diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CompactTorus.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CompactTorus.lean new file mode 100644 index 0000000000000000000000000000000000000000..d58291a4e9e3302adf631a700489156c2f465c10 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CompactTorus.lean @@ -0,0 +1,52 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.WeakLimit +import Mathlib.MeasureTheory.Constructions.Polish.Basic +import Mathlib.Topology.Instances.AddCircle.Real + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +abbrev SourceSamplingTorus := (SourceCoordinate → UnitAddCircle) × (SourceCoordinate → UnitAddCircle) + +instance sourceSamplingTorus_compact : CompactSpace SourceSamplingTorus := inferInstance + +instance sourceSamplingTorus_borel : BorelSpace SourceSamplingTorus := Prod.borelSpace + +def sourceSamplingTorusMap (p : SourceSamplingPair) : SourceSamplingTorus := + (fun i => (p.1 i : UnitAddCircle),fun i => (p.2 i : UnitAddCircle)) + +theorem sourceSamplingTorusMap_continuous : Continuous sourceSamplingTorusMap := by + exact (continuous_pi (fun i => (AddCircle.continuous_mk' (1 : ℝ)).comp + ((continuous_apply i).comp continuous_fst))).prodMk + (continuous_pi (fun i => (AddCircle.continuous_mk' (1 : ℝ)).comp + ((continuous_apply i).comp continuous_snd))) + +def sourceSamplingUntrimmedTorus (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : FiniteMeasure SourceSamplingTorus := + (sourceSamplingUntrimmedFinite I s θ).map sourceSamplingTorusMap + +def sourceSamplingLambdaTorus (I : Finset SourceCoordinate) : FiniteMeasure SourceSamplingTorus := + (sourceSamplingLambdaFinite I).map sourceSamplingTorusMap + +theorem sourceSamplingUntrimmed_torus_event : ∀ᵐ θ ∂sourceAngleLaw, + ∀ I : Finset SourceCoordinate, + Tendsto (fun s => sourceSamplingUntrimmedTorus I s θ) atTop + (𝓝 (sourceSamplingLambdaTorus I)) ∧ + ∀ f : C(SourceSamplingTorus,ℝ), + Tendsto (fun s => ∫ p, f p ∂(sourceSamplingUntrimmedTorus I s θ : Measure SourceSamplingTorus)) + atTop (𝓝 (∫ p, f p ∂(sourceSamplingLambdaTorus I : Measure SourceSamplingTorus))) := by + filter_upwards [sourceSamplingUntrimmed_weak_event] with θ hθ + intro I + have h := FiniteMeasure.tendsto_map_of_tendsto_of_continuous _ _ (hθ I) + sourceSamplingTorusMap_continuous + refine ⟨h,fun f => ?_⟩ + exact (FiniteMeasure.tendsto_iff_forall_integral_tendsto.mp h) + (BoundedContinuousFunction.mkOfCompact f) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CrossProducts.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CrossProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..f58969936a8b37397b8553a0cf7a00a7d88e6406 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CrossProducts.lean @@ -0,0 +1,98 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.ProductMoments +import OAI.Analysis.FiniteFactor.OrbitSampling.SingleCorrelation + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +noncomputable section + +/-- A global bound used only to justify finite-stage integrations. -/ +theorem sourceSamplingIdealDensity_bounds (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (x : SourceCoordinate → ℝ) : + 0 ≤ sourceSamplingIdealDensity stage r b E G x ∧ + sourceSamplingIdealDensity stage r b E G x ≤ + (max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)))^(sourceSamplingPrefix stage).card := by + have hp := sourceSampling_parameters stage + have hb (i : SourceCoordinate) := (sampling_kernel_mean unitIntervalMeasure + (samplingOrientedWeight r (b i) _ _ (E i) (G i)) + (samplingOrientedWeight_measurable r (b i) _ _ (E i) (G i) (hE i) (hG i)) + (max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage))) + (samplingOrientedWeight_bounds r (b i) _ _ (E i) (G i) hp.1 hp.2.2)).2 + refine ⟨prod_nonneg (fun i _ => (hb i (x i)).1),?_⟩ + calc + _ ≤ ∏ _i ∈ sourceSamplingPrefix stage, max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)) := + prod_le_prod₀ (fun i _ => (hb i (x i)).1) (fun i _ => (hb i (x i)).2) + _ = _ := by simp + +/-- Exact mixed factorization for q_n and the actual ideal density on the +full countable Haar space. -/ +theorem sourceSamplingProduct_mixed_factorization (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) (n : ℤ) : + (∫ x, ∫ θ, sourceSamplingProduct stage r b E G n θ x * sourceSamplingIdealDensity stage r b E G x + ∂sourceAngleLaw ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) = + ∏ i ∈ sourceSamplingPrefix stage, + ∫ s, samplingOrientedDensity r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) (E i) (G i) s * + (∫ θ, samplingOrientedWeight r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (E i) (G i) s (Int.fract ((n : ℝ)*θ i)) ∂sourceAngleLaw) ∂unitIntervalMeasure := by + let u (i : SourceCoordinate) := samplingOrientedWeight r (b i) (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) (E i) (G i) + let a (i : SourceCoordinate) := samplingOrientedDensity r (b i) (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) (E i) (G i) + let F (i : SourceCoordinate) (s t : ℝ) := u i s (Int.fract ((n : ℝ)*t))*a i s + have hF (i : SourceCoordinate) : Measurable (fun p : ℝ × ℝ => F i p.1 p.2) := by + have hu := samplingOrientedWeight_measurable r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (E i) (G i) (hE i) (hG i) + have ha := samplingOrientedDensity_measurable r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (E i) (G i) (hE i) (hG i) + exact (hu.comp (measurable_fst.prodMk (sourceFract_measurable.comp (measurable_const.mul measurable_snd)))).mul + (ha.comp measurable_fst) + calc + _ = ∫ x, ∏ i ∈ sourceSamplingPrefix stage, ∫ t, F i (x i) t ∂sourceAngleMarginal i + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure) := by + apply integral_congr_ae + filter_upwards [] with x + simp only [sourceSamplingProduct,sourceSamplingIdealDensity,← Finset.prod_mul_distrib] + exact integral_infinitePi_finset_prod _ _ _ + (fun i => (hF i).comp (measurable_const.prodMk measurable_id)) + _ = ∏ i ∈ sourceSamplingPrefix stage, ∫ s, ∫ t, F i s t ∂sourceAngleMarginal i ∂unitIntervalMeasure := + integral_infinitePi_finset_prod _ _ _ + (fun i => (hF i).stronglyMeasurable.integral_prod_right.measurable) + _ = _ := by + apply Finset.prod_congr rfl + intro i _ + apply integral_congr_ae + filter_upwards [] with s + have hm : Measurable (fun t => F i s t) := (hF i).comp (measurable_const.prodMk measurable_id) + rw [← sourceAngleLaw_coordinate i,integral_map (measurable_pi_apply i).aemeasurable hm.aestronglyMeasurable] + dsimp [F,u,a] + rw [integral_mul_const,mul_comm] + +/-- Fubini is justified for every finite-stage pair of actual summands. -/ +theorem sourceSamplingProduct_pair_integrable (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) (n k : ℤ) : + Integrable (fun p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) => + sourceSamplingProduct stage r b E G n p.1 p.2*sourceSamplingProduct stage r b E G k p.1 p.2) + (sourceAngleLaw.prod (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure))) := + sampling_bounded_product_integrable _ _ _ + (sourceSamplingProduct_measurable stage r b E G hE hG n) + (sourceSamplingProduct_measurable stage r b E G hE hG k) _ + (fun p => sourceSamplingProduct_bounds stage r b E G n p.1 p.2) + (fun p => sourceSamplingProduct_bounds stage r b E G k p.1 p.2) + +theorem sourceSamplingProduct_mixed_integrable (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) (n : ℤ) : + Integrable (fun p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) => + sourceSamplingProduct stage r b E G n p.1 p.2*sourceSamplingIdealDensity stage r b E G p.2) + (sourceAngleLaw.prod (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure))) := + sampling_bounded_product_integrable _ _ _ + (sourceSamplingProduct_measurable stage r b E G hE hG n) + ((sourceSamplingIdealDensity_measurable stage r b E G hE hG).comp measurable_snd) _ + (fun p => sourceSamplingProduct_bounds stage r b E G n p.1 p.2) + (fun p => sourceSamplingIdealDensity_bounds stage r b E G hE hG p.2) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Cube.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Cube.lean new file mode 100644 index 0000000000000000000000000000000000000000..875860200cc09c14a12e4e4b2ed0318104fabbd5 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Cube.lean @@ -0,0 +1,84 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.LambdaRectangles + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +abbrev SourceSamplingPair := (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) + +def sourceSamplingCube : Set SourceSamplingPair := + {p | ∀ i, p.1 i ∈ Set.Icc (0 : ℝ) 1 ∧ p.2 i ∈ Set.Icc (0 : ℝ) 1} + +theorem sourceSamplingCube_measurable : MeasurableSet sourceSamplingCube := by + exact sourceSamplingRectangle_measurable _ _ (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc) + +instance sourceSamplingUntrimmed_finite (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : IsFiniteMeasure (sourceSamplingUntrimmed I s θ) := by + constructor + unfold sourceSamplingUntrimmed + rw [Measure.smul_apply, smul_eq_mul] + exact ENNReal.mul_lt_top ENNReal.ofReal_lt_top (measure_lt_top _ _) + +theorem sourceSamplingSummand_cube (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) : + ∀ᵐ p ∂sourceSamplingSummand I s θ n, p ∈ sourceSamplingCube := by + apply (ae_map_iff (measurable_id.prodMk (coordinateRotate_preserving θ n).measurable).aemeasurable + sourceSamplingCube_measurable).mpr + have hh : ∀ᵐ x ∂sourceSamplingWeightedMeasure I s θ n, ∀ i, x i ∈ Set.Ico (0 : ℝ) 1 := + ae_iff.mpr (withDensity_absolutelyContinuous _ _ (ae_iff.mp sourceSamplingHaar_cube)) + filter_upwards [hh] with x hx + intro i + exact ⟨⟨(hx i).1,(hx i).2.le⟩,Int.fract_nonneg _,(Int.fract_lt_one _).le⟩ + +theorem sourceSamplingUntrimmed_cube (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : + ∀ᵐ p ∂sourceSamplingUntrimmed I s θ, p ∈ sourceSamplingCube := by + apply Measure.ae_smul_measure + rw [ae_iff, Measure.finsetSum_apply] + apply Finset.sum_eq_zero + intro n hn + exact ae_iff.mp (sourceSamplingSummand_cube I s θ n) + +theorem sourceSamplingLambda_cube (I : Finset SourceCoordinate) : + ∀ᵐ p ∂sourceSamplingLambda I, p ∈ sourceSamplingCube := by + apply (ae_map_iff (sourceSamplingLimitMap_measurable I).aemeasurable + sourceSamplingCube_measurable).mpr + filter_upwards [ae_restrict_of_ae sourceSamplingPairHaar_cube] with p hp + intro i + refine ⟨⟨(hp i).1.1,(hp i).1.2.le⟩,?_⟩ + by_cases hi : i ∈ I + · simpa [sourceSamplingLimitMap,hi] using And.intro (hp i).2.1 (hp i).2.2.le + · simpa [sourceSamplingLimitMap,hi] using And.intro (hp i).1.1 (hp i).1.2.le + +def sourceSamplingEmptyTest : SourceSamplingRationalTest := ⟨∅,fun _ => ((0,1),(0,1))⟩ + +theorem sourceSamplingEmptyTest_rectangle : + sourceSamplingRectangle (sourceSamplingRationalX sourceSamplingEmptyTest) + (sourceSamplingRationalY sourceSamplingEmptyTest) = sourceSamplingCube := by + ext p + simp [sourceSamplingRectangle,sourceSamplingRationalX,sourceSamplingRationalY, + sourceSamplingRationalEndpoints,sourceSamplingEmptyTest,sourceSamplingCube] + +/-- The empty rational test gives actual total-mass convergence. -/ +theorem sourceSampling_mass_limit_event : ∀ᵐ θ ∂sourceAngleLaw, + ∀ I : Finset SourceCoordinate, + Tendsto (fun s => ((sourceSamplingUntrimmed I s θ) Set.univ).toReal) + atTop (𝓝 (((sourceSamplingLambda I) Set.univ).toReal)) := by + filter_upwards [sourceSamplingLambda_rectangle_limit_event] with θ hθ + intro I + have h := hθ I sourceSamplingEmptyTest + rw [sourceSamplingEmptyTest_rectangle] at h + have hu (s : ℕ) : sourceSamplingUntrimmed I s θ sourceSamplingCube = + sourceSamplingUntrimmed I s θ Set.univ := + measure_congr (by filter_upwards [sourceSamplingUntrimmed_cube I s θ] with p hp; exact propext (iff_true_intro hp)) + have hl : sourceSamplingLambda I sourceSamplingCube = sourceSamplingLambda I Set.univ := + measure_congr (by filter_upwards [sourceSamplingLambda_cube I] with p hp; exact propext (iff_true_intro hp)) + simpa only [hu,hl] using h + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CutoffMass.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CutoffMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..2bfef62aadc532bbbbb2e3225cc1e099f6beba47 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CutoffMass.lean @@ -0,0 +1,92 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.DiagonalIntegral + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +/-- Exact whole-circle first density, including the retained cutoff. -/ +theorem samplingTestedFirstDensity_whole (b : Bool) (h α s : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hs : s ∈ Set.Ico (0 : ℝ) 1) : + samplingTestedFirstDensity b h α (Set.Icc 0 1) (Set.Icc 0 1) s = + if b then 1-s else if α ≤ samplingDistance s then 1 else 0 := by + have he : samplingTestedFirstDensity b h α (Set.Icc 0 1) (Set.Icc 0 1) s = + ∫ t, samplingWeight b h α s t ∂unitIntervalMeasure := by + apply integral_congr_ae + filter_upwards [] with t + have hs' : s ∈ Set.Icc (0 : ℝ) 1 := ⟨hs.1,hs.2.le⟩ + have ht' : Int.fract (s+t) ∈ Set.Icc (0 : ℝ) 1 := ⟨Int.fract_nonneg _,(Int.fract_lt_one _).le⟩ + simp only [samplingTestedFirstWeight,hs',ht',and_self,ite_true] + exact he.trans (samplingWeight_first_integral b h α s hh hh1 hα hs) + +/-- The exact lost mass of one untested diagonal coordinate is 2α. -/ +theorem sampling_diagonal_whole_mass (h α : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hα1 : α ≤ 1/2) : + (∫ s, samplingTestedFirstDensity false h α (Set.Icc 0 1) (Set.Icc 0 1) s ∂unitIntervalMeasure) = 1-2*α := by + have he : samplingTestedFirstDensity false h α (Set.Icc 0 1) (Set.Icc 0 1) =ᵐ[unitIntervalMeasure] + (Set.Icc α (1-α)).indicator (fun _ => (1 : ℝ)) := by + filter_upwards [ae_restrict_mem measurableSet_Ico] with s hs + rw [samplingTestedFirstDensity_whole false h α s hh hh1 hα hs] + have hc : α ≤ samplingDistance s ↔ s ∈ Set.Icc α (1-α) := by + simp only [samplingDistance,le_min_iff,Set.mem_Icc] + constructor <;> intro h <;> constructor <;> linarith [h.1,h.2] + simp only [Bool.false_eq_true,ite_false,hc,Set.indicator_apply] + rw [integral_congr_ae he,integral_indicator measurableSet_Icc,integral_const] + have hsub : Set.Icc α (1-α) ⊆ Set.Ico (0 : ℝ) 1 := by + intro s hs + exact ⟨hα.le.trans hs.1,hs.2.trans_lt (by linarith)⟩ + simp only [measureReal_def,Measure.restrict_apply MeasurableSet.univ,Set.univ_inter, + smul_eq_mul,mul_one] + unfold unitIntervalMeasure + rw [Measure.restrict_apply measurableSet_Icc,Set.inter_eq_left.mpr hsub,Real.volume_Icc, + ENNReal.toReal_ofReal (by linarith)] + ring + +/-- The total cutoff budget tends to zero despite the growing dimension. -/ +theorem sourceSampling_cutoff_budget_tendsto : + Tendsto (fun stage => 2*((sourceSamplingPrefix stage).card : ℝ)*sourceSamplingCutoff stage) + atTop (𝓝 0) := by + have ht : Tendsto (fun stage => (101/50 : ℝ)*(sourceBlockSize stage : ℝ)⁻¹) atTop (𝓝 0) := by + simpa using (tendsto_inv_atTop_zero.comp + (tendsto_natCast_atTop_atTop.comp sourceBlockSize_tendsto)).const_mul (101/50 : ℝ) + apply squeeze_zero (fun stage => by have := (sourceSampling_parameters stage).2.2; positivity) _ ht + intro stage + have hm := sourceBlockSize_pos stage + calc + _ ≤ 2*((101/100 : ℝ)*sourceBlockSize stage)*sourceSamplingCutoff stage := by + exact mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (sourceSamplingPrefix_card_bound stage) (by norm_num)) + (sourceSampling_parameters stage).2.2.le + _ = (101/50 : ℝ)*(sourceBlockSize stage : ℝ)⁻¹ := by + simp only [sourceSamplingCutoff,Real.rpow_neg hm.le,Real.rpow_two] + field_simp + ring + +/-- Any subset of untested coordinates retains asymptotically all its mass. +The estimate uses its actual varying cardinality, bounded by the prefix. -/ +theorem sourceSampling_untested_mass_tendsto (k : ℕ → ℕ) + (hk : ∀ stage, k stage ≤ (sourceSamplingPrefix stage).card) : + Tendsto (fun stage => (1-2*sourceSamplingCutoff stage)^(k stage)) atTop (𝓝 1) := by + have he : ∀ stage, |(1-2*sourceSamplingCutoff stage)^(k stage)-1| ≤ + 2*((sourceSamplingPrefix stage).card : ℝ)*sourceSamplingCutoff stage := by + intro stage + have hα := (sourceSampling_parameters stage).2.2 + have hα1 := sourceSamplingCutoff_le_half stage + have hlo : 0 ≤ 1-2*sourceSamplingCutoff stage := by linarith + have hup : (1-2*sourceSamplingCutoff stage)^(k stage) ≤ 1 := pow_le_one₀ hlo (by linarith) + have hb := one_add_mul_le_pow (show (-2 : ℝ) ≤ -(2*sourceSamplingCutoff stage) by linarith) (k stage) + have hk' : (k stage : ℝ) ≤ (sourceSamplingPrefix stage).card := by exact_mod_cast hk stage + rw [abs_of_nonpos (by linarith)] + have hm := mul_le_mul_of_nonneg_right hk' (show 0 ≤ 2*sourceSamplingCutoff stage by positivity) + simp only [mul_neg,← sub_eq_add_neg] at hb + nlinarith + apply tendsto_iff_norm_sub_tendsto_zero.mpr + simp only [Real.norm_eq_abs] + exact squeeze_zero (fun stage => abs_nonneg _) he sourceSampling_cutoff_budget_tendsto + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CylinderBasis.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CylinderBasis.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b94f1277d095e45d6bbd009d82e7734ee202add --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CylinderBasis.lean @@ -0,0 +1,63 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.CylinderSystem + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +theorem rational_Icc_nhds {x : ℝ} {u : Set ℝ} (hu : u ∈ 𝓝 x) : + ∃ a b : ℚ, Set.Icc (a : ℝ) b ∈ 𝓝 x ∧ Set.Icc (a : ℝ) b ⊆ u := by + obtain ⟨l,r,hlr,hsub⟩ := mem_nhds_iff_exists_Ioo_subset.mp hu + obtain ⟨a,hla,hax⟩ := exists_rat_btwn hlr.1 + obtain ⟨b,hxb,hbr⟩ := exists_rat_btwn hlr.2 + exact ⟨a,b,Icc_mem_nhds hax hxb,fun y hy => hsub ⟨hla.trans_le hy.1,hy.2.trans_lt hbr⟩⟩ + +/-- The finite rational cylinders contain arbitrarily small neighborhoods +in the full real product, including points outside the unit cube. -/ +theorem sourceSamplingCylinder_basis (u : Set SourceSamplingPair) (hu : IsOpen u) + (p : SourceSamplingPair) (hp : p ∈ u) : + ∃ s ∈ Set.range sourceSamplingCylinder, s ∈ 𝓝 p ∧ s ⊆ u := by + obtain ⟨ux,hux,uy,huy,hxy⟩ := mem_nhds_prod_iff.mp (hu.mem_nhds hp) + rw [nhds_pi,Filter.mem_pi'] at hux huy + obtain ⟨Kx,tx,htx,hsubx⟩ := hux + obtain ⟨Ky,ty,hty,hsuby⟩ := huy + choose ax bx hnx hsx using fun i => rational_Icc_nhds (htx i) + choose ay by' hny hsy using fun i => rational_Icc_nhds (hty i) + let T : SourceSamplingRationalTest := ⟨Kx ∪ Ky,fun i => ((ax i,bx i),(ay i,by' i))⟩ + have hTx (i : SourceCoordinate) (hi : i ∈ T.1) : + sourceSamplingRationalX T i = Set.Icc (ax i : ℝ) (bx i) := by + simp [sourceSamplingRationalX,sourceSamplingRationalEndpoints,hi,T] + have hTy (i : SourceCoordinate) (hi : i ∈ T.1) : + sourceSamplingRationalY T i = Set.Icc (ay i : ℝ) (by' i) := by + simp [sourceSamplingRationalY,sourceSamplingRationalEndpoints,hi,T] + refine ⟨sourceSamplingCylinder T,⟨T,rfl⟩,?_,?_⟩ + · have he : sourceSamplingCylinder T = ⋂ i ∈ T.1, + {q : SourceSamplingPair | q.1 i ∈ sourceSamplingRationalX T i ∧ + q.2 i ∈ sourceSamplingRationalY T i} := by ext q; simp [sourceSamplingCylinder] + rw [he] + apply (Filter.biInter_mem (Set.toFinite (T.1 : Set SourceCoordinate))).mpr + intro i hi + have hx := ((continuous_apply i).comp continuous_fst).continuousAt (hnx i) + have hy := ((continuous_apply i).comp continuous_snd).continuousAt (hny i) + change {q : SourceSamplingPair | q.1 i ∈ Set.Icc (ax i : ℝ) (bx i)} ∈ 𝓝 p at hx + change {q : SourceSamplingPair | q.2 i ∈ Set.Icc (ay i : ℝ) (by' i)} ∈ 𝓝 p at hy + filter_upwards [hx,hy] with q hq1 hq2 + exact ⟨by simpa only [hTx i hi] using hq1,by simpa only [hTy i hi] using hq2⟩ + · intro q hq + apply hxy + constructor + · apply hsubx + intro i hi + have hmem : i ∈ T.1 := Finset.mem_union_left _ hi + exact hsx i (by simpa only [hTx i hmem] using (hq i hmem).1) + · apply hsuby + intro i hi + have hmem : i ∈ T.1 := Finset.mem_union_right _ hi + exact hsy i (by simpa only [hTy i hmem] using (hq i hmem).2) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CylinderSystem.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CylinderSystem.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc3c80feb9f1d13de6a329f44f835c87e1f4f8dd --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/CylinderSystem.lean @@ -0,0 +1,75 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.Cube +import Mathlib.Topology.Instances.Rat + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +/-- Finite cylinders in the full real product: coordinates outside the +finite support are unrestricted. On the conull cube these are the original +rational tests. The ambient real product is not asserted to be compact. -/ +def sourceSamplingCylinder (T : SourceSamplingRationalTest) : Set SourceSamplingPair := + {p | ∀ i ∈ T.1, p.1 i ∈ sourceSamplingRationalX T i ∧ p.2 i ∈ sourceSamplingRationalY T i} + +theorem sourceSamplingCylinder_measurable (T : SourceSamplingRationalTest) : + MeasurableSet (sourceSamplingCylinder T) := by + simp only [sourceSamplingCylinder,Set.ofPred_forall] + exact MeasurableSet.iInter (fun i => MeasurableSet.iInter (fun _ => + (measurableSet_Icc.preimage ((measurable_pi_apply i).comp measurable_fst)).inter + (measurableSet_Icc.preimage ((measurable_pi_apply i).comp measurable_snd)))) + +theorem sourceSamplingCylinder_on_cube (T : SourceSamplingRationalTest) (p : SourceSamplingPair) + (hp : p ∈ sourceSamplingCube) : + p ∈ sourceSamplingCylinder T ↔ + p ∈ sourceSamplingRectangle (sourceSamplingRationalX T) (sourceSamplingRationalY T) := by + constructor + · intro h i + by_cases hi : i ∈ T.1 + · exact h i hi + · simpa [sourceSamplingRationalX,sourceSamplingRationalY,sourceSamplingRationalEndpoints,hi] + using hp i + · intro h i _ + exact h i + +def sourceSamplingTestMeet (T U : SourceSamplingRationalTest) : SourceSamplingRationalTest := + ⟨T.1 ∪ U.1,fun i => + if i.1 ∈ T.1 then + if i.1 ∈ U.1 then + ((max (sourceSamplingRationalEndpoints T i).1.1 (sourceSamplingRationalEndpoints U i).1.1, + min (sourceSamplingRationalEndpoints T i).1.2 (sourceSamplingRationalEndpoints U i).1.2), + (max (sourceSamplingRationalEndpoints T i).2.1 (sourceSamplingRationalEndpoints U i).2.1, + min (sourceSamplingRationalEndpoints T i).2.2 (sourceSamplingRationalEndpoints U i).2.2)) + else sourceSamplingRationalEndpoints T i + else sourceSamplingRationalEndpoints U i⟩ + +theorem sourceSamplingCylinder_inter (T U : SourceSamplingRationalTest) : + sourceSamplingCylinder (sourceSamplingTestMeet T U) = + sourceSamplingCylinder T ∩ sourceSamplingCylinder U := by + have hcoord (p : SourceSamplingPair) (i : SourceCoordinate) : + (i ∈ T.1 ∪ U.1 → p.1 i ∈ sourceSamplingRationalX (sourceSamplingTestMeet T U) i ∧ + p.2 i ∈ sourceSamplingRationalY (sourceSamplingTestMeet T U) i) ↔ + (i ∈ T.1 → p.1 i ∈ sourceSamplingRationalX T i ∧ p.2 i ∈ sourceSamplingRationalY T i) ∧ + (i ∈ U.1 → p.1 i ∈ sourceSamplingRationalX U i ∧ p.2 i ∈ sourceSamplingRationalY U i) := by + by_cases ht : i ∈ T.1 <;> by_cases hu : i ∈ U.1 <;> + simp [sourceSamplingRationalX,sourceSamplingRationalY,sourceSamplingRationalEndpoints, + sourceSamplingTestMeet,ht,hu,Set.mem_Icc] + tauto + ext p + change (∀ i, i ∈ T.1 ∪ U.1 → _) ↔ (∀ i, i ∈ T.1 → _) ∧ (∀ i, i ∈ U.1 → _) + constructor + · intro h + exact ⟨fun i => ((hcoord p i).mp (h i)).1,fun i => ((hcoord p i).mp (h i)).2⟩ + · rintro ⟨hT,hU⟩ i + exact (hcoord p i).mpr ⟨hT i,hU i⟩ + +theorem sourceSamplingCylinder_piSystem : IsPiSystem (Set.range sourceSamplingCylinder) := by + rintro _ ⟨T,rfl⟩ _ ⟨U,rfl⟩ _ + exact ⟨sourceSamplingTestMeet T U,sourceSamplingCylinder_inter T U⟩ + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalContribution.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalContribution.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d1401c810dfc682fc3dd8435124b2356629f139 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalContribution.lean @@ -0,0 +1,69 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.SelfSummability + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +noncomputable section + +/-- The self-pair part of the empirical squared norm, with its actual P^-2 weight. -/ +def sourceSamplingDiagonalContribution (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (θ : SourceCoordinate → ℝ) : ℝ := + (∑ n ∈ sourceSamplingPowers stage, + ∫ x, sourceSamplingProduct stage r b E G n θ x ^ 2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) / ((sourceSamplingPowers stage).card : ℝ)^2 + +theorem sourceSamplingDiagonalContribution_nonneg (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (θ : SourceCoordinate → ℝ) : + 0 ≤ sourceSamplingDiagonalContribution stage r b E G θ := + div_nonneg (sum_nonneg (fun _ _ => integral_nonneg (fun _ => sq_nonneg _))) (sq_nonneg _) + +theorem sourceSamplingProduct_square_integrable (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) (n : ℤ) : + Integrable (fun p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) => + sourceSamplingProduct stage r b E G n p.1 p.2 ^ 2) + (sourceAngleLaw.prod (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure))) := + sampling_square_integrable _ _ + ((max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)))^(sourceSamplingPrefix stage).card) + (sourceSamplingProduct_measurable stage r b E G hE hG n) + (fun p => sourceSamplingProduct_bounds stage r b E G n p.1 p.2) + +theorem sourceSamplingDiagonalContribution_integrable (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + Integrable (sourceSamplingDiagonalContribution stage r b E G) sourceAngleLaw := by + apply Integrable.div_const + exact integrable_finsetSum _ (fun n _ => + (sourceSamplingProduct_square_integrable stage r b E G hE hG n).integral_prod_left) + +/-- The diagonal contribution's expectation is bounded by the proved +summable budget; the finite set is the actual deterministic sample set. -/ +theorem sourceSamplingDiagonalContribution_expectation (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (r : Bool) (b : SourceCoordinate → Bool) (E G : SourceCoordinate → Set ℝ) + (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + (∫ θ, sourceSamplingDiagonalContribution stage r b E G θ ∂sourceAngleLaw) ≤ sourceSamplingSelfBudget stage := by + have hP : (0 : ℝ) < (sourceSamplingPowers stage).card := + (Real.rpow_pos_of_pos (sourceBlockSize_pos stage) _).trans_le (sourceSamplingPowers_spec stage hs).2.1 + unfold sourceSamplingDiagonalContribution + rw [integral_div,integral_finsetSum _ (fun n _ => + (sourceSamplingProduct_square_integrable stage r b E G hE hG n).integral_prod_left)] + have hsum := Finset.sum_le_sum (fun n hn => sourceSamplingProduct_self_moment stage hs r b E G hE hG n hn) + simp only [Finset.sum_const,nsmul_eq_mul] at hsum + calc + _ ≤ ((sourceSamplingPowers stage).card : ℝ)* + (2+8*(sourceBlockSize stage : ℝ)^(3/5 : ℝ)*Real.log (sourceBlockSize stage : ℝ))^(sourceSamplingPrefix stage).card / + ((sourceSamplingPowers stage).card : ℝ)^2 := div_le_div_of_nonneg_right hsum (sq_nonneg _) + _ = _ := by unfold sourceSamplingSelfBudget; field_simp + +/-- Actual self-pair expectations are summable across the constructed stages. -/ +theorem sourceSamplingDiagonalContribution_summable_integral (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + Summable (fun stage => ∫ θ, sourceSamplingDiagonalContribution stage r b E G θ ∂sourceAngleLaw) := by + apply sourceSamplingSelfBudget_summable.of_norm_bounded_eventually_nat + filter_upwards [sourceBlockSize_tendsto.eventually (eventually_ge_atTop 200000)] with stage hs + rw [Real.norm_eq_abs,abs_of_nonneg (integral_nonneg (sourceSamplingDiagonalContribution_nonneg stage r b E G))] + exact sourceSamplingDiagonalContribution_expectation stage hs r b E G hE hG + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalEvent.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalEvent.lean new file mode 100644 index 0000000000000000000000000000000000000000..c1698a544125c54eb95ce5799ae4cfd3d5d0abd4 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalEvent.lean @@ -0,0 +1,65 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.DiagonalContribution +import Mathlib.MeasureTheory.Integral.Lebesgue.Markov + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped ENNReal Topology +noncomputable section + +/-- Tonelli converts summable expectations of nonnegative functions into +pointwise summability on a conull event. -/ +theorem sampling_ae_summable_of_integrals {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) (f : ℕ → Ω → ℝ) (hm : ∀ n, Measurable (f n)) + (hi : ∀ n, Integrable (f n) μ) (hn : ∀ n x, 0 ≤ f n x) + (hs : Summable (fun n => ∫ x, f n x ∂μ)) : + ∀ᵐ x ∂μ, Summable (fun n => f n x) := by + have he (n : ℕ) : (∫⁻ x, ENNReal.ofReal (f n x) ∂μ) = ENNReal.ofReal (∫ x, f n x ∂μ) := + (ofReal_integral_eq_lintegral_ofReal (hi n) (Eventually.of_forall (hn n))).symm + have hfin : (∫⁻ x, ∑' n, ENNReal.ofReal (f n x) ∂μ) ≠ ∞ := by + rw [lintegral_tsum (fun n => (hm n).ennreal_ofReal.aemeasurable)] + simp_rw [he] + exact hs.tsum_ofReal_ne_top + have hm' : Measurable (fun x => ∑' n, ENNReal.ofReal (f n x)) := + Measurable.tsum (fun n => (hm n).ennreal_ofReal) + filter_upwards [ae_lt_top hm' hfin] with x hx + exact (ENNReal.summable_toReal hx.ne).congr (fun n => ENNReal.toReal_ofReal (hn n x)) + +theorem sourceSamplingDiagonalContribution_measurable (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + Measurable (sourceSamplingDiagonalContribution stage r b E G) := by + apply Measurable.div_const + apply Finset.measurable_sum + intro n _ + exact ((sourceSamplingProduct_measurable stage r b E G hE hG n).pow_const 2).stronglyMeasurable.integral_prod_right.measurable + +/-- A genuine conull conclusion for the actual diagonal contribution. +This does not assert convergence of the full empirical sampling error. -/ +theorem sourceSamplingDiagonalContribution_ae (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + ∀ᵐ θ ∂sourceAngleLaw, + Summable (fun stage => sourceSamplingDiagonalContribution stage r b E G θ) ∧ + Tendsto (fun stage => sourceSamplingDiagonalContribution stage r b E G θ) atTop (𝓝 0) := by + have ha := sampling_ae_summable_of_integrals sourceAngleLaw + (fun stage θ => sourceSamplingDiagonalContribution stage r b E G θ) + (fun stage => sourceSamplingDiagonalContribution_measurable stage r b E G hE hG) + (fun stage => sourceSamplingDiagonalContribution_integrable stage r b E G hE hG) + (fun stage θ => sourceSamplingDiagonalContribution_nonneg stage r b E G θ) + (sourceSamplingDiagonalContribution_summable_integral r b E G hE hG) + exact ha.mono (fun θ hθ => ⟨hθ,hθ.tendsto_atTop_zero⟩) + +/-- One conull event handles every member of any countable family of source +tests, orientations and triangular-coordinate choices for the diagonal term. -/ +theorem sourceSamplingDiagonalContribution_countable_event {ι : Type*} [Countable ι] + (r : ι → Bool) (b : ι → SourceCoordinate → Bool) (E G : ι → SourceCoordinate → Set ℝ) + (hE : ∀ j i, MeasurableSet (E j i)) (hG : ∀ j i, MeasurableSet (G j i)) : + ∀ᵐ θ ∂sourceAngleLaw, ∀ j, + Summable (fun stage => sourceSamplingDiagonalContribution stage (r j) (b j) (E j) (G j) θ) ∧ + Tendsto (fun stage => sourceSamplingDiagonalContribution stage (r j) (b j) (E j) (G j) θ) atTop (𝓝 0) := + (ae_all_iff).mpr (fun j => sourceSamplingDiagonalContribution_ae (r j) (b j) (E j) (G j) (hE j) (hG j)) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalIntegral.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf3017b74ce620092d5f5bddc34ee6e990bd361b --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalIntegral.lean @@ -0,0 +1,59 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.DiagonalLimit + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +/-- The actual one-coordinate diagonal model converges to uniform diagonal +mass on every measurable first test and closed-interval second test. -/ +theorem sourceSampling_diagonal_integral_tendsto (E : Set ℝ) (hE : MeasurableSet E) (a c : ℝ) : + Tendsto (fun stage => ∫ s, + samplingTestedFirstDensity false (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + E (Set.Icc a c) s ∂unitIntervalMeasure) + atTop (𝓝 ((unitIntervalMeasure (E ∩ Set.Icc a c)).toReal)) := by + have : NullSingletonClass unitIntervalMeasure := by unfold unitIntervalMeasure; infer_instance + let f : ℝ → ℝ := (E ∩ Set.Icc a c).indicator (fun _ => 1) + have hlim : ∀ᵐ s ∂unitIntervalMeasure, + Tendsto (fun stage => samplingTestedFirstDensity false + (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E (Set.Icc a c) s) + atTop (𝓝 (f s)) := by + filter_upwards [ae_restrict_mem measurableSet_Ico,unitIntervalMeasure.ae_ne 0, + unitIntervalMeasure.ae_ne a,unitIntervalMeasure.ae_ne c] with s hs hs0 hsa hsc + have hh := sourceSampling_diagonal_eventually s a c E ⟨lt_of_le_of_ne hs.1 (Ne.symm hs0),hs.2⟩ hsa hsc + have he : (fun stage => samplingTestedFirstDensity false (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) E (Set.Icc a c) s) =ᶠ[atTop] (fun _ => f s) := by + filter_upwards [hh] with stage hstage + simpa only [f,Set.indicator_apply,Set.mem_inter_iff] using hstage + exact tendsto_const_nhds.congr' he.symm + have hm (stage : ℕ) : AEStronglyMeasurable + (samplingTestedFirstDensity false (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + E (Set.Icc a c)) unitIntervalMeasure := (samplingTestedFirstDensity_measurable false + (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E (Set.Icc a c) hE measurableSet_Icc).aestronglyMeasurable + have hb (stage : ℕ) : ∀ᵐ s ∂unitIntervalMeasure, + ‖samplingTestedFirstDensity false (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + E (Set.Icc a c) s‖ ≤ (1 : ℝ) := by + filter_upwards [ae_restrict_mem measurableSet_Ico] with s hs + have hp := sourceSampling_parameters stage + have h := samplingTestedFirstDensity_bounds false _ _ E (Set.Icc a c) + hp.1 hp.2.1 hp.2.2 hE measurableSet_Icc s hs + rw [Real.norm_eq_abs,abs_of_nonneg h.1] + exact h.2 + have ht := tendsto_integral_of_dominated_convergence (fun _ : ℝ => (1 : ℝ)) hm (integrable_const 1) hb hlim + have hf : (∫ s, f s ∂unitIntervalMeasure) = (unitIntervalMeasure (E ∩ Set.Icc a c)).toReal := by + rw [integral_indicator (hE.inter measurableSet_Icc)] + simp [measureReal_def] + rwa [hf] at ht + +/-- Triangular tested factors are independent of the sampling width and cutoff. -/ +theorem samplingTestedFirstDensity_triangular_parameters (h α h' α' s : ℝ) (E G : Set ℝ) : + samplingTestedFirstDensity true h α E G s = samplingTestedFirstDensity true h' α' E G s := by + unfold samplingTestedFirstDensity samplingTestedFirstWeight samplingWeight + simp only [ite_true] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalLimit.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..c1150e06c2141e534c67776970681e6346699b69 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/DiagonalLimit.lean @@ -0,0 +1,94 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.RationalTests +import Mathlib.MeasureTheory.Integral.DominatedConvergence + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +theorem sourceSamplingWidth_tendsto : Tendsto sourceSamplingWidth atTop (𝓝 0) := by + have hh := (tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 3/5)).comp + (tendsto_natCast_atTop_atTop.comp sourceBlockSize_tendsto) + convert hh using 1 + funext stage + simp only [sourceSamplingWidth,Function.comp_apply] + congr 1; norm_num + +theorem sourceSamplingCutoff_tendsto : Tendsto sourceSamplingCutoff atTop (𝓝 0) := by + have hh := (tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 2)).comp + (tendsto_natCast_atTop_atTop.comp sourceBlockSize_tendsto) + exact hh + +theorem sampling_interval_small_displacement (s a c t : ℝ) + (_ha : s ≠ a) (hc : s ≠ c) (ht : 0 ≤ t) + (hta : t < |s-a|) (htc : t < |s-c|) : + s+t ∈ Set.Icc a c ↔ s ∈ Set.Icc a c := by + have hleft : a ≤ s+t ↔ a ≤ s := by + by_cases h : a ≤ s + · constructor + · exact fun _ => h + · intro _; linarith + · rw [abs_of_neg (by linarith : s-a < 0)] at hta + constructor <;> intro hh <;> linarith + have hright : s+t ≤ c ↔ s ≤ c := by + by_cases h : s ≤ c + · have hsc : s < c := lt_of_le_of_ne h hc + rw [abs_of_neg (by linarith : s-c < 0)] at htc + constructor <;> intro hh <;> linarith + · constructor <;> intro hh <;> linarith + exact and_congr hleft hright + +/-- Away from the interval endpoints, a sufficiently short retained diagonal +step has exactly the same interval test as its starting coordinate. -/ +theorem samplingTestedFirstDensity_diagonal_exact (h α s a c : ℝ) (E : Set ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (hs : s ∈ Set.Ico (0 : ℝ) 1) (hcut : α ≤ samplingDistance s) + (ha : s ≠ a) (hc : s ≠ c) (hha : h < |s-a|) (hhc : h < |s-c|) : + samplingTestedFirstDensity false h α E (Set.Icc a c) s = + if s ∈ E ∧ s ∈ Set.Icc a c then 1 else 0 := by + have he (t : ℝ) : samplingTestedFirstWeight false h α E (Set.Icc a c) s t = + if s ∈ E ∧ s ∈ Set.Icc a c then samplingWeight false h α s t else 0 := by + by_cases hw : samplingWeight false h α s t = 0 + · simp [samplingTestedFirstWeight,hw] + · have ho := samplingWeight_orders false h α s t hh hh1 hα hs hw + have hsp : 0 < t ∧ t < h*samplingDistance s := by + unfold samplingWeight at hw + simp only [Bool.false_eq_true,ite_false] at hw + split_ifs at hw with hcond + · exact hcond.2 + · exact False.elim (hw rfl) + have hd : samplingDistance s ≤ 1 := (min_le_right s (1-s)).trans (by linarith [hs.1]) + have hth : t < h := hsp.2.trans_le (by nlinarith) + have hmem := sampling_interval_small_displacement s a c t ha hc hsp.1.le + (hth.trans hha) (hth.trans hhc) + simp only [samplingTestedFirstWeight,ho.1,hmem] + unfold samplingTestedFirstDensity + simp_rw [he] + by_cases htest : s ∈ E ∧ s ∈ Set.Icc a c + · simp only [ite_eq_left htest] + simpa only [Bool.false_eq_true,ite_false,ite_eq_left hcut] using + samplingWeight_first_integral false h α s hh hh1 hα hs + · simp only [ite_eq_right htest,integral_zero] + +/-- At each interior starting point away from the two tested endpoints, the +actual diagonal density eventually equals the uniform diagonal test. -/ +theorem sourceSampling_diagonal_eventually (s a c : ℝ) (E : Set ℝ) + (hs : s ∈ Set.Ioo (0 : ℝ) 1) (ha : s ≠ a) (hc : s ≠ c) : + ∀ᶠ stage in atTop, + samplingTestedFirstDensity false (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + E (Set.Icc a c) s = if s ∈ E ∧ s ∈ Set.Icc a c then 1 else 0 := by + have hd : 0 < samplingDistance s := lt_min hs.1 (by linarith [hs.2]) + have hcut := sourceSamplingCutoff_tendsto.eventually (gt_mem_nhds hd) + have hwa := sourceSamplingWidth_tendsto.eventually (gt_mem_nhds (abs_pos.mpr (sub_ne_zero.mpr ha))) + have hwc := sourceSamplingWidth_tendsto.eventually (gt_mem_nhds (abs_pos.mpr (sub_ne_zero.mpr hc))) + filter_upwards [hcut,hwa,hwc] with stage hcut hwa hwc + have hp := sourceSampling_parameters stage + exact samplingTestedFirstDensity_diagonal_exact _ _ s a c E hp.1 hp.2.1 hp.2.2 + ⟨hs.1.le,hs.2⟩ hcut.le ha hc hwa hwc + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Discrepancy.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Discrepancy.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca269087e240cb314d1dc57176df3299a05fcc32 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Discrepancy.lean @@ -0,0 +1,111 @@ +import OAI.Analysis.FiniteFactor.Sampling.Rectangle +import OAI.Analysis.FiniteFactor.OrbitSampling.Fourier +import OAI.Analysis.FiniteFactor.Sampling.Periodization + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Finset Filter +open scoped ENNReal Topology +noncomputable section + +/-- Every constructed power is long enough for density at most two on +every coordinate in the sampling prefix. -/ +theorem sourceSampling_phase_length (s : ℕ) (hs : 200000 ≤ sourceBlockSize s) + (i : SourceCoordinate) (hi : i.1 ≤ s) (n : ℤ) (hn : n ∈ sourceSamplingPowers s) : + 1 ≤ (n : ℝ)*sourceAngleUnit i := by + have hm : (200000 : ℝ) ≤ sourceBlockSize s := by exact_mod_cast hs + have hm0 := sourceBlockSize_pos s + have hspec := (sourceSamplingPowers_spec s hs).1 n hn + have hQ : (sourceBlockSize s : ℝ)^3 ≤ samplingQ (sourceBlockSize s) := by + unfold samplingQ + rw [← Real.rpow_natCast] + exact Real.rpow_le_rpow_of_exponent_le (by linarith) (by norm_num; linarith) + have hN : (sourceBlockSize i.1 : ℝ)*(sourceStageState i.1).K ≤ (sourceBlockSize s : ℝ)^2 := by + have hh : (sourceBlockSize i.1 : ℝ)*(sourceStageState i.1).K ≤ + (sourceBlockSize s : ℝ)*(sourceStageState s).K := by exact_mod_cast sourceFrequencyScale_monotone hi + have hK : ((sourceStageState s).K : ℝ) ≤ sourceBlockSize s := by exact_mod_cast (sourceStage s).m_ge_K + nlinarith + have hnp : (sourceBlockSize i.1 : ℝ)*(sourceStageState i.1).K ≤ (n : ℝ) := by + nlinarith [hspec.1,sq_nonneg (sourceBlockSize s : ℝ)] + unfold sourceAngleUnit + rw [mul_one_div,le_div_iff₀ (mul_pos (sourceBlockSize_pos i.1) (sourceCutoff_pos i.1)),one_mul] + exact hnp + +theorem sourceSampling_phase_domination (s : ℕ) (hs : 200000 ≤ sourceBlockSize s) + (i : SourceCoordinate) (hi : i.1 ≤ s) (n : ℤ) (hn : n ∈ sourceSamplingPowers s) : + sourceAngleLaw.map (fun θ => Int.fract ((n : ℝ)*θ i)) ≤ + (2 : ℝ≥0∞) • unitIntervalMeasure := by + have hp : Measurable (fun t : ℝ => Int.fract ((n : ℝ)*t)) := + sourceFract_measurable.comp (measurable_const.mul measurable_id) + have he : sourceAngleLaw.map (fun θ => Int.fract ((n : ℝ)*θ i)) = + (sourceAngleMarginal i).map (fun t => Int.fract ((n : ℝ)*t)) := by + rw [← sourceAngleLaw_coordinate i,Measure.map_map hp (measurable_pi_apply i)] + rfl + rw [he] + have hnp : (0 : ℝ) < n := by exact_mod_cast ((sourceSamplingPowers_spec s hs).1 n hn).2.2 + have hh := (sourceAngle_phase_sandwich i (n : ℝ) hnp).2 + apply hh.trans + have hlen := sourceSampling_phase_length s hs i hi n hn + have hiR : 1/(n*sourceAngleUnit i) ≤ (1 : ℝ) := by + simpa using one_div_le_one_div_of_le (by norm_num : (0 : ℝ) < 1) hlen + have heps : ENNReal.ofReal (1+1/(n*sourceAngleUnit i)) ≤ (2 : ℝ≥0∞) := by + exact_mod_cast ENNReal.ofReal_le_ofReal (show 1+1/(n*sourceAngleUnit i) ≤ (2 : ℝ) by linarith) + gcongr + +theorem samplingCharacter_pair_expression (v w : ℤ) (a b : ℝ) : + samplingCharacter v a*samplingCharacter w b = + Complex.exp (2*Real.pi*Complex.I*((v : ℂ)*(a : ℂ)+(w : ℂ)*(b : ℂ))) := by + unfold samplingCharacter + rw [← Complex.exp_add] + congr 1 + ring + +/-- Rectangle discrepancy for the actual pair law of the deterministic +selected powers, with every probabilistic hypothesis discharged. -/ +theorem sourceSampling_rectangle_bound (s : ℕ) (hs : 200000 ≤ sourceBlockSize s) + (i : SourceCoordinate) (hi : i.1 ≤ s) (n n' : ℤ) + (hn : n ∈ sourceSamplingPowers s) (hn' : n' ∈ sourceSamplingPowers s) (hne : n ≠ n') + (a b a' b' : ℝ) : + |(sourceAngleLaw {θ | Int.fract ((n : ℝ)*θ i) ∈ Set.Icc a b ∧ + Int.fract ((n' : ℝ)*θ i) ∈ Set.Icc a' b'}).toReal - + (unitIntervalMeasure (Set.Icc a b)).toReal*(unitIntervalMeasure (Set.Icc a' b')).toReal| ≤ + 26*(sourceBlockSize s : ℝ)^(-80 : ℝ) := by + let m := sourceBlockSize s + have hm0 : (0 : ℝ) < m := sourceBlockSize_pos s + have hm1 : (1 : ℝ) ≤ m := by + have hm : (200000 : ℝ) ≤ m := by exact_mod_cast hs + linarith + let δ : ℝ := (m : ℝ)^(-80 : ℝ) + let ε : ℝ := Real.pi⁻¹*(m : ℝ)^(-1000 : ℝ) + have hH : 0 < samplingH m := pow_pos (by exact_mod_cast hm0) 300 + have hphase (n : ℤ) : Measurable (fun θ : SourceCoordinate → ℝ => Int.fract ((n : ℝ)*θ i)) := + sourceFract_measurable.comp (measurable_const.mul (measurable_pi_apply i)) + have hh := sampling_rectangle_discrepancy sourceAngleLaw _ _ (hphase n) (hphase n') + (sourceSampling_phase_domination s hs i hi n hn) (sourceSampling_phase_domination s hs i hi n' hn') + (samplingH m) hH a b a' b' δ ε (by dsimp [δ]; positivity) (by dsimp [ε]; positivity) + (fun v w hv hw hne' => by + simp_rw [samplingCharacter_pair_expression] + exact sourceSampling_pair_fourier_bound s hs i hi n n' hn hn' hne v w hv.le hw.le hne') + apply hh.trans + have htail : 1/(2*(samplingH m : ℝ)*δ^2) = (1/2 : ℝ)*(m : ℝ)^(-140 : ℝ) := by + dsimp [samplingH,δ] + norm_num [Real.rpow_neg,Real.rpow_ofNat,hm0.le] + field_simp + have hfour : (samplingH m : ℝ)^2*ε = Real.pi⁻¹*(m : ℝ)^(-400 : ℝ) := by + dsimp [samplingH,ε] + norm_num [Real.rpow_neg,Real.rpow_ofNat,hm0.le] + field_simp + rw [htail,hfour] + have h140 : (m : ℝ)^(-140 : ℝ) ≤ δ := Real.rpow_le_rpow_of_exponent_le hm1 (by norm_num) + have h400 : (m : ℝ)^(-400 : ℝ) ≤ δ := Real.rpow_le_rpow_of_exponent_le hm1 (by norm_num) + have hpi : Real.pi⁻¹ ≤ 1 := by simpa using one_div_le_one_div_of_le (by norm_num : (0 : ℝ) < 1) (show 1 ≤ Real.pi by linarith [Real.two_le_pi]) + have hδ : 0 ≤ δ := by dsimp [δ]; positivity + have hp0 : 0 ≤ (m : ℝ)^(-400 : ℝ) := by positivity + change 24*δ+1/2*(m : ℝ)^(-140 : ℝ)+Real.pi⁻¹*(m : ℝ)^(-400 : ℝ) ≤ 26*δ + nlinarith + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/EmpiricalL2.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/EmpiricalL2.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a1ca1c987bf96cd1844320aa17e5597c4ba7b65 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/EmpiricalL2.lean @@ -0,0 +1,89 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.ErrorEvent + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical +noncomputable section + +theorem sourceSamplingEmpiricalDensity_measurable (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (θ : SourceCoordinate → ℝ) : Measurable (sourceSamplingEmpiricalDensity stage r b E G θ) := + (Finset.measurable_sum _ (fun n _ => (sourceSamplingProduct_measurable stage r b E G hE hG n).comp + (measurable_const.prodMk measurable_id))).div_const _ + +/-- Every empirical density is bounded at its finite stage, including stages +whose selected set is empty. No asymptotic assumption is used here. -/ +theorem sourceSamplingEmpiricalDensity_bounds (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (θ x : SourceCoordinate → ℝ) : + 0 ≤ sourceSamplingEmpiricalDensity stage r b E G θ x ∧ + sourceSamplingEmpiricalDensity stage r b E G θ x ≤ + (max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)))^(sourceSamplingPrefix stage).card := by + let C := (max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)))^(sourceSamplingPrefix stage).card + have hC : 0 ≤ C := pow_nonneg ((by norm_num : (0 : ℝ) ≤ 1).trans (le_max_left _ _)) _ + have hb := sourceSamplingProduct_bounds stage r b E G + have hn : 0 ≤ sourceSamplingEmpiricalDensity stage r b E G θ x := + div_nonneg (sum_nonneg (fun n _ => (hb n θ x).1)) (by positivity) + refine ⟨hn,?_⟩ + by_cases hS : (sourceSamplingPowers stage).Nonempty + · have hP : (0 : ℝ) < (sourceSamplingPowers stage).card := by exact_mod_cast hS.card_pos + apply (div_le_iff₀ hP).mpr + calc + _ ≤ ∑ _n ∈ sourceSamplingPowers stage, C := sum_le_sum (fun n _ => (hb n θ x).2) + _ = _ := by simp [C]; ring + · have he : sourceSamplingPowers stage = ∅ := Finset.not_nonempty_iff_eq_empty.mp hS + simp [sourceSamplingEmpiricalDensity,he] + +/-- The empirical densities, not only the ideal products, belong to L2. -/ +theorem sourceSamplingEmpiricalDensity_memLp (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (θ : SourceCoordinate → ℝ) : + MemLp (sourceSamplingEmpiricalDensity stage r b E G θ) 2 + (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) := by + apply MemLp.of_bound (sourceSamplingEmpiricalDensity_measurable stage r b E G hE hG θ).aestronglyMeasurable + ((max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)))^(sourceSamplingPrefix stage).card) + apply Eventually.of_forall + intro x + rw [Real.norm_eq_abs,abs_of_nonneg (sourceSamplingEmpiricalDensity_bounds stage r b E G θ x).1] + exact (sourceSamplingEmpiricalDensity_bounds stage r b E G θ x).2 + +/-- The full error and the ideal L2 bound control the actual empirical square. -/ +theorem sourceSamplingEmpiricalDensity_square_le (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (θ : SourceCoordinate → ℝ) : + (∫ x, sourceSamplingEmpiricalDensity stage r b E G θ x^2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) ≤ + 2*sourceSamplingSquaredError stage r b E G θ+2*Real.exp 5 := by + let μ := Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure) + let z := sourceSamplingEmpiricalDensity stage r b E G θ + let g := sourceSamplingIdealDensity stage r b E G + let C := (max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)))^(sourceSamplingPrefix stage).card + have hz := sourceSamplingEmpiricalDensity_measurable stage r b E G hE hG θ + have hg := sourceSamplingIdealDensity_measurable stage r b E G hE hG + have hzb := sourceSamplingEmpiricalDensity_bounds stage r b E G θ + have hgb := sourceSamplingIdealDensity_bounds stage r b E G hE hG + have hzi : Integrable (fun x => z x^2) μ := sampling_square_integrable μ z C hz hzb + have hgi : Integrable (fun x => g x^2) μ := sampling_square_integrable μ g C hg hgb + have hei : Integrable (fun x => (z x-g x)^2) μ := by + apply sampling_integrable_bounded μ _ ((hz.sub hg).pow_const 2) (C^2) + intro x + rw [abs_of_nonneg (sq_nonneg _)] + have hz' : 0 ≤ z x ∧ z x ≤ C := hzb x + have hg' : 0 ≤ g x ∧ g x ≤ C := hgb x + change (z x-g x)^2 ≤ C^2 + nlinarith [mul_nonneg (show 0 ≤ C-(z x-g x) by linarith) (show 0 ≤ C+(z x-g x) by linarith)] + have hi := integral_mono_ae hzi ((hei.const_mul 2).add (hgi.const_mul 2)) + (Eventually.of_forall (fun x => show z x^2 ≤ 2*(z x-g x)^2+2*g x^2 by nlinarith [sq_nonneg (z x-2*g x)])) + simp only [Pi.add_apply] at hi + rw [integral_add (hei.const_mul 2) (hgi.const_mul 2),integral_const_mul,integral_const_mul] at hi + exact hi.trans (by + have hb := sourceSamplingIdealDensity_uniform_square stage r b E G hE hG + change (∫ x, g x^2 ∂μ) ≤ Real.exp 5 at hb + change _ ≤ 2*(∫ x, (z x-g x)^2 ∂μ)+2*Real.exp 5 + linarith) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Error.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Error.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8be3c22bfbcaf69fc03c7ea2a47d9381ba21988 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Error.lean @@ -0,0 +1,120 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.ProductError +import OAI.Analysis.FiniteFactor.OrbitSampling.DiagonalEvent +import OAI.Analysis.FiniteFactor.Sampling.Cancellation + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +noncomputable section + +def sourceSamplingEmpiricalDensity (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (θ x : SourceCoordinate → ℝ) : ℝ := + (∑ n ∈ sourceSamplingPowers stage, sourceSamplingProduct stage r b E G n θ x)/ + ((sourceSamplingPowers stage).card : ℝ) + +/-- The full sampling error, including every distinct-pair and mixed term. -/ +def sourceSamplingSquaredError (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (θ : SourceCoordinate → ℝ) : ℝ := + ∫ x, (sourceSamplingEmpiricalDensity stage r b E G θ x-sourceSamplingIdealDensity stage r b E G x)^2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure) + +theorem sourceSampling_error_joint_integrable (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + Integrable (fun p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) => + (sourceSamplingEmpiricalDensity stage r b E G p.1 p.2-sourceSamplingIdealDensity stage r b E G p.2)^2) + (sourceAngleLaw.prod (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure))) := by + apply sampling_average_square_integrable + · intro n _ k _ + exact sourceSamplingProduct_pair_integrable stage r b E G hE hG n k + · intro n _ + exact sourceSamplingProduct_mixed_integrable stage r b E G hE hG n + · have hm : Measurable (fun p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) => sourceSamplingIdealDensity stage r b E G p.2) := + (sourceSamplingIdealDensity_measurable stage r b E G hE hG).comp measurable_snd + have hi := sampling_bounded_product_integrable + (sourceAngleLaw.prod (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure))) + (fun p => sourceSamplingIdealDensity stage r b E G p.2) (fun p => sourceSamplingIdealDensity stage r b E G p.2) + hm hm _ (fun p => sourceSamplingIdealDensity_bounds stage r b E G hE hG p.2) + (fun p => sourceSamplingIdealDensity_bounds stage r b E G hE hG p.2) + simpa only [pow_two] using hi + +theorem sourceSamplingSquaredError_integrable (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + Integrable (sourceSamplingSquaredError stage r b E G) sourceAngleLaw := + (sourceSampling_error_joint_integrable stage r b E G hE hG).integral_prod_left + +theorem sourceSamplingSquaredError_measurable (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + Measurable (sourceSamplingSquaredError stage r b E G) := by + have hm : Measurable (fun p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) => + sourceSamplingEmpiricalDensity stage r b E G p.1 p.2) := + (Finset.measurable_sum _ (fun n _ => sourceSamplingProduct_measurable stage r b E G hE hG n)).div_const _ + exact ((hm.sub ((sourceSamplingIdealDensity_measurable stage r b E G hE hG).comp measurable_snd)).pow_const 2).stronglyMeasurable.integral_prod_right.measurable + +theorem sourceSamplingSquaredError_nonneg (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (θ : SourceCoordinate → ℝ) : + 0 ≤ sourceSamplingSquaredError stage r b E G θ := integral_nonneg (fun _ => sq_nonneg _) + +/-- Full expected squared sampling error with the source's actual sample set, +weights and ideal density. All distinct-pair and mixed assumptions are proved. -/ +theorem sourceSamplingSquaredError_expectation (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (r : Bool) (b : SourceCoordinate → Bool) (a c a' c' : SourceCoordinate → ℝ) : + (∫ θ, sourceSamplingSquaredError stage r b (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) θ ∂sourceAngleLaw) ≤ + (∫ θ, sourceSamplingDiagonalContribution stage r b (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) θ ∂sourceAngleLaw)+ + 3*sourceSamplingCorrelationBudget stage := by + let E := fun i => Set.Icc (a i) (c i) + let G := fun i => Set.Icc (a' i) (c' i) + have hE : ∀ i, MeasurableSet (E i) := fun _ => measurableSet_Icc + have hG : ∀ i, MeasurableSet (G i) := fun _ => measurableSet_Icc + let μ := sourceAngleLaw.prod (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) + let S := sourceSamplingPowers stage + let f (n : ℤ) (p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ)) := sourceSamplingProduct stage r b E G n p.1 p.2 + let g (p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ)) := sourceSamplingIdealDensity stage r b E G p.2 + have hpair (n k : ℤ) : Integrable (fun p => f n p*f k p) μ := + sourceSamplingProduct_pair_integrable stage r b E G hE hG n k + have hmix (n : ℤ) : Integrable (fun p => f n p*g p) μ := + sourceSamplingProduct_mixed_integrable stage r b E G hE hG n + have hg : Integrable (fun p => g p^2) μ := by + have hm : Measurable (fun p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) => sourceSamplingIdealDensity stage r b E G p.2) := + (sourceSamplingIdealDensity_measurable stage r b E G hE hG).comp measurable_snd + simpa only [pow_two] using sampling_bounded_product_integrable μ g g hm hm _ + (fun p => sourceSamplingIdealDensity_bounds stage r b E G hE hG p.2) + (fun p => sourceSamplingIdealDensity_bounds stage r b E G hE hG p.2) + have hA : (∫ p, g p^2 ∂μ) = ∫ x, sourceSamplingIdealDensity stage r b E G x^2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure) := by + rw [integral_prod _ hg] + simp [g] + have hB (n k : ℤ) : (∫ p, f n p*f k p ∂μ) = + ∫ θ, ∫ x, sourceSamplingProduct stage r b E G n θ x*sourceSamplingProduct stage r b E G k θ x + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure) ∂sourceAngleLaw := integral_prod _ (hpair n k) + have hM (n : ℤ) : (∫ p, f n p*g p ∂μ) = + ∫ θ, ∫ x, sourceSamplingProduct stage r b E G n θ x*sourceSamplingIdealDensity stage r b E G x + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure) ∂sourceAngleLaw := integral_prod _ (hmix n) + have hS : S.Nonempty := by + have hP : (0 : ℝ) < (sourceSamplingPowers stage).card := + (Real.rpow_pos_of_pos (sourceBlockSize_pos stage) _).trans_le (sourceSamplingPowers_spec stage hs).2.1 + exact Finset.card_pos.mp (by exact_mod_cast hP) + have hc := sampling_finite_cancellation S hS + (fun n k => ∫ p, f n p*f k p ∂μ) (fun n => ∫ p, f n p*g p ∂μ) + (∫ p, g p^2 ∂μ) (sourceSamplingCorrelationBudget stage) + (integral_nonneg (fun _ => sq_nonneg _)) (by unfold sourceSamplingCorrelationBudget; positivity) + (fun n hn k hk hne => by rw [hB,hA]; exact sourceSamplingProduct_pair_error stage hs r b a c a' c' n k hn hk hne) + (fun n hn => by rw [hM,hA]; exact sourceSamplingProduct_mixed_error stage hs r b E G hE hG n hn) + have hex := sampling_average_square_expansion μ S f g (fun n _ k _ => hpair n k) (fun n _ => hmix n) hg + rw [← hex] at hc + have hErr : (∫ p, ((∑ n ∈ S, f n p)/(S.card : ℝ)-g p)^2 ∂μ) = + ∫ θ, sourceSamplingSquaredError stage r b E G θ ∂sourceAngleLaw := + integral_prod _ (sourceSampling_error_joint_integrable stage r b E G hE hG) + have hDiag : (∑ n ∈ S, ∫ p, f n p*f n p ∂μ)/(S.card : ℝ)^2 = + ∫ θ, sourceSamplingDiagonalContribution stage r b E G θ ∂sourceAngleLaw := by + unfold sourceSamplingDiagonalContribution + rw [integral_div,integral_finsetSum _ (fun n _ => + (sourceSamplingProduct_square_integrable stage r b E G hE hG n).integral_prod_left)] + simp only [hB,pow_two,f,S] + rw [hErr,hDiag] at hc + exact hc + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/ErrorEvent.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/ErrorEvent.lean new file mode 100644 index 0000000000000000000000000000000000000000..572ea7c2fe8ae2c39406a0e477e7f4152a35eed2 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/ErrorEvent.lean @@ -0,0 +1,80 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.Error + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical Topology +noncomputable section + +/-- The distinct and mixed error budget is summable along the actual stages. -/ +theorem sourceSamplingCorrelationBudget_summable : Summable sourceSamplingCorrelationBudget := by + apply (sourceSampling_inverse_square_summable.mul_left (208*Real.exp 135)).of_nonneg_of_le + · intro stage; unfold sourceSamplingCorrelationBudget; positivity + intro stage + let m : ℝ := sourceBlockSize stage + have hm : 0 < m := sourceBlockSize_pos stage + have hm1 : 1 ≤ m := by + have hh : 100 ≤ sourceBlockSize stage := (sourceStage stage).m_ge_100 + dsimp [m] + exact_mod_cast (show 1 ≤ sourceBlockSize stage by omega) + have hd : ((sourceSamplingPrefix stage).card : ℝ) ≤ 2*m := + (sourceSamplingPrefix_card_bound stage).trans (by dsimp [m]; nlinarith) + have he : m*m^(-74 : ℝ) = m^(-73 : ℝ) := by + conv_lhs => lhs; rw [← Real.rpow_one m] + rw [← Real.rpow_add hm]; norm_num + calc + sourceSamplingCorrelationBudget stage ≤ (2*m)*(104*m^(-74 : ℝ))*Real.exp 135 := by + unfold sourceSamplingCorrelationBudget + exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hd (by positivity)) (by positivity) + _ = (208*Real.exp 135)*m^(-73 : ℝ) := by rw [← he]; ring + _ ≤ (208*Real.exp 135)*m^(-2 : ℝ) := mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow_of_exponent_le hm1 (by norm_num)) (by positivity) + +/-- Summable expectations for the full empirical sampling error. -/ +theorem sourceSamplingSquaredError_summable_integral (r : Bool) (b : SourceCoordinate → Bool) + (a c a' c' : SourceCoordinate → ℝ) : + Summable (fun stage => ∫ θ, sourceSamplingSquaredError stage r b + (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) θ ∂sourceAngleLaw) := by + have hd := sourceSamplingDiagonalContribution_summable_integral r b + (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) + (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc) + have hb := hd.add (sourceSamplingCorrelationBudget_summable.mul_left 3) + apply hb.of_norm_bounded_eventually_nat + filter_upwards [sourceBlockSize_tendsto.eventually (eventually_ge_atTop 200000)] with stage hs + rw [Real.norm_eq_abs,abs_of_nonneg (integral_nonneg (sourceSamplingSquaredError_nonneg stage r b _ _))] + exact sourceSamplingSquaredError_expectation stage hs r b a c a' c' + +/-- The full squared sampling error is summable and converges to zero on a +conull set of actual source angles. This is not just the self-pair event. -/ +theorem sourceSamplingSquaredError_ae (r : Bool) (b : SourceCoordinate → Bool) + (a c a' c' : SourceCoordinate → ℝ) : + ∀ᵐ θ ∂sourceAngleLaw, + Summable (fun stage => sourceSamplingSquaredError stage r b + (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) θ) ∧ + Tendsto (fun stage => sourceSamplingSquaredError stage r b + (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) θ) atTop (𝓝 0) := by + have he := sampling_ae_summable_of_integrals sourceAngleLaw + (fun stage θ => sourceSamplingSquaredError stage r b (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) θ) + (fun stage => sourceSamplingSquaredError_measurable stage r b _ _ (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc)) + (fun stage => sourceSamplingSquaredError_integrable stage r b _ _ (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc)) + (fun stage θ => sourceSamplingSquaredError_nonneg stage r b _ _ θ) + (sourceSamplingSquaredError_summable_integral r b a c a' c') + exact he.mono (fun θ hθ => ⟨hθ,hθ.tendsto_atTop_zero⟩) + +/-- One source-angle event handles any countable family of interval tests, +orientations and triangular-coordinate choices for the full error. -/ +theorem sourceSamplingSquaredError_countable_event {ι : Type*} [Countable ι] + (r : ι → Bool) (b : ι → SourceCoordinate → Bool) + (a c a' c' : ι → SourceCoordinate → ℝ) : + ∀ᵐ θ ∂sourceAngleLaw, ∀ j, + Summable (fun stage => sourceSamplingSquaredError stage (r j) (b j) + (fun i => Set.Icc (a j i) (c j i)) (fun i => Set.Icc (a' j i) (c' j i)) θ) ∧ + Tendsto (fun stage => sourceSamplingSquaredError stage (r j) (b j) + (fun i => Set.Icc (a j i) (c j i)) (fun i => Set.Icc (a' j i) (c' j i)) θ) atTop (𝓝 0) := + ae_all_iff.mpr (fun j => sourceSamplingSquaredError_ae (r j) (b j) (a j) (c j) (a' j) (c' j)) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/FirstCorrelation.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/FirstCorrelation.lean new file mode 100644 index 0000000000000000000000000000000000000000..72fff338a6e749d01642e885d9d34608a4604016 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/FirstCorrelation.lean @@ -0,0 +1,74 @@ +import OAI.Analysis.FiniteFactor.Sampling.FirstDiscrepancy + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical +noncomputable section + +theorem sourceSampling_first_height_bound (stage : ℕ) (b : Bool) (s : ℝ) : + 0 ≤ samplingFirstHeight b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) s ∧ + samplingFirstHeight b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) s ≤ + (sourceBlockSize stage : ℝ)^(13/5 : ℝ) := by + have hp := sourceSampling_parameters stage + have hm := sourceBlockSize_pos stage + have hm1 : (1 : ℝ) ≤ sourceBlockSize stage := by + have hh : (100 : ℝ) ≤ sourceBlockSize stage := by exact_mod_cast (sourceStage stage).m_ge_100 + linarith + cases b + · unfold samplingFirstHeight + simp only [Bool.false_eq_true,ite_false] + split_ifs with hc + · have hd : 0 < samplingDistance s := hp.2.2.trans_le hc + refine ⟨one_div_nonneg.mpr (mul_nonneg hp.1.le hd.le),?_⟩ + calc + _ ≤ 1/(sourceSamplingWidth stage*sourceSamplingCutoff stage) := + one_div_le_one_div_of_le (mul_pos hp.1 hp.2.2) (mul_le_mul_of_nonneg_left hc hp.1.le) + _ = _ := by + unfold sourceSamplingWidth sourceSamplingCutoff + rw [← Real.rpow_add hm] + norm_num + rw [Real.rpow_neg hm.le,inv_inv] + · exact ⟨le_rfl,by positivity⟩ + · exact ⟨by norm_num [samplingFirstHeight],Real.one_le_rpow hm1 (by norm_num)⟩ + +/-- Explicit first-oriented pair correlation error for every prefix coordinate, +every rectangle endpoint and both source coordinate types. -/ +theorem sourceSampling_first_pair_error (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (i : SourceCoordinate) (hi : i.1 ≤ stage) (n n' : ℤ) + (hn : n ∈ sourceSamplingPowers stage) (hn' : n' ∈ sourceSamplingPowers stage) (hne : n ≠ n') + (b : Bool) (E : Set ℝ) (a c s : ℝ) (hsx : s ∈ Set.Ico (0 : ℝ) 1) : + |(∫ θ, samplingTestedFirstWeight b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + E (Set.Icc a c) s (Int.fract ((n : ℝ)*θ i)) * + samplingTestedFirstWeight b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + E (Set.Icc a c) s (Int.fract ((n' : ℝ)*θ i)) ∂sourceAngleLaw) - + samplingTestedFirstDensity b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E (Set.Icc a c) s ^ 2| ≤ + 26*(sourceBlockSize stage : ℝ)^(-74 : ℝ) := by + let m : ℝ := sourceBlockSize stage + let C := if s ∈ E then samplingFirstHeight b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) s else 0 + have hm : 0 < m := sourceBlockSize_pos stage + have hm1 : 1 ≤ m := by + have hh : (200000 : ℝ) ≤ (sourceBlockSize stage : ℝ) := by exact_mod_cast hs + dsimp [m] + linarith + have hheight := sourceSampling_first_height_bound stage b s + have hC : 0 ≤ C ∧ C ≤ m^(3 : ℝ) := by + dsimp [C] + split_ifs + · exact ⟨hheight.1,hheight.2.trans (Real.rpow_le_rpow_of_exponent_le hm1 (by norm_num))⟩ + · exact ⟨le_rfl,by positivity⟩ + have hC2 : C^2 ≤ m^(6 : ℝ) := by + calc + C^2 ≤ (m^(3 : ℝ))^2 := by nlinarith [hC.1,hC.2,Real.rpow_nonneg hm.le (3 : ℝ)] + _ = _ := by rw [← Real.rpow_natCast,← Real.rpow_mul hm.le]; norm_num + apply (sourceSampling_first_pair_bound stage hs i hi n n' hn hn' hne b E a c s hsx).trans + change (26*m^(-80 : ℝ))*C^2 ≤ 26*m^(-74 : ℝ) + calc + _ ≤ (26*m^(-80 : ℝ))*m^(6 : ℝ) := mul_le_mul_of_nonneg_left hC2 (by positivity) + _ = _ := by rw [mul_assoc,← Real.rpow_add hm]; norm_num + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/FirstMarginal.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/FirstMarginal.lean new file mode 100644 index 0000000000000000000000000000000000000000..018924dd7290728b181ac6e31d0aa8eac70d6b56 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/FirstMarginal.lean @@ -0,0 +1,67 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.UniformEvent +import OAI.Analysis.FiniteFactor.OrbitSampling.Measures + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal +noncomputable section + +/-- The actual first marginal is the verified empirical interval-test density. +The whole-circle tests [0,1] are valid on the Haar cube. -/ +theorem sourceSamplingUntrimmed_first_density (I : Finset SourceCoordinate) (stage : ℕ) + (θ : SourceCoordinate → ℝ) : + (sourceSamplingUntrimmed I stage θ).map Prod.fst = + sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal + (sourceSamplingEmpiricalDensity stage false (fun i => decide (i ∈ I)) + (fun _ => Set.Icc 0 1) (fun _ => Set.Icc 0 1) θ x)) := by + let S := sourceSamplingPowers stage + let c : ℝ≥0∞ := ENNReal.ofReal (1/((sourceSamplingPowers stage).card : ℝ)) + let w (n : ℤ) := sourceSamplingWeight I stage θ n + have hrep : (fun x => ENNReal.ofReal (sourceSamplingEmpiricalDensity stage false (fun i => decide (i ∈ I)) + (fun _ => Set.Icc 0 1) (fun _ => Set.Icc 0 1) θ x)) =ᵐ[sourceSamplingHaar] + (fun x => c*(∑ n ∈ S, ENNReal.ofReal (w n x))) := by + filter_upwards [sourceSamplingHaar_cube] with x hx + have hw (n : ℤ) : sourceSamplingProduct stage false (fun i => decide (i ∈ I)) + (fun _ => Set.Icc 0 1) (fun _ => Set.Icc 0 1) n θ x = w n x := by + apply Finset.prod_congr rfl + intro i _ + have hx' : x i ∈ Set.Icc (0 : ℝ) 1 := ⟨(hx i).1,(hx i).2.le⟩ + have hy : Int.fract (x i+Int.fract ((n : ℝ)*θ i)) ∈ Set.Icc (0 : ℝ) 1 := + ⟨Int.fract_nonneg _,(Int.fract_lt_one _).le⟩ + simp only [samplingOrientedWeight, Bool.false_eq_true, ite_false, samplingTestedFirstWeight, + hx', hy, and_self, ite_true] + simp only [sourceSamplingEmpiricalDensity,hw] + rw [div_eq_mul_inv,mul_comm,← one_div, + ENNReal.ofReal_mul (by positivity),ENNReal.ofReal_sum_of_nonneg (fun n _ => (sourceSamplingWeight_bounds I stage θ n x).1)] + rw [withDensity_congr_ae hrep] + ext A hA + rw [Measure.map_apply measurable_fst hA] + unfold sourceSamplingUntrimmed + rw [Measure.smul_apply,Measure.finsetSum_apply,withDensity_apply _ hA] + have hterm (n : ℤ) : sourceSamplingSummand I stage θ n (Prod.fst ⁻¹' A) = + ∫⁻ x in A, ENNReal.ofReal (w n x) ∂sourceSamplingHaar := by + rw [← Measure.map_apply measurable_fst hA,sourceSamplingSummand_first_marginal] + exact withDensity_apply _ hA + simp only [hterm,smul_eq_mul] + rw [lintegral_const_mul' c _ ENNReal.ofReal_ne_top] + congr 1 + exact (lintegral_finsetSum S (fun n _ => + (sourceSamplingWeight_measurable I stage θ n).ennreal_ofReal)).symm + +/-- Uniform L2 densities for the actual untrimmed first marginals. -/ +theorem sourceSamplingUntrimmed_first_L2 (I : Finset SourceCoordinate) : + ∀ᵐ θ ∂sourceAngleLaw, ∃ C : ℝ, ∀ stage, + ∃ f : (SourceCoordinate → ℝ) → ℝ, + (sourceSamplingUntrimmed I stage θ).map Prod.fst = sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal (f x)) ∧ + MemLp f 2 sourceSamplingHaar ∧ (∫ x, f x^2 ∂sourceSamplingHaar) ≤ C := by + filter_upwards [sourceSamplingEmpiricalDensity_uniform false (fun i => decide (i ∈ I)) + (fun _ => 0) (fun _ => 1) (fun _ => 0) (fun _ => 1)] with θ hθ + obtain ⟨C,hC⟩ := hθ + refine ⟨C,fun stage => ⟨_,sourceSamplingUntrimmed_first_density I stage θ,(hC stage).1,(hC stage).2⟩⟩ + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Fourier.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Fourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..f83cead368cffd036810573f54cf3c3682361ceb --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Fourier.lean @@ -0,0 +1,92 @@ +import OAI.Analysis.FiniteFactor.Sampling.Fourier +import OAI.Analysis.FiniteFactor.OrbitSampling.Powers + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +noncomputable section + +theorem sourceBlockSize_monotone : Monotone sourceBlockSize := by + apply monotone_nat_of_le_succ + intro s + have hp := (sourceStage (s+1)).previous_size + have hd : (sourceBlockSize s : ℝ) ≤ (sourceStageState (s+1)).d := by + change (sourceBlockSize s : ℝ) ≤ ((sourceStageState s).d+(sourceStage s).m : ℕ) + change ((sourceStage s).m : ℝ) ≤ ((sourceStageState s).d+(sourceStage s).m : ℕ) + push_cast + exact le_add_of_nonneg_left (Nat.cast_nonneg _) + have hm : (sourceBlockSize s : ℝ) ≤ sourceBlockSize (s+1) := by + change ((sourceStageState (s+1)).d : ℝ) ≤ (sourceBlockSize (s+1) : ℝ)/100 at hp + have := Nat.cast_nonneg (α := ℝ) (sourceBlockSize (s+1)) + linarith + exact_mod_cast hm + +theorem sourceFrequencyScale_monotone : + Monotone (fun s => sourceBlockSize s * (sourceStageState s).K) := by + have hK : Monotone (fun s => (sourceStageState s).K) := by + apply monotone_nat_of_le_succ + intro s + have := sourceStage_cutoff_growth s + omega + intro s t hst + exact Nat.mul_le_mul (sourceBlockSize_monotone hst) (hK hst) + +/-- The full infinite-product angle expectation has the same coordinate +Fourier estimate; no independence between two phases is asserted. -/ +theorem sourceAngleLaw_pair_fourier_le (i : SourceCoordinate) (v v' : ℤ) (n n' : ℝ) + (hw : (v : ℝ)*n+(v' : ℝ)*n' ≠ 0) : + ‖∫ θ, Complex.exp (2 * Real.pi * Complex.I * + ((v : ℂ) * (Int.fract (n*θ i) : ℝ) + (v' : ℂ) * (Int.fract (n'*θ i) : ℝ))) + ∂sourceAngleLaw‖ ≤ + 1/(Real.pi*sourceAngleUnit i*|(v : ℝ)*n+(v' : ℝ)*n'|) := by + have hh := sourceAngle_pair_fourier_le i v v' n n' hw + simp_rw [pair_fourier_fract] at hh ⊢ + rw [← sourceAngleLaw_coordinate i, + integral_map (measurable_pi_apply i).aemeasurable (by fun_prop)] at hh + exact hh + +theorem sourceSampling_pair_fourier_bound (s : ℕ) (hs : 200000 ≤ sourceBlockSize s) + (i : SourceCoordinate) (hi : i.1 ≤ s) (n n' : ℤ) + (hn : n ∈ sourceSamplingPowers s) (hn' : n' ∈ sourceSamplingPowers s) (hne : n ≠ n') + (v v' : ℤ) (hv : |v| ≤ (samplingH (sourceBlockSize s) : ℤ)) + (hv' : |v'| ≤ (samplingH (sourceBlockSize s) : ℤ)) (hvv' : v ≠ 0 ∨ v' ≠ 0) : + ‖∫ θ, Complex.exp (2 * Real.pi * Complex.I * + ((v : ℂ) * (Int.fract ((n : ℝ)*θ i) : ℝ) + + (v' : ℂ) * (Int.fract ((n' : ℝ)*θ i) : ℝ))) ∂sourceAngleLaw‖ ≤ + Real.pi⁻¹*(sourceBlockSize s : ℝ)^(-1000 : ℝ) := by + have hsep := (sourceSamplingPowers_spec s hs).2.2 hn hn' hne + have hfreq : (samplingR (sourceBlockSize s) (sourceStageState s).K : ℤ) < |v*n+v'*n'| := by + by_contra hh + exact hsep ⟨v,mem_Icc.mpr (abs_le.mp hv),v',mem_Icc.mpr (abs_le.mp hv'),hvv',le_of_not_gt hh⟩ + let w : ℝ := (v : ℝ)*(n : ℝ)+(v' : ℝ)*(n' : ℝ) + have hwR : (samplingR (sourceBlockSize s) (sourceStageState s).K : ℝ) < |w| := by + dsimp [w] + exact_mod_cast hfreq + have hwpos : 0 < |w| := lt_of_le_of_lt (Nat.cast_nonneg _) hwR + have hw : w ≠ 0 := abs_pos.mp hwpos + apply (sourceAngleLaw_pair_fourier_le i v v' (n : ℝ) (n' : ℝ) hw).trans + have hN : (sourceBlockSize i.1 : ℝ)*(sourceStageState i.1).K ≤ + (sourceBlockSize s : ℝ)*(sourceStageState s).K := by + exact_mod_cast sourceFrequencyScale_monotone hi + have hmpos := sourceBlockSize_pos s + have hNpos := mul_pos (sourceBlockSize_pos i.1) (sourceCutoff_pos i.1) + have hscale : (sourceBlockSize s : ℝ)^1000 ≤ sourceAngleUnit i * |w| := by + unfold samplingR at hwR + push_cast at hwR + unfold sourceAngleUnit + rw [one_div, inv_mul_eq_div, le_div_iff₀ hNpos] + have hh := mul_le_mul_of_nonneg_right hN (pow_nonneg hmpos.le 1000) + nlinarith + change 1/(Real.pi*sourceAngleUnit i*|w|) ≤ _ + calc + _ = Real.pi⁻¹*(1/(sourceAngleUnit i*|w|)) := by ring + _ ≤ Real.pi⁻¹*(1/(sourceBlockSize s : ℝ)^1000) := by + exact mul_le_mul_of_nonneg_left + (one_div_le_one_div_of_le (pow_pos hmpos 1000) hscale) (inv_nonneg.mpr Real.pi_pos.le) + _ = _ := by rw [Real.rpow_neg, Real.rpow_ofNat, one_div]; positivity + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/IdealProduct.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/IdealProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..87cc393485bdc264dd008ff50ac3935226ca836b --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/IdealProduct.lean @@ -0,0 +1,120 @@ +import OAI.Analysis.FiniteFactor.Sampling.OrientedMoments + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +noncomputable section + +/-- The actual source prefix dimension, including the current block. -/ +theorem sourceSamplingPrefix_card (stage : ℕ) : + (sourceSamplingPrefix stage).card = (sourceStageState stage).d+sourceBlockSize stage := by + unfold sourceSamplingPrefix CouplingParameters.blockPrefix + simp only [Finset.card_sigma,Finset.card_univ,Fintype.card_fin] + change (∑ i ∈ range (stage+1), (sourceStage i).m) = _ + rw [sum_range_succ,← sourceStage_previous_size] + rfl + +theorem sourceSamplingPrefix_card_bound (stage : ℕ) : + ((sourceSamplingPrefix stage).card : ℝ) ≤ (101/100 : ℝ)*sourceBlockSize stage := by + rw [sourceSamplingPrefix_card,Nat.cast_add] + have hp := (sourceStage stage).previous_size + change ((sourceStageState stage).d : ℝ) ≤ (sourceBlockSize stage : ℝ)/100 at hp + linarith + +/-- The small quadratic coordinate errors stay bounded in the growing prefix. -/ +theorem sourceSampling_prefix_quadratic_budget (stage : ℕ) : + ((sourceSamplingPrefix stage).card : ℝ)*(4*(sourceBlockSize stage : ℝ)^(-6/5 : ℝ)) ≤ 5 := by + have hm := sourceBlockSize_pos stage + have hm1 : (1 : ℝ) ≤ sourceBlockSize stage := by + have hh : (100 : ℝ) ≤ sourceBlockSize stage := by exact_mod_cast (sourceStage stage).m_ge_100 + linarith + have he : (sourceBlockSize stage : ℝ)*(sourceBlockSize stage : ℝ)^(-6/5 : ℝ) = + (sourceBlockSize stage : ℝ)^(-1/5 : ℝ) := by + conv_lhs => lhs; rw [← Real.rpow_one (sourceBlockSize stage : ℝ)] + rw [← Real.rpow_add hm] + norm_num + have hp : (sourceBlockSize stage : ℝ)^(-1/5 : ℝ) ≤ 1 := + Real.rpow_le_one_of_one_le_of_nonpos hm1 (by norm_num) + calc + _ ≤ ((101/100 : ℝ)*sourceBlockSize stage)*(4*(sourceBlockSize stage : ℝ)^(-6/5 : ℝ)) := + mul_le_mul_of_nonneg_right (sourceSamplingPrefix_card_bound stage) (by positivity) + _ = (101/25 : ℝ)*(sourceBlockSize stage : ℝ)^(-1/5 : ℝ) := by rw [← he]; ring + _ ≤ 5 := by linarith + +def sourceSamplingIdealDensity (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (x : SourceCoordinate → ℝ) : ℝ := + ∏ i ∈ sourceSamplingPrefix stage, + samplingOrientedDensity r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) (E i) (G i) (x i) + +theorem sourceSamplingIdealDensity_measurable (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + Measurable (sourceSamplingIdealDensity stage r b E G) := + Finset.measurable_prod _ (fun i _ => + (samplingOrientedDensity_measurable r (b i) _ _ (E i) (G i) (hE i) (hG i)).comp (measurable_pi_apply i)) + +/-- Exact product factorization of the ideal marginal's quadratic moment. -/ +theorem sourceSamplingIdealDensity_square (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + (∫ x, sourceSamplingIdealDensity stage r b E G x ^ 2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) = + ∏ i ∈ sourceSamplingPrefix stage, + ∫ s, samplingOrientedDensity r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) (E i) (G i) s ^ 2 + ∂unitIntervalMeasure := by + simp only [sourceSamplingIdealDensity,← Finset.prod_pow] + exact integral_infinitePi_finset_prod _ _ _ (fun i => + (samplingOrientedDensity_measurable r (b i) _ _ (E i) (G i) (hE i) (hG i)).pow_const 2) + +/-- Uniform-in-stage ideal marginal bound. The second orientation uses the +quadratic cancellation established for the actual cutoff diagonal density. -/ +theorem sourceSamplingIdealDensity_uniform_square (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + (∫ x, sourceSamplingIdealDensity stage r b E G x ^ 2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) ≤ Real.exp 5 := by + rw [sourceSamplingIdealDensity_square stage r b E G hE hG,← Finset.prod_coe_sort] + have he := product_energy_le_exp + (fun i : sourceSamplingPrefix stage => ∫ s, samplingOrientedDensity r (b i) + (sourceSamplingWidth stage) (sourceSamplingCutoff stage) (E i) (G i) s ^ 2 ∂unitIntervalMeasure) + (fun _ : sourceSamplingPrefix stage => 4*(sourceBlockSize stage : ℝ)^(-6/5 : ℝ)) + (fun i => integral_nonneg (fun _ => sq_nonneg _)) + (fun i => (sourceSampling_oriented_moment stage r (b i) (E i) (G i) (hE i) (hG i)).2) + apply he.trans + apply Real.exp_le_exp.mpr + simpa using sourceSampling_prefix_quadratic_budget stage + +/-- Each ideal marginal is genuinely in L2; the preceding integral bound is +therefore a norm bound, not an integral of a nonintegrable function. -/ +theorem sourceSamplingIdealDensity_memLp (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + MemLp (sourceSamplingIdealDensity stage r b E G) 2 + (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) := by + let C := max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)) + have hp := sourceSampling_parameters stage + have hb (i : SourceCoordinate) (s : ℝ) : + 0 ≤ samplingOrientedDensity r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) (E i) (G i) s ∧ + samplingOrientedDensity r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) (E i) (G i) s ≤ C := by + have hm : Measurable (samplingOrientedWeight r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) (E i) (G i) s) := + (samplingOrientedWeight_measurable r (b i) _ _ (E i) (G i) (hE i) (hG i)).comp + (measurable_const.prodMk measurable_id) + have hw := samplingOrientedWeight_bounds r (b i) _ _ (E i) (G i) hp.1 hp.2.2 s + have hi : Integrable (samplingOrientedWeight r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) (E i) (G i) s) + unitIntervalMeasure := (integrable_const C).mono' hm.aestronglyMeasurable + (Eventually.of_forall (fun t => by rw [Real.norm_eq_abs,abs_of_nonneg (hw t).1]; exact (hw t).2)) + refine ⟨integral_nonneg (fun t => (hw t).1),?_⟩ + simpa [samplingOrientedDensity] using integral_mono_ae hi (integrable_const C) + (Eventually.of_forall (fun t => (hw t).2)) + apply MemLp.of_bound (sourceSamplingIdealDensity_measurable stage r b E G hE hG).aestronglyMeasurable + (C^(sourceSamplingPrefix stage).card) + apply Eventually.of_forall + intro x + have hnon : 0 ≤ sourceSamplingIdealDensity stage r b E G x := prod_nonneg (fun i _ => (hb i (x i)).1) + rw [Real.norm_eq_abs,abs_of_nonneg hnon] + calc + _ ≤ ∏ _i ∈ sourceSamplingPrefix stage, C := + prod_le_prod₀ (fun i _ => (hb i (x i)).1) (fun i _ => (hb i (x i)).2) + _ = _ := by simp + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/IdealRectangleLimit.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/IdealRectangleLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..7634cedf1964ec4998b77f82d19ee621bafd9de7 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/IdealRectangleLimit.lean @@ -0,0 +1,105 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.CutoffMass +import OAI.Analysis.FiniteFactor.OrbitSampling.RectangleApproximation + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +/-- Explicit finite-coordinate rectangle mass of the triangular/diagonal +model. The triangular term retains the actual source weight integral. -/ +def sourceSamplingLimitRectangleMass (I : Finset SourceCoordinate) (T : SourceSamplingRationalTest) : ℝ := + ∏ i ∈ I ∪ T.1, + if i ∈ I then + ∫ s, samplingTestedFirstDensity true (sourceSamplingWidth 0) (sourceSamplingCutoff 0) + (sourceSamplingRationalX T i) (sourceSamplingRationalY T i) s ∂unitIntervalMeasure + else (unitIntervalMeasure (sourceSamplingRationalX T i ∩ sourceSamplingRationalY T i)).toReal + +/-- Exact finite-coordinate factorization of the first ideal integral. -/ +theorem sourceSamplingIdealDensity_integral (I : Finset SourceCoordinate) (stage : ℕ) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + (∫ x, sourceSamplingIdealDensity stage false (fun i => decide (i ∈ I)) E G x ∂sourceSamplingHaar) = + ∏ i ∈ sourceSamplingPrefix stage, ∫ s, + samplingTestedFirstDensity (decide (i ∈ I)) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (E i) (G i) s ∂unitIntervalMeasure := by + exact integral_infinitePi_finset_prod _ _ _ (fun i => + samplingTestedFirstDensity_measurable (decide (i ∈ I)) _ _ (E i) (G i) (hE i) (hG i)) + +/-- Tests and triangular coordinates occupy a fixed finite set. Every other +prefix coordinate contributes its exact retained mass, 1-2α. -/ +theorem sourceSamplingIdeal_rectangle_split (I : Finset SourceCoordinate) (T : SourceSamplingRationalTest) + (stage : ℕ) (hK : I ∪ T.1 ⊆ sourceSamplingPrefix stage) : + (∫ x, sourceSamplingIdealDensity stage false (fun i => decide (i ∈ I)) + (sourceSamplingRationalX T) (sourceSamplingRationalY T) x ∂sourceSamplingHaar) = + (∏ i ∈ I ∪ T.1, ∫ s, + samplingTestedFirstDensity (decide (i ∈ I)) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (sourceSamplingRationalX T i) (sourceSamplingRationalY T i) s ∂unitIntervalMeasure) * + (1-2*sourceSamplingCutoff stage)^((sourceSamplingPrefix stage \ (I ∪ T.1)).card) := by + rw [sourceSamplingIdealDensity_integral I stage (sourceSamplingRationalX T) (sourceSamplingRationalY T) (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc)] + let F := fun i => ∫ s, samplingTestedFirstDensity (decide (i ∈ I)) (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) (sourceSamplingRationalX T i) (sourceSamplingRationalY T i) s ∂unitIntervalMeasure + have hf (i : SourceCoordinate) (hi : i ∈ sourceSamplingPrefix stage \ (I ∪ T.1)) : + F i = 1-2*sourceSamplingCutoff stage := by + have hnot := (Finset.mem_sdiff.mp hi).2 + have hI : i ∉ I := fun h => hnot (Finset.mem_union_left _ h) + have hT : i ∉ T.1 := fun h => hnot (Finset.mem_union_right _ h) + simp only [F,decide_eq_false hI,sourceSamplingRationalX,sourceSamplingRationalY, + sourceSamplingRationalEndpoints,dite_eq_right hT,Rat.cast_zero,Rat.cast_one] + have hp := sourceSampling_parameters stage + exact sampling_diagonal_whole_mass _ _ hp.1 hp.2.1 hp.2.2 (sourceSamplingCutoff_le_half stage) + have hp := Finset.prod_sdiff hK (f := F) + rw [Finset.prod_congr rfl hf,Finset.prod_const] at hp + simpa only [mul_comm] using hp.symm + +/-- The deterministic ideal product limit includes all growing-prefix cutoff +losses and has exactly the tested diagonal-coordinate limits. -/ +theorem sourceSamplingIdeal_rectangle_tendsto (I : Finset SourceCoordinate) (T : SourceSamplingRationalTest) : + Tendsto (fun stage => ∫ x, sourceSamplingIdealDensity stage false (fun i => decide (i ∈ I)) + (sourceSamplingRationalX T) (sourceSamplingRationalY T) x ∂sourceSamplingHaar) + atTop (𝓝 (sourceSamplingLimitRectangleMass I T)) := by + let F := fun stage i => ∫ s, samplingTestedFirstDensity (decide (i ∈ I)) (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) (sourceSamplingRationalX T i) (sourceSamplingRationalY T i) s ∂unitIntervalMeasure + have hcoord (i : SourceCoordinate) : Tendsto (fun stage => F stage i) atTop + (𝓝 (if i ∈ I then ∫ s, samplingTestedFirstDensity true (sourceSamplingWidth 0) (sourceSamplingCutoff 0) + (sourceSamplingRationalX T i) (sourceSamplingRationalY T i) s ∂unitIntervalMeasure + else (unitIntervalMeasure (sourceSamplingRationalX T i ∩ sourceSamplingRationalY T i)).toReal)) := by + by_cases hi : i ∈ I + · simp only [ite_eq_left hi,F,decide_eq_true hi] + have he (stage : ℕ) : (∫ s, samplingTestedFirstDensity true (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (sourceSamplingRationalX T i) (sourceSamplingRationalY T i) s ∂unitIntervalMeasure) = + ∫ s, samplingTestedFirstDensity true (sourceSamplingWidth 0) (sourceSamplingCutoff 0) + (sourceSamplingRationalX T i) (sourceSamplingRationalY T i) s ∂unitIntervalMeasure := by + apply integral_congr_ae + exact Eventually.of_forall (fun s => samplingTestedFirstDensity_triangular_parameters _ _ _ _ _ _ _) + simp_rw [he] + exact tendsto_const_nhds + · simp only [ite_eq_right hi,F,decide_eq_false hi] + exact sourceSampling_diagonal_integral_tendsto _ measurableSet_Icc _ _ + have hfixed := tendsto_finsetProd (I ∪ T.1) (fun i _ => hcoord i) + have htail := sourceSampling_untested_mass_tendsto + (fun stage => (sourceSamplingPrefix stage \ (I ∪ T.1)).card) + (fun stage => Finset.card_le_card Finset.sdiff_subset) + have hall := hfixed.mul htail + simp only [mul_one] at hall + apply hall.congr' + filter_upwards [sourceSamplingPrefix_eventually_covers (I ∪ T.1)] with stage hstage + exact (sourceSamplingIdeal_rectangle_split I T stage hstage).symm + +/-- Actual untrimmed rational rectangle masses converge to the explicit +triangular/diagonal product value on one conull event for all I and tests. -/ +theorem sourceSampling_rectangle_limit_event : + ∀ᵐ θ ∂sourceAngleLaw, ∀ (I : Finset SourceCoordinate) (T : SourceSamplingRationalTest), + Tendsto (fun stage => ((sourceSamplingUntrimmed I stage θ) + (sourceSamplingRectangle (sourceSamplingRationalX T) (sourceSamplingRationalY T))).toReal) + atTop (𝓝 (sourceSamplingLimitRectangleMass I T)) := by + filter_upwards [sourceSampling_rectangle_approximation_event] with θ hθ + intro I T + have hh := (hθ I T).add (sourceSamplingIdeal_rectangle_tendsto I T) + simpa only [sub_add_cancel,zero_add] using hh + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LambdaMarginals.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LambdaMarginals.lean new file mode 100644 index 0000000000000000000000000000000000000000..7643c9a0f9f72e305a181f6fd18ef61ec7501325 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LambdaMarginals.lean @@ -0,0 +1,69 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.Cube +import OAI.Analysis.FiniteFactor.SubmeasureL2Density + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +def sourceSamplingLimitCoordinate (I : Finset SourceCoordinate) (r : Bool) + (i : SourceCoordinate) (z : ℝ × ℝ) : ℝ := if r = true ∧ i ∈ I then z.2 else z.1 + +theorem sourceSamplingLimitCoordinate_preserving (I : Finset SourceCoordinate) (r : Bool) + (i : SourceCoordinate) : MeasurePreserving (sourceSamplingLimitCoordinate I r i) + (unitIntervalMeasure.prod unitIntervalMeasure) unitIntervalMeasure := by + by_cases h : r = true ∧ i ∈ I + · have he : sourceSamplingLimitCoordinate I r i = Prod.snd := by funext z; simp [sourceSamplingLimitCoordinate,h] + rw [he] + exact measurePreserving_snd + · have he : sourceSamplingLimitCoordinate I r i = Prod.fst := by funext z; simp [sourceSamplingLimitCoordinate,h] + rw [he] + exact measurePreserving_fst + +theorem sourceSamplingLimitEndpoint_eq (I : Finset SourceCoordinate) (r : Bool) : + sourceSamplingEndpoint r ∘ sourceSamplingLimitMap I = + (fun p i => sourceSamplingLimitCoordinate I r i (p i)) := by + funext p i + cases r <;> simp [sourceSamplingEndpoint,sourceSamplingLimitMap,sourceSamplingLimitCoordinate] + +/-- Before the triangular restriction, either selected endpoint is exactly +product Haar, including the mixed first/second selection in the second endpoint. -/ +theorem sourceSamplingLimitEndpoint_preserving (I : Finset SourceCoordinate) (r : Bool) : + MeasurePreserving (sourceSamplingEndpoint r ∘ sourceSamplingLimitMap I) + sourceSamplingPairHaar sourceSamplingHaar := by + rw [sourceSamplingLimitEndpoint_eq] + refine ⟨Measurable.of_eval (fun i => (sourceSamplingLimitCoordinate_preserving I r i).measurable.comp + (measurable_pi_apply i)),?_⟩ + rw [Measure.infinitePi_map_pi _ (fun i => (sourceSamplingLimitCoordinate_preserving I r i).measurable)] + simp only [(sourceSamplingLimitCoordinate_preserving I r _).map_eq] + +/-- Both actual limiting marginals are submeasures of Haar. This proves the +absolute continuity needed for the later Lusin transfer without assuming a marginal law. -/ +theorem sourceSamplingLambda_marginal_le (I : Finset SourceCoordinate) (r : Bool) : + (sourceSamplingLambda I).map (sourceSamplingEndpoint r) ≤ sourceSamplingHaar := by + rw [sourceSamplingLambda,Measure.map_map (sourceSamplingEndpoint_measurable r) + (sourceSamplingLimitMap_measurable I)] + have h := Measure.map_mono (μ := sourceSamplingPairHaar.restrict (sourceSamplingTriangleSet I)) + (ν := sourceSamplingPairHaar) Measure.restrict_le_self (sourceSamplingLimitEndpoint_preserving I r).measurable + rwa [(sourceSamplingLimitEndpoint_preserving I r).map_eq] at h + +theorem sourceSamplingLambda_marginal_density (I : Finset SourceCoordinate) (r : Bool) : + ∃ g : (SourceCoordinate → ℝ) → ℝ, + Measurable g ∧ (∀ x, 0 ≤ g x) ∧ + (sourceSamplingLambda I).map (sourceSamplingEndpoint r) = + sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal (g x)) ∧ + (∀ᵐ x ∂sourceSamplingHaar, g x ≤ 1) ∧ MemLp g 2 sourceSamplingHaar ∧ + (∫ x, g x^2 ∂sourceSamplingHaar) ≤ 1 := by + have h := sourceSamplingLambda_marginal_le I r + have h' : (sourceSamplingLambda I).map (sourceSamplingEndpoint r) ≤ + sourceSamplingHaar.withDensity (fun _ => ENNReal.ofReal (1 : ℝ)) := by simpa using h + obtain ⟨g,hg,hg0,hgm,hgle,hglp,hgint⟩ := submeasure_L2_density sourceSamplingHaar + ((sourceSamplingLambda I).map (sourceSamplingEndpoint r)) (fun _ => 1) (memLp_const (1 : ℝ)) h' + exact ⟨g,hg,hg0,hgm,by simpa using hgle,hglp,by simpa using hgint⟩ + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LambdaMass.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LambdaMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..24edf144cc460f3f9bc60e9da2cbd7b45dfc4868 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LambdaMass.lean @@ -0,0 +1,53 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.Cube +import Mathlib.Analysis.SpecialFunctions.Integrals.Basic + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +theorem sourceSampling_triangle_mass : + ((unitIntervalMeasure.prod unitIntervalMeasure) + {p : ℝ × ℝ | p.1 ∈ Set.Icc (0 : ℝ) 1 ∧ p.2 ∈ Set.Icc (0 : ℝ) 1 ∧ p.1 < p.2}).toReal = 1/2 := by + rw [← samplingTestedFirstDensity_triangular_mass (1/2) 1 _ _ measurableSet_Icc measurableSet_Icc] + have he : samplingTestedFirstDensity true (1/2) 1 (Set.Icc 0 1) (Set.Icc 0 1) =ᵐ[unitIntervalMeasure] + (fun s => 1-s) := by + filter_upwards [ae_restrict_mem measurableSet_Ico] with s hs + simpa only [ite_true] using samplingTestedFirstDensity_whole true (1/2) 1 s + (by norm_num) (by norm_num) (by norm_num) hs + rw [integral_congr_ae he,unitIntervalMeasure,restrict_Ico_eq_restrict_Ioc, + ← intervalIntegral.integral_of_le (show (0 : ℝ) ≤ 1 by norm_num)] + rw [intervalIntegral.integral_sub (f := fun _ : ℝ => (1 : ℝ)) (g := fun x : ℝ => x) + intervalIntegrable_const (continuous_id.intervalIntegrable _ _)] + norm_num [intervalIntegral.integral_const] + +theorem sourceSamplingLambda_mass (I : Finset SourceCoordinate) : + ((sourceSamplingLambda I) Set.univ).toReal = (1/2 : ℝ)^I.card := by + have he : sourceSamplingLambda I sourceSamplingCube = sourceSamplingLambda I Set.univ := + measure_congr (by filter_upwards [sourceSamplingLambda_cube I] with p hp; exact propext (iff_true_intro hp)) + rw [← he,← sourceSamplingEmptyTest_rectangle,sourceSamplingLambda_rectangle, + sourceSamplingLimitRectangleMass_formula] + have hE (i : SourceCoordinate) : sourceSamplingRationalX sourceSamplingEmptyTest i = Set.Icc (0 : ℝ) 1 ∧ + sourceSamplingRationalY sourceSamplingEmptyTest i = Set.Icc (0 : ℝ) 1 := by + simp [sourceSamplingRationalX,sourceSamplingRationalY,sourceSamplingRationalEndpoints,sourceSamplingEmptyTest] + change (∏ i ∈ I ∪ ∅, _) = _ + rw [Finset.union_empty] + calc + _ = ∏ _i ∈ I, (1/2 : ℝ) := by + apply Finset.prod_congr rfl + intro i hi + rw [ite_eq_left hi,(hE i).1,(hE i).2] + exact sourceSampling_triangle_mass + _ = _ := by simp + +theorem sourceSamplingLambda_mass_pos (I : Finset SourceCoordinate) : + 0 < ((sourceSamplingLambda I) Set.univ).toReal := by + rw [sourceSamplingLambda_mass] + positivity + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LambdaRectangles.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LambdaRectangles.lean new file mode 100644 index 0000000000000000000000000000000000000000..2fe51622b6dc3a0a39784cb30e7c42bcb4464384 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LambdaRectangles.lean @@ -0,0 +1,122 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.LimitMeasure + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +def sourceSamplingLambdaTest (I : Finset SourceCoordinate) (T : SourceSamplingRationalTest) + (i : SourceCoordinate) (p : ℝ × ℝ) : Prop := + if i ∈ I then p.1 ∈ sourceSamplingRationalX T i ∧ p.2 ∈ sourceSamplingRationalY T i ∧ p.1 < p.2 + else p.1 ∈ sourceSamplingRationalX T i ∧ p.1 ∈ sourceSamplingRationalY T i + +theorem sourceSamplingLambdaTest_measurable (I : Finset SourceCoordinate) (T : SourceSamplingRationalTest) + (i : SourceCoordinate) : MeasurableSet {p | sourceSamplingLambdaTest I T i p} := by + by_cases hi : i ∈ I + · simp only [sourceSamplingLambdaTest,ite_eq_left hi] + exact (measurableSet_Icc.preimage measurable_fst).inter + ((measurableSet_Icc.preimage measurable_snd).inter (measurableSet_lt measurable_fst measurable_snd)) + · simp only [sourceSamplingLambdaTest,ite_eq_right hi] + exact (measurableSet_Icc.preimage measurable_fst).inter (measurableSet_Icc.preimage measurable_fst) + +/-- The finite coordinate conditions are equivalent to restriction by the +triangle and the full cylinder rectangle on the conull Haar cube. -/ +theorem sourceSamplingLambdaTest_iff (I : Finset SourceCoordinate) (T : SourceSamplingRationalTest) + (p : SourceCoordinate → ℝ × ℝ) + (hp : ∀ i, (p i).1 ∈ Set.Ico (0 : ℝ) 1 ∧ (p i).2 ∈ Set.Ico (0 : ℝ) 1) : + (∀ i ∈ I ∪ T.1, sourceSamplingLambdaTest I T i (p i)) ↔ + sourceSamplingLimitMap I p ∈ sourceSamplingRectangle (sourceSamplingRationalX T) (sourceSamplingRationalY T) ∧ + p ∈ sourceSamplingTriangleSet I := by + constructor + · intro h + constructor + · intro i + by_cases hi : i ∈ I + · have hh := h i (Finset.mem_union_left _ hi) + simp only [sourceSamplingLambdaTest,ite_eq_left hi] at hh + exact ⟨hh.1,by simpa only [sourceSamplingLimitMap,ite_eq_left hi] using hh.2.1⟩ + · by_cases ht : i ∈ T.1 + · have hh := h i (Finset.mem_union_right _ ht) + simpa only [sourceSamplingLambdaTest,sourceSamplingLimitMap,ite_eq_right hi] using hh + · have hx : (p i).1 ∈ Set.Icc (0 : ℝ) 1 := ⟨(hp i).1.1,(hp i).1.2.le⟩ + simpa only [sourceSamplingLimitMap,ite_eq_right hi,sourceSamplingRationalX,sourceSamplingRationalY, + sourceSamplingRationalEndpoints,dite_eq_right ht,Rat.cast_zero,Rat.cast_one] using And.intro hx hx + · intro i hi + have hh := h i (Finset.mem_union_left _ hi) + simp only [sourceSamplingLambdaTest,ite_eq_left hi] at hh + exact hh.2.2 + · rintro ⟨hrect,htri⟩ i _ + have hh := hrect i + by_cases hi : i ∈ I + · simp only [sourceSamplingLambdaTest,ite_eq_left hi] + exact ⟨hh.1,by simpa only [sourceSamplingLimitMap,ite_eq_left hi] using hh.2,htri i hi⟩ + · simpa only [sourceSamplingLambdaTest,sourceSamplingLimitMap,ite_eq_right hi] using hh + +/-- The constructed infinite-coordinate measure has exactly the rectangle +values previously obtained as sampling limits. -/ +theorem sourceSamplingLambda_rectangle (I : Finset SourceCoordinate) (T : SourceSamplingRationalTest) : + ((sourceSamplingLambda I) + (sourceSamplingRectangle (sourceSamplingRationalX T) (sourceSamplingRationalY T))).toReal = + sourceSamplingLimitRectangleMass I T := by + let R := sourceSamplingRectangle (sourceSamplingRationalX T) (sourceSamplingRationalY T) + let C := sourceSamplingLimitMap I ⁻¹' R ∩ sourceSamplingTriangleSet I + have hR : MeasurableSet R := sourceSamplingRectangle_measurable _ _ + (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc) + have hmap := sourceSamplingLimitMap_measurable I + have hC : MeasurableSet C := (hmap hR).inter (sourceSamplingTriangleSet_measurable I) + have he : C.indicator (fun _ => (1 : ℝ)) =ᵐ[sourceSamplingPairHaar] + (fun p => ∏ i ∈ I ∪ T.1, if sourceSamplingLambdaTest I T i (p i) then (1 : ℝ) else 0) := by + filter_upwards [sourceSamplingPairHaar_cube] with p hp + simp only [Finset.prod_ite_zero,Finset.prod_const_one, + sourceSamplingLambdaTest_iff I T p hp,Set.indicator_apply] + rfl + rw [sourceSamplingLambda,Measure.map_apply hmap hR,Measure.restrict_apply (hmap hR)] + change (sourceSamplingPairHaar C).toReal = _ + calc + _ = ∫ p, C.indicator (fun _ => (1 : ℝ)) p ∂sourceSamplingPairHaar := by + rw [integral_indicator hC]; simp [measureReal_def] + _ = ∫ p, ∏ i ∈ I ∪ T.1, if sourceSamplingLambdaTest I T i (p i) then (1 : ℝ) else 0 + ∂sourceSamplingPairHaar := integral_congr_ae he + _ = ∏ i ∈ I ∪ T.1, ∫ z, (if sourceSamplingLambdaTest I T i z then (1 : ℝ) else 0) + ∂unitIntervalMeasure.prod unitIntervalMeasure := + integral_infinitePi_finset_prod _ _ _ (fun i => + Measurable.ite (sourceSamplingLambdaTest_measurable I T i) measurable_const measurable_const) + _ = _ := by + rw [sourceSamplingLimitRectangleMass_formula] + apply Finset.prod_congr rfl + intro i _ + have hA := sourceSamplingLambdaTest_measurable I T i + have hh : (∫ z, (if sourceSamplingLambdaTest I T i z then (1 : ℝ) else 0) + ∂unitIntervalMeasure.prod unitIntervalMeasure) = + ((unitIntervalMeasure.prod unitIntervalMeasure) {z | sourceSamplingLambdaTest I T i z}).toReal := by + change (∫ z, {z | sourceSamplingLambdaTest I T i z}.indicator (fun _ => (1 : ℝ)) z + ∂unitIntervalMeasure.prod unitIntervalMeasure) = _ + rw [integral_indicator hA]; simp [measureReal_def] + rw [hh] + by_cases hi : i ∈ I + · simp only [sourceSamplingLambdaTest,ite_eq_left hi] + · simp only [sourceSamplingLambdaTest,ite_eq_right hi] + have heq : {z : ℝ × ℝ | z.1 ∈ sourceSamplingRationalX T i ∧ z.1 ∈ sourceSamplingRationalY T i} = + (sourceSamplingRationalX T i ∩ sourceSamplingRationalY T i) ×ˢ Set.univ := by ext z; simp + rw [heq,Measure.prod_prod] + simp + +/-- Actual untrimmed measures converge to the actual source limiting measure +on every rational cylinder rectangle, on a single conull event. -/ +theorem sourceSamplingLambda_rectangle_limit_event : + ∀ᵐ θ ∂sourceAngleLaw, ∀ (I : Finset SourceCoordinate) (T : SourceSamplingRationalTest), + Tendsto (fun stage => ((sourceSamplingUntrimmed I stage θ) + (sourceSamplingRectangle (sourceSamplingRationalX T) (sourceSamplingRationalY T))).toReal) + atTop (𝓝 (((sourceSamplingLambda I) + (sourceSamplingRectangle (sourceSamplingRationalX T) (sourceSamplingRationalY T))).toReal)) := by + filter_upwards [sourceSampling_rectangle_limit_event] with θ hθ + intro I T + rw [sourceSamplingLambda_rectangle] + exact hθ I T + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LimitMeasure.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LimitMeasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..2243a88036b6889bdd069237f2651dc2a2f2d1b3 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/LimitMeasure.lean @@ -0,0 +1,98 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.TriangleLaw +import OAI.Analysis.FiniteFactor.OrbitSampling.IdealRectangleLimit + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +abbrev sourceSamplingPairHaar : Measure (SourceCoordinate → ℝ × ℝ) := + Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure.prod unitIntervalMeasure) + +def sourceSamplingTriangleSet (I : Finset SourceCoordinate) : Set (SourceCoordinate → ℝ × ℝ) := + {p | ∀ i ∈ I, (p i).1 < (p i).2} + +def sourceSamplingLimitMap (I : Finset SourceCoordinate) (p : SourceCoordinate → ℝ × ℝ) : + (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) := + (fun i => (p i).1,fun i => if i ∈ I then (p i).2 else (p i).1) + +def sourceSamplingLambda (I : Finset SourceCoordinate) : + Measure ((SourceCoordinate → ℝ) × (SourceCoordinate → ℝ)) := + (sourceSamplingPairHaar.restrict (sourceSamplingTriangleSet I)).map (sourceSamplingLimitMap I) + +theorem sourceSamplingTriangleSet_measurable (I : Finset SourceCoordinate) : + MeasurableSet (sourceSamplingTriangleSet I) := by + simp only [sourceSamplingTriangleSet,Set.ofPred_forall] + apply MeasurableSet.iInter + intro i + apply MeasurableSet.iInter + intro _ + exact measurableSet_lt (measurable_fst.comp (measurable_pi_apply i)) + (measurable_snd.comp (measurable_pi_apply i)) + +theorem sourceSamplingLimitMap_measurable (I : Finset SourceCoordinate) : + Measurable (sourceSamplingLimitMap I) := by + apply Measurable.prodMk + · exact Measurable.of_eval (fun i => measurable_fst.comp (measurable_pi_apply i)) + · apply Measurable.of_eval + intro i + by_cases hi : i ∈ I + · simpa only [hi,ite_true,Function.comp_def] using measurable_snd.comp (measurable_pi_apply i) + · simpa only [hi,ite_false,Function.comp_def] using measurable_fst.comp (measurable_pi_apply i) + +instance sourceSamplingLambda_finite (I : Finset SourceCoordinate) : IsFiniteMeasure (sourceSamplingLambda I) := by + unfold sourceSamplingLambda + infer_instance + +theorem sourceSamplingPairHaar_cube : ∀ᵐ p ∂sourceSamplingPairHaar, + ∀ i, (p i).1 ∈ Set.Ico (0 : ℝ) 1 ∧ (p i).2 ∈ Set.Ico (0 : ℝ) 1 := by + apply ae_all_iff.mpr + intro i + have hp : ∀ᵐ z ∂unitIntervalMeasure.prod unitIntervalMeasure, + z.1 ∈ Set.Ico (0 : ℝ) 1 ∧ z.2 ∈ Set.Ico (0 : ℝ) 1 := by + apply (Measure.ae_prod_iff_ae_ae (measurableSet_Ico.prod measurableSet_Ico)).mpr + filter_upwards [ae_restrict_mem measurableSet_Ico] with x hx + filter_upwards [ae_restrict_mem measurableSet_Ico] with y hy + exact ⟨hx,hy⟩ + have hh : ∀ᵐ z ∂sourceSamplingPairHaar.map (fun p => p i), + z.1 ∈ Set.Ico (0 : ℝ) 1 ∧ z.2 ∈ Set.Ico (0 : ℝ) 1 := by + rw [Measure.infinitePi_map_eval] + exact hp + exact ae_of_ae_map (measurable_pi_apply i).aemeasurable hh + +/-- The actual limiting measure is carried by ordered pairs. -/ +theorem sourceSamplingLambda_ordered (I : Finset SourceCoordinate) : + ∀ᵐ p ∂sourceSamplingLambda I, ∀ i, p.1 i ≤ p.2 i := by + have horder : MeasurableSet {p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) | + ∀ i, p.1 i ≤ p.2 i} := by + simp only [Set.ofPred_forall] + exact MeasurableSet.iInter (fun i => measurableSet_le + ((measurable_pi_apply i).comp measurable_fst) ((measurable_pi_apply i).comp measurable_snd)) + apply (ae_map_iff (sourceSamplingLimitMap_measurable I).aemeasurable horder).mpr + filter_upwards [ae_restrict_mem (sourceSamplingTriangleSet_measurable I)] with p hp + intro i + by_cases hi : i ∈ I + · simpa only [sourceSamplingLimitMap,ite_eq_left hi] using (hp i hi).le + · simp [sourceSamplingLimitMap,hi] + +/-- The finite rectangle formula for the source limit, written using actual +Lebesgue triangular and diagonal masses. -/ +theorem sourceSamplingLimitRectangleMass_formula (I : Finset SourceCoordinate) (T : SourceSamplingRationalTest) : + sourceSamplingLimitRectangleMass I T = ∏ i ∈ I ∪ T.1, + if i ∈ I then ((unitIntervalMeasure.prod unitIntervalMeasure) + {p : ℝ × ℝ | p.1 ∈ sourceSamplingRationalX T i ∧ + p.2 ∈ sourceSamplingRationalY T i ∧ p.1 < p.2}).toReal + else (unitIntervalMeasure (sourceSamplingRationalX T i ∩ sourceSamplingRationalY T i)).toReal := by + apply Finset.prod_congr rfl + intro i _ + by_cases hi : i ∈ I + · simp only [ite_eq_left hi] + exact samplingTestedFirstDensity_triangular_mass _ _ _ _ measurableSet_Icc measurableSet_Icc + · simp only [ite_eq_right hi] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Measures.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Measures.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b0dd0a433e2b0adc9405bf0f4a445b9b1bc3c3d --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Measures.lean @@ -0,0 +1,79 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.Weights + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Finset Filter +open scoped ENNReal +noncomputable section + +abbrev sourceSamplingHaar : Measure (SourceCoordinate → ℝ) := + Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure) + +def sourceSamplingWeightedMeasure (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) : Measure (SourceCoordinate → ℝ) := + sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal (sourceSamplingWeight I s θ n x)) + +instance sourceSamplingWeightedMeasure_finite (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) : IsFiniteMeasure (sourceSamplingWeightedMeasure I s θ n) := by + apply isFiniteMeasure_withDensity + let C := ((sourceBlockSize s : ℝ)^(13/5 : ℝ))^(sourceSamplingPrefix s).card + have hh : (∫⁻ x, ENNReal.ofReal (sourceSamplingWeight I s θ n x) ∂sourceSamplingHaar) ≤ ENNReal.ofReal C := by + calc + _ ≤ ∫⁻ _x, ENNReal.ofReal C ∂sourceSamplingHaar := + lintegral_mono (fun x => ENNReal.ofReal_le_ofReal (sourceSamplingWeight_bounds I s θ n x).2) + _ = _ := by simp + exact ne_top_of_le_ne_top ENNReal.ofReal_ne_top hh + +def sourceSamplingSummand (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) : + Measure ((SourceCoordinate → ℝ) × (SourceCoordinate → ℝ)) := + (sourceSamplingWeightedMeasure I s θ n).map (fun x => (x,coordinateRotate θ n x)) + +instance sourceSamplingSummand_finite (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) : IsFiniteMeasure (sourceSamplingSummand I s θ n) := by + unfold sourceSamplingSummand + infer_instance + +theorem sourceSamplingSummand_first_marginal (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) : + (sourceSamplingSummand I s θ n).map Prod.fst = sourceSamplingWeightedMeasure I s θ n := by + unfold sourceSamplingSummand + have hp : Measurable (fun x : SourceCoordinate → ℝ => (x,coordinateRotate θ n x)) := + measurable_id.prodMk (coordinateRotate_preserving θ n).measurable + rw [Measure.map_map measurable_fst hp] + exact Measure.map_id + +/-- Finite positive untrimmed measures averaged over the constructed powers. +No weak limit or uniform marginal bound is asserted by this definition. -/ +def sourceSamplingUntrimmed (I : Finset SourceCoordinate) (s : ℕ) (θ : SourceCoordinate → ℝ) : + Measure ((SourceCoordinate → ℝ) × (SourceCoordinate → ℝ)) := + ENNReal.ofReal (1/((sourceSamplingPowers s).card : ℝ)) • + ∑ n ∈ sourceSamplingPowers s, sourceSamplingSummand I s θ n + +theorem sourceSamplingHaar_cube : ∀ᵐ x ∂sourceSamplingHaar, + ∀ i : SourceCoordinate, x i ∈ Set.Ico (0 : ℝ) 1 := by + rw [ae_all_iff] + intro i + have hh : ∀ᵐ t ∂sourceSamplingHaar.map (fun x => x i), t ∈ Set.Ico (0 : ℝ) 1 := by + rw [Measure.infinitePi_map_eval] + exact ae_restrict_mem measurableSet_Ico + exact (ae_map_iff (measurable_pi_apply i).aemeasurable measurableSet_Ico).mp hh + +/-- The weighted source law already orders every coordinate in its prefix. -/ +theorem sourceSamplingWeightedMeasure_orders (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) : + ∀ᵐ x ∂sourceSamplingWeightedMeasure I s θ n, + ∀ i ∈ sourceSamplingPrefix s, x i < coordinateRotate θ n x i := by + rw [sourceSamplingWeightedMeasure,ae_withDensity_iff + ((sourceSamplingWeight_measurable I s θ n).ennreal_ofReal)] + filter_upwards [sourceSamplingHaar_cube] with x hx hw + have hw' : sourceSamplingWeight I s θ n x ≠ 0 := by + intro he + exact hw (by rw [he]; simp) + exact sourceSamplingWeight_orders_prefix I s θ n x hx hw' + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Moments.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Moments.lean new file mode 100644 index 0000000000000000000000000000000000000000..919664fe4d2084a2989e134d90fb0823f3b75772 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Moments.lean @@ -0,0 +1,50 @@ +import OAI.Analysis.FiniteFactor.Sampling.TestedSecondMoment +import OAI.Analysis.FiniteFactor.OrbitSampling.Weights + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +noncomputable section + +theorem sourceSamplingWidth_le_half (s : ℕ) : sourceSamplingWidth s ≤ 1/2 := by + have hm : (100 : ℝ) ≤ sourceBlockSize s := by exact_mod_cast (sourceStage s).m_ge_100 + have hm0 : 0 ≤ (sourceBlockSize s : ℝ) := by positivity + have he : sourceSamplingWidth s ≤ (sourceBlockSize s : ℝ)^(-1/2 : ℝ) := + Real.rpow_le_rpow_of_exponent_le (by linarith) (by norm_num) + have hs : 2 ≤ Real.sqrt (sourceBlockSize s : ℝ) := by + nlinarith [Real.sq_sqrt hm0,Real.sqrt_nonneg (sourceBlockSize s : ℝ)] + apply he.trans + rw [show (-1/2 : ℝ) = -(1/2) by ring,Real.rpow_neg hm0,← Real.sqrt_eq_rpow] + simpa only [one_div] using (one_div_le_one_div_of_le (by norm_num : (0 : ℝ) < 2) hs) + +/-- Exact stage parameters discharge all cutoff/width assumptions in the +source's tested second-diagonal one-coordinate moment bound. -/ +theorem sourceSampling_tested_second_moment (s : ℕ) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + (∀ᵐ x ∂unitIntervalMeasure, + 0 ≤ samplingTestedSecondDensity (sourceSamplingWidth s) (sourceSamplingCutoff s) E G x ∧ + samplingTestedSecondDensity (sourceSamplingWidth s) (sourceSamplingCutoff s) E G x ≤ 2) ∧ + (∫ x, samplingTestedSecondDensity (sourceSamplingWidth s) (sourceSamplingCutoff s) E G x^2 + ∂unitIntervalMeasure) ≤ 1+4*(sourceBlockSize s : ℝ)^(-6/5 : ℝ) := by + have hp := sourceSampling_parameters s + have hhalf := sourceSamplingWidth_le_half s + have hden : 0 < 1-sourceSamplingWidth s := by linarith [hp.2.1] + have hb := samplingTestedSecondDensity_square (sourceSamplingWidth s) (sourceSamplingCutoff s) + E G hp.1 hp.2.1 hp.2.2 hE hG + have hi : 1/(1-sourceSamplingWidth s) ≤ 2 := (div_le_iff₀ hden).mpr (by linarith) + have herror : (sourceSamplingWidth s)^2/(1-sourceSamplingWidth s)^2 ≤ 4*(sourceSamplingWidth s)^2 := by + apply (div_le_iff₀ (sq_pos_of_pos hden)).mpr + have hsq : (1/4 : ℝ) ≤ (1-sourceSamplingWidth s)^2 := by nlinarith + nlinarith [sq_nonneg (sourceSamplingWidth s),mul_nonneg (sq_nonneg (sourceSamplingWidth s)) + (show 0 ≤ (1-sourceSamplingWidth s)^2-1/4 by linarith)] + have he : (sourceSamplingWidth s)^2 = (sourceBlockSize s : ℝ)^(-6/5 : ℝ) := by + unfold sourceSamplingWidth + rw [← Real.rpow_natCast,← Real.rpow_mul (sourceBlockSize_pos s).le] + norm_num + exact ⟨hb.1.mono (fun x hx => ⟨hx.1,hx.2.trans hi⟩),hb.2.trans (by rw [← he]; linarith)⟩ + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/OrbitSupport.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/OrbitSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3e98f8c2e03a8a541c5fa9186ebe6dbaa6c3c0c --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/OrbitSupport.lean @@ -0,0 +1,48 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.OrderedRestriction + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +def sourceSamplingPositiveOrbits (s : ℕ) (θ : SourceCoordinate → ℝ) : Set SourceSamplingPair := + {p | ∃ n ∈ sourceSamplingPowers s, 0 < n ∧ p.2 = coordinateRotate θ n p.1} + +theorem sourceSamplingPositiveOrbits_measurable (s : ℕ) (θ : SourceCoordinate → ℝ) : + MeasurableSet (sourceSamplingPositiveOrbits s θ) := by + simp only [sourceSamplingPositiveOrbits,Set.ofPred_exists] + apply MeasurableSet.iUnion + intro n + by_cases hn : n ∈ sourceSamplingPowers s + · simp only [hn,true_and] + by_cases hp : 0 < n + · simp only [hp,true_and] + exact measurableSet_eq_fun measurable_snd ((coordinateRotate_preserving θ n).measurable.comp measurable_fst) + · simp [hp] + · simp [hn] + +theorem sourceSamplingSummand_positive_orbit (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) (hn : n ∈ sourceSamplingPowers s) : + ∀ᵐ p ∂sourceSamplingSummand I s θ n, p ∈ sourceSamplingPositiveOrbits s θ := by + apply (ae_map_iff (measurable_id.prodMk (coordinateRotate_preserving θ n).measurable).aemeasurable + (sourceSamplingPositiveOrbits_measurable s θ)).mpr + exact Eventually.of_forall (fun x => ⟨n,hn,(sourceSamplingPowers_positive s n hn).1,rfl⟩) + +/-- Trimming preserves the constructed finite set of strictly positive +orbit powers while imposing coordinatewise order everywhere. -/ +theorem sourceSamplingTrimmed_orbits (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : ∀ᵐ p ∂sourceSamplingTrimmed I s θ, + (∀ i, p.1 i ≤ p.2 i) ∧ ∃ n ∈ sourceSamplingPowers s, 0 < n ∧ p.2 = coordinateRotate θ n p.1 := by + have hu : ∀ᵐ p ∂sourceSamplingUntrimmed I s θ, p ∈ sourceSamplingPositiveOrbits s θ := by + apply Measure.ae_smul_measure + rw [ae_iff,Measure.finsetSum_apply] + exact Finset.sum_eq_zero (fun n hn => ae_iff.mp (sourceSamplingSummand_positive_orbit I s θ n hn)) + filter_upwards [sourceSamplingTrimmed_ordered I s θ,ae_restrict_of_ae hu] with p ho hp + exact ⟨ho,hp⟩ + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/OrderedRestriction.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/OrderedRestriction.lean new file mode 100644 index 0000000000000000000000000000000000000000..23177aff35af619cc2362665d4cfe409ca30780a --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/OrderedRestriction.lean @@ -0,0 +1,100 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.Cube +import OAI.Analysis.FiniteFactor.OrbitSampling.WeightedTail + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +def sourceSamplingOrdered : Set SourceSamplingPair := {p | ∀ i, p.1 i ≤ p.2 i} + +theorem sourceSamplingOrdered_measurable : MeasurableSet sourceSamplingOrdered := by + simp only [sourceSamplingOrdered,Set.ofPred_forall] + exact MeasurableSet.iInter (fun i => measurableSet_le + ((measurable_pi_apply i).comp measurable_fst) ((measurable_pi_apply i).comp measurable_snd)) + +/-- The actual ordered restriction of the already constructed average. -/ +def sourceSamplingTrimmed (I : Finset SourceCoordinate) (s : ℕ) (θ : SourceCoordinate → ℝ) : + Measure SourceSamplingPair := (sourceSamplingUntrimmed I s θ).restrict sourceSamplingOrdered + +instance sourceSamplingTrimmed_finite (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : IsFiniteMeasure (sourceSamplingTrimmed I s θ) := by + unfold sourceSamplingTrimmed + infer_instance + +theorem sourceSamplingTrimmed_ordered (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : ∀ᵐ p ∂sourceSamplingTrimmed I s θ, ∀ i, p.1 i ≤ p.2 i := + ae_restrict_mem sourceSamplingOrdered_measurable + +theorem sourceSamplingTrimmed_le (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : sourceSamplingTrimmed I s θ ≤ sourceSamplingUntrimmed I s θ := + Measure.restrict_le_self + +theorem sourceSamplingPowers_positive (s : ℕ) (n : ℤ) (hn : n ∈ sourceSamplingPowers s) : + 0 < n ∧ (n : ℝ) ≤ samplingQ (sourceBlockSize s) := by + by_cases hs : 200000 ≤ sourceBlockSize s + · exact ⟨((sourceSamplingPowers_spec s hs).1 n hn).2.2, + ((sourceSamplingPowers_spec s hs).1 n hn).2.1⟩ + · simp [sourceSamplingPowers,hs] at hn + +/-- Outside the finite prefix, every failure of global order is an actual +member of the source's countable tail-failure event. -/ +theorem sourceSampling_order_failure_tail (s n : ℕ) (θ x : SourceCoordinate → ℝ) + (hprefix : ∀ i ∈ sourceSamplingPrefix s, x i < coordinateRotate θ (n : ℤ) x i) + (hbad : (x,coordinateRotate θ (n : ℤ) x) ∉ sourceSamplingOrdered) : + x ∈ sourceTailOrderFailure θ (s+1) n := by + have hb : ∃ i, coordinateRotate θ (n : ℤ) x i < x i := by + simpa only [sourceSamplingOrdered,Set.mem_ofPred_eq,not_forall,not_le] using hbad + obtain ⟨i,hi⟩ := hb + have hout : i ∉ sourceSamplingPrefix s := fun hh => (hprefix i hh).asymm hi + have hk : s+1 ≤ i.1 := by + have hh := (CouplingParameters.mem_blockPrefix sourceBlockSize (s+1) i) + change i ∉ CouplingParameters.blockPrefix sourceBlockSize (s+1) at hout + have hnot : ¬ i.1 < s+1 := fun hi => hout (hh.mpr hi) + omega + rcases i with ⟨k,j⟩ + obtain ⟨r,rfl⟩ := Nat.exists_eq_add_of_le hk + apply Set.mem_iUnion.mpr ⟨r,?_⟩ + apply Set.mem_iUnion.mpr ⟨j,?_⟩ + simpa only [coordinateRotate,Int.cast_natCast,Set.mem_ofPred_eq] using hi + +/-- Discarded mass of each real summand obeys the preserved relative +weighted-tail estimate. This includes summands of mass zero. -/ +theorem sourceSamplingSummand_discarded_le (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (hθ : SourceAngles θ) (n : ℤ) + (hn : n ∈ sourceSamplingPowers s) : + sourceSamplingSummand I s θ n sourceSamplingOrderedᶜ ≤ + sourceSamplingSummand I s θ n Set.univ * + ENNReal.ofReal (4*(sourceBlockSize s : ℝ)^(-(sourceBlockSize s : ℝ)/20)) := by + have hp := sourceSamplingPowers_positive s n hn + have he : (n.toNat : ℤ) = n := Int.toNat_of_nonneg hp.1.le + have hm : Measurable (fun x => (x,coordinateRotate θ n x)) := + measurable_id.prodMk (coordinateRotate_preserving θ n).measurable + rw [sourceSamplingSummand,Measure.map_apply hm sourceSamplingOrdered_measurable.compl, + Measure.map_apply hm MeasurableSet.univ,Set.preimage_univ] + have hc : (n.toNat : ℝ) = (n : ℝ) := by exact_mod_cast he + have hb := sourceSampling_weighted_tail_small I s θ hθ n.toNat (by rw [hc]; exact hp.2) + rw [he] at hb + apply le_trans _ hb + apply measure_mono_ae + filter_upwards [sourceSamplingWeightedMeasure_orders I s θ n] with x hx + intro hb + change (x,coordinateRotate θ n x) ∉ sourceSamplingOrdered at hb + exact sourceSampling_order_failure_tail s n.toNat θ x (by simpa [he] using hx) (by simpa [he] using hb) + +/-- The average loses at most the same relative error as each summand. -/ +theorem sourceSamplingUntrimmed_discarded_le (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (hθ : SourceAngles θ) : + sourceSamplingUntrimmed I s θ sourceSamplingOrderedᶜ ≤ + sourceSamplingUntrimmed I s θ Set.univ * + ENNReal.ofReal (4*(sourceBlockSize s : ℝ)^(-(sourceBlockSize s : ℝ)/20)) := by + simp only [sourceSamplingUntrimmed,Measure.smul_apply,smul_eq_mul,Measure.finsetSum_apply] + rw [mul_assoc,Finset.sum_mul] + exact mul_le_mul' le_rfl (Finset.sum_le_sum (fun n hn => sourceSamplingSummand_discarded_le I s θ hθ n hn)) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/PairMoments.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/PairMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ce938e6b67c527ff3cd4d0f307acaec840e702d --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/PairMoments.lean @@ -0,0 +1,78 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.SecondCorrelation +import OAI.Analysis.FiniteFactor.Sampling.SecondTriangular +import OAI.Analysis.FiniteFactor.Sampling.IntegratedCorrelation + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical +noncomputable section + +/-- All four actual tested coordinate cases have the same pair-error budget. -/ +theorem sourceSampling_oriented_pair_error (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (i : SourceCoordinate) (hi : i.1 ≤ stage) (n n' : ℤ) + (hn : n ∈ sourceSamplingPowers stage) (hn' : n' ∈ sourceSamplingPowers stage) (hne : n ≠ n') + (r b : Bool) (a c a' c' s : ℝ) (hsx : s ∈ Set.Ioo (0 : ℝ) 1) : + |(∫ θ, samplingOrientedWeight r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (Set.Icc a c) (Set.Icc a' c') s (Int.fract ((n : ℝ)*θ i)) * + samplingOrientedWeight r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (Set.Icc a c) (Set.Icc a' c') s (Int.fract ((n' : ℝ)*θ i)) ∂sourceAngleLaw) - + samplingOrientedDensity r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (Set.Icc a c) (Set.Icc a' c') s ^ 2| ≤ + 104*(sourceBlockSize stage : ℝ)^(-74 : ℝ) := by + have hm1 : (1 : ℝ) ≤ sourceBlockSize stage := by + have h := (sourceStage stage).m_ge_100 + exact_mod_cast (by omega : 1 ≤ sourceBlockSize stage) + cases r + · have hb := sourceSampling_first_pair_error stage hs i hi n n' hn hn' hne b + (Set.Icc a c) a' c' s ⟨hsx.1.le,hsx.2⟩ + exact hb.trans (by nlinarith [Real.rpow_nonneg (sourceBlockSize_pos stage).le (-74 : ℝ)]) + · cases b + · exact sourceSampling_second_pair_error stage hs i hi n n' hn hn' hne + (Set.Icc a' c') measurableSet_Icc a c s ⟨hsx.1.le,hsx.2⟩ + · have := sourceSampling_phase_null_singletons stage hs i hi n hn + have := sourceSampling_phase_null_singletons stage hs i hi n' hn' + have hm (k : ℤ) : Measurable (fun θ : SourceCoordinate → ℝ => Int.fract ((k : ℝ)*θ i)) := + sourceFract_measurable.comp (measurable_const.mul (measurable_pi_apply i)) + have hp := sourceSampling_parameters stage + have hb := samplingSecondTriangular_pair_bound sourceAngleLaw + (fun θ => Int.fract ((n : ℝ)*θ i)) (fun θ => Int.fract ((n' : ℝ)*θ i)) (hm n) (hm n') + (Eventually.of_forall (fun θ => ⟨Int.fract_nonneg _,Int.fract_lt_one _⟩)) + (Eventually.of_forall (fun θ => ⟨Int.fract_nonneg _,Int.fract_lt_one _⟩)) + _ (by positivity) (sourceSampling_rectangle_bound stage hs i hi n n' hn hn' hne) + _ _ (Set.Icc a' c') a c s hp.1 hp.2.1 hp.2.2 hsx + apply hb.trans + have he := Real.rpow_le_rpow_of_exponent_le hm1 (show (-80 : ℝ) ≤ -74 by norm_num) + nlinarith [Real.rpow_nonneg (sourceBlockSize_pos stage).le (-74 : ℝ)] + +theorem sourceSampling_coordinate_pair_error (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (i : SourceCoordinate) (hi : i.1 ≤ stage) (n n' : ℤ) + (hn : n ∈ sourceSamplingPowers stage) (hn' : n' ∈ sourceSamplingPowers stage) (hne : n ≠ n') + (r b : Bool) (a c a' c' : ℝ) : + |(∫ s, ∫ θ, samplingOrientedWeight r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (Set.Icc a c) (Set.Icc a' c') s (Int.fract ((n : ℝ)*θ i)) * + samplingOrientedWeight r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (Set.Icc a c) (Set.Icc a' c') s (Int.fract ((n' : ℝ)*θ i)) ∂sourceAngleLaw ∂unitIntervalMeasure) - + (∫ s, samplingOrientedDensity r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (Set.Icc a c) (Set.Icc a' c') s ^ 2 ∂unitIntervalMeasure)| ≤ + 104*(sourceBlockSize stage : ℝ)^(-74 : ℝ) := by + have hp := sourceSampling_parameters stage + apply sampling_integrated_pair_error sourceAngleLaw + (fun θ => Int.fract ((n : ℝ)*θ i)) (fun θ => Int.fract ((n' : ℝ)*θ i)) + (sourceFract_measurable.comp (measurable_const.mul (measurable_pi_apply i))) + (sourceFract_measurable.comp (measurable_const.mul (measurable_pi_apply i))) + (samplingOrientedWeight r b _ _ (Set.Icc a c) (Set.Icc a' c')) + (samplingOrientedWeight_measurable r b _ _ _ _ measurableSet_Icc measurableSet_Icc) + (max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage))) _ + (samplingOrientedWeight_bounds r b _ _ _ _ hp.1 hp.2.2) + have : NullSingletonClass unitIntervalMeasure := by unfold unitIntervalMeasure; infer_instance + filter_upwards [self_mem_ae_restrict measurableSet_Ico, + ae_iff.mpr (show unitIntervalMeasure {s | ¬s ≠ 0} = 0 by simp)] with s hsx hs0 + exact sourceSampling_oriented_pair_error stage hs i hi n n' hn hn' hne r b a c a' c' s + ⟨lt_of_le_of_ne hsx.1 (Ne.symm hs0),hsx.2⟩ + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/PhaseSelfMoment.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/PhaseSelfMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..2228edbfb64922f7b08d87eb3019615d74314dba --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/PhaseSelfMoment.lean @@ -0,0 +1,61 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.SelfMoment + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped ENNReal +noncomputable section + +/-- Marginal phase domination controls the joint self-pair integral. +This is the source's one-phase step before taking coordinate products. -/ +theorem sampling_phase_square_bound {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → ℝ) (hX : Measurable X) + (hdom : μ.map X ≤ (2 : ℝ≥0∞) • unitIntervalMeasure) + (u : ℝ → ℝ → ℝ) (C : ℝ) (hu : Measurable (fun p : ℝ × ℝ => u p.1 p.2)) + (hb : ∀ s t, 0 ≤ u s t ∧ u s t ≤ C) : + (∫ s, ∫ ω, u s (X ω)^2 ∂μ ∂unitIntervalMeasure) ≤ + 2*(∫ s, ∫ t, u s t^2 ∂unitIntervalMeasure ∂unitIntervalMeasure) := by + have hΩ : Measurable (fun p : ℝ × Ω => u p.1 (X p.2)) := + hu.comp (measurable_fst.prodMk (hX.comp measurable_snd)) + have hiΩ := sampling_square_integrable (unitIntervalMeasure.prod μ) _ C hΩ + (fun p => hb p.1 (X p.2)) + have hiU := sampling_square_integrable (unitIntervalMeasure.prod unitIntervalMeasure) _ C hu + (fun p => hb p.1 p.2) + have hpoint (s : ℝ) : (∫ ω, u s (X ω)^2 ∂μ) ≤ 2*(∫ t, u s t^2 ∂unitIntervalMeasure) := by + have hm : Measurable (fun t => u s t) := hu.comp (measurable_const.prodMk measurable_id) + have hi := sampling_square_integrable unitIntervalMeasure _ C hm (hb s) + have hbig := hi.smul_measure (c := (2 : ℝ≥0∞)) (by norm_num) + have hle := integral_mono_measure hdom (Eventually.of_forall (fun t => sq_nonneg (u s t))) hbig + rw [integral_map hX.aemeasurable (hm.pow_const 2).aestronglyMeasurable, + integral_smul_measure] at hle + simpa using hle + calc + _ ≤ ∫ s, 2*(∫ t, u s t^2 ∂unitIntervalMeasure) ∂unitIntervalMeasure := + integral_mono_ae hiΩ.integral_prod_left (hiU.integral_prod_left.const_mul 2) + (Eventually.of_forall hpoint) + _ = _ := integral_const_mul _ _ + +/-- Actual angle expectation of the tested self-pair, at every admissible +selected power, for all source orientations and coordinate types. -/ +theorem sourceSampling_phase_self_moment (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (i : SourceCoordinate) (hi : i.1 ≤ stage) (n : ℤ) (hn : n ∈ sourceSamplingPowers stage) + (r b : Bool) (E G : Set ℝ) (hE : MeasurableSet E) (hG : MeasurableSet G) : + (∫ s, ∫ θ, samplingOrientedWeight r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + E G s (Int.fract ((n : ℝ)*θ i)) ^ 2 ∂sourceAngleLaw ∂unitIntervalMeasure) ≤ + 2+8*(sourceBlockSize stage : ℝ)^(3/5 : ℝ)*Real.log (sourceBlockSize stage : ℝ) := by + have hp := sourceSampling_parameters stage + have hbound := sampling_phase_square_bound sourceAngleLaw (fun θ => Int.fract ((n : ℝ)*θ i)) + (sourceFract_measurable.comp (measurable_const.mul (measurable_pi_apply i))) + (sourceSampling_phase_domination stage hs i hi n hn) + (samplingOrientedWeight r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E G) + (max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage))) + (samplingOrientedWeight_measurable r b _ _ E G hE hG) + (samplingOrientedWeight_bounds r b _ _ E G hp.1 hp.2.2) + have hself := sourceSampling_oriented_self_moment stage r b E G hE hG + exact hbound.trans (by nlinarith) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Powers.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Powers.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd237ebaf258e41eae7a78e38789e484cdcc69d2 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Powers.lean @@ -0,0 +1,153 @@ +import OAI.Analysis.FiniteFactor.Sampling.Selection +import OAI.Analysis.FiniteFactor.CrossedProduct.PhaseDecay + +namespace OAI + +namespace FiniteFactor +open Finset Filter +open scoped Topology +noncomputable section + +def samplingQ (m : ℕ) : ℝ := (m : ℝ)^((7/10 : ℝ)*(m : ℝ)) +def samplingH (m : ℕ) : ℕ := m^300 +def samplingR (m K : ℕ) : ℕ := m*K*m^1000 + +theorem sampling_integer_candidates (Q : ℝ) (hQ : 4 ≤ Q) : + Q/4 ≤ ((Finset.Icc ⌈Q/2⌉ ⌊Q⌋).card : ℝ) := by + have hf := Int.sub_one_lt_floor Q + have hc := Int.ceil_lt_add_one (Q/2) + have horder : ⌈Q/2⌉ ≤ ⌊Q⌋ := by + have : (⌈Q/2⌉ : ℝ) < (⌊Q⌋ : ℝ)+1 := by linarith + have ht : ⌈Q/2⌉ < ⌊Q⌋+1 := by exact_mod_cast this + omega + rw [Int.card_Icc] + have hcast : ((⌊Q⌋+1-⌈Q/2⌉).toNat : ℝ) = (⌊Q⌋ : ℝ)+1-(⌈Q/2⌉ : ℝ) := by + exact_mod_cast Int.toNat_of_nonneg (by omega : 0 ≤ ⌊Q⌋+1-⌈Q/2⌉) + rw [hcast] + linarith + +theorem sampling_forbidden_budget (m K : ℕ) (hm : 4 ≤ m) (hK : K ≤ m) : + (((2*samplingH m+1)^2*(2*samplingR m K+1) : ℕ) : ℝ) ≤ (m : ℝ)^1605 := by + have hm1 : 1 ≤ m := by omega + have hh : 1 ≤ samplingH m := one_le_pow₀ hm1 + have hr : samplingR m K ≤ m^1002 := by + unfold samplingR + calc + m*K*m^1000 ≤ m*m*m^1000 := by gcongr + _ = m^1002 := by ring + have hp : 1 ≤ m^1002 := one_le_pow₀ hm1 + have hD : (2*samplingH m+1)^2*(2*samplingR m K+1) ≤ 27*m^1602 := by + calc + _ ≤ (3*samplingH m)^2*(3*m^1002) := by gcongr <;> omega + _ = _ := by unfold samplingH; ring + have h27 : 27 ≤ m^3 := (by norm_num : 27 ≤ (4 : ℕ)^3).trans (Nat.pow_le_pow_left hm 3) + have hhD : (2*samplingH m+1)^2*(2*samplingR m K+1) ≤ m^1605 := by + calc + _ ≤ 27*m^1602 := hD + _ ≤ m^3*m^1602 := Nat.mul_le_mul_right _ h27 + _ = _ := by ring + exact_mod_cast hhD + +/-- An explicit sufficiently-large threshold discharges the source's greedy +asymptotics, retaining Q, H, R and the exponent 0.69m exactly. -/ +theorem exists_source_sampling_powers (m K : ℕ) (hm : 200000 ≤ m) (hK : K ≤ m) : + ∃ N : Finset ℤ, + (∀ n ∈ N, samplingQ m/2 ≤ (n : ℝ) ∧ (n : ℝ) ≤ samplingQ m ∧ 0 < n) ∧ + (m : ℝ)^((69/100 : ℝ)*(m : ℝ)) ≤ (N.card : ℝ) ∧ + (N : Set ℤ).Pairwise (fun n n' => ¬SamplingConflict (samplingH m) (samplingR m K) n n') := by + have hmR : (200000 : ℝ) ≤ m := by exact_mod_cast hm + have hm0 : (0 : ℝ) < m := by linarith + have hm1 : (1 : ℝ) ≤ m := by linarith + have hQ : (m : ℝ)^1606 ≤ samplingQ m := by + unfold samplingQ + rw [← Real.rpow_natCast] + apply Real.rpow_le_rpow_of_exponent_le hm1 + norm_num + linarith + have hmQ : (m : ℝ) ≤ samplingQ m := by + calc + _ ≤ (m : ℝ)^1606 := le_self_pow₀ hm1 (by norm_num) + _ ≤ _ := hQ + have hQ4 : 4 ≤ samplingQ m := by linarith + have hR : (samplingR m K : ℝ) < samplingQ m/2 := by + have hr : samplingR m K ≤ m^1002 := by + unfold samplingR + calc + m*K*m^1000 ≤ m*m*m^1000 := by gcongr + _ = _ := by ring + have hsmall : (m : ℝ)^1002 * (m : ℝ) ≤ (m : ℝ)^1606 := by + rw [← pow_succ] + exact pow_le_pow_right₀ hm1 (by norm_num) + have hrR : (samplingR m K : ℝ) ≤ (m : ℝ)^1002 := by exact_mod_cast hr + have hpos : 0 < (m : ℝ)^1002 := by positivity + nlinarith + let S := Finset.Icc ⌈samplingQ m/2⌉ ⌊samplingQ m⌋ + have hS (n : ℤ) (hn : n ∈ S) : + samplingQ m/2 ≤ (n : ℝ) ∧ (n : ℝ) ≤ samplingQ m := by + have hh := mem_Icc.mp hn + constructor + · exact (Int.le_ceil _).trans (by exact_mod_cast hh.1) + · exact (show (n : ℝ) ≤ (⌊samplingQ m⌋ : ℝ) by exact_mod_cast hh.2).trans (Int.floor_le _) + obtain ⟨N,hNS,hpair,hcard⟩ := exists_sampling_separated (samplingH m) (samplingR m K) + (one_le_pow₀ (by omega)) S (fun n hn => by exact_mod_cast hR.trans_le (hS n hn).1) + refine ⟨N, fun n hn => ⟨(hS n (hNS hn)).1, (hS n (hNS hn)).2, ?_⟩, ?_, hpair⟩ + · have hh := (hS n (hNS hn)).1 + have : (0 : ℝ) < n := by linarith + exact_mod_cast this + · have hcount : samplingQ m/4 ≤ + (((2*samplingH m+1)^2*(2*samplingR m K+1) : ℕ) : ℝ)*(N.card : ℝ) := + (sampling_integer_candidates _ hQ4).trans (by exact_mod_cast hcard) + have hDb := sampling_forbidden_budget m K (by omega) hK + have hcount' : samplingQ m/4 ≤ (m : ℝ)^1605*(N.card : ℝ) := + hcount.trans (mul_le_mul_of_nonneg_right hDb (Nat.cast_nonneg _)) + have hexp : (m : ℝ)^1605*(m : ℝ)^((69/100 : ℝ)*(m : ℝ))*(m : ℝ) ≤ samplingQ m := by + unfold samplingQ + calc + _ = (m : ℝ)^(1605+(69/100 : ℝ)*(m : ℝ)+1) := by + rw [Real.rpow_add hm0, Real.rpow_one, Real.rpow_add hm0] + norm_num [Real.rpow_ofNat] + _ ≤ _ := by + apply Real.rpow_le_rpow_of_exponent_le hm1 + norm_num + linarith + have hprod : 0 < (m : ℝ)^1605 := by positivity + have htarget : 0 ≤ (m : ℝ)^((69/100 : ℝ)*(m : ℝ)) := by positivity + apply (mul_le_mul_iff_right₀ hprod).mp + nlinarith + +/-- A deterministic finite set fixed from the numerical stages alone. -/ +def sourceSamplingPowers (s : ℕ) : Finset ℤ := + if h : 200000 ≤ sourceBlockSize s then + Classical.choose (exists_source_sampling_powers (sourceBlockSize s) + (sourceStageState s).K h (sourceStage s).m_ge_K) + else ∅ + +theorem sourceSamplingPowers_spec (s : ℕ) (hs : 200000 ≤ sourceBlockSize s) : + (∀ n ∈ sourceSamplingPowers s, + samplingQ (sourceBlockSize s)/2 ≤ (n : ℝ) ∧ + (n : ℝ) ≤ samplingQ (sourceBlockSize s) ∧ 0 < n) ∧ + (sourceBlockSize s : ℝ)^((69/100 : ℝ)*(sourceBlockSize s : ℝ)) ≤ + ((sourceSamplingPowers s).card : ℝ) ∧ + ((sourceSamplingPowers s : Finset ℤ) : Set ℤ).Pairwise (fun n n' => + ¬SamplingConflict (samplingH (sourceBlockSize s)) + (samplingR (sourceBlockSize s) (sourceStageState s).K) n n') := by + unfold sourceSamplingPowers + rw [dite_eq_left hs] + exact Classical.choose_spec (exists_source_sampling_powers _ _ hs (sourceStage s).m_ge_K) + +theorem sourceSamplingPowers_eventually : ∀ᶠ s in atTop, + (∀ n ∈ sourceSamplingPowers s, + samplingQ (sourceBlockSize s)/2 ≤ (n : ℝ) ∧ + (n : ℝ) ≤ samplingQ (sourceBlockSize s) ∧ 0 < n) ∧ + (sourceBlockSize s : ℝ)^((69/100 : ℝ)*(sourceBlockSize s : ℝ)) ≤ + ((sourceSamplingPowers s).card : ℝ) ∧ + ((sourceSamplingPowers s : Finset ℤ) : Set ℤ).Pairwise (fun n n' => + ¬SamplingConflict (samplingH (sourceBlockSize s)) + (samplingR (sourceBlockSize s) (sourceStageState s).K) n n') := by + filter_upwards [sourceBlockSize_tendsto.eventually (eventually_ge_atTop 200000)] with s hs + exact sourceSamplingPowers_spec s hs + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/ProductError.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/ProductError.lean new file mode 100644 index 0000000000000000000000000000000000000000..9427a2839ec4391773c591d9c02557b65bf063cf --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/ProductError.lean @@ -0,0 +1,114 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.CrossProducts +import OAI.Analysis.FiniteFactor.Sampling.ProductError + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +noncomputable section + +def sourceSamplingCorrelationBudget (stage : ℕ) : ℝ := + ((sourceSamplingPrefix stage).card : ℝ)*(104*(sourceBlockSize stage : ℝ)^(-74 : ℝ))*Real.exp 135 + +/-- Uniform telescoping budget from the actual ideal coordinate moments. -/ +theorem sourceSampling_coordinate_product_error (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (f : SourceCoordinate → ℝ) (hf : ∀ i ∈ sourceSamplingPrefix stage, 0 ≤ f i) + (he : ∀ i ∈ sourceSamplingPrefix stage, + |f i-(∫ s, samplingOrientedDensity r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (E i) (G i) s^2 ∂unitIntervalMeasure)| ≤ 104*(sourceBlockSize stage : ℝ)^(-74 : ℝ)) : + |(∏ i ∈ sourceSamplingPrefix stage, f i)- + (∫ x, sourceSamplingIdealDensity stage r b E G x^2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure))| ≤ sourceSamplingCorrelationBudget stage := by + let A (i : SourceCoordinate) := ∫ s, samplingOrientedDensity r (b i) (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) (E i) (G i) s^2 ∂unitIntervalMeasure + let x := (sourceBlockSize stage : ℝ)^(-6/5 : ℝ) + let ε := 104*(sourceBlockSize stage : ℝ)^(-74 : ℝ) + let M := 1+108*x + have hm1 : (1 : ℝ) ≤ sourceBlockSize stage := by + have h : 100 ≤ sourceBlockSize stage := (sourceStage stage).m_ge_100 + exact_mod_cast (show 1 ≤ sourceBlockSize stage by omega) + have hx : 0 ≤ x := by dsimp [x]; positivity + have hε : 0 ≤ ε := by dsimp [ε]; positivity + have hεx : ε ≤ 104*x := mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow_of_exponent_le hm1 (by norm_num : (-74 : ℝ) ≤ -6/5)) (by norm_num) + have hA (i : SourceCoordinate) : 0 ≤ A i ∧ A i ≤ 1+4*x := + ⟨integral_nonneg (fun _ => sq_nonneg _),(sourceSampling_oriented_moment stage r (b i) (E i) (G i) (hE i) (hG i)).2⟩ + have hfb (i : SourceCoordinate) (hi : i ∈ sourceSamplingPrefix stage) : 0 ≤ f i ∧ f i ≤ M := by + refine ⟨hf i hi,?_⟩ + have hh := (abs_le.mp (he i hi)).2 + have ha := (hA i).2 + dsimp [M] + change f i-A i ≤ ε at hh + linarith + have hAb (i : SourceCoordinate) (_hi : i ∈ sourceSamplingPrefix stage) : 0 ≤ A i ∧ A i ≤ M := + ⟨(hA i).1,(hA i).2.trans (by dsimp [M]; linarith)⟩ + have hpow : M^(sourceSamplingPrefix stage).card ≤ Real.exp 135 := by + have hp := product_energy_le_exp (fun _i : sourceSamplingPrefix stage => M) + (fun _i : sourceSamplingPrefix stage => 108*x) + (fun _ => by dsimp [M]; positivity) (fun _ => le_rfl) + have hbudget : ((sourceSamplingPrefix stage).card : ℝ)*(108*x) ≤ 135 := by + have hh := sourceSampling_prefix_quadratic_budget stage + change ((sourceSamplingPrefix stage).card : ℝ)*(4*x) ≤ 5 at hh + nlinarith + have hp' : M^(sourceSamplingPrefix stage).card ≤ + Real.exp (((sourceSamplingPrefix stage).card : ℝ)*(108*x)) := by simpa using hp + exact hp'.trans (Real.exp_le_exp.mpr hbudget) + rw [sourceSamplingIdealDensity_square stage r b E G hE hG] + apply (sampling_product_error (sourceSamplingPrefix stage) f A M ε (by dsimp [M]; linarith) hε hfb hAb he).trans + exact mul_le_mul_of_nonneg_left hpow (by positivity) + +/-- Distinct products under the actual angle and Haar laws. -/ +theorem sourceSamplingProduct_pair_error (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (r : Bool) (b : SourceCoordinate → Bool) (a c a' c' : SourceCoordinate → ℝ) + (n k : ℤ) (hn : n ∈ sourceSamplingPowers stage) (hk : k ∈ sourceSamplingPowers stage) (hne : n ≠ k) : + |(∫ θ, ∫ x, sourceSamplingProduct stage r b (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) n θ x * + sourceSamplingProduct stage r b (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) k θ x + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure) ∂sourceAngleLaw)- + (∫ x, sourceSamplingIdealDensity stage r b (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) x^2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure))| ≤ sourceSamplingCorrelationBudget stage := by + rw [integral_integral_swap (sourceSamplingProduct_pair_integrable stage r b _ _ + (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc) n k), + sourceSamplingProduct_inner_factorization stage r b _ _ (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc) n k] + apply sourceSampling_coordinate_product_error stage r b _ _ (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc) + · intro i _ + have hp := sourceSampling_parameters stage + exact integral_nonneg (fun s => integral_nonneg (fun θ => mul_nonneg + (samplingOrientedWeight_bounds r (b i) _ _ _ _ hp.1 hp.2.2 s _).1 + (samplingOrientedWeight_bounds r (b i) _ _ _ _ hp.1 hp.2.2 s _).1)) + · intro i hi + have hip : i.1 ≤ stage := by + have hh := (CouplingParameters.mem_blockPrefix sourceBlockSize (stage+1) i).mp hi + omega + exact sourceSampling_coordinate_pair_error stage hs i hip n k hn hk hne r (b i) (a i) (c i) (a' i) (c' i) + +/-- Actual mixed products have the same uniform error budget. -/ +theorem sourceSamplingProduct_mixed_error (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (r : Bool) (b : SourceCoordinate → Bool) (E G : SourceCoordinate → Set ℝ) + (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (n : ℤ) (hn : n ∈ sourceSamplingPowers stage) : + |(∫ θ, ∫ x, sourceSamplingProduct stage r b E G n θ x*sourceSamplingIdealDensity stage r b E G x + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure) ∂sourceAngleLaw)- + (∫ x, sourceSamplingIdealDensity stage r b E G x^2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure))| ≤ sourceSamplingCorrelationBudget stage := by + rw [integral_integral_swap (sourceSamplingProduct_mixed_integrable stage r b E G hE hG n), + sourceSamplingProduct_mixed_factorization stage r b E G hE hG n] + apply sourceSampling_coordinate_product_error stage r b E G hE hG + · intro i _ + have hp := sourceSampling_parameters stage + exact integral_nonneg (fun s => mul_nonneg + (integral_nonneg (fun t => (samplingOrientedWeight_bounds r (b i) _ _ _ _ hp.1 hp.2.2 s t).1)) + (integral_nonneg (fun θ => (samplingOrientedWeight_bounds r (b i) _ _ _ _ hp.1 hp.2.2 s _).1))) + · intro i hi + have hip : i.1 ≤ stage := by + have hh := (CouplingParameters.mem_blockPrefix sourceBlockSize (stage+1) i).mp hi + omega + apply (sourceSampling_coordinate_mixed_error stage hs i hip n hn r (b i) (E i) (G i) (hE i) (hG i)).trans + have hm1 : (1 : ℝ) ≤ sourceBlockSize stage := by exact_mod_cast (show 1 ≤ sourceBlockSize stage by omega) + have he := Real.rpow_le_rpow_of_exponent_le hm1 (by norm_num : (-80 : ℝ) ≤ -74) + nlinarith [Real.rpow_nonneg (sourceBlockSize_pos stage).le (-74 : ℝ)] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/ProductMoments.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/ProductMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f79273a5768be9c38bbdc720ad770e41f37b3cb --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/ProductMoments.lean @@ -0,0 +1,116 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.PhaseSelfMoment +import OAI.Analysis.FiniteFactor.OrbitSampling.IdealProduct + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +noncomputable section + +def sourceSamplingProduct (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (n : ℤ) (θ x : SourceCoordinate → ℝ) : ℝ := + ∏ i ∈ sourceSamplingPrefix stage, + samplingOrientedWeight r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (E i) (G i) (x i) (Int.fract ((n : ℝ)*θ i)) + +theorem sourceSamplingProduct_measurable (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) (n : ℤ) : + Measurable (fun p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) => sourceSamplingProduct stage r b E G n p.1 p.2) := by + unfold sourceSamplingProduct + apply Finset.measurable_prod + intro i _ + have hm : Measurable (fun p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ) => + (p.2 i,Int.fract ((n : ℝ)*p.1 i))) := + ((measurable_pi_apply i).comp measurable_snd).prodMk + (sourceFract_measurable.comp (measurable_const.mul ((measurable_pi_apply i).comp measurable_fst))) + exact (samplingOrientedWeight_measurable r (b i) (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) (E i) (G i) (hE i) (hG i)).comp hm + +theorem sourceSamplingProduct_bounds (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (n : ℤ) (θ x : SourceCoordinate → ℝ) : + 0 ≤ sourceSamplingProduct stage r b E G n θ x ∧ + sourceSamplingProduct stage r b E G n θ x ≤ + (max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)))^(sourceSamplingPrefix stage).card := by + have hp := sourceSampling_parameters stage + have hb (i : SourceCoordinate) := samplingOrientedWeight_bounds r (b i) _ _ (E i) (G i) hp.1 hp.2.2 + (x i) (Int.fract ((n : ℝ)*θ i)) + refine ⟨prod_nonneg (fun i _ => (hb i).1),?_⟩ + calc + _ ≤ ∏ _i ∈ sourceSamplingPrefix stage, max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)) := + prod_le_prod₀ (fun i _ => (hb i).1) (fun i _ => (hb i).2) + _ = _ := by simp + +/-- Exact coordinate factorization under the two actual infinite product laws. +Dependence of the two phases within one coordinate is retained in each factor. -/ +theorem sourceSamplingProduct_inner_factorization (stage : ℕ) (r : Bool) (b : SourceCoordinate → Bool) + (E G : SourceCoordinate → Set ℝ) (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) (n k : ℤ) : + (∫ x, ∫ θ, sourceSamplingProduct stage r b E G n θ x * sourceSamplingProduct stage r b E G k θ x + ∂sourceAngleLaw ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) = + ∏ i ∈ sourceSamplingPrefix stage, + ∫ s, ∫ θ, samplingOrientedWeight r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (E i) (G i) s (Int.fract ((n : ℝ)*θ i)) * + samplingOrientedWeight r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (E i) (G i) s (Int.fract ((k : ℝ)*θ i)) ∂sourceAngleLaw ∂unitIntervalMeasure := by + let u (i : SourceCoordinate) := samplingOrientedWeight r (b i) (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) (E i) (G i) + let F (i : SourceCoordinate) (s a : ℝ) := u i s (Int.fract ((n : ℝ)*a))*u i s (Int.fract ((k : ℝ)*a)) + have hF (i : SourceCoordinate) : Measurable (fun p : ℝ × ℝ => F i p.1 p.2) := by + have hu := samplingOrientedWeight_measurable r (b i) (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (E i) (G i) (hE i) (hG i) + exact (hu.comp (measurable_fst.prodMk (sourceFract_measurable.comp (measurable_const.mul measurable_snd)))).mul + (hu.comp (measurable_fst.prodMk (sourceFract_measurable.comp (measurable_const.mul measurable_snd)))) + calc + _ = ∫ x, ∏ i ∈ sourceSamplingPrefix stage, ∫ a, F i (x i) a ∂sourceAngleMarginal i + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure) := by + apply integral_congr_ae + filter_upwards [] with x + simp only [sourceSamplingProduct,← Finset.prod_mul_distrib] + exact integral_infinitePi_finset_prod _ _ _ + (fun i => (hF i).comp (measurable_const.prodMk measurable_id)) + _ = ∏ i ∈ sourceSamplingPrefix stage, ∫ s, ∫ a, F i s a ∂sourceAngleMarginal i ∂unitIntervalMeasure := + integral_infinitePi_finset_prod _ _ _ + (fun i => (hF i).stronglyMeasurable.integral_prod_right.measurable) + _ = _ := by + apply Finset.prod_congr rfl + intro i _ + apply integral_congr_ae + filter_upwards [] with s + have hm : Measurable (fun a => F i s a) := (hF i).comp (measurable_const.prodMk measurable_id) + rw [← sourceAngleLaw_coordinate i,integral_map (measurable_pi_apply i).aemeasurable hm.aestronglyMeasurable] + +/-- The actual full-prefix self-pair estimate, with the source's angle +expectation outside the L2 square integral. -/ +theorem sourceSamplingProduct_self_moment (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (r : Bool) (b : SourceCoordinate → Bool) (E G : SourceCoordinate → Set ℝ) + (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (n : ℤ) (hn : n ∈ sourceSamplingPowers stage) : + (∫ θ, ∫ x, sourceSamplingProduct stage r b E G n θ x ^ 2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure) ∂sourceAngleLaw) ≤ + (2+8*(sourceBlockSize stage : ℝ)^(3/5 : ℝ)*Real.log (sourceBlockSize stage : ℝ))^(sourceSamplingPrefix stage).card := by + have hint := sampling_square_integrable + (sourceAngleLaw.prod (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure))) + (fun p => sourceSamplingProduct stage r b E G n p.1 p.2) + ((max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)))^(sourceSamplingPrefix stage).card) + (sourceSamplingProduct_measurable stage r b E G hE hG n) + (fun p => sourceSamplingProduct_bounds stage r b E G n p.1 p.2) + rw [integral_integral_swap hint] + simp only [pow_two] + rw [sourceSamplingProduct_inner_factorization stage r b E G hE hG n n] + calc + _ ≤ ∏ _i ∈ sourceSamplingPrefix stage, + (2+8*(sourceBlockSize stage : ℝ)^(3/5 : ℝ)*Real.log (sourceBlockSize stage : ℝ)) := by + apply Finset.prod_le_prod₀ + · intro i _ + exact integral_nonneg (fun s => integral_nonneg (fun θ => mul_self_nonneg _)) + · intro i hi + have hip : i.1 ≤ stage := by + have ht := (CouplingParameters.mem_blockPrefix sourceBlockSize (stage+1) i).mp hi + omega + simpa only [pow_two] using sourceSampling_phase_self_moment stage hs i hip n hn r (b i) + (E i) (G i) (hE i) (hG i) + _ = _ := by simp + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RationalTests.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RationalTests.lean new file mode 100644 index 0000000000000000000000000000000000000000..b635373c609b56f60620fbfd5630a60b15e54e84 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RationalTests.lean @@ -0,0 +1,108 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.TestedMarginals +import OAI.Analysis.FiniteFactor.OrbitSampling.FirstMarginal + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +/-- A finite rational cylinder test, with two closed intervals per tested +coordinate. Whole-circle tests fill the remaining coordinates. -/ +abbrev SourceSamplingRationalTest := + Σ K : Finset SourceCoordinate, K → (ℚ × ℚ) × (ℚ × ℚ) + +instance : Countable SourceSamplingRationalTest := inferInstance + +def sourceSamplingRationalEndpoints (T : SourceSamplingRationalTest) (i : SourceCoordinate) : + (ℚ × ℚ) × (ℚ × ℚ) := + if hi : i ∈ T.1 then T.2 ⟨i,hi⟩ else ((0,1),(0,1)) + +def sourceSamplingRationalX (T : SourceSamplingRationalTest) (i : SourceCoordinate) : Set ℝ := + Set.Icc (sourceSamplingRationalEndpoints T i).1.1 (sourceSamplingRationalEndpoints T i).1.2 + +def sourceSamplingRationalY (T : SourceSamplingRationalTest) (i : SourceCoordinate) : Set ℝ := + Set.Icc (sourceSamplingRationalEndpoints T i).2.1 (sourceSamplingRationalEndpoints T i).2.2 + +theorem sourceSamplingRationalTests_outside (T : SourceSamplingRationalTest) (stage : ℕ) + (hK : T.1 ⊆ sourceSamplingPrefix stage) : + ∀ i ∉ sourceSamplingPrefix stage, + Set.Ico (0 : ℝ) 1 ⊆ sourceSamplingRationalX T i ∧ + Set.Ico (0 : ℝ) 1 ⊆ sourceSamplingRationalY T i := by + intro i hi + have hnot : i ∉ T.1 := fun h => hi (hK h) + simp only [sourceSamplingRationalX,sourceSamplingRationalY,sourceSamplingRationalEndpoints, + dite_eq_right hnot,Rat.cast_zero,Rat.cast_one] + exact ⟨Set.Ico_subset_Icc_self,Set.Ico_subset_Icc_self⟩ + +theorem sourceSamplingPrefix_eventually_covers (K : Finset SourceCoordinate) : + ∀ᶠ stage : ℕ in atTop, K ⊆ sourceSamplingPrefix stage := by + filter_upwards [eventually_ge_atTop (K.sup (fun i => i.1))] with stage hstage + intro i hi + apply (CouplingParameters.mem_blockPrefix sourceBlockSize (stage+1) i).mpr + exact Nat.lt_succ_of_le ((Finset.le_sup (f := fun i => i.1) hi).trans hstage) + +/-- A concrete single conull event for every finite I, both orientations, and +all rational cylinder tests. It includes the actual tested measure identity +at every admissible stage, as well as the full-error convergence and L2 bound. -/ +theorem sourceSampling_rational_event : + ∀ᵐ θ ∂sourceAngleLaw, ∀ (I : Finset SourceCoordinate) (r : Bool) + (T : SourceSamplingRationalTest), + Tendsto (fun stage => sourceSamplingSquaredError stage r (fun i => decide (i ∈ I)) + (sourceSamplingRationalX T) (sourceSamplingRationalY T) θ) atTop (𝓝 0) ∧ + ∃ C : ℝ, ∀ stage, + MemLp (sourceSamplingEmpiricalDensity stage r (fun i => decide (i ∈ I)) + (sourceSamplingRationalX T) (sourceSamplingRationalY T) θ) 2 sourceSamplingHaar ∧ + (∫ x, sourceSamplingEmpiricalDensity stage r (fun i => decide (i ∈ I)) + (sourceSamplingRationalX T) (sourceSamplingRationalY T) θ x ^ 2 ∂sourceSamplingHaar) ≤ C ∧ + (T.1 ⊆ sourceSamplingPrefix stage → + ((sourceSamplingUntrimmed I stage θ).restrict + (sourceSamplingRectangle (sourceSamplingRationalX T) (sourceSamplingRationalY T))).map + (sourceSamplingEndpoint r) = + sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal + (sourceSamplingEmpiricalDensity stage r (fun i => decide (i ∈ I)) + (sourceSamplingRationalX T) (sourceSamplingRationalY T) θ x))) := by + apply ae_all_iff.mpr + intro I + apply ae_all_iff.mpr + intro r + apply ae_all_iff.mpr + intro T + filter_upwards [sourceSamplingSquaredError_ae r (fun i => decide (i ∈ I)) + (fun i => (sourceSamplingRationalEndpoints T i).1.1) + (fun i => (sourceSamplingRationalEndpoints T i).1.2) + (fun i => (sourceSamplingRationalEndpoints T i).2.1) + (fun i => (sourceSamplingRationalEndpoints T i).2.2), + sourceSamplingEmpiricalDensity_uniform r (fun i => decide (i ∈ I)) + (fun i => (sourceSamplingRationalEndpoints T i).1.1) + (fun i => (sourceSamplingRationalEndpoints T i).1.2) + (fun i => (sourceSamplingRationalEndpoints T i).2.1) + (fun i => (sourceSamplingRationalEndpoints T i).2.2)] with θ he hu + obtain ⟨C,hC⟩ := hu + refine ⟨he.2,C,fun stage => ⟨(hC stage).1,(hC stage).2,?_⟩⟩ + intro hK + exact sourceSamplingUntrimmed_tested_marginal I stage r _ _ + (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc) + (sourceSamplingRationalTests_outside T stage hK) θ + +/-- Both actual untested marginal densities are uniformly L2 bounded on one +conull event, simultaneously for all finite I. -/ +theorem sourceSampling_both_marginals_event : + ∀ᵐ θ ∂sourceAngleLaw, ∀ (I : Finset SourceCoordinate) (r : Bool), + ∃ C : ℝ, ∀ stage, ∃ f : (SourceCoordinate → ℝ) → ℝ, + (sourceSamplingUntrimmed I stage θ).map (sourceSamplingEndpoint r) = + sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal (f x)) ∧ + MemLp f 2 sourceSamplingHaar ∧ (∫ x, f x^2 ∂sourceSamplingHaar) ≤ C := by + apply ae_all_iff.mpr + intro I + apply ae_all_iff.mpr + intro r + cases r + · exact sourceSamplingUntrimmed_first_L2 I + · exact sourceSamplingUntrimmed_second_L2 I + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RectangleApproximation.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RectangleApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a462e48df93e1d1333451e97577cdd0dc8f6656 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RectangleApproximation.lean @@ -0,0 +1,38 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.RectangleError + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +/-- Actual rational rectangle masses approach their ideal product integrals +on a single conull event. This is the stochastic approximation step; the +identification of the ideal limiting law is a separate obligation. -/ +theorem sourceSampling_rectangle_approximation_event : + ∀ᵐ θ ∂sourceAngleLaw, ∀ (I : Finset SourceCoordinate) (T : SourceSamplingRationalTest), + Tendsto (fun stage => + ((sourceSamplingUntrimmed I stage θ) + (sourceSamplingRectangle (sourceSamplingRationalX T) (sourceSamplingRationalY T))).toReal - + ∫ x, sourceSamplingIdealDensity stage false (fun i => decide (i ∈ I)) + (sourceSamplingRationalX T) (sourceSamplingRationalY T) x ∂sourceSamplingHaar) + atTop (𝓝 0) := by + filter_upwards [sourceSampling_rational_event] with θ hθ + intro I T + have he := (hθ I false T).1 + have hs := Real.continuous_sqrt.continuousAt.tendsto.comp he + simp only [Real.sqrt_zero] at hs + apply tendsto_zero_iff_norm_tendsto_zero.mpr + simp only [Real.norm_eq_abs] + apply squeeze_zero' (Eventually.of_forall (fun stage => abs_nonneg _)) _ hs + filter_upwards [sourceSamplingPrefix_eventually_covers T.1] with stage hstage + exact Real.abs_le_sqrt (sourceSamplingUntrimmed_rectangle_error I stage + (sourceSamplingRationalX T) (sourceSamplingRationalY T) + (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc) + (sourceSamplingRationalTests_outside T stage hstage) θ) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RectangleError.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RectangleError.lean new file mode 100644 index 0000000000000000000000000000000000000000..1af52e9df4808096ba478ae6ccb8513ea928a774 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RectangleError.lean @@ -0,0 +1,91 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.RationalTests + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +/-- The elementary probability-space Cauchy--Schwarz bound, proved by +integrating the nonnegative square centered at the mean. -/ +theorem sampling_integral_square_le {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (f : Ω → ℝ) + (hf : Integrable f μ) (hf2 : Integrable (fun x => f x^2) μ) : + (∫ x, f x ∂μ)^2 ≤ ∫ x, f x^2 ∂μ := by + let c := ∫ x, f x ∂μ + have he : (fun x => (f x-c)^2) = (fun x => f x^2-2*c*f x+c^2) := by funext x; ring + have hh : 0 ≤ ∫ x, (f x-c)^2 ∂μ := integral_nonneg (fun x => sq_nonneg _) + have hi : Integrable (fun x => f x^2-2*c*f x) μ := hf2.sub (hf.const_mul (2*c)) + have hc : Integrable (fun _x : Ω => c^2) μ := integrable_const _ + rw [he,integral_add hi hc,integral_sub hf2 (hf.const_mul (2*c)),integral_const_mul] at hh + simp only [integral_const,measureReal_def,measure_univ,ENNReal.toReal_one,smul_eq_mul,one_mul] at hh + change c^2 ≤ _ + change 0 ≤ (∫ x, f x^2 ∂μ)-2*c*c+c^2 at hh + nlinarith + +/-- Actual rectangle mass equals the integral of the first tested empirical +density at every admissible stage. -/ +theorem sourceSamplingUntrimmed_rectangle_mass (I : Finset SourceCoordinate) (stage : ℕ) + (E G : SourceCoordinate → Set ℝ) + (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (houtside : ∀ i ∉ sourceSamplingPrefix stage, + Set.Ico (0 : ℝ) 1 ⊆ E i ∧ Set.Ico (0 : ℝ) 1 ⊆ G i) + (θ : SourceCoordinate → ℝ) : + ((sourceSamplingUntrimmed I stage θ) (sourceSamplingRectangle E G)).toReal = + ∫ x, sourceSamplingEmpiricalDensity stage false (fun i => decide (i ∈ I)) E G θ x + ∂sourceSamplingHaar := by + let z := sourceSamplingEmpiricalDensity stage false (fun i => decide (i ∈ I)) E G θ + have hm := sourceSamplingEmpiricalDensity_measurable stage false (fun i => decide (i ∈ I)) E G hE hG θ + have hb := sourceSamplingEmpiricalDensity_bounds stage false (fun i => decide (i ∈ I)) E G θ + have hi : Integrable z sourceSamplingHaar := + sampling_integrable_bounded sourceSamplingHaar z hm _ (fun x => by + rw [abs_of_nonneg (hb x).1]; exact (hb x).2) + have hh := congrArg (fun ν : Measure (SourceCoordinate → ℝ) => ν Set.univ) + (sourceSamplingUntrimmed_tested_marginal I stage false E G hE hG houtside θ) + rw [Measure.map_apply (sourceSamplingEndpoint_measurable false) MeasurableSet.univ, + Set.preimage_univ,Measure.restrict_apply MeasurableSet.univ,Set.univ_inter, + withDensity_apply _ MeasurableSet.univ,Measure.restrict_univ] at hh + rw [hh,← ofReal_integral_eq_lintegral_ofReal hi (Eventually.of_forall (fun x => (hb x).1)), + ENNReal.toReal_ofReal (integral_nonneg (fun x => (hb x).1))] + +/-- Full squared sampling error bounds the squared discrepancy of the actual +rectangle mass and the ideal product integral. -/ +theorem sourceSamplingUntrimmed_rectangle_error (I : Finset SourceCoordinate) (stage : ℕ) + (E G : SourceCoordinate → Set ℝ) + (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (houtside : ∀ i ∉ sourceSamplingPrefix stage, + Set.Ico (0 : ℝ) 1 ⊆ E i ∧ Set.Ico (0 : ℝ) 1 ⊆ G i) + (θ : SourceCoordinate → ℝ) : + (((sourceSamplingUntrimmed I stage θ) (sourceSamplingRectangle E G)).toReal - + ∫ x, sourceSamplingIdealDensity stage false (fun i => decide (i ∈ I)) E G x ∂sourceSamplingHaar)^2 ≤ + sourceSamplingSquaredError stage false (fun i => decide (i ∈ I)) E G θ := by + rw [sourceSamplingUntrimmed_rectangle_mass I stage E G hE hG houtside θ] + let z := sourceSamplingEmpiricalDensity stage false (fun i => decide (i ∈ I)) E G θ + let g := sourceSamplingIdealDensity stage false (fun i => decide (i ∈ I)) E G + let C := (max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)))^(sourceSamplingPrefix stage).card + have hzm := sourceSamplingEmpiricalDensity_measurable stage false (fun i => decide (i ∈ I)) E G hE hG θ + have hgm := sourceSamplingIdealDensity_measurable stage false (fun i => decide (i ∈ I)) E G hE hG + have hzb := sourceSamplingEmpiricalDensity_bounds stage false (fun i => decide (i ∈ I)) E G θ + have hgb := sourceSamplingIdealDensity_bounds stage false (fun i => decide (i ∈ I)) E G hE hG + have hzi : Integrable z sourceSamplingHaar := sampling_integrable_bounded sourceSamplingHaar z hzm C + (fun x => by rw [abs_of_nonneg (hzb x).1]; exact (hzb x).2) + have hgi : Integrable g sourceSamplingHaar := sampling_integrable_bounded sourceSamplingHaar g hgm C + (fun x => by rw [abs_of_nonneg (hgb x).1]; exact (hgb x).2) + have hei : Integrable (fun x => (z x-g x)^2) sourceSamplingHaar := by + apply sampling_integrable_bounded sourceSamplingHaar _ ((hzm.sub hgm).pow_const 2) (C^2) + intro x + rw [abs_of_nonneg (sq_nonneg _)] + have hz' : 0 ≤ z x ∧ z x ≤ C := hzb x + have hg' : 0 ≤ g x ∧ g x ≤ C := hgb x + change (z x-g x)^2 ≤ C^2 + nlinarith [sq_nonneg (z x+g x),mul_nonneg (show 0 ≤ C-(z x-g x) by linarith) + (show 0 ≤ C+(z x-g x) by linarith)] + have hh := sampling_integral_square_le sourceSamplingHaar (fun x => z x-g x) (hzi.sub hgi) hei + rw [integral_sub hzi hgi] at hh + exact hh + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RotationTransport.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RotationTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6f3ac1b573dfa4574470b6cac9dd677355c0fe8 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/RotationTransport.lean @@ -0,0 +1,61 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.Measures + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical ENNReal +noncomputable section + +theorem coordinateRotate_neg_cube (θ x : SourceCoordinate → ℝ) (n : ℤ) + (hx : ∀ i, x i ∈ Set.Ico (0 : ℝ) 1) : + coordinateRotate θ (-n) (coordinateRotate θ n x) = x := by + funext i + unfold coordinateRotate + rw [Int.cast_neg,neg_mul] + have he : Int.fract (x i+(n : ℝ)*θ i) + -((n : ℝ)*θ i) = + x i - (⌊x i+(n : ℝ)*θ i⌋ : ℝ) := by + linarith [Int.fract_add_floor (x i+(n : ℝ)*θ i)] + rw [he,Int.fract_sub_intCast,Int.fract_eq_self.mpr (hx i)] + +theorem coordinateRotate_phase (θ x : SourceCoordinate → ℝ) (n : ℤ) (i : SourceCoordinate) : + coordinateRotate θ n x i = Int.fract (x i+Int.fract ((n : ℝ)*θ i)) := by + unfold coordinateRotate + have he : x i+(n : ℝ)*θ i = (x i+Int.fract ((n : ℝ)*θ i)) + (⌊(n : ℝ)*θ i⌋ : ℝ) := by + linarith [Int.fract_add_floor ((n : ℝ)*θ i)] + rw [he,Int.fract_add_intCast] + +theorem coordinateRotate_neg_phase (θ x : SourceCoordinate → ℝ) (n : ℤ) (i : SourceCoordinate) : + coordinateRotate θ (-n) x i = Int.fract (x i-Int.fract ((n : ℝ)*θ i)) := by + unfold coordinateRotate + rw [Int.cast_neg,neg_mul] + have he : x i + -((n : ℝ)*θ i) = (x i-Int.fract ((n : ℝ)*θ i)) - (⌊(n : ℝ)*θ i⌋ : ℝ) := by + linarith [Int.fract_add_floor ((n : ℝ)*θ i)] + rw [he,Int.fract_sub_intCast] + +/-- Change of variables for an actual weighted Haar law. The inverse identity +is needed only on the conull cube of representatives. -/ +theorem sourceSamplingHaar_rotate_withDensity (θ : SourceCoordinate → ℝ) (n : ℤ) + (w : (SourceCoordinate → ℝ) → ℝ≥0∞) (hw : Measurable w) : + (sourceSamplingHaar.withDensity w).map (coordinateRotate θ n) = + sourceSamplingHaar.withDensity (fun y => w (coordinateRotate θ (-n) y)) := by + let R := coordinateRotate θ n + let R' := coordinateRotate θ (-n) + have hR := coordinateRotate_preserving θ n + have hR' := coordinateRotate_preserving θ (-n) + ext A hA + rw [Measure.map_apply hR.measurable hA,withDensity_apply _ (hR.measurable hA),withDensity_apply _ hA] + rw [← lintegral_indicator (hR.measurable hA),← lintegral_indicator hA] + have hm : Measurable (A.indicator (fun y => w (R' y))) := (hw.comp hR'.measurable).indicator hA + calc + _ = ∫⁻ x, A.indicator (fun y => w (R' y)) (R x) ∂sourceSamplingHaar := by + apply lintegral_congr_ae + filter_upwards [sourceSamplingHaar_cube] with x hx + change (if R x ∈ A then w x else 0) = (if R x ∈ A then w (R' (R x)) else 0) + rw [show R' (R x) = x from coordinateRotate_neg_cube θ x n hx] + _ = _ := hR.lintegral_comp hm + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SecondCorrelation.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SecondCorrelation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c61be6139069ce9ea18b768982b98165c6dfb718 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SecondCorrelation.lean @@ -0,0 +1,73 @@ +import OAI.Analysis.FiniteFactor.Sampling.SecondDiscrepancy +import OAI.Analysis.FiniteFactor.OrbitSampling.FirstCorrelation + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical +noncomputable section + +/-- Uniform source height bound, for either marginal orientation. -/ +theorem sourceSampling_max_height (stage : ℕ) : + max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)) ≤ + (sourceBlockSize stage : ℝ)^(3 : ℝ) := by + have hm := sourceBlockSize_pos stage + have hm1 : (1 : ℝ) ≤ sourceBlockSize stage := by + have hh : (100 : ℝ) ≤ sourceBlockSize stage := by exact_mod_cast (sourceStage stage).m_ge_100 + linarith + apply max_le + · exact Real.one_le_rpow hm1 (by norm_num) + · have he : 1/(sourceSamplingWidth stage*sourceSamplingCutoff stage) = + (sourceBlockSize stage : ℝ)^(13/5 : ℝ) := by + unfold sourceSamplingWidth sourceSamplingCutoff + rw [← Real.rpow_add hm] + norm_num + rw [Real.rpow_neg hm.le,inv_inv] + rw [he] + exact Real.rpow_le_rpow_of_exponent_le hm1 (by norm_num) + +/-- Actual second-diagonal pair error for the selected source powers. +All phase support, atomlessness and discrepancy hypotheses are discharged. -/ +theorem sourceSampling_second_pair_error (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (i : SourceCoordinate) (hi : i.1 ≤ stage) (n n' : ℤ) + (hn : n ∈ sourceSamplingPowers stage) (hn' : n' ∈ sourceSamplingPowers stage) (hne : n ≠ n') + (G : Set ℝ) (hG : MeasurableSet G) (a c s : ℝ) (hsx : s ∈ Set.Ico (0 : ℝ) 1) : + |(∫ θ, samplingTestedSecondWeight (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (Set.Icc a c) G s (Int.fract ((n : ℝ)*θ i)) * + samplingTestedSecondWeight (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + (Set.Icc a c) G s (Int.fract ((n' : ℝ)*θ i)) ∂sourceAngleLaw) - + samplingTestedSecondDensity (sourceSamplingWidth stage) (sourceSamplingCutoff stage) (Set.Icc a c) G s ^ 2| ≤ + 104*(sourceBlockSize stage : ℝ)^(-74 : ℝ) := by + have := sourceSampling_phase_null_singletons stage hs i hi n hn + have := sourceSampling_phase_null_singletons stage hs i hi n' hn' + have hm (k : ℤ) : Measurable (fun θ : SourceCoordinate → ℝ => Int.fract ((k : ℝ)*θ i)) := + sourceFract_measurable.comp (measurable_const.mul (measurable_pi_apply i)) + have hsupport (k : ℤ) : ∀ᵐ t ∂sourceAngleLaw.map (fun θ => Int.fract ((k : ℝ)*θ i)), + t ∈ Set.Ico (0 : ℝ) 1 := by + apply (ae_map_iff (hm k).aemeasurable + (show MeasurableSet {t : ℝ | t ∈ Set.Ico (0 : ℝ) 1} from measurableSet_Ico)).mpr + exact Eventually.of_forall (fun θ => ⟨Int.fract_nonneg _,Int.fract_lt_one _⟩) + have hp := sourceSampling_parameters stage + have hb := samplingTestedSecond_pair_bound sourceAngleLaw + (fun θ => Int.fract ((n : ℝ)*θ i)) (fun θ => Int.fract ((n' : ℝ)*θ i)) + (hm n) (hm n') (hsupport n) (hsupport n') _ + (sourceSampling_rectangle_bound stage hs i hi n n' hn hn' hne) + _ _ G a c s hp.1 hp.2.1 hp.2.2 hG hsx + let m : ℝ := sourceBlockSize stage + let C := max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)) + have hC : 0 ≤ C := (by norm_num : (0 : ℝ) ≤ 1).trans (le_max_left _ _) + have hC2 : C^2 ≤ m^(6 : ℝ) := by + calc + _ ≤ (m^(3 : ℝ))^2 := by nlinarith [sourceSampling_max_height stage,Real.rpow_nonneg (sourceBlockSize_pos stage).le (3 : ℝ)] + _ = _ := by dsimp [m]; rw [← Real.rpow_natCast,← Real.rpow_mul (sourceBlockSize_pos stage).le]; norm_num + apply hb.trans + change (4*(26*m^(-80 : ℝ)))*C^2 ≤ 104*m^(-74 : ℝ) + calc + _ ≤ (4*(26*m^(-80 : ℝ)))*m^(6 : ℝ) := mul_le_mul_of_nonneg_left hC2 (by positivity) + _ = _ := by rw [mul_assoc, mul_assoc,← Real.rpow_add (sourceBlockSize_pos stage)]; norm_num; ring + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SecondMarginal.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SecondMarginal.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a9c224f064a3476323c2a849afa60dcd6c21e1d --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SecondMarginal.lean @@ -0,0 +1,80 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.UniformEvent +import OAI.Analysis.FiniteFactor.OrbitSampling.RotationTransport + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal +noncomputable section + +/-- The actual second marginal of one orbit summand, obtained by weighted +Haar transport and not supplied as an assumption. -/ +theorem sourceSamplingSummand_second_density (I : Finset SourceCoordinate) (stage : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) : + (sourceSamplingSummand I stage θ n).map Prod.snd = + sourceSamplingHaar.withDensity (fun y => ENNReal.ofReal + (sourceSamplingWeight I stage θ n (coordinateRotate θ (-n) y))) := by + unfold sourceSamplingSummand + have hp : Measurable (fun x : SourceCoordinate → ℝ => (x,coordinateRotate θ n x)) := + measurable_id.prodMk (coordinateRotate_preserving θ n).measurable + rw [Measure.map_map measurable_snd hp] + exact sourceSamplingHaar_rotate_withDensity θ n _ + (sourceSamplingWeight_measurable I stage θ n).ennreal_ofReal + +/-- The actual second marginal is the second-oriented empirical density. -/ +theorem sourceSamplingUntrimmed_second_density (I : Finset SourceCoordinate) (stage : ℕ) + (θ : SourceCoordinate → ℝ) : + (sourceSamplingUntrimmed I stage θ).map Prod.snd = + sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal + (sourceSamplingEmpiricalDensity stage true (fun i => decide (i ∈ I)) + (fun _ => Set.Icc 0 1) (fun _ => Set.Icc 0 1) θ x)) := by + let S := sourceSamplingPowers stage + let c : ℝ≥0∞ := ENNReal.ofReal (1/((sourceSamplingPowers stage).card : ℝ)) + let w (n : ℤ) := fun x => sourceSamplingWeight I stage θ n (coordinateRotate θ (-n) x) + have hrep : (fun x => ENNReal.ofReal (sourceSamplingEmpiricalDensity stage true (fun i => decide (i ∈ I)) + (fun _ => Set.Icc 0 1) (fun _ => Set.Icc 0 1) θ x)) =ᵐ[sourceSamplingHaar] + (fun x => c*(∑ n ∈ S, ENNReal.ofReal (w n x))) := by + filter_upwards [sourceSamplingHaar_cube] with x hx + have hw (n : ℤ) : sourceSamplingProduct stage true (fun i => decide (i ∈ I)) + (fun _ => Set.Icc 0 1) (fun _ => Set.Icc 0 1) n θ x = w n x := by + apply Finset.prod_congr rfl + intro i _ + have hx' : x i ∈ Set.Icc (0 : ℝ) 1 := ⟨(hx i).1,(hx i).2.le⟩ + have hz : Int.fract (x i-Int.fract ((n : ℝ)*θ i)) ∈ Set.Icc (0 : ℝ) 1 := + ⟨Int.fract_nonneg _,(Int.fract_lt_one _).le⟩ + simp only [samplingOrientedWeight,ite_true,hz,hx',and_self] + rw [coordinateRotate_neg_phase] + simp only [sourceSamplingEmpiricalDensity,hw] + rw [div_eq_mul_inv,mul_comm,← one_div, + ENNReal.ofReal_mul (by positivity),ENNReal.ofReal_sum_of_nonneg (fun n _ => (sourceSamplingWeight_bounds I stage θ n (coordinateRotate θ (-n) x)).1)] + rw [withDensity_congr_ae hrep] + ext A hA + rw [Measure.map_apply measurable_snd hA] + unfold sourceSamplingUntrimmed + rw [Measure.smul_apply,Measure.finsetSum_apply,withDensity_apply _ hA] + have hterm (n : ℤ) : sourceSamplingSummand I stage θ n (Prod.snd ⁻¹' A) = + ∫⁻ x in A, ENNReal.ofReal (w n x) ∂sourceSamplingHaar := by + rw [← Measure.map_apply measurable_snd hA,sourceSamplingSummand_second_density] + exact withDensity_apply _ hA + simp only [hterm,smul_eq_mul] + rw [lintegral_const_mul' c _ ENNReal.ofReal_ne_top] + congr 1 + exact (lintegral_finsetSum S (fun n _ => + ((sourceSamplingWeight_measurable I stage θ n).comp (coordinateRotate_preserving θ (-n)).measurable).ennreal_ofReal)).symm + +/-- Uniform L2 densities for the actual untrimmed second marginals. -/ +theorem sourceSamplingUntrimmed_second_L2 (I : Finset SourceCoordinate) : + ∀ᵐ θ ∂sourceAngleLaw, ∃ C : ℝ, ∀ stage, + ∃ f : (SourceCoordinate → ℝ) → ℝ, + (sourceSamplingUntrimmed I stage θ).map Prod.snd = sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal (f x)) ∧ + MemLp f 2 sourceSamplingHaar ∧ (∫ x, f x^2 ∂sourceSamplingHaar) ≤ C := by + filter_upwards [sourceSamplingEmpiricalDensity_uniform true (fun i => decide (i ∈ I)) + (fun _ => 0) (fun _ => 1) (fun _ => 0) (fun _ => 1)] with θ hθ + obtain ⟨C,hC⟩ := hθ + refine ⟨C,fun stage => ⟨_,sourceSamplingUntrimmed_second_density I stage θ,(hC stage).1,(hC stage).2⟩⟩ + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SelfMoment.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SelfMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..51c91a3fe24716ff08481050fedeba3f9dd9c19f --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SelfMoment.lean @@ -0,0 +1,74 @@ +import OAI.Analysis.FiniteFactor.Sampling.OrientedMoments + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +noncomputable section + +theorem sourceSamplingCutoff_le_half (s : ℕ) : sourceSamplingCutoff s ≤ 1/2 := by + have hm : (100 : ℝ) ≤ sourceBlockSize s := by exact_mod_cast (sourceStage s).m_ge_100 + have hp := sourceBlockSize_pos s + calc + sourceSamplingCutoff s ≤ (sourceBlockSize s : ℝ)^(-1 : ℝ) := + Real.rpow_le_rpow_of_exponent_le (by linarith) (by norm_num) + _ = 1/(sourceBlockSize s : ℝ) := by rw [Real.rpow_neg_one,one_div] + _ ≤ 1/2 := one_div_le_one_div_of_le (by norm_num) (by linarith) + +theorem sourceSampling_log_self_bound (s : ℕ) : + (2/sourceSamplingWidth s)*Real.log (1/(2*sourceSamplingCutoff s)) ≤ + 4*(sourceBlockSize s : ℝ)^(3/5 : ℝ)*Real.log (sourceBlockSize s : ℝ) := by + have hp := sourceSampling_parameters s + have hm := sourceBlockSize_pos s + have hl : Real.log (1/(2*sourceSamplingCutoff s)) ≤ Real.log (1/sourceSamplingCutoff s) := + Real.log_le_log (one_div_pos.mpr (mul_pos (by norm_num) hp.2.2)) (one_div_le_one_div_of_le hp.2.2 (by linarith [hp.2.2])) + have he : Real.log (1/sourceSamplingCutoff s) = 2*Real.log (sourceBlockSize s : ℝ) := by + unfold sourceSamplingCutoff + rw [one_div,Real.log_inv,Real.log_rpow hm] + ring + have hw : (sourceSamplingWidth s)⁻¹ = (sourceBlockSize s : ℝ)^(3/5 : ℝ) := by + unfold sourceSamplingWidth + rw [show (-3/5 : ℝ) = -(3/5) by ring,Real.rpow_neg hm.le,inv_inv] + calc + _ ≤ (2/sourceSamplingWidth s)*(2*Real.log (sourceBlockSize s : ℝ)) := + mul_le_mul_of_nonneg_left (hl.trans_eq he) (div_nonneg (by norm_num) hp.1.le) + _ = _ := by rw [div_eq_mul_inv,hw]; ring + +/-- All tested source weights have the logarithmic self-pair bound in both +orientations. The harmless extra 1 includes triangular coordinates. -/ +theorem sourceSampling_oriented_self_moment (stage : ℕ) (r b : Bool) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + (∫ s, ∫ t, samplingOrientedWeight r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E G s t ^ 2 + ∂unitIntervalMeasure ∂unitIntervalMeasure) ≤ + 1+4*(sourceBlockSize stage : ℝ)^(3/5 : ℝ)*Real.log (sourceBlockSize stage : ℝ) := by + have hp := sourceSampling_parameters stage + have hc := sourceSamplingCutoff_le_half stage + have hlog : 0 ≤ Real.log (sourceBlockSize stage : ℝ) := Real.log_nonneg (by + have hm : (100 : ℝ) ≤ sourceBlockSize stage := by exact_mod_cast (sourceStage stage).m_ge_100 + linarith) + have herr : (0 : ℝ) ≤ 4*(sourceBlockSize stage : ℝ)^(3/5 : ℝ)*Real.log (sourceBlockSize stage : ℝ) := by positivity + cases b + · have hb : (∫ s, ∫ t, samplingOrientedWeight r false (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E G s t ^ 2 + ∂unitIntervalMeasure ∂unitIntervalMeasure) ≤ + (2/sourceSamplingWidth stage)*Real.log (1/(2*sourceSamplingCutoff stage)) := by + cases r + · exact samplingTestedFirstWeight_square_integral _ _ E G hp.1 hp.2.1 hp.2.2 hc hE hG + · exact samplingTestedSecondWeight_square_integral _ _ E G hp.1 hp.2.1 hp.2.2 hc hE hG + exact (hb.trans (sourceSampling_log_self_bound stage)).trans (by linarith) + · have hm := samplingOrientedWeight_measurable r true (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) E G hE hG + have hb := samplingOrientedWeight_triangular_bounds r (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) E G + have hi := sampling_square_integrable (unitIntervalMeasure.prod unitIntervalMeasure) _ 1 hm + (fun p => hb p.1 p.2) + rw [← integral_prod _ hi] + have hle : (∫ p : ℝ × ℝ, samplingOrientedWeight r true (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) E G p.1 p.2 ^ 2 ∂unitIntervalMeasure.prod unitIntervalMeasure) ≤ 1 := by + simpa using integral_mono_ae hi (integrable_const (1 : ℝ)) + (Eventually.of_forall (fun p => by nlinarith [(hb p.1 p.2).1,(hb p.1 p.2).2])) + exact hle.trans (by linarith) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SelfSummability.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SelfSummability.lean new file mode 100644 index 0000000000000000000000000000000000000000..31b1c2a81a13d91a4421b5d6fc5918d02af9db1d --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SelfSummability.lean @@ -0,0 +1,96 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.ProductMoments +import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +noncomputable section + +def sourceSamplingSelfBudget (stage : ℕ) : ℝ := + (2+8*(sourceBlockSize stage : ℝ)^(3/5 : ℝ)*Real.log (sourceBlockSize stage : ℝ))^(sourceSamplingPrefix stage).card / + ((sourceSamplingPowers stage).card : ℝ) + +/-- A concrete logarithmic estimate sufficient for the source exponent gap. -/ +theorem sampling_self_base_bound (m : ℝ) (hm1 : 1 ≤ m) (hlarge : 802 ≤ m^(1/50 : ℝ)) : + 2+8*m^(3/5 : ℝ)*Real.log m ≤ m^(63/100 : ℝ) := by + have hm : 0 < m := lt_of_lt_of_le zero_lt_one hm1 + have hl := Real.log_le_rpow_div hm.le (by norm_num : (0 : ℝ) < 1/100) + have he : m^(3/5 : ℝ)*m^(1/100 : ℝ) = m^(61/100 : ℝ) := by + rw [← Real.rpow_add hm]; norm_num + have hpow : 1 ≤ m^(61/100 : ℝ) := Real.one_le_rpow hm1 (by norm_num) + have hmul : m^(3/5 : ℝ)*Real.log m ≤ 100*m^(61/100 : ℝ) := by + have hh := mul_le_mul_of_nonneg_left hl (Real.rpow_nonneg hm.le (3/5 : ℝ)) + rw [← mul_div_assoc,he] at hh + linarith + calc + _ ≤ 802*m^(61/100 : ℝ) := by linarith + _ ≤ m^(1/50 : ℝ)*m^(61/100 : ℝ) := mul_le_mul_of_nonneg_right hlarge (by positivity) + _ = _ := by rw [← Real.rpow_add hm]; norm_num + +theorem sourceSamplingSelfBudget_eventually : ∀ᶠ stage in atTop, + sourceSamplingSelfBudget stage ≤ (sourceBlockSize stage : ℝ)^(-(1/25 : ℝ)*(sourceBlockSize stage : ℝ)) := by + have ht : Tendsto (fun stage => (sourceBlockSize stage : ℝ)^(1/50 : ℝ)) atTop atTop := + (tendsto_rpow_atTop (by norm_num : (0 : ℝ) < 1/50)).comp + (tendsto_natCast_atTop_atTop.comp sourceBlockSize_tendsto) + filter_upwards [ht.eventually (eventually_ge_atTop 802),sourceSamplingPowers_eventually] with stage hlarge hspec + let m : ℝ := sourceBlockSize stage + let B := 2+8*m^(3/5 : ℝ)*Real.log m + let P : ℝ := (sourceSamplingPowers stage).card + have hm : 0 < m := sourceBlockSize_pos stage + have hm1 : 1 ≤ m := by + have hh : (100 : ℝ) ≤ sourceBlockSize stage := by exact_mod_cast (sourceStage stage).m_ge_100 + dsimp [m]; linarith + have hB0 : 0 ≤ B := by dsimp [B]; positivity [Real.log_nonneg hm1] + have hB : B ≤ m^(63/100 : ℝ) := sampling_self_base_bound m hm1 hlarge + have hnum : B^(sourceSamplingPrefix stage).card ≤ m^((65/100 : ℝ)*m) := by + calc + _ ≤ (m^(63/100 : ℝ))^(sourceSamplingPrefix stage).card := pow_le_pow_left₀ hB0 hB _ + _ = m^((63/100 : ℝ)*((sourceSamplingPrefix stage).card : ℝ)) := by + rw [← Real.rpow_natCast,← Real.rpow_mul hm.le] + _ ≤ _ := Real.rpow_le_rpow_of_exponent_le hm1 (by + have hd := sourceSamplingPrefix_card_bound stage + change ((sourceSamplingPrefix stage).card : ℝ) ≤ (101/100 : ℝ)*m at hd + nlinarith) + have hP : m^((69/100 : ℝ)*m) ≤ P := hspec.2.1 + have hPpos : 0 < P := (Real.rpow_pos_of_pos hm _).trans_le hP + change B^(sourceSamplingPrefix stage).card/P ≤ m^(-(1/25 : ℝ)*m) + calc + _ ≤ m^((65/100 : ℝ)*m)/P := div_le_div_of_nonneg_right hnum hPpos.le + _ ≤ m^((65/100 : ℝ)*m)/m^((69/100 : ℝ)*m) := + div_le_div_of_nonneg_left (by positivity) (by positivity) hP + _ = _ := by rw [← Real.rpow_sub hm]; congr 1; ring + +/-- The actual block growth makes the inverse-square stage sequence summable. -/ +theorem sourceSampling_inverse_square_summable : Summable (fun stage => (sourceBlockSize stage : ℝ)^(-2 : ℝ)) := by + have hg : Summable (fun stage : ℕ => (1/4 : ℝ)^stage) := + summable_geometric_of_lt_one (by norm_num) (by norm_num) + apply hg.of_nonneg_of_le (fun _ => by positivity) + intro stage + have hp : (2 : ℝ)^stage ≤ sourceBlockSize stage := by + have hh := (sourceStage stage).m_ge_pow + have hle : 2^stage ≤ 2^(stage+1) := Nat.pow_le_pow_right (by norm_num) (by omega) + exact_mod_cast hle.trans hh + calc + _ ≤ ((2 : ℝ)^stage)^(-2 : ℝ) := Real.rpow_le_rpow_of_nonpos (by positivity) hp (by norm_num) + _ = _ := by + rw [Real.rpow_neg (by positivity),Real.rpow_two] + rw [← pow_mul, Nat.mul_comm stage 2, pow_mul, ← inv_pow] + norm_num + +/-- Summability of the actual full-product self-pair budget. -/ +theorem sourceSamplingSelfBudget_summable : Summable sourceSamplingSelfBudget := by + apply sourceSampling_inverse_square_summable.of_norm_bounded_eventually_nat + filter_upwards [sourceSamplingSelfBudget_eventually] with stage hb + have hm : (100 : ℝ) ≤ sourceBlockSize stage := by exact_mod_cast (sourceStage stage).m_ge_100 + have hn : 0 ≤ sourceSamplingSelfBudget stage := by + unfold sourceSamplingSelfBudget + have hl := Real.log_nonneg (show (1 : ℝ) ≤ sourceBlockSize stage by linarith) + positivity + rw [Real.norm_eq_abs,abs_of_nonneg hn] + exact hb.trans (Real.rpow_le_rpow_of_exponent_le (by linarith) (by nlinarith)) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SingleCorrelation.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SingleCorrelation.lean new file mode 100644 index 0000000000000000000000000000000000000000..72ccec1ada84ef3a66f20793517bafcd56b2b9b9 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/SingleCorrelation.lean @@ -0,0 +1,96 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.PairMoments +import OAI.Analysis.FiniteFactor.Sampling.MixedCorrelation + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical +noncomputable section + +/-- The source powers make the single-phase relative error at most m^-80. -/ +theorem sourceSampling_single_phase_budget (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (i : SourceCoordinate) (hi : i.1 ≤ stage) (n : ℤ) (hn : n ∈ sourceSamplingPowers stage) : + 1/((n : ℝ)*sourceAngleUnit i) ≤ (sourceBlockSize stage : ℝ)^(-80 : ℝ) := by + let m : ℝ := sourceBlockSize stage + have hm : 0 < m := sourceBlockSize_pos stage + have hm2 : 2 ≤ m := by dsimp [m]; exact_mod_cast (show 2 ≤ sourceBlockSize stage by omega) + have hspec := (sourceSamplingPowers_spec stage hs).1 n hn + have hQ : m^(83 : ℝ) ≤ samplingQ (sourceBlockSize stage) := by + unfold samplingQ + change m^(83 : ℝ) ≤ m^((7/10 : ℝ)*m) + exact Real.rpow_le_rpow_of_exponent_le (by linarith) (by + have hh : (200000 : ℝ) ≤ m := by dsimp [m]; exact_mod_cast hs + linarith) + have hN : (sourceBlockSize i.1 : ℝ)*(sourceStageState i.1).K ≤ m^2 := by + have hh : (sourceBlockSize i.1 : ℝ)*(sourceStageState i.1).K ≤ + (sourceBlockSize stage : ℝ)*(sourceStageState stage).K := by exact_mod_cast sourceFrequencyScale_monotone hi + have hK : ((sourceStageState stage).K : ℝ) ≤ sourceBlockSize stage := by exact_mod_cast (sourceStage stage).m_ge_K + dsimp [m] + nlinarith + have hp : 0 < (n : ℝ) := by exact_mod_cast hspec.2.2 + have h82 : m^(82 : ℝ) ≤ (n : ℝ) := by + have he : m^(83 : ℝ) = m^(82 : ℝ)*m := by + rw [show (83 : ℝ) = 82+1 by norm_num,Real.rpow_add hm,Real.rpow_one] + have hh : 2*m^(82 : ℝ) ≤ m^(83 : ℝ) := by rw [he]; nlinarith [Real.rpow_pos_of_pos hm (82 : ℝ)] + nlinarith [hspec.1] + have hlen : m^(80 : ℝ) ≤ (n : ℝ)*sourceAngleUnit i := by + unfold sourceAngleUnit + rw [mul_one_div,le_div_iff₀ (mul_pos (sourceBlockSize_pos i.1) (sourceCutoff_pos i.1))] + calc + _ ≤ m^(80 : ℝ)*m^2 := mul_le_mul_of_nonneg_left hN (by positivity) + _ = m^(82 : ℝ) := by rw [← Real.rpow_natCast,← Real.rpow_add hm]; norm_num + _ ≤ _ := h82 + have he := one_div_le_one_div_of_le (Real.rpow_pos_of_pos hm (80 : ℝ)) hlen + simpa only [m,one_div,Real.rpow_neg (sourceBlockSize_pos stage).le] using he + +/-- Actual full-angle single-phase test, with all source sampling hypotheses. -/ +theorem sourceSampling_single_phase_relative (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (i : SourceCoordinate) (hi : i.1 ≤ stage) (n : ℤ) (hn : n ∈ sourceSamplingPowers stage) + (g : ℝ → ℝ) (hg : ∀ t, 0 ≤ g t) (hgm : Measurable g) (hgi : Integrable g unitIntervalMeasure) : + |(∫ θ, g (Int.fract ((n : ℝ)*θ i)) ∂sourceAngleLaw)-(∫ t, g t ∂unitIntervalMeasure)| ≤ + (sourceBlockSize stage : ℝ)^(-80 : ℝ)*(∫ t, g t ∂unitIntervalMeasure) := by + have hnp : (0 : ℝ) < n := by exact_mod_cast ((sourceSamplingPowers_spec stage hs).1 n hn).2.2 + have hh := sourceAngle_single_phase_test i (n : ℝ) hnp (sourceSampling_phase_length stage hs i hi n hn) g hg hgm hgi + have hm : Measurable (fun t : ℝ => g (Int.fract ((n : ℝ)*t))) := + hgm.comp (sourceFract_measurable.comp (measurable_const.mul measurable_id)) + rw [← sourceAngleLaw_coordinate i,integral_map (measurable_pi_apply i).aemeasurable hm.aestronglyMeasurable] at hh + exact hh.trans (mul_le_mul_of_nonneg_right (sourceSampling_single_phase_budget stage hs i hi n hn) (integral_nonneg hg)) + +/-- The actual mixed q_n/Z_l^0 coordinate factor, for every orientation and +all measurable tests, has error at most 5*m^-80. -/ +theorem sourceSampling_coordinate_mixed_error (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (i : SourceCoordinate) (hi : i.1 ≤ stage) (n : ℤ) (hn : n ∈ sourceSamplingPowers stage) + (r b : Bool) (E G : Set ℝ) (hE : MeasurableSet E) (hG : MeasurableSet G) : + |(∫ s, samplingOrientedDensity r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E G s * + (∫ θ, samplingOrientedWeight r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + E G s (Int.fract ((n : ℝ)*θ i)) ∂sourceAngleLaw) ∂unitIntervalMeasure)- + (∫ s, samplingOrientedDensity r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E G s^2 ∂unitIntervalMeasure)| ≤ + 5*(sourceBlockSize stage : ℝ)^(-80 : ℝ) := by + let u := samplingOrientedWeight r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E G + let C := max 1 (1/(sourceSamplingWidth stage*sourceSamplingCutoff stage)) + have hp := sourceSampling_parameters stage + have hu : Measurable (fun p : ℝ × ℝ => u p.1 p.2) := samplingOrientedWeight_measurable r b _ _ E G hE hG + have hb : ∀ s t, 0 ≤ u s t ∧ u s t ≤ C := samplingOrientedWeight_bounds r b _ _ E G hp.1 hp.2.2 + have he := sampling_integrated_mixed_error sourceAngleLaw (fun θ => Int.fract ((n : ℝ)*θ i)) + (sourceFract_measurable.comp (measurable_const.mul (measurable_pi_apply i))) + u hu C ((sourceBlockSize stage : ℝ)^(-80 : ℝ)) hb (fun s => + sourceSampling_single_phase_relative stage hs i hi n hn (u s) (fun t => (hb s t).1) + (hu.comp (measurable_const.prodMk measurable_id)) + (sampling_integrable_bounded unitIntervalMeasure (u s) + (hu.comp (measurable_const.prodMk measurable_id)) C (fun t => by + rw [abs_of_nonneg (hb s t).1]; exact (hb s t).2))) + apply he.trans + have hA := (sourceSampling_oriented_moment stage r b E G hE hG).2 + have hm1 : (1 : ℝ) ≤ sourceBlockSize stage := by + have h := (sourceStage stage).m_ge_100 + exact_mod_cast (show 1 ≤ sourceBlockSize stage by omega) + have hpow : (sourceBlockSize stage : ℝ)^(-6/5 : ℝ) ≤ 1 := Real.rpow_le_one_of_one_le_of_nonpos hm1 (by norm_num) + have hA5 : (∫ s, (∫ t, u s t ∂unitIntervalMeasure)^2 ∂unitIntervalMeasure) ≤ 5 := by + exact hA.trans (by linarith) + nlinarith [Real.rpow_nonneg (sourceBlockSize_pos stage).le (-80 : ℝ)] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Tail.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Tail.lean new file mode 100644 index 0000000000000000000000000000000000000000..efabd7c1b9ebbe48baac96d7afcf34c1db94f53a --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Tail.lean @@ -0,0 +1,86 @@ +import OAI.Analysis.FiniteFactor.CrossedProduct.StageOperator + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped ENNReal Topology +noncomputable section + +theorem sourceCutoff_ge_shift (s n : ℕ) : + 2^n * (sourceStageState s).K ≤ (sourceStageState (s+n)).K := by + induction n with + | zero => simp + | succ n ih => + have hh := sourceStage_cutoff_growth (s+n) + rw [pow_succ, Nat.add_succ] + nlinarith + +/-- The exact geometric tail estimate used in scales and tail trimming. -/ +theorem sourceCutoff_tail_bound (s : ℕ) : + (∑' n : ℕ, 1 / ((sourceStageState (s+n)).K : ℝ)) ≤ + 2 / ((sourceStageState s).K : ℝ) := by + let b (n : ℕ) : ℝ := (1 / ((sourceStageState s).K : ℝ)) * (1/2 : ℝ)^n + have hb : Summable b := (summable_geometric_of_lt_one (by norm_num : (0 : ℝ) ≤ 1/2) + (by norm_num : (1/2 : ℝ) < 1)).mul_left _ + have hle (n : ℕ) : 1 / ((sourceStageState (s+n)).K : ℝ) ≤ b n := by + have hh : (2 : ℝ)^n * (sourceStageState s).K ≤ (sourceStageState (s+n)).K := + by exact_mod_cast sourceCutoff_ge_shift s n + have hp : (0 : ℝ) < 2^n * (sourceStageState s).K := mul_pos (by positivity) (sourceCutoff_pos s) + have ht := one_div_le_one_div_of_le hp hh + simpa [b, one_div_pow, mul_comm, mul_left_comm] using ht + calc + _ ≤ ∑' n, b n := (hb.of_nonneg_of_le (fun _ => by positivity) hle).tsum_le_tsum hle hb + _ = 2 / ((sourceStageState s).K : ℝ) := by + rw [tsum_mul_left, tsum_geometric_of_lt_one (by norm_num : (0 : ℝ) ≤ 1/2) (by norm_num)] + ring + +def sourceTailAngleSum (θ : SourceCoordinate → ℝ) (s : ℕ) : ℝ := + ∑' n : ℕ, ∑ i : Fin (sourceBlockSize (s+n)), θ ⟨s+n,i⟩ + +theorem SourceAngles.tail_sum_bound {θ : SourceCoordinate → ℝ} (hθ : SourceAngles θ) (s : ℕ) : + sourceTailAngleSum θ s ≤ 4 / ((sourceStageState s).K : ℝ) := by + have hb (n : ℕ) : + (∑ i : Fin (sourceBlockSize (s+n)), θ ⟨s+n,i⟩) ≤ 2 / ((sourceStageState (s+n)).K : ℝ) := by + have hh := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => (hθ ⟨s+n,i⟩).2) + have he : (∑ _i : Fin (sourceBlockSize (s+n)), + 2 / ((sourceBlockSize (s+n) : ℝ)*(sourceStageState (s+n)).K)) = + 2 / ((sourceStageState (s+n)).K : ℝ) := by + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + field_simp [(sourceBlockSize_pos (s+n)).ne', (sourceCutoff_pos (s+n)).ne'] + exact hh.trans_eq he + have hs : Summable (fun n => 2 / ((sourceStageState (s+n)).K : ℝ)) := by + have hh := sourceCutoff_reciprocal_summable.comp_injective (add_right_injective s) + simpa [div_eq_mul_inv] using hh.mul_left 2 + calc + sourceTailAngleSum θ s ≤ ∑' n, 2 / ((sourceStageState (s+n)).K : ℝ) := + (hs.of_nonneg_of_le (fun n => Finset.sum_nonneg (fun i _ => hθ.nonneg _)) hb).tsum_le_tsum hb hs + _ = 2 * ∑' n, 1 / ((sourceStageState (s+n)).K : ℝ) := by + rw [← tsum_mul_left]; congr; funext n; ring + _ ≤ 2 * (2 / ((sourceStageState s).K : ℝ)) := + mul_le_mul_of_nonneg_left (sourceCutoff_tail_bound s) (by norm_num) + _ = 4 / ((sourceStageState s).K : ℝ) := by ring + +/-- The largest proposed sampling power divided by the next cutoff has the +source exponent gap 7/10 - 3/4 = -1/20. -/ +theorem sourceSampling_tail_ratio (s : ℕ) : + 4 * (sourceBlockSize s : ℝ)^((7/10 : ℝ)*(sourceBlockSize s : ℝ)) / + ((sourceStageState (s+1)).K : ℝ) ≤ + 4 * (sourceBlockSize s : ℝ)^(-(sourceBlockSize s : ℝ)/20) := by + have hm := sourceBlockSize_pos s + have hK := sourceCutoff_pos (s+1) + have hc : (sourceBlockSize s : ℝ)^((3/4 : ℝ)*(sourceBlockSize s : ℝ)) ≤ + (sourceStageState (s+1)).K := Nat.le_ceil _ + apply (div_le_iff₀ hK).mpr + calc + _ = (4 * (sourceBlockSize s : ℝ)^(-(sourceBlockSize s : ℝ)/20)) * + (sourceBlockSize s : ℝ)^((3/4 : ℝ)*(sourceBlockSize s : ℝ)) := by + rw [mul_assoc, ← Real.rpow_add hm] + congr 2 + ring + _ ≤ _ := mul_le_mul_of_nonneg_left hc (by positivity) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TestedMarginals.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TestedMarginals.lean new file mode 100644 index 0000000000000000000000000000000000000000..e061fcdaa488ab3f23e8fd3fb1bca910989019c7 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TestedMarginals.lean @@ -0,0 +1,94 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.TestedTransport + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal +noncomputable section + +def sourceSamplingEndpoint (r : Bool) + (p : (SourceCoordinate → ℝ) × (SourceCoordinate → ℝ)) : SourceCoordinate → ℝ := + if r then p.2 else p.1 + +theorem sourceSamplingEndpoint_measurable (r : Bool) : Measurable (sourceSamplingEndpoint r) := by + cases r + · exact measurable_fst + · exact measurable_snd + +/-- Both actual rectangle-restricted marginal measures for a single power. -/ +theorem sourceSamplingSummand_tested_marginal (I : Finset SourceCoordinate) (stage : ℕ) + (r : Bool) (E G : SourceCoordinate → Set ℝ) + (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (houtside : ∀ i ∉ sourceSamplingPrefix stage, + Set.Ico (0 : ℝ) 1 ⊆ E i ∧ Set.Ico (0 : ℝ) 1 ⊆ G i) + (θ : SourceCoordinate → ℝ) (n : ℤ) : + ((sourceSamplingSummand I stage θ n).restrict (sourceSamplingRectangle E G)).map + (sourceSamplingEndpoint r) = + sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal + (sourceSamplingProduct stage r (fun i => decide (i ∈ I)) E G n θ x)) := by + rw [sourceSamplingSummand_restrict_rectangle I stage E G hE hG houtside θ n] + have hp : Measurable (fun x : SourceCoordinate → ℝ => (x,coordinateRotate θ n x)) := + measurable_id.prodMk (coordinateRotate_preserving θ n).measurable + rw [Measure.map_map (sourceSamplingEndpoint_measurable r) hp] + cases r + · exact Measure.map_id + · change (sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal + (sourceSamplingProduct stage false (fun i => decide (i ∈ I)) E G n θ x))).map + (coordinateRotate θ n) = _ + have hw : Measurable (fun x => ENNReal.ofReal + (sourceSamplingProduct stage false (fun i => decide (i ∈ I)) E G n θ x)) := + (((sourceSamplingProduct_measurable stage false (fun i => decide (i ∈ I)) E G hE hG n).comp + (measurable_const.prodMk measurable_id)).ennreal_ofReal) + rw [sourceSamplingHaar_rotate_withDensity θ n _ hw] + apply withDensity_congr_ae + filter_upwards [sourceSamplingHaar_cube] with y hy + rw [sourceSamplingProduct_second_inverse I stage E G θ y n hy] + +/-- Averaging commutes with rectangle restriction and either endpoint map. +The density is the previously estimated empirical function, exactly. -/ +theorem sourceSamplingUntrimmed_tested_marginal (I : Finset SourceCoordinate) (stage : ℕ) + (r : Bool) (E G : SourceCoordinate → Set ℝ) + (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (houtside : ∀ i ∉ sourceSamplingPrefix stage, + Set.Ico (0 : ℝ) 1 ⊆ E i ∧ Set.Ico (0 : ℝ) 1 ⊆ G i) + (θ : SourceCoordinate → ℝ) : + ((sourceSamplingUntrimmed I stage θ).restrict (sourceSamplingRectangle E G)).map + (sourceSamplingEndpoint r) = + sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal + (sourceSamplingEmpiricalDensity stage r (fun i => decide (i ∈ I)) E G θ x)) := by + let S := sourceSamplingPowers stage + let c : ℝ≥0∞ := ENNReal.ofReal (1/((sourceSamplingPowers stage).card : ℝ)) + let w := fun n => sourceSamplingProduct stage r (fun i => decide (i ∈ I)) E G n θ + have hrep : (fun x => ENNReal.ofReal (sourceSamplingEmpiricalDensity stage r + (fun i => decide (i ∈ I)) E G θ x)) = + (fun x => c*∑ n ∈ S, ENNReal.ofReal (w n x)) := by + funext x + simp only [sourceSamplingEmpiricalDensity] + rw [div_eq_mul_inv,mul_comm,← one_div,ENNReal.ofReal_mul (by positivity), + ENNReal.ofReal_sum_of_nonneg (fun n _ => (sourceSamplingProduct_bounds stage r + (fun i => decide (i ∈ I)) E G n θ x).1)] + rw [hrep] + have hf := sourceSamplingEndpoint_measurable r + have hR := sourceSamplingRectangle_measurable E G hE hG + ext A hA + rw [Measure.map_apply hf hA,Measure.restrict_apply (hf hA)] + unfold sourceSamplingUntrimmed + rw [Measure.smul_apply,Measure.finsetSum_apply,withDensity_apply _ hA] + have hterm (n : ℤ) : sourceSamplingSummand I stage θ n + (sourceSamplingEndpoint r ⁻¹' A ∩ sourceSamplingRectangle E G) = + ∫⁻ x in A, ENNReal.ofReal (w n x) ∂sourceSamplingHaar := by + rw [← Measure.restrict_apply (hf hA),← Measure.map_apply hf hA, + sourceSamplingSummand_tested_marginal I stage r E G hE hG houtside θ n] + exact withDensity_apply _ hA + simp only [hterm,smul_eq_mul] + rw [lintegral_const_mul' c _ ENNReal.ofReal_ne_top] + congr 1 + exact (lintegral_finsetSum S (fun n _ => + (((sourceSamplingProduct_measurable stage r (fun i => decide (i ∈ I)) E G hE hG n).comp + (measurable_const.prodMk measurable_id)).ennreal_ofReal))).symm + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TestedTransport.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TestedTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..747cb81b4ba0749f170428c2af97cb1f0fb10b82 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TestedTransport.lean @@ -0,0 +1,92 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.SecondMarginal + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal +noncomputable section + +def sourceSamplingRectangle (E G : SourceCoordinate → Set ℝ) : + Set ((SourceCoordinate → ℝ) × (SourceCoordinate → ℝ)) := + {p | ∀ i, p.1 i ∈ E i ∧ p.2 i ∈ G i} + +theorem sourceSamplingRectangle_measurable (E G : SourceCoordinate → Set ℝ) + (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) : + MeasurableSet (sourceSamplingRectangle E G) := by + simp only [sourceSamplingRectangle,Set.ofPred_forall] + apply MeasurableSet.iInter + intro i + exact ((hE i).preimage ((measurable_pi_apply i).comp measurable_fst)).inter + ((hG i).preimage ((measurable_pi_apply i).comp measurable_snd)) + +theorem sourceSamplingProduct_first_indicator (I : Finset SourceCoordinate) (stage : ℕ) + (E G : SourceCoordinate → Set ℝ) + (houtside : ∀ i ∉ sourceSamplingPrefix stage, + Set.Ico (0 : ℝ) 1 ⊆ E i ∧ Set.Ico (0 : ℝ) 1 ⊆ G i) + (θ x : SourceCoordinate → ℝ) (n : ℤ) + (hx : ∀ i, x i ∈ Set.Ico (0 : ℝ) 1) : + sourceSamplingProduct stage false (fun i => decide (i ∈ I)) E G n θ x = + if (x,coordinateRotate θ n x) ∈ sourceSamplingRectangle E G + then sourceSamplingWeight I stage θ n x else 0 := by + have hy (i) : coordinateRotate θ n x i ∈ Set.Ico (0 : ℝ) 1 := + ⟨Int.fract_nonneg _,Int.fract_lt_one _⟩ + have he : (∀ i ∈ sourceSamplingPrefix stage, x i ∈ E i ∧ coordinateRotate θ n x i ∈ G i) ↔ + (x,coordinateRotate θ n x) ∈ sourceSamplingRectangle E G := by + constructor + · intro h i + by_cases hi : i ∈ sourceSamplingPrefix stage + · exact h i hi + · exact ⟨(houtside i hi).1 (hx i),(houtside i hi).2 (hy i)⟩ + · intro h i _ + exact h i + unfold sourceSamplingProduct samplingOrientedWeight samplingTestedFirstWeight + simp only [Bool.false_eq_true,ite_false,← coordinateRotate_phase] + simp only [Finset.prod_ite_zero,he] + rfl + +/-- Inverse rotation exchanges the two actual tested product orientations. -/ +theorem sourceSamplingProduct_second_inverse (I : Finset SourceCoordinate) (stage : ℕ) + (E G : SourceCoordinate → Set ℝ) (θ y : SourceCoordinate → ℝ) (n : ℤ) + (hy : ∀ i, y i ∈ Set.Ico (0 : ℝ) 1) : + sourceSamplingProduct stage false (fun i => decide (i ∈ I)) E G n θ + (coordinateRotate θ (-n) y) = + sourceSamplingProduct stage true (fun i => decide (i ∈ I)) E G n θ y := by + have hinv : coordinateRotate θ n (coordinateRotate θ (-n) y) = y := by + simpa only [neg_neg] using coordinateRotate_neg_cube θ y (-n) hy + apply Finset.prod_congr rfl + intro i _ + have hi := congrFun hinv i + rw [coordinateRotate_phase] at hi + simp only [samplingOrientedWeight,Bool.false_eq_true,ite_false,ite_true,samplingTestedFirstWeight,hi] + rw [coordinateRotate_neg_phase] + +/-- The restricted orbit-pair summand is exactly the pushforward of its +first tested product, with no assumed marginal law. -/ +theorem sourceSamplingSummand_restrict_rectangle (I : Finset SourceCoordinate) (stage : ℕ) + (E G : SourceCoordinate → Set ℝ) + (hE : ∀ i, MeasurableSet (E i)) (hG : ∀ i, MeasurableSet (G i)) + (houtside : ∀ i ∉ sourceSamplingPrefix stage, + Set.Ico (0 : ℝ) 1 ⊆ E i ∧ Set.Ico (0 : ℝ) 1 ⊆ G i) + (θ : SourceCoordinate → ℝ) (n : ℤ) : + (sourceSamplingSummand I stage θ n).restrict (sourceSamplingRectangle E G) = + (sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal + (sourceSamplingProduct stage false (fun i => decide (i ∈ I)) E G n θ x))).map + (fun x => (x,coordinateRotate θ n x)) := by + have hp : Measurable (fun x : SourceCoordinate → ℝ => (x,coordinateRotate θ n x)) := + measurable_id.prodMk (coordinateRotate_preserving θ n).measurable + have hR := sourceSamplingRectangle_measurable E G hE hG + unfold sourceSamplingSummand sourceSamplingWeightedMeasure + rw [Measure.restrict_map hp hR,restrict_withDensity (hp hR),← withDensity_indicator (hp hR)] + congr 1 + apply withDensity_congr_ae + filter_upwards [sourceSamplingHaar_cube] with x hx + rw [sourceSamplingProduct_first_indicator I stage E G houtside θ x n hx] + change (if (x,coordinateRotate θ n x) ∈ sourceSamplingRectangle E G + then ENNReal.ofReal (sourceSamplingWeight I stage θ n x) else 0) = _ + split_ifs <;> simp + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TorusLimitMarginals.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TorusLimitMarginals.lean new file mode 100644 index 0000000000000000000000000000000000000000..69c2a4e619e08f4a7059d59e5148a298427aa518 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TorusLimitMarginals.lean @@ -0,0 +1,69 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.TorusMarginals +import OAI.Analysis.FiniteFactor.OrbitSampling.LambdaMarginals +import OAI.Analysis.FiniteFactor.OrbitSampling.TorusSupport + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped ENNReal +noncomputable section + +/-- The actual compact-torus limiting marginals are dominated by product +Haar, the exact absolute continuity premise needed in the Lusin transfer. -/ +theorem sourceSamplingLambdaTorus_marginal_le (I : Finset SourceCoordinate) (r : Bool) : + (sourceSamplingLambdaTorus I : Measure SourceSamplingTorus).map (sourceTorusEndpoint r) ≤ sourceTorusHaar := by + have he : sourceTorusEndpoint r ∘ sourceSamplingTorusMap = sourceTorusQuotient ∘ sourceSamplingEndpoint r := by + funext p + cases r <;> rfl + change ((sourceSamplingLambda I).map sourceSamplingTorusMap).map (sourceTorusEndpoint r) ≤ _ + rw [Measure.map_map (sourceTorusEndpoint_measurable r) sourceSamplingTorusMap_continuous.measurable,he, + ← Measure.map_map sourceTorusQuotient_preserving.measurable (sourceSamplingEndpoint_measurable r)] + have h := Measure.map_mono (sourceSamplingLambda_marginal_le I r) sourceTorusQuotient_preserving.measurable + rwa [sourceTorusQuotient_preserving.map_eq] at h + +theorem sourceSamplingLambdaTorus_marginal_ac (I : Finset SourceCoordinate) (r : Bool) : + (sourceSamplingLambdaTorus I : Measure SourceSamplingTorus).map (sourceTorusEndpoint r) ≪ sourceTorusHaar := + Measure.absolutelyContinuous_of_le (sourceSamplingLambdaTorus_marginal_le I r) + +theorem sourceSamplingLambda_representatives (I : Finset SourceCoordinate) : + ∀ᵐ p ∂sourceSamplingLambda I, sourceSamplingPairRepresentative (sourceSamplingTorusMap p) = p := by + have hmeas : MeasurableSet {p : SourceSamplingPair | + sourceSamplingPairRepresentative (sourceSamplingTorusMap p) = p} := + measurableSet_eq_fun (sourceSamplingPairRepresentative_measurable.comp sourceSamplingTorusMap_continuous.measurable) + measurable_id + apply (ae_map_iff (sourceSamplingLimitMap_measurable I).aemeasurable hmeas).mpr + filter_upwards [ae_restrict_of_ae sourceSamplingPairHaar_cube] with p hp + apply Prod.ext + · exact sourceTorusRepresentative_quotient _ (fun i => (hp i).1) + · apply sourceTorusRepresentative_quotient + intro i + by_cases hi : i ∈ I + · simpa only [sourceSamplingLimitMap,ite_eq_left hi] using (hp i).2 + · simpa only [sourceSamplingLimitMap,ite_eq_right hi] using (hp i).1 + +/-- The actual limiting torus measure has the same representative order +as the trimmed measures. No closure of the order set in torus topology is assumed. -/ +theorem sourceSamplingLambdaTorus_ordered (I : Finset SourceCoordinate) : + ∀ᵐ p ∂(sourceSamplingLambdaTorus I : Measure SourceSamplingTorus), + ∀ i, sourceTorusRepresentative p.1 i ≤ sourceTorusRepresentative p.2 i := by + have hmeas : MeasurableSet {p : SourceSamplingTorus | + ∀ i, sourceTorusRepresentative p.1 i ≤ sourceTorusRepresentative p.2 i} := by + simp only [Set.ofPred_forall] + exact MeasurableSet.iInter (fun i => measurableSet_le + ((measurable_pi_apply i).comp (sourceTorusRepresentative_preserving.measurable.comp measurable_fst)) + ((measurable_pi_apply i).comp (sourceTorusRepresentative_preserving.measurable.comp measurable_snd))) + apply (ae_map_iff sourceSamplingTorusMap_continuous.measurable.aemeasurable hmeas).mpr + filter_upwards [sourceSamplingLambda_ordered I,sourceSamplingLambda_representatives I] with p hp he + have h1 := congrArg Prod.fst he + have h2 := congrArg Prod.snd he + change sourceTorusRepresentative (sourceTorusQuotient p.1) = p.1 at h1 + change sourceTorusRepresentative (sourceTorusQuotient p.2) = p.2 at h2 + change ∀ i, sourceTorusRepresentative (sourceTorusQuotient p.1) i ≤ sourceTorusRepresentative (sourceTorusQuotient p.2) i + rw [h1,h2] + exact hp + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TorusMarginals.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TorusMarginals.lean new file mode 100644 index 0000000000000000000000000000000000000000..32a40ccf420f18a33477b3d538c748861485dc85 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TorusMarginals.lean @@ -0,0 +1,58 @@ +import OAI.Analysis.FiniteFactor.CrossedProduct.TorusModel +import OAI.Analysis.FiniteFactor.OrbitSampling.TrimmedMarginals +import OAI.Analysis.FiniteFactor.OrbitSampling.TrimmedWeak + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped ENNReal +noncomputable section + +def sourceTorusEndpoint (r : Bool) (p : SourceSamplingTorus) : SourceTorus := if r then p.2 else p.1 + +theorem sourceTorusEndpoint_measurable (r : Bool) : Measurable (sourceTorusEndpoint r) := by + cases r + · exact measurable_fst + · exact measurable_snd + +theorem sourceSamplingTorus_marginal_transport (μ : Measure SourceSamplingPair) (r : Bool) + (g : (SourceCoordinate → ℝ) → ℝ) (hg : Measurable g) + (hm : μ.map (sourceSamplingEndpoint r) = sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal (g x))) : + (μ.map sourceSamplingTorusMap).map (sourceTorusEndpoint r) = + sourceTorusHaar.withDensity (fun z => ENNReal.ofReal (g (sourceTorusRepresentative z))) := by + have he : sourceTorusEndpoint r ∘ sourceSamplingTorusMap = sourceTorusQuotient ∘ sourceSamplingEndpoint r := by + funext p + cases r <;> rfl + rw [Measure.map_map (sourceTorusEndpoint_measurable r) sourceSamplingTorusMap_continuous.measurable,he, + ← Measure.map_map sourceTorusQuotient_preserving.measurable (sourceSamplingEndpoint_measurable r),hm] + exact sourceTorusQuotient_withDensity _ hg.ennreal_ofReal + +/-- The actual torus marginals, rather than only the representative-space +marginals, have uniformly bounded L2 densities with respect to product Haar. -/ +theorem sourceSamplingTrimmed_torus_marginals_event : ∀ᵐ θ ∂sourceAngleLaw, + ∀ (I : Finset SourceCoordinate) (r : Bool), ∃ C : ℝ, ∀ s, + ∃ g : SourceTorus → ℝ, + Measurable g ∧ (∀ z, 0 ≤ g z) ∧ + (sourceSamplingTrimmedTorus I s θ : Measure SourceSamplingTorus).map (sourceTorusEndpoint r) = + sourceTorusHaar.withDensity (fun z => ENNReal.ofReal (g z)) ∧ + MemLp g 2 sourceTorusHaar ∧ (∫ z, g z^2 ∂sourceTorusHaar) ≤ C := by + filter_upwards [sourceSamplingTrimmed_marginals_event] with θ hθ + intro I r + obtain ⟨C,hC⟩ := hθ I r + refine ⟨C,fun s => ?_⟩ + obtain ⟨g,hg,hg0,hgm,hglp,hgint⟩ := hC s + refine ⟨g ∘ sourceTorusRepresentative,hg.comp sourceTorusRepresentative_preserving.measurable, + fun z => hg0 _,sourceSamplingTorus_marginal_transport _ r g hg hgm,?_,?_⟩ + · exact hglp.comp_measurePreserving sourceTorusRepresentative_preserving + · have he : (∫ z, (g (sourceTorusRepresentative z))^2 ∂sourceTorusHaar) = + ∫ x, g x^2 ∂sourceSamplingHaar := by + rw [← sourceTorusRepresentative_preserving.map_eq] + exact (integral_map sourceTorusRepresentative_preserving.measurable.aemeasurable + (hg.pow_const 2).aestronglyMeasurable).symm + exact he.trans_le hgint + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TorusSupport.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TorusSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..0cf6109131839c18bba7f5653fc85dd7b4eb40ae --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TorusSupport.lean @@ -0,0 +1,107 @@ +import OAI.Analysis.FiniteFactor.CrossedProduct.TorusModel +import OAI.Analysis.FiniteFactor.OrbitSampling.OrbitSupport +import OAI.Analysis.FiniteFactor.OrbitSampling.TrimmedWeak + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped ENNReal Classical +noncomputable section + +def sourceSamplingPairRepresentative (z : SourceSamplingTorus) : SourceSamplingPair := + (sourceTorusRepresentative z.1,sourceTorusRepresentative z.2) + +theorem sourceSamplingPairRepresentative_measurable : Measurable sourceSamplingPairRepresentative := + (sourceTorusRepresentative_preserving.measurable.comp measurable_fst).prodMk + (sourceTorusRepresentative_preserving.measurable.comp measurable_snd) + +def sourceTorusRotate (θ : SourceCoordinate → ℝ) (n : ℤ) (z : SourceTorus) : SourceTorus := + fun i => z i + n • (θ i : UnitAddCircle) + +theorem sourceTorusRotate_continuous (θ : SourceCoordinate → ℝ) (n : ℤ) : Continuous (sourceTorusRotate θ n) := + continuous_pi (fun i => (continuous_apply i).add continuous_const) + +theorem sourceTorusQuotient_rotate (θ x : SourceCoordinate → ℝ) (n : ℤ) : + sourceTorusQuotient (coordinateRotate θ n x) = sourceTorusRotate θ n (sourceTorusQuotient x) := by + funext i + simp only [sourceTorusQuotient,coordinateRotate,sourceTorusRotate,AddCircle.coe_fract, + AddCircle.coe_add,← zsmul_eq_mul,AddCircle.coe_zsmul] + +/-- The chosen real representatives recover the actual orbit measures; +closed-cube endpoints are not silently identified with distinct real points. -/ +theorem sourceSamplingTrimmed_representatives (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : ∀ᵐ p ∂sourceSamplingTrimmed I s θ, + sourceSamplingPairRepresentative (sourceSamplingTorusMap p) = p := by + have hmeas : MeasurableSet {p : SourceSamplingPair | + sourceSamplingPairRepresentative (sourceSamplingTorusMap p) = p} := + measurableSet_eq_fun (sourceSamplingPairRepresentative_measurable.comp sourceSamplingTorusMap_continuous.measurable) + measurable_id + have hu : ∀ᵐ p ∂sourceSamplingUntrimmed I s θ, + sourceSamplingPairRepresentative (sourceSamplingTorusMap p) = p := by + apply Measure.ae_smul_measure + rw [ae_iff,Measure.finsetSum_apply] + apply Finset.sum_eq_zero + intro n hn + apply ae_iff.mp + apply (ae_map_iff (measurable_id.prodMk (coordinateRotate_preserving θ n).measurable).aemeasurable hmeas).mpr + have hh : ∀ᵐ x ∂sourceSamplingWeightedMeasure I s θ n, ∀ i, x i ∈ Set.Ico (0 : ℝ) 1 := + ae_iff.mpr (withDensity_absolutelyContinuous _ _ (ae_iff.mp sourceSamplingHaar_cube)) + filter_upwards [hh] with x hx + apply Prod.ext + · exact sourceTorusRepresentative_quotient x hx + · exact sourceTorusRepresentative_quotient _ (fun i => ⟨Int.fract_nonneg _,Int.fract_lt_one _⟩) + exact ae_restrict_of_ae hu + +def sourceSamplingTorusOrderedOrbits (s : ℕ) (θ : SourceCoordinate → ℝ) : Set SourceSamplingTorus := + {p | (∀ i, sourceTorusRepresentative p.1 i ≤ sourceTorusRepresentative p.2 i) ∧ + ∃ n ∈ sourceSamplingPowers s, 0 < n ∧ p.2 = sourceTorusRotate θ n p.1} + +theorem sourceSamplingTorusOrderedOrbits_measurable (s : ℕ) (θ : SourceCoordinate → ℝ) : + MeasurableSet (sourceSamplingTorusOrderedOrbits s θ) := by + change MeasurableSet ({p : SourceSamplingTorus | ∀ i, sourceTorusRepresentative p.1 i ≤ sourceTorusRepresentative p.2 i} ∩ + {p : SourceSamplingTorus | ∃ n ∈ sourceSamplingPowers s, 0 < n ∧ p.2 = sourceTorusRotate θ n p.1}) + apply MeasurableSet.inter + · simp only [Set.ofPred_forall] + exact MeasurableSet.iInter (fun i => measurableSet_le + ((measurable_pi_apply i).comp (sourceTorusRepresentative_preserving.measurable.comp measurable_fst)) + ((measurable_pi_apply i).comp (sourceTorusRepresentative_preserving.measurable.comp measurable_snd))) + · simp only [Set.ofPred_exists] + apply MeasurableSet.iUnion + intro n + by_cases hn : n ∈ sourceSamplingPowers s ∧ 0 < n + · simp only [hn.1,hn.2,true_and] + exact measurableSet_eq_fun measurable_snd ((sourceTorusRotate_continuous θ n).measurable.comp measurable_fst) + · have he : {p : SourceSamplingTorus | n ∈ sourceSamplingPowers s ∧ 0 < n ∧ p.2 = sourceTorusRotate θ n p.1} = ∅ := by + ext p; simp only [Set.mem_ofPred_eq,Set.mem_empty_iff_false,iff_false]; tauto + rw [he] + exact MeasurableSet.empty + +/-- Actual compact-torus support: representatives are ordered, and each pair +lies on one of the constructed finitely many strictly positive rotation graphs. -/ +theorem sourceSamplingTrimmed_torus_orbits (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : + ∀ᵐ p ∂(sourceSamplingTrimmedTorus I s θ : Measure SourceSamplingTorus), + (∀ i, sourceTorusRepresentative p.1 i ≤ sourceTorusRepresentative p.2 i) ∧ + ∃ n ∈ sourceSamplingPowers s, 0 < n ∧ p.2 = sourceTorusRotate θ n p.1 := by + apply (ae_map_iff sourceSamplingTorusMap_continuous.measurable.aemeasurable + (sourceSamplingTorusOrderedOrbits_measurable s θ)).mpr + filter_upwards [sourceSamplingTrimmed_orbits I s θ,sourceSamplingTrimmed_representatives I s θ] with p hp he + refine ⟨?_,?_⟩ + · have h1 := congrArg Prod.fst he + have h2 := congrArg Prod.snd he + change sourceTorusRepresentative (sourceTorusQuotient p.1) = p.1 at h1 + change sourceTorusRepresentative (sourceTorusQuotient p.2) = p.2 at h2 + change ∀ i, sourceTorusRepresentative (sourceTorusQuotient p.1) i ≤ sourceTorusRepresentative (sourceTorusQuotient p.2) i + rw [h1,h2] + exact hp.1 + · obtain ⟨n,hn,hpos,hrot⟩ := hp.2 + refine ⟨n,hn,hpos,?_⟩ + change sourceTorusQuotient p.2 = sourceTorusRotate θ n (sourceTorusQuotient p.1) + rw [hrot] + exact sourceTorusQuotient_rotate θ p.1 n + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TriangleLaw.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TriangleLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..0980fb4e3fffef3f583dc40695be14aba16e52de --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TriangleLaw.lean @@ -0,0 +1,79 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.CutoffMass + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical ENNReal Topology +noncomputable section + +/-- The actual triangular phase weight is precisely the order indicator +of the rotated endpoint, on the Haar representatives. -/ +theorem samplingWeight_triangular_order (h α s t : ℝ) + (hs : s ∈ Set.Ico (0 : ℝ) 1) (ht : t ∈ Set.Ico (0 : ℝ) 1) : + samplingWeight true h α s t = if s < Int.fract (s+t) then 1 else 0 := by + by_cases hst : s+t < 1 + · have hf : Int.fract (s+t) = s+t := Int.fract_eq_self.mpr ⟨by linarith [hs.1,ht.1],hst⟩ + simp only [samplingWeight,ite_true,hf] + have he : (0 < t ∧ t < 1-s) ↔ s < s+t := by + constructor + · intro h; linarith [h.1] + · intro h; constructor <;> linarith + simp only [he] + · have hf : ⌊s+t⌋ = (1 : ℤ) := Int.floor_eq_iff.mpr ⟨by norm_num; linarith,by norm_num; linarith [hs.2,ht.2]⟩ + have hn : ¬ (0 < t ∧ t < 1-s) := by intro h; linarith [h.2] + have ho : ¬ s < Int.fract (s+t) := by rw [Int.fract,hf]; norm_num; linarith [ht.2] + simp only [samplingWeight,ite_true,ite_eq_right hn,ite_eq_right ho] + +/-- The first tested triangular density is its actual vertical section of +Lebesgue measure on 0≤x if s ∈ E ∧ y ∈ G ∧ s < y then (1 : ℝ) else 0 + have hm : Measurable F := by + apply Measurable.ite _ measurable_const measurable_const + by_cases htest : s ∈ E + · simp only [htest,true_and] + change MeasurableSet (G ∩ {y : ℝ | s < y}) + exact hG.inter (measurableSet_lt measurable_const measurable_id) + · simp [htest] + have hp : MeasurePreserving (fun t : ℝ => Int.fract (s+t)) unitIntervalMeasure unitIntervalMeasure := by + simpa only [add_comm] using unitInterval_rotate_preserving s + have he : samplingTestedFirstWeight true h α E G s =ᵐ[unitIntervalMeasure] + (fun t => F (Int.fract (s+t))) := by + filter_upwards [ae_restrict_mem measurableSet_Ico] with t ht + rw [samplingTestedFirstWeight,samplingWeight_triangular_order h α s t hs ht] + simp only [F] + split_ifs <;> simp_all + rw [samplingTestedFirstDensity,integral_congr_ae he] + rw [← integral_map hp.measurable.aemeasurable hm.aestronglyMeasurable,hp.map_eq] + +/-- The two-dimensional tested source integral equals the genuine triangular +restriction of product Lebesgue measure. -/ +theorem samplingTestedFirstDensity_triangular_mass (h α : ℝ) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + (∫ s, samplingTestedFirstDensity true h α E G s ∂unitIntervalMeasure) = + ((unitIntervalMeasure.prod unitIntervalMeasure) + {p : ℝ × ℝ | p.1 ∈ E ∧ p.2 ∈ G ∧ p.1 < p.2}).toReal := by + let A := {p : ℝ × ℝ | p.1 ∈ E ∧ p.2 ∈ G ∧ p.1 < p.2} + have hA : MeasurableSet A := (hE.preimage measurable_fst).inter + ((hG.preimage measurable_snd).inter (measurableSet_lt measurable_fst measurable_snd)) + have hm : Measurable (A.indicator (fun _ => (1 : ℝ))) := measurable_const.indicator hA + have hi : Integrable (A.indicator (fun _ => (1 : ℝ))) (unitIntervalMeasure.prod unitIntervalMeasure) := + (integrable_const (1 : ℝ)).indicator hA + calc + _ = ∫ s, ∫ y, A.indicator (fun _ => (1 : ℝ)) (s,y) ∂unitIntervalMeasure ∂unitIntervalMeasure := by + apply integral_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Ico] with s hs + simpa only [A,Set.indicator_apply,Set.mem_ofPred_eq] using + samplingTestedFirstDensity_triangular_section h α s E G hG hs + _ = ∫ p, A.indicator (fun _ => (1 : ℝ)) p ∂unitIntervalMeasure.prod unitIntervalMeasure := + (integral_prod _ hi).symm + _ = _ := by rw [integral_indicator hA]; simp [measureReal_def,A] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TrimmedMarginals.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TrimmedMarginals.lean new file mode 100644 index 0000000000000000000000000000000000000000..347ed27475c988a76d9d3d87a6fe069c0f0312c3 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TrimmedMarginals.lean @@ -0,0 +1,42 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.OrderedRestriction +import OAI.Analysis.FiniteFactor.SubmeasureL2Density + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +/-- Each actual trimmed marginal is dominated by the actual untrimmed +marginal, for both orientations. -/ +theorem sourceSamplingTrimmed_marginal_le (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (r : Bool) : + (sourceSamplingTrimmed I s θ).map (sourceSamplingEndpoint r) ≤ + (sourceSamplingUntrimmed I s θ).map (sourceSamplingEndpoint r) := + Measure.map_mono (sourceSamplingTrimmed_le I s θ) (sourceSamplingEndpoint_measurable r) + +/-- The actual Radon--Nikodym densities after trimming have the same uniform +squared L2 bound, on a single event for every finite I and both endpoints. -/ +theorem sourceSamplingTrimmed_marginals_event : ∀ᵐ θ ∂sourceAngleLaw, + ∀ (I : Finset SourceCoordinate) (r : Bool), ∃ C : ℝ, ∀ s : ℕ, + ∃ g : (SourceCoordinate → ℝ) → ℝ, + Measurable g ∧ (∀ x, 0 ≤ g x) ∧ + (sourceSamplingTrimmed I s θ).map (sourceSamplingEndpoint r) = + sourceSamplingHaar.withDensity (fun x => ENNReal.ofReal (g x)) ∧ + MemLp g 2 sourceSamplingHaar ∧ (∫ x, g x^2 ∂sourceSamplingHaar) ≤ C := by + filter_upwards [sourceSampling_both_marginals_event] with θ hθ + intro I r + obtain ⟨C,hC⟩ := hθ I r + refine ⟨C,fun s => ?_⟩ + obtain ⟨f,hf,hLp,hbound⟩ := hC s + have hsub := sourceSamplingTrimmed_marginal_le I s θ r + rw [hf] at hsub + obtain ⟨g,hg,hg0,hgμ,hle,hgLp,hgint⟩ := submeasure_L2_density sourceSamplingHaar + ((sourceSamplingTrimmed I s θ).map (sourceSamplingEndpoint r)) f hLp hsub + exact ⟨g,hg,hg0,hgμ,hgLp,hgint.trans hbound⟩ + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TrimmedWeak.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TrimmedWeak.lean new file mode 100644 index 0000000000000000000000000000000000000000..5e9b1e7e00e3c4310ac7ddbc68e5bdc490746b40 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/TrimmedWeak.lean @@ -0,0 +1,88 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.OrderedRestriction +import OAI.Analysis.FiniteFactor.OrbitSampling.CompactTorus + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +def sourceSamplingTrimmedFinite (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : FiniteMeasure SourceSamplingPair := + ⟨sourceSamplingTrimmed I s θ,inferInstance⟩ + +def sourceSamplingTrimmedTorus (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : FiniteMeasure SourceSamplingTorus := + (sourceSamplingTrimmedFinite I s θ).map sourceSamplingTorusMap + +theorem sourceSampling_discarded_tendsto (I : Finset SourceCoordinate) + (θ : SourceCoordinate → ℝ) (hθ : SourceAngles θ) + (hmass : Tendsto (fun s => ((sourceSamplingUntrimmed I s θ) Set.univ).toReal) + atTop (𝓝 (((sourceSamplingLambda I) Set.univ).toReal))) : + Tendsto (fun s => ((sourceSamplingUntrimmed I s θ) sourceSamplingOrderedᶜ).toReal) + atTop (𝓝 0) := by + have hlim := hmass.mul sourceSampling_tail_error_tendsto + rw [mul_zero] at hlim + apply squeeze_zero (fun s => ENNReal.toReal_nonneg) _ hlim + intro s + have h := ENNReal.toReal_mono (by finiteness) + (sourceSamplingUntrimmed_discarded_le I s θ hθ) + simpa only [ENNReal.toReal_mul,ENNReal.toReal_ofReal (by positivity : + 0 ≤ 4*(sourceBlockSize s : ℝ)^(-(sourceBlockSize s : ℝ)/20))] using h + +def finiteMeasureRestrict {Ω : Type*} [MeasurableSpace Ω] + (μ : FiniteMeasure Ω) (A : Set Ω) : FiniteMeasure Ω := + ⟨(μ : Measure Ω).restrict A,inferInstance⟩ + +/-- A restriction whose discarded mass tends to zero has the same finite +weak limit. The norm bound gives the actual error for every test function. -/ +theorem finiteMeasure_restrict_tendsto {Ω : Type*} [MeasurableSpace Ω] + [TopologicalSpace Ω] [OpensMeasurableSpace Ω] + (μ : ℕ → FiniteMeasure Ω) (ν : FiniteMeasure Ω) (A : Set Ω) (hA : MeasurableSet A) + (hμ : Tendsto μ atTop (𝓝 ν)) + (hloss : Tendsto (fun n => ((μ n : Measure Ω) Aᶜ).toReal) atTop (𝓝 0)) : + Tendsto (fun n => finiteMeasureRestrict (μ n) A) + atTop (𝓝 ν) := by + apply FiniteMeasure.tendsto_of_forall_integral_tendsto + intro f + have hf := FiniteMeasure.tendsto_iff_forall_integral_tendsto.mp hμ f + have he : Tendsto (fun n => ∫ x in Aᶜ, f x ∂(μ n : Measure Ω)) atTop (𝓝 0) := by + apply tendsto_zero_iff_norm_tendsto_zero.mpr + have hb := hloss.const_mul ‖f‖ + rw [mul_zero] at hb + apply squeeze_zero (fun n => norm_nonneg _) _ hb + intro n + have hh := norm_integral_le_of_norm_le_const + (μ := (μ n : Measure Ω).restrict Aᶜ) + (Eventually.of_forall (fun x => f.norm_coe_le_norm x)) + simpa only [measureReal_def,Measure.restrict_apply MeasurableSet.univ,Set.univ_inter] using hh + have hsub := hf.sub he + rw [sub_zero] at hsub + convert hsub using 1 + funext n + exact (eq_sub_iff_add_eq.mpr (integral_add_compl (μ := (μ n : Measure Ω)) hA (f.integrable (μ := (μ n : Measure Ω))))) + +/-- Actual ordered measures have the same compact-torus weak limit, for +all continuous tests, on one probability-one angle event. -/ +theorem sourceSamplingTrimmed_weak_event : ∀ᵐ θ ∂sourceAngleLaw, + ∀ I : Finset SourceCoordinate, + Tendsto (fun s => sourceSamplingTrimmedFinite I s θ) atTop (𝓝 (sourceSamplingLambdaFinite I)) ∧ + Tendsto (fun s => sourceSamplingTrimmedTorus I s θ) atTop (𝓝 (sourceSamplingLambdaTorus I)) ∧ + ∀ f : C(SourceSamplingTorus,ℝ), + Tendsto (fun s => ∫ p, f p ∂(sourceSamplingTrimmedTorus I s θ : Measure SourceSamplingTorus)) + atTop (𝓝 (∫ p, f p ∂(sourceSamplingLambdaTorus I : Measure SourceSamplingTorus))) := by + filter_upwards [sourceSamplingUntrimmed_weak_event,sourceSampling_mass_limit_event,sourceAngleLaw_admissible] + with θ hw hm ha + intro I + have h := finiteMeasure_restrict_tendsto (fun s => sourceSamplingUntrimmedFinite I s θ) + (sourceSamplingLambdaFinite I) sourceSamplingOrdered sourceSamplingOrdered_measurable + (hw I) (sourceSampling_discarded_tendsto I θ ha (hm I)) + have ht := FiniteMeasure.tendsto_map_of_tendsto_of_continuous _ _ h sourceSamplingTorusMap_continuous + refine ⟨h,ht,fun f => ?_⟩ + exact (FiniteMeasure.tendsto_iff_forall_integral_tendsto.mp ht) (BoundedContinuousFunction.mkOfCompact f) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/UniformEvent.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/UniformEvent.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb6d19a2d679c98453cd6bc8f121b9d9e5a8e655 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/UniformEvent.lean @@ -0,0 +1,57 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.EmpiricalL2 + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical Topology +noncomputable section + +/-- Actual empirical L2 bounds, uniform over all stages on a conull event. -/ +theorem sourceSamplingEmpiricalDensity_uniform (r : Bool) (b : SourceCoordinate → Bool) + (a c a' c' : SourceCoordinate → ℝ) : + ∀ᵐ θ ∂sourceAngleLaw, ∃ C : ℝ, ∀ stage, + MemLp (sourceSamplingEmpiricalDensity stage r b + (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) θ) 2 + (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) ∧ + (∫ x, sourceSamplingEmpiricalDensity stage r b + (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) θ x^2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) ≤ C := by + filter_upwards [sourceSamplingSquaredError_ae r b a c a' c'] with θ hθ + let e := fun stage => sourceSamplingSquaredError stage r b + (fun i => Set.Icc (a i) (c i)) (fun i => Set.Icc (a' i) (c' i)) θ + refine ⟨2*(∑' stage, e stage)+2*Real.exp 5,?_⟩ + intro stage + refine ⟨sourceSamplingEmpiricalDensity_memLp stage r b _ _ + (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc) θ,?_⟩ + have he : e stage ≤ ∑' l, e l := hθ.1.le_tsum stage (fun l _ => sourceSamplingSquaredError_nonneg l r b _ _ θ) + apply (sourceSamplingEmpiricalDensity_square_le stage r b _ _ + (fun _ => measurableSet_Icc) (fun _ => measurableSet_Icc) θ).trans + change 2*e stage+2*Real.exp 5 ≤ _ + linarith + +/-- A single event gives full sampling convergence and uniform empirical L2 +bounds for every member of any countable source test family. -/ +theorem sourceSampling_full_L2_event {ι : Type*} [Countable ι] + (r : ι → Bool) (b : ι → SourceCoordinate → Bool) + (a c a' c' : ι → SourceCoordinate → ℝ) : + ∀ᵐ θ ∂sourceAngleLaw, ∀ j, + Tendsto (fun stage => sourceSamplingSquaredError stage (r j) (b j) + (fun i => Set.Icc (a j i) (c j i)) (fun i => Set.Icc (a' j i) (c' j i)) θ) atTop (𝓝 0) ∧ + ∃ C : ℝ, ∀ stage, + MemLp (sourceSamplingEmpiricalDensity stage (r j) (b j) + (fun i => Set.Icc (a j i) (c j i)) (fun i => Set.Icc (a' j i) (c' j i)) θ) 2 + (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) ∧ + (∫ x, sourceSamplingEmpiricalDensity stage (r j) (b j) + (fun i => Set.Icc (a j i) (c j i)) (fun i => Set.Icc (a' j i) (c' j i)) θ x^2 + ∂Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) ≤ C := by + apply ae_all_iff.mpr + intro j + filter_upwards [sourceSamplingSquaredError_ae (r j) (b j) (a j) (c j) (a' j) (c' j), + sourceSamplingEmpiricalDensity_uniform (r j) (b j) (a j) (c j) (a' j) (c' j)] with θ he hu + exact ⟨he.2,hu⟩ + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/WeakLimit.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/WeakLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..610a9bb6ac86009fa52636f382a7e6b52a9d1608 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/WeakLimit.lean @@ -0,0 +1,54 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.CylinderBasis +import OAI.Analysis.FiniteFactor.FiniteMeasureCylinderCriterion + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical ENNReal Topology +noncomputable section + +def sourceSamplingUntrimmedFinite (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) : FiniteMeasure SourceSamplingPair := + ⟨sourceSamplingUntrimmed I s θ,inferInstance⟩ + +def sourceSamplingLambdaFinite (I : Finset SourceCoordinate) : FiniteMeasure SourceSamplingPair := + ⟨sourceSamplingLambda I,inferInstance⟩ + +theorem sourceSamplingCylinder_mass_eq {μ : Measure SourceSamplingPair} + (hμ : ∀ᵐ p ∂μ, p ∈ sourceSamplingCube) (T : SourceSamplingRationalTest) : + μ (sourceSamplingCylinder T) = + μ (sourceSamplingRectangle (sourceSamplingRationalX T) (sourceSamplingRationalY T)) := by + apply measure_congr + filter_upwards [hμ] with p hp + exact propext (sourceSamplingCylinder_on_cube T p hp) + +/-- Actual finite measures converge weakly on the full real product. The +normalization and total-mass obligations are discharged by the empty test; +the original full sampling error is retained through the rectangle event. -/ +theorem sourceSamplingUntrimmed_weak_event : ∀ᵐ θ ∂sourceAngleLaw, + ∀ I : Finset SourceCoordinate, + Tendsto (fun s => sourceSamplingUntrimmedFinite I s θ) atTop + (𝓝 (sourceSamplingLambdaFinite I)) := by + filter_upwards [sourceSamplingLambda_rectangle_limit_event,sourceSampling_mass_limit_event] + with θ hrect hmass + intro I + apply finiteMeasure_tendsto_of_piSystem sourceSamplingCylinder_piSystem + · rintro _ ⟨T,rfl⟩ + exact sourceSamplingCylinder_measurable T + · exact sourceSamplingCylinder_basis + · apply NNReal.tendsto_coe.mp + exact hmass I + · rintro _ ⟨T,rfl⟩ + apply NNReal.tendsto_coe.mp + have h := hrect I T + have hu (s : ℕ) := sourceSamplingCylinder_mass_eq (sourceSamplingUntrimmed_cube I s θ) T + have hl := sourceSamplingCylinder_mass_eq (sourceSamplingLambda_cube I) T + change Tendsto (fun s => ((sourceSamplingUntrimmed I s θ) (sourceSamplingCylinder T)).toReal) + atTop (𝓝 (((sourceSamplingLambda I) (sourceSamplingCylinder T)).toReal)) + simpa only [← hu,← hl] using h + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/WeightedTail.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/WeightedTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..67ff1a1656cf0abf7c6ccbe33b622bdc0d8cdfd3 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/WeightedTail.lean @@ -0,0 +1,77 @@ +import OAI.Analysis.FiniteFactor.Sampling.WeightedCoordinate +import OAI.Analysis.FiniteFactor.CrossedProduct.TailTrimming + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped ENNReal +noncomputable section + +/-- The actual prefix-weighted summand loses at most the source tail budget +relative to its own mass. Coordinate independence is applied before the +countable union bound; a Haar estimate alone would not prove this statement. -/ +theorem sourceSampling_weighted_tail_loss (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (hθ : SourceAngles θ) (n : ℕ) : + sourceSamplingWeightedMeasure I s θ (n : ℤ) (sourceTailOrderFailure θ (s+1) n) ≤ + sourceSamplingWeightedMeasure I s θ (n : ℤ) Set.univ * + ENNReal.ofReal (4*(n : ℝ)/((sourceStageState (s+1)).K : ℝ)) := by + let ν := sourceSamplingWeightedMeasure I s θ (n : ℤ) + let M := ν Set.univ + have hcoord (i : SourceCoordinate) (hi : s < i.1) : + ν {x | Int.fract (x i+(n : ℝ)*θ i) < x i} ≤ M*ENNReal.ofReal ((n : ℝ)*θ i) := by + have hE : MeasurableSet {t : ℝ | Int.fract (t+(n : ℝ)*θ i) < t} := + measurableSet_lt (sourceFract_measurable.comp (measurable_id.add measurable_const)) measurable_id + have he := sourceSampling_tail_coordinate_mass I s θ (n : ℤ) i hi _ hE + change ν {x | Int.fract (x i+(n : ℝ)*θ i) < x i} = + M*unitIntervalMeasure {t | Int.fract (t+(n : ℝ)*θ i) < t} at he + rw [he] + have hh := unitInterval_order_failure ((n : ℝ)*θ i) (mul_nonneg (Nat.cast_nonneg _) (hθ.nonneg _)) + gcongr + have hblock (r : ℕ) : + ν (⋃ i : Fin (sourceBlockSize (s+1+r)), + {x | Int.fract (x ⟨s+1+r,i⟩+(n : ℝ)*θ ⟨s+1+r,i⟩) < x ⟨s+1+r,i⟩}) ≤ + M*ENNReal.ofReal ((n : ℝ)*(∑ i : Fin (sourceBlockSize (s+1+r)), θ ⟨s+1+r,i⟩)) := by + apply (measure_iUnion_le _).trans + calc + _ ≤ ∑' i : Fin (sourceBlockSize (s+1+r)), M*ENNReal.ofReal ((n : ℝ)*θ ⟨s+1+r,i⟩) := + ENNReal.tsum_le_tsum (fun i => hcoord ⟨s+1+r,i⟩ (by simp; omega)) + _ = _ := by + rw [tsum_fintype, ← Finset.mul_sum, + ← ENNReal.ofReal_sum_of_nonneg (fun i _ => mul_nonneg (Nat.cast_nonneg _) (hθ.nonneg _)), + ← Finset.mul_sum] + calc + _ ≤ ∑' r : ℕ, ν (⋃ i : Fin (sourceBlockSize (s+1+r)), + {x | Int.fract (x ⟨s+1+r,i⟩+(n : ℝ)*θ ⟨s+1+r,i⟩) < x ⟨s+1+r,i⟩}) := measure_iUnion_le _ + _ ≤ ∑' r : ℕ, M*ENNReal.ofReal ((n : ℝ)*(∑ i : Fin (sourceBlockSize (s+1+r)), θ ⟨s+1+r,i⟩)) := + ENNReal.tsum_le_tsum hblock + _ = M*ENNReal.ofReal ((n : ℝ)*sourceTailAngleSum θ (s+1)) := by + rw [ENNReal.tsum_mul_left, ← ENNReal.ofReal_tsum_of_nonneg + (fun r => mul_nonneg (Nat.cast_nonneg _) (Finset.sum_nonneg (fun i _ => hθ.nonneg _))) + ((hθ.tail_block_summable (s+1)).mul_left (n : ℝ)),tsum_mul_left] + rfl + _ ≤ _ := by + gcongr 1 + apply ENNReal.ofReal_le_ofReal + have hh := mul_le_mul_of_nonneg_left (hθ.tail_sum_bound (s+1)) (Nat.cast_nonneg n) + simpa [mul_div_assoc,mul_comm,mul_left_comm] using hh + +/-- The source exponent gap now bounds actual weighted lost mass, uniformly +for every positive power at most Q. -/ +theorem sourceSampling_weighted_tail_small (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (hθ : SourceAngles θ) (n : ℕ) + (hn : (n : ℝ) ≤ samplingQ (sourceBlockSize s)) : + sourceSamplingWeightedMeasure I s θ (n : ℤ) (sourceTailOrderFailure θ (s+1) n) ≤ + sourceSamplingWeightedMeasure I s θ (n : ℤ) Set.univ * + ENNReal.ofReal (4*(sourceBlockSize s : ℝ)^(-(sourceBlockSize s : ℝ)/20)) := by + apply (sourceSampling_weighted_tail_loss I s θ hθ n).trans + gcongr 1 + apply ENNReal.ofReal_le_ofReal + calc + _ ≤ 4*samplingQ (sourceBlockSize s)/((sourceStageState (s+1)).K : ℝ) := by gcongr + _ ≤ _ := sourceSampling_tail_ratio s + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Weights.lean b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Weights.lean new file mode 100644 index 0000000000000000000000000000000000000000..35e967444fbc3c870313e7b5cf49013016fbe044 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/OrbitSampling/Weights.lean @@ -0,0 +1,107 @@ +import OAI.Analysis.FiniteFactor.Sampling.Weights +import OAI.Analysis.FiniteFactor.OrbitSampling.Discrepancy + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Finset Filter +open scoped ENNReal +noncomputable section + +def sourceSamplingWidth (s : ℕ) : ℝ := (sourceBlockSize s : ℝ)^(-3/5 : ℝ) +def sourceSamplingCutoff (s : ℕ) : ℝ := (sourceBlockSize s : ℝ)^(-2 : ℝ) +def sourceSamplingPrefix (s : ℕ) : Finset SourceCoordinate := + CouplingParameters.blockPrefix sourceBlockSize (s+1) + +theorem sourceSampling_parameters (s : ℕ) : + 0 < sourceSamplingWidth s ∧ sourceSamplingWidth s < 1 ∧ 0 < sourceSamplingCutoff s := by + have hm : (100 : ℝ) ≤ sourceBlockSize s := by exact_mod_cast (sourceStage s).m_ge_100 + refine ⟨by unfold sourceSamplingWidth; positivity, ?_, by unfold sourceSamplingCutoff; positivity⟩ + exact Real.rpow_lt_one_of_one_lt_of_neg (by linarith) (by norm_num) + +theorem sourceSampling_weight_bound (s : ℕ) (triangular : Bool) (x t : ℝ) : + 0 ≤ samplingWeight triangular (sourceSamplingWidth s) (sourceSamplingCutoff s) x t ∧ + samplingWeight triangular (sourceSamplingWidth s) (sourceSamplingCutoff s) x t ≤ + (sourceBlockSize s : ℝ)^(13/5 : ℝ) := by + have hp := sourceSampling_parameters s + have hb := samplingWeight_bounds triangular _ _ x t hp.1 hp.2.2 + refine ⟨hb.1,hb.2.trans ?_⟩ + have hm := sourceBlockSize_pos s + have hm1 : (1 : ℝ) ≤ sourceBlockSize s := by + have hh : (100 : ℝ) ≤ sourceBlockSize s := by exact_mod_cast (sourceStage s).m_ge_100 + linarith + apply max_le + · exact Real.one_le_rpow hm1 (by norm_num) + · unfold sourceSamplingWidth sourceSamplingCutoff + rw [← Real.rpow_add hm] + norm_num + rw [Real.rpow_neg hm.le,inv_inv] + +def sourceSamplingWeight (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) (x : SourceCoordinate → ℝ) : ℝ := + ∏ i ∈ sourceSamplingPrefix s, + samplingWeight (decide (i ∈ I)) (sourceSamplingWidth s) (sourceSamplingCutoff s) + (x i) (Int.fract ((n : ℝ)*θ i)) + +theorem sourceSamplingWeight_measurable (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) : Measurable (sourceSamplingWeight I s θ n) := by + apply Finset.measurable_prod + intro i hi + have hp : Measurable (fun x : SourceCoordinate → ℝ => (x i, Int.fract ((n : ℝ)*θ i))) := + (measurable_pi_apply i).prodMk measurable_const + exact (samplingWeight_measurable (decide (i ∈ I)) (sourceSamplingWidth s) (sourceSamplingCutoff s)).comp hp + +theorem sourceSamplingWeight_bounds (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) (x : SourceCoordinate → ℝ) : + 0 ≤ sourceSamplingWeight I s θ n x ∧ sourceSamplingWeight I s θ n x ≤ + ((sourceBlockSize s : ℝ)^(13/5 : ℝ))^(sourceSamplingPrefix s).card := by + constructor + · exact prod_nonneg (fun i hi => (sourceSampling_weight_bound s _ _ _).1) + · unfold sourceSamplingWeight + calc + _ ≤ ∏ _i ∈ sourceSamplingPrefix s, (sourceBlockSize s : ℝ)^(13/5 : ℝ) := + prod_le_prod₀ (fun i hi => (sourceSampling_weight_bound s _ _ _).1) + (fun i hi => (sourceSampling_weight_bound s _ _ _).2) + _ = _ := by simp + +/-- Each actual finite-stage weight has an L2 density. This bound is for +one stage; it does not assert the later uniform-in-stage sampling bound. -/ +theorem sourceSamplingWeight_memLp (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) : + MemLp (sourceSamplingWeight I s θ n) 2 + (Measure.infinitePi (fun _ : SourceCoordinate => unitIntervalMeasure)) := by + apply MemLp.of_bound (sourceSamplingWeight_measurable I s θ n).aestronglyMeasurable + (((sourceBlockSize s : ℝ)^(13/5 : ℝ))^(sourceSamplingPrefix s).card) + exact Eventually.of_forall (fun x => by + rw [Real.norm_eq_abs,abs_of_nonneg (sourceSamplingWeight_bounds I s θ n x).1] + exact (sourceSamplingWeight_bounds I s θ n x).2) + +/-- The actual density depends only on the prefix, before tail trimming. -/ +theorem sourceSamplingWeight_prefix (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) (x y : SourceCoordinate → ℝ) + (hxy : ∀ i ∈ sourceSamplingPrefix s, x i = y i) : + sourceSamplingWeight I s θ n x = sourceSamplingWeight I s θ n y := by + apply prod_congr rfl + intro i hi + rw [hxy i hi] + +/-- Every nonzero summand orders all prefix coordinates under the actual rotation. -/ +theorem sourceSamplingWeight_orders_prefix (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) (x : SourceCoordinate → ℝ) + (hx : ∀ i, x i ∈ Set.Ico (0 : ℝ) 1) (hw : sourceSamplingWeight I s θ n x ≠ 0) : + ∀ i ∈ sourceSamplingPrefix s, x i < coordinateRotate θ n x i := by + intro i hi + have hp := sourceSampling_parameters s + have hwi := Finset.prod_ne_zero_iff.mp hw i hi + have horder := (samplingWeight_orders (decide (i ∈ I)) _ _ (x i) + (Int.fract ((n : ℝ)*θ i)) hp.1 hp.2.1 hp.2.2 (hx i) hwi).2 + have he : x i+(n : ℝ)*θ i = (x i+Int.fract ((n : ℝ)*θ i)) + (⌊(n : ℝ)*θ i⌋ : ℝ) := by + linarith [Int.fract_add_floor ((n : ℝ)*θ i)] + unfold coordinateRotate + rw [he,Int.fract_add_intCast] + exact horder + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/PeriodizedUniform.lean b/lean/OAI/Analysis/FiniteFactor/PeriodizedUniform.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3fdb8ef841ccfa221ad143554625ae7a50e5f73 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/PeriodizedUniform.lean @@ -0,0 +1,100 @@ +import OAI.Analysis.FiniteFactor.CrossedProduct.Rotation +import Mathlib.Probability.ConditionalProbability + +namespace OAI + +namespace FiniteFactor +open MeasureTheory ProbabilityTheory +open scoped ENNReal +noncomputable section + +theorem sourceFract_measurable : Measurable (Int.fract : ℝ → ℝ) := by + have hh := sourceCircleRepresentative_measurable.comp sourceCircle_mk_preserving.measurable + simpa only [Function.comp_def, sourceCircleRepresentative_coe] using hh + +/-- Every translated interval of length one maps to the same representative +Haar measure under fractional part. -/ +theorem fract_unit_interval (a : ℝ) : + (volume.restrict (Set.Ioc a (a+1))).map Int.fract = unitIntervalMeasure := by + have hh := sourceCircleRepresentative_preserving.comp (AddCircle.measurePreserving_mk 1 a) + have he : sourceCircleRepresentative ∘ ((↑) : ℝ → AddCircle (1 : ℝ)) = Int.fract := by + funext x + exact sourceCircleRepresentative_coe x + simpa only [he] using hh.map_eq + +theorem fract_integer_interval (a : ℝ) (n : ℕ) : + (volume.restrict (Set.Ioc a (a+n))).map Int.fract = (n : ℝ≥0∞) • unitIntervalMeasure := by + induction n with + | zero => simp + | succ n ih => + have hu : Set.Ioc a (a+((n+1 : ℕ) : ℝ)) = + Set.Ioc a (a+n) ∪ Set.Ioc (a+n) (a+n+1) := by + rw [Set.Ioc_union_Ioc_eq_Ioc (by have := Nat.cast_nonneg (α := ℝ) n; linarith) (by linarith)] + congr 1 + push_cast + ring + rw [hu, Measure.restrict_union (Set.Ioc_disjoint_Ioc_of_le le_rfl) measurableSet_Ioc, + Measure.map_add, ih, fract_unit_interval] + · simp [add_smul] + · exact sourceFract_measurable + +/-- Periodizing normalized interval measure has density at most 1+1/length. +The bound is expressed as domination of measures on every measurable set. -/ +theorem fract_interval_domination (a b : ℝ) (hab : a < b) : + (cond volume (Set.Ioc a b)).map Int.fract ≤ + ENNReal.ofReal (1+1/(b-a)) • unitIntervalMeasure := by + let n : ℕ := Nat.ceil (b-a) + have hsub : Set.Ioc a b ⊆ Set.Ioc a (a+n) := by + apply Set.Ioc_subset_Ioc le_rfl + have hh : b-a ≤ (n : ℝ) := Nat.le_ceil _ + linarith + have hle : (volume.restrict (Set.Ioc a b)).map Int.fract ≤ + (n : ℝ≥0∞) • unitIntervalMeasure := by + rw [← fract_integer_interval a n] + exact Measure.map_mono (Measure.restrict_mono hsub le_rfl) sourceFract_measurable + have hscalar : (ENNReal.ofReal (b-a))⁻¹ * (n : ℝ≥0∞) ≤ + ENNReal.ofReal (1+1/(b-a)) := by + have hpos : 0 < b-a := sub_pos.mpr hab + have hn : (n : ℝ) < b-a+1 := Nat.ceil_lt_add_one hpos.le + have hreal : (b-a)⁻¹ * (n : ℝ) ≤ 1+1/(b-a) := by + apply (mul_le_mul_of_nonneg_left hn.le (inv_nonneg.mpr hpos.le)).trans_eq + field_simp + rw [← ENNReal.ofReal_inv_of_pos hpos, ← ENNReal.ofReal_natCast, + ← ENNReal.ofReal_mul (inv_nonneg.mpr hpos.le)] + exact ENNReal.ofReal_le_ofReal hreal + unfold ProbabilityTheory.cond + rw [Measure.map_smul _ sourceFract_measurable.aemeasurable, Real.volume_Ioc] + calc + _ ≤ (ENNReal.ofReal (b-a))⁻¹ • ((n : ℝ≥0∞) • unitIntervalMeasure) := by gcongr + _ = ((ENNReal.ofReal (b-a))⁻¹ * (n : ℝ≥0∞)) • unitIntervalMeasure := smul_smul _ _ _ + _ ≤ _ := by gcongr + +/-- Positive scaling carries normalized interval measure to the normalized +scaled interval; this identifies the actual phase law before periodization. -/ +theorem cond_interval_mul_pos (a b c : ℝ) (hab : a < b) (hc : 0 < c) : + (cond volume (Set.Ioc a b)).map (fun t => c*t) = + cond volume (Set.Ioc (c*a) (c*b)) := by + have hp : (fun t : ℝ => c*t) ⁻¹' Set.Ioc (c*a) (c*b) = Set.Ioc a b := by + ext t + simp only [Set.mem_preimage, Set.mem_Ioc, mul_lt_mul_iff_right₀ hc, mul_le_mul_iff_right₀ hc] + have hlen : 0 < b-a := sub_pos.mpr hab + have hclen : 0 < c*b-c*a := by nlinarith + unfold ProbabilityTheory.cond + rw [Measure.map_smul _ (by fun_prop), Real.volume_Ioc, Real.volume_Ioc, ← hp, + ← Measure.restrict_map (f := fun t : ℝ => c*t) (by fun_prop) measurableSet_Ioc, + Real.map_volume_mul_left hc.ne', Measure.restrict_smul, smul_smul] + congr 1 + rw [abs_of_pos (inv_pos.mpr hc), ← ENNReal.ofReal_inv_of_pos hlen, + ← ENNReal.ofReal_mul (inv_nonneg.mpr hlen.le), ← ENNReal.ofReal_inv_of_pos hclen] + congr 1 + field_simp + +theorem cond_closed_interval_eq (a b : ℝ) : + cond volume (Set.Icc a b) = cond volume (Set.Ioc a b) := by + unfold ProbabilityTheory.cond + rw [Real.volume_Icc, Real.volume_Ioc, ← restrict_Ioc_eq_restrict_Icc] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Polynomial.lean b/lean/OAI/Analysis/FiniteFactor/Polynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..76750c0b3d1de8947aca4d484f3863bc40ae1b8f --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Polynomial.lean @@ -0,0 +1,162 @@ +import Mathlib + +namespace OAI + +namespace FiniteFactor +open Polynomial + +theorem product_has_low_nonzero_coeff (K : ℕ) (p q : ℂ[X]) + (hp : p.coeff K ≠ 0) (hq : q.coeff K ≠ 0) : + ∃ n ≤ 2 * K, (p * q).coeff n ≠ 0 := by + have hp0 : p ≠ 0 := by intro h; simp [h] at hp + have hq0 : q ≠ 0 := by intro h; simp [h] at hq + refine ⟨(p * q).natTrailingDegree, ?_, + Polynomial.coeff_natTrailingDegree_ne_zero.mpr (mul_ne_zero hp0 hq0)⟩ + rw [Polynomial.natTrailingDegree_mul hp0 hq0] + have ha := Polynomial.natTrailingDegree_le_of_ne_zero hp + have hb := Polynomial.natTrailingDegree_le_of_ne_zero hq + omega + +abbrev Coefficients (K : ℕ) := Fin (2 * K + 1) → ℂ + +noncomputable def coefficientPolynomial {K : ℕ} (a : Coefficients K) : ℂ[X] := + ∑ i : Fin (2 * K + 1), Polynomial.monomial i.val (a i) + +theorem coefficientPolynomial_coeff {K : ℕ} (a : Coefficients K) + (i : Fin (2 * K + 1)) : (coefficientPolynomial a).coeff i.val = a i := by + classical + simp [coefficientPolynomial, Polynomial.finsetSum_coeff, Polynomial.coeff_monomial, + Fin.val_inj] + +noncomputable def productCoefficient {K : ℕ} (a b : Coefficients K) (n : ℕ) : ℂ := + ∑ i : Fin (2 * K + 1), ∑ j : Fin (2 * K + 1), + if i.val + j.val = n then a i * b j else 0 + +theorem productCoefficient_eq {K : ℕ} (a b : Coefficients K) (n : ℕ) : + productCoefficient a b n = + (coefficientPolynomial a * coefficientPolynomial b).coeff n := by + classical + simp only [productCoefficient, coefficientPolynomial, Finset.sum_mul, Finset.mul_sum, + Polynomial.monomial_mul_monomial, Polynomial.finsetSum_coeff, Polynomial.coeff_monomial] + exact Finset.sum_comm + +theorem continuous_productCoefficient (K n : ℕ) : + Continuous (fun ab : Coefficients K × Coefficients K => + productCoefficient ab.1 ab.2 n) := by + classical + unfold productCoefficient + apply continuous_finsetSum + intro i _ + apply continuous_finsetSum + intro j _ + split_ifs <;> fun_prop + +noncomputable def lowCoefficients {K : ℕ} (ab : Coefficients K × Coefficients K) : + Coefficients K := fun n => productCoefficient ab.1 ab.2 n.val + +theorem continuous_lowCoefficients (K : ℕ) : Continuous (@lowCoefficients K) := + continuous_pi fun n => continuous_productCoefficient K n.val + +theorem lowCoefficients_ne_zero {K : ℕ} (ab : Coefficients K × Coefficients K) + (ha : ab.1 ⟨K, by omega⟩ ≠ 0) (hb : ab.2 ⟨K, by omega⟩ ≠ 0) : + lowCoefficients ab ≠ 0 := by + have ha' : (coefficientPolynomial ab.1).coeff K ≠ 0 := by + simpa using (coefficientPolynomial_coeff ab.1 ⟨K, by omega⟩).trans_ne ha + have hb' : (coefficientPolynomial ab.2).coeff K ≠ 0 := by + simpa using (coefficientPolynomial_coeff ab.2 ⟨K, by omega⟩).trans_ne hb + obtain ⟨n, hn, hne⟩ := product_has_low_nonzero_coeff K _ _ ha' hb' + intro h + have hz := congrFun h ⟨n, by omega⟩ + exact hne (by simpa [lowCoefficients, productCoefficient_eq] using hz) + +def admissibleCoefficients (K : ℕ) (D δ : ℝ) : Set (Coefficients K) := + {a | ∀ i, ‖a i‖ ≤ D} ∩ {a | δ ≤ ‖a ⟨K, by omega⟩‖} + +theorem isCompact_admissibleCoefficients (K : ℕ) (D δ : ℝ) : + IsCompact (admissibleCoefficients K D δ) := by + have hc : IsCompact {a : Coefficients K | ∀ i, ‖a i‖ ≤ D} := by + simpa [Set.pi, Metric.mem_closedBall, dist_zero_right] using + (isCompact_pi_infinite fun _ : Fin (2 * K + 1) => + isCompact_closedBall (0 : ℂ) D) + exact hc.inter_right (isClosed_le continuous_const (continuous_apply (⟨K, by omega⟩ : Fin (2 * K + 1))).norm) + +theorem uniform_product_coefficient_bound (K : ℕ) (D δ : ℝ) (hδ : 0 < δ) : + ∃ ε : ℝ, 0 < ε ∧ ∀ a b : Coefficients K, + (∀ i, ‖a i‖ ≤ D) → (∀ i, ‖b i‖ ≤ D) → + δ ≤ ‖a ⟨K, by omega⟩‖ → δ ≤ ‖b ⟨K, by omega⟩‖ → + ∃ n : Fin (2 * K + 1), ε ≤ ‖productCoefficient a b n.val‖ := by + classical + let S := (admissibleCoefficients K D δ).prod (admissibleCoefficients K D δ) + have hc : IsCompact S := (isCompact_admissibleCoefficients K D δ).prod + (isCompact_admissibleCoefficients K D δ) + by_cases hs : S.Nonempty + · obtain ⟨ab, hab, hmin⟩ := hc.exists_isMinOn hs + (continuous_lowCoefficients K).norm.continuousOn + have hpos : 0 < ‖lowCoefficients ab‖ := by + apply norm_pos_iff.mpr + apply lowCoefficients_ne_zero + · exact norm_pos_iff.mp (hδ.trans_le hab.1.2) + · exact norm_pos_iff.mp (hδ.trans_le hab.2.2) + refine ⟨‖lowCoefficients ab‖, hpos, ?_⟩ + intro a b ha hb ha0 hb0 + have hm : ‖lowCoefficients ab‖ ≤ ‖lowCoefficients (a, b)‖ := + hmin ⟨⟨ha, ha0⟩, ⟨hb, hb0⟩⟩ + by_contra hn + push Not at hn + have hlt : ‖lowCoefficients (a, b)‖ < ‖lowCoefficients ab‖ := + (pi_norm_lt_iff hpos).mpr hn + exact (not_lt_of_ge hm) hlt + · refine ⟨1, zero_lt_one, ?_⟩ + intro a b ha hb ha0 hb0 + exact False.elim (hs ⟨(a, b), ⟨⟨ha, ha0⟩, ⟨hb, hb0⟩⟩⟩) + +/-- Coefficient of z^r in the two Laurent polynomials supported on [-K,K]. +The finite indices enumerate each Laurent exponent exactly once as i-K. -/ +noncomputable def laurentProductCoefficient (K : ℕ) (A B : ℤ → ℂ) (r : ℤ) : ℂ := + ∑ i : Fin (2 * K + 1), ∑ j : Fin (2 * K + 1), + if (i.val : ℤ) - K + ((j.val : ℤ) - K) = r then + A ((i.val : ℤ) - K) * B ((j.val : ℤ) - K) else 0 + +theorem shifted_productCoefficient (K : ℕ) (A B : ℤ → ℂ) (n : ℕ) : + productCoefficient (K := K) (fun i => A ((i.val : ℤ) - K)) + (fun i => B ((i.val : ℤ) - K)) n = + laurentProductCoefficient K A B ((n : ℤ) - 2 * K) := by + classical + unfold productCoefficient laurentProductCoefficient + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + have h : (i.val + j.val = n) ↔ + (i.val : ℤ) - K + ((j.val : ℤ) - K) = (n : ℤ) - 2 * K := by omega + simp only [h] + +theorem laurent_product_uniform_lower_bound (K : ℕ) (D δ : ℝ) (hδ : 0 < δ) : + ∃ ε : ℝ, 0 < ε ∧ ∀ A B : ℤ → ℂ, + (∀ v : ℤ, -(K : ℤ) ≤ v → v ≤ K → ‖A v‖ ≤ D) → + (∀ v : ℤ, -(K : ℤ) ≤ v → v ≤ K → ‖B v‖ ≤ D) → + δ ≤ ‖A 0‖ → δ ≤ ‖B 0‖ → + ∃ n : ℕ, n ≤ 2 * K ∧ ε ≤ ‖laurentProductCoefficient K A B (-(n : ℤ))‖ := by + obtain ⟨ε, hε, hbound⟩ := uniform_product_coefficient_bound K D δ hδ + refine ⟨ε, hε, ?_⟩ + intro A B hA hB hA0 hB0 + let a : Coefficients K := fun i => A ((i.val : ℤ) - K) + let b : Coefficients K := fun i => B ((i.val : ℤ) - K) + have ha : ∀ i, ‖a i‖ ≤ D := by + intro i + apply hA <;> have := i.isLt <;> omega + have hb : ∀ i, ‖b i‖ ≤ D := by + intro i + apply hB <;> have := i.isLt <;> omega + have ha0 : δ ≤ ‖a ⟨K, by omega⟩‖ := by simpa [a] using hA0 + have hb0 : δ ≤ ‖b ⟨K, by omega⟩‖ := by simpa [b] using hB0 + obtain ⟨i, hi⟩ := hbound a b ha hb ha0 hb0 + have hiK : i.val ≤ 2 * K := by have := i.isLt; omega + refine ⟨2 * K - i.val, by omega, ?_⟩ + have he : (-((2 * K - i.val : ℕ) : ℤ)) = (i.val : ℤ) - 2 * K := by omega + rw [he] + simpa only [a, b, shifted_productCoefficient] using hi + +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/ProductDensityLimit.lean b/lean/OAI/Analysis/FiniteFactor/ProductDensityLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..295d4b394af396846abdf03c53a0a73b88d55b7b --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/ProductDensityLimit.lean @@ -0,0 +1,104 @@ +import Mathlib.MeasureTheory.Function.L2Space +import Mathlib.Probability.ProductMeasure +import Mathlib.MeasureTheory.Function.AEEqOfIntegral + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Topology ENNReal +noncomputable section + +/-- Nested orthogonal projections with bounded squared norms converge strongly. +For product densities, normalization supplies the displayed inner identity. -/ +theorem exists_limit_of_nested_inner {E : Type*} [NormedAddCommGroup E] + [InnerProductSpace ℝ E] [CompleteSpace E] (f : ℕ → E) (C : ℝ) + (hbound : ∀ n, ‖f n‖ ^ 2 ≤ C) + (hinner : ∀ n m, n ≤ m → inner ℝ (f n) (f m) = ‖f n‖ ^ 2) : + ∃ g : E, Tendsto f atTop (𝓝 g) ∧ ‖g‖ ^ 2 ≤ C := by + have hdist (n m : ℕ) (hnm : n ≤ m) : + ‖f m - f n‖ ^ 2 = ‖f m‖ ^ 2 - ‖f n‖ ^ 2 := by + rw [norm_sub_sq_real, real_inner_comm, hinner n m hnm] + ring + have hmono : Monotone (fun n => ‖f n‖ ^ 2) := by + intro n m hnm + have := sq_nonneg ‖f m - f n‖ + rw [hdist n m hnm] at this + linarith + have hbdd : BddAbove (Set.range (fun n => ‖f n‖ ^ 2)) := ⟨C, by + rintro _ ⟨n, rfl⟩; exact hbound n⟩ + have hc := (tendsto_atTop_ciSup hmono hbdd).cauchySeq + have hf : CauchySeq f := by + rw [Metric.cauchySeq_iff] at hc ⊢ + intro ε hε + obtain ⟨N, hN⟩ := hc (ε^2) (sq_pos_of_pos hε) + refine ⟨N, fun n hn m hm => ?_⟩ + have hh := hN n hn m hm + rw [Real.dist_eq] at hh + rw [dist_eq_norm] + rcases le_total n m with hnm | hmn + · have hd := hdist n m hnm + rw [norm_sub_rev] at hd + have hle := le_abs_self (‖f m‖ ^ 2 - ‖f n‖ ^ 2) + rw [abs_sub_comm] at hh + nlinarith [norm_nonneg (f n - f m)] + · have hd := hdist m n hmn + have hle := le_abs_self (‖f n‖ ^ 2 - ‖f m‖ ^ 2) + nlinarith [norm_nonneg (f n - f m)] + obtain ⟨g, hg⟩ := cauchySeq_tendsto_of_complete hf + exact ⟨g, hg, le_of_tendsto (hg.norm.pow 2) (Eventually.of_forall hbound)⟩ + +theorem l2_norm_sq {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} + (f : Lp ℝ 2 μ) : ‖f‖ ^ 2 = ∫ x, f x ^ 2 ∂μ := by + rw [← real_inner_self_eq_norm_sq, L2.inner_def] + simp only [RCLike.inner_apply, conj_trivial, sq] + +theorem l2_inner_toLp {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} + {f g : Ω → ℝ} (hf : MemLp f 2 μ) (hg : MemLp g 2 μ) : + inner ℝ (hf.toLp f) (hg.toLp g) = ∫ x, f x * g x ∂μ := by + rw [L2.inner_def] + apply integral_congr_ae + filter_upwards [hf.coeFn_toLp, hg.coeFn_toLp] with x hx hy + simp [hx, hy, RCLike.inner_apply, mul_comm] + +theorem l2_tendsto_setIntegral {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} + [IsFiniteMeasure μ] {f : ℕ → Lp ℝ 2 μ} {g : Lp ℝ 2 μ} + (h : Tendsto f atTop (𝓝 g)) {S : Set Ω} (hS : MeasurableSet S) : + Tendsto (fun n => ∫ x in S, f n x ∂μ) atTop (𝓝 (∫ x in S, g x ∂μ)) := by + have ht := tendsto_const_nhds.inner h + (𝕜 := ℝ) (x := indicatorConstLp 2 hS (measure_ne_top μ S) (1 : ℝ)) + simpa only [L2.inner_indicatorConstLp_eq_setIntegral_inner, + RCLike.inner_apply, conj_trivial, mul_one] using ht + +/-- An actual nonnegative L2 function, obtained by completeness, with convergence +of integrals on every measurable set. No limiting density is assumed. -/ +theorem exists_nonneg_L2_limit {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} + [IsFiniteMeasure μ] (f : ℕ → Ω → ℝ) (hf : ∀ n, MemLp (f n) 2 μ) + (hnon : ∀ n, ∀ᵐ x ∂μ, 0 ≤ f n x) (C : ℝ) + (hbound : ∀ n, (∫ x, f n x ^ 2 ∂μ) ≤ C) + (hinner : ∀ n m, n ≤ m → (∫ x, f n x * f m x ∂μ) = ∫ x, f n x ^ 2 ∂μ) : + ∃ g : Ω → ℝ, MemLp g 2 μ ∧ (∀ᵐ x ∂μ, 0 ≤ g x) ∧ + (∫ x, g x ^ 2 ∂μ) ≤ C ∧ + ∀ S, MeasurableSet S → + Tendsto (fun n => ∫ x in S, f n x ∂μ) atTop (𝓝 (∫ x in S, g x ∂μ)) := by + let F (n : ℕ) := (hf n).toLp (f n) + have hsq (n : ℕ) : ‖F n‖ ^ 2 = ∫ x, f n x ^ 2 ∂μ := by + rw [l2_norm_sq] + exact integral_congr_ae ((hf n).coeFn_toLp.mono fun x hx => congrArg (fun r : ℝ => r^2) hx) + obtain ⟨g, hg, hgb⟩ := exists_limit_of_nested_inner F C + (fun n => (hsq n).trans_le (hbound n)) (fun n m hnm => by + rw [l2_inner_toLp, hinner n m hnm, hsq n]) + have hsets (S : Set Ω) (hS : MeasurableSet S) : + Tendsto (fun n => ∫ x in S, f n x ∂μ) atTop (𝓝 (∫ x in S, g x ∂μ)) := by + have heq (n : ℕ) : (∫ x in S, F n x ∂μ) = ∫ x in S, f n x ∂μ := + setIntegral_congr_ae hS ((hf n).coeFn_toLp.mono fun x hx _ => hx) + simpa only [heq] using l2_tendsto_setIntegral hg hS + refine ⟨g, (Lp.memLp g), ?_, (l2_norm_sq g) ▸ hgb, hsets⟩ + exact ae_nonneg_of_forall_setIntegral_nonneg ((Lp.memLp g).integrable (by norm_num)) + (fun S hS _ => ge_of_tendsto (hsets S hS) + (Eventually.of_forall fun n => integral_nonneg_of_ae (ae_restrict_of_ae (hnon n)))) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/ProductKernel.lean b/lean/OAI/Analysis/FiniteFactor/ProductKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..80a910a7a64baf175da9a00709b52caecec22894 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/ProductKernel.lean @@ -0,0 +1,81 @@ +import Mathlib.Probability.ProductMeasure +import Mathlib.Probability.Independence.InfinitePi +import Mathlib.Probability.Independence.Integration +import Mathlib.Probability.Kernel.Composition.MeasureCompProd + +namespace OAI + +namespace FiniteFactor +open MeasureTheory ProbabilityTheory Finset MeasurableSpace +open scoped ENNReal +noncomputable section + +/-- Products of Markov kernels, with measurability proved on the generating +finite cylinders and extended to the entire product sigma algebra. -/ +def independentKernel {ι : Type*} {X Y : ι → Type*} + [∀ i, MeasurableSpace (X i)] [∀ i, MeasurableSpace (Y i)] + (κ : ∀ i, Kernel (X i) (Y i)) [∀ i, IsMarkovKernel (κ i)] : + Kernel (∀ i, X i) (∀ i, Y i) where + toFun x := Measure.infinitePi (fun i => κ i (x i)) + measurable' := by + apply Measurable.measure_of_isPiSystem_of_isProbabilityMeasure + generateFrom_squareCylinders.symm + (isPiSystem_squareCylinders (fun _ => isPiSystem_measurableSet) (by simp)) + rintro _ ⟨I, S, hS, rfl⟩ + have hs (i : ι) : MeasurableSet (S i) := hS i (Set.mem_univ i) + simp_rw [Measure.infinitePi_pi _ (fun i _ => hs i)] + exact Finset.measurable_prod _ fun i _ => ((κ i).measurable_coe (hs i)).comp (measurable_pi_apply i) + +instance independentKernel_markov {ι : Type*} {X Y : ι → Type*} + [∀ i, MeasurableSpace (X i)] [∀ i, MeasurableSpace (Y i)] + (κ : ∀ i, Kernel (X i) (Y i)) [∀ i, IsMarkovKernel (κ i)] : + IsMarkovKernel (independentKernel κ) := ⟨fun x => by + change IsProbabilityMeasure (Measure.infinitePi (fun i => κ i (x i))) + infer_instance⟩ + +theorem independentKernel_pi {ι : Type*} {X Y : ι → Type*} + [∀ i, MeasurableSpace (X i)] [∀ i, MeasurableSpace (Y i)] + (κ : ∀ i, Kernel (X i) (Y i)) [∀ i, IsMarkovKernel (κ i)] + (x : ∀ i, X i) (I : Finset ι) (S : ∀ i, Set (Y i)) + (hS : ∀ i ∈ I, MeasurableSet (S i)) : + independentKernel κ x (Set.pi (I : Set ι) S) = ∏ i ∈ I, κ i (x i) (S i) := + Measure.infinitePi_pi _ hS + +theorem lintegral_infinitePi_finset_prod {ι : Type*} {X : ι → Type*} + [∀ i, MeasurableSpace (X i)] (μ : ∀ i, Measure (X i)) [∀ i, IsProbabilityMeasure (μ i)] + (I : Finset ι) (f : ∀ i, X i → ℝ≥0∞) (hf : ∀ i, Measurable (f i)) : + (∫⁻ x, ∏ i ∈ I, f i (x i) ∂Measure.infinitePi μ) = ∏ i ∈ I, ∫⁻ t, f i t ∂μ i := by + rw [lintegral_prod_eq_prod_lintegral_of_indepFun I + (fun (i : ι) (x : ∀ i, X i) => f i (x i)) (iIndepFun_infinitePi (P := μ) (X := f) hf) + (fun i => (hf i).comp (measurable_pi_apply i))] + apply Finset.prod_congr rfl + intro i _ + exact (measurePreserving_eval_infinitePi μ i).lintegral_comp (hf i) + +/-- Full-vector disintegration commutes with an arbitrary independent product. +The equality is of measures on all measurable sets, not just rectangles. -/ +theorem independentKernel_compProd {ι : Type*} {X Y : ι → Type*} + [∀ i, MeasurableSpace (X i)] [∀ i, MeasurableSpace (Y i)] + (μ : ∀ i, Measure (X i)) [∀ i, IsProbabilityMeasure (μ i)] + (κ : ∀ i, Kernel (X i) (Y i)) [∀ i, IsMarkovKernel (κ i)] : + ((Measure.infinitePi μ) ⊗ₘ (independentKernel κ)).map + (fun z i => (z.1 i, z.2 i)) = Measure.infinitePi (fun i => (μ i) ⊗ₘ (κ i)) := by + have hm : Measurable (fun z : (∀ i, X i) × (∀ i, Y i) => fun i => (z.1 i, z.2 i)) := by + fun_prop + apply Measure.eq_infinitePi + intro I S hS + rw [Measure.map_apply hm (MeasurableSet.pi I.countable_toSet (fun i _ => hS i)), + Measure.compProd_apply (hm (MeasurableSet.pi I.countable_toSet (fun i _ => hS i)))] + have he (x : ∀ i, X i) : Prod.mk x ⁻¹' ((fun (z : (∀ i, X i) × (∀ i, Y i)) i => (z.1 i, z.2 i)) ⁻¹' Set.pi (I : Set ι) S) = + Set.pi (I : Set ι) (fun i => Prod.mk (x i) ⁻¹' S i) := rfl + simp_rw [he, independentKernel_pi κ _ I _ (fun i _ => measurable_prodMk_left (hS i))] + rw [lintegral_infinitePi_finset_prod μ I + (fun i t => κ i t (Prod.mk t ⁻¹' S i)) (fun i => Kernel.measurable_kernel_prodMk_left (hS i))] + apply Finset.prod_congr rfl + intro i _ + exact (Measure.compProd_apply (hS i)).symm + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Quasinilpotence.lean b/lean/OAI/Analysis/FiniteFactor/Quasinilpotence.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff7682e4f0e837f35697eb73941ea69898806d6b --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Quasinilpotence.lean @@ -0,0 +1,58 @@ +import Mathlib.Analysis.SpecialFunctions.Pow.Real +import Mathlib.Analysis.SpecialFunctions.Exp +import Mathlib.Analysis.SpecificLimits.Basic +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.Ring + +namespace OAI + +namespace FiniteFactor +open Filter +open scoped Topology + +/-- Taking nth roots of the finite-prefix exponential bound, for n>0. -/ +theorem root_le_prefix_exponential {a A B : ℝ} (ha : 0 ≤ a) {n : ℕ} (hn : 0 < n) + (hbound : a ≤ Real.exp (B - (n : ℝ)*A)) : + a ^ (1 / (n : ℝ)) ≤ Real.exp (B / (n : ℝ) - A) := by + have hn0 : (n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hn) + calc + a ^ (1 / (n : ℝ)) ≤ Real.exp (B - (n : ℝ)*A) ^ (1 / (n : ℝ)) := + Real.rpow_le_rpow ha hbound (by positivity) + _ = Real.exp ((B - (n : ℝ)*A) * (1 / (n : ℝ))) := (Real.exp_mul _ _).symm + _ = Real.exp (B / (n : ℝ) - A) := by + congr 1 + field_simp + +/-- The prefix is fixed before taking n→∞. Its additive loss B(q) may grow +arbitrarily with q; no uniform estimate on that loss is required. -/ +theorem root_tendsto_zero_of_prefix_bounds (a A B : ℕ → ℝ) + (ha : ∀ n, 0 ≤ a n) (hA : Tendsto A atTop atTop) + (hbound : ∀ (q n : ℕ), 0 < n → a n ≤ Real.exp (B q - (n : ℝ)*A q)) : + Tendsto (fun n => a n ^ (1 / (n : ℝ))) atTop (𝓝 0) := by + apply tendsto_order.2 + constructor + · intro l hl + exact Eventually.of_forall fun n => hl.trans_le (Real.rpow_nonneg (ha n) _) + · intro u hu + have hdecay : Tendsto (fun q => Real.exp (-A q)) atTop (𝓝 0) := + Real.tendsto_exp_neg_atTop_nhds_zero.comp hA + obtain ⟨q, hq⟩ := (hdecay.eventually (gt_mem_nhds hu)).exists + have hlim : Tendsto (fun n : ℕ => Real.exp (B q / (n : ℝ) - A q)) + atTop (𝓝 (Real.exp (-A q))) := by + simpa only [zero_sub, Function.comp_def] using + (Real.continuous_exp.tendsto (0 - A q)).comp + ((tendsto_const_div_atTop_nhds_zero_nat (B q)).sub_const (A q)) + filter_upwards [hlim.eventually (gt_mem_nhds hq), eventually_gt_atTop (0 : ℕ)] with n hn hn0 + exact (root_le_prefix_exponential (ha n) hn0 (hbound q n hn0)).trans_lt hn + +/-- Operator form of the analytic reduction, using precisely the norm-root +limit in MainTarget. This theorem does not assume spectral-radius theory. -/ +theorem norm_quasinilpotent_of_prefix_bounds {R : Type*} [NormedRing R] + (T : R) (A B : ℕ → ℝ) (hA : Tendsto A atTop atTop) + (hbound : ∀ (q n : ℕ), 0 < n → ‖T^n‖ ≤ Real.exp (B q - (n : ℝ)*A q)) : + Tendsto (fun n : ℕ => ‖T^n‖ ^ (1 / (n : ℝ))) atTop (𝓝 0) := + root_tendsto_zero_of_prefix_bounds (fun n => ‖T^n‖) A B (fun n => norm_nonneg (T^n)) hA hbound + +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/AveragedTransport.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/AveragedTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..169d8181b69427838f109badf4ed5085c8e5c567 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/AveragedTransport.lean @@ -0,0 +1,75 @@ +import OAI.Analysis.FiniteFactor.Sampling.WeightTransport + +namespace OAI + +namespace FiniteFactor +open MeasureTheory ProbabilityTheory Filter +open scoped ENNReal +noncomputable section + +/-- ENNReal form of the constructed averaged density. -/ +theorem samplingIdealSecond_lintegral (h s : ℝ) (hh : 0 < h) (hh1 : h < 1) : + ENNReal.ofReal (samplingIdealSecond h s) = + ∫⁻ v, ENNReal.ofReal (samplingTransportDensity v s) ∂samplingVelocityMeasure h := by + have := samplingVelocity_probability h hh + have hv : ∀ᵐ v ∂samplingVelocityMeasure h, v ∈ Set.Ioc (0 : ℝ) h := ae_cond_mem measurableSet_Ioc + have hm : Measurable (fun v => samplingTransportDensity v s) := + samplingTransportDensity_measurable.comp (measurable_id.prodMk measurable_const) + have hqi : Integrable (fun v => samplingTransportDensity v s) (samplingVelocityMeasure h) := + (integrable_const (1/(1-h))).mono' hm.aestronglyMeasurable (by + filter_upwards [hv] with v hv + rw [Real.norm_eq_abs,abs_of_nonneg (samplingTransportDensity_bounds h v s hh.le hh1 hv.1.le hv.2).1] + exact (samplingTransportDensity_bounds h v s hh.le hh1 hv.1.le hv.2).2.1) + exact ofReal_integral_eq_lintegral_ofReal hqi (hv.mono (fun v hv => + (samplingTransportDensity_bounds h v s hh.le hh1 hv.1.le hv.2).1)) + +/-- The average of the actual transport laws has density q_h. -/ +theorem samplingTransport_average (h : ℝ) (hh : 0 < h) (hh1 : h < 1) + (F : ℝ → ℝ≥0∞) (hF : Measurable F) : + (∫⁻ z, ∫⁻ v, F (samplingTransport v z) ∂samplingVelocityMeasure h ∂unitIntervalMeasure) = + ∫⁻ s, ENNReal.ofReal (samplingIdealSecond h s)*F s ∂unitIntervalMeasure := by + have := samplingVelocity_probability h hh + have hv : ∀ᵐ v ∂samplingVelocityMeasure h, v ∈ Set.Ioc (0 : ℝ) h := ae_cond_mem measurableSet_Ioc + have htm : Measurable (fun p : ℝ × ℝ => samplingTransport p.2 p.1) := by + unfold samplingTransport samplingDistance + fun_prop + have hswap := lintegral_lintegral_swap (μ := unitIntervalMeasure) (ν := samplingVelocityMeasure h) (f := fun z v => F (samplingTransport v z)) (hF.comp htm).aemeasurable + rw [hswap] + calc + _ = ∫⁻ v, (∫⁻ s, ENNReal.ofReal (samplingTransportDensity v s)*F s ∂unitIntervalMeasure) + ∂samplingVelocityMeasure h := by + apply lintegral_congr_ae + filter_upwards [hv] with v hv + have hm : Measurable (samplingTransport v) := by unfold samplingTransport samplingDistance; fun_prop + rw [← lintegral_map hF hm,samplingTransport_density v hv.1.le (hv.2.trans_lt hh1)] + have hmd : Measurable (fun s => ENNReal.ofReal (samplingTransportDensity v s)) := + (samplingTransportDensity_measurable.comp (measurable_const.prodMk measurable_id)).ennreal_ofReal + exact lintegral_withDensity_eq_lintegral_mul unitIntervalMeasure hmd hF + _ = ∫⁻ s, (∫⁻ v, ENNReal.ofReal (samplingTransportDensity v s)*F s ∂samplingVelocityMeasure h) + ∂unitIntervalMeasure := lintegral_lintegral_swap + (samplingTransportDensity_measurable.ennreal_ofReal.mul (hF.comp measurable_snd)).aemeasurable + _ = _ := by + apply lintegral_congr + intro s + have hmd : Measurable (fun v => ENNReal.ofReal (samplingTransportDensity v s)) := + (samplingTransportDensity_measurable.comp (measurable_id.prodMk measurable_const)).ennreal_ofReal + rw [lintegral_mul_const _ hmd,← samplingIdealSecond_lintegral h s hh hh1] + +/-- An actual cutoff-weight endpoint estimate, with no assumed second-marginal +identification. It holds against every measurable nonnegative test. -/ +theorem samplingWeight_endpoint_domination (h α : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (F : ℝ → ℝ≥0∞) (hF : Measurable F) : + (∫⁻ z, ∫⁻ t, ENNReal.ofReal (samplingWeight false h α z t)*F (z+t) + ∂unitIntervalMeasure ∂unitIntervalMeasure) ≤ + ∫⁻ s, ENNReal.ofReal (samplingIdealSecond h s)*F s ∂unitIntervalMeasure := by + rw [← samplingTransport_average h hh hh1 F hF] + apply lintegral_mono_ae + filter_upwards [show ∀ᵐ z ∂unitIntervalMeasure, z ∈ Set.Ico (0 : ℝ) 1 from + ae_restrict_mem measurableSet_Ico] with z hz + exact samplingWeight_transport_le h α z hh hh1 hα hz F hF + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/Cancellation.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/Cancellation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3385882463b43e4bfea960ee2661e314e5e0a6f --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/Cancellation.lean @@ -0,0 +1,111 @@ +import OAI.Analysis.FiniteFactor.Sampling.IntegratedCorrelation + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical +noncomputable section + +/-- Exact finite-average expansion, before bounding or discarding any term. -/ +theorem sampling_average_square_expansion {ι Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) (S : Finset ι) (f : ι → Ω → ℝ) (g : Ω → ℝ) + (hpair : ∀ n ∈ S, ∀ k ∈ S, Integrable (fun x => f n x*f k x) μ) + (hmix : ∀ n ∈ S, Integrable (fun x => f n x*g x) μ) + (hg : Integrable (fun x => g x^2) μ) : + (∫ x, ((∑ n ∈ S, f n x)/(S.card : ℝ)-g x)^2 ∂μ) = + (∑ n ∈ S, ∑ k ∈ S, ∫ x, f n x*f k x ∂μ)/(S.card : ℝ)^2 - + 2*(∑ n ∈ S, ∫ x, f n x*g x ∂μ)/(S.card : ℝ)+(∫ x, g x^2 ∂μ) := by + have he (x : Ω) : ((∑ n ∈ S, f n x)/(S.card : ℝ)-g x)^2 = + (∑ n ∈ S, ∑ k ∈ S, f n x*f k x)/(S.card : ℝ)^2 - + 2*(∑ n ∈ S, f n x*g x)/(S.card : ℝ)+g x^2 := by + have hsq : (∑ n ∈ S, ∑ k ∈ S, f n x*f k x) = (∑ n ∈ S, f n x)^2 := by + rw [pow_two]; simp_rw [Finset.sum_mul,Finset.mul_sum] + rw [hsq,← Finset.sum_mul] + ring + have hpi := integrable_finsetSum S (fun n hn => integrable_finsetSum S (fun k hk => hpair n hn k hk)) + have hmi := integrable_finsetSum S (fun n hn => hmix n hn) + have hiP : Integrable (fun x => (∑ n ∈ S, ∑ k ∈ S, f n x*f k x)/(S.card : ℝ)^2) μ := hpi.div_const _ + have hiM : Integrable (fun x => 2*(∑ n ∈ S, f n x*g x)/(S.card : ℝ)) μ := (hmi.const_mul 2).div_const _ + have hiSub : Integrable (fun x => (∑ n ∈ S, ∑ k ∈ S, f n x*f k x)/(S.card : ℝ)^2 - + 2*(∑ n ∈ S, f n x*g x)/(S.card : ℝ)) μ := hiP.sub hiM + have hpis : (∫ x, ∑ n ∈ S, ∑ k ∈ S, f n x*f k x ∂μ) = + ∑ n ∈ S, ∑ k ∈ S, ∫ x, f n x*f k x ∂μ := by + rw [integral_finsetSum S (fun n hn => integrable_finsetSum S (fun k hk => hpair n hn k hk))] + apply sum_congr rfl + intro n hn + exact integral_finsetSum S (fun k hk => hpair n hn k hk) + simp_rw [he] + rw [integral_add hiSub hg,integral_sub hiP hiM,integral_div,integral_div,integral_const_mul, + hpis,integral_finsetSum S (fun n hn => hmix n hn)] + +/-- Integrability of the full error follows from the same finite expansion. -/ +theorem sampling_average_square_integrable {ι Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) (S : Finset ι) (f : ι → Ω → ℝ) (g : Ω → ℝ) + (hpair : ∀ n ∈ S, ∀ k ∈ S, Integrable (fun x => f n x*f k x) μ) + (hmix : ∀ n ∈ S, Integrable (fun x => f n x*g x) μ) + (hg : Integrable (fun x => g x^2) μ) : + Integrable (fun x => ((∑ n ∈ S, f n x)/(S.card : ℝ)-g x)^2) μ := by + have hpi := integrable_finsetSum S (fun n hn => integrable_finsetSum S (fun k hk => hpair n hn k hk)) + have hmi := integrable_finsetSum S (fun n hn => hmix n hn) + have h : Integrable (fun x => (∑ n ∈ S, ∑ k ∈ S, f n x*f k x)/(S.card : ℝ)^2 - + 2*(∑ n ∈ S, f n x*g x)/(S.card : ℝ)+g x^2) μ := + ((hpi.div_const _).sub ((hmi.const_mul 2).div_const _)).add hg + apply h.congr + apply Eventually.of_forall + intro x + have hsq : (∑ n ∈ S, ∑ k ∈ S, f n x*f k x) = (∑ n ∈ S, f n x)^2 := by + rw [pow_two]; simp_rw [Finset.sum_mul,Finset.mul_sum] + dsimp only + rw [hsq,← Finset.sum_mul] + ring + +/-- The distinct-pair and mixed main terms cancel to -A/P. Since A is +nonnegative, the surviving upper bound is the actual diagonal term plus 3ε. -/ +theorem sampling_finite_cancellation {ι : Type*} (S : Finset ι) (hS : S.Nonempty) + (B : ι → ι → ℝ) (M : ι → ℝ) (A ε : ℝ) (hA : 0 ≤ A) (hε : 0 ≤ ε) + (hpair : ∀ n ∈ S, ∀ k ∈ S, n ≠ k → |B n k-A| ≤ ε) + (hmix : ∀ n ∈ S, |M n-A| ≤ ε) : + (∑ n ∈ S, ∑ k ∈ S, B n k)/(S.card : ℝ)^2 - + 2*(∑ n ∈ S, M n)/(S.card : ℝ)+A ≤ + (∑ n ∈ S, B n n)/(S.card : ℝ)^2+3*ε := by + let N : ℝ := S.card + have hN : 0 < N := by dsimp [N]; exact_mod_cast hS.card_pos + have hN1 : 1 ≤ N := by dsimp [N]; exact_mod_cast (show 1 ≤ S.card from hS.card_pos) + have hp (n : ι) (hn : n ∈ S) : + (∑ k ∈ S, B n k) ≤ B n n+(N-1)*(A+ε) := by + have hoff : (∑ k ∈ S.erase n, B n k) ≤ ((S.erase n).card : ℝ)*(A+ε) := by + calc + _ ≤ ∑ _k ∈ S.erase n, (A+ε) := sum_le_sum (fun k hk => by + have hmem := mem_erase.mp hk + have hb := (abs_le.mp (hpair n hn k hmem.2 (Ne.symm hmem.1))).2 + linarith) + _ = _ := by simp; ring + have hc : ((S.erase n).card : ℝ) = N-1 := by + rw [card_erase_of_mem hn,Nat.cast_sub (by exact hS.card_pos),Nat.cast_one] + rw [hc] at hoff + have he := sum_erase_add S (fun k => B n k) hn + linarith + have hpall : (∑ n ∈ S, ∑ k ∈ S, B n k) ≤ + (∑ n ∈ S, B n n)+N*(N-1)*(A+ε) := by + calc + _ ≤ ∑ n ∈ S, (B n n+(N-1)*(A+ε)) := sum_le_sum hp + _ = _ := by rw [sum_add_distrib]; simp [N]; ring + have hmall : N*(A-ε) ≤ ∑ n ∈ S, M n := by + calc + _ = ∑ _n ∈ S, (A-ε) := by simp [N]; ring + _ ≤ _ := sum_le_sum (fun n hn => by have hh := (abs_le.mp (hmix n hn)).1; linarith) + change _/N^2-2*_/N+A ≤ _/N^2+3*ε + have hpdiv := div_le_div_of_nonneg_right hpall (sq_nonneg N) + have hmdiv := div_le_div_of_nonneg_right hmall hN.le + have hcancel : ((∑ n ∈ S, B n n)+N*(N-1)*(A+ε))/N^2- + 2*(N*(A-ε))/N+A = + (∑ n ∈ S, B n n)/N^2+3*ε-(A+ε)/N := by field_simp; ring + have hnneg : 0 ≤ (A+ε)/N := div_nonneg (add_nonneg hA hε) hN.le + simp only [mul_div_assoc] at hmdiv hcancel ⊢ + nlinarith + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/FirstDiscrepancy.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/FirstDiscrepancy.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ddd666add9ce80e6091ac01d1639e88b46e3cae --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/FirstDiscrepancy.lean @@ -0,0 +1,102 @@ +import OAI.Analysis.FiniteFactor.Sampling.FirstInterval +import OAI.Analysis.FiniteFactor.OrbitSampling.Weights + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical ENNReal +noncomputable section + +/-- Rectangle discrepancy passes exactly to the first-oriented tested weights. -/ +theorem samplingTestedFirst_pair_bound {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X Y : Ω → ℝ) + (hX : Measurable X) (hY : Measurable Y) + [NullSingletonClass (μ.map X)] [NullSingletonClass (μ.map Y)] + (δ : ℝ) (hrect : ∀ a b c d : ℝ, + |(μ {ω | X ω ∈ Set.Icc a b ∧ Y ω ∈ Set.Icc c d}).toReal - + (unitIntervalMeasure (Set.Icc a b)).toReal*(unitIntervalMeasure (Set.Icc c d)).toReal| ≤ δ) + (b : Bool) (h α : ℝ) (E : Set ℝ) (a c s : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hs : s ∈ Set.Ico (0 : ℝ) 1) : + |(∫ ω, samplingTestedFirstWeight b h α E (Set.Icc a c) s (X ω) * + samplingTestedFirstWeight b h α E (Set.Icc a c) s (Y ω) ∂μ) - + samplingTestedFirstDensity b h α E (Set.Icc a c) s ^ 2| ≤ + δ*(if s ∈ E then samplingFirstHeight b h α s else 0)^2 := by + have : NullSingletonClass unitIntervalMeasure := by unfold unitIntervalMeasure; infer_instance + let A := max 0 (a-s) + let B := min (samplingFirstLength b h s) (c-s) + let C := if s ∈ E then samplingFirstHeight b h α s else 0 + let D := Set.Icc A B + have hrep (ν : Measure ℝ) [NullSingletonClass ν] : + samplingTestedFirstWeight b h α E (Set.Icc a c) s =ᵐ[ν] D.indicator (fun _ => C) := + samplingTestedFirstWeight_closed_interval_ae ν b h α E a c s hh hh1 hα hs + have hprod : (∫ ω, samplingTestedFirstWeight b h α E (Set.Icc a c) s (X ω) * + samplingTestedFirstWeight b h α E (Set.Icc a c) s (Y ω) ∂μ) = + C^2*(μ {ω | X ω ∈ D ∧ Y ω ∈ D}).toReal := by + calc + _ = ∫ ω, ({ω | X ω ∈ D ∧ Y ω ∈ D}).indicator (fun _ => C^2) ω ∂μ := by + apply integral_congr_ae + filter_upwards [ae_of_ae_map hX.aemeasurable (hrep (μ.map X)), + ae_of_ae_map hY.aemeasurable (hrep (μ.map Y))] with ω hx hy + rw [hx,hy] + simp only [Set.indicator,Set.mem_ofPred_eq] + split_ifs <;> simp_all [pow_two] + _ = _ := by + have hD : MeasurableSet {ω | X ω ∈ D ∧ Y ω ∈ D} := + (measurableSet_Icc.preimage hX).inter (measurableSet_Icc.preimage hY) + rw [integral_indicator hD] + simp [integral_const,measureReal_def,smul_eq_mul,mul_comm,D] + have hmean : samplingTestedFirstDensity b h α E (Set.Icc a c) s = + C*(unitIntervalMeasure D).toReal := by + unfold samplingTestedFirstDensity + rw [integral_congr_ae (hrep unitIntervalMeasure),integral_indicator measurableSet_Icc] + simp [integral_const,measureReal_def,smul_eq_mul,mul_comm,D] + rw [hprod,hmean] + calc + _ = C^2*|(μ {ω | X ω ∈ D ∧ Y ω ∈ D}).toReal - + (unitIntervalMeasure D).toReal*(unitIntervalMeasure D).toReal| := by + calc + _ = |C^2*((μ {ω | X ω ∈ D ∧ Y ω ∈ D}).toReal - + (unitIntervalMeasure D).toReal*(unitIntervalMeasure D).toReal)| := by congr 1; ring + _ = _ := by rw [abs_mul,abs_of_nonneg (sq_nonneg C)] + _ ≤ C^2*δ := mul_le_mul_of_nonneg_left (hrect A B A B) (sq_nonneg C) + _ = _ := by ring + +/-- The actual selected phase laws are atomless, despite possible dependence +between two phases. Only their already proved marginal domination is used. -/ +theorem sourceSampling_phase_null_singletons (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (i : SourceCoordinate) (hi : i.1 ≤ stage) (n : ℤ) (hn : n ∈ sourceSamplingPowers stage) : + NullSingletonClass (sourceAngleLaw.map (fun θ => Int.fract ((n : ℝ)*θ i))) := by + have : NullSingletonClass unitIntervalMeasure := by unfold unitIntervalMeasure; infer_instance + constructor + intro x + have hdom := sourceSampling_phase_domination stage hs i hi n hn + exact le_antisymm ((hdom {x}).trans_eq (by simp)) bot_le + +/-- Actual first-tested pair discrepancy, with all probabilistic assumptions +discharged by the source's deterministic separated powers. -/ +theorem sourceSampling_first_pair_bound (stage : ℕ) (hs : 200000 ≤ sourceBlockSize stage) + (i : SourceCoordinate) (hi : i.1 ≤ stage) (n n' : ℤ) + (hn : n ∈ sourceSamplingPowers stage) (hn' : n' ∈ sourceSamplingPowers stage) (hne : n ≠ n') + (b : Bool) (E : Set ℝ) (a c s : ℝ) (hsx : s ∈ Set.Ico (0 : ℝ) 1) : + |(∫ θ, samplingTestedFirstWeight b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + E (Set.Icc a c) s (Int.fract ((n : ℝ)*θ i)) * + samplingTestedFirstWeight b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) + E (Set.Icc a c) s (Int.fract ((n' : ℝ)*θ i)) ∂sourceAngleLaw) - + samplingTestedFirstDensity b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E (Set.Icc a c) s ^ 2| ≤ + (26*(sourceBlockSize stage : ℝ)^(-80 : ℝ))* + (if s ∈ E then samplingFirstHeight b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) s else 0)^2 := by + have := sourceSampling_phase_null_singletons stage hs i hi n hn + have := sourceSampling_phase_null_singletons stage hs i hi n' hn' + have hp := sourceSampling_parameters stage + exact samplingTestedFirst_pair_bound sourceAngleLaw + (fun θ => Int.fract ((n : ℝ)*θ i)) (fun θ => Int.fract ((n' : ℝ)*θ i)) + (sourceFract_measurable.comp (measurable_const.mul (measurable_pi_apply i))) + (sourceFract_measurable.comp (measurable_const.mul (measurable_pi_apply i))) _ + (sourceSampling_rectangle_bound stage hs i hi n n' hn hn' hne) + b _ _ E a c s hp.1 hp.2.1 hp.2.2 hsx + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/FirstInterval.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/FirstInterval.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a1a0b78a0552da13306f9bff222ee3a8982d696 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/FirstInterval.lean @@ -0,0 +1,82 @@ +import OAI.Analysis.FiniteFactor.Sampling.TestedFirstMoment + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical +noncomputable section + +def samplingFirstLength (b : Bool) (h s : ℝ) : ℝ := + if b then 1-s else h*samplingDistance s + +def samplingFirstHeight (b : Bool) (h α s : ℝ) : ℝ := + if b then 1 else if α ≤ samplingDistance s then 1/(h*samplingDistance s) else 0 + +/-- The first-oriented weight is exactly a constant times one open interval. -/ +theorem samplingWeight_first_interval (b : Bool) (h α s t : ℝ) : + samplingWeight b h α s t = + (Set.Ioo 0 (samplingFirstLength b h s)).indicator + (fun _ => samplingFirstHeight b h α s) t := by + cases b <;> unfold samplingWeight samplingFirstLength samplingFirstHeight <;> + simp only [Bool.false_eq_true,ite_false,ite_true,Set.indicator,Set.mem_Ioo]; + split_ifs <;> simp_all + +/-- Rational rectangle tests retain a single interval in the first orientation; +no bounded-variation theorem or independent pair density is assumed. -/ +theorem samplingTestedFirstWeight_interval (b : Bool) (h α : ℝ) (E : Set ℝ) (a c s t : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hs : s ∈ Set.Ico (0 : ℝ) 1) : + samplingTestedFirstWeight b h α E (Set.Icc a c) s t = + (Set.Ioo 0 (samplingFirstLength b h s) ∩ Set.Icc (a-s) (c-s)).indicator + (fun _ => if s ∈ E then samplingFirstHeight b h α s else 0) t := by + classical + have he := samplingWeight_first_interval b h α s t + by_cases ht : t ∈ Set.Ioo 0 (samplingFirstLength b h s) + · rw [Set.indicator_of_mem ht] at he + by_cases hc : samplingFirstHeight b h α s = 0 + · simp [samplingTestedFirstWeight,he,hc,Set.indicator] + · have hw : samplingWeight b h α s t ≠ 0 := by rwa [he] + have hf := (samplingWeight_orders b h α s t hh hh1 hα hs hw).1 + have heq : Int.fract (s+t) ∈ Set.Icc a c ↔ t ∈ Set.Icc (a-s) (c-s) := by + rw [hf] + simp only [Set.mem_Icc] + constructor <;> intro H <;> constructor <;> linarith [H.1,H.2] + simp only [samplingTestedFirstWeight,he,heq,Set.indicator,Set.mem_inter_iff,ht,true_and] + split_ifs <;> simp_all + · rw [Set.indicator_of_notMem ht] at he + simp [samplingTestedFirstWeight,he,Set.indicator,ht] + +/-- Closing the two support endpoints changes only those two points, even +when the tested interval is empty or degenerates to a singleton. -/ +theorem samplingTestedFirstWeight_closed_interval (b : Bool) (h α : ℝ) (E : Set ℝ) (a c s t : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hs : s ∈ Set.Ico (0 : ℝ) 1) + (ht0 : t ≠ 0) (htL : t ≠ samplingFirstLength b h s) : + samplingTestedFirstWeight b h α E (Set.Icc a c) s t = + (Set.Icc (max 0 (a-s)) (min (samplingFirstLength b h s) (c-s))).indicator + (fun _ => if s ∈ E then samplingFirstHeight b h α s else 0) t := by + rw [samplingTestedFirstWeight_interval b h α E a c s t hh hh1 hα hs] + have heq : t ∈ Set.Ioo 0 (samplingFirstLength b h s) ∩ Set.Icc (a-s) (c-s) ↔ + t ∈ Set.Icc (max 0 (a-s)) (min (samplingFirstLength b h s) (c-s)) := by + simp only [Set.mem_inter_iff,Set.mem_Ioo,Set.mem_Icc,max_le_iff,le_min_iff] + constructor + · intro H + exact ⟨⟨H.1.1.le,H.2.1⟩,⟨H.1.2.le,H.2.2⟩⟩ + · intro H + exact ⟨⟨lt_of_le_of_ne H.1.1 (Ne.symm ht0),lt_of_le_of_ne H.2.1 htL⟩,⟨H.1.2,H.2.2⟩⟩ + simp only [Set.indicator,heq] + +/-- The exact interval representation under any atomless law, including Haar. -/ +theorem samplingTestedFirstWeight_closed_interval_ae (μ : Measure ℝ) [NullSingletonClass μ] + (b : Bool) (h α : ℝ) (E : Set ℝ) (a c s : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hs : s ∈ Set.Ico (0 : ℝ) 1) : + samplingTestedFirstWeight b h α E (Set.Icc a c) s =ᵐ[μ] + (Set.Icc (max 0 (a-s)) (min (samplingFirstLength b h s) (c-s))).indicator + (fun _ => if s ∈ E then samplingFirstHeight b h α s else 0) := by + filter_upwards [ae_iff.mpr (show μ {t | ¬t ≠ 0} = 0 by simp), + ae_iff.mpr (show μ {t | ¬t ≠ samplingFirstLength b h s} = 0 by simp)] with t ht0 htL + exact samplingTestedFirstWeight_closed_interval b h α E a c s t hh hh1 hα hs ht0 htL + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/Fourier.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/Fourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..65428a1bc2b68b77983ee8862a0b00246bdd7266 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/Fourier.lean @@ -0,0 +1,79 @@ +import OAI.Analysis.FiniteFactor.CrossedProduct.AngleLaw +import OAI.Analysis.FiniteFactor.PeriodizedUniform +import Mathlib.Analysis.SpecialFunctions.Integrals.Basic + +namespace OAI + +namespace FiniteFactor +open MeasureTheory ProbabilityTheory +open scoped ENNReal +noncomputable section + +/-- Direct integral estimate for a real nonzero frequency on an interval. -/ +theorem norm_interval_fourier_le (a b w : ℝ) (hw : w ≠ 0) : + ‖∫ t in a..b, Complex.exp ((w : ℂ) * Complex.I * t)‖ ≤ 2 / |w| := by + rw [integral_exp_mul_complex (mul_ne_zero (Complex.ofReal_ne_zero.mpr hw) Complex.I_ne_zero), + norm_div, norm_mul, Complex.norm_real, Complex.norm_I, mul_one, Real.norm_eq_abs] + apply div_le_div_of_nonneg_right _ (abs_nonneg w) + calc + _ ≤ ‖Complex.exp ((w : ℂ) * Complex.I * b)‖ + + ‖Complex.exp ((w : ℂ) * Complex.I * a)‖ := norm_sub_le _ _ + _ = 2 := by norm_num [Complex.norm_exp, Complex.mul_re, Complex.mul_im] + +/-- The actual normalized angle interval, before reducing phases modulo one. -/ +theorem sourceAngle_fourier_le (i : SourceCoordinate) (w : ℝ) (hw : w ≠ 0) : + ‖∫ t, Complex.exp ((w : ℂ) * Complex.I * t) ∂sourceAngleMarginal i‖ ≤ + 2 / (sourceAngleUnit i * |w|) := by + have ha := sourceAngleUnit_pos i + rw [sourceAngleMarginal, sourceAngleInterval, cond_closed_interval_eq, + ProbabilityTheory.cond, integral_smul_measure, Real.volume_Ioc] + rw [show 2 * sourceAngleUnit i - sourceAngleUnit i = sourceAngleUnit i by ring] + rw [ENNReal.toReal_inv, ENNReal.toReal_ofReal ha.le, norm_smul, + Real.norm_eq_abs, abs_of_pos (inv_pos.mpr ha)] + rw [← intervalIntegral.integral_of_le (show sourceAngleUnit i ≤ 2*sourceAngleUnit i by linarith)] + calc + _ ≤ (sourceAngleUnit i)⁻¹ * (2 / |w|) := + mul_le_mul_of_nonneg_left (norm_interval_fourier_le _ _ w hw) (inv_nonneg.mpr ha.le) + _ = _ := by ring + +/-- Integer frequencies do not see the integer part of a phase. -/ +theorem fourier_fract (v : ℤ) (t : ℝ) : + Complex.exp (2 * Real.pi * Complex.I * ((v : ℂ) * (Int.fract t : ℝ))) = + Complex.exp (2 * Real.pi * Complex.I * ((v : ℂ) * (t : ℂ))) := by + rw [Int.fract] + push_cast + have he : 2 * (Real.pi : ℂ) * Complex.I * ((v : ℂ) * ((t : ℂ) - (⌊t⌋ : ℂ))) = + 2 * Real.pi * Complex.I * ((v : ℂ) * (t : ℂ)) + + ((-(v * ⌊t⌋) : ℤ) : ℂ) * (2 * Real.pi * Complex.I) := by + push_cast + ring + rw [he, Complex.exp_add, Complex.exp_int_mul_two_pi_mul_I, mul_one] + +/-- The two actual phases have the Fourier transform of the combined frequency. -/ +theorem pair_fourier_fract (v v' : ℤ) (n n' t : ℝ) : + Complex.exp (2 * Real.pi * Complex.I * + ((v : ℂ) * (Int.fract (n*t) : ℝ) + (v' : ℂ) * (Int.fract (n'*t) : ℝ))) = + Complex.exp (((2 * Real.pi * ((v : ℝ)*n + (v' : ℝ)*n') : ℝ) : ℂ) * Complex.I * t) := by + rw [mul_add, Complex.exp_add, fourier_fract, fourier_fract, ← Complex.exp_add] + congr 1 + push_cast + ring + +theorem sourceAngle_pair_fourier_le (i : SourceCoordinate) (v v' : ℤ) (n n' : ℝ) + (hw : (v : ℝ)*n + (v' : ℝ)*n' ≠ 0) : + ‖∫ t, Complex.exp (2 * Real.pi * Complex.I * + ((v : ℂ) * (Int.fract (n*t) : ℝ) + (v' : ℂ) * (Int.fract (n'*t) : ℝ))) + ∂sourceAngleMarginal i‖ ≤ + 1 / (Real.pi * sourceAngleUnit i * |(v : ℝ)*n + (v' : ℝ)*n'|) := by + simp_rw [pair_fourier_fract] + have hp := sourceAngle_fourier_le i (2*Real.pi*((v : ℝ)*n+(v' : ℝ)*n')) + (mul_ne_zero (mul_ne_zero (by norm_num) Real.pi_ne_zero) hw) + convert hp using 1 + rw [abs_mul, abs_mul, abs_of_pos Real.pi_pos] + norm_num + ring + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/FourierSum.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/FourierSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc70eb369a9d3462c1917521819403288564f4fa --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/FourierSum.lean @@ -0,0 +1,85 @@ +import OAI.Analysis.FiniteFactor.Sampling.Smoothing +import Mathlib.Algebra.BigOperators.Ring.Finset + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Finset +noncomputable section + +/-- Bounded characters are integrable under every probability law. -/ +theorem samplingCharacter_product_integrable {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X Y : Ω → ℝ) + (hX : Measurable X) (hY : Measurable Y) (v w : ℤ) : + Integrable (fun θ => samplingCharacter v (X θ)*samplingCharacter w (Y θ)) μ := by + apply (integrable_const (1 : ℝ)).mono' + (((samplingCharacter_continuous v).measurable.comp hX).mul + ((samplingCharacter_continuous w).measurable.comp hY)).aestronglyMeasurable + exact Filter.Eventually.of_forall (fun θ => by simp [samplingCharacter_norm]) + +/-- Finite Fourier polynomials require only Fourier bounds on the actual +joint law; the two input phases need not be independent. -/ +theorem samplingFourier_sum_error {Ω α β : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X Y : Ω → ℝ) + (hX : Measurable X) (hY : Measurable Y) + (F : Finset α) (G : Finset β) (v : α → ℤ) (w : β → ℤ) + (A : α → ℂ) (B : β → ℂ) + (hA : ∀ a ∈ F, ‖A a‖ ≤ 1) (hB : ∀ b ∈ G, ‖B b‖ ≤ 1) + (ε : ℝ) (hε : 0 ≤ ε) + (hFourier : ∀ a ∈ F, ∀ b ∈ G, v a ≠ 0 ∨ w b ≠ 0 → + ‖∫ θ, samplingCharacter (v a) (X θ)*samplingCharacter (w b) (Y θ) ∂μ‖ ≤ ε) : + ‖(∫ θ, (∑ a ∈ F, A a*samplingCharacter (v a) (X θ)) * + (∑ b ∈ G, B b*samplingCharacter (w b) (Y θ)) ∂μ) - + (∑ a ∈ F, if v a = 0 then A a else 0) * + (∑ b ∈ G, if w b = 0 then B b else 0)‖ ≤ + (F.card : ℝ)*(G.card : ℝ)*ε := by + classical + let τ := fun a b => ∫ θ, samplingCharacter (v a) (X θ)*samplingCharacter (w b) (Y θ) ∂μ + let d := fun a b => if v a = 0 ∧ w b = 0 then (1 : ℂ) else 0 + have heq (a : α) (b : β) (θ : Ω) : + (A a*samplingCharacter (v a) (X θ))*(B b*samplingCharacter (w b) (Y θ)) = + (A a*B b)*(samplingCharacter (v a) (X θ)*samplingCharacter (w b) (Y θ)) := by ring + have hi (a : α) (b : β) := (samplingCharacter_product_integrable μ X Y hX hY (v a) (w b)).const_mul (A a*B b) + have hmain : (∫ θ, (∑ a ∈ F, A a*samplingCharacter (v a) (X θ)) * + (∑ b ∈ G, B b*samplingCharacter (w b) (Y θ)) ∂μ) = + ∑ a ∈ F, ∑ b ∈ G, A a*B b*τ a b := by + simp_rw [sum_mul_sum, heq] + rw [integral_finsetSum _ (fun a _ => integrable_finsetSum _ (fun b _ => hi a b))] + simp_rw [integral_finsetSum _ (fun b _ => hi _ b), integral_const_mul] + rfl + have hconstant : (∑ a ∈ F, if v a = 0 then A a else 0) * + (∑ b ∈ G, if w b = 0 then B b else 0) = + ∑ a ∈ F, ∑ b ∈ G, A a*B b*d a b := by + rw [sum_mul_sum] + apply sum_congr rfl + intro a ha + apply sum_congr rfl + intro b hb + dsimp [d] + split_ifs <;> simp_all + have hτ (a : α) (ha : a ∈ F) (b : β) (hb : b ∈ G) : ‖τ a b-d a b‖ ≤ ε := by + by_cases hz : v a = 0 ∧ w b = 0 + · simpa [τ,d,hz.1,hz.2,samplingCharacter_zero] using hε + · have hn : v a ≠ 0 ∨ w b ≠ 0 := by tauto + simpa [τ,d,hz] using hFourier a ha b hb hn + rw [hmain,hconstant, ← sum_sub_distrib] + simp_rw [← sum_sub_distrib, ← mul_sub] + calc + _ ≤ ∑ a ∈ F, ‖∑ b ∈ G, A a*B b*(τ a b-d a b)‖ := norm_sum_le _ _ + _ ≤ ∑ a ∈ F, ∑ b ∈ G, ‖A a*B b*(τ a b-d a b)‖ := + sum_le_sum fun a ha => norm_sum_le _ _ + _ ≤ ∑ _a ∈ F, ∑ _b ∈ G, ε := by + apply sum_le_sum + intro a ha + apply sum_le_sum + intro b hb + rw [norm_mul,norm_mul] + calc + _ ≤ 1*1*ε := by gcongr; exact hA a ha; exact hB b hb; exact hτ a ha b hb + _ = ε := by ring + _ = _ := by simp; ring + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/IntegratedCorrelation.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/IntegratedCorrelation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3179a4ee56d3fb7a9382eae654abe547dbf2cc0 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/IntegratedCorrelation.lean @@ -0,0 +1,59 @@ +import OAI.Analysis.FiniteFactor.Sampling.LayerCake + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical +noncomputable section + +/-- Bounded nonnegative products are integrable, uniformly in their parameters. -/ +theorem sampling_bounded_product_integrable {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsFiniteMeasure μ] (f g : Ω → ℝ) (hf : Measurable f) (hg : Measurable g) + (C : ℝ) (hfb : ∀ x, 0 ≤ f x ∧ f x ≤ C) (hgb : ∀ x, 0 ≤ g x ∧ g x ≤ C) : + Integrable (fun x => f x*g x) μ := by + apply sampling_integrable_bounded μ (fun x => f x*g x) (hf.mul hg) (C^2) + intro x + rw [abs_of_nonneg (mul_nonneg (hfb x).1 (hgb x).1)] + calc + f x*g x ≤ C*C := mul_le_mul (hfb x).2 (hgb x).2 (hgb x).1 ((hfb x).1.trans (hfb x).2) + _ = C^2 := by ring + +/-- Integrate the actual pointwise pair error over the marginal coordinate. -/ +theorem sampling_integrated_pair_error {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X Y : Ω → ℝ) + (hX : Measurable X) (hY : Measurable Y) + (u : ℝ → ℝ → ℝ) (hu : Measurable (fun p : ℝ × ℝ => u p.1 p.2)) + (C ε : ℝ) (hb : ∀ s t, 0 ≤ u s t ∧ u s t ≤ C) + (he : ∀ᵐ s ∂unitIntervalMeasure, + |(∫ x, u s (X x)*u s (Y x) ∂μ)-(∫ t, u s t ∂unitIntervalMeasure)^2| ≤ ε) : + |(∫ s, ∫ x, u s (X x)*u s (Y x) ∂μ ∂unitIntervalMeasure)- + (∫ s, (∫ t, u s t ∂unitIntervalMeasure)^2 ∂unitIntervalMeasure)| ≤ ε := by + have hmX : Measurable (fun p : ℝ × Ω => u p.1 (X p.2)) := + hu.comp (measurable_fst.prodMk (hX.comp measurable_snd)) + have hmY : Measurable (fun p : ℝ × Ω => u p.1 (Y p.2)) := + hu.comp (measurable_fst.prodMk (hY.comp measurable_snd)) + have hi := sampling_bounded_product_integrable (unitIntervalMeasure.prod μ) + (fun p => u p.1 (X p.2)) (fun p => u p.1 (Y p.2)) hmX hmY C + (fun p => hb p.1 (X p.2)) (fun p => hb p.1 (Y p.2)) + have hmean (s : ℝ) : 0 ≤ (∫ t, u s t ∂unitIntervalMeasure) ∧ + (∫ t, u s t ∂unitIntervalMeasure) ≤ C := by + have hmi : Integrable (u s) unitIntervalMeasure := sampling_integrable_bounded _ _ + (hu.comp (measurable_const.prodMk measurable_id)) C + (fun t => by rw [abs_of_nonneg (hb s t).1]; exact (hb s t).2) + exact ⟨integral_nonneg (fun t => (hb s t).1),by + simpa using integral_mono_ae hmi (integrable_const C) (Eventually.of_forall (fun t => (hb s t).2))⟩ + have hm : Measurable (fun s => ∫ t, u s t ∂unitIntervalMeasure) := + hu.stronglyMeasurable.integral_prod_right.measurable + have hi₂ : Integrable (fun s => (∫ t, u s t ∂unitIntervalMeasure)^2) unitIntervalMeasure := by + simpa only [pow_two] using sampling_bounded_product_integrable unitIntervalMeasure _ _ hm hm C hmean hmean + rw [← integral_sub hi.integral_prod_left hi₂] + have hbound : ∀ᵐ s ∂unitIntervalMeasure, + ‖(∫ x, u s (X x)*u s (Y x) ∂μ)-(∫ t, u s t ∂unitIntervalMeasure)^2‖ ≤ ε := by + simpa only [Real.norm_eq_abs] using he + simpa [Real.norm_eq_abs,measureReal_def] using norm_integral_le_of_norm_le_const hbound + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/IntervalError.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/IntervalError.lean new file mode 100644 index 0000000000000000000000000000000000000000..f0544207b2b4905499fc9818596bc552b05cd35c --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/IntervalError.lean @@ -0,0 +1,97 @@ +import OAI.Analysis.FiniteFactor.Sampling.Smoothing + +namespace OAI + +namespace FiniteFactor +open MeasureTheory +noncomputable section + +/-- Interval membership cannot change under a displacement smaller than +delta when the starting point is farther than delta from both endpoints. -/ +theorem interval_membership_stable (a b δ t u : ℝ) (_hδ : 0 ≤ δ) + (ha : δ < |t-a|) (hb : δ < |t-b|) (htu : |t-u| < δ) : + u ∈ Set.Icc a b ↔ t ∈ Set.Icc a b := by + have hd := abs_lt.mp htu + constructor + · intro hu + constructor + · by_contra ht + have hh : t-a < 0 := by linarith + rw [abs_of_neg hh] at ha + linarith [hu.1] + · by_contra ht + have hh : 0 < t-b := by linarith + rw [abs_of_pos hh] at hb + linarith [hu.2] + · intro ht + rw [abs_of_nonneg (sub_nonneg.mpr ht.1)] at ha + rw [abs_of_nonpos (sub_nonpos.mpr ht.2)] at hb + constructor <;> linarith + +/-- A separated pair of representatives, with the first away from the cut, +has a fractional displacement outside the kernel's exceptional arc. -/ +theorem fract_displacement_middle (δ t u : ℝ) (hδ : 0 < δ) + (ht : δ ≤ t) (ht' : t ≤ 1-δ) (hu : u ∈ Set.Ico (0 : ℝ) 1) + (hsep : δ ≤ |t-u|) : Int.fract (t-u) ∈ Set.Icc δ (1-δ) := by + by_cases hpos : 0 ≤ t-u + · rw [abs_of_nonneg hpos] at hsep + rw [Int.fract_eq_self.mpr ⟨hpos, by linarith [hu.1]⟩] + constructor <;> linarith [hu.1] + · have hneg : t-u < 0 := lt_of_not_ge hpos + rw [abs_of_neg hneg] at hsep + have hf : ⌊t-u⌋ = (-1 : ℤ) := Int.floor_eq_iff.mpr ⟨by norm_num; linarith [hu.2], by norm_num; linarith⟩ + rw [Int.fract, hf] + norm_num + constructor <;> linarith [hu.2] + +/-- The actual interval convolution differs from its indicator only by +the proved kernel tail, away from interval endpoints and the circle cut. -/ +theorem samplingSmooth_interval_error (H : ℕ) (hH : 0 < H) (a b δ t : ℝ) + (hδ : 0 < δ) (ht : δ ≤ t) (ht' : t ≤ 1-δ) + (ha : δ < |t-a|) (hb : δ < |t-b|) : + |samplingSmooth H (Set.Icc a b) t - (Set.Icc a b).indicator (fun _ => (1 : ℝ)) t| ≤ + 1/(4*(H : ℝ)*δ^2) := by + let E := Set.Icc a b + let K := fun u => samplingKernel H (t-u) + let C := 1/(4*(H : ℝ)*δ^2) + have hC : 0 ≤ C := by dsimp [C]; positivity + have hki : Integrable K unitIntervalMeasure := + ((samplingKernel_continuous H).comp (continuous_const.sub continuous_id)).integrableOn_Icc.mono_set + Set.Ico_subset_Icc_self + have hcut (B : Set ℝ) (hBm : MeasurableSet B) + (hB : ∀ u ∈ B, ¬(u ∈ E ↔ t ∈ E)) : + (∫ u in B, K u ∂unitIntervalMeasure) ≤ C := by + rw [← integral_indicator hBm] + have hle : ∀ᵐ u ∂unitIntervalMeasure, B.indicator K u ≤ C := by + filter_upwards [ae_restrict_mem measurableSet_Ico] with u hu + by_cases hub : u ∈ B + · rw [Set.indicator_of_mem hub] + have hsep : δ ≤ |t-u| := by + by_contra hh + exact hB u hub (interval_membership_stable a b δ t u hδ.le ha hb (lt_of_not_ge hh)) + have hf := fract_displacement_middle δ t u hδ ht ht' hu hsep + dsimp [K,C] + rw [← samplingKernel_fract H (t-u)] + exact samplingKernel_tail_bound H hH δ _ hδ hf.1 hf.2 + · rw [Set.indicator_of_notMem hub] + exact hC + have hh := integral_mono_ae (hki.indicator hBm) (integrable_const C) hle + simpa using hh + have hbounds := samplingSmooth_bounds H hH E t + by_cases hte : t ∈ E + · rw [Set.indicator_of_mem hte, abs_of_nonpos (by linarith [hbounds.2])] + have hh := hcut Eᶜ measurableSet_Icc.compl (fun u hu he => hu (he.mpr hte)) + have hsplit := integral_add_compl (s := E) measurableSet_Icc hki + have hone : (∫ u, K u ∂unitIntervalMeasure) = 1 := samplingKernel_shift_integral H hH t + change (∫ u in E, K u ∂unitIntervalMeasure) + (∫ u in Eᶜ, K u ∂unitIntervalMeasure) = _ at hsplit + change -(samplingSmooth H E t-1) ≤ C + have heq : (∫ u in E, K u ∂unitIntervalMeasure) = samplingSmooth H E t := rfl + rw [hone,heq] at hsplit + linarith + · rw [Set.indicator_of_notMem hte, sub_zero, abs_of_nonneg hbounds.1] + exact hcut E measurableSet_Icc (fun u hu he => hte (he.mp hu)) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/IntervalSums.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/IntervalSums.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9710e317cd5208fc80e32d05e78d40c0efa25ce --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/IntervalSums.lean @@ -0,0 +1,96 @@ +import OAI.Analysis.FiniteFactor.Sampling.LayerDiscrepancy + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical ENNReal +noncomputable section + +def samplingClosedIndicator (a b t : ℝ) : ℝ := + (Set.Icc a b).indicator (fun _ => 1) t + +theorem samplingClosedIndicator_measurable (a b : ℝ) : + Measurable (samplingClosedIndicator a b) := measurable_const.indicator measurableSet_Icc + +theorem samplingClosedIndicator_bounds (a b t : ℝ) : + 0 ≤ samplingClosedIndicator a b t ∧ samplingClosedIndicator a b t ≤ 1 := by + simp only [samplingClosedIndicator,Set.indicator]; split_ifs <;> norm_num + +theorem samplingClosedIndicator_integral (a b : ℝ) : + (∫ t, samplingClosedIndicator a b t ∂unitIntervalMeasure) = + (unitIntervalMeasure (Set.Icc a b)).toReal := by + unfold samplingClosedIndicator + rw [integral_indicator measurableSet_Icc] + simp [measureReal_def] + +theorem samplingClosedIndicator_pair {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X Y : Ω → ℝ) + (hX : Measurable X) (hY : Measurable Y) (a b c d : ℝ) : + (∫ x, samplingClosedIndicator a b (X x)*samplingClosedIndicator c d (Y x) ∂μ) = + (μ {x | X x ∈ Set.Icc a b ∧ Y x ∈ Set.Icc c d}).toReal := by + have hs : MeasurableSet {x | X x ∈ Set.Icc a b ∧ Y x ∈ Set.Icc c d} := + (measurableSet_Icc.preimage hX).inter (measurableSet_Icc.preimage hY) + have he : (fun x => samplingClosedIndicator a b (X x)*samplingClosedIndicator c d (Y x)) = + {x | X x ∈ Set.Icc a b ∧ Y x ∈ Set.Icc c d}.indicator (fun _ => (1 : ℝ)) := by + funext x + simp only [samplingClosedIndicator,Set.indicator,Set.mem_ofPred_eq] + split_ifs <;> simp_all + rw [he,integral_indicator hs] + simp [measureReal_def] + +/-- Two intervals in each variable cost four rectangle discrepancies. -/ +theorem sampling_two_intervals_pair {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X Y : Ω → ℝ) + (hX : Measurable X) (hY : Measurable Y) (δ : ℝ) + (hrect : ∀ a b c d : ℝ, + |(μ {x | X x ∈ Set.Icc a b ∧ Y x ∈ Set.Icc c d}).toReal - + (unitIntervalMeasure (Set.Icc a b)).toReal*(unitIntervalMeasure (Set.Icc c d)).toReal| ≤ δ) + (a b c d : Fin 2 → ℝ) : + |(∫ x, (∑ j, samplingClosedIndicator (a j) (b j) (X x))* + (∑ k, samplingClosedIndicator (c k) (d k) (Y x)) ∂μ) - + (∫ t, ∑ j, samplingClosedIndicator (a j) (b j) t ∂unitIntervalMeasure)* + (∫ t, ∑ k, samplingClosedIndicator (c k) (d k) t ∂unitIntervalMeasure)| ≤ 4*δ := by + let f (j : Fin 2) := samplingClosedIndicator (a j) (b j) + let g (k : Fin 2) := samplingClosedIndicator (c k) (d k) + have hi (j k : Fin 2) : Integrable (fun x => f j (X x)*g k (Y x)) μ := by + apply sampling_integrable_bounded μ _ + (((samplingClosedIndicator_measurable _ _).comp hX).mul + ((samplingClosedIndicator_measurable _ _).comp hY)) 1 + intro x + have h1 := samplingClosedIndicator_bounds (a j) (b j) (X x) + have h2 := samplingClosedIndicator_bounds (c k) (d k) (Y x) + simp only [Pi.mul_apply,Function.comp_apply] + rw [abs_of_nonneg (mul_nonneg h1.1 h2.1)] + nlinarith + have hif (j : Fin 2) : Integrable (f j) unitIntervalMeasure := + integrable_unit_bounded _ _ (samplingClosedIndicator_measurable _ _) (samplingClosedIndicator_bounds _ _) + have hig (k : Fin 2) : Integrable (g k) unitIntervalMeasure := + integrable_unit_bounded _ _ (samplingClosedIndicator_measurable _ _) (samplingClosedIndicator_bounds _ _) + change |(∫ x, (∑ j, f j (X x))*(∑ k, g k (Y x)) ∂μ) - + (∫ t, ∑ j, f j t ∂unitIntervalMeasure)*(∫ t, ∑ k, g k t ∂unitIntervalMeasure)| ≤ _ + simp_rw [Finset.sum_mul,Finset.mul_sum] + rw [integral_finsetSum _ (fun j _ => integrable_finsetSum _ (fun k _ => hi j k))] + simp_rw [integral_finsetSum _ (fun k _ => hi _ k)] + rw [integral_finsetSum _ (fun j _ => hif j),integral_finsetSum _ (fun k _ => hig k)] + simp_rw [Finset.sum_mul,Finset.mul_sum] + rw [← Finset.sum_sub_distrib] + simp_rw [← Finset.sum_sub_distrib] + calc + _ ≤ ∑ j : Fin 2, ∑ k : Fin 2, + |(∫ x, f j (X x)*g k (Y x) ∂μ)- + (∫ t, f j t ∂unitIntervalMeasure)*(∫ t, g k t ∂unitIntervalMeasure)| := + (Finset.abs_sum_le_sum_abs _ _).trans (Finset.sum_le_sum (fun j _ => Finset.abs_sum_le_sum_abs _ _)) + _ ≤ ∑ _j : Fin 2, ∑ _k : Fin 2, δ := by + apply Finset.sum_le_sum + intro j _ + apply Finset.sum_le_sum + intro k _ + simpa only [f,g,samplingClosedIndicator_pair μ X Y hX hY, + samplingClosedIndicator_integral] using hrect (a j) (b j) (c k) (d k) + _ = _ := by simp; ring + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/Kernel.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/Kernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..918c5a102db464e76128e2a8c92c92a172050408 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/Kernel.lean @@ -0,0 +1,104 @@ +import OAI.Analysis.FiniteFactor.Sampling.Fourier +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds +import Mathlib.Algebra.Ring.GeomSum + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Finset +open scoped ComplexConjugate +noncomputable section + +def samplingCharacter (v : ℤ) (t : ℝ) : ℂ := + Complex.exp (2 * Real.pi * Complex.I * v * t) + +theorem samplingCharacter_norm (v : ℤ) (t : ℝ) : ‖samplingCharacter v t‖ = 1 := by + simp [samplingCharacter, Complex.norm_exp, Complex.mul_re, Complex.mul_im] + +theorem samplingCharacter_continuous (v : ℤ) : Continuous (samplingCharacter v) := by + unfold samplingCharacter + fun_prop + +theorem samplingCharacter_zero (t : ℝ) : samplingCharacter 0 t = 1 := by simp [samplingCharacter] + +theorem samplingCharacter_add (v w : ℤ) (t : ℝ) : + samplingCharacter (v+w) t = samplingCharacter v t * samplingCharacter w t := by + unfold samplingCharacter + rw [← Complex.exp_add] + congr 1 + push_cast + ring + +theorem samplingCharacter_neg (v : ℤ) (t : ℝ) : + samplingCharacter (-v) t = conj (samplingCharacter v t) := by + have htwo : conj (2 : ℂ) = 2 := by + change conj ((2 : ℝ) : ℂ) = _ + exact Complex.conj_ofReal _ + simp [samplingCharacter, ← Complex.exp_conj, mul_assoc, htwo] + +theorem samplingCharacter_sub (v w : ℤ) (t : ℝ) : + samplingCharacter (v-w) t = samplingCharacter v t * conj (samplingCharacter w t) := by + rw [sub_eq_add_neg, samplingCharacter_add, samplingCharacter_neg] + +theorem samplingCharacter_integrable (v : ℤ) : + Integrable (samplingCharacter v) unitIntervalMeasure := + (samplingCharacter_continuous v).integrableOn_Icc.mono_set Set.Ico_subset_Icc_self + +theorem samplingCharacter_integral (v : ℤ) : + (∫ t, samplingCharacter v t ∂unitIntervalMeasure) = if v = 0 then 1 else 0 := by + by_cases hv : v = 0 + · subst v; simp [samplingCharacter_zero] + rw [ite_eq_right hv] + unfold unitIntervalMeasure + rw [restrict_Ico_eq_restrict_Ioc, ← intervalIntegral.integral_of_le (by norm_num : (0 : ℝ) ≤ 1)] + change (∫ t in (0 : ℝ)..1, Complex.exp ((2 * Real.pi * Complex.I * (v : ℂ)) * t)) = 0 + have hvC : (v : ℂ) ≠ 0 := by exact_mod_cast hv + have hcoef : 2 * (Real.pi : ℂ) * Complex.I * (v : ℂ) ≠ 0 := + mul_ne_zero (mul_ne_zero (mul_ne_zero (by norm_num) (Complex.ofReal_ne_zero.mpr Real.pi_ne_zero)) + Complex.I_ne_zero) hvC + rw [integral_exp_mul_complex hcoef] + simp only [Complex.ofReal_one, mul_one, Complex.ofReal_zero, mul_zero, Complex.exp_zero] + rw [show 2 * (Real.pi : ℂ) * Complex.I * (v : ℂ) = (v : ℂ)*(2*Real.pi*Complex.I) by ring, + Complex.exp_int_mul_two_pi_mul_I] + simp + +/-- The finite Fejer kernel, as a nonnegative real function. -/ +def samplingKernel (H : ℕ) (t : ℝ) : ℝ := + ‖∑ r ∈ Finset.range H, samplingCharacter (r : ℤ) t‖^2 / (H : ℝ) + +theorem samplingKernel_nonneg (H : ℕ) (t : ℝ) : 0 ≤ samplingKernel H t := by + unfold samplingKernel + positivity + +theorem samplingKernel_continuous (H : ℕ) : Continuous (samplingKernel H) := by + unfold samplingKernel + apply Continuous.div_const + apply Continuous.pow + apply Continuous.norm + exact continuous_finsetSum _ (fun r _ => samplingCharacter_continuous _) + +theorem samplingKernel_expansion (H : ℕ) (t : ℝ) : + (samplingKernel H t : ℂ) = (H : ℂ)⁻¹ * + ∑ r ∈ Finset.range H, ∑ q ∈ Finset.range H, samplingCharacter ((r : ℤ)-(q : ℤ)) t := by + simp only [samplingKernel, Complex.ofReal_div, Complex.ofReal_pow, Complex.ofReal_natCast, + samplingCharacter_sub, ← Finset.mul_sum, ← Finset.sum_mul, ← map_sum] + rw [← Complex.ofReal_pow, Complex.sq_norm, Complex.mul_conj] + ring + +theorem samplingKernel_integral (H : ℕ) (hH : 0 < H) : + (∫ t, samplingKernel H t ∂unitIntervalMeasure) = 1 := by + have hki : Integrable (samplingKernel H) unitIntervalMeasure := + (samplingKernel_continuous H).integrableOn_Icc.mono_set Set.Ico_subset_Icc_self + have hc : (∫ t, (samplingKernel H t : ℂ) ∂unitIntervalMeasure) = 1 := by + simp_rw [samplingKernel_expansion] + rw [integral_const_mul, integral_finsetSum _ (fun r _ => + integrable_finsetSum _ (fun q _ => samplingCharacter_integrable _))] + simp_rw [integral_finsetSum _ (fun q _ => samplingCharacter_integrable _), samplingCharacter_integral] + simp [sub_eq_zero, -Finset.mem_range, hH.ne'] + rw [integral_complex_ofReal] at hc + exact_mod_cast hc + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/KernelTail.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/KernelTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..35da04cb357fd3833b3f2af247718ef5bb94e510 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/KernelTail.lean @@ -0,0 +1,96 @@ +import OAI.Analysis.FiniteFactor.Sampling.Kernel + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Finset +noncomputable section + +theorem samplingCharacter_nat (r : ℕ) (t : ℝ) : + samplingCharacter (r : ℤ) t = samplingCharacter 1 t ^ r := by + induction r with + | zero => simp [samplingCharacter_zero] + | succ r ih => + rw [Nat.cast_add, Nat.cast_one, samplingCharacter_add, ih, pow_succ] + +/-- Geometric-sum cancellation controls the kernel away from the origin. -/ +theorem samplingKernel_geometric_bound (H : ℕ) (t : ℝ) : + ‖∑ r ∈ Finset.range H, samplingCharacter (r : ℤ) t‖ * + ‖samplingCharacter 1 t - 1‖ ≤ 2 := by + simp_rw [samplingCharacter_nat] + rw [← norm_mul, geom_sum_mul] + calc + _ ≤ ‖samplingCharacter 1 t ^ H‖ + ‖(1 : ℂ)‖ := norm_sub_le _ _ + _ = _ := by norm_num [norm_pow, samplingCharacter_norm] + +/-- Elementary chord lower bound, including both halves of the unit interval. -/ +theorem samplingCharacter_chord_lower (δ t : ℝ) (hδ : 0 ≤ δ) + (ht : δ ≤ t) (ht' : t ≤ 1-δ) : + 4*δ ≤ ‖samplingCharacter 1 t-1‖ := by + have he : samplingCharacter 1 t = Complex.exp (Complex.I * ((2*Real.pi*t : ℝ) : ℂ)) := by + unfold samplingCharacter + congr 1 + push_cast + ring + rw [he, Complex.norm_exp_I_mul_ofReal_sub_one] + have harg : 2*Real.pi*t/2 = Real.pi*t := by ring + rw [harg, Real.norm_eq_abs, abs_mul, show |(2 : ℝ)| = 2 by norm_num] + have hsin : 2*δ ≤ Real.sin (Real.pi*t) := by + by_cases hhalf : t ≤ 1/2 + · have ht0 : 0 ≤ t := hδ.trans ht + have hh := Real.mul_le_sin (x := Real.pi*t) (by positivity) + (by nlinarith [Real.pi_pos]) + have he : 2/Real.pi*(Real.pi*t) = 2*t := by field_simp + rw [he] at hh + linarith + · have ht0 : 0 ≤ 1-t := by linarith + have hh := Real.mul_le_sin (x := Real.pi*(1-t)) (by positivity) + (by nlinarith [Real.pi_pos]) + have he : 2/Real.pi*(Real.pi*(1-t)) = 2*(1-t) := by field_simp + rw [he, show Real.pi*(1-t) = Real.pi-Real.pi*t by ring, Real.sin_pi_sub] at hh + linarith + have := le_abs_self (Real.sin (Real.pi*t)) + linarith + +theorem samplingKernel_tail_bound (H : ℕ) (hH : 0 < H) (δ t : ℝ) + (hδ : 0 < δ) (ht : δ ≤ t) (ht' : t ≤ 1-δ) : + samplingKernel H t ≤ 1/(4*(H : ℝ)*δ^2) := by + have hc := samplingCharacter_chord_lower δ t hδ.le ht ht' + have hg := samplingKernel_geometric_bound H t + let A := ‖∑ r ∈ Finset.range H, samplingCharacter (r : ℤ) t‖ + have hA : 0 ≤ A := norm_nonneg _ + have hbound : A ≤ 1/(2*δ) := by + apply (le_div_iff₀ (by positivity : 0 < 2*δ)).mpr + have hh := mul_le_mul_of_nonneg_left hc hA + dsimp [A] at * + nlinarith + have hsq := pow_le_pow_left₀ hA hbound 2 + have hHR : 0 < (H : ℝ) := by exact_mod_cast hH + unfold samplingKernel + calc + _ ≤ (1/(2*δ))^2/(H : ℝ) := div_le_div_of_nonneg_right hsq hHR.le + _ = _ := by ring + +/-- Actual mass of the part of the Fejer kernel outside a delta-neighborhood +of the integer cut. -/ +theorem samplingKernel_tail_integral (H : ℕ) (hH : 0 < H) (δ : ℝ) (hδ : 0 < δ) : + (∫ t in Set.Icc δ (1-δ), samplingKernel H t ∂unitIntervalMeasure) ≤ + 1/(4*(H : ℝ)*δ^2) := by + have hki : Integrable (samplingKernel H) unitIntervalMeasure := + (samplingKernel_continuous H).integrableOn_Icc.mono_set Set.Ico_subset_Icc_self + rw [← integral_indicator measurableSet_Icc] + have hle : ∀ t, (Set.Icc δ (1-δ)).indicator (samplingKernel H) t ≤ 1/(4*(H : ℝ)*δ^2) := by + intro t + by_cases ht : t ∈ Set.Icc δ (1-δ) + · rw [Set.indicator_of_mem ht] + exact samplingKernel_tail_bound H hH δ t hδ ht.1 ht.2 + · rw [Set.indicator_of_notMem ht] + positivity + have hh := integral_mono_ae (hki.indicator measurableSet_Icc) (integrable_const (1/(4*(H : ℝ)*δ^2))) + (Filter.Eventually.of_forall hle) + simpa using hh + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/LayerCake.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/LayerCake.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d28f5f358f594722a8a1e05ee9afc9b02ce5756 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/LayerCake.lean @@ -0,0 +1,78 @@ +import OAI.Analysis.FiniteFactor.Sampling.Rectangle +import Mathlib.MeasureTheory.Integral.Layercake + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical ENNReal +noncomputable section + +/-- A bounded measurable real function on a finite measure space is integrable. -/ +theorem sampling_integrable_bounded {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsFiniteMeasure μ] (f : Ω → ℝ) (hf : Measurable f) + (C : ℝ) (hb : ∀ x, |f x| ≤ C) : Integrable f μ := by + apply (integrable_const C).mono' hf.aestronglyMeasurable + exact Eventually.of_forall (fun x => by simpa [Real.norm_eq_abs] using hb x) + +/-- Finite layer-cake formula for a product, valid even for a singular joint law. -/ +theorem sampling_product_layerCake {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsFiniteMeasure μ] (f g : Ω → ℝ) + (hf : Measurable f) (hg : Measurable g) (C : ℝ) (_hC : 0 ≤ C) + (hfb : ∀ x, 0 ≤ f x ∧ f x ≤ C) (hgb : ∀ x, 0 ≤ g x ∧ g x ≤ C) : + (∫ x, f x*g x ∂μ) = + ∫ r in Set.Ioc 0 C, ∫ t in Set.Ioc 0 C, + (μ {x | r ≤ f x ∧ t ≤ g x}).toReal := by + let ν := volume.restrict (Set.Ioc 0 C) + let K : (ℝ × ℝ) × Ω → ℝ := fun p => + if p.1.1 ≤ f p.2 ∧ p.1.2 ≤ g p.2 then 1 else 0 + have hK : Measurable K := measurable_const.ite + ((measurableSet_le measurable_fst.fst (hf.comp measurable_snd)).inter + (measurableSet_le measurable_fst.snd (hg.comp measurable_snd))) measurable_const + have hKb (p) : |K p| ≤ 1 := by dsimp [K]; split_ifs <;> norm_num + have hKi := sampling_integrable_bounded ((ν.prod ν).prod μ) K hK 1 hKb + have hpoint (x : Ω) : (∫ p, K (p,x) ∂ν.prod ν) = f x*g x := by + have hik : Integrable (fun p => K (p,x)) (ν.prod ν) := + sampling_integrable_bounded (ν.prod ν) _ + (hK.comp (measurable_id.prodMk measurable_const)) 1 (fun p => hKb (p,x)) + rw [integral_prod _ hik] + have he (r t : ℝ) : K ((r,t),x) = + (Set.Iic (f x)).indicator (fun _ => (1 : ℝ)) r * + (Set.Iic (g x)).indicator (fun _ => (1 : ℝ)) t := by + simp only [K,Set.indicator,Set.mem_Iic]; split_ifs <;> simp_all + simp_rw [he,integral_const_mul,integral_mul_const] + have hv (a : ℝ) (ha : 0 ≤ a ∧ a ≤ C) : + (∫ r, (Set.Iic a).indicator (fun _ => (1 : ℝ)) r ∂ν) = a := by + rw [integral_indicator measurableSet_Iic] + simp only [integral_const,smul_eq_mul,mul_one,measureReal_def] + dsimp [ν] + rw [Measure.restrict_apply MeasurableSet.univ,Set.univ_inter, + Measure.restrict_apply measurableSet_Iic] + have he : Set.Iic a ∩ Set.Ioc 0 C = Set.Ioc 0 a := by + ext r; simp only [Set.mem_inter_iff,Set.mem_Iic,Set.mem_Ioc] + constructor + · intro h; exact ⟨h.2.1,h.1⟩ + · intro h; exact ⟨h.2,h.1,h.2.trans ha.2⟩ + rw [he,Real.volume_Ioc,sub_zero,ENNReal.toReal_ofReal ha.1] + rw [hv _ (hfb x),hv _ (hgb x)] + calc + _ = ∫ x, ∫ p, K (p,x) ∂ν.prod ν ∂μ := by simp_rw [hpoint] + _ = ∫ p, ∫ x, K (p,x) ∂μ ∂ν.prod ν := (integral_integral_swap hKi).symm + _ = ∫ r, ∫ t, ∫ x, K ((r,t),x) ∂μ ∂ν ∂ν := + integral_prod _ hKi.integral_prod_left + _ = _ := by + apply integral_congr_ae + filter_upwards [] with r + apply integral_congr_ae + filter_upwards [] with t + have he : (fun x => K ((r,t),x)) = + {x | r ≤ f x ∧ t ≤ g x}.indicator (fun _ => (1 : ℝ)) := by funext x; simp [K,Set.indicator] + have hm : MeasurableSet {x | r ≤ f x ∧ t ≤ g x} := + (measurableSet_le measurable_const hf).inter (measurableSet_le measurable_const hg) + rw [he,integral_indicator hm] + simp [measureReal_def] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/LayerDiscrepancy.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/LayerDiscrepancy.lean new file mode 100644 index 0000000000000000000000000000000000000000..f353ec2dff501f6d273369d279be65fadf403985 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/LayerDiscrepancy.lean @@ -0,0 +1,78 @@ +import OAI.Analysis.FiniteFactor.Sampling.LayerCake + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical ENNReal +noncomputable section + +theorem sampling_measureReal_le_one {α : Type*} [MeasurableSpace α] (ρ : Measure α) [IsProbabilityMeasure ρ] + (S : Set α) : |(ρ S).toReal| ≤ 1 := by + rw [abs_of_nonneg ENNReal.toReal_nonneg] + calc + _ ≤ (ρ Set.univ).toReal := ENNReal.toReal_mono (measure_ne_top _ _) (measure_mono (Set.subset_univ S)) + _ = 1 := by simp + +/-- Joint superlevel probabilities are measurable in both thresholds. -/ +theorem sampling_levelMass_measurable {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsFiniteMeasure μ] (f g : Ω → ℝ) + (hf : Measurable f) (hg : Measurable g) : + Measurable (fun p : ℝ × ℝ => (μ {x | p.1 ≤ f x ∧ p.2 ≤ g x}).toReal) := by + let K : (ℝ × ℝ) × Ω → ℝ := fun p => + if p.1.1 ≤ f p.2 ∧ p.1.2 ≤ g p.2 then 1 else 0 + have hK : Measurable K := measurable_const.ite + ((measurableSet_le measurable_fst.fst (hf.comp measurable_snd)).inter + (measurableSet_le measurable_fst.snd (hg.comp measurable_snd))) measurable_const + have he (p : ℝ × ℝ) : (∫ x, K (p,x) ∂μ) = + (μ {x | p.1 ≤ f x ∧ p.2 ≤ g x}).toReal := by + have hs : MeasurableSet {x | p.1 ≤ f x ∧ p.2 ≤ g x} := + (measurableSet_le measurable_const hf).inter (measurableSet_le measurable_const hg) + have hk : (fun x => K (p,x)) = + {x | p.1 ≤ f x ∧ p.2 ≤ g x}.indicator (fun _ => (1 : ℝ)) := by + funext x; simp [K,Set.indicator] + rw [hk,integral_indicator hs] + simp [measureReal_def] + have hKm : StronglyMeasurable (Function.uncurry (fun p x => K (p,x))) := hK.stronglyMeasurable + simpa only [he] using (hKm.integral_prod_right (ν := μ)).measurable + +/-- Uniform superlevel discrepancy controls weighted pair integrals. The +threshold square has area C^2; no density for the joint law is needed. -/ +theorem sampling_layer_discrepancy {Ω Ψ : Type*} [MeasurableSpace Ω] [MeasurableSpace Ψ] + (μ : Measure Ω) (ν : Measure Ψ) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] + (f g : Ω → ℝ) (f₀ g₀ : Ψ → ℝ) + (hf : Measurable f) (hg : Measurable g) (hf₀ : Measurable f₀) (hg₀ : Measurable g₀) + (C δ : ℝ) (hC : 0 ≤ C) + (hfb : ∀ x, 0 ≤ f x ∧ f x ≤ C) (hgb : ∀ x, 0 ≤ g x ∧ g x ≤ C) + (hf₀b : ∀ x, 0 ≤ f₀ x ∧ f₀ x ≤ C) (hg₀b : ∀ x, 0 ≤ g₀ x ∧ g₀ x ≤ C) + (hlevel : ∀ r t : ℝ, 0 < r → r ≤ C → 0 < t → t ≤ C → + |(μ {x | r ≤ f x ∧ t ≤ g x}).toReal - + (ν {x | r ≤ f₀ x ∧ t ≤ g₀ x}).toReal| ≤ δ) : + |(∫ x, f x*g x ∂μ)-(∫ x, f₀ x*g₀ x ∂ν)| ≤ δ*C^2 := by + let τ := volume.restrict (Set.Ioc 0 C) + let F : ℝ × ℝ → ℝ := fun p => (μ {x | p.1 ≤ f x ∧ p.2 ≤ g x}).toReal + let G : ℝ × ℝ → ℝ := fun p => (ν {x | p.1 ≤ f₀ x ∧ p.2 ≤ g₀ x}).toReal + have hFm : Measurable F := sampling_levelMass_measurable μ f g hf hg + have hGm : Measurable G := sampling_levelMass_measurable ν f₀ g₀ hf₀ hg₀ + have hFi := sampling_integrable_bounded (τ.prod τ) F hFm 1 (fun p => by dsimp [F]; exact sampling_measureReal_le_one μ _) + have hGi := sampling_integrable_bounded (τ.prod τ) G hGm 1 (fun p => by dsimp [G]; exact sampling_measureReal_le_one ν _) + rw [sampling_product_layerCake μ f g hf hg C hC hfb hgb, + sampling_product_layerCake ν f₀ g₀ hf₀ hg₀ C hC hf₀b hg₀b] + change |(∫ r, ∫ t, F (r,t) ∂τ ∂τ)-(∫ r, ∫ t, G (r,t) ∂τ ∂τ)| ≤ _ + rw [← integral_prod F hFi,← integral_prod G hGi,← integral_sub hFi hGi] + have hb : ∀ᵐ p ∂τ.prod τ, ‖F p-G p‖ ≤ δ := by + apply (Measure.ae_prod_iff_ae_ae (show MeasurableSet {p : ℝ × ℝ | ‖F p-G p‖ ≤ δ} from + measurableSet_le (hFm.sub hGm).norm measurable_const)).mpr + filter_upwards [self_mem_ae_restrict measurableSet_Ioc] with r hr + filter_upwards [self_mem_ae_restrict measurableSet_Ioc] with t ht + simpa [Real.norm_eq_abs,F,G] using hlevel r t hr.1 hr.2 ht.1 ht.2 + have hi := norm_integral_le_of_norm_le_const hb + have hm : (τ.prod τ).real Set.univ = C^2 := by + rw [measureReal_def,← Set.univ_prod_univ,Measure.prod_prod,ENNReal.toReal_mul] + simp [τ,Real.volume_Ioc,ENNReal.toReal_ofReal hC,pow_two] + simpa only [Real.norm_eq_abs,hm,mul_comm] using hi + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/MixedCorrelation.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/MixedCorrelation.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c9dbf06a8ae4f56d4c80f954713b6eee445f253 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/MixedCorrelation.lean @@ -0,0 +1,64 @@ +import OAI.Analysis.FiniteFactor.Sampling.IntegratedCorrelation + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical +noncomputable section + +/-- A bounded nonnegative coordinate kernel has a measurable bounded mean. -/ +theorem sampling_kernel_mean {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (u : ℝ → Ω → ℝ) + (hu : Measurable (fun p : ℝ × Ω => u p.1 p.2)) (C : ℝ) + (hb : ∀ s t, 0 ≤ u s t ∧ u s t ≤ C) : + Measurable (fun s => ∫ t, u s t ∂μ) ∧ + ∀ s, 0 ≤ (∫ t, u s t ∂μ) ∧ (∫ t, u s t ∂μ) ≤ C := by + refine ⟨hu.stronglyMeasurable.integral_prod_right.measurable,?_⟩ + intro s + have hi : Integrable (u s) μ := sampling_integrable_bounded μ _ + (hu.comp (measurable_const.prodMk measurable_id)) C + (fun t => by rw [abs_of_nonneg (hb s t).1]; exact (hb s t).2) + exact ⟨integral_nonneg (fun t => (hb s t).1),by + simpa using integral_mono_ae hi (integrable_const C) (Eventually.of_forall (fun t => (hb s t).2))⟩ + +/-- The mixed coordinate factor inherits a relative one-phase error. +The ideal moment may vanish; no division by it occurs. -/ +theorem sampling_integrated_mixed_error {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X : Ω → ℝ) (hX : Measurable X) + (u : ℝ → ℝ → ℝ) (hu : Measurable (fun p : ℝ × ℝ => u p.1 p.2)) + (C ε : ℝ) (hb : ∀ s t, 0 ≤ u s t ∧ u s t ≤ C) + (he : ∀ s, |(∫ x, u s (X x) ∂μ)-(∫ t, u s t ∂unitIntervalMeasure)| ≤ + ε*(∫ t, u s t ∂unitIntervalMeasure)) : + |(∫ s, (∫ t, u s t ∂unitIntervalMeasure)*(∫ x, u s (X x) ∂μ) ∂unitIntervalMeasure)- + (∫ s, (∫ t, u s t ∂unitIntervalMeasure)^2 ∂unitIntervalMeasure)| ≤ + ε*(∫ s, (∫ t, u s t ∂unitIntervalMeasure)^2 ∂unitIntervalMeasure) := by + let a := fun s => ∫ t, u s t ∂unitIntervalMeasure + let b := fun s => ∫ x, u s (X x) ∂μ + have ha := sampling_kernel_mean unitIntervalMeasure u hu C hb + have hbu : Measurable (fun p : ℝ × Ω => u p.1 (X p.2)) := + hu.comp (measurable_fst.prodMk (hX.comp measurable_snd)) + have hbb := sampling_kernel_mean μ (fun s x => u s (X x)) hbu C (fun s x => hb s (X x)) + have hai : Integrable (fun s => a s^2) unitIntervalMeasure := by + simpa only [pow_two] using sampling_bounded_product_integrable unitIntervalMeasure a a ha.1 ha.1 C ha.2 ha.2 + have habi := sampling_bounded_product_integrable unitIntervalMeasure a b ha.1 hbb.1 C ha.2 hbb.2 + change |(∫ s, a s*b s ∂unitIntervalMeasure)-(∫ s, a s^2 ∂unitIntervalMeasure)| ≤ + ε*(∫ s, a s^2 ∂unitIntervalMeasure) + rw [← integral_sub habi hai,← integral_const_mul] + apply (show |(∫ s, a s*b s-a s^2 ∂unitIntervalMeasure)| ≤ + ∫ s, ε*a s^2 ∂unitIntervalMeasure from ?_) + rw [← Real.norm_eq_abs] + apply norm_integral_le_of_norm_le (hai.const_mul ε) + apply Eventually.of_forall + intro s + rw [Real.norm_eq_abs] + calc + |a s*b s-a s^2| = a s*|b s-a s| := by + rw [show a s*b s-a s^2 = a s*(b s-a s) by ring,abs_mul,abs_of_nonneg (ha.2 s).1] + _ ≤ a s*(ε*a s) := mul_le_mul_of_nonneg_left (he s) (ha.2 s).1 + _ = ε*a s^2 := by ring + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/OrientedMoments.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/OrientedMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca001a818023d462ca4ce138b294f22aefa18941 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/OrientedMoments.lean @@ -0,0 +1,110 @@ +import OAI.Analysis.FiniteFactor.Sampling.TestedSelfMoment +import OAI.Analysis.FiniteFactor.OrbitSampling.Moments + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +noncomputable section + +/-- Both source orientations and both coordinate types, with exact x/y tests. -/ +def samplingOrientedWeight (second triangular : Bool) (h α : ℝ) (E G : Set ℝ) (s t : ℝ) : ℝ := by + classical + exact if second then + if Int.fract (s-t) ∈ E ∧ s ∈ G then samplingWeight triangular h α (Int.fract (s-t)) t else 0 + else samplingTestedFirstWeight triangular h α E G s t + +def samplingOrientedDensity (second triangular : Bool) (h α : ℝ) (E G : Set ℝ) (s : ℝ) : ℝ := + ∫ t, samplingOrientedWeight second triangular h α E G s t ∂unitIntervalMeasure + +theorem samplingOrientedWeight_measurable (r b : Bool) (h α : ℝ) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + Measurable (fun p : ℝ × ℝ => samplingOrientedWeight r b h α E G p.1 p.2) := by + cases r + · exact samplingTestedFirstWeight_measurable b h α E G hE hG + · unfold samplingOrientedWeight + simp only [ite_true] + exact Measurable.ite ((hE.preimage (sourceFract_measurable.comp + (measurable_fst.sub measurable_snd))).inter (hG.preimage measurable_fst)) + ((samplingWeight_measurable b h α).comp + ((sourceFract_measurable.comp (measurable_fst.sub measurable_snd)).prodMk measurable_snd)) measurable_const + +theorem samplingOrientedWeight_bounds (r b : Bool) (h α : ℝ) (E G : Set ℝ) + (hh : 0 < h) (hα : 0 < α) (s t : ℝ) : + 0 ≤ samplingOrientedWeight r b h α E G s t ∧ + samplingOrientedWeight r b h α E G s t ≤ max 1 (1/(h*α)) := by + cases r + · exact ⟨(samplingTestedFirstWeight_bounds b h α E G s t hh hα).1, + (samplingTestedFirstWeight_bounds b h α E G s t hh hα).2.trans + (samplingWeight_bounds b h α s t hh hα).2⟩ + · unfold samplingOrientedWeight + simp only [ite_true] + split_ifs + · exact samplingWeight_bounds b h α _ _ hh hα + · exact ⟨le_rfl,(by norm_num : (0 : ℝ) ≤ 1).trans (le_max_left _ _)⟩ + +theorem samplingOrientedWeight_triangular_bounds (r : Bool) (h α : ℝ) (E G : Set ℝ) (s t : ℝ) : + 0 ≤ samplingOrientedWeight r true h α E G s t ∧ + samplingOrientedWeight r true h α E G s t ≤ 1 := by + cases r <;> unfold samplingOrientedWeight samplingTestedFirstWeight samplingWeight <;> + simp only [Bool.false_eq_true,ite_false,ite_true] <;> split_ifs <;> norm_num + +theorem samplingOrientedDensity_measurable (r b : Bool) (h α : ℝ) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + Measurable (samplingOrientedDensity r b h α E G) := + (samplingOrientedWeight_measurable r b h α E G hE hG).stronglyMeasurable.integral_prod_right.measurable + +/-- Both triangular orientations have tested marginal densities between zero and one. -/ +theorem samplingOrientedDensity_triangular_bounds (r : Bool) (h α : ℝ) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) (s : ℝ) : + 0 ≤ samplingOrientedDensity r true h α E G s ∧ + samplingOrientedDensity r true h α E G s ≤ 1 := by + have hm : Measurable (samplingOrientedWeight r true h α E G s) := + (samplingOrientedWeight_measurable r true h α E G hE hG).comp (measurable_const.prodMk measurable_id) + have hi : Integrable (samplingOrientedWeight r true h α E G s) unitIntervalMeasure := + (integrable_const (1 : ℝ)).mono' hm.aestronglyMeasurable (Eventually.of_forall (fun t => by + rw [Real.norm_eq_abs,abs_of_nonneg (samplingOrientedWeight_triangular_bounds r h α E G s t).1] + exact (samplingOrientedWeight_triangular_bounds r h α E G s t).2)) + refine ⟨integral_nonneg (fun t => (samplingOrientedWeight_triangular_bounds r h α E G s t).1),?_⟩ + simpa [samplingOrientedDensity] using integral_mono_ae hi (integrable_const (1 : ℝ)) + (Eventually.of_forall (fun t => (samplingOrientedWeight_triangular_bounds r h α E G s t).2)) + +theorem samplingOrientedDensity_triangular_square (r : Bool) (h α : ℝ) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + (∫ s, samplingOrientedDensity r true h α E G s ^ 2 ∂unitIntervalMeasure) ≤ 1 := by + have hb := samplingOrientedDensity_triangular_bounds r h α E G hE hG + have hi := sampling_square_integrable unitIntervalMeasure _ 1 + (samplingOrientedDensity_measurable r true h α E G hE hG) hb + simpa [samplingOrientedDensity] using integral_mono_ae hi (integrable_const (1 : ℝ)) + (Eventually.of_forall (fun s => show samplingOrientedDensity r true h α E G s ^ 2 ≤ 1 by + nlinarith [(hb s).1,(hb s).2])) + +theorem sourceSampling_oriented_moment (stage : ℕ) (r b : Bool) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + (∀ᵐ s ∂unitIntervalMeasure, + 0 ≤ samplingOrientedDensity r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E G s ∧ + samplingOrientedDensity r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E G s ≤ 2) ∧ + (∫ s, samplingOrientedDensity r b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E G s ^ 2 + ∂unitIntervalMeasure) ≤ 1+4*(sourceBlockSize stage : ℝ)^(-6/5 : ℝ) := by + have hp := sourceSampling_parameters stage + have herr : (0 : ℝ) ≤ 4*(sourceBlockSize stage : ℝ)^(-6/5 : ℝ) := by positivity + cases r + · have hb : ∀ᵐ s ∂unitIntervalMeasure, + 0 ≤ samplingTestedFirstDensity b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E G s ∧ + samplingTestedFirstDensity b (sourceSamplingWidth stage) (sourceSamplingCutoff stage) E G s ≤ 1 := + (ae_restrict_mem measurableSet_Ico).mono (fun s hs => samplingTestedFirstDensity_bounds b _ _ E G + hp.1 hp.2.1 hp.2.2 hE hG s hs) + refine ⟨hb.mono (fun s hs => ⟨hs.1,hs.2.trans (by norm_num)⟩),?_⟩ + exact (samplingTestedFirstDensity_square b _ _ E G hp.1 hp.2.1 hp.2.2 hE hG).trans (by linarith) + · cases b + · exact sourceSampling_tested_second_moment stage E G hE hG + · refine ⟨Eventually.of_forall (fun s => ?_),?_⟩ + · have hb := samplingOrientedDensity_triangular_bounds true (sourceSamplingWidth stage) + (sourceSamplingCutoff stage) E G hE hG s + exact ⟨hb.1,hb.2.trans (by norm_num)⟩ + · exact (samplingOrientedDensity_triangular_square true _ _ E G hE hG).trans (by linarith) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/Periodization.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/Periodization.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b6ad416495bf89e85c6ded5ba065f95c8f66a4e --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/Periodization.lean @@ -0,0 +1,103 @@ +import OAI.Analysis.FiniteFactor.PeriodizedUniform +import OAI.Analysis.FiniteFactor.CrossedProduct.AngleLaw +import Mathlib.MeasureTheory.Integral.Bochner.Basic + +namespace OAI + +namespace FiniteFactor +open MeasureTheory ProbabilityTheory +open scoped ENNReal +noncomputable section + +/-- Lower counterpart to periodized interval domination; the floor-length +subinterval contributes exact Haar measure. -/ +theorem fract_interval_lower (a b : ℝ) (hab : a < b) : + ENNReal.ofReal (1-1/(b-a)) • unitIntervalMeasure ≤ + (cond volume (Set.Ioc a b)).map Int.fract := by + let n : ℕ := Nat.floor (b-a) + have hpos : 0 < b-a := sub_pos.mpr hab + have hsub : Set.Ioc a (a+n) ⊆ Set.Ioc a b := by + apply Set.Ioc_subset_Ioc le_rfl + have hh : (n : ℝ) ≤ b-a := Nat.floor_le hpos.le + linarith + have hle : (n : ℝ≥0∞) • unitIntervalMeasure ≤ + (volume.restrict (Set.Ioc a b)).map Int.fract := by + rw [← fract_integer_interval a n] + exact Measure.map_mono (Measure.restrict_mono hsub le_rfl) sourceFract_measurable + have hscalar : ENNReal.ofReal (1-1/(b-a)) ≤ + (ENNReal.ofReal (b-a))⁻¹ * (n : ℝ≥0∞) := by + have hn : b-a < (n : ℝ)+1 := Nat.lt_floor_add_one (b-a) + have hreal : 1-1/(b-a) ≤ (b-a)⁻¹ * (n : ℝ) := by + apply (le_inv_mul_iff₀ hpos).mpr + field_simp + linarith + rw [← ENNReal.ofReal_inv_of_pos hpos, ← ENNReal.ofReal_natCast, + ← ENNReal.ofReal_mul (inv_nonneg.mpr hpos.le)] + exact ENNReal.ofReal_le_ofReal hreal + unfold ProbabilityTheory.cond + rw [Measure.map_smul _ sourceFract_measurable.aemeasurable, Real.volume_Ioc] + calc + _ ≤ ((ENNReal.ofReal (b-a))⁻¹ * (n : ℝ≥0∞)) • unitIntervalMeasure := by gcongr + _ = (ENNReal.ofReal (b-a))⁻¹ • ((n : ℝ≥0∞) • unitIntervalMeasure) := + (smul_smul _ _ _).symm + _ ≤ _ := by gcongr + +/-- Two-sided near-uniformity for the actual single-phase law, on every +Borel set. The error is exactly 1/(n times the source interval length). -/ +theorem sourceAngle_phase_sandwich (i : SourceCoordinate) (n : ℝ) (hn : 0 < n) : + ENNReal.ofReal (1-1/(n*sourceAngleUnit i)) • unitIntervalMeasure ≤ + (sourceAngleMarginal i).map (fun t => Int.fract (n*t)) ∧ + (sourceAngleMarginal i).map (fun t => Int.fract (n*t)) ≤ + ENNReal.ofReal (1+1/(n*sourceAngleUnit i)) • unitIntervalMeasure := by + have ha := sourceAngleUnit_pos i + have he : (sourceAngleMarginal i).map (fun t => Int.fract (n*t)) = + (cond volume (Set.Ioc (n*sourceAngleUnit i) (n*(2*sourceAngleUnit i)))).map Int.fract := by + rw [← cond_interval_mul_pos (sourceAngleUnit i) (2*sourceAngleUnit i) n (by linarith) hn, + Measure.map_map sourceFract_measurable (by fun_prop)] + rw [sourceAngleMarginal, sourceAngleInterval, cond_closed_interval_eq] + rfl + rw [he] + have hpos : n*sourceAngleUnit i < n*(2*sourceAngleUnit i) := by nlinarith + have hlen : n*(2*sourceAngleUnit i)-n*sourceAngleUnit i = n*sourceAngleUnit i := by ring + constructor + · simpa only [hlen] using fract_interval_lower _ _ hpos + · simpa only [hlen] using fract_interval_domination _ _ hpos + +/-- Nonnegative tests inherit the exact relative error from a measure sandwich. -/ +theorem integral_error_of_measure_sandwich {α : Type*} [MeasurableSpace α] + (μ ν : Measure α) (ε : ℝ) (hε : 0 ≤ ε) (hε1 : ε ≤ 1) + (hlo : ENNReal.ofReal (1-ε) • μ ≤ ν) + (hhi : ν ≤ ENNReal.ofReal (1+ε) • μ) + (g : α → ℝ) (hg : ∀ x, 0 ≤ g x) (hgi : Integrable g μ) : + Integrable g ν ∧ |(∫ x, g x ∂ν) - ∫ x, g x ∂μ| ≤ ε * ∫ x, g x ∂μ := by + have hgui := hgi.smul_measure (c := ENNReal.ofReal (1+ε)) ENNReal.ofReal_ne_top + have hgν := hgui.mono_measure hhi + refine ⟨hgν, ?_⟩ + have hl := integral_mono_measure hlo (Filter.Eventually.of_forall hg) hgν + have hu := integral_mono_measure hhi (Filter.Eventually.of_forall hg) hgui + rw [integral_smul_measure, ENNReal.toReal_ofReal (by linarith), smul_eq_mul] at hl + rw [integral_smul_measure, ENNReal.toReal_ofReal (by linarith), smul_eq_mul] at hu + exact abs_le.mpr ⟨by nlinarith, by nlinarith⟩ + +/-- The source's single-phase test estimate for all integrable nonnegative +weights, not merely for rectangle indicators. -/ +theorem sourceAngle_single_phase_test (i : SourceCoordinate) (n : ℝ) (hn : 0 < n) + (hlen : 1 ≤ n*sourceAngleUnit i) (g : ℝ → ℝ) + (hg : ∀ x, 0 ≤ g x) (hgm : Measurable g) (hgi : Integrable g unitIntervalMeasure) : + |(∫ t, g (Int.fract (n*t)) ∂sourceAngleMarginal i) - + ∫ t, g t ∂unitIntervalMeasure| ≤ + (1/(n*sourceAngleUnit i)) * ∫ t, g t ∂unitIntervalMeasure := by + have hp := sourceAngle_phase_sandwich i n hn + have he0 : 0 ≤ 1/(n*sourceAngleUnit i) := by positivity + have he1 : 1/(n*sourceAngleUnit i) ≤ 1 := by + exact (one_div_le_one_div_of_le (by norm_num : (0 : ℝ) < 1) hlen).trans_eq (by norm_num) + have hh := (integral_error_of_measure_sandwich unitIntervalMeasure _ _ he0 he1 hp.1 hp.2 g hg hgi).2 + have hphase : Measurable (fun t : ℝ => Int.fract (n*t)) := + sourceFract_measurable.comp (measurable_const.mul measurable_id) + rw [integral_map hphase.aemeasurable hgm.aestronglyMeasurable] at hh + exact hh + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/ProductError.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/ProductError.lean new file mode 100644 index 0000000000000000000000000000000000000000..8591bdbba2b1d520112a33062a86341a3dbe1d1e --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/ProductError.lean @@ -0,0 +1,47 @@ +import OAI.Analysis.FiniteFactor.Sampling.IntegratedCorrelation + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter Finset +open scoped Classical +noncomputable section + +/-- Telescoping products needs upper bounds only. In particular, a zero ideal +coordinate moment causes no division or exceptional case. -/ +theorem sampling_product_error {ι : Type*} (S : Finset ι) (f g : ι → ℝ) (M ε : ℝ) + (hM : 1 ≤ M) (hε : 0 ≤ ε) + (hf : ∀ i ∈ S, 0 ≤ f i ∧ f i ≤ M) (hg : ∀ i ∈ S, 0 ≤ g i ∧ g i ≤ M) + (he : ∀ i ∈ S, |f i-g i| ≤ ε) : + |(∏ i ∈ S, f i)-(∏ i ∈ S, g i)| ≤ (S.card : ℝ)*ε*M^S.card := by + induction S using Finset.induction_on with + | empty => simp + | @insert i S hi ih => + have hfi := hf i (mem_insert_self _ _) + have hgi := hg i (mem_insert_self _ _) + have hei := he i (mem_insert_self _ _) + have hfS : ∀ j ∈ S, 0 ≤ f j ∧ f j ≤ M := fun j hj => hf j (mem_insert_of_mem hj) + have hgS : ∀ j ∈ S, 0 ≤ g j ∧ g j ≤ M := fun j hj => hg j (mem_insert_of_mem hj) + have heS : ∀ j ∈ S, |f j-g j| ≤ ε := fun j hj => he j (mem_insert_of_mem hj) + have hprod : 0 ≤ ∏ j ∈ S, g j := prod_nonneg (fun j hj => (hgS j hj).1) + have hprodM : (∏ j ∈ S, g j) ≤ M^S.card := by + calc + _ ≤ ∏ _j ∈ S, M := prod_le_prod₀ (fun j hj => (hgS j hj).1) (fun j hj => (hgS j hj).2) + _ = _ := by simp + have hMp : 0 ≤ M^S.card := pow_nonneg (by linarith) _ + have hbase : 0 ≤ (S.card : ℝ)*ε*M^S.card := by positivity + rw [prod_insert hi,prod_insert hi,card_insert_of_notMem hi,Nat.cast_add,Nat.cast_one,pow_succ] + calc + _ = |f i*((∏ j ∈ S, f j)-(∏ j ∈ S, g j))+(f i-g i)*(∏ j ∈ S, g j)| := by congr 1; ring + _ ≤ |f i*((∏ j ∈ S, f j)-(∏ j ∈ S, g j))|+|(f i-g i)*(∏ j ∈ S, g j)| := abs_add_le _ _ + _ = f i*|(∏ j ∈ S, f j)-(∏ j ∈ S, g j)|+|f i-g i| *(∏ j ∈ S, g j) := by + rw [abs_mul,abs_mul,abs_of_nonneg hfi.1,abs_of_nonneg hprod] + _ ≤ M*((S.card : ℝ)*ε*M^S.card)+ε*M^S.card := by + exact add_le_add (mul_le_mul hfi.2 (ih hfS hgS heS) (abs_nonneg _) (by linarith)) + (mul_le_mul hei hprodM hprod hε) + _ ≤ _ := by nlinarith [mul_nonneg hε hMp,mul_nonneg (show 0 ≤ M-1 by linarith) (mul_nonneg hε hMp)] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/Rectangle.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/Rectangle.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0bd8614d32b68e157b43176e4403bf01a74ba94 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/Rectangle.lean @@ -0,0 +1,116 @@ +import OAI.Analysis.FiniteFactor.Sampling.SmoothedPair +import OAI.Analysis.FiniteFactor.Sampling.SmoothingLaw + +namespace OAI + +namespace FiniteFactor +open MeasureTheory +open scoped ENNReal +noncomputable section + +theorem integrable_unit_bounded {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (f : Ω → ℝ) (hf : Measurable f) + (hbound : ∀ x, 0 ≤ f x ∧ f x ≤ 1) : Integrable f μ := by + apply (integrable_const (1 : ℝ)).mono' hf.aestronglyMeasurable + exact Filter.Eventually.of_forall (fun x => by simpa [Real.norm_eq_abs,abs_of_nonneg (hbound x).1] using (hbound x).2) + +theorem product_difference_unit_bound (a b c d : ℝ) + (hb : 0 ≤ b ∧ b ≤ 1) (hc : 0 ≤ c ∧ c ≤ 1) : + |a*b-c*d| ≤ |a-c|+|b-d| := by + calc + _ = |(a-c)*b+c*(b-d)| := by congr 1; ring + _ ≤ |(a-c)*b|+|c*(b-d)| := abs_add_le _ _ + _ = |a-c| *b+c*|b-d| := by rw [abs_mul,abs_mul,abs_of_nonneg hb.1,abs_of_nonneg hc.1] + _ ≤ |a-c|+|b-d| := by nlinarith [abs_nonneg (a-c),abs_nonneg (b-d)] + +/-- Uniform marginal smoothing errors control a product test under a +possibly dependent joint law. -/ +theorem integral_product_smoothing_error {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (f g a b : Ω → ℝ) + (hf : Measurable f) (hg : Measurable g) (ha : Measurable a) (hb : Measurable b) + (hfb : ∀ x, 0 ≤ f x ∧ f x ≤ 1) (hgb : ∀ x, 0 ≤ g x ∧ g x ≤ 1) + (hab : ∀ x, 0 ≤ a x ∧ a x ≤ 1) (hbb : ∀ x, 0 ≤ b x ∧ b x ≤ 1) : + |(∫ x, f x*g x ∂μ)-(∫ x, a x*b x ∂μ)| ≤ + (∫ x, |f x-a x| ∂μ)+(∫ x, |g x-b x| ∂μ) := by + have hfg : Integrable (fun x => f x*g x) μ := integrable_unit_bounded μ _ (hf.mul hg) + (fun x => ⟨mul_nonneg (hfb x).1 (hgb x).1, by nlinarith [(hfb x).1,(hfb x).2,(hgb x).1,(hgb x).2]⟩) + have habi : Integrable (fun x => a x*b x) μ := integrable_unit_bounded μ _ (ha.mul hb) + (fun x => ⟨mul_nonneg (hab x).1 (hbb x).1, by nlinarith [(hab x).1,(hab x).2,(hbb x).1,(hbb x).2]⟩) + have hfa := (integrable_unit_bounded μ f hf hfb).sub (integrable_unit_bounded μ a ha hab) + have hgb' := (integrable_unit_bounded μ g hg hgb).sub (integrable_unit_bounded μ b hb hbb) + have hfa' : Integrable (fun x => |f x-a x|) μ := by simpa [Real.norm_eq_abs] using hfa.norm + have hgb'' : Integrable (fun x => |g x-b x|) μ := by simpa [Real.norm_eq_abs] using hgb'.norm + rw [← integral_sub hfg habi] + calc + _ ≤ ∫ x, |f x*g x-a x*b x| ∂μ := by simpa [Real.norm_eq_abs] using norm_integral_le_integral_norm (fun x => f x*g x-a x*b x) + _ ≤ ∫ x, |f x-a x|+|g x-b x| ∂μ := by + apply integral_mono_ae + · simpa [Real.norm_eq_abs] using (hfg.sub habi).norm + · exact hfa'.add hgb'' + · exact Filter.Eventually.of_forall (fun x => product_difference_unit_bound _ _ _ _ (hgb x) (hab x)) + _ = _ := integral_add hfa' hgb'' + +/-- Explicit rectangle discrepancy derived from actual marginal domination +and joint Fourier estimates. No two-dimensional density is required. -/ +theorem sampling_rectangle_discrepancy {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X Y : Ω → ℝ) + (hX : Measurable X) (hY : Measurable Y) + (hdomX : μ.map X ≤ (2 : ℝ≥0∞) • unitIntervalMeasure) + (hdomY : μ.map Y ≤ (2 : ℝ≥0∞) • unitIntervalMeasure) + (H : ℕ) (hH : 0 < H) (a b a' b' δ ε : ℝ) (hδ : 0 < δ) (hε : 0 ≤ ε) + (hFourier : ∀ v w : ℤ, |v| < (H : ℤ) → |w| < (H : ℤ) → (v ≠ 0 ∨ w ≠ 0) → + ‖∫ θ, samplingCharacter v (X θ)*samplingCharacter w (Y θ) ∂μ‖ ≤ ε) : + |(μ {θ | X θ ∈ Set.Icc a b ∧ Y θ ∈ Set.Icc a' b'}).toReal - + (unitIntervalMeasure (Set.Icc a b)).toReal*(unitIntervalMeasure (Set.Icc a' b')).toReal| ≤ + 24*δ+1/(2*(H : ℝ)*δ^2)+(H : ℝ)^2*ε := by + let E := Set.Icc a b + let E' := Set.Icc a' b' + let f := fun θ => E.indicator (fun _ => (1 : ℝ)) (X θ) + let g := fun θ => E'.indicator (fun _ => (1 : ℝ)) (Y θ) + let A := fun θ => samplingSmooth H E (X θ) + let B := fun θ => samplingSmooth H E' (Y θ) + have hf : Measurable f := (measurable_const.indicator measurableSet_Icc).comp hX + have hg : Measurable g := (measurable_const.indicator measurableSet_Icc).comp hY + have hA : Measurable A := (samplingSmooth_continuous H E).measurable.comp hX + have hB : Measurable B := (samplingSmooth_continuous H E').measurable.comp hY + have hfb (θ) : 0 ≤ f θ ∧ f θ ≤ 1 := by + dsimp [f]; by_cases he : X θ ∈ E <;> simp [he] + have hgb (θ) : 0 ≤ g θ ∧ g θ ≤ 1 := by + dsimp [g]; by_cases he : Y θ ∈ E' <;> simp [he] + have hprod := integral_product_smoothing_error μ f g A B hf hg hA hB hfb hgb + (fun θ => samplingSmooth_bounds H hH E (X θ)) (fun θ => samplingSmooth_bounds H hH E' (Y θ)) + have : IsProbabilityMeasure (μ.map X) := ⟨by rw [Measure.map_apply hX MeasurableSet.univ]; simp⟩ + have : IsProbabilityMeasure (μ.map Y) := ⟨by rw [Measure.map_apply hY MeasurableSet.univ]; simp⟩ + have hex := samplingSmooth_expected_error (μ.map X) hdomX H hH a b δ hδ + have hey := samplingSmooth_expected_error (μ.map Y) hdomY H hH a' b' δ hδ + have hem (a b : ℝ) : Measurable (fun t => |samplingSmooth H (Set.Icc a b) t- + (Set.Icc a b).indicator (fun _ => (1 : ℝ)) t|) := by + have hi : Measurable ((Set.Icc a b).indicator (fun _ => (1 : ℝ))) := measurable_const.indicator measurableSet_Icc + simpa [Real.norm_eq_abs] using ((samplingSmooth_continuous H (Set.Icc a b)).measurable.sub hi).norm + rw [integral_map hX.aemeasurable (hem a b).aestronglyMeasurable] at hex + rw [integral_map hY.aemeasurable (hem a' b').aestronglyMeasurable] at hey + have hfint : (∫ θ, f θ*g θ ∂μ) = (μ {θ | X θ ∈ E ∧ Y θ ∈ E'}).toReal := by + have he : (fun θ => f θ*g θ) = {θ | X θ ∈ E ∧ Y θ ∈ E'}.indicator (fun _ => (1 : ℝ)) := by + funext θ + dsimp [f,g] + by_cases hx : X θ ∈ E <;> by_cases hy : Y θ ∈ E' <;> simp [hx,hy] + rw [he,integral_indicator (by exact (hX measurableSet_Icc).inter (hY measurableSet_Icc))] + simp [measureReal_def] + have hsm := samplingSmooth_pair_error μ X Y hX hY H hH E E' ε hε hFourier + simp_rw [← Complex.ofReal_mul] at hsm + rw [integral_complex_ofReal, ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] at hsm + change |(∫ θ, A θ*B θ ∂μ)-(unitIntervalMeasure E).toReal*(unitIntervalMeasure E').toReal| ≤ _ at hsm + have hex' : (∫ θ, |f θ-A θ| ∂μ) ≤ 12*δ+1/(4*(H : ℝ)*δ^2) := by + simpa only [f,A,abs_sub_comm] using hex + have hey' : (∫ θ, |g θ-B θ| ∂μ) ≤ 12*δ+1/(4*(H : ℝ)*δ^2) := by + simpa only [g,B,abs_sub_comm] using hey + rw [← hfint] + have htri := abs_sub_le (∫ θ, f θ*g θ ∂μ) (∫ θ, A θ*B θ ∂μ) + ((unitIntervalMeasure E).toReal*(unitIntervalMeasure E').toReal) + have hc : 2*(1/(4*(H : ℝ)*δ^2)) = 1/(2*(H : ℝ)*δ^2) := by ring + nlinarith + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/SecondDensity.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..f21c8e84b3979293dc602a07dff7034c291a970c --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondDensity.lean @@ -0,0 +1,119 @@ +import OAI.Analysis.FiniteFactor.Sampling.AveragedTransport +import Mathlib.MeasureTheory.Function.AEEqOfLIntegral + +namespace OAI + +namespace FiniteFactor +open MeasureTheory ProbabilityTheory Filter +open scoped ENNReal +noncomputable section + +def samplingSecondWeight (h α s t : ℝ) : ℝ := + samplingWeight false h α (Int.fract (s-t)) t + +def samplingSecondDensity (h α s : ℝ) : ℝ := + ∫ t, samplingSecondWeight h α s t ∂unitIntervalMeasure + +theorem samplingSecondWeight_measurable (h α : ℝ) : + Measurable (fun p : ℝ × ℝ => samplingSecondWeight h α p.1 p.2) := + (samplingWeight_measurable false h α).comp + ((sourceFract_measurable.comp (measurable_fst.sub measurable_snd)).prodMk measurable_snd) + +theorem samplingSecondWeight_integrable (h α s : ℝ) (hh : 0 < h) (hα : 0 < α) : + Integrable (samplingSecondWeight h α s) unitIntervalMeasure := by + have hm : Measurable (samplingSecondWeight h α s) := + (samplingSecondWeight_measurable h α).comp (measurable_const.prodMk measurable_id) + exact (integrable_const (max 1 (1/(h*α)))).mono' hm.aestronglyMeasurable + (Eventually.of_forall (fun t => by + rw [Real.norm_eq_abs] + change |samplingWeight false h α (Int.fract (s-t)) t| ≤ _ + rw [abs_of_nonneg (samplingWeight_bounds false h α (Int.fract (s-t)) t hh hα).1] + exact (samplingWeight_bounds false h α _ t hh hα).2)) + +theorem samplingSecondDensity_lintegral (h α s : ℝ) (hh : 0 < h) (hα : 0 < α) : + ENNReal.ofReal (samplingSecondDensity h α s) = + ∫⁻ t, ENNReal.ofReal (samplingSecondWeight h α s t) ∂unitIntervalMeasure := + ofReal_integral_eq_lintegral_ofReal (samplingSecondWeight_integrable h α s hh hα) + (Eventually.of_forall (fun t => (samplingWeight_bounds false h α _ t hh hα).1)) + +theorem samplingSecondDensity_measurable (h α : ℝ) : Measurable (samplingSecondDensity h α) := + (samplingSecondWeight_measurable h α).stronglyMeasurable.integral_prod_right.measurable + +theorem samplingSecondDensity_nonneg (h α s : ℝ) (hh : 0 < h) (hα : 0 < α) : + 0 ≤ samplingSecondDensity h α s := + integral_nonneg (fun t => (samplingWeight_bounds false h α _ t hh hα).1) + +theorem sampling_fract_inverse (z t : ℝ) (hz : z ∈ Set.Ico (0 : ℝ) 1) : + Int.fract (Int.fract (z+t)-t) = z := by + have he : Int.fract (z+t)-t = z-(Int.floor (z+t) : ℝ) := by rw [Int.fract]; ring + rw [he,Int.fract_sub_intCast,Int.fract_eq_self.mpr hz] + +/-- Haar substitution identifies the actual second-oriented integral with +the weighted endpoint law; no marginal-density hypothesis is assumed. -/ +theorem samplingSecondDensity_test (h α : ℝ) (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (F : ℝ → ℝ≥0∞) (hF : Measurable F) : + (∫⁻ s, ENNReal.ofReal (samplingSecondDensity h α s)*F s ∂unitIntervalMeasure) = + ∫⁻ z, ∫⁻ t, ENNReal.ofReal (samplingWeight false h α z t)*F (z+t) + ∂unitIntervalMeasure ∂unitIntervalMeasure := by + have hwm := samplingSecondWeight_measurable h α + calc + _ = ∫⁻ s, ∫⁻ t, ENNReal.ofReal (samplingSecondWeight h α s t)*F s + ∂unitIntervalMeasure ∂unitIntervalMeasure := by + apply lintegral_congr + intro s + have hmd : Measurable (fun t => ENNReal.ofReal (samplingSecondWeight h α s t)) := + (hwm.comp (measurable_const.prodMk measurable_id)).ennreal_ofReal + rw [samplingSecondDensity_lintegral h α s hh hα,lintegral_mul_const _ hmd] + _ = ∫⁻ t, ∫⁻ s, ENNReal.ofReal (samplingSecondWeight h α s t)*F s + ∂unitIntervalMeasure ∂unitIntervalMeasure := + lintegral_lintegral_swap (hwm.ennreal_ofReal.mul (hF.comp measurable_fst)).aemeasurable + _ = ∫⁻ t, ∫⁻ z, ENNReal.ofReal (samplingWeight false h α z t)*F (Int.fract (z+t)) + ∂unitIntervalMeasure ∂unitIntervalMeasure := by + apply lintegral_congr + intro t + have hm : Measurable (fun s => ENNReal.ofReal (samplingSecondWeight h α s t)*F s) := + ((hwm.comp (measurable_id.prodMk measurable_const)).ennreal_ofReal).mul hF + rw [← (unitInterval_rotate_preserving t).lintegral_comp hm] + apply lintegral_congr_ae + filter_upwards [show ∀ᵐ z ∂unitIntervalMeasure, z ∈ Set.Ico (0 : ℝ) 1 from + ae_restrict_mem measurableSet_Ico] with z hz + simp only [samplingSecondWeight,sampling_fract_inverse z t hz] + _ = ∫⁻ z, ∫⁻ t, ENNReal.ofReal (samplingWeight false h α z t)*F (Int.fract (z+t)) + ∂unitIntervalMeasure ∂unitIntervalMeasure := by + apply lintegral_lintegral_swap + exact (((samplingWeight_measurable false h α).comp measurable_swap).ennreal_ofReal.mul + (hF.comp (sourceFract_measurable.comp (measurable_snd.add measurable_fst)))).aemeasurable + _ = _ := by + apply lintegral_congr_ae + filter_upwards [show ∀ᵐ z ∂unitIntervalMeasure, z ∈ Set.Ico (0 : ℝ) 1 from + ae_restrict_mem measurableSet_Ico] with z hz + apply lintegral_congr + intro t + by_cases hw : samplingWeight false h α z t = 0 + · simp [hw] + · rw [(samplingWeight_orders false h α z t hh hh1 hα hz hw).1] + +/-- The actual cutoff second marginal is dominated almost everywhere by +q_h, completing the missing connection to the quadratic ideal moment. -/ +theorem samplingSecondDensity_le_ideal (h α : ℝ) (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) : + ∀ᵐ s ∂unitIntervalMeasure, samplingSecondDensity h α s ≤ samplingIdealSecond h s := by + have he : ∀ᵐ s ∂unitIntervalMeasure, + ENNReal.ofReal (samplingSecondDensity h α s) ≤ ENNReal.ofReal (samplingIdealSecond h s) := by + apply ae_le_of_forall_setLIntegral_le_of_sigmaFinite + (samplingSecondDensity_measurable h α).ennreal_ofReal + intro S hS _ + have hb := samplingWeight_endpoint_domination h α hh hh1 hα (S.indicator (fun _ => 1)) + (measurable_const.indicator hS) + rw [← samplingSecondDensity_test h α hh hh1 hα _ (measurable_const.indicator hS)] at hb + have hind (g : ℝ → ℝ≥0∞) : (fun s => g s*S.indicator (fun _ => 1) s) = S.indicator g := by + funext s + by_cases hs : s ∈ S <;> simp [Set.indicator,hs] + rw [hind,hind,lintegral_indicator hS,lintegral_indicator hS] at hb + exact hb + filter_upwards [he] with s hs + exact (ENNReal.ofReal_le_ofReal_iff (samplingIdealSecond_bounds h s hh hh1).1).mp hs + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/SecondDiscrepancy.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondDiscrepancy.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf15bfabdb7927163cb39822a1bba618df607a21 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondDiscrepancy.lean @@ -0,0 +1,88 @@ +import OAI.Analysis.FiniteFactor.Sampling.SecondLevelAE + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical ENNReal +noncomputable section + +theorem sampling_level_pair_integral {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (f g : Ω → ℝ) + (hf : Measurable f) (hg : Measurable g) (r t : ℝ) : + (∫ x, (if r ≤ f x then (1 : ℝ) else 0)*(if t ≤ g x then (1 : ℝ) else 0) ∂μ) = + (μ {x | r ≤ f x ∧ t ≤ g x}).toReal := by + have hs : MeasurableSet {x | r ≤ f x ∧ t ≤ g x} := + (measurableSet_le measurable_const hf).inter (measurableSet_le measurable_const hg) + have he : (fun x => (if r ≤ f x then (1 : ℝ) else 0)*(if t ≤ g x then (1 : ℝ) else 0)) = + {x | r ≤ f x ∧ t ≤ g x}.indicator (fun _ => (1 : ℝ)) := by + funext x; simp only [Set.indicator,Set.mem_ofPred_eq]; split_ifs <;> simp_all + rw [he,integral_indicator hs] + simp [measureReal_def] + +/-- The actual second-oriented reciprocal inherits rectangle discrepancy, +including both monotone pieces, cutoff jumps and reflected interval tests. -/ +theorem samplingTestedSecond_pair_bound {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X Y : Ω → ℝ) + (hX : Measurable X) (hY : Measurable Y) + [NullSingletonClass (μ.map X)] [NullSingletonClass (μ.map Y)] + (hXs : ∀ᵐ x ∂μ.map X, x ∈ Set.Ico (0 : ℝ) 1) + (hYs : ∀ᵐ x ∂μ.map Y, x ∈ Set.Ico (0 : ℝ) 1) + (δ : ℝ) (hrect : ∀ a b c d : ℝ, + |(μ {x | X x ∈ Set.Icc a b ∧ Y x ∈ Set.Icc c d}).toReal - + (unitIntervalMeasure (Set.Icc a b)).toReal*(unitIntervalMeasure (Set.Icc c d)).toReal| ≤ δ) + (h α : ℝ) (G : Set ℝ) (a c s : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hG : MeasurableSet G) + (hs : s ∈ Set.Ico (0 : ℝ) 1) : + |(∫ x, samplingTestedSecondWeight h α (Set.Icc a c) G s (X x)* + samplingTestedSecondWeight h α (Set.Icc a c) G s (Y x) ∂μ)- + samplingTestedSecondDensity h α (Set.Icc a c) G s^2| ≤ + (4*δ)*(max 1 (1/(h*α)))^2 := by + let w := samplingTestedSecondWeight h α (Set.Icc a c) G s + let C := max 1 (1/(h*α)) + have hw : Measurable w := (samplingTestedSecondWeight_measurable h α _ G measurableSet_Icc hG).comp + (measurable_const.prodMk measurable_id) + have hwb (t : ℝ) : 0 ≤ w t ∧ w t ≤ C := + ⟨(samplingTestedSecondWeight_bounds h α _ G s t hh hα).1, + (samplingTestedSecondWeight_bounds h α _ G s t hh hα).2.trans + (samplingWeight_bounds false h α _ t hh hα).2⟩ + have : NullSingletonClass unitIntervalMeasure := by unfold unitIntervalMeasure; infer_instance + have hu : ∀ᵐ t ∂unitIntervalMeasure, t ∈ Set.Ico (0 : ℝ) 1 := + self_mem_ae_restrict measurableSet_Ico + have hl (r t : ℝ) (hr : 0 < r) (_hrC : r ≤ C) (ht : 0 < t) (_htC : t ≤ C) : + |(μ {x | r ≤ w (X x) ∧ t ≤ w (Y x)}).toReal - + (unitIntervalMeasure.prod unitIntervalMeasure {p : ℝ × ℝ | r ≤ w p.1 ∧ t ≤ w p.2}).toReal| ≤ 4*δ := by + obtain ⟨A,B,hAB⟩ := samplingTestedSecond_level_exists h α G a c s r hh hh1 hα hs hr + obtain ⟨D,E,hDE⟩ := samplingTestedSecond_level_exists h α G a c s t hh hh1 hα hs ht + have hx := ae_of_ae_map hX.aemeasurable (hAB (μ.map X) hXs) + have hy := ae_of_ae_map hY.aemeasurable (hDE (μ.map Y) hYs) + have hpair : (∫ x, (if r ≤ w (X x) then (1 : ℝ) else 0)* + (if t ≤ w (Y x) then (1 : ℝ) else 0) ∂μ) = + ∫ x, (∑ j, samplingClosedIndicator (A j) (B j) (X x))* + (∑ k, samplingClosedIndicator (D k) (E k) (Y x)) ∂μ := by + apply integral_congr_ae + filter_upwards [hx,hy] with x hx hy + rw [hx,hy] + have hmeanr := integral_congr_ae (hAB unitIntervalMeasure hu) + have hmeant := integral_congr_ae (hDE unitIntervalMeasure hu) + rw [← sampling_level_pair_integral μ (fun x => w (X x)) (fun x => w (Y x)) (hw.comp hX) (hw.comp hY) r t,hpair, + ← sampling_level_pair_integral (unitIntervalMeasure.prod unitIntervalMeasure) (fun p => w p.1) (fun p => w p.2) + (hw.comp measurable_fst) (hw.comp measurable_snd) r t] + rw [integral_prod_mul (fun x => if r ≤ w x then (1 : ℝ) else 0) + (fun x => if t ≤ w x then (1 : ℝ) else 0)] + change |_- (∫ x, if r ≤ w x then (1 : ℝ) else 0 ∂unitIntervalMeasure)* + (∫ x, if t ≤ w x then (1 : ℝ) else 0 ∂unitIntervalMeasure)| ≤ _ + rw [hmeanr,hmeant] + exact sampling_two_intervals_pair μ X Y hX hY δ hrect A B D E + have hc := sampling_layer_discrepancy μ (unitIntervalMeasure.prod unitIntervalMeasure) + (fun x => w (X x)) (fun x => w (Y x)) (fun p => w p.1) (fun p => w p.2) + (hw.comp hX) (hw.comp hY) (hw.comp measurable_fst) (hw.comp measurable_snd) + C (4*δ) (le_trans (by norm_num) (le_max_left _ _)) + (fun x => hwb (X x)) (fun x => hwb (Y x)) (fun p => hwb p.1) (fun p => hwb p.2) hl + rw [integral_prod_mul w w] at hc + simpa only [w,C,samplingTestedSecondDensity,pow_two] using hc + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/SecondInterval.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondInterval.lean new file mode 100644 index 0000000000000000000000000000000000000000..26f05f164d0b3a94126bd23ba34859b578625104 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondInterval.lean @@ -0,0 +1,106 @@ +import OAI.Analysis.FiniteFactor.Sampling.TestedSecondMoment + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical +noncomputable section + +def samplingSecondLength (h s : ℝ) : ℝ := min (h*s/(1+h)) (h*(1-s)/(1-h)) + +theorem samplingSecondWeight_support_iff (h α s t : ℝ) (hh : 0 < h) (hh1 : h < 1) + (hα : 0 < α) (hs : s ∈ Set.Ico (0 : ℝ) 1) (ht : t ∈ Set.Ico (0 : ℝ) 1) : + samplingSecondWeight h α s t ≠ 0 ↔ + 0 < t ∧ t < samplingSecondLength h s ∧ α ≤ s-t ∧ s-t ≤ 1-α := by + have hplus : 0 < 1+h := by linarith + have hminus : 0 < 1-h := by linarith + constructor + · intro hw + have hf := (samplingWeight_second_no_wrap h α s t hh hh1 hα hs ht hw).2 + have hc : α ≤ samplingDistance (s-t) ∧ 0 < t ∧ t < h*samplingDistance (s-t) := by + unfold samplingSecondWeight samplingWeight at hw + simp only [Bool.false_eq_true,ite_false,hf] at hw + split_ifs at hw with hc + · exact hc + · exact False.elim (hw rfl) + have hcut := le_min_iff.mp hc.1 + have hleft : t < h*(s-t) := hc.2.2.trans_le + (mul_le_mul_of_nonneg_left (min_le_left _ _) hh.le) + have hright : t < h*(1-(s-t)) := hc.2.2.trans_le + (mul_le_mul_of_nonneg_left (min_le_right _ _) hh.le) + refine ⟨hc.2.1,?_,hcut.1,by linarith [hcut.2]⟩ + unfold samplingSecondLength + rw [lt_min_iff,lt_div_iff₀ hplus,lt_div_iff₀ hminus] + constructor <;> nlinarith + · rintro ⟨ht0,htL,hcut,hcut'⟩ + have hz : s-t ∈ Set.Ico (0 : ℝ) 1 := ⟨hα.le.trans hcut,by linarith⟩ + have hf := Int.fract_eq_self.mpr hz + have hL := lt_min_iff.mp htL + have hl := (lt_div_iff₀ hplus).mp hL.1 + have hr := (lt_div_iff₀ hminus).mp hL.2 + have htl : t < h*(s-t) := by nlinarith + have htr : t < h*(1-(s-t)) := by nlinarith + have hd : α ≤ samplingDistance (s-t) := le_min hcut (by linarith) + have htd : t < h*samplingDistance (s-t) := by + unfold samplingDistance + rw [mul_min_of_nonneg _ _ hh.le] + exact lt_min htl htr + have hp : 0 < h*samplingDistance (s-t) := mul_pos hh (hα.trans_le hd) + simp [samplingSecondWeight,samplingWeight,hf,hd,ht0,htd,(hα.trans_le hd).ne',hh.ne'] + +/-- Exact reciprocal on the actual second-oriented support. -/ +theorem samplingSecondWeight_interval (h α s t : ℝ) (hh : 0 < h) (hh1 : h < 1) + (hα : 0 < α) (hs : s ∈ Set.Ico (0 : ℝ) 1) (ht : t ∈ Set.Ico (0 : ℝ) 1) : + samplingSecondWeight h α s t = + if 0 < t ∧ t < samplingSecondLength h s ∧ α ≤ s-t ∧ s-t ≤ 1-α + then 1/(h*samplingDistance (s-t)) else 0 := by + by_cases hw : samplingSecondWeight h α s t ≠ 0 + · have hc := (samplingSecondWeight_support_iff h α s t hh hh1 hα hs ht).mp hw + have hf := (samplingWeight_second_no_wrap h α s t hh hh1 hα hs ht hw).2 + rw [ite_eq_left hc] + unfold samplingSecondWeight samplingWeight at * + simp only [Bool.false_eq_true,ite_false,hf] at * + split_ifs at * <;> simp_all + · rw [not_ne_iff] at hw + have hc : ¬ (0 < t ∧ t < samplingSecondLength h s ∧ α ≤ s-t ∧ s-t ≤ 1-α) := by + intro hc + exact ((samplingSecondWeight_support_iff h α s t hh hh1 hα hs ht).mpr hc) hw + rw [ite_eq_right hc,hw] + +/-- The x-test intersects that support with a reflected interval, while the +y-test is constant in the phase variable. -/ +theorem samplingTestedSecondWeight_interval (h α : ℝ) (G : Set ℝ) (a c s t : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (hs : s ∈ Set.Ico (0 : ℝ) 1) (ht : t ∈ Set.Ico (0 : ℝ) 1) : + samplingTestedSecondWeight h α (Set.Icc a c) G s t = + (Set.Ioo 0 (samplingSecondLength h s) ∩ + Set.Icc (max (s-(1-α)) (s-c)) (min (s-α) (s-a))).indicator + (fun t => if s ∈ G then 1/(h*samplingDistance (s-t)) else 0) t := by + have heq : t ∈ Set.Ioo 0 (samplingSecondLength h s) ∩ + Set.Icc (max (s-(1-α)) (s-c)) (min (s-α) (s-a)) ↔ + (0 < t ∧ t < samplingSecondLength h s ∧ α ≤ s-t ∧ s-t ≤ 1-α) ∧ s-t ∈ Set.Icc a c := by + simp only [Set.mem_inter_iff,Set.mem_Ioo,Set.mem_Icc,max_le_iff,le_min_iff] + constructor + · rintro ⟨ht0,hL⟩ + exact ⟨⟨ht0.1,ht0.2,by linarith [hL.2.1],by linarith [hL.1.1]⟩, + ⟨by linarith [hL.2.2],by linarith [hL.1.2]⟩⟩ + · rintro ⟨⟨ht0,hL,hcut,hcut'⟩,ha,hc⟩ + exact ⟨⟨ht0,hL⟩,⟨⟨by linarith,by linarith⟩,⟨by linarith,by linarith⟩⟩⟩ + by_cases hw : samplingSecondWeight h α s t ≠ 0 + · have hc := (samplingSecondWeight_support_iff h α s t hh hh1 hα hs ht).mp hw + have hf := (samplingWeight_second_no_wrap h α s t hh hh1 hα hs ht hw).2 + rw [samplingTestedSecondWeight,samplingSecondWeight_interval h α s t hh hh1 hα hs ht, + ite_eq_left hc,hf] + simp only [Set.indicator,heq,hc,true_and] + split_ifs <;> simp_all + · have hc : ¬ (0 < t ∧ t < samplingSecondLength h s ∧ α ≤ s-t ∧ s-t ≤ 1-α) := by + intro hc + exact hw ((samplingSecondWeight_support_iff h α s t hh hh1 hα hs ht).mpr hc) + have hz := not_ne_iff.mp hw + simp only [samplingTestedSecondWeight,hz,ite_self,Set.indicator,heq,hc,false_and,ite_false] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/SecondLevelAE.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondLevelAE.lean new file mode 100644 index 0000000000000000000000000000000000000000..347f757c28a85cbf5816920e27a8984307aa0927 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondLevelAE.lean @@ -0,0 +1,41 @@ +import OAI.Analysis.FiniteFactor.Sampling.SecondLevels +import OAI.Analysis.FiniteFactor.Sampling.IntervalSums + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical +noncomputable section + +/-- The interval endpoints depend only on the weight and level, and work +simultaneously for every atomless law carried by [0,1). -/ +theorem samplingTestedSecond_level_exists (h α : ℝ) (G : Set ℝ) (a c s r : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (hs : s ∈ Set.Ico (0 : ℝ) 1) (hr : 0 < r) : + ∃ A B : Fin 2 → ℝ, ∀ (ν : Measure ℝ) [NullSingletonClass ν], + (∀ᵐ t ∂ν, t ∈ Set.Ico (0 : ℝ) 1) → + (fun t => if r ≤ samplingTestedSecondWeight h α (Set.Icc a c) G s t then (1 : ℝ) else 0) =ᵐ[ν] + (fun t => ∑ j, samplingClosedIndicator (A j) (B j) t) := by + by_cases hG : s ∈ G + · refine ⟨![max 0 (max (s-(1-α)) (s-c)), + max (max (max 0 (max (s-(1-α)) (s-c))) (s-1/2)) (s-1/(h*r))], + ![min (min (min (samplingSecondLength h s) (min (s-α) (s-a))) (s-1/2)) (s-1+1/(h*r)), + min (samplingSecondLength h s) (min (s-α) (s-a))],?_⟩ + intro ν _ hν + filter_upwards [hν, + ae_iff.mpr (show ν {t | ¬t ≠ 0} = 0 by simp), + ae_iff.mpr (show ν {t | ¬t ≠ samplingSecondLength h s} = 0 by simp), + ae_iff.mpr (show ν {t | ¬t ≠ s-1/2} = 0 by simp)] with t ht ht0 htL htm + simpa [Fin.sum_univ_two,samplingClosedIndicator,samplingSecondLevelLeft,samplingSecondLevelRight] + using samplingTestedSecond_level_intervals h α G a c s r t hh hh1 hα hs ht hr hG ht0 htL htm + · refine ⟨fun _ => 1,fun _ => 0,?_⟩ + intro ν _ _ + apply Eventually.of_forall + intro t + simp [samplingTestedSecondWeight,hG,not_le.mpr hr,samplingClosedIndicator] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/SecondLevels.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondLevels.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d7a49708607fb14cd2b699f63e21396c7fc4e02 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondLevels.lean @@ -0,0 +1,90 @@ +import OAI.Analysis.FiniteFactor.Sampling.SecondInterval + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical +noncomputable section + +/-- The two closed intervals representing a positive superlevel of the +second-oriented tested reciprocal. Endpoint changes are dealt with separately. -/ +def samplingSecondLevelLeft (h α a c s r : ℝ) : Set ℝ := + Set.Icc (max 0 (max (s-(1-α)) (s-c))) + (min (min (min (samplingSecondLength h s) (min (s-α) (s-a))) (s-1/2)) (s-1+1/(h*r))) + +def samplingSecondLevelRight (h α a c s r : ℝ) : Set ℝ := + Set.Icc (max (max (max 0 (max (s-(1-α)) (s-c))) (s-1/2)) (s-1/(h*r))) + (min (samplingSecondLength h s) (min (s-α) (s-a))) + +/-- A reciprocal superlevel is the union of two endpoint intervals. -/ +theorem sampling_reciprocal_level (h r z : ℝ) (hh : 0 < h) (hr : 0 < r) + (hz : 0 < z) (hz1 : z < 1) : + r ≤ 1/(h*samplingDistance z) ↔ + (z ≤ 1/2 ∧ z ≤ 1/(h*r)) ∨ (1/2 ≤ z ∧ 1-z ≤ 1/(h*r)) := by + have hd : 0 < samplingDistance z := lt_min hz (by linarith) + have hd' : 0 < h*samplingDistance z := mul_pos hh hd + have hhr : 0 < h*r := mul_pos hh hr + rw [le_div_iff₀ hd'] + by_cases hc : z ≤ 1/2 + · have he : samplingDistance z = z := min_eq_left (by linarith) + rw [he] + constructor + · intro ha + exact Or.inl ⟨hc,(le_div_iff₀ hhr).mpr (by nlinarith)⟩ + · rintro (ha|ha) + · have hb := (le_div_iff₀ hhr).mp ha.2; nlinarith + · have hb := (le_div_iff₀ hhr).mp ha.2 + have heq : z = 1/2 := le_antisymm hc ha.1 + rw [heq] at * + nlinarith + · have he : samplingDistance z = 1-z := min_eq_right (by linarith) + rw [he] + constructor + · intro ha + exact Or.inr ⟨by linarith,(le_div_iff₀ hhr).mpr (by nlinarith)⟩ + · rintro (ha|ha) + · exact (hc ha.1).elim + · have hb := (le_div_iff₀ hhr).mp ha.2; nlinarith + +/-- Away from three possible jumps, the exact level indicator is the sum of +two closed-interval indicators. No variation theorem is assumed. -/ +theorem samplingTestedSecond_level_intervals (h α : ℝ) (G : Set ℝ) (a c s r t : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (hs : s ∈ Set.Ico (0 : ℝ) 1) (ht : t ∈ Set.Ico (0 : ℝ) 1) + (hr : 0 < r) (hsG : s ∈ G) + (ht0 : t ≠ 0) (htL : t ≠ samplingSecondLength h s) (htmid : t ≠ s-1/2) : + (if r ≤ samplingTestedSecondWeight h α (Set.Icc a c) G s t then (1 : ℝ) else 0) = + (samplingSecondLevelLeft h α a c s r).indicator (fun _ => (1 : ℝ)) t + + (samplingSecondLevelRight h α a c s r).indicator (fun _ => (1 : ℝ)) t := by + rw [samplingTestedSecondWeight_interval h α G a c s t hh hh1 hα hs ht] + have hsupport : t ∈ Set.Ioo 0 (samplingSecondLength h s) ∩ + Set.Icc (max (s-(1-α)) (s-c)) (min (s-α) (s-a)) ↔ + 0 ≤ t ∧ t ≤ samplingSecondLength h s ∧ α ≤ s-t ∧ s-t ≤ 1-α ∧ + a ≤ s-t ∧ s-t ≤ c := by + simp only [Set.mem_inter_iff,Set.mem_Ioo,Set.mem_Icc,max_le_iff,le_min_iff] + constructor + · rintro ⟨h1,h2⟩; rcases h1 with ⟨h1,h1'⟩; rcases h2 with ⟨⟨h2,h3⟩,h4,h5⟩ + exact ⟨h1.le,h1'.le,by linarith,by linarith,by linarith,by linarith⟩ + · rintro ⟨h1,h2,h3,h4,h5,h6⟩ + exact ⟨⟨lt_of_le_of_ne h1 (Ne.symm ht0),lt_of_le_of_ne h2 htL⟩, + ⟨⟨by linarith,by linarith⟩,by linarith,by linarith⟩⟩ + by_cases hc : t ∈ Set.Ioo 0 (samplingSecondLength h s) ∩ + Set.Icc (max (s-(1-α)) (s-c)) (min (s-α) (s-a)) + · have hz := hsupport.mp hc + rw [Set.indicator_of_mem hc,ite_eq_left hsG] + simp only [sampling_reciprocal_level h r (s-t) hh hr (hα.trans_le hz.2.2.1) (by linarith [hz.2.2.2.1])] + simp only [samplingSecondLevelLeft,samplingSecondLevelRight,Set.indicator, + Set.mem_Icc,max_le_iff,le_min_iff] + have hm : s-t ≠ (1/2 : ℝ) := by intro he; apply htmid; linarith + split_ifs <;> simp_all <;> grind + · have hn := (not_congr hsupport).mp hc + rw [Set.indicator_of_notMem hc,ite_eq_right (by linarith : ¬ r ≤ (0 : ℝ))] + simp only [samplingSecondLevelLeft,samplingSecondLevelRight,Set.indicator, + Set.mem_Icc,max_le_iff,le_min_iff] + split_ifs <;> simp_all <;> grind + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/SecondMoment.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..da9984d2e1491c98f1072099eabab13649cb2c6c --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondMoment.lean @@ -0,0 +1,162 @@ +import OAI.Analysis.FiniteFactor.Sampling.Transport +import Mathlib.MeasureTheory.Integral.Prod + +namespace OAI + +namespace FiniteFactor +open MeasureTheory ProbabilityTheory Filter +open scoped ENNReal +noncomputable section + +theorem samplingTransportDensity_bounds (h v s : ℝ) (hh : 0 ≤ h) (hh1 : h < 1) + (hv : 0 ≤ v) (hvh : v ≤ h) : + 0 ≤ samplingTransportDensity v s ∧ samplingTransportDensity v s ≤ 1/(1-h) ∧ + |samplingTransportDensity v s-1| ≤ h/(1-h) := by + have hmh : 0 < 1-h := by linarith + have hph : 0 < 1+h := by linarith + have hmv : 0 < 1-v := by linarith + have hpv : 0 < 1+v := by linarith + have hlo : 1/(1+h) ≤ samplingTransportDensity v s := by + unfold samplingTransportDensity + split_ifs + · exact one_div_le_one_div_of_le hpv (by linarith) + · exact one_div_le_one_div_of_le hmv (by linarith) + have hhi : samplingTransportDensity v s ≤ 1/(1-h) := by + unfold samplingTransportDensity + split_ifs <;> exact one_div_le_one_div_of_le hmh (by linarith) + have hl : 1-h/(1-h) ≤ 1/(1+h) := by + field_simp + nlinarith + have hr : 1/(1-h)-1 = h/(1-h) := by field_simp; ring + exact ⟨(by positivity : 0 ≤ 1/(1+h)).trans hlo,hhi, + abs_le.mpr ⟨by linarith,by linarith⟩⟩ + +theorem samplingTransportDensity_integral (v : ℝ) (hv : 0 ≤ v) (hv1 : v < 1) : + (∫ s, samplingTransportDensity v s ∂unitIntervalMeasure) = 1 := by + have hm : Measurable (samplingTransportDensity v) := + samplingTransportDensity_measurable.comp (measurable_const.prodMk measurable_id) + have hi : Integrable (samplingTransportDensity v) unitIntervalMeasure := + (integrable_const (1/(1-v))).mono' hm.aestronglyMeasurable + (Eventually.of_forall (fun s => by + rw [Real.norm_eq_abs,abs_of_nonneg (samplingTransportDensity_bounds v v s hv hv1 hv le_rfl).1] + exact (samplingTransportDensity_bounds v v s hv hv1 hv le_rfl).2.1)) + have hmap := congrArg (fun μ : Measure ℝ => μ Set.univ) (samplingTransport_density v hv hv1) + have htm : Measurable (samplingTransport v) := by unfold samplingTransport samplingDistance; fun_prop + rw [Measure.map_apply htm MeasurableSet.univ,withDensity_apply _ MeasurableSet.univ,Measure.restrict_univ] at hmap + simp only [Set.preimage_univ,measure_univ] at hmap + have he := ofReal_integral_eq_lintegral_ofReal hi + (Eventually.of_forall (fun s => (samplingTransportDensity_bounds v v s hv hv1 hv le_rfl).1)) + rw [← hmap] at he + have hn : 0 ≤ ∫ s, samplingTransportDensity v s ∂unitIntervalMeasure := integral_nonneg (fun s => (samplingTransportDensity_bounds v v s hv hv1 hv le_rfl).1) + have hh := congrArg ENNReal.toReal he + simpa [ENNReal.toReal_ofReal hn] using hh + +def samplingVelocityMeasure (h : ℝ) : Measure ℝ := cond volume (Set.Ioc (0 : ℝ) h) + +theorem samplingVelocity_probability (h : ℝ) (hh : 0 < h) : IsProbabilityMeasure (samplingVelocityMeasure h) := by + apply cond_isProbabilityMeasure_of_finite + · simp [Real.volume_Ioc,hh] + · simp [Real.volume_Ioc] + +/-- Actual averaged density of the uncut diagonal transport. -/ +def samplingIdealSecond (h s : ℝ) : ℝ := + ∫ v, samplingTransportDensity v s ∂samplingVelocityMeasure h + +theorem samplingIdealSecond_bounds (h s : ℝ) (hh : 0 < h) (hh1 : h < 1) : + 0 ≤ samplingIdealSecond h s ∧ samplingIdealSecond h s ≤ 1/(1-h) ∧ + |samplingIdealSecond h s-1| ≤ h/(1-h) := by + have := samplingVelocity_probability h hh + have hv : ∀ᵐ v ∂samplingVelocityMeasure h, v ∈ Set.Ioc (0 : ℝ) h := ae_cond_mem measurableSet_Ioc + have hm : Measurable (fun v => samplingTransportDensity v s) := + samplingTransportDensity_measurable.comp (measurable_id.prodMk measurable_const) + have hqi : Integrable (fun v => samplingTransportDensity v s) (samplingVelocityMeasure h) := + (integrable_const (1/(1-h))).mono' hm.aestronglyMeasurable (by + filter_upwards [hv] with v hv + rw [Real.norm_eq_abs,abs_of_nonneg (samplingTransportDensity_bounds h v s hh.le hh1 hv.1.le hv.2).1] + exact (samplingTransportDensity_bounds h v s hh.le hh1 hv.1.le hv.2).2.1) + have hnon : 0 ≤ samplingIdealSecond h s := integral_nonneg_of_ae (hv.mono (fun v hv => + (samplingTransportDensity_bounds h v s hh.le hh1 hv.1.le hv.2).1)) + have hu := integral_mono_ae hqi (integrable_const (1/(1-h))) (hv.mono (fun v hv => + (samplingTransportDensity_bounds h v s hh.le hh1 hv.1.le hv.2).2.1)) + refine ⟨hnon,by simpa [samplingIdealSecond] using hu,?_⟩ + have he : samplingIdealSecond h s-1 = ∫ v, samplingTransportDensity v s-1 ∂samplingVelocityMeasure h := by + rw [integral_sub hqi (integrable_const 1)] + simp [samplingIdealSecond] + rw [he] + calc + _ ≤ ∫ v, |samplingTransportDensity v s-1| ∂samplingVelocityMeasure h := by + simpa [Real.norm_eq_abs] using norm_integral_le_integral_norm (fun v => samplingTransportDensity v s-1) + _ ≤ ∫ _v, h/(1-h) ∂samplingVelocityMeasure h := by + apply integral_mono_ae + · simpa [Real.norm_eq_abs] using (hqi.sub (integrable_const 1)).norm + · exact integrable_const _ + · exact hv.mono (fun v hv => (samplingTransportDensity_bounds h v s hh.le hh1 hv.1.le hv.2).2.2) + _ = _ := by simp + +theorem samplingIdealSecond_measurable (h : ℝ) (hh : 0 < h) : Measurable (samplingIdealSecond h) := by + have := samplingVelocity_probability h hh + exact samplingTransportDensity_measurable.stronglyMeasurable.integral_prod_left.measurable + +/-- Fubini gives the exact mass identity for the averaged transport density. -/ +theorem samplingIdealSecond_integral (h : ℝ) (hh : 0 < h) (hh1 : h < 1) : + (∫ s, samplingIdealSecond h s ∂unitIntervalMeasure) = 1 := by + have := samplingVelocity_probability h hh + have hv : ∀ᵐ v ∂samplingVelocityMeasure h, v ∈ Set.Ioc (0 : ℝ) h := ae_cond_mem measurableSet_Ioc + have hvp : ∀ᵐ p : ℝ × ℝ ∂(samplingVelocityMeasure h).prod unitIntervalMeasure, + p.1 ∈ Set.Ioc (0 : ℝ) h := by + apply (Measure.ae_prod_iff_ae_ae (measurableSet_Ioc.preimage measurable_fst)).mpr + exact hv.mono (fun v hv => Eventually.of_forall (fun _ => hv)) + have hqi : Integrable (fun p : ℝ × ℝ => samplingTransportDensity p.1 p.2) + ((samplingVelocityMeasure h).prod unitIntervalMeasure) := + (integrable_const (1/(1-h))).mono' samplingTransportDensity_measurable.aestronglyMeasurable (by + filter_upwards [hvp] with p hp + rw [Real.norm_eq_abs,abs_of_nonneg (samplingTransportDensity_bounds h p.1 p.2 hh.le hh1 hp.1.le hp.2).1] + exact (samplingTransportDensity_bounds h p.1 p.2 hh.le hh1 hp.1.le hp.2).2.1) + have hswap := integral_integral_swap (f := fun v s => samplingTransportDensity v s) hqi + calc + _ = ∫ v, (∫ s, samplingTransportDensity v s ∂unitIntervalMeasure) ∂samplingVelocityMeasure h := hswap.symm + _ = ∫ _v, (1 : ℝ) ∂samplingVelocityMeasure h := integral_congr_ae + (hv.mono (fun v hv => samplingTransportDensity_integral v hv.1.le (hv.2.trans_lt hh1))) + _ = 1 := by simp + +/-- The source's quadratic cancellation for the actual averaged uncut +transport density. The exact mass-one identity eliminates the linear term. -/ +theorem samplingIdealSecond_square (h : ℝ) (hh : 0 < h) (hh1 : h < 1) : + (∫ s, samplingIdealSecond h s^2 ∂unitIntervalMeasure) = + 1+(∫ s, (samplingIdealSecond h s-1)^2 ∂unitIntervalMeasure) ∧ + (∫ s, samplingIdealSecond h s^2 ∂unitIntervalMeasure) ≤ 1+h^2/(1-h)^2 := by + let q := samplingIdealSecond h + let C := h/(1-h) + have hC : 0 ≤ C := by dsimp [C]; positivity + have hm := samplingIdealSecond_measurable h hh + have hqi : Integrable q unitIntervalMeasure := + (integrable_const (1/(1-h))).mono' hm.aestronglyMeasurable (Eventually.of_forall (fun s => by + rw [Real.norm_eq_abs,abs_of_nonneg (samplingIdealSecond_bounds h s hh hh1).1] + exact (samplingIdealSecond_bounds h s hh hh1).2.1)) + have hdev (s : ℝ) : (q s-1)^2 ≤ C^2 := by + have hb := abs_le.mp (samplingIdealSecond_bounds h s hh hh1).2.2 + dsimp [C,q] + nlinarith + have hdi : Integrable (fun s => (q s-1)^2) unitIntervalMeasure := + (integrable_const (C^2)).mono' (by fun_prop) (Eventually.of_forall (fun s => by + rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)] + exact hdev s)) + have heq : (fun s => q s^2) = (fun s => ((q s-1)^2+2*q s)-1) := by funext s; ring + have hmass : (∫ s, q s ∂unitIntervalMeasure) = 1 := samplingIdealSecond_integral h hh hh1 + have he : (∫ s, q s^2 ∂unitIntervalMeasure) = 1+∫ s, (q s-1)^2 ∂unitIntervalMeasure := by + rw [heq] + have hsum : Integrable (fun s => (q s-1)^2+2*q s) unitIntervalMeasure := hdi.add (hqi.const_mul 2) + rw [integral_sub hsum (integrable_const 1),integral_add hdi (hqi.const_mul 2),integral_const_mul,hmass] + simp + ring + refine ⟨he,?_⟩ + have hu := integral_mono_ae hdi (integrable_const (C^2)) (Eventually.of_forall hdev) + simp at hu + have hCeq : C^2 = h^2/(1-h)^2 := by dsimp [C]; rw [div_pow] + rw [he] + linarith + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/SecondTriangular.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondTriangular.lean new file mode 100644 index 0000000000000000000000000000000000000000..700880518df0795742c4276d8aa63db4aa10a895 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/SecondTriangular.lean @@ -0,0 +1,94 @@ +import OAI.Analysis.FiniteFactor.Sampling.FirstDiscrepancy +import OAI.Analysis.FiniteFactor.Sampling.OrientedMoments + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped Classical +noncomputable section + +/-- The triangular second orientation has one reflected interval of phases. -/ +theorem samplingSecondTriangular_interval (h α : ℝ) (G : Set ℝ) (a c s t : ℝ) + (hs : s ∈ Set.Ico (0 : ℝ) 1) (ht : t ∈ Set.Ico (0 : ℝ) 1) : + samplingOrientedWeight true true h α (Set.Icc a c) G s t = + (Set.Ioc 0 s ∩ Set.Icc (s-c) (s-a)).indicator (fun _ => if s ∈ G then (1 : ℝ) else 0) t := by + by_cases hts : t ≤ s + · have hf : Int.fract (s-t) = s-t := Int.fract_eq_self.mpr ⟨by linarith,by linarith [hs.2,ht.1]⟩ + simp only [samplingOrientedWeight,ite_true,samplingWeight,hf, + Set.indicator,Set.mem_inter_iff,Set.mem_Ioc,Set.mem_Icc] + split_ifs <;> simp_all <;> grind + · have hst : s-t < 0 := by linarith + have hfloor : ⌊s-t⌋ = (-1 : ℤ) := Int.floor_eq_iff.mpr + ⟨by norm_num; linarith [hs.1,ht.2],by norm_num; linarith⟩ + have hf : Int.fract (s-t) = s-t+1 := by rw [Int.fract,hfloor]; norm_num + simp only [samplingOrientedWeight,ite_true,samplingWeight,hf, + Set.indicator,Set.mem_inter_iff,Set.mem_Ioc,Set.mem_Icc] + split_ifs <;> simp_all + grind + +/-- Reflection identifies the actual triangular second weight with a first +weight. This equality concerns values; it introduces no new random law. -/ +theorem samplingSecondTriangular_reflect (h α : ℝ) (G : Set ℝ) (a c s t : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (hs : s ∈ Set.Ioo (0 : ℝ) 1) (ht : t ∈ Set.Ico (0 : ℝ) 1) (hts : t ≠ s) : + samplingOrientedWeight true true h α (Set.Icc a c) G s t = + samplingTestedFirstWeight true h α (if s ∈ G then Set.univ else ∅) + (Set.Icc (1-c) (1-a)) (1-s) t := by + rw [samplingSecondTriangular_interval h α G a c s t ⟨hs.1.le,hs.2⟩ ht, + samplingTestedFirstWeight_interval true h α (if s ∈ G then Set.univ else ∅) + (1-c) (1-a) (1-s) t hh hh1 hα ⟨by linarith [hs.2],by linarith [hs.1]⟩] + have h1 : 1-(1-s) = s := by ring + have h2 : (1-c)-(1-s) = s-c := by ring + have h3 : (1-a)-(1-s) = s-a := by ring + simp only [samplingFirstLength,samplingFirstHeight,ite_true,h1,h2,h3] + simp only [Set.indicator,Set.mem_inter_iff,Set.mem_Ioc,Set.mem_Ioo,Set.mem_Icc] + by_cases hG : s ∈ G <;> simp only [hG,ite_true,ite_false,Set.mem_univ,Set.notMem_empty] + all_goals split_ifs <;> simp_all <;> grind + +/-- Rectangle discrepancy controls the remaining triangular second case. -/ +theorem samplingSecondTriangular_pair_bound {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X Y : Ω → ℝ) + (hX : Measurable X) (hY : Measurable Y) + [NullSingletonClass (μ.map X)] [NullSingletonClass (μ.map Y)] + (hXs : ∀ᵐ x ∂μ, X x ∈ Set.Ico (0 : ℝ) 1) + (hYs : ∀ᵐ x ∂μ, Y x ∈ Set.Ico (0 : ℝ) 1) + (δ : ℝ) (hδ : 0 ≤ δ) (hrect : ∀ a b c d : ℝ, + |(μ {x | X x ∈ Set.Icc a b ∧ Y x ∈ Set.Icc c d}).toReal - + (unitIntervalMeasure (Set.Icc a b)).toReal*(unitIntervalMeasure (Set.Icc c d)).toReal| ≤ δ) + (h α : ℝ) (G : Set ℝ) (a c s : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hs : s ∈ Set.Ioo (0 : ℝ) 1) : + |(∫ x, samplingOrientedWeight true true h α (Set.Icc a c) G s (X x)* + samplingOrientedWeight true true h α (Set.Icc a c) G s (Y x) ∂μ)- + samplingOrientedDensity true true h α (Set.Icc a c) G s^2| ≤ δ := by + have he := samplingSecondTriangular_reflect h α G a c s + have hp : (∫ x, samplingOrientedWeight true true h α (Set.Icc a c) G s (X x)* + samplingOrientedWeight true true h α (Set.Icc a c) G s (Y x) ∂μ) = + ∫ x, samplingTestedFirstWeight true h α (if s ∈ G then Set.univ else ∅) + (Set.Icc (1-c) (1-a)) (1-s) (X x)* + samplingTestedFirstWeight true h α (if s ∈ G then Set.univ else ∅) + (Set.Icc (1-c) (1-a)) (1-s) (Y x) ∂μ := by + apply integral_congr_ae + have hxne : ∀ᵐ x ∂μ, X x ≠ s := ae_of_ae_map hX.aemeasurable + (ae_iff.mpr (show (μ.map X) {t | ¬t ≠ s} = 0 by simp)) + have hyne : ∀ᵐ x ∂μ, Y x ≠ s := ae_of_ae_map hY.aemeasurable + (ae_iff.mpr (show (μ.map Y) {t | ¬t ≠ s} = 0 by simp)) + filter_upwards [hXs,hYs,hxne,hyne] with x hx hy hxn hyn + rw [he (X x) hh hh1 hα hs hx hxn,he (Y x) hh hh1 hα hs hy hyn] + have hm : samplingOrientedDensity true true h α (Set.Icc a c) G s = + samplingTestedFirstDensity true h α (if s ∈ G then Set.univ else ∅) + (Set.Icc (1-c) (1-a)) (1-s) := by + apply integral_congr_ae + have : NullSingletonClass unitIntervalMeasure := by unfold unitIntervalMeasure; infer_instance + filter_upwards [self_mem_ae_restrict measurableSet_Ico, + ae_iff.mpr (show unitIntervalMeasure {t | ¬t ≠ s} = 0 by simp)] with t ht hts + exact he t hh hh1 hα hs ht hts + rw [hp,hm] + apply (samplingTestedFirst_pair_bound μ X Y hX hY δ hrect true h α _ + (1-c) (1-a) (1-s) hh hh1 hα ⟨by linarith [hs.2],by linarith [hs.1]⟩).trans + by_cases hG : s ∈ G <;> simp [hG,samplingFirstHeight,hδ] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/Selection.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/Selection.lean new file mode 100644 index 0000000000000000000000000000000000000000..f354d75de53753fc9cffeef054bc4447b4e028f5 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/Selection.lean @@ -0,0 +1,130 @@ +import Mathlib.Data.Finset.Card +import Mathlib.Data.Finset.Max +import Mathlib.Data.Int.Interval +import Mathlib.Algebra.BigOperators.Group.Finset.Basic +import Mathlib.Tactic.Linarith +import Mathlib.Algebra.Order.Ring.Abs +import Mathlib.Algebra.Order.BigOperators.Group.Finset +import Mathlib.Data.Set.Pairwise.Basic + +namespace OAI + +namespace FiniteFactor +open Finset + +/-- Finite greedy packing, with the precise loss supplied by forbidden neighbors. -/ +theorem finite_greedy_packing {α : Type*} [DecidableEq α] (bad : α → α → Prop) + [DecidableRel bad] (symm : ∀ a b, bad a b → bad b a) + (refl : ∀ a, bad a a) (S : Finset α) (D : ℕ) + (bound : ∀ a ∈ S, (S.filter (bad a)).card ≤ D) : + ∃ N ⊆ S, (N : Set α).Pairwise (fun a b => ¬bad a b) ∧ S.card ≤ D*N.card := by + classical + induction S using Finset.strongInductionOn with + | _ S ih => + by_cases hs : S = ∅ + · subst S; exact ⟨∅, by simp, by simp, by simp⟩ + obtain ⟨a, ha⟩ := Finset.nonempty_iff_ne_empty.mpr hs + let T := S.filter (fun b => ¬bad a b) + have hTa : a ∉ T := by simp [T, refl] + have hTS : T ⊂ S := Finset.ssubset_iff_subset_ne.mpr + ⟨filter_subset _ _, fun h => hTa (h.symm ▸ ha)⟩ + obtain ⟨N,hNT,hN,hcard⟩ := ih T hTS (fun b hb => + (card_le_card (filter_subset_filter _ (filter_subset _ _))).trans (bound b (mem_of_mem_filter b hb))) + have haN : a ∉ N := fun h => hTa (hNT h) + refine ⟨insert a N, insert_subset ha (hNT.trans (filter_subset _ _)), ?_, ?_⟩ + · rw [coe_insert, Set.pairwise_insert_of_notMem haN] + refine ⟨hN, ?_⟩ + intro b hb + constructor + · exact (mem_filter.mp (hNT hb)).2 + · intro h; exact (mem_filter.mp (hNT hb)).2 (symm b a h) + · have hsplit : (S.filter (bad a)).card + T.card = S.card := by + exact card_filter_add_card_filter_not (s := S) (bad a) + rw [card_insert_of_notMem haN] + have := bound a ha + rw [Nat.mul_add, Nat.mul_one] + omega + +/-- A fixed nonzero second frequency excludes at most 2R+1 integers. -/ +theorem forbidden_frequency_card (S : Finset ℤ) (v v' n : ℤ) (R : ℕ) (hv' : v' ≠ 0) : + (S.filter (fun n' => |v*n+v'*n'| ≤ (R : ℤ))).card ≤ 2*R+1 := by + have h := card_le_card_of_injOn (fun n' : ℤ => v*n+v'*n') + (s := S.filter (fun n' => |v*n+v'*n'| ≤ (R : ℤ))) + (t := Finset.Icc (-(R : ℤ)) (R : ℤ)) + (fun n' hn' => Finset.mem_Icc.mpr (abs_le.mp (mem_filter.mp hn').2)) + (fun a _ b _ he => mul_left_cancel₀ hv' (add_left_cancel he)) + have hc : (Finset.Icc (-(R : ℤ)) (R : ℤ)).card = 2*R+1 := by + rw [Int.card_Icc] + omega + exact h.trans_eq hc + +/-- Failure of the full symmetric bounded-frequency separation condition. -/ +def SamplingConflict (H R : ℕ) (n n' : ℤ) : Prop := + ∃ v ∈ Finset.Icc (-(H : ℤ)) (H : ℤ), + ∃ v' ∈ Finset.Icc (-(H : ℤ)) (H : ℤ), + (v ≠ 0 ∨ v' ≠ 0) ∧ |v*n+v'*n'| ≤ (R : ℤ) + +instance (H R : ℕ) : DecidableRel (SamplingConflict H R) := fun _ _ => + inferInstanceAs (Decidable (∃ v ∈ Finset.Icc (-(H : ℤ)) (H : ℤ), + ∃ v' ∈ Finset.Icc (-(H : ℤ)) (H : ℤ), _)) + +theorem samplingConflict_symm (H R : ℕ) (n n' : ℤ) : + SamplingConflict H R n n' → SamplingConflict H R n' n := by + rintro ⟨v,hv,v',hv',hne,hb⟩ + exact ⟨v',hv',v,hv,hne.symm,by simpa [add_comm] using hb⟩ + +theorem samplingConflict_refl (H R : ℕ) (hH : 1 ≤ H) (n : ℤ) : + SamplingConflict H R n n := by + refine ⟨1, mem_Icc.mpr ?_, -1, mem_Icc.mpr ?_, Or.inl (by omega), ?_⟩ + · constructor <;> omega + · constructor <;> omega + · simp + +/-- Total forbidden-neighbor count, with no unspecified asymptotic constant. -/ +theorem samplingConflict_card (H R : ℕ) (S : Finset ℤ) (n : ℤ) (hn : (R : ℤ) < n) : + (S.filter (SamplingConflict H R n)).card ≤ (2*H+1)^2*(2*R+1) := by + let F := (Finset.Icc (-(H : ℤ)) (H : ℤ)).product + ((Finset.Icc (-(H : ℤ)) (H : ℤ)).filter (fun v => v ≠ 0)) + let B := fun p : ℤ × ℤ => S.filter (fun n' => |p.1*n+p.2*n'| ≤ (R : ℤ)) + have hsub : S.filter (SamplingConflict H R n) ⊆ F.biUnion B := by + intro n' hn' + obtain ⟨hs,v,hv,v',hv',hne,hb⟩ := mem_filter.mp hn' + have hv'0 : v' ≠ 0 := by + intro he + subst v' + have hv0 := hne.resolve_right (by simp) + have hv1 : 1 ≤ |v| := by have := abs_pos.mpr hv0; omega + have hn0 : 0 ≤ n := by omega + simp only [zero_mul, add_zero, abs_mul, abs_of_nonneg hn0] at hb + nlinarith + exact mem_biUnion.mpr ⟨(v,v'), mem_product.mpr ⟨hv,mem_filter.mpr ⟨hv',hv'0⟩⟩, + mem_filter.mpr ⟨hs,hb⟩⟩ + have hF : F.card ≤ (2*H+1)^2 := by + have hc : (Finset.Icc (-(H : ℤ)) (H : ℤ)).card = 2*H+1 := by + rw [Int.card_Icc]; omega + dsimp [F] + rw [card_product] + calc + _ ≤ (Finset.Icc (-(H : ℤ)) (H : ℤ)).card ^ 2 := by + rw [pow_two] + exact Nat.mul_le_mul_left _ (card_filter_le _ _) + _ = _ := by rw [hc] + calc + _ ≤ (F.biUnion B).card := card_le_card hsub + _ ≤ ∑ p ∈ F, (B p).card := card_biUnion_le + _ ≤ ∑ _p ∈ F, (2*R+1) := sum_le_sum fun p hp => + forbidden_frequency_card S p.1 p.2 n R (mem_filter.mp (mem_product.mp hp).2).2 + _ = F.card*(2*R+1) := by simp + _ ≤ _ := Nat.mul_le_mul_right _ hF + +/-- Deterministic selection from any positive integer interval above R. -/ +theorem exists_sampling_separated (H R : ℕ) (hH : 1 ≤ H) (S : Finset ℤ) + (hS : ∀ n ∈ S, (R : ℤ) < n) : + ∃ N ⊆ S, (N : Set ℤ).Pairwise (fun n n' => ¬SamplingConflict H R n n') ∧ + S.card ≤ ((2*H+1)^2*(2*R+1))*N.card := + finite_greedy_packing (SamplingConflict H R) (samplingConflict_symm H R) + (samplingConflict_refl H R hH) S _ (fun n hn => samplingConflict_card H R S n (hS n hn)) + +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/SelfMoment.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/SelfMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7516f2f78f2ef3a7238c17cb8617821023f97f5 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/SelfMoment.lean @@ -0,0 +1,97 @@ +import OAI.Analysis.FiniteFactor.Sampling.TestedFirstMoment +import Mathlib.Analysis.SpecialFunctions.Integrals.Basic + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +noncomputable section + +/-- Squaring the constant-height slice leaves its reciprocal interval length. -/ +theorem samplingWeight_square_slice (h α s : ℝ) (hh : 0 < h) (hh1 : h < 1) + (hα : 0 < α) (hs : s ∈ Set.Ico (0 : ℝ) 1) : + (∫ t, samplingWeight false h α s t ^ 2 ∂unitIntervalMeasure) = + if α ≤ samplingDistance s then 1/(h*samplingDistance s) else 0 := by + have he : (fun t => samplingWeight false h α s t ^ 2) = + fun t => (1/(h*samplingDistance s))*samplingWeight false h α s t := by + funext t + unfold samplingWeight + simp only [Bool.false_eq_true,ite_false] + split_ifs <;> ring + rw [he,integral_const_mul,samplingWeight_first_integral false h α s hh hh1 hα hs] + simp only [Bool.false_eq_true,ite_false] + split_ifs <;> simp + +/-- Exact logarithmic integral of the cutoff reciprocal distance. -/ +theorem samplingDistance_cutoff_integral (α : ℝ) (hα : 0 < α) (hα1 : α ≤ 1/2) : + (∫ s, (if α ≤ samplingDistance s then (samplingDistance s)⁻¹ else 0) + ∂unitIntervalMeasure) = 2*Real.log (1/(2*α)) := by + have hab : α ≤ 1-α := by linarith + have hset : {s | α ≤ samplingDistance s} = Set.Icc α (1-α) := by + ext s + simp only [Set.mem_ofPred_eq,samplingDistance,le_min_iff,Set.mem_Icc] + constructor <;> intro hs <;> constructor <;> linarith [hs.1,hs.2] + have he : (fun s => if α ≤ samplingDistance s then (samplingDistance s)⁻¹ else 0) = + (Set.Icc α (1-α)).indicator (fun s => (samplingDistance s)⁻¹) := by + rw [← hset] + rfl + rw [he,integral_indicator measurableSet_Icc] + unfold unitIntervalMeasure + rw [Measure.restrict_restrict measurableSet_Icc,Set.inter_eq_left.mpr (show + Set.Icc α (1-α) ⊆ Set.Ico (0 : ℝ) 1 from fun s hs => ⟨hα.le.trans hs.1,by linarith [hs.2]⟩), + integral_Icc_eq_integral_Ioc,← intervalIntegral.integral_of_le hab] + have hc : ContinuousOn (fun s => (samplingDistance s)⁻¹) (Set.Icc α (1-α)) := by + apply ContinuousOn.inv₀ (by unfold samplingDistance; fun_prop) + intro s hs + have hd : 0 < samplingDistance s := lt_min (hα.trans_le hs.1) (by linarith [hs.2]) + exact hd.ne' + have hi : IntervalIntegrable (fun s => (samplingDistance s)⁻¹) volume α (1-α) := hc.intervalIntegrable_of_Icc hab + have hleft : IntervalIntegrable (fun s => (samplingDistance s)⁻¹) volume α (1/2) := + hi.mono_set (by rw [Set.uIcc_of_le hα1,Set.uIcc_of_le hab]; intro s hs; exact ⟨hs.1,by linarith [hs.2]⟩) + have hright : IntervalIntegrable (fun s => (samplingDistance s)⁻¹) volume (1/2) (1-α) := + hi.mono_set (by rw [Set.uIcc_of_le (show (1/2 : ℝ) ≤ 1-α by linarith),Set.uIcc_of_le hab]; intro s hs; exact ⟨by linarith [hs.1],hs.2⟩) + rw [← intervalIntegral.integral_add_adjacent_intervals hleft hright] + have hl : (∫ s in α..(1/2 : ℝ), (samplingDistance s)⁻¹) = Real.log ((1/2)/α) := by + calc + _ = ∫ s in α..(1/2 : ℝ), s⁻¹ := by + apply intervalIntegral.integral_congr + rw [Set.uIcc_of_le hα1] + intro s hs + change (min s (1-s))⁻¹ = s⁻¹ + rw [min_eq_left (by linarith [hs.2])] + _ = _ := integral_inv_of_pos hα (by norm_num) + have hr : (∫ s in (1/2 : ℝ)..(1-α), (samplingDistance s)⁻¹) = Real.log ((1/2)/α) := by + calc + _ = ∫ s in (1/2 : ℝ)..(1-α), (1-s)⁻¹ := by + apply intervalIntegral.integral_congr + rw [Set.uIcc_of_le (show (1/2 : ℝ) ≤ 1-α by linarith)] + intro s hs + change (min s (1-s))⁻¹ = (1-s)⁻¹ + rw [min_eq_right (by linarith [hs.1])] + _ = ∫ s in α..(1/2 : ℝ), s⁻¹ := by + rw [intervalIntegral.integral_comp_sub_left (fun s : ℝ => s⁻¹) 1] + norm_num + _ = _ := integral_inv_of_pos hα (by norm_num) + rw [hl,hr,show (1/2 : ℝ)/α = 1/(2*α) by ring] + ring + +theorem samplingWeight_square_integral (h α : ℝ) (hh : 0 < h) (hh1 : h < 1) + (hα : 0 < α) (hα1 : α ≤ 1/2) : + (∫ s, ∫ t, samplingWeight false h α s t ^ 2 + ∂unitIntervalMeasure ∂unitIntervalMeasure) = (2/h)*Real.log (1/(2*α)) := by + calc + _ = ∫ s, (1/h)*(if α ≤ samplingDistance s then (samplingDistance s)⁻¹ else 0) + ∂unitIntervalMeasure := by + apply integral_congr_ae + filter_upwards [show ∀ᵐ s ∂unitIntervalMeasure, s ∈ Set.Ico (0 : ℝ) 1 from + ae_restrict_mem measurableSet_Ico] with s hs + rw [samplingWeight_square_slice h α s hh hh1 hα hs] + split_ifs <;> simp [div_eq_mul_inv,mul_comm] + _ = _ := by + rw [integral_const_mul,samplingDistance_cutoff_integral α hα hα1] + ring + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/SmoothedPair.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/SmoothedPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..728c2a2048852bc472ecf92b01adf9834a30d231 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/SmoothedPair.lean @@ -0,0 +1,90 @@ +import OAI.Analysis.FiniteFactor.Sampling.FourierSum + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Finset +noncomputable section + +/-- The finite kernel index form, with total coefficient absolute sum at most H. -/ +theorem samplingSmooth_index_expansion (H : ℕ) (E : Set ℝ) (t : ℝ) : + (samplingSmooth H E t : ℂ) = (H : ℂ)⁻¹ * + ∑ p ∈ (Finset.range H).product (Finset.range H), + samplingIntervalCoefficient E ((p.1 : ℤ)-(p.2 : ℤ)) * + samplingCharacter ((p.1 : ℤ)-(p.2 : ℤ)) t := by + rw [samplingSmooth_expansion, Finset.product_eq_sprod, sum_product] + congr 1 + apply sum_congr rfl + intro r hr + apply sum_congr rfl + intro q hq + exact mul_comm _ _ + +theorem samplingSmooth_constant_sum (H : ℕ) (E : Set ℝ) : + (∑ p ∈ (Finset.range H).product (Finset.range H), + if (p.1 : ℤ)-(p.2 : ℤ) = 0 then + samplingIntervalCoefficient E ((p.1 : ℤ)-(p.2 : ℤ)) else 0) = + (H : ℂ)*((unitIntervalMeasure E).toReal : ℂ) := by + simp [sum_product, sub_eq_zero, -Finset.mem_range, samplingIntervalCoefficient_zero] + +/-- Quantitative smoothed rectangle estimate, with the actual joint Fourier +bound as the only dependence assumption. -/ +theorem samplingSmooth_pair_error {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsProbabilityMeasure μ] (X Y : Ω → ℝ) + (hX : Measurable X) (hY : Measurable Y) (H : ℕ) (hH : 0 < H) + (E E' : Set ℝ) (ε : ℝ) (hε : 0 ≤ ε) + (hFourier : ∀ v w : ℤ, |v| < (H : ℤ) → |w| < (H : ℤ) → + (v ≠ 0 ∨ w ≠ 0) → + ‖∫ θ, samplingCharacter v (X θ)*samplingCharacter w (Y θ) ∂μ‖ ≤ ε) : + ‖(∫ θ, (samplingSmooth H E (X θ) : ℂ)*(samplingSmooth H E' (Y θ) : ℂ) ∂μ) - + ((unitIntervalMeasure E).toReal : ℂ)*((unitIntervalMeasure E').toReal : ℂ)‖ ≤ + (H : ℝ)^2*ε := by + let F := (Finset.range H).product (Finset.range H) + let v := fun p : ℕ × ℕ => (p.1 : ℤ)-(p.2 : ℤ) + let A := fun p => samplingIntervalCoefficient E (v p) + let B := fun p => samplingIntervalCoefficient E' (v p) + let P := fun t => ∑ p ∈ F, A p*samplingCharacter (v p) t + let Q := fun t => ∑ p ∈ F, B p*samplingCharacter (v p) t + have hfreq (p : ℕ × ℕ) (hp : p ∈ F) : |v p| < (H : ℤ) := by + obtain ⟨hp,hq⟩ := mem_product.mp hp + have hp' := mem_range.mp hp + have hq' := mem_range.mp hq + dsimp [v] + rw [abs_lt] + constructor <;> omega + have hh := samplingFourier_sum_error μ X Y hX hY F F v v A B + (fun p hp => samplingIntervalCoefficient_norm E (v p)) + (fun p hp => samplingIntervalCoefficient_norm E' (v p)) ε hε + (fun p hp q hq hn => hFourier (v p) (v q) (hfreq p hp) (hfreq q hq) hn) + have ha : (∑ p ∈ F, if v p = 0 then A p else 0) = + (H : ℂ)*((unitIntervalMeasure E).toReal : ℂ) := samplingSmooth_constant_sum H E + have hb : (∑ p ∈ F, if v p = 0 then B p else 0) = + (H : ℂ)*((unitIntervalMeasure E').toReal : ℂ) := samplingSmooth_constant_sum H E' + rw [ha,hb] at hh + change ‖(∫ θ, P (X θ)*Q (Y θ) ∂μ) - _‖ ≤ _ at hh + have hmain : (∫ θ, (samplingSmooth H E (X θ) : ℂ)*(samplingSmooth H E' (Y θ) : ℂ) ∂μ) = + (H : ℂ)⁻¹^2 * ∫ θ, P (X θ)*Q (Y θ) ∂μ := by + simp_rw [samplingSmooth_index_expansion] + change (∫ θ, ((H : ℂ)⁻¹*P (X θ))*((H : ℂ)⁻¹*Q (Y θ)) ∂μ) = _ + have he (θ : Ω) : ((H : ℂ)⁻¹*P (X θ))*((H : ℂ)⁻¹*Q (Y θ)) = + (H : ℂ)⁻¹^2*(P (X θ)*Q (Y θ)) := by ring + simp_rw [he] + exact integral_const_mul _ _ + have hHC : (H : ℂ) ≠ 0 := by exact_mod_cast hH.ne' + have hHR : (H : ℝ) ≠ 0 := by exact_mod_cast hH.ne' + have hz : (H : ℂ)⁻¹^2*((H : ℂ)*((unitIntervalMeasure E).toReal : ℂ)* + ((H : ℂ)*((unitIntervalMeasure E').toReal : ℂ))) = + ((unitIntervalMeasure E).toReal : ℂ)*((unitIntervalMeasure E').toReal : ℂ) := by + field_simp + rw [hmain, ← hz, ← mul_sub, norm_mul] + calc + _ ≤ ‖(H : ℂ)⁻¹^2‖*((F.card : ℝ)*(F.card : ℝ)*ε) := + mul_le_mul_of_nonneg_left hh (norm_nonneg _) + _ = _ := by + simp only [F, Finset.product_eq_sprod, card_product, card_range, Nat.cast_mul, norm_pow, norm_inv, Complex.norm_natCast] + field_simp + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/Smoothing.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/Smoothing.lean new file mode 100644 index 0000000000000000000000000000000000000000..25135ed5ff5c6c9b9cf1034d238f442c9c7950d1 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/Smoothing.lean @@ -0,0 +1,101 @@ +import OAI.Analysis.FiniteFactor.Sampling.KernelTail + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Finset +open scoped ComplexConjugate ENNReal +noncomputable section + +theorem samplingCharacter_sub_argument (v : ℤ) (t u : ℝ) : + samplingCharacter v (t-u) = samplingCharacter v t * samplingCharacter (-v) u := by + unfold samplingCharacter + rw [← Complex.exp_add] + congr 1 + push_cast + ring + +theorem samplingCharacter_fract (v : ℤ) (t : ℝ) : + samplingCharacter v (Int.fract t) = samplingCharacter v t := by + simpa only [samplingCharacter, mul_assoc] using fourier_fract v t + +theorem samplingKernel_fract (H : ℕ) (t : ℝ) : + samplingKernel H (Int.fract t) = samplingKernel H t := by + simp only [samplingKernel, samplingCharacter_fract] + +theorem samplingKernel_shift_integral (H : ℕ) (hH : 0 < H) (t : ℝ) : + (∫ u, samplingKernel H (t-u) ∂unitIntervalMeasure) = 1 := by + have hc : (∫ u, (samplingKernel H (t-u) : ℂ) ∂unitIntervalMeasure) = 1 := by + simp_rw [samplingKernel_expansion, samplingCharacter_sub_argument] + rw [integral_const_mul, integral_finsetSum _ (fun r _ => + integrable_finsetSum _ (fun q _ => (samplingCharacter_integrable _).const_mul _))] + simp_rw [integral_finsetSum _ (fun q _ => (samplingCharacter_integrable _).const_mul _), + integral_const_mul, samplingCharacter_integral] + simp [sub_eq_zero, -Finset.mem_range, hH.ne', samplingCharacter_zero] + rw [integral_complex_ofReal] at hc + exact_mod_cast hc + +def samplingSmooth (H : ℕ) (E : Set ℝ) (t : ℝ) : ℝ := + ∫ u in E, samplingKernel H (t-u) ∂unitIntervalMeasure + +def samplingIntervalCoefficient (E : Set ℝ) (v : ℤ) : ℂ := + ∫ u in E, samplingCharacter (-v) u ∂unitIntervalMeasure + +theorem samplingSmooth_bounds (H : ℕ) (hH : 0 < H) (E : Set ℝ) (t : ℝ) : + 0 ≤ samplingSmooth H E t ∧ samplingSmooth H E t ≤ 1 := by + have hki : Integrable (fun u => samplingKernel H (t-u)) unitIntervalMeasure := + ((samplingKernel_continuous H).comp (continuous_const.sub continuous_id)).integrableOn_Icc.mono_set + Set.Ico_subset_Icc_self + constructor + · exact integral_nonneg (fun u => samplingKernel_nonneg H (t-u)) + · calc + _ ≤ ∫ u, samplingKernel H (t-u) ∂unitIntervalMeasure := + integral_mono_measure Measure.restrict_le_self + (Filter.Eventually.of_forall (fun u => samplingKernel_nonneg H (t-u))) hki + _ = 1 := samplingKernel_shift_integral H hH t + +theorem samplingIntervalCoefficient_zero (E : Set ℝ) : + samplingIntervalCoefficient E 0 = ((unitIntervalMeasure E).toReal : ℂ) := by + simp [samplingIntervalCoefficient, samplingCharacter_zero, measureReal_def] + +theorem samplingIntervalCoefficient_norm (E : Set ℝ) (v : ℤ) : + ‖samplingIntervalCoefficient E v‖ ≤ 1 := by + unfold samplingIntervalCoefficient + calc + _ ≤ ∫ u in E, ‖samplingCharacter (-v) u‖ ∂unitIntervalMeasure := norm_integral_le_integral_norm _ + _ = (unitIntervalMeasure E).toReal := by simp [samplingCharacter_norm, measureReal_def] + _ ≤ 1 := by + have hh : unitIntervalMeasure E ≤ 1 := + (measure_mono (Set.subset_univ E)).trans_eq (measure_univ) + simpa using ENNReal.toReal_mono (by norm_num : (1 : ℝ≥0∞) ≠ ∞) hh + +/-- An actual finite Fourier expansion of the smoothed interval indicator. +Keeping the two kernel indices avoids assuming a coefficient formula. -/ +theorem samplingSmooth_expansion (H : ℕ) (E : Set ℝ) (t : ℝ) : + (samplingSmooth H E t : ℂ) = (H : ℂ)⁻¹ * + ∑ r ∈ Finset.range H, ∑ q ∈ Finset.range H, + samplingCharacter ((r : ℤ)-(q : ℤ)) t * + samplingIntervalCoefficient E ((r : ℤ)-(q : ℤ)) := by + rw [samplingSmooth, ← integral_complex_ofReal] + simp_rw [samplingKernel_expansion, samplingCharacter_sub_argument] + rw [integral_const_mul, integral_finsetSum _ (fun r _ => + integrable_finsetSum _ (fun q _ => ((samplingCharacter_integrable _).restrict).const_mul _))] + simp_rw [integral_finsetSum _ (fun q _ => ((samplingCharacter_integrable _).restrict).const_mul _), + integral_const_mul] + rfl + +theorem samplingSmooth_continuous (H : ℕ) (E : Set ℝ) : Continuous (samplingSmooth H E) := by + have hc : Continuous (fun t => (samplingSmooth H E t : ℂ)) := by + simp_rw [samplingSmooth_expansion] + apply Continuous.const_mul + apply continuous_finsetSum + intro r hr + apply continuous_finsetSum + intro q hq + exact (samplingCharacter_continuous _).mul_const _ + simpa only [Function.comp_def, Complex.ofReal_re] using Complex.continuous_re.comp hc + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/SmoothingLaw.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/SmoothingLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a60d7830153256f5563a510231868c506a9c0d0 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/SmoothingLaw.lean @@ -0,0 +1,105 @@ +import OAI.Analysis.FiniteFactor.Sampling.IntervalError +import OAI.Analysis.FiniteFactor.CrossedProduct.PhaseMarginal + +namespace OAI + +namespace FiniteFactor +open MeasureTheory +open scoped ENNReal +noncomputable section + +def samplingBoundary (a b δ : ℝ) : Set ℝ := + (Set.Icc δ (1-δ))ᶜ ∪ Set.Icc (a-δ) (a+δ) ∪ Set.Icc (b-δ) (b+δ) + +theorem samplingBoundary_measurable (a b δ : ℝ) : MeasurableSet (samplingBoundary a b δ) := + (measurableSet_Icc.compl.union measurableSet_Icc).union measurableSet_Icc + +theorem samplingBoundary_measure (a b δ : ℝ) (hδ : 0 ≤ δ) : + unitIntervalMeasure (samplingBoundary a b δ) ≤ ENNReal.ofReal (6*δ) := by + have hband (a : ℝ) : unitIntervalMeasure (Set.Icc (a-δ) (a+δ)) ≤ ENNReal.ofReal (2*δ) := by + calc + _ ≤ volume (Set.Icc (a-δ) (a+δ)) := Measure.restrict_le_self _ + _ = _ := by rw [Real.volume_Icc]; congr 1; ring + calc + _ ≤ unitIntervalMeasure ((Set.Icc δ (1-δ))ᶜ ∪ Set.Icc (a-δ) (a+δ)) + + unitIntervalMeasure (Set.Icc (b-δ) (b+δ)) := measure_union_le _ _ + _ ≤ unitIntervalMeasure (Set.Icc δ (1-δ))ᶜ + + unitIntervalMeasure (Set.Icc (a-δ) (a+δ)) + + unitIntervalMeasure (Set.Icc (b-δ) (b+δ)) := by gcongr; exact measure_union_le _ _ + _ ≤ ENNReal.ofReal (2*δ) + ENNReal.ofReal (2*δ) + ENNReal.ofReal (2*δ) := by + gcongr + · exact unitInterval_middle_compl δ hδ + · exact hband a + · exact hband b + _ = _ := by rw [← ENNReal.ofReal_add (by positivity) (by positivity), + ← ENNReal.ofReal_add (by positivity) (by positivity)]; congr 1; ring + +theorem samplingSmooth_indicator_error_le_one (H : ℕ) (hH : 0 < H) (E : Set ℝ) (t : ℝ) : + |samplingSmooth H E t - E.indicator (fun _ => (1 : ℝ)) t| ≤ 1 := by + have h := samplingSmooth_bounds H hH E t + by_cases ht : t ∈ E + · rw [Set.indicator_of_mem ht] + exact abs_le.mpr ⟨by linarith [h.1], by linarith [h.2]⟩ + · rw [Set.indicator_of_notMem ht, sub_zero, abs_of_nonneg h.1] + exact h.2 + +/-- The interval smoothing error integrated under any actual phase law with +density bounded by two. Only one-dimensional domination is used. -/ +theorem samplingSmooth_expected_error (ν : Measure ℝ) [IsProbabilityMeasure ν] + (hν : ν ≤ (2 : ℝ≥0∞) • unitIntervalMeasure) (H : ℕ) (hH : 0 < H) + (a b δ : ℝ) (hδ : 0 < δ) : + (∫ t, |samplingSmooth H (Set.Icc a b) t - + (Set.Icc a b).indicator (fun _ => (1 : ℝ)) t| ∂ν) ≤ + 12*δ + 1/(4*(H : ℝ)*δ^2) := by + let E := Set.Icc a b + let B := samplingBoundary a b δ + let C := 1/(4*(H : ℝ)*δ^2) + let f := fun t => |samplingSmooth H E t - E.indicator (fun _ => (1 : ℝ)) t| + have hC : 0 ≤ C := by dsimp [C]; positivity + have hBm : MeasurableSet B := samplingBoundary_measurable a b δ + have hfm : Measurable f := by + have hi : Measurable (E.indicator (fun _ => (1 : ℝ))) := measurable_const.indicator measurableSet_Icc + simpa only [Real.norm_eq_abs, Pi.sub_apply, f] using ((samplingSmooth_continuous H E).measurable.sub hi).norm + have hfi : Integrable f ν := (integrable_const (1 : ℝ)).mono' hfm.aestronglyMeasurable + (Filter.Eventually.of_forall (fun t => by + rw [Real.norm_eq_abs, abs_of_nonneg (abs_nonneg _)] + exact samplingSmooth_indicator_error_le_one H hH E t)) + have hle (t : ℝ) : f t ≤ B.indicator (fun _ => (1 : ℝ)) t + C := by + by_cases ht : t ∈ B + · rw [Set.indicator_of_mem ht] + exact (samplingSmooth_indicator_error_le_one H hH E t).trans (by linarith) + · rw [Set.indicator_of_notMem ht, zero_add] + have hn := not_or.mp ht + have hn' := not_or.mp hn.1 + have hmid : t ∈ Set.Icc δ (1-δ) := by simpa only [Set.mem_compl_iff, not_not] using hn'.1 + have ha : δ < |t-a| := by + by_contra hh + have hab := abs_le.mp (le_of_not_gt hh) + exact hn'.2 ⟨by linarith [hab.1], by linarith [hab.2]⟩ + have hb : δ < |t-b| := by + by_contra hh + have hab := abs_le.mp (le_of_not_gt hh) + exact hn.2 ⟨by linarith [hab.1], by linarith [hab.2]⟩ + exact samplingSmooth_interval_error H hH a b δ t hδ hmid.1 hmid.2 ha hb + have hBμ : ν B ≤ ENNReal.ofReal (12*δ) := by + calc + _ ≤ ((2 : ℝ≥0∞) • unitIntervalMeasure) B := hν B + _ = 2 * unitIntervalMeasure B := rfl + _ ≤ 2 * ENNReal.ofReal (6*δ) := by gcongr; exact samplingBoundary_measure a b δ hδ.le + _ = _ := by rw [show (2 : ℝ≥0∞) = ENNReal.ofReal 2 by norm_num, + ← ENNReal.ofReal_mul (by norm_num : (0 : ℝ) ≤ 2)]; congr 1; ring + have hBreal : (ν B).toReal ≤ 12*δ := by + have hh := ENNReal.toReal_mono ENNReal.ofReal_ne_top hBμ + rwa [ENNReal.toReal_ofReal (by positivity)] at hh + have hh := integral_mono_ae hfi (((integrable_const (1 : ℝ)).indicator hBm).add (integrable_const C)) + (Filter.Eventually.of_forall hle) + simp only [Pi.add_apply] at hh + rw [integral_add ((integrable_const (1 : ℝ)).indicator hBm) (integrable_const C), integral_indicator hBm] at hh + simp [measureReal_def] at hh + change (∫ t, f t ∂ν) ≤ 12*δ+C + linarith + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/TestedFirstMoment.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/TestedFirstMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..9be72dea472f3cfd03640fd2607ec78e4cb74a60 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/TestedFirstMoment.lean @@ -0,0 +1,90 @@ +import OAI.Analysis.FiniteFactor.Sampling.Weights + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +noncomputable section + +def samplingTestedFirstWeight (b : Bool) (h α : ℝ) (E G : Set ℝ) (s t : ℝ) : ℝ := by + classical + exact if s ∈ E ∧ Int.fract (s+t) ∈ G then samplingWeight b h α s t else 0 + +def samplingTestedFirstDensity (b : Bool) (h α : ℝ) (E G : Set ℝ) (s : ℝ) : ℝ := + ∫ t, samplingTestedFirstWeight b h α E G s t ∂unitIntervalMeasure + +theorem samplingTestedFirstWeight_measurable (b : Bool) (h α : ℝ) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + Measurable (fun p : ℝ × ℝ => samplingTestedFirstWeight b h α E G p.1 p.2) := by + unfold samplingTestedFirstWeight + exact Measurable.ite ((hE.preimage measurable_fst).inter + (hG.preimage (sourceFract_measurable.comp (measurable_fst.add measurable_snd)))) + (samplingWeight_measurable b h α) measurable_const + +theorem samplingTestedFirstWeight_bounds (b : Bool) (h α : ℝ) (E G : Set ℝ) (s t : ℝ) + (hh : 0 < h) (hα : 0 < α) : + 0 ≤ samplingTestedFirstWeight b h α E G s t ∧ + samplingTestedFirstWeight b h α E G s t ≤ samplingWeight b h α s t := by + have hn := (samplingWeight_bounds b h α s t hh hα).1 + unfold samplingTestedFirstWeight + split_ifs <;> simp [hn] + +theorem samplingWeight_integrable (b : Bool) (h α s : ℝ) (hh : 0 < h) (hα : 0 < α) : + Integrable (samplingWeight b h α s) unitIntervalMeasure := by + apply (integrable_const (max 1 (1/(h*α)))).mono' + ((samplingWeight_measurable b h α).comp (measurable_const.prodMk measurable_id)).aestronglyMeasurable + exact Eventually.of_forall (fun t => by + change ‖samplingWeight b h α s t‖ ≤ _ + rw [Real.norm_eq_abs,abs_of_nonneg (samplingWeight_bounds b h α s t hh hα).1] + exact (samplingWeight_bounds b h α s t hh hα).2) + +theorem samplingTestedFirstDensity_measurable (b : Bool) (h α : ℝ) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + Measurable (samplingTestedFirstDensity b h α E G) := + (samplingTestedFirstWeight_measurable b h α E G hE hG).stronglyMeasurable.integral_prod_right.measurable + +/-- Tests decrease the exact first marginal, which is at most one. -/ +theorem samplingTestedFirstDensity_bounds (b : Bool) (h α : ℝ) (E G : Set ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hE : MeasurableSet E) (hG : MeasurableSet G) + (s : ℝ) (hs : s ∈ Set.Ico (0 : ℝ) 1) : + 0 ≤ samplingTestedFirstDensity b h α E G s ∧ + samplingTestedFirstDensity b h α E G s ≤ 1 := by + have hm : Measurable (samplingTestedFirstWeight b h α E G s) := (samplingTestedFirstWeight_measurable b h α E G hE hG).comp + (measurable_const.prodMk measurable_id) + have hi := (samplingWeight_integrable b h α s hh hα).mono' hm.aestronglyMeasurable + (Eventually.of_forall (fun t => by + rw [Real.norm_eq_abs,abs_of_nonneg (samplingTestedFirstWeight_bounds b h α E G s t hh hα).1] + exact (samplingTestedFirstWeight_bounds b h α E G s t hh hα).2)) + refine ⟨integral_nonneg (fun t => (samplingTestedFirstWeight_bounds b h α E G s t hh hα).1), ?_⟩ + calc + _ ≤ ∫ t, samplingWeight b h α s t ∂unitIntervalMeasure := + integral_mono_ae hi (samplingWeight_integrable b h α s hh hα) + (Eventually.of_forall (fun t => (samplingTestedFirstWeight_bounds b h α E G s t hh hα).2)) + _ ≤ 1 := by + rw [samplingWeight_first_integral b h α s hh hh1 hα hs] + cases b <;> simp only [Bool.false_eq_true,ite_false,ite_true] + · split_ifs <;> norm_num + · linarith [hs.1] + +/-- The first tested marginal has quadratic moment at most one in both +triangular and diagonal coordinates, uniformly in the measurable tests. -/ +theorem samplingTestedFirstDensity_square (b : Bool) (h α : ℝ) (E G : Set ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hE : MeasurableSet E) (hG : MeasurableSet G) : + (∫ s, samplingTestedFirstDensity b h α E G s ^ 2 ∂unitIntervalMeasure) ≤ 1 := by + have hb : ∀ᵐ s ∂unitIntervalMeasure, 0 ≤ samplingTestedFirstDensity b h α E G s ∧ + samplingTestedFirstDensity b h α E G s ≤ 1 := + (ae_restrict_mem measurableSet_Ico).mono (fun s hs => + samplingTestedFirstDensity_bounds b h α E G hh hh1 hα hE hG s hs) + have hb2 := hb.mono (fun s hs => show samplingTestedFirstDensity b h α E G s ^ 2 ≤ 1 by nlinarith) + have hi : Integrable (fun s => samplingTestedFirstDensity b h α E G s ^ 2) unitIntervalMeasure := + (integrable_const (1 : ℝ)).mono' + ((samplingTestedFirstDensity_measurable b h α E G hE hG).pow_const 2).aestronglyMeasurable + (hb2.mono (fun s hs => by + rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg (samplingTestedFirstDensity b h α E G s))] + exact hs)) + simpa using integral_mono_ae hi (integrable_const (1 : ℝ)) hb2 + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/TestedSecondMoment.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/TestedSecondMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..c589577b7f4ca47a963d2f7e96c66d0afe6a3c88 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/TestedSecondMoment.lean @@ -0,0 +1,85 @@ +import OAI.Analysis.FiniteFactor.Sampling.SecondDensity + +namespace OAI + +namespace FiniteFactor +open MeasureTheory ProbabilityTheory Filter +open scoped ENNReal +noncomputable section + +/-- Exact x- and y-tests in the second diagonal orientation. -/ +def samplingTestedSecondWeight (h α : ℝ) (E G : Set ℝ) (s t : ℝ) : ℝ := by + classical + exact if Int.fract (s-t) ∈ E ∧ s ∈ G then samplingSecondWeight h α s t else 0 + +def samplingTestedSecondDensity (h α : ℝ) (E G : Set ℝ) (s : ℝ) : ℝ := + ∫ t, samplingTestedSecondWeight h α E G s t ∂unitIntervalMeasure + +theorem samplingTestedSecondWeight_measurable (h α : ℝ) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + Measurable (fun p : ℝ × ℝ => samplingTestedSecondWeight h α E G p.1 p.2) := by + unfold samplingTestedSecondWeight + exact Measurable.ite ((hE.preimage (sourceFract_measurable.comp + (measurable_fst.sub measurable_snd))).inter (hG.preimage measurable_fst)) + (samplingSecondWeight_measurable h α) measurable_const + +theorem samplingTestedSecondWeight_bounds (h α : ℝ) (E G : Set ℝ) (s t : ℝ) + (hh : 0 < h) (hα : 0 < α) : + 0 ≤ samplingTestedSecondWeight h α E G s t ∧ + samplingTestedSecondWeight h α E G s t ≤ samplingSecondWeight h α s t := by + have hn : 0 ≤ samplingSecondWeight h α s t := (samplingWeight_bounds false h α _ t hh hα).1 + unfold samplingTestedSecondWeight + split_ifs <;> simp [hn] + +theorem samplingTestedSecondDensity_measurable (h α : ℝ) (E G : Set ℝ) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + Measurable (samplingTestedSecondDensity h α E G) := + (samplingTestedSecondWeight_measurable h α E G hE hG).stronglyMeasurable.integral_prod_right.measurable + +theorem samplingTestedSecondDensity_bounds (h α : ℝ) (E G : Set ℝ) + (hh : 0 < h) (hα : 0 < α) (hE : MeasurableSet E) (hG : MeasurableSet G) (s : ℝ) : + 0 ≤ samplingTestedSecondDensity h α E G s ∧ + samplingTestedSecondDensity h α E G s ≤ samplingSecondDensity h α s := by + have hm : Measurable (samplingTestedSecondWeight h α E G s) := + (samplingTestedSecondWeight_measurable h α E G hE hG).comp (measurable_const.prodMk measurable_id) + have hi := (samplingSecondWeight_integrable h α s hh hα).mono' hm.aestronglyMeasurable + (Eventually.of_forall (fun t => by + rw [Real.norm_eq_abs,abs_of_nonneg (samplingTestedSecondWeight_bounds h α E G s t hh hα).1] + exact (samplingTestedSecondWeight_bounds h α E G s t hh hα).2)) + exact ⟨integral_nonneg (fun t => (samplingTestedSecondWeight_bounds h α E G s t hh hα).1), + integral_mono_ae hi (samplingSecondWeight_integrable h α s hh hα) + (Eventually.of_forall (fun t => (samplingTestedSecondWeight_bounds h α E G s t hh hα).2))⟩ + +theorem samplingTestedSecondDensity_square (h α : ℝ) (E G : Set ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hE : MeasurableSet E) (hG : MeasurableSet G) : + (∀ᵐ s ∂unitIntervalMeasure, 0 ≤ samplingTestedSecondDensity h α E G s ∧ + samplingTestedSecondDensity h α E G s ≤ 1/(1-h)) ∧ + (∫ s, samplingTestedSecondDensity h α E G s^2 ∂unitIntervalMeasure) ≤ 1+h^2/(1-h)^2 := by + let f := samplingTestedSecondDensity h α E G + let q := samplingIdealSecond h + let C := 1/(1-h) + have hC : 0 ≤ C := by dsimp [C]; positivity + have hf := samplingTestedSecondDensity_measurable h α E G hE hG + have hq := samplingIdealSecond_measurable h hh + have hnon (s : ℝ) : 0 ≤ f s := (samplingTestedSecondDensity_bounds h α E G hh hα hE hG s).1 + have hle : ∀ᵐ s ∂unitIntervalMeasure, f s ≤ q s := + (samplingSecondDensity_le_ideal h α hh hh1 hα).mono (fun s hs => + (samplingTestedSecondDensity_bounds h α E G hh hα hE hG s).2.trans hs) + have hqb (s : ℝ) : 0 ≤ q s ∧ q s ≤ C := (samplingIdealSecond_bounds h s hh hh1).imp_right And.left + have hq2 (s : ℝ) : q s^2 ≤ C^2 := by nlinarith [(hqb s).1,(hqb s).2] + have hf2 : ∀ᵐ s ∂unitIntervalMeasure, f s^2 ≤ q s^2 := hle.mono (fun s hs => by nlinarith [hnon s,(hqb s).1]) + have hfi : Integrable (fun s => f s^2) unitIntervalMeasure := + (integrable_const (C^2)).mono' (hf.pow_const 2).aestronglyMeasurable (hf2.mono (fun s hs => by + rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)] + exact hs.trans (hq2 s))) + have hqi : Integrable (fun s => q s^2) unitIntervalMeasure := + (integrable_const (C^2)).mono' (hq.pow_const 2).aestronglyMeasurable (Eventually.of_forall (fun s => by + rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)] + exact hq2 s)) + exact ⟨hle.mono (fun s hs => ⟨hnon s,hs.trans (hqb s).2⟩), + (integral_mono_ae hfi hqi hf2).trans (samplingIdealSecond_square h hh hh1).2⟩ + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/TestedSelfMoment.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/TestedSelfMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..9da43807bf56bc88ac73cbb54e62feecfe614b83 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/TestedSelfMoment.lean @@ -0,0 +1,100 @@ +import OAI.Analysis.FiniteFactor.Sampling.SelfMoment +import OAI.Analysis.FiniteFactor.Sampling.TestedSecondMoment + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +noncomputable section + +/-- A bounded measurable real function has an integrable square on a finite measure. -/ +theorem sampling_square_integrable {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) + [IsFiniteMeasure μ] (f : Ω → ℝ) (C : ℝ) (hm : Measurable f) + (hb : ∀ x, 0 ≤ f x ∧ f x ≤ C) : Integrable (fun x => f x ^ 2) μ := by + apply (integrable_const (C^2)).mono' (hm.pow_const 2).aestronglyMeasurable + exact Eventually.of_forall (fun x => by + rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg (f x))] + nlinarith [(hb x).1,(hb x).2]) + +/-- Squared weights are integrable jointly, permitting the source's Fubini step. -/ +theorem samplingWeight_square_integrable (b : Bool) (h α : ℝ) (hh : 0 < h) (hα : 0 < α) : + Integrable (fun p : ℝ × ℝ => samplingWeight b h α p.1 p.2 ^ 2) + (unitIntervalMeasure.prod unitIntervalMeasure) := + sampling_square_integrable _ _ (max 1 (1/(h*α))) (samplingWeight_measurable b h α) + (fun p => samplingWeight_bounds b h α p.1 p.2 hh hα) + +/-- Haar translation preserves the untested self-pair moment in the second +orientation, with the source's order of both integrations. -/ +theorem samplingSecondWeight_square_integral (h α : ℝ) (hh : 0 < h) (hh1 : h < 1) + (hα : 0 < α) (hα1 : α ≤ 1/2) : + (∫ s, ∫ t, samplingSecondWeight h α s t ^ 2 + ∂unitIntervalMeasure ∂unitIntervalMeasure) = (2/h)*Real.log (1/(2*α)) := by + have hi : Integrable (fun p : ℝ × ℝ => samplingSecondWeight h α p.1 p.2 ^ 2) + (unitIntervalMeasure.prod unitIntervalMeasure) := + sampling_square_integrable _ _ (max 1 (1/(h*α))) (samplingSecondWeight_measurable h α) + (fun p => samplingWeight_bounds false h α (Int.fract (p.1-p.2)) p.2 hh hα) + rw [integral_integral_swap hi] + calc + _ = ∫ t, ∫ s, samplingWeight false h α s t ^ 2 ∂unitIntervalMeasure ∂unitIntervalMeasure := by + apply integral_congr_ae + filter_upwards [] with t + have hm : AEStronglyMeasurable (fun s => samplingWeight false h α s t ^ 2) unitIntervalMeasure := + (((samplingWeight_measurable false h α).comp (measurable_id.prodMk measurable_const)).pow_const 2).aestronglyMeasurable + have hp := unitInterval_rotate_preserving (-t) + have he := integral_map hp.measurable.aemeasurable (show AEStronglyMeasurable + (fun s => samplingWeight false h α s t ^ 2) (unitIntervalMeasure.map (fun s => Int.fract (s+ -t))) from + hp.map_eq.symm ▸ hm) + rw [hp.map_eq] at he + simpa [samplingSecondWeight,sub_eq_add_neg] using he.symm + _ = _ := by + rw [← integral_integral_swap (samplingWeight_square_integrable false h α hh hα), + samplingWeight_square_integral h α hh hh1 hα hα1] + +/-- Tests decrease the diagonal self-pair moment in the first orientation. -/ +theorem samplingTestedFirstWeight_square_integral (h α : ℝ) (E G : Set ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hα1 : α ≤ 1/2) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + (∫ s, ∫ t, samplingTestedFirstWeight false h α E G s t ^ 2 + ∂unitIntervalMeasure ∂unitIntervalMeasure) ≤ (2/h)*Real.log (1/(2*α)) := by + have hb (s t : ℝ) := samplingTestedFirstWeight_bounds false h α E G s t hh hα + have hm := samplingTestedFirstWeight_measurable false h α E G hE hG + have hbig := samplingWeight_square_integrable false h α hh hα + have hsmall : Integrable (fun p : ℝ × ℝ => samplingTestedFirstWeight false h α E G p.1 p.2 ^ 2) + (unitIntervalMeasure.prod unitIntervalMeasure) := + sampling_square_integrable _ _ (max 1 (1/(h*α))) hm + (fun p => ⟨(hb p.1 p.2).1,(hb p.1 p.2).2.trans (samplingWeight_bounds false h α p.1 p.2 hh hα).2⟩) + rw [← samplingWeight_square_integral h α hh hh1 hα hα1, + ← integral_prod _ hsmall,← integral_prod _ hbig] + apply integral_mono_ae hsmall hbig + exact Eventually.of_forall (fun p => by + nlinarith [(hb p.1 p.2).1,(hb p.1 p.2).2, + (samplingWeight_bounds false h α p.1 p.2 hh hα).1]) + +/-- Tests decrease the diagonal self-pair moment in the second orientation. -/ +theorem samplingTestedSecondWeight_square_integral (h α : ℝ) (E G : Set ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hα1 : α ≤ 1/2) + (hE : MeasurableSet E) (hG : MeasurableSet G) : + (∫ s, ∫ t, samplingTestedSecondWeight h α E G s t ^ 2 + ∂unitIntervalMeasure ∂unitIntervalMeasure) ≤ (2/h)*Real.log (1/(2*α)) := by + have hb (s t : ℝ) := samplingTestedSecondWeight_bounds h α E G s t hh hα + have hm := samplingTestedSecondWeight_measurable h α E G hE hG + have hbig : Integrable (fun p : ℝ × ℝ => samplingSecondWeight h α p.1 p.2 ^ 2) + (unitIntervalMeasure.prod unitIntervalMeasure) := + sampling_square_integrable _ _ (max 1 (1/(h*α))) (samplingSecondWeight_measurable h α) + (fun p => samplingWeight_bounds false h α (Int.fract (p.1-p.2)) p.2 hh hα) + have hsmall : Integrable (fun p : ℝ × ℝ => samplingTestedSecondWeight h α E G p.1 p.2 ^ 2) + (unitIntervalMeasure.prod unitIntervalMeasure) := + sampling_square_integrable _ _ (max 1 (1/(h*α))) hm + (fun p => ⟨(hb p.1 p.2).1,(hb p.1 p.2).2.trans + (samplingWeight_bounds false h α (Int.fract (p.1-p.2)) p.2 hh hα).2⟩) + rw [← samplingSecondWeight_square_integral h α hh hh1 hα hα1, + ← integral_prod _ hsmall,← integral_prod _ hbig] + apply integral_mono_ae hsmall hbig + exact Eventually.of_forall (fun p => by + nlinarith [(hb p.1 p.2).1,(hb p.1 p.2).2, + (samplingWeight_bounds false h α (Int.fract (p.1-p.2)) p.2 hh hα).1]) + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/Transport.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/Transport.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b389e37dfbf6e0849e3519dc90ef4adf375913d --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/Transport.lean @@ -0,0 +1,95 @@ +import OAI.Analysis.FiniteFactor.Sampling.Weights + +namespace OAI + +namespace FiniteFactor +open MeasureTheory +open scoped ENNReal +noncomputable section + +theorem unitInterval_split (c : ℝ) (hc : 0 ≤ c) (hc1 : c ≤ 1) : + unitIntervalMeasure = volume.restrict (Set.Ioc (0 : ℝ) c) + volume.restrict (Set.Ioc c 1) := by + unfold unitIntervalMeasure + rw [restrict_Ico_eq_restrict_Ioc,← Set.Ioc_union_Ioc_eq_Ioc hc hc1, + Measure.restrict_union (Set.Ioc_disjoint_Ioc_of_le le_rfl) measurableSet_Ioc] + +theorem map_interval_affine (a b c d : ℝ) (hc : 0 < c) : + (volume.restrict (Set.Ioc a b)).map (fun x => c*x+d) = + ENNReal.ofReal c⁻¹ • volume.restrict (Set.Ioc (c*a+d) (c*b+d)) := by + have hp : (fun x : ℝ => c*x+d) ⁻¹' Set.Ioc (c*a+d) (c*b+d) = Set.Ioc a b := by + ext x + simp only [Set.mem_preimage,Set.mem_Ioc,add_lt_add_iff_right,add_le_add_iff_right, + mul_lt_mul_iff_right₀ hc,mul_le_mul_iff_right₀ hc] + have hmap : volume.map (fun x : ℝ => c*x+d) = ENNReal.ofReal c⁻¹ • volume := by + have he : (fun x : ℝ => c*x+d) = (fun x : ℝ => x+d) ∘ (fun x : ℝ => c*x) := rfl + rw [he,← Measure.map_map (by fun_prop) (by fun_prop),Real.map_volume_mul_left hc.ne', + Measure.map_smul _ (by fun_prop), + (measurePreserving_add_right (volume : Measure ℝ) d).map_eq,abs_of_pos (inv_pos.mpr hc)] + rw [← hp,← Measure.restrict_map (f := fun x : ℝ => c*x+d) (by fun_prop) measurableSet_Ioc, + hmap,Measure.restrict_smul] + +/-- The uncut diagonal model moves z by v times its endpoint distance. -/ +def samplingTransport (v z : ℝ) : ℝ := z+v*samplingDistance z + +/-- Exact density of the two affine branches of the uncut transport. -/ +def samplingTransportDensity (v s : ℝ) : ℝ := + if s ≤ (1+v)/2 then 1/(1+v) else 1/(1-v) + +theorem samplingTransportDensity_measurable : + Measurable (fun p : ℝ × ℝ => samplingTransportDensity p.1 p.2) := by + unfold samplingTransportDensity + exact Measurable.ite (measurableSet_le measurable_snd ((measurable_const.add measurable_fst).div_const 2)) + (by fun_prop) (by fun_prop) + +/-- This is the actual push-forward density, not an assumed ideal moment. -/ +theorem samplingTransport_density (v : ℝ) (hv : 0 ≤ v) (hv1 : v < 1) : + unitIntervalMeasure.map (samplingTransport v) = + unitIntervalMeasure.withDensity (fun s => ENNReal.ofReal (samplingTransportDensity v s)) := by + let c := (1+v)/2 + have hc : 0 ≤ c := by dsimp [c]; linarith + have hc1 : c ≤ 1 := by dsimp [c]; linarith + have hleft : (volume.restrict (Set.Ioc (0 : ℝ) (1/2))).map (samplingTransport v) = + ENNReal.ofReal (1/(1+v)) • volume.restrict (Set.Ioc (0 : ℝ) c) := by + have he : samplingTransport v =ᵐ[volume.restrict (Set.Ioc (0 : ℝ) (1/2))] (fun z => (1+v)*z+0) := by + filter_upwards [ae_restrict_mem measurableSet_Ioc] with z hz + unfold samplingTransport samplingDistance + rw [min_eq_left (by linarith [hz.2])] + ring + rw [Measure.map_congr he,map_interval_affine _ _ _ _ (by linarith)] + simp only [mul_zero,add_zero,one_div] + congr 3 + have hright : (volume.restrict (Set.Ioc (1/2 : ℝ) 1)).map (samplingTransport v) = + ENNReal.ofReal (1/(1-v)) • volume.restrict (Set.Ioc c (1 : ℝ)) := by + have he : samplingTransport v =ᵐ[volume.restrict (Set.Ioc (1/2 : ℝ) 1)] (fun z => (1-v)*z+v) := by + filter_upwards [ae_restrict_mem measurableSet_Ioc] with z hz + unfold samplingTransport samplingDistance + rw [min_eq_right (by linarith [hz.1])] + ring + rw [Measure.map_congr he,map_interval_affine _ _ _ _ (by linarith)] + have hc' : (1-v)*(1/2)+v = c := by dsimp [c]; ring + rw [hc',show (1-v)*1+v = 1 by ring] + simp [one_div] + have hdleft : (volume.restrict (Set.Ioc (0 : ℝ) c)).withDensity + (fun s => ENNReal.ofReal (samplingTransportDensity v s)) = + ENNReal.ofReal (1/(1+v)) • volume.restrict (Set.Ioc (0 : ℝ) c) := by + rw [← withDensity_const] + apply withDensity_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Ioc] with z hz + simp [samplingTransportDensity,show z ≤ (1+v)/2 from hz.2] + have hdright : (volume.restrict (Set.Ioc c (1 : ℝ))).withDensity + (fun s => ENNReal.ofReal (samplingTransportDensity v s)) = + ENNReal.ofReal (1/(1-v)) • volume.restrict (Set.Ioc c (1 : ℝ)) := by + rw [← withDensity_const] + apply withDensity_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Ioc] with z hz + simp [samplingTransportDensity,show ¬z ≤ (1+v)/2 from not_le.mpr hz.1] + conv_lhs => rw [unitInterval_split (1/2) (by norm_num) (by norm_num)] + have htm : Measurable (samplingTransport v) := by unfold samplingTransport samplingDistance; fun_prop + rw [Measure.map_add _ _ htm,hleft,hright] + conv_rhs => rw [unitInterval_split c hc hc1] + rw [withDensity_add_measure,hdleft,hdright] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/WeightTransport.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/WeightTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ca30da9ab623931b04735e44a068457b5da7204 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/WeightTransport.lean @@ -0,0 +1,76 @@ +import OAI.Analysis.FiniteFactor.Sampling.SecondMoment + +namespace OAI + +namespace FiniteFactor +open MeasureTheory ProbabilityTheory Filter +open scoped ENNReal +noncomputable section + +/-- At each retained starting coordinate, the source weight is exactly the +law of the displacement v times the distance to the endpoint. -/ +theorem samplingWeight_displacement (h α z : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (hz : z ∈ Set.Ico (0 : ℝ) 1) (hcut : α ≤ samplingDistance z) : + unitIntervalMeasure.withDensity (fun t => ENNReal.ofReal (samplingWeight false h α z t)) = + (samplingVelocityMeasure h).map (fun v => samplingDistance z * v) := by + let d := samplingDistance z + have hd : 0 < d := hα.trans_le hcut + have hL : 0 < h*d := mul_pos hh hd + have hd1 : d ≤ 1-z := min_le_right _ _ + have hL1 : h*d ≤ 1 := by nlinarith [hz.1] + have he : (fun t => ENNReal.ofReal (samplingWeight false h α z t)) = + (Set.Ioo 0 (h*d)).indicator (fun _ => ENNReal.ofReal (1/(h*d))) := by + funext t + simp only [samplingWeight,Bool.false_eq_true,ite_false,hcut,true_and,Set.indicator,Set.mem_Ioo,d] + split_ifs <;> simp + rw [he,withDensity_indicator measurableSet_Ioo,withDensity_const] + unfold unitIntervalMeasure + rw [Measure.restrict_restrict measurableSet_Ioo, + Set.inter_eq_left.mpr (show Set.Ioo 0 (h*d) ⊆ Set.Ico (0 : ℝ) 1 from + fun t ht => ⟨ht.1.le,ht.2.trans_le hL1⟩),restrict_Ioo_eq_restrict_Ioc] + unfold samplingVelocityMeasure ProbabilityTheory.cond + rw [Measure.map_smul _ (by fun_prop)] + have ha := map_interval_affine 0 h d 0 hd + simp only [mul_zero,add_zero] at ha + rw [ha,smul_smul,Real.volume_Ioc,sub_zero] + congr 1 + rw [← ENNReal.ofReal_inv_of_pos hh,← ENNReal.ofReal_mul (inv_nonneg.mpr hh.le)] + congr 1 + dsimp [d] + field_simp + simp [mul_comm] + +/-- Exact substitution t=v*Delta(z), at each retained starting point. -/ +theorem samplingWeight_transport_integral (h α z : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (hz : z ∈ Set.Ico (0 : ℝ) 1) (hcut : α ≤ samplingDistance z) + (F : ℝ → ℝ≥0∞) (hF : Measurable F) : + (∫⁻ t, ENNReal.ofReal (samplingWeight false h α z t)*F (z+t) ∂unitIntervalMeasure) = + ∫⁻ v, F (samplingTransport v z) ∂samplingVelocityMeasure h := by + have hw : Measurable (fun t => ENNReal.ofReal (samplingWeight false h α z t)) := + ((samplingWeight_measurable false h α).comp (measurable_const.prodMk measurable_id)).ennreal_ofReal + have hFz : Measurable (fun t => F (z+t)) := hF.comp (by fun_prop) + have hi := lintegral_withDensity_eq_lintegral_mul unitIntervalMeasure hw hFz + simp only [Pi.mul_apply] at hi + rw [← hi, + samplingWeight_displacement h α z hh hh1 hα hz hcut, + lintegral_map hFz (by fun_prop)] + apply lintegral_congr + intro v + simp [samplingTransport,mul_comm] + +/-- Discarding the cutoff only increases the weighted endpoint law. -/ +theorem samplingWeight_transport_le (h α z : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (hz : z ∈ Set.Ico (0 : ℝ) 1) (F : ℝ → ℝ≥0∞) (hF : Measurable F) : + (∫⁻ t, ENNReal.ofReal (samplingWeight false h α z t)*F (z+t) ∂unitIntervalMeasure) ≤ + ∫⁻ v, F (samplingTransport v z) ∂samplingVelocityMeasure h := by + by_cases hc : α ≤ samplingDistance z + · exact (samplingWeight_transport_integral h α z hh hh1 hα hz hc F hF).le + · simp [samplingWeight,hc] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/WeightedCoordinate.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/WeightedCoordinate.lean new file mode 100644 index 0000000000000000000000000000000000000000..07336ef88174f9a8c4fe79f836b2433a0ca045c0 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/WeightedCoordinate.lean @@ -0,0 +1,86 @@ +import OAI.Analysis.FiniteFactor.OrbitSampling.Measures +import Mathlib.Probability.Independence.Integration + +namespace OAI + +namespace FiniteFactor +open MeasureTheory ProbabilityTheory Finset +open scoped ENNReal +noncomputable section + +/-- Exact relative mass of a tail-coordinate event under a prefix product +weight. This includes zero-mass weights and requires no division by mass. -/ +theorem weighted_prefix_coordinate_mass {ι : Type*} [DecidableEq ι] + (μi : ι → Measure ℝ) [∀ i, IsProbabilityMeasure (μi i)] + (J : Finset ι) (F : ι → ℝ → ℝ≥0∞) (hF : ∀ j, Measurable (F j)) + (i : ι) (hi : i ∉ J) (E : Set ℝ) (hE : MeasurableSet E) : + ((Measure.infinitePi μi).withDensity (fun x => ∏ j ∈ J, F j (x j))) {x | x i ∈ E} = + ((Measure.infinitePi μi).withDensity (fun x => ∏ j ∈ J, F j (x j))) Set.univ * μi i E := by + classical + let μ := Measure.infinitePi μi + let W := fun x : ι → ℝ => ∏ j ∈ J, F j (x j) + let B := fun x : ι → ℝ => E.indicator (fun _ => (1 : ℝ≥0∞)) (x i) + let G := fun j : ι => if j = i then E.indicator (fun _ => (1 : ℝ≥0∞)) else F j + have hG (j : ι) : Measurable (G j) := by + dsimp [G] + split_ifs + · exact measurable_const.indicator hE + · exact hF j + have hind : iIndepFun (fun j (x : ι → ℝ) => G j (x j)) μ := iIndepFun_infinitePi hG + have hproduct : (∏ j ∈ J, (fun x : ι → ℝ => G j (x j))) = W := by + funext x + simp only [Finset.prod_apply] + apply prod_congr rfl + intro j hj + simp only [G,ite_eq_right (ne_of_mem_of_not_mem hj hi)] + have heval : (fun x : ι → ℝ => G i (x i)) = B := by funext x; simp [G,B] + have hind' := hind.indepFun_finsetProd_of_notMem (fun j => (hG j).comp (measurable_pi_apply j)) hi + rw [hproduct,heval] at hind' + have hW : Measurable W := Finset.measurable_prod J (fun j hj => (hF j).comp (measurable_pi_apply j)) + have hB : Measurable B := (measurable_const.indicator hE).comp (measurable_pi_apply i) + have hEpre : MeasurableSet {x : ι → ℝ | x i ∈ E} := hE.preimage (measurable_pi_apply i) + have hfub := lintegral_mul_eq_lintegral_mul_lintegral_of_indepFun hW hB hind' + have hcoord : (∫⁻ x, B x ∂μ) = μi i E := by + rw [show B = {x : ι → ℝ | x i ∈ E}.indicator (fun _ => (1 : ℝ≥0∞)) by + funext x; simp [B,Set.indicator]] + rw [lintegral_indicator hEpre] + simp only [lintegral_const,one_mul,Measure.restrict_apply_univ] + have hh := congrArg (fun ν : Measure ℝ => ν E) (Measure.infinitePi_map_eval μi i) + rw [Measure.map_apply (measurable_pi_apply i) hE] at hh + exact hh + rw [hcoord] at hfub + rw [withDensity_apply _ hEpre,withDensity_apply _ MeasurableSet.univ, + Measure.restrict_univ,← lintegral_indicator hEpre] + have he : {x : ι → ℝ | x i ∈ E}.indicator W = W*B := by + funext x + by_cases hx : x i ∈ E <;> simp [W,B,Set.indicator,hx] + change (∫⁻ x, ({x : ι → ℝ | x i ∈ E}.indicator W) x ∂μ) = _ + rw [he] + exact hfub + +/-- The source sampling summand has exactly the Haar tail-coordinate +probability multiplied by its own mass. -/ +theorem sourceSampling_tail_coordinate_mass (I : Finset SourceCoordinate) (s : ℕ) + (θ : SourceCoordinate → ℝ) (n : ℤ) (i : SourceCoordinate) (hi : s < i.1) + (E : Set ℝ) (hE : MeasurableSet E) : + sourceSamplingWeightedMeasure I s θ n {x | x i ∈ E} = + sourceSamplingWeightedMeasure I s θ n Set.univ * unitIntervalMeasure E := by + let F := fun j : SourceCoordinate => fun t : ℝ => ENNReal.ofReal + (samplingWeight (decide (j ∈ I)) (sourceSamplingWidth s) (sourceSamplingCutoff s) + t (Int.fract ((n : ℝ)*θ j))) + have hF (j : SourceCoordinate) : Measurable (F j) := by + apply Measurable.ennreal_ofReal + exact (samplingWeight_measurable _ _ _).comp (measurable_id.prodMk measurable_const) + have he : (fun x => ENNReal.ofReal (sourceSamplingWeight I s θ n x)) = + (fun x => ∏ j ∈ sourceSamplingPrefix s, F j (x j)) := by + funext x + exact ENNReal.ofReal_prod_of_nonneg (fun j hj => (sourceSampling_weight_bound s _ _ _).1) + rw [sourceSamplingWeightedMeasure,he] + apply weighted_prefix_coordinate_mass _ _ F hF i _ E hE + rw [sourceSamplingPrefix,CouplingParameters.mem_blockPrefix] + omega + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Sampling/Weights.lean b/lean/OAI/Analysis/FiniteFactor/Sampling/Weights.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e60b38e6dcedf57b649756f45939ad4570c63f0 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Sampling/Weights.lean @@ -0,0 +1,137 @@ +import OAI.Analysis.FiniteFactor.Sampling.Periodization + +namespace OAI + +namespace FiniteFactor +open MeasureTheory +noncomputable section + +/-- Distance of a representative to the two ends of the unit interval. -/ +def samplingDistance (s : ℝ) : ℝ := min s (1-s) + +def samplingWeight (triangular : Bool) (h α s t : ℝ) : ℝ := + if triangular then + if 0 < t ∧ t < 1-s then 1 else 0 + else + if α ≤ samplingDistance s ∧ 0 < t ∧ t < h*samplingDistance s then + 1/(h*samplingDistance s) + else 0 + +theorem samplingWeight_measurable (triangular : Bool) (h α : ℝ) : + Measurable (fun p : ℝ × ℝ => samplingWeight triangular h α p.1 p.2) := by + cases triangular <;> unfold samplingWeight samplingDistance <;> simp only [Bool.false_eq_true,ite_false,ite_true] + · apply Measurable.ite _ (by fun_prop) measurable_const + exact (measurableSet_le measurable_const (measurable_fst.min (measurable_const.sub measurable_fst))).inter + ((measurableSet_lt measurable_const measurable_snd).inter + (measurableSet_lt measurable_snd (measurable_const.mul (measurable_fst.min (measurable_const.sub measurable_fst))))) + · exact Measurable.ite ((measurableSet_lt measurable_const measurable_snd).inter + (measurableSet_lt measurable_snd (measurable_const.sub measurable_fst))) measurable_const measurable_const + +theorem samplingWeight_bounds (triangular : Bool) (h α s t : ℝ) (hh : 0 < h) (hα : 0 < α) : + 0 ≤ samplingWeight triangular h α s t ∧ + samplingWeight triangular h α s t ≤ max 1 (1/(h*α)) := by + cases triangular + · unfold samplingWeight + simp only [Bool.false_eq_true,ite_false] + split_ifs with hc + · have hd : 0 < samplingDistance s := hα.trans_le hc.1 + exact ⟨by positivity, (one_div_le_one_div_of_le (mul_pos hh hα) + (mul_le_mul_of_nonneg_left hc.1 hh.le)).trans (le_max_right _ _)⟩ + · exact ⟨le_rfl,le_trans (by norm_num) (le_max_left _ _)⟩ + · unfold samplingWeight + simp only [ite_true] + split_ifs <;> constructor <;> first | positivity | exact le_max_left _ _ + +theorem samplingWeight_support (triangular : Bool) (h α s t : ℝ) + (_hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (_hs : s ∈ Set.Ico (0 : ℝ) 1) (hw : samplingWeight triangular h α s t ≠ 0) : + 0 < t ∧ t < 1-s := by + cases triangular + · unfold samplingWeight at hw + simp only [Bool.false_eq_true,ite_false] at hw + split_ifs at hw with hc + · have hd : 0 < samplingDistance s := hα.trans_le hc.1 + have hd1 : samplingDistance s ≤ 1-s := min_le_right _ _ + exact ⟨hc.2.1, hc.2.2.trans_le ((by simpa using + (mul_lt_mul_of_pos_right hh1 hd).le : h * samplingDistance s ≤ samplingDistance s).trans hd1)⟩ + · exact False.elim (hw rfl) + · simpa only [samplingWeight,ite_true,ne_eq,ite_eq_right_iff,one_ne_zero,imp_false,not_not] using hw + +/-- The positive weight already orders each prefix coordinate strictly, +with no wrap of the orbit endpoint. -/ +theorem samplingWeight_orders (triangular : Bool) (h α s t : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) + (hs : s ∈ Set.Ico (0 : ℝ) 1) (hw : samplingWeight triangular h α s t ≠ 0) : + Int.fract (s+t) = s+t ∧ s < Int.fract (s+t) := by + have ht := samplingWeight_support triangular h α s t hh hh1 hα hs hw + have he := Int.fract_eq_self.mpr (show s+t ∈ Set.Ico (0 : ℝ) 1 from ⟨by linarith [hs.1],by linarith⟩) + exact ⟨he,by rw [he]; linarith⟩ + +/-- In the second diagonal orientation the nonzero weight has no wrap and +the original coordinate is exactly s-t, as in the source calculation. -/ +theorem samplingWeight_second_no_wrap (h α s t : ℝ) (hh : 0 < h) (hh1 : h < 1) + (hα : 0 < α) (hs : s ∈ Set.Ico (0 : ℝ) 1) (ht : t ∈ Set.Ico (0 : ℝ) 1) + (hw : samplingWeight false h α (Int.fract (s-t)) t ≠ 0) : + t < s ∧ Int.fract (s-t) = s-t := by + have hsp := samplingWeight_support false h α (Int.fract (s-t)) t hh hh1 hα + ⟨Int.fract_nonneg _,Int.fract_lt_one _⟩ hw + have hcut : α ≤ samplingDistance (Int.fract (s-t)) := by + unfold samplingWeight at hw + simp only [Bool.false_eq_true,ite_false] at hw + split_ifs at hw with hc + · exact hc.1 + · exact False.elim (hw rfl) + have hts : t < s := by + by_contra hn + have hle : s ≤ t := le_of_not_gt hn + by_cases he : s = t + · subst t + simp [samplingDistance] at hcut + linarith + · have hst : s-t < 0 := sub_neg.mpr (lt_of_le_of_ne hle he) + have hf : ⌊s-t⌋ = (-1 : ℤ) := Int.floor_eq_iff.mpr + ⟨by norm_num; linarith [hs.1,ht.2],by norm_num; linarith⟩ + rw [Int.fract,hf] at hsp + norm_num at hsp + linarith [hsp.2,hs.1] + exact ⟨hts,Int.fract_eq_self.mpr ⟨by linarith,by linarith [hs.2,ht.1]⟩⟩ + +/-- Exact first marginal of either untested one-coordinate weight. -/ +theorem samplingWeight_first_integral (triangular : Bool) (h α s : ℝ) + (hh : 0 < h) (hh1 : h < 1) (hα : 0 < α) (hs : s ∈ Set.Ico (0 : ℝ) 1) : + (∫ t, samplingWeight triangular h α s t ∂unitIntervalMeasure) = + if triangular then 1-s else if α ≤ samplingDistance s then 1 else 0 := by + have hvol (L : ℝ) (hL : 0 ≤ L) (hL1 : L ≤ 1) : + unitIntervalMeasure (Set.Ioo (0 : ℝ) L) = ENNReal.ofReal L := by + unfold unitIntervalMeasure + rw [Measure.restrict_apply measurableSet_Ioo,Set.inter_eq_left.mpr (by + intro t ht; exact ⟨ht.1.le,ht.2.trans_le hL1⟩),Real.volume_Ioo,sub_zero] + cases triangular + · simp only [Bool.false_eq_true,ite_false] + by_cases hc : α ≤ samplingDistance s + · have hd : 0 < samplingDistance s := hα.trans_le hc + have hL : 0 < h*samplingDistance s := mul_pos hh hd + have hL1 : h*samplingDistance s ≤ 1 := by + have := min_le_right s (1-s) + change samplingDistance s ≤ 1-s at this + nlinarith [hs.1] + have he : samplingWeight false h α s = + (Set.Ioo 0 (h*samplingDistance s)).indicator (fun _ => 1/(h*samplingDistance s)) := by + funext t + simp [samplingWeight,hc,Set.indicator,Set.mem_Ioo] + rw [he,integral_indicator measurableSet_Ioo] + simp [hc,hvol (h*samplingDistance s) hL.le hL1,ENNReal.toReal_ofReal hL.le,measureReal_def] + field_simp + · have he : samplingWeight false h α s = fun _ => 0 := by funext t; simp [samplingWeight,hc] + simp [he,hc] + · simp only [ite_true] + have he : samplingWeight true h α s = (Set.Ioo 0 (1-s)).indicator (fun _ => (1 : ℝ)) := by + funext t + simp [samplingWeight,Set.indicator,Set.mem_Ioo] + rw [he,integral_indicator measurableSet_Ioo] + simp [hvol (1-s) (by linarith [hs.2]) (by linarith [hs.1]),ENNReal.toReal_ofReal,show 0 ≤ 1-s by linarith [hs.2],measureReal_def] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/SubmeasureL2Density.lean b/lean/OAI/Analysis/FiniteFactor/SubmeasureL2Density.lean new file mode 100644 index 0000000000000000000000000000000000000000..04e1dee8f589480782a74309e1905215297ffa46 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/SubmeasureL2Density.lean @@ -0,0 +1,53 @@ +import Mathlib.MeasureTheory.Measure.Decomposition.RadonNikodym +import Mathlib.MeasureTheory.Function.L2Space + +namespace OAI + +namespace FiniteFactor +open MeasureTheory Filter +open scoped ENNReal +noncomputable section + +/-- A finite submeasure of an L2 density has an actual nonnegative L2 +Radon--Nikodym density, with no increase in its squared integral. -/ +theorem submeasure_L2_density {Ω : Type*} [MeasurableSpace Ω] + (μ ν : Measure Ω) [SigmaFinite μ] [IsFiniteMeasure ν] (f : Ω → ℝ) + (hf : MemLp f 2 μ) (hν : ν ≤ μ.withDensity (fun x => ENNReal.ofReal (f x))) : + ∃ g : Ω → ℝ, Measurable g ∧ (∀ x, 0 ≤ g x) ∧ + ν = μ.withDensity (fun x => ENNReal.ofReal (g x)) ∧ + (∀ᵐ x ∂μ, g x ≤ |f x|) ∧ MemLp g 2 μ ∧ + (∫ x, g x ^ 2 ∂μ) ≤ ∫ x, f x ^ 2 ∂μ := by + let g := fun x => (ν.rnDeriv μ x).toReal + have hg : Measurable g := (Measure.measurable_rnDeriv ν μ).ennreal_toReal + have hac : ν ≪ μ := (Measure.absolutelyContinuous_of_le hν).trans (withDensity_absolutelyContinuous _ _) + have hderiv : ν.rnDeriv μ ≤ᵐ[μ] (fun x => ENNReal.ofReal (f x)) := by + apply ae_le_of_forall_setLIntegral_le_of_sigmaFinite (Measure.measurable_rnDeriv ν μ) + intro A hA _ + calc + _ ≤ ν A := Measure.setLIntegral_rnDeriv_le A + _ ≤ (μ.withDensity (fun x => ENNReal.ofReal (f x))) A := hν A + _ = _ := withDensity_apply _ hA + have hle : ∀ᵐ x ∂μ, g x ≤ |f x| := by + filter_upwards [hderiv] with x hx + have hh := ENNReal.toReal_mono ENNReal.ofReal_ne_top + (hx.trans (ENNReal.ofReal_le_ofReal (le_abs_self (f x)))) + simpa only [ENNReal.toReal_ofReal (abs_nonneg (f x))] using hh + have hlp : MemLp g 2 μ := hf.mono hg.aestronglyMeasurable (by + filter_upwards [hle] with x hx + change |g x| ≤ |f x| + rw [abs_of_nonneg (show 0 ≤ g x from ENNReal.toReal_nonneg)] + exact hx) + refine ⟨g,hg,fun x => ENNReal.toReal_nonneg,?_,hle,hlp,?_⟩ + · rw [← Measure.withDensity_rnDeriv_eq ν μ hac] + apply withDensity_congr_ae + filter_upwards [Measure.rnDeriv_ne_top ν μ] with x hx + exact (ENNReal.ofReal_toReal hx).symm + · apply integral_mono_ae hlp.integrable_sq hf.integrable_sq + filter_upwards [hle] with x hx + have hg0 : 0 ≤ g x := ENNReal.toReal_nonneg + nlinarith [sq_abs (f x)] + +end +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/TagExponentialLower.lean b/lean/OAI/Analysis/FiniteFactor/TagExponentialLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..6723f098f61be04b0ae86f30b884a84e7db0a991 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/TagExponentialLower.lean @@ -0,0 +1,44 @@ +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.Positivity + +namespace OAI + +namespace FiniteFactor + +/-- The explicit logarithm bound used in the source tag probability. -/ +theorem log_one_sub_ge_neg_two {t : ℝ} (ht : 0 ≤ t) (ht1 : t ≤ 1/2) : + -2*t ≤ Real.log (1-t) := by + have hp : 0 < 1-t := by linarith + apply le_trans _ (Real.one_sub_inv_le_log_of_pos hp) + have hh : (1-t)⁻¹ ≤ 1+2*t := by + rw [← one_div] + apply (div_le_iff₀ hp).mpr + nlinarith + linarith + +/-- The source's exactly-one-tag probability has a uniform positive lower +bound, despite the growing block size. -/ +theorem tag_probability_exponential_lower (m : ℕ) (hm : 100 ≤ m) : + Real.exp (-82) ≤ (1-41/(m : ℝ))^(m-1) := by + have hmR : (100 : ℝ) ≤ m := by exact_mod_cast hm + have hm0 : (0 : ℝ) < m := by linarith + have ht0 : 0 ≤ 41/(m : ℝ) := by positivity + have ht1 : 41/(m : ℝ) ≤ 1/2 := (div_le_iff₀ hm0).mpr (by linarith) + have hbase : 0 < 1-41/(m : ℝ) := by linarith + have hlog := log_one_sub_ge_neg_two ht0 ht1 + have hnum : ((m-1 : ℕ) : ℝ) ≤ m := by exact_mod_cast Nat.sub_le m 1 + have hmul := mul_le_mul_of_nonneg_left hlog (Nat.cast_nonneg (m-1) : (0 : ℝ) ≤ (m-1 : ℕ)) + have hden : (m : ℝ)*(41/(m : ℝ)) = 41 := by field_simp + have hsmall := mul_le_mul_of_nonneg_right hnum ht0 + have hh : -82 ≤ ((m-1 : ℕ) : ℝ)*Real.log (1-41/(m : ℝ)) := by nlinarith + have he : (1-41/(m : ℝ))^(m-1) = + Real.exp (((m-1 : ℕ) : ℝ)*Real.log (1-41/(m : ℝ))) := by + rw [Real.exp_nat_mul,Real.exp_log hbase] + rw [he] + exact Real.exp_le_exp.mpr hh + +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/TailEstimate.lean b/lean/OAI/Analysis/FiniteFactor/TailEstimate.lean new file mode 100644 index 0000000000000000000000000000000000000000..93856a1107293d40216ff77eab091f1d40c6a1a0 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/TailEstimate.lean @@ -0,0 +1,186 @@ +import Mathlib.MeasureTheory.Function.ConditionalExpectation.PullOut +import Mathlib.MeasureTheory.Integral.DominatedConvergence +import Mathlib.Analysis.SpecialFunctions.Pow.Real +import Mathlib.Tactic.Positivity +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Ring + +namespace OAI + +namespace FiniteFactor +open MeasureTheory +open scoped ENNReal + +variable {Ω : Type*} {mΩ : MeasurableSpace Ω} {μ : Measure Ω} + +/-- A conditional probability bound controls any nonnegative integrable weight +measurable with respect to the conditioning sigma algebra. -/ +theorem conditional_mask_integral_le [IsFiniteMeasure μ] + {m : MeasurableSpace Ω} (hm : m ≤ mΩ) {f : Ω → ℝ} {H : Set Ω} {δ : ℝ} + (hf : Integrable f μ) (hfm : StronglyMeasurable[m] f) + (hf0 : 0 ≤ᵐ[μ] f) (hH : @MeasurableSet Ω mΩ H) + (hcond : ∀ᵐ ω ∂μ, μ[H.indicator (fun _ => (1 : ℝ)) | m] ω ≤ δ) : + ∫ ω in H, f ω ∂μ ≤ δ * ∫ ω, f ω ∂μ := by + let g : Ω → ℝ := H.indicator (fun _ => 1) + have hg : Integrable g μ := (integrable_const (1 : ℝ)).indicator hH + have heq : f * g = H.indicator f := by + ext ω + by_cases h : ω ∈ H <;> simp [g, h] + have hfg : Integrable (f * g) μ := heq.symm ▸ hf.indicator hH + have hout : μ[f * g | m] =ᵐ[μ] f * μ[g | m] := + condExp_mul_of_stronglyMeasurable_left hfm hfg hg + have hi : Integrable (f * μ[g | m]) μ := integrable_condExp.congr hout + calc + ∫ ω in H, f ω ∂μ = ∫ ω, (f * g) ω ∂μ := by + rw [heq, integral_indicator hH] + _ = ∫ ω, μ[f * g | m] ω ∂μ := (integral_condExp hm).symm + _ = ∫ ω, f ω * μ[g | m] ω ∂μ := integral_congr_ae hout + _ ≤ ∫ ω, f ω * δ ∂μ := by + apply integral_mono_ae hi (hf.mul_const δ) + filter_upwards [hf0, hcond] with ω hfω hcω + exact mul_le_mul_of_nonneg_left hcω hfω + _ = δ * ∫ ω, f ω ∂μ := by rw [integral_mul_const]; exact mul_comm _ _ + +/-- Cauchy–Schwarz in the integral form used on Ω × ℤ. -/ +theorem integral_mul_le_sqrt_squares {f g : Ω → ℝ} + (hf : MemLp f 2 μ) (hg : MemLp g 2 μ) + (hf0 : 0 ≤ᵐ[μ] f) (hg0 : 0 ≤ᵐ[μ] g) : + ∫ ω, f ω * g ω ∂μ ≤ + Real.sqrt (∫ ω, f ω ^ 2 ∂μ) * Real.sqrt (∫ ω, g ω ^ 2 ∂μ) := by + have hh : Real.HolderConjugate 2 2 := by norm_num [Real.holderConjugate_iff] + have h := integral_mul_le_Lp_mul_Lq_of_nonneg hh hf0 hg0 + (by simpa using hf) (by simpa using hg) + simpa [Real.sqrt_eq_rpow] using h + +/-- A masked L² mass at most δ and an unmasked mass at most one yield √δ. +The ambient measure can be probability times counting measure, so this is +not restricted to a finite coefficient set. -/ +theorem integral_mul_le_sqrt_of_square_bounds {f g : Ω → ℝ} {δ : ℝ} + (hf : MemLp f 2 μ) (hg : MemLp g 2 μ) + (hf0 : 0 ≤ᵐ[μ] f) (hg0 : 0 ≤ᵐ[μ] g) + (hδ : ∫ ω, f ω ^ 2 ∂μ ≤ δ) (hg1 : ∫ ω, g ω ^ 2 ∂μ ≤ 1) : + ∫ ω, f ω * g ω ∂μ ≤ Real.sqrt δ := by + calc + ∫ ω, f ω * g ω ∂μ ≤ + Real.sqrt (∫ ω, f ω ^ 2 ∂μ) * Real.sqrt (∫ ω, g ω ^ 2 ∂μ) := + integral_mul_le_sqrt_squares hf hg hf0 hg0 + _ ≤ Real.sqrt δ * Real.sqrt 1 := + mul_le_mul (Real.sqrt_le_sqrt hδ) (Real.sqrt_le_sqrt hg1) + (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) + _ = Real.sqrt δ := by simp + +/-- Countably many masks, each with a conditional probability bound. +The sum is genuinely infinite; no bound on the union of the events is used. +Apply to f_v=|ξ_v(x)|² or f_v=|γ_{n+v}(y)|² in the two orientations. -/ +theorem conditional_mask_tsum_integral_le [IsFiniteMeasure μ] + {ι : Type*} [Countable ι] {m : MeasurableSpace Ω} (hm : m ≤ mΩ) + {f : ι → Ω → ℝ} {H : ι → Set Ω} {δ : ℝ} + (hf : ∀ i, Integrable (f i) μ) + (hfm : ∀ i, StronglyMeasurable[m] (f i)) + (hf0 : ∀ i ω, 0 ≤ f i ω) (hH : ∀ i, @MeasurableSet Ω mΩ (H i)) + (hsum : ∀ᵐ ω ∂μ, Summable (fun i => f i ω)) + (hint : Integrable (fun ω => ∑' i, f i ω) μ) + (hcond : ∀ i, ∀ᵐ ω ∂μ, + μ[(H i).indicator (fun _ => (1 : ℝ)) | m] ω ≤ δ) : + ∫ ω, (∑' i, (H i).indicator (f i) ω) ∂μ ≤ + δ * ∫ ω, (∑' i, f i ω) ∂μ := by + classical + have hmask0 : ∀ i ω, 0 ≤ (H i).indicator (f i) ω := by + intro i ω + by_cases h : ω ∈ H i <;> simp [h, hf0] + have hmaskle : ∀ i ω, (H i).indicator (f i) ω ≤ f i ω := by + intro i ω + by_cases h : ω ∈ H i <;> simp [h, hf0] + have hmaskSum : ∀ᵐ ω ∂μ, Summable (fun i => (H i).indicator (f i) ω) := by + filter_upwards [hsum] with ω hω + exact hω.of_nonneg_of_le (fun i => hmask0 i ω) (fun i => hmaskle i ω) + have horig := hasSum_integral_of_dominated_convergence f + (fun i => (hf i).aestronglyMeasurable) + (fun i => Filter.Eventually.of_forall fun ω => (Real.norm_of_nonneg (hf0 i ω)).le) + hsum hint (hsum.mono fun _ h => h.hasSum) + have hmasked := hasSum_integral_of_dominated_convergence f + (fun i => ((hf i).indicator (hH i)).aestronglyMeasurable) + (fun i => Filter.Eventually.of_forall fun ω => by + rw [Real.norm_of_nonneg (hmask0 i ω)] + exact hmaskle i ω) + hsum hint (hmaskSum.mono fun _ h => h.hasSum) + calc + ∫ ω, (∑' i, (H i).indicator (f i) ω) ∂μ = + ∑' i, ∫ ω, (H i).indicator (f i) ω ∂μ := hmasked.tsum_eq.symm + _ ≤ ∑' i, δ * ∫ ω, f i ω ∂μ := by + apply Summable.tsum_le_tsum _ hmasked.summable (horig.summable.mul_left δ) + intro i + rw [integral_indicator (hH i)] + exact conditional_mask_integral_le hm (hf i) (hfm i) + (Filter.Eventually.of_forall (hf0 i)) (hH i) (hcond i) + _ = δ * ∫ ω, (∑' i, f i ω) ∂μ := by rw [tsum_mul_left, horig.tsum_eq] + +theorem attenuated_two_mask_integral_le + {f g R : Ω → ℝ} {H₁ H₂ : Set Ω} {ε δ : ℝ} + (hf : MemLp f 2 μ) (hg : MemLp g 2 μ) + (hf0 : 0 ≤ᵐ[μ] f) (hg0 : 0 ≤ᵐ[μ] g) + (hf1 : ∫ ω, f ω ^ 2 ∂μ ≤ 1) (hg1 : ∫ ω, g ω ^ 2 ∂μ ≤ 1) + (hH₁ : MeasurableSet H₁) (hH₂ : MeasurableSet H₂) + (hmask₁ : ∫ ω, (H₁.indicator f ω) ^ 2 ∂μ ≤ δ) + (hmask₂ : ∫ ω, (H₂.indicator g ω) ^ 2 ∂μ ≤ δ) + (hε : 0 ≤ ε) (hRm : AEStronglyMeasurable R μ) + (hR0 : 0 ≤ᵐ[μ] R) (hR1 : ∀ᵐ ω ∂μ, R ω ≤ 1) + (hR : ∀ᵐ ω ∂μ, R ω ≤ ε + H₁.indicator (fun _ => 1) ω + + H₂.indicator (fun _ => 1) ω) : + ∫ ω, R ω * f ω * g ω ∂μ ≤ ε + 2 * Real.sqrt δ := by + have hm₁ : MemLp (H₁.indicator f) 2 μ := hf.indicator hH₁ + have hm₂ : MemLp (H₂.indicator g) 2 μ := hg.indicator hH₂ + have hm₁0 : 0 ≤ᵐ[μ] H₁.indicator f := hf0.mono fun ω h => by + change 0 ≤ f ω at h + by_cases hω : ω ∈ H₁ <;> simp [hω, h] + have hm₂0 : 0 ≤ᵐ[μ] H₂.indicator g := hg0.mono fun ω h => by + change 0 ≤ g ω at h + by_cases hω : ω ∈ H₂ <;> simp [hω, h] + have herr₁ := integral_mul_le_sqrt_of_square_bounds hm₁ hg hm₁0 hg0 hmask₁ hg1 + have herr₂ : ∫ ω, f ω * H₂.indicator g ω ∂μ ≤ Real.sqrt δ := by + simpa only [mul_comm] using + integral_mul_le_sqrt_of_square_bounds hm₂ hf hm₂0 hf0 hmask₂ hf1 + have hgood : ∫ ω, f ω * g ω ∂μ ≤ 1 := by + simpa using integral_mul_le_sqrt_of_square_bounds hf hg hf0 hg0 hf1 hg1 + have hfg : Integrable (fun ω => f ω * g ω) μ := hf.integrable_mul hg + have hi₁ : Integrable (fun ω => H₁.indicator f ω * g ω) μ := hm₁.integrable_mul hg + have hi₂ : Integrable (fun ω => f ω * H₂.indicator g ω) μ := hf.integrable_mul hm₂ + have hprod : Integrable (fun ω => R ω * f ω * g ω) μ := by + apply hfg.mono' ((hRm.mul hf.aestronglyMeasurable).mul hg.aestronglyMeasurable) + filter_upwards [hf0, hg0, hR0, hR1] with ω hfω hgω hRω hRω1 + change ‖R ω * f ω * g ω‖ ≤ f ω * g ω + rw [Real.norm_of_nonneg (mul_nonneg (mul_nonneg hRω hfω) hgω)] + calc + R ω * f ω * g ω = R ω * (f ω * g ω) := mul_assoc _ _ _ + _ ≤ 1 * (f ω * g ω) := mul_le_mul_of_nonneg_right hRω1 (mul_nonneg hfω hgω) + _ = f ω * g ω := one_mul _ + have hmajor : ∀ᵐ ω ∂μ, R ω * f ω * g ω ≤ + ε * (f ω * g ω) + H₁.indicator f ω * g ω + f ω * H₂.indicator g ω := by + filter_upwards [hf0, hg0, hR] with ω hfω hgω hRω + calc + R ω * f ω * g ω = R ω * (f ω * g ω) := mul_assoc _ _ _ + _ ≤ (ε + H₁.indicator (fun _ => 1) ω + H₂.indicator (fun _ => 1) ω) * + (f ω * g ω) := mul_le_mul_of_nonneg_right hRω (mul_nonneg hfω hgω) + _ = ε * (f ω * g ω) + H₁.indicator f ω * g ω + f ω * H₂.indicator g ω := by + by_cases h₁ : ω ∈ H₁ <;> by_cases h₂ : ω ∈ H₂ <;> + simp [h₁, h₂] <;> ring + calc + ∫ ω, R ω * f ω * g ω ∂μ ≤ + ∫ ω, ε * (f ω * g ω) + H₁.indicator f ω * g ω + + f ω * H₂.indicator g ω ∂μ := + integral_mono_ae hprod (((hfg.const_mul ε).add hi₁).add hi₂) hmajor + _ = ε * (∫ ω, f ω * g ω ∂μ) + + (∫ ω, H₁.indicator f ω * g ω ∂μ) + + (∫ ω, f ω * H₂.indicator g ω ∂μ) := by + have h₁ := integral_add (hfg.const_mul ε) hi₁ + have h₂ := integral_add ((hfg.const_mul ε).add hi₁) hi₂ + dsimp only [Pi.add_apply] at h₁ h₂ + rw [h₂, h₁, integral_const_mul] + _ ≤ ε + 2 * Real.sqrt δ := by + have := mul_le_mul_of_nonneg_left hgood hε + linarith + +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/FiniteFactor/Truncation.lean b/lean/OAI/Analysis/FiniteFactor/Truncation.lean new file mode 100644 index 0000000000000000000000000000000000000000..8951506a0f7887bf08b81640c16afeb1695878c6 --- /dev/null +++ b/lean/OAI/Analysis/FiniteFactor/Truncation.lean @@ -0,0 +1,165 @@ +import OAI.Analysis.FiniteFactor.Polynomial +import OAI.Analysis.FiniteFactor.Convolution +import Mathlib.Data.Int.Interval + +namespace OAI + +namespace FiniteFactor +open scoped ComplexConjugate + +/-- Sum a row of the Laurent coefficient double sum using its unique possible +second exponent. -/ +theorem laurent_row_eq (K : ℕ) (A B : ℤ → ℂ) (r v : ℤ) : + (∑ j : Fin (2*K+1), if v + ((j.val : ℤ)-K) = r then + A v * B ((j.val : ℤ)-K) else 0) = + if -(K : ℤ) ≤ r-v ∧ r-v ≤ K then A v * B (r-v) else 0 := by + classical + by_cases hv : -(K : ℤ) ≤ r-v ∧ r-v ≤ K + · rw [ite_eq_left hv] + let j : Fin (2*K+1) := ⟨(r-v+K).toNat, by omega⟩ + have hj : (j.val : ℤ)-K = r-v := by dsimp [j]; omega + rw [Finset.sum_eq_single j] + · rw [hj, ite_eq_left (by omega)] + · intro b _ hb + apply ite_eq_right + intro he + apply hb + apply Fin.ext + have := b.isLt + omega + · simp + · rw [ite_eq_right hv] + apply Finset.sum_eq_zero + intro j _ + apply ite_eq_right + intro he + apply hv + have := j.isLt + omega + +/-- A finite subset of ℤ, exactly the two simultaneous coefficient cutoffs. -/ +noncomputable def convolutionWindow (K : ℕ) (n : ℤ) : Finset ℤ := + (Finset.Icc (-(K : ℤ)) K).filter (fun v => -(K : ℤ) ≤ -n-v ∧ -n-v ≤ K) + +theorem mem_convolutionWindow (K : ℕ) (n v : ℤ) : + v ∈ convolutionWindow K n ↔ |v| ≤ (K : ℤ) ∧ |n+v| ≤ (K : ℤ) := by + simp only [convolutionWindow, Finset.mem_filter, Finset.mem_Icc, abs_le] + omega + +theorem not_mem_convolutionWindow (K : ℕ) (n v : ℤ) : + v ∉ convolutionWindow K n ↔ (K : ℤ) < |v| ∨ (K : ℤ) < |n+v| := by + rw [mem_convolutionWindow] + omega + +theorem laurent_coefficient_eq_finite_convolution (K : ℕ) (A B : ℤ → ℂ) (n : ℤ) : + laurentProductCoefficient K A B (-n) = + ∑ v ∈ convolutionWindow K n, A v * B (-n-v) := by + classical + simp only [laurentProductCoefficient, laurent_row_eq] + rw [convolutionWindow, Finset.sum_filter] + apply Finset.sum_bij (fun i _ => (i.val : ℤ)-K) + · intro i _ + simp only [Finset.mem_Icc] + have := i.isLt + omega + · intro i _ j _ hij + apply Fin.ext + omega + · intro v hv + simp only [Finset.mem_Icc] at hv + refine ⟨⟨(v+K).toNat, by omega⟩, Finset.mem_univ _, ?_⟩ + dsimp + omega + · intro i _ + rfl + +/-- A zero absolutely convergent convolution forces the exact finite Laurent +coefficient to be the negative complementary tail. -/ +theorem laurent_coefficient_eq_neg_tail (K : ℕ) (A B : ℤ → ℂ) (n : ℤ) + (hs : Summable (fun v => A v * B (-n-v))) + (hz : ∑' v, A v * B (-n-v) = 0) : + laurentProductCoefficient K A B (-n) = + -(∑' v : {v : ℤ // v ∉ convolutionWindow K n}, A v * B (-n-v)) := by + rw [laurent_coefficient_eq_finite_convolution] + exact finite_part_eq_neg_tail hs hz _ + +/-- The corresponding absolute tail bound used in error-pointwise. -/ +theorem laurent_coefficient_norm_le_tail (K : ℕ) (A B : ℤ → ℂ) (n : ℤ) + (hs : Summable (fun v => ‖A v * B (-n-v)‖)) + (hz : ∑' v, A v * B (-n-v) = 0) : + ‖laurentProductCoefficient K A B (-n)‖ ≤ + ∑' v : {v : ℤ // v ∉ convolutionWindow K n}, ‖A v * B (-n-v)‖ := by + rw [laurent_coefficient_eq_finite_convolution] + exact finite_part_norm_le_tail hs hz _ + +/-- The full pointwise error estimate. The two exceptional masks remain +separate and each is summed over all of ℤ; no union bound is introduced. -/ +theorem laurent_error_pointwise (K : ℕ) (n : ℤ) + (ξ γ : lp (fun _ : ℤ => ℂ) 2) {F G : ℤ → ℝ} + (hF : ∀ k, 0 < F k) (hG : ∀ k, 0 < G k) + (hFa : Antitone F) (hGa : Antitone G) (hGF : ∀ k, G k ≤ F k) + (hn : 0 ≤ n) {H₁ H₂ : Set ℤ} {ε : ℝ} (hε : 0 ≤ ε) + (hz : ∑' v, leftCoefficient F ξ v * rightCoefficient G γ (-n-v) = 0) + (hR : ∀ v, v ∉ convolutionWindow K n → + G (n+v) / F v ≤ ε + H₁.indicator (fun _ => 1) v + + H₂.indicator (fun _ => 1) v) : + ‖laurentProductCoefficient K (leftCoefficient F ξ) (rightCoefficient G γ) (-n)‖ ≤ + ε * (‖ξ‖ * ‖γ‖) + + (∑' v, H₁.indicator (fun v => ‖ξ v‖ * ‖γ (n+v)‖) v) + + (∑' v, H₂.indicator (fun v => ‖ξ v‖ * ‖γ (n+v)‖) v) := by + classical + let p : ℤ → ℝ := fun v => ‖ξ v‖ * ‖γ (n+v)‖ + have hp0 : ∀ v, 0 ≤ p v := fun v => mul_nonneg (norm_nonneg _) (norm_nonneg _) + obtain ⟨hp, hpbound⟩ := shifted_l2_norm_product ξ γ n + change Summable p at hp + change (∑' v, p v) ≤ ‖ξ‖ * ‖γ‖ at hpbound + have hmask : ∀ H : Set ℤ, Summable (H.indicator p) := by + intro H + apply hp.of_nonneg_of_le + · intro v + by_cases hv : v ∈ H <;> simp [hv, hp0] + · intro v + by_cases hv : v ∈ H <;> simp [hv, hp0] + let b : ℤ → ℝ := fun v => ε * p v + H₁.indicator p v + H₂.indicator p v + have hb : Summable b := ((hp.mul_left ε).add (hmask H₁)).add (hmask H₂) + have hb0 : ∀ v, 0 ≤ b v := by + intro v + dsimp [b] + have h₁ : 0 ≤ H₁.indicator p v := by by_cases hv : v ∈ H₁ <;> simp [hv, hp0] + have h₂ : 0 ≤ H₂.indicator p v := by by_cases hv : v ∈ H₂ <;> simp [hv, hp0] + exact add_nonneg (add_nonneg (mul_nonneg hε (hp0 v)) h₁) h₂ + have hterm : ∀ v, v ∉ convolutionWindow K n → + ‖leftCoefficient F ξ v * rightCoefficient G γ (-n-v)‖ ≤ b v := by + intro v hv + rw [cocycle_convolution_term_eq] + have hr : 0 ≤ G (n+v) / F v := (div_pos (hG _) (hF _)).le + simp only [norm_mul, RCLike.norm_conj, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg hr] + calc + G (n+v) / F v * ‖ξ v‖ * ‖γ (n+v)‖ = (G (n+v) / F v) * p v := by dsimp [p]; ring + _ ≤ (ε + H₁.indicator (fun _ => 1) v + H₂.indicator (fun _ => 1) v) * p v := + mul_le_mul_of_nonneg_right (hR v hv) (hp0 v) + _ = b v := by + dsimp [b] + by_cases h₁ : v ∈ H₁ <;> by_cases h₂ : v ∈ H₂ <;> simp [h₁, h₂] <;> ring + have hs := (cocycle_convolution_absolute_convergence ξ γ hF hG hFa hGa hGF hn).1 + calc + ‖laurentProductCoefficient K (leftCoefficient F ξ) (rightCoefficient G γ) (-n)‖ ≤ + ∑' v : {v : ℤ // v ∉ convolutionWindow K n}, + ‖leftCoefficient F ξ v * rightCoefficient G γ (-n-v)‖ := + laurent_coefficient_norm_le_tail K _ _ n hs hz + _ ≤ ∑' v : {v : ℤ // v ∉ convolutionWindow K n}, b v := + (hs.subtype _).tsum_le_tsum (fun v => hterm v v.property) (hb.subtype _) + _ ≤ ∑' v, b v := hb.tsum_subtype_le _ _ hb0 + _ = ε * (∑' v, p v) + (∑' v, H₁.indicator p v) + (∑' v, H₂.indicator p v) := by + change (∑' v, (ε * p v + H₁.indicator p v + H₂.indicator p v)) = _ + rw [Summable.tsum_add ((hp.mul_left ε).add (hmask H₁)) (hmask H₂), + Summable.tsum_add (hp.mul_left ε) (hmask H₁), tsum_mul_left] + _ ≤ _ := by + change ε * (∑' v, p v) + (∑' v, H₁.indicator p v) + (∑' v, H₂.indicator p v) ≤ + ε * (‖ξ‖ * ‖γ‖) + (∑' v, H₁.indicator p v) + (∑' v, H₂.indicator p v) + linarith [mul_le_mul_of_nonneg_left hpbound hε] + +end FiniteFactor + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Completion.lean b/lean/OAI/Analysis/ForestSpace/Completion.lean new file mode 100644 index 0000000000000000000000000000000000000000..236e7cf3182283c442a69c687e88304f173108ea --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Completion.lean @@ -0,0 +1,394 @@ +import OAI.Analysis.ForestSpace.Norm + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +/-- Finite coordinate vectors with the segment norm (a type synonym prevents +clashes with any other norm on finitely supported functions). -/ +def TestVector (V : Type) := V →₀ ℝ + +def segmentSeminorm (V : Type) [PartialOrder V] : Seminorm ℝ (V →₀ ℝ) := by + have segSum_zero [PartialOrder V] (S : Finset V) : segSum (0 : V → ℝ) S = 0 := by + simp [segSum] + have segSum_add [PartialOrder V] (u v : V → ℝ) (S : Finset V) : + segSum (u + v) S = segSum u S + segSum v S := by + simp [segSum, Finset.sum_add_distrib] + have segSum_smul [PartialOrder V] (a : ℝ) (u : V → ℝ) (S : Finset V) : + segSum (a • u) S = a * segSum u S := by + simp [segSum, Finset.mul_sum] + have TestBound.nonneg {u : V → ℝ} {C : ℝ} (h : TestBound u C) : 0 ≤ C := by + simpa using h PEmpty inferInstance PEmpty.elim (by simp) (by simp [Pairwise]) + have TestBound.zero : TestBound (0 : V → ℝ) 0 := by + intro ι inst S hS hd + simp [segSum] + have TestBound.smul {u : V → ℝ} {C : ℝ} (h : TestBound u C) (a : ℝ) : + TestBound (a • u) (a ^ 2 * C) := by + intro ι inst S hS hd + have hh := mul_le_mul_of_nonneg_left (h ι inst S hS hd) (sq_nonneg a) + simpa only [segSum_smul, mul_pow, Finset.mul_sum] using hh + have TestBound.add {u v : V → ℝ} {A B : ℝ} + (hu : TestBound u (A ^ 2)) (hv : TestBound v (B ^ 2)) + (hA : 0 ≤ A) (hB : 0 ≤ B) : TestBound (u + v) ((A + B) ^ 2) := by + intro ι inst S hS hd + have h₁ := hu ι inst S hS hd + have h₂ := hv ι inst S hS hd + have hc := Real.sum_mul_le_sqrt_mul_sqrt (univ : Finset ι) + (fun i => segSum u (S i)) (fun i => segSum v (S i)) + have hs₁ : Real.sqrt (∑ i, segSum u (S i) ^ 2) ≤ A := + (Real.sqrt_le_iff).2 ⟨hA, h₁⟩ + have hs₂ : Real.sqrt (∑ i, segSum v (S i) ^ 2) ≤ B := + (Real.sqrt_le_iff).2 ⟨hB, h₂⟩ + have hc' : ∑ i, segSum u (S i) * segSum v (S i) ≤ A * B := + hc.trans (mul_le_mul hs₁ hs₂ (Real.sqrt_nonneg _) hA) + have he : (∑ i, segSum (u + v) (S i) ^ 2) = + (∑ i, segSum u (S i) ^ 2) + 2 * (∑ i, segSum u (S i) * segSum v (S i)) + + (∑ i, segSum v (S i) ^ 2) := by + simp only [segSum_add, add_sq, Finset.sum_add_distrib, Finset.mul_sum] + congr 1 + congr 1 + apply Finset.sum_congr rfl + intro i hi + ring + rw [he] + nlinarith + have zero_mem_testValues (u : V → ℝ) : 0 ∈ testValues u := by + refine ⟨PEmpty, inferInstance, PEmpty.elim, by simp, by simp [Pairwise], ?_⟩ + simp [segSum] + have TestBound.bddAbove {u : V → ℝ} {C : ℝ} (h : TestBound u C) : + BddAbove (testValues u) := by + refine ⟨C, ?_⟩ + rintro r ⟨ι, inst, S, hs, hd, rfl⟩ + exact h ι inst S hs hd + have TestBound.squareSup_le {u : V → ℝ} {C : ℝ} (h : TestBound u C) : + squareSup u ≤ C := by + apply csSup_le ⟨0, zero_mem_testValues u⟩ + rintro r ⟨ι, inst, S, hs, hd, rfl⟩ + exact h ι inst S hs hd + have testBound_squareSup {u : V → ℝ} (hu : ∃ C, TestBound u C) : + TestBound u (squareSup u) := by + intro ι inst S hs hd + exact le_csSup (TestBound.bddAbove hu.choose_spec) ⟨ι, inst, S, hs, hd, rfl⟩ + have squareSup_nonneg {u : V → ℝ} (hu : ∃ C, TestBound u C) : 0 ≤ squareSup u := + TestBound.nonneg (testBound_squareSup hu) + have rho_nonneg (u : V → ℝ) : 0 ≤ rho u := Real.sqrt_nonneg _ + have rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : rho u ^ 2 = squareSup u := + Real.sq_sqrt (squareSup_nonneg hu) + have testBound_rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : TestBound u (rho u ^ 2) := by + rw [rho_sq hu] + exact testBound_squareSup hu + have rho_le_of_testBound {u : V → ℝ} {C : ℝ} (hC : 0 ≤ C) + (hu : TestBound u (C ^ 2)) : rho u ≤ C := + Real.sqrt_le_iff.mpr ⟨hC, TestBound.squareSup_le hu⟩ + have rho_add_le {u v : V → ℝ} (hu : ∃ C, TestBound u C) (hv : ∃ C, TestBound v C) : + rho (u + v) ≤ rho u + rho v := + rho_le_of_testBound (add_nonneg (rho_nonneg u) (rho_nonneg v)) + (TestBound.add (testBound_rho_sq hu) (testBound_rho_sq hv) (rho_nonneg u) (rho_nonneg v)) + have rho_smul_le {u : V → ℝ} (hu : ∃ C, TestBound u C) (a : ℝ) : + rho (a • u) ≤ |a| * rho u := by + apply rho_le_of_testBound (mul_nonneg (abs_nonneg a) (rho_nonneg u)) + have hh := TestBound.smul (testBound_rho_sq hu) a + simpa only [mul_pow, sq_abs] using hh + have rho_zero : rho (0 : V → ℝ) = 0 := by + apply le_antisymm _ (rho_nonneg _) + apply rho_le_of_testBound (C := 0) (by norm_num) + simpa using (TestBound.zero : TestBound (0 : V → ℝ) 0) + have l1size_nonneg [PartialOrder V] (u : V →₀ ℝ) : 0 ≤ l1size u := + sum_nonneg (fun vertex _ => abs_nonneg (u vertex)) + have finset_abs_sum_le_l1size [PartialOrder V] (u : V →₀ ℝ) (S : Finset V) : + ∑ v ∈ S, |u v| ≤ l1size u := by + have he : (∑ v ∈ S ∪ u.support, |u v|) = l1size u := by + symm + apply sum_subset subset_union_right + intro v hv hn + rw [Finsupp.notMem_support_iff.mp hn, abs_zero] + rw [← he] + exact sum_le_sum_of_subset_of_nonneg subset_union_left (fun v hv hn => abs_nonneg _) + have testBound_l1size (u : V →₀ ℝ) : TestBound u (l1size u ^ 2) := by + intro ι inst S hS hd + have habs : (∑ i, |segSum u (S i)|) ≤ l1size u := by + calc + (∑ i, |segSum u (S i)|) ≤ ∑ i, ∑ v ∈ S i, |u v| := + sum_le_sum fun i hi => abs_sum_le_sum_abs _ _ + _ = ∑ v ∈ univ.biUnion S, |u v| := + (sum_biUnion (by intro i hi j hj hij; exact hd hij)).symm + _ ≤ l1size u := finset_abs_sum_le_l1size u _ + have hsq := sum_sq_le_sq_sum_of_nonneg + (s := (univ : Finset ι)) (f := fun i => |segSum u (S i)|) (fun i hi => abs_nonneg _) + simp only [sq_abs] at hsq + have hnonneg : 0 ≤ ∑ i, |segSum u (S i)| := sum_nonneg (fun i hi => abs_nonneg _) + nlinarith [l1size_nonneg u] + have finsupp_has_testBound (u : V →₀ ℝ) : ∃ C, TestBound u C := ⟨_, testBound_l1size u⟩ + exact Seminorm.ofSMulLE (fun u : V →₀ ℝ => rho u) rho_zero + (fun u v => rho_add_le (finsupp_has_testBound u) (finsupp_has_testBound v)) + (fun a u => by simpa only [Real.norm_eq_abs, Finsupp.coe_smul] using rho_smul_le (finsupp_has_testBound u) a) + +namespace TestVector +variable {V : Type} +instance : AddCommGroup (TestVector V) := inferInstanceAs (AddCommGroup (V →₀ ℝ)) +instance : Module ℝ (TestVector V) := inferInstanceAs (Module ℝ (V →₀ ℝ)) +def toFinsupp (u : TestVector V) : V →₀ ℝ := u +instance : CoeFun (TestVector V) (fun _ => V → ℝ) := ⟨fun u => u.toFinsupp⟩ + +@[ext] theorem ext {u v : TestVector V} (h : ∀ a, u a = v a) : u = v := Finsupp.ext h +@[simp] theorem zero_apply (v : V) : (0 : TestVector V) v = 0 := rfl +@[simp] theorem add_apply (u v : TestVector V) (a : V) : (u + v) a = u a + v a := rfl +@[simp] theorem smul_apply (r : ℝ) (u : TestVector V) (a : V) : (r • u) a = r * u a := rfl +@[simp] theorem coe_add (u v : TestVector V) : ⇑(u + v) = u + v := rfl +@[simp] theorem coe_smul (r : ℝ) (u : TestVector V) : ⇑(r • u) = r • ⇑u := rfl + +variable [PartialOrder V] +instance : Norm (TestVector V) := ⟨fun u => rho u⟩ + + theorem normCore : NormedSpace.Core ℝ (TestVector V) where + norm_nonneg u := rho_nonneg u + norm_triangle u v := rho_add_le (finsupp_has_testBound u.toFinsupp) (finsupp_has_testBound v.toFinsupp) + norm_smul r u := by + change rho (r • ⇑u) = ‖r‖ * rho u + simpa only [Real.norm_eq_abs] using rho_smul (finsupp_has_testBound u.toFinsupp) r + norm_eq_zero_iff u := finsupp_rho_eq_zero u.toFinsupp + +instance : NormedAddCommGroup (TestVector V) := by + have isSegment_singleton (v : V) : IsSegment ({v} : Finset V) := by + constructor + · intro a ha b hb + simp only [mem_singleton] at ha hb + subst a + subst b + exact Or.inl le_rfl + · intro a ha b hb c hac hcb + simp only [mem_singleton] at ha hb ⊢ + subst a + subst b + exact le_antisymm hcb hac + have TestBound.nonneg {u : V → ℝ} {C : ℝ} (h : TestBound u C) : 0 ≤ C := by + simpa using h PEmpty inferInstance PEmpty.elim (by simp) (by simp [Pairwise]) + have TestBound.single {u : V → ℝ} {C : ℝ} (h : TestBound u C) + {S : Finset V} (hS : IsSegment S) : segSum u S ^ 2 ≤ C := by + simpa using h Unit inferInstance (fun _ => S) (fun _ => hS) + (by simp [Pairwise]) + have TestBound.bddAbove {u : V → ℝ} {C : ℝ} (h : TestBound u C) : + BddAbove (testValues u) := by + refine ⟨C, ?_⟩ + rintro r ⟨ι, inst, S, hs, hd, rfl⟩ + exact h ι inst S hs hd + have testBound_squareSup {u : V → ℝ} (hu : ∃ C, TestBound u C) : + TestBound u (squareSup u) := by + intro ι inst S hs hd + exact le_csSup (TestBound.bddAbove hu.choose_spec) ⟨ι, inst, S, hs, hd, rfl⟩ + have squareSup_nonneg {u : V → ℝ} (hu : ∃ C, TestBound u C) : 0 ≤ squareSup u := + TestBound.nonneg (testBound_squareSup hu) + have rho_nonneg (u : V → ℝ) : 0 ≤ rho u := Real.sqrt_nonneg _ + have rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : rho u ^ 2 = squareSup u := + Real.sq_sqrt (squareSup_nonneg hu) + have testBound_rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : TestBound u (rho u ^ 2) := by + rw [rho_sq hu] + exact testBound_squareSup hu + have coordinate_le_rho {u : V → ℝ} (hu : ∃ C, TestBound u C) (v : V) : + |u v| ≤ rho u := by + have hh := TestBound.single (testBound_rho_sq hu) (isSegment_singleton v) + simp only [segSum, sum_singleton] at hh + exact (sq_le_sq₀ (abs_nonneg _) (rho_nonneg _)).mp (by simpa only [sq_abs] using hh) + have l1size_nonneg [PartialOrder V] (u : V →₀ ℝ) : 0 ≤ l1size u := + sum_nonneg (fun vertex _ => abs_nonneg (u vertex)) + have finset_abs_sum_le_l1size [PartialOrder V] (u : V →₀ ℝ) (S : Finset V) : + ∑ v ∈ S, |u v| ≤ l1size u := by + have he : (∑ v ∈ S ∪ u.support, |u v|) = l1size u := by + symm + apply sum_subset subset_union_right + intro v hv hn + rw [Finsupp.notMem_support_iff.mp hn, abs_zero] + rw [← he] + exact sum_le_sum_of_subset_of_nonneg subset_union_left (fun v hv hn => abs_nonneg _) + have testBound_l1size (u : V →₀ ℝ) : TestBound u (l1size u ^ 2) := by + intro ι inst S hS hd + have habs : (∑ i, |segSum u (S i)|) ≤ l1size u := by + calc + (∑ i, |segSum u (S i)|) ≤ ∑ i, ∑ v ∈ S i, |u v| := + sum_le_sum fun i hi => abs_sum_le_sum_abs _ _ + _ = ∑ v ∈ univ.biUnion S, |u v| := + (sum_biUnion (by intro i hi j hj hij; exact hd hij)).symm + _ ≤ l1size u := finset_abs_sum_le_l1size u _ + have hsq := sum_sq_le_sq_sum_of_nonneg + (s := (univ : Finset ι)) (f := fun i => |segSum u (S i)|) (fun i hi => abs_nonneg _) + simp only [sq_abs] at hsq + have hnonneg : 0 ≤ ∑ i, |segSum u (S i)| := sum_nonneg (fun i hi => abs_nonneg _) + nlinarith [l1size_nonneg u] + have finsupp_has_testBound (u : V →₀ ℝ) : ∃ C, TestBound u C := ⟨_, testBound_l1size u⟩ + exact NormedAddCommGroup.ofCore (𝕜 := ℝ) { + norm_nonneg u := apply_nonneg (segmentSeminorm V) u.toFinsupp + norm_triangle u v := map_add_le_add (segmentSeminorm V) u.toFinsupp v.toFinsupp + norm_smul a u := map_smul_eq_mul (segmentSeminorm V) a u.toFinsupp + norm_eq_zero_iff u := ⟨by + intro h + apply Finsupp.ext + intro v + have hh := coordinate_le_rho (finsupp_has_testBound u.toFinsupp) v + change rho u.toFinsupp = 0 at h + rw [h] at hh + exact abs_nonpos_iff.mp hh, by + rintro rfl + exact map_zero (segmentSeminorm V)⟩ } +instance : NormedSpace ℝ (TestVector V) where + norm_smul_le a u := le_of_eq (map_smul_eq_mul (segmentSeminorm V) a u.toFinsupp) + +theorem norm_eq_rho (u : TestVector V) : ‖u‖ = rho u := rfl + +/-- The norm on the finite-support space is the nonempty-segment supremum. -/ +theorem norm_eq_source_sup [Nonempty V] (u : TestVector V) : + ‖u‖ = sSup (sourceNormValues u) := + rho_eq_source_sup u.toFinsupp + + theorem norm_le_iff_testBound (u : TestVector V) {C : ℝ} (hC : 0 ≤ C) : + ‖u‖ ≤ C ↔ TestBound u (C ^ 2) := + ⟨testBound_of_rho_le (finsupp_has_testBound u.toFinsupp), rho_le_of_testBound hC⟩ + +noncomputable def single (v : V) (a : ℝ) : TestVector V := Finsupp.single v a + +omit [PartialOrder V] in +@[simp] theorem single_apply [PartialOrder V] (v : V) (a : ℝ) (w : V) : + single v a w = if v = w then a else 0 := Finsupp.single_apply + + theorem norm_single (v : V) (a : ℝ) : ‖single v a‖ = |a| := by + change rho (Finsupp.single v a) = |a| + have hl : l1size (Finsupp.single v a) = |a| := by + change (Finsupp.single v a).sum (fun _ x => |x|) = |a| + simp + apply le_antisymm + · simpa only [hl] using rho_le_l1size (Finsupp.single v a) + · simpa using coordinate_le_rho (finsupp_has_testBound (Finsupp.single v a)) v + +/-- Coordinate evaluation is bounded by singleton segment tests. -/ +noncomputable def eval (v : V) : TestVector V →L[ℝ] ℝ := + (show TestVector V →ₗ[ℝ] ℝ from + { toFun := fun u => u v + map_add' := fun _ _ => rfl + map_smul' := fun _ _ => rfl }).mkContinuous 1 (by + intro u + change |u v| ≤ 1 * rho u + simpa only [one_mul] + using coordinate_le_rho (finsupp_has_testBound u.toFinsupp) v) + +@[simp] theorem eval_apply (v : V) (u : TestVector V) : eval v u = u v := rfl + + theorem eval_norm_le (v : V) : ‖eval v‖ ≤ 1 := + (eval v).opNorm_le_bound zero_le_one (fun u => by + simpa only [eval_apply, Real.norm_eq_abs, one_mul, norm_eq_rho] + using coordinate_le_rho (finsupp_has_testBound u.toFinsupp) v) + +/-- Coordinate restriction, before the boundedness hypothesis is imposed. -/ +noncomputable def cut (H : Set V) : TestVector V →ₗ[ℝ] TestVector V where + toFun u := Finsupp.filter (· ∈ H) u.toFinsupp + map_add' _ _ := Finsupp.filter_add + map_smul' _ _ := Finsupp.filter_smul + +omit [PartialOrder V] in +@[simp] theorem cut_apply [PartialOrder V] (H : Set V) (u : TestVector V) (v : V) : + cut H u v = if v ∈ H then u v else 0 := Finsupp.filter_apply _ _ _ + + theorem cut_supported (H : Set V) (u : TestVector V) : SupportedOn (cut H u) H := by + intro v hv + simp [hv] + + theorem cut_add_compl (H : Set V) (u : TestVector V) : cut H u + cut Hᶜ u = u := by + ext v + by_cases hv : v ∈ H <;> simp [hv] + + theorem cut_eq_self {H : Set V} {u : TestVector V} (hu : SupportedOn u H) : cut H u = u := by + ext v + by_cases hv : v ∈ H + · simp [hv] + · simp [hv, hu v hv] + + theorem norm_cut_le (H : Set V) (hH : IsLowerSet H) (u : TestVector V) : + ‖cut H u‖ ≤ ‖u‖ := by + apply (norm_le_iff_testBound _ (norm_nonneg u)).mpr + have hh := (testBound_rho_sq (finsupp_has_testBound u.toFinsupp)).restrict H hH + have he : H.indicator ⇑u = ⇑(cut H u) := by + funext v + by_cases hv : v ∈ H <;> simp [cut_apply, hv] + rw [he] at hh + exact hh + + theorem norm_cut_compl_le (H : Set V) (hH : IsLowerSet H) (u : TestVector V) : + ‖cut Hᶜ u‖ ≤ ‖u‖ := by + apply (norm_le_iff_testBound _ (norm_nonneg u)).mpr + have hh := (testBound_rho_sq (finsupp_has_testBound u.toFinsupp)).restrict_compl H hH + have he : Hᶜ.indicator ⇑u = ⇑(cut Hᶜ u) := by + funext v + by_cases hv : v ∈ H <;> simp [cut_apply, hv] + rw [he] at hh + exact hh + +omit [PartialOrder V] in +@[simp] theorem sum_apply [PartialOrder V] {ι : Type} (S : Finset ι) (u : ι → TestVector V) (v : V) : + (∑ i ∈ S, u i) v = ∑ i ∈ S, u i v := by + induction S using Finset.induction_on with + | empty => simp + | @insert a S ha ih => simp [ha, ih] + + theorem cut_finite_eq_sum (H : Finset V) (u : TestVector V) : + cut (H : Set V) u = ∑ v ∈ H, u v • single v 1 := by + ext w + simp only [cut_apply, Finset.mem_coe, sum_apply, smul_apply, single_apply, + mul_ite, mul_one, mul_zero] + simp + + theorem cut_eq_zero_of_compl {H : Set V} {u : TestVector V} + (hu : SupportedOn u Hᶜ) : cut H u = 0 := by + ext v + by_cases hv : v ∈ H + · simp [hv, hu v (by simpa using hv)] + · simp [hv] + +noncomputable def head (H : Set V) (hH : IsLowerSet H) : TestVector V →L[ℝ] TestVector V := + (cut H).mkContinuous 1 (by intro u; simpa only [one_mul] using norm_cut_le H hH u) + +noncomputable def tail (H : Set V) (hH : IsLowerSet H) : TestVector V →L[ℝ] TestVector V := + (cut Hᶜ).mkContinuous 1 (by intro u; simpa only [one_mul] using norm_cut_compl_le H hH u) + +@[simp] theorem head_apply (H : Set V) (hH : IsLowerSet H) (u : TestVector V) : + head H hH u = cut H u := rfl +@[simp] theorem tail_apply (H : Set V) (hH : IsLowerSet H) (u : TestVector V) : + tail H hH u = cut Hᶜ u := rfl + + theorem paired_correction (hF : ForestOrder V) (hAnc : ∀ v : V, (Set.Iic v).Finite) + (H : Set V) (hH : IsLowerSet H) (f k : TestVector V) + (hf : SupportedOn f H) (hk : SupportedOn k Hᶜ) + (hf₁ : ‖f‖ ≤ 1) (hk₁ : ‖k‖ ≤ 1) (s : ℝ) (hs : 0 < s) : + ∃ c : TestVector V, SupportedOn c Hᶜ ∧ ‖c‖ ≤ 1 ∧ + ‖f + s • (c + k)‖ ≤ Real.sqrt (1 + 12 * s ^ 2) ∧ + ‖f + s • (c - k)‖ ≤ Real.sqrt (1 + 12 * s ^ 2) := by + have hf' : TestBound f 1 := by simpa using (norm_le_iff_testBound f zero_le_one).mp hf₁ + have hk' : TestBound k 1 := by simpa using (norm_le_iff_testBound k zero_le_one).mp hk₁ + obtain ⟨c,hcH,hc,hcp,hcm⟩ := finsupp_paired_correction hF hAnc H hH + f.toFinsupp k.toFinsupp hf hk hf' hk' s hs + refine ⟨c,hcH, ?_, ?_, ?_⟩ + · exact (norm_le_iff_testBound _ zero_le_one).mpr (by + change TestBound c (1 ^ 2); simpa only [one_pow] using hc) + · apply (norm_le_iff_testBound _ (Real.sqrt_nonneg _)).mpr + rw [Real.sq_sqrt (by positivity)] + exact hcp + · apply (norm_le_iff_testBound _ (Real.sqrt_nonneg _)).mpr + rw [Real.sq_sqrt (by positivity)] + exact hcm + +end TestVector + +/-- J(T), completion of the finite-support disjoint-segment norm. -/ +abbrev J (V : Type) [PartialOrder V] := UniformSpace.Completion (TestVector V) + +/-- The full continuous dual, used for the finite-height forest example. -/ +abbrev FullDual (V : Type) [PartialOrder V] := StrongDual ℝ (J V) + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Components.lean b/lean/OAI/Analysis/ForestSpace/Components.lean new file mode 100644 index 0000000000000000000000000000000000000000..24438be8ed72702c6b0ed55f35f89e5a42e6b4f2 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Components.lean @@ -0,0 +1,258 @@ +import OAI.Analysis.ForestSpace.Reflexivity + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section ComponentDecomposition + +noncomputable def componentRaw (h : ℕ) : TestVector Vertex →ₗ[ℝ] TestVector (Component h) where + toFun u := u.toFinsupp.subtypeDomain (fun v => v.height = h) + map_add' u v := by ext w; rfl + map_smul' a u := by ext w; rfl + +@[simp] theorem componentRaw_apply (h : ℕ) (u : TestVector Vertex) (v : Component h) : + componentRaw h u v = u v := rfl + +noncomputable def liftComponent (h : ℕ) (u : TestVector (Component h)) : TestVector Vertex := + Finsupp.extendDomain u.toFinsupp + +@[simp] theorem liftComponent_apply (h : ℕ) (u : TestVector (Component h)) (v : Vertex) : + liftComponent h u v = if hv : v.height = h then u ⟨v,hv⟩ else 0 := + Finsupp.extendDomain_apply _ _ + +@[simp] theorem componentRaw_lift_same (h : ℕ) (u : TestVector (Component h)) : + componentRaw h (liftComponent h u) = u := by + ext v + simp [v.property] + + theorem componentRaw_lift_other (h j : ℕ) (hj : j ≠ h) (u : TestVector (Component h)) : + componentRaw j (liftComponent h u) = 0 := by + ext v + have hv : v.val.height ≠ h := by simpa only [v.property] using hj + simp [hv] + +noncomputable def componentSupport (u : TestVector Vertex) : Finset ℕ := + u.toFinsupp.support.image Vertex.height + + theorem componentRaw_zero (u : TestVector Vertex) {h : ℕ} (hh : h ∉ componentSupport u) : + componentRaw h u = 0 := by + ext v + change u v = 0 + apply Finsupp.notMem_support_iff.mp + intro hv + exact hh (Finset.mem_image.mpr ⟨v,hv,v.property⟩) + +noncomputable def rawDecompositionLinear : TestVector Vertex →ₗ[ℝ] lp (fun h => J (Component h)) 2 where + toFun u := ⟨(fun h => (componentRaw h u : J (Component h))),memℓp_gen (by + apply summable_of_ne_finset_zero (s := componentSupport u) + intro h hh + simp [componentRaw_zero u hh])⟩ + map_add' u v := by + ext h + change ((componentRaw h (u+v) : TestVector (Component h)) : J (Component h)) = _ + rw [map_add,UniformSpace.Completion.coe_add] + rfl + map_smul' a u := by + ext h + change ((componentRaw h (a • u) : TestVector (Component h)) : J (Component h)) = _ + rw [map_smul,UniformSpace.Completion.coe_smul] + rfl + +@[simp] theorem rawDecomposition_apply (u : TestVector Vertex) (h : ℕ) : + rawDecompositionLinear u h = (componentRaw h u : J (Component h)) := rfl + + theorem rawDecomposition_norm_sq (u : TestVector Vertex) : + ‖rawDecompositionLinear u‖^2 = ∑ h ∈ componentSupport u, ‖componentRaw h u‖^2 := by + have he := lp.norm_rpow_eq_tsum (p := 2) (by norm_num) (rawDecompositionLinear u) + simp only [ENNReal.toReal_ofNat,Real.rpow_two,rawDecomposition_apply,UniformSpace.Completion.norm_coe] at he + rw [he] + apply tsum_eq_sum + intro h hh + simp [componentRaw_zero u hh] + + theorem segment_component_subtype (S : Finset Vertex) (hS : IsSegment S) (h : ℕ) : + IsSegment (S.subtype (fun v => v.height = h)) := by + constructor + · intro a ha b hb + exact hS.1 a (Finset.mem_subtype.mp ha) b (Finset.mem_subtype.mp hb) + · intro a ha b hb c hac hcb + exact Finset.mem_subtype.mpr (hS.2 a (Finset.mem_subtype.mp ha) b (Finset.mem_subtype.mp hb) c hac hcb) + + theorem segment_component_image (h : ℕ) (S : Finset (Component h)) (hS : IsSegment S) : + IsSegment (S.image Subtype.val) := by + constructor + · intro a ha b hb + obtain ⟨a',ha',rfl⟩ := Finset.mem_image.mp ha + obtain ⟨b',hb',rfl⟩ := Finset.mem_image.mp hb + exact hS.1 a' ha' b' hb' + · intro a ha b hb c hac hcb + obtain ⟨a',ha',rfl⟩ := Finset.mem_image.mp ha + obtain ⟨b',hb',rfl⟩ := Finset.mem_image.mp hb + have hc : c.height = h := hac.1.symm.trans a'.property + exact Finset.mem_image.mpr ⟨⟨c,hc⟩,hS.2 a' ha' b' hb' ⟨c,hc⟩ hac hcb,rfl⟩ + + theorem segSum_component_image (h : ℕ) (u : TestVector Vertex) (S : Finset (Component h)) : + segSum u (S.image Subtype.val) = segSum (componentRaw h u) S := by + exact Finset.sum_image (fun a ha b hb hab => Subtype.val_injective hab) + + theorem segment_single_height {S : Finset Vertex} (hS : IsSegment S) {v : Vertex} (hv : v ∈ S) : + ∀ w ∈ S, w.height = v.height := by + intro w hw + exact (hS.1 w hw v hv).elim (fun h => h.1) (fun h => h.1.symm) + + theorem segSum_component_subtype (u : TestVector Vertex) (S : Finset Vertex) + (k : ℕ) (hS : ∀ v ∈ S, v.height = k) (h : ℕ) : + segSum (componentRaw h u) (S.subtype (fun v => v.height = h)) = + if h = k then segSum u S else 0 := by + unfold segSum + simp only [componentRaw_apply,Finset.sum_subtype_eq_sum_filter] + by_cases hh : h = k + · subst h + rw [ite_eq_left rfl,Finset.filter_eq_self.mpr hS] + · rw [ite_eq_right hh] + have hf : S.filter (fun v => v.height = h) = ∅ := by + apply Finset.filter_eq_empty_iff.mpr + intro v hv he + exact hh (he.symm.trans (hS v hv)) + rw [hf,Finset.sum_empty] + + theorem segSum_sq_components (u : TestVector Vertex) (S : Finset Vertex) (hS : IsSegment S) : + segSum u S ^ 2 = ∑ h ∈ componentSupport u, + segSum (componentRaw h u) (S.subtype (fun v => v.height = h))^2 := by + by_cases hne : S.Nonempty + · obtain ⟨v,hv⟩ := hne + simp_rw [segSum_component_subtype u S v.height (segment_single_height hS hv)] + by_cases hh : v.height ∈ componentSupport u + · simp [hh] + · have hz : segSum u S = 0 := by + apply Finset.sum_eq_zero + intro w hw + apply Finsupp.notMem_support_iff.mp + intro hw' + exact hh (Finset.mem_image.mpr ⟨w,hw',segment_single_height hS hv w hw⟩) + simp [hz] + · have he : S = ∅ := Finset.not_nonempty_iff_eq_empty.mp hne + simp [he,segSum] + + theorem norm_le_rawDecomposition (u : TestVector Vertex) : ‖u‖ ≤ ‖rawDecompositionLinear u‖ := by + classical + apply (TestVector.norm_le_iff_testBound u (norm_nonneg _)).mpr + intro I inst S hS hd + rw [rawDecomposition_norm_sq] + simp_rw [segSum_sq_components u _ (hS _)] + rw [Finset.sum_comm] + apply Finset.sum_le_sum + intro h hh + change (∑ i, segSum (componentRaw h u) ((S i).subtype (fun v => v.height = h)) ^ 2) ≤ + rho (componentRaw h u) ^ 2 + apply testBound_rho_sq (finsupp_has_testBound (componentRaw h u).toFinsupp) + · intro i + exact segment_component_subtype _ (hS i) h + · intro i j hij + apply Finset.disjoint_left.mpr + intro v hvi hvj + exact Finset.disjoint_left.mp (hd hij) (Finset.mem_subtype.mp hvi) (Finset.mem_subtype.mp hvj) + + theorem exists_half_test {W : Type} [PartialOrder W] (u : TestVector W) : + ∃ (I : Type) (_ : Fintype I) (S : I → Finset W), (∀ i, IsSegment (S i)) ∧ + Pairwise (fun i j => Disjoint (S i) (S j)) ∧ ‖u‖^2 ≤ 2*∑ i, segSum u (S i)^2 := by + by_cases hz : ‖u‖ = 0 + · exact ⟨PEmpty,inferInstance,PEmpty.elim,by simp,by simp [Pairwise],by simp [hz]⟩ + · have hp : 0 < ‖u‖^2 := sq_pos_of_ne_zero hz + have hs : ‖u‖^2/2 < squareSup u := by + rw [← rho_sq (finsupp_has_testBound u.toFinsupp)] + exact half_lt_self hp + obtain ⟨r,hr,hl⟩ := (lt_csSup_iff (testBound_l1size u.toFinsupp).bddAbove ⟨0,zero_mem_testValues u⟩).mp hs + obtain ⟨I,inst,S,hS,hd,rfl⟩ := hr + exact ⟨I,inst,S,hS,hd,by linarith⟩ + + theorem rawDecomposition_norm_le (u : TestVector Vertex) : ‖rawDecompositionLinear u‖ ≤ 2*‖u‖ := by + let K := componentSupport u + choose I inst S hS hd hb using (fun h : K => exists_half_test (componentRaw h u)) + let : ∀ h : K, Fintype (I h) := inst + let A : (Σ h : K, I h) → Finset Vertex := fun i => (S i.1 i.2).image Subtype.val + have hA : ∀ i, IsSegment (A i) := fun i => segment_component_image i.1 _ (hS i.1 i.2) + have hdis : Pairwise (fun i j => Disjoint (A i) (A j)) := by + intro i j hij + by_cases hh : i.1 = j.1 + · rcases i with ⟨h,i⟩ + rcases j with ⟨h',j⟩ + dsimp at hh + subst h' + apply (Finset.disjoint_image Subtype.val_injective).mpr + exact hd h (fun he => hij (by cases he; rfl)) + · apply Finset.disjoint_left.mpr + intro v hvi hvj + obtain ⟨a,ha,hea⟩ := Finset.mem_image.mp hvi + obtain ⟨b,hb,heb⟩ := Finset.mem_image.mp hvj + exact hh (Subtype.ext (a.property.symm.trans ((congrArg Vertex.height (hea.trans heb.symm)).trans b.property))) + have ht := (testBound_rho_sq (finsupp_has_testBound u.toFinsupp)) (Σ h : K, I h) inferInstance A hA hdis + have he : (∑ i : (Σ h : K, I h), segSum u (A i)^2) = + ∑ h : K, ∑ i : I h, segSum (componentRaw h u) (S h i)^2 := by + rw [Fintype.sum_sigma] + apply Finset.sum_congr rfl + intro h hh + apply Finset.sum_congr rfl + intro i hi + rw [show A ⟨h,i⟩ = (S h i).image Subtype.val from rfl,segSum_component_image] + rw [he] at ht + have hh := Finset.sum_le_sum (s := Finset.univ) (fun h hh => hb h) + rw [← Finset.mul_sum] at hh + have hsq : ‖rawDecompositionLinear u‖^2 ≤ 2*‖u‖^2 := by + rw [rawDecomposition_norm_sq,← Finset.sum_coe_sort] + change (∑ h : K, ‖componentRaw h u‖^2) ≤ 2*‖u‖^2 + exact hh.trans (mul_le_mul_of_nonneg_left ht (by norm_num)) + nlinarith [norm_nonneg u,norm_nonneg (rawDecompositionLinear u)] + +noncomputable def rawDecomposition : TestVector Vertex →L[ℝ] lp (fun h => J (Component h)) 2 := + rawDecompositionLinear.mkContinuous 2 rawDecomposition_norm_le + + theorem rawDecomposition_lift (h : ℕ) (u : TestVector (Component h)) : + rawDecompositionLinear (liftComponent h u) = lp.single 2 h (u : J (Component h)) := by + ext j + by_cases hj : j = h + · subst j + simp + · simp [componentRaw_lift_other h j hj,Pi.single_eq_of_ne hj] + + theorem rawDecomposition_dense : DenseRange rawDecomposition := by + let : DecidableEq ℕ := Classical.decEq ℕ + apply denseRange_lp_of_singles (fun h => J (Component h)) rawDecompositionLinear + intro h x + refine UniformSpace.Completion.induction_on (p := fun a => lp.single 2 h a ∈ rawDecompositionLinear.range.topologicalClosure) x ?_ ?_ + · exact (Submodule.isClosed_topologicalClosure rawDecompositionLinear.range).preimage + (lp.isometry_single (E := fun h => J (Component h)) (p := 2) h).continuous + · intro u + apply Submodule.le_topologicalClosure + refine ⟨liftComponent h u,?_⟩ + ext j + by_cases hj : j = h + · subst j + simp + · simp [componentRaw_lift_other h j hj,Pi.single_eq_of_ne hj] + +/-- The specified disjoint-component segment completion is canonically +reflexive. Only bounded isomorphisms are needed here; its norm is unchanged. -/ + theorem reflexive_forest_J : Reflexive (J Vertex) := by + obtain ⟨e⟩ := completion_equiv_of_bounds rawDecomposition 1 + (fun u => by + change ‖u‖ ≤ 1*‖rawDecompositionLinear u‖ + rw [one_mul] + exact norm_le_rawDecomposition u) + rawDecomposition_dense + exact reflexive_of_equiv e (reflexive_l2 (fun h => J (Component h)) reflexive_component) + +end ComponentDecomposition + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Coordinates.lean b/lean/OAI/Analysis/ForestSpace/Coordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..146f9a446c6ce96621f809f383edee7732b28af8 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Coordinates.lean @@ -0,0 +1,136 @@ +import OAI.Analysis.ForestSpace.Renorming + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section CoordinateBounds +variable {V : Type} [PartialOrder V] + + theorem coordinate_squares_le (S : Finset V) (u : TestVector V) : + ∑ v ∈ S, u v ^ 2 ≤ ‖u‖^2 := by + have hh := (testBound_rho_sq (finsupp_has_testBound u.toFinsupp)) + S inferInstance (fun v : S => {(v : V)}) + (fun v => isSegment_singleton (v : V)) + (by + intro i j hij + apply Finset.disjoint_singleton.mpr + exact fun he => hij (Subtype.ext he)) + have hh' : (∑ v : S, u (v : V)^2) ≤ ‖u‖^2 := by + simpa only [segSum,Finset.sum_singleton,TestVector.norm_eq_rho] using hh + rw [← Finset.sum_coe_sort S (fun v => u v^2)] + exact hh' + + theorem norm_sum_coordinates_le (S : Finset V) (a : V → ℝ) : + ‖∑ v ∈ S, a v • eStar v‖ ≤ Real.sqrt (∑ v ∈ S, a v ^ 2) := by + rw [← norm_rawRestriction (∑ v ∈ S, a v • eStar v)] + apply ContinuousLinearMap.opNorm_le_bound _ (Real.sqrt_nonneg _) + intro u + simp only [rawRestriction_apply, _root_.sum_apply, smul_apply, eStar_coe, + smul_eq_mul, Real.norm_eq_abs] + have hA : 0 ≤ ∑ v ∈ S, a v ^ 2 := Finset.sum_nonneg (fun _ _ => sq_nonneg _) + apply (sq_le_sq₀ (abs_nonneg _) (mul_nonneg (Real.sqrt_nonneg _) (norm_nonneg u))).mp + rw [sq_abs, mul_pow, Real.sq_sqrt hA] + exact (Finset.sum_mul_sq_le_sq_mul_sq S a (fun v => u v)).trans + (mul_le_mul_of_nonneg_left (coordinate_squares_le S u) hA) + + theorem norm_sum_eX_le (S : Finset V) (a : V → ℝ) : + ‖∑ v ∈ S, a v • eX v‖ ≤ Real.sqrt (∑ v ∈ S, a v ^ 2) := by + change ‖(∑ v ∈ S, a v • eX v : X V).val‖ ≤ _ + simpa only [Submodule.coe_sum, Submodule.coe_smul, eX_val] using norm_sum_coordinates_le S a + + theorem dual_vectors_squares_le {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + {I : Type} (v : I → E) + (h : ∀ (S : Finset I) (a : I → ℝ), ‖∑ i ∈ S, a i • v i‖ ≤ Real.sqrt (∑ i ∈ S, a i^2)) + (φ : StrongDual ℝ E) (S : Finset I) : + ∑ i ∈ S, (φ (v i))^2 ≤ ‖φ‖^2 := by + let A : ℝ := ∑ i ∈ S, (φ (v i))^2 + have hA : 0 ≤ A := Finset.sum_nonneg (fun _ _ => sq_nonneg _) + have hroot := Real.sq_sqrt hA + have hp : φ (∑ i ∈ S, φ (v i) • v i) = A := by + simp only [map_sum, map_smul, smul_eq_mul, pow_two, A] + have hh := φ.le_opNorm (∑ i ∈ S, φ (v i) • v i) + rw [hp, Real.norm_of_nonneg hA] at hh + have hh' := hh.trans (mul_le_mul_of_nonneg_left + (h S (fun i => φ (v i))) (norm_nonneg φ)) + change A ≤ ‖φ‖*Real.sqrt A at hh' + have hr : Real.sqrt A ≤ ‖φ‖ := by + by_cases hz : Real.sqrt A = 0 + · simp [hz] + · have hpos : 0 < Real.sqrt A := lt_of_le_of_ne (Real.sqrt_nonneg _) (Ne.symm hz) + nlinarith + change A ≤ ‖φ‖^2 + nlinarith [Real.sqrt_nonneg A, norm_nonneg φ] + + theorem weakNull_of_l2_bound {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + {I : Type} (v : I → E) + (h : ∀ (S : Finset I) (a : I → ℝ), ‖∑ i ∈ S, a i • v i‖ ≤ Real.sqrt (∑ i ∈ S, a i^2)) + (w : ℕ → I) (hw : Function.Injective w) : WeakNull (fun n => v (w n)) := by + intro φ + have hs : Summable (fun i : I => (φ (v i))^2) := + summable_of_sum_le (fun _ => sq_nonneg _) (dual_vectors_squares_le v h φ) + have ht := (hs.comp_injective hw).tendsto_atTop_zero + have hh := Real.continuous_sqrt.continuousAt.tendsto.comp ht + apply (tendsto_zero_iff_abs_tendsto_zero _).mpr + simpa only [Function.comp_def, Real.sqrt_sq_eq_abs, Real.sqrt_zero] using hh + + theorem weakNull_coordinates (v : ℕ → V) (hv : Function.Injective v) : + WeakNull (fun n => eX (v n)) := by + apply weakNull_of_l2_bound (E := X V) (eX (V := V)) ?_ v hv + intro S a + change ‖(∑ i ∈ S, a i • eX i : X V).val‖ ≤ _ + simpa only [Submodule.coe_sum,Submodule.coe_smul,eX_val] using norm_sum_coordinates_le S a + + theorem norm_segment_functional_le (S : Finset V) (hS : IsSegment S) : + ‖∑ v ∈ S, eStar v‖ ≤ 1 := by + rw [← norm_rawRestriction (∑ v ∈ S, eStar v)] + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro u + simp only [rawRestriction_apply, _root_.sum_apply, eStar_coe, one_mul, Real.norm_eq_abs] + have hh := (testBound_rho_sq (finsupp_has_testBound u.toFinsupp)).single hS + exact (sq_le_sq₀ (abs_nonneg _) (norm_nonneg u)).mp (by + simpa only [sq_abs, TestVector.norm_eq_rho, segSum] using hh) + + theorem norm_segment_functional (S : Finset V) (hS : IsSegment S) (hne : S.Nonempty) : + ‖∑ v ∈ S, eStar v‖ = 1 := by + apply le_antisymm (norm_segment_functional_le S hS) + obtain ⟨v,hv⟩ := hne + have hh := (∑ w ∈ S, eStar w).le_opNorm (e v) + simpa [eStar_e,hv] using hh + + theorem norm_segment_eX (S : Finset V) (hS : IsSegment S) (hne : S.Nonempty) : + ‖∑ v ∈ S, eX v‖ = 1 := by + change ‖(∑ v ∈ S, eX v : X V).val‖ = _ + simpa only [Submodule.coe_sum,eX_val] using norm_segment_functional S hS hne + + theorem ancestors_isSegment (hF : ForestOrder V) (v : V) (hfin : (Set.Iic v).Finite) : + IsSegment hfin.toFinset := by + constructor + · intro a ha b hb + apply hF a b v + · simpa using ha + · simpa using hb + · intro a ha b hb c hac hcb + have hbv : b ≤ v := by simpa using hb + simpa using hcb.trans hbv + +noncomputable def pathVector (v : V) (hfin : (Set.Iic v).Finite) : X V := + ∑ w ∈ hfin.toFinset, eX w + + theorem norm_pathVector (hF : ForestOrder V) (v : V) (hfin : (Set.Iic v).Finite) : + ‖pathVector v hfin‖ = 1 := by + exact norm_segment_eX _ (ancestors_isSegment hF v hfin) ⟨v,by simp⟩ + +end CoordinateBounds + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Diamonds.lean b/lean/OAI/Analysis/ForestSpace/Diamonds.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e7ea18f3a66047cff74aeea18cf41b50f4b98a4 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Diamonds.lean @@ -0,0 +1,331 @@ +import OAI.Analysis.ForestSpace.Lens + +namespace OAI + +noncomputable section + +open scoped BigOperators +open Finset + +namespace ForestSpace + +attribute [local instance] Classical.propDecidable + +namespace Diamond + +/-- An oriented edge enumeration; only the associated undirected unit-edge +simple graph is used for distances. -/ +structure Network where + V : Type + E : Type + left : E → V + right : E → V + distinct : ∀ e, left e ≠ right e + +namespace Network +variable (A : Network) + +def graph : SimpleGraph A.V where + Adj u v := ∃ e : A.E, (A.left e = u ∧ A.right e = v) ∨ + (A.right e = u ∧ A.left e = v) + symm := ⟨by + rintro u v ⟨e,h | h⟩ + · exact ⟨e,Or.inr ⟨h.2,h.1⟩⟩ + · exact ⟨e,Or.inl ⟨h.2,h.1⟩⟩⟩ + loopless := ⟨by + rintro u ⟨e,h | h⟩ + · exact A.distinct e (h.1.trans h.2.symm) + · exact A.distinct e (h.2.trans h.1.symm)⟩ + + theorem edge_adj (e : A.E) : A.graph.Adj (A.left e) (A.right e) := + ⟨e,Or.inl ⟨rfl,rfl⟩⟩ + +/-- Every edge is replaced by countably many internally disjoint two-edge +paths. All old vertices remain, and each pair (edge,index) is a new midpoint. -/ +@[reducible] def refine : Network where + V := Sum A.V (A.E × ℕ) + E := A.E × ℕ × Bool + left e := if e.2.2 then Sum.inr (e.1,e.2.1) else Sum.inl (A.left e.1) + right e := if e.2.2 then Sum.inl (A.right e.1) else Sum.inr (e.1,e.2.1) + distinct := by rintro ⟨e,j,b⟩; cases b <;> simp + + theorem refine_adj_left (e : A.E) (j : ℕ) : + A.refine.graph.Adj (Sum.inl (A.left e)) (Sum.inr (e,j)) := by + exact A.refine.edge_adj (e,j,false) + + theorem refine_adj_right (e : A.E) (j : ℕ) : + A.refine.graph.Adj (Sum.inr (e,j)) (Sum.inl (A.right e)) := by + exact A.refine.edge_adj (e,j,true) + + theorem refine_no_adj_middle (a b : A.E × ℕ) : + ¬A.refine.graph.Adj (Sum.inr a) (Sum.inr b) := by + rintro ⟨⟨e,j,c⟩,h⟩ + cases c <;> simp [refine] at h + + theorem refine_no_adj_old (u v : A.V) : + ¬A.refine.graph.Adj (Sum.inl u) (Sum.inl v) := by + rintro ⟨⟨e,j,c⟩,h⟩ + cases c <;> simp [refine] at h + + theorem refine_adj_lift {u v : A.V} (huv : A.graph.Adj u v) : + ∃ w : A.refine.V, A.refine.graph.Adj (Sum.inl u) w ∧ + A.refine.graph.Adj w (Sum.inl v) := by + obtain ⟨e,h | h⟩ := huv + · rcases h with ⟨rfl,rfl⟩ + exact ⟨Sum.inr (e,0),A.refine_adj_left e 0,A.refine_adj_right e 0⟩ + · rcases h with ⟨rfl,rfl⟩ + exact ⟨Sum.inr (e,0),(A.refine_adj_right e 0).symm,(A.refine_adj_left e 0).symm⟩ + + theorem refine_walk_lift {u v : A.V} (p : A.graph.Walk u v) : + ∃ q : A.refine.graph.Walk (Sum.inl u) (Sum.inl v), q.length = 2*p.length := by + induction p with + | nil => exact ⟨.nil,rfl⟩ + | @cons u v w huv p ih => + obtain ⟨q,hq⟩ := ih + obtain ⟨z,huz,hzv⟩ := A.refine_adj_lift huv + refine ⟨.cons huz (.cons hzv q),?_⟩ + change q.length+1+1 = 2*(p.length+1) + rw [hq] + omega + + theorem refine_connected (hA : A.graph.Connected) : A.refine.graph.Connected := by + have hOld : ∀ u v : A.V, A.refine.graph.Reachable (Sum.inl u) (Sum.inl v) := by + intro u v + obtain ⟨p⟩ := hA u v + obtain ⟨q,hq⟩ := A.refine_walk_lift p + exact ⟨q⟩ + refine @SimpleGraph.Connected.mk _ _ ?_ ?_ + · intro u v + cases u with + | inl u => + cases v with + | inl v => exact hOld u v + | inr v => exact (hOld u (A.left v.1)).trans (A.refine_adj_left v.1 v.2).reachable + | inr u => + cases v with + | inl v => exact (A.refine_adj_left u.1 u.2).symm.reachable.trans (hOld (A.left u.1) v) + | inr v => exact ((A.refine_adj_left u.1 u.2).symm.reachable.trans + (hOld (A.left u.1) (A.left v.1))).trans (A.refine_adj_left v.1 v.2).reachable + · obtain ⟨u⟩ := hA.nonempty + exact ⟨Sum.inl u⟩ + +end Network + + theorem potential_bound {V : Type} (G : SimpleGraph V) (f : V → ℝ) + (hf : ∀ u v, G.Adj u v → |f u-f v| ≤ 1) {u v : V} (p : G.Walk u v) : + |f u-f v| ≤ (p.length : ℝ) := by + induction p with + | nil => simp + | @cons u v w huv p ih => + have hh := abs_add_le (f u-f v) (f v-f w) + have he : f u-f v+(f v-f w) = f u-f w := by ring + rw [he] at hh + simp only [SimpleGraph.Walk.length_cons,Nat.cast_add,Nat.cast_one] + linarith [hf u v huv] + +namespace Network + +section +variable (A : Network) + + theorem adj_dist_potential (hA : A.graph.Connected) (a : A.V) {u v : A.V} + (huv : A.graph.Adj u v) : + |(A.graph.dist a u : ℝ)-(A.graph.dist a v : ℝ)| ≤ 1 := by + have he : A.graph.dist u v = 1 := SimpleGraph.dist_eq_one_iff_adj.mpr huv + have h1 := hA.dist_triangle (u := a) (v := u) (w := v) + have h2 := hA.dist_triangle (u := a) (v := v) (w := u) + rw [he] at h1 + rw [SimpleGraph.dist_comm (u := v) (v := u),he] at h2 + have h1' : (A.graph.dist a v : ℝ) ≤ (A.graph.dist a u : ℝ)+1 := by exact_mod_cast h1 + have h2' : (A.graph.dist a u : ℝ) ≤ (A.graph.dist a v : ℝ)+1 := by exact_mod_cast h2 + exact abs_le.mpr ⟨by linarith,by linarith⟩ + +noncomputable def refinePotential (a : A.V) : A.refine.V → ℝ + | Sum.inl u => 2*(A.graph.dist a u : ℝ) + | Sum.inr ⟨e,_⟩ => (A.graph.dist a (A.left e) : ℝ)+(A.graph.dist a (A.right e) : ℝ) + + theorem refinePotential_adj (hA : A.graph.Connected) (a : A.V) + (u v : A.refine.V) (huv : A.refine.graph.Adj u v) : + |A.refinePotential a u-A.refinePotential a v| ≤ 1 := by + obtain ⟨⟨e,j,b⟩,h | h⟩ := huv + all_goals rcases h with ⟨rfl,rfl⟩ + all_goals cases b + all_goals dsimp [refine,refinePotential] + all_goals have hh := A.adj_dist_potential hA a (A.edge_adj e) + all_goals obtain ⟨h1,h2⟩ := abs_le.mp hh + all_goals exact abs_le.mpr ⟨by linarith,by linarith⟩ + + theorem refine_dist_old (hA : A.graph.Connected) (u v : A.V) : + A.refine.graph.dist (Sum.inl u) (Sum.inl v) = 2*A.graph.dist u v := by + apply le_antisymm + · obtain ⟨p,hp⟩ := (hA u v).exists_walk_length_eq_dist + obtain ⟨q,hq⟩ := A.refine_walk_lift p + have hh := SimpleGraph.dist_le q + rwa [hq,hp] at hh + · obtain ⟨p,hp⟩ := (A.refine_connected hA (Sum.inl u) (Sum.inl v)).exists_walk_length_eq_dist + have hh := potential_bound A.refine.graph (A.refinePotential u) (A.refinePotential_adj hA u) p + simp only [refinePotential,SimpleGraph.dist_self,Nat.cast_zero,mul_zero,zero_sub,abs_neg, + abs_mul,abs_of_pos (by norm_num : (0:ℝ)<2), + abs_of_nonneg (show (0:ℝ) ≤ (A.graph.dist u v : ℝ) from Nat.cast_nonneg _),hp] at hh + exact_mod_cast hh + + theorem refine_dist_middle (e : A.E) (i j : ℕ) (hij : i ≠ j) : + A.refine.graph.dist (Sum.inr (e,i)) (Sum.inr (e,j)) = 2 := by + have he : A.refine.graph.edist (Sum.inr (e,i)) (Sum.inr (e,j)) = 2 := by + apply SimpleGraph.edist_eq_two_iff.mpr + refine ⟨?_,A.refine_no_adj_middle _ _,?_⟩ + · intro he + exact hij (congrArg Prod.snd (Sum.inr.inj he)) + · exact ⟨Sum.inl (A.left e),(A.refine_adj_left e i).symm,(A.refine_adj_left e j).symm⟩ + exact_mod_cast (congrArg ENat.toNat he) + +end + +/-- Iterating the very same edge replacement, starting from an arbitrary +network. This recursion groups the first replacement before the remaining ones. -/ +@[reducible] def iterate : Network → ℕ → Network + | A,0 => A + | A,n+1 => iterate A.refine n + +/-- The canonical inclusion of all old vertices through finitely many refinements. -/ +def old : (A : Network) → (n : ℕ) → A.V → (A.iterate n).V + | _,0 => id + | A,n+1 => fun u => A.refine.old n (Sum.inl u) + +@[simp] theorem old_zero (A : Network) (u : A.V) : A.old 0 u = u := rfl +@[simp] theorem old_succ (A : Network) (n : ℕ) (u : A.V) : + A.old (n+1) u = A.refine.old n (Sum.inl u) := rfl + + theorem old_injective (A : Network) (n : ℕ) : Function.Injective (A.old n) := by + induction n generalizing A with + | zero => exact Function.injective_id + | succ n ih => exact (ih A.refine).comp Sum.inl_injective + + theorem iterate_connected (A : Network) (hA : A.graph.Connected) (n : ℕ) : + (A.iterate n).graph.Connected := by + induction n generalizing A with + | zero => exact hA + | succ n ih => exact ih A.refine (A.refine_connected hA) + + theorem old_dist (A : Network) (hA : A.graph.Connected) (n : ℕ) (u v : A.V) : + (A.iterate n).graph.dist (A.old n u) (A.old n v) = 2^n*A.graph.dist u v := by + induction n generalizing A with + | zero => simp [iterate] + | succ n ih => + change (A.refine.iterate n).graph.dist (A.refine.old n (Sum.inl u)) + (A.refine.old n (Sum.inl v)) = _ + rw [ih A.refine (A.refine_connected hA),A.refine_dist_old hA,pow_succ] + ring + + theorem old_edge_dist (A : Network) (hA : A.graph.Connected) (n : ℕ) (e : A.E) : + (A.iterate n).graph.dist (A.old n (A.left e)) (A.old n (A.right e)) = 2^n := by + rw [A.old_dist hA,SimpleGraph.dist_eq_one_iff_adj.mpr (A.edge_adj e),mul_one] + + theorem old_middle_dist (A : Network) (hA : A.graph.Connected) (n : ℕ) (e : A.E) + (i j : ℕ) (hij : i ≠ j) : + (A.iterate (n+1)).graph.dist (A.refine.old n (Sum.inr (e,i))) + (A.refine.old n (Sum.inr (e,j))) = 2^(n+1) := by + change (A.refine.iterate n).graph.dist _ _ = _ + rw [A.refine.old_dist (A.refine_connected hA),A.refine_dist_middle e i j hij,pow_succ] + +end Network + +/-- D₀ is precisely one edge. -/ +@[reducible] def base : Network where + V := Bool + E := Unit + left _ := false + right _ := true + distinct _ := by decide + + theorem base_connected : base.graph.Connected := by + refine @SimpleGraph.Connected.mk _ _ ?_ ⟨false⟩ + intro u v + cases u <;> cases v + · exact SimpleGraph.Reachable.refl _ + · exact (base.edge_adj ()).reachable + · exact (base.edge_adj ()).symm.reachable + · exact SimpleGraph.Reachable.refl _ + +/-- Countably branching diamonds, all current edges of length one. -/ +@[reducible] def diamond (k : ℕ) := base.iterate k + +/-- The shortest-path distance, via Mathlib's actual graph distance. -/ +def distance (k : ℕ) (u v : (diamond k).V) : ℝ := ((diamond k).graph.dist u v : ℝ) + + theorem diamond_connected (k : ℕ) : (diamond k).graph.Connected := + base.iterate_connected base_connected k + +/-- Our tail-recursive presentation is exactly successive edge replacement. -/ +theorem Network.iterate_succ_refine (A : Network) (n : ℕ) : + A.iterate (n+1) = (A.iterate n).refine := by + induction n generalizing A with + | zero => rfl + | succ n ih => exact ih A.refine + +@[simp] theorem diamond_zero : diamond 0 = base := rfl + +theorem diamond_succ (k : ℕ) : diamond (k+1) = (diamond k).refine := + Network.iterate_succ_refine base k + +theorem Network.iterate_countable (A : Network) [Countable A.V] [Countable A.E] + (n : ℕ) : Countable (A.iterate n).V ∧ Countable (A.iterate n).E := by + induction n generalizing A with + | zero => exact ⟨inferInstance,inferInstance⟩ + | succ n ih => exact ih A.refine + +/-- Vertices and edges really are countable at each finite diamond stage. -/ +theorem diamond_countable (k : ℕ) : Countable (diamond k).V ∧ Countable (diamond k).E := + Network.iterate_countable base k + +theorem distance_nonneg (k : ℕ) (u v : (diamond k).V) : 0 ≤ distance k u v := by + unfold distance + positivity + +theorem distance_eq_zero_iff (k : ℕ) (u v : (diamond k).V) : + distance k u v = 0 ↔ u = v := by + rw [distance,Nat.cast_eq_zero] + exact (diamond_connected k).dist_eq_zero_iff + +theorem distance_comm (k : ℕ) (u v : (diamond k).V) : + distance k u v = distance k v u := by + unfold distance + rw [SimpleGraph.dist_comm] + +theorem distance_triangle (k : ℕ) (u v w : (diamond k).V) : + distance k u w ≤ distance k u v+distance k v w := by + have h : (diamond k).graph.dist u w ≤ (diamond k).graph.dist u v+(diamond k).graph.dist v w := + (diamond_connected k).dist_triangle + unfold distance + exact_mod_cast h + +/-- Every undirected edge has exactly one entry in the oriented enumeration. +Thus refinement replaces genuine graph edges, not a multiset of edges. -/ +def Network.UniqueEdges (A : Network) : Prop := + ∀ e f : A.E, (A.left e = A.left f ∧ A.right e = A.right f) ∨ + (A.left e = A.right f ∧ A.right e = A.left f) → e = f + +theorem Network.refine_uniqueEdges (A : Network) : A.refine.UniqueEdges := by + rintro ⟨e,i,b⟩ ⟨f,j,c⟩ h + have he := A.distinct e + have hf := A.distinct f + cases b <;> cases c <;> rcases h with h | h <;> + simp_all [Network.refine,Prod.mk.injEq] + all_goals aesop + +theorem Network.iterate_uniqueEdges (A : Network) (hA : A.UniqueEdges) (n : ℕ) : + (A.iterate n).UniqueEdges := by + induction n generalizing A with + | zero => exact hA + | succ n ih => exact ih A.refine A.refine_uniqueEdges + +theorem diamond_uniqueEdges (k : ℕ) : (diamond k).UniqueEdges := + Network.iterate_uniqueEdges base (fun _ _ _ => Subsingleton.elim _ _) k + +end Diamond + +end ForestSpace + +end + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Distortion.lean b/lean/OAI/Analysis/ForestSpace/Distortion.lean new file mode 100644 index 0000000000000000000000000000000000000000..357a8e10bd88e65f013476f08f73ced8277246c7 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Distortion.lean @@ -0,0 +1,198 @@ +import OAI.Analysis.ForestSpace.Diamonds + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +namespace Diamond + +noncomputable section + +section Distortion +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- The exact separated approximate-midpoint estimate proved for the target space. -/ +def LensProperty (E : Type) [NormedAddCommGroup E] [NormedSpace ℝ E] : Prop := + ∀ (R ε : ℝ), 0 < R → 0 < ε → ∀ (x : E) (y : ℕ → E), + (∀ j, ‖x+y j‖ ≤ R) → (∀ j, ‖x-y j‖ ≤ R) → + (∀ i j, i ≠ j → ε ≤ ‖y i-y j‖) → ε^2/48 ≤ R^2-‖x‖^2 + + theorem parent_step (hLens : LensProperty E) (R ℓ : ℝ) (hR : 0 < R) (hℓ : 0 < ℓ) + (a b : E) (w : ℕ → E) + (hp : ∀ j, ‖w j-a‖/ℓ ≤ R) (hm : ∀ j, ‖b-w j‖/ℓ ≤ R) + (hs : ∀ i j, i ≠ j → 2*ℓ ≤ ‖w i-w j‖) : + (‖b-a‖/(2*ℓ))^2+1/12 ≤ R^2 := by + let x : E := (2*ℓ)⁻¹ • (b-a) + let y : ℕ → E := fun j => ℓ⁻¹ • (w j-(1/2 : ℝ) • (a+b)) + have hc : (2*ℓ)⁻¹ = (1/2 : ℝ)*ℓ⁻¹ := by field_simp + have hplus : ∀ j, x+y j = ℓ⁻¹ • (w j-a) := by + intro j + dsimp [x,y] + rw [hc] + module + have hminus : ∀ j, x-y j = ℓ⁻¹ • (b-w j) := by + intro j + dsimp [x,y] + rw [hc] + module + have hdn : ∀ i j, ‖y i-y j‖ = ‖w i-w j‖/ℓ := by + intro i j + have he : y i-y j = ℓ⁻¹ • (w i-w j) := by dsimp [y]; module + rw [he,norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr hℓ.le)] + ring + have hh := hLens R 2 hR (by norm_num) x y + (by + intro j + rw [hplus,norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr hℓ.le)] + simpa only [div_eq_mul_inv,mul_comm] using hp j) + (by + intro j + rw [hminus,norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr hℓ.le)] + simpa only [div_eq_mul_inv,mul_comm] using hm j) + (by intro i j hij; rw [hdn]; exact (le_div_iff₀ hℓ).mpr (hs i j hij)) + have hx : ‖x‖ = ‖b-a‖/(2*ℓ) := by + dsimp [x] + rw [norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr (mul_nonneg (by norm_num) hℓ.le))] + ring + rw [hx] at hh + norm_num at hh + linarith + +/-- The squared loss holds on each original edge, without requiring attainment +of any supremum of edge stretches. -/ + theorem edge_sq_loss (hLens : LensProperty E) (A : Network) (hA : A.graph.Connected) + (n : ℕ) (f : (A.iterate n).V → E) (C : ℝ) (hC : 0 ≤ C) + (hl : ∀ u v, ((A.iterate n).graph.dist u v : ℝ) ≤ ‖f u-f v‖) + (hu : ∀ u v, ‖f u-f v‖ ≤ C*((A.iterate n).graph.dist u v : ℝ)) + (e : A.E) : + (‖f (A.old n (A.right e))-f (A.old n (A.left e))‖/(2:ℝ)^n)^2+(n:ℝ)/12 ≤ C^2 := by + induction n generalizing A with + | zero => + have hh := hu (A.right e) (A.left e) + have he : A.graph.dist (A.right e) (A.left e) = 1 := + SimpleGraph.dist_eq_one_iff_adj.mpr (A.edge_adj e).symm + change ‖f (A.right e)-f (A.left e)‖ ≤ C*(A.graph.dist (A.right e) (A.left e) : ℝ) at hh + rw [he,Nat.cast_one,mul_one] at hh + simpa using (sq_le_sq₀ (norm_nonneg _) hC).mpr hh + | succ n ih => + let ℓ : ℝ := (2:ℝ)^n + have hℓ : 0 < ℓ := pow_pos (by norm_num) _ + let a := f (A.refine.old n (Sum.inl (A.left e))) + let b := f (A.refine.old n (Sum.inl (A.right e))) + let w : ℕ → E := fun j => f (A.refine.old n (Sum.inr (e,j))) + have hchild : ∀ c : A.refine.E, + (‖f (A.refine.old n (A.refine.right c))-f (A.refine.old n (A.refine.left c))‖/ℓ)^2+ + (n:ℝ)/12 ≤ C^2 := by + intro c + exact ih A.refine (A.refine_connected hA) f hl hu c + have hrad : 1 ≤ C^2-(n:ℝ)/12 := by + have hb := hchild (e,0,false) + have hd := A.refine.old_edge_dist (A.refine_connected hA) n (e,0,false) + have hlo := hl (A.refine.old n (Sum.inl (A.left e))) (A.refine.old n (Sum.inr (e,0))) + have hd' : ((A.refine.iterate n).graph.dist + (A.refine.old n (Sum.inl (A.left e))) (A.refine.old n (Sum.inr (e,0))) : ℝ) = ℓ := by + dsimp [ℓ] + exact_mod_cast hd + change ((A.refine.iterate n).graph.dist + (A.refine.old n (Sum.inl (A.left e))) (A.refine.old n (Sum.inr (e,0))) : ℝ) ≤ + ‖a-w 0‖ at hlo + rw [hd',norm_sub_rev] at hlo + have hc : 1 ≤ ‖w 0-a‖/ℓ := (le_div_iff₀ hℓ).mpr (by simpa using hlo) + change (‖w 0-a‖/ℓ)^2+(n:ℝ)/12 ≤ C^2 at hb + nlinarith + let R : ℝ := Real.sqrt (C^2-(n:ℝ)/12) + have hR : 0 < R := Real.sqrt_pos.mpr (by linarith) + have hR2 : R^2 = C^2-(n:ℝ)/12 := Real.sq_sqrt (by linarith) + have hp : ∀ j, ‖w j-a‖/ℓ ≤ R := by + intro j + have hh := hchild (e,j,false) + change (‖w j-a‖/ℓ)^2+(n:ℝ)/12 ≤ C^2 at hh + exact Real.le_sqrt_of_sq_le (by linarith) + have hm : ∀ j, ‖b-w j‖/ℓ ≤ R := by + intro j + have hh := hchild (e,j,true) + change (‖b-w j‖/ℓ)^2+(n:ℝ)/12 ≤ C^2 at hh + exact Real.le_sqrt_of_sq_le (by linarith) + have hs : ∀ i j, i ≠ j → 2*ℓ ≤ ‖w i-w j‖ := by + intro i j hij + have hh := hl (A.refine.old n (Sum.inr (e,i))) (A.refine.old n (Sum.inr (e,j))) + rw [A.old_middle_dist hA n e i j hij] at hh + have he : ((2^(n+1) : ℕ) : ℝ) = 2*ℓ := by + dsimp [ℓ] + norm_cast + rw [pow_succ,mul_comm] + exact he ▸ hh + have hh := parent_step hLens R ℓ hR hℓ a b w hp hm hs + rw [hR2] at hh + have he : (2:ℝ)^(n+1) = 2*ℓ := by dsimp [ℓ]; rw [pow_succ,mul_comm] + change (‖b-a‖/(2:ℝ)^(n+1))^2+((n+1:ℕ):ℝ)/12 ≤ C^2 + rw [he,Nat.cast_add,Nat.cast_one] + linarith + +/-- The distortion convention, including its arbitrary positive scale. -/ +def EmbeddingBound (k : ℕ) (f : (diamond k).V → E) (C : ℝ) : Prop := + ∃ s : ℝ, 0 < s ∧ ∀ u v, + s*distance k u v ≤ ‖f u-f v‖ ∧ ‖f u-f v‖ ≤ C*s*distance k u v + + theorem distortion_lower (hLens : LensProperty E) (k : ℕ) + (f : (diamond k).V → E) (C : ℝ) (hf : EmbeddingBound k f C) : + Real.sqrt (1+(k:ℝ)/12) ≤ C := by + obtain ⟨s,hs,hf⟩ := hf + let g : (diamond k).V → E := fun v => s⁻¹ • f v + have hgn : ∀ u v, ‖g u-g v‖ = ‖f u-f v‖/s := by + intro u v + dsimp [g] + rw [← smul_sub,norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr hs.le)] + ring + have hl : ∀ u v, ((base.iterate k).graph.dist u v : ℝ) ≤ ‖g u-g v‖ := by + intro u v + rw [hgn] + exact (le_div_iff₀ hs).mpr (by simpa only [distance,mul_comm] using (hf u v).1) + have hu : ∀ u v, ‖g u-g v‖ ≤ C*((base.iterate k).graph.dist u v : ℝ) := by + intro u v + rw [hgn] + exact (div_le_iff₀ hs).mpr (by simpa only [distance,mul_assoc,mul_comm,mul_left_comm] using (hf u v).2) + let a := base.old k (base.left ()) + let b := base.old k (base.right ()) + have hd : ((base.iterate k).graph.dist a b : ℝ) = (2:ℝ)^k := by + exact_mod_cast (base.old_edge_dist base_connected k ()) + have hc : 1 ≤ C := by + have hlo := hl a b + have hup := hu a b + rw [hd] at hlo hup + have hpow : 0 < (2:ℝ)^k := pow_pos (by norm_num) _ + nlinarith + have hbound := edge_sq_loss hLens base base_connected k g C (by linarith) hl hu () + have hlo : 1 ≤ ‖g b-g a‖/(2:ℝ)^k := by + have hh := hl a b + rw [hd,norm_sub_rev] at hh + exact (le_div_iff₀ (pow_pos (by norm_num : (0:ℝ)<2) k)).mpr (by simpa using hh) + change (‖g b-g a‖/(2:ℝ)^k)^2+(k:ℝ)/12 ≤ C^2 at hbound + apply Real.sqrt_le_iff.mpr + exact ⟨by linarith,by nlinarith⟩ + +end Distortion + +end +end Diamond + + +/-- The distortion bound, with the positive-scale +bi-Lipschitz convention and the actual shortest-path distance on D_k. -/ +theorem main_diamond_distortion (k : ℕ) + (f : (Diamond.diamond k).V → FullDual Vertex) (C : ℝ) + (hf : Diamond.EmbeddingBound k f C) : + Real.sqrt (1+(k:ℝ)/12) ≤ C := + Diamond.distortion_lower main_lens k f C hf + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Exhaustions.lean b/lean/OAI/Analysis/ForestSpace/Exhaustions.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a24b61c031f786c12e9a4a9ea912f32311e0c9e --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Exhaustions.lean @@ -0,0 +1,79 @@ +import OAI.Analysis.ForestSpace.Distortion + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section Exhaustions +variable {V : Type} [PartialOrder V] + +/-- Every increasing ancestral exhaustion converges by coordinate density +and tail contractivity, without reflexivity. -/ +theorem ancestral_exhaustion_tendsto (H : ℕ → Finset V) + (hH : ∀ n, IsLowerSet (H n : Set V)) (hmono : Monotone H) + (hcover : ∀ v : V, ∃ n, v ∈ H n) (x : X V) : + Filter.Tendsto (fun n => PX (H n) (hH n) x) Filter.atTop (nhds x) := by + apply Metric.tendsto_atTop.mpr + intro ε hε + have hx : (x : FullDual V) ∈ closure + (Submodule.span ℝ (Set.range (eStar (V := V))) : Set (FullDual V)) := x.property + obtain ⟨z,hz,hclose⟩ := Metric.mem_closure_iff.mp hx ε hε + obtain ⟨S,hS⟩ := finite_span_support hz + let n : V → ℕ := fun v => (hcover v).choose + refine ⟨S.sup n,?_⟩ + intro m hm + have hSm : S ⊆ H m := by + intro v hv + have hvm : n v ≤ m := (Finset.le_sup hv).trans hm + exact hmono hvm (hcover v).choose_spec + have hzP := hS (H m) (hH m) hSm + have hzQ : Q (H m : Set V) (hH m) z = 0 := by rw [Q_eq_sub,hzP,sub_self] + have hh := norm_Q_le (H m : Set V) (hH m) ((x : FullDual V)-z) + rw [map_sub,hzQ,sub_zero,Q_eq_sub] at hh + have he : ‖(x : FullDual V)-P (H m : Set V) (hH m) x‖ < ε := + hh.trans_lt (by simpa only [dist_eq_norm] using hclose) + rw [dist_eq_norm] + change ‖((PX (H m) (hH m) x : FullDual V)-(x : FullDual V))‖ < ε + rw [PX_val,norm_sub_rev] + exact he + +/-- Completed tails are approximated by finite coordinate combinations outside +the ancestral head. -/ +theorem approximate_tail_outside (H : Finset V) (hH : IsLowerSet (H : Set V)) + (y : X V) (hy : y = QX H hH y) (ε : ℝ) (hε : 0 < ε) : + ∃ z : FullDual V, z ∈ Submodule.span ℝ (eStar '' (H : Set V)ᶜ) ∧ + ‖(y : FullDual V)-z‖ < ε := by + have hycl : (y : FullDual V) ∈ closure + (Submodule.span ℝ (Set.range (eStar (V := V))) : Set (FullDual V)) := y.property + obtain ⟨z,hz,hclose⟩ := Metric.mem_closure_iff.mp hycl ε hε + refine ⟨Q (H : Set V) hH z,?_,?_⟩ + · obtain ⟨c,rfl⟩ := Finsupp.mem_span_range_iff_exists_finsupp.mp hz + change Q (H : Set V) hH (∑ v ∈ c.support, c v • eStar v) ∈ _ + rw [map_sum] + apply Submodule.sum_mem + intro v hv + rw [map_smul,Q_eq_sub,P_eStar] + by_cases hvH : v ∈ (H : Set V) + · simp [hvH] + · rw [ite_eq_right hvH,sub_zero] + exact Submodule.smul_mem _ _ (Submodule.subset_span ⟨v,hvH,rfl⟩) + · have hy' : Q (H : Set V) hH (y : FullDual V) = y := by + have he := congrArg Subtype.val hy + simpa only [QX_val] using he.symm + have hh := norm_Q_le (H : Set V) hH ((y : FullDual V)-z) + rw [map_sub,hy'] at hh + exact hh.trans_lt (by simpa only [dist_eq_norm] using hclose) + +end Exhaustions + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/FiniteGeometry.lean b/lean/OAI/Analysis/ForestSpace/FiniteGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..2dd68d9bcb55abea67837651e04bc09b6a46ef02 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/FiniteGeometry.lean @@ -0,0 +1,361 @@ +import OAI.Analysis.ForestSpace.Segments + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section FiniteGeometry +variable {V : Type} [Fintype V] [PartialOrder V] + +/-- The ancestral interval [a,g), ending immediately before g along its path. -/ +noncomputable def before (a g : V) : Finset V := by + classical + exact univ.filter (fun v => a ≤ v ∧ v < g) + +@[simp] theorem mem_before {a g v : V} : v ∈ before a g ↔ a ≤ v ∧ v < g := by + classical + simp [before] + + theorem isSegment_before (hF : ForestOrder V) (a g : V) : IsSegment (before a g) := by + constructor + · intro v hv w hw + exact hF v w g (mem_before.mp hv).2.le (mem_before.mp hw).2.le + · intro v hv w hw z hvz hzw + exact mem_before.mpr ⟨(mem_before.mp hv).1.trans hvz, + lt_of_le_of_lt hzw (mem_before.mp hw).2⟩ + + theorem before_mono {a b g : V} (hab : a ≤ b) : before b g ⊆ before a g := by + intro v hv + exact mem_before.mpr ⟨hab.trans (mem_before.mp hv).1, (mem_before.mp hv).2⟩ + + theorem before_subset_head {H : Set V} {g a : V} (hg : Gate H g) : + ∀ v ∈ before a g, v ∈ H := by + intro v hv + exact hg.2 v (mem_before.mp hv).2 + + theorem IsSegment.head_eq_before {H : Set V} (hH : IsLowerSet H) + {S : Finset V} (hS : IsSegment S) {g : V} (hg : Gate H g) (hgs : g ∈ S) + (hp : ∃ a ∈ S, a ∈ H) : + ∃ a, a < g ∧ S.filter (· ∈ H) = before a g := by + classical + obtain ⟨a, ha, b, hb, hab⟩ := hS.endpoints ⟨g, hgs⟩ + have haH : a ∈ H := by + obtain ⟨w, hw, hwH⟩ := hp + exact hH ((hab w).mp hw).1 hwH + have hag : a < g := lt_of_le_of_ne ((hab g).mp hgs).1 + (fun h => hg.1 (h ▸ haH)) + refine ⟨a, hag, ?_⟩ + ext v + simp only [mem_filter, mem_before] + constructor + · rintro ⟨hv, hvH⟩ + refine ⟨((hab v).mp hv).1, ?_⟩ + have hvg : v ≤ g := (hS.1 v hv g hgs).resolve_right (fun h => hg.1 (hH h hvH)) + exact lt_of_le_of_ne hvg (fun he => hg.1 (he ▸ hvH)) + · rintro ⟨hav, hvg⟩ + exact ⟨hS.2 a ha g hgs v hav hvg.le, hg.2 v hvg⟩ + +/-- Removing a terminal suffix from any segment leaves a segment. -/ + theorem IsSegment.sdiff_before {S : Finset V} (hS : IsSegment S) {a b g : V} + (hSa : S = before a g) : IsSegment (S \ before b g) := by + classical + subst S + constructor + · intro v hv w hw + exact hS.1 v (mem_sdiff.mp hv).1 w (mem_sdiff.mp hw).1 + · intro v hv w hw z hvz hzw + have hz := hS.2 v (mem_sdiff.mp hv).1 w (mem_sdiff.mp hw).1 z hvz hzw + refine mem_sdiff.mpr ⟨hz, ?_⟩ + intro hzb + apply (mem_sdiff.mp hw).2 + exact mem_before.mpr ⟨(mem_before.mp hzb).1.trans hzw, + (mem_before.mp (mem_sdiff.mp hw).1).2⟩ + +/-- The closed ancestral interval [g,w]. -/ +noncomputable def along (g w : V) : Finset V := + univ.filter (fun v => g ≤ v ∧ v ≤ w) + +@[simp] theorem mem_along {g w v : V} : v ∈ along g w ↔ g ≤ v ∧ v ≤ w := by + simp [along] + + theorem isSegment_along (hF : ForestOrder V) (g w : V) : IsSegment (along g w) := by + constructor + · intro a ha b hb + exact hF a b w (mem_along.mp ha).2 (mem_along.mp hb).2 + · intro a ha b hb c hac hcb + exact mem_along.mpr ⟨(mem_along.mp ha).1.trans hac, hcb.trans (mem_along.mp hb).2⟩ + + theorem IsSegment.tail_eq_along {H : Set V} (hH : IsLowerSet H) + {S : Finset V} (hS : IsSegment S) {g : V} (hg : Gate H g) (hgs : g ∈ S) : + ∃ b, S.filter (· ∉ H) = along g b := by + obtain ⟨a, ha, b, hb, hab⟩ := hS.endpoints ⟨g, hgs⟩ + refine ⟨b, ?_⟩ + ext v + simp only [mem_filter, mem_along] + constructor + · rintro ⟨hv, hvH⟩ + refine ⟨?_, ((hab v).mp hv).2⟩ + rcases hS.1 g hgs v hv with hgv | hvg + · exact hgv + · by_contra hngv + exact hvH (hg.2 v (lt_of_le_not_ge hvg hngv)) + · rintro ⟨hgv, hvb⟩ + exact ⟨hS.2 g hgs b hb v hgv hvb, fun hv => hg.1 (hH hgv hv)⟩ + +/-- Maximal initial-segment mass of a test inside the cone at g. -/ +noncomputable def mass (k : V → ℝ) (g : V) : ℝ := + univ.sup' ⟨g, mem_univ g⟩ (fun w => |segSum k (along g w)|) + + theorem abs_segSum_along_le (k : V → ℝ) (g w : V) : + |segSum k (along g w)| ≤ mass k g := + le_sup' (fun w => |segSum k (along g w)|) (mem_univ w) + + theorem mass_nonneg (k : V → ℝ) (g : V) : 0 ≤ mass k g := + (abs_nonneg _).trans (abs_segSum_along_le k g g) + + theorem mass_attained (k : V → ℝ) (g : V) : + ∃ w, mass k g = |segSum k (along g w)| := by + obtain ⟨w, hw, he⟩ := exists_mem_eq_sup' (⟨g, mem_univ g⟩ : (univ : Finset V).Nonempty) + (fun w => |segSum k (along g w)|) + exact ⟨w, he⟩ + + theorem gate_mass_bound (hF : ForestOrder V) {k : V → ℝ} (hk : TestBound k 1) + (H : Set V) : ∑ g : {g // Gate H g}, mass k g ^ 2 ≤ 1 := by + choose w hw using (fun g : {g // Gate H g} => mass_attained k g) + have hd : Pairwise (fun g h : {g // Gate H g} => Disjoint (along (g : V) (w g)) (along (h : V) (w h))) := by + intro g h hne + apply disjoint_left.mpr + intro v hvg hvh + have hcomp := hF g h v (mem_along.mp hvg).1 (mem_along.mp hvh).1 + apply hne + apply Subtype.ext + exact hcomp.elim (g.property.eq_of_le h.property) (fun hle => (h.property.eq_of_le g.property hle).symm) + have hh := hk {g // Gate H g} inferInstance (fun g => along (g : V) (w g)) + (fun g => isSegment_along hF g (w g)) hd + simpa only [hw, sq_abs] using hh + +/-- Square mass at gates, and zero elsewhere. -/ +noncomputable def gateWeight (H : Set V) (k : V → ℝ) (g : V) : ℝ := + if Gate H g then mass k g ^ 2 else 0 + + theorem gateWeight_nonneg (H : Set V) (k : V → ℝ) (g : V) : 0 ≤ gateWeight H k g := by + unfold gateWeight + split_ifs <;> positivity + + theorem gateWeight_sum_le (hF : ForestOrder V) {k : V → ℝ} (hk : TestBound k 1) + (H : Set V) : ∑ g, gateWeight H k g ≤ 1 := by + have he : (∑ g, gateWeight H k g) = ∑ g : {g // Gate H g}, mass k g ^ 2 := by + rw [← sum_subtype (p := Gate H) (univ.filter (Gate H)) (by simp) + (fun g => mass k g ^ 2)] + simp only [gateWeight, sum_filter] + rw [he] + exact gate_mass_bound hF hk H + +omit [Fintype V] [PartialOrder V] in + theorem disjoint_sum_le [Fintype V] [PartialOrder V] {ι : Type} [Fintype ι] (S : ι → Finset V) + (hd : Pairwise (fun i j => Disjoint (S i) (S j))) (q : V → ℝ) (hq : ∀ v, 0 ≤ q v) : + (∑ i, ∑ v ∈ S i, q v) ≤ ∑ v, q v := by + rw [← sum_biUnion (s := univ) (t := S) (by intro i hi j hj hij; exact hd hij)] + exact sum_le_sum_of_subset_of_nonneg (subset_univ _) (by intro v hv hv'; exact hq v) + + theorem gateWeight_family_le (hF : ForestOrder V) {k : V → ℝ} (hk : TestBound k 1) + (H : Set V) {ι : Type} [Fintype ι] (S : ι → Finset V) + (hd : Pairwise (fun i j => Disjoint (S i) (S j))) : + (∑ i, ∑ v ∈ S i, gateWeight H k v) ≤ 1 := + (disjoint_sum_le S hd _ (gateWeight_nonneg H k)).trans (gateWeight_sum_le hF hk H) + +omit [Fintype V] [PartialOrder V] in +/-- A segment contains at most one coordinate of a gate-supported vector. -/ + theorem sum_gate_supported [Fintype V] [PartialOrder V] {H : Set V} {c : V → ℝ} + (hc : ∀ v, ¬ Gate H v → c v = 0) {S : Finset V} (hS : IsSegment S) + {g : V} (hg : Gate H g) (hgs : g ∈ S) : segSum c S = c g := by + apply sum_eq_single g + · intro v hv hvg + apply hc v + intro hgate + exact hvg (hS.gate_unique hgate hg hv hgs) + · exact fun h => (h hgs).elim + +noncomputable def correction (H : Set V) (k σ : V → ℝ) (g : V) : ℝ := + if Gate H g then σ g * mass k g else 0 + + theorem correction_supported (H : Set V) (k σ : V → ℝ) : + SupportedOn (correction H k σ) Hᶜ := by + intro v hv + simp only [Set.mem_compl_iff, not_not] at hv + exact ite_eq_right (fun hg => hg.1 hv) + + theorem correction_sum {H : Set V} {k σ : V → ℝ} {S : Finset V} (hS : IsSegment S) + {g : V} (hg : Gate H g) (hgs : g ∈ S) : + segSum (correction H k σ) S = σ g * mass k g := by + rw [sum_gate_supported (c := correction H k σ) (fun v hv => ite_eq_right hv) hS hg hgs] + exact ite_eq_left hg + + theorem correction_segment_sq {H : Set V} {k σ : V → ℝ} (hσ : ∀ v, σ v ^ 2 = 1) + {S : Finset V} (hS : IsSegment S) : + segSum (correction H k σ) S ^ 2 = ∑ v ∈ S, gateWeight H k v := by + by_cases h : ∃ g ∈ S, Gate H g + · obtain ⟨g, hgs, hg⟩ := h + rw [correction_sum hS hg hgs, mul_pow, hσ, one_mul] + symm + calc + (∑ v ∈ S, gateWeight H k v) = gateWeight H k g := by + apply sum_eq_single g + · intro v hv hvg + exact ite_eq_right (fun hgate => hvg (hS.gate_unique hgate hg hv hgs)) + · exact fun hn => (hn hgs).elim + _ = mass k g ^ 2 := ite_eq_left hg + · have hz : segSum (correction H k σ) S = 0 := by + apply sum_eq_zero + intro v hv + exact ite_eq_right (fun hg => h ⟨v, hv, hg⟩) + rw [hz, zero_pow (by decide : (2 : ℕ) ≠ 0)] + symm + apply sum_eq_zero + intro v hv + exact ite_eq_right (fun hg => h ⟨v, hv, hg⟩) + + theorem correction_testBound (hF : ForestOrder V) {k σ : V → ℝ} (hk : TestBound k 1) + (hσ : ∀ v, σ v ^ 2 = 1) (H : Set V) : TestBound (correction H k σ) 1 := by + intro ι inst S hS hd + simp_rw [correction_segment_sq hσ (hS _)] + exact gateWeight_family_le hF hk H S hd + + theorem tail_sum_le_mass {H : Set V} (hH : IsLowerSet H) {k : V → ℝ} + (hk : SupportedOn k Hᶜ) {S : Finset V} (hS : IsSegment S) + {g : V} (hg : Gate H g) (hgs : g ∈ S) : |segSum k S| ≤ mass k g := by + obtain ⟨b, hb⟩ := hS.tail_eq_along hH hg hgs + have he := hk.segSum_filter S + simp only [Set.mem_compl_iff] at he + rw [← he, hb] + exact abs_segSum_along_le k g b + +/-- Candidate starts of suffixes whose head sum reaches the gate threshold. -/ +noncomputable def largeStarts (f k : V → ℝ) (s : ℝ) (g : V) : Finset V := + univ.filter (fun a => a < g ∧ 2 * s * mass k g ≤ |segSum f (before a g)|) + +@[simp] theorem mem_largeStarts {f k : V → ℝ} {s : ℝ} {g a : V} : + a ∈ largeStarts f k s g ↔ a < g ∧ 2 * s * mass k g ≤ |segSum f (before a g)| := by + simp [largeStarts] + +noncomputable def selectedStart (f k : V → ℝ) (s : ℝ) (g : V) + (h : (largeStarts f k s g).Nonempty) : V := + Classical.choose ((largeStarts f k s g).exists_maximal h) + + theorem selectedStart_spec (f k : V → ℝ) (s : ℝ) (g : V) + (h : (largeStarts f k s g).Nonempty) : + Maximal (· ∈ largeStarts f k s g) (selectedStart f k s g h) := + Classical.choose_spec ((largeStarts f k s g).exists_maximal h) + +noncomputable def selectedHead (f k : V → ℝ) (s : ℝ) (g : V) : Finset V := + if h : (largeStarts f k s g).Nonempty then before (selectedStart f k s g h) g else ∅ + + theorem selectedHead_segment (hF : ForestOrder V) (f k : V → ℝ) (s : ℝ) (g : V) : + IsSegment (selectedHead f k s g) := by + unfold selectedHead + split_ifs + · exact isSegment_before hF _ _ + · exact isSegment_empty + + theorem selectedHead_subset (hF : ForestOrder V) {f k : V → ℝ} {s : ℝ} {a g : V} + (ha : a ∈ largeStarts f k s g) : selectedHead f k s g ⊆ before a g := by + have hne : (largeStarts f k s g).Nonempty := ⟨a, ha⟩ + rw [selectedHead, dite_eq_left hne] + apply before_mono + have hb := selectedStart_spec f k s g hne + exact (hF a (selectedStart f k s g hne) g + (mem_largeStarts.mp ha).1.le (mem_largeStarts.mp hb.1).1.le).elim id (hb.2 ha) + + theorem selectedHead_large {f k : V → ℝ} {s : ℝ} {a g : V} + (ha : a ∈ largeStarts f k s g) : + 2 * s * mass k g ≤ |segSum f (selectedHead f k s g)| := by + have hne : (largeStarts f k s g).Nonempty := ⟨a, ha⟩ + rw [selectedHead, dite_eq_left hne] + exact (mem_largeStarts.mp (selectedStart_spec f k s g hne).1).2 + + theorem sdiff_selectedHead_segment {f k : V → ℝ} {s : ℝ} {a g : V} + (hS : IsSegment (before a g)) : IsSegment (before a g \ selectedHead f k s g) := by + unfold selectedHead + split_ifs + · exact hS.sdiff_before rfl + · simpa using hS + +end FiniteGeometry + +section CrossTermAlgebra + +/-- Opposite sign for the selected head sum; at zero either sign is harmless. -/ +def oppositeSign (r : ℝ) : ℝ := if r < 0 then 1 else -1 + + theorem oppositeSign_sq (r : ℝ) : oppositeSign r ^ 2 = 1 := by + unfold oppositeSign + split_ifs <;> norm_num + + theorem abs_oppositeSign (r : ℝ) : |oppositeSign r| = 1 := by + unfold oppositeSign + split_ifs <;> norm_num + + theorem oppositeSign_cross {r m d : ℝ} (hd : |d| ≤ m) : + r * (oppositeSign r * m + d) ≤ 0 := by + have hd' := abs_le.mp hd + unfold oppositeSign + split_ifs with hr + · exact mul_nonpos_of_nonpos_of_nonneg hr.le (by linarith) + · exact mul_nonpos_of_nonneg_of_nonpos (le_of_not_gt hr) (by linarith) + + theorem oppositeSign_tail_abs {r m d : ℝ} (hm : 0 ≤ m) (hd : |d| ≤ m) : + |oppositeSign r * m + d| ≤ 2 * m := by + calc + |oppositeSign r * m + d| ≤ |oppositeSign r * m| + |d| := abs_add_le _ _ + _ ≤ m + m := by rw [abs_mul, abs_oppositeSign, abs_of_nonneg hm, one_mul]; linarith + _ = 2 * m := by ring + + theorem small_cross_bound {a b s m q : ℝ} (hs : 0 ≤ s) (hm : 0 ≤ m) + (ha : |a| ≤ 2 * s * m) (hb : |b| ≤ 2 * m) (hq : m ^ 2 ≤ q) : + 2 * s * a * b ≤ 8 * s ^ 2 * q := by + have hab : a * b ≤ (2 * s * m) * (2 * m) := + (le_abs_self _).trans (by rw [abs_mul]; exact mul_le_mul ha hb (abs_nonneg _) (by positivity)) + have h₁ := mul_le_mul_of_nonneg_left hab (show 0 ≤ 2 * s by positivity) + have h₂ := mul_le_mul_of_nonneg_left hq (show 0 ≤ 8 * s ^ 2 by positivity) + nlinarith + + theorem cross_sign {a b r : ℝ} (hab : 0 < a * b) (hrb : r * b ≤ 0) : a * r ≤ 0 := by + rcases lt_or_ge b 0 with hb | hb + · have ha : a < 0 := (mul_pos_iff.mp hab).resolve_left (fun hh => not_lt_of_ge hb.le hh.2) + |>.1 + have hr : 0 ≤ r := by nlinarith + exact mul_nonpos_of_nonpos_of_nonneg ha.le hr + · have hb' : 0 < b := lt_of_le_of_ne hb (by intro h; subst b; simp at hab) + have ha : 0 < a := (mul_pos_iff.mp hab).resolve_right (fun hh => not_lt_of_ge hb hh.2) + |>.1 + have hr : r ≤ 0 := by nlinarith + exact mul_nonpos_of_nonneg_of_nonpos ha.le hr + +/-- A large positive cross term is paid for by splitting off the selected suffix. -/ + theorem large_cross_bound {a b r s m : ℝ} (hs : 0 ≤ s) (hm : 0 ≤ m) + (hab : 0 < a * b) (hrb : r * b ≤ 0) (hr : 2 * s * m ≤ |r|) + (hb : |b| ≤ 2 * m) : + 2 * s * a * b ≤ (a - r) ^ 2 + r ^ 2 - a ^ 2 := by + have har := cross_sign hab hrb + have h₁ : a * b ≤ |a| * (2 * m) := + (le_abs_self _).trans (by + rw [abs_mul, mul_comm |a| |b|, mul_comm |a| (2 * m)] + exact mul_le_mul hb le_rfl (abs_nonneg a) (mul_nonneg (by norm_num) hm)) + have h₂ := mul_le_mul_of_nonneg_left h₁ (show 0 ≤ 2 * s by positivity) + have h₃ := mul_le_mul_of_nonneg_left hr (show 0 ≤ 2 * |a| by positivity) + have he : |a| * |r| = -(a * r) := by rw [← abs_mul, abs_of_nonpos har] + nlinarith [sq_nonneg r] + +end CrossTermAlgebra + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/FullDual.lean b/lean/OAI/Analysis/ForestSpace/FullDual.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e9697faa4eb4b28de691e52e18922ef142ca7ae --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/FullDual.lean @@ -0,0 +1,187 @@ +import OAI.Analysis.ForestSpace.Components + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section CoordinateDensity +variable {V : Type} [PartialOrder V] + + theorem headJ_finite_eq_sum (H : Finset V) (hH : IsLowerSet (H : Set V)) (u : J V) : + headJ (H : Set V) hH u = ∑ v ∈ H, eStar v u • e v := by + refine UniformSpace.Completion.induction_on u (isClosed_eq (headJ (H : Set V) hH).continuous + (continuous_finsetSum _ (fun v hv => (eStar v).continuous.smul continuous_const))) ?_ + intro f + rw [headJ_coe,TestVector.cut_finite_eq_sum] + change (UniformSpace.Completion.toComplL : TestVector V →L[ℝ] J V) (∑ v ∈ H, f v • TestVector.single v 1) = _ + simp only [map_sum,map_smul,eStar_coe] + rfl + + theorem exists_headJ_approx (hAnc : ∀ v : V, (Set.Iic v).Finite) + (u : J V) (ε : ℝ) (hε : 0 < ε) : + ∃ H : Finset V, ∃ hH : IsLowerSet (H : Set V), ‖u-headJ (H : Set V) hH u‖ < ε := by + obtain ⟨z,hz,hclose⟩ := Metric.mem_closure_iff.mp + (UniformSpace.Completion.denseRange_coe u) ε hε + obtain ⟨f,rfl⟩ := hz + obtain ⟨H,hSH,hH⟩ := exists_finite_lower_hull hAnc f.toFinsupp.support + have hf : SupportedOn f (H : Set V) := by + intro v hv + exact Finsupp.notMem_support_iff.mp (fun hs => hv (hSH hs)) + have he : tailJ (H : Set V) hH (f : J V) = 0 := by + change (f : J V) - headJ (H : Set V) hH (f : J V) = 0 + rw [headJ_coe,TestVector.cut_eq_self hf,sub_self] + have hn := norm_tailJ_le (H : Set V) hH (u - (f : J V)) + rw [map_sub,he,sub_zero] at hn + refine ⟨H,hH,hn.trans_lt ?_⟩ + simpa only [dist_eq_norm] using hclose + + theorem eq_zero_of_coordinates_zero (hAnc : ∀ v : V, (Set.Iic v).Finite) + {u : J V} (hu : ∀ v, eStar v u = 0) : u = 0 := by + apply norm_eq_zero.mp + apply le_antisymm ?_ (norm_nonneg _) + apply le_of_forall_pos_lt_add + intro ε hε + obtain ⟨H,hH,hh⟩ := exists_headJ_approx hAnc u ε hε + have he : headJ (H : Set V) hH u = 0 := by + rw [headJ_finite_eq_sum] + simp only [hu,zero_smul,Finset.sum_const_zero] + simpa only [he,sub_zero,zero_add] using hh + + theorem coordinateSubspace_eq_top_of_reflexive (hAnc : ∀ v : V, (Set.Iic v).Finite) + (hRefl : Reflexive (J V)) : coordinateSubspace V = ⊤ := by + let M := coordinateSubspace V + let : IsClosed (M : Set (FullDual V)) := Submodule.isClosed_topologicalClosure _ + let : NormedAddCommGroup ((FullDual V) ⧸ M) := inferInstance + let : NormedSpace ℝ ((FullDual V) ⧸ M) := inferInstance + apply top_unique + intro x hx + change x ∈ M + apply (Submodule.Quotient.mk_eq_zero M).mp + apply SeparatingDual.eq_zero_of_forall_dual_eq_zero (R := ℝ) + intro ψ + obtain ⟨u,hu⟩ := hRefl (ψ.comp M.mkQL) + have hz : ∀ v, eStar v u = 0 := by + intro v + have hv : eStar v ∈ M := Submodule.le_topologicalClosure _ (Submodule.subset_span ⟨v,rfl⟩) + have hh := congrArg (fun z : StrongDual ℝ (FullDual V) => z (eStar v)) hu + change eStar v u = ψ (M.mkQ (eStar v)) at hh + simpa only [Submodule.mkQ_apply,(Submodule.Quotient.mk_eq_zero M).mpr hv,map_zero] using hh + have hu0 := eq_zero_of_coordinates_zero hAnc hz + have hh := congrArg (fun z : StrongDual ℝ (FullDual V) => z x) hu + change x u = ψ (M.mkQ x) at hh + simpa only [Submodule.mkQ_apply,hu0,map_zero] using hh.symm + + theorem forest_coordinateSubspace_eq_top : coordinateSubspace Vertex = ⊤ := + coordinateSubspace_eq_top_of_reflexive Vertex.finiteAncestors reflexive_forest_J + +noncomputable def fullDualEquiv : X Vertex ≃ₗᵢ[ℝ] FullDual Vertex := + LinearIsometryEquiv.ofSurjective (coordinateSubspace Vertex).subtypeₗᵢ (by + intro x + exact ⟨⟨x,by rw [forest_coordinateSubspace_eq_top]; trivial⟩,rfl⟩) + + theorem reflexive_main_fullDual : Reflexive (FullDual Vertex) := + reflexive_dual reflexive_forest_J + + theorem separable_main_fullDual : TopologicalSpace.SeparableSpace (FullDual Vertex) := by + let := separable_X (V := Vertex) + exact fullDualEquiv.surjective.denseRange.separableSpace fullDualEquiv.continuous + + theorem infiniteDimensional_main_fullDual : ¬FiniteDimensional ℝ (FullDual Vertex) := by + intro h + let := h + have : Finite Vertex := linearIndependent_eStar.finite + exact Infinite.not_finite (inferInstance : Finite Vertex) + + theorem exists_main_head_approx (x : FullDual Vertex) (ε : ℝ) (hε : 0 < ε) : + ∃ H : Finset Vertex, ∃ hH : IsLowerSet (H : Set Vertex), + ‖x-P (H : Set Vertex) hH x‖ < ε := by + let z : X Vertex := fullDualEquiv.symm x + obtain ⟨H,hH,hh⟩ := exists_head_approx Vertex.finiteAncestors z ε hε + refine ⟨H,hH,?_⟩ + have hz : (z : FullDual Vertex) = x := fullDualEquiv.apply_symm_apply x + change ‖(z : FullDual Vertex)-P (H : Set Vertex) hH z‖ < ε at hh + simpa only [hz] using hh + +end CoordinateDensity + +section MainNorm + +noncomputable def mainFiniteCoordinates (H : Finset Vertex) : FullDual Vertex →L[ℝ] (H → ℝ) := + ContinuousLinearMap.pi (fun v : H => (ContinuousLinearMap.apply ℝ ℝ) (e (v : Vertex))) + + theorem mainFiniteCoordinates_kernel_finite (H : Finset Vertex) : + FiniteDimensional ℝ ((FullDual Vertex) ⧸ (mainFiniteCoordinates H).toLinearMap.ker) := + Module.Finite.equiv (mainFiniteCoordinates H).toLinearMap.quotKerEquivRange.symm + + theorem main_P_eq_zero_of_mem_ker (H : Finset Vertex) (hH : IsLowerSet (H : Set Vertex)) + {y : FullDual Vertex} (hy : y ∈ (mainFiniteCoordinates H).toLinearMap.ker) : + P (H : Set Vertex) hH y = 0 := by + have hh : mainFiniteCoordinates H y = 0 := hy + rw [P_finite_eq_sum] + apply Finset.sum_eq_zero + intro v hv + have hz : y (e v) = 0 := congrFun hh ⟨v,hv⟩ + rw [hz,zero_smul] + + theorem main_average_modulus (t : ℝ) (ht : 0 < t) : + Real.sqrt (1+t^2/12)-1 ≤ averageModulus (FullDual Vertex) norm t := by + apply averageModulus_lower_of_subspaces infiniteDimensional_main_fullDual ht.le + intro x hx ε hε + obtain ⟨H,hH,hclose⟩ := exists_main_head_approx x (ε/4) (by positivity) + let F : Cofinite (FullDual Vertex) := ⟨(mainFiniteCoordinates H).toLinearMap.ker, + (mainFiniteCoordinates H).isClosed_ker, mainFiniteCoordinates_kernel_finite H⟩ + refine ⟨F,?_⟩ + intro y hy hyn + have he : Q (H : Set Vertex) hH y = y := by + rw [Q_eq_sub,main_P_eq_zero_of_mem_ker H hH hy,sub_zero] + have hy' : Annihilates y (H : Set Vertex) := by + rw [← he] + exact annihilates_Q _ _ _ + have hpair := paired_estimate Vertex.forestOrder Vertex.finiteAncestors (H : Set Vertex) hH + (P (H : Set Vertex) hH x) (t • y) (annihilates_P _ _ _) (hy'.smul t) + rw [norm_smul,Real.norm_of_nonneg ht.le,hyn,mul_one] at hpair + have hh := pair_perturbation x (P (H : Set Vertex) hH x) (t • y) + (t^2/12) (by positivity) hx hpair + linarith + + theorem main_auc_modulus_zero {α β : ℝ} (R : EquivalentNorm (FullDual Vertex) α β) : + aucModulus (FullDual Vertex) R.N (α/(2*β)) = 0 := by + apply R.bounded_trees_auc_zero infiniteDimensional_main_fullDual + (fun h s => (Vertex.treePath h s : FullDual Vertex)) + · exact Vertex.norm_treePath + · intro h hh s hs j + change 1 ≤ ‖((Vertex.treePath h (s++[j])-Vertex.treePath h s : X Vertex) : FullDual Vertex)‖ + rw [Vertex.treePath_child h hh s hs j,eX_val,norm_eStar] + · intro h hh s hs + have hd := weakNull_coordinates _ + (Vertex.child_injective (Vertex.node h hh s (Nat.le_of_lt hs)) hs) + intro φ + have hh' := hd (φ.comp (coordinateSubspace Vertex).subtypeL) + convert hh' using 1 + ext j + change φ (((Vertex.treePath h (s++[j])-Vertex.treePath h s : X Vertex) : FullDual Vertex)) = _ + rw [Vertex.treePath_child h hh s hs j] + rfl + + + theorem main_no_equivalent_AUC {α β : ℝ} (R : EquivalentNorm (FullDual Vertex) α β) : + ¬IsAUC R.N := by + intro h + have hp : 0 < α/(2*β) := div_pos R.alpha_pos (mul_pos (by norm_num) (R.alpha_pos.trans_le R.alpha_le_beta)) + have hh := h _ hp + rw [main_auc_modulus_zero R] at hh + exact lt_irrefl _ hh + +end MainNorm + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Lens.lean b/lean/OAI/Analysis/ForestSpace/Lens.lean new file mode 100644 index 0000000000000000000000000000000000000000..d22859f2045bc5de5893b22098690bef995a133c --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Lens.lean @@ -0,0 +1,160 @@ +import OAI.Analysis.ForestSpace.FullDual + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section Lens +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + + theorem bounded_finiteDimensional_pair {G : Type} [NormedAddCommGroup G] + [NormedSpace ℝ G] [FiniteDimensional ℝ G] (v : ℕ → G) (R : ℝ) + (hv : ∀ j, ‖v j‖ ≤ R) (η : ℝ) (hη : 0 < η) : + ∃ i j : ℕ, i ≠ j ∧ ‖v i-v j‖ < 2*η := by + obtain ⟨s,hfin,hcover⟩ := Metric.totallyBounded_iff.mp + (isCompact_closedBall (0 : G) R).totallyBounded η hη + have hex : ∀ n : ℕ, ∃ a : s, dist (v n) a.val < η := by + intro n + have hn : v n ∈ Metric.closedBall (0 : G) R := by simpa using hv n + obtain ⟨a,ha,hna⟩ := Set.mem_iUnion₂.mp (hcover hn) + exact ⟨⟨a,ha⟩,hna⟩ + choose a ha using hex + let := hfin.fintype + obtain ⟨i,j,hij,he⟩ := Finite.exists_ne_map_eq_of_infinite a + refine ⟨i,j,hij,?_⟩ + have hj : dist (v j) (a i).val < η := by rw [he]; exact ha j + have hh := dist_triangle (v i) (a i).val (v j) + rw [dist_comm (a i).val (v j),dist_eq_norm (v i) (v j)] at hh + linarith [ha i] + + theorem norm_half_sum_le (a b : E) : ‖(1/2 : ℝ) • (a+b)‖ ≤ (‖a‖+‖b‖)/2 := by + rw [norm_smul,Real.norm_of_nonneg (by norm_num : 0 ≤ (1/2 : ℝ))] + nlinarith [norm_add_le a b] + + theorem norm_le_signed_average (x y : E) : ‖x‖ ≤ (‖x+y‖+‖x-y‖)/2 := by + have he : (1/2 : ℝ) • ((x+y)+(x-y)) = x := by module + have hh := norm_half_sum_le (x+y) (x-y) + rwa [he] at hh + + theorem norm_right_le_signed_average (x y : E) : ‖y‖ ≤ (‖x+y‖+‖x-y‖)/2 := by + have hh := norm_le_signed_average y x + simpa only [add_comm y x,norm_sub_rev y x] using hh + + theorem main_head_pair (H : Finset Vertex) (hH : IsLowerSet (H : Set Vertex)) + (y : ℕ → FullDual Vertex) (R : ℝ) (hy : ∀ j, ‖y j‖ ≤ R) + (η : ℝ) (hη : 0 < η) : + ∃ i j : ℕ, i ≠ j ∧ ‖P (H : Set Vertex) hH (y i-y j)‖ < 2*η := by + let M := Submodule.span ℝ (eStar '' (H : Set Vertex)) + let : FiniteDimensional ℝ M := FiniteDimensional.span_of_finite ℝ (H.finite_toSet.image eStar) + let L : FullDual Vertex →L[ℝ] M := (P (H : Set Vertex) hH).codRestrict M (by + intro z + rw [P_finite_eq_sum] + apply Submodule.sum_mem + intro v hv + exact Submodule.smul_mem _ _ (Submodule.subset_span ⟨v,hv,rfl⟩)) + obtain ⟨i,j,hij,hh⟩ := bounded_finiteDimensional_pair (fun j => L (y j)) R + (fun j => (norm_P_le (H : Set Vertex) hH (y j)).trans (hy j)) η hη + refine ⟨i,j,hij,?_⟩ + change ‖P (H : Set Vertex) hH (y i)-P (H : Set Vertex) hH (y j)‖ < 2*η at hh + simpa only [map_sub] using hh + + theorem main_lens_aprox (R ε : ℝ) (hR : 0 < R) (hε : 0 < ε) + (x : FullDual Vertex) (y : ℕ → FullDual Vertex) + (hp : ∀ j, ‖x+y j‖ ≤ R) (hm : ∀ j, ‖x-y j‖ ≤ R) + (hs : ∀ i j, i ≠ j → ε ≤ ‖y i-y j‖) + (η : ℝ) (hη : 0 < η) (hη1 : η ≤ 1) : + ‖x‖^2+ε^2/48 ≤ R^2+8*(R+1)*η := by + have hxn : ‖x‖ ≤ R := by linarith [norm_le_signed_average x (y 0),hp 0,hm 0] + have hyn : ∀ j, ‖y j‖ ≤ R := by + intro j + linarith [norm_right_le_signed_average x (y j),hp j,hm j] + obtain ⟨H,hH,hclose⟩ := exists_main_head_approx x η hη + obtain ⟨i,j,hij,hijclose⟩ := main_head_pair H hH y R hyn η hη + let z : FullDual Vertex := (1/2 : ℝ) • (y i-y j) + have hzp : ‖x+z‖ ≤ R := by + have he : x+z = (1/2 : ℝ) • ((x+y i)+(x-y j)) := by dsimp [z]; module + rw [he] + linarith [norm_half_sum_le (x+y i) (x-y j),hp i,hm j] + have hzm : ‖x-z‖ ≤ R := by + have he : x-z = (1/2 : ℝ) • ((x-y i)+(x+y j)) := by dsimp [z]; module + rw [he] + linarith [norm_half_sum_le (x-y i) (x+y j),hm i,hp j] + have hzn : ‖z‖ ≤ R := by linarith [norm_right_le_signed_average x z] + have hzsep : ε/2 ≤ ‖z‖ := by + dsimp [z] + rw [norm_smul,Real.norm_of_nonneg (by norm_num : 0 ≤ (1/2 : ℝ))] + linarith [hs i j hij] + have hzP : ‖P (H : Set Vertex) hH z‖ < η := by + dsimp [z] + rw [map_smul,norm_smul,Real.norm_of_nonneg (by norm_num : 0 ≤ (1/2 : ℝ))] + linarith + let a := P (H : Set Vertex) hH x + let b := Q (H : Set Vertex) hH z + have haR : ‖a‖ ≤ R := (norm_P_le _ _ _).trans hxn + have hbR : ‖b‖ ≤ R := (norm_Q_le _ _ _).trans hzn + have hxa : ‖x‖ ≤ ‖a‖+η := by + have hh := norm_add_le (x-a) a + rw [sub_add_cancel] at hh + linarith + have hzb : ε/2 ≤ ‖b‖+η := by + have hb : z = b+P (H : Set Vertex) hH z := by dsimp [b]; rw [Q_eq_sub]; abel + have hh := norm_add_le b (P (H : Set Vertex) hH z) + rw [← hb] at hh + linarith + have hp' : ‖a+b‖ ≤ R+2*η := by + have he : a+b = (x+z)-(x-a)-P (H : Set Vertex) hH z := by + dsimp [b]; rw [Q_eq_sub]; abel + rw [he] + have hh := norm_sub_le ((x+z)-(x-a)) (P (H : Set Vertex) hH z) + have hh' := norm_sub_le (x+z) (x-a) + linarith + have hm' : ‖a-b‖ ≤ R+2*η := by + have he : a-b = (x-z)-(x-a)+P (H : Set Vertex) hH z := by + dsimp [b]; rw [Q_eq_sub]; abel + rw [he] + have hh := norm_add_le ((x-z)-(x-a)) (P (H : Set Vertex) hH z) + have hh' := norm_sub_le (x-z) (x-a) + linarith + have hpair := paired_estimate Vertex.forestOrder Vertex.finiteAncestors (H : Set Vertex) hH a b + (annihilates_P _ _ _) (annihilates_Q _ _ _) + have hroot : Real.sqrt (‖a‖^2+‖b‖^2/12) ≤ R+2*η := by linarith + have hsq : ‖a‖^2+‖b‖^2/12 ≤ (R+2*η)^2 := (Real.sqrt_le_iff.mp hroot).2 + have hxsq : ‖x‖^2 ≤ ‖a‖^2+2*R*η+η^2 := by + nlinarith [norm_nonneg x,norm_nonneg a,mul_nonneg hη.le (sub_nonneg.mpr haR)] + have hzsq : ε^2/4 ≤ ‖b‖^2+2*R*η+η^2 := by + nlinarith [norm_nonneg b,mul_nonneg hη.le (sub_nonneg.mpr hbR)] + have heta : η^2 ≤ η := by nlinarith + nlinarith [mul_nonneg hR.le hη.le] + +/-- The squared separated-midpoint deficit. -/ + theorem main_lens (R ε : ℝ) (hR : 0 < R) (hε : 0 < ε) + (x : FullDual Vertex) (y : ℕ → FullDual Vertex) + (hp : ∀ j, ‖x+y j‖ ≤ R) (hm : ∀ j, ‖x-y j‖ ≤ R) + (hs : ∀ i j, i ≠ j → ε ≤ ‖y i-y j‖) : + ε^2/48 ≤ R^2-‖x‖^2 := by + have hh : ‖x‖^2+ε^2/48 ≤ R^2 := by + apply le_of_forall_pos_le_add + intro δ hδ + let η := min 1 (δ/(8*(R+1))) + have hc : 0 < 8*(R+1) := by positivity + have hη : 0 < η := lt_min (by norm_num) (div_pos hδ hc) + have hb := main_lens_aprox R ε hR hε x y hp hm hs η hη (min_le_left _ _) + have he : 8*(R+1)*η ≤ δ := by + rw [mul_comm] + exact (le_div_iff₀ hc).mp (min_le_right _ _) + linarith + linarith + +end Lens + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Main.lean b/lean/OAI/Analysis/ForestSpace/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..3fa429babf1e6b5530388da4f6234f3cd55bcb58 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Main.lean @@ -0,0 +1,53 @@ +import OAI.Analysis.ForestSpace.Exhaustions + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +/-- The space +is the full continuous dual of the specified segment-norm completion, not the +coordinate completion in place of that dual. -/ +theorem main_theorem : + (¬FiniteDimensional ℝ (FullDual Vertex)) ∧ + TopologicalSpace.SeparableSpace (FullDual Vertex) ∧ + Reflexive (FullDual Vertex) ∧ + (∀ (α β : ℝ) (R : EquivalentNorm (FullDual Vertex) α β), ¬IsAUC R.N) ∧ + (∀ t : ℝ, 0 < t → + Real.sqrt (1+t^2/12)-1 ≤ averageModulus (FullDual Vertex) norm t) ∧ + (∀ (k : ℕ) (f : (Diamond.diamond k).V → FullDual Vertex) (C : ℝ), + Diamond.EmbeddingBound k f C → Real.sqrt (1+(k:ℝ)/12) ≤ C) := by + exact ⟨infiniteDimensional_main_fullDual, separable_main_fullDual, + reflexive_main_fullDual, fun _ _ R => main_no_equivalent_AUC R, + main_average_modulus, main_diamond_distortion⟩ + +/-- The general-forest refinement. `ForestOrder` says that each +ancestor set is a chain; finite ancestor sets provide the rooted-forest +structure. No reflexivity or full-dual identification is assumed here. -/ +theorem general_forest_main (V : Type) [PartialOrder V] [Countable V] [Infinite V] + (hF : ForestOrder V) (hAnc : ∀ v : V, (Set.Iic v).Finite) : + (∀ (H : Finset V) (hH : IsLowerSet (H : Set V)) (x y : X V), + x = PX H hH x → y = QX H hH y → + Real.sqrt (‖x‖^2+‖y‖^2/12) ≤ (‖x+y‖+‖x-y‖)/2) ∧ + (∀ (H : Finset V) (hH : IsLowerSet (H : Set V)) (x y : X V), + x = PX H hH x → y = QX H hH y → ∀ (s t : ℝ), 0 < s → 0 < t → + (‖x‖+s*t*‖y‖)/Real.sqrt (1+12*s^2) ≤ (‖x+t•y‖+‖x-t•y‖)/2) ∧ + (∀ t : ℝ, 0 < t → Real.sqrt (1+t^2/12)-1 ≤ averageModulus (X V) norm t) := by + exact ⟨paired_X hF hAnc, paired_X_two_parameters hF hAnc, forest_average_modulus hF hAnc⟩ + +/-- The last clause of the general-forest refinement, with exactly the +scale `alpha/(2 beta)` and every equivalent norm. -/ +theorem word_forest_main (α β : ℝ) (R : EquivalentNorm (X Word) α β) : + aucModulus (X Word) R.N (α/(2*β)) = 0 := + word_auc_modulus_zero R + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Moduli.lean b/lean/OAI/Analysis/ForestSpace/Moduli.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4b2574c4f02758b60cff4d8affd019ef8673606 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Moduli.lean @@ -0,0 +1,75 @@ +import Mathlib + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section ModulusDefinitions +variable (E : Type) [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- The closed finite-codimensional subspaces. -/ +def Cofinite : Type := + {F : Submodule ℝ E // IsClosed (F : Set E) ∧ FiniteDimensional ℝ (E ⧸ F)} + +noncomputable def cofiniteTop : Cofinite E := + ⟨⊤, by simp, inferInstance⟩ + +/-- The inner one-sided excess values and their infimum. -/ +def aucValues (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : Set ℝ := + {a | ∃ y : E, y ∈ F.val ∧ N y = 1 ∧ a = N (x + t • y) - 1} + +noncomputable def aucInner (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : ℝ := + sInf (aucValues E N t x F) + +noncomputable def aucCenter (N : E → ℝ) (t : ℝ) (x : E) : ℝ := + sSup (Set.range (aucInner E N t x)) + +/-- The one-sided asymptotic uniform convexity modulus, with the order +of infimum, supremum and infimum. -/ +noncomputable def aucModulus (N : E → ℝ) (t : ℝ) : ℝ := + sInf {a | ∃ x : E, N x = 1 ∧ a = aucCenter E N t x} + +/-- The inner averaged signed excess; it is not replaced by a maximum. -/ +def averageValues (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : Set ℝ := + {a | ∃ y : E, y ∈ F.val ∧ N y = 1 ∧ + a = (N (x+t•y) + N (x-t•y))/((2 : ℕ) : ℝ) - 1} + +noncomputable def averageInner (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : ℝ := + sInf (averageValues E N t x F) + +noncomputable def averageCenter (N : E → ℝ) (t : ℝ) (x : E) : ℝ := + sSup (Set.range (averageInner E N t x)) + +/-- The averaged asymptotic midpoint modulus. -/ +noncomputable def averageModulus (N : E → ℝ) (t : ℝ) : ℝ := + sInf {a | ∃ x : E, N x = 1 ∧ a = averageCenter E N t x} + +end ModulusDefinitions + +/-- An equivalent norm is kept as its exact real seminorm, with explicit positive +comparison constants. The lower inequality makes it a norm. -/ +structure EquivalentNorm (E : Type) [NormedAddCommGroup E] [NormedSpace ℝ E] + (α β : ℝ) where + N : Seminorm ℝ E + alpha_pos : 0 < α + alpha_le_beta : α ≤ β + lower : ∀ x : E, α*‖x‖ ≤ N x + upper : ∀ x : E, N x ≤ β*‖x‖ +/-- Canonical (not merely abstract) reflexivity. -/ +def Reflexive (E : Type) [NormedAddCommGroup E] [NormedSpace ℝ E] : Prop := + Function.Surjective (NormedSpace.inclusionInDoubleDual ℝ E) +/-- AUC requires positivity at every strictly positive parameter. -/ +def IsAUC {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] (N : E → ℝ) : Prop := + ∀ t : ℝ, 0 < t → 0 < aucModulus E N t + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/ModulusProofs.lean b/lean/OAI/Analysis/ForestSpace/ModulusProofs.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4406ace034790b32a06864577841baefaa4ce11 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/ModulusProofs.lean @@ -0,0 +1,166 @@ +import OAI.Analysis.ForestSpace.Moduli +import OAI.Analysis.ForestSpace.Projections + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section ModulusDefinitions + +variable (E : Type) [NormedAddCommGroup E] [NormedSpace ℝ E] + +variable {E} + + theorem cofinite_nontrivial (hI : ¬FiniteDimensional ℝ E) (F : Cofinite E) : + Nontrivial F.val := by + apply not_subsingleton_iff_nontrivial.mp + intro hss + let := hss + let : FiniteDimensional ℝ F.val := Module.Finite.of_injective + (0 : F.val →ₗ[ℝ] ℝ) (fun _ _ _ => Subsingleton.elim _ _) + let : FiniteDimensional ℝ (E ⧸ F.val) := F.property.2 + exact hI (Module.Finite.of_submodule_quotient F.val) + + theorem cofinite_exists_unit (hI : ¬FiniteDimensional ℝ E) (F : Cofinite E) : + ∃ y : E, y ∈ F.val ∧ ‖y‖ = 1 := by + let := cofinite_nontrivial hI F + obtain ⟨y,hy⟩ := exists_norm_eq F.val zero_le_one + exact ⟨y,y.property,hy⟩ + + theorem cofiniteKernel {G : Type} [NormedAddCommGroup G] [NormedSpace ℝ G] + [FiniteDimensional ℝ G] (f : E →L[ℝ] G) : + IsClosed (f.toLinearMap.ker : Set E) ∧ FiniteDimensional ℝ (E ⧸ f.toLinearMap.ker) := by + exact ⟨f.isClosed_ker, Module.Finite.equiv f.toLinearMap.quotKerEquivRange.symm⟩ + + theorem averageValues_nonempty (hI : ¬FiniteDimensional ℝ E) + (t : ℝ) (x : E) (F : Cofinite E) : (averageValues E norm t x F).Nonempty := by + obtain ⟨y,hy,hyn⟩ := cofinite_exists_unit hI F + exact ⟨_,y,hy,hyn,rfl⟩ + + theorem averageValues_bddBelow (t : ℝ) (x : E) (F : Cofinite E) : + BddBelow (averageValues E norm t x F) := by + refine ⟨-1, ?_⟩ + rintro a ⟨y,hy,hyn,rfl⟩ + linarith [norm_nonneg (x+t•y),norm_nonneg (x-t•y)] + + theorem averageInner_le (hI : ¬FiniteDimensional ℝ E) + {t : ℝ} (ht : 0 ≤ t) {x : E} (hx : ‖x‖ = 1) (F : Cofinite E) : + averageInner E norm t x F ≤ t := by + obtain ⟨y,hy,hyn⟩ := cofinite_exists_unit hI F + have hp := norm_add_le x (t•y) + have hm := norm_sub_le x (t•y) + rw [hx,norm_smul,Real.norm_of_nonneg ht,hyn,mul_one] at hp hm + have hh : averageInner E norm t x F ≤ (‖x+t•y‖+‖x-t•y‖)/2-1 := + csInf_le (averageValues_bddBelow t x F) ⟨y,hy,hyn,rfl⟩ + linarith + + theorem averageCenter_bddAbove (hI : ¬FiniteDimensional ℝ E) + {t : ℝ} (ht : 0 ≤ t) {x : E} (hx : ‖x‖ = 1) : + BddAbove (Set.range (averageInner E norm t x)) := by + exact ⟨t, fun a ⟨F,hF⟩ => hF ▸ averageInner_le hI ht hx F⟩ + +/-- A quantitative subspace formulation implies the literal inf-sup-inf bound. +The nonempty-inner-sphere and bounded-supremum details are explicit. -/ + theorem averageModulus_lower_of_subspaces (hI : ¬FiniteDimensional ℝ E) + {t L : ℝ} (ht : 0 ≤ t) + (h : ∀ x : E, ‖x‖ = 1 → ∀ ε : ℝ, 0 < ε → ∃ F : Cofinite E, + ∀ y : E, y ∈ F.val → ‖y‖ = 1 → L-ε ≤ (‖x+t•y‖+‖x-t•y‖)/2-1) : + L ≤ averageModulus E norm t := by + have hunit : ∃ x : E, ‖x‖ = 1 := by + obtain ⟨x,hx,hxn⟩ := cofinite_exists_unit hI (cofiniteTop E) + exact ⟨x,hxn⟩ + apply le_csInf + · obtain ⟨x,hx⟩ := hunit + exact ⟨_,x,hx,rfl⟩ + · rintro a ⟨x,hx,rfl⟩ + apply le_of_forall_pos_le_add + intro ε hε + obtain ⟨F,hF⟩ := h x hx ε hε + have hb : L-ε ≤ averageInner E norm t x F := by + apply le_csInf (averageValues_nonempty hI t x F) + rintro b ⟨y,hy,hyn,rfl⟩ + exact hF y hy hyn + have hs : averageInner E norm t x F ≤ averageCenter E norm t x := + le_csSup (averageCenter_bddAbove hI ht hx) ⟨F,rfl⟩ + linarith + +end ModulusDefinitions + +section ForestModulus +variable {V : Type} [PartialOrder V] + + theorem sqrt_perturbation {a b δ : ℝ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hδ : 0 ≤ δ) + (h1 : 1 ≤ a+δ) : Real.sqrt (1+b) ≤ Real.sqrt (a^2+b)+δ := by + have hs := Real.sq_sqrt (show 0 ≤ a^2+b by positivity) + have has : a ≤ Real.sqrt (a^2+b) := (Real.le_sqrt ha (show 0 ≤ a^2+b by positivity)).mpr (by linarith) + apply Real.sqrt_le_iff.mpr + constructor + · positivity + · nlinarith [mul_nonneg hδ (sub_nonneg.mpr has), sq_nonneg (a+δ-1)] + +theorem pair_perturbation {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + (x a y : E) (b : ℝ) (hb : 0 ≤ b) (hx : ‖x‖ = 1) + (hpair : Real.sqrt (‖a‖^2+b) ≤ (‖a+y‖+‖a-y‖)/2) : + Real.sqrt (1+b) ≤ (‖x+y‖+‖x-y‖)/2+2*‖x-a‖ := by + let δ : ℝ := ‖x-a‖ + have hc : 1 ≤ ‖a‖+δ := by + have hh := norm_add_le a (x-a) + have he : a+(x-a) = x := by abel + rw [he, hx] at hh + exact hh + have hroot := sqrt_perturbation (norm_nonneg a) hb (norm_nonneg (x-a)) hc + have hp : ‖a+y‖ ≤ ‖x+y‖+δ := by + have hh := norm_sub_le (x+y) (x-a) + have he : x+y-(x-a) = a+y := by abel + rwa [he] at hh + have hm : ‖a-y‖ ≤ ‖x-y‖+δ := by + have hh := norm_sub_le (x-y) (x-a) + have he : x-y-(x-a) = a-y := by abel + rwa [he] at hh + change Real.sqrt (1+b) ≤ (‖x+y‖+‖x-y‖)/2+2*δ + linarith + + theorem forest_average_head (hF : ForestOrder V) (hAnc : ∀ v : V, (Set.Iic v).Finite) + (H : Finset V) (hH : IsLowerSet (H : Set V)) (x y : X V) + (hx : ‖x‖ = 1) (hy : y ∈ (finiteCoordinates H).toLinearMap.ker) + (hyn : ‖y‖ = 1) (t : ℝ) (ht : 0 ≤ t) : + Real.sqrt (1+t^2/12) ≤ (‖x+t•y‖+‖x-t•y‖)/2+2*‖x-PX H hH x‖ := by + have hy' := annihilates_of_mem_ker_coordinates H hH hy + have hpair := paired_estimate hF hAnc (H : Set V) hH + (P (H : Set V) hH x) (t • (y : FullDual V)) + (annihilates_P (H : Set V) hH x) (hy'.smul t) + have hyn' : ‖(y : FullDual V)‖ = 1 := hyn + rw [norm_smul, Real.norm_of_nonneg ht, hyn', mul_one] at hpair + have hh := pair_perturbation (x : FullDual V) (P (H : Set V) hH x) + (t • (y : FullDual V)) (t^2/12) (by positivity) hx hpair + exact hh + +/-- The midpoint bound for every coordinate-completion forest, +using the averaged signed excess rather than its maximum. -/ + theorem forest_average_modulus [Infinite V] + (hF : ForestOrder V) (hAnc : ∀ v : V, (Set.Iic v).Finite) + (t : ℝ) (ht : 0 < t) : + Real.sqrt (1+t^2/12)-1 ≤ averageModulus (X V) norm t := by + apply averageModulus_lower_of_subspaces (E := X V) (not_finiteDimensional_X (V := V)) ht.le + intro x hx ε hε + obtain ⟨H,hH,hclose⟩ := exists_head_approx hAnc x (ε/4) (by positivity) + let F : Cofinite (X V) := ⟨(finiteCoordinates H).toLinearMap.ker, + (finiteCoordinates H).isClosed_ker, finiteCoordinates_kernel_finite H⟩ + refine ⟨F, ?_⟩ + intro y hy hyn + have hh := forest_average_head hF hAnc H hH x y hx hy hyn t ht.le + linarith + +end ForestModulus + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Norm.lean b/lean/OAI/Analysis/ForestSpace/Norm.lean new file mode 100644 index 0000000000000000000000000000000000000000..67af2f20534d5867bdf48fed94300ab0504d86d8 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Norm.lean @@ -0,0 +1,267 @@ +import OAI.Analysis.ForestSpace.Paired + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section SegmentNorm +variable {V : Type} [PartialOrder V] + +/-- All squared disjoint-segment tests. Quantifying over finite index types +is equivalent to families S₁,...,Sₘ; a zero-sized family +adds only zero to the set of test values. -/ +def testValues (u : V → ℝ) : Set ℝ := + {r | ∃ (ι : Type) (_ : Fintype ι) (S : ι → Finset V), + (∀ i, IsSegment (S i)) ∧ Pairwise (fun i j => Disjoint (S i) (S j)) ∧ + r = ∑ i, segSum u (S i) ^ 2} + +noncomputable def squareSup (u : V → ℝ) : ℝ := sSup (testValues u) + +/-- Exactly the disjoint-segment norm, written as the square root of its +squared testing supremum. -/ +noncomputable def rho (u : V → ℝ) : ℝ := Real.sqrt (squareSup u) + + theorem zero_mem_testValues (u : V → ℝ) : 0 ∈ testValues u := by + refine ⟨PEmpty, inferInstance, PEmpty.elim, by simp, by simp [Pairwise], ?_⟩ + simp + + theorem TestBound.bddAbove {u : V → ℝ} {C : ℝ} (h : TestBound u C) : + BddAbove (testValues u) := by + refine ⟨C, ?_⟩ + rintro r ⟨ι, inst, S, hs, hd, rfl⟩ + exact h ι inst S hs hd + + theorem TestBound.squareSup_le {u : V → ℝ} {C : ℝ} (h : TestBound u C) : + squareSup u ≤ C := by + apply csSup_le ⟨0, zero_mem_testValues u⟩ + rintro r ⟨ι, inst, S, hs, hd, rfl⟩ + exact h ι inst S hs hd + + theorem testBound_squareSup {u : V → ℝ} (hu : ∃ C, TestBound u C) : + TestBound u (squareSup u) := by + intro ι inst S hs hd + exact le_csSup hu.choose_spec.bddAbove ⟨ι, inst, S, hs, hd, rfl⟩ + + theorem squareSup_nonneg {u : V → ℝ} (hu : ∃ C, TestBound u C) : 0 ≤ squareSup u := + (testBound_squareSup hu).nonneg + + theorem rho_nonneg (u : V → ℝ) : 0 ≤ rho u := Real.sqrt_nonneg _ + + theorem rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : rho u ^ 2 = squareSup u := + Real.sq_sqrt (squareSup_nonneg hu) + + theorem testBound_rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : TestBound u (rho u ^ 2) := by + rw [rho_sq hu] + exact testBound_squareSup hu + + theorem rho_le_of_testBound {u : V → ℝ} {C : ℝ} (hC : 0 ≤ C) + (hu : TestBound u (C ^ 2)) : rho u ≤ C := + Real.sqrt_le_iff.mpr ⟨hC, hu.squareSup_le⟩ + + theorem testBound_of_rho_le {u : V → ℝ} (hu : ∃ C, TestBound u C) + {C : ℝ} (h : rho u ≤ C) : TestBound u (C ^ 2) := + (testBound_rho_sq hu).mono (by nlinarith [rho_nonneg u]) + + theorem rho_add_le {u v : V → ℝ} (hu : ∃ C, TestBound u C) (hv : ∃ C, TestBound v C) : + rho (u + v) ≤ rho u + rho v := + rho_le_of_testBound (add_nonneg (rho_nonneg u) (rho_nonneg v)) + ((testBound_rho_sq hu).add (testBound_rho_sq hv) (rho_nonneg u) (rho_nonneg v)) + + theorem rho_smul_le {u : V → ℝ} (hu : ∃ C, TestBound u C) (a : ℝ) : + rho (a • u) ≤ |a| * rho u := by + apply rho_le_of_testBound (mul_nonneg (abs_nonneg a) (rho_nonneg u)) + have hh := (testBound_rho_sq hu).smul a + simpa only [mul_pow, sq_abs] using hh + + theorem rho_zero : rho (0 : V → ℝ) = 0 := by + apply le_antisymm _ (rho_nonneg _) + apply rho_le_of_testBound (C := 0) (by norm_num) + simpa using (TestBound.zero : TestBound (0 : V → ℝ) 0) + + theorem rho_smul {u : V → ℝ} (hu : ∃ C, TestBound u C) (a : ℝ) : + rho (a • u) = |a| * rho u := by + apply le_antisymm (rho_smul_le hu a) + by_cases ha : a = 0 + · subst a + simp [rho_zero] + · have hb : ∃ C, TestBound (a • u) C := ⟨_, hu.choose_spec.smul a⟩ + have hh := rho_smul_le hb a⁻¹ + rw [inv_smul_smul₀ ha] at hh + have hpos : 0 < |a| := abs_pos.mpr ha + have ht := mul_le_mul_of_nonneg_left hh hpos.le + simpa [abs_inv, ← mul_assoc, ne_of_gt hpos] using ht + + theorem coordinate_le_rho {u : V → ℝ} (hu : ∃ C, TestBound u C) (v : V) : + |u v| ≤ rho u := by + have hh := (testBound_rho_sq hu).single (isSegment_singleton v) + simp only [segSum, sum_singleton] at hh + exact (sq_le_sq₀ (abs_nonneg _) (rho_nonneg _)).mp (by simpa only [sq_abs] using hh) + +noncomputable def l1size (u : V →₀ ℝ) : ℝ := ∑ v ∈ u.support, |u v| + +omit [PartialOrder V] in + theorem l1size_nonneg [PartialOrder V] (u : V →₀ ℝ) : 0 ≤ l1size u := + sum_nonneg (fun vertex _ => abs_nonneg (u vertex)) + +omit [PartialOrder V] in + theorem finset_abs_sum_le_l1size [PartialOrder V] (u : V →₀ ℝ) (S : Finset V) : + ∑ v ∈ S, |u v| ≤ l1size u := by + have he : (∑ v ∈ S ∪ u.support, |u v|) = l1size u := by + symm + apply sum_subset subset_union_right + intro v hv hn + rw [Finsupp.notMem_support_iff.mp hn, abs_zero] + rw [← he] + exact sum_le_sum_of_subset_of_nonneg subset_union_left (fun v hv hn => abs_nonneg _) + + theorem testBound_l1size (u : V →₀ ℝ) : TestBound u (l1size u ^ 2) := by + intro ι inst S hS hd + have habs : (∑ i, |segSum u (S i)|) ≤ l1size u := by + calc + (∑ i, |segSum u (S i)|) ≤ ∑ i, ∑ v ∈ S i, |u v| := + sum_le_sum fun i hi => abs_sum_le_sum_abs _ _ + _ = ∑ v ∈ univ.biUnion S, |u v| := + (sum_biUnion (by intro i hi j hj hij; exact hd hij)).symm + _ ≤ l1size u := finset_abs_sum_le_l1size u _ + have hsq := sum_sq_le_sq_sum_of_nonneg + (s := (univ : Finset ι)) (f := fun i => |segSum u (S i)|) (fun i hi => abs_nonneg _) + simp only [sq_abs] at hsq + have hnonneg : 0 ≤ ∑ i, |segSum u (S i)| := sum_nonneg (fun i hi => abs_nonneg _) + nlinarith [l1size_nonneg u] + + theorem finsupp_has_testBound (u : V →₀ ℝ) : ∃ C, TestBound u C := ⟨_, testBound_l1size u⟩ + + theorem rho_le_l1size (u : V →₀ ℝ) : rho u ≤ l1size u := + rho_le_of_testBound (l1size_nonneg u) (testBound_l1size u) + + theorem finsupp_rho_eq_zero (u : V →₀ ℝ) : rho u = 0 ↔ u = 0 := by + constructor + · intro h + ext v + have hh := coordinate_le_rho (finsupp_has_testBound u) v + rw [h] at hh + exact abs_nonpos_iff.mp hh + · rintro rfl + exact rho_zero + +end SegmentNorm + +section SourceNormFidelity +variable {V : Type} [PartialOrder V] + +/-- Nonempty finite convex chains are precisely the ancestral intervals. +This rules out a change in the allowed segment tests. -/ +theorem nonempty_segment_iff_interval (hF : ForestOrder V) (S : Finset V) : + IsSegment S ∧ S.Nonempty ↔ + ∃ a b : V, a ≤ b ∧ ∀ v, v ∈ S ↔ a ≤ v ∧ v ≤ b := by + constructor + · rintro ⟨hS,hne⟩ + obtain ⟨a,ha,b,hb,h⟩ := hS.endpoints hne + exact ⟨a,b,(h b).mp hb |>.1,h⟩ + · rintro ⟨a,b,hab,h⟩ + constructor + · constructor + · intro v hv w hw + exact hF v w b ((h v).mp hv).2 ((h w).mp hw).2 + · intro v hv w hw z hvz hzw + exact (h z).mpr ⟨((h v).mp hv).1.trans hvz, hzw.trans ((h w).mp hw).2⟩ + · exact ⟨a,(h a).mpr ⟨le_rfl,hab⟩⟩ + +/-- The testing set with m≥1, nonempty +segments, and the square root taken before the supremum. -/ +def sourceNormValues (u : V → ℝ) : Set ℝ := + {r | ∃ (m : ℕ), 0 < m ∧ ∃ S : Fin m → Finset V, + (∀ i, IsSegment (S i) ∧ (S i).Nonempty) ∧ + Pairwise (fun i j => Disjoint (S i) (S j)) ∧ + r = Real.sqrt (∑ i, segSum u (S i)^2)} + +theorem sourceNormValues_nonempty [Nonempty V] (u : V → ℝ) : + (sourceNormValues u).Nonempty := by + obtain ⟨v⟩ := ‹Nonempty V› + refine ⟨_,1,by norm_num,fun _ => {v},?_,?_,rfl⟩ + · intro i + exact ⟨isSegment_singleton v, by simp⟩ + · intro i j hij + exact (hij (Subsingleton.elim i j)).elim + +theorem sourceNormValues_le_rho {u : V → ℝ} (hu : ∃ C, TestBound u C) + {r : ℝ} (hr : r ∈ sourceNormValues u) : r ≤ rho u := by + obtain ⟨m,hm,S,hS,hd,rfl⟩ := hr + apply Real.sqrt_le_iff.mpr + exact ⟨rho_nonneg u, testBound_rho_sq hu (Fin m) inferInstance S (fun i => (hS i).1) hd⟩ + +theorem sourceNormValues_bddAbove {u : V → ℝ} (hu : ∃ C, TestBound u C) : + BddAbove (sourceNormValues u) := + ⟨rho u,fun _ h => sourceNormValues_le_rho hu h⟩ + +theorem sourceNormValues_sup_nonneg [Nonempty V] {u : V → ℝ} + (hu : ∃ C, TestBound u C) : 0 ≤ sSup (sourceNormValues u) := by + obtain ⟨r,hr⟩ := sourceNormValues_nonempty u + have hr0 : 0 ≤ r := by + obtain ⟨m,hm,S,hS,hd,rfl⟩ := hr + exact Real.sqrt_nonneg _ + exact hr0.trans (le_csSup (sourceNormValues_bddAbove hu) hr) + +/-- Erasing empty zero tests and enumerating the remaining finite family does +not alter its squared sum. -/ +theorem testBound_from_source_sup [Nonempty V] {u : V → ℝ} + (hu : ∃ C, TestBound u C) : TestBound u (sSup (sourceNormValues u)^2) := by + classical + intro ι inst S hS hd + let I := {i : ι // (S i).Nonempty} + by_cases hI : Nonempty I + · let := hI + let e : Fin (Fintype.card I) ≃ I := (Fintype.equivFin I).symm + let T : Fin (Fintype.card I) → Finset V := fun i => S (e i).val + have hT : ∀ i, IsSegment (T i) ∧ (T i).Nonempty := fun i => + ⟨hS (e i).val,(e i).property⟩ + have hdT : Pairwise (fun i j => Disjoint (T i) (T j)) := by + intro i j hij + exact hd (fun h => hij (e.injective (Subtype.ext h))) + have hsum : (∑ i, segSum u (T i)^2) = ∑ i, segSum u (S i)^2 := by + rw [show (∑ i, segSum u (T i)^2) = ∑ i : I, segSum u (S i.val)^2 from + e.sum_comp (fun i : I => segSum u (S i.val)^2)] + have hz : (∑ i : {i : ι // ¬(S i).Nonempty}, segSum u (S i.val)^2) = 0 := by + apply Finset.sum_eq_zero + intro i hi + have he : S i.val = ∅ := Finset.not_nonempty_iff_eq_empty.mp i.property + simp [he] + have hh := Fintype.sum_subtype_add_sum_subtype (fun i : ι => (S i).Nonempty) + (fun i => segSum u (S i)^2) + rw [hz,add_zero] at hh + exact hh + have hmem : Real.sqrt (∑ i, segSum u (S i)^2) ∈ sourceNormValues u := by + refine ⟨Fintype.card I,Fintype.card_pos,T,hT,hdT,?_⟩ + rw [hsum] + have hle := le_csSup (sourceNormValues_bddAbove hu) hmem + exact (Real.sqrt_le_iff.mp hle).2 + · have hzero : ∑ i, segSum u (S i)^2 = 0 := by + apply Finset.sum_eq_zero + intro i hi + have he : S i = ∅ := Finset.not_nonempty_iff_eq_empty.mp (fun hi => hI ⟨⟨i,hi⟩⟩) + simp [he] + rw [hzero] + exact sq_nonneg _ + +/-- Equality with the nonempty-segment definition, including the exclusion of empty +segments and zero-sized families and the order of supremum/square root. -/ +theorem rho_eq_source_sup [Nonempty V] (u : V →₀ ℝ) : + rho u = sSup (sourceNormValues u) := by + have hu := finsupp_has_testBound u + apply le_antisymm + · exact rho_le_of_testBound (sourceNormValues_sup_nonneg hu) (testBound_from_source_sup hu) + · exact csSup_le (sourceNormValues_nonempty u) (fun _ h => sourceNormValues_le_rho hu h) + +end SourceNormFidelity + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Paired.lean b/lean/OAI/Analysis/ForestSpace/Paired.lean new file mode 100644 index 0000000000000000000000000000000000000000..8604960fe6a67d0a73cabd4697f77afc68df0619 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Paired.lean @@ -0,0 +1,353 @@ +import OAI.Analysis.ForestSpace.FiniteGeometry + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section FinitePaired +variable {V : Type} [Fintype V] [PartialOrder V] + +noncomputable def gateSigns (f k : V → ℝ) (s : ℝ) (g : V) : ℝ := + oppositeSign (segSum f (selectedHead f k s g)) + + theorem gateSigns_sq (f k : V → ℝ) (s : ℝ) (g : V) : gateSigns f k s g ^ 2 = 1 := + oppositeSign_sq _ + +noncomputable def correctedTail (H : Set V) (f k : V → ℝ) (s τ : ℝ) : V → ℝ := + correction H k (gateSigns f k s) + τ • k + + theorem correctedTail_supported {H : Set V} {f k : V → ℝ} + (hk : SupportedOn k Hᶜ) (s τ : ℝ) : SupportedOn (correctedTail H f k s τ) Hᶜ := by + intro v hv + change correction H k (gateSigns f k s) v + τ * k v = 0 + rw [correction_supported H k (gateSigns f k s) v hv, hk v hv] + ring + + theorem correctedTail_testBound (hF : ForestOrder V) (H : Set V) (f k : V → ℝ) + (hk : TestBound k 1) (s τ : ℝ) (hτ : |τ| ≤ 1) : + TestBound (correctedTail H f k s τ) 4 := by + have ht : τ ^ 2 ≤ 1 := by + have := abs_le.mp hτ + nlinarith [sq_abs τ] + have hk' : TestBound (τ • k) 1 := (hk.smul τ).mono (by simpa using ht) + have hc := correction_testBound hF hk (gateSigns_sq f k s) H + have hh := TestBound.add (A := 1) (B := 1) (by simpa using hc) (by simpa using hk') + zero_le_one zero_le_one + convert hh using 1 <;> norm_num [correctedTail] + + theorem correctedTail_at_gate {H : Set V} (hH : IsLowerSet H) {f k : V → ℝ} + (hk : SupportedOn k Hᶜ) {s τ : ℝ} (hτ : |τ| ≤ 1) + {S : Finset V} (hS : IsSegment S) {g : V} (hg : Gate H g) (hgs : g ∈ S) : + segSum f (selectedHead f k s g) * segSum (correctedTail H f k s τ) S ≤ 0 ∧ + |segSum (correctedTail H f k s τ) S| ≤ 2 * mass k g := by + have hd : |τ * segSum k S| ≤ mass k g := by + rw [abs_mul] + calc + |τ| * |segSum k S| ≤ 1 * mass k g := + mul_le_mul hτ (tail_sum_le_mass hH hk hS hg hgs) (abs_nonneg _) zero_le_one + _ = mass k g := one_mul _ + simp only [correctedTail, segSum_add, segSum_smul, correction_sum hS hg hgs, gateSigns] + exact ⟨oppositeSign_cross hd, oppositeSign_tail_abs (mass_nonneg k g) hd⟩ + + theorem gate_charge_le {H : Set V} {k : V → ℝ} {S : Finset V} {g : V} + (hg : Gate H g) (hgs : g ∈ S) : mass k g ^ 2 ≤ ∑ v ∈ S, gateWeight H k v := by + have hh := single_le_sum (f := gateWeight H k) + (fun v hv => gateWeight_nonneg H k v) hgs + simpa only [gateWeight, ite_eq_left hg] using hh + +/-- The local choice of a suffix cut, including empty cuts for inexpensive terms. -/ + theorem segment_cut (hF : ForestOrder V) {H : Set V} (hH : IsLowerSet H) + {f k : V → ℝ} (hf : SupportedOn f H) (hk : SupportedOn k Hᶜ) + {s τ : ℝ} (hs : 0 ≤ s) (hτ : |τ| ≤ 1) + {S : Finset V} (hS : IsSegment S) : + ∃ L : Finset V, L ⊆ S.filter (· ∈ H) ∧ IsSegment L ∧ + IsSegment (S.filter (· ∈ H) \ L) ∧ + (segSum f S + s * segSum (correctedTail H f k s τ) S) ^ 2 ≤ + (segSum f S - segSum f L) ^ 2 + segSum f L ^ 2 + + 8 * s ^ 2 * (∑ v ∈ S, gateWeight H k v) + + s ^ 2 * segSum (correctedTail H f k s τ) S ^ 2 := by + have hq : 0 ≤ ∑ v ∈ S, gateWeight H k v := sum_nonneg (fun v hv => gateWeight_nonneg H k v) + have hcost : 0 ≤ 8 * s ^ 2 * (∑ v ∈ S, gateWeight H k v) := by positivity + by_cases hcross : 0 < segSum f S * segSum (correctedTail H f k s τ) S + · have hgex : ∃ g ∈ S, Gate H g := by + by_contra hng + have hz := cross_zero_of_no_gate hF hH hf (correctedTail_supported (f := f) hk s τ) hS hng + linarith + obtain ⟨g, hgs, hg⟩ := hgex + have hinfo := correctedTail_at_gate (f := f) (s := s) hH hk hτ hS hg hgs + have hcharge := gate_charge_le (k := k) hg hgs + by_cases hsmall : |segSum f S| ≤ 2 * s * mass k g + · refine ⟨∅, empty_subset _, isSegment_empty, by simpa using hS.head H hH, ?_⟩ + have hc := small_cross_bound hs (mass_nonneg k g) hsmall hinfo.2 hcharge + simp only [segSum_empty, sub_zero, zero_pow (by decide : (2 : ℕ) ≠ 0), add_zero] + nlinarith + · have hp : ∃ a ∈ S, a ∈ H := by + by_contra hn + have hz := hf.segSum_eq_zero (S := S) (by simpa using hn) + rw [hz, zero_mul] at hcross + exact (lt_irrefl 0) hcross + obtain ⟨a, hag, hhead⟩ := hS.head_eq_before hH hg hgs hp + have he : segSum f (before a g) = segSum f S := by + rw [← hhead] + exact hf.segSum_filter S + have ha : a ∈ largeStarts f k s g := mem_largeStarts.mpr + ⟨hag, by rw [he]; exact le_of_lt (lt_of_not_ge hsmall)⟩ + refine ⟨selectedHead f k s g, ?_, selectedHead_segment hF f k s g, ?_, ?_⟩ + · rw [hhead] + exact selectedHead_subset hF ha + · rw [hhead] + exact sdiff_selectedHead_segment (isSegment_before hF a g) + · have hc := large_cross_bound hs (mass_nonneg k g) hcross hinfo.1 + (selectedHead_large ha) hinfo.2 + nlinarith + · refine ⟨∅, empty_subset _, isSegment_empty, by simpa using hS.head H hH, ?_⟩ + have hc : 2 * s * (segSum f S * segSum (correctedTail H f k s τ) S) ≤ 0 := + mul_nonpos_of_nonneg_of_nonpos (by positivity) (le_of_not_gt hcross) + simp only [segSum_empty, sub_zero, zero_pow (by decide : (2 : ℕ) ≠ 0), add_zero] + nlinarith + +omit [Fintype V] [PartialOrder V] in +/-- All suffix cuts can be charged to one disjoint segment test of the head. -/ + theorem simultaneous_cut_bound [Fintype V] [PartialOrder V] {H : Set V} {f : V → ℝ} + (hf : SupportedOn f H) (hf₁ : TestBound f 1) + {ι : Type} [Fintype ι] (S L : ι → Finset V) + (hd : Pairwise (fun i j => Disjoint (S i) (S j))) + (hL : ∀ i, L i ⊆ (S i).filter (· ∈ H)) + (hseg : ∀ i, IsSegment (L i)) + (hdiff : ∀ i, IsSegment ((S i).filter (· ∈ H) \ L i)) : + (∑ i, ((segSum f (S i) - segSum f (L i)) ^ 2 + segSum f (L i) ^ 2)) ≤ 1 := by + let P : ι → Finset V := fun i => (S i).filter (· ∈ H) + let pieces : ι × Bool → Finset V := fun p => if p.2 then L p.1 else P p.1 \ L p.1 + have hpseg : ∀ p, IsSegment (pieces p) := by + rintro ⟨i, b⟩ + cases b + · exact hdiff i + · exact hseg i + have hpsub : ∀ p, pieces p ⊆ S p.1 := by + rintro ⟨i, b⟩ + cases b + · exact sdiff_subset.trans (filter_subset _ _) + · exact (hL i).trans (filter_subset _ _) + have hpdis : Pairwise (fun p q => Disjoint (pieces p) (pieces q)) := by + rintro ⟨i,b⟩ ⟨j,c⟩ hne + by_cases hij : i = j + · subst j + cases b <;> cases c + · exact (hne rfl).elim + · exact sdiff_disjoint + · exact disjoint_sdiff + · exact (hne rfl).elim + · exact (hd hij).mono (hpsub (i,b)) (hpsub (j,c)) + have hb := hf₁ (ι × Bool) inferInstance pieces hpseg hpdis + have he : ∀ i, segSum f (P i \ L i) = segSum f (S i) - segSum f (L i) := by + intro i + have ht : segSum f (P i \ L i) + segSum f (L i) = segSum f (P i) := sum_sdiff (hL i) + have ht' : segSum f (P i) = segSum f (S i) := hf.segSum_filter (S i) + linarith + simpa only [Fintype.sum_prod_type, Fintype.sum_bool, pieces, Bool.false_eq_true, + ↓reduceIte, he, add_comm] using hb + +/-- The corrected tests have squared norm at most 1+12s², for either sign. -/ + theorem corrected_test_bound (hF : ForestOrder V) {H : Set V} (hH : IsLowerSet H) + {f k : V → ℝ} (hf : SupportedOn f H) (hk : SupportedOn k Hᶜ) + (hf₁ : TestBound f 1) (hk₁ : TestBound k 1) + {s τ : ℝ} (hs : 0 ≤ s) (hτ : |τ| ≤ 1) : + TestBound (f + s • correctedTail H f k s τ) (1 + 12 * s ^ 2) := by + intro ι inst S hS hd + choose L hL hseg hdiff hlocal using (fun i => segment_cut hF hH hf hk hs hτ (hS i)) + have hhead := simultaneous_cut_bound hf hf₁ S L hd hL hseg hdiff + have hcharge := gateWeight_family_le hF hk₁ H S hd + have htail := correctedTail_testBound hF H f k hk₁ s τ hτ ι inst S hS hd + have hnum := sum_le_sum (s := (univ : Finset ι)) (fun i hi => hlocal i) + simp only [sum_add_distrib, ← mul_sum] at hnum + have hcharge' := mul_le_mul_of_nonneg_left hcharge (show 0 ≤ 8 * s ^ 2 by positivity) + have htail' := mul_le_mul_of_nonneg_left htail (sq_nonneg s) + simp only [sum_add_distrib] at hhead + simp only [segSum_add, segSum_smul] + nlinarith + +/-- Finite-support paired extension: the common correction cancels on averaging. -/ + + theorem paired_finite_test_correction + (hF : ForestOrder V) (H : Set V) (hH : IsLowerSet H) (f k : V → ℝ) + (hf : ∀ v, v ∉ H → f v = 0) (hk : ∀ v, v ∈ H → k v = 0) + (hf₁ : TestBound f 1) (hk₁ : TestBound k 1) + (s : ℝ) (hs : 0 < s) : + ∃ c : V → ℝ, (∀ v, v ∈ H → c v = 0) ∧ TestBound c 1 ∧ + TestBound (f + s • (c + k)) (1 + 12 * s ^ 2) ∧ + TestBound (f + s • (c - k)) (1 + 12 * s ^ 2) := by + have hk' : SupportedOn k Hᶜ := by + intro v hv + exact hk v (by simpa using hv) + refine ⟨correction H k (gateSigns f k s), ?_, + correction_testBound hF hk₁ (gateSigns_sq f k s) H, ?_, ?_⟩ + · intro v hv + exact correction_supported H k (gateSigns f k s) v (by simpa using hv) + · have hh := corrected_test_bound hF hH hf hk' hf₁ hk₁ hs.le (τ := 1) (by norm_num) + simpa only [correctedTail, one_smul] using hh + · have hh := corrected_test_bound hF hH hf hk' hf₁ hk₁ hs.le (τ := -1) (by norm_num) + simpa only [correctedTail, neg_one_smul, sub_eq_add_neg] using hh + +end FinitePaired + +section FiniteRestriction +variable {V : Type} [PartialOrder V] + + theorem forestOrder_subtype (hF : ForestOrder V) (B : Set V) : ForestOrder B := by + intro a b c hac hbc + exact hF a b c hac hbc + + theorem IsSegment.subtype {S B : Finset V} (hS : IsSegment S) : + IsSegment (S.subtype (· ∈ B)) := by + constructor + · intro a ha b hb + exact hS.1 a (mem_subtype.mp ha) b (mem_subtype.mp hb) + · intro a ha b hb c hac hcb + exact mem_subtype.mpr (hS.2 a (mem_subtype.mp ha) b (mem_subtype.mp hb) c hac hcb) + + theorem IsSegment.image_subtype {B : Finset V} (hB : IsLowerSet (B : Set V)) + {S : Finset B} (hS : IsSegment S) : IsSegment (S.image Subtype.val) := by + constructor + · intro a ha b hb + obtain ⟨a, ha', rfl⟩ := mem_image.mp ha + obtain ⟨b, hb', rfl⟩ := mem_image.mp hb + exact hS.1 a ha' b hb' + · intro a ha b hb c hac hcb + obtain ⟨a, ha', rfl⟩ := mem_image.mp ha + obtain ⟨b, hb', rfl⟩ := mem_image.mp hb + have hcB : c ∈ B := hB hcb b.property + exact mem_image.mpr ⟨⟨c,hcB⟩, hS.2 a ha' b hb' ⟨c,hcB⟩ hac hcb, rfl⟩ + +omit [PartialOrder V] in + theorem segSum_image_subtype [PartialOrder V] {B : Finset V} (u : V → ℝ) (S : Finset B) : + segSum u (S.image Subtype.val) = segSum (fun v : B => u v) S := by + exact sum_image (fun a ha b hb hab => Subtype.val_injective hab) + +omit [PartialOrder V] in + theorem segSum_subtype [PartialOrder V] {B S : Finset V} {u : V → ℝ} (hu : SupportedOn u (B : Set V)) : + segSum (fun v : B => u v) (S.subtype (· ∈ B)) = segSum u S := by + change (∑ v ∈ S.subtype (· ∈ B), u v) = ∑ v ∈ S, u v + rw [sum_subtype_eq_sum_filter] + exact sum_subset (filter_subset _ _) (by + intro v hv hv' + exact hu v (by change v ∉ B; simpa only [mem_filter, hv, true_and] using hv')) + + theorem TestBound.restrict_subtype {B : Finset V} (hB : IsLowerSet (B : Set V)) + {u : V → ℝ} {C : ℝ} (hu : TestBound u C) : + TestBound (fun v : B => u v) C := by + intro ι inst S hS hd + have hh := hu ι inst (fun i => (S i).image Subtype.val) + (fun i => (hS i).image_subtype hB) (by + intro i j hij + exact (Finset.disjoint_image Subtype.val_injective).mpr (hd hij)) + simpa only [segSum_image_subtype] using hh + + theorem TestBound.of_restrict {B : Finset V} {u : V → ℝ} {C : ℝ} + (hu : SupportedOn u (B : Set V)) (hb : TestBound (fun v : B => u v) C) : + TestBound u C := by + intro ι inst S hS hd + have hh := hb ι inst (fun i => (S i).subtype (· ∈ B)) + (fun i => (hS i).subtype) (by + intro i j hij + apply disjoint_left.mpr + intro v hvi hvj + exact disjoint_left.mp (hd hij) (mem_subtype.mp hvi) (mem_subtype.mp hvj)) + simpa only [segSum_subtype hu] using hh + +/-- The finite ancestor assumption ensures that no node inserted between two +supported coordinates is lost when we use a finite test forest. -/ + theorem exists_finite_lower_hull (hAnc : ∀ v : V, (Set.Iic v).Finite) + (S : Finset V) : ∃ B : Finset V, S ⊆ B ∧ IsLowerSet (B : Set V) := by + let A : Set V := ⋃ v ∈ (S : Set V), Set.Iic v + have hA : A.Finite := S.finite_toSet.biUnion (fun v hv => hAnc v) + refine ⟨hA.toFinset, ?_, ?_⟩ + · intro v hv + exact hA.mem_toFinset.mpr (Set.mem_iUnion.mpr ⟨v, + Set.mem_iUnion.mpr ⟨hv, le_rfl⟩⟩) + · intro a b hab hb + obtain ⟨v,hv,hbv⟩ := Set.mem_iUnion₂.mp (hA.mem_toFinset.mp hb) + exact hA.mem_toFinset.mpr (Set.mem_iUnion₂.mpr ⟨v,hv,hab.trans hbv⟩) + +/-- Extension by zero from a finite lower subforest. -/ +noncomputable def finiteExtension (B : Finset V) (u : B → ℝ) : V →₀ ℝ := + Finsupp.onFinset B (fun v => if h : v ∈ B then u ⟨v,h⟩ else 0) (by + intro v hv + by_contra hn + exact hv (dite_eq_right hn)) + +omit [PartialOrder V] in +@[simp] theorem finiteExtension_apply [PartialOrder V] {B : Finset V} (u : B → ℝ) (v : B) : + finiteExtension B u v = u v := by simp [finiteExtension, v.property] + +omit [PartialOrder V] in + theorem finiteExtension_supported [PartialOrder V] (B : Finset V) (u : B → ℝ) : + SupportedOn (finiteExtension B u) (B : Set V) := by + intro v hv + simp [finiteExtension, show v ∉ B from hv] + + theorem finiteExtension_testBound {B : Finset V} {u : B → ℝ} {C : ℝ} + (hu : TestBound u C) : TestBound (finiteExtension B u) C := by + apply TestBound.of_restrict (finiteExtension_supported B u) + simpa only [finiteExtension_apply] using hu + +/-- The finite-support corrected tests on an arbitrary finite-ancestor forest. +No assertion about the full dual having dense finite coordinates is used. -/ + theorem finsupp_paired_correction (hF : ForestOrder V) + (hAnc : ∀ v : V, (Set.Iic v).Finite) + (H : Set V) (hH : IsLowerSet H) (f k : V →₀ ℝ) + (hf : SupportedOn f H) (hk : SupportedOn k Hᶜ) + (hf₁ : TestBound f 1) (hk₁ : TestBound k 1) (s : ℝ) (hs : 0 < s) : + ∃ c : V →₀ ℝ, SupportedOn c Hᶜ ∧ TestBound c 1 ∧ + TestBound (f + s • (c + k)) (1 + 12 * s ^ 2) ∧ + TestBound (f + s • (c - k)) (1 + 12 * s ^ 2) := by + obtain ⟨B,hB,hBl⟩ := exists_finite_lower_hull hAnc (f.support ∪ k.support) + have hfB : SupportedOn f (B : Set V) := by + intro v hv + by_contra hvf + exact hv (hB (mem_union_left _ (Finsupp.mem_support_iff.mpr hvf))) + have hkB : SupportedOn k (B : Set V) := by + intro v hv + by_contra hvk + exact hv (hB (mem_union_right _ (Finsupp.mem_support_iff.mpr hvk))) + let HB : Set B := {v | (v : V) ∈ H} + have hHB : IsLowerSet HB := fun _ _ hab hb => hH hab hb + obtain ⟨c,hcH,hc₁,hcp,hcm⟩ := paired_finite_test_correction + (V := B) (fun a b c hac hbc => hF a b c hac hbc) HB hHB (fun v : B => f v) (fun v : B => k v) + (fun v hv => hf v hv) (fun v hv => hk v (by + exact not_not.mpr hv)) + (hf₁.restrict_subtype hBl) (hk₁.restrict_subtype hBl) s hs + refine ⟨finiteExtension B c, ?_, finiteExtension_testBound hc₁, ?_, ?_⟩ + · intro v hv + by_cases hvB : v ∈ B + · have hh := hcH ⟨v,hvB⟩ (by + change v ∈ H; simpa only [Set.mem_compl_iff, not_not] using hv) + simpa [finiteExtension, hvB] using hh + · exact finiteExtension_supported B c v hvB + · apply TestBound.of_restrict (B := B) + (u := (f + s • (finiteExtension B c + k) : V →₀ ℝ)) + · intro v hv + simp [hfB v hv, hkB v hv, finiteExtension_supported B c v hv] + · change TestBound (fun v : B => f v + s * (c v + k v)) (1 + 12 * s ^ 2) at hcp + simpa only [Finsupp.coe_add, Finsupp.coe_smul, Pi.add_apply, + Pi.smul_apply, smul_eq_mul, finiteExtension_apply] using hcp + · apply TestBound.of_restrict (B := B) + (u := (f + s • (finiteExtension B c - k) : V →₀ ℝ)) + · intro v hv + simp [hfB v hv, hkB v hv, finiteExtension_supported B c v hv] + · change TestBound (fun v : B => f v + s * (c v - k v)) (1 + 12 * s ^ 2) at hcm + simpa only [Finsupp.coe_add, Finsupp.coe_sub, Finsupp.coe_smul, Pi.add_apply, + Pi.sub_apply, Pi.smul_apply, smul_eq_mul, finiteExtension_apply] using hcm + +end FiniteRestriction + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Polar.lean b/lean/OAI/Analysis/ForestSpace/Polar.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a10ce19fc85e4186d82c61130044cbc92fba83f --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Polar.lean @@ -0,0 +1,216 @@ +import OAI.Analysis.ForestSpace.Completion + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section PolarTests +variable {V : Type} [PartialOrder V] + +noncomputable def rawRestriction (x : FullDual V) : TestVector V →L[ℝ] ℝ := + x.comp UniformSpace.Completion.toComplL + +@[simp] theorem rawRestriction_apply (x : FullDual V) (u : TestVector V) : + rawRestriction x u = x (u : J V) := rfl + + theorem norm_rawRestriction (x : FullDual V) : ‖rawRestriction x‖ = ‖x‖ := by + apply le_antisymm + · apply (rawRestriction x).opNorm_le_bound (norm_nonneg x) + intro u + simpa only [rawRestriction_apply, UniformSpace.Completion.norm_coe] + using x.le_opNorm (u : J V) + · apply x.opNorm_le_bound (norm_nonneg _) + intro u + refine UniformSpace.Completion.induction_on u + (isClosed_le x.continuous.norm (continuous_const.mul continuous_norm)) ?_ + intro v + simpa only [← rawRestriction_apply, UniformSpace.Completion.norm_coe] + using (rawRestriction x).le_opNorm v + +/-- Norming tests can always be chosen finitely supported, with a positive +rather than absolute pairing. -/ + theorem exists_raw_test (x : FullDual V) {r : ℝ} (hr : r < ‖x‖) : + ∃ u : TestVector V, ‖u‖ ≤ 1 ∧ r < x (u : J V) := by + have hr' : r < ‖rawRestriction x‖ := by simpa only [norm_rawRestriction] using hr + obtain ⟨u,hu,hr⟩ := (rawRestriction x).exists_lt_apply_of_lt_opNorm hr' + rw [Real.norm_eq_abs] at hr + by_cases hpos : 0 ≤ rawRestriction x u + · refine ⟨u,hu.le, ?_⟩ + rw [abs_of_nonneg hpos] at hr + exact hr + · refine ⟨-u, by simpa only [norm_neg] using hu.le, ?_⟩ + have ha : rawRestriction x (-u) = -rawRestriction x u := map_neg _ _ + rw [abs_of_neg (lt_of_not_ge hpos), ← ha] at hr + exact hr + +/-- Vanishing on all finite tests in a specified coordinate region. -/ +def Annihilates (x : FullDual V) (A : Set V) : Prop := + ∀ u : TestVector V, SupportedOn u A → x (u : J V) = 0 + + theorem exists_head_test (H : Set V) (hH : IsLowerSet H) (x : FullDual V) + (hx : Annihilates x Hᶜ) {r : ℝ} (hr : r < ‖x‖) : + ∃ f : TestVector V, SupportedOn f H ∧ ‖f‖ ≤ 1 ∧ r < x (f : J V) := by + obtain ⟨u,hu,hr⟩ := exists_raw_test x hr + have he := congrArg (rawRestriction x) (TestVector.cut_add_compl H u) + have hz := hx (TestVector.cut Hᶜ u) (TestVector.cut_supported Hᶜ u) + simp only [map_add, rawRestriction_apply, hz, add_zero] at he + exact ⟨TestVector.cut H u, TestVector.cut_supported H u, + (TestVector.norm_cut_le H hH u).trans hu, by simpa only [he] using hr⟩ + + theorem exists_tail_test (H : Set V) (hH : IsLowerSet H) (x : FullDual V) + (hx : Annihilates x H) {r : ℝ} (hr : r < ‖x‖) : + ∃ k : TestVector V, SupportedOn k Hᶜ ∧ ‖k‖ ≤ 1 ∧ r < x (k : J V) := by + obtain ⟨u,hu,hr⟩ := exists_raw_test x hr + have he := congrArg (rawRestriction x) (TestVector.cut_add_compl H u) + have hz := hx (TestVector.cut H u) (TestVector.cut_supported H u) + simp only [map_add, rawRestriction_apply, hz, zero_add] at he + exact ⟨TestVector.cut Hᶜ u, TestVector.cut_supported Hᶜ u, + (TestVector.norm_cut_compl_le H hH u).trans hu, by simpa only [he] using hr⟩ + +/-- The cancellation of the same gate correction in the two dual evaluations. -/ + theorem paired_polar_test (H : Set V) {x y : FullDual V} + (hx : Annihilates x Hᶜ) (hy : Annihilates y H) + {f k c : TestVector V} (hf : SupportedOn f H) (hk : SupportedOn k Hᶜ) + (hc : SupportedOn c Hᶜ) (s d : ℝ) + (hp : ‖f + s • (c + k)‖ ≤ d) (hm : ‖f + s • (c - k)‖ ≤ d) : + x (f : J V) + s * y (k : J V) ≤ (‖x+y‖ + ‖x-y‖) / 2 * d := by + have hb (z : FullDual V) (u : TestVector V) (hu : ‖u‖ ≤ d) : + rawRestriction z u ≤ ‖z‖ * d := by + calc + rawRestriction z u ≤ |rawRestriction z u| := le_abs_self _ + _ ≤ ‖z‖ * ‖u‖ := by + simpa only [Real.norm_eq_abs, norm_rawRestriction] using (rawRestriction z).le_opNorm u + _ ≤ ‖z‖ * d := mul_le_mul_of_nonneg_left hu (norm_nonneg _) + have hp' := hb (x+y) (f+s•(c+k)) hp + have hm' := hb (x-y) (f+s•(c-k)) hm + have he : rawRestriction (x+y) (f+s•(c+k)) + rawRestriction (x-y) (f+s•(c-k)) = + 2 * (x (f : J V) + s * y (k : J V)) := by + simp only [map_add, map_sub, map_smul, rawRestriction_apply, + _root_.add_apply, _root_.sub_apply, smul_eq_mul, + hx k hk, hx c hc, hy f hf] + ring + linarith + + theorem paired_parameter (hF : ForestOrder V) (hAnc : ∀ v : V, (Set.Iic v).Finite) + (H : Set V) (hH : IsLowerSet H) (x y : FullDual V) + (hx : Annihilates x Hᶜ) (hy : Annihilates y H) (s : ℝ) (hs : 0 < s) : + (‖x‖ + s * ‖y‖) / Real.sqrt (1 + 12 * s ^ 2) ≤ (‖x+y‖ + ‖x-y‖) / 2 := by + have hd : 0 < Real.sqrt (1 + 12 * s ^ 2) := Real.sqrt_pos.mpr (by positivity) + apply (div_le_iff₀ hd).mpr + apply le_of_forall_pos_le_add + intro ε hε + obtain ⟨f,hf,hf₁,hfx⟩ := exists_head_test H hH x hx (show ‖x‖-ε/2 < ‖x‖ by linarith) + obtain ⟨k,hk,hk₁,hky⟩ := exists_tail_test H hH y hy + (show ‖y‖-ε/(2*s) < ‖y‖ by + have : 0 < ε/(2*s) := by positivity + linarith) + obtain ⟨c,hc,hc₁,hp,hm⟩ := TestVector.paired_correction hF hAnc H hH f k hf hk hf₁ hk₁ s hs + have ht := paired_polar_test H hx hy hf hk hc s (Real.sqrt (1+12*s^2)) hp hm + have hm' := mul_lt_mul_of_pos_left hky hs + have he : s * (ε / (2*s)) = ε/2 := by field_simp + rw [mul_sub, he] at hm' + linarith + + theorem Annihilates.smul {x : FullDual V} {A : Set V} (hx : Annihilates x A) (t : ℝ) : + Annihilates (t • x) A := by + intro u hu + simp [hx u hu] + + theorem paired_estimate (hF : ForestOrder V) (hAnc : ∀ v : V, (Set.Iic v).Finite) + (H : Set V) (hH : IsLowerSet H) (x y : FullDual V) + (hx : Annihilates x Hᶜ) (hy : Annihilates y H) : + Real.sqrt (‖x‖ ^ 2 + ‖y‖ ^ 2 / 12) ≤ (‖x+y‖ + ‖x-y‖) / 2 := by + by_cases hx0 : x = 0 + · subst x + simp only [norm_zero, zero_pow (by decide : (2:ℕ) ≠ 0), zero_add, zero_sub, norm_neg] + apply Real.sqrt_le_iff.mpr + constructor + · positivity + · nlinarith [sq_nonneg ‖y‖] + by_cases hy0 : y = 0 + · subst y + simp only [norm_zero, zero_pow (by decide : (2:ℕ) ≠ 0), zero_div, add_zero, sub_zero] + rw [Real.sqrt_sq (norm_nonneg _)] + linarith + have hxpos : 0 < ‖x‖ := norm_pos_iff.mpr hx0 + have hypos : 0 < ‖y‖ := norm_pos_iff.mpr hy0 + let s := ‖y‖ / (12 * ‖x‖) + have hs : 0 < s := by dsimp [s]; positivity + have hd : 0 < Real.sqrt (1+12*s^2) := Real.sqrt_pos.mpr (by positivity) + have hh := (div_le_iff₀ hd).mp (paired_parameter hF hAnc H hH x y hx hy s hs) + have he : (‖x‖+s*‖y‖)^2 = (‖x‖^2+‖y‖^2/12)*(1+12*s^2) := by + dsimp [s] + field_simp + + have hh' : (‖x‖+s*‖y‖)^2 ≤ ((‖x+y‖+‖x-y‖)/2 * Real.sqrt (1+12*s^2))^2 := + sq_le_sq₀ (by positivity) (by positivity) |>.mpr hh + rw [he, mul_pow, Real.sq_sqrt (by positivity)] at hh' + have hden : 0 < 1+12*s^2 := by positivity + apply Real.sqrt_le_iff.mpr + exact ⟨by positivity, (mul_le_mul_iff_left₀ hden).mp (by simpa only [mul_comm] using hh')⟩ + + theorem paired_two_parameters (hF : ForestOrder V) (hAnc : ∀ v : V, (Set.Iic v).Finite) + (H : Set V) (hH : IsLowerSet H) (x y : FullDual V) + (hx : Annihilates x Hᶜ) (hy : Annihilates y H) (s t : ℝ) (hs : 0 < s) (ht : 0 < t) : + (‖x‖ + s*t*‖y‖) / Real.sqrt (1+12*s^2) ≤ (‖x+t•y‖ + ‖x-t•y‖)/2 := by + simpa only [norm_smul, Real.norm_of_nonneg ht.le, mul_assoc] + using paired_parameter hF hAnc H hH x (t•y) hx (hy.smul t) s hs + +end PolarTests + +section CoordinateCompletion +variable {W : Type} [PartialOrder W] +instance fullDualAddCommGroup : AddCommGroup (FullDual W) := + inferInstanceAs (AddCommGroup (StrongDual ℝ (J W))) + +variable {V : Type} [PartialOrder V] + +noncomputable def e (v : V) : J V := (TestVector.single v 1 : TestVector V) + +/-- The coordinate functional on J(T). -/ +noncomputable def eStar (v : V) : FullDual V := + (TestVector.eval v).extend UniformSpace.Completion.toComplL + +@[simp] theorem eStar_coe (v : V) (u : TestVector V) : eStar v (u : J V) = u v := by + exact (TestVector.eval v).extend_eq UniformSpace.Completion.denseRange_coe + (UniformSpace.Completion.isUniformInducing_coe (TestVector V)) u + +@[simp] theorem norm_e (v : V) : ‖e v‖ = 1 := by + simp [e, UniformSpace.Completion.norm_coe, TestVector.norm_single] + +@[simp] theorem eStar_e (v w : V) : eStar v (e w) = if w = v then 1 else 0 := by + simp [e] + + theorem eStar_norm_le (v : V) : ‖eStar v‖ ≤ 1 := by + have h := (TestVector.eval v).opNorm_extend_le (N := 1) + (e := UniformSpace.Completion.toComplL) UniformSpace.Completion.denseRange_coe + (by intro u; simp) + have hh : ‖eStar v‖ ≤ ‖TestVector.eval v‖ := by simpa [eStar] using h + exact hh.trans (TestVector.eval_norm_le v) + +@[simp] theorem norm_eStar (v : V) : ‖eStar v‖ = 1 := by + apply le_antisymm (eStar_norm_le v) + have h := (eStar v).unit_le_opNorm (e v) (by simp) + simpa using h + +/-- The norm-closed coordinate span inside J(T)*. No identification with the +full dual is made for a general forest. -/ +@[reducible] noncomputable def coordinateSubspace (V : Type) [PartialOrder V] : Submodule ℝ (FullDual V) := + (Submodule.span ℝ (Set.range (eStar (V := V)))).topologicalClosure + +abbrev X (V : Type) [PartialOrder V] : Type := ↥(coordinateSubspace V) + + +end CoordinateCompletion + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Projections.lean b/lean/OAI/Analysis/ForestSpace/Projections.lean new file mode 100644 index 0000000000000000000000000000000000000000..979962a62541fea807f52fe317438cb93d6091f7 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Projections.lean @@ -0,0 +1,295 @@ +import OAI.Analysis.ForestSpace.Polar + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section Projections +variable {V : Type} [PartialOrder V] + +/-- Completion of restriction to an ancestral head. -/ +noncomputable def headJ (H : Set V) (hH : IsLowerSet H) : J V →L[ℝ] J V := + (UniformSpace.Completion.toComplL.comp (TestVector.head H hH)).extend + UniformSpace.Completion.toComplL + +@[simp] theorem headJ_coe (H : Set V) (hH : IsLowerSet H) (u : TestVector V) : + headJ H hH (u : J V) = (TestVector.cut H u : J V) := by + exact (UniformSpace.Completion.toComplL.comp (TestVector.head H hH)).extend_eq + UniformSpace.Completion.denseRange_coe + (UniformSpace.Completion.isUniformInducing_coe (TestVector V)) u + +noncomputable def tailJ (H : Set V) (hH : IsLowerSet H) : J V →L[ℝ] J V := + ContinuousLinearMap.id ℝ (J V) - headJ H hH + +@[simp] theorem tailJ_coe (H : Set V) (hH : IsLowerSet H) (u : TestVector V) : + tailJ H hH (u : J V) = (TestVector.cut Hᶜ u : J V) := by + have he : u - TestVector.cut H u = TestVector.cut Hᶜ u := by + apply sub_eq_iff_eq_add.mpr + exact (TestVector.cut_add_compl H u).symm.trans (add_comm _ _) + change (u : J V) - headJ H hH (u : J V) = _ + rw [headJ_coe, ← UniformSpace.Completion.coe_sub, he] + + theorem norm_headJ_le (H : Set V) (hH : IsLowerSet H) (u : J V) : + ‖headJ H hH u‖ ≤ ‖u‖ := by + refine UniformSpace.Completion.induction_on u + (isClosed_le (headJ H hH).continuous.norm continuous_norm) ?_ + intro v + simpa only [headJ_coe, UniformSpace.Completion.norm_coe] using TestVector.norm_cut_le H hH v + + theorem norm_tailJ_le (H : Set V) (hH : IsLowerSet H) (u : J V) : + ‖tailJ H hH u‖ ≤ ‖u‖ := by + refine UniformSpace.Completion.induction_on u + (isClosed_le (tailJ H hH).continuous.norm continuous_norm) ?_ + intro v + simpa only [tailJ_coe, UniformSpace.Completion.norm_coe] using TestVector.norm_cut_compl_le H hH v + +noncomputable def P (H : Set V) (hH : IsLowerSet H) : FullDual V →L[ℝ] FullDual V := + ContinuousLinearMap.precomp ℝ (headJ H hH) + +noncomputable def Q (H : Set V) (hH : IsLowerSet H) : FullDual V →L[ℝ] FullDual V := + ContinuousLinearMap.precomp ℝ (tailJ H hH) + +@[simp] theorem P_coe (H : Set V) (hH : IsLowerSet H) (x : FullDual V) (u : TestVector V) : + P H hH x (u : J V) = x (TestVector.cut H u : J V) := by + change x (headJ H hH (u : J V)) = _ + rw [headJ_coe] + +@[simp] theorem Q_coe (H : Set V) (hH : IsLowerSet H) (x : FullDual V) (u : TestVector V) : + Q H hH x (u : J V) = x (TestVector.cut Hᶜ u : J V) := by + change x (tailJ H hH (u : J V)) = _ + rw [tailJ_coe] + + theorem Q_eq_sub (H : Set V) (hH : IsLowerSet H) (x : FullDual V) : Q H hH x = x - P H hH x := by + ext u + change x (u - headJ H hH u) = x u - x (headJ H hH u) + exact map_sub x _ _ + + theorem norm_P_le (H : Set V) (hH : IsLowerSet H) (x : FullDual V) : ‖P H hH x‖ ≤ ‖x‖ := by + apply (P H hH x).opNorm_le_bound (norm_nonneg _) + intro u + exact (x.le_opNorm (headJ H hH u)).trans + (mul_le_mul_of_nonneg_left (norm_headJ_le H hH u) (norm_nonneg _)) + + theorem norm_Q_le (H : Set V) (hH : IsLowerSet H) (x : FullDual V) : ‖Q H hH x‖ ≤ ‖x‖ := by + apply (Q H hH x).opNorm_le_bound (norm_nonneg _) + intro u + exact (x.le_opNorm (tailJ H hH u)).trans + (mul_le_mul_of_nonneg_left (norm_tailJ_le H hH u) (norm_nonneg _)) + + theorem annihilates_P (H : Set V) (hH : IsLowerSet H) (x : FullDual V) : + Annihilates (P H hH x) Hᶜ := by + intro u hu + simp only [P_coe, TestVector.cut_eq_zero_of_compl hu, + UniformSpace.Completion.coe_zero, map_zero] + + theorem annihilates_Q (H : Set V) (hH : IsLowerSet H) (x : FullDual V) : + Annihilates (Q H hH x) H := by + intro u hu + rw [Q_eq_sub] + simp only [_root_.sub_apply, P_coe, TestVector.cut_eq_self hu, sub_self] + + theorem P_finite_eq_sum (H : Finset V) (hH : IsLowerSet (H : Set V)) (x : FullDual V) : + P (H : Set V) hH x = ∑ v ∈ H, x (e v) • eStar v := by + apply ContinuousLinearMap.ext + intro u + refine UniformSpace.Completion.induction_on u (isClosed_eq + (P (H : Set V) hH x).continuous (map_continuous _)) ?_ + intro f + rw [P_coe, ← rawRestriction_apply, TestVector.cut_finite_eq_sum] + simp only [map_sum, map_smul, smul_eq_mul, _root_.sum_apply, + _root_.smul_apply, eStar_coe, rawRestriction_apply] + apply Finset.sum_congr rfl + intro v hv + change f v * x (e v) = x (e v) * f v + ring + + theorem P_eStar (H : Set V) (hH : IsLowerSet H) (v : V) : + P H hH (eStar v) = if v ∈ H then eStar v else 0 := by + apply ContinuousLinearMap.ext + intro u + refine UniformSpace.Completion.induction_on u + (isClosed_eq (P H hH (eStar v)).continuous (map_continuous _)) ?_ + intro f + by_cases hv : v ∈ H <;> simp [hv] + + theorem P_finite_mem_span (H : Finset V) (hH : IsLowerSet (H : Set V)) (x : FullDual V) : + P (H : Set V) hH x ∈ Submodule.span ℝ (Set.range (eStar (V := V))) := by + rw [P_finite_eq_sum] + exact Submodule.sum_mem _ (fun v hv => Submodule.smul_mem _ _ (Submodule.subset_span ⟨v,rfl⟩)) + +/-- Finite ancestral heads preserve the coordinate completion by their explicit +finite-coordinate formula; tails then do so by subtraction. -/ +noncomputable def PX (H : Finset V) (hH : IsLowerSet (H : Set V)) : X V →L[ℝ] X V := + ((P (H : Set V) hH).comp (coordinateSubspace V).subtypeL).codRestrict (coordinateSubspace V) + (fun x => Submodule.le_topologicalClosure _ (P_finite_mem_span H hH x)) + +noncomputable def QX (H : Finset V) (hH : IsLowerSet (H : Set V)) : X V →L[ℝ] X V := + ContinuousLinearMap.id ℝ (X V) - PX H hH + +@[simp] theorem PX_val (H : Finset V) (hH : IsLowerSet (H : Set V)) (x : X V) : + (PX H hH x : FullDual V) = P (H : Set V) hH x := rfl + +@[simp] theorem QX_val (H : Finset V) (hH : IsLowerSet (H : Set V)) (x : X V) : + (QX H hH x : FullDual V) = Q (H : Set V) hH x := by + exact (Q_eq_sub (H : Set V) hH x).symm + + theorem norm_PX_le (H : Finset V) (hH : IsLowerSet (H : Set V)) (x : X V) : + ‖PX H hH x‖ ≤ ‖x‖ := norm_P_le (H : Set V) hH x + + theorem norm_QX_le (H : Finset V) (hH : IsLowerSet (H : Set V)) (x : X V) : + ‖QX H hH x‖ ≤ ‖x‖ := by + change ‖(QX H hH x : FullDual V)‖ ≤ ‖(x : FullDual V)‖ + rw [QX_val] + exact norm_Q_le (H : Set V) hH x + + theorem finite_span_support {z : FullDual V} + (hz : z ∈ Submodule.span ℝ (Set.range (eStar (V := V)))) : + ∃ S : Finset V, ∀ H : Finset V, ∀ hH : IsLowerSet (H : Set V), + S ⊆ H → P (H : Set V) hH z = z := by + obtain ⟨c,rfl⟩ := Finsupp.mem_span_range_iff_exists_finsupp.mp hz + refine ⟨c.support, ?_⟩ + intro H hH hSH + change P (H : Set V) hH (∑ v ∈ c.support, c v • eStar v) = _ + rw [map_sum] + apply Finset.sum_congr rfl + intro v hv + rw [map_smul, P_eStar, ite_eq_left (show v ∈ (H : Set V) from hSH hv)] + +/-- Coordinate density plus tail contractivity gives arbitrarily close finite +ancestral heads in the general coordinate completion. -/ + theorem exists_head_approx (hAnc : ∀ v : V, (Set.Iic v).Finite) + (x : X V) (ε : ℝ) (hε : 0 < ε) : + ∃ H : Finset V, ∃ hH : IsLowerSet (H : Set V), ‖x - PX H hH x‖ < ε := by + have hx : (x : FullDual V) ∈ closure + (Submodule.span ℝ (Set.range (eStar (V := V))) : Set (FullDual V)) := x.property + obtain ⟨z,hz,hclose⟩ := Metric.mem_closure_iff.mp hx ε hε + obtain ⟨S,hS⟩ := finite_span_support hz + obtain ⟨H,hSH,hH⟩ := exists_finite_lower_hull hAnc S + have hzP := hS H hH hSH + have hzQ : Q (H : Set V) hH z = 0 := by rw [Q_eq_sub, hzP, sub_self] + have hn := norm_Q_le (H : Set V) hH ((x : FullDual V)-z) + rw [map_sub, hzQ, sub_zero, Q_eq_sub] at hn + refine ⟨H,hH, ?_⟩ + change ‖(x : FullDual V) - P (H : Set V) hH x‖ < ε + exact hn.trans_lt (by simpa only [dist_eq_norm] using hclose) + +/-- Restriction to finitely many coordinate values. Its kernel is the particular +closed finite-codimensional subspace used for the modulus. -/ +noncomputable def finiteCoordinates (H : Finset V) : X V →L[ℝ] (H → ℝ) := + ContinuousLinearMap.pi (fun v : H => + ((ContinuousLinearMap.apply ℝ ℝ) (e (V := V) (v : V))).comp (coordinateSubspace V).subtypeL) + +@[simp] theorem finiteCoordinates_apply (H : Finset V) (x : X V) (v : H) : + finiteCoordinates H x v = (x : FullDual V) (e v) := rfl + + theorem finiteCoordinates_kernel_finite (H : Finset V) : + FiniteDimensional ℝ ((X V) ⧸ (finiteCoordinates H).toLinearMap.ker) := by + exact Module.Finite.equiv (finiteCoordinates H).toLinearMap.quotKerEquivRange.symm + + theorem P_eq_zero_of_mem_ker_coordinates (H : Finset V) (hH : IsLowerSet (H : Set V)) + {y : X V} (hy : y ∈ (finiteCoordinates H).toLinearMap.ker) : + P (H : Set V) hH (y : FullDual V) = 0 := by + have hh : finiteCoordinates H y = 0 := hy + rw [P_finite_eq_sum] + apply Finset.sum_eq_zero + intro v hv + have hz := congrFun hh ⟨v,hv⟩ + simp only [finiteCoordinates_apply, Pi.zero_apply] at hz + rw [hz, zero_smul] + + theorem annihilates_of_mem_ker_coordinates (H : Finset V) (hH : IsLowerSet (H : Set V)) + {y : X V} (hy : y ∈ (finiteCoordinates H).toLinearMap.ker) : + Annihilates (y : FullDual V) (H : Set V) := by + have he : Q (H : Set V) hH y = y := by + rw [Q_eq_sub, P_eq_zero_of_mem_ker_coordinates H hH hy, sub_zero] + rw [← he] + exact annihilates_Q (H : Set V) hH y + + theorem paired_X (hF : ForestOrder V) (hAnc : ∀ v : V, (Set.Iic v).Finite) + (H : Finset V) (hH : IsLowerSet (H : Set V)) (x y : X V) + (hx : x = PX H hH x) (hy : y = QX H hH y) : + Real.sqrt (‖x‖^2 + ‖y‖^2/12) ≤ (‖x+y‖ + ‖x-y‖)/2 := by + have hx' : Annihilates (x : FullDual V) (H : Set V)ᶜ := by + nth_rw 1 [hx] + exact annihilates_P (H : Set V) hH x + have hy' : Annihilates (y : FullDual V) (H : Set V) := by + nth_rw 1 [hy] + rw [QX_val] + exact annihilates_Q (H : Set V) hH y + exact paired_estimate hF hAnc (H : Set V) hH x y hx' hy' + + theorem paired_X_two_parameters (hF : ForestOrder V) (hAnc : ∀ v : V, (Set.Iic v).Finite) + (H : Finset V) (hH : IsLowerSet (H : Set V)) (x y : X V) + (hx : x = PX H hH x) (hy : y = QX H hH y) + (s t : ℝ) (hs : 0 < s) (ht : 0 < t) : + (‖x‖+s*t*‖y‖)/Real.sqrt (1+12*s^2) ≤ (‖x+t•y‖+‖x-t•y‖)/2 := by + have hx' : Annihilates (x : FullDual V) (H : Set V)ᶜ := by + nth_rw 1 [hx] + exact annihilates_P (H : Set V) hH x + have hy' : Annihilates (y : FullDual V) (H : Set V) := by + nth_rw 1 [hy] + rw [QX_val] + exact annihilates_Q (H : Set V) hH y + exact paired_two_parameters hF hAnc (H : Set V) hH x y hx' hy' s t hs ht + +end Projections + +section CoordinateStructure +variable {V : Type} [PartialOrder V] + +noncomputable def eX (v : V) : X V := + ⟨eStar v, Submodule.le_topologicalClosure _ (Submodule.subset_span ⟨v,rfl⟩)⟩ + +@[simp] theorem eX_val (v : V) : (eX v : FullDual V) = eStar v := rfl +@[simp] theorem norm_eX (v : V) : ‖eX v‖ = 1 := norm_eStar v + + theorem linearIndependent_eStar : LinearIndependent ℝ (eStar (V := V)) := by + apply linearIndependent_iff'.mpr + intro S a h v hv + have hh := congrArg (fun x : FullDual V => x (e v)) h + simp only [_root_.sum_apply, _root_.smul_apply, + smul_eq_mul, eStar_e, _root_.zero_apply, mul_ite, mul_one, mul_zero] at hh + simpa [hv] using hh + + theorem linearIndependent_eX : LinearIndependent ℝ (eX (V := V)) := + LinearIndependent.of_comp (coordinateSubspace V).subtype linearIndependent_eStar + + theorem not_finiteDimensional_X [Infinite V] : ¬FiniteDimensional ℝ (X V) := by + intro h + let := h + have : Finite V := linearIndependent_eX.finite + exact Infinite.not_finite (inferInstance : Finite V) + +instance [Nonempty V] : Nontrivial (X V) := by + obtain ⟨v⟩ := ‹Nonempty V› + apply nontrivial_iff.mpr + refine ⟨eX v,0, ?_⟩ + intro he + have hval : eStar v = 0 := congrArg Subtype.val he + have hh := congrArg (fun z : FullDual V => z (e v)) hval + simp at hh + +instance : CompleteSpace (X V) := by + let : IsClosed (coordinateSubspace V : Set (FullDual V)) := + Submodule.isClosed_topologicalClosure _ + exact IsClosed.completeSpace_coe + + theorem separable_X [Countable V] : TopologicalSpace.SeparableSpace (X V) := by + have hs : TopologicalSpace.IsSeparable (Set.range (eStar (V := V))) := + (Set.countable_range _).isSeparable + have hc := (hs.span (R := ℝ)).closure + exact hc.separableSpace + +end CoordinateStructure + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Reflexivity.lean b/lean/OAI/Analysis/ForestSpace/Reflexivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cfa2b5a0a8265c1d54585fba2fb9584a45d89e2 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Reflexivity.lean @@ -0,0 +1,309 @@ +import OAI.Analysis.ForestSpace.Trees + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section Reflexivity + + + theorem reflexive_of_equiv {E F : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] (e : E ≃L[ℝ] F) (hF : Reflexive F) : Reflexive E := by + intro Φ + let Ψ := Φ.comp (ContinuousLinearMap.precomp ℝ e.toContinuousLinearMap) + obtain ⟨y,hy⟩ := hF Ψ + refine ⟨e.symm y,?_⟩ + ext φ + have hh := congrArg (fun z : StrongDual ℝ (StrongDual ℝ F) => z (φ.comp e.symm.toContinuousLinearMap)) hy + have he : (φ.comp e.symm.toContinuousLinearMap).comp e.toContinuousLinearMap = φ := by + ext x + simp + change φ (e.symm y) = Φ ((φ.comp e.symm.toContinuousLinearMap).comp e.toContinuousLinearMap) at hh + rw [he] at hh + exact hh + + theorem reflexive_dual {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + (hE : Reflexive E) : Reflexive (StrongDual ℝ E) := by + intro Φ + refine ⟨Φ.comp (NormedSpace.inclusionInDoubleDual ℝ E),?_⟩ + ext G + obtain ⟨x,rfl⟩ := hE G + rfl + + theorem reflexive_hilbert (H : Type) [NormedAddCommGroup H] [InnerProductSpace ℝ H] + [CompleteSpace H] : Reflexive H := by + intro Φ + let R : H ≃L[ℝ] StrongDual ℝ H := (InnerProductSpace.toDual ℝ H).toContinuousLinearEquiv + let x := R.symm (Φ.comp R.toContinuousLinearMap) + refine ⟨x,?_⟩ + ext φ + obtain ⟨y,rfl⟩ := R.surjective φ + change @inner ℝ H _ y x = Φ (R y) + rw [real_inner_comm] + exact InnerProductSpace.toDual_symm_apply + +section L2Dual +variable {I : Type} (E : I → Type) [∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace ℝ (E i)] + +noncomputable def l2DualMap : lp (fun i => StrongDual ℝ (E i)) 2 →L[ℝ] StrongDual ℝ (lp E 2) := + lp.dualPairing 2 2 (fun i => ContinuousLinearMap.id ℝ (StrongDual ℝ (E i))) + (K := 1) (fun _ => ContinuousLinearMap.norm_id_le) + +@[simp] theorem l2DualMap_apply (a : lp (fun i => StrongDual ℝ (E i)) 2) (x : lp E 2) : + l2DualMap E a x = ∑' i, a i (x i) := rfl + +@[simp] theorem l2DualMap_single_right (a : lp (fun i => StrongDual ℝ (E i)) 2) + (i : I) (x : E i) : l2DualMap E a (lp.single 2 i x) = a i x := by + rw [l2DualMap_apply,tsum_eq_single i] + · simp + · intro j hj + simp [Pi.single_eq_of_ne hj] + +@[simp] theorem l2DualMap_single_left (i : I) (φ : StrongDual ℝ (E i)) (x : lp E 2) : + l2DualMap E (lp.single 2 i φ) x = φ (x i) := by + rw [l2DualMap_apply,tsum_eq_single i] + · simp + · intro j hj + simp [Pi.single_eq_of_ne hj] + +noncomputable def l2Restriction (φ : StrongDual ℝ (lp E 2)) (i : I) : StrongDual ℝ (E i) := + φ.comp (lp.singleContinuousLinearMap ℝ E 2 i) + + theorem l2_norm_sum_unit_le (u : ∀ i, E i) (hu : ∀ i, ‖u i‖ ≤ 1) + (S : Finset I) (a : I → ℝ) : + ‖∑ i ∈ S, a i • lp.single 2 i (u i)‖ ≤ Real.sqrt (∑ i ∈ S, a i ^ 2) := by + have he := lp.norm_sum_single (p := 2) (by norm_num) (fun i => a i • u i) S + have he' : ‖∑ i ∈ S, a i • lp.single 2 i (u i)‖^2 = + ∑ i ∈ S, (|a i| * ‖u i‖)^2 := by + simpa only [ENNReal.toReal_ofNat,Real.rpow_two,lp.single_smul,norm_smul, + Real.norm_eq_abs] using he + apply (sq_le_sq₀ (norm_nonneg _) (Real.sqrt_nonneg _)).mp + rw [Real.sq_sqrt (Finset.sum_nonneg (fun _ _ => sq_nonneg _)),he'] + apply Finset.sum_le_sum + intro i hi + have hh := mul_le_mul_of_nonneg_left (hu i) (abs_nonneg (a i)) + have hh' : (|a i| * ‖u i‖)^2 ≤ |a i|^2 := + (sq_le_sq₀ (mul_nonneg (abs_nonneg _) (norm_nonneg _)) (abs_nonneg _)).mpr (by simpa using hh) + simpa only [sq_abs] using hh' + + theorem l2_restriction_summable (φ : StrongDual ℝ (lp E 2)) : + Summable (fun i => ‖l2Restriction E φ i‖^2) := by + have hc : ∀ i, ∃ u : E i, ‖u‖ ≤ 1 ∧ ‖l2Restriction E φ i‖/2 ≤ ‖l2Restriction E φ i u‖ := by + intro i + by_cases hz : ‖l2Restriction E φ i‖ = 0 + · exact ⟨0,by simp,by simp [hz]⟩ + · have hp : 0 < ‖l2Restriction E φ i‖ := lt_of_le_of_ne (norm_nonneg _) (Ne.symm hz) + obtain ⟨u,hu,hφ⟩ := (l2Restriction E φ i).exists_lt_apply_of_lt_opNorm (half_lt_self hp) + exact ⟨u,hu.le,hφ.le⟩ + choose u hu hφ using hc + have hb := dual_vectors_squares_le (fun i => lp.single 2 i (u i)) (l2_norm_sum_unit_le E u hu) φ + apply summable_of_sum_le (fun _ => sq_nonneg _) (c := 4*‖φ‖^2) + intro S + calc + (∑ i ∈ S, ‖l2Restriction E φ i‖^2) ≤ ∑ i ∈ S, 4*(φ (lp.single 2 i (u i)))^2 := by + apply Finset.sum_le_sum + intro i hi + have hh := hφ i + change ‖l2Restriction E φ i‖/2 ≤ |φ (lp.single 2 i (u i))| at hh + have h0 := norm_nonneg (l2Restriction E φ i) + have h1 := abs_nonneg (φ (lp.single 2 i (u i))) + nlinarith [sq_abs (φ (lp.single 2 i (u i)))] + _ = 4*∑ i ∈ S, (φ (lp.single 2 i (u i)))^2 := by rw [Finset.mul_sum] + _ ≤ 4*‖φ‖^2 := mul_le_mul_of_nonneg_left (hb S) (by norm_num) + + theorem l2DualMap_surjective : Function.Surjective (l2DualMap E) := by + intro φ + let a : lp (fun i => StrongDual ℝ (E i)) 2 := ⟨l2Restriction E φ, memℓp_gen (by + simpa only [ENNReal.toReal_ofNat,Real.rpow_two] using l2_restriction_summable E φ)⟩ + refine ⟨a,?_⟩ + apply lp.ext_continuousLinearMap (by norm_num) + intro i + ext x + exact l2DualMap_single_right E a i x + + theorem reflexive_l2 (hE : ∀ i, Reflexive (E i)) : Reflexive (lp E 2) := by + intro Φ + obtain ⟨g,hg⟩ := l2DualMap_surjective (fun i => StrongDual ℝ (E i)) (Φ.comp (l2DualMap E)) + choose u hu using (fun i => hE i (g i)) + have hn : ∀ i, ‖u i‖ = ‖g i‖ := by + intro i + rw [← hu i] + exact (NormedSpace.inclusionInDoubleDualLi ℝ).norm_map (u i) |>.symm + let x : lp E 2 := ⟨u,memℓp_gen (by + simpa only [hn] using (memℓp_gen_iff (p := 2) (by norm_num)).mp (lp.memℓp g))⟩ + refine ⟨x,?_⟩ + ext φ + obtain ⟨a,rfl⟩ := l2DualMap_surjective E φ + have hh := congrArg (fun z : StrongDual ℝ (lp (fun i => StrongDual ℝ (E i)) 2) => z a) hg + simp only [ContinuousLinearMap.comp_apply,l2DualMap_apply] at hh ⊢ + rw [← hh] + apply tsum_congr + intro i + rw [← hu i] + rfl + +end L2Dual +end Reflexivity + +section CompletionIsomorphism +variable {E F : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + + theorem completion_equiv_of_bounds (f : E →L[ℝ] F) (K : NNReal) + (hK : ∀ x, ‖x‖ ≤ K*‖f x‖) (hd : DenseRange f) : + Nonempty (UniformSpace.Completion E ≃L[ℝ] F) := by + let L : UniformSpace.Completion E →L[ℝ] F := f.extend UniformSpace.Completion.toComplL + have he : ∀ x : E, L (x : UniformSpace.Completion E) = f x := by + intro x + exact f.extend_eq UniformSpace.Completion.denseRange_coe + (UniformSpace.Completion.isUniformInducing_coe E) x + have hL : ∀ x, ‖x‖ ≤ K*‖L x‖ := by + intro x + refine UniformSpace.Completion.induction_on x + (isClosed_le continuous_norm (continuous_const.mul L.continuous.norm)) ?_ + intro x + simpa only [he,UniformSpace.Completion.norm_coe] using hK x + have ha := L.antilipschitz_of_bound hL + have hs : Function.Surjective L := by + intro y + apply closure_minimal (t := Set.range L) ?_ (ha.isClosed_range L.uniformContinuous) (hd y) + rintro _ ⟨x,rfl⟩ + exact ⟨(x : UniformSpace.Completion E),he x⟩ + exact ⟨ContinuousLinearEquiv.ofBijective L (LinearMap.ker_eq_bot.mpr ha.injective) + (LinearMap.range_eq_top.mpr hs)⟩ + + theorem denseRange_lp_of_singles {I : Type} (G : I → Type) + [∀ i, NormedAddCommGroup (G i)] [∀ i, NormedSpace ℝ (G i)] + (f : E →ₗ[ℝ] lp G 2) + (hs : ∀ i (x : G i), lp.single 2 i x ∈ f.range.topologicalClosure) : DenseRange f := by + intro x + have hh : x ∈ f.range.topologicalClosure := by + apply (Submodule.isClosed_topologicalClosure f.range).mem_of_tendsto + (lp.hasSum_single (by norm_num : (2 : ENNReal) ≠ ⊤) x) + exact Filter.Eventually.of_forall (fun S => Submodule.sum_mem _ (fun i hi => hs i (x i))) + exact hh + +end CompletionIsomorphism + +section ComponentHilbert +variable {V : Type} [PartialOrder V] + +noncomputable def rawL2Linear : TestVector V →ₗ[ℝ] lp (fun _ : V => ℝ) 2 where + toFun u := ⟨(fun v => u v),memℓp_gen (by + apply summable_of_ne_finset_zero (s := u.toFinsupp.support) + intro v hv + have hz : u v = 0 := Finsupp.notMem_support_iff.mp hv + simp [hz])⟩ + map_add' u v := by ext w; rfl + map_smul' a u := by ext w; rfl + +omit [PartialOrder V] in +@[simp] theorem rawL2Linear_apply [PartialOrder V] (u : TestVector V) (v : V) : rawL2Linear u v = u v := rfl + +omit [PartialOrder V] in + theorem rawL2_norm_sq [PartialOrder V] (u : TestVector V) : + ‖rawL2Linear u‖^2 = ∑ v ∈ u.toFinsupp.support, u v^2 := by + have he := lp.norm_rpow_eq_tsum (p := 2) (by norm_num) (rawL2Linear u) + simp only [ENNReal.toReal_ofNat,Real.rpow_two,rawL2Linear_apply,Real.norm_eq_abs,sq_abs] at he + rw [he] + apply tsum_eq_sum + intro v hv + have hz : u v = 0 := Finsupp.notMem_support_iff.mp hv + simp [hz] + + theorem rawL2_norm_le (u : TestVector V) : ‖rawL2Linear u‖ ≤ ‖u‖ := by + apply (sq_le_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [rawL2_norm_sq] + exact coordinate_squares_le _ u + +noncomputable def rawL2 : TestVector V →L[ℝ] lp (fun _ : V => ℝ) 2 := + rawL2Linear.mkContinuous 1 (by intro u; simpa only [one_mul] using rawL2_norm_le u) + +@[simp] theorem rawL2_apply (u : TestVector V) : rawL2 u = rawL2Linear u := rfl + +omit [PartialOrder V] in + theorem sum_sq_le_support [PartialOrder V] (u : TestVector V) (S : Finset V) : + ∑ v ∈ S, u v^2 ≤ ∑ v ∈ u.toFinsupp.support, u v^2 := by + have he : (∑ v ∈ S ∪ u.toFinsupp.support, u v^2) = ∑ v ∈ u.toFinsupp.support, u v^2 := by + symm + apply Finset.sum_subset Finset.subset_union_right + intro v hv hn + have hz : u v = 0 := Finsupp.notMem_support_iff.mp hn + simp [hz] + rw [← he] + exact Finset.sum_le_sum_of_subset_of_nonneg Finset.subset_union_left (fun _ _ _ => sq_nonneg _) + + theorem rho_le_card_bound (C : ℕ) (hC : ∀ S : Finset V, IsSegment S → S.card ≤ C) + (u : TestVector V) : ‖u‖ ≤ Real.sqrt C * ‖rawL2 u‖ := by + apply (TestVector.norm_le_iff_testBound u (mul_nonneg (Real.sqrt_nonneg _) (norm_nonneg _))).mpr + intro I inst S hS hd + have hloc : ∀ i, (segSum u (S i))^2 ≤ C * ∑ v ∈ S i, u v^2 := by + intro i + have hh := Finset.sum_mul_sq_le_sq_mul_sq (S i) (fun _ => (1:ℝ)) (fun v => u v) + simp only [one_mul,one_pow,Finset.sum_const,nsmul_eq_mul,mul_one] at hh + apply hh.trans + change (S i).card * (∑ v ∈ S i, u v^2) ≤ (C : ℝ) * _ + exact mul_le_mul_of_nonneg_right (by exact_mod_cast hC (S i) (hS i)) + (Finset.sum_nonneg (fun _ _ => sq_nonneg _)) + have hsum : (∑ i, ∑ v ∈ S i, u v^2) ≤ ∑ v ∈ u.toFinsupp.support, u v^2 := by + rw [← Finset.sum_biUnion (s := Finset.univ) (t := S) (by + intro i hi j hj hij + exact hd hij)] + exact sum_sq_le_support u _ + have hm : (∑ i, (C : ℝ) * ∑ v ∈ S i, u v^2) ≤ (C : ℝ) * ∑ v ∈ u.toFinsupp.support, u v^2 := by + rw [← Finset.mul_sum] + exact mul_le_mul_of_nonneg_left hsum (Nat.cast_nonneg C) + have hh := (Finset.sum_le_sum (s := Finset.univ) (fun i hi => hloc i)).trans hm + simpa only [mul_pow,Real.sq_sqrt (Nat.cast_nonneg C),rawL2_apply,rawL2_norm_sq] using hh + + theorem rawL2_dense : DenseRange (rawL2 (V := V)) := by + apply denseRange_lp_of_singles (fun _ : V => ℝ) rawL2Linear + intro v a + apply Submodule.le_topologicalClosure + refine ⟨TestVector.single v a,?_⟩ + ext w + simp [TestVector.single_apply,lp.single_apply,Pi.single_apply,eq_comm] + + theorem reflexive_J_of_segment_card_bound (C : ℕ) + (hC : ∀ S : Finset V, IsSegment S → S.card ≤ C) : Reflexive (J V) := by + obtain ⟨e⟩ := completion_equiv_of_bounds (rawL2 (V := V)) ⟨Real.sqrt C,Real.sqrt_nonneg _⟩ + (rho_le_card_bound C hC) rawL2_dense + exact reflexive_of_equiv e (reflexive_hilbert _) + +abbrev Component (h : ℕ) := {v : Vertex // v.height = h} + + theorem component_segment_card (h : ℕ) (S : Finset (Component h)) (hS : IsSegment S) : + S.card ≤ h+1 := by + let f : S → Fin (h+1) := fun v => ⟨v.val.val.word.letters.length, by + have hh := v.val.val.bounded + rw [v.val.property] at hh + omega⟩ + have hf : Function.Injective f := by + intro a b hab + have hl : a.val.val.word.letters.length = b.val.val.word.letters.length := congrArg Fin.val hab + apply Subtype.ext + apply Subtype.ext + apply Vertex.ext (a.val.property.trans b.val.property.symm) + apply Word.ext + rcases hS.1 a a.property b b.property with h | h + · exact h.2.eq_of_length hl + · exact (h.2.eq_of_length hl.symm).symm + have hh := Fintype.card_le_of_injective f hf + simpa only [Fintype.card_coe, Fintype.card_fin] using hh + + theorem reflexive_component (h : ℕ) : Reflexive (J (Component h)) := + reflexive_J_of_segment_card_bound (h+1) (component_segment_card h) + +end ComponentHilbert + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Renorming.lean b/lean/OAI/Analysis/ForestSpace/Renorming.lean new file mode 100644 index 0000000000000000000000000000000000000000..111f1b78eb40b2446cb5f9829fc352b783443938 --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Renorming.lean @@ -0,0 +1,311 @@ +import OAI.Analysis.ForestSpace.ModulusProofs + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section WeakNull +open Filter +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- Weak convergence against the entire continuous dual. -/ +def WeakNull (d : ℕ → E) : Prop := + ∀ φ : StrongDual ℝ E, Tendsto (fun n => φ (d n)) atTop (nhds 0) + + theorem weakNull_finiteDimensional {G : Type} [NormedAddCommGroup G] + [NormedSpace ℝ G] [FiniteDimensional ℝ G] (d : ℕ → E) (hd : WeakNull d) + (L : E →L[ℝ] G) : Tendsto (fun n => L (d n)) atTop (nhds 0) := by + let b := (Module.finBasis ℝ G).equivFunL + have hb : Tendsto (fun n => b (L (d n))) atTop (nhds 0) := by + apply tendsto_pi_nhds.mpr + intro i + exact hd ((ContinuousLinearMap.proj i).comp (b.toContinuousLinearMap.comp L)) + have hh := b.symm.continuous.continuousAt.tendsto.comp hb + simpa only [Function.comp_def, b.symm_apply_apply, map_zero] using hh + + theorem weakNull_cofinite_approx (d : ℕ → E) (hd : WeakNull d) + (F : Cofinite E) (ε : ℝ) (hε : 0 < ε) : + ∃ j : ℕ, ∃ w : E, w ∈ F.val ∧ ‖w-d j‖ < ε := by + let : IsClosed (F.val : Set E) := F.property.1 + let : FiniteDimensional ℝ (E ⧸ F.val) := F.property.2 + have hh := weakNull_finiteDimensional d hd F.val.mkQL + obtain ⟨j,hj⟩ := (Metric.tendsto_atTop.mp hh (ε/2) (by positivity)) + have hj' : ‖F.val.mkQL (d j)‖ < ε/2 := by simpa using hj j le_rfl + obtain ⟨v,hv,hnv⟩ := Submodule.Quotient.norm_mk_lt (F.val.mkQL (d j)) + (show 0 < ε/2 by positivity) + refine ⟨j,d j-v, ?_, ?_⟩ + · exact (Submodule.Quotient.eq F.val).mp hv.symm + · have he : d j-v-d j = -v := by abel + rw [he, norm_neg] + linarith + +end WeakNull + +section EquivalentNormModulus +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + + +variable {α β : ℝ} (R : EquivalentNorm E α β) + + include R in + theorem EquivalentNorm.beta_pos : 0 < β := R.alpha_pos.trans_le R.alpha_le_beta + theorem EquivalentNorm.nonneg (x : E) : 0 ≤ R.N x := + (mul_nonneg R.alpha_pos.le (norm_nonneg x)).trans (R.lower x) + theorem EquivalentNorm.pos {x : E} (hx : x ≠ 0) : 0 < R.N x := + (mul_pos R.alpha_pos (norm_pos_iff.mpr hx)).trans_le (R.lower x) + + theorem EquivalentNorm.continuous : Continuous R.N := by + let b : NNReal := ⟨β,R.beta_pos.le⟩ + apply Seminorm.continuous_of_le (q := b • normSeminorm ℝ E) + · exact continuous_norm.const_smul b + · intro x + exact R.upper x + + theorem EquivalentNorm.cofinite_unit (hI : ¬FiniteDimensional ℝ E) (F : Cofinite E) : + ∃ y : E, y ∈ F.val ∧ R.N y = 1 := by + obtain ⟨z,hz,hzn⟩ := cofinite_exists_unit hI F + have hp : 0 < R.N z := (by simpa [hzn] using R.alpha_pos : 0 < α*‖z‖).trans_le (R.lower z) + refine ⟨(R.N z)⁻¹ • z, F.val.smul_mem _ hz, ?_⟩ + rw [map_smul_eq_mul, Real.norm_of_nonneg (inv_nonneg.mpr hp.le), inv_mul_cancel₀ hp.ne'] + + theorem EquivalentNorm.support {x : E} (hx : R.N x = 1) : + ∃ φ : StrongDual ℝ E, φ x = 1 ∧ ∀ z : E, |φ z| ≤ R.N z := by + have hx0 : x ≠ 0 := by intro h; simp [h] at hx + let e := LinearEquiv.toSpanNonzeroSingleton ℝ E x hx0 + let f : Module.Dual ℝ (ℝ ∙ x) := e.symm.toLinearMap + have hf : ∀ z : (ℝ ∙ x), ‖f z‖ ≤ R.N (z : E) := by + intro z + obtain ⟨c,rfl⟩ := e.surjective z + change ‖e.symm (e c)‖ ≤ R.N (e c : E) + rw [e.symm_apply_apply] + change ‖c‖ ≤ R.N (c • x) + rw [map_smul_eq_mul,hx,mul_one] + obtain ⟨φ,hφ,hbound⟩ := Module.Dual.exists_continuous_extension_of_le_seminorm + (ℝ ∙ x) f R.continuous hf + refine ⟨φ, ?_, ?_⟩ + · have hh := hφ (e 1) + change φ (e 1 : E) = e.symm (e 1) at hh + rw [e.symm_apply_apply] at hh + simpa only [e, LinearEquiv.toSpanNonzeroSingleton_apply, one_smul] using hh + · intro z + simpa only [Real.norm_eq_abs] using hbound z + + theorem EquivalentNorm.aucValues_nonempty (hI : ¬FiniteDimensional ℝ E) + (t : ℝ) (x : E) (F : Cofinite E) : (aucValues E R.N t x F).Nonempty := by + obtain ⟨y,hy,hyn⟩ := R.cofinite_unit hI F + exact ⟨_,y,hy,hyn,rfl⟩ + + theorem EquivalentNorm.aucValues_bddBelow (t : ℝ) (x : E) (F : Cofinite E) : + BddBelow (aucValues E R.N t x F) := by + refine ⟨-1, ?_⟩ + rintro a ⟨y,hy,hyn,rfl⟩ + linarith [R.nonneg (x+t•y)] + + theorem EquivalentNorm.aucInner_le (hI : ¬FiniteDimensional ℝ E) + {t : ℝ} (ht : 0 ≤ t) {x : E} (hx : R.N x = 1) (F : Cofinite E) : + aucInner E R.N t x F ≤ t := by + obtain ⟨y,hy,hyn⟩ := R.cofinite_unit hI F + have hp := map_add_le_add R.N x (t•y) + rw [hx,map_smul_eq_mul,Real.norm_of_nonneg ht,hyn,mul_one] at hp + have hi := csInf_le (R.aucValues_bddBelow t x F) (show + R.N (x+t•y)-1 ∈ aucValues E R.N t x F from ⟨y,hy,hyn,rfl⟩) + exact hi.trans (by linarith) + + theorem EquivalentNorm.aucCenter_bddAbove (hI : ¬FiniteDimensional ℝ E) + {t : ℝ} (ht : 0 ≤ t) {x : E} (hx : R.N x = 1) : + BddAbove (Set.range (aucInner E R.N t x)) := by + exact ⟨t, fun a ⟨F,hF⟩ => hF ▸ R.aucInner_le hI ht hx F⟩ + + theorem EquivalentNorm.aucCenter_nonneg (hI : ¬FiniteDimensional ℝ E) + {t : ℝ} (ht : 0 ≤ t) {x : E} (hx : R.N x = 1) : + 0 ≤ aucCenter E R.N t x := by + obtain ⟨φ,hφ,hbound⟩ := R.support hx + let F : Cofinite E := ⟨φ.toLinearMap.ker,cofiniteKernel φ⟩ + have hi : 0 ≤ aucInner E R.N t x F := by + apply le_csInf (R.aucValues_nonempty hI t x F) + rintro a ⟨y,hy,hyn,rfl⟩ + have hy' : φ y = 0 := hy + have hb := hbound (x+t•y) + rw [map_add,map_smul,hφ,hy',smul_zero,add_zero,abs_one] at hb + linarith + exact hi.trans (le_csSup (R.aucCenter_bddAbove hI ht hx) ⟨F,rfl⟩) + + theorem EquivalentNorm.aucModulus_nonneg (hI : ¬FiniteDimensional ℝ E) + {t : ℝ} (ht : 0 ≤ t) : 0 ≤ aucModulus E R.N t := by + apply le_csInf + · obtain ⟨x,hx,hxn⟩ := R.cofinite_unit hI (cofiniteTop E) + exact ⟨_,x,hxn,rfl⟩ + · rintro a ⟨x,hx,rfl⟩ + exact R.aucCenter_nonneg hI ht hx + + theorem EquivalentNorm.aucModulus_le_center (hI : ¬FiniteDimensional ℝ E) + {t : ℝ} (ht : 0 ≤ t) {x : E} (hx : R.N x = 1) : + aucModulus E R.N t ≤ aucCenter E R.N t x := by + apply csInf_le + · exact ⟨0, fun a ⟨z,hz,he⟩ => he ▸ R.aucCenter_nonneg hI ht hz⟩ + · exact ⟨x,hx,rfl⟩ + + theorem EquivalentNorm.subspace_gain (hI : ¬FiniteDimensional ℝ E) + {t γ : ℝ} (ht : 0 < t) (hγ : γ < aucModulus E R.N t) + {x : E} (hx : R.N x = 1) : ∃ F : Cofinite E, + ∀ y : E, y ∈ F.val → R.N y = 1 → 1+γ ≤ R.N (x+t•y) := by + have hh : γ < aucCenter E R.N t x := hγ.trans_le (R.aucModulus_le_center hI ht.le hx) + obtain ⟨a,⟨F,rfl⟩,hF⟩ := (lt_csSup_iff (R.aucCenter_bddAbove hI ht.le hx) + ⟨_,cofiniteTop E,rfl⟩).mp hh + refine ⟨F, ?_⟩ + intro y hy hyn + have hi := csInf_le (R.aucValues_bddBelow t x F) + (show R.N (x+t•y)-1 ∈ aucValues E R.N t x F from ⟨y,hy,hyn,rfl⟩) + change γ < sInf (aucValues E R.N t x F) at hF + linarith + +end EquivalentNormModulus + +section TreeObstruction +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] +variable {α β : ℝ} (R : EquivalentNorm E α β) + + theorem EquivalentNorm.gain_extended {t γ : ℝ} (ht : 0 < t) (hγ : 0 ≤ γ) + {x : E} (hx : R.N x = 1) (F : Cofinite E) + (hF : ∀ y : E, y ∈ F.val → R.N y = 1 → 1+γ ≤ R.N (x+t•y)) + {w : E} (hw : w ∈ F.val) (hwn : t ≤ R.N w) : + 1+γ ≤ R.N (x+w) := by + have hp : 0 < R.N w := ht.trans_le hwn + let c : ℝ := t / R.N w + have hc : 0 < c := div_pos ht hp + have hc1 : c ≤ 1 := (div_le_one hp).mpr hwn + have hn : R.N ((R.N w)⁻¹ • w) = 1 := by + rw [map_smul_eq_mul, Real.norm_of_nonneg (inv_nonneg.mpr hp.le), inv_mul_cancel₀ hp.ne'] + have hg := hF ((R.N w)⁻¹ • w) (F.val.smul_mem _ hw) hn + have he : x+t•((R.N w)⁻¹•w) = (1-c)•x+c•(x+w) := by + simp only [smul_add, smul_smul, sub_smul, one_smul, c, div_eq_mul_inv] + abel + rw [he] at hg + have hu := map_add_le_add R.N ((1-c)•x) (c•(x+w)) + rw [map_smul_eq_mul,map_smul_eq_mul,Real.norm_of_nonneg (sub_nonneg.mpr hc1), + Real.norm_of_nonneg hc.le,hx,mul_one] at hu + by_contra hh + have hlt := mul_lt_mul_of_pos_left (lt_of_not_ge hh) hc + have hle := mul_le_mul_of_nonneg_right hc1 hγ + nlinarith + + theorem EquivalentNorm.vector_gain (hI : ¬FiniteDimensional ℝ E) + {t γ : ℝ} (ht : 0 < t) (hγ0 : 0 ≤ γ) (hγ : γ < aucModulus E R.N t) + {u : E} (hu : 0 < R.N u) : ∃ F : Cofinite E, + ∀ w : E, w ∈ F.val → t*R.N u ≤ R.N w → + (1+γ)*R.N u ≤ R.N (u+w) := by + have hn : R.N ((R.N u)⁻¹•u) = 1 := by + rw [map_smul_eq_mul,Real.norm_of_nonneg (inv_nonneg.mpr hu.le),inv_mul_cancel₀ hu.ne'] + obtain ⟨F,hF⟩ := R.subspace_gain hI ht hγ hn + refine ⟨F, ?_⟩ + intro w hw hwn + have hNw : t ≤ R.N ((R.N u)⁻¹•w) := by + rw [map_smul_eq_mul,Real.norm_of_nonneg (inv_nonneg.mpr hu.le)] + exact (le_inv_mul_iff₀ hu).mpr (by simpa only [mul_comm] using hwn) + have hg := R.gain_extended ht hγ0 hn F hF (F.val.smul_mem (R.N u)⁻¹ hw) hNw + rw [← smul_add,map_smul_eq_mul,Real.norm_of_nonneg (inv_nonneg.mpr hu.le)] at hg + simpa only [mul_comm] using (le_inv_mul_iff₀ hu).mp hg + + theorem EquivalentNorm.child_gain (hI : ¬FiniteDimensional ℝ E) + {γ : ℝ} (hγ0 : 0 < γ) (hγ : γ < aucModulus E R.N (α/(2*β))) + (u : E) (hu : ‖u‖ = 1) (v : ℕ → E) + (hd : ∀ j, 1 ≤ ‖v j-u‖) (hweak : WeakNull (fun j => v j-u)) : + ∃ j, R.N u+γ*α/2 ≤ R.N (v j) := by + have huL : α ≤ R.N u := by simpa [hu] using R.lower u + have huU : R.N u ≤ β := by simpa [hu] using R.upper u + have hup : 0 < R.N u := R.alpha_pos.trans_le huL + have ht : 0 < α/(2*β) := div_pos R.alpha_pos (mul_pos (by norm_num) R.beta_pos) + obtain ⟨F,hF⟩ := R.vector_gain hI ht hγ0.le hγ hup + let ε : ℝ := min (α/(2*β)) (γ*α/(2*β)) + have hε : 0 < ε := lt_min ht (div_pos (mul_pos hγ0 R.alpha_pos) (mul_pos (by norm_num) R.beta_pos)) + obtain ⟨j,w,hw,hclose⟩ := weakNull_cofinite_approx (fun j => v j-u) hweak F ε hε + have herr : R.N (w-(v j-u)) < β*ε := + (R.upper _).trans_lt (mul_lt_mul_of_pos_left hclose R.beta_pos) + have he1 : β*ε ≤ α/2 := by + calc + β*ε ≤ β*(α/(2*β)) := mul_le_mul_of_nonneg_left (min_le_left _ _) R.beta_pos.le + _ = α/2 := by field_simp [R.beta_pos.ne'] + have he2 : β*ε ≤ γ*α/2 := by + calc + β*ε ≤ β*(γ*α/(2*β)) := mul_le_mul_of_nonneg_left (min_le_right _ _) R.beta_pos.le + _ = γ*α/2 := by field_simp [R.beta_pos.ne'] + have hdL : α ≤ R.N (v j-u) := + (le_mul_of_one_le_right R.alpha_pos.le (hd j)).trans (R.lower _) + have hwL : α/2 ≤ R.N w := by + have hh := map_sub_le_add R.N w (w-(v j-u)) + have he : w-(w-(v j-u)) = v j-u := by abel + rw [he] at hh + linarith + have hth : α/(2*β)*R.N u ≤ α/2 := by + calc + α/(2*β)*R.N u ≤ α/(2*β)*β := mul_le_mul_of_nonneg_left huU ht.le + _ = α/2 := by field_simp [R.beta_pos.ne'] + have hgain := hF w hw (hth.trans hwL) + have hupper := map_add_le_add R.N (v j) (w-(v j-u)) + have he : v j+(w-(v j-u)) = u+w := by abel + rw [he] at hupper + refine ⟨j, ?_⟩ + nlinarith [mul_le_mul_of_nonneg_left huL hγ0.le] + +/-- The obstruction scale for bounded norm-one paths and +norm-one (or larger) weakly null child increments. An additive form of the +uniform gain is enough for the final finite-height contradiction. -/ + theorem EquivalentNorm.bounded_trees_auc_zero (hI : ¬FiniteDimensional ℝ E) + (u : ℕ → List ℕ → E) + (hu : ∀ h ≥ 1, ∀ s : List ℕ, s.length ≤ h → ‖u h s‖ = 1) + (hd : ∀ h ≥ 1, ∀ s : List ℕ, s.length < h → ∀ j, + 1 ≤ ‖u h (s++[j])-u h s‖) + (hweak : ∀ h ≥ 1, ∀ s : List ℕ, s.length < h → + WeakNull (fun j => u h (s++[j])-u h s)) : + aucModulus E R.N (α/(2*β)) = 0 := by + have ht : 0 < α/(2*β) := div_pos R.alpha_pos (mul_pos (by norm_num) R.beta_pos) + apply le_antisymm ?_ (R.aucModulus_nonneg hI ht.le) + by_contra hh + have hpos : 0 < aucModulus E R.N (α/(2*β)) := lt_of_not_ge hh + let γ : ℝ := aucModulus E R.N (α/(2*β))/2 + have hγ0 : 0 < γ := half_pos hpos + have hγ : γ < aucModulus E R.N (α/(2*β)) := half_lt_self hpos + let δ : ℝ := γ*α/2 + have hδ : 0 < δ := div_pos (mul_pos hγ0 R.alpha_pos) (by norm_num) + obtain ⟨h,hh⟩ := exists_nat_gt (β/δ) + have hb : β < (h:ℝ)*δ := (div_lt_iff₀ hδ).mp hh + have hh1 : 1 ≤ h := by + by_contra hn + have : h = 0 := by omega + subst h + simp at hb + linarith [R.beta_pos] + have hg : ∀ n : ℕ, n ≤ h → ∃ s : List ℕ, + s.length = n ∧ (n:ℝ)*δ ≤ R.N (u h s) := by + intro n hn + induction n with + | zero => exact ⟨[],rfl,by simp [R.nonneg]⟩ + | succ n ih => + obtain ⟨s,hs,hNs⟩ := ih (by omega) + have hslt : s.length < h := by omega + obtain ⟨j,hj⟩ := R.child_gain hI hγ0 hγ (u h s) + (hu h hh1 s (by omega)) (fun j => u h (s++[j])) + (hd h hh1 s hslt) (hweak h hh1 s hslt) + refine ⟨s++[j],by simp [hs], ?_⟩ + push_cast + + dsimp [δ] at hNs ⊢ + linarith + obtain ⟨s,hs,hNs⟩ := hg h le_rfl + have hU := R.upper (u h s) + rw [hu h hh1 s (by omega)] at hU + linarith + +end TreeObstruction + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Segments.lean b/lean/OAI/Analysis/ForestSpace/Segments.lean new file mode 100644 index 0000000000000000000000000000000000000000..79be5604d7d9540f254c23bb55c1954880b746ae --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Segments.lean @@ -0,0 +1,248 @@ +import Mathlib + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +/-- Every ancestral cone is a chain, the order-theoretic forest condition. -/ +def ForestOrder (V : Type) [PartialOrder V] : Prop := + ∀ a b c : V, a ≤ c → b ≤ c → a ≤ b ∨ b ≤ a + +/-- A finite, order-convex chain. The empty chain is a harmless zero test. -/ +def IsSegment {V : Type} [PartialOrder V] (S : Finset V) : Prop := + (∀ a ∈ S, ∀ b ∈ S, a ≤ b ∨ b ≤ a) ∧ + (∀ a ∈ S, ∀ b ∈ S, ∀ c, a ≤ c → c ≤ b → c ∈ S) + +/-- The sum of coordinates over a segment. -/ +def segSum {V : Type} (u : V → ℝ) (S : Finset V) : ℝ := ∑ v ∈ S, u v + +/-- Squared bound on every disjoint family of segment tests. -/ +def TestBound {V : Type} [PartialOrder V] (u : V → ℝ) (C : ℝ) : Prop := + ∀ (ι : Type) (_ : Fintype ι) (S : ι → Finset V), + (∀ i, IsSegment (S i)) → Pairwise (fun i j => Disjoint (S i) (S j)) → + ∑ i, segSum u (S i) ^ 2 ≤ C + +section Basic +variable {V : Type} [PartialOrder V] + +@[simp] theorem isSegment_empty : IsSegment (∅ : Finset V) := by + simp [IsSegment] + +@[simp] theorem isSegment_singleton (v : V) : IsSegment ({v} : Finset V) := by + constructor + · intro a ha b hb + simp only [mem_singleton] at ha hb + subst a + subst b + exact Or.inl le_rfl + · intro a ha b hb c hac hcb + simp only [mem_singleton] at ha hb ⊢ + subst a + subst b + exact le_antisymm hcb hac + +omit [PartialOrder V] in +@[simp] theorem segSum_empty [PartialOrder V] (u : V → ℝ) : segSum u ∅ = 0 := by simp [segSum] +omit [PartialOrder V] in +@[simp] theorem segSum_zero [PartialOrder V] (S : Finset V) : segSum (0 : V → ℝ) S = 0 := by + simp [segSum] +omit [PartialOrder V] in +@[simp] theorem segSum_add [PartialOrder V] (u v : V → ℝ) (S : Finset V) : + segSum (u + v) S = segSum u S + segSum v S := by + simp [segSum, Finset.sum_add_distrib] +omit [PartialOrder V] in +@[simp] theorem segSum_sub [PartialOrder V] (u v : V → ℝ) (S : Finset V) : + segSum (u - v) S = segSum u S - segSum v S := by + simp [segSum, Finset.sum_sub_distrib] +omit [PartialOrder V] in +@[simp] theorem segSum_smul [PartialOrder V] (a : ℝ) (u : V → ℝ) (S : Finset V) : + segSum (a • u) S = a * segSum u S := by + simp [segSum, Finset.mul_sum] + + theorem TestBound.mono {u : V → ℝ} {C D : ℝ} (h : TestBound u C) (hCD : C ≤ D) : + TestBound u D := fun ι inst S hs hd => (h ι inst S hs hd).trans hCD + + theorem TestBound.nonneg {u : V → ℝ} {C : ℝ} (h : TestBound u C) : 0 ≤ C := by + simpa using h PEmpty inferInstance PEmpty.elim (by simp) (by simp [Pairwise]) + + theorem TestBound.single {u : V → ℝ} {C : ℝ} (h : TestBound u C) + {S : Finset V} (hS : IsSegment S) : segSum u S ^ 2 ≤ C := by + simpa using h Unit inferInstance (fun _ => S) (fun _ => hS) + (by simp [Pairwise]) + + theorem TestBound.zero : TestBound (0 : V → ℝ) 0 := by + intro ι inst S hS hd + simp + + theorem TestBound.smul {u : V → ℝ} {C : ℝ} (h : TestBound u C) (a : ℝ) : + TestBound (a • u) (a ^ 2 * C) := by + intro ι inst S hS hd + have hh := mul_le_mul_of_nonneg_left (h ι inst S hS hd) (sq_nonneg a) + simpa only [segSum_smul, mul_pow, Finset.mul_sum] using hh + + theorem TestBound.add {u v : V → ℝ} {A B : ℝ} + (hu : TestBound u (A ^ 2)) (hv : TestBound v (B ^ 2)) + (hA : 0 ≤ A) (hB : 0 ≤ B) : TestBound (u + v) ((A + B) ^ 2) := by + intro ι inst S hS hd + have h₁ := hu ι inst S hS hd + have h₂ := hv ι inst S hS hd + have hc := Real.sum_mul_le_sqrt_mul_sqrt (univ : Finset ι) + (fun i => segSum u (S i)) (fun i => segSum v (S i)) + have hs₁ : Real.sqrt (∑ i, segSum u (S i) ^ 2) ≤ A := + (Real.sqrt_le_iff).2 ⟨hA, h₁⟩ + have hs₂ : Real.sqrt (∑ i, segSum v (S i) ^ 2) ≤ B := + (Real.sqrt_le_iff).2 ⟨hB, h₂⟩ + have hc' : ∑ i, segSum u (S i) * segSum v (S i) ≤ A * B := + hc.trans (mul_le_mul hs₁ hs₂ (Real.sqrt_nonneg _) hA) + have he : (∑ i, segSum (u + v) (S i) ^ 2) = + (∑ i, segSum u (S i) ^ 2) + 2 * (∑ i, segSum u (S i) * segSum v (S i)) + + (∑ i, segSum v (S i) ^ 2) := by + simp only [segSum_add, add_sq, Finset.sum_add_distrib, Finset.mul_sum] + congr 1 + congr 1 + apply Finset.sum_congr rfl + intro i hi + ring + rw [he] + nlinarith + +/-- Cutting a segment by an ancestral set produces another segment. -/ + theorem IsSegment.head {S : Finset V} (hS : IsSegment S) (H : Set V) + (hH : IsLowerSet H) [DecidablePred (· ∈ H)] : + IsSegment (S.filter (· ∈ H)) := by + constructor + · intro a ha b hb + exact hS.1 a (mem_filter.mp ha).1 b (mem_filter.mp hb).1 + · intro a ha b hb c hac hcb + exact mem_filter.mpr ⟨hS.2 a (mem_filter.mp ha).1 b (mem_filter.mp hb).1 c hac hcb, + hH hcb (mem_filter.mp hb).2⟩ + + theorem IsSegment.tail {S : Finset V} (hS : IsSegment S) (H : Set V) + (hH : IsLowerSet H) [DecidablePred (· ∈ H)] : + IsSegment (S.filter (· ∉ H)) := by + classical + constructor + · intro a ha b hb + exact hS.1 a (mem_filter.mp ha).1 b (mem_filter.mp hb).1 + · intro a ha b hb c hac hcb + exact mem_filter.mpr ⟨hS.2 a (mem_filter.mp ha).1 b (mem_filter.mp hb).1 c hac hcb, + fun hc => (mem_filter.mp ha).2 (hH hac hc)⟩ + + theorem TestBound.restrict {u : V → ℝ} {C : ℝ} (hu : TestBound u C) + (H : Set V) (hH : IsLowerSet H) : TestBound (H.indicator u) C := by + classical + intro ι inst S hS hd + have h := hu ι inst (fun i => (S i).filter (· ∈ H)) + (fun i => (hS i).head H hH) + (fun i j hij => (hd hij).mono (filter_subset _ _) (filter_subset _ _)) + simpa [segSum, Finset.sum_filter, Set.indicator_apply] using h + + theorem TestBound.restrict_compl {u : V → ℝ} {C : ℝ} (hu : TestBound u C) + (H : Set V) (hH : IsLowerSet H) : TestBound (Hᶜ.indicator u) C := by + classical + intro ι inst S hS hd + have h := hu ι inst (fun i => (S i).filter (· ∉ H)) + (fun i => (hS i).tail H hH) + (fun i j hij => (hd hij).mono (filter_subset _ _) (filter_subset _ _)) + simpa [segSum, Finset.sum_filter, Set.indicator_apply] using h + +end Basic + +section Geometry +variable {V : Type} [PartialOrder V] + + theorem IsSegment.endpoints {S : Finset V} (hS : IsSegment S) (hne : S.Nonempty) : + ∃ a ∈ S, ∃ b ∈ S, ∀ v, v ∈ S ↔ a ≤ v ∧ v ≤ b := by + obtain ⟨a, ha, hamin⟩ := S.exists_minimal hne + obtain ⟨b, hb, hbmax⟩ := S.exists_maximal hne + refine ⟨a, ha, b, hb, ?_⟩ + intro v + constructor + · intro hv + exact ⟨(hS.1 a ha v hv).elim id (hamin hv), + (hS.1 v hv b hb).elim id (hbmax hv)⟩ + · rintro ⟨hav, hvb⟩ + exact hS.2 a ha b hb v hav hvb + +/-- A first vertex outside an ancestral set (including unattached roots). -/ +def Gate (H : Set V) (g : V) : Prop := g ∉ H ∧ ∀ v, v < g → v ∈ H + + theorem Gate.eq_of_le {H : Set V} {g h : V} (hg : Gate H g) (hh : Gate H h) + (hgh : g ≤ h) : g = h := by + by_contra hne + exact hg.1 (hh.2 g (lt_of_le_of_ne hgh hne)) + + theorem IsSegment.gate_unique {H : Set V} {S : Finset V} (hS : IsSegment S) + {g h : V} (hg : Gate H g) (hh : Gate H h) (hgs : g ∈ S) (hhs : h ∈ S) : g = h := by + rcases hS.1 g hgs h hhs with hgh | hhg + · exact hg.eq_of_le hh hgh + · exact (hh.eq_of_le hg hhg).symm + + theorem IsSegment.exists_gate (hF : ForestOrder V) {H : Set V} (hH : IsLowerSet H) + {S : Finset V} (hS : IsSegment S) + (hp : ∃ a ∈ S, a ∈ H) (hq : ∃ b ∈ S, b ∉ H) : + ∃ g ∈ S, Gate H g := by + classical + obtain ⟨a, ha, haH⟩ := hp + let T := S.filter (· ∉ H) + have hne : T.Nonempty := by + obtain ⟨b, hb, hbH⟩ := hq + exact ⟨b, mem_filter.mpr ⟨hb, hbH⟩⟩ + obtain ⟨g, hg, hgmin⟩ := T.exists_minimal hne + have hgs : g ∈ S := (mem_filter.mp hg).1 + have hgH : g ∉ H := (mem_filter.mp hg).2 + have hag : a ≤ g := (hS.1 a ha g hgs).resolve_right (fun h => hgH (hH h haH)) + refine ⟨g, hgs, hgH, ?_⟩ + intro v hvg + rcases hF v a g hvg.le hag with hva | hav + · exact hH hva haH + · by_contra hvH + have hvm : v ∈ T := mem_filter.mpr ⟨hS.2 a ha g hgs v hav hvg.le, hvH⟩ + exact (not_le_of_gt hvg) (hgmin hvm hvg.le) + +/-- A coordinate vector supported on a specified set. -/ +def SupportedOn (u : V → ℝ) (H : Set V) : Prop := ∀ v, v ∉ H → u v = 0 + +omit [PartialOrder V] in + theorem SupportedOn.segSum_filter [PartialOrder V] {u : V → ℝ} {H : Set V} (hu : SupportedOn u H) + (S : Finset V) : segSum u (S.filter (· ∈ H)) = segSum u S := by + classical + simp only [segSum, Finset.sum_filter] + apply sum_congr rfl + intro v hv + split_ifs with hh + · rfl + · exact (hu v hh).symm + +omit [PartialOrder V] in + theorem SupportedOn.segSum_eq_zero [PartialOrder V] {u : V → ℝ} {H : Set V} (hu : SupportedOn u H) + {S : Finset V} (hS : ∀ v ∈ S, v ∉ H) : segSum u S = 0 := by + exact sum_eq_zero fun v hv => hu v (hS v hv) + + theorem cross_zero_of_no_gate (hF : ForestOrder V) {H : Set V} (hH : IsLowerSet H) + {f v : V → ℝ} (hf : SupportedOn f H) (hv : SupportedOn v Hᶜ) + {S : Finset V} (hS : IsSegment S) (hg : ¬∃ g ∈ S, Gate H g) : + segSum f S * segSum v S = 0 := by + by_cases hp : ∃ a ∈ S, a ∈ H + · have hq : ∀ b ∈ S, b ∈ H := by + intro b hb + by_contra hbH + exact hg (hS.exists_gate hF hH hp ⟨b, hb, hbH⟩) + have hz : segSum v S = 0 := hv.segSum_eq_zero (by simpa using hq) + rw [hz, mul_zero] + · have hz : segSum f S = 0 := hf.segSum_eq_zero (by simpa using hp) + rw [hz, zero_mul] + +end Geometry + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/ForestSpace/Trees.lean b/lean/OAI/Analysis/ForestSpace/Trees.lean new file mode 100644 index 0000000000000000000000000000000000000000..f59d35bb5d7920129a203fee6337a27a0c686c4a --- /dev/null +++ b/lean/OAI/Analysis/ForestSpace/Trees.lean @@ -0,0 +1,234 @@ +import OAI.Analysis.ForestSpace.Coordinates + +namespace OAI + +open scoped BigOperators +open Finset + +namespace ForestSpace + +noncomputable section +attribute [local instance] Classical.propDecidable + +section Words + +/-- Finite words, ordered by extension, including the empty root. -/ +structure Word where + letters : List ℕ + deriving DecidableEq + +namespace Word +@[ext] theorem ext {a b : Word} (h : a.letters = b.letters) : a = b := by + cases a; cases b; cases h; rfl +instance : Countable Word := Function.Injective.countable (f := letters) (fun _ _ => ext) +instance : Infinite Word := Infinite.of_injective (fun n : ℕ => Word.mk [n]) (by + intro i j h + simpa using congrArg letters h) +instance : PartialOrder Word where + le a b := a.letters <+: b.letters + le_refl _ := List.prefix_rfl + le_trans _ _ _ := List.IsPrefix.trans + le_antisymm a b hab hba := by + have h := hab.eq_of_length (Nat.le_antisymm hab.length_le hba.length_le) + cases a; cases b; cases h; rfl + +@[simp] theorem le_def (a b : Word) : a ≤ b ↔ a.letters <+: b.letters := Iff.rfl + theorem forestOrder : ForestOrder Word := by + intro a b c hac hbc + rcases le_total a.letters.length b.letters.length with h | h + · exact Or.inl (List.prefix_of_prefix_length_le hac hbc h) + · exact Or.inr (List.prefix_of_prefix_length_le hbc hac h) + + theorem finiteAncestors (v : Word) : (Set.Iic v).Finite := by + apply (v.letters.inits.toFinset.finite_toSet.image Word.mk).subset + intro w hw + exact ⟨w.letters,by simpa only [Finset.mem_coe,List.mem_toFinset,List.mem_inits] using (show w.letters <+: v.letters from hw),rfl⟩ + +def root : Word := ⟨[]⟩ +def child (s : Word) (j : ℕ) : Word := ⟨s.letters++[j]⟩ + + theorem le_child (s : Word) (j : ℕ) : s ≤ child s j := List.prefix_append _ _ + theorem child_not_le (s : Word) (j : ℕ) : ¬child s j ≤ s := by + intro h + have hh := h.length_le + simp only [child,List.length_append,List.length_singleton] at hh + omega + + theorem child_injective (s : Word) : Function.Injective (child s) := by + intro i j h + have hh := congrArg letters h + simpa [child] using hh + + theorem le_child_iff (s w : Word) (j : ℕ) : + w ≤ child s j ↔ w = child s j ∨ w ≤ s := by + constructor + · intro h + by_cases hlen : w.letters.length ≤ s.letters.length + · exact Or.inr (List.prefix_of_prefix_length_le h (le_child s j) hlen) + · left + apply ext + apply h.eq_of_length + have hh := h.length_le + simp only [child,List.length_append,List.length_singleton] at hh ⊢ + omega + · rintro (rfl | h) + · exact le_rfl + · exact h.trans (le_child s j) + + theorem ancestor_finset_child (s : Word) (j : ℕ) : + (finiteAncestors (child s j)).toFinset = insert (child s j) (finiteAncestors s).toFinset := by + ext w + simp only [Set.Finite.mem_toFinset, Set.mem_Iic, Finset.mem_insert] + exact le_child_iff s w j + + theorem path_child (s : Word) (j : ℕ) : + pathVector (child s j) (finiteAncestors _) - pathVector s (finiteAncestors _) = eX (child s j) := by + unfold pathVector + rw [ancestor_finset_child,Finset.sum_insert] + · abel + · simpa using child_not_le s j + + theorem weakNull_path_children (s : Word) : + WeakNull (fun j => pathVector (child s j) (finiteAncestors _) - + pathVector s (finiteAncestors _)) := by + simpa only [path_child] using weakNull_coordinates (child s) (child_injective s) + +end Word + +/-- The James-tree coordinate completion has zero AUC modulus at exactly the +comparison scale for every equivalent norm; reflexivity is not assumed. -/ + theorem word_auc_modulus_zero {α β : ℝ} (R : EquivalentNorm (X Word) α β) : + aucModulus (X Word) R.N (α/(2*β)) = 0 := by + apply R.bounded_trees_auc_zero not_finiteDimensional_X + (fun _ s => pathVector (Word.mk s) (Word.finiteAncestors _)) + · intro h hh s hs + exact norm_pathVector Word.forestOrder _ _ + · intro h hh s hs j + have he := Word.path_child (Word.mk s) j + change pathVector (Word.mk (s++[j])) _ - pathVector (Word.mk s) _ = _ at he + rw [he,norm_eX] + · intro h hh s hs + exact Word.weakNull_path_children (Word.mk s) + +end Words + +section FiniteHeightForest + +/-- A disjoint forest: one copy of `Nat^{≤h}` for every `h≥1`. -/ +structure Vertex where + height : ℕ + positive : 1 ≤ height + word : Word + bounded : word.letters.length ≤ height + deriving DecidableEq + +namespace Vertex +@[ext] theorem ext {a b : Vertex} (hh : a.height = b.height) (hw : a.word = b.word) : a = b := by + cases a; cases b; cases hh; cases hw; rfl +instance : Countable Vertex := Function.Injective.countable + (f := fun v : Vertex => (v.height,v.word)) (by + intro a b h + exact ext (congrArg Prod.fst h) (congrArg Prod.snd h)) +instance : PartialOrder Vertex where + le a b := a.height = b.height ∧ a.word ≤ b.word + le_refl _ := ⟨rfl,le_rfl⟩ + le_trans a b c hab hbc := ⟨hab.1.trans hbc.1,hab.2.trans hbc.2⟩ + le_antisymm a b hab hba := by + obtain ⟨hh, hw⟩ := hab + have he := le_antisymm hw hba.2 + cases a; cases b; cases hh; cases he; rfl +@[simp] theorem le_def (a b : Vertex) : a ≤ b ↔ a.height = b.height ∧ a.word ≤ b.word := Iff.rfl + theorem forestOrder : ForestOrder Vertex := by + intro a b c hac hbc + rcases Word.forestOrder a.word b.word c.word hac.2 hbc.2 with h | h + · exact Or.inl ⟨hac.1.trans hbc.1.symm,h⟩ + · exact Or.inr ⟨hbc.1.trans hac.1.symm,h⟩ + + theorem finiteAncestors (v : Vertex) : (Set.Iic v).Finite := by + apply Set.Finite.of_finite_image (f := fun w : Vertex => w.word) + ((Word.finiteAncestors v.word).subset ?_) ?_ + · rintro _ ⟨w,hw,rfl⟩ + exact hw.2 + · intro a ha b hb he + exact ext (ha.1.trans hb.1.symm) he + +def node (h : ℕ) (hh : 1 ≤ h) (s : List ℕ) (hs : s.length ≤ h) : Vertex := + ⟨h,hh,Word.mk s,hs⟩ + +def child (v : Vertex) (hv : v.word.letters.length < v.height) (j : ℕ) : Vertex := + ⟨v.height,v.positive,Word.child v.word j,by + simp only [Word.child,List.length_append,List.length_singleton] + omega⟩ + + theorem child_injective (v : Vertex) (hv : v.word.letters.length < v.height) : + Function.Injective (child v hv) := by + intro i j h + exact Word.child_injective v.word (congrArg word h) + +instance : Infinite Vertex := Infinite.of_injective + (child (node 1 le_rfl [] (by simp)) (by simp [node])) + (child_injective _ _) + + theorem child_not_le (v : Vertex) (hv : v.word.letters.length < v.height) (j : ℕ) : + ¬ child v hv j ≤ v := fun h => Word.child_not_le v.word j h.2 + + theorem le_child_iff (v w : Vertex) (hv : v.word.letters.length < v.height) (j : ℕ) : + w ≤ child v hv j ↔ w = child v hv j ∨ w ≤ v := by + constructor + · intro hw + rcases (Word.le_child_iff v.word w.word j).mp hw.2 with h | h + · exact Or.inl (ext hw.1 h) + · exact Or.inr ⟨hw.1,h⟩ + · rintro (rfl | h) + · exact le_rfl + · exact ⟨h.1,h.2.trans (Word.le_child v.word j)⟩ + + theorem ancestor_finset_child (v : Vertex) (hv : v.word.letters.length < v.height) (j : ℕ) : + (finiteAncestors (child v hv j)).toFinset = insert (child v hv j) (finiteAncestors v).toFinset := by + ext w + simp only [Set.Finite.mem_toFinset,Set.mem_Iic,Finset.mem_insert] + exact le_child_iff v w hv j + + theorem path_child (v : Vertex) (hv : v.word.letters.length < v.height) (j : ℕ) : + pathVector (child v hv j) (finiteAncestors _) - pathVector v (finiteAncestors _) = eX (child v hv j) := by + unfold pathVector + rw [ancestor_finset_child,Finset.sum_insert] + · abel + · simpa using child_not_le v hv j + +/-- A total extension of the path vector; the off-tree values are never used. -/ +noncomputable def treePath (h : ℕ) (s : List ℕ) : X Vertex := + if hh : 1 ≤ h then if hs : s.length ≤ h then + pathVector (node h hh s hs) (finiteAncestors _) else 0 else 0 + + theorem norm_treePath (h : ℕ) (hh : 1 ≤ h) (s : List ℕ) (hs : s.length ≤ h) : + ‖treePath h s‖ = 1 := by + simp only [treePath,dite_eq_left hh,dite_eq_left hs] + exact norm_pathVector forestOrder _ _ + + theorem treePath_child (h : ℕ) (hh : 1 ≤ h) (s : List ℕ) (hs : s.length < h) (j : ℕ) : + treePath h (s++[j]) - treePath h s = + eX (child (node h hh s (by omega)) hs j) := by + have hs' : (s++[j]).length ≤ h := by simp; omega + simpa only [treePath,dite_eq_left hh,dite_eq_left hs',dite_eq_left (Nat.le_of_lt hs),node,child,Word.child] using + path_child (node h hh s (Nat.le_of_lt hs)) hs j + +end Vertex + + theorem finite_forest_auc_modulus_zero {α β : ℝ} (R : EquivalentNorm (X Vertex) α β) : + aucModulus (X Vertex) R.N (α/(2*β)) = 0 := by + apply R.bounded_trees_auc_zero not_finiteDimensional_X Vertex.treePath + · exact Vertex.norm_treePath + · intro h hh s hs j + rw [Vertex.treePath_child h hh s hs j,norm_eX] + · intro h hh s hs + simpa only [Vertex.treePath_child h hh s hs] using + weakNull_coordinates _ (Vertex.child_injective (Vertex.node h hh s (Nat.le_of_lt hs)) hs) + +end FiniteHeightForest + +end + +end ForestSpace + +end OAI diff --git a/lean/OAI/Analysis/Fourier/HeightLayers.lean b/lean/OAI/Analysis/Fourier/HeightLayers.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1f37176f243070431b8c679feac3842467885ed --- /dev/null +++ b/lean/OAI/Analysis/Fourier/HeightLayers.lean @@ -0,0 +1,484 @@ +import Mathlib + +namespace OAI + + + +noncomputable section + +open MeasureTheory Filter +open scoped BigOperators Topology + +namespace FourierLLogL + +abbrev Torus := AddCircle (2 * Real.pi) + +instance circlePeriod_pos : Fact (0 < 2 * Real.pi) := + ⟨mul_pos (by norm_num) Real.pi_pos⟩ + + +def circleMeasure : Measure Torus := AddCircle.haarAddCircle + + + +def MemLLogL (f : Torus → ℂ) : Prop := + AEStronglyMeasurable f circleMeasure ∧ + Integrable (fun x ↦ ‖f x‖ * Real.log (2 + ‖f x‖)) circleMeasure + + + +def symmetricPartialSum (f : Torus → ℂ) (N : ℕ) (x : Torus) : ℂ := + ∑ k ∈ Finset.Icc (-(N : ℤ)) (N : ℤ), fourierCoeff f k * fourier k x + + + + + +instance : IsProbabilityMeasure circleMeasure := by + unfold circleMeasure + infer_instance + +@[simp] theorem circleMeasure_univ : circleMeasure Set.univ = 1 := + measure_univ + + +theorem fourier_of_real (k : ℤ) (x : ℝ) : + fourier k (x : Torus) = Complex.exp (Complex.I * (k : ℂ) * (x : ℂ)) := by + rw [fourier_coe_apply] + congr 1 + push_cast + field_simp + + +theorem fourierCoeff_eq_integral (f : Torus → ℂ) (k : ℤ) : + fourierCoeff f k = ∫ x, f x * fourier (-k) x ∂circleMeasure := by + simp only [fourierCoeff, circleMeasure, smul_eq_mul, mul_comm] + + + +theorem fourierCoeff_eq_normalized_intervalIntegral (f : Torus → ℂ) (k : ℤ) : + fourierCoeff f k = (1 / (2 * Real.pi) : ℝ) • + ∫ x in (0 : ℝ)..(2 * Real.pi), + f (x : Torus) * Complex.exp (-(Complex.I * (k : ℂ) * (x : ℂ))) := by + rw [fourierCoeff_eq_intervalIntegral f k 0] + simp only [zero_add, smul_eq_mul] + congr 1 + apply intervalIntegral.integral_congr + intro x _ + dsimp only + rw [fourier_of_real] + simp only [Int.cast_neg, mul_neg, mul_comm] + + +theorem orliczDensity_nonneg (z : ℂ) : + 0 ≤ ‖z‖ * Real.log (2 + ‖z‖) := by + apply mul_nonneg (norm_nonneg _) + apply Real.log_nonneg + linarith [norm_nonneg z] + + +theorem MemLLogL.integrable {f : Torus → ℂ} (hf : MemLLogL f) : + Integrable f circleMeasure := by + have hlog : 0 < Real.log 2 := Real.log_pos (by norm_num) + apply (hf.2.div_const (Real.log 2)).mono' hf.1 + refine Filter.Eventually.of_forall fun x ↦ ?_ + apply (le_div_iff₀ hlog).2 + exact mul_le_mul_of_nonneg_left + (Real.log_le_log (by norm_num) (le_add_of_nonneg_right (norm_nonneg _))) + (norm_nonneg _) + + +theorem MemLLogL.congr_ae {f g : Torus → ℂ} (hf : MemLLogL f) + (hfg : f =ᵐ[circleMeasure] g) : MemLLogL g := by + refine ⟨hf.1.congr hfg, hf.2.congr ?_⟩ + filter_upwards [hfg] with x hx + rw [hx] + + + +theorem continuous_symmetricPartialSum (f : Torus → ℂ) (N : ℕ) : + Continuous (symmetricPartialSum f N) := by + apply continuous_finsetSum + intro k _ + exact continuous_const.mul (fourier k).continuous + +theorem measurable_symmetricPartialSum (f : Torus → ℂ) (N : ℕ) : + Measurable (symmetricPartialSum f N) := + (continuous_symmetricPartialSum f N).measurable + + +theorem symmetricPartialSum_congr_ae {f g : Torus → ℂ} + (hfg : f =ᵐ[circleMeasure] g) (N : ℕ) (x : Torus) : + symmetricPartialSum f N x = symmetricPartialSum g N x := by + have hcoeff : fourierCoeff f = fourierCoeff g := fourierCoeff_congr_ae hfg + simp only [symmetricPartialSum, hcoeff] + +@[simp] theorem symmetricPartialSum_zero (N : ℕ) (x : Torus) : + symmetricPartialSum (fun _ ↦ 0) N x = 0 := by + simp [symmetricPartialSum, fourierCoeff] + + +@[simp] theorem symmetricPartialSum_cutoff_zero (f : Torus → ℂ) (x : Torus) : + symmetricPartialSum f 0 x = fourierCoeff f 0 := by + simp [symmetricPartialSum] + +theorem symmetricPartialSum_add {f g : Torus → ℂ} + (hf : Integrable f circleMeasure) (hg : Integrable g circleMeasure) + (N : ℕ) (x : Torus) : + symmetricPartialSum (f + g) N x = + symmetricPartialSum f N x + symmetricPartialSum g N x := by + simp only [symmetricPartialSum, fourierCoeff.add hf hg, Pi.add_apply, + add_mul, Finset.sum_add_distrib] + +theorem symmetricPartialSum_const_mul (f : Torus → ℂ) (c : ℂ) + (N : ℕ) (x : Torus) : + symmetricPartialSum (fun y ↦ c * f y) N x = c * symmetricPartialSum f N x := by + simp only [symmetricPartialSum, fourierCoeff.const_mul, Finset.mul_sum, mul_assoc] + + +theorem norm_fourierCoeff_le (f : Torus → ℂ) (k : ℤ) : + ‖fourierCoeff f k‖ ≤ ∫ x, ‖f x‖ ∂circleMeasure := by + calc + ‖fourierCoeff f k‖ ≤ ∫ x, ‖fourier (-k) x * f x‖ ∂circleMeasure := + norm_integral_le_integral_norm _ + _ = ∫ x, ‖f x‖ ∂circleMeasure := by + congr 1 + funext x + simp [fourier_apply, Circle.norm_coe] + + + +theorem norm_symmetricPartialSum_le (f : Torus → ℂ) (N : ℕ) (x : Torus) : + ‖symmetricPartialSum f N x‖ ≤ + (2 * N + 1 : ℕ) * ∫ y, ‖f y‖ ∂circleMeasure := by + calc + ‖symmetricPartialSum f N x‖ ≤ + ∑ k ∈ Finset.Icc (-(N : ℤ)) (N : ℤ), ‖fourierCoeff f k * fourier k x‖ := + norm_sum_le _ _ + _ ≤ ∑ _k ∈ Finset.Icc (-(N : ℤ)) (N : ℤ), ∫ y, ‖f y‖ ∂circleMeasure := by + apply Finset.sum_le_sum + intro k _ + simpa only [norm_mul, fourier_apply, Circle.norm_coe, mul_one] using + norm_fourierCoeff_le f k + _ = (2 * N + 1 : ℕ) * ∫ y, ‖f y‖ ∂circleMeasure := by + simp only [Finset.sum_const, nsmul_eq_mul, Int.card_Icc] + congr 2 + omega + + + + + +theorem exists_measurable_null_of_ae {p : Torus → Prop} + (hp : ∀ᵐ x ∂circleMeasure, p x) : + ∃ E : Set Torus, MeasurableSet E ∧ circleMeasure E = 0 ∧ ∀ x ∉ E, p x := by + obtain ⟨E, hsub, hE, hzero⟩ := exists_measurable_superset_of_null (ae_iff.mp hp) + refine ⟨E, hE, hzero, ?_⟩ + intro x hx + by_contra h + exact hx (hsub h) + + + +theorem ae_convergence_iff_exists_measurable_null (f : Torus → ℂ) : + (∀ᵐ x ∂circleMeasure, + Tendsto (fun N : ℕ ↦ symmetricPartialSum f N x) atTop (𝓝 (f x))) ↔ + ∃ E : Set Torus, MeasurableSet E ∧ circleMeasure E = 0 ∧ + ∀ x ∉ E, Tendsto (fun N : ℕ ↦ symmetricPartialSum f N x) atTop (𝓝 (f x)) := by + refine ⟨exists_measurable_null_of_ae, ?_⟩ + rintro ⟨E, _, hzero, hconv⟩ + have hE : ∀ᵐ x ∂circleMeasure, x ∉ E := by + simpa only [ae_iff, not_not, Set.ofPred_mem_eq] using hzero + filter_upwards [hE] with x hx using hconv x hx + + + + + +theorem tendsto_symmetricPartialSum_of_summable (f : C(Torus, ℂ)) + (hf : Summable (fourierCoeff f)) (x : Torus) : + Tendsto (fun N : ℕ ↦ symmetricPartialSum f N x) atTop (𝓝 (f x)) := by + have h := has_pointwise_sum_fourier_series_of_summable hf x + exact h.comp (Finset.tendsto_Icc_neg (R := ℤ)) + + + + +theorem fourierCoeff_tsum {F : ℕ → Torus → ℂ} + (hF : ∀ j, Integrable (F j) circleMeasure) + (hsum : Summable (fun j ↦ ∫ x, ‖F j x‖ ∂circleMeasure)) (k : ℤ) : + fourierCoeff (fun x ↦ ∑' j, F j x) k = ∑' j, fourierCoeff (F j) k := by + have hint : ∀ j, Integrable (fun x ↦ fourier (-k) x * F j x) circleMeasure := + fun j ↦ (hF j).fourier_smul (-k) + have hs : Summable (fun j ↦ ∫ x, ‖fourier (-k) x * F j x‖ ∂circleMeasure) := by + simpa only [norm_mul, fourier_apply, Circle.norm_coe, one_mul] using hsum + simpa only [fourierCoeff, circleMeasure, smul_eq_mul, tsum_mul_left] using + (integral_tsum_of_summable_integral_norm hint hs).symm + + + +theorem symmetricPartialSum_tsum {F : ℕ → Torus → ℂ} + (hF : ∀ j, Integrable (F j) circleMeasure) + (hsum : Summable (fun j ↦ ∫ x, ‖F j x‖ ∂circleMeasure)) (N : ℕ) (x : Torus) : + symmetricPartialSum (fun y ↦ ∑' j, F j y) N x = + ∑' j, symmetricPartialSum (F j) N x := by + simp only [symmetricPartialSum, fourierCoeff_tsum hF hsum, ← tsum_mul_right] + symm + apply Summable.tsum_finsetSum + intro k _ + exact (hsum.of_norm_bounded (fun j ↦ norm_fourierCoeff_le (F j) k)).mul_right _ + + + +theorem tendsto_symmetricPartialSum_tsum {F : ℕ → Torus → ℂ} + (hF : ∀ j, Integrable (F j) circleMeasure) + (hsum : Summable (fun j ↦ ∫ y, ‖F j y‖ ∂circleMeasure)) + (x : Torus) {b : ℕ → ℝ} (hb : Summable b) + (hbound : ∀ j N, ‖symmetricPartialSum (F j) N x‖ ≤ b j) + (hlim : ∀ j, Tendsto (fun N : ℕ ↦ symmetricPartialSum (F j) N x) + atTop (𝓝 (F j x))) : + Tendsto (fun N : ℕ ↦ symmetricPartialSum (fun y ↦ ∑' j, F j y) N x) + atTop (𝓝 (∑' j, F j x)) := by + have h := tendsto_tsum_of_dominated_convergence hb hlim + (Filter.Eventually.of_forall (fun N j ↦ hbound j N)) + simpa only [symmetricPartialSum_tsum hF hsum, tsum_apply] using h + + + + +theorem mass_logMinus_le {m a : ℝ} (hm : 0 ≤ m) (ha : 0 ≤ a) : + m * max 0 (-Real.log m) ≤ a * m + Real.exp (-a) := by + rcases eq_or_lt_of_le hm with rfl | hm + · simp [Real.exp_nonneg] + by_cases hlog : 0 ≤ -Real.log m + · rw [max_eq_right hlog] + have h := Real.log_le_sub_one_of_pos (div_pos (Real.exp_pos (-a)) hm) + rw [Real.log_div (Real.exp_ne_zero _) hm.ne', Real.log_exp] at h + have h' := mul_le_mul_of_nonneg_right h hm.le + simp only [sub_mul, div_mul_cancel₀ _ hm.ne', one_mul] at h' + nlinarith + · rw [max_eq_left (le_of_not_ge hlog), mul_zero] + positivity + + + +theorem summable_mass_logMinus {m : ℕ → ℝ} (hm : ∀ j, 0 ≤ m j) + (hweight : Summable (fun j ↦ (2 : ℝ) ^ j * m j)) : + Summable (fun j ↦ m j * max 0 (-Real.log (m j))) := by + have hexp : Summable (fun j : ℕ ↦ Real.exp (-((2 : ℝ) ^ j))) := by + have hpow : ∀ j : ℕ, (j : ℝ) ≤ (2 : ℝ) ^ j := by + intro j + exact_mod_cast (Nat.lt_two_pow_self (n := j)).le + simpa only [neg_one_mul] using + Real.summable_exp_nat_mul_of_ge (c := -1) (by norm_num) hpow + refine (hweight.add hexp).of_nonneg_of_le (fun j ↦ ?_) (fun j ↦ ?_) + · exact mul_nonneg (hm j) (le_max_left _ _) + · exact mass_logMinus_le (hm j) (by positivity) + + + +theorem summable_layerCost {m : ℕ → ℝ} (hm : ∀ j, 0 ≤ m j) + (hweight : Summable (fun j ↦ (2 : ℝ) ^ j * m j)) : + Summable (fun j ↦ m j * ((2 : ℝ) ^ (j + 1) + max 0 (-Real.log (m j)))) := by + apply ((hweight.mul_left 2).add (summable_mass_logMinus hm hweight)).congr + intro j + simp only [pow_succ] + ring + + + + +def heightLayerSet (f : Torus → ℂ) (j : ℕ) : Set Torus := + {x | Real.exp ((2 : ℝ) ^ (j + 1)) ≤ ‖f x‖ ∧ + ‖f x‖ < Real.exp ((2 : ℝ) ^ (j + 2))} + + +def heightLayer (f : Torus → ℂ) (j : ℕ) : Torus → ℂ := + (heightLayerSet f j).indicator f + + +def heightLayerMass (f : Torus → ℂ) (j : ℕ) : ℝ := + ∫ x in heightLayerSet f j, ‖f x‖ ∂circleMeasure + +theorem heightLayerSet_nullMeasurable {f : Torus → ℂ} (hf : MemLLogL f) (j : ℕ) : + NullMeasurableSet (heightLayerSet f j) circleMeasure := by + exact (nullMeasurableSet_le aemeasurable_const hf.1.norm.aemeasurable).inter + (nullMeasurableSet_lt hf.1.norm.aemeasurable aemeasurable_const) + +theorem heightLayerSet_pairwise_disjoint (f : Torus → ℂ) : + Pairwise (fun i j ↦ Disjoint (heightLayerSet f i) (heightLayerSet f j)) := by + intro i j hij + rw [Set.disjoint_left] + intro x hxi hxj + have hmono : Monotone (fun n : ℕ ↦ Real.exp ((2 : ℝ) ^ n)) := + Real.exp_monotone.comp (pow_right_strictMono₀ (by norm_num : (1 : ℝ) < 2)).monotone + rcases lt_or_gt_of_ne hij with h | h + · exact (not_lt_of_ge ((hmono (by omega : i + 2 ≤ j + 1)).trans hxj.1)) hxi.2 + · exact (not_lt_of_ge ((hmono (by omega : j + 2 ≤ i + 1)).trans hxi.1)) hxj.2 + +theorem MemLLogL.heightLayer_integrable {f : Torus → ℂ} (hf : MemLLogL f) (j : ℕ) : + Integrable (heightLayer f j) circleMeasure := + hf.integrable.indicator₀ (heightLayerSet_nullMeasurable hf j) + +theorem heightLayerMass_nonneg (f : Torus → ℂ) (j : ℕ) : + 0 ≤ heightLayerMass f j := + integral_nonneg (fun x ↦ norm_nonneg (f x)) + +theorem heightLayerMass_eq_integral_norm {f : Torus → ℂ} (hf : MemLLogL f) (j : ℕ) : + heightLayerMass f j = ∫ x, ‖heightLayer f j x‖ ∂circleMeasure := by + rw [heightLayerMass, ← integral_indicator₀ (heightLayerSet_nullMeasurable hf j)] + simp only [heightLayer, norm_indicator_eq_indicator_norm] + + + +theorem MemLLogL.summable_weighted_heightLayerMass {f : Torus → ℂ} (hf : MemLLogL f) : + Summable (fun j ↦ (2 : ℝ) ^ (j + 1) * heightLayerMass f j) := by + have hD : Summable (fun j ↦ ∫ x in heightLayerSet f j, + ‖f x‖ * Real.log (2 + ‖f x‖) ∂circleMeasure) := + (hasSum_integral_iUnion_ae (heightLayerSet_nullMeasurable hf) + ((heightLayerSet_pairwise_disjoint f).mono (fun _ _ h ↦ h.aedisjoint)) + hf.2.integrableOn).summable + refine hD.of_nonneg_of_le + (fun j ↦ mul_nonneg (by positivity) (heightLayerMass_nonneg f j)) ?_ + intro j + rw [heightLayerMass, ← integral_const_mul] + apply integral_mono_ae (hf.integrable.norm.integrableOn.const_mul _) hf.2.integrableOn + filter_upwards [ae_restrict_mem₀ (heightLayerSet_nullMeasurable hf j)] with x hx + have hlog : (2 : ℝ) ^ (j + 1) ≤ Real.log (2 + ‖f x‖) := by + calc + (2 : ℝ) ^ (j + 1) = Real.log (Real.exp ((2 : ℝ) ^ (j + 1))) := (Real.log_exp _).symm + _ ≤ Real.log (2 + ‖f x‖) := + Real.log_le_log (Real.exp_pos _) (hx.1.trans (by linarith)) + simpa only [mul_comm] using mul_le_mul_of_nonneg_right hlog (norm_nonneg (f x)) + + +theorem MemLLogL.summable_heightLayer_norm {f : Torus → ℂ} (hf : MemLLogL f) : + Summable (fun j ↦ ∫ x, ‖heightLayer f j x‖ ∂circleMeasure) := by + simp_rw [← heightLayerMass_eq_integral_norm hf] + apply hf.summable_weighted_heightLayerMass.of_nonneg_of_le + (heightLayerMass_nonneg f) + intro j + exact le_mul_of_one_le_left (heightLayerMass_nonneg f j) + (one_le_pow₀ (by norm_num : (1 : ℝ) ≤ 2)) + + + +theorem MemLLogL.summable_heightLayerCost {f : Torus → ℂ} (hf : MemLLogL f) : + Summable (fun j ↦ heightLayerMass f j * + ((2 : ℝ) ^ (j + 2) + max 0 (-Real.log (heightLayerMass f j)))) := by + have hw0 : Summable (fun j ↦ (2 : ℝ) ^ j * heightLayerMass f j) := by + apply (hf.summable_weighted_heightLayerMass.mul_left (1 / 2 : ℝ)).congr + intro j + simp only [pow_succ] + ring + apply ((hf.summable_weighted_heightLayerMass.mul_left 2).add + (summable_mass_logMinus (heightLayerMass_nonneg f) hw0)).congr + intro j + simp only [pow_succ] + ring + + +def boundedPart (f : Torus → ℂ) : Torus → ℂ := + {x | ‖f x‖ < Real.exp 2}.indicator f + +theorem MemLLogL.boundedPart_integrable {f : Torus → ℂ} (hf : MemLLogL f) : + Integrable (boundedPart f) circleMeasure := + hf.integrable.indicator₀ (nullMeasurableSet_lt hf.1.norm.aemeasurable aemeasurable_const) + +theorem norm_boundedPart_le (f : Torus → ℂ) (x : Torus) : + ‖boundedPart f x‖ ≤ Real.exp 2 := by + by_cases hx : ‖f x‖ < Real.exp 2 + · simpa [boundedPart, hx] using hx.le + · simp [boundedPart, hx, Real.exp_nonneg] + +theorem norm_heightLayer_le (f : Torus → ℂ) (j : ℕ) (x : Torus) : + ‖heightLayer f j x‖ ≤ Real.exp ((2 : ℝ) ^ (j + 2)) := by + by_cases hx : x ∈ heightLayerSet f j + · simpa only [heightLayer, Set.indicator_of_mem hx] using hx.2.le + · simp only [heightLayer, Set.indicator_of_notMem hx, norm_zero] + exact Real.exp_nonneg _ + + +theorem mem_boundedPart_or_heightLayerSet (f : Torus → ℂ) (x : Torus) : + ‖f x‖ < Real.exp 2 ∨ ∃ j : ℕ, x ∈ heightLayerSet f j := by + classical + by_cases hlo : ‖f x‖ < Real.exp 2 + · exact Or.inl hlo + right + have hex : ∃ n : ℕ, ‖f x‖ < Real.exp ((2 : ℝ) ^ (n + 1)) := by + obtain ⟨n, hn⟩ := exists_nat_gt ‖f x‖ + refine ⟨n, ?_⟩ + have hp : (n + 1 : ℝ) < (2 : ℝ) ^ (n + 1) := by + exact_mod_cast (Nat.lt_two_pow_self (n := n + 1)) + have he := Real.add_one_le_exp ((2 : ℝ) ^ (n + 1)) + linarith + have hn : 0 < Nat.find hex := by + by_contra hn + have hn0 : Nat.find hex = 0 := by omega + exact hlo (by simpa only [hn0, zero_add, pow_one] using Nat.find_spec hex) + refine ⟨Nat.find hex - 1, ?_, ?_⟩ + · exact le_of_not_gt (Nat.find_min hex (by omega : Nat.find hex - 1 < Nat.find hex)) + · have hidx : Nat.find hex - 1 + 2 = Nat.find hex + 1 := by omega + simpa only [hidx] using Nat.find_spec hex + + + +theorem boundedPart_add_tsum_heightLayer (f : Torus → ℂ) (x : Torus) : + boundedPart f x + ∑' j, heightLayer f j x = f x := by + classical + by_cases hlo : ‖f x‖ < Real.exp 2 + · have hz : ∀ j, heightLayer f j x = 0 := by + intro j + have hnot : x ∉ heightLayerSet f j := by + intro hx + have hp : (2 : ℝ) ≤ (2 : ℝ) ^ (j + 1) := by + simpa only [pow_one] using + (pow_right_strictMono₀ (by norm_num : (1 : ℝ) < 2)).monotone + (by omega : 1 ≤ j + 1) + exact (not_le_of_gt hlo) ((Real.exp_le_exp.mpr hp).trans hx.1) + exact Set.indicator_of_notMem hnot f + simp [boundedPart, hlo, hz] + · obtain ⟨j, hj⟩ := (mem_boundedPart_or_heightLayerSet f x).resolve_left hlo + have hs : (∑' k, heightLayer f k x) = heightLayer f j x := by + apply tsum_eq_single j + intro k hkj + have hk : x ∉ heightLayerSet f k := by + intro hk + exact Set.disjoint_left.mp (heightLayerSet_pairwise_disjoint f hkj) hk hj + exact Set.indicator_of_notMem hk f + rw [hs] + simp [boundedPart, hlo, heightLayer, hj] + + + +theorem MemLLogL.symmetricPartialSum_heightDecomposition {f : Torus → ℂ} + (hf : MemLLogL f) (N : ℕ) (x : Torus) : + symmetricPartialSum f N x = symmetricPartialSum (boundedPart f) N x + + ∑' j, symmetricPartialSum (heightLayer f j) N x := by + have htail : (fun y ↦ ∑' j, heightLayer f j y) = f - boundedPart f := by + funext y + have h := boundedPart_add_tsum_heightLayer f y + change (∑' j, heightLayer f j y) = f y - boundedPart f y + exact eq_sub_of_add_eq' h + have hint : Integrable (fun y ↦ ∑' j, heightLayer f j y) circleMeasure := by + rw [htail] + exact hf.integrable.sub hf.boundedPart_integrable + have hdecomp : f = boundedPart f + (fun y ↦ ∑' j, heightLayer f j y) := by + funext y + exact (boundedPart_add_tsum_heightLayer f y).symm + calc + symmetricPartialSum f N x = + symmetricPartialSum (boundedPart f + (fun y ↦ ∑' j, heightLayer f j y)) N x := + congrArg (fun g ↦ symmetricPartialSum g N x) hdecomp + _ = symmetricPartialSum (boundedPart f) N x + + symmetricPartialSum (fun y ↦ ∑' j, heightLayer f j y) N x := + symmetricPartialSum_add hf.boundedPart_integrable hint N x + _ = symmetricPartialSum (boundedPart f) N x + + ∑' j, symmetricPartialSum (heightLayer f j) N x := by + rw [symmetricPartialSum_tsum hf.heightLayer_integrable hf.summable_heightLayer_norm] + +end FourierLLogL + +end + +end OAI diff --git a/lean/OAI/Analysis/Fourier/SphereExtension.lean b/lean/OAI/Analysis/Fourier/SphereExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e8266534755174f1c6f1edbf8066d7e043ea500 --- /dev/null +++ b/lean/OAI/Analysis/Fourier/SphereExtension.lean @@ -0,0 +1,1096 @@ +import Mathlib + +namespace OAI + +/-! Fourier extension from the unit sphere in the fourth-power range. -/ + +noncomputable section +open MeasureTheory Set +open scoped ENNReal NNReal + +namespace EllipticCapacity + +abbrev Space := EuclideanSpace ℝ (Fin 3) +abbrev Sphere := {ω : Space // ω ∈ Metric.sphere (0 : Space) 1} + +def surfaceArea : Measure Sphere := (volume : Measure Space).toSphere + +def extension (g : Sphere → ℂ) (x : Space) : ℂ := + ∫ ω, g ω * Complex.exp + (2 * (Real.pi : ℂ) * Complex.I * (inner ℝ x (ω : Space) : ℂ)) ∂surfaceArea + +def SphereRestriction : Prop := + ∀ p : ℝ, 3 < p → ∃ C : ℝ≥0, ∀ g : Sphere → ℂ, + Measurable g → (∃ M : ℝ, ∀ ω, ‖g ω‖ ≤ M) → + eLpNorm (extension g) (ENNReal.ofReal p) volume ≤ + (C : ℝ≥0∞) * eLpNorm g ∞ surfaceArea + +theorem surfaceArea_univ : surfaceArea Set.univ = ENNReal.ofReal (4 * Real.pi) := by + unfold surfaceArea + rw [Measure.toSphere_apply_univ] + simp only [Space, finrank_euclideanSpace, Fintype.card_fin, + EuclideanSpace.volume_ball_fin_three, ENNReal.ofReal_one, one_pow, one_mul] + rw [← ENNReal.ofReal_natCast] + norm_num only [Nat.cast_ofNat] + rw [← ENNReal.ofReal_mul (by norm_num : (0 : ℝ) ≤ 3)] + congr 1 + ring + +theorem kernel_norm (x : Space) (ω : Sphere) : + ‖Complex.exp (2 * (Real.pi : ℂ) * Complex.I * + (inner ℝ x (ω : Space) : ℂ))‖ = 1 := by + rw [Complex.norm_exp] + simp + +instance surfaceArea_isFiniteMeasure : IsFiniteMeasure surfaceArea := by + constructor + rw [surfaceArea_univ] + exact ENNReal.ofReal_lt_top + +theorem extension_integrable {g : Sphere → ℂ} (hg : Measurable g) + {M : ℝ} (hM : ∀ ω, ‖g ω‖ ≤ M) (x : Space) : + Integrable (fun ω => g ω * Complex.exp + (2 * (Real.pi : ℂ) * Complex.I * (inner ℝ x (ω : Space) : ℂ))) surfaceArea := by + have hm : Measurable (fun ω : Sphere => g ω * Complex.exp + (2 * (Real.pi : ℂ) * Complex.I * (inner ℝ x (ω : Space) : ℂ))) := by fun_prop + apply Integrable.of_bound hm.aestronglyMeasurable M + filter_upwards [] with ω + simpa only [norm_mul, kernel_norm, mul_one] using hM ω + +theorem extension_norm_le {g : Sphere → ℂ} {M : ℝ} + (hM : ∀ ω, ‖g ω‖ ≤ M) (x : Space) : ‖extension g x‖ ≤ M * (4 * Real.pi) := by + unfold extension + have hmass : surfaceArea.real Set.univ = 4 * Real.pi := by + rw [Measure.real, surfaceArea_univ, ENNReal.toReal_ofReal] + positivity + rw [← hmass] + apply norm_integral_le_of_norm_le_const + filter_upwards [] with ω + simpa only [norm_mul, kernel_norm, mul_one] using hM ω + +theorem extension_continuous {g : Sphere → ℂ} (hg : Measurable g) + {M : ℝ} (hM : ∀ ω, ‖g ω‖ ≤ M) : Continuous (extension g) := by + apply continuous_of_dominated + (bound := fun _ : Sphere => M) + (fun x => (extension_integrable hg hM x).aestronglyMeasurable) + · intro x + filter_upwards [] with ω + simpa only [norm_mul, kernel_norm, mul_one] using hM ω + · exact integrable_const M + · filter_upwards [] with ω + fun_prop + +theorem norm_exp_mul_I_sub_le (a b : ℝ) : + ‖Complex.exp ((a : ℂ) * Complex.I) - + Complex.exp ((b : ℂ) * Complex.I)‖ ≤ |a - b| := by + have hd : ∀ x : ℝ, HasDerivAt + (fun y : ℝ => Complex.exp ((y : ℂ) * Complex.I)) + (Complex.exp ((x : ℂ) * Complex.I) * Complex.I) x := by + intro x + simpa using (((hasDerivAt_id (x : ℂ)).comp_ofReal).mul_const Complex.I).cexp + have hb : ∀ x : ℝ, ‖Complex.exp ((x : ℂ) * Complex.I) * Complex.I‖ ≤ 1 := by + intro x + simp [Complex.norm_exp] + simpa using Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun x (_ : x ∈ (Set.univ : Set ℝ)) => (hd x).hasDerivWithinAt) + (fun x _ => hb x) (convex_univ : Convex ℝ (Set.univ : Set ℝ)) + (Set.mem_univ b) (Set.mem_univ a) + +theorem kernel_norm_sub_le (x y : Space) (ω : Sphere) : + ‖Complex.exp (2 * (Real.pi : ℂ) * Complex.I * (inner ℝ x (ω : Space) : ℂ)) - + Complex.exp (2 * (Real.pi : ℂ) * Complex.I * (inner ℝ y (ω : Space) : ℂ))‖ ≤ + 2 * Real.pi * ‖x - y‖ := by + have h := norm_exp_mul_I_sub_le (2 * Real.pi * inner ℝ x (ω : Space)) + (2 * Real.pi * inner ℝ y (ω : Space)) + have hω : ‖(ω : Space)‖ = 1 := mem_sphere_zero_iff_norm.mp ω.property + have hi : |inner ℝ (x - y) (ω : Space)| ≤ ‖x - y‖ := by + simpa only [Real.norm_eq_abs, hω, mul_one] using norm_inner_le_norm (𝕜 := ℝ) (x - y) (ω : Space) + have he : ∀ a : ℝ, (2 * (Real.pi : ℂ) * Complex.I * (a : ℂ)) = + ((2 * Real.pi * a : ℝ) : ℂ) * Complex.I := by + intro a + push_cast + ring + simp only [he] at ⊢ + refine h.trans ?_ + rw [← mul_sub, abs_mul, abs_of_pos (mul_pos (by norm_num) Real.pi_pos), + ← inner_sub_left] + exact mul_le_mul_of_nonneg_left hi (by positivity) + +theorem extension_norm_sub_le {g : Sphere → ℂ} (hg : Measurable g) + {M : ℝ} (hM0 : 0 ≤ M) (hM : ∀ ω, ‖g ω‖ ≤ M) (x y : Space) : + ‖extension g x - extension g y‖ ≤ + (8 * Real.pi ^ 2 * M) * ‖x - y‖ := by + unfold extension + rw [← integral_sub (extension_integrable hg hM x) (extension_integrable hg hM y)] + have hmass : surfaceArea.real Set.univ = 4 * Real.pi := by + rw [Measure.real, surfaceArea_univ, ENNReal.toReal_ofReal] + positivity + have hbound := norm_integral_le_of_norm_le_const (μ := surfaceArea) + (C := M * (2 * Real.pi * ‖x - y‖)) (f := fun ω : Sphere => + g ω * Complex.exp (2 * (Real.pi : ℂ) * Complex.I * (inner ℝ x (ω : Space) : ℂ)) - + g ω * Complex.exp (2 * (Real.pi : ℂ) * Complex.I * (inner ℝ y (ω : Space) : ℂ))) + (by + filter_upwards [] with ω + rw [← mul_sub, norm_mul] + exact mul_le_mul (hM ω) (kernel_norm_sub_le x y ω) (norm_nonneg _) hM0) + rw [hmass] at hbound + convert hbound using 1 + ring + +open Filter + +def SphereFourthPower : Prop := + ∀ g : Sphere → ℂ, Measurable g → (∃ M : ℝ, ∀ ω, ‖g ω‖ ≤ M) → + (eLpNorm (extension g) 4 volume) ^ 4 ≤ + ENNReal.ofReal (32 * Real.pi ^ 3) * (eLpNorm g ∞ surfaceArea) ^ 4 + +def character (x v : Space) : ℂ := + Complex.exp (2 * (Real.pi : ℂ) * Complex.I * (inner ℝ x v : ℂ)) + +lemma character_norm (x v : Space) : ‖character x v‖ = 1 := by + simp [character, Complex.norm_exp] +lemma character_add (x v w : Space) : character x (v + w) = character x v * character x w := by + simp [character, inner_add_right, mul_add, Complex.exp_add] +lemma character_neg (x v : Space) : character x (-v) = star (character x v) := by + simp [character, inner_neg_right, ← Complex.exp_conj] + rw [show (starRingEnd ℂ) (2 : ℂ) = 2 by change star (2 : ℂ) = _; simp] + +abbrev Quad := (Sphere × Sphere) × (Sphere × Sphere) +def quadMeasure : Measure Quad := (surfaceArea.prod surfaceArea).prod (surfaceArea.prod surfaceArea) +instance : IsFiniteMeasure quadMeasure := inferInstanceAs (IsFiniteMeasure ((surfaceArea.prod surfaceArea).prod (surfaceArea.prod surfaceArea))) +def quadVector (q : Quad) : Space := (q.1.1 : Space) + q.1.2 - ((q.2.1 : Space) + q.2.2) +def quadAmplitude (g : Sphere → ℂ) (q : Quad) : ℂ := g q.1.1 * g q.1.2 * star (g q.2.1 * g q.2.2) + +lemma quad_character (x : Space) (q : Quad) : + character x (quadVector q) = character x q.1.1 * character x q.1.2 * + star (character x q.2.1 * character x q.2.2) := by + simp only [quadVector, sub_eq_add_neg, character_add, character_neg, star_mul] + +lemma fourth_power_expansion {g : Sphere → ℂ} (hg : Measurable g) + {M : ℝ} (hM : ∀ ω, ‖g ω‖ ≤ M) (x : Space) : + (‖extension g x‖ ^ 4 : ℝ) = (∫ q, quadAmplitude g q * character x (quadVector q) ∂quadMeasure : ℂ) := by + let f : Sphere → ℂ := fun ω => g ω * character x ω + have hf : Integrable f surfaceArea := extension_integrable hg hM x + have hc : (∫ q : Sphere × Sphere, star (f q.1 * f q.2) ∂surfaceArea.prod surfaceArea) = + star (extension g x ^ 2) := by + change (∫ q : Sphere × Sphere, (starRingEnd ℂ) (f q.1 * f q.2) ∂surfaceArea.prod surfaceArea) = _ + rw [integral_conj, integral_prod_mul] + simp only [pow_two] + rfl + have hp := integral_prod_mul (μ := surfaceArea.prod surfaceArea) (ν := surfaceArea.prod surfaceArea) + (fun q : Sphere × Sphere => f q.1 * f q.2) (fun q : Sphere × Sphere => star (f q.1 * f q.2)) + have hq : (∫ q, quadAmplitude g q * character x (quadVector q) ∂quadMeasure) = + extension g x ^ 2 * star (extension g x ^ 2) := by + calc + _ = ∫ q : Quad, f q.1.1 * f q.1.2 * star (f q.2.1 * f q.2.2) ∂quadMeasure := by + apply integral_congr_ae + filter_upwards [] with q + simp only [quadAmplitude, quad_character, f, star_mul] + ring + _ = _ := by + rw [quadMeasure, hp, hc, integral_prod_mul] + simp only [pow_two] + rfl + rw [hq] + change ((‖extension g x‖ ^ 4 : ℝ) : ℂ) = + extension g x ^ 2 * (starRingEnd ℂ) (extension g x ^ 2) + rw [RCLike.mul_conj] + change (↑(‖extension g x‖ ^ 4) : ℂ) = (↑(‖extension g x ^ 2‖) : ℂ) ^ 2 + rw [norm_pow, ← Complex.ofReal_pow, ← pow_mul] + +lemma quadAmplitude_bound {g : Sphere → ℂ} {M : ℝ} (hM0 : 0 ≤ M) + (hM : ∀ ω, ‖g ω‖ ≤ M) (q : Quad) : ‖quadAmplitude g q‖ ≤ M ^ 4 := by + unfold quadAmplitude + simp only [norm_mul, norm_star] + calc + _ ≤ (M * M) * (M * M) := by gcongr <;> apply hM + _ = _ := by ring + +def gaussian (b : ℝ) (x : Space) : ℝ := Real.exp (-b * ‖x‖ ^ 2) +def heatKernel (b : ℝ) (v : Space) : ℝ := + (Real.pi / b) ^ (3 / 2 : ℝ) * Real.exp (-Real.pi ^ 2 * ‖v‖ ^ 2 / b) + +lemma gaussian_pos (b : ℝ) (x : Space) : 0 < gaussian b x := Real.exp_pos _ +lemma heatKernel_nonneg {b : ℝ} (hb : 0 < b) (v : Space) : 0 ≤ heatKernel b v := by + unfold heatKernel + positivity + +lemma gaussian_integrable {b : ℝ} (hb : 0 < b) : Integrable (gaussian b) := by + have h := (GaussianFourier.integrable_cexp_neg_mul_sq_norm_add (V := Space) + (b := (b : ℂ)) (by simpa using hb) 0 0).norm + change Integrable (fun x : Space => Real.exp (-b * ‖x‖ ^ 2)) + simpa [Complex.norm_exp, neg_mul, ← Complex.ofReal_pow] using h + +lemma gaussian_character_integral {b : ℝ} (hb : 0 < b) (v : Space) : + (∫ x, (gaussian b x : ℂ) * character x v) = (heatKernel b v : ℂ) := by + have heq : (fun x : Space => (gaussian b x : ℂ) * character x v) = + (fun x : Space => Complex.exp (-(b : ℂ) * ‖x‖ ^ 2 + 2 * Real.pi * Complex.I * (inner ℝ v x : ℂ))) := by + ext x + rw [gaussian, character, Complex.ofReal_exp, ← Complex.exp_add, real_inner_comm x v] + push_cast + rfl + rw [heq, GaussianFourier.integral_cexp_neg_mul_sq_norm_add (by simpa using hb)] + simp only [Space, finrank_euclideanSpace, Fintype.card_fin] + unfold heatKernel + rw [Complex.ofReal_mul, Complex.ofReal_cpow (div_nonneg Real.pi_pos.le hb.le), Complex.ofReal_exp] + push_cast + congr 1 + congr 1 + rw [show (2 * (Real.pi : ℂ) * Complex.I) ^ 2 = -4 * (Real.pi : ℂ) ^ 2 by + ring_nf; simp [Complex.I_sq]] + ring + +lemma gaussian_quad_integrable {b M : ℝ} (hb : 0 < b) (hM0 : 0 ≤ M) + {g : Sphere → ℂ} (hg : Measurable g) (hM : ∀ ω, ‖g ω‖ ≤ M) : + Integrable (fun p : Space × Quad => (gaussian b p.1 : ℂ) * + (quadAmplitude g p.2 * character p.1 (quadVector p.2))) (volume.prod quadMeasure) := by + apply ((gaussian_integrable hb).mul_prod (integrable_const (M ^ 4) : Integrable (fun _ : Quad => M ^ 4) quadMeasure)).mono' + · unfold gaussian quadAmplitude character quadVector + fun_prop + · filter_upwards [] with p + simp only [norm_mul, character_norm, mul_one, Complex.norm_real, + Real.norm_eq_abs, abs_of_pos (gaussian_pos _ _)] + exact mul_le_mul_of_nonneg_left (quadAmplitude_bound hM0 hM _) (gaussian_pos _ _).le + +lemma gaussian_fourth_identity {b M : ℝ} (hb : 0 < b) (hM0 : 0 ≤ M) + {g : Sphere → ℂ} (hg : Measurable g) (hM : ∀ ω, ‖g ω‖ ≤ M) : + ((∫ x, gaussian b x * ‖extension g x‖ ^ 4 : ℝ) : ℂ) = + ∫ q, quadAmplitude g q * (heatKernel b (quadVector q) : ℂ) ∂quadMeasure := by + rw [← integral_complex_ofReal] + simp only [Complex.ofReal_mul] + simp_rw [fourth_power_expansion hg hM, ← integral_const_mul] + rw [integral_integral_swap (gaussian_quad_integrable hb hM0 hg hM)] + apply integral_congr_ae + filter_upwards [] with q + rw [show (fun x : Space => (gaussian b x : ℂ) * (quadAmplitude g q * character x (quadVector q))) = + (fun x : Space => quadAmplitude g q * ((gaussian b x : ℂ) * character x (quadVector q))) by + funext x; ring] + rw [integral_const_mul, gaussian_character_integral hb] + +lemma heatKernel_integrable {b : ℝ} (hb : 0 < b) : + Integrable (fun q : Quad => heatKernel b (quadVector q)) quadMeasure := by + apply Integrable.of_bound (C := (Real.pi / b) ^ (3 / 2 : ℝ)) + · unfold heatKernel quadVector + fun_prop + · filter_upwards [] with q + rw [Real.norm_eq_abs, abs_of_nonneg (heatKernel_nonneg hb _)] + unfold heatKernel + apply mul_le_of_le_one_right (Real.rpow_nonneg (by positivity) _) + apply Real.exp_le_one_iff.mpr + apply div_nonpos_of_nonpos_of_nonneg _ hb.le + exact mul_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr (sq_nonneg _)) (sq_nonneg _) + +lemma gaussian_fourth_integrable {b M : ℝ} (hb : 0 < b) (_hM0 : 0 ≤ M) + {g : Sphere → ℂ} (hg : Measurable g) (hM : ∀ ω, ‖g ω‖ ≤ M) : + Integrable (fun x => gaussian b x * ‖extension g x‖ ^ 4) := by + apply (gaussian_integrable hb).mul_bdd (c := (M * (4 * Real.pi)) ^ 4) + ((extension_continuous hg hM).norm.pow 4).aestronglyMeasurable + filter_upwards [] with x + simp only [Pi.pow_apply, Real.norm_eq_abs, abs_of_nonneg (pow_nonneg (norm_nonneg _) 4)] + exact pow_le_pow_left₀ (norm_nonneg _) (extension_norm_le hM x) 4 + +lemma gaussian_fourth_bound {b M : ℝ} (hb : 0 < b) (hM0 : 0 ≤ M) + {g : Sphere → ℂ} (hg : Measurable g) (hM : ∀ ω, ‖g ω‖ ≤ M) : + (∫ x, gaussian b x * ‖extension g x‖ ^ 4) ≤ + M ^ 4 * ∫ x, gaussian b x * ‖extension (fun _ => 1) x‖ ^ 4 := by + have hn (g : Sphere → ℂ) : 0 ≤ ∫ x, gaussian b x * ‖extension g x‖ ^ 4 := + integral_nonneg (fun x => mul_nonneg (gaussian_pos _ _).le (by positivity)) + have h1 := gaussian_fourth_identity (M := 1) hb (by norm_num) + (g := fun _ => 1) measurable_const (fun _ => by simp) + have h1' : (∫ x, gaussian b x * ‖extension (fun _ => 1) x‖ ^ 4) = + ∫ q, heatKernel b (quadVector q) ∂quadMeasure := by + have : ((∫ x, gaussian b x * ‖extension (fun _ => 1) x‖ ^ 4 : ℝ) : ℂ) = + ((∫ q, heatKernel b (quadVector q) ∂quadMeasure : ℝ) : ℂ) := by + simpa [quadAmplitude, integral_complex_ofReal] using h1 + exact_mod_cast this + rw [h1'] + have hi := gaussian_fourth_identity hb hM0 hg hM + calc + _ = ‖((∫ x, gaussian b x * ‖extension g x‖ ^ 4 : ℝ) : ℂ)‖ := by + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hn g)] + _ = ‖∫ q, quadAmplitude g q * (heatKernel b (quadVector q) : ℂ) ∂quadMeasure‖ := by rw [hi] + _ ≤ ∫ q, ‖quadAmplitude g q * (heatKernel b (quadVector q) : ℂ)‖ ∂quadMeasure := + norm_integral_le_integral_norm _ + _ ≤ ∫ q, M ^ 4 * heatKernel b (quadVector q) ∂quadMeasure := by + apply integral_mono_of_nonneg + · exact Eventually.of_forall (fun q => norm_nonneg _) + · exact (heatKernel_integrable hb).const_mul (M ^ 4) + · filter_upwards [] with q + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (heatKernel_nonneg hb _)] + exact mul_le_mul_of_nonneg_right (quadAmplitude_bound hM0 hM _) (heatKernel_nonneg hb _) + _ = _ := integral_const_mul _ _ + +lemma gaussian_le_one {b : ℝ} (hb : 0 ≤ b) (x : Space) : gaussian b x ≤ 1 := by + unfold gaussian + exact Real.exp_le_one_iff.mpr + (mul_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr hb) (sq_nonneg _)) + +lemma lintegral_gaussian_fourth_bound {b M : ℝ} (hb : 0 < b) (hM0 : 0 ≤ M) + {g : Sphere → ℂ} (hg : Measurable g) (hM : ∀ ω, ‖g ω‖ ≤ M) : + (∫⁻ x, ENNReal.ofReal (gaussian b x * ‖extension g x‖ ^ 4)) ≤ + ENNReal.ofReal (M ^ 4) * ∫⁻ x, ENNReal.ofReal (‖extension (fun _ => 1) x‖ ^ 4) := by + rw [← ofReal_integral_eq_lintegral_ofReal (gaussian_fourth_integrable hb hM0 hg hM) + (Filter.Eventually.of_forall (fun x => mul_nonneg (gaussian_pos b x).le (by positivity)))] + refine (ENNReal.ofReal_le_ofReal (gaussian_fourth_bound hb hM0 hg hM)).trans ?_ + rw [ENNReal.ofReal_mul (by positivity)] + gcongr + rw [ofReal_integral_eq_lintegral_ofReal + (gaussian_fourth_integrable (M := 1) hb (by norm_num) measurable_const (fun _ => by simp)) + (Filter.Eventually.of_forall (fun x => mul_nonneg (gaussian_pos b x).le (by positivity)))] + apply lintegral_mono + intro x + apply ENNReal.ofReal_le_ofReal + exact mul_le_of_le_one_left (by positivity) (gaussian_le_one hb.le x) + +lemma fourth_power_majorant {M : ℝ} (hM0 : 0 ≤ M) + {g : Sphere → ℂ} (hg : Measurable g) (hM : ∀ ω, ‖g ω‖ ≤ M) : + (∫⁻ x, ENNReal.ofReal (‖extension g x‖ ^ 4)) ≤ + ENNReal.ofReal (M ^ 4) * ∫⁻ x, ENNReal.ofReal (‖extension (fun _ => 1) x‖ ^ 4) := by + let F : ℕ → Space → ℝ≥0∞ := fun n x => + ENNReal.ofReal (gaussian ((1 / 2 : ℝ) ^ n) x * ‖extension g x‖ ^ 4) + have hm : ∀ n, Measurable (F n) := by + intro n + dsimp [F] + have hc := extension_continuous hg hM + unfold gaussian + fun_prop + have ht : ∀ x, Filter.Tendsto (fun n => F n x) Filter.atTop + (nhds (ENNReal.ofReal (‖extension g x‖ ^ 4))) := by + intro x + have hp := tendsto_pow_atTop_nhds_zero_of_lt_one (by norm_num : (0 : ℝ) ≤ 1 / 2) + (by norm_num : (1 / 2 : ℝ) < 1) + have he := Real.continuous_exp.continuousAt.tendsto.comp (hp.neg.mul_const (‖x‖ ^ 2)) + have h := ENNReal.continuous_ofReal.continuousAt.tendsto.comp (he.mul_const (‖extension g x‖ ^ 4)) + simpa [F, gaussian, Function.comp_def] using h + have hfat := lintegral_liminf_le (μ := (volume : Measure Space)) (u := Filter.atTop) hm + simp_rw [(ht _).liminf_eq] at hfat + apply hfat.trans + apply Filter.liminf_le_of_frequently_le + apply Filter.Eventually.frequently + apply Filter.Eventually.of_forall + intro n + exact lintegral_gaussian_fourth_bound (by positivity) hM0 hg hM + all_goals isBoundedDefault + +lemma integral_polar_three (f : Space → ℂ) (hf : Integrable f) : + ∫ y, f y = ∫ r in Set.Ioi (0 : ℝ), + r ^ 2 • ∫ ω : Sphere, f (r • (ω : Space)) ∂surfaceArea := by + let h := homeomorphUnitSphereProd Space + let μ := (volume : Measure Space) + let g : Sphere × Set.Ioi (0 : ℝ) → ℂ := fun p => f (p.2.val • (p.1 : Space)) + have heq : g ∘ h = f ∘ Subtype.val := by + funext y + dsimp [g] + rw [← homeomorphUnitSphereProd_symm_apply_coe Space] + simp [h] + have hc : Integrable (f ∘ Subtype.val) (μ.comap (Subtype.val : ({0}ᶜ : Set Space) → Space)) := + (integrableOn_iff_comap_subtypeVal (measurableSet_singleton (0 : Space)).compl).1 + hf.integrableOn + have hg : Integrable g (surfaceArea.prod (Measure.volumeIoiPow 2)) := by + have hm := μ.measurePreserving_homeomorphUnitSphereProd.integrable_comp_emb + (Homeomorph.measurableEmbedding h) (g := g) + rw [heq] at hm + simpa [Space, surfaceArea, μ] using hm.mp hc + calc + ∫ y, f y = ∫ y : ({0}ᶜ : Set Space), f y.val ∂μ.comap Subtype.val := by + rw [integral_subtype_comap (measurableSet_singleton (0 : Space)).compl, + restrict_compl_singleton] + _ = ∫ p, g p ∂surfaceArea.prod (Measure.volumeIoiPow 2) := by + have hi := μ.measurePreserving_homeomorphUnitSphereProd.integral_comp + (Homeomorph.measurableEmbedding h) g + change ∫ y, (g ∘ h) y ∂μ.comap Subtype.val = _ at hi + rw [heq] at hi + simpa [Space, surfaceArea, μ] using hi + _ = ∫ r : Set.Ioi (0 : ℝ), ∫ ω : Sphere, + f (r.val • (ω : Space)) ∂surfaceArea ∂Measure.volumeIoiPow 2 := + integral_prod_symm g hg + _ = ∫ r in Set.Ioi (0 : ℝ), + r ^ 2 • ∫ ω : Sphere, f (r • (ω : Space)) ∂surfaceArea := by + simp only [Measure.volumeIoiPow, ENNReal.ofReal] + rw [integral_withDensity_eq_integral_smul] + · rw [integral_subtype_comap measurableSet_Ioi (fun r : ℝ => + Real.toNNReal (r ^ 2) • ∫ ω : Sphere, f (r • (ω : Space)) ∂surfaceArea)] + apply setIntegral_congr_fun measurableSet_Ioi + intro r hr + dsimp only + rw [NNReal.smul_def, Real.coe_toNNReal _ (sq_nonneg r)] + · exact (measurable_subtype_coe.pow_const 2).real_toNNReal + +abbrev CrossPlane := EuclideanSpace ℝ (Fin 2) + +def sphereSplit : Space ≃ᵐ ℝ × CrossPlane := + (((MeasurableEquiv.toLp 2 (Fin 3 → ℝ)).symm.trans + (MeasurableEquiv.piFinSuccAbove (fun _ : Fin 3 => ℝ) 0)).trans + ((MeasurableEquiv.refl ℝ).prodCongr (MeasurableEquiv.toLp 2 (Fin 2 → ℝ)))) + +lemma sphereSplit_measurePreserving : MeasurePreserving sphereSplit := by + have h1 := EuclideanSpace.volume_preserving_symm_measurableEquiv_toLp (Fin 3) + have h2 := volume_preserving_piFinSuccAbove (fun _ : Fin 3 => ℝ) 0 + have h3 : MeasurePreserving + ((MeasurableEquiv.refl ℝ).prodCongr (MeasurableEquiv.toLp 2 (Fin 2 → ℝ))) := by + change MeasurePreserving (Prod.map id (WithLp.toLp 2)) _ _ + simpa only [Measure.volume_eq_prod] using + (MeasurePreserving.id (volume : Measure ℝ)).prod + (PiLp.volume_preserving_toLp (Fin 2)) + exact h3.comp (h2.comp h1) + +lemma sphereSplit_symm_apply (u : ℝ) (v : CrossPlane) : + sphereSplit.symm (u, v) = WithLp.toLp 2 (Fin.cons u (WithLp.ofLp v)) := by + ext i + fin_cases i <;> rfl + +lemma sphereSplit_norm_sq (u : ℝ) (v : CrossPlane) : + ‖sphereSplit.symm (u, v)‖ ^ 2 = u ^ 2 + ‖v‖ ^ 2 := by + rw [sphereSplit_symm_apply, EuclideanSpace.real_norm_sq_eq, + EuclideanSpace.real_norm_sq_eq] + simp [Fin.sum_univ_succ] + +def sphereKernel (x y : Space) : ℂ := + Complex.exp (2 * (Real.pi : ℂ) * Complex.I * (inner ℝ x y : ℂ)) + +def ballFourier (x : Space) (R : ℝ) : ℂ := + ∫ y in Metric.ball (0 : Space) R, sphereKernel x y + +lemma ballFourier_polar (x : Space) (R : ℝ) (hR : 0 ≤ R) : + ballFourier x R = ∫ r in (0 : ℝ)..R, + r ^ 2 • extension (fun _ => 1) (r • x) := by + have hcont : Continuous (sphereKernel x) := by unfold sphereKernel; fun_prop + have hint : Integrable ((Metric.ball (0 : Space) R).indicator (sphereKernel x)) := + (integrable_indicator_iff measurableSet_ball).2 + ((ContinuousOn.integrableOn_compact (isCompact_closedBall (0 : Space) R) + hcont.continuousOn).mono_set Metric.ball_subset_closedBall) + calc + ballFourier x R = ∫ y, (Metric.ball (0 : Space) R).indicator (sphereKernel x) y := by + rw [integral_indicator measurableSet_ball]; rfl + _ = ∫ r in Set.Ioi (0 : ℝ), r ^ 2 • ∫ ω : Sphere, + (Metric.ball (0 : Space) R).indicator (sphereKernel x) + (r • (ω : Space)) ∂surfaceArea := integral_polar_three _ hint + _ = ∫ r in Set.Ioi (0 : ℝ), (Set.Iio R).indicator + (fun r => r ^ 2 • extension (fun _ => 1) (r • x)) r := by + apply setIntegral_congr_fun measurableSet_Ioi + intro r hr + dsimp only + have hr0 : 0 < r := hr + have hn (ω : Sphere) : ‖r • (ω : Space)‖ = r := by + rw [norm_smul, Real.norm_of_nonneg hr0.le, + mem_sphere_zero_iff_norm.mp ω.property, mul_one] + by_cases hrR : r < R + · rw [Set.indicator_of_mem (show r ∈ Set.Iio R from hrR)] + congr 1 + unfold extension + apply integral_congr_ae + filter_upwards [] with ω + rw [Set.indicator_of_mem (show r • (ω : Space) ∈ Metric.ball (0 : Space) R by + simpa only [mem_ball_zero_iff, hn] using hrR)] + simp [sphereKernel, inner_smul_right, real_inner_smul_left] + · rw [Set.indicator_of_notMem (show r ∉ Set.Iio R from hrR)] + have he : ∀ ω : Sphere, + (Metric.ball (0 : Space) R).indicator (sphereKernel x) (r • (ω : Space)) = 0 := by + intro ω + apply Set.indicator_of_notMem + simpa only [mem_ball_zero_iff, hn] using hrR + simp only [he, integral_zero, smul_zero] + _ = ∫ r in (0 : ℝ)..R, r ^ 2 • extension (fun _ => 1) (r • x) := by + rw [setIntegral_indicator measurableSet_Iio, intervalIntegral.integral_of_le hR, + integral_Ioc_eq_integral_Ioo] + congr 1 + +lemma sphereSplit_symm_first (u : ℝ) (v : CrossPlane) : + (sphereSplit.symm (u, v)) 0 = u := by + rw [sphereSplit_symm_apply] + rfl + +lemma sphereSplit_ball_slice (R : ℝ) (hR : 0 ≤ R) (u : ℝ) : + {v : CrossPlane | sphereSplit.symm (u, v) ∈ Metric.ball (0 : Space) R} = + Metric.ball (0 : CrossPlane) (Real.sqrt (R ^ 2 - u ^ 2)) := by + ext v + simp only [Set.mem_ofPred_eq, mem_ball_zero_iff, Real.lt_sqrt (norm_nonneg v)] + have hn := sphereSplit_norm_sq u v + constructor <;> intro hv + · nlinarith [norm_nonneg (sphereSplit.symm (u, v))] + · nlinarith [norm_nonneg (sphereSplit.symm (u, v))] + +lemma plane_slice_volume (R u : ℝ) (hR : 0 ≤ R) : + (volume : Measure CrossPlane).real + (Metric.ball 0 (Real.sqrt (R ^ 2 - u ^ 2))) = + (Set.Ioo (-R) R).indicator (fun u => Real.pi * (R ^ 2 - u ^ 2)) u := by + rw [Measure.real, EuclideanSpace.volume_ball_fin_two, ENNReal.toReal_mul, + ENNReal.toReal_pow, ENNReal.toReal_ofReal (Real.sqrt_nonneg _), + ENNReal.toReal_ofReal Real.pi_pos.le] + by_cases hu : u ∈ Set.Ioo (-R) R + · rw [Set.indicator_of_mem hu, Real.sq_sqrt] + · ring + · have := hu.1 + have := hu.2 + nlinarith + · rw [Set.indicator_of_notMem hu, Real.sqrt_eq_zero_of_nonpos] + · ring + · simp only [mem_Ioo, not_and_or, not_lt] at hu + rcases hu with h | h <;> nlinarith + +lemma integral_ball_head (f : ℝ → ℂ) (hf : Continuous f) (R : ℝ) (hR : 0 ≤ R) : + ∫ y in Metric.ball (0 : Space) R, f (y 0) = + ∫ u in (-R)..R, (Real.pi * (R ^ 2 - u ^ 2)) • f u := by + let g : Space → ℂ := (Metric.ball (0 : Space) R).indicator (fun y => f (y 0)) + have hc : Continuous (fun y : Space => f (y 0)) := by fun_prop + have hg : Integrable g := (integrable_indicator_iff measurableSet_ball).2 + ((ContinuousOn.integrableOn_compact (isCompact_closedBall (0 : Space) R) + hc.continuousOn).mono_set Metric.ball_subset_closedBall) + have hg' : Integrable (g ∘ sphereSplit.symm) + ((volume : Measure ℝ).prod (volume : Measure CrossPlane)) := by + have h := (sphereSplit_measurePreserving.symm.integrable_comp_emb + sphereSplit.symm.measurableEmbedding).2 hg + simpa only [Measure.volume_eq_prod] using h + have hinner (u : ℝ) : ∫ v : CrossPlane, g (sphereSplit.symm (u, v)) = + (Set.Ioo (-R) R).indicator (fun u => Real.pi * (R ^ 2 - u ^ 2)) u • f u := by + have he : (fun v : CrossPlane => g (sphereSplit.symm (u, v))) = + (Metric.ball (0 : CrossPlane) (Real.sqrt (R ^ 2 - u ^ 2))).indicator + (fun _ => f u) := by + funext v + have ht : sphereSplit.symm (u, v) ∈ Metric.ball (0 : Space) R ↔ + v ∈ Metric.ball (0 : CrossPlane) (Real.sqrt (R ^ 2 - u ^ 2)) := by + change v ∈ {v : CrossPlane | sphereSplit.symm (u, v) ∈ Metric.ball (0 : Space) R} ↔ _ + rw [sphereSplit_ball_slice R hR u] + by_cases hv : v ∈ Metric.ball (0 : CrossPlane) (Real.sqrt (R ^ 2 - u ^ 2)) + · rw [Set.indicator_of_mem hv] + change (Metric.ball (0 : Space) R).indicator (fun y => f (y 0)) + (sphereSplit.symm (u, v)) = _ + rw [Set.indicator_of_mem (ht.mpr hv), sphereSplit_symm_first] + · rw [Set.indicator_of_notMem hv] + exact Set.indicator_of_notMem (fun h => hv (ht.mp h)) _ + rw [he, integral_indicator measurableSet_ball, setIntegral_const, + plane_slice_volume R u hR] + calc + ∫ y in Metric.ball (0 : Space) R, f (y 0) = ∫ y, g y := + (integral_indicator measurableSet_ball).symm + _ = ∫ p : ℝ × CrossPlane, g (sphereSplit.symm p) := + (sphereSplit_measurePreserving.symm.integral_comp' g).symm + _ = ∫ u : ℝ, ∫ v : CrossPlane, g (sphereSplit.symm (u, v)) := by + rw [Measure.volume_eq_prod] + exact integral_prod _ hg' + _ = ∫ u : ℝ, (Set.Ioo (-R) R).indicator + (fun u => (Real.pi * (R ^ 2 - u ^ 2)) • f u) u := by + apply integral_congr_ae + filter_upwards [] with u + rw [hinner] + by_cases hu : u ∈ Set.Ioo (-R) R <;> simp [Set.indicator, hu] + _ = ∫ u in (-R)..R, (Real.pi * (R ^ 2 - u ^ 2)) • f u := by + rw [integral_indicator measurableSet_Ioo, intervalIntegral.integral_of_le (by linarith), + integral_Ioc_eq_integral_Ioo] + +lemma hasDerivAt_symmetric_integral (f : ℝ → ℂ) (hf : Continuous f) (R : ℝ) : + HasDerivAt (fun r => ∫ u in (-r)..r, f u) (f R + f (-R)) R := by + have hD (r : ℝ) : HasDerivAt (fun r => ∫ u in (0 : ℝ)..r, f u) (f r) r := + intervalIntegral.integral_hasDerivAt_right (hf.intervalIntegrable _ _) + hf.aestronglyMeasurable.stronglyMeasurableAtFilter hf.continuousAt + have he (r : ℝ) : ∫ u in (-r)..r, f u = + (∫ u in (0 : ℝ)..r, f u) - ∫ u in (0 : ℝ)..(-r), f u := by + have h := intervalIntegral.integral_add_adjacent_intervals + (hf.intervalIntegrable (μ := volume) 0 (-r)) (hf.intervalIntegrable (-r) r) + exact eq_sub_iff_add_eq.mpr (by simpa only [add_comm] using h) + simp_rw [he] + simpa only [Pi.sub_def, Function.comp_def, id_eq, neg_one_smul, sub_neg_eq_add] + using (hD R).sub ((hD (-R)).scomp R (hasDerivAt_id R).neg) + +lemma hasDerivAt_weighted_slice (f : ℝ → ℂ) (hf : Continuous f) (R : ℝ) : + HasDerivAt (fun r => ∫ u in (-r)..r, (Real.pi * (r ^ 2 - u ^ 2)) • f u) + ((2 * Real.pi * R) • ∫ u in (-R)..R, f u) R := by + have hcont : Continuous (fun u : ℝ => u ^ 2 • f u) := by fun_prop + have he (r : ℝ) : (∫ u in (-r)..r, (Real.pi * (r ^ 2 - u ^ 2)) • f u) = + Real.pi • (r ^ 2 • (∫ u in (-r)..r, f u) - + ∫ u in (-r)..r, u ^ 2 • f u) := by + simp_rw [mul_smul, sub_smul] + rw [intervalIntegral.integral_smul, intervalIntegral.integral_sub] + · rw [intervalIntegral.integral_smul] + · exact (hf.intervalIntegrable _ _).smul _ + · exact hcont.intervalIntegrable _ _ + simp_rw [he] + convert! ((((hasDerivAt_id R).pow 2).smul (hasDerivAt_symmetric_integral f hf R)).sub + (hasDerivAt_symmetric_integral _ hcont R)).const_smul Real.pi using 1 + simp only [Pi.pow_apply, id_eq, Nat.cast_ofNat, Nat.reduceSub, pow_one, mul_one, neg_sq, + smul_add] + module + +lemma ballFourier_hasDerivAt_one (x : Space) : + HasDerivAt (ballFourier x) (extension (fun _ => 1) x) 1 := by + have hec : Continuous (extension (fun _ => (1 : ℂ))) := + extension_continuous measurable_const (M := 1) (by simp) + have hc : Continuous (fun r : ℝ => r ^ 2 • extension (fun _ => 1) (r • x)) := by + fun_prop + have hd := intervalIntegral.integral_hasDerivAt_right + (hc.intervalIntegrable (0 : ℝ) 1) + hc.aestronglyMeasurable.stronglyMeasurableAtFilter hc.continuousAt + have he : ballFourier x =ᶠ[nhds (1 : ℝ)] + (fun R => ∫ r in (0 : ℝ)..R, r ^ 2 • extension (fun _ => 1) (r • x)) := by + filter_upwards [eventually_gt_nhds (show (0 : ℝ) < 1 by norm_num)] with R hR + exact ballFourier_polar x R hR.le + simpa using hd.congr_of_eventuallyEq he + +lemma ballFourier_isometry (e : Space ≃ₗᵢ[ℝ] Space) (x : Space) (R : ℝ) : + ballFourier (e x) R = ballFourier x R := by + let g : Space → ℂ := (Metric.ball (0 : Space) R).indicator (sphereKernel (e x)) + have he : (fun y => g (e y)) = + (Metric.ball (0 : Space) R).indicator (sphereKernel x) := by + funext y + dsimp [g] + by_cases hy : y ∈ Metric.ball (0 : Space) R + · have hey : e y ∈ Metric.ball (0 : Space) R := by + simpa only [mem_ball_zero_iff, e.norm_map] using hy + rw [Set.indicator_of_mem hey, Set.indicator_of_mem hy] + simp only [sphereKernel, e.inner_map_map] + · have hey : e y ∉ Metric.ball (0 : Space) R := by + simpa only [mem_ball_zero_iff, e.norm_map] using hy + rw [Set.indicator_of_notMem hey, Set.indicator_of_notMem hy] + have hm := e.measurePreserving.integral_comp e.toHomeomorph.measurableEmbedding g + rw [he, integral_indicator measurableSet_ball] at hm + dsimp only [g] at hm + rw [integral_indicator measurableSet_ball] at hm + exact hm.symm + +lemma extension_one_isometry (e : Space ≃ₗᵢ[ℝ] Space) (x : Space) : + extension (fun _ => 1) (e x) = extension (fun _ => 1) x := by + have he : ballFourier (e x) = ballFourier x := funext (ballFourier_isometry e x) + have h := ballFourier_hasDerivAt_one (e x) + rw [he] at h + exact h.unique (ballFourier_hasDerivAt_one x) + +def spaceAxis (t : ℝ) : Space := PiLp.single 2 0 t + +lemma spaceAxis_norm (t : ℝ) : ‖spaceAxis t‖ = |t| := by + simp [spaceAxis, PiLp.norm_single, Real.norm_eq_abs] + +lemma spaceAxis_inner (t : ℝ) (y : Space) : inner ℝ (spaceAxis t) y = t * y 0 := by + simp [spaceAxis, EuclideanSpace.inner_single_left] + +lemma extension_one_axis (t : ℝ) : + extension (fun _ => 1) (spaceAxis t) = + (2 * Real.pi) • ∫ u in (-1 : ℝ)..1, + Complex.exp (((2 * Real.pi * t * u : ℝ) : ℂ) * Complex.I) := by + let f : ℝ → ℂ := fun u => + Complex.exp (((2 * Real.pi * t * u : ℝ) : ℂ) * Complex.I) + have hf : Continuous f := by fun_prop + have he (R : ℝ) (hR : 0 ≤ R) : ballFourier (spaceAxis t) R = + ∫ u in (-R)..R, (Real.pi * (R ^ 2 - u ^ 2)) • f u := by + rw [ballFourier] + have hk : sphereKernel (spaceAxis t) = fun y => f (y 0) := by + funext y + dsimp only [sphereKernel, f] + rw [spaceAxis_inner] + congr 1 + push_cast + ring + rw [hk, integral_ball_head f hf R hR] + have hEq : ballFourier (spaceAxis t) =ᶠ[nhds (1 : ℝ)] + (fun R => ∫ u in (-R)..R, (Real.pi * (R ^ 2 - u ^ 2)) • f u) := by + filter_upwards [eventually_gt_nhds (show (0 : ℝ) < 1 by norm_num)] with R hR + exact he R hR.le + have hD := (hasDerivAt_weighted_slice f hf 1).congr_of_eventuallyEq hEq + simpa only [mul_one] using (ballFourier_hasDerivAt_one (spaceAxis t)).unique hD + +lemma extension_one_axis_formula (t : ℝ) (ht : t ≠ 0) : + extension (fun _ => 1) (spaceAxis t) = + ((2 * Real.sin (2 * Real.pi * t) / t : ℝ) : ℂ) := by + rw [extension_one_axis] + have hc : 2 * Real.pi * t ≠ 0 := mul_ne_zero (mul_ne_zero (by norm_num) Real.pi_ne_zero) ht + have he := intervalIntegral.integral_comp_mul_left + (fun u : ℝ => Complex.exp ((u : ℂ) * Complex.I)) + (a := -1) (b := 1) hc + simp only [mul_neg_one, mul_one] at he + rw [he, integral_exp_mul_I_eq_sin] + simp only [Complex.real_smul, Complex.ofReal_mul, Complex.ofReal_ofNat, + Complex.ofReal_inv, Complex.ofReal_div] + field_simp + +theorem extension_one_formula (x : Space) (hx : x ≠ 0) : + extension (fun _ => 1) x = + ((2 * Real.sin (2 * Real.pi * ‖x‖) / ‖x‖ : ℝ) : ℂ) := by + have hn : ‖x‖ = ‖spaceAxis ‖x‖‖ := by + rw [spaceAxis_norm, abs_of_nonneg (norm_nonneg x)] + let e : Space ≃ₗᵢ[ℝ] Space := (ℝ ∙ (x - spaceAxis ‖x‖))ᗮ.reflection + have he : e x = spaceAxis ‖x‖ := Submodule.reflection_sub hn + have hi := extension_one_isometry e x + rw [he] at hi + rw [← hi] + exact extension_one_axis_formula _ (norm_ne_zero_iff.mpr hx) + +open FourierTransform Convolution + +def box : ℝ → ℂ := (Icc (-1 : ℝ) 1).indicator (fun _ => 1) + +lemma box_measurable : Measurable box := measurable_const.indicator measurableSet_Icc + +lemma box_bound (x : ℝ) : ‖box x‖ ≤ 1 := by + by_cases h : x ∈ Icc (-1 : ℝ) 1 <;> simp [box, h] + +lemma box_integrable : Integrable box := by + apply (integrable_indicator_iff measurableSet_Icc).2 + exact integrableOn_const (C := (1 : ℂ)) (ne_of_lt (measure_Icc_lt_top : volume (Icc (-1 : ℝ) 1) < ∞)) + +lemma box_integral : ∫ x, box x = (2 : ℂ) := by + rw [box, integral_indicator measurableSet_Icc, integral_const] + simp + norm_num + +lemma box_neg (x : ℝ) : box (-x) = box x := by + have h : -x ∈ Icc (-1 : ℝ) 1 ↔ x ∈ Icc (-1 : ℝ) 1 := by + simp only [mem_Icc] + constructor <;> intro h <;> constructor <;> linarith [h.1, h.2] + simp only [box, indicator, h] + +lemma box_mul_self (x : ℝ) : box x * box x = box x := by + by_cases h : x ∈ Icc (-1 : ℝ) 1 <;> simp [box, h] + +lemma box_fourier {r : ℝ} (hr : r ≠ 0) : + 𝓕 box r = (Real.sin (2 * Real.pi * r) / (Real.pi * r) : ℝ) := by + rw [Real.fourier_real_eq_integral_exp_smul] + simp only [smul_eq_mul, box] + simp_rw [← indicator_mul_right (Icc (-1 : ℝ) 1) + (fun v : ℝ => Complex.exp (↑(-2 * Real.pi * v * r) * Complex.I)) (fun _ => 1)] + rw [integral_indicator measurableSet_Icc, integral_Icc_eq_integral_Ioc, + ← intervalIntegral.integral_of_le (by norm_num : (-1 : ℝ) ≤ 1)] + simp only [mul_one] + have he : (fun t : ℝ => Complex.exp ((↑(-2 * Real.pi * t * r) : ℂ) * Complex.I)) = + (fun t : ℝ => Complex.exp ((-2 * Real.pi * r * Complex.I : ℂ) * t)) := by + ext t + congr 1 + push_cast + ring + rw [he, integral_exp_mul_complex (by simp [hr, Real.pi_ne_zero])] + simp only [Complex.ofReal_one, Complex.ofReal_neg, mul_one, mul_neg] + rw [show (-2 * (Real.pi : ℂ) * r * Complex.I) = + (-(2 * Real.pi * r : ℝ) : ℂ) * Complex.I by push_cast; ring] + simp only [neg_mul, neg_neg] + rw [← neg_mul] + simp only [Complex.exp_mul_I, Complex.cos_neg, Complex.sin_neg] + push_cast + field_simp + ring + +lemma box_fourier_continuous : Continuous (𝓕 box) := + VectorFourier.fourierIntegral_continuous Real.continuous_fourierChar + (by change Continuous (fun p : ℝ × ℝ => inner ℝ p.1 p.2); fun_prop) box_integrable + +lemma box_norm_integral : ∫ x, ‖box x‖ = (2 : ℝ) := by + simp only [box, norm_indicator_eq_indicator_norm, norm_one] + rw [integral_indicator measurableSet_Icc, integral_const] + norm_num + +lemma box_fourier_bound (r : ℝ) : ‖𝓕 box r‖ ≤ 2 := by + exact (VectorFourier.norm_fourierIntegral_le_integral_norm + Real.fourierChar volume (innerₗ ℝ) box r).trans_eq box_norm_integral + +lemma box_fourier_decay {r : ℝ} (hr : 1 ≤ |r|) : ‖𝓕 box r‖ ≤ 1 / |r| := by + have hr0 : 0 < |r| := by linarith + rw [box_fourier (abs_pos.mp hr0), Complex.norm_real, Real.norm_eq_abs, + abs_div, abs_mul, abs_of_pos Real.pi_pos] + apply (div_le_div_of_nonneg_right (Real.abs_sin_le_one _) (by positivity)).trans + apply one_div_le_one_div_of_le hr0 + nlinarith [Real.pi_gt_three] + +lemma box_fourier_sq_integrable : Integrable (fun r => (𝓕 box r) ^ 2) := by + apply (integrable_inv_one_add_sq.const_mul 8).mono' + (box_fourier_continuous.pow 2).aestronglyMeasurable + filter_upwards [] with r + change ‖𝓕 box r ^ 2‖ ≤ 8 * (1 + r ^ 2)⁻¹ + rw [norm_pow] + have hd : 0 < 1 + r ^ 2 := by positivity + rw [← div_eq_mul_inv, le_div_iff₀ hd] + by_cases hr : |r| ≤ 1 + · have hn := box_fourier_bound r + have hsq : r ^ 2 ≤ 1 := by nlinarith [sq_abs r, abs_nonneg r] + nlinarith [sq_nonneg ‖𝓕 box r‖, norm_nonneg (𝓕 box r)] + · have hr' : 1 ≤ |r| := le_of_not_ge hr + have hb := box_fourier_decay hr' + have hr0 : 0 < |r| := lt_of_lt_of_le zero_lt_one hr' + have hsq : 1 ≤ r ^ 2 := by nlinarith [sq_abs r] + have hb' : ‖𝓕 box r‖ * |r| ≤ 1 := (le_div_iff₀ hr0).mp hb + have hs : ‖𝓕 box r‖ ^ 2 * r ^ 2 ≤ 1 := by + nlinarith [sq_nonneg (‖𝓕 box r‖ * |r|), sq_abs r, + mul_self_le_mul_self (mul_nonneg (norm_nonneg _) (abs_nonneg r)) hb'] + have hn : ‖𝓕 box r‖ ^ 2 ≤ 1 := by nlinarith [sq_nonneg ‖𝓕 box r‖] + nlinarith + +noncomputable def tent : ℝ → ℂ := box ⋆[ContinuousLinearMap.mul ℂ ℂ] box + +lemma tent_integrable : Integrable tent := + box_integrable.integrable_convolution (ContinuousLinearMap.mul ℂ ℂ) box_integrable + +lemma tent_fourier (r : ℝ) : 𝓕 tent r = (𝓕 box r) ^ 2 := by + rw [tent, Real.fourier_mul_convolution_eq box_integrable box_integrable, pow_two] + +lemma tent_fourier_integrable : Integrable (𝓕 tent) := by + have he : 𝓕 tent = fun r => (𝓕 box r) ^ 2 := funext tent_fourier + rw [he] + exact box_fourier_sq_integrable + +lemma tent_zero : tent 0 = 2 := by + change (∫ t, box t * box (0 - t)) = 2 + simpa only [zero_sub, box_neg, box_mul_self] using box_integral + +lemma tent_continuousAt_zero : ContinuousAt tent 0 := by + change ContinuousAt (fun x => ∫ t, box t * box (x - t)) 0 + apply continuousAt_of_dominated (bound := fun t => ‖box t‖) + · exact Eventually.of_forall (fun x => + (box_measurable.mul (box_measurable.comp (measurable_const.sub measurable_id))).aestronglyMeasurable) + · apply Eventually.of_forall + intro x + filter_upwards [] with t + rw [norm_mul] + exact mul_le_of_le_one_right (norm_nonneg _) (box_bound _) + · exact box_integrable.norm + · filter_upwards [(volume : Measure ℝ).ae_ne (-1), (volume : Measure ℝ).ae_ne 1] with t ht1 ht2 + have hct : ContinuousAt box (-t) := by + apply continuous_const.continuousOn.continuousAt_indicator + rw [frontier_Icc (by norm_num : (-1 : ℝ) ≤ 1)] + simp only [mem_insert_iff, mem_singleton_iff, not_or] + constructor + · intro h; apply ht2; linarith + · intro h; apply ht1; linarith + have hc : ContinuousAt box (0 - t) := by simpa using hct + have hg : ContinuousAt (fun x : ℝ => box (x - t)) 0 := + hc.comp (f := fun x : ℝ => x - t) (continuous_id.sub continuous_const).continuousAt + exact continuousAt_const.mul hg + +lemma integral_box_fourier_sq : ∫ r, (𝓕 box r) ^ 2 = (2 : ℂ) := by + have h := tent_integrable.fourierInv_fourier_eq tent_fourier_integrable tent_continuousAt_zero + simpa [Real.fourierInv_eq, tent_fourier, tent_zero] using h + +def sineSq (r : ℝ) : ℝ := Real.sin (2 * Real.pi * r) ^ 2 / r ^ 2 + +def sineFourth (r : ℝ) : ℝ := Real.sin (2 * Real.pi * r) ^ 4 / r ^ 2 + +lemma sineSq_fourier_ae : (fun r => (sineSq r : ℂ)) =ᵐ[volume] + (fun r => (Real.pi : ℂ) ^ 2 * (𝓕 box r) ^ 2) := by + filter_upwards [(volume : Measure ℝ).ae_ne 0] with r hr + rw [box_fourier hr] + simp only [sineSq] + push_cast + field_simp + +lemma sineSq_integrable : Integrable sineSq := by + have h : Integrable (fun r => (sineSq r : ℂ)) := + (box_fourier_sq_integrable.const_mul ((Real.pi : ℂ) ^ 2)).congr sineSq_fourier_ae.symm + simpa using h.re + +lemma sineSq_integral : ∫ r, sineSq r = 2 * Real.pi ^ 2 := by + have h : ((∫ r, sineSq r : ℝ) : ℂ) = (2 * Real.pi ^ 2 : ℝ) := by + rw [← integral_complex_ofReal, integral_congr_ae sineSq_fourier_ae, + integral_const_mul, integral_box_fourier_sq] + push_cast + ring + exact_mod_cast h + +lemma sineFourth_identity (r : ℝ) : sineFourth r = sineSq r - sineSq (2 * r) := by + by_cases hr : r = 0 + · simp [hr, sineFourth, sineSq] + unfold sineFourth sineSq + rw [show 2 * Real.pi * (2 * r) = 2 * (2 * Real.pi * r) by ring, + Real.sin_two_mul] + field_simp + nlinarith [Real.sin_sq_add_cos_sq (2 * Real.pi * r)] + +lemma sineFourth_integrable : Integrable sineFourth := by + apply (sineSq_integrable.sub + ((integrable_comp_mul_left_iff sineSq (by norm_num : (2 : ℝ) ≠ 0)).2 + sineSq_integrable)).congr + exact Eventually.of_forall (fun r => (sineFourth_identity r).symm) + +lemma sineFourth_integral : ∫ r, sineFourth r = Real.pi ^ 2 := by + simp_rw [sineFourth_identity] + rw [integral_sub sineSq_integrable + ((integrable_comp_mul_left_iff sineSq (by norm_num : (2 : ℝ) ≠ 0)).2 sineSq_integrable), + Measure.integral_comp_mul_left, sineSq_integral] + norm_num + ring + +lemma sineFourth_abs (r : ℝ) : sineFourth |r| = sineFourth r := by + rcases le_total 0 r with hr | hr + · rw [abs_of_nonneg hr] + · simp only [abs_of_nonpos hr, sineFourth, mul_neg, Real.sin_neg] + ring + +lemma sineFourth_integral_Ioi : ∫ r in Ioi (0 : ℝ), sineFourth r = Real.pi ^ 2 / 2 := by + have h := integral_comp_abs (f := sineFourth) + simp only [sineFourth_abs, sineFourth_integral] at h + linarith + +lemma fourth_radial_density {r : ℝ} (hr : r ≠ 0) : + r ^ 2 * (2 * Real.sin (2 * Real.pi * r) / r) ^ 4 = 16 * sineFourth r := by + unfold sineFourth + field_simp + ring + +lemma extension_one_fourth_ae : + (fun x : Space => ‖extension (fun _ => 1) x‖ ^ 4) =ᵐ[volume] + (fun x : Space => (2 * Real.sin (2 * Real.pi * ‖x‖) / ‖x‖) ^ 4) := by + filter_upwards [(volume : Measure Space).ae_ne 0] with x hx + rw [extension_one_formula x hx, Complex.norm_real, Real.norm_eq_abs] + rw [← abs_pow, abs_of_nonneg (by positivity)] + +lemma extension_one_fourth_integrable : + Integrable (fun x : Space => ‖extension (fun _ => 1) x‖ ^ 4) := by + have hp : IntegrableOn (fun r : ℝ => r ^ 2 * (2 * Real.sin (2 * Real.pi * r) / r) ^ 4) + (Ioi 0) := by + apply (sineFourth_integrable.const_mul 16).integrableOn.congr + filter_upwards [ae_restrict_mem measurableSet_Ioi] with r hr + exact (fourth_radial_density (ne_of_gt hr)).symm + have hi := (integrable_fun_norm_addHaar (volume : Measure Space) + (f := fun r : ℝ => (2 * Real.sin (2 * Real.pi * r) / r) ^ 4)).2 + (by simpa only [Space, finrank_euclideanSpace, Fintype.card_fin, Nat.reduceSub, + smul_eq_mul] using hp) + exact hi.congr extension_one_fourth_ae.symm + +lemma extension_one_fourth_integral : + ∫ x : Space, ‖extension (fun _ => 1) x‖ ^ 4 = 32 * Real.pi ^ 3 := by + rw [integral_congr_ae extension_one_fourth_ae, + integral_fun_norm_addHaar (volume : Measure Space) + (fun r : ℝ => (2 * Real.sin (2 * Real.pi * r) / r) ^ 4)] + simp only [Space, finrank_euclideanSpace, Fintype.card_fin, Nat.reduceSub, + smul_eq_mul, nsmul_eq_mul, Nat.cast_ofNat] + rw [setIntegral_congr_fun measurableSet_Ioi (fun r hr => fourth_radial_density (ne_of_gt hr)), + integral_const_mul, sineFourth_integral_Ioi] + rw [Measure.real, EuclideanSpace.volume_ball_fin_three] + norm_num + rw [ENNReal.toReal_ofReal (by positivity)] + ring + +lemma extension_one_fourth_lintegral : + (∫⁻ x : Space, ENNReal.ofReal (‖extension (fun _ => 1) x‖ ^ 4)) = + ENNReal.ofReal (32 * Real.pi ^ 3) := by + rw [← ofReal_integral_eq_lintegral_ofReal extension_one_fourth_integrable + (Eventually.of_forall (fun x => by positivity)), extension_one_fourth_integral] + +lemma extension_congr_ae {g h : Sphere → ℂ} (he : g =ᵐ[surfaceArea] h) : + extension g = extension h := by + funext x + apply integral_congr_ae + filter_upwards [he] with ω hω + rw [hω] + +lemma eLpNorm_fourth_power (f : Space → ℂ) (hf : AEStronglyMeasurable f volume) : + (eLpNorm f 4 volume) ^ 4 = ∫⁻ x, ENNReal.ofReal (‖f x‖ ^ 4) := by + have h := eLpNorm_nnreal_pow_eq_lintegral (μ := (volume : Measure Space)) + (f := f) (p := (4 : ℝ≥0)) (by norm_num) hf + have hn (x : ℝ≥0∞) : x ^ (4 : ℝ) = x ^ (4 : ℕ) := by exact ENNReal.rpow_natCast x 4 + norm_num only [NNReal.coe_ofNat, ENNReal.coe_ofNat] at h + simp only [hn] at h + rw [h] + apply lintegral_congr + intro x + rw [ENNReal.ofReal_pow (norm_nonneg _), ofReal_norm] + +theorem sphere_fourth_power : SphereFourthPower := by + classical + intro g hg ⟨B, hB⟩ + let M : ℝ := (eLpNorm g ∞ surfaceArea).toReal + have hM0 : 0 ≤ M := ENNReal.toReal_nonneg + have hfin : eLpNorm g ∞ surfaceArea ≠ ∞ := by + rw [eLpNorm_exponent_top hg.aestronglyMeasurable] + exact (eLpNormEssSup_lt_top_of_ae_bound (Eventually.of_forall hB)).ne + have hM : ∀ᵐ ω ∂surfaceArea, ‖g ω‖ ≤ M := by + filter_upwards [ae_le_eLpNormEssSup (f := g) (μ := surfaceArea)] with ω hω + have ht := ENNReal.toReal_mono + (by simpa only [eLpNorm_exponent_top hg.aestronglyMeasurable] using hfin) hω + simpa [M, eLpNorm_exponent_top hg.aestronglyMeasurable, enorm_eq_nnnorm] using ht + let h : Sphere → ℂ := fun ω => if ‖g ω‖ ≤ M then g ω else 0 + have hh : Measurable h := Measurable.ite (measurableSet_le hg.norm measurable_const) hg measurable_const + have hbound : ∀ ω, ‖h ω‖ ≤ M := by + intro ω + dsimp [h] + split_ifs with hw + · exact hw + · simpa using hM0 + have he : h =ᵐ[surfaceArea] g := by + filter_upwards [hM] with ω hω + simp [h, hω] + rw [← extension_congr_ae he, + eLpNorm_fourth_power _ (extension_continuous hh hbound).aestronglyMeasurable] + calc + _ ≤ ENNReal.ofReal (M ^ 4) * ∫⁻ x, ENNReal.ofReal (‖extension (fun _ => 1) x‖ ^ 4) := + fourth_power_majorant hM0 hh hbound + _ = ENNReal.ofReal (32 * Real.pi ^ 3) * (eLpNorm g ∞ surfaceArea) ^ 4 := by + rw [extension_one_fourth_lintegral, ENNReal.ofReal_pow hM0] + dsimp [M] + rw [ENNReal.ofReal_toReal hfin, mul_comm] + +lemma extension_enorm_le_essSup (g : Sphere → ℂ) (x : Space) : + ‖extension g x‖ₑ ≤ ENNReal.ofReal (4 * Real.pi) * eLpNorm g ∞ surfaceArea := by + unfold extension + calc + _ ≤ ∫⁻ ω, ‖g ω * Complex.exp + (2 * (Real.pi : ℂ) * Complex.I * (inner ℝ x (ω : Space) : ℂ))‖ₑ ∂surfaceArea := + enorm_integral_le_lintegral_enorm _ + _ ≤ ∫⁻ _ : Sphere, eLpNorm g ∞ surfaceArea ∂surfaceArea := by + apply lintegral_mono_ae + filter_upwards [ae_le_eLpNormEssSup (f := g) (μ := surfaceArea)] with ω hω + simpa only [← ofReal_norm, norm_mul, kernel_norm, mul_one] + using hω.trans eLpNormEssSup_le_eLpNorm_top + _ = _ := by rw [lintegral_const, surfaceArea_univ, mul_comm] + +theorem sphere_restriction_ge_four : + ∀ p : ℝ, 4 ≤ p → ∃ C : ℝ≥0, ∀ g : Sphere → ℂ, + Measurable g → (∃ M : ℝ, ∀ ω, ‖g ω‖ ≤ M) → + eLpNorm (extension g) (ENNReal.ofReal p) volume ≤ + (C : ℝ≥0∞) * eLpNorm g ∞ surfaceArea := by + intro p hp + have hp0 : 0 < p := lt_of_lt_of_le (by norm_num) hp + have hdiff : 0 ≤ p - 4 := sub_nonneg.mpr hp + have hinv : 0 ≤ p⁻¹ := le_of_lt (inv_pos.mpr hp0) + let A : ℝ≥0∞ := ENNReal.ofReal (4 * Real.pi) + let B : ℝ≥0∞ := ENNReal.ofReal (32 * Real.pi ^ 3) + let C : ℝ≥0∞ := (A ^ (p - 4) * B) ^ p⁻¹ + have hA : A ≠ ∞ := ENNReal.ofReal_ne_top + have hB : B ≠ ∞ := ENNReal.ofReal_ne_top + have hC : C ≠ ∞ := by + dsimp [C] + finiteness + refine ⟨C.toNNReal, ?_⟩ + intro g hg hbdd + have hext : AEStronglyMeasurable (extension g) volume := + (extension_continuous hg hbdd.choose_spec).aestronglyMeasurable + rw [ENNReal.coe_toNNReal hC] + let G := eLpNorm g ∞ surfaceArea + have hG : G ≠ ∞ := by + rcases hbdd with ⟨M, hM⟩ + simpa only [G, eLpNorm_exponent_top hg.aestronglyMeasurable] using + (eLpNormEssSup_lt_top_of_ae_bound (μ := surfaceArea) (Filter.Eventually.of_forall hM)).ne + have hpoint : ∀ x, ‖extension g x‖ₑ ≤ A * G := extension_enorm_le_essSup g + have hfour : (∫⁻ x, ‖extension g x‖ₑ ^ (4 : ℕ)) ≤ B * G ^ (4 : ℕ) := by + have h := sphere_fourth_power g hg hbdd + rw [eLpNorm_fourth_power _ hext] at h + simpa only [ENNReal.ofReal_pow (norm_nonneg _), ofReal_norm] using h + have hsplit : ∀ x, ‖extension g x‖ₑ ^ p ≤ + (A * G) ^ (p - 4) * ‖extension g x‖ₑ ^ (4 : ℕ) := by + intro x + calc + ‖extension g x‖ₑ ^ p = + ‖extension g x‖ₑ ^ (p - 4) * ‖extension g x‖ₑ ^ (4 : ℝ) := by + rw [← ENNReal.rpow_add_of_nonneg _ _ hdiff (by norm_num), sub_add_cancel] + _ ≤ (A * G) ^ (p - 4) * ‖extension g x‖ₑ ^ (4 : ℝ) := + mul_le_mul_left (ENNReal.rpow_le_rpow (hpoint x) hdiff) _ + _ = _ := by rw [ENNReal.rpow_ofNat] + have integral_bound : (∫⁻ x, ‖extension g x‖ₑ ^ p) ≤ (A ^ (p - 4) * B) * G ^ p := by + calc + _ ≤ ∫⁻ x, (A * G) ^ (p - 4) * ‖extension g x‖ₑ ^ (4 : ℕ) := + lintegral_mono hsplit + _ = (A * G) ^ (p - 4) * (∫⁻ x, ‖extension g x‖ₑ ^ (4 : ℕ)) := + lintegral_const_mul' _ _ (by finiteness) + _ ≤ (A * G) ^ (p - 4) * (B * G ^ (4 : ℕ)) := mul_le_mul_right hfour _ + _ = (A ^ (p - 4) * B) * (G ^ (p - 4) * G ^ (4 : ℝ)) := by + rw [ENNReal.mul_rpow_of_nonneg _ _ hdiff, ENNReal.rpow_ofNat] + ring + _ = _ := by + rw [← ENNReal.rpow_add_of_nonneg _ _ hdiff (by norm_num), sub_add_cancel] + rw [eLpNorm_eq_lintegral_rpow_enorm_toReal (ne_of_gt (ENNReal.ofReal_pos.mpr hp0)) + ENNReal.ofReal_ne_top hext, ENNReal.toReal_ofReal hp0.le, one_div] + calc + _ ≤ ((A ^ (p - 4) * B) * G ^ p) ^ p⁻¹ := ENNReal.rpow_le_rpow integral_bound hinv + _ = C * G := by + rw [ENNReal.mul_rpow_of_nonneg _ _ hinv, ← ENNReal.rpow_mul, + mul_inv_cancel₀ hp0.ne', ENNReal.rpow_one] + +end EllipticCapacity + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/AffineArea.lean b/lean/OAI/Analysis/FourierExtension/AffineArea.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ad6d3ad94e0833ecc656c74e8d3cfafd987cd58 --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/AffineArea.lean @@ -0,0 +1,78 @@ +import Mathlib +import OAI.Analysis.FourierExtension.GraphBounds +import OAI.Analysis.FourierExtension.ChartMeasure + +namespace OAI + +/-! Fourier bounds for affine graph area measures. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology +open Set Filter +open scoped ENNReal InnerProductSpace +open scoped FourierTransform SchwartzMap ENNReal +open scoped ENNReal FourierTransform InnerProductSpace +open MeasureTheory Set Filter +open scoped ContDiff Topology ENNReal +open scoped ENNReal NNReal + +namespace DiagonalExtension.AffineGraph +open MeasureTheory Set ConvexRadial +open scoped ENNReal NNReal +variable {Y : Type*} [NormedAddCommGroup Y] [InnerProductSpace ℝ Y] + [FiniteDimensional ℝ Y] [MeasurableSpace Y] [BorelSpace Y] + +theorem area_L4 (A : GraphSpace ≃L[ℝ] Y) (a : Y) + {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) {c : ℝ} (hc : 0 < c) + (hell : ∀ x v : E2, c * ‖v‖^2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) + (R : ℝ) (κ : ℝ≥0) : ∃ C : ℝ≥0, ∀ μ : Measure Y, + μ ≤ ((κ : ℝ≥0∞) • (Measure.hausdorffMeasure 2 : Measure Y)).restrict + ((fun u => a + A (graphEmbedding φ u)) '' Metric.closedBall 0 R) → + ∀ f : Y → ℂ, MemLp f 2 μ → + MemLp (fun x => ∫ y, f y * (Real.fourierChar (-inner ℝ y x) : ℂ) ∂μ) 4 volume ∧ + eLpNorm (fun x => ∫ y, f y * (Real.fourierChar (-inner ℝ y x) : ℂ) ∂μ) 4 volume ≤ + (C : ℝ≥0∞) * eLpNorm f 2 μ := by + let Γ : E2 → Y := fun u => a + A (graphEmbedding φ u) + let P := WithLp.prodContinuousLinearEquiv 2 ℝ E2 ℝ + let π : Y → E2 := fun y => (P (A.symm (y-a))).1 + have hΓsmooth : ContDiff ℝ ∞ Γ := by + apply contDiff_const.add + apply A.contDiff.comp + exact P.symm.contDiff.comp (contDiff_id.prodMk hφ) + have hπ : Measurable π := by dsimp [π]; fun_prop + have hleft (u : E2) : π (Γ u) = u := by + simp [π,Γ,P,graphEmbedding] + obtain ⟨L,hL⟩ := hΓsmooth.contDiffOn.exists_lipschitzOnWith (by simp) + (convex_closedBall (0 : E2) R) (isCompact_closedBall (0 : E2) R) + let C : ℝ≥0∞ := + (ENNReal.ofReal (Real.pi/c) * (haarFactor A : ℝ≥0∞)) ^ (1/4 : ℝ) * + ((κ : ℝ≥0∞) * (L : ℝ≥0∞)^2 * (ChartMeasure.dimensionFactor E2 : ℝ≥0∞)) ^ (1/2 : ℝ) + have hC : C ≠ (⊤ : ℝ≥0∞) := by dsimp [C]; finiteness + refine ⟨C.toNNReal,?_⟩ + intro μ hμ f hf + obtain ⟨g,hg,hgc,hgi,hgb,hpair⟩ := ChartMeasure.exists_graph_density + (by simp [E2]) hΓsmooth.continuous hπ (fun u _ => hleft u) hL + (isCompact_closedBall (0 : E2) R) hμ hf + have he : (fun x => ∫ y, f y * (Real.fourierChar (-inner ℝ y x) : ℂ) ∂μ) = + GraphFourier.transform Γ g := by + ext x + exact (hpair _ (GraphFourier.character_continuous x) + ⟨1,fun y => by simp only [Circle.norm_coe,le_rfl]⟩).symm + obtain ⟨hm,hb⟩ := L4 A a hφ hc hell hg hgc + rw [he,ENNReal.coe_toNNReal hC] + refine ⟨hm,hb.trans ?_⟩ + simpa only [C,mul_assoc] using + mul_le_mul_right hgb ((ENNReal.ofReal (Real.pi/c) * (haarFactor A : ℝ≥0∞)) ^ (1/4 : ℝ)) + +end DiagonalExtension.AffineGraph + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/AutomaticBound.lean b/lean/OAI/Analysis/FourierExtension/AutomaticBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e4d7b5fb00178ff544641979bc0ce16975f9703 --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/AutomaticBound.lean @@ -0,0 +1,152 @@ +import Mathlib + +namespace OAI + +/-! Automatic boundedness and integral kernels on Lp spaces. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology +open Set Filter +open scoped ENNReal InnerProductSpace +open scoped FourierTransform SchwartzMap ENNReal +open scoped ENNReal FourierTransform InnerProductSpace +open MeasureTheory Set Filter +open scoped ContDiff Topology ENNReal +open scoped ENNReal NNReal + +open Filter +namespace DiagonalExtension.AutomaticBound +variable {α V : Type*} [MeasurableSpace α] {μ : Measure α} + [NormedAddCommGroup V] [NormedSpace ℂ V] [CompleteSpace V] + {p : ℝ≥0∞} [Fact (1 ≤ p)] + +def pointwiseLpMap (T : α → V →L[ℂ] ℂ) + (hT : ∀ v, MemLp (fun x => T x v) p μ) : V →ₗ[ℂ] Lp ℂ p μ where + toFun v := (hT v).toLp (fun x => T x v) + map_add' v w := by + apply Lp.ext + filter_upwards [(hT (v+w)).coeFn_toLp,(hT v).coeFn_toLp,(hT w).coeFn_toLp, + Lp.coeFn_add ((hT v).toLp _) ((hT w).toLp _)] with x h₁ h₂ h₃ h₄ + exact (h₁.trans ((T x).map_add v w)).trans (by rw [h₄,Pi.add_apply,h₂,h₃]) + map_smul' c v := by + apply Lp.ext + filter_upwards [(hT (c • v)).coeFn_toLp,(hT v).coeFn_toLp, + Lp.coeFn_smul c ((hT v).toLp _)] with x h₁ h₂ h₃ + exact (h₁.trans ((T x).map_smul c v)).trans (by rw [RingHom.id_apply,h₃,Pi.smul_apply,h₂]) + +theorem continuous_pointwiseLpMap (T : α → V →L[ℂ] ℂ) + (hT : ∀ v, MemLp (fun x => T x v) p μ) : + Continuous (pointwiseLpMap T hT) := by + apply LinearMap.continuous_of_seq_closed_graph + intro u v w hu hw + obtain ⟨ns,hmono,hns⟩ := (tendstoInMeasure_of_tendsto_Lp hw).exists_seq_tendsto_ae + apply Lp.ext + have hall : ∀ᵐ x ∂μ, ∀ n : ℕ, + pointwiseLpMap T hT (u (ns n)) x = T x (u (ns n)) := by + exact ae_all_iff.mpr (fun n => (hT (u (ns n))).coeFn_toLp) + filter_upwards [hns,hall,(hT v).coeFn_toLp] with x hx hxe hxv + change w x = (hT v).toLp (fun x => T x v) x + rw [hxv] + have he : Tendsto (fun n => T x (u (ns n))) atTop (𝓝 (T x v)) := + ((T x).continuous.tendsto v).comp (hu.comp hmono.tendsto_atTop) + have hw' : Tendsto (fun n => T x (u (ns n))) atTop (𝓝 (w x)) := by + convert hx using 1 + ext n + exact (hxe n).symm + exact tendsto_nhds_unique hw' he + +theorem exists_bound (T : α → V →L[ℂ] ℂ) + (hT : ∀ v, MemLp (fun x => T x v) p μ) : + ∃ C : ℝ≥0, ∀ v, eLpNorm (fun x => T x v) p μ ≤ (C : ℝ≥0∞) * ‖v‖ₑ := by + let L : V →L[ℂ] Lp ℂ p μ := + ⟨pointwiseLpMap T hT, continuous_pointwiseLpMap T hT⟩ + refine ⟨‖L‖₊,fun v => ?_⟩ + have hb := L.le_opNorm v + have he := ENNReal.ofReal_le_ofReal hb + have hv : ‖L v‖ₑ = eLpNorm (fun x => T x v) p μ := + Lp.enorm_toLp (hT v) + rw [← hv, ENNReal.coe_nnreal_eq] + change ‖L v‖ₑ ≤ ENNReal.ofReal ‖L‖ * ‖v‖ₑ + simpa only [ENNReal.ofReal_mul (norm_nonneg _),ofReal_norm] using he + +end DiagonalExtension.AutomaticBound + +open MeasureTheory Filter +open scoped NNReal ENNReal Topology + +namespace DiagonalExtension.KernelLp +variable {α : Type*} [MeasurableSpace α] {μ : Measure α} [IsFiniteMeasure μ] + {p : ℝ≥0∞} [Fact (1 ≤ p)] + +lemma integral_norm_le_lp (hp : p ≠ (∞ : ℝ≥0∞)) (f : Lp ℂ p μ) : + (∫ x, ‖f x‖ ∂μ) ≤ (μ Set.univ ^ (1-1/p.toReal)).toReal * ‖f‖ := by + have hpr : 1 ≤ p.toReal := by + simpa using ENNReal.toReal_mono hp (show (1:ℝ≥0∞) ≤ p from Fact.out) + have hpow : 0 ≤ 1-1/p.toReal := by + have ht : 0 < p.toReal := by linarith + have hh : 1/p.toReal ≤ 1 := (div_le_one ht).mpr hpr + linarith + have hM : μ Set.univ ^ (1-1/p.toReal) ≠ (∞ : ℝ≥0∞) := + ENNReal.rpow_ne_top_of_nonneg hpow (measure_ne_top μ _) + rw [integral_norm_eq_lintegral_enorm (Lp.aestronglyMeasurable f), + ← eLpNorm_one_eq_lintegral_enorm (Lp.aestronglyMeasurable f)] + have hh := eLpNorm_le_eLpNorm_mul_rpow_measure_univ + (show (1:ℝ≥0∞) ≤ p from Fact.out) (Lp.aestronglyMeasurable f) + simp only [ENNReal.toReal_one,div_one] at hh + have hr := ENNReal.toReal_mono (ENNReal.mul_ne_top (Lp.memLp f).eLpNorm_ne_top hM) hh + simpa only [ENNReal.toReal_mul,← Lp.norm_def,mul_comm] using hr + +lemma integrable_kernel {k : α → ℂ} (hk : AEStronglyMeasurable k μ) + (hb : ∀ᵐ x ∂μ, ‖k x‖ ≤ 1) (f : Lp ℂ p μ) : + Integrable (fun x => f x * k x) μ := + ((Lp.memLp f).integrable (show (1:ℝ≥0∞) ≤ p from Fact.out)).mul_bdd hk hb + +def evalLinear {k : α → ℂ} (hk : AEStronglyMeasurable k μ) + (hb : ∀ᵐ x ∂μ, ‖k x‖ ≤ 1) : Lp ℂ p μ →ₗ[ℂ] ℂ where + toFun f := ∫ x, f x * k x ∂μ + map_add' f g := by + calc + _ = ∫ x, f x * k x + g x * k x ∂μ := by + apply integral_congr_ae + filter_upwards [Lp.coeFn_add f g] with x hx + rw [hx,Pi.add_apply,add_mul] + _ = _ := integral_add (integrable_kernel hk hb f) (integrable_kernel hk hb g) + map_smul' c f := by + simp only [RingHom.id_apply] + calc + _ = ∫ x, c • (f x * k x) ∂μ := by + apply integral_congr_ae + filter_upwards [Lp.coeFn_smul c f] with x hx + rw [hx,Pi.smul_apply,smul_mul_assoc] + _ = _ := integral_smul _ _ + +lemma norm_evalLinear_le (hp : p ≠ (∞ : ℝ≥0∞)) {k : α → ℂ} + (hk : AEStronglyMeasurable k μ) (hb : ∀ᵐ x ∂μ, ‖k x‖ ≤ 1) + (f : Lp ℂ p μ) : + ‖evalLinear hk hb f‖ ≤ (μ Set.univ ^ (1-1/p.toReal)).toReal * ‖f‖ := by + have hi := ((Lp.memLp f).integrable (show (1:ℝ≥0∞) ≤ p from Fact.out)).norm + apply le_trans (norm_integral_le_of_norm_le hi ?_) (integral_norm_le_lp hp f) + filter_upwards [hb] with x hx + exact (norm_mul _ _).le.trans (by simpa using mul_le_mul_of_nonneg_left hx (norm_nonneg (f x))) + +def eval (hp : p ≠ (∞ : ℝ≥0∞)) {k : α → ℂ} (hk : AEStronglyMeasurable k μ) + (hb : ∀ᵐ x ∂μ, ‖k x‖ ≤ 1) : Lp ℂ p μ →L[ℂ] ℂ := + (evalLinear hk hb).mkContinuous (μ Set.univ ^ (1-1/p.toReal)).toReal + (norm_evalLinear_le hp hk hb) + +@[simp] lemma eval_apply (hp : p ≠ (∞ : ℝ≥0∞)) {k : α → ℂ} (hk : AEStronglyMeasurable k μ) + (hb : ∀ᵐ x ∂μ, ‖k x‖ ≤ 1) (f : Lp ℂ p μ) : + eval hp hk hb f = ∫ x, f x * k x ∂μ := rfl + +end DiagonalExtension.KernelLp + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/ChartMeasure.lean b/lean/OAI/Analysis/FourierExtension/ChartMeasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..3927944d498581811ce10087c5030e3f675aa9e9 --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/ChartMeasure.lean @@ -0,0 +1,153 @@ +import Mathlib +import OAI.Analysis.FourierExtension.L2Fourier + +namespace OAI + +/-! Surface-area measure bounds in graph coordinates. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology +open Set Filter +open scoped ENNReal InnerProductSpace +open scoped FourierTransform SchwartzMap ENNReal +open scoped ENNReal FourierTransform InnerProductSpace +open MeasureTheory Set Filter +open scoped ContDiff Topology ENNReal + +open MeasureTheory Set +open scoped ENNReal NNReal +namespace DiagonalExtension.ChartMeasure +variable {E Y : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [MeasureSpace E] [BorelSpace E] [Measure.IsAddHaarMeasure (volume : Measure E)] + [NormedAddCommGroup Y] [NormedSpace ℝ Y] [MeasurableSpace Y] [BorelSpace Y] + +def dimensionFactor (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [MeasureSpace E] [BorelSpace E] [Measure.IsAddHaarMeasure (volume : Measure E)] : ℝ≥0 := + Measure.addHaarScalarFactor (Measure.hausdorffMeasure (Module.finrank ℝ E) : Measure E) (volume : Measure E) + +lemma hausdorff_eq (hd : Module.finrank ℝ E = 2) : + (Measure.hausdorffMeasure 2 : Measure E) = dimensionFactor E • volume := by + simpa [dimensionFactor,hd] using + (Measure.isAddLeftInvariant_eq_smul + (Measure.hausdorffMeasure (Module.finrank ℝ E) : Measure E) volume) + +omit [NormedSpace ℝ Y] in +theorem coordinate_measure_le {Γ : E → Y} {π : Y → E} {K : Set E} {L κ : ℝ≥0} + (hd : Module.finrank ℝ E = 2) (hπ : Measurable π) + (hleft : ∀ x ∈ K, π (Γ x) = x) (hLip : LipschitzOnWith L Γ K) : + Measure.map π (((κ : ℝ≥0∞) • (Measure.hausdorffMeasure 2 : Measure Y)).restrict (Γ '' K)) ≤ + ((κ : ℝ≥0∞) * (L : ℝ≥0∞)^2 * (dimensionFactor E : ℝ≥0∞)) • volume.restrict K := by + apply Measure.le_iff.mpr + intro B hB + rw [Measure.map_apply hπ hB,Measure.restrict_apply (hπ hB)] + have he : π ⁻¹' B ∩ Γ '' K = Γ '' (B ∩ K) := by + ext y + constructor + · rintro ⟨hy, x,hx,rfl⟩ + exact ⟨x,⟨by simpa only [mem_preimage,hleft x hx] using hy,hx⟩,rfl⟩ + · rintro ⟨x,⟨hxB,hxK⟩,rfl⟩ + exact ⟨by simpa only [mem_preimage,hleft x hxK] using hxB,⟨x,hxK,rfl⟩⟩ + rw [he,Measure.smul_apply] + have hH := (hLip.mono (show B ∩ K ⊆ K from inter_subset_right)).hausdorffMeasure_image_le + (by norm_num : (0 : ℝ) ≤ 2) + calc + _ ≤ (κ : ℝ≥0∞) * ((L : ℝ≥0∞)^2 * (Measure.hausdorffMeasure 2 : Measure E) (B ∩ K)) := by + simpa only [ENNReal.rpow_two, smul_eq_mul] using mul_le_mul_right hH (κ : ℝ≥0∞) + _ = _ := by + rw [hausdorff_eq hd,Measure.smul_apply,Measure.smul_apply,Measure.restrict_apply hB] + simp only [smul_eq_mul,ENNReal.smul_def] + ring + +end DiagonalExtension.ChartMeasure + +namespace DiagonalExtension.ChartMeasure +open MeasureTheory Set +open scoped ENNReal NNReal +variable {E Y : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [MeasureSpace E] [BorelSpace E] + [Measure.IsAddHaarMeasure (volume : Measure E)] + [NormedAddCommGroup Y] [NormedSpace ℝ Y] [MeasurableSpace Y] [BorelSpace Y] + +omit [NormedSpace ℝ Y] in +theorem exists_graph_density {Γ : E → Y} {π : Y → E} {K : Set E} {L κ : ℝ≥0} + (hd : Module.finrank ℝ E = 2) (hΓ : Continuous Γ) (hπ : Measurable π) + (hleft : ∀ x ∈ K, π (Γ x) = x) (hLip : LipschitzOnWith L Γ K) + (hK : IsCompact K) {μ : Measure Y} + (hμ : μ ≤ ((κ : ℝ≥0∞) • (Measure.hausdorffMeasure 2 : Measure Y)).restrict (Γ '' K)) + {f : Y → ℂ} (hf : MemLp f 2 μ) : + ∃ g : E → ℂ, MemLp g 2 volume ∧ HasCompactSupport g ∧ Integrable g volume ∧ + eLpNorm g 2 volume ≤ + ((κ : ℝ≥0∞) * (L : ℝ≥0∞)^2 * (dimensionFactor E : ℝ≥0∞)) ^ (1/2 : ℝ) * + eLpNorm f 2 μ ∧ + ∀ v : Y → ℂ, Continuous v → (∃ M : ℝ, ∀ y, ‖v y‖ ≤ M) → + (∫ x, g x * v (Γ x)) = ∫ y, f y * v y ∂μ := by + classical + let C : ℝ≥0∞ := (κ : ℝ≥0∞) * (L : ℝ≥0∞)^2 * (dimensionFactor E : ℝ≥0∞) + have hC : C ≠ (⊤ : ℝ≥0∞) := by dsimp [C]; finiteness + have hcoord : Measure.map π μ ≤ C • volume := + ((Measure.map_mono hμ hπ).trans (coordinate_measure_le hd hπ hleft hLip)).trans + (by + intro B + simp only [Measure.smul_apply, smul_eq_mul] + exact mul_le_mul_right (Measure.restrict_le_self B) C) + have hsupport : ∀ᵐ y ∂μ, y ∈ Γ '' K := by + exact (ae_mono hμ) (ae_restrict_mem (hK.image hΓ).measurableSet) + let F := hf.toLp f + have hF : (F : Y → ℂ) =ᵐ[μ] f := MemLp.coeFn_toLp hf + obtain ⟨u,huInt,huNorm,huSupp,huPair⟩ := + BoundedPullback.exists_integrable_density hπ hC hcoord F hK.measurableSet + hK.measure_lt_top (by + filter_upwards [hsupport] with y hy + obtain ⟨x,hx,rfl⟩ := hy + simp [hleft x hx,hx]) + let g := K.indicator (u : E → ℂ) + have hgue : g =ᵐ[volume] u := by + filter_upwards [huSupp] with x hx + by_cases h : x ∈ K + · simp [g,h] + · simp [g,h,hx h] + have hg : MemLp g 2 volume := (Lp.memLp u).ae_eq hgue.symm + have hgc : HasCompactSupport g := hK.of_isClosed_subset (isClosed_tsupport _) + (closure_minimal (Set.support_indicator_subset) hK.isClosed) + refine ⟨g,hg,hgc,huInt.congr hgue.symm,?_,?_⟩ + · rw [eLpNorm_congr_ae hgue, ← Lp.enorm_def] + rw [← ofReal_norm] + calc + _ ≤ ENNReal.ofReal (C.toReal ^ (1 / 2 : ℝ) * ‖F‖) := ENNReal.ofReal_le_ofReal huNorm + _ = C ^ (1/2 : ℝ) * ENNReal.ofReal ‖F‖ := by + rw [ENNReal.ofReal_mul (Real.rpow_nonneg ENNReal.toReal_nonneg _), + ← ENNReal.ofReal_rpow_of_nonneg ENNReal.toReal_nonneg (by norm_num), ENNReal.ofReal_toReal hC] + _ = _ := by rw [ofReal_norm, Lp.enorm_def, eLpNorm_congr_ae hF] + · intro v hv hvB + obtain ⟨M,hM⟩ := hvB + let w := K.indicator (fun x => v (Γ x)) + have hw : MemLp w 2 volume := by + rw [memLp_indicator_iff_restrict hK.measurableSet] + have : IsFiniteMeasure ((volume : Measure E).restrict K) := + ⟨by simpa using hK.measure_lt_top⟩ + exact MemLp.of_bound (hv.comp hΓ).aestronglyMeasurable M + (Filter.Eventually.of_forall (fun x => hM (Γ x))) + calc + (∫ x, g x * v (Γ x)) = ∫ x, u x * w x := by + apply integral_congr_ae + filter_upwards [huSupp] with x hx + by_cases h : x ∈ K <;> simp [g,w,h,hx] + _ = ∫ y, F y * w (π y) ∂μ := huPair w hw + _ = ∫ y, f y * v y ∂μ := by + apply integral_congr_ae + filter_upwards [hF,hsupport] with y hy hs + obtain ⟨x,hx,rfl⟩ := hs + simp [hy,w,hleft x hx,hx] + +end DiagonalExtension.ChartMeasure + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/ConvexExtension.lean b/lean/OAI/Analysis/FourierExtension/ConvexExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe4e5e1500244f3f40a17f20ad1f7b88678ccab8 --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/ConvexExtension.lean @@ -0,0 +1,374 @@ +import Mathlib +import OAI.Analysis.FourierExtension.SmoothCharts +import OAI.Analysis.FourierExtension.LocalizedFourier + +namespace OAI + +/-! Smooth cutoffs and convex continuation. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology + +namespace DiagonalExtension.CutoffHessian +open MeasureTheory Set Filter +open scoped Topology ContDiff +variable {E : Type} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + +lemma iteratedFDeriv_section {F : ℝ × E → ℝ} (hF : ContDiff ℝ ∞ F) + (p : ℝ) (z : E) (j : ℕ) : + iteratedFDeriv ℝ j (fun y => F (p,y)) z = + (iteratedFDeriv ℝ j F (p,z)).compContinuousLinearMap + (fun _ => ContinuousLinearMap.inr ℝ ℝ E) := by + let g : ℝ × E → ℝ := fun q => F ((p,0) + q) + have hg : ContDiff ℝ ∞ g := hF.comp (contDiff_const.add contDiff_id) + have heq := (ContinuousLinearMap.inr ℝ ℝ E).iteratedFDeriv_comp_right hg z + (i := j) (by exact WithTop.coe_le_coe.mpr le_top) + have ht := iteratedFDerivWithin_comp_add_left (𝕜 := ℝ) (f := F) (s := Set.univ) + j (p, (0:E)) ((0:ℝ),z) + simp only [Set.vadd_set_univ, iteratedFDerivWithin_univ, Prod.mk_add_mk, + add_zero, zero_add] at ht + simp only [Function.comp_def, g, ContinuousLinearMap.inr_apply, + Prod.mk_add_mk, add_zero, zero_add] at heq + rw [show iteratedFDeriv ℝ j (fun q : ℝ × E => F ((p,0) + q)) (0,z) = + iteratedFDeriv ℝ j F (p,z) from ht] at heq + exact heq + +lemma continuous_section_derivative {F : ℝ × E → ℝ} (hF : ContDiff ℝ ∞ F) (j : ℕ) : + Continuous (fun q : ℝ × E => iteratedFDeriv ℝ j (fun y => F (q.1,y)) q.2) := by + simp_rw [iteratedFDeriv_section hF] + exact (ContinuousMultilinearMap.compContinuousLinearMapL + (fun _ : Fin j => ContinuousLinearMap.inr ℝ ℝ E)).continuous.comp + (hF.continuous_iteratedFDeriv (by exact WithTop.coe_le_coe.mpr le_top)) + +lemma uniform_derivative_small {F : ℝ × E → ℝ} (hF : ContDiff ℝ ∞ F) + {K : Set E} (hK : IsCompact K) (hzero : ∀ x, F (0,x) = 0) + (hsupp : ∀ δ, tsupport (fun x => F (δ,x)) ⊆ K) (j : ℕ) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ δ in 𝓝 (0 : ℝ), ∀ x, ‖iteratedFDeriv ℝ j (fun z => F (δ,z)) x‖ < ε := by + have hz (x : E) : iteratedFDeriv ℝ j (fun z => F (0,z)) x = 0 := by + simp only [show (fun z => F (0,z)) = (fun _ => 0) from funext hzero] + simp + have hlocal := hK.eventually_forall_of_forall_eventually (x₀ := (0 : ℝ)) + (P := fun δ x => ‖iteratedFDeriv ℝ j (fun z => F (δ,z)) x‖ < ε) + (fun x hx => ((continuous_section_derivative hF j).norm.continuousAt.eventually (gt_mem_nhds (by simpa [hz] using hε)))) + filter_upwards [hlocal] with δ hδ x + by_cases hx : x ∈ K + · exact hδ x hx + · have hd : iteratedFDeriv ℝ j (fun z => F (δ,z)) x = 0 := by + apply Function.notMem_support.mp + exact fun h => hx (hsupp δ (support_iteratedFDeriv_subset j h)) + simpa [hd] using hε + +def profile (φ χ : E → ℝ) (a : E) (q : ℝ × E) : ℝ := + χ q.2 * PacketTaylor.remainder φ ((a,q.1),q.2) + +variable [FiniteDimensional ℝ E] + +lemma smooth_profile {φ χ : E → ℝ} (hφ : ContDiff ℝ ∞ φ) + (hχ : ContDiff ℝ ∞ χ) (a : E) : ContDiff ℝ ∞ (profile φ χ a) := + (hχ.comp contDiff_snd).mul ((PacketTaylor.smooth_remainder hφ).comp (by fun_prop)) + +omit [FiniteDimensional ℝ E] in +lemma profile_zero {φ χ : E → ℝ} {a : E} (h0 : fderiv ℝ (fderiv ℝ φ) a = 0) (x : E) : + profile φ χ a (0,x) = 0 := by + simp [profile,PacketTaylor.remainder,h0] + +theorem profile_hessian_small {φ χ : E → ℝ} (hφ : ContDiff ℝ ∞ φ) + (hχ : ContDiff ℝ ∞ χ) (hχc : HasCompactSupport χ) {a : E} + (h0 : fderiv ℝ (fderiv ℝ φ) a = 0) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ δ in 𝓝 (0 : ℝ), ∀ x, + ‖iteratedFDeriv ℝ 2 (fun z => profile φ χ a (δ,z)) x‖ < ε := by + apply uniform_derivative_small (smooth_profile hφ hχ a) hχc + (profile_zero h0) _ 2 hε + intro δ + apply closure_mono + intro x hx + simp only [Function.mem_support,profile] at * + exact fun h => hx (by simp [h]) + +omit [FiniteDimensional ℝ E] in +lemma scaled_hessian_apply {f : E → ℝ} (hf : ContDiff ℝ ∞ f) + {δ : ℝ} (hδ : δ ≠ 0) (x v : E) : + (fderiv ℝ (fderiv ℝ (fun y => δ^2 * f (δ⁻¹ • y))) x v) v = + (fderiv ℝ (fderiv ℝ f) (δ⁻¹ • x) v) v := by + let L : E →L[ℝ] E := δ⁻¹ • ContinuousLinearMap.id ℝ E + have hfL : ContDiff ℝ ∞ (f ∘ L) := hf.comp L.contDiff + have hh := iteratedFDeriv_const_smul_apply' (a := δ^2) + ((hfL.of_le (show (2 : ℕ∞ω) ≤ (∞ : ℕ∞ω) by exact WithTop.coe_le_coe.mpr le_top)).contDiffAt (x := x)) + have hL := L.iteratedFDeriv_comp_right hf x (i := 2) (by exact WithTop.coe_le_coe.mpr le_top) + have hv := congrArg (fun B => B ![v,v]) hh + rw [hL] at hv + simp only [iteratedFDeriv_two_apply, smul_apply, + ContinuousMultilinearMap.compContinuousLinearMap_apply, Matrix.cons_val_zero, + Matrix.cons_val_one, map_smul, + ContinuousLinearMap.id_apply,smul_eq_mul,L] at hv + convert hv using 1 + · congr 1 + · field_simp + +omit [FiniteDimensional ℝ E] in +lemma hessian_add {f g : E → ℝ} (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) + (x v : E) : + (fderiv ℝ (fderiv ℝ (fun y => f y + g y)) x v) v = + (fderiv ℝ (fderiv ℝ f) x v) v + (fderiv ℝ (fderiv ℝ g) x v) v := by + have hd := iteratedFDeriv_add_apply (i := 2) + ((hf.of_le (by exact WithTop.coe_le_coe.mpr le_top)).contDiffAt (x := x)) + ((hg.of_le (by exact WithTop.coe_le_coe.mpr le_top)).contDiffAt (x := x)) + have hv := congrArg (fun B => B ![v,v]) hd + simpa only [iteratedFDeriv_two_apply, add_apply, + Matrix.cons_val_zero, Matrix.cons_val_one,Pi.add_apply] using + (show (iteratedFDeriv ℝ 2 (fun y => f y + g y) x) ![v,v] = _ from hv) + +def patch (φ χ : E → ℝ) (δ : ℝ) (x : E) : ℝ := χ (δ⁻¹ • x) * φ x + +omit [FiniteDimensional ℝ E] in +lemma patch_scaled {φ χ : E → ℝ} (hφ : ContDiff ℝ ∞ φ) + (hval : φ 0 = 0) (hder : fderiv ℝ φ 0 = 0) {δ : ℝ} (hδ : δ ≠ 0) : + patch φ χ δ = fun x => δ^2 * profile φ χ 0 (δ,δ⁻¹ • x) := by + ext x + have ht := PacketTaylor.taylor_identity hφ 0 (δ⁻¹ • x) δ + simp only [zero_add,smul_smul,mul_inv_cancel₀ hδ,one_smul,hval,hder, + zero_apply,mul_zero,add_zero] at ht + dsimp [patch,profile] + rw [ht] + ring + +lemma patch_hessian_small {φ χ : E → ℝ} (hφ : ContDiff ℝ ∞ φ) + (hχ : ContDiff ℝ ∞ χ) (hχc : HasCompactSupport χ) + (hval : φ 0 = 0) (hder : fderiv ℝ φ 0 = 0) + (hder2 : fderiv ℝ (fderiv ℝ φ) 0 = 0) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ δ in 𝓝 (0 : ℝ), δ ≠ 0 → ∀ x v, + ‖(fderiv ℝ (fderiv ℝ (patch φ χ δ)) x v) v‖ ≤ ε * ‖v‖ ^ 2 := by + filter_upwards [profile_hessian_small hφ hχ hχc hder2 hε] with δ hδ hn x v + have hsec : ContDiff ℝ ∞ (fun z => profile φ χ 0 (δ,z)) := + (smooth_profile hφ hχ 0).comp (by fun_prop) + rw [patch_scaled hφ hval hder hn, scaled_hessian_apply hsec hn] + have hb := (iteratedFDeriv ℝ 2 (fun z => profile φ χ 0 (δ,z)) (δ⁻¹ • x)).le_opNorm ![v,v] + have hb' : ‖(fderiv ℝ (fderiv ℝ (fun z => profile φ χ 0 (δ,z))) (δ⁻¹ • x) v) v‖ ≤ + ‖iteratedFDeriv ℝ 2 (fun z => profile φ χ 0 (δ,z)) (δ⁻¹ • x)‖ * ‖v‖ ^ 2 := by + simpa only [iteratedFDeriv_two_apply,Fin.prod_univ_two,Matrix.cons_val_zero, + Matrix.cons_val_one,pow_two] using hb + exact hb'.trans (mul_le_mul_of_nonneg_right (hδ _).le (sq_nonneg _)) + +theorem exists_small_patch {φ : E → ℝ} (hφ : ContDiff ℝ ∞ φ) + (hval : φ 0 = 0) (hder : fderiv ℝ φ 0 = 0) + (hder2 : fderiv ℝ (fderiv ℝ φ) 0 = 0) {ε R : ℝ} (hε : 0 < ε) (hR : 0 < R) : + ∃ P : E → ℝ, ContDiff ℝ ∞ P ∧ HasCompactSupport P ∧ + P =ᶠ[𝓝 0] φ ∧ tsupport P ⊆ Metric.ball 0 R ∧ + ∀ x v, ‖(fderiv ℝ (fderiv ℝ P) x v) v‖ ≤ ε * ‖v‖^2 := by + let b : ContDiffBump (0 : E) := ⟨1,2,by norm_num,by norm_num⟩ + obtain ⟨r,hr,hrU⟩ := Metric.mem_nhds_iff.mp + (patch_hessian_small hφ b.contDiff b.hasCompactSupport hval hder hder2 hε) + let δ := min r (R/2) / 2 + have hδ : 0 < δ := by dsimp [δ]; positivity + have hδr : δ < r := by dsimp [δ]; linarith [min_le_left r (R/2)] + have hδR : 2 * δ < R := by dsimp [δ]; linarith [min_le_right r (R/2)] + have hsmall := hrU (show δ ∈ Metric.ball (0 : ℝ) r by simpa [Real.dist_eq,abs_of_pos hδ] using hδr) + let P := patch φ b δ + have hb : ContDiff ℝ ∞ (fun x : E => b (δ⁻¹ • x)) := b.contDiff.comp (contDiff_const.smul contDiff_id) + have hPc : HasCompactSupport P := + (b.hasCompactSupport.comp_homeomorph (Homeomorph.smulOfNeZero δ⁻¹ (inv_ne_zero hδ.ne'))).mul_right + refine ⟨P,hb.mul hφ,hPc,?_,?_,hsmall hδ.ne'⟩ + · have hlim : Tendsto (fun x : E => δ⁻¹ • x) (𝓝 0) (𝓝 0) := by + have hc : Continuous (fun x : E => δ⁻¹ • x) := + ((continuous_const : Continuous (fun _ : E => (δ⁻¹ : ℝ))).smul continuous_id) + simpa only [smul_zero] using hc.tendsto (0 : E) + filter_upwards [hlim.eventually b.eventuallyEq_one] with x hx + simp [P,patch,hx] + · have hs : tsupport P ⊆ tsupport (fun x : E => b (δ⁻¹ • x)) := by + apply closure_mono + intro x hx + simp only [Function.mem_support,P,patch] at * + exact fun h => hx (by simp [h]) + intro x hx + have hh : δ⁻¹ • x ∈ Metric.closedBall (0 : E) 2 := by + have hm : δ⁻¹ • x ∈ tsupport (b : E → ℝ) := + tsupport_comp_subset_preimage (b : E → ℝ) + (by fun_prop : Continuous (fun y : E => δ⁻¹ • y)) (hs hx) + simpa [b.tsupport_eq,b] using hm + have hn : δ⁻¹ * ‖x‖ ≤ 2 := by simpa [norm_smul,abs_of_pos hδ] using hh + have hn' : ‖x‖ ≤ 2 * δ := by nlinarith [mul_le_mul_of_nonneg_left hn hδ.le,inv_mul_cancel₀ hδ.ne'] + simpa using hn'.trans_lt hδR + +end DiagonalExtension.CutoffHessian + +namespace DiagonalExtension.CutoffHessian +variable {E : Type} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + +lemma hessian_sub_map {f g : E → ℝ} (hf : ContDiff ℝ ∞ f) (hg : ContDiff ℝ ∞ g) + (x : E) : + fderiv ℝ (fderiv ℝ (fun y => f y - g y)) x = + fderiv ℝ (fderiv ℝ f) x - fderiv ℝ (fderiv ℝ g) x := by + have he : fderiv ℝ (fun y => f y - g y) = fun y => fderiv ℝ f y - fderiv ℝ g y := by + ext y v + exact congrArg (fun A : E →L[ℝ] ℝ => A v) + (fderiv_sub (hf.differentiable (by simp) y) (hg.differentiable (by simp) y)) + rw [he] + exact fderiv_sub ((hf.fderiv_right (m := ∞) (by simp)).differentiable (by simp) x) + ((hg.fderiv_right (m := ∞) (by simp)).differentiable (by simp) x) + +variable [FiniteDimensional ℝ E] + +theorem glue_convex {q ψ : E → ℝ} (hq : ContDiff ℝ ∞ q) (hψ : ContDiff ℝ ∞ ψ) + (hj0 : ψ 0 = q 0) (hj1 : fderiv ℝ ψ 0 = fderiv ℝ q 0) + (hj2 : fderiv ℝ (fderiv ℝ ψ) 0 = fderiv ℝ (fderiv ℝ q) 0) + {c R : ℝ} (hc : 0 < c) (hR : 0 < R) + (hconv : ∀ x v, c * ‖v‖^2 ≤ (fderiv ℝ (fderiv ℝ q) x v) v) : + ∃ Φ : E → ℝ, ContDiff ℝ ∞ Φ ∧ Φ =ᶠ[𝓝 0] ψ ∧ + (∀ x ∉ Metric.ball 0 R, Φ x = q x) ∧ + HasCompactSupport (fun x => Φ x - q x) ∧ + ∀ x v, (c/2) * ‖v‖^2 ≤ (fderiv ℝ (fderiv ℝ Φ) x v) v := by + let φ : E → ℝ := fun x => ψ x - q x + have hφ : ContDiff ℝ ∞ φ := hψ.sub hq + have h0 : φ 0 = 0 := by simp [φ,hj0] + have h1 : fderiv ℝ φ 0 = 0 := by + have hd : fderiv ℝ φ 0 = fderiv ℝ ψ 0 - fderiv ℝ q 0 := + fderiv_sub (hψ.differentiable (by simp) 0) (hq.differentiable (by simp) 0) + rw [hd,hj1,sub_self] + have h2 : fderiv ℝ (fderiv ℝ φ) 0 = 0 := by + rw [show φ = fun x => ψ x - q x from rfl,hessian_sub_map hψ hq,hj2,sub_self] + obtain ⟨P,hP,hPc,hPe,hPs,hPb⟩ := exists_small_patch hφ h0 h1 h2 (half_pos hc) hR + let Φ : E → ℝ := fun x => q x + P x + refine ⟨Φ,hq.add hP,?_,?_,?_,?_⟩ + · filter_upwards [hPe] with x hx + dsimp [Φ] + rw [hx] + dsimp [φ] + ring + · intro x hx + have hp : P x = 0 := image_eq_zero_of_notMem_tsupport (fun hh => hx (hPs hh)) + simp [Φ,hp] + · simpa only [Φ,add_sub_cancel_left] using hPc + · intro x v + rw [show Φ = fun y => q y + P y from rfl,hessian_add hq hP] + have hp := (neg_le_of_abs_le (by simpa only [Real.norm_eq_abs] using hPb x v)) + linarith [hconv x v] + +end DiagonalExtension.CutoffHessian + +open Set Filter +open scoped Topology ContDiff +namespace DiagonalExtension.SmoothExtension +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] + +theorem extend_local {f : E → ℝ} {U : Set E} {a : E} + (hU : IsOpen U) (ha : a ∈ U) (hf : ContDiffOn ℝ ∞ f U) : + ∃ g : E → ℝ, ContDiff ℝ ∞ g ∧ HasCompactSupport g ∧ g =ᶠ[𝓝 a] f := by + obtain ⟨r,hr,hrU⟩ := Metric.nhds_basis_closedBall.mem_iff.mp (hU.mem_nhds ha) + let b : ContDiffBump a := ⟨r/2,r,by positivity,by linarith⟩ + let g : E → ℝ := fun x => b x * f x + have hs : tsupport g ⊆ tsupport b := by + apply closure_mono + intro x hx + simp only [Function.mem_support,g] at * + exact fun hb => hx (by simp [hb]) + refine ⟨g,?_,b.hasCompactSupport.of_isClosed_subset isClosed_closure hs,?_⟩ + · rw [contDiff_iff_contDiffAt] + intro x + by_cases hx : x ∈ tsupport b + · have hxU : x ∈ U := hrU (by simpa [b.tsupport_eq,b] using hx) + exact b.contDiff.contDiffAt.mul (hf.contDiffAt (hU.mem_nhds hxU)) + · have he : b =ᶠ[𝓝 x] 0 := notMem_tsupport_iff_eventuallyEq.mp hx + have he' : g =ᶠ[𝓝 x] fun _ => 0 := by + filter_upwards [he] with y hy + simp [g,hy] + exact contDiffAt_const.congr_of_eventuallyEq he' + · filter_upwards [b.eventuallyEq_one] with x hx + simp [g,hx] +end DiagonalExtension.SmoothExtension + +open Filter +open scoped Topology ContDiff +namespace DiagonalExtension.QuadraticTaylor +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + + def polynomial (a : ℝ) (ℓ : E →L[ℝ] ℝ) (B : E →L[ℝ] E →L[ℝ] ℝ) (x : E) : ℝ := + a + ℓ x + (1/2 : ℝ) * B x x + +lemma smooth (a : ℝ) (ℓ : E →L[ℝ] ℝ) (B : E →L[ℝ] E →L[ℝ] ℝ) : + ContDiff ℝ ∞ (polynomial a ℓ B) := by + unfold polynomial + fun_prop + +lemma derivative (a : ℝ) (ℓ : E →L[ℝ] ℝ) (B : E →L[ℝ] E →L[ℝ] ℝ) + (hB : ∀ v w, B v w = B w v) (x : E) : + HasFDerivAt (polynomial a ℓ B) (ℓ + B x) x := by + have hq : HasFDerivAt (fun y => (1/2 : ℝ) * B y y) (B x) x := by + convert! ((B.hasFDerivAt).clm_apply (hasFDerivAt_id x)).const_mul (1/2 : ℝ) using 1 + ext v + simp [hB x v] + ring + exact (ℓ.hasFDerivAt.const_add a).add hq + +lemma fderiv_polynomial (a : ℝ) (ℓ : E →L[ℝ] ℝ) (B : E →L[ℝ] E →L[ℝ] ℝ) + (hB : ∀ v w, B v w = B w v) : + fderiv ℝ (polynomial a ℓ B) = fun x => ℓ + B x := by + funext x + exact (derivative a ℓ B hB x).fderiv + +lemma hessian_polynomial (a : ℝ) (ℓ : E →L[ℝ] ℝ) (B : E →L[ℝ] E →L[ℝ] ℝ) + (hB : ∀ v w, B v w = B w v) (x : E) : + fderiv ℝ (fderiv ℝ (polynomial a ℓ B)) x = B := by + rw [fderiv_polynomial a ℓ B hB] + exact (B.hasFDerivAt.const_add ℓ).fderiv + +end DiagonalExtension.QuadraticTaylor + +open Filter +open scoped Topology ContDiff +namespace DiagonalExtension.ConvexNeighborhood +open CutoffHessian QuadraticTaylor +variable {E : Type} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] + +def taylor2 (f : E → ℝ) : E → ℝ := + polynomial (f 0) (fderiv ℝ f 0) (fderiv ℝ (fderiv ℝ f) 0) + +theorem local_convex_extension {f : E → ℝ} {U : Set E} + (hU : IsOpen U) (h0 : (0 : E) ∈ U) (hf : ContDiffOn ℝ ∞ f U) + (hpos : ∀ v : E, v ≠ 0 → 0 < (fderiv ℝ (fderiv ℝ f) 0 v) v) + {R : ℝ} (hR : 0 < R) : + ∃ c : ℝ, 0 < c ∧ ∃ Φ : E → ℝ, ContDiff ℝ ∞ Φ ∧ + Φ =ᶠ[𝓝 0] f ∧ (∀ x ∉ Metric.ball 0 R, Φ x = taylor2 f x) ∧ + HasCompactSupport (fun x => Φ x - taylor2 f x) ∧ + ∀ x v, c * ‖v‖^2 ≤ (fderiv ℝ (fderiv ℝ Φ) x v) v := by + obtain ⟨g,hg,_,he⟩ := SmoothExtension.extend_local hU h0 hf + have he0 : g 0 = f 0 := he.eq_of_nhds + have he1 : fderiv ℝ g 0 = fderiv ℝ f 0 := he.fderiv_eq + have he2 : fderiv ℝ (fderiv ℝ g) 0 = fderiv ℝ (fderiv ℝ f) 0 := + (he.fderiv (𝕜 := ℝ)).fderiv_eq + have hsym : ∀ v w, (fderiv ℝ (fderiv ℝ g) 0 v) w = + (fderiv ℝ (fderiv ℝ g) 0 w) v := + hg.contDiffAt.isSymmSndFDerivAt (by + simp only [minSmoothness_of_isRCLikeNormedField] + exact WithTop.coe_le_coe.mpr le_top) + obtain ⟨c,hc,hcB⟩ := SmoothLevel.positive_quadratic_lower + (fderiv ℝ (fderiv ℝ g) 0) (by simpa only [he2] using hpos) + let q := taylor2 g + have hq : ContDiff ℝ ∞ q := smooth _ _ _ + have hj0 : g 0 = q 0 := by simp [q,taylor2,polynomial] + have hj1 : fderiv ℝ g 0 = fderiv ℝ q 0 := by + dsimp [q,taylor2] + rw [fderiv_polynomial _ _ _ hsym] + simp + have hj2 : fderiv ℝ (fderiv ℝ g) 0 = fderiv ℝ (fderiv ℝ q) 0 := + (hessian_polynomial _ _ _ hsym 0).symm + obtain ⟨Φ,hΦ,hΦe,hΦq,hΦc,hΦb⟩ := glue_convex hq hg hj0 hj1 hj2 hc hR + (fun x v => by simpa only [q,taylor2,hessian_polynomial _ _ _ hsym] using hcB v) + have hqeq : q = taylor2 f := by simp only [q,taylor2,he0,he1,he2] + refine ⟨c/2,half_pos hc,Φ,hΦ,hΦe.trans he,?_,?_,hΦb⟩ + · simpa only [hqeq] using hΦq + · simpa only [hqeq] using hΦc + +end DiagonalExtension.ConvexNeighborhood + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/GraphBounds.lean b/lean/OAI/Analysis/FourierExtension/GraphBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef45c7814f740968eff1f6e52551a43b7607c978 --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/GraphBounds.lean @@ -0,0 +1,124 @@ +import Mathlib +import OAI.Analysis.FourierExtension.RadialMeasure +import OAI.Analysis.FourierExtension.L2Fourier + +namespace OAI + +/-! Convex graph and affine Fourier bounds. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology +open Set Filter +open scoped ENNReal InnerProductSpace +open scoped FourierTransform SchwartzMap ENNReal +open scoped ENNReal FourierTransform InnerProductSpace +open MeasureTheory Set Filter +open scoped ContDiff Topology ENNReal + +namespace DiagonalExtension.ConvexRadial +open MeasureTheory Set +open scoped ENNReal ContDiff + +abbrev GraphSpace := WithLp 2 (E2 × ℝ) + +def graphEmbedding (φ : E2 → ℝ) (ξ : E2) : GraphSpace := + WithLp.toLp 2 (ξ, φ ξ) + +lemma graphEmbedding_continuous {φ : E2 → ℝ} (hφ : Continuous φ) : + Continuous (graphEmbedding φ) := + (WithLp.prod_continuous_toLp 2 E2 ℝ).comp (continuous_id.prodMk hφ) + +lemma graphEmbedding_pairMap (φ : E2 → ℝ) : + GraphFourier.pairMap (graphEmbedding φ) = WithLp.toLp 2 ∘ pairGraph φ := by + ext point + rfl + +lemma graphEmbedding_pairMap_le {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) + {c : ℝ} (hc : 0 < c) (hell : ∀ x v : E2, + c * ‖v‖ ^ 2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) : + Measure.map (GraphFourier.pairMap (graphEmbedding φ)) (volume.prod volume) ≤ + ENNReal.ofReal (Real.pi / c) • (volume : Measure GraphSpace) := by + rw [graphEmbedding_pairMap, ← Measure.map_map + (WithLp.prod_continuous_toLp 2 E2 ℝ).measurable + (pairGraph_continuous hφ.continuous).measurable] + have H := Measure.map_mono (pairGraph_map_le hφ hc hell) + (WithLp.prod_continuous_toLp 2 E2 ℝ).measurable + simpa only [Measure.map_smul _ (WithLp.prod_continuous_toLp 2 E2 ℝ).measurable.aemeasurable, + (WithLp.volume_preserving_toLp E2 ℝ).map_eq] using H + +theorem convex_graph_L4 {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) + {c : ℝ} (hc : 0 < c) (hell : ∀ x v : E2, + c * ‖v‖ ^ 2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) + {g : E2 → ℂ} (hg : MemLp g 2 volume) (hgc : HasCompactSupport g) : + MemLp (GraphFourier.transform (graphEmbedding φ) g) 4 volume ∧ + eLpNorm (GraphFourier.transform (graphEmbedding φ) g) 4 volume ≤ + ENNReal.ofReal (Real.pi / c) ^ (1 / 4 : ℝ) * eLpNorm g 2 volume := by + exact GraphFourier.memLp_four_and_bound (graphEmbedding_continuous hφ.continuous) + ENNReal.ofReal_ne_top (graphEmbedding_pairMap_le hφ hc hell) hg hgc + +end DiagonalExtension.ConvexRadial + +namespace DiagonalExtension.AffineGraph +open MeasureTheory Set ConvexRadial +open scoped ENNReal NNReal +variable {Y : Type*} [NormedAddCommGroup Y] [InnerProductSpace ℝ Y] + [FiniteDimensional ℝ Y] [MeasurableSpace Y] [BorelSpace Y] + +def haarFactor (A : GraphSpace ≃L[ℝ] Y) : ℝ≥0 := + Measure.addHaarScalarFactor (Measure.map A (volume : Measure GraphSpace)) (volume : Measure Y) + +lemma map_affine (A : GraphSpace ≃L[ℝ] Y) (a : Y) : + Measure.map (fun z => a + A z) (volume : Measure GraphSpace) = + (haarFactor A : ℝ≥0∞) • (volume : Measure Y) := by + have : Measure.IsAddHaarMeasure (Measure.map A (volume : Measure GraphSpace)) := + A.isAddHaarMeasure_map volume + have hA := Measure.isAddLeftInvariant_eq_smul + (Measure.map A (volume : Measure GraphSpace)) (volume : Measure Y) + have he : (fun z => a + A z) = (fun y : Y => a + y) ∘ A := rfl + have hm : Measurable (fun y : Y => a + y) := by fun_prop + rw [he, ← Measure.map_map hm A.continuous.measurable, + hA, Measure.map_smul _ hm.aemeasurable, Measure.IsAddLeftInvariant.map_add_left_eq_self] + rfl + +lemma pairMap_le (A : GraphSpace ≃L[ℝ] Y) (a : Y) + {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) {c : ℝ} (hc : 0 < c) + (hell : ∀ x v : E2, c * ‖v‖^2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) : + Measure.map (GraphFourier.pairMap (fun ξ => a + A (graphEmbedding φ ξ))) + (volume.prod volume) ≤ + (ENNReal.ofReal (Real.pi / c) * (haarFactor A : ℝ≥0∞)) • volume := by + have he : GraphFourier.pairMap (fun ξ => a + A (graphEmbedding φ ξ)) = + (fun z => (a+a) + A z) ∘ GraphFourier.pairMap (graphEmbedding φ) := by + ext z + simp only [GraphFourier.pairMap, Function.comp_apply, map_add] + abel + have hm : Measurable (fun z : GraphSpace => (a+a) + A z) := by fun_prop + rw [he, ← Measure.map_map hm + (GraphFourier.pairMap_continuous (graphEmbedding_continuous hφ.continuous)).measurable] + have H := Measure.map_mono (graphEmbedding_pairMap_le hφ hc hell) + hm + simpa only [Measure.map_smul _ hm.aemeasurable, map_affine, smul_smul] using H + +theorem L4 (A : GraphSpace ≃L[ℝ] Y) (a : Y) + {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) {c : ℝ} (hc : 0 < c) + (hell : ∀ x v : E2, c * ‖v‖^2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) + {g : E2 → ℂ} (hg : MemLp g 2 volume) (hgc : HasCompactSupport g) : + MemLp (GraphFourier.transform (fun ξ => a + A (graphEmbedding φ ξ)) g) 4 volume ∧ + eLpNorm (GraphFourier.transform (fun ξ => a + A (graphEmbedding φ ξ)) g) 4 volume ≤ + (ENNReal.ofReal (Real.pi / c) * (haarFactor A : ℝ≥0∞)) ^ (1/4 : ℝ) * + eLpNorm g 2 volume := by + apply GraphFourier.memLp_four_and_bound + (continuous_const.add (A.continuous.comp (graphEmbedding_continuous hφ.continuous))) + (by finiteness) (pairMap_le A a hφ hc hell) hg hgc + +end DiagonalExtension.AffineGraph + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/GraphCharts.lean b/lean/OAI/Analysis/FourierExtension/GraphCharts.lean new file mode 100644 index 0000000000000000000000000000000000000000..94f86b2560e2850321b9a2543982e616c321b110 --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/GraphCharts.lean @@ -0,0 +1,121 @@ +import Mathlib +import OAI.Analysis.FourierExtension.SmoothCharts +import OAI.Analysis.FourierExtension.ConvexExtension + +namespace OAI + +/-! Local convex graph coordinates for curved surfaces. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology +open Set Filter + +namespace DiagonalExtension.SmoothLevel +abbrev Ambient := EuclideanSpace ℝ (Fin 3) +abbrev Plane := EuclideanSpace ℝ (Fin 2) + +lemma tangent_finrank (L : Ambient →L[ℝ] ℝ) (hL : L ≠ 0) : + Module.finrank ℝ L.ker = 2 := by + have hL' : L.toLinearMap ≠ 0 := by + intro he; apply hL; ext x; exact DFunLike.congr_fun he x + have hh := Module.Dual.finrank_ker_add_one_of_ne_zero hL' + have hdim : Module.finrank ℝ Ambient = 3 := by simp [Ambient] + rw [hdim] at hh + omega + +def tangentPlaneEquiv (L : Ambient →L[ℝ] ℝ) (hL : L ≠ 0) : L.ker ≃ₗᵢ[ℝ] Plane := + ((stdOrthonormalBasis ℝ L.ker).reindex (finCongr (tangent_finrank L hL))).repr + +end DiagonalExtension.SmoothLevel + +namespace DiagonalExtension.LocalGraph +open SmoothLevel Set Filter +open scoped Topology +abbrev Plane := EuclideanSpace ℝ (Fin 2) +abbrev Space := WithLp 2 (Plane × ℝ) + +def graph (φ : Plane → ℝ) (u : Plane) : Space := WithLp.toLp 2 (u,φ u) + +lemma hessian_comp_linear {V W : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] + [NormedAddCommGroup W] [NormedSpace ℝ W] {f : W → ℝ} (hf : ContDiff ℝ ∞ f) + (L : V →L[ℝ] W) (x v : V) : + (fderiv ℝ (fderiv ℝ (f ∘ L)) x v) v = + (fderiv ℝ (fderiv ℝ f) (L x) (L v)) (L v) := by + have h := congrArg (fun B => B ![v,v]) + (L.iteratedFDeriv_comp_right hf x (i := 2) (by exact WithTop.coe_le_coe.mpr le_top)) + simpa only [iteratedFDeriv_two_apply, ContinuousMultilinearMap.compContinuousLinearMap_apply, + Matrix.cons_val_zero,Matrix.cons_val_one] using h + +theorem exists_local_graph {S : Set E3} (hS : IsSurface S) {a : E3} (ha : a ∈ S) : + ∃ (A : Space ≃L[ℝ] E3) (φ : Plane → ℝ) (c R : ℝ) (V : Set E3), + 0 < c ∧ 0 < R ∧ ContDiff ℝ ∞ φ ∧ + (∀ x v, c * ‖v‖^2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) ∧ + IsOpen V ∧ a ∈ V ∧ + S ∩ V ⊆ (fun u => a + A (graph φ u)) '' Metric.closedBall 0 R := by + obtain ⟨U,F,G,n,h,c,r,hU,haU,hF,hG,hreg,hF0,hG0,hn,hc,hr,hh0,hd0, + hh,hlower,hiff,hbd⟩ := hS.exists_convex_chart ha + let K := (fderiv ℝ F a).ker + let e : K ≃ₗᵢ[ℝ] Plane := tangentPlaneEquiv (fderiv ℝ F a) hreg + let L : (K × ℝ) ≃L[ℝ] E3 := kernelNormalEquiv (fderiv ℝ F a) n hn + obtain ⟨c',hc',ψ,hψ,hψh,hψout,hψcomp,hψlower⟩ := + ConvexNeighborhood.local_convex_extension Metric.isOpen_ball + (Metric.mem_ball_self hr) hh (fun v hv => + lt_of_lt_of_le (mul_pos hc (sq_pos_of_ne_zero (norm_ne_zero_iff.mpr hv))) + (hlower 0 (Metric.mem_ball_self hr) v)) (by norm_num : (0:ℝ)<1) + let φ : Plane → ℝ := ψ ∘ e.symm + have hφ : ContDiff ℝ ∞ φ := hψ.comp e.symm.toContinuousLinearEquiv.contDiff + have hφlower (x v : Plane) : c' * ‖v‖^2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v := by + rw [show φ = ψ ∘ e.symm.toContinuousLinearEquiv.toContinuousLinearMap from rfl, + hessian_comp_linear hψ] + simpa only [ContinuousLinearEquiv.coe_coe, LinearIsometryEquiv.coe_toContinuousLinearEquiv, + LinearIsometryEquiv.norm_map] using hψlower (e.symm x) (e.symm v) + let A : Space ≃L[ℝ] E3 := + ((WithLp.prodContinuousLinearEquiv 2 ℝ Plane ℝ).trans + (e.symm.toContinuousLinearEquiv.prodCongr (ContinuousLinearEquiv.refl ℝ ℝ))).trans L + obtain ⟨s,hs,hse⟩ := Metric.eventually_nhds_iff.mp hψh + let R : ℝ := min r s / 2 + have hR : 0 < R := half_pos (lt_min hr hs) + have hRr : R < r := (half_lt_self (lt_min hr hs)).trans_le (min_le_left _ _) + have hRs : R < s := (half_lt_self (lt_min hr hs)).trans_le (min_le_right _ _) + let V : Set E3 := {y | ‖L.symm (y-a)‖ < R} + have hV : IsOpen V := isOpen_lt (by fun_prop) continuous_const + have haV : a ∈ V := by simpa [V] using hR + refine ⟨A,φ,c',R,V,hc',hR,hφ,hφlower,hV,haV,?_⟩ + rintro y ⟨hyS,hyV⟩ + let z : K × ℝ := L.symm (y-a) + have hzR : ‖z‖ < R := hyV + have hzr : z ∈ Metric.ball 0 r := by simpa only [Metric.mem_ball,dist_zero_right] using hzR.trans hRr + have hyEq : a + (z.1 : E3) + z.2 • n = y := by + have heq := L.apply_symm_apply (y-a) + change (z.1 : E3) + z.2 • n = y-a at heq + rw [add_assoc,heq] + abel + have hheight : z.2 = h z.1 := ((hiff z hzr).2.mp (by rwa [hyEq])).1 + have hz1 : ‖z.1‖ < R := (norm_fst_le z).trans_lt hzR + have hpatch : ψ z.1 = h z.1 := hse (by simpa only [dist_zero_right] using hz1.trans hRs) + refine ⟨e z.1,?_,?_⟩ + · simpa only [Metric.mem_closedBall,dist_zero_right,LinearIsometryEquiv.norm_map] + using hz1.le + · have heval : A (graph φ (e z.1)) = L z := by + simp only [A,graph,ContinuousLinearEquiv.trans_apply, + WithLp.prodContinuousLinearEquiv_apply,ContinuousLinearEquiv.prodCongr_apply, + ContinuousLinearEquiv.refl_apply,φ,Function.comp_apply, + LinearIsometryEquiv.coe_toContinuousLinearEquiv,LinearIsometryEquiv.symm_apply_apply] + rw [hpatch, ← hheight] + change a + A (graph φ (e z.1)) = y + rw [heval] + change a + ((z.1 : E3) + z.2 • n) = y + rwa [← add_assoc] + +end DiagonalExtension.LocalGraph + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/L2Fourier.lean b/lean/OAI/Analysis/FourierExtension/L2Fourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6497963badfa104289db1c5a9dd0d2e473bac9a --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/L2Fourier.lean @@ -0,0 +1,512 @@ +import Mathlib + +namespace OAI + +/-! Bounded pullback densities and graph Fourier L4 estimates. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology +open Set Filter + +open MeasureTheory Set +open scoped ENNReal InnerProductSpace +namespace DiagonalExtension.BoundedPullback + +variable {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] +variable {μ : Measure α} {ν : Measure β} {T : α → β} {K : ℝ≥0∞} + +lemma comp_memLp (hT : Measurable T) (hK : K ≠ (⊤ : ℝ≥0∞)) (h : Measure.map T μ ≤ K • ν) + (v : Lp ℂ 2 ν) : MemLp (fun x => v (T x)) 2 μ := + (((Lp.memLp v).of_measure_le_smul hK h).comp_of_map hT.aemeasurable) + +lemma comp_ae (hT : Measurable T) (h : Measure.map T μ ≤ K • ν) + {f g : β → ℂ} (hfg : f =ᵐ[ν] g) : (fun x => f (T x)) =ᵐ[μ] (fun x => g (T x)) := + ae_of_ae_map hT.aemeasurable ((Measure.absolutelyContinuous_of_le_smul h).ae_eq hfg) + +def pullbackLinear (hT : Measurable T) (hK : K ≠ (⊤ : ℝ≥0∞)) (h : Measure.map T μ ≤ K • ν) : + Lp ℂ 2 ν →ₗ[ℂ] Lp ℂ 2 μ where + toFun v := (comp_memLp hT hK h v).toLp (fun x => v (T x)) + map_add' v w := by + apply Lp.ext + filter_upwards [MemLp.coeFn_toLp (comp_memLp hT hK h (v + w)), + Lp.coeFn_add ((comp_memLp hT hK h v).toLp _) + ((comp_memLp hT hK h w).toLp _), + MemLp.coeFn_toLp (comp_memLp hT hK h v), + MemLp.coeFn_toLp (comp_memLp hT hK h w), + comp_ae hT h (Lp.coeFn_add v w)] with x hx ha hv hw hc + simpa only [Pi.add_apply, hx, ha, hv, hw] using hc + map_smul' a v := by + apply Lp.ext + filter_upwards [MemLp.coeFn_toLp (comp_memLp hT hK h (a • v)), + Lp.coeFn_smul a ((comp_memLp hT hK h v).toLp _), + MemLp.coeFn_toLp (comp_memLp hT hK h v), + comp_ae hT h (Lp.coeFn_smul a v)] with x hx ha hv hc + simpa only [Pi.smul_apply, hx, ha, hv, RingHom.id_apply] using hc + +lemma pullbackLinear_ae (hT : Measurable T) (hK : K ≠ (⊤ : ℝ≥0∞)) (h : Measure.map T μ ≤ K • ν) + (v : Lp ℂ 2 ν) : pullbackLinear hT hK h v =ᵐ[μ] fun x => v (T x) := + MemLp.coeFn_toLp (comp_memLp hT hK h v) + +lemma enorm_pullbackLinear_le (hT : Measurable T) (hK : K ≠ (⊤ : ℝ≥0∞)) + (h : Measure.map T μ ≤ K • ν) (v : Lp ℂ 2 ν) : + ‖pullbackLinear hT hK h v‖ₑ ≤ K ^ (1 / 2 : ℝ) * ‖v‖ₑ := by + simp only [Lp.enorm_def] + rw [eLpNorm_congr_ae (pullbackLinear_ae hT hK h v)] + change eLpNorm ((v : β → ℂ) ∘ T) 2 μ ≤ K ^ (1 / 2 : ℝ) * eLpNorm (v : β → ℂ) 2 ν + rw [← eLpNorm_map_measure ((Lp.memLp v).of_measure_le_smul hK h).aestronglyMeasurable + hT.aemeasurable] + convert eLpNorm_le_of_measure_le_smul (f := (v : β → ℂ)) (p := 2) h using 1 + norm_num + +lemma norm_pullbackLinear_le (hT : Measurable T) (hK : K ≠ (⊤ : ℝ≥0∞)) + (h : Measure.map T μ ≤ K • ν) (v : Lp ℂ 2 ν) : + ‖pullbackLinear hT hK h v‖ ≤ K.toReal ^ (1 / 2 : ℝ) * ‖v‖ := by + simp only [← toReal_enorm] + rw [ENNReal.toReal_rpow, ← ENNReal.toReal_mul] + exact ENNReal.toReal_mono (by simp [ENNReal.mul_eq_top, hK]) + (enorm_pullbackLinear_le hT hK h v) + +def pullback (hT : Measurable T) (hK : K ≠ (⊤ : ℝ≥0∞)) (h : Measure.map T μ ≤ K • ν) : + Lp ℂ 2 ν →L[ℂ] Lp ℂ 2 μ := + (pullbackLinear hT hK h).mkContinuous (K.toReal ^ (1 / 2 : ℝ)) + (norm_pullbackLinear_le hT hK h) + +lemma pullback_ae (hT : Measurable T) (hK : K ≠ (⊤ : ℝ≥0∞)) (h : Measure.map T μ ≤ K • ν) + (v : Lp ℂ 2 ν) : pullback hT hK h v =ᵐ[μ] fun x => v (T x) := + pullbackLinear_ae hT hK h v + +lemma norm_pullback_le (hT : Measurable T) (hK : K ≠ (⊤ : ℝ≥0∞)) (h : Measure.map T μ ≤ K • ν) : + ‖pullback hT hK h‖ ≤ K.toReal ^ (1 / 2 : ℝ) := + LinearMap.mkContinuous_norm_le _ (Real.rpow_nonneg ENNReal.toReal_nonneg _) _ + +theorem exists_density (hT : Measurable T) (hK : K ≠ (⊤ : ℝ≥0∞)) (h : Measure.map T μ ≤ K • ν) + (f : Lp ℂ 2 μ) : ∃ u : Lp ℂ 2 ν, + ‖u‖ ≤ K.toReal ^ (1 / 2 : ℝ) * ‖f‖ ∧ + ∀ v : Lp ℂ 2 ν, inner ℂ u v = ∫ x, inner ℂ (f x) (v (T x)) ∂μ := by + let A := pullback hT hK h + refine ⟨ContinuousLinearMap.adjoint A f, ?_, ?_⟩ + · calc + _ ≤ ‖ContinuousLinearMap.adjoint A‖ * ‖f‖ := ContinuousLinearMap.le_opNorm _ _ + _ = ‖A‖ * ‖f‖ := by rw [LinearIsometryEquiv.norm_map] + _ ≤ _ := mul_le_mul_of_nonneg_right (norm_pullback_le hT hK h) (norm_nonneg f) + · intro v + rw [ContinuousLinearMap.adjoint_inner_left, L2.inner_def] + apply integral_congr_ae + filter_upwards [pullback_ae hT hK h v] with x hx + rw [hx] + +end DiagonalExtension.BoundedPullback + +namespace DiagonalExtension.BoundedPullback +open MeasureTheory +open scoped ENNReal InnerProductSpace +variable {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] +variable {μ : Measure α} {ν : Measure β} {T : α → β} {K : ℝ≥0∞} + +theorem exists_density_mul (hT : Measurable T) (hK : K ≠ (⊤ : ℝ≥0∞)) (h : Measure.map T μ ≤ K • ν) + (f : Lp ℂ 2 μ) : ∃ u : Lp ℂ 2 ν, + ‖u‖ ≤ K.toReal ^ (1 / 2 : ℝ) * ‖f‖ ∧ + ∀ v : β → ℂ, MemLp v 2 ν → (∫ y, u y * v y ∂ν) = ∫ x, f x * v (T x) ∂μ := by + obtain ⟨u, hu, hident⟩ := exists_density hT hK h f + refine ⟨u, hu, ?_⟩ + intro v hv + have hcv : MemLp (fun y => star (v y)) 2 ν := hv.star + let cv := hcv.toLp (fun y => star (v y)) + have hcoe : (cv : β → ℂ) =ᵐ[ν] fun y => star (v y) := MemLp.coeFn_toLp hcv + have heq := congrArg (starRingEnd ℂ) (hident cv) + rw [L2.inner_def, ← integral_conj, ← integral_conj] at heq + convert heq using 1 + · apply integral_congr_ae + filter_upwards [hcoe] with y hy + simp [hy, RCLike.inner_apply, mul_comm] + · apply integral_congr_ae + filter_upwards [comp_ae hT h hcoe] with x hx + simp [hx, RCLike.inner_apply, mul_comm] + +lemma map_restrict_le_restrict {P : Set α} {S : Set β} (hP : MeasurableSet P) + (hS : MeasurableSet S) (hT : Measurable T) (himage : Set.MapsTo T P S) + (h : Measure.map T μ ≤ K • ν) : + Measure.map T (μ.restrict P) ≤ K • ν.restrict S := by + rw [← Measure.restrict_smul] + have hle : Measure.map T (μ.restrict P) ≤ Measure.map T μ := Measure.map_mono Measure.restrict_le_self hT + have hsupport : (Measure.map T (μ.restrict P)).restrict S = Measure.map T (μ.restrict P) := by + apply Measure.restrict_eq_self_of_ae_mem + change (Measure.map T (μ.restrict P)) Sᶜ = 0 + rw [Measure.map_apply hT hS.compl, Measure.restrict_apply' hP] + convert measure_empty (μ := μ) using 2 + exact Set.eq_empty_iff_forall_notMem.mpr fun x hx => hx.1 (himage hx.2) + rw [← hsupport] + exact Measure.restrict_mono (Set.Subset.refl _) (hle.trans h) + +end DiagonalExtension.BoundedPullback + +namespace DiagonalExtension.BoundedPullback +open MeasureTheory +open scoped ENNReal InnerProductSpace +variable {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] +variable {μ : Measure α} {ν : Measure β} {T : α → β} {K : ℝ≥0∞} + +lemma density_support (hT : Measurable T) (h : Measure.map T μ ≤ K • ν) + (f : Lp ℂ 2 μ) (u : Lp ℂ 2 ν) {S : Set β} (hS : MeasurableSet S) + (hf : ∀ᵐ x ∂μ, T x ∉ S → f x = 0) + (hident : ∀ v : Lp ℂ 2 ν, inner ℂ u v = ∫ x, inner ℂ (f x) (v (T x)) ∂μ) : + ∀ᵐ y ∂ν, y ∉ S → u y = 0 := by + classical + have ho : MemLp (Sᶜ.indicator (u : β → ℂ)) 2 ν := (Lp.memLp u).indicator hS.compl + let out := ho.toLp _ + have hout : (out : β → ℂ) =ᵐ[ν] Sᶜ.indicator (u : β → ℂ) := MemLp.coeFn_toLp ho + have hzero : inner ℂ u out = 0 := by + rw [hident] + apply integral_eq_zero_of_ae + filter_upwards [hf, comp_ae hT h hout] with x hx ho + by_cases hs : T x ∈ S + · simp [ho, hs] + · simp [hx hs] + have hself : inner ℂ out out = 0 := by + rw [← hzero, L2.inner_def, L2.inner_def] + apply integral_congr_ae + filter_upwards [hout] with y hy + by_cases hs : y ∈ S <;> simp [hy, hs] + have houtzero : out = 0 := (inner_self_eq_zero (𝕜 := ℂ)).mp hself + have hzae : (out : β → ℂ) =ᵐ[ν] 0 := by rw [houtzero]; exact Lp.coeFn_zero _ _ _ + filter_upwards [hout, hzae] with y hy hz + intro hs + simpa [hs] using hy.symm.trans hz + +theorem exists_integrable_density (hT : Measurable T) (hK : K ≠ (⊤ : ℝ≥0∞)) + (h : Measure.map T μ ≤ K • ν) (f : Lp ℂ 2 μ) {S : Set β} + (hS : MeasurableSet S) (hSf : ν S < (⊤ : ℝ≥0∞)) + (hf : ∀ᵐ x ∂μ, T x ∉ S → f x = 0) : + ∃ u : Lp ℂ 2 ν, Integrable (u : β → ℂ) ν ∧ + ‖u‖ ≤ K.toReal ^ (1 / 2 : ℝ) * ‖f‖ ∧ + (∀ᵐ y ∂ν, y ∉ S → u y = 0) ∧ + ∀ v : β → ℂ, MemLp v 2 ν → (∫ y, u y * v y ∂ν) = ∫ x, f x * v (T x) ∂μ := by + obtain ⟨u, hu, hid⟩ := exists_density hT hK h f + have hsupp := density_support hT h f u hS hf hid + have ha : (u : β → ℂ) =ᵐ[ν] S.indicator (u : β → ℂ) := by + filter_upwards [hsupp] with y hy + by_cases hs : y ∈ S + · simp [hs] + · simp [hs, hy hs] + have hint : Integrable (u : β → ℂ) ν := by + have huS : MemLp (u : β → ℂ) 2 (ν.restrict S) := (Lp.memLp u).restrict _ + have : IsFiniteMeasure (ν.restrict S) := ⟨by simpa using hSf⟩ + have hi := huS.integrable (by norm_num) + exact ((integrable_indicator_iff hS).mpr hi).congr ha.symm + refine ⟨u, hint, hu, hsupp, ?_⟩ + intro v hv + have hcv : MemLp (fun y => star (v y)) 2 ν := hv.star + let cv := hcv.toLp (fun y => star (v y)) + have hcoe : (cv : β → ℂ) =ᵐ[ν] fun y => star (v y) := MemLp.coeFn_toLp hcv + have heq := congrArg (starRingEnd ℂ) (hid cv) + rw [L2.inner_def, ← integral_conj, ← integral_conj] at heq + convert heq using 1 + · apply integral_congr_ae + filter_upwards [hcoe] with y hy + simp [hy, RCLike.inner_apply, mul_comm] + · apply integral_congr_ae + filter_upwards [comp_ae hT h hcoe] with x hx + simp [hx, RCLike.inner_apply, mul_comm] + +end DiagonalExtension.BoundedPullback + +namespace DiagonalExtension.BoundedPullback +open MeasureTheory +open scoped ENNReal InnerProductSpace +variable {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] +variable {μ : Measure α} {ν : Measure β} {T : α → β} {K : ℝ≥0∞} + +lemma density_bounded_test (f : Lp ℂ 2 μ) (u : Lp ℂ 2 ν) {S : Set β} + (hS : MeasurableSet S) (hSf : ν S < (⊤ : ℝ≥0∞)) + (hf : ∀ᵐ x ∂μ, T x ∉ S → f x = 0) (hu : ∀ᵐ y ∂ν, y ∉ S → u y = 0) + (hid : ∀ v : β → ℂ, MemLp v 2 ν → (∫ y, u y * v y ∂ν) = ∫ x, f x * v (T x) ∂μ) + {v : β → ℂ} (hv : AEStronglyMeasurable v ν) (C : ℝ) (hC : ∀ y, ‖v y‖ ≤ C) : + (∫ y, u y * v y ∂ν) = ∫ x, f x * v (T x) ∂μ := by + classical + have : IsFiniteMeasure (ν.restrict S) := ⟨by simpa using hSf⟩ + have hvi : MemLp (S.indicator v) 2 ν := by + rw [memLp_indicator_iff_restrict hS] + exact MemLp.of_bound hv.restrict C (Filter.Eventually.of_forall hC) + calc + _ = ∫ y, u y * S.indicator v y ∂ν := by + apply integral_congr_ae + filter_upwards [hu] with y hy + by_cases hs : y ∈ S + · simp [hs] + · simp [hs, hy hs] + _ = ∫ x, f x * S.indicator v (T x) ∂μ := hid _ hvi + _ = _ := by + apply integral_congr_ae + filter_upwards [hf] with x hx + by_cases hs : T x ∈ S + · simp [hs] + · simp [hs, hx hs] + +end DiagonalExtension.BoundedPullback + +open MeasureTheory +open scoped ENNReal InnerProductSpace +namespace DiagonalExtension.TensorL2 +variable {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] +variable {μ : Measure α} {ν : Measure β} [SFinite μ] [SFinite ν] + +omit [SFinite μ] in +lemma memLp_mul_prod {f : α → ℂ} {g : β → ℂ} (hf : MemLp f 2 μ) (hg : MemLp g 2 ν) : + MemLp (fun z : α × β => f z.1 * g z.2) 2 (μ.prod ν) := by + apply (memLp_two_iff_integrable_sq_norm + ((hf.aestronglyMeasurable.comp_fst).mul (hg.aestronglyMeasurable.comp_snd))).mpr + simpa only [Pi.mul_apply, norm_mul, mul_pow] using hf.norm.integrable_sq.mul_prod hg.norm.integrable_sq + +lemma norm_sq_toLp {γ : Type*} [MeasurableSpace γ] {m : Measure γ} + {f : γ → ℂ} (hf : MemLp f 2 m) : + ‖hf.toLp f‖ ^ 2 = ∫ x, ‖f x‖ ^ 2 ∂m := by + apply Complex.ofReal_injective + have hi : ((‖hf.toLp f‖ ^ 2 : ℝ) : ℂ) = inner ℂ (hf.toLp f) (hf.toLp f) := by simp + rw [hi, L2.inner_def, ← integral_complex_ofReal] + apply integral_congr_ae + filter_upwards [hf.coeFn_toLp] with x hx + simp [hx, inner_self_eq_norm_sq_to_K] + +lemma norm_mul_prod {f : α → ℂ} {g : β → ℂ} (hf : MemLp f 2 μ) (hg : MemLp g 2 ν) : + ‖(memLp_mul_prod hf hg).toLp (fun z : α × β => f z.1 * g z.2)‖ = + ‖hf.toLp f‖ * ‖hg.toLp g‖ := by + have hs : ‖(memLp_mul_prod hf hg).toLp (fun z : α × β => f z.1 * g z.2)‖ ^ 2 = + (‖hf.toLp f‖ * ‖hg.toLp g‖)^2 := by + simp only [mul_pow, norm_sq_toLp, norm_mul] + exact integral_prod_mul (fun x => ‖f x‖ ^ 2) (fun y => ‖g y‖ ^ 2) + nlinarith [norm_nonneg ((memLp_mul_prod hf hg).toLp (fun z : α × β => f z.1 * g z.2)), + mul_nonneg (norm_nonneg (hf.toLp f)) (norm_nonneg (hg.toLp g))] + +end DiagonalExtension.TensorL2 + +open MeasureTheory +open scoped FourierTransform SchwartzMap ENNReal +namespace DiagonalExtension.FourierCompatibility + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +lemma integral_fourier_swap {f : E → ℂ} (hf : Integrable f) (v : 𝓢(E, ℂ)) : + (∫ x, v x * 𝓕 f x) = ∫ x, 𝓕 v x * f x := by + have h := VectorFourier.integral_fourierIntegral_smul_eq_flip (L := innerₗ E) + Real.continuous_fourierChar continuous_inner hf (v.integrable (μ := volume)) + simp only [flip_innerₗ] at h + change (∫ x, 𝓕 f x * v x) = ∫ x, f x * 𝓕 (v : E → ℂ) x at h + simpa only [mul_comm, SchwartzMap.fourier_coe] using h + +theorem fourier_ae (f : Lp ℂ 2 (volume : Measure E)) (hf : Integrable (f : E → ℂ)) : + 𝓕 (f : E → ℂ) =ᵐ[volume] (𝓕 f : Lp ℂ 2 volume) := by + apply ae_eq_of_integral_contDiff_smul_eq + · exact (VectorFourier.fourierIntegral_continuous Real.continuous_fourierChar + (innerSL ℝ).continuous₂ hf).locallyIntegrable + · exact (Lp.memLp (𝓕 f)).locallyIntegrable (by norm_num) + intro g hg hgc + have hg₁ : HasCompactSupport (Complex.ofRealCLM ∘ g) := hgc.comp_left rfl + have hg₂ := Complex.ofRealCLM.contDiff.comp hg + let v : 𝓢(E, ℂ) := hg₁.toSchwartzMap hg₂ + have hd := congrArg (fun D : 𝓢'(E, ℂ) => D v) (Lp.fourier_toTemperedDistribution_eq f) + simp only [TemperedDistribution.fourier_apply, Lp.toTemperedDistribution_apply, + smul_eq_mul] at hd + calc + _ = ∫ x, v x * 𝓕 (f : E → ℂ) x := by simp [v, Complex.real_smul] + _ = ∫ x, 𝓕 v x * f x := integral_fourier_swap hf v + _ = ∫ x, v x * (𝓕 f : Lp ℂ 2 volume) x := hd + _ = _ := by simp [v, Complex.real_smul] + +lemma fourier_memLp {f : E → ℂ} (hf : Integrable f) (hf2 : MemLp f 2) : + MemLp (𝓕 f) 2 := by + have hcoe := MemLp.coeFn_toLp hf2 + have hF := fourier_ae (hf2.toLp f) (hf.congr hcoe.symm) + have he : 𝓕 (hf2.toLp f : E → ℂ) = 𝓕 f := by + ext x + rw [Real.fourier_eq, Real.fourier_eq] + apply integral_congr_ae + filter_upwards [hcoe] with y hy + rw [hy] + rw [he] at hF + exact MemLp.ae_eq hF.symm (Lp.memLp (𝓕 (hf2.toLp f))) + +end DiagonalExtension.FourierCompatibility + +open MeasureTheory Set +open scoped ENNReal FourierTransform InnerProductSpace +namespace DiagonalExtension.GraphFourier +variable {X E : Type*} [NormedAddCommGroup X] [InnerProductSpace ℝ X] + [FiniteDimensional ℝ X] [MeasurableSpace X] [BorelSpace X] + [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +def transform (Γ : X → E) (g : X → ℂ) (x : E) : ℂ := + ∫ ξ, g ξ * (Real.fourierChar (-inner ℝ (Γ ξ) x) : ℂ) + +def pairMap (Γ : X → E) (z : X × X) : E := Γ z.1 + Γ z.2 + +omit [InnerProductSpace ℝ X] [FiniteDimensional ℝ X] [MeasurableSpace X] [BorelSpace X] + [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma pairMap_continuous {Γ : X → E} (hΓ : Continuous Γ) : Continuous (pairMap Γ) := + (hΓ.comp continuous_fst).add (hΓ.comp continuous_snd) + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma character_continuous (x : E) : + Continuous (fun y : E => (Real.fourierChar (-inner ℝ y x) : ℂ)) := + (show Continuous (fun z : Circle => (z : ℂ)) from continuous_subtype_val).comp + (Real.continuous_fourierChar.comp (continuous_id.inner continuous_const).neg) + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma continuous_transform {Γ : X → E} (hΓ : Continuous Γ) {g : X → ℂ} + (hg : Integrable g) : Continuous (transform Γ g) := by + apply continuous_of_dominated + (fun x => hg.aestronglyMeasurable.mul ((character_continuous x).comp hΓ).aestronglyMeasurable) + (fun x => Filter.Eventually.of_forall (fun ξ => by + change ‖g ξ * (Real.fourierChar (-inner ℝ (Γ ξ) x) : ℂ)‖ ≤ ‖g ξ‖ + rw [norm_mul, Circle.norm_coe, mul_one])) hg.norm + apply Filter.Eventually.of_forall + intro ξ + exact continuous_const.mul ((show Continuous (fun z : Circle => (z : ℂ)) from continuous_subtype_val).comp + (Real.continuous_fourierChar.comp (continuous_const.inner continuous_id).neg)) + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma character_add (a b x : E) : + (Real.fourierChar (-inner ℝ (a + b) x) : ℂ) = + (Real.fourierChar (-inner ℝ a x) : ℂ) * (Real.fourierChar (-inner ℝ b x) : ℂ) := by + rw [inner_add_left, neg_add, AddChar.map_add_eq_mul, Circle.coe_mul] + +theorem square_density {Γ : X → E} (hΓ : Continuous Γ) {K : ℝ≥0∞} (hK : K ≠ (⊤ : ℝ≥0∞)) + (hmap : Measure.map (pairMap Γ) (volume.prod volume) ≤ K • volume) + {g : X → ℂ} (hg : MemLp g 2 volume) (hgc : HasCompactSupport g) : + ∃ u : Lp ℂ 2 (volume : Measure E), Integrable (u : E → ℂ) ∧ + ‖u‖ ≤ K.toReal ^ (1 / 2 : ℝ) * ‖hg.toLp g‖ ^ 2 ∧ + ∀ x : E, 𝓕 (u : E → ℂ) x = transform Γ g x ^ 2 := by + classical + let T := pairMap Γ + have hT : Continuous T := pairMap_continuous hΓ + let S := T '' (tsupport g ×ˢ tsupport g) + have hcomp : IsCompact S := (hgc.isCompact.prod hgc.isCompact).image hT + have hF := TensorL2.memLp_mul_prod hg hg + let F : Lp ℂ 2 (volume.prod volume) := hF.toLp (fun z : X × X => g z.1 * g z.2) + have hFeq : (F : X × X → ℂ) =ᵐ[volume.prod volume] fun z => g z.1 * g z.2 := + MemLp.coeFn_toLp hF + have hsupp : ∀ᵐ z ∂volume.prod volume, T z ∉ S → F z = 0 := by + filter_upwards [hFeq] with z hz + intro hout + rw [hz] + by_cases h1 : z.1 ∈ tsupport g + · have h2 : z.2 ∉ tsupport g := fun h2 => hout ⟨z, ⟨h1, h2⟩, rfl⟩ + simp [image_eq_zero_of_notMem_tsupport h2] + · simp [image_eq_zero_of_notMem_tsupport h1] + obtain ⟨u, hu1, hunorm, husupp, huid⟩ := BoundedPullback.exists_integrable_density + hT.measurable hK hmap F hcomp.measurableSet hcomp.measure_lt_top hsupp + refine ⟨u, hu1, ?_, ?_⟩ + · change ‖u‖ ≤ _ * ‖(TensorL2.memLp_mul_prod hg hg).toLp (fun z : X × X => g z.1 * g z.2)‖ at hunorm + rw [TensorL2.norm_mul_prod hg hg] at hunorm + simpa only [← sq] using hunorm + intro x + have hid := BoundedPullback.density_bounded_test F u hcomp.measurableSet + hcomp.measure_lt_top hsupp husupp huid + (character_continuous x).aestronglyMeasurable 1 (fun y => by simp only [Circle.norm_coe, le_rfl]) + rw [Real.fourier_eq] + calc + _ = ∫ y : E, u y * (Real.fourierChar (-inner ℝ y x) : ℂ) := by + apply integral_congr_ae + filter_upwards [] with y + simp [Circle.smul_def, mul_comm] + _ = ∫ z, F z * (Real.fourierChar (-inner ℝ (T z) x) : ℂ) ∂volume.prod volume := hid + _ = ∫ z : X × X, (g z.1 * (Real.fourierChar (-inner ℝ (Γ z.1) x) : ℂ)) * + (g z.2 * (Real.fourierChar (-inner ℝ (Γ z.2) x) : ℂ)) ∂volume.prod volume := by + apply integral_congr_ae + filter_upwards [hFeq] with z hz + rw [hz] + change (g z.1 * g z.2) * (Real.fourierChar (-inner ℝ (Γ z.1 + Γ z.2) x) : ℂ) = _ + rw [character_add] + ring + _ = transform Γ g x ^ 2 := by + simpa only [transform, pow_two] using (integral_prod_mul + (fun ξ => g ξ * (Real.fourierChar (-inner ℝ (Γ ξ) x) : ℂ)) + (fun ξ => g ξ * (Real.fourierChar (-inner ℝ (Γ ξ) x) : ℂ))) + +end DiagonalExtension.GraphFourier + +namespace DiagonalExtension.GraphFourier +open MeasureTheory Set +open scoped ENNReal FourierTransform InnerProductSpace +variable {X E : Type*} [NormedAddCommGroup X] [InnerProductSpace ℝ X] + [FiniteDimensional ℝ X] [MeasurableSpace X] [BorelSpace X] + [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +lemma integrable_compact_L2 {g : X → ℂ} (hg : MemLp g 2 volume) + (hgc : HasCompactSupport g) : Integrable g := + (integrableOn_iff_integrable_of_support_subset (subset_tsupport g)).mp + ((hg.locallyIntegrable (by norm_num)).integrableOn_isCompact hgc.isCompact) + +lemma eLpNorm'_square {α : Type*} [MeasurableSpace α] (μ : Measure α) (G : α → ℂ) : + eLpNorm' (fun point => G point ^ 2) 2 μ = (eLpNorm' G 4 μ) ^ (2 : ℝ) := by + calc + _ = eLpNorm' (fun point => ‖G point‖ ^ (2 : ℝ)) 2 μ := by + apply eLpNorm'_congr_norm_ae + filter_upwards [] with point + simp [norm_pow] + _ = _ := by + have identity := eLpNorm'_norm_rpow (μ := μ) G 2 2 (by norm_num) + norm_num at identity ⊢ + exact identity + +lemma eLpNorm_square {α : Type*} [MeasurableSpace α] (μ : Measure α) (G : α → ℂ) + (hG : AEStronglyMeasurable G μ) : + eLpNorm (fun point => G point ^ 2) 2 μ = (eLpNorm G 4 μ) ^ (2 : ℝ) := by + have hsquare : AEStronglyMeasurable (fun point => G point ^ 2) μ := hG.pow 2 + rw [eLpNorm_eq_eLpNorm' (by norm_num) (by norm_num) hsquare, + eLpNorm_eq_eLpNorm' (by norm_num) (by norm_num) hG] + norm_num only [ENNReal.toReal_ofNat] + exact eLpNorm'_square μ G + +theorem memLp_four_and_bound {Γ : X → E} (hΓ : Continuous Γ) {K : ℝ≥0∞} (hK : K ≠ (⊤ : ℝ≥0∞)) + (hmap : Measure.map (pairMap Γ) (volume.prod volume) ≤ K • volume) + {g : X → ℂ} (hg : MemLp g 2 volume) (hgc : HasCompactSupport g) : + MemLp (transform Γ g) 4 volume ∧ + eLpNorm (transform Γ g) 4 volume ≤ K ^ (1 / 4 : ℝ) * eLpNorm g 2 volume := by + obtain ⟨u, hu1, hub, hueq⟩ := square_density hΓ hK hmap hg hgc + have hG : AEStronglyMeasurable (transform Γ g) volume := + (continuous_transform hΓ (integrable_compact_L2 hg hgc)).aestronglyMeasurable + have hFae : (fun x => transform Γ g x ^ 2) =ᵐ[volume] (𝓕 u : Lp ℂ 2 volume) := by + convert FourierCompatibility.fourier_ae u hu1 using 1 + ext x + exact (hueq x).symm + have htwo : MemLp (fun x => transform Γ g x ^ 2) 2 volume := + MemLp.ae_eq hFae.symm (Lp.memLp (𝓕 u)) + have hfour : MemLp (transform Γ g) 4 volume := by + have hn := htwo.norm + have hm := (memLp_norm_rpow_iff (p := 4) (q := 2) hG (by norm_num) (by norm_num)) + apply hm.mp + have h42 : (4 : ℝ≥0∞) / 2 = 2 := by + symm + apply (ENNReal.eq_div_iff (by norm_num) (by norm_num)).mpr + norm_num + simpa [h42] using hn + refine ⟨hfour, ?_⟩ + have hsq : eLpNorm (transform Γ g) 4 volume ^ (2 : ℝ) = ‖u‖ₑ := by + rw [← eLpNorm_square _ _ hG, eLpNorm_congr_ae hFae, ← Lp.enorm_def] + exact enorm_eq_iff_norm_eq.mpr (Lp.norm_fourier_eq u) + have hub' : ‖u‖ₑ ≤ K ^ (1 / 2 : ℝ) * (eLpNorm g 2 volume) ^ (2 : ℝ) := by + have hh := ENNReal.ofReal_le_ofReal hub + simpa only [ofReal_norm, ENNReal.ofReal_mul (Real.rpow_nonneg ENNReal.toReal_nonneg _), + ← ENNReal.ofReal_rpow_of_nonneg ENNReal.toReal_nonneg (by norm_num : (0:ℝ) ≤ 1/2), + ENNReal.ofReal_toReal hK, ENNReal.ofReal_pow (norm_nonneg _), ofReal_norm, + Lp.enorm_toLp, ENNReal.rpow_two] using hh + have hr := ENNReal.rpow_le_rpow (hsq ▸ hub') (by norm_num : (0:ℝ) ≤ 1/2) + simpa only [← ENNReal.rpow_mul, ENNReal.mul_rpow_of_nonneg _ _ (by norm_num : (0:ℝ) ≤ 1/2), + show (2:ℝ)*(1/2)=1 by norm_num, show (1/2:ℝ)*(1/2)=1/4 by norm_num, + ENNReal.rpow_one] using hr + +end DiagonalExtension.GraphFourier + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/LocalizedFourier.lean b/lean/OAI/Analysis/FourierExtension/LocalizedFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..afcafa919b179f4447f52419dc60864e459c8da8 --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/LocalizedFourier.lean @@ -0,0 +1,289 @@ +import Mathlib + +namespace OAI + +/-! Uniform Fourier decay and localized Taylor amplitudes. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff + +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +namespace DiagonalExtension.UniformFourierDecay +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +theorem weighted_fourier_bound {f : E → ℂ} (hf : ContDiff ℝ ∞ f) + (hfc : HasCompactSupport f) (n : ℕ) {M : ℝ} (_hM : 0 ≤ M) + (hderiv : ∀ j ≤ n, ∫ y, ‖iteratedFDeriv ℝ j f y‖ ≤ M) (x : E) : + (1 + ‖x‖) ^ n * ‖𝓕 f x‖ ≤ (2 : ℝ) ^ n * (1 + 2 ^ n * (n + 1)) * M := by + have hint (k j : ℕ) : Integrable (fun y : E => ‖y‖ ^ k * ‖iteratedFDeriv ℝ j f y‖) := + (((continuous_norm.pow k).mul (hf.continuous_iteratedFDeriv (by exact WithTop.coe_le_coe.mpr le_top)).norm)).integrable_of_hasCompactSupport + (((hfc.iteratedFDeriv j).norm).mul_left) + have h0 : ‖𝓕 f x‖ ≤ M := by + exact (VectorFourier.norm_fourierIntegral_le_integral_norm Real.fourierChar volume (innerₗ E) f x).trans + (by simpa only [norm_iteratedFDeriv_zero] using hderiv 0 (Nat.zero_le n)) + have hw := Real.pow_mul_norm_iteratedFDeriv_fourier_le (K := (0 : ℕ∞)) (N := ⊤) + hf (fun k j _ _ => hint k j) (k := 0) (n := n) (by simp) (by simp) x + have hw' : ‖x‖ ^ n * ‖𝓕 f x‖ ≤ 2 ^ n * ((n + 1) * M) := by + simp only [pow_zero, zero_add, one_mul, norm_iteratedFDeriv_zero, + Nat.cast_zero, Finset.range_one, Finset.singleton_product, Finset.sum_map, Function.Embedding.sectR_apply, + mul_zero] at hw + refine hw.trans ?_ + apply mul_le_mul_of_nonneg_left _ (by positivity) + calc + _ ≤ ∑ j ∈ Finset.range (n + 1), M := by + apply Finset.sum_le_sum + intro j hj + exact hderiv j (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj)) + _ = _ := by simp + have hp : (1 + ‖x‖) ^ n ≤ 2 ^ n * (1 + ‖x‖ ^ n) := by + refine (add_pow_le (a := (1:ℝ)) (b := ‖x‖) (by positivity) (norm_nonneg _) n).trans ?_ + simp only [one_pow] + gcongr + · norm_num + · omega + calc + _ ≤ 2 ^ n * (1 + ‖x‖ ^ n) * ‖𝓕 f x‖ := mul_le_mul_of_nonneg_right hp (norm_nonneg _) + _ = 2 ^ n * (‖𝓕 f x‖ + ‖x‖ ^ n * ‖𝓕 f x‖) := by ring + _ ≤ 2 ^ n * (M + 2 ^ n * ((n + 1) * M)) := by gcongr + _ = _ := by ring + +end DiagonalExtension.UniformFourierDecay + +namespace DiagonalExtension.UniformFourierDecay +variable {P : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + +lemma iteratedFDeriv_section {F : P × E → ℂ} (hF : ContDiff ℝ ∞ F) + (p : P) (z : E) (j : ℕ) : + iteratedFDeriv ℝ j (fun y => F (p,y)) z = + (iteratedFDeriv ℝ j F (p,z)).compContinuousLinearMap + (fun _ => ContinuousLinearMap.inr ℝ P E) := by + let g : P × E → ℂ := fun q => F ((p,0) + q) + have hg : ContDiff ℝ ∞ g := hF.comp (contDiff_const.add contDiff_id) + have heq := (ContinuousLinearMap.inr ℝ P E).iteratedFDeriv_comp_right hg z + (i := j) (by exact WithTop.coe_le_coe.mpr le_top) + have ht := iteratedFDerivWithin_comp_add_left (𝕜 := ℝ) (f := F) (s := Set.univ) + j (p, (0:E)) ((0:P),z) + simp only [Set.vadd_set_univ, iteratedFDerivWithin_univ, Prod.mk_add_mk, + add_zero, zero_add] at ht + simp only [Function.comp_def, g, ContinuousLinearMap.inr_apply, + Prod.mk_add_mk, add_zero, zero_add] at heq + rw [show iteratedFDeriv ℝ j (fun q : P × E => F ((p,0) + q)) (0,z) = + iteratedFDeriv ℝ j F (p,z) from ht] at heq + exact heq + +lemma continuous_section_derivative {F : P × E → ℂ} (hF : ContDiff ℝ ∞ F) (j : ℕ) : + Continuous (fun q : P × E => iteratedFDeriv ℝ j (fun y => F (q.1,y)) q.2) := by + simp_rw [iteratedFDeriv_section hF] + exact (ContinuousMultilinearMap.compContinuousLinearMapL + (fun _ : Fin j => ContinuousLinearMap.inr ℝ P E)).continuous.comp + (hF.continuous_iteratedFDeriv (by exact WithTop.coe_le_coe.mpr le_top)) + +variable [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +theorem compact_uniform_decay {F : P × E → ℂ} (hF : ContDiff ℝ ∞ F) + {K : Set P} (hK : IsCompact K) {S : Set E} (hS : IsCompact S) + (hsupp : ∀ p ∈ K, tsupport (fun z => F (p,z)) ⊆ S) (n : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ p ∈ K, ∀ x : E, + (1 + ‖x‖) ^ n * ‖𝓕 (fun z => F (p,z)) x‖ ≤ C := by + have hb (j : ℕ) : ∃ C : ℝ, 0 ≤ C ∧ ∀ p ∈ K, + ∫ z, ‖iteratedFDeriv ℝ j (fun y => F (p,y)) z‖ ≤ C := by + obtain ⟨B,hB⟩ := (hK.prod hS).exists_bound_of_continuousOn + (continuous_section_derivative hF j).continuousOn + refine ⟨max B 0 * (volume S).toReal, by positivity, ?_⟩ + intro p hp + have hf : ContDiff ℝ ∞ (fun z => F (p,z)) := + hF.comp (contDiff_const.prodMk contDiff_id) + have hfc : HasCompactSupport (fun z => F (p,z)) := + hS.of_isClosed_subset isClosed_closure (hsupp p hp) + have hc : Continuous (fun z => ‖iteratedFDeriv ℝ j (fun y => F (p,y)) z‖) := + (hf.continuous_iteratedFDeriv (by exact WithTop.coe_le_coe.mpr le_top)).norm + rw [← setIntegral_eq_integral_of_forall_compl_eq_zero (s := S) (fun z hz => ?_)] + · calc + _ ≤ ∫ _ in S, max B 0 := by + apply setIntegral_mono_on (hc.continuousOn.integrableOn_compact hS) + (integrableOn_const hS.measure_lt_top.ne) hS.measurableSet + intro z hz + exact (hB (p,z) ⟨hp,hz⟩).trans (le_max_left _ _) + _ = _ := by simp [mul_comm, Measure.real_def] + · exact norm_eq_zero.mpr (Function.notMem_support.mp fun h => hz + (hsupp p hp (support_iteratedFDeriv_subset j h))) + choose B hB hbound using hb + let M := ∑ j ∈ Finset.range (n+1), B j + have hM : 0 ≤ M := Finset.sum_nonneg fun j _ => hB j + refine ⟨2 ^ n * (1 + 2 ^ n * (n+1)) * M, by positivity, ?_⟩ + intro p hp x + apply weighted_fourier_bound (hF.comp (contDiff_const.prodMk contDiff_id)) + (hS.of_isClosed_subset isClosed_closure (hsupp p hp)) n hM _ x + intro j hj + exact (hbound j p hp).trans (Finset.single_le_sum (fun i _ => hB i) + (Finset.mem_range.mpr (Nat.lt_succ_of_le hj))) + +end DiagonalExtension.UniformFourierDecay +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology +namespace DiagonalExtension.SmoothCompactIntegral +universe u +variable {P A B : Type u} + [NormedAddCommGroup P] [NormedSpace ℝ P] + [NormedAddCommGroup A] [NormedSpace ℝ A] + [NormedAddCommGroup B] [NormedSpace ℝ B] + +def paramDeriv (F : P × A → B) (q : P × A) : P →L[ℝ] B := + (fderiv ℝ F q).comp (ContinuousLinearMap.inl ℝ P A) + +lemma smooth_partial {F : P × A → B} (hF : ContDiff ℝ ∞ F) : + ContDiff ℝ ∞ (paramDeriv F) := + (hF.fderiv_right (by simp)).clm_comp contDiff_const + +lemma partial_hasFDerivAt {F : P × A → B} (hF : ContDiff ℝ ∞ F) (p : P) (a : A) : + HasFDerivAt (fun q => F (q,a)) (paramDeriv F (p,a)) p := by + convert ((hF.differentiable (by simp)) (p,a)).hasFDerivAt.comp p + ((hasFDerivAt_id (𝕜 := ℝ) p).prodMk (hasFDerivAt_const (𝕜 := ℝ) a p)) using 1 <;> rfl + +variable [FiniteDimensional ℝ P] [FiniteDimensional ℝ A] + [MeasurableSpace A] [BorelSpace A] +variable {μ : Measure A} [IsFiniteMeasureOnCompacts μ] + +lemma hasFDerivAt_integral {K : Set A} (hK : IsCompact K) {F : P × A → B} + (hF : ContDiff ℝ ∞ F) (p : P) : + HasFDerivAt (fun q => ∫ a in K, F (q,a) ∂μ) + (∫ a in K, paramDeriv F (p,a) ∂μ) p := by + have : IsFiniteMeasure (μ.restrict K) := ⟨by simpa using (hK.measure_lt_top (μ := μ))⟩ + obtain ⟨C,hC⟩ := ((isCompact_closedBall p 1).prod hK).exists_bound_of_continuousOn + (smooth_partial hF).continuous.continuousOn + refine hasFDerivAt_integral_of_dominated_of_fderiv_le + (s := closedBall p 1) (F' := fun q a => paramDeriv F (q,a)) (bound := fun _ => C) + (closedBall_mem_nhds p (by norm_num)) ?_ ?_ ?_ ?_ (integrable_const C) ?_ + · exact Filter.Eventually.of_forall fun q => + (hF.continuous.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable + · exact (hF.continuous.comp (continuous_const.prodMk continuous_id)).continuousOn.integrableOn_compact hK + · exact ((smooth_partial hF).continuous.comp + (continuous_const.prodMk continuous_id)).aestronglyMeasurable + · filter_upwards [ae_restrict_mem hK.measurableSet] with a ha + intro q hq + exact hC (q,a) ⟨hq,ha⟩ + · exact Filter.Eventually.of_forall fun a q _ => partial_hasFDerivAt hF q a + +private lemma smooth_integral_nat (n : ℕ) {K : Set A} (hK : IsCompact K) + {F : P × A → B} (hF : ContDiff ℝ ∞ F) : + ContDiff ℝ n (fun q => ∫ a in K, F (q,a) ∂μ) := by + induction n generalizing B with + | zero => + exact contDiff_zero.mpr (Differentiable.continuous + (fun p => (hasFDerivAt_integral hK hF p).differentiableAt)) + | succ n ih => + rw [Nat.cast_add, Nat.cast_one, contDiff_succ_iff_fderiv] + refine ⟨fun p => (hasFDerivAt_integral hK hF p).differentiableAt, by simp, ?_⟩ + have heq : fderiv ℝ (fun q => ∫ a in K, F (q,a) ∂μ) = + (fun q => ∫ a in K, paramDeriv F (q,a) ∂μ) := + funext fun p => (hasFDerivAt_integral hK hF p).fderiv + rw [heq] + exact ih (smooth_partial hF) + +theorem contDiff_integral {K : Set A} (hK : IsCompact K) {F : P × A → B} + (hF : ContDiff ℝ ∞ F) : ContDiff ℝ ∞ (fun q => ∫ a in K, F (q,a) ∂μ) := + contDiff_infty.mpr fun n => smooth_integral_nat n hK hF + +end DiagonalExtension.SmoothCompactIntegral + +namespace DiagonalExtension.PacketTaylor +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace +variable {E : Type} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] + +def remainder (φ : E → ℝ) (q : (E × ℝ) × E) : ℝ := + ∫ s in Set.Icc (0:ℝ) 1, (1-s) * + (fderiv ℝ (fderiv ℝ φ) (q.1.1 + (s*q.1.2) • q.2) q.2) q.2 + +lemma smooth_remainder {φ : E → ℝ} (hφ : ContDiff ℝ ∞ φ) : + ContDiff ℝ ∞ (remainder φ) := by + unfold remainder + apply SmoothCompactIntegral.contDiff_integral (μ := (volume : Measure ℝ)) + (F := fun q : ((E × ℝ) × E) × ℝ => (1-q.2) * + (fderiv ℝ (fderiv ℝ φ) (q.1.1.1 + (q.2*q.1.1.2) • q.1.2) q.1.2) q.1.2) + isCompact_Icc + have hH : ContDiff ℝ ∞ (fderiv ℝ (fderiv ℝ φ)) := + (hφ.fderiv_right (m := ∞) (by simp)).fderiv_right (by simp) + have hloc : ContDiff ℝ ∞ (fun q : ((E × ℝ) × E) × ℝ => + q.1.1.1 + (q.2*q.1.1.2) • q.1.2) := by fun_prop + exact (contDiff_const.sub contDiff_snd).mul + (((hH.comp hloc).clm_apply (contDiff_snd.comp contDiff_fst)).clm_apply + (contDiff_snd.comp contDiff_fst)) + +omit [FiniteDimensional ℝ E] in +lemma taylor_identity {φ : E → ℝ} (hφ : ContDiff ℝ ∞ φ) + (ν z : E) (δ : ℝ) : + φ (ν + δ • z) = φ ν + δ * (fderiv ℝ φ ν z) + δ^2 * remainder φ ((ν,δ),z) := by + have ht := map_add_eq_sum_add_integral_iteratedFDeriv (f := φ) (x := ν) (y := δ • z) + (n := 1) (fun _ _ => (hφ.of_le (by exact WithTop.coe_le_coe.mpr le_top)).contDiffAt) + simp only [Nat.reduceAdd, Finset.sum_range_succ, Finset.sum_range_zero, zero_add, + Nat.factorial_zero, Nat.factorial_one, Nat.cast_one, inv_one, one_smul, + iteratedFDeriv_zero_apply, iteratedFDeriv_one_apply, pow_one, + iteratedFDeriv_two_apply] at ht + rw [intervalIntegral.integral_of_le (by norm_num : (0:ℝ) ≤ 1), + ← integral_Icc_eq_integral_Ioc] at ht + simp only [smul_smul, map_smul, smul_apply, smul_eq_mul] at ht + rw [ht, remainder, ← integral_const_mul] + congr 1 + apply setIntegral_congr_fun measurableSet_Icc + intro s hs + ring + +abbrev Param (E : Type) := (E × ℝ) × (ℝ × (E × ℝ)) + +def amplitude (φ χ : E → ℝ) (q : Param E × E) : ℂ := + (χ q.2 : ℂ) * (χ (q.1.2.2.1 + q.1.2.2.2 • q.2) : ℂ) * + Complex.exp ((2 * Real.pi * (q.1.2.1 * remainder φ (q.1.1,q.2)) : ℝ) * Complex.I) + +lemma smooth_amplitude {φ χ : E → ℝ} (hφ : ContDiff ℝ ∞ φ) (hχ : ContDiff ℝ ∞ χ) : + ContDiff ℝ ∞ (amplitude φ χ) := by + have hr : ContDiff ℝ ∞ (fun q : Param E × E => remainder φ (q.1.1,q.2)) := + (smooth_remainder hφ).comp (by fun_prop) + have h1 : ContDiff ℝ ∞ (fun q : Param E × E => (χ q.2 : ℂ)) := + Complex.ofRealCLM.contDiff.comp (hχ.comp contDiff_snd) + have h2 : ContDiff ℝ ∞ (fun q : Param E × E => (χ (q.1.2.2.1 + q.1.2.2.2 • q.2) : ℂ)) := + Complex.ofRealCLM.contDiff.comp (hχ.comp (by fun_prop)) + have ht : ContDiff ℝ ∞ (fun q : Param E × E => q.1.2.1) := by fun_prop + have h3 : ContDiff ℝ ∞ (fun q : Param E × E => ((2 * Real.pi * (q.1.2.1 * remainder φ (q.1.1,q.2)) : ℝ) : ℂ)) := + Complex.ofRealCLM.contDiff.comp (contDiff_const.mul (ht.mul hr)) + exact (h1.mul h2).mul (((Complex.contDiff_exp : ContDiff ℂ ∞ Complex.exp).restrict_scalars ℝ).comp (h3.mul contDiff_const)) + +variable [MeasurableSpace E] [BorelSpace E] + +theorem normalized_locality {φ χ : E → ℝ} (hφ : ContDiff ℝ ∞ φ) + (hχ : ContDiff ℝ ∞ χ) (hχc : HasCompactSupport χ) (R A : ℝ) (L : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ ν δ τ a ρ, + ‖ν‖ ≤ R → δ ∈ Icc (0:ℝ) 1 → τ ∈ Icc (0:ℝ) 1 → + ‖a‖ ≤ A → ρ ∈ Icc (0:ℝ) 1 → ∀ x : E, + (1 + ‖x‖)^L * ‖𝓕 (fun z => amplitude φ χ (((ν,δ),(τ,(a,ρ))),z)) x‖ ≤ C := by + let K : Set (Param E) := (Metric.closedBall 0 R ×ˢ Icc 0 1) ×ˢ + (Icc 0 1 ×ˢ (Metric.closedBall 0 A ×ˢ Icc 0 1)) + have hK : IsCompact K := ((isCompact_closedBall 0 R).prod isCompact_Icc).prod + (isCompact_Icc.prod ((isCompact_closedBall 0 A).prod isCompact_Icc)) + have hsupp : ∀ p ∈ K, tsupport (fun z => amplitude φ χ (p,z)) ⊆ tsupport χ := by + intro p hp + apply closure_mono + intro z hz + simp only [Function.mem_support] at * + intro h + apply hz + simp [amplitude,h] + obtain ⟨C,hC,h⟩ := UniformFourierDecay.compact_uniform_decay (smooth_amplitude hφ hχ) + hK hχc hsupp L + refine ⟨C,hC,?_⟩ + intro ν δ τ a ρ hν hδ hτ ha hρ x + apply h ((ν,δ),(τ,(a,ρ))) _ x + exact ⟨⟨by simpa using hν,hδ⟩,hτ,by simpa using ha,hρ⟩ + +end DiagonalExtension.PacketTaylor + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/LpEstimate.lean b/lean/OAI/Analysis/FourierExtension/LpEstimate.lean new file mode 100644 index 0000000000000000000000000000000000000000..adc9debb9d73255761fa5f0dcefb9d68f3239776 --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/LpEstimate.lean @@ -0,0 +1,140 @@ +import Mathlib +import OAI.Analysis.FourierExtension.SurfaceBound +import OAI.Analysis.FourierExtension.AutomaticBound + +namespace OAI + +/-! Diagonal estimates above four and the remaining low-exponent condition. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology +open Set Filter +open scoped ENNReal InnerProductSpace +open scoped FourierTransform SchwartzMap ENNReal +open scoped ENNReal FourierTransform InnerProductSpace +open MeasureTheory Set Filter +open scoped ContDiff Topology ENNReal +open scoped ENNReal NNReal +open MeasureTheory Filter +open scoped NNReal ENNReal Topology + +namespace DiagonalExtension +lemma memLp_above_four_of_bounded {α E : Type*} [MeasurableSpace α] + [NormedAddCommGroup E] {μ : Measure α} {g : α → E} + (hg : MemLp g 4 μ) {M p : ℝ} (hb : ∀ᵐ x ∂μ, ‖g x‖ ≤ M) (hp : 4 ≤ p) : + MemLp g (ENNReal.ofReal p) μ := by + have hp0 : 0 < p := by linarith + have he : p = (p-4)+4 := by ring + have ht : Integrable (fun x => ‖g x‖^(4 : ℕ)) μ := hg.integrable_norm_pow (by norm_num) + have hdom : Integrable (fun x => (max 1 M)^(p-4) * ‖g x‖^(4 : ℕ)) μ := ht.const_mul _ + have hpow : Integrable (fun x => ‖g x‖^p) μ := by + apply hdom.mono' (hg.aestronglyMeasurable.norm.aemeasurable.pow_const p).aestronglyMeasurable + filter_upwards [hb] with x hx + rw [Real.norm_of_nonneg (Real.rpow_nonneg (norm_nonneg _) _)] + calc + _ = ‖g x‖^(p-4) * ‖g x‖^(4 : ℕ) := by + conv_lhs => rw [he] + rw [Real.rpow_add_of_nonneg (norm_nonneg _) (by linarith) (by norm_num)] + norm_num + _ ≤ _ := mul_le_mul_of_nonneg_right + (Real.rpow_le_rpow (norm_nonneg _) (hx.trans (le_max_right 1 M)) (by linarith)) (by positivity) + apply (integrable_norm_rpow_iff hg.aestronglyMeasurable + (by simp [hp0] : ENNReal.ofReal p ≠ 0) ENNReal.ofReal_ne_top).mp + simpa only [ENNReal.toReal_ofReal hp0.le] using hpow + +theorem IsSurface.diagonal_extension_of_four_le {S : Set E3} (hS : IsSurface S) + {p : ℝ} (hp : 4 ≤ p) : + ∃ C : ℝ≥0, ∀ f : E3 → ℂ, + MemLp f (ENNReal.ofReal p) (surfaceMeasure S) → + MemLp (extension S f) (ENNReal.ofReal p) volume ∧ + eLpNorm (extension S f) (ENNReal.ofReal p) volume ≤ + (C : ℝ≥0∞) * eLpNorm f (ENNReal.ofReal p) (surfaceMeasure S) := by + have := hS.isFiniteMeasure + let q := ENNReal.ofReal p + have hq1 : (1 : ℝ≥0∞) ≤ q := by + simpa only [q,ENNReal.ofReal_one] using ENNReal.ofReal_le_ofReal (show (1 : ℝ) ≤ p by linarith) + have hq2 : (2 : ℝ≥0∞) ≤ q := by + simpa only [q,ENNReal.ofReal_ofNat] using ENNReal.ofReal_le_ofReal (show (2 : ℝ) ≤ p by linarith) + have : Fact (1 ≤ q) := ⟨hq1⟩ + obtain ⟨C4,hC4⟩ := hS.extension_L4 + have hmem (f : E3 → ℂ) (hf : MemLp f q (surfaceMeasure S)) : + MemLp (extension S f) q volume := by + have hfi : Integrable f (surfaceMeasure S) := hf.integrable hq1 + exact memLp_above_four_of_bounded (hC4 f (hf.mono_exponent hq2)).1 + (Filter.Eventually.of_forall (norm_extension_le hfi)) hp + have hk (x : E3) : AEStronglyMeasurable (fun ξ => fourierCharacter (inner ℝ x ξ)) + (surfaceMeasure S) := + (continuous_fourierCharacter.comp (continuous_const.inner continuous_id)).aestronglyMeasurable + have hkb (x : E3) : ∀ᵐ ξ ∂surfaceMeasure S, ‖fourierCharacter (inner ℝ x ξ)‖ ≤ 1 := + Filter.Eventually.of_forall (fun _ => (norm_fourierCharacter _).le) + let T : E3 → Lp ℂ q (surfaceMeasure S) →L[ℂ] ℂ := + fun x => KernelLp.eval ENNReal.ofReal_ne_top (hk x) (hkb x) + have hT (v : Lp ℂ q (surfaceMeasure S)) : MemLp (fun x => T x v) q volume := + hmem (v : E3 → ℂ) (Lp.memLp v) + obtain ⟨C,hC⟩ := AutomaticBound.exists_bound T hT + refine ⟨C,fun f hf => ⟨hmem f hf,?_⟩⟩ + have he : (fun x => T x (hf.toLp f)) = extension S f := by + funext x + apply integral_congr_ae + filter_upwards [hf.coeFn_toLp] with ξ hξ + rw [hξ] + have hb := hC (hf.toLp f) + rw [he,Lp.enorm_toLp] at hb + exact hb + + + +theorem mainStatement_iff_low_exponent_memLp : + MainStatement ↔ + ∀ (S : Set E3), IsSurface S → ∀ p : ℝ, 3 < p → p < 4 → + ∀ f : E3 → ℂ, MemLp f (ENNReal.ofReal p) (surfaceMeasure S) → + MemLp (extension S f) (ENNReal.ofReal p) volume := by + constructor + · intro h S hS p hp _ f hf + obtain ⟨C, hC⟩ := h S hS p hp + exact (hC f hf).1 + · intro h S hS p hp + by_cases hp4 : 4 ≤ p + · exact hS.diagonal_extension_of_four_le hp4 + · have hmem := h S hS p hp (lt_of_not_ge hp4) + have := hS.isFiniteMeasure + let q := ENNReal.ofReal p + have hq1 : (1 : ℝ≥0∞) ≤ q := by + simpa only [q, ENNReal.ofReal_one] using + ENNReal.ofReal_le_ofReal (show (1 : ℝ) ≤ p by linarith) + have : Fact (1 ≤ q) := ⟨hq1⟩ + have hk (x : E3) : AEStronglyMeasurable + (fun ξ => fourierCharacter (inner ℝ x ξ)) (surfaceMeasure S) := + (continuous_fourierCharacter.comp + (continuous_const.inner continuous_id)).aestronglyMeasurable + have hkb (x : E3) : ∀ᵐ ξ ∂surfaceMeasure S, + ‖fourierCharacter (inner ℝ x ξ)‖ ≤ 1 := + Filter.Eventually.of_forall (fun _ => (norm_fourierCharacter _).le) + let T : E3 → Lp ℂ q (surfaceMeasure S) →L[ℂ] ℂ := + fun x => KernelLp.eval ENNReal.ofReal_ne_top (hk x) (hkb x) + have hT (v : Lp ℂ q (surfaceMeasure S)) : + MemLp (fun x => T x v) q volume := + hmem (v : E3 → ℂ) (Lp.memLp v) + obtain ⟨C, hC⟩ := AutomaticBound.exists_bound T hT + refine ⟨C, fun f hf => ⟨hmem f hf, ?_⟩⟩ + have he : (fun x => T x (hf.toLp f)) = extension S f := by + funext x + apply integral_congr_ae + filter_upwards [hf.coeFn_toLp] with ξ hξ + rw [hξ] + have hb := hC (hf.toLp f) + rw [he, Lp.enorm_toLp] at hb + exact hb + +end DiagonalExtension + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/MeasureFourier.lean b/lean/OAI/Analysis/FourierExtension/MeasureFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..806e2cdf005da07e444a8aadef9cecb5d7ac4895 --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/MeasureFourier.lean @@ -0,0 +1,106 @@ +import Mathlib + +namespace OAI + +/-! Fourier integrals over finite measurable covers. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology +open Set Filter +open scoped ENNReal InnerProductSpace +open scoped FourierTransform SchwartzMap ENNReal +open scoped ENNReal FourierTransform InnerProductSpace +open MeasureTheory Set Filter +open scoped ContDiff Topology ENNReal +open scoped ENNReal NNReal + +open MeasureTheory Set +open scoped ENNReal NNReal +namespace DiagonalExtension.MeasureFourier +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +def transform (μ : Measure E) (f : E → ℂ) (x : E) : ℂ := + ∫ y, f y * (Real.fourierChar (-inner ℝ y x) : ℂ) ∂μ + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma char_continuous (x : E) : + Continuous (fun y : E => (Real.fourierChar (-inner ℝ y x) : ℂ)) := + continuous_subtype_val.comp + (Real.continuous_fourierChar.comp (continuous_id.inner continuous_const).neg) + +omit [FiniteDimensional ℝ E] in +lemma integrand_integrable {μ : Measure E} {f : E → ℂ} (hf : Integrable f μ) (x : E) : + Integrable (fun y => f y * (Real.fourierChar (-inner ℝ y x) : ℂ)) μ := + hf.mul_bdd (char_continuous x).aestronglyMeasurable + (Filter.Eventually.of_forall (fun _ => le_of_eq (Circle.norm_coe _))) + +omit [FiniteDimensional ℝ E] in +lemma split {μ : Measure E} {f : E → ℂ} (hf : Integrable f μ) + {V : Set E} (hV : MeasurableSet V) : + transform μ f = transform (μ.restrict V) f + transform (μ.restrict Vᶜ) f := by + ext x + exact (integral_add_compl hV (integrand_integrable hf x)).symm + +theorem finite_cover {ι : Type*} (t : Finset ι) (V : ι → Set E) (C : ι → ℝ≥0) + (hV : ∀ i, MeasurableSet (V i)) {μ : Measure E} [IsFiniteMeasure μ] + (hloc : ∀ i ∈ t, ∀ ν : Measure E, ν ≤ μ.restrict (V i) → ∀ f : E → ℂ, + MemLp f 2 ν → MemLp (transform ν f) 4 volume ∧ + eLpNorm (transform ν f) 4 volume ≤ (C i : ℝ≥0∞) * eLpNorm f 2 ν) : + ∀ ν : Measure E, ν ≤ μ → (∀ᵐ y ∂ν, ∃ i ∈ t, y ∈ V i) → + ∀ f : E → ℂ, MemLp f 2 ν → + MemLp (transform ν f) 4 volume ∧ + eLpNorm (transform ν f) 4 volume ≤ + ((∑ i ∈ t, C i) : ℝ≥0∞) * eLpNorm f 2 ν := by + classical + induction t using Finset.induction_on with + | empty => + intro ν hν hcover f hf + have hν0 : ν = 0 := by + have hh : ∀ᵐ y ∂ν, False := by simpa using hcover + simpa using hh + have hz : transform (0 : Measure E) f = 0 := by + ext x; simp only [MeasureFourier.transform, integral_zero_measure, Pi.zero_apply] + rw [hν0, hz] + simp + | @insert i t hi ih => + intro ν hν hcover f hf + have : IsFiniteMeasure ν := isFiniteMeasure_of_le μ hν + have hfr : MemLp f 2 (ν.restrict (V i)) := hf.mono_measure Measure.restrict_le_self + have hfc : MemLp f 2 (ν.restrict (V i)ᶜ) := hf.mono_measure Measure.restrict_le_self + obtain ⟨hm1,hb1⟩ := hloc i (Finset.mem_insert_self _ _) _ + (Measure.restrict_mono_measure hν (V i)) f hfr + have hcover' : ∀ᵐ y ∂ν.restrict (V i)ᶜ, ∃ j ∈ t, y ∈ V j := by + rw [ae_restrict_iff' (hV i).compl] + filter_upwards [hcover] with y hy hnot + obtain ⟨j,hj,hyj⟩ := hy + rcases Finset.mem_insert.mp hj with rfl | hj + · exact (hnot hyj).elim + · exact ⟨j,hj,hyj⟩ + obtain ⟨hm2,hb2⟩ := ih (fun j hj => hloc j (Finset.mem_insert_of_mem hj)) + (ν.restrict (V i)ᶜ) (Measure.restrict_le_self.trans hν) hcover' f hfc + rw [split (hf.integrable (by norm_num)) (hV i)] + refine ⟨hm1.add hm2,?_⟩ + calc + _ ≤ eLpNorm (transform (ν.restrict (V i)) f) 4 volume + + eLpNorm (transform (ν.restrict (V i)ᶜ) f) 4 volume := + eLpNorm_add_le (by norm_num) + _ ≤ (C i : ℝ≥0∞) * eLpNorm f 2 (ν.restrict (V i)) + + ((∑ j ∈ t, C j) : ℝ≥0∞) * eLpNorm f 2 (ν.restrict (V i)ᶜ) := add_le_add hb1 hb2 + _ ≤ (C i : ℝ≥0∞) * eLpNorm f 2 ν + ((∑ j ∈ t, C j) : ℝ≥0∞) * eLpNorm f 2 ν := by + exact add_le_add (mul_le_mul_right (eLpNorm_mono_measure f Measure.restrict_le_self) _) + (mul_le_mul_right (eLpNorm_mono_measure f Measure.restrict_le_self) _) + _ = _ := by rw [← add_mul, Finset.sum_insert hi] + +end DiagonalExtension.MeasureFourier + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/RadialMeasure.lean b/lean/OAI/Analysis/FourierExtension/RadialMeasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f17e6d1809035c04df7befaaf1983548393115a --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/RadialMeasure.lean @@ -0,0 +1,296 @@ +import Mathlib + +namespace OAI + +/-! Radial pushforward estimates for convex phases. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology +open Set Filter +open scoped ENNReal InnerProductSpace +open scoped FourierTransform SchwartzMap ENNReal +open scoped ENNReal FourierTransform InnerProductSpace + +open MeasureTheory Set Filter +open scoped ContDiff Topology ENNReal +namespace DiagonalExtension.ConvexRadial + +abbrev E2 := EuclideanSpace ℝ (Fin 2) + +def symPhase (φ : E2 → ℝ) (m dir : E2) (r : ℝ) : ℝ := + φ (m + r • dir) + φ (m - r • dir) + +def symPhaseDeriv (φ : E2 → ℝ) (m dir : E2) (r : ℝ) : ℝ := + (fderiv ℝ φ (m + r • dir)) dir - (fderiv ℝ φ (m - r • dir)) dir + +lemma hasDerivAt_line (m dir : E2) (r : ℝ) : + HasDerivAt (fun s : ℝ => m + s • dir) dir r := by + simpa only [one_smul, id_eq] using! + ((hasDerivAt_id r).smul_const dir).const_add m + +lemma hasDerivAt_line_sub (m dir : E2) (r : ℝ) : + HasDerivAt (fun s : ℝ => m - s • dir) (-dir) r := by + simpa only [one_smul, id_eq, sub_eq_add_neg] using! + ((hasDerivAt_id r).smul_const dir).neg.const_add m + +lemma hasDerivAt_symPhase {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) + (m dir : E2) (r : ℝ) : + HasDerivAt (symPhase φ m dir) (symPhaseDeriv φ m dir r) r := by + have hd := hφ.differentiable (by simp) + simpa only [symPhase, symPhaseDeriv, map_neg, sub_eq_add_neg, Pi.add_apply, Function.comp_apply] using! + ((hd (m + r • dir)).hasFDerivAt.comp_hasDerivAt r (hasDerivAt_line m dir r)).add + ((hd (m - r • dir)).hasFDerivAt.comp_hasDerivAt r (hasDerivAt_line_sub m dir r)) + +lemma hasDerivAt_directional {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) + (m dir : E2) (r : ℝ) : + HasDerivAt (fun s : ℝ => (fderiv ℝ φ (m + s • dir)) dir) + ((fderiv ℝ (fderiv ℝ φ) (m + r • dir) dir) dir) r := by + have hd : ContDiff ℝ 1 (fderiv ℝ φ) := hφ.fderiv_right (by exact WithTop.coe_le_coe.mpr (show (1 : ℕ∞) + 1 ≤ ⊤ from le_top)) + have hdf : Differentiable ℝ (fderiv ℝ φ) := hd.differentiable (by norm_num) + have H₀ : HasFDerivAt (fderiv ℝ φ) (fderiv ℝ (fderiv ℝ φ) (m + r • dir)) + (m + r • dir) := (hdf (m + r • dir)).hasFDerivAt + have H₁ : HasDerivAt (fun s : ℝ => fderiv ℝ φ (m + s • dir)) + (fderiv ℝ (fderiv ℝ φ) (m + r • dir) dir) r := + H₀.comp_hasDerivAt r (hasDerivAt_line m dir r) + simpa only [map_zero, add_zero] using H₁.clm_apply (hasDerivAt_const r dir) + +lemma radial_deriv_lower {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) + {c : ℝ} (hell : ∀ x v : E2, + c * ‖v‖ ^ 2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) + (m : E2) {dir : E2} (hdir : ‖dir‖ = 1) {r : ℝ} (hr : 0 ≤ r) : + 2 * c * r ≤ symPhaseDeriv φ m dir r := by + let F : ℝ → ℝ := fun s => (fderiv ℝ φ (m + s • dir)) dir + have hF (s : ℝ) : HasDerivAt F + ((fderiv ℝ (fderiv ℝ φ) (m + s • dir) dir) dir) s := + hasDerivAt_directional hφ m dir s + have hc (s : ℝ) : c ≤ deriv F s := by + rw [(hF s).deriv] + simpa only [hdir, one_pow, mul_one] using hell (m + s • dir) dir + have H := mul_sub_le_image_sub_of_le_deriv (fun s => (hF s).differentiableAt) + hc (show -r ≤ r by linarith) + simpa only [F, neg_smul, ← sub_eq_add_neg, symPhaseDeriv, sub_neg_eq_add, + ← two_mul, mul_comm c, mul_assoc] using H + +lemma symPhase_continuous {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) (m dir : E2) : + Continuous (symPhase φ m dir) := + continuous_iff_continuousAt.mpr (fun r => (hasDerivAt_symPhase hφ m dir r).continuousAt) + +lemma symPhase_strictMonoOn {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) + {c : ℝ} (hc : 0 < c) (hell : ∀ x v : E2, + c * ‖v‖ ^ 2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) + (m : E2) {dir : E2} (hdir : ‖dir‖ = 1) : + StrictMonoOn (symPhase φ m dir) (Ici 0) := by + apply strictMonoOn_of_deriv_pos (convex_Ici (0 : ℝ)) + (symPhase_continuous hφ m dir).continuousOn + intro r hr + rw [interior_Ici, mem_Ioi] at hr + rw [(hasDerivAt_symPhase hφ m dir r).deriv] + exact (mul_pos (mul_pos (by norm_num) hc) hr).trans_le + (radial_deriv_lower hφ hell m hdir hr.le) + +lemma radial_lintegral_le {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) + {c : ℝ} (hc : 0 < c) (hell : ∀ x v : E2, + c * ‖v‖ ^ 2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) + (m : E2) {dir : E2} (hdir : ‖dir‖ = 1) (g : ℝ → ℝ≥0∞) : + ∫⁻ r in Ioi (0 : ℝ), ENNReal.ofReal r * g (symPhase φ m dir r) ≤ + ENNReal.ofReal ((2 * c)⁻¹) * ∫⁻ s : ℝ, g s := by + have hc2 : 0 < 2 * c := mul_pos (by norm_num) hc + have hmono := (symPhase_strictMonoOn hφ hc hell m hdir).mono Ioi_subset_Ici_self + have hchange := lintegral_image_eq_lintegral_abs_deriv_mul measurableSet_Ioi + (fun r (_ : r ∈ Ioi (0 : ℝ)) => (hasDerivAt_symPhase hφ m dir r).hasDerivWithinAt) + hmono.injOn g + have hcoe (r : ℝ) (hr : r ∈ Ioi (0 : ℝ)) : + ENNReal.ofReal r ≤ ENNReal.ofReal ((2 * c)⁻¹) * + ENNReal.ofReal |symPhaseDeriv φ m dir r| := by + rw [← ENNReal.ofReal_mul (inv_nonneg.mpr hc2.le)] + apply ENNReal.ofReal_le_ofReal + calc + r = (2 * c)⁻¹ * (2 * c * r) := by field_simp + _ ≤ (2 * c)⁻¹ * |symPhaseDeriv φ m dir r| := by + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr hc2.le) + exact (radial_deriv_lower hφ hell m hdir hr.le).trans (le_abs_self _) + calc + _ ≤ ∫⁻ r in Ioi (0 : ℝ), ENNReal.ofReal ((2 * c)⁻¹) * + (ENNReal.ofReal |symPhaseDeriv φ m dir r| * g (symPhase φ m dir r)) := by + apply lintegral_mono_ae + filter_upwards [ae_restrict_mem measurableSet_Ioi] with r hr + rw [← mul_assoc] + exact mul_le_mul_left (hcoe r hr) _ + _ = ENNReal.ofReal ((2 * c)⁻¹) * + ∫⁻ s in symPhase φ m dir '' Ioi (0 : ℝ), g s := by + rw [lintegral_const_mul' _ _ ENNReal.ofReal_ne_top, ← hchange] + _ ≤ _ := by gcongr; exact Measure.restrict_le_self + + + +def pairEquiv : (ℝ × ℝ) ≃ᵐ E2 := + MeasurableEquiv.finTwoArrow.symm.trans (MeasurableEquiv.toLp 2 (Fin 2 → ℝ)) + +lemma pairEquiv_measurePreserving : MeasurePreserving pairEquiv volume volume := by + exact (PiLp.volume_preserving_toLp (Fin 2)).comp + (volume_preserving_finTwoArrow ℝ).symm + +lemma pairEquiv_apply (p : ℝ × ℝ) : pairEquiv p = WithLp.toLp 2 ![p.1, p.2] := rfl + +lemma pairEquiv_continuous : Continuous pairEquiv := by + change Continuous (fun p : ℝ × ℝ => WithLp.toLp 2 ![p.1, p.2]) + exact (PiLp.continuous_toLp 2 (fun _ : Fin 2 => ℝ)).comp (by fun_prop) + +def direction (θ : ℝ) : E2 := pairEquiv (Real.cos θ, Real.sin θ) + +lemma direction_norm (θ : ℝ) : ‖direction θ‖ = 1 := by + have h : ‖direction θ‖ ^ 2 = 1 := by + simp only [EuclideanSpace.real_norm_sq_eq, direction, pairEquiv_apply, + Fin.sum_univ_two, Matrix.cons_val_zero, Matrix.cons_val_one] + nlinarith [Real.sin_sq_add_cos_sq θ] + nlinarith [norm_nonneg (direction θ)] + +lemma pairEquiv_polar (r θ : ℝ) : pairEquiv (polarCoord.symm (r, θ)) = r • direction θ := by + ext i + fin_cases i <;> simp [polarCoord_symm_apply, pairEquiv_apply, direction] + +lemma polar_lintegral_le {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) + {c : ℝ} (hc : 0 < c) (hell : ∀ x v : E2, + c * ‖v‖ ^ 2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) + (m : E2) {g : ℝ → ℝ≥0∞} (hg : Measurable g) : + ∫⁻ w : E2, g (φ (m + w) + φ (m - w)) ≤ + ENNReal.ofReal (Real.pi / c) * ∫⁻ s : ℝ, g s := by + let f : ℝ × ℝ → ℝ≥0∞ := fun p => g (φ (m + pairEquiv p) + φ (m - pairEquiv p)) + have hf : Measurable f := hg.comp <| Continuous.measurable <| + (hφ.continuous.comp (continuous_const.add pairEquiv_continuous)).add + (hφ.continuous.comp (continuous_const.sub pairEquiv_continuous)) + have hcomp : (∫⁻ w : E2, g (φ (m + w) + φ (m - w))) = ∫⁻ p, f p := + (pairEquiv_measurePreserving.lintegral_comp_emb pairEquiv.measurableEmbedding _).symm + rw [hcomp, ← lintegral_comp_polarCoord_symm f] + have hmeas : Measurable (fun p : ℝ × ℝ => ENNReal.ofReal p.1 * f (polarCoord.symm p)) := by + apply measurable_fst.ennreal_ofReal.mul + apply hf.comp + change Measurable (fun p : ℝ × ℝ => (p.1 * Real.cos p.2, p.1 * Real.sin p.2)) + fun_prop + rw [polarCoord_target] + change (∫⁻ p : ℝ × ℝ, ENNReal.ofReal p.1 * f (polarCoord.symm p) + ∂(volume.prod volume).restrict (Ioi (0 : ℝ) ×ˢ Ioo (-Real.pi) Real.pi)) ≤ _ + rw [← Measure.prod_restrict] + rw [lintegral_prod_symm _ hmeas.aemeasurable] + change (∫⁻ θ in Ioo (-Real.pi) Real.pi, + ∫⁻ r in Ioi (0 : ℝ), ENNReal.ofReal r * f (polarCoord.symm (r, θ))) ≤ _ + calc + _ = ∫⁻ θ in Ioo (-Real.pi) Real.pi, ∫⁻ r in Ioi (0 : ℝ), + ENNReal.ofReal r * g (symPhase φ m (direction θ) r) := by + simp only [f, pairEquiv_polar, symPhase] + _ ≤ ∫⁻ _θ in Ioo (-Real.pi) Real.pi, + ENNReal.ofReal ((2 * c)⁻¹) * ∫⁻ s : ℝ, g s := by + apply lintegral_mono + intro θ + exact radial_lintegral_le hφ hc hell m (direction_norm θ) g + _ = _ := by + rw [lintegral_const, Measure.restrict_apply_univ, Real.volume_Ioo] + rw [mul_comm _ (ENNReal.ofReal _), ← mul_assoc, + ← ENNReal.ofReal_mul (by linarith [Real.pi_pos] : 0 ≤ Real.pi - -Real.pi)] + congr 1 + congr 1 + field_simp + ring + + + +lemma pair_graph_lintegral_le {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) + {c : ℝ} (hc : 0 < c) (hell : ∀ x v : E2, + c * ‖v‖ ^ 2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) + {G : E2 × ℝ → ℝ≥0∞} (hG : Measurable G) : + ∫⁻ ξ : E2, ∫⁻ η : E2, G (ξ + η, φ ξ + φ η) ≤ + ENNReal.ofReal (Real.pi / c) * ∫⁻ u : E2 × ℝ, G u := by + have hswap : AEMeasurable + (Function.uncurry (fun ξ η : E2 => G (ξ + η, φ ξ + φ η))) + (volume.prod volume) := by + apply Measurable.aemeasurable + exact hG.comp ((continuous_fst.add continuous_snd).prodMk + ((hφ.continuous.comp continuous_fst).add (hφ.continuous.comp continuous_snd))).measurable + have hswap₂ : AEMeasurable + (Function.uncurry (fun η m : E2 => G (m, φ (m - η) + φ η))) + (volume.prod volume) := by + apply Measurable.aemeasurable + exact hG.comp (continuous_snd.prodMk + ((hφ.continuous.comp (continuous_snd.sub continuous_fst)).add + (hφ.continuous.comp continuous_fst))).measurable + calc + _ = ∫⁻ η : E2, ∫⁻ ξ : E2, G (ξ + η, φ ξ + φ η) := lintegral_lintegral_swap hswap + _ = ∫⁻ η : E2, ∫⁻ m : E2, G (m, φ (m - η) + φ η) := by + apply lintegral_congr + intro η + have hm : Measurable (fun m : E2 => G (m, φ (m - η) + φ η)) := by + apply hG.comp + exact (continuous_id.prodMk + ((hφ.continuous.comp (continuous_id.sub continuous_const)).add + continuous_const)).measurable + have H := (measurePreserving_add_right (volume : Measure E2) η).lintegral_comp hm + simpa only [add_sub_cancel_right] using H + _ = ∫⁻ m : E2, ∫⁻ η : E2, G (m, φ (m - η) + φ η) := lintegral_lintegral_swap hswap₂ + _ = ∫⁻ m : E2, ∫⁻ w : E2, + G (m, φ ((2 : ℝ)⁻¹ • m + w) + φ ((2 : ℝ)⁻¹ • m - w)) := by + apply lintegral_congr + intro m + have hm : Measurable (fun η : E2 => G (m, φ (m - η) + φ η)) := by + apply hG.comp + exact (continuous_const.prodMk + ((hφ.continuous.comp (continuous_const.sub continuous_id)).add hφ.continuous)).measurable + have H := ((measurePreserving_add_left (volume : Measure E2) ((2 : ℝ)⁻¹ • m)).comp + (Measure.measurePreserving_neg volume)).lintegral_comp hm + symm + convert H using 1 + congr 1 + ext w + dsimp only [Function.comp_apply] + have he : m - ((2 : ℝ)⁻¹ • m + -w) = (2 : ℝ)⁻¹ • m + w := by module + simp only [he, sub_eq_add_neg] + _ ≤ ∫⁻ m : E2, ENNReal.ofReal (Real.pi / c) * ∫⁻ s : ℝ, G (m, s) := by + apply lintegral_mono + intro m + exact polar_lintegral_le hφ hc hell ((2 : ℝ)⁻¹ • m) + (hG.comp (measurable_const.prodMk measurable_id)) + _ = _ := by + rw [lintegral_const_mul' _ _ ENNReal.ofReal_ne_top] + congr 1 + exact (lintegral_prod G hG.aemeasurable).symm + + + +def pairGraph (φ : E2 → ℝ) (z : E2 × E2) : E2 × ℝ := + (z.1 + z.2, φ z.1 + φ z.2) + +lemma pairGraph_continuous {φ : E2 → ℝ} (hφ : Continuous φ) : Continuous (pairGraph φ) := + (continuous_fst.add continuous_snd).prodMk + ((hφ.comp continuous_fst).add (hφ.comp continuous_snd)) + +lemma pairGraph_map_le {φ : E2 → ℝ} (hφ : ContDiff ℝ ∞ φ) + {c : ℝ} (hc : 0 < c) (hell : ∀ x v : E2, + c * ‖v‖ ^ 2 ≤ (fderiv ℝ (fderiv ℝ φ) x v) v) : + Measure.map (pairGraph φ) (volume.prod volume) ≤ + ENNReal.ofReal (Real.pi / c) • (volume : Measure (E2 × ℝ)) := by + refine Measure.le_iff.mpr fun s hs => ?_ + let G : E2 × ℝ → ℝ≥0∞ := s.indicator (fun _ => 1) + have hG : Measurable G := measurable_const.indicator hs + have H := pair_graph_lintegral_le hφ hc hell hG + have heq : (∫⁻ ξ : E2, ∫⁻ η : E2, G (ξ + η, φ ξ + φ η)) = + Measure.map (pairGraph φ) (volume.prod volume) s := by + change (∫⁻ ξ : E2, ∫⁻ η : E2, G (pairGraph φ (ξ, η))) = _ + rw [← lintegral_prod (μ := volume) (ν := volume) (fun z : E2 × E2 => G (pairGraph φ z)) + (hG.comp (pairGraph_continuous hφ.continuous).measurable).aemeasurable] + rw [← lintegral_map hG (pairGraph_continuous hφ.continuous).measurable] + simp [G, hs] + rw [heq] at H + simpa only [G, lintegral_indicator hs, lintegral_const, Measure.restrict_apply_univ, + one_mul, Measure.smul_apply, smul_eq_mul] using H + +end DiagonalExtension.ConvexRadial + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/SmoothCharts.lean b/lean/OAI/Analysis/FourierExtension/SmoothCharts.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f9b2618a14af9c3c4fefa62b6ff0953dc5f0cac --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/SmoothCharts.lean @@ -0,0 +1,418 @@ +import Mathlib +import OAI.Analysis.FourierExtension.Surface + +namespace OAI + +/-! Smooth regular levels and positively curved charts. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section + +open Filter +open scoped Topology ContDiff + +namespace DiagonalExtension.SmoothLevel +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +theorem exists_height [CompleteSpace E] {F : E → ℝ} {a : E} + (hF : ContDiffAt ℝ ∞ F a) (hreg : fderiv ℝ F a ≠ 0) : + ∃ (n : E) (h : (fderiv ℝ F a).ker → ℝ), + fderiv ℝ F a n = -1 ∧ ContDiffAt ℝ ∞ h 0 ∧ h 0 = 0 ∧ + fderiv ℝ h 0 = 0 ∧ + (∀ᶠ (v : (fderiv ℝ F a).ker) in 𝓝 0, + F (a + (v : E) + h v • n) = F a) ∧ + (∀ᶠ (z : (fderiv ℝ F a).ker × ℝ) in 𝓝 0, + F (a + (z.1 : E) + z.2 • n) = F a ↔ h z.1 = z.2) := by + let K := (fderiv ℝ F a).ker + have hnz : (fderiv ℝ F a).toLinearMap ≠ 0 := by + intro hh + apply hreg + ext x + exact DFunLike.congr_fun hh x + obtain ⟨n,hn⟩ := (LinearMap.range_eq_top.mp + (Module.Dual.range_eq_top_of_ne_zero hnz)) (-1) + change fderiv ℝ F a n = -1 at hn + let L : K × ℝ →L[ℝ] E := + K.subtypeL.comp (ContinuousLinearMap.fst ℝ K ℝ) + + (ContinuousLinearMap.snd ℝ K ℝ).smulRight n + let f : K × ℝ → ℝ := fun z => F (a + L z) + have hL : ∀ z : K × ℝ, L z = (z.1 : E) + z.2 • n := by intro z; rfl + have hf : ContDiffAt ℝ ∞ f 0 := by + have hg : ContDiffAt ℝ ∞ (fun z : K × ℝ => a + L z) 0 := by fun_prop + have hh : ContDiffAt ℝ ∞ F (a + L 0) := by simpa using hF + exact hh.comp 0 hg + have hdf : fderiv ℝ f 0 = (fderiv ℝ F a).comp L := by + have hh : HasFDerivAt F (fderiv ℝ F a) (a + L 0) := by + simpa using (hF.differentiableAt (by simp)).hasFDerivAt + exact (hh.comp 0 (L.hasFDerivAt.const_add a)).fderiv + have hdvert : fderiv ℝ f 0 ∘L ContinuousLinearMap.inr ℝ K ℝ = + -(ContinuousLinearMap.id ℝ ℝ) := by + rw [hdf] + ext + simp [L, hn] + have hdin : fderiv ℝ f 0 ∘L ContinuousLinearMap.inl ℝ K ℝ = 0 := by + rw [hdf] + ext v + simp [L] + have hv : (fderiv ℝ f 0 ∘L ContinuousLinearMap.inr ℝ K ℝ).IsInvertible := by + rw [hdvert] + apply ContinuousLinearMap.IsInvertible.of_inverse (g := -(ContinuousLinearMap.id ℝ ℝ)) <;> + ext <;> simp + let h := hf.implicitFunction (by simp) hv + refine ⟨n,h,hn,hf.contDiffAt_implicitFunction (by simp) hv, + hf.implicitFunction_apply_self (by simp) hv,?_,?_,?_⟩ + · simpa [hdin] using (hf.hasStrictFDerivAt_implicitFunction (by simp) hv).hasFDerivAt.fderiv + · simpa [f,h,hL, add_assoc] using + hf.eventually_apply_implicitFunction (by simp) hv + · simpa [f,h,hL, add_assoc] using + hf.eventually_apply_eq_iff_implicitFunction (by simp) hv + +variable {V : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] + +lemma second_level_equation {F : E → ℝ} {g : V → E} {b : V} {c : ℝ} + (hF : ContDiffAt ℝ ∞ F (g b)) (hg : ContDiffAt ℝ ∞ g b) + (he : (fun y => F (g y)) =ᶠ[𝓝 b] fun _ => c) (v w : V) : + fderiv ℝ F (g b) ((fderiv ℝ (fderiv ℝ g) b v) w) + + (fderiv ℝ (fderiv ℝ F) (g b) (fderiv ℝ g b v)) (fderiv ℝ g b w) = 0 := by + have hg1 := (hg.of_le (show (1 : ℕ∞ω) ≤ (∞ : ℕ∞ω) by simp)).eventually (by simp) + have hF1 := hg.continuousAt.eventually + ((hF.of_le (show (1 : ℕ∞ω) ≤ (∞ : ℕ∞ω) by simp)).eventually (by simp)) + have hq : (fun y => fderiv ℝ F (g y) (fderiv ℝ g y w)) =ᶠ[𝓝 b] fun _ => (0 : ℝ) := by + filter_upwards [hg1,hF1,he.fderiv (𝕜 := ℝ)] with y hgy hFy hy + have hch := fderiv_comp y (hFy.differentiableAt (by simp)) + (hgy.differentiableAt (by simp)) + have hyw := DFunLike.congr_fun hy w + rw [show (fun y => F (g y)) = F ∘ g from rfl, hch] at hyw + simpa using hyw + have hFD := (hF.fderiv_right (m := ∞) (by simp)).differentiableAt (by simp) + have hgD := (hg.fderiv_right (m := ∞) (by simp)).differentiableAt (by simp) + have hA := hFD.hasFDerivAt.comp b (hg.differentiableAt (by simp)).hasFDerivAt + have hB := (ContinuousLinearMap.apply ℝ E w).hasFDerivAt.comp b hgD.hasFDerivAt + have hd := (hA.clm_apply hB).fderiv + have hz := hq.fderiv_eq (𝕜 := ℝ) + simp only [Function.comp_apply, ContinuousLinearMap.apply_apply] at hd + rw [hd] at hz + have hh := DFunLike.congr_fun hz v + simpa using hh + +lemma height_hessian {F : E → ℝ} {a n : E} + (hF : ContDiffAt ℝ ∞ F a) (hn : fderiv ℝ F a n = -1) + {h : (fderiv ℝ F a).ker → ℝ} (hh : ContDiffAt ℝ ∞ h 0) + (hh0 : h 0 = 0) (hd0 : fderiv ℝ h 0 = 0) + (he : ∀ᶠ (v : (fderiv ℝ F a).ker) in 𝓝 0, + F (a + (v : E) + h v • n) = F a) + (v : (fderiv ℝ F a).ker) : + (fderiv ℝ (fderiv ℝ h) 0 v) v = + (fderiv ℝ (fderiv ℝ F) a (v : E)) (v : E) := by + let K := (fderiv ℝ F a).ker + let g : K → E := fun y => a + (y : E) + h y • n + have hg : ContDiffAt ℝ ∞ g 0 := by + exact (contDiffAt_const.add K.subtypeL.contDiff.contDiffAt).add + (hh.smul contDiffAt_const) + have hg0 : g 0 = a := by simp [g,hh0] + have hdg {y : K} (hy : DifferentiableAt ℝ h y) : + HasFDerivAt g (K.subtypeL + (fderiv ℝ h y).smulRight n) y := + (K.subtypeL.hasFDerivAt.const_add a).add (hy.hasFDerivAt.smul_const n) + have hdg0 : fderiv ℝ g 0 = K.subtypeL := by + simpa [hd0] using (hdg (hh.differentiableAt (by simp))).fderiv + let A : (K →L[ℝ] ℝ) →L[ℝ] K →L[ℝ] E := + (ContinuousLinearMap.smulRightL ℝ K E).flip n + have hnear : fderiv ℝ g =ᶠ[𝓝 0] fun y => K.subtypeL + A (fderiv ℝ h y) := by + filter_upwards [(hh.of_le (show (1 : ℕ∞ω) ≤ (∞ : ℕ∞ω) by simp)).eventually (by simp)] with y hy + change ContDiffAt ℝ 1 h y at hy + exact (hdg (hy.differentiableAt (by simp))).fderiv + have hD := ((hh.fderiv_right (m := ∞) (by simp)).differentiableAt + (by simp)).hasFDerivAt + have hA := (A.hasFDerivAt.comp 0 hD).const_add K.subtypeL + simp only [Function.comp_apply] at hA + have hsecond := hnear.fderiv_eq (𝕜 := ℝ) + rw [hA.fderiv] at hsecond + have hsecondv : (fderiv ℝ (fderiv ℝ g) 0 v) v = + ((fderiv ℝ (fderiv ℝ h) 0 v) v) • n := by + have hh := DFunLike.congr_fun (DFunLike.congr_fun hsecond v) v + simpa [A] using hh + have hEq := second_level_equation (g := g) (b := 0) + (by simpa only [hg0] using hF) hg he v v + rw [hg0,hdg0,hsecondv] at hEq + simp only [Submodule.subtypeL_apply, map_smul, hn, smul_eq_mul] at hEq + linarith + +end DiagonalExtension.SmoothLevel + +open Filter +open scoped Topology ContDiff +namespace DiagonalExtension.SmoothLevel +variable {V : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] [CompleteSpace V] + +lemma eventually_contDiffAt_implicit {f : V × ℝ → ℝ} {U : Set (V × ℝ)} + {u : V × ℝ} (hU : IsOpen U) (hu : u ∈ U) + (hf : ContDiffOn ℝ ∞ f U) + (hv : (fderiv ℝ f u ∘L ContinuousLinearMap.inr ℝ V ℝ).IsInvertible) + {h : V → ℝ} (hh : ContDiffAt ℝ ∞ h u.1) (hh0 : h u.1 = u.2) + (he : ∀ᶠ x in 𝓝 u.1, f (x,h x) = f u) : + ∀ᶠ x in 𝓝 u.1, ContDiffAt ℝ ∞ h x := by + have hfu : ContDiffAt ℝ ∞ f u := hf.contDiffAt (hU.mem_nhds hu) + have hc : ContinuousAt (fun x => (x,h x)) u.1 := continuousAt_id.prodMk hh.continuousAt + have hcu : Tendsto (fun x => (x,h x)) (𝓝 u.1) (𝓝 u) := by + change Tendsto (fun x => (x,h x)) (𝓝 u.1) (𝓝 (u.1,h u.1)) at hc + simpa only [hh0, Prod.eta] using hc + have hD : ContinuousAt (fun z => fderiv ℝ f z ∘L ContinuousLinearMap.inr ℝ V ℝ) u := + (hfu.fderiv_right (m := ∞) (by simp)).continuousAt.clm_comp continuousAt_const + have hinv : ∀ᶠ z in 𝓝 u, + (fderiv ℝ f z ∘L ContinuousLinearMap.inr ℝ V ℝ).IsInvertible := by + rcases hv with ⟨e,he⟩ + have heN := e.nhds + rw [he] at heN + exact hD.eventually heN + have hH := (hh.of_le (show (1 : ℕ∞ω) ≤ (∞ : ℕ∞ω) by simp)).eventually (by simp) + filter_upwards [hcu.eventually (hU.mem_nhds hu),hcu.eventually hinv,hH, + he.eventually_nhds,he] with x hxU hxv hxh hxe hxe0 + have hfx : ContDiffAt ℝ ∞ f (x,h x) := hf.contDiffAt (hU.mem_nhds hxU) + let k := hfx.implicitFunction (by simp) hxv + have hk : ContDiffAt ℝ ∞ k x := hfx.contDiffAt_implicitFunction (by simp) hxv + have hxc : ContinuousAt (fun y => (y,h y)) x := continuousAt_id.prodMk hxh.continuousAt + have hiff := hxc.eventually (hfx.eventually_apply_eq_iff_implicitFunction (by simp) hxv) + have heq : k =ᶠ[𝓝 x] h := by + filter_upwards [hxe,hiff] with y hy hyiff + exact hyiff.mp (hy.trans hxe0.symm) + exact hk.congr_of_eventuallyEq heq.symm + +end DiagonalExtension.SmoothLevel + +open Filter +open scoped Topology ContDiff +namespace DiagonalExtension.SmoothLevel +variable {V : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] + [FiniteDimensional ℝ V] + +lemma positive_quadratic_lower (B : V →L[ℝ] V →L[ℝ] ℝ) + (hB : ∀ v : V, v ≠ 0 → 0 < B v v) : + ∃ c : ℝ, 0 < c ∧ ∀ v : V, c * ‖v‖^2 ≤ B v v := by + obtain ⟨c,hc,hbound⟩ := (isCompact_sphere (0 : V) 1).exists_forall_le' + (f := fun v => B v v) (by fun_prop) + (a := (0 : ℝ)) (fun v hv => hB v (by + have hv' : ‖v‖ = 1 := by simpa using hv + intro he; simp [he] at hv')) + refine ⟨c,hc,fun v => ?_⟩ + by_cases hv : v = 0 + · simp [hv] + have hn : 0 < ‖v‖ := norm_pos_iff.mpr hv + have hu : ‖‖v‖⁻¹ • v‖ = 1 := by + rw [norm_smul, norm_inv, Real.norm_of_nonneg (norm_nonneg _), inv_mul_cancel₀ hn.ne'] + have hb := hbound (‖v‖⁻¹ • v) (by simpa using hu) + simp only [map_smul, smul_apply, smul_eq_mul] at hb + have hh := mul_le_mul_of_nonneg_right hb (sq_nonneg ‖v‖) + field_simp at hh + nlinarith + +variable {P : Type*} [TopologicalSpace P] {p : P} + +lemma eventually_quadratic_lower {B : P → V →L[ℝ] V →L[ℝ] ℝ} + (hB : ContinuousAt B p) (hp : ∀ v : V, v ≠ 0 → 0 < B p v v) : + ∃ c : ℝ, 0 < c ∧ ∀ᶠ x in 𝓝 p, ∀ v : V, c * ‖v‖^2 ≤ B x v v := by + obtain ⟨k,hk,hbound⟩ := positive_quadratic_lower (B p) hp + refine ⟨k/2,half_pos hk,?_⟩ + have he : ∀ᶠ x in 𝓝 p, ‖B x - B p‖ < k/2 := by + filter_upwards [hB.eventually (Metric.ball_mem_nhds (B p) (half_pos hk))] with x hx + change dist (B x) (B p) < k/2 at hx + rwa [dist_eq_norm (B x) (B p)] at hx + filter_upwards [he] with x hx + intro v + have heval : |B x v v - B p v v| ≤ ‖B x - B p‖ * ‖v‖^2 := by + calc + _ = ‖(B x - B p) v v‖ := by simp [Real.norm_eq_abs] + _ ≤ ‖(B x - B p) v‖ * ‖v‖ := ContinuousLinearMap.le_opNorm _ _ + _ ≤ (‖B x - B p‖ * ‖v‖) * ‖v‖ := by + gcongr; exact ContinuousLinearMap.le_opNorm _ _ + _ = _ := by ring + have hmul := mul_le_mul_of_nonneg_right hx.le (sq_nonneg ‖v‖) + have hab := (abs_le.mp (heval.trans hmul)).1 + have hh := hbound v + linarith + +end DiagonalExtension.SmoothLevel + +namespace DiagonalExtension.SmoothLevel +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] [CompleteSpace E] + +theorem exists_convex_height {F : E → ℝ} {a : E} {U : Set E} + (hU : IsOpen U) (ha : a ∈ U) (hF : ContDiffOn ℝ ∞ F U) + (hreg : fderiv ℝ F a ≠ 0) + (hpos : ∀ v : E, v ≠ 0 → fderiv ℝ F a v = 0 → + 0 < (fderiv ℝ (fderiv ℝ F) a v) v) : + ∃ (n : E) (h : (fderiv ℝ F a).ker → ℝ) (c r : ℝ), + 0 < c ∧ 0 < r ∧ fderiv ℝ F a n = -1 ∧ h 0 = 0 ∧ fderiv ℝ h 0 = 0 ∧ + ContDiffOn ℝ ∞ h (Metric.ball 0 r) ∧ + (∀ x ∈ Metric.ball 0 r, ∀ v : (fderiv ℝ F a).ker, + c * ‖v‖^2 ≤ (fderiv ℝ (fderiv ℝ h) x v) v) ∧ + (∀ (v : (fderiv ℝ F a).ker), v ∈ Metric.ball 0 r → F (a + (v : E) + h v • n) = F a) ∧ + (∀ z ∈ Metric.ball (0 : (fderiv ℝ F a).ker × ℝ) r, + a + (z.1 : E) + z.2 • n ∈ U ∧ + (F (a + (z.1 : E) + z.2 • n) = F a ↔ h z.1 = z.2)) := by + have hFa := hF.contDiffAt (hU.mem_nhds ha) + obtain ⟨n,h,hn,hh,hh0,hd0,he,hiff⟩ := exists_height hFa hreg + let K := (fderiv ℝ F a).ker + let L : K × ℝ →L[ℝ] E := + K.subtypeL.comp (ContinuousLinearMap.fst ℝ K ℝ) + + (ContinuousLinearMap.snd ℝ K ℝ).smulRight n + let g : K × ℝ → E := fun z => a + L z + let f : K × ℝ → ℝ := F ∘ g + have hg : ContDiff ℝ ∞ g := by dsimp [g]; fun_prop + have hg0 : g 0 = a := by simp [g] + have hfu : ContDiffOn ℝ ∞ f (g ⁻¹' U) := + hF.comp hg.contDiffOn (fun _ hx => hx) + have hf : ContDiffAt ℝ ∞ f 0 := + hfu.contDiffAt ((hU.preimage hg.continuous).mem_nhds (by simpa [hg0])) + have hdf : fderiv ℝ f 0 = (fderiv ℝ F a).comp L := by + have hhF : HasFDerivAt F (fderiv ℝ F a) (a + L 0) := by + simpa using (hFa.differentiableAt (by simp)).hasFDerivAt + exact (hhF.comp 0 (L.hasFDerivAt.const_add a)).fderiv + have hdvert : fderiv ℝ f 0 ∘L ContinuousLinearMap.inr ℝ K ℝ = + -(ContinuousLinearMap.id ℝ ℝ) := by + rw [hdf]; ext; simp [L,hn] + have hv : (fderiv ℝ f 0 ∘L ContinuousLinearMap.inr ℝ K ℝ).IsInvertible := by + rw [hdvert] + apply ContinuousLinearMap.IsInvertible.of_inverse (g := -(ContinuousLinearMap.id ℝ ℝ)) <;> + ext <;> simp + have hsmooth : ∀ᶠ x in 𝓝 (0 : K), ContDiffAt ℝ ∞ h x := + eventually_contDiffAt_implicit (hU.preimage hg.continuous) (by simpa [hg0]) + hfu hv hh hh0 (by simpa [f,g,L,add_assoc] using he) + have hD : ContinuousAt (fderiv ℝ (fderiv ℝ h)) (0 : K) := + ((hh.fderiv_right (m := ∞) (by simp)).fderiv_right (m := ∞) (by simp)).continuousAt + have hposh : ∀ v : K, v ≠ 0 → 0 < (fderiv ℝ (fderiv ℝ h) 0 v) v := by + intro v hv + rw [height_hessian hFa hn hh hh0 hd0 he] + exact hpos v (by intro h; apply hv; exact Subtype.ext h) v.property + obtain ⟨c,hc,hlower⟩ := eventually_quadratic_lower hD hposh + have hev : ∀ᶠ x in 𝓝 (0 : K), ContDiffAt ℝ ∞ h x ∧ + (∀ v : K, c * ‖v‖^2 ≤ (fderiv ℝ (fderiv ℝ h) x v) v) ∧ + F (a + (x : E) + h x • n) = F a := hsmooth.and (hlower.and he) + obtain ⟨r₁,hr₁,hr₁bound⟩ := Metric.eventually_nhds_iff.mp hev + have hez : ∀ᶠ z in 𝓝 (0 : K × ℝ), + a + (z.1 : E) + z.2 • n ∈ U ∧ + (F (a + (z.1 : E) + z.2 • n) = F a ↔ h z.1 = z.2) := by + have hnear : ∀ᶠ z in 𝓝 (0 : K × ℝ), g z ∈ U := by + have hcont : Tendsto g (𝓝 (0 : K × ℝ)) (𝓝 a) := by + have hx := hg.continuous.continuousAt (x := (0 : K × ℝ)) + change Tendsto g (𝓝 0) (𝓝 (g 0)) at hx + simpa only [hg0] using hx + exact hcont.eventually (hU.mem_nhds ha) + simpa [g,L,add_assoc] using hnear.and hiff + obtain ⟨r₂,hr₂,hr₂bound⟩ := Metric.eventually_nhds_iff.mp hez + refine ⟨n,h,c,min r₁ r₂,hc,lt_min hr₁ hr₂,hn,hh0,hd0,?_,?_,?_,?_⟩ + · intro x hx + exact (hr₁bound (lt_of_lt_of_le hx (min_le_left _ _))).1.contDiffWithinAt + · intro x hx + exact (hr₁bound (lt_of_lt_of_le hx (min_le_left _ _))).2.1 + · intro x hx + exact (hr₁bound (lt_of_lt_of_le hx (min_le_left _ _))).2.2 + · intro z hz + exact hr₂bound (lt_of_lt_of_le hz (min_le_right _ _)) + +end DiagonalExtension.SmoothLevel + +open scoped Topology ContDiff +namespace DiagonalExtension.SmoothLevel +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +def kernelNormalEquiv (L : E →L[ℝ] ℝ) (n : E) (hn : L n = -1) : + (L.ker × ℝ) ≃L[ℝ] E where + toFun z := (z.1 : E) + z.2 • n + invFun x := (⟨x + L x • n, by simp [hn]⟩, -L x) + left_inv z := by + apply Prod.ext + · apply Subtype.ext + simp [hn] + · simp [hn] + right_inv x := by simp + map_add' z w := by simp only [Prod.fst_add, Prod.snd_add, Submodule.coe_add, add_smul]; abel + map_smul' c z := by simp [smul_add, smul_smul] + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop + +@[simp] lemma kernelNormalEquiv_apply (L : E →L[ℝ] ℝ) (n : E) (hn : L n = -1) + (z : L.ker × ℝ) : kernelNormalEquiv L n hn z = (z.1 : E) + z.2 • n := rfl + +@[simp] lemma kernelNormalEquiv_symm_snd (L : E →L[ℝ] ℝ) (n : E) (hn : L n = -1) + (x : E) : ((kernelNormalEquiv L n hn).symm x).2 = -L x := rfl + +lemma kernelNormalEquiv_symm_fst (L : E →L[ℝ] ℝ) (n : E) (hn : L n = -1) + (x : E) : (((kernelNormalEquiv L n hn).symm x).1 : E) = x + L x • n := rfl + +end DiagonalExtension.SmoothLevel + +namespace DiagonalExtension +open SmoothLevel + +theorem IsSurface.exists_convex_chart {S : Set E3} (hS : IsSurface S) {a : E3} + (ha : a ∈ S) : + ∃ (U : Set E3) (F G : E3 → ℝ) (n : E3) + (h : (fderiv ℝ F a).ker → ℝ) (c r : ℝ), + IsOpen U ∧ a ∈ U ∧ ContDiffOn ℝ ∞ F U ∧ ContDiffOn ℝ ∞ G U ∧ + fderiv ℝ F a ≠ 0 ∧ F a = 0 ∧ 0 ≤ G a ∧ + fderiv ℝ F a n = -1 ∧ 0 < c ∧ 0 < r ∧ + h 0 = 0 ∧ fderiv ℝ h 0 = 0 ∧ + ContDiffOn ℝ ∞ h (Metric.ball 0 r) ∧ + (∀ x ∈ Metric.ball 0 r, ∀ v : (fderiv ℝ F a).ker, + c * ‖v‖^2 ≤ (fderiv ℝ (fderiv ℝ h) x v) v) ∧ + (∀ z ∈ Metric.ball (0 : (fderiv ℝ F a).ker × ℝ) r, + a + (z.1 : E3) + z.2 • n ∈ U ∧ + (a + (z.1 : E3) + z.2 • n ∈ S ↔ + z.2 = h z.1 ∧ 0 ≤ G (a + (z.1 : E3) + z.2 • n))) ∧ + (G a = 0 → fderiv ℝ (fun v : (fderiv ℝ F a).ker => + G (a + (v : E3) + h v • n)) 0 ≠ 0) := by + obtain ⟨U,F,G,hU,haU,hF,hG,hset,hreg,hbd,hpos⟩ := hS.2 a ha + have haFG : F a = 0 ∧ 0 ≤ G a := by + have hh : a ∈ S ∩ U := ⟨ha,haU⟩ + rw [hset] at hh + exact hh.2 + obtain ⟨n,h,c,r,hc,hr,hn,hh0,hd0,hh,hlower,he,hiff⟩ := + exists_convex_height hU haU hF hreg hpos + refine ⟨U,F,G,n,h,c,r,hU,haU,hF,hG,hreg,haFG.1,haFG.2,hn,hc,hr, + hh0,hd0,hh,hlower,?_,?_⟩ + · intro z hz + obtain ⟨hzU,hzif⟩ := hiff z hz + refine ⟨hzU,?_⟩ + have hmem : a + (z.1 : E3) + z.2 • n ∈ S ↔ + F (a + (z.1 : E3) + z.2 • n) = 0 ∧ + 0 ≤ G (a + (z.1 : E3) + z.2 • n) := by + constructor + · intro hx + have hh : a + (z.1 : E3) + z.2 • n ∈ S ∩ U := ⟨hx,hzU⟩ + rw [hset] at hh + exact hh.2 + · intro hx + have hh : a + (z.1 : E3) + z.2 • n ∈ S ∩ U := by + rw [hset] + exact ⟨hzU,hx⟩ + exact hh.1 + rw [hmem, ← haFG.1, hzif, eq_comm] + · intro hGa + let K := (fderiv ℝ F a).ker + let g : K → E3 := fun v => a + (v : E3) + h v • n + have hg0 : g 0 = a := by simp [g,hh0] + have hhAt : ContDiffAt ℝ ∞ h (0 : K) := + hh.contDiffAt (Metric.ball_mem_nhds 0 hr) + have hdg : HasFDerivAt g K.subtypeL (0 : K) := by + have hd := (K.subtypeL.hasFDerivAt.const_add a).add + ((hhAt.differentiableAt (by simp)).hasFDerivAt.smul_const n) + convert! hd using 1 + simp [hd0] + have hdG : HasFDerivAt G (fderiv ℝ G a) (g 0) := by + simpa [hg0] using ((hG.contDiffAt (hU.mem_nhds haU)).differentiableAt (by simp)).hasFDerivAt + have hcomp := (hdG.comp 0 hdg).fderiv + change fderiv ℝ (fun v : K => G (g v)) 0 = _ at hcomp + rw [show (fun v : K => G (a + (v : E3) + h v • n)) = (fun v => G (g v)) from rfl, + hcomp] + obtain ⟨v,hv,hGv⟩ := hbd hGa + intro hzero + have hval := DFunLike.congr_fun hzero (⟨v,hv⟩ : K) + exact hGv (by simpa using hval) + +end DiagonalExtension + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/Surface.lean b/lean/OAI/Analysis/FourierExtension/Surface.lean new file mode 100644 index 0000000000000000000000000000000000000000..42689b602bc3b5eb6ba75c473579973a61d4494f --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/Surface.lean @@ -0,0 +1,151 @@ +import Mathlib + +namespace OAI + +/-! Positively curved surfaces and their extension operators. -/ + + + +open MeasureTheory +open scoped NNReal ENNReal ContDiff + +noncomputable section + +namespace DiagonalExtension + +abbrev E3 := EuclideanSpace ℝ (Fin 3) + +def IsSurface (S : Set E3) : Prop := + IsCompact S ∧ ∀ ξ ∈ S, ∃ (U : Set E3) (F G : E3 → ℝ), + IsOpen U ∧ ξ ∈ U ∧ + ContDiffOn ℝ ∞ F U ∧ ContDiffOn ℝ ∞ G U ∧ + S ∩ U = {y ∈ U | F y = 0 ∧ 0 ≤ G y} ∧ + fderiv ℝ F ξ ≠ 0 ∧ + (G ξ = 0 → ∃ v : E3, fderiv ℝ F ξ v = 0 ∧ fderiv ℝ G ξ v ≠ 0) ∧ + (∀ v : E3, v ≠ 0 → fderiv ℝ F ξ v = 0 → + 0 < (fderiv ℝ (fderiv ℝ F) ξ v) v) + +def surfaceMeasure (S : Set E3) : Measure E3 := + (ENNReal.ofReal (Real.pi / 4) • (Measure.hausdorffMeasure 2 : Measure E3)).restrict S + +def fourierCharacter (t : ℝ) : ℂ := + Complex.exp ((2 * Real.pi * t : ℝ) * Complex.I) + +def extension (S : Set E3) (f : E3 → ℂ) (x : E3) : ℂ := + ∫ ξ, f ξ * fourierCharacter (inner ℝ x ξ) ∂surfaceMeasure S + +def MainStatement : Prop := + ∀ (S : Set E3), IsSurface S → ∀ p : ℝ, 3 < p → + ∃ C : ℝ≥0, ∀ f : E3 → ℂ, + MemLp f (ENNReal.ofReal p) (surfaceMeasure S) → + MemLp (extension S f) (ENNReal.ofReal p) volume ∧ + eLpNorm (extension S f) (ENNReal.ofReal p) volume ≤ + (C : ℝ≥0∞) * eLpNorm f (ENNReal.ofReal p) (surfaceMeasure S) + +open Set Filter +open scoped Topology + +theorem regular_level_finiteAt {F : E3 → ℝ} {F' : E3 →L[ℝ] ℝ} + {a : E3} {s : Set E3} (hF : HasStrictFDerivAt F F' a) (hF' : F' ≠ 0) + (hs : ∀ᶠ x in 𝓝[s] a, F x = F a) : + (Measure.hausdorffMeasure 2 : Measure E3).FiniteAtFilter (𝓝[s] a) := by + have hn : (F' : E3 →ₗ[ℝ] ℝ) ≠ 0 := by + intro h + exact hF' (ContinuousLinearMap.coe_injective h) + have hr : (F' : E3 →ₗ[ℝ] ℝ).range = ⊤ := + Module.Dual.range_eq_top_of_ne_zero hn + have hd : Module.finrank ℝ F'.ker = 2 := by + have h := Module.Dual.finrank_ker_add_one_of_ne_zero hn + simp only [finrank_euclideanSpace_fin] at h + omega + let e := hF.implicitToOpenPartialHomeomorph F F' hr + let g : F'.ker → E3 := hF.implicitFunction F F' hr (F a) + obtain ⟨K, V, hV, hLip⟩ := (hF.to_implicitFunction hr).exists_lipschitzOnWith + obtain ⟨r, hr0, hrV⟩ := Metric.nhds_basis_closedBall.mem_iff.mp hV + have harea : (Measure.hausdorffMeasure 2 : Measure F'.ker) + (Metric.closedBall 0 r) < ⊤ := by + have hd' : (2 : ℝ) = (Module.finrank ℝ F'.ker : ℝ) := by rw [hd]; norm_num + rw [hd'] + exact (isCompact_closedBall (0 : F'.ker) r).measure_lt_top + have himage : (Measure.hausdorffMeasure 2 : Measure E3) + (g '' Metric.closedBall 0 r) < ⊤ := by + refine ((hLip.mono hrV).hausdorffMeasure_image_le (by norm_num : (0:ℝ) ≤ 2)).trans_lt ?_ + exact ENNReal.mul_lt_top + (ENNReal.rpow_lt_top_of_nonneg (by norm_num) ENNReal.coe_ne_top) harea + refine ⟨g '' Metric.closedBall 0 r, ?_, himage⟩ + have he : ContinuousAt (fun x => (e x).2) a := + (e.continuousAt (hF.mem_implicitToOpenPartialHomeomorph_source hr)).snd + have hea : (e a).2 = 0 := by simp [e] + have heevent : ∀ᶠ x in 𝓝 a, (e x).2 ∈ Metric.closedBall 0 r := by + change ((fun x => (e x).2) ⁻¹' Metric.closedBall 0 r) ∈ 𝓝 a + have hh := he (Metric.closedBall_mem_nhds ((e a).2) hr0) + simpa only [hea, Filter.mem_map] using hh + filter_upwards [heevent.filter_mono nhdsWithin_le_nhds, + (hF.eq_implicitFunction hr).filter_mono nhdsWithin_le_nhds, hs] with x hx hx' hFx + refine ⟨(e x).2, hx, ?_⟩ + simpa only [g, e, hFx] using hx' + +theorem IsSurface.hausdorffMeasure_lt_top {S : Set E3} (hS : IsSurface S) : + (Measure.hausdorffMeasure 2 : Measure E3) S < ⊤ := by + apply hS.1.measure_lt_top_of_nhdsWithin + intro a ha + obtain ⟨U, F, G, hU, haU, hF, _, hEq, hFn, _, _⟩ := hS.2 a ha + have hFa : F a = 0 := by + have : a ∈ {y ∈ U | F y = 0 ∧ 0 ≤ G y} := hEq ▸ ⟨ha, haU⟩ + exact this.2.1 + apply regular_level_finiteAt + ((hF.contDiffAt (hU.mem_nhds haU)).hasStrictFDerivAt (by norm_num)) hFn + have hUnear : ∀ᶠ x in 𝓝 a, x ∈ U := hU.mem_nhds haU + filter_upwards [hUnear.filter_mono nhdsWithin_le_nhds, + self_mem_nhdsWithin] with x hxU hxS + have hx : x ∈ {y ∈ U | F y = 0 ∧ 0 ≤ G y} := hEq ▸ ⟨hxS, hxU⟩ + exact hx.2.1.trans hFa.symm + +theorem IsSurface.isFiniteMeasure {S : Set E3} (hS : IsSurface S) : + IsFiniteMeasure (surfaceMeasure S) := by + apply (isFiniteMeasure_iff _).2 + rw [surfaceMeasure, Measure.restrict_apply_univ, Measure.smul_apply] + exact ENNReal.mul_lt_top ENNReal.ofReal_lt_top hS.hausdorffMeasure_lt_top + +theorem IsSurface.integrable_of_memLp {S : Set E3} (hS : IsSurface S) + {p : ℝ} (hp : 3 < p) {f : E3 → ℂ} + (hf : MemLp f (ENNReal.ofReal p) (surfaceMeasure S)) : + Integrable f (surfaceMeasure S) := by + let := hS.isFiniteMeasure + apply hf.integrable + exact_mod_cast ENNReal.ofReal_le_ofReal (show (1 : ℝ) ≤ p by linarith) + +@[simp] +theorem norm_fourierCharacter (t : ℝ) : ‖fourierCharacter t‖ = 1 := + Complex.norm_exp_ofReal_mul_I _ + +theorem continuous_fourierCharacter : Continuous fourierCharacter := by + unfold fourierCharacter + fun_prop + +theorem extension_integrand_integrable {S : Set E3} {f : E3 → ℂ} + (hf : Integrable f (surfaceMeasure S)) (x : E3) : + Integrable (fun ξ => f ξ * fourierCharacter (inner ℝ x ξ)) (surfaceMeasure S) := by + apply hf.mul_bdd + ((continuous_fourierCharacter.comp (continuous_const.inner continuous_id)).aestronglyMeasurable) + exact Filter.Eventually.of_forall (fun ξ => le_of_eq (norm_fourierCharacter _)) + +theorem norm_extension_le {S : Set E3} {f : E3 → ℂ} + (hf : Integrable f (surfaceMeasure S)) (x : E3) : + ‖extension S f x‖ ≤ ∫ ξ, ‖f ξ‖ ∂surfaceMeasure S := by + apply norm_integral_le_of_norm_le hf.norm + exact Filter.Eventually.of_forall (fun ξ => by simp) + +theorem continuous_extension {S : Set E3} {f : E3 → ℂ} + (hf : Integrable f (surfaceMeasure S)) : Continuous (extension S f) := by + apply continuous_of_dominated + (fun x => (extension_integrand_integrable hf x).aestronglyMeasurable) + (fun x => Filter.Eventually.of_forall (fun ξ => by simp)) hf.norm + exact Filter.Eventually.of_forall (fun ξ => continuous_const.mul + (continuous_fourierCharacter.comp (continuous_id.inner continuous_const))) + +end DiagonalExtension + +end + +end OAI diff --git a/lean/OAI/Analysis/FourierExtension/SurfaceBound.lean b/lean/OAI/Analysis/FourierExtension/SurfaceBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..f069174d5bd15ebc5464f93cbda6872962d31367 --- /dev/null +++ b/lean/OAI/Analysis/FourierExtension/SurfaceBound.lean @@ -0,0 +1,97 @@ +import Mathlib +import OAI.Analysis.FourierExtension.GraphCharts +import OAI.Analysis.FourierExtension.AffineArea +import OAI.Analysis.FourierExtension.MeasureFourier + +namespace OAI + +/-! Global L4 extension bounds for compact curved surfaces. -/ + +open MeasureTheory +open scoped NNReal ENNReal ContDiff +noncomputable section +open Filter +open scoped Topology ContDiff +open MeasureTheory Set +open scoped ContDiff FourierTransform InnerProductSpace ENNReal +open MeasureTheory Set Filter Metric +open scoped ContDiff Topology +open Set Filter +open scoped ENNReal InnerProductSpace +open scoped FourierTransform SchwartzMap ENNReal +open scoped ENNReal FourierTransform InnerProductSpace +open MeasureTheory Set Filter +open scoped ContDiff Topology ENNReal +open scoped ENNReal NNReal + +namespace DiagonalExtension +open MeasureTheory Set +open scoped ENNReal NNReal + +theorem IsSurface.exists_local_L4 {S : Set E3} (hS : IsSurface S) {a : E3} (ha : a ∈ S) : + ∃ (V : Set E3) (C : ℝ≥0), IsOpen V ∧ a ∈ V ∧ + ∀ ν : Measure E3, ν ≤ (surfaceMeasure S).restrict V → ∀ f : E3 → ℂ, + MemLp f 2 ν → MemLp (MeasureFourier.transform ν f) 4 volume ∧ + eLpNorm (MeasureFourier.transform ν f) 4 volume ≤ (C : ℝ≥0∞) * eLpNorm f 2 ν := by + obtain ⟨A,φ,c,R,V,hc,hR,hφ,hess,hV,haV,hinc⟩ := LocalGraph.exists_local_graph hS ha + let κ : ℝ≥0 := ⟨Real.pi/4, by positivity⟩ + obtain ⟨C,hC⟩ := AffineGraph.area_L4 A a hφ hc hess R κ + refine ⟨V,C,hV,haV,?_⟩ + intro ν hν f hf + apply hC ν _ f hf + apply hν.trans + have hnorm : (κ : ℝ≥0∞) = ENNReal.ofReal (Real.pi/4) := by + rw [ENNReal.ofReal_eq_coe_nnreal (by positivity)] + rfl + rw [hnorm,surfaceMeasure,Measure.restrict_restrict hV.measurableSet,inter_comm V S] + exact Measure.restrict_mono_set _ hinc + +theorem IsSurface.L4_negative {S : Set E3} (hS : IsSurface S) : + ∃ C : ℝ≥0, ∀ f : E3 → ℂ, MemLp f 2 (surfaceMeasure S) → + MemLp (MeasureFourier.transform (surfaceMeasure S) f) 4 volume ∧ + eLpNorm (MeasureFourier.transform (surfaceMeasure S) f) 4 volume ≤ + (C : ℝ≥0∞) * eLpNorm f 2 (surfaceMeasure S) := by + classical + have := hS.isFiniteMeasure + choose V C hV haV hloc using (fun a : S => hS.exists_local_L4 a.property) + have hcover : S ⊆ ⋃ a : S, V a := by + intro a ha + exact mem_iUnion.mpr ⟨⟨a,ha⟩,haV ⟨a,ha⟩⟩ + obtain ⟨t,ht⟩ := hS.1.elim_finite_subcover V hV hcover + refine ⟨∑ a ∈ t, C a,?_⟩ + intro f hf + have hcovered : ∀ᵐ y ∂surfaceMeasure S, ∃ i ∈ t, y ∈ V i := by + filter_upwards [ae_restrict_mem hS.1.measurableSet] with y hy + rcases mem_iUnion₂.mp (ht hy) with ⟨i,hi,hy⟩ + exact ⟨i,hi,hy⟩ + simpa only [ENNReal.ofNNReal_finsetSum] using MeasureFourier.finite_cover t V C + (fun a => (hV a).measurableSet) (fun a _ => hloc a) + (surfaceMeasure S) le_rfl hcovered f hf + +lemma extension_eq_negative_transform (S : Set E3) (f : E3 → ℂ) : + extension S f = MeasureFourier.transform (surfaceMeasure S) f ∘ Neg.neg := by + ext x + apply integral_congr_ae + filter_upwards [] with y + congr 1 + simp only [inner_neg_right, neg_neg, Real.fourierChar_apply, fourierCharacter] + rw [real_inner_comm] + +theorem IsSurface.extension_L4 {S : Set E3} (hS : IsSurface S) : + ∃ C : ℝ≥0, ∀ f : E3 → ℂ, MemLp f 2 (surfaceMeasure S) → + MemLp (extension S f) 4 volume ∧ + eLpNorm (extension S f) 4 volume ≤ (C : ℝ≥0∞) * eLpNorm f 2 (surfaceMeasure S) := by + obtain ⟨C,hC⟩ := hS.L4_negative + refine ⟨C,?_⟩ + intro f hf + obtain ⟨hm,hb⟩ := hC f hf + rw [extension_eq_negative_transform] + exact ⟨hm.comp_measurePreserving (Measure.measurePreserving_neg volume), + (eLpNorm_comp_measurePreserving hm.aestronglyMeasurable + (Measure.measurePreserving_neg volume)).le.trans hb⟩ + +end DiagonalExtension + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/ActualTuple.lean b/lean/OAI/Analysis/FreeEntropy/ActualTuple.lean new file mode 100644 index 0000000000000000000000000000000000000000..941249ade4abff40a62db7eb3908eca9f4c81bf9 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/ActualTuple.lean @@ -0,0 +1,150 @@ +import OAI.Analysis.FreeEntropy.EquidiscreteSignal + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate lp +open MeasureTheory Filter +namespace FiniteEntropySeparation +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] + +omit [Group G] in +theorem semicircularB_selfAdjoint [Group G] (b : B) : IsSelfAdjoint (semicircularB (N := N) (G := G) b) := + IsSelfAdjoint.add_star_self (creationB (N := N) (G := G) b) + theorem semicircularN_selfAdjoint (i : N) : IsSelfAdjoint (semicircularN (B := B) (G := G) i) := + IsSelfAdjoint.add_star_self (creationN (B := B) (G := G) i) + + theorem backgroundAlgebra_le (J : Set N) : + backgroundAlgebra (B := B) (G := G) J ≤ (algebra B N G).toStarSubalgebra.toSubalgebra := by + apply Algebra.adjoin_le + rintro _ ((⟨b,rfl⟩ | ⟨g,rfl⟩) | ⟨i,_,rfl⟩) + · exact semicircularB_mem b + · exact unitaryG_mem g + · exact semicircularN_mem i + + theorem semicircularB_mem_background (J : Set N) (b : B) : + semicircularB (N := N) (G := G) b ∈ backgroundAlgebra J := + Algebra.subset_adjoin (Or.inl (Or.inl ⟨b,rfl⟩)) + theorem semicircularN_mem_background (J : Set N) {i : N} (hi : i ∈ J) : + semicircularN (B := B) (G := G) i ∈ backgroundAlgebra J := + Algebra.subset_adjoin (Or.inr ⟨i,hi,rfl⟩) + + theorem heatTuple_selfAdjoint {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + [CompleteSpace H] {n : ℕ} (X S : Fin n → H →L[ℂ] H) + (hX : ∀ i, IsSelfAdjoint (X i)) (hS : ∀ i, IsSelfAdjoint (S i)) (u : ℝ) (i : Fin n) : + IsSelfAdjoint (heatTuple X S u i) := by + change star (X i + (Real.sqrt u : ℂ) • S i) = _ + simp only [star_add, star_smul, Complex.star_def, Complex.conj_ofReal, (hX i).star_eq, + (hS i).star_eq, heatTuple] + + theorem heatTuple_mem_background {n : ℕ} (J : Set N) + (X S : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ i, X i ∈ backgroundAlgebra J) (hS : ∀ i, S i ∈ backgroundAlgebra J) + (u : ℝ) (i : Fin n) : heatTuple X S u i ∈ backgroundAlgebra J := + (backgroundAlgebra J).add_mem (hX i) ((backgroundAlgebra J).smul_mem (hS i) _) + +end FreeTensor + +namespace Model +open FreeTensor +variable (p : ℕ) [NeZero p] +abbrev H := Space (Fin p) (Fin ((p+1)+(p+1))) (Multiplicative (ZMod p)) +abbrev M : VonNeumannAlgebra (H p) := algebra (Fin p) (Fin ((p+1)+(p+1))) (Multiplicative (ZMod p)) +abbrev τ : TracialVector (M p) := tracialVector _ _ _ +def C : Fin (p+1) → H p →L[ℂ] H p := + Fin.lastCases (equidiscreteSignal p) (fun i => semicircularB i) +def initialIndex (i : Fin (p+1)) : Fin ((p+1)+(p+1)) := Fin.castAdd (p+1) i +def auxiliaryIndex (i : Fin (p+1)) : Fin ((p+1)+(p+1)) := Fin.natAdd (p+1) i +def initialNoise (i : Fin (p+1)) : H p →L[ℂ] H p := semicircularN (initialIndex p i) +def auxiliaryNoise (i : Fin (p+1)) : H p →L[ℂ] H p := semicircularN (auxiliaryIndex p i) +def oldNoise : Set (Fin ((p+1)+(p+1))) := Set.range (initialIndex p) +def X (h : ℝ) : Fin (p+1) → H p →L[ℂ] H p := heatTuple (C p) (initialNoise p) h + +omit [NeZero p] in +theorem initialIndex_injective [NeZero p] : Function.Injective (initialIndex p) := Fin.castAdd_injective (p+1) (p+1) + +omit [NeZero p] in +theorem auxiliaryIndex_injective [NeZero p] : Function.Injective (auxiliaryIndex p) := Fin.natAdd_injective (p+1) (p+1) + +omit [NeZero p] in +theorem auxiliaryIndex_fresh [NeZero p] (i : Fin (p+1)) : auxiliaryIndex p i ∉ oldNoise p := by + rintro ⟨j,h⟩ + have hv := congrArg Fin.val h + simp only [initialIndex, auxiliaryIndex, Fin.val_castAdd, Fin.val_natAdd] at hv + have hj := j.isLt + omega + +@[simp] theorem C_last : C p (Fin.last p) = equidiscreteSignal p := by simp [C] +@[simp] theorem C_castSucc (i : Fin p) : C p i.castSucc = semicircularB i := by simp [C] + + theorem C_selfAdjoint (i : Fin (p+1)) : IsSelfAdjoint (C p i) := by + induction i using Fin.lastCases with + | last => rw [C_last]; exact equidiscreteSignal_selfAdjoint p + | cast i => rw [C_castSucc]; exact semicircularB_selfAdjoint i + + theorem C_mem_background (J : Set (Fin ((p+1)+(p+1)))) (i : Fin (p+1)) : + C p i ∈ backgroundAlgebra J := by + induction i using Fin.lastCases with + | last => rw [C_last]; exact equidiscreteSignal_mem_background p J + | cast i => rw [C_castSucc]; exact semicircularB_mem_background J i + + theorem C_mem (i : Fin (p+1)) : C p i ∈ M p := backgroundAlgebra_le ∅ (C_mem_background p ∅ i) + + theorem C_norm_le (hp : 2 ≤ p) (i : Fin (p+1)) : ‖C p i‖ ≤ 2 := by + induction i using Fin.lastCases with + | last => rw [C_last]; exact (equidiscreteSignal_norm_le p hp).trans (by norm_num) + | cast i => rw [C_castSucc]; exact semicircularB_norm_le i + + theorem initialNoise_free : FreeStandardNoise (τ p) (C p) (initialNoise p) := + freeStandardNoise ∅ (C p) (C_mem_background p ∅) (initialIndex p) + (initialIndex_injective p) (by simp) + + theorem X_mem_background (h : ℝ) (i : Fin (p+1)) : + X p h i ∈ backgroundAlgebra (oldNoise p) := by + apply heatTuple_mem_background _ _ _ (C_mem_background p (oldNoise p)) + intro j + exact semicircularN_mem_background _ ⟨j,rfl⟩ + + theorem auxiliaryNoise_free (h : ℝ) : FreeStandardNoise (τ p) (X p h) (auxiliaryNoise p) := + freeStandardNoise (oldNoise p) (X p h) (X_mem_background p h) (auxiliaryIndex p) + (auxiliaryIndex_injective p) (auxiliaryIndex_fresh p) + + theorem X_mem (h : ℝ) (i : Fin (p+1)) : X p h i ∈ M p := + backgroundAlgebra_le _ (X_mem_background p h i) + theorem X_selfAdjoint (h : ℝ) (i : Fin (p+1)) : IsSelfAdjoint (X p h i) := + heatTuple_selfAdjoint (C p) (initialNoise p) (C_selfAdjoint p) + (fun _index => semicircularN_selfAdjoint _) h i + +omit [NeZero p] in +theorem auxiliaryNoise_mem [NeZero p] (i : Fin (p+1)) : auxiliaryNoise p i ∈ M p := semicircularN_mem _ + +omit [NeZero p] in +theorem auxiliaryNoise_selfAdjoint [NeZero p] (i : Fin (p+1)) : IsSelfAdjoint (auxiliaryNoise p i) := + semicircularN_selfAdjoint _ + + theorem X_norm_le (hp : 2 ≤ p) (h : ℝ) (i : Fin (p+1)) : + ‖X p h i‖ ≤ 2 + 2 * Real.sqrt h := by + apply (norm_add_le _ _).trans + rw [norm_smul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg h)] + exact add_le_add (C_norm_le p hp i) + (by + have hn : ‖initialNoise p i‖ ≤ 2 := semicircularN_norm_le _ + nlinarith [Real.sqrt_nonneg h]) + + theorem heat_fisher_le (h s : ℝ) (hs : 0 < s) : + freeFisher (τ p) (heatTuple (X p h) (auxiliaryNoise p) s) ≤ ENNReal.ofReal ((p+1 : ℕ)/s) := + heat_freeFisher_le (oldNoise p) (X p h) (X_mem_background p h) + (auxiliaryIndex p) (auxiliaryIndex_injective p) (auxiliaryIndex_fresh p) s hs + + theorem heat_fisher_measurable (h : ℝ) : Measurable (fun s : Set.Ioi (0 : ℝ) => + freeFisher (τ p) (heatTuple (X p h) (auxiliaryNoise p) s)) := + heat_freeFisher_measurable (oldNoise p) (X p h) (X_mem_background p h) + (auxiliaryIndex p) (auxiliaryIndex_injective p) (auxiliaryIndex_fresh p) + +end Model +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/Basic.lean b/lean/OAI/Analysis/FreeEntropy/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..51c0f09246babea8d5f3a7558ce03a91e39c6a49 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/Basic.lean @@ -0,0 +1,1449 @@ +import OAI.Analysis.FreeEntropy.Model + +namespace OAI + +universe u1 u2 + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate +open MeasureTheory Filter + +namespace FiniteEntropySeparation + +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +@[simp] theorem trace_zero {M : VonNeumannAlgebra H} (τ : TracialVector M) : + trace τ (0 : H →L[ℂ] H) = 0 := by simp [trace] + + theorem trace_add {M : VonNeumannAlgebra H} (τ : TracialVector M) + (A B : H →L[ℂ] H) : trace τ (A + B) = trace τ A + trace τ B := by + simp [trace] + + theorem trace_smul {M : VonNeumannAlgebra H} (τ : TracialVector M) + (z : ℂ) (A : H →L[ℂ] H) : trace τ (z • A) = z * trace τ A := by + simp [trace] + + theorem trace_sum {M : VonNeumannAlgebra H} (τ : TracialVector M) + {α : Type u1} (s : Finset α) (A : α → H →L[ℂ] H) : + trace τ (∑ a ∈ s, A a) = ∑ a ∈ s, trace τ (A a) := by + simp [trace] + +theorem ConjugateSystem.unique {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} {X : Fin n → H →L[ℂ] H} {ξ η : Fin n → H} + (hξ : ConjugateSystem τ X ξ) (hη : ConjugateSystem τ X η) : ξ = η := by + funext i + have hmem : ξ i - η i ∈ polynomialL2 τ X := + (polynomialL2 τ X).sub_mem (hξ i).1 (hη i).1 + have hker : polynomialL2 τ X ≤ (innerSL ℂ (ξ i - η i)).ker := by + apply Submodule.topologicalClosure_minimal + · apply Submodule.span_le.mpr + rintro _ ⟨w, rfl⟩ + change inner ℂ (ξ i - η i) (wordEval X w τ.vacuum) = 0 + rw [inner_sub_left, (hξ i).2 w, (hη i).2 w, sub_self] + · exact (innerSL ℂ (ξ i - η i)).isClosed_ker + have hd : inner ℂ (ξ i - η i) (ξ i - η i) = 0 := hker hmem + exact sub_eq_zero.mp ((inner_self_eq_zero).mp hd) + +theorem freeFisher_eq_of_conjugate {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} {X : Fin n → H →L[ℂ] H} {ξ : Fin n → H} + (hξ : ConjugateSystem τ X ξ) : + freeFisher τ X = ENNReal.ofReal (∑ i, ‖ξ i‖ ^ 2) := by + apply le_antisymm + · exact iInf_le_of_le ξ (iInf_le_of_le hξ le_rfl) + · refine le_iInf fun η => le_iInf fun hη => ?_ + rw [hξ.unique τ hη] + +@[simp] theorem trace_one {M : VonNeumannAlgebra H} (τ : TracialVector M) : + trace τ (1 : H →L[ℂ] H) = 1 := by + simp [trace, inner_self_eq_norm_sq_to_K, τ.norm_vacuum] + +@[simp] theorem wordMoment_nil {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) : wordMoment τ X [] = 1 := by + simp [wordMoment, wordEval] + + theorem wordVector_mem_polynomialL2 {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (w : List (Fin n)) : + wordEval X w τ.vacuum ∈ polynomialL2 τ X := + Submodule.le_topologicalClosure _ (Submodule.subset_span ⟨w, rfl⟩) + +instance polynomialL2_complete {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) : CompleteSpace (polynomialL2 τ X) := + (Submodule.isClosed_topologicalClosure _).completeSpace_coe + +def projectedConjugate {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (η : Fin n → H) (i : Fin n) : H := + (polynomialL2 τ X).starProjection (η i) + + theorem projectedConjugate_system {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (η : Fin n → H) + (hη : ∀ i w, inner ℂ (η i) (wordEval X w τ.vacuum) = derivativeMoment τ X i w) : + ConjugateSystem τ X (projectedConjugate τ X η) := by + intro i + refine ⟨(polynomialL2 τ X).starProjection_apply_mem _, fun w => ?_⟩ + have h := (polynomialL2 τ X).starProjection_inner_eq_zero (η i) + (wordEval X w τ.vacuum) (wordVector_mem_polynomialL2 τ X w) + rw [inner_sub_left, hη i w] at h + exact (sub_eq_zero.mp h).symm + +theorem freeFisher_le_testVectors {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (η : Fin n → H) + (hη : ∀ i w, inner ℂ (η i) (wordEval X w τ.vacuum) = derivativeMoment τ X i w) : + freeFisher τ X ≤ ENNReal.ofReal (∑ i, ‖η i‖ ^ 2) := by + rw [freeFisher_eq_of_conjugate τ (projectedConjugate_system τ X η hη)] + apply ENNReal.ofReal_le_ofReal + apply Finset.sum_le_sum + intro i _ + exact pow_le_pow_left₀ (norm_nonneg _) ((polynomialL2 τ X).norm_starProjection_apply_le _) _ + + theorem conjugate_coordinate_pairing {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} {X : Fin n → H →L[ℂ] H} {ξ : Fin n → H} + (hξ : ConjugateSystem τ X ξ) (i : Fin n) : inner ℂ (ξ i) (X i τ.vacuum) = 1 := by + have h := (hξ i).2 [i] + simpa [wordEval, derivativeMoment, wordMoment, trace_one] using h + +theorem conjugate_norm_sq_lower {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} {X : Fin n → H →L[ℂ] H} {ξ : Fin n → H} + (hξ : ConjugateSystem τ X ξ) (i : Fin n) : + 1 / ‖X i τ.vacuum‖ ^ 2 ≤ ‖ξ i‖ ^ 2 := by + have h : 1 ≤ ‖ξ i‖ * ‖X i τ.vacuum‖ := by + simpa only [conjugate_coordinate_pairing τ hξ i, norm_one] using + norm_inner_le_norm (𝕜 := ℂ) (ξ i) (X i τ.vacuum) + have hp : 0 < ‖X i τ.vacuum‖ := by + have hn := norm_nonneg (X i τ.vacuum) + by_contra hh + have hz : ‖X i τ.vacuum‖ = 0 := le_antisymm (not_lt.mp hh) hn + rw [hz, mul_zero] at h + linarith + apply (div_le_iff₀ (sq_pos_of_pos hp)).mpr + nlinarith [sq_nonneg (‖ξ i‖ * ‖X i τ.vacuum‖ - 1)] + + theorem freeFisher_lower_covariance {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) : + ENNReal.ofReal (∑ i, 1 / ‖X i τ.vacuum‖ ^ 2) ≤ freeFisher τ X := by + refine le_iInf fun ξ => le_iInf fun hξ => ?_ + apply ENNReal.ofReal_le_ofReal + exact Finset.sum_le_sum fun i _ => conjugate_norm_sq_lower τ hξ i + +def vacuumRankOne {M : VonNeumannAlgebra H} (τ : TracialVector M) : H →L[ℂ] H := + InnerProductSpace.rankOne ℂ τ.vacuum τ.vacuum + +def commutatorKernel {n : ℕ} (P : H →L[ℂ] H) (X : Fin n → H →L[ℂ] H) + (i : Fin n) (w : List (Fin n)) : H →L[ℂ] H := + ∑ r : Fin w.length, if w[r.val] = i then + wordEval X (w.take r.val) * P * wordEval X (w.drop (r.val + 1)) else 0 + +omit [CompleteSpace H] in +@[simp] theorem commutatorKernel_nil {n : ℕ} (P : H →L[ℂ] H) + (X : Fin n → H →L[ℂ] H) (i : Fin n) : commutatorKernel P X i [] = 0 := by + simp [commutatorKernel] + +omit [CompleteSpace H] in + theorem commutatorKernel_cons {n : ℕ} (P : H →L[ℂ] H) + (X : Fin n → H →L[ℂ] H) (i j : Fin n) (w : List (Fin n)) : + commutatorKernel P X i (j :: w) = + (if j = i then P * wordEval X w else 0) + X j * commutatorKernel P X i w := by + simp only [commutatorKernel, List.length_cons, Fin.sum_univ_succ] + simp only [Fin.val_zero, Fin.val_succ, List.getElem_cons_zero, List.getElem_cons_succ, + List.take_zero, List.take_succ_cons, List.drop_succ_cons, Nat.zero_add, + wordEval, List.map_nil, List.prod_nil, one_mul, Finset.mul_sum] + congr 1 + apply Finset.sum_congr rfl + intro r _ + split_ifs <;> simp [List.map_cons, List.prod_cons, mul_assoc] + +omit [CompleteSpace H] in + theorem commutator_word {n : ℕ} (P a : H →L[ℂ] H) (X : Fin n → H →L[ℂ] H) + (i : Fin n) (c : ℂ) + (h : ∀ j, a * X j = X j * a + if j = i then c • P else 0) + (w : List (Fin n)) : + a * wordEval X w = wordEval X w * a + c • commutatorKernel P X i w := by + induction w with + | nil => simp [wordEval] + | cons j w ih => + have hw : wordEval X (j :: w) = X j * wordEval X w := by simp [wordEval] + rw [hw, commutatorKernel_cons, ← mul_assoc, h, add_mul, mul_assoc, ih] + by_cases hji : j = i <;> + simp [hji, mul_add, mul_assoc, smul_add, _root_.add_assoc, _root_.add_comm, + _root_.add_left_comm] + + theorem trace_vacuumRankOne_product {M : VonNeumannAlgebra H} (τ : TracialVector M) + (A B : H →L[ℂ] H) : trace τ (A * vacuumRankOne τ * B) = trace τ A * trace τ B := by + simp only [trace, vacuumRankOne, mul_apply_eq_comp, InnerProductSpace.rankOne_apply, + map_smul, inner_smul_right] + exact mul_comm _ _ + + theorem trace_commutatorKernel {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (i : Fin n) (w : List (Fin n)) : + trace τ (commutatorKernel (vacuumRankOne τ) X i w) = derivativeMoment τ X i w := by + rw [commutatorKernel, trace_sum] + apply Finset.sum_congr rfl + intro r _ + split_ifs <;> simp [trace_vacuumRankOne_product, wordMoment] + +theorem commutator_integration_by_parts {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (a : H →L[ℂ] H) (i : Fin n) (c : ℂ) + (h : ∀ j, a * X j = X j * a + if j = i then c • vacuumRankOne τ else 0) + (hz : a τ.vacuum = 0) (w : List (Fin n)) : + inner ℂ (star a τ.vacuum) (wordEval X w τ.vacuum) = c * derivativeMoment τ X i w := by + rw [ContinuousLinearMap.star_eq_adjoint, ContinuousLinearMap.adjoint_inner_left] + change trace τ (a * wordEval X w) = _ + rw [commutator_word _ _ _ _ _ h, trace_add, trace_smul, trace_commutatorKernel] + have hzero : trace τ (wordEval X w * a) = 0 := by + simp [trace, mul_apply_eq_comp, hz] + rw [hzero, zero_add] + +theorem FreeSubalgebras.mono {κ : Type} {M : VonNeumannAlgebra H} (τ : TracialVector M) + {A B : κ → Subalgebra ℂ (H →L[ℂ] H)} (hA : FreeSubalgebras τ A) + (hBA : ∀ i, B i ≤ A i) : FreeSubalgebras τ B := by + intro k hk j a ha hc hadj + exact hA k hk j a (fun r => hBA (j r) (ha r)) hc hadj + +namespace Fock + +open scoped lp +variable {ι : Type} [DecidableEq ι] + +abbrev Space (ι : Type) := lp (fun _ : List ι => ℂ) 2 + +instance space_nontrivial : Nontrivial (Space ι) := by + refine ⟨⟨lp.single 2 ([] : List ι) (1 : ℂ), 0, ?_⟩⟩ + intro h + have he := congrArg (fun f : Space ι => f []) h + simp at he + +def basisVector (w : List ι) : Space ι := lp.single 2 w 1 + +def coordinateIsometry (w : List ι) : ℂ →ₗᵢ[ℂ] Space ι where + toLinearMap := lp.lsingle (𝕜 := ℂ) (E := fun _ : List ι => ℂ) 2 w + norm_map' z := lp.norm_single (E := fun _ : List ι => ℂ) (p := 2) (by norm_num) w z + +@[simp] theorem coordinateIsometry_apply (w : List ι) (z : ℂ) : + coordinateIsometry w z = lp.single 2 w z := rfl + +theorem orthogonal_coordinates (f : List ι → List ι) (hf : Function.Injective f) : + OrthogonalFamily ℂ (fun _ : List ι => ℂ) (fun w => coordinateIsometry (f w)) := by + intro w v hwv a b + simp only [coordinateIsometry_apply, lp.inner_single_left] + rw [lp.single_apply_ne (E := fun _ : List ι => ℂ) 2 (f v) b (fun h => hwv (hf h))] + simp + +def injectionIsometry (f : List ι → List ι) (hf : Function.Injective f) : + Space ι →ₗᵢ[ℂ] Space ι := + (orthogonal_coordinates f hf).linearIsometry + +@[simp] theorem injectionIsometry_single (f : List ι → List ι) + (hf : Function.Injective f) (w : List ι) (z : ℂ) : + injectionIsometry f hf (lp.single 2 w z) = lp.single 2 (f w) z := by + exact (orthogonal_coordinates f hf).linearIsometry_apply_single z + +def creation (i : ι) : Space ι →L[ℂ] Space ι := + (injectionIsometry (List.cons i) (List.cons_injective (a := i))).toContinuousLinearMap + +def rightCreation (i : ι) : Space ι →L[ℂ] Space ι := + (injectionIsometry (fun w => w ++ [i]) (List.append_left_injective [i])).toContinuousLinearMap + +@[simp] theorem creation_single (i : ι) (w : List ι) (z : ℂ) : + creation i (lp.single 2 w z) = lp.single 2 (i :: w) z := by + exact injectionIsometry_single (List.cons i) List.cons_injective w z + +@[simp] theorem rightCreation_single (i : ι) (w : List ι) (z : ℂ) : + rightCreation i (lp.single 2 w z) = lp.single 2 (w ++ [i]) z := by + exact injectionIsometry_single (fun w => w ++ [i]) (List.append_left_injective [i]) w z + +def semicircular (i : ι) : Space ι →L[ℂ] Space ι := creation i + star (creation i) + +def rightSemicircular (i : ι) : Space ι →L[ℂ] Space ι := + rightCreation i + star (rightCreation i) + +theorem semicircular_selfAdjoint (i : ι) : IsSelfAdjoint (semicircular i) := + IsSelfAdjoint.add_star_self (creation i) + +theorem rightSemicircular_selfAdjoint (i : ι) : IsSelfAdjoint (rightSemicircular i) := + IsSelfAdjoint.add_star_self (rightCreation i) + +theorem semicircular_norm_le (i : ι) : ‖semicircular i‖ ≤ 2 := by + calc + ‖semicircular i‖ ≤ ‖creation i‖ + ‖star (creation i)‖ := norm_add_le _ _ + _ = 2 := by norm_num [creation, ContinuousLinearMap.star_eq_adjoint, LinearIsometry.norm_toContinuousLinearMap] + +@[simp] theorem adjoint_creation_apply (i : ι) (x : Space ι) (w : List ι) : + (star (creation i) x) w = x (i :: w) := by + have h := ContinuousLinearMap.adjoint_inner_right (creation i) (lp.single 2 w (1 : ℂ)) x + simpa [ContinuousLinearMap.star_eq_adjoint, lp.inner_single_left] using h + +@[simp] theorem adjoint_rightCreation_apply (i : ι) (x : Space ι) (w : List ι) : + (star (rightCreation i) x) w = x (w ++ [i]) := by + have h := ContinuousLinearMap.adjoint_inner_right (rightCreation i) (lp.single 2 w (1 : ℂ)) x + simpa [ContinuousLinearMap.star_eq_adjoint, lp.inner_single_left] using h + +@[simp] theorem annihilation_single_nil (i : ι) (z : ℂ) : + star (creation i) (lp.single 2 ([] : List ι) z) = 0 := by + apply lp.ext + funext w + simp [lp.single_apply] + +@[simp] theorem annihilation_single_cons (i j : ι) (w : List ι) (z : ℂ) : + star (creation i) (lp.single 2 (j :: w) z) = + if i = j then lp.single 2 w z else 0 := by + apply lp.ext + funext v + by_cases h : i = j + · subst j + simp [lp.single_apply, Pi.single_apply] + · simp [lp.single_apply, h] + +@[simp] theorem rightAnnihilation_single_nil (i : ι) (z : ℂ) : + star (rightCreation i) (lp.single 2 ([] : List ι) z) = 0 := by + apply lp.ext + funext w + simp [lp.single_apply] + +@[simp] theorem rightAnnihilation_single_append (i j : ι) (w : List ι) (z : ℂ) : + star (rightCreation i) (lp.single 2 (w ++ [j]) z) = + if i = j then lp.single 2 w z else 0 := by + apply lp.ext + funext v + by_cases h : i = j + · subst j + simp [lp.single_apply, Pi.single_apply] + · simp [lp.single_apply, h] + +@[simp] theorem semicircular_single_nil (i : ι) (z : ℂ) : + semicircular i (lp.single 2 ([] : List ι) z) = lp.single 2 [i] z := by + simp [semicircular] + +@[simp] theorem semicircular_single_cons (i j : ι) (w : List ι) (z : ℂ) : + semicircular i (lp.single 2 (j :: w) z) = + lp.single 2 (i :: j :: w) z + if i = j then lp.single 2 w z else 0 := by + simp [semicircular] + +@[simp] theorem rightSemicircular_single_nil (i : ι) (z : ℂ) : + rightSemicircular i (lp.single 2 ([] : List ι) z) = lp.single 2 [i] z := by + simp [rightSemicircular] + +@[simp] theorem rightSemicircular_single_append (i j : ι) (w : List ι) (z : ℂ) : + rightSemicircular i (lp.single 2 (w ++ [j]) z) = + lp.single 2 (w ++ [j, i]) z + if i = j then lp.single 2 w z else 0 := by + simp [rightSemicircular] + +theorem semicircular_commutes_right (i j : ι) : + Commute (semicircular i) (rightSemicircular j) := by + show semicircular i * rightSemicircular j = rightSemicircular j * semicircular i + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change semicircular i (rightSemicircular j (lp.single 2 w z)) = + rightSemicircular j (semicircular i (lp.single 2 w z)) + cases w with + | nil => + simp only [rightSemicircular_single_nil, semicircular_single_nil, + semicircular_single_cons] + rw [show [i] = [] ++ [i] from rfl, rightSemicircular_single_append] + by_cases h : i = j <;> simp [h, eq_comm] + | cons k v => + induction v using List.reverseRecOn with + | nil => + rw [show [k] = [] ++ [k] from rfl, rightSemicircular_single_append] + simp only [List.nil_append, map_add, semicircular_single_cons] + rw [show [i, k] = [i] ++ [k] from rfl, rightSemicircular_single_append] + by_cases hik : i = k <;> by_cases hjk : j = k <;> + simp [hik, hjk, rightSemicircular_single_nil] + | append_singleton v l _ => + rw [show k :: (v ++ [l]) = (k :: v) ++ [l] from rfl, + rightSemicircular_single_append] + simp only [map_add, List.cons_append, semicircular_single_cons] + rw [show i :: k :: (v ++ [l]) = (i :: k :: v) ++ [l] from rfl, + rightSemicircular_single_append] + by_cases hik : i = k <;> by_cases hjl : j = l <;> + simp [hik, hjl, rightSemicircular_single_append, add_assoc, add_comm, add_left_comm] + +def rightWick : List ι → Space ι →L[ℂ] Space ι + | [] => 1 + | [i] => rightSemicircular i + | i :: j :: w => rightSemicircular i * rightWick (j :: w) - + if i = j then rightWick w else 0 + + theorem commute_rightWick (A : Space ι →L[ℂ] Space ι) + (h : ∀ i, Commute A (rightSemicircular i)) (w : List ι) : + Commute A (rightWick w) := by + induction w using rightWick.induct with + | case1 => exact Commute.one_right A + | case2 i => exact h i + | case3 i j w ih₁ ih₂ => + dsimp only [rightWick] + apply ((h i).mul_right ih₁).sub_right + split_ifs + · exact ih₂ + · exact Commute.zero_right A + +@[simp] theorem rightWick_vacuum (w : List ι) : + rightWick w (basisVector []) = basisVector w.reverse := by + induction w using rightWick.induct with + | case1 => simp [rightWick] + | case2 i => simp [rightWick, basisVector] + | case3 i j w ih₁ ih₂ => + simp only [rightWick, sub_apply, mul_apply_eq_comp, ih₁] + by_cases h : i = j <;> + simp only [h, ↓reduceIte, ih₂] <;> + simp [basisVector, List.reverse_cons, h, rightSemicircular_single_append] + +@[simp] theorem adjoint_rightWick_vacuum (w : List ι) : + star (rightWick w) (basisVector []) = basisVector w := by + induction w using rightWick.induct with + | case1 => simp [rightWick] + | case2 i => + rw [rightWick, (rightSemicircular_selfAdjoint i).star_eq] + simp [basisVector] + | case3 i j w ih₁ ih₂ => + have hc : Commute (star (rightWick (j :: w))) (semicircular i) := by + have h := commute_rightWick (semicircular i) (semicircular_commutes_right i) (j :: w) + have hs := congrArg star h.eq + change _ * _ = _ * _ + simpa only [star_mul, (semicircular_selfAdjoint i).star_eq] using hs + have hv : rightSemicircular i (basisVector ([] : List ι)) = + semicircular i (basisVector []) := by simp [basisVector] + rw [rightWick, star_sub (rightSemicircular i * rightWick (j :: w)) _, star_mul, + (rightSemicircular_selfAdjoint i).star_eq, + sub_apply, mul_apply_eq_comp] + rw [hv, ← mul_apply_eq_comp, hc.eq, mul_apply_eq_comp, ih₁] + by_cases h : i = j <;> + simp only [h, ↓reduceIte, star_zero, ih₂] <;> + simp [h, basisVector] + +def algebra (ι : Type) [DecidableEq ι] : VonNeumannAlgebra (Space ι) where + toStarSubalgebra := StarSubalgebra.centralizer ℂ (Set.range (rightSemicircular (ι := ι))) + centralizer_centralizer' := Set.centralizer_centralizer_centralizer _ + + theorem mem_algebra_iff (A : Space ι →L[ℂ] Space ι) : + A ∈ algebra ι ↔ ∀ i, Commute A (rightSemicircular i) := by + change A ∈ StarSubalgebra.centralizer ℂ (Set.range rightSemicircular) ↔ _ + rw [StarSubalgebra.mem_centralizer_iff] + simp only [Set.forall_mem_range, (rightSemicircular_selfAdjoint _).star_eq, and_self] + exact forall_congr' fun i => eq_comm + + theorem semicircular_mem (i : ι) : semicircular i ∈ algebra ι := + (mem_algebra_iff _).mpr (semicircular_commutes_right i) + +theorem vacuum_separating (A : Space ι →L[ℂ] Space ι) (hA : A ∈ algebra ι) + (h0 : A (basisVector []) = 0) : A = 0 := by + have hsingle (w : List ι) : A (basisVector w) = 0 := by + rw [← List.reverse_reverse w, ← rightWick_vacuum] + rw [← mul_apply_eq_comp, + (commute_rightWick A ((mem_algebra_iff A).mp hA) w.reverse).eq, + mul_apply_eq_comp, h0, map_zero] + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change A (lp.single 2 w z) = 0 + have hz : lp.single 2 w z = z • basisVector w := by + simp [basisVector, ← lp.single_smul] + rw [hz, map_smul, hsingle, smul_zero] + +theorem adjoint_vacuum_coefficient (A : Space ι →L[ℂ] Space ι) + (hA : A ∈ algebra ι) (w : List ι) : + (star A (basisVector [])) w = star ((A (basisVector [])) w.reverse) := by + have hw : A (basisVector w) = rightWick w.reverse (A (basisVector [])) := by + rw [← mul_apply_eq_comp, + ← (commute_rightWick A ((mem_algebra_iff A).mp hA) w.reverse).eq, + mul_apply_eq_comp, rightWick_vacuum, List.reverse_reverse] + calc + (star A (basisVector [])) w = inner ℂ (basisVector w) (star A (basisVector [])) := by + simp [basisVector, lp.inner_single_left] + _ = inner ℂ (A (basisVector w)) (basisVector []) := + ContinuousLinearMap.adjoint_inner_right A _ _ + _ = inner ℂ (rightWick w.reverse (A (basisVector []))) (basisVector []) := by rw [hw] + _ = inner ℂ (A (basisVector [])) (star (rightWick w.reverse) (basisVector [])) := + (ContinuousLinearMap.adjoint_inner_right _ _ _).symm + _ = star ((A (basisVector [])) w.reverse) := by + rw [adjoint_rightWick_vacuum] + simp [basisVector, lp.inner_single_right] + + theorem vacuum_product_formula (A B : Space ι →L[ℂ] Space ι) + (hA : A ∈ algebra ι) : + inner ℂ (basisVector []) ((A * B) (basisVector [])) = + ∑' w : List ι, (B (basisVector [])) w * (A (basisVector [])) w.reverse := by + rw [mul_apply_eq_comp, ← ContinuousLinearMap.adjoint_inner_left A, + ← ContinuousLinearMap.star_eq_adjoint, lp.inner_eq_tsum] + apply tsum_congr + intro w + rw [RCLike.inner_apply, adjoint_vacuum_coefficient A hA w] + simp + +theorem vacuum_tracial (A : Space ι →L[ℂ] Space ι) (hA : A ∈ algebra ι) + (B : Space ι →L[ℂ] Space ι) (hB : B ∈ algebra ι) : + inner ℂ (basisVector []) ((A * B) (basisVector [])) = + inner ℂ (basisVector []) ((B * A) (basisVector [])) := by + rw [vacuum_product_formula A B hA, vacuum_product_formula B A hB] + let e : List ι ≃ List ι := ⟨List.reverse, List.reverse, List.reverse_reverse, List.reverse_reverse⟩ + calc + (∑' w : List ι, (B (basisVector [])) w * (A (basisVector [])) w.reverse) = + ∑' w : List ι, (B (basisVector [])) w.reverse * (A (basisVector [])) w := by + simpa [e] using (e.tsum_eq (fun w : List ι => + (B (basisVector [])) w * (A (basisVector [])) w.reverse)).symm + _ = _ := tsum_congr fun _ => mul_comm _ _ + +def tracialVector (ι : Type) [DecidableEq ι] : TracialVector (algebra ι) where + vacuum := basisVector [] + norm_vacuum := by + simp [basisVector, lp.norm_single (E := fun _ : List ι => ℂ) (p := 2)] + tracial := vacuum_tracial + separating := vacuum_separating + +def vacuumProjection : Space ι →L[ℂ] Space ι := + InnerProductSpace.rankOne ℂ (basisVector []) (basisVector []) + +@[simp] theorem vacuumProjection_single (w : List ι) (z : ℂ) : + vacuumProjection (lp.single 2 w z) = if w = [] then lp.single 2 [] z else 0 := by + by_cases h : w = [] + · subst w + simp [vacuumProjection, basisVector, lp.inner_single_left, ← lp.single_smul] + · simp [vacuumProjection, basisVector, lp.inner_single_left, lp.single_apply, h] + + theorem creation_commutes_rightCreation (i j : ι) : + Commute (creation i) (rightCreation j) := by + show creation i * rightCreation j = rightCreation j * creation i + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change creation i (rightCreation j (lp.single 2 w z)) = + rightCreation j (creation i (lp.single 2 w z)) + simp + + theorem rightAnnihilation_creation (i j : ι) : + star (rightCreation i) * creation j = creation j * star (rightCreation i) + + if i = j then vacuumProjection else 0 := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change star (rightCreation i) (creation j (lp.single 2 w z)) = + creation j (star (rightCreation i) (lp.single 2 w z)) + + (if i = j then vacuumProjection else 0) (lp.single 2 w z) + induction w using List.reverseRecOn with + | nil => + rw [creation_single, show [j] = [] ++ [j] from rfl, rightAnnihilation_single_append] + by_cases h : i = j <;> simp [h] + | append_singleton w k _ => + rw [creation_single, show j :: (w ++ [k]) = (j :: w) ++ [k] from rfl, + rightAnnihilation_single_append] + have hp : (if i = j then vacuumProjection else 0) (lp.single 2 (w ++ [k]) z) = 0 := by + split_ifs <;> simp + rw [hp, rightAnnihilation_single_append] + by_cases h : i = k <;> simp [h] + +theorem rightAnnihilation_semicircular (i j : ι) : + star (rightCreation i) * semicircular j = semicircular j * star (rightCreation i) + + if i = j then vacuumProjection else 0 := by + have h : star (rightCreation i) * star (creation j) = + star (creation j) * star (rightCreation i) := by + simpa only [star_mul] using congrArg star (creation_commutes_rightCreation j i).eq + rw [semicircular, mul_add, add_mul, rightAnnihilation_creation, h] + abel + +def derivativeKernel {n : ℕ} (i : Fin n) (w : List (Fin n)) : + Space (Fin n) →L[ℂ] Space (Fin n) := + ∑ r : Fin w.length, if w[r.val] = i then + wordEval semicircular (w.take r.val) * vacuumProjection * + wordEval semicircular (w.drop (r.val + 1)) else 0 + +@[simp] theorem derivativeKernel_nil {n : ℕ} (i : Fin n) : + derivativeKernel i [] = 0 := by simp [derivativeKernel] + + theorem derivativeKernel_cons {n : ℕ} (i j : Fin n) (w : List (Fin n)) : + derivativeKernel i (j :: w) = + (if j = i then vacuumProjection * wordEval semicircular w else 0) + + semicircular j * derivativeKernel i w := by + simp only [derivativeKernel, List.length_cons, Fin.sum_univ_succ] + simp only [Fin.val_zero, Fin.val_succ, List.getElem_cons_zero, List.getElem_cons_succ, + List.take_zero, List.take_succ_cons, List.drop_succ_cons, Nat.zero_add, + wordEval, List.map_nil, List.prod_nil, one_mul, Finset.mul_sum] + congr 1 + apply Finset.sum_congr rfl + intro r _ + split_ifs <;> simp [List.map_cons, List.prod_cons, mul_assoc] + + theorem rightAnnihilation_word {n : ℕ} (i : Fin n) (w : List (Fin n)) : + star (rightCreation i) * wordEval semicircular w = + wordEval semicircular w * star (rightCreation i) + derivativeKernel i w := by + induction w with + | nil => simp [wordEval] + | cons j w ih => + have hw : wordEval semicircular (j :: w) = semicircular j * wordEval semicircular w := by + simp [wordEval] + rw [hw, derivativeKernel_cons, ← mul_assoc, rightAnnihilation_semicircular, + add_mul, mul_assoc, ih, mul_add] + by_cases h : i = j <;> simp [h, eq_comm, mul_assoc, add_assoc, add_comm, add_left_comm] + + theorem trace_projection_product (A B : Space ι →L[ℂ] Space ι) : + trace (tracialVector ι) (A * vacuumProjection * B) = + trace (tracialVector ι) A * trace (tracialVector ι) B := by + simp only [trace, tracialVector, vacuumProjection, mul_apply_eq_comp, + InnerProductSpace.rankOne_apply, map_smul, inner_smul_right] + exact mul_comm _ _ + + theorem trace_derivativeKernel {n : ℕ} (i : Fin n) (w : List (Fin n)) : + trace (tracialVector (Fin n)) (derivativeKernel i w) = + derivativeMoment (tracialVector (Fin n)) semicircular i w := by + rw [derivativeKernel, trace_sum] + apply Finset.sum_congr rfl + intro r _ + split_ifs <;> simp [trace_projection_product, wordMoment] + + theorem trace_semicircular_left (i : ι) (A : Space ι →L[ℂ] Space ι) : + trace (tracialVector ι) (semicircular i * A) = + trace (tracialVector ι) (star (rightCreation i) * A) := by + simp only [trace, tracialVector, mul_apply_eq_comp] + rw [← ContinuousLinearMap.adjoint_inner_left (semicircular i), + ← ContinuousLinearMap.adjoint_inner_left (star (rightCreation i))] + simp only [← ContinuousLinearMap.star_eq_adjoint, star_star, + (semicircular_selfAdjoint i).star_eq, basisVector, + semicircular_single_nil, rightCreation_single, List.nil_append] + +theorem semicircular_integration_by_parts {n : ℕ} (i : Fin n) (w : List (Fin n)) : + trace (tracialVector (Fin n)) (semicircular i * wordEval semicircular w) = + derivativeMoment (tracialVector (Fin n)) semicircular i w := by + rw [trace_semicircular_left, rightAnnihilation_word, trace_add, trace_derivativeKernel] + suffices trace (tracialVector (Fin n)) + (wordEval semicircular w * star (rightCreation i)) = 0 by rw [this, zero_add] + simp [trace, tracialVector, basisVector, mul_apply_eq_comp] + +theorem semicircular_conjugateSystem (n : ℕ) : + ConjugateSystem (tracialVector (Fin n)) semicircular + (fun i => semicircular i (basisVector [])) := by + intro i + constructor + · apply Submodule.le_topologicalClosure + apply Submodule.subset_span + use [i] + simp [wordEval, tracialVector] + · intro w + rw [← semicircular_integration_by_parts] + change inner ℂ (semicircular i (basisVector [])) (wordEval semicircular w (basisVector [])) = + inner ℂ (basisVector []) (semicircular i (wordEval semicircular w (basisVector []))) + conv_lhs => rw [← (semicircular_selfAdjoint i).star_eq] + exact ContinuousLinearMap.adjoint_inner_left _ _ _ + +theorem semicircular_freeFisher (n : ℕ) : + freeFisher (tracialVector (Fin n)) semicircular = (n : ℝ≥0∞) := by + rw [freeFisher_eq_of_conjugate _ (semicircular_conjugateSystem n)] + simp [basisVector, lp.norm_single (E := fun _ : List (Fin n) => ℂ) (p := 2)] + +theorem semicircular_moment_succ {n : ℕ} (i : Fin n) (k : ℕ) : + trace (tracialVector (Fin n)) (semicircular i ^ (k + 1)) = + ∑ r ∈ Finset.range k, trace (tracialVector (Fin n)) (semicircular i ^ r) * + trace (tracialVector (Fin n)) (semicircular i ^ (k - (r + 1))) := by + have hw (j : ℕ) : wordEval semicircular (List.replicate j i) = semicircular i ^ j := by + simp [wordEval] + rw [pow_succ', ← hw k, semicircular_integration_by_parts] + simp only [derivativeMoment, List.getElem_replicate, + ite_true, wordMoment, List.take_replicate, List.drop_replicate] + simp only [hw] + rw [Fin.sum_univ_eq_sum_range (fun r => + trace (tracialVector (Fin n)) (semicircular i ^ min r k) * + trace (tracialVector (Fin n)) (semicircular i ^ (k - (r + 1)))) + (List.replicate k i).length, List.length_replicate] + apply Finset.sum_congr rfl + intro r hr + rw [min_eq_left (Nat.le_of_lt (Finset.mem_range.mp hr))] + +private theorem sum_range_double {α : Type u2} [AddCommMonoid α] (f : ℕ → α) (k : ℕ) : + ∑ r ∈ Finset.range (2 * k), f r = + ∑ r ∈ Finset.range k, (f (2 * r) + f (2 * r + 1)) := by + induction k with + | zero => simp + | succ k ih => + rw [Nat.mul_succ, show 2 * k + 2 = (2 * k + 1) + 1 by omega] + rw [Finset.sum_range_succ, Finset.sum_range_succ, ih, + Finset.sum_range_succ, add_assoc] + +theorem semicircular_moments {n : ℕ} (i : Fin n) (k : ℕ) : + trace (tracialVector (Fin n)) (semicircular i ^ k) = + if Even k then (catalan (k / 2) : ℂ) else 0 := by + induction k using Nat.strong_induction_on with + | h k ih => + rcases k with _ | k + · simp [trace, tracialVector, basisVector] + · rw [semicircular_moment_succ] + rcases Nat.even_or_odd' k with ⟨m, rfl | rfl⟩ + · rw [ite_eq_right (by rw [Nat.even_iff]; omega : ¬Even (2 * m + 1))] + apply Finset.sum_eq_zero + intro r hr + have hr' := Finset.mem_range.mp hr + rw [ih r (by omega), ih (2 * m - (r + 1)) (by omega)] + rcases Nat.mod_two_eq_zero_or_one r with he | ho + · have : ¬ Even (2 * m - (r + 1)) := by rw [Nat.even_iff]; omega + simp [this] + · have : ¬ Even r := by rw [Nat.even_iff]; omega + simp [this] + · have he : Even (2 * m + 1 + 1) := by rw [Nat.even_iff]; omega + rw [ite_eq_left he, show (2 * m + 1 + 1) / 2 = m + 1 by omega, + Finset.sum_range_succ, sum_range_double] + have hs : ∀ r < m, + trace (tracialVector (Fin n)) (semicircular i ^ (2 * r)) * + trace (tracialVector (Fin n)) (semicircular i ^ (2 * m + 1 - (2 * r + 1))) + + trace (tracialVector (Fin n)) (semicircular i ^ (2 * r + 1)) * + trace (tracialVector (Fin n)) (semicircular i ^ (2 * m + 1 - (2 * r + 1 + 1))) = + (catalan r : ℂ) * (catalan (m - r) : ℂ) := by + intro r hr + rw [ih (2 * r) (by omega), ih (2 * m + 1 - (2 * r + 1)) (by omega), + ih (2 * r + 1) (by omega)] + have h₁ : Even (2 * r) := by rw [Nat.even_iff]; omega + have h₂ : Even (2 * m + 1 - (2 * r + 1)) := by rw [Nat.even_iff]; omega + have h₃ : ¬Even (2 * r + 1) := by rw [Nat.even_iff]; omega + simp only [h₁, h₂, h₃, ite_true, ite_false, zero_mul, add_zero] + rw [show 2 * r / 2 = r by omega, + show (2 * m + 1 - (2 * r + 1)) / 2 = m - r by omega] + rw [Finset.sum_congr rfl (fun r hr => hs r (Finset.mem_range.mp hr))] + rw [ih (2 * m) (by omega), ih (2 * m + 1 - (2 * m + 1)) (by omega)] + have h₁ : Even (2 * m) := by rw [Nat.even_iff]; omega + simp only [Nat.sub_self, h₁, ite_true, show Even (0 : ℕ) from ⟨0, rfl⟩, Nat.zero_div, + catalan_zero, Nat.cast_one, mul_one] + rw [show 2 * m / 2 = m by omega, catalan_succ, + Nat.cast_sum, ← Fin.sum_univ_eq_sum_range] + rw [Fin.sum_univ_castSucc] + simp only [Fin.val_castSucc, Fin.val_last, Nat.sub_self, catalan_zero, + mul_one, Nat.cast_mul] + +def wordSpace (J : Set ι) : Submodule ℂ (Space ι) := + Submodule.span ℂ {x | ∃ w : List ι, (∀ i ∈ w, i ∈ J) ∧ x = basisVector w} + +def startsIn (J : Set ι) : Submodule ℂ (Space ι) := + Submodule.span ℂ {x | ∃ i ∈ J, ∃ w : List ι, x = basisVector (i :: w)} + +def suffixEmbedding (w : List ι) : Space ι →L[ℂ] Space ι := + (injectionIsometry (fun v => v ++ w) (List.append_left_injective w)).toContinuousLinearMap + +@[simp] theorem suffixEmbedding_basis (w v : List ι) : + suffixEmbedding w (basisVector v) = basisVector (v ++ w) := + injectionIsometry_single _ (List.append_left_injective w) v 1 + + theorem basis_mem_wordSpace {J : Set ι} {w : List ι} (hw : ∀ i ∈ w, i ∈ J) : + basisVector w ∈ wordSpace J := Submodule.subset_span ⟨w, hw, rfl⟩ + + theorem vacuum_mem_wordSpace (J : Set ι) : basisVector [] ∈ wordSpace J := + basis_mem_wordSpace (by simp) + + theorem semicircular_preserves_wordSpace {J : Set ι} {i : ι} (hi : i ∈ J) + {x : Space ι} (hx : x ∈ wordSpace J) : semicircular i x ∈ wordSpace J := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨w, hw, rfl⟩ := hx + cases w with + | nil => + simpa [basisVector] using + (basis_mem_wordSpace (show ∀ j ∈ [i], j ∈ J by simpa using hi)) + | cons j w => + change semicircular i (lp.single 2 (j :: w) 1) ∈ wordSpace J + rw [semicircular_single_cons] + apply Submodule.add_mem + · exact basis_mem_wordSpace (by simpa using And.intro hi hw) + · split_ifs + · exact basis_mem_wordSpace (fun k hk => hw k (List.mem_cons_of_mem _ hk)) + · exact Submodule.zero_mem _ + | zero => simp + | add x y _ _ hx hy => simpa using (wordSpace J).add_mem hx hy + | smul z x _ hx => simpa using (wordSpace J).smul_mem z hx + + theorem semicircular_suffix {J : Set ι} {i : ι} (hi : i ∈ J) + (w : List ι) (hw : ∀ j ∈ w.head?, j ∉ J) {x : Space ι} (hx : x ∈ wordSpace J) : + semicircular i (suffixEmbedding w x) = suffixEmbedding w (semicircular i x) := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨v, hv, rfl⟩ := hx + cases v with + | nil => + cases w with + | nil => simp [basisVector, suffixEmbedding, injectionIsometry_single] + | cons j w => + have hij : i ≠ j := by intro hij; subst i; exact hw j (by simp) hi + simp [basisVector, suffixEmbedding, injectionIsometry_single, hij] + | cons j v => + change semicircular i (suffixEmbedding w (lp.single 2 (j :: v) 1)) = _ + rw [show suffixEmbedding w (lp.single 2 (j :: v) 1) = + lp.single 2 (j :: (v ++ w)) 1 from suffixEmbedding_basis w (j :: v)] + simp only [basisVector, semicircular_single_cons, map_add] + split_ifs <;> simp [suffixEmbedding, injectionIsometry_single] + | zero => simp + | add x y _ _ hx hy => simp [map_add, hx, hy] + | smul z x _ hx => simp [hx] + +theorem adjoin_suffix {J : Set ι} {A : Space ι →L[ℂ] Space ι} + (hA : A ∈ Algebra.adjoin ℂ (semicircular '' J)) (w : List ι) + (hw : ∀ j ∈ w.head?, j ∉ J) : + ∀ x ∈ wordSpace J, + A x ∈ wordSpace J ∧ A (suffixEmbedding w x) = suffixEmbedding w (A x) := by + induction hA using Algebra.adjoin_induction with + | mem A hA => + obtain ⟨i, hi, rfl⟩ := hA + exact fun x hx => ⟨semicircular_preserves_wordSpace hi hx, semicircular_suffix hi w hw hx⟩ + | algebraMap z => + intro x hx + constructor + · simpa using (wordSpace J).smul_mem z hx + · simp + | add A B _ _ hA hB => + intro x hx + exact ⟨(wordSpace J).add_mem (hA x hx).1 (hB x hx).1, + by simp only [add_apply, (hA x hx).2, (hB x hx).2, map_add]⟩ + | mul A B _ _ hA hB => + intro x hx + exact ⟨(hA (B x) (hB x hx).1).1, + by simp only [mul_apply_eq_comp, (hB x hx).2, (hA (B x) (hB x hx).1).2]⟩ + + theorem centered_wordSpace_suffix {J : Set ι} {x : Space ι} (hx : x ∈ wordSpace J) + (w : List ι) : suffixEmbedding w (x - x [] • basisVector []) ∈ startsIn J := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨v, hv, rfl⟩ := hx + cases v with + | nil => simp [basisVector, lp.single_apply] + | cons j v => + have hz : (basisVector (j :: v)) [] = 0 := by simp [basisVector, lp.single_apply] + rw [hz, zero_smul, sub_zero, suffixEmbedding_basis] + exact Submodule.subset_span ⟨j, hv j (by simp), v ++ w, rfl⟩ + | zero => simp + | add x y _ _ hx hy => + have h : (x + y) - (x + y) [] • basisVector [] = + (x - x [] • basisVector []) + (y - y [] • basisVector []) := by + change (x + y) - (x [] + y []) • basisVector [] = _ + rw [add_smul]; abel + rw [h, map_add] + exact (startsIn J).add_mem hx hy + | smul z x _ hx => + have h : z • x - (z • x) [] • basisVector [] = + z • (x - x [] • basisVector []) := by + change z • x - (z * x []) • basisVector [] = _ + rw [smul_sub, smul_smul] + rw [h, map_smul] + exact (startsIn J).smul_mem z hx + + theorem trace_eq_vacuum_coefficient (A : Space ι →L[ℂ] Space ι) : + trace (tracialVector ι) A = (A (basisVector [])) [] := by + simp [trace, tracialVector, basisVector, lp.inner_single_left] + + theorem centered_adjoin_basis {J : Set ι} {A : Space ι →L[ℂ] Space ι} + (hA : A ∈ Algebra.adjoin ℂ (semicircular '' J)) + (hcenter : trace (tracialVector ι) A = 0) (w : List ι) + (hw : ∀ j ∈ w.head?, j ∉ J) : A (basisVector w) ∈ startsIn J := by + have h := adjoin_suffix hA w hw (basisVector []) (vacuum_mem_wordSpace J) + have hzero : (A (basisVector [])) [] = 0 := by + rwa [← trace_eq_vacuum_coefficient] + have hs := centered_wordSpace_suffix h.1 w + simpa only [hzero, zero_smul, sub_zero, ← h.2, suffixEmbedding_basis, List.nil_append] using hs + + theorem centered_adjoin_startsIn {J K : Set ι} (hJK : Disjoint J K) + {A : Space ι →L[ℂ] Space ι} (hA : A ∈ Algebra.adjoin ℂ (semicircular '' J)) + (hcenter : trace (tracialVector ι) A = 0) {x : Space ι} (hx : x ∈ startsIn K) : + A x ∈ startsIn J := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨i, hi, w, rfl⟩ := hx + apply centered_adjoin_basis hA hcenter + intro j hj hjJ + have : j = i := by simpa using hj.symm + subst j + exact Set.disjoint_left.mp hJK hjJ hi + | zero => simp + | add x y _ _ hx hy => simpa using (startsIn J).add_mem hx hy + | smul z x _ hx => simpa using (startsIn J).smul_mem z hx + + theorem startsIn_vacuum_zero {J : Set ι} {x : Space ι} (hx : x ∈ startsIn J) : x [] = 0 := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨i, _, w, rfl⟩ := hx + simp [basisVector, lp.single_apply] + | zero => rfl + | add x y _ _ hx hy => simp [hx, hy] + | smul z x _ hx => simp [hx] + + theorem alternating_product_starts {κ : Type} (J : κ → Set ι) + (hJ : Pairwise (fun i j => Disjoint (J i) (J j))) : + ∀ (k : ℕ) (hk : 0 < k) (j : Fin k → κ) (a : Fin k → Space ι →L[ℂ] Space ι), + (∀ r, a r ∈ Algebra.adjoin ℂ (semicircular '' J (j r))) → + (∀ r, trace (tracialVector ι) (a r) = 0) → + (∀ (r : ℕ) (hr : r + 1 < k), + j ⟨r, Nat.lt_trans (Nat.lt_succ_self r) hr⟩ ≠ j ⟨r + 1, hr⟩) → + (List.ofFn a).prod (basisVector []) ∈ startsIn (J (j ⟨0, hk⟩)) := by + intro k + induction k with + | zero => intro hk; omega + | succ k ih => + intro hk j a ha hc hadj + rw [List.ofFn_succ, List.prod_cons, mul_apply_eq_comp] + cases k with + | zero => + simpa using centered_adjoin_basis (ha 0) (hc 0) [] (by simp) + | succ k => + have htail := ih (by omega) (fun r => j r.succ) (fun r => a r.succ) + (fun r => ha r.succ) (fun r => hc r.succ) (by + intro r hr + exact hadj (r + 1) (by omega)) + exact centered_adjoin_startsIn (hJ (hadj 0 (by omega))) (ha 0) (hc 0) htail + +theorem free_grouped_semicircular {κ : Type} (J : κ → Set ι) + (hJ : Pairwise (fun i j => Disjoint (J i) (J j))) : + FreeSubalgebras (tracialVector ι) + (fun j => Algebra.adjoin ℂ (semicircular '' J j)) := by + intro k hk j a ha hc hadj + rw [trace_eq_vacuum_coefficient] + exact startsIn_vacuum_zero (alternating_product_starts J hJ k hk j a ha hc hadj) + +theorem free_semicircular : + FreeSubalgebras (tracialVector ι) (fun i : ι => Algebra.adjoin ℂ {semicircular i}) := by + simpa only [Set.image_singleton] using free_grouped_semicircular (fun i : ι => {i}) + (by intro i j hij; exact Set.disjoint_singleton.mpr hij) + +theorem freeStandardNoise {m n : ℕ} (J : Set (Fin m)) + (X : Fin n → Space (Fin m) →L[ℂ] Space (Fin m)) + (hX : ∀ i, X i ∈ Algebra.adjoin ℂ (semicircular '' J)) + (σ : Fin n → Fin m) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) : + FreeStandardNoise (tracialVector (Fin m)) X (fun i => semicircular (σ i)) := by + refine ⟨fun i k => semicircular_moments (σ i) k, ?_⟩ + let K : Option (Fin n) → Set (Fin m) := fun j => match j with + | none => J + | some i => {σ i} + have hK : Pairwise (fun i j => Disjoint (K i) (K j)) := by + intro i j hij + cases i with + | none => + cases j with + | none => exact False.elim (hij rfl) + | some j => exact Set.disjoint_singleton_right.mpr (hs j) + | some i => + cases j with + | none => exact Set.disjoint_singleton_left.mpr (hs i) + | some j => exact Set.disjoint_singleton.mpr (fun h => hij (congrArg some (hσ h))) + apply (free_grouped_semicircular K hK).mono + intro j + cases j with + | none => + apply Algebra.adjoin_le + rintro _ ⟨i, rfl⟩ + exact hX i + | some i => simp [K] + +theorem rightAnnihilation_adjoin {J : Set ι} {i : ι} (hi : i ∉ J) + {A : Space ι →L[ℂ] Space ι} (hA : A ∈ Algebra.adjoin ℂ (semicircular '' J)) : + Commute (star (rightCreation i)) A := by + induction hA using Algebra.adjoin_induction with + | mem A hA => + obtain ⟨j, hj, rfl⟩ := hA + have hij : i ≠ j := by intro h; subst j; exact hi hj + show _ * _ = _ * _ + simpa [hij] using rightAnnihilation_semicircular i j + | algebraMap z => exact Algebra.commutes z _ |>.symm + | add A B _ _ hA hB => exact hA.add_right hB + | mul A B _ _ hA hB => exact hA.mul_right hB + +theorem heat_freeFisher_le {n : ℕ} (J : Set ι) + (X : Fin n → Space ι →L[ℂ] Space ι) + (hX : ∀ i, X i ∈ Algebra.adjoin ℂ (semicircular '' J)) + (σ : Fin n → ι) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) + (u : ℝ) (hu : 0 < u) : + freeFisher (tracialVector ι) (heatTuple X (fun i => semicircular (σ i)) u) ≤ + ENNReal.ofReal ((n : ℝ) / u) := by + let Z := heatTuple X (fun i => semicircular (σ i)) u + let η : Fin n → Space ι := fun i => ((Real.sqrt u)⁻¹ : ℂ) • basisVector [σ i] + have hc (i j : Fin n) : star (rightCreation (σ i)) * Z j = + Z j * star (rightCreation (σ i)) + + if j = i then (Real.sqrt u : ℂ) • vacuumRankOne (tracialVector ι) else 0 := by + change _ * (X j + (Real.sqrt u : ℂ) • semicircular (σ j)) = _ + rw [mul_add, mul_smul_comm, (rightAnnihilation_adjoin (hs i) (hX j)).eq, + rightAnnihilation_semicircular] + change _ = (X j + (Real.sqrt u : ℂ) • semicircular (σ j)) * + star (rightCreation (σ i)) + + if j = i then (Real.sqrt u : ℂ) • vacuumProjection else 0 + by_cases hij : j = i + · subst j + simp only [ite_true, add_mul, smul_mul_assoc, add_assoc] + congr 1 + exact smul_add _ _ _ + · have hneq : σ i ≠ σ j := fun h => hij (hσ h).symm + simp [hij, hneq, add_mul, smul_mul_assoc] + have hu' : Real.sqrt u ≠ 0 := ne_of_gt (Real.sqrt_pos.mpr hu) + have hη (i : Fin n) (w : List (Fin n)) : + inner ℂ (η i) (wordEval Z w (tracialVector ι).vacuum) = + derivativeMoment (tracialVector ι) Z i w := by + have h := commutator_integration_by_parts (tracialVector ι) Z + (star (rightCreation (σ i))) i (Real.sqrt u) (hc i) + (by simp [tracialVector, basisVector]) w + simp only [star_star, tracialVector, basisVector, rightCreation_single, + List.nil_append] at h + change inner ℂ (((Real.sqrt u : ℂ)⁻¹) • lp.single 2 [σ i] 1) + (wordEval Z w (lp.single 2 [] 1)) = _ + rw [inner_smul_left, h] + simp [hu', tracialVector, basisVector] + refine (freeFisher_le_testVectors (tracialVector ι) Z η hη).trans ?_ + apply ENNReal.ofReal_le_ofReal + have hnorm (i : Fin n) : ‖η i‖ ^ 2 = u⁻¹ := by + simp [η, norm_smul, basisVector, norm_inv, + lp.norm_single (E := fun _ : List ι => ℂ) (p := 2), + abs_of_nonneg (Real.sqrt_nonneg u), inv_pow, Real.sq_sqrt (le_of_lt hu)] + simp [hnorm, div_eq_mul_inv] + +end Fock + +namespace LabelHilbert +open scoped lp +variable {α : Type} [DecidableEq α] +abbrev Space (α : Type) := lp (fun _ : α => ℂ) 2 + +def basis (a : α) : Space α := lp.single 2 a 1 + +def coordinateIsometry (a : α) : ℂ →ₗᵢ[ℂ] Space α where + toLinearMap := lp.lsingle (𝕜 := ℂ) (E := fun _ : α => ℂ) 2 a + norm_map' z := lp.norm_single (E := fun _ : α => ℂ) (p := 2) (by norm_num) a z + +theorem orthogonal_coordinates (f : α → α) (hf : Function.Injective f) : + OrthogonalFamily ℂ (fun _ : α => ℂ) (fun a => coordinateIsometry (f a)) := by + intro a b hab x y + change inner ℂ (lp.single (E := fun _ : α => ℂ) 2 (f a) x) + (lp.single (E := fun _ : α => ℂ) 2 (f b) y) = 0 + rw [lp.inner_single_left, lp.single_apply_ne (E := fun _ : α => ℂ) 2 (f b) y + (fun h => hab (hf h))] + simp + +def lift (f : α → α) (hf : Function.Injective f) : Space α →L[ℂ] Space α := + (orthogonal_coordinates f hf).linearIsometry.toContinuousLinearMap + +@[simp] theorem lift_single (f : α → α) (hf : Function.Injective f) (a : α) (z : ℂ) : + lift f hf (lp.single 2 a z) = lp.single 2 (f a) z := + (orthogonal_coordinates f hf).linearIsometry_apply_single z + +@[simp] theorem lift_basis (f : α → α) (hf : Function.Injective f) (a : α) : + lift f hf (basis a) = basis (f a) := lift_single f hf a 1 + + theorem adjoint_apply (f : α → α) (hf : Function.Injective f) (x : Space α) (a : α) : + (star (lift f hf) x) a = x (f a) := by + have h := ContinuousLinearMap.adjoint_inner_right (lift f hf) (basis a) x + simpa [basis, ContinuousLinearMap.star_eq_adjoint, lp.inner_single_left] using h + + theorem adjoint_single_of_inverse (f : α → α) (hf : Function.Injective f) + (q : α → Option α) (hq : ∀ a b, q b = some a ↔ f a = b) (b : α) (z : ℂ) : + star (lift f hf) (lp.single 2 b z) = (q b).elim 0 (fun a => lp.single 2 a z) := by + apply lp.ext + funext a + rw [adjoint_apply] + cases h : q b with + | none => + have hab : f a ≠ b := fun he => by have := (hq a b).mpr he; simp [h] at this + simp [lp.single_apply, hab] + | some c => + have hfc : f c = b := (hq c b).mp h + subst b + change (lp.single (E := fun _ : α => ℂ) 2 (f c) z) (f a) = + (lp.single (E := fun _ : α => ℂ) 2 c z) a + by_cases hac : a = c + · subst a; simp + · rw [lp.single_apply_ne (E := fun _ : α => ℂ) 2 (f c) z (fun h => hac (hf h)), + lp.single_apply_ne (E := fun _ : α => ℂ) 2 c z hac] + + theorem lift_mul (f g : α → α) (hf : Function.Injective f) (hg : Function.Injective g) : + lift f hf * lift g hg = lift (f ∘ g) (hf.comp hg) := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro a + apply ContinuousLinearMap.ext + intro z + change lift f hf (lift g hg (lp.single 2 a z)) = _ + simp + + theorem lift_commute (f g : α → α) (hf : Function.Injective f) (hg : Function.Injective g) + (hfg : Function.Commute f g) : Commute (lift f hf) (lift g hg) := by + show _ * _ = _ * _ + rw [lift_mul, lift_mul] + congr 1 + exact funext hfg + +end LabelHilbert + +namespace FreeTensor +variable {B N G : Type} [Group G] +abbrev Atom (B G : Type) := List B × G +abbrev Word (B N G : Type) := Atom B G × List (N × Atom B G) + +def empty : Word B N G := (([], 1), []) +def push (a : Atom B G) (i : N) (w : Word B N G) : Word B N G := + (a, (i, w.1) :: w.2) +def append (w : Word B N G) (i : N) (a : Atom B G) : Word B N G := + (w.1, w.2 ++ [(i, a)]) +def reverseAtom (a : Atom B G) : Atom B G := (a.1.reverse, a.2⁻¹) + +@[simp] theorem reverseAtom_involutive (a : Atom B G) : reverseAtom (reverseAtom a) = a := by + simp [reverseAtom] + +def reverseAux (a : Atom B G) : List (N × Atom B G) → Word B N G + | [] => (reverseAtom a, []) + | (i,b) :: t => append (reverseAux b t) i (reverseAtom a) +def reverse (w : Word B N G) : Word B N G := reverseAux w.1 w.2 + +@[simp] theorem reverse_nil (a : Atom B G) : reverse (a, ([] : List (N × Atom B G))) = + (reverseAtom a, []) := rfl +@[simp] theorem reverse_push (a : Atom B G) (i : N) (w : Word B N G) : + reverse (push a i w) = append (reverse w) i (reverseAtom a) := rfl + +omit [Group G] in + theorem push_append (a b : Atom B G) (i j : N) (w : Word B N G) : + push a i (append w j b) = append (push a i w) j b := rfl + + theorem reverse_append (w : Word B N G) (i : N) (a : Atom B G) : + reverse (append w i a) = push (reverseAtom a) i (reverse w) := by + rcases w with ⟨b, t⟩ + induction t generalizing b with + | nil => rfl + | cons c t ih => + rcases c with ⟨j,c⟩ + change append (reverse (append (c,t) i a)) j (reverseAtom b) = _ + rw [ih, ← push_append] + rfl + +@[simp] theorem reverse_involutive (w : Word B N G) : reverse (reverse w) = w := by + rcases w with ⟨a,t⟩ + induction t generalizing a with + | nil => simp + | cons b t ih => + rcases b with ⟨i,b⟩ + change reverse (append (reverse (b,t)) i (reverseAtom a)) = _ + rw [reverse_append, reverseAtom_involutive, ih] + rfl + +def leftB (b : B) (w : Word B N G) : Word B N G := ((b :: w.1.1, w.1.2), w.2) +def leftN (i : N) (w : Word B N G) : Word B N G := push ([],1) i w +def leftG (g : G) (w : Word B N G) : Word B N G := ((w.1.1, g * w.1.2), w.2) +def rightB (b : B) (w : Word B N G) : Word B N G := reverse (leftB b (reverse w)) +def rightN (i : N) (w : Word B N G) : Word B N G := reverse (leftN i (reverse w)) +def rightG (g : G) (w : Word B N G) : Word B N G := reverse (leftG g (reverse w)) + +omit [Group G] in + theorem leftB_injective (b : B) : Function.Injective (leftB (N := N) (G := G) b) := by + rintro ⟨⟨v,g⟩,t⟩ ⟨⟨w,h⟩,s⟩ he + simpa [leftB] using he + theorem leftN_injective (i : N) : Function.Injective (leftN (B := B) (G := G) i) := by + rintro ⟨a,t⟩ ⟨b,s⟩ he + simpa [leftN, push] using he + theorem leftG_injective (g : G) : Function.Injective (leftG (B := B) (N := N) g) := by + rintro ⟨⟨v,h⟩,t⟩ ⟨⟨w,k⟩,s⟩ he + simpa [leftG] using he + theorem reverse_injective : Function.Injective (reverse (B := B) (N := N) (G := G)) := + Function.Involutive.injective reverse_involutive + theorem rightB_injective (b : B) : Function.Injective (rightB (N := N) (G := G) b) := + reverse_injective.comp ((leftB_injective b).comp reverse_injective) + theorem rightN_injective (i : N) : Function.Injective (rightN (B := B) (G := G) i) := + reverse_injective.comp ((leftN_injective i).comp reverse_injective) + theorem rightG_injective (g : G) : Function.Injective (rightG (B := B) (N := N) g) := + reverse_injective.comp ((leftG_injective g).comp reverse_injective) + +@[simp] theorem rightB_nil (b : B) (a : Atom B G) : + rightB b (a, ([] : List (N × Atom B G))) = ((a.1 ++ [b],a.2),[]) := by + simp [rightB, leftB, reverse, reverseAux, reverseAtom] +@[simp] theorem rightB_push (b : B) (a : Atom B G) (i : N) (w : Word B N G) : + rightB b (push a i w) = push a i (rightB b w) := by + have h (v : Word B N G) : leftB b (append v i (reverseAtom a)) = + append (leftB b v) i (reverseAtom a) := rfl + rw [rightB, reverse_push, h, reverse_append, reverseAtom_involutive] + rfl +@[simp] theorem rightN_eq_append (i : N) (w : Word B N G) : + rightN i w = append w i ([],1) := by + rw [rightN, leftN, reverse_push, reverse_involutive] + simp [reverseAtom] + +@[simp] theorem rightG_nil (g : G) (a : Atom B G) : + rightG g (a, ([] : List (N × Atom B G))) = ((a.1,a.2 * g⁻¹),[]) := by + simp [rightG, leftG, reverse, reverseAux, reverseAtom] +@[simp] theorem rightG_push (g : G) (a : Atom B G) (i : N) (w : Word B N G) : + rightG g (push a i w) = push a i (rightG g w) := by + have h (v : Word B N G) : leftG g (append v i (reverseAtom a)) = + append (leftG g v) i (reverseAtom a) := rfl + rw [rightG, reverse_push, h, reverse_append, reverseAtom_involutive] + rfl + + theorem leftB_rightB (b c : B) : + Function.Commute (leftB (N := N) (G := G) b) (rightB c) := by + rintro ⟨⟨v,g⟩,t⟩ + cases t with + | nil => simp [leftB] + | cons a t => + rcases a with ⟨i,a⟩ + change leftB b (rightB c (push (v,g) i (a,t))) = + rightB c (push (b::v,g) i (a,t)) + rw [rightB_push, rightB_push] + rfl + theorem leftN_rightB (i : N) (b : B) : + Function.Commute (leftN (G := G) i) (rightB b) := by + intro w + exact (rightB_push b ([],1) i w).symm + theorem leftG_rightB (g : G) (b : B) : + Function.Commute (leftG (N := N) g) (rightB b) := by + rintro ⟨⟨v,h⟩,t⟩ + cases t with + | nil => simp [leftG] + | cons a t => + rcases a with ⟨i,a⟩ + change leftG g (rightB b (push (v,h) i (a,t))) = + rightB b (push (v,g*h) i (a,t)) + rw [rightB_push, rightB_push] + rfl + theorem leftB_rightN (b : B) (i : N) : + Function.Commute (leftB (G := G) b) (rightN i) := by + intro w + simp only [rightN_eq_append] + rfl + theorem leftN_rightN (i j : N) : + Function.Commute (leftN (B := B) (G := G) i) (rightN j) := by + intro w + simp only [rightN_eq_append] + rfl + theorem leftG_rightN (g : G) (i : N) : + Function.Commute (leftG (B := B) g) (rightN i) := by + intro w + simp only [rightN_eq_append] + rfl + theorem leftB_rightG (b : B) (g : G) : + Function.Commute (leftB (N := N) b) (rightG g) := by + rintro ⟨⟨v,h⟩,t⟩ + cases t with + | nil => simp [leftB] + | cons a t => + rcases a with ⟨i,a⟩ + change leftB b (rightG g (push (v,h) i (a,t))) = + rightG g (push (b::v,h) i (a,t)) + rw [rightG_push, rightG_push] + rfl + theorem leftN_rightG (i : N) (g : G) : + Function.Commute (leftN (B := B) i) (rightG g) := by + intro w + exact (rightG_push g ([],1) i w).symm + theorem leftG_rightG (g h : G) : + Function.Commute (leftG (B := B) (N := N) g) (rightG h) := by + rintro ⟨⟨v,k⟩,t⟩ + cases t with + | nil => simp [leftG, mul_assoc] + | cons a t => + rcases a with ⟨i,a⟩ + change leftG g (rightG h (push (v,k) i (a,t))) = + rightG h (push (v,g*k) i (a,t)) + rw [rightG_push, rightG_push] + rfl + +variable [DecidableEq B] [DecidableEq N] [DecidableEq G] +open scoped lp +abbrev Space (B N G : Type) := LabelHilbert.Space (Word B N G) +def basis (w : Word B N G) : Space B N G := lp.single 2 w 1 + +def creationB (b : B) : Space B N G →L[ℂ] Space B N G := + LabelHilbert.lift (leftB b) (leftB_injective b) +def creationN (i : N) : Space B N G →L[ℂ] Space B N G := + LabelHilbert.lift (leftN i) (leftN_injective i) +def unitaryG (g : G) : Space B N G →L[ℂ] Space B N G := + LabelHilbert.lift (leftG g) (leftG_injective g) +def rightCreationB (b : B) : Space B N G →L[ℂ] Space B N G := + LabelHilbert.lift (rightB b) (rightB_injective b) +def rightCreationN (i : N) : Space B N G →L[ℂ] Space B N G := + LabelHilbert.lift (rightN i) (rightN_injective i) +def rightUnitaryG (g : G) : Space B N G →L[ℂ] Space B N G := + LabelHilbert.lift (rightG g) (rightG_injective g) + +omit [Group G] in +@[simp] theorem creationB_single (b : B) (w : Word B N G) (z : ℂ) : + creationB b (lp.single 2 w z) = lp.single 2 (leftB b w) z := + LabelHilbert.lift_single _ _ _ _ +@[simp] theorem creationN_single (i : N) (w : Word B N G) (z : ℂ) : + creationN i (lp.single 2 w z) = lp.single 2 (leftN i w) z := + LabelHilbert.lift_single _ _ _ _ +@[simp] theorem unitaryG_single (g : G) (w : Word B N G) (z : ℂ) : + unitaryG g (lp.single 2 w z) = lp.single 2 (leftG g w) z := + LabelHilbert.lift_single _ _ _ _ +@[simp] theorem rightCreationB_single (b : B) (w : Word B N G) (z : ℂ) : + rightCreationB b (lp.single 2 w z) = lp.single 2 (rightB b w) z := + LabelHilbert.lift_single _ _ _ _ +@[simp] theorem rightCreationN_single (i : N) (w : Word B N G) (z : ℂ) : + rightCreationN i (lp.single 2 w z) = lp.single 2 (rightN i w) z := + LabelHilbert.lift_single _ _ _ _ +@[simp] theorem rightUnitaryG_single (g : G) (w : Word B N G) (z : ℂ) : + rightUnitaryG g (lp.single 2 w z) = lp.single 2 (rightG g w) z := + LabelHilbert.lift_single _ _ _ _ + +def removeB (b : B) (w : Word B N G) : Option (Word B N G) := + match w.1.1 with + | [] => none + | c::v => if b = c then some ((v,w.1.2),w.2) else none + +def removeN (i : N) (w : Word B N G) : Option (Word B N G) := + if w.1 = ([],1) then match w.2 with + | [] => none + | (j,a)::t => if i = j then some (a,t) else none + else none + +omit [Group G] [DecidableEq N] [DecidableEq G] in + theorem removeB_spec (b : B) (u v : Word B N G) : removeB b v = some u ↔ leftB b u = v := by + rcases u with ⟨⟨uv,ug⟩,ut⟩ + rcases v with ⟨⟨vv,vg⟩,vt⟩ + cases vv with + | nil => simp [removeB, leftB] + | cons c vv => + by_cases h : b = c + · subst c; simp [removeB, leftB, eq_comm] + · simp [removeB, leftB, h] + + theorem removeN_spec (i : N) (u v : Word B N G) : removeN i v = some u ↔ leftN i u = v := by + rcases u with ⟨ua,ut⟩ + rcases v with ⟨va,vt⟩ + by_cases h : va = ([],1) + · subst va + cases vt with + | nil => simp [removeN, leftN, push] + | cons a t => + rcases a with ⟨j,a⟩ + by_cases hij : i = j + · subst j; simp [removeN, leftN, push, eq_comm] + · simp [removeN, leftN, push, hij] + · simp [removeN, leftN, push, h, Ne.symm h] + +omit [Group G] in + theorem annihilationB_single (b : B) (w : Word B N G) (z : ℂ) : + star (creationB b) (lp.single 2 w z) = + (removeB b w).elim 0 (fun a => lp.single 2 a z) := + LabelHilbert.adjoint_single_of_inverse _ _ _ (removeB_spec b) _ _ + theorem annihilationN_single (i : N) (w : Word B N G) (z : ℂ) : + star (creationN i) (lp.single 2 w z) = + (removeN i w).elim 0 (fun a => lp.single 2 a z) := + LabelHilbert.adjoint_single_of_inverse _ _ _ (removeN_spec i) _ _ + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in + theorem right_remove_spec (f : Word B N G → Word B N G) + (q : Word B N G → Option (Word B N G)) (hq : ∀ u v, q v = some u ↔ f u = v) + (u v : Word B N G) : + (q (reverse v)).map reverse = some u ↔ reverse (f (reverse u)) = v := by + rw [Option.map_eq_some_iff] + constructor + · rintro ⟨a,ha,hu⟩ + have had : a = reverse u := by rw [← hu, reverse_involutive] + rw [had] at ha + rw [(hq _ _).mp ha, reverse_involutive] + · intro h + refine ⟨reverse u, (hq _ _).mpr ?_, reverse_involutive u⟩ + have := congrArg reverse h + simpa using this + + theorem rightAnnihilationB_single (b : B) (w : Word B N G) (z : ℂ) : + star (rightCreationB b) (lp.single 2 w z) = + ((removeB b (reverse w)).map reverse).elim 0 (fun a => lp.single 2 a z) := + LabelHilbert.adjoint_single_of_inverse _ _ _ (right_remove_spec _ _ (removeB_spec b)) _ _ + theorem rightAnnihilationN_single (i : N) (w : Word B N G) (z : ℂ) : + star (rightCreationN i) (lp.single 2 w z) = + ((removeN i (reverse w)).map reverse).elim 0 (fun a => lp.single 2 a z) := + LabelHilbert.adjoint_single_of_inverse _ _ _ (right_remove_spec _ _ (removeN_spec i)) _ _ + +@[simp] theorem rightAnnihilationN_atom (i : N) (a : Atom B G) (z : ℂ) : + star (rightCreationN i) (lp.single 2 (a,[]) z) = 0 := by + rw [rightAnnihilationN_single] + have hr : removeN i (reverse (a,[])) = none := by + dsimp only [reverse_nil, removeN] + split <;> rfl + rw [hr] + rfl + + theorem rightAnnihilationN_append (i j : N) (w : Word B N G) (a : Atom B G) (z : ℂ) : + star (rightCreationN i) (lp.single 2 (append w j a) z) = + if a = ([],1) ∧ i = j then lp.single 2 w z else 0 := by + rw [rightAnnihilationN_single, reverse_append] + have ha : reverseAtom a = ([],1) ↔ a = ([],1) := by + rcases a with ⟨v,g⟩ + simp [reverseAtom] + by_cases haa : a = ([],1) + · subst a + by_cases hij : i = j <;> simp [removeN, push, reverseAtom, hij] + · simp [removeN, push, ha, haa] + +@[simp] theorem rightAnnihilationB_atom_nil (b : B) (g : G) (z : ℂ) : + star (rightCreationB (N := N) b) (lp.single 2 (([],g),[]) z) = 0 := by + rw [rightAnnihilationB_single] + simp [reverse_nil, reverseAtom, removeB] + + theorem rightAnnihilationB_atom_append (b c : B) (v : List B) (g : G) (z : ℂ) : + star (rightCreationB (N := N) b) (lp.single 2 ((v ++ [c],g),[]) z) = + if b = c then lp.single 2 ((v,g),[]) z else 0 := by + rw [rightAnnihilationB_single] + by_cases h : b = c <;> simp [reverse_nil, reverseAtom, removeB, h] + +@[simp] theorem rightAnnihilationB_append_nil (b : B) (w : Word B N G) (i : N) + (g : G) (z : ℂ) : + star (rightCreationB b) (lp.single 2 (append w i ([],g)) z) = 0 := by + rw [rightAnnihilationB_single, reverse_append] + simp [reverseAtom, push, removeB] + + theorem rightAnnihilationB_append_append (b c : B) (w : Word B N G) (i : N) + (v : List B) (g : G) (z : ℂ) : + star (rightCreationB b) (lp.single 2 (append w i (v ++ [c],g)) z) = + if b = c then lp.single 2 (append w i (v,g)) z else 0 := by + rw [rightAnnihilationB_single, reverse_append] + have hinv := reverse_involutive w + simp only [reverse] at hinv + by_cases h : b = c <;> + simp [reverseAtom, push, removeB, h, reverse, reverseAux, append, hinv] + + theorem creationB_commutes_rightAnnihilationN (b : B) (i : N) : + Commute (creationB (G := G) b) (star (rightCreationN i)) := by + show _ * _ = _ * _ + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change creationB b (star (rightCreationN i) (lp.single 2 w z)) = + star (rightCreationN i) (creationB b (lp.single 2 w z)) + rcases w with ⟨a,t⟩ + induction t using List.reverseRecOn with + | nil => simp [leftB] + | append_singleton t c _ => + rcases c with ⟨j,c⟩ + change creationB b (star (rightCreationN i) (lp.single 2 (append (a,t) j c) z)) = _ + rw [rightAnnihilationN_append, creationB_single] + change creationB b (if c = ([],1) ∧ i = j then lp.single 2 (a,t) z else 0) = + star (rightCreationN i) (lp.single 2 (append (leftB b (a,t)) j c) z) + rw [rightAnnihilationN_append] + split_ifs <;> simp + + theorem creationN_commutes_rightAnnihilationB (i : N) (b : B) : + Commute (creationN (G := G) i) (star (rightCreationB b)) := by + show _ * _ = _ * _ + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change creationN i (star (rightCreationB b) (lp.single 2 w z)) = + star (rightCreationB b) (creationN i (lp.single 2 w z)) + rcases w with ⟨⟨av,g⟩,t⟩ + induction t using List.reverseRecOn with + | nil => + induction av using List.reverseRecOn with + | nil => + rw [rightAnnihilationB_atom_nil, map_zero, creationN_single] + change 0 = star (rightCreationB b) (lp.single 2 (append empty i ([],g)) z) + simp + | append_singleton v c _ => + rw [rightAnnihilationB_atom_append, creationN_single] + change creationN i (if b = c then lp.single 2 ((v,g),[]) z else 0) = + star (rightCreationB b) (lp.single 2 (append empty i (v ++ [c],g)) z) + rw [rightAnnihilationB_append_append] + split_ifs <;> simp [leftN, push, append, empty] + | append_singleton t c _ => + rcases c with ⟨j,⟨v,h⟩⟩ + rw [creationN_single] + change creationN i (star (rightCreationB b) + (lp.single 2 (append ((av,g),t) j (v,h)) z)) = + star (rightCreationB b) (lp.single 2 (append (leftN i ((av,g),t)) j (v,h)) z) + induction v using List.reverseRecOn with + | nil => simp + | append_singleton v c _ => + rw [rightAnnihilationB_append_append, rightAnnihilationB_append_append] + split_ifs <;> simp [leftN, push, append] + +end FreeTensor + +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/BilinearNet.lean b/lean/OAI/Analysis/FreeEntropy/BilinearNet.lean new file mode 100644 index 0000000000000000000000000000000000000000..25b4846ae843de8552649553e7767e8be6e7c9d7 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/BilinearNet.lean @@ -0,0 +1,65 @@ +import OAI.Analysis.FreeEntropy.MatrixBilinear + +namespace OAI + +universe u1 + +noncomputable section +open scoped ComplexConjugate +open Finset Metric Set +namespace FiniteEntropySeparation + variable {E : Type u1} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + theorem norm_le_of_unit_inner (z : E) {C : ℝ} (hC : 0 ≤ C) + (h : ∀ v : E, ‖v‖ = 1 → ‖inner ℂ v z‖ ≤ C) : ‖z‖ ≤ C := by + by_cases hz : z=0 + · simpa [hz] using hC + have hn : ‖z‖ ≠ 0 := norm_ne_zero_iff.mpr hz + have hv : ‖(‖z‖⁻¹ : ℝ) • z‖ = 1 := by rw [norm_smul, Real.norm_eq_abs, abs_inv, abs_norm, inv_mul_cancel₀ hn] + have hh := h ((‖z‖⁻¹ : ℝ) • z) hv + simpa [inner_smul_real_left, norm_smul, inner_self_eq_norm_sq_to_K, norm_pow, + Real.norm_eq_abs, abs_inv, abs_norm, sq, ← mul_assoc, inv_mul_cancel₀ hn] using hh + theorem opNorm_le_of_bilinear (T : E →L[ℂ] E) {C : ℝ} (hC : 0 ≤ C) + (h : ∀ x y : E, ‖x‖ = 1 → ‖y‖ = 1 → ‖inner ℂ x (T y)‖ ≤ C) : ‖T‖ ≤ C := by + apply ContinuousLinearMap.opNorm_le_of_unit_norm hC + intro y hy + exact norm_le_of_unit_inner _ hC (fun x hx => h x y hx hy) + theorem bilinear_net_bound (T : E →L[ℂ] E) (s : Finset E) + (hs : ∀ x ∈ s, ‖x‖ = 1) + (hcov : ∀ x : E, ‖x‖ = 1 → ∃ y ∈ s, dist x y ≤ 1/4) + {M : ℝ} (hM : 0 ≤ M) (hB : ∀ x ∈ s, ∀ y ∈ s, ‖inner ℂ x (T y)‖ ≤ M) : ‖T‖ ≤ 2*M := by + have hb : ‖T‖ ≤ M + ‖T‖/2 := by + apply opNorm_le_of_bilinear T (by positivity) + intro x y hx hy + obtain ⟨u,hu,hxu⟩ := hcov x hx + obtain ⟨v,hv,hyv⟩ := hcov y hy + have he : inner ℂ x (T y) = inner ℂ u (T v) + inner ℂ (x-u) (T y) + inner ℂ u (T (y-v)) := by + simp only [map_sub, inner_sub_left, inner_sub_right]; abel + have h1 : ‖inner ℂ (x-u) (T y)‖ ≤ ‖T‖/4 := by + calc + _ ≤ ‖x-u‖*‖T y‖ := norm_inner_le_norm _ _ + _ ≤ (1/4)*(‖T‖*‖y‖) := mul_le_mul (by simpa [dist_eq_norm] using hxu) (T.le_opNorm y) (norm_nonneg _) (by norm_num) + _ = _ := by rw [hy]; ring + have h2 : ‖inner ℂ u (T (y-v))‖ ≤ ‖T‖/4 := by + calc + _ ≤ ‖u‖*‖T (y-v)‖ := norm_inner_le_norm _ _ + _ ≤ ‖u‖*(‖T‖*‖y-v‖) := mul_le_mul_of_nonneg_left (T.le_opNorm _) (norm_nonneg _) + _ ≤ 1*(‖T‖*(1/4)) := by rw [hs u hu]; gcongr; simpa [dist_eq_norm] using hyv + _ = _ := by ring + rw [he] + exact ((norm_add_le _ _).trans (add_le_add ((norm_add_le _ _).trans (add_le_add (hB u hu v hv) h1)) h2)).trans_eq (by ring) + linarith + theorem sphere_finite_net [FiniteDimensional ℝ E] : + ∃ s : Finset E, (∀ x ∈ s, ‖x‖ = 1) ∧ + (∀ x : E, ‖x‖ = 1 → ∃ y ∈ s, dist x y ≤ 1/4) ∧ + (s.card : ℝ) ≤ 9^Module.finrank ℝ E := by + obtain ⟨s,hs,hc,hb⟩ := compact_finite_net (sphere (0:E) 1) (isCompact_sphere 0 1) + (R := 1) (ε := 1/4) (by norm_num) (by norm_num) (by intro x hx; exact (mem_sphere_zero_iff_norm.mp hx).le) + refine ⟨s,?_,?_,?_⟩ + · intro x hx; exact mem_sphere_zero_iff_norm.mp (hs x hx) + · intro x hx; exact hc x (mem_sphere_zero_iff_norm.mpr hx) + · norm_num at hb ⊢; exact hb +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/BlockEnsembleLower.lean b/lean/OAI/Analysis/FreeEntropy/BlockEnsembleLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..b205610ca083ea06208d6b98bc81c43c88a29f76 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/BlockEnsembleLower.lean @@ -0,0 +1,66 @@ +import OAI.Analysis.FreeEntropy.TotalSecond + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal Topology +namespace FiniteEntropySeparation +variable {p d : ℕ} + theorem matrixHeatLaw_block_lower (hp : 2≤p) (hd : 0 ENNReal.ofReal (smoothedDensity μ (t/d) x))) E + rw [← smoothedLaw_eq μ htd,Measure.map_apply (by fun_prop) hE] + have : IsProbabilityMeasure (normalLaw (ι := MatrixIndex (p+1) d) (t/d)) := normalLaw_probability htd + rw [Measure.prod_apply (hE.preimage (show Measurable (fun z : MatrixCoordinates (p+1) d × MatrixCoordinates (p+1) d => z.1+z.2) from by fun_prop))] + calc + _ = ∫⁻a : MatrixCoordinates (p+1) d,ENNReal.ofReal (1/2:ℝ) ∂μ := by simp + _ ≤ _ := lintegral_mono_ae (hμ.mono (fun a ha => blockEvent_conditional_lower hp hd ht hv htv hpt a ha.1 ha.2)) +namespace Model +variable (p : ℕ) [NeZero p] + theorem diagonalMicrostates_blocks_eventually {δ Δ : ℝ} (hδ : 0<δ) (hΔ : 0<Δ) (hδΔ : δ≤Δ/4) + (hsep : ∀i j : Fin p,i≠j → Δ≤|equidiscreteAtom p i-equidiscreteAtom p j|) + (hq : ∀l : Fin p,∀r : ℝ,|r-equidiscreteAtom p l|≤δ → (3:ℝ)/4≤((spectralBasis p l).eval r)^2) + {h : ℝ} (hh : spectralGood p δ Δ (wordMoment (τ p) (X p h))) (R : ℝ) : + ∀ᶠk : ℕ in atTop,∀d : ℕ,0 fun_prop + theorem rotateCoordinates_continuous_joint : + Continuous (fun z : unitary (Matrix (Fin d) (Fin d) ℂ) × MatrixCoordinates n d => rotateCoordinates z.1 z.2) := by + unfold rotateCoordinates + apply matrixCoordinatesOfHermitian_continuous.comp + apply continuous_pi + intro i + exact ((continuous_subtype_val.comp continuous_fst).star.mul ((hermitianMatrix_continuous i).comp continuous_snd)).mul + (continuous_subtype_val.comp continuous_fst) + def blockEvent (p d : ℕ) (r M : ℝ) : Set (MatrixCoordinates (p+1) d) := + {a | ‖a‖≤M ∧ ∃f : Fin d → Fin p,balancedBlocks f ∧ + ∃U : unitary (Matrix (Fin d) (Fin d) ℂ),r≤‖coordinateMask (blockMask f) (rotateCoordinates U a)‖} + theorem blockEvent_isClosed (hd : 0 isClosed_iUnion_of_finite (fun _ => hf f))) + theorem blockEvent_subset_net (hd : 0 hbound f hf V)) + · simp [hf] + _ = ENNReal.ofReal ((p:ℝ)^d*(S.card:ℝ)*K) := by + simp only [sum_const,nsmul_eq_mul,card_univ,Fintype.card_fun,Fintype.card_fin] + simp only [ENNReal.ofReal_mul (show 0≤(p:ℝ)^d by positivity), ENNReal.ofReal_pow (show (0:ℝ)≤p by positivity), ENNReal.ofReal_natCast, Nat.cast_pow, ENNReal.ofReal_mul (show (0:ℝ)≤S.card by positivity), mul_assoc] + _ ≤ _ := by + apply ENNReal.ofReal_le_ofReal + have hh := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hcard (by positivity : 0≤(p:ℝ)^d)) hK + simpa [K,mul_assoc] using hh +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/BlockEventLower.lean b/lean/OAI/Analysis/FreeEntropy/BlockEventLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e9ebfef4be9c2104d53de192eeeb93a0960fc6a --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/BlockEventLower.lean @@ -0,0 +1,112 @@ +import OAI.Analysis.FreeEntropy.MatrixHeatLaw + +namespace OAI + +universe u1 u2 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Set +open scoped ENNReal +namespace FiniteEntropySeparation +variable {p d : ℕ} + theorem normalLaw_rotated_mask_markov {s r : ℝ} (hs : 0 h (Or.inl hh)) + have hb : ‖coordinateMask (blockMask f) (rotateCoordinates U g)‖ h (Or.inr hh)) + apply hg + apply blockEvent_add_mem (A := 2*Real.sqrt ((p:ℝ)*d)) (B := 2*Real.sqrt (v*p*d)) _ a g ha hn.le f hf U _ hb.le + · have hh : Real.sqrt ((p:ℝ)*d)≤Real.sqrt (v*p*d) := Real.sqrt_le_sqrt (by nlinarith) + linarith + · linarith + have hEc : (normalLaw (t/d)) Eᶜ≤ENNReal.ofReal (1/2:ℝ) := by + apply (measure_mono hsub).trans ((measure_union_le _ _).trans _) + calc + _ ≤ ENNReal.ofReal (3/8:ℝ)+ENNReal.ofReal (1/8:ℝ) := add_le_add hN hB + _ = _ := by rw [← ENNReal.ofReal_add (by norm_num : (0:ℝ)≤3/8) (by norm_num : (0:ℝ)≤1/8)]; congr 1; norm_num + have hm : MeasurableSet E := (blockEvent_isClosed hd _ _).measurableSet.preimage (by fun_prop : Measurable (fun g : MatrixCoordinates (p+1) d => a+g)) + have hh := measure_add_measure_compl hm (μ := normalLaw (t/d)) + rw [measure_univ] at hh + have hle : (1:ℝ≥0∞)≤(normalLaw (t/d)) E+ENNReal.ofReal (1/2:ℝ) := by rw [← hh]; exact add_le_add (le_refl _) hEc + have hfE : (normalLaw (t/d)) E≠⊤ := measure_ne_top _ _ + have htoreal := (ENNReal.toReal_le_toReal (by simp) (by finiteness)).mpr hle + rw [ENNReal.toReal_add hfE (by finiteness)] at htoreal + change ENNReal.ofReal (1/2:ℝ)≤(normalLaw (t/d)) E + apply (ENNReal.ofReal_le_iff_le_toReal hfE).mpr + norm_num only [ENNReal.toReal_one, ENNReal.toReal_ofReal (by norm_num : (0:ℝ)≤1/2)] at htoreal + linarith +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/BlockGaussianQuantitative.lean b/lean/OAI/Analysis/FreeEntropy/BlockGaussianQuantitative.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6c4743af7525422455f03b9c7cad78dc3fb1180 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/BlockGaussianQuantitative.lean @@ -0,0 +1,94 @@ +import OAI.Analysis.FreeEntropy.BlockEnsembleLower + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +open scoped ENNReal +namespace FiniteEntropySeparation +variable {p d : ℕ} + theorem two_pow_le_exp (k : ℕ) : (2:ℝ)^k≤Real.exp k := by + have hh := pow_le_pow_left₀ (by norm_num : (0:ℝ)≤2) (show (2:ℝ)≤Real.exp 1 from by linarith [Real.add_one_le_exp (1:ℝ)]) k + simpa only [← Real.exp_nat_mul,mul_one] using hh + theorem blockEvent_gaussian_four (hd : 64≤d) {v : ℝ} (hv : 0 f' z.1 z.2) (Icc a b ×ˢ K)) + (hd : ∀s∈Icc a b,∀x∈K,HasDerivAt (fun u => f u x) (f' s x) s) : + Integrable (f' t) μ ∧ HasDerivAt (fun u => ∫ x,f u x ∂μ) (∫ x,f' t x ∂μ) t := by + obtain ⟨C,hC⟩ := (isCompact_Icc.prod hK).exists_bound_of_continuousOn hc + apply hasDerivAt_integral_of_dominated_loc_of_deriv_le (s := Icc a b) (bound := fun _ => C) (Icc_mem_nhds ha hb) + · filter_upwards [Icc_mem_nhds ha hb] with s hs + exact (hf s hs).aestronglyMeasurable + · exact integrable_of_compact_ae μ hK hμ (hf t ⟨ha.le,hb.le⟩).aestronglyMeasurable (hf t ⟨ha.le,hb.le⟩).continuousOn + · exact (hf' t ⟨ha.le,hb.le⟩).aestronglyMeasurable + · filter_upwards [hμ] with x hx s hs + exact hC (s,x) ⟨hs,hx⟩ + · exact integrable_const _ + · filter_upwards [hμ] with x hx s hs + exact hd s hs x hx +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/ComplexPolynomialFunctions.lean b/lean/OAI/Analysis/FreeEntropy/ComplexPolynomialFunctions.lean new file mode 100644 index 0000000000000000000000000000000000000000..750c2e155bcc8815a5cac3d5c8388c345802fe4b --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/ComplexPolynomialFunctions.lean @@ -0,0 +1,123 @@ +import OAI.Analysis.FreeEntropy.PolynomialFunctions + +namespace OAI + +universe u1 u2 u3 u4 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] [DecidableEq ι] + def IsComplexPolynomial (f : (ι → ℝ) → ℂ) : Prop := + IsRealPolynomial (fun x => (f x).re) ∧ IsRealPolynomial (fun x => (f x).im) + def complexCoordinateDerivative (f : (ι → ℝ) → ℂ) (i : ι) (x : ι → ℝ) : ℂ := + deriv (fun t => f (Function.update x i t)) (x i) + theorem complex_integral_re {Ω : Type u2} [MeasurableSpace Ω] {μ : Measure Ω} {f : Ω → ℂ} + (hf : Integrable f μ) : (∫ x, f x ∂μ).re = ∫ x, (f x).re ∂μ := (integral_re hf).symm + theorem complex_integral_im {Ω : Type u3} [MeasurableSpace Ω] {μ : Measure Ω} {f : Ω → ℂ} + (hf : Integrable f μ) : (∫ x, f x ∂μ).im = ∫ x, (f x).im ∂μ := (integral_im hf).symm + namespace IsComplexPolynomial + theorem const (z : ℂ) : IsComplexPolynomial (fun _ : ι → ℝ => z) := + ⟨IsRealPolynomial.const _,IsRealPolynomial.const _⟩ + theorem ofReal {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) : + IsComplexPolynomial (fun x => (f x : ℂ)) := by + exact ⟨hf, IsRealPolynomial.const 0⟩ + theorem coord (i : ι) : IsComplexPolynomial (fun x : ι → ℝ => (x i : ℂ)) := ofReal (IsRealPolynomial.coord i) + theorem add {f g : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (hg : IsComplexPolynomial g) : + IsComplexPolynomial (fun x => f x+g x) := ⟨hf.1.add hg.1,hf.2.add hg.2⟩ + theorem sub {f g : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (hg : IsComplexPolynomial g) : + IsComplexPolynomial (fun x => f x-g x) := ⟨hf.1.sub hg.1,hf.2.sub hg.2⟩ + theorem mul {f g : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (hg : IsComplexPolynomial g) : + IsComplexPolynomial (fun x => f x*g x) := + ⟨(hf.1.mul hg.1).sub (hf.2.mul hg.2),(hf.1.mul hg.2).add (hf.2.mul hg.1)⟩ + theorem const_mul {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (z : ℂ) : + IsComplexPolynomial (fun x => z*f x) := (const z).mul hf + theorem mul_const {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (z : ℂ) : + IsComplexPolynomial (fun x => f x*z) := hf.mul (const z) + theorem finset_sum {κ : Type u4} (s : Finset κ) {f : κ → (ι → ℝ) → ℂ} + (hf : ∀ k ∈ s, IsComplexPolynomial (f k)) : IsComplexPolynomial (fun x => ∑ k ∈ s, f k x) := by + constructor + · simpa using IsRealPolynomial.finset_sum s (fun k hk => (hf k hk).1) + · simpa using IsRealPolynomial.finset_sum s (fun k hk => (hf k hk).2) + theorem continuous {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) : Continuous f := by + have hc := (Complex.continuous_ofReal.comp hf.1.continuous).add ((Complex.continuous_ofReal.comp hf.2.continuous).mul (continuous_const (y := Complex.I))) + convert hc using 1 + funext x + exact (Complex.re_add_im (f x)).symm + theorem integrable {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) : Integrable f (productGaussian ι) := by + have hi := hf.1.integrable.ofReal.add (hf.2.integrable.ofReal.mul_const Complex.I) + convert hi using 1 ; try rfl + funext x + exact (Complex.re_add_im (f x)).symm + theorem normSq {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) : + IsRealPolynomial (fun x => Complex.normSq (f x)) := by + simpa only [Complex.normSq_apply, pow_two] using (hf.1.pow 2).add (hf.2.pow 2) + theorem norm_sq {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) : + IsRealPolynomial (fun x => ‖f x‖^2) := by simpa only [Complex.sq_norm] using hf.normSq + theorem hasCoordinateDeriv {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (i : ι) (x : ι → ℝ) : + HasDerivAt (fun t => f (Function.update x i t)) + ((coordinateDerivative (fun y => (f y).re) i x : ℂ) + + (coordinateDerivative (fun y => (f y).im) i x : ℂ)*Complex.I) (x i) := by + have hd := (hf.1.hasDerivAt i x).ofReal_comp.add ((hf.2.hasDerivAt i x).ofReal_comp.mul_const Complex.I) + convert hd using 1 ; try rfl + funext t + exact (Complex.re_add_im (f (Function.update x i t))).symm + theorem coordinateDerivative_eq {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (i : ι) (x : ι → ℝ) : + complexCoordinateDerivative f i x = + (coordinateDerivative (fun y => (f y).re) i x : ℂ) + + (coordinateDerivative (fun y => (f y).im) i x : ℂ)*Complex.I := + (hf.hasCoordinateDeriv i x).deriv + theorem derivative {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (i : ι) : + IsComplexPolynomial (complexCoordinateDerivative f i) := by + have he : complexCoordinateDerivative f i = fun x => + (coordinateDerivative (fun y => (f y).re) i x : ℂ) + + (coordinateDerivative (fun y => (f y).im) i x : ℂ)*Complex.I := by + funext x; exact hf.coordinateDerivative_eq i x + rw [he] + exact (ofReal (hf.1.derivative i)).add ((ofReal (hf.2.derivative i)).mul_const Complex.I) + theorem hasDerivAt {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (i : ι) (x : ι → ℝ) : + HasDerivAt (fun t => f (Function.update x i t)) (complexCoordinateDerivative f i x) (x i) := by + rw [hf.coordinateDerivative_eq] + exact hf.hasCoordinateDeriv i x + theorem stein {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (i : ι) : + (∫ x, (x i : ℂ)*f x ∂productGaussian ι) = ∫ x, complexCoordinateDerivative f i x ∂productGaussian ι := by + have hi := ((coord i).mul hf).integrable + have hd := (hf.derivative i).integrable + apply Complex.ext + · rw [complex_integral_re hi, complex_integral_re hd] + simpa only [Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, + hf.coordinateDerivative_eq, Complex.add_re, Complex.mul_re, Complex.I_re, Complex.I_im, mul_zero, zero_add, add_zero] using hf.1.stein i + · rw [complex_integral_im hi, complex_integral_im hd] + simpa only [Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, zero_mul, add_zero, + hf.coordinateDerivative_eq, Complex.add_im, Complex.I_re, Complex.I_im, mul_one, mul_zero, zero_add] using hf.2.stein i + theorem poincare {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) : + (∫ x, ‖f x-∫ y, f y ∂productGaussian ι‖^2 ∂productGaussian ι) ≤ + ∑ i, ∫ x, ‖complexCoordinateDerivative f i x‖^2 ∂productGaussian ι := by + have hi := hf.integrable + have hnorm (z : ℂ) : ‖z‖^2 = z.re^2+z.im^2 := by rw [Complex.sq_norm]; simp only [Complex.normSq_apply,pow_two] + have hr := ((hf.1.sub (IsRealPolynomial.const (∫ y, (f y).re ∂productGaussian ι))).pow 2).integrable + have hm := ((hf.2.sub (IsRealPolynomial.const (∫ y, (f y).im ∂productGaussian ι))).pow 2).integrable + have he : (∫ x, ‖f x-∫ y, f y ∂productGaussian ι‖^2 ∂productGaussian ι) = + (∫ x, ((f x).re-∫ y, (f y).re ∂productGaussian ι)^2 ∂productGaussian ι) + + ∫ x, ((f x).im-∫ y, (f y).im ∂productGaussian ι)^2 ∂productGaussian ι := by + simp only [hnorm, Complex.sub_re, Complex.sub_im, complex_integral_re hi, complex_integral_im hi] + exact integral_add hr hm + rw [he] + calc + _ ≤ (∑ i, ∫ x, (coordinateDerivative (fun y => (f y).re) i x)^2 ∂productGaussian ι) + + ∑ i, ∫ x, (coordinateDerivative (fun y => (f y).im) i x)^2 ∂productGaussian ι := + add_le_add hf.1.poincare hf.2.poincare + _ = _ := by + rw [← sum_add_distrib] + apply sum_congr rfl + intro i hi + rw [← integral_add ((hf.1.derivative i).pow 2).integrable ((hf.2.derivative i).pow 2).integrable] + apply integral_congr_ae + filter_upwards [] with x + simp [hnorm, hf.coordinateDerivative_eq] + end IsComplexPolynomial +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/CoordinateIBP.lean b/lean/OAI/Analysis/FreeEntropy/CoordinateIBP.lean new file mode 100644 index 0000000000000000000000000000000000000000..5077b2f5590a0ad90d9d45f3e0f6fd5a537599df --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/CoordinateIBP.lean @@ -0,0 +1,27 @@ +import OAI.Analysis.FreeEntropy.GaussianEntropyIntegrability + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] [DecidableEq ι] + theorem integral_coordinate_ibp (i : ι) (f f' g g' : EuclideanSpace ℝ ι → ℝ) + (hf : ∀x r,HasDerivAt (fun t : ℝ => f (x+t • EuclideanSpace.single i 1)) (f' (x+r • EuclideanSpace.single i 1)) r) + (hg : ∀x r,HasDerivAt (fun t : ℝ => g (x+t • EuclideanSpace.single i 1)) (g' (x+r • EuclideanSpace.single i 1)) r) + (hfg' : Integrable (fun x => f x*g' x)) (hf'g : Integrable (fun x => f' x*g x)) + (hfg : Integrable (fun x => f x*g x)) : + (∫x,f x*g' x) = -(∫x,f' x*g x) := by + apply integral_bilinear_hasLineDerivAt_right_eq_neg_left_of_integrable + (B := ContinuousLinearMap.mul ℝ ℝ) hf'g hfg' hfg + · intro x hx + simpa only [HasLineDerivAt,zero_smul,add_zero] using hf x 0 + · intro x hx + simpa only [HasLineDerivAt,zero_smul,add_zero] using hg x 0 +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/CoordinateMask.lean b/lean/OAI/Analysis/FreeEntropy/CoordinateMask.lean new file mode 100644 index 0000000000000000000000000000000000000000..79b48d48264f42f876caca33bf851aa3c422e46e --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/CoordinateMask.lean @@ -0,0 +1,48 @@ +import OAI.Analysis.FreeEntropy.GaussianBlockTail + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] [DecidableEq ι] + def coordinateMask (m : Finset ι) (x : EuclideanSpace ℝ ι) : EuclideanSpace ℝ ι := + WithLp.toLp 2 (fun i => if i∈m then x i else 0) + theorem coordinateMask_sq (m : Finset ι) (x : EuclideanSpace ℝ ι) : + ‖coordinateMask m x‖^2=∑i∈m,x i^2 := by + classical + simp [coordinateMask,EuclideanSpace.norm_sq_eq,Real.norm_eq_abs,sq_abs] + theorem coordinateMask_norm_le (m : Finset ι) (x : EuclideanSpace ℝ ι) : + ‖coordinateMask m x‖≤‖x‖ := by + apply (sq_le_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [coordinateMask_sq,EuclideanSpace.norm_sq_eq] + simp only [Real.norm_eq_abs,sq_abs] + exact sum_le_sum_of_subset_of_nonneg (subset_univ m) (fun i _ _ => sq_nonneg _) + def coordinateMaskLinear (m : Finset ι) : EuclideanSpace ℝ ι →ₗ[ℝ] EuclideanSpace ℝ ι where + toFun := coordinateMask m + map_add' x y := by ext i; simp only [coordinateMask,PiLp.toLp_apply,PiLp.add_apply]; split_ifs <;> simp + map_smul' r x := by ext i; simp only [coordinateMask,PiLp.toLp_apply,PiLp.smul_apply,smul_eq_mul,RingHom.id_apply]; split_ifs <;> simp + theorem coordinateMask_continuous (m : Finset ι) : Continuous (coordinateMask m) := + (coordinateMaskLinear m).continuous_of_finiteDimensional + theorem coordinateMask_norm_sub (m : Finset ι) (x y : EuclideanSpace ℝ ι) : + |‖coordinateMask m x‖-‖coordinateMask m y‖|≤‖x-y‖ := by + calc + _ ≤ ‖coordinateMask m x-coordinateMask m y‖ := abs_norm_sub_norm_le _ _ + _ = ‖coordinateMask m (x-y)‖ := by exact congrArg norm (map_sub (coordinateMaskLinear m) x y).symm + _ ≤ _ := coordinateMask_norm_le _ _ + theorem normalLaw_coordinateMask_tail (m : Finset ι) {s r : ℝ} (hs : 0 (hwB N).trans (by norm_num)) m + simpa [r] using hh + let t := (8*B)⁻¹ + have ht : 0 < t := by dsimp [t]; positivity + have htB : (2*t)*B = 1/4 := by dsimp [t]; field_simp ; ring + have hneg : (-boolean M) [] = 0 := by simp + have hnegW (N : ℕ) : seriesWeight (-boolean M) (2*t) N ≤ 1/3 := by + have hh := weight_le_geom hneg hB.le (by positivity : 0 ≤ 2*t) + (by rw [htB]; norm_num) (fun m _ => by simpa using hBn m) N + norm_num [htB] at hh ⊢ + exact hh + have hJ (N : ℕ) : seriesWeight (moments (-boolean M)-unit) t N ≤ 1/3 := + moments_tail_weight hneg ht.le (by norm_num) (by norm_num) hnegW N + have hR (N : ℕ) : seriesWeight (cumulants M) t N ≤ 1 := by + have hh := inverse_tail_weight (moments_nil (-boolean M)) ht.le + (by norm_num : (0:ℝ) ≤ 1/3) (by norm_num : (1:ℝ)/3 < 1) N (hJ N) + change seriesWeight (cumulants M) t N ≤ _ at hh + norm_num at hh + exact hh.trans (by norm_num) + have hh := degreeNorm_le_of_weight ht hR n + norm_num [t, B, ← mul_assoc] at hh + exact hh + +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/CumulantResidual.lean b/lean/OAI/Analysis/FreeEntropy/CumulantResidual.lean new file mode 100644 index 0000000000000000000000000000000000000000..66a5a95ef1c0bda686fc4e9ddea51dbbc7319638 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/CumulantResidual.lean @@ -0,0 +1,101 @@ +import OAI.Analysis.FreeEntropy.WickSeries + +namespace OAI + +noncomputable section +open scoped ComplexConjugate +namespace FiniteEntropySeparation +open Finset FreeSeries +namespace FreeSeries +variable {α : Type} [DecidableEq α] +def reverseEquiv : List α ≃ List α where + toFun := List.reverse + invFun := List.reverse + left_inv := List.reverse_reverse + right_inv := List.reverse_reverse + +def residual (R : Series α) (v : α → ℝ) (i : α) : Series α := + FreeSeries.deriv i R - (v i : ℂ) • letter i + theorem residual_heat (R : Series α) (v : α → ℝ) (u : ℝ) (i : α) : + residual (R + (u : ℂ) • quadratic) (fun i => v i + u) i = residual R v i := by + funext w + simp only [residual, Pi.sub_apply, FreeSeries.deriv_apply, Pi.add_apply, Pi.smul_apply, + smul_eq_mul, Complex.ofReal_add] + have hq := congrFun (deriv_quadratic (α := α) i) w + change quadratic (i::w) = letter i w at hq + rw [hq] + ring + theorem cumulant_residual_identity (M : Series α) (hM : M [] = 1) (v : α → ℝ) (i : α) : + conv M (subst M (residual (cumulants M) v i)) = + FreeSeries.deriv i M - (v i : ℂ) • conv M (subst M (letter i)) := by + rw [residual, subst_sub, subst_smul, conv_sub_right, conv_smul_right] + congr 1 + have he := congrArg (FreeSeries.deriv i) (cumulants_equation hM) + have he' : FreeSeries.deriv i M = FreeSeries.deriv i (subst M (cumulants M)) := by + funext w + simpa only [FreeSeries.deriv_apply, Pi.add_apply, unit_cons, zero_add] using congrFun he w + rw [he', deriv_subst] +end FreeSeries + +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + theorem series_reverseDerivative_hasSum {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (f : Series (Fin n)) (w : List (Fin n)) : + HasSum (fun js => f js.reverse * reverseDerivativeMoment τ X js w) + (conv (wordMoment τ X) (subst (wordMoment τ X) f) w) := by + let F : List (Fin n) → ℂ := fun js => f js * + conv (wordMoment τ X) (subst (wordMoment τ X) (monomial js)) w + have hs : HasSum (F ∘ (reverseEquiv (α := Fin n))) + (conv (wordMoment τ X) (subst (wordMoment τ X) f) w) := + (reverseEquiv (α := Fin n)).hasSum_iff.mpr (conv_subst_hasSum (wordMoment τ X) f w) + apply hs.congr_fun + intro js + change f js.reverse * reverseDerivativeMoment τ X js w = + f js.reverse * conv (wordMoment τ X) + (subst (wordMoment τ X) (monomial js.reverse)) w + rw [reverseDerivativeMoment_monomial] + theorem inner_selfAdjoint_word {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (hX : ∀ i, IsSelfAdjoint (X i)) (i : Fin n) (w : List (Fin n)) : + inner ℂ (X i τ.vacuum) (wordEval X w τ.vacuum) = wordMoment τ X (i::w) := by + rw [← ContinuousLinearMap.adjoint_inner_right, ← ContinuousLinearMap.star_eq_adjoint, + (hX i).star_eq] + rfl + theorem cumulant_residual_hasSum {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (hX : ∀ i, IsSelfAdjoint (X i)) + (v : Fin n → ℝ) (i : Fin n) (w : List (Fin n)) : + HasSum (fun js => residual (cumulants (wordMoment τ X)) v i js.reverse * + reverseDerivativeMoment τ X js w) + (inner ℂ (X i τ.vacuum) (wordEval X w τ.vacuum) - + (v i : ℂ) * derivativeMoment τ X i w) := by + have hs := series_reverseDerivative_hasSum τ X (residual (cumulants (wordMoment τ X)) v i) w + rw [cumulant_residual_identity _ (by simp), Pi.sub_apply, Pi.smul_apply, + smul_eq_mul, FreeSeries.deriv_apply, ← derivativeMoment_series, ← inner_selfAdjoint_word τ X hX] at hs + exact hs + +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] +variable {n : ℕ} + + theorem heat_cumulant_residual_hasSum (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) (hX : ∀ i, X i ∈ backgroundAlgebra J) + (hsa : ∀ i, IsSelfAdjoint (X i)) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) + (u : ℝ) (hu : 0 ≤ u) (v : Fin n → ℝ) (i : Fin n) (w : List (Fin n)) : + HasSum (fun js => residual (cumulants (wordMoment (tracialVector B N G) X)) v i js.reverse * + reverseDerivativeMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u) js w) + (inner ℂ (heatTuple X (fun i => semicircularN (σ i)) u i (tracialVector B N G).vacuum) + (wordEval (heatTuple X (fun i => semicircularN (σ i)) u) w (tracialVector B N G).vacuum) - + ((v i + u : ℝ) : ℂ) * derivativeMoment (tracialVector B N G) + (heatTuple X (fun i => semicircularN (σ i)) u) i w) := by + have he := cumulant_residual_hasSum (tracialVector B N G) + (heatTuple X (fun i => semicircularN (σ i)) u) + (heatTuple_selfAdjoint X _ hsa (fun i => semicircularN_selfAdjoint _) u) + (fun i => v i + u) i w + rw [heat_cumulants J X hX σ hσ hs u hu] at he + simp only [residual_heat] at he + exact he +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/CumulantSeries.lean b/lean/OAI/Analysis/FreeEntropy/CumulantSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..353d29f252daf507a56e1a964f34b54042af374a --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/CumulantSeries.lean @@ -0,0 +1,194 @@ +import OAI.Analysis.FreeEntropy.WordSeries + +namespace OAI + +universe u1 + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α : Type u1} + + theorem Agree.mono {n m : ℕ} {f g : Series α} (h : Agree n f g) (hmn : m ≤ n) : + Agree m f g := fun w hw => h w (hw.trans hmn) + theorem Agree.refl (n : ℕ) (f : Series α) : Agree n f f := fun _ _ => rfl + theorem Agree.symm {n : ℕ} {f g : Series α} (h : Agree n f g) : Agree n g f := + fun w hw => (h w hw).symm + theorem Agree.trans {n : ℕ} {f g h : Series α} (hfg : Agree n f g) (hgh : Agree n g h) : + Agree n f h := fun w hw => (hfg w hw).trans (hgh w hw) + theorem agree_add {n : ℕ} {f f' g g' : Series α} (hf : Agree n f f') (hg : Agree n g g') : + Agree n (f+g) (f'+g') := fun w hw => by simp only [Pi.add_apply, hf w hw, hg w hw] + theorem agree_deriv {n : ℕ} {f g : Series α} (h : Agree (n+1) f g) (a : α) : + Agree n (deriv a f) (deriv a g) := fun w hw => h (a::w) (by simp; omega) + + theorem subst_agree {n : ℕ} {M M' f g : Series α} (hM : Agree n M M') (hf : Agree n f g) : + Agree n (subst M f) (subst M' g) := by + induction n generalizing M M' f g with + | zero => + intro w hw + have : w = [] := List.length_eq_zero_iff.mp (Nat.eq_zero_of_le_zero hw) + subst w + simpa using hf [] (by simp) + | succ n ih => + intro w hw + cases w with + | nil => simpa using hf [] (by simp) + | cons a w => + simp only [subst_cons] + exact conv_agree (hM.mono (by omega)) + (ih (hM.mono (by omega)) (agree_deriv hf a)) w (by simp at hw; omega) + + theorem subst_agree_left_step {n : ℕ} {M M' : Series α} (hM : Agree n M M') (f : Series α) : + Agree (n+1) (subst M f) (subst M' f) := by + intro w hw + cases w with + | nil => simp + | cons a w => + simp only [subst_cons] + exact conv_agree hM (subst_agree hM (Agree.refl _ _)) w (by simp at hw; omega) + + theorem conv_left_cancel {M f g : Series α} (hM : M [] = 1) + (h : conv M f = conv M g) : f = g := by + funext w + induction w using length_induction with + | h w ih => + cases w with + | nil => simpa [hM] using congrFun h [] + | cons a w => + have ht := congrFun h (a::w) + simp only [conv_cons, hM, one_mul] at ht + have hsmall : conv (deriv a M) f w = conv (deriv a M) g w := by + apply conv_agree (Agree.refl w.length _) (fun v hv => ih v (by simp; omega)) w le_rfl + rw [hsmall] at ht + exact add_right_cancel ht + + theorem subst_injective {M : Series α} (hM : M [] = 1) : Function.Injective (subst M) := by + intro f g h + funext w + induction w generalizing f g with + | nil => simpa using congrFun h [] + | cons a w ih => + apply ih + apply conv_left_cancel hM + change conv M (subst M (deriv a f)) = conv M (subst M (deriv a g)) + rw [← deriv_subst, ← deriv_subst, h] + +def inverse (f : Series α) : Series α + | [] => 1 + | a::w => - ∑ k ∈ range (w.length+1), f (a::w.take k) * inverse f (w.drop k) +termination_by w => w.length + +@[simp] theorem inverse_nil (f : Series α) : inverse f [] = 1 := by rw [inverse] + theorem inverse_cons (f : Series α) (a : α) (w : List α) : + inverse f (a::w) = -conv (deriv a f) (inverse f) w := by + rw [inverse, conv_sum_splits] + rfl + theorem conv_inverse {f : Series α} (hf : f [] = 1) : conv f (inverse f) = unit := by + funext w + cases w with + | nil => simp [hf] + | cons a w => simp [inverse_cons, hf] + theorem inverse_conv {f : Series α} (hf : f [] = 1) : conv (inverse f) f = unit := by + apply conv_left_cancel hf + rw [← conv_assoc, conv_inverse hf, conv_unit_left, conv_unit_right] + theorem inverse_unique {f g : Series α} (hf : f [] = 1) (hg : conv f g = unit) : + g = inverse f := conv_left_cancel hf (hg.trans (conv_inverse hf).symm) + theorem inverse_inverse {f : Series α} (hf : f [] = 1) : inverse (inverse f) = f := + (inverse_unique (inverse_nil f) (inverse_conv hf)).symm + theorem subst_inverse (M : Series α) {f : Series α} (hf : f [] = 1) : + subst M (inverse f) = inverse (subst M f) := by + apply inverse_unique (by simpa using hf) + rw [← subst_mul, conv_inverse hf, subst_unit] + +def momentIter (R : Series α) : ℕ → Series α + | 0 => unit + | n+1 => unit + subst (momentIter R n) R + +@[simp] theorem momentIter_nil {R : Series α} (hR : R [] = 0) (n : ℕ) : + momentIter R n [] = 1 := by + cases n <;> simp [momentIter, hR] + theorem momentIter_step {R : Series α} (hR : R [] = 0) (n : ℕ) : + Agree n (momentIter R (n+1)) (momentIter R n) := by + induction n with + | zero => + intro w hw + have : w = [] := List.length_eq_zero_iff.mp (Nat.eq_zero_of_le_zero hw) + subst w + simp [momentIter, hR] + | succ n ih => + exact agree_add (Agree.refl _ _) (subst_agree_left_step ih R) + theorem momentIter_stable {R : Series α} (hR : R [] = 0) {n m : ℕ} (hnm : n ≤ m) : + Agree n (momentIter R m) (momentIter R n) := by + induction m, hnm using Nat.le_induction with + | base => exact Agree.refl _ _ + | succ m hnm ih => exact ((momentIter_step hR m).mono hnm).trans ih + + def moments (R : Series α) : Series α := fun w => momentIter R w.length w + theorem moments_agree {R : Series α} (hR : R [] = 0) (n : ℕ) : + Agree n (moments R) (momentIter R n) := by + intro w hw + exact ((momentIter_stable hR hw) w le_rfl).symm +@[simp] theorem moments_nil (R : Series α) : moments R [] = 1 := rfl + theorem moments_eq {R : Series α} (hR : R [] = 0) : moments R = unit + subst (moments R) R := by + funext w + have h := (moments_agree hR (w.length+1)) w (by omega) + rw [h, momentIter] + apply congrArg (fun z : ℂ => unit w + z) + exact ((subst_agree_left_step (moments_agree hR w.length) R) w (by omega)).symm + theorem moments_unique {R M : Series α} (hR : R [] = 0) + (hM : M = unit + subst M R) : M = moments R := by + have hn (n : ℕ) : Agree n M (momentIter R n) := by + induction n with + | zero => + intro w hw + have : w = [] := List.length_eq_zero_iff.mp (Nat.eq_zero_of_le_zero hw) + subst w + have h := congrFun hM [] + simpa [momentIter, hR] using h + | succ n ih => + rw [hM] + exact agree_add (Agree.refl _ _) (subst_agree_left_step ih R) + funext w + exact hn w.length w le_rfl + +def boolean (M : Series α) : Series α := unit - inverse M + def cumulants (M : Series α) : Series α := inverse (moments (-boolean M)) - unit + +@[simp] theorem boolean_nil (M : Series α) : boolean M [] = 0 := by simp [boolean] +@[simp] theorem cumulants_nil (M : Series α) : cumulants M [] = 0 := by simp [cumulants] + + theorem cumulants_equation {M : Series α} (hM : M [] = 1) : + M = unit + subst M (cumulants M) := by + let J := moments (-boolean M) + have hB : (-boolean M) [] = 0 := by simp + have hJ : J = unit - subst J (boolean M) := by + simpa only [subst_neg, sub_eq_add_neg] using moments_eq hB + have hJM : conv J (subst J M) = unit := by + have hJI : J = subst J (inverse M) := by + calc + J = unit - subst J (boolean M) := hJ + _ = subst J (inverse M) := by rw [boolean, subst_sub, subst_unit]; abel + calc + conv J (subst J M) = conv (subst J (inverse M)) (subst J M) := + congrArg (fun A => conv A (subst J M)) hJI + _ = unit := by rw [← subst_mul, inverse_conv hM, subst_unit] + have hsubst : subst J (subst M (cumulants M)) = inverse J - unit := by + rw [subst_comp, hJM, subst_unit_left] + rfl + apply subst_injective (moments_nil _) + rw [subst_add, subst_unit, hsubst] + have hMI : subst J M = inverse J := inverse_unique (moments_nil _) hJM + rw [hMI] + abel + + theorem cumulants_unique {M R : Series α} (hM : M [] = 1) + (h : M = unit + subst M R) : R = cumulants M := by + apply subst_injective hM + have he := cumulants_equation hM + exact add_left_cancel (h.symm.trans he) + +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/CutoffSeparation.lean b/lean/OAI/Analysis/FreeEntropy/CutoffSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d24a27530256200904eefd31ef12448b2a065d6 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/CutoffSeparation.lean @@ -0,0 +1,69 @@ +import OAI.Analysis.FreeEntropy.MicrostatesLower + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology ENNReal +namespace FiniteEntropySeparation + theorem chosen_cutoff_real_bound {h R δ Δ β : ℝ} (hh0 : 0 diagonalMicrostates (Model.τ chosenP) (Model.X chosenP h) R k (D k) + have hs k : MeasurableSet (S k) := diagonalMicrostates_measurable _ _ _ _ _ + have hv0 k : volume (S k)≠0 := matrixVolumeEntropy_ne_bot_volume (hD0 k) _ + (ne_bot_of_gt ((EReal.bot_lt_coe β).trans (hvol k))) + have hvt k : volume (S k)≠⊤ := ne_of_lt (microstates_volume_lt_top (Model.τ chosenP) (Model.X chosenP h) R hR k (D k) _) + let μ := fun k => cond volume (S k) + have hprob : ∀k,IsProbabilityMeasure (μ k) := fun k => cond_isProbabilityMeasure_of_finite (hv0 k) (hvt k) + let : ∀k,IsProbabilityMeasure (μ k) := hprob + have hμ k : ∀ᵐa ∂μ k,a∈S k := ae_cond_mem (hs k) + have hn k : (S k).Nonempty := by + apply Set.nonempty_iff_ne_empty.mpr + intro he + apply hv0 k + rw [he,measure_empty] + have hinit (k : ℕ) : β≤normalizedMatrixEntropy (μ k) (chosenStart h) := by + have hnorm : ∀ᵐa ∂μ k,‖a‖≤Real.sqrt (((chosenP+1:ℕ):ℝ)*D k)*R := + FreeTensor.diagonalMicrostates_norm_ae (Model.X chosenP h) hR μ hμ k + have hb := normalizedMatrixEntropy_cond_lower (hD0 k) (S k) (hv0 k) (hvt k) + (show 0≤Real.sqrt (((chosenP+1:ℕ):ℝ)*D k)*R by positivity) hnorm (chosenStart_pos hh0) + have he : β<((D k:ℝ)^2)⁻¹*Real.log (volume (S k)).toReal+((chosenP+1:ℕ):ℝ)/2*Real.log (D k) := by + apply EReal.coe_lt_coe_iff.mp + have hbvol : (β:EReal)< matrixVolumeEntropy (S k) := hvol k + rwa [matrixVolumeEntropy_coe (S k) (hv0 k) (hvt k)] at hbvol + exact he.le.trans (by simpa only [zpow_neg,zpow_ofNat] using hb) + have hterm := chosen_terminal_gaussian hD0 hDm.tendsto_atTop hh0 hh1 hR hδ hΔ hδΔ hsep hq hh hn μ hμ + have hflow := Model.matrixFlow_limit chosenP chosenP_ge_two hD0 hDm.tendsto_atTop hh0 hR hn μ hμ + (chosenStart_pos hh0) (chosenStart_le_time hh1) hinit hterm + exact flow_to_chiStar_gap hh0 hh1 hflow + theorem chosen_cutoff_bound {h R δ Δ : ℝ} (hh0 : 0 f (w ++ [i]) +def Cyclic (f : Series α) : Prop := ∀ i, deriv i f = rightDeriv i f +@[simp] theorem rightDeriv_apply {α : Type} [DecidableEq α] [Fintype α] (i : α) (f : Series α) (w : List α) : + rightDeriv i f w = f (w ++ [i]) := rfl + theorem rightDeriv_conv {α : Type} [DecidableEq α] [Fintype α] (i : α) (f g : Series α) : + rightDeriv i (conv f g) = conv f (rightDeriv i g) + g [] • rightDeriv i f := by + funext w + induction w generalizing f with + | nil => simp [rightDeriv, deriv, conv]; ring + | cons a w ih => + change f [] * g ((a::w)++[i]) + conv (deriv a f) g (w++[i]) = + (f [] * g ((a::w)++[i]) + conv (deriv a f) (rightDeriv i g) w) + + g [] * f ((a::w)++[i]) + have h := ih (deriv a f) + change conv (deriv a f) g (w++[i]) = _ at h + rw [h] + simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, rightDeriv_apply, deriv_apply, List.cons_append] + ring + theorem rightDeriv_conv' (i : α) (f g : Series α) : + rightDeriv i (conv f g) = conv f (rightDeriv i g) + g [] • rightDeriv i f := + rightDeriv_conv i f g +@[simp] theorem rightDeriv_unit {α : Type} [DecidableEq α] [Fintype α] (i : α) : rightDeriv i (unit : Series α) = 0 := by + funext w + cases w <;> rfl +@[simp] theorem rightDeriv_zero {α : Type} [DecidableEq α] [Fintype α] (i : α) : rightDeriv i (0 : Series α) = 0 := rfl + theorem rightDeriv_add {α : Type} [DecidableEq α] [Fintype α] (i : α) (f g : Series α) : + rightDeriv i (f+g) = rightDeriv i f + rightDeriv i g := rfl + theorem rightDeriv_sub {α : Type} [DecidableEq α] [Fintype α] (i : α) (f g : Series α) : + rightDeriv i (f-g) = rightDeriv i f - rightDeriv i g := rfl + theorem rightDeriv_smul {α : Type} [DecidableEq α] [Fintype α] (i : α) (c : ℂ) (f : Series α) : + rightDeriv i (c • f) = c • rightDeriv i f := rfl + theorem rightDeriv_sum {α : Type} [DecidableEq α] [Fintype α] {β : Type u1} (s : Finset β) (f : β → Series α) (i : α) : + rightDeriv i (∑ b ∈ s, f b) = ∑ b ∈ s, rightDeriv i (f b) := by + funext w + simp [rightDeriv] + theorem rightDeriv_letter {α : Type} [DecidableEq α] [Fintype α] (i j : α) : rightDeriv i (letter j) = if i=j then unit else 0 := by + funext w + cases w with + | nil => by_cases h : i=j <;> simp [rightDeriv, letter, unit, h] + | cons a w => cases w <;> by_cases h : i=j <;> simp [rightDeriv, letter, unit, h] + theorem series_ext_right {α : Type} [DecidableEq α] [Fintype α] {f g : Series α} (hn : f [] = g []) + (h : ∀ i, rightDeriv i f = rightDeriv i g) : f = g := by + funext w + induction w using List.reverseRecOn with + | nil => exact hn + | append_singleton w i _ => exact congrFun (h i) w + +def rightAssemble (f : α → Series α) : Series α := ∑ i, conv (f i) (letter i) +@[simp] theorem rightAssemble_nil (f : α → Series α) : rightAssemble f [] = 0 := by + simp [rightAssemble] + theorem rightDeriv_assemble (f : α → Series α) (j : α) : + rightDeriv j (rightAssemble f) = f j := by + rw [rightAssemble, rightDeriv_sum] + simp only [rightDeriv_conv, rightDeriv_letter, letter_nil, zero_smul, add_zero] + have hh (i : α) : conv (f i) (if j=i then unit else 0) = if j=i then f i else 0 := by + split_ifs <;> simp + simp_rw [hh] + simp + theorem assemble_rightDeriv (f : Series α) : + rightAssemble (fun i => rightDeriv i f) = f - f [] • unit := by + apply series_ext_right + · simp + · intro i + simp [rightDeriv_assemble, rightDeriv_sub, rightDeriv_smul] + theorem Cyclic.assemble {f : Series α} (hf : Cyclic f) : + rightAssemble (fun i => deriv i f) = f - f [] • unit := by + have hh : (fun i => deriv i f) = (fun i => rightDeriv i f) := funext hf + rw [hh, assemble_rightDeriv] + theorem cyclic_of_assemble {f : Series α} (h : rightAssemble (fun i => deriv i f) = f - f [] • unit) : + Cyclic f := by + intro i + have hh := congrArg (rightDeriv i) h + simpa [rightDeriv_assemble, rightDeriv_sub, rightDeriv_smul] using hh + + theorem conv_sum_left {α : Type} [DecidableEq α] [Fintype α] {β : Type u2} (s : Finset β) (f : β → Series α) (g : Series α) : + conv (∑ b ∈ s, f b) g = ∑ b ∈ s, conv (f b) g := by + classical + induction s using Finset.induction with + | empty => simp + | @insert b s hb ih => simp [sum_insert hb, conv_add_left, ih] + theorem conv_sum_right {α : Type} [DecidableEq α] [Fintype α] {β : Type u3} (s : Finset β) (f : Series α) (g : β → Series α) : + conv f (∑ b ∈ s, g b) = ∑ b ∈ s, conv f (g b) := by + classical + induction s using Finset.induction with + | empty => simp + | @insert b s hb ih => simp [sum_insert hb, conv_add_right, ih] + theorem subst_sum {α : Type} [DecidableEq α] [Fintype α] {β : Type u4} (s : Finset β) (M : Series α) (f : β → Series α) : + subst M (∑ b ∈ s, f b) = ∑ b ∈ s, subst M (f b) := by + classical + induction s using Finset.induction with + | empty => simp + | @insert b s hb ih => simp [sum_insert hb, subst_add, ih] + theorem subst_letter {α : Type} [DecidableEq α] [Fintype α] (M : Series α) (i : α) : subst M (letter i) = conv (letter i) M := by + funext w + cases w with + | nil => simp + | cons j w => simp only [subst_letter_cons, conv_cons, letter_nil, zero_mul, zero_add, + deriv_letter]; split_ifs <;> simp + theorem subst_rightAssemble (M : Series α) (f : α → Series α) : + subst M (rightAssemble f) = conv (rightAssemble (fun i => subst M (f i))) M := by + simp only [rightAssemble, subst_sum, conv_sum_left, subst_mul, subst_letter, conv_assoc] + + theorem cyclic_cumulants {M : Series α} (hM : M [] = 1) (hc : Cyclic M) : + Cyclic (cumulants M) := by + let R := cumulants M + have he : M = unit + subst M R := cumulants_equation hM + have hd (i : α) : deriv i M = conv M (subst M (deriv i R)) := by + funext w + have h := congrFun he (i::w) + simpa [subst_cons] using h + have hi (i : α) : rightDeriv i (inverse M) = -subst M (deriv i R) := by + have hh := congrArg (rightDeriv i) (inverse_conv hM) + rw [rightDeriv_conv, rightDeriv_unit, hM, one_smul, ← hc i, hd i, + ← conv_assoc, inverse_conv hM, conv_unit_left] at hh + exact eq_neg_of_add_eq_zero_right hh + have hinv : rightAssemble (fun i => subst M (deriv i R)) = unit - inverse M := by + apply series_ext_right + · simp + · intro i + simp [rightDeriv_assemble, rightDeriv_sub, hi] + apply cyclic_of_assemble + simp only [cumulants_nil, zero_smul, sub_zero] + apply subst_injective hM + rw [subst_rightAssemble, hinv, conv_sub_left, conv_unit_left, inverse_conv hM] + exact (eq_sub_iff_add_eq.mpr (by simpa [add_comm] using he.symm)).symm + + theorem cyclic_moments {R : Series α} (hR : R [] = 0) (hc : Cyclic R) : + Cyclic (moments R) := by + let M := moments R + have hM : M [] = 1 := moments_nil R + have he : M = unit + subst M R := moments_eq hR + let A := rightAssemble (fun i => subst M (deriv i R)) + have hr : subst M R = conv A M := by + have h := hc.assemble + rw [hR, zero_smul, sub_zero] at h + rw [← h, subst_rightAssemble] + have ha : unit - A = inverse M := by + have hp : conv (unit - A) M = unit := by + rw [conv_sub_left, conv_unit_left] + rw [hr] at he + exact sub_eq_iff_eq_add.mpr he + calc + unit - A = conv (unit - A) (conv M (inverse M)) := by rw [conv_inverse hM, conv_unit_right] + _ = inverse M := by rw [← conv_assoc, hp, conv_unit_left] + intro i + have hi : rightDeriv i (inverse M) = -subst M (deriv i R) := by + rw [← ha, rightDeriv_sub, rightDeriv_unit, sub_eq_add_neg, zero_add] + change -rightDeriv i (rightAssemble _) = _ + rw [rightDeriv_assemble] + have hh := congrArg (rightDeriv i) (conv_inverse hM) + rw [rightDeriv_conv, rightDeriv_unit, inverse_nil, one_smul, hi, conv_neg_right] at hh + have hh' : rightDeriv i M = conv M (subst M (deriv i R)) := by + exact eq_of_sub_eq_zero (by rw [sub_eq_add_neg]; simpa [add_comm] using hh) + rw [hh'] + funext w + have h := congrFun he (i::w) + simpa [subst_cons] using h + +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/EmbeddedSeries.lean b/lean/OAI/Analysis/FreeEntropy/EmbeddedSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..9938da584da99202f89b5b43103c2469177860e2 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/EmbeddedSeries.lean @@ -0,0 +1,127 @@ +import OAI.Analysis.FreeEntropy.LinearSeries + +namespace OAI + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α β γ : Type} [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] + +def liftSeries (e : α → β) : Series α → Series β := reparam (fun a b => if e a=b then 1 else 0) +@[simp] theorem liftSeries_nil {α β : Type} [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] (e : α → β) (f : Series α) : liftSeries e f [] = f [] := rfl + theorem deriv_liftSeries (e : α → β) (f : Series α) (b : β) : + deriv b (liftSeries e f) = ∑ a, (if e a=b then (1:ℂ) else 0) • liftSeries e (deriv a f) := + deriv_reparam _ _ _ + theorem deriv_liftSeries_image (e : α → β) (he : Function.Injective e) (f : Series α) (a : α) : + deriv (e a) (liftSeries e f) = liftSeries e (deriv a f) := by + rw [deriv_liftSeries] + simp only [he.eq_iff, ite_smul, one_smul, zero_smul] + simp + theorem deriv_liftSeries_out (e : α → β) (f : Series α) (b : β) + (hb : ∀ a, e a ≠ b) : deriv b (liftSeries e f) = 0 := by + rw [deriv_liftSeries] + simp [hb] + theorem liftSeries_letter (e : α → β) (a : α) : liftSeries e (letter a) = letter (e a) := by + funext w + cases w with + | nil => rfl + | cons b w => + rw [liftSeries, reparam_cons] + simp only [deriv_letter, apply_ite (reparam _), reparam_unit, reparam_zero] + simp only [ite_apply, Pi.zero_apply, mul_ite, mul_zero] + simp only [sum_ite_eq', mem_univ, ↓reduceIte] + cases w with + | nil => simp [letter, eq_comm] + | cons d w => cases w <;> simp [letter] + theorem restrict_liftSeries (e : α → β) (he : Function.Injective e) (f : Series α) : + restrict e (liftSeries e f) = f := by + funext w + induction w generalizing f with + | nil => rfl + | cons a w ih => + change deriv (e a) (liftSeries e f) (w.map e) = f (a::w) + rw [deriv_liftSeries_image e he] + exact ih (deriv a f) + theorem restrict_liftSeries_disjoint (e : α → β) (d : γ → β) + (hd : ∀ i j, e i ≠ d j) (f : Series α) (hf : f [] = 0) : + (fun w : List γ => liftSeries e f (w.map d)) = 0 := by + funext w + cases w with + | nil => exact hf + | cons a w => + change deriv (d a) (liftSeries e f) (w.map d) = 0 + rw [deriv_liftSeries_out e f (d a) (fun i => hd i a)] + rfl + +variable [DecidableEq γ] [Fintype γ] + theorem reparam_liftSeries (e : α → β) (c : β → γ → ℂ) (f : Series α) : + reparam c (liftSeries e f) = reparam (fun a d => c (e a) d) f := by + funext w + induction w generalizing f with + | nil => rfl + | cons d w ih => + rw [reparam_cons, reparam_cons] + simp only [deriv_liftSeries, reparam_sum, reparam_smul, Finset.sum_apply, + Pi.smul_apply, smul_eq_mul] + simp_rw [mul_sum] + rw [sum_comm] + apply sum_congr rfl + intro a _ + simp only [ite_mul, one_mul, zero_mul, mul_ite, mul_zero] + simp only [sum_ite_eq, mem_univ, ↓reduceIte] + rw [ih] + theorem reparam_identity (f : Series α) : reparam (fun a b : α => if a=b then 1 else 0) f = f := by + funext w + have h := congrFun (restrict_liftSeries (id : α → α) Function.injective_id f) w + change reparam (fun a b : α => if a=b then 1 else 0) f (w.map id) = f w at h + simpa only [List.map_id] using h + theorem reparam_scalar (z : ℂ) (f : Series α) (w : List α) : + reparam (fun a b : α => if a=b then z else 0) f w = z^w.length * f w := by + induction w generalizing f with + | nil => simp + | cons a w ih => + rw [reparam_cons] + simp only [ite_mul, zero_mul, sum_ite_eq', mem_univ, ↓reduceIte] + rw [ih] + simp [deriv_apply, pow_succ, mul_assoc, mul_left_comm] + theorem reparam_scalar_quadratic (z : ℂ) : + reparam (fun a b : α => if a=b then z else 0) quadratic = z^2 • quadratic := by + funext w + rw [reparam_scalar] + cases w with + | nil => simp + | cons a w => + cases w with + | nil => simp [quadratic] + | cons b w => cases w <;> simp [quadratic] + + theorem Cyclic.append {α : Type} [DecidableEq α] [Fintype α] {f : Series α} (hf : Cyclic f) (u v : List α) : + f (u++v) = f (v++u) := by + induction u generalizing v with + | nil => simp + | cons a u ih => + have hh := congrFun (hf a) (u++v) + change f (a::(u++v)) = f ((u++v)++[a]) at hh + simp only [List.cons_append, hh, List.append_assoc] + rw [ih] + simp + theorem cyclic_quadratic {α : Type} [DecidableEq α] [Fintype α] : Cyclic (quadratic : Series α) := by + intro a + funext w + cases w with + | nil => rfl + | cons b w => + cases w with + | nil => simp [deriv, rightDeriv, quadratic, eq_comm] + | cons d w => cases w <;> rfl + theorem deriv_moments {α : Type} [DecidableEq α] [Fintype α] {R : Series α} (hR : R [] = 0) (i : α) : + deriv i (moments R) = conv (moments R) (subst (moments R) (deriv i R)) := by + funext w + have hh := congrFun (moments_eq hR) (i::w) + simpa [subst_cons] using hh + +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/EntropyDeficit.lean b/lean/OAI/Analysis/FreeEntropy/EntropyDeficit.lean new file mode 100644 index 0000000000000000000000000000000000000000..a692015fc374cb91ae98caf2d49341ffecf054e2 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/EntropyDeficit.lean @@ -0,0 +1,51 @@ +import OAI.Analysis.FreeEntropy.RealTail + +namespace OAI + +noncomputable section +open MeasureTheory Set Filter Finset +namespace FiniteEntropySeparation.Model +variable (p : ℕ) [NeZero p] +theorem cumulantConstant_pos : 0 < cumulantConstant p := by + unfold cumulantConstant + exact mul_pos (by norm_num) (Real.sqrt_pos.mpr (Real.sqrt_pos.mpr (Nat.cast_pos.mpr (NeZero.pos p)))) +theorem fisherDeficit_tail_integrable (hp : 2 ≤ p) (a : ℝ) (ha : 0 < a) : + IntegrableOn (fisherDeficit p) (Ioi a) := + (integrableOn_Ioi_translate a).mp (fisherDeficit_shift_integrable p hp a ha) +theorem fisherDeficit_tail_nonneg (a : ℝ) (ha : 0 < a) : + 0 ≤ ∫ u in Ioi a, fisherDeficit p u := by + apply setIntegral_nonneg measurableSet_Ioi + intro u hu + exact fisherDeficit_nonneg p u (lt_trans ha hu) +theorem fisherDeficit_tail_le (hp : 2 ≤ p) (a : ℝ) (ha : 0 < a) + (hKa : 2*(cumulantConstant p)^2 ≤ a) : + (∫ u in Ioi a, fisherDeficit p u) ≤ 2*(cumulantConstant p)^6/(3*a^3) := by + have hi := (inverseFourth_integrable ha).const_mul (2*(cumulantConstant p)^6) + have hle : (∫ u in Ioi a, fisherDeficit p u) ≤ + ∫ u in Ioi a, 2*(cumulantConstant p)^6 * (1/u^4) := by + apply integral_mono_ae (fisherDeficit_tail_integrable p hp a ha) hi + filter_upwards [ae_restrict_mem measurableSet_Ioi] with u hu + simpa only [mul_one_div] using + (fisherDeficit_bounds p hp u (lt_trans ha hu) (hKa.trans hu.le)).2 + rw [integral_const_mul, inverseFourth_integral ha] at hle + simpa only [mul_one_div] using hle +theorem chiStar_tail_formula (hp : 2 ≤ p) (a : ℝ) (ha : 0 < a) : + chiStar (τ p) (X p a) (auxiliaryNoise p) = + ((gaussianEntropy p a - (1/2 : ℝ) * ∫ u in Ioi a, fisherDeficit p u : ℝ) : EReal) := by + rw [chiStar_covariance_formula p hp a ha, integral_Ioi_translate] +theorem entropy_deficit_le (hp : 2 ≤ p) (a : ℝ) (ha : 0 < a) + (hKa : 2*(cumulantConstant p)^2 ≤ a) : + (1/2 : ℝ) * (∫ u in Ioi a, fisherDeficit p u) ≤ 1/24 := by + have hK := cumulantConstant_pos p + have hb := fisherDeficit_tail_le p hp a ha hKa + have hc : (2*(cumulantConstant p)^2)^3 ≤ a^3 := pow_le_pow_left₀ (by positivity) hKa 3 + have hd : 0 < 3*a^3 := by positivity + have he : 2*(cumulantConstant p)^6/(3*a^3) ≤ 1/12 := by + apply (div_le_iff₀ hd).mpr + nlinarith [hc] + linarith +end FiniteEntropySeparation.Model + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/EntropyFiniteness.lean b/lean/OAI/Analysis/FreeEntropy/EntropyFiniteness.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f755635401fd45473044683da2a9546dd948b3f --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/EntropyFiniteness.lean @@ -0,0 +1,88 @@ +import OAI.Analysis.FreeEntropy.EntropyIntegral + +namespace OAI + +universe u1 + +noncomputable section +open scoped ENNReal NNReal Topology +open MeasureTheory Filter Set +namespace FiniteEntropySeparation + + theorem lintegral_ofReal_finite {α : Type u1} [MeasurableSpace α] {μ : Measure α} + {f : α → ℝ} (hf : Integrable f μ) : (∫⁻ x, ENNReal.ofReal (f x) ∂μ) < ∞ := + (lintegral_ofReal_le_lintegral_enorm _).trans_lt hf.hasFiniteIntegral + + theorem reciprocal_posPart_finite {n a : ℝ} (ha : 0 < a) : + (∫⁻ s in Ioi (0 : ℝ), ENNReal.ofReal (n/(1+s)) - ENNReal.ofReal (n/(a+s))) < ∞ := by + have hh := lintegral_ofReal_finite ((reciprocalDifference_integrable ha).const_mul n) + apply lt_of_le_of_lt _ hh + apply setLIntegral_mono' measurableSet_Ioi + intro s hs + have hs : 0 < s := hs + by_cases hn : 0 ≤ n + · rw [← ENNReal.ofReal_sub _ (div_nonneg hn (by linarith : 0 ≤ a+s))] + apply le_of_eq + congr 1 + simp [reciprocalDifference, mul_sub, div_eq_mul_inv] + · have hz : n / (1+s) ≤ 0 := div_nonpos_of_nonpos_of_nonneg (le_of_not_ge hn) (by linarith) + rw [ENNReal.ofReal_of_nonpos hz, zero_tsub] + exact bot_le + + theorem reciprocal_negPart_finite {n a : ℝ} (ha : 0 < a) : + (∫⁻ s in Ioi (0 : ℝ), ENNReal.ofReal (n/(a+s)) - ENNReal.ofReal (n/(1+s))) < ∞ := by + have hh := lintegral_ofReal_finite (((reciprocalDifference_integrable ha).const_mul n).neg) + apply lt_of_le_of_lt _ hh + apply setLIntegral_mono' measurableSet_Ioi + intro s hs + have hs : 0 < s := hs + by_cases hn : 0 ≤ n + · rw [← ENNReal.ofReal_sub _ (div_nonneg hn (by linarith : 0 ≤ 1+s))] + apply le_of_eq + congr 1 + simp [reciprocalDifference, mul_sub, div_eq_mul_inv] + · have hz : n / (a+s) ≤ 0 := div_nonpos_of_nonpos_of_nonneg (le_of_not_ge hn) (by linarith) + rw [ENNReal.ofReal_of_nonpos hz, zero_tsub] + exact bot_le + + theorem entropy_parts_finite {f : ℝ → ℝ≥0∞} {n a b : ℝ} + (ha : 0 < a) (hb : 0 < b) + (hl : ∀ s, 0 < s → ENNReal.ofReal (n/(b+s)) ≤ f s) + (hu : ∀ s, 0 < s → f s ≤ ENNReal.ofReal (n/(a+s))) : + (∫⁻ s in Ioi (0 : ℝ), ENNReal.ofReal (n/(1+s)) - f s) < ∞ ∧ + (∫⁻ s in Ioi (0 : ℝ), f s - ENNReal.ofReal (n/(1+s))) < ∞ := by + constructor + · apply lt_of_le_of_lt _ (reciprocal_posPart_finite (n := n) hb) + exact setLIntegral_mono' measurableSet_Ioi (fun s hs => tsub_le_tsub_left (hl s hs) _) + · apply lt_of_le_of_lt _ (reciprocal_negPart_finite (n := n) ha) + exact setLIntegral_mono' measurableSet_Ioi (fun s hs => tsub_le_tsub_right (hu s hs) _) + + theorem finite_entropy_expression (c : ℝ) {P N : ℝ≥0∞} (hP : P < ∞) (hN : N < ∞) : + ∃ r : ℝ, (c : EReal) + (1/2 : EReal) * P.toEReal - (1/2 : EReal) * N.toEReal = r := by + refine ⟨c + (1/2 : ℝ) * P.toReal - (1/2 : ℝ) * N.toReal, ?_⟩ + rw [← EReal.coe_ennreal_toReal hP.ne, ← EReal.coe_ennreal_toReal hN.ne] + norm_cast + +namespace Model + theorem chiStar_real (p : ℕ) [NeZero p] (hp : 2 ≤ p) (h : ℝ) (hh : 0 < h) : + ∃ r : ℝ, chiStar (τ p) (X p h) (auxiliaryNoise p) = r := by + have hb : 0 < h+4 := by linarith + have hf := entropy_parts_finite (f := fun s => freeFisher (τ p) (doublyNoised p h s)) + (n := (p+1 : ℕ)) hh hb + (fun s hs => by simpa [add_assoc, add_comm, add_left_comm] using + doublyNoised_fisher_lower p hp h s hh.le hs.le (by linarith)) + (fun s hs => doublyNoised_fisher_le p h s hh.le hs.le (by linarith)) + exact finite_entropy_expression _ hf.1 hf.2 + + theorem chiStar_finite (p : ℕ) [NeZero p] (hp : 2 ≤ p) (h : ℝ) (hh : 0 < h) : + (⊥ : EReal) < chiStar (τ p) (X p h) (auxiliaryNoise p) ∧ + chiStar (τ p) (X p h) (auxiliaryNoise p) < ⊤ := by + obtain ⟨r,hr⟩ := chiStar_real p hp h hh + rw [hr] + exact ⟨EReal.bot_lt_coe r, EReal.coe_lt_top r⟩ +end Model +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/EntropyIntegral.lean b/lean/OAI/Analysis/FreeEntropy/EntropyIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb2ad8d3d7d8a62a83c521d2a3f0e2664b076f6b --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/EntropyIntegral.lean @@ -0,0 +1,53 @@ +import OAI.Analysis.FreeEntropy.TerminalGaussian + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal Topology +open MeasureTheory Filter Set +namespace FiniteEntropySeparation + +def reciprocalDifference (a s : ℝ) : ℝ := 1 / (1+s) - 1 / (a+s) +def logarithmicPrimitive (a s : ℝ) : ℝ := Real.log (1+s) - Real.log (a+s) + + theorem logarithmicPrimitive_deriv {a : ℝ} (ha : 0 < a) {s : ℝ} (hs : 0 ≤ s) : + HasDerivAt (logarithmicPrimitive a) (reciprocalDifference a s) s := by + unfold logarithmicPrimitive reciprocalDifference + have h1 : 1+s ≠ 0 := by linarith + have h2 : a+s ≠ 0 := by linarith + convert (((hasDerivAt_id s).const_add 1).log h1).sub (((hasDerivAt_id s).const_add a).log h2) using 1 + all_goals rfl + + theorem logarithmicPrimitive_atTop (a : ℝ) : + Tendsto (logarithmicPrimitive a) atTop (𝓝 0) := by + have h := (Real.tendsto_log_comp_add_sub_log 1).sub (Real.tendsto_log_comp_add_sub_log a) + unfold logarithmicPrimitive + convert h using 1 <;> simp [add_comm, sub_sub_sub_cancel_right] + + theorem reciprocalDifference_integrable {a : ℝ} (ha : 0 < a) : + IntegrableOn (reciprocalDifference a) (Ioi 0) := by + by_cases ha1 : 1 ≤ a + · apply integrableOn_Ioi_deriv_of_nonneg' (fun s hs => logarithmicPrimitive_deriv ha hs) + (fun s hs => ?_) (logarithmicPrimitive_atTop a) + have hs : 0 < s := hs + apply sub_nonneg.mpr + apply one_div_le_one_div_of_le (by linarith : 0 < 1+s) + linarith + · apply integrableOn_Ioi_deriv_of_nonpos' (fun s hs => logarithmicPrimitive_deriv ha hs) + (fun s hs => ?_) (logarithmicPrimitive_atTop a) + have hs : 0 < s := hs + apply sub_nonpos.mpr + apply one_div_le_one_div_of_le (by linarith : 0 < a+s) + linarith + + theorem reciprocalDifference_integral {a : ℝ} (ha : 0 < a) : + ∫ s in Ioi (0 : ℝ), reciprocalDifference a s = Real.log a := by + simpa [logarithmicPrimitive] using + integral_Ioi_of_hasDerivAt_of_tendsto' (fun s hs => logarithmicPrimitive_deriv ha hs) + (reciprocalDifference_integrable ha) (logarithmicPrimitive_atTop a) + +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/EntropyReal.lean b/lean/OAI/Analysis/FreeEntropy/EntropyReal.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a91dec343e3ec305a9b2d22b0f2931a78ddf3b4 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/EntropyReal.lean @@ -0,0 +1,123 @@ +import OAI.Analysis.FreeEntropy.HeatAnalysis + +namespace OAI + +universe u1 + +noncomputable section +open scoped ENNReal NNReal Topology +open MeasureTheory Filter Set Finset +namespace FiniteEntropySeparation + + theorem signed_lintegral_toEReal {α : Type u1} [MeasurableSpace α] {μ : Measure α} + {b f : α → ℝ≥0∞} {r : α → ℝ} + (hb : ∀ᵐ x ∂μ, b x ≠ ⊤) (hf : ∀ᵐ x ∂μ, f x ≠ ⊤) + (hr : ∀ᵐ x ∂μ, r x = (b x).toReal - (f x).toReal) (hi : Integrable r μ) : + (∫⁻ x, b x - f x ∂μ).toEReal - (∫⁻ x, f x - b x ∂μ).toEReal = + ((∫ x, r x ∂μ : ℝ) : EReal) := by + have hp : ∫⁻ x, b x - f x ∂μ = ∫⁻ x, ENNReal.ofReal (r x) ∂μ := by + apply lintegral_congr_ae + filter_upwards [hb,hf,hr] with x hb hf hr + rw [hr, ENNReal.ofReal_sub _ ENNReal.toReal_nonneg, ENNReal.ofReal_toReal hb, + ENNReal.ofReal_toReal hf] + have hn : ∫⁻ x, f x - b x ∂μ = ∫⁻ x, ENNReal.ofReal (-r x) ∂μ := by + apply lintegral_congr_ae + filter_upwards [hb,hf,hr] with x hb hf hr + rw [hr, neg_sub, ENNReal.ofReal_sub _ ENNReal.toReal_nonneg, ENNReal.ofReal_toReal hb, + ENNReal.ofReal_toReal hf] + have hnf : (∫⁻ x, ENNReal.ofReal (-r x) ∂μ) < ∞ := by + simpa only [Pi.neg_apply] using lintegral_ofReal_finite hi.neg + rw [hp,hn, ← EReal.coe_ennreal_toReal (lintegral_ofReal_finite hi).ne, + ← EReal.coe_ennreal_toReal hnf.ne, + integral_eq_lintegral_pos_part_sub_lintegral_neg_part hi] + norm_cast + +namespace Model +variable (p : ℕ) [NeZero p] +def gaussianEntropy (a : ℝ) : ℝ := + (p+1 : ℕ)/2 * Real.log (2*Real.pi*Real.exp 1) + + (1/2 : ℝ) * ∑ i : Fin (p+1), Real.log (a + variance p i) + theorem chiStar_integral (hp : 2 ≤ p) (a : ℝ) (ha : 0 < a) : + chiStar (τ p) (X p a) (auxiliaryNoise p) = + (((p+1 : ℕ)/2 * Real.log (2*Real.pi*Real.exp 1) + + (1/2 : ℝ) * ∫ s in Ioi (0 : ℝ), (p+1 : ℕ)/(1+s) - heatFisherReal p (a+s) : ℝ) : EReal) := by + let b : ℝ → ℝ≥0∞ := fun s => ENNReal.ofReal ((p+1 : ℕ)/(1+s)) + let f : ℝ → ℝ≥0∞ := fun s => freeFisher (τ p) (doublyNoised p a s) + let r : ℝ → ℝ := fun s => (p+1 : ℕ)/(1+s) - heatFisherReal p (a+s) + have hb : ∀ᵐ s ∂volume.restrict (Ioi (0 : ℝ)), b s ≠ ⊤ := Eventually.of_forall (fun _ => ENNReal.ofReal_ne_top) + have hf : ∀ᵐ s ∂volume.restrict (Ioi (0 : ℝ)), f s ≠ ⊤ := by + filter_upwards [ae_restrict_mem measurableSet_Ioi] with s hs + exact ne_top_of_le_ne_top ENNReal.ofReal_ne_top + (doublyNoised_fisher_le p a s ha.le hs.le (by linarith [show 0 by simpa [f,add_assoc,add_comm,add_left_comm] using + doublyNoised_fisher_lower p hp a s ha.le hs.le (by linarith)) + (fun s hs => doublyNoised_fisher_le p a s ha.le hs.le (by linarith)) + rw [← EReal.coe_ennreal_toReal ht.1.ne, ← EReal.coe_ennreal_toReal ht.2.ne] at he ⊢ + have he' : (∫⁻ s in Ioi (0:ℝ), b s - f s).toReal - + (∫⁻ s in Ioi (0:ℝ), f s - b s).toReal = ∫ s in Ioi (0:ℝ), r s := by + exact_mod_cast he + change (((p+1 : ℕ)/2 * Real.log (2*Real.pi*Real.exp 1) + + (1/2 : ℝ)*(∫⁻ s in Ioi (0:ℝ), b s-f s).toReal - + (1/2 : ℝ)*(∫⁻ s in Ioi (0:ℝ), f s-b s).toReal : ℝ) : EReal) = _ + congr 1 + change _ = (p+1 : ℕ)/2 * Real.log (2*Real.pi*Real.exp 1) + + (1/2 : ℝ)*∫ s in Ioi (0:ℝ), r s + linarith [he'] + + theorem covarianceCorrection_integrable (a : ℝ) (ha : 0 < a) : + IntegrableOn (fun s => ∑ i : Fin (p+1), reciprocalDifference (a+variance p i) s) (Ioi 0) := + integrable_finsetSum _ (fun i _ => reciprocalDifference_integrable (by linarith [variance_nonneg p i])) + theorem covarianceCorrection_integral (a : ℝ) (ha : 0 < a) : + (∫ s in Ioi (0 : ℝ), ∑ i : Fin (p+1), reciprocalDifference (a+variance p i) s) = + ∑ i : Fin (p+1), Real.log (a+variance p i) := by + rw [integral_finsetSum _ (fun i _ => reciprocalDifference_integrable (by linarith [variance_nonneg p i]))] + apply sum_congr rfl + intro i _ + exact reciprocalDifference_integral (by linarith [variance_nonneg p i]) + theorem covarianceCorrection_identity (a s : ℝ) : + (∑ i : Fin (p+1), reciprocalDifference (a+variance p i) s) - + ((p+1 : ℕ)/(1+s) - heatFisherReal p (a+s)) = fisherDeficit p (a+s) := by + simp only [reciprocalDifference, sum_sub_distrib, sum_const, card_univ, Fintype.card_fin, nsmul_eq_mul] + simp only [fisherDeficit, covarianceFisher, heatFisherReal, one_div] + have he : (∑ i : Fin (p+1), (a+variance p i+s)⁻¹) = ∑ i : Fin (p+1), (variance p i+(a+s))⁻¹ := by + apply sum_congr rfl; intro i _; congr 1; ring + rw [he] + simp only [div_eq_mul_inv] + ring + theorem fisherDeficit_shift_integrable (hp : 2 ≤ p) (a : ℝ) (ha : 0 < a) : + IntegrableOn (fun s => fisherDeficit p (a+s)) (Ioi 0) := by + have hh := (covarianceCorrection_integrable p a ha).sub (entropyIntegrand_integrable p hp a ha) + change IntegrableOn (fun s => (∑ i : Fin (p+1), reciprocalDifference (a+variance p i) s) - + ((p+1 : ℕ)/(1+s) - heatFisherReal p (a+s))) (Ioi 0) at hh + simpa only [covarianceCorrection_identity] using hh + theorem chiStar_covariance_formula (hp : 2 ≤ p) (a : ℝ) (ha : 0 < a) : + chiStar (τ p) (X p a) (auxiliaryNoise p) = + ((gaussianEntropy p a - (1/2 : ℝ) * ∫ s in Ioi (0:ℝ), fisherDeficit p (a+s) : ℝ) : EReal) := by + rw [chiStar_integral p hp a ha] + congr 1 + have he : (∫ s in Ioi (0:ℝ), fisherDeficit p (a+s)) = + (∑ i : Fin (p+1), Real.log (a+variance p i)) - + (∫ s in Ioi (0:ℝ), (p+1 : ℕ)/(1+s) - heatFisherReal p (a+s)) := by + simp_rw [← covarianceCorrection_identity p a] + rw [integral_sub (covarianceCorrection_integrable p a ha) (entropyIntegrand_integrable p hp a ha), + covarianceCorrection_integral p a ha] + rw [he] + unfold gaussianEntropy + ring +end Model +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/EquidiscreteSignal.lean b/lean/OAI/Analysis/FreeEntropy/EquidiscreteSignal.lean new file mode 100644 index 0000000000000000000000000000000000000000..8cea4f17c444e6e309b3caeed56e957593ee3561 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/EquidiscreteSignal.lean @@ -0,0 +1,137 @@ +import OAI.Analysis.FreeEntropy.TensorFreeness + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate lp +open MeasureTheory Filter +namespace FiniteEntropySeparation + +def equidiscreteAtom (p : ℕ) (l : Fin p) : ℝ := -1 + 2 * l.val / (p - 1 : ℝ) + + theorem equidiscreteAtom_rev {p : ℕ} (hp : 2 ≤ p) (l : Fin p) : + equidiscreteAtom p l.rev = -equidiscreteAtom p l := by + have hd : (p : ℝ) - 1 ≠ 0 := by + have hp' : (2 : ℝ) ≤ p := by exact_mod_cast hp + linarith + have hl : (l.rev.val : ℝ) = (p : ℝ) - 1 - l.val := by + have hn : l.rev.val + 1 + l.val = p := by simp [Fin.rev]; omega + have hr : (l.rev.val : ℝ) + 1 + l.val = p := by exact_mod_cast hn + linarith + unfold equidiscreteAtom + rw [hl] + field_simp + ; ring + + theorem sum_equidiscreteAtom {p : ℕ} (hp : 2 ≤ p) : ∑ l : Fin p, equidiscreteAtom p l = 0 := by + have hs := Equiv.sum_comp (Fin.revPerm (n := p)) (equidiscreteAtom p) + simp only [Fin.revPerm_apply, equidiscreteAtom_rev hp, Finset.sum_neg_distrib] at hs + linarith + + theorem equidiscreteAtom_abs_le {p : ℕ} (hp : 2 ≤ p) (l : Fin p) : + |equidiscreteAtom p l| ≤ 1 := by + have hd : 0 < (p : ℝ) - 1 := by + have hp' : (2 : ℝ) ≤ p := by exact_mod_cast hp + linarith + have hl : (l.val : ℝ) ≤ (p : ℝ) - 1 := by + have hn : l.val + 1 ≤ p := l.isLt + exact_mod_cast (show (l.val : ℤ) ≤ (p : ℤ) - 1 by omega) + rw [abs_le, equidiscreteAtom] + constructor + · have h := div_nonneg (show 0 ≤ 2 * (l.val : ℝ) by positivity) hd.le + linarith + · have h : 2 * (l.val : ℝ) / ((p : ℝ) - 1) ≤ 2 := (div_le_iff₀ hd).mpr (by linarith) + linarith + +namespace FreeTensor +variable {B N : Type} [DecidableEq B] [DecidableEq N] (p : ℕ) [NeZero p] + +def dualIndex : AddChar (ZMod p) ℂ ≃ Fin p := + Fintype.equivFinOfCardEq (by simp) + +def equidiscreteSignal : Space B N (Multiplicative (ZMod p)) →L[ℂ] Space B N (Multiplicative (ZMod p)) := + spectralSignal (fun ψ => equidiscreteAtom p (dualIndex p ψ)) + + theorem equidiscreteSignal_selfAdjoint : IsSelfAdjoint (equidiscreteSignal (B := B) (N := N) p) := + spectralSignal_selfAdjoint _ + + theorem equidiscreteSignal_mem : equidiscreteSignal (B := B) (N := N) p ∈ + algebra B N (Multiplicative (ZMod p)) := spectralSignal_mem _ + + theorem equidiscreteSignal_norm_le (hp : 2 ≤ p) : + ‖equidiscreteSignal (B := B) (N := N) p‖ ≤ 1 := + spectralSignal_norm_le _ 1 zero_le_one (fun _character => equidiscreteAtom_abs_le hp _) + + theorem equidiscreteSignal_moments (k : ℕ) : + trace (tracialVector B N (Multiplicative (ZMod p))) (equidiscreteSignal p ^ k) = + (p : ℂ)⁻¹ * ∑ l : Fin p, (equidiscreteAtom p l : ℂ) ^ k := by + rw [equidiscreteSignal, trace_spectralSignal_pow] + simp only [ZMod.card] + congr 1 + exact (dualIndex p).sum_comp (fun l => (equidiscreteAtom p l : ℂ) ^ k) + + theorem trace_equidiscreteSignal (hp : 2 ≤ p) : + trace (tracialVector B N (Multiplicative (ZMod p))) (equidiscreteSignal p) = 0 := by + have h := equidiscreteSignal_moments (B := B) (N := N) p 1 + simpa [← Complex.ofReal_sum, sum_equidiscreteAtom hp] using h + + theorem characterProjection_mem_background {A : Type} [AddCommGroup A] [Fintype A] [DecidableEq A] + (J : Set N) (ψ : AddChar A ℂ) : + characterProjection (B := B) (N := N) ψ ∈ backgroundAlgebra J := by + apply (backgroundAlgebra J).smul_mem + apply (backgroundAlgebra J).sum_mem + intro a _ + apply (backgroundAlgebra J).smul_mem + exact Algebra.subset_adjoin (Or.inl (Or.inr ⟨Multiplicative.ofAdd a,rfl⟩)) + + theorem equidiscreteSignal_mem_background (J : Set N) : + equidiscreteSignal (B := B) (N := N) p ∈ backgroundAlgebra J := by + apply (backgroundAlgebra J).sum_mem + intro ψ _ + exact (backgroundAlgebra J).smul_mem (characterProjection_mem_background J ψ) _ + + theorem characterProjection_commutes_B {A : Type} [AddCommGroup A] [Fintype A] [DecidableEq A] + (ψ : AddChar A ℂ) (b : B) : + Commute (characterProjection (B := B) (N := N) ψ) (semicircularB b) := by + apply Commute.smul_left + apply Commute.sum_left + intro a _ + exact (unitaryG_commutes_semicircularB (Multiplicative.ofAdd a) b).smul_left _ + + theorem equidiscreteSignal_commutes_B (b : B) : + Commute (equidiscreteSignal (B := B) (N := N) p) (semicircularB b) := by + apply Commute.sum_left + intro ψ _ + exact (characterProjection_commutes_B ψ b).smul_left _ + + theorem tensor_characterProjection_moment {A : Type} [AddCommGroup A] [Fintype A] [DecidableEq A] + (w : List B) (ψ : AddChar A ℂ) : + trace (tracialVector B N (Multiplicative A)) + ((w.map semicircularB).prod * characterProjection ψ) = + trace (Fock.tracialVector B) ((w.map Fock.semicircular).prod) * (Fintype.card A : ℂ)⁻¹ := by + simp only [characterProjection, mul_smul_comm, Finset.mul_sum, trace_smul, trace_sum, + groupUnitary, tensor_word_moment] + have hi (a : A) : (Multiplicative.ofAdd a = (1 : Multiplicative A)) ↔ a = 0 := Iff.rfl + simp only [hi] + simp + ring + + theorem tensor_equidiscrete_moment (w : List B) (k : ℕ) : + trace (tracialVector B N (Multiplicative (ZMod p))) + ((w.map semicircularB).prod * equidiscreteSignal p ^ k) = + trace (Fock.tracialVector B) ((w.map Fock.semicircular).prod) * + ((p : ℂ)⁻¹ * ∑ l : Fin p, (equidiscreteAtom p l : ℂ) ^ k) := by + rw [equidiscreteSignal, spectralSignal_pow, Finset.mul_sum, trace_sum] + simp only [mul_smul_comm, trace_smul, tensor_characterProjection_moment, ZMod.card] + rw [← Finset.sum_mul] + have hs := (dualIndex p).sum_comp (fun l => (equidiscreteAtom p l : ℂ) ^ k) + change _ = _ at hs + rw [hs] + ring + +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/FatouFlow.lean b/lean/OAI/Analysis/FreeEntropy/FatouFlow.lean new file mode 100644 index 0000000000000000000000000000000000000000..20ce24b38f4ec6683f3ab6d736d7c2202f986df8 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/FatouFlow.lean @@ -0,0 +1,61 @@ +import OAI.Analysis.FreeEntropy.GaussianCorrection + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory Set Filter +open scoped Topology ENNReal +namespace FiniteEntropySeparation + theorem integral_le_of_liminf_tests {Ω : Type u1} [MeasurableSpace Ω] (ν : Measure Ω) + (F : Ω → ℝ) (g : ℕ → Ω → ℝ) (hF : Integrable F ν) (hF0 : 0≤ᵐ[ν] F) + (hg : ∀k,Integrable (g k) ν) (hg0 : ∀k,0≤ᵐ[ν] g k) + (hl : ∀ᵐs ∂ν,ENNReal.ofReal (F s) ≤ liminf (fun k => ENNReal.ofReal (g k s)) atTop) + {C : ℝ} (hC : ∀ᶠk in atTop,(∫s,g k s ∂ν) ≤ C) : (∫s,F s ∂ν) ≤ C := by + have hc : 0≤C := by + obtain ⟨k,hk⟩ := hC.exists + exact (integral_nonneg_of_ae (hg0 k)).trans hk + apply (ENNReal.ofReal_le_ofReal_iff hc).mp + rw [ofReal_integral_eq_lintegral_ofReal hF hF0] + apply (lintegral_mono_ae hl).trans + apply (lintegral_liminf_le' (fun k => ENNReal.measurable_ofReal.comp_aemeasurable (hg k).aestronglyMeasurable.aemeasurable)).trans + apply liminf_le_of_frequently_le' + apply Eventually.frequently + filter_upwards [hC] with k hk + simp only [Function.comp_apply] + rw [← ofReal_integral_eq_lintegral_ofReal (hg k) (hg0 k)] + exact ENNReal.ofReal_le_ofReal hk +variable {n : ℕ} {D : ℕ → ℕ} (hD : ∀k,0 ENNReal.ofReal (normalizedMatrixFisher (μ k) s)) atTop) + (hinit : ∀k,β≤normalizedMatrixEntropy (μ k) a) + (hterm : ∀ε : ℝ,0<ε → ∀ᶠk in atTop,normalizedMatrixEntropy (μ k) t ≤ L+ε) : + β+(1/2:ℝ)*(∫s in a..t,F s) ≤ L := by + have ht : 0 normalizedMatrixFisher (μ k)) hF.1 + ((ae_restrict_mem measurableSet_Ioc).mono (fun _ hs => hF0 _ hs)) + (fun k => (hg k).1) + (fun k => (ae_restrict_mem measurableSet_Ioc).mono (fun s hs => normalizedMatrixFisher_nonneg (hD k) (μ k) (ha.trans hs.1))) + ((ae_restrict_mem measurableSet_Ioc).mono (fun _ hs => hl _ hs)) hbound + rw [intervalIntegral.integral_of_le hat] + linarith +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/FisherDeficit.lean b/lean/OAI/Analysis/FreeEntropy/FisherDeficit.lean new file mode 100644 index 0000000000000000000000000000000000000000..1345f7a4fb66ed6be7feea08bc8e6bd1545181b6 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/FisherDeficit.lean @@ -0,0 +1,83 @@ +import OAI.Analysis.FreeEntropy.NoiseRotation + +namespace OAI + +noncomputable section +open scoped ComplexConjugate ENNReal +namespace FiniteEntropySeparation +open Finset FreeSeries +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] + +theorem fisher_cumulant_deficit {n : ℕ} (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ i, X i ∈ backgroundAlgebra J) (hsa : ∀ i, IsSelfAdjoint (X i)) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) + (v : Fin n → ℝ) (hv : ∀ i, 0 ≤ v i) + (hc : ∀ i, cumulants (wordMoment (tracialVector B N G) X) [i] = 0) + (hcov : ∀ i j, cumulants (wordMoment (tracialVector B N G) X) [i,j] = + if j=i then (v i : ℂ) else 0) + (K u : ℝ) (hK : 0 ≤ K) (hu : 0 < u) (hKu : 2*K^2 ≤ u) + (hR : ∀ m, degreeNorm (cumulants (wordMoment (tracialVector B N G) X)) m ≤ K^m) + (hvar : ∀ i, ‖heatTuple X (fun k => semicircularN (σ k)) u i + (tracialVector B N G).vacuum‖^2 = v i + u) : + 0 ≤ (freeFisher (tracialVector B N G) (heatTuple X (fun k => semicircularN (σ k)) u)).toReal - + ∑ i, (v i + u)⁻¹ ∧ + (freeFisher (tracialVector B N G) (heatTuple X (fun k => semicircularN (σ k)) u)).toReal - + ∑ i, (v i + u)⁻¹ ≤ 2*K^6/u^4 := by + let R := cumulants (wordMoment (tracialVector B N G) X) + let a : Fin n → List (Fin n) → ℂ := fun i => wickCoefficients (residual R v i) u + have hKu' : K^2 < u := by nlinarith [sq_nonneg K] + have ha (i : Fin n) : Summable (fun js => ‖a i js‖^2) := + wickCoefficient_summable hc hcov hK hR hu hKu' i + let av : Fin n → LabelHilbert.Space (List (Fin n)) := fun i => wickCoefficientVector (a i) (ha i) + obtain ⟨ξ,hξ⟩ := heat_conjugates_exist J X hX σ hσ hs u hu + have ht (i : Fin n) (w : List (Fin n)) := + heat_cumulant_residual_hasSum J X hX hsa σ hσ hs u hu.le v i w + have he (i : Fin n) (w : List (Fin n)) : + inner ℂ (heatTuple X (fun k => semicircularN (σ k)) u i (tracialVector B N G).vacuum) + (wordEval (heatTuple X (fun k => semicircularN (σ k)) u) w (tracialVector B N G).vacuum) - + ((v i + u : ℝ) : ℂ) * derivativeMoment (tracialVector B N G) + (heatTuple X (fun k => semicircularN (σ k)) u) i w = + ∑' js, conj (av i js) * (Real.sqrt u : ℂ)^js.length * reverseDerivativeMoment + (tracialVector B N G) (heatTuple X (fun k => semicircularN (σ k)) u) js w := by + change _ = ∑' js, conj (wickCoefficients (residual R v i) u js) * + (Real.sqrt u : ℂ)^js.length * _ + simp_rw [wickCoefficients_cancel _ u hu] + exact (ht i w).tsum_eq.symm + have hb := fisher_wick_series_bound J X hX σ hσ hs u hu ξ hξ + (fun i => v i + u) hvar (fun i => by linarith [hv i]) av he + have hf : (freeFisher (tracialVector B N G) + (heatTuple X (fun k => semicircularN (σ k)) u)).toReal = ∑ i, ‖ξ i‖^2 := by + rw [freeFisher_eq_of_conjugate _ hξ, ENNReal.toReal_ofReal (sum_nonneg (fun _ _ => sq_nonneg _))] + rw [hf] + refine ⟨hb.1,hb.2.trans ?_⟩ + have hb' : ∑ i, ∑' js, ‖av i js‖^2 ≤ 2*K^6/u^2 := + wickCoefficient_total_bound hc hcov hK hR hu hKu + calc + _ ≤ (u^2)⁻¹ * (2*K^6/u^2) := mul_le_mul_of_nonneg_left hb' (by positivity) + _ = _ := by rw [show u^4 = u^2*u^2 by ring]; simp only [div_eq_mul_inv, mul_inv_rev]; ring +end FreeTensor +namespace Model +open FreeTensor +variable (p : ℕ) [NeZero p] +def cumulantConstant : ℝ := 128*Real.sqrt (Real.sqrt p) +def covarianceFisher (u : ℝ) : ℝ := ∑ i : Fin (p+1), (variance p i + u)⁻¹ +def fisherDeficit (u : ℝ) : ℝ := (freeFisher (τ p) (X p u)).toReal - covarianceFisher p u + theorem X_variance (u : ℝ) (hu : 0 ≤ u) (i : Fin (p+1)) : + ‖X p u i (τ p).vacuum‖^2 = variance p i + u := by + simpa [doublyNoised, heatTuple, variance] using doublyNoised_variance p u 0 hu (le_refl 0) i + theorem fisherDeficit_bounds (hp : 2 ≤ p) (u : ℝ) (hu : 0 < u) + (hKu : 2*(cumulantConstant p)^2 ≤ u) : + 0 ≤ fisherDeficit p u ∧ fisherDeficit p u ≤ 2*(cumulantConstant p)^6/u^4 := + fisher_cumulant_deficit ∅ (C p) (C_mem_background p ∅) (C_selfAdjoint p) + (initialIndex p) (initialIndex_injective p) (by simp) + (variance p) (variance_nonneg p) (signalCumulants_centered p hp) (signalCumulants_covariance p hp) + (cumulantConstant p) u (by dsimp [cumulantConstant]; positivity) hu hKu + (signalCumulants_norm_le p hp) (X_variance p u hu.le) +end Model +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/FisherLaw.lean b/lean/OAI/Analysis/FreeEntropy/FisherLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..d8e4ffd34b9d71c0bb7b04d6984a7ed34dad8c5d --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/FisherLaw.lean @@ -0,0 +1,114 @@ +import OAI.Analysis.FreeEntropy.HeatTensor + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate +open MeasureTheory Filter +namespace FiniteEntropySeparation +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + + theorem wordEval_append {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] {n : ℕ} (X : Fin n → H →L[ℂ] H) (u v : List (Fin n)) : + wordEval X (u ++ v) = wordEval X u * wordEval X v := by + simp [wordEval] + + theorem star_wordEval {n : ℕ} (X : Fin n → H →L[ℂ] H) + (hX : ∀ i, IsSelfAdjoint (X i)) (w : List (Fin n)) : + star (wordEval X w) = wordEval X w.reverse := by + induction w with + | nil => simp [wordEval] + | cons i w ih => + simp only [wordEval, List.map_cons, List.prod_cons, star_mul, (hX i).star_eq, + List.reverse_cons, List.map_append, List.prod_append, ] at * + rw [ih] + simp + + theorem inner_wordVector {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (hX : ∀ i, IsSelfAdjoint (X i)) (u v : List (Fin n)) : + inner ℂ (wordEval X u τ.vacuum) (wordEval X v τ.vacuum) = + wordMoment τ X (u.reverse ++ v) := by + rw [← ContinuousLinearMap.adjoint_inner_right, ← ContinuousLinearMap.star_eq_adjoint, + star_wordEval X hX u] + simp only [wordMoment, trace, wordEval_append, mul_apply_eq_comp] + +theorem polynomialVector_norm_sq_eq_of_moments + {K : Type} [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + {M : VonNeumannAlgebra H} {N : VonNeumannAlgebra K} + (τ : TracialVector M) (ρ : TracialVector N) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (Y : Fin n → K →L[ℂ] K) + (hX : ∀ i, IsSelfAdjoint (X i)) (hY : ∀ i, IsSelfAdjoint (Y i)) + (hm : ∀ w, wordMoment τ X w = wordMoment ρ Y w) (p : WordPolynomial n) : + ‖polynomialVector τ X p‖ ^ 2 = ‖polynomialVector ρ Y p‖ ^ 2 := by + rw [norm_sq_eq_re_inner (𝕜 := ℂ), norm_sq_eq_re_inner (𝕜 := ℂ)] + congr 1 + simp only [polynomialVector, Finsupp.linearCombination_apply, Finsupp.sum, + sum_inner, inner_sum, inner_smul_left, inner_smul_right, inner_wordVector τ X hX, + inner_wordVector ρ Y hY, hm] + + theorem derivativeMoment_eq_of_moments + {K : Type} [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + {M : VonNeumannAlgebra H} {N : VonNeumannAlgebra K} + (τ : TracialVector M) (ρ : TracialVector N) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (Y : Fin n → K →L[ℂ] K) + (hm : ∀ w, wordMoment τ X w = wordMoment ρ Y w) (i : Fin n) (w : List (Fin n)) : + derivativeMoment τ X i w = derivativeMoment ρ Y i w := by + simp only [derivativeMoment, hm] + +theorem freeFisher_eq_of_wordMoments + {K : Type} [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + {M : VonNeumannAlgebra H} {N : VonNeumannAlgebra K} + (τ : TracialVector M) (ρ : TracialVector N) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (Y : Fin n → K →L[ℂ] K) + (hX : ∀ i, IsSelfAdjoint (X i)) (hY : ∀ i, IsSelfAdjoint (Y i)) + (hm : ∀ w, wordMoment τ X w = wordMoment ρ Y w) + (heX : ∃ ξ, ConjugateSystem τ X ξ) (heY : ∃ ξ, ConjugateSystem ρ Y ξ) : + freeFisher τ X = freeFisher ρ Y := by + obtain ⟨ξ,hξ⟩ := heX + obtain ⟨η,hη⟩ := heY + rw [freeFisher_variational τ X hξ, freeFisher_variational ρ Y hη] + apply Finset.sum_congr rfl + intro i _ + apply congrArg iSup + funext p + apply congrArg ENNReal.ofReal + unfold fisherTest + rw [polynomialVector_norm_sq_eq_of_moments τ ρ X Y hX hY hm] + congr 2 + simp only [polynomialDerivative, Finsupp.linearCombination_apply, Finsupp.sum, + derivativeMoment_eq_of_moments τ ρ X Y hm] + + theorem continuous_heatTuple {n : ℕ} (X S : Fin n → H →L[ℂ] H) (i : Fin n) : + Continuous (fun u : ℝ => heatTuple X S u i) := by + unfold heatTuple + fun_prop + +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] + theorem heat_conjugates_exist {n : ℕ} (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ i, X i ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) + (u : ℝ) (hu : 0 < u) : + ∃ ξ, ConjugateSystem (tracialVector B N G) + (heatTuple X (fun i => semicircularN (σ i)) u) ξ := + exists_conjugate_of_fisher_le _ _ (n/u) (heat_freeFisher_le J X hX σ hσ hs u hu) + + theorem heat_freeFisher_measurable {n : ℕ} (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ i, X i ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) : + Measurable (fun u : Set.Ioi (0 : ℝ) => freeFisher (tracialVector B N G) + (heatTuple X (fun i => semicircularN (σ i)) u.val)) := by + apply LowerSemicontinuous.measurable + apply lowerSemicontinuous_freeFisher (tracialVector B N G) + · intro i + exact (continuous_heatTuple X (fun i => semicircularN (σ i)) i).comp continuous_subtype_val + · intro u + exact heat_conjugates_exist J X hX σ hσ hs u.val u.property + +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/FisherLiminf.lean b/lean/OAI/Analysis/FreeEntropy/FisherLiminf.lean new file mode 100644 index 0000000000000000000000000000000000000000..3fb394c258eb9c0a441dfa090b003a5c483ac7e2 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/FisherLiminf.lean @@ -0,0 +1,59 @@ +import OAI.Analysis.FreeEntropy.FisherTestLimit + +namespace OAI + +universe u1 + +noncomputable section +open Finset Filter +open scoped Topology ENNReal +namespace FiniteEntropySeparation + theorem ennreal_sum_iSup_tuple {P : Type u1} [Nonempty P] (n : ℕ) (f : Fin n → P → ℝ≥0∞) : + (∑i,⨆p,f i p) = ⨆p : Fin n → P,∑i,f i (p i) := by + induction n with + | zero => simp + | succ n ih => + rw [Fin.sum_univ_succ,ih (fun i => f i.succ),ENNReal.iSup_add] + simp_rw [ENNReal.add_iSup] + apply le_antisymm + · apply iSup_le + intro a + apply iSup_le + intro p + exact le_iSup_of_le (Fin.cons a p) (by simp [Fin.sum_univ_succ]) + · apply iSup_le + intro p + exact le_iSup_of_le (p 0) (le_iSup_of_le (fun i => p i.succ) (by simp [Fin.sum_univ_succ])) +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} (X : Fin n → H →L[ℂ] H) + theorem fisherTest_zero (i : Fin n) : fisherTest τ X i 0 = 0 := by simp [fisherTest] + theorem freeFisher_le_liminf_tests {ξ : Fin n → H} (hξ : ConjugateSystem τ X ξ) + (t : ℕ → Fin n → WordPolynomial n → ℝ) (I : ℕ → ℝ) + (ht : ∀i p,Tendsto (fun k => t k i p) atTop (𝓝 (fisherTest τ X i p))) + (hI : ∀k (p : Fin n → WordPolynomial n),∑i,t k i (p i) ≤ I k) : + freeFisher τ X ≤ liminf (fun k => ENNReal.ofReal (I k)) atTop := by + rw [freeFisher_variational τ X hξ,ennreal_sum_iSup_tuple] + apply iSup_le + intro p + let q : Fin n → WordPolynomial n := fun i => if 0 ≤ fisherTest τ X i (p i) then p i else 0 + have hq i : 0 ≤ fisherTest τ X i (q i) := by + dsimp [q] + split_ifs with h + · exact h + · rw [fisherTest_zero] + have he i : ENNReal.ofReal (fisherTest τ X i (p i)) = ENNReal.ofReal (fisherTest τ X i (q i)) := by + dsimp [q] + split_ifs with h + · rfl + · rw [fisherTest_zero,ENNReal.ofReal_zero,ENNReal.ofReal_eq_zero] + exact le_of_not_ge h + simp_rw [he] + rw [← ENNReal.ofReal_sum_of_nonneg (fun i _ => hq i)] + have ht' := ENNReal.continuous_ofReal.continuousAt.tendsto.comp (tendsto_finsetSum univ (fun i _ => ht i (q i))) + rw [← ht'.liminf_eq] + exact liminf_le_liminf (Eventually.of_forall (fun k => ENNReal.ofReal_le_ofReal (hI k q))) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/FisherResidual.lean b/lean/OAI/Analysis/FreeEntropy/FisherResidual.lean new file mode 100644 index 0000000000000000000000000000000000000000..b22e0d5e8eb24ef894ec9110d57c8408f98c753f --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/FisherResidual.lean @@ -0,0 +1,103 @@ +import OAI.Analysis.FreeEntropy.MonomialSeries + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate +open MeasureTheory Filter +namespace FiniteEntropySeparation +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + + theorem polynomialL2_ext {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) {x y : H} + (hx : x ∈ polynomialL2 τ X) (hy : y ∈ polynomialL2 τ X) + (h : ∀ w, inner ℂ x (wordEval X w τ.vacuum) = inner ℂ y (wordEval X w τ.vacuum)) : x = y := by + have hmem := (polynomialL2 τ X).sub_mem hx hy + have hker : polynomialL2 τ X ≤ (innerSL ℂ (x - y)).ker := by + apply Submodule.topologicalClosure_minimal + · apply Submodule.span_le.mpr + rintro _ ⟨w,rfl⟩ + change inner ℂ (x-y) (wordEval X w τ.vacuum) = 0 + rw [inner_sub_left, h w, sub_self] + · exact (innerSL ℂ (x-y)).isClosed_ker + exact sub_eq_zero.mp (inner_self_eq_zero.mp (hker hmem)) + + theorem polynomialL2_eq_projection {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) {x y : H} + (hx : x ∈ polynomialL2 τ X) + (h : ∀ w, inner ℂ x (wordEval X w τ.vacuum) = inner ℂ y (wordEval X w τ.vacuum)) : + x = (polynomialL2 τ X).starProjection y := by + apply polynomialL2_ext τ X hx ((polynomialL2 τ X).starProjection_apply_mem y) + intro w + have hp := (polynomialL2 τ X).starProjection_inner_eq_zero y + (wordEval X w τ.vacuum) (wordVector_mem_polynomialL2 τ X w) + rw [inner_sub_left, ← h w] at hp + exact sub_eq_zero.mp hp + + theorem norm_le_of_polynomial_testing {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) {x y : H} + (hx : x ∈ polynomialL2 τ X) + (h : ∀ w, inner ℂ x (wordEval X w τ.vacuum) = inner ℂ y (wordEval X w τ.vacuum)) : + ‖x‖ ≤ ‖y‖ := by + rw [polynomialL2_eq_projection τ X hx h] + exact (polynomialL2 τ X).norm_starProjection_apply_le y + + theorem conjugate_residual_norm_sq {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} {X : Fin n → H →L[ℂ] H} {ξ : Fin n → H} + (hξ : ConjugateSystem τ X ξ) (i : Fin n) (v : ℝ) + (hv : ‖X i τ.vacuum‖ ^ 2 = v) : + ‖X i τ.vacuum - (v : ℂ) • ξ i‖ ^ 2 = v ^ 2 * ‖ξ i‖ ^ 2 - v := by + have hp : inner ℂ (X i τ.vacuum) (ξ i) = 1 := by + rw [← inner_conj_symm, conjugate_coordinate_pairing τ hξ i] + simp + rw [norm_sub_sq (𝕜 := ℂ), hv, inner_smul_right, hp, mul_one, norm_smul, + Complex.norm_real, Real.norm_eq_abs, mul_pow, sq_abs] + change v - 2 * v + v ^ 2 * ‖ξ i‖ ^ 2 = _ + ring + +theorem fisher_residual_bound {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} {X : Fin n → H →L[ℂ] H} {ξ : Fin n → H} + (hξ : ConjugateSystem τ X ξ) (v : Fin n → ℝ) (u : ℝ) (hu : 0 < u) + (hv : ∀ i, ‖X i τ.vacuum‖ ^ 2 = v i) (hvu : ∀ i, u ≤ v i) + (R : Fin n → H) + (hR : ∀ i w, inner ℂ (X i τ.vacuum) (wordEval X w τ.vacuum) - + (v i : ℂ) * derivativeMoment τ X i w = inner ℂ (R i) (wordEval X w τ.vacuum)) : + 0 ≤ (∑ i, ‖ξ i‖ ^ 2) - (∑ i, (v i)⁻¹) ∧ + (∑ i, ‖ξ i‖ ^ 2) - (∑ i, (v i)⁻¹) ≤ (u ^ 2)⁻¹ * ∑ i, ‖R i‖ ^ 2 := by + have hvp (i : Fin n) : 0 < v i := hu.trans_le (hvu i) + have hl (i : Fin n) : (v i)⁻¹ ≤ ‖ξ i‖ ^ 2 := by + simpa only [hv i, one_div] using conjugate_norm_sq_lower τ hξ i + have hn (i : Fin n) : ‖X i τ.vacuum - (v i : ℂ) • ξ i‖ ≤ ‖R i‖ := by + apply norm_le_of_polynomial_testing τ X + · apply (polynomialL2 τ X).sub_mem + · simpa [wordEval] using wordVector_mem_polynomialL2 τ X [i] + · exact (polynomialL2 τ X).smul_mem _ (hξ i).1 + · intro w + simpa only [inner_sub_left, inner_smul_left, map_ofNat, Complex.conj_ofReal, + (hξ i).2 w] using hR i w + have hi (i : Fin n) : ‖ξ i‖ ^ 2 - (v i)⁻¹ ≤ (u ^ 2)⁻¹ * ‖R i‖ ^ 2 := by + have hs : (v i) ^ 2 * ‖ξ i‖ ^ 2 - v i ≤ ‖R i‖ ^ 2 := by + rw [← conjugate_residual_norm_sq τ hξ i (v i) (hv i)] + exact pow_le_pow_left₀ (norm_nonneg _) (hn i) 2 + have huv : u ^ 2 ≤ (v i) ^ 2 := pow_le_pow_left₀ hu.le (hvu i) 2 + have hd : 0 ≤ ‖ξ i‖ ^ 2 - (v i)⁻¹ := sub_nonneg.mpr (hl i) + have hmult := mul_le_mul_of_nonneg_right huv hd + rw [mul_comm ((u ^ 2)⁻¹), ← div_eq_mul_inv] + apply (le_div_iff₀ (sq_pos_of_pos hu)).mpr + have ha : (v i) ^ 2 * (v i)⁻¹ = v i := by + rw [pow_two, mul_assoc, mul_inv_cancel₀ (hvp i).ne', mul_one] + calc + _ = u ^ 2 * (‖ξ i‖ ^ 2 - (v i)⁻¹) := mul_comm _ _ + _ ≤ (v i) ^ 2 * (‖ξ i‖ ^ 2 - (v i)⁻¹) := hmult + _ = (v i) ^ 2 * ‖ξ i‖ ^ 2 - v i := by rw [mul_sub, ha] + _ ≤ _ := hs + constructor + · exact sub_nonneg.mpr (Finset.sum_le_sum (fun i _ => hl i)) + · rw [← Finset.sum_sub_distrib, Finset.mul_sum] + exact Finset.sum_le_sum fun i _ => hi i + +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/FisherTestLimit.lean b/lean/OAI/Analysis/FreeEntropy/FisherTestLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..2fe0b87236daf0989f60bdf79735a03c4669163f --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/FisherTestLimit.lean @@ -0,0 +1,91 @@ +import OAI.Analysis.FreeEntropy.MatrixHeatLawMoments + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory Finset Filter +open scoped Topology +namespace FiniteEntropySeparation + theorem complex_integrable_re {Ω : Type u1} [MeasurableSpace Ω] {μ : Measure Ω} {f : Ω → ℂ} + (hf : Integrable f μ) : Integrable (fun x => (f x).re) μ := hf.re +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +variable {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} (X : Fin n → H →L[ℂ] H) (hX : ∀i,IsSelfAdjoint (X i)) +variable {D : ℕ → ℕ} (ν : (k:ℕ) → Measure (MatrixCoordinates n (D k))) + (hi : ∀k w,Integrable (fun a => matrixMoment a w) (ν k)) + (hip : ∀k v w,Integrable (fun a => matrixMoment a v*matrixMoment a w) (ν k)) + (ht : ∀w,Tendsto (fun k => ∫a,matrixMoment a w ∂ν k) atTop (𝓝 (wordMoment τ X w))) + (htp : ∀v w,Tendsto (fun k => ∫a,matrixMoment a v*matrixMoment a w ∂ν k) atTop (𝓝 (wordMoment τ X v*wordMoment τ X w))) + include hi in + theorem matrixPolynomialNorm_integrable (k : ℕ) (p : WordPolynomial n) : + Integrable (matrixPolynomialNorm p) (ν k) := + (integrable_finsetSum p.support (fun u _ => integrable_finsetSum p.support (fun v _ => (hi k (u.reverse++v)).const_mul (star (p u)*p v)))).re + include hip in + theorem matrixPolynomialDerivative_integrable (k : ℕ) (p : WordPolynomial n) (i : Fin n) : + Integrable (matrixPolynomialDerivative p i) (ν k) := by + apply integrable_finsetSum p.support + intro w _ + apply Integrable.const_mul + apply integrable_finsetSum univ + intro r _ + by_cases h : w[r.val]=i + · simpa only [h,ite_true] using hip k (w.take r.val) (w.drop (r.val+1)) + · simp only [h,ite_false] + exact integrable_zero _ _ _ + include hi ht hX in + theorem matrixPolynomialNorm_integral_tendsto (p : WordPolynomial n) : + Tendsto (fun k => ∫a,matrixPolynomialNorm p a ∂ν k) atTop (𝓝 (‖polynomialVector τ X p‖^2)) := by + have he k : (∫a,matrixPolynomialNorm p a ∂ν k) = + (∑u∈p.support,∑v∈p.support,star (p u)*p v*(∫a,matrixMoment a (u.reverse++v) ∂ν k)).re := by + simp only [matrixPolynomialNorm] + rw [← complex_integral_re (integrable_finsetSum _ (fun u _ => integrable_finsetSum _ (fun v _ => (hi k _).const_mul _)))] + rw [integral_finsetSum _ (fun u _ => integrable_finsetSum _ (fun v _ => (hi k _).const_mul _))] + simp_rw [integral_finsetSum _ (fun v _ => (hi k _).const_mul _),integral_const_mul] + simp_rw [he] + rw [polynomialVector_norm_formula τ X hX] + exact Complex.continuous_re.continuousAt.tendsto.comp + (tendsto_finsetSum p.support (fun u _ => tendsto_finsetSum p.support (fun v _ => (ht _).const_mul _))) + include hip htp in + theorem matrixPolynomialDerivative_integral_tendsto (p : WordPolynomial n) (i : Fin n) : + Tendsto (fun k => ∫a,matrixPolynomialDerivative p i a ∂ν k) atTop (𝓝 (polynomialDerivative τ X i p)) := by + have hir (k : ℕ) (w : List (Fin n)) (r : Fin w.length) : Integrable (fun a : MatrixCoordinates n (D k) => if w[r.val]=i then matrixMoment a (w.take r.val)*matrixMoment a (w.drop (r.val+1)) else 0) (ν k) := by + by_cases h : w[r.val]=i + · simpa only [h,ite_true] using hip k (w.take r.val) (w.drop (r.val+1)) + · simp only [h,ite_false]; exact integrable_zero _ _ _ + have he k : (∫a,matrixPolynomialDerivative p i a ∂ν k) = + ∑w∈p.support,p w*∑r : Fin w.length,if w[r.val]=i then (∫a,matrixMoment a (w.take r.val)*matrixMoment a (w.drop (r.val+1)) ∂ν k) else 0 := by + simp only [matrixPolynomialDerivative] + rw [integral_finsetSum _ (fun w _ => (integrable_finsetSum _ (fun r _ => hir k w r)).const_mul _)] + apply sum_congr rfl + intro w _ + rw [integral_const_mul,integral_finsetSum _ (fun r _ => hir k w r)] + congr 1 + apply sum_congr rfl + intro r _ + split_ifs <;> simp + simp_rw [he] + simp only [polynomialDerivative,Finsupp.linearCombination_apply,Finsupp.sum,smul_eq_mul,derivativeMoment] + apply tendsto_finsetSum p.support + intro w _ + apply Tendsto.const_mul + apply tendsto_finsetSum univ + intro r _ + split_ifs + · exact htp _ _ + · exact tendsto_const_nhds + include hi hip ht htp hX in + theorem matrixFisherTest_integral_tendsto (p : WordPolynomial n) (i : Fin n) : + Tendsto (fun k => ∫a,matrixFisherTest p i a ∂ν k) atTop (𝓝 (fisherTest τ X i p)) := by + have he k : (∫a,matrixFisherTest p i a ∂ν k) = + 2*(∫a,matrixPolynomialDerivative p i a ∂ν k).re-∫a,matrixPolynomialNorm p a ∂ν k := by + simp only [matrixFisherTest] + rw [integral_sub ((complex_integrable_re (matrixPolynomialDerivative_integrable ν hip k p i)).const_mul 2) (matrixPolynomialNorm_integrable ν hi k p),integral_const_mul,← complex_integral_re (matrixPolynomialDerivative_integrable ν hip k p i)] + simp_rw [he] + exact ((Complex.continuous_re.continuousAt.tendsto.comp (matrixPolynomialDerivative_integral_tendsto τ X ν hip htp p i)).const_mul 2).sub + (matrixPolynomialNorm_integral_tendsto τ X hX ν hi ht p) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/FisherVariational.lean b/lean/OAI/Analysis/FreeEntropy/FisherVariational.lean new file mode 100644 index 0000000000000000000000000000000000000000..029b163b316ad43c65183c42a56ce5aefb421d0f --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/FisherVariational.lean @@ -0,0 +1,168 @@ +import OAI.Analysis.FreeEntropy.MatrixWordDerivative + +namespace OAI + +universe u1 u2 u3 u4 u5 + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate +open MeasureTheory Filter +namespace FiniteEntropySeparation +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +abbrev WordPolynomial (n : ℕ) := List (Fin n) →₀ ℂ + +def polynomialVector {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) : WordPolynomial n →ₗ[ℂ] H := + Finsupp.linearCombination ℂ (fun w => wordEval X w τ.vacuum) + +def polynomialDerivative {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (i : Fin n) : WordPolynomial n →ₗ[ℂ] ℂ := + Finsupp.linearCombination ℂ (derivativeMoment τ X i) + + theorem conjugate_polynomial_pairing {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} {X : Fin n → H →L[ℂ] H} {ξ : Fin n → H} + (hξ : ConjugateSystem τ X ξ) (i : Fin n) (p : WordPolynomial n) : + inner ℂ (ξ i) (polynomialVector τ X p) = polynomialDerivative τ X i p := by + simp only [polynomialVector, polynomialDerivative, Finsupp.linearCombination_apply, + Finsupp.sum, inner_sum, inner_smul_right, (hξ i).2, smul_eq_mul] + + theorem polynomialVector_range {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) : + (polynomialVector τ X).range.topologicalClosure = polynomialL2 τ X := by + rw [polynomialVector, Finsupp.range_linearCombination] + rfl + +theorem norm_sq_eq_iSup_dense {H : Type} [NormedAddCommGroup H] + [InnerProductSpace ℂ H] [CompleteSpace H] {ι : Type} (v : ι → H) (ξ : H) + (hξ : ξ ∈ (Submodule.span ℂ (Set.range v)).topologicalClosure) : + ENNReal.ofReal (‖ξ‖ ^ 2) = + ⨆ p : ι →₀ ℂ, ENNReal.ofReal + (2 * (inner ℂ ξ (Finsupp.linearCombination ℂ v p)).re - + ‖Finsupp.linearCombination ℂ v p‖ ^ 2) := by + let Q : H → ℝ := fun z => 2 * (inner ℂ ξ z).re - ‖z‖ ^ 2 + have hQ : Continuous Q := by fun_prop + let b := ⨆ p : ι →₀ ℂ, ENNReal.ofReal (Q (Finsupp.linearCombination ℂ v p)) + change ENNReal.ofReal (‖ξ‖ ^ 2) = b + apply le_antisymm + · have hc : IsClosed {z : H | ENNReal.ofReal (Q z) ≤ b} := + isClosed_le (ENNReal.continuous_ofReal.comp hQ) continuous_const + have hs : (Submodule.span ℂ (Set.range v) : Set H) ⊆ {z | ENNReal.ofReal (Q z) ≤ b} := by + intro z hz + rw [← Finsupp.range_linearCombination] at hz + obtain ⟨p,rfl⟩ := hz + exact le_iSup (fun p : ι →₀ ℂ => ENNReal.ofReal (Q (Finsupp.linearCombination ℂ v p))) p + have hh := hc.closure_subset_iff.mpr hs hξ + have he : Q ξ = ‖ξ‖ ^ 2 := by + have hself : (inner ℂ ξ ξ).re = ‖ξ‖ ^ 2 := (norm_sq_eq_re_inner (𝕜 := ℂ) ξ).symm + dsimp [Q] + rw [hself] + ring + change ENNReal.ofReal (Q ξ) ≤ b at hh + rwa [he] at hh + · refine iSup_le fun p => ENNReal.ofReal_le_ofReal ?_ + have h := norm_sub_sq (𝕜 := ℂ) ξ (Finsupp.linearCombination ℂ v p) + change ‖ξ - Finsupp.linearCombination ℂ v p‖ ^ 2 = + ‖ξ‖ ^ 2 - 2 * (inner ℂ ξ (Finsupp.linearCombination ℂ v p)).re + + ‖Finsupp.linearCombination ℂ v p‖ ^ 2 at h + dsimp [Q] + nlinarith [sq_nonneg ‖ξ - Finsupp.linearCombination ℂ v p‖] + +def fisherTest {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (i : Fin n) (p : WordPolynomial n) : ℝ := + 2 * (polynomialDerivative τ X i p).re - ‖polynomialVector τ X p‖ ^ 2 + + theorem freeFisher_variational {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) {ξ : Fin n → H} + (hξ : ConjugateSystem τ X ξ) : + freeFisher τ X = ∑ i, ⨆ p : WordPolynomial n, ENNReal.ofReal (fisherTest τ X i p) := by + rw [freeFisher_eq_of_conjugate τ hξ, ENNReal.ofReal_sum_of_nonneg (fun i _ => sq_nonneg _)] + apply Finset.sum_congr rfl + intro i _ + have h := norm_sq_eq_iSup_dense (fun w => wordEval X w τ.vacuum) (ξ i) (hξ i).1 + change ENNReal.ofReal (‖ξ i‖ ^ 2) = + ⨆ p : WordPolynomial n, ENNReal.ofReal + (2 * (inner ℂ (ξ i) (polynomialVector τ X p)).re - ‖polynomialVector τ X p‖ ^ 2) at h + simpa only [conjugate_polynomial_pairing τ hξ, fisherTest] using h + + theorem freeFisher_lt_top_iff {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) : + freeFisher τ X < ⊤ ↔ ∃ ξ, ConjugateSystem τ X ξ := by + constructor + · intro h + by_contra! hn + have he : freeFisher τ X = ⊤ := by simp [freeFisher, hn] + rw [he] at h + exact lt_irrefl _ h + · rintro ⟨ξ,hξ⟩ + rw [freeFisher_eq_of_conjugate τ hξ] + exact ENNReal.ofReal_lt_top + + theorem exists_conjugate_of_fisher_le {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (c : ℝ) + (h : freeFisher τ X ≤ ENNReal.ofReal c) : ∃ ξ, ConjugateSystem τ X ξ := + (freeFisher_lt_top_iff τ X).mp (h.trans_lt ENNReal.ofReal_lt_top) + + theorem continuous_wordEval {T : Type u1} [TopologicalSpace T] {n : ℕ} + (X : T → Fin n → H →L[ℂ] H) (hX : ∀ i, Continuous (fun t => X t i)) + (w : List (Fin n)) : Continuous (fun t => wordEval (X t) w) := by + induction w with + | nil => simpa [wordEval] using (continuous_const : Continuous (fun _ : T => (1 : H →L[ℂ] H))) + | cons i w ih => + change Continuous (fun t => X t i * wordEval (X t) w) + exact (hX i).mul ih + + theorem continuous_wordMoment {M : VonNeumannAlgebra H} (τ : TracialVector M) + {T : Type u2} [TopologicalSpace T] {n : ℕ} + (X : T → Fin n → H →L[ℂ] H) (hX : ∀ i, Continuous (fun t => X t i)) + (w : List (Fin n)) : Continuous (fun t => wordMoment τ (X t) w) := by + exact continuous_const.inner ((continuous_wordEval X hX w).clm_apply continuous_const) + + theorem continuous_derivativeMoment {M : VonNeumannAlgebra H} (τ : TracialVector M) + {T : Type u3} [TopologicalSpace T] {n : ℕ} + (X : T → Fin n → H →L[ℂ] H) (hX : ∀ i, Continuous (fun t => X t i)) + (i : Fin n) (w : List (Fin n)) : Continuous (fun t => derivativeMoment τ (X t) i w) := by + unfold derivativeMoment + apply continuous_finsetSum + intro r _ + split_ifs + · exact (continuous_wordMoment τ X hX _).mul (continuous_wordMoment τ X hX _) + · exact continuous_const + + theorem continuous_fisherTest {M : VonNeumannAlgebra H} (τ : TracialVector M) + {T : Type u4} [TopologicalSpace T] {n : ℕ} + (X : T → Fin n → H →L[ℂ] H) (hX : ∀ i, Continuous (fun t => X t i)) + (i : Fin n) (p : WordPolynomial n) : Continuous (fun t => fisherTest τ (X t) i p) := by + have hd : Continuous (fun t => polynomialDerivative τ (X t) i p) := by + simp only [polynomialDerivative, Finsupp.linearCombination_apply, Finsupp.sum] + apply continuous_finsetSum + intro w _ + exact (continuous_const (y := p w)).smul (continuous_derivativeMoment τ X hX i w) + have hv : Continuous (fun t => polynomialVector τ (X t) p) := by + simp only [polynomialVector, Finsupp.linearCombination_apply, Finsupp.sum] + exact continuous_finsetSum _ (fun w _ => continuous_const.smul + ((continuous_wordEval X hX w).clm_apply continuous_const)) + exact (continuous_const.mul (Complex.continuous_re.comp hd)).sub (hv.norm.pow 2) + +theorem lowerSemicontinuous_freeFisher {M : VonNeumannAlgebra H} (τ : TracialVector M) + {T : Type u5} [TopologicalSpace T] {n : ℕ} + (X : T → Fin n → H →L[ℂ] H) (hX : ∀ i, Continuous (fun t => X t i)) + (he : ∀ t, ∃ ξ, ConjugateSystem τ (X t) ξ) : + LowerSemicontinuous (fun t => freeFisher τ (X t)) := by + have heq : (fun t => freeFisher τ (X t)) = + (fun t => ∑ i, ⨆ p : WordPolynomial n, ENNReal.ofReal (fisherTest τ (X t) i p)) := by + funext t + obtain ⟨ξ,hξ⟩ := he t + exact freeFisher_variational τ _ hξ + rw [heq] + apply lowerSemicontinuous_sum + intro i _ + apply lowerSemicontinuous_iSup + intro p + exact (ENNReal.continuous_ofReal.comp (continuous_fisherTest τ X hX i p)).lowerSemicontinuous + +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/FlowSeparation.lean b/lean/OAI/Analysis/FreeEntropy/FlowSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a30b8c190d4d292c64abd954b7ef7bfefa91483 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/FlowSeparation.lean @@ -0,0 +1,50 @@ +import OAI.Analysis.FreeEntropy.ModelFlowLimit + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped Topology ENNReal +namespace FiniteEntropySeparation + def chosenStart (h : ℝ) : ℝ := h/(4*((chosenP+1:ℕ):ℝ)) + theorem chosenStart_pos {h : ℝ} (hh : 0 (variance p i + u)⁻¹) volume a b := by + apply ContinuousOn.intervalIntegrable + apply ContinuousOn.inv₀ (continuous_const.add continuous_id).continuousOn + intro u hu + rw [uIcc_of_le hab] at hu + change variance p i + u ≠ 0 + exact ne_of_gt (by linarith [variance_nonneg p i, hu.1]) +theorem covarianceFisher_intervalIntegrable (a b : ℝ) (ha : 0 < a) (hab : a ≤ b) : + IntervalIntegrable (covarianceFisher p) volume a b := by + change IntervalIntegrable (fun u => ∑ i : Fin (p+1), (variance p i + u)⁻¹) volume a b + simpa only [Finset.sum_fn] using (IntervalIntegrable.sum univ (fun i _ => reciprocal_variance_intervalIntegrable p i a b ha hab)) +theorem covarianceFisher_integral (a b : ℝ) (ha : 0 < a) (hab : a ≤ b) : + (∫ u in a..b, covarianceFisher p u) = + ∑ i : Fin (p+1), (Real.log (b + variance p i) - Real.log (a + variance p i)) := by + unfold covarianceFisher + rw [intervalIntegral.integral_finsetSum (fun i _ => reciprocal_variance_intervalIntegrable p i a b ha hab)] + apply sum_congr rfl + intro i _ + rw [intervalIntegral.integral_comp_add_left (fun u : ℝ => u⁻¹), integral_inv_of_pos + (by linarith [variance_nonneg p i]) (by linarith [variance_nonneg p i]), + Real.log_div (by linarith [variance_nonneg p i] : variance p i+b ≠ 0) + (by linarith [variance_nonneg p i] : variance p i+a ≠ 0)] + simp only [add_comm] +theorem gaussianEntropy_flow (a b : ℝ) (ha : 0 < a) (hab : a ≤ b) : + gaussianEntropy p b - gaussianEntropy p a = + (1/2 : ℝ) * ∫ u in a..b, covarianceFisher p u := by + rw [covarianceFisher_integral p a b ha hab, sum_sub_distrib] + unfold gaussianEntropy + ring +theorem fisherDeficit_intervalIntegrable (hp : 2 ≤ p) (a b : ℝ) (ha : 0 < a) (hab : a ≤ b) : + IntervalIntegrable (fisherDeficit p) volume a b := by + rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hab] + exact (fisherDeficit_tail_integrable p hp a ha).mono_set (fun u hu => hu.1) +theorem heatFisherReal_intervalIntegrable (hp : 2 ≤ p) (a b : ℝ) (ha : 0 < a) (hab : a ≤ b) : + IntervalIntegrable (heatFisherReal p) volume a b := by + have hh := (fisherDeficit_intervalIntegrable p hp a b ha hab).add + (covarianceFisher_intervalIntegrable p a b ha hab) + change IntervalIntegrable (fun x => (freeFisher (τ p) (X p x)).toReal) volume a b + simpa only [fisherDeficit, sub_add_cancel] using hh + +theorem chiStar_flow (hp : 2 ≤ p) (a b : ℝ) (ha : 0 < a) (hab : a ≤ b) : + chiStar (τ p) (X p b) (auxiliaryNoise p) - chiStar (τ p) (X p a) (auxiliaryNoise p) = + (((1/2 : ℝ) * ∫ u in a..b, heatFisherReal p u : ℝ) : EReal) := by + rw [chiStar_tail_formula p hp a ha, chiStar_tail_formula p hp b (lt_of_lt_of_le ha hab), + ← EReal.coe_sub] + congr 1 + have hd := intervalIntegral.integral_Ioi_sub_Ioi (fisherDeficit_tail_integrable p hp a ha) hab + have hg := gaussianEntropy_flow p a b ha hab + have hh : (∫ u in a..b, heatFisherReal p u) = + (∫ u in a..b, fisherDeficit p u) + (∫ u in a..b, covarianceFisher p u) := by + rw [← intervalIntegral.integral_add (fisherDeficit_intervalIntegrable p hp a b ha hab) + (covarianceFisher_intervalIntegrable p a b ha hab)] + apply intervalIntegral.integral_congr + intro u hu + simp only [fisherDeficit, heatFisherReal, sub_add_cancel] + rw [hh] + linarith +end FiniteEntropySeparation.Model + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/FreeMatrixModels.lean b/lean/OAI/Analysis/FreeEntropy/FreeMatrixModels.lean new file mode 100644 index 0000000000000000000000000000000000000000..38b0702897e5117cf45d664900fac8d3ea16999d --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/FreeMatrixModels.lean @@ -0,0 +1,31 @@ +import OAI.Analysis.FreeEntropy.MicrostatesLogLower + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +namespace FiniteEntropySeparation + theorem gueMatrix_isHermitian {n d : ℕ} (x : MatrixIndex n d → ℝ) (i : Fin n) : (gueMatrix x i).IsHermitian := by + change (((Real.sqrt d:ℂ)⁻¹) • hermitianMatrix (WithLp.toLp 2 x) i).IsHermitian + simp only [Matrix.IsHermitian,Matrix.conjTranspose_smul,map_inv₀,Complex.star_def,Complex.conj_ofReal] + rw [show (hermitianMatrix (WithLp.toLp 2 x) i).conjTranspose=hermitianMatrix (WithLp.toLp 2 x) i from hermitianMatrix_isHermitian _ _] + theorem exists_free_matrix_models (n : ℕ) : + ∃ (D : ℕ → ℕ) (A : (k : ℕ) → Fin n → Matrix (Fin (D k)) (Fin (D k)) ℂ), + (∀ k,0 matrixTraceWord (A k) w) atTop (𝓝 (FreeSeries.fockMoments n w)) := by + have hex (k : ℕ) := exists_gue_model n k k (ε := 1/((k:ℝ)+1)) (by positivity) + choose D hD x hx hm using hex + refine ⟨D,fun k => gueMatrix (x k),fun k => lt_of_le_of_lt (Nat.zero_le _) (hD k),?_,hx,fun k i => gueMatrix_isHermitian _ _,?_⟩ + · exact tendsto_atTop_mono (fun k => (hD k).le) tendsto_id + · intro w + rw [tendsto_iff_norm_sub_tendsto_zero] + apply squeeze_zero' (Filter.Eventually.of_forall (fun _ => norm_nonneg _)) _ (tendsto_one_div_add_atTop_nhds_zero_nat) + filter_upwards [eventually_ge_atTop w.length] with k hk + exact (hm k w hk).le +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GUEBounds.lean b/lean/OAI/Analysis/FreeEntropy/GUEBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..17d08e89dfc080c302d35f8b2bd967c29d96ff18 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GUEBounds.lean @@ -0,0 +1,82 @@ +import OAI.Analysis.FreeEntropy.GUEMoments + +namespace OAI + +universe u1 u2 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +open scoped Classical +namespace FiniteEntropySeparation + def jointNoiseBound {n d : ℕ} (R : ℝ) (x : MatrixIndex n d → ℝ) : ℝ := R+∑ i, matrixOpNorm (gueMatrix x i) + def jointMomentBound (n : ℕ) (R : ℝ) : ℕ → ℝ + | 0 => 1 + | m+1 => (n+1:ℝ)^m*(R^(m+1)+(n:ℝ)*gaussianMomentMajorant m) + theorem jointNoiseBound_nonneg {n d : ℕ} {R : ℝ} (hR : 0 ≤ R) (x : MatrixIndex n d → ℝ) : + 0 ≤ jointNoiseBound R x := add_nonneg hR (sum_nonneg (fun _ _ => norm_nonneg _)) + theorem jointNoiseBound_measurable {n d : ℕ} (R : ℝ) : Measurable (jointNoiseBound (n := n) (d := d) R) := + measurable_const.add (Finset.measurable_sum _ (fun i _ => gueMatrix_norm_measurable i)) + theorem jointMatrix_norm_bound {α : Type u1} {n d : ℕ} (A : α → Matrix (Fin d) (Fin d) ℂ) {R : ℝ} (hR : 0 ≤ R) + (hA : ∀ a, matrixOpNorm (A a) ≤ R) (x : MatrixIndex n d → ℝ) (a : α ⊕ Fin n) : + matrixOpNorm (jointMatrix A x a) ≤ jointNoiseBound R x := by + cases a with + | inl a => + change matrixOpNorm (A a) ≤ R + ∑ i, matrixOpNorm (gueMatrix x i) + exact (hA a).trans (le_add_of_nonneg_right (sum_nonneg (fun i _ => matrixOpNorm_nonneg (gueMatrix x i)))) + | inr i => + change matrixOpNorm (gueMatrix x i) ≤ R + ∑ j, matrixOpNorm (gueMatrix x j) + have hl : matrixOpNorm (gueMatrix x i) ≤ ∑ j, matrixOpNorm (gueMatrix x j) := + single_le_sum (fun j _ => matrixOpNorm_nonneg (gueMatrix x j)) (mem_univ i) + exact hl.trans (le_add_of_nonneg_left hR) + theorem jointNoiseBound_power {n d : ℕ} {R : ℝ} (hR : 0 ≤ R) (x : MatrixIndex n d → ℝ) (m : ℕ) : + jointNoiseBound R x^(m+1) ≤ (n+1:ℝ)^m * (R^(m+1)+∑ i, matrixOpNorm (gueMatrix x i)^(m+1)) := by + let f : Option (Fin n) → ℝ := Option.elim' R (fun i => matrixOpNorm (gueMatrix x i)) + have hf : ∀ i ∈ (univ : Finset (Option (Fin n))), 0 ≤ f i := by + intro i _; cases i <;> simp [f,hR,matrixOpNorm_nonneg] + simpa [f, Fintype.sum_option, jointNoiseBound, add_comm] using pow_sum_le_card_mul_sum_pow hf m + theorem jointNoiseBound_moment {n d : ℕ} (hd : 0 < d) {R : ℝ} (hR : 0 ≤ R) (m : ℕ) : + Integrable (fun x => jointNoiseBound R x^m) (productGaussian (MatrixIndex n d)) ∧ + (∫ x, jointNoiseBound R x^m ∂productGaussian (MatrixIndex n d)) ≤ jointMomentBound n R m := by + cases m with + | zero => simp [jointMomentBound] + | succ m => + have hi (i : Fin n) := (gueMatrix_norm_moment hd i m).1 + have hsum : Integrable (fun x => ∑ i : Fin n, matrixOpNorm (gueMatrix x i)^(m+1)) (productGaussian (MatrixIndex n d)) := integrable_finsetSum _ (fun i _ => hi i) + have hbig := ((integrable_const (R^(m+1))).add hsum).const_mul ((n+1:ℝ)^m) + have hsmall : Integrable (fun x : MatrixIndex n d → ℝ => jointNoiseBound R x^(m+1)) (productGaussian (MatrixIndex n d)) := by + apply hbig.mono' ((jointNoiseBound_measurable R).pow_const _).aestronglyMeasurable + exact ae_of_all _ (fun x => by rw [Real.norm_eq_abs, abs_of_nonneg (pow_nonneg (jointNoiseBound_nonneg hR x) _)]; exact jointNoiseBound_power hR x m) + refine ⟨hsmall, ?_⟩ + calc + _ ≤ ∫ x : MatrixIndex n d → ℝ, ((n+1:ℝ)^m)*(R^(m+1)+∑ i, matrixOpNorm (gueMatrix x i)^(m+1)) ∂productGaussian (MatrixIndex n d) := + integral_mono hsmall hbig (fun x => jointNoiseBound_power hR x m) + _ = (n+1:ℝ)^m*(R^(m+1)+∑ i, ∫ x, matrixOpNorm (gueMatrix x i)^(m+1) ∂productGaussian (MatrixIndex n d)) := by + rw [integral_const_mul, integral_add (integrable_const _) hsum, integral_finsetSum _ (fun i _ => hi i)]; simp + _ ≤ _ := by + apply mul_le_mul_of_nonneg_left _ (by positivity) + apply add_le_add_right + calc + _ ≤ ∑ _i : Fin n, gaussianMomentMajorant m := sum_le_sum (fun i _ => (gueMatrix_norm_moment hd i m).2) + _ = _ := by simp + theorem matrixTraceWord_variance_bound {α : Type u2} {n d : ℕ} (hd : 0 < d) + (A : α → Matrix (Fin d) (Fin d) ℂ) {R : ℝ} (hR : 0 ≤ R) (hA : ∀ a, matrixOpNorm (A a) ≤ R) + (w : List (α ⊕ Fin n)) : + (∫ x, ‖matrixTraceWord (jointMatrix A x) w - ∫ y, matrixTraceWord (jointMatrix A y) w ∂productGaussian (MatrixIndex n d)‖^2 ∂productGaussian (MatrixIndex n d)) ≤ + (w.length:ℝ)^2/(d:ℝ)^2 * jointMomentBound n R (2*(w.length-1)) := by + let f := fun x : MatrixIndex n d → ℝ => matrixTraceWord (jointMatrix A x) w + have hf : IsComplexPolynomial f := matrixTraceWord_polynomial A w + have hi (q : MatrixIndex n d) := ((hf.derivative q).norm_sq).integrable + calc + _ ≤ ∑ q, ∫ x, ‖complexCoordinateDerivative f q x‖^2 ∂productGaussian (MatrixIndex n d) := hf.poincare + _ = ∫ x, ∑ q, ‖complexCoordinateDerivative f q x‖^2 ∂productGaussian (MatrixIndex n d) := (integral_finsetSum _ (fun q _ => hi q)).symm + _ ≤ ∫ x, ((w.length:ℝ)^2/(d:ℝ)^2)*jointNoiseBound R x^(2*(w.length-1)) ∂productGaussian (MatrixIndex n d) := by + apply integral_mono (integrable_finsetSum _ (fun q _ => hi q)) ((jointNoiseBound_moment hd hR _).1.const_mul _) + intro x + exact matrixTraceWord_gradient_bound hd A w x (jointNoiseBound_nonneg hR x) (fun a _ => jointMatrix_norm_bound A hR hA x a) + _ = ((w.length:ℝ)^2/(d:ℝ)^2)*(∫ x, jointNoiseBound R x^(2*(w.length-1)) ∂productGaussian (MatrixIndex n d)) := integral_const_mul _ _ + _ ≤ _ := mul_le_mul_of_nonneg_left (jointNoiseBound_moment hd hR _).2 (by positivity) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GUEConcentration.lean b/lean/OAI/Analysis/FreeEntropy/GUEConcentration.lean new file mode 100644 index 0000000000000000000000000000000000000000..71eb3594f00d0b038594d3d9efe8874bc657f31b --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GUEConcentration.lean @@ -0,0 +1,68 @@ +import OAI.Analysis.FreeEntropy.MatrixReparam + +namespace OAI + +universe u1 u2 u3 u4 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Filter +open scoped Classical Topology +namespace FiniteEntropySeparation + theorem complex_mean_square_bound {ι : Type u1} [Fintype ι] [DecidableEq ι] + {f : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (z : ℂ) : + (∫ x, ‖f x-z‖^2 ∂productGaussian ι) ≤ + 2*(∫ x, ‖f x-∫ y, f y ∂productGaussian ι‖^2 ∂productGaussian ι)+2*‖(∫ y, f y ∂productGaussian ι)-z‖^2 := by + let a := ∫ y, f y ∂productGaussian ι + have hg := (hf.sub (IsComplexPolynomial.const a)).norm_sq.integrable + calc + _ ≤ ∫ x, 2*‖f x-a‖^2+2*‖a-z‖^2 ∂productGaussian ι := by + apply integral_mono ((hf.sub (IsComplexPolynomial.const z)).norm_sq.integrable) ((hg.const_mul 2).add (integrable_const _)) + intro x + have ht : ‖f x-z‖ ≤ ‖f x-a‖+‖a-z‖ := by + simpa only [sub_add_sub_cancel] using norm_add_le (f x-a) (a-z) + have hp := pow_le_pow_left₀ (norm_nonneg _) ht 2 + change ‖f x-z‖^2 ≤ 2*‖f x-a‖^2+2*‖a-z‖^2 + nlinarith [sq_nonneg (‖f x-a‖-‖a-z‖)] + _ = _ := by rw [integral_add (hg.const_mul _) (integrable_const _),integral_const_mul]; simp [a] + theorem real_tendsto_zero_of_inv_sq {D : ℕ → ℕ} (hD : Tendsto D atTop atTop) (C : ℝ) : + Tendsto (fun k => C/(D k:ℝ)^2) atTop (𝓝 0) := by + have hc : Tendsto (fun k => (D k:ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp hD + have hi := tendsto_inv_atTop_zero.comp (tendsto_pow_atTop (by norm_num : (2:ℕ) ≠ 0) |>.comp hc) + simpa [div_eq_mul_inv] using tendsto_const_nhds.mul hi + theorem matrixTraceWord_mean_square_tendsto {α : Type u2} {n : ℕ} {D : ℕ → ℕ} + (hD0 : ∀ k,0 expectedMatrixWord A k w) atTop (𝓝 z)) : + Tendsto (fun k => ∫ x, ‖matrixTraceWord (jointMatrix (A k) x) w-z‖^2 ∂productGaussian (MatrixIndex n (D k))) atTop (𝓝 0) := by + have hvar : Tendsto (fun k => ∫ x, ‖matrixTraceWord (jointMatrix (A k) x) w-expectedMatrixWord A k w‖^2 ∂productGaussian (MatrixIndex n (D k))) atTop (𝓝 0) := by + apply squeeze_zero (fun k => integral_nonneg (fun _ => sq_nonneg _)) + (fun k => (matrixTraceWord_variance_bound (hD0 k) (A k) hR (hA k) w).trans_eq (by ring)) + (real_tendsto_zero_of_inv_sq hD ((w.length:ℝ)^2*jointMomentBound n R (2*(w.length-1)))) + have hb : Tendsto (fun k => 2*(∫ x, ‖matrixTraceWord (jointMatrix (A k) x) w-expectedMatrixWord A k w‖^2 ∂productGaussian (MatrixIndex n (D k)))+2*‖expectedMatrixWord A k w-z‖^2) atTop (𝓝 0) := by + have hh := (hvar.const_mul 2).add (((hm.sub_const z).norm.pow 2).const_mul 2) + simpa using hh + exact squeeze_zero (fun k => integral_nonneg (fun _ => sq_nonneg _)) + (fun k => complex_mean_square_bound (matrixTraceWord_polynomial (A k) w) z) hb + theorem probability_error_le_mean_square {Ω : Type u3} [MeasurableSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ] + {f : Ω → ℂ} {z : ℂ} {ε : ℝ} (hε : 0 < ε) (hi : Integrable (fun x => ‖f x-z‖^2) μ) : + μ.real {x | ε ≤ ‖f x-z‖} ≤ (∫ x, ‖f x-z‖^2 ∂μ)/ε^2 := by + have he : {x | ε ≤ ‖f x-z‖} = {x | ε^2 ≤ ‖f x-z‖^2} := by + ext x; simp only [Set.mem_ofPred_eq]; exact (sq_le_sq₀ hε.le (norm_nonneg _)).symm + rw [he] + exact (le_div_iff₀ (sq_pos_of_pos hε)).mpr (by + simpa [mul_comm] using mul_meas_ge_le_integral_of_nonneg (ae_of_all _ (fun x => sq_nonneg ‖f x-z‖)) hi (ε^2)) + theorem matrixTraceWord_probability_tendsto {α : Type u4} {n : ℕ} {D : ℕ → ℕ} + (hD0 : ∀ k,0 expectedMatrixWord A k w) atTop (𝓝 z)) {ε : ℝ} (hε : 0 < ε) : + Tendsto (fun k => (productGaussian (MatrixIndex n (D k))).real {x | ε ≤ ‖matrixTraceWord (jointMatrix (A k) x) w-z‖}) atTop (𝓝 0) := by + apply squeeze_zero (fun k => measureReal_nonneg) + (fun k => probability_error_le_mean_square _ hε ((matrixTraceWord_polynomial (A k) w).sub (IsComplexPolynomial.const z)).norm_sq.integrable) + simpa using (matrixTraceWord_mean_square_tendsto hD0 hD A hR hA w hm).div_const (ε^2) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GUECovariance.lean b/lean/OAI/Analysis/FreeEntropy/GUECovariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6da7c96a71bc669e27159594b0e9ffac5ec2caa --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GUECovariance.lean @@ -0,0 +1,62 @@ +import OAI.Analysis.FreeEntropy.GUEStein + +namespace OAI + +universe u1 u2 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Filter +open scoped Classical Topology +namespace FiniteEntropySeparation + theorem complex_polynomial_covariance {ι : Type u1} [Fintype ι] [DecidableEq ι] + {f g : (ι → ℝ) → ℂ} (hf : IsComplexPolynomial f) (hg : IsComplexPolynomial g) : + ‖(∫ x, f x*g x ∂productGaussian ι)-(∫ x, f x ∂productGaussian ι)*(∫ x, g x ∂productGaussian ι)‖ ≤ + ((∫ x, ‖f x-∫ y, f y ∂productGaussian ι‖^2 ∂productGaussian ι)+ + (∫ x, ‖g x-∫ y, g y ∂productGaussian ι‖^2 ∂productGaussian ι))/2 := by + let a := ∫ x, f x ∂productGaussian ι + let b := ∫ x, g x ∂productGaussian ι + have hf' := hf.sub (IsComplexPolynomial.const a) + have hg' := hg.sub (IsComplexPolynomial.const b) + have he : (∫ x, (f x-a)*(g x-b) ∂productGaussian ι) = (∫ x, f x*g x ∂productGaussian ι)-a*b := by + have heq : (fun x => (f x-a)*(g x-b)) = fun x => f x*g x-f x*b-a*g x+a*b := by funext x; ring + rw [heq, integral_add ((hf.mul hg).sub (hf.mul_const b) |>.sub (hg.const_mul a)).integrable (integrable_const _), + integral_sub ((hf.mul hg).sub (hf.mul_const b)).integrable (hg.const_mul a).integrable, + integral_sub (hf.mul hg).integrable (hf.mul_const b).integrable, + integral_mul_const, integral_const_mul] + simp only [a,b,integral_const,probReal_univ,one_smul] + ring + rw [← he] + calc + _ ≤ ∫ x, ‖(f x-a)*(g x-b)‖ ∂productGaussian ι := norm_integral_le_integral_norm _ + _ ≤ ∫ x, (‖f x-a‖^2+‖g x-b‖^2)/2 ∂productGaussian ι := by + apply integral_mono (hf'.mul hg').integrable.norm (((hf'.norm_sq).add (hg'.norm_sq)).integrable.div_const 2) + intro x + dsimp only + rw [norm_mul] + nlinarith [sq_nonneg (‖f x-a‖-‖g x-b‖)] + _ = _ := by rw [integral_div, integral_add hf'.norm_sq.integrable hg'.norm_sq.integrable] + theorem matrixTraceWord_covariance_bound {α : Type u2} {n d : ℕ} (hd : 0 < d) + (A : α → Matrix (Fin d) (Fin d) ℂ) {R : ℝ} (hR : 0 ≤ R) (hA : ∀ a, matrixOpNorm (A a) ≤ R) + (u v : List (α ⊕ Fin n)) : + ‖(∫ x, matrixTraceWord (jointMatrix A x) u*matrixTraceWord (jointMatrix A x) v ∂productGaussian (MatrixIndex n d))- + (∫ x, matrixTraceWord (jointMatrix A x) u ∂productGaussian (MatrixIndex n d))*(∫ x, matrixTraceWord (jointMatrix A x) v ∂productGaussian (MatrixIndex n d))‖ ≤ + ((u.length:ℝ)^2*jointMomentBound n R (2*(u.length-1))+(v.length:ℝ)^2*jointMomentBound n R (2*(v.length-1)))/(2*(d:ℝ)^2) := by + have h := complex_polynomial_covariance (matrixTraceWord_polynomial A u) (matrixTraceWord_polynomial A v) + have hu := matrixTraceWord_variance_bound hd A hR hA u + have hv := matrixTraceWord_variance_bound hd A hR hA v + calc + _ ≤ _ := h + _ ≤ (((u.length:ℝ)^2/(d:ℝ)^2)*jointMomentBound n R (2*(u.length-1))+((v.length:ℝ)^2/(d:ℝ)^2)*jointMomentBound n R (2*(v.length-1)))/2 := by linarith + _ = _ := by ring + theorem tendsto_zero_of_norm_bound_inv_sq {D : ℕ → ℕ} (hD : Tendsto D atTop atTop) + {f : ℕ → ℂ} {C : ℝ} (hf : ∀ k, ‖f k‖ ≤ C/(D k:ℝ)^2) : Tendsto f atTop (𝓝 0) := by + have ht : Tendsto (fun k => C/(D k:ℝ)^2) atTop (𝓝 0) := by + have hc : Tendsto (fun k => (D k:ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp hD + have hi := tendsto_inv_atTop_zero.comp (tendsto_pow_atTop (by norm_num : (2:ℕ) ≠ 0) |>.comp hc) + simpa [div_eq_mul_inv] using tendsto_const_nhds.mul hi + exact squeeze_zero_norm hf ht +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GUEDerivative.lean b/lean/OAI/Analysis/FreeEntropy/GUEDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec6aee037268427f35090803efe87e2ecc1d4b2a --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GUEDerivative.lean @@ -0,0 +1,57 @@ +import OAI.Analysis.FreeEntropy.GUEOperatorTail + +namespace OAI + +universe u1 + +noncomputable section +open scoped ComplexConjugate Classical +open Finset +namespace FiniteEntropySeparation + variable {α : Type u1} {n d : ℕ} + def jointMatrix (A : α → Matrix (Fin d) (Fin d) ℂ) (x : MatrixIndex n d → ℝ) : α ⊕ Fin n → Matrix (Fin d) (Fin d) ℂ := Sum.elim A (gueMatrix x) + def matrixTraceWord (A : α → Matrix (Fin d) (Fin d) ℂ) (w : List α) : ℂ := (d:ℂ)⁻¹ * Matrix.trace (matrixWord A w) + def noiseDirection (q : MatrixIndex n d) : α ⊕ Fin n → Matrix (Fin d) (Fin d) ℂ := fun a => + if a=Sum.inr q.1 then ((Real.sqrt d : ℂ)⁻¹) • hermitianBasis q.2.1 q.2.2 else 0 + theorem jointMatrix_polynomial (A : α → Matrix (Fin d) (Fin d) ℂ) (a : α ⊕ Fin n) : + IsMatrixPolynomial (fun x : MatrixIndex n d → ℝ => jointMatrix A x a) := by + cases a with + | inl a => exact IsMatrixPolynomial.const (A a) + | inr i => exact (show IsMatrixPolynomial (fun x : MatrixIndex n d → ℝ => coordinateMatrix x i) from fun j k => coordinateMatrix_polynomial i j k).smul _ + theorem jointMatrix_hasDeriv (A : α → Matrix (Fin d) (Fin d) ℂ) (x : MatrixIndex n d → ℝ) (q : MatrixIndex n d) + (a : α ⊕ Fin n) (j k : Fin d) : + HasDerivAt (fun t => jointMatrix A (Function.update x q t) a j k) (noiseDirection (α := α) q a j k) (x q) := by + classical + cases a with + | inl a => simpa [jointMatrix, noiseDirection] using hasDerivAt_const (x q) (A a j k) + | inr i => + have hh := (coordinateMatrix_hasDeriv x q i j k).const_mul ((Real.sqrt d:ℂ)⁻¹) + by_cases h : q.1=i + · simpa [jointMatrix, gueMatrix, noiseDirection, h] using hh + · simpa [jointMatrix, gueMatrix, noiseDirection, h, Ne.symm h] using hh + theorem matrixTraceWord_polynomial (A : α → Matrix (Fin d) (Fin d) ℂ) (w : List (α ⊕ Fin n)) : + IsComplexPolynomial (fun x : MatrixIndex n d → ℝ => matrixTraceWord (jointMatrix A x) w) := + ((IsMatrixPolynomial.word (jointMatrix_polynomial A) w).trace).const_mul _ + theorem matrixTraceWord_derivative (A : α → Matrix (Fin d) (Fin d) ℂ) (w : List (α ⊕ Fin n)) + (q : MatrixIndex n d) (x : MatrixIndex n d → ℝ) : + complexCoordinateDerivative (fun y => matrixTraceWord (jointMatrix A y) w) q x = + ((d:ℂ)⁻¹ * (Real.sqrt d:ℂ)⁻¹) * ∑ r : Fin w.length, + if w[r.val]=Sum.inr q.1 then Matrix.trace (hermitianBasis q.2.1 q.2.2 * cyclicMatrixWord (jointMatrix A x) w r) else 0 := by + classical + have hd := (hasDerivAt_matrixWord_trace (jointMatrix_hasDeriv A x q) w).const_mul ((d:ℂ)⁻¹) + have he := hd.deriv + change complexCoordinateDerivative (fun y => matrixTraceWord (jointMatrix A y) w) q x = _ at he + simp only [Function.update_eq_self] at he + rw [he, matrixWordVariation_trace] + simp only [noiseDirection, cyclicMatrixWord] + rw [mul_assoc] + congr 1 + rw [mul_sum] + apply sum_congr rfl + intro r _ + split_ifs <;> simp [Matrix.trace_smul] +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GUEFock.lean b/lean/OAI/Analysis/FreeEntropy/GUEFock.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b418d520617b14002465b249fd3350271898afc --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GUEFock.lean @@ -0,0 +1,58 @@ +import OAI.Analysis.FreeEntropy.MatrixHeatLimit + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Filter +open scoped Classical Topology +namespace FiniteEntropySeparation +open FreeSeries +variable {n d : ℕ} + theorem matrixTraceWord_gue_map (x : MatrixIndex n d → ℝ) (w : List (Fin n)) : + matrixTraceWord (jointMatrix (fun _ : Empty => (0 : Matrix (Fin d) (Fin d) ℂ)) x) (w.map Sum.inr) = matrixTraceWord (gueMatrix x) w := by + rw [matrixTraceWord_map] + rfl + theorem gueTraceWord_stein_pure (hd : 0 < d) (i : Fin n) (w : List (Fin n)) : + (∫ x, matrixTraceWord (gueMatrix x) (i::w) ∂productGaussian (MatrixIndex n d)) = + ∑ r : Fin w.length, if w[r.val]=i then + ∫ x, matrixTraceWord (gueMatrix x) (w.take r.val)*matrixTraceWord (gueMatrix x) (w.drop (r.val+1)) ∂productGaussian (MatrixIndex n d) else 0 := by + have h := gueTraceWord_stein hd (fun _ : Empty => (0 : Matrix (Fin d) (Fin d) ℂ)) i (w.map Sum.inr) + have he : Sum.inr i::w.map (Sum.inr (α := Empty)) = (i::w).map Sum.inr := rfl + rw [he] at h + simp only [matrixTraceWord_gue_map] at h + rw [h] + apply Fintype.sum_equiv (finCongr (List.length_map (as := w) (Sum.inr (α := Empty)))) + intro r + simp only [finCongr_apply,Fin.val_cast,List.getElem_map,Sum.inr.injEq,← List.map_take,← List.map_drop,matrixTraceWord_gue_map] + theorem gueTraceWord_expected_tendsto {D : ℕ → ℕ} (hD0 : ∀ k,0 ∫ x, matrixTraceWord (gueMatrix x) w ∂productGaussian (MatrixIndex n (D k))) atTop (𝓝 (fockMoments n w)) := by + induction w using FreeSeries.length_induction with + | h w ih => + cases w with + | nil => + have he (k : ℕ) (x : MatrixIndex n (D k) → ℝ) : matrixTraceWord (gueMatrix x) [] = 1 := by + simp [matrixTraceWord,matrixWord,ne_of_gt (hD0 k)] + simp [he,fockMoments] + | cons i w => + have hf : fockMoments n (i::w) = ∑ r : Fin w.length, if w[r.val]=i then fockMoments n (w.take r.val)*fockMoments n (w.drop (r.val+1)) else 0 := + Fock.semicircular_integration_by_parts i w + simp only [gueTraceWord_stein_pure (hD0 _), hf] + apply tendsto_finsetSum + intro r _ + split_ifs with hr + · have hc := matrixTraceWord_covariance_tendsto hD0 hD (fun k (_ : Empty) => (0 : Matrix (Fin (D k)) (Fin (D k)) ℂ)) (R := 0) le_rfl (by intro k a; exact a.elim) ((w.take r.val).map Sum.inr) ((w.drop (r.val+1)).map Sum.inr) + simp only [matrixTraceWord_gue_map,expectedMatrixWord] at hc + apply tendsto_of_sub_zero hc + exact (ih (w.take r.val) (by simp)).mul (ih (w.drop (r.val+1)) (by simp)) + · exact tendsto_const_nhds + theorem gueTraceWord_probability_tendsto {D : ℕ → ℕ} (hD0 : ∀ k,0 (productGaussian (MatrixIndex n (D k))).real {x | ε ≤ ‖matrixTraceWord (gueMatrix x) w-fockMoments n w‖}) atTop (𝓝 0) := by + have hm : Tendsto (fun k => expectedMatrixWord (fun k (_ : Empty) => (0 : Matrix (Fin (D k)) (Fin (D k)) ℂ)) k (w.map Sum.inr)) atTop (𝓝 (fockMoments n w)) := by + simpa only [expectedMatrixWord,matrixTraceWord_gue_map] using gueTraceWord_expected_tendsto hD0 hD w + simpa only [matrixTraceWord_gue_map] using matrixTraceWord_probability_tendsto hD0 hD _ (R := 0) le_rfl (by intro k a; exact a.elim) (w.map Sum.inr) hm hε +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GUEFreeLaw.lean b/lean/OAI/Analysis/FreeEntropy/GUEFreeLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e4754889b3703286d48219bbd2648f1b576bfb0 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GUEFreeLaw.lean @@ -0,0 +1,67 @@ +import OAI.Analysis.FreeEntropy.GaussianL2Limit + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Filter +open scoped Classical Topology +namespace FiniteEntropySeparation +open FreeSeries +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] +variable {n : ℕ} +def sumJointMoment (X : Fin n → Space B N G →L[ℂ] Space B N G) (σ : Fin n → N) + (w : List (Fin n ⊕ Fin n)) : ℂ := + wordMoment (tracialVector B N G) (jointTuple X σ) (w.map finSumFinEquiv) + theorem sumJointMoment_cyclic (J : Set N) (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ i, X i ∈ backgroundAlgebra J) (σ : Fin n → N) (u v : List (Fin n ⊕ Fin n)) : + sumJointMoment X σ (u++v)=sumJointMoment X σ (v++u) := by + simp only [sumJointMoment,List.map_append] + exact (wordMoment_cyclic (tracialVector B N G) _ (jointTuple_mem J X hX σ)).append _ _ + theorem sumJointMoment_left (X : Fin n → Space B N G →L[ℂ] Space B N G) (σ : Fin n → N) (u : List (Fin n)) : + sumJointMoment X σ (u.map Sum.inl)=wordMoment (tracialVector B N G) X u := by + simp only [sumJointMoment,wordMoment,wordEval,List.map_map] + congr 3 + funext i + exact jointTuple_left X σ i + theorem sumJointMoment_noise (J : Set N) (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ i, X i ∈ backgroundAlgebra J) (σ : Fin n → N) (hσ : Function.Injective σ) + (hs : ∀ i, σ i ∉ J) (i : Fin n) (w : List (Fin n ⊕ Fin n)) : + sumJointMoment X σ (Sum.inr i::w)= ∑ r : Fin w.length, + if w[r.val]=Sum.inr i then sumJointMoment X σ (w.take r.val)*sumJointMoment X σ (w.drop (r.val+1)) else 0 := by + have h := congrFun (jointTuple_noise_deriv J X hX σ hσ hs i) (w.map finSumFinEquiv) + rw [← derivativeMoment_series] at h + change wordMoment (tracialVector B N G) (jointTuple X σ) (rightIndex i::w.map finSumFinEquiv)=_ at h + change wordMoment (tracialVector B N G) (jointTuple X σ) (rightIndex i::w.map finSumFinEquiv) = _ + rw [h] + dsimp only + simp only [derivativeMoment] + apply Fintype.sum_equiv (finCongr (List.length_map (as := w) finSumFinEquiv)) + intro r + simp only [finCongr_apply, Fin.val_cast, List.getElem_map, ← List.map_take, ← List.map_drop] + have he : finSumFinEquiv w[r.val] = rightIndex i ↔ w[r.val]=Sum.inr i := + by change finSumFinEquiv w[r.val] = finSumFinEquiv (Sum.inr i) ↔ _; exact finSumFinEquiv.injective.eq_iff + simp only [he,sumJointMoment] + theorem expectedMatrixWord_free_tendsto {D : ℕ → ℕ} (hD0 : ∀ k,0 matrixTraceWord (A k) u) atTop (𝓝 (wordMoment (tracialVector B N G) X u))) + (w : List (Fin n ⊕ Fin n)) : + Tendsto (fun k => expectedMatrixWord A k w) atTop (𝓝 (sumJointMoment X σ w)) := by + apply expectedMatrixWord_tendsto hD0 hD A hR hA _ (sumJointMoment_cyclic J X hX σ) + · intro u + simpa only [sumJointMoment_left] using hbase u + · intro i v + classical + exact (sumJointMoment_noise J X hX σ hσ hs i v).trans (by + apply sum_congr rfl + intro r _ + split_ifs <;> rfl) +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GUEGradient.lean b/lean/OAI/Analysis/FreeEntropy/GUEGradient.lean new file mode 100644 index 0000000000000000000000000000000000000000..f530b214ec82af04815e4c4b25f55912bf9942ad --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GUEGradient.lean @@ -0,0 +1,54 @@ +import OAI.Analysis.FreeEntropy.GUEDerivative + +namespace OAI + +universe u1 u2 u3 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +open scoped Classical +namespace FiniteEntropySeparation + theorem norm_sum_sq_le {ι : Type u1} (s : Finset ι) (f : ι → ℂ) : + ‖∑ i ∈ s, f i‖^2 ≤ (s.card:ℝ)*∑ i ∈ s, ‖f i‖^2 := by + exact (pow_le_pow_left₀ (norm_nonneg _) (norm_sum_le s f) 2).trans (sq_sum_le_card_mul_sum_sq (s := s) (f := fun i => ‖f i‖)) + theorem basisNoise_trace_bound {α : Type u2} {n d : ℕ} (a : α ⊕ Fin n) (D : Matrix (Fin d) (Fin d) ℂ) : + (∑ q : MatrixIndex n d, ‖(if a=Sum.inr q.1 then Matrix.trace (hermitianBasis q.2.1 q.2.2*D) else 0 : ℂ)‖^2) ≤ + (d:ℝ)*matrixOpNorm D^2 := by + cases a with + | inl a => simp; positivity + | inr i => + simpa [Fintype.sum_prod_type, apply_ite, sum_ite_irrel, sum_ite_eq] using hermitianBasis_trace_bound D + theorem matrixTraceWord_gradient_bound {α : Type u3} {n d : ℕ} (hd : 0 < d) + (A : α → Matrix (Fin d) (Fin d) ℂ) (w : List (α ⊕ Fin n)) + (x : MatrixIndex n d → ℝ) {K : ℝ} (hK : 0 ≤ K) (hA : ∀ i ∈ w, matrixOpNorm (jointMatrix A x i) ≤ K) : + (∑ q, ‖complexCoordinateDerivative (fun y => matrixTraceWord (jointMatrix A y) w) q x‖^2) ≤ + (w.length:ℝ)^2/(d:ℝ)^2 * K^(2*(w.length-1)) := by + have hd' : (d:ℝ) ≠ 0 := by exact_mod_cast Nat.ne_of_gt hd + have hc : ‖((d:ℂ)⁻¹*(Real.sqrt d:ℂ)⁻¹)‖^2 = (d:ℝ)⁻¹^3 := by + simp only [norm_mul, mul_pow, norm_inv, Complex.norm_natCast, Complex.norm_real, + Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _), inv_pow, Real.sq_sqrt (Nat.cast_nonneg _)] + field_simp + simp only [norm_mul, mul_pow] at hc + simp_rw [matrixTraceWord_derivative, norm_mul, mul_pow, hc] + rw [← mul_sum] + calc + _ ≤ (d:ℝ)⁻¹^3 * ∑ q : MatrixIndex n d, (w.length:ℝ)*∑ r : Fin w.length, + ‖(if w[r.val]=Sum.inr q.1 then Matrix.trace (hermitianBasis q.2.1 q.2.2*cyclicMatrixWord (jointMatrix A x) w r) else 0 : ℂ)‖^2 := by + apply mul_le_mul_of_nonneg_left _ (by positivity) + apply sum_le_sum + intro q _ + simpa using norm_sum_sq_le univ (fun r : Fin w.length => if w[r.val]=Sum.inr q.1 then Matrix.trace (hermitianBasis q.2.1 q.2.2*cyclicMatrixWord (jointMatrix A x) w r) else 0) + _ = (d:ℝ)⁻¹^3 * ((w.length:ℝ)*∑ r : Fin w.length, ∑ q : MatrixIndex n d, + ‖(if w[r.val]=Sum.inr q.1 then Matrix.trace (hermitianBasis q.2.1 q.2.2*cyclicMatrixWord (jointMatrix A x) w r) else 0 : ℂ)‖^2) := by rw [← mul_sum, sum_comm] + _ ≤ (d:ℝ)⁻¹^3 * ((w.length:ℝ)*∑ _r : Fin w.length, (d:ℝ)*(K^(w.length-1))^2) := by + gcongr with r + exact (basisNoise_trace_bound _ _).trans (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (matrixOpNorm_nonneg _) (cyclicMatrixWord_bound _ _ _ hK hA) 2) (Nat.cast_nonneg _)) + _ = _ := by + simp only [sum_const, card_fin, nsmul_eq_mul, ← pow_mul] + rw [Nat.mul_comm (w.length-1) 2] + field_simp +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GUELimit.lean b/lean/OAI/Analysis/FreeEntropy/GUELimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2232d67826d0ea5554afe92d71fe04e743c43ac --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GUELimit.lean @@ -0,0 +1,76 @@ +import OAI.Analysis.FreeEntropy.GUECovariance + +namespace OAI + +universe u1 u2 u3 u4 u5 u6 u7 u8 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Filter +open scoped Classical Topology +namespace FiniteEntropySeparation + theorem matrixTraceWord_cyclic {α : Type u1} {d : ℕ} (A : α → Matrix (Fin d) (Fin d) ℂ) (u v : List α) : + matrixTraceWord A (u++v) = matrixTraceWord A (v++u) := by + simp only [matrixTraceWord, matrixWord_append] + rw [Matrix.trace_mul_comm] + theorem matrixWord_map {α : Type u2} {β : Type u3} {d : ℕ} (A : β → Matrix (Fin d) (Fin d) ℂ) (f : α → β) (w : List α) : + matrixWord A (w.map f) = matrixWord (A ∘ f) w := by simp [matrixWord,List.map_map] + theorem matrixTraceWord_map {α : Type u4} {β : Type u5} {d : ℕ} (A : β → Matrix (Fin d) (Fin d) ℂ) (f : α → β) (w : List α) : + matrixTraceWord A (w.map f) = matrixTraceWord (A ∘ f) w := by simp [matrixTraceWord,matrixWord_map] + theorem sum_word_left_or_noise {α : Type u6} {β : Type u7} (w : List (α ⊕ β)) : + (∃ u : List α, w=u.map Sum.inl) ∨ (∃ u i v, w=u++Sum.inr i::v) := by + induction w with + | nil => exact Or.inl ⟨[],rfl⟩ + | cons a w ih => + cases a with + | inl a => + rcases ih with ⟨u,rfl⟩ | ⟨u,i,v,rfl⟩ + · exact Or.inl ⟨a::u,rfl⟩ + · exact Or.inr ⟨Sum.inl a::u,i,v,rfl⟩ + | inr i => exact Or.inr ⟨[],i,w,rfl⟩ + theorem tendsto_of_sub_zero {f g : ℕ → ℂ} {z : ℂ} (hfg : Tendsto (fun k => f k-g k) atTop (𝓝 0)) + (hg : Tendsto g atTop (𝓝 z)) : Tendsto f atTop (𝓝 z) := by + simpa only [sub_add_cancel, zero_add] using hfg.add hg + variable {α : Type u8} {n : ℕ} {D : ℕ → ℕ} + def expectedMatrixWord (A : (k : ℕ) → α → Matrix (Fin (D k)) (Fin (D k)) ℂ) (k : ℕ) (w : List (α ⊕ Fin n)) : ℂ := + ∫ x, matrixTraceWord (jointMatrix (A k) x) w ∂productGaussian (MatrixIndex n (D k)) + theorem matrixTraceWord_covariance_tendsto (hD0 : ∀ k, 0 < D k) (hD : Tendsto D atTop atTop) + (A : (k : ℕ) → α → Matrix (Fin (D k)) (Fin (D k)) ℂ) {R : ℝ} (hR : 0 ≤ R) + (hA : ∀ k a, matrixOpNorm (A k a) ≤ R) (u v : List (α ⊕ Fin n)) : + Tendsto (fun k => (∫ x, matrixTraceWord (jointMatrix (A k) x) u*matrixTraceWord (jointMatrix (A k) x) v ∂productGaussian (MatrixIndex n (D k)))- + expectedMatrixWord A k u*expectedMatrixWord A k v) atTop (𝓝 0) := by + apply tendsto_zero_of_norm_bound_inv_sq hD (C := ((u.length:ℝ)^2*jointMomentBound n R (2*(u.length-1))+(v.length:ℝ)^2*jointMomentBound n R (2*(v.length-1)))/2) + intro k + convert matrixTraceWord_covariance_bound (hD0 k) (A k) hR (hA k) u v using 1 + · rfl + · ring + theorem expectedMatrixWord_tendsto (hD0 : ∀ k, 0 < D k) (hD : Tendsto D atTop atTop) + (A : (k : ℕ) → α → Matrix (Fin (D k)) (Fin (D k)) ℂ) {R : ℝ} (hR : 0 ≤ R) + (hA : ∀ k a, matrixOpNorm (A k a) ≤ R) (M : List (α ⊕ Fin n) → ℂ) + (hcyclic : ∀ u v, M (u++v)=M (v++u)) + (hbase : ∀ u : List α, Tendsto (fun k => matrixTraceWord (A k) u) atTop (𝓝 (M (u.map Sum.inl)))) + (hrec : ∀ (i : Fin n) (w : List (α ⊕ Fin n)), M (Sum.inr i::w) = + ∑ r : Fin w.length, if w[r.val]=Sum.inr i then M (w.take r.val)*M (w.drop (r.val+1)) else 0) + (w : List (α ⊕ Fin n)) : Tendsto (fun k => expectedMatrixWord A k w) atTop (𝓝 (M w)) := by + induction w using (measure List.length).wf.induction with + | h w ih => + rcases sum_word_left_or_noise w with ⟨u,rfl⟩ | ⟨u,i,v,rfl⟩ + · simpa [expectedMatrixWord,matrixTraceWord_map,jointMatrix,Function.comp_def] using hbase u + · have hrecLimit : Tendsto (fun k => expectedMatrixWord A k (Sum.inr i::(v++u))) atTop (𝓝 (M (Sum.inr i::(v++u)))) := by + simp only [expectedMatrixWord, gueTraceWord_stein (hD0 _), hrec] + apply tendsto_finsetSum + intro r _ + split_ifs with hr + · apply tendsto_of_sub_zero (matrixTraceWord_covariance_tendsto hD0 hD A hR hA _ _) + apply Tendsto.mul + · exact ih ((v++u).take r.val) (by change ((v++u).take r.val).length < (u++Sum.inr i::v).length; have hh:=r.isLt; simp only [List.length_take,List.length_append,List.length_cons] at *; omega) + · exact ih ((v++u).drop (r.val+1)) (by change ((v++u).drop (r.val+1)).length < (u++Sum.inr i::v).length; simp only [List.length_drop,List.length_append,List.length_cons]; omega) + · exact tendsto_const_nhds + convert hrecLimit using 1 + · funext k + exact congrArg (fun f => ∫ x, f x ∂productGaussian (MatrixIndex n (D k))) (funext (fun x => matrixTraceWord_cyclic (jointMatrix (A k) x) u (Sum.inr i::v))) + · exact congrArg (fun z : ℂ => 𝓝 z) (hcyclic u (Sum.inr i::v)) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GUEMoments.lean b/lean/OAI/Analysis/FreeEntropy/GUEMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f636bc59c38b235616e2c225c74877cad9e307f --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GUEMoments.lean @@ -0,0 +1,106 @@ +import OAI.Analysis.FreeEntropy.GUEGradient + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Set +open scoped ENNReal +namespace FiniteEntropySeparation + theorem gueMatrix_norm_tail_uniform {n d : ℕ} (hd : 0 < d) (i : Fin n) {L : ℝ} (hL : 0 ≤ L) : + (productGaussian (MatrixIndex n d)).real {x | L < matrixOpNorm (gueMatrix x i)} ≤ + (4*Real.exp 64)*Real.exp (-L^2/64) := by + have hd1 : (1:ℝ) ≤ d := by exact_mod_cast hd + by_cases hlarge : 64 ≤ L + · have hlog : 4*Real.log 9 ≤ L^2/64 := by + have hh := Real.log_le_sub_one_of_pos (by norm_num : (0:ℝ)<9) + nlinarith [sq_nonneg (L-64)] + have he : (4*(d:ℝ))*Real.log 9 - (d:ℝ)*L^2/32 ≤ -L^2/64 := by + calc + _ = (d:ℝ)*(4*Real.log 9-L^2/32) := by ring + _ ≤ (d:ℝ)*(-L^2/64) := mul_le_mul_of_nonneg_left (by linarith) (Nat.cast_nonneg _) + _ ≤ _ := by nlinarith [mul_nonneg (sub_nonneg.mpr hd1) (sq_nonneg L)] + calc + _ ≤ 4*9^(4*d)*Real.exp (-((d:ℝ)*L^2)/32) := gueMatrix_norm_tail hd i hL + _ = 4*Real.exp ((4*(d:ℝ))*Real.log 9 - (d:ℝ)*L^2/32) := by + rw [show (9:ℝ)^(4*d)=Real.exp ((4*(d:ℝ))*Real.log 9) by rw [show 4*(d:ℝ)=((4*d:ℕ):ℝ) by push_cast; rfl, Real.exp_nat_mul, Real.exp_log (by norm_num : (0:ℝ)<9)]] + rw [mul_assoc, ← Real.exp_add]; congr 2; ring + _ ≤ 4*Real.exp (-L^2/64) := by gcongr + _ ≤ _ := by + have hh : 1 ≤ Real.exp (64:ℝ) := by simp + nlinarith [Real.exp_pos (-L^2/64)] + · have hL2 : L^2/64 ≤ 64 := by nlinarith + have hh : 1 ≤ Real.exp 64*Real.exp (-L^2/64) := by + rw [← Real.exp_add]; simpa using Real.exp_le_exp.mpr (show 0 ≤ 64 + -L^2/64 by linarith) + exact (measureReal_le_one).trans (by nlinarith) + theorem gueMatrix_norm_measurable {n d : ℕ} (i : Fin n) : + Measurable (fun x : MatrixIndex n d → ℝ => matrixOpNorm (gueMatrix x i)) := by + unfold gueMatrix + apply (matrixOpNorm_continuous.comp ?_).measurable + exact (continuous_const (y := (Real.sqrt d:ℂ)⁻¹)).smul (show Continuous (fun x : MatrixIndex n d → ℝ => coordinateMatrix x i) from + continuous_pi (fun j => continuous_pi (fun k => (coordinateMatrix_polynomial i j k).continuous))) + def gaussianMomentMajorant (m : ℕ) : ℝ := + (4*Real.exp 64)*(m+1)*∫ t : ℝ in Ioi 0, t^m*Real.exp (-t^2/64) + theorem gaussianMomentMajorant_nonneg (m : ℕ) : 0 ≤ gaussianMomentMajorant m := by + apply mul_nonneg (by positivity) + apply integral_nonneg_of_ae + filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht + have ht0 : 0 ≤ t := le_of_lt ht + positivity + theorem tail_power_integral {Ω : Type u1} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] + {Z : Ω → ℝ} (hZ : Measurable Z) (hZ0 : ∀ x, 0 ≤ Z x) + (htail : ∀ t ≥ 0, μ.real {x | t < Z x} ≤ (4*Real.exp 64)*Real.exp (-t^2/64)) (m : ℕ) : + Integrable (fun x => Z x^(m+1)) μ ∧ (∫ x, Z x^(m+1) ∂μ) ≤ gaussianMomentMajorant m := by + have hi : IntegrableOn (fun t : ℝ => t^m*Real.exp (-t^2/64)) (Ioi 0) := by + convert integrableOn_rpow_mul_exp_neg_mul_sq (b := (1:ℝ)/64) (by norm_num) (s := (m:ℝ)) (by have := Nat.cast_nonneg (α := ℝ) m; linarith) using 1 + simp only [Real.rpow_natCast] + funext t + congr 1 + congr 1 + ring + have hi' := hi.const_mul ((4*Real.exp 64)*(m+1)) + have hpos : 0 ≤ᵐ[volume.restrict (Ioi 0)] (fun t : ℝ => ((4*Real.exp 64)*(m+1))*(t^m*Real.exp (-t^2/64))) := by + filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht + have ht0 : 0 ≤ t := le_of_lt ht + positivity + have hbound : (∫⁻ x, ENNReal.ofReal (Z x^(m+1)) ∂μ) ≤ ENNReal.ofReal (gaussianMomentMajorant m) := by + have he := lintegral_rpow_eq_lintegral_meas_lt_mul μ (ae_of_all _ hZ0) hZ.aemeasurable (p := (m+1:ℕ)) (by positivity) + simp only [Real.rpow_natCast] at he + simp only [Nat.cast_add, Nat.cast_one, add_sub_cancel_right] at he + rw [he] + calc + _ ≤ ENNReal.ofReal ((m:ℝ)+1) * ∫⁻ t : ℝ in Ioi 0, + ENNReal.ofReal ((4*Real.exp 64)*Real.exp (-t^2/64))*ENNReal.ofReal (t^(m:ℝ)) := by + apply mul_le_mul' le_rfl + apply lintegral_mono_ae + filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht + apply mul_le_mul' _ le_rfl + rw [← ENNReal.ofReal_toReal (measure_ne_top μ _)] + exact ENNReal.ofReal_le_ofReal (htail t ht.le) + _ = ENNReal.ofReal (gaussianMomentMajorant m) := by + rw [← lintegral_const_mul' _ _ ENNReal.ofReal_ne_top] + simp only [Real.rpow_natCast] + simp only [← ENNReal.ofReal_mul (by positivity : 0 ≤ (4:ℝ)*Real.exp 64*Real.exp _)] + simp only [← ENNReal.ofReal_mul (by positivity : 0 ≤ (m:ℝ)+1)] + have heq : ∀ t : ℝ, ((m:ℝ)+1)*((4*Real.exp 64*Real.exp (-t^2/64))*t^m) = + ((4*Real.exp 64)*(m+1))*(t^m*Real.exp (-t^2/64)) := by intro t; ring + simp_rw [heq] + rw [ ← ofReal_integral_eq_lintegral_ofReal hi' hpos] + congr 1 + exact integral_const_mul _ _ + have hint : Integrable (fun x => Z x^(m+1)) μ := ⟨(hZ.pow_const _).aestronglyMeasurable, + (hasFiniteIntegral_iff_ofReal (ae_of_all _ (fun x => pow_nonneg (hZ0 x) _))).mpr (hbound.trans_lt ENNReal.ofReal_lt_top)⟩ + refine ⟨hint, ?_⟩ + have hnn : 0 ≤ ∫ x, Z x^(m+1) ∂μ := integral_nonneg (fun x => pow_nonneg (hZ0 x) _) + rw [← ofReal_integral_eq_lintegral_ofReal hint (ae_of_all _ (fun x => pow_nonneg (hZ0 x) _))] at hbound + exact (ENNReal.ofReal_le_ofReal_iff (gaussianMomentMajorant_nonneg m)).mp hbound + theorem gueMatrix_norm_moment {n d : ℕ} (hd : 0 < d) (i : Fin n) (m : ℕ) : + Integrable (fun x => matrixOpNorm (gueMatrix x i)^(m+1)) (productGaussian (MatrixIndex n d)) ∧ + (∫ x, matrixOpNorm (gueMatrix x i)^(m+1) ∂productGaussian (MatrixIndex n d)) ≤ gaussianMomentMajorant m := + tail_power_integral _ (gueMatrix_norm_measurable i) (fun _ => norm_nonneg _) (fun _ ht => gueMatrix_norm_tail_uniform hd i ht) m +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GUEOperatorTail.lean b/lean/OAI/Analysis/FreeEntropy/GUEOperatorTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..15542d455a05808b38b1ea02fca5e103b340cfa2 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GUEOperatorTail.lean @@ -0,0 +1,61 @@ +import OAI.Analysis.FreeEntropy.BilinearNet + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Set Metric +namespace FiniteEntropySeparation + def gueMatrix {n d : ℕ} (x : MatrixIndex n d → ℝ) (i : Fin n) : Matrix (Fin d) (Fin d) ℂ := + ((Real.sqrt d : ℂ)⁻¹) • coordinateMatrix x i + theorem coordinateMatrix_norm_tail {n d : ℕ} (i : Fin n) {u : ℝ} (hu : 0 ≤ u) : + (productGaussian (MatrixIndex n d)).real {x | 2*u < matrixOpNorm (coordinateMatrix x i)} ≤ + 4*9^(4*d)*Real.exp (-u^2/8) := by + classical + obtain ⟨s,hs,hcov,hcard⟩ := sphere_finite_net (E := EuclideanSpace ℂ (Fin d)) + have hdim : Module.finrank ℝ (EuclideanSpace ℂ (Fin d)) = 2*d := by + rw [← Module.finrank_mul_finrank ℝ ℂ, Complex.finrank_real_complex, finrank_euclideanSpace_fin] + rw [hdim] at hcard + let E : EuclideanSpace ℂ (Fin d) × EuclideanSpace ℂ (Fin d) → Set (MatrixIndex n d → ℝ) := + fun q => {x | u ≤ ‖matrixBilinear q.1 q.2 (coordinateMatrix x i)‖} + have hsub : {x | 2*u < matrixOpNorm (coordinateMatrix x i)} ⊆ ⋃ q ∈ s ×ˢ s, E q := by + intro x hx + by_contra hh + have hall : ∀ v ∈ s, ∀ w ∈ s, ‖matrixBilinear v w (coordinateMatrix x i)‖ ≤ u := by + intro v hv w hw + have hn : x ∉ E (v,w) := fun h => hh (mem_iUnion₂.mpr ⟨(v,w), mem_product.mpr ⟨hv,hw⟩, h⟩) + exact (not_le.mp hn).le + have hb := bilinear_net_bound (matrixOperator (coordinateMatrix x i)) s hs hcov hu hall + exact (not_lt_of_ge hb) hx + calc + _ ≤ (productGaussian (MatrixIndex n d)).real (⋃ q ∈ s ×ˢ s, E q) := measureReal_mono hsub (measure_ne_top _ _) + _ ≤ ∑ q ∈ s ×ˢ s, (productGaussian (MatrixIndex n d)).real (E q) := measureReal_biUnion_finset_le _ _ + _ ≤ ∑ _q ∈ s ×ˢ s, 4*Real.exp (-u^2/8) := by + apply sum_le_sum + intro q hq + exact matrixBilinear_gaussian_tail i q.1 q.2 (hs _ (mem_product.mp hq).1) (hs _ (mem_product.mp hq).2) hu + _ = (s.card:ℝ)^2*(4*Real.exp (-u^2/8)) := by simp [sq] + _ ≤ (9^(2*d))^2*(4*Real.exp (-u^2/8)) := mul_le_mul_of_nonneg_right (pow_le_pow_left₀ (Nat.cast_nonneg _) hcard 2) (by positivity) + _ = _ := by rw [← pow_mul, show 2*d*2=4*d by omega]; ring + theorem gueMatrix_norm {n d : ℕ} (x : MatrixIndex n d → ℝ) (i : Fin n) : + matrixOpNorm (gueMatrix x i) = (Real.sqrt d)⁻¹ * matrixOpNorm (coordinateMatrix x i) := by + rw [gueMatrix, matrixOpNorm_smul, norm_inv, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _)] + theorem gueMatrix_norm_tail {n d : ℕ} (hd : 0 < d) (i : Fin n) {L : ℝ} (hL : 0 ≤ L) : + (productGaussian (MatrixIndex n d)).real {x | L < matrixOpNorm (gueMatrix x i)} ≤ + 4*9^(4*d)*Real.exp (-((d:ℝ)*L^2)/32) := by + have hd' : 0 < (d:ℝ) := by exact_mod_cast hd + have hs : 0 < Real.sqrt d := Real.sqrt_pos.mpr hd' + have he : {x : MatrixIndex n d → ℝ | L < matrixOpNorm (gueMatrix x i)} = + {x | 2*(L*Real.sqrt d/2) < matrixOpNorm (coordinateMatrix x i)} := by + ext x + simp only [mem_ofPred_eq, gueMatrix_norm, ← div_eq_inv_mul, lt_div_iff₀ hs] + ring_nf + rw [he] + convert coordinateMatrix_norm_tail i (u := L*Real.sqrt d/2) (by positivity) using 1 + congr 2 + rw [div_pow, mul_pow, Real.sq_sqrt hd'.le] + ring +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GUESelection.lean b/lean/OAI/Analysis/FreeEntropy/GUESelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..04b1dc937d6ad69bc3f0e57d91a85ed053647954 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GUESelection.lean @@ -0,0 +1,64 @@ +import OAI.Analysis.FreeEntropy.GUEFock + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Filter Set +open scoped Classical Topology +namespace FiniteEntropySeparation + theorem gueMatrix_norm_tail64 {n d : ℕ} (hd : 0 (productGaussian (MatrixIndex n (D k))).real {x | 64 < matrixOpNorm (gueMatrix x i)}) atTop (𝓝 0) := by + apply squeeze_zero (fun _ => measureReal_nonneg) (fun k => gueMatrix_norm_tail64 (hD0 k) i) + have ht : Tendsto (fun k => (64:ℝ)*(D k:ℝ)) atTop atTop := (tendsto_natCast_atTop_atTop.comp hD).const_mul_atTop (by norm_num) + simpa only [neg_mul, mul_zero,Function.comp_def] using (Real.tendsto_exp_neg_atTop_nhds_zero.comp ht).const_mul 4 + def gueBad (n m d : ℕ) (ε : ℝ) : Set (MatrixIndex n d → ℝ) := + {x | (∃ i,64 < matrixOpNorm (gueMatrix x i)) ∨ ∃ w : List (Fin n), w.length ≤ m ∧ ε ≤ ‖matrixTraceWord (gueMatrix x) w-FreeSeries.fockMoments n w‖} + theorem gueBad_probability_tendsto (n m : ℕ) {ε : ℝ} (hε : 0<ε) : + Tendsto (fun k => (productGaussian (MatrixIndex n (k+1))).real (gueBad n m (k+1) ε)) atTop (𝓝 0) := by + let W := (List.finite_length_le (Fin n) m).toFinset + have hD : Tendsto (fun k : ℕ => k+1) atTop atTop := tendsto_add_atTop_nat 1 + have hn : Tendsto (fun k => ∑ i : Fin n, (productGaussian (MatrixIndex n (k+1))).real {x | 64 < matrixOpNorm (gueMatrix x i)}) atTop (𝓝 0) := by + simpa using tendsto_finsetSum univ (fun i _ => gueMatrix_norm_probability_tendsto (fun _ => Nat.succ_pos _) hD i) + have hw : Tendsto (fun k => ∑ w ∈ W, (productGaussian (MatrixIndex n (k+1))).real {x | ε ≤ ‖matrixTraceWord (gueMatrix x) w-FreeSeries.fockMoments n w‖}) atTop (𝓝 0) := by + simpa using tendsto_finsetSum W (fun w _ => gueTraceWord_probability_tendsto (fun _ => Nat.succ_pos _) hD w hε) + apply squeeze_zero (fun k => measureReal_nonneg) _ (by simpa using hn.add hw) + intro k + have he : gueBad n m (k+1) ε = + (⋃ i ∈ (univ : Finset (Fin n)), {x | 64 < matrixOpNorm (gueMatrix x i)}) ∪ + (⋃ w ∈ W, {x | ε ≤ ‖matrixTraceWord (gueMatrix x) w-FreeSeries.fockMoments n w‖}) := by + ext x + simp [gueBad,W] + rw [he] + exact (measureReal_union_le _ _).trans (add_le_add (measureReal_biUnion_finset_le _ _) (measureReal_biUnion_finset_le _ _)) + theorem exists_gue_model (n m K : ℕ) {ε : ℝ} (hε : 0<ε) : + ∃ d, K Matrix.trace (B*matrixWord (jointMatrix A x) w)) := + ((IsMatrixPolynomial.const B).mul (IsMatrixPolynomial.word (jointMatrix_polynomial A) w)).trace + theorem fixedTraceWord_derivative (A : α → Matrix (Fin d) (Fin d) ℂ) + (B : Matrix (Fin d) (Fin d) ℂ) (w : List (α ⊕ Fin n)) (q : MatrixIndex n d) (x : MatrixIndex n d → ℝ) : + complexCoordinateDerivative (fun y => Matrix.trace (B*matrixWord (jointMatrix A y) w)) q x = + (Real.sqrt d:ℂ)⁻¹ * ∑ r : Fin w.length, if w[r.val]=Sum.inr q.1 then + Matrix.trace (B*matrixWord (jointMatrix A x) (w.take r.val)*hermitianBasis q.2.1 q.2.2*matrixWord (jointMatrix A x) (w.drop (r.val+1))) else 0 := by + have hm := hasDerivAt_matrix_mul (fun j k => hasDerivAt_const (x q) (B j k)) (hasDerivAt_matrixWord (jointMatrix_hasDeriv A x q) w) + have ht := HasDerivAt.sum (u := univ) (fun j _ => hm j j) + have htrace : HasDerivAt (fun y => Matrix.trace (B*matrixWord (jointMatrix A (Function.update x q y)) w)) + (Matrix.trace (B*matrixWordVariation (jointMatrix A (Function.update x q (x q))) (noiseDirection q) w)) (x q) := by + simpa only [Finset.sum_fn, Matrix.trace, Matrix.diag, show (fun _ _ : Fin d => (0:ℂ)) = (0:Matrix (Fin d) (Fin d) ℂ) from rfl, Matrix.zero_mul, zero_add] using ht + have he := htrace.deriv + change complexCoordinateDerivative (fun y => Matrix.trace (B*matrixWord (jointMatrix A y) w)) q x = _ at he + simp only [Function.update_eq_self] at he + rw [he] + change Matrix.trace (B*matrixWordVariation (jointMatrix A x) (noiseDirection q) w) = _ + simp only [matrixWordVariation, mul_sum, Matrix.trace_sum] + apply sum_congr rfl + intro r _ + simp only [noiseDirection] + split_ifs <;> simp [Matrix.trace_smul, mul_assoc] + theorem gueTraceWord_expand (A : α → Matrix (Fin d) (Fin d) ℂ) (i : Fin n) (w : List (α ⊕ Fin n)) (x : MatrixIndex n d → ℝ) : + matrixTraceWord (jointMatrix A x) (Sum.inr i::w) = + ((d:ℂ)⁻¹*(Real.sqrt d:ℂ)⁻¹)*∑ j, ∑ k, (x (i,j,k):ℂ)*Matrix.trace (hermitianBasis j k*matrixWord (jointMatrix A x) w) := by + simp only [matrixTraceWord, matrixWord_cons, jointMatrix, Sum.elim_inr, gueMatrix, coordinateMatrix_expand, + smul_mul_assoc, sum_mul, Matrix.trace_sum, Matrix.trace_smul, smul_eq_mul, mul_sum] + ring_nf + theorem gueTraceWord_stein (_hd : 0 < d) (A : α → Matrix (Fin d) (Fin d) ℂ) (i : Fin n) (w : List (α ⊕ Fin n)) : + (∫ x, matrixTraceWord (jointMatrix A x) (Sum.inr i::w) ∂productGaussian (MatrixIndex n d)) = + ∑ r : Fin w.length, if w[r.val]=Sum.inr i then + ∫ x, matrixTraceWord (jointMatrix A x) (w.take r.val)*matrixTraceWord (jointMatrix A x) (w.drop (r.val+1)) ∂productGaussian (MatrixIndex n d) else 0 := by + let F := fun (j k : Fin d) (x : MatrixIndex n d → ℝ) => Matrix.trace (hermitianBasis j k*matrixWord (jointMatrix A x) w) + have hF (j k : Fin d) : IsComplexPolynomial (F j k) := fixedTraceWord_polynomial A _ w + have hi (j k : Fin d) := ((IsComplexPolynomial.coord (i,j,k)).mul (hF j k)).integrable + have hdF (j k : Fin d) := ((hF j k).derivative (i,j,k)).integrable + simp_rw [gueTraceWord_expand] + rw [integral_const_mul, integral_finsetSum _ (fun j _ => integrable_finsetSum _ (fun k _ => hi j k))] + simp_rw [integral_finsetSum _ (fun k _ => hi _ k)] + change ((d:ℂ)⁻¹*(Real.sqrt d:ℂ)⁻¹)*(∑ j, ∑ k, ∫ x, (x (i,j,k):ℂ)*F j k x ∂productGaussian (MatrixIndex n d)) = _ + simp_rw [(hF _ _).stein] + simp_rw [← integral_finsetSum _ (fun k _ => hdF _ k)] + rw [← integral_finsetSum _ (fun j _ => integrable_finsetSum _ (fun k _ => hdF j k))] + have hcalc (x : MatrixIndex n d → ℝ) : (∑ j, ∑ k, complexCoordinateDerivative (F j k) (i,j,k) x) = + (Real.sqrt d:ℂ)⁻¹ * ∑ r : Fin w.length, if w[r.val]=Sum.inr i then + Matrix.trace (matrixWord (jointMatrix A x) (w.take r.val))*Matrix.trace (matrixWord (jointMatrix A x) (w.drop (r.val+1))) else 0 := by + simp only [F, fixedTraceWord_derivative] + simp_rw [← mul_sum] + congr 1 + have hs : ∀ j : Fin d, (∑ k : Fin d, ∑ r : Fin w.length, if w[r.val]=Sum.inr i then + Matrix.trace (hermitianBasis j k*matrixWord (jointMatrix A x) (w.take r.val)*hermitianBasis j k*matrixWord (jointMatrix A x) (w.drop (r.val+1))) else 0) = + ∑ r : Fin w.length, ∑ k : Fin d, if w[r.val]=Sum.inr i then + Matrix.trace (hermitianBasis j k*matrixWord (jointMatrix A x) (w.take r.val)*hermitianBasis j k*matrixWord (jointMatrix A x) (w.drop (r.val+1))) else 0 := fun _ => sum_comm + simp_rw [hs] + rw [sum_comm] + apply sum_congr rfl + intro r _ + simp only [sum_ite_irrel, sum_const_zero] + split_ifs + · exact basis_trace_contract _ _ + · rfl + simp_rw [hcalc] + rw [integral_const_mul, ← mul_assoc] + have hc : (d:ℂ)⁻¹*(Real.sqrt d:ℂ)⁻¹*(Real.sqrt d:ℂ)⁻¹=(d:ℂ)⁻¹*(d:ℂ)⁻¹ := by + rw [mul_assoc, ← pow_two, inv_pow] + have hs : (Real.sqrt d:ℂ)^2=(d:ℂ) := by norm_cast; exact Real.sq_sqrt (Nat.cast_nonneg _) + rw [hs] + rw [hc] + have hp (r : Fin w.length) := ((IsMatrixPolynomial.word (jointMatrix_polynomial A) (w.take r.val)).trace.mul + (IsMatrixPolynomial.word (jointMatrix_polynomial A) (w.drop (r.val+1))).trace).integrable + rw [integral_finsetSum _ (fun r _ => by split_ifs <;> first | exact hp r | exact integrable_const 0)] + rw [mul_sum] + apply sum_congr rfl + intro r _ + split_ifs with h + · simp only [matrixTraceWord] + rw [← integral_const_mul] + apply integral_congr_ae + filter_upwards [] with x + ring + · simp +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianAffineVolume.lean b/lean/OAI/Analysis/FreeEntropy/GaussianAffineVolume.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b8a0fca346c871d2d516f13950a0507e296a994 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianAffineVolume.lean @@ -0,0 +1,31 @@ +import OAI.Analysis.FreeEntropy.FlowSeparation + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace FiniteEntropySeparation + theorem gaussian_affine_volume {ι : Type u1} [Fintype ι] (a : EuclideanSpace ℝ ι) {r : ℝ} (hr : 0 a+r • WithLp.toLp 2 x) ⁻¹' s)) : + ENNReal.ofReal (r^(Fintype.card ι)/2) ≤ volume s := by + have hp : productGaussian ι ((fun x => a+r • WithLp.toLp 2 x) ⁻¹' s) ≤ + ENNReal.ofReal ((r^(Fintype.card ι))⁻¹)*volume s := by + have hh := productGaussian_toLp_le_volume ι ((fun x => a+r • x) ⁻¹' s) + have he : ((fun x : EuclideanSpace ℝ ι => a+r • x) ⁻¹' s) = + (fun x => r • x) ⁻¹' ((fun x => a+x) ⁻¹' s) := rfl + rw [he,Measure.addHaar_preimage_smul volume hr.ne', measure_preimage_add] at hh + simpa only [finrank_euclideanSpace,Set.preimage_preimage,Function.comp_def,abs_of_pos (inv_pos.mpr (pow_pos hr _))] using hh + have hm : ENNReal.ofReal (r^(Fintype.card ι)) * (1/2:ℝ≥0∞) ≤ + ENNReal.ofReal (r^(Fintype.card ι)) * (ENNReal.ofReal ((r^(Fintype.card ι))⁻¹)*volume s) := by + gcongr; exact h.trans hp + rw [← mul_assoc,← ENNReal.ofReal_mul (pow_nonneg hr.le _),mul_inv_cancel₀ (pow_ne_zero _ hr.ne'),ENNReal.ofReal_one,one_mul] at hm + simpa only [div_eq_mul_inv,ENNReal.ofReal_mul (pow_nonneg hr.le _),ENNReal.ofReal_inv_of_pos (by norm_num : (0:ℝ)<2),ENNReal.ofReal_ofNat,one_mul] using hm +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianBlockTail.lean b/lean/OAI/Analysis/FreeEntropy/GaussianBlockTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e2dea72907ff7162880c5df1e409a850bed6999 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianBlockTail.lean @@ -0,0 +1,104 @@ +import OAI.Analysis.FreeEntropy.NormalLaw + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Set +open scoped ENNReal +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] + theorem normalLaw_rotation (s : ℝ) (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) : + (normalLaw s).map U = normalLaw s := by + have he : (fun x => ENNReal.ofReal (normalKernel s x)) = + (fun x => ENNReal.ofReal (normalKernel s x)) ∘ U := by + funext x + simp [normalKernel] + unfold normalLaw + conv_lhs => rw [he] + exact map_withDensity_of_measurePreserving U.measurePreserving _ + (ENNReal.measurable_ofReal.comp (normalKernel_continuous_space s).measurable) + theorem normalLaw_measurePreserving (s : ℝ) (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) : + MeasurePreserving U (normalLaw s) (normalLaw s) := + ⟨U.continuous.measurable,normalLaw_rotation s U⟩ + theorem squareExp_density (x : ℝ) : + gaussianPDFReal 0 1 x * Real.exp (x^2/4) = + (Real.sqrt (2*Real.pi))⁻¹ * Real.exp (-(1/4:ℝ)*x^2) := by + simp only [gaussianPDFReal,NNReal.coe_one,mul_one,sub_zero,mul_assoc,← Real.exp_add] + congr 2 + ring + theorem squareExp_integrable : Integrable (fun x : ℝ => Real.exp (x^2/4)) (gaussianReal 0 1) := by + rw [gaussian_weight_integrable one_ne_zero] + simp only [smul_eq_mul,squareExp_density] + exact (integrable_exp_neg_mul_sq (by norm_num : (0:ℝ)<1/4)).const_mul _ + theorem squareExp_integral : (∫x : ℝ,Real.exp (x^2/4) ∂gaussianReal 0 1) = Real.sqrt 2 := by + rw [integral_gaussianReal_eq_integral_smul one_ne_zero] + simp only [smul_eq_mul,squareExp_density] + rw [integral_const_mul,integral_gaussian] + have hp := Real.pi_pos + have he : Real.pi / (1/4:ℝ)=4*Real.pi := by ring + rw [he,Real.sqrt_mul (by norm_num : (0:ℝ)≤2),Real.sqrt_mul (by norm_num : (0:ℝ)≤4)] + norm_num + have hs : Real.sqrt Real.pi≠0 := (Real.sqrt_pos.mpr hp).ne' + have h2 : Real.sqrt 2≠0 := (Real.sqrt_pos.mpr (by norm_num : (0:ℝ)<2)).ne' + field_simp + nlinarith [Real.sq_sqrt (by norm_num : (0:ℝ)≤2)] + theorem masked_exp_integrable (m : Finset ι) : + Integrable (fun x : ι → ℝ => Real.exp ((∑i∈m,x i^2)/4)) (productGaussian ι) := by + classical + have he : (fun x : ι → ℝ => Real.exp ((∑i∈m,x i^2)/4)) = + fun x => ∏i,if i∈m then Real.exp (x i^2/4) else 1 := by + funext x + rw [sum_div,Real.exp_sum] + simp + rw [he] + apply Integrable.fintype_prod (f := fun i (x:ℝ) => if i∈m then Real.exp (x^2/4) else 1) + intro i + by_cases hi : i∈m + · simpa [hi] using squareExp_integrable + · simp [hi] + theorem masked_exp_integral (m : Finset ι) : + (∫x : ι → ℝ,Real.exp ((∑i∈m,x i^2)/4) ∂productGaussian ι) = Real.sqrt 2^m.card := by + classical + have he : (fun x : ι → ℝ => Real.exp ((∑i∈m,x i^2)/4)) = + fun x => ∏i,if i∈m then Real.exp (x i^2/4) else 1 := by + funext x + rw [sum_div,Real.exp_sum] + simp + rw [he,productGaussian,integral_fintype_prod_eq_prod (fun i (x:ℝ) => if i∈m then Real.exp (x^2/4) else 1)] + have hh i : (∫x : ℝ,if i∈m then Real.exp (x^2/4) else 1 ∂gaussianReal 0 1)= + if i∈m then Real.sqrt 2 else 1 := by + by_cases hi : i∈m <;> simp [hi,squareExp_integral] + simp_rw [hh] + simp + theorem masked_square_tail (m : Finset ι) (u : ℝ) : + (productGaussian ι) {x | u≤∑i∈m,x i^2} ≤ + ENNReal.ofReal (Real.exp (-u/4)*Real.sqrt 2^m.card) := by + have hi := (masked_exp_integrable m).const_mul (Real.exp (-u/4)) + have hh := hi.measure_le_integral (Filter.Eventually.of_forall (fun x => by positivity)) + (s := {x | u≤∑i∈m,x i^2}) (fun x hx => by + rw [← Real.exp_add,Real.one_le_exp_iff] + dsimp at hx + linarith) + rw [integral_const_mul,masked_exp_integral] at hh + exact hh + theorem normalLaw_mask_tail (m : Finset ι) {s : ℝ} (hs : 0 Real.sqrt s • WithLp.toLp 2 x) ⁻¹' {x : EuclideanSpace ℝ ι | u≤∑i∈m,x i^2} = + {x | u/s≤∑i∈m,x i^2} := by + ext x + simp only [Set.mem_preimage,Set.mem_ofPred_eq,PiLp.smul_apply,smul_eq_mul,mul_pow,Real.sq_sqrt hs.le,← mul_sum] + rw [div_le_iff₀ hs,mul_comm] + rw [he] + convert masked_square_tail m (u/s) using 1 ; congr 2 ; ring_nf + theorem gaussian_square_integral : (∫x : ℝ,x^2 ∂gaussianReal 0 1)=1 := by + simpa [pow_two] using gaussian_polynomial_stein (Polynomial.X : Polynomial ℝ) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianConvolution.lean b/lean/OAI/Analysis/FreeEntropy/GaussianConvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..d75fb7bb9db718c109c07e88ce73dfdfbdb11f2d --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianConvolution.lean @@ -0,0 +1,108 @@ +import OAI.Analysis.FreeEntropy.CompactIntegration + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped Topology ENNReal +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] +def smoothedDensity (μ : Measure (EuclideanSpace ℝ ι)) (s : ℝ) (x : EuclideanSpace ℝ ι) : ℝ := + ∫a,normalKernel s (x-a) ∂μ +def smoothedTimeDerivative (μ : Measure (EuclideanSpace ℝ ι)) (s : ℝ) (x : EuclideanSpace ℝ ι) : ℝ := + ∫a,normalTimeDerivative s (x-a) ∂μ +def smoothedGradient (μ : Measure (EuclideanSpace ℝ ι)) (s : ℝ) (x : EuclideanSpace ℝ ι) (i : ι) : ℝ := + ∫a,normalGradient s (x-a) i ∂μ +def smoothedSecond (μ : Measure (EuclideanSpace ℝ ι)) (s : ℝ) (x : EuclideanSpace ℝ ι) (i : ι) : ℝ := + ∫a,normalSecond s (x-a) i ∂μ + theorem normalKernel_le (s : ℝ) (hs : 0 normalKernel s (x-a)) μ := by + apply (integrable_const (Real.exp (-(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*s)))).mono' + (((normalKernel_continuous_space s).comp (continuous_const.sub continuous_id)).aestronglyMeasurable) + exact ae_of_all _ (fun a => by change ‖normalKernel s (x-a)‖≤_; rw [Real.norm_eq_abs,abs_of_pos (normalKernel_pos _ _)]; exact normalKernel_le s hs _) + theorem smoothedDensity_pos (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {s : ℝ} (hs : 0 (normalKernel_pos _ _).le) (normalKernel_integrable_finite μ hs x)] + have h : Function.support (fun a => normalKernel s (x-a))=univ := by + ext a; simp [Function.mem_support,(normalKernel_pos s (x-a)).ne'] + simp [h] + theorem smoothedDensity_continuous (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + {s : ℝ} (hs : 0 Real.exp (-(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*s))) + · intro x; exact (normalKernel_integrable_finite μ hs x).aestronglyMeasurable + · intro x; exact ae_of_all _ (fun a => by change ‖normalKernel s (x-a)‖≤_; rw [Real.norm_eq_abs,abs_of_pos (normalKernel_pos _ _)]; exact normalKernel_le s hs _) + · exact integrable_const _ + · exact ae_of_all _ (fun a => (normalKernel_continuous_space s).comp (continuous_id.sub continuous_const)) + theorem normalKernel_product_integrable (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + {s : ℝ} (hs : 0 normalKernel s (z.2-z.1)) (μ.prod volume) := by + apply (integrable_prod_iff (((normalKernel_continuous_space s).comp (continuous_snd.sub continuous_fst)).aestronglyMeasurable)).mpr + constructor + · exact ae_of_all _ (fun a => (normalKernel_integrable hs).comp_sub_right a) + · simpa only [Function.comp_apply,Pi.sub_apply,Prod.fst,Prod.snd,Real.norm_eq_abs,abs_of_pos (normalKernel_pos _ _),integral_sub_right_eq_self,normalKernel_integral hs] using (integrable_const (1:ℝ) : Integrable (fun _ : EuclideanSpace ℝ ι => (1:ℝ)) μ) + theorem smoothedDensity_integrable (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + {s : ℝ} (hs : 0 normalKernel s (x-a)) (show Integrable (fun z : EuclideanSpace ℝ ι × EuclideanSpace ℝ ι => normalKernel s (z.1-z.2)) (volume.prod μ) from (normalKernel_product_integrable μ hs).swap)] + simp only [integral_sub_right_eq_self,normalKernel_integral hs,integral_const,probReal_univ,one_smul] + theorem smoothedDensity_hasDeriv_time (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + {K : Set (EuclideanSpace ℝ ι)} (hK : IsCompact K) (hμ : ∀ᵐ a ∂μ,a∈K) + {s : ℝ} (hs : 0 smoothedDensity μ t x) (smoothedTimeDerivative μ s x) s := by + apply (hasDerivAt_integral_compact μ hK hμ (fun t a => normalKernel t (x-a)) (fun t a => normalTimeDerivative t (x-a)) + (a := s/2) (b := s+1) (by linarith) (by linarith) ?_ ?_ ?_ ?_).2 + · intro t ht; exact (normalKernel_continuous_space t).comp (continuous_const.sub continuous_id) + · intro t ht + unfold normalTimeDerivative normalKernel + fun_prop + · apply normalTimeDerivative_continuousOn.comp ((continuous_fst.prodMk (continuous_const.sub continuous_snd)).continuousOn) + intro z hz; dsimp; linarith [hz.1.1] + · intro t ht a ha + exact normalKernel_hasDeriv_time (by linarith [ht.1]) (x-a) + theorem smoothedDensity_hasDeriv_coordinate [DecidableEq ι] (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + {K : Set (EuclideanSpace ℝ ι)} (hK : IsCompact K) (hμ : ∀ᵐ a ∂μ,a∈K) + (s : ℝ) (x : EuclideanSpace ℝ ι) (i : ι) (r : ℝ) : + HasDerivAt (fun t => smoothedDensity μ s (x+t • EuclideanSpace.single i 1)) + (smoothedGradient μ s (x+r • EuclideanSpace.single i 1) i) r := by + apply (hasDerivAt_integral_compact μ hK hμ (fun t a => normalKernel s (x+t • EuclideanSpace.single i 1-a)) + (fun t a => normalGradient s (x+t • EuclideanSpace.single i 1-a) i) (a := r-1) (b := r+1) (by linarith) (by linarith) ?_ ?_ ?_ ?_).2 + · intro t ht; exact (normalKernel_continuous_space s).comp (continuous_const.sub continuous_id) + · intro t ht; exact (normalGradient_continuous s i).comp (continuous_const.sub continuous_id) + · exact ((normalGradient_continuous s i).comp ((continuous_const.add (continuous_fst.smul continuous_const)).sub continuous_snd)).continuousOn + · intro t ht a ha + simpa only [add_sub_right_comm] using normalKernel_hasDeriv_coordinate_at s (x-a) i t + theorem smoothedGradient_hasDeriv_coordinate [DecidableEq ι] (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + {K : Set (EuclideanSpace ℝ ι)} (hK : IsCompact K) (hμ : ∀ᵐ a ∂μ,a∈K) + (s : ℝ) (x : EuclideanSpace ℝ ι) (i : ι) (r : ℝ) : + HasDerivAt (fun t => smoothedGradient μ s (x+t • EuclideanSpace.single i 1) i) + (smoothedSecond μ s (x+r • EuclideanSpace.single i 1) i) r := by + apply (hasDerivAt_integral_compact μ hK hμ (fun t a => normalGradient s (x+t • EuclideanSpace.single i 1-a) i) + (fun t a => normalSecond s (x+t • EuclideanSpace.single i 1-a) i) (a := r-1) (b := r+1) (by linarith) (by linarith) ?_ ?_ ?_ ?_).2 + · intro t ht; exact (normalGradient_continuous s i).comp (continuous_const.sub continuous_id) + · intro t ht; exact (normalSecond_continuous s i).comp (continuous_const.sub continuous_id) + · exact ((normalSecond_continuous s i).comp ((continuous_const.add (continuous_fst.smul continuous_const)).sub continuous_snd)).continuousOn + · intro t ht a ha + simpa only [add_sub_right_comm] using normalGradient_hasDeriv_coordinate s (x-a) i t + theorem smoothed_heatEquation (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + {K : Set (EuclideanSpace ℝ ι)} (hK : IsCompact K) (hμ : ∀ᵐ a ∂μ,a∈K) (s : ℝ) (x : EuclideanSpace ℝ ι) : + smoothedTimeDerivative μ s x = (1/2:ℝ)*∑i, smoothedSecond μ s x i := by + classical + unfold smoothedTimeDerivative smoothedSecond + simp only [normal_heatEquation,integral_const_mul] + rw [integral_finsetSum] + intro i hi + exact integrable_of_compact_ae μ hK hμ (((normalSecond_continuous s i).comp (continuous_const.sub continuous_id)).aestronglyMeasurable) + (((normalSecond_continuous s i).comp (continuous_const.sub continuous_id)).continuousOn) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianConvolutionBounds.lean b/lean/OAI/Analysis/FreeEntropy/GaussianConvolutionBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..724d9af59896c930352887d11243ade4f842fe24 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianConvolutionBounds.lean @@ -0,0 +1,115 @@ +import OAI.Analysis.FreeEntropy.GaussianDecay + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped Topology +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] + theorem normal_prefactor_bounded {a b : ℝ} (ha : 0 -(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*s)) (Icc a b) := by + apply continuousOn_const.mul + apply ContinuousOn.log (by fun_prop) + intro s hs; exact ne_of_gt (by have : 0 (normalKernel_shift_bounds ha hs hD hK x y hy).1)) + simpa only [smoothedDensity,integral_const,probReal_univ,one_smul] using h + · have h := integral_mono_ae hi (integrable_const (Real.exp (D+K^2/(2*b))*Real.exp (-‖x‖^2/(4*b)))) + (hμ.mono (fun y hy => (normalKernel_shift_bounds ha hs hD hK x y hy).2)) + simpa only [smoothedDensity,integral_const,probReal_univ,one_smul] using h + theorem smoothedDensity_log_bound (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {a b s D K : ℝ} (ha : 0 (normalKernel_le s hs0 (x-y)).trans (Real.exp_le_exp.mpr (le_trans (le_abs_self _) hD)))) + simpa only [smoothedDensity,integral_const,probReal_univ,one_smul] using h + have h := Real.log_le_log hp hu' + rw [Real.log_exp] at h + exact h.trans (le_add_of_nonneg_right (by positivity)) + theorem integrable_of_normBound (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + {K : ℝ} (hμ : ∀ᵐ y ∂μ,‖y‖ ≤ K) {f : EuclideanSpace ℝ ι → ℝ} (hf : Continuous f) : Integrable f μ := by + apply integrable_of_compact_ae μ (isCompact_closedBall (0 : EuclideanSpace ℝ ι) K) _ hf.aestronglyMeasurable hf.continuousOn + simpa only [Metric.mem_closedBall,dist_zero_right] using hμ + theorem smoothedGradient_bound (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + {a s K : ℝ} (ha : 0 normalGradient s (x-y) i) μ := integrable_of_normBound μ hμ ((normalGradient_continuous s i).comp (continuous_const.sub continuous_id)) + calc + _ ≤ ∫y,|normalGradient s (x-y) i| ∂μ := by simpa only [smoothedGradient,Real.norm_eq_abs] using norm_integral_le_integral_norm (fun y => normalGradient s (x-y) i) + _ ≤ ∫y,((‖x‖+K)/a)*normalKernel s (x-y) ∂μ := by + apply integral_mono_ae hi.norm ((normalKernel_integrable_finite μ hs0 x).const_mul _) + filter_upwards [hμ] with y hy + unfold normalGradient + rw [Real.norm_eq_abs,abs_mul,abs_div,abs_neg,abs_of_pos hs0,abs_of_pos (normalKernel_pos _ _)] + apply mul_le_mul_of_nonneg_right _ (normalKernel_pos _ _).le + have hn0 : |(x-y) i| ≤ ‖x-y‖ := by simpa only [Real.norm_eq_abs] using PiLp.norm_apply_le (x-y) i + have hn : |(x-y) i| ≤ ‖x‖+K := hn0.trans ((norm_sub_le x y).trans (add_le_add le_rfl hy)) + exact (div_le_div_of_nonneg_right hn hs0.le).trans (div_le_div_of_nonneg_left (by positivity) ha hs) + _ = _ := integral_const_mul _ _ +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianCorrection.lean b/lean/OAI/Analysis/FreeEntropy/GaussianCorrection.lean new file mode 100644 index 0000000000000000000000000000000000000000..c46524a3a488663ca325672439549f496320a56a --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianCorrection.lean @@ -0,0 +1,65 @@ +import OAI.Analysis.FreeEntropy.FreeEntropyFlow + +namespace OAI + +noncomputable section +open MeasureTheory Filter Finset Set +open scoped Topology +namespace FiniteEntropySeparation +namespace Model +variable (p : ℕ) [NeZero p] + theorem isotropic_gaussian_correction {a : ℝ} (ha : 0 smoothedDensity μ s x*‖x‖^2) := by + have hi := (smoothedPolynomial_integrable μ hs hK hμ 1).sub (smoothedDensity_integrable μ hs) + convert hi using 1 + funext x + simp only [pow_one,Pi.sub_apply] + ring + theorem normalCross_integrable (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {s K : ℝ} (hs : 0 smoothedDensity μ s x*Real.log (normalKernel v x)) := by + have he x : smoothedDensity μ s x*Real.log (normalKernel v x)= + smoothedDensity μ s x*(-(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*v))- + (smoothedDensity μ s x*‖x‖^2)/(2*v) := by rw [normalKernel,Real.log_exp]; ring + simp only [he] + exact ((smoothedDensity_integrable μ hs).mul_const _).sub ((smoothedSecond_integrable μ hs hK hμ).div_const _) + theorem normalCross_integral (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {s K : ℝ} (hs : 0 ENNReal.ofReal (f x))) E).toReal=∫x in E,f x ∂ν := by + rw [withDensity_apply _ hE,← ofReal_integral_eq_lintegral_ofReal hf.integrableOn (ae_of_all _ hf0), + ENNReal.toReal_ofReal (integral_nonneg hf0)] + theorem classicalEntropy_event_gaussian (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {s K v z : ℝ} (hs : 0 ENNReal.ofReal (smoothedDensity μ s x))) E) + (hβ : normalLaw v E≤ENNReal.ofReal (Real.exp (-z))) : + classicalEntropy μ s≤(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*v)+ + (∫x,smoothedDensity μ s x*‖x‖^2)/(2*v)-z/2+Real.log 2 := by + have hfi := smoothedDensity_integrable μ hs + have hgi := normalKernel_integrable (ι := ι) hv + have hfm : (volume.withDensity (fun x => ENNReal.ofReal (smoothedDensity μ s x))) univ=1 := by + rw [withDensity_apply _ MeasurableSet.univ,setLIntegral_univ, + ← ofReal_integral_eq_lintegral_ofReal hfi (ae_of_all _ (fun x => (smoothedDensity_pos μ hs x).le)),smoothedDensity_integral μ hs] + simp + have hfE : (volume.withDensity (fun x => ENNReal.ofReal (smoothedDensity μ s x))) E≠⊤ := + ne_top_of_le_ne_top (by simp) ((measure_mono (subset_univ E)).trans_eq hfm) + have ha := (ENNReal.ofReal_le_iff_le_toReal hfE).mp hα + rw [density_event_toReal volume _ hfi (fun x => (smoothedDensity_pos μ hs x).le) E hE] at ha + have hb := ENNReal.toReal_mono (ENNReal.ofReal_ne_top) hβ + rw [normalLaw,density_event_toReal volume _ hgi (fun x => (normalKernel_pos v x).le) E hE, + ENNReal.toReal_ofReal (Real.exp_pos _).le] at hb + have he := entropy_event_bound volume (smoothedDensity μ s) (normalKernel v) + (smoothedDensity_pos μ hs) (normalKernel_pos v) hfi hgi (smoothedEntropy_integrable μ hs hK hμ) + (normalCross_integrable μ hs hK hμ v) (smoothedDensity_integral μ hs) (normalKernel_integral hv) E hE hz ha hb + rwa [normalCross_integral μ hs hK hμ v] at he +variable {n d : ℕ} + theorem integral_heatLaw_totalSecond (hd : 0 smoothedDensity μ t x*Real.log (smoothedDensity μ t x)) + ((1+Real.log (smoothedDensity μ s x))*smoothedTimeDerivative μ s x) s := by + have hm : ∀ᵐ y ∂μ,y∈Metric.closedBall 0 K := by simpa only [Metric.mem_closedBall,dist_zero_right] using hμ + have hd := smoothedDensity_hasDeriv_time μ (isCompact_closedBall _ _) hm hs x + have hp := (smoothedDensity_pos μ hs x).ne' + convert hd.mul (hd.log hp) using 1 ; try rfl + field_simp [hp] + ring + theorem classicalEntropy_hasDeriv_integral (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {K s : ℝ} (hK : 0 ≤ K) (hμ : ∀ᵐ y ∂μ,‖y‖ ≤ K) (hs : 0 smoothedDensity μ t x*Real.log (smoothedDensity μ t x)) + (F' := fun t x => (1+Real.log (smoothedDensity μ t x))*smoothedTimeDerivative μ t x) + (μ := volume) (s := Icc a b) (bound := fun x => (L*T*A)*(1+‖x‖^2)^2*Real.exp (-(1/(4*b))*‖x‖^2)) + (x₀ := s) (Icc_mem_nhds (by dsimp [a]; linarith) (by dsimp [b]; linarith)) ?_ ?_ ?_ ?_ ?_ ?_ + · exact hd.2.neg + · filter_upwards [Icc_mem_nhds (show a by + have ht0 := ha.trans_le ht.1 + have hp := (smoothedDensity_pos μ ht0 x).le + have hlog : |1+Real.log (smoothedDensity μ t x)| ≤ L*(1+‖x‖^2) := by + have h := smoothedLog_polynomial_bound μ ha ht hD0 (hD t ht) hK hμ x + have h' := abs_add_le (1:ℝ) (Real.log (smoothedDensity μ t x)) + norm_num only [abs_one] at h' + dsimp [L]; nlinarith [sq_nonneg ‖x‖] + have htime := smoothedTime_polynomial_bound μ ha ht.1 hK hμ x + have hden := (smoothedDensity_bounds μ ha ht (hD t ht) hK hμ x).2 + have he : -‖x‖^2/(4*b)=-(1/(4*b))*‖x‖^2 := by ring + rw [he] at hden + rw [Real.norm_eq_abs,abs_mul] + calc + _ ≤ (L*(1+‖x‖^2))*(T*(1+‖x‖^2)*smoothedDensity μ t x) := mul_le_mul hlog htime (abs_nonneg _) (by positivity) + _ = (L*T)*(1+‖x‖^2)^2*smoothedDensity μ t x := by ring + _ ≤ (L*T)*(1+‖x‖^2)^2*(A*Real.exp (-(1/(4*b))*‖x‖^2)) := mul_le_mul_of_nonneg_left hden (by positivity) + _ = _ := by ring) + · convert (polynomial_gaussian_integrable (E := EuclideanSpace ℝ ι) (c := 1/(4*b)) (by positivity) 2).const_mul (L*T*A) using 1 + funext x; ring + · exact ae_of_all _ (fun x t ht => smoothedEntropy_hasDeriv_time μ hK hμ (ha.trans_le ht.1) x) + theorem smoothed_score_ibp [DecidableEq ι] (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {K s : ℝ} (hK : 0 ≤ K) (hμ : ∀ᵐ y ∂μ,‖y‖ ≤ K) (hs : 0 smoothedSecond_polynomial_bound μ hs le_rfl hK hμ x i) + have hiGradient := smoothedLog_mul_integrable μ hs hK hμ (smoothedGradient_measurable μ s i) + ((1+K)/s) (by positivity) (fun x => smoothedGradient_polynomial_bound μ hs le_rfl hK hμ x i) + have he : (fun x => (smoothedGradient μ s x i/smoothedDensity μ s x)*smoothedGradient μ s x i) = + fun x => (smoothedGradient μ s x i)^2/smoothedDensity μ s x := by funext x; ring + have hiScore : Integrable (fun x => (smoothedGradient μ s x i/smoothedDensity μ s x)*smoothedGradient μ s x i) := by + rw [he]; exact smoothedScore_integrable μ hs hK hμ i + have hibp := integral_coordinate_ibp i (fun x => 1+Real.log (smoothedDensity μ s x)) + (fun x => smoothedGradient μ s x i/smoothedDensity μ s x) + (fun x => smoothedGradient μ s x i) (fun x => smoothedSecond μ s x i) ?_ ?_ hiSecond hiScore hiGradient + · simpa only [he] using hibp + · intro x r + convert ((smoothedDensity_hasDeriv_coordinate μ (isCompact_closedBall _ _) hm s x i r).log (smoothedDensity_pos μ hs _).ne').const_add 1 using 1 + · intro x r + exact smoothedGradient_hasDeriv_coordinate μ (isCompact_closedBall _ _) hm s x i r + theorem classicalEntropy_hasDeriv (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {K s : ℝ} (hK : 0 ≤ K) (hμ : ∀ᵐ y ∂μ,‖y‖ ≤ K) (hs : 0 smoothedSecond_polynomial_bound μ hs le_rfl hK hμ x i) + theorem classicalFisher_nonneg (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {s : ℝ} (hs : 0 Real.exp (-c*‖x‖^2)) := by + have h := (GaussianFourier.integrable_cexp_neg_mul_sq_norm_add (b := (c:ℂ)) (by simpa using hc) 0 (0:E)).re + convert h using 1 + funext x + simp only [zero_mul,add_zero] + change Real.exp (-c*‖x‖^2) = (Complex.exp (-(c:ℂ)*(‖x‖:ℂ)^2)).re + rw [← Complex.ofReal_pow,← Complex.ofReal_neg,← Complex.ofReal_mul,← Complex.ofReal_exp] + rfl + theorem polynomial_gaussian_bound {c : ℝ} (hc : 0 (1+‖x‖^2)^m*Real.exp (-c*‖x‖^2)) := by + apply ((gaussianDecay_integrable (E := E) (show 0 (1+‖x‖^2)^m*Real.exp (-c*‖x‖^2))).aestronglyMeasurable + · exact ae_of_all _ (fun x => by + rw [Real.norm_eq_abs,abs_of_nonneg (by positivity)] + exact polynomial_gaussian_bound hc m (‖x‖^2) (sq_nonneg _)) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianDensity.lean b/lean/OAI/Analysis/FreeEntropy/GaussianDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e3f72f2c295523b015e2c7654c49edc56358de7 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianDensity.lean @@ -0,0 +1,68 @@ +import OAI.Analysis.FreeEntropy.GaussianVolume + +namespace OAI + +universe u1 u2 u3 u4 u5 u6 u7 + +noncomputable section +open MeasureTheory ProbabilityTheory Set Finset +open scoped ENNReal +namespace FiniteEntropySeparation + theorem integral_pi_prod {ι : Type u1} [Fintype ι] (f : ι → ℝ → ℝ) + (s : ι → Set ℝ) (hs : ∀i,MeasurableSet (s i)) : + ∫ x : ι → ℝ in Set.pi univ s, ∏ i,f i (x i) = ∏ i,∫ x in s i,f i x := by + classical + rw [← integral_indicator (MeasurableSet.univ_pi hs)] + have he : (Set.pi univ s).indicator (fun x : ι → ℝ => ∏ i,f i (x i)) = + fun x => ∏ i,(s i).indicator (f i) (x i) := by + funext x + by_cases h : ∀i,x i ∈ s i + · simp [Set.indicator_of_mem,Set.mem_pi,h] + · obtain ⟨i,hi⟩ := not_forall.mp h + rw [Set.indicator_of_notMem (by simpa only [Set.mem_univ_pi] using not_forall.mpr ⟨i,hi⟩)] + symm + exact prod_eq_zero (mem_univ i) (Set.indicator_of_notMem hi _) + rw [he,integral_fintype_prod_volume_eq_prod] + simp only [integral_indicator,hs] + def gaussianDensity {ι : Type u2} [Fintype ι] (x : ι → ℝ) : ℝ := + ∏ i,gaussianPDFReal 0 1 (x i) + theorem gaussianDensity_pos {ι : Type u3} [Fintype ι] (x : ι → ℝ) : 0 integrable_gaussianPDFReal 0 1) + theorem productGaussian_withDensity (ι : Type u6) [Fintype ι] : + productGaussian ι = volume.withDensity (fun x => ENNReal.ofReal (gaussianDensity x)) := by + apply Measure.pi_eq + intro s hs + rw [withDensity_apply _ (MeasurableSet.univ_pi hs)] + rw [← ofReal_integral_eq_lintegral_ofReal (gaussianDensity_integrable ι).integrableOn + (ae_of_all _ (fun x => (gaussianDensity_pos x).le))] + change ENNReal.ofReal (∫ x : ι → ℝ in Set.pi univ s, ∏ i,gaussianPDFReal 0 1 (x i)) = _ + rw [integral_pi_prod _ s hs, ENNReal.ofReal_prod_of_nonneg] + · apply prod_congr rfl + intro i _ + rw [gaussianReal_apply 0 one_ne_zero,gaussianPDF_def] + exact ofReal_integral_eq_lintegral_ofReal (integrable_gaussianPDFReal 0 1).integrableOn + (ae_of_all _ (gaussianPDFReal_nonneg 0 1)) + · intro i _ + exact integral_nonneg (gaussianPDFReal_nonneg _ _) + theorem gaussianDensity_formula {ι : Type u7} [Fintype ι] (x : ι → ℝ) : + gaussianDensity x = (Real.sqrt (2*Real.pi))⁻¹^(Fintype.card ι) * Real.exp (-(∑i,x i^2)/2) := by + classical + simp only [gaussianDensity,gaussianPDFReal, NNReal.coe_one,mul_one,sub_zero] + rw [prod_mul_distrib,prod_const,card_univ,← Real.exp_sum] + congr 1 + congr 1 + rw [← sum_div,sum_neg_distrib] +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianDifferential.lean b/lean/OAI/Analysis/FreeEntropy/GaussianDifferential.lean new file mode 100644 index 0000000000000000000000000000000000000000..9abfd25b583fa0073c8759956cc5ce39205f27e2 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianDifferential.lean @@ -0,0 +1,63 @@ +import OAI.Analysis.FreeEntropy.GaussianKernel + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +open scoped Topology +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] [DecidableEq ι] +def normalTimeDerivative (s : ℝ) (x : EuclideanSpace ℝ ι) : ℝ := + (-(Fintype.card ι:ℝ)/(2*s)+‖x‖^2/(2*s^2))*normalKernel s x +def normalGradient (s : ℝ) (x : EuclideanSpace ℝ ι) (i : ι) : ℝ := -x i/s*normalKernel s x +def normalSecond (s : ℝ) (x : EuclideanSpace ℝ ι) (i : ι) : ℝ := ((x i)^2/s^2-1/s)*normalKernel s x + theorem normalKernel_hasDeriv_coordinate_at (s : ℝ) (x : EuclideanSpace ℝ ι) (i : ι) (r : ℝ) : + HasDerivAt (fun t : ℝ => normalKernel s (x+t • EuclideanSpace.single i 1)) + (normalGradient s (x+r • EuclideanSpace.single i 1) i) r := by + have hd : HasDerivAt (fun t : ℝ => ‖x+t • EuclideanSpace.single i 1‖^2) (2*(x i+r)) r := by + have h := ((hasDerivAt_const r x).add ((hasDerivAt_id r).smul_const (EuclideanSpace.single i 1))).norm_sq + simpa [real_inner_comm,PiLp.inner_apply,EuclideanSpace.single] using h + have h := ((hasDerivAt_const r (-(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*s))).sub (hd.div_const (2*s))).exp + convert h using 1 + · rfl + · dsimp only [Pi.sub_apply,normalGradient] + simp only [PiLp.add_apply,PiLp.smul_apply,smul_eq_mul,EuclideanSpace.single,PiLp.single_apply,ite_true,mul_one,normalKernel] + ring + theorem normalGradient_hasDeriv_coordinate (s : ℝ) (x : EuclideanSpace ℝ ι) (i : ι) (r : ℝ) : + HasDerivAt (fun t : ℝ => normalGradient s (x+t • EuclideanSpace.single i 1) i) + (normalSecond s (x+r • EuclideanSpace.single i 1) i) r := by + have h := (((hasDerivAt_const r (x i)).add (hasDerivAt_id r)).neg.div_const s).mul (normalKernel_hasDeriv_coordinate_at s x i r) + simp only [normalGradient,normalSecond,PiLp.add_apply,PiLp.smul_apply,smul_eq_mul, + EuclideanSpace.single,PiLp.single_apply,ite_true,mul_one,Pi.neg_apply,Pi.add_apply,id_eq] at h ⊢ + convert h using 1; first | rfl | ring + omit [DecidableEq ι] in + theorem normal_heatEquation (s : ℝ) (x : EuclideanSpace ℝ ι) : + normalTimeDerivative s x = (1/2:ℝ)*∑ i,normalSecond s x i := by + unfold normalTimeDerivative normalSecond + rw [← sum_mul,sum_sub_distrib,← sum_div,sum_const,card_univ,nsmul_eq_mul] + have hn : ‖x‖^2=∑i,(x i)^2 := by simp [EuclideanSpace.norm_sq_eq,Real.norm_eq_abs,sq_abs] + rw [hn] + ring + omit [DecidableEq ι] in + theorem normalTimeDerivative_continuousOn : + ContinuousOn (fun z : ℝ × EuclideanSpace ℝ ι => normalTimeDerivative z.1 z.2) {z | 0 mul_ne_zero (by norm_num) (ne_of_gt hz)) + · exact (continuous_snd.norm.pow 2).continuousOn.div ((continuous_const.mul (continuous_fst.pow 2)).continuousOn) (fun z hz => mul_ne_zero (by norm_num) (pow_ne_zero _ (ne_of_gt hz))) + omit [DecidableEq ι] in + theorem normalGradient_continuous (s : ℝ) (i : ι) : Continuous (fun x : EuclideanSpace ℝ ι => normalGradient s x i) := by + unfold normalGradient + exact (((PiLp.continuous_apply 2 _ i).neg).div_const s).mul (normalKernel_continuous_space s) + omit [DecidableEq ι] in + theorem normalSecond_continuous (s : ℝ) (i : ι) : Continuous (fun x : EuclideanSpace ℝ ι => normalSecond s x i) := by + unfold normalSecond + exact ((((PiLp.continuous_apply 2 _ i).pow 2).div_const (s^2)).sub continuous_const).mul (normalKernel_continuous_space s) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianEntropyEvent.lean b/lean/OAI/Analysis/FreeEntropy/GaussianEntropyEvent.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cb8aba55f07f7161ccb28ebad2aa1d76bddd387 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianEntropyEvent.lean @@ -0,0 +1,89 @@ +import OAI.Analysis.FreeEntropy.GaussianDeBruijn + +namespace OAI + +universe u1 u2 u3 u4 u5 + +noncomputable section +open MeasureTheory Set Classical +namespace FiniteEntropySeparation + theorem entropy_subprobability_bound {Ω : Type u1} [MeasurableSpace Ω] (ν : Measure Ω) + (f g : Ω → ℝ) (hf : ∀x,0 f x*Real.log (f x)) ν) + (hfg : Integrable (fun x => f x*Real.log (g x)) ν) + (hfmass : ∫x,f x ∂ν=1) (hgmass : ∫x,g x ∂ν≤1) : + -(∫x,f x*Real.log (f x) ∂ν) ≤ -(∫x,f x*Real.log (g x) ∂ν) := by + have hp x : f x*Real.log (g x)-f x*Real.log (f x) ≤ g x-f x := by + have hh := mul_le_mul_of_nonneg_left (Real.log_le_sub_one_of_pos (div_pos (hg x) (hf x))) (hf x).le + rw [Real.log_div (hg x).ne' (hf x).ne'] at hh + have he : f x*(g x/f x-1)=g x-f x := by field_simp [(hf x).ne'] + rw [he] at hh + nlinarith + have hi := integral_mono (hfg.sub hff) (hgi.sub hfi) hp + simp only [Pi.sub_apply] at hi + rw [integral_sub hfg hff,integral_sub hgi hfi,hfmass] at hi + linarith + def eventTilt {Ω : Type u2} (g : Ω → ℝ) (E : Set Ω) (z : ℝ) (x : Ω) : ℝ := + (if x∈E then Real.exp z else 1)/2*g x + theorem eventTilt_expand {Ω : Type u3} (g : Ω → ℝ) (E : Set Ω) (z : ℝ) (x : Ω) : + eventTilt g E z x = g x/2+(Real.exp z-1)/2*E.indicator g x := by + classical + by_cases hx : x∈E <;> simp [eventTilt,hx] <;> ring + theorem eventTilt_log {Ω : Type u4} (g : Ω → ℝ) (hg : ∀x,0 f x*Real.log (f x)) ν) + (hfg : Integrable (fun x => f x*Real.log (g x)) ν) + (hfmass : ∫x,f x ∂ν=1) (hgmass : ∫x,g x ∂ν=1) + (E : Set Ω) (hE : MeasurableSet E) {z : ℝ} (hz : 0≤z) + (hα : (1/2:ℝ)≤∫x in E,f x ∂ν) (hβ : (∫x in E,g x ∂ν)≤Real.exp (-z)) : + -(∫x,f x*Real.log (f x) ∂ν) ≤ -(∫x,f x*Real.log (g x) ∂ν)-z/2+Real.log 2 := by + classical + have hi : Integrable (eventTilt g E z) ν := by + have heq : eventTilt g E z = fun x => g x/2+(Real.exp z-1)/2*E.indicator g x := funext (eventTilt_expand g E z) + rw [heq] + exact (hgi.div_const 2).add ((hgi.indicator hE).const_mul _) + have hm : (∫x,eventTilt g E z x ∂ν)≤1 := by + simp only [eventTilt_expand] + rw [integral_add (hgi.div_const 2) ((hgi.indicator hE).const_mul _),integral_div, + integral_const_mul,integral_indicator hE,hgmass] + have hb0 : 0≤∫x in E,g x ∂ν := integral_nonneg (fun x => (hg x).le) + have h := mul_le_mul_of_nonneg_left hβ (Real.exp_pos z).le + rw [← Real.exp_add,add_neg_cancel,Real.exp_zero] at h + nlinarith + have hp x : 0 simp [hx] <;> ring + have hlog : Integrable (fun x => f x*Real.log (eventTilt g E z x)) ν := by + simp only [he] + exact (hfg.add ((hfi.indicator hE).const_mul z)).sub (hfi.const_mul _) + have hb := entropy_subprobability_bound ν f (eventTilt g E z) hf hp hfi hi hff hlog hfmass hm + simp only [he] at hb + have hj : Integrable (fun x => f x*Real.log (g x)+z*E.indicator f x) ν := hfg.add ((hfi.indicator hE).const_mul z) + rw [integral_sub hj (hfi.const_mul (Real.log 2)), + integral_add hfg ((hfi.indicator hE).const_mul z),integral_const_mul,integral_const_mul, + integral_indicator hE,hfmass,mul_one] at hb + nlinarith [mul_le_mul_of_nonneg_left hα hz] +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianEntropyIntegrability.lean b/lean/OAI/Analysis/FreeEntropy/GaussianEntropyIntegrability.lean new file mode 100644 index 0000000000000000000000000000000000000000..41c304bef0460f62bd38416534199fafe58d5f93 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianEntropyIntegrability.lean @@ -0,0 +1,93 @@ +import OAI.Analysis.FreeEntropy.GaussianRegularity + +namespace OAI + +universe u1 u2 + +noncomputable section +open MeasureTheory Set +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] + theorem smoothedPolynomial_integrable (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {s K : ℝ} (hs : 0 (1+‖x‖^2)^m*smoothedDensity μ s x) := by + let D := |-(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*s)| + let A := Real.exp (D+K^2/(2*s)) + have hi := (polynomial_gaussian_integrable (E := EuclideanSpace ℝ ι) (c := 1/(4*s)) (by positivity) m).const_mul A + apply hi.mono' (((continuous_const.add (continuous_norm.pow 2)).pow m).mul (smoothedDensity_continuous μ hs)).aestronglyMeasurable + exact ae_of_all _ (fun x => by + simp only [Pi.mul_apply,Pi.add_apply,Pi.pow_apply] + have hp := smoothedDensity_pos μ hs x + rw [Real.norm_eq_abs,abs_of_nonneg (by positivity : 0 ≤ (1+‖x‖^2)^m*smoothedDensity μ s x)] + have h := (smoothedDensity_bounds μ hs (show s∈Icc s s from ⟨le_rfl,le_rfl⟩) (show |-(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*s)| ≤ D from le_rfl) hK hμ x).2 + have he : -‖x‖^2/(4*s)=-(1/(4*s))*‖x‖^2 := by ring + rw [he] at h + simpa only [A,mul_assoc,mul_left_comm] using mul_le_mul_of_nonneg_left h (show 0 ≤ (1+‖x‖^2)^m by positivity)) + theorem smoothedIntegrable_of_bound {F : Type u2} [NormedAddCommGroup F] + (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {s K : ℝ} (hs : 0 by simpa only [mul_assoc] using hb x) + theorem smoothedLog_continuous (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {s : ℝ} (hs : 0 Real.log (smoothedDensity μ s x)) := + (smoothedDensity_continuous μ hs).log (fun x => (smoothedDensity_pos μ hs x).ne') + theorem smoothedLog_constant (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {s K : ℝ} (hs : 0 smoothedDensity μ s x*Real.log (smoothedDensity μ s x)) := by + let D := |-(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*s)| + apply smoothedIntegrable_of_bound μ hs hK hμ + (((smoothedDensity_continuous μ hs).mul (smoothedLog_continuous μ hs)).aestronglyMeasurable) + (D+(1+K^2)/s) 1 + intro x + simp only [Pi.mul_apply] + simp only [Real.norm_eq_abs,abs_mul,abs_of_pos (smoothedDensity_pos μ hs x),pow_one] + have h := smoothedLog_polynomial_bound μ hs (show s∈Icc s s from ⟨le_rfl,le_rfl⟩) (abs_nonneg _) (show |-(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*s)| ≤ D from le_rfl) hK hμ x + nlinarith [mul_le_mul_of_nonneg_left h (smoothedDensity_pos μ hs x).le] + theorem smoothedLog_mul_integrable (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {s K : ℝ} (hs : 0 (1+Real.log (smoothedDensity μ s x))*g x) := by + obtain ⟨L,hL,hlog⟩ := smoothedLog_constant μ hs hK hμ + apply smoothedIntegrable_of_bound μ hs hK hμ + (((continuous_const.add (smoothedLog_continuous μ hs)).stronglyMeasurable.mul hg).aestronglyMeasurable) (L*C) 2 + intro x + simp only [Pi.mul_apply,Pi.add_apply] + rw [Real.norm_eq_abs,abs_mul] + calc _ ≤ (L*(1+‖x‖^2))*(C*(1+‖x‖^2)*smoothedDensity μ s x) := + mul_le_mul (hlog x) (hb x) (abs_nonneg _) (by positivity) + _ = _ := by ring + theorem smoothedScore_integrable (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {s K : ℝ} (hs : 0 (smoothedGradient μ s x i)^2/smoothedDensity μ s x) := by + let C := (1+K)/s + apply smoothedIntegrable_of_bound μ hs hK hμ + (((smoothedGradient_measurable μ s i).pow 2).div (smoothedDensity_continuous μ hs).stronglyMeasurable).aestronglyMeasurable (C^2) 2 + intro x + simp only [Pi.pow_apply,Pi.div_apply] + have hp := smoothedDensity_pos μ hs x + rw [Real.norm_eq_abs,abs_of_nonneg (by positivity)] + apply (div_le_iff₀ hp).mpr + have hb := smoothedGradient_polynomial_bound μ hs le_rfl hK hμ x i + have hh := pow_le_pow_left₀ (abs_nonneg _) hb 2 + simp only [sq_abs] at hh + dsimp only [C] + nlinarith +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianFlow.lean b/lean/OAI/Analysis/FreeEntropy/GaussianFlow.lean new file mode 100644 index 0000000000000000000000000000000000000000..47566739934bba938bdaebeefc558f78c56517d7 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianFlow.lean @@ -0,0 +1,74 @@ +import OAI.Analysis.FreeEntropy.MatrixFisherLiminf + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory ProbabilityTheory Set Filter +open scoped Topology +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] + theorem classicalEntropy_continuousOn (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {K : ℝ} (hK : 0 ≤ K) (hμ : ∀ᵐ y ∂μ,‖y‖ ≤ K) : + ContinuousOn (classicalEntropy μ) (Ioi 0) := by + intro s hs + exact (classicalEntropy_hasDeriv μ hK hμ hs).continuousAt.continuousWithinAt + theorem classicalFisher_intervalIntegrable (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {K a b : ℝ} (hK : 0 ≤ K) (hμ : ∀ᵐ y ∂μ,‖y‖ ≤ K) (ha : 0 (1/2:ℝ)*classicalFisher μ s) volume a b := + intervalIntegral.intervalIntegrable_deriv_of_nonneg + ((classicalEntropy_continuousOn μ hK hμ).mono (fun s hs => hmin.trans_le hs.1)) + (fun s hs => classicalEntropy_hasDeriv μ hK hμ (hmin.trans hs.1)) + (fun s hs => mul_nonneg (by norm_num) (classicalFisher_nonneg μ (hmin.trans hs.1))) + simpa only [← mul_assoc,show (2:ℝ)*(1/2:ℝ)=1 by norm_num,one_mul] using hi.const_mul (2:ℝ) + theorem classicalEntropy_flow (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {K a b : ℝ} (hK : 0 ≤ K) (hμ : ∀ᵐ y ∂μ,‖y‖ ≤ K) (ha : 0 classicalEntropy_hasDeriv μ hK hμ (hmin.trans_le hs.1)) + ((classicalFisher_intervalIntegrable μ hK hμ ha hb).const_mul (1/2:ℝ)) + simpa only [intervalIntegral.integral_const_mul] using he.symm + theorem smoothedDensity_cond_le (S : Set (EuclideanSpace ℝ ι)) {s : ℝ} (hs : 0 normalKernel s (x-y)) volume := (normalKernel_integrable (ι := ι) hs).comp_sub_left x + have hle := integral_mono_measure (Measure.restrict_le_self (μ := (volume : Measure (EuclideanSpace ℝ ι))) (s := S)) + (ae_of_all _ (fun y => (normalKernel_pos s (x-y)).le)) hi + rw [integral_sub_left_eq_self (μ := (volume : Measure (EuclideanSpace ℝ ι))),normalKernel_integral hs] at hle + simpa only [mul_one] using mul_le_mul_of_nonneg_left hle (inv_nonneg.mpr ENNReal.toReal_nonneg) + theorem classicalEntropy_cond_lower (S : Set (EuclideanSpace ℝ ι)) + (hS0 : volume S ≠ 0) (hSt : volume S ≠ ⊤) {K s : ℝ} + (hK : 0 ≤ K) (hμ : ∀ᵐ y ∂ProbabilityTheory.cond volume S,‖y‖ ≤ K) (hs : 0 + mul_le_mul_of_nonneg_left (hl x) (smoothedDensity_pos ν hs x).le)) + rw [integral_mul_const,smoothedDensity_integral ν hs,one_mul] at hh + change Real.log (volume S).toReal ≤ -(∫x,smoothedDensity ν s x*Real.log (smoothedDensity ν s x)) + linarith + theorem classicalEntropy_cond_flow_lower (S : Set (EuclideanSpace ℝ ι)) + (hS0 : volume S ≠ 0) (hSt : volume S ≠ ⊤) {K a b : ℝ} + (hK : 0 ≤ K) (hμ : ∀ᵐ y ∂ProbabilityTheory.cond volume S,‖y‖ ≤ K) (ha : 0 simp [realHermite_succ] + | succ n ih => + rw [realHermite_succ (n+1), derivative_sub, derivative_mul, derivative_X, one_mul, ih, + derivative_smul, mul_smul_comm] + calc + _ = realHermite (n+1) + (n+1 : ℝ) • (X * realHermite n - (realHermite n).derivative) := by module + _ = _ := by rw [← realHermite_succ]; push_cast; module + theorem realHermite_monic (n : ℕ) : (realHermite n).Monic := (Polynomial.hermite_monic n).map _ + theorem realHermite_degree (n : ℕ) : (realHermite n).degree = n := by + rw [realHermite, Polynomial.degree_map_eq_of_injective Int.cast_injective, Polynomial.degree_hermite] + def hermiteSequence : Polynomial.Sequence ℝ := ⟨realHermite, realHermite_degree⟩ + def hermiteBasis : Module.Basis ℕ ℝ ℝ[X] := hermiteSequence.basis (fun n => by + change IsUnit (realHermite n).leadingCoeff + rw [(realHermite_monic n).leadingCoeff]; exact isUnit_one) + @[simp] theorem hermiteBasis_apply (n : ℕ) : hermiteBasis n = realHermite n := by + simp [hermiteBasis, hermiteSequence] + def gaussianPolyIntegral (P : ℝ[X]) : ℝ := ∫ x, P.eval x ∂gaussianReal 0 1 + theorem gaussianPolyIntegral_add (P Q : ℝ[X]) : + gaussianPolyIntegral (P+Q) = gaussianPolyIntegral P + gaussianPolyIntegral Q := by + simp only [gaussianPolyIntegral, eval_add] + exact integral_add (gaussian_polynomial_integrable _ _ _) (gaussian_polynomial_integrable _ _ _) + theorem gaussianPolyIntegral_sub (P Q : ℝ[X]) : + gaussianPolyIntegral (P-Q) = gaussianPolyIntegral P - gaussianPolyIntegral Q := by + simp only [gaussianPolyIntegral, eval_sub] + exact integral_sub (gaussian_polynomial_integrable _ _ _) (gaussian_polynomial_integrable _ _ _) + theorem gaussianPolyIntegral_smul (r : ℝ) (P : ℝ[X]) : + gaussianPolyIntegral (r • P) = r * gaussianPolyIntegral P := by + simp [gaussianPolyIntegral, eval_smul, integral_const_mul] + @[simp] theorem gaussianPolyIntegral_one : gaussianPolyIntegral 1 = 1 := by simp [gaussianPolyIntegral] + @[simp] theorem gaussianPolyIntegral_zero : gaussianPolyIntegral 0 = 0 := by simp [gaussianPolyIntegral] + theorem hermite_raising_lowering (n : ℕ) (Q : ℝ[X]) : + gaussianPolyIntegral (realHermite (n+1) * Q) = gaussianPolyIntegral (realHermite n * Q.derivative) := by + have hs := gaussian_polynomial_stein (realHermite n * Q) + have hstein : gaussianPolyIntegral (X * (realHermite n * Q)) = + gaussianPolyIntegral ((realHermite n * Q).derivative) := by + simpa only [gaussianPolyIntegral, eval_mul, eval_X] using hs + rw [realHermite_succ, sub_mul, gaussianPolyIntegral_sub, mul_assoc, hstein, + derivative_mul, gaussianPolyIntegral_add] + ring + theorem realHermite_mean (n : ℕ) : gaussianPolyIntegral (realHermite n) = if n=0 then 1 else 0 := by + cases n with + | zero => simp + | succ n => simpa using hermite_raising_lowering n 1 + theorem realHermite_inner (n m : ℕ) : + gaussianPolyIntegral (realHermite n * realHermite m) = if n=m then (n.factorial : ℝ) else 0 := by + induction n generalizing m with + | zero => simpa [eq_comm] using realHermite_mean m + | succ n ih => + cases m with + | zero => simp [realHermite_mean] + | succ m => + rw [hermite_raising_lowering, realHermite_derivative, mul_smul_comm, gaussianPolyIntegral_smul, ih] + by_cases h : n=m + · subst m; simp [Nat.factorial_succ] + · simp [h] + def gaussianPolyLinear : ℝ[X] →ₗ[ℝ] ℝ where + toFun := gaussianPolyIntegral + map_add' := gaussianPolyIntegral_add + map_smul' := gaussianPolyIntegral_smul + theorem hermite_expansion (P : ℝ[X]) : P = (hermiteBasis.repr P).sum (fun n a => a • realHermite n) := by + simpa only [Finsupp.linearCombination_apply, hermiteBasis_apply] using (hermiteBasis.linearCombination_repr P).symm + theorem hermite_sum_inner (a b : ℕ →₀ ℝ) : + gaussianPolyIntegral (a.sum (fun n r => r • realHermite n) * b.sum (fun n r => r • realHermite n)) = + a.sum (fun n r => r * b n * (n.factorial : ℝ)) := by + classical + change gaussianPolyLinear _ = _ + simp only [Finsupp.sum, sum_mul, mul_sum, smul_mul_assoc, mul_smul_comm, + map_sum, map_smul, smul_eq_mul] + rw [sum_comm] + change (∑ n ∈ a.support, ∑ m ∈ b.support, b m*(a n*gaussianPolyIntegral (realHermite n*realHermite m))) = _ + simp_rw [realHermite_inner] + apply sum_congr rfl + intro n hn + by_cases hnb : n ∈ b.support + · rw [sum_eq_single n] + · simp; ring + · intro m hm hmn; simp [Ne.symm hmn] + · exact fun h => (h hnb).elim + · have hb : b n=0 := Finsupp.notMem_support_iff.mp hnb + rw [hb, mul_zero, zero_mul] + apply sum_eq_zero + intro m hm + have hnm : n ≠ m := fun h => hnb (h.symm ▸ hm) + simp [hnm] +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianIBP.lean b/lean/OAI/Analysis/FreeEntropy/GaussianIBP.lean new file mode 100644 index 0000000000000000000000000000000000000000..7a8f436ca866ad31344e0075206ec9359507b64f --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianIBP.lean @@ -0,0 +1,85 @@ +import OAI.Analysis.FreeEntropy.Basic + +namespace OAI + +universe u1 + +noncomputable section +open scoped ENNReal NNReal Polynomial +open MeasureTheory ProbabilityTheory Filter +namespace FiniteEntropySeparation + theorem gaussian_weight_integrable {E : Type u1} [NormedAddCommGroup E] [NormedSpace ℝ E] + {μ : ℝ} {v : ℝ≥0} (hv : v ≠ 0) {f : ℝ → E} : + Integrable f (gaussianReal μ v) ↔ Integrable (fun x => gaussianPDFReal μ v x • f x) := by + rw [gaussianReal_of_var_ne_zero _ hv] + simpa only [toReal_gaussianPDF] using integrable_withDensity_iff_integrable_smul' + (measurable_gaussianPDF μ v) (Filter.Eventually.of_forall (fun _ => gaussianPDF_lt_top)) + theorem hasDerivAt_gaussianPDFReal (μ : ℝ) (v : ℝ≥0) (hv : v ≠ 0) (x : ℝ) : + HasDerivAt (gaussianPDFReal μ v) (-(x-μ)/(v : ℝ) * gaussianPDFReal μ v x) x := by + have hv' : (v : ℝ) ≠ 0 := NNReal.coe_ne_zero.mpr hv + have hd := (hasDerivAt_const x (1 / Real.sqrt (2*Real.pi*(v : ℝ)))).mul + (((((hasDerivAt_id x).sub_const μ).pow 2).neg.div_const (2*(v : ℝ))).exp) + have he := hd.congr_deriv (show _ = -(x-μ)/(v : ℝ) * gaussianPDFReal μ v x by + unfold gaussianPDFReal + dsimp + field_simp + ring) + convert he using 1 + try rfl + funext y + simp [gaussianPDFReal, one_div] + + theorem gaussian_integrationByParts {μ : ℝ} {v : ℝ≥0} (hv : v ≠ 0) + {f f' : ℝ → ℝ} (hf : ∀ x, HasDerivAt f (f' x) x) + (hi : Integrable f (gaussianReal μ v)) (hi' : Integrable f' (gaussianReal μ v)) + (hx : Integrable (fun x => (x-μ)*f x) (gaussianReal μ v)) : + (∫ x, (x-μ)*f x ∂gaussianReal μ v) = (v : ℝ) * ∫ x, f' x ∂gaussianReal μ v := by + have h0 := (gaussian_weight_integrable hv).mp hi + have h1 := (gaussian_weight_integrable hv).mp hi' + have h2 := ((gaussian_weight_integrable hv).mp hx).const_mul (-(v : ℝ)⁻¹) + have h2' : Integrable (fun x => f x * (-(x-μ)/(v : ℝ) * gaussianPDFReal μ v x)) := by + convert h2 using 1 + ext x + simp only [smul_eq_mul, div_eq_mul_inv] + ring + have h1' : Integrable (fun x => f' x * gaussianPDFReal μ v x) := by + simpa only [smul_eq_mul, mul_comm] using h1 + have h0' : Integrable (fun x => f x * gaussianPDFReal μ v x) := by + simpa only [smul_eq_mul, mul_comm] using h0 + have he := integral_mul_deriv_eq_deriv_mul_of_integrable + (fun x _ => hf x) (fun x _ => hasDerivAt_gaussianPDFReal μ v hv x) h2' h1' h0' + have heq : (fun x => f x * (-(x-μ)/(v : ℝ) * gaussianPDFReal μ v x)) = + fun x => -(v : ℝ)⁻¹ * (gaussianPDFReal μ v x * ((x-μ)*f x)) := by + funext x; simp only [div_eq_mul_inv]; ring + rw [heq, integral_const_mul] at he + simp_rw [mul_comm (f' _) (gaussianPDFReal μ v _)] at he + rw [integral_gaussianReal_eq_integral_smul hv, integral_gaussianReal_eq_integral_smul hv] + simp only [smul_eq_mul] + have hv' : (v : ℝ) ≠ 0 := NNReal.coe_ne_zero.mpr hv + have hh := congrArg ((v : ℝ) * ·) he + field_simp at hh + simp only [mul_assoc] at hh + linarith + theorem gaussian_pow_integrable (μ : ℝ) (v : ℝ≥0) (n : ℕ) : + Integrable (fun x : ℝ => x^n) (gaussianReal μ v) := by + by_cases hn : n = 0 + · subst n; simp + have h := (memLp_id_gaussianReal' (μ := μ) (v := v) (n : ℝ≥0∞) (by simp)).integrable_norm_pow hn + apply h.mono' (by fun_prop) + exact Filter.Eventually.of_forall (fun x => by simp [norm_pow]) + theorem gaussian_polynomial_integrable (μ : ℝ) (v : ℝ≥0) (P : ℝ[X]) : + Integrable (fun x => P.eval x) (gaussianReal μ v) := by + classical + simp only [Polynomial.eval_eq_sum_range] + exact integrable_finsetSum _ (fun i _ => (gaussian_pow_integrable μ v i).const_mul _) + theorem gaussian_polynomial_stein (P : ℝ[X]) : + (∫ x, x*P.eval x ∂gaussianReal 0 1) = ∫ x, P.derivative.eval x ∂gaussianReal 0 1 := by + have hi := gaussian_polynomial_integrable 0 1 (Polynomial.X * P) + simpa only [sub_zero, NNReal.coe_one, one_mul] using gaussian_integrationByParts (by norm_num : (1 : ℝ≥0) ≠ 0) + (fun x => P.hasDerivAt x) (gaussian_polynomial_integrable 0 1 P) + (gaussian_polynomial_integrable 0 1 P.derivative) (by simpa using hi) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianKernel.lean b/lean/OAI/Analysis/FreeEntropy/GaussianKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..f27ead89df6c7ecdcdb71ac8154ef80d20a16a49 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianKernel.lean @@ -0,0 +1,87 @@ +import OAI.Analysis.FreeEntropy.GaussianDensity + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +open scoped ENNReal NNReal Topology +namespace FiniteEntropySeparation + variable {ι : Type u1} [Fintype ι] + def normalKernel (s : ℝ) (x : EuclideanSpace ℝ ι) : ℝ := + Real.exp (-(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*s)-‖x‖^2/(2*s)) + theorem normalKernel_pos (s : ℝ) (x : EuclideanSpace ℝ ι) : 0 integrable_gaussianPDFReal 0 ⟨s,hs.le⟩) + theorem normalKernel_integral {s : ℝ} (hs : 0 hs.ne' (congrArg (fun z : ℝ≥0 => (z:ℝ)) h)) + simp only [h,prod_const_one] + theorem normalKernel_continuous_space (s : ℝ) : Continuous (normalKernel (ι := ι) s) := by + unfold normalKernel + fun_prop + theorem normalKernel_continuousOn : ContinuousOn (fun z : ℝ × EuclideanSpace ℝ ι => normalKernel z.1 z.2) {z | 0 normalKernel t x) + ((-(Fintype.card ι:ℝ)/(2*s)+‖x‖^2/(2*s^2))*normalKernel s x) s := by + have hp : 2*Real.pi*s≠0 := by positivity + have hd := (((((hasDerivAt_id s).const_mul (2*Real.pi)).log hp).const_mul (-(Fintype.card ι:ℝ)/2)).sub + ((hasDerivAt_const s (‖x‖^2)).div ((hasDerivAt_id s).const_mul 2) (by positivity))).exp + convert hd using 1 + · rfl + · dsimp only [normalKernel,id_eq,Pi.sub_apply,Pi.div_apply] + rw [mul_comm _ (Real.exp _)] + congr 1 + field_simp [hs.ne',Real.pi_ne_zero] + ring + theorem normalKernel_hasDeriv_coordinate [DecidableEq ι] (s : ℝ) (x : EuclideanSpace ℝ ι) (i : ι) : + HasDerivAt (fun t : ℝ => normalKernel s (x+t • EuclideanSpace.single i 1)) + (-(x i)/s*normalKernel s x) 0 := by + classical + have hd : HasDerivAt (fun t : ℝ => ‖x+t • EuclideanSpace.single i 1‖^2) (2*x i) 0 := by + have h := ((hasDerivAt_const (0:ℝ) x).add ((hasDerivAt_id 0).smul_const (EuclideanSpace.single i 1))).norm_sq + simpa [real_inner_comm,PiLp.inner_apply,EuclideanSpace.single] using h + have h := ((hasDerivAt_const 0 (-(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*s))).sub (hd.div_const (2*s))).exp + convert h using 1 + · rfl + · dsimp only [Pi.sub_apply] + simp only [zero_smul,add_zero,normalKernel] + ring +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianL2Limit.lean b/lean/OAI/Analysis/FreeEntropy/GaussianL2Limit.lean new file mode 100644 index 0000000000000000000000000000000000000000..8202aa4e8b5c15fb18704abb4b69defc04e39605 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianL2Limit.lean @@ -0,0 +1,67 @@ +import OAI.Analysis.FreeEntropy.GUEConcentration + +namespace OAI + +universe u1 u2 u3 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Filter +open scoped Topology +namespace FiniteEntropySeparation + theorem norm_sum_sq_le_card {ι : Type u1} (s : Finset ι) (f : ι → ℂ) : + ‖∑ i ∈ s, f i‖^2 ≤ (s.card:ℝ) * ∑ i ∈ s, ‖f i‖^2 := by + calc + _ ≤ (∑ i ∈ s, ‖f i‖)^2 := pow_le_pow_left₀ (norm_nonneg _) (norm_sum_le _ _) 2 + _ ≤ _ := by + simpa using (sq_sum_le_card_mul_sum_sq (s := s) (f := fun i => ‖f i‖)) + theorem polynomial_sum_L2_tendsto {I : ℕ → Type} [∀ k,Fintype (I k)] [∀ k,DecidableEq (I k)] + {α : Type u2} (s : Finset α) (F : (k:ℕ) → α → (I k → ℝ) → ℂ) + (hF : ∀ k a,IsComplexPolynomial (F k a)) + (hlim : ∀ a ∈ s,Tendsto (fun k => ∫ x, ‖F k a x‖^2 ∂productGaussian (I k)) atTop (𝓝 0)) : + Tendsto (fun k => ∫ x, ‖∑ a ∈ s,F k a x‖^2 ∂productGaussian (I k)) atTop (𝓝 0) := by + apply squeeze_zero (fun k => integral_nonneg (fun _ => sq_nonneg _)) + (fun k => ?_) (by simpa using (tendsto_finsetSum s hlim).const_mul (s.card:ℝ)) + rw [← integral_finsetSum s (fun a _ => (hF k a).norm_sq.integrable),← integral_const_mul] + apply integral_mono ((IsComplexPolynomial.finset_sum s (fun a _ => hF k a)).norm_sq.integrable) + ((integrable_finsetSum s (fun a _ => (hF k a).norm_sq.integrable)).const_mul _) + intro x + exact norm_sum_sq_le_card s _ + theorem polynomial_const_mul_L2_tendsto {I : ℕ → Type} [∀ k,Fintype (I k)] [∀ k,DecidableEq (I k)] + (F : (k:ℕ) → (I k → ℝ) → ℂ) (c : ℂ) + (hlim : Tendsto (fun k => ∫ x, ‖F k x‖^2 ∂productGaussian (I k)) atTop (𝓝 0)) : + Tendsto (fun k => ∫ x, ‖c*F k x‖^2 ∂productGaussian (I k)) atTop (𝓝 0) := by + simp only [norm_mul,mul_pow,integral_const_mul] + simpa using hlim.const_mul (‖c‖^2) +namespace FreeSeries +variable {α β : Type} [Fintype α] [DecidableEq α] [Fintype β] [DecidableEq β] + +omit [DecidableEq α] [Fintype β] [DecidableEq β] in +theorem reparam_polynomial [DecidableEq α] [Fintype β] [DecidableEq β] {ι : Type u3} [Fintype ι] [DecidableEq ι] + (c : α → β → ℂ) (F : (ι → ℝ) → Series α) (hF : ∀ w,IsComplexPolynomial (fun x => F x w)) + (w : List β) : IsComplexPolynomial (fun x => reparam c (F x) w) := by + induction w generalizing F with + | nil => exact hF [] + | cons b w ih => + exact IsComplexPolynomial.finset_sum univ (fun a _ => (ih (fun x => deriv a (F x)) (fun v => hF (a::v))).const_mul (c a b)) + theorem reparam_L2_tendsto {I : ℕ → Type} [∀ k,Fintype (I k)] [∀ k,DecidableEq (I k)] + (c : α → β → ℂ) (F : (k:ℕ) → (I k → ℝ) → Series α) (M : Series α) + (hF : ∀ k w,IsComplexPolynomial (fun x => F k x w)) + (hlim : ∀ w,Tendsto (fun k => ∫ x, ‖F k x w-M w‖^2 ∂productGaussian (I k)) atTop (𝓝 0)) + (w : List β) : + Tendsto (fun k => ∫ x, ‖reparam c (F k x) w-reparam c M w‖^2 ∂productGaussian (I k)) atTop (𝓝 0) := by + induction w generalizing F M with + | nil => exact hlim [] + | cons b w ih => + simp only [reparam_cons,← Finset.sum_sub_distrib,← mul_sub] + apply polynomial_sum_L2_tendsto + · intro k a + exact ((reparam_polynomial c (fun x => deriv a (F k x)) (fun v => hF k (a::v)) w).sub (IsComplexPolynomial.const _)).const_mul _ + · intro a _ + apply polynomial_const_mul_L2_tendsto + exact ih (fun k x => deriv a (F k x)) (deriv a M) (fun k v => hF k (a::v)) (fun v => hlim (a::v)) +end FreeSeries +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianLinearTail.lean b/lean/OAI/Analysis/FreeEntropy/GaussianLinearTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..df3302793f83610834bfb1f69e2e1c3acd868fe9 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianLinearTail.lean @@ -0,0 +1,55 @@ +import OAI.Analysis.FreeEntropy.MicrostatesSelection + +namespace OAI + +universe u1 + +noncomputable section +open scoped NNReal +open MeasureTheory ProbabilityTheory Finset Set +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] + def gaussianLinear (c : ι → ℝ) (x : ι → ℝ) : ℝ := ∑ i, c i*x i + theorem gaussianLinear_exp_eq (c : ι → ℝ) (t : ℝ) : + (fun x => Real.exp (t*gaussianLinear c x)) = fun x => ∏ i, Real.exp ((t*c i)*x i) := by + funext x + rw [← Real.exp_sum] + congr 1 + simp [gaussianLinear, mul_sum, mul_assoc] + theorem gaussianLinear_exp_integrable (c : ι → ℝ) (t : ℝ) : + Integrable (fun x => Real.exp (t*gaussianLinear c x)) (productGaussian ι) := by + rw [gaussianLinear_exp_eq] + exact Integrable.fintype_prod (fun i => integrable_exp_mul_gaussianReal (t*c i)) + theorem gaussianLinear_mgf (c : ι → ℝ) (t : ℝ) : + mgf (gaussianLinear c) (productGaussian ι) t = Real.exp ((∑ i, c i^2)*t^2/2) := by + unfold mgf + rw [gaussianLinear_exp_eq] + unfold productGaussian + rw [integral_fintype_prod_eq_prod (fun i s => Real.exp ((t*c i)*s))] + have hi (i : ι) : (∫ s, Real.exp ((t*c i)*s) ∂gaussianReal 0 1) = Real.exp ((t*c i)^2/2) := by + simpa only [mgf, NNReal.coe_one, zero_mul, zero_add, one_mul] using congrFun (mgf_fun_id_gaussianReal (μ := 0) (v := 1)) (t*c i) + simp_rw [hi] + rw [← Real.exp_sum] + congr 1 + simp [mul_pow, sum_div, sum_mul] + ring_nf + theorem gaussianLinear_subgaussian (c : ι → ℝ) (K : ℝ≥0) (hK : (∑ i, c i^2) ≤ K) : + HasSubgaussianMGF (gaussianLinear c) K (productGaussian ι) where + integrable_exp_mul := gaussianLinear_exp_integrable c + mgf_le t := by rw [gaussianLinear_mgf]; apply Real.exp_le_exp.mpr; gcongr + theorem gaussianLinear_tail (c : ι → ℝ) (K : ℝ≥0) (hK : (∑ i, c i^2) ≤ K) {u : ℝ} (hu : 0 ≤ u) : + (productGaussian ι).real {x | u ≤ |gaussianLinear c x|} ≤ 2*Real.exp (-u^2/(2*K)) := by + have h := gaussianLinear_subgaussian c K hK + have hp := h.measure_ge_le hu + have hm := h.neg.measure_ge_le hu + have he : {x | u ≤ |gaussianLinear c x|} = {x | u ≤ gaussianLinear c x} ∪ {x | u ≤ -gaussianLinear c x} := by + ext x; simp only [Set.mem_ofPred_eq, Set.mem_union]; exact le_abs + rw [he] + calc + _ ≤ (productGaussian ι).real {x | u ≤ gaussianLinear c x} + (productGaussian ι).real {x | u ≤ -gaussianLinear c x} := measureReal_union_le _ _ + _ ≤ _ := by simpa only [Pi.neg_apply] using add_le_add hp hm |>.trans_eq (two_mul _).symm +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianMvStein.lean b/lean/OAI/Analysis/FreeEntropy/GaussianMvStein.lean new file mode 100644 index 0000000000000000000000000000000000000000..73ed38fb5695322fa751c89642036ee570d8c793 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianMvStein.lean @@ -0,0 +1,65 @@ +import OAI.Analysis.FreeEntropy.TensorPoincare + +namespace OAI + +universe u1 + +noncomputable section +open scoped Polynomial +open MeasureTheory ProbabilityTheory Finset +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] [DecidableEq ι] + theorem tensorHermite_coord_eq (a : ι → ℕ) (i : ι) : + (fun x => x i*tensorHermite a x) = + fun x => ∏ j, (if j=i then Polynomial.X*realHermite (a j) else realHermite (a j)).eval (x j) := by + funext x + rw [← mul_prod_erase univ _ (mem_univ i)] + have hh : tensorHermite a x = (realHermite (a i)).eval (x i)*∏ j ∈ univ.erase i, (realHermite (a j)).eval (x j) := by + simpa only [Function.update_eq_self] using tensorHermite_update a i (a i) x + rw [hh] + simp only [ite_true, Polynomial.eval_mul, Polynomial.eval_X, mul_assoc] + congr 2 + apply prod_congr rfl + intro j hj + rw [ite_eq_right (ne_of_mem_erase hj)] + theorem tensorHermite_coord_integrable (a : ι → ℕ) (i : ι) : + Integrable (fun x => x i*tensorHermite a x) (productGaussian ι) := by + rw [tensorHermite_coord_eq] + exact Integrable.fintype_prod (fun j => gaussian_polynomial_integrable 0 1 _) + theorem tensorHermite_stein (a : ι → ℕ) (i : ι) : + (∫ x, x i*tensorHermite a x ∂productGaussian ι) = ∫ x, tensorGradient a i x ∂productGaussian ι := by + rw [tensorHermite_coord_eq] + unfold tensorGradient productGaussian + rw [integral_fintype_prod_eq_prod (fun j t => (if j=i then Polynomial.X*realHermite (a j) else realHermite (a j)).eval t), + integral_fintype_prod_eq_prod (fun j t => (if j=i then (realHermite (a j)).derivative else realHermite (a j)).eval t)] + apply prod_congr rfl + intro j hj + by_cases h : j=i + · subst j + simpa only [ite_true, Polynomial.eval_mul, Polynomial.eval_X] using gaussian_polynomial_stein (realHermite (a i)) + · simp [h] + theorem linearExpand_coord {ι : Type u1} [Fintype ι] [DecidableEq ι] (a : (ι → ℕ) →₀ ℝ) (i : ι) : + (fun x => x i*linearExpand tensorHermite a x) = linearExpand (fun k x => x i*tensorHermite k x) a := by + funext x + simp only [linearExpand_apply, mul_sum] + apply sum_congr rfl + intro k hk + ring + theorem tensorExpansion_stein (a : (ι → ℕ) →₀ ℝ) (i : ι) : + (∫ x, x i*linearExpand tensorHermite a x ∂productGaussian ι) = + ∫ x, coordinateDerivative (linearExpand tensorHermite a) i x ∂productGaussian ι := by + rw [linearExpand_coord, tensorExpansion_derivative, + linearExpand_integral (fun k => tensorHermite_coord_integrable k i), + linearExpand_integral (fun k => tensorGradient_integrable k i)] + simp_rw [tensorHermite_stein] + theorem gaussian_mvPolynomial_stein (P : MvPolynomial ι ℝ) (i : ι) : + (∫ x, x i*MvPolynomial.eval x P ∂productGaussian ι) = + ∫ x, coordinateDerivative (fun y => MvPolynomial.eval y P) i x ∂productGaussian ι := by + obtain ⟨a,ha⟩ := mvPolynomial_hermite_expansion P + change (fun x => MvPolynomial.eval x P) = linearExpand tensorHermite a at ha + simpa only [← ha] using tensorExpansion_stein a i +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianProjectionMoments.lean b/lean/OAI/Analysis/FreeEntropy/GaussianProjectionMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..639206e3ec4b871d525c200394b81c8feaa41b6f --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianProjectionMoments.lean @@ -0,0 +1,49 @@ +import OAI.Analysis.FreeEntropy.BlockEvent + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] [DecidableEq ι] + theorem productGaussian_coordinate_second {ι : Type u1} [Fintype ι] [DecidableEq ι] (i : ι) : + (∫x : ι → ℝ,x i^2 ∂productGaussian ι)=1 := by + have hm := measurePreserving_eval (fun _ : ι => gaussianReal 0 1) i + have he := integral_map hm.measurable.aemeasurable + (show AEStronglyMeasurable (fun x : ℝ => x^2) (Measure.map (Function.eval i) (productGaussian ι)) from (continuous_id.pow 2).aestronglyMeasurable) + change (∫y : ℝ,y^2 ∂Measure.map (Function.eval i) (Measure.pi (fun _ : ι => gaussianReal 0 1)))=_ at he + rw [hm.map_eq,gaussian_square_integral] at he + exact he.symm + theorem normalLaw_coordinateMask_integrable {s : ℝ} (hs : 0 ‖coordinateMask m x‖^2) (normalLaw s) := by + rw [normalLaw_eq_scaled hs] + apply (integrable_map_measure (((coordinateMask_continuous m).norm.pow 2).aestronglyMeasurable) (by fun_prop : AEMeasurable (fun x : ι → ℝ => Real.sqrt s • WithLp.toLp 2 x) _)).mpr + change Integrable (fun x : ι → ℝ => ‖coordinateMask m (Real.sqrt s • WithLp.toLp 2 x)‖^2) (productGaussian ι) + simp only [coordinateMask_sq,PiLp.smul_apply,smul_eq_mul,mul_pow,Real.sq_sqrt hs.le,← mul_sum] + exact (integrable_finsetSum _ (fun i _ => ((IsRealPolynomial.coord i).pow 2).integrable)).const_mul s + theorem normalLaw_coordinateMask_integral {s : ℝ} (hs : 0 ‖coordinateMask m x‖^2) (Measure.map (fun x : ι → ℝ => Real.sqrt s • WithLp.toLp 2 x) (productGaussian ι)) := ((coordinateMask_continuous m).norm.pow 2).aestronglyMeasurable + rw [integral_map (by fun_prop) hm] + simp only [coordinateMask_sq,PiLp.smul_apply,smul_eq_mul,mul_pow,Real.sq_sqrt hs.le,← mul_sum] + rw [integral_const_mul,integral_finsetSum _ (fun i _ => ((IsRealPolynomial.coord i).pow 2).integrable)] + simp only [productGaussian_coordinate_second,sum_const,mul_one,nsmul_eq_mul] + theorem normalLaw_coordinateMask_markov {s r : ℝ} (hs : 0 ‖coordinateMask m x‖^2/r^2 + have hF := (normalLaw_coordinateMask_integrable hs m).div_const (r^2) + have hh := hF.measure_le_integral (ae_of_all _ (fun x => div_nonneg (sq_nonneg _) hz.le)) + (s := {x | r≤‖coordinateMask m x‖}) (fun x hx => by + dsimp at hx + rw [le_div_iff₀ hz,one_mul] + exact pow_le_pow_left₀ hr.le hx 2) + simpa only [integral_div,normalLaw_coordinateMask_integral hs m] using hh +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianRegularity.lean b/lean/OAI/Analysis/FreeEntropy/GaussianRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..c572902603271f80830bd43a12c811cbfc34ca60 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianRegularity.lean @@ -0,0 +1,92 @@ +import OAI.Analysis.FreeEntropy.GaussianConvolutionBounds + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory Set +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] + theorem smoothedGradient_measurable (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + (s : ℝ) (i : ι) : StronglyMeasurable (fun x => smoothedGradient μ s x i) := by + exact (((normalGradient_continuous s i).comp (continuous_fst.sub continuous_snd)).stronglyMeasurable).integral_prod_right' + theorem smoothedSecond_measurable (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + (s : ℝ) (i : ι) : StronglyMeasurable (fun x => smoothedSecond μ s x i) := by + exact (((normalSecond_continuous s i).comp (continuous_fst.sub continuous_snd)).stronglyMeasurable).integral_prod_right' + theorem smoothedTime_measurable (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + (s : ℝ) : StronglyMeasurable (smoothedTimeDerivative μ s) := by + have hc : Continuous (fun z : EuclideanSpace ℝ ι × EuclideanSpace ℝ ι => normalTimeDerivative s (z.1-z.2)) := by + unfold normalTimeDerivative normalKernel + fun_prop + exact hc.stronglyMeasurable.integral_prod_right' + theorem smoothedSecond_bound (μ : Measure (EuclideanSpace ℝ ι)) [IsFiniteMeasure μ] + {a s K : ℝ} (ha : 0 normalSecond s (x-y) i) μ := integrable_of_normBound μ hμ ((normalSecond_continuous s i).comp (continuous_const.sub continuous_id)) + calc + _ ≤ ∫y,|normalSecond s (x-y) i| ∂μ := by simpa only [smoothedSecond,Real.norm_eq_abs] using norm_integral_le_integral_norm (fun y => normalSecond s (x-y) i) + _ ≤ ∫y,(((‖x‖+K)^2/a^2)+1/a)*normalKernel s (x-y) ∂μ := by + apply integral_mono_ae hi.norm ((normalKernel_integrable_finite μ hs0 x).const_mul _) + filter_upwards [hμ] with y hy + unfold normalSecond + rw [Real.norm_eq_abs,abs_mul,abs_of_pos (normalKernel_pos _ _)] + apply mul_le_mul_of_nonneg_right _ (normalKernel_pos _ _).le + have hn0 : |(x-y) i| ≤ ‖x-y‖ := by simpa only [Real.norm_eq_abs] using PiLp.norm_apply_le (x-y) i + have hn : |(x-y) i| ≤ ‖x‖+K := hn0.trans ((norm_sub_le x y).trans (add_le_add le_rfl hy)) + have hn2 : ((x-y) i)^2 ≤ (‖x‖+K)^2 := by simpa only [sq_abs] using pow_le_pow_left₀ (abs_nonneg _) hn 2 + calc + _ ≤ |((x-y) i)^2/s^2|+|1/s| := abs_sub _ _ + _ = ((x-y) i)^2/s^2+1/s := by rw [abs_of_nonneg (by positivity),abs_of_pos (by positivity)] + _ ≤ _ := add_le_add + ((div_le_div_of_nonneg_right hn2 (sq_nonneg s)).trans (div_le_div_of_nonneg_left (sq_nonneg _) (by positivity) (pow_le_pow_left₀ ha.le hs 2))) + (one_div_le_one_div_of_le ha hs) + _ = _ := integral_const_mul _ _ + theorem smoothedSecond_polynomial_bound (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {a s K : ℝ} (ha : 0 ring + theorem smoothedGradient_polynomial_bound (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {a s K : ℝ} (ha : 0 smoothedSecond_polynomial_bound μ ha hs hK hμ x i)) (by norm_num) + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul]; ring + theorem smoothedLog_polynomial_bound (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {a b s D K : ℝ} (ha : 0 f (WithLp.ofLp x)) + (fun x => coordinateDerivative f i (WithLp.ofLp x)) + (smoothedDensity μ s) (fun x => smoothedGradient μ s x i) + (fun x r => hf.hasDerivAt_line x i r) + (fun x r => smoothedDensity_hasDeriv_coordinate μ (isCompact_closedBall _ _) hm s x i r) + (hf.smoothedGradient_integrable μ hs hK hμ i) + ((hf.derivative i).smoothed_integrable μ hs hK hμ) + (hf.smoothed_integrable μ hs hK hμ) + theorem smoothed_score_lower (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {K s : ℝ} (hK : 0≤K) (hμ : ∀ᵐy ∂μ,‖y‖≤K) (hs : 0 (2*coordinateDerivative f i (WithLp.ofLp x)-f (WithLp.ofLp x)^2)*smoothedDensity μ s x) = + fun x => 2*(coordinateDerivative f i (WithLp.ofLp x)*smoothedDensity μ s x)-f (WithLp.ofLp x)^2*smoothedDensity μ s x := by + funext x; ring + rw [he,integral_sub (hd.const_mul 2) hsq,integral_const_mul] + linarith + theorem classicalFisher_polynomial_lower (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] + {K s : ℝ} (hK : 0≤K) (hμ : ∀ᵐy ∂μ,‖y‖≤K) (hs : 0 smoothed_score_lower μ hK hμ hs (hf i) i) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GaussianVolume.lean b/lean/OAI/Analysis/FreeEntropy/GaussianVolume.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f1de1122750cdf812a0347f67b30d2175b2685a --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GaussianVolume.lean @@ -0,0 +1,52 @@ +import OAI.Analysis.FreeEntropy.TensorHermite + +namespace OAI + +universe u1 u2 u3 u4 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Set +open scoped ENNReal +namespace FiniteEntropySeparation + theorem measure_pi_mono {ι : Type u1} [Fintype ι] {α : ι → Type u2} [∀ i,MeasurableSpace (α i)] + (μ ν : (i:ι) → Measure (α i)) [∀i,SigmaFinite (μ i)] (h : ∀i,μ i≤ν i) : + Measure.pi μ ≤ Measure.pi ν := by + have ho : (Measure.pi μ).toOuterMeasure ≤ OuterMeasure.pi (fun i => (ν i).toOuterMeasure) := by + rw [OuterMeasure.le_pi] + intro s _ + change Measure.pi μ (Set.pi univ s) ≤ _ + rw [Measure.pi_pi] + exact prod_le_prod (fun i _ => h i (s i)) + rw [Measure.le_iff] + intro s hs + conv_rhs => rw [Measure.pi, toMeasure_apply _ _ hs] + exact ho s + theorem gaussianPDF_le_one (x : ℝ) : gaussianPDF 0 1 x ≤ 1 := by + rw [gaussianPDF] + apply ENNReal.ofReal_le_one.mpr + have hp : 1 ≤ Real.sqrt (2*Real.pi) := by nlinarith [Real.sq_sqrt (show 0≤2*Real.pi by positivity),Real.sqrt_nonneg (2*Real.pi),Real.pi_gt_three] + have he : Real.exp (-(x-0)^2/(2:ℝ)) ≤ 1 := Real.exp_le_one_iff.mpr (by nlinarith [sq_nonneg (x-0)]) + dsimp [gaussianPDFReal] + norm_num only [NNReal.coe_one, mul_one] + calc + _ ≤ (Real.sqrt (2*Real.pi))⁻¹ * 1 := mul_le_mul_of_nonneg_left he (inv_nonneg.mpr (Real.sqrt_nonneg _)) + _ ≤ 1 := by rw [mul_one]; exact (inv_le_one₀ (by positivity)).2 hp + theorem gaussianReal_le_volume : gaussianReal 0 1 ≤ (volume : Measure ℝ) := by + rw [Measure.le_iff'] + intro s + rw [gaussianReal_apply 0 one_ne_zero s] + calc + _ ≤ ∫⁻ _ : ℝ in s, (1:ℝ≥0∞) := lintegral_mono (fun x => gaussianPDF_le_one x) + _ = volume s := by simp + theorem productGaussian_le_volume (ι : Type u3) [Fintype ι] : + productGaussian ι ≤ (volume : Measure (ι → ℝ)) := + measure_pi_mono _ _ (fun _ => gaussianReal_le_volume) + theorem productGaussian_toLp_le_volume (ι : Type u4) [Fintype ι] (s : Set (EuclideanSpace ℝ ι)) : + productGaussian ι (WithLp.toLp 2 ⁻¹' s) ≤ volume s := by + apply (productGaussian_le_volume ι _).trans + exact (PiLp.volume_preserving_toLp ι).measure_preimage_le s +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/GeometricTail.lean b/lean/OAI/Analysis/FreeEntropy/GeometricTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..591fb617337073c3fdd34a0d7ffb025c8376bddb --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/GeometricTail.lean @@ -0,0 +1,62 @@ +import OAI.Analysis.FreeEntropy.WickCoefficients + +namespace OAI + +noncomputable section +namespace FiniteEntropySeparation +open Finset + +def geometricCumulantTail (K u : ℝ) (k : ℕ) : ℝ := + if 2 ≤ k then u⁻¹^k * K^(2*(k+1)) else 0 + theorem geometricCumulantTail_nonneg (K u : ℝ) (hu : 0 ≤ u) (k : ℕ) : + 0 ≤ geometricCumulantTail K u k := by + unfold geometricCumulantTail + split_ifs + · exact mul_nonneg (pow_nonneg (inv_nonneg.mpr hu) _) (pow_nonneg (sq_nonneg K) (k+1) |>.trans_eq (pow_mul K 2 (k+1)).symm) + · rfl + theorem geometricCumulantTail_factor (K u : ℝ) (k : ℕ) : + u⁻¹^k * K^(2*(k+1)) = K^2 * (K^2/u)^k := by + rw [Nat.mul_add, pow_add, pow_mul, div_pow, div_eq_mul_inv, inv_pow] + ring + theorem geometricCumulantTail_shift (K u : ℝ) (k : ℕ) : + geometricCumulantTail K u (k+2) = (K^6/u^2) * (K^2/u)^k := by + rw [geometricCumulantTail, ite_eq_left (by omega), geometricCumulantTail_factor, pow_add] + rw [div_pow, div_eq_mul_inv, div_eq_mul_inv] + ring + theorem geometricCumulantTail_summable {K u : ℝ} (hu : 0 < u) (hk : K^2 < u) : + Summable (geometricCumulantTail K u) := by + have hr : ‖K^2/u‖ < 1 := by + rw [Real.norm_eq_abs, abs_of_nonneg (div_nonneg (sq_nonneg _) hu.le)] + exact (div_lt_one hu).mpr hk + apply (summable_nat_add_iff 2).mp + simp_rw [geometricCumulantTail_shift] + exact (summable_geometric_of_norm_lt_one hr).mul_left _ + theorem geometricCumulantTail_tsum {K u : ℝ} (hu : 0 < u) (hk : K^2 < u) : + ∑' k, geometricCumulantTail K u k = (K^6/u^2) * (1-K^2/u)⁻¹ := by + have hh := geometricCumulantTail_summable hu hk + have hr : ‖K^2/u‖ < 1 := by + rw [Real.norm_eq_abs, abs_of_nonneg (div_nonneg (sq_nonneg _) hu.le)] + exact (div_lt_one hu).mpr hk + rw [← hh.sum_add_tsum_nat_add 2] + have hz : ∑ i ∈ range 2, geometricCumulantTail K u i = 0 := by + norm_num [sum_range_succ, geometricCumulantTail] + rw [hz, zero_add] + simp_rw [geometricCumulantTail_shift] + rw [tsum_mul_left, tsum_geometric_of_norm_lt_one hr] + theorem geometricCumulantTail_le {K u : ℝ} (hu : 0 < u) (hk : 2*K^2 ≤ u) : + ∑' k, geometricCumulantTail K u k ≤ 2*K^6/u^2 := by + have hk' : K^2 < u := by nlinarith [sq_nonneg K] + rw [geometricCumulantTail_tsum hu hk'] + have hr : K^2/u ≤ 1/2 := (div_le_iff₀ hu).mpr (by linarith) + have hd : 0 < 1 - K^2/u := by linarith + have hi : (1-K^2/u)⁻¹ ≤ 2 := by + rw [← one_div] + exact (div_le_iff₀ hd).mpr (by linarith) + calc + _ ≤ (K^6/u^2) * 2 := mul_le_mul_of_nonneg_left hi (by positivity) + _ = _ := by ring +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/HeatAnalysis.lean b/lean/OAI/Analysis/FreeEntropy/HeatAnalysis.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c805779eb809e28563f711c050228dddf531d2d --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/HeatAnalysis.lean @@ -0,0 +1,99 @@ +import OAI.Analysis.FreeEntropy.EntropyFiniteness + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal Topology +open MeasureTheory Filter Set Finset +namespace FiniteEntropySeparation +namespace Model +open FreeTensor +variable (p : ℕ) [NeZero p] +def heatFisherReal (u : ℝ) : ℝ := (freeFisher (τ p) (X p u)).toReal + theorem heatFisher_ne_top (u : ℝ) (hu : 0 < u) : freeFisher (τ p) (X p u) ≠ ⊤ := by + exact ne_top_of_le_ne_top ENNReal.ofReal_ne_top + (heat_freeFisher_le ∅ (C p) (C_mem_background p ∅) (initialIndex p) + (initialIndex_injective p) (by simp) u hu) + theorem heatFisherReal_upper (u : ℝ) (hu : 0 < u) : heatFisherReal p u ≤ (p+1 : ℕ)/u := by + have he := heat_freeFisher_le ∅ (C p) (C_mem_background p ∅) (initialIndex p) + (initialIndex_injective p) (by simp) u hu + exact (ENNReal.toReal_le_toReal (heatFisher_ne_top p u hu) ENNReal.ofReal_ne_top).mpr he |>.trans_eq + (ENNReal.toReal_ofReal (by positivity)) + theorem heatFisherReal_lower (u : ℝ) (hu : 0 < u) : covarianceFisher p u ≤ heatFisherReal p u := by + obtain ⟨ξ,hξ⟩ := heat_conjugates_exist ∅ (C p) (C_mem_background p ∅) (initialIndex p) + (initialIndex_injective p) (by simp) u hu + change ConjugateSystem (τ p) (X p u) ξ at hξ + unfold heatFisherReal + rw [freeFisher_eq_of_conjugate _ hξ, ENNReal.toReal_ofReal (sum_nonneg (fun _ _ => sq_nonneg _))] + apply sum_le_sum + intro i _ + simpa only [X_variance p u hu.le, one_div] using conjugate_norm_sq_lower (τ p) hξ i + theorem heatFisherReal_measurable : Measurable (fun u : Ioi (0 : ℝ) => heatFisherReal p u) := + ENNReal.measurable_toReal.comp (heat_freeFisher_measurable ∅ (C p) (C_mem_background p ∅) + (initialIndex p) (initialIndex_injective p) (by simp)) + theorem heatFisherReal_shift_aesm (a : ℝ) (ha : 0 < a) : + AEStronglyMeasurable (fun s => heatFisherReal p (a+s)) (volume.restrict (Ioi 0)) := by + let g : ℝ → Ioi (0 : ℝ) := fun s => ⟨a+max s 0, by exact lt_of_lt_of_le ha (le_add_of_nonneg_right (le_max_right s 0))⟩ + have hg : Continuous g := by continuity + have hm := ((heatFisherReal_measurable p).comp hg.measurable).aestronglyMeasurable (μ := volume.restrict (Ioi 0)) + apply hm.congr + filter_upwards [ae_restrict_mem measurableSet_Ioi] with s hs + change heatFisherReal p (a+max s 0) = _ + rw [max_eq_left (le_of_lt hs)] + theorem fisherDeficit_nonneg (u : ℝ) (hu : 0 < u) : 0 ≤ fisherDeficit p u := + sub_nonneg.mpr (heatFisherReal_lower p u hu) + theorem fisherDeficit_upper (hp : 2 ≤ p) (u : ℝ) (hu : 0 < u) : + fisherDeficit p u ≤ (p+1 : ℕ)/u^2 := by + have he (i : Fin (p+1)) : u⁻¹ - (variance p i + u)⁻¹ ≤ u⁻¹^2 := by + have hv := variance_nonneg p i + have hv1 := variance_le_one p hp i + have hd : 0 < variance p i + u := by linarith + have hi := one_div_le_one_div_of_le hu (by linarith : u ≤ variance p i + u) + have hid : (variance p i + u)⁻¹ ≤ u⁻¹ := by simpa only [one_div] using hi + have heq : u⁻¹ - (variance p i + u)⁻¹ = variance p i * u⁻¹ * (variance p i+u)⁻¹ := by + field_simp; ring + rw [heq] + calc + _ ≤ 1 * u⁻¹ * u⁻¹ := mul_le_mul (mul_le_mul_of_nonneg_right hv1 (by positivity)) hid + (by positivity) (by positivity) + _ = _ := by ring + change heatFisherReal p u - covarianceFisher p u ≤ _ + calc + _ ≤ (p+1 : ℕ)/u - covarianceFisher p u := sub_le_sub_right (heatFisherReal_upper p u hu) _ + _ = ∑ i : Fin (p+1), (u⁻¹ - (variance p i + u)⁻¹) := by + simp [covarianceFisher, sum_sub_distrib, div_eq_mul_inv] + _ ≤ ∑ _i : Fin (p+1), u⁻¹^2 := sum_le_sum (fun i _ => he i) + _ = _ := by simp [div_eq_mul_inv, inv_pow] + theorem heatFisherReal_broad_lower (hp : 2 ≤ p) (u : ℝ) (hu : 0 < u) : + (p+1 : ℕ)/(u+4) ≤ heatFisherReal p u := by + apply le_trans _ (heatFisherReal_lower p u hu) + have he (i : Fin (p+1)) : 1/(u+4) ≤ (variance p i+u)⁻¹ := by + rw [← one_div] + exact one_div_le_one_div_of_le (by linarith [variance_nonneg p i]) + (by linarith [variance_le_one p hp i]) + simpa [covarianceFisher, div_eq_mul_inv] using sum_le_sum (s := (univ : Finset (Fin (p+1)))) (fun i _ => he i) + theorem entropyIntegrand_integrable (hp : 2 ≤ p) (a : ℝ) (ha : 0 < a) : + IntegrableOn (fun s => (p+1 : ℕ)/(1+s) - heatFisherReal p (a+s)) (Ioi 0) := by + have hm : AEStronglyMeasurable (fun s : ℝ => (p+1 : ℕ)/(1+s)) (volume.restrict (Ioi 0)) := by + exact (by fun_prop : Measurable (fun s : ℝ => (p+1 : ℕ)/(1+s))).aestronglyMeasurable + apply integrable_of_le_of_le (hm.sub (heatFisherReal_shift_aesm p a ha)) + (g₁ := fun s => (p+1 : ℕ) * reciprocalDifference a s) + (g₂ := fun s => (p+1 : ℕ) * reciprocalDifference (a+4) s) + · filter_upwards [ae_restrict_mem measurableSet_Ioi] with s hs + have he := heatFisherReal_upper p (a+s) (by linarith [show 0 if i=b then 1 else 0) + (fun i => if i=b then (Real.sqrt u : ℂ) else 0) a +@[simp] theorem heatCoefficients_left (u : ℝ) (a b : Fin n) : + heatCoefficients u (leftIndex a) b = if a=b then 1 else 0 := Fin.addCases_left a +@[simp] theorem heatCoefficients_right (u : ℝ) (a b : Fin n) : + heatCoefficients u (rightIndex a) b = if a=b then (Real.sqrt u : ℂ) else 0 := Fin.addCases_right a + theorem heatCoefficients_R (u : ℝ) (hu : 0 ≤ u) (R : Series (Fin n)) : + reparam (heatCoefficients u) (gaussianJointR R) = R + (u : ℂ) • quadratic := by + rw [gaussianJointR, reparam_add, reparam_liftSeries, reparam_liftSeries] + simp only [heatCoefficients_left, heatCoefficients_right, reparam_identity, reparam_scalar_quadratic] + congr 2 + exact_mod_cast Real.sq_sqrt hu +end FreeSeries + +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] +variable {n : ℕ} + theorem heat_linear_tuple (X : Fin n → Space B N G →L[ℂ] Space B N G) + (σ : Fin n → N) (u : ℝ) : + (fun i => ∑ j, heatCoefficients u j i • jointTuple X σ j) = + heatTuple X (fun i => semicircularN (σ i)) u := by + funext i + rw [Fin.sum_univ_add] + change (∑ j : Fin n, heatCoefficients u (leftIndex j) i • jointTuple X σ (leftIndex j)) + + (∑ j : Fin n, heatCoefficients u (rightIndex j) i • jointTuple X σ (rightIndex j)) = _ + simp only [heatCoefficients_left, heatCoefficients_right, jointTuple_left, + jointTuple_right, ite_smul, one_smul, + zero_smul ℂ (A := Space B N G →L[ℂ] Space B N G), Finset.sum_ite_eq', + Finset.mem_univ, ite_true, heatTuple] + +theorem heat_moments_cumulants (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) (hX : ∀ i, X i ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) + (u : ℝ) (hu : 0 ≤ u) : + wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u) = + moments (cumulants (wordMoment (tracialVector B N G) X) + (u : ℂ) • quadratic) := by + rw [← heat_linear_tuple X σ u, ← reparam_wordMoment, + joint_moments_cumulants J X hX σ hσ hs, + reparam_moments (heatCoefficients u) (gaussianJointR_nil _ (cumulants_nil _)), + heatCoefficients_R u hu] + theorem heat_cumulants (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) (hX : ∀ i, X i ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) + (u : ℝ) (hu : 0 ≤ u) : + cumulants (wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u)) = + cumulants (wordMoment (tracialVector B N G) X) + (u : ℂ) • quadratic := by + let R := cumulants (wordMoment (tracialVector B N G) X) + (u : ℂ) • quadratic + have hR : R [] = 0 := by simp [R] + rw [heat_moments_cumulants J X hX σ hσ hs u hu] + exact (cumulants_unique (moments_nil _) (moments_eq hR)).symm +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/HeatTensor.lean b/lean/OAI/Analysis/FreeEntropy/HeatTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..659bdd9b119bf3520e7f1c72ab306b854190c5f6 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/HeatTensor.lean @@ -0,0 +1,132 @@ +import OAI.Analysis.FreeEntropy.TracialRealization + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate lp +open MeasureTheory Filter +namespace FiniteEntropySeparation +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] + + theorem semicircularB_norm_le {B N G : Type} [Group G] + [DecidableEq B] [DecidableEq N] [DecidableEq G] (b : B) : ‖semicircularB (N := N) (G := G) b‖ ≤ 2 := by + have h : ‖creationB (N := N) (G := G) b‖ ≤ 1 := + LinearIsometry.norm_toContinuousLinearMap_le _ + calc + _ ≤ ‖creationB (N := N) (G := G) b‖ + ‖star (creationB b)‖ := norm_add_le _ _ + _ ≤ 1 + 1 := add_le_add h (by simpa [ContinuousLinearMap.star_eq_adjoint] using h) + _ = 2 := by norm_num + + theorem semicircularN_norm_le (i : N) : ‖semicircularN (B := B) (G := G) i‖ ≤ 2 := by + have h : ‖creationN (B := B) (G := G) i‖ ≤ 1 := + LinearIsometry.norm_toContinuousLinearMap_le _ + calc + _ ≤ ‖creationN (B := B) (G := G) i‖ + ‖star (creationN i)‖ := norm_add_le _ _ + _ ≤ 1 + 1 := add_le_add h (by simpa [ContinuousLinearMap.star_eq_adjoint] using h) + _ = 2 := by norm_num + + theorem vacuumBoundary_eq_rankOne : + vacuumBoundary (B := B) (N := N) (G := G) = vacuumRankOne (tracialVector B N G) := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change vacuumBoundary (lp.single 2 w z) = _ + rw [vacuumBoundary_single] + by_cases hw : w = empty + · subst w + simp [vacuumRankOne, tracialVector, basis, lp.inner_single_left] + simpa using (lp.single_smul (E := fun _ : Word B N G => ℂ) 2 (empty : Word B N G) z (1 : ℂ)) + · simp [hw, vacuumRankOne, tracialVector, basis, lp.inner_single_left, lp.single_apply, Ne.symm hw] + + theorem rightAnnihilationN_semicircularN (i j : N) : + star (rightCreationN (B := B) (G := G) i) * semicircularN j = + semicircularN j * star (rightCreationN i) + if i = j then + vacuumRankOne (tracialVector B N G) else 0 := by + have h : Commute (creationN (B := B) (G := G) j) (rightCreationN i) := + LabelHilbert.lift_commute _ _ _ _ (leftN_rightN j i) + have hs := h.star_star.symm.eq + rw [semicircularN, mul_add, add_mul, rightAnnihilationN_creationN, hs, + vacuumBoundary_eq_rankOne] + abel + + theorem rightAnnihilationN_commutes_semicircularB (i : N) (b : B) : + Commute (star (rightCreationN (G := G) i)) (semicircularB b) := by + have h : Commute (creationB (G := G) b) (rightCreationN i) := + LabelHilbert.lift_commute _ _ _ _ (leftB_rightN b i) + exact (creationB_commutes_rightAnnihilationN b i).symm.add_right h.star_star.symm + +def backgroundAlgebra (J : Set N) : Subalgebra ℂ (Space B N G →L[ℂ] Space B N G) := + Algebra.adjoin ℂ (Set.range semicircularB ∪ Set.range unitaryG ∪ semicircularN '' J) + + theorem rightAnnihilationN_background {i : N} {J : Set N} (hi : i ∉ J) + {T : Space B N G →L[ℂ] Space B N G} (hT : T ∈ backgroundAlgebra J) : + Commute (star (rightCreationN i)) T := by + induction hT using Algebra.adjoin_induction with + | mem T hT => + rcases hT with ((⟨b,rfl⟩ | ⟨g,rfl⟩) | ⟨j,hj,rfl⟩) + · exact rightAnnihilationN_commutes_semicircularB i b + · exact (unitaryG_commutes_rightAnnihilationN g i).symm + · have hij : i ≠ j := fun h => hi (h ▸ hj) + show _ * _ = _ * _ + simpa [hij] using rightAnnihilationN_semicircularN (B := B) (G := G) i j + | algebraMap z => exact (Algebra.commute_algebraMap_left z _).symm + | add T U _ _ hT hU => exact hT.add_right hU + | mul T U _ _ hT hU => exact hT.mul_right hU + +theorem heat_freeFisher_le {n : ℕ} (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ i, X i ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) + (u : ℝ) (hu : 0 < u) : + freeFisher (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u) ≤ + ENNReal.ofReal ((n : ℝ) / u) := by + let Z := heatTuple X (fun i => semicircularN (σ i)) u + let η : Fin n → Space B N G := fun i => + ((Real.sqrt u)⁻¹ : ℂ) • basis (leftN (σ i) empty) + have hc (i j : Fin n) : star (rightCreationN (σ i)) * Z j = + Z j * star (rightCreationN (σ i)) + + if j = i then (Real.sqrt u : ℂ) • vacuumRankOne (tracialVector B N G) else 0 := by + change _ * (X j + (Real.sqrt u : ℂ) • semicircularN (σ j)) = _ + rw [mul_add, mul_smul_comm, (rightAnnihilationN_background (hs i) (hX j)).eq, + rightAnnihilationN_semicircularN] + change _ = (X j + (Real.sqrt u : ℂ) • semicircularN (σ j)) * + star (rightCreationN (σ i)) + + if j = i then (Real.sqrt u : ℂ) • vacuumRankOne (tracialVector B N G) else 0 + by_cases hij : j = i + · subst j + simp only [ite_true, add_mul, smul_mul_assoc, add_assoc] + congr 1 + exact smul_add _ _ _ + · have hneq : σ i ≠ σ j := fun h => hij (hσ h).symm + simp only [hij, hneq, ↓reduceIte, add_zero, add_mul, smul_mul_assoc] + have hu' : Real.sqrt u ≠ 0 := ne_of_gt (Real.sqrt_pos.mpr hu) + have hη (i : Fin n) (w : List (Fin n)) : + inner ℂ (η i) (wordEval Z w (tracialVector B N G).vacuum) = + derivativeMoment (tracialVector B N G) Z i w := by + have h := commutator_integration_by_parts (tracialVector B N G) Z + (star (rightCreationN (σ i))) i (Real.sqrt u) (hc i) + (by simp [tracialVector, basis, empty]) w + simp only [star_star, tracialVector, basis, rightCreationN_single] at h + have he : rightN (σ i) (empty : Word B N G) = leftN (σ i) empty := by + simp [rightN_eq_append, empty, leftN, push, append] + rw [he] at h + change inner ℂ (((Real.sqrt u : ℂ)⁻¹) • lp.single 2 (leftN (σ i) empty) 1) + (wordEval Z w (lp.single 2 empty 1)) = _ + rw [inner_smul_left, h] + simp [hu', tracialVector, basis] + refine (freeFisher_le_testVectors (tracialVector B N G) Z η hη).trans ?_ + apply ENNReal.ofReal_le_ofReal + have hnorm (i : Fin n) : ‖η i‖ ^ 2 = u⁻¹ := by + simp [η, norm_smul, basis, norm_inv, + lp.norm_single (E := fun _ : Word B N G => ℂ) (p := 2), + abs_of_nonneg (Real.sqrt_nonneg u), inv_pow, Real.sq_sqrt (le_of_lt hu)] + simp [hnorm, div_eq_mul_inv] + +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/L2Convergence.lean b/lean/OAI/Analysis/FreeEntropy/L2Convergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..87d3752cf14fa5fc60e6ff3860246fbcee2fafff --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/L2Convergence.lean @@ -0,0 +1,95 @@ +import OAI.Analysis.FreeEntropy.RandomHeatMoments + +namespace OAI + +universe u1 u2 u3 u4 u5 u6 u7 + +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +namespace FiniteEntropySeparation + theorem integral_sq_le_integral_square {Ω : Type u1} [MeasurableSpace Ω] (μ : Measure Ω) + [IsProbabilityMeasure μ] {f : Ω → ℝ} (hf : Integrable f μ) (hf2 : Integrable (fun x => (f x)^2) μ) : + (∫ x,f x ∂μ)^2 ≤ ∫x,(f x)^2 ∂μ := by + let m := ∫x,f x ∂μ + have h : 0≤∫x,(f x-m)^2 ∂μ := integral_nonneg (fun x => sq_nonneg (f x-m)) + have he : (fun x => (f x-m)^2) = fun x => (f x)^2-2*m*f x+m^2 := by funext x; ring + rw [he] at h + have ha := integral_add (hf2.sub (hf.const_mul (2*m))) (integrable_const (m^2)) + simp only [Pi.sub_apply] at ha + rw [ha,integral_sub hf2 (hf.const_mul (2*m)),integral_const_mul] at h + simp only [integral_const,probReal_univ,one_smul] at h + dsimp only [m] at h + nlinarith + theorem complex_integral_error_sq_le {Ω : Type u2} [MeasurableSpace Ω] (μ : Measure Ω) + [IsProbabilityMeasure μ] {f : Ω → ℂ} (c : ℂ) (hf : Integrable f μ) + (hf2 : Integrable (fun x => ‖f x-c‖^2) μ) : + ‖(∫x,f x ∂μ)-c‖^2 ≤ ∫x,‖f x-c‖^2 ∂μ := by + have hi := hf.sub (integrable_const c) + have h : ‖(∫x,f x ∂μ)-c‖ ≤ ∫x,‖f x-c‖ ∂μ := by + have hh := norm_integral_le_integral_norm (fun x => f x-c) (μ := μ) + simpa only [integral_sub hf (integrable_const c),integral_const,probReal_univ,one_smul] using hh + exact (pow_le_pow_left₀ (norm_nonneg _) h 2).trans (integral_sq_le_integral_square μ hi.norm hf2) + theorem complex_integral_error_le {Ω : Type u3} [MeasurableSpace Ω] (μ : Measure Ω) + [IsProbabilityMeasure μ] {f : Ω → ℂ} (c : ℂ) (hf : Integrable f μ) + (hf2 : Integrable (fun x => ‖f x-c‖^2) μ) : + ‖(∫x,f x ∂μ)-c‖ ≤ Real.sqrt (∫x,‖f x-c‖^2 ∂μ) := by + exact (Real.le_sqrt (norm_nonneg _) (integral_nonneg (fun x => sq_nonneg _))).mpr + (complex_integral_error_sq_le μ c hf hf2) + theorem complex_integral_tendsto_of_L2 {Ω : ℕ → Type u4} [∀k,MeasurableSpace (Ω k)] + (μ : (k:ℕ) → Measure (Ω k)) [∀k,IsProbabilityMeasure (μ k)] (f : (k:ℕ) → Ω k → ℂ) (c : ℂ) + (hi : ∀k,Integrable (f k) (μ k)) (hi2 : ∀k,Integrable (fun x => ‖f k x-c‖^2) (μ k)) + (ht : Tendsto (fun k => ∫x,‖f k x-c‖^2 ∂μ k) atTop (𝓝 0)) : + Tendsto (fun k => ∫x,f k x ∂μ k) atTop (𝓝 c) := by + rw [← tendsto_sub_nhds_zero_iff] + exact squeeze_zero_norm (fun k => complex_integral_error_le (μ k) c (hi k) (hi2 k)) (by simpa only [Function.comp_def,Real.sqrt_zero] using Real.continuous_sqrt.continuousAt.tendsto.comp ht) + theorem complex_mul_integrable_of_squares {Ω : Type u5} [MeasurableSpace Ω] (μ : Measure Ω) + {f g : Ω → ℂ} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) + (hf2 : Integrable (fun x => ‖f x‖^2) μ) (hg2 : Integrable (fun x => ‖g x‖^2) μ) : + Integrable (fun x => f x*g x) μ := by + apply ((hf2.add hg2).div_const 2).mono' (hf.mul hg) + exact ae_of_all _ (fun x => by dsimp; rw [norm_mul]; nlinarith [sq_nonneg (‖f x‖-‖g x‖)]) + theorem complex_integral_mul_centered_bound {Ω : Type u6} [MeasurableSpace Ω] (μ : Measure Ω) + {f g : Ω → ℂ} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) + (hf2 : Integrable (fun x => ‖f x‖^2) μ) (hg2 : Integrable (fun x => ‖g x‖^2) μ) : + ‖∫x,f x*g x ∂μ‖ ≤ ((∫x,‖f x‖^2 ∂μ)+(∫x,‖g x‖^2 ∂μ))/2 := by + calc + _ ≤ ∫x,‖f x*g x‖ ∂μ := norm_integral_le_integral_norm _ + _ ≤ ∫x,(‖f x‖^2+‖g x‖^2)/2 ∂μ := by + apply integral_mono (complex_mul_integrable_of_squares μ hf hg hf2 hg2).norm ((hf2.add hg2).div_const 2) + intro x; dsimp; rw [norm_mul]; nlinarith [sq_nonneg (‖f x‖-‖g x‖)] + _ = _ := by rw [integral_div,integral_add hf2 hg2] + theorem complex_integral_mul_tendsto_of_L2 {Ω : ℕ → Type u7} [∀k,MeasurableSpace (Ω k)] + (μ : (k:ℕ) → Measure (Ω k)) [∀k,IsProbabilityMeasure (μ k)] + (f g : (k:ℕ) → Ω k → ℂ) (c d : ℂ) + (hif : ∀k,Integrable (f k) (μ k)) (hig : ∀k,Integrable (g k) (μ k)) + (hif2 : ∀k,Integrable (fun x => ‖f k x-c‖^2) (μ k)) + (hig2 : ∀k,Integrable (fun x => ‖g k x-d‖^2) (μ k)) + (htf : Tendsto (fun k => ∫x,‖f k x-c‖^2 ∂μ k) atTop (𝓝 0)) + (htg : Tendsto (fun k => ∫x,‖g k x-d‖^2 ∂μ k) atTop (𝓝 0)) : + Tendsto (fun k => ∫x,f k x*g k x ∂μ k) atTop (𝓝 (c*d)) := by + have hcf (k : ℕ) : Integrable (fun x => f k x-c) (μ k) := (hif k).sub (integrable_const c) + have hcg (k : ℕ) : Integrable (fun x => g k x-d) (μ k) := (hig k).sub (integrable_const d) + have hr : Tendsto (fun k => ∫x,(f k x-c)*(g k x-d) ∂μ k) atTop (𝓝 0) := by + apply squeeze_zero_norm (fun k => complex_integral_mul_centered_bound (μ k) (hcf k).aestronglyMeasurable (hcg k).aestronglyMeasurable (hif2 k) (hig2 k)) + simpa using (htf.add htg).div_const 2 + have hf := complex_integral_tendsto_of_L2 μ f c hif hif2 htf + have hg := complex_integral_tendsto_of_L2 μ g d hig hig2 htg + have he k : (∫x,f k x*g k x ∂μ k) = (∫x,(f k x-c)*(g k x-d) ∂μ k)+ + ((∫x,f k x ∂μ k)-c)*d+c*((∫x,g k x ∂μ k)-d)+c*d := by + have hmul := complex_mul_integrable_of_squares (μ k) (hcf k).aestronglyMeasurable (hcg k).aestronglyMeasurable (hif2 k) (hig2 k) + have hpoint : (fun x => f k x*g k x) = fun x => (f k x-c)*(g k x-d)+(f k x-c)*d+c*(g k x-d)+c*d := by funext x; ring + have ha := integral_add ((hmul.add ((hcf k).mul_const d)).add ((hcg k).const_mul c)) (integrable_const (c*d)) + have hb := integral_add (hmul.add ((hcf k).mul_const d)) ((hcg k).const_mul c) + simp only [Pi.add_apply] at ha hb + rw [hpoint,ha,hb, + integral_add hmul ((hcf k).mul_const d),integral_mul_const,integral_const_mul, + integral_sub (hif k) (integrable_const c),integral_sub (hig k) (integrable_const d)] + simp only [integral_const,probReal_univ,one_smul] + simp_rw [he] + convert ((hr.add ((hf.sub_const c).mul_const d)).add ((hg.sub_const d).const_mul c)).add_const (c*d) using 1 ; simp +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/LinearSeries.lean b/lean/OAI/Analysis/FreeEntropy/LinearSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ef89f2f342bcd4910c4f5337607db98f2d88f99 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/LinearSeries.lean @@ -0,0 +1,154 @@ +import OAI.Analysis.FreeEntropy.CyclicSeries + +namespace OAI + +universe u1 + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α β γ : Type} [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] + +def reparam (c : α → β → ℂ) (f : Series α) : Series β + | [] => f [] + | b::w => ∑ a, c a b * reparam c (deriv a f) w +@[simp] theorem reparam_nil {α β : Type} [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] (c : α → β → ℂ) (f : Series α) : reparam c f [] = f [] := rfl + theorem reparam_cons {α β : Type} [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] (c : α → β → ℂ) (f : Series α) (b : β) (w : List β) : + reparam c f (b::w) = ∑ a, c a b * reparam c (deriv a f) w := rfl + theorem deriv_reparam {α β : Type} [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] (c : α → β → ℂ) (f : Series α) (b : β) : + deriv b (reparam c f) = ∑ a, c a b • reparam c (deriv a f) := by + funext w; simp [deriv_apply, reparam_cons] + theorem reparam_add {α β : Type} [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] (c : α → β → ℂ) (f g : Series α) : + reparam c (f+g) = reparam c f + reparam c g := by + funext w + induction w generalizing f g with + | nil => rfl + | cons b w ih => + simp only [reparam_cons, Pi.add_apply, + show ∀ a, deriv a (f+g) = deriv a f + deriv a g from fun _ => rfl, ih] + simp [mul_add, sum_add_distrib] + theorem reparam_smul {α β : Type} [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] (c : α → β → ℂ) (z : ℂ) (f : Series α) : + reparam c (z • f) = z • reparam c f := by + funext w + induction w generalizing f with + | nil => rfl + | cons b w ih => + simp only [reparam_cons, Pi.smul_apply, smul_eq_mul, + show ∀ a, deriv a (z • f) = z • deriv a f from fun _ => rfl, ih] + simp [mul_left_comm, mul_sum] +@[simp] theorem reparam_zero (c : α → β → ℂ) : reparam c 0 = 0 := by + simpa using reparam_smul c 0 0 + theorem reparam_sum {δ : Type u1} (s : Finset δ) (c : α → β → ℂ) (f : δ → Series α) : + reparam c (∑ d ∈ s, f d) = ∑ d ∈ s, reparam c (f d) := by + classical + induction s using Finset.induction with + | empty => simp + | @insert d s hd ih => simp [sum_insert hd, reparam_add, ih] +@[simp] theorem reparam_unit (c : α → β → ℂ) : reparam c unit = unit := by + funext w + cases w with + | nil => rfl + | cons b w => + have hh (a : α) : deriv a (unit : Series α) = 0 := rfl + simp [reparam_cons, hh] + theorem reparam_conv (c : α → β → ℂ) (f g : Series α) : + reparam c (conv f g) = conv (reparam c f) (reparam c g) := by + funext w + induction w generalizing f g with + | nil => rfl + | cons b w ih => + simp only [reparam_cons, deriv_conv, reparam_add, reparam_smul, Pi.add_apply, + Pi.smul_apply, smul_eq_mul, ih, mul_add, sum_add_distrib] + rw [conv_cons, reparam_nil, reparam_cons, deriv_reparam, conv_sum_left] + simp only [conv_smul_left, Finset.sum_apply, Pi.smul_apply, smul_eq_mul] + congr 1 + simp [mul_left_comm, mul_sum] + theorem rightDeriv_reparam {α β : Type} [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] (c : α → β → ℂ) (f : Series α) (b : β) : + rightDeriv b (reparam c f) = ∑ a, c a b • reparam c (rightDeriv a f) := by + funext w + induction w generalizing f with + | nil => simp [rightDeriv, reparam_cons] + | cons d w ih => + simp only [rightDeriv_apply, List.cons_append, reparam_cons, Finset.sum_apply, + Pi.smul_apply, smul_eq_mul] + have hh (a : α) : reparam c (deriv a f) (w++[b]) = + ∑ j, c j b * reparam c (rightDeriv j (deriv a f)) w := by + simpa only [rightDeriv_apply, Finset.sum_apply, Pi.smul_apply, smul_eq_mul] using ih (deriv a f) + simp_rw [hh, mul_sum] + rw [sum_comm] + apply sum_congr rfl + intro a _ + apply sum_congr rfl + intro j _ + have he : rightDeriv a (deriv j f) = deriv j (rightDeriv a f) := rfl + rw [he] + ring + theorem Cyclic.reparam {f : Series α} (hf : Cyclic f) (c : α → β → ℂ) : + Cyclic (reparam c f) := by + intro b + rw [deriv_reparam, rightDeriv_reparam] + apply sum_congr rfl + intro a _ + rw [hf a] + theorem reparam_subst (c : α → β → ℂ) (M f : Series α) : + reparam c (subst M f) = subst (reparam c M) (reparam c f) := by + funext w + induction w using length_induction generalizing f with + | h w ih => + cases w with + | nil => simp + | cons b w => + rw [reparam_cons, subst_cons, deriv_reparam, subst_sum, conv_sum_right] + simp only [deriv_subst, reparam_conv, subst_smul, conv_smul_right, + Finset.sum_apply, Pi.smul_apply, smul_eq_mul] + apply sum_congr rfl + intro a _ + congr 1 + apply conv_agree (n := w.length) (Agree.refl _ _) (fun v hv => ?_) w le_rfl + exact ih v (by simp; omega) (deriv a f) + theorem reparam_moments (c : α → β → ℂ) {R : Series α} (hR : R [] = 0) : + reparam c (moments R) = moments (reparam c R) := by + apply moments_unique (by simpa using hR) + have hh := congrArg (reparam c) (moments_eq hR) + simpa only [reparam_add, reparam_unit, reparam_subst] using hh + theorem reparam_cumulants (c : α → β → ℂ) {M : Series α} (hM : M [] = 1) : + reparam c (cumulants M) = cumulants (reparam c M) := by + apply cumulants_unique (by simpa using hM) + have hh := congrArg (reparam c) (cumulants_equation hM) + simpa only [reparam_add, reparam_unit, reparam_subst] using hh + +def restrict (e : β → α) (f : Series α) : Series β := fun w => f (w.map e) + theorem restrict_conv {α β : Type} [DecidableEq α] [Fintype α] [DecidableEq β] [Fintype β] (e : β → α) (f g : Series α) : + restrict e (conv f g) = conv (restrict e f) (restrict e g) := by + funext w + simp only [restrict, conv_sum_splits, List.length_map, ← List.map_take, ← List.map_drop] + theorem restrict_subst (e : β → α) (M f : Series α) : + restrict e (subst M f) = subst (restrict e M) (restrict e f) := by + funext w + induction w using length_induction generalizing f with + | h w ih => + cases w with + | nil => simp [restrict] + | cons b w => + change subst M f (e b :: w.map e) = _ + rw [subst_cons, subst_cons] + change restrict e (conv M (subst M (deriv (e b) f))) w = _ + rw [restrict_conv] + apply conv_agree (n := w.length) (Agree.refl _ _) (fun v hv => ?_) w le_rfl + exact ih v (by simp; omega) (deriv (e b) f) + theorem restrict_moments (e : β → α) {R : Series α} (hR : R [] = 0) : + restrict e (moments R) = moments (restrict e R) := by + apply moments_unique (show (restrict e R) [] = 0 from hR) + funext w + have hh := congrFun (moments_eq hR) (w.map e) + simp only [Pi.add_apply] at hh + change moments R (w.map e) = _ + rw [hh] + congr 1 + · cases w <;> rfl + · exact congrFun (restrict_subst e _ _) w +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/Main.lean b/lean/OAI/Analysis/FreeEntropy/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd4ff97c6a8fece850c9fd2dc2ad065a74f38585 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/Main.lean @@ -0,0 +1,38 @@ +import OAI.Analysis.FreeEntropy.CutoffSeparation + +namespace OAI + +noncomputable section +open MeasureTheory +namespace FiniteEntropySeparation + +theorem main : + ∃ (H : Type) (_ : NormedAddCommGroup H) (_ : InnerProductSpace ℂ H) + (_ : CompleteSpace H) (M : VonNeumannAlgebra H) (τ : TracialVector M) + (n : ℕ) (X S : Fin n → H →L[ℂ] H), + 2 ≤ n ∧ + (∀ i, X i ∈ M ∧ IsSelfAdjoint (X i)) ∧ + (∀ i, S i ∈ M ∧ IsSelfAdjoint (S i)) ∧ + FreeStandardNoise τ X S ∧ + (⊥ : EReal) < chi τ X ∧ + chi τ X ≤ chiStar τ X S - (1 / 2 : EReal) ∧ + chiStar τ X S - (1 / 2 : EReal) < (⊤ : EReal) := by + obtain ⟨δ,Δ,hδ,hΔ,hδΔ,hsep,hq⟩ := exists_spectral_parameters chosenP_ge_two + obtain ⟨h,hh0,hh1,hh⟩ := exists_small_h_spectralGood chosenP_ge_two hδ hΔ + refine ⟨Model.H chosenP,inferInstance,inferInstance,inferInstance,Model.M chosenP, + Model.τ chosenP,chosenP+1,Model.X chosenP h,Model.auxiliaryNoise chosenP, + by have := chosenP_ge_two; omega, + (fun i => ⟨Model.X_mem chosenP h i,Model.X_selfAdjoint chosenP h i⟩), + (fun i => ⟨Model.auxiliaryNoise_mem chosenP i,Model.auxiliaryNoise_selfAdjoint chosenP i⟩), + Model.auxiliaryNoise_free chosenP h,Model.chi_gt_bot chosenP chosenP_ge_two hh0, + chosen_chi_bound hh0 hh1 hδ hΔ hδΔ hsep hq hh,?_⟩ + rw [Model.chiStar_tail_formula chosenP chosenP_ge_two h hh0] + change ((Model.gaussianEntropy chosenP h-(1/2:ℝ)*(∫u in Set.Ioi h,Model.fisherDeficit chosenP u):ℝ):EReal)-(((1/2:ℝ):ℝ):EReal)<⊤ + rw [← EReal.coe_sub] + exact EReal.coe_lt_top _ + +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixBasis.lean b/lean/OAI/Analysis/FreeEntropy/MatrixBasis.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cba2c82471cd27eb87477dea771874f0887eabe --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixBasis.lean @@ -0,0 +1,74 @@ +import OAI.Analysis.FreeEntropy.MatrixChart + +namespace OAI + +noncomputable section +open scoped ComplexConjugate +open Finset +namespace FiniteEntropySeparation + def hermitianBasis {d : ℕ} (j k : Fin d) : Matrix (Fin d) (Fin d) ℂ := + if j=k then Matrix.single j j 1 else if j ∑ j, ∑ k, f j k) + (funext (fun j => funext (fun k => basis_pair_contract j k D))) + simp only [sum_add_distrib] at hp + have hswap : (∑ j : Fin d, ∑ k : Fin d, hermitianBasis k j * D * hermitianBasis k j) = + ∑ j : Fin d, ∑ k : Fin d, hermitianBasis j k * D * hermitianBasis j k := sum_comm + have hswap' : (∑ j : Fin d, ∑ k : Fin d, Matrix.single k j 1 * D * Matrix.single j k 1) = + ∑ j : Fin d, ∑ k : Fin d, Matrix.single j k 1 * D * Matrix.single k j 1 := sum_comm + rw [hswap,hswap'] at hp + have he : (∑ j : Fin d, ∑ k : Fin d, Matrix.single j k 1 * D * Matrix.single k j 1) = + Matrix.trace D • (1 : Matrix (Fin d) (Fin d) ℂ) := by + ext a b + simp only [Matrix.single_mul_mul_single, one_mul, mul_one, Matrix.sum_apply, Matrix.single_apply, + Matrix.smul_apply, Matrix.one_apply, smul_eq_mul] + by_cases hab : a=b + · subst b; simp [Matrix.trace] + · simp only [hab, ite_false, mul_zero] + apply sum_eq_zero + intro j _ + simp only [ite_eq_right (show ¬(j=a ∧ j=b) from fun h => hab (h.1.symm.trans h.2)), sum_const_zero] + rw [he] at hp + ext a b + have hc := congrArg (fun A : Matrix (Fin d) (Fin d) ℂ => A a b) hp + simp only [Matrix.add_apply] at hc + linear_combination hc / 2 +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixBasisChart.lean b/lean/OAI/Analysis/FreeEntropy/MatrixBasisChart.lean new file mode 100644 index 0000000000000000000000000000000000000000..47913be4fb438452a36e2d78107a9989b38daf75 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixBasisChart.lean @@ -0,0 +1,51 @@ +import OAI.Analysis.FreeEntropy.MatrixBasis + +namespace OAI + +noncomputable section +open scoped ComplexConjugate +open Finset +namespace FiniteEntropySeparation + theorem hermitianMatrix_single {n d : ℕ} (i l : Fin n) (j k : Fin d) : + hermitianMatrix (EuclideanSpace.single (i,j,k) 1 : MatrixCoordinates n d) l = + if i=l then hermitianBasis j k else 0 := by + ext a b + simp only [hermitianMatrix, hermitianBasis, EuclideanSpace.single, PiLp.single_apply] + by_cases hil : i=l + · subst l + by_cases hjk : j=k + · subst k + by_cases hab : a=b + · subst b + by_cases hja : j=a <;> simp [*,Prod.mk.injEq,eq_comm] + · have hbad : ¬(j=a ∧ j=b) := fun h => hab (h.1.symm.trans h.2) + simp [*,Prod.mk.injEq,eq_comm, and_comm] + · rcases lt_or_gt_of_ne hjk with hjk' | hkj' + · by_cases hab : a=b + · subst b + have hbad : ¬(j=a ∧ k=a) := fun h => hjk (h.1.trans h.2.symm) + have hbad' : ¬(k=a ∧ j=a) := fun h => hjk (h.2.trans h.1.symm) + simp [*,Prod.mk.injEq,eq_comm, and_comm] + · by_cases hjka : j=a ∧ k=b + · rcases hjka with ⟨rfl,rfl⟩; simp [*,Prod.mk.injEq,eq_comm,div_eq_mul_inv] + · by_cases hkja : k=a ∧ j=b + · rcases hkja with ⟨rfl,rfl⟩; simp [*,Prod.mk.injEq,eq_comm,Ne.symm hab,not_lt_of_gt hjk',div_eq_mul_inv] + · have hbad : ¬(j=b ∧ k=a) := fun h => hkja ⟨h.2,h.1⟩ + simp [*,Prod.mk.injEq,eq_comm, and_comm] + · by_cases hab : a=b + · subst b + have hbad : ¬(j=a ∧ k=a) := fun h => hjk (h.1.trans h.2.symm) + have hbad' : ¬(k=a ∧ j=a) := fun h => hjk (h.2.trans h.1.symm) + simp [*,Prod.mk.injEq,eq_comm, and_comm, not_lt_of_gt hkj'] + · by_cases hjka : j=a ∧ k=b + · rcases hjka with ⟨rfl,rfl⟩; simp [*,Prod.mk.injEq,eq_comm,not_lt_of_gt hkj',div_eq_mul_inv] + · by_cases hkja : k=a ∧ j=b + · rcases hkja with ⟨rfl,rfl⟩; simp [*,Prod.mk.injEq,eq_comm,Ne.symm hab,not_lt_of_gt hkj',div_eq_mul_inv] + · have hbad : ¬(j=b ∧ k=a) := fun h => hkja ⟨h.2,h.1⟩ + simp [*,Prod.mk.injEq,eq_comm, and_comm,not_lt_of_gt hkj'] + · simp [hil,Prod.mk.injEq,eq_comm] +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixBilinear.lean b/lean/OAI/Analysis/FreeEntropy/MatrixBilinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..8bd6155012f03952008b53c2633d040b096ef918 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixBilinear.lean @@ -0,0 +1,79 @@ +import OAI.Analysis.FreeEntropy.GaussianLinearTail + +namespace OAI + +noncomputable section +open scoped ComplexConjugate NNReal +open MeasureTheory ProbabilityTheory Finset +namespace FiniteEntropySeparation + def matrixBilinear {d : ℕ} (v w : EuclideanSpace ℂ (Fin d)) (A : Matrix (Fin d) (Fin d) ℂ) : ℂ := inner ℂ v (matrixOperator A w) + theorem matrixBilinear_trace {d : ℕ} (v w : EuclideanSpace ℂ (Fin d)) (A : Matrix (Fin d) (Fin d) ℂ) : + matrixBilinear v w A = Matrix.trace (A * Matrix.vecMulVec (WithLp.ofLp w) (star (WithLp.ofLp v))) := by + rw [Matrix.mul_vecMulVec, Matrix.trace_vecMulVec] + rfl + theorem matrixBilinear_expand {n d : ℕ} (x : MatrixIndex n d → ℝ) (i : Fin n) (v w : EuclideanSpace ℂ (Fin d)) : + matrixBilinear v w (coordinateMatrix x i) = ∑ j, ∑ k, (x (i,j,k) : ℂ)*matrixBilinear v w (hermitianBasis j k) := by + simp_rw [matrixBilinear_trace] + rw [coordinateMatrix_expand] + simp [Finset.sum_mul, Matrix.trace_sum, Matrix.trace_smul] + theorem matrixBilinear_parseval {d : ℕ} (v w : EuclideanSpace ℂ (Fin d)) : + (∑ j, ∑ k, Complex.normSq (matrixBilinear v w (hermitianBasis j k))) = ‖v‖^2*‖w‖^2 := by + simp_rw [matrixBilinear_trace, hermitianBasis_parseval] + simp only [Matrix.vecMulVec_apply, map_mul, Pi.star_apply, Complex.star_def, Complex.normSq_conj] + rw [EuclideanSpace.norm_sq_eq, EuclideanSpace.norm_sq_eq] + simp_rw [Complex.normSq_eq_norm_sq] + rw [sum_comm] + simp only [← sum_mul, ← mul_sum] + ring + theorem matrixBilinear_re_coeff {n d : ℕ} (i : Fin n) (v w : EuclideanSpace ℂ (Fin d)) : + (∑ q : MatrixIndex n d, (if q.1=i then (matrixBilinear v w (hermitianBasis q.2.1 q.2.2)).re else 0)^2) ≤ ‖v‖^2*‖w‖^2 := by + rw [Fintype.sum_prod_type] + simp only [ite_pow, zero_pow (by norm_num : 2 ≠ 0), Fintype.sum_prod_type, sum_ite_irrel, sum_const_zero, sum_ite_eq', mem_univ, ite_true] + rw [← matrixBilinear_parseval] + apply sum_le_sum; intro j _ + apply sum_le_sum; intro k _ + rw [Complex.normSq_apply] + nlinarith [sq_nonneg (matrixBilinear v w (hermitianBasis j k)).im] + theorem matrixBilinear_im_coeff {n d : ℕ} (i : Fin n) (v w : EuclideanSpace ℂ (Fin d)) : + (∑ q : MatrixIndex n d, (if q.1=i then (matrixBilinear v w (hermitianBasis q.2.1 q.2.2)).im else 0)^2) ≤ ‖v‖^2*‖w‖^2 := by + rw [Fintype.sum_prod_type] + simp only [ite_pow, zero_pow (by norm_num : 2 ≠ 0), Fintype.sum_prod_type, sum_ite_irrel, sum_const_zero, sum_ite_eq', mem_univ, ite_true] + rw [← matrixBilinear_parseval] + apply sum_le_sum; intro j _ + apply sum_le_sum; intro k _ + rw [Complex.normSq_apply] + nlinarith [sq_nonneg (matrixBilinear v w (hermitianBasis j k)).re] + theorem matrixBilinear_re_linear {n d : ℕ} (x : MatrixIndex n d → ℝ) (i : Fin n) (v w : EuclideanSpace ℂ (Fin d)) : + (matrixBilinear v w (coordinateMatrix x i)).re = gaussianLinear (fun q : MatrixIndex n d => if q.1=i then (matrixBilinear v w (hermitianBasis q.2.1 q.2.2)).re else 0) x := by + rw [matrixBilinear_expand] + simp [gaussianLinear, Fintype.sum_prod_type, Complex.mul_re, mul_comm] + theorem matrixBilinear_im_linear {n d : ℕ} (x : MatrixIndex n d → ℝ) (i : Fin n) (v w : EuclideanSpace ℂ (Fin d)) : + (matrixBilinear v w (coordinateMatrix x i)).im = gaussianLinear (fun q : MatrixIndex n d => if q.1=i then (matrixBilinear v w (hermitianBasis q.2.1 q.2.2)).im else 0) x := by + rw [matrixBilinear_expand] + simp [gaussianLinear, Fintype.sum_prod_type, Complex.mul_im, mul_comm] + theorem matrixBilinear_gaussian_tail {n d : ℕ} (i : Fin n) (v w : EuclideanSpace ℂ (Fin d)) + (hv : ‖v‖ = 1) (hw : ‖w‖ = 1) {u : ℝ} (hu : 0 ≤ u) : + (productGaussian (MatrixIndex n d)).real {x | u ≤ ‖matrixBilinear v w (coordinateMatrix x i)‖} ≤ 4*Real.exp (-u^2/8) := by + let cr : MatrixIndex n d → ℝ := fun q => if q.1=i then (matrixBilinear v w (hermitianBasis q.2.1 q.2.2)).re else 0 + let ci : MatrixIndex n d → ℝ := fun q => if q.1=i then (matrixBilinear v w (hermitianBasis q.2.1 q.2.2)).im else 0 + have hr : (∑ q, cr q^2) ≤ (1:ℝ≥0) := by simpa [cr,hv,hw] using matrixBilinear_re_coeff i v w + have hi : (∑ q, ci q^2) ≤ (1:ℝ≥0) := by simpa [ci,hv,hw] using matrixBilinear_im_coeff i v w + have hsub : {x | u ≤ ‖matrixBilinear v w (coordinateMatrix x i)‖} ⊆ {x | u/2 ≤ |gaussianLinear cr x|} ∪ {x | u/2 ≤ |gaussianLinear ci x|} := by + intro x hx + simp only [Set.mem_union, Set.mem_ofPred_eq] + by_contra! hh + have hn := Complex.norm_le_abs_re_add_abs_im (matrixBilinear v w (coordinateMatrix x i)) + rw [matrixBilinear_re_linear, matrixBilinear_im_linear] at hn + change u ≤ _ at hx + change |gaussianLinear cr x|+|gaussianLinear ci x| ≥ _ at hn + linarith + calc + _ ≤ (productGaussian (MatrixIndex n d)).real ({x | u/2 ≤ |gaussianLinear cr x|} ∪ {x | u/2 ≤ |gaussianLinear ci x|}) := measureReal_mono hsub + _ ≤ _ + _ := measureReal_union_le _ _ + _ ≤ 2*Real.exp (-(u/2)^2/(2*(1:ℝ≥0))) + 2*Real.exp (-(u/2)^2/(2*(1:ℝ≥0))) := add_le_add (gaussianLinear_tail cr 1 hr (by positivity)) (gaussianLinear_tail ci 1 hi (by positivity)) + _ = _ := by norm_num only [NNReal.coe_one]; ring_nf +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixBlockEnergy.lean b/lean/OAI/Analysis/FreeEntropy/MatrixBlockEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..304716f751ca291e0b1d928995f9c07131ec5d5a --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixBlockEnergy.lean @@ -0,0 +1,104 @@ +import OAI.Analysis.FreeEntropy.SpectralClustering + +namespace OAI + +noncomputable section +open Finset +open scoped ComplexConjugate +namespace FiniteEntropySeparation +variable {p d : ℕ} + theorem small_rows_bound (W : Fin d → Fin d → ℝ) (hW : ∀j k,0≤W j k) + (B : Finset (Fin d)) (hb : (B.card:ℝ)≤(d:ℝ)/4096) + (hfour : (∑j : Fin d,(∑k : Fin d,W j k)^2)≤4*d) : + (∑j∈B,∑k : Fin d,W j k)≤(d:ℝ)/32 := by + have hrows : ∀ j, 0 ≤ ∑ k : Fin d, W j k := fun j => sum_nonneg (fun k _ => hW j k) + have hc := sq_sum_le_card_mul_sum_sq (s := B) (f := fun j => ∑k : Fin d,W j k) + have hh : (∑j∈B,(∑k : Fin d,W j k)^2)≤4*d := + (sum_le_sum_of_subset_of_nonneg (subset_univ _) (fun _ _ _ => sq_nonneg _)).trans hfour + have hm := mul_le_mul hb hh (sum_nonneg (fun j _ => pow_nonneg (hrows j) 2)) (by positivity : (0:ℝ)≤d/4096) + have hd : (0:ℝ)≤d := by positivity + nlinarith + theorem clustered_energy_lower [NeZero p] (y : Fin p → ℝ) (δ Δ : ℝ) (x : Fin d → ℝ) + (hy : ∀i j,i≠j → Δ≤|y i-y j|) (hδ : δ≤Δ/4) (hΔ : 0<Δ) + (W : Fin d → Fin d → ℝ) (hW : ∀j k,0≤W j k) (hsymm : ∀j k,W j k=W k j) + (hsecond : 3*(d:ℝ)/4≤∑j,∑k,W j k) + (hfour : (∑j : Fin d,(∑k : Fin d,W j k)^2)≤4*d) + (hcomm : (∑j,∑k,(x j-x k)^2*W j k)≤Δ^2*d/64) + (hb : ((badSpectrum y δ x).card:ℝ)≤(d:ℝ)/4096) : + (d:ℝ)/2≤∑j,∑k,if clusterLabel y δ x j=clusterLabel y δ x k then W j k else 0 := by + classical + let B := badSpectrum y δ x + have hrows := small_rows_bound W hW B hb hfour + have hpoint j k : W j k ≤ + (if clusterLabel y δ x j=clusterLabel y δ x k then W j k else 0)+ + (4/Δ^2)*((x j-x k)^2*W j k)+ + (if j∈B then W j k else 0)+(if k∈B then W j k else 0) := by + have hn := hW j k + have hc : 0≤(4/Δ^2)*((x j-x k)^2*W j k) := by positivity + by_cases he : clusterLabel y δ x j=clusterLabel y δ x k + · simp only [ite_eq_left he]; split_ifs <;> linarith + by_cases hj : j∈B + · simp only [ite_eq_right he,ite_eq_left hj]; split_ifs <;> linarith + by_cases hk : k∈B + · simp only [ite_eq_right he,ite_eq_left hk]; split_ifs ; linarith + simp only [ite_eq_right he,ite_eq_right hj,ite_eq_right hk,zero_add,add_zero] + have hs := clusterLabel_separated y δ Δ x hy hδ hj hk he + have hs' : Δ^2/4≤(x j-x k)^2 := by nlinarith [sq_abs (x j-x k)] + have hf : 1≤(4/Δ^2)*(x j-x k)^2 := by + rw [div_mul_eq_mul_div] + apply (le_div_iff₀ (sq_pos_of_pos hΔ)).mpr + nlinarith + have hm := mul_le_mul_of_nonneg_right hf hn + nlinarith + have hh := sum_le_sum (fun j (_ : j∈(univ:Finset (Fin d))) => sum_le_sum (fun k (_ : k∈(univ:Finset (Fin d))) => hpoint j k)) + have he1 : (∑j : Fin d,∑k : Fin d,if j∈B then W j k else 0)=∑j∈B,∑k : Fin d,W j k := by + calc + _ = ∑j : Fin d,if j∈B then ∑k : Fin d,W j k else 0 := by + apply sum_congr rfl + intro j _ + by_cases hj : j∈B <;> simp [hj] + _ = _ := by simp + have he2 : (∑j : Fin d,∑k : Fin d,if k∈B then W j k else 0)=∑j∈B,∑k : Fin d,W j k := by + rw [sum_comm] + simpa only [hsymm] using he1 + simp only [sum_add_distrib,← mul_sum,he1,he2] at hh + have hc := mul_le_mul_of_nonneg_left hcomm (show 0≤4/Δ^2 by positivity) + have hc' : (4/Δ^2)*(∑j,∑k,(x j-x k)^2*W j k)≤(d:ℝ)/16 := by + calc + _ ≤ (4/Δ^2)*(Δ^2*(d:ℝ)/64) := hc + _ = _ := by field_simp [ne_of_gt hΔ]; ring + linarith + theorem hermitian_row_energy (A : Matrix (Fin d) (Fin d) ℂ) (hA : A.IsHermitian) (j : Fin d) : + ∑k,Complex.normSq (A j k)=((A^2) j j).re := by + have he k : star (A j k)=A k j := by simpa only [Matrix.conjTranspose_apply] using congrFun (congrFun hA.eq k) j + rw [pow_two,Matrix.mul_apply,Complex.re_sum] + apply sum_congr rfl + intro k _ + rw [← he k,Complex.star_def,Complex.mul_conj,Complex.ofReal_re] + theorem hermitian_row_fourth (A : Matrix (Fin d) (Fin d) ℂ) (hA : A.IsHermitian) : + (∑j : Fin d,(∑k : Fin d,Complex.normSq (A j k))^2)≤(Matrix.trace (A^4)).re := by + have hA2 : (A^2).IsHermitian := hA.pow 2 + have ht : (Matrix.trace (A^4)).re=hsNorm (A^2)^2 := by + rw [hsNorm_sq,← trace_conjTranspose_mul_re,hA2.eq,← pow_add] + rw [ht,hsNorm_sq] + apply sum_le_sum + intro j _ + rw [hermitian_row_energy A hA] + apply le_trans _ (Finset.single_le_sum (fun k _ => Complex.normSq_nonneg ((A^2) j k)) (mem_univ j)) + simp only [Complex.normSq_apply] + nlinarith [sq_nonneg ((A^2) j j).im] + theorem hermitian_entry_symmetric (A : Matrix (Fin d) (Fin d) ℂ) (hA : A.IsHermitian) (j k : Fin d) : + Complex.normSq (A j k)=Complex.normSq (A k j) := by + have he : star (A j k)=A k j := by simpa only [Matrix.conjTranspose_apply] using congrFun (congrFun hA.eq k) j + rw [← he,Complex.star_def,Complex.normSq_conj] + theorem commutator_diagonal_entry (A : Matrix (Fin d) (Fin d) ℂ) (x : Fin d → ℝ) (j k : Fin d) : + Complex.normSq ((Matrix.diagonal (fun j => (x j:ℂ))*A-A*Matrix.diagonal (fun j => (x j:ℂ))) j k)= + (x j-x k)^2*Complex.normSq (A j k) := by + simp only [Matrix.sub_apply,Matrix.diagonal_mul,Matrix.mul_diagonal] + rw [mul_comm (A j k),← sub_mul,← Complex.ofReal_sub,Complex.normSq_mul,Complex.normSq_ofReal] + ring +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixBlocks.lean b/lean/OAI/Analysis/FreeEntropy/MatrixBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..1144a3c2e217e0a6ae91f6426d3839f9715c8094 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixBlocks.lean @@ -0,0 +1,62 @@ +import OAI.Analysis.FreeEntropy.FreeMatrixModels + +namespace OAI + +noncomputable section +open Finset +namespace FiniteEntropySeparation + def matrixBlocks {d p : ℕ} : (Fin p → Matrix (Fin d) (Fin d) ℂ) →+* Matrix (Fin (d*p)) (Fin (d*p)) ℂ := + (Matrix.reindexRingEquiv ℂ finProdFinEquiv).toRingHom.comp (Matrix.blockDiagonalRingHom (Fin d) (Fin p) ℂ) + theorem matrixBlocks_apply {d p : ℕ} (A : Fin p → Matrix (Fin d) (Fin d) ℂ) (j k : Fin d) (l r : Fin p) : + matrixBlocks A (finProdFinEquiv (j,l)) (finProdFinEquiv (k,r)) = if l=r then A l j k else 0 := by + change Matrix.blockDiagonal A (finProdFinEquiv.symm (finProdFinEquiv (j,l))) (finProdFinEquiv.symm (finProdFinEquiv (k,r))) = _ + simp only [Equiv.symm_apply_apply,Matrix.blockDiagonal] + rfl + theorem trace_matrixBlocks {d p : ℕ} (A : Fin p → Matrix (Fin d) (Fin d) ℂ) : + Matrix.trace (matrixBlocks A) = ∑ l, Matrix.trace (A l) := by + rw [Matrix.trace] + rw [← finProdFinEquiv.sum_comp] + simp only [Fintype.sum_prod_type,Matrix.diag,matrixBlocks_apply,ite_true] + rw [Finset.sum_comm] + rfl + def blockVector {d p : ℕ} (v : EuclideanSpace ℂ (Fin (d*p))) (l : Fin p) : EuclideanSpace ℂ (Fin d) := + WithLp.toLp 2 (fun j => v (finProdFinEquiv (j,l))) + theorem blockVector_normSq {d p : ℕ} (v : EuclideanSpace ℂ (Fin (d*p))) : + ∑ l : Fin p, ‖blockVector v l‖^2 = ‖v‖^2 := by + simp only [EuclideanSpace.norm_sq_eq,blockVector] + rw [← finProdFinEquiv.sum_comp] + rw [Fintype.sum_prod_type,Finset.sum_comm] + theorem matrixBlocks_mulVec {d p : ℕ} (A : Fin p → Matrix (Fin d) (Fin d) ℂ) + (v : EuclideanSpace ℂ (Fin (d*p))) (l : Fin p) : + blockVector (matrixOperator (matrixBlocks A) v) l = matrixOperator (A l) (blockVector v l) := by + ext j + change (matrixBlocks A).mulVec v.ofLp (finProdFinEquiv (j,l)) = (A l).mulVec (fun k => v (finProdFinEquiv (k,l))) j + simp only [Matrix.mulVec,dotProduct] + rw [← finProdFinEquiv.sum_comp] + simp [Fintype.sum_prod_type,matrixBlocks_apply] + theorem matrixBlocks_norm_le {d p : ℕ} (A : Fin p → Matrix (Fin d) (Fin d) ℂ) + {K : ℝ} (hK : 0≤K) (hA : ∀ l, matrixOpNorm (A l)≤K) : matrixOpNorm (matrixBlocks A)≤K := by + apply ContinuousLinearMap.opNorm_le_bound _ hK + intro v + have he : ‖matrixOperator (matrixBlocks A) v‖^2 ≤ K^2*‖v‖^2 := by + rw [← blockVector_normSq,← blockVector_normSq v,Finset.mul_sum] + apply sum_le_sum + intro l _ + rw [matrixBlocks_mulVec,← mul_pow] + exact pow_le_pow_left₀ (norm_nonneg _) ((matrixOperator (A l)).le_opNorm (blockVector v l) |>.trans (mul_le_mul_of_nonneg_right (hA l) (norm_nonneg _))) 2 + change ‖matrixOperator (matrixBlocks A) v‖ ≤ K*‖v‖ + nlinarith [norm_nonneg (matrixOperator (matrixBlocks A) v),mul_nonneg hK (norm_nonneg v)] + theorem matrixBlocks_isHermitian {d p : ℕ} (A : Fin p → Matrix (Fin d) (Fin d) ℂ) + (hA : ∀ l,(A l).IsHermitian) : (matrixBlocks A).IsHermitian := by + ext j k + obtain ⟨⟨j,l⟩,rfl⟩ := finProdFinEquiv.surjective j + obtain ⟨⟨k,r⟩,rfl⟩ := finProdFinEquiv.surjective k + simp only [Matrix.conjTranspose_apply,matrixBlocks_apply] + by_cases h:l=r + · subst r; simp only [ite_true]; exact congrFun (congrFun (hA l) j) k + · simp [h,Ne.symm h] +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixBounds.lean b/lean/OAI/Analysis/FreeEntropy/MatrixBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..21233187cca88dc8efa6cf6893f1d40704731d73 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixBounds.lean @@ -0,0 +1,75 @@ +import OAI.Analysis.FreeEntropy.MatrixPolynomial + +namespace OAI + +noncomputable section +open scoped ENNReal +open Finset MeasureTheory Set +namespace FiniteEntropySeparation + theorem matrixOpNorm_continuous {d : ℕ} : Continuous (matrixOpNorm (d := d)) := by + exact ((Matrix.toEuclideanLin (𝕜 := ℂ) (m := Fin d) (n := Fin d)).trans + LinearMap.toContinuousLinearMap).toLinearMap.continuous_of_finiteDimensional.norm + theorem matrix_column_bound {d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) (k : Fin d) : + (∑ j, Complex.normSq (A j k)) ≤ matrixOpNorm A ^ 2 := by + let T := (Matrix.toEuclideanLin A).toContinuousLinearMap + have he : T (EuclideanSpace.single k 1) = WithLp.toLp 2 (fun j => A j k) := by + change Matrix.toEuclideanLin A (EuclideanSpace.single k 1) = _ + rw [Matrix.toLpLin_apply] + congr 1 + simp [EuclideanSpace.single, Matrix.mulVec_single, Matrix.col, Matrix.transpose] + rfl + have hb := T.le_opNorm (EuclideanSpace.single k 1) + rw [he, PiLp.norm_single, norm_one, mul_one] at hb + have hn : ‖WithLp.toLp 2 (fun j => A j k)‖^2 = ∑ j, Complex.normSq (A j k) := by + rw [EuclideanSpace.norm_sq_eq] + simp [Complex.normSq_eq_norm_sq] + rw [← hn] + exact pow_le_pow_left₀ (norm_nonneg _) hb 2 + theorem matrix_frobenius_bound {d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) : + (∑ j, ∑ k, Complex.normSq (A j k)) ≤ (d : ℝ) * matrixOpNorm A ^ 2 := by + rw [sum_comm] + simpa using sum_le_sum (s := (univ : Finset (Fin d))) (fun k _ => matrix_column_bound A k) + theorem coordinates_sq_bound {n d : ℕ} (a : MatrixCoordinates n d) (R : ℝ) + (hR : 0 ≤ R) (ha : ∀ i, matrixOpNorm (hermitianMatrix a i) ≤ R) : + ‖a‖^2 ≤ (n : ℝ)*d*R^2 := by + rw [← hermitianChart_normSq] + calc + _ ≤ ∑ i : Fin n, (d : ℝ) * matrixOpNorm (hermitianMatrix a i)^2 := + sum_le_sum (fun i _ => matrix_frobenius_bound _) + _ ≤ ∑ _i : Fin n, (d : ℝ)*R^2 := sum_le_sum (fun i _ => mul_le_mul_of_nonneg_left + ((sq_le_sq₀ (norm_nonneg _) hR).mpr (ha i)) (Nat.cast_nonneg d)) + _ = _ := by simp; ring + theorem microstates_measurable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} (X : Fin n → H →L[ℂ] H) + (R : ℝ) (m d : ℕ) (ε : ℝ) : MeasurableSet (microstates τ X R m d ε) := by + simp only [microstates, ofPred_and, ofPred_forall] + apply MeasurableSet.inter + · apply MeasurableSet.iInter + intro i + exact (isClosed_le (matrixOpNorm_continuous.comp (hermitianMatrix_continuous i)) continuous_const).measurableSet + · apply MeasurableSet.iInter + intro w + apply MeasurableSet.iInter + intro hw + exact (isOpen_lt (((matrixMoment_continuous w).sub continuous_const).norm) continuous_const).measurableSet + theorem microstates_subset_closedBall {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} (X : Fin n → H →L[ℂ] H) + (R : ℝ) (hR : 0 ≤ R) (m d : ℕ) (ε : ℝ) : + microstates τ X R m d ε ⊆ Metric.closedBall 0 (Real.sqrt ((n : ℝ)*d) * R) := by + intro a ha + rw [Metric.mem_closedBall, dist_zero_right] + have hb := coordinates_sq_bound a R hR ha.1 + have he : (Real.sqrt ((n : ℝ)*d) * R)^2 = (n : ℝ)*d*R^2 := by + rw [mul_pow, Real.sq_sqrt (by positivity)] + have hn : 0 ≤ Real.sqrt ((n : ℝ)*d) * R := by positivity + nlinarith [norm_nonneg a] + theorem microstates_volume_lt_top {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} (X : Fin n → H →L[ℂ] H) + (R : ℝ) (hR : 0 ≤ R) (m d : ℕ) (ε : ℝ) : volume (microstates τ X R m d ε) < ⊤ := + (measure_mono (microstates_subset_closedBall τ X R hR m d ε)).trans_lt + (isCompact_closedBall (0 : MatrixCoordinates n d) _).measure_lt_top +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixChart.lean b/lean/OAI/Analysis/FreeEntropy/MatrixChart.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4241908c6435c02f77360517a6f0ccd5c46177e --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixChart.lean @@ -0,0 +1,73 @@ +import OAI.Analysis.FreeEntropy.CoordinateMask + +namespace OAI + +noncomputable section +open scoped ComplexConjugate +open Finset +namespace FiniteEntropySeparation + theorem hermitianMatrix_add {n d : ℕ} (a b : MatrixCoordinates n d) (i : Fin n) : + hermitianMatrix (a+b) i = hermitianMatrix a i + hermitianMatrix b i := by + ext j k + simp only [hermitianMatrix, PiLp.add_apply, Matrix.add_apply] + split_ifs <;> push_cast <;> ring + theorem hermitianMatrix_smul {n d : ℕ} (r : ℝ) (a : MatrixCoordinates n d) (i : Fin n) : + hermitianMatrix (r • a) i = r • hermitianMatrix a i := by + ext j k + simp only [hermitianMatrix, PiLp.smul_apply, Matrix.smul_apply, smul_eq_mul, Complex.real_smul] + split_ifs <;> push_cast <;> ring + def hermitianChart (n d : ℕ) : MatrixCoordinates n d →ₗ[ℝ] (Fin n → Matrix (Fin d) (Fin d) ℂ) where + toFun := hermitianMatrix + map_add' a b := funext (hermitianMatrix_add a b) + map_smul' r a := funext (hermitianMatrix_smul r a) + theorem hermitianMatrix_isHermitian {n d : ℕ} (a : MatrixCoordinates n d) (i : Fin n) : + (hermitianMatrix a i).IsHermitian := by + ext j k + simp only [Matrix.conjTranspose_apply, hermitianMatrix] + by_cases h : j=k + · subst k; simp + · have h' : k ≠ j := Ne.symm h + rcases lt_or_gt_of_ne h with hjk | hkj + · simp [h,h',hjk,not_lt_of_gt hjk, Complex.conj_ofReal, sub_eq_add_neg] + · simp [h,h',hkj,not_lt_of_gt hkj, Complex.conj_ofReal, sub_eq_add_neg] + theorem hermitianMatrix_normSq {n d : ℕ} (a : MatrixCoordinates n d) (i : Fin n) (j k : Fin d) : + Complex.normSq (hermitianMatrix a i j k) = (a (i,j,k)^2 + a (i,k,j)^2)/2 := by + have hs : Real.sqrt 2 * Real.sqrt 2 = 2 := Real.mul_self_sqrt (by norm_num) + unfold hermitianMatrix + split_ifs with h hlt + · subst k; simp [Complex.normSq_ofReal]; ring + · rw [Complex.normSq_div, Complex.normSq_ofReal, hs] + simp [Complex.normSq_apply, Complex.mul_re, Complex.mul_im] + ring + · rw [Complex.normSq_div, Complex.normSq_ofReal, hs] + simp [Complex.normSq_apply, Complex.mul_re, Complex.mul_im] + ring + theorem hermitianMatrix_frobenius {n d : ℕ} (a : MatrixCoordinates n d) (i : Fin n) : + (∑ j, ∑ k, Complex.normSq (hermitianMatrix a i j k)) = ∑ j, ∑ k, a (i,j,k)^2 := by + simp_rw [hermitianMatrix_normSq, add_div] + simp_rw [sum_add_distrib] + have he : (∑ j : Fin d, ∑ k : Fin d, a (i,k,j)^2 / 2) = ∑ j : Fin d, ∑ k : Fin d, a (i,j,k)^2 / 2 := sum_comm + rw [he] + simp_rw [← sum_div] + ring + theorem hermitianChart_normSq {n d : ℕ} (a : MatrixCoordinates n d) : + (∑ i, ∑ j, ∑ k, Complex.normSq (hermitianMatrix a i j k)) = ‖a‖^2 := by + simp_rw [hermitianMatrix_frobenius] + rw [EuclideanSpace.norm_sq_eq] + simp [Fintype.sum_prod_type, Real.norm_eq_abs, sq_abs] + theorem hermitianMatrix_continuous {n d : ℕ} (i : Fin n) : + Continuous (fun a : MatrixCoordinates n d => hermitianMatrix a i) := + (continuous_apply i).comp (hermitianChart n d).continuous_of_finiteDimensional + theorem matrixMoment_continuous {n d : ℕ} (w : List (Fin n)) : + Continuous (fun a : MatrixCoordinates n d => matrixMoment a w) := by + have hp : Continuous (fun a : MatrixCoordinates n d => (w.map (hermitianMatrix a)).prod) := by + induction w with + | nil => simpa using (continuous_const : Continuous (fun _ : MatrixCoordinates n d => (1 : Matrix (Fin d) (Fin d) ℂ))) + | cons i w ih => simpa using (hermitianMatrix_continuous i).matrix_mul ih + unfold matrixMoment Matrix.trace + exact continuous_const.mul (continuous_finsetSum _ (fun i _ => hp.matrix_elem i i)) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixChartInverse.lean b/lean/OAI/Analysis/FreeEntropy/MatrixChartInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..df13405a31ac8c21628511688ebfc3ad8c908673 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixChartInverse.lean @@ -0,0 +1,36 @@ +import OAI.Analysis.FreeEntropy.MatrixPolynomialNorm + +namespace OAI + +noncomputable section +open scoped ComplexConjugate +namespace FiniteEntropySeparation + def matrixCoordinatesOfHermitian {n d : ℕ} (A : Fin n → Matrix (Fin d) (Fin d) ℂ) : MatrixCoordinates n d := + WithLp.toLp 2 (fun (i,j,k) => if j=k then (A i j j).re else if j simp [Complex.mul_re,Complex.mul_im] <;> ring + · simp only [hermitianMatrix,matrixCoordinatesOfHermitian,PiLp.toLp_apply,hjk,hkj,hgt,not_lt_of_gt hgt,ite_false,ite_true,Complex.ofReal_mul] + rw [div_eq_iff hs,← he] + apply Complex.ext <;> simp [Complex.mul_re,Complex.mul_im] <;> ring +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixFisherLiminf.lean b/lean/OAI/Analysis/FreeEntropy/MatrixFisherLiminf.lean new file mode 100644 index 0000000000000000000000000000000000000000..3205f1fce5c45232495bf51feb5160bb5bb4e73e --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixFisherLiminf.lean @@ -0,0 +1,63 @@ +import OAI.Analysis.FreeEntropy.FisherLiminf + +namespace OAI + +noncomputable section +open MeasureTheory Filter Finset +open scoped Topology +namespace FiniteEntropySeparation +variable {n d : ℕ} +def normalizedMatrixFisher (μ : Measure (MatrixCoordinates n d)) (s : ℝ) : ℝ := + classicalFisher μ (s/d)/(d:ℝ)^3 + theorem matrixHeatLaw_fisher_lower (hd : 0 ∫a,matrixFisherTest p i a ∂matrixHeatLaw (μ k) s) atTop + (𝓝 (fisherTest (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) s) i p)) := by + have hb k : ∀ᵐa ∂μ k,∀i,matrixOpNorm (hermitianMatrix a i) ≤ R := (hμ k).mono (fun _ ha => ha.1) + exact matrixFisherTest_integral_tendsto + (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) s) + (heatTuple_selfAdjoint X (fun i => semicircularN (σ i)) hself (fun i => semicircularN_selfAdjoint (B := B) (G := G) (σ i)) s) + (fun k => matrixHeatLaw (μ k) s) + (fun k w => matrixHeatLaw_moment_integrable (hD0 k) (μ k) hR (hb k) hs w) + (fun k v w => matrixHeatLaw_product_integrable (hD0 k) (μ k) hR (hb k) hs v w) + (matrixHeatLaw_moment_tendsto hD0 hD J X hX hR hn σ hσ hsigma μ hμ hs) + (matrixHeatLaw_product_tendsto hD0 hD J X hX hR hn σ hσ hsigma μ hμ hs) p i +include hD0 hD hX hself hR hn hσ hsigma hμ in + theorem freeFisher_le_liminf_matrixFisher {s : ℝ} (hs : 0 semicircularN (σ i)) s) ≤ + liminf (fun k => ENNReal.ofReal (normalizedMatrixFisher (μ k) s)) atTop := by + obtain ⟨ξ,hξ⟩ := heat_conjugates_exist J X hX σ hσ hsigma s hs + apply freeFisher_le_liminf_tests _ _ hξ (fun k i p => ∫a,matrixFisherTest p i a ∂matrixHeatLaw (μ k) s) + · exact matrixHeatLaw_fisherTest_tendsto hD0 hD J X hX hself hR hn σ hσ hsigma μ hμ hs + · intro k p + exact matrixHeatLaw_fisher_lower (hD0 k) (μ k) (show 0≤Real.sqrt ((n:ℝ)*D k)*R by positivity) + (diagonalMicrostates_norm_ae X hR μ hμ k) hs p +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixFisherTest.lean b/lean/OAI/Analysis/FreeEntropy/MatrixFisherTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..eeb8961220ca2fe404f4d357beed8b02d15c4a6b --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixFisherTest.lean @@ -0,0 +1,74 @@ +import OAI.Analysis.FreeEntropy.GaussianScore + +namespace OAI + +noncomputable section +open Finset MeasureTheory +namespace FiniteEntropySeparation +variable {n d : ℕ} + def matrixPolynomialDerivative (p : WordPolynomial n) (i : Fin n) (a : MatrixCoordinates n d) : ℂ := + ∑w∈p.support,p w*∑r : Fin w.length,if w[r.val]=i then + matrixMoment a (w.take r.val)*matrixMoment a (w.drop (r.val+1)) else 0 + def matrixFisherTest (p : WordPolynomial n) (i : Fin n) (a : MatrixCoordinates n d) : ℝ := + 2*(matrixPolynomialDerivative p i a).re-matrixPolynomialNorm p a + def matrixRealScore (p : WordPolynomial n) (j k : Fin d) (x : MatrixIndex n d → ℝ) : ℝ := + (d:ℝ)*(matrixScorePolynomial p j k x).re + theorem matrixRealScore_polynomial (p : WordPolynomial n) (j k : Fin d) : + IsRealPolynomial (matrixRealScore p j k) := (matrixScorePolynomial_polynomial p j k).1.const_mul d + theorem matrixRealScore_derivative (p : WordPolynomial n) (i : Fin n) (j k : Fin d) (x : MatrixIndex n d → ℝ) : + coordinateDerivative (matrixRealScore p j k) (i,j,k) x = + (d:ℝ)*(complexCoordinateDerivative (matrixScorePolynomial p j k) (i,j,k) x).re := by + have hp := (matrixScorePolynomial_polynomial p j k) + rw [hp.coordinateDerivative_eq] + simp only [Complex.add_re,Complex.ofReal_re,Complex.mul_re,Complex.ofReal_im, + Complex.I_re,Complex.I_im,mul_zero,mul_one,sub_zero,add_zero] + exact ((hp.1.hasDerivAt (i,j,k) x).const_mul (d:ℝ)).deriv + theorem matrixRealScore_divergence (hd : 0 (normalizedMatrixEntropy_hasDeriv hd μ hK hμ hs).continuousAt.continuousWithinAt + theorem normalizedMatrixFisher_measurable (hd : 0 normalizedMatrixFisher μ s) := by + have he (s : Ioi (0:ℝ)) : normalizedMatrixFisher μ s = 2*deriv (normalizedMatrixEntropy μ) s := by + rw [(normalizedMatrixEntropy_hasDeriv hd μ hK hμ s.property).deriv] + ring + simp_rw [he] + exact ((measurable_deriv (normalizedMatrixEntropy μ)).comp measurable_subtype_coe).const_mul 2 + theorem normalizedMatrixFisher_intervalIntegrable (hd : 0 (1/2:ℝ)*normalizedMatrixFisher μ s) volume a b := + intervalIntegral.intervalIntegrable_deriv_of_nonneg + ((normalizedMatrixEntropy_continuousOn hd μ hK hμ).mono (fun s hs => hmin.trans_le hs.1)) + (fun s hs => normalizedMatrixEntropy_hasDeriv hd μ hK hμ (hmin.trans hs.1)) + (fun s hs => mul_nonneg (by norm_num) (normalizedMatrixFisher_nonneg hd μ (hmin.trans hs.1))) + simpa only [← mul_assoc,show (2:ℝ)*(1/2:ℝ)=1 by norm_num,one_mul] using hi.const_mul (2:ℝ) + theorem normalizedMatrixEntropy_flow (hd : 0 normalizedMatrixEntropy_hasDeriv hd μ hK hμ (hmin.trans_le hs.1)) + ((normalizedMatrixFisher_intervalIntegrable hd μ hK hμ ha hb).const_mul (1/2:ℝ)) + simpa only [intervalIntegral.integral_const_mul] using hf.symm + theorem normalizedMatrixEntropy_cond_lower (hd : 0 ENNReal.ofReal (smoothedDensity μ (s/d) x)) + theorem matrixHeatLaw_eq (hd : 0 heatCoordinates z.1 s z.2) := by + have hsd : 0 Real.sqrt (s/d) • WithLp.toLp 2 x)) = + (μ.prod (productGaussian (MatrixIndex n d))).map (Prod.map id (fun x => Real.sqrt (s/d) • WithLp.toLp 2 x)) := by + convert Measure.map_prod_map μ (productGaussian (MatrixIndex n d)) measurable_id + (show Measurable (fun x : MatrixIndex n d → ℝ => Real.sqrt (s/d) • WithLp.toLp 2 x) from + (show Continuous (WithLp.toLp 2 : (MatrixIndex n d → ℝ) → MatrixCoordinates n d) from PiLp.continuous_toLp 2 _).measurable.const_smul (Real.sqrt (s/d))) using 1 + rw [Measure.map_id] + rw [he,Measure.map_map (show Measurable (fun z : MatrixCoordinates n d × MatrixCoordinates n d => z.1+z.2) from by fun_prop) + (show Measurable (Prod.map id (fun x : MatrixIndex n d → ℝ => Real.sqrt (s/d) • WithLp.toLp 2 x)) from + measurable_id.prodMap ((show Continuous (WithLp.toLp 2 : (MatrixIndex n d → ℝ) → MatrixCoordinates n d) from PiLp.continuous_toLp 2 _).measurable.const_smul (Real.sqrt (s/d))))] + congr 1 + funext z + simp only [Function.comp_apply,Prod.map_fst,Prod.map_snd,id_eq,heatCoordinates,Real.sqrt_div hs.le] + theorem matrixHeatLaw_probability (hd : 0 integral_nonneg (fun y => (normalKernel_pos _ _).le) + rw [matrixHeatLaw,integral_withDensity_eq_integral_toReal_smul] + · simp only [ENNReal.toReal_ofReal (hp _),smul_eq_mul] + · exact ENNReal.measurable_ofReal.comp (smoothedDensity_continuous μ (div_pos hs (by exact_mod_cast hd))).measurable + · exact ae_of_all _ (fun _ => ENNReal.ofReal_lt_top) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixHeatLawMoments.lean b/lean/OAI/Analysis/FreeEntropy/MatrixHeatLawMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd1fb3422b3719d15a5b931ba8bb78c36b667648 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixHeatLawMoments.lean @@ -0,0 +1,62 @@ +import OAI.Analysis.FreeEntropy.MatrixTestPolynomial + +namespace OAI + +universe u1 u2 + +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +namespace FiniteEntropySeparation +variable {n d : ℕ} + theorem integral_heatLaw_eq {E : Type u1} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] + (hd : 0 f (heatCoordinates z.1 s z.2)) (μ.prod (productGaussian (MatrixIndex n d))) := by + rw [matrixHeatLaw_eq hd μ hs] + exact integrable_map_measure hf.aestronglyMeasurable (heatCoordinates_continuous s).measurable.aemeasurable + theorem matrixHeatLaw_moment_integrable (hd : 0 matrixMoment a w) (matrixHeatLaw μ s) := + (integrable_heatLaw_iff hd μ hs _ (matrixMoment_continuous w)).mpr (heatMoment_integrable hd μ hR hμ s w) + theorem matrixHeatLaw_product_integrable (hd : 0 matrixMoment a v*matrixMoment a w) (matrixHeatLaw μ s) := by + apply (integrable_heatLaw_iff hd μ hs _ ((matrixMoment_continuous v).mul (matrixMoment_continuous w))).mpr + exact complex_mul_integrable_of_squares _ + (((matrixMoment_continuous v).comp (heatCoordinates_continuous s)).aestronglyMeasurable) + (((matrixMoment_continuous w).comp (heatCoordinates_continuous s)).aestronglyMeasurable) + (heatMoment_power_integrable hd μ hR hμ s v 2) (heatMoment_power_integrable hd μ hR hμ s w 2) +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] +variable {D : ℕ → ℕ} (hD0 : ∀k,0 ∫a,matrixMoment a w ∂matrixHeatLaw (μ k) s) atTop + (𝓝 (wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) s) w)) := by + simp_rw [integral_heatLaw_eq (hD0 _) _ hs _ (matrixMoment_continuous w)] + exact heatMoment_product_tendsto hD0 hD J X hX hR hn σ hσ hsigma μ hμ s w + theorem matrixHeatLaw_product_tendsto {s : ℝ} (hs : 0 ∫a,matrixMoment a v*matrixMoment a w ∂matrixHeatLaw (μ k) s) atTop + (𝓝 (wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) s) v* + wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) s) w)) := by + have he (k : ℕ) := integral_heatLaw_eq (hD0 k) (μ k) hs (fun a => matrixMoment a v*matrixMoment a w) ((matrixMoment_continuous v).mul (matrixMoment_continuous w)) + simp_rw [he] + exact heatMoment_products_tendsto hD0 hD J X hX hR hn σ hσ hsigma μ hμ s v w +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixHeatLimit.lean b/lean/OAI/Analysis/FreeEntropy/MatrixHeatLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..72f09b02427d52667a3f222a0d1179a00c4cc079 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixHeatLimit.lean @@ -0,0 +1,53 @@ +import OAI.Analysis.FreeEntropy.GUEFreeLaw + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Finset +open scoped Topology +namespace FiniteEntropySeparation +open FreeSeries +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] {n : ℕ} + theorem heatMatrix_meanSquare_tendsto {D : ℕ → ℕ} (hD0 : ∀ k,0 matrixTraceWord (A k) w) atTop (𝓝 (wordMoment (tracialVector B N G) X w))) + (u : ℝ) (w : List (Fin n)) : + Tendsto (fun k => ∫ x, ‖matrixTraceWord (heatMatrix (A k) u x) w- + wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u) w‖^2 ∂productGaussian (MatrixIndex n (D k))) atTop (𝓝 0) := by + have hj (v : List (Fin (n+n))) : + Tendsto (fun k => ∫ x, ‖matrixTraceWord (jointFinMatrix (A k) x) v- + wordMoment (tracialVector B N G) (jointTuple X σ) v‖^2 ∂productGaussian (MatrixIndex n (D k))) atTop (𝓝 0) := by + have hm := expectedMatrixWord_free_tendsto hD0 hD A hR hA J X hX σ hσ hs hbase (v.map finSumFinEquiv.symm) + have h := matrixTraceWord_mean_square_tendsto hD0 hD A hR hA (v.map finSumFinEquiv.symm) hm + simpa only [← jointFinMatrix_trace,sumJointMoment,List.map_map,Function.comp_def,Equiv.apply_symm_apply,List.map_id',List.map_id_fun] using h + have hpoly (k:ℕ) (v : List (Fin (n+n))) : IsComplexPolynomial (fun x : MatrixIndex n (D k) → ℝ => matrixTraceWord (jointFinMatrix (A k) x) v) := by + simpa only [jointFinMatrix_trace] using matrixTraceWord_polynomial (A k) (v.map finSumFinEquiv.symm) + have h := reparam_L2_tendsto (heatCoefficients u) (fun k x => matrixTraceWord (jointFinMatrix (A k) x)) + (wordMoment (tracialVector B N G) (jointTuple X σ)) hpoly hj w + simpa only [reparam_matrixTraceWord,heatMatrix_linear,reparam_wordMoment,heat_linear_tuple] using h + theorem heatMatrix_probability_tendsto {D : ℕ → ℕ} (hD0 : ∀ k,0 matrixTraceWord (A k) w) atTop (𝓝 (wordMoment (tracialVector B N G) X w))) + (u : ℝ) (w : List (Fin n)) {ε : ℝ} (hε : 0<ε) : + Tendsto (fun k => (productGaussian (MatrixIndex n (D k))).real {x | ε ≤ ‖matrixTraceWord (heatMatrix (A k) u x) w- + wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u) w‖}) atTop (𝓝 0) := by + apply squeeze_zero (fun _ => measureReal_nonneg) (fun k => probability_error_le_mean_square _ hε ?_) + (by simpa using (heatMatrix_meanSquare_tendsto hD0 hD A hR hA J X hX σ hσ hs hbase u w).div_const (ε^2)) + apply IsComplexPolynomial.norm_sq + (IsComplexPolynomial.sub ?_ (IsComplexPolynomial.const _)) |>.integrable + have hp := reparam_polynomial (heatCoefficients u) (fun x => matrixTraceWord (jointFinMatrix (A k) x)) (fun v => by + simpa only [jointFinMatrix_trace] using matrixTraceWord_polynomial (A k) (v.map finSumFinEquiv.symm)) w + simpa only [reparam_matrixTraceWord,heatMatrix_linear] using hp +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixHilbertSchmidt.lean b/lean/OAI/Analysis/FreeEntropy/MatrixHilbertSchmidt.lean new file mode 100644 index 0000000000000000000000000000000000000000..df69dde5187137b018e50e653b3d9182c84a0238 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixHilbertSchmidt.lean @@ -0,0 +1,133 @@ +import OAI.Analysis.FreeEntropy.MatrixChartInverse + +namespace OAI + +noncomputable section +open scoped ComplexConjugate Matrix.Norms.L2Operator +open Finset +namespace FiniteEntropySeparation +variable {n d : ℕ} + def hsVector (A : Matrix (Fin d) (Fin d) ℂ) : EuclideanSpace ℂ (Fin d×Fin d) := + WithLp.toLp 2 (fun q => A q.1 q.2) + def hsNorm (A : Matrix (Fin d) (Fin d) ℂ) : ℝ := ‖hsVector A‖ + theorem hsNorm_sq (A : Matrix (Fin d) (Fin d) ℂ) : + hsNorm A^2=∑j,∑k,Complex.normSq (A j k) := by + rw [hsNorm,EuclideanSpace.norm_sq_eq] + simp [hsVector,Fintype.sum_prod_type,Complex.normSq_eq_norm_sq] + theorem hsNorm_nonneg (A : Matrix (Fin d) (Fin d) ℂ) : 0≤hsNorm A := norm_nonneg _ + theorem hsNorm_add (A B : Matrix (Fin d) (Fin d) ℂ) : hsNorm (A+B) ≤ hsNorm A+hsNorm B := by + have he : hsVector (A+B)=hsVector A+hsVector B := by ext q; rfl + simpa only [hsNorm,he] using norm_add_le (hsVector A) (hsVector B) + theorem hsNorm_sub (A B : Matrix (Fin d) (Fin d) ℂ) : hsNorm (A-B) ≤ hsNorm A+hsNorm B := by + have he : hsVector (A-B)=hsVector A-hsVector B := by ext q; rfl + simpa only [hsNorm,he] using norm_sub_le (hsVector A) (hsVector B) + theorem hsNorm_star (A : Matrix (Fin d) (Fin d) ℂ) : hsNorm A.conjTranspose=hsNorm A := by + apply (sq_eq_sq₀ (hsNorm_nonneg _) (hsNorm_nonneg _)).mp + simp only [hsNorm_sq,Matrix.conjTranspose_apply,Complex.star_def,Complex.normSq_conj] + exact sum_comm + theorem hsNorm_mul_left (A B : Matrix (Fin d) (Fin d) ℂ) : + hsNorm (A*B) ≤ matrixOpNorm A*hsNorm B := by + have hcol k : (∑j,Complex.normSq ((A*B) j k)) ≤ matrixOpNorm A^2*(∑j,Complex.normSq (B j k)) := by + let x : EuclideanSpace ℂ (Fin d) := WithLp.toLp 2 (fun j => B j k) + have hh := (matrixOperator A).le_opNorm x + have hn : ‖matrixOperator A x‖^2 ≤ (matrixOpNorm A*‖x‖)^2 := by + exact pow_le_pow_left₀ (norm_nonneg _) hh 2 + simpa [matrixOperator,Matrix.toLpLin_apply,EuclideanSpace.norm_sq_eq,Matrix.mul_apply, + Matrix.mulVec, dotProduct, x,Complex.normSq_eq_norm_sq,mul_pow,matrixOpNorm] using hn + have hh := sum_le_sum (fun k (_ : k∈(univ:Finset (Fin d))) => hcol k) + rw [sum_comm] at hh + simp only [← mul_sum] at hh + rw [sum_comm (f := fun i j : Fin d => Complex.normSq (B j i)),← hsNorm_sq,← hsNorm_sq] at hh + have hb := hsNorm_nonneg B + have hab := hsNorm_nonneg (A*B) + have ha := matrixOpNorm_nonneg A + apply (sq_le_sq₀ hab (mul_nonneg ha hb)).mp + simpa only [mul_pow] using hh + theorem hsNorm_mul_right (A B : Matrix (Fin d) (Fin d) ℂ) : + hsNorm (A*B) ≤ hsNorm A*matrixOpNorm B := by + rw [← hsNorm_star (A*B),Matrix.conjTranspose_mul] + have hh := hsNorm_mul_left B.conjTranspose A.conjTranspose + rw [hsNorm_star] at hh + have he : matrixOpNorm B.conjTranspose=matrixOpNorm B := Matrix.l2_opNorm_conjTranspose B + rw [he,mul_comm] at hh + exact hh + theorem hsNorm_unitary_conjugate (U : unitary (Matrix (Fin d) (Fin d) ℂ)) (A : Matrix (Fin d) (Fin d) ℂ) : + hsNorm (star (U:Matrix (Fin d) (Fin d) ℂ)*A*(U:Matrix (Fin d) (Fin d) ℂ))=hsNorm A := by + apply (sq_eq_sq₀ (hsNorm_nonneg _) (hsNorm_nonneg _)).mp + rw [hsNorm_sq,hsNorm_sq,← trace_conjTranspose_mul_re,← trace_conjTranspose_mul_re] + congr 1 + simp only [← Matrix.star_eq_conjTranspose,star_mul,star_star] + have h1 : (U:Matrix (Fin d) (Fin d) ℂ)*star (U:Matrix (Fin d) (Fin d) ℂ)=1 := Unitary.coe_mul_star_self U + have h2 : star (U:Matrix (Fin d) (Fin d) ℂ)*(U:Matrix (Fin d) (Fin d) ℂ)=1 := Unitary.coe_star_mul_self U + calc + _ = Matrix.trace (star (U:Matrix (Fin d) (Fin d) ℂ)*(star A*A)*(U:Matrix (Fin d) (Fin d) ℂ)) := by + congr 1 + calc + _ = star (U:Matrix (Fin d) (Fin d) ℂ)*star A*((U:Matrix (Fin d) (Fin d) ℂ)*star (U:Matrix (Fin d) (Fin d) ℂ))*A*(U:Matrix (Fin d) (Fin d) ℂ) := by noncomm_ring + _ = _ := by rw [h1]; noncomm_ring + _ = _ := by rw [Matrix.trace_mul_cycle, h1,one_mul] + theorem hermitianChart_injective : Function.Injective (hermitianChart n d) := by + intro a b hab + have he : hermitianChart n d (a-b)=0 := by rw [map_sub,hab,sub_self] + have hz := hermitianChart_normSq (a-b) + have hh : ∀i,hermitianMatrix (a-b) i=0 := congrFun he + simp only [hh,Matrix.zero_apply,map_zero,sum_const_zero] at hz + exact sub_eq_zero.mp (norm_eq_zero.mp (by nlinarith [norm_nonneg (a-b)])) + theorem matrixCoordinates_hermitianMatrix (a : MatrixCoordinates n d) : + matrixCoordinatesOfHermitian (hermitianMatrix a)=a := by + apply hermitianChart_injective + funext i + exact hermitianMatrix_coordinatesOfHermitian _ (hermitianMatrix_isHermitian a) i + def rotateCoordinates (U : unitary (Matrix (Fin d) (Fin d) ℂ)) (a : MatrixCoordinates n d) : MatrixCoordinates n d := + matrixCoordinatesOfHermitian (fun i => star (U:Matrix (Fin d) (Fin d) ℂ)*hermitianMatrix a i*U) + theorem conjugate_hermitian (U : unitary (Matrix (Fin d) (Fin d) ℂ)) (A : Matrix (Fin d) (Fin d) ℂ) + (hA : A.IsHermitian) : (star (U:Matrix (Fin d) (Fin d) ℂ)*A*U).IsHermitian := by + change star _ = _ + simp only [star_mul,star_star] + rw [show star A=A from hA] + simp only [mul_assoc] + theorem hermitianMatrix_rotate (U : unitary (Matrix (Fin d) (Fin d) ℂ)) (a : MatrixCoordinates n d) (i : Fin n) : + hermitianMatrix (rotateCoordinates U a) i=star (U:Matrix (Fin d) (Fin d) ℂ)*hermitianMatrix a i*U := + hermitianMatrix_coordinatesOfHermitian _ (fun i => conjugate_hermitian U _ (hermitianMatrix_isHermitian a i)) i + theorem rotateCoordinates_norm (U : unitary (Matrix (Fin d) (Fin d) ℂ)) (a : MatrixCoordinates n d) : + ‖rotateCoordinates U a‖=‖a‖ := by + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [← hermitianChart_normSq,← hermitianChart_normSq] + simp_rw [hermitianMatrix_rotate,← hsNorm_sq] + apply sum_congr rfl + intro i _ + rw [hsNorm_unitary_conjugate] + def rotateLinearIsometryEquiv (U : unitary (Matrix (Fin d) (Fin d) ℂ)) : + MatrixCoordinates n d ≃ₗᵢ[ℝ] MatrixCoordinates n d where + toFun := rotateCoordinates U + invFun := rotateCoordinates (star U) + left_inv a := by + apply hermitianChart_injective + funext i + simp only [hermitianChart,LinearMap.coe_mk,AddHom.coe_mk,hermitianMatrix_rotate,Unitary.coe_star,star_star] + have h : (U:Matrix (Fin d) (Fin d) ℂ)*star (U:Matrix (Fin d) (Fin d) ℂ)=1 := Unitary.coe_mul_star_self U + calc + _ = ((U:Matrix (Fin d) (Fin d) ℂ)*star (U:Matrix (Fin d) (Fin d) ℂ))*hermitianMatrix a i*((U:Matrix (Fin d) (Fin d) ℂ)*star (U:Matrix (Fin d) (Fin d) ℂ)) := by noncomm_ring + _ = _ := by rw [h,one_mul,mul_one] + right_inv a := by + apply hermitianChart_injective + funext i + simp only [hermitianChart,LinearMap.coe_mk,AddHom.coe_mk,hermitianMatrix_rotate,Unitary.coe_star,star_star] + have h : star (U:Matrix (Fin d) (Fin d) ℂ)*(U:Matrix (Fin d) (Fin d) ℂ)=1 := Unitary.coe_star_mul_self U + calc + _ = (star (U:Matrix (Fin d) (Fin d) ℂ)*(U:Matrix (Fin d) (Fin d) ℂ))*hermitianMatrix a i*(star (U:Matrix (Fin d) (Fin d) ℂ)*(U:Matrix (Fin d) (Fin d) ℂ)) := by noncomm_ring + _ = _ := by rw [h,one_mul,mul_one] + map_add' a b := by + apply hermitianChart_injective + funext i + simp [hermitianChart,hermitianMatrix_rotate,hermitianMatrix_add,mul_add,add_mul] + map_smul' r a := by + apply hermitianChart_injective + funext i + simp [hermitianChart,hermitianMatrix_rotate,hermitianMatrix_smul,Algebra.mul_smul_comm,Algebra.smul_mul_assoc] + norm_map' := rotateCoordinates_norm U +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixOperator.lean b/lean/OAI/Analysis/FreeEntropy/MatrixOperator.lean new file mode 100644 index 0000000000000000000000000000000000000000..03d115faee2b06527b516e821cb6e87a838ed26e --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixOperator.lean @@ -0,0 +1,89 @@ +import OAI.Analysis.FreeEntropy.MatrixParseval + +namespace OAI + +universe u1 + +noncomputable section +open scoped ComplexConjugate +open Finset +namespace FiniteEntropySeparation + def matrixOperator {d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) : EuclideanSpace ℂ (Fin d) →L[ℂ] EuclideanSpace ℂ (Fin d) := + (Matrix.toEuclideanLin A).toContinuousLinearMap + theorem matrixOperator_mul {d : ℕ} (A B : Matrix (Fin d) (Fin d) ℂ) : + matrixOperator (A*B) = matrixOperator A*matrixOperator B := by + ext x j + simp [matrixOperator, Matrix.toLpLin_apply, Matrix.mulVec_mulVec] + theorem matrixOperator_one {d : ℕ} : matrixOperator (1 : Matrix (Fin d) (Fin d) ℂ) = 1 := by + ext x j + simp [matrixOperator] + theorem matrixOperator_add {d : ℕ} (A B : Matrix (Fin d) (Fin d) ℂ) : + matrixOperator (A+B) = matrixOperator A+matrixOperator B := by + ext x j + simp [matrixOperator, Matrix.toLpLin_apply] + theorem matrixOperator_smul {d : ℕ} (c : ℂ) (A : Matrix (Fin d) (Fin d) ℂ) : + matrixOperator (c • A) = c • matrixOperator A := by + ext x j + simp [matrixOperator, Matrix.toLpLin_apply] + theorem matrixOpNorm_nonneg {d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) : 0 ≤ matrixOpNorm A := norm_nonneg _ + theorem matrixOpNorm_mul {d : ℕ} (A B : Matrix (Fin d) (Fin d) ℂ) : + matrixOpNorm (A*B) ≤ matrixOpNorm A*matrixOpNorm B := by + change ‖matrixOperator (A*B)‖ ≤ ‖matrixOperator A‖*‖matrixOperator B‖ + rw [matrixOperator_mul] + exact norm_mul_le _ _ + theorem matrixOpNorm_one {d : ℕ} : matrixOpNorm (1 : Matrix (Fin d) (Fin d) ℂ) ≤ 1 := by + change ‖matrixOperator (1 : Matrix (Fin d) (Fin d) ℂ)‖ ≤ 1 + rw [matrixOperator_one] + exact ContinuousLinearMap.norm_id_le + theorem matrixOpNorm_add {d : ℕ} (A B : Matrix (Fin d) (Fin d) ℂ) : + matrixOpNorm (A+B) ≤ matrixOpNorm A+matrixOpNorm B := by + change ‖matrixOperator (A+B)‖ ≤ ‖matrixOperator A‖+‖matrixOperator B‖ + rw [matrixOperator_add] + exact norm_add_le _ _ + theorem matrixOpNorm_smul {d : ℕ} (c : ℂ) (A : Matrix (Fin d) (Fin d) ℂ) : + matrixOpNorm (c • A) = ‖c‖*matrixOpNorm A := by + change ‖matrixOperator (c • A)‖ = ‖c‖*‖matrixOperator A‖ + rw [matrixOperator_smul, norm_smul] + theorem matrixOpNorm_prod {d : ℕ} (L : List (Matrix (Fin d) (Fin d) ℂ)) : + matrixOpNorm L.prod ≤ (L.map matrixOpNorm).prod := by + induction L with + | nil => exact matrixOpNorm_one + | cons A L ih => + simpa only [List.prod_cons, List.map_cons] using (matrixOpNorm_mul A L.prod).trans + (mul_le_mul_of_nonneg_left ih (matrixOpNorm_nonneg A)) + theorem matrixOpNorm_word {ι : Type u1} {d : ℕ} (A : ι → Matrix (Fin d) (Fin d) ℂ) (w : List ι) + {K : ℝ} (hK : 0 ≤ K) (hA : ∀ i ∈ w, matrixOpNorm (A i) ≤ K) : + matrixOpNorm (w.map A).prod ≤ K^w.length := by + induction w with + | nil => simpa using (matrixOpNorm_one (d := d)) + | cons i w ih => + simp only [List.map_cons, List.prod_cons, List.length_cons, pow_succ] + rw [mul_comm (K^w.length) K] + exact (matrixOpNorm_mul _ _).trans (mul_le_mul (hA i (by simp)) + (ih (fun j hj => hA j (by simp [hj]))) (matrixOpNorm_nonneg _) hK) + theorem matrix_entry_bound {d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) (j k : Fin d) : + ‖A j k‖ ≤ matrixOpNorm A := by + have h := matrix_column_bound A k + have hs := single_le_sum (fun i (_ : i ∈ (univ : Finset (Fin d))) => Complex.normSq_nonneg (A i k)) (mem_univ j) + rw [Complex.normSq_eq_norm_sq] at hs + have hn := (norm_nonneg (A j k)) + have hN := matrixOpNorm_nonneg A + nlinarith + theorem matrix_trace_bound {d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) : + ‖Matrix.trace A‖ ≤ (d:ℝ)*matrixOpNorm A := by + calc + _ ≤ ∑ j, ‖A j j‖ := norm_sum_le _ _ + _ ≤ ∑ _j : Fin d, matrixOpNorm A := sum_le_sum (fun j _ => matrix_entry_bound A j j) + _ = _ := by simp + theorem matrix_normalized_trace_bound {d : ℕ} (hd : 0 < d) (A : Matrix (Fin d) (Fin d) ℂ) : + ‖(d:ℂ)⁻¹*Matrix.trace A‖ ≤ matrixOpNorm A := by + rw [norm_mul, norm_inv, Complex.norm_natCast] + have h := matrix_trace_bound A + calc + (d:ℝ)⁻¹*‖Matrix.trace A‖ ≤ (d:ℝ)⁻¹*((d:ℝ)*matrixOpNorm A) := mul_le_mul_of_nonneg_left h (by positivity) + _ = _ := by rw [← mul_assoc, inv_mul_cancel₀ (by exact_mod_cast hd.ne'), one_mul] +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixParseval.lean b/lean/OAI/Analysis/FreeEntropy/MatrixParseval.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d17fe2ebfeb1841dc34ae81f43726a5902abf26 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixParseval.lean @@ -0,0 +1,67 @@ +import OAI.Analysis.FreeEntropy.MatrixBounds + +namespace OAI + +noncomputable section +open scoped ComplexConjugate +open Finset +namespace FiniteEntropySeparation + theorem coordinateMatrix_expand {n d : ℕ} (x : MatrixIndex n d → ℝ) (i : Fin n) : + coordinateMatrix x i = ∑ j, ∑ k, (x (i,j,k) : ℂ) • hermitianBasis j k := by + have hx : (WithLp.toLp 2 x : MatrixCoordinates n d) = ∑ q, x q • EuclideanSpace.single q 1 := by + ext q + simp [EuclideanSpace.single, Pi.single_apply] + have he := congrArg (fun a : MatrixCoordinates n d => (hermitianChart n d a) i) hx + change coordinateMatrix x i = _ at he + rw [he] + simp only [map_sum, map_smul, Finset.sum_apply, Pi.smul_apply] + change (∑ q : MatrixIndex n d, x q • hermitianMatrix (EuclideanSpace.single q 1) i) = _ + simp only [Fintype.sum_prod_type, hermitianMatrix_single] + simp only [smul_ite, smul_zero, sum_ite_irrel, sum_const_zero, sum_ite_eq', mem_univ, ite_true] + apply sum_congr rfl + intro j hj + apply sum_congr rfl + intro k hk + ext a b + exact Complex.real_smul + theorem basis_pair_parseval {d : ℕ} (j k : Fin d) (D : Matrix (Fin d) (Fin d) ℂ) : + Complex.normSq (Matrix.trace (hermitianBasis j k*D)) + Complex.normSq (Matrix.trace (hermitianBasis k j*D)) = + Complex.normSq (D j k)+Complex.normSq (D k j) := by + by_cases hjk : j=k + · subst k; simp [hermitianBasis, Matrix.trace_single_mul] + have hcalc (z w : ℂ) : + Complex.normSq (((Real.sqrt 2 : ℂ)⁻¹)*(z+w)) + + Complex.normSq (Complex.I*((Real.sqrt 2 : ℂ)⁻¹)*(w-z)) = Complex.normSq z+Complex.normSq w := by + have hs : Complex.normSq ((Real.sqrt 2 : ℂ)⁻¹) = (1/2 : ℝ) := by + simp [Complex.normSq_ofReal, Real.mul_self_sqrt (by norm_num : (0:ℝ) ≤ 2)] + simp only [map_mul, hs, one_mul, Complex.normSq_apply, + Complex.add_re, Complex.add_im, Complex.sub_re, Complex.sub_im, Complex.I_re, Complex.I_im] + ring + rcases lt_or_gt_of_ne hjk with h | h + · simpa [hermitianBasis, hjk, Ne.symm hjk, h, not_lt_of_gt h, + smul_mul_assoc, Matrix.trace_smul, Matrix.add_mul, Matrix.sub_mul, + Matrix.trace_add, Matrix.trace_sub, Matrix.trace_single_mul, smul_eq_mul, + add_comm, mul_add] using hcalc (D j k) (D k j) + · simpa [hermitianBasis, hjk, Ne.symm hjk, h, not_lt_of_gt h, + smul_mul_assoc, Matrix.trace_smul, Matrix.add_mul, Matrix.sub_mul, + Matrix.trace_add, Matrix.trace_sub, Matrix.trace_single_mul, smul_eq_mul, + add_comm, mul_add] using hcalc (D k j) (D j k) + theorem hermitianBasis_parseval {d : ℕ} (D : Matrix (Fin d) (Fin d) ℂ) : + (∑ j, ∑ k, Complex.normSq (Matrix.trace (hermitianBasis j k*D))) = ∑ j, ∑ k, Complex.normSq (D j k) := by + have hp := congrArg (fun f : Fin d → Fin d → ℝ => ∑ j, ∑ k, f j k) + (funext (fun j => funext (fun k => basis_pair_parseval j k D))) + simp only [sum_add_distrib] at hp + have hswap : (∑ j : Fin d, ∑ k : Fin d, Complex.normSq (Matrix.trace (hermitianBasis k j*D))) = + ∑ j : Fin d, ∑ k : Fin d, Complex.normSq (Matrix.trace (hermitianBasis j k*D)) := sum_comm + have hswap' : (∑ j : Fin d, ∑ k : Fin d, Complex.normSq (D k j)) = ∑ j : Fin d, ∑ k : Fin d, Complex.normSq (D j k) := sum_comm + rw [hswap,hswap'] at hp + linarith + theorem hermitianBasis_trace_bound {d : ℕ} (D : Matrix (Fin d) (Fin d) ℂ) : + (∑ j, ∑ k, ‖Matrix.trace (hermitianBasis j k*D)‖^2) ≤ (d:ℝ)*matrixOpNorm D^2 := by + simp_rw [← Complex.normSq_eq_norm_sq, hermitianBasis_parseval] + exact matrix_frobenius_bound D +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixPolynomial.lean b/lean/OAI/Analysis/FreeEntropy/MatrixPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..cde271256484606543a026d2580559ac1e11fb19 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixPolynomial.lean @@ -0,0 +1,73 @@ +import OAI.Analysis.FreeEntropy.ComplexPolynomialFunctions + +namespace OAI + +universe u1 u2 u3 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +namespace FiniteEntropySeparation + abbrev MatrixIndex (n d : ℕ) := Fin n × Fin d × Fin d + def coordinateMatrix {n d : ℕ} (x : MatrixIndex n d → ℝ) (i : Fin n) : Matrix (Fin d) (Fin d) ℂ := + hermitianMatrix (WithLp.toLp 2 x) i + theorem coordinateMatrix_polynomial {n d : ℕ} (i : Fin n) (j k : Fin d) : + IsComplexPolynomial (fun x : MatrixIndex n d → ℝ => coordinateMatrix x i j k) := by + unfold coordinateMatrix hermitianMatrix + split_ifs + · exact IsComplexPolynomial.coord _ + · simpa only [div_eq_mul_inv, mul_comm, WithLp.ofLp_toLp] using ((IsComplexPolynomial.coord (i,j,k)).add ((IsComplexPolynomial.coord (i,k,j)).const_mul Complex.I)).mul_const ((Real.sqrt 2 : ℂ)⁻¹) + · simpa only [div_eq_mul_inv, mul_comm, WithLp.ofLp_toLp] using ((IsComplexPolynomial.coord (i,k,j)).sub ((IsComplexPolynomial.coord (i,j,k)).const_mul Complex.I)).mul_const ((Real.sqrt 2 : ℂ)⁻¹) + theorem coordinateMatrix_update {n d : ℕ} (x : MatrixIndex n d → ℝ) (q : MatrixIndex n d) (t : ℝ) (i : Fin n) : + coordinateMatrix (Function.update x q t) i = coordinateMatrix x i + + (t-x q) • (if q.1=i then hermitianBasis q.2.1 q.2.2 else 0) := by + have he : (WithLp.toLp 2 (Function.update x q t) : MatrixCoordinates n d) = + WithLp.toLp 2 x + (t-x q) • EuclideanSpace.single q 1 := by + ext a + by_cases h : a=q + · subst a; simp + · simp [EuclideanSpace.single, h] + unfold coordinateMatrix + rw [he, hermitianMatrix_add, hermitianMatrix_smul, hermitianMatrix_single] + theorem coordinateMatrix_hasDeriv {n d : ℕ} (x : MatrixIndex n d → ℝ) (q : MatrixIndex n d) (i : Fin n) (j k : Fin d) : + HasDerivAt (fun t => coordinateMatrix (Function.update x q t) i j k) + ((if q.1=i then hermitianBasis q.2.1 q.2.2 else 0) j k) (x q) := by + let D : Matrix (Fin d) (Fin d) ℂ := if q.1=i then hermitianBasis q.2.1 q.2.2 else 0 + have hd : HasDerivAt (fun t : ℝ => coordinateMatrix x i j k + ((t-x q : ℝ) : ℂ)*(D j k)) (D j k) (x q) := by + simpa using ((((hasDerivAt_id (x q)).sub_const (x q)).ofReal_comp.mul_const (D j k)).const_add (coordinateMatrix x i j k)) + convert hd using 1 ; try rfl + funext t + rw [coordinateMatrix_update] + by_cases he : q.1=i <;> simp [he, Matrix.add_apply, Matrix.smul_apply, Complex.real_smul, D] + variable {ι : Type u1} {κ : Type u2} {d : Type u3} [Fintype ι] [DecidableEq ι] [Fintype d] [DecidableEq d] + def IsMatrixPolynomial (A : (ι → ℝ) → Matrix d d ℂ) : Prop := ∀ j k, IsComplexPolynomial (fun x => A x j k) + namespace IsMatrixPolynomial + theorem const {ι : Type u1} {d : Type u3} [Fintype ι] [DecidableEq ι] [Fintype d] [DecidableEq d] (A : Matrix d d ℂ) : IsMatrixPolynomial (fun _ : ι → ℝ => A) := fun _ _ => IsComplexPolynomial.const _ + theorem add {ι : Type u1} {d : Type u3} [Fintype ι] [DecidableEq ι] [Fintype d] [DecidableEq d] {A B : (ι → ℝ) → Matrix d d ℂ} (hA : IsMatrixPolynomial A) (hB : IsMatrixPolynomial B) : + IsMatrixPolynomial (fun x => A x+B x) := fun j k => (hA j k).add (hB j k) + theorem mul {ι : Type u1} {d : Type u3} [Fintype ι] [DecidableEq ι] [Fintype d] [DecidableEq d] {A B : (ι → ℝ) → Matrix d d ℂ} (hA : IsMatrixPolynomial A) (hB : IsMatrixPolynomial B) : + IsMatrixPolynomial (fun x => A x*B x) := by + intro j k + exact IsComplexPolynomial.finset_sum univ (fun l _ => (hA j l).mul (hB l k)) + theorem smul {ι : Type u1} {d : Type u3} [Fintype ι] [DecidableEq ι] [Fintype d] [DecidableEq d] {A : (ι → ℝ) → Matrix d d ℂ} (hA : IsMatrixPolynomial A) (c : ℂ) : + IsMatrixPolynomial (fun x => c • A x) := fun j k => (hA j k).const_mul c + theorem trace {ι : Type u1} {d : Type u3} [Fintype ι] [DecidableEq ι] [Fintype d] [DecidableEq d] {A : (ι → ℝ) → Matrix d d ℂ} (hA : IsMatrixPolynomial A) : + IsComplexPolynomial (fun x => Matrix.trace (A x)) := + IsComplexPolynomial.finset_sum univ (fun j _ => hA j j) + theorem word {A : κ → (ι → ℝ) → Matrix d d ℂ} (hA : ∀ i, IsMatrixPolynomial (A i)) (w : List κ) : + IsMatrixPolynomial (fun x => (w.map (fun i => A i x)).prod) := by + induction w with + | nil => exact const 1 + | cons i w ih => exact (hA i).mul ih + end IsMatrixPolynomial + theorem hasDerivAt_matrix_mul {d : Type u3} [Fintype d] [DecidableEq d] {A B : ℝ → Matrix d d ℂ} {A' B' : Matrix d d ℂ} {t : ℝ} + (hA : ∀ j k, HasDerivAt (fun s => A s j k) (A' j k) t) + (hB : ∀ j k, HasDerivAt (fun s => B s j k) (B' j k) t) : + ∀ j k, HasDerivAt (fun s => (A s*B s) j k) ((A'*B t+A t*B') j k) t := by + intro j k + have hd := HasDerivAt.sum (u := univ) (fun l _ => (hA j l).mul (hB l k)) + simpa [Matrix.mul_apply, sum_add_distrib, Matrix.add_apply, Finset.sum_fn] using hd +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixPolynomialNorm.lean b/lean/OAI/Analysis/FreeEntropy/MatrixPolynomialNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..39bfa6ae99247f3d022a75a6c663f17ed5e680e7 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixPolynomialNorm.lean @@ -0,0 +1,84 @@ +import OAI.Analysis.FreeEntropy.FisherLaw + +namespace OAI + +noncomputable section +open scoped ComplexConjugate +open Finset +namespace FiniteEntropySeparation +variable {n d : ℕ} + theorem trace_conjTranspose_mul_re (D : Matrix (Fin d) (Fin d) ℂ) : + (Matrix.trace (D.conjTranspose*D)).re = ∑j,∑k,Complex.normSq (D j k) := by + simp only [Matrix.trace,Matrix.diag,Matrix.mul_apply,Matrix.conjTranspose_apply,Complex.re_sum,Complex.mul_re,Complex.star_def, + Complex.conj_re,Complex.conj_im,neg_mul,sub_neg_eq_add,Complex.normSq_apply] + exact sum_comm + theorem matrixWord_conjTranspose (A : Fin n → Matrix (Fin d) (Fin d) ℂ) + (hA : ∀i,(A i).IsHermitian) (w : List (Fin n)) : + (matrixWord A w).conjTranspose = matrixWord A w.reverse := by + induction w with + | nil => simp [matrixWord] + | cons i w ih => + simp only [matrixWord_cons,Matrix.conjTranspose_mul,ih,(hA i).eq,List.reverse_cons, + matrixWord_append,matrixWord_cons,matrixWord_nil,mul_one] + theorem matrixScorePolynomial_norm_lower (p : WordPolynomial n) (x : MatrixIndex n d → ℝ) : + (∑j,∑k,(matrixScorePolynomial p j k x).re^2) ≤ + (Matrix.trace ((matrixPolynomial p (coordinateMatrix x)).conjTranspose*matrixPolynomial p (coordinateMatrix x))).re := by + rw [trace_conjTranspose_mul_re,← hermitianBasis_parseval] + apply sum_le_sum + intro j _ + apply sum_le_sum + intro k _ + change (matrixScorePolynomial p j k x).re^2 ≤ Complex.normSq (matrixScorePolynomial p j k x) + simp only [Complex.normSq_apply] + nlinarith [sq_nonneg (matrixScorePolynomial p j k x).im] + def matrixPolynomialNorm (p : WordPolynomial n) (a : MatrixCoordinates n d) : ℝ := + (∑u∈p.support,∑v∈p.support,star (p u)*p v*matrixMoment a (u.reverse++v)).re + theorem matrixPolynomialNorm_trace (p : WordPolynomial n) (a : MatrixCoordinates n d) : + matrixPolynomialNorm p a = (d:ℝ)⁻¹*(Matrix.trace + ((matrixPolynomial p (hermitianMatrix a)).conjTranspose*matrixPolynomial p (hermitianMatrix a))).re := by + have he : Matrix.trace ((matrixPolynomial p (hermitianMatrix a)).conjTranspose*matrixPolynomial p (hermitianMatrix a)) = + ∑u∈p.support,∑v∈p.support,star (p u)*p v*Matrix.trace (matrixWord (hermitianMatrix a) (u.reverse++v)) := by + simp only [matrixPolynomial,Finsupp.sum,Matrix.conjTranspose_sum,Matrix.conjTranspose_smul, + matrixWord_conjTranspose _ (hermitianMatrix_isHermitian a),sum_mul,mul_sum, + smul_mul_assoc,mul_smul_comm,Matrix.trace_sum,Matrix.trace_smul, + smul_eq_mul,matrixWord_append] + rw [sum_comm] + apply sum_congr rfl + intro u _ + apply sum_congr rfl + intro v _ + ring + rw [he] + unfold matrixPolynomialNorm matrixMoment + have he' : (∑u∈p.support,∑v∈p.support,star (p u)*p v*((d:ℂ)⁻¹*Matrix.trace ((u.reverse++v).map (hermitianMatrix a)).prod)) = + (d:ℂ)⁻¹*(∑u∈p.support,∑v∈p.support,star (p u)*p v*Matrix.trace (matrixWord (hermitianMatrix a) (u.reverse++v))) := by + simp only [mul_sum,matrixWord] + apply sum_congr rfl + intro u _ + apply sum_congr rfl + intro v _ + ring + rw [he'] + simp only [← Complex.ofReal_natCast,← Complex.ofReal_inv,Complex.mul_re,Complex.ofReal_re, + Complex.ofReal_im,zero_mul,sub_zero] + theorem polynomialVector_norm_formula {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {M : VonNeumannAlgebra H} (τ : TracialVector M) (X : Fin n → H →L[ℂ] H) + (hX : ∀i,IsSelfAdjoint (X i)) (p : WordPolynomial n) : + ‖polynomialVector τ X p‖^2 = + (∑u∈p.support,∑v∈p.support,star (p u)*p v*wordMoment τ X (u.reverse++v)).re := by + rw [norm_sq_eq_re_inner (𝕜 := ℂ)] + simp only [polynomialVector,Finsupp.linearCombination_apply,Finsupp.sum,sum_inner,inner_sum, + inner_smul_left,inner_smul_right,inner_wordVector τ X hX,mul_assoc,mul_sum] + change (∑u∈p.support,∑v∈p.support,p u*(star (p v)*wordMoment τ X (v.reverse++u))).re = _ + rw [sum_comm] + congr 1 + apply sum_congr rfl + intro u _ + apply sum_congr rfl + intro v _ + ring +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixReparam.lean b/lean/OAI/Analysis/FreeEntropy/MatrixReparam.lean new file mode 100644 index 0000000000000000000000000000000000000000..d989dabea6b55396fb10219e0e075d22ac7650f4 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixReparam.lean @@ -0,0 +1,59 @@ +import OAI.Analysis.FreeEntropy.HeatCumulants + +namespace OAI + +noncomputable section +open Finset +namespace FiniteEntropySeparation +open FreeSeries + theorem reparam_matrixTraceWord {α β : Type} [Fintype α] [DecidableEq α] [Fintype β] [DecidableEq β] {d : ℕ} + (X : α → Matrix (Fin d) (Fin d) ℂ) (c : α → β → ℂ) : + reparam c (matrixTraceWord X) = matrixTraceWord (fun b => ∑ a, c a b • X a) := by + let Y := fun b => ∑ a, c a b • X a + have hh (w : List β) (A : Matrix (Fin d) (Fin d) ℂ) : + reparam c (fun v => (d:ℂ)⁻¹*Matrix.trace (A * matrixWord X v)) w = (d:ℂ)⁻¹*Matrix.trace (A * matrixWord Y w) := by + induction w generalizing A with + | nil => simp [matrixWord] + | cons b w ih => + rw [reparam_cons] + have hf (a : α) : deriv a (fun v => (d:ℂ)⁻¹*Matrix.trace (A * matrixWord X v)) = + (fun v => (d:ℂ)⁻¹*Matrix.trace ((A * X a) * matrixWord X v)) := by + funext v; simp [FreeSeries.deriv, matrixWord, mul_assoc] + simp only [hf, ih] + change _ = (d:ℂ)⁻¹*Matrix.trace (A * (Y b * matrixWord Y w)) + rw [← mul_assoc] + dsimp only [Y] + rw [Finset.mul_sum, Finset.sum_mul, Matrix.trace_sum,Finset.mul_sum] + apply sum_congr rfl + intro a _ + simp only [mul_smul_comm, smul_mul_assoc, Matrix.trace_smul,smul_eq_mul] + ring + funext w + change reparam c (fun v => (d:ℂ)⁻¹*Matrix.trace (matrixWord X v)) w = _ + simpa only [one_mul,Y,matrixTraceWord] using hh w 1 + def jointFinMatrix {n d : ℕ} (A : Fin n → Matrix (Fin d) (Fin d) ℂ) (x : MatrixIndex n d → ℝ) : Fin (n+n) → Matrix (Fin d) (Fin d) ℂ := + Fin.addCases A (gueMatrix x) + theorem jointFinMatrix_trace {n d : ℕ} (A : Fin n → Matrix (Fin d) (Fin d) ℂ) (x : MatrixIndex n d → ℝ) (w : List (Fin (n+n))) : + matrixTraceWord (jointFinMatrix A x) w = matrixTraceWord (jointMatrix A x) (w.map finSumFinEquiv.symm) := by + rw [matrixTraceWord_map] + congr 1 + funext j + obtain ⟨a,rfl⟩ := finSumFinEquiv.surjective j + cases a with + | inl i => simp only [Function.comp_apply,finSumFinEquiv_symm_apply_castAdd,finSumFinEquiv_apply_left,jointFinMatrix,Fin.addCases_left,jointMatrix,Sum.elim_inl] + | inr i => simp only [Function.comp_apply,finSumFinEquiv_symm_apply_natAdd,finSumFinEquiv_apply_right,jointFinMatrix,Fin.addCases_right,jointMatrix,Sum.elim_inr] + def heatMatrix {n d : ℕ} (A : Fin n → Matrix (Fin d) (Fin d) ℂ) (u : ℝ) (x : MatrixIndex n d → ℝ) : Fin n → Matrix (Fin d) (Fin d) ℂ := + fun i => A i+(Real.sqrt u:ℂ) • gueMatrix x i + theorem heatMatrix_linear {n d : ℕ} (A : Fin n → Matrix (Fin d) (Fin d) ℂ) (u : ℝ) (x : MatrixIndex n d → ℝ) : + (fun i => ∑ j, heatCoefficients u j i • jointFinMatrix A x j)=heatMatrix A u x := by + funext i + rw [Fin.sum_univ_add] + simp only [jointFinMatrix,Fin.addCases_left,Fin.addCases_right] + change (∑ j:Fin n,heatCoefficients u (leftIndex j) i • A j)+ + (∑ j:Fin n,heatCoefficients u (rightIndex j) i • gueMatrix x j)=_ + simp [heatMatrix,ite_smul] +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixRotationBounds.lean b/lean/OAI/Analysis/FreeEntropy/MatrixRotationBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..ecad9c2690013a1492065a64a5071de4175a927b --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixRotationBounds.lean @@ -0,0 +1,88 @@ +import OAI.Analysis.FreeEntropy.VolumetricNet + +namespace OAI + +noncomputable section +open scoped Matrix.Norms.L2Operator +open Finset Set +namespace FiniteEntropySeparation +variable {n d : ℕ} + theorem unitary_matrix_norm {d : ℕ} (hd : 0 ?_⟩ + rw [Metric.mem_closedBall,dist_zero_right] + change matrixOpNorm U≤1 + exact (unitary_matrix_norm hd ⟨U,hU⟩).le + theorem unitary_matrix_net (hd : 0 (unitary_matrix_norm hd ⟨U,hU⟩).le) + let g : {U // U∈s} → unitary (Matrix (Fin d) (Fin d) ℂ) := fun U => ⟨U,hs U U.property⟩ + refine ⟨Finset.univ.image g, ?_, ?_⟩ + · intro U + obtain ⟨V,hV,hUV⟩ := hcover U U.property + refine ⟨g ⟨V,hV⟩,mem_image.mpr ⟨⟨V,hV⟩,mem_univ _,rfl⟩,?_⟩ + change ‖(U:Matrix (Fin d) (Fin d) ℂ)-V‖≤ε + simpa only [dist_eq_norm] using hUV + · have he : Module.finrank ℝ (Matrix (Fin d) (Fin d) ℂ)=2*d^2 := by + rw [Module.finrank_matrix,Complex.finrank_real_complex] + simp only [Fintype.card_fin] + ring + calc + _ ≤ (s.card:ℝ) := by exact_mod_cast (Finset.card_image_le.trans_eq (by simp)) + _ ≤ _ := by simpa [he] using hcard +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixScoreWords.lean b/lean/OAI/Analysis/FreeEntropy/MatrixScoreWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..8600651ba63cdfeb4c598751cb64dd8799311b62 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixScoreWords.lean @@ -0,0 +1,99 @@ +import OAI.Analysis.FreeEntropy.FisherVariational + +namespace OAI + +noncomputable section +open scoped ComplexConjugate +open Finset +namespace FiniteEntropySeparation +variable {n d : ℕ} + def matrixScoreWord (w : List (Fin n)) (j k : Fin d) (x : MatrixIndex n d → ℝ) : ℂ := + Matrix.trace (hermitianBasis j k*matrixWord (coordinateMatrix x) w) + theorem matrixScoreWord_polynomial (w : List (Fin n)) (j k : Fin d) : + IsComplexPolynomial (matrixScoreWord w j k) := + ((IsMatrixPolynomial.const (hermitianBasis j k)).mul + (IsMatrixPolynomial.word (fun i a b => coordinateMatrix_polynomial i a b) w)).trace + theorem matrixScoreWord_derivative (w : List (Fin n)) (i : Fin n) (j k : Fin d) (x : MatrixIndex n d → ℝ) : + complexCoordinateDerivative (matrixScoreWord w j k) (i,j,k) x = + ∑r : Fin w.length, if w[r.val]=i then + Matrix.trace (hermitianBasis j k*matrixWord (coordinateMatrix x) (w.take r.val)*hermitianBasis j k* + matrixWord (coordinateMatrix x) (w.drop (r.val+1))) else 0 := by + have hd := hasDerivAt_matrix_mul + (A := fun _ : ℝ => hermitianBasis j k) (A' := 0) + (fun a b => hasDerivAt_const (x (i,j,k)) (hermitianBasis j k a b)) + (hasDerivAt_matrixWord (coordinateMatrix_hasDeriv x (i,j,k)) w) + have ht := HasDerivAt.sum (u := univ) (fun a _ => hd a a) + have he := ht.deriv + simp only [Finset.sum_fn] at he + change complexCoordinateDerivative (matrixScoreWord w j k) (i,j,k) x = _ at he + rw [he] + simp only [Function.update_eq_self,zero_mul,zero_add,Matrix.mul_apply,Matrix.add_apply, + Matrix.zero_apply,zero_mul,zero_add] + change Matrix.trace (hermitianBasis j k*matrixWordVariation (coordinateMatrix x) + (fun a => if i=a then hermitianBasis j k else 0) w) = _ + rw [matrixWordVariation,mul_sum,Matrix.trace_sum] + apply sum_congr rfl + intro r _ + by_cases h : w[r.val]=i + · simp [h,mul_assoc] + · simp [h,Ne.symm h] + theorem hermitianBasis_contract_trace (U V : Matrix (Fin d) (Fin d) ℂ) : + (∑j,∑k,Matrix.trace (hermitianBasis j k*U*hermitianBasis j k*V)) = Matrix.trace U*Matrix.trace V := by + calc + _ = Matrix.trace ((∑j,∑k,hermitianBasis j k*U*hermitianBasis j k)*V) := by + simp only [sum_mul,Matrix.trace_sum] + _ = _ := by rw [hermitianBasis_contract,smul_mul_assoc,one_mul,Matrix.trace_smul,smul_eq_mul] + theorem matrixScoreWord_divergence (w : List (Fin n)) (i : Fin n) (x : MatrixIndex n d → ℝ) : + (∑j,∑k,complexCoordinateDerivative (matrixScoreWord w j k) (i,j,k) x) = + ∑r : Fin w.length, if w[r.val]=i then + Matrix.trace (matrixWord (coordinateMatrix x) (w.take r.val))* + Matrix.trace (matrixWord (coordinateMatrix x) (w.drop (r.val+1))) else 0 := by + simp_rw [matrixScoreWord_derivative] + have hreorder (f : Fin d → Fin d → Fin w.length → ℂ) : + (∑j,∑k,∑r,f j k r) = ∑r,∑j,∑k,f j k r := by + calc + _ = ∑j,∑r,∑k,f j k r := sum_congr rfl (fun j _ => sum_comm) + _ = _ := sum_comm + rw [hreorder] + apply sum_congr rfl + intro r _ + by_cases h : w[r.val]=i + · simp only [h,ite_true] + exact hermitianBasis_contract_trace _ _ + · simp [h] + def matrixPolynomial (p : WordPolynomial n) (A : Fin n → Matrix (Fin d) (Fin d) ℂ) : Matrix (Fin d) (Fin d) ℂ := + p.sum (fun w c => c • matrixWord A w) + def matrixScorePolynomial (p : WordPolynomial n) (j k : Fin d) (x : MatrixIndex n d → ℝ) : ℂ := + Matrix.trace (hermitianBasis j k*matrixPolynomial p (coordinateMatrix x)) + theorem matrixScorePolynomial_sum (p : WordPolynomial n) (j k : Fin d) (x : MatrixIndex n d → ℝ) : + matrixScorePolynomial p j k x = ∑w∈p.support,p w*matrixScoreWord w j k x := by + simp only [matrixScorePolynomial,matrixPolynomial,Finsupp.sum,mul_sum,mul_smul_comm, + Matrix.trace_sum,Matrix.trace_smul,smul_eq_mul,matrixScoreWord] + theorem matrixScorePolynomial_polynomial (p : WordPolynomial n) (j k : Fin d) : + IsComplexPolynomial (matrixScorePolynomial p j k) := by + have he : matrixScorePolynomial p j k = fun x => ∑w∈p.support,p w*matrixScoreWord w j k x := funext (matrixScorePolynomial_sum p j k) + rw [he] + exact IsComplexPolynomial.finset_sum p.support (fun w _ => (matrixScoreWord_polynomial w j k).const_mul (p w)) + theorem matrixScorePolynomial_divergence (p : WordPolynomial n) (i : Fin n) (x : MatrixIndex n d → ℝ) : + (∑j,∑k,complexCoordinateDerivative (matrixScorePolynomial p j k) (i,j,k) x) = + ∑w∈p.support,p w*∑r : Fin w.length, if w[r.val]=i then + Matrix.trace (matrixWord (coordinateMatrix x) (w.take r.val))* + Matrix.trace (matrixWord (coordinateMatrix x) (w.drop (r.val+1))) else 0 := by + have he j k : complexCoordinateDerivative (matrixScorePolynomial p j k) (i,j,k) x = + ∑w∈p.support,p w*complexCoordinateDerivative (matrixScoreWord w j k) (i,j,k) x := by + have hd := HasDerivAt.sum (u := p.support) (fun w _ => ((matrixScoreWord_polynomial w j k).hasDerivAt (i,j,k) x).const_mul (p w)) + simpa only [complexCoordinateDerivative,matrixScorePolynomial_sum,Finset.sum_fn] using hd.deriv + simp_rw [he] + calc + _ = ∑w∈p.support,p w*(∑j,∑k,complexCoordinateDerivative (matrixScoreWord w j k) (i,j,k) x) := by + simp_rw [mul_sum] + calc + _ = ∑j,∑w∈p.support,∑k,p w*complexCoordinateDerivative (matrixScoreWord w j k) (i,j,k) x := + sum_congr rfl (fun j _ => sum_comm) + _ = _ := sum_comm + _ = _ := by simp_rw [matrixScoreWord_divergence] +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixSpectralMoments.lean b/lean/OAI/Analysis/FreeEntropy/MatrixSpectralMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b851f250c553c9fa4373d64936af4138cb8fd0d --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixSpectralMoments.lean @@ -0,0 +1,69 @@ +import OAI.Analysis.FreeEntropy.BlockEventLower + +namespace OAI + +noncomputable section +open Finset +open scoped ComplexConjugate +namespace FiniteEntropySeparation +variable {n d : ℕ} + theorem matrixWord_unitary_conjugate (U : unitary (Matrix (Fin d) (Fin d) ℂ)) + (A : Fin n → Matrix (Fin d) (Fin d) ℂ) (w : List (Fin n)) : + (w.map (fun i => star (U:Matrix (Fin d) (Fin d) ℂ)*A i*(U:Matrix (Fin d) (Fin d) ℂ))).prod = + star (U:Matrix (Fin d) (Fin d) ℂ)*(w.map A).prod*(U:Matrix (Fin d) (Fin d) ℂ) := by + induction w with + | nil => simp [] + | cons i w ih => + simp only [List.map_cons,List.prod_cons,ih] + have hU : (U:Matrix (Fin d) (Fin d) ℂ)*star (U:Matrix (Fin d) (Fin d) ℂ)=1 := by simp + calc + _ = star (U:Matrix (Fin d) (Fin d) ℂ)*A i*((U:Matrix (Fin d) (Fin d) ℂ)*star (U:Matrix (Fin d) (Fin d) ℂ))*(w.map A).prod*(U:Matrix (Fin d) (Fin d) ℂ) := by noncomm_ring + _ = _ := by rw [hU]; noncomm_ring + theorem trace_unitary_conjugate (U : unitary (Matrix (Fin d) (Fin d) ℂ)) (A : Matrix (Fin d) (Fin d) ℂ) : + Matrix.trace (star (U:Matrix (Fin d) (Fin d) ℂ)*A*(U:Matrix (Fin d) (Fin d) ℂ))=Matrix.trace A := by + rw [Matrix.trace_mul_cycle] + have hU : (U:Matrix (Fin d) (Fin d) ℂ)*star (U:Matrix (Fin d) (Fin d) ℂ)=1 := by simp + rw [hU,one_mul] + theorem matrixMoment_rotate (U : unitary (Matrix (Fin d) (Fin d) ℂ)) (a : MatrixCoordinates n d) (w : List (Fin n)) : + matrixMoment (rotateCoordinates U a) w=matrixMoment a w := by + unfold matrixMoment + have he : hermitianMatrix (rotateCoordinates U a)=fun i => star (U:Matrix (Fin d) (Fin d) ℂ)*hermitianMatrix a i*U := funext (hermitianMatrix_rotate U a) + rw [he] + rw [matrixWord_unitary_conjugate,trace_unitary_conjugate] + theorem matrixMoment_replicate (a : MatrixCoordinates n d) (i : Fin n) (k : ℕ) : + matrixMoment a (List.replicate k i)=(d:ℂ)⁻¹*Matrix.trace (hermitianMatrix a i^k) := by + simp [matrixMoment] + theorem diagonal_eigenvalues (a : MatrixCoordinates n d) (i : Fin n) : + hermitianMatrix (rotateCoordinates (hermitianMatrix_isHermitian a i).eigenvectorUnitary a) i = + Matrix.diagonal (fun j => ((hermitianMatrix_isHermitian a i).eigenvalues j:ℂ)) := by + rw [hermitianMatrix_rotate] + simpa [Unitary.conjStarAlgAut_apply,Function.comp_def] using (hermitianMatrix_isHermitian a i).conjStarAlgAut_star_eigenvectorUnitary + theorem matrixMoment_eigenvalues (a : MatrixCoordinates n d) (i : Fin n) (k : ℕ) : + (matrixMoment a (List.replicate k i)).re=(d:ℝ)⁻¹*∑j,((hermitianMatrix_isHermitian a i).eigenvalues j)^k := by + rw [← matrixMoment_rotate (hermitianMatrix_isHermitian a i).eigenvectorUnitary a, + matrixMoment_replicate,diagonal_eigenvalues,Matrix.diagonal_pow,Matrix.trace_diagonal] + simp only [Pi.pow_apply,← Complex.ofReal_pow,← Complex.ofReal_sum,← Complex.ofReal_natCast,← Complex.ofReal_inv,← Complex.ofReal_mul,Complex.ofReal_re] + def matrixUnivariateMoment (q : Polynomial ℝ) (a : MatrixCoordinates n d) (i : Fin n) : ℝ := + ∑k∈q.support,q.coeff k*(matrixMoment a (List.replicate k i)).re + theorem matrixUnivariateMoment_eigenvalues (q : Polynomial ℝ) (a : MatrixCoordinates n d) (i : Fin n) : + matrixUnivariateMoment q a i=(d:ℝ)⁻¹*∑j,q.eval ((hermitianMatrix_isHermitian a i).eigenvalues j) := by + unfold matrixUnivariateMoment + simp_rw [matrixMoment_eigenvalues] + simp only [mul_left_comm (q.coeff _),← mul_sum] + congr 1 + simp only [Polynomial.eval_eq_sum,Polynomial.sum] + rw [sum_comm] + simp only [mul_sum] + theorem equidiscreteAtom_injective {p : ℕ} (hp : 2≤p) : Function.Injective (equidiscreteAtom p) := by + intro l k h + have hd : (p:ℝ)-1≠0 := by + have hh : (2:ℝ)≤p := by exact_mod_cast hp + linarith + unfold equidiscreteAtom at h + have he : (l.val:ℝ)=(k.val:ℝ) := by field_simp [hd] at h; linarith + exact Fin.ext (by exact_mod_cast he) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixTestPolynomial.lean b/lean/OAI/Analysis/FreeEntropy/MatrixTestPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4818c40f36d70cf1b80ff947aecf88c1e76a95b --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixTestPolynomial.lean @@ -0,0 +1,59 @@ +import OAI.Analysis.FreeEntropy.MatrixFisherTest + +namespace OAI + +noncomputable section +open MeasureTheory Finset +namespace FiniteEntropySeparation +variable {n d : ℕ} + theorem matrixMoment_polynomial (w : List (Fin n)) : + IsComplexPolynomial (fun x : MatrixIndex n d → ℝ => matrixMoment (WithLp.toLp 2 x) w) := + ((IsMatrixPolynomial.word (fun i a b => coordinateMatrix_polynomial i a b) w).trace).const_mul ((d:ℂ)⁻¹) + theorem matrixPolynomialDerivative_polynomial (p : WordPolynomial n) (i : Fin n) : + IsComplexPolynomial (fun x : MatrixIndex n d → ℝ => matrixPolynomialDerivative p i (WithLp.toLp 2 x)) := by + apply IsComplexPolynomial.finset_sum p.support + intro w _ + apply IsComplexPolynomial.const_mul + apply IsComplexPolynomial.finset_sum univ + intro r _ + by_cases h : w[r.val]=i + · simp only [h,ite_true] + exact (matrixMoment_polynomial _).mul (matrixMoment_polynomial _) + · simp only [h,ite_false] + exact IsComplexPolynomial.const 0 + theorem matrixPolynomialNorm_polynomial (p : WordPolynomial n) : + IsRealPolynomial (fun x : MatrixIndex n d → ℝ => matrixPolynomialNorm p (WithLp.toLp 2 x)) := + (IsComplexPolynomial.finset_sum p.support (fun u _ => IsComplexPolynomial.finset_sum p.support + (fun v _ => (matrixMoment_polynomial (u.reverse++v)).const_mul (star (p u)*p v)))).1 + theorem matrixFisherTest_polynomial (p : WordPolynomial n) (i : Fin n) : + IsRealPolynomial (fun x : MatrixIndex n d → ℝ => matrixFisherTest p i (WithLp.toLp 2 x)) := + ((matrixPolynomialDerivative_polynomial p i).1.const_mul 2).sub (matrixPolynomialNorm_polynomial p) + theorem matrix_classicalFisher_lower (hd : 0 matrixRealScore (p q.1) q.2.1 q.2.2 + have hf q : IsRealPolynomial (f q) := matrixRealScore_polynomial _ _ _ + have hc := classicalFisher_polynomial_lower μ hK hμ hs f hf + have hi i : Integrable (fun a => matrixFisherTest (p i) i a*smoothedDensity μ s a) := + (matrixFisherTest_polynomial (p i) i).smoothed_integrable μ hs hK hμ + have hj q : Integrable (fun a => (2*coordinateDerivative (f q) q (WithLp.ofLp a)-(f q (WithLp.ofLp a))^2)*smoothedDensity μ s a) := + (((hf q).derivative q).const_mul 2 |>.sub ((hf q).pow 2)).smoothed_integrable μ hs hK hμ + apply le_trans _ hc + rw [Fintype.sum_prod_type] + simp_rw [Fintype.sum_prod_type] + rw [mul_sum] + apply sum_le_sum + intro i _ + rw [← integral_const_mul] + simp_rw [← integral_finsetSum _ (fun k _ => hj (i,_,k))] + rw [← integral_finsetSum _ (fun j _ => integrable_finsetSum _ (fun k _ => hj (i,j,k)))] + apply integral_mono ((hi i).const_mul _) (integrable_finsetSum _ (fun j _ => integrable_finsetSum _ (fun k _ => hj (i,j,k)))) + intro a + have hp := mul_le_mul_of_nonneg_right (matrixFisherTest_pointwise hd (p i) i a) (smoothedDensity_pos μ hs a).le + simpa only [sum_mul,mul_assoc] using hp +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MatrixWordDerivative.lean b/lean/OAI/Analysis/FreeEntropy/MatrixWordDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d0568e641afc0050f3d5d19152db624989fcea2 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MatrixWordDerivative.lean @@ -0,0 +1,71 @@ +import OAI.Analysis.FreeEntropy.MatrixOperator + +namespace OAI + +universe u1 + +noncomputable section +open scoped ComplexConjugate +open Finset +namespace FiniteEntropySeparation + variable {α : Type u1} {d : ℕ} + def matrixWord (A : α → Matrix (Fin d) (Fin d) ℂ) (w : List α) : Matrix (Fin d) (Fin d) ℂ := (w.map A).prod + @[simp] theorem matrixWord_nil (A : α → Matrix (Fin d) (Fin d) ℂ) : matrixWord A [] = 1 := rfl + @[simp] theorem matrixWord_cons (A : α → Matrix (Fin d) (Fin d) ℂ) (a : α) (w : List α) : matrixWord A (a::w) = A a*matrixWord A w := rfl + theorem matrixWord_append (A : α → Matrix (Fin d) (Fin d) ℂ) (u v : List α) : matrixWord A (u++v) = matrixWord A u*matrixWord A v := by simp [matrixWord] + def matrixWordVariation (A D : α → Matrix (Fin d) (Fin d) ℂ) (w : List α) : Matrix (Fin d) (Fin d) ℂ := + ∑ r : Fin w.length, matrixWord A (w.take r.val) * D w[r.val] * matrixWord A (w.drop (r.val+1)) + @[simp] theorem matrixWordVariation_nil (A D : α → Matrix (Fin d) (Fin d) ℂ) : matrixWordVariation A D [] = 0 := by simp [matrixWordVariation] + theorem matrixWordVariation_cons (A D : α → Matrix (Fin d) (Fin d) ℂ) (a : α) (w : List α) : + matrixWordVariation A D (a::w) = D a*matrixWord A w + A a*matrixWordVariation A D w := by + unfold matrixWordVariation + simp only [List.length_cons] + rw [Fin.sum_univ_succ] + simp only [Fin.val_zero, List.take_zero, matrixWord_nil, Nat.zero_add, List.getElem_cons_zero, one_mul, + Fin.val_succ, List.take_succ_cons, List.getElem_cons_succ, List.drop_succ_cons, matrixWord_cons] + rw [mul_sum] + congr 1 + apply sum_congr rfl + intro r _ + simp [mul_assoc] + theorem hasDerivAt_matrixWord {A : ℝ → α → Matrix (Fin d) (Fin d) ℂ} {D : α → Matrix (Fin d) (Fin d) ℂ} {t : ℝ} + (hA : ∀ a j k, HasDerivAt (fun s => A s a j k) (D a j k) t) (w : List α) : + ∀ j k, HasDerivAt (fun s => matrixWord (A s) w j k) (matrixWordVariation (A t) D w j k) t := by + induction w with + | nil => intro j k; simpa using hasDerivAt_const t ((1 : Matrix (Fin d) (Fin d) ℂ) j k) + | cons a w ih => + rw [matrixWordVariation_cons] + exact hasDerivAt_matrix_mul (hA a) ih + theorem hasDerivAt_matrixWord_trace {A : ℝ → α → Matrix (Fin d) (Fin d) ℂ} {D : α → Matrix (Fin d) (Fin d) ℂ} {t : ℝ} + (hA : ∀ a j k, HasDerivAt (fun s => A s a j k) (D a j k) t) (w : List α) : + HasDerivAt (fun s => Matrix.trace (matrixWord (A s) w)) (Matrix.trace (matrixWordVariation (A t) D w)) t := by + simpa only [Matrix.trace, Matrix.diag, Finset.sum_fn] using HasDerivAt.sum (u := univ) (fun j _ => hasDerivAt_matrixWord hA w j j) + theorem matrixWordVariation_trace (A D : α → Matrix (Fin d) (Fin d) ℂ) (w : List α) : + Matrix.trace (matrixWordVariation A D w) = ∑ r : Fin w.length, + Matrix.trace (D w[r.val] * (matrixWord A (w.drop (r.val+1))*matrixWord A (w.take r.val))) := by + rw [matrixWordVariation, Matrix.trace_sum] + apply sum_congr rfl + intro r _ + rw [Matrix.trace_mul_cycle] + exact Matrix.trace_mul_comm _ _ + def cyclicMatrixWord (A : α → Matrix (Fin d) (Fin d) ℂ) (w : List α) (r : Fin w.length) : Matrix (Fin d) (Fin d) ℂ := + matrixWord A (w.drop (r.val+1))*matrixWord A (w.take r.val) + theorem cyclicMatrixWord_bound (A : α → Matrix (Fin d) (Fin d) ℂ) (w : List α) (r : Fin w.length) + {K : ℝ} (hK : 0 ≤ K) (hA : ∀ i ∈ w, matrixOpNorm (A i) ≤ K) : + matrixOpNorm (cyclicMatrixWord A w r) ≤ K^(w.length-1) := by + rw [cyclicMatrixWord, ← matrixWord_append] + have hb := matrixOpNorm_word A (w.drop (r.val+1)++w.take r.val) hK (by + intro i hi + rcases List.mem_append.mp hi with hi | hi + · exact hA i (List.mem_of_mem_drop hi) + · exact hA i (List.mem_of_mem_take hi)) + have he : (w.drop (r.val+1)++w.take r.val).length = w.length-1 := by + simp only [List.length_append, List.length_drop, List.length_take] + have hr := r.isLt + omega + simpa only [he, matrixWord] using hb +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MicrostatesHeat.lean b/lean/OAI/Analysis/FreeEntropy/MicrostatesHeat.lean new file mode 100644 index 0000000000000000000000000000000000000000..709c077204e31425213f8fa98b5bd58673835738 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MicrostatesHeat.lean @@ -0,0 +1,71 @@ +import OAI.Analysis.FreeEntropy.GUESelection + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Filter Set +open scoped Classical Topology ENNReal +namespace FiniteEntropySeparation + def heatCoordinates {n d : ℕ} (a : MatrixCoordinates n d) (u : ℝ) (x : MatrixIndex n d → ℝ) : MatrixCoordinates n d := + a+(Real.sqrt u/Real.sqrt d) • WithLp.toLp 2 x + theorem hermitianMatrix_heatCoordinates {n d : ℕ} (a : MatrixCoordinates n d) (u : ℝ) (x : MatrixIndex n d → ℝ) (i : Fin n) : + hermitianMatrix (heatCoordinates a u x) i = heatMatrix (hermitianMatrix a) u x i := by + rw [heatCoordinates,hermitianMatrix_add,hermitianMatrix_smul] + simp only [heatMatrix,gueMatrix,← smul_assoc,smul_eq_mul,coordinateMatrix] + congr 1 + ext j k + simp [Matrix.smul_apply,smul_eq_mul,Complex.real_smul,div_eq_mul_inv] + theorem matrixMoment_heatCoordinates {n d : ℕ} (a : MatrixCoordinates n d) (u : ℝ) (x : MatrixIndex n d → ℝ) (w : List (Fin n)) : + matrixMoment (heatCoordinates a u x) w = matrixTraceWord (heatMatrix (hermitianMatrix a) u x) w := by + simp only [matrixMoment,matrixTraceWord,matrixWord] + rw [show hermitianMatrix (heatCoordinates a u x)=heatMatrix (hermitianMatrix a) u x from funext (hermitianMatrix_heatCoordinates a u x)] + theorem heatMatrix_norm_le {n d : ℕ} (A : Fin n → Matrix (Fin d) (Fin d) ℂ) {R : ℝ} + (hA : ∀i,matrixOpNorm (A i)≤R) (u : ℝ) (x : MatrixIndex n d → ℝ) + (hx : ∀i,matrixOpNorm (gueMatrix x i)≤64) (i : Fin n) : + matrixOpNorm (heatMatrix A u x i)≤R+Real.sqrt u*64 := by + apply (matrixOpNorm_add _ _).trans + rw [matrixOpNorm_smul,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg (Real.sqrt_nonneg _)] + exact add_le_add (hA i) (mul_le_mul_of_nonneg_left (hx i) (Real.sqrt_nonneg _)) + variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} (X : Fin n → H →L[ℂ] H) + theorem heat_microstates_probability {D : ℕ → ℕ} (hD0 : ∀k,0 (productGaussian (MatrixIndex n (D k))).real + {x | ε≤‖matrixTraceWord (heatMatrix (hermitianMatrix (a k)) u x) w-wordMoment τ X w‖}) atTop (𝓝 0)) + (m : ℕ) {ε : ℝ} (hε : 0<ε) : + ∀ᶠ k in atTop, (1/2:ℝ≥0∞) ≤ productGaussian (MatrixIndex n (D k)) + (heatCoordinates (a k) u ⁻¹' microstates τ X (R+Real.sqrt u*64) m (D k) ε) := by + let W := (List.finite_length_le (Fin n) m).toFinset + let E (k : ℕ) : Set (MatrixIndex n (D k) → ℝ) := + (⋃ i ∈ (univ : Finset (Fin n)), {x | 64 < matrixOpNorm (gueMatrix x i)}) ∪ + (⋃ w ∈ W, {x | ε≤‖matrixTraceWord (heatMatrix (hermitianMatrix (a k)) u x) w-wordMoment τ X w‖}) + have hn : Tendsto (fun k => ∑ i : Fin n, (productGaussian (MatrixIndex n (D k))).real {x | 64 < matrixOpNorm (gueMatrix x i)}) atTop (𝓝 0) := by + simpa using tendsto_finsetSum univ (fun i _ => gueMatrix_norm_probability_tendsto hD0 hD i) + have hw : Tendsto (fun k => ∑ w ∈ W, (productGaussian (MatrixIndex n (D k))).real {x | ε ≤ ‖matrixTraceWord (heatMatrix (hermitianMatrix (a k)) u x) w-wordMoment τ X w‖}) atTop (𝓝 0) := by + simpa using tendsto_finsetSum W (fun w _ => hMom w ε hε) + have ht : Tendsto (fun k => (productGaussian (MatrixIndex n (D k))).real (E k)) atTop (𝓝 0) := by + apply squeeze_zero (fun _ => measureReal_nonneg) _ (by simpa using hn.add hw) + intro k + exact (measureReal_union_le _ _).trans (add_le_add (measureReal_biUnion_finset_le _ _) (measureReal_biUnion_finset_le _ _)) + filter_upwards [ht.eventually (gt_mem_nhds (by norm_num : (0:ℝ)<1/2))] with k hk + have hb : (E k)ᶜ ⊆ heatCoordinates (a k) u ⁻¹' microstates τ X (R+Real.sqrt u*64) m (D k) ε := by + intro x hx + simp only [mem_compl_iff,E,Set.mem_union,mem_iUnion,Finset.mem_univ,exists_prop,true_and,not_or,not_exists] at hx + refine ⟨?_,?_⟩ + · intro i + rw [hermitianMatrix_heatCoordinates] + exact heatMatrix_norm_le _ (hA k) u x (fun i => le_of_not_gt (hx.1 i)) i + · intro w hw + rw [matrixMoment_heatCoordinates] + exact lt_of_not_ge (fun hh => hx.2 w ⟨by simpa [W] using hw,hh⟩) + apply le_trans _ (measure_mono hb) + have hu : (1:ℝ) ≤ (productGaussian (MatrixIndex n (D k))).real (E k)+(productGaussian (MatrixIndex n (D k))).real ((E k)ᶜ) := by + simpa [measureReal_def] using measureReal_union_le (μ := productGaussian (MatrixIndex n (D k))) (E k) (E k)ᶜ + have hc : (1/2:ℝ) ≤ (productGaussian (MatrixIndex n (D k))).real ((E k)ᶜ) := by linarith + rw [← ENNReal.toReal_le_toReal (by norm_num) (measure_ne_top _ _)] + simpa [measureReal_def] using hc +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MicrostatesLogLower.lean b/lean/OAI/Analysis/FreeEntropy/MicrostatesLogLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..649ae1811a6ee7287c3e9a61925110ebbc80a476 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MicrostatesLogLower.lean @@ -0,0 +1,44 @@ +import OAI.Analysis.FreeEntropy.GaussianAffineVolume + +namespace OAI + +noncomputable section +open MeasureTheory Filter +open scoped ENNReal +namespace FiniteEntropySeparation + theorem normalized_log_lower (n d : ℕ) (hd : 0 (productGaussian (MatrixIndex n (D k))).real + {x | ε≤‖matrixTraceWord (heatMatrix (hermitianMatrix (a k)) u x) w-wordMoment τ X w‖}) atTop (𝓝 0)) : + (((n:ℝ)/2*Real.log u-Real.log 2:ℝ):EReal) ≤ chiCutoff τ X (R+Real.sqrt u*64) := by + apply le_iInf + intro m + apply le_iInf + intro ε + have hp := heat_microstates_probability τ X hD0 hD a hA u hMom m ε.property + let F : ℕ → EReal := fun d => ((((d+1:ℕ):ℝ)^2)⁻¹:ℝ)* + (volume (microstates τ X (R+Real.sqrt u*64) m (d+1) ε.val)).log+((n:ℝ)/2*Real.log (d+1):ℝ) + have hD' := (tendsto_sub_atTop_nat 1).comp hD + apply le_trans _ (hD'.limsup_comp_le_limsup (u := F)) + apply le_limsup_of_frequently_le' + apply Filter.Eventually.frequently + filter_upwards [hp] with k hk + have hv := gaussian_affine_volume (a k) (r := Real.sqrt u/Real.sqrt (D k)) + (div_pos (Real.sqrt_pos.mpr hu) (Real.sqrt_pos.mpr (Nat.cast_pos.mpr (hD0 k)))) + (microstates τ X (R+Real.sqrt u*64) m (D k) ε.val) hk + have he : F (D k-1) = ((((D k:ℝ)^2)⁻¹:ℝ):EReal)* + (volume (microstates τ X (R+Real.sqrt u*64) m (D k) ε.val)).log+(((n:ℝ)/2*Real.log (D k):ℝ):EReal) := by + have hn : D k-1+1=D k := Nat.sub_add_cancel (hD0 k) + have hc : ((D k-1:ℕ):ℝ)+1=(D k:ℝ) := by exact_mod_cast hn + simp only [F,hn,hc] + rw [hn] + change _ ≤ F (D k-1) + rw [he] + apply normalized_log_lower n (D k) (hD0 k) hu + (ne_of_lt (microstates_volume_lt_top τ X _ (by positivity) _ _ _)) + simpa only [Fintype.card_prod,Fintype.card_fin,mul_assoc] using hv + end Generic + namespace Model + theorem chiCutoff_lower (p : ℕ) [NeZero p] (hp : 2≤p) {h : ℝ} (hh : 0 matrixCoordinatesOfHermitian (A k) + have ha (k : ℕ) : hermitianMatrix (a k)=A k := funext (hermitianMatrix_coordinatesOfHermitian (A k) (hAH k)) + apply chiCutoff_lower_of_heat_models (τ p) (X p h) hD0 hD a (by norm_num : (0:ℝ)≤64) + (fun k i => by rw [ha]; exact hA k i) hh + intro w ε hε + simp only [ha] + exact FreeTensor.heatMatrix_probability_tendsto hD0 hD A (by norm_num) hA ∅ (C p) + (C_mem_background p ∅) (initialIndex p) (initialIndex_injective p) (fun i => Set.notMem_empty _) hM h w hε + theorem chi_gt_bot (p : ℕ) [NeZero p] (hp : 2≤p) {h : ℝ} (hh : 0 Nat.rec (f 0 0) (fun k d => f (k+1) d) k + refine ⟨D,strictMono_nat_of_lt_succ (fun k => hf (k+1) (D k)),?_⟩ + intro k + cases k with + | zero => exact hfP 0 0 + | succ k => exact hfP (k+1) (D k) + variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} (X : Fin n → H →L[ℂ] H) + def diagonalMicrostates (R : ℝ) (k d : ℕ) : Set (MatrixCoordinates n d) := + microstates τ X R k d ((k+1:ℝ)⁻¹) + theorem exists_microstate_dimensions {R b : ℝ} (hb : (b:EReal) 0 (h k).1,fun k => (h k).2⟩ + theorem diagonalMicrostates_moments {D : ℕ → ℕ} {R : ℝ} + (a : (k:ℕ) → MatrixCoordinates n (D k)) + (ha : ∀k,a k ∈ diagonalMicrostates τ X R k (D k)) (w : List (Fin n)) : + Tendsto (fun k => matrixMoment (a k) w) atTop (𝓝 (wordMoment τ X w)) := by + apply tendsto_iff_norm_sub_tendsto_zero.mpr + apply squeeze_zero' (Eventually.of_forall (fun k => norm_nonneg _)) + · filter_upwards [eventually_ge_atTop w.length] with k hk + exact ((ha k).2 w hk).le + · simpa only [one_div] using (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)) + theorem diagonalMicrostates_measurable (R : ℝ) (k d : ℕ) : + MeasurableSet (diagonalMicrostates τ X R k d) := microstates_measurable τ X R k d _ + theorem diagonalMicrostates_uniform_probability {R b : ℝ} (hR : 0≤R) {D : ℕ → ℕ} + (hD : ∀k,0 exact Or.inl ⟨i,rfl⟩ + | right i => exact Or.inr ⟨i,rfl⟩ +def gaussianJointR (R : Series (Fin n)) : Series (Fin (n+n)) := + liftSeries leftIndex R + liftSeries rightIndex quadratic +@[simp] theorem gaussianJointR_nil (R : Series (Fin n)) (hR : R [] = 0) : gaussianJointR R [] = 0 := by + simp [gaussianJointR, hR] + theorem gaussianJointR_noise_deriv (R : Series (Fin n)) (i : Fin n) : + FreeSeries.deriv (rightIndex i) (gaussianJointR R) = letter (rightIndex i) := by + change FreeSeries.deriv (rightIndex i) (liftSeries leftIndex R) + + FreeSeries.deriv (rightIndex i) (liftSeries rightIndex quadratic) = _ + rw [deriv_liftSeries_out _ _ _ (fun j => leftIndex_ne_rightIndex j i), + deriv_liftSeries_image _ rightIndex_injective, deriv_quadratic, liftSeries_letter, zero_add] + theorem gaussianJointR_restrict (R : Series (Fin n)) : restrict leftIndex (gaussianJointR R) = R := by + have hh := restrict_liftSeries_disjoint (rightIndex (n := n)) leftIndex + (fun i j => (leftIndex_ne_rightIndex j i).symm) (quadratic : Series (Fin n)) quadratic_nil + have hl := restrict_liftSeries (leftIndex (n := n)) leftIndex_injective R + funext w + exact (congrArg₂ (·+·) (congrFun hl w) (congrFun hh w)).trans (add_zero _) + theorem gaussianJointR_cyclic {R : Series (Fin n)} (hR : Cyclic R) : Cyclic (gaussianJointR R) := by + have hL := hR.reparam (fun a b => if leftIndex a=b then (1:ℂ) else 0) + have hN := (cyclic_quadratic (α := Fin n)).reparam (fun a b => if rightIndex a=b then (1:ℂ) else 0) + intro i + change FreeSeries.deriv i (liftSeries leftIndex R) + FreeSeries.deriv i (liftSeries rightIndex quadratic) = + rightDeriv i (liftSeries leftIndex R) + rightDeriv i (liftSeries rightIndex quadratic) + exact congrArg₂ (·+·) (hL i) (hN i) + theorem word_left_or_noise (w : List (Fin (n+n))) : + (∃ v : List (Fin n), w=v.map leftIndex) ∨ (∃u i v, w=u++rightIndex i::v) := by + induction w with + | nil => exact Or.inl ⟨[],rfl⟩ + | cons a w ih => + rcases joint_cases a with ⟨i,rfl⟩ | ⟨i,rfl⟩ + · rcases ih with ⟨v,rfl⟩ | ⟨u,j,v,rfl⟩ + · exact Or.inl ⟨i::v,rfl⟩ + · exact Or.inr ⟨leftIndex i::u,j,v,rfl⟩ + · exact Or.inr ⟨[],i,w,rfl⟩ + +theorem mixed_gaussian_unique {M N : Series (Fin (n+n))} + (hM : Cyclic M) (hN : Cyclic N) (hleft : restrict leftIndex M = restrict leftIndex N) + (hm : ∀ i, FreeSeries.deriv (rightIndex i) M = conv M (subst M (letter (rightIndex i)))) + (hn : ∀ i, FreeSeries.deriv (rightIndex i) N = conv N (subst N (letter (rightIndex i)))) : M=N := by + funext w + induction w using length_induction with + | h w ih => + rcases word_left_or_noise w with ⟨v,rfl⟩ | ⟨u,i,v,rfl⟩ + · exact congrFun hleft v + · rw [hM.append u _, hN.append u _] + change FreeSeries.deriv (rightIndex i) M (v++u) = FreeSeries.deriv (rightIndex i) N (v++u) + rw [hm, hn] + exact pairDerivative_congr (fun z hz => ih z (by simp at hz ⊢; omega)) _ (v++u) le_rfl + theorem moments_cumulants {α : Type} [DecidableEq α] [Fintype α] {M : Series α} (hM : M [] = 1) : + moments (cumulants M) = M := (moments_unique (cumulants_nil M) (cumulants_equation hM)).symm +end FreeSeries + +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] +variable {n : ℕ} +def jointTuple (X : Fin n → Space B N G →L[ℂ] Space B N G) (σ : Fin n → N) : + Fin (n+n) → Space B N G →L[ℂ] Space B N G := Fin.addCases X (fun i => semicircularN (σ i)) +@[simp] theorem jointTuple_left (X : Fin n → Space B N G →L[ℂ] Space B N G) (σ : Fin n → N) (i : Fin n) : + jointTuple X σ (leftIndex i) = X i := Fin.addCases_left i +@[simp] theorem jointTuple_right (X : Fin n → Space B N G →L[ℂ] Space B N G) (σ : Fin n → N) (i : Fin n) : + jointTuple X σ (rightIndex i) = semicircularN (σ i) := Fin.addCases_right i + theorem jointTuple_mem (J : Set N) (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ i, X i ∈ backgroundAlgebra J) (σ : Fin n → N) (j : Fin (n+n)) : + jointTuple X σ j ∈ algebra B N G := by + rcases joint_cases j with ⟨i,rfl⟩ | ⟨i,rfl⟩ + · rw [jointTuple_left]; exact backgroundAlgebra_le J (hX i) + · rw [jointTuple_right]; exact semicircularN_mem _ + theorem jointTuple_noise_deriv (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) (hX : ∀ i, X i ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) (i : Fin n) : + FreeSeries.deriv (rightIndex i) (wordMoment (tracialVector B N G) (jointTuple X σ)) = + conv (wordMoment (tracialVector B N G) (jointTuple X σ)) + (subst (wordMoment (tracialVector B N G) (jointTuple X σ)) (letter (rightIndex i))) := by + let Z := jointTuple X σ + let τ := tracialVector B N G + have hc (j : Fin (n+n)) : star (rightCreationN (σ i)) * Z j = + Z j * star (rightCreationN (σ i)) + if j=rightIndex i then (1:ℂ) • vacuumRankOne τ else 0 := by + rcases joint_cases j with ⟨k,rfl⟩ | ⟨k,rfl⟩ + · simpa [Z, leftIndex_ne_rightIndex] using (rightAnnihilationN_background (hs i) (hX k)).eq + · have he : σ i = σ k ↔ rightIndex k = rightIndex i := by + rw [hσ.eq_iff, rightIndex_injective.eq_iff, eq_comm] + simpa [Z, he] using rightAnnihilationN_semicircularN (B := B) (G := G) (σ i) (σ k) + funext w + rw [← derivativeMoment_series] + have h := commutator_integration_by_parts τ Z (star (rightCreationN (σ i))) + (rightIndex i) 1 hc (by simp [τ, tracialVector, basis, empty]) w + simp only [star_star, one_mul] at h + have hv : rightCreationN (σ i) τ.vacuum = semicircularN (σ i) τ.vacuum := by + simp [τ, tracialVector, semicircularN, basis, rightCreationN_single, creationN_single, + annihilationN_single, removeN, rightN_eq_append, empty, append, leftN, push] + rw [hv, ← ContinuousLinearMap.adjoint_inner_right, ← ContinuousLinearMap.star_eq_adjoint, + (semicircularN_selfAdjoint (B := B) (G := G) (σ i)).star_eq] at h + change trace τ (semicircularN (σ i) * wordEval Z w) = _ at h + simpa [FreeSeries.deriv, wordMoment, wordEval, Z] using h + + theorem joint_moments_cumulants (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) (hX : ∀ i, X i ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) : + wordMoment (tracialVector B N G) (jointTuple X σ) = + moments (gaussianJointR (cumulants (wordMoment (tracialVector B N G) X))) := by + let τ := tracialVector B N G + let M := wordMoment τ X + have hM : M [] = 1 := by simp [M] + have hC : Cyclic M := wordMoment_cyclic τ X (fun i => backgroundAlgebra_le J (hX i)) + let R := gaussianJointR (cumulants M) + have hR : R [] = 0 := gaussianJointR_nil _ (cumulants_nil M) + apply mixed_gaussian_unique + · exact wordMoment_cyclic τ _ (jointTuple_mem J X hX σ) + · exact cyclic_moments hR (gaussianJointR_cyclic (cyclic_cumulants hM hC)) + · rw [restrict_moments leftIndex hR, gaussianJointR_restrict, moments_cumulants hM, wordMoment_restrict] + congr 1 + funext i + exact jointTuple_left X σ i + · exact jointTuple_noise_deriv J X hX σ hσ hs + · intro i + rw [deriv_moments hR, gaussianJointR_noise_deriv] +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/Model.lean b/lean/OAI/Analysis/FreeEntropy/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..40541e1824927f072cd7bb529a8e64e65b5541cc --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/Model.lean @@ -0,0 +1,109 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate +open MeasureTheory Filter + +namespace FiniteEntropySeparation + +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +structure TracialVector (M : VonNeumannAlgebra H) where + vacuum : H + norm_vacuum : ‖vacuum‖ = 1 + tracial : ∀ A ∈ M, ∀ B ∈ M, + inner ℂ vacuum ((A * B) vacuum) = inner ℂ vacuum ((B * A) vacuum) + separating : ∀ A ∈ M, A vacuum = 0 → A = 0 + +def trace {M : VonNeumannAlgebra H} (τ : TracialVector M) (A : H →L[ℂ] H) : ℂ := + inner ℂ τ.vacuum (A τ.vacuum) + +def wordEval {n : ℕ} (X : Fin n → H →L[ℂ] H) (w : List (Fin n)) : H →L[ℂ] H := + (w.map X).prod + +def wordMoment {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (w : List (Fin n)) : ℂ := trace τ (wordEval X w) + +def FreeSubalgebras {ι : Type} {M : VonNeumannAlgebra H} (τ : TracialVector M) + (A : ι → Subalgebra ℂ (H →L[ℂ] H)) : Prop := + ∀ (k : ℕ), 0 < k → ∀ (j : Fin k → ι) (a : Fin k → H →L[ℂ] H), + (∀ r, a r ∈ A (j r)) → (∀ r, trace τ (a r) = 0) → + (∀ (r : ℕ) (hr : r + 1 < k), + j ⟨r, Nat.lt_trans (Nat.lt_succ_self r) hr⟩ ≠ j ⟨r + 1, hr⟩) → + trace τ (List.ofFn a).prod = 0 + +def FreeStandardNoise {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X S : Fin n → H →L[ℂ] H) : Prop := + (∀ i k, trace τ (S i ^ k) = + if Even k then (catalan (k / 2) : ℂ) else 0) ∧ + FreeSubalgebras τ (fun j : Option (Fin n) => match j with + | none => Algebra.adjoin ℂ (Set.range X) + | some i => Algebra.adjoin ℂ {S i}) + +def polynomialL2 {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) : Submodule ℂ H := + (Submodule.span ℂ (Set.range (fun w : List (Fin n) => wordEval X w τ.vacuum))).topologicalClosure + +def derivativeMoment {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (i : Fin n) (w : List (Fin n)) : ℂ := + ∑ r : Fin w.length, if w[r.val] = i then + wordMoment τ X (w.take r.val) * wordMoment τ X (w.drop (r.val + 1)) else 0 + +def ConjugateSystem {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (ξ : Fin n → H) : Prop := + ∀ i, ξ i ∈ polynomialL2 τ X ∧ ∀ w : List (Fin n), + inner ℂ (ξ i) (wordEval X w τ.vacuum) = derivativeMoment τ X i w + +def freeFisher {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) : ℝ≥0∞ := + ⨅ (ξ : Fin n → H) (_ : ConjugateSystem τ X ξ), ENNReal.ofReal (∑ i, ‖ξ i‖ ^ 2) + +def heatTuple {n : ℕ} (X S : Fin n → H →L[ℂ] H) (s : ℝ) : + Fin n → H →L[ℂ] H := fun i => X i + (Real.sqrt s : ℂ) • S i + +def chiStar {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X S : Fin n → H →L[ℂ] H) : EReal := + let b : ℝ → ℝ≥0∞ := fun s => ENNReal.ofReal ((n : ℝ) / (1 + s)) + let f : ℝ → ℝ≥0∞ := fun s => freeFisher τ (heatTuple X S s) + ((n / 2 * Real.log (2 * Real.pi * Real.exp 1) : ℝ) : EReal) + + (1 / 2 : EReal) * (∫⁻ s in Set.Ioi (0 : ℝ), b s - f s).toEReal - + (1 / 2 : EReal) * (∫⁻ s in Set.Ioi (0 : ℝ), f s - b s).toEReal + +abbrev MatrixCoordinates (n d : ℕ) := EuclideanSpace ℝ (Fin n × Fin d × Fin d) + +def hermitianMatrix {n d : ℕ} (a : MatrixCoordinates n d) (i : Fin n) : + Matrix (Fin d) (Fin d) ℂ := fun j k => + if j = k then (a (i, j, j) : ℂ) + else if j < k then ((a (i, j, k) : ℂ) + Complex.I * (a (i, k, j) : ℂ)) / Real.sqrt 2 + else ((a (i, k, j) : ℂ) - Complex.I * (a (i, j, k) : ℂ)) / Real.sqrt 2 + +def matrixOpNorm {d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) : ℝ := + ‖(Matrix.toEuclideanLin A).toContinuousLinearMap‖ + +def matrixMoment {n d : ℕ} (a : MatrixCoordinates n d) (w : List (Fin n)) : ℂ := + (d : ℂ)⁻¹ * Matrix.trace (w.map (hermitianMatrix a)).prod + +def microstates {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (R : ℝ) (m d : ℕ) (ε : ℝ) : Set (MatrixCoordinates n d) := + {a | (∀ i, matrixOpNorm (hermitianMatrix a i) ≤ R) ∧ + ∀ w : List (Fin n), w.length ≤ m → ‖matrixMoment a w - wordMoment τ X w‖ < ε} + +def chiCutoff {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (R : ℝ) : EReal := + ⨅ m : ℕ, ⨅ ε : {ε : ℝ // 0 < ε}, + limsup (fun d : ℕ => + (((((d + 1 : ℕ) : ℝ) ^ 2)⁻¹ : ℝ) : EReal) * + (volume (microstates τ X R m (d + 1) ε.val)).log + + (((n : ℝ) / 2 * Real.log (d + 1) : ℝ) : EReal)) atTop + +def chi {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) : EReal := + ⨆ R : {R : ℝ // 0 < R}, chiCutoff τ X R.val + +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/ModelFlowLimit.lean b/lean/OAI/Analysis/FreeEntropy/ModelFlowLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6a9bc109ec804d8d21f4d4b6673d743c9b30c70 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/ModelFlowLimit.lean @@ -0,0 +1,56 @@ +import OAI.Analysis.FreeEntropy.FatouFlow + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped Topology ENNReal +namespace FiniteEntropySeparation.Model +variable (p : ℕ) [NeZero p] + theorem heatFisher_shift_intervalIntegrable (hp : 2≤p) {h a t : ℝ} + (hh : 0 heatFisherReal p (h+s)) volume a t := by + have hi := (heatFisherReal_intervalIntegrable p hp (h+a) (h+t) (by linarith) (by linarith)).comp_add_left h + simpa only [add_sub_cancel_left] using hi + theorem matrixFlow_limit (hp : 2≤p) {D : ℕ → ℕ} (hD0 : ∀k,0 ENNReal.ofReal (normalizedMatrixFisher (μ k) s)) atTop := by + have hs0 : 0 Real.sqrt (((p+1:ℕ):ℝ)*D k)*R) + (fun k => by positivity) hnorm (fun s => heatFisherReal p (h+s)) ha hat + (heatFisher_shift_intervalIntegrable p hp hh ha.le hat) (fun _ _ => ENNReal.toReal_nonneg) hl hinit + (fun ε hε => hterm.mono (fun k hk => by linarith)) + rwa [intervalIntegral.integral_comp_add_left] at hb + theorem heatFisher_short_bound (hp : 2≤p) {h a : ℝ} (hh : 0 ((p+1:ℕ):ℝ)/h) volume h (h+a)) + (fun u hu => (heatFisherReal_upper p u (hh.trans_le hu.1)).trans + (div_le_div_of_nonneg_left (by positivity) hh hu.1)) + rw [intervalIntegral.integral_const] at hb + simp only [add_sub_cancel_left,smul_eq_mul] at hb + calc + _ ≤ (1/2:ℝ)*(a*(((p+1:ℕ):ℝ)/h)) := mul_le_mul_of_nonneg_left hb (by norm_num) + _ = _ := by ring +end FiniteEntropySeparation.Model + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/MonomialSeries.lean b/lean/OAI/Analysis/FreeEntropy/MonomialSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..66629941fd319fe1cb4c17933c9f9baf030c0f4e --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/MonomialSeries.lean @@ -0,0 +1,103 @@ +import OAI.Analysis.FreeEntropy.WickTensor + +namespace OAI + +noncomputable section +namespace FiniteEntropySeparation +open Finset FreeSeries +namespace FreeSeries +variable {α : Type} [DecidableEq α] +def monomial (v : List α) : Series α := fun w => if w=v then 1 else 0 +@[simp] theorem monomial_nil : monomial ([] : List α) = unit := by + funext w; cases w <;> simp [monomial, unit] +@[simp] theorem monomial_cons_nil (a : α) (v : List α) : monomial (a::v) [] = 0 := by simp [monomial] + theorem deriv_monomial (a b : α) (v : List α) : + FreeSeries.deriv b (monomial (a::v)) = if b=a then monomial v else 0 := by + funext w + by_cases h : b=a <;> simp [FreeSeries.deriv, monomial, h] + theorem monomial_append (v q : List α) : monomial (v++q) = conv (monomial v) (monomial q) := by + funext w + induction v generalizing w with + | nil => simp + | cons a v ih => + cases w with + | nil => simp + | cons b w => + rw [conv_cons, monomial_cons_nil, zero_mul, zero_add, deriv_monomial] + by_cases h : b=a + · subst b; simpa [monomial] using ih w + · simp [h, monomial] + theorem monomial_single (i : α) : monomial [i] = letter i := by + funext w + cases w with + | nil => rfl + | cons a w => cases w <;> simp [monomial, letter] + theorem conv_subst_letter (F M : Series α) (i : α) (w : List α) : + conv F (subst M (letter i)) w = ∑ r : Fin w.length, if w[r.val] = i then + F (w.take r.val) * M (w.drop (r.val+1)) else 0 := by + rw [conv_sum_splits, sum_range_succ] + simp only [List.take_length, List.drop_length, subst_nil, letter_nil, mul_zero, add_zero] + rw [← Fin.sum_univ_eq_sum_range (fun k => F (w.take k) * subst M (letter i) (w.drop k))] + apply sum_congr rfl + intro k hk + rw [List.drop_eq_getElem_cons k.isLt, subst_letter_cons] + split_ifs <;> simp + +variable [Fintype α] +def wordBall (d : ℕ) : Finset (List α) := + (range (d+1)).biUnion (fun m => univ.image (fun v : List.Vector α m => v.val)) +@[simp] theorem mem_wordBall (v : List α) (d : ℕ) : v ∈ wordBall d ↔ v.length ≤ d := by + simp only [wordBall, mem_biUnion, mem_range, mem_image, mem_univ, true_and] + constructor + · rintro ⟨m,hm,q,rfl⟩; rw [q.prop]; omega + · intro h; exact ⟨v.length, by omega, ⟨v,rfl⟩, rfl⟩ + theorem monomial_expansion (f : Series α) (d : ℕ) : + Agree d f (∑ v ∈ wordBall d, f v • monomial v) := by + intro w hw + simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul] + rw [Finset.sum_eq_single w] + · simp [monomial] + · intro v hv hne; simp [monomial, Ne.symm hne] + · intro hn; exact (hn ((mem_wordBall w d).mpr hw)).elim + +omit [Fintype α] in +theorem monomial_large_agree [Fintype α] (v : List α) (d : ℕ) (h : d < v.length) : + Agree d (monomial v) 0 := by + intro w hw + have hn : w ≠ v := by intro he; subst w; omega + simp [monomial, hn] + theorem conv_subst_monomial_large (M : Series α) (v w : List α) (h : w.length < v.length) : + conv M (subst M (monomial v)) w = 0 := by + have he := conv_agree (Agree.refl w.length M) + (subst_agree (Agree.refl _ M) (monomial_large_agree v w.length h)) w le_rfl + simpa using he + theorem conv_subst_hasSum (M f : Series α) (w : List α) : + HasSum (fun v => f v * conv M (subst M (monomial v)) w) (conv M (subst M f) w) := by + have he := conv_agree (Agree.refl w.length M) + (subst_agree (Agree.refl _ M) (monomial_expansion f w.length)) w le_rfl + rw [subst_sum, conv_sum_right] at he + simp only [subst_smul, conv_smul_right, Finset.sum_apply, Pi.smul_apply, smul_eq_mul] at he + rw [he] + apply hasSum_sum_of_ne_finset_zero + intro v hv + rw [conv_subst_monomial_large M v w (by simpa using hv), mul_zero] +end FreeSeries + +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + theorem reverseDerivativeMoment_monomial {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (js w : List (Fin n)) : + reverseDerivativeMoment τ X js w = + conv (wordMoment τ X) (subst (wordMoment τ X) (monomial js.reverse)) w := by + induction js generalizing w with + | nil => simp [reverseDerivativeMoment] + | cons i js ih => + rw [List.reverse_cons, monomial_append, subst_mul, ← conv_assoc, monomial_single, + conv_subst_letter, reverseDerivativeMoment] + apply sum_congr rfl + intro r hr + split_ifs <;> simp [ih] +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/NoiseRotation.lean b/lean/OAI/Analysis/FreeEntropy/NoiseRotation.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d9ddefde63a94684fb0f74b28ef4c070cb3dfe3 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/NoiseRotation.lean @@ -0,0 +1,53 @@ +import OAI.Analysis.FreeEntropy.WickBound + +namespace OAI + +noncomputable section +namespace FiniteEntropySeparation +open FreeSeries +namespace FreeSeries +variable {α : Type} + theorem cumulants_injective_normalized {M N : Series α} (hM : M [] = 1) (hN : N [] = 1) + (h : cumulants M = cumulants N) : M = N := by + have hm := moments_unique (cumulants_nil M) (cumulants_equation hM) + have hn := moments_unique (cumulants_nil N) (cumulants_equation hN) + rw [hm, hn, h] +end FreeSeries +namespace Model +open FreeTensor +variable (p : ℕ) [NeZero p] + theorem X_cumulants (h : ℝ) (hh : 0 ≤ h) : + cumulants (wordMoment (τ p) (X p h)) = + cumulants (wordMoment (τ p) (C p)) + (h : ℂ) • quadratic := + heat_cumulants ∅ (C p) (C_mem_background p ∅) (initialIndex p) + (initialIndex_injective p) (by simp) h hh + theorem doublyNoised_cumulants (h s : ℝ) (hh : 0 ≤ h) (hs : 0 ≤ s) : + cumulants (wordMoment (τ p) (doublyNoised p h s)) = + cumulants (wordMoment (τ p) (C p)) + ((h+s : ℝ) : ℂ) • quadratic := by + calc + _ = cumulants (wordMoment (τ p) (X p h)) + (s : ℂ) • quadratic := + heat_cumulants (oldNoise p) (X p h) (X_mem_background p h) + (auxiliaryIndex p) (auxiliaryIndex_injective p) (auxiliaryIndex_fresh p) s hs + _ = _ := by rw [X_cumulants p h hh]; simp [add_smul, add_assoc] + theorem doublyNoised_law (h s : ℝ) (hh : 0 ≤ h) (hs : 0 ≤ s) : + wordMoment (τ p) (doublyNoised p h s) = wordMoment (τ p) (X p (h+s)) := by + apply cumulants_injective_normalized (by simp) (by simp) + rw [doublyNoised_cumulants p h s hh hs, X_cumulants p (h+s) (add_nonneg hh hs)] + theorem doublyNoised_fisher_eq (h s : ℝ) (hh : 0 ≤ h) (hs : 0 ≤ s) (hu : 0 < h+s) : + freeFisher (τ p) (doublyNoised p h s) = freeFisher (τ p) (X p (h+s)) := by + apply freeFisher_eq_of_wordMoments (τ p) (τ p) + · intro i + exact heatTuple_selfAdjoint (X p h) (auxiliaryNoise p) (X_selfAdjoint p h) + (auxiliaryNoise_selfAdjoint p) s i + · exact X_selfAdjoint p (h+s) + · exact congrFun (doublyNoised_law p h s hh hs) + · exact exists_conjugate_of_fisher_le _ _ ((p+1 : ℕ)/(h+s)) + (doublyNoised_fisher_le p h s hh hs hu) + · exact heat_conjugates_exist ∅ (C p) (C_mem_background p ∅) (initialIndex p) + (initialIndex_injective p) (by simp) (h+s) hu +end Model +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/NoiseTensor.lean b/lean/OAI/Analysis/FreeEntropy/NoiseTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..15eaa32820f21c2f3a050fb60ef3db140ca45c05 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/NoiseTensor.lean @@ -0,0 +1,124 @@ +import OAI.Analysis.FreeEntropy.TensorLaw + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate lp +open MeasureTheory Filter +namespace FiniteEntropySeparation +namespace FreeTensor +variable {B N G : Type} [Group G] + +def noiseWord : List N → Word B N G + | [] => empty + | i :: w => leftN i (noiseWord w) + +@[simp] theorem noiseWord_nil : noiseWord ([] : List N) = (empty : Word B N G) := rfl +@[simp] theorem noiseWord_cons (i : N) (w : List N) : + noiseWord (i :: w) = (leftN i (noiseWord w) : Word B N G) := rfl + + theorem noiseWord_formula (w : List N) : + noiseWord (B := B) (G := G) w = (([],1), w.map (fun i => (i,([],1)))) := by + induction w with + | nil => rfl + | cons i w ih => simp [noiseWord, ih, leftN, push] + + theorem noiseWord_injective : Function.Injective (noiseWord (B := B) (N := N) (G := G)) := by + intro v w h + have h' := congrArg (fun a : Word B N G => a.2.map Prod.fst) h + simpa [noiseWord_formula, List.map_map, Function.comp_def] using h' + + theorem noiseWord_append (v w : List N) : + noiseWord (B := B) (G := G) (v ++ w) = + (([],1), (noiseWord (B := B) (G := G) v).2 ++ (noiseWord (B := B) (G := G) w).2) := by + simp [noiseWord_formula] + +@[simp] theorem rightN_noiseWord (i : N) (w : List N) : + rightN i (noiseWord (B := B) (G := G) w) = noiseWord (w ++ [i]) := by + simp [rightN_eq_append, append, noiseWord_formula] + +variable [DecidableEq B] [DecidableEq N] [DecidableEq G] + +def noiseSlice : Fock.Space N →L[ℂ] Space B N G := + (LabelHilbert.embedding noiseWord noiseWord_injective).toContinuousLinearMap + +@[simp] theorem noiseSlice_single (w : List N) (z : ℂ) : + noiseSlice (B := B) (G := G) (lp.single 2 w z) = lp.single 2 (noiseWord w) z := + LabelHilbert.embedding_single noiseWord noiseWord_injective w z + +@[simp] theorem noiseSlice_basis (w : List N) : + noiseSlice (B := B) (G := G) (Fock.basisVector w) = basis (noiseWord w) := + noiseSlice_single w 1 + + theorem noiseSlice_semicircular (i : N) : + (semicircularN i).comp (noiseSlice (B := B) (G := G)) = + noiseSlice.comp (Fock.semicircular i) := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change semicircularN i (noiseSlice (lp.single 2 w z)) = + noiseSlice (Fock.semicircular i (lp.single 2 w z)) + rw [noiseSlice_single] + cases w with + | nil => simp [semicircularN, annihilationN_single, removeN, empty] + | cons j w => + simp only [noiseWord_cons, semicircularN, add_apply, creationN_single, + annihilationN_single, Fock.semicircular_single_cons, map_add, noiseSlice_single] + by_cases hij : i = j <;> simp [removeN, leftN, push, hij] + + theorem noiseSlice_word (w : List N) : + ((w.map (semicircularN (B := B) (G := G))).prod).comp noiseSlice = + noiseSlice.comp ((w.map Fock.semicircular).prod) := by + induction w with + | nil => rfl + | cons i w ih => + apply ContinuousLinearMap.ext + intro x + have hi := congrArg (fun T : Fock.Space N →L[ℂ] Space B N G => T x) ih + have hc := congrArg (fun T : Fock.Space N →L[ℂ] Space B N G => + T ((w.map Fock.semicircular).prod x)) (noiseSlice_semicircular (B := B) (G := G) i) + simp only [ContinuousLinearMap.comp_apply] at hi hc + simpa only [ContinuousLinearMap.comp_apply, List.map_cons, List.prod_cons, + mul_apply_eq_comp, hi] using hc + + theorem noiseSlice_vacuum_coefficient (x : Fock.Space N) : + inner ℂ (basis (empty : Word B N G)) (noiseSlice x) = + inner ℂ (Fock.basisVector []) x := by + have h := (LabelHilbert.embedding (noiseWord (B := B) (G := G)) noiseWord_injective).inner_map_map + (Fock.basisVector []) x + change inner ℂ (noiseSlice (Fock.basisVector [])) (noiseSlice x) = _ at h + simpa using h + + theorem noise_word_moment (w : List N) : + trace (tracialVector B N G) ((w.map semicircularN).prod) = + trace (Fock.tracialVector N) ((w.map Fock.semicircular).prod) := by + change inner ℂ (basis (empty : Word B N G)) ((w.map semicircularN).prod (basis empty)) = _ + rw [← noiseWord_nil, ← noiseSlice_basis, ← ContinuousLinearMap.comp_apply, + noiseSlice_word, ContinuousLinearMap.comp_apply, noiseSlice_basis, noiseWord_nil, + noiseSlice_vacuum_coefficient] + rfl + + theorem trace_semicircularN_pow {k : ℕ} (i : Fin k) (r : ℕ) : + trace (tracialVector B (Fin k) G) (semicircularN i ^ r) = + if Even r then (catalan (r / 2) : ℂ) else 0 := by + have h := noise_word_moment (B := B) (G := G) (List.replicate r i) + simpa [Fock.semicircular_moments] using h + + theorem noise_basis_orthonormal : Orthonormal ℂ (fun w : List N => + basis (noiseWord (B := B) (G := G) w)) := by + rw [orthonormal_iff_ite] + intro v w + by_cases h : v = w + · subst w + simp [basis, ] + · have h' : noiseWord (B := B) (G := G) v ≠ noiseWord w := + fun hh => h (noiseWord_injective hh) + simp [basis, lp.inner_single_left, lp.single_apply, h, h'] + +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/NormalLaw.lean b/lean/OAI/Analysis/FreeEntropy/NormalLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..d43d7696b7342a7e294193aba6e9d614248b936f --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/NormalLaw.lean @@ -0,0 +1,112 @@ +import OAI.Analysis.FreeEntropy.GaussianConvolution + +namespace OAI + +universe u1 u2 u3 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +open scoped ENNReal NNReal +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] + theorem map_withDensity_of_measurePreserving {α : Type u2} {β : Type u3} [MeasurableSpace α] [MeasurableSpace β] + {μ : Measure α} {ν : Measure β} {f : α → β} (hf : MeasurePreserving f μ ν) + (g : β → ℝ≥0∞) (hg : Measurable g) : + (μ.withDensity (g ∘ f)).map f = ν.withDensity g := by + apply Measure.ext_of_lintegral + intro F hF + rw [lintegral_map hF hf.measurable] + change (∫⁻ a,(F ∘ f) a ∂μ.withDensity (g ∘ f)) = _ + rw [lintegral_withDensity_eq_lintegral_mul μ (hg.comp hf.measurable) (hF.comp hf.measurable),lintegral_withDensity_eq_lintegral_mul ν hg hF] + exact hf.lintegral_comp (hg.mul hF) + theorem productNormal_withDensity {s : ℝ} (hs : 0 gaussianReal 0 (⟨s,hs.le⟩ : ℝ≥0)) = + volume.withDensity (fun x : ι → ℝ => ENNReal.ofReal (∏i,gaussianPDFReal 0 (⟨s,hs.le⟩ : ℝ≥0) (x i))) := by + classical + have hv : (⟨s,hs.le⟩ : ℝ≥0)≠0 := by + intro h; exact hs.ne' (congrArg (fun x : ℝ≥0 => (x:ℝ)) h) + have hi : Integrable (fun x : ι → ℝ => ∏i,gaussianPDFReal 0 (⟨s,hs.le⟩ : ℝ≥0) (x i)) := + Integrable.fintype_prod (fun _ => integrable_gaussianPDFReal 0 (⟨s,hs.le⟩ : ℝ≥0)) + let v : ℝ≥0 := ⟨s,hs.le⟩ + have : ∀i : ι,SigmaFinite (gaussianReal 0 v) := fun _ => inferInstance + apply Measure.pi_eq (μ := fun _ : ι => gaussianReal 0 v) + intro S hS + rw [withDensity_apply _ (MeasurableSet.univ_pi hS)] + rw [← ofReal_integral_eq_lintegral_ofReal hi.integrableOn (ae_of_all _ (fun x => prod_nonneg (fun i _ => gaussianPDFReal_nonneg _ _ _)))] + rw [integral_pi_prod _ S hS,ENNReal.ofReal_prod_of_nonneg] + · apply prod_congr rfl + intro i _ + rw [gaussianReal_apply 0 hv] + exact ofReal_integral_eq_lintegral_ofReal (integrable_gaussianPDFReal 0 (⟨s,hs.le⟩ : ℝ≥0)).integrableOn + (ae_of_all _ (gaussianPDFReal_nonneg _ _)) + · intro i _ + exact integral_nonneg (gaussianPDFReal_nonneg _ _) + def normalLaw (s : ℝ) : Measure (EuclideanSpace ℝ ι) := + volume.withDensity (fun x => ENNReal.ofReal (normalKernel s x)) + theorem normalLaw_eq_map {s : ℝ} (hs : 0 gaussianReal 0 (⟨s,hs.le⟩ : ℝ≥0))).map (WithLp.toLp 2) := by + rw [productNormal_withDensity hs] + have he : (fun x : ι → ℝ => ENNReal.ofReal (∏i,gaussianPDFReal 0 (⟨s,hs.le⟩ : ℝ≥0) (x i))) = + (fun x => ENNReal.ofReal (normalKernel s x)) ∘ WithLp.toLp 2 := by + funext x; simp only [Function.comp_apply,normalKernel_product hs] + rw [he] + exact (map_withDensity_of_measurePreserving (PiLp.volume_preserving_toLp ι) + (fun x => ENNReal.ofReal (normalKernel s x)) + (ENNReal.measurable_ofReal.comp (normalKernel_continuous_space s).measurable)).symm + theorem normalLaw_eq_scaled {s : ℝ} (hs : 0 Real.sqrt s • WithLp.toLp 2 x) := by + have hm : (productGaussian ι).map (fun x i => Real.sqrt s*x i) = Measure.pi (fun _ : ι => gaussianReal 0 (⟨s,hs.le⟩ : ℝ≥0)) := by + change (Measure.pi (fun _ : ι => gaussianReal 0 1)).map (fun x i => Real.sqrt s * id (x i)) = _ + rw [Measure.pi_map_pi (fun _ => (measurable_id.const_mul (Real.sqrt s)).aemeasurable)] + congr 1 + funext i + simp only [id_eq] + rw [gaussianReal_map_const_mul] + congr 1 + · simp + · ext; simp only [mul_one,NNReal.coe_mk,Real.sq_sqrt hs.le] + rfl + rw [normalLaw_eq_map hs,← hm] + rw [Measure.map_map (show Measurable (WithLp.toLp 2 : (ι → ℝ) → EuclideanSpace ℝ ι) from (PiLp.continuous_toLp 2 _).measurable) (by fun_prop)] + congr 1 + theorem normalLaw_probability {s : ℝ} (hs : 0 z.1+z.2) = + volume.withDensity (fun x => ENNReal.ofReal (smoothedDensity μ s x)) := by + have : IsProbabilityMeasure (normalLaw (ι := ι) s) := normalLaw_probability hs + have hk := (ENNReal.measurable_ofReal.comp (normalKernel_continuous_space (ι := ι) s).measurable) + have hden := (ENNReal.measurable_ofReal.comp (smoothedDensity_continuous μ hs).measurable) + apply Measure.ext_of_lintegral + intro F hF + rw [lintegral_map hF (by fun_prop)] + rw [lintegral_prod _ (show AEMeasurable (fun z : EuclideanSpace ℝ ι × EuclideanSpace ℝ ι => F (z.1+z.2)) _ from (hF.comp (by fun_prop)).aemeasurable)] + have hinner (a : EuclideanSpace ℝ ι) : + (∫⁻z,F (a+z) ∂normalLaw s) = ∫⁻z,ENNReal.ofReal (normalKernel s z)*F (a+z) := by + exact lintegral_withDensity_eq_lintegral_mul volume hk (show Measurable (fun z => F (a+z)) from hF.comp (measurable_const.add measurable_id)) + simp_rw [hinner] + have hshift (a : EuclideanSpace ℝ ι) : + (∫⁻z,ENNReal.ofReal (normalKernel s z)*F (a+z)) = + ∫⁻x,ENNReal.ofReal (normalKernel s (x-a))*F x := by + have he := (measurePreserving_add_left (volume : Measure (EuclideanSpace ℝ ι)) a).lintegral_comp + (f := fun x => ENNReal.ofReal (normalKernel s (x-a))*F x) + ((hk.comp (measurable_id.sub measurable_const)).mul hF) + simpa only [add_sub_cancel_left] using he + simp_rw [hshift] + have hmeas : Measurable (fun z : EuclideanSpace ℝ ι × EuclideanSpace ℝ ι => + ENNReal.ofReal (normalKernel s (z.2-z.1))*F z.2) := + (hk.comp (measurable_snd.sub measurable_fst)).mul (hF.comp measurable_snd) + rw [lintegral_lintegral_swap hmeas.aemeasurable] + change (∫⁻x,∫⁻a,ENNReal.ofReal (normalKernel s (x-a))*F x ∂μ) = ∫⁻x,F x ∂volume.withDensity (ENNReal.ofReal ∘ smoothedDensity μ s) + rw [lintegral_withDensity_eq_lintegral_mul volume hden hF] + apply lintegral_congr + intro x + rw [lintegral_mul_const (F x) (show Measurable (fun a => ENNReal.ofReal (normalKernel s (x-a))) from hk.comp (measurable_const.sub measurable_id)),← ofReal_integral_eq_lintegral_ofReal (normalKernel_integrable_finite μ hs x) (ae_of_all _ (fun a => (normalKernel_pos _ _).le))] + rfl +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/OptionSeries.lean b/lean/OAI/Analysis/FreeEntropy/OptionSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5bfb5f4a09ce417d49af90c36558fe3bdf83ff4 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/OptionSeries.lean @@ -0,0 +1,72 @@ +import OAI.Analysis.FreeEntropy.SpectralMatrixProducer + +namespace OAI + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α β : Type} [DecidableEq α] [Fintype α] + +def ignoreLetter (f : Series α) : Series (Option α) := fun w => f (w.filterMap id) + +omit [DecidableEq α] [Fintype α] in +theorem deriv_ignore_none [DecidableEq α] [Fintype α] (f : Series α) : deriv none (ignoreLetter f) = ignoreLetter f := rfl + +omit [DecidableEq α] [Fintype α] in +theorem deriv_ignore_some [DecidableEq α] [Fintype α] (f : Series α) (a : α) : + deriv (some a) (ignoreLetter f) = ignoreLetter (deriv a f) := rfl + theorem ignoreLetter_norm_sq (f : Series α) (n : ℕ) : + degreeNorm (ignoreLetter f) n^2 = + ∑ k ∈ range (n+1), (n.choose k : ℝ) * degreeNorm f k^2 := by + induction n generalizing f with + | zero => simp [degreeNorm_nil, ignoreLetter] + | succ n ih => + rw [degreeNorm_succ_sq, Fintype.sum_option, deriv_ignore_none, ih] + simp only [deriv_ignore_some, ih] + rw [sum_comm] + simp only [← mul_sum, ← degreeNorm_succ_sq] + exact (Finset.sum_choose_succ_mul (fun k _ => degreeNorm f k^2) n).symm + theorem ignoreLetter_norm_le {f : Series α} {A : ℝ} (hA : 0 ≤ A) + (hf : ∀ n, degreeNorm f n ≤ A^n) (n : ℕ) : + degreeNorm (ignoreLetter f) n ≤ (A+1)^n := by + apply (sq_le_sq₀ (degreeNorm_nonneg _ _) (pow_nonneg (by linarith) _)).mp + rw [ignoreLetter_norm_sq] + calc + _ ≤ ∑ k ∈ range (n+1), (n.choose k : ℝ) * (A^k)^2 := by + apply sum_le_sum + intro k hk + exact mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (degreeNorm_nonneg _ _) (hf k) 2) (by positivity) + _ = (A^2+1)^n := by + rw [add_pow] + apply sum_congr rfl + intro k hk + rw [one_pow, mul_one, ← pow_mul, ← pow_mul, Nat.mul_comm k 2, mul_comm] + _ ≤ ((A+1)^2)^n := pow_le_pow_left₀ (by positivity) (by nlinarith) _ + _ = _ := by rw [← pow_mul, ← pow_mul, Nat.mul_comm 2 n] + + def vectorMap (e : α ≃ β) (n : ℕ) : List.Vector α n ≃ List.Vector β n where + toFun w := ⟨w.val.map e, by simp [w.prop]⟩ + invFun w := ⟨w.val.map e.symm, by simp [w.prop]⟩ + left_inv w := by apply Subtype.ext; simp + right_inv w := by apply Subtype.ext; simp + +omit [DecidableEq α] in +theorem degreeNorm_equiv [DecidableEq α] [Fintype β] (e : α ≃ β) (f : Series β) (n : ℕ) : + degreeNorm (fun w => f (w.map e)) n = degreeNorm f n := by + apply (sq_eq_sq₀ (degreeNorm_nonneg _ _) (degreeNorm_nonneg _ _)).mp + rw [degreeNorm_sq, degreeNorm_sq] + exact (vectorMap e n).sum_comp (fun w : List.Vector β n => ‖f w.val‖^2) + +def optionFin (p : ℕ) : Option (Fin p) ≃ Fin (p+1) where + toFun := fun a => match a with | none => Fin.last p | some i => i.castSucc + invFun := Fin.lastCases none some + left_inv a := by cases a <;> simp + right_inv a := by induction a using Fin.lastCases <;> simp +@[simp] theorem optionFin_none (p : ℕ) : optionFin p none = Fin.last p := rfl +@[simp] theorem optionFin_some (p : ℕ) (i : Fin p) : optionFin p (some i) = i.castSucc := rfl + +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/OrthogonalExpansion.lean b/lean/OAI/Analysis/FreeEntropy/OrthogonalExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c79403492e90279a94f9aa79a1f5244147d7305 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/OrthogonalExpansion.lean @@ -0,0 +1,97 @@ +import OAI.Analysis.FreeEntropy.TensorGradient + +namespace OAI + +universe u1 u2 + +noncomputable section +open MeasureTheory Finset +namespace FiniteEntropySeparation +variable {κ : Type u1} {Ω : Type u2} [MeasurableSpace Ω] + def linearExpand (g : κ → Ω → ℝ) (a : κ →₀ ℝ) : Ω → ℝ := a.sum (fun k r => r • g k) + theorem linearExpand_apply {κ : Type u1} {Ω : Type u2} [MeasurableSpace Ω] (g : κ → Ω → ℝ) (a : κ →₀ ℝ) (x : Ω) : + linearExpand g a x = ∑ k ∈ a.support, a k*g k x := by + simp [linearExpand, Finsupp.sum, Finset.sum_apply, Pi.smul_apply] + theorem linearExpand_integrable {μ : Measure Ω} {g : κ → Ω → ℝ} + (hg : ∀ k, Integrable (g k) μ) (a : κ →₀ ℝ) : Integrable (linearExpand g a) μ := by + change Integrable (fun x => linearExpand g a x) μ + simp only [linearExpand_apply] + exact integrable_finsetSum _ (fun k _ => (hg k).const_mul (a k)) + theorem linearExpand_mul_integrable {μ : Measure Ω} {g h : κ → Ω → ℝ} + (hgh : ∀ k l, Integrable (fun x => g k x*h l x) μ) (a b : κ →₀ ℝ) : + Integrable (fun x => linearExpand g a x*linearExpand h b x) μ := by + simp only [linearExpand_apply, sum_mul, mul_sum] + apply integrable_finsetSum + intro k hk + apply integrable_finsetSum + intro l hl + convert (hgh l k).const_mul (a l*b k) using 1 ; try rfl + funext x; ring + theorem linearExpand_integral {μ : Measure Ω} {g : κ → Ω → ℝ} + (hg : ∀ k, Integrable (g k) μ) (a : κ →₀ ℝ) : + (∫ x, linearExpand g a x ∂μ) = ∑ k ∈ a.support, a k*∫ x, g k x ∂μ := by + simp only [linearExpand_apply] + rw [integral_finsetSum _ (fun k _ => (hg k).const_mul (a k))] + simp only [integral_const_mul] + theorem linearExpand_inner {μ : Measure Ω} {g h : κ → Ω → ℝ} + (hgh : ∀ k l, Integrable (fun x => g k x*h l x) μ) (a b : κ →₀ ℝ) : + (∫ x, linearExpand g a x*linearExpand h b x ∂μ) = + ∑ k ∈ a.support, ∑ l ∈ b.support, a k*b l*∫ x, g k x*h l x ∂μ := by + have he : (fun x => linearExpand g a x*linearExpand h b x) = + fun x => ∑ k ∈ a.support, ∑ l ∈ b.support, (a k*b l)*(g k x*h l x) := by + funext x + simp only [linearExpand_apply, sum_mul, mul_sum] + rw [sum_comm] + apply sum_congr rfl + intro k hk + apply sum_congr rfl + intro l hl + ring + rw [he, integral_finsetSum _ (fun k _ => integrable_finsetSum _ (fun l _ => (hgh k l).const_mul _))] + apply sum_congr rfl + intro k hk + rw [integral_finsetSum _ (fun l _ => (hgh k l).const_mul _)] + simp only [integral_const_mul] + theorem linearExpand_orthogonal [DecidableEq κ] {μ : Measure Ω} {g h : κ → Ω → ℝ} + (hgh : ∀ k l, Integrable (fun x => g k x*h l x) μ) (w : κ → ℝ) + (horth : ∀ k l, (∫ x, g k x*h l x ∂μ) = if k=l then w k else 0) + (a b : κ →₀ ℝ) : + (∫ x, linearExpand g a x*linearExpand h b x ∂μ) = + ∑ k ∈ a.support, a k*b k*w k := by + classical + rw [linearExpand_inner hgh] + apply sum_congr rfl + intro k hk + simp_rw [horth] + by_cases hkb : k ∈ b.support + · rw [sum_eq_single k] + · simp + · intro l hl hlk; simp [Ne.symm hlk] + · exact fun h => (h hkb).elim + · have hb : b k=0 := Finsupp.notMem_support_iff.mp hkb + rw [hb, mul_zero, zero_mul] + apply sum_eq_zero + intro l hl + have hkl : k ≠ l := fun h => hkb (h.symm ▸ hl) + simp [hkl] + theorem integral_center_sq {μ : Measure Ω} [IsProbabilityMeasure μ] {f : Ω → ℝ} + (hf : Integrable f μ) (hfsq : Integrable (fun x => f x*f x) μ) : + (∫ x, (f x-∫ y, f y ∂μ)^2 ∂μ) = (∫ x, f x*f x ∂μ) - (∫ x, f x ∂μ)^2 := by + let m := ∫ x, f x ∂μ + have he : (fun x => (f x-m)^2) = fun x => f x*f x - (2*m)*f x + m^2 := by + funext x; ring + change (∫ x, (f x-m)^2 ∂μ) = _ + rw [he] + have ha : (∫ x, f x*f x - (2*m)*f x + m^2 ∂μ) = + (∫ x, f x*f x - (2*m)*f x ∂μ) + ∫ x, m^2 ∂μ := + integral_add (hfsq.sub (hf.const_mul (2*m))) (integrable_const _) + have hs : (∫ x, f x*f x - (2*m)*f x ∂μ) = + (∫ x, f x*f x ∂μ) - ∫ x, (2*m)*f x ∂μ := integral_sub hfsq (hf.const_mul _) + rw [ha, hs, integral_const_mul] + simp only [integral_const, probReal_univ, smul_eq_mul, one_mul] + dsimp [m]; ring +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/PolynomialFunctions.lean b/lean/OAI/Analysis/FreeEntropy/PolynomialFunctions.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3ecdbb19996b36027a6445be1bb168ce9dea611 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/PolynomialFunctions.lean @@ -0,0 +1,92 @@ +import OAI.Analysis.FreeEntropy.GaussianMvStein + +namespace OAI + +universe u1 u2 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] [DecidableEq ι] + def IsRealPolynomial (f : (ι → ℝ) → ℝ) : Prop := ∃ P : MvPolynomial ι ℝ, f = fun x => MvPolynomial.eval x P + theorem mvPolynomial_hasCoordinateDeriv {ι : Type u1} [Fintype ι] [DecidableEq ι] (P : MvPolynomial ι ℝ) (i : ι) (x : ι → ℝ) : + HasDerivAt (fun t => MvPolynomial.eval (Function.update x i t) P) + (MvPolynomial.eval x (MvPolynomial.pderiv i P)) (x i) := by + induction P using MvPolynomial.induction_on with + | C r => simpa using hasDerivAt_const (x i) r + | add P Q hP hQ => + convert hP.add hQ using 1 <;> try rfl + · funext t; simp + · simp + | mul_X P j hP => + by_cases h : j=i + · subst j + convert hP.mul (hasDerivAt_id (x i)) using 1 <;> try rfl + · funext t; simp + · simp [mul_comm, add_comm] + · convert hP.mul_const (x j) using 1 <;> try rfl + · funext t; simp [Function.update_of_ne h] + · simp [MvPolynomial.pderiv_X_of_ne h, mul_comm] + namespace IsRealPolynomial + theorem const {ι : Type u1} [Fintype ι] [DecidableEq ι] (r : ℝ) : IsRealPolynomial (fun _ : ι → ℝ => r) := ⟨MvPolynomial.C r, by simp⟩ + theorem coord {ι : Type u1} [Fintype ι] [DecidableEq ι] (i : ι) : IsRealPolynomial (fun x : ι → ℝ => x i) := ⟨MvPolynomial.X i, by simp⟩ + theorem add {ι : Type u1} [Fintype ι] [DecidableEq ι] {f g : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) (hg : IsRealPolynomial g) : + IsRealPolynomial (fun x => f x+g x) := by + obtain ⟨P,rfl⟩ := hf; obtain ⟨Q,rfl⟩ := hg + exact ⟨P+Q,by simp⟩ + theorem sub {ι : Type u1} [Fintype ι] [DecidableEq ι] {f g : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) (hg : IsRealPolynomial g) : + IsRealPolynomial (fun x => f x-g x) := by + obtain ⟨P,rfl⟩ := hf; obtain ⟨Q,rfl⟩ := hg + exact ⟨P-Q,by simp⟩ + theorem mul {ι : Type u1} [Fintype ι] [DecidableEq ι] {f g : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) (hg : IsRealPolynomial g) : + IsRealPolynomial (fun x => f x*g x) := by + obtain ⟨P,rfl⟩ := hf; obtain ⟨Q,rfl⟩ := hg + exact ⟨P*Q,by simp⟩ + theorem const_mul {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) (r : ℝ) : + IsRealPolynomial (fun x => r*f x) := (const r).mul hf + theorem mul_const {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) (r : ℝ) : + IsRealPolynomial (fun x => f x*r) := hf.mul (const r) + theorem neg {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) : IsRealPolynomial (fun x => -f x) := by + simpa using (const 0).sub hf + theorem pow {ι : Type u1} [Fintype ι] [DecidableEq ι] {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) (n : ℕ) : IsRealPolynomial (fun x => f x^n) := by + obtain ⟨P,rfl⟩ := hf + exact ⟨P^n,by simp⟩ + theorem finset_sum {κ : Type u2} (s : Finset κ) {f : κ → (ι → ℝ) → ℝ} + (hf : ∀ k ∈ s, IsRealPolynomial (f k)) : IsRealPolynomial (fun x => ∑ k ∈ s, f k x) := by + classical + induction s using Finset.induction_on with + | empty => simpa using const (ι := ι) 0 + | @insert k s hk ih => + simpa [hk] using (hf k (mem_insert_self _ _)).add (ih (fun j hj => hf j (mem_insert_of_mem hj))) + theorem continuous {ι : Type u1} [Fintype ι] [DecidableEq ι] {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) : Continuous f := by + obtain ⟨P,rfl⟩ := hf + exact P.continuous_eval + theorem integrable {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) : Integrable f (productGaussian ι) := by + obtain ⟨P,rfl⟩ := hf + exact gaussian_mvPolynomial_integrable P + theorem derivative {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) (i : ι) : + IsRealPolynomial (coordinateDerivative f i) := by + obtain ⟨P,rfl⟩ := hf + refine ⟨MvPolynomial.pderiv i P, ?_⟩ + funext x + exact (mvPolynomial_hasCoordinateDeriv P i x).deriv + theorem hasDerivAt {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) (i : ι) (x : ι → ℝ) : + HasDerivAt (fun t => f (Function.update x i t)) (coordinateDerivative f i x) (x i) := by + obtain ⟨P,rfl⟩ := hf + have hd := mvPolynomial_hasCoordinateDeriv P i x + exact hd.congr_deriv hd.deriv.symm + theorem stein {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) (i : ι) : + (∫ x, x i*f x ∂productGaussian ι) = ∫ x, coordinateDerivative f i x ∂productGaussian ι := by + obtain ⟨P,rfl⟩ := hf + exact gaussian_mvPolynomial_stein P i + theorem poincare {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) : + (∫ x, (f x-∫ y, f y ∂productGaussian ι)^2 ∂productGaussian ι) ≤ + ∑ i, ∫ x, (coordinateDerivative f i x)^2 ∂productGaussian ι := by + obtain ⟨P,rfl⟩ := hf + exact gaussian_mvPolynomial_poincare P + end IsRealPolynomial +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/PolynomialGrowth.lean b/lean/OAI/Analysis/FreeEntropy/PolynomialGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..986f9d4145a0dc3d2cc889bb7f4a04a48f6ea98b --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/PolynomialGrowth.lean @@ -0,0 +1,93 @@ +import OAI.Analysis.FreeEntropy.GaussianEntropyEvent + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] [DecidableEq ι] + +omit [DecidableEq ι] in +theorem mvPolynomial_norm_bound [DecidableEq ι] (P : MvPolynomial ι ℝ) : + ∃ C : ℝ,0 ≤ C ∧ ∃ m : ℕ,∀x : EuclideanSpace ℝ ι, + |MvPolynomial.eval (WithLp.ofLp x) P| ≤ C*(1+‖x‖^2)^m := by + induction P using MvPolynomial.induction_on with + | C c => exact ⟨|c|,abs_nonneg _,0,by intro x; simp⟩ + | add P Q hP hQ => + obtain ⟨C,hC,m,hP⟩ := hP + obtain ⟨D,hD,k,hQ⟩ := hQ + refine ⟨C+D,add_nonneg hC hD,max m k,?_⟩ + intro x + have hbase : 1≤1+‖x‖^2 := by nlinarith [sq_nonneg ‖x‖] + calc + _ ≤ |MvPolynomial.eval (WithLp.ofLp x) P|+|MvPolynomial.eval (WithLp.ofLp x) Q| := by simpa only [map_add] using abs_add_le (MvPolynomial.eval (WithLp.ofLp x) P) (MvPolynomial.eval (WithLp.ofLp x) Q) + _ ≤ C*(1+‖x‖^2)^m+D*(1+‖x‖^2)^k := add_le_add (hP x) (hQ x) + _ ≤ C*(1+‖x‖^2)^(max m k)+D*(1+‖x‖^2)^(max m k) := add_le_add + (mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hbase (le_max_left m k)) hC) + (mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hbase (le_max_right m k)) hD) + _ = _ := by ring + | mul_X P i hP => + obtain ⟨C,hC,m,hP⟩ := hP + refine ⟨C,hC,m+1,?_⟩ + intro x + have hn : |x i| ≤ ‖x‖ := by simpa only [Real.norm_eq_abs] using PiLp.norm_apply_le x i + have hn' : |x i| ≤ 1+‖x‖^2 := by nlinarith [sq_nonneg (‖x‖-1/2)] + calc + _ = |MvPolynomial.eval (WithLp.ofLp x) P| * |x i| := by simp only [map_mul,MvPolynomial.eval_X,abs_mul] + _ ≤ (C*(1+‖x‖^2)^m)*(1+‖x‖^2) := mul_le_mul (hP x) hn' (abs_nonneg _) (by positivity) + _ = _ := by rw [pow_succ]; ring + namespace IsRealPolynomial + theorem norm_bound {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) : + ∃ C : ℝ,0 ≤ C ∧ ∃ m : ℕ,∀x : EuclideanSpace ℝ ι,|f (WithLp.ofLp x)| ≤ C*(1+‖x‖^2)^m := by + obtain ⟨P,rfl⟩ := hf + exact mvPolynomial_norm_bound P + theorem smoothed_integrable {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) + (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] {s K : ℝ} + (hs : 0 f (WithLp.ofLp x)*smoothedDensity μ s x) := by + obtain ⟨C,hC,m,hb⟩ := hf.norm_bound + apply smoothedIntegrable_of_bound μ hs hK hμ + (((hf.continuous.comp (PiLp.continuous_ofLp 2 _)).mul (smoothedDensity_continuous μ hs)).aestronglyMeasurable) C m + intro x + change ‖f (WithLp.ofLp x)*smoothedDensity μ s x‖≤_ + rw [Real.norm_eq_abs,abs_mul,abs_of_pos (smoothedDensity_pos μ hs x)] + exact mul_le_mul_of_nonneg_right (hb x) (smoothedDensity_pos μ hs x).le + theorem smoothedGradient_integrable {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) + (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] {s K : ℝ} + (hs : 0 f (WithLp.ofLp x)*smoothedGradient μ s x i) := by + obtain ⟨C,hC,m,hb⟩ := hf.norm_bound + apply smoothedIntegrable_of_bound μ hs hK hμ + ((((hf.continuous.comp (PiLp.continuous_ofLp 2 _)).stronglyMeasurable).mul (smoothedGradient_measurable μ s i)).aestronglyMeasurable) (C*((1+K)/s)) (m+1) + intro x + change ‖f (WithLp.ofLp x)*smoothedGradient μ s x i‖≤_ + rw [Real.norm_eq_abs,abs_mul] + calc + _ ≤ (C*(1+‖x‖^2)^m)*(((1+K)/s)*(1+‖x‖^2)*smoothedDensity μ s x) := + mul_le_mul (hb x) (smoothedGradient_polynomial_bound μ hs le_rfl hK hμ x i) (abs_nonneg _) (by positivity) + _ = _ := by rw [pow_succ]; ring + theorem hasDerivAt_line {f : (ι → ℝ) → ℝ} (hf : IsRealPolynomial f) + (x : EuclideanSpace ℝ ι) (i : ι) (r : ℝ) : + HasDerivAt (fun t : ℝ => f (WithLp.ofLp (x+t • EuclideanSpace.single i 1))) + (coordinateDerivative f i (WithLp.ofLp (x+r • EuclideanSpace.single i 1))) r := by + let y := x+r • EuclideanSpace.single i 1 + have hy : (WithLp.ofLp y) i = x i+r := by simp [y] + have hd0 := hf.hasDerivAt i (WithLp.ofLp y) + rw [hy] at hd0 + have hd := hd0.comp r ((hasDerivAt_id r).const_add (x i)) + convert hd using 1 <;> try rfl + · funext t + congr 1 + ext j + by_cases h : j=i + · subst j; simp + · simp [y,h,EuclideanSpace.single] + · simp [y] + end IsRealPolynomial +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/RandomHeatConvergence.lean b/lean/OAI/Analysis/FreeEntropy/RandomHeatConvergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..04500f3eb5ae3020d74e166620e523769ecfaddd --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/RandomHeatConvergence.lean @@ -0,0 +1,52 @@ +import OAI.Analysis.FreeEntropy.L2Convergence + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology +namespace FiniteEntropySeparation.FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] {n : ℕ} +variable {D : ℕ → ℕ} (hD0 : ∀k,0 ∫z : MatrixCoordinates n (D k) × (MatrixIndex n (D k) → ℝ), + ‖matrixMoment (heatCoordinates z.1 u z.2) w-wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u) w‖^2 + ∂(μ k).prod (productGaussian (MatrixIndex n (D k)))) atTop (𝓝 0) := by + have he k := heatMoment_error_integrable (hD0 k) (μ k) hR ((hμ k).mono (fun a ha => ha.1)) u w + (wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u) w) + have heq (k : ℕ) := integral_prod _ (he k) + simp_rw [heq] + exact heatError_integral_tendsto hD0 hD J X hX hR hn σ hσ hs μ hμ u w + theorem heatMoment_product_tendsto (u : ℝ) (w : List (Fin n)) : + Tendsto (fun k => ∫z : MatrixCoordinates n (D k) × (MatrixIndex n (D k) → ℝ), + matrixMoment (heatCoordinates z.1 u z.2) w + ∂(μ k).prod (productGaussian (MatrixIndex n (D k)))) atTop + (𝓝 (wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u) w)) := by + exact complex_integral_tendsto_of_L2 _ _ _ + (fun k => heatMoment_integrable (hD0 k) (μ k) hR ((hμ k).mono (fun a ha => ha.1)) u w) + (fun k => heatMoment_error_integrable (hD0 k) (μ k) hR ((hμ k).mono (fun a ha => ha.1)) u w _) + (heatError_product_tendsto hD0 hD J X hX hR hn σ hσ hs μ hμ u w) + theorem heatMoment_products_tendsto (u : ℝ) (v w : List (Fin n)) : + Tendsto (fun k => ∫z : MatrixCoordinates n (D k) × (MatrixIndex n (D k) → ℝ), + matrixMoment (heatCoordinates z.1 u z.2) v*matrixMoment (heatCoordinates z.1 u z.2) w + ∂(μ k).prod (productGaussian (MatrixIndex n (D k)))) atTop + (𝓝 (wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u) v* + wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u) w)) := by + exact complex_integral_mul_tendsto_of_L2 _ _ _ _ _ + (fun k => heatMoment_integrable (hD0 k) (μ k) hR ((hμ k).mono (fun a ha => ha.1)) u v) + (fun k => heatMoment_integrable (hD0 k) (μ k) hR ((hμ k).mono (fun a ha => ha.1)) u w) + (fun k => heatMoment_error_integrable (hD0 k) (μ k) hR ((hμ k).mono (fun a ha => ha.1)) u v _) + (fun k => heatMoment_error_integrable (hD0 k) (μ k) hR ((hμ k).mono (fun a ha => ha.1)) u w _) + (heatError_product_tendsto hD0 hD J X hX hR hn σ hσ hs μ hμ u v) + (heatError_product_tendsto hD0 hD J X hX hR hn σ hσ hs μ hμ u w) +end FiniteEntropySeparation.FreeTensor + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/RandomHeatMoments.lean b/lean/OAI/Analysis/FreeEntropy/RandomHeatMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..03c93172822b359730eb16f18cb378e3cf6ed7cb --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/RandomHeatMoments.lean @@ -0,0 +1,68 @@ +import OAI.Analysis.FreeEntropy.RandomMatrixConvergence + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Finset Filter +open scoped Topology ENNReal +namespace FiniteEntropySeparation + theorem heatMatrix_noiseBound {n d : ℕ} (A : Fin n → Matrix (Fin d) (Fin d) ℂ) {R : ℝ} + (hR : 0≤R) (hA : ∀i,matrixOpNorm (A i)≤R) (u : ℝ) (x : MatrixIndex n d → ℝ) (i : Fin n) : + matrixOpNorm (heatMatrix A u x i) ≤ (1+Real.sqrt u)*jointNoiseBound R x := by + have h1 := jointMatrix_norm_bound A hR hA x (Sum.inl i) + have h2 := jointMatrix_norm_bound A hR hA x (Sum.inr i) + have h := matrixOpNorm_add (A i) ((Real.sqrt u:ℂ) • gueMatrix x i) + rw [matrixOpNorm_smul,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg (Real.sqrt_nonneg _)] at h + change matrixOpNorm (heatMatrix A u x i) ≤ _ at h + calc + _ ≤ matrixOpNorm (A i)+Real.sqrt u*matrixOpNorm (gueMatrix x i) := h + _ ≤ jointNoiseBound R x+Real.sqrt u*jointNoiseBound R x := add_le_add h1 (mul_le_mul_of_nonneg_left h2 (Real.sqrt_nonneg _)) + _ = _ := by ring + theorem heatMoment_bound {n d : ℕ} (hd : 0 heatMatrix_noiseBound _ hR ha u x i) + theorem heatMoment_power_integrable {n d : ℕ} (hd : 0 ‖matrixMoment (heatCoordinates z.1 u z.2) w‖^m) + (μ.prod (productGaussian (MatrixIndex n d))) := by + have hb := ((jointNoiseBound_moment (n := n) hd hR (w.length*m)).1.const_mul ((1+Real.sqrt u)^(w.length*m))).comp_snd μ + apply hb.mono' + · exact (((matrixMoment_continuous w).comp (heatCoordinates_continuous u)).norm.pow m).aestronglyMeasurable + have hm : ∀ᵐ z ∂μ.prod (productGaussian (MatrixIndex n d)),∀i,matrixOpNorm (hermitianMatrix z.1 i)≤R := by + apply (Measure.ae_prod_iff_ae_ae ?_).mpr + · filter_upwards [hμ] with a ha + exact ae_of_all _ (fun _ => ha) + · simpa only [Set.ofPred_forall,Function.comp_apply] using MeasurableSet.iInter (fun i : Fin n => measurableSet_le ((matrixOpNorm_continuous.comp (hermitianMatrix_continuous (n := n) (d := d) i)).comp (continuous_fst : Continuous (Prod.fst : MatrixCoordinates n d × (MatrixIndex n d → ℝ) → MatrixCoordinates n d))).measurable (measurable_const (a := R))) + filter_upwards [hm] with z hz + rw [Real.norm_eq_abs,abs_of_nonneg (pow_nonneg (norm_nonneg _) _)] + simpa only [mul_pow,← pow_mul] using pow_le_pow_left₀ (norm_nonneg _) (heatMoment_bound hd z.1 hR hz u z.2 w) m + theorem heatMoment_integrable {n d : ℕ} (hd : 0 matrixMoment (heatCoordinates z.1 u z.2) w) + (μ.prod (productGaussian (MatrixIndex n d))) := by + apply integrable_norm_iff (((matrixMoment_continuous w).comp (heatCoordinates_continuous u)).aestronglyMeasurable) |>.mp + simpa using heatMoment_power_integrable hd μ hR hμ u w 1 + theorem heatMoment_error_integrable {n d : ℕ} (hd : 0 ‖matrixMoment (heatCoordinates z.1 u z.2) w-c‖^2) + (μ.prod (productGaussian (MatrixIndex n d))) := by + have hi := ((heatMoment_power_integrable hd μ hR hμ u w 2).add (integrable_const (‖c‖^2))).const_mul 2 + apply hi.mono' (((((matrixMoment_continuous w).comp (heatCoordinates_continuous u)).sub continuous_const).norm.pow 2).aestronglyMeasurable) + exact ae_of_all _ (fun z => by + rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)] + dsimp only [Pi.add_apply,Pi.pow_apply,Pi.sub_apply,Function.comp_apply] + have h := norm_sub_le (matrixMoment (heatCoordinates z.1 u z.2) w) c + have hn := norm_nonneg (matrixMoment (heatCoordinates z.1 u z.2) w-c) + nlinarith [sq_nonneg (‖matrixMoment (heatCoordinates z.1 u z.2) w‖-‖c‖)]) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/RandomMatrixConvergence.lean b/lean/OAI/Analysis/FreeEntropy/RandomMatrixConvergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..00dbbcc85114281adb8bb4d719f2fb7e8d9817c5 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/RandomMatrixConvergence.lean @@ -0,0 +1,50 @@ +import OAI.Analysis.FreeEntropy.UniformConvergence + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory Filter +open scoped Topology ENNReal +namespace FiniteEntropySeparation + theorem heatCoordinates_continuous {n d : ℕ} (u : ℝ) : + Continuous (fun z : MatrixCoordinates n d × (MatrixIndex n d → ℝ) => heatCoordinates z.1 u z.2) := by + exact continuous_fst.add ((PiLp.continuous_toLp 2 (fun _ : MatrixIndex n d => ℝ)).comp continuous_snd |>.const_smul (Real.sqrt u/Real.sqrt d)) + theorem conditionalHeatError_measurable {n d : ℕ} (u : ℝ) (w : List (Fin n)) (z : ℂ) : + Measurable (fun a : MatrixCoordinates n d => ∫ x,‖matrixMoment (heatCoordinates a u x) w-z‖^2 ∂productGaussian (MatrixIndex n d)) := by + have h : Continuous (fun z' : MatrixCoordinates n d × (MatrixIndex n d → ℝ) => ‖matrixMoment (heatCoordinates z'.1 u z'.2) w-z‖^2) := + (((matrixMoment_continuous w).comp (heatCoordinates_continuous u)).sub continuous_const).norm.pow 2 + exact h.stronglyMeasurable.integral_prod_right'.measurable + namespace FreeTensor + variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] {n : ℕ} + theorem heatError_uniform {D : ℕ → ℕ} (hD0 : ∀k,0 semicircularN (σ i)) u) w‖^2 ∂productGaussian (MatrixIndex n (D k))|<ε := by + apply uniform_of_all_selections _ hn _ _ hε + intro a ha + simp only [matrixMoment_heatCoordinates] + apply heatMatrix_meanSquare_tendsto hD0 hD (fun k => hermitianMatrix (a k)) hR (fun k i => (ha k).1 i) J X hX σ hσ hs + intro v + exact diagonalMicrostates_moments (tracialVector B N G) X a ha v + theorem heatError_integral_tendsto {D : ℕ → ℕ} (hD0 : ∀k,0 ∫ a,∫ x,‖matrixMoment (heatCoordinates a u x) w- + wordMoment (tracialVector B N G) (heatTuple X (fun i => semicircularN (σ i)) u) w‖^2 ∂productGaussian (MatrixIndex n (D k)) ∂μ k) atTop (𝓝 0) := by + apply integral_tendsto_zero_of_uniform μ _ hμ _ (fun k => (conditionalHeatError_measurable u w _).aestronglyMeasurable) + intro ε hε + exact heatError_uniform hD0 hD J X hX hR hn σ hσ hs u w hε + end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/RealTail.lean b/lean/OAI/Analysis/FreeEntropy/RealTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4359fbe44b4e55eb49bd20384417282dffa0e74 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/RealTail.lean @@ -0,0 +1,37 @@ +import OAI.Analysis.FreeEntropy.EntropyReal + +namespace OAI + +noncomputable section +open MeasureTheory Set Filter +namespace FiniteEntropySeparation + theorem integrableOn_Ioi_translate {f : ℝ → ℝ} (a : ℝ) : + IntegrableOn (fun s => f (a+s)) (Ioi 0) ↔ IntegrableOn f (Ioi a) := by + have he : (fun s : ℝ => a+s) ⁻¹' Ioi a = Ioi 0 := by ext s; simp + simpa only [he, Function.comp_def] using + (measurePreserving_add_left volume a).integrableOn_comp_preimage (measurableEmbedding_addLeft a) + (f := f) (s := Ioi a) + theorem integral_Ioi_translate (f : ℝ → ℝ) (a : ℝ) : + (∫ s in Ioi (0 : ℝ), f (a+s)) = ∫ u in Ioi a, f u := by + have he : (fun s : ℝ => a+s) ⁻¹' Ioi a = Ioi 0 := by ext s; simp + simpa only [he] using (measurePreserving_add_left volume a).setIntegral_preimage_emb + (measurableEmbedding_addLeft a) f (Ioi a) + theorem inverseFourth_integrable {a : ℝ} (ha : 0 < a) : + IntegrableOn (fun u : ℝ => 1/u^4) (Ioi a) := by + apply (integrableOn_Ioi_rpow_of_lt (by norm_num : (-4 : ℝ) < -1) ha).congr_fun _ measurableSet_Ioi + intro u hu + norm_num + theorem inverseFourth_integral {a : ℝ} (ha : 0 < a) : + (∫ u in Ioi a, 1/u^4) = 1/(3*a^3) := by + have he : (∫ u in Ioi a, 1/u^4) = ∫ u in Ioi a, u^(-4 : ℝ) := by + apply setIntegral_congr_fun measurableSet_Ioi + intro u hu + norm_num + rw [he, integral_Ioi_rpow_of_lt (by norm_num : (-4 : ℝ) < -1) ha] + norm_num + ring +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/SemicircularSeries.lean b/lean/OAI/Analysis/FreeEntropy/SemicircularSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..70617c4d2becbecaf07a92ea455ce7c9ed5f79de --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/SemicircularSeries.lean @@ -0,0 +1,134 @@ +import OAI.Analysis.FreeEntropy.SeriesAnalytic + +namespace OAI + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α : Type} [DecidableEq α] + +def letter (i : α) : Series α + | [j] => if j=i then 1 else 0 + | _ => 0 +def quadratic : Series α + | [i,j] => if j=i then 1 else 0 + | _ => 0 +@[simp] theorem letter_nil (i : α) : letter i [] = 0 := rfl +@[simp] theorem quadratic_nil : (quadratic : Series α) [] = 0 := rfl + theorem deriv_letter (i j : α) : deriv j (letter i) = if j=i then unit else 0 := by + funext w + cases w with + | nil => by_cases h : j=i <;> simp [deriv, letter, unit, h] + | cons a w => cases w <;> by_cases h : j=i <;> simp [deriv, letter, unit, h] + theorem subst_letter_cons (M : Series α) (i j : α) (w : List α) : + subst M (letter i) (j::w) = if j=i then M w else 0 := by + rw [subst_cons, deriv_letter] + split_ifs <;> simp + theorem deriv_quadratic (i : α) : deriv i (quadratic : Series α) = letter i := by + funext w + cases w with + | nil => rfl + | cons a w => cases w <;> rfl + + theorem quadratic_subst_derivative {n : ℕ} (M : Series (Fin n)) (i : Fin n) (w : List (Fin n)) : + subst M quadratic (i::w) = ∑ r : Fin w.length, if w[r.val] = i then + M (w.take r.val) * M (w.drop (r.val+1)) else 0 := by + rw [subst_cons, deriv_quadratic, conv_sum_splits, sum_range_succ] + simp only [List.take_length, List.drop_length, subst_nil, letter_nil, mul_zero, add_zero] + rw [← Fin.sum_univ_eq_sum_range (fun k => M (w.take k) * subst M (letter i) (w.drop k))] + apply sum_congr rfl + intro k hk + rw [List.drop_eq_getElem_cons k.isLt, subst_letter_cons] + split_ifs <;> simp + +def fockMoments (p : ℕ) : Series (Fin p) := wordMoment (Fock.tracialVector (Fin p)) Fock.semicircular + theorem fockMoments_eq (p : ℕ) : fockMoments p = unit + subst (fockMoments p) quadratic := by + funext w + cases w with + | nil => simp [fockMoments] + | cons i w => + simp only [Pi.add_apply, unit_cons, zero_add, quadratic_subst_derivative] + exact Fock.semicircular_integration_by_parts i w + theorem fockMoments_moments (p : ℕ) : fockMoments p = moments quadratic := + moments_unique quadratic_nil (fockMoments_eq p) + +variable [Fintype α] + theorem degreeNorm_succ_sq {α : Type} [DecidableEq α] [Fintype α] (f : Series α) (n : ℕ) : + degreeNorm f (n+1)^2 = ∑ a : α, degreeNorm (deriv a f) n ^ 2 := by + rw [degreeNorm_sq] + have he := (vectorCons (α := α) n).sum_comp + (fun w : List.Vector α (n+1) => ‖f w.val‖^2) + rw [← he, Fintype.sum_prod_type] + apply sum_congr rfl + intro a ha + exact (degreeNorm_sq (deriv a f) n).symm + theorem degreeNorm_letter_one (i : α) : degreeNorm (letter i) 1 = 1 := by + apply (sq_eq_sq₀ (degreeNorm_nonneg _ _) (by norm_num : (0:ℝ) ≤ 1)).mp + rw [degreeNorm_succ_sq] + simp only [deriv_letter, degreeNorm_nil, ite_apply, unit_nil, Pi.zero_apply] + calc + _ = ∑ a : α, if a=i then (1:ℝ) else 0 := by + apply sum_congr rfl + intro a ha + split_ifs <;> norm_num + _ = _ := by simp + theorem degreeNorm_quadratic_sq : degreeNorm (quadratic : Series α) 2 ^ 2 = Fintype.card α := by + rw [degreeNorm_succ_sq] + simp [deriv_quadratic, degreeNorm_letter_one] + theorem degreeNorm_quadratic_other {n : ℕ} (hn : n ≠ 2) : + degreeNorm (quadratic : Series α) n = 0 := by + apply (degreeNorm_congr (g := 0) n ?_).trans (degreeNorm_zero n) + intro w hw + cases w with + | nil => rfl + | cons a w => + cases w with + | nil => rfl + | cons b w => + cases w with + | nil => simp at hw; omega + | cons c w => rfl + theorem degreeNorm_quadratic : degreeNorm (quadratic : Series α) 2 = Real.sqrt (Fintype.card α) := by + apply (sq_eq_sq₀ (degreeNorm_nonneg _ _) (Real.sqrt_nonneg _)).mp + rw [degreeNorm_quadratic_sq, Real.sq_sqrt (by positivity)] + theorem quadratic_weight_le {r : ℝ} (_hr : 0 ≤ r) (N : ℕ) : + seriesWeight (quadratic : Series α) r N ≤ r^2 * Real.sqrt (Fintype.card α) := by + unfold seriesWeight truncEval + calc + _ = ∑ k ∈ range (N+1), if k=2 then r^2 * Real.sqrt (Fintype.card α) else 0 := by + apply sum_congr rfl + intro k hk + by_cases h : k = 2 + · subst k; simp [degreeNorm_quadratic] + · simp [h, degreeNorm_quadratic_other h] + _ ≤ _ := by simp only [sum_ite_eq']; split_ifs <;> first | exact le_rfl | positivity + + theorem fockMoments_norm_le {p : ℕ} (hp : 0 < p) (n : ℕ) : + degreeNorm (fockMoments p) n ≤ (2 * Real.sqrt (Real.sqrt p))^n := by + let q := Real.sqrt (Real.sqrt p) + have hq : 0 < q := Real.sqrt_pos.mpr (Real.sqrt_pos.mpr (by exact_mod_cast hp)) + have hq2 : q^2 = Real.sqrt p := Real.sq_sqrt (Real.sqrt_nonneg _) + let r := (2*q)⁻¹ + have hr : 0 < r := by dsimp [r]; positivity + have hw (N : ℕ) : seriesWeight (quadratic : Series (Fin p)) (2*r) N ≤ 1 := by + apply (quadratic_weight_le (by positivity) N).trans + simp only [Fintype.card_fin] + rw [← hq2] + dsimp [r] + field_simp + norm_num + have hm (N : ℕ) : seriesWeight (moments (quadratic : Series (Fin p))-unit) r N ≤ 1 := + moments_tail_weight quadratic_nil hr.le (by norm_num) le_rfl hw N + cases n with + | zero => simp [fockMoments] + | succ n => + rw [fockMoments_moments] + have hh := degreeNorm_le_of_weight hr hm (n+1) + rw [degreeNorm_sub_unit_pos _ (by omega)] at hh + simpa [r, q] using hh + +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/SeriesAnalytic.lean b/lean/OAI/Analysis/FreeEntropy/SeriesAnalytic.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f1761378d9f1fe1baf207fcfa3a8c2ae26aa075 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/SeriesAnalytic.lean @@ -0,0 +1,143 @@ +import OAI.Analysis.FreeEntropy.SeriesWeights + +namespace OAI + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α : Type} [Fintype α] + +@[simp] theorem degreeNorm_nil (f : Series α) : degreeNorm f 0 = ‖f []‖ := + vdegreeNorm_zero_degree f +@[simp] theorem degreeNorm_unit_pos {n : ℕ} (hn : 0 < n) : degreeNorm (unit : Series α) n = 0 := by + apply (degreeNorm_congr (g := 0) n ?_).trans (degreeNorm_zero n) + intro w hw + cases w with + | nil => simp at hw; omega + | cons a w => rfl +@[simp] theorem degreeNorm_neg (f : Series α) (n : ℕ) : degreeNorm (-f) n = degreeNorm f n := by + change ‖-degreeVector f n‖ = _ + exact norm_neg _ + theorem degreeNorm_sub_unit_pos (f : Series α) {n : ℕ} (hn : 0 < n) : + degreeNorm (f-unit) n = degreeNorm f n := by + apply degreeNorm_congr + intro w hw + cases w with + | nil => simp at hw; omega + | cons a w => simp + theorem seriesWeight_add_le (f g : Series α) {r : ℝ} (hr : 0 ≤ r) (N : ℕ) : + seriesWeight (f+g) r N ≤ seriesWeight f r N + seriesWeight g r N := by + unfold seriesWeight truncEval + rw [← sum_add_distrib] + apply sum_le_sum + intro k hk + rw [← mul_add] + exact mul_le_mul_of_nonneg_left (degreeNorm_add_le f g k) (pow_nonneg hr k) +@[simp] theorem seriesWeight_neg (f : Series α) (r : ℝ) (N : ℕ) : + seriesWeight (-f) r N = seriesWeight f r N := by simp [seriesWeight, truncEval] + theorem seriesWeight_agree {f g : Series α} {N : ℕ} (h : Agree N f g) (r : ℝ) : + seriesWeight f r N = seriesWeight g r N := by + unfold seriesWeight truncEval + apply sum_congr rfl + intro k hk + congr 1 + exact degreeNorm_congr k (fun w hw => h w (by simp only [mem_range] at hk; omega)) + theorem seriesWeight_split {f : Series α} (hf : f [] = 1) (r : ℝ) (N : ℕ) : + seriesWeight f r N = 1 + seriesWeight (f-unit) r N := by + unfold seriesWeight truncEval + rw [sum_range_succ', sum_range_succ'] + simp only [degreeNorm_nil, hf, norm_one, pow_zero, one_mul, Pi.sub_apply, unit_nil, sub_self, norm_zero, add_zero] + simp only [degreeNorm_sub_unit_pos f (Nat.zero_lt_succ _)] + ring +@[simp] theorem seriesWeight_unit (r : ℝ) (N : ℕ) : seriesWeight (unit : Series α) r N = 1 := by + unfold seriesWeight truncEval + rw [sum_range_succ'] + simp + theorem inverse_tail_identity {α : Type} [Fintype α] {M : Series α} (hM : M [] = 1) : + inverse M - unit = -(M-unit) - conv (M-unit) (inverse M-unit) := by + rw [conv_sub_left, conv_sub_right, conv_sub_right, conv_inverse hM, conv_unit_left, + conv_unit_right, conv_unit_left] + abel + theorem inverse_tail_weight {M : Series α} (hM : M [] = 1) {r a : ℝ} (hr : 0 ≤ r) + (_ha : 0 ≤ a) (ha1 : a < 1) (N : ℕ) (h : seriesWeight (M-unit) r N ≤ a) : + seriesWeight (inverse M-unit) r N ≤ a/(1-a) := by + have hb := seriesWeight_nonneg (inverse M-unit) hr N + have hie : seriesWeight (inverse M-unit) r N ≤ + seriesWeight (M-unit) r N + seriesWeight (M-unit) r N * seriesWeight (inverse M-unit) r N := by + conv_lhs => rw [inverse_tail_identity hM] + calc + _ ≤ seriesWeight (-(M-unit)) r N + seriesWeight (-conv (M-unit) (inverse M-unit)) r N := + seriesWeight_add_le _ _ hr N + _ ≤ _ := by simpa only [seriesWeight_neg] using + add_le_add le_rfl (seriesWeight_conv_le (M-unit) (inverse M-unit) hr N) + apply (le_div_iff₀ (by linarith : 0 < 1-a)).mpr + have hh := mul_le_mul_of_nonneg_right h hb + nlinarith + theorem seriesWeight_coeff_le (f : Series α) {r : ℝ} (hr : 0 ≤ r) (n : ℕ) : + r^n * degreeNorm f n ≤ seriesWeight f r n := by + exact single_le_sum (fun k _ => mul_nonneg (pow_nonneg hr k) (degreeNorm_nonneg f k)) + (mem_range.mpr (by omega)) + theorem degreeNorm_le_of_weight {f : Series α} {r : ℝ} (hr : 0 < r) + (h : ∀ N, seriesWeight f r N ≤ 1) (n : ℕ) : degreeNorm f n ≤ (r⁻¹)^n := by + have hn := (seriesWeight_coeff_le f hr.le n).trans (h n) + rw [inv_pow, ← one_div] + apply (le_div_iff₀ (pow_pos hr n)).mpr + simpa only [mul_comm] using hn + + theorem seriesWeight_mono_radius (f : Series α) {r s : ℝ} (hr : 0 ≤ r) (hrs : r ≤ s) (N : ℕ) : + seriesWeight f r N ≤ seriesWeight f s N := by + unfold seriesWeight truncEval + apply sum_le_sum + intro k hk + exact mul_le_mul_of_nonneg_right (pow_le_pow_left₀ hr hrs k) (degreeNorm_nonneg f k) + theorem geom_tail_le {q : ℝ} (hq : 0 ≤ q) (hq1 : q < 1) (N : ℕ) : + (∑ k ∈ range (N+1), q^k) - 1 ≤ q/(1-q) := by + apply (le_div_iff₀ (by linarith : 0 < 1-q)).mpr + have he := geom_sum_mul_neg q (N+1) + have hp := pow_nonneg hq (N+1) + nlinarith + theorem weight_le_geom {f : Series α} (hf : f [] = 0) {A r : ℝ} + (hA : 0 ≤ A) (hr : 0 ≤ r) (hq : r*A < 1) + (hb : ∀ n, 0 < n → degreeNorm f n ≤ A^n) (N : ℕ) : + seriesWeight f r N ≤ (r*A)/(1-r*A) := by + apply le_trans (b := (∑ k ∈ range (N+1), (r*A)^k) - 1) ?_ + (geom_tail_le (mul_nonneg hr hA) hq N) + unfold seriesWeight truncEval + rw [sum_range_succ', sum_range_succ'] + simp only [degreeNorm_nil, hf, norm_zero, pow_zero, mul_zero, add_zero] + rw [add_sub_cancel_right] + apply sum_le_sum + intro k hk + rw [mul_pow] + exact mul_le_mul_of_nonneg_left (hb (k+1) (by omega)) (pow_nonneg hr _) + theorem subst_weight_le (M f : Series α) {r : ℝ} (hr : 0 ≤ r) (N : ℕ) : + seriesWeight (subst M f) r N ≤ seriesWeight f (r*seriesWeight M r N) N := by + apply (seriesWeight_subst_le M f hr N).trans_eq + exact sum_congr rfl (fun k _ => mul_comm _ _) + theorem moments_tail_weight {R : Series α} (hR : R [] = 0) {r a : ℝ} + (hr : 0 ≤ r) (ha : 0 ≤ a) (ha1 : a ≤ 1) + (h : ∀ N, seriesWeight R (2*r) N ≤ a) (N : ℕ) : + seriesWeight (moments R-unit) r N ≤ a := by + have hi (j : ℕ) (K : ℕ) : seriesWeight (momentIter R j-unit) r K ≤ a := by + induction j with + | zero => simpa [momentIter, seriesWeight, truncEval] using ha + | succ j ih => + have hM : seriesWeight (momentIter R j) r K ≤ 2 := by + rw [seriesWeight_split (momentIter_nil hR j)] + linarith + have ht : momentIter R (j+1)-unit = subst (momentIter R j) R := by + rw [momentIter]; abel + rw [ht] + apply (subst_weight_le _ _ hr K).trans + apply (seriesWeight_mono_radius R + (mul_nonneg hr (seriesWeight_nonneg _ hr _)) + (by nlinarith : r*seriesWeight (momentIter R j) r K ≤ 2*r) K).trans + exact h K + apply le_of_eq_of_le (b := seriesWeight (momentIter R N-unit) r N) ?_ (hi N N) + exact seriesWeight_agree (fun w hw => by simp only [Pi.sub_apply, moments_agree hR N w hw]) r + +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/SeriesNorm.lean b/lean/OAI/Analysis/FreeEntropy/SeriesNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..b74d7a51f3eec6742590d6eb8ac38689358b8e18 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/SeriesNorm.lean @@ -0,0 +1,96 @@ +import OAI.Analysis.FreeEntropy.CumulantSeries + +namespace OAI + +universe u1 u2 u3 + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α : Type u1} [Fintype α] + +abbrev DegreeSpace (α : Type u2) [Fintype α] (n : ℕ) := EuclideanSpace ℂ (List.Vector α n) +def degreeVector (f : Series α) (n : ℕ) : DegreeSpace α n := WithLp.toLp 2 (fun w => f w.val) +def degreeNorm (f : Series α) (n : ℕ) : ℝ := ‖degreeVector f n‖ + +@[simp] theorem degreeVector_apply (f : Series α) (n : ℕ) (w : List.Vector α n) : + degreeVector f n w = f w.val := rfl +@[simp] theorem degreeNorm_nonneg (f : Series α) (n : ℕ) : 0 ≤ degreeNorm f n := norm_nonneg _ + theorem degreeNorm_sq (f : Series α) (n : ℕ) : + degreeNorm f n ^ 2 = ∑ w : List.Vector α n, ‖f w.val‖ ^ 2 := by + exact EuclideanSpace.norm_sq_eq _ + theorem degreeVector_add (f g : Series α) (n : ℕ) : + degreeVector (f+g) n = degreeVector f n + degreeVector g n := rfl + theorem degreeVector_smul (c : ℂ) (f : Series α) (n : ℕ) : + degreeVector (c • f) n = c • degreeVector f n := rfl + theorem degreeNorm_add_le (f g : Series α) (n : ℕ) : + degreeNorm (f+g) n ≤ degreeNorm f n + degreeNorm g n := by + unfold degreeNorm + rw [degreeVector_add] + exact norm_add_le _ _ +@[simp] theorem degreeNorm_smul (c : ℂ) (f : Series α) (n : ℕ) : + degreeNorm (c • f) n = ‖c‖ * degreeNorm f n := by + unfold degreeNorm + rw [degreeVector_smul] + exact norm_smul _ _ +@[simp] theorem degreeNorm_zero (n : ℕ) : degreeNorm (0 : Series α) n = 0 := norm_zero + theorem degreeNorm_congr {f g : Series α} (n : ℕ) + (h : ∀ w, w.length = n → f w = g w) : degreeNorm f n = degreeNorm g n := by + apply congrArg norm + ext w : 1 + exact h w.val w.prop + theorem degreeNorm_le_of_coeff {f g : Series α} {n : ℕ} + (h : ∀ w, w.length = n → ‖f w‖ ≤ ‖g w‖) : degreeNorm f n ≤ degreeNorm g n := by + apply (sq_le_sq₀ (degreeNorm_nonneg _ _) (degreeNorm_nonneg _ _)).mp + rw [degreeNorm_sq, degreeNorm_sq] + exact sum_le_sum fun w _ => pow_le_pow_left₀ (norm_nonneg _) (h w.val w.prop) 2 + theorem degreeNorm_sum_le {ι : Type u3} (s : Finset ι) (f : ι → Series α) (n : ℕ) : + degreeNorm (∑ i ∈ s, f i) n ≤ ∑ i ∈ s, degreeNorm (f i) n := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + rw [sum_insert hi, sum_insert hi] + exact (degreeNorm_add_le _ _ _).trans (add_le_add_right ih _) + + def vectorSplit (m n : ℕ) : List.Vector α (m+n) ≃ List.Vector α m × List.Vector α n where + toFun w := (⟨w.val.take m, by simp [w.prop]⟩, ⟨w.val.drop m, by simp [w.prop]⟩) + invFun v := ⟨v.1.val ++ v.2.val, by simp [v.1.prop, v.2.prop]⟩ + left_inv w := by apply Subtype.ext; exact List.take_append_drop _ _ + right_inv v := by + apply Prod.ext <;> apply Subtype.ext + · exact List.take_left' v.1.prop + · exact List.drop_left' v.1.prop + + theorem degreeNorm_tensor (f g : Series α) (m n : ℕ) : + degreeNorm (fun w => f (w.take m) * g (w.drop m)) (m+n) = + degreeNorm f m * degreeNorm g n := by + apply (sq_eq_sq₀ (degreeNorm_nonneg _ _) (mul_nonneg (degreeNorm_nonneg _ _) (degreeNorm_nonneg _ _))).mp + rw [mul_pow, degreeNorm_sq, degreeNorm_sq, degreeNorm_sq] + have h := (vectorSplit (α := α) m n).sum_comp + (fun v : List.Vector α m × List.Vector α n => ‖f v.1.val‖ ^ 2 * ‖g v.2.val‖ ^ 2) + calc + _ = ∑ v : List.Vector α (m+n), ‖f (v.val.take m)‖^2 * ‖g (v.val.drop m)‖^2 := by + simp only [norm_mul, mul_pow] + _ = ∑ v : List.Vector α m × List.Vector α n, ‖f v.1.val‖^2 * ‖g v.2.val‖^2 := h + _ = _ := by rw [Fintype.sum_prod_type, sum_mul_sum] + + theorem degreeNorm_conv_le (f g : Series α) (n : ℕ) : + degreeNorm (conv f g) n ≤ ∑ k ∈ range (n+1), degreeNorm f k * degreeNorm g (n-k) := by + have h : degreeNorm (conv f g) n = + degreeNorm (∑ k ∈ range (n+1), fun w => f (w.take k) * g (w.drop k)) n := by + apply degreeNorm_congr + intro w hw + simp only [conv_sum_splits, hw, Finset.sum_apply] + rw [h] + apply (degreeNorm_sum_le _ _ _).trans + apply sum_le_sum + intro k hk + have hn : k + (n-k) = n := Nat.add_sub_of_le (Nat.le_of_lt_succ (mem_range.mp hk)) + simpa only [hn] using le_of_eq (degreeNorm_tensor f g k (n-k)) + +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/SeriesSummability.lean b/lean/OAI/Analysis/FreeEntropy/SeriesSummability.lean new file mode 100644 index 0000000000000000000000000000000000000000..437e2e1155aa56913216fc12712a0013682a62ef --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/SeriesSummability.lean @@ -0,0 +1,44 @@ +import OAI.Analysis.FreeEntropy.SignalCovariance + +namespace OAI + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α : Type} [Fintype α] + +def wordSigma : (Σ n : ℕ, List.Vector α n) ≃ List α where + toFun v := v.2.val + invFun w := ⟨w.length, ⟨w,rfl⟩⟩ + left_inv v := by rcases v with ⟨n,⟨w,hw⟩⟩; cases hw; rfl + right_inv w := rfl + + theorem summable_words_iff (f : List α → ℝ) (hf : ∀ w, 0 ≤ f w) : + Summable f ↔ Summable (fun n => ∑ v : List.Vector α n, f v.val) := by + rw [← (wordSigma (α := α)).summable_iff] + change Summable (fun v : Σ n : ℕ, List.Vector α n => f v.2.val) ↔ _ + have he := summable_sigma_of_nonneg + (f := fun v : Σ n : ℕ, List.Vector α n => f v.2.val) (fun v => hf v.2.val) + simpa only [tsum_fintype, and_iff_right (fun n => (hasSum_fintype (fun v : List.Vector α n => f v.val)).summable)] using he + theorem tsum_words_degree (f : List α → ℝ) (hf : Summable f) : + ∑' w, f w = ∑' n, ∑ v : List.Vector α n, f v.val := by + have hs : Summable (fun v : Σ n : ℕ, List.Vector α n => f v.2.val) := + (wordSigma (α := α)).summable_iff.mpr hf + calc + ∑' w, f w = ∑' v : Σ n : ℕ, List.Vector α n, f v.2.val := + ((wordSigma (α := α)).tsum_eq f).symm + _ = ∑' n, ∑' v : List.Vector α n, f v.val := hs.tsum_sigma + _ = _ := by simp only [tsum_fintype] + theorem summable_norm_sq_iff (f : Series α) : + Summable (fun w => ‖f w‖ ^ 2) ↔ Summable (fun n => degreeNorm f n ^ 2) := by + rw [summable_words_iff _ (fun w => sq_nonneg _)] + simp only [degreeNorm_sq] + theorem tsum_norm_sq_degree (f : Series α) (hf : Summable (fun w => ‖f w‖^2)) : + ∑' w, ‖f w‖^2 = ∑' n, degreeNorm f n ^ 2 := by + rw [tsum_words_degree _ hf] + simp only [degreeNorm_sq] +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/SeriesWeights.lean b/lean/OAI/Analysis/FreeEntropy/SeriesWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..baeef71fd7d970b46bfbb84b3aeff5ee9c7dd4ac --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/SeriesWeights.lean @@ -0,0 +1,142 @@ +import OAI.Analysis.FreeEntropy.VectorSeries + +namespace OAI + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset + + def truncEval (a : ℕ → ℝ) (r : ℝ) (N : ℕ) : ℝ := ∑ n ∈ range (N+1), r^n * a n + theorem truncEval_nonneg {a : ℕ → ℝ} {r : ℝ} (ha : ∀ n, 0 ≤ a n) (hr : 0 ≤ r) (N : ℕ) : + 0 ≤ truncEval a r N := sum_nonneg fun n _ => mul_nonneg (pow_nonneg hr _) (ha n) + theorem truncEval_mono {a : ℕ → ℝ} {r : ℝ} (ha : ∀ n, 0 ≤ a n) (hr : 0 ≤ r) + {N K : ℕ} (hNK : N ≤ K) : truncEval a r N ≤ truncEval a r K := by + apply sum_le_sum_of_subset_of_nonneg (range_mono (by omega)) + intro n _ _ + exact mul_nonneg (pow_nonneg hr _) (ha n) + theorem truncEval_le {a b : ℕ → ℝ} {r : ℝ} (hr : 0 ≤ r) + (hab : ∀ n, a n ≤ b n) (N : ℕ) : truncEval a r N ≤ truncEval b r N := + sum_le_sum fun n _ => mul_le_mul_of_nonneg_left (hab n) (pow_nonneg hr n) +@[simp] theorem truncEval_zero (a : ℕ → ℝ) (r : ℝ) : truncEval a r 0 = a 0 := by simp [truncEval] + theorem truncEval_succ_shift (a : ℕ → ℝ) (r : ℝ) (N : ℕ) : + truncEval a r (N+1) = a 0 + r * truncEval (fun n => a (n+1)) r N := by + unfold truncEval + rw [sum_range_succ'] + simp only [pow_zero, one_mul, mul_sum, pow_succ] + rw [add_comm] + congr 1 + apply sum_congr rfl + intro n _ + ring + + theorem triangle_le_rectangle (f : ℕ → ℕ → ℝ) (hf : ∀ i j, 0 ≤ f i j) (N : ℕ) : + (∑ n ∈ range (N+1), ∑ k ∈ range (n+1), f k (n-k)) ≤ + ∑ k ∈ range (N+1), ∑ j ∈ range (N+1), f k j := by + let s := (range (N+1) ×ˢ range (N+1)).filter (fun v : ℕ × ℕ => v.1+v.2 ≤ N) + rw [sum_sigma'] + calc + _ = ∑ v ∈ s, f v.1 v.2 := by + apply sum_bij (fun x _ => (x.2, x.1-x.2)) + · intro x hx + obtain ⟨hx1,hx2⟩ := mem_sigma.mp hx + simp only [mem_range] at hx1 hx2 + simp only [s, mem_filter, mem_product, mem_range] + omega + · intro x hx y hy he + obtain ⟨hx1,hx2⟩ := mem_sigma.mp hx + obtain ⟨hy1,hy2⟩ := mem_sigma.mp hy + simp only [mem_range] at hx1 hx2 hy1 hy2 + have h1 := congrArg Prod.fst he + have h2 := congrArg Prod.snd he + rcases x with ⟨xn,xk⟩ + rcases y with ⟨yn,yk⟩ + dsimp at h1 h2 hx1 hx2 hy1 hy2 + have hxy : xn = yn := by omega + subst yn + subst yk + rfl + · intro y hy + simp only [s, mem_filter, mem_product, mem_range] at hy + refine ⟨⟨y.1+y.2,y.1⟩, ?_, ?_⟩ + · simp only [mem_sigma, mem_range]; omega + · apply Prod.ext <;> simp + · intro x hx; rfl + _ ≤ ∑ v ∈ range (N+1) ×ˢ range (N+1), f v.1 v.2 := by + exact sum_le_sum_of_subset_of_nonneg (filter_subset _ _) (fun v _ _ => hf v.1 v.2) + _ = _ := sum_product _ _ _ + + def scalarConv (a b : ℕ → ℝ) (n : ℕ) : ℝ := ∑ k ∈ range (n+1), a k * b (n-k) + theorem truncEval_conv_le {a b : ℕ → ℝ} {r : ℝ} + (ha : ∀ n, 0 ≤ a n) (hb : ∀ n, 0 ≤ b n) (hr : 0 ≤ r) (N : ℕ) : + truncEval (scalarConv a b) r N ≤ truncEval a r N * truncEval b r N := by + unfold truncEval + rw [sum_mul_sum] + calc + _ = ∑ n ∈ range (N+1), ∑ k ∈ range (n+1), (r^k*a k)*(r^(n-k)*b (n-k)) := by + apply sum_congr rfl + intro n hn + rw [scalarConv, mul_sum] + apply sum_congr rfl + intro k hk + have hkn : k+(n-k)=n := Nat.add_sub_of_le (Nat.le_of_lt_succ (mem_range.mp hk)) + have hp : r^n = r^k*r^(n-k) := by rw [← pow_add, hkn] + rw [hp]; ring + _ ≤ _ := by + exact triangle_le_rectangle (fun k j => (r^k*a k)*(r^j*b j)) + (fun k j => mul_nonneg (mul_nonneg (pow_nonneg hr _) (ha k)) + (mul_nonneg (pow_nonneg hr _) (hb j))) N + + theorem substBound_trunc_le {b a : ℕ → ℝ} {r B : ℝ} + (hb : ∀ n, 0 ≤ b n) (ha : ∀ n, 0 ≤ a n) (hr : 0 ≤ r) + (N : ℕ) (hB : truncEval b r N ≤ B) : + truncEval (substBound b a) r N ≤ ∑ k ∈ range (N+1), a k * (r*B)^k := by + have hB0 : 0 ≤ B := (truncEval_nonneg hb hr N).trans hB + induction N generalizing a with + | zero => simp [substBound] + | succ N ih => + have hBN : truncEval b r N ≤ B := (truncEval_mono hb hr (by omega)).trans hB + have ha' : ∀ n, 0 ≤ a (n+1) := fun n => ha (n+1) + have hi := ih ha' hBN + have ht : (fun n => substBound b a (n+1)) = scalarConv b (substBound b (fun n => a (n+1))) := by + funext n + rw [substBound, scalarConv] + rw [truncEval_succ_shift, show substBound b a 0 = a 0 by rw [substBound], ht] + calc + _ ≤ a 0 + r * (truncEval b r N * truncEval (substBound b (fun n => a (n+1))) r N) := by + gcongr + exact truncEval_conv_le hb (substBound_nonneg hb ha') hr N + _ ≤ a 0 + r * (B * ∑ k ∈ range (N+1), a (k+1) * (r*B)^k) := by + apply add_le_add_right (mul_le_mul_of_nonneg_left _ hr) + exact mul_le_mul hBN hi (truncEval_nonneg (substBound_nonneg hb ha') hr N) hB0 + _ = _ := by + conv_rhs => rw [sum_range_succ'] + simp only [pow_zero, mul_one, pow_succ, mul_sum] + rw [add_comm] + congr 1 + apply sum_congr rfl + intro k hk + ring + +variable {α : Type} [Fintype α] + def seriesWeight (f : Series α) (r : ℝ) (N : ℕ) : ℝ := truncEval (degreeNorm f) r N + theorem seriesWeight_nonneg (f : Series α) {r : ℝ} (hr : 0 ≤ r) (N : ℕ) : + 0 ≤ seriesWeight f r N := truncEval_nonneg (degreeNorm_nonneg f) hr N + theorem seriesWeight_conv_le (f g : Series α) {r : ℝ} (hr : 0 ≤ r) (N : ℕ) : + seriesWeight (conv f g) r N ≤ seriesWeight f r N * seriesWeight g r N := by + apply (truncEval_le hr (degreeNorm_conv_le f g) N).trans + exact truncEval_conv_le (degreeNorm_nonneg f) (degreeNorm_nonneg g) hr N + theorem seriesWeight_subst_le (M f : Series α) {r : ℝ} (hr : 0 ≤ r) (N : ℕ) : + seriesWeight (subst M f) r N ≤ + ∑ k ∈ range (N+1), degreeNorm f k * (r * seriesWeight M r N)^k := by + apply (truncEval_le hr (fun k => ?_) N).trans + · exact substBound_trunc_le (degreeNorm_nonneg M) (degreeNorm_nonneg f) hr N le_rfl + · have h := vsubst_norm_le k M f + change degreeNorm (vsubst M f) k ≤ substBound (degreeNorm M) (degreeNorm f) k at h + rw [vsubst_scalar] at h + exact h + +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/Signal.lean b/lean/OAI/Analysis/FreeEntropy/Signal.lean new file mode 100644 index 0000000000000000000000000000000000000000..81c8e0d2324f1dd92392834e0765d92323a6cc0a --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/Signal.lean @@ -0,0 +1,204 @@ +import OAI.Analysis.FreeEntropy.WordLinearLaw + +namespace OAI + +universe u1 u2 + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate lp +open MeasureTheory Filter +namespace FiniteEntropySeparation + +theorem norm_sum_sq_orthogonal {H : Type u1} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + {ι : Type u2} [Fintype ι] (x : ι → H) + (h : ∀ i j, i ≠ j → inner ℂ (x i) (x j) = 0) : + ‖∑ i, x i‖ ^ 2 = ∑ i, ‖x i‖ ^ 2 := by + classical + rw [norm_sq_eq_re_inner (𝕜 := ℂ), sum_inner] + have hs (i : ι) : inner ℂ (x i) (∑ j, x j) = inner ℂ (x i) (x i) := by + rw [inner_sum] + exact Finset.sum_eq_single i (fun j _ hji => h i j (Ne.symm hji)) (by simp) + simp_rw [hs] + simp only [map_sum, ← norm_sq_eq_re_inner (𝕜 := ℂ)] + +namespace FreeTensor + +variable {B N A : Type} [DecidableEq B] [DecidableEq N] [AddCommGroup A] + [Fintype A] [DecidableEq A] + +abbrev groupUnitary (a : A) : Space B N (Multiplicative A) →L[ℂ] Space B N (Multiplicative A) := + unitaryG (Multiplicative.ofAdd a) + +omit [Fintype A] in +@[simp] theorem groupUnitary_zero : groupUnitary (B := B) (N := N) (0 : A) = 1 := + unitaryG_one + +omit [Fintype A] in + theorem groupUnitary_add (a b : A) : + groupUnitary (B := B) (N := N) (a + b) = groupUnitary a * groupUnitary b := + unitaryG_mul _ _ + +omit [Fintype A] in +@[simp] theorem star_groupUnitary (a : A) : + star (groupUnitary (B := B) (N := N) a) = groupUnitary (-a) := star_unitaryG _ + +def characterProjection (ψ : AddChar A ℂ) : + Space B N (Multiplicative A) →L[ℂ] Space B N (Multiplicative A) := + (Fintype.card A : ℂ)⁻¹ • ∑ a : A, ψ (-a) • groupUnitary a + + theorem groupUnitary_mul_characterProjection (a : A) (ψ : AddChar A ℂ) : + groupUnitary (B := B) (N := N) a * characterProjection ψ = ψ a • characterProjection ψ := by + unfold characterProjection + rw [mul_smul_comm, Finset.mul_sum, smul_comm (ψ a)] + congr 1 + rw [Finset.smul_sum] + apply Fintype.sum_equiv (Equiv.addLeft a) + intro b + rw [mul_smul_comm] + change ψ (-b) • (groupUnitary (B := B) (N := N) a * groupUnitary b) = + ψ a • (ψ (-(a + b)) • groupUnitary (a + b)) + simp only [← groupUnitary_add, smul_smul] + congr 1 + rw [neg_add, AddChar.map_add_eq_mul, ← mul_assoc, ← AddChar.map_add_eq_mul, add_neg_cancel] + simp + + theorem characterProjection_mul (ψ φ : AddChar A ℂ) : + characterProjection (B := B) (N := N) ψ * characterProjection φ = + if ψ = φ then characterProjection ψ else 0 := by + classical + rw [characterProjection, smul_mul_assoc, Finset.sum_mul] + simp only [smul_mul_assoc, groupUnitary_mul_characterProjection, smul_smul, + ← Finset.sum_smul] + have hs : (∑ a : A, ψ (-a) * φ a) = if ψ = φ then (Fintype.card A : ℂ) else 0 := by + have he (a : A) : ψ (-a) * φ a = (-ψ + φ) a := by + simp [AddChar.add_apply, AddChar.neg_apply, AddChar.map_neg_eq_inv] + simp_rw [he] + rw [AddChar.sum_eq_ite] + congr 1 + exact propext neg_add_eq_zero + rw [hs] + by_cases h : ψ = φ + · subst φ + simp [Fintype.card_ne_zero, characterProjection] + · simp only [h, ↓reduceIte, mul_zero, + zero_smul ℂ (characterProjection (B := B) (N := N) φ)] + +@[simp] theorem star_characterProjection (ψ : AddChar A ℂ) : + star (characterProjection (B := B) (N := N) ψ) = characterProjection ψ := by + unfold characterProjection + simp only [star_smul, star_inv₀, star_natCast, + star_sum (R := Space B N (Multiplicative A) →L[ℂ] Space B N (Multiplicative A)), + star_groupUnitary] + congr 1 + apply Fintype.sum_equiv (Equiv.neg A) + intro a + simp only [Equiv.neg_apply, neg_neg] + congr 1 + rw [AddChar.map_neg_eq_inv, AddChar.inv_apply_eq_conj] + simp + + theorem sum_characterProjection : + ∑ ψ : AddChar A ℂ, characterProjection (B := B) (N := N) ψ = 1 := by + classical + unfold characterProjection + rw [← Finset.smul_sum, Finset.sum_comm] + simp only [← Finset.sum_smul, AddChar.sum_apply_eq_ite, neg_eq_zero] + simp [smul_smul, Fintype.card_ne_zero] + + theorem characterProjection_mem (ψ : AddChar A ℂ) : + characterProjection (B := B) (N := N) ψ ∈ algebra B N (Multiplicative A) := by + apply (algebra B N (Multiplicative A)).smul_mem + apply (algebra B N (Multiplicative A)).sum_mem + intro a _ + exact (algebra B N (Multiplicative A)).smul_mem (unitaryG_mem _) _ + +omit [Fintype A] in + theorem trace_groupUnitary (a : A) : + trace (tracialVector B N (Multiplicative A)) (groupUnitary a) = if a = 0 then 1 else 0 := by + rw [trace_unitaryG] + rfl + + theorem trace_characterProjection (ψ : AddChar A ℂ) : + trace (tracialVector B N (Multiplicative A)) (characterProjection ψ) = + (Fintype.card A : ℂ)⁻¹ := by + rw [characterProjection, trace_smul, trace_sum] + simp [trace_smul, trace_groupUnitary] + +def spectralSignal (y : AddChar A ℂ → ℝ) : + Space B N (Multiplicative A) →L[ℂ] Space B N (Multiplicative A) := + ∑ ψ, (y ψ : ℂ) • characterProjection ψ + + theorem spectralSignal_selfAdjoint (y : AddChar A ℂ → ℝ) : + IsSelfAdjoint (spectralSignal (B := B) (N := N) y) := by + show star _ = _ + simp [spectralSignal, + star_sum (R := Space B N (Multiplicative A) →L[ℂ] Space B N (Multiplicative A))] + + theorem spectralSignal_mem (y : AddChar A ℂ → ℝ) : + spectralSignal (B := B) (N := N) y ∈ algebra B N (Multiplicative A) := by + apply (algebra B N (Multiplicative A)).sum_mem + intro ψ _ + exact (algebra B N (Multiplicative A)).smul_mem (characterProjection_mem ψ) _ + + theorem spectralSignal_pow (y : AddChar A ℂ → ℝ) (k : ℕ) : + spectralSignal (B := B) (N := N) y ^ k = ∑ ψ, ((y ψ : ℂ) ^ k) • characterProjection ψ := by + classical + induction k with + | zero => simpa using (sum_characterProjection (B := B) (N := N) (A := A)).symm + | succ k ih => + rw [pow_succ, ih, spectralSignal, Finset.sum_mul] + apply Finset.sum_congr rfl + intro ψ _ + rw [smul_mul_assoc, Finset.mul_sum] + simp only [mul_smul_comm, characterProjection_mul] + simp only [smul_ite, smul_zero (M := ℂ) (A := Space B N (Multiplicative A) →L[ℂ] Space B N (Multiplicative A)), + Finset.sum_ite_eq, Finset.mem_univ, + ↓reduceIte, smul_smul, pow_succ] + + theorem trace_spectralSignal_pow (y : AddChar A ℂ → ℝ) (k : ℕ) : + trace (tracialVector B N (Multiplicative A)) (spectralSignal y ^ k) = + (Fintype.card A : ℂ)⁻¹ * ∑ ψ, (y ψ : ℂ) ^ k := by + rw [spectralSignal_pow, trace_sum] + simp only [trace_smul, trace_characterProjection, ← Finset.sum_mul] + exact mul_comm _ _ + + theorem characterProjection_orthogonal (ψ φ : AddChar A ℂ) (h : ψ ≠ φ) + (v w : Space B N (Multiplicative A)) : + inner ℂ (characterProjection ψ v) (characterProjection φ w) = 0 := by + rw [← ContinuousLinearMap.adjoint_inner_left, ← ContinuousLinearMap.star_eq_adjoint, + star_characterProjection, ← mul_apply_eq_comp, characterProjection_mul, ite_eq_right (Ne.symm h)] + simp + + theorem spectralSignal_norm_le (y : AddChar A ℂ → ℝ) (R : ℝ) (hR : 0 ≤ R) + (hy : ∀ ψ, |y ψ| ≤ R) : ‖spectralSignal (B := B) (N := N) y‖ ≤ R := by + classical + apply ContinuousLinearMap.opNorm_le_bound _ hR + intro x + have hx : ∑ ψ : AddChar A ℂ, characterProjection ψ x = x := by + simpa only [sum_apply, one_apply_eq_self] using + congrArg (fun T : Space B N (Multiplicative A) →L[ℂ] Space B N (Multiplicative A) => T x) + (sum_characterProjection (B := B) (N := N) (A := A)) + have hn : ∑ ψ : AddChar A ℂ, ‖characterProjection ψ x‖ ^ 2 = ‖x‖ ^ 2 := by + rw [← norm_sum_sq_orthogonal _ (fun ψ φ h => characterProjection_orthogonal ψ φ h x x), hx] + have hn' : ‖spectralSignal (B := B) (N := N) y x‖ ^ 2 = + ∑ ψ : AddChar A ℂ, |y ψ| ^ 2 * ‖characterProjection ψ x‖ ^ 2 := by + simp only [spectralSignal, sum_apply, smul_apply] + rw [norm_sum_sq_orthogonal _ (by + intro ψ φ h + simp [characterProjection_orthogonal ψ φ h x x])] + simp only [norm_smul, Complex.norm_real, Real.norm_eq_abs, mul_pow] + have hsq : ‖spectralSignal (B := B) (N := N) y x‖ ^ 2 ≤ R ^ 2 * ‖x‖ ^ 2 := by + rw [hn', ← hn, Finset.mul_sum] + apply Finset.sum_le_sum + intro ψ _ + apply mul_le_mul_of_nonneg_right _ (sq_nonneg _) + exact pow_le_pow_left₀ (abs_nonneg _) (hy ψ) 2 + apply (sq_le_sq₀ (norm_nonneg _) (mul_nonneg hR (norm_nonneg x))).mp + simpa only [mul_pow] using hsq + +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/SignalCovariance.lean b/lean/OAI/Analysis/FreeEntropy/SignalCovariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ebe030c125888a8f9d33b90779acd687409adc8 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/SignalCovariance.lean @@ -0,0 +1,122 @@ +import OAI.Analysis.FreeEntropy.TwoNoiseFisher + +namespace OAI + +noncomputable section +open scoped ComplexConjugate +namespace FiniteEntropySeparation +open Finset FreeSeries +namespace FreeSeries +variable {α : Type} [DecidableEq α] + +omit [DecidableEq α] in +theorem cumulants_one [DecidableEq α] (M : Series α) (hM : M [] = 1) (i : α) : + cumulants M [i] = M [i] := by + have he := congrFun (cumulants_equation hM) [i] + simpa [subst_cons, hM, conv_nil] using he.symm + theorem cumulants_two (M : Series α) (hM : M [] = 1) (i j : α) : + cumulants M [i,j] = M [i,j] - M [i] * M [j] := by + have he := congrFun (cumulants_equation hM) [i,j] + simp only [Pi.add_apply, unit_cons, zero_add, subst_cons, conv_cons, hM, one_mul, + subst_nil, conv_nil, FreeSeries.deriv_apply] at he + rw [cumulants_one M hM i] at he + linear_combination -he + theorem residual_short {R : Series α} {v : α → ℝ} + (hc : ∀ i, R [i] = 0) (hv : ∀ i j, R [i,j] = if j=i then (v i : ℂ) else 0) + (i : α) (w : List α) (hw : w.length < 2) : residual R v i w = 0 := by + cases w with + | nil => simp [residual, hc] + | cons j w => + have : w = [] := List.length_eq_zero_iff.mp (by simp only [List.length_cons] at hw; omega) + subst w + simp [residual, hv, letter] + theorem residual_long (R : Series α) (v : α → ℝ) (i : α) (w : List α) (hw : 2 ≤ w.length) : + residual R v i w = R (i::w) := by + cases w with + | nil => simp at hw + | cons j w => + cases w with + | nil => simp at hw + | cons k w => simp [residual, letter] +end FreeSeries +namespace Model +open FreeTensor +variable (p : ℕ) [NeZero p] +def variance (i : Fin (p+1)) : ℝ := ‖C p i (τ p).vacuum‖ ^ 2 + theorem variance_nonneg (i : Fin (p+1)) : 0 ≤ variance p i := sq_nonneg _ + +omit [NeZero p] in +theorem fockMoments_one [NeZero p] (i : Fin p) : fockMoments p [i] = 0 := by + have he := congrFun (fockMoments_eq p) [i] + simpa [subst_cons, conv_nil, quadratic] using he + +omit [NeZero p] in +theorem fockMoments_two [NeZero p] (i j : Fin p) : fockMoments p [i,j] = if j=i then 1 else 0 := by + have he := congrFun (fockMoments_eq p) [i,j] + simp only [Pi.add_apply, unit_cons, zero_add, subst_cons, conv_cons, subst_nil, conv_nil, + FreeSeries.deriv_apply, quadratic] at he + simpa [fockMoments] using he + theorem C_centered (hp : 2 ≤ p) (i : Fin (p+1)) : signalMoments p [i] = 0 := by + induction i using Fin.lastCases with + | last => + simpa [signalMoments, wordMoment, wordEval] using + (trace_equidiscreteSignal (B := Fin p) (N := Fin ((p+1)+(p+1))) p hp) + | cast i => + have he := signal_option_moments p [some i] + simpa [fockMoments_one] using he + theorem C_offDiagonal (i j : Fin (p+1)) (hij : j ≠ i) : signalMoments p [i,j] = 0 := by + induction i using Fin.lastCases with + | last => + induction j using Fin.lastCases with + | last => exact (hij rfl).elim + | cast j => + have he := signal_option_moments p [none, some j] + simpa [fockMoments_one] using he + | cast i => + induction j using Fin.lastCases with + | last => + have he := signal_option_moments p [some i, none] + simpa [fockMoments_one] using he + | cast j => + have hj : j ≠ i := fun h => hij (congrArg Fin.castSucc h) + have he := signal_option_moments p [some i, some j] + simpa [fockMoments_two, hj] using he + theorem C_covariance (i j : Fin (p+1)) : + signalMoments p [i,j] = if j=i then (variance p i : ℂ) else 0 := by + by_cases hj : j=i + · subst j + rw [ite_eq_left rfl] + have he := inner_selfAdjoint_word (τ p) (C p) (C_selfAdjoint p) i [i] + simpa [signalMoments, wordEval, variance, inner_self_eq_norm_sq_to_K] using he.symm + · rw [ite_eq_right hj]; exact C_offDiagonal p i j hj + theorem signalCumulants_centered (hp : 2 ≤ p) (i : Fin (p+1)) : + cumulants (signalMoments p) [i] = 0 := by + rw [cumulants_one _ (by simp [signalMoments]), C_centered p hp] + theorem signalCumulants_covariance (hp : 2 ≤ p) (i j : Fin (p+1)) : + cumulants (signalMoments p) [i,j] = if j=i then (variance p i : ℂ) else 0 := by + rw [cumulants_two _ (by simp [signalMoments]), C_centered p hp, zero_mul, sub_zero, C_covariance] + theorem variance_last_le_one (hp : 2 ≤ p) : variance p (Fin.last p) ≤ 1 := by + have he := (C p (Fin.last p)).le_opNorm (τ p).vacuum + rw [(τ p).norm_vacuum, mul_one, C_last] at he + have hn := equidiscreteSignal_norm_le (B := Fin p) (N := Fin ((p+1)+(p+1))) p hp + unfold variance + rw [C_last] + nlinarith [norm_nonneg (equidiscreteSignal p (τ p).vacuum)] + theorem variance_castSucc (i : Fin p) : variance p i.castSucc = 1 := by + have he := C_covariance p i.castSucc i.castSucc + have ht := signal_option_moments p [some i,some i] + simp only [List.map_cons, List.map_nil, optionFin_some, List.filterMap_cons, List.filterMap_nil, + id_eq, fockMoments_two, ite_true] at ht + simp at ht + rw [ite_eq_left rfl, ht] at he + exact_mod_cast he.symm + theorem variance_le_one (hp : 2 ≤ p) (i : Fin (p+1)) : variance p i ≤ 1 := by + induction i using Fin.lastCases with + | last => exact variance_last_le_one p hp + | cast i => rw [variance_castSucc] +end Model +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/SignalSeries.lean b/lean/OAI/Analysis/FreeEntropy/SignalSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d969bfcc04e7f39cc212ac7858602de93d96fc4 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/SignalSeries.lean @@ -0,0 +1,99 @@ +import OAI.Analysis.FreeEntropy.CumulantBound + +namespace OAI + +noncomputable section +namespace FiniteEntropySeparation +open Finset FreeSeries + +section Product +variable {α A : Type} [DecidableEq α] [Monoid A] +def optionTuple (B : α → A) (Y : A) : Option α → A + | none => Y + | some i => B i + theorem option_word_product (B : α → A) (Y : A) (h : ∀ i, Commute Y (B i)) (w : List (Option α)) : + (w.map (optionTuple B Y)).prod = ((w.filterMap id).map B).prod * Y^(w.count none) := by + induction w with + | nil => simp + | cons a w ih => + cases a with + | none => + simp only [List.map_cons, List.prod_cons, optionTuple, List.filterMap_cons, id_eq, ih] + have hc := Commute.list_prod_right ((w.filterMap id).map B) Y (by + intro x hx + obtain ⟨i,hi,rfl⟩ := List.mem_map.mp hx + exact h i) + simp only [List.count_cons_self] + change Y * (((w.filterMap id).map B).prod * Y ^ w.count none) = _ + rw [← mul_assoc, hc.eq, mul_assoc, pow_succ'] + rfl + | some i => simp [optionTuple, ih, mul_assoc] +end Product + +section TraceNorm +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + theorem norm_trace_le_opNorm {M : VonNeumannAlgebra H} (τ : TracialVector M) (A : H →L[ℂ] H) : + ‖trace τ A‖ ≤ ‖A‖ := by + apply (norm_inner_le_norm _ _).trans + simpa only [τ.norm_vacuum, one_mul, mul_one] using A.le_opNorm τ.vacuum +end TraceNorm + +namespace Model +open FreeTensor +variable (p : ℕ) [NeZero p] +def signalMoments : Series (Fin (p+1)) := wordMoment (τ p) (C p) + theorem signal_option_product (w : List (Option (Fin p))) : + wordEval (C p) (w.map (optionFin p)) = + ((w.filterMap id).map (semicircularB (N := Fin ((p+1)+(p+1))) (G := Multiplicative (ZMod p)))).prod * + equidiscreteSignal p ^ (w.count none) := by + unfold wordEval + rw [List.map_map] + have hf : (fun a => C p (optionFin p a)) = optionTuple semicircularB (equidiscreteSignal p) := by + funext a + cases a <;> simp [optionTuple] + change (w.map (fun a => C p (optionFin p a))).prod = _ + rw [hf] + exact option_word_product _ _ (equidiscreteSignal_commutes_B p) w + theorem signal_option_moments (w : List (Option (Fin p))) : + signalMoments p (w.map (optionFin p)) = fockMoments p (w.filterMap id) * + trace (τ p) (equidiscreteSignal p ^ (w.count none)) := by + unfold signalMoments wordMoment + rw [signal_option_product, tensor_equidiscrete_moment, equidiscreteSignal_moments] + rfl + theorem signal_option_coeff_norm_le (hp : 2 ≤ p) (w : List (Option (Fin p))) : + ‖signalMoments p (w.map (optionFin p))‖ ≤ ‖ignoreLetter (fockMoments p) w‖ := by + rw [signal_option_moments, norm_mul] + change _ ≤ ‖fockMoments p (w.filterMap id)‖ + let : Nontrivial (H p) := ⟨⟨basis empty, 0, by + intro h + have he := congrArg (fun f : H p => f empty) h + simp [basis, lp.single_apply] at he⟩⟩ + have hy : ‖trace (τ p) (equidiscreteSignal p ^ (w.count none))‖ ≤ 1 := by + apply (norm_trace_le_opNorm _ _).trans + apply (norm_pow_le _ _).trans + exact (pow_le_pow_left₀ (norm_nonneg _) (equidiscreteSignal_norm_le p hp) _).trans_eq (one_pow _) + exact (mul_le_mul_of_nonneg_left hy (norm_nonneg _)).trans_eq (mul_one _) + theorem signalMoments_norm_le (hp : 2 ≤ p) (n : ℕ) : + degreeNorm (signalMoments p) n ≤ (4*Real.sqrt (Real.sqrt p))^n := by + rw [← degreeNorm_equiv (optionFin p) (signalMoments p) n] + apply (degreeNorm_le_of_coeff (fun w _ => signal_option_coeff_norm_le p hp w)).trans + apply (ignoreLetter_norm_le (by positivity) (fockMoments_norm_le (by omega)) n).trans + have hp1 : (1:ℝ) ≤ p := by exact_mod_cast (show 1 ≤ p by omega) + have hq1 : (1:ℝ) ≤ Real.sqrt (Real.sqrt p) := by + exact Real.one_le_sqrt.mpr (Real.one_le_sqrt.mpr hp1) + exact pow_le_pow_left₀ (by positivity) (by linarith) _ + theorem signalCumulants_norm_le (hp : 2 ≤ p) (n : ℕ) : + degreeNorm (cumulants (signalMoments p)) n ≤ (128*Real.sqrt (Real.sqrt p))^n := by + have hM : signalMoments p [] = 1 := by simp [signalMoments] + have hA : 0 < 4*Real.sqrt (Real.sqrt (p:ℝ)) := by + have hp' : (0:ℝ) < p := by exact_mod_cast (show 0 < p by omega) + positivity + have hh := cumulants_norm_le hM hA (fun m _ => signalMoments_norm_le p hp m) n + norm_num [← mul_assoc] at hh + exact hh +end Model +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/SpectralBlockMask.lean b/lean/OAI/Analysis/FreeEntropy/SpectralBlockMask.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3947d36138ab5bf118663b479de7a8e9bec47a7 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/SpectralBlockMask.lean @@ -0,0 +1,62 @@ +import OAI.Analysis.FreeEntropy.MatrixHilbertSchmidt + +namespace OAI + +noncomputable section +open Finset MeasureTheory ProbabilityTheory +namespace FiniteEntropySeparation +variable {p d : ℕ} + def blockMask (f : Fin d → Fin p) : Finset (Fin (p+1) × Fin d × Fin d) := + univ.filter (fun q => q.1.val

f j=l)).card≤2*d + theorem blockMask_card (f : Fin d → Fin p) : + (blockMask f).card = p*∑j : Fin d,(univ.filter (fun k => f k=f j)).card := by + classical + rw [blockMask,card_filter] + simp only [Fintype.sum_prod_type] + rw [Fin.sum_univ_castSucc] + simp only [Fin.val_last,lt_self_iff_false,false_and,ite_false,sum_const_zero,add_zero, + Fin.val_castSucc,Fin.is_lt,true_and] + have he : (∑j : Fin d,∑k : Fin d,if f j=f k then 1 else 0)= + ∑j : Fin d,(univ.filter (fun k => f k=f j)).card := by + apply sum_congr rfl + intro j _ + simp only [card_filter,eq_comm] + simp only [he,sum_const,card_univ,Fintype.card_fin,nsmul_eq_mul,Nat.cast_id] + theorem blockMask_card_le (f : Fin d → Fin p) (hf : balancedBlocks f) : + (blockMask f).card≤2*d^2 := by + rw [blockMask_card,mul_sum] + calc + _ ≤ ∑j : Fin d,2*d := sum_le_sum (fun j _ => hf (f j)) + _ = _ := by simp; ring + theorem blockMask_matrixEnergy (f : Fin d → Fin p) (a : MatrixCoordinates (p+1) d) : + ‖coordinateMask (blockMask f) a‖^2 = + ∑i : Fin p,∑j : Fin d,∑k : Fin d,if f j=f k then Complex.normSq (hermitianMatrix a i.castSucc j k) else 0 := by + classical + rw [coordinateMask_sq,blockMask,sum_filter] + simp only [Fintype.sum_prod_type] + rw [Fin.sum_univ_castSucc] + simp only [Fin.val_last,lt_self_iff_false,false_and,ite_false,sum_const_zero,add_zero, + Fin.val_castSucc,Fin.is_lt,true_and] + apply sum_congr rfl + intro i _ + simp_rw [hermitianMatrix_normSq] + have he : (∑j : Fin d,∑k : Fin d,if f j=f k then a (i.castSucc,k,j)^2 else 0)= + ∑j : Fin d,∑k : Fin d,if f j=f k then a (i.castSucc,j,k)^2 else 0 := by + rw [sum_comm] + congr 1 + funext k + apply sum_congr rfl + intro j _ + simp only [eq_comm] + have hp (j k : Fin d) : (if f j=f k then (a (i.castSucc,j,k)^2+a (i.castSucc,k,j)^2)/2 else 0) = + ((if f j=f k then a (i.castSucc,j,k)^2 else 0)+(if f j=f k then a (i.castSucc,k,j)^2 else 0))/2 := by split_ifs <;> ring + conv_rhs => simp only [hp,← sum_div,sum_add_distrib] + rw [he] + ring +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/SpectralClustering.lean b/lean/OAI/Analysis/FreeEntropy/SpectralClustering.lean new file mode 100644 index 0000000000000000000000000000000000000000..f4b1057f64bd6920edab1db9047d95d8c0162754 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/SpectralClustering.lean @@ -0,0 +1,85 @@ +import OAI.Analysis.FreeEntropy.MatrixSpectralMoments + +namespace OAI + +noncomputable section +open Finset +namespace FiniteEntropySeparation +variable {p d : ℕ} + def badSpectrum (y : Fin p → ℝ) (δ : ℝ) (x : Fin d → ℝ) : Finset (Fin d) := + univ.filter (fun j => ∀l,δ < |x j-y l|) + def clusterLabel [NeZero p] (y : Fin p → ℝ) (δ : ℝ) (x : Fin d → ℝ) (j : Fin d) : Fin p := + if h : ∃l,|x j-y l|≤δ then h.choose else 0 + theorem clusterLabel_close [NeZero p] (y : Fin p → ℝ) (δ : ℝ) (x : Fin d → ℝ) (j : Fin d) + (hj : j∉badSpectrum y δ x) : |x j-y (clusterLabel y δ x j)|≤δ := by + have he : ∃l,|x j-y l|≤δ := by simpa [badSpectrum,not_forall,not_lt] using hj + simp only [clusterLabel,dite_eq_left he] + exact he.choose_spec + theorem clusterLabel_separated [NeZero p] (y : Fin p → ℝ) (δ Δ : ℝ) (x : Fin d → ℝ) + (hy : ∀i j,i≠j → Δ≤|y i-y j|) (hδ : δ≤Δ/4) + {j k : Fin d} (hj : j∉badSpectrum y δ x) (hk : k∉badSpectrum y δ x) + (hjk : clusterLabel y δ x j≠clusterLabel y δ x k) : Δ/2≤|x j-x k| := by + have hj' := clusterLabel_close y δ x j hj + have hk' := clusterLabel_close y δ x k hk + have hy' := hy _ _ hjk + have ht : |y (clusterLabel y δ x j)-y (clusterLabel y δ x k)|≤ + |x j-y (clusterLabel y δ x j)|+|x j-x k|+|x k-y (clusterLabel y δ x k)| := by + calc + _ = |-(x j-y (clusterLabel y δ x j))+(x j-x k)+(x k-y (clusterLabel y δ x k))| := by congr 1; ring + _ ≤ |-(x j-y (clusterLabel y δ x j))|+|x j-x k|+|x k-y (clusterLabel y δ x k)| := + (abs_add_le _ _).trans (add_le_add (abs_add_le _ _) le_rfl) + _ = _ := by rw [abs_neg] + linarith + theorem badSpectrum_product_bound (y : Fin p → ℝ) {δ : ℝ} (hδ : 0≤δ) (x : Fin d → ℝ) : + ((badSpectrum y δ x).card:ℝ)*δ^(2*p) ≤ ∑j : Fin d,(∏l : Fin p,(x j-y l))^2 := by + have hb j (hj : j∈badSpectrum y δ x) : δ^(2*p)≤(∏l : Fin p,(x j-y l))^2 := by + have hh : δ^p≤|∏l : Fin p,(x j-y l)| := by + rw [abs_prod] + have hp := prod_le_prod₀ (fun _ (_ : _∈(univ:Finset (Fin p))) => hδ) + (fun l (_ : l∈(univ:Finset (Fin p))) => ((mem_filter.mp hj).2 l).le) + simpa using hp + have := pow_le_pow_left₀ (pow_nonneg hδ p) hh 2 + simpa [← pow_mul,sq_abs,Nat.mul_comm] using this + calc + _ = ∑j∈badSpectrum y δ x,δ^(2*p) := by simp + _ ≤ ∑j∈badSpectrum y δ x,(∏l : Fin p,(x j-y l))^2 := sum_le_sum hb + _ ≤ _ := sum_le_sum_of_subset_of_nonneg (subset_univ _) (fun _ _ _ => sq_nonneg _) + theorem clusterLabel_rank_bound [NeZero p] (y : Fin p → ℝ) (δ : ℝ) (x : Fin d → ℝ) + (q : Fin p → ℝ → ℝ) + (hq : ∀l r,|r-y l|≤δ → (3:ℝ)/4≤q l r^2) + (hm : ∀l,(∑j : Fin d,q l (x j)^2)≤9*(d:ℝ)/(8*p)) + (hb : ((badSpectrum y δ x).card:ℝ)≤(d:ℝ)/(2*p)) (l : Fin p) : + (p:ℝ)*((univ.filter (fun j => clusterLabel y δ x j=l)).card:ℝ)≤2*d := by + classical + have hp : (0:ℝ)

clusterLabel y δ x j=l) + let B := badSpectrum y δ x + have hgood : ((S\B).card:ℝ)*(3/4:ℝ)≤∑j : Fin d,q l (x j)^2 := by + calc + _ = ∑j∈S\B,(3/4:ℝ) := by simp + _ ≤ ∑j∈S\B,q l (x j)^2 := by + apply sum_le_sum + intro j hj + have he : clusterLabel y δ x j=l := (mem_filter.mp (mem_sdiff.mp hj).1).2 + have hh := clusterLabel_close y δ x j (mem_sdiff.mp hj).2 + rw [he] at hh + exact hq l (x j) hh + _ ≤ _ := sum_le_sum_of_subset_of_nonneg (subset_univ _) (fun _ _ _ => sq_nonneg _) + have hcard : (S.card:ℝ)≤((S\B).card:ℝ)+(B.card:ℝ) := by + exact_mod_cast (card_le_card (show S⊆(S\B)∪B by intro j hj; by_cases h:j∈B <;> simp [hj,h])).trans (card_union_le _ _) + have hgood' := hgood.trans (hm l) + have hbad : (p:ℝ)*(B.card:ℝ)≤(d:ℝ)/2 := by + dsimp [B] + have hh := (le_div_iff₀ (by positivity : (0:ℝ)<2*p)).mp hb + nlinarith + have hgood'' : (p:ℝ)*((S\B).card:ℝ)≤3*(d:ℝ)/2 := by + have hh := (le_div_iff₀ (by positivity : (0:ℝ)<8*p)).mp hgood' + nlinarith + have hh := mul_le_mul_of_nonneg_left hcard hp.le + change (p:ℝ)*(S.card:ℝ)≤2*d + nlinarith +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/SpectralMatrixProducer.lean b/lean/OAI/Analysis/FreeEntropy/SpectralMatrixProducer.lean new file mode 100644 index 0000000000000000000000000000000000000000..7952bf7004c1a90ee3ad1e79ca81db36da491232 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/SpectralMatrixProducer.lean @@ -0,0 +1,93 @@ +import OAI.Analysis.FreeEntropy.SpectralParameters + +namespace OAI + +noncomputable section +open Finset +open scoped ComplexConjugate +namespace FiniteEntropySeparation +variable {p d : ℕ} [NeZero p] + theorem spectralGood_blocks (hd : 0 (x j:ℂ)) := diagonal_eigenvalues a _ + have hm (l : Fin p) : (∑j : Fin d,((spectralBasis p l).eval (x j))^2)≤9*(d:ℝ)/(8*p) := by + have hh := ha.2.1 l + rw [univariateMoment_matrix] at hh + simp only [Polynomial.eval_pow] at hh + have hh' := mul_lt_mul_of_pos_left hh hd' + rw [← mul_assoc,mul_inv_cancel₀ (ne_of_gt hd'),one_mul] at hh' + exact hh'.le.trans_eq (by ring) + have hb : ((badSpectrum y δ x).card:ℝ)≤badFraction p*d := by + have hh := ha.2.2 + rw [univariateMoment_matrix] at hh + simp only [Polynomial.eval_pow,spectralAnnihilator_eval] at hh + have hh' := mul_lt_mul_of_pos_left hh hd' + rw [← mul_assoc,mul_inv_cancel₀ (ne_of_gt hd'),one_mul] at hh' + have hb' := (badSpectrum_product_bound y hδ.le x).trans hh'.le + have he : (d:ℝ)*(badFraction p*δ^(2*p))=(badFraction p*d)*δ^(2*p) := by ring + rw [he] at hb' + exact (mul_le_mul_iff_left₀ (pow_pos hδ _)).mp hb' + have hb1 : ((badSpectrum y δ x).card:ℝ)≤(d:ℝ)/(2*p) := by + apply hb.trans + have hh := mul_le_mul_of_nonneg_right (min_le_right (1/4096:ℝ) (1/(2*p))) hd'.le + simpa [badFraction,mul_comm,div_eq_mul_inv] using hh + have hb2 : ((badSpectrum y δ x).card:ℝ)≤(d:ℝ)/4096 := by + apply hb.trans + have hh := mul_le_mul_of_nonneg_right (min_le_left (1/4096:ℝ) (1/(2*p))) hd'.le + simpa [badFraction,mul_comm,div_eq_mul_inv] using hh + have hf : balancedBlocks f := by + intro l + have hh := clusterLabel_rank_bound y δ x (fun l r => (spectralBasis p l).eval r) hq hm hb1 l + exact_mod_cast hh + refine ⟨f,hf,U,?_⟩ + rw [blockMask_matrixEnergy] + have henergy (i : Fin p) : (d:ℝ)/2≤∑j : Fin d,∑k : Fin d,if f j=f k then Complex.normSq (hermitianMatrix b i.castSucc j k) else 0 := by + let A := hermitianMatrix b i.castSucc + have hA : A.IsHermitian := hermitianMatrix_isHermitian b i.castSucc + have hsecond : 3*(d:ℝ)/4≤hsNorm A^2 := by + have hh := (ha.1 i).1 + rw [← matrixMoment_rotate U a, matrixMoment_second_hs] at hh + have hh' := mul_lt_mul_of_pos_left hh hd' + rw [← mul_assoc,mul_inv_cancel₀ (ne_of_gt hd'),one_mul] at hh' + exact le_of_lt (by convert hh' using 1 ; ring) + have hfour : (Matrix.trace (A^4)).re≤4*(d:ℝ) := by + have hh := (ha.1 i).2.1 + rw [← matrixMoment_rotate U a,matrixMoment_fourth_trace] at hh + have hh' := mul_lt_mul_of_pos_left hh hd' + rw [← mul_assoc,mul_inv_cancel₀ (ne_of_gt hd'),one_mul] at hh' + exact hh'.le.trans_eq (by ring) + have hc : (∑j : Fin d,∑k : Fin d,(x j-x k)^2*Complex.normSq (A j k))≤Δ^2*d/64 := by + have hh := (ha.1 i).2.2 + have he : commutatorMoment (matrixMoment b) i.castSucc (Fin.last p)=commutatorMoment (matrixMoment a) i.castSucc (Fin.last p) := by + unfold commutatorMoment + simp only [b,matrixMoment_rotate] + rw [← he,commutatorMoment_matrix,hdiag,hsNorm_sq] at hh + simp only [commutator_diagonal_entry] at hh + have hh' := mul_lt_mul_of_pos_left hh hd' + rw [← mul_assoc,mul_inv_cancel₀ (ne_of_gt hd'),one_mul] at hh' + exact hh'.le.trans_eq (by ring) + apply clustered_energy_lower y δ Δ x hsep hδΔ hΔ (fun j k => Complex.normSq (A j k)) + (fun j k => Complex.normSq_nonneg _) (hermitian_entry_symmetric A hA) + · simpa only [hsNorm_sq] using hsecond + · exact (hermitian_row_fourth A hA).trans hfour + · exact hc + · exact hb2 + have hh := sum_le_sum (fun i (_ : i∈(univ:Finset (Fin p))) => henergy i) + simpa only [sum_const,card_univ,Fintype.card_fin,nsmul_eq_mul,mul_div_assoc] using hh +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/SpectralParameters.lean b/lean/OAI/Analysis/FreeEntropy/SpectralParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5f02794d890a8e4991ad04e96225666aa97ae4e --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/SpectralParameters.lean @@ -0,0 +1,109 @@ +import OAI.Analysis.FreeEntropy.SpectralTestFunctions + +namespace OAI + +noncomputable section +open Finset Filter Set +open scoped Topology +namespace FiniteEntropySeparation +variable {p : ℕ} + def spectralBasis (p : ℕ) (l : Fin p) : Polynomial ℝ := Lagrange.basis univ (equidiscreteAtom p) l + def spectralAnnihilator (p : ℕ) : Polynomial ℝ := ∏l : Fin p,(Polynomial.X-Polynomial.C (equidiscreteAtom p l)) + def badFraction (p : ℕ) : ℝ := min (1/4096:ℝ) (1/(2*p)) + theorem badFraction_pos [NeZero p] : 0 if ij.1=ij.2 then 1 else |equidiscreteAtom p ij.1-equidiscreteAtom p ij.2|) + have hΔ : 0<Δ := by + apply (lt_inf'_iff _).mpr + rintro ⟨i,j⟩ _ + dsimp + split_ifs with h + · norm_num + · exact abs_pos.mpr (sub_ne_zero.mpr (fun he => h (equidiscreteAtom_injective hp he))) + have hsep (i j : Fin p) (h : i≠j) : Δ≤|equidiscreteAtom p i-equidiscreteAtom p j| := by + have hh := inf'_le (s := (univ:Finset (Fin p×Fin p))) (f := fun ij : Fin p×Fin p => if ij.1=ij.2 then (1:ℝ) else |equidiscreteAtom p ij.1-equidiscreteAtom p ij.2|) (mem_univ (i,j)) + simpa only [ite_eq_right h] using hh + have hev : ∀ᶠs : ℝ in 𝓝 0,∀l : Fin p,(3:ℝ)/4<((spectralBasis p l).eval (equidiscreteAtom p l+s))^2 := by + rw [eventually_all] + intro l + have hc : Continuous (fun s : ℝ => ((spectralBasis p l).eval (equidiscreteAtom p l+s))^2) := by fun_prop + have hh : (3:ℝ)/4<((spectralBasis p l).eval (equidiscreteAtom p l+0))^2 := by norm_num [spectralBasis_eval hp] + exact (isOpen_lt continuous_const hc).mem_nhds hh + obtain ⟨ε,hε,he⟩ := Metric.mem_nhds_iff.mp hev + let δ := min (Δ/4) (ε/2) + refine ⟨δ,Δ,lt_min (by positivity) (by positivity),hΔ,min_le_left _ _,hsep,?_⟩ + intro l r hr + have hs : r-equidiscreteAtom p l ∈ Metric.ball 0 ε := by + rw [Metric.mem_ball,Real.dist_eq,sub_zero] + exact hr.trans_lt (lt_of_le_of_lt (min_le_right _ _) (by linarith)) + have hh := he hs l + convert hh.le using 1 ; congr 2 ; ring + def spectralGood (p : ℕ) (δ Δ : ℝ) (m : List (Fin (p+1)) → ℂ) : Prop := + (∀i : Fin p,(3:ℝ)/4<(m [i.castSucc,i.castSucc]).re ∧ + (m [i.castSucc,i.castSucc,i.castSucc,i.castSucc]).re<4 ∧ + commutatorMoment m i.castSucc (Fin.last p)<Δ^2/64) ∧ + (∀l : Fin p,univariateMoment m ((spectralBasis p l)^2) (Fin.last p)<9/(8*p)) ∧ + univariateMoment m ((spectralAnnihilator p)^2) (Fin.last p) isOpen_lt (univariateMoment_continuous _ _) continuous_const)).inter + (isOpen_lt (univariateMoment_continuous _ _) continuous_const) + theorem spectralGood_C [NeZero p] (hp : 2≤p) {δ Δ : ℝ} (hδ : 0<δ) (hΔ : 0<Δ) : + spectralGood p δ Δ (wordMoment (Model.τ p) (Model.C p)) := by + refine ⟨?_,?_,?_⟩ + · intro i + rw [Model.C_second,Model.C_fourth,Model.C_commutator] + refine ⟨by norm_num,by norm_num,by positivity⟩ + · intro l + rw [Model.C_univariateMoment] + simp only [Polynomial.eval_pow,spectralBasis_eval hp] + have he : (∑k : Fin p,(if l=k then (1:ℝ) else 0)^2)=1 := by simp [eq_comm] + rw [he,mul_one] + have hp' : (0:ℝ)

univariateMoment m q i) := by + unfold univariateMoment + fun_prop + theorem commutatorMoment_continuous (i j : Fin n) : Continuous (fun m : List (Fin n) → ℂ => commutatorMoment m i j) := by + unfold commutatorMoment + fun_prop + theorem univariateMoment_matrix (q : Polynomial ℝ) (a : MatrixCoordinates n d) (i : Fin n) : + univariateMoment (matrixMoment a) q i=(d:ℝ)⁻¹*∑j,q.eval ((hermitianMatrix_isHermitian a i).eigenvalues j) := + matrixUnivariateMoment_eigenvalues q a i + theorem commutatorMoment_matrix (a : MatrixCoordinates n d) (i j : Fin n) : + commutatorMoment (matrixMoment a) i j = (d:ℝ)⁻¹*hsNorm (hermitianMatrix a j*hermitianMatrix a i-hermitianMatrix a i*hermitianMatrix a j)^2 := by + let A := hermitianMatrix a i + let B := hermitianMatrix a j + have hA : A.conjTranspose=A := (hermitianMatrix_isHermitian a i).eq + have hB : B.conjTranspose=B := (hermitianMatrix_isHermitian a j).eq + rw [hsNorm_sq,← trace_conjTranspose_mul_re] + change _ = (d:ℝ)⁻¹*(Matrix.trace ((B*A-A*B).conjTranspose*(B*A-A*B))).re + simp only [Matrix.conjTranspose_sub,Matrix.conjTranspose_mul,hA,hB] + have he : (A*B-B*A)*(B*A-A*B)=A*B*B*A-A*B*A*B-B*A*B*A+B*A*A*B := by noncomm_ring + rw [he,Matrix.trace_add,Matrix.trace_sub,Matrix.trace_sub] + unfold commutatorMoment matrixMoment + simp only [List.map_cons,List.map_nil,List.prod_cons,List.prod_nil,mul_one] + change ((d:ℂ)⁻¹*Matrix.trace (A*(B*(B*A)))-(d:ℂ)⁻¹*Matrix.trace (A*(B*(A*B)))- + (d:ℂ)⁻¹*Matrix.trace (B*(A*(B*A)))+(d:ℂ)⁻¹*Matrix.trace (B*(A*(A*B)))).re = _ + simp only [← mul_add,← mul_sub,mul_assoc,← Complex.ofReal_natCast,← Complex.ofReal_inv, + Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,zero_mul,sub_zero] + theorem matrixMoment_second_hs (a : MatrixCoordinates n d) (i : Fin n) : + (matrixMoment a [i,i]).re=(d:ℝ)⁻¹*hsNorm (hermitianMatrix a i)^2 := by + rw [hsNorm_sq,← trace_conjTranspose_mul_re,(hermitianMatrix_isHermitian a i).eq] + simp [matrixMoment,← Complex.ofReal_natCast,← Complex.ofReal_inv] + theorem matrixMoment_fourth_trace (a : MatrixCoordinates n d) (i : Fin n) : + (matrixMoment a [i,i,i,i]).re=(d:ℝ)⁻¹*(Matrix.trace (hermitianMatrix a i^4)).re := by + have he := matrixMoment_replicate a i 4 + simp only [List.replicate_succ,List.replicate_zero] at he + rw [he] + simp [← Complex.ofReal_natCast,← Complex.ofReal_inv] + section Operators + variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {M : VonNeumannAlgebra H} (τ : TracialVector M) + theorem continuous_tuple_wordMoments : Continuous (fun X : Fin n → H →L[ℂ] H => wordMoment τ X) := by + apply continuous_pi + intro w + unfold wordMoment trace wordEval + fun_prop + theorem univariateMoment_word (X : Fin n → H →L[ℂ] H) (q : Polynomial ℝ) (i : Fin n) : + univariateMoment (wordMoment τ X) q i=∑k∈q.support,q.coeff k*(trace τ (X i^k)).re := by + simp [univariateMoment,wordMoment,wordEval] + theorem commutatorMoment_word_zero (X : Fin n → H →L[ℂ] H) (i j : Fin n) (hc : Commute (X i) (X j)) : + commutatorMoment (wordMoment τ X) i j=0 := by + have h1 : X i*(X j*(X j*X i))=X i*(X j*(X i*X j)) := by rw [hc.eq.symm] + have h2 : X j*(X i*(X j*X i))=X j*(X i*(X i*X j)) := by rw [hc.eq.symm] + simp only [commutatorMoment,wordMoment,wordEval,List.map_cons,List.map_nil,List.prod_cons,List.prod_nil,mul_one,h1,h2,sub_self,zero_sub,neg_add_cancel,Complex.zero_re] +end Operators +namespace Model +variable (p : ℕ) [NeZero p] + theorem continuous_X : Continuous (X p) := by + apply continuous_pi + intro i + unfold X heatTuple + fun_prop + theorem continuous_X_moments : Continuous (fun h : ℝ => wordMoment (τ p) (X p h)) := + (continuous_tuple_wordMoments (τ p)).comp (continuous_X p) + theorem X_zero : X p 0=C p := by ext i; simp [X,heatTuple] + theorem C_second (i : Fin p) : (wordMoment (τ p) (C p) [i.castSucc,i.castSucc]).re=1 := by + have he := FreeTensor.trace_semicircularB_pow (N := Fin ((p+1)+(p+1))) (G := Multiplicative (ZMod p)) i 2 + simpa [wordMoment,wordEval,pow_two,C_castSucc] using congrArg Complex.re he + theorem C_fourth (i : Fin p) : (wordMoment (τ p) (C p) [i.castSucc,i.castSucc,i.castSucc,i.castSucc]).re=2 := by + have he := FreeTensor.trace_semicircularB_pow (N := Fin ((p+1)+(p+1))) (G := Multiplicative (ZMod p)) i 4 + simpa [wordMoment,wordEval,pow_succ,mul_assoc,C_castSucc,catalan,show Even (4:ℕ) from ⟨2,by norm_num⟩] using congrArg Complex.re he + theorem C_commutator (i : Fin p) : commutatorMoment (wordMoment (τ p) (C p)) i.castSucc (Fin.last p)=0 := by + apply commutatorMoment_word_zero + rw [C_castSucc,C_last] + exact (FreeTensor.equidiscreteSignal_commutes_B p i).symm + theorem C_univariateMoment (q : Polynomial ℝ) : + univariateMoment (wordMoment (τ p) (C p)) q (Fin.last p)=(p:ℝ)⁻¹*∑l : Fin p,q.eval (equidiscreteAtom p l) := by + rw [univariateMoment_word] + simp only [C_last,FreeTensor.equidiscreteSignal_moments,← Complex.ofReal_pow,← Complex.ofReal_sum, + ← Complex.ofReal_natCast,← Complex.ofReal_inv,← Complex.ofReal_mul,Complex.ofReal_re] + simp only [mul_left_comm (q.coeff _),← mul_sum] + congr 1 + simp only [Polynomial.eval_eq_sum,Polynomial.sum] + rw [sum_comm] + simp only [mul_sum] +end Model +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/TensorConcat.lean b/lean/OAI/Analysis/FreeEntropy/TensorConcat.lean new file mode 100644 index 0000000000000000000000000000000000000000..29b02e2b341956b27e927f46ce9855e7680d4535 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/TensorConcat.lean @@ -0,0 +1,196 @@ +import OAI.Analysis.FreeEntropy.NoiseTensor + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate lp +open MeasureTheory Filter +namespace FiniteEntropySeparation +namespace FreeTensor +variable {B N G : Type} [Group G] + +def atomMul (a b : Atom B G) : Atom B G := (a.1 ++ b.1, a.2 * b.2) + +def concatAux (a : Atom B G) : List (N × Atom B G) → Word B N G → Word B N G + | [], v => (atomMul a v.1, v.2) + | (i,b) :: t, v => push a i (concatAux b t v) + +def concat (w v : Word B N G) : Word B N G := concatAux w.1 w.2 v + +@[simp] theorem concat_nil (a : Atom B G) (v : Word B N G) : + concat (a, ([] : List (N × Atom B G))) v = (atomMul a v.1, v.2) := rfl + +@[simp] theorem concat_push (a : Atom B G) (i : N) (w v : Word B N G) : + concat (push a i w) v = push a i (concat w v) := rfl + +@[simp] theorem concat_empty_left (v : Word B N G) : concat empty v = v := by + rcases v with ⟨⟨l,g⟩,t⟩ + simp [concat, concatAux, empty, atomMul] + +@[simp] theorem concat_empty_right (w : Word B N G) : concat w empty = w := by + rcases w with ⟨a,t⟩ + induction t generalizing a with + | nil => simp [concat, concatAux, empty, atomMul] + | cons p t ih => + rcases p with ⟨i,b⟩ + change push a i (concat (b,t) empty) = _ + rw [ih] + rfl + + theorem concat_tail_length (w v : Word B N G) : + (concat w v).2.length = w.2.length + v.2.length := by + rcases w with ⟨a,t⟩ + induction t generalizing a with + | nil => simp [concat, concatAux] + | cons p t ih => + rcases p with ⟨i,b⟩ + change (push a i (concat (b,t) v)).2.length = _ + simp only [push, List.length_cons, ih] + omega + + theorem atomMul_right_injective (b : Atom B G) : Function.Injective (fun a => atomMul a b) := by + rintro ⟨v,g⟩ ⟨w,h⟩ he + simpa [atomMul] using he + + theorem concat_right_injective (v : Word B N G) : Function.Injective (fun w => concat w v) := by + rintro ⟨a,t⟩ ⟨b,s⟩ h + have hl : t.length = s.length := by + have hh := congrArg (fun w : Word B N G => w.2.length) h + simp only [concat_tail_length] at hh + omega + induction t generalizing a b s with + | nil => + have hs : s = [] := List.length_eq_zero_iff.mp (by simpa using hl.symm) + subst s + have he : atomMul a v.1 = atomMul b v.1 := congrArg Prod.fst h + exact congrArg (fun a => (a, ([] : List (N × Atom B G)))) (atomMul_right_injective _ he) + | cons p t ih => + cases s with + | nil => simp at hl + | cons q s => + rcases p with ⟨i,c⟩ + rcases q with ⟨j,d⟩ + have he : a = b ∧ i = j ∧ concat (c,t) v = concat (d,s) v := by + have he := h + simp only [concat, concatAux, push, Prod.mk.injEq, List.cons.injEq, and_assoc] at he + exact ⟨he.1, he.2.1, Prod.ext he.2.2.1 he.2.2.2⟩ + rcases he with ⟨rfl,rfl,he⟩ + have hh := ih c d s he (by simpa using hl) + cases hh + rfl + + theorem leftB_concat (i : B) (w v : Word B N G) : + leftB i (concat w v) = concat (leftB i w) v := by + rcases w with ⟨⟨l,g⟩,t⟩ + cases t <;> rfl + + theorem leftN_concat (i : N) (w v : Word B N G) : + leftN i (concat w v) = concat (leftN i w) v := rfl + + theorem leftG_concat (g : G) (w v : Word B N G) : + leftG g (concat w v) = concat (leftG g w) v := by + rcases w with ⟨⟨l,h⟩,t⟩ + cases t with + | nil => simp [concat, concatAux, atomMul, leftG, mul_assoc] + | cons a t => rfl + + theorem concat_noiseWord_cons (i : N) (w : List N) (v : Word B N G) : + concat (noiseWord (i :: w)) v = leftN i (concat (noiseWord w) v) := rfl + +variable [DecidableEq B] [DecidableEq N] [DecidableEq G] + +def suffixEmbedding (v : Word B N G) : Space B N G →L[ℂ] Space B N G := + LabelHilbert.lift (fun w => concat w v) (concat_right_injective v) + +@[simp] theorem suffixEmbedding_single (v w : Word B N G) (z : ℂ) : + suffixEmbedding v (lp.single 2 w z) = lp.single 2 (concat w v) z := + LabelHilbert.lift_single _ _ _ _ + +@[simp] theorem suffixEmbedding_basis (v w : Word B N G) : + suffixEmbedding v (basis w) = basis (concat w v) := suffixEmbedding_single v w 1 + + theorem creationB_suffix (i : B) (v : Word B N G) : + Commute (creationB i) (suffixEmbedding v) := by + apply LabelHilbert.lift_commute + intro w + exact leftB_concat i w v + + theorem creationN_suffix (i : N) (v : Word B N G) : + Commute (creationN i) (suffixEmbedding v) := by + apply LabelHilbert.lift_commute + intro w + exact leftN_concat i w v + + theorem unitaryG_suffix (g : G) (v : Word B N G) : + Commute (unitaryG g) (suffixEmbedding v) := by + apply LabelHilbert.lift_commute + intro w + exact leftG_concat g w v + +def StartsNoise (i : N) (w : Word B N G) : Prop := + ∃ v, w = leftN i v + +def Supported (J : Set N) (w : Word B N G) : Prop := + ∀ p ∈ w.2, p.1 ∈ J + +def StartsBackground (J : Set N) (w : Word B N G) : Prop := + w.1 ≠ ([],1) ∨ ∃ i ∈ J, StartsNoise i w + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +theorem supported_empty [DecidableEq B] [DecidableEq N] [DecidableEq G] (J : Set N) : Supported J (empty : Word B N G) := by + simp [Supported, empty] + +omit [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] in +theorem supported_leftB [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] {J : Set N} {w : Word B N G} (hw : Supported J w) (i : B) : + Supported J (leftB i w) := hw + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +theorem supported_leftG [DecidableEq B] [DecidableEq N] [DecidableEq G] {J : Set N} {w : Word B N G} (hw : Supported J w) (g : G) : + Supported J (leftG g w) := hw + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +theorem supported_leftN [DecidableEq B] [DecidableEq N] [DecidableEq G] {J : Set N} {w : Word B N G} (hw : Supported J w) + {i : N} (hi : i ∈ J) : Supported J (leftN i w) := by + simpa [Supported, leftN, push] using And.intro hi hw + +omit [DecidableEq N] in +theorem supported_ne_empty_starts [DecidableEq N] {J : Set N} {w : Word B N G} + (hw : Supported J w) (hne : w ≠ empty) : StartsBackground J w := by + by_cases ha : w.1 = ([],1) + · rcases w with ⟨a,t⟩ + cases ha + cases t with + | nil => exact False.elim (hne rfl) + | cons p t => + rcases p with ⟨i,a⟩ + exact Or.inr ⟨i, hw (i,a) (by simp), (a,t), rfl⟩ + · exact Or.inl ha + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +theorem startsBackground_concat [DecidableEq B] [DecidableEq N] [DecidableEq G] {J : Set N} {w : Word B N G} + (hw : StartsBackground J w) {i : N} {v : Word B N G} (hv : StartsNoise i v) : + StartsBackground J (concat w v) := by + obtain ⟨v,rfl⟩ := hv + rcases hw with (ha | ⟨j,hj,u,rfl⟩) + · left + rcases w with ⟨a,t⟩ + cases t with + | nil => simpa [concat, concatAux, atomMul, leftN, push] using ha + | cons p t => exact ha + · exact Or.inr ⟨j,hj,concat u (leftN i v),rfl⟩ + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +theorem startsBackground_not_noise [DecidableEq B] [DecidableEq N] [DecidableEq G] {J : Set N} {w : Word B N G} + (hw : StartsBackground J w) {i : N} (hi : i ∉ J) : ¬ StartsNoise i w := by + rintro ⟨v,rfl⟩ + rcases hw with (hw | ⟨j,hj,u,he⟩) + · exact hw rfl + · have : i = j := by simpa [leftN, push, Prod.mk.injEq] using congrArg (fun w => w.2.head?.map Prod.fst) he + exact hi (this ▸ hj) + +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/TensorFreeness.lean b/lean/OAI/Analysis/FreeEntropy/TensorFreeness.lean new file mode 100644 index 0000000000000000000000000000000000000000..fea78ab55afb9ee1594ccbd4d02040cb805cea89 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/TensorFreeness.lean @@ -0,0 +1,472 @@ +import OAI.Analysis.FreeEntropy.TensorConcat + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate lp +open MeasureTheory Filter +namespace FiniteEntropySeparation +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] + +def labelSpace (P : Word B N G → Prop) : Submodule ℂ (Space B N G) := + Submodule.span ℂ {x | ∃ w, P w ∧ x = basis w} + +omit [Group G] in +theorem basis_mem_labelSpace [Group G] {P : Word B N G → Prop} {w : Word B N G} (hw : P w) : + basis w ∈ labelSpace P := Submodule.subset_span ⟨w, hw, rfl⟩ + +omit [Group G] in +theorem labelSpace_action [Group G] {P Q : Word B N G → Prop} {T : Space B N G →L[ℂ] Space B N G} + (hT : ∀ w, P w → T (basis w) ∈ labelSpace Q) {x : Space B N G} + (hx : x ∈ labelSpace P) : T x ∈ labelSpace Q := by + induction hx using Submodule.span_induction with + | mem x hx => obtain ⟨w,hw,rfl⟩ := hx; exact hT w hw + | zero => simp + | add x y _ _ hx hy => simpa using (labelSpace Q).add_mem hx hy + | smul z x _ hx => simpa using (labelSpace Q).smul_mem z hx + + theorem centered_labelSpace_suffix {P Q : Word B N G → Prop} + {x : Space B N G} (hx : x ∈ labelSpace P) (v : Word B N G) + (hPQ : ∀ w, P w → w ≠ empty → Q (concat w v)) : + suffixEmbedding v (x - x empty • basis empty) ∈ labelSpace Q := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨w,hw,rfl⟩ := hx + by_cases he : w = empty + · subst w + simp [basis, lp.single_apply] + · have hz : (basis w : Space B N G) empty = 0 := by + simp [basis, lp.single_apply, Ne.symm he] + rw [hz, zero_smul, sub_zero, suffixEmbedding_basis] + exact basis_mem_labelSpace (hPQ w hw he) + | zero => simp + | add x y _ _ hx hy => + have h : (x + y) - (x + y) empty • basis empty = + (x - x empty • basis empty) + (y - y empty • basis empty) := by + change (x + y) - (x empty + y empty) • basis empty = _ + rw [add_smul]; abel + rw [h, map_add] + exact (labelSpace Q).add_mem hx hy + | smul z x _ hx => + have h : z • x - (z • x) empty • basis empty = + z • (x - x empty • basis empty) := by + change z • x - (z * x empty) • basis empty = _ + rw [smul_sub, smul_smul] + rw [h, map_smul] + exact (labelSpace Q).smul_mem z hx + + theorem labelSpace_vacuum_zero {P : Word B N G → Prop} (hP : ¬ P empty) + {x : Space B N G} (hx : x ∈ labelSpace P) : x empty = 0 := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨w,hw,rfl⟩ := hx + have hne : empty ≠ w := fun h => hP (h ▸ hw) + simp [basis, lp.single_apply, hne] + | zero => rfl + | add x y _ _ hx hy => simp [hx, hy] + | smul z x _ hx => simp [hx] + + theorem trace_eq_vacuum_coefficient (T : Space B N G →L[ℂ] Space B N G) : + trace (tracialVector B N G) T = (T (basis empty)) empty := by + simp [trace, tracialVector, basis, lp.inner_single_left] + + theorem annihilationB_preserves_supported {J : Set N} {w : Word B N G} + (hw : Supported J w) (b : B) : + star (creationB b) (basis w) ∈ labelSpace (Supported J) := by + rw [basis, annihilationB_single] + cases h : removeB b w with + | none => exact (labelSpace _).zero_mem + | some v => + have hv := (removeB_spec b v w).mp h + subst w + exact basis_mem_labelSpace hw + + theorem annihilationN_preserves_supported {J : Set N} {w : Word B N G} + (hw : Supported J w) (i : N) : + star (creationN i) (basis w) ∈ labelSpace (Supported J) := by + rw [basis, annihilationN_single] + cases h : removeN i w with + | none => exact (labelSpace _).zero_mem + | some v => + have hv := (removeN_spec i v w).mp h + subst w + apply basis_mem_labelSpace + intro p hp + exact hw p (List.mem_cons_of_mem _ hp) + + theorem background_preserves_supported {J : Set N} + {T : Space B N G →L[ℂ] Space B N G} (hT : T ∈ backgroundAlgebra J) : + ∀ x ∈ labelSpace (Supported J), T x ∈ labelSpace (Supported J) := by + induction hT using Algebra.adjoin_induction with + | mem T hT => + rcases hT with ((⟨b,rfl⟩ | ⟨g,rfl⟩) | ⟨i,hi,rfl⟩) + · apply labelSpace_action + intro w hw + change creationB b (basis w) + star (creationB b) (basis w) ∈ _ + apply Submodule.add_mem + · simpa [basis] using basis_mem_labelSpace (supported_leftB hw b) + · exact annihilationB_preserves_supported hw b + · apply labelSpace_action + intro w hw + simpa [basis] using basis_mem_labelSpace (supported_leftG hw g) + · apply labelSpace_action + intro w hw + change creationN i (basis w) + star (creationN i) (basis w) ∈ _ + apply Submodule.add_mem + · simpa [basis] using basis_mem_labelSpace (supported_leftN hw hi) + · exact annihilationN_preserves_supported hw i + | algebraMap z => + intro x hx + simpa using (labelSpace (Supported J)).smul_mem z hx + | add T U _ _ hT hU => + intro x hx + exact Submodule.add_mem _ (hT x hx) (hU x hx) + | mul T U _ _ hT hU => + intro x hx + exact hT (U x) (hU x hx) + +omit [DecidableEq N] [DecidableEq G] in +theorem removeB_concat_noise [DecidableEq N] [DecidableEq G] (b : B) (w v : Word B N G) (i : N) : + removeB b (concat w (leftN i v)) = (removeB b w).map (fun u => concat u (leftN i v)) := by + rcases w with ⟨⟨l,g⟩,t⟩ + cases t with + | nil => + cases l with + | nil => simp [concat, concatAux, atomMul, leftN, push, removeB] + | cons c l => + by_cases h : b = c <;> simp [concat, concatAux, atomMul, leftN, push, removeB, h] + | cons p t => + rcases p with ⟨j,a⟩ + cases l with + | nil => rfl + | cons c l => + by_cases h : b = c <;> simp [concat, concatAux, leftN, push, removeB, h] + + theorem removeN_concat_noise (i k : N) (hik : i ≠ k) (w v : Word B N G) : + removeN i (concat w (leftN k v)) = (removeN i w).map (fun u => concat u (leftN k v)) := by + rcases w with ⟨a,t⟩ + cases t with + | nil => + by_cases ha : a = ([],1) + · subst a + simp [concat, concatAux, atomMul, leftN, push, removeN, hik] + · have ham : atomMul a ([],1) = a := by simp [atomMul] + simp [concat, concatAux, leftN, push, removeN, ha, ham] + | cons p t => + rcases p with ⟨j,a'⟩ + by_cases ha : a = ([],1) <;> by_cases hij : i = j <;> + simp [concat, concatAux, leftN, push, removeN, ha, hij] + + theorem annihilationB_suffix_noise (b : B) (i : N) (v : Word B N G) : + Commute (star (creationB b)) (suffixEmbedding (leftN i v)) := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change star (creationB b) (suffixEmbedding (leftN i v) (lp.single 2 w z)) = + suffixEmbedding (leftN i v) (star (creationB b) (lp.single 2 w z)) + rw [suffixEmbedding_single, annihilationB_single, annihilationB_single, removeB_concat_noise] + cases removeB b w <;> simp + + theorem annihilationN_suffix_noise (i k : N) (hik : i ≠ k) (v : Word B N G) : + Commute (star (creationN i)) (suffixEmbedding (leftN k v)) := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change star (creationN i) (suffixEmbedding (leftN k v) (lp.single 2 w z)) = + suffixEmbedding (leftN k v) (star (creationN i) (lp.single 2 w z)) + rw [suffixEmbedding_single, annihilationN_single, annihilationN_single, + removeN_concat_noise i k hik] + cases removeN i w <;> simp + + theorem background_commutes_suffix {J : Set N} {k : N} (hk : k ∉ J) (v : Word B N G) + {T : Space B N G →L[ℂ] Space B N G} (hT : T ∈ backgroundAlgebra J) : + Commute T (suffixEmbedding (leftN k v)) := by + induction hT using Algebra.adjoin_induction with + | mem T hT => + rcases hT with ((⟨b,rfl⟩ | ⟨g,rfl⟩) | ⟨i,hi,rfl⟩) + · exact (creationB_suffix b _).add_left (annihilationB_suffix_noise b k v) + · exact unitaryG_suffix g _ + · exact (creationN_suffix i _).add_left + (annihilationN_suffix_noise i k (fun h => hk (h ▸ hi)) v) + | algebraMap z => exact Algebra.commute_algebraMap_left z _ + | add T U _ _ hT hU => exact hT.add_left hU + | mul T U _ _ hT hU => exact hT.mul_left hU + + theorem centered_background_basis {J : Set N} + {T : Space B N G →L[ℂ] Space B N G} (hT : T ∈ backgroundAlgebra J) + (hcenter : trace (tracialVector B N G) T = 0) {k : N} (hk : k ∉ J) + {v : Word B N G} (hv : StartsNoise k v) : + T (basis v) ∈ labelSpace (StartsBackground J) := by + obtain ⟨v,rfl⟩ := hv + have hc := congrArg (fun A : Space B N G →L[ℂ] Space B N G => A (basis empty)) + (background_commutes_suffix hk v hT).eq + simp only [mul_apply_eq_comp, suffixEmbedding_basis, concat_empty_left] at hc + have hx := background_preserves_supported hT (basis empty) + (basis_mem_labelSpace (supported_empty J)) + have hz : (T (basis empty)) empty = 0 := by rwa [← trace_eq_vacuum_coefficient] + have hs := centered_labelSpace_suffix hx (leftN k v) + (fun w hw hne => startsBackground_concat (supported_ne_empty_starts hw hne) ⟨v,rfl⟩) + simpa only [hz, zero_smul, sub_zero, ← hc] using hs + +def PureSupported (J : Set N) (w : Word B N G) : Prop := + ∃ l : List N, (∀ i ∈ l, i ∈ J) ∧ w = noiseWord l + +def StartsNoiseIn (J : Set N) (w : Word B N G) : Prop := + ∃ i ∈ J, StartsNoise i w + + theorem removeN_none_iff (i : N) (w : Word B N G) : + removeN i w = none ↔ ¬ StartsNoise i w := by + constructor + · intro h ⟨v,hv⟩ + have hv' := (removeN_spec i v w).mpr hv.symm + rw [h] at hv' + contradiction + · intro h + cases he : removeN i w with + | none => rfl + | some v => exact False.elim (h ⟨v, ((removeN_spec i v w).mp he).symm⟩) + + theorem semicircularN_basis_leftN (i j : N) (w : Word B N G) : + semicircularN i (basis (leftN j w)) = + basis (leftN i (leftN j w)) + if i = j then basis w else 0 := by + by_cases h : i = j <;> simp [semicircularN, basis, annihilationN_single, removeN, leftN, push, h] + + theorem semicircularN_basis_not_starts (i : N) (w : Word B N G) + (hw : ¬ StartsNoise i w) : + semicircularN i (basis w) = basis (leftN i w) := by + simp [semicircularN, basis, annihilationN_single, (removeN_none_iff i w).mpr hw] + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +theorem pureSupported_empty [DecidableEq B] [DecidableEq N] [DecidableEq G] (J : Set N) : PureSupported J (empty : Word B N G) := + ⟨[], by simp, rfl⟩ + + theorem semicircularN_preserves_pureSupported {J : Set N} {i : N} (hi : i ∈ J) + {x : Space B N G} (hx : x ∈ labelSpace (PureSupported J)) : + semicircularN i x ∈ labelSpace (PureSupported J) := by + apply labelSpace_action (x := x) _ hx + rintro w ⟨l,hl,rfl⟩ + cases l with + | nil => + have hn : ¬ StartsNoise i (empty : Word B N G) := by + rintro ⟨v,hv⟩ + simp [empty, leftN, push] at hv + rw [noiseWord_nil, semicircularN_basis_not_starts i empty hn] + exact basis_mem_labelSpace ⟨[i], by simpa using hi, rfl⟩ + | cons j l => + rw [noiseWord_cons, semicircularN_basis_leftN] + apply Submodule.add_mem + · exact basis_mem_labelSpace ⟨i :: j :: l, by simpa using And.intro hi hl, rfl⟩ + · split_ifs + · exact basis_mem_labelSpace ⟨l, fun k hk => hl k (List.mem_cons_of_mem _ hk), rfl⟩ + · exact Submodule.zero_mem _ + + theorem semicircularN_pureSuffix {J : Set N} {i : N} (hi : i ∈ J) + (v : Word B N G) (hv : ∀ j ∈ J, ¬ StartsNoise j v) + {x : Space B N G} (hx : x ∈ labelSpace (PureSupported J)) : + semicircularN i (suffixEmbedding v x) = suffixEmbedding v (semicircularN i x) := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨w,⟨l,hl,rfl⟩,rfl⟩ := hx + cases l with + | nil => + rw [noiseWord_nil, suffixEmbedding_basis, concat_empty_left, + semicircularN_basis_not_starts i v (hv i hi)] + have hn : ¬ StartsNoise i (empty : Word B N G) := by + rintro ⟨w,hw⟩ + simp [empty, leftN, push] at hw + rw [semicircularN_basis_not_starts i empty hn, suffixEmbedding_basis] + rw [← leftN_concat, concat_empty_left] + | cons j l => + rw [noiseWord_cons, suffixEmbedding_basis, ← leftN_concat, + semicircularN_basis_leftN, semicircularN_basis_leftN, map_add] + by_cases h : i = j <;> simp [h, suffixEmbedding_basis, ← leftN_concat] + | zero => simp + | add x y _ _ hx hy => simp [map_add, hx, hy] + | smul z x _ hx => simp [hx] + + theorem noise_adjoin_suffix {J : Set N} {T : Space B N G →L[ℂ] Space B N G} + (hT : T ∈ Algebra.adjoin ℂ (semicircularN '' J)) (v : Word B N G) + (hv : ∀ j ∈ J, ¬ StartsNoise j v) : + ∀ x ∈ labelSpace (PureSupported J), T x ∈ labelSpace (PureSupported J) ∧ + T (suffixEmbedding v x) = suffixEmbedding v (T x) := by + induction hT using Algebra.adjoin_induction with + | mem T hT => + obtain ⟨i,hi,rfl⟩ := hT + exact fun x hx => ⟨semicircularN_preserves_pureSupported hi hx, + semicircularN_pureSuffix hi v hv hx⟩ + | algebraMap z => + intro x hx + exact ⟨by simpa using (labelSpace (PureSupported J)).smul_mem z hx, by simp⟩ + | add T U _ _ hT hU => + intro x hx + exact ⟨Submodule.add_mem _ (hT x hx).1 (hU x hx).1, + by simp only [add_apply, (hT x hx).2, (hU x hx).2, map_add]⟩ + | mul T U _ _ hT hU => + intro x hx + exact ⟨(hT (U x) (hU x hx).1).1, + by simp only [mul_apply_eq_comp, (hU x hx).2, (hT (U x) (hU x hx).1).2]⟩ + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +theorem pureSupported_ne_empty_concat [DecidableEq B] [DecidableEq N] [DecidableEq G] {J : Set N} {w : Word B N G} + (hw : PureSupported J w) (hne : w ≠ empty) (v : Word B N G) : + StartsNoiseIn J (concat w v) := by + obtain ⟨l,hl,rfl⟩ := hw + cases l with + | nil => exact False.elim (hne rfl) + | cons i l => exact ⟨i, hl i (by simp), concat (noiseWord l) v, rfl⟩ + + theorem centered_noise_basis {J : Set N} {T : Space B N G →L[ℂ] Space B N G} + (hT : T ∈ Algebra.adjoin ℂ (semicircularN '' J)) + (hc : trace (tracialVector B N G) T = 0) (v : Word B N G) + (hv : ∀ j ∈ J, ¬ StartsNoise j v) : + T (basis v) ∈ labelSpace (StartsNoiseIn J) := by + have h := noise_adjoin_suffix hT v hv (basis empty) + (basis_mem_labelSpace (pureSupported_empty J)) + have hz : (T (basis empty)) empty = 0 := by rwa [← trace_eq_vacuum_coefficient] + have hs := centered_labelSpace_suffix h.1 v + (fun w hw hne => pureSupported_ne_empty_concat hw hne v) + simpa only [hz, zero_smul, sub_zero, ← h.2, suffixEmbedding_basis, + concat_empty_left] using hs + + theorem centered_coordinate_basis {i : N} {T : Space B N G →L[ℂ] Space B N G} + (hT : T ∈ Algebra.adjoin ℂ {semicircularN i}) + (hc : trace (tracialVector B N G) T = 0) (v : Word B N G) (hv : ¬ StartsNoise i v) : + T (basis v) ∈ labelSpace (StartsNoise i) := by + have hT' : T ∈ Algebra.adjoin ℂ (semicircularN '' {i}) := by simpa using hT + have h := centered_noise_basis hT' hc v (by simpa using hv) + have he : StartsNoiseIn ({i} : Set N) = (StartsNoise i : Word B N G → Prop) := by + funext w + simp [StartsNoiseIn] + rwa [he] at h + + theorem centered_background_vacuum {J : Set N} + {T : Space B N G →L[ℂ] Space B N G} (hT : T ∈ backgroundAlgebra J) + (hc : trace (tracialVector B N G) T = 0) : + T (basis empty) ∈ labelSpace (StartsBackground J) := by + have hx := background_preserves_supported hT (basis empty) + (basis_mem_labelSpace (supported_empty J)) + have hz : (T (basis empty)) empty = 0 := by rwa [← trace_eq_vacuum_coefficient] + have hs := centered_labelSpace_suffix hx empty + (fun w hw hne => by simpa using supported_ne_empty_starts hw hne) + have hid : suffixEmbedding (empty : Word B N G) = 1 := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + simp + simpa only [hz, zero_smul, sub_zero, hid, one_apply_eq_self] using hs + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +theorem startsNoise_injective [DecidableEq B] [DecidableEq N] [DecidableEq G] {i j : N} {w : Word B N G} + (hi : StartsNoise i w) (hj : StartsNoise j w) : i = j := by + obtain ⟨v,rfl⟩ := hi + obtain ⟨u,hu⟩ := hj + have h := congrArg (fun w : Word B N G => w.2.head?.map Prod.fst) hu + simpa [leftN, push] using h + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +theorem not_startsNoise_empty [DecidableEq B] [DecidableEq N] [DecidableEq G] (i : N) : ¬ StartsNoise i (empty : Word B N G) := by + rintro ⟨v,hv⟩ + simp [empty, leftN, push] at hv + + theorem not_startsBackground_empty (J : Set N) : ¬ StartsBackground J (empty : Word B N G) := by + rintro (h | ⟨i,_,hi⟩) + · exact h rfl + · exact not_startsNoise_empty i hi + +def noiseAlgebras {κ : Type} (J : Set N) (σ : κ → N) : + Option κ → Subalgebra ℂ (Space B N G →L[ℂ] Space B N G) + | none => backgroundAlgebra J + | some i => Algebra.adjoin ℂ {semicircularN (σ i)} + +def StartsColor {κ : Type} (J : Set N) (σ : κ → N) : Option κ → Word B N G → Prop + | none => StartsBackground J + | some i => StartsNoise (σ i) + + theorem centered_noiseAlgebras_vacuum {κ : Type} (J : Set N) (σ : κ → N) + (i : Option κ) {T : Space B N G →L[ℂ] Space B N G} + (hT : T ∈ noiseAlgebras J σ i) (hc : trace (tracialVector B N G) T = 0) : + T (basis empty) ∈ labelSpace (StartsColor J σ i) := by + cases i with + | none => exact centered_background_vacuum hT hc + | some i => exact centered_coordinate_basis hT hc empty (not_startsNoise_empty _) + + theorem centered_noiseAlgebras_starts {κ : Type} (J : Set N) (σ : κ → N) + (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) + {i j : Option κ} (hij : i ≠ j) {T : Space B N G →L[ℂ] Space B N G} + (hT : T ∈ noiseAlgebras J σ i) (hc : trace (tracialVector B N G) T = 0) + {x : Space B N G} (hx : x ∈ labelSpace (StartsColor J σ j)) : + T x ∈ labelSpace (StartsColor J σ i) := by + apply labelSpace_action (x := x) _ hx + intro w hw + cases i with + | none => + cases j with + | none => exact False.elim (hij rfl) + | some j => exact centered_background_basis hT hc (hs j) hw + | some i => + apply centered_coordinate_basis hT hc + cases j with + | none => exact startsBackground_not_noise hw (hs i) + | some j => + intro hi + exact hij (congrArg some (hσ (startsNoise_injective hi hw))) + + theorem alternating_noise_product_starts {κ : Type} (J : Set N) (σ : κ → N) + (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) : + ∀ (k : ℕ) (hk : 0 < k) (j : Fin k → Option κ) + (a : Fin k → Space B N G →L[ℂ] Space B N G), + (∀ r, a r ∈ noiseAlgebras J σ (j r)) → + (∀ r, trace (tracialVector B N G) (a r) = 0) → + (∀ (r : ℕ) (hr : r + 1 < k), + j ⟨r, Nat.lt_trans (Nat.lt_succ_self r) hr⟩ ≠ j ⟨r + 1, hr⟩) → + (List.ofFn a).prod (basis empty) ∈ labelSpace (StartsColor J σ (j ⟨0,hk⟩)) := by + intro k + induction k with + | zero => intro hk; omega + | succ k ih => + intro hk j a ha hc hadj + rw [List.ofFn_succ, List.prod_cons, mul_apply_eq_comp] + cases k with + | zero => exact centered_noiseAlgebras_vacuum J σ (j 0) (ha 0) (hc 0) + | succ k => + have ht := ih (by omega) (fun r => j r.succ) (fun r => a r.succ) + (fun r => ha r.succ) (fun r => hc r.succ) (by + intro r hr + exact hadj (r+1) (by omega)) + exact centered_noiseAlgebras_starts J σ hσ hs (hadj 0 (by omega)) (ha 0) (hc 0) ht + +theorem free_noiseAlgebras {κ : Type} (J : Set N) (σ : κ → N) + (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) : + FreeSubalgebras (tracialVector B N G) (noiseAlgebras J σ) := by + intro k hk j a ha hc hadj + rw [trace_eq_vacuum_coefficient] + apply labelSpace_vacuum_zero _ (alternating_noise_product_starts J σ hσ hs k hk j a ha hc hadj) + cases j ⟨0,hk⟩ with + | none => exact not_startsBackground_empty J + | some i => exact not_startsNoise_empty (σ i) + +theorem freeStandardNoise {m n : ℕ} (J : Set (Fin m)) + (X : Fin n → Space B (Fin m) G →L[ℂ] Space B (Fin m) G) + (hX : ∀ i, X i ∈ backgroundAlgebra J) + (σ : Fin n → Fin m) (hσ : Function.Injective σ) (hs : ∀ i, σ i ∉ J) : + FreeStandardNoise (tracialVector B (Fin m) G) X (fun i => semicircularN (σ i)) := by + refine ⟨fun i k => trace_semicircularN_pow (σ i) k, ?_⟩ + apply (free_noiseAlgebras J σ hσ hs).mono + intro j + cases j with + | none => + apply Algebra.adjoin_le + rintro _ ⟨i,rfl⟩ + exact hX i + | some i => exact le_rfl + +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/TensorGradient.lean b/lean/OAI/Analysis/FreeEntropy/TensorGradient.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e607ccad39a7540de9ec7f652c74349dd9033f1 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/TensorGradient.lean @@ -0,0 +1,87 @@ +import OAI.Analysis.FreeEntropy.MatrixBasisChart + +namespace OAI + +universe u1 + +noncomputable section +open scoped Polynomial +open MeasureTheory ProbabilityTheory Polynomial Finset +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] [DecidableEq ι] + theorem realHermite_derivative_inner (n m : ℕ) : + gaussianPolyIntegral ((realHermite n).derivative * (realHermite m).derivative) = + (n : ℝ)*gaussianPolyIntegral (realHermite n*realHermite m) := by + cases n with + | zero => simp + | succ n => + cases m with + | zero => simp [realHermite_mean] + | succ m => + rw [realHermite_derivative, realHermite_derivative, smul_mul_smul_comm, + gaussianPolyIntegral_smul, realHermite_inner, realHermite_inner] + by_cases h : n=m + · subst m; simp [Nat.factorial_succ]; ring + · simp [h] + def tensorGradient (a : ι → ℕ) (i : ι) (x : ι → ℝ) : ℝ := + ∏ j, (if j=i then (realHermite (a j)).derivative else realHermite (a j)).eval (x j) + theorem tensorGradient_erase (a : ι → ℕ) (i : ι) (x : ι → ℝ) : + tensorGradient a i x = (realHermite (a i)).derivative.eval (x i) * + ∏ j ∈ univ.erase i, (realHermite (a j)).eval (x j) := by + rw [tensorGradient, ← mul_prod_erase _ _ (mem_univ i)] + simp only [] + congr 1 + apply prod_congr rfl + intro j hj + rw [ite_eq_right (ne_of_mem_erase hj)] + theorem tensorHermite_section (a : ι → ℕ) (i : ι) (x : ι → ℝ) : + (fun t => tensorHermite a (Function.update x i t)) = + fun t => (realHermite (a i)).eval t * ∏ j ∈ univ.erase i, (realHermite (a j)).eval (x j) := by + funext t + rw [tensorHermite, ← mul_prod_erase _ _ (mem_univ i)] + simp only [Function.update_self] + congr 1 + apply prod_congr rfl + intro j hj + rw [Function.update_of_ne (ne_of_mem_erase hj)] + theorem tensorHermite_hasDerivAt (a : ι → ℕ) (i : ι) (x : ι → ℝ) : + HasDerivAt (fun t => tensorHermite a (Function.update x i t)) (tensorGradient a i x) (x i) := by + rw [tensorHermite_section, tensorGradient_erase] + exact ((realHermite (a i)).hasDerivAt (x i)).mul_const _ + theorem tensorGradient_integrable (a : ι → ℕ) (i : ι) : + Integrable (tensorGradient a i) (productGaussian ι) := + Integrable.fintype_prod (fun _ => gaussian_polynomial_integrable 0 1 _) + theorem tensorGradient_mul_integrable (a b : ι → ℕ) (i : ι) : + Integrable (fun x => tensorGradient a i x * tensorGradient b i x) (productGaussian ι) := by + have h := Integrable.fintype_prod (fun j => gaussian_polynomial_integrable 0 1 + ((if j=i then (realHermite (a j)).derivative else realHermite (a j)) * + (if j=i then (realHermite (b j)).derivative else realHermite (b j)))) + simpa only [eval_mul, prod_mul_distrib, tensorGradient, productGaussian] using h + theorem tensorGradient_inner (a b : ι → ℕ) (i : ι) : + (∫ x, tensorGradient a i x*tensorGradient b i x ∂productGaussian ι) = + if a=b then (a i : ℝ)*tensorWeight a else 0 := by + have he : (∫ x, tensorGradient a i x*tensorGradient b i x ∂productGaussian ι) = + (a i : ℝ) * ∫ x, tensorHermite a x*tensorHermite b x ∂productGaussian ι := by + simp only [tensorGradient, tensorHermite, ← prod_mul_distrib, productGaussian] + rw [integral_fintype_prod_eq_prod + (fun j t => (if j=i then (realHermite (a j)).derivative else realHermite (a j)).eval t * + (if j=i then (realHermite (b j)).derivative else realHermite (b j)).eval t), + integral_fintype_prod_eq_prod + (fun j t => (realHermite (a j)).eval t * (realHermite (b j)).eval t)] + simp only [← eval_mul] + change (∏ j, gaussianPolyIntegral ((if j=i then (realHermite (a j)).derivative else realHermite (a j)) * + (if j=i then (realHermite (b j)).derivative else realHermite (b j)))) = + (a i : ℝ) * ∏ j, gaussianPolyIntegral (realHermite (a j)*realHermite (b j)) + rw [← mul_prod_erase _ _ (mem_univ i), ← mul_prod_erase univ (fun j => gaussianPolyIntegral (realHermite (a j)*realHermite (b j))) (mem_univ i)] + simp only [ite_true, realHermite_derivative_inner, mul_assoc] + congr 2 + apply prod_congr rfl + intro j hj + simp only [ite_eq_right (ne_of_mem_erase hj)] + rw [he, tensorHermite_inner] + split_ifs <;> simp +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/TensorHermite.lean b/lean/OAI/Analysis/FreeEntropy/TensorHermite.lean new file mode 100644 index 0000000000000000000000000000000000000000..323dfc5f0b0eda983f2b51768ebbd9617089dd1f --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/TensorHermite.lean @@ -0,0 +1,131 @@ +import OAI.Analysis.FreeEntropy.GaussianHermite + +namespace OAI + +universe u1 u2 + +noncomputable section +open scoped Polynomial +open MeasureTheory ProbabilityTheory Polynomial Finset +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] +def productGaussian (ι : Type u2) [Fintype ι] : Measure (ι → ℝ) := + Measure.pi (fun _ => gaussianReal 0 1) +instance : IsProbabilityMeasure (productGaussian ι) := by unfold productGaussian; infer_instance + +def tensorHermite (a : ι → ℕ) (x : ι → ℝ) : ℝ := ∏ i, (realHermite (a i)).eval (x i) +def tensorWeight (a : ι → ℕ) : ℝ := ∏ i, (a i).factorial +@[simp] theorem tensorHermite_zero [DecidableEq ι] (x : ι → ℝ) : tensorHermite (fun _ => 0) x = 1 := by + simp [tensorHermite] +theorem tensorHermite_integrable [DecidableEq ι] (a : ι → ℕ) : Integrable (tensorHermite a) (productGaussian ι) := + Integrable.fintype_prod (fun i => gaussian_polynomial_integrable 0 1 (realHermite (a i))) +theorem tensorHermite_mul_integrable [DecidableEq ι] (a b : ι → ℕ) : + Integrable (fun x => tensorHermite a x * tensorHermite b x) (productGaussian ι) := by + have h := Integrable.fintype_prod (fun i => gaussian_polynomial_integrable 0 1 + (realHermite (a i) * realHermite (b i))) + simpa only [eval_mul, prod_mul_distrib, tensorHermite, productGaussian] using h + theorem tensorHermite_mean [DecidableEq ι] (a : ι → ℕ) : + (∫ x, tensorHermite a x ∂productGaussian ι) = if a=0 then 1 else 0 := by + classical + unfold tensorHermite productGaussian + rw [integral_fintype_prod_eq_prod (fun i t => (realHermite (a i)).eval t)] + change (∏ i, gaussianPolyIntegral (realHermite (a i))) = _ + simp_rw [realHermite_mean] + by_cases ha : a=0 + · subst a; simp + · rw [ite_eq_right ha] + obtain ⟨i, hi⟩ : ∃ i, a i ≠ 0 := by simpa only [funext_iff, Pi.zero_apply, not_forall] using ha + apply prod_eq_zero (mem_univ i) + simp [hi] + theorem tensorHermite_inner [DecidableEq ι] (a b : ι → ℕ) : + (∫ x, tensorHermite a x*tensorHermite b x ∂productGaussian ι) = + if a=b then tensorWeight a else 0 := by + classical + simp only [tensorHermite, ← prod_mul_distrib] + rw [productGaussian, integral_fintype_prod_eq_prod + (fun i t => (realHermite (a i)).eval t * (realHermite (b i)).eval t)] + simp only [← eval_mul] + change (∏ i, gaussianPolyIntegral (realHermite (a i)*realHermite (b i))) = _ + simp_rw [realHermite_inner] + by_cases ha : a=b + · subst b; simp [tensorWeight] + · rw [ite_eq_right ha] + obtain ⟨i, hi⟩ : ∃ i, a i ≠ b i := by simpa only [funext_iff, not_forall] using ha + apply prod_eq_zero (mem_univ i) + simp [hi] + theorem tensorWeight_pos [DecidableEq ι] (a : ι → ℕ) : 0 < tensorWeight a := by + unfold tensorWeight + exact prod_pos (fun i _ => by exact_mod_cast Nat.factorial_pos (a i)) + theorem tensorHermite_update [DecidableEq ι] (a : ι → ℕ) (i : ι) (k : ℕ) (x : ι → ℝ) : + tensorHermite (Function.update a i k) x = (realHermite k).eval (x i) * + ∏ j ∈ univ.erase i, (realHermite (a j)).eval (x j) := by + classical + rw [tensorHermite, ← mul_prod_erase _ _ (mem_univ i)] + simp only [Function.update_self] + congr 1 + apply prod_congr rfl + intro j hj + rw [Function.update_of_ne (ne_of_mem_erase hj)] + theorem tensorHermite_mul_coord [DecidableEq ι] (a : ι → ℕ) (i : ι) (x : ι → ℝ) : + x i * tensorHermite a x = tensorHermite (Function.update a i (a i+1)) x + + (a i : ℝ) * tensorHermite (Function.update a i (a i-1)) x := by + classical + have he : tensorHermite a x = (realHermite (a i)).eval (x i) * + ∏ j ∈ univ.erase i, (realHermite (a j)).eval (x j) := by + simpa only [Function.update_eq_self] using tensorHermite_update a i (a i) x + rw [he, tensorHermite_update, tensorHermite_update] + have hr : x i * (realHermite (a i)).eval (x i) = + (realHermite (a i+1)).eval (x i) + (a i : ℝ)*(realHermite (a i-1)).eval (x i) := by + cases h : a i with + | zero => simp [realHermite_succ] + | succ n => + rw [realHermite_succ (n+1), realHermite_derivative] + simp only [eval_sub, eval_mul, eval_X, eval_smul, smul_eq_mul, Nat.add_sub_cancel] + push_cast + ring + rw [← mul_assoc, hr] + ring + def tensorHermiteSpan : Submodule ℝ ((ι → ℝ) → ℝ) := + Submodule.span ℝ (Set.range (tensorHermite (ι := ι))) + theorem tensorHermite_mem [DecidableEq ι] (a : ι → ℕ) : tensorHermite a ∈ tensorHermiteSpan := + Submodule.subset_span ⟨a,rfl⟩ + theorem tensorHermiteSpan_coord [DecidableEq ι] {f : (ι → ℝ) → ℝ} (hf : f ∈ tensorHermiteSpan) (i : ι) : + (fun x => x i*f x) ∈ tensorHermiteSpan := by + classical + induction hf using Submodule.span_induction with + | mem f hf => + obtain ⟨a,rfl⟩ := hf + have hfun : (fun x => x i*tensorHermite a x) = + tensorHermite (Function.update a i (a i+1)) + (a i : ℝ) • tensorHermite (Function.update a i (a i-1)) := by + funext x; exact tensorHermite_mul_coord a i x + rw [hfun] + exact Submodule.add_mem _ (tensorHermite_mem _) (Submodule.smul_mem _ _ (tensorHermite_mem _)) + | zero => + convert (Submodule.zero_mem tensorHermiteSpan) using 1 + funext x; simp + | add f g hf hg ihf ihg => + convert Submodule.add_mem tensorHermiteSpan ihf ihg using 1 + funext x; simp [mul_add] + | smul r f hf ih => + convert Submodule.smul_mem tensorHermiteSpan r ih using 1 + funext x; simp [mul_left_comm] + theorem mvPolynomial_hermite_span [DecidableEq ι] (P : MvPolynomial ι ℝ) : + (fun x => MvPolynomial.eval x P) ∈ tensorHermiteSpan := by + induction P using MvPolynomial.induction_on with + | C r => + have he : (fun x : ι → ℝ => MvPolynomial.eval x (MvPolynomial.C r)) = r • tensorHermite (fun _ => 0) := by + ext x; simp + rw [he]; exact Submodule.smul_mem _ r (tensorHermite_mem _) + | add P Q hP hQ => + convert Submodule.add_mem tensorHermiteSpan hP hQ using 1 + funext x; simp + | mul_X P i hP => simpa only [map_mul, MvPolynomial.eval_X, mul_comm] using tensorHermiteSpan_coord hP i + theorem mvPolynomial_hermite_expansion [DecidableEq ι] (P : MvPolynomial ι ℝ) : + ∃ a : (ι → ℕ) →₀ ℝ, (fun x => MvPolynomial.eval x P) = a.sum (fun k r => r • tensorHermite k) := by + obtain ⟨a,ha⟩ := Finsupp.mem_span_range_iff_exists_finsupp.mp (mvPolynomial_hermite_span P) + exact ⟨a,ha.symm⟩ +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/TensorLaw.lean b/lean/OAI/Analysis/FreeEntropy/TensorLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..d995875b082b0a1dbdb27dedef14da80623b7963 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/TensorLaw.lean @@ -0,0 +1,131 @@ +import OAI.Analysis.FreeEntropy.Signal + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate lp +open MeasureTheory Filter +namespace FiniteEntropySeparation +namespace LabelHilbert +variable {α β : Type} [DecidableEq α] [DecidableEq β] + +omit [DecidableEq α] in + theorem orthogonal_embedding (f : α → β) (hf : Function.Injective f) : + OrthogonalFamily ℂ (fun _ : α => ℂ) (fun a => coordinateIsometry (f a)) := by + intro a b hab x y + change inner ℂ (lp.single (E := fun _ : β => ℂ) 2 (f a) x) + (lp.single (E := fun _ : β => ℂ) 2 (f b) y) = 0 + rw [lp.inner_single_left, lp.single_apply_ne (E := fun _ : β => ℂ) 2 (f b) y + (fun h => hab (hf h))] + simp + + def embedding (f : α → β) (hf : Function.Injective f) : Space α →ₗᵢ[ℂ] Space β := + (orthogonal_embedding f hf).linearIsometry + +@[simp] theorem embedding_single (f : α → β) (hf : Function.Injective f) (a : α) (z : ℂ) : + embedding f hf (lp.single 2 a z) = lp.single 2 (f a) z := + (orthogonal_embedding f hf).linearIsometry_apply_single z + +end LabelHilbert +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] + +def signalSlice (g : G) : Fock.Space B →L[ℂ] Space B N G := + (LabelHilbert.embedding (fun w : List B => ((w,g), ([] : List (N × Atom B G)))) + (by intro v w h; exact congrArg (fun a => a.1.1) h)).toContinuousLinearMap + +omit [Group G] in +@[simp] theorem signalSlice_single (g : G) (v : List B) (z : ℂ) : + signalSlice (N := N) g (lp.single 2 v z) = lp.single 2 ((v,g),[]) z := by + exact LabelHilbert.embedding_single + (fun w : List B => ((w,g), ([] : List (N × Atom B G)))) + (by intro v w h; exact congrArg (fun a => a.1.1) h) v z + +omit [Group G] in +@[simp] theorem signalSlice_basis [Group G] (g : G) (v : List B) : + signalSlice (N := N) g (Fock.basisVector v) = basis ((v,g),[]) := + signalSlice_single g v 1 + +omit [Group G] in +theorem signalSlice_semicircular [Group G] (g : G) (b : B) : + (semicircularB b).comp (signalSlice (N := N) g) = + (signalSlice g).comp (Fock.semicircular b) := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change semicircularB b (signalSlice g (lp.single 2 w z)) = + signalSlice g (Fock.semicircular b (lp.single 2 w z)) + rw [signalSlice_single] + cases w with + | nil => simp [semicircularB, creationB_single, annihilationB_single, removeB, leftB] + | cons c w => + simp only [semicircularB, add_apply, creationB_single, annihilationB_single, removeB, + Fock.semicircular_single_cons, map_add, signalSlice_single, leftB] + by_cases h : b = c <;> simp [h] + + theorem signalSlice_word (g : G) (w : List B) : + ((w.map (semicircularB (N := N) (G := G))).prod).comp (signalSlice g) = + (signalSlice g).comp ((w.map Fock.semicircular).prod) := by + induction w with + | nil => rfl + | cons b w ih => + apply ContinuousLinearMap.ext + intro x + have hi := congrArg (fun T : Fock.Space B →L[ℂ] Space B N G => T x) ih + have hc := congrArg (fun T : Fock.Space B →L[ℂ] Space B N G => + T ((w.map Fock.semicircular).prod x)) (signalSlice_semicircular (N := N) g b) + simp only [ContinuousLinearMap.comp_apply] at hi hc + simpa only [ContinuousLinearMap.comp_apply, List.map_cons, List.prod_cons, + mul_apply_eq_comp, hi] using hc + + theorem signalSlice_vacuum_coefficient (g : G) (x : Fock.Space B) : + inner ℂ (basis (empty : Word B N G)) (signalSlice g x) = + if g = 1 then inner ℂ (Fock.basisVector []) x else 0 := by + have h : (innerSL ℂ (basis (empty : Word B N G))).comp (signalSlice g) = + if g = 1 then innerSL ℂ (Fock.basisVector ([] : List B)) else 0 := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro v + apply ContinuousLinearMap.ext + intro z + by_cases hg : g = 1 <;> by_cases hv : v = [] <;> + simp [hg, hv, basis, empty, Fock.basisVector, lp.inner_single_left, lp.single_apply, eq_comm] + have hx := congrArg (fun f : Fock.Space B →L[ℂ] ℂ => f x) h + by_cases hg : g = 1 <;> simpa [hg] using hx + +theorem tensor_word_moment (w : List B) (g : G) : + trace (tracialVector B N G) ((w.map semicircularB).prod * unitaryG g) = + trace (Fock.tracialVector B) ((w.map Fock.semicircular).prod) * + (if g = 1 then 1 else 0) := by + change inner ℂ (basis (empty : Word B N G)) + (((w.map (semicircularB (N := N) (G := G))).prod * unitaryG (B := B) (N := N) g) (basis empty)) = _ + rw [mul_apply_eq_comp, unitaryG_basis] + have hv : basis (leftG g (empty : Word B N G)) = signalSlice g (Fock.basisVector []) := by + simp [leftG, empty] + rw [hv, ← ContinuousLinearMap.comp_apply, signalSlice_word, + ContinuousLinearMap.comp_apply, signalSlice_vacuum_coefficient] + by_cases hg : g = 1 <;> simp [hg, trace, Fock.tracialVector] + + theorem trace_semicircularB_pow {p : ℕ} (b : Fin p) (k : ℕ) : + trace (tracialVector (Fin p) N G) (semicircularB b ^ k) = + if Even k then (catalan (k / 2) : ℂ) else 0 := by + have h := tensor_word_moment (N := N) (List.replicate k b) (1 : G) + simpa [Fock.semicircular_moments] using h + + theorem unitaryG_commutes_creationB (g : G) (b : B) : + Commute (unitaryG (N := N) g) (creationB b) := by + apply LabelHilbert.lift_commute + intro w + rfl + + theorem unitaryG_commutes_semicircularB (g : G) (b : B) : + Commute (unitaryG (N := N) g) (semicircularB b) := by + apply (unitaryG_commutes_creationB g b).add_right + simpa using (unitaryG_commutes_creationB (N := N) g⁻¹ b).star_star + +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/TensorMatrices.lean b/lean/OAI/Analysis/FreeEntropy/TensorMatrices.lean new file mode 100644 index 0000000000000000000000000000000000000000..2dc3a334a8aa80b11fe355771ad0b0e607e03fed --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/TensorMatrices.lean @@ -0,0 +1,65 @@ +import OAI.Analysis.FreeEntropy.MatrixBlocks + +namespace OAI + +noncomputable section +open Finset +namespace FiniteEntropySeparation +open FreeSeries FreeTensor + def tensorMatrixTuple {p d : ℕ} (A : Fin p → Matrix (Fin d) (Fin d) ℂ) : Option (Fin p) → Matrix (Fin (d*p)) (Fin (d*p)) ℂ := + fun a => matrixBlocks (fun l : Fin p => optionTuple A ((equidiscreteAtom p l:ℂ) • (1 : Matrix (Fin d) (Fin d) ℂ)) a) + theorem tensorMatrixTuple_some {p d : ℕ} (A : Fin p → Matrix (Fin d) (Fin d) ℂ) (i : Fin p) : + tensorMatrixTuple A (some i)=matrixBlocks (fun _ => A i) := rfl + theorem tensorMatrixTuple_none {p d : ℕ} (A : Fin p → Matrix (Fin d) (Fin d) ℂ) : + tensorMatrixTuple A none=matrixBlocks (fun l : Fin p => (equidiscreteAtom p l:ℂ) • (1 : Matrix (Fin d) (Fin d) ℂ)) := rfl + theorem tensorMatrixTuple_norm_le {p d : ℕ} (hp : 2≤p) (A : Fin p → Matrix (Fin d) (Fin d) ℂ) + (hA : ∀ i,matrixOpNorm (A i)≤64) (a : Option (Fin p)) : matrixOpNorm (tensorMatrixTuple A a)≤64 := by + apply matrixBlocks_norm_le _ (by norm_num) + intro l + cases a with + | some i => exact hA i + | none => + change matrixOpNorm ((equidiscreteAtom p l:ℂ) • (1 : Matrix (Fin d) (Fin d) ℂ))≤64 + rw [matrixOpNorm_smul,Complex.norm_real,Real.norm_eq_abs] + have h := mul_le_mul (equidiscreteAtom_abs_le hp l) (matrixOpNorm_one (d:=d)) (matrixOpNorm_nonneg _) (by norm_num : (0:ℝ)≤1) + norm_num at h ⊢ + linarith + theorem tensorMatrixTuple_isHermitian {p d : ℕ} (A : Fin p → Matrix (Fin d) (Fin d) ℂ) + (hA : ∀ i,(A i).IsHermitian) (a : Option (Fin p)) : (tensorMatrixTuple A a).IsHermitian := by + apply matrixBlocks_isHermitian + intro l + cases a with + | some i => exact hA i + | none => + change (((equidiscreteAtom p l:ℂ) • (1 : Matrix (Fin d) (Fin d) ℂ))).IsHermitian + simp [Matrix.IsHermitian,Matrix.conjTranspose_smul] + theorem tensorMatrixTuple_word {p d : ℕ} (A : Fin p → Matrix (Fin d) (Fin d) ℂ) (w : List (Option (Fin p))) : + matrixWord (tensorMatrixTuple A) w = matrixBlocks (fun l : Fin p => (equidiscreteAtom p l:ℂ)^(w.count none) • matrixWord A (w.filterMap id)) := by + let F : Option (Fin p) → (Fin p → Matrix (Fin d) (Fin d) ℂ) := + fun a l => optionTuple A ((equidiscreteAtom p l:ℂ) • (1 : Matrix (Fin d) (Fin d) ℂ)) a + have hmap : matrixWord (tensorMatrixTuple A) w = matrixBlocks (w.map F).prod := by + change (w.map (fun a => matrixBlocks (F a))).prod = matrixBlocks (w.map F).prod + rw [map_list_prod,List.map_map] + rfl + rw [hmap] + clear hmap + congr 1 + funext l + have he : (w.map F).prod l = (w.map (optionTuple A ((equidiscreteAtom p l:ℂ) • (1 : Matrix (Fin d) (Fin d) ℂ)))).prod := by + induction w with + | nil => rfl + | cons a w ih => simp only [List.map_cons,List.prod_cons,Pi.mul_apply,ih]; rfl + rw [he,option_word_product _ _ (fun i => (Commute.one_left (A i)).smul_left _)] + rw [smul_pow,one_pow,mul_smul_comm,mul_one] + rfl + theorem tensorMatrixTuple_moment {p d : ℕ} (A : Fin p → Matrix (Fin d) (Fin d) ℂ) (w : List (Option (Fin p))) : + matrixTraceWord (tensorMatrixTuple A) w = matrixTraceWord A (w.filterMap id) * + ((p:ℂ)⁻¹ * ∑ l : Fin p, (equidiscreteAtom p l:ℂ)^(w.count none)) := by + simp only [matrixTraceWord,tensorMatrixTuple_word,trace_matrixBlocks,Matrix.trace_smul,smul_eq_mul,Nat.cast_mul,mul_inv_rev] + rw [← Finset.sum_mul] + ring +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/TensorMatrixModels.lean b/lean/OAI/Analysis/FreeEntropy/TensorMatrixModels.lean new file mode 100644 index 0000000000000000000000000000000000000000..01865caa905de979965db6245428ed1293744bb8 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/TensorMatrixModels.lean @@ -0,0 +1,39 @@ +import OAI.Analysis.FreeEntropy.TensorMatrices + +namespace OAI + +noncomputable section +open Filter +open scoped Topology +namespace FiniteEntropySeparation +open FreeSeries FreeTensor + theorem exists_tensor_matrix_models (p : ℕ) [NeZero p] (hp : 2≤p) : + ∃ (D : ℕ → ℕ) (A : (k : ℕ) → Fin (p+1) → Matrix (Fin (D k)) (Fin (D k)) ℂ), + (∀ k,0 matrixTraceWord (A k) w) atTop (𝓝 (Model.signalMoments p w)) := by + obtain ⟨D,A,hD0,hD,hA,hAH,hM⟩ := exists_free_matrix_models p + let E := fun k => D k*p + let T := fun k (i : Fin (p+1)) => tensorMatrixTuple (A k) ((optionFin p).symm i) + refine ⟨E,T,fun k => Nat.mul_pos (hD0 k) (by omega),?_,?_,?_,?_⟩ + · apply tendsto_atTop_mono _ hD + intro k + dsimp [E] + exact Nat.le_mul_of_pos_right _ (by omega) + · intro k i; exact tensorMatrixTuple_norm_le hp (A k) (hA k) _ + · intro k i; exact tensorMatrixTuple_isHermitian (A k) (hAH k) _ + · intro w + let v := w.map (optionFin p).symm + have he : v.map (optionFin p)=w := by simp [v,List.map_map] + have ht (k : ℕ) : matrixTraceWord (T k) w = matrixTraceWord (tensorMatrixTuple (A k)) v := by + rw [matrixTraceWord_map]; rfl + have hm : Model.signalMoments p w = FreeSeries.fockMoments p (v.filterMap id) * + ((p:ℂ)⁻¹ * ∑ l : Fin p, (equidiscreteAtom p l:ℂ)^(v.count none)) := by + rw [← he,Model.signal_option_moments, equidiscreteSignal_moments] + simp only [ht,tensorMatrixTuple_moment,hm] + exact (hM (v.filterMap id)).mul_const _ +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/TensorPoincare.lean b/lean/OAI/Analysis/FreeEntropy/TensorPoincare.lean new file mode 100644 index 0000000000000000000000000000000000000000..93e87a3a966d448e6b8824454cfc20fd40b205ed --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/TensorPoincare.lean @@ -0,0 +1,92 @@ +import OAI.Analysis.FreeEntropy.OrthogonalExpansion + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory ProbabilityTheory Finset +namespace FiniteEntropySeparation +variable {ι : Type u1} [Fintype ι] [DecidableEq ι] + def coordinateDerivative (f : (ι → ℝ) → ℝ) (i : ι) (x : ι → ℝ) : ℝ := + deriv (fun t => f (Function.update x i t)) (x i) + theorem tensorExpansion_hasDerivAt (a : (ι → ℕ) →₀ ℝ) (i : ι) (x : ι → ℝ) : + HasDerivAt (fun t => linearExpand tensorHermite a (Function.update x i t)) + (linearExpand (fun k => tensorGradient k i) a x) (x i) := by + simp only [linearExpand_apply] + exact HasDerivAt.fun_sum (fun k _ => (tensorHermite_hasDerivAt k i x).const_mul (a k)) + theorem tensorExpansion_derivative (a : (ι → ℕ) →₀ ℝ) (i : ι) : + coordinateDerivative (linearExpand tensorHermite a) i = linearExpand (fun k => tensorGradient k i) a := by + funext x + exact (tensorExpansion_hasDerivAt a i x).deriv + theorem tensorExpansion_mean (a : (ι → ℕ) →₀ ℝ) : + (∫ x, linearExpand tensorHermite a x ∂productGaussian ι) = a 0 := by + rw [linearExpand_integral tensorHermite_integrable] + simp_rw [tensorHermite_mean] + simp_all + theorem tensorExpansion_energy (a : (ι → ℕ) →₀ ℝ) (i : ι) : + (∫ x, (coordinateDerivative (linearExpand tensorHermite a) i x)^2 ∂productGaussian ι) = + ∑ k ∈ a.support, (k i : ℝ)*(a k)^2*tensorWeight k := by + rw [tensorExpansion_derivative] + simp only [pow_two] + rw [linearExpand_orthogonal (fun k l => tensorGradient_mul_integrable k l i) + (fun k => (k i : ℝ)*tensorWeight k) (fun k l => tensorGradient_inner k l i)] + apply sum_congr rfl + intro k hk + ring + theorem tensorExpansion_variance (a : (ι → ℕ) →₀ ℝ) : + (∫ x, (linearExpand tensorHermite a x - ∫ y, linearExpand tensorHermite a y ∂productGaussian ι)^2 + ∂productGaussian ι) = (∑ k ∈ a.support, (a k)^2*tensorWeight k) - (a 0)^2 := by + rw [integral_center_sq (linearExpand_integrable tensorHermite_integrable _) + (linearExpand_mul_integrable tensorHermite_mul_integrable _ _), + linearExpand_orthogonal tensorHermite_mul_integrable tensorWeight tensorHermite_inner, + tensorExpansion_mean] + simp only [pow_two] + theorem tensorDegree_ge_one {ι : Type u1} [Fintype ι] [DecidableEq ι] {k : ι → ℕ} (hk : k ≠ 0) : (1 : ℝ) ≤ ∑ i, (k i : ℝ) := by + classical + obtain ⟨i,hi⟩ : ∃ i, k i ≠ 0 := by + by_contra h + apply hk + funext i + by_contra hi + exact h ⟨i,hi⟩ + calc + (1 : ℝ) ≤ k i := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr hi + _ ≤ ∑ j, (k j : ℝ) := single_le_sum (f := fun j => (k j : ℝ)) (fun j _ => by positivity) (mem_univ i) + theorem tensorExpansion_poincare (a : (ι → ℕ) →₀ ℝ) : + (∫ x, (linearExpand tensorHermite a x - ∫ y, linearExpand tensorHermite a y ∂productGaussian ι)^2 + ∂productGaussian ι) ≤ + ∑ i, ∫ x, (coordinateDerivative (linearExpand tensorHermite a) i x)^2 ∂productGaussian ι := by + classical + rw [tensorExpansion_variance] + simp_rw [tensorExpansion_energy] + rw [sum_comm] + have hz : (a 0)^2 = ∑ k ∈ a.support, if k=0 then (a k)^2 else 0 := by simp + rw [hz, ← sum_sub_distrib] + apply sum_le_sum + intro k hk + by_cases hk0 : k=0 + · subst k; simp [tensorWeight] + · rw [ite_eq_right hk0, sub_zero] + simp only [← sum_mul] + have hd := tensorDegree_ge_one hk0 + have hw : 0 ≤ (a k)^2*tensorWeight k := mul_nonneg (sq_nonneg _) (tensorWeight_pos k).le + nlinarith + + theorem gaussian_mvPolynomial_poincare (P : MvPolynomial ι ℝ) : + (∫ x, (MvPolynomial.eval x P - ∫ y, MvPolynomial.eval y P ∂productGaussian ι)^2 ∂productGaussian ι) ≤ + ∑ i, ∫ x, (coordinateDerivative (fun y => MvPolynomial.eval y P) i x)^2 ∂productGaussian ι := by + obtain ⟨a,ha⟩ := mvPolynomial_hermite_expansion P + change (fun x => MvPolynomial.eval x P) = linearExpand tensorHermite a at ha + simpa only [← ha] using tensorExpansion_poincare a + theorem gaussian_mvPolynomial_integrable (P : MvPolynomial ι ℝ) : + Integrable (fun x => MvPolynomial.eval x P) (productGaussian ι) := by + obtain ⟨a,ha⟩ := mvPolynomial_hermite_expansion P + change (fun x => MvPolynomial.eval x P) = linearExpand tensorHermite a at ha + rw [ha] + exact linearExpand_integrable tensorHermite_integrable a +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/TerminalGaussian.lean b/lean/OAI/Analysis/FreeEntropy/TerminalGaussian.lean new file mode 100644 index 0000000000000000000000000000000000000000..dbfc0e13f7a00f96537dd1b7dabc752b1b3db35c --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/TerminalGaussian.lean @@ -0,0 +1,83 @@ +import OAI.Analysis.FreeEntropy.GaussianCrossEntropy + +namespace OAI + +noncomputable section +open MeasureTheory Filter Finset Set +open scoped Topology +namespace FiniteEntropySeparation +namespace Model +variable (p : ℕ) [NeZero p] +variable {D : ℕ → ℕ} (hD0 : ∀k,0 ∫a,totalSecond (matrixMoment a) ∂matrixHeatLaw (μ k) s) atTop + (𝓝 (totalSecond (wordMoment (τ p) (heatTuple (X p h) (auxiliaryNoise p) s)))) := by + have hb k : ∀ᵐa ∂μ k,∀i,matrixOpNorm (hermitianMatrix a i)≤R := (hμ k).mono (fun _ ha => ha.1) + have hi k i : Integrable (fun a => (matrixMoment a [i,i]).re) (matrixHeatLaw (μ k) s) := + (matrixHeatLaw_moment_integrable (hD0 k) (μ k) hR (hb k) hs [i,i]).re + have ht i := Complex.continuous_re.continuousAt.tendsto.comp (FreeTensor.matrixHeatLaw_moment_tendsto hD0 hD (oldNoise p) (X p h) + (X_mem_background p h) hR hn (auxiliaryIndex p) (auxiliaryIndex_injective p) + (auxiliaryIndex_fresh p) μ hμ hs [i,i]) + have he k : (∫a,totalSecond (matrixMoment a) ∂matrixHeatLaw (μ k) s)= + ∑i : Fin (p+1),(∫a,matrixMoment a [i,i] ∂matrixHeatLaw (μ k) s).re := by + unfold totalSecond + rw [integral_finsetSum univ (fun i _ => hi k i)] + apply sum_congr rfl + intro i _ + exact integral_re (matrixHeatLaw_moment_integrable (hD0 k) (μ k) hR (hb k) hs [i,i]) + simp_rw [he] + exact tendsto_finsetSum univ (fun i _ => ht i) +end Model + + theorem chosen_terminal_isotropic {D : ℕ → ℕ} (hD0 : ∀k,0 add_le_add (variance_le_one p hp i) (le_refl h)) + _ = _ := by simp only [sum_const,card_univ,Fintype.card_fin,nsmul_eq_mul,Nat.cast_add,Nat.cast_one] + have hp' : (2:ℝ)≤p := by exact_mod_cast hp + nlinarith + theorem totalSecond_heat_le (hp : 2≤p) {h s : ℝ} (hh : 0≤h) (hs : 0 ≤ s) : + totalSecond (wordMoment (τ p) (heatTuple (X p h) (auxiliaryNoise p) s))≤(p+1:ℝ)*(1+h+s) := by + have hsa := FreeTensor.heatTuple_selfAdjoint (X p h) (auxiliaryNoise p) (X_selfAdjoint p h) (auxiliaryNoise_selfAdjoint p) s + simp only [totalSecond,wordMoment_second (τ p) _ hsa] + change (∑i : Fin (p+1),‖doublyNoised p h s i (τ p).vacuum‖^2)≤_ + simp only [doublyNoised_variance p h s hh hs] + calc + _ ≤ ∑i : Fin (p+1),(1+h+s) := sum_le_sum (fun i _ => by + have hb := variance_le_one p hp i + change ‖C p i (τ p).vacuum‖^2≤1 at hb + linarith) + _ = _ := by simp only [sum_const,card_univ,Fintype.card_fin,nsmul_eq_mul,Nat.cast_add,Nat.cast_one] + theorem diagonalMicrostates_norm_eventually (hp : 2≤p) {h : ℝ} (hh : 0≤h) (hh1 : h<1) (R : ℝ) : + ∀ᶠk : ℕ in atTop,∀d : ℕ,0 some (g b)), lift_single] + · rfl + · intro a b + simp only [Option.some.injEq] + constructor + · intro h + rw [← h, hgf b] + · intro h + rw [← h, hfg a] + +def keepLinear (P : α → Prop) [DecidablePred P] : Space α →ₗ[ℂ] Space α where + toFun x := ⟨fun a => if P a then x a else 0, (lp.memℓp x).mono' (by + intro a + split_ifs <;> simp)⟩ + map_add' x y := by + apply lp.ext + funext a + change (if P a then x a + y a else 0) = + (if P a then x a else 0) + (if P a then y a else 0) + by_cases h : P a <;> simp [h] + map_smul' c x := by + apply lp.ext + funext a + by_cases h : P a <;> simp [h] + +def keep (P : α → Prop) [DecidablePred P] : Space α →L[ℂ] Space α := + (keepLinear P).mkContinuous 1 (by + intro x + simp only [one_mul] + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro a + change ‖if P a then x a else 0‖ ≤ ‖x a‖ + split_ifs <;> simp) + +omit [DecidableEq α] in +@[simp] theorem keep_apply (P : α → Prop) [DecidablePred P] (x : Space α) (a : α) : + keep P x a = if P a then x a else 0 := rfl + + theorem keep_single (P : α → Prop) [DecidablePred P] (a : α) (z : ℂ) : + keep P (lp.single 2 a z) = if P a then lp.single 2 a z else 0 := by + apply lp.ext + funext b + by_cases h : b = a + · subst b; split_ifs <;> simp_all + · by_cases ha : P a <;> by_cases hb : P b <;> + simp [ha, hb, lp.single_apply, h] + +@[simp] theorem star_keep (P : α → Prop) [DecidablePred P] : star (keep P) = keep P := by + apply ContinuousLinearMap.ext + intro x + apply lp.ext + funext a + have h := ContinuousLinearMap.adjoint_inner_right (keep P) (basis a) x + change inner ℂ (basis a) (star (keep P) x) = inner ℂ (keep P (basis a)) x at h + rw [basis, keep_single] at h + by_cases ha : P a <;> simpa [ha, lp.inner_single_left] using h + +end LabelHilbert +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +@[simp] theorem leftG_one (w : Word B N G) : leftG 1 w = w := by + rcases w with ⟨⟨v,g⟩,t⟩ + simp [leftG] + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +@[simp] theorem leftG_mul (g h : G) (w : Word B N G) : + leftG (g*h) w = leftG g (leftG h w) := by + simp [leftG, mul_assoc] + +@[simp] theorem unitaryG_one : unitaryG (B := B) (N := N) (1 : G) = 1 := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro a + apply ContinuousLinearMap.ext + intro z + change unitaryG 1 (lp.single 2 a z) = lp.single 2 a z + rw [unitaryG_single, leftG_one] + +@[simp] theorem unitaryG_mul (g h : G) : + unitaryG (B := B) (N := N) (g*h) = unitaryG g * unitaryG h := by + unfold unitaryG + rw [LabelHilbert.lift_mul] + congr 1 + exact funext (leftG_mul g h) + +@[simp] theorem star_unitaryG (g : G) : + star (unitaryG (B := B) (N := N) g) = unitaryG g⁻¹ := by + apply LabelHilbert.lift_inverse + · intro w; rw [← leftG_mul]; simp + · intro w; rw [← leftG_mul]; simp + +@[simp] theorem star_rightUnitaryG (g : G) : + star (rightUnitaryG (B := B) (N := N) g) = rightUnitaryG g⁻¹ := by + apply LabelHilbert.lift_inverse + · intro w; simp [rightG, ← leftG_mul] + · intro w; simp [rightG, ← leftG_mul] + + theorem unitaryG_commutes_rightCreationB (g : G) (b : B) : + Commute (unitaryG (N := N) g) (rightCreationB b) := + LabelHilbert.lift_commute _ _ _ _ (leftG_rightB g b) + + theorem unitaryG_commutes_rightCreationN (g : G) (i : N) : + Commute (unitaryG (B := B) g) (rightCreationN i) := + LabelHilbert.lift_commute _ _ _ _ (leftG_rightN g i) + + theorem creationB_commutes_rightUnitaryG (b : B) (g : G) : + Commute (creationB (N := N) b) (rightUnitaryG g) := + LabelHilbert.lift_commute _ _ _ _ (leftB_rightG b g) + + theorem creationN_commutes_rightUnitaryG (i : N) (g : G) : + Commute (creationN (B := B) i) (rightUnitaryG g) := + LabelHilbert.lift_commute _ _ _ _ (leftN_rightG i g) + + theorem unitaryG_commutes_rightUnitaryG (g h : G) : + Commute (unitaryG (B := B) (N := N) g) (rightUnitaryG h) := + LabelHilbert.lift_commute _ _ _ _ (leftG_rightG g h) + + theorem unitaryG_commutes_rightAnnihilationB (g : G) (b : B) : + Commute (unitaryG (N := N) g) (star (rightCreationB b)) := by + have h := (unitaryG_commutes_rightCreationB (N := N) g⁻¹ b).star_star + simpa using h + + theorem unitaryG_commutes_rightAnnihilationN (g : G) (i : N) : + Commute (unitaryG (B := B) g) (star (rightCreationN i)) := by + have h := (unitaryG_commutes_rightCreationN (B := B) g⁻¹ i).star_star + simpa using h + + theorem annihilationB_commutes_rightUnitaryG (b : B) (g : G) : + Commute (star (creationB (N := N) b)) (rightUnitaryG g) := by + have h := (creationB_commutes_rightUnitaryG (N := N) b g⁻¹).star_star + simpa using h + + theorem annihilationN_commutes_rightUnitaryG (i : N) (g : G) : + Commute (star (creationN (B := B) i)) (rightUnitaryG g) := by + have h := (creationN_commutes_rightUnitaryG (B := B) i g⁻¹).star_star + simpa using h + +def signalBoundary : Space B N G →L[ℂ] Space B N G := + LabelHilbert.keep (fun w : Word B N G => w.1.1 = [] ∧ w.2 = []) + +def vacuumBoundary : Space B N G →L[ℂ] Space B N G := + LabelHilbert.keep (fun w : Word B N G => w = empty) + +omit [Group G] in +@[simp] theorem signalBoundary_single (w : Word B N G) (z : ℂ) : + signalBoundary (lp.single 2 w z) = + if w.1.1 = [] ∧ w.2 = [] then lp.single 2 w z else 0 := + LabelHilbert.keep_single _ _ _ + +@[simp] theorem vacuumBoundary_single (w : Word B N G) (z : ℂ) : + vacuumBoundary (lp.single 2 w z) = if w = empty then lp.single 2 w z else 0 := + LabelHilbert.keep_single _ _ _ + + theorem rightAnnihilationN_creationN (i j : N) : + star (rightCreationN (B := B) (G := G) i) * creationN j = + creationN j * star (rightCreationN i) + if i = j then vacuumBoundary else 0 := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change star (rightCreationN i) (creationN j (lp.single 2 w z)) = + creationN j (star (rightCreationN i) (lp.single 2 w z)) + + (if i = j then vacuumBoundary else 0) (lp.single 2 w z) + rcases w with ⟨a,t⟩ + induction t using List.reverseRecOn with + | nil => + rw [rightAnnihilationN_atom, map_zero, zero_add, creationN_single] + change star (rightCreationN i) (lp.single 2 (append empty j a) z) = _ + rw [rightAnnihilationN_append] + by_cases ha : a = ([],1) <;> by_cases hij : i = j <;> + simp [ha, hij, empty] + | append_singleton t c _ => + rcases c with ⟨k,c⟩ + rw [creationN_single] + change star (rightCreationN i) (lp.single 2 (append (leftN j (a,t)) k c) z) = + creationN j (star (rightCreationN i) (lp.single 2 (append (a,t) k c) z)) + _ + rw [rightAnnihilationN_append, rightAnnihilationN_append] + by_cases hij : i = j <;> simp only [hij, ↓reduceIte, zero_apply] + all_goals simp only [vacuumBoundary_single, empty, Prod.mk.injEq, + List.append_eq_nil_iff, List.cons_ne_self, and_false, ↓reduceIte, add_zero] + all_goals split_ifs <;> simp + + theorem rightAnnihilationB_creationB_atom (b c : B) (v : List B) (g : G) (z : ℂ) : + star (rightCreationB (N := N) b) (creationB c (lp.single 2 ((v,g),[]) z)) = + creationB c (star (rightCreationB b) (lp.single 2 ((v,g),[]) z)) + + (if b = c then signalBoundary else 0) (lp.single 2 ((v,g),[]) z) := by + induction v using List.reverseRecOn with + | nil => + rw [rightAnnihilationB_atom_nil, map_zero, zero_add, creationB_single] + simp only [leftB] + rw [show [c] = [] ++ [c] from rfl, rightAnnihilationB_atom_append] + by_cases h : b = c <;> simp only [h, ↓reduceIte, signalBoundary_single, + and_self, zero_apply] + | append_singleton v a _ => + rw [rightAnnihilationB_atom_append, creationB_single] + simp only [leftB] at * + rw [show c :: (v ++ [a]) = (c :: v) ++ [a] from rfl, rightAnnihilationB_atom_append] + by_cases hc : b = c <;> simp only [hc, ↓reduceIte, signalBoundary_single, + List.append_eq_nil_iff, List.cons_ne_nil, and_false, false_and, + zero_apply, add_zero] + all_goals split_ifs <;> simp [leftB] + + theorem rightAnnihilationB_creationB_append (b c : B) (w : Word B N G) (i : N) + (a : Atom B G) (z : ℂ) : + star (rightCreationB b) (creationB c (lp.single 2 (append w i a) z)) = + creationB c (star (rightCreationB b) (lp.single 2 (append w i a) z)) := by + rcases a with ⟨v,g⟩ + rw [creationB_single] + change star (rightCreationB b) (lp.single 2 (append (leftB c w) i (v,g)) z) = _ + induction v using List.reverseRecOn with + | nil => rw [rightAnnihilationB_append_nil, rightAnnihilationB_append_nil, map_zero] + | append_singleton v a _ => + rw [rightAnnihilationB_append_append, rightAnnihilationB_append_append] + by_cases h : b = a <;> simp only [h, ↓reduceIte, map_zero, creationB_single] + rfl + + theorem rightAnnihilationB_creationB (b c : B) : + star (rightCreationB (N := N) (G := G) b) * creationB c = + creationB c * star (rightCreationB b) + if b = c then signalBoundary else 0 := by + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change star (rightCreationB b) (creationB c (lp.single 2 w z)) = + creationB c (star (rightCreationB b) (lp.single 2 w z)) + + (if b = c then signalBoundary else 0) (lp.single 2 w z) + rcases w with ⟨⟨v,g⟩,t⟩ + induction t using List.reverseRecOn with + | nil => exact rightAnnihilationB_creationB_atom b c v g z + | append_singleton t d _ => + rcases d with ⟨k,a⟩ + change star (rightCreationB b) (creationB c (lp.single 2 (append ((v,g),t) k a) z)) = _ + rw [rightAnnihilationB_creationB_append] + by_cases h : b = c <;> simp [h, append] + +def semicircularB (b : B) : Space B N G →L[ℂ] Space B N G := creationB b + star (creationB b) +def semicircularN (i : N) : Space B N G →L[ℂ] Space B N G := creationN i + star (creationN i) +def rightSemicircularB (b : B) : Space B N G →L[ℂ] Space B N G := + rightCreationB b + star (rightCreationB b) +def rightSemicircularN (i : N) : Space B N G →L[ℂ] Space B N G := + rightCreationN i + star (rightCreationN i) + +omit [Group G] in +@[simp] theorem star_semicircularB (b : B) : + star (semicircularB (N := N) (G := G) b) = semicircularB b := by + exact IsSelfAdjoint.add_star_self (creationB b) +@[simp] theorem star_semicircularN (i : N) : + star (semicircularN (B := B) (G := G) i) = semicircularN i := by + exact IsSelfAdjoint.add_star_self (creationN i) +@[simp] theorem star_rightSemicircularB (b : B) : + star (rightSemicircularB (N := N) (G := G) b) = rightSemicircularB b := by + exact IsSelfAdjoint.add_star_self (rightCreationB b) +@[simp] theorem star_rightSemicircularN (i : N) : + star (rightSemicircularN (B := B) (G := G) i) = rightSemicircularN i := by + exact IsSelfAdjoint.add_star_self (rightCreationN i) + + theorem semicircularB_commutes_rightB (b c : B) : + Commute (semicircularB (N := N) (G := G) b) (rightSemicircularB c) := by + apply commute_add_star_of_boundary _ _ _ + (LabelHilbert.lift_commute _ _ _ _ (leftB_rightB b c)) + (rightAnnihilationB_creationB c b) + split_ifs <;> simp [signalBoundary] + + theorem semicircularN_commutes_rightN (i j : N) : + Commute (semicircularN (B := B) (G := G) i) (rightSemicircularN j) := by + apply commute_add_star_of_boundary _ _ _ + (LabelHilbert.lift_commute _ _ _ _ (leftN_rightN i j)) + (rightAnnihilationN_creationN j i) + split_ifs <;> simp [vacuumBoundary] + + theorem semicircularB_commutes_rightN (b : B) (i : N) : + Commute (semicircularB (G := G) b) (rightSemicircularN i) := by + have h : Commute (creationB (G := G) b) (rightCreationN i) := + LabelHilbert.lift_commute _ _ _ _ (leftB_rightN b i) + have hs := creationB_commutes_rightAnnihilationN (G := G) b i + have hsl : Commute (star (creationB (G := G) b)) (rightCreationN i) := by + simpa using hs.star_star + exact (h.add_right hs).add_left (hsl.add_right h.star_star) + + theorem semicircularN_commutes_rightB (i : N) (b : B) : + Commute (semicircularN (G := G) i) (rightSemicircularB b) := by + have h : Commute (creationN (G := G) i) (rightCreationB b) := + LabelHilbert.lift_commute _ _ _ _ (leftN_rightB i b) + have hs := creationN_commutes_rightAnnihilationB (G := G) i b + have hsl : Commute (star (creationN (G := G) i)) (rightCreationB b) := by + simpa using hs.star_star + exact (h.add_right hs).add_left (hsl.add_right h.star_star) + + theorem semicircularB_commutes_rightG (b : B) (g : G) : + Commute (semicircularB (N := N) b) (rightUnitaryG g) := + (creationB_commutes_rightUnitaryG b g).add_left (annihilationB_commutes_rightUnitaryG b g) + + theorem semicircularN_commutes_rightG (i : N) (g : G) : + Commute (semicircularN (B := B) i) (rightUnitaryG g) := + (creationN_commutes_rightUnitaryG i g).add_left (annihilationN_commutes_rightUnitaryG i g) + + theorem unitaryG_commutes_rightB (g : G) (b : B) : + Commute (unitaryG (N := N) g) (rightSemicircularB b) := + (unitaryG_commutes_rightCreationB g b).add_right (unitaryG_commutes_rightAnnihilationB g b) + + theorem unitaryG_commutes_rightN (g : G) (i : N) : + Commute (unitaryG (B := B) g) (rightSemicircularN i) := + (unitaryG_commutes_rightCreationN g i).add_right (unitaryG_commutes_rightAnnihilationN g i) + +abbrev Generator (B N G : Type) := B ⊕ N ⊕ G + +def leftGenerator : Generator B N G → Space B N G →L[ℂ] Space B N G + | .inl b => semicircularB b + | .inr (.inl i) => semicircularN i + | .inr (.inr g) => unitaryG g + +def rightGenerator : Generator B N G → Space B N G →L[ℂ] Space B N G + | .inl b => rightSemicircularB b + | .inr (.inl i) => rightSemicircularN i + | .inr (.inr g) => rightUnitaryG g + +def inverseGenerator : Generator B N G → Generator B N G + | .inl b => .inl b + | .inr (.inl i) => .inr (.inl i) + | .inr (.inr g) => .inr (.inr g⁻¹) + +@[simp] theorem star_leftGenerator (k : Generator B N G) : + star (leftGenerator k) = leftGenerator (inverseGenerator k) := by + rcases k with b | (i | g) <;> simp [leftGenerator, inverseGenerator] + +@[simp] theorem star_rightGenerator (k : Generator B N G) : + star (rightGenerator k) = rightGenerator (inverseGenerator k) := by + rcases k with b | (i | g) <;> simp [rightGenerator, inverseGenerator] + + theorem generators_commute (j k : Generator B N G) : + Commute (leftGenerator j) (rightGenerator k) := by + rcases j with b | (i | g) <;> rcases k with c | (j | h) + · exact semicircularB_commutes_rightB b c + · exact semicircularB_commutes_rightN b j + · exact semicircularB_commutes_rightG b h + · exact semicircularN_commutes_rightB i c + · exact semicircularN_commutes_rightN i j + · exact semicircularN_commutes_rightG i h + · exact unitaryG_commutes_rightB g c + · exact unitaryG_commutes_rightN g j + · exact unitaryG_commutes_rightUnitaryG g h + +def algebra (B N G : Type) [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] : + VonNeumannAlgebra (Space B N G) where + toStarSubalgebra := StarSubalgebra.centralizer ℂ (Set.range rightGenerator) + centralizer_centralizer' := Set.centralizer_centralizer_centralizer _ + + theorem mem_algebra_iff (A : Space B N G →L[ℂ] Space B N G) : + A ∈ algebra B N G ↔ ∀ k : Generator B N G, Commute A (rightGenerator k) := by + change A ∈ StarSubalgebra.centralizer ℂ (Set.range rightGenerator) ↔ _ + rw [StarSubalgebra.mem_centralizer_iff] + constructor + · intro h k + exact (h _ ⟨k,rfl⟩).1.symm + · rintro h _ ⟨k,rfl⟩ + exact ⟨(h k).eq.symm, by rw [star_rightGenerator]; exact (h _).eq.symm⟩ + + theorem leftGenerator_mem (k : Generator B N G) : leftGenerator k ∈ algebra B N G := + (mem_algebra_iff _).mpr (generators_commute k) + +def rightWick : Word B N G → Space B N G →L[ℂ] Space B N G + | (([],g),[]) => rightUnitaryG g + | (([b],g),t) => rightSemicircularB b * rightWick (([],g),t) + | ((b::c::v,g),t) => rightSemicircularB b * rightWick ((c::v,g),t) - + if b = c then rightWick ((v,g),t) else 0 + | (([],g),[(i,a)]) => rightUnitaryG g * (rightSemicircularN i * rightWick (a,[])) + | (([],g),(i,a)::(j,d)::t) => rightUnitaryG g * + (rightSemicircularN i * rightWick (a,(j,d)::t) - + if a = ([],1) ∧ i = j then rightWick (d,t) else 0) +termination_by w => (w.2.length, w.1.1.length) + + theorem commute_rightWick (A : Space B N G →L[ℂ] Space B N G) + (hA : ∀ k : Generator B N G, Commute A (rightGenerator k)) (w : Word B N G) : + Commute A (rightWick w) := by + induction w using rightWick.induct with + | case1 g => + rw [rightWick] + exact hA (.inr (.inr g)) + | case2 b g t ih => + rw [rightWick] + exact (hA (.inl b)).mul_right ih + | case3 b c v g t ih₁ ih₂ => + rw [rightWick] + apply ((hA (.inl b)).mul_right ih₁).sub_right + split_ifs + · exact ih₂ + · exact Commute.zero_right A + | case4 g i a ih => + rw [rightWick] + exact (hA (.inr (.inr g))).mul_right ((hA (.inr (.inl i))).mul_right ih) + | case5 g i a j d t ih₁ ih₂ => + rw [rightWick] + apply (hA (.inr (.inr g))).mul_right + apply ((hA (.inr (.inl i))).mul_right ih₁).sub_right + split_ifs + · exact ih₂ + · exact Commute.zero_right A + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +@[simp] theorem reverse_empty : reverse (B := B) (N := N) (G := G) empty = empty := by + simp [empty, reverseAtom] + +@[simp] theorem rightUnitaryG_basis_reverse (g : G) (w : Word B N G) : + rightUnitaryG g (basis (reverse w)) = basis (reverse (leftG g w)) := by + simp [basis, rightG] + + theorem rightSemicircularB_basis_reverse (b : B) (w : Word B N G) : + rightSemicircularB b (basis (reverse w)) = basis (reverse (leftB b w)) + + (removeB b w).elim 0 (fun a => basis (reverse a)) := by + rw [rightSemicircularB, add_apply, basis, rightCreationB_single, rightAnnihilationB_single, + reverse_involutive] + simp only [rightB, reverse_involutive] + cases removeB b w <;> rfl + + theorem rightSemicircularN_basis_reverse (i : N) (w : Word B N G) : + rightSemicircularN i (basis (reverse w)) = basis (reverse (leftN i w)) + + (removeN i w).elim 0 (fun a => basis (reverse a)) := by + rw [rightSemicircularN, add_apply, basis, rightCreationN_single, rightAnnihilationN_single, + reverse_involutive] + simp only [rightN, reverse_involutive] + cases removeN i w <;> rfl + +@[simp] theorem rightWick_vacuum (w : Word B N G) : + rightWick w (basis empty) = basis (reverse w) := by + induction w using rightWick.induct with + | case1 g => simp [rightWick, basis, empty, reverseAtom] + | case2 b g t ih => + rw [rightWick, mul_apply_eq_comp, ih, rightSemicircularB_basis_reverse] + simp [removeB, leftB] + | case3 b c v g t ih₁ ih₂ => + rw [rightWick, sub_apply, mul_apply_eq_comp, ih₁, rightSemicircularB_basis_reverse] + by_cases h : b = c <;> simp [h, removeB, leftB, ih₂] + | case4 g i a ih => + rw [rightWick, mul_apply_eq_comp, mul_apply_eq_comp, ih, + rightSemicircularN_basis_reverse] + have h : removeN i (a, ([] : List (N × Atom B G))) = none := by + simp only [removeN]; split <;> rfl + simp [h, leftN, push, leftG] + | case5 g i a j d t ih₁ ih₂ => + rw [rightWick, mul_apply_eq_comp, sub_apply, mul_apply_eq_comp, ih₁, + rightSemicircularN_basis_reverse] + by_cases ha : a = ([],1) <;> by_cases hij : i = j <;> + simp [ha, hij, ih₂, removeN, leftN, push, leftG] + +omit [DecidableEq B] [DecidableEq N] [DecidableEq G] in +@[simp] theorem inverseGenerator_involutive (k : Generator B N G) : + inverseGenerator (inverseGenerator k) = k := by + rcases k with b | (i | g) <;> simp [inverseGenerator] + +omit [Group G] in + theorem semicircularB_basis (b : B) (w : Word B N G) : + semicircularB b (basis w) = basis (leftB b w) + (removeB b w).elim 0 basis := by + simp only [semicircularB, add_apply, basis, creationB_single, annihilationB_single] + rfl + + theorem semicircularN_basis (i : N) (w : Word B N G) : + semicircularN i (basis w) = basis (leftN i w) + (removeN i w).elim 0 basis := by + simp only [semicircularN, add_apply, basis, creationN_single, annihilationN_single] + rfl + +@[simp] theorem unitaryG_basis (g : G) (w : Word B N G) : + unitaryG g (basis w) = basis (leftG g w) := by simp [basis] + +@[simp] theorem adjoint_rightGenerator_vacuum (k : Generator B N G) : + star (rightGenerator k) (basis empty) = leftGenerator k (basis empty) := by + rcases k with b | (i | g) + · simp only [rightGenerator, leftGenerator, star_rightSemicircularB] + simp [rightSemicircularB, semicircularB, basis, empty, + annihilationB_single, removeB, leftB] + · simp only [rightGenerator, leftGenerator, star_rightSemicircularN] + simp [rightSemicircularN, semicircularN, basis, empty, + annihilationN_single, removeN, leftN, append, push] + · simp [rightGenerator, leftGenerator, basis, empty, leftG] + + theorem adjoint_right_mul_vacuum (A : Space B N G →L[ℂ] Space B N G) + (h : ∀ j : Generator B N G, Commute (leftGenerator j) A) (k : Generator B N G) : + star (rightGenerator k * A) (basis empty) = leftGenerator k (star A (basis empty)) := by + have hc : Commute (leftGenerator k) (star A) := by + simpa only [star_leftGenerator, inverseGenerator_involutive] using (h (inverseGenerator k)).star_star + rw [star_mul, mul_apply_eq_comp, adjoint_rightGenerator_vacuum, + ← mul_apply_eq_comp, hc.eq.symm, mul_apply_eq_comp] + + theorem adjoint_rightB_mul_vacuum (A : Space B N G →L[ℂ] Space B N G) + (h : ∀ j : Generator B N G, Commute (leftGenerator j) A) (b : B) : + star (rightSemicircularB (N := N) (G := G) b * A) (basis empty) = semicircularB b (star A (basis empty)) := + adjoint_right_mul_vacuum A h (.inl b) + + theorem adjoint_rightN_mul_vacuum (A : Space B N G →L[ℂ] Space B N G) + (h : ∀ j : Generator B N G, Commute (leftGenerator j) A) (i : N) : + star (rightSemicircularN (B := B) (G := G) i * A) (basis empty) = semicircularN i (star A (basis empty)) := + adjoint_right_mul_vacuum A h (.inr (.inl i)) + + theorem adjoint_rightG_mul_vacuum (A : Space B N G →L[ℂ] Space B N G) + (h : ∀ j : Generator B N G, Commute (leftGenerator j) A) (g : G) : + star (rightUnitaryG (B := B) (N := N) g * A) (basis empty) = unitaryG g (star A (basis empty)) := + adjoint_right_mul_vacuum A h (.inr (.inr g)) + + theorem rightWick_commutesLeft (w : Word B N G) (k : Generator B N G) : + Commute (leftGenerator k) (rightWick w) := + commute_rightWick _ (generators_commute k) w + +@[simp] theorem adjoint_rightWick_vacuum (w : Word B N G) : + star (rightWick w) (basis empty) = basis w := by + induction w using rightWick.induct with + | case1 g => simp [rightWick, basis, empty] + | case2 b g t ih => + rw [rightWick, adjoint_rightB_mul_vacuum (B := B) (N := N) (G := G) _ (rightWick_commutesLeft _) b, ih] + simp [semicircularB_basis, removeB, leftB] + | case3 b c v g t ih₁ ih₂ => + rw [rightWick, star_sub (R := Space B N G →L[ℂ] Space B N G) _ _, sub_apply, + adjoint_rightB_mul_vacuum (B := B) (N := N) (G := G) _ (rightWick_commutesLeft _) b, ih₁] + by_cases h : b = c <;> simp [h, ih₂, semicircularB_basis, removeB, leftB] + | case4 g i a ih => + have hc (k : Generator B N G) : Commute (leftGenerator k) + (rightSemicircularN i * rightWick (a, ([] : List (N × Atom B G)))) := + (generators_commute k (.inr (.inl i))).mul_right (rightWick_commutesLeft _ k) + rw [rightWick, adjoint_rightG_mul_vacuum (B := B) (N := N) (G := G) _ hc g, + adjoint_rightN_mul_vacuum (B := B) (N := N) (G := G) _ (rightWick_commutesLeft _) i, ih] + have hn : removeN i (a, ([] : List (N × Atom B G))) = none := by + simp only [removeN]; split <;> rfl + simp [semicircularN_basis, hn, leftN, push, leftG] + | case5 g i a j d t ih₁ ih₂ => + have hc (k : Generator B N G) : Commute (leftGenerator k) + (rightSemicircularN i * rightWick (a,(j,d)::t) - + if a = ([],1) ∧ i = j then rightWick (d,t) else 0) := by + apply ((generators_commute k (.inr (.inl i))).mul_right (rightWick_commutesLeft _ k)).sub_right + split_ifs + · exact rightWick_commutesLeft _ k + · exact Commute.zero_right _ + rw [rightWick, adjoint_rightG_mul_vacuum (B := B) (N := N) (G := G) _ hc g, + star_sub (R := Space B N G →L[ℂ] Space B N G) _ _, sub_apply, + adjoint_rightN_mul_vacuum (B := B) (N := N) (G := G) _ (rightWick_commutesLeft _) i, ih₁] + by_cases ha : a = ([],1) <;> by_cases hij : i = j <;> + simp [ha, hij, ih₂, semicircularN_basis, removeN, leftN, push, leftG] + +theorem vacuum_separating (A : Space B N G →L[ℂ] Space B N G) (hA : A ∈ algebra B N G) + (h0 : A (basis empty) = 0) : A = 0 := by + have hsingle (w : Word B N G) : A (basis w) = 0 := by + rw [← reverse_involutive w, ← rightWick_vacuum] + rw [← mul_apply_eq_comp, (commute_rightWick A ((mem_algebra_iff A).mp hA) (reverse w)).eq, + mul_apply_eq_comp, h0, map_zero] + apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) + intro w + apply ContinuousLinearMap.ext + intro z + change A (lp.single 2 w z) = 0 + have hz : lp.single 2 w z = z • basis w := by simp [basis, ← lp.single_smul] + rw [hz, map_smul, hsingle, smul_zero] + + theorem adjoint_vacuum_coefficient (A : Space B N G →L[ℂ] Space B N G) + (hA : A ∈ algebra B N G) (w : Word B N G) : + (star A (basis empty)) w = star ((A (basis empty)) (reverse w)) := by + have hw : A (basis w) = rightWick (reverse w) (A (basis empty)) := by + rw [← mul_apply_eq_comp, + ← (commute_rightWick A ((mem_algebra_iff A).mp hA) (reverse w)).eq, + mul_apply_eq_comp, rightWick_vacuum, reverse_involutive] + calc + (star A (basis empty)) w = inner ℂ (basis w) (star A (basis empty)) := by + simp [basis, lp.inner_single_left] + _ = inner ℂ (A (basis w)) (basis empty) := ContinuousLinearMap.adjoint_inner_right A _ _ + _ = inner ℂ (rightWick (reverse w) (A (basis empty))) (basis empty) := by rw [hw] + _ = inner ℂ (A (basis empty)) (star (rightWick (reverse w)) (basis empty)) := + (ContinuousLinearMap.adjoint_inner_right _ _ _).symm + _ = star ((A (basis empty)) (reverse w)) := by + rw [adjoint_rightWick_vacuum] + simp [basis, lp.inner_single_right] + + theorem vacuum_product_formula (A D : Space B N G →L[ℂ] Space B N G) + (hA : A ∈ algebra B N G) : + inner ℂ (basis empty) ((A * D) (basis empty)) = + ∑' w : Word B N G, (D (basis empty)) w * (A (basis empty)) (reverse w) := by + rw [mul_apply_eq_comp, ← ContinuousLinearMap.adjoint_inner_left A, + ← ContinuousLinearMap.star_eq_adjoint, lp.inner_eq_tsum] + apply tsum_congr + intro w + rw [RCLike.inner_apply, adjoint_vacuum_coefficient A hA w] + simp + + theorem vacuum_tracial (A : Space B N G →L[ℂ] Space B N G) (hA : A ∈ algebra B N G) + (D : Space B N G →L[ℂ] Space B N G) (hD : D ∈ algebra B N G) : + inner ℂ (basis empty) ((A * D) (basis empty)) = + inner ℂ (basis empty) ((D * A) (basis empty)) := by + rw [vacuum_product_formula A D hA, vacuum_product_formula D A hD] + let e : Word B N G ≃ Word B N G := ⟨reverse, reverse, reverse_involutive, reverse_involutive⟩ + calc + (∑' w : Word B N G, (D (basis empty)) w * (A (basis empty)) (reverse w)) = + ∑' w : Word B N G, (D (basis empty)) (reverse w) * (A (basis empty)) w := by + simpa [e] using (e.tsum_eq (fun w : Word B N G => + (D (basis empty)) w * (A (basis empty)) (reverse w))).symm + _ = _ := tsum_congr fun _ => mul_comm _ _ + +def tracialVector (B N G : Type) [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] : + TracialVector (algebra B N G) where + vacuum := basis empty + norm_vacuum := by simp [basis, lp.norm_single (E := fun _ : Word B N G => ℂ) (p := 2)] + tracial := vacuum_tracial + separating := vacuum_separating + + theorem semicircularB_mem (b : B) : semicircularB (N := N) (G := G) b ∈ algebra B N G := + leftGenerator_mem (.inl b) + theorem semicircularN_mem (i : N) : semicircularN (B := B) (G := G) i ∈ algebra B N G := + leftGenerator_mem (.inr (.inl i)) + theorem unitaryG_mem (g : G) : unitaryG (B := B) (N := N) g ∈ algebra B N G := + leftGenerator_mem (.inr (.inr g)) + + theorem trace_unitaryG (g : G) : + trace (tracialVector B N G) (unitaryG g) = if g = 1 then 1 else 0 := by + change inner ℂ (basis empty) (unitaryG g (basis empty)) = _ + rw [unitaryG_basis] + by_cases hg : g = 1 <;> simp [basis, leftG, empty, lp.inner_single_left, lp.single_apply, hg, eq_comm] + +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/TwoNoiseFisher.lean b/lean/OAI/Analysis/FreeEntropy/TwoNoiseFisher.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3545d17762a668f4dab74d155030f893bd37b7d --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/TwoNoiseFisher.lean @@ -0,0 +1,183 @@ +import OAI.Analysis.FreeEntropy.CumulantResidual + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate lp +open MeasureTheory Filter +namespace FiniteEntropySeparation +section General +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + + theorem fisher_le_scaled_test {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (Z : Fin n → H →L[ℂ] H) (η : Fin n → H) (v : ℝ) (hv : 0 < v) + (ht : ∀ i w, inner ℂ (η i) (wordEval Z w τ.vacuum) = + (v : ℂ) * derivativeMoment τ Z i w) + (hn : ∀ i, ‖η i‖ ^ 2 ≤ v) : freeFisher τ Z ≤ ENNReal.ofReal ((n : ℝ)/v) := by + have ht' (i : Fin n) (w : List (Fin n)) : + inner ℂ ((v⁻¹ : ℂ) • η i) (wordEval Z w τ.vacuum) = derivativeMoment τ Z i w := by + rw [inner_smul_left, ht i w] + simp [hv.ne'] + apply (freeFisher_le_testVectors τ Z (fun i => ((v⁻¹ : ℂ) • η i)) ht').trans + apply ENNReal.ofReal_le_ofReal + calc + _ = ∑ i, v⁻¹ ^ 2 * ‖η i‖ ^ 2 := by + simp only [norm_smul, norm_inv, Complex.norm_real, Real.norm_eq_abs, mul_pow, inv_pow, sq_abs] + _ ≤ ∑ _i : Fin n, v⁻¹ ^ 2 * v := Finset.sum_le_sum (fun i _ => mul_le_mul_of_nonneg_left (hn i) (sq_nonneg _)) + _ = _ := by simp [pow_two, hv.ne', div_eq_mul_inv] + +omit [CompleteSpace H] in +theorem norm_sq_sqrt_pair [CompleteSpace H] {x y : H} (hx : ‖x‖ = 1) (hy : ‖y‖ = 1) + (hxy : inner ℂ x y = 0) (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) : + ‖(Real.sqrt a : ℂ) • x + (Real.sqrt b : ℂ) • y‖ ^ 2 = a + b := by + rw [norm_add_sq (𝕜 := ℂ), inner_smul_left, inner_smul_right, hxy] + simp [norm_smul, hx, hy, + Real.norm_eq_abs, Real.sq_sqrt ha, Real.sq_sqrt hb, + abs_of_nonneg (Real.sqrt_nonneg a), abs_of_nonneg (Real.sqrt_nonneg b)] + +end General + +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] + theorem noise_basis_test {n : ℕ} (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ j, X j ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ j, σ j ∉ J) + (u : ℝ) (i : Fin n) (w : List (Fin n)) : + inner ℂ (basis (noiseWord [σ i])) + (wordEval (heatTuple X (fun k => semicircularN (σ k)) u) w + (tracialVector B N G).vacuum) = + (Real.sqrt u : ℂ) * derivativeMoment (tracialVector B N G) + (heatTuple X (fun k => semicircularN (σ k)) u) i w := by + simpa only [List.map_cons, List.map_nil, List.reverse_singleton, List.length_singleton, pow_one, + reverseDerivativeMoment, derivativeMoment] using wick_testing J X hX σ hσ hs u [i] w + + theorem semicircularN_vacuum (i : N) : + semicircularN i (tracialVector B N G).vacuum = basis (noiseWord [i]) := by + simp [semicircularN, tracialVector, basis, creationN_single, annihilationN_single, + removeN, empty, noiseWord_cons, noiseWord_nil] +end FreeTensor +namespace Model +open FreeTensor +variable (p : ℕ) [NeZero p] + + theorem initialIndex_fresh (i : Fin (p+1)) : initialIndex p i ∉ Set.range (auxiliaryIndex p) := by + rintro ⟨j,h⟩ + exact auxiliaryIndex_fresh p j ⟨i,h.symm⟩ + + def doublyNoised (h s : ℝ) := heatTuple (X p h) (auxiliaryNoise p) s + def noiseVector₀ (i : Fin (p+1)) : H p := basis (noiseWord [initialIndex p i]) + def noiseVector₁ (i : Fin (p+1)) : H p := basis (noiseWord [auxiliaryIndex p i]) + + theorem doublyNoised_comm (h s : ℝ) : doublyNoised p h s = + heatTuple (heatTuple (C p) (auxiliaryNoise p) s) (initialNoise p) h := by + funext i + simp only [doublyNoised, X, heatTuple] + abel + + theorem auxiliaryBackground_mem (s : ℝ) (i : Fin (p+1)) : + heatTuple (C p) (auxiliaryNoise p) s i ∈ backgroundAlgebra (Set.range (auxiliaryIndex p)) := by + apply heatTuple_mem_background _ _ _ (C_mem_background p _) + intro j + exact semicircularN_mem_background _ ⟨j,rfl⟩ + + theorem noiseVector₀_test (h s : ℝ) (i : Fin (p+1)) (w : List (Fin (p+1))) : + inner ℂ (noiseVector₀ p i) (wordEval (doublyNoised p h s) w (τ p).vacuum) = + (Real.sqrt h : ℂ) * derivativeMoment (τ p) (doublyNoised p h s) i w := by + rw [doublyNoised_comm] + exact noise_basis_test _ _ (auxiliaryBackground_mem p s) + (initialIndex p) (initialIndex_injective p) (initialIndex_fresh p) h i w + + theorem noiseVector₁_test (h s : ℝ) (i : Fin (p+1)) (w : List (Fin (p+1))) : + inner ℂ (noiseVector₁ p i) (wordEval (doublyNoised p h s) w (τ p).vacuum) = + (Real.sqrt s : ℂ) * derivativeMoment (τ p) (doublyNoised p h s) i w := + noise_basis_test _ _ (X_mem_background p h) + (auxiliaryIndex p) (auxiliaryIndex_injective p) (auxiliaryIndex_fresh p) s i w + +omit [NeZero p] in +theorem noiseVector₀_norm [NeZero p] (i : Fin (p+1)) : ‖noiseVector₀ p i‖ = 1 := by + simp [noiseVector₀, basis, lp.norm_single (E := fun _ => ℂ) (p := 2)] + +omit [NeZero p] in +theorem noiseVector₁_norm [NeZero p] (i : Fin (p+1)) : ‖noiseVector₁ p i‖ = 1 := by + simp [noiseVector₁, basis, lp.norm_single (E := fun _ => ℂ) (p := 2)] + theorem noiseVector_orthogonal (i j : Fin (p+1)) : inner ℂ (noiseVector₀ p i) (noiseVector₁ p j) = 0 := by + have hneq : [initialIndex p i] ≠ [auxiliaryIndex p j] := by + intro he + have he' : initialIndex p i = auxiliaryIndex p j := List.cons.inj he |>.1 + exact auxiliaryIndex_fresh p j ⟨i,he'⟩ + exact noise_basis_orthonormal.inner_eq_zero hneq + +theorem doublyNoised_fisher_le (h s : ℝ) (hh : 0 ≤ h) (hs : 0 ≤ s) (hu : 0 < h+s) : + freeFisher (τ p) (doublyNoised p h s) ≤ ENNReal.ofReal ((p+1 : ℕ)/(h+s)) := by + let η : Fin (p+1) → H p := fun i => (Real.sqrt h : ℂ) • noiseVector₀ p i + + (Real.sqrt s : ℂ) • noiseVector₁ p i + apply fisher_le_scaled_test (τ p) _ η (h+s) hu + · intro i w + simp only [η, inner_add_left, inner_smul_left, Complex.conj_ofReal, + noiseVector₀_test, noiseVector₁_test, ← mul_assoc, ← pow_two] + rw [← Complex.ofReal_pow, ← Complex.ofReal_pow, Real.sq_sqrt hh, Real.sq_sqrt hs] + push_cast + ring + · intro i + exact (norm_sq_sqrt_pair (noiseVector₀_norm p i) (noiseVector₁_norm p i) + (noiseVector_orthogonal p i i) h s hh hs).le + + theorem noiseVector₀_C (i j : Fin (p+1)) : inner ℂ (noiseVector₀ p i) (C p j (τ p).vacuum) = 0 := by + have ht := noise_basis_test ∅ (C p) (C_mem_background p ∅) (initialIndex p) + (initialIndex_injective p) (by simp) 0 i [j] + simpa [heatTuple, wordEval, noiseVector₀] using ht + theorem noiseVector₁_C (i j : Fin (p+1)) : inner ℂ (noiseVector₁ p i) (C p j (τ p).vacuum) = 0 := by + have ht := noise_basis_test ∅ (C p) (C_mem_background p ∅) (auxiliaryIndex p) + (auxiliaryIndex_injective p) (by simp) 0 i [j] + simpa [heatTuple, wordEval, noiseVector₁] using ht + + theorem doublyNoised_vacuum (h s : ℝ) (i : Fin (p+1)) : + doublyNoised p h s i (τ p).vacuum = C p i (τ p).vacuum + + ((Real.sqrt h : ℂ) • noiseVector₀ p i + (Real.sqrt s : ℂ) • noiseVector₁ p i) := by + change (C p i (τ p).vacuum + (Real.sqrt h : ℂ) • + semicircularN (initialIndex p i) (τ p).vacuum) + + (Real.sqrt s : ℂ) • semicircularN (auxiliaryIndex p i) (τ p).vacuum = _ + rw [semicircularN_vacuum, semicircularN_vacuum] + simp only [noiseVector₀, noiseVector₁, add_assoc] + + theorem doublyNoised_variance (h s : ℝ) (hh : 0 ≤ h) (hs : 0 ≤ s) (i : Fin (p+1)) : + ‖doublyNoised p h s i (τ p).vacuum‖ ^ 2 = ‖C p i (τ p).vacuum‖ ^ 2 + h+s := by + have hc : inner ℂ (C p i (τ p).vacuum) + ((Real.sqrt h : ℂ) • noiseVector₀ p i + (Real.sqrt s : ℂ) • noiseVector₁ p i) = 0 := by + rw [← inner_conj_symm, inner_add_left, inner_smul_left, inner_smul_left, + noiseVector₀_C, noiseVector₁_C] + simp + rw [doublyNoised_vacuum, norm_add_sq (𝕜 := ℂ), hc, + norm_sq_sqrt_pair (noiseVector₀_norm p i) (noiseVector₁_norm p i) + (noiseVector_orthogonal p i i) h s hh hs] + simp + ring + + theorem C_vacuum_norm_sq_le (hp : 2 ≤ p) (i : Fin (p+1)) : + ‖C p i (τ p).vacuum‖ ^ 2 ≤ 4 := by + have h := (C p i).le_opNorm (τ p).vacuum + rw [(τ p).norm_vacuum] at h + have h' := C_norm_le p hp i + nlinarith [norm_nonneg (C p i (τ p).vacuum)] + + theorem doublyNoised_fisher_lower (hp : 2 ≤ p) (h s : ℝ) + (hh : 0 ≤ h) (hs : 0 ≤ s) (hu : 0 < h+s) : + ENNReal.ofReal ((p+1 : ℕ)/(h+s+4)) ≤ freeFisher (τ p) (doublyNoised p h s) := by + apply le_trans _ (freeFisher_lower_covariance (τ p) (doublyNoised p h s)) + apply ENNReal.ofReal_le_ofReal + calc + _ = ∑ _i : Fin (p+1), 1 / (h+s+4) := by simp [div_eq_mul_inv] + _ ≤ _ := Finset.sum_le_sum (fun i _ => by + apply one_div_le_one_div_of_le + · rw [doublyNoised_variance p h s hh hs] + nlinarith [sq_nonneg ‖C p i (τ p).vacuum‖] + · rw [doublyNoised_variance p h s hh hs] + linarith [C_vacuum_norm_sq_le p hp i]) + +end Model +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/UniformConvergence.lean b/lean/OAI/Analysis/FreeEntropy/UniformConvergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..28e09fe58deba6c40488fa51c7e5c5fefef66295 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/UniformConvergence.lean @@ -0,0 +1,49 @@ +import OAI.Analysis.FreeEntropy.MicrostatesHeat + +namespace OAI + +universe u1 u2 + +noncomputable section +open MeasureTheory Filter +open scoped Topology +namespace FiniteEntropySeparation + theorem uniform_of_all_selections {α : ℕ → Type u1} (S : (k:ℕ) → Set (α k)) (hS : ∀k,(S k).Nonempty) + (F : (k:ℕ) → α k → ℝ) (hF : ∀a:(k:ℕ) → α k,(∀k,a k ∈ S k) → Tendsto (fun k => F k (a k)) atTop (𝓝 0)) + {ε : ℝ} (hε : 0<ε) : ∀ᶠ k in atTop,∀a ∈ S k,|F k a|<ε := by + classical + choose a ha using hS + let b (k : ℕ) : α k := if h : ∃x ∈ S k,ε≤|F k x| then h.choose else a k + have hb (k : ℕ) : b k ∈ S k := by + dsimp only [b] + split_ifs with h + · exact h.choose_spec.1 + · exact ha k + have ht := (hF b hb).abs.eventually (gt_mem_nhds (by simpa using hε)) + filter_upwards [ht] with k hk x hx + by_contra he + have h : ∃x ∈ S k,ε≤|F k x| := ⟨x,hx,le_of_not_gt he⟩ + have hh : ε≤|F k (b k)| := by simpa only [b,dite_eq_left h] using h.choose_spec.2 + exact (not_lt_of_ge hh) hk + theorem integral_tendsto_zero_of_uniform {α : ℕ → Type u2} [∀k,MeasurableSpace (α k)] + (μ : (k:ℕ) → Measure (α k)) [∀k,IsProbabilityMeasure (μ k)] + (S : (k:ℕ) → Set (α k)) (hS : ∀k,∀ᵐ a ∂μ k,a ∈ S k) + (F : (k:ℕ) → α k → ℝ) (hm : ∀k,AEStronglyMeasurable (F k) (μ k)) + (hu : ∀ε:ℝ,0<ε → ∀ᶠ k in atTop,∀a ∈ S k,|F k a|<ε) : + Tendsto (fun k => ∫ a,F k a ∂μ k) atTop (𝓝 0) := by + apply Metric.tendsto_nhds.mpr + intro ε hε + filter_upwards [hu (ε/2) (by positivity)] with k hk + have hb : ∀ᵐ a ∂μ k,‖F k a‖≤ε/2 := by + filter_upwards [hS k] with a ha + exact (hk a ha).le + have hi : Integrable (F k) (μ k) := (integrable_const (ε/2)).mono' (hm k) hb + have hn : ‖∫ a,F k a ∂μ k‖≤ε/2 := by + apply (norm_integral_le_integral_norm _).trans + exact (integral_mono_ae hi.norm (integrable_const _) hb).trans_eq (by simp) + simpa only [dist_zero_right] using hn.trans_lt (by linarith : ε/2<ε) +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/UniformMicrostateTests.lean b/lean/OAI/Analysis/FreeEntropy/UniformMicrostateTests.lean new file mode 100644 index 0000000000000000000000000000000000000000..5adc2c330c15bc7c9be04df4b5cfe7f3de68607a --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/UniformMicrostateTests.lean @@ -0,0 +1,41 @@ +import OAI.Analysis.FreeEntropy.FisherDeficit + +namespace OAI + +noncomputable section +open Filter MeasureTheory Set +open scoped Topology +namespace FiniteEntropySeparation +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} (X : Fin n → H →L[ℂ] H) + theorem diagonalMicrostates_uniform_open (R : ℝ) (O : Set (List (Fin n) → ℂ)) (hO : IsOpen O) + (hX : wordMoment τ X ∈ O) : + ∀ᶠk : ℕ in atTop,∀d : ℕ,∀a : MatrixCoordinates n d,a∈diagonalMicrostates τ X R k d → matrixMoment a∈O := by + classical + by_contra h + have hb : ∀N : ℕ,∃k,N≤k ∧ ∃d : ℕ,∃a : MatrixCoordinates n d, + a∈diagonalMicrostates τ X R k d ∧ matrixMoment a∉O := by + simpa only [eventually_atTop,not_exists,not_forall,Classical.not_imp,exists_prop] using h + obtain ⟨I,hI,hi⟩ := exists_strictMono_diagonal (fun _ k => ∃d : ℕ,∃a : MatrixCoordinates n d, + a∈diagonalMicrostates τ X R k d ∧ matrixMoment a∉O) (by + intro k L + obtain ⟨j,hj,hh⟩ := hb (L+1) + exact ⟨j,by omega,hh⟩) + choose D a ha hbad using hi + have hlim : Tendsto (fun k => matrixMoment (a k)) atTop (𝓝 (wordMoment τ X)) := by + apply tendsto_pi_nhds.mpr + intro w + apply tendsto_iff_norm_sub_tendsto_zero.mpr + apply squeeze_zero' (Eventually.of_forall (fun k => norm_nonneg _)) + · filter_upwards [hI.tendsto_atTop.eventually (eventually_ge_atTop w.length)] with k hk + exact ((ha k).2 w hk).le + · exact (show Tendsto (fun k : ℕ => (k+1:ℝ)⁻¹) atTop (𝓝 0) by + simpa only [one_div] using tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).comp hI.tendsto_atTop + have hev := hlim.eventually (hO.mem_nhds hX) + obtain ⟨k,hk⟩ := hev.exists + exact hbad k hk +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/VectorSeries.lean b/lean/OAI/Analysis/FreeEntropy/VectorSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..5e982f49d89b04bae0937c8aa9f35d156a17ac4f --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/VectorSeries.lean @@ -0,0 +1,188 @@ +import OAI.Analysis.FreeEntropy.SeriesNorm + +namespace OAI + +universe u1 + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α E : Type} [Fintype α] [NormedAddCommGroup E] [NormedSpace ℂ E] + +abbrev VSeries (α E : Type) := List α → E +abbrev VDegreeSpace (α E : Type) [Fintype α] [NormedAddCommGroup E] (n : ℕ) := + PiLp 2 (fun _ : List.Vector α n => E) +def vdegreeVector (f : VSeries α E) (n : ℕ) : VDegreeSpace α E n := + WithLp.toLp 2 (fun w => f w.val) +def vdegreeNorm (f : VSeries α E) (n : ℕ) : ℝ := ‖vdegreeVector f n‖ +@[simp] theorem vdegreeVector_apply {α E : Type} [Fintype α] [NormedAddCommGroup E] [NormedSpace ℂ E] (f : VSeries α E) (n : ℕ) (w : List.Vector α n) : + vdegreeVector f n w = f w.val := rfl +@[simp] theorem vdegreeNorm_nonneg {α E : Type} [Fintype α] [NormedAddCommGroup E] [NormedSpace ℂ E] (f : VSeries α E) (n : ℕ) : 0 ≤ vdegreeNorm f n := norm_nonneg _ + theorem vdegreeNorm_sq {α E : Type} [Fintype α] [NormedAddCommGroup E] [NormedSpace ℂ E] (f : VSeries α E) (n : ℕ) : + vdegreeNorm f n ^ 2 = ∑ w : List.Vector α n, ‖f w.val‖ ^ 2 := + PiLp.norm_sq_eq_of_L2 _ _ + theorem vdegreeNorm_scalar (f : Series α) (n : ℕ) : vdegreeNorm f n = degreeNorm f n := rfl + theorem vdegreeNorm_congr {α E : Type} [Fintype α] [NormedAddCommGroup E] [NormedSpace ℂ E] {f g : VSeries α E} (n : ℕ) + (h : ∀ w, w.length = n → f w = g w) : vdegreeNorm f n = vdegreeNorm g n := by + apply congrArg norm + ext w : 1 + exact h w.val w.prop + theorem vdegreeNorm_zero_degree (f : VSeries α E) : vdegreeNorm f 0 = ‖f []‖ := by + apply (sq_eq_sq₀ (vdegreeNorm_nonneg _ _) (norm_nonneg _)).mp + rw [vdegreeNorm_sq] + simp only [show ∀ w : List.Vector α 0, w.val = [] from fun w => List.length_eq_zero_iff.mp w.prop] + simp + theorem vdegreeNorm_add_le {α E : Type} [Fintype α] [NormedAddCommGroup E] [NormedSpace ℂ E] (f g : VSeries α E) (n : ℕ) : + vdegreeNorm (f+g) n ≤ vdegreeNorm f n + vdegreeNorm g n := by + change ‖vdegreeVector f n + vdegreeVector g n‖ ≤ _ + exact norm_add_le _ _ +@[simp] theorem vdegreeNorm_zero {α E : Type} [Fintype α] [NormedAddCommGroup E] [NormedSpace ℂ E] (n : ℕ) : vdegreeNorm (0 : VSeries α E) n = 0 := norm_zero + theorem vdegreeNorm_sum_le {ι : Type u1} (s : Finset ι) (f : ι → VSeries α E) (n : ℕ) : + vdegreeNorm (∑ i ∈ s, f i) n ≤ ∑ i ∈ s, vdegreeNorm (f i) n := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + rw [sum_insert hi, sum_insert hi] + exact (vdegreeNorm_add_le _ _ _).trans (add_le_add_right ih _) + theorem vdegreeNorm_tensor (f : Series α) (g : VSeries α E) (m n : ℕ) : + vdegreeNorm (fun w => f (w.take m) • g (w.drop m)) (m+n) = + degreeNorm f m * vdegreeNorm g n := by + apply (sq_eq_sq₀ (vdegreeNorm_nonneg _ _) (mul_nonneg (degreeNorm_nonneg _ _) (vdegreeNorm_nonneg _ _))).mp + rw [mul_pow, vdegreeNorm_sq, degreeNorm_sq, vdegreeNorm_sq] + have h := (vectorSplit (α := α) m n).sum_comp + (fun v : List.Vector α m × List.Vector α n => ‖f v.1.val‖ ^ 2 * ‖g v.2.val‖ ^ 2) + calc + _ = ∑ v : List.Vector α (m+n), ‖f (v.val.take m)‖^2 * ‖g (v.val.drop m)‖^2 := by + simp only [norm_smul, mul_pow] + _ = ∑ v : List.Vector α m × List.Vector α n, ‖f v.1.val‖^2 * ‖g v.2.val‖^2 := h + _ = _ := by rw [Fintype.sum_prod_type, sum_mul_sum] + +def vconv (M : Series α) (f : VSeries α E) : VSeries α E := fun w => + ∑ k ∈ range (w.length+1), M (w.take k) • f (w.drop k) + theorem vdegreeNorm_conv_le (M : Series α) (f : VSeries α E) (n : ℕ) : + vdegreeNorm (vconv M f) n ≤ ∑ k ∈ range (n+1), degreeNorm M k * vdegreeNorm f (n-k) := by + have h : vdegreeNorm (vconv M f) n = + vdegreeNorm (∑ k ∈ range (n+1), fun w => M (w.take k) • f (w.drop k)) n := by + apply vdegreeNorm_congr + intro w hw + simp only [vconv, hw, Finset.sum_apply] + rw [h] + apply (vdegreeNorm_sum_le _ _ _).trans + apply sum_le_sum + intro k hk + have hn : k + (n-k) = n := Nat.add_sub_of_le (Nat.le_of_lt_succ (mem_range.mp hk)) + simpa only [hn] using le_of_eq (vdegreeNorm_tensor M f k (n-k)) + + def vsubst (M : Series α) (f : VSeries α E) : VSeries α E + | [] => f [] + | a::w => ∑ k ∈ range (w.length+1), M (w.take k) • vsubst M (fun v => f (a::v)) (w.drop k) +termination_by w => w.length +@[simp] theorem vsubst_nil {α E : Type} [Fintype α] [NormedAddCommGroup E] [NormedSpace ℂ E] (M : Series α) (f : VSeries α E) : vsubst M f [] = f [] := by rw [vsubst] + theorem vsubst_cons {α E : Type} [Fintype α] [NormedAddCommGroup E] [NormedSpace ℂ E] (M : Series α) (f : VSeries α E) (a : α) (w : List α) : + vsubst M f (a::w) = vconv M (vsubst M (fun v => f (a::v))) w := by rw [vsubst, vconv] + theorem vsubst_scalar (M f : Series α) : vsubst M f = subst M f := by + funext w + induction w using length_induction generalizing f with + | h w ih => + cases w with + | nil => simp + | cons a w => + rw [vsubst, subst] + apply sum_congr rfl + intro k hk + rw [ih _ (by simp)] + rfl + + def bundleDeriv (f : VSeries α E) : VSeries α (PiLp 2 (fun _ : α => E)) := fun w => + WithLp.toLp 2 (fun a => f (a::w)) +@[simp] theorem bundleDeriv_apply {α E : Type} [Fintype α] [NormedAddCommGroup E] [NormedSpace ℂ E] (f : VSeries α E) (w : List α) (a : α) : + bundleDeriv f w a = f (a::w) := rfl + +def vectorCons (n : ℕ) : α × List.Vector α n ≃ List.Vector α (n+1) where + toFun v := v.1 ::ᵥ v.2 + invFun w := (w.head,w.tail) + left_inv v := by simp + right_inv w := w.cons_head_tail + + theorem vdegreeNorm_bundleDeriv (f : VSeries α E) (n : ℕ) : + vdegreeNorm (bundleDeriv f) n = vdegreeNorm f (n+1) := by + apply (sq_eq_sq₀ (vdegreeNorm_nonneg _ _) (vdegreeNorm_nonneg _ _)).mp + rw [vdegreeNorm_sq, vdegreeNorm_sq] + simp only [PiLp.norm_sq_eq_of_L2, bundleDeriv_apply] + rw [sum_comm] + calc + _ = ∑ v : α × List.Vector α n, ‖f (v.1 :: v.2.val)‖ ^ 2 := + (Fintype.sum_prod_type (fun v : α × List.Vector α n => ‖f (v.1 :: v.2.val)‖ ^ 2)).symm + _ = _ := (vectorCons n).sum_comp (fun w : List.Vector α (n+1) => ‖f w.val‖^2) + + theorem vsubst_apply (M : Series α) (f : VSeries α (PiLp 2 (fun _ : α => E))) + (w : List α) (a : α) : + vsubst M f w a = vsubst M (fun v => f v a) w := by + induction w using length_induction generalizing f with + | h w ih => + cases w with + | nil => simp + | cons b w => + rw [vsubst, vsubst] + simp only [WithLp.ofLp_sum, Finset.sum_apply, PiLp.smul_apply] + apply sum_congr rfl + intro k hk + congr 1 + exact ih _ (by simp) _ + + theorem vsubst_bundleDeriv (M : Series α) (f : VSeries α E) (w : List α) (a : α) : + vsubst M (bundleDeriv f) w a = vsubst M (fun v => f (a::v)) w := + vsubst_apply M (bundleDeriv f) w a + + theorem vdegreeNorm_subst_succ (M : Series α) (f : VSeries α E) (n : ℕ) : + vdegreeNorm (vsubst M f) (n+1) = + vdegreeNorm (vconv M (vsubst M (bundleDeriv f))) n := by + rw [← vdegreeNorm_bundleDeriv] + apply vdegreeNorm_congr + intro w hw + ext a : 1 + simp only [bundleDeriv_apply, vsubst_cons, vconv, WithLp.ofLp_sum, Finset.sum_apply, PiLp.smul_apply, + vsubst_bundleDeriv] + +def substBound (b a : ℕ → ℝ) : ℕ → ℝ + | 0 => a 0 + | n+1 => ∑ k ∈ range (n+1), b k * substBound b (fun j => a (j+1)) (n-k) +termination_by n => n + + theorem substBound_nonneg {b a : ℕ → ℝ} (hb : ∀ k, 0 ≤ b k) (ha : ∀ k, 0 ≤ a k) (n : ℕ) : + 0 ≤ substBound b a n := by + induction n using Nat.strong_induction_on generalizing a with + | h n ih => + cases n with + | zero => simpa only [substBound] using ha 0 + | succ n => + rw [substBound] + exact sum_nonneg fun k hk => mul_nonneg (hb k) (ih (n-k) (by omega) (fun j => ha (j+1))) + + theorem vsubst_norm_le (n : ℕ) : + ∀ {E : Type} [NormedAddCommGroup E] [NormedSpace ℂ E] + (M : Series α) (f : VSeries α E), + vdegreeNorm (vsubst M f) n ≤ substBound (degreeNorm M) (vdegreeNorm f) n := by + induction n using Nat.strong_induction_on with + | h n ih => + intro E _ _ M f + cases n with + | zero => simp [vdegreeNorm_zero_degree, substBound] + | succ n => + rw [vdegreeNorm_subst_succ, substBound] + apply (vdegreeNorm_conv_le _ _ _).trans + apply sum_le_sum + intro k hk + apply mul_le_mul_of_nonneg_left _ (degreeNorm_nonneg _ _) + have h := ih (n-k) (by omega) M (bundleDeriv f) + have he : vdegreeNorm (bundleDeriv f) = fun j => vdegreeNorm f (j+1) := + funext (vdegreeNorm_bundleDeriv f) + rw [he] at h + exact h + +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/VolumetricNet.lean b/lean/OAI/Analysis/FreeEntropy/VolumetricNet.lean new file mode 100644 index 0000000000000000000000000000000000000000..47746cbad076c6b0ce155dae61c386a2fc1c9519 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/VolumetricNet.lean @@ -0,0 +1,80 @@ +import OAI.Analysis.FreeEntropy.SpectralBlockMask + +namespace OAI + +universe u1 + +noncomputable section +open MeasureTheory Metric Set +open scoped ENNReal NNReal +namespace FiniteEntropySeparation + variable {E : Type u1} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + theorem separated_card_bound (s : Finset E) {R ε : ℝ} (hR : 0 ≤ R) (hε : 0 < ε) + (hs : ∀ c ∈ s, ‖c‖ ≤ R) (hsep : ∀ c ∈ s, ∀ d ∈ s, c ≠ d → ε ≤ ‖c-d‖) : + (s.card : ℝ) ≤ (1+2*R/ε)^Module.finrank ℝ E := by + borelize E + let μ : Measure E := Measure.addHaar + let δ : ℝ := ε/2 + let ρ : ℝ := R+δ + have hδ : 0 < δ := by dsimp [δ]; positivity + have hρ : 0 < ρ := by dsimp [ρ]; positivity + let A := ⋃ c ∈ s, ball c δ + have hD : Set.Pairwise (s : Set E) (fun c d => Disjoint (ball c δ) (ball d δ)) := by + intro c hc d hd hcd + apply ball_disjoint_ball + rw [dist_eq_norm] + simpa [δ] using hsep c hc d hd hcd + have hA : A ⊆ ball (0 : E) ρ := by + refine iUnion₂_subset fun x hx => ball_subset_ball' ?_ + rw [dist_zero_right] + dsimp [ρ] + linarith [hs x hx] + have hI : (s.card : ℝ≥0∞)*ENNReal.ofReal (δ^Module.finrank ℝ E)*μ (ball 0 1) ≤ + ENNReal.ofReal (ρ^Module.finrank ℝ E)*μ (ball 0 1) := by + calc + _ = μ A := by + rw [show A = ⋃ c ∈ s, ball c δ from rfl, measure_biUnion_finset hD (fun _ _ => measurableSet_ball)] + simp only [μ.addHaar_ball_of_pos _ hδ, Finset.sum_const, nsmul_eq_mul, mul_assoc] + _ ≤ μ (ball (0 : E) ρ) := measure_mono hA + _ = _ := μ.addHaar_ball_of_pos _ hρ + have hJ : (s.card : ℝ≥0∞)*ENNReal.ofReal (δ^Module.finrank ℝ E) ≤ ENNReal.ofReal (ρ^Module.finrank ℝ E) := + (ENNReal.mul_le_mul_iff_left (measure_ball_pos μ _ zero_lt_one).ne' measure_ball_lt_top.ne).1 hI + have hK : (s.card : ℝ)*δ^Module.finrank ℝ E ≤ ρ^Module.finrank ℝ E := by + simpa only [ENNReal.toReal_mul, ENNReal.toReal_natCast, ENNReal.toReal_ofReal (pow_nonneg hδ.le _)] using + ENNReal.toReal_le_of_le_ofReal (pow_nonneg hρ.le _) hJ + have he : (1+2*R/ε)*δ = ρ := by dsimp [δ,ρ]; field_simp; ring + apply (mul_le_mul_iff_left₀ (pow_pos hδ _)).mp + rw [← mul_pow, he] + exact hK + theorem compact_finite_net (A : Set E) (hA : IsCompact A) {R ε : ℝ} (hR : 0 ≤ R) (hε : 0 < ε) + (hAR : ∀ x ∈ A, ‖x‖ ≤ R) : + ∃ s : Finset E, (∀ x ∈ s, x ∈ A) ∧ (∀ x ∈ A, ∃ y ∈ s, dist x y ≤ ε) ∧ + (s.card : ℝ) ≤ (1+2*R/ε)^Module.finrank ℝ E := by + classical + let e : ℝ≥0 := ⟨ε,hε.le⟩ + have he : e/2 ≠ 0 := ne_of_gt (div_pos (show 0 < e from hε) (by norm_num)) + obtain ⟨N,hNA,hNfin,hNcov⟩ := Metric.exists_finite_isCover_of_isCompact (ε := (e/2 : ℝ≥0)) he hA + have hpn : packingNumber e A ≠ ⊤ := by + have hb := packingNumber_two_mul_le_externalCoveringNumber (e/2) A + rw [mul_div_cancel₀ _ (by norm_num : (2 : ℝ≥0) ≠ 0)] at hb + exact ne_top_of_le_ne_top hNfin.encard_lt_top.ne (hb.trans hNcov.externalCoveringNumber_le_encard) + let K := maximalSeparatedSet e A + have hKfin : K.Finite := Set.encard_ne_top_iff.mp (by simpa [K, encard_maximalSeparatedSet hpn] using hpn) + refine ⟨hKfin.toFinset, ?_, ?_, ?_⟩ + · intro x hx; exact maximalSeparatedSet_subset (by simpa using hx) + · intro x hx + obtain ⟨y,hy,hxy⟩ := isCover_maximalSeparatedSet hpn hx + refine ⟨y, by simpa using hy, ?_⟩ + exact (edist_le_coe).mp hxy + · apply separated_card_bound _ hR hε + · intro x hx; exact hAR x (maximalSeparatedSet_subset (by simpa using hx)) + · intro x hx y hy hxy + have hh := isSeparated_maximalSeparatedSet (ε := e) (A := A) (by simpa using hx) (by simpa using hy) hxy + have hh' : e < nndist x y := by simpa only [edist_nndist, ENNReal.coe_lt_coe] using hh + have hh'' : ε < dist x y := hh' + simpa only [dist_eq_norm] using hh''.le +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/WickBound.lean b/lean/OAI/Analysis/FreeEntropy/WickBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..459cb01f5a4b43474bc16cc4fc881f4410853fb0 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/WickBound.lean @@ -0,0 +1,48 @@ +import OAI.Analysis.FreeEntropy.GeometricTail + +namespace OAI + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α : Type} [DecidableEq α] [Fintype α] + + theorem wick_degree_bound {R : Series α} {v : α → ℝ} {K u : ℝ} + (hc : ∀ i, R [i] = 0) (hv : ∀ i j, R [i,j] = if j=i then (v i : ℂ) else 0) + (_hK : 0 ≤ K) (hR : ∀ m, degreeNorm R m ≤ K^m) (hu : 0 ≤ u) (d : ℕ) : + ∑ i : α, degreeNorm (wickCoefficients (residual R v i) u) d ^ 2 ≤ + geometricCumulantTail K u d := by + rw [wickCoefficients_degree_sum hc hv u hu d, geometricCumulantTail] + split_ifs + · apply mul_le_mul_of_nonneg_left _ (by positivity) + calc + degreeNorm R (d+1)^2 ≤ (K^(d+1))^2 := + pow_le_pow_left₀ (degreeNorm_nonneg _ _) (hR _) _ + _ = _ := by rw [← pow_mul, Nat.mul_comm] + · rfl + theorem wickCoefficient_summable {R : Series α} {v : α → ℝ} {K u : ℝ} + (hc : ∀ i, R [i] = 0) (hv : ∀ i j, R [i,j] = if j=i then (v i : ℂ) else 0) + (hK : 0 ≤ K) (hR : ∀ m, degreeNorm R m ≤ K^m) (hu : 0 < u) (hKu : K^2 < u) + (i : α) : Summable (fun js => ‖wickCoefficients (residual R v i) u js‖^2) := by + apply (summable_norm_sq_iff _).mpr + apply Summable.of_nonneg_of_le (fun d => sq_nonneg _) _ (geometricCumulantTail_summable hu hKu) + intro d + exact (single_le_sum (fun j _ => sq_nonneg (degreeNorm (wickCoefficients (residual R v j) u) d)) + (mem_univ i)).trans (wick_degree_bound hc hv hK hR hu.le d) + theorem wickCoefficient_total_bound {R : Series α} {v : α → ℝ} {K u : ℝ} + (hc : ∀ i, R [i] = 0) (hv : ∀ i j, R [i,j] = if j=i then (v i : ℂ) else 0) + (hK : 0 ≤ K) (hR : ∀ m, degreeNorm R m ≤ K^m) (hu : 0 < u) (hKu : 2*K^2 ≤ u) : + ∑ i : α, ∑' js, ‖wickCoefficients (residual R v i) u js‖^2 ≤ 2*K^6/u^2 := by + have hKu' : K^2 < u := by nlinarith [sq_nonneg K] + have hs (i : α) := wickCoefficient_summable hc hv hK hR hu hKu' i + have hd (i : α) := (summable_norm_sq_iff _).mp (hs i) + have hsum := hasSum_sum (s := (univ : Finset α)) (fun i _ => (hd i).hasSum) + simp_rw [tsum_norm_sq_degree _ (hs _)] + rw [← hsum.tsum_eq] + exact (hsum.summable.tsum_le_tsum (fun d => wick_degree_bound hc hv hK hR hu.le d) + (geometricCumulantTail_summable hu hKu')).trans (geometricCumulantTail_le hu hKu) +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/WickCoefficients.lean b/lean/OAI/Analysis/FreeEntropy/WickCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..62880130a09ce4687a5c3126808c340c9b0e316a --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/WickCoefficients.lean @@ -0,0 +1,82 @@ +import OAI.Analysis.FreeEntropy.SeriesSummability + +namespace OAI + +noncomputable section +open scoped ComplexConjugate +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α : Type} [DecidableEq α] [Fintype α] + +def vectorReverse (d : ℕ) : List.Vector α d ≃ List.Vector α d where + toFun v := v.reverse + invFun v := v.reverse + left_inv v := by apply Subtype.ext; simp + right_inv v := by apply Subtype.ext; simp + +omit [DecidableEq α] in +theorem degreeNorm_reverse [DecidableEq α] (f : Series α) (d : ℕ) : degreeNorm (fun w => f w.reverse) d = degreeNorm f d := by + apply (sq_eq_sq₀ (degreeNorm_nonneg _ _) (degreeNorm_nonneg _ _)).mp + rw [degreeNorm_sq, degreeNorm_sq] + exact (vectorReverse (α := α) d).sum_comp (fun v => ‖f v.val‖^2) + +omit [DecidableEq α] in +theorem degreeNorm_conj [DecidableEq α] (f : Series α) (d : ℕ) : degreeNorm (fun w => conj (f w)) d = degreeNorm f d := by + apply (sq_eq_sq₀ (degreeNorm_nonneg _ _) (degreeNorm_nonneg _ _)).mp + simp [degreeNorm_sq] + +def wickCoefficients (f : Series α) (u : ℝ) : Series α := + fun js => conj (f js.reverse) / (Real.sqrt u : ℂ)^js.length + +omit [DecidableEq α] [Fintype α] in +theorem wickCoefficients_cancel [DecidableEq α] [Fintype α] (f : Series α) (u : ℝ) (hu : 0 < u) (js : List α) : + conj (wickCoefficients f u js) * (Real.sqrt u : ℂ)^js.length = f js.reverse := by + have hr : (Real.sqrt u : ℂ) ≠ 0 := by exact_mod_cast (Real.sqrt_pos.mpr hu).ne' + simp [wickCoefficients, hr] + theorem wickCoefficients_degree_sq (f : Series α) (u : ℝ) (hu : 0 ≤ u) (d : ℕ) : + degreeNorm (wickCoefficients f u) d ^ 2 = u⁻¹^d * degreeNorm f d ^ 2 := by + have he : degreeNorm (wickCoefficients f u) d = + degreeNorm ((Real.sqrt u : ℂ)⁻¹^d • (fun w => conj (f w.reverse) : Series α)) d := by + apply degreeNorm_congr + intro w hw + simp [wickCoefficients, hw, div_eq_mul_inv, mul_comm] + rw [he, degreeNorm_smul, degreeNorm_conj, degreeNorm_reverse, mul_pow] + congr 1 + have hsq : (Real.sqrt u ^ d)^2 = u^d := by + rw [← pow_mul, Nat.mul_comm d 2, pow_mul, Real.sq_sqrt hu] + simp [norm_pow, norm_inv, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (Real.sqrt_nonneg u), hsq] + theorem residual_degree (R : Series α) (v : α → ℝ) (i : α) (d : ℕ) (hd : 2 ≤ d) : + degreeNorm (residual R v i) d = degreeNorm (FreeSeries.deriv i R) d := by + apply degreeNorm_congr + intro w hw + exact residual_long R v i w (by omega) + theorem residual_degree_short {R : Series α} {v : α → ℝ} + (hc : ∀ i, R [i] = 0) (hv : ∀ i j, R [i,j] = if j=i then (v i : ℂ) else 0) + (i : α) (d : ℕ) (hd : d < 2) : degreeNorm (residual R v i) d = 0 := by + apply (degreeNorm_congr (g := 0) d ?_).trans (degreeNorm_zero d) + intro w hw + exact residual_short hc hv i w (by omega) + theorem residual_degree_sum {R : Series α} {v : α → ℝ} + (hc : ∀ i, R [i] = 0) (hv : ∀ i j, R [i,j] = if j=i then (v i : ℂ) else 0) (d : ℕ) : + ∑ i : α, degreeNorm (residual R v i) d ^ 2 = + if 2 ≤ d then degreeNorm R (d+1)^2 else 0 := by + by_cases hd : 2 ≤ d + · simp only [ite_eq_left hd, residual_degree R v _ _ hd] + exact (degreeNorm_succ_sq R d).symm + · have hz (i : α) : degreeNorm (residual R v i) d = 0 := + residual_degree_short hc hv i d (by omega) + simp [hd, hz] + theorem wickCoefficients_degree_sum {R : Series α} {v : α → ℝ} + (hc : ∀ i, R [i] = 0) (hv : ∀ i j, R [i,j] = if j=i then (v i : ℂ) else 0) + (u : ℝ) (hu : 0 ≤ u) (d : ℕ) : + ∑ i : α, degreeNorm (wickCoefficients (residual R v i) u) d^2 = + if 2 ≤ d then u⁻¹^d * degreeNorm R (d+1)^2 else 0 := by + simp_rw [wickCoefficients_degree_sq _ u hu] + rw [← mul_sum, residual_degree_sum hc hv] + split_ifs <;> simp +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/WickSeries.lean b/lean/OAI/Analysis/FreeEntropy/WickSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec14050c612fe8836be3ee9310c6f2c0231bbb65 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/WickSeries.lean @@ -0,0 +1,110 @@ +import OAI.Analysis.FreeEntropy.FisherResidual + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate lp +open MeasureTheory Filter +namespace FiniteEntropySeparation +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] + + def noiseWickIsometry {n : ℕ} (σ : Fin n → N) (hσ : Function.Injective σ) : + LabelHilbert.Space (List (Fin n)) →ₗᵢ[ℂ] Space B N G := + LabelHilbert.embedding (fun js => noiseWord ((js.map σ).reverse)) (by + intro js ks h + apply List.map_injective_iff.mpr hσ + exact List.reverse_injective (noiseWord_injective h)) + +@[simp] theorem noiseWickIsometry_single {n : ℕ} (σ : Fin n → N) + (hσ : Function.Injective σ) (js : List (Fin n)) (z : ℂ) : + noiseWickIsometry (B := B) (G := G) σ hσ (lp.single 2 js z) = + z • basis (noiseWord ((js.map σ).reverse)) := by + have hz : z • (basis (noiseWord ((js.map σ).reverse)) : Space B N G) = + lp.single 2 (noiseWord ((js.map σ).reverse)) z := by + simp [basis, ← lp.single_smul] + rw [hz] + exact LabelHilbert.embedding_single _ _ js z + + theorem noiseWickIsometry_norm_sq {n : ℕ} (σ : Fin n → N) + (hσ : Function.Injective σ) (a : LabelHilbert.Space (List (Fin n))) : + ‖noiseWickIsometry (B := B) (G := G) σ hσ a‖ ^ 2 = ∑' js, ‖a js‖ ^ 2 := by + rw [LinearIsometry.norm_map] + convert lp.norm_rpow_eq_tsum (by norm_num : 0 < (2 : ℝ≥0∞).toReal) a using 1 <;> norm_cast + + theorem noiseWickIsometry_hasSum {n : ℕ} (σ : Fin n → N) + (hσ : Function.Injective σ) (a : LabelHilbert.Space (List (Fin n))) : + HasSum (fun js => a js • (basis (noiseWord ((js.map σ).reverse)) : Space B N G)) + (noiseWickIsometry σ hσ a) := by + simpa only [LinearIsometry.coe_toContinuousLinearMap, noiseWickIsometry_single] using + (lp.hasSum_single (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) a).mapL + (noiseWickIsometry (B := B) (G := G) σ hσ).toContinuousLinearMap + + theorem noiseWickIsometry_inner_hasSum {n : ℕ} (σ : Fin n → N) + (hσ : Function.Injective σ) (a : LabelHilbert.Space (List (Fin n))) + (x : Space B N G) : + HasSum (fun js => conj (a js) * inner ℂ (basis (noiseWord ((js.map σ).reverse))) x) + (inner ℂ (noiseWickIsometry σ hσ a) x) := by + have h := ((noiseWickIsometry_hasSum (B := B) (G := G) σ hσ a).mapL (innerSL ℂ x)) + have hc := Complex.hasSum_conj'.mpr h + simpa only [innerSL_apply_apply, inner_smul_right, map_mul, inner_conj_symm] using hc + +theorem wick_series_testing {n : ℕ} (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ j, X j ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ j, σ j ∉ J) + (u : ℝ) (a : LabelHilbert.Space (List (Fin n))) (w : List (Fin n)) : + inner ℂ (noiseWickIsometry σ hσ a) + (wordEval (heatTuple X (fun k => semicircularN (σ k)) u) w + (tracialVector B N G).vacuum) = + ∑' js, conj (a js) * (Real.sqrt u : ℂ) ^ js.length * + reverseDerivativeMoment (tracialVector B N G) + (heatTuple X (fun k => semicircularN (σ k)) u) js w := by + have h := noiseWickIsometry_inner_hasSum σ hσ a + (wordEval (heatTuple X (fun k => semicircularN (σ k)) u) w + (tracialVector B N G).vacuum) + simp only [wick_testing J X hX σ hσ hs u, ← mul_assoc] at h + exact h.tsum_eq.symm + + def wickCoefficientVector {n : ℕ} (a : List (Fin n) → ℂ) + (ha : Summable (fun js => ‖a js‖ ^ 2)) : LabelHilbert.Space (List (Fin n)) := + ⟨a, (memℓp_gen_iff (by norm_num : 0 < (2 : ℝ≥0∞).toReal)).mpr (by simpa using ha)⟩ + + theorem fisher_wick_series_bound {n : ℕ} (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ j, X j ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ j, σ j ∉ J) + (u : ℝ) (hu : 0 < u) + (ξ : Fin n → Space B N G) + (hξ : ConjugateSystem (tracialVector B N G) + (heatTuple X (fun k => semicircularN (σ k)) u) ξ) + (v : Fin n → ℝ) + (hv : ∀ i, ‖heatTuple X (fun k => semicircularN (σ k)) u i + (tracialVector B N G).vacuum‖ ^ 2 = v i) + (hvu : ∀ i, u ≤ v i) + (a : Fin n → LabelHilbert.Space (List (Fin n))) + (hseries : ∀ i w, + inner ℂ (heatTuple X (fun k => semicircularN (σ k)) u i + (tracialVector B N G).vacuum) + (wordEval (heatTuple X (fun k => semicircularN (σ k)) u) w + (tracialVector B N G).vacuum) - + (v i : ℂ) * derivativeMoment (tracialVector B N G) + (heatTuple X (fun k => semicircularN (σ k)) u) i w = + ∑' js, conj (a i js) * (Real.sqrt u : ℂ) ^ js.length * + reverseDerivativeMoment (tracialVector B N G) + (heatTuple X (fun k => semicircularN (σ k)) u) js w) : + 0 ≤ (∑ i, ‖ξ i‖ ^ 2) - (∑ i, (v i)⁻¹) ∧ + (∑ i, ‖ξ i‖ ^ 2) - (∑ i, (v i)⁻¹) ≤ + (u ^ 2)⁻¹ * ∑ i, ∑' js, ‖a i js‖ ^ 2 := by + have hr (i : Fin n) (w : List (Fin n)) := + (hseries i w).trans (wick_series_testing J X hX σ hσ hs u (a i) w).symm + simpa only [noiseWickIsometry_norm_sq] using + fisher_residual_bound (tracialVector B N G) hξ v u hu hv hvu + (fun i => noiseWickIsometry σ hσ (a i)) hr + +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/WickTensor.lean b/lean/OAI/Analysis/FreeEntropy/WickTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..160006e8cf1e480f05306d17b25f4a95f42710d0 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/WickTensor.lean @@ -0,0 +1,118 @@ +import OAI.Analysis.FreeEntropy.SignalSeries + +namespace OAI + +noncomputable section +open scoped ENNReal NNReal ComplexConjugate lp +open MeasureTheory Filter +namespace FiniteEntropySeparation + +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def reverseDerivativeMoment {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) : List (Fin n) → List (Fin n) → ℂ + | [], w => wordMoment τ X w + | i :: js, w => ∑ r : Fin w.length, if w[r.val] = i then + reverseDerivativeMoment τ X js (w.take r.val) * + wordMoment τ X (w.drop (r.val + 1)) else 0 + + theorem inner_commutatorKernel {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (i : Fin n) (w : List (Fin n)) (v : H) : + inner ℂ v (commutatorKernel (vacuumRankOne τ) X i w τ.vacuum) = + ∑ r : Fin w.length, if w[r.val] = i then + inner ℂ v (wordEval X (w.take r.val) τ.vacuum) * + wordMoment τ X (w.drop (r.val + 1)) else 0 := by + rw [commutatorKernel, sum_apply, inner_sum] + apply Finset.sum_congr rfl + intro r _ + split_ifs + · simp only [vacuumRankOne, mul_apply_eq_comp, InnerProductSpace.rankOne_apply, + map_smul, inner_smul_right, wordMoment, trace] + exact mul_comm _ _ + · simp + +namespace FreeTensor +variable {B N G : Type} [Group G] [DecidableEq B] [DecidableEq N] [DecidableEq G] + + theorem rightAnnihilationN_heat {n : ℕ} (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ j, X j ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ j, σ j ∉ J) + (u : ℝ) (i j : Fin n) : + star (rightCreationN (σ i)) * heatTuple X (fun k => semicircularN (σ k)) u j = + heatTuple X (fun k => semicircularN (σ k)) u j * star (rightCreationN (σ i)) + + if j = i then (Real.sqrt u : ℂ) • vacuumRankOne (tracialVector B N G) else 0 := by + change _ * (X j + (Real.sqrt u : ℂ) • semicircularN (σ j)) = _ + rw [mul_add, mul_smul_comm, (rightAnnihilationN_background (hs i) (hX j)).eq, + rightAnnihilationN_semicircularN] + dsimp [heatTuple] + by_cases hij : j = i + · subst j + simp only [ite_true, add_mul, smul_mul_assoc, add_assoc] + congr 1 + exact smul_add _ _ _ + · have hneq : σ i ≠ σ j := fun h => hij (hσ h).symm + simp only [ite_eq_right hij, ite_eq_right hneq, add_zero, add_mul, smul_mul_assoc] + congr 1 + +theorem wick_testing {n : ℕ} (J : Set N) + (X : Fin n → Space B N G →L[ℂ] Space B N G) + (hX : ∀ j, X j ∈ backgroundAlgebra J) + (σ : Fin n → N) (hσ : Function.Injective σ) (hs : ∀ j, σ j ∉ J) + (u : ℝ) (js w : List (Fin n)) : + inner ℂ (basis (noiseWord ((js.map σ).reverse))) + (wordEval (heatTuple X (fun k => semicircularN (σ k)) u) w + (tracialVector B N G).vacuum) = + (Real.sqrt u : ℂ) ^ js.length * + reverseDerivativeMoment (tracialVector B N G) + (heatTuple X (fun k => semicircularN (σ k)) u) js w := by + let Z := heatTuple X (fun k => semicircularN (σ k)) u + change inner ℂ _ (wordEval Z w _) = _ * reverseDerivativeMoment _ Z js w + induction js generalizing w with + | nil => simp [reverseDerivativeMoment, wordMoment, trace, tracialVector] + | cons i js ih => + have hvec : basis (noiseWord (((i :: js).map σ).reverse)) = + rightCreationN (σ i) (basis (noiseWord ((js.map σ).reverse)) : Space B N G) := by + simp only [List.map_cons, List.reverse_cons, basis, rightCreationN_single, rightN_noiseWord] + rw [hvec, ← ContinuousLinearMap.adjoint_inner_right, + ← ContinuousLinearMap.star_eq_adjoint] + have hc := commutator_word (vacuumRankOne (tracialVector B N G)) + (star (rightCreationN (σ i))) Z i (Real.sqrt u : ℂ) + (rightAnnihilationN_heat J X hX σ hσ hs u i) w + have hc' := congrArg (fun T : Space B N G →L[ℂ] Space B N G => + T (tracialVector B N G).vacuum) hc + have hz : star (rightCreationN (σ i)) (tracialVector B N G).vacuum = 0 := by + simp [tracialVector, basis, empty] + simp only [mul_apply_eq_comp, hz, map_zero, add_apply, zero_add, smul_apply] at hc' + rw [hc', inner_smul_right, inner_commutatorKernel] + simp_rw [ih] + rw [reverseDerivativeMoment, List.length_cons, pow_succ, Finset.mul_sum, + Finset.mul_sum] + apply Finset.sum_congr rfl + intro r _ + split_ifs <;> ring + + theorem wick_test_zero_above_degree {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (js w : List (Fin n)) (h : w.length < js.length) : + reverseDerivativeMoment τ X js w = 0 := by + induction js generalizing w with + | nil => simp at h + | cons i js ih => + rw [reverseDerivativeMoment] + apply Finset.sum_eq_zero + intro r _ + split_ifs + · rw [ih] + · simp + · have hr : r.val < w.length := r.isLt + have ht : (w.take r.val).length ≤ r.val := List.length_take_le _ _ + simp only [List.length_cons] at h + omega + · rfl + +end FreeTensor +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/WordLinearLaw.lean b/lean/OAI/Analysis/FreeEntropy/WordLinearLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..c377701707b6360ecd3b3b534eb34e3e62ec8c63 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/WordLinearLaw.lean @@ -0,0 +1,75 @@ +import OAI.Analysis.FreeEntropy.EmbeddedSeries + +namespace OAI + +noncomputable section +open scoped ComplexConjugate +namespace FiniteEntropySeparation +open Finset FreeSeries +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + + theorem wordEval_mem {M : VonNeumannAlgebra H} {n : ℕ} + (X : Fin n → H →L[ℂ] H) (hX : ∀ i, X i ∈ M) (w : List (Fin n)) : wordEval X w ∈ M := by + induction w with + | nil => simp [wordEval] + | cons i w ih => simpa [wordEval] using M.mul_mem (hX i) ih + theorem wordMoment_cyclic {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (hX : ∀ i, X i ∈ M) : Cyclic (wordMoment τ X) := by + intro i + funext w + change trace τ ((i::w).map X).prod = trace τ ((w++[i]).map X).prod + simpa [trace, wordEval, List.map_cons, List.prod_cons, List.map_append, List.prod_append] using + τ.tracial (X i) (hX i) (wordEval X w) (wordEval_mem X hX w) + theorem wordMoment_restrict {M : VonNeumannAlgebra H} (τ : TracialVector M) {n m : ℕ} + (X : Fin n → H →L[ℂ] H) (e : Fin m → Fin n) : + restrict e (wordMoment τ X) = wordMoment τ (fun i => X (e i)) := by + funext w + simp [FreeSeries.restrict, wordMoment, wordEval, List.map_map, Function.comp_def] + + theorem reparam_wordMoment {M : VonNeumannAlgebra H} (τ : TracialVector M) {n m : ℕ} + (X : Fin n → H →L[ℂ] H) (c : Fin n → Fin m → ℂ) : + reparam c (wordMoment τ X) = wordMoment τ (fun b => ∑ a, c a b • X a) := by + let Y := fun b => ∑ a, c a b • X a + have hh (w : List (Fin m)) (A : H →L[ℂ] H) : + reparam c (fun v => trace τ (A * wordEval X v)) w = trace τ (A * wordEval Y w) := by + induction w generalizing A with + | nil => simp [wordEval] + | cons b w ih => + rw [reparam_cons] + have hf (a : Fin n) : deriv a (fun v => trace τ (A * wordEval X v)) = + (fun v => trace τ ((A * X a) * wordEval X v)) := by + funext v; simp [FreeSeries.deriv, wordEval, mul_assoc] + simp only [hf, ih] + change _ = trace τ (A * (Y b * wordEval Y w)) + rw [← mul_assoc] + dsimp only [Y] + rw [Finset.mul_sum, Finset.sum_mul, trace_sum] + apply sum_congr rfl + intro a _ + simp only [mul_smul_comm, smul_mul_assoc, trace_smul] + funext w + change reparam c (fun v => trace τ (wordEval X v)) w = trace τ (wordEval Y w) + simpa only [one_mul] using hh w 1 + + theorem pairDerivative_eq {n : ℕ} (M : Series (Fin n)) (i : Fin n) (w : List (Fin n)) : + conv M (subst M (letter i)) w = ∑ r : Fin w.length, if w[r.val] = i then + M (w.take r.val) * M (w.drop (r.val+1)) else 0 := by + rw [← deriv_quadratic i, ← subst_cons] + exact quadratic_subst_derivative M i w + theorem derivativeMoment_series {M : VonNeumannAlgebra H} (τ : TracialVector M) + {n : ℕ} (X : Fin n → H →L[ℂ] H) (i : Fin n) : + (fun w => derivativeMoment τ X i w) = + conv (wordMoment τ X) (subst (wordMoment τ X) (letter i)) := by + funext w + rw [pairDerivative_eq] + rfl + theorem pairDerivative_congr {α : Type} [DecidableEq α] [Fintype α] + {M N : Series α} {k : ℕ} (h : Agree k M N) (i : α) : + Agree k (conv M (subst M (letter i))) (conv N (subst N (letter i))) := + conv_agree h (subst_agree h (Agree.refl _ _)) + +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeEntropy/WordSeries.lean b/lean/OAI/Analysis/FreeEntropy/WordSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..8de4b6c7a6a9aaae12ee2d5b78a2a1d03a2d40f8 --- /dev/null +++ b/lean/OAI/Analysis/FreeEntropy/WordSeries.lean @@ -0,0 +1,200 @@ +import OAI.Analysis.FreeEntropy.GUELimit + +namespace OAI + +universe u1 u2 + +noncomputable section +namespace FiniteEntropySeparation.FreeSeries +open Finset +variable {α : Type u1} +abbrev Series (α : Type u2) := List α → ℂ + +def unit : Series α + | [] => 1 + | _::_ => 0 + +def deriv (a : α) (f : Series α) : Series α := fun w => f (a::w) + +def conv (f g : Series α) : Series α + | [] => f [] * g [] + | a::w => f [] * g (a::w) + conv (deriv a f) g w + +@[simp] theorem unit_nil : (unit : Series α) [] = 1 := rfl +@[simp] theorem unit_cons (a : α) (w : List α) : unit (a::w) = 0 := rfl +@[simp] theorem conv_nil (f g : Series α) : conv f g [] = f [] * g [] := rfl +@[simp] theorem conv_cons (f g : Series α) (a : α) (w : List α) : + conv f g (a::w) = f [] * g (a::w) + conv (deriv a f) g w := rfl +@[simp] theorem deriv_apply (a : α) (f : Series α) (w : List α) : deriv a f w = f (a::w) := rfl + + theorem conv_sum_splits (f g : Series α) (w : List α) : + conv f g w = ∑ k ∈ range (w.length+1), f (w.take k) * g (w.drop k) := by + induction w generalizing f with + | nil => simp + | cons a w ih => + rw [conv_cons, ih, List.length_cons] + conv_rhs => rw [sum_range_succ'] + simp only [List.take_zero, List.drop_zero, List.take_succ_cons, List.drop_succ_cons, deriv_apply] + ring + + theorem conv_add_left (f g h : Series α) : conv (f+g) h = conv f h + conv g h := by + funext w + simp only [conv_sum_splits, Pi.add_apply, add_mul, sum_add_distrib] + theorem conv_add_right (f g h : Series α) : conv f (g+h) = conv f g + conv f h := by + funext w + simp only [conv_sum_splits, Pi.add_apply, mul_add, sum_add_distrib] + theorem conv_smul_left (c : ℂ) (f g : Series α) : conv (c • f) g = c • conv f g := by + funext w + simp only [conv_sum_splits, Pi.smul_apply, smul_eq_mul, mul_assoc, mul_sum] + theorem conv_smul_right (c : ℂ) (f g : Series α) : conv f (c • g) = c • conv f g := by + funext w + simp only [conv_sum_splits, Pi.smul_apply, smul_eq_mul, mul_sum] + apply sum_congr rfl + intro k _ + ring +@[simp] theorem conv_zero_left (f : Series α) : conv 0 f = 0 := by + funext w + simp [conv_sum_splits] +@[simp] theorem conv_zero_right (f : Series α) : conv f 0 = 0 := by + funext w + simp [conv_sum_splits] + theorem deriv_conv (a : α) (f g : Series α) : + deriv a (conv f g) = f [] • deriv a g + conv (deriv a f) g := rfl +@[simp] theorem deriv_unit (a : α) : deriv a (unit : Series α) = 0 := rfl + +@[simp] theorem conv_unit_left (f : Series α) : conv unit f = f := by + funext w + cases w <;> simp [conv, deriv_unit] +@[simp] theorem conv_unit_right (f : Series α) : conv f unit = f := by + funext w + induction w generalizing f with + | nil => simp + | cons a w ih => simp [ih] + + theorem conv_assoc (f g h : Series α) : conv (conv f g) h = conv f (conv g h) := by + funext w + induction w generalizing f g h with + | nil => simp [mul_assoc] + | cons a w ih => + simp only [conv_cons, conv_nil, deriv_conv, conv_add_left, conv_smul_left, + Pi.add_apply, Pi.smul_apply, smul_eq_mul, ih] + ring + + theorem conv_neg_left (f g : Series α) : conv (-f) g = -conv f g := by + simpa using conv_smul_left (-1) f g + theorem conv_neg_right (f g : Series α) : conv f (-g) = -conv f g := by + simpa using conv_smul_right (-1) f g + theorem conv_sub_left (f g h : Series α) : conv (f-g) h = conv f h - conv g h := by + simp [sub_eq_add_neg, conv_add_left, conv_neg_left] + theorem conv_sub_right (f g h : Series α) : conv f (g-h) = conv f g - conv f h := by + simp [sub_eq_add_neg, conv_add_right, conv_neg_right] + + def Agree (n : ℕ) (f g : Series α) : Prop := ∀ w, w.length ≤ n → f w = g w + theorem conv_agree {n : ℕ} {f f' g g' : Series α} (hf : Agree n f f') (hg : Agree n g g') : + Agree n (conv f g) (conv f' g') := by + intro w hw + simp only [conv_sum_splits] + apply sum_congr rfl + intro k hk + rw [hf _ (by simp only [List.length_take]; omega), + hg _ (by simp only [List.length_drop]; omega)] + +theorem length_induction {P : List α → Prop} (w : List α) + (h : ∀ w, (∀ v, v.length < w.length → P v) → P w) : P w := + (measure List.length).wf.induction w h + +def subst (M f : Series α) : Series α + | [] => f [] + | a::w => ∑ k ∈ range (w.length+1), M (w.take k) * subst M (deriv a f) (w.drop k) +termination_by w => w.length + +@[simp] theorem subst_nil (M f : Series α) : subst M f [] = f [] := by rw [subst] + theorem subst_cons (M f : Series α) (a : α) (w : List α) : + subst M f (a::w) = conv M (subst M (deriv a f)) w := by + rw [subst, conv_sum_splits] + theorem deriv_subst (M f : Series α) (a : α) : + deriv a (subst M f) = conv M (subst M (deriv a f)) := by + funext w + exact subst_cons M f a w + + theorem subst_add (M f g : Series α) : subst M (f+g) = subst M f + subst M g := by + funext w + induction w using length_induction generalizing f g with + | h w ih => + cases w with + | nil => simp + | cons a w => + simp only [subst, Pi.add_apply] + simp_rw [show deriv a (f+g) = deriv a f + deriv a g from rfl] + rw [← sum_add_distrib] + apply sum_congr rfl + intro k hk + rw [ih _ (by simp)] + simp [mul_add] + + theorem subst_smul (M f : Series α) (c : ℂ) : subst M (c • f) = c • subst M f := by + funext w + induction w using length_induction generalizing f with + | h w ih => + cases w with + | nil => simp + | cons a w => + simp only [subst, Pi.smul_apply, smul_eq_mul] + simp_rw [show deriv a (c • f) = c • deriv a f from rfl] + rw [mul_sum] + apply sum_congr rfl + intro k hk + rw [ih _ (by simp)] + simp [mul_left_comm] + +@[simp] theorem subst_zero (M : Series α) : subst M 0 = 0 := by + have h := subst_smul M 0 0 + simpa using h +@[simp] theorem subst_unit (M : Series α) : subst M unit = unit := by + funext w + cases w with + | nil => simp + | cons a w => simp [subst_cons] + + theorem subst_mul (M f g : Series α) : subst M (conv f g) = conv (subst M f) (subst M g) := by + funext w + induction w using length_induction generalizing f g with + | h w ih => + cases w with + | nil => simp + | cons a w => + rw [subst_cons, deriv_conv, subst_add, subst_smul, conv_add_right, conv_smul_right] + rw [conv_cons, subst_nil, subst_cons, deriv_subst, conv_assoc] + change f [] * _ + _ = f [] * _ + _ + congr 1 + apply conv_agree (n := w.length) (fun _ _ => rfl) (fun v hv => ?_) w le_rfl + exact ih v (by simp ; omega) _ _ + + theorem subst_neg (M f : Series α) : subst M (-f) = -subst M f := by + simpa using subst_smul M f (-1) + theorem subst_sub (M f g : Series α) : subst M (f-g) = subst M f - subst M g := by + simp [sub_eq_add_neg, subst_add, subst_neg] + + theorem subst_unit_left (f : Series α) : subst unit f = f := by + funext w + induction w generalizing f with + | nil => simp + | cons a w ih => rw [subst_cons, conv_unit_left, ih]; rfl + +theorem subst_comp (L M f : Series α) : + subst L (subst M f) = subst (conv L (subst L M)) f := by + funext w + induction w using length_induction generalizing f with + | h w ih => + cases w with + | nil => simp + | cons a w => + rw [subst_cons, deriv_subst, subst_mul, ← conv_assoc, subst_cons] + apply conv_agree (n := w.length) (fun _ _ => rfl) (fun v hv => ?_) w le_rfl + exact ih v (by simp ; omega) _ + +end FiniteEntropySeparation.FreeSeries + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/Cocycles.lean b/lean/OAI/Analysis/FreeGroupFactor/Cocycles.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f290c273072918e4e71a2b4108a1e0679178e0e --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/Cocycles.lean @@ -0,0 +1,507 @@ +import OAI.Analysis.FreeGroupFactor.FreeSum + +namespace OAI + +namespace FreeGroupFactorMain + +noncomputable section + +universe uA uB uG uH uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +abbrev Coeff (G : Type uG) := G →₀ ℝ + +def coefficientShift {G : Type uG} [Group G] (g : G) : Coeff G ≃+ Coeff G := + Finsupp.domCongr (Equiv.mulLeft g) + +@[simp] theorem coefficientShift_apply {G : Type uG} [Group G] (g : G) (h : Coeff G) (b : G) : + coefficientShift g h b = h (g⁻¹ * b) := rfl + +@[simp] theorem coefficientShift_one {G : Type uG} [Group G] (h : Coeff G) : + coefficientShift (1 : G) h = h := by + ext b + simp + +@[simp] theorem coefficientShift_mul {G : Type uG} [Group G] (g b : G) (h : Coeff G) : + coefficientShift (g * b) h = coefficientShift g (coefficientShift b h) := by + ext c + simp [mul_assoc] + +def coefficientAction (G : Type uG) [Group G] : G →* MulAut (Multiplicative (Coeff G)) where + toFun g := AddEquiv.toMultiplicative (coefficientShift g) + map_one' := by + apply MulEquiv.ext + intro h + exact coefficientShift_one h.toAdd + map_mul' g b := by + apply MulEquiv.ext + intro h + exact coefficientShift_mul g b h.toAdd + +def cocycleGraph {ι : Type uι} (h : ι → Coeff (FreeGroup ι)) : + FreeGroup ι →* (Multiplicative (Coeff (FreeGroup ι)) ⋊[coefficientAction (FreeGroup ι)] + FreeGroup ι) := + FreeGroup.lift (fun i => ⟨Multiplicative.ofAdd (h i), FreeGroup.of i⟩) + +@[simp] theorem cocycleGraph_right {ι : Type uι} (h : ι → Coeff (FreeGroup ι)) + (g : FreeGroup ι) : (cocycleGraph h g).right = g := by + have hr : SemidirectProduct.rightHom.comp (cocycleGraph h) = MonoidHom.id _ := by + ext i + simp [cocycleGraph] + exact DFunLike.congr_fun hr g + +def freeCocycle {ι : Type uι} (h : ι → Coeff (FreeGroup ι)) (g : FreeGroup ι) : + Coeff (FreeGroup ι) := (cocycleGraph h g).left.toAdd + +@[simp] theorem freeCocycle_of {ι : Type uι} (h : ι → Coeff (FreeGroup ι)) (i : ι) : + freeCocycle h (FreeGroup.of i) = h i := by + simp [freeCocycle, cocycleGraph] + +@[simp] theorem freeCocycle_one {ι : Type uι} (h : ι → Coeff (FreeGroup ι)) : + freeCocycle h 1 = 0 := by simp [freeCocycle] + +theorem freeCocycle_mul {ι : Type uι} (h : ι → Coeff (FreeGroup ι)) (g b : FreeGroup ι) : + freeCocycle h (g * b) = freeCocycle h g + coefficientShift g (freeCocycle h b) := by + unfold freeCocycle + rw [map_mul] + rw [SemidirectProduct.mul_left, cocycleGraph_right] + rfl + +theorem freeCocycle_inv {ι : Type uι} (h : ι → Coeff (FreeGroup ι)) (g : FreeGroup ι) : + freeCocycle h g⁻¹ = -coefficientShift g⁻¹ (freeCocycle h g) := by + have he := freeCocycle_mul h g⁻¹ g + simp only [inv_mul_cancel, freeCocycle_one] at he + exact eq_neg_of_add_eq_zero_left he.symm + +namespace UnitaryEvaluation +variable {A : Type uA} [CStarAlgebra A] {ι : Type uι} + +def hamiltonianLinear (S : A) (U : ι → unitary A) : (FreeGroup ι →₀ ℝ) →ₗ[ℝ] A := + Finsupp.linearCombination ℝ (fun g => wordHom U g * S * star (wordHom U g)) + +theorem hamiltonianLinear_eq [DecidableEq ι] (S : A) (U : ι → unitary A) (k : FreeGroup ι →₀ ℝ) : + hamiltonianLinear S U k = PolynomialFlow.hamiltonian S k (fun i => (U i : A)) := by + classical + simp only [hamiltonianLinear, Finsupp.linearCombination_apply, + PolynomialFlow.hamiltonian, Finsupp.sum, wordHom_word] + apply Finset.sum_congr rfl + intro g _hg + exact (Complex.coe_smul (k g) _).symm + +theorem hamiltonianLinear_shift (S : A) (U : ι → unitary A) + (g : FreeGroup ι) (k : FreeGroup ι →₀ ℝ) : + hamiltonianLinear S U (coefficientShift g k) = + wordHom U g * hamiltonianLinear S U k * star (wordHom U g) := by + induction k using Finsupp.induction_linear with + | zero => simp + | add p q hp hq => simp only [map_add, hp, hq, mul_add, add_mul] + | single b c => + have he : coefficientShift g (Finsupp.single b c) = Finsupp.single (g*b) c := by + simp only [coefficientShift, Finsupp.domCongr_apply, + Finsupp.equivMapDomain_eq_mapDomain, Finsupp.mapDomain_single] + rfl + rw [he] + simp only [hamiltonianLinear, Finsupp.linearCombination_single, map_mul, star_mul, + smul_mul_assoc, mul_smul_comm, mul_assoc] + +theorem wordHom_mem_unitary (U : ι → unitary A) (g : FreeGroup ι) : + wordHom U g ∈ unitary A := (FreeGroup.lift U g).property + +theorem hasDerivAt_wordHom_cocycle [Fintype ι] [DecidableEq ι] + (S : A) (hS : IsSelfAdjoint S) (h : ι → FreeGroup ι →₀ ℝ) + (U : ℝ → ι → unitary A) + (hU : ∀ t, HasDerivAt (fun t j => (U t j : A)) + (PolynomialFlow.field S h (fun j => (U t j : A))) t) + (g : FreeGroup ι) (t : ℝ) : + HasDerivAt (fun s => wordHom (U s) g) + (Complex.I • (hamiltonianLinear S (U t) (freeCocycle h g) * wordHom (U t) g)) t := by + induction g using FreeGroup.induction_on with + | one => simpa using hasDerivAt_const t (1:A) + | of i => + simpa only [freeCocycle_of, wordHom_of, hamiltonianLinear_eq, + PolynomialFlow.field, smul_mul_assoc] using + (hasDerivAt_pi.mp (hU t) i) + | inv_of i ih => + let g := FreeGroup.of i + change HasDerivAt (fun s => wordHom (U s) g⁻¹) _ t + have hs : IsSelfAdjoint (hamiltonianLinear S (U t) (freeCocycle h g)) := by + rw [hamiltonianLinear_eq] + exact PolynomialFlow.selfAdjoint_hamiltonian S hS _ _ + simp only [wordHom_inv] + convert ih.star using 1 + dsimp [g] at hs + simp only [freeCocycle_inv, map_neg, hamiltonianLinear_shift, wordHom_inv, + star_smul, Complex.star_def, Complex.conj_I, star_mul, hs.star_eq, star_star, + neg_mul, neg_smul, smul_neg] + rw [mul_assoc, mul_assoc, (wordHom_mem_unitary (U t) g).2, mul_one] + | mul g b hg hb => + simp only [map_mul] + convert hg.mul hb using 1 + simp only [freeCocycle_mul, map_add, hamiltonianLinear_shift, add_mul, + smul_add, smul_mul_assoc, mul_smul_comm] + simp only [mul_assoc] + rw [← mul_assoc (star (wordHom (U t) g)), + (wordHom_mem_unitary (U t) g).1, one_mul] + +end UnitaryEvaluation + +section +open UnitaryEvaluation + +def groupUnitaryUHom (G : Type uG) [Group G] : G →* unitary (groupVonNeumann G) where + toFun g := ⟨groupUnitary g, groupUnitary_mem_unitary g⟩ + map_one' := Subtype.ext groupUnitary_one + map_mul' g b := Subtype.ext (groupUnitary_mul g b) + +theorem laurentValue_group (ι : Type uι) (l : ℤ →₀ ℂ) : + laurentValue (generatorUnitary (none : Option ι)) l = + groupLaurent (FreeGroup.of (none : Option ι)) l := by + classical + unfold laurentValue coefficientHom groupLaurent + rw [Finsupp.linearCombination_apply] + apply Finsupp.sum_congr + intro m _hm + change l m • (((generatorUnitary (none : Option ι))^m : + unitary (groupVonNeumann (FreeGroup (Option ι)))) : groupVonNeumann (FreeGroup (Option ι))) = + l m • groupUnitary (FreeGroup.of (none : Option ι) ^ m) + congr 1 + have hh := (groupUnitaryUHom (FreeGroup (Option ι))).map_zpow + (FreeGroup.of none) m + exact congrArg Subtype.val hh.symm + +theorem wordHom_original {ι : Type uι} (g : FreeGroup ι) : + wordHom (fun j => generatorUnitary (some j)) g = groupUnitary (FreeGroup.map Option.some g) := by + have he : wordHom (fun j : ι => generatorUnitary (some j)) = + (groupUnitaryHom (FreeGroup (Option ι))).comp (FreeGroup.map Option.some) := by + apply FreeGroup.ext_hom + intro i + simp only [MonoidHom.comp_apply, FreeGroup.map.of, wordHom_of] + rfl + exact DFunLike.congr_fun he g + +theorem hamiltonianLinear_original_bound {ι : Type uι} [DecidableEq ι] + (l : ℤ →₀ ℂ) (h0 : l 0 = 0) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option ι)) l)) + (K : ℝ) (hK : 0 ≤ K) + (hn : ‖laurentValue (generatorUnitary (none : Option ι)) l‖ ≤ K) + (k : FreeGroup ι →₀ ℝ) : + ‖hamiltonianLinear (laurentValue (generatorUnitary (none : Option ι)) l) + (fun j => generatorUnitary (some j)) k‖ ≤ 3*K*Real.sqrt (k.sum (fun _ r => r^2)) := by + rw [laurentValue_group] at hS hn ⊢ + convert centered_laurent_free_sum l h0 hS K hK hn k using 1 + congr 1 + unfold hamiltonianLinear + rw [Finsupp.linearCombination_apply] + apply Finsupp.sum_congr + intro g _hg + rw [wordHom_original, ← groupLaurent_conjugate] + rfl + +variable {A : Type uA} {B : Type uB} [CStarAlgebra A] [CStarAlgebra B] + +theorem hamiltonianLinear_map {ι : Type uι} + (Φ : A ≃⋆ₐ[ℂ] B) (S : A) (U : ι → unitary A) (V : ι → unitary B) + (hUV : ∀ g, Φ (wordHom U g) = wordHom V g) (k : FreeGroup ι →₀ ℝ) : + Φ (hamiltonianLinear S U k) = hamiltonianLinear (Φ S) V k := by + classical + simp only [hamiltonianLinear, Finsupp.linearCombination_apply, Finsupp.sum, + map_sum, ← Complex.coe_smul, map_smul, map_mul, map_star, hUV] + +theorem hamiltonianLinear_single_one {ι : Type uι} (S : A) (U : ι → unitary A) : + hamiltonianLinear S U (Finsupp.single 1 1) = S := by + simp [hamiltonianLinear] + +end +section + +variable {A : Type uA} [CStarAlgebra A] + +theorem unitary_curve_displacement (S : A) (hS : IsSelfAdjoint S) + (W : ℝ → unitary A) (H : ℝ → A) + (hW : ∀ t, HasDerivAt (fun s => (W s : A)) + (Complex.I • (H t * (W t : A))) t) + (B : ℝ) (hB : ∀ t ∈ Set.Icc (0:ℝ) 1, ‖H t-S‖ ≤ B) : + ‖(W 1 : A) - NormedSpace.exp (Complex.I • S) * (W 0 : A)‖ ≤ B := by + let : NormedAlgebra ℚ A := NormedAlgebra.restrictScalars ℚ ℂ A + let E (t : ℝ) : A := NormedSpace.exp (t • (-Complex.I • S)) + have hEu (t : ℝ) : E t ∈ unitary A := by + apply NormedSpace.exp_mem_unitary_of_mem_skewAdjoint + change star (t • (-Complex.I • S)) = -(t • (-Complex.I • S)) + rw [star_smul, star_smul, star_trivial, star_neg, Complex.star_def, + Complex.conj_I, neg_neg, hS.star_eq, neg_smul, smul_neg] + rw [neg_neg] + let D (t : ℝ) : A := Complex.I • (E t * (H t-S) * (W t : A)) + have hd (t : ℝ) : HasDerivAt (fun s => E s * (W s : A)) (D t) t := by + have he := hasDerivAt_exp_smul_const (-Complex.I • S) t + convert he.mul (hW t) using 1 + dsimp [E, D] + simp only [mul_sub, sub_mul, smul_sub, mul_smul_comm, smul_mul_assoc, + neg_smul, mul_neg, neg_mul, smul_neg, mul_assoc] + abel + have hb (t : ℝ) (ht : t ∈ Set.Icc (0:ℝ) 1) : ‖D t‖ ≤ B := by + dsimp [D] + rw [norm_smul, Complex.norm_I, one_mul, + CStarRing.norm_mul_mem_unitary _ (W t).property, + CStarRing.norm_mem_unitary_mul _ (hEu t)] + exact hB t ht + have hm := (convex_Icc (0:ℝ) 1).norm_image_sub_le_of_norm_hasDerivWithin_le + (fun t _ => (hd t).hasDerivWithinAt) hb (by simp : (0:ℝ) ∈ Set.Icc 0 1) + (by simp : (1:ℝ) ∈ Set.Icc 0 1) + have hE0 : E 0 = 1 := by simp [E] + have hE1 : E 1 * NormedSpace.exp (Complex.I • S) = 1 := by + dsimp [E] + rw [one_smul, neg_smul, ← NormedSpace.exp_add_of_commute (Commute.refl _).neg_left, + neg_add_cancel, NormedSpace.exp_zero] + have heq : E 1 * ((W 1 : A) - NormedSpace.exp (Complex.I • S) * (W 0 : A)) = + E 1 * (W 1 : A) - E 0 * (W 0 : A) := by + rw [mul_sub, ← mul_assoc, hE1, hE0] + rw [← heq, CStarRing.norm_mem_unitary_mul _ (hEu 1)] at hm + simpa using hm + +end + +namespace UnitaryEvaluation +variable {A : Type uA} [CStarAlgebra A] {ι : Type uι} [Fintype ι] [DecidableEq ι] + +omit [Fintype ι] [DecidableEq ι] in +theorem hamiltonianLinear_norm_map (Φ : A ≃⋆ₐ[ℂ] A) + (S : A) (hS : Φ S = S) (U V : ι → unitary A) + (hUV : ∀ g, Φ (wordHom U g) = wordHom V g) (k : FreeGroup ι →₀ ℝ) : + ‖hamiltonianLinear S V k‖ = ‖hamiltonianLinear S U k‖ := by + have he := FreeGroupFactorMain.hamiltonianLinear_map Φ S U V hUV k + rw [hS] at he + rw [← he, StarAlgEquiv.norm_map] + +omit [Fintype ι] in +theorem generator_displacement (S : A) (h : ι → FreeGroup ι →₀ ℝ) + (U : ℝ → ι → unitary A) + (hU : ∀ t, HasDerivAt (fun t j => (U t j : A)) + (PolynomialFlow.field S h (fun j => (U t j : A))) t) + (B : ι → ℝ) (hb : ∀ t j, ‖hamiltonianLinear S (U t) (h j)‖ ≤ B j) (j : ι) : + ‖(U 1 j : A) - (U 0 j : A)‖ ≤ B j := by + have hd := unitary_curve_displacement (0 : A) (by simp) + (fun t => U t j) (fun t => hamiltonianLinear S (U t) (h j)) + (fun t => by + simpa only [hamiltonianLinear_eq, PolynomialFlow.field] using + (hasDerivAt_pi.mp (hU t) j)) + (B j) (fun t _ => by simpa only [sub_zero] using hb t j) + simpa only [smul_zero, NormedSpace.exp_zero, one_mul] using hd + +theorem word_displacement (S : A) (hS : IsSelfAdjoint S) + (h : ι → FreeGroup ι →₀ ℝ) (U : ℝ → ι → unitary A) + (hU : ∀ t, HasDerivAt (fun t j => (U t j : A)) + (PolynomialFlow.field S h (fun j => (U t j : A))) t) + (w : FreeGroup ι) (B : ℝ) + (hb : ∀ t, ‖hamiltonianLinear S (U t) (freeCocycle h w - Finsupp.single 1 1)‖ ≤ B) : + ‖wordHom (U 1) w - NormedSpace.exp (Complex.I • S) * wordHom (U 0) w‖ ≤ B := by + apply unitary_curve_displacement S hS (fun t => FreeGroup.lift (U t) w) + (fun t => hamiltonianLinear S (U t) (freeCocycle h w)) + (fun t => hasDerivAt_wordHom_cocycle S hS h U hU w t) + intro t _ht + simpa only [map_sub, FreeGroupFactorMain.hamiltonianLinear_single_one] using hb t + +end UnitaryEvaluation + +section +open UnitaryEvaluation + +variable {ι : Type uι} [Fintype ι] [DecidableEq ι] + +omit [Fintype ι] [DecidableEq ι] in +theorem wordHom_extend_none_zpow {A : Type uA} [CStarAlgebra A] + (U : ι → unitary A) (C : unitary A) (m : ℤ) : + wordHom (extendUnitary U C) (FreeGroup.of none ^ m) = ((C^m : unitary A) : A) := by + change ((FreeGroup.lift (extendUnitary U C) (FreeGroup.of none ^ m) : unitary A) : A) = _ + simp only [map_zpow, FreeGroup.lift_apply_of, extendUnitary, Option.elim_none] + +omit [Fintype ι] [DecidableEq ι] in +theorem flow_iso_fix_laurent (l : ℤ →₀ ℂ) + (U : ι → unitary (groupVonNeumann (FreeGroup (Option ι)))) + (Φ : groupVonNeumann (FreeGroup (Option ι)) ≃⋆ₐ[ℂ] groupVonNeumann (FreeGroup (Option ι))) + (hΦ : ∀ g, Φ (groupUnitary g) = wordHom (extendUnitary U (generatorUnitary (none : Option ι))) g) : + Φ (laurentValue (generatorUnitary (none : Option ι)) l) = + laurentValue (generatorUnitary (none : Option ι)) l := by + classical + conv_lhs => rw [laurentValue_group] + simp only [groupLaurent, Finsupp.sum, map_sum, map_smul, hΦ, wordHom_extend_none_zpow] + rfl + +omit [Fintype ι] in +theorem flow_iso_hamiltonian_bound (l : ℤ →₀ ℂ) (h0 : l 0 = 0) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option ι)) l)) + (K : ℝ) (hK : 0 ≤ K) (hn : ‖laurentValue (generatorUnitary (none : Option ι)) l‖ ≤ K) + (U : ι → unitary (groupVonNeumann (FreeGroup (Option ι)))) + (Φ : groupVonNeumann (FreeGroup (Option ι)) ≃⋆ₐ[ℂ] groupVonNeumann (FreeGroup (Option ι))) + (hΦ : ∀ g, Φ (groupUnitary g) = wordHom (extendUnitary U (generatorUnitary (none : Option ι))) g) + (k : FreeGroup ι →₀ ℝ) : + ‖hamiltonianLinear (laurentValue (generatorUnitary (none : Option ι)) l) U k‖ ≤ + 3*K*Real.sqrt (k.sum (fun _ r => r^2)) := by + have hword (g : FreeGroup ι) : + Φ (wordHom (fun j => generatorUnitary (some j)) g) = wordHom U g := by + rw [wordHom_original, hΦ, wordHom_extend] + rw [hamiltonianLinear_norm_map Φ + (laurentValue (generatorUnitary (none : Option ι)) l) + (flow_iso_fix_laurent l U Φ hΦ) (fun j => generatorUnitary (some j)) U hword k] + exact hamiltonianLinear_original_bound l h0 hS K hK hn k + +theorem laurent_bounded_flow + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) (h0 : l 0 = 0) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option ι)) l)) + (K : ℝ) (hK : 0 ≤ K) (hn : ‖laurentValue (generatorUnitary (none : Option ι)) l‖ ≤ K) : + ∃ U : ℝ → ι → unitary (groupVonNeumann (FreeGroup (Option ι))), + U 0 = (fun j => generatorUnitary (some j)) ∧ + (∀ t, HasDerivAt (fun t j => (U t j : groupVonNeumann (FreeGroup (Option ι)))) + (PolynomialFlow.field (laurentValue (generatorUnitary (none : Option ι)) l) h + (fun j => (U t j : groupVonNeumann (FreeGroup (Option ι))))) t) ∧ + (∀ t k, ‖hamiltonianLinear (laurentValue (generatorUnitary (none : Option ι)) l) (U t) k‖ ≤ + 3*K*Real.sqrt (k.sum (fun _ r => r^2))) ∧ + ∃ β : groupVonNeumann (FreeGroup (Option ι)) ≃⋆ₐ[ℂ] groupVonNeumann (FreeGroup (Option ι)), + (∀ T, canonicalTrace (β T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option ι))) + (groupUltraweakTopology (FreeGroup (Option ι))) β ∧ + ∀ g, β (groupUnitary g) = wordHom (extendUnitary (U 1) (generatorUnitary (none : Option ι))) g := by + classical + obtain ⟨X,hU,hX₀,hX,hiso⟩ := laurent_flow_automorphisms h l hS + let U (t : ℝ) : ι → unitary (groupVonNeumann (FreeGroup (Option ι))) := fun j => ⟨X t j, hU t j⟩ + refine ⟨U,?_,hX,?_,hiso 1⟩ + · funext j + exact Subtype.ext (congrFun hX₀ j) + · intro t k + obtain ⟨Φ,_ht,_hc,hΦ⟩ := hiso t + exact flow_iso_hamiltonian_bound l h0 hS K hK hn (U t) Φ hΦ k + +theorem flow_displacements_from_bounds + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option ι)) l)) (K : ℝ) + (U : ℝ → ι → unitary (groupVonNeumann (FreeGroup (Option ι)))) + (hU₀ : U 0 = fun j => generatorUnitary (some j)) + (hX : ∀ t, HasDerivAt (fun t j => (U t j : groupVonNeumann (FreeGroup (Option ι)))) + (PolynomialFlow.field (laurentValue (generatorUnitary (none : Option ι)) l) h + (fun j => (U t j : groupVonNeumann (FreeGroup (Option ι))))) t) + (hbound : ∀ t k, ‖hamiltonianLinear (laurentValue (generatorUnitary (none : Option ι)) l) (U t) k‖ ≤ + 3*K*Real.sqrt (k.sum (fun _ r => r^2))) : + (∀ j, ‖(U 1 j : groupVonNeumann (FreeGroup (Option ι))) - groupUnitary (FreeGroup.of (some j))‖ ≤ + 3*K*Real.sqrt ((h j).sum (fun _ r => r^2))) ∧ + ∀ w : FreeGroup ι, ‖wordHom (U 1) w - NormedSpace.exp (Complex.I • laurentValue (generatorUnitary (none : Option ι)) l) * + groupUnitary (FreeGroup.map Option.some w)‖ ≤ + 3*K*Real.sqrt ((freeCocycle h w - Finsupp.single 1 1).sum (fun _ r => r^2)) := by + constructor + · intro j + have hd := generator_displacement (laurentValue (generatorUnitary (none : Option ι)) l) h U hX + (fun j => 3*K*Real.sqrt ((h j).sum (fun _ r => r^2))) + (fun t j => hbound t (h j)) j + rw [hU₀] at hd + exact hd + · intro w + have hd := word_displacement (laurentValue (generatorUnitary (none : Option ι)) l) hS h U hX w + (3*K*Real.sqrt ((freeCocycle h w - Finsupp.single 1 1).sum (fun _ r => r^2))) + (fun t => hbound t (freeCocycle h w - Finsupp.single 1 1)) + rwa [hU₀, wordHom_original] at hd + +theorem laurent_flow_displacement + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) (h0 : l 0 = 0) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option ι)) l)) + (K : ℝ) (hK : 0 ≤ K) (hn : ‖laurentValue (generatorUnitary (none : Option ι)) l‖ ≤ K) : + ∃ β : groupVonNeumann (FreeGroup (Option ι)) ≃⋆ₐ[ℂ] groupVonNeumann (FreeGroup (Option ι)), + (∀ T, canonicalTrace (β T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option ι))) + (groupUltraweakTopology (FreeGroup (Option ι))) β ∧ + β (groupUnitary (FreeGroup.of none)) = groupUnitary (FreeGroup.of none) ∧ + (∀ j : ι, ‖β (groupUnitary (FreeGroup.of (some j))) - groupUnitary (FreeGroup.of (some j))‖ ≤ + 3*K*Real.sqrt ((h j).sum (fun _ r => r^2))) ∧ + ∀ w : FreeGroup ι, ‖β (groupUnitary (FreeGroup.map Option.some w)) - + NormedSpace.exp (Complex.I • laurentValue (generatorUnitary (none : Option ι)) l) * + groupUnitary (FreeGroup.map Option.some w)‖ ≤ + 3*K*Real.sqrt ((freeCocycle h w - Finsupp.single 1 1).sum (fun _ r => r^2)) := by + classical + obtain ⟨U,hU₀,hX,hbound,β,hβt,hβc,hβ⟩ := laurent_bounded_flow (ι := ι) h l h0 hS K hK hn + obtain ⟨hgen,hword⟩ := flow_displacements_from_bounds (ι := ι) h l hS K U hU₀ hX hbound + refine ⟨β,hβt,hβc,?_,?_,?_⟩ + · exact (hβ (FreeGroup.of (none : Option ι))).trans (wordHom_of _ _) + · intro j + rw [hβ] + simpa only [wordHom_of, extendUnitary, Option.elim_some] using hgen j + · intro w + rw [hβ] + simpa only [wordHom_extend] using hword w + +end + +def groupL2 {G : Type uG} [Group G] : groupVonNeumann G →L[ℂ] GroupHilbert G := + ({ toFun := fun T => (T : GroupOperator G) deltaOne + map_add' := by intros; rfl + map_smul' := by intros; rfl } : groupVonNeumann G →ₗ[ℂ] GroupHilbert G).mkContinuous 1 (by + intro T + calc + ‖(T : GroupOperator G) deltaOne‖ ≤ ‖T‖ * ‖(deltaOne : GroupHilbert G)‖ := + ContinuousLinearMap.le_opNorm _ _ + _ = 1 * ‖T‖ := by simp [deltaOne, lp.norm_single]) + +abbrev twoNorm {G : Type uG} [Group G] (T : groupVonNeumann G) : ℝ := ‖groupL2 T‖ + +@[simp] theorem groupL2_apply {G : Type uG} [Group G] (T : groupVonNeumann G) : + groupL2 T = (T : GroupOperator G) deltaOne := rfl + +theorem twoNorm_le_norm {G : Type uG} [Group G] (T : groupVonNeumann G) : + twoNorm T ≤ ‖T‖ := by + calc + _ ≤ ‖(T : GroupOperator G)‖ * ‖(deltaOne : GroupHilbert G)‖ := + ContinuousLinearMap.le_opNorm _ _ + _ = _ := by simp [deltaOne, lp.norm_single] + +theorem twoNorm_sq {G : Type uG} [Group G] (T : groupVonNeumann G) : + (twoNorm T : ℂ)^2 = canonicalTrace (star T*T) := by + classical + rw [canonicalTrace_star_mul, ← deltaOne_eq] + rfl + +theorem twoNorm_star {G : Type uG} [Group G] (T : groupVonNeumann G) : + twoNorm (star T) = twoNorm T := by + classical + have hsq : (twoNorm (star T) : ℂ)^2 = (twoNorm T : ℂ)^2 := by + rw [twoNorm_sq, twoNorm_sq, star_star] + exact canonicalTrace_mul T (star T) + have hr := congrArg Complex.re hsq + norm_cast at hr + nlinarith [norm_nonneg (groupL2 (star T)), norm_nonneg (groupL2 T)] + +theorem twoNorm_mul_unitary_left {G : Type uG} [Group G] + (U : unitary (groupVonNeumann G)) (T : groupVonNeumann G) : + twoNorm ((U : groupVonNeumann G)*T) = twoNorm T := by + apply ContinuousLinearMap.norm_map_of_mem_unitary + exact ⟨congrArg Subtype.val U.property.1, congrArg Subtype.val U.property.2⟩ + +theorem twoNorm_mul_unitary_right {G : Type uG} [Group G] + (U : unitary (groupVonNeumann G)) (T : groupVonNeumann G) : + twoNorm (T*(U : groupVonNeumann G)) = twoNorm T := by + rw [← twoNorm_star, star_mul] + change twoNorm (((star U : unitary (groupVonNeumann G)) : groupVonNeumann G) * star T) = _ + rw [twoNorm_mul_unitary_left, twoNorm_star] + +theorem twoNorm_iso {G : Type uG} {H : Type uH} [Group G] [Group H] + (Φ : groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann H) + (hΦ : ∀ T, canonicalTrace (Φ T) = canonicalTrace T) (T : groupVonNeumann G) : + twoNorm (Φ T) = twoNorm T := by + have hs : Φ (star T) = star (Φ T) := Φ.map_star' T + have hm : Φ (star T * T) = Φ (star T) * Φ T := Φ.map_mul' (star T) T + have hsq : (twoNorm (Φ T) : ℂ)^2 = (twoNorm T : ℂ)^2 := by + rw [twoNorm_sq, twoNorm_sq, ← hs, ← hm, hΦ] + have hr := congrArg Complex.re hsq + norm_cast at hr + nlinarith [norm_nonneg (groupL2 (Φ T)), norm_nonneg (groupL2 T)] + +theorem canonicalTrace_star {G : Type uG} [Group G] (T : groupVonNeumann G) : + canonicalTrace (star T) = star (canonicalTrace T) := by + classical + have hh := groupVN_star_coefficient T 1 + change ((star T : GroupOperator G) (lp.single 2 1 1)) 1 = + (starRingEnd ℂ) (((T : GroupOperator G) (lp.single 2 1 1)) 1) + simpa only [deltaOne_eq, inv_one] using hh + +end + +end FreeGroupFactorMain + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/FiniteActive.lean b/lean/OAI/Analysis/FreeGroupFactor/FiniteActive.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c0b709c299d6fbc7a68fac8a90922551034d5d6 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/FiniteActive.lean @@ -0,0 +1,404 @@ +import OAI.Analysis.FreeGroupFactor.FiniteMoments + +namespace OAI + +noncomputable section + +universe uA uι uκ + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff ENNReal + +attribute [local instance] Classical.propDecidable + +namespace FreeGroupFactorMain.FiniteActive + +section +open UnitaryEvaluation +open scoped ENNReal + theorem original_generators_mem {ι : Type uι} {κ : Type uκ} [Fintype ι] [DecidableEq ι] [DecidableEq κ] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l)) + (X : ℝ → ι → Ambient ι κ) (hU : ∀ t i, X t i ∈ unitary (Ambient ι κ)) + (hX₀ : X 0 = fun i => groupUnitary (FreeGroup.of (some (Sum.inl i)))) + (hX : ∀ t, HasDerivAt X (PolynomialFlow.field + (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) h (X t)) t) + (E : StarSubalgebra ℂ (Ambient ι κ)) (hE : IsClosed (E : Set (Ambient ι κ))) + (hC : (generatorUnitary (none : Option (ι ⊕ κ)) : Ambient ι κ) ∈ E) + (t₀ : ℝ) (hXt : ∀ i, X t₀ i ∈ E) + (hpass : ∀ k : κ, (generatorUnitary (some (Sum.inr k) : Option (ι ⊕ κ)) : Ambient ι κ) ∈ E) : + ∀ i : Option (ι ⊕ κ), (generatorUnitary i : Ambient ι κ) ∈ E := by + have hXS := PolynomialFlow.solution_mem_subalgebra E hE + (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) hS + (laurentValue_mem E _ hC l) h X hX hU t₀ hXt + intro i + cases i with + | none => exact hC + | some j => + cases j with + | inl i => + change groupUnitary (FreeGroup.of (some (Sum.inl i))) ∈ E + simpa only [hX₀] using hXS 0 i + | inr k => exact hpass k + + theorem orbit_total {ι : Type uι} {κ : Type uκ} [Fintype ι] [DecidableEq ι] [DecidableEq κ] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l)) + (X : ℝ → ι → groupVonNeumann (FreeGroup (Option (ι ⊕ κ)))) + (hU : ∀ t j, X t j ∈ unitary (groupVonNeumann (FreeGroup (Option (ι ⊕ κ))))) + (hX₀ : X 0 = fun j => groupUnitary (FreeGroup.of (some (Sum.inl j)))) + (hX : ∀ t, HasDerivAt X (PolynomialFlow.field + (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) h (X t)) t) (t₀ : ℝ) : + ⊤ ≤ (Submodule.span ℂ (Set.range (fun g : FreeGroup (Option (ι ⊕ κ)) => + ((wordHom (extendUnitary (fun j => ⟨tuple (X t₀) j,tuple_unitary (X t₀) (hU t₀) j⟩) + (generatorUnitary none)) g : groupVonNeumann (FreeGroup (Option (ι ⊕ κ)))) : + GroupOperator (FreeGroup (Option (ι ⊕ κ)))) deltaOne))).topologicalClosure := by + classical + let U := extendUnitary (fun j => ⟨tuple (X t₀) j,tuple_unitary (X t₀) (hU t₀) j⟩) (generatorUnitary none) + let ρ : FreeGroup (Option (ι ⊕ κ)) →* GroupOperator (FreeGroup (Option (ι ⊕ κ))) := + (groupVonNeumann _).subtype.toMonoidHom.comp (wordHom U) + let K := (Submodule.span ℂ (Set.range (fun g => ρ g deltaOne))).topologicalClosure + let E := (reducingAlgebra K).comap (groupVonNeumann _).subtype + have hK : IsClosed (K : Set (GroupHilbert (FreeGroup (Option (ι ⊕ κ))))) := + Submodule.isClosed_topologicalClosure _ + have hE : IsClosed (E : Set (groupVonNeumann (FreeGroup (Option (ι ⊕ κ))))) := + (reducingAlgebra_isClosed K hK).preimage continuous_subtype_val + have hρ (g) : wordHom U g ∈ E := by + constructor + · exact closedSpan_invariant ρ deltaOne g + · have he : star (ρ g) = ρ g⁻¹ := by + change ((star (wordHom U g) : groupVonNeumann (FreeGroup (Option (ι ⊕ κ)))) : + GroupOperator (FreeGroup (Option (ι ⊕ κ)))) = _ + rw [← wordHom_inv] + rfl + change ∀ x ∈ K, (star (ρ g)) x ∈ K + rw [he] + exact closedSpan_invariant ρ deltaOne g⁻¹ + have hC : (generatorUnitary (none : Option (ι ⊕ κ)) : groupVonNeumann _) ∈ E := by + simpa only [wordHom_of, U, extendUnitary, Option.elim_none] using hρ (FreeGroup.of none) + have hXt : ∀ j, X t₀ j ∈ E := by + intro j + simpa only [wordHom_of, U, extendUnitary, Option.elim_some,tuple,Sum.elim_inl] using hρ (FreeGroup.of (some (Sum.inl j))) + have hpass (k : κ) : (generatorUnitary (some (Sum.inr k) : Option (ι ⊕ κ)) : Ambient ι κ) ∈ E := by + change groupUnitary (FreeGroup.of (some (Sum.inr k))) ∈ E + simpa only [wordHom_of,U,extendUnitary,Option.elim_some,tuple,Sum.elim_inr] + using hρ (FreeGroup.of (some (Sum.inr k))) + have hgen := original_generators_mem h l hS X hU hX₀ hX E hE hC t₀ hXt hpass + change ⊤ ≤ K + apply canonical_total_of_reducing K hK _ hgen + apply Submodule.le_topologicalClosure + apply Submodule.subset_span + exact ⟨1, by simp⟩ + +end +open UnitaryEvaluation + +theorem extension_at_time {ι : Type uι} {κ : Type uκ} [Fintype ι] [DecidableEq ι] [DecidableEq κ] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l)) + (X : ℝ → ι → Ambient ι κ) (hU : ∀ t i, X t i ∈ unitary (Ambient ι κ)) + (hX₀ : X 0 = fun i => groupUnitary (FreeGroup.of (some (Sum.inl i)))) + (hX : ∀ t, HasDerivAt X (PolynomialFlow.field + (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) h (X t)) t) (t : ℝ) : + ∃ Φ : Ambient ι κ ≃⋆ₐ[ℂ] Ambient ι κ, + (∀ T, canonicalTrace (Φ T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option (ι ⊕ κ)))) + (groupUltraweakTopology (FreeGroup (Option (ι ⊕ κ)))) Φ ∧ + ∀ g, Φ (groupUnitary g) = wordHom + (extendUnitary (fun j => ⟨tuple (X t) j,tuple_unitary (X t) (hU t) j⟩) + (generatorUnitary none)) g := by + exact iso_extension_of_haar_total + (wordHom (extendUnitary (fun j => ⟨tuple (X t) j,tuple_unitary (X t) (hU t) j⟩) + (generatorUnitary none))) + (fun g => (wordHom_inv _ g).symm) + (moments h l hS X hU hX₀ hX t) + (orbit_total h l hS X hU hX₀ hX t) + +theorem basis_solution {ι : Type uι} {κ : Type uκ} [Fintype ι] [DecidableEq ι] [DecidableEq κ] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l)) : + ∃ (X : ℝ → ι → Ambient ι κ), + X 0 = (fun i => groupUnitary (FreeGroup.of (some (Sum.inl i)))) ∧ + (∀ t, HasDerivAt X (PolynomialFlow.field + (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) h (X t)) t) ∧ + ∀ t i, X t i ∈ unitary (Ambient ι κ) := by + exact PolynomialFlow.global_unitary_solution (A := Ambient ι κ) + (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) hS h + (fun i => groupUnitary (FreeGroup.of (some (Sum.inl i)))) (fun _ => groupUnitary_mem_unitary _) + +theorem automorphisms {ι : Type uι} {κ : Type uκ} [Fintype ι] [DecidableEq ι] [DecidableEq κ] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l)) : + ∃ (X : ℝ → ι → Ambient ι κ) + (hU : ∀ t i, X t i ∈ unitary (Ambient ι κ)), + X 0 = (fun i => groupUnitary (FreeGroup.of (some (Sum.inl i)))) ∧ + (∀ t, HasDerivAt X (PolynomialFlow.field + (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) h (X t)) t) ∧ + ∀ t, ∃ Φ : Ambient ι κ ≃⋆ₐ[ℂ] Ambient ι κ, + (∀ T, canonicalTrace (Φ T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option (ι ⊕ κ)))) + (groupUltraweakTopology (FreeGroup (Option (ι ⊕ κ)))) Φ ∧ + ∀ g, Φ (groupUnitary g) = wordHom + (extendUnitary (fun j => ⟨tuple (X t) j,tuple_unitary (X t) (hU t) j⟩) + (generatorUnitary none)) g := by + obtain ⟨X,hX₀,hX,hU⟩ := basis_solution (ι := ι) (κ := κ) h l hS + refine ⟨X,hU,hX₀,hX,?_⟩ + intro t + exact extension_at_time h l hS X hU hX₀ hX t + +end FreeGroupFactorMain.FiniteActive + +namespace FreeGroupFactorMain.UnitaryEvaluation +variable {A : Type uA} [CStarAlgebra A] {ι : Type uι} {κ : Type uκ} + +theorem hamiltonianLinear_mapDomain (S : A) (U : κ → unitary A) + (f : ι → κ) (k : FreeGroup ι →₀ ℝ) : + hamiltonianLinear S U (Finsupp.mapDomain (FreeGroup.map f) k) = + hamiltonianLinear S (U ∘ f) k := by + classical + simp only [hamiltonianLinear,Finsupp.linearCombination_apply] + rw [Finsupp.sum_mapDomain_index (fun g => by simp) + (fun g a b => by simp [add_smul])] + apply Finsupp.sum_congr + intro g hg + rw [wordHom_map] + +end FreeGroupFactorMain.UnitaryEvaluation + +namespace FreeGroupFactorMain.FiniteActive + +section +open UnitaryEvaluation +variable {ι : Type uι} {κ : Type uκ} [Fintype ι] [DecidableEq ι] [DecidableEq κ] + +omit [Fintype ι] in +theorem flow_bound (l : ℤ →₀ ℂ) (h0 : l 0 = 0) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l)) + (K : ℝ) (hK : 0 ≤ K) + (hn : ‖laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l‖ ≤ K) + (U : ι → unitary (Ambient ι κ)) + (Φ : Ambient ι κ ≃⋆ₐ[ℂ] Ambient ι κ) + (hΦ : ∀ g, Φ (groupUnitary g) = wordHom + (extendUnitary (fun j => ⟨tuple (fun i => (U i : Ambient ι κ)) j, + tuple_unitary _ (fun i => (U i).property) j⟩) (generatorUnitary none)) g) + (k : FreeGroup ι →₀ ℝ) : + ‖hamiltonianLinear (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) U k‖ ≤ + 3*K*Real.sqrt (k.sum (fun _ r => r^2)) := by + let V : (ι ⊕ κ) → unitary (Ambient ι κ) := fun j => + ⟨tuple (fun i => (U i : Ambient ι κ)) j,tuple_unitary _ (fun i => (U i).property) j⟩ + have hb := flow_iso_hamiltonian_bound l h0 hS K hK hn V Φ hΦ + (Finsupp.mapDomain (FreeGroup.map Sum.inl) k) + rw [hamiltonianLinear_mapDomain, + Finsupp.sum_mapDomain_index_inj (FreeGroup.map_injective Sum.inl_injective)] at hb + exact hb + +theorem bounded_solution (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) (h0 : l 0 = 0) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l)) + (K : ℝ) (hK : 0 ≤ K) + (hn : ‖laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l‖ ≤ K) + (X : ℝ → ι → Ambient ι κ) (hU : ∀ t i, X t i ∈ unitary (Ambient ι κ)) + (hX₀ : X 0 = fun i => groupUnitary (FreeGroup.of (some (Sum.inl i)))) + (hX : ∀ t, HasDerivAt X (PolynomialFlow.field + (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) h (X t)) t) : + ∀ t k, ‖hamiltonianLinear + (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) + (fun i => ⟨X t i,hU t i⟩) k‖ ≤ 3*K*Real.sqrt (k.sum (fun _ r => r^2)) := by + intro t k + obtain ⟨Φ,_ht,_hc,hΦ⟩ := extension_at_time (ι := ι) (κ := κ) h l hS X hU hX₀ hX t + exact flow_bound (ι := ι) (κ := κ) l h0 hS K hK hn (fun i => ⟨X t i,hU t i⟩) Φ hΦ k + +theorem bounded_flow (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) (h0 : l 0 = 0) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l)) + (K : ℝ) (hK : 0 ≤ K) + (hn : ‖laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l‖ ≤ K) : + ∃ U : ℝ → ι → unitary (Ambient ι κ), + U 0 = (fun i => generatorUnitary (some (Sum.inl i) : Option (ι ⊕ κ))) ∧ + (∀ t, HasDerivAt (fun t i => (U t i : Ambient ι κ)) + (PolynomialFlow.field (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) + h (fun i => (U t i : Ambient ι κ))) t) ∧ + (∀ t k, ‖hamiltonianLinear + (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) (U t) k‖ ≤ + 3*K*Real.sqrt (k.sum (fun _ r => r^2))) ∧ + ∃ β : Ambient ι κ ≃⋆ₐ[ℂ] Ambient ι κ, + (∀ T, canonicalTrace (β T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option (ι ⊕ κ)))) + (groupUltraweakTopology (FreeGroup (Option (ι ⊕ κ)))) β ∧ + ∀ g, β (groupUnitary g) = wordHom + (extendUnitary (fun j => ⟨tuple (fun i => (U 1 i : Ambient ι κ)) j, + tuple_unitary _ (fun i => (U 1 i).property) j⟩) (generatorUnitary none)) g := by + obtain ⟨X,hX₀,hX,hU⟩ := basis_solution (ι := ι) (κ := κ) h l hS + let U (t : ℝ) : ι → unitary (Ambient ι κ) := fun i => ⟨X t i,hU t i⟩ + refine ⟨U,?_,hX,?_,?_⟩ + · funext i + exact Subtype.ext (congrFun hX₀ i) + · exact bounded_solution (ι := ι) (κ := κ) h l h0 hS K hK hn X hU hX₀ hX + · exact extension_at_time (ι := ι) (κ := κ) h l hS X hU hX₀ hX 1 + +omit [Fintype ι] [DecidableEq ι] [DecidableEq κ] in +theorem wordHom_active (w : FreeGroup ι) : + wordHom (fun i => generatorUnitary (some (Sum.inl i) : Option (ι ⊕ κ))) w = + groupUnitary (FreeGroup.map (fun i => some (Sum.inl i)) w) := by + rw [← wordHom_generatorUnitary,wordHom_map] + rfl + +omit [Fintype ι] [DecidableEq ι] [DecidableEq κ] in +theorem wordHom_tuple_active (U : ι → unitary (Ambient ι κ)) (w : FreeGroup ι) : + wordHom (extendUnitary (fun j => ⟨tuple (fun i => (U i : Ambient ι κ)) j, + tuple_unitary _ (fun i => (U i).property) j⟩) (generatorUnitary none)) + (FreeGroup.map (fun i => some (Sum.inl i)) w) = wordHom U w := by + rw [wordHom_map] + rfl + +omit [DecidableEq κ] in +theorem displacements_from_bounds + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l)) (K : ℝ) + (U : ℝ → ι → unitary (Ambient ι κ)) + (hU₀ : U 0 = fun j => generatorUnitary (some (Sum.inl j) : Option (ι ⊕ κ))) + (hX : ∀ t, HasDerivAt (fun t j => (U t j : Ambient ι κ)) + (PolynomialFlow.field (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) h + (fun j => (U t j : Ambient ι κ))) t) + (hbound : ∀ t k, ‖hamiltonianLinear (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) (U t) k‖ ≤ + 3*K*Real.sqrt (k.sum (fun _ r => r^2))) : + (∀ j, ‖(U 1 j : Ambient ι κ) - groupUnitary (FreeGroup.of (some (Sum.inl j)))‖ ≤ + 3*K*Real.sqrt ((h j).sum (fun _ r => r^2))) ∧ + ∀ w : FreeGroup ι, ‖wordHom (U 1) w - NormedSpace.exp (Complex.I • laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) * + groupUnitary (FreeGroup.map (fun i => some (Sum.inl i)) w)‖ ≤ + 3*K*Real.sqrt ((freeCocycle h w - Finsupp.single 1 1).sum (fun _ r => r^2)) := by + constructor + · intro j + have hd := generator_displacement (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) h U hX + (fun j => 3*K*Real.sqrt ((h j).sum (fun _ r => r^2))) + (fun t j => hbound t (h j)) j + rw [hU₀] at hd + exact hd + · intro w + have hd := word_displacement (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) hS h U hX w + (3*K*Real.sqrt ((freeCocycle h w - Finsupp.single 1 1).sum (fun _ r => r^2))) + (fun t => hbound t (freeCocycle h w - Finsupp.single 1 1)) + rwa [hU₀, wordHom_active] at hd + +theorem displacement (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) (h0 : l 0 = 0) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l)) + (K : ℝ) (hK : 0 ≤ K) + (hn : ‖laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l‖ ≤ K) : + ∃ β : Ambient ι κ ≃⋆ₐ[ℂ] Ambient ι κ, + (∀ T, canonicalTrace (β T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option (ι ⊕ κ)))) + (groupUltraweakTopology (FreeGroup (Option (ι ⊕ κ)))) β ∧ + β (groupUnitary (FreeGroup.of none)) = groupUnitary (FreeGroup.of none) ∧ + (∀ k : κ, β (groupUnitary (FreeGroup.of (some (Sum.inr k)))) = + groupUnitary (FreeGroup.of (some (Sum.inr k)))) ∧ + (∀ i : ι, ‖β (groupUnitary (FreeGroup.of (some (Sum.inl i) : Option (ι ⊕ κ)))) - + groupUnitary (FreeGroup.of (some (Sum.inl i) : Option (ι ⊕ κ)))‖ ≤ + 3*K*Real.sqrt ((h i).sum (fun _ r => r^2))) ∧ + ∀ w : FreeGroup ι, ‖β (groupUnitary (FreeGroup.map (fun i => some (Sum.inl i)) w)) - + NormedSpace.exp (Complex.I • laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) * + groupUnitary (FreeGroup.map (fun i => some (Sum.inl i)) w)‖ ≤ + 3*K*Real.sqrt ((freeCocycle h w - Finsupp.single 1 1).sum (fun _ r => r^2)) := by + obtain ⟨U,hU₀,hX,hbound,β,hβt,hβc,hβ⟩ := bounded_flow (ι := ι) (κ := κ) h l h0 hS K hK hn + obtain ⟨hgen,hword⟩ := displacements_from_bounds (ι := ι) (κ := κ) h l hS K U hU₀ hX hbound + refine ⟨β,hβt,hβc,?_,?_,?_,?_⟩ + · exact (hβ (FreeGroup.of (none : Option (ι ⊕ κ)))).trans (wordHom_of _ _) + · intro k + exact (hβ (FreeGroup.of (some (Sum.inr k) : Option (ι ⊕ κ)))).trans (wordHom_of _ _) + · intro i + rw [hβ] + simpa only [wordHom_of,extendUnitary,Option.elim_some,tuple,Sum.elim_inl] using hgen i + · intro w + rw [hβ] + simpa only [wordHom_tuple_active] using hword w + +end + +open UnitaryEvaluation + + theorem one_step_from_laurent {κ : Type uκ} [DecidableEq κ] + (n : ℕ) {ε : ℝ} (hε : 0 < ε) + (l : ℤ →₀ ℂ) (hl0 : l 0 = 0) + (hlS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (Fin n ⊕ κ))) l)) + (hln : ‖laurentValue (generatorUnitary (none : Option (Fin n ⊕ κ))) l‖ ≤ 2*(Real.pi+1)) + (z : unitary ℂ) (hze : twoNorm (NormedSpace.exp (Complex.I • laurentValue + (generatorUnitary (none : Option (Fin n ⊕ κ))) l) - + (z : ℂ) • groupUnitary (FreeGroup.of none)) < ε/2) + (w : FreeGroup (Fin n)) (h : Coeff (FreeGroup (Fin n))) + (hh : coefficientNorm h < (ε/2)/(3*(2*(Real.pi+1)))) + (hw : coefficientNorm (freeCocycle (firstCoefficients h) w-Finsupp.single 1 1) < + (ε/2)/(3*(2*(Real.pi+1)))) : + ∃ α : Ambient (Fin n) κ ≃⋆ₐ[ℂ] Ambient (Fin n) κ, + (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + (∀ k : κ, α (groupUnitary (FreeGroup.of (some (Sum.inr k)))) = + groupUnitary (FreeGroup.of (some (Sum.inr k)))) ∧ + ∃ w : FreeGroup (Fin n), + (∀ i : Fin n, ‖α (groupUnitary (FreeGroup.of (some (Sum.inl i)))) - + groupUnitary (FreeGroup.of (some (Sum.inl i)))‖ < ε) ∧ + twoNorm (α (groupUnitary (FreeGroup.map (fun i => some (Sum.inl i)) w)) - + groupUnitary (FreeGroup.of none)) < ε := by + let K : ℝ := 2*(Real.pi+1) + have hK : 0 < K := by dsimp [K]; positivity + obtain ⟨β,hβt,_hβn,_hβC,hβpass,hβgen,hβword⟩ := + displacement (κ := κ) (firstCoefficients h) l hl0 hlS K hK.le hln + obtain ⟨γ,hγt,_hγn,_hγi,hγgen,hγC⟩ := + gauged_nielsen_iso (ι := Fin n ⊕ κ) (FreeGroup.map Sum.inl w) z + have hmap : FreeGroup.map (Option.some : Fin n ⊕ κ → Option (Fin n ⊕ κ)) + (FreeGroup.map Sum.inl w) = FreeGroup.map (fun i => some (Sum.inl i)) w := by + have he : (FreeGroup.map (Option.some : Fin n ⊕ κ → Option (Fin n ⊕ κ))).comp + (FreeGroup.map Sum.inl) = FreeGroup.map (fun i => some (Sum.inl i)) := by + apply FreeGroup.ext_hom + intro i + simp + exact DFunLike.congr_fun he w + rw [hmap] at hγC + refine ⟨β.trans γ.symm,?_,?_,w,?_,?_⟩ + · intro T + change canonicalTrace (γ.symm (β T)) = canonicalTrace T + rw [trace_symm γ hγt,hβt] + · intro k + change γ.symm (β (groupUnitary (FreeGroup.of (some (Sum.inr k))))) = _ + rw [hβpass,← hγgen (Sum.inr k),γ.symm_apply_apply] + exact (hγgen (Sum.inr k)).symm + · intro i + exact one_step_generator_estimate β γ _ (hγgen (Sum.inl i)) hK hε (hβgen i) + ((firstCoefficients_norm_le h i).trans_lt hh) + · exact one_step_word_estimate β γ hγt + (generatorUnitary (none : Option (Fin n ⊕ κ))) + (groupUnitaryUHom (FreeGroup (Option (Fin n ⊕ κ))) + (FreeGroup.map (fun i => some (Sum.inl i)) w)) + _ z hγC hK (hβword w) hw hze + +theorem one_step_of_coefficient_estimate {κ : Type uκ} [DecidableEq κ] (n : ℕ) + (hc : ∀ η : ℝ, 0 < η → ∃ (w : FreeGroup (Fin n)) (h : Coeff (FreeGroup (Fin n))), + coefficientNorm h < η ∧ coefficientNorm (freeCocycle (firstCoefficients h) w-Finsupp.single 1 1) < η) + {ε : ℝ} (hε : 0 < ε) : + ∃ α : Ambient (Fin n) κ ≃⋆ₐ[ℂ] Ambient (Fin n) κ, + (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + (∀ k : κ, α (groupUnitary (FreeGroup.of (some (Sum.inr k)))) = + groupUnitary (FreeGroup.of (some (Sum.inr k)))) ∧ + ∃ w : FreeGroup (Fin n), + (∀ i : Fin n, ‖α (groupUnitary (FreeGroup.of (some (Sum.inl i)))) - + groupUnitary (FreeGroup.of (some (Sum.inl i)))‖ < ε) ∧ + twoNorm (α (groupUnitary (FreeGroup.map (fun i => some (Sum.inl i)) w)) - + groupUnitary (FreeGroup.of none)) < ε := by + obtain ⟨l,hl0,hlS,hln,z,hze⟩ := haar_centered_laurent + (generatorUnitary (none : Option (Fin n ⊕ κ))) (generator_haar _) (half_pos hε) + rw [← laurentValue_eq_value] at hlS hln hze + obtain ⟨w,h,hh,hw⟩ := hc ((ε/2)/(3*(2*(Real.pi+1)))) (by positivity) + exact one_step_from_laurent n hε l hl0 hlS hln z hze w h hh hw + +theorem one_step {κ : Type uκ} [DecidableEq κ] (n : ℕ) (hn : 3 ≤ n) + {ε : ℝ} (hε : 0 < ε) : + ∃ α : Ambient (Fin n) κ ≃⋆ₐ[ℂ] Ambient (Fin n) κ, + (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + (∀ k : κ, α (groupUnitary (FreeGroup.of (some (Sum.inr k)))) = + groupUnitary (FreeGroup.of (some (Sum.inr k)))) ∧ + ∃ w : FreeGroup (Fin n), + (∀ i : Fin n, ‖α (groupUnitary (FreeGroup.of (some (Sum.inl i)))) - + groupUnitary (FreeGroup.of (some (Sum.inl i)))‖ < ε) ∧ + twoNorm (α (groupUnitary (FreeGroup.map (fun i => some (Sum.inl i)) w)) - + groupUnitary (FreeGroup.of none)) < ε := one_step_of_coefficient_estimate n (smallCocycle n hn) hε + +end FreeGroupFactorMain.FiniteActive + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/FiniteMoments.lean b/lean/OAI/Analysis/FreeGroupFactor/FiniteMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ef3fbfdc2bb980a3527a6f691b5649c4bbe60a1 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/FiniteMoments.lean @@ -0,0 +1,378 @@ +import OAI.Analysis.FreeGroupFactor.FiniteRank + +namespace OAI + +noncomputable section + +universe uA uι uκ + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff ENNReal + +attribute [local instance] Classical.propDecidable + +open scoped ContDiff BigOperators ENNReal +namespace FreeGroupFactorMain +theorem source_laurent_moments_bounded {ι : Type uι} [DecidableEq ι] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (Y : ℝ → (Option ι × Bool) → groupVonNeumann (FreeGroup (Option ι))) + (hY₀ : ∀ ib, Y 0 ib = groupUnitary (AlgebraPolynomial.signed ib)) + (hsmooth : ∀ ib, ContDiff ℝ ∞ (fun t => Y t ib)) + (hbounded : ∀ t ib, ‖Y t ib‖ ≤ 1) + (hODE : ∀ t ib, HasDerivAt (fun s => Y s ib) + (NCPolynomial.eval (Y t) + (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) ib)) t) + (J : ℕ) (B : ℝ) (hB : 0 ≤ B) + (hdeg : ∀ ib, NCPolynomial.degree (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) ib) ≤ J + 1) + (hmass : ∀ ib, NCPolynomial.mass (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) ib) ≤ B) + (p : NCPolynomial.Expr (Option ι × Bool)) (t : ℝ) : + canonicalTrace (NCPolynomial.eval (Y t) p) = + canonicalTrace (NCPolynomial.eval (Y 0) p) := by + classical + let V := AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) + have hinitial (q) : canonicalTrace (NCPolynomial.eval (Y 0) (NCPolynomial.delta V q)) = 0 := by + have hinit : Y 0 = fun ib => groupUnitary (AlgebraPolynomial.signed ib) := funext hY₀ + rw [hinit, canonicalTrace_eval] + exact AlgebraPolynomial.encoded_initial_trace h l q + have hreal (L : ℂ →L[ℝ] ℝ) : + L (canonicalTrace (NCPolynomial.eval (Y t) p)) = + L (canonicalTrace (NCPolynomial.eval (Y 0) p)) := by + let Lt := L.comp ((canonicalTraceCLM (G := FreeGroup (Option ι))).restrictScalars ℝ) + apply NCPolynomial.polynomial_moments Y V Lt hsmooth hODE 1 le_rfl hbounded + J B hB hdeg hmass + intro q + change L (canonicalTrace (NCPolynomial.eval (Y 0) (NCPolynomial.delta V q))) = 0 + rw [hinitial, map_zero] + exact Complex.ext (hreal Complex.reCLM) (hreal Complex.imCLM) + +end FreeGroupFactorMain +namespace FreeGroupFactorMain.UnitaryEvaluation +variable {A : Type uA} [CStarAlgebra A] {ι : Type uι} + theorem signedTrajectory_coordinate_ode [DecidableEq ι] + (C : unitary A) (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue C l)) + (X : ℝ → ι → A) (hU : ∀ t j, X t j ∈ unitary A) + (hX : ∀ t i, HasDerivAt (fun s => X s i) (PolynomialFlow.field (laurentValue C l) h (X t) i) t) + (t : ℝ) (ib : Option ι × Bool) : + HasDerivAt (fun s => signedTrajectory X hU C s ib) + (NCPolynomial.eval (signedTrajectory X hU C t) + (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) ib)) t := by + have hpos (j : Option ι) : NCPolynomial.eval (signedTrajectory X hU C t) + (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) (j,true)) = + coefficientHom (wordHom (extendUnitary (fun j => ⟨X t j, hU t j⟩) C)) + (TraceCocycle.fieldCoefficients h l j) * + (extendUnitary (fun j => ⟨X t j,hU t j⟩) C j : A) := + eval_encodedField_pos _ _ _ + have hneg (j : Option ι) : NCPolynomial.eval (signedTrajectory X hU C t) + (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) (j,false)) = + -(star (extendUnitary (fun j => ⟨X t j,hU t j⟩) C j : A) * + coefficientHom (wordHom (extendUnitary (fun j => ⟨X t j, hU t j⟩) C)) + (TraceCocycle.fieldCoefficients h l j)) := + eval_encodedField_neg _ _ _ + rcases ib with ⟨i,b⟩ + cases i with + | none => + cases b + · rw [hneg] + simp only [TraceCocycle.fieldCoefficients, map_zero, mul_zero, neg_zero] + simpa only [signedTrajectory_none_neg] using hasDerivAt_const t (star (C : A)) + · rw [hpos] + simp only [TraceCocycle.fieldCoefficients, map_zero, zero_mul] + simpa only [signedTrajectory_none_pos] using hasDerivAt_const t (C : A) + | some i => + have hi := hX t i + cases b + · rw [hneg, coefficientHom_fieldCoefficients] + have hs := hi.star + have he : star (PolynomialFlow.field (laurentValue C l) h (X t) i) = + -(star (X t i) * (Complex.I • PolynomialFlow.hamiltonian (laurentValue C l) (h i) (X t))) := by + simp only [PolynomialFlow.field, star_smul, star_mul, Complex.star_def, + Complex.conj_I, (PolynomialFlow.selfAdjoint_hamiltonian _ hS _ _).star_eq, + neg_smul, mul_smul_comm] + rw [he] at hs + simpa only [signedTrajectory_some_neg, extendUnitary, Option.elim_some] using hs + · rw [hpos, coefficientHom_fieldCoefficients] + simpa only [signedTrajectory_some_pos, extendUnitary, Option.elim_some, + PolynomialFlow.field, smul_mul_assoc] using hi + +end FreeGroupFactorMain.UnitaryEvaluation + +namespace FreeGroupFactorMain +open scoped ContDiff +open UnitaryEvaluation + +theorem encodedField_finite_range {ι : Type uι} [DecidableEq ι] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (s : Finset ι) (hs : ∀ i, i ∉ s → h i = 0) : + (Set.range (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l))).Finite := by + classical + let S : Finset (Option ι × Bool) := (insert none (s.image some)).product Finset.univ + let V := AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) + have hz (ib : Option ι × Bool) (hib : ib ∉ S) : + V ib = AlgebraPolynomial.encode (0 : MonoidAlgebra ℂ (FreeGroup (Option ι))) := by + have hi : ∃ i, ib.1 = some i ∧ i ∉ s := by + rcases ib with ⟨i,b⟩ + cases i with + | none => simp [S] at hib + | some i => exact ⟨i,rfl,by simpa [S] using hib⟩ + obtain ⟨i,hi,his⟩ := hi + have hf : TraceCocycle.fieldCoefficients h l (some i) = 0 := by + simp [TraceCocycle.fieldCoefficients,hs i his] + change AlgebraPolynomial.encode (TraceCocycle.algebraDerivative _ + (MonoidAlgebra.of ℂ _ (AlgebraPolynomial.signed ib))) = _ + congr 1 + ext b + cases hb : ib.2 <;> + simp [AlgebraPolynomial.signed,hi,hb,TraceCocycle.cocycle_inv,hf] + apply (Set.Finite.insert (AlgebraPolynomial.encode (0 : MonoidAlgebra ℂ (FreeGroup (Option ι)))) + (S.finite_toSet.image V)).subset + rintro q ⟨ib,rfl⟩ + by_cases hb : ib ∈ S + · exact Set.mem_insert_of_mem _ ⟨ib,hb,rfl⟩ + · exact Set.mem_insert_iff.mpr (Or.inl (hz ib hb)) + +theorem source_laurent_moments_finite {ι : Type uι} [DecidableEq ι] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (s : Finset ι) (hs : ∀ i, i ∉ s → h i = 0) + (Y : ℝ → (Option ι × Bool) → groupVonNeumann (FreeGroup (Option ι))) + (hY₀ : ∀ ib, Y 0 ib = groupUnitary (AlgebraPolynomial.signed ib)) + (hsmooth : ∀ ib, ContDiff ℝ ∞ (fun t => Y t ib)) + (hbounded : ∀ t ib, ‖Y t ib‖ ≤ 1) + (hODE : ∀ t ib, HasDerivAt (fun s => Y s ib) + (NCPolynomial.eval (Y t) + (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) ib)) t) + (p : NCPolynomial.Expr (Option ι × Bool)) (t : ℝ) : + canonicalTrace (NCPolynomial.eval (Y t) p) = + canonicalTrace (NCPolynomial.eval (Y 0) p) := by + classical + let V := AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) + let S := (encodedField_finite_range h l s hs).toFinset + have hmem (ib) : V ib ∈ S := by simp [S,V] + let J := S.sup NCPolynomial.degree + let B := ∑ q ∈ S, NCPolynomial.mass q + have hB : 0 ≤ B := Finset.sum_nonneg fun _ _ => NCPolynomial.mass_nonneg _ + apply source_laurent_moments_bounded h l Y hY₀ hsmooth hbounded hODE J B hB + · intro ib + exact (Finset.le_sup (f := NCPolynomial.degree) (hmem ib)).trans (Nat.le_succ _) + · intro ib + exact Finset.single_le_sum (fun q _ => NCPolynomial.mass_nonneg q) (hmem ib) + + theorem laurent_flow_coordinate_moments {ι : Type uι} [DecidableEq ι] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (s : Finset ι) (hs : ∀ i, i ∉ s → h i = 0) + (hS : IsSelfAdjoint (UnitaryEvaluation.laurentValue + (generatorUnitary (none : Option ι)) l)) + (X : ℝ → ι → groupVonNeumann (FreeGroup (Option ι))) + (hU : ∀ t j, X t j ∈ unitary (groupVonNeumann (FreeGroup (Option ι)))) + (hX₀ : X 0 = fun j => groupUnitary (FreeGroup.of (some j))) + (hX : ∀ t i, HasDerivAt (fun s => X s i) (PolynomialFlow.field + (UnitaryEvaluation.laurentValue (generatorUnitary (none : Option ι)) l) h (X t) i) t) + (hsmoothX : ∀ i, ContDiff ℝ ∞ (fun t => X t i)) : + ∀ t (g : FreeGroup (Option ι)), + canonicalTrace (UnitaryEvaluation.wordHom + (UnitaryEvaluation.extendUnitary (fun j => ⟨X t j, hU t j⟩) + (generatorUnitary none)) g) = if g = 1 then 1 else 0 := by + classical + let C : unitary (groupVonNeumann (FreeGroup (Option ι))) := generatorUnitary none + let S := UnitaryEvaluation.laurentValue C l + let Y := UnitaryEvaluation.signedTrajectory X hU C + have hu0 : UnitaryEvaluation.extendUnitary (fun j => ⟨X 0 j, hU 0 j⟩) C = + generatorUnitary := by + funext i + cases i with + | none => rfl + | some j => apply Subtype.ext; exact congrFun hX₀ j + have hY₀ (ib) : Y 0 ib = groupUnitary (AlgebraPolynomial.signed ib) := by + dsimp [Y, UnitaryEvaluation.signedTrajectory] + rw [hu0, wordHom_generatorUnitary] + have hsmooth (ib) : ContDiff ℝ ∞ (fun t => Y t ib) := by + rcases ib with ⟨i,b⟩ + cases i with + | none => cases b <;> + simp only [Y,signedTrajectory_none_pos,signedTrajectory_none_neg] <;> + exact contDiff_const + | some i => cases b + · simp only [Y,signedTrajectory_some_neg] + exact (starL ℝ (A := groupVonNeumann (FreeGroup (Option ι)))).contDiff.comp (hsmoothX i) + · simpa only [Y,signedTrajectory_some_pos] using hsmoothX i + have hbounded (t ib) : ‖Y t ib‖ ≤ 1 := + UnitaryEvaluation.norm_signedTrajectory_le_one X hU C t ib + intro t g + let p := AlgebraPolynomial.encode (MonoidAlgebra.of ℂ (FreeGroup (Option ι)) g) + have hmoment := source_laurent_moments_finite h l s hs Y hY₀ hsmooth hbounded + (UnitaryEvaluation.signedTrajectory_coordinate_ode C h l hS X hU hX) p t + have he (s) : NCPolynomial.eval (Y s) p = + UnitaryEvaluation.wordHom + (UnitaryEvaluation.extendUnitary (fun j => ⟨X s j, hU s j⟩) C) g := by + change NCPolynomial.eval (fun ib => UnitaryEvaluation.wordHom + (UnitaryEvaluation.extendUnitary (fun j => ⟨X s j, hU s j⟩) C) + (AlgebraPolynomial.signed ib)) (AlgebraPolynomial.encode + (MonoidAlgebra.of ℂ (FreeGroup (Option ι)) g)) = _ + rw [UnitaryEvaluation.eval_encode, UnitaryEvaluation.algebraHom_of] + rw [he, he, hu0, wordHom_generatorUnitary, canonicalTrace_groupUnitary] at hmoment + exact hmoment + +end FreeGroupFactorMain + +namespace FreeGroupFactorMain.UnitaryEvaluation +open scoped ContDiff +variable {A : Type uA} [CStarAlgebra A] {ι : Type uι} {κ : Type uκ} + +@[simp] theorem wordHom_map (U : κ → unitary A) (f : ι → κ) (g : FreeGroup ι) : + wordHom U (FreeGroup.map f g) = wordHom (U ∘ f) g := by + have he : (wordHom U).comp (FreeGroup.map f) = wordHom (U ∘ f) := by + apply FreeGroup.ext_hom + intro i + simp + exact DFunLike.congr_fun he g + +theorem hamiltonian_map [DecidableEq ι] [DecidableEq κ] + (S : A) (h : FreeGroup ι →₀ ℝ) (f : ι → κ) (U : κ → unitary A) : + PolynomialFlow.hamiltonian S (Finsupp.mapDomain (FreeGroup.map f) h) (fun j => (U j : A)) = + PolynomialFlow.hamiltonian S h (fun i => (U (f i) : A)) := by + classical + simp only [PolynomialFlow.hamiltonian] + rw [Finsupp.sum_mapDomain_index (fun g => by simp) (fun g a b => by simp [add_smul])] + apply Finsupp.sum_congr + intro g hg + rw [← wordHom_word,wordHom_map,wordHom_word] + rfl + +theorem solution_coordinate_deriv [Fintype ι] [DecidableEq ι] + (S : A) (h : ι → FreeGroup ι →₀ ℝ) (X : ℝ → ι → A) + (hX : ∀ t, HasDerivAt X (PolynomialFlow.field S h (X t)) t) (t : ℝ) (i : ι) : + HasDerivAt (fun s => X s i) (PolynomialFlow.field S h (X t) i) t := + hasDerivAt_pi.mp (hX t) i + +theorem solution_coordinate_smooth [Fintype ι] [DecidableEq ι] + (S : A) (h : ι → FreeGroup ι →₀ ℝ) (X : ℝ → ι → A) + (hX : ∀ t, HasDerivAt X (PolynomialFlow.field S h (X t)) t) (i : ι) : + ContDiff ℝ ∞ (fun t => X t i) := + (contDiff_apply ℝ A i).comp (PolynomialFlow.smooth_solution S h X hX) + +end FreeGroupFactorMain.UnitaryEvaluation + +namespace FreeGroupFactorMain.FiniteActive +open UnitaryEvaluation +open scoped ContDiff +variable {ι : Type uι} {κ : Type uκ} + +abbrev Ambient (ι : Type uι) (κ : Type uκ) : Type _ := ↥(groupVonNeumann (FreeGroup (Option (ι ⊕ κ)))) + +instance ambientMulActionReal : MulAction ℝ (Ambient ι κ) := + (groupVN_normedSpaceReal (FreeGroup (Option (ι ⊕ κ)))).toModule.toMulAction + +instance ambientContinuousSMulReal : ContinuousSMul ℝ (Ambient ι κ) := by + let : NormedSpace ℝ (Ambient ι κ) := groupVN_normedSpaceReal _ + exact IsBoundedSMul.continuousSMul + +def coefficients (h : ι → FreeGroup ι →₀ ℝ) : (ι ⊕ κ) → FreeGroup (ι ⊕ κ) →₀ ℝ := + Sum.elim (fun i => Finsupp.mapDomain (FreeGroup.map Sum.inl) (h i)) (fun _ => 0) + +def tuple (X : ι → Ambient ι κ) : (ι ⊕ κ) → Ambient ι κ := + Sum.elim X (fun k => groupUnitary (FreeGroup.of (some (Sum.inr k)))) + +theorem tuple_unitary (X : ι → Ambient ι κ) (hX : ∀ i, X i ∈ unitary (Ambient ι κ)) : + ∀ j, tuple X j ∈ unitary (Ambient ι κ) := by + intro j + cases j with + | inl i => exact hX i + | inr k => exact groupUnitary_mem_unitary _ + +theorem field_inl [DecidableEq ι] [DecidableEq κ] + (S : Ambient ι κ) (h : ι → FreeGroup ι →₀ ℝ) + (X : ι → Ambient ι κ) (hX : ∀ i, X i ∈ unitary (Ambient ι κ)) (i : ι) : + PolynomialFlow.field S (coefficients h) (tuple X) (Sum.inl i) = + PolynomialFlow.field S h X i := by + let U : (ι ⊕ κ) → unitary (Ambient ι κ) := fun j => ⟨tuple X j,tuple_unitary X hX j⟩ + change Complex.I • (PolynomialFlow.hamiltonian S + (Finsupp.mapDomain (FreeGroup.map Sum.inl) (h i)) (fun j => (U j : Ambient ι κ)) * X i) = _ + rw [hamiltonian_map] + rfl + +@[simp] theorem field_inr [DecidableEq ι] [DecidableEq κ] + (S : Ambient ι κ) (h : ι → FreeGroup ι →₀ ℝ) + (X : ι → Ambient ι κ) (k : κ) : + PolynomialFlow.field S (coefficients h) (tuple X) (Sum.inr k) = 0 := by + change Complex.I • ((0 : Ambient ι κ) * tuple X (Sum.inr k)) = 0 + rw [zero_mul] + apply Subtype.ext + exact smul_zero Complex.I + +theorem moments [Fintype ι] [DecidableEq ι] [DecidableEq κ] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue + (generatorUnitary (none : Option (ι ⊕ κ))) l)) + (X : ℝ → ι → Ambient ι κ) (hU : ∀ t i, X t i ∈ unitary (Ambient ι κ)) + (hX₀ : X 0 = fun i => groupUnitary (FreeGroup.of (some (Sum.inl i)))) + (hX : ∀ t, HasDerivAt X (PolynomialFlow.field + (laurentValue (generatorUnitary (none : Option (ι ⊕ κ))) l) h (X t)) t) : + ∀ t (g : FreeGroup (Option (ι ⊕ κ))), canonicalTrace (wordHom + (extendUnitary (fun j => ⟨tuple (X t) j,tuple_unitary (X t) (hU t) j⟩) + (generatorUnitary none)) g) = if g = 1 then 1 else 0 := by + classical + let s : Finset (ι ⊕ κ) := Finset.univ.image Sum.inl + have hs (j) (hj : j ∉ s) : coefficients (κ := κ) h j = 0 := by + cases j with + | inl i => simp [s] at hj + | inr k => rfl + apply laurent_flow_coordinate_moments (coefficients h) l s hs hS + (fun t => tuple (X t)) (fun t => tuple_unitary (X t) (hU t)) + · funext j + cases j with + | inl i => exact congrFun hX₀ i + | inr k => rfl + · intro t j + cases j with + | inl i => + rw [field_inl _ h (X t) (hU t)] + exact solution_coordinate_deriv _ h X hX t i + | inr k => + rw [field_inr] + exact hasDerivAt_const t _ + · intro j + cases j with + | inl i => + change ContDiff ℝ _ (fun t => X t i) + exact solution_coordinate_smooth _ h X hX i + | inr k => exact contDiff_const + +end FreeGroupFactorMain.FiniteActive + +namespace FreeGroupFactorMain +open UnitaryEvaluation +open scoped ENNReal + theorem canonical_total_of_reducing {ι : Type uι} + (K : Submodule ℂ (GroupHilbert (FreeGroup ι))) + (hK : IsClosed (K : Set (GroupHilbert (FreeGroup ι)))) (hδ : deltaOne ∈ K) + (hgen : ∀ i : ι, (generatorUnitary i : groupVonNeumann (FreeGroup ι)) ∈ + (reducingAlgebra K).comap (groupVonNeumann (FreeGroup ι)).subtype) : ⊤ ≤ K := by + classical + let E := (reducingAlgebra K).comap (groupVonNeumann (FreeGroup ι)).subtype + have hgroup (g : FreeGroup ι) : groupUnitary g ∈ E := by + rw [← wordHom_generatorUnitary] + exact wordHom_mem E generatorUnitary hgen g + have hsingle (g : FreeGroup ι) : lp.single 2 g (1 : ℂ) ∈ K := by + have hh := (hgroup g).1 deltaOne hδ + have he : (leftRegular g) deltaOne = lp.single 2 g 1 := by + ext x + simp [deltaOne, lp.single_apply, Pi.single_apply, inv_mul_eq_one, eq_comm] + change (leftRegular g) deltaOne ∈ K at hh + rwa [he] at hh + intro ξ _hξ + have hs := lp.hasSum_single (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) ξ + apply hK.mem_of_tendsto hs + filter_upwards [] with s + apply K.sum_mem + intro g _hg + have he : lp.single 2 g (ξ g) = (ξ g) • (lp.single 2 g (1 : ℂ) : GroupHilbert (FreeGroup ι)) := by + ext x + simp [lp.single_apply, Pi.single_apply] + rw [he] + exact K.smul_mem _ (hsingle g) + +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/FiniteRank.lean b/lean/OAI/Analysis/FreeGroupFactor/FiniteRank.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3633a17549f36d1c9bb7d28338b5de2c228c17f --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/FiniteRank.lean @@ -0,0 +1,157 @@ +import OAI.Analysis.FreeGroupFactor.RankTwoCoefficients + +namespace OAI + +namespace FreeGroupFactorMain + +noncomputable section + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +attribute [local instance] Classical.propDecidable + +open UnitaryEvaluation +theorem one_step_of_coefficient_estimate (n : ℕ) + (hc : ∀ η : ℝ, 0 < η → ∃ (w : FreeGroup (Fin n)) (h : Coeff (FreeGroup (Fin n))), + coefficientNorm h < η ∧ + coefficientNorm (freeCocycle (firstCoefficients h) w-Finsupp.single 1 1) < η) {ε : ℝ} (hε : 0 < ε) : + ∃ α : groupVonNeumann (FreeGroup (Option (Fin n))) ≃⋆ₐ[ℂ] groupVonNeumann (FreeGroup (Option (Fin n))), + (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option (Fin n)))) + (groupUltraweakTopology (FreeGroup (Option (Fin n)))) α ∧ + ∃ w : FreeGroup (Fin n), + (∀ j : Fin n, ‖α (groupUnitary (FreeGroup.of (some j))) - groupUnitary (FreeGroup.of (some j))‖ < ε) ∧ + twoNorm (α (groupUnitary (FreeGroup.map Option.some w)) - groupUnitary (FreeGroup.of none)) < ε := by + obtain ⟨l,hl0,hlS,hln,z,hze⟩ := haar_centered_laurent (G := FreeGroup (Option (Fin n))) + (generatorUnitary (none : Option (Fin n))) (generator_haar (none : Option (Fin n))) (half_pos hε) + rw [← laurentValue_eq_value] at hlS hln hze + obtain ⟨w,h,hh,hw⟩ := hc ((ε/2)/(3*(2*(Real.pi+1)))) (by positivity) + exact one_step_from_laurent n hε l hl0 hlS hln z hze w h hh hw + +theorem one_step_two {ε : ℝ} (hε : 0 < ε) : + ∃ α : groupVonNeumann (FreeGroup (Option (Fin 2))) ≃⋆ₐ[ℂ] groupVonNeumann (FreeGroup (Option (Fin 2))), + (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option (Fin 2)))) + (groupUltraweakTopology (FreeGroup (Option (Fin 2)))) α ∧ + ∃ w : FreeGroup (Fin 2), + (∀ j : Fin 2, ‖α (groupUnitary (FreeGroup.of (some j))) - groupUnitary (FreeGroup.of (some j))‖ < ε) ∧ + twoNorm (α (groupUnitary (FreeGroup.map Option.some w)) - groupUnitary (FreeGroup.of none)) < ε := + one_step_of_coefficient_estimate 2 smallCocycleTwo hε + +theorem one_step_ge_two (n : ℕ) (hn : 2 ≤ n) {ε : ℝ} (hε : 0 < ε) : + ∃ α : groupVonNeumann (FreeGroup (Option (Fin n))) ≃⋆ₐ[ℂ] groupVonNeumann (FreeGroup (Option (Fin n))), + (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option (Fin n)))) + (groupUltraweakTopology (FreeGroup (Option (Fin n)))) α ∧ + ∃ w : FreeGroup (Fin n), + (∀ j : Fin n, ‖α (groupUnitary (FreeGroup.of (some j))) - groupUnitary (FreeGroup.of (some j))‖ < ε) ∧ + twoNorm (α (groupUnitary (FreeGroup.map Option.some w)) - groupUnitary (FreeGroup.of none)) < ε := by + by_cases h : n = 2 + · subst n + exact one_step_two hε + · exact one_step n (by omega) hε + +namespace Generation + +theorem orbit_step_ge_two (n : ℕ) (hn : 2 ≤ n) + (Φ : Ambient n ≃⋆ₐ[ℂ] Ambient n) + (ht : ∀ T, canonicalTrace (Φ T) = canonicalTrace T) {θ : ℝ} (hθ : 0 < θ) : + ∃ V ∈ orbit n, dist V (mapTuple Φ (initial n)) < θ ∧ + ∃ w : FreeGroup (Fin n), ∀ j : Option (Fin n), + twoNorm ((wordTuple V (fun j => j.elim w FreeGroup.of) j : Ambient n) - + (mapTuple Φ generatorUnitary j : Ambient n)) < θ := by + obtain ⟨α,hαt,_hαn,w,hgen,hword⟩ := one_step_ge_two n hn hθ + let V : Tuple n := mapTuple (α.trans Φ) (initial n) + have hdist : dist V (mapTuple Φ (initial n)) < θ := by + apply (dist_pi_lt_iff hθ).mpr + intro j + change dist (Φ (α (groupUnitary (FreeGroup.of (some j))))) (Φ (groupUnitary (FreeGroup.of (some j)))) < θ + have hnorm (T : Ambient n) : ‖Φ T‖ = ‖T‖ := + NonUnitalStarAlgHom.norm_map Φ.toStarAlgHom Φ.injective T + rw [dist_eq_norm, ← map_sub, hnorm] + exact hgen j + refine ⟨V,⟨α.trans Φ,?_,rfl⟩,hdist,w,?_⟩ + · intro T + simp only [StarAlgEquiv.trans_apply,ht,hαt] + · intro j + cases j with + | none => + change twoNorm (word V w-Φ (groupUnitary (FreeGroup.of none))) < θ + rw [show V = mapTuple (α.trans Φ) (initial n) from rfl,word_mapTuple, + word_initial,StarAlgEquiv.trans_apply,← map_sub,twoNorm_iso Φ ht] + exact hword + | some j => + change twoNorm ((V j : Ambient n)-Φ (groupUnitary (FreeGroup.of (some j)))) < θ + have hj := (dist_pi_lt_iff hθ).mp hdist j + change dist (V j : Ambient n) (Φ (groupUnitary (FreeGroup.of (some j)))) < θ at hj + rw [dist_eq_norm] at hj + exact (twoNorm_le_norm _).trans_lt hj + +theorem orbit_local_approximation_ge_two (n : ℕ) (hn : 2 ≤ n) + (U : Tuple n) (hU : U ∈ orbit n) (δ : ℝ) (hδ : 0 < δ) + (g : FreeGroup (Option (Fin n))) (ε : ℝ) (hε : 0 < ε) : + ∃ V ∈ orbit n, dist V U < δ ∧ ∃ p : FreeGroup (Fin n) →₀ ℂ, + dist (groupL2 (poly V p)) (lp.single 2 g (1 : ℂ)) < ε := by + classical + obtain ⟨Φ,ht,rfl⟩ := hU + obtain ⟨p,hp⟩ := automorphism_poly_dense Φ ht (groupUnitary g) (half_pos hε) + obtain ⟨K,hK,hbound⟩ := poly_twoNorm_bound (G := FreeGroup (Option (Fin n))) p + let θ := min δ (ε/(2*(K+1))) + have hθ : 0 < θ := lt_min hδ (div_pos hε (by positivity)) + obtain ⟨V,hV,hd,w,hw⟩ := orbit_step_ge_two n hn Φ ht hθ + refine ⟨V,hV,hd.trans_le (min_le_left _ _),substitute (fun j => j.elim w FreeGroup.of) p,?_⟩ + have hb := hbound (wordTuple V (fun j => j.elim w FreeGroup.of)) (mapTuple Φ generatorUnitary) + θ hθ.le (fun j => (hw j).le) + have hθe : θ*(2*(K+1)) ≤ ε := + (le_div_iff₀ (by positivity : 0 < 2*(K+1))).mp (min_le_right _ _) + have hKe : K*θ < ε/2 := by nlinarith + rw [dist_eq_norm,← groupL2_groupUnitary g,← map_sub] + change twoNorm (poly V (substitute (fun j => j.elim w FreeGroup.of) p)-groupUnitary g) < ε + rw [poly_substitute] + have he : poly (wordTuple V (fun j => j.elim w FreeGroup.of)) p-groupUnitary g = + (poly (wordTuple V (fun j => j.elim w FreeGroup.of)) p-poly (mapTuple Φ generatorUnitary) p)+ + (poly (mapTuple Φ generatorUnitary) p-groupUnitary g) := by abel + rw [he] + exact (twoNorm_add_le _ _).trans_lt (by linarith) + +end Generation + +open Generation + +theorem generating_haar_tuple_ge_two (n : ℕ) (hn : 2 ≤ n) : + ∃ U : Tuple n, + (∀ g : FreeGroup (Fin n), canonicalTrace (word U g) = if g = 1 then 1 else 0) ∧ + ⊤ ≤ (Submodule.span ℂ (Set.range (fun g => groupL2 (word U g)))).topologicalClosure := by + classical + obtain ⟨U,hU,happrox⟩ := baire_local_approximation (orbit n) (orbit_nonempty n) + (fun p U => groupL2 (poly U p)) (poly_groupL2_continuous n) + (fun g : FreeGroup (Option (Fin n)) => lp.single 2 g (1 : ℂ)) + (orbit_local_approximation_ge_two n hn) + exact ⟨U,closure_orbit_trace n U hU,total_of_poly_approx U happrox⟩ + +theorem rank_step_option_ge_two (n : ℕ) (hn : 2 ≤ n) : + HasNormalTracialIso (FreeGroupRank n) (FreeGroup (Option (Fin n))) := by + classical + obtain ⟨U,htrace,htotal⟩ := generating_haar_tuple_ge_two n hn + apply normalTracialIso_of_haar_total (word U) + · intro g + exact (word_inv U g).symm + · exact htrace + · exact htotal + +theorem rank_step_ge_two (n : ℕ) (hn : 2 ≤ n) : + HasNormalTracialIso (FreeGroupRank n) (FreeGroupRank (n+1)) := + (rank_step_option_ge_two n hn).trans (normalTracialIso_of_groupEquiv (optionRankEquiv n)) + +theorem rankTwo : HasNormalTracialIso (FreeGroupRank 2) (FreeGroupRank 3) := + rank_step_ge_two 2 le_rfl + +theorem rankStep (n : ℕ) (hn : 3 ≤ n) : + HasNormalTracialIso (FreeGroupRank n) (FreeGroupRank (n + 1)) := rank_step n hn + +end + +end FreeGroupFactorMain + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/FreeSum.lean b/lean/OAI/Analysis/FreeGroupFactor/FreeSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a01c82732de2e87e59483327984bee132739785 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/FreeSum.lean @@ -0,0 +1,475 @@ +import OAI.Analysis.FreeGroupFactor.Reducing + +namespace OAI + +namespace FreeGroupFactorMain + +noncomputable section + +universe uG uH uα uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +namespace ConjugateSectors + + def basisAction {ι : Type uι} : FreeGroup ι →* MulAut (FreeGroup (FreeGroup ι)) where + toFun g := FreeGroup.freeGroupCongr (Equiv.mulLeft g) + map_one' := by + apply MulEquiv.toMonoidHom_injective + apply FreeGroup.ext_hom + intro j + simp [FreeGroup.freeGroupCongr_apply] + map_mul' g h := by + apply MulEquiv.toMonoidHom_injective + apply FreeGroup.ext_hom + intro j + simp [FreeGroup.freeGroupCongr_apply, mul_assoc] + + abbrev Witness (ι : Type uι) := FreeGroup (FreeGroup ι) ⋊[basisAction] FreeGroup ι + + @[simp] theorem basisAction_of {ι : Type uι} (g j : FreeGroup ι) : + basisAction g (FreeGroup.of j) = FreeGroup.of (g * j) := by + simp [basisAction, FreeGroup.freeGroupCongr_apply] + + def witness {ι : Type uι} : FreeGroup (Option ι) →* Witness ι := + FreeGroup.lift (fun i => match i with + | none => SemidirectProduct.inl (FreeGroup.of 1) + | some j => SemidirectProduct.inr (FreeGroup.of j)) + + @[simp] theorem witness_some {ι : Type uι} (g : FreeGroup ι) : + witness (FreeGroup.map Option.some g) = SemidirectProduct.inr g := by + have hh : (witness (ι := ι)).comp (FreeGroup.map Option.some) = SemidirectProduct.inr := by + apply FreeGroup.ext_hom + intro j + simp [witness] + exact DFunLike.congr_fun hh g + + @[simp] theorem witness_none {ι : Type uι} : + witness (FreeGroup.of (none : Option ι)) = SemidirectProduct.inl (FreeGroup.of 1) := by + simp [witness] + + def conjugate {ι : Type uι} (g : FreeGroup ι) : FreeGroup (Option ι) := + FreeGroup.map Option.some g * FreeGroup.of none * (FreeGroup.map Option.some g)⁻¹ + + @[simp] theorem witness_conjugate {ι : Type uι} (g : FreeGroup ι) : + witness (conjugate g) = SemidirectProduct.inl (FreeGroup.of g) := by + simp only [conjugate, map_mul, map_inv, witness_some, witness_none] + rw [← map_inv, ← SemidirectProduct.inl_aut, basisAction_of, mul_one] + + def begins {ι : Type uι} [DecidableEq ι] (i : ι) (g : FreeGroup ι) : Prop := + ∃ b w, g.toWord = (i, b) :: w + + theorem begins_unique {ι : Type uι} [DecidableEq ι] {i j : ι} {g : FreeGroup ι} + (hi : begins i g) (hj : begins j g) : i = j := by + obtain ⟨b, w, hi⟩ := hi + obtain ⟨c, v, hj⟩ := hj + rw [hi] at hj + exact congrArg Prod.fst (List.cons.inj hj).1 + + theorem reduce_prepend {ι : Type uι} [DecidableEq ι] (i : ι) (b : Bool) + (w : List (ι × Bool)) (hw : FreeGroup.reduce w = w) + (hhead : ∀ c v, w ≠ (i, c) :: v) (n : ℕ) : + FreeGroup.reduce (List.replicate n (i, b) ++ w) = List.replicate n (i, b) ++ w := by + induction n with + | zero => simpa using hw + | succ n ih => + rw [List.replicate_succ, List.cons_append, FreeGroup.reduce.cons, ih] + cases n with + | zero => + cases w with + | nil => rfl + | cons a v => + rcases a with ⟨j, c⟩ + have hij : i ≠ j := by + intro he + subst j + exact hhead c v rfl + simp [hij] + | succ n => simp [List.replicate_succ] + + theorem begins_pow_mul {ι : Type uι} [DecidableEq ι] (i : ι) (g : FreeGroup ι) + (hg : ¬ begins i g) (k : ℤ) (hk : k ≠ 0) : begins i ((FreeGroup.of i) ^ k * g) := by + have hh : ∀ c v, g.toWord ≠ (i, c) :: v := by + intro c v eq + exact hg ⟨c, v, eq⟩ + cases k with + | ofNat n => + cases n with + | zero => exact (hk rfl).elim + | succ n => + refine ⟨true, List.replicate n (i, true) ++ g.toWord, ?_⟩ + rw [Int.ofNat_eq_natCast, zpow_natCast, FreeGroup.toWord_mul, FreeGroup.toWord_of_pow, + reduce_prepend i true g.toWord (FreeGroup.reduce_toWord g) hh] + simp [List.replicate_succ] + | negSucc n => + refine ⟨false, List.replicate n (i, false) ++ g.toWord, ?_⟩ + rw [zpow_negSucc, FreeGroup.toWord_mul, FreeGroup.toWord_inv, FreeGroup.toWord_of_pow] + simp only [FreeGroup.invRev, List.reverse_replicate, List.map_replicate, Bool.not_true] + rw [reduce_prepend i false g.toWord (FreeGroup.reduce_toWord g) hh] + simp [List.replicate_succ] + + def sector {ι : Type uι} [DecidableEq ι] (i : FreeGroup ι) : Set (FreeGroup (Option ι)) := + {g | begins i (witness g).left} + + theorem sector_disjoint {ι : Type uι} [DecidableEq ι] {i j : FreeGroup ι} (hij : i ≠ j) : + Disjoint (sector i) (sector j) := by + rw [Set.disjoint_left] + intro g hi hj + exact hij (begins_unique hi hj) + + theorem sector_prefix {ι : Type uι} [DecidableEq ι] (i : FreeGroup ι) + (g : FreeGroup (Option ι)) (hg : g ∉ sector i) (k : ℤ) (hk : k ≠ 0) : + (conjugate i) ^ k * g ∈ sector i := by + change begins i (witness ((conjugate i) ^ k * g)).left + rw [map_mul, map_zpow, witness_conjugate, ← map_zpow] + simp only [SemidirectProduct.mul_left, SemidirectProduct.left_inl, + SemidirectProduct.right_inl, map_one, MulAut.one_apply] + exact begins_pow_mul i (witness g).left hg k hk + +end ConjugateSectors + +namespace CoordinateProjection + +abbrev Hilbert (α : Type uα) := lp (fun _ : α => ℂ) 2 + +def restrict {α : Type uα} (s : Set α) (ξ : Hilbert α) : Hilbert α := by + classical + refine ⟨s.indicator ξ, (lp.memℓp ξ).mono' ?_⟩ + intro a + by_cases ha : a ∈ s <;> simp [Set.indicator, ha] + +@[simp] theorem restrict_apply {α : Type uα} (s : Set α) (ξ : Hilbert α) (a : α) : + restrict s ξ a = s.indicator ξ a := rfl + +theorem norm_restrict_le {α : Type uα} (s : Set α) (ξ : Hilbert α) : + ‖restrict s ξ‖ ≤ ‖ξ‖ := by + classical + apply lp.norm_mono (by norm_num) + intro a + by_cases ha : a ∈ s <;> simp [Set.indicator, ha] + +def linearMap {α : Type uα} (s : Set α) : Hilbert α →ₗ[ℂ] Hilbert α where + toFun := restrict s + map_add' ξ η := by + classical + ext a + by_cases ha : a ∈ s <;> simp [Set.indicator, ha] + map_smul' c ξ := by + classical + ext a + by_cases ha : a ∈ s <;> simp [Set.indicator, ha] + +def proj {α : Type uα} (s : Set α) : Hilbert α →L[ℂ] Hilbert α := + (linearMap s).mkContinuous 1 (fun ξ => by + change ‖restrict s ξ‖ ≤ 1 * ‖ξ‖ + simpa only [one_mul] using norm_restrict_le s ξ) + +@[simp] theorem proj_apply {α : Type uα} (s : Set α) (ξ : Hilbert α) (a : α) : + proj s ξ a = s.indicator ξ a := rfl + +theorem norm_proj_le {α : Type uα} (s : Set α) : ‖proj s‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro ξ + change ‖restrict s ξ‖ ≤ 1 * ‖ξ‖ + simpa only [one_mul] using norm_restrict_le s ξ + +theorem star_proj {α : Type uα} (s : Set α) : star (proj s) = proj s := by + classical + rw [ContinuousLinearMap.star_eq_adjoint, eq_comm, ContinuousLinearMap.eq_adjoint_iff] + intro ξ η + simp only [lp.inner_eq_tsum] + apply tsum_congr + intro a + by_cases ha : a ∈ s <;> simp [Set.indicator, ha] + +theorem proj_orthogonal {α : Type uα} (s t : Set α) (hst : Disjoint s t) + (ξ η : Hilbert α) : inner ℂ (proj s ξ) (proj t η) = 0 := by + classical + rw [lp.inner_eq_tsum] + have hz (a : α) : inner ℂ (proj s ξ a) (proj t η a) = 0 := by + by_cases hs : a ∈ s + · have ht : a ∉ t := fun ht => Set.disjoint_left.mp hst hs ht + simp [Set.indicator, ht] + · simp [Set.indicator, hs] + simp only [hz, tsum_zero] + +@[simp] theorem complement_apply {α : Type uα} (s : Set α) (ξ : Hilbert α) (a : α) : + ((1 - proj s) ξ) a = sᶜ.indicator ξ a := by + classical + by_cases ha : a ∈ s <;> simp [Set.indicator, ha] + +end CoordinateProjection + +open scoped BigOperators +namespace FreeSum +variable {ι : Type uι} {H : Type uH} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] +local notation "Op" => H →L[ℂ] H + +omit [CompleteSpace H] in +theorem norm_sum_sq (s : Finset ι) (v : ι → H) + (hv : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → inner ℂ (v i) (v j) = 0) : + ‖∑ i ∈ s, v i‖ ^ 2 = ∑ i ∈ s, ‖v i‖ ^ 2 := by + classical + have hh : inner ℂ (∑ i ∈ s, v i) (∑ i ∈ s, v i) = + ∑ i ∈ s, inner ℂ (v i) (v i) := by + rw [sum_inner] + apply Finset.sum_congr rfl + intro i hi + rw [inner_sum] + apply Finset.sum_eq_single i + · intro j hj hji + exact hv i hi j hj hji.symm + · simp_all + simp only [inner_self_eq_norm_sq_to_K] at hh + exact_mod_cast hh + +omit [CompleteSpace H] in + +theorem norm_sum_orthogonal (s : Finset ι) (T : ι → Op) (b : ι → ℝ) + (hT : ∀ i ∈ s, ‖T i‖ ≤ b i) + (horth : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → ∀ x y, + inner ℂ (T i x) (T j y) = 0) : + ‖∑ i ∈ s, T i‖ ≤ Real.sqrt (∑ i ∈ s, b i ^ 2) := by + classical + apply ContinuousLinearMap.opNorm_le_bound _ (Real.sqrt_nonneg _) + intro x + simp only [sum_apply] + have hsq := norm_sum_sq s (fun i => T i x) (fun i hi j hj hij => horth i hi j hj hij x x) + have hle : ∑ i ∈ s, ‖T i x‖ ^ 2 ≤ (∑ i ∈ s, b i ^ 2) * ‖x‖ ^ 2 := by + rw [Finset.sum_mul] + apply Finset.sum_le_sum + intro i hi + have hnorm : ‖T i x‖ ≤ b i * ‖x‖ := + (T i).le_opNorm x |>.trans (mul_le_mul_of_nonneg_right (hT i hi) (norm_nonneg x)) + calc + ‖T i x‖ ^ 2 ≤ (b i * ‖x‖) ^ 2 := pow_le_pow_left₀ (norm_nonneg _) hnorm _ + _ = b i ^ 2 * ‖x‖ ^ 2 := mul_pow _ _ _ + have hsum : 0 ≤ ∑ i ∈ s, b i ^ 2 := Finset.sum_nonneg fun _ _ => sq_nonneg _ + have hsqrt := Real.sq_sqrt hsum + have hn := norm_nonneg (∑ i ∈ s, T i x) + have hr := mul_nonneg (Real.sqrt_nonneg (∑ i ∈ s, b i ^ 2)) (norm_nonneg x) + nlinarith + +omit [CompleteSpace H] in + +theorem norm_weighted_sum_orthogonal (s : Finset ι) (T : ι → Op) (k : ι → ℝ) + (K : ℝ) (hK : 0 ≤ K) (hT : ∀ i ∈ s, ‖T i‖ ≤ K) + (horth : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → ∀ x y, + inner ℂ (T i x) (T j y) = 0) : + ‖∑ i ∈ s, (k i : ℂ) • T i‖ ≤ K * Real.sqrt (∑ i ∈ s, k i ^ 2) := by + have hh := norm_sum_orthogonal s (fun i => (k i : ℂ) • T i) + (fun i => |k i| * K) (by + intro i hi + rw [norm_smul, Complex.norm_real, Real.norm_eq_abs] + exact mul_le_mul_of_nonneg_left (hT i hi) (abs_nonneg _)) (by + intro i hi j hj hij x y + simp only [smul_apply, inner_smul_left, inner_smul_right, + horth i hi j hj hij, mul_zero]) + have hs : Real.sqrt (∑ i ∈ s, (|k i| * K) ^ 2) = + K * Real.sqrt (∑ i ∈ s, k i ^ 2) := by + simp_rw [mul_pow, sq_abs] + rw [← Finset.sum_mul, Real.sqrt_mul (Finset.sum_nonneg fun _ _ => sq_nonneg _), + Real.sqrt_sq hK, mul_comm] + rwa [hs] at hh + +theorem three_block_bound (s : Finset ι) (P S : ι → Op) (k : ι → ℝ) + (K : ℝ) (hK : 0 ≤ K) + (hP : ∀ i ∈ s, star (P i) = P i) (hPn : ∀ i ∈ s, ‖P i‖ ≤ 1) + (hS : ∀ i ∈ s, star (S i) = S i) (hSn : ∀ i ∈ s, ‖S i‖ ≤ K) + (horth : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → ∀ x y, + inner ℂ (P i x) (P j y) = 0) + (hcompression : ∀ i ∈ s, (1 - P i) * S i * (1 - P i) = 0) : + ‖∑ i ∈ s, (k i : ℂ) • S i‖ ≤ 3 * K * Real.sqrt (∑ i ∈ s, k i ^ 2) := by + classical + let A : Op := ∑ i ∈ s, (k i : ℂ) • (P i * S i) + let D : Op := ∑ i ∈ s, (k i : ℂ) • (P i * S i * P i) + have hPS (i : ι) (hi : i ∈ s) : ‖P i * S i‖ ≤ K := by + calc + ‖P i * S i‖ ≤ ‖P i‖ * ‖S i‖ := norm_mul_le _ _ + _ ≤ 1 * K := mul_le_mul (hPn i hi) (hSn i hi) (norm_nonneg _) (by norm_num) + _ = K := one_mul _ + have hA : ‖A‖ ≤ K * Real.sqrt (∑ i ∈ s, k i ^ 2) := by + apply norm_weighted_sum_orthogonal s _ k K hK hPS + intro i hi j hj hij x y + exact horth i hi j hj hij (S i x) (S j y) + have hD : ‖D‖ ≤ K * Real.sqrt (∑ i ∈ s, k i ^ 2) := by + apply norm_weighted_sum_orthogonal s _ k K hK + · intro i hi + calc + ‖P i * S i * P i‖ ≤ ‖P i * S i‖ * ‖P i‖ := norm_mul_le _ _ + _ ≤ K * 1 := mul_le_mul (hPS i hi) (hPn i hi) (norm_nonneg _) hK + _ = K := mul_one _ + · intro i hi j hj hij x y + exact horth i hi j hj hij (S i (P i x)) (S j (P j y)) + have heq : (∑ i ∈ s, (k i : ℂ) • S i) = A + star A - D := by + dsimp [A, D] + simp only [star_sum, star_smul, star_trivial, + star_mul, ← Finset.sum_add_distrib, ← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro i hi + rw [hP i hi, hS i hi, ← smul_add, ← smul_sub] + congr 1 + apply sub_eq_zero.mp + calc + S i - (P i * S i + S i * P i - P i * S i * P i) = + (1 - P i) * S i * (1 - P i) := by noncomm_ring + _ = 0 := hcompression i hi + rw [heq] + calc + ‖A + star A - D‖ ≤ ‖A + star A‖ + ‖D‖ := norm_sub_le _ _ + _ ≤ (‖A‖ + ‖star A‖) + ‖D‖ := by gcongr; exact norm_add_le _ _ + _ = 2 * ‖A‖ + ‖D‖ := by rw [norm_star]; ring + _ ≤ 2 * (K * Real.sqrt (∑ i ∈ s, k i ^ 2)) + + K * Real.sqrt (∑ i ∈ s, k i ^ 2) := by gcongr + _ = _ := by ring + +end FreeSum + +open scoped BigOperators ENNReal +open ConjugateSectors CoordinateProjection + + theorem operator_eq_zero_of_single {α : Type uα} [DecidableEq α] + (T : GroupOperator α) (hT : ∀ g, T (lp.single 2 g 1) = 0) : T = 0 := by + apply operator_matrix_ext + intro g + simpa only [zero_apply] using hT g + + theorem sector_compression {ι : Type uι} [DecidableEq ι] (i : FreeGroup ι) + (T : groupVonNeumann (FreeGroup (Option ι))) + (hsupport : ∀ g, ((T : GroupOperator _) (lp.single 2 1 1)) g ≠ 0 → + ∃ k : ℤ, k ≠ 0 ∧ g = conjugate i ^ k) : + (1 - proj (sector i)) * (T : GroupOperator _) * (1 - proj (sector i)) = 0 := by + classical + apply operator_eq_zero_of_single + intro y + have hQ : (1 - proj (sector i)) (lp.single 2 y 1) = + if y ∈ sector i then 0 else lp.single 2 y 1 := by + ext x + by_cases hy : y ∈ sector i <;> by_cases hx : x ∈ sector i <;> + simp_all [Set.indicator, lp.single_apply, Pi.single_apply] <;> + intro he <;> subst x <;> contradiction + change (1 - proj (sector i)) ((T : GroupOperator _) + ((1 - proj (sector i)) (lp.single 2 y 1))) = 0 + rw [hQ] + split_ifs with hy + · simp + · ext x + change ((1 - proj (sector i)) ((T : GroupOperator _) (lp.single 2 y 1))) x = 0 + rw [complement_apply] + by_cases hx : x ∈ sector i + · simp [Set.indicator, hx] + · simp only [Set.indicator_of_mem (Set.mem_compl hx)] + rw [groupVN_matrix] + by_contra hne + obtain ⟨k, hk, he⟩ := hsupport (x * y⁻¹) (by rwa [deltaOne_eq] at hne) + have hx' : x = conjugate i ^ k * y := by + rw [← he, inv_mul_cancel_right] + exact hx (hx'.symm ▸ sector_prefix i y hy k hk) + + theorem concrete_free_sum {ι : Type uι} [DecidableEq ι] + (s : Finset (FreeGroup ι)) (T : FreeGroup ι → groupVonNeumann (FreeGroup (Option ι))) + (k : FreeGroup ι → ℝ) (K : ℝ) (hK : 0 ≤ K) + (hsa : ∀ i ∈ s, star (T i) = T i) (hn : ∀ i ∈ s, ‖T i‖ ≤ K) + (hsupport : ∀ i ∈ s, ∀ g, ((T i : GroupOperator (FreeGroup (Option ι))) (lp.single 2 1 1)) g ≠ 0 → + ∃ m : ℤ, m ≠ 0 ∧ g = conjugate i ^ m) : + ‖∑ i ∈ s, (k i : ℂ) • (T i : GroupOperator (FreeGroup (Option ι)))‖ ≤ + 3 * K * Real.sqrt (∑ i ∈ s, k i ^ 2) := by + apply FreeSum.three_block_bound s (fun i => proj (sector i)) + (fun i => (T i : GroupOperator (FreeGroup (Option ι)))) k K hK + · intro i _; exact star_proj _ + · intro i _; exact norm_proj_le _ + · intro i hi; exact congrArg Subtype.val (hsa i hi) + · exact hn + · intro i _ j _ hij x y + exact proj_orthogonal _ _ (sector_disjoint hij) x y + · intro i hi + exact sector_compression i (T i) (hsupport i hi) + +open scoped BigOperators + +@[simp] theorem groupUnitary_mul {G : Type uG} [Group G] (g h : G) : + groupUnitary (g*h) = groupUnitary g * groupUnitary h := by + apply Subtype.ext + exact leftRegular_mul g h + +@[simp] theorem groupUnitary_inv {G : Type uG} [Group G] (g : G) : + groupUnitary g⁻¹ = star (groupUnitary g) := by + apply Subtype.ext + exact (leftRegular_star g).symm + +@[simp] theorem groupUnitary_one {G : Type uG} [Group G] : groupUnitary (1 : G) = 1 := by + apply Subtype.ext + exact leftRegular_one + +def groupLaurent {G : Type uG} [Group G] (g : G) (l : ℤ →₀ ℂ) : groupVonNeumann G := + l.sum (fun m c => c • groupUnitary (g^m)) + +theorem groupLaurent_conjugate {G : Type uG} [Group G] (g c : G) (l : ℤ →₀ ℂ) : + groupLaurent (g*c*g⁻¹) l = groupUnitary g * groupLaurent c l * star (groupUnitary g) := by + classical + simp only [groupLaurent, Finsupp.sum, Finset.mul_sum, Finset.sum_mul, + mul_smul_comm, smul_mul_assoc] + apply Finset.sum_congr rfl + intro m _hm + rw [conj_zpow, groupUnitary_mul, groupUnitary_mul, groupUnitary_inv] + +theorem groupLaurent_coe {G : Type uG} [Group G] (c : G) (l : ℤ →₀ ℂ) : + (groupLaurent c l : GroupOperator G) = ∑ m ∈ l.support, l m • leftRegular (c^m) := by + change (groupVonNeumann G).subtype (∑ m ∈ l.support, l m • groupUnitary (c^m)) = _ + simp only [map_sum, map_smul] + rfl + +theorem groupLaurent_support {G : Type uG} [Group G] [DecidableEq G] + (c : G) (l : ℤ →₀ ℂ) (h0 : l 0 = 0) (x : G) + (hne : ((groupLaurent c l : GroupOperator G) (lp.single 2 1 1)) x ≠ 0) : + ∃ m : ℤ, m ≠ 0 ∧ x = c^m := by + classical + by_contra! hn + apply hne + rw [groupLaurent_coe] + simp only [sum_apply, smul_apply, + lp.coeFn_sum, Finset.sum_apply, lp.coeFn_smul, Pi.smul_apply, smul_eq_mul] + apply Finset.sum_eq_zero + intro m hm + have hm0 : m ≠ 0 := by + intro he + subst m + exact (Finsupp.mem_support_iff.mp hm) h0 + simp [leftRegular_apply, lp.single_apply, inv_mul_eq_one, (hn m hm0).symm] + +theorem centered_laurent_free_sum {ι : Type uι} [DecidableEq ι] + (l : ℤ →₀ ℂ) (h0 : l 0 = 0) + (hsa : IsSelfAdjoint (groupLaurent (FreeGroup.of (none : Option ι)) l)) + (K : ℝ) (hK : 0 ≤ K) + (hn : ‖groupLaurent (FreeGroup.of (none : Option ι)) l‖ ≤ K) + (k : FreeGroup ι →₀ ℝ) : + ‖k.sum (fun g r => (r : ℂ) • groupLaurent (ConjugateSectors.conjugate g) l)‖ ≤ + 3*K*Real.sqrt (k.sum (fun _ r => r^2)) := by + classical + have he (g : FreeGroup ι) := groupLaurent_conjugate + (FreeGroup.map Option.some g) (FreeGroup.of (none : Option ι)) l + change ‖(groupVonNeumann (FreeGroup (Option ι))).subtype + (∑ g ∈ k.support, (k g : ℂ) • groupLaurent (ConjugateSectors.conjugate g) l)‖ ≤ _ + simp only [map_sum, map_smul] + apply concrete_free_sum k.support (fun g => groupLaurent (ConjugateSectors.conjugate g) l) + k K hK + · intro g _hg + rw [ConjugateSectors.conjugate] at * + rw [he, star_mul, star_mul, star_star, hsa.star_eq, mul_assoc] + · intro g _hg + change ‖(groupLaurent (ConjugateSectors.conjugate g) l : GroupOperator (FreeGroup (Option ι)))‖ ≤ _ + rw [ConjugateSectors.conjugate, he] + change ‖leftRegular _ * (groupLaurent (FreeGroup.of (none : Option ι)) l : + GroupOperator (FreeGroup (Option ι))) * star (leftRegular _)‖ ≤ _ + rw [CStarRing.norm_mul_mem_unitary _ (Unitary.star_mem (leftRegular_unitary _)), + CStarRing.norm_mem_unitary_mul _ (leftRegular_unitary _)] + exact hn + · intro g _hg x hx + exact groupLaurent_support _ l h0 x hx + +end + +end FreeGroupFactorMain + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/Generation.lean b/lean/OAI/Analysis/FreeGroupFactor/Generation.lean new file mode 100644 index 0000000000000000000000000000000000000000..43002032e6d23204df1a7bbe2813e70316c4ab08 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/Generation.lean @@ -0,0 +1,356 @@ +import OAI.Analysis.FreeGroupFactor.LocalAutomorphism + +namespace OAI + +noncomputable section + +universe uA uB uC uG uH uI uK uP uX uY uι uκ + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +namespace FreeGroupFactorMain.Generation + +section +variable {A : Type uA} {B : Type uB} [CStarAlgebra A] [CStarAlgebra B] {ι : Type uι} {κ : Type uκ} + +def mapTuple (Φ : A ≃⋆ₐ[ℂ] B) (U : ι → unitary A) : ι → unitary B := + fun j => ⟨Φ (U j : A), Unitary.map_mem Φ (U j).property⟩ + +@[simp] theorem mapTuple_coe (Φ : A ≃⋆ₐ[ℂ] B) (U : ι → unitary A) (j : ι) : + (mapTuple Φ U j : B) = Φ (U j : A) := rfl + +@[simp] theorem word_mapTuple (Φ : A ≃⋆ₐ[ℂ] B) (U : ι → unitary A) (g : FreeGroup ι) : + word (mapTuple Φ U) g = Φ (word U g) := by + induction g using FreeGroup.induction_on with + | one => simp only [map_one] + | of j => simp only [word_of,mapTuple_coe] + | inv_of j ih => rw [word_inv,word_inv,ih,map_star] + | mul g h hg hh => rw [map_mul,map_mul,map_mul,hg,hh] + +@[simp] theorem poly_mapTuple (Φ : A ≃⋆ₐ[ℂ] B) (U : ι → unitary A) (p : FreeGroup ι →₀ ℂ) : + poly (mapTuple Φ U) p = Φ (poly U p) := by + classical + simp only [poly,Finsupp.sum,map_sum,map_smul,word_mapTuple] + +def substitute (w : κ → FreeGroup ι) : (FreeGroup κ →₀ ℂ) →ₗ[ℂ] FreeGroup ι →₀ ℂ := + Finsupp.lmapDomain ℂ ℂ (FreeGroup.lift w) + +def wordTuple (U : ι → unitary A) (w : κ → FreeGroup ι) : κ → unitary A := + fun j => FreeGroup.lift U (w j) + +@[simp] theorem word_wordTuple (U : ι → unitary A) (w : κ → FreeGroup ι) (g : FreeGroup κ) : + word (wordTuple U w) g = word U (FreeGroup.lift w g) := by + have he : word (wordTuple U w) = (word U).comp (FreeGroup.lift w) := by + apply FreeGroup.ext_hom + intro j + simp only [word_of,MonoidHom.comp_apply,FreeGroup.lift_apply_of] + rfl + exact DFunLike.congr_fun he g + +@[simp] theorem poly_substitute (U : ι → unitary A) (w : κ → FreeGroup ι) (p : FreeGroup κ →₀ ℂ) : + poly U (substitute w p) = poly (wordTuple U w) p := by + induction p using Finsupp.induction_linear with + | zero => simp only [map_zero,poly_zero] + | add p q hp hq => simp only [map_add,poly_add,hp,hq] + | single g c => + simp only [substitute,Finsupp.lmapDomain_apply,Finsupp.mapDomain_single,poly_single,word_wordTuple] + +instance unitary_isClosed (A : Type uA) [CStarAlgebra A] : IsClosed (unitary A : Set A) := + isClosed_unitary + +instance unitary_completeSpace (A : Type uA) [CStarAlgebra A] : CompleteSpace (unitary A) := by + change CompleteSpace ↥(unitary A : Set A) + infer_instance + +end + +@[simp] theorem word_canonical {ι : Type uι} (g : FreeGroup ι) : + word (generatorUnitary (ι := ι)) g = groupUnitary g := by + have he : word (generatorUnitary (ι := ι)) = + (unitary (groupVonNeumann (FreeGroup ι))).subtype.comp (groupUnitaryUHom (FreeGroup ι)) := by + apply FreeGroup.ext_hom + intro i + simp only [word_of,MonoidHom.comp_apply] + rfl + exact DFunLike.congr_fun he g + +theorem canonical_poly_dense {ι : Type uι} (ξ : GroupHilbert (FreeGroup ι)) {ε : ℝ} (hε : 0 < ε) : + ∃ p : FreeGroup ι →₀ ℂ, ‖groupL2 (poly generatorUnitary p)-ξ‖ < ε := by + classical + let K := Submodule.span ℂ (Set.range (fun g : FreeGroup ι => groupL2 (groupUnitary g))) + have ht : ⊤ ≤ K.topologicalClosure := by + apply group_single_total _ (Submodule.isClosed_topologicalClosure _) + intro g + rw [← groupL2_groupUnitary g] + exact Submodule.le_topologicalClosure _ (Submodule.subset_span ⟨g,rfl⟩) + have hx : ξ ∈ closure (K : Set (GroupHilbert (FreeGroup ι))) := by + rw [← Submodule.topologicalClosure_coe] + exact ht trivial + obtain ⟨x,hx,hd⟩ := Metric.mem_closure_iff.mp hx ε hε + obtain ⟨p,hp⟩ := Finsupp.mem_span_range_iff_exists_finsupp.mp hx + refine ⟨p,?_⟩ + have he : groupL2 (poly generatorUnitary p) = x := by + rw [poly,Finsupp.sum] + simp only [map_sum,map_smul,word_canonical] + exact hp + rw [he,← dist_eq_norm,dist_comm] + exact hd + +theorem automorphism_poly_dense {ι : Type uι} + (Φ : groupVonNeumann (FreeGroup ι) ≃⋆ₐ[ℂ] groupVonNeumann (FreeGroup ι)) + (ht : ∀ T, canonicalTrace (Φ T) = canonicalTrace T) + (T : groupVonNeumann (FreeGroup ι)) {ε : ℝ} (hε : 0 < ε) : + ∃ p : FreeGroup ι →₀ ℂ, twoNorm (poly (mapTuple Φ generatorUnitary) p-T) < ε := by + obtain ⟨p,hp⟩ := canonical_poly_dense (groupL2 (Φ.symm T)) hε + refine ⟨p,?_⟩ + rw [poly_mapTuple,← Φ.apply_symm_apply T,← map_sub,twoNorm_iso Φ ht] + change ‖groupL2 (poly generatorUnitary p-Φ.symm T)‖ < ε + rw [map_sub] + exact hp + +abbrev Ambient (n : ℕ) := groupVonNeumann (FreeGroup (Option (Fin n))) +abbrev Tuple (n : ℕ) := Fin n → unitary (Ambient n) +def initial (n : ℕ) : Tuple n := fun j => generatorUnitary (some j) + +theorem word_initial (n : ℕ) (g : FreeGroup (Fin n)) : + word (initial n) g = groupUnitary (FreeGroup.map Option.some g) := by + have he : word (initial n) = + (unitary (Ambient n)).subtype.comp + ((groupUnitaryUHom (FreeGroup (Option (Fin n)))).comp (FreeGroup.map Option.some)) := by + apply FreeGroup.ext_hom + intro j + simp only [word_of,MonoidHom.comp_apply,FreeGroup.map.of] + rfl + exact DFunLike.congr_fun he g + +def orbit (n : ℕ) : Set (Tuple n) := + {U | ∃ Φ : Ambient n ≃⋆ₐ[ℂ] Ambient n, + (∀ T, canonicalTrace (Φ T) = canonicalTrace T) ∧ U = mapTuple Φ (initial n)} + +theorem orbit_nonempty (n : ℕ) : (orbit n).Nonempty := by + refine ⟨mapTuple (StarAlgEquiv.refl ℂ (Ambient n)) (initial n),StarAlgEquiv.refl ℂ (Ambient n),?_,rfl⟩ + intro T + rfl + +@[simp] theorem mapTuple_trans {A : Type uA} {B : Type uB} {C : Type uC} [CStarAlgebra A] [CStarAlgebra B] [CStarAlgebra C] + {ι : Type uι} (Φ : A ≃⋆ₐ[ℂ] B) (Ψ : B ≃⋆ₐ[ℂ] C) (U : ι → unitary A) : + mapTuple (Φ.trans Ψ) U = mapTuple Ψ (mapTuple Φ U) := rfl + +theorem orbit_step (n : ℕ) (hn : 3 ≤ n) + (Φ : Ambient n ≃⋆ₐ[ℂ] Ambient n) + (ht : ∀ T, canonicalTrace (Φ T) = canonicalTrace T) {θ : ℝ} (hθ : 0 < θ) : + ∃ V ∈ orbit n, dist V (mapTuple Φ (initial n)) < θ ∧ + ∃ w : FreeGroup (Fin n), ∀ j : Option (Fin n), + twoNorm ((wordTuple V (fun j => j.elim w FreeGroup.of) j : Ambient n) - + (mapTuple Φ generatorUnitary j : Ambient n)) < θ := by + obtain ⟨α,hαt,_hαn,w,hgen,hword⟩ := one_step n hn hθ + let V : Tuple n := mapTuple (α.trans Φ) (initial n) + have hdist : dist V (mapTuple Φ (initial n)) < θ := by + apply (dist_pi_lt_iff hθ).mpr + intro j + change dist (Φ (α (groupUnitary (FreeGroup.of (some j))))) (Φ (groupUnitary (FreeGroup.of (some j)))) < θ + have hnorm (T : Ambient n) : ‖Φ T‖ = ‖T‖ := + NonUnitalStarAlgHom.norm_map Φ.toStarAlgHom Φ.injective T + rw [dist_eq_norm, ← map_sub, hnorm] + exact hgen j + refine ⟨V,⟨α.trans Φ,?_,rfl⟩,hdist,w,?_⟩ + · intro T + simp only [StarAlgEquiv.trans_apply,ht,hαt] + · intro j + cases j with + | none => + change twoNorm (word V w-Φ (groupUnitary (FreeGroup.of none))) < θ + rw [show V = mapTuple (α.trans Φ) (initial n) from rfl,word_mapTuple, + word_initial,StarAlgEquiv.trans_apply,← map_sub,twoNorm_iso Φ ht] + exact hword + | some j => + change twoNorm ((V j : Ambient n)-Φ (groupUnitary (FreeGroup.of (some j)))) < θ + have hj := (dist_pi_lt_iff hθ).mp hdist j + change dist (V j : Ambient n) (Φ (groupUnitary (FreeGroup.of (some j)))) < θ at hj + rw [dist_eq_norm] at hj + exact (twoNorm_le_norm _).trans_lt hj + +theorem poly_groupL2_continuous (n : ℕ) (p : FreeGroup (Fin n) →₀ ℂ) : + Continuous (fun U : Tuple n => groupL2 (poly U p)) := + (groupL2 (G := FreeGroup (Option (Fin n)))).continuous.comp (poly_continuous p) + +theorem orbit_local_approximation (n : ℕ) (hn : 3 ≤ n) + (U : Tuple n) (hU : U ∈ orbit n) (δ : ℝ) (hδ : 0 < δ) + (g : FreeGroup (Option (Fin n))) (ε : ℝ) (hε : 0 < ε) : + ∃ V ∈ orbit n, dist V U < δ ∧ ∃ p : FreeGroup (Fin n) →₀ ℂ, + dist (groupL2 (poly V p)) (lp.single 2 g (1 : ℂ)) < ε := by + classical + obtain ⟨Φ,ht,rfl⟩ := hU + obtain ⟨p,hp⟩ := automorphism_poly_dense Φ ht (groupUnitary g) (half_pos hε) + obtain ⟨K,hK,hbound⟩ := poly_twoNorm_bound (G := FreeGroup (Option (Fin n))) p + let θ := min δ (ε/(2*(K+1))) + have hθ : 0 < θ := lt_min hδ (div_pos hε (by positivity)) + obtain ⟨V,hV,hd,w,hw⟩ := orbit_step n hn Φ ht hθ + refine ⟨V,hV,hd.trans_le (min_le_left _ _),substitute (fun j => j.elim w FreeGroup.of) p,?_⟩ + have hb := hbound (wordTuple V (fun j => j.elim w FreeGroup.of)) (mapTuple Φ generatorUnitary) + θ hθ.le (fun j => (hw j).le) + have hθe : θ*(2*(K+1)) ≤ ε := + (le_div_iff₀ (by positivity : 0 < 2*(K+1))).mp (min_le_right _ _) + have hKe : K*θ < ε/2 := by nlinarith + rw [dist_eq_norm,← groupL2_groupUnitary g,← map_sub] + change twoNorm (poly V (substitute (fun j => j.elim w FreeGroup.of) p)-groupUnitary g) < ε + rw [poly_substitute] + have he : poly (wordTuple V (fun j => j.elim w FreeGroup.of)) p-groupUnitary g = + (poly (wordTuple V (fun j => j.elim w FreeGroup.of)) p-poly (mapTuple Φ generatorUnitary) p)+ + (poly (mapTuple Φ generatorUnitary) p-groupUnitary g) := by abel + rw [he] + exact (twoNorm_add_le _ _).trans_lt (by linarith) + +theorem orbit_trace (n : ℕ) (U : Tuple n) (hU : U ∈ orbit n) (g : FreeGroup (Fin n)) : + canonicalTrace (word U g) = if g = 1 then 1 else 0 := by + classical + obtain ⟨Φ,ht,rfl⟩ := hU + rw [word_mapTuple,ht,word_initial,canonicalTrace_groupUnitary] + have hi : FreeGroup.map (Option.some : Fin n → Option (Fin n)) g = 1 ↔ g = 1 := by + rw [← (FreeGroup.map Option.some).map_one] + exact (FreeGroup.map_injective (Option.some_injective (Fin n))).eq_iff + simp only [hi] + +theorem closure_orbit_trace (n : ℕ) (U : Tuple n) (hU : U ∈ closure (orbit n)) (g : FreeGroup (Fin n)) : + canonicalTrace (word U g) = if g = 1 then 1 else 0 := by + classical + have hc : Continuous (fun V : Tuple n => canonicalTrace (word V g)) := + (canonicalTraceCLM (G := FreeGroup (Option (Fin n)))).continuous.comp (word_continuous g) + have hclosed : IsClosed {V : Tuple n | canonicalTrace (word V g) = if g = 1 then 1 else 0} := + isClosed_eq hc continuous_const + exact (closure_minimal (fun V hV => orbit_trace n V hV g) hclosed) hU + +theorem poly_l2_mem {G : Type uG} [Group G] {ι : Type uι} + (U : ι → unitary (groupVonNeumann G)) (p : FreeGroup ι →₀ ℂ) : + groupL2 (poly U p) ∈ Submodule.span ℂ (Set.range (fun g => groupL2 (word U g))) := by + classical + rw [poly,Finsupp.sum,map_sum] + apply Submodule.sum_mem + intro g _hg + rw [map_smul] + exact Submodule.smul_mem _ _ (Submodule.subset_span ⟨g,rfl⟩) + +theorem total_of_poly_approx {G : Type uG} [Group G] [DecidableEq G] {ι : Type uι} + (U : ι → unitary (groupVonNeumann G)) + (hU : ∀ g : G, ∀ ε : ℝ, 0 < ε → ∃ p : FreeGroup ι →₀ ℂ, + dist (groupL2 (poly U p)) (lp.single 2 g (1 : ℂ)) < ε) : + ⊤ ≤ (Submodule.span ℂ (Set.range (fun g => groupL2 (word U g)))).topologicalClosure := by + classical + apply group_single_total _ (Submodule.isClosed_topologicalClosure _) + intro g + change lp.single 2 g (1 : ℂ) ∈ closure (Submodule.span ℂ (Set.range (fun g => groupL2 (word U g))) : Set (GroupHilbert G)) + apply Metric.mem_closure_iff.mpr + intro ε hε + obtain ⟨p,hp⟩ := hU g ε hε + exact ⟨groupL2 (poly U p),poly_l2_mem U p,by simpa only [dist_comm] using hp⟩ + +end FreeGroupFactorMain.Generation + +namespace FreeGroupFactorMain + +theorem baire_local_approximation + {X : Type uX} {Y : Type uY} {I : Type uI} {P : Type uP} [MetricSpace X] [CompleteSpace X] [MetricSpace Y] [Countable I] + (S : Set X) (hS : S.Nonempty) (a : P → X → Y) (ha : ∀ p, Continuous (a p)) + (v : I → Y) + (hlocal : ∀ x ∈ S, ∀ δ : ℝ, 0 < δ → ∀ i : I, ∀ ε : ℝ, 0 < ε → + ∃ y ∈ S, dist y x < δ ∧ ∃ p, dist (a p y) (v i) < ε) : + ∃ x ∈ closure S, ∀ i : I, ∀ ε : ℝ, 0 < ε → ∃ p, dist (a p x) (v i) < ε := by + let T := closure S + let : IsClosed T := isClosed_closure + let : Nonempty T := by + obtain ⟨x,hx⟩ := hS + exact ⟨⟨x, subset_closure hx⟩⟩ + let O (ik : I × ℕ) : Set T := {x | ∃ p, dist (a p x) (v ik.1) < 1 / (ik.2 + 1 : ℝ)} + have hopen (ik : I × ℕ) : IsOpen (O ik) := by + simp only [O, Set.ofPred_exists] + apply isOpen_iUnion + intro p + exact isOpen_lt (((ha p).comp continuous_subtype_val).dist continuous_const) continuous_const + have hdense (ik : I × ℕ) : Dense (O ik) := by + intro x + apply Metric.mem_closure_iff.mpr + intro δ hδ + obtain ⟨y,hy,hxy⟩ := Metric.mem_closure_iff.mp x.property (δ/2) (half_pos hδ) + obtain ⟨z,hz,hzy,p,hp⟩ := hlocal y hy (δ/2) (half_pos hδ) ik.1 + (1/(ik.2+1:ℝ)) (by positivity) + refine ⟨⟨z,subset_closure hz⟩, ⟨p,hp⟩, ?_⟩ + change dist (x : X) z < δ + have htri := dist_triangle (x : X) y z + rw [dist_comm y z] at htri + linarith + obtain ⟨x,hx⟩ := (dense_iInter_of_isOpen hopen hdense).nonempty + refine ⟨x,x.property,?_⟩ + intro i ε hε + obtain ⟨k,hk⟩ := exists_nat_one_div_lt hε + obtain ⟨p,hp⟩ := Set.mem_iInter.mp hx (i,k) + exact ⟨p, hp.trans hk⟩ + +theorem normalTracialIso_of_groupEquiv {G : Type uG} {H : Type uH} [Group G] [Group H] (e : G ≃* H) : + HasNormalTracialIso G H := by + classical + let ρ : G →* groupVonNeumann H := (groupUnitaryHom H).comp e.toMonoidHom + apply normalTracialIso_of_haar_total ρ + · intro g + change star (groupUnitary (e g)) = groupUnitary (e g⁻¹) + rw [map_inv] + exact Subtype.ext (leftRegular_star (e g)) + · intro g + change canonicalTrace (groupUnitary (e g)) = _ + rw [canonicalTrace_groupUnitary] + simp only [e.map_eq_one_iff] + · apply group_single_total _ (Submodule.isClosed_topologicalClosure _) + intro h + have hh : groupL2 (groupUnitary h) = ((ρ (e.symm h) : groupVonNeumann H) : GroupOperator H) deltaOne := by + simp only [ρ,MonoidHom.comp_apply,MulEquiv.coe_toMonoidHom,e.apply_symm_apply] + rfl + rw [← groupL2_groupUnitary h,hh] + exact Submodule.le_topologicalClosure _ (Submodule.subset_span ⟨e.symm h,rfl⟩) + +theorem HasNormalTracialIso.trans {G : Type uG} {H : Type uH} {K : Type uK} [Group G] [Group H] [Group K] + (hGH : HasNormalTracialIso G H) (hHK : HasNormalTracialIso H K) : HasNormalTracialIso G K := by + obtain ⟨Φ,hΦt,hΦn⟩ := hGH + obtain ⟨Ψ,hΨt,hΨn⟩ := hHK + refine ⟨Φ.trans Ψ,?_,?_⟩ + · intro T + simp only [StarAlgEquiv.trans_apply,hΨt,hΦt] + · let : TopologicalSpace (groupVonNeumann G) := groupUltraweakTopology G + let : TopologicalSpace (groupVonNeumann H) := groupUltraweakTopology H + let : TopologicalSpace (groupVonNeumann K) := groupUltraweakTopology K + exact hΨn.comp hΦn + +def optionRankEquiv (n : ℕ) : FreeGroup (Option (Fin n)) ≃* FreeGroupRank (n+1) := + FreeGroup.freeGroupCongr (finSuccEquiv n).symm + +open Generation + +theorem generating_haar_tuple (n : ℕ) (hn : 3 ≤ n) : + ∃ U : Tuple n, + (∀ g : FreeGroup (Fin n), canonicalTrace (word U g) = if g = 1 then 1 else 0) ∧ + ⊤ ≤ (Submodule.span ℂ (Set.range (fun g => groupL2 (word U g)))).topologicalClosure := by + classical + obtain ⟨U,hU,happrox⟩ := baire_local_approximation (orbit n) (orbit_nonempty n) + (fun p U => groupL2 (poly U p)) (poly_groupL2_continuous n) + (fun g : FreeGroup (Option (Fin n)) => lp.single 2 g (1 : ℂ)) + (orbit_local_approximation n hn) + exact ⟨U,closure_orbit_trace n U hU,total_of_poly_approx U happrox⟩ + +theorem rank_step_option (n : ℕ) (hn : 3 ≤ n) : + HasNormalTracialIso (FreeGroupRank n) (FreeGroup (Option (Fin n))) := by + classical + obtain ⟨U,htrace,htotal⟩ := generating_haar_tuple n hn + apply normalTracialIso_of_haar_total (word U) + · intro g + exact (word_inv U g).symm + · exact htrace + · exact htotal + +theorem rank_step (n : ℕ) (hn : 3 ≤ n) : + HasNormalTracialIso (FreeGroupRank n) (FreeGroupRank (n+1)) := + (rank_step_option n hn).trans (normalTracialIso_of_groupEquiv (optionRankEquiv n)) + +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/GlobalODE.lean b/lean/OAI/Analysis/FreeGroupFactor/GlobalODE.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea0a5f6b9b3a4dcbefe91a23868fa9fa40767f1f --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/GlobalODE.lean @@ -0,0 +1,244 @@ +import OAI.Analysis.FreeGroupFactor.Model + +namespace OAI + +noncomputable section + +universe uA uE uι + +open Set Metric +open scoped NNReal Topology + +open Set Metric +open scoped NNReal Topology +namespace FreeGroupFactorMain + +theorem global_solution_of_bounded_lipschitz + {E : Type uE} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] + (f : E → E) (K L : ℝ≥0) (hf : LipschitzWith K f) + (hbound : ∀ x, ‖f x‖ ≤ L) (x₀ : E) : + ∃ X : ℝ → E, X 0 = x₀ ∧ ∀ t, HasDerivAt X (f (X t)) t := by + have hlocal (R : ℝ) (hR : 0 < R) : + ∃ X : ℝ → E, X 0 = x₀ ∧ + ∀ t ∈ Ioo (-R) R, HasDerivAt X (f (X t)) t := by + let r : ℝ≥0 := NNReal.mk R hR.le + have hp : IsPicardLindelof (fun _ : ℝ => f) + (⟨0, by constructor <;> linarith⟩ : Icc (-R) R) + x₀ (L * r) 0 L K := by + constructor + · intro t ht + exact hf.lipschitzOnWith + · intro x hx + exact continuousOn_const + · intro t ht x hx + exact hbound x + · simp [r, NNReal.coe_mul] + obtain ⟨X, hX₀, hX⟩ := hp.exists_eq_forall_mem_Icc_hasDerivWithinAt₀ + refine ⟨X, hX₀, fun t ht => ?_⟩ + exact (hX t ⟨ht.1.le, ht.2.le⟩).hasDerivAt (Icc_mem_nhds ht.1 ht.2) + choose sol init deriv using hlocal + have agree (R Q : ℝ) (hR : 0 < R) (hQ : 0 < Q) (t : ℝ) + (htR : t ∈ Ioo (-R) R) (htQ : t ∈ Ioo (-Q) Q) : + sol R hR t = sol Q hQ t := by + have hm : 0 < min R Q := lt_min hR hQ + have heq : EqOn (sol R hR) (sol Q hQ) (Ioo (-min R Q) (min R Q)) := by + apply ODE_solution_unique_of_mem_Ioo + (v := fun _ : ℝ => f) (s := fun _ => univ) (t₀ := 0) + (fun _ _ => hf.lipschitzOnWith) + (by constructor <;> linarith) _ _ (by rw [init, init]) + · intro u hu + refine ⟨deriv R hR u ?_, mem_univ _⟩ + constructor <;> have := min_le_left R Q <;> linarith [hu.1, hu.2] + · intro u hu + refine ⟨deriv Q hQ u ?_, mem_univ _⟩ + constructor <;> have := min_le_right R Q <;> linarith [hu.1, hu.2] + apply heq + constructor + · have hh : -t < min R Q := lt_min (by linarith [htR.1]) (by linarith [htQ.1]) + linarith + · exact lt_min htR.2 htQ.2 + let X : ℝ → E := fun t => sol (|t| + 1) (by positivity) t + have hEq (R : ℝ) (hR : 0 < R) : EqOn X (sol R hR) (Ioo (-R) R) := by + intro t ht + apply agree + · constructor <;> linarith [neg_abs_le t, le_abs_self t] + · exact ht + refine ⟨X, ?_, fun t => ?_⟩ + · exact init _ _ + · let R := |t| + 1 + have hR : 0 < R := by dsimp [R]; positivity + have ht : t ∈ Ioo (-R) R := by + dsimp [R] + constructor <;> linarith [neg_abs_le t, le_abs_self t] + have hh : X =ᶠ[nhds t] sol R hR := + Filter.eventuallyEq_of_mem (isOpen_Ioo.mem_nhds ht) (hEq R hR) + rw [hEq R hR ht] + exact (deriv R hR t ht).congr_of_eventuallyEq hh + +end FreeGroupFactorMain + +open scoped NNReal +namespace FreeGroupFactorMain + +variable {E : Type uE} [NormedAddCommGroup E] [NormedSpace ℝ E] + +def radialClip (x : E) : E := (max 1 ‖x‖)⁻¹ • x + +theorem radialClip_eq {x : E} (hx : ‖x‖ ≤ 1) : radialClip x = x := by + simp [radialClip, max_eq_left hx] + +theorem norm_radialClip_le (x : E) : ‖radialClip x‖ ≤ 1 := by + have ha : 0 < max 1 ‖x‖ := lt_of_lt_of_le zero_lt_one (le_max_left _ _) + rw [radialClip, norm_smul, norm_inv, Real.norm_eq_abs, abs_of_pos ha] + simpa only [div_eq_mul_inv, mul_comm] using (div_le_one ha).mpr (le_max_right 1 ‖x‖) + +theorem radialClip_lipschitz : LipschitzWith 2 (radialClip : E → E) := by + have hle (x y : E) (hxy : max 1 ‖y‖ ≤ max 1 ‖x‖) : + ‖radialClip x - radialClip y‖ ≤ 2 * ‖x - y‖ := by + let a := max 1 ‖x‖ + let b := max 1 ‖y‖ + have ha1 : 1 ≤ a := le_max_left _ _ + have hb1 : 1 ≤ b := le_max_left _ _ + have ha : 0 < a := lt_of_lt_of_le zero_lt_one ha1 + have hb : 0 < b := lt_of_lt_of_le zero_lt_one hb1 + have hba : b ≤ a := hxy + have hiny : ‖y‖ ≤ b := le_max_right _ _ + have hdiff : a - b ≤ ‖x - y‖ := by + have := (lipschitzWith_one_norm.const_max 1).dist_le_mul x y + exact (le_abs_self (a - b)).trans (by simpa [a, b, Real.dist_eq, dist_eq_norm] using this) + have hinv : a⁻¹ ≤ b⁻¹ := inv_anti₀ hb hba + have hterm : (b⁻¹ - a⁻¹) * ‖y‖ ≤ a - b := by + calc + (b⁻¹ - a⁻¹) * ‖y‖ = (a - b) * (‖y‖ / (a * b)) := by + field_simp + _ ≤ (a - b) * 1 := by + apply mul_le_mul_of_nonneg_left _ (sub_nonneg.mpr hba) + apply (div_le_one (mul_pos ha hb)).mpr + exact hiny.trans (by nlinarith [mul_nonneg (sub_nonneg.mpr ha1) hb.le]) + _ = a - b := mul_one _ + have hfirst : a⁻¹ * ‖x - y‖ ≤ ‖x - y‖ := + mul_le_of_le_one_left (norm_nonneg _) ((inv_le_one₀ ha).mpr ha1) + have hid : radialClip x - radialClip y = + a⁻¹ • (x - y) + (a⁻¹ - b⁻¹) • y := by + dsimp [radialClip, a, b] + module + rw [hid] + calc + ‖a⁻¹ • (x - y) + (a⁻¹ - b⁻¹) • y‖ ≤ + ‖a⁻¹ • (x - y)‖ + ‖(a⁻¹ - b⁻¹) • y‖ := norm_add_le _ _ + _ = a⁻¹ * ‖x - y‖ + (b⁻¹ - a⁻¹) * ‖y‖ := by + rw [norm_smul, norm_smul, Real.norm_eq_abs, Real.norm_eq_abs, + abs_of_pos (inv_pos.mpr ha), abs_of_nonpos (sub_nonpos.mpr hinv)] + ring + _ ≤ 2 * ‖x - y‖ := by linarith + apply LipschitzWith.of_dist_le_mul + intro x y + simp only [NNReal.coe_ofNat, dist_eq_norm] + rcases le_total (max 1 ‖y‖) (max 1 ‖x‖) with h | h + · exact hle x y h + · simpa only [norm_sub_rev (radialClip y), norm_sub_rev y] using hle y x h + +end FreeGroupFactorMain + +open scoped NNReal BigOperators +namespace FreeGroupFactorMain + +variable {E : Type uE} {A : Type uA} [NormedAddCommGroup E] [NormedRing A] + +def BoundedLip (f : E → A) : Prop := + ∃ M K : ℝ, 0 ≤ M ∧ 0 ≤ K ∧ (∀ x, ‖f x‖ ≤ M) ∧ + ∀ x y, ‖f x - f y‖ ≤ K * ‖x - y‖ + +namespace BoundedLip + +theorem const (c : A) : BoundedLip (fun _ : E => c) := by + refine ⟨‖c‖, 0, norm_nonneg _, le_rfl, fun _ => le_rfl, ?_⟩ + intro x y + simp + +theorem add {f g : E → A} (hf : BoundedLip f) (hg : BoundedLip g) : + BoundedLip (fun x => f x + g x) := by + obtain ⟨M, K, hM, hK, hfb, hfl⟩ := hf + obtain ⟨N, L, hN, hL, hgb, hgl⟩ := hg + refine ⟨M + N, K + L, add_nonneg hM hN, add_nonneg hK hL, ?_, ?_⟩ + · intro x + exact (norm_add_le _ _).trans (add_le_add (hfb x) (hgb x)) + · intro x y + rw [show f x + g x - (f y + g y) = (f x - f y) + (g x - g y) by abel] + exact (norm_add_le _ _).trans (by nlinarith only [hfl x y, hgl x y]) + +theorem mul {f g : E → A} (hf : BoundedLip f) (hg : BoundedLip g) : + BoundedLip (fun x => f x * g x) := by + obtain ⟨M, K, hM, hK, hfb, hfl⟩ := hf + obtain ⟨N, L, hN, hL, hgb, hgl⟩ := hg + refine ⟨M * N, M * L + K * N, mul_nonneg hM hN, + add_nonneg (mul_nonneg hM hL) (mul_nonneg hK hN), ?_, ?_⟩ + · intro x + exact (norm_mul_le _ _).trans (mul_le_mul (hfb x) (hgb x) (norm_nonneg _) hM) + · intro x y + calc + ‖f x * g x - f y * g y‖ = + ‖f x * (g x - g y) + (f x - f y) * g y‖ := by + congr 1 + noncomm_ring + _ ≤ ‖f x‖ * ‖g x - g y‖ + ‖f x - f y‖ * ‖g y‖ := + (norm_add_le _ _).trans (add_le_add (norm_mul_le _ _) (norm_mul_le _ _)) + _ ≤ M * (L * ‖x - y‖) + (K * ‖x - y‖) * N := by + exact add_le_add + (mul_le_mul (hfb x) (hgl x y) (norm_nonneg _) hM) + (mul_le_mul (hfl x y) (hgb y) (norm_nonneg _) + (mul_nonneg hK (norm_nonneg _))) + _ = (M * L + K * N) * ‖x - y‖ := by ring + +theorem star [StarRing A] [NormedStarGroup A] {f : E → A} (hf : BoundedLip f) : + BoundedLip (fun x => star (f x)) := by + obtain ⟨M, K, hM, hK, hfb, hfl⟩ := hf + refine ⟨M, K, hM, hK, ?_, ?_⟩ + · simpa only [norm_star] using hfb + · simpa only [← star_sub, norm_star] using hfl + +theorem sum {ι : Type uι} (s : Finset ι) (f : ι → E → A) + (hf : ∀ i ∈ s, BoundedLip (f i)) : BoundedLip (fun x => ∑ i ∈ s, f i x) := by + classical + induction s using Finset.induction_on with + | empty => simpa using (const (E := E) (0 : A)) + | @insert i s hi ih => + simpa [Finset.sum_insert hi] using + (hf i (Finset.mem_insert_self i s)).add + (ih (fun j hj => hf j (Finset.mem_insert_of_mem hj))) + +theorem smul [NormedAlgebra ℂ A] (c : ℂ) {f : E → A} (hf : BoundedLip f) : + BoundedLip (fun x => c • f x) := by + simpa only [Algebra.smul_def] using (const (E := E) (algebraMap ℂ A c)).mul hf + +theorem pi {ι : Type uι} [Fintype ι] {f : E → ι → A} + (hf : ∀ i, BoundedLip (fun x => f x i)) : BoundedLip f := by + classical + choose M K hM hK hb hl using hf + have hMs (i : ι) : M i ≤ ∑ j, M j := + Finset.single_le_sum (fun j _ => hM j) (Finset.mem_univ i) + have hKs (i : ι) : K i ≤ ∑ j, K j := + Finset.single_le_sum (fun j _ => hK j) (Finset.mem_univ i) + have hMsum : 0 ≤ ∑ j, M j := Finset.sum_nonneg fun j _ => hM j + have hKsum : 0 ≤ ∑ j, K j := Finset.sum_nonneg fun j _ => hK j + refine ⟨∑ j, M j, ∑ j, K j, hMsum, hKsum, ?_, ?_⟩ + · intro x + exact (pi_norm_le_iff_of_nonneg hMsum).mpr fun i => (hb i x).trans (hMs i) + · intro x y + apply (pi_norm_le_iff_of_nonneg (mul_nonneg hKsum (norm_nonneg _))).mpr + intro i + exact (hl i x y).trans (mul_le_mul_of_nonneg_right (hKs i) (norm_nonneg _)) + +theorem to_bounds {f : E → A} (hf : BoundedLip f) : + ∃ M K : ℝ≥0, (∀ x, ‖f x‖ ≤ M) ∧ LipschitzWith K f := by + obtain ⟨M, K, hM, hK, hb, hl⟩ := hf + refine ⟨NNReal.mk M hM, NNReal.mk K hK, hb, LipschitzWith.of_dist_le_mul ?_⟩ + intro x y + simpa only [dist_eq_norm, NNReal.coe_mk] using hl x y + +end BoundedLip +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/InfiniteGeneration.lean b/lean/OAI/Analysis/FreeGroupFactor/InfiniteGeneration.lean new file mode 100644 index 0000000000000000000000000000000000000000..179c8fdf22c415b2b24c1eacec9f46f409bd6b04 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/InfiniteGeneration.lean @@ -0,0 +1,449 @@ +import OAI.Analysis.FreeGroupFactor.FiniteActive + +namespace OAI + +noncomputable section + +universe uA uG uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff ENNReal + +attribute [local instance] Classical.propDecidable + +namespace FreeGroupFactorMain.Generation + + theorem norm_comp_sub_le {A : Type uA} [CStarAlgebra A] + (α β : A ≃⋆ₐ[ℂ] A) (x : A) : + ‖α (β x)-x‖ ≤ ‖β x-x‖+‖α x-x‖ := by + have he : α (β x)-x = α (β x-x)+(α x-x) := by rw [map_sub]; abel + rw [he] + exact (norm_add_le _ _).trans_eq (by rw [StarAlgEquiv.norm_map]) + + theorem twoNorm_comp_sub_le {G : Type uG} [Group G] + (α β : groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann G) + (ht : ∀ T, canonicalTrace (α T) = canonicalTrace T) + (x y : groupVonNeumann G) : + twoNorm (α (β x)-y) ≤ twoNorm (β x-x)+twoNorm (α x-y) := by + have he : α (β x)-y = α (β x-x)+(α x-y) := by rw [map_sub]; abel + rw [he] + exact (twoNorm_add_le _ _).trans_eq (by rw [twoNorm_iso α ht]) + + theorem twoNorm_map_sub_fixed {G : Type uG} [Group G] + (α : groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann G) + (ht : ∀ T, canonicalTrace (α T) = canonicalTrace T) + (x y : groupVonNeumann G) (hy : α y = y) : + twoNorm (α x-y) = twoNorm (x-y) := by + calc + twoNorm (α x-y) = twoNorm (α (x-y)) := by rw [map_sub,hy] + _ = twoNorm (x-y) := twoNorm_iso α ht _ + + theorem mapTuple_dist_lt {A : Type uA} [CStarAlgebra A] {ι : Type uι} [Fintype ι] + (α : A ≃⋆ₐ[ℂ] A) (U : ι → unitary A) {ε : ℝ} (hε : 0 < ε) + (h : ∀ i, ‖α (U i : A)-(U i : A)‖ < ε) : dist (mapTuple α U) U < ε := by + apply (dist_pi_lt_iff hε).mpr + intro i + change dist (α (U i : A)) (U i : A) < ε + rw [dist_eq_norm] + exact h i + +theorem conjugate_fix {A : Type uA} [CStarAlgebra A] + (α Ψ : A ≃⋆ₐ[ℂ] A) (x y : A) (hΨ : Ψ x = y) (hα : α x = x) : + Ψ (α (Ψ.symm y)) = y := by + rw [← hΨ,Ψ.symm_apply_apply,hα] + +theorem conjugate_norm_sub {A : Type uA} [CStarAlgebra A] + (α Ψ : A ≃⋆ₐ[ℂ] A) (x : A) (hx : Ψ x = x) : + ‖Ψ (α (Ψ.symm x))-x‖ = ‖α x-x‖ := by + conv_lhs => rw [← hx,Ψ.symm_apply_apply,← map_sub,StarAlgEquiv.norm_map] + +theorem conjugate_twoNorm_sub {G : Type uG} [Group G] + (α Ψ : groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann G) + (ht : ∀ T, canonicalTrace (Ψ T) = canonicalTrace T) + (x y z : groupVonNeumann G) (hx : Ψ x = x) (hy : Ψ y = z) : + twoNorm (Ψ (α (Ψ.symm x))-z) = twoNorm (α x-y) := by + conv_lhs => rw [← hx,Ψ.symm_apply_apply,← hy,← map_sub,twoNorm_iso Ψ ht] + +end FreeGroupFactorMain.Generation + +namespace FreeGroupFactorMain.InfiniteGeneration +open Generation + +abbrev Index := Option (Fin 3 ⊕ ℕ) +abbrev Group := FreeGroup Index +abbrev M := groupVonNeumann Group +abbrev Tuple := Fin 3 → unitary M + +def initial : Tuple := fun i => generatorUnitary (some (Sum.inl i)) +def extra (q : Option ℕ) : unitary M := + generatorUnitary (q.elim none (fun k => some (Sum.inr k))) + +theorem word_initial (g : FreeGroup (Fin 3)) : + word initial g = groupUnitary (FreeGroup.map (fun i => some (Sum.inl i)) g) := by + have he : word initial = (groupUnitaryHom Group).comp + (FreeGroup.map (fun i => some (Sum.inl i))) := by + apply FreeGroup.ext_hom + intro i + simp only [word_of,MonoidHom.comp_apply,FreeGroup.map.of] + rfl + exact DFunLike.congr_fun he g + +theorem permutation_iso (e : Index ≃ Index) : + ∃ Φ : M ≃⋆ₐ[ℂ] M, (∀ T, canonicalTrace (Φ T) = canonicalTrace T) ∧ + ∀ i, Φ (generatorUnitary i : M) = (generatorUnitary (e i) : M) := by + obtain ⟨Φ,ht,_hc,_hci,hg⟩ := gaugedIso (FreeGroup.freeGroupCongr e) (1 : Group →* unitary ℂ) + refine ⟨Φ,ht,?_⟩ + intro i + have hh := hg (FreeGroup.of i) + simp only [MonoidHom.one_apply,Submonoid.coe_one,one_smul] at hh + change Φ (groupUnitary (FreeGroup.of i)) = groupUnitary (FreeGroup.map e (FreeGroup.of i)) at hh + simpa only [FreeGroup.map.of,generatorUnitary] using hh + +theorem swapped_extra_iso (k : ℕ) : + ∃ Ψ : M ≃⋆ₐ[ℂ] M, (∀ T, canonicalTrace (Ψ T) = canonicalTrace T) ∧ + (∀ i, Ψ (initial i : M) = (initial i : M)) ∧ + Ψ (extra none : M) = (extra (some k) : M) ∧ + Ψ (extra (some k) : M) = (extra none : M) ∧ + ∀ j, j ≠ k → Ψ (extra (some j) : M) = (extra (some j) : M) := by + let e : Index ≃ Index := Equiv.swap none (some (Sum.inr k)) + obtain ⟨Ψ,hΨt,hΨ⟩ := permutation_iso e + have hΨA (i : Fin 3) : Ψ (initial i : M) = (initial i : M) := by + change Ψ (generatorUnitary (some (Sum.inl i) : Index) : M) = _ + rw [hΨ] + simp [e,Equiv.swap_apply_of_ne_of_ne,initial] + have hΨ0 : Ψ (extra none : M) = (extra (some k) : M) := by + change Ψ (generatorUnitary (none : Index) : M) = _ + rw [hΨ] + simp [e,extra] + have hΨk : Ψ (extra (some k) : M) = (extra none : M) := by + change Ψ (generatorUnitary (some (Sum.inr k) : Index) : M) = _ + rw [hΨ] + simp [e,extra] + have hΨj (j : ℕ) (hj : j ≠ k) : Ψ (extra (some j) : M) = (extra (some j) : M) := by + change Ψ (generatorUnitary (some (Sum.inr j) : Index) : M) = _ + rw [hΨ] + simp [e,Equiv.swap_apply_of_ne_of_ne,hj,extra] + exact ⟨Ψ,hΨt,hΨA,hΨ0,hΨk,hΨj⟩ + +theorem one_step_extra_of_none + (hone : ∀ ε : ℝ, 0 < ε → ∃ α : M ≃⋆ₐ[ℂ] M, + (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + (∀ k : ℕ, α (extra (some k) : M) = (extra (some k) : M)) ∧ + ∃ w : FreeGroup (Fin 3), + (∀ i, ‖α (initial i : M)-(initial i : M)‖ < ε) ∧ + twoNorm (α (word initial w)-(extra none : M)) < ε) + (q : Option ℕ) {ε : ℝ} (hε : 0 < ε) : + ∃ α : M ≃⋆ₐ[ℂ] M, (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + (∀ r : Option ℕ, r ≠ q → α (extra r : M) = (extra r : M)) ∧ + ∃ w : FreeGroup (Fin 3), + (∀ i, ‖α (initial i : M)-(initial i : M)‖ < ε) ∧ + twoNorm (α (word initial w)-(extra q : M)) < ε := by + obtain ⟨α,ht,hfix,w,hA,hw⟩ := hone ε hε + cases q with + | none => + refine ⟨α,ht,?_,w,hA,hw⟩ + rintro (_|k) hk + · exact (hk rfl).elim + · exact hfix k + | some k => + obtain ⟨Ψ,hΨt,hΨA,hΨ0,hΨk,hΨj⟩ := swapped_extra_iso k + have hΨtuple : mapTuple Ψ initial = initial := by + funext i + exact Subtype.ext (hΨA i) + have hΨword : Ψ (word initial w) = word initial w := by + rw [← word_mapTuple,hΨtuple] + refine ⟨(Ψ.symm.trans α).trans Ψ,?_,?_,w,?_,?_⟩ + · intro T + simp only [StarAlgEquiv.trans_apply,hΨt,ht,trace_symm Ψ hΨt] + · intro r hr + change Ψ (α (Ψ.symm (extra r : M))) = (extra r : M) + cases r with + | none => exact conjugate_fix α Ψ _ _ hΨk (hfix k) + | some j => + have hj : j ≠ k := fun he => hr (congrArg some he) + exact conjugate_fix α Ψ _ _ (hΨj j hj) (hfix j) + · intro i + change ‖Ψ (α (Ψ.symm (initial i : M)))-(initial i : M)‖ < ε + rw [conjugate_norm_sub α Ψ _ (hΨA i)] + exact hA i + · change twoNorm (Ψ (α (Ψ.symm (word initial w)))-(extra (some k) : M)) < ε + rw [conjugate_twoNorm_sub α Ψ hΨt _ _ _ hΨword hΨ0] + exact hw + +end FreeGroupFactorMain.InfiniteGeneration + +namespace FreeGroupFactorMain.Generation +variable {G : Type uG} [Group G] {ι : Type uι} + +theorem word_twoNorm_finite_bound (g : FreeGroup ι) : + ∃ (s : Finset ι) (K : ℝ), 0 ≤ K ∧ + ∀ (U V : ι → unitary (groupVonNeumann G)) (δ : ℝ), 0 ≤ δ → + (∀ j ∈ s, twoNorm ((U j : groupVonNeumann G)-(V j : groupVonNeumann G)) ≤ δ) → + twoNorm (word U g-word V g) ≤ K*δ := by + classical + induction g using FreeGroup.induction_on with + | one => + refine ⟨∅,0,le_rfl,?_⟩ + intro U V δ _hδ _hUV + simp only [map_one,sub_self,twoNorm_zero,zero_mul,le_refl] + | of j => + refine ⟨{j},1,by norm_num,?_⟩ + intro U V δ _hδ hUV + simpa only [word_of,one_mul] using hUV j (Finset.mem_singleton_self j) + | inv_of j ih => + obtain ⟨s,K,hK,hb⟩ := ih + refine ⟨s,K,hK,?_⟩ + intro U V δ hδ hUV + rw [word_inv,word_inv,← star_sub,twoNorm_star] + exact hb U V δ hδ hUV + | mul g h hg hh => + obtain ⟨s,K,hK,hb⟩ := hg + obtain ⟨t,L,hL,hl⟩ := hh + refine ⟨s ∪ t,K+L,add_nonneg hK hL,?_⟩ + intro U V δ hδ hUV + rw [map_mul,map_mul] + exact (twoNorm_mul_sub_le (FreeGroup.lift U g) (FreeGroup.lift U h) + (FreeGroup.lift V g) (FreeGroup.lift V h)).trans (by + simpa only [add_mul,word,MonoidHom.comp_apply,Submonoid.subtype_apply] using + add_le_add (hb U V δ hδ (fun j hj => hUV j (Finset.mem_union_left _ hj))) + (hl U V δ hδ (fun j hj => hUV j (Finset.mem_union_right _ hj)))) + +theorem poly_twoNorm_finite_bound (p : FreeGroup ι →₀ ℂ) : + ∃ (s : Finset ι) (K : ℝ), 0 ≤ K ∧ + ∀ (U V : ι → unitary (groupVonNeumann G)) (δ : ℝ), 0 ≤ δ → + (∀ j ∈ s, twoNorm ((U j : groupVonNeumann G)-(V j : groupVonNeumann G)) ≤ δ) → + twoNorm (poly U p-poly V p) ≤ K*δ := by + classical + induction p using Finsupp.induction_linear with + | zero => + refine ⟨∅,0,le_rfl,?_⟩ + intro U V δ _hδ _hUV + simp only [poly_zero,sub_self,twoNorm_zero,zero_mul,le_refl] + | add p q ihp ihq => + obtain ⟨s,K,hK,hb⟩ := ihp + obtain ⟨t,L,hL,hl⟩ := ihq + refine ⟨s ∪ t,K+L,add_nonneg hK hL,?_⟩ + intro U V δ hδ hUV + simp only [poly_add] + have he : poly U p+poly U q-(poly V p+poly V q) = + (poly U p-poly V p)+(poly U q-poly V q) := by abel + rw [he] + exact (twoNorm_add_le _ _).trans (by + simpa only [add_mul] using + add_le_add (hb U V δ hδ (fun j hj => hUV j (Finset.mem_union_left _ hj))) + (hl U V δ hδ (fun j hj => hUV j (Finset.mem_union_right _ hj)))) + | single g c => + obtain ⟨s,K,hK,hb⟩ := word_twoNorm_finite_bound (G := G) g + refine ⟨s,‖c‖*K,mul_nonneg (norm_nonneg _) hK,?_⟩ + intro U V δ hδ hUV + simp only [poly_single,← smul_sub,twoNorm_smul] + exact (mul_le_mul_of_nonneg_left (hb U V δ hδ hUV) (norm_nonneg c)).trans_eq + (mul_assoc _ _ _).symm + +end FreeGroupFactorMain.Generation + +namespace FreeGroupFactorMain.InfiniteGeneration +open Generation + + theorem finite_word_continuity (s : Finset (Option ℕ)) (w : Option ℕ → FreeGroup (Fin 3)) + {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ, 0 < δ ∧ ∀ U : Tuple, dist U initial < δ → + ∀ j ∈ s, ‖word U (w j)-word initial (w j)‖ < ε := by + have hc : Continuous (fun U : Tuple => fun j : s => word U (w j)) := + continuous_pi (fun j => word_continuous (w j)) + obtain ⟨δ,hδ,hd⟩ := Metric.continuousAt_iff.mp hc.continuousAt ε hε + refine ⟨δ,hδ,?_⟩ + intro U hU j hj + have hh := (dist_pi_lt_iff hε).mp (hd hU) (⟨j,hj⟩ : s) + rwa [dist_eq_norm] at hh + +theorem finite_absorption + (hone : ∀ (q : Option ℕ) (ε : ℝ), 0 < ε → + ∃ α : M ≃⋆ₐ[ℂ] M, (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + (∀ r : Option ℕ, r ≠ q → α (extra r : M) = (extra r : M)) ∧ + ∃ w : FreeGroup (Fin 3), + (∀ i, ‖α (initial i : M)-(initial i : M)‖ < ε) ∧ + twoNorm (α (word initial w)-(extra q : M)) < ε) + (s : Finset (Option ℕ)) (ε : ℝ) (hε : 0 < ε) : + ∃ α : M ≃⋆ₐ[ℂ] M, (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + (∀ r, r ∉ s → α (extra r : M) = (extra r : M)) ∧ + ∃ w : Option ℕ → FreeGroup (Fin 3), + (∀ i, ‖α (initial i : M)-(initial i : M)‖ < ε) ∧ + ∀ j ∈ s, twoNorm (α (word initial (w j))-(extra j : M)) < ε := by + classical + induction s using Finset.induction_on generalizing ε with + | empty => + refine ⟨StarAlgEquiv.refl ℂ M,fun _ => rfl,fun _ _ => rfl,fun _ => 1,?_,?_⟩ + · intro i + change ‖(initial i : M)-(initial i : M)‖ < ε + simpa only [sub_self,norm_zero] using hε + · intro j hj + exact (Finset.notMem_empty j hj).elim + | @insert j s hj ih => + obtain ⟨α,hαt,hαfix,w,hαA,hαw⟩ := ih (ε/2) (half_pos hε) + obtain ⟨δ,hδ,hd⟩ := finite_word_continuity s w (half_pos hε) + let η := min (ε/2) δ + have hη : 0 < η := lt_min (half_pos hε) hδ + obtain ⟨β,hβt,hβfix,v,hβA,hβv⟩ := hone j η hη + have hbd := mapTuple_dist_lt β initial hη hβA + refine ⟨β.trans α,?_,?_,Function.update w j v,?_,?_⟩ + · intro T + simp only [StarAlgEquiv.trans_apply,hαt,hβt] + · intro r hr + have hrs : r ∉ s := fun hh => hr (Finset.mem_insert_of_mem hh) + have hrj : r ≠ j := fun hh => hr (hh ▸ Finset.mem_insert_self j s) + simp only [StarAlgEquiv.trans_apply,hβfix r hrj,hαfix r hrs] + · intro i + change ‖α (β (initial i : M))-(initial i : M)‖ < ε + apply (norm_comp_sub_le α β (initial i : M)).trans_lt + have hh := (hβA i).trans_le (min_le_left _ _) + linarith [hαA i] + · intro r hr + rcases Finset.mem_insert.mp hr with hrj | hrs + · subst r + rw [Function.update_self] + change twoNorm (α (β (word initial v))-(extra j : M)) < ε + rw [twoNorm_map_sub_fixed α hαt _ _ (hαfix j hj)] + exact hβv.trans_le ((min_le_left _ _).trans (by linarith)) + · by_cases hrj : r = j + · subst r + exact (hj hrs).elim + rw [Function.update_of_ne hrj] + change twoNorm (α (β (word initial (w r)))-(extra r : M)) < ε + apply (twoNorm_comp_sub_le α β hαt _ _).trans_lt + have hh := hd (mapTuple β initial) (hbd.trans_le (min_le_right _ _)) r hrs + rw [word_mapTuple] at hh + have hh' := (twoNorm_le_norm _).trans_lt hh + linarith [hαw r hrs] + + def orbit : Set Tuple := {U | ∃ Φ : M ≃⋆ₐ[ℂ] M, + (∀ T, canonicalTrace (Φ T) = canonicalTrace T) ∧ U = mapTuple Φ initial} + + theorem orbit_nonempty : orbit.Nonempty := by + refine ⟨mapTuple (StarAlgEquiv.refl ℂ M) initial,StarAlgEquiv.refl ℂ M,?_,rfl⟩ + intro T + rfl + + def extraLabel : Index → Option ℕ := fun j => j.elim none (Sum.elim (fun _ => none) some) + def replacement (w : Option ℕ → FreeGroup (Fin 3)) : Index → FreeGroup (Fin 3) := + fun j => j.elim (w none) (Sum.elim FreeGroup.of (fun k => w (some k))) + + theorem orbit_step + (hfinite : ∀ (s : Finset (Option ℕ)) (ε : ℝ), 0 < ε → + ∃ α : M ≃⋆ₐ[ℂ] M, (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + (∀ r, r ∉ s → α (extra r : M) = (extra r : M)) ∧ + ∃ w : Option ℕ → FreeGroup (Fin 3), + (∀ i, ‖α (initial i : M)-(initial i : M)‖ < ε) ∧ + ∀ j ∈ s, twoNorm (α (word initial (w j))-(extra j : M)) < ε) + (Φ : M ≃⋆ₐ[ℂ] M) (ht : ∀ T, canonicalTrace (Φ T) = canonicalTrace T) + (s : Finset Index) {θ : ℝ} (hθ : 0 < θ) : + ∃ V ∈ orbit, dist V (mapTuple Φ initial) < θ ∧ + ∃ w : Index → FreeGroup (Fin 3), ∀ j ∈ s, + twoNorm ((wordTuple V w j : M)-(mapTuple Φ generatorUnitary j : M)) < θ := by + classical + obtain ⟨α,hαt,_hfix,w,hA,hw⟩ := hfinite (s.image extraLabel) θ hθ + let V : Tuple := mapTuple (α.trans Φ) initial + have hdist : dist V (mapTuple Φ initial) < θ := by + apply (dist_pi_lt_iff hθ).mpr + intro i + change dist (Φ (α (initial i : M))) (Φ (initial i : M)) < θ + have hnorm (T : M) : ‖Φ T‖ = ‖T‖ := + NonUnitalStarAlgHom.norm_map Φ.toStarAlgHom Φ.injective T + rw [dist_eq_norm, ← map_sub, hnorm] + exact hA i + refine ⟨V,⟨α.trans Φ,?_,rfl⟩,hdist,replacement w,?_⟩ + · intro T + simp only [StarAlgEquiv.trans_apply,ht,hαt] + · intro j hj + have hex : extraLabel j ∈ s.image extraLabel := Finset.mem_image.mpr ⟨j,hj,rfl⟩ + cases j with + | none => + change twoNorm (word V (w none)-Φ (extra none : M)) < θ + rw [show V = mapTuple (α.trans Φ) initial from rfl,word_mapTuple, + StarAlgEquiv.trans_apply,← map_sub,twoNorm_iso Φ ht] + exact hw none hex + | some j => + cases j with + | inl i => + change twoNorm ((V i : M)-Φ (initial i : M)) < θ + have hh := (dist_pi_lt_iff hθ).mp hdist i + change dist (V i : M) (Φ (initial i : M)) < θ at hh + rw [dist_eq_norm] at hh + exact (twoNorm_le_norm _).trans_lt hh + | inr k => + change twoNorm (word V (w (some k))-Φ (extra (some k) : M)) < θ + rw [show V = mapTuple (α.trans Φ) initial from rfl,word_mapTuple, + StarAlgEquiv.trans_apply,← map_sub,twoNorm_iso Φ ht] + exact hw (some k) hex + + theorem orbit_local_approximation + (hstep : ∀ (Φ : M ≃⋆ₐ[ℂ] M), (∀ T, canonicalTrace (Φ T) = canonicalTrace T) → + ∀ (s : Finset Index) (θ : ℝ), 0 < θ → + ∃ V ∈ orbit, dist V (mapTuple Φ initial) < θ ∧ + ∃ w : Index → FreeGroup (Fin 3), ∀ j ∈ s, + twoNorm ((wordTuple V w j : M)-(mapTuple Φ generatorUnitary j : M)) < θ) + (U : Tuple) (hU : U ∈ orbit) (δ : ℝ) (hδ : 0 < δ) + (g : Group) (ε : ℝ) (hε : 0 < ε) : + ∃ V ∈ orbit, dist V U < δ ∧ ∃ p : FreeGroup (Fin 3) →₀ ℂ, + dist (groupL2 (poly V p)) (lp.single 2 g (1 : ℂ)) < ε := by + classical + obtain ⟨Φ,ht,rfl⟩ := hU + obtain ⟨p,hp⟩ := automorphism_poly_dense Φ ht (groupUnitary g) (half_pos hε) + obtain ⟨s,K,hK,hbound⟩ := poly_twoNorm_finite_bound (G := Group) p + let θ := min δ (ε/(2*(K+1))) + have hθ : 0 < θ := lt_min hδ (div_pos hε (by positivity)) + obtain ⟨V,hV,hd,w,hw⟩ := hstep Φ ht s θ hθ + refine ⟨V,hV,hd.trans_le (min_le_left _ _),substitute w p,?_⟩ + have hb := hbound (wordTuple V w) (mapTuple Φ generatorUnitary) θ hθ.le (fun j hj => (hw j hj).le) + have hθe : θ*(2*(K+1)) ≤ ε := + (le_div_iff₀ (by positivity : 0 < 2*(K+1))).mp (min_le_right _ _) + have hKe : K*θ < ε/2 := by nlinarith + rw [dist_eq_norm,← groupL2_groupUnitary g,← map_sub] + change twoNorm (poly V (substitute w p)-groupUnitary g) < ε + rw [poly_substitute] + have he : poly (wordTuple V w) p-groupUnitary g = + (poly (wordTuple V w) p-poly (mapTuple Φ generatorUnitary) p)+ + (poly (mapTuple Φ generatorUnitary) p-groupUnitary g) := by abel + rw [he] + exact (twoNorm_add_le _ _).trans_lt (by linarith) + + theorem orbit_trace (U : Tuple) (hU : U ∈ orbit) (g : FreeGroup (Fin 3)) : + canonicalTrace (word U g) = if g = 1 then 1 else 0 := by + classical + obtain ⟨Φ,ht,rfl⟩ := hU + rw [word_mapTuple,ht,word_initial,canonicalTrace_groupUnitary] + have hinj : Function.Injective (fun i : Fin 3 => (some (Sum.inl i) : Index)) := + Option.some_injective _ |>.comp Sum.inl_injective + have hi : FreeGroup.map (fun i : Fin 3 => (some (Sum.inl i) : Index)) g = 1 ↔ g = 1 := by + rw [← (FreeGroup.map (fun i : Fin 3 => (some (Sum.inl i) : Index))).map_one] + exact (FreeGroup.map_injective hinj).eq_iff + simp only [hi] + + theorem closure_orbit_trace (U : Tuple) (hU : U ∈ closure orbit) (g : FreeGroup (Fin 3)) : + canonicalTrace (word U g) = if g = 1 then 1 else 0 := by + classical + have hc : Continuous (fun V : Tuple => canonicalTrace (word V g)) := + (canonicalTraceCLM (G := Group)).continuous.comp (word_continuous g) + have hclosed : IsClosed {V : Tuple | canonicalTrace (word V g) = if g = 1 then 1 else 0} := + isClosed_eq hc continuous_const + exact (closure_minimal (fun V hV => orbit_trace V hV g) hclosed) hU + + theorem generating_haar_tuple + (hlocal : ∀ U ∈ orbit, ∀ δ : ℝ, 0 < δ → ∀ g : Group, ∀ ε : ℝ, 0 < ε → + ∃ V ∈ orbit, dist V U < δ ∧ ∃ p : FreeGroup (Fin 3) →₀ ℂ, + dist (groupL2 (poly V p)) (lp.single 2 g (1 : ℂ)) < ε) : + ∃ U : Tuple, + (∀ g : FreeGroup (Fin 3), canonicalTrace (word U g) = if g = 1 then 1 else 0) ∧ + ⊤ ≤ (Submodule.span ℂ (Set.range (fun g => groupL2 (word U g)))).topologicalClosure := by + classical + obtain ⟨U,hU,happrox⟩ := baire_local_approximation orbit orbit_nonempty + (fun p U => groupL2 (poly U p)) + (fun p => (groupL2 (G := Group)).continuous.comp (poly_continuous p)) + (fun g : Group => lp.single 2 g (1 : ℂ)) hlocal + exact ⟨U,closure_orbit_trace U hU,total_of_poly_approx U happrox⟩ + +end FreeGroupFactorMain.InfiniteGeneration + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/LaurentApproximation.lean b/lean/OAI/Analysis/FreeGroupFactor/LaurentApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..fea7a22d152a134cf68a5c35d7e6cc133dcd7d8e --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/LaurentApproximation.lean @@ -0,0 +1,419 @@ +import OAI.Analysis.FreeGroupFactor.SmallCocycle + +namespace OAI + +noncomputable section + +universe uA uG + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +namespace FreeGroupFactorMain.MobiusLog +variable {A : Type uA} [CommCStarAlgebra A] [Nontrivial A] + +theorem norm_neg_smul_star_lt (C : unitary A) {r : ℝ} (hr0 : 0 ≤ r) (hr1 : r < 1) : + ‖-r • star (C : A)‖ < 1 := by + calc + ‖-r • star (C : A)‖ = r * ‖(C : A)‖ := by + rw [norm_smul, norm_star, Real.norm_eq_abs, abs_neg, abs_of_nonneg hr0] + _ ≤ r * 1 := mul_le_mul_of_nonneg_left (CStarRing.norm_coe_unitary C).le hr0 + _ < 1 := by simpa using hr1 + +def denominator (C : unitary A) (r : ℝ) (hr0 : 0 ≤ r) (hr1 : r < 1) : Aˣ := + Units.oneSub (-r • star (C : A)) (norm_neg_smul_star_lt C hr0 hr1) + +@[simp] theorem denominator_coe (C : unitary A) (r : ℝ) (hr0 : 0 ≤ r) (hr1 : r < 1) : + (denominator C r hr0 hr1 : A) = 1 + r • star (C : A) := by + simp [denominator, sub_neg_eq_add] + +def mobius (C : unitary A) (r : ℝ) (hr0 : 0 ≤ r) (hr1 : r < 1) : unitary A := + ⟨((star (denominator C r hr0 hr1)) * (denominator C r hr0 hr1)⁻¹ : Aˣ), by + apply (Units.mul_inv_mem_unitary _ _).mpr + rw [star_star, mul_comm]⟩ + +theorem denominator_add_star_isUnit (C : unitary A) (r : ℝ) + (hr0 : 0 ≤ r) (hr1 : r < 1) : + IsUnit ((denominator C r hr0 hr1 : A) + star (denominator C r hr0 hr1 : A)) := by + have hn : ‖-(r/2) • ((C : A) + star (C : A))‖ < 1 := by + calc + _ = (r/2) * ‖(C : A) + star (C : A)‖ := by + rw [norm_smul, Real.norm_eq_abs, abs_neg, abs_of_nonneg (by positivity)] + _ ≤ (r/2) * (1+1) := by + gcongr + exact (norm_add_le _ _).trans (by + rw [norm_star] + exact add_le_add (CStarRing.norm_coe_unitary C).le (CStarRing.norm_coe_unitary C).le) + _ < 1 := by linarith + have hu := isUnit_one_sub_of_norm_lt_one hn + have he : (denominator C r hr0 hr1 : A) + star (denominator C r hr0 hr1 : A) = + (2 : ℝ) • (1 - (-(r/2) • ((C : A) + star (C : A)))) := by + simp only [denominator_coe, star_add, star_one, star_smul, star_trivial, star_star] + module + rw [he] + rw [Algebra.smul_def] + exact ((isUnit_iff_ne_zero.mpr (by norm_num) : IsUnit (2 : ℝ)).map + (algebraMap ℝ A)).mul hu + +theorem mobius_add_one_isUnit (C : unitary A) (r : ℝ) + (hr0 : 0 ≤ r) (hr1 : r < 1) : + IsUnit ((mobius C r hr0 hr1 : A) + 1) := by + have hu := denominator_add_star_isUnit C r hr0 hr1 + have he : ((mobius C r hr0 hr1 : A) + 1) * (denominator C r hr0 hr1 : A) = + (denominator C r hr0 hr1 : A) + star (denominator C r hr0 hr1 : A) := by + simp only [mobius, Units.val_mul, Units.coe_star, add_mul, mul_assoc, + Units.inv_mul, mul_one, one_mul] + exact add_comm _ _ + rw [← he] at hu + exact (IsUnit.mul_iff.mp hu).1 + +theorem mobius_norm_sub_one_lt_two (C : unitary A) (r : ℝ) + (hr0 : 0 ≤ r) (hr1 : r < 1) : + ‖(mobius C r hr0 hr1 : A) - 1‖ < 2 := by + apply (Unitary.norm_sub_one_lt_two_iff (mobius C r hr0 hr1).property).mpr + rw [spectrum.notMem_iff] + simpa [sub_eq_add_neg, add_comm] using + (mobius_add_one_isUnit C r hr0 hr1).neg + +theorem mobius_bounded_log (C : unitary A) (r : ℝ) + (hr0 : 0 ≤ r) (hr1 : r < 1) : + ∃ S : selfAdjoint A, ‖S‖ ≤ Real.pi ∧ selfAdjoint.expUnitary S = mobius C r hr0 hr1 := by + exact ⟨Unitary.argSelfAdjoint _, Unitary.norm_argSelfAdjoint_le_pi _, + expUnitary_argSelfAdjoint (mobius_norm_sub_one_lt_two C r hr0 hr1)⟩ + +theorem mobius_decomp (C : unitary A) (r : ℝ) (hr0 : 0 ≤ r) (hr1 : r < 1) : + (mobius C r hr0 hr1 : A) = r • (C : A) + + (1-r^2) • ((denominator C r hr0 hr1)⁻¹ : Aˣ) := by + let q := denominator C r hr0 hr1 + have he : (r • (C : A) + (1-r^2) • ((q⁻¹ : Aˣ) : A)) * (q : A) = star (q : A) := by + rw [add_mul, smul_mul_assoc, smul_mul_assoc, Units.inv_mul, denominator_coe, + mul_add, mul_one, mul_smul_comm, C.property.2] + simp only [star_add, star_one, star_smul, star_trivial, star_star, smul_add, smul_smul] + module + have hh := congrArg (fun x : A => x * ((q⁻¹ : Aˣ) : A)) he + simpa only [mul_assoc, Units.mul_inv, mul_one, mobius, Units.val_mul, Units.coe_star] + using hh.symm + +theorem trace_star_mul_denominator_inv (C : unitary A) (τ : A →L[ℂ] ℂ) + (hτ : ∀ m : ℤ, τ ((C^m : unitary A) : A) = if m = 0 then 1 else 0) + (r : ℝ) (hr0 : 0 ≤ r) (hr1 : r < 1) : + τ (star (C : A) * ((denominator C r hr0 hr1)⁻¹ : Aˣ)) = 0 := by + let t : A := -r • star (C : A) + have hs := summable_geometric_of_norm_lt_one (norm_neg_smul_star_lt C hr0 hr1) + change τ (star (C : A) * ∑' m : ℕ, t^m) = _ + rw [← hs.tsum_mul_left, τ.map_tsum (hs.mul_left _)] + have hz : ∀ m : ℕ, τ (star (C : A) * t^m) = 0 := by + intro m + have he : star (C : A) * (star (C : A))^m = ((C^(-(m+1 : ℤ)) : unitary A) : A) := by + rw [show (m:ℤ)+1 = ((m+1:ℕ):ℤ) by simp, zpow_neg, zpow_natCast, + ← Unitary.star_eq_inv] + rw [Unitary.coe_star, SubmonoidClass.coe_pow, star_pow, pow_succ'] + dsimp [t] + rw [smul_pow, mul_smul_comm, he, τ.map_smul_of_tower] + rw [hτ, ite_eq_right (by omega), smul_zero] + change (∑' m : ℕ, τ (star (C : A) * t^m)) = 0 + simp only [hz, tsum_zero] + +theorem trace_star_mul_mobius (C : unitary A) (τ : A →L[ℂ] ℂ) + (hτ : ∀ m : ℤ, τ ((C^m : unitary A) : A) = if m = 0 then 1 else 0) + (r : ℝ) (hr0 : 0 ≤ r) (hr1 : r < 1) : + τ (star (C : A) * (mobius C r hr0 hr1 : A)) = (r : ℂ) := by + rw [mobius_decomp, mul_add, mul_smul_comm, mul_smul_comm, C.property.1, + map_add, τ.map_smul_of_tower, τ.map_smul_of_tower, + trace_star_mul_denominator_inv C τ hτ r hr0 hr1] + have ht : τ 1 = 1 := by simpa using hτ 0 + simp [ht] + +end FreeGroupFactorMain.MobiusLog +namespace FreeGroupFactorMain.ElementalMobius +variable {A : Type uA} [CStarAlgebra A] [Nontrivial A] + +abbrev unitaryElemental (C : unitary A) : unitary (StarAlgebra.elemental ℂ (C : A)) := + ⟨⟨C, StarAlgebra.elemental.self_mem ℂ (C : A)⟩, + ⟨Subtype.ext C.property.1, Subtype.ext C.property.2⟩⟩ + +def inclusion (C : unitary A) : (StarAlgebra.elemental ℂ (C : A)) →L[ℂ] A := + (StarAlgebra.elemental ℂ (C : A)).subtype.toAlgHom.toLinearMap.mkContinuous 1 + (fun _ => by simp) + +omit [Nontrivial A] in +@[simp] theorem inclusion_apply (C : unitary A) (x : StarAlgebra.elemental ℂ (C : A)) : + inclusion C x = (x : A) := rfl + +omit [Nontrivial A] in +theorem unitaryElemental_zpow (C : unitary A) (m : ℤ) : + (((unitaryElemental C ^ m : unitary (StarAlgebra.elemental ℂ (C : A))) : + StarAlgebra.elemental ℂ (C : A)) : A) = ((C ^ m : unitary A) : A) := by + let f : unitary (StarAlgebra.elemental ℂ (C : A)) →* unitary A := + Unitary.map (StarMonoidHom.ofClass (StarAlgebra.elemental ℂ (C : A)).subtype) + exact congrArg (fun u : unitary A => (u : A)) (f.map_zpow (unitaryElemental C) m) + +def value (C : unitary A) (r : ℝ) (hr0 : 0 ≤ r) (hr1 : r < 1) : unitary A := + Unitary.map (StarMonoidHom.ofClass (StarAlgebra.elemental ℂ (C : A)).subtype) + (MobiusLog.mobius (unitaryElemental C) r hr0 hr1) + +theorem trace (C : unitary A) (τ : A →L[ℂ] ℂ) + (hτ : ∀ m : ℤ, τ ((C^m : unitary A) : A) = if m = 0 then 1 else 0) + (r : ℝ) (hr0 : 0 ≤ r) (hr1 : r < 1) : + τ (star (C : A) * (value C r hr0 hr1 : A)) = r := by + have ht (m : ℤ) : (τ.comp (inclusion C)) ((unitaryElemental C^m : unitary _) : + StarAlgebra.elemental ℂ (C : A)) = if m = 0 then 1 else 0 := by + simp only [ContinuousLinearMap.comp_apply, inclusion_apply, unitaryElemental_zpow, hτ] + exact MobiusLog.trace_star_mul_mobius (unitaryElemental C) (τ.comp (inclusion C)) ht r hr0 hr1 + +theorem bounded_log (C : unitary A) (r : ℝ) (hr0 : 0 ≤ r) (hr1 : r < 1) : + ∃ S : A, S ∈ StarAlgebra.elemental ℂ (C : A) ∧ IsSelfAdjoint S ∧ ‖S‖ ≤ Real.pi ∧ + NormedSpace.exp (Complex.I • S) = (value C r hr0 hr1 : A) := by + let B := StarAlgebra.elemental ℂ (C : A) + obtain ⟨S,hSn,hSexp⟩ := MobiusLog.mobius_bounded_log (unitaryElemental C) r hr0 hr1 + have hTsa : IsSelfAdjoint ((S : B) : A) := congrArg (fun x : B => (x : A)) S.property + refine ⟨((S : B) : A), (S : B).property, hTsa, hSn, ?_⟩ + have hmap := congrArg (fun x : unitary B => ((x : B) : A)) hSexp + change B.subtype (NormedSpace.exp (Complex.I • (S : B))) = _ at hmap + let : NormedAlgebra ℚ A := NormedAlgebra.restrictScalars ℚ ℂ A + let : NormedAlgebra ℚ B := NormedAlgebra.restrictScalars ℚ ℂ B + rw [NormedSpace.map_exp B.subtype continuous_subtype_val] at hmap + exact hmap + +end FreeGroupFactorMain.ElementalMobius +namespace FreeGroupFactorMain +variable {G : Type uG} [Group G] + +@[simp] theorem twoNorm_one : twoNorm (1 : groupVonNeumann G) = 1 := by + simp [twoNorm, groupL2, deltaOne, lp.norm_single] + +@[simp] theorem twoNorm_unitary (U : unitary (groupVonNeumann G)) : + twoNorm (U : groupVonNeumann G) = 1 := by + simpa using twoNorm_mul_unitary_left U 1 + +theorem twoNorm_sub_unitary_sq (U V : unitary (groupVonNeumann G)) : + twoNorm ((U : groupVonNeumann G) - (V : groupVonNeumann G)) ^ 2 = + 2 - 2 * (canonicalTrace (star (U : groupVonNeumann G) * (V : groupVonNeumann G))).re := by + classical + unfold twoNorm + rw [map_sub, norm_sub_sq (𝕜 := ℂ)] + change (twoNorm (U : groupVonNeumann G))^2 - + 2*(inner ℂ (groupL2 (U : groupVonNeumann G)) (groupL2 (V : groupVonNeumann G))).re + + (twoNorm (V : groupVonNeumann G))^2 = _ + rw [twoNorm_unitary, twoNorm_unitary, canonicalTrace_star_mul_inner] + simp only [groupL2_apply, deltaOne_eq] + ring + +def canonicalTraceContinuous : groupVonNeumann G →L[ℂ] ℂ := + (canonicalTraceLinear (G := G)).mkContinuous 1 (fun T => by + change ‖canonicalTrace T‖ ≤ 1 * ‖T‖ + simpa only [one_mul] using norm_canonicalTrace_le T) + +@[simp] theorem canonicalTraceContinuous_apply (T : groupVonNeumann G) : + canonicalTraceContinuous T = canonicalTrace T := rfl + +theorem haar_approx_log (C : unitary (groupVonNeumann G)) + (hτ : ∀ m : ℤ, canonicalTrace ((C^m : unitary (groupVonNeumann G)) : groupVonNeumann G) = + if m = 0 then 1 else 0) + {ε : ℝ} (hε : 0 < ε) : + ∃ S : groupVonNeumann G, + S ∈ StarAlgebra.elemental ℂ (C : groupVonNeumann G) ∧ IsSelfAdjoint S ∧ + ‖S‖ ≤ Real.pi ∧ twoNorm (NormedSpace.exp (Complex.I • S) - (C : groupVonNeumann G)) < ε := by + classical + let r : ℝ := 1 - min (ε^2/4) (1/2) + have hpos : 0 < min (ε^2/4) (1/2:ℝ) := lt_min (by positivity) (by norm_num) + have hr0 : 0 ≤ r := by dsimp [r]; have := min_le_right (ε^2/4) (1/2:ℝ); linarith + have hr1 : r < 1 := by dsimp [r]; linarith + obtain ⟨S,hSm,hSsa,hSn,hSexp⟩ := ElementalMobius.bounded_log C r hr0 hr1 + refine ⟨S,hSm,hSsa,hSn,?_⟩ + rw [hSexp] + have he := twoNorm_sub_unitary_sq C (ElementalMobius.value C r hr0 hr1) + rw [← canonicalTraceContinuous_apply, ElementalMobius.trace C canonicalTraceContinuous hτ r hr0 hr1, Complex.ofReal_re] at he + have hs : twoNorm ((ElementalMobius.value C r hr0 hr1 : groupVonNeumann G)-(C : groupVonNeumann G)) = + twoNorm ((C : groupVonNeumann G)-(ElementalMobius.value C r hr0 hr1 : groupVonNeumann G)) := by + unfold twoNorm + rw [map_sub, map_sub, norm_sub_rev] + rw [hs] + have hm := min_le_left (ε^2/4) (1/2:ℝ) + dsimp [r] at he + nlinarith [norm_nonneg (groupL2 ((C : groupVonNeumann G)-(ElementalMobius.value C r hr0 hr1 : groupVonNeumann G)))] + +end FreeGroupFactorMain + +open scoped BigOperators +namespace FreeGroupFactorMain.LaurentApprox + +section +variable {A : Type uA} [CStarAlgebra A] + +def value (C : unitary A) (l : ℤ →₀ ℂ) : A := + l.sum (fun m c => c • ((C^m : unitary A) : A)) + +def powers (C : unitary A) : Submonoid A where + carrier := Set.range (fun m : ℤ => ((C^m : unitary A) : A)) + one_mem' := ⟨0, by simp⟩ + mul_mem' := by + rintro x y ⟨m, rfl⟩ ⟨n, rfl⟩ + exact ⟨m+n, by simp [zpow_add]⟩ + +theorem adjoin_mem_span (C : unitary A) {x : A} + (hx : x ∈ StarAlgebra.adjoin ℂ ({(C : A)} : Set A)) : + x ∈ Submodule.span ℂ (Set.range (fun m : ℤ => ((C^m : unitary A) : A))) := by + have hs : Submonoid.closure ({(C : A)} ∪ star ({(C : A)} : Set A)) ≤ powers C := by + apply Submonoid.closure_le.mpr + intro y hy + simp only [Set.mem_union, Set.mem_singleton_iff, Set.star_singleton] at hy + rcases hy with rfl | rfl + · exact ⟨1, by simp⟩ + · exact ⟨-1, by change (((C^(-1:ℤ) : unitary A) : A)) = _; simp only [zpow_neg_one]; rfl⟩ + exact Submodule.span_mono hs (by + rw [← StarAlgebra.adjoin_eq_span] + exact hx) + +theorem approx (C : unitary A) {x : A} + (hx : x ∈ StarAlgebra.elemental ℂ (C : A)) {ε : ℝ} (hε : 0 < ε) : + ∃ l : ℤ →₀ ℂ, ‖value C l - x‖ < ε := by + change x ∈ closure (StarAlgebra.adjoin ℂ ({(C : A)} : Set A) : Set A) at hx + obtain ⟨y, hy, hxy⟩ := Metric.mem_closure_iff.mp hx ε hε + obtain ⟨l, hl⟩ := Finsupp.mem_span_range_iff_exists_finsupp.mp (adjoin_mem_span C hy) + refine ⟨l, ?_⟩ + simpa only [value, hl, dist_eq_norm, norm_sub_rev] using hxy + +theorem approx_selfAdjoint (C : unitary A) {x : A} + (hx : x ∈ StarAlgebra.elemental ℂ (C : A)) (hsa : IsSelfAdjoint x) + {ε : ℝ} (hε : 0 < ε) : + ∃ l : ℤ →₀ ℂ, IsSelfAdjoint (value C l) ∧ ‖value C l - x‖ < ε := by + change x ∈ closure (StarAlgebra.adjoin ℂ ({(C : A)} : Set A) : Set A) at hx + obtain ⟨y, hy, hxy⟩ := Metric.mem_closure_iff.mp hx ε hε + let z : A := (1/2 : ℝ) • (y + star y) + have hz : z ∈ StarAlgebra.adjoin ℂ ({(C : A)} : Set A) := by + exact (StarAlgebra.adjoin ℂ ({(C : A)} : Set A)).smul_mem + (by exact add_mem hy (star_mem hy)) (1/2 : ℝ) + obtain ⟨l, hl⟩ := Finsupp.mem_span_range_iff_exists_finsupp.mp (adjoin_mem_span C hz) + have hl' : value C l = z := hl + refine ⟨l, ?_, ?_⟩ + · rw [hl'] + show star z = z + simp [z, add_comm] + · rw [hl'] + have hz' : z - x = (1/2:ℝ) • ((y-x) + star (y-x)) := by + simp only [z, star_sub, hsa.star_eq] + module + rw [hz', norm_smul, Real.norm_eq_abs, abs_of_pos (by norm_num : (0:ℝ)<1/2)] + have hn := norm_add_le (y-x) (star (y-x)) + rw [norm_star] at hn + have hh : ‖y-x‖ < ε := by simpa only [dist_eq_norm, norm_sub_rev] using hxy + nlinarith + +@[simp] theorem value_add (C : unitary A) (l k : ℤ →₀ ℂ) : + value C (l+k) = value C l + value C k := + (Finsupp.linearCombination ℂ (fun m : ℤ => ((C^m : unitary A) : A))).map_add l k + +@[simp] theorem value_sub (C : unitary A) (l k : ℤ →₀ ℂ) : + value C (l-k) = value C l - value C k := + (Finsupp.linearCombination ℂ (fun m : ℤ => ((C^m : unitary A) : A))).map_sub l k + +@[simp] theorem value_single (C : unitary A) (m : ℤ) (c : ℂ) : + value C (Finsupp.single m c) = c • ((C^m : unitary A) : A) := by + simp [value] + +theorem trace_value (C : unitary A) (τ : A →L[ℂ] ℂ) + (hτ : ∀ m : ℤ, τ ((C^m : unitary A) : A) = if m = 0 then 1 else 0) + (l : ℤ →₀ ℂ) : τ (value C l) = l 0 := by + classical + simp only [value, Finsupp.sum, map_sum, map_smul, hτ] + simp [smul_eq_mul, mul_ite, eq_comm] + +theorem approx_selfAdjoint_exp (C : unitary A) {x : A} + (hx : x ∈ StarAlgebra.elemental ℂ (C : A)) (hsa : IsSelfAdjoint x) + {ε : ℝ} (hε : 0 < ε) : + ∃ l : ℤ →₀ ℂ, IsSelfAdjoint (value C l) ∧ ‖value C l‖ ≤ ‖x‖+1 ∧ + ‖NormedSpace.exp (Complex.I • value C l) - NormedSpace.exp (Complex.I • x)‖ < ε := by + have hc : ContinuousAt (fun y : A => NormedSpace.exp (Complex.I • y)) x := by + exact (NormedSpace.exp_analytic (𝕂 := ℂ) _).continuousAt.comp + (continuous_const_smul _).continuousAt + obtain ⟨δ, hδ, hd⟩ := Metric.continuousAt_iff.mp hc ε hε + obtain ⟨l, hsa', hl⟩ := approx_selfAdjoint C hx hsa (ε := min δ 1) (lt_min hδ (by norm_num)) + refine ⟨l, hsa', ?_, ?_⟩ + · have hh := norm_add_le (value C l-x) x + rw [sub_add_cancel] at hh + have := (lt_min_iff.mp hl).2 + linarith + · simpa only [dist_eq_norm] using + hd (by simpa only [dist_eq_norm] using (lt_min_iff.mp hl).1) + +end + +variable {A : Type uA} [CStarAlgebra A] [Nontrivial A] + +theorem center (C : unitary A) (τ : A →L[ℂ] ℂ) + (hτ : ∀ m : ℤ, τ ((C^m : unitary A) : A) = if m = 0 then 1 else 0) + (hstar : ∀ x, τ (star x) = star (τ x)) (hb : ∀ x, ‖τ x‖ ≤ ‖x‖) + (l : ℤ →₀ ℂ) (hsa : IsSelfAdjoint (value C l)) (K : ℝ) (hn : ‖value C l‖ ≤ K) : + ∃ k : ℤ →₀ ℂ, k 0 = 0 ∧ IsSelfAdjoint (value C k) ∧ ‖value C k‖ ≤ 2*K ∧ + ∃ z : unitary ℂ, NormedSpace.exp (Complex.I • value C k) = + (z : ℂ) • NormedSpace.exp (Complex.I • value C l) := by + let : NormedAlgebra ℚ A := NormedAlgebra.restrictScalars ℚ ℂ A + have hre : IsSelfAdjoint (l 0) := by + change star (l 0) = l 0 + rw [← trace_value C τ hτ l, ← hstar, hsa.star_eq] + have hbn : ‖l 0‖ ≤ ‖value C l‖ := by rw [← trace_value C τ hτ l]; exact hb _ + let k : ℤ →₀ ℂ := l - Finsupp.single 0 (l 0) + have hk : value C k = value C l - (l 0) • (1 : A) := by + simp only [k,value_sub,value_single,zpow_zero,Submonoid.coe_one] + refine ⟨k,by simp [k],?_,?_,?_⟩ + · rw [hk] + exact hsa.sub (hre.smul (IsSelfAdjoint.one A)) + · rw [hk] + calc + ‖value C l - (l 0) • (1 : A)‖ ≤ ‖value C l‖ + ‖(l 0) • (1 : A)‖ := norm_sub_le _ _ + _ ≤ ‖value C l‖ + ‖l 0‖ := by + gcongr + simp only [norm_smul, norm_one, mul_one, le_refl] + _ ≤ 2*K := by linarith + · let z : unitary ℂ := selfAdjoint.expUnitary ⟨-(l 0), hre.neg⟩ + refine ⟨z,?_⟩ + have he : NormedSpace.exp ((Complex.I * (-(l 0))) • (1 : A)) = (z : ℂ) • (1 : A) := by + rw [← Algebra.algebraMap_eq_smul_one, ← NormedSpace.algebraMap_exp_comm] + exact Algebra.algebraMap_eq_smul_one _ + rw [hk] + have hs : Complex.I • (value C l - (l 0) • (1 : A)) = + (Complex.I * (-(l 0))) • (1 : A) + Complex.I • value C l := by module + rw [hs, NormedSpace.exp_add_of_commute, he, smul_mul_assoc, one_mul] + exact (Commute.one_left (Complex.I • value C l)).smul_left _ + +end FreeGroupFactorMain.LaurentApprox + +namespace FreeGroupFactorMain +variable {G : Type uG} [Group G] + +theorem haar_centered_laurent (C : unitary (groupVonNeumann G)) + (hτ : ∀ m : ℤ, canonicalTrace ((C^m : unitary (groupVonNeumann G)) : groupVonNeumann G) = + if m = 0 then 1 else 0) {ε : ℝ} (hε : 0 < ε) : + ∃ k : ℤ →₀ ℂ, k 0 = 0 ∧ IsSelfAdjoint (LaurentApprox.value C k) ∧ + ‖LaurentApprox.value C k‖ ≤ 2*(Real.pi+1) ∧ ∃ z : unitary ℂ, + twoNorm (NormedSpace.exp (Complex.I • LaurentApprox.value C k) - (z : ℂ) • (C : groupVonNeumann G)) < ε := by + obtain ⟨S,hSm,hSsa,hSn,hSe⟩ := haar_approx_log C hτ (half_pos hε) + obtain ⟨l,hlS,hln,hle⟩ := LaurentApprox.approx_selfAdjoint_exp C hSm hSsa (half_pos hε) + obtain ⟨k,hk0,hkS,hkn,z,hze⟩ := LaurentApprox.center C canonicalTraceContinuous hτ + canonicalTrace_star norm_canonicalTrace_le l hlS (Real.pi+1) (hln.trans (by linarith)) + refine ⟨k,hk0,hkS,hkn,z,?_⟩ + have hsmul : (z : ℂ) • + (NormedSpace.exp (Complex.I • LaurentApprox.value C l) - (C : groupVonNeumann G)) = + (z : ℂ) • NormedSpace.exp (Complex.I • LaurentApprox.value C l) - + (z : ℂ) • (C : groupVonNeumann G) := + smul_sub (z : ℂ) (NormedSpace.exp (Complex.I • LaurentApprox.value C l)) + (C : groupVonNeumann G) + rw [hze, ← hsmul] + change ‖groupL2 ((z : ℂ) • _)‖ < ε + rw [map_smul, norm_smul, CStarRing.norm_coe_unitary, one_mul] + have he : NormedSpace.exp (Complex.I • LaurentApprox.value C l) - (C : groupVonNeumann G) = + (NormedSpace.exp (Complex.I • LaurentApprox.value C l) - NormedSpace.exp (Complex.I • S)) + + (NormedSpace.exp (Complex.I • S) - (C : groupVonNeumann G)) := by abel + rw [he, map_add] + have ht := norm_add_le (groupL2 (NormedSpace.exp (Complex.I • LaurentApprox.value C l) - NormedSpace.exp (Complex.I • S))) + (groupL2 (NormedSpace.exp (Complex.I • S) - (C : groupVonNeumann G))) + have hb := twoNorm_le_norm (NormedSpace.exp (Complex.I • LaurentApprox.value C l) - NormedSpace.exp (Complex.I • S)) + change ‖groupL2 (NormedSpace.exp (Complex.I • S) - (C : groupVonNeumann G))‖ < ε/2 at hSe + linarith + +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/LocalAutomorphism.lean b/lean/OAI/Analysis/FreeGroupFactor/LocalAutomorphism.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cbd232d322861f13da44c5ea45f319244f53762 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/LocalAutomorphism.lean @@ -0,0 +1,275 @@ +import OAI.Analysis.FreeGroupFactor.Nielsen + +namespace OAI + +noncomputable section + +universe uA uG uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +namespace FreeGroupFactorMain.Generation +variable {A : Type uA} [CStarAlgebra A] {ι : Type uι} + +def word (U : ι → unitary A) : FreeGroup ι →* A := + (unitary A).subtype.comp (FreeGroup.lift U) + +@[simp] theorem word_of (U : ι → unitary A) (i : ι) : word U (FreeGroup.of i) = (U i : A) := by + simp [word] + +@[simp] theorem word_inv (U : ι → unitary A) (g : FreeGroup ι) : + word U g⁻¹ = star (word U g) := by + change ((FreeGroup.lift U g⁻¹ : unitary A) : A) = _ + rw [map_inv] + rfl + +@[fun_prop] theorem word_continuous (g : FreeGroup ι) : Continuous (fun U : ι → unitary A => word U g) := by + induction g using FreeGroup.induction_on with + | one => simpa only [map_one] using (continuous_const : Continuous (fun _ : ι → unitary A => (1 : A))) + | of i => + simp only [word_of] + exact continuous_subtype_val.comp (continuous_apply i) + | inv_of i ih => simpa only [word_inv] using ih.star + | mul g h hg hh => + simp only [map_mul] + exact hg.mul hh + +def poly (U : ι → unitary A) (p : FreeGroup ι →₀ ℂ) : A := p.sum (fun g c => c • word U g) + +@[simp] theorem poly_zero (U : ι → unitary A) : poly U 0 = 0 := by simp [poly] +@[simp] theorem poly_add (U : ι → unitary A) (p q : FreeGroup ι →₀ ℂ) : + poly U (p+q) = poly U p + poly U q := + (Finsupp.linearCombination ℂ (word U)).map_add p q +@[simp] theorem poly_single (U : ι → unitary A) (g : FreeGroup ι) (c : ℂ) : + poly U (Finsupp.single g c) = c • word U g := by simp [poly] + +@[fun_prop] theorem poly_continuous (p : FreeGroup ι →₀ ℂ) : Continuous (fun U : ι → unitary A => poly U p) := by + classical + unfold poly Finsupp.sum + exact continuous_finsetSum _ (fun g _ => (word_continuous g).const_smul _) + +variable {G : Type uG} [Group G] + +@[simp] theorem twoNorm_zero : twoNorm (0 : groupVonNeumann G) = 0 := by + simp [twoNorm] + +theorem twoNorm_add_le (x y : groupVonNeumann G) : twoNorm (x+y) ≤ twoNorm x + twoNorm y := by + change ‖groupL2 (x+y)‖ ≤ _ + rw [map_add] + exact norm_add_le _ _ + +theorem twoNorm_smul (c : ℂ) (x : groupVonNeumann G) : twoNorm (c • x) = ‖c‖ * twoNorm x := by + change ‖groupL2 (c • x)‖ = _ + rw [map_smul, norm_smul] + +theorem twoNorm_mul_sub_le (U V U' V' : unitary (groupVonNeumann G)) : + twoNorm ((U : groupVonNeumann G)*(V : groupVonNeumann G)- + (U' : groupVonNeumann G)*(V' : groupVonNeumann G)) ≤ + twoNorm ((U : groupVonNeumann G)-(U' : groupVonNeumann G)) + + twoNorm ((V : groupVonNeumann G)-(V' : groupVonNeumann G)) := by + have he : (U : groupVonNeumann G)*(V : groupVonNeumann G)- + (U' : groupVonNeumann G)*(V' : groupVonNeumann G) = + ((U : groupVonNeumann G)-(U' : groupVonNeumann G))*(V : groupVonNeumann G) + + (U' : groupVonNeumann G)*((V : groupVonNeumann G)-(V' : groupVonNeumann G)) := by noncomm_ring + rw [he] + exact (twoNorm_add_le _ _).trans_eq (by rw [twoNorm_mul_unitary_right, twoNorm_mul_unitary_left]) + +theorem word_twoNorm_bound (g : FreeGroup ι) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (U V : ι → unitary (groupVonNeumann G)) (δ : ℝ), 0 ≤ δ → + (∀ j, twoNorm ((U j : groupVonNeumann G)-(V j : groupVonNeumann G)) ≤ δ) → + twoNorm (word U g-word V g) ≤ K*δ := by + induction g using FreeGroup.induction_on with + | one => + refine ⟨0,le_rfl,?_⟩ + intro U V δ _hδ _hUV + simp only [map_one, sub_self, twoNorm_zero, zero_mul, le_refl] + | of j => + refine ⟨1,by norm_num,?_⟩ + intro U V δ _hδ hUV + simpa only [word_of,one_mul] using hUV j + | inv_of j ih => + obtain ⟨K,hK,hb⟩ := ih + refine ⟨K,hK,?_⟩ + intro U V δ hδ hUV + rw [word_inv, word_inv, ← star_sub, twoNorm_star] + exact hb U V δ hδ hUV + | mul g h hg hh => + obtain ⟨K,hK,hb⟩ := hg + obtain ⟨L,hL,hl⟩ := hh + refine ⟨K+L,add_nonneg hK hL,?_⟩ + intro U V δ hδ hUV + rw [map_mul,map_mul] + exact (twoNorm_mul_sub_le (FreeGroup.lift U g) (FreeGroup.lift U h) + (FreeGroup.lift V g) (FreeGroup.lift V h)).trans + (by simpa only [add_mul, word, MonoidHom.comp_apply, Submonoid.subtype_apply] using add_le_add (hb U V δ hδ hUV) (hl U V δ hδ hUV)) + +theorem poly_twoNorm_bound (p : FreeGroup ι →₀ ℂ) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (U V : ι → unitary (groupVonNeumann G)) (δ : ℝ), 0 ≤ δ → + (∀ j, twoNorm ((U j : groupVonNeumann G)-(V j : groupVonNeumann G)) ≤ δ) → + twoNorm (poly U p-poly V p) ≤ K*δ := by + induction p using Finsupp.induction_linear with + | zero => + refine ⟨0,le_rfl,?_⟩ + intro U V δ _hδ _hUV + simp only [poly_zero,sub_self,twoNorm_zero,zero_mul,le_refl] + | add p q ihp ihq => + obtain ⟨K,hK,hb⟩ := ihp + obtain ⟨L,hL,hl⟩ := ihq + refine ⟨K+L,add_nonneg hK hL,?_⟩ + intro U V δ hδ hUV + simp only [poly_add] + have he : poly U p+poly U q-(poly V p+poly V q) = + (poly U p-poly V p)+(poly U q-poly V q) := by abel + rw [he] + exact (twoNorm_add_le _ _).trans (by + simpa only [add_mul] using add_le_add (hb U V δ hδ hUV) (hl U V δ hδ hUV)) + | single g c => + obtain ⟨K,hK,hb⟩ := word_twoNorm_bound (G := G) g + refine ⟨‖c‖*K,mul_nonneg (norm_nonneg _) hK,?_⟩ + intro U V δ hδ hUV + simp only [poly_single,← smul_sub,twoNorm_smul] + exact (mul_le_mul_of_nonneg_left (hb U V δ hδ hUV) (norm_nonneg c)).trans_eq (mul_assoc _ _ _).symm + +end FreeGroupFactorMain.Generation + +namespace FreeGroupFactorMain +open UnitaryEvaluation + +@[simp] theorem generator_haar {ι : Type uι} (i : ι) (m : ℤ) : + canonicalTrace (((generatorUnitary i)^m : unitary (groupVonNeumann (FreeGroup ι))) : groupVonNeumann (FreeGroup ι)) = + if m = 0 then 1 else 0 := by + classical + have hz : (((generatorUnitary i)^m : unitary (groupVonNeumann (FreeGroup ι))) : groupVonNeumann (FreeGroup ι)) = + groupUnitary ((FreeGroup.of i)^m) := + congrArg Subtype.val ((groupUnitaryUHom (FreeGroup ι)).map_zpow (FreeGroup.of i) m).symm + rw [hz,canonicalTrace_groupUnitary] + have hi : (FreeGroup.of i)^m = 1 ↔ m = 0 := by + constructor + · intro h + have he := congrArg (FreeGroup.lift (fun _ : ι => Multiplicative.ofAdd (1 : ℤ))) h + simp only [map_zpow,FreeGroup.lift_apply_of,map_one] at he + simpa using congrArg Multiplicative.toAdd he + · rintro rfl; simp + simp only [hi] + +theorem trace_symm {G : Type uG} [Group G] + (γ : groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann G) + (ht : ∀ T, canonicalTrace (γ T) = canonicalTrace T) (T : groupVonNeumann G) : + canonicalTrace (γ.symm T) = canonicalTrace T := by + simpa only [γ.apply_symm_apply] using (ht (γ.symm T)).symm + +theorem norm_symm_sub {A : Type uA} [CStarAlgebra A] + (γ : A ≃⋆ₐ[ℂ] A) (X Y : A) : ‖γ.symm X - Y‖ = ‖X - γ Y‖ := by + have he : γ.symm (X - γ Y) = γ.symm X - Y := by simp only [map_sub,γ.symm_apply_apply] + rw [← he,StarAlgEquiv.norm_map] + +theorem twoNorm_symm_sub {G : Type uG} [Group G] + (γ : groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann G) + (ht : ∀ T, canonicalTrace (γ T) = canonicalTrace T) (X Y : groupVonNeumann G) : + twoNorm (γ.symm X-Y) = twoNorm (X-γ Y) := by + have he : γ.symm (X-γ Y) = γ.symm X-Y := by simp only [map_sub,γ.symm_apply_apply] + rw [← he,twoNorm_iso γ.symm (trace_symm γ ht)] + +theorem laurentValue_eq_value {A : Type uA} [CStarAlgebra A] (C : unitary A) (l : ℤ →₀ ℂ) : + laurentValue C l = LaurentApprox.value C l := rfl + +theorem firstCoefficients_norm_le {n : ℕ} (h : Coeff (FreeGroup (Fin n))) (j : Fin n) : + coefficientNorm (firstCoefficients h j) ≤ coefficientNorm h := by + unfold firstCoefficients + split_ifs + · exact le_rfl + · simp only [coefficientNorm,Finsupp.sum_zero_index,Real.sqrt_zero] + exact Real.sqrt_nonneg _ + +theorem one_step_generator_estimate {G : Type uG} [Group G] + (β γ : groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann G) + (A : groupVonNeumann G) (hγ : γ A = A) + {K ε c : ℝ} (hK : 0 < K) (hε : 0 < ε) + (hb : ‖β A-A‖ ≤ 3*K*c) (hc : c < (ε/2)/(3*K)) : + ‖γ.symm (β A)-A‖ < ε := by + rw [norm_symm_sub,hγ] + have hd := (lt_div_iff₀ (by positivity : 0 < 3*K)).mp hc + nlinarith + +theorem one_step_word_estimate {G : Type uG} [Group G] + (β γ : groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann G) + (hγt : ∀ T, canonicalTrace (γ T) = canonicalTrace T) + (C W : unitary (groupVonNeumann G)) (E : groupVonNeumann G) (z : unitary ℂ) + (hγC : γ (C : groupVonNeumann G) = (z : ℂ) • ((C : groupVonNeumann G)*(W : groupVonNeumann G))) + {K ε c : ℝ} (hK : 0 < K) + (hb : ‖β (W : groupVonNeumann G)-E*(W : groupVonNeumann G)‖ ≤ 3*K*c) + (hc : c < (ε/2)/(3*K)) (hze : twoNorm (E-(z : ℂ) • (C : groupVonNeumann G)) < ε/2) : + twoNorm (γ.symm (β (W : groupVonNeumann G))-(C : groupVonNeumann G)) < ε := by + rw [twoNorm_symm_sub γ hγt,hγC] + have he : β (W : groupVonNeumann G) - (z : ℂ) • ((C : groupVonNeumann G)*(W : groupVonNeumann G)) = + (β (W : groupVonNeumann G)-E*(W : groupVonNeumann G)) + + (E-(z : ℂ) • (C : groupVonNeumann G))*(W : groupVonNeumann G) := by + simp only [sub_mul,smul_mul_assoc] + abel + rw [he] + have ht := Generation.twoNorm_add_le + (β (W : groupVonNeumann G)-E*(W : groupVonNeumann G)) + ((E-(z : ℂ) • (C : groupVonNeumann G))*(W : groupVonNeumann G)) + rw [twoNorm_mul_unitary_right] at ht + have hle := twoNorm_le_norm (β (W : groupVonNeumann G)-E*(W : groupVonNeumann G)) + have hd := (lt_div_iff₀ (by positivity : 0 < 3*K)).mp hc + nlinarith + +theorem one_step_from_laurent (n : ℕ) {ε : ℝ} (hε : 0 < ε) + (l : ℤ →₀ ℂ) (hl0 : l 0 = 0) + (hlS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option (Fin n))) l)) + (hln : ‖laurentValue (generatorUnitary (none : Option (Fin n))) l‖ ≤ 2*(Real.pi+1)) + (z : unitary ℂ) (hze : twoNorm (NormedSpace.exp (Complex.I • laurentValue + (generatorUnitary (none : Option (Fin n))) l) - (z : ℂ) • groupUnitary (FreeGroup.of none)) < ε/2) + (w : FreeGroup (Fin n)) (h : Coeff (FreeGroup (Fin n))) + (hh : coefficientNorm h < (ε/2)/(3*(2*(Real.pi+1)))) + (hw : coefficientNorm (freeCocycle (firstCoefficients h) w-Finsupp.single 1 1) < + (ε/2)/(3*(2*(Real.pi+1)))) : + ∃ α : groupVonNeumann (FreeGroup (Option (Fin n))) ≃⋆ₐ[ℂ] groupVonNeumann (FreeGroup (Option (Fin n))), + (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option (Fin n)))) + (groupUltraweakTopology (FreeGroup (Option (Fin n)))) α ∧ + ∃ w : FreeGroup (Fin n), + (∀ j : Fin n, ‖α (groupUnitary (FreeGroup.of (some j))) - groupUnitary (FreeGroup.of (some j))‖ < ε) ∧ + twoNorm (α (groupUnitary (FreeGroup.map Option.some w)) - groupUnitary (FreeGroup.of none)) < ε := by + let K : ℝ := 2*(Real.pi+1) + have hK : 0 < K := by dsimp [K]; positivity + obtain ⟨β,hβt,hβn,_hβC,hβgen,hβword⟩ := + laurent_flow_displacement (ι := Fin n) (firstCoefficients h) l hl0 hlS K hK.le hln + obtain ⟨γ,hγt,_hγn,hγi,hγgen,hγC⟩ := gauged_nielsen_iso (ι := Fin n) w z + have hnormal : @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option (Fin n)))) + (groupUltraweakTopology (FreeGroup (Option (Fin n)))) (β.trans γ.symm) := by + let : TopologicalSpace (groupVonNeumann (FreeGroup (Option (Fin n)))) := + groupUltraweakTopology (FreeGroup (Option (Fin n))) + exact hγi.comp hβn + refine ⟨β.trans γ.symm,?_,hnormal,w,?_,?_⟩ + · intro T + change canonicalTrace (γ.symm (β T)) = canonicalTrace T + rw [trace_symm γ hγt,hβt] + · intro j + exact one_step_generator_estimate (G := FreeGroup (Option (Fin n))) β γ _ (hγgen j) hK hε (hβgen j) + ((firstCoefficients_norm_le h j).trans_lt hh) + · exact one_step_word_estimate (G := FreeGroup (Option (Fin n))) β γ hγt (generatorUnitary (none : Option (Fin n))) + (groupUnitaryUHom (FreeGroup (Option (Fin n))) (FreeGroup.map Option.some w)) + _ z hγC hK (hβword w) hw hze + +theorem one_step (n : ℕ) (hn : 3 ≤ n) {ε : ℝ} (hε : 0 < ε) : + ∃ α : groupVonNeumann (FreeGroup (Option (Fin n))) ≃⋆ₐ[ℂ] groupVonNeumann (FreeGroup (Option (Fin n))), + (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option (Fin n)))) + (groupUltraweakTopology (FreeGroup (Option (Fin n)))) α ∧ + ∃ w : FreeGroup (Fin n), + (∀ j : Fin n, ‖α (groupUnitary (FreeGroup.of (some j))) - groupUnitary (FreeGroup.of (some j))‖ < ε) ∧ + twoNorm (α (groupUnitary (FreeGroup.map Option.some w)) - groupUnitary (FreeGroup.of none)) < ε := by + obtain ⟨l,hl0,hlS,hln,z,hze⟩ := haar_centered_laurent (G := FreeGroup (Option (Fin n))) + (generatorUnitary (none : Option (Fin n))) (generator_haar (none : Option (Fin n))) (half_pos hε) + rw [← laurentValue_eq_value] at hlS hln hze + obtain ⟨w,h,hh,hw⟩ := smallCocycle n hn ((ε/2)/(3*(2*(Real.pi+1)))) (by positivity) + exact one_step_from_laurent n hε l hl0 hlS hln z hze w h hh hw + +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/Main.lean b/lean/OAI/Analysis/FreeGroupFactor/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a161cc2d20963743c8616f4f660c255deee0b27 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/Main.lean @@ -0,0 +1,64 @@ +import OAI.Analysis.FreeGroupFactor.InfiniteGeneration + +namespace OAI + +noncomputable section + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff ENNReal + +attribute [local instance] Classical.propDecidable + +namespace FreeGroupFactorMain + +namespace InfiniteGeneration + + theorem one_step_none (ε : ℝ) (hε : 0 < ε) : + ∃ α : M ≃⋆ₐ[ℂ] M, + (∀ T, canonicalTrace (α T) = canonicalTrace T) ∧ + (∀ k : ℕ, α (extra (some k) : M) = (extra (some k) : M)) ∧ + ∃ w : FreeGroup (Fin 3), + (∀ i, ‖α (initial i : M)-(initial i : M)‖ < ε) ∧ + twoNorm (α (Generation.word initial w)-(extra none : M)) < ε := by + obtain ⟨α,ht,hfix,w,hA,hw⟩ := FiniteActive.one_step (κ := ℕ) 3 (by rfl) hε + refine ⟨α,ht,hfix,w,hA,?_⟩ + rw [word_initial] + exact hw + + theorem generating_tuple : + ∃ U : Tuple, + (∀ g : FreeGroup (Fin 3), canonicalTrace (Generation.word U g) = if g = 1 then 1 else 0) ∧ + ⊤ ≤ (Submodule.span ℂ (Set.range (fun g => groupL2 (Generation.word U g)))).topologicalClosure := by + apply generating_haar_tuple + apply orbit_local_approximation + intro Φ ht s θ hθ + apply orbit_step _ Φ ht s hθ + intro s ε hε + apply finite_absorption _ s ε hε + intro q ε hε + exact one_step_extra_of_none one_step_none q hε + + theorem rank_three_to_index : HasNormalTracialIso (FreeGroupRank 3) Group := by + classical + obtain ⟨U,ht,htotal⟩ := generating_tuple + apply normalTracialIso_of_haar_total (Generation.word U) + · intro g + exact (Generation.word_inv U g).symm + · exact ht + · exact htotal + + def indexEquivNat : Index ≃ ℕ := by + letI : Denumerable Index := Denumerable.ofEncodableOfInfinite Index + exact Denumerable.eqv Index + +end InfiniteGeneration + +theorem rankThreeInfinite : HasNormalTracialIso (FreeGroupRank 3) (FreeGroup ℕ) := + InfiniteGeneration.rank_three_to_index.trans + (normalTracialIso_of_groupEquiv (FreeGroup.freeGroupCongr InfiniteGeneration.indexEquivNat)) + +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/Model.lean b/lean/OAI/Analysis/FreeGroupFactor/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..fac1791d2e613dd996c8cbd9d7a444e8e8cd52ce --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/Model.lean @@ -0,0 +1,231 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace FreeGroupFactorMain + +universe u uG + +open scoped ENNReal + +abbrev GroupHilbert (G : Type u) := lp (fun _ : G => ℂ) 2 +abbrev GroupOperator (G : Type u) := GroupHilbert G →L[ℂ] GroupHilbert G + +def leftTranslations (G : Type u) [Group G] : Set (GroupOperator G) := + {T | ∃ g : G, ∀ (ξ : GroupHilbert G) (h : G), (T ξ) h = ξ (g⁻¹ * h)} + +def groupVonNeumann (G : Type u) [Group G] : StarSubalgebra ℂ (GroupOperator G) := + StarSubalgebra.centralizer ℂ + (StarSubalgebra.centralizer ℂ (leftTranslations G) : Set (GroupOperator G)) + +def canonicalTrace {G : Type u} [Group G] (T : groupVonNeumann G) : ℂ := by + classical + exact ((T : GroupOperator G) (lp.single 2 (1 : G) (1 : ℂ))) 1 + +@[instance_reducible] def ultraweakOperatorTopology (G : Type u) : TopologicalSpace (GroupOperator G) := + ⨅ (ξ : lp (fun _ : ℕ => GroupHilbert G) 2) + (η : lp (fun _ : ℕ => GroupHilbert G) 2), + TopologicalSpace.induced + (fun T : GroupOperator G => ∑' k : ℕ, inner ℂ (η k) (T (ξ k))) + inferInstance + +@[instance_reducible] def groupUltraweakTopology (G : Type u) [Group G] : + TopologicalSpace (groupVonNeumann G) := + TopologicalSpace.induced (fun T : groupVonNeumann G => (T : GroupOperator G)) + (ultraweakOperatorTopology G) + +abbrev FreeGroupRank (n : ℕ) := FreeGroup (Fin n) + +instance groupVN_isClosed (G : Type uG) [Group G] : + IsClosed (groupVonNeumann G : Set (GroupOperator G)) := by + unfold groupVonNeumann + rw [StarSubalgebra.coe_centralizer] + exact Set.isClosed_centralizer _ + +instance groupVN_CStarAlgebra (G : Type uG) [Group G] : + CStarAlgebra (groupVonNeumann G) := inferInstance + +end FreeGroupFactorMain + +universe u_1 u_2 u_3 u_4 u_5 u_6 u_7 u_8 u_9 u_10 u_11 u_42 u_43 + +namespace FreeGroupFactorMain.Amplification + +open scoped ENNReal + +section +variable {A : Type u_1} {B : Type u_2} [CStarAlgebra A] [CStarAlgebra B] + +def cornerSubalgebra (p : A) (hp : IsStarProjection p) : NonUnitalStarSubalgebra ℂ A where + carrier := {x | p*x=x ∧ x*p=x} + zero_mem' := by simp + add_mem' hx hy := by constructor <;> simp [mul_add,add_mul,hx.1,hx.2,hy.1,hy.2] + mul_mem' hx hy := by + constructor + · rw [← mul_assoc,hx.1] + · rw [mul_assoc,hy.2] + smul_mem' c x hx := by + constructor + · rw [mul_smul_comm,hx.1] + · rw [smul_mul_assoc,hx.2] + star_mem' hx := by + constructor + · simpa only [star_mul,hp.isSelfAdjoint.star_eq] using congrArg star hx.2 + · simpa only [star_mul,hp.isSelfAdjoint.star_eq] using congrArg star hx.1 + +abbrev Corner (p : A) (hp : IsStarProjection p) := ↥(cornerSubalgebra p hp) + +instance cornerClosed (p : A) (hp : IsStarProjection p) : + IsClosed (cornerSubalgebra p hp : Set A) := + (isClosed_eq (continuous_const.mul continuous_id) continuous_id).inter + (isClosed_eq (continuous_id.mul continuous_const) continuous_id) + +instance cornerSemiring (p : A) (hp : IsStarProjection p) : Semiring (Corner p hp) where + __ : NonUnitalSemiring (Corner p hp) := inferInstance + one := ⟨p,hp.isIdempotentElem.eq,hp.isIdempotentElem.eq⟩ + one_mul x := Subtype.ext x.property.1 + mul_one x := Subtype.ext x.property.2 + +instance cornerRing (p : A) (hp : IsStarProjection p) : Ring (Corner p hp) where + __ : Semiring (Corner p hp) := inferInstance + __ : NonUnitalRing (Corner p hp) := inferInstance + +instance cornerAlgebra (p : A) (hp : IsStarProjection p) : Algebra ℂ (Corner p hp) := + Algebra.ofModule smul_mul_assoc mul_smul_comm + +instance cornerNormedRing (p : A) (hp : IsStarProjection p) : NormedRing (Corner p hp) where + __ : Ring (Corner p hp) := inferInstance + __ : NonUnitalNormedRing (Corner p hp) := inferInstance + +instance cornerCStarAlgebra (p : A) (hp : IsStarProjection p) : CStarAlgebra (Corner p hp) where + __ : NonUnitalCStarAlgebra (Corner p hp) := inferInstance + __ : NormedRing (Corner p hp) := inferInstance + __ : Algebra ℂ (Corner p hp) := inferInstance + norm_smul_le := norm_smul_le + +end + +section +variable {A : Type u_3} {B : Type u_4} [CStarAlgebra A] [CStarAlgebra B] + +@[instance_reducible] def cornerTopology (𝒯 : TopologicalSpace A) + (p : A) (hp : IsStarProjection p) : TopologicalSpace (Corner p hp) := + TopologicalSpace.induced (fun x : Corner p hp => (x : A)) 𝒯 + +def normalizedCornerTrace (τ : A → ℂ) (t : ℝ) (p : A) (hp : IsStarProjection p) + (x : Corner p hp) : ℂ := (t : ℂ)⁻¹ * τ x + +end + +def stabilizedRightTranslations (G : Type u_5) [Group G] : Set (GroupOperator (ℕ × G)) := + {T | ∃ g : G, ∀ (ξ : GroupHilbert (ℕ × G)) (x : ℕ × G), + T ξ x = ξ (x.1,x.2*g)} + +def stabilization (G : Type u_6) [Group G] : StarSubalgebra ℂ (GroupOperator (ℕ × G)) := + StarSubalgebra.centralizer ℂ (stabilizedRightTranslations G) + +instance stabilization_isClosed (G : Type u_7) [Group G] : + IsClosed (stabilization G : Set (GroupOperator (ℕ × G))) := by + rw [stabilization,StarSubalgebra.coe_centralizer] + exact Set.isClosed_centralizer _ + +instance stabilization_CStarAlgebra (G : Type u_8) [Group G] : CStarAlgebra (stabilization G) := + inferInstance + +def stabilizedProjectionTrace {G : Type u_9} [Group G] (p : stabilization G) : ℝ≥0∞ := by + classical + exact ∑' k : ℕ, ENNReal.ofReal (‖(p : GroupOperator (ℕ × G)) + (lp.single 2 (k,1) (1 : ℂ))‖ ^ 2) + +def stabilizedTrace {G : Type u_10} [Group G] (T : stabilization G) : ℂ := by + classical + exact ∑' k : ℕ, inner ℂ (lp.single 2 (k,1) (1 : ℂ)) + ((T : GroupOperator (ℕ × G)) (lp.single 2 (k,1) (1 : ℂ))) + +@[instance_reducible] def stabilizationTopology (G : Type u_11) [Group G] : + TopologicalSpace (stabilization G) := + TopologicalSpace.induced (fun T : stabilization G => (T : GroupOperator (ℕ × G))) + (ultraweakOperatorTopology (ℕ × G)) + +section +variable {A : Type u_42} {B : Type u_43} [CStarAlgebra A] [CStarAlgebra B] + +structure NormalTracialEquiv (τA : A → ℂ) (τB : B → ℂ) + (𝒯A : TopologicalSpace A) (𝒯B : TopologicalSpace B) where + equiv : A ≃⋆ₐ[ℂ] B + trace_eq : ∀x,τB (equiv x)=τA x + normal : @Continuous _ _ 𝒯A 𝒯B equiv + inverse_normal : @Continuous _ _ 𝒯B 𝒯A equiv.symm + +end + +end FreeGroupFactorMain.Amplification + +namespace FreeGroupFactorMain.Interpolation + +open Amplification +open scoped ENNReal + +abbrev RankTwoProjection := {p : stabilization (FreeGroupRank 2) // IsStarProjection p} + +instance rankTwoProjectionInhabited : Inhabited RankTwoProjection := + ⟨⟨0,IsStarProjection.zero _⟩⟩ + +def selectedProjection (a : ℝ) : RankTwoProjection := + Classical.epsilon (fun p : RankTwoProjection => stabilizedProjectionTrace p.val=ENNReal.ofReal a) + +def interpolationScale (r : ℝ) : ℝ := (Real.sqrt (r-1))⁻¹ + +inductive Model where + | integer (n : ℕ) + | continuous (r : ℝ) + | infinity + +def Model.Algebra : Model → Type + | .integer n => groupVonNeumann (FreeGroupRank n) + | .continuous r => Corner (selectedProjection (interpolationScale r)).val + (selectedProjection (interpolationScale r)).property + | .infinity => groupVonNeumann (FreeGroup ℕ) + +instance modelCStarAlgebra (m : Model) : CStarAlgebra m.Algebra := by + cases m <;> dsimp only [Model.Algebra] <;> infer_instance + +def Model.trace : (m : Model) → m.Algebra → ℂ + | .integer _ => canonicalTrace + | .continuous r => normalizedCornerTrace stabilizedTrace (interpolationScale r) + (selectedProjection (interpolationScale r)).val (selectedProjection (interpolationScale r)).property + | .infinity => canonicalTrace + +@[instance_reducible] def Model.topology : (m : Model) → TopologicalSpace m.Algebra + | .integer n => groupUltraweakTopology (FreeGroupRank n) + | .continuous r => cornerTopology (stabilizationTopology (FreeGroupRank 2)) + (selectedProjection (interpolationScale r)).val (selectedProjection (interpolationScale r)).property + | .infinity => groupUltraweakTopology (FreeGroup ℕ) + +def parameterModel (r : ℝ≥0∞) : Model := by + classical + exact if r=⊤ then .infinity else + if h : ∃n : ℕ,r=(n:ℝ≥0∞) then .integer h.choose else .continuous r.toReal + +abbrev InterpolatedFactor (r : ℝ≥0∞) := (parameterModel r).Algebra +abbrev interpolatedTrace (r : ℝ≥0∞) := (parameterModel r).trace +abbrev interpolatedTopology (r : ℝ≥0∞) := (parameterModel r).topology + +end FreeGroupFactorMain.Interpolation + +namespace FreeGroupFactorMain + +universe u v + +def HasNormalTracialIso (G : Type u) (H : Type v) [Group G] [Group H] : Prop := + ∃ Φ : groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann H, + (∀ T, canonicalTrace (Φ T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology G) (groupUltraweakTopology H) Φ + +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/MomentFlow.lean b/lean/OAI/Analysis/FreeGroupFactor/MomentFlow.lean new file mode 100644 index 0000000000000000000000000000000000000000..24c8d2ba8ce075a7a7f4d99c26111a673ad93bf5 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/MomentFlow.lean @@ -0,0 +1,293 @@ +import OAI.Analysis.FreeGroupFactor.Operators + +namespace OAI + +noncomputable section + +universe uA uG uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +namespace FreeGroupFactorMain + +instance groupVN_normedSpaceReal (G : Type uG) [Group G] : + NormedSpace ℝ (groupVonNeumann G) := + NormedSpace.restrictScalars ℝ ℂ (groupVonNeumann G) + + instance groupHilbert_nontrivial (G : Type uG) [Group G] : Nontrivial (GroupHilbert G) := by + classical + apply nontrivial_of_ne (lp.single 2 (1 : G) (1 : ℂ)) 0 + intro he + have hh := congrArg (fun x : GroupHilbert G => x 1) he + simp at hh + + instance groupVN_normOneClass (G : Type uG) [Group G] : NormOneClass (groupVonNeumann G) where + norm_one := by + change ‖(1 : GroupOperator G)‖ = 1 + exact norm_one + + def groupUnitaryHom (G : Type uG) [Group G] : G →* groupVonNeumann G where + toFun := groupUnitary + map_one' := Subtype.ext (leftRegular_one) + map_mul' g b := Subtype.ext (leftRegular_mul g b) + + def groupAlgebraEvaluation (G : Type uG) [Group G] : + MonoidAlgebra ℂ G →ₐ[ℂ] groupVonNeumann G := + MonoidAlgebra.lift ℂ (groupVonNeumann G) G (groupUnitaryHom G) + + @[simp] theorem groupAlgebraEvaluation_of {G : Type uG} [Group G] (g : G) : + groupAlgebraEvaluation G (MonoidAlgebra.of ℂ G g) = groupUnitary g := by + simp [groupAlgebraEvaluation, groupUnitaryHom] + + theorem canonicalTrace_groupAlgebraEvaluation {G : Type uG} [Group G] [DecidableEq G] + (p : MonoidAlgebra ℂ G) : canonicalTrace (groupAlgebraEvaluation G p) = p.coeff 1 := by + induction p using MonoidAlgebra.induction_on with + | of g => + rw [groupAlgebraEvaluation_of, canonicalTrace_groupUnitary] + simp only [MonoidAlgebra.of_apply, MonoidAlgebra.coeff_single, Finsupp.single_apply] + | add p q hp hq => + change canonicalTraceCLM (groupAlgebraEvaluation G (p + q)) = _ + simp only [map_add, canonicalTraceCLM_apply, hp, hq, MonoidAlgebra.coeff_add, + Finsupp.add_apply] + | smul c p hp => + change canonicalTraceCLM (groupAlgebraEvaluation G (c • p)) = _ + simp only [map_smul, canonicalTraceCLM_apply, hp, MonoidAlgebra.coeff_smul, + Finsupp.smul_apply] + + theorem canonicalTrace_eval {ι : Type uι} [DecidableEq ι] + (p : NCPolynomial.Expr (ι × Bool)) : + canonicalTrace (NCPolynomial.eval (fun ib => groupUnitary (AlgebraPolynomial.signed ib)) p) = + (NCPolynomial.eval (fun ib => MonoidAlgebra.of ℂ (FreeGroup ι) + (AlgebraPolynomial.signed ib)) p).coeff 1 := by + rw [← canonicalTrace_groupAlgebraEvaluation] + congr 1 + rw [AlgebraPolynomial.map_eval] + congr 1 + funext ib + exact (groupAlgebraEvaluation_of _).symm + +theorem source_laurent_moments {ι : Type uι} [Fintype ι] [DecidableEq ι] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (Y : ℝ → (Option ι × Bool) → groupVonNeumann (FreeGroup (Option ι))) + (hY₀ : ∀ ib, Y 0 ib = groupUnitary (AlgebraPolynomial.signed ib)) + (hsmooth : ∀ ib, ContDiff ℝ ∞ (fun t => Y t ib)) + (hbounded : ∀ t ib, ‖Y t ib‖ ≤ 1) + (hODE : ∀ t ib, HasDerivAt (fun s => Y s ib) + (NCPolynomial.eval (Y t) + (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) ib)) t) + (p : NCPolynomial.Expr (Option ι × Bool)) (t : ℝ) : + canonicalTrace (NCPolynomial.eval (Y t) p) = + canonicalTrace (NCPolynomial.eval (Y 0) p) := by + classical + let V := AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) + let J := Finset.univ.sup (fun ib => NCPolynomial.degree (V ib)) + let B := ∑ ib, NCPolynomial.mass (V ib) + have hB : 0 ≤ B := Finset.sum_nonneg fun _ _ => NCPolynomial.mass_nonneg _ + have hdeg (ib) : NCPolynomial.degree (V ib) ≤ J + 1 := by + exact (Finset.le_sup (f := fun ib => NCPolynomial.degree (V ib)) + (Finset.mem_univ ib)).trans (Nat.le_succ _) + have hmass (ib) : NCPolynomial.mass (V ib) ≤ B := + Finset.single_le_sum (fun i _ => NCPolynomial.mass_nonneg (V i)) (Finset.mem_univ ib) + have hinitial (q) : canonicalTrace (NCPolynomial.eval (Y 0) (NCPolynomial.delta V q)) = 0 := by + have hinit : Y 0 = fun ib => groupUnitary (AlgebraPolynomial.signed ib) := funext hY₀ + rw [hinit, canonicalTrace_eval] + exact AlgebraPolynomial.encoded_initial_trace h l q + have hreal (L : ℂ →L[ℝ] ℝ) : + L (canonicalTrace (NCPolynomial.eval (Y t) p)) = + L (canonicalTrace (NCPolynomial.eval (Y 0) p)) := by + let Lt := L.comp ((canonicalTraceCLM (G := FreeGroup (Option ι))).restrictScalars ℝ) + apply NCPolynomial.polynomial_moments Y V Lt hsmooth hODE 1 le_rfl hbounded + J B hB hdeg hmass + intro q + change L (canonicalTrace (NCPolynomial.eval (Y 0) (NCPolynomial.delta V q))) = 0 + rw [hinitial, map_zero] + exact Complex.ext (hreal Complex.reCLM) (hreal Complex.imCLM) + +end FreeGroupFactorMain + +namespace FreeGroupFactorMain.UnitaryEvaluation +open scoped ContDiff +variable {A : Type uA} [CStarAlgebra A] {ι : Type uι} + theorem norm_signedTrajectory_le_one [Nontrivial A] + (X : ℝ → ι → A) (hU : ∀ t j, X t j ∈ unitary A) + (C : unitary A) (t : ℝ) (ib : Option ι × Bool) : + ‖signedTrajectory X hU C t ib‖ ≤ 1 := by + change ‖((FreeGroup.lift (extendUnitary (fun j => ⟨X t j, hU t j⟩) C) + (AlgebraPolynomial.signed ib) : unitary A) : A)‖ ≤ 1 + exact (CStarRing.norm_of_mem_unitary (Subtype.property _)).le + + theorem smooth_signedTrajectory [Fintype ι] + (X : ℝ → ι → A) (hU : ∀ t j, X t j ∈ unitary A) + (C : unitary A) (hs : ContDiff ℝ ∞ X) (ib : Option ι × Bool) : + ContDiff ℝ ∞ (fun t => signedTrajectory X hU C t ib) := by + rcases ib with ⟨i,b⟩ + cases i with + | none => cases b <;> + simp only [signedTrajectory_none_pos, signedTrajectory_none_neg] <;> exact contDiff_const + | some j => cases b + · simp only [signedTrajectory_some_neg] + exact (starL ℝ (A := A)).contDiff.comp ((contDiff_apply ℝ A j).comp hs) + · simp only [signedTrajectory_some_pos] + exact (contDiff_apply ℝ A j).comp hs +end FreeGroupFactorMain.UnitaryEvaluation + +namespace FreeGroupFactorMain +open scoped ContDiff + + theorem groupUnitary_mem_unitary {G : Type uG} [Group G] (g : G) : + groupUnitary g ∈ unitary (groupVonNeumann G) := by + rw [Unitary.mem_iff] + constructor <;> apply Subtype.ext + · exact (Unitary.mem_iff.mp (leftRegular_unitary g)).1 + · exact (Unitary.mem_iff.mp (leftRegular_unitary g)).2 + + def generatorUnitary {ι : Type uι} (i : ι) : unitary (groupVonNeumann (FreeGroup ι)) := + ⟨groupUnitary (FreeGroup.of i), groupUnitary_mem_unitary _⟩ + + theorem wordHom_generatorUnitary {ι : Type uι} (g : FreeGroup ι) : + UnitaryEvaluation.wordHom generatorUnitary g = groupUnitary g := by + have he : UnitaryEvaluation.wordHom (generatorUnitary (ι := ι)) = + groupUnitaryHom (FreeGroup ι) := by + apply FreeGroup.ext_hom + intro i + rfl + exact DFunLike.congr_fun he g + + theorem laurent_flow_moments {ι : Type uι} [Fintype ι] [DecidableEq ι] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (UnitaryEvaluation.laurentValue + (generatorUnitary (none : Option ι)) l)) + (X : ℝ → ι → groupVonNeumann (FreeGroup (Option ι))) + (hU : ∀ t j, X t j ∈ unitary (groupVonNeumann (FreeGroup (Option ι)))) + (hX₀ : X 0 = fun j => groupUnitary (FreeGroup.of (some j))) + (hX : ∀ t, HasDerivAt X (PolynomialFlow.field + (UnitaryEvaluation.laurentValue (generatorUnitary (none : Option ι)) l) h (X t)) t) : + ∀ t (g : FreeGroup (Option ι)), + canonicalTrace (UnitaryEvaluation.wordHom + (UnitaryEvaluation.extendUnitary (fun j => ⟨X t j, hU t j⟩) + (generatorUnitary none)) g) = if g = 1 then 1 else 0 := by + classical + let C : unitary (groupVonNeumann (FreeGroup (Option ι))) := generatorUnitary none + let S := UnitaryEvaluation.laurentValue C l + let Y := UnitaryEvaluation.signedTrajectory X hU C + have hu0 : UnitaryEvaluation.extendUnitary (fun j => ⟨X 0 j, hU 0 j⟩) C = + generatorUnitary := by + funext i + cases i with + | none => rfl + | some j => apply Subtype.ext; exact congrFun hX₀ j + have hY₀ (ib) : Y 0 ib = groupUnitary (AlgebraPolynomial.signed ib) := by + dsimp [Y, UnitaryEvaluation.signedTrajectory] + rw [hu0, wordHom_generatorUnitary] + have hsmooth (ib) : ContDiff ℝ ∞ (fun t => Y t ib) := + UnitaryEvaluation.smooth_signedTrajectory X hU C + (PolynomialFlow.smooth_solution S h X hX) ib + have hbounded (t ib) : ‖Y t ib‖ ≤ 1 := + UnitaryEvaluation.norm_signedTrajectory_le_one X hU C t ib + intro t g + let p := AlgebraPolynomial.encode (MonoidAlgebra.of ℂ (FreeGroup (Option ι)) g) + have hmoment := source_laurent_moments h l Y hY₀ hsmooth hbounded + (UnitaryEvaluation.signedTrajectory_ode C h l hS X hU hX) p t + have he (s) : NCPolynomial.eval (Y s) p = + UnitaryEvaluation.wordHom + (UnitaryEvaluation.extendUnitary (fun j => ⟨X s j, hU s j⟩) C) g := by + change NCPolynomial.eval (fun ib => UnitaryEvaluation.wordHom + (UnitaryEvaluation.extendUnitary (fun j => ⟨X s j, hU s j⟩) C) + (AlgebraPolynomial.signed ib)) (AlgebraPolynomial.encode + (MonoidAlgebra.of ℂ (FreeGroup (Option ι)) g)) = _ + rw [UnitaryEvaluation.eval_encode, UnitaryEvaluation.algebraHom_of] + rw [he, he, hu0, wordHom_generatorUnitary, canonicalTrace_groupUnitary] at hmoment + exact hmoment + + theorem actual_laurent_flow_moments {ι : Type uι} [Fintype ι] [DecidableEq ι] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (UnitaryEvaluation.laurentValue + (generatorUnitary (none : Option ι)) l)) : + ∃ (X : ℝ → ι → groupVonNeumann (FreeGroup (Option ι))) + (hU : ∀ t j, X t j ∈ unitary (groupVonNeumann (FreeGroup (Option ι)))), + X 0 = (fun j => groupUnitary (FreeGroup.of (some j))) ∧ + (∀ t, HasDerivAt X (PolynomialFlow.field + (UnitaryEvaluation.laurentValue (generatorUnitary (none : Option ι)) l) h (X t)) t) ∧ + ∀ t (g : FreeGroup (Option ι)), + canonicalTrace (UnitaryEvaluation.wordHom + (UnitaryEvaluation.extendUnitary (fun j => ⟨X t j, hU t j⟩) + (generatorUnitary none)) g) = if g = 1 then 1 else 0 := by + classical + let C : unitary (groupVonNeumann (FreeGroup (Option ι))) := generatorUnitary none + let S := UnitaryEvaluation.laurentValue C l + obtain ⟨X, hX₀, hX, hU⟩ := PolynomialFlow.global_unitary_solution S hS h + (fun j => groupUnitary (FreeGroup.of (some j))) (fun j => groupUnitary_mem_unitary _) + refine ⟨X,hU,hX₀,hX,?_⟩ + exact laurent_flow_moments h l hS X hU hX₀ hX + +end FreeGroupFactorMain + +namespace FreeGroupFactorMain.PolynomialFlow +variable {A : Type uA} [CStarAlgebra A] [Nontrivial A] +variable {ι : Type uι} [Fintype ι] [DecidableEq ι] + +omit [Nontrivial A] [Fintype ι] [DecidableEq ι] in +theorem coe_wordList (E : StarSubalgebra ℂ A) [IsClosed (E : Set A)] (w : List (ι × Bool)) (X : ι → E) : + ((wordList w X : E) : A) = wordList w (fun i => (X i : A)) := by + induction w with + | nil => rfl + | cons a w ih => + rcases a with ⟨i, b⟩ + cases b <;> simpa [wordList] using + congrArg (fun z : A => _ * z) ih + +omit [Nontrivial A] [Fintype ι] in +theorem coe_field (E : StarSubalgebra ℂ A) [IsClosed (E : Set A)] (S : E) + (h : ι → FreeGroup ι →₀ ℝ) (X : ι → E) (j : ι) : + ((field S h X j : E) : A) = field (S : A) h (fun i => (X i : A)) j := by + classical + simp [field, hamiltonian, Finsupp.sum, word, coe_wordList] + +theorem solution_mem_subalgebra (E : StarSubalgebra ℂ A) (hE : IsClosed (E : Set A)) + (S : A) (hS : IsSelfAdjoint S) (hSE : S ∈ E) (h : ι → FreeGroup ι →₀ ℝ) + (X : ℝ → ι → A) (hX : ∀ t, HasDerivAt X (field S h (X t)) t) + (hU : ∀ t j, X t j ∈ unitary A) (t₀ : ℝ) (h₀ : ∀ j, X t₀ j ∈ E) : + ∀ t j, X t j ∈ E := by + let : IsClosed (E : Set A) := hE + let S' : E := ⟨S, hSE⟩ + let V : ι → E := fun j => ⟨X t₀ j, h₀ j⟩ + have hS' : IsSelfAdjoint S' := Subtype.ext hS + have hV : ∀ j, V j ∈ unitary E := by + intro j + rw [Unitary.mem_iff] + exact ⟨Subtype.ext (hU t₀ j).1, Subtype.ext (hU t₀ j).2⟩ + obtain ⟨Y, hY₀, hY, hUY⟩ := global_unitary_solution S' hS' h V hV + let L : (ι → E) →L[ℝ] (ι → A) := + ContinuousLinearMap.pi fun j => + (E.toSubalgebra.toSubmodule.subtypeL.restrictScalars ℝ).comp + (ContinuousLinearMap.proj j) + let Z : ℝ → ι → A := fun t => L (Y (t - t₀)) + have hZ : ∀ t, HasDerivAt Z (field S h (Z t)) t := by + intro t + have hd := (hY (t - t₀)).scomp t ((hasDerivAt_id t).sub_const t₀) + have hm := L.hasFDerivAt.comp_hasDerivAt t hd + have hm' : HasDerivAt Z (L (field S' h (Y (t - t₀)))) t := by + simpa only [Function.comp_def, id_eq, one_smul, Z] using hm + have hf : L (field S' h (Y (t - t₀))) = field S h (Z t) := by + ext j + exact coe_field E S' h (Y (t - t₀)) j + rw [hf] at hm' + exact hm' + have hUZ : ∀ t j, Z t j ∈ unitary A := by + intro t j + exact ⟨congrArg Subtype.val (hUY (t - t₀) j).1, + congrArg Subtype.val (hUY (t - t₀) j).2⟩ + have heq : X = Z := unitary_solutions_unique S h X Z hX hZ hU hUZ t₀ (by + ext j + change X t₀ j = ((Y (t₀ - t₀) j : E) : A) + rw [sub_self, hY₀]) + intro t j + rw [heq] + exact (Y (t - t₀) j).property + +end FreeGroupFactorMain.PolynomialFlow + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/NCPolynomial.lean b/lean/OAI/Analysis/FreeGroupFactor/NCPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..34ec96e373fa6f6f1dfff73f6bc36c26ab83c273 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/NCPolynomial.lean @@ -0,0 +1,223 @@ +import OAI.Analysis.FreeGroupFactor.PolynomialFlow + +namespace OAI + +noncomputable section + +universe uA uι + +open Set Metric +open scoped NNReal Topology BigOperators ContDiff + +open scoped BigOperators ContDiff +namespace FreeGroupFactorMain +namespace NCPolynomial + +inductive Expr (ι : Type uι) where + | scalar : ℂ → Expr ι + | gen : ι → Expr ι + | add : Expr ι → Expr ι → Expr ι + | mul : Expr ι → Expr ι → Expr ι + +def degree {ι : Type uι} : Expr ι → ℕ + | .scalar _ => 0 + | .gen _ => 1 + | .add p q => max (degree p) (degree q) + | .mul p q => degree p + degree q + +def mass {ι : Type uι} : Expr ι → ℝ + | .scalar c => ‖c‖ + | .gen _ => 1 + | .add p q => mass p + mass q + | .mul p q => mass p * mass q + +def eval {ι : Type uι} {A : Type uA} [Semiring A] [Algebra ℂ A] (X : ι → A) : Expr ι → A + | .scalar c => algebraMap ℂ A c + | .gen i => X i + | .add p q => eval X p + eval X q + | .mul p q => eval X p * eval X q + +def delta {ι : Type uι} (V : ι → Expr ι) : Expr ι → Expr ι + | .scalar _ => .scalar 0 + | .gen i => V i + | .add p q => .add (delta V p) (delta V q) + | .mul p q => .add (.mul (delta V p) q) (.mul p (delta V q)) + + theorem mass_nonneg {ι : Type uι} (p : Expr ι) : 0 ≤ mass p := by + induction p with + | scalar c => exact norm_nonneg _ + | gen i => exact zero_le_one + | add p q hp hq => exact add_nonneg hp hq + | mul p q hp hq => exact mul_nonneg hp hq + + theorem degree_delta {ι : Type uι} (V : ι → Expr ι) (J : ℕ) + (hV : ∀ i, degree (V i) ≤ J + 1) (p : Expr ι) : + degree (delta V p) ≤ degree p + J := by + induction p with + | scalar c => simp [delta, degree] + | gen i => simpa [delta, degree, Nat.add_comm] using hV i + | add p q hp hq => + simp only [delta, degree] + omega + | mul p q hp hq => + simp only [delta, degree] + omega + + theorem mass_delta {ι : Type uι} (V : ι → Expr ι) (B : ℝ) (hB : 0 ≤ B) + (hV : ∀ i, mass (V i) ≤ B) (p : Expr ι) : + mass (delta V p) ≤ mass p * (degree p : ℝ) * B := by + induction p with + | scalar c => simp [delta, mass, degree] + | gen i => simpa [delta, mass, degree] using hV i + | add p q hp hq => + simp only [delta, mass, degree] + have hl : (degree p : ℝ) ≤ (max (degree p) (degree q) : ℕ) := by exact_mod_cast le_max_left _ _ + have hr : (degree q : ℝ) ≤ (max (degree p) (degree q) : ℕ) := by exact_mod_cast le_max_right _ _ + calc + mass (delta V p) + mass (delta V q) ≤ + mass p * (degree p : ℝ) * B + mass q * (degree q : ℝ) * B := add_le_add hp hq + _ ≤ mass p * (max (degree p) (degree q) : ℕ) * B + + mass q * (max (degree p) (degree q) : ℕ) * B := by + gcongr + · exact mass_nonneg p + · exact mass_nonneg q + _ = _ := by ring + | mul p q hp hq => + simp only [delta, mass, degree, Nat.cast_add] + calc + mass (delta V p) * mass q + mass p * mass (delta V q) ≤ + (mass p * (degree p : ℝ) * B) * mass q + + mass p * (mass q * (degree q : ℝ) * B) := by + exact add_le_add (mul_le_mul_of_nonneg_right hp (mass_nonneg q)) + (mul_le_mul_of_nonneg_left hq (mass_nonneg p)) + _ = _ := by ring + + theorem degree_iterate {ι : Type uι} (V : ι → Expr ι) (J : ℕ) + (hV : ∀ i, degree (V i) ≤ J + 1) (p : Expr ι) (r : ℕ) : + degree ((delta V)^[r] p) ≤ degree p + r * J := by + induction r with + | zero => simp + | succ r ih => + rw [Function.iterate_succ_apply'] + exact (degree_delta V J hV _).trans (by simpa [Nat.add_mul, Nat.add_assoc] using Nat.add_le_add_right ih J) + + theorem mass_iterate {ι : Type uι} (V : ι → Expr ι) (J : ℕ) (B : ℝ) (hB : 0 ≤ B) + (hdeg : ∀ i, degree (V i) ≤ J + 1) (hmass : ∀ i, mass (V i) ≤ B) + (p : Expr ι) (r : ℕ) : + mass ((delta V)^[r] p) ≤ + mass p * (B * ((degree p : ℝ) + J)) ^ r * (r.factorial : ℝ) := by + induction r with + | zero => simp + | succ r ih => + rw [Function.iterate_succ_apply'] + have hd : (degree ((delta V)^[r] p) : ℝ) ≤ ((degree p : ℝ) + J) * (r + 1) := by + have := degree_iterate V J hdeg p r + have hh : (degree ((delta V)^[r] p) : ℝ) ≤ (degree p : ℝ) + r * J := by exact_mod_cast this + nlinarith [Nat.cast_nonneg (α := ℝ) (degree p)] + calc + mass (delta V ((delta V)^[r] p)) ≤ + mass ((delta V)^[r] p) * (degree ((delta V)^[r] p) : ℝ) * B := + mass_delta V B hB hmass _ + _ ≤ (mass p * (B * ((degree p : ℝ) + J)) ^ r * (r.factorial : ℝ)) * + (((degree p : ℝ) + J) * (r + 1)) * B := by + gcongr + exact mul_nonneg (mul_nonneg (mass_nonneg p) (pow_nonneg (mul_nonneg hB (by positivity)) _)) (by positivity) + _ = _ := by simp [pow_succ, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add]; ring + + theorem norm_eval {ι : Type uι} {A : Type uA} [NormedRing A] [NormedAlgebra ℂ A] [NormOneClass A] + (X : ι → A) (R : ℝ) (hR : 1 ≤ R) (hX : ∀ i, ‖X i‖ ≤ R) (p : Expr ι) : + ‖eval X p‖ ≤ mass p * R ^ degree p := by + induction p with + | scalar c => simp [eval, mass, degree, norm_algebraMap'] + | gen i => simpa [eval, mass, degree] using hX i + | add p q hp hq => + simp only [eval, mass, degree] + calc + ‖eval X p + eval X q‖ ≤ ‖eval X p‖ + ‖eval X q‖ := norm_add_le _ _ + _ ≤ mass p * R ^ degree p + mass q * R ^ degree q := add_le_add hp hq + _ ≤ mass p * R ^ max (degree p) (degree q) + + mass q * R ^ max (degree p) (degree q) := by + gcongr + · exact mass_nonneg p + · exact le_max_left _ _ + · exact mass_nonneg q + · exact le_max_right _ _ + _ = _ := by ring + | mul p q hp hq => + simp only [eval, mass, degree, pow_add] + calc + ‖eval X p * eval X q‖ ≤ ‖eval X p‖ * ‖eval X q‖ := norm_mul_le _ _ + _ ≤ (mass p * R ^ degree p) * (mass q * R ^ degree q) := by + exact mul_le_mul hp hq (norm_nonneg _) (mul_nonneg (mass_nonneg _) (pow_nonneg (by linarith) _)) + _ = _ := by ring + + theorem hasDerivAt_eval {ι : Type uι} {A : Type uA} [NormedRing A] [NormedAlgebra ℂ A] + (X : ℝ → ι → A) (V : ι → Expr ι) (t : ℝ) + (hX : ∀ i, HasDerivAt (fun s => X s i) (eval (X t) (V i)) t) (p : Expr ι) : + HasDerivAt (fun s => eval (X s) p) (eval (X t) (delta V p)) t := by + induction p with + | scalar c => simpa [eval, delta] using hasDerivAt_const t (algebraMap ℂ A c) + | gen i => exact hX i + | add p q hp hq => exact hp.add hq + | mul p q hp hq => exact hp.mul hq + + theorem eval_delta {ι : Type uι} {A : Type uA} [Ring A] [Algebra ℂ A] + (X : ι → A) (V : ι → Expr ι) (D : A →ₗ[ℂ] A) + (h1 : D 1 = 0) (hmul : ∀ a b, D (a * b) = D a * b + a * D b) + (hX : ∀ i, D (X i) = eval X (V i)) (p : Expr ι) : + D (eval X p) = eval X (delta V p) := by + induction p with + | scalar c => + simp only [eval, delta, map_zero] + rw [Algebra.algebraMap_eq_smul_one, map_smul, h1, smul_zero] + | gen i => exact hX i + | add p q hp hq => simpa only [eval, delta, map_add] using congrArg₂ (· + ·) hp hq + | mul p q hp hq => simp only [eval, delta, hmul, hp, hq] + +theorem norm_eval_iterate {ι : Type uι} {A : Type uA} [NormedRing A] [NormedAlgebra ℂ A] + [NormOneClass A] (X : ι → A) (R : ℝ) (hR : 1 ≤ R) (hX : ∀ i, ‖X i‖ ≤ R) + (V : ι → Expr ι) (J : ℕ) (B : ℝ) (hB : 0 ≤ B) + (hdeg : ∀ i, degree (V i) ≤ J + 1) (hmass : ∀ i, mass (V i) ≤ B) + (p : Expr ι) (r : ℕ) : + ‖eval X ((delta V)^[r] p)‖ ≤ + (mass p * R ^ degree p) * (B * ((degree p : ℝ) + J) * R ^ J) ^ r * + (r.factorial : ℝ) := by + have hR0 : 0 ≤ R := le_trans zero_le_one hR + calc + ‖eval X ((delta V)^[r] p)‖ ≤ mass ((delta V)^[r] p) * R ^ degree ((delta V)^[r] p) := + norm_eval X R hR hX _ + _ ≤ (mass p * (B * ((degree p : ℝ) + J)) ^ r * (r.factorial : ℝ)) * + R ^ (degree p + r * J) := by + apply mul_le_mul (mass_iterate V J B hB hdeg hmass p r) + · exact pow_le_pow_right₀ hR (degree_iterate V J hdeg p r) + · exact pow_nonneg hR0 _ + · exact mul_nonneg (mul_nonneg (mass_nonneg p) (pow_nonneg (mul_nonneg hB (by positivity)) _)) (by positivity) + _ = _ := by simp only [pow_add, mul_pow, ← pow_mul]; rw [Nat.mul_comm r J]; ring + +theorem smooth_eval {ι : Type uι} {A : Type uA} [NormedRing A] [NormedAlgebra ℂ A] + (X : ℝ → ι → A) (hX : ∀ i, ContDiff ℝ ∞ (fun t => X t i)) (p : Expr ι) : + ContDiff ℝ ∞ (fun t => eval (X t) p) := by + induction p with + | scalar c => exact contDiff_const + | gen i => exact hX i + | add p q hp hq => exact hp.add hq + | mul p q hp hq => exact hp.mul hq + +theorem iteratedDeriv_eval {ι : Type uι} {A : Type uA} [NormedRing A] [NormedAlgebra ℂ A] + (X : ℝ → ι → A) (V : ι → Expr ι) + (hX : ∀ t i, HasDerivAt (fun s => X s i) (eval (X t) (V i)) t) + (p : Expr ι) (r : ℕ) : + iteratedDeriv r (fun t => eval (X t) p) = fun t => eval (X t) ((delta V)^[r] p) := by + induction r with + | zero => rfl + | succ r ih => + rw [iteratedDeriv_succ, ih] + funext t + rw [(hasDerivAt_eval X V t (hX t) _).deriv, Function.iterate_succ_apply'] + +end NCPolynomial +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/Nielsen.lean b/lean/OAI/Analysis/FreeGroupFactor/Nielsen.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b7152985b874c0311e64a857086d52631f6a38c --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/Nielsen.lean @@ -0,0 +1,192 @@ +import OAI.Analysis.FreeGroupFactor.LaurentApproximation + +namespace OAI + +noncomputable section + +universe uG uH uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +namespace FreeGroupFactorMain +open scoped ENNReal + +variable {G : Type uG} [Group G] + +@[simp] theorem groupL2_groupUnitary [DecidableEq G] (g : G) : + groupL2 (groupUnitary g) = lp.single 2 g (1 : ℂ) := by + classical + ext x + simp [groupL2, groupUnitary, deltaOne, leftRegular_apply, + lp.single_apply, Pi.single_apply, inv_mul_eq_one, eq_comm] + +omit [Group G] in +theorem group_single_total [DecidableEq G] (K : Submodule ℂ (GroupHilbert G)) + (hK : IsClosed (K : Set (GroupHilbert G))) + (hsingle : ∀ g : G, lp.single 2 g (1 : ℂ) ∈ K) : ⊤ ≤ K := by + classical + intro ξ _hξ + have hs := lp.hasSum_single (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) ξ + apply hK.mem_of_tendsto hs + filter_upwards [] with s + apply K.sum_mem + intro g _hg + have he : lp.single 2 g (ξ g) = (ξ g) • (lp.single 2 g (1 : ℂ) : GroupHilbert G) := by + ext x + simp [lp.single_apply, Pi.single_apply] + rw [he] + exact K.smul_mem _ (hsingle g) + +theorem spatialGroupIso_symm_normal {H : Type uH} [Group H] + (e : GroupHilbert G ≃ₗᵢ[ℂ] GroupHilbert H) + (hVN : ∀ T : GroupOperator G, + T ∈ groupVonNeumann G ↔ e.conjStarAlgEquiv T ∈ groupVonNeumann H) : + @Continuous _ _ (groupUltraweakTopology H) (groupUltraweakTopology G) + (spatialGroupIso e hVN).symm := by + let : TopologicalSpace (GroupOperator G) := ultraweakOperatorTopology G + let : TopologicalSpace (GroupOperator H) := ultraweakOperatorTopology H + let : TopologicalSpace (groupVonNeumann G) := groupUltraweakTopology G + let : TopologicalSpace (groupVonNeumann H) := groupUltraweakTopology H + apply continuous_induced_rng.mpr + have hinc : Continuous (fun T : groupVonNeumann H => (T : GroupOperator H)) := + continuous_induced_dom + exact (spatial_ultraweak_continuous e.symm).comp hinc + +def gaugedRepresentation (e : G ≃* G) (χ : G →* unitary ℂ) : G →* groupVonNeumann G where + toFun g := (χ g : ℂ) • groupUnitary (e g) + map_one' := by + simp only [map_one, Submonoid.coe_one, one_smul] + exact Subtype.ext leftRegular_one + map_mul' g h := by + simp only [map_mul, Submonoid.coe_mul, smul_mul_smul_comm] + congr 1 + exact Subtype.ext (leftRegular_mul _ _) + +@[simp] theorem gaugedRepresentation_apply (e : G ≃* G) (χ : G →* unitary ℂ) (g : G) : + gaugedRepresentation e χ g = (χ g : ℂ) • groupUnitary (e g) := rfl + +theorem gaugedRepresentation_star (e : G ≃* G) (χ : G →* unitary ℂ) (g : G) : + star (gaugedRepresentation e χ g) = gaugedRepresentation e χ g⁻¹ := by + simp only [gaugedRepresentation_apply, star_smul, map_inv] + have hg : star (groupUnitary (e g)) = groupUnitary ((e g)⁻¹) := + Subtype.ext (leftRegular_star _) + rw [hg] + congr 1 + +theorem gaugedRepresentation_trace [DecidableEq G] (e : G ≃* G) (χ : G →* unitary ℂ) (g : G) : + canonicalTrace (gaugedRepresentation e χ g) = if g = 1 then 1 else 0 := by + classical + change canonicalTraceLinear ((χ g : ℂ) • groupUnitary (e g)) = _ + rw [map_smul] + change (χ g : ℂ) • canonicalTrace (groupUnitary (e g)) = _ + rw [canonicalTrace_groupUnitary] + simp only [e.map_eq_one_iff] + split_ifs with hg + · subst g; simp + · simp + +theorem gaugedRepresentation_total (e : G ≃* G) (χ : G →* unitary ℂ) : + ⊤ ≤ (Submodule.span ℂ (Set.range + (fun g => groupL2 (gaugedRepresentation e χ g)))).topologicalClosure := by + classical + let K := (Submodule.span ℂ (Set.range + (fun g => groupL2 (gaugedRepresentation e χ g)))).topologicalClosure + apply group_single_total K (Submodule.isClosed_topologicalClosure _) + intro g + have hg : groupL2 (gaugedRepresentation e χ (e.symm g)) ∈ K := + Submodule.le_topologicalClosure _ (Submodule.subset_span ⟨e.symm g,rfl⟩) + have hs := K.smul_mem (star (χ (e.symm g) : ℂ)) hg + simp only [gaugedRepresentation_apply, map_smul, groupL2_groupUnitary, + e.apply_symm_apply, smul_smul, (χ (e.symm g)).property.1, one_smul] at hs + exact hs + +theorem gaugedIso (e : G ≃* G) (χ : G →* unitary ℂ) : + ∃ Φ : groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann G, + (∀ T, canonicalTrace (Φ T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology G) (groupUltraweakTopology G) Φ ∧ + @Continuous _ _ (groupUltraweakTopology G) (groupUltraweakTopology G) Φ.symm ∧ + ∀ g, Φ (groupUnitary g) = (χ g : ℂ) • groupUnitary (e g) := by + classical + obtain ⟨f,hδ,hρ,hVN⟩ := spatial_of_haar_total (gaugedRepresentation e χ) + (gaugedRepresentation_star e χ) (gaugedRepresentation_trace e χ) + (gaugedRepresentation_total e χ) + refine ⟨spatialGroupIso f hVN, ?_, spatialGroupIso_normal f hVN, + spatialGroupIso_symm_normal f hVN, ?_⟩ + · intro T + rw [canonicalTrace_eq_inner, canonicalTrace_eq_inner] + change inner ℂ deltaOne (f ((T : GroupOperator G) (f.symm deltaOne))) = + inner ℂ deltaOne ((T : GroupOperator G) deltaOne) + have hf : f.symm deltaOne = deltaOne := f.injective (by simpa only [f.apply_symm_apply] using hδ.symm) + rw [hf] + simpa only [hδ] using f.inner_map_map deltaOne ((T : GroupOperator G) deltaOne) + · intro g + apply Subtype.ext + exact hρ g + +variable {ι : Type uι} + +def nielsenHom (w : FreeGroup ι) : FreeGroup (Option ι) →* FreeGroup (Option ι) := + FreeGroup.lift (fun j => j.elim (FreeGroup.of none * FreeGroup.map Option.some w) + (fun j => FreeGroup.of (some j))) + +@[simp] theorem nielsenHom_of_some (w : FreeGroup ι) (j : ι) : + nielsenHom w (FreeGroup.of (some j)) = FreeGroup.of (some j) := by + simp [nielsenHom] + +@[simp] theorem nielsenHom_of_none (w : FreeGroup ι) : + nielsenHom w (FreeGroup.of none) = FreeGroup.of none * FreeGroup.map Option.some w := by + simp [nielsenHom] + +@[simp] theorem nielsenHom_map_some (w v : FreeGroup ι) : + nielsenHom w (FreeGroup.map Option.some v) = FreeGroup.map Option.some v := by + have he : (nielsenHom w).comp (FreeGroup.map Option.some) = FreeGroup.map Option.some := by + apply FreeGroup.ext_hom + intro j + simp + exact DFunLike.congr_fun he v + +theorem nielsenHom_inv_comp (w : FreeGroup ι) : + (nielsenHom w⁻¹).comp (nielsenHom w) = MonoidHom.id _ := by + apply FreeGroup.ext_hom + intro j + cases j <;> simp [mul_assoc] + +def nielsenEquiv (w : FreeGroup ι) : FreeGroup (Option ι) ≃* FreeGroup (Option ι) where + toFun := nielsenHom w + invFun := nielsenHom w⁻¹ + left_inv g := DFunLike.congr_fun (nielsenHom_inv_comp w) g + right_inv g := by simpa using DFunLike.congr_fun (nielsenHom_inv_comp w⁻¹) g + map_mul' := map_mul (nielsenHom w) + +theorem gauged_nielsen_iso (w : FreeGroup ι) (z : unitary ℂ) : + ∃ γ : groupVonNeumann (FreeGroup (Option ι)) ≃⋆ₐ[ℂ] groupVonNeumann (FreeGroup (Option ι)), + (∀ T, canonicalTrace (γ T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option ι))) + (groupUltraweakTopology (FreeGroup (Option ι))) γ ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option ι))) + (groupUltraweakTopology (FreeGroup (Option ι))) γ.symm ∧ + (∀ j, γ (groupUnitary (FreeGroup.of (some j))) = groupUnitary (FreeGroup.of (some j))) ∧ + γ (groupUnitary (FreeGroup.of none)) = + (z : ℂ) • (groupUnitary (FreeGroup.of none) * groupUnitary (FreeGroup.map Option.some w)) := by + let χ : FreeGroup (Option ι) →* unitary ℂ := FreeGroup.lift (fun j => j.elim z (fun _ => 1)) + obtain ⟨γ,ht,hc,hci,hg⟩ := gaugedIso (nielsenEquiv w) χ + refine ⟨γ,ht,hc,hci,?_,?_⟩ + · intro j + rw [hg] + change ((χ (FreeGroup.of (some j)) : unitary ℂ) : ℂ) • + groupUnitary (nielsenHom w (FreeGroup.of (some j))) = _ + simp only [χ, FreeGroup.lift_apply_of, Option.elim_some, Submonoid.coe_one, + nielsenHom_of_some, one_smul] + · rw [hg] + change ((χ (FreeGroup.of none) : unitary ℂ) : ℂ) • + groupUnitary (nielsenHom w (FreeGroup.of none)) = _ + simp only [χ, FreeGroup.lift_apply_of, Option.elim_none, nielsenHom_of_none] + congr 1 + exact Subtype.ext (leftRegular_mul _ _) + +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/NormalExtension.lean b/lean/OAI/Analysis/FreeGroupFactor/NormalExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..5e89a7950928d6049fa292604227c898ca4f0ddd --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/NormalExtension.lean @@ -0,0 +1,417 @@ +import OAI.Analysis.FreeGroupFactor.MomentFlow + +namespace OAI + +namespace FreeGroupFactorMain + +noncomputable section + +universe uG uH + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +open scoped ComplexConjugate + +abbrev deltaOne {G : Type uG} [Group G] : GroupHilbert G := by + classical + exact lp.single 2 1 1 + +theorem deltaOne_eq {G : Type uG} [Group G] [DecidableEq G] : + (deltaOne : GroupHilbert G) = lp.single 2 1 1 := by + ext x + simp [deltaOne, lp.single_apply, Pi.single_apply] + +theorem groupVN_matrix {G : Type uG} [Group G] [DecidableEq G] + (T : groupVonNeumann G) (x y : G) : + ((T : GroupOperator G) (lp.single 2 y 1)) x = + ((T : GroupOperator G) deltaOne) (x * y⁻¹) := by + have hr : rightRegular y⁻¹ deltaOne = lp.single 2 y 1 := by + ext b + simp [deltaOne, lp.single_apply, Pi.single_apply, mul_inv_eq_one] + rw [← hr] + have hc := congrArg (fun f : GroupOperator G => f deltaOne) + (groupVN_commute_right T y⁻¹) + simpa only [mul_apply_eq_comp, rightRegular_apply] using + congrArg (fun v : GroupHilbert G => v x) hc.symm + +theorem groupVN_star_coefficient {G : Type uG} [Group G] [DecidableEq G] + (T : groupVonNeumann G) (x : G) : + ((star T : GroupOperator G) deltaOne) x = + conj (((T : GroupOperator G) deltaOne) x⁻¹) := by + calc + ((star T : GroupOperator G) deltaOne) x = + inner ℂ (lp.single 2 x (1 : ℂ)) ((star T : GroupOperator G) deltaOne) := by + simp only [lp.inner_single_left, RCLike.inner_apply, map_one, mul_one] + _ = inner ℂ ((T : GroupOperator G) (lp.single 2 x 1)) deltaOne := by + exact ContinuousLinearMap.adjoint_inner_right _ _ _ + _ = conj (((T : GroupOperator G) (lp.single 2 x 1)) 1) := by + simp only [deltaOne, lp.inner_single_right, RCLike.inner_apply, one_mul] + _ = _ := by rw [groupVN_matrix]; simp + +theorem canonicalTrace_star_mul_inner {G : Type uG} [Group G] [DecidableEq G] + (T U : groupVonNeumann G) : + canonicalTrace (star T * U) = inner ℂ + ((T : GroupOperator G) deltaOne) ((U : GroupOperator G) deltaOne) := by + classical + rw [canonicalTrace_eq_inner, ← deltaOne_eq] + change inner ℂ deltaOne (star (T : GroupOperator G) ((U : GroupOperator G) deltaOne)) = _ + rw [ContinuousLinearMap.star_eq_adjoint, ContinuousLinearMap.adjoint_inner_right] + +theorem canonicalTrace_mul {G : Type uG} [Group G] [DecidableEq G] + (T U : groupVonNeumann G) : canonicalTrace (T * U) = canonicalTrace (U * T) := by + have he (T U : groupVonNeumann G) : + canonicalTrace (T * U) = ∑' x : G, + ((T : GroupOperator G) deltaOne) x⁻¹ * ((U : GroupOperator G) deltaOne) x := by + rw [← star_star T, canonicalTrace_star_mul_inner] + change (∑' x, inner ℂ (((star T : GroupOperator G) deltaOne) x) + (((U : GroupOperator G) deltaOne) x)) = _ + apply tsum_congr + intro x + rw [groupVN_star_coefficient] + simp [RCLike.inner_apply, mul_comm] + rw [he, he] + simpa only [Equiv.inv_apply, inv_inv, mul_comm] using + ((Equiv.inv G).tsum_eq (fun x => + ((T : GroupOperator G) deltaOne) x⁻¹ * ((U : GroupOperator G) deltaOne) x)).symm + +def hilbertSequenceMap {G : Type uG} {H : Type uH} (e : GroupHilbert G ≃ₗᵢ[ℂ] GroupHilbert H) + (ξ : lp (fun _ : ℕ => GroupHilbert G) 2) : + lp (fun _ : ℕ => GroupHilbert H) 2 := + ⟨fun n => e (ξ n), Memℓp.of_norm (by simpa only [e.norm_map] using (lp.memℓp ξ).norm)⟩ + +theorem spatial_ultraweak_continuous {G : Type uG} {H : Type uH} + (e : GroupHilbert G ≃ₗᵢ[ℂ] GroupHilbert H) : + @Continuous _ _ (ultraweakOperatorTopology G) (ultraweakOperatorTopology H) + e.conjStarAlgEquiv := by + apply continuous_iInf_rng.mpr + intro ξ + apply continuous_iInf_rng.mpr + intro η + apply continuous_induced_rng.mpr + have heq : + (fun T : GroupOperator G => ∑' k : ℕ, inner ℂ (η k) (e.conjStarAlgEquiv T (ξ k))) = + (fun T : GroupOperator G => ∑' k : ℕ, + inner ℂ (hilbertSequenceMap e.symm η k) (T (hilbertSequenceMap e.symm ξ k))) := by + funext T + apply tsum_congr + intro k + change inner ℂ (η k) (e (T (e.symm (ξ k)))) = + inner ℂ (e.symm (η k)) (T (e.symm (ξ k))) + rw [← e.inner_map_map] + simp + change @Continuous _ _ (ultraweakOperatorTopology G) _ + (fun T : GroupOperator G => ∑' k : ℕ, inner ℂ (η k) (e.conjStarAlgEquiv T (ξ k))) + rw [heq] + exact continuous_iInf_dom (i := hilbertSequenceMap e.symm ξ) + (continuous_iInf_dom (i := hilbertSequenceMap e.symm η) continuous_induced_dom) + +def spatialGroupIso {G : Type uG} {H : Type uH} [Group G] [Group H] + (e : GroupHilbert G ≃ₗᵢ[ℂ] GroupHilbert H) + (hVN : ∀ T : GroupOperator G, + T ∈ groupVonNeumann G ↔ e.conjStarAlgEquiv T ∈ groupVonNeumann H) : + groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann H where + toFun T := ⟨e.conjStarAlgEquiv T, (hVN T).mp T.property⟩ + invFun T := ⟨e.conjStarAlgEquiv.symm T, (hVN _).mpr (by rw [e.conjStarAlgEquiv.apply_symm_apply]; exact T.property)⟩ + left_inv T := Subtype.ext (e.conjStarAlgEquiv.symm_apply_apply T) + right_inv T := Subtype.ext (e.conjStarAlgEquiv.apply_symm_apply T) + map_mul' T U := Subtype.ext (map_mul e.conjStarAlgEquiv (T : GroupOperator G) (U : GroupOperator G)) + map_add' T U := Subtype.ext (map_add e.conjStarAlgEquiv (T : GroupOperator G) (U : GroupOperator G)) + map_star' T := Subtype.ext (map_star e.conjStarAlgEquiv (T : GroupOperator G)) + map_smul' c T := Subtype.ext (map_smul e.conjStarAlgEquiv c (T : GroupOperator G)) + +theorem spatialGroupIso_normal {G : Type uG} {H : Type uH} [Group G] [Group H] + (e : GroupHilbert G ≃ₗᵢ[ℂ] GroupHilbert H) + (hVN : ∀ T : GroupOperator G, + T ∈ groupVonNeumann G ↔ e.conjStarAlgEquiv T ∈ groupVonNeumann H) : + @Continuous _ _ (groupUltraweakTopology G) (groupUltraweakTopology H) + (spatialGroupIso e hVN) := by + let : TopologicalSpace (GroupOperator G) := ultraweakOperatorTopology G + let : TopologicalSpace (GroupOperator H) := ultraweakOperatorTopology H + let : TopologicalSpace (groupVonNeumann G) := groupUltraweakTopology G + let : TopologicalSpace (groupVonNeumann H) := groupUltraweakTopology H + apply continuous_induced_rng.mpr + have hinc : Continuous (fun T : groupVonNeumann G => (T : GroupOperator G)) := + continuous_induced_dom + exact (spatial_ultraweak_continuous e).comp hinc + +theorem normalTracialIso_of_spatial {G : Type uG} {H : Type uH} [Group G] [Group H] + (e : GroupHilbert G ≃ₗᵢ[ℂ] GroupHilbert H) + (hδ : e deltaOne = deltaOne) + (hVN : ∀ T : GroupOperator G, + T ∈ groupVonNeumann G ↔ e.conjStarAlgEquiv T ∈ groupVonNeumann H) : + HasNormalTracialIso G H := by + classical + refine ⟨spatialGroupIso e hVN, fun T => ?_, spatialGroupIso_normal e hVN⟩ + rw [canonicalTrace_eq_inner, canonicalTrace_eq_inner] + change inner ℂ deltaOne (e ((T : GroupOperator G) (e.symm deltaOne))) = + inner ℂ deltaOne ((T : GroupOperator G) deltaOne) + rw [← hδ, e.symm_apply_apply, e.inner_map_map] + +open scoped ComplexConjugate ENNReal + + theorem operator_matrix_ext {G : Type uG} [DecidableEq G] (T U : GroupOperator G) + (h : ∀ g, T (lp.single 2 g 1) = U (lp.single 2 g 1)) : T = U := by + classical + apply ContinuousLinearMap.ext + intro ξ + have hT := (lp.hasSum_single (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) ξ).mapL T + have hU := (lp.hasSum_single (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) ξ).mapL U + have he (g : G) : T (lp.single 2 g (ξ g)) = U (lp.single 2 g (ξ g)) := by + have hc : lp.single (E := fun _ : G => ℂ) 2 g (ξ g) = + (ξ g) • lp.single (E := fun _ : G => ℂ) 2 g 1 := by + ext b + simp [lp.single_apply, Pi.single_apply] + rw [hc, map_smul, map_smul, h] + simp only [he] at hT + exact hT.unique hU + + theorem operator_coeff_tsum {G : Type uG} [DecidableEq G] (T : GroupOperator G) + (ξ : GroupHilbert G) (x : G) : + (T ξ) x = ∑' y : G, (T (lp.single 2 y 1)) x * ξ y := by + calc + (T ξ) x = inner ℂ (lp.single 2 x 1) (T ξ) := by simp [lp.inner_single_left] + _ = inner ℂ (star T (lp.single 2 x 1)) ξ := by + rw [ContinuousLinearMap.star_eq_adjoint, ContinuousLinearMap.adjoint_inner_left] + _ = ∑' y : G, (T (lp.single 2 y 1)) x * ξ y := by + rw [lp.inner_eq_tsum] + apply tsum_congr + intro y + have he : conj ((star T (lp.single 2 x 1)) y) = (T (lp.single 2 y 1)) x := by + calc + _ = inner ℂ (star T (lp.single 2 x 1)) (lp.single 2 y 1) := by + simp [lp.inner_single_right] + _ = inner ℂ (lp.single 2 x 1) (T (lp.single 2 y 1)) := by + rw [ContinuousLinearMap.star_eq_adjoint, ContinuousLinearMap.adjoint_inner_left] + _ = _ := by simp [lp.inner_single_left] + simp only [RCLike.inner_apply, he, mul_comm] + + theorem matrix_of_commute_right {G : Type uG} [Group G] [DecidableEq G] + (T : GroupOperator G) (hT : ∀ g, rightRegular g * T = T * rightRegular g) + (x y : G) : + (T (lp.single 2 y 1)) x = (T deltaOne) (x * y⁻¹) := by + have hr : rightRegular y⁻¹ deltaOne = lp.single 2 y 1 := by + ext b + simp [deltaOne, lp.single_apply, Pi.single_apply, mul_inv_eq_one] + rw [← hr] + have hc := congrArg (fun f : GroupOperator G => f deltaOne) (hT y⁻¹) + simpa only [mul_apply_eq_comp, rightRegular_apply] using + congrArg (fun v : GroupHilbert G => v x) hc.symm + + theorem matrix_of_commute_left {G : Type uG} [Group G] [DecidableEq G] + (T : GroupOperator G) (hT : ∀ g, leftRegular g * T = T * leftRegular g) + (x y : G) : + (T (lp.single 2 y 1)) x = (T deltaOne) (y⁻¹ * x) := by + have hl : leftRegular y deltaOne = lp.single 2 y 1 := by + ext b + simp [deltaOne, lp.single_apply, Pi.single_apply, inv_mul_eq_one, eq_comm] + rw [← hl] + have hc := congrArg (fun f : GroupOperator G => f deltaOne) (hT y) + simpa only [mul_apply_eq_comp, leftRegular_apply] using + congrArg (fun v : GroupHilbert G => v x) hc.symm + + theorem mem_groupVN_iff_commute_right {G : Type uG} [Group G] + (T : GroupOperator G) : T ∈ groupVonNeumann G ↔ + ∀ g, rightRegular g * T = T * rightRegular g := by + classical + refine ⟨fun h g => groupVN_commute_right ⟨T,h⟩ g, ?_⟩ + intro hT + have hc (U : GroupOperator G) (hU : ∀ g, leftRegular g * U = U * leftRegular g) : + U * T = T * U := by + apply operator_matrix_ext + intro k + ext x + have hleft : ((U * T) (lp.single 2 k 1)) x = + ∑' y : G, (U deltaOne) (y⁻¹ * x) * (T deltaOne) (y * k⁻¹) := by + change (U (T (lp.single 2 k 1))) x = _ + rw [operator_coeff_tsum U] + apply tsum_congr + intro y + rw [matrix_of_commute_left U hU x y, matrix_of_commute_right T hT y k] + have hright : ((T * U) (lp.single 2 k 1)) x = + ∑' y : G, (T deltaOne) (x * y⁻¹) * (U deltaOne) (k⁻¹ * y) := by + change (T (U (lp.single 2 k 1))) x = _ + rw [operator_coeff_tsum T] + apply tsum_congr + intro y + rw [matrix_of_commute_right T hT x y, matrix_of_commute_left U hU y k] + rw [hleft, hright] + let e : G ≃ G := ((Equiv.inv G).trans (Equiv.mulLeft x)).trans (Equiv.mulRight k) + have hs := e.tsum_eq (fun y => (U deltaOne) (y⁻¹ * x) * (T deltaOne) (y * k⁻¹)) + change (∑' c : G, (U deltaOne) ((x * c⁻¹ * k)⁻¹ * x) * + (T deltaOne) (x * c⁻¹ * k * k⁻¹)) = _ at hs + simpa only [mul_inv_rev, inv_inv, mul_assoc, inv_mul_cancel, + mul_inv_cancel, mul_one, mul_comm] using hs.symm + rw [groupVonNeumann, StarSubalgebra.mem_centralizer_iff] + intro U hU + have hu : ∀ g, leftRegular g * U = U * leftRegular g := by + intro g + exact ((StarSubalgebra.mem_centralizer_iff ℂ).mp hU _ + (leftRegular_mem_leftTranslations g)).1 + refine ⟨hc U hu, hc (star U) ?_⟩ + intro g + have hh := congrArg star (hu g⁻¹) + simpa only [star_mul, leftRegular_star, inv_inv] using hh.symm + +open scoped ComplexConjugate + + theorem rightRegular_single {G : Type uG} [Group G] [DecidableEq G] (g y : G) : + rightRegular g (lp.single 2 y (1 : ℂ)) = lp.single 2 (y * g⁻¹) 1 := by + ext x + simp only [rightRegular_apply, lp.single_apply, Pi.single_apply] + congr 1 + exact propext (eq_mul_inv_iff_mul_eq.symm) + + theorem mem_groupVN_of_matrix_invariant {G : Type uG} [Group G] [DecidableEq G] + (T : GroupOperator G) + (hT : ∀ x y g : G, (T (lp.single 2 (y*g) 1)) (x*g) = + (T (lp.single 2 y 1)) x) : T ∈ groupVonNeumann G := by + rw [mem_groupVN_iff_commute_right] + intro g + apply operator_matrix_ext + intro y + ext x + simp only [mul_apply_eq_comp, rightRegular_apply] + change (T (lp.single 2 y 1)) (x*g) = (T (rightRegular g (lp.single 2 y 1))) x + rw [rightRegular_single] + simpa only [mul_inv_cancel_right] using (hT (x*g) y g⁻¹).symm + + theorem haar_orbit_orthonormal {G : Type uG} {H : Type uH} [Group G] [Group H] [DecidableEq G] + (ρ : G →* groupVonNeumann H) + (hstar : ∀ g, star (ρ g) = ρ g⁻¹) + (htrace : ∀ g, canonicalTrace (ρ g) = if g = 1 then 1 else 0) : + Orthonormal ℂ (fun g => ((ρ g : groupVonNeumann H) : GroupOperator H) deltaOne) := by + classical + rw [orthonormal_iff_ite] + intro x y + rw [← canonicalTrace_star_mul_inner, hstar, ← map_mul, htrace] + simp only [inv_mul_eq_one] + + theorem spatial_of_haar_total {G : Type uG} {H : Type uH} [Group G] [Group H] [DecidableEq G] + (ρ : G →* groupVonNeumann H) + (hstar : ∀ g, star (ρ g) = ρ g⁻¹) + (htrace : ∀ g, canonicalTrace (ρ g) = if g = 1 then 1 else 0) + (htotal : ⊤ ≤ (Submodule.span ℂ (Set.range + (fun g => ((ρ g : groupVonNeumann H) : GroupOperator H) deltaOne))).topologicalClosure) : + ∃ e : GroupHilbert G ≃ₗᵢ[ℂ] GroupHilbert H, + e deltaOne = deltaOne ∧ + (∀ g, e.conjStarAlgEquiv (leftRegular g) = (ρ g : GroupOperator H)) ∧ + ∀ T : GroupOperator G, T ∈ groupVonNeumann G ↔ + e.conjStarAlgEquiv T ∈ groupVonNeumann H := by + classical + let v : G → GroupHilbert H := fun g => ((ρ g : groupVonNeumann H) : GroupOperator H) deltaOne + have hon : Orthonormal ℂ v := haar_orbit_orthonormal ρ hstar htrace + let e : GroupHilbert G ≃ₗᵢ[ℂ] GroupHilbert H := + (hon.isHilbertSum htotal).linearIsometryEquiv.symm + have he (g : G) : e (lp.single 2 g 1) = v g := + hon.linearIsometryEquiv_symm_apply_single_one htotal g + have hδ : e deltaOne = deltaOne := by + rw [deltaOne_eq, he] + simp [v] + have hleft (g : G) : e.conjStarAlgEquiv (leftRegular g) = (ρ g : GroupOperator H) := by + apply e.conjStarAlgEquiv.symm.injective + change e.conjStarAlgEquiv.symm (e.conjStarAlgEquiv (leftRegular g)) = + e.conjStarAlgEquiv.symm (ρ g : GroupOperator H) + rw [e.conjStarAlgEquiv.symm_apply_apply] + apply operator_matrix_ext + intro y + apply e.injective + change e (leftRegular g (lp.single 2 y 1)) = + e (e.symm ((ρ g : GroupOperator H) (e (lp.single 2 y 1)))) + rw [e.apply_symm_apply, he] + have hl : leftRegular g (lp.single 2 y (1 : ℂ)) = lp.single 2 (g*y) 1 := by + ext x + simp only [leftRegular_apply, lp.single_apply, Pi.single_apply] + congr 1 + exact propext (inv_mul_eq_iff_eq_mul) + rw [hl, he] + change ((ρ (g*y) : groupVonNeumann H) : GroupOperator H) deltaOne = _ + rw [map_mul] + rfl + refine ⟨e, hδ, hleft, ?_⟩ + intro T + constructor + · intro hT + rw [mem_groupVN_iff_commute_right] + intro g + apply e.conjStarAlgEquiv.symm.injective + change e.conjStarAlgEquiv.symm (rightRegular g * e.conjStarAlgEquiv T) = + e.conjStarAlgEquiv.symm (e.conjStarAlgEquiv T * rightRegular g) + rw [map_mul, map_mul, e.conjStarAlgEquiv.symm_apply_apply] + have hc : e.conjStarAlgEquiv.symm (rightRegular g) ∈ + StarSubalgebra.centralizer ℂ (leftTranslations G) := by + rw [StarSubalgebra.mem_centralizer_iff, leftTranslations_eq_range] + rintro _ ⟨x,rfl⟩ + constructor + · apply e.conjStarAlgEquiv.injective + change e.conjStarAlgEquiv (leftRegular _ * e.conjStarAlgEquiv.symm (rightRegular g)) = + e.conjStarAlgEquiv (e.conjStarAlgEquiv.symm (rightRegular g) * leftRegular _) + rw [map_mul, map_mul, e.conjStarAlgEquiv.apply_symm_apply, hleft] + exact (groupVN_commute_right (ρ x) g).symm + · rw [leftRegular_star] + apply e.conjStarAlgEquiv.injective + change e.conjStarAlgEquiv (leftRegular _ * e.conjStarAlgEquiv.symm (rightRegular g)) = + e.conjStarAlgEquiv (e.conjStarAlgEquiv.symm (rightRegular g) * leftRegular _) + rw [map_mul, map_mul, e.conjStarAlgEquiv.apply_symm_apply, hleft] + exact (groupVN_commute_right (ρ x⁻¹) g).symm + exact ((StarSubalgebra.mem_centralizer_iff ℂ).mp hT _ hc).1 + · intro hT + let U : groupVonNeumann H := ⟨e.conjStarAlgEquiv T, hT⟩ + have hm (x y : G) : (T (lp.single 2 y 1)) x = + canonicalTrace (star (ρ x) * U * ρ y) := by + calc + (T (lp.single 2 y 1)) x = inner ℂ (lp.single 2 x 1) (T (lp.single 2 y 1)) := by + simp [lp.inner_single_left] + _ = inner ℂ (v x) ((U : GroupOperator H) (v y)) := by + rw [← he x, ← he y, ← e.inner_map_map] + change inner ℂ (e (lp.single 2 x 1)) (e (T (lp.single 2 y 1))) = + inner ℂ (e (lp.single 2 x 1)) (e (T (e.symm (e (lp.single 2 y 1))))) + rw [e.symm_apply_apply] + _ = canonicalTrace (star (ρ x) * U * ρ y) := by + rw [mul_assoc, canonicalTrace_star_mul_inner] + rfl + apply mem_groupVN_of_matrix_invariant T + intro x y g + rw [hm, hm, map_mul, map_mul, star_mul] + have hc := canonicalTrace_mul (star (ρ g) * star (ρ x) * U * ρ y) (ρ g) + simp only [← mul_assoc] + rw [hc] + simp only [hstar, ← mul_assoc, ← map_mul, mul_inv_cancel, one_mul] + + theorem normalTracialIso_of_haar_total {G : Type uG} {H : Type uH} [Group G] [Group H] [DecidableEq G] + (ρ : G →* groupVonNeumann H) + (hstar : ∀ g, star (ρ g) = ρ g⁻¹) + (htrace : ∀ g, canonicalTrace (ρ g) = if g = 1 then 1 else 0) + (htotal : ⊤ ≤ (Submodule.span ℂ (Set.range + (fun g => ((ρ g : groupVonNeumann H) : GroupOperator H) deltaOne))).topologicalClosure) : + HasNormalTracialIso G H := by + obtain ⟨e,hδ,_hρ,hVN⟩ := spatial_of_haar_total ρ hstar htrace htotal + exact normalTracialIso_of_spatial e hδ hVN + + theorem iso_extension_of_haar_total {G : Type uG} {H : Type uH} [Group G] [Group H] [DecidableEq G] + (ρ : G →* groupVonNeumann H) + (hstar : ∀ g, star (ρ g) = ρ g⁻¹) + (htrace : ∀ g, canonicalTrace (ρ g) = if g = 1 then 1 else 0) + (htotal : ⊤ ≤ (Submodule.span ℂ (Set.range + (fun g => ((ρ g : groupVonNeumann H) : GroupOperator H) deltaOne))).topologicalClosure) : + ∃ Φ : groupVonNeumann G ≃⋆ₐ[ℂ] groupVonNeumann H, + (∀ T, canonicalTrace (Φ T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology G) (groupUltraweakTopology H) Φ ∧ + ∀ g, Φ (groupUnitary g) = ρ g := by + classical + obtain ⟨e,hδ,hρ,hVN⟩ := spatial_of_haar_total ρ hstar htrace htotal + refine ⟨spatialGroupIso e hVN, ?_, spatialGroupIso_normal e hVN, ?_⟩ + · intro T + rw [canonicalTrace_eq_inner, canonicalTrace_eq_inner, ← deltaOne_eq, ← deltaOne_eq] + change inner ℂ deltaOne (e ((T : GroupOperator G) (e.symm deltaOne))) = + inner ℂ deltaOne ((T : GroupOperator G) deltaOne) + rw [← hδ, e.symm_apply_apply, e.inner_map_map] + · intro g + apply Subtype.ext + exact hρ g + +end + +end FreeGroupFactorMain + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/Operators.lean b/lean/OAI/Analysis/FreeGroupFactor/Operators.lean new file mode 100644 index 0000000000000000000000000000000000000000..4518c284f9d7ade8cb0b6f49458b545d103b9960 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/Operators.lean @@ -0,0 +1,219 @@ +import OAI.Analysis.FreeGroupFactor.Taylor + +namespace OAI + +noncomputable section + +universe uG uH + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +namespace FreeGroupFactorMain + +open scoped ENNReal + +def hilbertReindex {G : Type uG} {H : Type uH} (e : G ≃ H) : + GroupHilbert G ≃ₗᵢ[ℂ] GroupHilbert H where + toFun ξ := ⟨fun h => ξ (e.symm h), by + apply memℓp_gen + exact e.symm.summable_iff.mpr ((lp.memℓp ξ).summable (by norm_num))⟩ + invFun η := ⟨fun g => η (e g), by + apply memℓp_gen + exact e.summable_iff.mpr ((lp.memℓp η).summable (by norm_num))⟩ + left_inv ξ := by ext g; simp + right_inv η := by ext h; simp + map_add' ξ η := by rfl + map_smul' c ξ := by rfl + norm_map' ξ := by + simp only [lp.norm_eq_tsum_rpow (by norm_num : 0 < (2 : ℝ≥0∞).toReal)] + change (∑' h : H, ‖ξ (e.symm h)‖ ^ (2 : ℝ≥0∞).toReal) ^ (1 / (2 : ℝ≥0∞).toReal) = + (∑' g : G, ‖ξ g‖ ^ (2 : ℝ≥0∞).toReal) ^ (1 / (2 : ℝ≥0∞).toReal) + exact congrArg (fun t : ℝ => t ^ (1 / (2 : ℝ≥0∞).toReal)) + (e.symm.tsum_eq (fun g => ‖ξ g‖ ^ (2 : ℝ≥0∞).toReal)) + +@[simp] theorem hilbertReindex_apply {G : Type uG} {H : Type uH} (e : G ≃ H) + (ξ : GroupHilbert G) (h : H) : hilbertReindex e ξ h = ξ (e.symm h) := rfl + +def leftRegular {G : Type uG} [Group G] (g : G) : GroupOperator G := + (hilbertReindex (Equiv.mulLeft g)).toContinuousLinearEquiv.toContinuousLinearMap + +@[simp] theorem leftRegular_apply {G : Type uG} [Group G] (g : G) + (ξ : GroupHilbert G) (h : G) : leftRegular g ξ h = ξ (g⁻¹ * h) := rfl + +@[simp] theorem leftRegular_one {G : Type uG} [Group G] : + leftRegular (1 : G) = 1 := by + ext ξ h + simp + +@[simp] theorem leftRegular_mul {G : Type uG} [Group G] (g h : G) : + leftRegular (g * h) = leftRegular g * leftRegular h := by + ext ξ b + simp [mul_assoc] + +theorem leftRegular_mem_leftTranslations {G : Type uG} [Group G] (g : G) : + leftRegular g ∈ leftTranslations G := ⟨g, fun _ _ => rfl⟩ + +theorem leftTranslations_eq_range (G : Type uG) [Group G] : + leftTranslations G = Set.range (leftRegular (G := G)) := by + ext T + constructor + · rintro ⟨g, hg⟩ + refine ⟨g, ?_⟩ + ext ξ h + exact (hg ξ h).symm + · rintro ⟨g, rfl⟩ + exact leftRegular_mem_leftTranslations g + +def groupVonNeumannBundled (G : Type uG) [Group G] : VonNeumannAlgebra (GroupHilbert G) where + toStarSubalgebra := groupVonNeumann G + centralizer_centralizer' := by + change Set.centralizer (Set.centralizer (groupVonNeumann G : Set (GroupOperator G))) = + (groupVonNeumann G : Set (GroupOperator G)) + simp only [groupVonNeumann, StarSubalgebra.coe_centralizer_centralizer, + Set.centralizer_centralizer_centralizer] + +@[simp] theorem leftRegular_star {G : Type uG} [Group G] (g : G) : + star (leftRegular g) = leftRegular g⁻¹ := by + change star ((hilbertReindex (Equiv.mulLeft g)) : GroupOperator G) = _ + rw [LinearIsometryEquiv.star_eq_symm] + ext ξ b + change ξ (g * b) = ξ ((g⁻¹)⁻¹ * b) + simp + +def rightRegular {G : Type uG} [Group G] (g : G) : GroupOperator G := + (hilbertReindex (Equiv.mulRight g⁻¹)).toContinuousLinearEquiv.toContinuousLinearMap + +@[simp] theorem rightRegular_apply {G : Type uG} [Group G] (g : G) + (ξ : GroupHilbert G) (h : G) : rightRegular g ξ h = ξ (h * g) := by + simp [rightRegular] + +@[simp] theorem rightRegular_star {G : Type uG} [Group G] (g : G) : + star (rightRegular g) = rightRegular g⁻¹ := by + change star ((hilbertReindex (Equiv.mulRight g⁻¹)) : GroupOperator G) = _ + rw [LinearIsometryEquiv.star_eq_symm] + ext ξ b + change ξ (b * g⁻¹) = rightRegular g⁻¹ ξ b + rw [rightRegular_apply] + +theorem left_right_commute {G : Type uG} [Group G] (g h : G) : + leftRegular g * rightRegular h = rightRegular h * leftRegular g := by + ext ξ b + simp [mul_assoc] + +theorem rightRegular_mem_commutant {G : Type uG} [Group G] (g : G) : + rightRegular g ∈ StarSubalgebra.centralizer ℂ (leftTranslations G) := by + rw [StarSubalgebra.mem_centralizer_iff, leftTranslations_eq_range] + rintro _ ⟨h, rfl⟩ + exact ⟨left_right_commute h g, by simp only [leftRegular_star]; exact left_right_commute _ _⟩ + +theorem groupVN_commute_right {G : Type uG} [Group G] (T : groupVonNeumann G) (g : G) : + rightRegular g * (T : GroupOperator G) = (T : GroupOperator G) * rightRegular g := + ((StarSubalgebra.mem_centralizer_iff ℂ).mp T.property _ (rightRegular_mem_commutant g)).1 + +theorem groupVN_separating {G : Type uG} [Group G] [DecidableEq G] (T : groupVonNeumann G) + (hT : (T : GroupOperator G) (lp.single 2 (1 : G) (1 : ℂ)) = 0) : T = 0 := by + classical + have hr (g : G) : rightRegular g⁻¹ (lp.single 2 (1 : G) (1 : ℂ)) = lp.single 2 g 1 := by + ext b + simp [lp.single_apply, Pi.single_apply, mul_inv_eq_one] + have hsingle (g : G) : (T : GroupOperator G) (lp.single 2 g 1) = 0 := by + rw [← hr g] + have hc := congrArg (fun f : GroupOperator G => f (lp.single 2 (1 : G) (1 : ℂ))) + (groupVN_commute_right T g⁻¹) + simpa [hT] using hc.symm + apply Subtype.ext + apply ContinuousLinearMap.ext + intro ξ + have hs := ((lp.hasSum_single (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) ξ).mapL (T : GroupOperator G)) + have hz (g : G) : (T : GroupOperator G) (lp.single 2 g (ξ g)) = 0 := by + have he : lp.single (E := fun _ : G => ℂ) 2 g (ξ g) = (ξ g) • lp.single (E := fun _ : G => ℂ) 2 g (1 : ℂ) := by + ext b + simp [lp.single_apply, Pi.single_apply] + rw [he, map_smul, hsingle, smul_zero] + simp only [hz] at hs + exact HasSum.unique hs hasSum_zero + +theorem canonicalTrace_eq_inner {G : Type uG} [Group G] [DecidableEq G] + (T : groupVonNeumann G) : + canonicalTrace T = inner ℂ (lp.single 2 (1 : G) (1 : ℂ)) + ((T : GroupOperator G) (lp.single 2 (1 : G) (1 : ℂ))) := by + classical + simp only [canonicalTrace, lp.inner_single_left, RCLike.inner_apply, map_one, mul_one] + apply congrArg (fun v : GroupHilbert G => ((T : GroupOperator G) v) 1) + ext b + simp [lp.single_apply, Pi.single_apply] + +theorem canonicalTrace_star_mul {G : Type uG} [Group G] [DecidableEq G] + (T : groupVonNeumann G) : + canonicalTrace (star T * T) = + (‖(T : GroupOperator G) (lp.single 2 (1 : G) (1 : ℂ))‖ ^ 2 : ℂ) := by + rw [canonicalTrace_eq_inner] + change inner ℂ (lp.single 2 (1 : G) (1 : ℂ)) + (star (T : GroupOperator G) ((T : GroupOperator G) (lp.single 2 (1 : G) (1 : ℂ)))) = _ + rw [ContinuousLinearMap.star_eq_adjoint, ContinuousLinearMap.adjoint_inner_right] + exact inner_self_eq_norm_sq_to_K _ + +theorem canonicalTrace_faithful {G : Type uG} [Group G] [DecidableEq G] + (T : groupVonNeumann G) (hT : canonicalTrace (star T * T) = 0) : T = 0 := by + rw [canonicalTrace_star_mul] at hT + have hnorm : ‖(T : GroupOperator G) (lp.single 2 (1 : G) (1 : ℂ))‖ = 0 := by + exact Complex.ofReal_eq_zero.mp (eq_zero_of_pow_eq_zero hT) + exact groupVN_separating T (norm_eq_zero.mp hnorm) + +def canonicalTraceLinear {G : Type uG} [Group G] : groupVonNeumann G →ₗ[ℂ] ℂ where + toFun := canonicalTrace + map_add' T U := by simp [canonicalTrace] + map_smul' c T := by simp [canonicalTrace] + +theorem norm_canonicalTrace_le {G : Type uG} [Group G] (T : groupVonNeumann G) : + ‖canonicalTrace T‖ ≤ ‖T‖ := by + classical + rw [canonicalTrace_eq_inner] + calc + ‖inner ℂ (lp.single 2 (1 : G) (1 : ℂ)) + ((T : GroupOperator G) (lp.single 2 (1 : G) (1 : ℂ)))‖ ≤ + ‖lp.single (E := fun _ : G => ℂ) 2 (1 : G) (1 : ℂ)‖ * + ‖(T : GroupOperator G) (lp.single 2 (1 : G) (1 : ℂ))‖ := norm_inner_le_norm _ _ + _ ≤ ‖lp.single (E := fun _ : G => ℂ) 2 (1 : G) (1 : ℂ)‖ * + (‖(T : GroupOperator G)‖ * ‖lp.single (E := fun _ : G => ℂ) 2 (1 : G) (1 : ℂ)‖) := by + gcongr + exact (T : GroupOperator G).le_opNorm _ + _ = ‖T‖ := by simp + +def canonicalTraceCLM {G : Type uG} [Group G] : groupVonNeumann G →L[ℂ] ℂ := + canonicalTraceLinear.mkContinuous 1 (fun T => by + change ‖canonicalTrace T‖ ≤ 1 * ‖T‖ + simpa only [one_mul] using norm_canonicalTrace_le T) + +@[simp] theorem canonicalTraceCLM_apply {G : Type uG} [Group G] (T : groupVonNeumann G) : + canonicalTraceCLM T = canonicalTrace T := rfl + +theorem leftRegular_unitary {G : Type uG} [Group G] (g : G) : + leftRegular g ∈ unitary (GroupOperator G) := by + rw [Unitary.mem_iff] + constructor <;> simp [← leftRegular_mul, leftRegular_star, leftRegular_one] + +theorem leftRegular_mem_groupVN {G : Type uG} [Group G] (g : G) : + leftRegular g ∈ groupVonNeumann G := by + rw [groupVonNeumann, StarSubalgebra.mem_centralizer_iff] + intro S hS + have hs := (StarSubalgebra.mem_centralizer_iff ℂ).mp hS + constructor + · exact (hs _ (by rw [leftTranslations_eq_range]; exact ⟨g, rfl⟩)).1.symm + · have hh := congrArg star (hs _ (by rw [leftTranslations_eq_range]; exact ⟨g⁻¹, rfl⟩)).1 + simpa only [star_mul, leftRegular_star, inv_inv] using hh + +def groupUnitary {G : Type uG} [Group G] (g : G) : groupVonNeumann G := + ⟨leftRegular g, leftRegular_mem_groupVN g⟩ + +@[simp] theorem canonicalTrace_groupUnitary {G : Type uG} [Group G] [DecidableEq G] (g : G) : + canonicalTrace (groupUnitary g) = if g = 1 then 1 else 0 := by + classical + simp [canonicalTrace, groupUnitary, lp.single_apply, Pi.single_apply] + +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/PolynomialFlow.lean b/lean/OAI/Analysis/FreeGroupFactor/PolynomialFlow.lean new file mode 100644 index 0000000000000000000000000000000000000000..55624c2a2f0417ed0828c00083c47f57f6af8c26 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/PolynomialFlow.lean @@ -0,0 +1,310 @@ +import OAI.Analysis.FreeGroupFactor.GlobalODE + +namespace OAI + +noncomputable section + +universe uA uι + +open Set Metric +open scoped NNReal Topology BigOperators + +open scoped BigOperators ContDiff +namespace FreeGroupFactorMain +namespace PolynomialFlow + +section + +variable {A : Type uA} [CStarAlgebra A] +variable {ι : Type uι} [Fintype ι] [DecidableEq ι] + +def wordList (w : List (ι × Bool)) (X : ι → A) : A := + (w.map (fun ib => if ib.2 then X ib.1 else star (X ib.1))).prod + +def word (g : FreeGroup ι) (X : ι → A) : A := wordList g.toWord X + +def hamiltonian (S : A) (h : FreeGroup ι →₀ ℝ) (X : ι → A) : A := + h.sum (fun g c => (c : ℂ) • (word g X * S * star (word g X))) + +def field (S : A) (h : ι → FreeGroup ι →₀ ℝ) (X : ι → A) : ι → A := + fun j => Complex.I • (hamiltonian S (h j) X * X j) + + omit [DecidableEq ι] in + theorem smooth_wordList (w : List (ι × Bool)) : + ContDiff ℝ ∞ (wordList (A := A) w) := by + induction w with + | nil => + change ContDiff ℝ ∞ (fun _ : ι → A => (1 : A)) + exact contDiff_const + | cons a w ih => + rcases a with ⟨i, b⟩ + cases b + · change ContDiff ℝ ∞ (fun X : ι → A => star (X i) * wordList w X) + exact ((starL ℝ (A := A)).contDiff.comp (contDiff_apply ℝ A i)).mul ih + · change ContDiff ℝ ∞ (fun X : ι → A => X i * wordList w X) + exact (contDiff_apply ℝ A i).mul ih + + theorem smooth_word (g : FreeGroup ι) : ContDiff ℝ ∞ (word (A := A) g) := + smooth_wordList _ + + theorem smooth_hamiltonian (S : A) (h : FreeGroup ι →₀ ℝ) : + ContDiff ℝ ∞ (hamiltonian S h) := by + classical + unfold hamiltonian Finsupp.sum + apply ContDiff.sum + intro g hg + exact (contDiff_const (c := (h g : ℂ))).smul + (((smooth_word (A := A) g).mul (contDiff_const (c := S))).mul + ((starL ℝ (A := A)).contDiff.comp (smooth_word (A := A) g))) + + theorem smooth_field (S : A) (h : ι → FreeGroup ι →₀ ℝ) : + ContDiff ℝ ∞ (field S h) := by + apply contDiff_pi.mpr + intro j + exact (contDiff_const (c := Complex.I)).smul + ((smooth_hamiltonian S (h j)).mul (contDiff_apply ℝ A j)) + + omit [Fintype ι] in + theorem selfAdjoint_hamiltonian (S : A) (hS : IsSelfAdjoint S) + (h : FreeGroup ι →₀ ℝ) (X : ι → A) : IsSelfAdjoint (hamiltonian S h X) := by + classical + unfold hamiltonian Finsupp.sum + change star (∑ g ∈ h.support, (h g : ℂ) • (word g X * S * star (word g X))) = _ + simp only [star_sum, star_smul, Complex.star_def, Complex.conj_ofReal, star_mul, star_star, hS.star_eq, mul_assoc] + + theorem local_solution (S : A) (h : ι → FreeGroup ι →₀ ℝ) + (V : ι → A) (t₀ : ℝ) : + ∃ ε > (0 : ℝ), ∃ X : ℝ → ι → A, X t₀ = V ∧ + ∀ t ∈ Set.Ioo (t₀ - ε) (t₀ + ε), HasDerivAt X (field S h (X t)) t := by + obtain ⟨X, hX, ε, hε, hd⟩ := + ((smooth_field S h).of_le (show (1 : WithTop ℕ∞) ≤ ∞ from by simp)).contDiffAt + (x := V) |>.exists_forall_mem_closedBall_exists_eq_forall_mem_Ioo_hasDerivAt₀ t₀ + exact ⟨ε, hε, X, hX, hd⟩ + +omit [Fintype ι] in + + theorem tangent_star_mul (S : A) (hS : IsSelfAdjoint S) + (h : ι → FreeGroup ι →₀ ℝ) (X : ι → A) (j : ι) : + star (field S h X j) * X j + star (X j) * field S h X j = 0 := by + simp only [field, star_smul, star_mul, (selfAdjoint_hamiltonian S hS (h j) X).star_eq, + Complex.star_def, Complex.conj_I, neg_smul, neg_mul, smul_mul_assoc, + mul_smul_comm, mul_assoc] + exact neg_add_cancel _ + + omit [Fintype ι] in + theorem solution_star_mul_derivative (S : A) (hS : IsSelfAdjoint S) + (h : ι → FreeGroup ι →₀ ℝ) {X : ℝ → ι → A} {t : ℝ} + (hX : HasDerivAt X (field S h (X t)) t) (j : ι) : + HasDerivAt (fun u => star (X u j) * X u j) 0 t := by + have hj := hasDerivAt_pi.mp hX j + convert! hj.star.mul hj using 1 + exact (tangent_star_mul S hS h (X t) j).symm + + omit [Fintype ι] in + theorem solution_star_mul_constant (S : A) (hS : IsSelfAdjoint S) + (h : ι → FreeGroup ι →₀ ℝ) {X : ℝ → ι → A} {a b : ℝ} + (hX : ∀ t ∈ Set.Ioo a b, HasDerivAt X (field S h (X t)) t) + {t u : ℝ} (ht : t ∈ Set.Ioo a b) (hu : u ∈ Set.Ioo a b) (j : ι) : + star (X t j) * X t j = star (X u j) * X u j := by + have hd (v : ℝ) (hv : v ∈ Set.Ioo a b) := + solution_star_mul_derivative S hS h (hX v hv) j + exact isOpen_Ioo.is_const_of_deriv_eq_zero (convex_Ioo a b).isPreconnected + (fun v hv => (hd v hv).differentiableAt.differentiableWithinAt) + (fun v hv => (hd v hv).deriv) ht hu + +theorem local_unitary_solution (S : A) (hS : IsSelfAdjoint S) + (h : ι → FreeGroup ι →₀ ℝ) (V : ι → A) + (hV : ∀ j, V j ∈ unitary A) (t₀ : ℝ) : + ∃ ε > (0 : ℝ), ∃ X : ℝ → ι → A, X t₀ = V ∧ + (∀ t ∈ Set.Ioo (t₀ - ε) (t₀ + ε), HasDerivAt X (field S h (X t)) t) ∧ + (∀ t ∈ Set.Ioo (t₀ - ε) (t₀ + ε), ∀ j, X t j ∈ unitary A) := by + obtain ⟨ε, hε, X, hX₀, hX⟩ := local_solution S h V t₀ + have ht₀ : t₀ ∈ Set.Ioo (t₀ - ε) (t₀ + ε) := by constructor <;> linarith + have hinv : ∀ᶠ t in nhds t₀, ∀ j, IsUnit (X t j) := by + rw [Filter.eventually_all] + intro j + have hj := (hasDerivAt_pi.mp (hX t₀ ht₀) j).continuousAt + apply hj.eventually + apply Units.isOpen.mem_nhds + change IsUnit (X t₀ j) + rw [hX₀] + exact Unitary.isUnit_coe (U := ⟨V j, hV j⟩) + obtain ⟨ρ, hρ, hinv⟩ := Metric.eventually_nhds_iff.mp hinv + refine ⟨min ε ρ, lt_min hε hρ, X, hX₀, ?_, ?_⟩ + · intro t ht + apply hX t + constructor <;> have := min_le_left ε ρ <;> rcases ht with ⟨htl, htr⟩ <;> linarith + · intro t ht j + have htε : t ∈ Set.Ioo (t₀ - ε) (t₀ + ε) := by + constructor <;> have := min_le_left ε ρ <;> rcases ht with ⟨htl, htr⟩ <;> linarith + have hdist : dist t t₀ < ρ := by + rw [Real.dist_eq, abs_lt] + constructor <;> have := min_le_right ε ρ <;> rcases ht with ⟨htl, htr⟩ <;> linarith + apply (hinv hdist j).mem_unitary_of_star_mul_self + rw [solution_star_mul_constant S hS h hX htε ht₀ j, hX₀] + exact (Unitary.mem_iff.mp (hV j)).1 + +end + +section +open scoped NNReal BigOperators +variable {A : Type uA} [CStarAlgebra A] +variable {ι : Type uι} [Fintype ι] [DecidableEq ι] + +omit [DecidableEq ι] in +theorem boundedLip_clip_coordinate (j : ι) : + BoundedLip (fun X : ι → A => radialClip X j) := by + refine ⟨1, 2, by positivity, by positivity, ?_, ?_⟩ + · intro X + exact (norm_le_pi_norm (radialClip X) j).trans (norm_radialClip_le X) + · intro X Y + exact (norm_le_pi_norm (radialClip X - radialClip Y) j).trans + (by simpa only [dist_eq_norm, NNReal.coe_ofNat] using radialClip_lipschitz.dist_le_mul X Y) + +omit [DecidableEq ι] in +theorem boundedLip_clip_wordList (w : List (ι × Bool)) : + BoundedLip (fun X : ι → A => wordList w (radialClip X)) := by + induction w with + | nil => exact BoundedLip.const 1 + | cons a w ih => + rcases a with ⟨i, b⟩ + cases b + · exact (boundedLip_clip_coordinate i).star.mul ih + · exact (boundedLip_clip_coordinate i).mul ih + +theorem boundedLip_clip_word (g : FreeGroup ι) : + BoundedLip (fun X : ι → A => word g (radialClip X)) := + boundedLip_clip_wordList _ + +theorem boundedLip_clip_hamiltonian (S : A) (h : FreeGroup ι →₀ ℝ) : + BoundedLip (fun X : ι → A => hamiltonian S h (radialClip X)) := by + classical + unfold hamiltonian Finsupp.sum + apply BoundedLip.sum + intro g hg + exact ((boundedLip_clip_word g).mul (BoundedLip.const S) |>.mul + (boundedLip_clip_word g).star).smul (h g : ℂ) + +theorem boundedLip_clip_field (S : A) (h : ι → FreeGroup ι →₀ ℝ) : + BoundedLip (fun X => field S h (radialClip X)) := by + apply BoundedLip.pi + intro j + exact ((boundedLip_clip_hamiltonian S (h j)).mul + (boundedLip_clip_coordinate j)).smul Complex.I + +theorem tangent_clipped (S : A) (hS : IsSelfAdjoint S) + (h : ι → FreeGroup ι →₀ ℝ) (X : ι → A) (j : ι) : + star (field S h (radialClip X) j) * X j + + star (X j) * field S h (radialClip X) j = 0 := by + let r : ℝ := (max 1 ‖X‖)⁻¹ + have he : radialClip X j = r • X j := rfl + simp only [field, he, mul_smul_comm, smul_comm Complex.I r, star_smul, + star_trivial, star_mul, (selfAdjoint_hamiltonian S hS (h j) (radialClip X)).star_eq, + Complex.star_def, Complex.conj_I, neg_smul, neg_mul, smul_mul_assoc, + mul_assoc] + module + +theorem global_unitary_solution [Nontrivial A] + (S : A) (hS : IsSelfAdjoint S) (h : ι → FreeGroup ι →₀ ℝ) + (V : ι → A) (hV : ∀ j, V j ∈ unitary A) : + ∃ X : ℝ → ι → A, X 0 = V ∧ + (∀ t, HasDerivAt X (field S h (X t)) t) ∧ + ∀ t j, X t j ∈ unitary A := by + obtain ⟨M, K, hb, hl⟩ := (boundedLip_clip_field S h).to_bounds + obtain ⟨X, hX₀, hX⟩ := global_solution_of_bounded_lipschitz + (fun X => field S h (radialClip X)) K M hl hb V + have hd (j : ι) (t : ℝ) : + HasDerivAt (fun u => star (X u j) * X u j) 0 t := by + have hj := hasDerivAt_pi.mp (hX t) j + convert! hj.star.mul hj using 1 + exact (tangent_clipped S hS h (X t) j).symm + have hisom (t : ℝ) (j : ι) : star (X t j) * X t j = 1 := by + have he := is_const_of_deriv_eq_zero (fun u => (hd j u).differentiableAt) + (fun u => (hd j u).deriv) t 0 + rw [he, hX₀] + exact (Unitary.mem_iff.mp (hV j)).1 + have hn (t : ℝ) : ‖X t‖ ≤ 1 := by + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro j + have he := congrArg norm (hisom t j) + rw [CStarRing.norm_star_mul_self, norm_one] at he + nlinarith [norm_nonneg (X t j)] + have hder (t : ℝ) : HasDerivAt X (field S h (X t)) t := by + simpa only [radialClip_eq (hn t)] using hX t + refine ⟨X, hX₀, hder, ?_⟩ + intro t j + have hc : Continuous (fun u => X u j) := + continuous_iff_continuousAt.mpr fun u => (hasDerivAt_pi.mp (hder u) j).continuousAt + have hset : {u | X u j ∈ unitary A} = {u | IsUnit (X u j)} := by + ext u + constructor + · intro hu + exact Unitary.isUnit_coe (U := ⟨X u j, hu⟩) + · exact fun hu => hu.mem_unitary_of_star_mul_self (hisom u j) + have hcl : IsClosed {u | X u j ∈ unitary A} := isClosed_unitary.preimage hc + have hop : IsOpen {u | X u j ∈ unitary A} := by + rw [hset] + exact Units.isOpen.preimage hc + have hall := (IsClopen.eq_univ ⟨hcl, hop⟩ ⟨0, by change X 0 j ∈ unitary A; rw [hX₀]; exact hV j⟩) + exact (show t ∈ {u | X u j ∈ unitary A} from by rw [hall]; trivial) + +end + +variable {A : Type uA} [CStarAlgebra A] +variable {ι : Type uι} [Fintype ι] [DecidableEq ι] + +theorem smooth_solution (S : A) (h : ι → FreeGroup ι →₀ ℝ) + (X : ℝ → ι → A) (hX : ∀ t, HasDerivAt X (field S h (X t)) t) : + ContDiff ℝ ∞ X := by + have hdiff : Differentiable ℝ X := fun t => (hX t).differentiableAt + apply contDiff_infty.mpr + intro n + induction n with + | zero => exact contDiff_zero.mpr hdiff.continuous + | succ n ih => + rw [Nat.cast_add, Nat.cast_one, contDiff_succ_iff_deriv] + refine ⟨hdiff, by simp, ?_⟩ + have heq : deriv X = fun t => field S h (X t) := funext fun t => (hX t).deriv + rw [heq] + exact (contDiff_infty.mp (smooth_field S h) n).comp ih + +omit [DecidableEq ι] in +theorem norm_unitary_tuple_le [Nontrivial A] (V : ι → A) + (hV : ∀ j, V j ∈ unitary A) : ‖V‖ ≤ 1 := by + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro j + exact (CStarRing.norm_of_mem_unitary (hV j)).le + +theorem unitary_solutions_unique [Nontrivial A] + (S : A) (h : ι → FreeGroup ι →₀ ℝ) (X Y : ℝ → ι → A) + (hX : ∀ t, HasDerivAt X (field S h (X t)) t) + (hY : ∀ t, HasDerivAt Y (field S h (Y t)) t) + (hUX : ∀ t j, X t j ∈ unitary A) (hUY : ∀ t j, Y t j ∈ unitary A) + (t₀ : ℝ) (hinit : X t₀ = Y t₀) : X = Y := by + obtain ⟨M, K, _hb, hl⟩ := (boundedLip_clip_field S h).to_bounds + funext t + let R := |t| + |t₀| + 1 + have ht : t ∈ Set.Ioo (-R) R := by + dsimp [R] + constructor <;> linarith [neg_abs_le t, le_abs_self t, abs_nonneg t₀] + have ht₀ : t₀ ∈ Set.Ioo (-R) R := by + dsimp [R] + constructor <;> linarith [neg_abs_le t₀, le_abs_self t₀, abs_nonneg t] + have heq : Set.EqOn X Y (Set.Ioo (-R) R) := by + apply ODE_solution_unique_of_mem_Ioo + (v := fun _ Z => field S h (radialClip Z)) (s := fun _ => Set.univ) (t₀ := t₀) + (fun _ _ => hl.lipschitzOnWith) ht₀ _ _ hinit + · intro u _ + rw [radialClip_eq (norm_unitary_tuple_le _ (hUX u))] + exact ⟨hX u, Set.mem_univ _⟩ + · intro u _ + rw [radialClip_eq (norm_unitary_tuple_le _ (hUY u))] + exact ⟨hY u, Set.mem_univ _⟩ + exact heq ht + +end PolynomialFlow +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/RadialCoefficients.lean b/lean/OAI/Analysis/FreeGroupFactor/RadialCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..c859c5dccbe9a1806e86160094cdc749610cd0c7 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/RadialCoefficients.lean @@ -0,0 +1,571 @@ +import OAI.Analysis.FreeGroupFactor.Cocycles + +namespace OAI + +noncomputable section + +universe uE uG uI uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +namespace FreeGroupFactorMain + +def coefficientSqNorm {G : Type uG} (h : G →₀ ℝ) : ℝ := h.sum (fun _ r => r ^ 2) + +theorem coefficientSqNorm_nonneg {G : Type uG} (h : G →₀ ℝ) : 0 ≤ coefficientSqNorm h := by + exact Finset.sum_nonneg (fun _ _ => sq_nonneg _) + +@[simp] theorem coefficientSqNorm_zero {G : Type uG} : coefficientSqNorm (0 : G →₀ ℝ) = 0 := by + simp [coefficientSqNorm] + +@[simp] theorem coefficientSqNorm_single {G : Type uG} (g : G) (c : ℝ) : + coefficientSqNorm (Finsupp.single g c) = c ^ 2 := by + simp [coefficientSqNorm] + +@[simp] theorem coefficientSqNorm_smul {G : Type uG} (c : ℝ) (h : G →₀ ℝ) : + coefficientSqNorm (c • h) = c ^ 2 * coefficientSqNorm h := by + classical + rw [coefficientSqNorm, Finsupp.sum_of_support_subset _ Finsupp.support_smul + (fun (_ : G) (r : ℝ) => r ^ 2) (by simp)] + simp [Finsupp.smul_apply, mul_pow, coefficientSqNorm, Finsupp.sum, Finset.mul_sum] + +theorem coefficientSqNorm_add_of_disjoint {G : Type uG} (f g : G →₀ ℝ) + (hfg : Disjoint f.support g.support) : + coefficientSqNorm (f + g) = coefficientSqNorm f + coefficientSqNorm g := by + classical + rw [coefficientSqNorm, Finsupp.sum_of_support_subset _ Finsupp.support_add + (fun (_ : G) (r : ℝ) => r ^ 2) (by simp), + coefficientSqNorm, Finsupp.sum_of_support_subset f Finset.subset_union_left + (fun (_ : G) (r : ℝ) => r ^ 2) (by simp), + coefficientSqNorm, Finsupp.sum_of_support_subset g Finset.subset_union_right + (fun (_ : G) (r : ℝ) => r ^ 2) (by simp), ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro a _ + by_cases hf : f a = 0 + · simp [hf] + · have hg : g a = 0 := by + by_contra hg + exact Finset.disjoint_left.mp hfg (Finsupp.mem_support_iff.mpr hf) + (Finsupp.mem_support_iff.mpr hg) + simp [hg] + +theorem coefficientSqNorm_sum_of_disjoint {I : Type uI} {G : Type uG} (s : Finset I) (f : I → G →₀ ℝ) + (hf : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → Disjoint (f i).support (f j).support) : + coefficientSqNorm (∑ i ∈ s, f i) = ∑ i ∈ s, coefficientSqNorm (f i) := by + classical + revert hf + induction s using Finset.induction_on with + | empty => intro _; simp + | @insert a s ha ih => + intro hf + rw [Finset.sum_insert ha, Finset.sum_insert ha, coefficientSqNorm_add_of_disjoint] + · exact congrArg (coefficientSqNorm (f a) + ·) (ih (fun i hi j hj hij => + hf i (Finset.mem_insert_of_mem hi) j (Finset.mem_insert_of_mem hj) hij)) + · apply Finset.disjoint_left.mpr + intro g hg hs + obtain ⟨i, hi, hgi⟩ := Finsupp.mem_support_finsetSum g hs + have hai : a ≠ i := by intro h; exact ha (h.symm ▸ hi) + exact Finset.disjoint_left.mp (hf a (Finset.mem_insert_self ..) i + (Finset.mem_insert_of_mem hi) hai) hg hgi + +theorem coefficientSqNorm_sum_le {I : Type uI} {G : Type uG} (s : Finset I) (f : I → G →₀ ℝ) : + coefficientSqNorm (∑ i ∈ s, f i) ≤ (s.card : ℝ) * ∑ i ∈ s, coefficientSqNorm (f i) := by + classical + let t := s.biUnion (fun i => (f i).support) + have hsupp (i : I) (hi : i ∈ s) : (f i).support ⊆ t := + Finset.subset_biUnion_of_mem (fun i => (f i).support) hi + have hsum : (∑ i ∈ s, f i).support ⊆ t := by + intro g hg + obtain ⟨i, hi, hgi⟩ := Finsupp.mem_support_finsetSum g hg + exact hsupp i hi hgi + rw [coefficientSqNorm, Finsupp.sum_of_support_subset _ hsum _ (by simp)] + have hq (g : G) : ((∑ i ∈ s, f i) g) ^ 2 ≤ + (s.card : ℝ) * ∑ i ∈ s, (f i g) ^ 2 := by + simpa using Finset.sum_mul_sq_le_sq_mul_sq s (fun _ => (1 : ℝ)) (fun i => f i g) + calc + _ ≤ ∑ g ∈ t, (s.card : ℝ) * ∑ i ∈ s, (f i g) ^ 2 := Finset.sum_le_sum (fun g _ => hq g) + _ = (s.card : ℝ) * ∑ i ∈ s, ∑ g ∈ t, (f i g) ^ 2 := by + rw [← Finset.mul_sum, Finset.sum_comm] + _ = _ := by + congr 1 + apply Finset.sum_congr rfl + intro i hi + exact (Finsupp.sum_of_support_subset (f i) (hsupp i hi) + (fun (_ : G) (r : ℝ) => r ^ 2) (by simp)).symm + +theorem coefficientSqNorm_add_le {G : Type uG} (f g : G →₀ ℝ) : + coefficientSqNorm (f + g) ≤ 2 * (coefficientSqNorm f + coefficientSqNorm g) := by + simpa using coefficientSqNorm_sum_le (Finset.univ : Finset Bool) (fun b => if b then f else g) + +namespace Radial + +section +variable {ι : Type uι} [DecidableEq ι] [Fintype ι] + +def paths (i : ι) : ℕ → Finset (List ι) + | 0 => {[]} + | k + 1 => (Finset.univ.erase i).biUnion (fun j => (paths j k).image (List.cons j)) + +def sphere : ℕ → Finset (List ι) + | 0 => {[]} + | k + 1 => Finset.univ.biUnion (fun j : ι => (paths j k).image (List.cons j)) + +theorem paths_mem_length (i : ι) (k : ℕ) {w : List ι} (hw : w ∈ paths i k) : + w.length = k := by + induction k generalizing i w with + | zero => simpa [paths] using hw + | succ k ih => + simp only [paths, Finset.mem_biUnion, Finset.mem_image] at hw + obtain ⟨j, _, v, hv, rfl⟩ := hw + simp [ih j hv] + +theorem sphere_mem_length (k : ℕ) {w : List ι} (hw : w ∈ sphere (ι := ι) k) : + w.length = k := by + cases k with + | zero => simpa [sphere] using hw + | succ k => + simp only [sphere, Finset.mem_biUnion, Finset.mem_image] at hw + obtain ⟨j, _, v, hv, rfl⟩ := hw + simp [paths_mem_length j k hv] + +omit [Fintype ι] in +theorem cons_images_disjoint {i j : ι} (hij : i ≠ j) (s t : Finset (List ι)) : + Disjoint (s.image (List.cons i)) (t.image (List.cons j)) := by + apply Finset.disjoint_left.mpr + intro w hw ht + obtain ⟨v, _, rfl⟩ := Finset.mem_image.mp hw + obtain ⟨u, _, hu⟩ := Finset.mem_image.mp ht + exact hij (List.cons.inj hu).1.symm + +theorem card_paths (i : ι) (k : ℕ) : + (paths i k).card = (Fintype.card ι - 1) ^ k := by + induction k generalizing i with + | zero => simp [paths] + | succ k ih => + rw [paths, Finset.card_biUnion] + · simp only [Finset.card_image_of_injective _ (fun _ _ h => (List.cons.inj h).2), ih] + simp [pow_succ, Nat.mul_comm] + · intro a _ b _ hab + exact cons_images_disjoint hab _ _ + +theorem card_sphere_succ (k : ℕ) : + (sphere (ι := ι) (k + 1)).card = Fintype.card ι * (Fintype.card ι - 1) ^ k := by + rw [sphere, Finset.card_biUnion] + · simp only [Finset.card_image_of_injective _ (fun _ _ h => (List.cons.inj h).2), card_paths] + simp + · intro a _ b _ hab + exact cons_images_disjoint hab _ _ + +def signed (b : Bool) : List ι → List (ι × Bool) + | [] => [] + | i :: w => (i, b) :: signed (!b) w + +omit [DecidableEq ι] [Fintype ι] in +@[simp] theorem signed_length (b : Bool) (w : List ι) : (signed b w).length = w.length := by + induction w generalizing b with + | nil => rfl + | cons i w ih => simp [signed, ih] + +omit [DecidableEq ι] [Fintype ι] in +@[simp] theorem signed_map_fst (b : Bool) (w : List ι) : + (signed b w).map Prod.fst = w := by + induction w generalizing b with + | nil => rfl + | cons i w ih => simp [signed, ih] + +omit [DecidableEq ι] [Fintype ι] in +theorem signed_injective (b : Bool) : Function.Injective (signed (ι := ι) b) := by + intro u v huv + simpa using congrArg (List.map Prod.fst) huv + +theorem signed_reduced_paths (b : Bool) (i : ι) (k : ℕ) {w : List ι} + (hw : w ∈ paths i k) : FreeGroup.IsReduced ((i, b) :: signed (!b) w) := by + induction k generalizing b i w with + | zero => + have : w = [] := by simpa [paths] using hw + subst w + exact FreeGroup.IsReduced.singleton + | succ k ih => + simp only [paths, Finset.mem_biUnion, Finset.mem_image, Finset.mem_erase, + Finset.mem_univ, and_true] at hw + obtain ⟨j, hji, v, hv, rfl⟩ := hw + rw [signed, FreeGroup.isReduced_cons_cons] + exact ⟨fun hij => False.elim (hji hij.symm), ih (!b) j hv⟩ + +theorem signed_reduced_sphere (b : Bool) (k : ℕ) {w : List ι} + (hw : w ∈ sphere (ι := ι) k) : FreeGroup.IsReduced (signed b w) := by + cases k with + | zero => + have : w = [] := by simpa [sphere] using hw + subst w + exact FreeGroup.IsReduced.nil + | succ k => + simp only [sphere, Finset.mem_biUnion, Finset.mem_image] at hw + obtain ⟨j, _, v, hv, rfl⟩ := hw + exact signed_reduced_paths b j k hv + +def vertex (b : Bool) (w : List ι) : FreeGroup ι := FreeGroup.mk (signed b w) + +theorem toWord_vertex (b : Bool) (k : ℕ) {w : List ι} + (hw : w ∈ sphere (ι := ι) k) : (vertex b w).toWord = signed b w := by + rw [vertex, FreeGroup.toWord_mk, (signed_reduced_sphere b k hw).reduce_eq] + +theorem vertex_injOn (b : Bool) (k : ℕ) : + Set.InjOn (vertex (ι := ι) b) (↑(sphere (ι := ι) k) : Set (List ι)) := by + intro u hu v hv huv + have hh := congrArg FreeGroup.toWord huv + rw [toWord_vertex b k hu, toWord_vertex b k hv] at hh + exact signed_injective b hh + +theorem sum_sphere_succ {E : Type uE} [AddCommMonoid E] (f : List ι → E) (k : ℕ) : + ∑ w ∈ sphere (ι := ι) (k + 1), f w = + ∑ j : ι, ∑ w ∈ paths j k, f (j :: w) := by + rw [sphere, Finset.sum_biUnion (fun i _ j _ hij => cons_images_disjoint hij _ _)] + apply Finset.sum_congr rfl + intro j _ + exact Finset.sum_image (fun _ _ _ _ h => (List.cons.inj h).2) + +theorem sum_paths_succ {E : Type uE} [AddCommMonoid E] (f : List ι → E) (i : ι) (k : ℕ) : + ∑ w ∈ paths i (k + 1), f w = + ∑ j ∈ Finset.univ.erase i, ∑ w ∈ paths j k, f (j :: w) := by + rw [paths, Finset.sum_biUnion (fun a _ b _ hab => cons_images_disjoint hab _ _)] + apply Finset.sum_congr rfl + intro j _ + exact Finset.sum_image (fun _ _ _ _ h => (List.cons.inj h).2) + +omit [DecidableEq ι] [Fintype ι] in +@[simp] theorem vertex_nil (b : Bool) : vertex (ι := ι) b [] = 1 := rfl + +omit [DecidableEq ι] [Fintype ι] in +@[simp] theorem vertex_cons_true (i : ι) (w : List ι) : + vertex true (i :: w) = FreeGroup.of i * vertex false w := by + rfl + +omit [DecidableEq ι] [Fintype ι] in +@[simp] theorem vertex_cons_false (i : ι) (w : List ι) : + vertex false (i :: w) = (FreeGroup.of i)⁻¹ * vertex true w := by + rfl + +def shell (b : Bool) (k : ℕ) : FreeGroup ι →₀ ℝ := + ∑ w ∈ sphere k, Finsupp.single (vertex b w) 1 + +def shift (g : FreeGroup ι) : (FreeGroup ι →₀ ℝ) →ₗ[ℝ] (FreeGroup ι →₀ ℝ) := + (Finsupp.domLCongr (Equiv.mulLeft g)).toLinearMap + +omit [DecidableEq ι] [Fintype ι] in +@[simp] theorem shift_single (g a : FreeGroup ι) (r : ℝ) : + shift g (Finsupp.single a r) = Finsupp.single (g * a) r := by + exact Finsupp.equivMapDomain_single (Equiv.mulLeft g) a r + +def sumShift : (FreeGroup ι →₀ ℝ) →ₗ[ℝ] (FreeGroup ι →₀ ℝ) := + ∑ i : ι, shift (FreeGroup.of i) + +omit [DecidableEq ι] in +@[simp] theorem sumShift_apply (h : FreeGroup ι →₀ ℝ) : + sumShift h = ∑ i : ι, shift (FreeGroup.of i) h := by + simp [sumShift] + +@[simp] theorem shell_zero (b : Bool) : shell (ι := ι) b 0 = Finsupp.single 1 1 := by + simp [shell, sphere] + +theorem shell_succ (b : Bool) (k : ℕ) : + shell (ι := ι) b (k + 1) = + ∑ j : ι, ∑ w ∈ paths j k, Finsupp.single (vertex b (j :: w)) 1 := by + exact sum_sphere_succ _ _ + +theorem outward_shell (k : ℕ) : + (∑ j : ι, ∑ w ∈ paths j k, ∑ i ∈ Finset.univ.erase j, + Finsupp.single (FreeGroup.of i * vertex false (j :: w)) (1 : ℝ)) = + shell (ι := ι) true (k + 2) := by + rw [shell_succ] + simp only [sum_paths_succ] + simp_rw [vertex_cons_true] + simp_rw [Finset.sum_comm (s := paths _ _) (t := Finset.univ.erase _)] + apply Finset.sum_comm' + intro x y + simp [ne_comm, and_comm] + +theorem sumShift_shell (k : ℕ) : + sumShift (shell (ι := ι) false (k + 1)) = + (∑ j : ι, ∑ w ∈ paths j k, Finsupp.single (vertex true w) (1 : ℝ)) + + shell (ι := ι) true (k + 2) := by + rw [shell_succ, map_sum] + simp only [map_sum, sumShift_apply, shift_single] + have hs (j : ι) (w : List ι) : + (∑ i : ι, Finsupp.single (FreeGroup.of i * vertex false (j :: w)) (1 : ℝ)) = + Finsupp.single (vertex true w) 1 + + ∑ i ∈ Finset.univ.erase j, + Finsupp.single (FreeGroup.of i * vertex false (j :: w)) 1 := by + rw [← Finset.sum_erase_add _ _ (Finset.mem_univ j)] + simp [add_comm, vertex_cons_false] + simp_rw [hs, Finset.sum_add_distrib] + rw [outward_shell] + +theorem sumShift_shell_one : + sumShift (shell (ι := ι) false 1) = + (Fintype.card ι : ℝ) • Finsupp.single 1 1 + shell (ι := ι) true 2 := by + rw [show 1 = 0 + 1 from rfl, sumShift_shell] + simp [paths, Nat.cast_smul_eq_nsmul] + +theorem inward_shell [Nonempty ι] (k : ℕ) : + (∑ j : ι, ∑ w ∈ paths j (k + 1), Finsupp.single (vertex true w) (1 : ℝ)) = + ((Fintype.card ι - 1 : ℕ) : ℝ) • shell (ι := ι) true (k + 1) := by + simp_rw [sum_paths_succ, Finset.sum_erase_eq_sub (Finset.mem_univ _)] + rw [Finset.sum_sub_distrib] + simp only [Finset.sum_const, Finset.card_univ] + rw [← shell_succ, ← Nat.cast_smul_eq_nsmul ℝ, Nat.cast_sub Fintype.card_pos, + Nat.cast_one, sub_smul, one_smul] + +theorem sumShift_shell_succ [Nonempty ι] (k : ℕ) : + sumShift (shell (ι := ι) false (k + 2)) = + ((Fintype.card ι - 1 : ℕ) : ℝ) • shell (ι := ι) true (k + 1) + + shell (ι := ι) true (k + 3) := by + rw [show k + 2 = (k + 1) + 1 from rfl, sumShift_shell, inward_shell] + +def vertices (b : Bool) (k : ℕ) : Finset (FreeGroup ι) := + (sphere k).image (vertex b) + +theorem shell_eq_sum_vertices (b : Bool) (k : ℕ) : + shell (ι := ι) b k = ∑ g ∈ vertices b k, Finsupp.single g 1 := by + rw [vertices, Finset.sum_image (vertex_injOn b k)] + rfl + +@[simp] theorem shell_apply (b : Bool) (k : ℕ) (g : FreeGroup ι) : + shell (ι := ι) b k g = if g ∈ vertices b k then 1 else 0 := by + rw [shell_eq_sum_vertices] + simp [Finsupp.single_apply] + +@[simp] theorem shell_support (b : Bool) (k : ℕ) : + (shell (ι := ι) b k).support = vertices b k := by + ext g + simp only [Finsupp.mem_support_iff, shell_apply] + split_ifs <;> simp_all + +theorem card_vertices (b : Bool) (k : ℕ) : + (vertices (ι := ι) b k).card = (sphere (ι := ι) k).card := + Finset.card_image_iff.mpr (vertex_injOn b k) + +theorem vertices_disjoint (b c : Bool) {k l : ℕ} (hkl : k ≠ l) : + Disjoint (vertices (ι := ι) b k) (vertices (ι := ι) c l) := by + apply Finset.disjoint_left.mpr + intro g hg hk + obtain ⟨u, hu, rfl⟩ := Finset.mem_image.mp hg + obtain ⟨v, hv, hveq⟩ := Finset.mem_image.mp hk + have heq := congrArg (fun x : FreeGroup ι => x.toWord.length) hveq + rw [toWord_vertex c l hv, toWord_vertex b k hu, signed_length, + signed_length, sphere_mem_length l hv, sphere_mem_length k hu] at heq + exact hkl heq.symm + +end + +def rightShell (m k : ℕ) : FreeGroup (Fin m) →₀ ℝ := + (1 / ((m : ℝ) * ((m : ℝ) - 1) ^ k)) • shell false (2 * k + 1) + +def leftShell (m k : ℕ) : FreeGroup (Fin m) →₀ ℝ := + (1 / ((m : ℝ) * ((m : ℝ) - 1) ^ k)) • shell true (2 * k + 2) + +theorem sqNorm_shell_succ (m k : ℕ) (hm : 1 ≤ m) (b : Bool) : + coefficientSqNorm (shell (ι := Fin m) b (k + 1)) = + (m : ℝ) * ((m : ℝ) - 1) ^ k := by + classical + rw [coefficientSqNorm, Finsupp.sum, shell_support] + have hs : (∑ g ∈ vertices (ι := Fin m) b (k + 1), (shell b (k + 1) g) ^ 2) = + ((vertices (ι := Fin m) b (k + 1)).card : ℝ) := by + simp only [shell_apply] + simp + rw [hs, card_vertices, card_sphere_succ] + simp [Nat.cast_sub hm] + +theorem sumShift_rightShell_zero (m : ℕ) (hm : 2 ≤ m) : + sumShift (rightShell m 0) = Finsupp.single 1 1 + leftShell m 0 := by + have hm0 : (m : ℝ) ≠ 0 := by exact_mod_cast (by omega : m ≠ 0) + rw [rightShell, map_smul] + simp only [mul_zero, zero_add] + rw [sumShift_shell_one, smul_add, smul_smul] + simp [leftShell, hm0] + +theorem sumShift_rightShell_succ (m k : ℕ) (hm : 2 ≤ m) : + sumShift (rightShell m (k + 1)) = leftShell m k + leftShell m (k + 1) := by + let : NeZero m := ⟨by omega⟩ + have hm1 : 1 ≤ m := by omega + have hm0 : (m : ℝ) ≠ 0 := by exact_mod_cast (by omega : m ≠ 0) + have hq0 : (m : ℝ) - 1 ≠ 0 := by + have : (2 : ℝ) ≤ m := by exact_mod_cast hm + linarith + rw [rightShell, map_smul, show 2 * (k + 1) + 1 = (2 * k + 1) + 2 by omega, + sumShift_shell_succ, smul_add, smul_smul] + simp only [Fintype.card_fin, Nat.cast_sub hm1, Nat.cast_one, leftShell] + have heq : 1 / ((m : ℝ) * ((m : ℝ) - 1) ^ (k + 1)) * ((m : ℝ) - 1) = + 1 / ((m : ℝ) * ((m : ℝ) - 1) ^ k) := by + rw [pow_succ] + field_simp + rw [heq] + congr 2 + +theorem sqNorm_rightShell (m k : ℕ) (hm : 2 ≤ m) : + coefficientSqNorm (rightShell m k) = 1 / (m : ℝ) := by + have hm1 : 1 ≤ m := by omega + have hm0 : (m : ℝ) ≠ 0 := by exact_mod_cast (by omega : m ≠ 0) + have hq0 : (m : ℝ) - 1 ≠ 0 := by + have : (2 : ℝ) ≤ m := by exact_mod_cast hm + linarith + rw [rightShell, coefficientSqNorm_smul, sqNorm_shell_succ m (2 * k) hm1] + rw [show 2 * k = k * 2 by omega, pow_mul] + field_simp + +theorem sqNorm_leftShell (m k : ℕ) (hm : 2 ≤ m) : + coefficientSqNorm (leftShell m k) = ((m : ℝ) - 1) / (m : ℝ) := by + have hm1 : 1 ≤ m := by omega + have hm0 : (m : ℝ) ≠ 0 := by exact_mod_cast (by omega : m ≠ 0) + have hq0 : (m : ℝ) - 1 ≠ 0 := by + have : (2 : ℝ) ≤ m := by exact_mod_cast hm + linarith + rw [leftShell, coefficientSqNorm_smul, + show 2 * k + 2 = (2 * k + 1) + 1 by omega, sqNorm_shell_succ m (2 * k + 1) hm1, + pow_succ ((m : ℝ) - 1) (2 * k), show 2 * k = k * 2 by omega, pow_mul] + field_simp + +def partialInverse (m N : ℕ) : FreeGroup (Fin m) →₀ ℝ := + ∑ k ∈ Finset.range N, (-1 : ℝ) ^ k • rightShell m k + +@[simp] theorem partialInverse_zero (m : ℕ) : partialInverse m 0 = 0 := by + simp [partialInverse] + +theorem partialInverse_succ (m N : ℕ) : + partialInverse m (N + 1) = partialInverse m N + (-1 : ℝ) ^ N • rightShell m N := by + exact Finset.sum_range_succ _ _ + +theorem sumShift_partialInverse (m N : ℕ) (hm : 2 ≤ m) : + sumShift (partialInverse m (N + 1)) = + Finsupp.single 1 1 + (-1 : ℝ) ^ N • leftShell m N := by + induction N with + | zero => simp only [partialInverse_succ, partialInverse_zero, pow_zero, one_smul, + zero_add, sumShift_rightShell_zero m hm] + | succ N ih => + rw [partialInverse_succ, map_add, ih, map_smul, sumShift_rightShell_succ m N hm] + simp only [pow_succ, mul_neg_one, neg_smul, smul_add] + abel + +theorem rightShell_disjoint (m : ℕ) {j k : ℕ} (hjk : j ≠ k) : + Disjoint (rightShell m j).support (rightShell m k).support := by + exact Finset.disjoint_of_subset_left Finsupp.support_smul + (Finset.disjoint_of_subset_right Finsupp.support_smul + (by rw [shell_support, shell_support]; exact vertices_disjoint _ _ (by omega))) + +theorem leftShell_disjoint (m : ℕ) {j k : ℕ} (hjk : j ≠ k) : + Disjoint (leftShell m j).support (leftShell m k).support := by + exact Finset.disjoint_of_subset_left Finsupp.support_smul + (Finset.disjoint_of_subset_right Finsupp.support_smul + (by rw [shell_support, shell_support]; exact vertices_disjoint _ _ (by omega))) + +theorem sqNorm_partialInverse (m N : ℕ) (hm : 2 ≤ m) : + coefficientSqNorm (partialInverse m N) = (N : ℝ) / m := by + rw [partialInverse, coefficientSqNorm_sum_of_disjoint] + · have hsign (k : ℕ) : ((-1 : ℝ) ^ k) ^ 2 = 1 := by + rw [← pow_mul, Nat.mul_comm, pow_mul] + norm_num + simp [coefficientSqNorm_smul, sqNorm_rightShell m _ hm, hsign, div_eq_mul_inv] + · intro i _ j _ hij + exact Finset.disjoint_of_subset_left Finsupp.support_smul + (Finset.disjoint_of_subset_right Finsupp.support_smul (rightShell_disjoint m hij)) + +def averagedInverse (m N : ℕ) : FreeGroup (Fin m) →₀ ℝ := + (1 / (N + 1 : ℝ)) • ∑ k ∈ Finset.range (N + 1), partialInverse m (k + 1) + +theorem sumShift_averagedInverse (m N : ℕ) (hm : 2 ≤ m) : + sumShift (averagedInverse m N) - Finsupp.single 1 1 = + (1 / (N + 1 : ℝ)) • + ∑ k ∈ Finset.range (N + 1), (-1 : ℝ) ^ k • leftShell m k := by + rw [averagedInverse, map_smul, map_sum] + simp_rw [sumShift_partialInverse m _ hm] + rw [Finset.sum_add_distrib, Finset.sum_const, Finset.card_range, + smul_add, ← Nat.cast_smul_eq_nsmul ℝ, smul_smul] + have hN : (N + 1 : ℝ) ≠ 0 := by positivity + simp [hN] + +theorem sqNorm_averagedInverse_le (m N : ℕ) (hm : 2 ≤ m) : + coefficientSqNorm (averagedInverse m N) ≤ (N + 1 : ℝ) / m := by + have hmpos : (0 : ℝ) < m := by exact_mod_cast (by omega : 0 < m) + have hNpos : (0 : ℝ) < N + 1 := by positivity + have hb : coefficientSqNorm (∑ k ∈ Finset.range (N + 1), partialInverse m (k + 1)) ≤ + (N + 1 : ℝ) ^ 2 * ((N + 1 : ℝ) / m) := by + calc + _ ≤ ((Finset.range (N + 1)).card : ℝ) * + ∑ k ∈ Finset.range (N + 1), coefficientSqNorm (partialInverse m (k + 1)) := + coefficientSqNorm_sum_le _ _ + _ ≤ ((Finset.range (N + 1)).card : ℝ) * + ∑ _k ∈ Finset.range (N + 1), (N + 1 : ℝ) / m := by + gcongr with k hk + rw [sqNorm_partialInverse m (k + 1) hm] + apply div_le_div_of_nonneg_right _ hmpos.le + exact_mod_cast (by have := Finset.mem_range.mp hk; omega : k + 1 ≤ N + 1) + _ = _ := by simp [pow_two, mul_assoc] + rw [averagedInverse, coefficientSqNorm_smul] + calc + _ ≤ (1 / (N + 1 : ℝ)) ^ 2 * ((N + 1 : ℝ) ^ 2 * ((N + 1 : ℝ) / m)) := + mul_le_mul_of_nonneg_left hb (sq_nonneg _) + _ = _ := by field_simp + +theorem sqNorm_averagedInverse_residual (m N : ℕ) (hm : 2 ≤ m) : + coefficientSqNorm (sumShift (averagedInverse m N) - Finsupp.single 1 1) = + ((m : ℝ) - 1) / ((m : ℝ) * (N + 1 : ℝ)) := by + rw [sumShift_averagedInverse m N hm, coefficientSqNorm_smul, + coefficientSqNorm_sum_of_disjoint] + · have hsign (k : ℕ) : ((-1 : ℝ) ^ k) ^ 2 = 1 := by + rw [← pow_mul, Nat.mul_comm, pow_mul] + norm_num + simp only [coefficientSqNorm_smul, hsign, sqNorm_leftShell m _ hm, one_mul, + Finset.sum_const, Finset.card_range, nsmul_eq_mul, Nat.cast_add, Nat.cast_one] + field_simp + · intro i _ j _ hij + exact Finset.disjoint_of_subset_left Finsupp.support_smul + (Finset.disjoint_of_subset_right Finsupp.support_smul (leftShell_disjoint m hij)) + +theorem sqNorm_averagedInverse_residual_le (m N : ℕ) (hm : 2 ≤ m) : + coefficientSqNorm (sumShift (averagedInverse m N) - Finsupp.single 1 1) ≤ + 1 / (N + 1 : ℝ) := by + rw [sqNorm_averagedInverse_residual m N hm] + have hmpos : (0 : ℝ) < m := by exact_mod_cast (by omega : 0 < m) + have hNpos : (0 : ℝ) < N + 1 := by positivity + apply (div_le_iff₀ (mul_pos hmpos hNpos)).mpr + field_simp + linarith + +def prefixSumOperator (m : ℕ) (h : FreeGroup (Fin m) →₀ ℝ) : FreeGroup (Fin m) →₀ ℝ := + h + sumShift h + +theorem sqNorm_prefixSum_residual_le (m N : ℕ) (hm : 2 ≤ m) : + coefficientSqNorm (prefixSumOperator m (averagedInverse m N) - Finsupp.single 1 1) ≤ + 2 * ((N + 1 : ℝ) / m + 1 / (N + 1 : ℝ)) := by + rw [prefixSumOperator, add_sub_assoc] + exact (coefficientSqNorm_add_le _ _).trans + (mul_le_mul_of_nonneg_left + (add_le_add (sqNorm_averagedInverse_le m N hm) + (sqNorm_averagedInverse_residual_le m N hm)) (by norm_num)) + +theorem exists_small_prefix_inverse (ε : ℝ) (hε : 0 < ε) : + ∃ m : ℕ, 2 ≤ m ∧ ∃ h : FreeGroup (Fin m) →₀ ℝ, + coefficientSqNorm h < ε ∧ + coefficientSqNorm (prefixSumOperator m h - Finsupp.single 1 1) < ε := by + obtain ⟨N, hN⟩ := exists_nat_one_div_lt (by positivity : 0 < ε / 4) + obtain ⟨m, hm⟩ := exists_nat_gt (max (2 : ℝ) (4 * (N + 1 : ℝ) / ε)) + have hm2 : 2 ≤ m := by + have := (le_max_left (2 : ℝ) _).trans_lt hm + exact_mod_cast this.le + have hmpos : (0 : ℝ) < m := by exact_mod_cast (by omega : 0 < m) + have hsmall : (N + 1 : ℝ) / m < ε / 4 := by + apply (div_lt_iff₀ hmpos).mpr + have h := (le_max_right (2 : ℝ) _).trans_lt hm + have h' := (div_lt_iff₀ hε).mp h + nlinarith + refine ⟨m, hm2, averagedInverse m N, ?_, ?_⟩ + · exact (sqNorm_averagedInverse_le m N hm2).trans_lt (hsmall.trans (by linarith)) + · exact (sqNorm_prefixSum_residual_le m N hm2).trans_lt (by linarith) + +end Radial +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/RankTwoCoefficients.lean b/lean/OAI/Analysis/FreeGroupFactor/RankTwoCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..aab844815a4fb2a937c445be7d8c781f0dd2dbb0 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/RankTwoCoefficients.lean @@ -0,0 +1,577 @@ +import OAI.Analysis.FreeGroupFactor.RankTwoCounting + +namespace OAI + +noncomputable section + +universe uG uH uK uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +attribute [local instance] Classical.propDecidable + +namespace FreeGroupFactorMain + +namespace RankTwo + +def tupleSphere (m l : ℕ) : Finset (Fin l → Fin m) := + Finset.univ.filter (fun x => List.ofFn x ∈ Radial.sphere l) + +theorem tupleSphere_image (m l : ℕ) : + (tupleSphere m l).image List.ofFn = Radial.sphere l := by + classical + ext w + constructor + · intro hw + obtain ⟨x,hx,rfl⟩ := Finset.mem_image.mp hw + exact (Finset.mem_filter.mp hx).2 + · intro hw + have hl := Radial.sphere_mem_length l hw + subst l + refine Finset.mem_image.mpr ⟨w.get,?_,List.ofFn_get w⟩ + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,by simpa only [List.ofFn_get] using hw⟩ + +theorem shell_eq_tuple (m l : ℕ) (b : Bool) : + Radial.shell (ι := Fin m) b l = + ∑ x ∈ tupleSphere m l, Finsupp.single (patternWord (alternating b l) x) (1 : ℝ) := by + classical + unfold Radial.shell + rw [← tupleSphere_image,Finset.sum_image (fun _ _ _ _ he => List.ofFn_injective he)] + simp only [vertex_ofFn] + +theorem pair_push_pattern_le {m l k B r : ℕ} (hB : m*(l+k) < B) (hb : 2 ≤ B) + (b : Fin l → Bool) (c : Fin k → Bool) + (eP : Fin r ≃ {i // pairColors b c i = true}) + (eN : Fin r ≃ {i // pairColors b c i = false}) + (hc : ∑ i, boolSign (b i) = ∑ j, boolSign (c j)) + (s : Finset (Fin l → Fin m)) (t : Finset (Fin k → Fin m)) : + coefficientPair + (pushCoefficients (prefixHom B m) (∑ x ∈ s, Finsupp.single (patternWord b x) 1)) + (pushCoefficients (prefixHom B m) (∑ y ∈ t, Finsupp.single (patternWord c y) 1)) ≤ + (m : ℝ)^r * r^r := by + classical + simp only [map_sum,pushCoefficients_single] + rw [coefficientPair_shells] + have hh := card_patternCollisions_le hB hb b c eP eN hc + ((s ×ˢ t).filter (fun p => prefixHom B m (patternWord b p.1) = prefixHom B m (patternWord c p.2))) + (fun p hp => (Finset.mem_filter.mp hp).2) + convert (Nat.cast_le (α := ℝ)).mpr hh using 1 + all_goals push_cast + all_goals (first | rfl | congr 4) + +theorem pair_push_pattern_le_free_add {m l k B r : ℕ} (hB : m*(l+k) < B) (hb : 2 ≤ B) + (b : Fin l → Bool) (c : Fin k → Bool) + (eP : Fin r ≃ {i // pairColors b c i = true}) + (eN : Fin r ≃ {i // pairColors b c i = false}) + (hc : ∑ i, boolSign (b i) = ∑ j, boolSign (c j)) + (s : Finset (Fin l → Fin m)) (t : Finset (Fin k → Fin m)) : + coefficientPair + (pushCoefficients (prefixHom B m) (∑ x ∈ s, Finsupp.single (patternWord b x) 1)) + (pushCoefficients (prefixHom B m) (∑ y ∈ t, Finsupp.single (patternWord c y) 1)) ≤ + coefficientPair (∑ x ∈ s, Finsupp.single (patternWord b x) 1) + (∑ y ∈ t, Finsupp.single (patternWord c y) 1) + (r^2*r^r : ℝ)*m^(r-1) := by + classical + simp only [map_sum,pushCoefficients_single] + rw [coefficientPair_shells,coefficientPair_shells] + convert (Nat.cast_le (α := ℝ)).mpr (card_patternCollisions_le_free_add hB hb b c eP eN hc (s ×ˢ t)) using 1 + all_goals push_cast + all_goals (first | rfl | congr 4) + +theorem right_pairColors_card (k : ℕ) (d : Bool) : + Fintype.card {i // pairColors (alternating false (2*k+1)) (alternating false (2*k+1)) i = d} = + 2*k+1 := by + cases d + · rw [card_pairColors_neg] + simp only [card_alternating_pos,card_alternating_neg,positiveCount_odd,Bool.false_eq_true, + ↓reduceIte,zero_add] + omega + · rw [card_pairColors_pos] + simp only [card_alternating_pos,card_alternating_neg,positiveCount_odd,Bool.false_eq_true, + ↓reduceIte,zero_add] + omega + +theorem positiveCount_even_add_two (b : Bool) (k : ℕ) : positiveCount b (2*k+2) = k+1 := by + rw [positiveCount_two,positiveCount_even] + omega + +theorem left_pairColors_card (k l : ℕ) (d : Bool) : + Fintype.card {i // pairColors (alternating true (2*k+2)) (alternating true (2*l+2)) i = d} = + k+l+2 := by + cases d + · rw [card_pairColors_neg] + simp only [card_alternating_pos,card_alternating_neg,positiveCount_even_add_two] + omega + · rw [card_pairColors_pos] + simp only [card_alternating_pos,card_alternating_neg,positiveCount_even_add_two] + omega + +theorem pair_shell_right_le {m k B : ℕ} (hB : m*((2*k+1)+(2*k+1)) < B) (hb : 2 ≤ B) : + coefficientPair (pushCoefficients (prefixHom B m) (Radial.shell false (2*k+1))) + (pushCoefficients (prefixHom B m) (Radial.shell false (2*k+1))) ≤ + (m : ℝ)^(2*k+1) * (2*k+1 : ℝ)^(2*k+1) := by + let eP : Fin (2*k+1) ≃ {i // pairColors (alternating false (2*k+1)) (alternating false (2*k+1)) i = true} := + (Fintype.equivFinOfCardEq (right_pairColors_card k true)).symm + let eN : Fin (2*k+1) ≃ {i // pairColors (alternating false (2*k+1)) (alternating false (2*k+1)) i = false} := + (Fintype.equivFinOfCardEq (right_pairColors_card k false)).symm + rw [shell_eq_tuple m _ false] + convert pair_push_pattern_le hB hb _ _ eP eN rfl (tupleSphere m _) (tupleSphere m _) using 1 + all_goals push_cast + all_goals rfl + +theorem pair_shell_left_le_free_add {m k l B : ℕ} (hB : m*((2*k+2)+(2*l+2)) < B) (hb : 2 ≤ B) : + coefficientPair (pushCoefficients (prefixHom B m) (Radial.shell true (2*k+2))) + (pushCoefficients (prefixHom B m) (Radial.shell true (2*l+2))) ≤ + coefficientPair (Radial.shell (ι := Fin m) true (2*k+2)) (Radial.shell true (2*l+2)) + + ((k+l+2 : ℝ)^2*(k+l+2 : ℝ)^(k+l+2))*(m : ℝ)^(k+l+1) := by + let eP : Fin (k+l+2) ≃ {i // pairColors (alternating true (2*k+2)) (alternating true (2*l+2)) i = true} := + (Fintype.equivFinOfCardEq (left_pairColors_card k l true)).symm + let eN : Fin (k+l+2) ≃ {i // pairColors (alternating true (2*k+2)) (alternating true (2*l+2)) i = false} := + (Fintype.equivFinOfCardEq (left_pairColors_card k l false)).symm + have hc : ∑ i, boolSign (alternating true (2*k+2) i) = ∑ i, boolSign (alternating true (2*l+2) i) := by + rw [alternating_charge,alternating_charge,positiveCount_even_add_two,positiveCount_even_add_two] + push_cast + ring + rw [shell_eq_tuple m _ true,shell_eq_tuple m _ true] + convert pair_push_pattern_le_free_add hB hb _ _ eP eN hc (tupleSphere m _) (tupleSphere m _) using 1 + all_goals push_cast + all_goals rfl + +end RankTwo + +theorem coefficientPair_nonneg {G : Type uG} (h k : G →₀ ℝ) + (hh : ∀ g, 0 ≤ h g) (hk : ∀ g, 0 ≤ k g) : 0 ≤ coefficientPair h k := by + exact Finset.sum_nonneg (fun g _ => mul_nonneg (hh g) (hk g)) + +theorem coefficientPair_eq_zero_of_disjoint {G : Type uG} (h k : G →₀ ℝ) + (hd : Disjoint h.support k.support) : coefficientPair h k = 0 := by + classical + apply Finset.sum_eq_zero + intro g hg + have hk : k g = 0 := by + by_contra hn + exact Finset.disjoint_left.mp hd hg (Finsupp.mem_support_iff.mpr hn) + simp [hk] + +theorem pushCoefficients_nonneg {G : Type uG} {H : Type uH} [Group G] [Group H] + (f : G →* H) (h : G →₀ ℝ) (hh : ∀ g, 0 ≤ h g) (a : H) : + 0 ≤ pushCoefficients f h a := by + classical + change 0 ≤ Finsupp.mapDomain f h a + rw [Finsupp.mapDomain,Finsupp.sum_apply] + apply Finset.sum_nonneg + intro g _ + change 0 ≤ Finsupp.single (f g) (h g) a + rw [Finsupp.single_apply] + split_ifs + · exact hh g + · rfl + +namespace RankTwo + +def shellWeight (m k : ℕ) : ℝ := 1 / ((m : ℝ)*((m : ℝ)-1)^k) + +theorem shellWeight_nonneg {m : ℕ} (hm : 2 ≤ m) (k : ℕ) : 0 ≤ shellWeight m k := by + have hm' : (2 : ℝ) ≤ m := by exact_mod_cast hm + have hq : 0 ≤ (m : ℝ)-1 := by linarith + unfold shellWeight + positivity + +theorem shellWeight_product_bound {m : ℕ} (hm : 2 ≤ m) (k l : ℕ) : + shellWeight m k * shellWeight m l * (m : ℝ)^(k+l+1) ≤ 2^(k+l)/(m : ℝ) := by + have hm' : (2 : ℝ) ≤ m := by exact_mod_cast hm + have hp : (0 : ℝ) < m := by linarith + have hq : (0 : ℝ) < (m : ℝ)-1 := by linarith + have he : shellWeight m k * shellWeight m l * (m : ℝ)^(k+l+1) = + ((m : ℝ)/((m : ℝ)-1))^(k+l)/(m : ℝ) := by + simp only [shellWeight,pow_succ,pow_add,div_pow] + field_simp + rw [he] + apply div_le_div_of_nonneg_right _ hp.le + apply pow_le_pow_left₀ (by positivity) + apply (div_le_iff₀ hq).mpr + linarith + +def rightConstant (k : ℕ) : ℝ := 2^(2*k)*(2*k+1 : ℝ)^(2*k+1) +def leftConstant (k l : ℕ) : ℝ := 2^(k+l)*(k+l+2 : ℝ)^2*(k+l+2 : ℝ)^(k+l+2) + +theorem pair_rightShell_le {m k B : ℕ} (hm : 2 ≤ m) + (hB : m*((2*k+1)+(2*k+1)) < B) (hb : 2 ≤ B) : + coefficientSqNorm (pushCoefficients (prefixHom B m) (Radial.rightShell m k)) ≤ + rightConstant k / m := by + rw [Radial.rightShell,map_smul,coefficientSqNorm_smul,← coefficientPair_self] + change (shellWeight m k)^2 * _ ≤ _ + calc + _ ≤ (shellWeight m k)^2 * ((m : ℝ)^(2*k+1)*(2*k+1 : ℝ)^(2*k+1)) := + mul_le_mul_of_nonneg_left (pair_shell_right_le hB hb) (sq_nonneg _) + _ = (2*k+1 : ℝ)^(2*k+1) * + (shellWeight m k * shellWeight m k * (m : ℝ)^(k+k+1)) := by + rw [show k+k=2*k by omega]; ring + _ ≤ (2*k+1 : ℝ)^(2*k+1) * (2^(k+k)/(m : ℝ)) := + mul_le_mul_of_nonneg_left (shellWeight_product_bound hm k k) (by positivity) + _ = _ := by rw [show k+k=2*k by omega]; unfold rightConstant; ring + +theorem pair_leftShell_le_free_add {m k l B : ℕ} (hm : 2 ≤ m) + (hB : m*((2*k+2)+(2*l+2)) < B) (hb : 2 ≤ B) : + coefficientPair (pushCoefficients (prefixHom B m) (Radial.leftShell m k)) + (pushCoefficients (prefixHom B m) (Radial.leftShell m l)) ≤ + coefficientPair (Radial.leftShell m k) (Radial.leftShell m l) + leftConstant k l / m := by + simp only [Radial.leftShell,map_smul,coefficientPair_smul_left,coefficientPair_smul_right] + change shellWeight m l * (shellWeight m k * _) ≤ + shellWeight m l * (shellWeight m k * _) + _ + have hh := mul_le_mul_of_nonneg_left (pair_shell_left_le_free_add hB hb) + (mul_nonneg (shellWeight_nonneg hm k) (shellWeight_nonneg hm l)) + have he := mul_le_mul_of_nonneg_left (shellWeight_product_bound hm k l) + (show 0 ≤ (k+l+2 : ℝ)^2*(k+l+2 : ℝ)^(k+l+2) by positivity) + calc + _ = (shellWeight m k * shellWeight m l) * _ := by ring + _ ≤ (shellWeight m k * shellWeight m l) * + (coefficientPair (Radial.shell true (2*k+2)) (Radial.shell true (2*l+2)) + + ((k+l+2 : ℝ)^2*(k+l+2 : ℝ)^(k+l+2))*(m : ℝ)^(k+l+1)) := hh + _ = shellWeight m l * (shellWeight m k * + coefficientPair (Radial.shell true (2*k+2)) (Radial.shell true (2*l+2))) + + ((k+l+2 : ℝ)^2*(k+l+2 : ℝ)^(k+l+2)) * + (shellWeight m k * shellWeight m l * (m : ℝ)^(k+l+1)) := by ring + _ ≤ shellWeight m l * (shellWeight m k * + coefficientPair (Radial.shell true (2*k+2)) (Radial.shell true (2*l+2))) + + ((k+l+2 : ℝ)^2*(k+l+2 : ℝ)^(k+l+2)) * (2^(k+l)/(m : ℝ)) := add_le_add le_rfl he + _ = _ := by unfold leftConstant; ring + +theorem pair_leftShell_free_le {m : ℕ} (hm : 2 ≤ m) (k l : ℕ) : + coefficientPair (Radial.leftShell m k) (Radial.leftShell m l) ≤ if k=l then 1 else 0 := by + classical + by_cases h : k=l + · subst l + rw [ite_eq_left rfl,coefficientPair_self,Radial.sqNorm_leftShell m k hm] + have hp : (0 : ℝ) < m := by exact_mod_cast (by omega : 0 < m) + apply (div_le_iff₀ hp).mpr + linarith + · rw [ite_eq_right h,coefficientPair_eq_zero_of_disjoint _ _ (Radial.leftShell_disjoint m h)] + +theorem leftShell_nonneg {m : ℕ} (hm : 2 ≤ m) (k : ℕ) (g : FreeGroup (Fin m)) : + 0 ≤ Radial.leftShell m k g := by + change 0 ≤ shellWeight m k * Radial.shell true (2*k+2) g + apply mul_nonneg (shellWeight_nonneg hm k) + rw [Radial.shell_apply] + split_ifs <;> norm_num + +theorem pair_leftShell_push_nonneg {m B : ℕ} (hm : 2 ≤ m) (k l : ℕ) : + 0 ≤ coefficientPair (pushCoefficients (prefixHom B m) (Radial.leftShell m k)) + (pushCoefficients (prefixHom B m) (Radial.leftShell m l)) := by + apply coefficientPair_nonneg + · exact pushCoefficients_nonneg _ _ (leftShell_nonneg hm k) + · exact pushCoefficients_nonneg _ _ (leftShell_nonneg hm l) + +def partialConstant (N : ℕ) : ℝ := (N : ℝ)*∑ k ∈ Finset.range N, rightConstant k +def inverseConstant (N : ℕ) : ℝ := + (1/(N+1 : ℝ))^2*(N+1 : ℝ)*∑ k ∈ Finset.range (N+1), partialConstant (k+1) +def residualConstant (N : ℕ) : ℝ := + (1/(N+1 : ℝ))^2*∑ k ∈ Finset.range (N+1), ∑ l ∈ Finset.range (N+1), leftConstant k l + +theorem rightConstant_nonneg (k : ℕ) : 0 ≤ rightConstant k := by unfold rightConstant; positivity +theorem leftConstant_nonneg (k l : ℕ) : 0 ≤ leftConstant k l := by unfold leftConstant; positivity +theorem partialConstant_nonneg (N : ℕ) : 0 ≤ partialConstant N := by + apply mul_nonneg (Nat.cast_nonneg _) + exact Finset.sum_nonneg (fun k _ => rightConstant_nonneg k) +theorem inverseConstant_nonneg (N : ℕ) : 0 ≤ inverseConstant N := by + apply mul_nonneg (by positivity) + exact Finset.sum_nonneg (fun k _ => partialConstant_nonneg _) +theorem residualConstant_nonneg (N : ℕ) : 0 ≤ residualConstant N := by + apply mul_nonneg (sq_nonneg _) + exact Finset.sum_nonneg (fun k _ => Finset.sum_nonneg (fun l _ => leftConstant_nonneg k l)) + +theorem neg_one_pow_sq (k : ℕ) : ((-1 : ℝ)^k)^2 = 1 := by + rw [← pow_mul,Nat.mul_comm,pow_mul] + norm_num + +theorem sqNorm_push_partial_le {m N B : ℕ} (hm : 2 ≤ m) + (hB : m*(4*N+4) < B) (hb : 2 ≤ B) (j : ℕ) (hj : j ≤ N+1) : + coefficientSqNorm (pushCoefficients (prefixHom B m) (Radial.partialInverse m j)) ≤ + partialConstant j / m := by + rw [Radial.partialInverse,map_sum] + calc + _ ≤ ((Finset.range j).card : ℝ)*∑ k ∈ Finset.range j, + coefficientSqNorm (pushCoefficients (prefixHom B m) ((-1 : ℝ)^k • Radial.rightShell m k)) := + coefficientSqNorm_sum_le _ _ + _ ≤ (j : ℝ)*∑ k ∈ Finset.range j, rightConstant k / m := by + rw [Finset.card_range] + apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _) + apply Finset.sum_le_sum + intro k hk + rw [map_smul,coefficientSqNorm_smul,neg_one_pow_sq,one_mul] + apply pair_rightShell_le hm _ hb + have hkN : k ≤ N := by have := Finset.mem_range.mp hk; omega + exact lt_of_le_of_lt (Nat.mul_le_mul_left m (by omega)) hB + _ = _ := by rw [← Finset.sum_div]; unfold partialConstant; ring + +theorem sqNorm_push_inverse_le {m N B : ℕ} (hm : 2 ≤ m) + (hB : m*(4*N+4) < B) (hb : 2 ≤ B) : + coefficientSqNorm (pushCoefficients (prefixHom B m) (Radial.averagedInverse m N)) ≤ + inverseConstant N / m := by + rw [Radial.averagedInverse,map_smul,coefficientSqNorm_smul,map_sum] + calc + _ ≤ (1/(N+1 : ℝ))^2 * (((Finset.range (N+1)).card : ℝ)*∑ k ∈ Finset.range (N+1), + coefficientSqNorm (pushCoefficients (prefixHom B m) (Radial.partialInverse m (k+1)))) := + mul_le_mul_of_nonneg_left (coefficientSqNorm_sum_le _ _) (sq_nonneg _) + _ ≤ (1/(N+1 : ℝ))^2 * ((N+1 : ℝ)*∑ k ∈ Finset.range (N+1), partialConstant (k+1)/m) := by + simp only [Finset.card_range,Nat.cast_add,Nat.cast_one] + apply mul_le_mul_of_nonneg_left _ (sq_nonneg _) + apply mul_le_mul_of_nonneg_left _ (by positivity) + exact Finset.sum_le_sum (fun k hk => sqNorm_push_partial_le hm hB hb (k+1) + (by have := Finset.mem_range.mp hk; omega)) + _ = _ := by rw [← Finset.sum_div]; unfold inverseConstant; ring + +theorem signed_left_pair_le {m B k l : ℕ} (hm : 2 ≤ m) + (hB : m*((2*k+2)+(2*l+2)) < B) (hb : 2 ≤ B) : + (-1 : ℝ)^k * ((-1 : ℝ)^l * + coefficientPair (pushCoefficients (prefixHom B m) (Radial.leftShell m k)) + (pushCoefficients (prefixHom B m) (Radial.leftShell m l))) ≤ + (if k=l then (1 : ℝ) else 0) + leftConstant k l/m := by + have hsign : (-1 : ℝ)^k*(-1 : ℝ)^l ≤ 1 := by + rw [← pow_add] + rcases neg_one_pow_eq_or ℝ (k+l) with h | h <;> simp [h] + have hp := pair_leftShell_push_nonneg (B := B) hm k l + have hsign' := mul_le_mul_of_nonneg_right hsign hp + rw [mul_assoc,one_mul] at hsign' + exact hsign'.trans ((pair_leftShell_le_free_add hm hB hb).trans + (add_le_add (pair_leftShell_free_le hm k l) le_rfl)) + +theorem sqNorm_signed_left_sum_le {m N B : ℕ} (hm : 2 ≤ m) + (hB : m*(4*N+4) < B) (hb : 2 ≤ B) : + coefficientSqNorm (∑ k ∈ Finset.range (N+1), (-1 : ℝ)^k • + pushCoefficients (prefixHom B m) (Radial.leftShell m k)) ≤ + (N+1 : ℝ) + (∑ k ∈ Finset.range (N+1), ∑ l ∈ Finset.range (N+1), leftConstant k l)/m := by + classical + rw [← coefficientPair_self,coefficientPair_sum_left] + simp_rw [coefficientPair_sum_right,coefficientPair_smul_left,coefficientPair_smul_right] + calc + _ ≤ ∑ k ∈ Finset.range (N+1), ∑ l ∈ Finset.range (N+1), + ((if k=l then (1 : ℝ) else 0) + leftConstant k l / m) := by + apply Finset.sum_le_sum + intro k hk + apply Finset.sum_le_sum + intro l hl + apply signed_left_pair_le hm (B := B) (k := k) (l := l) _ hb + have hkN : k ≤ N := by have := Finset.mem_range.mp hk; omega + have hlN : l ≤ N := by have := Finset.mem_range.mp hl; omega + exact lt_of_le_of_lt (Nat.mul_le_mul_left m (by omega)) hB + _ = _ := by + simp only [Finset.sum_add_distrib,← Finset.sum_div] + have hdiag : (∑ k ∈ Finset.range (N+1), ∑ l ∈ Finset.range (N+1), + if k=l then (1 : ℝ) else 0) = N+1 := by + calc + _ = ∑ _k ∈ Finset.range (N+1), (1 : ℝ) := by + apply Finset.sum_congr rfl + intro k hk + simp [hk] + _ = _ := by simp + rw [hdiag] + +theorem sqNorm_push_residual_le {m N B : ℕ} (hm : 2 ≤ m) + (hB : m*(4*N+4) < B) (hb : 2 ≤ B) : + coefficientSqNorm (pushCoefficients (prefixHom B m) + (Radial.sumShift (Radial.averagedInverse m N) - Finsupp.single 1 1)) ≤ + 1/(N+1 : ℝ)+residualConstant N/m := by + rw [Radial.sumShift_averagedInverse m N hm,map_smul,coefficientSqNorm_smul,map_sum] + simp_rw [map_smul] + calc + _ ≤ (1/(N+1 : ℝ))^2 * ((N+1 : ℝ) + + (∑ k ∈ Finset.range (N+1), ∑ l ∈ Finset.range (N+1), leftConstant k l)/m) := + mul_le_mul_of_nonneg_left (sqNorm_signed_left_sum_le hm hB hb) (sq_nonneg _) + _ = _ := by + unfold residualConstant + have hN : (N+1 : ℝ) ≠ 0 := by positivity + field_simp + +theorem exists_small_pushed_inverse (ε : ℝ) (hε : 0 < ε) : + ∃ m B : ℕ, 2 ≤ m ∧ 2 ≤ B ∧ ∃ h : FreeGroup (Fin m) →₀ ℝ, + coefficientSqNorm (pushCoefficients (prefixHom B m) h) < ε ∧ + coefficientSqNorm (pushCoefficients (prefixHom B m) + (Radial.sumShift h-Finsupp.single 1 1)) < ε := by + obtain ⟨N,hN⟩ := exists_nat_one_div_lt (by positivity : 0 < ε/2) + obtain ⟨m,hm⟩ := exists_nat_gt (max (2 : ℝ) (max (2*inverseConstant N/ε) (2*residualConstant N/ε))) + have hm2 : 2 ≤ m := by exact_mod_cast ((le_max_left _ _).trans_lt hm).le + have hmp : (0 : ℝ) < m := by exact_mod_cast (by omega : 0 < m) + have hmI : inverseConstant N/m < ε/2 := by + apply (div_lt_iff₀ hmp).mpr + have hh := (le_max_left (2*inverseConstant N/ε) _).trans_lt ((le_max_right _ _).trans_lt hm) + have hh' := (div_lt_iff₀ hε).mp hh + nlinarith + have hmR : residualConstant N/m < ε/2 := by + apply (div_lt_iff₀ hmp).mpr + have hh := (le_max_right _ (2*residualConstant N/ε)).trans_lt ((le_max_right _ _).trans_lt hm) + have hh' := (div_lt_iff₀ hε).mp hh + nlinarith + let B := m*(4*N+4)+2 + have hB : m*(4*N+4) if i = 0 then syllable true 1 else syllable false 1) + +@[simp] theorem syllabify_generator (b : Bool) : syllabify (twoGenerator b) = syllable b 1 := by + cases b <;> simp [syllabify,twoGenerator] + +@[simp] theorem syllable_zpow (b : Bool) (z : ℤ) : (syllable b 1)^z = syllable b z := by + unfold syllable + rw [← map_zpow] + congr 1 + change Multiplicative.ofAdd (z • (1 : ℤ)) = Multiplicative.ofAdd z + simp + +theorem syllabify_realize : syllabify.comp realize = MonoidHom.id _ := by + apply Monoid.CoprodI.ext_hom + intro b + apply DFunLike.ext + intro z + change syllabify (realize (syllable b (Multiplicative.toAdd z))) = syllable b (Multiplicative.toAdd z) + rw [realize_syllable,map_zpow,syllabify_generator,syllable_zpow] + +theorem realize_injective : Function.Injective realize := by + intro x y he + have hh := congrArg syllabify he + simpa only [← MonoidHom.comp_apply,syllabify_realize,MonoidHom.id_apply] using hh + +end RankTwo + +theorem pushCoefficients_comp {G : Type uG} {H : Type uH} {K : Type uK} [Group G] [Group H] [Group K] + (f : G →* H) (g : H →* K) (h : G →₀ ℝ) : + pushCoefficients (g.comp f) h = pushCoefficients g (pushCoefficients f h) := by + induction h using Finsupp.induction_linear with + | zero => simp + | add h k ih ik => simp only [map_add,ih,ik] + | single a c => simp + +theorem coefficientSqNorm_shift {G : Type uG} [Group G] (g : G) (h : Coeff G) : + coefficientSqNorm (coefficientShift g h) = coefficientSqNorm h := by + rw [coefficientShift,Finsupp.domCongr_apply,Finsupp.equivMapDomain_eq_mapDomain] + exact Finsupp.sum_mapDomain_index_inj (Equiv.mulLeft g).injective + +theorem freeCocycle_zpow_of_zero {ι : Type uι} (h : ι → Coeff (FreeGroup ι)) + (g : FreeGroup ι) (hg : freeCocycle h g = 0) (k : ℤ) : freeCocycle h (g^k) = 0 := by + cases k with + | ofNat k => simpa using freeCocycle_pow_of_zero h g hg k + | negSucc k => simp only [zpow_negSucc,freeCocycle_inv,freeCocycle_pow_of_zero h g hg,map_zero,neg_zero] + +namespace RankTwo + +def concretePrefix (B j : ℕ) : FreeGroup (Fin 2) := realize (segment (runExponent B) 0 j) +def concreteWord (B m : ℕ) : FreeGroup (Fin 2) := concretePrefix B (m+1) * twoGenerator true + +def concretePrefixHom (B m : ℕ) : FreeGroup (Fin m) →* FreeGroup (Fin 2) := + realize.comp (prefixHom B m) + +@[simp] theorem concretePrefixHom_of (B m : ℕ) (i : Fin m) : + concretePrefixHom B m (FreeGroup.of i) = concretePrefix B (i.val+2) := by + simp [concretePrefixHom,prefixHom,concretePrefix] + +@[simp] theorem concretePrefix_zero (B : ℕ) : concretePrefix B 0 = 1 := by simp [concretePrefix] +@[simp] theorem concretePrefix_succ (B j : ℕ) : + concretePrefix B (j+1) = concretePrefix B j * + (twoGenerator true * (twoGenerator false)^(runExponent B j)) := by + simp only [concretePrefix,segment_succ,Nat.zero_add,map_mul,piece,realize_syllable,zpow_one] + +theorem cocycle_twoGenerator_true (h : Coeff (FreeGroup (Fin 2))) : + freeCocycle (firstCoefficients h) (twoGenerator true) = h := by + simp [twoGenerator,firstCoefficients] + +theorem cocycle_twoGenerator_false (h : Coeff (FreeGroup (Fin 2))) : + freeCocycle (firstCoefficients h) (twoGenerator false) = 0 := by + simp [twoGenerator,firstCoefficients] + +theorem cocycle_concretePrefix (B m : ℕ) (h : Coeff (FreeGroup (Fin 2))) : + freeCocycle (firstCoefficients h) (concretePrefix B m) = + ∑ j ∈ Finset.range m, coefficientShift (concretePrefix B j) h := by + induction m with + | zero => simp + | succ m ih => + rw [concretePrefix_succ,freeCocycle_mul,freeCocycle_mul, + cocycle_twoGenerator_true,freeCocycle_zpow_of_zero _ _ (cocycle_twoGenerator_false h)] + simp only [map_zero,add_zero,ih,Finset.sum_range_succ] + +theorem cocycle_concreteWord (B m : ℕ) (h : Coeff (FreeGroup (Fin 2))) : + freeCocycle (firstCoefficients h) (concreteWord B m) = + h + coefficientShift (concretePrefix B 1) h + + ∑ i : Fin m, coefficientShift (concretePrefix B (i.val+2)) h := by + rw [concreteWord,freeCocycle_mul,cocycle_concretePrefix,cocycle_twoGenerator_true, + ← Finset.sum_range_succ] + rw [Finset.sum_range_succ',Finset.sum_range_succ'] + simp only [concretePrefix_zero,coefficientShift_one,Nat.zero_add] + rw [Fin.sum_univ_eq_sum_range (fun k : ℕ => coefficientShift (concretePrefix B (k+2)) h)] + simpa only [Nat.add_assoc,Nat.one_add] using (by abel : + (∑ j ∈ Finset.range m, coefficientShift (concretePrefix B (j+1+1)) h) + + coefficientShift (concretePrefix B 1) h + h = + h + coefficientShift (concretePrefix B 1) h + + (∑ j ∈ Finset.range m, coefficientShift (concretePrefix B (j+2)) h)) + +theorem push_sumShift (B m : ℕ) (h : FreeGroup (Fin m) →₀ ℝ) : + pushCoefficients (concretePrefixHom B m) (Radial.sumShift h) = + ∑ i : Fin m, coefficientShift (concretePrefix B (i.val+2)) + (pushCoefficients (concretePrefixHom B m) h) := by + rw [Radial.sumShift_apply,map_sum] + simp only [pushCoefficients_shift,concretePrefixHom_of] + +theorem rank_two_cocycle_identity (B m : ℕ) (h : FreeGroup (Fin m) →₀ ℝ) : + freeCocycle (firstCoefficients (pushCoefficients (concretePrefixHom B m) h)) (concreteWord B m) = + pushCoefficients (concretePrefixHom B m) h + + coefficientShift (concretePrefix B 1) (pushCoefficients (concretePrefixHom B m) h) + + pushCoefficients (concretePrefixHom B m) (Radial.sumShift h) := by + rw [cocycle_concreteWord,push_sumShift] + +theorem sqNorm_concrete_push (B m : ℕ) (h : FreeGroup (Fin m) →₀ ℝ) : + coefficientSqNorm (pushCoefficients (concretePrefixHom B m) h) = + coefficientSqNorm (pushCoefficients (prefixHom B m) h) := by + rw [concretePrefixHom,pushCoefficients_comp,sqNorm_pushCoefficients realize realize_injective] + +end RankTwo + +theorem smallCocycleTwo (η : ℝ) (hη : 0 < η) : + ∃ (w : FreeGroup (Fin 2)) (h : Coeff (FreeGroup (Fin 2))), + coefficientNorm h < η ∧ + coefficientNorm (freeCocycle (firstCoefficients h) w-Finsupp.single 1 1) < η := by + obtain ⟨m,B,_hm,_hB,h,hh,hr⟩ := RankTwo.exists_small_pushed_inverse (η^2/16) (by positivity) + let f := RankTwo.concretePrefixHom B m + let h₂ := pushCoefficients f h + have hsmall : coefficientSqNorm h₂ < η^2/16 := by + simpa only [h₂,f,RankTwo.sqNorm_concrete_push] using hh + have hrsmall : coefficientSqNorm (pushCoefficients f (Radial.sumShift h-Finsupp.single 1 1)) < η^2/16 := by + simpa only [f,RankTwo.sqNorm_concrete_push] using hr + refine ⟨RankTwo.concreteWord B m,h₂,?_,?_⟩ + · apply (Real.sqrt_lt' hη).mpr + exact hsmall.trans (by nlinarith [sq_pos_of_pos hη]) + · apply (Real.sqrt_lt' hη).mpr + change coefficientSqNorm (freeCocycle (firstCoefficients h₂) (RankTwo.concreteWord B m)-_) < η^2 + have hid : freeCocycle (firstCoefficients h₂) (RankTwo.concreteWord B m)-Finsupp.single 1 1 = + (h₂+coefficientShift (RankTwo.concretePrefix B 1) h₂) + + pushCoefficients f (Radial.sumShift h-Finsupp.single 1 1) := by + dsimp only [h₂,f] + rw [RankTwo.rank_two_cocycle_identity,map_sub] + simp only [pushCoefficients_single,map_one] + abel + rw [hid] + have hshift := coefficientSqNorm_shift (RankTwo.concretePrefix B 1) h₂ + have hsum := coefficientSqNorm_add_le h₂ (coefficientShift (RankTwo.concretePrefix B 1) h₂) + have htot := coefficientSqNorm_add_le (h₂+coefficientShift (RankTwo.concretePrefix B 1) h₂) + (pushCoefficients f (Radial.sumShift h-Finsupp.single 1 1)) + nlinarith + +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/RankTwoCounting.lean b/lean/OAI/Analysis/FreeGroupFactor/RankTwoCounting.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc39cd6d9c5d5ab8066417f84e96a52766f50929 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/RankTwoCounting.lean @@ -0,0 +1,742 @@ +import OAI.Analysis.FreeGroupFactor.RankTwoWords + +namespace OAI + +noncomputable section + +universe uG uI uJ uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +attribute [local instance] Classical.propDecidable + +namespace FreeGroupFactorMain +namespace RankTwo + +section + +theorem top_power_dominates (B L k : ℕ) (hB : L < B) (hk : 0 < k) : + (L : ℤ) * (B : ℤ)^(k-1) < (B : ℤ)^k := by + have hb : (0 : ℤ) < B := by omega + have hp : (0 : ℤ) < (B : ℤ)^(k-1) := pow_pos hb _ + calc + _ < (B : ℤ) * (B : ℤ)^(k-1) := mul_lt_mul_of_pos_right (by exact_mod_cast hB) hp + _ = (B : ℤ)^k := by rw [mul_comm, ← pow_succ]; congr 1; omega + +theorem power_sum_ne_zero {m B L : ℕ} (hB : m * L < B) + (c : Fin m → ℤ) (hc : ∀ i, |c i| ≤ L) (hne : ∃ i, c i ≠ 0) : + ∑ i, c i * (B : ℤ)^i.val ≠ 0 := by + classical + let s : Finset (Fin m) := Finset.univ.filter (fun i => c i ≠ 0) + have hs : s.Nonempty := by obtain ⟨i,hi⟩ := hne; exact ⟨i,by simp [s,hi]⟩ + let j := s.max' hs + have hj : c j ≠ 0 := (Finset.mem_filter.mp (Finset.max'_mem s hs)).2 + have hm : 0 < m := by obtain ⟨i,_⟩ := hne; exact lt_of_le_of_lt (Nat.zero_le i.val) i.is_lt + have hL : 0 < L := by + obtain ⟨i,hi⟩ := hne + have hci := hc i + have : 1 ≤ |c i| := by have := abs_pos.mpr hi; omega + omega + have hb : (0 : ℤ) < B := by + have : 0 < m * L := Nat.mul_pos hm hL + omega + have hvan (i : Fin m) (hij : j < i) : c i = 0 := by + by_contra hi + have him : i ∈ s := by simp [s,hi] + exact (not_lt_of_ge (Finset.le_max' s i him)) hij + have hsplit : (∑ i, c i * (B : ℤ)^i.val) = + c j * (B : ℤ)^j.val + ∑ i ∈ Finset.univ.erase j, c i * (B : ℤ)^i.val := by + rw [← Finset.add_sum_erase Finset.univ _ (Finset.mem_univ j)] + rw [hsplit] + by_cases hj0 : j.val = 0 + · have hrest : ∑ i ∈ Finset.univ.erase j, c i * (B : ℤ)^i.val = 0 := by + apply Finset.sum_eq_zero + intro i hi + have hij : j < i := by + have hine := (Finset.mem_erase.mp hi).1 + have hiv : i.val ≠ j.val := fun h => hine (Fin.ext h) + change j.val < i.val + omega + rw [hvan i hij,zero_mul] + simpa [hrest,hj0] using hj + · have hrest : |∑ i ∈ Finset.univ.erase j, c i * (B : ℤ)^i.val| ≤ + (m : ℤ) * L * (B : ℤ)^(j.val-1) := by + calc + _ ≤ ∑ i ∈ Finset.univ.erase j, |c i * (B : ℤ)^i.val| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _i ∈ Finset.univ.erase j, (L : ℤ) * (B : ℤ)^(j.val-1) := by + apply Finset.sum_le_sum + intro i hi + by_cases hij : i < j + · rw [abs_mul,abs_of_nonneg (pow_nonneg hb.le _)] + gcongr + · exact hc i + · exact_mod_cast (by omega : i.val ≤ j.val-1) + · have hji : j < i := lt_of_le_of_ne (le_of_not_gt hij) + (by exact (Finset.mem_erase.mp hi).1.symm) + rw [hvan i hji,zero_mul,abs_zero] + positivity + _ ≤ (m : ℤ) * L * (B : ℤ)^(j.val-1) := by + simp only [Finset.sum_const, nsmul_eq_mul] + have hcard : ((Finset.univ.erase j).card : ℤ) ≤ m := by + exact_mod_cast (show (Finset.univ.erase j).card ≤ m by simp only [Finset.card_erase_of_mem (Finset.mem_univ j),Finset.card_univ,Fintype.card_fin]; omega) + have hn : 0 ≤ (L : ℤ) * (B : ℤ)^(j.val-1) := by positivity + nlinarith [mul_le_mul_of_nonneg_right hcard hn] + have hdom : (m : ℤ) * L * (B : ℤ)^(j.val-1) < (B : ℤ)^j.val := by + simpa [Nat.cast_mul] using top_power_dominates B (m*L) j.val hB (Nat.pos_of_ne_zero hj0) + have hlead : (B : ℤ)^j.val ≤ |c j * (B : ℤ)^j.val| := by + rw [abs_mul,abs_of_nonneg (pow_nonneg hb.le _)] + have hci : 1 ≤ |c j| := by have := abs_pos.mpr hj; omega + nlinarith [pow_nonneg hb.le j.val] + intro heq + have habs : |c j * (B : ℤ)^j.val| = + |∑ i ∈ Finset.univ.erase j, c i * (B : ℤ)^i.val| := by + have := eq_neg_of_add_eq_zero_left heq + rw [this,abs_neg] + omega + +def bExponentHom : SyllableGroup →* Multiplicative ℤ := + Monoid.CoprodI.lift (fun i => if i then 1 else MonoidHom.id _) + +def bExponent (g : SyllableGroup) : ℤ := Multiplicative.toAdd (bExponentHom g) + +@[simp] theorem bExponent_one : bExponent 1 = 0 := by simp [bExponent] +@[simp] theorem bExponent_mul (g h : SyllableGroup) : bExponent (g*h) = bExponent g+bExponent h := by + simp [bExponent] +@[simp] theorem bExponent_inv (g : SyllableGroup) : bExponent g⁻¹ = -bExponent g := by + simp [bExponent] +@[simp] theorem bExponent_a (z : ℤ) : bExponent (syllable true z) = 0 := by + simp [bExponent,bExponentHom,syllable] +@[simp] theorem bExponent_b (z : ℤ) : bExponent (syllable false z) = z := by + simp [bExponent,bExponentHom,syllable] +@[simp] theorem bExponent_piece (E : ℕ → ℤ) (j : ℕ) : bExponent (piece E j) = E j := by + simp [piece] + +theorem bExponent_segment (B k : ℕ) : + bExponent (segment (runExponent B) 0 k) = (B : ℤ)^k-1 := by + induction k with + | zero => simp + | succ k ih => simp only [segment_succ,bExponent_mul,bExponent_piece,zero_add,ih] + simp only [runExponent,pow_succ] + ring + +def boolSign (b : Bool) : ℤ := if b then 1 else -1 + +@[simp] theorem boolSign_true : boolSign true = 1 := rfl +@[simp] theorem boolSign_false : boolSign false = -1 := rfl +@[simp] theorem boolSign_not (b : Bool) : boolSign (!b) = -boolSign b := by cases b <;> rfl +@[simp] theorem abs_boolSign (b : Bool) : |boolSign b| = 1 := by cases b <;> norm_num [boolSign] + +def labelCoefficient {I : Type uI} [Fintype I] {m : ℕ} + (b : I → Bool) (x : I → Fin m) (j : Fin m) : ℤ := + ∑ i, if x i = j then boolSign (b i) else 0 + +theorem labelCoefficient_abs_le {I : Type uI} [Fintype I] {m : ℕ} + (b : I → Bool) (x : I → Fin m) (j : Fin m) : + |labelCoefficient b x j| ≤ Fintype.card I := by + classical + unfold labelCoefficient + calc + _ ≤ ∑ i, |if x i = j then boolSign (b i) else 0| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _i : I, (1 : ℤ) := by apply Finset.sum_le_sum; intro i _; split_ifs <;> simp + _ = _ := by simp + +theorem labelCoefficient_sum_mul {I : Type uI} [Fintype I] {m : ℕ} + (b : I → Bool) (x : I → Fin m) (f : Fin m → ℤ) : + ∑ j, labelCoefficient b x j * f j = ∑ i, boolSign (b i)*f (x i) := by + classical + simp only [labelCoefficient,Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + simp [ite_mul] + +theorem labelCoefficient_eq_zero {I : Type uI} [Fintype I] {m B : ℕ} + (hB : m * Fintype.card I < B) (hb : 2 ≤ B) + (b : I → Bool) (x : I → Fin m) + (hcharge : ∑ i, boolSign (b i) = 0) + (hexp : ∑ i, boolSign (b i)*((B : ℤ)^((x i).val+2)-1) = 0) : + ∀ j, labelCoefficient b x j = 0 := by + classical + have hn : (B : ℤ) ≠ 0 := by omega + have he : ∑ i, boolSign (b i)*(B : ℤ)^(x i).val = 0 := by + have hh : ∑ i, boolSign (b i)*((B : ℤ)^((x i).val+2)-1) = + (∑ i, boolSign (b i)*(B : ℤ)^(x i).val)*(B : ℤ)^2 - ∑ i, boolSign (b i) := by + simp only [pow_add,mul_sub,mul_one,Finset.sum_sub_distrib,Finset.sum_mul,mul_assoc] + rw [hh,hcharge,sub_zero] at hexp + exact (mul_eq_zero.mp hexp).resolve_right (pow_ne_zero _ hn) + intro j + by_contra hj + have hne := power_sum_ne_zero hB (labelCoefficient b x) (labelCoefficient_abs_le b x) ⟨j,hj⟩ + apply hne + rw [labelCoefficient_sum_mul] + exact he + +def AdjacentValues {m r : ℕ} (p : Fin r → Fin m) : Prop := + ∃ i j, (p i).val + 1 = (p j).val + +def Covers {m r : ℕ} (p q : Fin r → Fin m) : Prop := ∀ i, ∃ j, p j = q i + +theorem covers_iff {m r : ℕ} (p q : Fin r → Fin m) : + Covers p q ↔ ∃ σ : Fin r → Fin r, q = p ∘ σ := by + classical + constructor + · intro h + choose σ hσ using h + exact ⟨σ,funext (fun i => (hσ i).symm)⟩ + · rintro ⟨σ,rfl⟩ i + exact ⟨σ i,rfl⟩ + +def adjacentPairs (m r : ℕ) (i j : Fin r) : Finset (Fin r → Fin m) := + Finset.univ.filter (fun p => (p i).val+1 = (p j).val) + +theorem card_adjacentPairs_le (m r : ℕ) (i j : Fin r) : + (adjacentPairs m r i j).card ≤ m^(r-1) := by + classical + by_cases hij : i = j + · subst j + simp [adjacentPairs] + · let restrict : {p // p ∈ adjacentPairs m r i j} → ({x : Fin r // x ≠ j} → Fin m) := + fun p x => p.val x.val + have hinj : Function.Injective restrict := by + intro p q hpq + apply Subtype.ext + funext x + by_cases hx : x = j + · subst x + have hpi := (Finset.mem_filter.mp p.property).2 + have hqi := (Finset.mem_filter.mp q.property).2 + have hei : p.val i = q.val i := congrFun hpq ⟨i,hij⟩ + apply Fin.ext + omega + · exact congrFun hpq ⟨x,hx⟩ + have hc := Fintype.card_le_of_injective restrict hinj + have hj : Fintype.card {x : Fin r // x ≠ j} = r-1 := by + simp [Fintype.card_subtype_compl] + simpa only [Fintype.card_coe,Fintype.card_fun,Fintype.card_fin,hj] using hc + +def adjacentFunctions (m r : ℕ) : Finset (Fin r → Fin m) := by + classical + exact Finset.univ.filter AdjacentValues + +theorem adjacentFunctions_eq (m r : ℕ) : + adjacentFunctions m r = Finset.univ.biUnion (fun i : Fin r => + Finset.univ.biUnion (fun j : Fin r => adjacentPairs m r i j)) := by + classical + ext p + simp [adjacentFunctions,AdjacentValues,adjacentPairs] + +theorem card_adjacentFunctions_le (m r : ℕ) : + (adjacentFunctions m r).card ≤ r^2 * m^(r-1) := by + classical + rw [adjacentFunctions_eq] + calc + _ ≤ ∑ i : Fin r, (Finset.univ.biUnion (fun j : Fin r => adjacentPairs m r i j)).card := + Finset.card_biUnion_le + _ ≤ ∑ i : Fin r, ∑ j : Fin r, (adjacentPairs m r i j).card := + Finset.sum_le_sum (fun _ _ => Finset.card_biUnion_le) + _ ≤ ∑ _i : Fin r, ∑ _j : Fin r, m^(r-1) := by + gcongr with i _ j _ + exact card_adjacentPairs_le m r i j + _ = _ := by simp [pow_two,Nat.mul_assoc] + +def coveredPairs (m r : ℕ) : Finset ((Fin r → Fin m) × (Fin r → Fin m)) := by + classical + exact Finset.univ.filter (fun p => Covers p.1 p.2) + +def badCoveredPairs (m r : ℕ) : Finset ((Fin r → Fin m) × (Fin r → Fin m)) := by + classical + exact Finset.univ.filter (fun p => Covers p.1 p.2 ∧ AdjacentValues p.1) + +theorem coveredPairs_param (m r : ℕ) : + coveredPairs m r = Finset.univ.image (fun t : (Fin r → Fin m) × (Fin r → Fin r) => + (t.1,t.1 ∘ t.2)) := by + classical + ext ⟨p,q⟩ + constructor + · intro h + obtain ⟨σ,hσ⟩ := (covers_iff p q).mp (Finset.mem_filter.mp h).2 + apply Finset.mem_image.mpr + exact ⟨(p,σ),Finset.mem_univ _,Prod.ext rfl hσ.symm⟩ + · intro h + obtain ⟨⟨p',σ⟩,_,he⟩ := Finset.mem_image.mp h + have hp : p' = p := congrArg Prod.fst he + have hq : p' ∘ σ = q := congrArg Prod.snd he + subst p' + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(covers_iff p q).mpr ⟨σ,hq.symm⟩⟩ + +theorem card_coveredPairs_le (m r : ℕ) : + (coveredPairs m r).card ≤ m^r * r^r := by + classical + rw [coveredPairs_param] + simpa using Finset.card_image_le (s := (Finset.univ : Finset ((Fin r → Fin m) × (Fin r → Fin r)))) + (f := fun t => (t.1,t.1 ∘ t.2)) + +theorem badCoveredPairs_param (m r : ℕ) : + badCoveredPairs m r = ((adjacentFunctions m r) ×ˢ (Finset.univ : Finset (Fin r → Fin r))).image + (fun t => (t.1,t.1 ∘ t.2)) := by + classical + ext ⟨p,q⟩ + constructor + · intro h + obtain ⟨hc,ha⟩ := (Finset.mem_filter.mp h).2 + obtain ⟨σ,hσ⟩ := (covers_iff p q).mp hc + apply Finset.mem_image.mpr + refine ⟨(p,σ),?_,Prod.ext rfl hσ.symm⟩ + exact Finset.mem_product.mpr ⟨Finset.mem_filter.mpr ⟨Finset.mem_univ _,ha⟩,Finset.mem_univ _⟩ + · intro h + obtain ⟨⟨p',σ⟩,hm,he⟩ := Finset.mem_image.mp h + have hp : p' = p := congrArg Prod.fst he + have hq : p' ∘ σ = q := congrArg Prod.snd he + subst p' + have ha := (Finset.mem_filter.mp (Finset.mem_product.mp hm).1).2 + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(covers_iff p q).mpr ⟨σ,hq.symm⟩,ha⟩ + +theorem card_badCoveredPairs_le (m r : ℕ) : + (badCoveredPairs m r).card ≤ (r^2 * r^r) * m^(r-1) := by + classical + rw [badCoveredPairs_param] + calc + _ ≤ ((adjacentFunctions m r) ×ˢ (Finset.univ : Finset (Fin r → Fin r))).card := Finset.card_image_le + _ = (adjacentFunctions m r).card * r^r := by simp + _ ≤ (r^2 * m^(r-1)) * r^r := Nat.mul_le_mul_right _ (card_adjacentFunctions_le m r) + _ = _ := by ring + +variable {I : Type uI} + +def coloredEncode {m r : ℕ} (b : I → Bool) + (eP : Fin r ≃ {i // b i = true}) (eN : Fin r ≃ {i // b i = false}) + (x : I → Fin m) : (Fin r → Fin m) × (Fin r → Fin m) := + (fun j => x (eP j).val, fun j => x (eN j).val) + +theorem coloredEncode_injective {m r : ℕ} (b : I → Bool) + (eP : Fin r ≃ {i // b i = true}) (eN : Fin r ≃ {i // b i = false}) : + Function.Injective (coloredEncode (m := m) b eP eN) := by + intro x y h + funext i + cases hi : b i with + | false => + have he := congrFun (congrArg Prod.snd h) (eN.symm ⟨i,hi⟩) + simpa only [coloredEncode,Equiv.apply_symm_apply] using he + | true => + have he := congrFun (congrArg Prod.fst h) (eP.symm ⟨i,hi⟩) + simpa only [coloredEncode,Equiv.apply_symm_apply] using he + +def ColoredCovers {m : ℕ} (b : I → Bool) (x : I → Fin m) : Prop := + ∀ i, b i = false → ∃ j, b j = true ∧ x j = x i + +def ColoredAdjacent {m : ℕ} (b : I → Bool) (x : I → Fin m) : Prop := + ∃ i j, b i = true ∧ b j = true ∧ (x i).val+1 = (x j).val + +theorem coloredEncode_covers {m r : ℕ} (b : I → Bool) + (eP : Fin r ≃ {i // b i = true}) (eN : Fin r ≃ {i // b i = false}) + (x : I → Fin m) (h : ColoredCovers b x) : + Covers (coloredEncode b eP eN x).1 (coloredEncode b eP eN x).2 := by + intro i + obtain ⟨j,hj,he⟩ := h (eN i).val (eN i).property + refine ⟨eP.symm ⟨j,hj⟩,?_⟩ + simpa only [coloredEncode,Equiv.apply_symm_apply] using he + +theorem coloredEncode_adjacent {m r : ℕ} (b : I → Bool) + (eP : Fin r ≃ {i // b i = true}) (eN : Fin r ≃ {i // b i = false}) + (x : I → Fin m) (h : ColoredAdjacent b x) : + AdjacentValues (coloredEncode b eP eN x).1 := by + obtain ⟨i,j,hi,hj,he⟩ := h + refine ⟨eP.symm ⟨i,hi⟩,eP.symm ⟨j,hj⟩,?_⟩ + simpa only [coloredEncode,Equiv.apply_symm_apply] using he + +theorem card_coloredCovered_le {m r : ℕ} (b : I → Bool) + (eP : Fin r ≃ {i // b i = true}) (eN : Fin r ≃ {i // b i = false}) + (s : Finset (I → Fin m)) (hs : ∀ x ∈ s, ColoredCovers b x) : + s.card ≤ m^r * r^r := by + classical + have he : s.image (coloredEncode b eP eN) ⊆ coveredPairs m r := by + intro y hy + obtain ⟨x,hx,rfl⟩ := Finset.mem_image.mp hy + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,coloredEncode_covers b eP eN x (hs x hx)⟩ + calc + _ = (s.image (coloredEncode b eP eN)).card := (Finset.card_image_of_injective s (coloredEncode_injective b eP eN)).symm + _ ≤ (coveredPairs m r).card := Finset.card_le_card he + _ ≤ _ := card_coveredPairs_le m r + +theorem card_coloredBad_le {m r : ℕ} (b : I → Bool) + (eP : Fin r ≃ {i // b i = true}) (eN : Fin r ≃ {i // b i = false}) + (s : Finset (I → Fin m)) + (hs : ∀ x ∈ s, ColoredCovers b x ∧ ColoredAdjacent b x) : + s.card ≤ (r^2 * r^r) * m^(r-1) := by + classical + have he : s.image (coloredEncode b eP eN) ⊆ badCoveredPairs m r := by + intro y hy + obtain ⟨x,hx,rfl⟩ := Finset.mem_image.mp hy + obtain ⟨hc,ha⟩ := hs x hx + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,coloredEncode_covers b eP eN x hc, + coloredEncode_adjacent b eP eN x ha⟩ + calc + _ = (s.image (coloredEncode b eP eN)).card := (Finset.card_image_of_injective s (coloredEncode_injective b eP eN)).symm + _ ≤ (badCoveredPairs m r).card := Finset.card_le_card he + _ ≤ _ := card_badCoveredPairs_le m r + +end + +def prefixHom (B m : ℕ) : FreeGroup (Fin m) →* SyllableGroup := + FreeGroup.lift (fun i => segment (runExponent B) 0 (i.val+2)) + +def patternWord {m l : ℕ} (b : Fin l → Bool) (x : Fin l → Fin m) : FreeGroup (Fin m) := + FreeGroup.mk (List.ofFn (fun i => (x i,b i))) + +def pairColors {I : Type uI} {J : Type uJ} (b : I → Bool) (c : J → Bool) : I ⊕ J → Bool := + Sum.elim b (fun j => !(c j)) + +def pairLabels {I : Type uI} {J : Type uJ} {m : ℕ} (x : I → Fin m) (y : J → Fin m) : I ⊕ J → Fin m := + Sum.elim x y + +theorem pairLabels_injective {I : Type uI} {J : Type uJ} {m : ℕ} : + Function.Injective (fun p : (I → Fin m) × (J → Fin m) => pairLabels p.1 p.2) := by + intro p q h + apply Prod.ext + · funext i; exact congrFun h (.inl i) + · funext j; exact congrFun h (.inr j) + +theorem bExponent_lift_mk {ι : Type uι} (f : ι → SyllableGroup) (L : List (ι × Bool)) : + bExponent (FreeGroup.lift f (FreeGroup.mk L)) = + (L.map (fun p => boolSign p.2 * bExponent (f p.1))).sum := by + rw [FreeGroup.lift_mk] + induction L with + | nil => simp + | cons p L ih => + simp only [Bool.cond_eq_ite] at ih + cases p with | mk i b => cases b <;> simp [ih] + +theorem bExponent_pattern (B m l : ℕ) (b : Fin l → Bool) (x : Fin l → Fin m) : + bExponent (prefixHom B m (patternWord b x)) = + ∑ i, boolSign (b i) * ((B : ℤ)^((x i).val+2)-1) := by + unfold prefixHom patternWord + rw [bExponent_lift_mk,List.map_ofFn,List.sum_ofFn] + simp only [bExponent_segment] + rfl + +theorem covers_of_balanced {I : Type uI} [Fintype I] {m : ℕ} + (b : I → Bool) (x : I → Fin m) (he : ∀ j, labelCoefficient b x j = 0) : + ColoredCovers b x := by + classical + intro i hi + by_contra hn + have hno (j : I) (hj : x j = x i) : b j = false := by + cases hb : b j with + | false => rfl + | true => exact False.elim (hn ⟨j,hb,hj⟩) + have hle (j : I) : (if x j = x i then boolSign (b j) else 0 : ℤ) ≤ 0 := by + split_ifs with hj + · rw [hno j hj]; norm_num + · rfl + have hlt : (∑ j, if x j = x i then boolSign (b j) else 0 : ℤ) < ∑ _j : I, 0 := by + apply Finset.sum_lt_sum (fun j _ => hle j) + exact ⟨i,Finset.mem_univ _,by simp [hi]⟩ + have hz := he (x i) + simp only [labelCoefficient] at hz + simp only [Finset.sum_const_zero] at hlt + omega + +theorem collision_covers {m l k B : ℕ} (hB : m * (l+k) < B) (hb : 2 ≤ B) + (b : Fin l → Bool) (c : Fin k → Bool) (x : Fin l → Fin m) (y : Fin k → Fin m) + (hc : ∑ i, boolSign (b i) = ∑ j, boolSign (c j)) + (he : prefixHom B m (patternWord b x) = prefixHom B m (patternWord c y)) : + ColoredCovers (pairColors b c) (pairLabels x y) := by + have he' := congrArg bExponent he + rw [bExponent_pattern,bExponent_pattern] at he' + have hcharge : ∑ i, boolSign (pairColors b c i) = 0 := by + simp only [Fintype.sum_sum_type,pairColors,Sum.elim_inl,Sum.elim_inr,boolSign_not, + Finset.sum_neg_distrib,hc,add_neg_cancel] + have hexp : ∑ i, boolSign (pairColors b c i)*((B : ℤ)^((pairLabels x y i).val+2)-1) = 0 := by + simp only [Fintype.sum_sum_type,pairColors,pairLabels,Sum.elim_inl,Sum.elim_inr, + boolSign_not,neg_mul,Finset.sum_neg_distrib,he',add_neg_cancel] + apply covers_of_balanced + apply labelCoefficient_eq_zero (by simpa only [Fintype.card_sum,Fintype.card_fin] using hB) hb _ _ hcharge hexp + +theorem separated_of_covers {I : Type uI} {m : ℕ} (b : I → Bool) (x : I → Fin m) + (hc : ColoredCovers b x) (ha : ¬ColoredAdjacent b x) : + ∀ i j, (x i).val+1 ≠ (x j).val := by + have hp (i : I) : ∃ j, b j = true ∧ x j = x i := by + cases hi : b i with + | false => exact hc i hi + | true => exact ⟨i,hi,rfl⟩ + intro i j he + obtain ⟨u,hu,heu⟩ := hp i + obtain ⟨v,hv,hev⟩ := hp j + exact ha ⟨u,v,hu,hv,by simpa only [heu,hev] using he⟩ + +theorem collision_free_of_separated {m l k B : ℕ} (hb : 2 ≤ B) + (b : Fin l → Bool) (c : Fin k → Bool) (x : Fin l → Fin m) (y : Fin k → Fin m) + (hs : ∀ i j, (pairLabels x y i).val+1 ≠ (pairLabels x y j).val) + (he : prefixHom B m (patternWord b x) = prefixHom B m (patternWord c y)) : + patternWord b x = patternWord c y := by + let L := List.ofFn (fun i => (x i,b i)) ++ FreeGroup.invRev (List.ofFn (fun j => (y j,c j))) + have hlabel (p : Fin m × Bool) (hp : p ∈ L) : ∃ i, pairLabels x y i = p.1 := by + simp only [L,List.mem_append,FreeGroup.invRev,List.mem_reverse,List.mem_map,List.mem_ofFn] at hp + rcases hp with h | ⟨q,⟨j,hj⟩,hq⟩ + · obtain ⟨i,hi⟩ := h + exact ⟨.inl i,congrArg Prod.fst hi⟩ + · subst q + exact ⟨.inr j,congrArg Prod.fst hq⟩ + have hsep : ∀ p ∈ L, ∀ q ∈ L, p.1.val+1 ≠ q.1.val := by + intro p hp q hq + obtain ⟨i,hi⟩ := hlabel p hp + obtain ⟨j,hj⟩ := hlabel q hq + simpa only [hi,hj] using hs i j + have hmk : FreeGroup.mk L = patternWord b x * (patternWord c y)⁻¹ := by + rw [patternWord,patternWord,FreeGroup.inv_mk,FreeGroup.mul_mk] + have hrel : prefixHom B m (FreeGroup.mk L) = 1 := by + rw [hmk,map_mul,map_inv,he,mul_inv_cancel] + have hzero := prefixRelation_of_separated (runExponent B) + (fun j => ne_of_gt (runExponent_pos hb j)) (runExponent_strictMono hb).injective L hsep hrel + rw [hmk,mul_inv_eq_one] at hzero + exact hzero + +theorem collision_bad_adjacent {m l k B : ℕ} (hB : m * (l+k) < B) (hb : 2 ≤ B) + (b : Fin l → Bool) (c : Fin k → Bool) (x : Fin l → Fin m) (y : Fin k → Fin m) + (hc : ∑ i, boolSign (b i) = ∑ j, boolSign (c j)) + (he : prefixHom B m (patternWord b x) = prefixHom B m (patternWord c y)) + (hne : patternWord b x ≠ patternWord c y) : + ColoredCovers (pairColors b c) (pairLabels x y) ∧ + ColoredAdjacent (pairColors b c) (pairLabels x y) := by + have hc' := collision_covers hB hb b c x y hc he + refine ⟨hc',?_⟩ + by_contra ha + exact hne (collision_free_of_separated hb b c x y (separated_of_covers _ _ hc' ha) he) + +theorem card_patternCollisions_le {m l k B r : ℕ} (hB : m*(l+k) < B) (hb : 2 ≤ B) + (b : Fin l → Bool) (c : Fin k → Bool) + (eP : Fin r ≃ {i // pairColors b c i = true}) + (eN : Fin r ≃ {i // pairColors b c i = false}) + (hc : ∑ i, boolSign (b i) = ∑ j, boolSign (c j)) + (s : Finset ((Fin l → Fin m) × (Fin k → Fin m))) + (hs : ∀ p ∈ s, prefixHom B m (patternWord b p.1) = prefixHom B m (patternWord c p.2)) : + s.card ≤ m^r * r^r := by + classical + let t := s.image (fun p => pairLabels p.1 p.2) + have ht : ∀ x ∈ t, ColoredCovers (pairColors b c) x := by + intro x hx + obtain ⟨p,hp,rfl⟩ := Finset.mem_image.mp hx + exact collision_covers hB hb b c p.1 p.2 hc (hs p hp) + have hh := card_coloredCovered_le (pairColors b c) eP eN t ht + rwa [Finset.card_image_of_injective s pairLabels_injective] at hh + +theorem card_patternBadCollisions_le {m l k B r : ℕ} (hB : m*(l+k) < B) (hb : 2 ≤ B) + (b : Fin l → Bool) (c : Fin k → Bool) + (eP : Fin r ≃ {i // pairColors b c i = true}) + (eN : Fin r ≃ {i // pairColors b c i = false}) + (hc : ∑ i, boolSign (b i) = ∑ j, boolSign (c j)) + (s : Finset ((Fin l → Fin m) × (Fin k → Fin m))) + (hs : ∀ p ∈ s, prefixHom B m (patternWord b p.1) = prefixHom B m (patternWord c p.2) ∧ + patternWord b p.1 ≠ patternWord c p.2) : + s.card ≤ (r^2*r^r)*m^(r-1) := by + classical + let t := s.image (fun p => pairLabels p.1 p.2) + have ht : ∀ x ∈ t, ColoredCovers (pairColors b c) x ∧ ColoredAdjacent (pairColors b c) x := by + intro x hx + obtain ⟨p,hp,rfl⟩ := Finset.mem_image.mp hx + exact collision_bad_adjacent hB hb b c p.1 p.2 hc (hs p hp).1 (hs p hp).2 + have hh := card_coloredBad_le (pairColors b c) eP eN t ht + rwa [Finset.card_image_of_injective s pairLabels_injective] at hh + +theorem card_patternCollisions_le_free_add {m l k B r : ℕ} (hB : m*(l+k) < B) (hb : 2 ≤ B) + (b : Fin l → Bool) (c : Fin k → Bool) + (eP : Fin r ≃ {i // pairColors b c i = true}) + (eN : Fin r ≃ {i // pairColors b c i = false}) + (hc : ∑ i, boolSign (b i) = ∑ j, boolSign (c j)) + (s : Finset ((Fin l → Fin m) × (Fin k → Fin m))) : + (s.filter (fun p => prefixHom B m (patternWord b p.1) = prefixHom B m (patternWord c p.2))).card ≤ + (s.filter (fun p => patternWord b p.1 = patternWord c p.2)).card + (r^2*r^r)*m^(r-1) := by + classical + let t := s.filter (fun p => prefixHom B m (patternWord b p.1) = prefixHom B m (patternWord c p.2)) + let u := t.filter (fun p => patternWord b p.1 = patternWord c p.2) + let v := t.filter (fun p => ¬ patternWord b p.1 = patternWord c p.2) + have huc : u.card ≤ (s.filter (fun p => patternWord b p.1 = patternWord c p.2)).card := by + apply Finset.card_le_card + intro p hp + exact Finset.mem_filter.mpr ⟨(Finset.mem_filter.mp (Finset.mem_filter.mp hp).1).1, + (Finset.mem_filter.mp hp).2⟩ + have hvc : v.card ≤ (r^2*r^r)*m^(r-1) := by + apply card_patternBadCollisions_le hB hb b c eP eN hc v + intro p hp + exact ⟨(Finset.mem_filter.mp (Finset.mem_filter.mp hp).1).2,(Finset.mem_filter.mp hp).2⟩ + have he : u.card+v.card = t.card := Finset.card_filter_add_card_filter_not _ + change t.card ≤ _ + omega + +def alternating (b : Bool) : (l : ℕ) → Fin l → Bool + | 0 => Fin.elim0 + | l+1 => Fin.cases b (alternating (!b) l) + +@[simp] theorem alternating_zero (b : Bool) (l : ℕ) : alternating b (l+1) 0 = b := rfl +@[simp] theorem alternating_succ (b : Bool) (l : ℕ) (i : Fin l) : + alternating b (l+1) i.succ = alternating (!b) l i := rfl + +theorem signed_ofFn {ι : Type uι} (b : Bool) (l : ℕ) (x : Fin l → ι) : + Radial.signed b (List.ofFn x) = List.ofFn (fun i => (x i,alternating b l i)) := by + induction l generalizing b with + | zero => simp [Radial.signed] + | succ l ih => + rw [List.ofFn_succ,Radial.signed,ih,List.ofFn_succ] + rfl + +theorem vertex_ofFn {m l : ℕ} (b : Bool) (x : Fin l → Fin m) : + Radial.vertex b (List.ofFn x) = patternWord (alternating b l) x := by + unfold Radial.vertex patternWord + rw [signed_ofFn] + +def positiveCount (b : Bool) (l : ℕ) : ℕ := ∑ i, if alternating b l i = true then 1 else 0 + +@[simp] theorem positiveCount_zero (b : Bool) : positiveCount b 0 = 0 := by simp [positiveCount] +@[simp] theorem positiveCount_succ (b : Bool) (l : ℕ) : + positiveCount b (l+1) = (if b = true then 1 else 0)+positiveCount (!b) l := by + simp only [positiveCount,Fin.sum_univ_succ,alternating_zero,alternating_succ] + rfl + +theorem positiveCount_two (b : Bool) (l : ℕ) : positiveCount b (l+2) = 1+positiveCount b l := by + rw [positiveCount_succ,positiveCount_succ] + cases b <;> simp + +theorem positiveCount_even (b : Bool) (k : ℕ) : positiveCount b (2*k) = k := by + induction k with + | zero => simp + | succ k ih => rw [Nat.mul_succ,positiveCount_two,ih]; omega + +theorem positiveCount_odd (b : Bool) (k : ℕ) : + positiveCount b (2*k+1) = (if b = true then 1 else 0)+k := by + rw [positiveCount_succ,positiveCount_even] + +theorem card_alternating_pos (b : Bool) (l : ℕ) : + Fintype.card {i // alternating b l i = true} = positiveCount b l := by + classical + rw [Fintype.card_subtype,Finset.card_filter] + rfl + +theorem card_alternating_neg (b : Bool) (l : ℕ) : + Fintype.card {i // alternating b l i = false} = l-positiveCount b l := by + classical + have hh := Fintype.card_subtype_compl (fun i : Fin l => alternating b l i = true) + simpa only [Bool.not_eq_true,Fintype.card_fin,card_alternating_pos] using hh + +theorem alternating_charge (b : Bool) (l : ℕ) : + (∑ i, boolSign (alternating b l i)) = 2*(positiveCount b l : ℤ)-l := by + classical + have hh (i : Fin l) : boolSign (alternating b l i) = + 2*(if alternating b l i = true then (1 : ℤ) else 0)-1 := by + cases alternating b l i <;> norm_num + simp only [hh,Finset.sum_sub_distrib,← Finset.mul_sum,Finset.sum_const,Finset.card_univ, + Fintype.card_fin,nsmul_eq_mul,mul_one,positiveCount] + push_cast + rfl + +theorem card_pairColors_pos {I : Type uI} {J : Type uJ} [Fintype I] [Fintype J] + (b : I → Bool) (c : J → Bool) : + Fintype.card {i // pairColors b c i = true} = + Fintype.card {i // b i = true} + Fintype.card {j // c j = false} := by + classical + simp only [Fintype.card_subtype,Finset.card_filter] + rw [Fintype.sum_sum_type] + simp only [pairColors,Sum.elim_inl,Sum.elim_inr,Bool.not_eq_true_eq_eq_false] + rfl + +theorem card_pairColors_neg {I : Type uI} {J : Type uJ} [Fintype I] [Fintype J] + (b : I → Bool) (c : J → Bool) : + Fintype.card {i // pairColors b c i = false} = + Fintype.card {i // b i = false} + Fintype.card {j // c j = true} := by + classical + simp only [Fintype.card_subtype,Finset.card_filter] + rw [Fintype.sum_sum_type] + simp only [pairColors,Sum.elim_inl,Sum.elim_inr,Bool.not_eq_false_eq_eq_true] + rfl + +end RankTwo + +def coefficientPair {G : Type uG} (h k : G →₀ ℝ) : ℝ := h.sum (fun g c => c * k g) + +@[simp] theorem coefficientPair_self {G : Type uG} (h : G →₀ ℝ) : + coefficientPair h h = coefficientSqNorm h := by + unfold coefficientPair coefficientSqNorm + apply Finsupp.sum_congr + intro g _ + exact (pow_two (h g)).symm + +@[simp] theorem coefficientPair_zero_left {G : Type uG} (k : G →₀ ℝ) : coefficientPair 0 k = 0 := by + simp [coefficientPair] + +@[simp] theorem coefficientPair_single_left {G : Type uG} (g : G) (c : ℝ) (k : G →₀ ℝ) : + coefficientPair (Finsupp.single g c) k = c * k g := by simp [coefficientPair] + +@[simp] theorem coefficientPair_add_left {G : Type uG} (h k l : G →₀ ℝ) : + coefficientPair (h+k) l = coefficientPair h l + coefficientPair k l := by + exact Finsupp.sum_add_index' (fun _ => zero_mul _) (fun _ _ _ => add_mul ..) + +@[simp] theorem coefficientPair_sum_left {I : Type uI} {G : Type uG} (s : Finset I) (h : I → G →₀ ℝ) (k : G →₀ ℝ) : + coefficientPair (∑ i ∈ s, h i) k = ∑ i ∈ s, coefficientPair (h i) k := by + classical + induction s using Finset.induction_on with + | empty => simp + | insert i s hi ih => simp [Finset.sum_insert hi,ih] + +@[simp] theorem coefficientPair_zero_right {G : Type uG} (h : G →₀ ℝ) : coefficientPair h 0 = 0 := by + simp [coefficientPair] + +@[simp] theorem coefficientPair_add_right {G : Type uG} (h k l : G →₀ ℝ) : + coefficientPair h (k+l) = coefficientPair h k + coefficientPair h l := by + simp [coefficientPair,mul_add,Finsupp.sum_add] + +@[simp] theorem coefficientPair_single_right {G : Type uG} (h : G →₀ ℝ) (g : G) (c : ℝ) : + coefficientPair h (Finsupp.single g c) = h g * c := by + classical + simp [coefficientPair,Finsupp.sum,Finsupp.single_apply] + exact fun h => Or.inl h + +@[simp] theorem coefficientPair_sum_right {I : Type uI} {G : Type uG} (s : Finset I) (h : G →₀ ℝ) (k : I → G →₀ ℝ) : + coefficientPair h (∑ i ∈ s, k i) = ∑ i ∈ s, coefficientPair h (k i) := by + classical + induction s using Finset.induction_on with + | empty => simp + | insert i s hi ih => simp [Finset.sum_insert hi,ih] + +theorem coefficientPair_smul_left {G : Type uG} (c : ℝ) (h k : G →₀ ℝ) : + coefficientPair (c • h) k = c * coefficientPair h k := by + unfold coefficientPair + rw [Finsupp.sum_smul_index (fun _ => zero_mul _)] + simp only [mul_assoc,Finsupp.mul_sum] + +theorem coefficientPair_smul_right {G : Type uG} (c : ℝ) (h k : G →₀ ℝ) : + coefficientPair h (c • k) = c * coefficientPair h k := by + unfold coefficientPair + simp only [Finsupp.smul_apply,smul_eq_mul,Finsupp.mul_sum,mul_left_comm] + +theorem coefficientPair_single_sums {I : Type uI} {J : Type uJ} {G : Type uG} (s : Finset I) (t : Finset J) + (f : I → G) (g : J → G) (a : I → ℝ) (b : J → ℝ) : + coefficientPair (∑ i ∈ s, Finsupp.single (f i) (a i)) (∑ j ∈ t, Finsupp.single (g j) (b j)) = + ∑ i ∈ s, ∑ j ∈ t, if f i = g j then a i * b j else 0 := by + classical + rw [coefficientPair_sum_left] + apply Finset.sum_congr rfl + intro i _ + rw [coefficientPair_sum_right] + simp only [coefficientPair_single_left,Finsupp.single_apply] + apply Finset.sum_congr rfl + intro j _ + by_cases h : f i = g j + · rw [ite_eq_left h.symm,ite_eq_left h] + · rw [ite_eq_right (Ne.symm h),ite_eq_right h,mul_zero] + +theorem coefficientPair_shells {I : Type uI} {J : Type uJ} {G : Type uG} (s : Finset I) (t : Finset J) + (f : I → G) (g : J → G) : + coefficientPair (∑ i ∈ s, Finsupp.single (f i) 1) (∑ j ∈ t, Finsupp.single (g j) 1) = + ((s ×ˢ t).filter (fun p : I × J => f p.1 = g p.2)).card := by + classical + rw [coefficientPair_single_sums] + simp only [mul_one,Finset.card_filter,Finset.sum_product] + push_cast + rfl + +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/RankTwoWords.lean b/lean/OAI/Analysis/FreeGroupFactor/RankTwoWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8ff3ef12c1754457b3f532fc228e69657b7024c --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/RankTwoWords.lean @@ -0,0 +1,489 @@ +import OAI.Analysis.FreeGroupFactor.Generation + +namespace OAI + +namespace FreeGroupFactorMain + +noncomputable section + +universe uG uH uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +attribute [local instance] Classical.propDecidable + +namespace RankTwo + +section +open Monoid.CoprodI + +abbrev SyllableGroups (_ : Bool) := Multiplicative ℤ +abbrev SyllableGroup := Monoid.CoprodI SyllableGroups +abbrev NW (i j : Bool) := Monoid.CoprodI.NeWord SyllableGroups i j + +def syllable (i : Bool) (z : ℤ) : SyllableGroup := + Monoid.CoprodI.of (i := i) (Multiplicative.ofAdd z) + +def singleWord (i : Bool) (z : ℤ) (hz : z ≠ 0) : NW i i := + NeWord.singleton (Multiplicative.ofAdd z) hz + +@[simp] theorem singleWord_prod (i : Bool) (z : ℤ) (hz : z ≠ 0) : + (singleWord i z hz).prod = syllable i z := by + exact NeWord.prod_singleton _ _ + +@[simp] theorem syllable_add (i : Bool) (z w : ℤ) : + syllable i (z+w) = syllable i z * syllable i w := by + exact map_mul (Monoid.CoprodI.of (i := i)) (Multiplicative.ofAdd z) (Multiplicative.ofAdd w) + +@[simp] theorem syllable_neg (i : Bool) (z : ℤ) : + syllable i (-z) = (syllable i z)⁻¹ := by + exact map_inv _ _ + +@[simp] theorem syllable_zero (i : Bool) : syllable i 0 = 1 := map_one _ + +theorem neWord_prod_ne_one {i j : Bool} (w : NW i j) : w.prod ≠ 1 := by + classical + intro h + have hinj : Function.Injective (Word.prod : Word SyllableGroups → SyllableGroup) := + (Word.equiv (M := SyllableGroups)).symm.injective + have heq : w.toWord = Word.empty := hinj (by simpa [NeWord.prod] using h) + exact w.toList_ne_nil (congrArg Word.toList heq) + +variable {ι : Type uι} + +def longBlock (start finish : ι → ℤ) (core : ι → NW true true) (i : ι) : SyllableGroup := + syllable true 1 * syllable false (start i) * (core i).prod * syllable false (finish i) + +def PositiveHead (start : ι → ℤ) (i : ι) (g : SyllableGroup) : Prop := + ∃ j, ∃ W : NW false j, W.head = Multiplicative.ofAdd (start i) ∧ + g = syllable true 1 * W.prod + +def NegativeHead (finish : ι → ℤ) (i : ι) (g : SyllableGroup) : Prop := + ∃ j, ∃ W : NW true j, g = syllable false (-(finish i)) * W.prod + +theorem positiveHead_ne_one {start : ι → ℤ} {i : ι} {g : SyllableGroup} + (h : PositiveHead start i g) : g ≠ 1 := by + obtain ⟨j,W,_hW,rfl⟩ := h + exact neWord_prod_ne_one ((singleWord true 1 (by norm_num)).append (by decide) W) + +theorem negativeHead_ne_one {finish : ι → ℤ} {i : ι} (hi : finish i ≠ 0) + {g : SyllableGroup} (h : NegativeHead finish i g) : g ≠ 1 := by + obtain ⟨j,W,rfl⟩ := h + exact neWord_prod_ne_one ((singleWord false (-finish i) (neg_ne_zero.mpr hi)).append (by decide) W) + +variable (start finish : ι → ℤ) (core : ι → NW true true) +variable (hs : ∀ i, start i ≠ 0) (ht : ∀ i, finish i ≠ 0) +include hs ht + +theorem longBlock_positive (i : ι) : + PositiveHead start i (longBlock start finish core i) := by + let W := ((singleWord false (start i) (hs i)).append (by decide) (core i)).append + (by decide) (singleWord false (finish i) (ht i)) + refine ⟨false,W,?_,?_⟩ + · rfl + · simp [W,longBlock,mul_assoc] + +omit ht in +theorem longBlock_negative (i : ι) : + NegativeHead finish i (longBlock start finish core i)⁻¹ := by + let W := ((core i).inv.append (by decide) (singleWord false (-start i) (neg_ne_zero.mpr (hs i)))).append + (by decide) (singleWord true (-1) (by norm_num)) + refine ⟨true,W,?_⟩ + simp [W,longBlock,mul_inv_rev,mul_assoc] + +theorem positive_mul_positive (i j : ι) {g : SyllableGroup} + (h : PositiveHead start j g) : + PositiveHead start i (longBlock start finish core i * g) := by + obtain ⟨k,V,_hV,rfl⟩ := h + let W := ((((singleWord false (start i) (hs i)).append (by decide) (core i)).append + (by decide) (singleWord false (finish i) (ht i))).append (by decide) + (singleWord true 1 (by norm_num))).append (by decide) V + refine ⟨k,W,rfl,?_⟩ + simp [W,longBlock,mul_assoc] + +theorem negative_mul_negative (i j : ι) {g : SyllableGroup} + (h : NegativeHead finish j g) : + NegativeHead finish i ((longBlock start finish core i)⁻¹ * g) := by + obtain ⟨k,V,rfl⟩ := h + let W := ((((core i).inv.append (by decide) (singleWord false (-start i) (neg_ne_zero.mpr (hs i)))).append + (by decide) (singleWord true (-1) (by norm_num))).append (by decide) + (singleWord false (-finish j) (neg_ne_zero.mpr (ht j)))).append (by decide) V + refine ⟨k,W,?_⟩ + simp [W,longBlock,mul_inv_rev,mul_assoc] + +omit ht in +theorem positive_mul_negative (i j : ι) (hij : finish i ≠ finish j) {g : SyllableGroup} + (h : NegativeHead finish j g) : + PositiveHead start i (longBlock start finish core i * g) := by + obtain ⟨k,V,rfl⟩ := h + let W := (((singleWord false (start i) (hs i)).append (by decide) (core i)).append + (by decide) (singleWord false (finish i-finish j) (sub_ne_zero.mpr hij))).append (by decide) V + refine ⟨k,W,rfl,?_⟩ + simp [W,longBlock,sub_eq_add_neg,mul_assoc] + +omit hs ht in +theorem negative_mul_positive (i j : ι) (hij : start i ≠ start j) {g : SyllableGroup} + (h : PositiveHead start j g) : + NegativeHead finish i ((longBlock start finish core i)⁻¹ * g) := by + obtain ⟨k,V,hV,rfl⟩ := h + have hno : (Multiplicative.ofAdd (-(start i))) * V.head ≠ 1 := by + rw [hV] + change -(start i) + start j ≠ 0 + omega + let W := (core i).inv.append (by decide) (V.mulHead (Multiplicative.ofAdd (-(start i))) hno) + refine ⟨k,W,?_⟩ + simp [W,longBlock,mul_inv_rev,syllable,mul_assoc] + +variable (hinjs : Function.Injective start) (hinjt : Function.Injective finish) +include hinjs hinjt + +def evalLetters (f : ι → SyllableGroup) (L : List (ι × Bool)) : SyllableGroup := + (L.map (fun x => cond x.2 (f x.1) (f x.1)⁻¹)).prod + +omit hs ht hinjs hinjt in +@[simp] theorem evalLetters_nil (f : ι → SyllableGroup) : evalLetters f [] = 1 := rfl + +omit hs ht hinjs hinjt in +@[simp] theorem evalLetters_cons (f : ι → SyllableGroup) (i : ι) (b : Bool) (L : List (ι × Bool)) : + evalLetters f ((i,b)::L) = (cond b (f i) (f i)⁻¹) * evalLetters f L := rfl + +theorem longBlock_head (L : List (ι × Bool)) (i : ι) (b : Bool) + (hL : FreeGroup.IsReduced ((i,b)::L)) : + if b then PositiveHead start i (evalLetters (longBlock start finish core) ((i,b)::L)) + else NegativeHead finish i (evalLetters (longBlock start finish core) ((i,b)::L)) := by + induction L generalizing i b with + | nil => + cases b + · simpa using longBlock_negative start finish core hs i + · simpa using longBlock_positive start finish core hs ht i + | cons a L ih => + obtain ⟨j,c⟩ := a + obtain ⟨hij,hred⟩ := FreeGroup.isReduced_cons_cons.mp hL + have hrec := ih j c hred + cases b <;> cases c + · simpa using negative_mul_negative start finish core hs ht i j hrec + · have hne : start i ≠ start j := fun h => by simpa using hij (hinjs h) + simpa using negative_mul_positive start finish core i j hne hrec + · have hne : finish i ≠ finish j := fun h => by simpa using hij (hinjt h) + simpa using positive_mul_negative start finish core hs i j hne hrec + · simpa using positive_mul_positive start finish core hs ht i j hrec + +theorem longBlock_injective : + Function.Injective (FreeGroup.lift (longBlock start finish core)) := by + classical + apply (injective_iff_map_eq_one _).mpr + intro g hg + have hred := FreeGroup.isReduced_toWord (x := g) + have he : evalLetters (longBlock start finish core) g.toWord = 1 := by + unfold evalLetters + rw [← FreeGroup.lift_mk,FreeGroup.mk_toWord] + exact hg + cases hw : g.toWord with + | nil => exact FreeGroup.toWord_eq_nil_iff.mp hw + | cons a L => + obtain ⟨i,b⟩ := a + rw [hw] at hred he + have hh := longBlock_head start finish core hs ht hinjs hinjt L i b hred + cases b + · exact False.elim (negativeHead_ne_one (ht i) hh he) + · exact False.elim (positiveHead_ne_one hh he) + +end +open Monoid.CoprodI + +def piece (E : ℕ → ℤ) (j : ℕ) : SyllableGroup := syllable true 1 * syllable false (E j) + +def segment (E : ℕ → ℤ) (s : ℕ) : ℕ → SyllableGroup + | 0 => 1 + | k+1 => segment E s k * piece E (s+k) + +@[simp] theorem segment_zero (E : ℕ → ℤ) (s : ℕ) : segment E s 0 = 1 := rfl +@[simp] theorem segment_succ (E : ℕ → ℤ) (s k : ℕ) : + segment E s (k+1) = segment E s k * piece E (s+k) := rfl + +@[simp] theorem segment_one (E : ℕ → ℤ) (s : ℕ) : segment E s 1 = piece E s := by simp + +theorem segment_append (E : ℕ → ℤ) (s j k : ℕ) : + segment E s (j+k) = segment E s j * segment E (s+j) k := by + induction k with + | zero => simp + | succ k ih => simp only [Nat.add_succ,segment_succ,ih,Nat.add_assoc,mul_assoc] + +theorem segment_cons (E : ℕ → ℤ) (s k : ℕ) : + segment E s (k+1) = piece E s * segment E (s+1) k := by + simpa [Nat.add_comm] using segment_append E s 1 k + +def coreWord (E : ℕ → ℤ) (hE : ∀ j, E j ≠ 0) (s : ℕ) : ℕ → NW true true + | 0 => singleWord true 1 (by norm_num) + | k+1 => ((coreWord E hE s k).append (by decide) + (singleWord false (E (s+k)) (hE (s+k)))).append (by decide) + (singleWord true 1 (by norm_num)) + +theorem segment_core (E : ℕ → ℤ) (hE : ∀ j, E j ≠ 0) (s k : ℕ) : + segment E s (k+1) = (coreWord E hE s k).prod * syllable false (E (s+k)) := by + induction k with + | zero => simp [coreWord,piece] + | succ k ih => + rw [segment_succ,ih] + simp only [coreWord,NeWord.append_prod,singleWord_prod,piece,mul_assoc] + +theorem segment_longBlock (E : ℕ → ℤ) (hE : ∀ j, E j ≠ 0) (s k : ℕ) : + segment E s (k+2) = syllable true 1 * syllable false (E s) * + (coreWord E hE (s+1) k).prod * syllable false (E (s+k+1)) := by + rw [show k+2 = (k+1)+1 by omega,segment_cons,segment_core E hE] + have he : s+1+k = s+k+1 := by omega + simp only [piece,mul_assoc,he] + +def cumulative {G : Type uG} [Group G] (f : ℕ → G) : ℕ → G + | 0 => 1 + | k+1 => cumulative f k * f k + +@[simp] theorem cumulative_zero {G : Type uG} [Group G] (f : ℕ → G) : cumulative f 0 = 1 := rfl +@[simp] theorem cumulative_succ {G : Type uG} [Group G] (f : ℕ → G) (k : ℕ) : + cumulative f (k+1) = cumulative f k * f k := rfl + +theorem map_cumulative {G : Type uG} {H : Type uH} [Group G] [Group H] (φ : G →* H) (f : ℕ → G) (k : ℕ) : + φ (cumulative f k) = cumulative (φ ∘ f) k := by + induction k with + | zero => simp + | succ k ih => simp [ih] + +def finGenerator (m j : ℕ) : FreeGroup (Fin m) := + if h : j < m then FreeGroup.of ⟨j,h⟩ else 1 + +def prefixGenerator (m j : ℕ) : FreeGroup (Fin m) := + if j = 0 then 1 else finGenerator m (j-1) + +@[simp] theorem prefixGenerator_zero (m : ℕ) : prefixGenerator m 0 = 1 := by simp [prefixGenerator] +@[simp] theorem prefixGenerator_succ (m j : ℕ) : prefixGenerator m (j+1) = finGenerator m j := by + simp [prefixGenerator] + +@[simp] theorem finGenerator_fin {m : ℕ} (i : Fin m) : finGenerator m i.val = FreeGroup.of i := by + simp [finGenerator,i.is_lt] + +def triangularHom (m : ℕ) : FreeGroup (Fin m) →* FreeGroup (Fin m) := + FreeGroup.lift (fun i => cumulative (finGenerator m) (i.val+1)) + +def differenceHom (m : ℕ) : FreeGroup (Fin m) →* FreeGroup (Fin m) := + FreeGroup.lift (fun i => (prefixGenerator m i.val)⁻¹ * prefixGenerator m (i.val+1)) + +theorem difference_cumulative (m k : ℕ) (hk : k ≤ m) : + differenceHom m (cumulative (finGenerator m) k) = prefixGenerator m k := by + induction k with + | zero => simp + | succ k ih => + have hkm : k < m := by omega + rw [cumulative_succ,map_mul,ih (by omega)] + simp only [finGenerator,dite_eq_left hkm,differenceHom,FreeGroup.lift_apply_of] + simp + +theorem triangularHom_injective (m : ℕ) : Function.Injective (triangularHom m) := by + have hcomp : (differenceHom m).comp (triangularHom m) = MonoidHom.id _ := by + ext i + simp only [MonoidHom.comp_apply,triangularHom,FreeGroup.lift_apply_of,MonoidHom.id_apply] + rw [difference_cumulative m (i.val+1) (by omega)] + simp + intro x y hxy + have := congrArg (differenceHom m) hxy + change ((differenceHom m).comp (triangularHom m)) x = + ((differenceHom m).comp (triangularHom m)) y at this + simpa only [hcomp,MonoidHom.id_apply] using this + +theorem cumulative_injective {G : Type uG} [Group G] (m : ℕ) (f : ℕ → G) + (hf : Function.Injective (FreeGroup.lift (fun i : Fin m => f i.val))) : + Function.Injective (FreeGroup.lift (fun i : Fin m => cumulative f (i.val+1))) := by + have hc (k : ℕ) (hk : k ≤ m) : + FreeGroup.lift (fun i : Fin m => f i.val) (cumulative (finGenerator m) k) = cumulative f k := by + induction k with + | zero => simp + | succ k ih => + have hkm : k < m := by omega + rw [cumulative_succ,map_mul,ih (by omega),cumulative_succ] + simp only [finGenerator,dite_eq_left hkm,FreeGroup.lift_apply_of] + have he : FreeGroup.lift (fun i : Fin m => cumulative f (i.val+1)) = + (FreeGroup.lift (fun i : Fin m => f i.val)).comp (triangularHom m) := by + ext i + simp only [MonoidHom.comp_apply,triangularHom,FreeGroup.lift_apply_of] + exact (hc (i.val+1) (by omega)).symm + rw [he] + exact hf.comp (triangularHom_injective m) + +theorem intervalBlocks_injective (E : ℕ → ℤ) (hE : ∀ j, E j ≠ 0) + (hiE : Function.Injective E) (k : ℕ) (b : Fin (k+1) → ℕ) + (hb : ∀ i : Fin k, b i.castSucc + 2 ≤ b i.succ) : + Function.Injective (FreeGroup.lift (fun i : Fin k => + segment E (b i.castSucc) (b i.succ - b i.castSucc))) := by + have hbm : StrictMono b := Fin.strictMono_iff_lt_succ.mpr (fun i => by have := hb i; omega) + let start (i : Fin k) : ℤ := E (b i.castSucc) + let finish (i : Fin k) : ℤ := E (b i.succ-1) + let core (i : Fin k) : NW true true := + coreWord E hE (b i.castSucc+1) (b i.succ-b i.castSucc-2) + have hstart : Function.Injective start := by + intro i j hij + have he := congrArg Fin.val (hbm.injective (hiE hij)) + exact Fin.ext he + have hfinish : Function.Injective finish := by + intro i j hij + have he := hiE hij + have hi := hb i + have hj := hb j + have he' : b i.succ = b j.succ := by omega + have hev := congrArg Fin.val (hbm.injective he') + apply Fin.ext + exact Nat.add_right_cancel hev + have hh := longBlock_injective start finish core (fun i => hE _) (fun i => hE _) hstart hfinish + have he (i : Fin k) : segment E (b i.castSucc) (b i.succ-b i.castSucc) = + longBlock start finish core i := by + have hbi := hb i + have hn : b i.succ-b i.castSucc = (b i.succ-b i.castSucc-2)+2 := by omega + rw [hn,segment_longBlock E hE] + dsimp only [longBlock,start,finish,core] + have he' : b i.castSucc+(b i.succ-b i.castSucc-2)+1 = b i.succ-1 := by omega + rw [he'] + simpa only [he] using hh + +theorem boundaryPrefixes_injective (E : ℕ → ℤ) (hE : ∀ j, E j ≠ 0) + (hiE : Function.Injective E) (k : ℕ) (b : Fin (k+1) → ℕ) + (hb0 : b 0 = 0) (hb : ∀ i : Fin k, b i.castSucc + 2 ≤ b i.succ) : + Function.Injective (FreeGroup.lift (fun i : Fin k => segment E 0 (b i.succ))) := by + let f (j : ℕ) : SyllableGroup := if h : j < k then + segment E (b (⟨j,h⟩ : Fin k).castSucc) (b (⟨j,h⟩ : Fin k).succ-b (⟨j,h⟩ : Fin k).castSucc) + else 1 + have hf : Function.Injective (FreeGroup.lift (fun i : Fin k => f i.val)) := by + simpa only [f,dite_eq_left (Fin.is_lt _)] using intervalBlocks_injective E hE hiE k b hb + have hc (j : ℕ) (hj : j ≤ k) : cumulative f j = segment E 0 (b ⟨j,by omega⟩) := by + induction j with + | zero => simp [hb0] + | succ j ih => + have hjk : j < k := by omega + have hbj := hb ⟨j,hjk⟩ + change b (⟨j,by omega⟩ : Fin (k+1))+2 ≤ b (⟨j+1,by omega⟩ : Fin (k+1)) at hbj + rw [cumulative_succ,ih (by omega)] + simp only [f,dite_eq_left hjk] + have happ := segment_append E 0 (b (⟨j,by omega⟩ : Fin (k+1))) + (b (⟨j+1,by omega⟩ : Fin (k+1))-b (⟨j,by omega⟩ : Fin (k+1))) + simp only [zero_add] at happ + change segment E 0 (b (⟨j,by omega⟩ : Fin (k+1))) * + segment E (b (⟨j,by omega⟩ : Fin (k+1))) + (b (⟨j+1,by omega⟩ : Fin (k+1))-b (⟨j,by omega⟩ : Fin (k+1))) = _ + rw [← happ] + congr 1 + change b (⟨j,by omega⟩ : Fin (k+1)) + + (b (⟨j+1,by omega⟩ : Fin (k+1))-b (⟨j,by omega⟩ : Fin (k+1))) = _ + omega + have he (i : Fin k) : cumulative f (i.val+1) = segment E 0 (b i.succ) := hc _ (by omega) + simpa only [he] using cumulative_injective k f hf + +theorem separatedPrefixes_injective (E : ℕ → ℤ) (hE : ∀ j, E j ≠ 0) + (hiE : Function.Injective E) (k : ℕ) (r : Fin k → ℕ) + (hr : ∀ i j : Fin k, i < j → r i + 2 ≤ r j) : + Function.Injective (FreeGroup.lift (fun i : Fin k => segment E 0 (r i+2))) := by + let b : Fin (k+1) → ℕ := Fin.cases 0 (fun i => r i+2) + have hb0 : b 0 = 0 := rfl + have hb (i : Fin k) : b i.castSucc+2 ≤ b i.succ := by + change b i.castSucc+2 ≤ r i+2 + by_cases hi : i.val = 0 + · have he : i.castSucc = 0 := Fin.ext hi + rw [he,hb0] + omega + · let j : Fin k := ⟨i.val-1,by have := i.is_lt; omega⟩ + have hji : j < i := by change i.val-1 < i.val; omega + have he : i.castSucc = j.succ := Fin.ext (by dsimp [j]; omega) + rw [he] + have hg := hr j i hji + change (r j+2)+2 ≤ r i+2 + omega + simpa only [b,Fin.cases_succ] using boundaryPrefixes_injective E hE hiE k b hb0 hb + +def runExponent (B j : ℕ) : ℤ := ((B : ℤ)-1)*(B : ℤ)^j + +theorem runExponent_pos {B : ℕ} (hB : 2 ≤ B) (j : ℕ) : 0 < runExponent B j := by + have hb : (1 : ℤ) < B := by exact_mod_cast hB + unfold runExponent + positivity + +theorem runExponent_strictMono {B : ℕ} (hB : 2 ≤ B) : StrictMono (runExponent B) := by + apply strictMono_nat_of_lt_succ + intro j + have hp := runExponent_pos hB j + have hb : (1 : ℤ) < B := by exact_mod_cast hB + have he : runExponent B (j+1) = runExponent B j * B := by simp [runExponent,pow_succ,mul_assoc] + rw [he] + nlinarith + +theorem separatedSetPrefixes_injective (E : ℕ → ℤ) (hE : ∀ j, E j ≠ 0) + (hiE : Function.Injective E) {m : ℕ} (s : Finset (Fin m)) + (hs : ∀ i ∈ s, ∀ j ∈ s, i.val+1 ≠ j.val) : + Function.Injective (FreeGroup.lift (fun i : s => segment E 0 (i.val.val+2))) := by + classical + let e : Fin s.card ≃o s := s.orderIsoOfFin rfl + have hr (i j : Fin s.card) (hij : i < j) : (e i).val.val+2 ≤ (e j).val.val := by + have hlt : (e i).val < (e j).val := e.strictMono hij + have hne := hs (e i).val (e i).property (e j).val (e j).property + change (e i).val.val < (e j).val.val at hlt + omega + have hf := separatedPrefixes_injective E hE hiE s.card (fun i => (e i).val.val) hr + have he : (FreeGroup.lift (fun i : Fin s.card => segment E 0 ((e i).val.val+2))).comp + (FreeGroup.map e.symm) = FreeGroup.lift (fun i : s => segment E 0 (i.val.val+2)) := by + ext i + simp + rw [← he] + exact hf.comp (FreeGroup.map_injective e.symm.injective) + +theorem mk_eq_one_of_restricted_lift {ι : Type uι} {G : Type uG} [Group G] + (f : ι → G) (s : Finset ι) + (hf : Function.Injective (FreeGroup.lift (fun i : s => f i.val))) + (L : List (ι × Bool)) (hL : ∀ p ∈ L, p.1 ∈ s) + (he : FreeGroup.lift f (FreeGroup.mk L) = 1) : FreeGroup.mk L = 1 := by + classical + by_cases hs : s.Nonempty + · let z : s := ⟨hs.choose,hs.choose_spec⟩ + let r (i : ι) : s := if h : i ∈ s then ⟨i,h⟩ else z + have hr (i : ι) (hi : i ∈ s) : (r i).val = i := by simp [r,hi] + let R := (FreeGroup.map r) (FreeGroup.mk L) + have hR : FreeGroup.map (fun i : s => i.val) R = FreeGroup.mk L := by + simp only [R,FreeGroup.map.mk,List.map_map] + congr 1 + have hmap : L.map ((fun x : s × Bool => (x.1.val,x.2)) ∘ + (fun x : ι × Bool => (r x.1,x.2))) = L.map id := by + apply List.map_congr_left + intro p hp + exact Prod.ext (hr p.1 (hL p hp)) rfl + exact hmap.trans (List.map_id L) + have hh : (FreeGroup.lift f).comp (FreeGroup.map (fun i : s => i.val)) = + FreeGroup.lift (fun i : s => f i.val) := by ext i; simp + have heR : FreeGroup.lift (fun i : s => f i.val) R = 1 := by + rw [← hh, MonoidHom.comp_apply,hR,he] + have hR1 : R = 1 := hf (heR.trans (map_one _).symm) + rw [← hR,hR1,map_one] + · have hnil : L = [] := by + apply List.eq_nil_iff_forall_not_mem.mpr + intro p hp + exact hs ⟨p.1,hL p hp⟩ + subst L + rfl + +theorem prefixRelation_of_separated {m : ℕ} (E : ℕ → ℤ) (hE : ∀ j, E j ≠ 0) + (hiE : Function.Injective E) (L : List (Fin m × Bool)) + (hsep : ∀ p ∈ L, ∀ q ∈ L, p.1.val+1 ≠ q.1.val) + (he : FreeGroup.lift (fun i : Fin m => segment E 0 (i.val+2)) (FreeGroup.mk L) = 1) : + FreeGroup.mk L = 1 := by + classical + let s := (L.map Prod.fst).toFinset + have hs : ∀ i ∈ s, ∀ j ∈ s, i.val+1 ≠ j.val := by + intro i hi j hj + obtain ⟨p,hp,rfl⟩ := List.mem_map.mp (List.mem_toFinset.mp hi) + obtain ⟨q,hq,rfl⟩ := List.mem_map.mp (List.mem_toFinset.mp hj) + exact hsep p hp q hq + apply mk_eq_one_of_restricted_lift _ s (separatedSetPrefixes_injective E hE hiE s hs) L _ he + intro p hp + exact List.mem_toFinset.mpr (List.mem_map.mpr ⟨p,hp,rfl⟩) + +end RankTwo + +end + +end FreeGroupFactorMain + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/Reducing.lean b/lean/OAI/Analysis/FreeGroupFactor/Reducing.lean new file mode 100644 index 0000000000000000000000000000000000000000..7d4d247f08a8c4592cbbd4520fa5819b5fb39cf8 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/Reducing.lean @@ -0,0 +1,210 @@ +import OAI.Analysis.FreeGroupFactor.NormalExtension + +namespace OAI + +namespace FreeGroupFactorMain + +noncomputable section + +universe uA uG uH uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +section +variable {H : Type uH} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def reducingAlgebra (K : Submodule ℂ H) : StarSubalgebra ℂ (H →L[ℂ] H) where + carrier := {T | (∀ x ∈ K, T x ∈ K) ∧ ∀ x ∈ K, (star T) x ∈ K} + zero_mem' := by simp + one_mem' := by simp + add_mem' := by + rintro T U ⟨hT,hT'⟩ ⟨hU,hU'⟩ + constructor + · intro x hx; exact K.add_mem (hT x hx) (hU x hx) + · intro x hx; simpa using K.add_mem (hT' x hx) (hU' x hx) + mul_mem' := by + rintro T U ⟨hT,hT'⟩ ⟨hU,hU'⟩ + constructor + · intro x hx; exact hT _ (hU x hx) + · intro x hx; simpa using hU' _ (hT' x hx) + algebraMap_mem' := by + intro c + constructor + · intro x hx; simpa using K.smul_mem c hx + · intro x hx; simpa only [← algebraMap_star_comm, ContinuousLinearMap.algebraMap_apply] using K.smul_mem (star c) hx + star_mem' := by + rintro T ⟨hT,hT'⟩ + exact ⟨hT', by simpa using hT⟩ + +theorem reducingAlgebra_isClosed (K : Submodule ℂ H) (hK : IsClosed (K : Set H)) : + IsClosed (reducingAlgebra K : Set (H →L[ℂ] H)) := by + change IsClosed {T : H →L[ℂ] H | _ ∧ _} + simp only [Set.ofPred_and, Set.ofPred_forall] + apply IsClosed.inter + · apply isClosed_iInter + intro x + apply isClosed_iInter + intro _hx + exact hK.preimage (ContinuousLinearMap.apply ℂ H x).continuous + · apply isClosed_iInter + intro x + apply isClosed_iInter + intro _hx + exact hK.preimage ((ContinuousLinearMap.apply ℂ H x).continuous.comp continuous_star) + +omit [CompleteSpace H] in + +theorem closedSpan_invariant {G : Type uG} [Group G] + (ρ : G →* (H →L[ℂ] H)) (ξ : H) (g : G) : + ∀ x ∈ (Submodule.span ℂ (Set.range (fun a => ρ a ξ))).topologicalClosure, + ρ g x ∈ (Submodule.span ℂ (Set.range (fun a => ρ a ξ))).topologicalClosure := by + let K := (Submodule.span ℂ (Set.range (fun a => ρ a ξ))).topologicalClosure + change K ≤ K.comap (ρ g).toLinearMap + apply Submodule.topologicalClosure_minimal + · rw [Submodule.span_le] + rintro _ ⟨a,rfl⟩ + change ρ g (ρ a ξ) ∈ K + have he : ρ g (ρ a ξ) = ρ (g*a) ξ := by rw [map_mul]; rfl + rw [he] + exact Submodule.le_topologicalClosure _ (Submodule.subset_span ⟨g*a, rfl⟩) + · exact (Submodule.isClosed_topologicalClosure _).preimage (ρ g).continuous + +end + +namespace UnitaryEvaluation +variable {A : Type uA} [CStarAlgebra A] {ι : Type uι} + theorem wordHom_mem (E : StarSubalgebra ℂ A) (U : ι → unitary A) + (hU : ∀ i, (U i : A) ∈ E) (g : FreeGroup ι) : wordHom U g ∈ E := by + induction g using FreeGroup.induction_on with + | one => rw [map_one]; exact one_mem E + | of i => simpa only [wordHom_of] using hU i + | inv_of i hi => rw [wordHom_inv]; exact star_mem hi + | mul x y hx hy => rw [map_mul]; exact mul_mem hx hy + + theorem laurentValue_mem (E : StarSubalgebra ℂ A) (C : unitary A) + (hC : (C : A) ∈ E) (l : ℤ →₀ ℂ) : laurentValue C l ∈ E := by + have hp (k : ℤ) : ((C ^ k : unitary A) : A) ∈ E := by + cases k with + | ofNat n => + rw [Int.ofNat_eq_natCast, zpow_natCast] + exact pow_mem hC n + | negSucc n => + rw [zpow_negSucc] + change star ((C : A) ^ (n+1)) ∈ E + exact star_mem (pow_mem hC (n+1)) + classical + change (∑ k ∈ l.support, l k • ((C ^ k : unitary A) : A)) ∈ E + exact sum_mem fun k _ => E.smul_mem (hp k) _ +end UnitaryEvaluation + +open UnitaryEvaluation +open scoped ENNReal + + theorem flow_word_orbit_total {ι : Type uι} [Fintype ι] [DecidableEq ι] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option ι)) l)) + (X : ℝ → ι → groupVonNeumann (FreeGroup (Option ι))) + (hU : ∀ t j, X t j ∈ unitary (groupVonNeumann (FreeGroup (Option ι)))) + (hX₀ : X 0 = fun j => groupUnitary (FreeGroup.of (some j))) + (hX : ∀ t, HasDerivAt X (PolynomialFlow.field + (laurentValue (generatorUnitary (none : Option ι)) l) h (X t)) t) (t₀ : ℝ) : + ⊤ ≤ (Submodule.span ℂ (Set.range (fun g : FreeGroup (Option ι) => + ((wordHom (extendUnitary (fun j => ⟨X t₀ j, hU t₀ j⟩) + (generatorUnitary none)) g : groupVonNeumann (FreeGroup (Option ι))) : + GroupOperator (FreeGroup (Option ι))) deltaOne))).topologicalClosure := by + classical + let U := extendUnitary (fun j => ⟨X t₀ j, hU t₀ j⟩) (generatorUnitary none) + let ρ : FreeGroup (Option ι) →* GroupOperator (FreeGroup (Option ι)) := + (groupVonNeumann _).subtype.toMonoidHom.comp (wordHom U) + let K := (Submodule.span ℂ (Set.range (fun g => ρ g deltaOne))).topologicalClosure + let E := (reducingAlgebra K).comap (groupVonNeumann _).subtype + have hK : IsClosed (K : Set (GroupHilbert (FreeGroup (Option ι)))) := + Submodule.isClosed_topologicalClosure _ + have hE : IsClosed (E : Set (groupVonNeumann (FreeGroup (Option ι)))) := + (reducingAlgebra_isClosed K hK).preimage continuous_subtype_val + have hρ (g) : wordHom U g ∈ E := by + constructor + · exact closedSpan_invariant ρ deltaOne g + · have he : star (ρ g) = ρ g⁻¹ := by + change ((star (wordHom U g) : groupVonNeumann (FreeGroup (Option ι))) : + GroupOperator (FreeGroup (Option ι))) = _ + rw [← wordHom_inv] + rfl + change ∀ x ∈ K, (star (ρ g)) x ∈ K + rw [he] + exact closedSpan_invariant ρ deltaOne g⁻¹ + have hC : (generatorUnitary (none : Option ι) : groupVonNeumann _) ∈ E := by + simpa only [wordHom_of, U, extendUnitary, Option.elim_none] using hρ (FreeGroup.of none) + have hXt : ∀ j, X t₀ j ∈ E := by + intro j + simpa only [wordHom_of, U, extendUnitary, Option.elim_some] using hρ (FreeGroup.of (some j)) + have hXS := PolynomialFlow.solution_mem_subalgebra E hE + (laurentValue (generatorUnitary (none : Option ι)) l) hS + (laurentValue_mem E _ hC l) h X hX hU t₀ hXt + have hgen (i : Option ι) : (generatorUnitary i : groupVonNeumann _) ∈ E := by + cases i with + | none => exact hC + | some j => + change groupUnitary (FreeGroup.of (some j)) ∈ E + simpa only [hX₀] using hXS 0 j + have hgroup (g : FreeGroup (Option ι)) : groupUnitary g ∈ E := by + rw [← wordHom_generatorUnitary] + exact wordHom_mem E generatorUnitary hgen g + have hδ : deltaOne ∈ K := by + apply Submodule.le_topologicalClosure + apply Submodule.subset_span + exact ⟨1, by simp⟩ + have hsingle (g : FreeGroup (Option ι)) : lp.single 2 g (1 : ℂ) ∈ K := by + have hh := (hgroup g).1 deltaOne hδ + have he : (leftRegular g) deltaOne = lp.single 2 g 1 := by + ext x + simp [deltaOne, lp.single_apply, Pi.single_apply, inv_mul_eq_one, eq_comm] + change (leftRegular g) deltaOne ∈ K at hh + rwa [he] at hh + change ⊤ ≤ K + intro ξ _hξ + have hs := lp.hasSum_single (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) ξ + apply hK.mem_of_tendsto hs + filter_upwards [] with s + apply K.sum_mem + intro g _hg + have he : lp.single 2 g (ξ g) = (ξ g) • (lp.single 2 g (1 : ℂ) : GroupHilbert (FreeGroup (Option ι))) := by + ext x + simp [lp.single_apply, Pi.single_apply] + rw [he] + exact K.smul_mem _ (hsingle g) + +open UnitaryEvaluation + +theorem laurent_flow_automorphisms {ι : Type uι} [Fintype ι] [DecidableEq ι] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue (generatorUnitary (none : Option ι)) l)) : + ∃ (X : ℝ → ι → groupVonNeumann (FreeGroup (Option ι))) + (hU : ∀ t j, X t j ∈ unitary (groupVonNeumann (FreeGroup (Option ι)))), + X 0 = (fun j => groupUnitary (FreeGroup.of (some j))) ∧ + (∀ t, HasDerivAt X (PolynomialFlow.field + (laurentValue (generatorUnitary (none : Option ι)) l) h (X t)) t) ∧ + ∀ t, ∃ Φ : groupVonNeumann (FreeGroup (Option ι)) ≃⋆ₐ[ℂ] + groupVonNeumann (FreeGroup (Option ι)), + (∀ T, canonicalTrace (Φ T) = canonicalTrace T) ∧ + @Continuous _ _ (groupUltraweakTopology (FreeGroup (Option ι))) + (groupUltraweakTopology (FreeGroup (Option ι))) Φ ∧ + ∀ g, Φ (groupUnitary g) = wordHom + (extendUnitary (fun j => ⟨X t j, hU t j⟩) (generatorUnitary none)) g := by + classical + obtain ⟨X,hU,hX₀,hX,hm⟩ := actual_laurent_flow_moments h l hS + refine ⟨X,hU,hX₀,hX,?_⟩ + intro t + apply iso_extension_of_haar_total + (wordHom (extendUnitary (fun j => ⟨X t j, hU t j⟩) (generatorUnitary none))) + · intro g + exact (wordHom_inv _ g).symm + · exact hm t + · exact flow_word_orbit_total h l hS X hU hX₀ hX t + +end + +end FreeGroupFactorMain + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/SmallCocycle.lean b/lean/OAI/Analysis/FreeGroupFactor/SmallCocycle.lean new file mode 100644 index 0000000000000000000000000000000000000000..8dfc6fce9c3231bbde48019f9f7e816fc516e9ac --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/SmallCocycle.lean @@ -0,0 +1,237 @@ +import OAI.Analysis.FreeGroupFactor.RadialCoefficients + +namespace OAI + +noncomputable section + +universe uG uH uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +namespace FreeGroupFactorMain + +def coefficientNorm {G : Type uG} (h : Coeff G) : ℝ := + Real.sqrt (h.sum (fun _ r => r ^ 2)) + +theorem freeCocycle_pow_of_zero {ι : Type uι} (h : ι → Coeff (FreeGroup ι)) + (g : FreeGroup ι) (hg : freeCocycle h g = 0) (k : ℕ) : + freeCocycle h (g ^ k) = 0 := by + induction k with + | zero => simp + | succ k ih => simp [pow_succ, freeCocycle_mul, ih, hg] + +def firstCoefficients {n : ℕ} (h : Coeff (FreeGroup (Fin n))) : + Fin n → Coeff (FreeGroup (Fin n)) := fun i => if i.val = 0 then h else 0 + +def sourceA (n : ℕ) (hn : 3 ≤ n) : FreeGroup (Fin n) := + FreeGroup.of ⟨0, by omega⟩ + +def sourceB (n : ℕ) (hn : 3 ≤ n) (j : ℕ) : FreeGroup (Fin n) := + (FreeGroup.of ⟨1, by omega⟩) ^ j * FreeGroup.of ⟨2, by omega⟩ * + ((FreeGroup.of ⟨1, by omega⟩) ^ j)⁻¹ + +def sourcePrefix (n : ℕ) (hn : 3 ≤ n) : ℕ → FreeGroup (Fin n) + | 0 => 1 + | k + 1 => sourcePrefix n hn k * (sourceA n hn * sourceB n hn (k + 1)) + +def sourceWord (n : ℕ) (hn : 3 ≤ n) (m : ℕ) : FreeGroup (Fin n) := + sourcePrefix n hn m * sourceA n hn + +@[simp] theorem freeCocycle_sourceA (n : ℕ) (hn : 3 ≤ n) + (h : Coeff (FreeGroup (Fin n))) : + freeCocycle (firstCoefficients h) (sourceA n hn) = h := by + simp [sourceA, firstCoefficients] + +@[simp] theorem freeCocycle_sourceB (n : ℕ) (hn : 3 ≤ n) + (h : Coeff (FreeGroup (Fin n))) (j : ℕ) : + freeCocycle (firstCoefficients h) (sourceB n hn j) = 0 := by + have hg : freeCocycle (firstCoefficients h) + (FreeGroup.of (⟨1, by omega⟩ : Fin n)) = 0 := by + simp [firstCoefficients] + have hz := freeCocycle_pow_of_zero (firstCoefficients h) _ hg j + simp [sourceB, freeCocycle_mul, freeCocycle_inv, hz, firstCoefficients] + +theorem freeCocycle_sourcePrefix (n : ℕ) (hn : 3 ≤ n) + (h : Coeff (FreeGroup (Fin n))) (m : ℕ) : + freeCocycle (firstCoefficients h) (sourcePrefix n hn m) = + ∑ j ∈ Finset.range m, coefficientShift (sourcePrefix n hn j) h := by + induction m with + | zero => simp [sourcePrefix] + | succ m ih => + rw [sourcePrefix, freeCocycle_mul, freeCocycle_mul] + simp [ih, Finset.sum_range_succ] + +theorem freeCocycle_sourceWord (n : ℕ) (hn : 3 ≤ n) + (h : Coeff (FreeGroup (Fin n))) (m : ℕ) : + freeCocycle (firstCoefficients h) (sourceWord n hn m) = + ∑ j ∈ Finset.range (m + 1), coefficientShift (sourcePrefix n hn j) h := by + rw [sourceWord, freeCocycle_mul, freeCocycle_sourcePrefix, freeCocycle_sourceA, + Finset.sum_range_succ] + +namespace PrefixSeparation + +def integerAction : Multiplicative ℤ →* MulAut (FreeGroup ℤ) where + toFun k := FreeGroup.freeGroupCongr (Equiv.addLeft k.toAdd) + map_one' := by + apply MulEquiv.toMonoidHom_injective + apply FreeGroup.ext_hom + intro j + simp [FreeGroup.freeGroupCongr_apply] + map_mul' k l := by + apply MulEquiv.toMonoidHom_injective + apply FreeGroup.ext_hom + intro j + simp [FreeGroup.freeGroupCongr_apply, add_assoc] + +abbrev Witness := FreeGroup ℤ ⋊[integerAction] Multiplicative ℤ + +@[simp] theorem integerAction_of (k : Multiplicative ℤ) (j : ℤ) : + integerAction k (FreeGroup.of j) = FreeGroup.of (k.toAdd + j) := by + simp [integerAction, FreeGroup.freeGroupCongr_apply] + +def witnessHom (n : ℕ) : FreeGroup (Fin n) →* Witness := + FreeGroup.lift (fun i => + if i.val = 1 then SemidirectProduct.inr (Multiplicative.ofAdd (1 : ℤ)) + else if i.val = 2 then SemidirectProduct.inl (FreeGroup.of (0 : ℤ)) else 1) + +@[simp] theorem witnessHom_sourceA (n : ℕ) (hn : 3 ≤ n) : + witnessHom n (sourceA n hn) = 1 := by + simp [witnessHom, sourceA] + +@[simp] theorem witnessHom_sourceB (n : ℕ) (hn : 3 ≤ n) (j : ℕ) : + witnessHom n (sourceB n hn j) = SemidirectProduct.inl (FreeGroup.of (j : ℤ)) := by + simp only [sourceB, map_mul, map_inv, map_pow] + simp only [witnessHom, FreeGroup.lift_apply_of, show (2 : ℕ) ≠ 1 by decide, ↓reduceIte] + rw [← map_pow, ← map_inv, ← SemidirectProduct.inl_aut, integerAction_of] + simp + +def integerPrefix : ℕ → FreeGroup ℤ + | 0 => 1 + | k + 1 => integerPrefix k * FreeGroup.of (k + 1 : ℤ) + +@[simp] theorem witnessHom_sourcePrefix (n : ℕ) (hn : 3 ≤ n) (j : ℕ) : + witnessHom n (sourcePrefix n hn j) = SemidirectProduct.inl (integerPrefix j) := by + induction j with + | zero => simp [sourcePrefix, integerPrefix] + | succ j ih => simp [sourcePrefix, integerPrefix, ih] + +def prefixHom (n : ℕ) (hn : 3 ≤ n) (m : ℕ) : FreeGroup (Fin m) →* FreeGroup (Fin n) := + FreeGroup.lift (fun i => sourcePrefix n hn (i.val + 1)) + +def targetPrefix (m k : ℕ) : FreeGroup (Fin m) := + if k = 0 then 1 else if h : k - 1 < m then FreeGroup.of ⟨k - 1, h⟩ else 1 + +@[simp] theorem targetPrefix_zero (m : ℕ) : targetPrefix m 0 = 1 := by + simp [targetPrefix] + +@[simp] theorem targetPrefix_generator (m : ℕ) (i : Fin m) : + targetPrefix m (i.val + 1) = FreeGroup.of i := by + simp [targetPrefix, i.isLt] + +def telescopeHom (m : ℕ) : FreeGroup ℤ →* FreeGroup (Fin m) := + FreeGroup.lift (fun z => (targetPrefix m (z.toNat - 1))⁻¹ * targetPrefix m z.toNat) + +@[simp] theorem telescopeHom_integerPrefix (m j : ℕ) : + telescopeHom m (integerPrefix j) = targetPrefix m j := by + induction j with + | zero => simp [integerPrefix] + | succ j ih => + rw [integerPrefix, map_mul, ih] + simp [telescopeHom] + +theorem witnessHom_prefixHom (n : ℕ) (hn : 3 ≤ n) (m : ℕ) : + (witnessHom n).comp (prefixHom n hn m) = + (SemidirectProduct.inl (φ := integerAction)).comp + (FreeGroup.lift (fun i : Fin m => integerPrefix (i.val + 1))) := by + apply FreeGroup.ext_hom + intro i + simp [prefixHom] + +theorem telescope_leftInverse (m : ℕ) : + (telescopeHom m).comp (FreeGroup.lift (fun i : Fin m => integerPrefix (i.val + 1))) = + MonoidHom.id (FreeGroup (Fin m)) := by + ext i + simp + +theorem prefixHom_injective (n : ℕ) (hn : 3 ≤ n) (m : ℕ) : + Function.Injective (prefixHom n hn m) := by + intro g h hgh + have he := congrArg (witnessHom n) hgh + have hw := witnessHom_prefixHom n hn m + change ((witnessHom n).comp (prefixHom n hn m)) g = + ((witnessHom n).comp (prefixHom n hn m)) h at he + rw [hw] at he + have he' := SemidirectProduct.inl_injective he + have he'' := congrArg (telescopeHom m) he' + change ((telescopeHom m).comp _) g = ((telescopeHom m).comp _) h at he'' + simpa only [telescope_leftInverse, MonoidHom.id_apply] using he'' + +end PrefixSeparation + +def pushCoefficients {G : Type uG} {H : Type uH} [Group G] [Group H] (f : G →* H) : + (G →₀ ℝ) →ₗ[ℝ] (H →₀ ℝ) := Finsupp.lmapDomain ℝ ℝ f + +@[simp] theorem pushCoefficients_single {G : Type uG} {H : Type uH} [Group G] [Group H] + (f : G →* H) (g : G) (c : ℝ) : + pushCoefficients f (Finsupp.single g c) = Finsupp.single (f g) c := by + exact Finsupp.mapDomain_single + +@[simp] theorem coefficientShift_single {G : Type uG} [Group G] (g b : G) (c : ℝ) : + coefficientShift g (Finsupp.single b c) = Finsupp.single (g * b) c := by + exact Finsupp.equivMapDomain_single (Equiv.mulLeft g) b c + +theorem pushCoefficients_shift {ι : Type uι} {H : Type uH} [Group H] + (f : FreeGroup ι →* H) (g : FreeGroup ι) (h : FreeGroup ι →₀ ℝ) : + pushCoefficients f (Radial.shift g h) = coefficientShift (f g) (pushCoefficients f h) := by + induction h using Finsupp.induction_linear with + | zero => simp + | add h k ih ik => simp only [map_add, ih, ik] + | single b c => simp [Radial.shift_single] + +theorem sqNorm_pushCoefficients {G : Type uG} {H : Type uH} [Group G] [Group H] + (f : G →* H) (hf : Function.Injective f) (h : G →₀ ℝ) : + coefficientSqNorm (pushCoefficients f h) = coefficientSqNorm h := by + exact Finsupp.sum_mapDomain_index_inj hf + +theorem cocycle_push_prefix_inverse (n : ℕ) (hn : 3 ≤ n) (m : ℕ) + (h : FreeGroup (Fin m) →₀ ℝ) : + freeCocycle (firstCoefficients (pushCoefficients (PrefixSeparation.prefixHom n hn m) h)) + (sourceWord n hn m) = + pushCoefficients (PrefixSeparation.prefixHom n hn m) (Radial.prefixSumOperator m h) := by + rw [freeCocycle_sourceWord, Finset.sum_range_succ'] + rw [show sourcePrefix n hn 0 = 1 from rfl, coefficientShift_one] + rw [Radial.prefixSumOperator, map_add, Radial.sumShift_apply, map_sum] + simp_rw [pushCoefficients_shift] + have hpf (i : Fin m) : PrefixSeparation.prefixHom n hn m (FreeGroup.of i) = + sourcePrefix n hn (i.val + 1) := by simp [PrefixSeparation.prefixHom] + simp_rw [hpf] + rw [Fin.sum_univ_eq_sum_range (fun k => coefficientShift (sourcePrefix n hn (k + 1)) + (pushCoefficients (PrefixSeparation.prefixHom n hn m) h)) m] + exact add_comm _ _ + +theorem smallCocycle (n : ℕ) (hn : 3 ≤ n) (η : ℝ) (hη : 0 < η) : + ∃ (w : FreeGroup (Fin n)) (h : Coeff (FreeGroup (Fin n))), + coefficientNorm h < η ∧ + coefficientNorm (freeCocycle (firstCoefficients h) w - Finsupp.single 1 1) < η := by + obtain ⟨m, _hm, h, hh, herr⟩ := Radial.exists_small_prefix_inverse (η ^ 2) (sq_pos_of_pos hη) + let f := PrefixSeparation.prefixHom n hn m + have hf : Function.Injective f := PrefixSeparation.prefixHom_injective n hn m + refine ⟨sourceWord n hn m, pushCoefficients f h, ?_, ?_⟩ + · apply (Real.sqrt_lt' hη).mpr + change coefficientSqNorm (pushCoefficients f h) < η ^ 2 + rwa [sqNorm_pushCoefficients f hf] + · apply (Real.sqrt_lt' hη).mpr + change coefficientSqNorm + (freeCocycle (firstCoefficients (pushCoefficients f h)) (sourceWord n hn m) - + Finsupp.single 1 1) < η ^ 2 + rw [cocycle_push_prefix_inverse] + have hδ : pushCoefficients f (Finsupp.single 1 1) = Finsupp.single 1 1 := by simp + rw [← hδ, ← map_sub, sqNorm_pushCoefficients f hf] + exact herr + +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/Taylor.lean b/lean/OAI/Analysis/FreeGroupFactor/Taylor.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb32596c06572a759bf9fcc675e804b65bf155c5 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/Taylor.lean @@ -0,0 +1,141 @@ +import OAI.Analysis.FreeGroupFactor.UnitaryEvaluation + +namespace OAI + +noncomputable section + +universe uA uι + +open Set Metric Filter +open scoped NNReal Topology BigOperators ContDiff + +open scoped Topology ContDiff +open Set Filter +namespace FreeGroupFactorMain + +theorem flat_local_of_factorial_bound (f : ℝ → ℝ) (hf : ContDiff ℝ ∞ f) + (B c : ℝ) (_hB : 0 ≤ B) (hc : 0 < c) + (hbound : ∀ r t, |iteratedDeriv r f t| ≤ B * c ^ r * (r.factorial : ℝ)) + (a : ℝ) (ha : ∀ r, iteratedDeriv (r + 1) f a = 0) + (x : ℝ) (hx : c * |x - a| < 1) : f x = f a := by + by_cases hax : a = x + · simp [hax] + have htaylor (n : ℕ) : taylorWithinEval f n (uIcc a x) a x = f a := by + induction n with + | zero => simp + | succ n ih => + rw [taylorWithinEval_succ, ih, + iteratedDerivWithin_eq_iteratedDeriv (uniqueDiffOn_uIcc hax) + ((hf.of_le (by exact_mod_cast (le_top : ((n + 1 : ℕ) : ℕ∞) ≤ ⊤))).contDiffAt) + (left_mem_uIcc), ha n] + simp + have hest (n : ℕ) : |f x - f a| ≤ B * (c * |x - a|) ^ (n + 1) := by + obtain ⟨y, _, hy⟩ := taylor_mean_remainder_lagrange_iteratedDeriv hax + ((hf.of_le (by exact_mod_cast (le_top : ((n + 1 : ℕ) : ℕ∞) ≤ ⊤))).contDiffOn) + rw [htaylor] at hy + have hfpos : (0 : ℝ) < ((n + 1).factorial : ℝ) := by positivity + calc + |f x - f a| = |iteratedDeriv (n + 1) f y| * |x - a| ^ (n + 1) / + ((n + 1).factorial : ℝ) := by rw [hy, abs_div, abs_mul, abs_pow, abs_of_pos hfpos] + _ ≤ (B * c ^ (n + 1) * ((n + 1).factorial : ℝ)) * |x - a| ^ (n + 1) / + ((n + 1).factorial : ℝ) := by gcongr; exact hbound _ _ + _ = B * (c * |x - a|) ^ (n + 1) := by rw [mul_pow]; field_simp + have hlim : Tendsto (fun n : ℕ => B * (c * |x - a|) ^ (n + 1)) atTop (nhds 0) := by + have hp := (tendsto_pow_atTop_nhds_zero_of_lt_one (mul_nonneg hc.le (abs_nonneg _)) hx) + simpa using (hp.comp (tendsto_add_atTop_nat 1)).const_mul B + have hz : |f x - f a| ≤ 0 := ge_of_tendsto hlim (Eventually.of_forall hest) + exact sub_eq_zero.mp (abs_nonpos_iff.mp hz) + +theorem flat_global_of_factorial_bound (f : ℝ → ℝ) (hf : ContDiff ℝ ∞ f) + (B c : ℝ) (hB : 0 ≤ B) (hc : 0 < c) + (hbound : ∀ r t, |iteratedDeriv r f t| ≤ B * c ^ r * (r.factorial : ℝ)) + (ha : ∀ r, iteratedDeriv (r + 1) f 0 = 0) (x : ℝ) : f x = f 0 := by + let Z : Set ℝ := {a | ∀ r, iteratedDeriv (r + 1) f a = 0} + have hclosed : IsClosed Z := by + change IsClosed {a | ∀ r, iteratedDeriv (r + 1) f a = 0} + simp only [ofPred_forall] + apply isClosed_iInter + intro r + exact isClosed_eq (hf.continuous_iteratedDeriv (r + 1) (by exact_mod_cast (le_top : ((r + 1 : ℕ) : ℕ∞) ≤ ⊤))) continuous_const + have hopen : IsOpen Z := by + apply isOpen_iff_mem_nhds.mpr + intro a ha + have hδ : 0 < c⁻¹ := inv_pos.mpr hc + apply Filter.mem_of_superset (Metric.ball_mem_nhds a hδ) + intro y hy + have heq : f =ᶠ[nhds y] (fun _ => f a) := by + filter_upwards [Metric.isOpen_ball.mem_nhds hy] with z hz + apply flat_local_of_factorial_bound f hf B c hB hc hbound a ha z + rw [Metric.mem_ball, Real.dist_eq] at hz + have := mul_lt_mul_of_pos_left hz hc + simpa [ne_of_gt hc] using this + intro r + rw [heq.iteratedDeriv_eq (r + 1)] + simp [iteratedDeriv_const] + have hall : Z = univ := (show IsClopen Z from ⟨hclosed, hopen⟩).eq_univ ⟨0, ha⟩ + have hderiv (a : ℝ) : deriv f a = 0 := by + have hz : a ∈ Z := hall ▸ mem_univ a + simpa using hz 0 + exact isOpen_univ.is_const_of_deriv_eq_zero isPreconnected_univ + (fun a _ => ((hf.of_le (by simp : (1 : ℕ∞ω) ≤ ∞)).differentiable (by simp)).differentiableOn a (mem_univ a)) + (fun a _ => hderiv a) (mem_univ x) (mem_univ 0) + +namespace NCPolynomial + +theorem iteratedDeriv_moment {ι : Type uι} {A : Type uA} [NormedRing A] [NormedAlgebra ℂ A] + (X : ℝ → ι → A) (V : ι → Expr ι) (L : A →L[ℝ] ℝ) + (hX : ∀ t i, HasDerivAt (fun s => X s i) (eval (X t) (V i)) t) + (p : Expr ι) (r : ℕ) : + iteratedDeriv r (fun t => L (eval (X t) p)) = + fun t => L (eval (X t) ((delta V)^[r] p)) := by + induction r with + | zero => rfl + | succ r ih => + rw [iteratedDeriv_succ, ih] + funext t + rw [Function.iterate_succ_apply'] + convert! (L.hasFDerivAt.comp_hasDerivAt t (hasDerivAt_eval X V t (hX t) ((delta V)^[r] p))).deriv using 1 + +theorem polynomial_moments {ι : Type uι} {A : Type uA} [NormedRing A] [NormedAlgebra ℂ A] + [NormOneClass A] (X : ℝ → ι → A) (V : ι → Expr ι) (L : A →L[ℝ] ℝ) + (hsmooth : ∀ i, ContDiff ℝ ∞ (fun t => X t i)) + (hX : ∀ t i, HasDerivAt (fun s => X s i) (eval (X t) (V i)) t) + (R : ℝ) (hR : 1 ≤ R) (hbounded : ∀ t i, ‖X t i‖ ≤ R) + (J : ℕ) (B : ℝ) (hB : 0 ≤ B) + (hdeg : ∀ i, degree (V i) ≤ J + 1) (hmass : ∀ i, mass (V i) ≤ B) + (htrace : ∀ p, L (eval (X 0) (delta V p)) = 0) + (p : Expr ι) (t : ℝ) : L (eval (X t) p) = L (eval (X 0) p) := by + let b := ‖L‖ * (mass p * R ^ degree p) + let c := B * ((degree p : ℝ) + J) * R ^ J + 1 + have hR0 : 0 ≤ R := le_trans zero_le_one hR + have hbase : 0 ≤ B * ((degree p : ℝ) + J) * R ^ J := by positivity + have hb : 0 ≤ b := mul_nonneg (norm_nonneg _) (mul_nonneg (mass_nonneg _) (pow_nonneg hR0 _)) + have hc : 0 < c := by dsimp [c]; linarith + apply flat_global_of_factorial_bound (fun t => L (eval (X t) p)) (L.contDiff.comp (smooth_eval X hsmooth p)) b c hb hc + · intro r u + rw [iteratedDeriv_moment X V L hX] + calc + |L (eval (X u) ((delta V)^[r] p))| ≤ ‖L‖ * ‖eval (X u) ((delta V)^[r] p)‖ := + L.le_opNorm _ + _ ≤ ‖L‖ * ((mass p * R ^ degree p) * + (B * ((degree p : ℝ) + J) * R ^ J) ^ r * (r.factorial : ℝ)) := by + gcongr + exact norm_eval_iterate (X u) R hR (hbounded u) V J B hB hdeg hmass p r + _ ≤ b * c ^ r * (r.factorial : ℝ) := by + dsimp [b] + calc + _ = (‖L‖ * (mass p * R ^ degree p)) * + (B * ((degree p : ℝ) + J) * R ^ J) ^ r * (r.factorial : ℝ) := by ring + _ ≤ _ := by + gcongr + dsimp [c]; linarith + · intro r + rw [iteratedDeriv_moment X V L hX, Function.iterate_succ_apply'] + exact htrace _ + +end NCPolynomial +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/TraceCocycle.lean b/lean/OAI/Analysis/FreeGroupFactor/TraceCocycle.lean new file mode 100644 index 0000000000000000000000000000000000000000..892aa39f43decab97bcdd93d2bc12f88a35f7c90 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/TraceCocycle.lean @@ -0,0 +1,390 @@ +import OAI.Analysis.FreeGroupFactor.NCPolynomial + +namespace OAI + +noncomputable section + +universe uA uB uG uι + +open Set Metric +open scoped NNReal Topology BigOperators ContDiff + +namespace FreeGroupFactorMain +namespace TraceCocycle + +abbrev CF (G : Type uG) := G →₀ ℂ + +def shift {G : Type uG} [Group G] (g : G) : CF G ≃+ CF G := + Finsupp.domCongr (MulAut.conj g).toEquiv + +@[simp] theorem shift_apply {G : Type uG} [Group G] (g : G) (p : CF G) (b : G) : + shift g p b = p (g⁻¹ * b * g) := rfl + +@[simp] theorem shift_one {G : Type uG} [Group G] (p : CF G) : shift (1 : G) p = p := by + ext b + simp + +@[simp] theorem shift_mul {G : Type uG} [Group G] (g b : G) (p : CF G) : + shift (g * b) p = shift g (shift b p) := by + ext c + simp [mul_assoc] + +def action (G : Type uG) [Group G] : G →* MulAut (Multiplicative (CF G)) where + toFun g := AddEquiv.toMultiplicative (shift g) + map_one' := by + apply MulEquiv.ext + intro p + exact shift_one p.toAdd + map_mul' g b := by + apply MulEquiv.ext + intro p + exact shift_mul g b p.toAdd + +def graph {ι : Type uι} (h : ι → CF (FreeGroup ι)) : + FreeGroup ι →* (Multiplicative (CF (FreeGroup ι)) ⋊[action (FreeGroup ι)] FreeGroup ι) := + FreeGroup.lift (fun i => ⟨Multiplicative.ofAdd (h i), FreeGroup.of i⟩) + +@[simp] theorem graph_right {ι : Type uι} (h : ι → CF (FreeGroup ι)) (g : FreeGroup ι) : + (graph h g).right = g := by + have hr : SemidirectProduct.rightHom.comp (graph h) = MonoidHom.id _ := by + ext i + simp [graph] + exact DFunLike.congr_fun hr g + +def cocycle {ι : Type uι} (h : ι → CF (FreeGroup ι)) (g : FreeGroup ι) : CF (FreeGroup ι) := + (graph h g).left.toAdd + +@[simp] theorem cocycle_of {ι : Type uι} (h : ι → CF (FreeGroup ι)) (i : ι) : + cocycle h (FreeGroup.of i) = h i := by + simp [cocycle, graph] + +@[simp] theorem cocycle_one {ι : Type uι} (h : ι → CF (FreeGroup ι)) : cocycle h 1 = 0 := by + simp [cocycle] + +theorem cocycle_mul {ι : Type uι} (h : ι → CF (FreeGroup ι)) (g b : FreeGroup ι) : + cocycle h (g * b) = cocycle h g + shift g (cocycle h b) := by + unfold cocycle + rw [map_mul, SemidirectProduct.mul_left, graph_right] + rfl + +theorem cocycle_inv {ι : Type uι} (h : ι → CF (FreeGroup ι)) (g : FreeGroup ι) : + cocycle h g⁻¹ = -shift g⁻¹ (cocycle h g) := by + have he := cocycle_mul h g⁻¹ g + simp only [inv_mul_cancel, cocycle_one] at he + exact eq_neg_of_add_eq_zero_left he.symm + +def traceDerivative {ι : Type uι} (h : ι → CF (FreeGroup ι)) (g : FreeGroup ι) : ℂ := + cocycle h g g⁻¹ + +theorem traceDerivative_conjugate {ι : Type uι} (h : ι → CF (FreeGroup ι)) + (a g : FreeGroup ι) : + traceDerivative h (a * g * a⁻¹) = traceDerivative h g := by + simp only [traceDerivative, cocycle_mul, cocycle_inv, shift_apply, + Finsupp.add_apply, Finsupp.neg_apply, mul_inv_rev, inv_inv] + simp only [mul_assoc, inv_mul_cancel_left, inv_mul_cancel, mul_one] + ring + +def CyclicConjugate {G : Type uG} [Group G] (c b : G) : Prop := + ∃ (a : G) (k : ℤ), b = a * c ^ k * a⁻¹ + +theorem CyclicConjugate.conj {G : Type uG} [Group G] {c b : G} + (hb : CyclicConjugate c b) (g : G) : CyclicConjugate c (g * b * g⁻¹) := by + obtain ⟨a, k, rfl⟩ := hb + exact ⟨g * a, k, by simp [mul_assoc]⟩ + +theorem CyclicConjugate.inv {G : Type uG} [Group G] {c b : G} + (hb : CyclicConjugate c b) : CyclicConjugate c b⁻¹ := by + obtain ⟨a, k, rfl⟩ := hb + exact ⟨a, -k, by simp [mul_assoc]⟩ + +def SupportedOn {G : Type uG} (P : G → Prop) (p : CF G) : Prop := + ∀ b, ¬P b → p b = 0 + +@[simp] theorem supported_zero {G : Type uG} (P : G → Prop) : SupportedOn P (0 : CF G) := by + intro b hb + rfl + +theorem supported_add {G : Type uG} {P : G → Prop} {p q : CF G} + (hp : SupportedOn P p) (hq : SupportedOn P q) : SupportedOn P (p + q) := by + intro b hb + simp [hp b hb, hq b hb] + +theorem supported_neg {G : Type uG} {P : G → Prop} {p : CF G} + (hp : SupportedOn P p) : SupportedOn P (-p) := by + intro b hb + simp [hp b hb] + +theorem supported_shift {G : Type uG} [Group G] {c : G} {p : CF G} + (hp : SupportedOn (CyclicConjugate c) p) (g : G) : + SupportedOn (CyclicConjugate c) (shift g p) := by + intro b hb + apply hp + intro h + have := h.conj g + apply hb + simpa [mul_assoc] using this + +end TraceCocycle +end FreeGroupFactorMain + +namespace FreeGroupFactorMain.TraceCocycle + + theorem cocycle_supported {ι : Type uι} (h : ι → CF (FreeGroup ι)) (c : FreeGroup ι) + (hh : ∀ i, SupportedOn (CyclicConjugate c) (h i)) (g : FreeGroup ι) : + SupportedOn (CyclicConjugate c) (cocycle h g) := by + induction g using FreeGroup.induction_on with + | one => simp + | of i => simpa using hh i + | inv_of g hg => rw [cocycle_inv]; exact supported_neg (supported_shift hg _) + | mul g b hg hb => rw [cocycle_mul]; exact supported_add hg (supported_shift hb _) + + theorem cocycle_pow_zero {ι : Type uι} (h : ι → CF (FreeGroup ι)) (c : FreeGroup ι) + (hc : cocycle h c = 0) (k : ℕ) : cocycle h (c ^ k) = 0 := by + induction k with + | zero => simp + | succ k ih => simp [pow_succ, cocycle_mul, ih, hc] + + theorem cocycle_zpow_zero {ι : Type uι} (h : ι → CF (FreeGroup ι)) (c : FreeGroup ι) + (hc : cocycle h c = 0) (k : ℤ) : cocycle h (c ^ k) = 0 := by + cases k with + | ofNat k => simpa using cocycle_pow_zero h c hc k + | negSucc k => simp [zpow_negSucc, cocycle_inv, cocycle_pow_zero h c hc] + + theorem universalGroupTraceIdentity {ι : Type uι} (h : ι → CF (FreeGroup ι)) (c : ι) + (hh : ∀ i, SupportedOn (CyclicConjugate (FreeGroup.of c)) (h i)) + (hc : h c = 0) (g : FreeGroup ι) : traceDerivative h g = 0 := by + classical + by_cases hg : CyclicConjugate (FreeGroup.of c) g + · obtain ⟨a, k, rfl⟩ := hg + rw [traceDerivative_conjugate, traceDerivative, + cocycle_zpow_zero h _ (by simpa using hc)] + rfl + · apply cocycle_supported h (FreeGroup.of c) hh g + intro hginv + exact hg (by simpa using hginv.inv) + +def rightShift {G : Type uG} [Group G] (g : G) : CF G ≃ₗ[ℂ] CF G := + Finsupp.domLCongr (Equiv.mulRight g) + +@[simp] theorem rightShift_apply {G : Type uG} [Group G] (g : G) (p : CF G) (b : G) : + rightShift g p b = p (b * g⁻¹) := rfl + +def polynomialDerivative {ι : Type uι} (h : ι → CF (FreeGroup ι)) : + CF (FreeGroup ι) →ₗ[ℂ] CF (FreeGroup ι) := + Finsupp.linearCombination ℂ (fun g => rightShift g (cocycle h g)) + +@[simp] theorem polynomialDerivative_single {ι : Type uι} (h : ι → CF (FreeGroup ι)) + (g : FreeGroup ι) (a : ℂ) : + polynomialDerivative h (Finsupp.single g a) = a • rightShift g (cocycle h g) := by + simp [polynomialDerivative] + + theorem polynomialDerivative_trace_zero {ι : Type uι} (h : ι → CF (FreeGroup ι)) (c : ι) + (hh : ∀ i, SupportedOn (CyclicConjugate (FreeGroup.of c)) (h i)) + (hc : h c = 0) (p : CF (FreeGroup ι)) : (polynomialDerivative h p) 1 = 0 := by + induction p using Finsupp.induction_linear with + | zero => simp + | add p q hp hq => simp [map_add, hp, hq] + | single g a => + simp only [polynomialDerivative_single, Finsupp.smul_apply, smul_eq_mul, + rightShift_apply, one_mul] + change a * traceDerivative h g = 0 + rw [universalGroupTraceIdentity h c hh hc, mul_zero] + + theorem iteratedDerivative_trace_zero {ι : Type uι} (h : ι → CF (FreeGroup ι)) (c : ι) + (hh : ∀ i, SupportedOn (CyclicConjugate (FreeGroup.of c)) (h i)) + (hc : h c = 0) (p : CF (FreeGroup ι)) (r : ℕ) : + ((polynomialDerivative h)^[r + 1] p) 1 = 0 := by + rw [Function.iterate_succ_apply'] + exact polynomialDerivative_trace_zero h c hh hc _ + +def algebraDerivative {ι : Type uι} (h : ι → CF (FreeGroup ι)) : + MonoidAlgebra ℂ (FreeGroup ι) →ₗ[ℂ] MonoidAlgebra ℂ (FreeGroup ι) := + (MonoidAlgebra.coeffLinearEquiv ℂ).symm.toLinearMap ∘ₗ + polynomialDerivative h ∘ₗ (MonoidAlgebra.coeffLinearEquiv ℂ).toLinearMap + +@[simp] theorem algebraDerivative_coeff {ι : Type uι} (h : ι → CF (FreeGroup ι)) + (p : MonoidAlgebra ℂ (FreeGroup ι)) : + (algebraDerivative h p).coeff = polynomialDerivative h p.coeff := rfl + +@[simp] theorem algebraDerivative_of_coeff {ι : Type uι} (h : ι → CF (FreeGroup ι)) + (g : FreeGroup ι) (b : FreeGroup ι) : + (algebraDerivative h (MonoidAlgebra.of ℂ (FreeGroup ι) g)).coeff b = + cocycle h g (b * g⁻¹) := by + simp [MonoidAlgebra.of_apply] + +theorem algebraDerivative_mul_of {ι : Type uι} (h : ι → CF (FreeGroup ι)) + (g b : FreeGroup ι) : + algebraDerivative h (MonoidAlgebra.of ℂ (FreeGroup ι) g * + MonoidAlgebra.of ℂ (FreeGroup ι) b) = + algebraDerivative h (MonoidAlgebra.of ℂ (FreeGroup ι) g) * + MonoidAlgebra.of ℂ (FreeGroup ι) b + + MonoidAlgebra.of ℂ (FreeGroup ι) g * + algebraDerivative h (MonoidAlgebra.of ℂ (FreeGroup ι) b) := by + rw [← map_mul] + ext x + simp [MonoidAlgebra.of_apply, cocycle_mul, mul_assoc] + +theorem algebraDerivative_mul {ι : Type uι} (h : ι → CF (FreeGroup ι)) + (p q : MonoidAlgebra ℂ (FreeGroup ι)) : + algebraDerivative h (p * q) = algebraDerivative h p * q + p * algebraDerivative h q := by + induction p using MonoidAlgebra.induction_on with + | of g => + induction q using MonoidAlgebra.induction_on with + | of b => exact algebraDerivative_mul_of h g b + | add q₁ q₂ ih₁ ih₂ => simp only [mul_add, map_add, ih₁, ih₂]; abel + | smul r q ih => simp only [mul_smul_comm, map_smul, ih, smul_add] + | add p₁ p₂ ih₁ ih₂ => simp only [add_mul, map_add, ih₁, ih₂]; abel + | smul r p ih => simp only [smul_mul_assoc, map_smul, ih, smul_add] + +def laurent {G : Type uG} [Group G] (c : G) (l : ℤ →₀ ℂ) : CF G := + Finsupp.linearCombination ℂ (fun k => Finsupp.single (c ^ k) 1) l + +theorem supported_smul {G : Type uG} {P : G → Prop} {p : CF G} + (hp : SupportedOn P p) (a : ℂ) : SupportedOn P (a • p) := by + intro b hb + simp [hp b hb] + +theorem laurent_supported {G : Type uG} [Group G] (c : G) (l : ℤ →₀ ℂ) : + SupportedOn (CyclicConjugate c) (laurent c l) := by + classical + induction l using Finsupp.induction_linear with + | zero => simp [laurent] + | add p q hp hq => simpa only [laurent, map_add] using supported_add hp hq + | single k a => + simp only [laurent, Finsupp.linearCombination_single] + apply supported_smul + intro b hb + apply Finsupp.single_eq_of_ne + intro heq + apply hb + exact ⟨1, k, by simpa using heq⟩ + +def fieldCoefficients {ι : Type uι} (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) : + Option ι → CF (FreeGroup (Option ι)) + | none => 0 + | some i => (h i).sum fun g a => ((a : ℂ) * Complex.I) • + shift (FreeGroup.map Option.some g) (laurent (FreeGroup.of none) l) + +theorem fieldCoefficients_supported {ι : Type uι} (h : ι → FreeGroup ι →₀ ℝ) + (l : ℤ →₀ ℂ) (i : Option ι) : + SupportedOn (CyclicConjugate (FreeGroup.of none)) (fieldCoefficients h l i) := by + classical + cases i with + | none => exact supported_zero _ + | some i => + intro b hb + simp only [fieldCoefficients, Finsupp.sum, Finsupp.finsetSum_apply] + apply Finset.sum_eq_zero + intro g hg + exact supported_smul (supported_shift (laurent_supported _ _) _) _ b hb + +theorem sourceLaurentTraceIdentity {ι : Type uι} (h : ι → FreeGroup ι →₀ ℝ) + (l : ℤ →₀ ℂ) (p : MonoidAlgebra ℂ (FreeGroup (Option ι))) (r : ℕ) : + ((algebraDerivative (fieldCoefficients h l))^[r + 1] p).coeff 1 = 0 := by + rw [Function.iterate_succ_apply', algebraDerivative_coeff] + exact polynomialDerivative_trace_zero _ none (fieldCoefficients_supported h l) rfl _ + +end FreeGroupFactorMain.TraceCocycle + +namespace FreeGroupFactorMain +namespace AlgebraPolynomial +open NCPolynomial + +def signed {ι : Type uι} (ib : ι × Bool) : FreeGroup ι := + if ib.2 then FreeGroup.of ib.1 else (FreeGroup.of ib.1)⁻¹ + +def wordExpr {ι : Type uι} : List (ι × Bool) → Expr (ι × Bool) + | [] => .scalar 1 + | a :: w => .mul (.gen a) (wordExpr w) + +theorem eval_wordExpr {ι : Type uι} {A : Type uA} [Semiring A] [Algebra ℂ A] + (ρ : FreeGroup ι →* A) (w : List (ι × Bool)) : + eval (fun ib => ρ (signed ib)) (wordExpr w) = ρ (FreeGroup.mk w) := by + induction w with + | nil => simp [wordExpr, eval, ← FreeGroup.one_eq_mk] + | cons a w ih => + rcases a with ⟨i, b⟩ + change ρ (signed (i, b)) * eval (fun ib => ρ (signed ib)) (wordExpr w) = _ + rw [ih, ← map_mul] + cases b <;> rfl + +def groupExpr {ι : Type uι} [DecidableEq ι] (g : FreeGroup ι) : Expr (ι × Bool) := + wordExpr g.toWord + +theorem eval_groupExpr {ι : Type uι} {A : Type uA} [DecidableEq ι] [Semiring A] [Algebra ℂ A] + (ρ : FreeGroup ι →* A) (g : FreeGroup ι) : + eval (fun ib => ρ (signed ib)) (groupExpr g) = ρ g := by + rw [groupExpr, eval_wordExpr, FreeGroup.mk_toWord] + +def sumExpr {ι : Type uι} : List (Expr ι) → Expr ι + | [] => .scalar 0 + | p :: ps => .add p (sumExpr ps) + +theorem eval_sumExpr {ι : Type uι} {A : Type uA} [Semiring A] [Algebra ℂ A] + (X : ι → A) (ps : List (Expr ι)) : + eval X (sumExpr ps) = (ps.map (eval X)).sum := by + induction ps with + | nil => simp [sumExpr, eval] + | cons p ps ih => simp [sumExpr, eval, ih] + +def encode {ι : Type uι} [DecidableEq ι] (p : MonoidAlgebra ℂ (FreeGroup ι)) : + Expr (ι × Bool) := + sumExpr (p.coeff.support.toList.map fun g => .mul (.scalar (p.coeff g)) (groupExpr g)) + +theorem eval_encode {ι : Type uι} [DecidableEq ι] (p : MonoidAlgebra ℂ (FreeGroup ι)) : + eval (fun ib => MonoidAlgebra.of ℂ (FreeGroup ι) (signed ib)) (encode p) = p := by + classical + rw [encode, eval_sumExpr, List.map_map] + simp only [Function.comp_def, eval] + simp_rw [eval_groupExpr] + simp only [Algebra.algebraMap_eq_smul_one, smul_mul_assoc, one_mul, + MonoidAlgebra.of_apply, MonoidAlgebra.smul_single, smul_eq_mul, mul_one] + rw [Finset.sum_map_toList] + simpa only [Finsupp.sum] using (MonoidAlgebra.sum_coeff_single p) + +def encodedField {ι : Type uι} [DecidableEq ι] + (h : ι → TraceCocycle.CF (FreeGroup ι)) (ib : ι × Bool) : Expr (ι × Bool) := + encode (TraceCocycle.algebraDerivative h (MonoidAlgebra.of ℂ (FreeGroup ι) (signed ib))) + +theorem algebraDerivative_one {ι : Type uι} (h : ι → TraceCocycle.CF (FreeGroup ι)) : + TraceCocycle.algebraDerivative h 1 = 0 := by + have he := TraceCocycle.algebraDerivative_mul h 1 1 + simp only [one_mul, mul_one] at he + exact (add_eq_left.mp he.symm) + +theorem eval_delta_encoded {ι : Type uι} [DecidableEq ι] + (h : ι → TraceCocycle.CF (FreeGroup ι)) (p : Expr (ι × Bool)) : + eval (fun ib => MonoidAlgebra.of ℂ (FreeGroup ι) (signed ib)) + (delta (encodedField h) p) = + TraceCocycle.algebraDerivative h + (eval (fun ib => MonoidAlgebra.of ℂ (FreeGroup ι) (signed ib)) p) := by + induction p with + | scalar c => + simp only [delta, eval, Algebra.algebraMap_eq_smul_one, map_smul, + algebraDerivative_one, smul_zero, zero_smul] + | gen ib => exact eval_encode _ + | add p q hp hq => simp only [delta, eval, hp, hq, map_add] + | mul p q hp hq => simp only [delta, eval, hp, hq, TraceCocycle.algebraDerivative_mul] + +theorem map_eval {ι : Type uι} {A : Type uA} {B : Type uB} [Semiring A] [Semiring B] + [Algebra ℂ A] [Algebra ℂ B] (φ : A →ₐ[ℂ] B) (X : ι → A) (p : Expr ι) : + φ (eval X p) = eval (fun i => φ (X i)) p := by + induction p with + | scalar c => exact φ.commutes c + | gen i => rfl + | add p q hp hq => simp only [eval, map_add, hp, hq] + | mul p q hp hq => simp only [eval, map_mul, hp, hq] + +theorem encoded_initial_trace {ι : Type uι} [DecidableEq ι] + (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) (p : Expr ((Option ι) × Bool)) : + (eval (fun ib => MonoidAlgebra.of ℂ (FreeGroup (Option ι)) (signed ib)) + (delta (encodedField (TraceCocycle.fieldCoefficients h l)) p)).coeff 1 = 0 := by + rw [eval_delta_encoded] + exact TraceCocycle.sourceLaurentTraceIdentity h l _ 0 + +end AlgebraPolynomial +end FreeGroupFactorMain + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeGroupFactor/UnitaryEvaluation.lean b/lean/OAI/Analysis/FreeGroupFactor/UnitaryEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9ab799da0d582c3717bde813541c648c951b4f4 --- /dev/null +++ b/lean/OAI/Analysis/FreeGroupFactor/UnitaryEvaluation.lean @@ -0,0 +1,248 @@ +import OAI.Analysis.FreeGroupFactor.TraceCocycle + +namespace OAI + +noncomputable section + +universe uA uG uι + +open Set Metric +open scoped NNReal Topology BigOperators ContDiff + +namespace FreeGroupFactorMain +namespace UnitaryEvaluation +variable {A : Type uA} [CStarAlgebra A] +variable {ι : Type uι} + +def wordHom (U : ι → unitary A) : FreeGroup ι →* A := + (unitary A).subtype.comp (FreeGroup.lift U) + +@[simp] theorem wordHom_of (U : ι → unitary A) (i : ι) : + wordHom U (FreeGroup.of i) = (U i : A) := by + simp [wordHom] + +@[simp] theorem wordHom_inv (U : ι → unitary A) (g : FreeGroup ι) : + wordHom U g⁻¹ = star (wordHom U g) := by + change ((FreeGroup.lift U g⁻¹ : unitary A) : A) = _ + rw [map_inv] + rfl + +theorem wordHom_word [DecidableEq ι] + (U : ι → unitary A) (g : FreeGroup ι) : + wordHom U g = PolynomialFlow.word g (fun i => (U i : A)) := by + conv_lhs => rw [← FreeGroup.mk_toWord (x := g)] + change ((FreeGroup.lift U (FreeGroup.mk g.toWord) : unitary A) : A) = _ + rw [FreeGroup.lift_mk] + rw [Submonoid.coe_list_prod] + simp only [List.map_map, Function.comp_def] + unfold PolynomialFlow.word PolynomialFlow.wordList + apply congrArg List.prod + apply List.map_congr_left + intro ib _ + rcases ib with ⟨i, b⟩ + cases b <;> rfl + +def algebraHom (U : ι → unitary A) : MonoidAlgebra ℂ (FreeGroup ι) →ₐ[ℂ] A := + MonoidAlgebra.lift ℂ A (FreeGroup ι) (wordHom U) + +@[simp] theorem algebraHom_of (U : ι → unitary A) (g : FreeGroup ι) : + algebraHom U (MonoidAlgebra.of ℂ (FreeGroup ι) g) = wordHom U g := by + simp [algebraHom] + +@[simp] theorem eval_encode [DecidableEq ι] + (U : ι → unitary A) (p : MonoidAlgebra ℂ (FreeGroup ι)) : + NCPolynomial.eval (fun ib => wordHom U (AlgebraPolynomial.signed ib)) + (AlgebraPolynomial.encode p) = algebraHom U p := by + calc + _ = algebraHom U (NCPolynomial.eval + (fun ib => MonoidAlgebra.of ℂ (FreeGroup ι) (AlgebraPolynomial.signed ib)) + (AlgebraPolynomial.encode p)) := by + rw [AlgebraPolynomial.map_eval] + congr 1 + funext ib + exact (algebraHom_of U _).symm + _ = algebraHom U p := by rw [AlgebraPolynomial.eval_encode] + +def coefficientHom {G : Type uG} (ρ : G → A) : (G →₀ ℂ) →ₗ[ℂ] A := + Finsupp.linearCombination ℂ ρ + +@[simp] theorem coefficientHom_single {G : Type uG} (ρ : G → A) (g : G) (c : ℂ) : + coefficientHom ρ (Finsupp.single g c) = c • ρ g := by + exact Finsupp.linearCombination_single _ _ _ + +theorem algebraHom_ofCoeff (U : ι → unitary A) (p : FreeGroup ι →₀ ℂ) : + algebraHom U (MonoidAlgebra.ofCoeff p) = coefficientHom (wordHom U) p := by + simp [algebraHom, MonoidAlgebra.lift_apply, coefficientHom, Finsupp.linearCombination_apply] + +theorem coefficientHom_shift {G : Type uG} [Group G] (ρ : G →* A) + (g : G) (p : G →₀ ℂ) : + coefficientHom ρ (TraceCocycle.shift g p) = + ρ g * coefficientHom ρ p * ρ g⁻¹ := by + induction p using Finsupp.induction_linear with + | zero => simp + | add p q hp hq => simp [map_add, hp, hq, mul_add, add_mul] + | single b c => + have hs : TraceCocycle.shift g (Finsupp.single b c) = + Finsupp.single (g * b * g⁻¹) c := by + simp only [TraceCocycle.shift, Finsupp.domCongr_apply, + Finsupp.equivMapDomain_eq_mapDomain, Finsupp.mapDomain_single] + rfl + rw [hs, coefficientHom_single, coefficientHom_single] + simp only [map_mul, smul_mul_assoc, mul_smul_comm] + +theorem derivative_of (h : ι → TraceCocycle.CF (FreeGroup ι)) (g : FreeGroup ι) : + TraceCocycle.algebraDerivative h (MonoidAlgebra.of ℂ (FreeGroup ι) g) = + MonoidAlgebra.ofCoeff (TraceCocycle.cocycle h g) * + MonoidAlgebra.of ℂ (FreeGroup ι) g := by + ext b + simp [MonoidAlgebra.of_apply] + +theorem eval_derivative_of (U : ι → unitary A) + (h : ι → TraceCocycle.CF (FreeGroup ι)) (g : FreeGroup ι) : + algebraHom U (TraceCocycle.algebraDerivative h (MonoidAlgebra.of ℂ (FreeGroup ι) g)) = + coefficientHom (wordHom U) (TraceCocycle.cocycle h g) * wordHom U g := by + rw [derivative_of, map_mul, algebraHom_ofCoeff, algebraHom_of] + +theorem eval_encodedField_pos [DecidableEq ι] (U : ι → unitary A) + (h : ι → TraceCocycle.CF (FreeGroup ι)) (i : ι) : + NCPolynomial.eval (fun ib => wordHom U (AlgebraPolynomial.signed ib)) + (AlgebraPolynomial.encodedField h (i, true)) = + coefficientHom (wordHom U) (h i) * (U i : A) := by + rw [AlgebraPolynomial.encodedField, eval_encode, eval_derivative_of] + simp only [AlgebraPolynomial.signed, ↓reduceIte, TraceCocycle.cocycle_of, wordHom_of] + +theorem eval_encodedField_neg [DecidableEq ι] (U : ι → unitary A) + (h : ι → TraceCocycle.CF (FreeGroup ι)) (i : ι) : + NCPolynomial.eval (fun ib => wordHom U (AlgebraPolynomial.signed ib)) + (AlgebraPolynomial.encodedField h (i, false)) = + -(star (U i : A) * coefficientHom (wordHom U) (h i)) := by + rw [AlgebraPolynomial.encodedField, eval_encode, eval_derivative_of] + simp only [AlgebraPolynomial.signed, Bool.false_eq_true, ↓reduceIte, + TraceCocycle.cocycle_inv, TraceCocycle.cocycle_of, map_neg, coefficientHom_shift, + wordHom_inv, inv_inv, wordHom_of, neg_mul] + rw [mul_assoc, mul_assoc, (U i).property.2, mul_one] + +end UnitaryEvaluation +end FreeGroupFactorMain + +namespace FreeGroupFactorMain.UnitaryEvaluation +variable {A : Type uA} [CStarAlgebra A] {ι : Type uι} + +def extendUnitary (U : ι → unitary A) (C : unitary A) : Option ι → unitary A := + fun o => o.elim C U + +def laurentValue (C : unitary A) (l : ℤ →₀ ℂ) : A := + coefficientHom (fun k : ℤ => ((C ^ k : unitary A) : A)) l + +@[simp] theorem wordHom_extend (U : ι → unitary A) (C : unitary A) (g : FreeGroup ι) : + wordHom (extendUnitary U C) (FreeGroup.map Option.some g) = wordHom U g := by + have he : (wordHom (extendUnitary U C)).comp (FreeGroup.map Option.some) = wordHom U := by + apply FreeGroup.ext_hom + intro i + simp [extendUnitary] + exact DFunLike.congr_fun he g + +@[simp] theorem coefficientHom_laurent (U : ι → unitary A) (C : unitary A) (l : ℤ →₀ ℂ) : + coefficientHom (wordHom (extendUnitary U C)) + (TraceCocycle.laurent (FreeGroup.of none) l) = laurentValue C l := by + induction l using Finsupp.induction_linear with + | zero => simp [TraceCocycle.laurent, laurentValue] + | add p q hp hq => simpa [TraceCocycle.laurent, laurentValue, map_add] using congrArg₂ (· + ·) hp hq + | single k c => + simp only [TraceCocycle.laurent, Finsupp.linearCombination_single, map_smul, + coefficientHom_single, one_smul, laurentValue] + congr 1 + change ((FreeGroup.lift (extendUnitary U C) (FreeGroup.of none ^ k) : unitary A) : A) = _ + rw [map_zpow, FreeGroup.lift_apply_of] + rfl + + theorem coefficientHom_fieldCoefficients [DecidableEq ι] + (U : ι → unitary A) (C : unitary A) (h : ι → FreeGroup ι →₀ ℝ) + (l : ℤ →₀ ℂ) (i : ι) : + coefficientHom (wordHom (extendUnitary U C)) (TraceCocycle.fieldCoefficients h l (some i)) = + Complex.I • PolynomialFlow.hamiltonian (laurentValue C l) (h i) (fun j => (U j : A)) := by + classical + simp only [TraceCocycle.fieldCoefficients, PolynomialFlow.hamiltonian, Finsupp.sum, + map_sum, map_smul, coefficientHom_shift, coefficientHom_laurent, + wordHom_inv, wordHom_extend, Finset.smul_sum] + simp only [wordHom_word] + apply Finset.sum_congr rfl + intro g hg + rw [smul_smul, mul_comm] + +def signedTrajectory (X : ℝ → ι → A) (hU : ∀ t j, X t j ∈ unitary A) + (C : unitary A) (t : ℝ) (ib : Option ι × Bool) : A := + wordHom (extendUnitary (fun j => ⟨X t j, hU t j⟩) C) (AlgebraPolynomial.signed ib) + + theorem signedTrajectory_some_pos (X : ℝ → ι → A) (hU : ∀ t j, X t j ∈ unitary A) + (C : unitary A) (t : ℝ) (i : ι) : + signedTrajectory X hU C t (some i, true) = X t i := by + simp [signedTrajectory, AlgebraPolynomial.signed, extendUnitary] + + theorem signedTrajectory_some_neg (X : ℝ → ι → A) (hU : ∀ t j, X t j ∈ unitary A) + (C : unitary A) (t : ℝ) (i : ι) : + signedTrajectory X hU C t (some i, false) = star (X t i) := by + simp [signedTrajectory, AlgebraPolynomial.signed, extendUnitary] + + theorem signedTrajectory_none_pos (X : ℝ → ι → A) (hU : ∀ t j, X t j ∈ unitary A) + (C : unitary A) (t : ℝ) : + signedTrajectory X hU C t (none, true) = C := by + simp [signedTrajectory, AlgebraPolynomial.signed, extendUnitary] + + theorem signedTrajectory_none_neg (X : ℝ → ι → A) (hU : ∀ t j, X t j ∈ unitary A) + (C : unitary A) (t : ℝ) : + signedTrajectory X hU C t (none, false) = star (C : A) := by + simp [signedTrajectory, AlgebraPolynomial.signed, extendUnitary] + + theorem signedTrajectory_ode [Fintype ι] [DecidableEq ι] + (C : unitary A) (h : ι → FreeGroup ι →₀ ℝ) (l : ℤ →₀ ℂ) + (hS : IsSelfAdjoint (laurentValue C l)) + (X : ℝ → ι → A) (hU : ∀ t j, X t j ∈ unitary A) + (hX : ∀ t, HasDerivAt X (PolynomialFlow.field (laurentValue C l) h (X t)) t) + (t : ℝ) (ib : Option ι × Bool) : + HasDerivAt (fun s => signedTrajectory X hU C s ib) + (NCPolynomial.eval (signedTrajectory X hU C t) + (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) ib)) t := by + have hpos (j : Option ι) : NCPolynomial.eval (signedTrajectory X hU C t) + (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) (j,true)) = + coefficientHom (wordHom (extendUnitary (fun j => ⟨X t j, hU t j⟩) C)) + (TraceCocycle.fieldCoefficients h l j) * + (extendUnitary (fun j => ⟨X t j,hU t j⟩) C j : A) := + eval_encodedField_pos _ _ _ + have hneg (j : Option ι) : NCPolynomial.eval (signedTrajectory X hU C t) + (AlgebraPolynomial.encodedField (TraceCocycle.fieldCoefficients h l) (j,false)) = + -(star (extendUnitary (fun j => ⟨X t j,hU t j⟩) C j : A) * + coefficientHom (wordHom (extendUnitary (fun j => ⟨X t j, hU t j⟩) C)) + (TraceCocycle.fieldCoefficients h l j)) := + eval_encodedField_neg _ _ _ + rcases ib with ⟨i,b⟩ + cases i with + | none => + cases b + · rw [hneg] + simp only [TraceCocycle.fieldCoefficients, map_zero, mul_zero, neg_zero] + simpa only [signedTrajectory_none_neg] using hasDerivAt_const t (star (C : A)) + · rw [hpos] + simp only [TraceCocycle.fieldCoefficients, map_zero, zero_mul] + simpa only [signedTrajectory_none_pos] using hasDerivAt_const t (C : A) + | some i => + have hi := hasDerivAt_pi.mp (hX t) i + cases b + · rw [hneg, coefficientHom_fieldCoefficients] + have hs := hi.star + have he : star (PolynomialFlow.field (laurentValue C l) h (X t) i) = + -(star (X t i) * (Complex.I • PolynomialFlow.hamiltonian (laurentValue C l) (h i) (X t))) := by + simp only [PolynomialFlow.field, star_smul, star_mul, Complex.star_def, + Complex.conj_I, (PolynomialFlow.selfAdjoint_hamiltonian _ hS _ _).star_eq, + neg_smul, mul_smul_comm] + rw [he] at hs + simpa only [signedTrajectory_some_neg, extendUnitary, Option.elim_some] using hs + · rw [hpos, coefficientHom_fieldCoefficients] + simpa only [signedTrajectory_some_pos, extendUnitary, Option.elim_some, + PolynomialFlow.field, smul_mul_assoc] using hi + +end FreeGroupFactorMain.UnitaryEvaluation + +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/AmplifiedBlockBounds.lean b/lean/OAI/Analysis/FreeWords/AmplifiedBlockBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b97e890aa0414d9f470fbd43ba28e6d37e246ee --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/AmplifiedBlockBounds.lean @@ -0,0 +1,77 @@ +import Mathlib +import OAI.Analysis.FreeWords.AmplifiedBlockBoundsDefinitions +import OAI.Analysis.FreeWords.MatrixUnitaryBounds + +namespace OAI + +noncomputable section + +namespace KKMatrixBounds + +noncomputable section + +open KKHaarEndpoints KKMatrixExpectation Filter + +open scoped Matrix.Norms.Operator Topology + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +omit [PartialOrder A] [StarOrderedRing A] in +theorem wordBound_nonneg (n:ℕ) (w:List (ℤ×Matrix (Fin n) (Fin n) A)) : + 0≤wordBound n w := by + induction w with + | nil => simp [wordBound] + | cons z w ih => + change 0≤((n:ℝ)*‖z.2‖)*wordBound n w + exact mul_nonneg (mul_nonneg (Nat.cast_nonneg _) (norm_nonneg _)) ih + +theorem powerWord_norm_le (n:ℕ) (U:unitary (Matrix (Fin n) (Fin n) A)) + (w:List (ℤ×Matrix (Fin n) (Fin n) A)) : + ‖powerWord U w‖≤wordBound n w := by + induction w with + | nil => + change ‖(1:Matrix (Fin n) (Fin n) A)‖≤1 + have h1 : ‖(1:A)‖≤1 := by + have hh := CStarRing.norm_star_mul_self (x := (1:A)) + simp only [star_one,mul_one] at hh + nlinarith [norm_nonneg (1:A)] + rw [Matrix.linfty_opNorm_def] + change ((Finset.univ.sup fun i:Fin n => ∑j:Fin n,‖(1:Matrix (Fin n) (Fin n) A) i j‖₊:NNReal):ℝ)≤((1:NNReal):ℝ) + apply NNReal.coe_le_coe.mpr + apply Finset.sup_le + intro i hi + have h1' : ‖(1:A)‖₊≤1 := h1 + simpa [Matrix.one_apply,apply_ite,eq_comm] using h1' + | cons z w ih => + change ‖(U^z.1).val*z.2*powerWord U w‖≤((n:ℝ)*‖z.2‖)*wordBound n w + calc + _ ≤ ‖(U^z.1).val*z.2‖*‖powerWord U w‖ := norm_mul_le _ _ + _ ≤ ((n:ℝ)*‖z.2‖)*wordBound n w := by + apply mul_le_mul + · exact (norm_mul_le _ _).trans (mul_le_mul_of_nonneg_right + (unitary_rowSum_norm_le (U^z.1)) (norm_nonneg _)) + · exact ih + · exact norm_nonneg _ + · positivity + +omit [PartialOrder A] [StarOrderedRing A] in +theorem expectation_tendsto_zero (ι:Type) (L:Filter ι) (τ:A →ₗ[ℂ] ℂ) (n:ℕ) + (X:ι → Matrix (Fin n) (Fin n) A) + (h:∀a b,Tendsto (fun j => τ (X j a b)) L (𝓝 0)) : + Tendsto (fun j => matrixExpectation τ n (X j)) L (𝓝 0) := by + apply tendsto_pi_nhds.mpr + intro a + apply tendsto_pi_nhds.mpr + intro b + simpa only [matrixExpectation_apply,Pi.zero_apply,Matrix.zero_apply,map_zero,Function.comp_def] using + ((continuous_algebraMap ℂ A).tendsto 0).comp (h a b) + +theorem amplified_block_bounds : AmplifiedBlockBounds (A := A) := + ⟨powerWord_norm_le,expectation_tendsto_zero⟩ + +end + +end KKMatrixBounds +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/AmplifiedBlockBoundsDefinitions.lean b/lean/OAI/Analysis/FreeWords/AmplifiedBlockBoundsDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc13ce86fcb024d528459a94615277d8c1f18704 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/AmplifiedBlockBoundsDefinitions.lean @@ -0,0 +1,35 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarEndpointsDefinitions +import OAI.Analysis.FreeWords.MatrixConditionalExpectation + +namespace OAI + +noncomputable section + +namespace KKMatrixBounds + +noncomputable section + +open KKHaarEndpoints KKMatrixExpectation Filter + +open scoped Matrix.Norms.Operator Topology + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +def wordBound (n:ℕ) (w:List (ℤ×Matrix (Fin n) (Fin n) A)) : ℝ := + (w.map fun z => (n:ℝ)*‖z.2‖).prod + +def AmplifiedBlockBounds : Prop := + (∀n:ℕ,∀U:unitary (Matrix (Fin n) (Fin n) A),∀w:List (ℤ×Matrix (Fin n) (Fin n) A), + ‖powerWord U w‖≤wordBound n w) ∧ + (∀(ι:Type) (L:Filter ι) (τ:A →ₗ[ℂ] ℂ) (n:ℕ) + (X:ι → Matrix (Fin n) (Fin n) A), + (∀a b,Tendsto (fun j => τ (X j a b)) L (𝓝 0)) → + Tendsto (fun j => matrixExpectation τ n (X j)) L (𝓝 0)) + +end + +end KKMatrixBounds +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/AmplifiedBlockModel.lean b/lean/OAI/Analysis/FreeWords/AmplifiedBlockModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..8443805a58a86b04bdcd59eeabfda2f656b856f2 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/AmplifiedBlockModel.lean @@ -0,0 +1,60 @@ +import Mathlib +import OAI.Analysis.FreeWords.AmplifiedBlockModelDefinitions +import OAI.Analysis.FreeWords.AmplifiedCyclicApprox +import OAI.Analysis.FreeWords.CyclicApproxNet +import OAI.Analysis.FreeWords.MatrixPowerBlockLimits + +namespace OAI + +noncomputable section + +namespace KKFreeLiftFrontier + +open KKTraceTransfer KKMatrixExpectation KKHaarEndpoints Filter + +open scoped Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem finite_amplified_block_model : FiniteAmplifiedBlockModel (H := H) := by + classical + intro M τ hfac hdiff n hn K F E hF hE ε hε + let τn := matrixTraceMap τ.map n + let B := (numericalHom (A := ConcreteAlgebra M) n).range.toSubalgebra + obtain ⟨u,hgood,hH,hC⟩ := cyclic_approx_net τn B (FullMatrixUnitary n) + (finite_amplified_cyclic_approx M τ hfac hdiff hn) + have hblocks := matrix_power_block_limits (A := ConcreteAlgebra M) + (CyclicIndex τn B) atTop τ.map τ.normalized τ.tracial n hn u hH hC + have hKsmall : ∀ᶠj in atTop,∀k∈K,k≠0 → ‖τn (u j^k).val‖<ε := by + apply (Filter.eventually_all_finset K).2 + intro k hk + by_cases hk0 : k=0 + · exact Eventually.of_forall (fun _ h => (h hk0).elim) + · have hh := Metric.tendsto_nhds.mp (hH k hk0) ε hε + simpa only [dist_zero_right] using hh.mono (fun j hj _ => hj) + have hFsmall : ∀ᶠj in atTop,∀w∈F,‖τn (powerWord (u j) w)‖<ε := by + apply (Filter.eventually_all_finset F).2 + intro w hw + simpa only [dist_zero_right] using Metric.tendsto_nhds.mp (hC w (hF w hw).1 (hF w hw).2) ε hε + have hEsmall : ∀ᶠj in atTop,∀z∈E,∀a b, + ‖τ.map ((powerWord (u j) z.1*(u j^z.2).val) a b)‖<ε := by + apply (Filter.eventually_all_finset E).2 + intro z hz + apply Filter.eventually_all.2 + intro a + apply Filter.eventually_all.2 + intro b + simpa only [dist_zero_right] using Metric.tendsto_nhds.mp + (hblocks z.1 (hE z hz).1 z.2 (hE z hz).2 a b) ε hε + obtain ⟨j,hjK,hjF,hjE⟩ := (hKsmall.and (hFsmall.and hEsmall)).exists + obtain ⟨d,hd,ρ,hρ,hU⟩ := hgood j + exact ⟨d,hd,ρ,hρ,u j,hU,hjK,hjF,hjE⟩ + +end + +end KKFreeLiftFrontier +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/AmplifiedBlockModelDefinitions.lean b/lean/OAI/Analysis/FreeWords/AmplifiedBlockModelDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..db925a187d2e566347ea38f3ce0b7a024cf69f09 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/AmplifiedBlockModelDefinitions.lean @@ -0,0 +1,36 @@ +import Mathlib +import OAI.Analysis.FreeWords.AmplifiedModelDefinitions +import OAI.Analysis.FreeWords.HaarEndpointsDefinitions + +namespace OAI + +noncomputable section + +namespace KKFreeLiftFrontier + +open KKTraceTransfer KKMatrixExpectation KKHaarEndpoints + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def FiniteAmplifiedBlockModel : Prop := + ∀(M:VonNeumannAlgebra H) (τ:FaithfulNormalTrace M),IsFactor M → IsDiffuse M → + ∀n:ℕ,0 (z.1,liftB z.2)) + let F₀ := F.image liftW + have hnonempty : ∀w∈F₀,w≠[] := by + intro w hw + obtain ⟨v,hv,rfl⟩ := Finset.mem_image.mp hw + simpa [liftW] using (hF v hv).1 + have hcentered : ∀w∈F₀,∀z∈w,z.1≠0 ∧ Matrix.trace z.2=0 := by + intro w hw z hz + obtain ⟨v,hv,rfl⟩ := Finset.mem_image.mp hw + obtain ⟨t,ht,rfl⟩ := List.mem_map.mp hz + have hc := (hF v hv).2 t ht + refine ⟨hc.1,?_⟩ + have hh := hc.2.2 + rw [← hlift t.2 hc.2.1,matrixTraceMap_numerical τ.map τ.normalized n] at hh + have hn0 : (n:ℂ)≠0 := Nat.cast_ne_zero.mpr hn.ne' + exact (mul_eq_zero.mp hh).resolve_left (inv_ne_zero hn0) + obtain ⟨d,hd,ρ,hρ,U,hU,hK,hF₀⟩ := finite_amplified_numerical_model M τ hfac hdiff n hn K F₀ + hnonempty hcentered ε hε + refine ⟨U,⟨d,hd,ρ,hρ,hU⟩,hK,?_⟩ + intro w hw + have hh := hF₀ (liftW w) (Finset.mem_image.mpr ⟨w,hw,rfl⟩) + have he : ((liftW w).map (fun z => (U^z.1).val*ιB z.2)).prod=powerWord U w := by + dsimp [powerWord,liftW] + rw [List.map_map] + congr 1 + apply List.map_congr_left + intro z hz + rw [Function.comp_apply,hlift z.2 ((hF w hw).2 z hz).2.1] + change ‖matrixTrace τ n (((liftW w).map (fun z => (U^z.1).val*ιB z.2)).prod)‖<ε at hh + rw [he] at hh + exact hh + +end + +end KKFreeLiftFrontier +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/AmplifiedModel.lean b/lean/OAI/Analysis/FreeWords/AmplifiedModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee515fa2bbe54c4d264b89af2f0e42898cce1ea9 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/AmplifiedModel.lean @@ -0,0 +1,59 @@ +import Mathlib +import OAI.Analysis.FreeWords.AmplifiedModelDefinitions +import OAI.Analysis.FreeWords.BlockMatrixEmbedding +import OAI.Analysis.FreeWords.NumericalModel + +namespace OAI + +noncomputable section + +namespace KKFreeLiftFrontier + +open KKTraceTransfer KKVariableUltra KKMatrixExpectation KKBlockMatrix KKFactorSupport KKProjectionSupport + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance amplifiedModelOrder (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance amplifiedModelPreorder (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance amplifiedModelLE (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance amplifiedModelSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem finite_amplified_numerical_model : FiniteAmplifiedNumericalModel (H := H) := by + classical + intro M τ hF hD n hn K F hne hc ε hε + obtain ⟨d,hd,V,hVK,hVF⟩ := finite_numerical_model M τ hF hD n hn K F hne hc ε hε + have : NeZero d := ⟨hd.ne'⟩ + obtain ⟨ρ,hρ,hτρ⟩ := exists_matrix_subfactor M τ hF hD d hd + let φ := blockHom (ι := Fin n) ρ + let U : unitary (MatrixAlgebra n M) := ⟨φ V.val,Unitary.map_mem φ V.property⟩ + have hp (k : ℤ) : φ (V^k).val=(U^k).val := unitary_preimage_zpow φ V U rfl k + have hτ (X) : matrixTrace τ n (φ X)=((n*d:ℕ):ℂ)⁻¹*Matrix.trace X := + blockHom_trace ρ τ.map τ.normalized τ.tracial X + refine ⟨d,hd,ρ,hρ,U,?_,?_,?_⟩ + · intro i j + exact blockHom_entry_mem ρ V.val i j + · intro k hk hk0 + rw [← hp k,hτ] + exact hVK k hk hk0 + · intro w hw + have he : φ ((w.map (fun z => (V^z.1).val*Matrix.kronecker z.2 1)).prod)= + ((w.map (fun z => (U^z.1).val*numericalHom (A := ConcreteAlgebra M) n z.2)).prod) := by + rw [map_list_prod,List.map_map] + apply congrArg List.prod + apply List.map_congr_left + intro z hz + exact (map_mul φ _ _).trans (congrArg₂ (·*·) (hp z.1) (blockHom_kronecker ρ z.2)) + rw [← he,hτ] + exact hVF w hw + +end + +end KKFreeLiftFrontier +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/AmplifiedModelDefinitions.lean b/lean/OAI/Analysis/FreeWords/AmplifiedModelDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..42c03433f6aafd28034015e6d3533251df8c1108 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/AmplifiedModelDefinitions.lean @@ -0,0 +1,40 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixConditionalExpectation +import OAI.Analysis.FreeWords.ProjectionSmall + +namespace OAI + +noncomputable section + +namespace KKFreeLiftFrontier + +open KKTraceTransfer KKMatrixExpectation + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +abbrev MatrixAlgebra (n : ℕ) (M : VonNeumannAlgebra H) := + Matrix (Fin n) (Fin n) (ConcreteAlgebra M) + +def matrixTrace {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) (n : ℕ) + (x : MatrixAlgebra n M) : ℂ := (n : ℂ)⁻¹ * ∑ i, τ.map (x i i) + +def FiniteAmplifiedNumericalModel : Prop := + ∀ (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M), IsFactor M → IsDiffuse M → + ∀ n : ℕ, 0 (U^z.1).val*numericalHom (A := ConcreteAlgebra M) n z.2)).prod)‖<ε) + +end + +end KKFreeLiftFrontier +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/AsymptoticBlockTransport.lean b/lean/OAI/Analysis/FreeWords/AsymptoticBlockTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3ec2ebbd4d2f65ce5cafd846e7d694330c3d4ad --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/AsymptoticBlockTransport.lean @@ -0,0 +1,120 @@ +import Mathlib +import OAI.Analysis.FreeWords.AsymptoticProduct + +namespace OAI + +noncomputable section + +namespace KKAsymptoticTransport + +noncomputable section + +open Filter + +open scoped Topology + +variable {I A:Type*} [NormedRing A] [NormedAlgebra ℂ A] + +omit [NormedAlgebra ℂ A] in +@[simp] theorem netPair_nil (j:I) : netPair ([]:List ((I → A)×A)) j=1 := rfl + +omit [NormedAlgebra ℂ A] in +@[simp] theorem netPair_cons (z:(I → A)×A) (w:List ((I → A)×A)) (j:I) : + netPair (z::w) j=z.1 j*z.2*netPair w j := rfl + +omit [NormedAlgebra ℂ A] in +@[simp] theorem netPair_append (w v:List ((I → A)×A)) (j:I) : + netPair (w++v) j=netPair w j*netPair v j := by + simp [netPair,List.map_append,List.prod_append] + +theorem raw_relative_limits (L:Filter I) (E:A →L[ℂ] A) (S:Set (I → A)) + (hbound:∀c∈S,NetBound c) + (hzero:∀c∈S,Tendsto (fun j => E (c j)) L (𝓝 0)) + (hrel:RelativeBlockLimits L E S) + (w:List ((I → A)×A)) (hw:∀z∈w,z.1∈S ∧ E z.2=0) : + (w≠[] → Tendsto (fun j => E (netPair w j)) L (𝓝 0)) ∧ + (∀c∈S,Tendsto (fun j => E (netPair w j*c j)) L (𝓝 0)) := by + have hb := fun z hz => hbound z.1 (hw z hz).1 + have hz := fun z hz => hzero z.1 (hw z hz).1 + have hd := pair_center_difference E w hb hz + have hr := hrel w hw + refine ⟨fun hn => tendsto_E_of_difference E hd (hr.1 hn),?_⟩ + intro c hc + have hbc : NetBound (netPair (centeredWord E w)) := by + apply NetBound.netPair + intro z hz + obtain ⟨a,ha,rfl⟩ := List.mem_map.mp hz + exact (hb a ha).center E + exact tendsto_E_of_difference E + (asymp_mul hd (asymp_center E (hzero c hc)) hbc (hbound c hc)) (hr.2 c hc) + +theorem asymptotic_block_transport : AsymptoticBlockTransport (I := I) (A := A) := by + intro L E S T hid hright hbound hzero hjoin hrelative + have hrelative' := raw_relative_limits L E S hbound hzero hrelative + have hxzero (x:A) : E (x-E x)=0 := by rw [map_sub,hid,sub_self] + have haux : ∀w:List ((I → A)×A), + (∀z∈w,z.1∈S ∧ z.2∈T) → + ∀p:List ((I → A)×A), + (∀z∈p,z.1∈S ∧ E z.2=0) → + ∀c∈S,∀x∈T, + Tendsto (fun j => E (netPair p j*c j*x*netPair w j)) L (𝓝 0) := by + intro w + induction w with + | nil => + intro _ p hp c hc x hx + have hp' : ∀z∈p++[(c,x-E x)],z.1∈S ∧ E z.2=0 := by + intro z hz + rcases List.mem_append.mp hz with hz | hz + · exact hp z hz + · have he := List.mem_singleton.mp hz + subst z + exact ⟨hc,hxzero x⟩ + have h₀ := (hrelative' (p++[(c,x-E x)]) hp').1 (by simp) + have hB := null_mul ((hrelative' p hp).2 c hc) (NetBound.const (E x)) + have hsum := h₀.add hB + have he (j:I) : E (netPair p j*c j*x*netPair [] j)= + E (netPair (p++[(c,x-E x)]) j)+E (netPair p j*c j)*E x := by + rw [← hright] + rw [← map_add] + congr 1 + simp only [netPair_nil,netPair_append,netPair_cons,mul_one] + noncomm_ring + simpa only [← he,add_zero] using hsum + | cons z w ih => + intro hw p hp c hc x hx + have hz := hw z List.mem_cons_self + have hw' := fun a ha => hw a (List.mem_cons_of_mem _ ha) + have hp' : ∀a∈p++[(c,x-E x)],a.1∈S ∧ E a.2=0 := by + intro a ha + rcases List.mem_append.mp ha with ha | ha + · exact hp a ha + · have he := List.mem_singleton.mp ha + subst a + exact ⟨hc,hxzero x⟩ + have hnew : (fun j => c j*E x*z.1 j)∈S := hjoin c hc z.1 hz.1 x hx + have h₀ := ih hw' (p++[(c,x-E x)]) hp' z.1 hz.1 z.2 hz.2 + have hB := ih hw' p hp (fun j => c j*E x*z.1 j) hnew z.2 hz.2 + have hsum := h₀.add hB + have he (j:I) : E (netPair p j*c j*x*netPair (z::w) j)= + E (netPair (p++[(c,x-E x)]) j*z.1 j*z.2*netPair w j)+ + E (netPair p j*(c j*E x*z.1 j)*z.2*netPair w j) := by + rw [← map_add] + congr 1 + simp only [netPair_append,netPair_cons,netPair_nil,mul_one] + noncomm_ring + simpa only [← he,add_zero] using hsum + intro w hne hw + cases w with + | nil => exact (hne rfl).elim + | cons z w => + have hz := hw z List.mem_cons_self + have hh := haux w (fun a ha => hw a (List.mem_cons_of_mem _ ha)) [] (by simp) + z.1 hz.1 z.2 hz.2 + simpa only [netPair_nil,one_mul,netPair_cons] using hh + +end + +end KKAsymptoticTransport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/AsymptoticBlockTransportDefinitions.lean b/lean/OAI/Analysis/FreeWords/AsymptoticBlockTransportDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ba062c8b61271d2fb0633af700e16f4b3d291b9 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/AsymptoticBlockTransportDefinitions.lean @@ -0,0 +1,48 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKAsymptoticTransport + +noncomputable section + +open Filter + +open scoped Topology + +variable {I A:Type*} [NormedRing A] [NormedAlgebra ℂ A] + +def NetBound (f:I → A) : Prop := ∃C:ℝ,0≤C ∧ ∀j,‖f j‖≤C + +def netPair (w:List ((I → A)×A)) (j:I) : A := + (w.map fun z => z.1 j*z.2).prod + +def centerNet (E:A →L[ℂ] A) (f:I → A) (j:I) : A := f j-E (f j) + +def centeredWord (E:A →L[ℂ] A) (w:List ((I → A)×A)) := + w.map fun z => (centerNet E z.1,z.2) + +def RelativeBlockLimits (L:Filter I) (E:A →L[ℂ] A) (S:Set (I → A)) : Prop := + ∀w:List ((I → A)×A),(∀z∈w,z.1∈S ∧ E z.2=0) → + (w≠[] → Tendsto (fun j => E (netPair (centeredWord E w) j)) L (𝓝 0)) ∧ + (∀c∈S,Tendsto (fun j => E (netPair (centeredWord E w) j*centerNet E c j)) L (𝓝 0)) + +def AsymptoticBlockTransport : Prop := + ∀(L:Filter I) (E:A →L[ℂ] A) (S:Set (I → A)) (T:Set A), + (∀a,E (E a)=E a) → + (∀a b,E (a*E b)=E a*E b) → + (∀c∈S,NetBound c) → + (∀c∈S,Tendsto (fun j => E (c j)) L (𝓝 0)) → + (∀c∈S,∀d∈S,∀x∈T,(fun j => c j*E x*d j)∈S) → + RelativeBlockLimits L E S → + ∀w:List ((I → A)×A),w≠[] → (∀z∈w,z.1∈S ∧ z.2∈T) → + Tendsto (fun j => E (netPair w j)) L (𝓝 0) + +end + +end KKAsymptoticTransport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/AsymptoticProduct.lean b/lean/OAI/Analysis/FreeWords/AsymptoticProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..43dc3ca459353d1cdd5e5cad39f7506c559dcdd9 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/AsymptoticProduct.lean @@ -0,0 +1,114 @@ +import Mathlib +import OAI.Analysis.FreeWords.AsymptoticBlockTransportDefinitions + +namespace OAI + +noncomputable section + +namespace KKAsymptoticTransport + +noncomputable section + +open Filter + +open scoped Topology + +variable {I A:Type*} [NormedRing A] [NormedAlgebra ℂ A] + +omit [NormedAlgebra ℂ A] in +theorem NetBound.const (a:A) : NetBound (fun _:I => a) := ⟨‖a‖,norm_nonneg _,fun _ => le_rfl⟩ + +omit [NormedAlgebra ℂ A] in +theorem NetBound.mul {f g:I → A} (hf:NetBound f) (hg:NetBound g) : + NetBound (fun j => f j*g j) := by + obtain ⟨C,hC,hf⟩ := hf + obtain ⟨D,hD,hg⟩ := hg + exact ⟨C*D,mul_nonneg hC hD,fun j => (norm_mul_le _ _).trans + (mul_le_mul (hf j) (hg j) (norm_nonneg _) hC)⟩ + +omit [NormedAlgebra ℂ A] in +theorem NetBound.sub {f g:I → A} (hf:NetBound f) (hg:NetBound g) : + NetBound (fun j => f j-g j) := by + obtain ⟨C,hC,hf⟩ := hf + obtain ⟨D,hD,hg⟩ := hg + exact ⟨C+D,add_nonneg hC hD,fun j => (norm_sub_le _ _).trans (add_le_add (hf j) (hg j))⟩ + +theorem NetBound.map (E:A →L[ℂ] A) {f:I → A} (hf:NetBound f) : + NetBound (fun j => E (f j)) := by + obtain ⟨C,hC,hf⟩ := hf + exact ⟨‖E‖*C,mul_nonneg (norm_nonneg _) hC,fun j => (E.le_opNorm _).trans + (mul_le_mul_of_nonneg_left (hf j) (norm_nonneg _))⟩ + +theorem NetBound.center (E:A →L[ℂ] A) {f:I → A} (hf:NetBound f) : + NetBound (centerNet E f) := hf.sub (hf.map E) + +omit [NormedAlgebra ℂ A] in +theorem NetBound.isBoundedUnder {L:Filter I} {f:I → A} (hf:NetBound f) : + IsBoundedUnder (·≤·) L (norm ∘ f) := by + obtain ⟨C,_,hf⟩ := hf + exact isBoundedUnder_of ⟨C,hf⟩ + +omit [NormedAlgebra ℂ A] in +theorem NetBound.netPair (w:List ((I → A)×A)) + (h:∀z∈w,NetBound z.1) : NetBound (netPair w) := by + induction w with + | nil => exact NetBound.const 1 + | cons z w ih => + exact ((h z List.mem_cons_self).mul (NetBound.const z.2)).mul + (ih (fun a ha => h a (List.mem_cons_of_mem _ ha))) + +omit [NormedAlgebra ℂ A] in +theorem null_mul {L:Filter I} {f g:I → A} + (hf:Tendsto f L (𝓝 0)) (hg:NetBound g) : + Tendsto (fun j => f j*g j) L (𝓝 0) := hf.zero_mul_isBoundedUnder_le hg.isBoundedUnder + +omit [NormedAlgebra ℂ A] in +theorem mul_null {L:Filter I} {f g:I → A} + (hf:NetBound f) (hg:Tendsto g L (𝓝 0)) : + Tendsto (fun j => f j*g j) L (𝓝 0) := isBoundedUnder_le_mul_tendsto_zero hf.isBoundedUnder hg + +omit [NormedAlgebra ℂ A] in +theorem asymp_mul {L:Filter I} {f f' g g':I → A} + (hf:Tendsto (fun j => f j-f' j) L (𝓝 0)) + (hg:Tendsto (fun j => g j-g' j) L (𝓝 0)) + (hf':NetBound f') (hgb:NetBound g) : + Tendsto (fun j => f j*g j-f' j*g' j) L (𝓝 0) := by + have hh := (null_mul hf hgb).add (mul_null hf' hg) + simpa only [sub_mul,mul_sub,sub_add_sub_cancel,add_zero] using hh + +theorem asymp_center {L:Filter I} (E:A →L[ℂ] A) {c:I → A} + (hc:Tendsto (fun j => E (c j)) L (𝓝 0)) : + Tendsto (fun j => c j-centerNet E c j) L (𝓝 0) := by + simpa only [centerNet,sub_sub_cancel] using hc + +theorem pair_center_difference {L:Filter I} (E:A →L[ℂ] A) + (w:List ((I → A)×A)) + (hb:∀z∈w,NetBound z.1) + (hz:∀z∈w,Tendsto (fun j => E (z.1 j)) L (𝓝 0)) : + Tendsto (fun j => netPair w j-netPair (centeredWord E w) j) L (𝓝 0) := by + induction w with + | nil => simpa [netPair,centeredWord] using (tendsto_const_nhds : Tendsto (fun _:I => (0:A)) L (𝓝 0)) + | cons z w ih => + have hd := null_mul (asymp_center E (hz z List.mem_cons_self)) (NetBound.const z.2) + have hd' : Tendsto (fun j => z.1 j*z.2-centerNet E z.1 j*z.2) L (𝓝 0) := by + simpa only [sub_mul] using hd + exact asymp_mul hd' + (ih (fun a ha => hb a (List.mem_cons_of_mem _ ha)) + (fun a ha => hz a (List.mem_cons_of_mem _ ha))) + (((hb z List.mem_cons_self).center E).mul (NetBound.const z.2)) + (NetBound.netPair w (fun a ha => hb a (List.mem_cons_of_mem _ ha))) + +theorem tendsto_E_of_difference {L:Filter I} (E:A →L[ℂ] A) {f g:I → A} + (hd:Tendsto (fun j => f j-g j) L (𝓝 0)) + (hg:Tendsto (fun j => E (g j)) L (𝓝 0)) : + Tendsto (fun j => E (f j)) L (𝓝 0) := by + have hd' := E.continuous.tendsto 0 |>.comp hd + have hh := hd'.add hg + simpa only [Function.comp_def,map_sub,map_zero,sub_add_cancel,add_zero] using hh + +end + +end KKAsymptoticTransport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/Bicommutant.lean b/lean/OAI/Analysis/FreeWords/Bicommutant.lean new file mode 100644 index 0000000000000000000000000000000000000000..b56a5b29f12ff5f68cd2358a0dc652206ac0f073 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/Bicommutant.lean @@ -0,0 +1,192 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace UniversalStrongKK + +open scoped BigOperators InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + [CompleteSpace H] + +variable {ι : Type*} [Fintype ι] + +abbrev DirectSum (ι H : Type*) [Fintype ι] [NormedAddCommGroup H] := + PiLp 2 (fun _ : ι => H) + +def diagonalOp (T : H →L[ℂ] H) : DirectSum ι H →L[ℂ] DirectSum ι H := + (PiLp.continuousLinearEquiv 2 ℂ (fun _ : ι => H)).symm.toContinuousLinearMap.comp + (ContinuousLinearMap.pi (fun i => T.comp (PiLp.proj 2 (fun _ : ι => H) i))) + +omit [CompleteSpace H] in +@[simp] theorem diagonalOp_apply (T : H →L[ℂ] H) (ξ : DirectSum ι H) (i : ι) : + (diagonalOp T ξ).ofLp i = T (ξ.ofLp i) := by simp [diagonalOp] + +theorem diagonalOp_star (T : H →L[ℂ] H) : + diagonalOp (star T) = star (diagonalOp (ι := ι) T) := by + apply ContinuousLinearMap.ext + intro x + apply ext_inner_left ℂ + intro y + simp only [ContinuousLinearMap.star_eq_adjoint] + rw [ContinuousLinearMap.adjoint_inner_right] + simp only [PiLp.inner_apply, diagonalOp_apply, + ContinuousLinearMap.adjoint_inner_right] + +def coordinateOp [DecidableEq ι] (T : DirectSum ι H →L[ℂ] DirectSum ι H) (i j : ι) : H →L[ℂ] H := + (PiLp.proj 2 (fun _ : ι => H) i).comp + (T.comp ((PiLp.continuousLinearEquiv 2 ℂ (fun _ : ι => H)).symm.toContinuousLinearMap.comp + (ContinuousLinearMap.single ℂ (fun _ : ι => H) j))) + +omit [CompleteSpace H] in +@[simp] theorem coordinateOp_apply [DecidableEq ι] + (T : DirectSum ι H →L[ℂ] DirectSum ι H) (i j : ι) (x : H) : + coordinateOp T i j x = (T (PiLp.single 2 j x)).ofLp i := by + rfl + +omit [CompleteSpace H] in +@[simp] theorem diagonalOp_single [DecidableEq ι] (T : H →L[ℂ] H) (j : ι) (x : H) : + diagonalOp (ι := ι) T (PiLp.single 2 j x) = PiLp.single 2 j (T x) := by + ext i + by_cases h : i=j + · subst i; simp + · simp [h] + +omit [CompleteSpace H] in +theorem coordinate_commute_of_diagonal [DecidableEq ι] + (T : H →L[ℂ] H) (S : DirectSum ι H →L[ℂ] DirectSum ι H) + (h : diagonalOp T * S = S * diagonalOp T) (i j : ι) : + T * coordinateOp S i j = coordinateOp S i j * T := by + ext x + have hh := congrArg (fun Q : DirectSum ι H →L[ℂ] DirectSum ι H => + (Q (PiLp.single 2 j x)).ofLp i) h + simpa only [mul_apply_eq_comp, diagonalOp_apply, diagonalOp_single, + coordinateOp_apply] using hh + +omit [InnerProductSpace ℂ H] [CompleteSpace H] in +theorem sum_single_direct [DecidableEq ι] (x : DirectSum ι H) : + ∑ j, PiLp.single 2 j (x.ofLp j) = x := by + ext i + simp [Pi.single_apply] + +omit [CompleteSpace H] in +theorem diagonal_commute_of_coordinates [DecidableEq ι] + (T : H →L[ℂ] H) (S : DirectSum ι H →L[ℂ] DirectSum ι H) + (h : ∀ i j, T * coordinateOp S i j = coordinateOp S i j * T) : + diagonalOp T * S = S * diagonalOp T := by + ext x i + have hs (x : DirectSum ι H) : + (S x).ofLp i = ∑ j, coordinateOp S i j (x.ofLp j) := by + conv_lhs => rw [← sum_single_direct x] + simp + simp only [mul_apply_eq_comp, diagonalOp_apply, hs, map_sum] + apply Finset.sum_congr rfl + intro j hj + exact congrArg (fun Q : H →L[ℂ] H => Q (x.ofLp j)) (h i j) + +theorem commute_projection_of_invariant {E : Type*} [NormedAddCommGroup E] + [InnerProductSpace ℂ E] [CompleteSpace E] (V : Submodule ℂ E) [V.HasOrthogonalProjection] + (L : E →L[ℂ] E) + (hL : ∀ x ∈ V, L x ∈ V) (hLs : ∀ x ∈ V, star L x ∈ V) : + Commute L V.starProjection := by + apply ContinuousLinearMap.ext + intro x + change L (V.starProjection x) = V.starProjection (L x) + symm + apply Submodule.eq_starProjection_of_mem_of_inner_eq_zero + (hL _ (Submodule.starProjection_apply_mem _ _)) + intro y hy + rw [← map_sub, ← ContinuousLinearMap.adjoint_inner_right] + exact Submodule.inner_left_of_mem_orthogonal (hLs y hy) + (Submodule.sub_starProjection_mem_orthogonal x) + +def orbitCore (A : StarSubalgebra ℂ (H →L[ℂ] H)) (ξ : DirectSum ι H) : + Submodule ℂ (DirectSum ι H) where + carrier := {y | ∃ a ∈ A, diagonalOp a ξ = y} + zero_mem' := by + refine ⟨0, zero_mem A, ?_⟩ + ext i; simp + add_mem' := by + rintro x y ⟨a, ha, rfl⟩ ⟨b, hb, rfl⟩ + refine ⟨a+b, add_mem ha hb, ?_⟩ + ext i; simp + smul_mem' := by + rintro c x ⟨a, ha, rfl⟩ + refine ⟨c • a, A.smul_mem ha c, ?_⟩ + ext i; simp + +def closedOrbit (A : StarSubalgebra ℂ (H →L[ℂ] H)) (ξ : DirectSum ι H) : + Submodule ℂ (DirectSum ι H) := (orbitCore A ξ).topologicalClosure + +instance closedOrbit_complete (A : StarSubalgebra ℂ (H →L[ℂ] H)) (ξ : DirectSum ι H) : + CompleteSpace (closedOrbit A ξ) := + (Submodule.isClosed_topologicalClosure _).completeSpace_coe + +theorem diagonal_closedOrbit_mem (A : StarSubalgebra ℂ (H →L[ℂ] H)) + (ξ : DirectSum ι H) {a : H →L[ℂ] H} (ha : a ∈ A) + {y : DirectSum ι H} (hy : y ∈ closedOrbit A ξ) : + diagonalOp a y ∈ closedOrbit A ξ := by + change diagonalOp a y ∈ closure (orbitCore A ξ : Set (DirectSum ι H)) + apply map_mem_closure (diagonalOp a).continuous hy + rintro z ⟨b, hb, rfl⟩ + refine ⟨a*b, mul_mem ha hb, ?_⟩ + ext i; simp [mul_apply_eq_comp] + +theorem identityVector_mem_closedOrbit (A : StarSubalgebra ℂ (H →L[ℂ] H)) + (ξ : DirectSum ι H) : ξ ∈ closedOrbit A ξ := by + apply subset_closure + refine ⟨1, one_mem A, ?_⟩ + ext i; simp + +theorem bicommutant_diagonal_mem_closedOrbit + (A : StarSubalgebra ℂ (H →L[ℂ] H)) (T : H →L[ℂ] H) + (hT : T ∈ Set.centralizer (Set.centralizer (A : Set (H →L[ℂ] H)))) + (ξ : DirectSum ι H) : diagonalOp T ξ ∈ closedOrbit A ξ := by + classical + let V := closedOrbit A ξ + have hc (a : H →L[ℂ] H) (ha : a ∈ A) : + diagonalOp a * V.starProjection = V.starProjection * diagonalOp a := by + apply (commute_projection_of_invariant V (diagonalOp a) ?_ ?_).eq + · exact fun x hx => diagonal_closedOrbit_mem A ξ ha hx + · rw [← diagonalOp_star] + exact fun x hx => diagonal_closedOrbit_mem A ξ (star_mem ha) hx + have hentry (i j : ι) : coordinateOp V.starProjection i j ∈ + Set.centralizer (A : Set (H →L[ℂ] H)) := by + intro a ha + exact coordinate_commute_of_diagonal a V.starProjection (hc a ha) i j + have hdiag : diagonalOp T * V.starProjection = V.starProjection * diagonalOp T := + diagonal_commute_of_coordinates T V.starProjection (fun i j => (hT _ (hentry i j)).symm) + have he : V.starProjection ξ = ξ := + Submodule.starProjection_eq_self_iff.mpr (identityVector_mem_closedOrbit A ξ) + have h := congrArg (fun Q : DirectSum ι H →L[ℂ] DirectSum ι H => Q ξ) hdiag + simp only [mul_apply_eq_comp, he] at h + rw [h] + exact Submodule.starProjection_apply_mem _ _ + +theorem bicommutant_strong_approximation + (A : StarSubalgebra ℂ (H →L[ℂ] H)) (T : H →L[ℂ] H) + (hT : T ∈ Set.centralizer (Set.centralizer (A : Set (H →L[ℂ] H)))) + (n : ℕ) (ξ : Fin n → H) (ε : ℝ) (hε : 0 < ε) : + ∃ a ∈ A, ∀ i, ‖(a-T) (ξ i)‖ < ε := by + let η : DirectSum (Fin n) H := WithLp.toLp 2 ξ + have hm := bicommutant_diagonal_mem_closedOrbit A T hT η + change diagonalOp T η ∈ closure (orbitCore A η : Set _) at hm + obtain ⟨y, ⟨a, ha, hay⟩, hyd⟩ := Metric.mem_closure_iff.mp hm ε hε + refine ⟨a, ha, fun i => ?_⟩ + subst y + have hh := PiLp.norm_apply_le (diagonalOp a η - diagonalOp T η) i + have hd : ‖diagonalOp a η - diagonalOp T η‖ < ε := by + simpa only [dist_eq_norm, norm_sub_rev] using hyd + simpa only [PiLp.sub_apply, diagonalOp_apply, sub_apply] + using hh.trans_lt hd + +end + +end UniversalStrongKK +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/BicommutantTrace.lean b/lean/OAI/Analysis/FreeWords/BicommutantTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..934fb3d313cc95fbe4558bddc08c591e9c4608d6 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/BicommutantTrace.lean @@ -0,0 +1,115 @@ +import Mathlib +import OAI.Analysis.FreeWords.Bicommutant + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open scoped InnerProductSpace ComplexOrder Pointwise + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def bicommutantAlg (S : StarSubalgebra ℂ (H →L[ℂ] H)) : StarSubalgebra ℂ (H →L[ℂ] H) := + StarSubalgebra.centralizer ℂ (StarSubalgebra.centralizer ℂ (S : Set (H →L[ℂ] H))) + +@[simp] theorem coe_bicommutantAlg (S : StarSubalgebra ℂ (H →L[ℂ] H)) : + (bicommutantAlg S : Set (H →L[ℂ] H)) = Set.centralizer (Set.centralizer (S : Set _)) := by + simp only [bicommutantAlg, StarSubalgebra.coe_centralizer_centralizer, + StarMemClass.star_coe_eq, Set.union_self] + +instance bicommutantAlg_closed (S : StarSubalgebra ℂ (H →L[ℂ] H)) : + IsClosed (bicommutantAlg S : Set (H →L[ℂ] H)) := by + rw [coe_bicommutantAlg] + exact Set.isClosed_centralizer _ + +@[instance_reducible] def biOrder (S : StarSubalgebra ℂ (H →L[ℂ] H)) : PartialOrder (bicommutantAlg S) := + CStarAlgebra.spectralOrder _ + +attribute [local instance] KKUltraTrace.biOrder + +@[instance_reducible] def biLE (S : StarSubalgebra ℂ (H →L[ℂ] H)) : LE (bicommutantAlg S) := + (biOrder S).toLE + +attribute [local instance] KKUltraTrace.biLE + +@[instance_reducible] def biPreorder (S : StarSubalgebra ℂ (H →L[ℂ] H)) : Preorder (bicommutantAlg S) := + (biOrder S).toPreorder + +attribute [local instance] KKUltraTrace.biPreorder + +theorem biSOR (S : StarSubalgebra ℂ (H →L[ℂ] H)) : StarOrderedRing (bicommutantAlg S) := + CStarAlgebra.spectralOrderedRing _ + +attribute [local instance] KKUltraTrace.biSOR + +theorem subset_bicommutantAlg (S : StarSubalgebra ℂ (H →L[ℂ] H)) : S ≤ bicommutantAlg S := by + intro a ha + change a ∈ (bicommutantAlg S : Set _) + rw [coe_bicommutantAlg] + exact Set.subset_centralizer_centralizer ha + +theorem bicommutant_eval_closed (S : StarSubalgebra ℂ (H →L[ℂ] H)) + (T : bicommutantAlg S) (n : ℕ) (ξ : Fin n → H) (Z : Set (Fin n → H)) + (hZ : IsClosed Z) (h : ∀ a ∈ S, (fun i => a (ξ i)) ∈ Z) : + (fun i => T.1 (ξ i)) ∈ Z := by + apply hZ.closure_subset + apply Metric.mem_closure_iff.mpr + intro ε hε + have hT : T.1 ∈ Set.centralizer (Set.centralizer (S : Set (H →L[ℂ] H))) := by + have ht : T.1 ∈ (bicommutantAlg S : Set _) := T.2 + rwa [coe_bicommutantAlg] at ht + obtain ⟨a, ha, hclose⟩ := UniversalStrongKK.bicommutant_strong_approximation S T.1 hT n ξ ε hε + refine ⟨fun i => a (ξ i), h a ha, ?_⟩ + rw [dist_eq_norm] + apply (pi_norm_lt_iff hε).mpr + intro i + simpa only [Pi.sub_apply, norm_sub_rev, sub_apply] using hclose i + +def bicommutantState (S : StarSubalgebra ℂ (H →L[ℂ] H)) (Ω : H) : + bicommutantAlg S →ₚ[ℂ] ℂ where + toFun x := ⟪Ω, x.1 Ω⟫_ℂ + map_add' x y := by + change ⟪Ω, x.1 Ω + y.1 Ω⟫_ℂ = _ + exact inner_add_right _ _ _ + map_smul' c x := by simp + monotone' x y hxy := by + obtain ⟨v, hv⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp (sub_nonneg.mpr hxy) + apply sub_nonneg.mp + change 0 ≤ ⟪Ω, y.1 Ω⟫_ℂ - ⟪Ω, x.1 Ω⟫_ℂ + rw [← inner_sub_right] + have he : y.1 Ω - x.1 Ω = v.1.adjoint (v.1 Ω) := + congrArg (fun z : bicommutantAlg S => z.1 Ω) hv + rw [he, ContinuousLinearMap.adjoint_inner_right, ← inner_self_ofReal_re] + exact Complex.zero_le_real.mpr (inner_self_nonneg (𝕜 := ℂ) (x := v.1 Ω)) + +@[simp] theorem bicommutantState_apply (S : StarSubalgebra ℂ (H →L[ℂ] H)) (Ω : H) + (x : bicommutantAlg S) : bicommutantState S Ω x = ⟪Ω, x.1 Ω⟫_ℂ := rfl + +theorem trace_relation_extend (S : StarSubalgebra ℂ (H →L[ℂ] H)) (Ω : H) + (B : H →L[ℂ] H) (h : ∀ a ∈ S, ⟪Ω, (a*B) Ω⟫_ℂ = ⟪Ω, (B*a) Ω⟫_ℂ) + (T : bicommutantAlg S) : ⟪Ω, (T.1*B) Ω⟫_ℂ = ⟪Ω, (B*T.1) Ω⟫_ℂ := by + have hz := bicommutant_eval_closed S T 2 ![B Ω, Ω] + {z | ⟪Ω, z 0⟫_ℂ = ⟪Ω, B (z 1)⟫_ℂ} + (isClosed_eq (by fun_prop) (by fun_prop)) + (fun a ha => by simpa using h a ha) + simpa using hz + +theorem bicommutantState_tracial (S : StarSubalgebra ℂ (H →L[ℂ] H)) (Ω : H) + (htr : ∀ a ∈ S, ∀ b ∈ S, ⟪Ω, (a*b) Ω⟫_ℂ = ⟪Ω, (b*a) Ω⟫_ℂ) + (x y : bicommutantAlg S) : + bicommutantState S Ω (x*y) = bicommutantState S Ω (y*x) := by + have ha (a : H →L[ℂ] H) (ha : a ∈ S) (T : bicommutantAlg S) : + ⟪Ω, (T.1*a) Ω⟫_ℂ = ⟪Ω, (a*T.1) Ω⟫_ℂ := + trace_relation_extend S Ω a (fun b hb => htr b hb a ha) T + exact (trace_relation_extend S Ω x.1 (fun a ha' => (ha a ha' x).symm) y).symm + +end + +end KKUltraTrace +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/BlockMatrixEmbedding.lean b/lean/OAI/Analysis/FreeWords/BlockMatrixEmbedding.lean new file mode 100644 index 0000000000000000000000000000000000000000..10cfef99832ea236ed9a3e1f340b03bf18204478 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/BlockMatrixEmbedding.lean @@ -0,0 +1,75 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixConditionalExpectation +import OAI.Analysis.FreeWords.MatrixTraceUnique + +namespace OAI + +noncomputable section + +namespace KKBlockMatrix + +open KKMatrixExpectation + +noncomputable section + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] [StarModule ℂ A] + +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def blockHom (ρ : Matrix κ κ ℂ →⋆ₐ[ℂ] A) : + Matrix (ι×κ) (ι×κ) ℂ →⋆ₐ[ℂ] Matrix ι ι A := + { (ρ.toAlgHom.mapMatrix).comp (Matrix.compAlgEquiv ι κ ℂ ℂ).symm.toAlgHom with + map_star' := by + intro X + ext i j + exact map_star ρ (fun a b => X (j,a) (i,b)) } + +omit [StarModule ℂ A] in +@[simp] theorem blockHom_apply (ρ : Matrix κ κ ℂ →⋆ₐ[ℂ] A) + (X : Matrix (ι×κ) (ι×κ) ℂ) (i j : ι) : + blockHom ρ X i j=ρ (fun a b => X (i,a) (j,b)) := rfl + +omit [StarModule ℂ A] in +theorem blockHom_injective (ρ : Matrix κ κ ℂ →⋆ₐ[ℂ] A) (hρ : Function.Injective ρ) : + Function.Injective (blockHom (ι := ι) ρ) := by + intro X Y he + ext ⟨i,a⟩ ⟨j,b⟩ + exact congrFun (congrFun (hρ (congrFun (congrFun he i) j)) a) b + +theorem blockHom_entry_mem (ρ : Matrix κ κ ℂ →⋆ₐ[ℂ] A) + (X : Matrix (ι×κ) (ι×κ) ℂ) (i j : ι) : blockHom ρ X i j∈ρ.range := + ⟨fun a b => X (i,a) (j,b),rfl⟩ + +theorem blockHom_kronecker {n d : ℕ} (ρ : Matrix (Fin d) (Fin d) ℂ →⋆ₐ[ℂ] A) + (b : Matrix (Fin n) (Fin n) ℂ) : + blockHom ρ (Matrix.kronecker b 1)=numericalHom (A := A) n b := by + ext i j + change ρ (fun a c => b i j*(1 : Matrix (Fin d) (Fin d) ℂ) a c)=algebraMap ℂ A (b i j) + have he : (fun a c => b i j*(1 : Matrix (Fin d) (Fin d) ℂ) a c)= + algebraMap ℂ (Matrix (Fin d) (Fin d) ℂ) (b i j) := by + ext a c + simp [Matrix.algebraMap_eq_diagonal,Matrix.diagonal_apply,Matrix.one_apply] + rw [he] + exact ρ.commutes (b i j) + +omit [StarModule ℂ A] in +theorem blockHom_trace {n d : ℕ} (ρ : Matrix (Fin d) (Fin d) ℂ →⋆ₐ[ℂ] A) + [NeZero d] (τ : A →ₗ[ℂ] ℂ) (hτ1 : τ 1=1) (htr : ∀x y,τ (x*y)=τ (y*x)) + (X : Matrix (Fin n×Fin d) (Fin n×Fin d) ℂ) : + matrixTraceMap τ n (blockHom ρ X)=((n*d:ℕ):ℂ)⁻¹*Matrix.trace X := by + change (n:ℂ)⁻¹*(∑i:Fin n,τ (ρ (fun a b => X (i,a) (i,b))))=_ + have he : (∑i:Fin n,τ (ρ (fun a b => X (i,a) (i,b))))= + ∑i:Fin n,(d:ℂ)⁻¹*(∑a:Fin d,X (i,a) (i,a)) := by + apply Finset.sum_congr rfl + intro i hi + simpa only [Fintype.card_fin,Matrix.trace,Matrix.diag] using KKVariableUltra.matrixHom_trace ρ τ hτ1 htr (fun a b => X (i,a) (i,b)) + rw [he,← Finset.mul_sum] + simp only [Matrix.trace,Matrix.diag,Fintype.sum_prod_type,Nat.cast_mul,mul_inv_rev] + ring + +end + +end KKBlockMatrix +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/BoundedStrongContinuity.lean b/lean/OAI/Analysis/FreeWords/BoundedStrongContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..c95175cd4ceed31658ce48b924a9b7ff37a76189 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/BoundedStrongContinuity.lean @@ -0,0 +1,43 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKTraceTransfer + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +theorem bounded_evals_continuous {X : Type*} [TopologicalSpace X] + (F : X → (H →L[ℂ] H)) (hF : ∀ a, ‖F a‖ ≤ 1) + (D : ℕ → H) (hD : DenseRange D) (hc : ∀ j, Continuous (fun a => F a (D j))) + (ξ : H) : Continuous (fun a => F a ξ) := by + have hLip (a : X) (x y : H) : dist (F a x) (F a y) ≤ dist x y := by + rw [dist_eq_norm,dist_eq_norm,←map_sub] + exact ((F a).le_opNorm _).trans (by simpa using mul_le_mul_of_nonneg_right (hF a) (norm_nonneg (x-y))) + apply continuous_iff_continuousAt.mpr + intro a + apply Metric.tendsto_nhds.mpr + intro ε hε + obtain ⟨j, hj⟩ := hD.exists_dist_lt ξ (show 0 < ε/4 by positivity) + have hjc := Metric.tendsto_nhds.mp ( (hc j).continuousAt (x := a)) (ε/2) (show 0 < ε/2 by positivity) + filter_upwards [hjc] with b hb + calc + dist (F b ξ) (F a ξ) ≤ dist (F b ξ) (F b (D j)) + + (dist (F b (D j)) (F a (D j)) + dist (F a (D j)) (F a ξ)) := + (dist_triangle (F b ξ) (F b (D j)) (F a ξ)).trans + (add_le_add (le_refl _) (dist_triangle (F b (D j)) (F a (D j)) (F a ξ))) + _ ≤ dist ξ (D j) + (dist (F b (D j)) (F a (D j)) + dist (D j) ξ) := + add_le_add (hLip b _ _) (add_le_add (le_refl _) (hLip a _ _)) + _ < ε := by rw [dist_comm (D j) ξ]; linarith + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CanonicalMatrixExtension.lean b/lean/OAI/Analysis/FreeWords/CanonicalMatrixExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d5c5f30383f91860fa466338faa0fa3ee1be0b0 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CanonicalMatrixExtension.lean @@ -0,0 +1,76 @@ +import Mathlib +import OAI.Analysis.FreeWords.KronExpansion +import OAI.Analysis.FreeWords.MatrixCommutantTrace +import OAI.Analysis.FreeWords.MatrixProduct +import OAI.Analysis.FreeWords.MatrixReindex +import OAI.Analysis.FreeWords.MatrixSubfactor +import OAI.Analysis.FreeWords.MatrixTraceUnique + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKFreeLiftFrontier KKProjectionSupport KKMatrixQuantization + +noncomputable section + +variable {ι κ A : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + [Ring A] [Algebra ℂ A] [StarRing A] [StarModule ℂ A] + +theorem matrixProduct_kronecker_one + (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) (σ : Matrix κ κ ℂ →⋆ₐ[ℂ] A) + (hc : ∀ i j k l, Commute (matrixUnit ρ i j) (matrixUnit σ k l)) (a : Matrix ι ι ℂ) : + matrixProduct ρ σ hc (Matrix.kronecker a 1)=ρ a := by + rw [kronecker_one_expansion] + simp only [map_sum,map_smul] + change (∑ i,∑ j,∑ k, a i j • matrixUnit (matrixProduct ρ σ hc) (i,k) (j,k))=ρ a + simp only [matrixProduct_unit,productUnits,← Finset.smul_sum,← Finset.mul_sum, + matrixUnit_sum_diag,mul_one] + exact (matrix_representation ρ a).symm + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem matrix_extension_canonical (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) (n k : ℕ) (hn : 0 by + have ht := congrArg τ.map h + rw [map_zero,τ.normalized] at ht + exact zero_ne_one ht⟩⟩ + have : NeZero (n*k) := ⟨Nat.ne_of_gt (Nat.mul_pos hn hk)⟩ + refine ⟨Q,Q.toAlgHom.toRingHom.injective,?_,?_⟩ + · intro a + change P (matrixReindex e.symm (matrixReindex e (Matrix.kronecker a 1)))=β a + have he (b : Matrix (Fin n × Fin k) (Fin n × Fin k) ℂ) : + matrixReindex e.symm (matrixReindex e b)=b := by + ext i j + change b (e.symm (e i)) (e.symm (e j))=b i j + simp only [Equiv.symm_apply_apply] + rw [he] + exact matrixProduct_kronecker_one β σ' hc a + · intro x + simpa only [Fintype.card_fin] using matrixHom_trace Q τ.map τ.normalized τ.tracial x + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CenteredCornerCompression.lean b/lean/OAI/Analysis/FreeWords/CenteredCornerCompression.lean new file mode 100644 index 0000000000000000000000000000000000000000..a700e69f953e37fa1bd2413ba3de16d92450ac33 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CenteredCornerCompression.lean @@ -0,0 +1,48 @@ +import Mathlib +import OAI.Analysis.FreeWords.CornerCompression + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +open KKTraceTransfer KKFreeLiftFrontier KKProjectionSupport + +noncomputable section + +theorem corner_centered_compression + {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {ι : Type*} [Fintype ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) + (p : ConcreteAlgebra M) (hp : IsStarProjection p) (hp0 : p≠0) + (x : ι → ConcreteAlgebra M) (hs : ∀ i, p*x i*p=x i) + (ε : ℝ) (hε : 0<ε) : + ∃ q : ConcreteAlgebra M, IsStarProjection q ∧ q≠0 ∧ q*p=q ∧ (τ.map q).re<ε ∧ + ∑ i, (traceNorm τ (q*x i*q-((τ.map p)⁻¹*τ.map (x i)) • q))^2 < ε*(τ.map q).re := by + let c (i:ι) : ℂ := (τ.map p)⁻¹*τ.map (x i) + let y (i:ι) : ConcreteAlgebra M := x i-c i • p + have hy (i:ι) : p*y i*p=y i := by + dsimp only [y] + rw [mul_sub,sub_mul,mul_smul_comm,smul_mul_assoc,hp.isIdempotentElem.eq, + hp.isIdempotentElem.eq,hs] + have hτp : τ.map p ≠ 0 := trace_projection_ne_zero τ hp hp0 + have hyτ (i:ι) : τ.map (y i)=0 := by + change τ.map (x i-c i • p)=0 + rw [map_sub,map_smul,smul_eq_mul,sub_eq_zero] + dsimp only [c] + field_simp + obtain ⟨q,hq,hq0,hqp,hqt,hqs⟩ := corner_small_compression M τ hF hD p hp hp0 y hy hyτ ε hε + refine ⟨q,hq,hq0,hqp,hqt,?_⟩ + have he (i:ι) : q*y i*q=q*x i*q-((τ.map p)⁻¹*τ.map (x i)) • q := by + dsimp only [y,c] + rw [mul_sub,sub_mul,mul_smul_comm,smul_mul_assoc,hqp,hq.isIdempotentElem.eq] + simpa only [he] using hqs + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CenteredMatrixDensity.lean b/lean/OAI/Analysis/FreeWords/CenteredMatrixDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..7db795e3f1db386e5cc97b3605701752dc89d289 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CenteredMatrixDensity.lean @@ -0,0 +1,75 @@ +import Mathlib +import OAI.Analysis.FreeWords.BoundedStrongContinuity +import OAI.Analysis.FreeWords.CenteredMatrixDensityDefinitions +import OAI.Analysis.FreeWords.TraceStrongContinuity + +namespace OAI + +noncomputable section + +namespace KKTraceTransfer + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem centered_matrix_countable_dense [TopologicalSpace.SeparableSpace H] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (n : ℕ) : + ∃ a : ℕ → Matrix (Fin n) (Fin n) (ConcreteAlgebra M), + (∀ j, amplifiedTrace M τ n (a j) = 0) ∧ + (∀ j i k, ‖a j i k‖ ≤ 1) ∧ + ∀ x : Matrix (Fin n) (Fin n) (ConcreteAlgebra M), + amplifiedTrace M τ n x = 0 → (∀ i k, ‖x i k‖ ≤ 1) → + ∀ ε : ℝ, 0 < ε → ∃ j, ∀ i k, traceNorm τ (a j i k - x i k) < ε := by + classical + obtain ⟨D,hD⟩ := TopologicalSpace.exists_dense_seq H + let B := {x : Matrix (Fin n) (Fin n) (ConcreteAlgebra M) // + amplifiedTrace M τ n x = 0 ∧ ∀ i k, ‖x i k‖ ≤ 1} + let : Inhabited B := ⟨⟨0,by simp [amplifiedTrace]⟩⟩ + let E : B → ((Fin n × Fin n) × ℕ → H) := + fun a p => (a.val p.1.1 p.1.2 : H →L[ℂ] H) (D p.2) + let : TopologicalSpace B := TopologicalSpace.induced E inferInstance + have hE : Topology.IsInducing E := ⟨rfl⟩ + let : SecondCountableTopology B := hE.secondCountableTopology + have hec : Continuous E := continuous_induced_dom + have hc (i k : Fin n) (ξ : H) : + Continuous (fun a : B => (a.val i k : H →L[ℂ] H) ξ) := by + apply bounded_evals_continuous (fun a : B => (a.val i k : H →L[ℂ] H)) + (fun a => a.property.2 i k) D hD + intro j + exact (continuous_apply ((i,k),j)).comp hec + obtain ⟨a,ha⟩ := TopologicalSpace.exists_dense_seq B + refine ⟨fun j => (a j).val,fun j => (a j).property.1,fun j => (a j).property.2,?_⟩ + intro x hx hb ε hε + have ht (i k : Fin n) : + Continuous (fun b : B => traceNorm τ (b.val i k - x i k)) := + traceNorm_strong_continuous M τ (fun b : B => b.val i k) + (fun b => b.property.2 i k) (hc i k) (x i k) (hb i k) + let O := {b : B | ∀ i k, traceNorm τ (b.val i k - x i k) < ε} + have ho : IsOpen O := by + dsimp only [O] + simp only [Set.ofPred_forall] + apply isOpen_iInter_of_finite + intro i + apply isOpen_iInter_of_finite + intro k + exact isOpen_Iio.preimage (ht i k) + have hn : O.Nonempty := by + refine ⟨⟨x,hx,hb⟩,?_⟩ + intro i k + change traceNorm τ (x i k-x i k) < ε + simpa [traceNorm] using hε + obtain ⟨b,hb',j,hj⟩ := ha.inter_open_nonempty O ho hn + refine ⟨j,?_⟩ + change (a j) ∈ O + rw [hj] + exact hb' + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CenteredMatrixDensityDefinitions.lean b/lean/OAI/Analysis/FreeWords/CenteredMatrixDensityDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..87a32ff6d89399885acf4f0276d2fb43ae8d38f7 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CenteredMatrixDensityDefinitions.lean @@ -0,0 +1,23 @@ +import Mathlib +import OAI.Analysis.FreeWords.TraceTransferDefinitions + +namespace OAI + +noncomputable section + +namespace KKTraceTransfer + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def amplifiedTrace (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (n : ℕ) + (x : Matrix (Fin n) (Fin n) (ConcreteAlgebra M)) : ℂ := + (n : ℂ)⁻¹ * ∑ i, τ.map (x i i) + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ChosenUnitaryMatrix.lean b/lean/OAI/Analysis/FreeWords/ChosenUnitaryMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf12e4155787d153a57a835e5e2101fcc690873e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ChosenUnitaryMatrix.lean @@ -0,0 +1,58 @@ +import Mathlib +import OAI.Analysis.FreeWords.RoundingMatrixUnitary + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFreeLiftFrontier KKSpectralSupport + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKFreeLiftFrontier KKSpectralSupport + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem chosen_unitary_matrix_approximation (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M) (hF : IsFactor M) (hD : IsDiffuse M) + (u : unitary (ConcreteAlgebra M)) (ε : ℝ) (hε : 0 < ε) : + ∃ (n : ℕ) (_hn : 0 < n) + (ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M) + (v : unitary (Matrix (Fin n) (Fin n) ℂ)), + Function.Injective ρ ∧ traceNorm τ (u.val-ρ v.val) < ε := by + classical + obtain ⟨m,l,p,c,hp,ho,h1,hc,he⟩ := unitary_finite_spectrum_approximation M u (ε/2) (half_pos hε) + obtain ⟨n,hn,ρ,v,hρ,hv⟩ := rounded_unitary_matrix M τ hF hD p hp ho h1 c hc (ε/2) (half_pos hε) + refine ⟨n,hn,ρ,v,hρ,?_⟩ + have ha : traceNorm τ (u.val-∑ i, c i • p i) < ε/2 := + (traceNorm_le_norm τ _).trans_lt he + have ht := traceNorm_add_le τ (u.val-∑ i, c i • p i) ((∑ i, c i • p i)-ρ v.val) + rw [sub_add_sub_cancel] at ht + linarith + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ColoredExpansion.lean b/lean/OAI/Analysis/FreeWords/ColoredExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..f4261341bdcdac638bbef118df808f8af3a06ac3 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ColoredExpansion.lean @@ -0,0 +1,90 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKLocalPatching.Colored + +noncomputable section + +variable {A : Type*} + +abbrev Cell (A : Type*) := (A × ℤ) × Bool + +def old (s : List (A × ℤ)) : List (Cell A) := s.map (fun z => (z,false)) + +def changes : List (A × ℤ) → List (List (Cell A)) + | [] => [] + | z::s => ((changes s).map (fun c => (z,false)::c)) ++ + ((old s::changes s).map (fun c => (z,true)::c)) + +def erase (c : List (Cell A)) : List (A × ℤ) := c.map Prod.fst + +@[simp] theorem erase_old (s : List (A × ℤ)) : erase (old s)=s := by + simp [erase,old,List.map_map,Function.comp_def] + +theorem changes_length (s : List (A × ℤ)) : (changes s).length+1=2^s.length := by + induction s with + | nil => simp [changes] + | cons z s ih => + simp only [changes,List.length_append,List.length_map,List.length_cons,pow_succ] + omega + +theorem erase_of_mem_changes {s : List (A × ℤ)} {c : List (Cell A)} (hc : c∈changes s) : erase c=s := by + induction s generalizing c with + | nil => simp [changes] at hc + | cons z s ih => + simp only [changes,List.mem_append,List.mem_map] at hc + rcases hc with ⟨d,hd,rfl⟩ | ⟨d,hd,rfl⟩ + · simpa only [erase,List.map_cons] using congrArg (List.cons z) (ih hd) + · rcases List.mem_cons.mp hd with rfl | hd + · change z::erase (old s)=z::s + rw [erase_old] + · simpa only [erase,List.map_cons] using congrArg (List.cons z) (ih hd) + +theorem true_of_mem_changes {s : List (A × ℤ)} {c : List (Cell A)} (hc : c∈changes s) : + ∃ z∈c, z.2=true := by + induction s generalizing c with + | nil => simp [changes] at hc + | cons z s ih => + simp only [changes,List.mem_append,List.mem_map] at hc + rcases hc with ⟨d,hd,rfl⟩ | ⟨d,hd,rfl⟩ + · obtain ⟨a,ha,h⟩ := ih hd + exact ⟨a,List.mem_cons_of_mem _ ha,h⟩ + · exact ⟨(z,true),List.mem_cons_self,rfl⟩ + +def value [Ring A] (u v : ℤ → A) (c : List (Cell A)) : A := + (c.map (fun z => z.1.1*(if z.2 then v z.1.2 else u z.1.2))).prod + +@[simp] theorem value_nil [Ring A] (u v : ℤ → A) : value u v []=1 := rfl + +@[simp] theorem value_cons [Ring A] (u v : ℤ → A) (z : Cell A) (c : List (Cell A)) : + value u v (z::c)=z.1.1*(if z.2 then v z.1.2 else u z.1.2)*value u v c := rfl + +@[simp] theorem value_old [Ring A] (u v : ℤ → A) (s : List (A × ℤ)) : + value u v (old s)=(s.map (fun z => z.1*u z.2)).prod := by + simp [value,old,List.map_map,Function.comp_def] + +theorem value_append [Ring A] (u v : ℤ → A) (s t : List (Cell A)) : + value u v (s++t)=value u v s*value u v t := by + simp only [value,List.map_append,List.prod_append] + +theorem expansion [Ring A] (u v : ℤ → A) (s : List (A × ℤ)) : + (s.map (fun z => z.1*(u z.2+v z.2))).prod= + (s.map (fun z => z.1*u z.2)).prod+((changes s).map (value u v)).sum := by + induction s with + | nil => simp [changes] + | cons z s ih => + simp only [changes,List.map_cons,List.prod_cons,List.map_append,List.sum_append, + List.map_map,Function.comp_def,value_cons,Bool.false_eq_true,ite_false,ite_true, + List.sum_cons,value_old,ih] + simp only [List.sum_map_mul_left] + noncomm_ring + +end + +end KKLocalPatching.Colored +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ColoredSplit.lean b/lean/OAI/Analysis/FreeWords/ColoredSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ee84961640f55ff52641d785c2c456baf3a3b55 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ColoredSplit.lean @@ -0,0 +1,85 @@ +import Mathlib +import OAI.Analysis.FreeWords.ColoredExpansion + +namespace OAI + +noncomputable section + +namespace KKLocalPatching.Colored + +noncomputable section + +variable {A : Type*} + +theorem first_true_split (c : List (Cell A)) (hc : ∃ z∈c, z.2=true) : + ∃ p z r, c=old p++(z,true)::r := by + induction c with + | nil => simp at hc + | cons a c ih => + rcases a with ⟨z,b⟩ + cases b + · have ht : ∃ z∈c, z.2=true := by + obtain ⟨a,ha,ha'⟩ := hc + rcases List.mem_cons.mp ha with rfl | ha + · simp at ha' + · exact ⟨a,ha,ha'⟩ + obtain ⟨p,y,r,hr⟩ := ih ht + refine ⟨z::p,y,r,?_⟩ + simp only [old,List.map_cons,List.cons_append,hr] + · exact ⟨[],z,c,rfl⟩ + +theorem eq_old_of_no_true (c : List (Cell A)) (hc : ¬∃ z∈c, z.2=true) : c=old (erase c) := by + induction c with + | nil => rfl + | cons a c ih => + rcases a with ⟨z,b⟩ + have ht : ¬∃ a∈c, a.2=true := by + rintro ⟨a,ha,h⟩ + exact hc ⟨a,List.mem_cons_of_mem _ ha,h⟩ + cases b + · simpa only [erase,List.map_cons,old] using congrArg (List.cons (z,false)) (ih ht) + · exact (hc ⟨(z,true),List.mem_cons_self,rfl⟩).elim + +inductive Split (c : List (Cell A)) where + | single (p : List (A × ℤ)) (z : A × ℤ) (s : List (A × ℤ)) + (eqn : c=old p++(z,true)::old s) + | multiple (p : List (A × ℤ)) (z : A × ℤ) (g : List (A × ℤ)) + (y : A × ℤ) (r : List (Cell A)) + (eqn : c=old p++(z,true)::(old g++(y,true)::r)) + +theorem split_nonempty {c : List (Cell A)} (hc : ∃ z∈c, z.2=true) : Nonempty (Split c) := by + classical + obtain ⟨p,z,r,he⟩ := first_true_split c hc + by_cases hr : ∃ a∈r, a.2=true + · obtain ⟨g,y,s,hs⟩ := first_true_split r hr + exact ⟨.multiple p z g y s (he.trans (by rw [hs]))⟩ + · exact ⟨.single p z (erase r) (he.trans (by rw [← eq_old_of_no_true r hr]))⟩ + +def split {s : List (A × ℤ)} {c : List (Cell A)} (hc : c∈changes s) : Split c := + Classical.choice (split_nonempty (true_of_mem_changes hc)) + +namespace Split + +variable [Ring A] {c : List (Cell A)} + +def exponent : Split c → ℤ + | .single _ z _ _ => z.2 + | .multiple _ _ _ _ _ _ => 1 + +def gap (u : ℤ → A) : Split c → A + | .single _ _ _ _ => 0 + | .multiple _ _ g y _ _ => (g.map (fun z => z.1*u z.2)).prod*y.1 + +def coefficient (u : ℤ → A) (right : A) : Split c → A + | .single p z s _ => (s.map (fun z => z.1*u z.2)).prod*right* + (p.map (fun z => z.1*u z.2)).prod*z.1 + | .multiple _ _ _ _ _ _ => 0 + +end Split + +end + +end KKLocalPatching.Colored +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CompressionMoment.lean b/lean/OAI/Analysis/FreeWords/CompressionMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..8dfb6bc8391873d8e93cda2c5d542c6e79f10e90 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CompressionMoment.lean @@ -0,0 +1,103 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixAverageTrace +import OAI.Analysis.FreeWords.RankOneCompression + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +open KKTraceTransfer KKWeingarten MeasureTheory + +open scoped BigOperators Matrix.Norms.L2Operator + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +variable {d : ℕ} (ρ : Matrix (Fin d) (Fin d) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M) + +theorem traceNorm_compression_sq (q x : ConcreteAlgebra M) (hq : IsStarProjection q) : + (((traceNorm τ (q*x*q))^2 : ℝ) : ℂ)=τ.map (q*star x*q*x) := by + rw [traceNorm_sq] + have hq2 : q*q=q := hq.isIdempotentElem + have hqs : star q=q := hq.isSelfAdjoint + simp only [star_mul,hqs] + calc + τ.map (q*(star x*q)*(q*x*q)) = τ.map ((q*star x*(q*q)*x)*q) := by congr 1 + _ = τ.map (q*(q*star x*q*x)) := by rw [hq2,τ.tracial] + _ = _ := by simp only [← mul_assoc,hq2] + +theorem average_traceNorm_sq [NeZero d] (x : ConcreteAlgebra M) : + τ.map (matrixAverage ρ (star x)*x)=(((traceNorm τ (matrixAverage ρ x))^2 : ℝ) : ℂ) := by + rw [traceNorm_sq, matrixAverage_star] + calc + τ.map (matrixAverage ρ (star x)*x) = τ.map (star x*matrixAverage ρ x) := matrixAverage_trace_symm ρ τ _ _ + _ = τ.map (matrixAverage ρ (star x)*matrixAverage ρ x) := by + rw [matrixAverage_trace_symm,matrixAverage_idempotent] + +theorem continuous_compression_energy (z : Fin d) (x : ConcreteAlgebra M) : + Continuous (fun U => (traceNorm τ (rankOne ρ z U*x*rankOne ρ z U))^2) := by + have he (U : Matrix.unitaryGroup (Fin d) ℂ) : + (traceNorm τ (rankOne ρ z U*x*rankOne ρ z U))^2= + (τ.map (rankOne ρ z U*star x*rankOne ρ z U*x)).re := by + simpa only [Complex.ofReal_re] using congrArg Complex.re + (traceNorm_compression_sq τ _ x (rankOne_projection ρ z U)) + simp_rw [he] + exact Complex.continuous_re.comp (continuous_rankOne_pair τ ρ z (star x) x) + +theorem integral_compression_energy (hd : 2 ≤ d) (z : Fin d) (x : ConcreteAlgebra M) : + (∫ U : Matrix.unitaryGroup (Fin d) ℂ, + (traceNorm τ (rankOne ρ z U*x*rankOne ρ z U))^2 ∂matrixHaar d)= + ((traceNorm τ x)^2+(d : ℝ)*(traceNorm τ (matrixAverage ρ x))^2)/((d : ℝ)*((d : ℝ)+1)) := by + have : NeZero d := ⟨by omega⟩ + have he := integral_rankOne_pair τ ρ hd z (star x) x + rw [← traceNorm_sq,average_traceNorm_sq] at he + have hU (U : Matrix.unitaryGroup (Fin d) ℂ) : + τ.map (rankOne ρ z U*star x*rankOne ρ z U*x)= + (((traceNorm τ (rankOne ρ z U*x*rankOne ρ z U))^2 : ℝ) : ℂ) := + (traceNorm_compression_sq τ _ x (rankOne_projection ρ z U)).symm + simp_rw [hU] at he + rw [integral_complex_ofReal] at he + rw [mul_comm,← div_eq_mul_inv] at he + exact_mod_cast he + +theorem integral_compression_sum {ι : Type*} [Fintype ι] + (hd : 2 ≤ d) (z : Fin d) (x : ι → ConcreteAlgebra M) : + (∫ U : Matrix.unitaryGroup (Fin d) ℂ, + ∑ i,(traceNorm τ (rankOne ρ z U*x i*rankOne ρ z U))^2 ∂matrixHaar d)= + ((∑ i,(traceNorm τ (x i))^2)+(d : ℝ)*∑ i,(traceNorm τ (matrixAverage ρ (x i)))^2)/ + ((d : ℝ)*((d : ℝ)+1)) := by + rw [integral_finsetSum _ (fun i _ => + (continuous_compression_energy τ ρ z (x i)).integrable_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _))] + simp only [integral_compression_energy τ ρ hd z,← Finset.sum_div,Finset.sum_add_distrib,Finset.mul_sum] + +theorem exists_rankOne_small_compression {ι : Type*} [Fintype ι] + (hd : 2 ≤ d) (z : Fin d) (x : ι → ConcreteAlgebra M) (ε : ℝ) + (hb : ((∑ i,(traceNorm τ (x i))^2)+(d : ℝ)*∑ i,(traceNorm τ (matrixAverage ρ (x i)))^2)/ + ((d : ℝ)*((d : ℝ)+1)) < ε/(d : ℝ)) : + ∃ U : Matrix.unitaryGroup (Fin d) ℂ, + ∑ i,(traceNorm τ (rankOne ρ z U*x i*rankOne ρ z U))^2 < ε/(d : ℝ) := by + by_contra hh + push Not at hh + have hi : Integrable (fun U : Matrix.unitaryGroup (Fin d) ℂ => + ∑ i,(traceNorm τ (rankOne ρ z U*x i*rankOne ρ z U))^2) (matrixHaar d) := by + apply integrable_finsetSum + intro i hi + exact (continuous_compression_energy τ ρ z (x i)).integrable_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) + have hle := integral_mono (integrable_const (ε/(d : ℝ))) hi hh + rw [integral_const,integral_compression_sum τ ρ hd z x] at hle + simp only [probReal_univ,smul_eq_mul,one_mul] at hle + linarith + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ConcreteCornerAlgebra.lean b/lean/OAI/Analysis/FreeWords/ConcreteCornerAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..9486273f58e9d4f6246e39bd62e53ecfee43c462 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ConcreteCornerAlgebra.lean @@ -0,0 +1,151 @@ +import Mathlib +import OAI.Analysis.FreeWords.ConcreteCornerGeometry +import OAI.Analysis.FreeWords.TraceTransferDefinitions + +namespace OAI + +noncomputable section + +namespace KKConcreteCorner + +open KKTraceTransfer + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable (S : Submodule ℂ H) [CompleteSpace S] + +omit [CompleteSpace H] in +theorem extend_mul_compress (x : S →L[ℂ] S) (y : H →L[ℂ] H) + (hy : Commute y S.starProjection) : + extend S (x*compress S y)=extend S x*y := by + rw [extend_mul,extend_compress] + simp only [← mul_assoc] + rw [(extend_supported S x).2,mul_assoc,hy.eq,← mul_assoc,(extend_supported S x).2] + +omit [CompleteSpace H] in +theorem extend_compress_mul (y : H →L[ℂ] H) (x : S →L[ℂ] S) + (hy : Commute y S.starProjection) : + extend S (compress S y*x)=y*extend S x := by + rw [extend_mul,extend_compress,mul_assoc _ _ (extend S x),(extend_supported S x).1, + ← hy.eq,mul_assoc,(extend_supported S x).1] + +def centralizerVNA (s : Set (S →L[ℂ] S)) : VonNeumannAlgebra S where + toStarSubalgebra := StarSubalgebra.centralizer ℂ s + centralizer_centralizer' := by + change Set.centralizer (Set.centralizer (Set.centralizer (s ∪ star s))) = _ + exact Set.centralizer_centralizer_centralizer _ + +def cornerAlgebra (M : VonNeumannAlgebra H) : VonNeumannAlgebra S := + centralizerVNA S (compress S '' (M.commutant : Set (H →L[ℂ] H))) + +theorem mem_cornerAlgebra_iff (M : VonNeumannAlgebra H) + (hp : S.starProjection ∈ M) (x : S →L[ℂ] S) : + x ∈ cornerAlgebra S M ↔ extend S x ∈ M := by + have hc (y : H →L[ℂ] H) (hy : y∈M.commutant) : Commute y S.starProjection := + ((VonNeumannAlgebra.mem_commutant_iff.mp hy) _ hp).symm + change x ∈ StarSubalgebra.centralizer ℂ _ ↔ _ + rw [StarSubalgebra.mem_centralizer_iff] + constructor + · intro hx + rw [← M.commutant_commutant] + apply VonNeumannAlgebra.mem_commutant_iff.mpr + intro y hy + have hh := (hx _ ⟨y,hy,rfl⟩).1 + have he := congrArg (extend S) hh + rw [extend_compress_mul S y x (hc y hy),extend_mul_compress S x y (hc y hy)] at he + exact he + · intro hx + rintro y ⟨z,hz,rfl⟩ + have hh : ∀ (a : H →L[ℂ] H), a∈M.commutant → compress S a*x=x*compress S a := by + intro a ha + apply extend_injective S + rw [extend_compress_mul S a x (hc a ha),extend_mul_compress S x a (hc a ha)] + exact ((VonNeumannAlgebra.mem_commutant_iff.mp ha) _ hx).symm + exact ⟨hh z hz,by rw [← compress_star]; exact hh (star z) (star_mem hz)⟩ + +def liftLinear (M : VonNeumannAlgebra H) (hp : S.starProjection ∈ M) : + ConcreteAlgebra (cornerAlgebra S M) →ₗ[ℂ] ConcreteAlgebra M where + toFun x := ⟨extend S x.val,(mem_cornerAlgebra_iff S M hp x.val).mp x.property⟩ + map_add' x y := Subtype.ext (extend_add S x.val y.val) + map_smul' c x := Subtype.ext (extend_smul S c x.val) + +@[simp] theorem lift_val (M : VonNeumannAlgebra H) (hp : S.starProjection ∈ M) + (x : ConcreteAlgebra (cornerAlgebra S M)) : + (liftLinear S M hp x : H →L[ℂ] H)=extend S x.val := rfl + +theorem lift_injective (M : VonNeumannAlgebra H) (hp : S.starProjection ∈ M) : + Function.Injective (liftLinear S M hp) := by + intro x y h + apply Subtype.ext + exact extend_injective S (congrArg Subtype.val h) + +@[simp] theorem lift_mul (M : VonNeumannAlgebra H) (hp : S.starProjection ∈ M) + (x y : ConcreteAlgebra (cornerAlgebra S M)) : + liftLinear S M hp (x*y)=liftLinear S M hp x*liftLinear S M hp y := + Subtype.ext (extend_mul S x.val y.val) + +@[simp] theorem lift_star (M : VonNeumannAlgebra H) (hp : S.starProjection ∈ M) + (x : ConcreteAlgebra (cornerAlgebra S M)) : + liftLinear S M hp (star x)=star (liftLinear S M hp x) := + Subtype.ext (extend_star S x.val) + +def restrict (M : VonNeumannAlgebra H) (hp : S.starProjection ∈ M) + (x : ConcreteAlgebra M) : ConcreteAlgebra (cornerAlgebra S M) := + ⟨compress S x.val,(mem_cornerAlgebra_iff S M hp _).mpr (by + rw [extend_compress] + exact M.toStarSubalgebra.mul_mem (M.toStarSubalgebra.mul_mem hp x.property) hp)⟩ + +@[simp] theorem restrict_lift (M : VonNeumannAlgebra H) (hp : S.starProjection ∈ M) + (x : ConcreteAlgebra (cornerAlgebra S M)) : restrict S M hp (liftLinear S M hp x)=x := + Subtype.ext (compress_extend S x.val) + +end + +end KKConcreteCorner + +namespace KKConcreteCorner + +open KKTraceTransfer + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable (S : Submodule ℂ H) [CompleteSpace S] + +variable (M : VonNeumannAlgebra H) (hp : S.starProjection ∈ M) + +def projection : ConcreteAlgebra M := ⟨S.starProjection,hp⟩ + +@[simp] theorem lift_one : liftLinear S M hp 1=projection S M hp := Subtype.ext (extend_one S) + +theorem projection_isStar' : IsStarProjection (projection S M hp) := by + constructor + · exact Subtype.ext (projection_isStar S).isIdempotentElem.eq + · exact Subtype.ext (projection_isStar S).isSelfAdjoint.star_eq + +@[simp] theorem lift_restrict (x : ConcreteAlgebra M) : + liftLinear S M hp (restrict S M hp x)=projection S M hp*x*projection S M hp := + Subtype.ext (extend_compress S x.val) + +theorem lift_supported (x : ConcreteAlgebra (cornerAlgebra S M)) : + projection S M hp*liftLinear S M hp x=liftLinear S M hp x ∧ + liftLinear S M hp x*projection S M hp=liftLinear S M hp x := + ⟨Subtype.ext (extend_supported S x.val).1,Subtype.ext (extend_supported S x.val).2⟩ + +theorem lift_projection (q : ConcreteAlgebra (cornerAlgebra S M)) (hq : IsStarProjection q) : + IsStarProjection (liftLinear S M hp q) := by + constructor + · change liftLinear S M hp q*liftLinear S M hp q=liftLinear S M hp q + rw [← lift_mul,hq.isIdempotentElem.eq] + · change star (liftLinear S M hp q)=liftLinear S M hp q + rw [← lift_star,hq.isSelfAdjoint.star_eq] + +end + +end KKConcreteCorner +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ConcreteCornerFactor.lean b/lean/OAI/Analysis/FreeWords/ConcreteCornerFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..a18024b80aa76b4641d31f47401e1a117a0878ae --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ConcreteCornerFactor.lean @@ -0,0 +1,84 @@ +import Mathlib +import OAI.Analysis.FreeWords.ConcreteCornerAlgebra +import OAI.Analysis.FreeWords.CornerCentralScalar +import OAI.Analysis.FreeWords.ProjectionSmall + +namespace OAI + +noncomputable section + +namespace KKConcreteCorner + +open KKTraceTransfer KKFreeLiftFrontier KKProjectionSupport + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable (S : Submodule ℂ H) [CompleteSpace S] + +variable (M : VonNeumannAlgebra H) (hp : S.starProjection ∈ M) + +theorem cornerAlgebra_factor (τ : FaithfulNormalTrace M) (hF : IsFactor M) + (hp0 : projection S M hp ≠ 0) : IsFactor (cornerAlgebra S M) := by + intro x hx + let p := projection S M hp + let a := liftLinear S M hp x + have hpa : p*a=a := (lift_supported S M hp x).1 + have hap : a*p=a := (lift_supported S M hp x).2 + have hco : ∀ y : ConcreteAlgebra M, a*y*p=p*y*a := by + intro y + have hh := congrArg (liftLinear S M hp) (hx (restrict S M hp y)).eq + rw [lift_mul,lift_mul,lift_restrict] at hh + change a*(p*y*p)=(p*y*p)*a at hh + calc + a*y*p = (a*p)*y*p := by rw [hap] + _ = a*(p*y*p) := by simp only [mul_assoc] + _ = (p*y*p)*a := hh + _ = p*y*(p*a) := by simp only [mul_assoc] + _ = p*y*a := by rw [hpa] + obtain ⟨c,hc⟩ := corner_central_scalar τ hF p a (projection_isStar' S M hp) hp0 hco + refine ⟨c,lift_injective S M hp ?_⟩ + simpa only [map_smul,lift_one] using hc + +include hp in +theorem cornerAlgebra_diffuse (hD : IsDiffuse M) : IsDiffuse (cornerAlgebra S M) := by + intro q hq hq0 + let p := projection S M hp + let a := liftLinear S M hp q + have ha : IsStarProjection a := lift_projection S M hp q hq + have ha0 : a≠0 := by + intro hh + exact hq0 (lift_injective S M hp (hh.trans (map_zero _).symm)) + obtain ⟨b,hb,hb0,hba,hbb⟩ := hD a ha ha0 + have hap : a*p=a := (lift_supported S M hp q).2 + have hbp : b*p=b := by rw [← hbb,mul_assoc,hap,hbb] + have hps : star p=p := (projection_isStar' S M hp).isSelfAdjoint.star_eq + have hpb : p*b=b := by + simpa only [star_mul,hps,hb.isSelfAdjoint.star_eq] using congrArg star hbp + let B := restrict S M hp b + have hB : liftLinear S M hp B=b := by + change liftLinear S M hp (restrict S M hp b)=b + rw [lift_restrict,hpb,hbp] + refine ⟨B,?_,?_,?_,?_⟩ + · constructor + · change B*B=B + apply lift_injective S M hp + rw [lift_mul,hB,hb.isIdempotentElem.eq] + · change star B=B + apply lift_injective S M hp + rw [lift_star,hB,hb.isSelfAdjoint.star_eq] + · intro hh + exact hb0 (by rw [← hB,hh,map_zero]) + · intro hh + exact hba (by rw [← hB,hh]) + · apply lift_injective S M hp + rw [lift_mul,hB] + exact hbb + +end + +end KKConcreteCorner +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ConcreteCornerGeometry.lean b/lean/OAI/Analysis/FreeWords/ConcreteCornerGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2dfb4ce26d18189a4c9b41810ba0eacf9f21755 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ConcreteCornerGeometry.lean @@ -0,0 +1,78 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKConcreteCorner + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +variable (S : Submodule ℂ H) [CompleteSpace S] + +def compress (x : H →L[ℂ] H) : S →L[ℂ] S := + S.orthogonalProjectionOnto ∘L x ∘L S.subtypeL + +def extend (x : S →L[ℂ] S) : H →L[ℂ] H := + S.subtypeL ∘L x ∘L S.orthogonalProjectionOnto + +@[simp] theorem compress_extend (x : S →L[ℂ] S) : compress S (extend S x)=x := by + ext v + simp [compress,extend] + +@[simp] theorem extend_compress (x : H →L[ℂ] H) : + extend S (compress S x)=S.starProjection*x*S.starProjection := by + rfl + +@[simp] theorem extend_zero : extend S 0=0 := by simp [extend] + +@[simp] theorem extend_one : extend S 1=S.starProjection := by ext v; rfl + +@[simp] theorem extend_add (x y : S →L[ℂ] S) : extend S (x+y)=extend S x+extend S y := by + simp [extend,ContinuousLinearMap.add_comp,ContinuousLinearMap.comp_add] + +@[simp] theorem extend_smul (c : ℂ) (x : S →L[ℂ] S) : extend S (c • x)=c • extend S x := by + simp [extend] + +@[simp] theorem extend_mul (x y : S →L[ℂ] S) : extend S (x*y)=extend S x*extend S y := by + ext v + simp [extend] + +@[simp] theorem extend_star [CompleteSpace H] (x : S →L[ℂ] S) : extend S (star x)=star (extend S x) := by + simp only [extend,ContinuousLinearMap.star_eq_adjoint,ContinuousLinearMap.adjoint_comp, + Submodule.adjoint_subtypeL,Submodule.adjoint_orthogonalProjectionOnto,ContinuousLinearMap.comp_assoc] + +theorem extend_injective : Function.Injective (extend S) := by + intro x y h + simpa only [compress_extend] using congrArg (compress S) h + +theorem extend_supported (x : S →L[ℂ] S) : + S.starProjection*extend S x=extend S x ∧ extend S x*S.starProjection=extend S x := by + constructor + · rw [← extend_one,← extend_mul,one_mul] + · rw [← extend_one,← extend_mul,mul_one] + +@[simp] theorem compress_star [CompleteSpace H] (x : H →L[ℂ] H) : compress S (star x)=star (compress S x) := by + simp only [compress,ContinuousLinearMap.star_eq_adjoint,ContinuousLinearMap.adjoint_comp, + Submodule.adjoint_subtypeL,Submodule.adjoint_orthogonalProjectionOnto,ContinuousLinearMap.comp_assoc] + +theorem projection_isStar [CompleteSpace H] : IsStarProjection S.starProjection := + isStarProjection_starProjection + +theorem extend_norm_le (x : S →L[ℂ] S) : ‖extend S x‖ ≤ ‖x‖ := by + apply (extend S x).opNorm_le_bound (norm_nonneg x) + intro v + change ‖(x (S.orthogonalProjectionOnto v) : H)‖ ≤ ‖x‖*‖v‖ + change ‖x (S.orthogonalProjectionOnto v)‖ ≤ _ + exact (x.le_opNorm _).trans (mul_le_mul_of_nonneg_left (S.norm_orthogonalProjectionOnto_apply_le v) (norm_nonneg _)) + +end + +end KKConcreteCorner +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ConcreteCornerTrace.lean b/lean/OAI/Analysis/FreeWords/ConcreteCornerTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ad2a5f1f80d3cd24fc3fea3e64faeac0fd3284d --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ConcreteCornerTrace.lean @@ -0,0 +1,111 @@ +import Mathlib +import OAI.Analysis.FreeWords.ConcreteCornerAlgebra +import OAI.Analysis.FreeWords.ProjectionSmall + +namespace OAI + +noncomputable section + +namespace KKConcreteCorner + +open KKTraceTransfer KKProjectionSupport + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable (S : Submodule ℂ H) [CompleteSpace S] + +variable (M : VonNeumannAlgebra H) (hp : S.starProjection ∈ M) + +variable (τ : FaithfulNormalTrace M) (hp0 : projection S M hp ≠ 0) + +theorem extend_positive {x : S →L[ℂ] S} (hx : x.IsPositive) : (extend S x).IsPositive := by + simpa only [extend,Submodule.adjoint_orthogonalProjectionOnto] using + hx.adjoint_conj S.orthogonalProjectionOnto + +def extendWeak (T : WeakAlgebra (cornerAlgebra S M)) : WeakAlgebra M := + ⟨(ContinuousLinearMapWOT.ofCLM S.subtypeL).comp + (T.val.comp (ContinuousLinearMapWOT.ofCLM S.orthogonalProjectionOnto)), + (mem_cornerAlgebra_iff S M hp _).mp T.property⟩ + +theorem extendWeak_continuous : Continuous (extendWeak S M hp) := by + apply Continuous.subtype_mk + exact (ContinuousLinearMapWOT.continuous_postcomp (ContinuousLinearMapWOT.ofCLM S.subtypeL)).comp + ((ContinuousLinearMapWOT.continuous_precomp + (ContinuousLinearMapWOT.ofCLM S.orthogonalProjectionOnto)).comp continuous_subtype_val) + +theorem trace_projection_real : ((τ.map (projection S M hp)).re : ℂ)=τ.map (projection S M hp) := by + apply Complex.ext + · rfl + · exact (Complex.nonneg_iff.mp (trace_projection_nonneg τ (projection_isStar' S M hp))).2 + +def cornerTrace : FaithfulNormalTrace (cornerAlgebra S M) where + map := (Complex.ofReal (((τ.map (projection S M hp)).re)⁻¹)) • (τ.map.comp (liftLinear S M hp)) + positive x hx := by + have ht := Complex.nonneg_iff.mp (τ.positive (liftLinear S M hp x) (extend_positive S hx)) + apply Complex.nonneg_iff.mpr + constructor + · change 0 ≤ ((((τ.map (projection S M hp)).re)⁻¹ : ℝ) : ℂ).re * + (τ.map (liftLinear S M hp x)).re - + ((((τ.map (projection S M hp)).re)⁻¹ : ℝ) : ℂ).im * + (τ.map (liftLinear S M hp x)).im + simp only [Complex.ofReal_re,Complex.ofReal_im,zero_mul,sub_zero] + exact mul_nonneg (inv_nonneg.mpr (trace_projection_pos τ (projection_isStar' S M hp) hp0).le) ht.1 + · change 0=((((τ.map (projection S M hp)).re)⁻¹ : ℝ) : ℂ).re * + (τ.map (liftLinear S M hp x)).im + + ((((τ.map (projection S M hp)).re)⁻¹ : ℝ) : ℂ).im * + (τ.map (liftLinear S M hp x)).re + rw [← ht.2] + simp + normalized := by + change Complex.ofReal (((τ.map (projection S M hp)).re)⁻¹)*τ.map (liftLinear S M hp 1)=1 + rw [lift_one] + calc + _ = Complex.ofReal (((τ.map (projection S M hp)).re)⁻¹)* + Complex.ofReal ((τ.map (projection S M hp)).re) := by + congr 1 + exact (trace_projection_real S M hp τ).symm + _ = 1 := by + rw [← Complex.ofReal_mul,inv_mul_cancel₀ + (trace_projection_pos τ (projection_isStar' S M hp) hp0).ne',Complex.ofReal_one] + tracial x y := by + change _*τ.map (liftLinear S M hp (x*y))=_*τ.map (liftLinear S M hp (y*x)) + rw [lift_mul,lift_mul,τ.tracial] + faithful x hx ht := by + have hc : ((((τ.map (projection S M hp)).re)⁻¹ : ℝ) : ℂ)≠0 := by + exact_mod_cast (inv_ne_zero (trace_projection_pos τ (projection_isStar' S M hp) hp0).ne') + have hzero := (mul_eq_zero.mp ht).resolve_left hc + have he := τ.faithful (liftLinear S M hp x) (extend_positive S hx) hzero + exact lift_injective S M hp (he.trans (map_zero _).symm) + normal r := by + have hf : ContinuousOn (fun T : WeakAlgebra (cornerAlgebra S M) => + τ.map (weakToAlgebra (extendWeak S M hp T))) {T | ‖T.val.toCLM‖ ≤ r} := + (τ.normal r).comp (extendWeak_continuous S M hp).continuousOn (fun T hT => + (extend_norm_le S T.val.toCLM).trans hT) + exact continuousOn_const.mul hf + +@[simp] theorem cornerTrace_apply (x : ConcreteAlgebra (cornerAlgebra S M)) : + (cornerTrace S M hp τ hp0).map x= + (Complex.ofReal (((τ.map (projection S M hp)).re)⁻¹))*τ.map (liftLinear S M hp x) := rfl + +theorem cornerTrace_re (x : ConcreteAlgebra (cornerAlgebra S M)) : + ((cornerTrace S M hp τ hp0).map x).re= + ((τ.map (projection S M hp)).re)⁻¹*(τ.map (liftLinear S M hp x)).re := by + rw [cornerTrace_apply,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,zero_mul,sub_zero] + +theorem cornerTrace_norm_sq (x : ConcreteAlgebra (cornerAlgebra S M)) : + (traceNorm (cornerTrace S M hp τ hp0) x)^2= + ((τ.map (projection S M hp)).re)⁻¹*(traceNorm τ (liftLinear S M hp x))^2 := by + have h := congrArg Complex.re (traceNorm_sq (cornerTrace S M hp τ hp0) x) + rw [Complex.ofReal_re,cornerTrace_re,lift_mul,lift_star,← traceNorm_sq,Complex.ofReal_re] at h + exact h + +end + +end KKConcreteCorner +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ConcreteWords.lean b/lean/OAI/Analysis/FreeWords/ConcreteWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd4227f747bff11488c4bbf23017144a567e367a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ConcreteWords.lean @@ -0,0 +1,53 @@ +import Mathlib +import OAI.Analysis.FreeWords.FullThroughLabel +import OAI.Analysis.FreeWords.VNAModel + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +universe u + +local instance vnaOrder' {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + [CompleteSpace H] (V : VonNeumannAlgebra H) : PartialOrder V.toStarSubalgebra := + CStarAlgebra.spectralOrder _ + +local instance vnaStarOrder' {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + [CompleteSpace H] (V : VonNeumannAlgebra H) : StarOrderedRing V.toStarSubalgebra := + CStarAlgebra.spectralOrderedRing _ + +theorem concrete_free_words_through_label : + ∃ C : ℕ → ℝ, (∀ r, 0 < C r) ∧ + ∀ N : ℕ, 1 ≤ N → ∃ d₀ : ℕ, N ≤ d₀ ∧ + ∀ d : ℕ, d₀ ≤ d → + (∀ r : ℕ, 1 ≤ r → r ≤ N → + ∀ (H : Type u) [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + (V : VonNeumannAlgebra H) (τ : V.toStarSubalgebra →ₚ[ℂ] ℂ), + FaithfulTracial τ → NormalTrace V τ → + ∀ (F : FreeMatrixCopies τ r d) (W : Sym (Fin d) r), + ‖matrixWordSum V F W‖ ≤ KKThroughLabel.beta C d r W) ∧ + (∀ r : ℕ, 1 ≤ r → r ≤ N → ∀ a : Fin d, + KKThroughLabel.throughSum C d r a ≤ 64) := by + obtain ⟨C, hC, h⟩ := free_words_through_label.{u} + refine ⟨C, hC, ?_⟩ + intro N hN + obtain ⟨d₀, hd₀, hd⟩ := h N hN + refine ⟨d₀, hd₀, ?_⟩ + intro d hd' + obtain ⟨hb, hs⟩ := hd d hd' + refine ⟨?_, hs⟩ + intro r hr hrN H iG iI iC V τ hτ hNormal F W + exact hb r hr hrN V.toStarSubalgebra τ hτ (F.toPartitions hτ) W + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ConjugateCopies.lean b/lean/OAI/Analysis/FreeWords/ConjugateCopies.lean new file mode 100644 index 0000000000000000000000000000000000000000..0708bf878cd4ec305a1a9ef0eafc0aa76bd4a331 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ConjugateCopies.lean @@ -0,0 +1,78 @@ +import Mathlib +import OAI.Analysis.FreeWords.FreeWordCore + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] + +variable {τ : A →ₚ[ℂ] ℂ} {r d : ℕ} + +structure FreeMatrixCopies (τ : A →ₚ[ℂ] ℂ) (r d : ℕ) where + inclusion : Fin r → Matrix (Fin d) (Fin d) ℂ →⋆ₐ[ℂ] A + injective : ∀ j, Function.Injective (inclusion j) + free : ScalarFree τ (fun j => (inclusion j).range) + +namespace FreeMatrixCopies + +variable (F : FreeMatrixCopies τ r d) + +def diagonal (j : Fin r) (a : Fin d) : A := F.inclusion j (Matrix.single a a 1) + +theorem diagonal_selfadjoint (j : Fin r) (a : Fin d) : + star (F.diagonal j a) = F.diagonal j a := by + rw [diagonal, ← map_star] + congr 1 + change (Matrix.single a a (1:ℂ)).conjTranspose = _ + simp + +theorem diagonal_mul (j : Fin r) (a b : Fin d) : + F.diagonal j a * F.diagonal j b = if a=b then F.diagonal j a else 0 := by + rw [diagonal, diagonal, ← map_mul] + split_ifs with h + · subst b + simp + · rw [Matrix.single_mul_single_of_ne 1 a a b h 1, map_zero] + +theorem diagonal_sum (j : Fin r) : ∑ a, F.diagonal j a = 1 := by + simp only [diagonal, ← map_sum, Matrix.sum_single_one, map_one] + +theorem diagonal_trace_eq (hτ : ∀ x y : A, τ (x*y) = τ (y*x)) + (j : Fin r) (a b : Fin d) : τ (F.diagonal j a) = τ (F.diagonal j b) := by + have h := hτ (F.inclusion j (Matrix.single a b 1)) (F.inclusion j (Matrix.single b a 1)) + simpa only [← map_mul, Matrix.single_mul_single_same, one_mul, diagonal] using h + +theorem diagonal_trace (hτ : FaithfulTracial τ) (j : Fin r) (a : Fin d) : + τ (F.diagonal j a) = (d:ℂ)⁻¹ := by + have hs : (d:ℂ)*τ (F.diagonal j a) = 1 := by + have h := congrArg τ (F.diagonal_sum j) + rw [map_sum, hτ.1] at h + simpa only [F.diagonal_trace_eq hτ.2.1 j _ a, Finset.sum_const, Finset.card_univ, + Fintype.card_fin, nsmul_eq_mul] using h + exact eq_inv_of_mul_eq_one_right hs + +def toPartitions (hτ : FaithfulTracial τ) : FreePartitions τ r d where + S j := (F.inclusion j).range + e := F.diagonal + mem _ a := ⟨Matrix.single a a 1, rfl⟩ + selfadjoint := F.diagonal_selfadjoint + mul := F.diagonal_mul + sum := F.diagonal_sum + trace := F.diagonal_trace hτ + free := F.free + +end FreeMatrixCopies + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ConjugateCopies2.lean b/lean/OAI/Analysis/FreeWords/ConjugateCopies2.lean new file mode 100644 index 0000000000000000000000000000000000000000..7d7ddcb75c37cf47e1d05306f80c6eed0792dfe8 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ConjugateCopies2.lean @@ -0,0 +1,98 @@ +import Mathlib +import OAI.Analysis.FreeWords.ConjugateCopies +import OAI.Analysis.FreeWords.ConjugateFree + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {r d : ℕ} + +namespace FreeMatrixCopies + +variable (F : FreeMatrixCopies τ r d) + +end FreeMatrixCopies + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} {r d : ℕ} + +def haarConjugateCopies (hτ : FaithfulTracial τ) + (u : unitary A) (hu : (u:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) + (I : Matrix (Fin d) (Fin d) ℂ →⋆ₐ[ℂ] A) (hI : Function.Injective I) + (hIP : I.range ≤ P) (k : Fin r → ℤ) (hk : Function.Injective k) : + FreeMatrixCopies τ r d where + inclusion j := (conjugate u (k j)).toStarAlgHom.comp I + injective j := (conjugate u (k j)).injective.comp hI + free := by + have hf := (conjugates_scalarFree hτ.2.1 u hu hHaar hfree).reindex hk + apply hf.mono + intro j x hx + obtain ⟨y,rfl⟩ := hx + exact StarSubalgebra.mem_map.mpr ⟨I y, hIP ⟨y,rfl⟩, rfl⟩ + +omit [StarOrderedRing A] in +theorem haarConjugateCopies_diagonal (hτ : FaithfulTracial τ) + (u : unitary A) (hu : (u:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) + (I : Matrix (Fin d) (Fin d) ℂ →⋆ₐ[ℂ] A) (hI : Function.Injective I) + (hIP : I.range ≤ P) (k : Fin r → ℤ) (hk : Function.Injective k) + (j : Fin r) (a : Fin d) : + (haarConjugateCopies hτ u hu hHaar hfree I hI hIP k hk).diagonal j a = + upow u (-k j) * I (Matrix.single a a 1) * upow u (k j) := by + exact conjugate_apply u (k j) _ + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ConjugateFree.lean b/lean/OAI/Analysis/FreeWords/ConjugateFree.lean new file mode 100644 index 0000000000000000000000000000000000000000..72695b7b378febbf6f3fe2d4b8e9ffa6e8edbc79 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ConjugateFree.lean @@ -0,0 +1,292 @@ +import Mathlib +import OAI.Analysis.FreeWords.FreeWordCore + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +omit [StarOrderedRing A] + +section + +omit [PartialOrder A] + +def upow (u : unitary A) (k : ℤ) : A := (u ^ k : unitary A) + +@[simp] theorem upow_zero (u : unitary A) : upow u 0 = 1 := by simp [upow] + +@[simp] theorem upow_one (u : unitary A) : upow u 1 = u := by simp [upow] + +theorem upow_add (u : unitary A) (k l : ℤ) : upow u (k+l) = upow u k * upow u l := by + simp [upow, zpow_add] + +@[simp] theorem upow_neg_mul (u : unitary A) (k : ℤ) : upow u (-k) * upow u k = 1 := by + rw [← upow_add]; simp + +@[simp] theorem upow_mul_neg (u : unitary A) (k : ℤ) : upow u k * upow u (-k) = 1 := by + rw [← upow_add]; simp + +@[simp] theorem star_upow (u : unitary A) (k : ℤ) : star (upow u k) = upow u (-k) := by + change ((star (u^k) : unitary A) : A) = _ + rw [Unitary.star_eq_inv, ← zpow_neg] + rfl + +theorem upow_mem (u : unitary A) (hu : (u:A) ∈ S) (k : ℤ) : upow u k ∈ S := by + cases k with + | ofNat n => simpa [upow] using S.pow_mem hu n + | negSucc n => + have h : upow u (Int.ofNat (n+1)) ∈ S := by + change ((u ^ ((n+1:ℕ):ℤ) : unitary A) : A) ∈ S + rw [zpow_natCast, SubmonoidClass.coe_pow] + exact S.pow_mem hu (n+1) + have hn : Int.negSucc n = -Int.ofNat (n+1) := by + change Int.negSucc n = -((n+1:ℕ):ℤ) + omega + rw [hn, ← star_upow] + exact star_mem h + +def conjugate (u : unitary A) (k : ℤ) : A ≃⋆ₐ[ℂ] A := + Unitary.conjStarAlgAut ℂ A (u^(-k)) + +@[simp] theorem conjugate_apply (u : unitary A) (k : ℤ) (x : A) : + conjugate u k x = upow u (-k) * x * upow u k := by + rw [conjugate, Unitary.conjStarAlgAut_apply] + change upow u (-k) * x * star (upow u (-k)) = _ + rw [star_upow, neg_neg] + +@[simp] theorem conjugate_inverse (u : unitary A) (k : ℤ) (x : A) : + conjugate u (-k) (conjugate u k x) = x := by + simp only [conjugate_apply, neg_neg] + calc upow u k * (upow u (-k) * x * upow u k) * upow u (-k) + = (upow u k * upow u (-k)) * x * (upow u k * upow u (-k)) := by + simp only [mul_assoc] + _ = x := by simp + +end + +theorem trace_conjugate (hτ : ∀ x y, τ (x*y) = τ (y*x)) + (u : unitary A) (k : ℤ) (x : A) : τ (conjugate u k x) = τ x := by + rw [conjugate_apply, hτ] + simp only [← mul_assoc, upow_mul_neg, one_mul] + +section + +omit [PartialOrder A] + +def powerWord (u : unitary A) (k : ℤ) : List (Bool × A) := + if k=0 then [] else [(false, upow u k)] + +def separatedWord (u : unitary A) : List (ℤ × A) → List (Bool × A) + | [] => [] + | [(k,x)] => (true,x) :: powerWord u k + | (k,x)::(l,y)::w => (true,x) :: powerWord u (k-l) ++ separatedWord u ((l,y)::w) + +def expandedWord (u : unitary A) : List (ℤ × A) → List (Bool × A) + | [] => [] + | (k,x)::w => powerWord u (-k) ++ separatedWord u ((k,x)::w) + +@[simp] theorem powerWord_value (u : unitary A) (k : ℤ) : + ((powerWord u k).map Prod.snd).prod = upow u k := by + by_cases h : k=0 <;> simp [powerWord, h] + +@[simp] theorem separatedWord_head (u : unitary A) (k : ℤ) (x : A) (w : List (ℤ×A)) : + (separatedWord u ((k,x)::w)).head? = some (true,x) := by + cases w <;> simp [separatedWord] + +@[simp] theorem separatedWord_ne_nil (u : unitary A) (k : ℤ) (x : A) (w : List (ℤ×A)) : + separatedWord u ((k,x)::w) ≠ [] := by + cases w <;> simp [separatedWord] + +theorem separatedWord_value (u : unitary A) (k : ℤ) (x : A) (w : List (ℤ×A)) : + ((separatedWord u ((k,x)::w)).map Prod.snd).prod = + upow u k * (((k,x)::w).map (fun y => conjugate u y.1 y.2)).prod := by + induction w generalizing k x with + | nil => simp [separatedWord, conjugate_apply, ← mul_assoc] + | cons y w ih => + obtain ⟨l,y⟩ := y + simp only [separatedWord, List.map_append, List.map_cons, List.prod_append, + List.prod_cons, powerWord_value, ih] + have hpow : upow u (k-l) * upow u l = upow u k := by rw [← upow_add]; congr 1; omega + have lead (z : A) : upow u k * (conjugate u k x * z) = x * (upow u k * z) := by + simp only [conjugate_apply, ← mul_assoc, upow_mul_neg, one_mul] + rw [lead, mul_assoc, ← mul_assoc (upow u (k-l)), hpow] + +theorem expandedWord_value (u : unitary A) (w : List (ℤ×A)) : + ((expandedWord u w).map Prod.snd).prod = + (w.map (fun y => conjugate u y.1 y.2)).prod := by + cases w with + | nil => simp [expandedWord] + | cons y w => + obtain ⟨k,x⟩ := y + rw [expandedWord, List.map_append, List.prod_append, powerWord_value, + separatedWord_value, ← mul_assoc, upow_neg_mul, one_mul] + +def binaryCopy (S P : StarSubalgebra ℂ A) (b : Bool) : StarSubalgebra ℂ A := + if b then P else S + +theorem separatedWord_chain (u : unitary A) {k : ℤ} {x : A} {w : List (ℤ×A)} + (h : ((k,x)::w).IsChain (fun x y => x.1 ≠ y.1)) : + (separatedWord u ((k,x)::w)).IsChain (fun x y => x.1 ≠ y.1) := by + induction w generalizing k x with + | nil => + by_cases hk : k=0 <;> simp [separatedWord, powerWord, hk] + | cons y w ih => + obtain ⟨l,y⟩ := y + have hkl : k ≠ l := (List.isChain_cons_cons.mp h).1 + have hh := ih h.tail + rw [separatedWord, powerWord, ite_eq_right (sub_ne_zero.mpr hkl)] + simpa [List.isChain_cons, separatedWord_head] using hh + +theorem expandedWord_chain (u : unitary A) {w : List (ℤ×A)} + (h : w.IsChain (fun x y => x.1 ≠ y.1)) : + (expandedWord u w).IsChain (fun x y => x.1 ≠ y.1) := by + cases w with + | nil => simp [expandedWord] + | cons y w => + obtain ⟨k,x⟩ := y + have hh := separatedWord_chain u h + by_cases hk : -k=0 <;> simpa [expandedWord, powerWord, hk, List.isChain_cons] using hh + +end + +theorem powerWord_centered (u : unitary A) (hu : (u:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) (k : ℤ) : + ∀ x ∈ powerWord u k, x.2 ∈ binaryCopy S P x.1 ∧ τ x.2 = 0 := by + intro x hx + by_cases hk : k=0 + · simp [powerWord, hk] at hx + · have he : x = (false, upow u k) := by + simpa only [powerWord, ite_eq_right hk, List.mem_singleton] using hx + subst x + exact ⟨upow_mem u hu k, hHaar k hk⟩ + +theorem separatedWord_centered (u : unitary A) (hu : (u:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) {w : List (ℤ×A)} + (hw : ∀ x ∈ w, x.2 ∈ P ∧ τ x.2 = 0) : + ∀ x ∈ separatedWord u w, x.2 ∈ binaryCopy S P x.1 ∧ τ x.2 = 0 := by + induction w with + | nil => simp [separatedWord] + | cons y w ih => + obtain ⟨k,y⟩ := y + have hy := hw (k,y) (by simp) + have ht := ih (fun x hx => hw x (List.mem_cons_of_mem _ hx)) + intro x hx + cases w with + | nil => + simp only [separatedWord, List.mem_cons] at hx + rcases hx with rfl | hx + · exact hy + · exact powerWord_centered u hu hHaar k x hx + | cons z w => + obtain ⟨l,z⟩ := z + simp only [separatedWord, List.mem_append, List.mem_cons] at hx + rcases hx with (rfl | hx) | hx + · exact hy + · exact powerWord_centered u hu hHaar (k-l) x hx + · exact ht x hx + +theorem expandedWord_centered (u : unitary A) (hu : (u:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) {w : List (ℤ×A)} + (hw : ∀ x ∈ w, x.2 ∈ P ∧ τ x.2 = 0) : + ∀ x ∈ expandedWord u w, x.2 ∈ binaryCopy S P x.1 ∧ τ x.2 = 0 := by + cases w with + | nil => simp [expandedWord] + | cons y w => + obtain ⟨k,y⟩ := y + intro x hx + rw [expandedWord, List.mem_append] at hx + exact hx.elim (powerWord_centered u hu hHaar (-k) x) + (separatedWord_centered u hu hHaar hw x) + +theorem trace_conjugate_word (u : unitary A) (hu : (u:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) {w : List (ℤ×A)} + (hne : w ≠ []) (hchain : w.IsChain (fun x y => x.1 ≠ y.1)) + (hw : ∀ x ∈ w, x.2 ∈ P ∧ τ x.2 = 0) : + τ ((w.map (fun x => conjugate u x.1 x.2)).prod) = 0 := by + have hne' : expandedWord u w ≠ [] := by + cases w with + | nil => contradiction + | cons y w => + obtain ⟨k,x⟩ := y + intro he + exact separatedWord_ne_nil u k x w (List.append_eq_nil_iff.mp he).2 + simpa only [expandedWord_value] using hfree (expandedWord u w) hne' + (expandedWord_chain u hchain) (expandedWord_centered u hu hHaar hw) + +def conjugateCopy (u : unitary A) (P : StarSubalgebra ℂ A) (k : ℤ) : + StarSubalgebra ℂ A := P.map (conjugate u k).toStarAlgHom + +theorem conjugates_scalarFree (hτ : ∀ x y, τ (x*y) = τ (y*x)) + (u : unitary A) (hu : (u:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) : + ScalarFree τ (conjugateCopy u P) := by + intro w hne hchain hw + let w₀ := w.map (fun x : ℤ × A => (x.1, conjugate u (-x.1) x.2)) + have he := trace_conjugate_word u hu hHaar hfree (w := w₀) + have hne₀ : w₀ ≠ [] := by simpa [w₀] using hne + have hchain₀ : w₀.IsChain (fun x y => x.1 ≠ y.1) := by + simpa only [w₀, List.isChain_map] using hchain + have hw₀ : ∀ x ∈ w₀, x.2 ∈ P ∧ τ x.2 = 0 := by + intro x hx + obtain ⟨y,hy,rfl⟩ := List.mem_map.mp hx + obtain ⟨hyP, hyτ⟩ := hw y hy + constructor + · obtain ⟨z,hz,hze⟩ := StarSubalgebra.mem_map.mp hyP + change conjugate u y.1 z = y.2 at hze + rw [← hze, conjugate_inverse] + exact hz + · simpa only [trace_conjugate hτ] using hyτ + have hzero := he hne₀ hchain₀ hw₀ + have hinv (k : ℤ) (x : A) : conjugate u k (conjugate u (-k) x) = x := by + simpa only [neg_neg] using conjugate_inverse u (-k) x + simpa only [w₀, List.map_map, Function.comp_def, hinv] using hzero + +theorem ScalarFree.mono {ι : Type*} {T U : ι → StarSubalgebra ℂ A} + (h : ScalarFree τ T) (hTU : ∀ i, U i ≤ T i) : ScalarFree τ U := by + intro w hne hchain hw + exact h w hne hchain (fun x hx => ⟨hTU x.1 (hw x hx).1, (hw x hx).2⟩) + +theorem ScalarFree.reindex {ι κ : Type*} {T : ι → StarSubalgebra ℂ A} + (h : ScalarFree τ T) {f : κ → ι} (hf : Function.Injective f) : + ScalarFree τ (T ∘ f) := by + intro w hne hchain hw + have hne' : w.map (fun x => (f x.1, x.2)) ≠ [] := by simpa using hne + have hc : (w.map (fun x => (f x.1, x.2))).IsChain (fun x y => x.1 ≠ y.1) := by + rw [List.isChain_map] + exact hchain.imp (fun x y hxy heq => hxy (hf heq)) + have hz := h (w.map (fun x => (f x.1, x.2))) hne' hc (by + intro x hx + obtain ⟨y,hy,rfl⟩ := List.mem_map.mp hx + exact hw y hy) + simpa only [List.map_map, Function.comp_def] using hz + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ControlledLiftCommutator.lean b/lean/OAI/Analysis/FreeWords/ControlledLiftCommutator.lean new file mode 100644 index 0000000000000000000000000000000000000000..033b8821611d857faba695211a90f7b6f6de58a2 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ControlledLiftCommutator.lean @@ -0,0 +1,50 @@ +import Mathlib +import OAI.Analysis.FreeWords.RestrictedDerivationDefinitions +import OAI.Analysis.FreeWords.ScalarMatrixCommutator + +namespace OAI + +noncomputable section + +namespace KKMatrixHilbert + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem controlled_lift_commutator {n d : ℕ} + (S : StarSubalgebra ℂ (H →L[ℂ] H)) + (ρ : Matrix (Fin d) (Fin d) ℂ →⋆ₐ[ℂ] (H →L[ℂ] H)) + (hρ : ∀ a, ρ a ∈ S) (h : H →L[ℂ] H) (_ : IsSelfAdjoint h) + (s : unitary (Matrix (Fin n) (Fin n) (H →L[ℂ] H))) + (hs : ∀ i j, s.val i j ∈ ρ.range) : + ‖matrixOperator (Matrix.diagonal fun _ : Fin n => h) * matrixOperator s.val - + matrixOperator s.val * matrixOperator (Matrix.diagonal fun _ : Fin n => h)‖ ≤ + 2 * ‖restrictedDerivation S h‖ := by + apply scalar_matrix_commutator_bound ρ h _ _ s hs + intro u + let a : S := ⟨ρ u.val,hρ u.val⟩ + have ha : a ∈ unitary S := by + constructor + · apply Subtype.ext + change star (ρ u.val) * ρ u.val = 1 + rw [←map_star,←map_mul,u.property.1,map_one] + · apply Subtype.ext + change ρ u.val * star (ρ u.val) = 1 + rw [←map_star,←map_mul,u.property.2,map_one] + have hnorm : ‖a‖ ≤ 1 := by + cases subsingleton_or_nontrivial S with + | inl h => have := h; simp [Subsingleton.elim a 0] + | inr h => have := h; exact (CStarRing.norm_of_mem_unitary ha).le + change ‖restrictedDerivation S h a‖ ≤ ‖restrictedDerivation S h‖ + calc + _ ≤ ‖restrictedDerivation S h‖ * ‖a‖ := (restrictedDerivation S h).le_opNorm a + _ ≤ ‖restrictedDerivation S h‖ * 1 := mul_le_mul_of_nonneg_left hnorm (norm_nonneg _) + _ = _ := mul_one _ + +end + +end KKMatrixHilbert +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ControlledMatrixConjugation.lean b/lean/OAI/Analysis/FreeWords/ControlledMatrixConjugation.lean new file mode 100644 index 0000000000000000000000000000000000000000..8bf68e99b6133102e5d6bf8b5b0211d85e664345 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ControlledMatrixConjugation.lean @@ -0,0 +1,77 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixConditionalExpectation +import OAI.Analysis.FreeWords.RelativeConjugationDefinitions + +namespace OAI + +noncomputable section + +namespace KKControlledConjugation + +open KKRelativeMatrix KKMatrixExpectation KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] [StarModule ℂ A] + +def amplifyConj (n : ℕ) (u : unitary A) : + Matrix (Fin n) (Fin n) A →⋆ₐ[ℂ] Matrix (Fin n) (Fin n) A := + { (Unitary.conjStarAlgAut ℂ A u).toStarAlgHom.toAlgHom.mapMatrix with + map_star' := by + intro X + ext i j + exact map_star (Unitary.conjStarAlgAut ℂ A u) (X j i) } + +omit [StarModule ℂ A] in +@[simp] theorem amplifyConj_apply (n : ℕ) (u : unitary A) + (X : Matrix (Fin n) (Fin n) A) (i j : Fin n) : + amplifyConj n u X i j=u.val*X i j*star u.val := rfl + +omit [StarModule ℂ A] in +theorem conj_trace (τ : A →ₗ[ℂ] ℂ) (htr : ∀a b,τ (a*b)=τ (b*a)) + (u : unitary A) (a : A) : τ (u.val*a*star u.val)=τ a := by + rw [htr,← mul_assoc] + rw [show star u.val*u.val=1 from u.property.1,one_mul] + +omit [StarModule ℂ A] in +theorem amplifyConj_trace (τ : A →ₗ[ℂ] ℂ) (htr : ∀a b,τ (a*b)=τ (b*a)) + (n : ℕ) (u : unitary A) (X : Matrix (Fin n) (Fin n) A) : + matrixTraceMap τ n (amplifyConj n u X)=matrixTraceMap τ n X := by + simp only [matrixTraceMap_apply,amplifyConj_apply,conj_trace τ htr] + +theorem amplifyConj_expectation (τ : A →ₗ[ℂ] ℂ) (htr : ∀a b,τ (a*b)=τ (b*a)) + (n : ℕ) (u : unitary A) (X : Matrix (Fin n) (Fin n) A) : + matrixExpectation τ n (amplifyConj n u X)=matrixExpectation τ n X := by + ext i j + simp only [matrixExpectation_apply,amplifyConj_apply,conj_trace τ htr] + +theorem amplifyConj_numerical (n : ℕ) (u : unitary A) (b : Matrix (Fin n) (Fin n) ℂ) : + amplifyConj n u (numericalHom (A := A) n b)=numericalHom (A := A) n b := by + ext i j + change (Unitary.conjStarAlgAut ℂ A u) (algebraMap ℂ A (b i j))=algebraMap ℂ A (b i j) + exact (Unitary.conjStarAlgAut ℂ A u).toStarAlgHom.commutes (b i j) + +theorem amplifyConj_entry_range {n d : ℕ} (u : unitary A) + (ρ : Matrix (Fin d) (Fin d) ℂ →⋆ₐ[ℂ] A) + (X : Matrix (Fin n) (Fin n) A) (hX : ∀i j,X i j∈ρ.range) (i j : Fin n) : + amplifyConj n u X i j∈((Unitary.conjStarAlgAut ℂ A u).toStarAlgHom.comp ρ).range := by + obtain ⟨a,ha⟩ := hX i j + refine ⟨a,?_⟩ + change (Unitary.conjStarAlgAut ℂ A u) (ρ a)= (Unitary.conjStarAlgAut ℂ A u) (X i j) + exact congrArg (Unitary.conjStarAlgAut ℂ A u) ha + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem amplifyConj_eq_scalarConjugate {M : VonNeumannAlgebra H} {n : ℕ} + (u : unitary (ConcreteAlgebra M)) (X : Matrix (Fin n) (Fin n) (ConcreteAlgebra M)) : + amplifyConj n u X=scalarConjugate u X := by + ext i j + simp only [amplifyConj_apply,scalarConjugate,Matrix.diagonal_mul,Matrix.mul_diagonal] + rfl + +end + +end KKControlledConjugation +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CoordinateConstantFree.lean b/lean/OAI/Analysis/FreeWords/CoordinateConstantFree.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c1d36ac7c7a6204b47c35ad2549cd2c42aead65 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CoordinateConstantFree.lean @@ -0,0 +1,90 @@ +import Mathlib +import OAI.Analysis.FreeWords.CoordinateFreeExtract + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace + +open Filter Topology + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable (R : ℕ → StarSubalgebra ℂ A) [∀ j, IsClosed (R j : Set A)] + +local instance constantFreeOrder : PartialOrder (coordinateAlgebra R) := CStarAlgebra.spectralOrder _ + +local instance coordinateConstantFreeLE : LE (coordinateAlgebra R) := (constantFreeOrder R).toLE + +local instance coordinateConstantFreePreorder : Preorder (coordinateAlgebra R) := (constantFreeOrder R).toPreorder + +local instance coordinateConstantFreeSOR : StarOrderedRing (coordinateAlgebra R) := CStarAlgebra.spectralOrderedRing _ + +def coordinateConstant (x : A) (hx : ∀j,x∈R j) : coordinateAlgebra R := + ⟨BoundedContinuousFunction.const ℕ x,hx⟩ + +theorem trace_coordinateConstant (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) + (x : A) (hx : ∀j,x∈R j) : coordinateTrace R τ ω (coordinateConstant R x hx)=τ x := by + exact tendsto_nhds_unique (tendsto_ultraTraceValue τ ω (BoundedContinuousFunction.const ℕ x)) + tendsto_const_nhds + +theorem coordinate_constant_free (τ : A →ₚ[ℂ] ℂ) (h1 : τ 1=1) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (ω : Ultrafilter ℕ) + (hω : (ω : Filter ℕ)≤atTop) + (hF : IsFactor (gnsVonNeumann (coordinateTrace R τ ω))) + (hD : IsDiffuse (gnsVonNeumann (coordinateTrace R τ ω))) + (K : Finset ℤ) (F : Finset (List (ℤ × A))) + (hFne : ∀ w∈F, w≠[]) + (hcenter : ∀ w∈F, ∀ z∈w, z.1≠0 ∧ τ z.2=0) + (hmem : ∀ w∈F, ∀ z∈w, ∀j, z.2∈R j) + (ε : ℝ) (hε : 0<ε) (N : ℕ) : + ∃ j : ℕ, N≤j ∧ ∃ u : unitary A, u.val∈R j ∧ + (∀ k∈K, k≠0 → ‖τ ((u^k).val)‖<ε) ∧ + (∀ w∈F, ‖τ ((w.map (fun z => ((u^z.1).val)*z.2)).prod)‖<ε) := by + classical + let lift (x : A) : coordinateAlgebra R := + if hx : ∀j,x∈R j then coordinateConstant R x hx else 0 + have hlift (x : A) (hx : ∀j,x∈R j) : lift x=coordinateConstant R x hx := dite_eq_left hx + let wf : List (ℤ × A) → List (ℤ × coordinateAlgebra R) := + List.map (fun z => (z.1,lift z.2)) + have hn : ∀ w∈F.image wf, w≠[] := by + intro w hw + obtain ⟨v,hv,rfl⟩ := Finset.mem_image.mp hw + intro hz + exact hFne v hv (List.map_eq_nil_iff.mp hz) + have hc : ∀ w∈F.image wf, ∀ z∈w, + z.1≠0 ∧ coordinateTrace R τ ω z.2=0 := by + intro w hw z hz + obtain ⟨v,hv,rfl⟩ := Finset.mem_image.mp hw + obtain ⟨a,ha,rfl⟩ := List.mem_map.mp hz + refine ⟨(hcenter v hv a ha).1,?_⟩ + change coordinateTrace R τ ω (lift a.2)=0 + rw [hlift a.2 (hmem v hv a ha),trace_coordinateConstant] + exact (hcenter v hv a ha).2 + obtain ⟨j,hjN,u,huR,huK,huF⟩ := coordinate_free_extract R τ h1 htr ω hω hF hD + K (F.image wf) hn hc ε hε N + refine ⟨j,hjN,u,huR,huK,?_⟩ + intro w hw + have hh := huF (wf w) (Finset.mem_image.mpr ⟨w,hw,rfl⟩) + have he : ((wf w).map (fun z => (u^z.1).val*(z.2.val j)))= + w.map (fun z => (u^z.1).val*z.2) := by + simp only [wf,List.map_map,Function.comp_def] + apply List.map_congr_left + intro z hz + rw [hlift z.2 (hmem w hw z hz)] + rfl + rwa [he] at hh + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CoordinateFreeExtract.lean b/lean/OAI/Analysis/FreeWords/CoordinateFreeExtract.lean new file mode 100644 index 0000000000000000000000000000000000000000..28b11ca7ecaff3922b54c864a4aaf1b6b0c7b4cc --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CoordinateFreeExtract.lean @@ -0,0 +1,117 @@ +import Mathlib +import OAI.Analysis.FreeWords.FreePreimage +import OAI.Analysis.FreeWords.VariableUltraBundle + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace + +open Filter Topology + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable (R : ℕ → StarSubalgebra ℂ A) [∀ j, IsClosed (R j : Set A)] + +local instance coordExtractOrder : PartialOrder (coordinateAlgebra R) := CStarAlgebra.spectralOrder _ + +local instance coordinateFreeExtractLE : LE (coordinateAlgebra R) := (coordExtractOrder R).toLE + +local instance coordinateFreeExtractPreorder : Preorder (coordinateAlgebra R) := (coordExtractOrder R).toPreorder + +local instance coordinateFreeExtractSOR : StarOrderedRing (coordinateAlgebra R) := CStarAlgebra.spectralOrderedRing _ + +def coordinateEval (j : ℕ) : coordinateAlgebra R →⋆ₐ[ℂ] A where + toFun x := x.val j + map_one' := rfl + map_zero' := rfl + map_add' _ _ := rfl + map_mul' _ _ := rfl + commutes' _ := rfl + map_star' _ := rfl + +omit [PartialOrder A] [StarOrderedRing A] [∀ j, IsClosed (R j : Set A)] in +@[simp] theorem coordinateEval_apply (j : ℕ) (x : coordinateAlgebra R) : + coordinateEval R j x=x.val j := rfl + +theorem coordinate_gns_surjective (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (ω : Ultrafilter ℕ) + (hω : (ω : Filter ℕ)≤atTop) : + Function.Surjective (gnsBiHom (coordinateTrace R τ ω)) := by + intro x + have hx := (SetLike.ext_iff.mp (coordinate_gns_range R τ htr ω hω) x.val).mpr x.property + obtain ⟨preimage, hpreimage⟩ := hx + exact ⟨preimage, Subtype.ext hpreimage⟩ + +theorem coordinate_unitary_extract (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) + (hω : (ω : Filter ℕ)≤atTop) + (K : Finset ℤ) (F : Finset (List (ℤ × coordinateAlgebra R))) + (v : unitary (coordinateAlgebra R)) (ε : ℝ) + (hK : ∀ k∈K, k≠0 → ‖coordinateTrace R τ ω ((v^k).val)‖<ε) + (hW : ∀ w∈F, ‖coordinateTrace R τ ω ((w.map (fun z => (v^z.1).val*z.2)).prod)‖<ε) + (N : ℕ) : + ∃ j : ℕ, N≤j ∧ ∃ u : unitary A, u.val∈R j ∧ + (∀ k∈K, k≠0 → ‖τ ((u^k).val)‖<ε) ∧ + (∀ w∈F, ‖τ ((w.map (fun z => ((u^z.1).val)*(z.2.val j))).prod)‖<ε) := by + have hKt : ∀ᶠ j in (ω : Filter ℕ), ∀ k∈K, k≠0 → + ‖τ (((Unitary.map (StarMonoidHom.ofClass (coordinateEval R j)) v)^k).val)‖<ε := by + apply (Filter.eventually_all_finset K).mpr + intro k hk + by_cases hk0 : k=0 + · exact Eventually.of_forall (fun _ h => (h hk0).elim) + · have ht := (tendsto_ultraTraceValue τ ω ((v^k).val.val)).norm + have hh := (tendsto_order.mp ht).2 ε (hK k hk hk0) + filter_upwards [hh] with j hj + intro _ + rw [← unitary_map_zpow] + change ‖τ ((v^k).val.val j)‖<ε + exact hj + have hFt : ∀ᶠ j in (ω : Filter ℕ), ∀ w∈F, + ‖τ ((w.map (fun z => (((Unitary.map (StarMonoidHom.ofClass (coordinateEval R j)) v)^z.1).val)* + (z.2.val j))).prod)‖<ε := by + apply (Filter.eventually_all_finset F).mpr + intro w hw + have ht := (tendsto_ultraTraceValue τ ω ((w.map (fun z => (v^z.1).val*z.2)).prod.val)).norm + have hh := (tendsto_order.mp ht).2 ε (hW w hw) + filter_upwards [hh] with j hj + have hew := unitary_map_word (coordinateEval R j) v w + change ‖τ ((coordinateEval R j) ((w.map (fun z => (v^z.1).val*z.2)).prod))‖<ε at hj + rw [hew] at hj + simpa only [List.map_map,Function.comp_def,coordinateEval_apply] using hj + have hN : ∀ᶠ j in (ω : Filter ℕ), N≤j := hω (eventually_ge_atTop N) + obtain ⟨j,hjN,hjK,hjF⟩ := (hN.and (hKt.and hFt)).exists + exact ⟨j,hjN,Unitary.map (StarMonoidHom.ofClass (coordinateEval R j)) v,v.val.property j,hjK,hjF⟩ + +theorem coordinate_free_extract (τ : A →ₚ[ℂ] ℂ) (h1 : τ 1=1) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (ω : Ultrafilter ℕ) + (hω : (ω : Filter ℕ)≤atTop) + (hF : IsFactor (gnsVonNeumann (coordinateTrace R τ ω))) + (hD : IsDiffuse (gnsVonNeumann (coordinateTrace R τ ω))) + (K : Finset ℤ) (F : Finset (List (ℤ × coordinateAlgebra R))) + (hFne : ∀ w∈F, w≠[]) + (hcenter : ∀ w∈F, ∀ z∈w, z.1≠0 ∧ coordinateTrace R τ ω z.2=0) + (ε : ℝ) (hε : 0<ε) (N : ℕ) : + ∃ j : ℕ, N≤j ∧ ∃ u : unitary A, u.val∈R j ∧ + (∀ k∈K, k≠0 → ‖τ ((u^k).val)‖<ε) ∧ + (∀ w∈F, ‖τ ((w.map (fun z => ((u^z.1).val)*(z.2.val j))).prod)‖<ε) := by + obtain ⟨v,hvK,hvF⟩ := finite_free_preimage + (gnsVonNeumann (coordinateTrace R τ ω)) + (gnsNormalTrace (coordinateTrace R τ ω) (coordinateTrace_one R τ ω h1) + (coordinateTrace_tracial R τ ω htr)) hF hD + (gnsBiHom (coordinateTrace R τ ω)) (coordinate_gns_surjective R τ htr ω hω) + (coordinateTrace R τ ω) (gnsNormalTrace_image _ _ _) K F hFne hcenter ε hε + exact coordinate_unitary_extract R τ ω hω K F v ε hvK hvF N + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CornerCentralScalar.lean b/lean/OAI/Analysis/FreeWords/CornerCentralScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..00643ff962c90caebc8089538c081a068f3f55ca --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CornerCentralScalar.lean @@ -0,0 +1,105 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorCorners +import OAI.Analysis.FreeWords.TupleHull + +namespace OAI + +noncomputable section + +namespace KKConcreteCorner + +open KKTraceTransfer KKFreeLiftFrontier KKProjectionSupport KKFactorSupport KKUltraTrace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +private theorem closure_convexHull_subset_zero + {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] (T : E →L[ℝ] F) {s : Set E} + (hs : s ⊆ {v | T v = 0}) : closure (convexHull ℝ s) ⊆ {v | T v = 0} := + closure_minimal (convexHull_min hs T.ker.convex) + (isClosed_eq T.continuous continuous_const) + +private def cornerOperator {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (p a : ConcreteAlgebra M) : TupleSpace τ (ι := Bool) →L[ℂ] (tracePositive τ).GNS := + ((tracePositive τ).gnsStarAlgHom a).comp (PiLp.proj 2 _ false) - + ((tracePositive τ).gnsStarAlgHom p).comp (PiLp.proj 2 _ true) + +private theorem cornerOperator_orbit {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (p a : ConcreteAlgebra M) (hcentral : ∀ y : ConcreteAlgebra M, a*y*p=p*y*a) : + tupleOrbit τ (fun b : Bool => if b then a else p) ⊆ + {v | cornerOperator τ p a v = 0} := by + rintro _ ⟨u,rfl⟩ + change (tracePositive τ).gnsStarAlgHom a (gnsVector (tracePositive τ) (algebraConj u p)) - + (tracePositive τ).gnsStarAlgHom p (gnsVector (tracePositive τ) (algebraConj u a))=0 + rw [gnsStarAlgHom_vector,gnsStarAlgHom_vector,sub_eq_zero] + congr 1 + simp only [algebraConj_apply,← mul_assoc] + rw [hcentral] + +private theorem cornerOperator_hull {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (p a : ConcreteAlgebra M) (hcentral : ∀ y : ConcreteAlgebra M, a*y*p=p*y*a) : + tupleHull τ (fun b : Bool => if b then a else p) ⊆ + {v | cornerOperator τ p a v = 0} := + closure_convexHull_subset_zero ((cornerOperator τ p a).restrictScalars ℝ) + (cornerOperator_orbit τ p a hcentral) + +private theorem cornerOperator_trace_zero {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (hF : KKFreeLiftFrontier.IsFactor M) (p a : ConcreteAlgebra M) + (hcentral : ∀ y : ConcreteAlgebra M, a*y*p=p*y*a) : + cornerOperator τ p a + (tupleVector τ (fun b : Bool => τ.map (if b then a else p) • 1)) = 0 := + cornerOperator_hull τ p a hcentral (tuple_trace_in_hull τ hF _) + +open scoped ComplexOrder in +private theorem gnsStarAlgHom_smul_one {A : Type*} [CStarAlgebra A] + [PartialOrder A] [StarOrderedRing A] (τ : A →ₚ[ℂ] ℂ) (a : A) (c : ℂ) : + τ.gnsStarAlgHom a (gnsVector τ (c • 1)) = gnsVector τ (c • a) := by + rw [gnsStarAlgHom_vector, mul_smul_comm, mul_one] + +private theorem cornerOperator_trace_value {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (p a : ConcreteAlgebra M) : + cornerOperator τ p a + (tupleVector τ (fun b : Bool => τ.map (if b then a else p) • 1)) = + gnsVector (tracePositive τ) (τ.map p • a) - + gnsVector (tracePositive τ) (τ.map a • p) := by + change (tracePositive τ).gnsStarAlgHom a (gnsVector (tracePositive τ) (τ.map p • 1)) - + (tracePositive τ).gnsStarAlgHom p (gnsVector (tracePositive τ) (τ.map a • 1)) = _ + exact congrArg₂ (· - ·) + (gnsStarAlgHom_smul_one (tracePositive τ) a (τ.map p)) + (gnsStarAlgHom_smul_one (tracePositive τ) p (τ.map a)) + +private theorem corner_trace_smul_eq {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (hF : KKFreeLiftFrontier.IsFactor M) (p a : ConcreteAlgebra M) + (hcentral : ∀ y : ConcreteAlgebra M, a*y*p=p*y*a) : + τ.map p • a = τ.map a • p := by + apply gnsVector_injective τ + apply sub_eq_zero.mp + exact (cornerOperator_trace_value τ p a).symm.trans (cornerOperator_trace_zero τ hF p a hcentral) + +theorem corner_central_scalar {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (hF : KKFreeLiftFrontier.IsFactor M) + (p a : ConcreteAlgebra M) (hp : IsStarProjection p) (hp0 : p ≠ 0) + (hcentral : ∀ y : ConcreteAlgebra M, a*y*p=p*y*a) : + ∃ c : ℂ, a=c • p := by + have he' := corner_trace_smul_eq τ hF p a hcentral + have hpτ := trace_projection_ne_zero τ hp hp0 + refine ⟨(τ.map p)⁻¹*τ.map a,?_⟩ + have h := congrArg (fun z : ConcreteAlgebra M => (τ.map p)⁻¹ • z) he' + simpa only [smul_smul,inv_mul_cancel₀ hpτ,one_smul] using h + +end + +end KKConcreteCorner +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CornerCompression.lean b/lean/OAI/Analysis/FreeWords/CornerCompression.lean new file mode 100644 index 0000000000000000000000000000000000000000..f19ac01ec4b5052d1d333c4ae5954aa52bfcbbe4 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CornerCompression.lean @@ -0,0 +1,95 @@ +import Mathlib +import OAI.Analysis.FreeWords.ConcreteCornerFactor +import OAI.Analysis.FreeWords.ConcreteCornerTrace +import OAI.Analysis.FreeWords.LocalCompression + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +open KKTraceTransfer KKFreeLiftFrontier KKProjectionSupport KKConcreteCorner + +noncomputable section + +theorem corner_small_compression + {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {ι : Type*} [Fintype ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) + (p : ConcreteAlgebra M) (hp : IsStarProjection p) (hp0 : p ≠ 0) + (x : ι → ConcreteAlgebra M) + (hs : ∀ i, p*x i*p=x i) (hx : ∀ i, τ.map (x i)=0) + (ε : ℝ) (hε : 0 < ε) : + ∃ q : ConcreteAlgebra M, IsStarProjection q ∧ q ≠ 0 ∧ q*p=q ∧ + (τ.map q).re < ε ∧ + ∑ i, (traceNorm τ (q*x i*q))^2 < ε*(τ.map q).re := by + have hpCLM : IsStarProjection (p : H →L[ℂ] H) := hp.map M.toStarSubalgebra.subtype + let S : Submodule ℂ H := (p.val : H →ₗ[ℂ] H).range + let : IsClosed (S : Set H) := ContinuousLinearMap.IsIdempotentElem.isClosed_range hpCLM.isIdempotentElem + let : CompleteSpace S := IsClosed.completeSpace_coe + have heq : S.starProjection=p.val := by + obtain ⟨h,heq⟩ := isStarProjection_iff_eq_starProjection_range.mp hpCLM + exact heq.symm + have hmem : S.starProjection ∈ M := heq ▸ p.property + have hproj : projection S M hmem=p := Subtype.ext heq + have hproj0 : projection S M hmem≠0 := hproj ▸ hp0 + let C := cornerAlgebra S M + let σ := cornerTrace S M hmem τ hproj0 + let y : ι → ConcreteAlgebra C := fun i => restrict S M hmem (x i) + have hy (i : ι) : liftLinear S M hmem (y i)=x i := by + change liftLinear S M hmem (restrict S M hmem (x i))=x i + rw [lift_restrict,hproj,hs] + have hyτ (i : ι) : σ.map (y i)=0 := by + change (cornerTrace S M hmem τ hproj0).map (y i)=0 + rw [cornerTrace_apply,hy,hx,mul_zero] + let t : ℝ := (τ.map p).re + have ht : 0 ?_⟩ + have hi := hu i + have he (a : ConcreteAlgebra C) : σ.map a=Complex.ofReal t⁻¹*τ.map (liftLinear S M hmem a) := by + change (cornerTrace S M hmem τ hproj0).map a=_ + rw [cornerTrace_apply,hproj] + rw [he,← trace_supported_restrict] at hi + simp only [norm_mul,Complex.norm_real,Real.norm_eq_abs,abs_of_pos (inv_pos.mpr ht)] at hi + change ‖τ.map (liftLinear S M hmem ((u^(k i)).val)*x i)‖<ε + have htt := mul_lt_mul_of_pos_left hi ht + have hc (a:ℝ) : t*(t⁻¹*a)=a := by rw [← mul_assoc,mul_inv_cancel₀ ht.ne',one_mul] + rw [hc] at htt + have hcan : t*(ε/t)=ε := by field_simp + rwa [hcan] at htt + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CountableFreeLift.lean b/lean/OAI/Analysis/FreeWords/CountableFreeLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..de2d8f5ce9a391320ac6e8bc6483e094a8814b1b --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CountableFreeLift.lean @@ -0,0 +1,55 @@ +import Mathlib +import OAI.Analysis.FreeWords.FiniteMatrixFreeApproximation + +namespace OAI + +noncomputable section + +namespace KKFreeLiftFrontier + +open KKTraceTransfer Filter Topology + +noncomputable section + +theorem countable_matrix_free_approximation + (H : Type*) [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [TopologicalSpace.SeparableSpace H] [Nontrivial H] (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M) (hfac : IsFactor M) (hdiff : IsDiffuse M) + (n : ℕ) (hn : 0 < n) (T : ℕ → List (ℤ × MatrixAlgebra n M)) + (hT : ∀ i, IsCenteredTest τ (T i)) : + ∃ d : ℕ → ℕ, (∀ j, 0 < d j) ∧ + ∃ ρ : ∀ j, Matrix (Fin (d j)) (Fin (d j)) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M, + (∀ j, Function.Injective (ρ j)) ∧ ∃ U : ℕ → unitary (MatrixAlgebra n M), + (∀ j i k, (U j).val i k ∈ (ρ j).range) ∧ + (∀ k : ℤ, k ≠ 0 → Tendsto (fun j => matrixTrace τ n (U j ^ k).val) atTop (𝓝 0)) ∧ + (∀ i, Tendsto (fun j => mixedMoment τ (U j) (T i)) atTop (𝓝 0)) := by + classical + have hε (j : ℕ) : 0 < (1 : ℝ) / (j + 1) := by positivity + have ex (j : ℕ) := finite_matrix_free_approximation H M τ hfac hdiff n hn + ((Finset.range (j+1)).image T) + (by intro w hw; obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp hw; exact hT i) + (Finset.Icc (-(j:ℤ)) (j:ℤ)) ((1:ℝ)/(j+1)) (hε j) + choose d hd ρ hρ U hU hH hM using ex + refine ⟨d,hd,ρ,hρ,U,hU,?_,?_⟩ + · intro k hk + apply squeeze_zero_norm' _ tendsto_one_div_add_atTop_nhds_zero_nat + filter_upwards [eventually_ge_atTop k.natAbs] with j hj + apply (hH j k _ hk).le + apply Finset.mem_Icc.mpr + have hc : (k.natAbs:ℤ) ≤ (j:ℤ) := by exact_mod_cast hj + have hpos : k ≤ (k.natAbs:ℤ) := Int.le_natAbs + have hneg : -k ≤ (k.natAbs:ℤ) := by simpa using (Int.le_natAbs (a := -k)) + constructor <;> omega + · intro i + apply squeeze_zero_norm' _ tendsto_one_div_add_atTop_nhds_zero_nat + filter_upwards [eventually_ge_atTop i] with j hj + apply (hM j (T i) _).le + apply Finset.mem_image.mpr + exact ⟨i,Finset.mem_range.mpr (by omega),rfl⟩ + +end + +end KKFreeLiftFrontier +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CutAlgebra.lean b/lean/OAI/Analysis/FreeWords/CutAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f52e664041f410e4d62e3aff3e40a6dcd7e9f25 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CutAlgebra.lean @@ -0,0 +1,85 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators + +section + +variable {R ι : Type*} [Semiring R] + +variable (C A K : ι → R) + +def cutSum : List ι → R + | [] => 1 + | i :: w => C i * cutSum w + (A i + K i) * (w.map A).prod + +def CutCompatible (i j : ι) : Prop := + A i * C j = 0 ∧ K i * C j = 0 ∧ A i * K j = 0 ∧ K i * K j = 0 + +theorem noncreation_cutSum (i j : ι) (w : List ι) + (h : CutCompatible C A K i j) : + (A i + K i) * cutSum C A K (j :: w) = + (A i + K i) * ((j :: w).map A).prod := by + rcases h with ⟨hAC, hKC, hAK, hKK⟩ + simp only [cutSum, List.map_cons, List.prod_cons, mul_add, add_mul, + ← mul_assoc, hAC, hKC, hAK, hKK, zero_mul, zero_add, add_zero] + +theorem product_eq_cutSum (w : List ι) (hw : w.IsChain (CutCompatible C A K)) : + (w.map (fun i => C i + A i + K i)).prod = cutSum C A K w := by + induction w with + | nil => simp [cutSum] + | cons i w ih => + rw [List.isChain_cons] at hw + rw [List.map_cons, List.prod_cons, ih hw.2, cutSum, add_assoc, add_mul] + congr 1 + cases w with + | nil => simp [cutSum] + | cons j w => exact noncreation_cutSum C A K i j w (hw.1 j (by simp)) + +theorem cutSum_map {κ : Type*} (f : κ → ι) (w : List κ) : + cutSum C A K (w.map f) = cutSum (C ∘ f) (A ∘ f) (K ∘ f) w := by + induction w with + | nil => rfl + | cons i w ih => simp only [cutSum, List.map_cons, ih, List.map_map]; rfl + +def noPresCut {n : ℕ} (C A : Fin n → R) (k : ℕ) : R := + ((List.ofFn C).take k).prod * ((List.ofFn A).drop k).prod + +def presCut {n : ℕ} (C A K : Fin n → R) (j : Fin n) : R := + ((List.ofFn C).take j).prod * K j * ((List.ofFn A).drop (j+1)).prod + +theorem cutSum_eq_cuts {n : ℕ} (C A K : Fin n → R) : + cutSum C A K (List.ofFn id) = + (∑ p : Fin (n+1), noPresCut C A p) + ∑ j : Fin n, presCut C A K j := by + induction n with + | zero => simp [cutSum, noPresCut, presCut] + | succ n ih => + rw [List.ofFn_succ] + simp only [id_eq] + rw [cutSum] + have htail : cutSum C A K (List.ofFn (fun j : Fin n => j.succ)) = + cutSum (fun j => C j.succ) (fun j => A j.succ) (fun j => K j.succ) + (List.ofFn id) := by + simpa only [List.map_ofFn, Function.comp_def, id_eq] using + cutSum_map C A K Fin.succ (List.ofFn (id : Fin n → Fin n)) + rw [htail, ih, + Fin.sum_univ_succ (fun p : Fin (n+2) => noPresCut C A p), + Fin.sum_univ_succ (fun j : Fin (n+1) => presCut C A K j)] + simp only [noPresCut, presCut, List.ofFn_succ, List.take_zero, List.prod_nil, + List.drop_zero, one_mul, List.take_succ_cons, List.drop_succ_cons, + List.prod_cons, Fin.val_zero, Fin.val_succ, + List.map_ofFn, Function.comp_def] + simp only [mul_add, add_mul, Finset.mul_sum, mul_assoc] + abel + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CutNorms.lean b/lean/OAI/Analysis/FreeWords/CutNorms.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd59d3f0d3622b080084ebbb0d081c851d338de5 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CutNorms.lean @@ -0,0 +1,79 @@ +import Mathlib +import OAI.Analysis.FreeWords.CutTuples +import OAI.Analysis.FreeWords.TupleMatrices + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder InnerProductSpace + +noncomputable section + +variable {E α : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +variable [Fintype α] [DecidableEq α] + +omit [CompleteSpace E] in +theorem sum_noPresCut_norm (p q : ℕ) (W : Multiset α) + (C D : Fin (q+p) → α → E →L[ℂ] E) {t : ℝ} (ht : 0 ≤ t) + (hC : ∀ j, RowSqBound (C j) (t^2)) (hD : ∀ j, ColSqBound (D j) (t^2)) : + ‖∑ a : Fin (q+p) → α, if tupleLabels a = W then + noPresCut (fun j => C j (a j)) (fun j => D j (a j)) q else 0‖ ≤ + Real.sqrt ((q.factorial : ℝ) * p.factorial) * t^(q+p) := by + rw [sum_noPresCut] + have hCr : RowSqBound (tupleOp (fun j : Fin q => C (j.castAdd p))) ((t^q)^2) := by + simpa only [← pow_mul, Nat.mul_comm] using + tupleOp_row (sq_nonneg t) (fun j : Fin q => hC (j.castAdd p)) + have hDc : ColSqBound (tupleOp (fun j : Fin p => D (Fin.natAdd q j))) ((t^p)^2) := by + simpa only [← pow_mul, Nat.mul_comm] using + tupleOp_col (sq_nonneg t) (fun j : Fin p => hD (Fin.natAdd q j)) + have hT : MatrixSqBound (tupleScalarMatrix (E := E) p q W) + ((Real.sqrt ((q.factorial : ℝ)*p.factorial))^2) := by + rw [Real.sq_sqrt (by positivity), mul_comm] + exact tupleScalarMatrix_bound p q W + have h := row_matrix_col_norm hCr hT hDc (pow_nonneg ht _) (Real.sqrt_nonneg _) + (pow_nonneg ht _) + change ‖∑ a, ∑ b, tupleOp _ a * tupleScalarMatrix (E := E) p q W a b * tupleOp _ b‖ ≤ _ + exact h.trans_eq (by rw [pow_add]; ring) + +theorem sum_presCut_norm (p q : ℕ) (W : Multiset α) + (C D K : Fin (q+(p+1)) → α → E →L[ℂ] E) {t : ℝ} (ht : 0 ≤ t) + (hC : ∀ j, RowSqBound (C j) (t^2)) (hD : ∀ j, ColSqBound (D j) (t^2)) + (P : α → E →L[ℂ] E) (hP : ∀ c, IsStarProjection (P c)) + (horth : ∀ c e, c ≠ e → P c * P e = 0) (hsum : ∑ c, P c = 1) + (Q : E →L[ℂ] E) (hQ : ‖Q‖ ≤ 1) (z : ℂ) + (hK : ∀ c, K (Fin.natAdd q 0) c = Q * (P c - z • 1) * Q) : + ‖∑ a : Fin (q+(p+1)) → α, if tupleLabels a = W then + presCut (fun j => C j (a j)) (fun j => D j (a j)) (fun j => K j (a j)) + (Fin.natAdd q 0) else 0‖ ≤ + (Real.sqrt ((q.factorial : ℝ) * p.factorial) + + ‖z‖ * Real.sqrt (((q+1).factorial : ℝ) * (p+1).factorial)) * t^(q+p) := by + rw [sum_presCut] + have hCr : RowSqBound (tupleOp (fun j : Fin q => C (j.castAdd (p+1)))) ((t^q)^2) := by + simpa only [← pow_mul, Nat.mul_comm] using + tupleOp_row (sq_nonneg t) (fun j : Fin q => hC (j.castAdd (p+1))) + have hDc : ColSqBound (tupleOp (fun j : Fin p => D (Fin.natAdd q j.succ))) ((t^p)^2) := by + simpa only [← pow_mul, Nat.mul_comm] using + tupleOp_col (sq_nonneg t) (fun j : Fin p => hD (Fin.natAdd q j.succ)) + have hT := tuplePresMatrix_bound P hP horth hsum Q hQ z p q W + have h := row_matrix_col_norm hCr hT hDc (pow_nonneg ht _) (by positivity) + (pow_nonneg ht _) + have he : (fun a : Fin q → α => fun b : Fin p → α => + ∑ c, if tupleLabels a + {c} + tupleLabels b = W then K (Fin.natAdd q 0) c else 0) = + tuplePresMatrix P Q z p q W := by + funext a b + simp only [tuplePresMatrix, hK] + change ‖∑ a, ∑ b, tupleOp _ a * _ * tupleOp _ b‖ ≤ _ + simp only [hK] + exact h.trans_eq (by rw [pow_add]; simp only [mul_comm (p.factorial : ℝ), + mul_comm (((p+1).factorial : ℕ) : ℝ)]; ring) + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CutTuples.lean b/lean/OAI/Analysis/FreeWords/CutTuples.lean new file mode 100644 index 0000000000000000000000000000000000000000..671e78f10bfb5370bbf69a5a4c705fad207b1c36 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CutTuples.lean @@ -0,0 +1,122 @@ +import Mathlib +import OAI.Analysis.FreeWords.CutAlgebra +import OAI.Analysis.FreeWords.TupleCombinatorics + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators + +noncomputable section + +variable {R α : Type*} [Semiring R] [Fintype α] [DecidableEq α] + +omit [Semiring R] in +theorem ofFn_take_add {m n : ℕ} (f : Fin (m+n) → R) : + (List.ofFn f).take m = List.ofFn (fun i => f (i.castAdd n)) := by + rw [List.ofFn_add] + have he : (fun i : Fin m => f (Fin.castLE (Nat.le_add_right m n) i)) = + (fun i : Fin m => f (i.castAdd n)) := by + funext i + congr 1 + rw [he] + simpa only [List.length_ofFn] using + (List.take_left (l₁ := List.ofFn (fun i : Fin m => f (i.castAdd n))) + (l₂ := List.ofFn (fun i : Fin n => f (Fin.natAdd m i)))) + +omit [Semiring R] in +theorem ofFn_drop_add {m n : ℕ} (f : Fin (m+n) → R) : + (List.ofFn f).drop m = List.ofFn (fun i => f (Fin.natAdd m i)) := by + rw [List.ofFn_add] + have he : (fun i : Fin m => f (Fin.castLE (Nat.le_add_right m n) i)) = + (fun i : Fin m => f (i.castAdd n)) := by + funext i + congr 1 + rw [he] + simpa only [List.length_ofFn] using + (List.drop_left (l₁ := List.ofFn (fun i : Fin m => f (i.castAdd n))) + (l₂ := List.ofFn (fun i : Fin n => f (Fin.natAdd m i)))) + +omit [Fintype α] [DecidableEq α] in +theorem tupleLabels_append {m n : ℕ} (a : Fin m → α) (b : Fin n → α) : + tupleLabels (Fin.append a b) = tupleLabels a + tupleLabels b := by + simp only [tupleLabels, List.ofFn_fin_append, Multiset.coe_add] + +def tupleProduct {n : ℕ} (C : Fin n → α → R) (a : Fin n → α) : R := + (List.ofFn (fun j => C j (a j))).prod + +theorem sum_noPresCut (p q : ℕ) (W : Multiset α) + (C D : Fin (q+p) → α → R) : + (∑ a : Fin (q+p) → α, if tupleLabels a = W then + noPresCut (fun j => C j (a j)) (fun j => D j (a j)) q else 0) = + ∑ a : Fin q → α, ∑ b : Fin p → α, + tupleProduct (fun j => C (j.castAdd p)) a * + (if tupleLabels a + tupleLabels b = W then 1 else 0) * + tupleProduct (fun j => D (Fin.natAdd q j)) b := by + rw [← Equiv.sum_comp (Fin.appendEquiv q p)] + simp only [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro a ha + apply Finset.sum_congr rfl + intro b hb + change (if tupleLabels (Fin.append a b) = W then + noPresCut (fun j => C j ((Fin.append a b) j)) + (fun j => D j ((Fin.append a b) j)) q else 0) = _ + simp only [tupleLabels_append, noPresCut, + ofFn_take_add, ofFn_drop_add, Fin.append_left, Fin.append_right, tupleProduct] + split_ifs <;> simp + +theorem sum_presCut (p q : ℕ) (W : Multiset α) + (C D K : Fin (q+(p+1)) → α → R) : + (∑ a : Fin (q+(p+1)) → α, if tupleLabels a = W then + presCut (fun j => C j (a j)) (fun j => D j (a j)) (fun j => K j (a j)) + (Fin.natAdd q 0) else 0) = + ∑ a : Fin q → α, ∑ b : Fin p → α, + tupleProduct (fun j => C (j.castAdd (p+1))) a * + (∑ c : α, if tupleLabels a + {c} + tupleLabels b = W then + K (Fin.natAdd q 0) c else 0) * + tupleProduct (fun j => D (Fin.natAdd q j.succ)) b := by + rw [← Equiv.sum_comp (Fin.appendEquiv q (p+1))] + simp only [Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro a ha + rw [← Equiv.sum_comp (Fin.consEquiv (fun _ : Fin (p+1) => α))] + simp only [Fintype.sum_prod_type] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro b hb + rw [Finset.mul_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro c hc + change (if tupleLabels (Fin.append a (Fin.cons c b)) = W then + presCut (fun j => C j ((Fin.append a (Fin.cons c b)) j)) + (fun j => D j ((Fin.append a (Fin.cons c b)) j)) + (fun j => K j ((Fin.append a (Fin.cons c b)) j)) (Fin.natAdd q 0) else 0) = _ + have he : presCut (fun j => C j ((Fin.append a (Fin.cons c b)) j)) + (fun j => D j ((Fin.append a (Fin.cons c b)) j)) + (fun j => K j ((Fin.append a (Fin.cons c b)) j)) (Fin.natAdd q 0) = + tupleProduct (fun j => C (j.castAdd (p+1))) a * K (Fin.natAdd q 0) c * + tupleProduct (fun j => D (Fin.natAdd q j.succ)) b := by + dsimp only [presCut] + rw [Fin.append_right, Fin.cons_zero] + change ((List.ofFn (fun j => C j ((Fin.append a (Fin.cons c b)) j))).take q).prod * + K (Fin.natAdd q 0) c * + ((List.ofFn (fun j => D j ((Fin.append a (Fin.cons c b)) j))).drop (q+1)).prod = _ + have hd : (List.ofFn (fun j => D j ((Fin.append a (Fin.cons c b)) j))).drop (q+1) = + List.ofFn (fun j => D (Fin.natAdd q j.succ) (b j)) := by + rw [← List.drop_drop, ofFn_drop_add, List.ofFn_succ] + simp only [Fin.append_right, List.drop_succ_cons, List.drop_zero, Fin.cons_succ] + rw [hd, ofFn_take_add] + simp only [Fin.append_left, tupleProduct] + rw [he, tupleLabels_append, tupleLabels_cons, ← add_assoc] + split_ifs <;> simp + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CyclicApproxNet.lean b/lean/OAI/Analysis/FreeWords/CyclicApproxNet.lean new file mode 100644 index 0000000000000000000000000000000000000000..b21cd8baf94494f54669ac4de00dfef81670c78e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CyclicApproxNet.lean @@ -0,0 +1,62 @@ +import Mathlib +import OAI.Analysis.FreeWords.FiniteMomentNet +import OAI.Analysis.FreeWords.HaarFiniteEndpointsDefinitions + +namespace OAI + +noncomputable section + +namespace KKHaarEndpoints + +noncomputable section + +open Filter + +open scoped Topology + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] + +abbrev CyclicTest (τ : A →ₗ[ℂ] ℂ) (B : Subalgebra ℂ A) := + {k : ℤ // k≠0} ⊕ {w : List (ℤ×A) // w≠[] ∧ CenteredPowerWord τ B w} + +abbrev CyclicIndex (τ : A →ₗ[ℂ] ℂ) (B : Subalgebra ℂ A) := Finset (CyclicTest τ B)×ℕ + +theorem cyclic_approx_net (τ : A →ₗ[ℂ] ℂ) (B : Subalgebra ℂ A) (Good : unitary A → Prop) + (happ : FiniteCyclicApprox τ B Good) : + ∃u:CyclicIndex τ B → unitary A, (∀j,Good (u j)) ∧ + (∀k:ℤ,k≠0 → Tendsto (fun j => τ (u j^k).val) atTop (𝓝 0)) ∧ + (∀w:List (ℤ×A),w≠[] → CenteredPowerWord τ B w → + Tendsto (fun j => τ (powerWord (u j) w)) atTop (𝓝 0)) := by + classical + let T := CyclicTest τ B + let f : T → unitary A → ℂ := fun t u => match t with + | .inl k => τ (u^k.val).val + | .inr w => τ (powerWord u w.val) + have hfinite : ∀L:Finset T, ∀η:ℝ,0<η → ∃u,Good u ∧ ∀t∈L,‖f t u‖<η := by + intro L η hη + let K₀ : Finset ℤ := L.image (fun t => match t with | .inl k => k.val | .inr _ => 0) + let F₀ : Finset (List (ℤ×A)) := L.biUnion (fun t => match t with | .inl _ => ∅ | .inr w => {w.val}) + have hF₀ : ∀w∈F₀,w≠[] ∧ CenteredPowerWord τ B w := by + intro w hw + obtain ⟨t,ht,hw⟩ := Finset.mem_biUnion.mp hw + cases t with + | inl k => simp at hw + | inr v => have he := Finset.mem_singleton.mp hw; subst w; exact v.property + obtain ⟨u,hgood,hK₀,hF₀'⟩ := happ K₀ F₀ hF₀ η hη + refine ⟨u,hgood,?_⟩ + intro t ht + cases t with + | inl k => exact hK₀ k.val (Finset.mem_image.mpr ⟨.inl k,ht,rfl⟩) k.property + | inr w => exact hF₀' w.val (Finset.mem_biUnion.mpr ⟨.inr w,ht,by simp⟩) + obtain ⟨u,hgood,hu⟩ := KKFiniteMomentNet.finite_moment_net Good f hfinite + have hH (k : ℤ) (hk : k≠0) : Tendsto (fun j => τ (u j^k).val) atTop (𝓝 0) := hu (.inl ⟨k,hk⟩) + have hC (w : List (ℤ×A)) (hne : w≠[]) (hc : CenteredPowerWord τ B w) : + Tendsto (fun j => τ (powerWord (u j) w)) atTop (𝓝 0) := hu (.inr ⟨w,hne,hc⟩) + exact ⟨u,hgood,hH,hC⟩ + +end + +end KKHaarEndpoints +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CyclicBasis.lean b/lean/OAI/Analysis/FreeWords/CyclicBasis.lean new file mode 100644 index 0000000000000000000000000000000000000000..535e3d7bb6b8f4dc48a4fe83449f84cf6cc36e6a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CyclicBasis.lean @@ -0,0 +1,62 @@ +import Mathlib +import OAI.Analysis.FreeWords.CyclicMatrix +import OAI.Analysis.FreeWords.ProjectionRound + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKFactorSupport KKProjectionSupport + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +variable {G : Type*} [Fintype G] [DecidableEq G] [AddCommGroup G] + +variable (ρ : Matrix G G ℂ →⋆ₐ[ℂ] ConcreteAlgebra M) + +variable (hρ : ∀ a, τ.map (ρ a)=(Fintype.card G : ℂ)⁻¹*Matrix.trace a) + +local instance cyclicBasisPartialOrder : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance cyclicBasisStarOrderedRing : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +include hρ + +theorem shift_orthonormal : Orthonormal ℂ (fun g : G => gnsVector (tracePositive τ) (ρ (shiftMatrix g))) := by + classical + apply orthonormal_iff_ite.mpr + intro g h + rw [gnsVector_inner] + change τ.map (star (ρ (shiftMatrix g))*ρ (shiftMatrix h))=_ + rw [← map_star,← map_mul,shift_star,← shift_add] + by_cases he : g=h + · subst h + rw [neg_add_cancel,shift_zero,map_one,τ.normalized,ite_eq_left rfl] + · rw [ite_eq_right he,hρ,shift_trace _ (by + intro hh + have eqh : h=g := by + calc h = g+(-g+h) := by simp + _ = g := by rw [hh,add_zero] + exact he eqh.symm),mul_zero] + +theorem cyclic_bessel (x : ConcreteAlgebra M) : + ∑ g : G, ‖τ.map (ρ (shiftMatrix g)*x)‖^2 ≤ (traceNorm τ x)^2 := by + have h := (shift_orthonormal τ ρ hρ).comp (Equiv.neg G) (Equiv.neg G).injective + have hh := h.sum_inner_products_le (s:=Finset.univ) (gnsVector (tracePositive τ) x) + simp only [Function.comp_apply,Equiv.neg_apply,gnsVector_inner, + ← map_star,shift_star,neg_neg] at hh + rw [traceNorm_eq_gns] + exact hh + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/CyclicMatrix.lean b/lean/OAI/Analysis/FreeWords/CyclicMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..5fd984231873a60761b3f5b86fb756f7408ccc32 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/CyclicMatrix.lean @@ -0,0 +1,65 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +noncomputable section + +variable {G : Type*} [Fintype G] [DecidableEq G] [AddCommGroup G] + +def shiftMatrix (g : G) : Matrix G G ℂ := (Equiv.addRight g).permMatrix ℂ + +omit [Fintype G] in +@[simp] theorem shift_zero : shiftMatrix (0:G)=1 := by + have h : Equiv.addRight (0:G)=1 := by ext; simp [Equiv.addRight] + simp [shiftMatrix,h] + +@[simp] theorem shift_add (g h : G) : shiftMatrix (g+h)=shiftMatrix g*shiftMatrix h := by + have he : Equiv.addRight (g+h)=(Equiv.addRight h)*(Equiv.addRight g) := by + ext x + simp [Equiv.addRight,add_assoc] + rw [shiftMatrix,he,Matrix.permMatrix_mul] + rfl + +omit [Fintype G] in +@[simp] theorem shift_star (g : G) : star (shiftMatrix g)=shiftMatrix (-g) := by + change ((Equiv.addRight g).permMatrix ℂ).conjTranspose=_ + rw [Matrix.conjTranspose_permMatrix] + congr 1 + ext x + simp [Equiv.addRight] + +def shiftUnitary (g : G) : unitary (Matrix G G ℂ) := + ⟨shiftMatrix g, by + constructor + · rw [shift_star,← shift_add,neg_add_cancel,shift_zero] + · rw [shift_star,← shift_add,add_neg_cancel,shift_zero]⟩ + +@[simp] theorem shiftUnitary_val (g:G) : (shiftUnitary g).val=shiftMatrix g := rfl + +def shiftHom : Multiplicative G →* unitary (Matrix G G ℂ) where + toFun g := shiftUnitary g.toAdd + map_one' := Subtype.ext shift_zero + map_mul' g h := Subtype.ext (shift_add g.toAdd h.toAdd) + +@[simp] theorem shift_zsmul (k : ℤ) (g : G) : shiftUnitary (k • g)=(shiftUnitary g)^k := + (shiftHom : Multiplicative G →* unitary (Matrix G G ℂ)).map_zpow _ _ + +theorem shift_trace (g : G) (hg : g ≠ 0) : Matrix.trace (shiftMatrix g)=0 := by + rw [shiftMatrix,Matrix.trace_permutation] + have hf : Function.fixedPoints (Equiv.addRight g)=∅ := by + ext x + change (x+g=x) ↔ False + simp only [add_eq_left] + exact iff_false_intro hg + rw [hf,Set.ncard_empty,Nat.cast_zero] + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/DenseFreeSequence.lean b/lean/OAI/Analysis/FreeWords/DenseFreeSequence.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e21116c448a4ecdabe454ba332fc21ec41b720f --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/DenseFreeSequence.lean @@ -0,0 +1,44 @@ +import Mathlib +import OAI.Analysis.FreeWords.CenteredMatrixDensity +import OAI.Analysis.FreeWords.CountableFreeLift +import OAI.Analysis.FreeWords.DenseFreeSequenceDefinitions + +namespace OAI + +noncomputable section + +namespace KKFreeLiftFrontier + +open KKTraceTransfer Filter Topology + +noncomputable section + +theorem dense_test_matrix_free_sequence : DenseTestMatrixFreeSequence := by + intro H _ _ _ _ _ M τ hfac hdiff n hn + classical + obtain ⟨a,ha,hb,hd⟩ := centered_matrix_countable_dense M τ n + let Code := {w : List (ℤ × ℕ) // w ≠ [] ∧ ∀ z ∈ w, z.1 ≠ 0} + have : Nonempty Code := ⟨⟨[(1,0)],by simp⟩⟩ + obtain ⟨e,he⟩ := exists_surjective_nat Code + let T (i:ℕ) : List (ℤ × MatrixAlgebra n M) := + (e i).val.map (fun z => (z.1,a z.2)) + have hT (i:ℕ) : IsCenteredTest τ (T i) := by + constructor + · intro hz + exact (e i).property.1 (List.map_eq_nil_iff.mp hz) + · intro z hz + obtain ⟨v,hv,rfl⟩ := List.mem_map.mp hz + exact ⟨(e i).property.2 v hv,ha v.2⟩ + obtain ⟨d,hd',ρ,hρ,U,hU,hH,hM⟩ := + countable_matrix_free_approximation H M τ hfac hdiff n hn T hT + refine ⟨a,ha,hb,hd,d,hd',ρ,hρ,U,hU,hH,?_⟩ + intro w hw hk + obtain ⟨i,hi⟩ := he ⟨w,hw,hk⟩ + simpa only [T,hi] using hM i + +end + +end KKFreeLiftFrontier +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/DenseFreeSequenceDefinitions.lean b/lean/OAI/Analysis/FreeWords/DenseFreeSequenceDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..a6f11e0fe9d1acd1981225779b592e35e58f3970 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/DenseFreeSequenceDefinitions.lean @@ -0,0 +1,35 @@ +import Mathlib +import OAI.Analysis.FreeWords.FiniteFreeDefinitions + +namespace OAI + +noncomputable section + +namespace KKFreeLiftFrontier + +open KKTraceTransfer Filter Topology + +noncomputable section + +def DenseTestMatrixFreeSequence : Prop := + ∀ (H : Type*) [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [TopologicalSpace.SeparableSpace H] [Nontrivial H] (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M), IsFactor M → IsDiffuse M → + ∀ n : ℕ, 0 < n → ∃ a : ℕ → MatrixAlgebra n M, + (∀ j, matrixTrace τ n (a j) = 0) ∧ (∀ j i k, ‖a j i k‖ ≤ 1) ∧ + (∀ x : MatrixAlgebra n M, matrixTrace τ n x = 0 → (∀ i k, ‖x i k‖ ≤ 1) → + ∀ ε : ℝ, 0 < ε → ∃ j, ∀ i k, traceNorm τ (a j i k-x i k) < ε) ∧ + ∃ d : ℕ → ℕ, (∀ j, 0 < d j) ∧ + ∃ ρ : ∀ j, Matrix (Fin (d j)) (Fin (d j)) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M, + (∀ j, Function.Injective (ρ j)) ∧ ∃ U : ℕ → unitary (MatrixAlgebra n M), + (∀ j i k, (U j).val i k ∈ (ρ j).range) ∧ + (∀ k : ℤ, k ≠ 0 → Tendsto (fun j => matrixTrace τ n (U j ^ k).val) atTop (𝓝 0)) ∧ + (∀ w : List (ℤ × ℕ), w ≠ [] → (∀ z ∈ w, z.1 ≠ 0) → + Tendsto (fun j => mixedMoment τ (U j) (w.map fun z => (z.1,a z.2))) atTop (𝓝 0)) + +end + +end KKFreeLiftFrontier +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/DirichletCounts.lean b/lean/OAI/Analysis/FreeWords/DirichletCounts.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d5f4ed1bfa25b4122439066ae4bf7dcdcc69c4f --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/DirichletCounts.lean @@ -0,0 +1,96 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators + +noncomputable section + +def dirichletCount (N k : ℕ) : ℕ := + (((Finset.range N) ×ˢ (Finset.range N)).filter (fun x => x.1+x.2=k)).card + +theorem dirichletCount_low {N k : ℕ} (hk : k < N) : dirichletCount N k = k+1 := by + classical + rw [dirichletCount, ← Finset.card_range (k+1)] + apply Finset.card_bij (fun x _ => x.1) + · intro x hx + simp only [Finset.mem_filter,Finset.mem_product,Finset.mem_range] at hx ⊢ + omega + · intro x hx y hy he + simp only [Finset.mem_filter,Finset.mem_product,Finset.mem_range] at hx hy + apply Prod.ext he + omega + · intro k' hk' + have hk' : k' < k+1 := Finset.mem_range.mp hk' + refine ⟨(k',k-k'), ?_, rfl⟩ + simp only [Finset.mem_filter,Finset.mem_product,Finset.mem_range] + omega + +theorem dirichletCount_reflect {N k : ℕ} (hN : 0 < N) (hk : k ≤ 2*(N-1)) : + dirichletCount N k = dirichletCount N (2*(N-1)-k) := by + classical + unfold dirichletCount + apply Finset.card_bij (fun x _ => (N-1-x.1,N-1-x.2)) + · intro x hx + simp only [Finset.mem_filter,Finset.mem_product,Finset.mem_range] at hx ⊢ + omega + · intro x hx y hy he + simp only [Finset.mem_filter,Finset.mem_product,Finset.mem_range] at hx hy + have h1 := congrArg Prod.fst he + have h2 := congrArg Prod.snd he + apply Prod.ext <;> dsimp at h1 h2 ⊢ <;> omega + · intro x hx + simp only [Finset.mem_filter,Finset.mem_product,Finset.mem_range] at hx + refine ⟨(N-1-x.1,N-1-x.2), ?_, ?_⟩ + · simp only [Finset.mem_filter,Finset.mem_product,Finset.mem_range] + omega + · apply Prod.ext <;> dsimp <;> omega + +theorem dirichletCount_high {N k : ℕ} (hk : k < N-1) : + dirichletCount N (N+k) = N-1-k := by + have hN : 0 < N := by omega + rw [dirichletCount_reflect hN (by omega),dirichletCount_low (by omega)] + omega + +theorem sum_squares_succ_real (N : ℕ) : + ∑ k ∈ Finset.range N, ((k:ℝ)+1)^2 = (N:ℝ)*((N:ℝ)+1)*(2*(N:ℝ)+1)/6 := by + induction N with + | zero => simp + | succ N ih => rw [Finset.sum_range_succ,ih]; push_cast; ring + +theorem dirichletCount_energy {N : ℕ} (hN : 0 < N) : + ∑ k ∈ Finset.range (2*N-1), (dirichletCount N k : ℝ)^2 = + (2*(N:ℝ)^3+(N:ℝ))/3 := by + have hsize : 2*N-1 = N+(N-1) := by omega + rw [hsize, Finset.sum_range_add] + have h1 : ∑ k ∈ Finset.range N, (dirichletCount N k : ℝ)^2 = + (N:ℝ)*((N:ℝ)+1)*(2*(N:ℝ)+1)/6 := by + simp_rw [Finset.sum_congr rfl (fun k hk => congrArg (fun n : ℕ => (n:ℝ)^2) + (dirichletCount_low (Finset.mem_range.mp hk))), Nat.cast_add,Nat.cast_one] + exact sum_squares_succ_real N + have h2 : ∑ k ∈ Finset.range (N-1), (dirichletCount N (N+k) : ℝ)^2 = + ((N:ℝ)-1)*(N:ℝ)*(2*(N:ℝ)-1)/6 := by + have hsum : ∑ k ∈ Finset.range (N-1), (dirichletCount N (N+k) : ℝ)^2 = + ∑ k ∈ Finset.range (N-1), ((k:ℝ)+1)^2 := by + rw [← Finset.sum_range_reflect (fun k => (dirichletCount N (N+k) : ℝ)^2)] + apply Finset.sum_congr rfl + intro k hk + have hk' := Finset.mem_range.mp hk + rw [dirichletCount_high (by omega)] + have he : N-1-(N-1-1-k) = k+1 := by omega + rw [he, Nat.cast_add,Nat.cast_one] + rw [hsum,sum_squares_succ_real,Nat.cast_sub (by omega),Nat.cast_one] + ring + rw [h1,h2] + ring + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/DirichletMoments.lean b/lean/OAI/Analysis/FreeWords/DirichletMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..534b697dcb704e71a54f5fc2b1128ebeec04bdd9 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/DirichletMoments.lean @@ -0,0 +1,159 @@ +import Mathlib +import OAI.Analysis.FreeWords.ConjugateFree +import OAI.Analysis.FreeWords.DirichletCounts + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +def dirichletRow (u : unitary A) (N : ℕ) : A := + (Real.sqrt (N : ℝ))⁻¹ • ∑ r ∈ Finset.range N, upow u (r+1) + +def regularizedScalar (τ : A →ₚ[ℂ] ℂ) (n : ℕ) (p f : A) : ℝ := + let a := p * f^2 * p + (n : ℝ) * (τ (a * star a * + cfc (fun t : ℝ => (Real.sqrt (t + 1/100))⁻¹) (a * star a))).re + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped BigOperators + +noncomputable section + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +omit [StarOrderedRing A] in +theorem positiveMap_real_smul (r : ℝ) (x : A) : τ (r • x) = r • τ x := + τ.toLinearMap.map_smul_of_tower r x + +theorem haar_upow_orthonormal (hτ : FaithfulTracial τ) (u : unitary A) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) : + Orthonormal ℂ (fun k : ℕ => τ.toPreGNS (upow u (k+2))) := by + rw [orthonormal_iff_ite] + intro k l + simp only [PositiveLinearMap.preGNS_inner_def,PositiveLinearMap.ofPreGNS_toPreGNS, + star_upow,← upow_add] + split_ifs with h + · subst l; simp [hτ.1] + · exact hHaar _ (by omega) + +theorem haar_dirichlet_coefficient (hτ : FaithfulTracial τ) (u : unitary A) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) (N k : ℕ) : + inner ℂ (τ.toPreGNS (upow u (k+2))) + (τ.toPreGNS ((∑ r ∈ Finset.range N, upow u (r+1))^2)) = + (dirichletCount N k : ℂ) := by + classical + simp only [PositiveLinearMap.preGNS_inner_def,PositiveLinearMap.ofPreGNS_toPreGNS, + star_upow,pow_two,Finset.sum_mul,Finset.mul_sum,map_sum,← upow_add] + rw [dirichletCount, Finset.natCast_card_filter,Finset.sum_product] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + dsimp + split_ifs with h + · have he : -((k:ℤ)+2)+((j:ℤ)+1+((i:ℤ)+1)) = 0 := by omega + rw [he,upow_zero,hτ.1] + · exact hHaar _ (by omega) + +theorem haar_dirichlet_energy (hτ : FaithfulTracial τ) (u : unitary A) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) {N : ℕ} (hN : 0 < N) : + (2*(N:ℝ)^3+(N:ℝ))/3 ≤ + (τ (((∑ r ∈ Finset.range N, upow u (r+1))^2) * + star ((∑ r ∈ Finset.range N, upow u (r+1))^2))).re := by + have h := (haar_upow_orthonormal hτ u hHaar).sum_inner_products_le + (s := Finset.range (2*N-1)) (τ.toPreGNS ((∑ r ∈ Finset.range N, upow u (r+1))^2)) + simp_rw [haar_dirichlet_coefficient hτ u hHaar,Complex.norm_natCast] at h + rw [dirichletCount_energy hN,← inner_self_eq_norm_sq (𝕜 := ℂ), + PositiveLinearMap.preGNS_inner_def,PositiveLinearMap.ofPreGNS_toPreGNS,hτ.2.1] at h + exact h + +omit [PartialOrder A] [StarOrderedRing A] in +theorem dirichletRow_square (u : unitary A) {N : ℕ} (hN : 0 < N) : + (dirichletRow u N)^2 = (N:ℝ)⁻¹ • (∑ r ∈ Finset.range N, upow u (r+1))^2 := by + have hNr : (0:ℝ) < N := by exact_mod_cast hN + have hs := Real.sq_sqrt hNr.le + have hi : (Real.sqrt (N:ℝ))⁻¹*(Real.sqrt (N:ℝ))⁻¹ = (N:ℝ)⁻¹ := by + rw [← mul_inv, ← pow_two,hs] + simp only [dirichletRow,pow_two,smul_mul_assoc,mul_smul_comm,smul_smul,hi] + +omit [StarOrderedRing A] in +theorem dirichletRow_square_centered (_ : FaithfulTracial τ) (u : unitary A) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) {N : ℕ} (hN : 0 < N) : + τ ((dirichletRow u N)^2) = 0 := by + rw [dirichletRow_square u hN] + simp only [positiveMap_real_smul,pow_two,Finset.sum_mul,Finset.mul_sum,map_sum,← upow_add] + have hz (i j : ℕ) : τ (upow u ((i:ℤ)+1+((j:ℤ)+1))) = 0 := hHaar _ (by omega) + simp only [hz,Finset.sum_const_zero,smul_zero] + +theorem dirichletRow_energy_lower (hτ : FaithfulTracial τ) (u : unitary A) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) {N : ℕ} (hN : 0 < N) : + 2*(N:ℝ)/3 ≤ (τ ((dirichletRow u N)^2*star ((dirichletRow u N)^2))).re := by + have hNr : (0:ℝ) < N := by exact_mod_cast hN + have he := haar_dirichlet_energy hτ u hHaar hN + have hm := mul_le_mul_of_nonneg_left he (sq_nonneg ((N:ℝ)⁻¹)) + rw [dirichletRow_square u hN] + simp only [star_smul,star_trivial,smul_mul_assoc,mul_smul_comm,smul_smul,positiveMap_real_smul, + Complex.real_smul,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,zero_mul,sub_zero] + have hid : (N:ℝ)⁻¹ ^ 2 * ((2*(N:ℝ)^3+(N:ℝ))/3) = + 2*(N:ℝ)/3 + 1/(3*(N:ℝ)) := by + field_simp + rw [hid] at hm + nlinarith [one_div_nonneg.mpr (by positivity : (0:ℝ) ≤ 3*(N:ℝ))] + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/DyadicGrid.lean b/lean/OAI/Analysis/FreeWords/DyadicGrid.lean new file mode 100644 index 0000000000000000000000000000000000000000..76e74af2aafd0d43ad3d855e3d0b0f80233696b6 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/DyadicGrid.lean @@ -0,0 +1,123 @@ +import Mathlib +import OAI.Analysis.FreeWords.ProjectionSubdivision + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +open scoped ComplexOrder + +noncomputable section + +def BitWords : ℕ → Type + | 0 => Unit + | n+1 => BitWords n × Bool + +instance bitWordsFintype (n : ℕ) : Fintype (BitWords n) := by + induction n with + | zero => exact inferInstanceAs (Fintype Unit) + | succ n ih => exact @instFintypeProd _ _ ih inferInstance + +instance bitWordsDecEq (n : ℕ) : DecidableEq (BitWords n) := Classical.decEq _ + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance dyadicGridConcreteOrder (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance dyadicGridConcretePreorder (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance dyadicGridConcreteLE (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance dyadicGridConcreteSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +structure DyadicGrid (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (n : ℕ) where + p : BitWords n → ConcreteAlgebra M + proj : ∀ w, IsStarProjection (p w) + orth : ∀ v w, v≠w → p v*p w=0 + sum : ∑ w, p w=1 + trace : ∀ w, τ.map (p w)=(((1/2:ℝ)^n : ℝ):ℂ) + +def gridZero (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) : DyadicGrid M τ 0 where + p _ := 1 + proj _ := IsStarProjection.one _ + orth v w h := by exact (h (by cases v; cases w; rfl)).elim + sum := by change ∑ _ : Unit, (1:ConcreteAlgebra M)=1; simp + trace w := by simp only [pow_zero,Complex.ofReal_one,τ.normalized] + +theorem grid_refine (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hD : IsDiffuse M) {n : ℕ} (G : DyadicGrid M τ n) : + ∃ G' : DyadicGrid M τ (n+1), ∀ w, + G'.p (w,true)+G'.p (w,false)=G.p w := by + classical + have ht : 0 ≤ (1/2:ℝ)^n := le_of_lt (pow_pos (by norm_num) _) + have hex (w : BitWords n) : ∃ q : ConcreteAlgebra M, IsStarProjection q ∧ q*G.p w=q ∧ + τ.map q=(((1/2:ℝ)^n/2 : ℝ):ℂ) := by + apply projection_with_trace M τ hD (G.p w) (G.proj w) _ (div_nonneg ht (by norm_num)) + rw [G.trace,Complex.ofReal_re] + linarith + choose q hq hqp hτq using hex + have hle (w) : q w ≤ G.p w := ((hq w).le_iff_mul_eq_left (G.proj w)).mpr (hqp w) + let f : BitWords (n+1) → ConcreteAlgebra M := fun w => if w.2 then q w.1 else G.p w.1-q w.1 + have hf (w : BitWords (n+1)) : IsStarProjection (f w) := by + rcases w with ⟨w,b⟩; cases b + · exact ((hq w).le_iff_sub (G.proj w)).mp (hle w) + · exact hq w + have hfp (w : BitWords (n+1)) : f w ≤ G.p w.1 := by + rcases w with ⟨w,b⟩; cases b + · exact sub_le_self _ (hq w).nonneg + · exact hle w + have hff (v w : BitWords (n+1)) (hvw : v≠w) : f v*f w=0 := by + by_cases hfst : v.1=w.1 + · rcases v with ⟨v,b⟩; rcases w with ⟨w,c⟩; dsimp at hfst; subst w + cases b <;> cases c + · exact (hvw rfl).elim + · change (G.p v-q v)*q v=0 + rw [sub_mul,((hq v).le_iff_mul_eq_right (G.proj v)).mp (hle v),(hq v).isIdempotentElem.eq,sub_self] + · change q v*(G.p v-q v)=0 + rw [mul_sub,hqp,(hq v).isIdempotentElem.eq,sub_self] + · exact (hvw rfl).elim + · calc + f v*f w = (f v*G.p v.1)*(G.p w.1*f w) := by + rw [((hf v).le_iff_mul_eq_left (G.proj _)).mp (hfp v),((hf w).le_iff_mul_eq_right (G.proj _)).mp (hfp w)] + _ = f v*(G.p v.1*G.p w.1)*f w := by simp only [mul_assoc] + _ = 0 := by rw [G.orth _ _ hfst,mul_zero,zero_mul] + have hfs (w : BitWords n) : f (w,true)+f (w,false)=G.p w := by dsimp [f]; abel + have hsum : ∑ w, f w=1 := by + change ∑ w : BitWords n × Bool, f w=1 + rw [Fintype.sum_prod_type] + calc + _ = ∑ w, G.p w := Finset.sum_congr rfl fun w _ => (Fintype.sum_bool _).trans (hfs w) + _ = 1 := G.sum + have hfτ (w : BitWords (n+1)) : τ.map (f w)=(((1/2:ℝ)^(n+1):ℝ):ℂ) := by + rcases w with ⟨w,b⟩ + have hr : (1/2:ℝ)^(n+1)=(1/2:ℝ)^n/2 := by rw [pow_succ]; ring + rw [hr] + cases b + · change τ.map (G.p w-q w)=_ + rw [map_sub,G.trace,hτq] + push_cast + ring + · exact hτq w + exact ⟨⟨f,hf,hff,hsum,hfτ⟩,hfs⟩ + +def dyadicGrid (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (hD : IsDiffuse M) : + (n : ℕ) → DyadicGrid M τ n + | 0 => gridZero M τ + | n+1 => (grid_refine M τ hD (dyadicGrid M τ hD n)).choose + +theorem dyadicGrid_refine (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hD : IsDiffuse M) (n : ℕ) (w : BitWords n) : + (dyadicGrid M τ hD (n+1)).p (w,true)+(dyadicGrid M τ hD (n+1)).p (w,false)= + (dyadicGrid M τ hD n).p w := + (grid_refine M τ hD (dyadicGrid M τ hD n)).choose_spec w + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/DyadicPhases.lean b/lean/OAI/Analysis/FreeWords/DyadicPhases.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa5995cdeb734c38fb3a4eebae8e7e2479efe1c2 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/DyadicPhases.lean @@ -0,0 +1,117 @@ +import Mathlib +import OAI.Analysis.FreeWords.DyadicGrid + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance dyadicPhasesPartialOrder (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance dyadicPhasesPreorder (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance dyadicPhasesLE (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance dyadicPhasesStarOrderedRing (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +noncomputable section + +def dyadicRoot (n : ℕ) : ℂ := Complex.exp (2*Real.pi*Complex.I/(2:ℂ)^n) + +@[simp] theorem dyadicRoot_zero : dyadicRoot 0=1 := by + simp only [dyadicRoot,pow_zero,div_one,Complex.exp_two_pi_mul_I] + +theorem dyadicRoot_norm (n : ℕ) : ‖dyadicRoot n‖=1 := by + have he : 2*Real.pi*Complex.I/(2:ℂ)^n=Complex.I*((2*Real.pi/(2:ℝ)^n:ℝ):ℂ) := by push_cast; ring + rw [dyadicRoot,he,Complex.norm_exp] + simp only [Complex.mul_re,Complex.I_re,Complex.I_im,Complex.ofReal_re, + Complex.ofReal_im,mul_zero,zero_mul,sub_self,Real.exp_zero] + +theorem dyadicRoot_square (n : ℕ) : dyadicRoot (n+1)^2=dyadicRoot n := by + rw [dyadicRoot,dyadicRoot,← Complex.exp_nat_mul] + congr 1 + push_cast + rw [pow_succ] + field_simp + +theorem dyadicRoot_sub_one (n : ℕ) : ‖dyadicRoot n-1‖ ≤ 2*Real.pi/(2:ℝ)^n := by + have he : 2*Real.pi*Complex.I/(2:ℂ)^n=Complex.I*((2*Real.pi/(2:ℝ)^n:ℝ):ℂ) := by push_cast; ring + rw [dyadicRoot,he] + exact (Real.norm_exp_I_mul_ofReal_sub_one_le).trans (by + rw [Real.norm_eq_abs,abs_of_nonneg (by positivity)]) + +theorem dyadicRoot_pow_ne_one (n k : ℕ) (hk : 0 < k) (hkn : k < 2^n) : + dyadicRoot n^k≠1 := by + rw [dyadicRoot,← Complex.exp_nat_mul] + have he : (k:ℂ)*(2*Real.pi*Complex.I/(2:ℂ)^n)=2*Real.pi*Complex.I*k/(2^n:ℕ) := by push_cast; ring + rw [he,ne_eq,Complex.exp_two_pi_mul_I_mul_div_eq_one_iff (by positivity)] + exact Nat.not_dvd_of_pos_of_lt hk hkn + +def dyadicPhase : (n : ℕ) → BitWords n → ℂ + | 0, _ => 1 + | n+1, w => dyadicPhase n w.1 * if w.2 then dyadicRoot (n+1) else 1 + +theorem dyadicPhase_norm (n : ℕ) (w : BitWords n) : ‖dyadicPhase n w‖=1 := by + induction n with + | zero => simp [dyadicPhase] + | succ n ih => + rcases w with ⟨w,b⟩; cases b <;> simp only [dyadicPhase,Bool.false_eq_true,ite_false, + ite_true,mul_one,norm_mul,ih,dyadicRoot_norm] + +def phaseMoment (n k : ℕ) : ℂ := (1/2:ℂ)^n * ∑ w, dyadicPhase n w^k + +@[simp] theorem phaseMoment_zero (k : ℕ) : phaseMoment 0 k=1 := by + change (1/2:ℂ)^0 * ∑ _ : Unit, (1:ℂ)^k=1 + simp + +theorem phaseMoment_succ (n k : ℕ) : + phaseMoment (n+1) k=(1+dyadicRoot (n+1)^k)/2*phaseMoment n k := by + change (1/2:ℂ)^(n+1) * (∑ w : BitWords n × Bool, dyadicPhase (n+1) w ^ k)=_ + simp only [Fintype.sum_prod_type,Fintype.sum_bool,dyadicPhase,Bool.false_eq_true,ite_true,ite_false, + mul_pow,mul_one,one_pow] + simp only [Finset.sum_add_distrib,← Finset.sum_mul,phaseMoment,pow_succ] + ring + +theorem phaseMoment_annihilation (n k : ℕ) : + (1-dyadicRoot n^k)*phaseMoment n k=0 := by + induction n with + | zero => simp + | succ n ih => + rw [phaseMoment_succ] + have hs : (dyadicRoot (n+1)^k)^2=dyadicRoot n^k := by + rw [← pow_mul,mul_comm k 2,pow_mul,dyadicRoot_square] + calc + (1-dyadicRoot (n+1)^k)*((1+dyadicRoot (n+1)^k)/2*phaseMoment n k) = + (1-(dyadicRoot (n+1)^k)^2)*phaseMoment n k/2 := by ring + _ = 0 := by rw [hs,ih,zero_div] + +theorem phaseMoment_eq_zero (n k : ℕ) (hk : 0 < k) (hkn : k < 2^n) : + phaseMoment n k=0 := + (mul_eq_zero.mp (phaseMoment_annihilation n k)).resolve_left + (sub_ne_zero.mpr (Ne.symm (dyadicRoot_pow_ne_one n k hk hkn))) + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/EntryWords.lean b/lean/OAI/Analysis/FreeWords/EntryWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..75b89850c3cc3155793db0c1633f84c3deda62de --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/EntryWords.lean @@ -0,0 +1,94 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKRelativeMatrix + +noncomputable section + +variable {A : Type*} {n : ℕ} + +def entryWords (s : List (ℤ × Matrix (Fin n) (Fin n) A)) (i j : Fin n) : List (List (ℤ × A)) := + match s with + | [] => if i=j then [[]] else [] + | z::t => (List.finRange n).flatMap fun k => (entryWords t k j).map fun v => (z.1,z.2 i k)::v + +theorem entryWords_length {s : List (ℤ × Matrix (Fin n) (Fin n) A)} {i j : Fin n} + {v : List (ℤ × A)} (hv : v∈entryWords s i j) : v.length=s.length := by + induction s generalizing i j v with + | nil => + simp only [entryWords] at hv + split_ifs at hv with h + · simp only [List.mem_singleton] at hv + subst v + rfl + · simp at hv + | cons z s ih => + obtain ⟨k,_,hk⟩ := List.mem_flatMap.mp hv + obtain ⟨v,hv0,rfl⟩ := List.mem_map.mp hk + simp only [List.length_cons,ih hv0] + +theorem entryWords_letters {s : List (ℤ × Matrix (Fin n) (Fin n) A)} {i j : Fin n} + {v : List (ℤ × A)} (hv : v∈entryWords s i j) : + ∀ y∈v, ∃ z∈s, ∃ a b : Fin n, y=(z.1,z.2 a b) := by + induction s generalizing i j v with + | nil => + have h := entryWords_length hv + have he : v=[] := List.eq_nil_of_length_eq_zero h + simp [he] + | cons z s ih => + obtain ⟨k,_,hk⟩ := List.mem_flatMap.mp hv + obtain ⟨v,hv0,rfl⟩ := List.mem_map.mp hk + intro y hy + rcases List.mem_cons.mp hy with rfl | hy + · exact ⟨z,List.mem_cons_self,i,k,rfl⟩ + · obtain ⟨z,hz,a,b,hy⟩ := ih hv0 y hy + exact ⟨z,List.mem_cons_of_mem _ hz,a,b,hy⟩ + +theorem sum_map_flatMap {α β C : Type*} [AddMonoid C] + (l : List α) (f : α → List β) (g : β → C) : + ((l.flatMap f).map g).sum=(l.map fun a => ((f a).map g).sum).sum := by + induction l with + | nil => rfl + | cons a l ih => simp only [List.flatMap_cons,List.map_append,List.sum_append, + List.map_cons,List.sum_cons,ih] + +def scalarWord [Monoid A] (u : ℤ → A) (s : List (ℤ × A)) : A := + (s.map (fun z => u z.1*z.2)).prod + +@[simp] theorem scalarWord_cons [Monoid A] (u : ℤ → A) (z : ℤ × A) (s) : + scalarWord u (z::s)=u z.1*z.2*scalarWord u s := rfl + +def matrixWord [Semiring A] (u : ℤ → A) (s : List (ℤ × Matrix (Fin n) (Fin n) A)) : + Matrix (Fin n) (Fin n) A := + (s.map (fun z => Matrix.diagonal (fun _ : Fin n => u z.1)*z.2)).prod + +theorem entryWords_sum [Semiring A] (u : ℤ → A) + (s : List (ℤ × Matrix (Fin n) (Fin n) A)) (i j : Fin n) : + matrixWord u s i j=((entryWords s i j).map (scalarWord u)).sum := by + induction s generalizing i j with + | nil => + simp only [matrixWord,List.map_nil,List.prod_nil,Matrix.one_apply,entryWords] + split_ifs <;> simp [scalarWord] + | cons z s ih => + change ((Matrix.diagonal (fun _ : Fin n => u z.1)*z.2)*matrixWord u s) i j = _ + rw [Matrix.mul_apply] + simp only [Matrix.diagonal_mul,ih,entryWords,sum_map_flatMap,List.map_map, + Function.comp_def,scalarWord_cons,List.sum_map_mul_left] + rw [← List.ofFn_eq_map,List.sum_ofFn] + +theorem norm_list_sum_le {C : Type*} [SeminormedAddCommGroup C] (l : List C) : + ‖l.sum‖≤(l.map norm).sum := by + induction l with + | nil => simp + | cons a l ih => + simpa only [List.sum_cons,List.map_cons] using (norm_add_le a l.sum).trans (add_le_add le_rfl ih) + +end + +end KKRelativeMatrix +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ExponentialUnitaryApprox.lean b/lean/OAI/Analysis/FreeWords/ExponentialUnitaryApprox.lean new file mode 100644 index 0000000000000000000000000000000000000000..11d5190145eff2e7958b13944f22ae88c74ca1d5 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ExponentialUnitaryApprox.lean @@ -0,0 +1,61 @@ +import Mathlib +import OAI.Analysis.FreeWords.UnitaryFiniteSpectrum + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKSpectralSupport KKProjectionSupport + +open scoped CStarAlgebra + +noncomputable section + +variable {A B : Type*} [CStarAlgebra A] [CStarAlgebra B] + +local instance exponentialUnitaryApproxSourceNormedAlgebra : NormedAlgebra ℚ A := + NormedAlgebra.restrictScalars ℚ ℂ A + +local instance exponentialUnitaryApproxTargetNormedAlgebra : NormedAlgebra ℚ B := + NormedAlgebra.restrictScalars ℚ ℂ B + +theorem map_expUnitary (φ : A →⋆ₐ[ℂ] B) (a : selfAdjoint A) : + φ ((selfAdjoint.expUnitary a).val) = (selfAdjoint.expUnitary (⟨φ a.val,a.property.map φ⟩ : selfAdjoint B)).val := by + simp only [selfAdjoint.expUnitary_coe] + rw [NormedSpace.map_exp φ (map_continuous φ),map_smul] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem unitary_exponential_approximation (M : VonNeumannAlgebra H) + (u : unitary (ConcreteAlgebra M)) (ε : ℝ) (hε : 0<ε) : + ∃ a : selfAdjoint (ConcreteAlgebra M), ‖u.val-(selfAdjoint.expUnitary a).val‖<ε := by + classical + let : NormedAlgebra ℚ (ConcreteAlgebra M) := NormedAlgebra.restrictScalars ℚ ℂ _ + obtain ⟨m,n,p,c,hp,ho,h1,hc,he⟩ := unitary_finite_spectrum_approximation M u ε hε + let φ := partitionHom p hp ho h1 + let b : (Fin m × Fin n → ℂ) := fun i => ((c i).arg:ℂ) + have hb : IsSelfAdjoint b := by + funext i + exact Complex.conj_ofReal _ + let a : selfAdjoint (ConcreteAlgebra M) := ⟨φ b,hb.map φ⟩ + refine ⟨a,?_⟩ + have hexp : NormedSpace.exp (Complex.I • b)=c := by + funext i + rw [Pi.coe_exp,← Complex.exp_eq_exp_ℂ] + change Complex.exp (Complex.I*((c i).arg:ℂ))=c i + have hh := Complex.norm_mul_exp_arg_mul_I (c i) + simpa only [hc i,Complex.ofReal_one,one_mul,mul_comm,mul_one] using hh + have heq : (selfAdjoint.expUnitary a).val=∑ i, c i•p i := by + change NormedSpace.exp (Complex.I • φ b)=_ + rw [← map_smul,← NormedSpace.map_exp φ (map_continuous φ),hexp] + rfl + rwa [heq] + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FactorBase.lean b/lean/OAI/Analysis/FreeWords/FactorBase.lean new file mode 100644 index 0000000000000000000000000000000000000000..aaf9f926222da2d72bed5c55f336a6d724a0e7f1 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FactorBase.lean @@ -0,0 +1,293 @@ +import Mathlib +import OAI.Analysis.FreeWords.TraceTransferDefinitions +import OAI.Analysis.FreeWords.UltraTrace +import OAI.Analysis.FreeWords.WeakMeanAlgebra + +namespace OAI + +noncomputable section + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +namespace UniversalStrongKK + +section OperatorMean + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +variable (m : ScalarMean G) + +variable [CompleteSpace H] + +end OperatorMean + +end UniversalStrongKK + +open scoped Topology + +namespace UniversalStrongKK + +section UltraMean + +variable {I : Type*} [TopologicalSpace I] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UltraMean + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped InnerProductSpace + +open Filter Topology + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UniversalStrongKK + +namespace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKTraceTransfer + +namespace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKTraceTransfer + +namespace UniversalStrongKK + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +section OperatorMeanAlgebra + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable (m : ScalarMean G) + +end OperatorMeanAlgebra + +end UniversalStrongKK + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace.seqOrder + +attribute [local instance] KKUltraTrace.seqSOR + +open scoped InnerProductSpace + +end + +end KKUltraTrace + +namespace KKTraceTransfer + +open scoped BoundedContinuousFunction ComplexOrder InnerProductSpace + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +instance concreteClosed (M : VonNeumannAlgebra H) : + IsClosed (M.toStarSubalgebra : Set (H →L[ℂ] H)) := by + rw [VonNeumannAlgebra.coe_toStarSubalgebra, ← M.centralizer_centralizer] + exact Set.isClosed_centralizer _ + +@[instance_reducible] def concreteOrder (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := + CStarAlgebra.spectralOrder _ + +attribute [local instance] KKTraceTransfer.concreteOrder + +@[instance_reducible] def concreteLE (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := + (concreteOrder M).toLE + +attribute [local instance] KKTraceTransfer.concreteLE + +@[instance_reducible] def concretePreorder (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := + (concreteOrder M).toPreorder + +attribute [local instance] KKTraceTransfer.concretePreorder + +theorem concreteSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := + CStarAlgebra.spectralOrderedRing _ + +attribute [local instance] KKTraceTransfer.concreteSOR + +@[instance_reducible] def seqOrder (M : VonNeumannAlgebra H) : PartialOrder (ℕ →ᵇ ConcreteAlgebra M) := + CStarAlgebra.spectralOrder _ + +attribute [local instance] KKTraceTransfer.seqOrder + +@[instance_reducible] def seqLE (M : VonNeumannAlgebra H) : LE (ℕ →ᵇ ConcreteAlgebra M) := + (seqOrder M).toLE + +attribute [local instance] KKTraceTransfer.seqLE + +@[instance_reducible] def seqPreorder (M : VonNeumannAlgebra H) : Preorder (ℕ →ᵇ ConcreteAlgebra M) := + (seqOrder M).toPreorder + +attribute [local instance] KKTraceTransfer.seqPreorder + +theorem seqSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ℕ →ᵇ ConcreteAlgebra M) := + CStarAlgebra.spectralOrderedRing _ + +attribute [local instance] KKTraceTransfer.seqSOR + +def tracePositive {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) : + ConcreteAlgebra M →ₚ[ℂ] ℂ where + toLinearMap := τ.map + monotone' x y h := by + apply sub_nonneg.mp + change 0 ≤ τ.map y - τ.map x + rw [← map_sub] + apply τ.positive + obtain ⟨v, hv⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp (sub_nonneg.mpr h) + rw [hv] + exact ContinuousLinearMap.isPositive_adjoint_comp_self (v : H →L[ℂ] H) + +end + +end KKTraceTransfer + +namespace KKTraceTransfer + +open scoped BoundedContinuousFunction ComplexOrder InnerProductSpace + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance factorBaseConcreteOrder (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := + concreteOrder M + +local instance factorBaseConcretePreorder (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := + (concreteOrder M).toPreorder + +local instance factorBaseConcreteLE (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := + (concreteOrder M).toLE + +local instance factorBaseConcreteSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := + concreteSOR M + +def operatorSequence (M : VonNeumannAlgebra H) : + (ℕ →ᵇ ConcreteAlgebra M) →ₗ[ℂ] (ℕ →ᵇ (H →L[ℂ] H)) where + toFun x := BoundedContinuousFunction.ofNormedAddCommGroup + (fun j => (x j : H →L[ℂ] H)) continuous_of_discreteTopology ‖x‖ + (fun j => x.norm_coe_le_norm j) + map_add' x y := by ext j; rfl + map_smul' c x := by ext j; rfl + +@[simp] theorem operatorSequence_apply {M : VonNeumannAlgebra H} + (x : ℕ →ᵇ ConcreteAlgebra M) (j : ℕ) : operatorSequence M x j = (x j : H →L[ℂ] H) := rfl + +theorem norm_operatorSequence_le {M : VonNeumannAlgebra H} (x : ℕ →ᵇ ConcreteAlgebra M) : + ‖operatorSequence M x‖ ≤ ‖x‖ := by + exact (BoundedContinuousFunction.norm_le (norm_nonneg x)).mpr fun j => x.norm_coe_le_norm j + +def sequenceMean (M : VonNeumannAlgebra H) (ω : Ultrafilter ℕ) : + (ℕ →ᵇ ConcreteAlgebra M) →ₗ[ℂ] ConcreteAlgebra M where + toFun x := ⟨UniversalStrongKK.operatorMean (UniversalStrongKK.ultrafilterMean ω) + (operatorSequence M x), UniversalStrongKK.mem_of_wot_tendsto M + (UniversalStrongKK.tendsto_operatorMean ω (operatorSequence M x)) + (Filter.Eventually.of_forall fun j => (x j).property)⟩ + map_add' x y := by + apply Subtype.ext + exact congrArg (UniversalStrongKK.operatorMean (UniversalStrongKK.ultrafilterMean ω)) + (map_add (operatorSequence M) x y) |>.trans + (UniversalStrongKK.operatorMean_add _ _ _) + map_smul' c x := by + apply Subtype.ext + exact congrArg (UniversalStrongKK.operatorMean (UniversalStrongKK.ultrafilterMean ω)) + (map_smul (operatorSequence M) c x) |>.trans + (UniversalStrongKK.operatorMean_smul _ _ _) + +theorem norm_sequenceMean_le {M : VonNeumannAlgebra H} (ω : Ultrafilter ℕ) + (x : ℕ →ᵇ ConcreteAlgebra M) : ‖sequenceMean M ω x‖ ≤ ‖x‖ := + (UniversalStrongKK.norm_operatorMean_le _ _).trans (norm_operatorSequence_le x) + +theorem tendsto_sequenceMean {M : VonNeumannAlgebra H} (ω : Ultrafilter ℕ) + (x : ℕ →ᵇ ConcreteAlgebra M) : + Tendsto (fun j => ContinuousLinearMapWOT.ofCLM (x j : H →L[ℂ] H)) (ω : Filter ℕ) + (𝓝 (ContinuousLinearMapWOT.ofCLM (sequenceMean M ω x : H →L[ℂ] H))) := + UniversalStrongKK.tendsto_operatorMean ω (operatorSequence M x) + +theorem trace_sequenceMean {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (ω : Ultrafilter ℕ) (x : ℕ →ᵇ ConcreteAlgebra M) : + τ.map (sequenceMean M ω x) = KKUltraTrace.ultraTrace (tracePositive τ) ω x := by + let Aw : WeakAlgebra M := ⟨ContinuousLinearMapWOT.ofCLM (sequenceMean M ω x), + (sequenceMean M ω x).property⟩ + let Tw : ℕ → WeakAlgebra M := fun j => ⟨ContinuousLinearMapWOT.ofCLM (x j), (x j).property⟩ + have ht : Tendsto Tw (ω : Filter ℕ) (𝓝 Aw) := + tendsto_subtype_rng.mpr (tendsto_sequenceMean ω x) + have ht' : Tendsto Tw (ω : Filter ℕ) + (𝓝[{T : WeakAlgebra M | ‖T.val.toCLM‖ ≤ ‖x‖}] Aw) := + tendsto_nhdsWithin_iff.mpr ⟨ht, Filter.Eventually.of_forall x.norm_coe_le_norm⟩ + have hτ := (τ.normal ‖x‖ Aw (norm_sequenceMean_le ω x)).tendsto.comp ht' + exact tendsto_nhds_unique hτ (KKUltraTrace.tendsto_ultraTraceValue (tracePositive τ) ω x) + +theorem sequenceMean_const {M : VonNeumannAlgebra H} (ω : Ultrafilter ℕ) + (a : ConcreteAlgebra M) : sequenceMean M ω (BoundedContinuousFunction.const ℕ a) = a := by + apply Subtype.ext + change UniversalStrongKK.operatorMean (UniversalStrongKK.ultrafilterMean ω) + (operatorSequence M (BoundedContinuousFunction.const ℕ a)) = (a : H →L[ℂ] H) + rw [show operatorSequence M (BoundedContinuousFunction.const ℕ a) = + BoundedContinuousFunction.const ℕ (a : H →L[ℂ] H) by ext; rfl] + exact UniversalStrongKK.operatorMean_const _ _ + +theorem sequenceMean_bimodule {M : VonNeumannAlgebra H} (ω : Ultrafilter ℕ) + (a b : ConcreteAlgebra M) (x : ℕ →ᵇ ConcreteAlgebra M) : + sequenceMean M ω (BoundedContinuousFunction.const ℕ a * x * + BoundedContinuousFunction.const ℕ b) = a * sequenceMean M ω x * b := by + apply Subtype.ext + change UniversalStrongKK.operatorMean (UniversalStrongKK.ultrafilterMean ω) + (operatorSequence M (BoundedContinuousFunction.const ℕ a * x * + BoundedContinuousFunction.const ℕ b)) = + (a : H →L[ℂ] H) * UniversalStrongKK.operatorMean (UniversalStrongKK.ultrafilterMean ω) + (operatorSequence M x) * (b : H →L[ℂ] H) + rw [show operatorSequence M (BoundedContinuousFunction.const ℕ a * x * + BoundedContinuousFunction.const ℕ b) = + BoundedContinuousFunction.const ℕ (a : H →L[ℂ] H) * operatorSequence M x * + BoundedContinuousFunction.const ℕ (b : H →L[ℂ] H) by ext; rfl] + exact UniversalStrongKK.operatorMean_bimodule _ _ _ _ + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FactorCorners.lean b/lean/OAI/Analysis/FreeWords/FactorCorners.lean new file mode 100644 index 0000000000000000000000000000000000000000..8377359d66374a1039eb1daefc269f2024f65e7c --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FactorCorners.lean @@ -0,0 +1,66 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorStructure + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem trace_projection_ne_zero {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) {p : ConcreteAlgebra M} + (hp : IsStarProjection p) (hp0 : p ≠ 0) : τ.map p ≠ 0 := by + intro hτ + apply hp0 + apply τ.faithful p _ hτ + have he : star p*p=p := by rw [hp.isSelfAdjoint.star_eq, hp.isIdempotentElem.eq] + have he' : star (p : H →L[ℂ] H)*(p : H →L[ℂ] H) = p := congrArg Subtype.val he + rw [← he'] + exact ContinuousLinearMap.isPositive_adjoint_comp_self _ + +theorem factor_nonzero_corner {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (hM : KKFreeLiftFrontier.IsFactor M) {p q : ConcreteAlgebra M} + (hp : IsStarProjection p) (hp0 : p ≠ 0) (hq0 : q ≠ 0) : + ∃ a : ConcreteAlgebra M, q*a*p ≠ 0 := by + by_contra! hz + let T : (tracePositive τ).GNS →L[ℂ] (tracePositive τ).GNS := + (tracePositive τ).gnsStarAlgHom q + have ho : conjugacyOrbit τ p ⊆ {v | T v=0} := by + rintro _ ⟨u,rfl⟩ + change (tracePositive τ).gnsStarAlgHom q (gnsVector (tracePositive τ) + ((u : ConcreteAlgebra M)*p*star (u : ConcreteAlgebra M))) = 0 + rw [gnsStarAlgHom_vector] + have he : q*((u : ConcreteAlgebra M)*p*star (u : ConcreteAlgebra M))=0 := by + rw [← mul_assoc, ← mul_assoc, hz, zero_mul] + rw [he, map_zero] + have hh : conjugacyHull τ p ⊆ {v | T v=0} := by + apply closure_minimal (convexHull_min ho ?_) (isClosed_eq T.continuous continuous_const) + exact (T.restrictScalars ℝ).ker.convex + have he := hh (factor_trace_in_conjugacyHull τ hM p) + change (tracePositive τ).gnsStarAlgHom q (gnsVector (tracePositive τ) (τ.map p • 1))=0 at he + rw [gnsStarAlgHom_vector, mul_smul_comm, mul_one] at he + have hzero : τ.map p • q=0 := gnsVector_injective τ (he.trans (map_zero _).symm) + exact hq0 ((smul_eq_zero.mp hzero).resolve_left (trace_projection_ne_zero τ hp hp0)) + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FactorDiffuseCriterion.lean b/lean/OAI/Analysis/FreeWords/FactorDiffuseCriterion.lean new file mode 100644 index 0000000000000000000000000000000000000000..55951b0efec0c6fc93828192867099542800d758 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FactorDiffuseCriterion.lean @@ -0,0 +1,70 @@ +import Mathlib +import OAI.Analysis.FreeWords.ProjectionSmall +import OAI.Analysis.FreeWords.ProjectionStructure + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKFreeLiftFrontier KKProjectionSupport + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem factor_diffuse_of_small_projections (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M) (hF : IsFactor M) + (hsmall : ∀ ε : ℝ, 0<ε → ∃ p : ConcreteAlgebra M, + IsStarProjection p ∧ 0<(τ.map p).re ∧ (τ.map p).re<ε) : IsDiffuse M := by + intro q hq hq0 + obtain ⟨p,hp,hp0,hpq⟩ := hsmall (τ.map q).re (trace_projection_pos τ hq hq0) + obtain ⟨v,hv,hvp,hqv,he⟩ := projection_comparable_by_trace M τ hF p q hp hq + have hpi := initial_bound hp hvp + have hqi := final_bound hq hqv + have htr : τ.map (star v*v)=τ.map (v*star v) := τ.tracial _ _ + have hle : (τ.map (star v*v)).re≤(τ.map p).re := by + have hn := (Complex.nonneg_iff.mp (trace_projection_nonneg τ + (projection_sub hp (partial_initial hv) hpi.1))).1 + simpa only [map_sub,Complex.sub_re,sub_nonneg] using hn + have he' : star v*v=p := by + rcases he with he | he + · exact he + · rw [he] at htr + rw [htr] at hle + exact False.elim (not_le.mpr hpq hle) + refine ⟨v*star v,partial_final hv,?_,?_,hqi.1⟩ + · intro hz + rw [he',hz,map_zero] at htr + rw [htr,Complex.zero_re] at hp0 + exact lt_irrefl 0 hp0 + · intro heq + rw [he',heq] at htr + rw [htr] at hpq + exact lt_irrefl _ hpq + +theorem factor_diffuse_of_dyadic_projections (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M) (hF : IsFactor M) + (hproj : ∀ m : ℕ, ∃ p : ConcreteAlgebra M, IsStarProjection p ∧ + τ.map p=(((2:ℝ)^m)⁻¹:ℝ)) : IsDiffuse M := by + apply factor_diffuse_of_small_projections M τ hF + intro ε hε + have ht : Filter.Tendsto (fun m : ℕ => 1/(2:ℝ)^m) Filter.atTop (nhds 0) := + tendsto_const_nhds.div_atTop (tendsto_pow_atTop_atTop_of_one_lt (by norm_num)) + obtain ⟨m,hm⟩ := (ht.eventually (eventually_lt_nhds hε)).exists + obtain ⟨p,hp,hpτ⟩ := hproj m + refine ⟨p,hp,?_,?_⟩ + · rw [hpτ,Complex.ofReal_re] + positivity + · rw [hpτ,Complex.ofReal_re] + simpa only [one_div] using hm + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FactorHullGeneric.lean b/lean/OAI/Analysis/FreeWords/FactorHullGeneric.lean new file mode 100644 index 0000000000000000000000000000000000000000..6388c80e4457fb60be2157c13bba231294d94595 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FactorHullGeneric.lean @@ -0,0 +1,49 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped InnerProductSpace + +noncomputable section + +theorem norm_minimizer_unique {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] + {K : Set F} (hK : Convex ℝ K) {a b : F} (ha : a ∈ K) (hb : b ∈ K) + (hmin : ‖(0 : F) - a‖ = ⨅ z : K, ‖(0 : F) - z‖) (hn : ‖b‖ = ‖a‖) : a = b := by + have hbmin : ‖(0 : F) - b‖ = ⨅ z : K, ‖(0 : F) - z‖ := by + simpa only [zero_sub, norm_neg, hn] using hmin + have h₁ := (norm_eq_iInf_iff_real_inner_le_zero hK ha).mp hmin b hb + have h₂ := (norm_eq_iInf_iff_real_inner_le_zero hK hb).mp hbmin a ha + simp only [zero_sub, inner_neg_left, inner_sub_right] at h₁ h₂ + have hz : ⟪a-b,a-b⟫_ℝ ≤ 0 := by + simp only [inner_sub_left, inner_sub_right] + linarith + rw [real_inner_self_eq_norm_sq] at hz + apply eq_of_norm_sub_eq_zero + nlinarith [norm_nonneg (a-b)] + +theorem mapsTo_hull {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + (f : F →L[ℝ] F) {S : Set F} (hf : Set.MapsTo f S S) : + Set.MapsTo f (closure (convexHull ℝ S)) (closure (convexHull ℝ S)) := by + apply Set.MapsTo.closure _ f.continuous + intro x hx + have hh : f x ∈ f '' convexHull ℝ S := ⟨x, hx, rfl⟩ + rw [show f '' convexHull ℝ S = convexHull ℝ (f '' S) from + f.toLinearMap.image_convexHull S] at hh + exact convexHull_mono hf.image_subset hh + +theorem commute_all_of_unitary {A : Type*} [CStarAlgebra A] (a : A) + (ha : ∀ u : unitary A, Commute a (u : A)) : ∀ b, Commute a b := by + intro b + have hb : b ∈ Submodule.span ℂ (unitary A : Set A) := by + rw [CStarAlgebra.span_unitary]; trivial + induction hb using Submodule.span_induction with + | mem y hy => exact ha ⟨y,hy⟩ + | zero => exact Commute.zero_right _ + | add x y hx hy hx' hy' => exact hx'.add_right hy' + | smul c x hx hx' => exact hx'.smul_right c +end +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FactorStructure.lean b/lean/OAI/Analysis/FreeWords/FactorStructure.lean new file mode 100644 index 0000000000000000000000000000000000000000..f09d1b7a73d38ed2ea05041df98045c4d8d75411 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FactorStructure.lean @@ -0,0 +1,365 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorBase +import OAI.Analysis.FreeWords.FactorHullGeneric + +namespace OAI + +noncomputable section + +namespace KKFactorSupport + +open KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +def algebraConj (u : unitary A) : A →ₗ[ℂ] A where + toFun x := (u : A) * x * star (u : A) + map_add' x y := by simp only [mul_add, add_mul] + map_smul' c x := by simp only [mul_smul_comm, smul_mul_assoc, RingHom.id_apply] + +omit [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem algebraConj_apply (u : unitary A) (x : A) : + algebraConj u x = (u : A) * x * star (u : A) := rfl + +omit [StarOrderedRing A] in +theorem trace_algebraConj (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y) = τ (y*x)) (u : unitary A) (x : A) : + τ (algebraConj u x) = τ x := by + change τ ((u : A) * x * star (u : A)) = τ x + rw [htr, ← mul_assoc, Unitary.coe_star_mul_self, one_mul] + +omit [PartialOrder A] [StarOrderedRing A] in +theorem star_conj_mul_conj (u : unitary A) (x : A) : + star (algebraConj u x) * algebraConj u x = algebraConj u (star x * x) := by + simp only [algebraConj_apply, star_mul, star_star] + calc + (u : A) * (star x * star (u : A)) * ((u : A) * x * star (u : A)) = + (u : A) * star x * (star (u : A) * (u : A)) * x * star (u : A) := by + simp only [mul_assoc] + _ = (u : A) * (star x * x) * star (u : A) := by + rw [Unitary.coe_star_mul_self, mul_one] + simp only [mul_assoc] + +theorem preGNS_conj_norm (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y) = τ (y*x)) (u : unitary A) (x : A) : + ‖τ.toPreGNS (algebraConj u x)‖ = ‖τ.toPreGNS x‖ := by + change Real.sqrt (τ (star (algebraConj u x) * algebraConj u x)).re = + Real.sqrt (τ (star x * x)).re + rw [star_conj_mul_conj, trace_algebraConj τ htr] + +def preGNSConj (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y) = τ (y*x)) (u : unitary A) : τ.PreGNS →L[ℂ] τ.PreGNS := + ((τ.toPreGNS.toLinearMap.comp (algebraConj u)).comp τ.ofPreGNS.toLinearMap).mkContinuous 1 + (fun x => by simpa only [LinearMap.comp_apply, LinearEquiv.coe_coe, one_mul, + preGNS_conj_norm τ htr u, PositiveLinearMap.toPreGNS_ofPreGNS] using le_refl ‖x‖) + +def gnsConj (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y) = τ (y*x)) (u : unitary A) : τ.GNS →L[ℂ] τ.GNS := + (preGNSConj τ htr u).completion + +@[simp] theorem gnsConj_vector (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y) = τ (y*x)) (u : unitary A) (x : A) : + gnsConj τ htr u (gnsVector τ x) = gnsVector τ (algebraConj u x) := by + change (preGNSConj τ htr u).completion (τ.toPreGNS x : τ.GNS) = + (τ.toPreGNS (algebraConj u x) : τ.GNS) + rw [ContinuousLinearMap.completion_apply_coe] + rfl + +theorem gnsConj_norm (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y) = τ (y*x)) (u : unitary A) (v : τ.GNS) : + ‖gnsConj τ htr u v‖ = ‖v‖ := by + induction v using UniformSpace.Completion.induction_on with + | hp => exact isClosed_eq ((gnsConj τ htr u).continuous.norm) continuous_norm + | ih a => + change ‖(preGNSConj τ htr u).completion (a : τ.GNS)‖ = ‖(a : τ.GNS)‖ + rw [ContinuousLinearMap.completion_apply_coe, + UniformSpace.Completion.norm_coe, UniformSpace.Completion.norm_coe] + exact preGNS_conj_norm τ htr u (τ.ofPreGNS a) + +end + +end KKFactorSupport + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem tracePositive_tracial {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) : + ∀ x y, tracePositive τ (x*y) = tracePositive τ (y*x) := τ.tracial + +theorem gnsVector_injective {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) : + Function.Injective (gnsVector (tracePositive τ)) := by + intro a b hab + have hz : gnsVector (tracePositive τ) (a-b) = 0 := by rw [map_sub, hab, sub_self] + have hτ : τ.map (star (a-b) * (a-b)) = 0 := by + change (tracePositive τ) (star (a-b) * (a-b)) = 0 + rw [← gnsVector_inner (tracePositive τ), hz, inner_zero_left] + have hs : star (a-b) * (a-b) = 0 := + τ.faithful _ (ContinuousLinearMap.isPositive_adjoint_comp_self _) hτ + exact sub_eq_zero.mp ((CStarRing.star_mul_self_eq_zero_iff (a-b)).mp hs) + +theorem tendsto_gnsMean_inner {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (ω : Ultrafilter ℕ) (x : ℕ →ᵇ ConcreteAlgebra M) (a : ConcreteAlgebra M) : + Tendsto (fun j => ⟪gnsVector (tracePositive τ) a, gnsVector (tracePositive τ) (x j)⟫_ℂ) + (ω : Filter ℕ) (𝓝 ⟪gnsVector (tracePositive τ) a, + gnsVector (tracePositive τ) (sequenceMean M ω x)⟫_ℂ) := by + let s := BoundedContinuousFunction.const ℕ (star a) * x * BoundedContinuousFunction.const ℕ 1 + have hs : sequenceMean M ω s = star a * sequenceMean M ω x := by + simpa only [mul_one] using sequenceMean_bimodule ω (star a) 1 x + have ht := tendsto_ultraTraceValue (tracePositive τ) ω s + change Tendsto (fun j => (tracePositive τ) (s j)) (ω : Filter ℕ) + (𝓝 (ultraTrace (tracePositive τ) ω s)) at ht + rw [← trace_sequenceMean τ ω s, hs] at ht + simp only [gnsVector_inner] + change Tendsto (fun j => τ.map (star a * x j)) (ω : Filter ℕ) + (𝓝 (τ.map (star a * sequenceMean M ω x))) + have heval : (fun j => (tracePositive τ) (s j)) = + (fun j => τ.map (star a * x j)) := by + funext j + change τ.map (star a * x j * 1) = _ + rw [mul_one] + rw [heval] at ht + exact ht + +theorem gnsVector_closedBall_isClosed {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (R : ℝ) : + IsClosed (gnsVector (tracePositive τ) '' Metric.closedBall (0 : ConcreteAlgebra M) R) := by + apply isClosed_of_closure_subset + intro y hy + obtain ⟨v, hv, hlim⟩ := mem_closure_iff_seq_limit.mp hy + choose a ha heq using hv + have hR : 0 ≤ R := (norm_nonneg (a 0)).trans (by simpa using ha 0) + let x : ℕ →ᵇ ConcreteAlgebra M := BoundedContinuousFunction.ofNormedAddCommGroup a + continuous_of_discreteTopology R (fun j => by simpa using ha j) + have hx : ‖x‖ ≤ R := (BoundedContinuousFunction.norm_le hR).mpr + (fun j => by change ‖a j‖ ≤ R; simpa using ha j) + let ω : Ultrafilter ℕ := Ultrafilter.of atTop + refine ⟨sequenceMean M ω x, ?_, ?_⟩ + · simpa only [Metric.mem_closedBall, dist_zero_right] using (norm_sequenceMean_le ω x).trans hx + · apply ext_inner_left ℂ + intro z + induction z using UniformSpace.Completion.induction_on with + | hp => + exact isClosed_eq (continuous_id.inner continuous_const) (continuous_id.inner continuous_const) + | ih z => + let b := (tracePositive τ).ofPreGNS z + have hseq : Tendsto (fun j => gnsVector (tracePositive τ) (x j)) + (ω : Filter ℕ) (𝓝 y) := by + have hh : (fun j => gnsVector (tracePositive τ) (x j)) = v := by + funext j + exact heq j + rw [hh] + exact hlim.mono_left (Ultrafilter.of_le atTop) + have h1 : Tendsto (fun j => ⟪gnsVector (tracePositive τ) b, + gnsVector (tracePositive τ) (x j)⟫_ℂ) (ω : Filter ℕ) + (𝓝 ⟪gnsVector (tracePositive τ) b, y⟫_ℂ) := tendsto_const_nhds.inner hseq + have h2 := tendsto_gnsMean_inner τ ω x b + exact (tendsto_nhds_unique h2 h1) + +end + +end KKFactorSupport + +namespace KKFreeLiftFrontier + +open KKTraceTransfer + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def IsFactor (M : VonNeumannAlgebra H) : Prop := + ∀ x : ConcreteAlgebra M, (∀ y : ConcreteAlgebra M, Commute x y) → + ∃ c : ℂ, x = c • 1 + +end KKFreeLiftFrontier + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +def conjugacyOrbit {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (x : ConcreteAlgebra M) : Set (tracePositive τ).GNS := + Set.range (fun u : unitary (ConcreteAlgebra M) => + gnsVector (tracePositive τ) ((u : ConcreteAlgebra M) * x * star (u : ConcreteAlgebra M))) + +def conjugacyHull {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (x : ConcreteAlgebra M) : Set (tracePositive τ).GNS := + closure (convexHull ℝ (conjugacyOrbit τ x)) + +end + +end KKFactorSupport + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem norm_minimizer_unique {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] + {K : Set F} (hK : Convex ℝ K) {a b : F} (ha : a ∈ K) (hb : b ∈ K) + (hmin : ‖(0 : F) - a‖ = ⨅ z : K, ‖(0 : F) - z‖) (hn : ‖b‖ = ‖a‖) : a = b := by + have hbmin : ‖(0 : F) - b‖ = ⨅ z : K, ‖(0 : F) - z‖ := by + simpa only [zero_sub, norm_neg, hn] using hmin + have h₁ := (norm_eq_iInf_iff_real_inner_le_zero hK ha).mp hmin b hb + have h₂ := (norm_eq_iInf_iff_real_inner_le_zero hK hb).mp hbmin a ha + simp only [zero_sub, inner_neg_left, inner_sub_right] at h₁ h₂ + have hz : ⟪a-b,a-b⟫_ℝ ≤ 0 := by + simp only [inner_sub_left, inner_sub_right] + linarith + rw [real_inner_self_eq_norm_sq] at hz + apply eq_of_norm_sub_eq_zero + nlinarith [norm_nonneg (a-b)] + +theorem mapsTo_hull {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + (f : F →L[ℝ] F) {S : Set F} (hf : Set.MapsTo f S S) : + Set.MapsTo f (closure (convexHull ℝ S)) (closure (convexHull ℝ S)) := by + apply Set.MapsTo.closure _ f.continuous + intro x hx + have hh : f x ∈ f '' convexHull ℝ S := ⟨x, hx, rfl⟩ + rw [show f '' convexHull ℝ S = convexHull ℝ (f '' S) from + f.toLinearMap.image_convexHull S] at hh + exact convexHull_mono hf.image_subset hh + +theorem conjugacyHull_bounded {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (x : ConcreteAlgebra M) : conjugacyHull τ x ⊆ + gnsVector (tracePositive τ) '' Metric.closedBall (0 : ConcreteAlgebra M) ‖x‖ := by + apply closure_minimal + · apply convexHull_min + · rintro _ ⟨u, rfl⟩ + refine ⟨algebraConj u x, ?_, rfl⟩ + rw [Metric.mem_closedBall, dist_eq_norm] + change ‖algebraConj u x - 0‖ ≤ ‖x‖ + simp only [algebraConj_apply, sub_zero, ← Unitary.coe_star] + rw [CStarRing.norm_mul_coe_unitary, CStarRing.norm_coe_unitary_mul] + · exact (convex_closedBall (0 : ConcreteAlgebra M) ‖x‖).linear_image + ((gnsVector (tracePositive τ)).restrictScalars ℝ) + · exact gnsVector_closedBall_isClosed τ ‖x‖ + +theorem conjugacyHull_trace {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (x : ConcreteAlgebra M) (v : (tracePositive τ).GNS) (hv : v ∈ conjugacyHull τ x) : + ⟪gnsVector (tracePositive τ) 1, v⟫_ℂ = τ.map x := by + let φ : (tracePositive τ).GNS →L[ℝ] ℂ := + (innerSL ℂ (gnsVector (tracePositive τ) 1)).restrictScalars ℝ + have hc : Convex ℝ {v | φ v = τ.map x} := by + intro a ha b hb c d hc hd hcd + change φ (c • a+d • b) = τ.map x + rw [map_add, map_smul, map_smul, ha, hb, ← add_smul, hcd, one_smul] + have ho : conjugacyOrbit τ x ⊆ {v | φ v = τ.map x} := by + rintro _ ⟨u,rfl⟩ + change ⟪gnsVector (tracePositive τ) 1, gnsVector (tracePositive τ) (algebraConj u x)⟫_ℂ = _ + rw [gnsVector_inner, star_one, one_mul] + exact trace_algebraConj (tracePositive τ) (tracePositive_tracial τ) u x + exact closure_minimal (convexHull_min ho hc) + (isClosed_eq φ.continuous continuous_const) hv + +theorem gnsConj_hull {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (x : ConcreteAlgebra M) (u : unitary (ConcreteAlgebra M)) : + Set.MapsTo (gnsConj (tracePositive τ) (tracePositive_tracial τ) u) (conjugacyHull τ x) + (conjugacyHull τ x) := by + apply mapsTo_hull ((gnsConj (tracePositive τ) (tracePositive_tracial τ) u).restrictScalars ℝ) + rintro _ ⟨w,rfl⟩ + refine ⟨u*w, ?_⟩ + change gnsVector (tracePositive τ) (algebraConj (u*w) x) = + gnsConj (tracePositive τ) (tracePositive_tracial τ) u (gnsVector (tracePositive τ) (algebraConj w x)) + rw [gnsConj_vector] + congr 1 + simp only [algebraConj_apply, Submonoid.coe_mul, star_mul, mul_assoc] + +theorem commute_all_of_unitary {A : Type*} [CStarAlgebra A] (a : A) + (ha : ∀ u : unitary A, Commute a (u : A)) : ∀ b, Commute a b := by + intro b + have hb : b ∈ Submodule.span ℂ (unitary A : Set A) := by + rw [CStarAlgebra.span_unitary]; trivial + induction hb using Submodule.span_induction with + | mem y hy => exact ha ⟨y,hy⟩ + | zero => exact Commute.zero_right _ + | add x y hx hy hx' hy' => exact hx'.add_right hy' + | smul c x hx hx' => exact hx'.smul_right c + +theorem factor_trace_in_conjugacyHull {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (hM : KKFreeLiftFrontier.IsFactor M) + (x : ConcreteAlgebra M) : + gnsVector (tracePositive τ) (τ.map x • 1) ∈ conjugacyHull τ x := by + let : InnerProductSpace ℝ (tracePositive τ).GNS := + InnerProductSpace.rclikeToReal ℂ (tracePositive τ).GNS + have hc : Convex ℝ (conjugacyHull τ x) := (convex_convexHull ℝ _).closure + have hn : (conjugacyHull τ x).Nonempty := by + refine ⟨gnsVector (tracePositive τ) x, subset_closure (subset_convexHull ℝ _ ?_)⟩ + refine ⟨1, ?_⟩ + simp only [OneMemClass.coe_one, star_one, one_mul, mul_one] + obtain ⟨v,hv,hmin⟩ := exists_norm_eq_iInf_of_complete_convex hn isClosed_closure.isComplete hc 0 + obtain ⟨a,ha,hav⟩ := conjugacyHull_bounded τ x hv + have hf (u : unitary (ConcreteAlgebra M)) : + gnsConj (tracePositive τ) (tracePositive_tracial τ) u v = v := by + exact (norm_minimizer_unique hc hv (gnsConj_hull τ x u hv) hmin + (gnsConj_norm (tracePositive τ) (tracePositive_tracial τ) u v)).symm + have hcentral : ∀ b, Commute a b := by + apply commute_all_of_unitary + intro u + have he : algebraConj u a = a := by + apply gnsVector_injective τ + rw [← gnsConj_vector, hav] + exact hf u + have he' := congrArg (fun z => z * (u : ConcreteAlgebra M)) he + simp only [algebraConj_apply, mul_assoc, Unitary.coe_star_mul_self, mul_one] at he' + exact he'.symm + obtain ⟨c,hc⟩ := hM a hcentral + have ht := conjugacyHull_trace τ x v hv + rw [← hav, gnsVector_inner, star_one, one_mul] at ht + change τ.map a = τ.map x at ht + rw [hc, map_smul, τ.normalized, smul_eq_mul, mul_one] at ht + rw [← ht, ← hc] + exact hav.symm ▸ hv + +end + +end KKFactorSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FactorVarianceStructure.lean b/lean/OAI/Analysis/FreeWords/FactorVarianceStructure.lean new file mode 100644 index 0000000000000000000000000000000000000000..e35386024c5825ab0d9691c88d3cc6d648742632 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FactorVarianceStructure.lean @@ -0,0 +1,170 @@ +import Mathlib +import OAI.Analysis.FreeWords.UnitaryTraceWitnessSupport + +namespace OAI + +noncomputable section + +namespace KKFactorSupport + +open KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFactorSupport + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance factorVarianceStructurePartialOrder (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance factorVarianceStructurePreorder (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance factorVarianceStructureLE (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance factorVarianceStructureStarOrderedRing (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +end + +end KKFactorSupport + +namespace KKFreeLiftFrontier + +open KKTraceTransfer + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end KKFreeLiftFrontier + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance factorVarianceStructurePartialOrder_1 (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance factorVarianceStructurePreorder_1 (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance factorVarianceStructureLE_1 (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance factorVarianceStructureStarOrderedRing_1 (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +end + +end KKFactorSupport + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance factorVarianceStructurePartialOrder_2 (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance factorVarianceStructurePreorder_2 (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance factorVarianceStructureLE_2 (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance factorVarianceStructureStarOrderedRing_2 (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +end + +end KKFactorSupport + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance factorVarianceStructurePartialOrder_3 (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance factorVarianceStructurePreorder_3 (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance factorVarianceStructureLE_3 (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance factorVarianceStructureStarOrderedRing_3 (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem factor_trace_distance_bound {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (hM : KKFreeLiftFrontier.IsFactor M) (x : ConcreteAlgebra M) + (R : ℝ) (hR : ∀ u : unitary (ConcreteAlgebra M), + ‖gnsVector (tracePositive τ) (x * (u : ConcreteAlgebra M) - (u : ConcreteAlgebra M) * x)‖ ≤ R) : + ‖gnsVector (tracePositive τ) (x - τ.map x • 1)‖ ≤ R := by + have ho : conjugacyOrbit τ x ⊆ Metric.closedBall (gnsVector (tracePositive τ) x) R := by + rintro _ ⟨u,rfl⟩ + rw [Metric.mem_closedBall, dist_comm, dist_eq_norm] + change ‖gnsVector (tracePositive τ) x - gnsVector (tracePositive τ) (algebraConj u x)‖ ≤ R + rw [gnsVector_conj_sub_norm _ (tracePositive_tracial τ)] + exact hR u + have hh : conjugacyHull τ x ⊆ Metric.closedBall (gnsVector (tracePositive τ) x) R := + closure_minimal (convexHull_min ho (convex_closedBall _ _)) Metric.isClosed_closedBall + have hv := hh (factor_trace_in_conjugacyHull τ hM x) + rw [Metric.mem_closedBall, dist_comm, dist_eq_norm, ← map_sub] at hv + exact hv + +theorem factor_commutator_witness {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (hM : KKFreeLiftFrontier.IsFactor M) (x : ConcreteAlgebra M) : + ∃ u : unitary (ConcreteAlgebra M), + ‖gnsVector (tracePositive τ) (x - τ.map x • 1)‖ ≤ + 2 * ‖gnsVector (tracePositive τ) (x * (u : ConcreteAlgebra M) - (u : ConcreteAlgebra M) * x)‖ := by + by_cases hz : ‖gnsVector (tracePositive τ) (x - τ.map x • 1)‖ = 0 + · exact ⟨1, by rw [hz]; positivity⟩ + · by_contra! hall + have hb := factor_trace_distance_bound τ hM x + (‖gnsVector (tracePositive τ) (x - τ.map x • 1)‖ / 2) + (fun u => by linarith [hall u]) + have hn := norm_nonneg (gnsVector (tracePositive τ) (x - τ.map x • 1)) + exact hz (by linarith) + +end + +end KKFactorSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FactorialSum.lean b/lean/OAI/Analysis/FreeWords/FactorialSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..61cca79b1439f43b710316689349604cd1d739d7 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FactorialSum.lean @@ -0,0 +1,108 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +noncomputable section + +open scoped BigOperators + +theorem choose_mono_small {m a b : ℕ} (hab : a ≤ b) (hb : b ≤ m / 2) : + m.choose a ≤ m.choose b := by + induction b, hab using Nat.le_induction with + | base => exact le_rfl + | succ b hab ih => + exact (ih (by omega)).trans (Nat.choose_le_succ_of_lt_half_left (by omega)) + +theorem choose_two_le {m p : ℕ} (hp : 2 ≤ p) (hpm : p + 2 ≤ m) : + m.choose 2 ≤ m.choose p := by + by_cases h : p ≤ m / 2 + · exact choose_mono_small hp h + · rw [← Nat.choose_symm (show p ≤ m by omega)] + exact choose_mono_small (by omega) (by omega) + +theorem factorial_product_middle {m p : ℕ} (hp : 2 ≤ p) (hpm : p + 2 ≤ m) : + p.factorial * (m-p).factorial ≤ 2 * (m-2).factorial := by + have hc := choose_two_le hp hpm + have hp' := Nat.choose_mul_factorial_mul_factorial (show p ≤ m by omega) + have h2 := Nat.choose_mul_factorial_mul_factorial (show 2 ≤ m by omega) + have hpos := Nat.choose_pos (show 2 ≤ m by omega) + norm_num only [Nat.factorial_two] at h2 + nlinarith [Nat.mul_le_mul_right (p.factorial * (m-p).factorial) hc] + +def factorialRoot (m p : ℕ) : ℝ := Real.sqrt ((p.factorial : ℝ) * (m-p).factorial) + +theorem factorialRoot_middle {m p : ℕ} (hp : 2 ≤ p) (hpm : p + 2 ≤ m) : + factorialRoot m p ≤ Real.sqrt (2 * ((m-2).factorial : ℝ)) := by + apply Real.sqrt_le_sqrt + exact_mod_cast factorial_product_middle hp hpm + +theorem factorialRoot_sum_small (m : ℕ) (hm : m ≤ 3) : + (∑ p ∈ Finset.range (m+1), factorialRoot m p) ≤ 5 * Real.sqrt (m.factorial : ℝ) := by + interval_cases m <;> + norm_num [factorialRoot, Finset.sum_range_succ, Real.sqrt_mul] <;> + nlinarith [Real.sqrt_nonneg 2, Real.sq_sqrt (show (0:ℝ) ≤ 2 by norm_num), + Real.sqrt_nonneg 6, Real.sq_sqrt (show (0:ℝ) ≤ 6 by norm_num)] + +theorem sum_range_four_ends {R : Type*} [AddCommMonoid R] (f : ℕ → R) (k : ℕ) : + (∑ p ∈ Finset.range (k+5), f p) = + f 0 + f 1 + (∑ i ∈ Finset.range (k+1), f (i+2)) + f (k+3) + f (k+4) := by + rw [Finset.sum_range_succ, Finset.sum_range_succ] + rw [show k+3 = 2+(k+1) by omega, Finset.sum_range_add] + simp only [Finset.sum_range_succ, Finset.sum_range_zero, zero_add] + simp only [Nat.add_comm 2] + +theorem factorialRoot_sum (m : ℕ) : + (∑ p ∈ Finset.range (m+1), factorialRoot m p) ≤ 5 * Real.sqrt (m.factorial : ℝ) := by + by_cases hm : m ≤ 3 + · exact factorialRoot_sum_small m hm + obtain ⟨k, rfl⟩ : ∃ k, m = k+4 := ⟨m-4, by omega⟩ + let A : ℝ := Real.sqrt ((k+4).factorial : ℝ) + let B : ℝ := Real.sqrt ((k+3).factorial : ℝ) + let C : ℝ := Real.sqrt (2 * ((k+2).factorial : ℝ)) + have hA : 0 ≤ A := Real.sqrt_nonneg _ + have hB : 0 ≤ B := Real.sqrt_nonneg _ + have hC : 0 ≤ C := Real.sqrt_nonneg _ + have hAsq : A^2 = ((k+4).factorial : ℝ) := Real.sq_sqrt (Nat.cast_nonneg _) + have hBsq : B^2 = ((k+3).factorial : ℝ) := Real.sq_sqrt (Nat.cast_nonneg _) + have hCsq : C^2 = 2 * ((k+2).factorial : ℝ) := Real.sq_sqrt (by positivity) + have hfac : ((k+4).factorial : ℝ) = (k+4) * ((k+3).factorial : ℝ) := by + exact_mod_cast Nat.factorial_succ (k+3) + have hfac' : ((k+3).factorial : ℝ) = (k+3) * ((k+2).factorial : ℝ) := by + exact_mod_cast Nat.factorial_succ (k+2) + have hBA : 2 * B ≤ A := by + apply (sq_le_sq₀ (by positivity) hA).mp + nlinarith [Nat.cast_nonneg (α := ℝ) k, sq_nonneg B] + have hCA : (k+1 : ℝ) * C ≤ 2 * A := by + apply (sq_le_sq₀ (by positivity) (by positivity)).mp + rw [mul_pow, mul_pow, hAsq, hCsq, hfac, hfac'] + nlinarith [Nat.cast_nonneg (α := ℝ) k, Nat.cast_nonneg (α := ℝ) (k+2).factorial, + mul_nonneg (sq_nonneg (k:ℝ)) (Nat.cast_nonneg (α := ℝ) (k+2).factorial), + mul_nonneg (Nat.cast_nonneg (α := ℝ) k) (Nat.cast_nonneg (α := ℝ) (k+2).factorial)] + have hmid : (∑ i ∈ Finset.range (k+1), factorialRoot (k+4) (i+2)) ≤ (k+1:ℝ) * C := by + calc + _ ≤ ∑ i ∈ Finset.range (k+1), C := by + apply Finset.sum_le_sum + intro i hi + have hh := factorialRoot_middle (m := k+4) (p := i+2) (by omega) + (by have := Finset.mem_range.mp hi; omega) + simpa only [show k+4-2=k+2 by omega] using hh + _ = _ := by simp + rw [sum_range_four_ends] + have hends : factorialRoot (k+4) 0 = A ∧ factorialRoot (k+4) 1 = B ∧ + factorialRoot (k+4) (k+3) = B ∧ factorialRoot (k+4) (k+4) = A := by + simp [factorialRoot, A, B, show k+4-1=k+3 by omega, + show k+4-(k+3)=1 by omega] + rw [hends.1, hends.2.1, hends.2.2.1, hends.2.2.2] + change A + B + _ + B + A ≤ 5*A + linarith + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FiniteDimensionalWitness.lean b/lean/OAI/Analysis/FreeWords/FiniteDimensionalWitness.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee13af7304e19e16793d2ca974943b00c1770f62 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FiniteDimensionalWitness.lean @@ -0,0 +1,107 @@ +import Mathlib +import OAI.Analysis.FreeWords.UnitaryTraceWitnessSupport + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKUltraTrace KKFactorSupport + +open scoped ComplexOrder InnerProductSpace + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +def finiteConjHull (τ : A →ₚ[ℂ] ℂ) (x : A) : Set τ.GNS := + closure (convexHull ℝ (Set.range fun u : unitary A => gnsVector τ (algebraConj u x))) + +theorem finite_trace_in_conjugacyHull [FiniteDimensional ℂ A] + (τ : A →ₚ[ℂ] ℂ) (htr : ∀ x y, τ (x*y)=τ (y*x)) (h1 : τ 1=1) + (hinj : Function.Injective (gnsVector τ)) + (hcenter : ∀ a : A, (∀ b : A, Commute a b) → ∃ c : ℂ, a=c•1) + (x : A) : gnsVector τ (τ x•1)∈finiteConjHull τ x := by + let : InnerProductSpace ℝ τ.GNS := InnerProductSpace.rclikeToReal ℂ τ.GNS + have hconv : Convex ℝ (finiteConjHull τ x) := (convex_convexHull ℝ _).closure + have hne : (finiteConjHull τ x).Nonempty := by + refine ⟨gnsVector τ x,subset_closure (subset_convexHull ℝ _ ?_)⟩ + refine ⟨1,?_⟩ + simp only [algebraConj_apply,OneMemClass.coe_one,one_mul,star_one,mul_one] + obtain ⟨v,hv,hmin⟩ := exists_norm_eq_iInf_of_complete_convex hne isClosed_closure.isComplete hconv 0 + have hrange : finiteConjHull τ x ⊆ LinearMap.range (gnsVector τ) := by + apply closure_minimal + · apply convexHull_min + · rintro _ ⟨u,rfl⟩; exact ⟨algebraConj u x,rfl⟩ + · exact ((LinearMap.range (gnsVector τ)).restrictScalars ℝ).convex + · exact (LinearMap.range (gnsVector τ)).closed_of_finiteDimensional + obtain ⟨a,hav⟩ := hrange hv + have hmap (u : unitary A) : Set.MapsTo (gnsConj τ htr u) + (finiteConjHull τ x) (finiteConjHull τ x) := by + apply KKFactorSupport.mapsTo_hull ((gnsConj τ htr u).restrictScalars ℝ) + rintro _ ⟨w,rfl⟩ + refine ⟨u*w,?_⟩ + change gnsVector τ (algebraConj (u*w) x)=gnsConj τ htr u (gnsVector τ (algebraConj w x)) + rw [gnsConj_vector] + congr 1 + simp only [algebraConj_apply,Submonoid.coe_mul,star_mul,mul_assoc] + have hfixed (u : unitary A) : gnsConj τ htr u v=v := + (KKFactorSupport.norm_minimizer_unique hconv hv (hmap u hv) hmin (gnsConj_norm τ htr u v)).symm + have ha : ∀ b : A, Commute a b := by + apply KKFactorSupport.commute_all_of_unitary + intro u + have he : algebraConj u a=a := by + apply hinj + rw [← gnsConj_vector,hav] + exact hfixed u + have hh := congrArg (fun z => z*(u:A)) he + simp only [algebraConj_apply,mul_assoc,Unitary.coe_star_mul_self,mul_one] at hh + exact hh.symm + obtain ⟨c,hc⟩ := hcenter a ha + have htrace : ⟪gnsVector τ 1,v⟫_ℂ=τ x := by + let φ : τ.GNS →L[ℝ] ℂ := (innerSL ℂ (gnsVector τ 1)).restrictScalars ℝ + have hc' : Convex ℝ {v | φ v=τ x} := by + intro a ha b hb c d hc hd hcd + change φ (c•a+d•b)=τ x + rw [map_add,map_smul,map_smul,ha,hb,← add_smul,hcd,one_smul] + have ho : (Set.range fun u : unitary A => gnsVector τ (algebraConj u x)) ⊆ + {v | φ v=τ x} := by + rintro _ ⟨u,rfl⟩ + change ⟪gnsVector τ 1,gnsVector τ (algebraConj u x)⟫_ℂ=τ x + rw [gnsVector_inner,star_one,one_mul,trace_algebraConj τ htr] + exact closure_minimal (convexHull_min ho hc') (isClosed_eq φ.continuous continuous_const) hv + rw [← hav,gnsVector_inner,star_one,one_mul,hc,map_smul,h1,smul_eq_mul,mul_one] at htrace + rw [← htrace,← hc] + exact hav.symm ▸ hv + +theorem finite_commutator_witness [FiniteDimensional ℂ A] + (τ : A →ₚ[ℂ] ℂ) (htr : ∀ x y, τ (x*y)=τ (y*x)) (h1 : τ 1=1) + (hinj : Function.Injective (gnsVector τ)) + (hcenter : ∀ a : A, (∀ b : A, Commute a b) → ∃ c : ℂ, a=c•1) + (x : A) : ∃ u : unitary A, + ‖gnsVector τ (x-τ x•1)‖≤2*‖gnsVector τ (x*(u:A)-(u:A)*x)‖ := by + by_cases hz : ‖gnsVector τ (x-τ x•1)‖=0 + · exact ⟨1,by rw [hz]; positivity⟩ + by_contra! hall + have hbound : finiteConjHull τ x ⊆ + Metric.closedBall (gnsVector τ x) (‖gnsVector τ (x-τ x•1)‖/2) := by + apply closure_minimal + · apply convexHull_min + · rintro _ ⟨u,rfl⟩ + rw [Metric.mem_closedBall,dist_comm,dist_eq_norm,gnsVector_conj_sub_norm τ htr] + linarith [hall u] + · exact convex_closedBall _ _ + · exact Metric.isClosed_closedBall + have hb := hbound (finite_trace_in_conjugacyHull τ htr h1 hinj hcenter x) + rw [Metric.mem_closedBall,dist_comm,dist_eq_norm,← map_sub] at hb + exact hz (by have hh:=norm_nonneg (gnsVector τ (x-τ x•1)); linarith) + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FiniteFreeDefinitions.lean b/lean/OAI/Analysis/FreeWords/FiniteFreeDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..a19d21a95bcd080f320a4462236e00a1b2996509 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FiniteFreeDefinitions.lean @@ -0,0 +1,40 @@ +import Mathlib +import OAI.Analysis.FreeWords.AmplifiedModelDefinitions + +namespace OAI + +noncomputable section + +namespace KKFreeLiftFrontier + +open KKTraceTransfer + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def mixedMoment {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) {n : ℕ} + (U : unitary (MatrixAlgebra n M)) (w : List (ℤ × MatrixAlgebra n M)) : ℂ := + matrixTrace τ n ((w.map fun z => (U ^ z.1).val * z.2).prod) + +def IsCenteredTest {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) {n : ℕ} + (w : List (ℤ × MatrixAlgebra n M)) : Prop := + w ≠ [] ∧ ∀ z ∈ w, z.1 ≠ 0 ∧ matrixTrace τ n z.2 = 0 + +def FiniteMatrixFreeApproximation : Prop := + ∀ (H : Type*) [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [TopologicalSpace.SeparableSpace H] [Nontrivial H] (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M), IsFactor M → IsDiffuse M → + ∀ n : ℕ, 0 < n → ∀ (F : Finset (List (ℤ × MatrixAlgebra n M))), + (∀ w ∈ F, IsCenteredTest τ w) → ∀ K : Finset ℤ, ∀ ε : ℝ, 0 < ε → + ∃ d : ℕ, 0 < d ∧ ∃ ρ : Matrix (Fin d) (Fin d) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M, + Function.Injective ρ ∧ ∃ U : unitary (MatrixAlgebra n M), + (∀ i j, U.val i j ∈ ρ.range) ∧ + (∀ k ∈ K, k ≠ 0 → ‖matrixTrace τ n (U ^ k).val‖ < ε) ∧ (∀ w ∈ F, ‖mixedMoment τ U w‖ < ε) + +end + +end KKFreeLiftFrontier +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FiniteMatrixFreeApproximation.lean b/lean/OAI/Analysis/FreeWords/FiniteMatrixFreeApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..5761972f0ede144c51df7e63df33dcabcc5f11e8 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FiniteMatrixFreeApproximation.lean @@ -0,0 +1,80 @@ +import Mathlib +import OAI.Analysis.FreeWords.TransportLimits +import OAI.Analysis.FreeWords.TransportTests + +namespace OAI + +noncomputable section + +namespace KKFiniteTransport + +noncomputable section + +open KKTraceTransfer KKFreeLiftFrontier KKMatrixExpectation KKHaarEndpoints Filter + +open scoped Matrix.Norms.Operator Topology ComplexOrder + +variable {H:Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M:VonNeumannAlgebra H} + +attribute [local instance] concreteOrder concreteLE concretePreorder concreteSOR + +theorem matrixTraceMap_continuous (τ:FaithfulNormalTrace M) (n:ℕ) : + Continuous (matrixTraceMap τ.map n) := by + change Continuous (fun x:MatrixAlgebra n M => (n:ℂ)⁻¹*∑i,τ.map (x i i)) + apply Continuous.const_mul + apply continuous_finsetSum + intro i hi + exact (map_continuous (tracePositive τ)).comp (by fun_prop) + +theorem mixed_transport_limits (τ:FaithfulNormalTrace M) {n:ℕ} {I:Type*} (L:Filter I) + (U:I → unitary (MatrixAlgebra n M)) + (ht:∀t:TransportTest τ n,Tendsto (fun j => testValue τ t (U j)) L (𝓝 0)) + (w:List (ℤ×MatrixAlgebra n M)) (hw:IsCenteredTest τ w) : + Tendsto (fun j => mixedMoment τ (U j) w) L (𝓝 0) := by + have hh := (matrixTraceMap_continuous τ n).tendsto 0 |>.comp (transport_limits τ L U ht w hw) + simpa only [Function.comp_def,map_zero,matrixExpectation_trace τ.map τ.normalized n, + mixedMoment,matrixTrace,matrixTraceMap_apply,powerWord] using hh + +end + +end KKFiniteTransport + +namespace KKFreeLiftFrontier + +noncomputable section + +open KKFiniteTransport KKMatrixExpectation Filter + +open scoped Topology + +theorem finite_matrix_free_approximation : FiniteMatrixFreeApproximation := by + classical + intro H _ _ _ _ _ M τ hfac hdiff n hn F hF K ε hε + obtain ⟨U,hgood,ht⟩ := KKFiniteMomentNet.finite_moment_net (FullMatrixUnitary n) + (testValue τ) (finite_transport_tests M τ hfac hdiff n hn) + have hsmallF : ∀ᶠj in atTop,∀w∈F,‖mixedMoment τ (U j) w‖<ε := by + apply (Filter.eventually_all_finset F).2 + intro w hw + simpa only [dist_zero_right] using Metric.tendsto_nhds.mp + (mixed_transport_limits τ atTop U ht w (hF w hw)) ε hε + have hsmallK : ∀ᶠj in atTop,∀k∈K,k≠0 → ‖matrixTrace τ n ((U j)^k).val‖<ε := by + apply (Filter.eventually_all_finset K).2 + intro k hk + by_cases hk0:k=0 + · subst k; exact Filter.Eventually.of_forall (by simp) + · have hh := Metric.tendsto_nhds.mp (ht (.haar k hk0)) ε hε + filter_upwards [hh] with j hj + intro _ + simpa only [dist_zero_right,testValue,matrixTraceMap_apply,matrixTrace] using hj + obtain ⟨j,hjF,hjK⟩ := (hsmallF.and hsmallK).exists + obtain ⟨d,hd,ρ,hρ,hentry⟩ := hgood j + exact ⟨d,hd,ρ,hρ,U j,hentry,hjK,hjF⟩ + +end + +end KKFreeLiftFrontier +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FiniteMomentNet.lean b/lean/OAI/Analysis/FreeWords/FiniteMomentNet.lean new file mode 100644 index 0000000000000000000000000000000000000000..9aaf88fb913d3d4f94b76176b939e80ad5fad92a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FiniteMomentNet.lean @@ -0,0 +1,41 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKFiniteMomentNet + +noncomputable section + +open Filter + +open scoped Topology + +variable {S T : Type*} + +theorem finite_moment_net (Good : S → Prop) (f : T → S → ℂ) + (h : ∀K:Finset T, ∀ε:ℝ,0<ε → ∃s,Good s ∧ ∀t∈K,‖f t s‖<ε) : + ∃u : (Finset T×ℕ) → S, (∀j,Good (u j)) ∧ + ∀t,Tendsto (fun j => f t (u j)) atTop (𝓝 0) := by + classical + have hw (j : Finset T×ℕ) : ∃s,Good s ∧ ∀t∈j.1,‖f t s‖<1/((j.2:ℝ)+1) := + h j.1 _ (by positivity) + choose u hu using hw + refine ⟨u,fun j => (hu j).1,?_⟩ + intro t + have hsnd : Tendsto (fun j : Finset T×ℕ => j.2) atTop atTop := by + apply tendsto_atTop.2 + intro n + exact eventually_atTop.2 ⟨(∅,n),fun _ h => h.2⟩ + apply tendsto_zero_iff_norm_tendsto_zero.2 + apply squeeze_zero' (Eventually.of_forall fun _ => norm_nonneg _) _ + (tendsto_one_div_add_atTop_nhds_zero_nat.comp hsnd) + exact eventually_atTop.2 ⟨({t},0),fun j hj => ((hu j).2 t (hj.1 (by simp))).le⟩ + +end + +end KKFiniteMomentNet +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FiniteSpectrum.lean b/lean/OAI/Analysis/FreeWords/FiniteSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..a43cfc3d59c5c8e5fe7784b3e899436f2105e76f --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FiniteSpectrum.lean @@ -0,0 +1,125 @@ +import Mathlib +import OAI.Analysis.FreeWords.SpectralCuts + +namespace OAI + +noncomputable section + +namespace KKSpectralSupport + +open KKTraceTransfer KKPolarSupport + +open scoped InnerProductSpace ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {M : VonNeumannAlgebra H} + +theorem spectralBand_mul_cut (a : ConcreteAlgebra M) {s t v : ℝ} (hst : s ≤ t) (htv : t ≤ v) : + spectralBand a s t*spectralCut a v=0 := by + rw [spectralBand,sub_mul, + ((spectralCut_isProjection a v).le_iff_mul_eq_right (spectralCut_isProjection a s)).mp (spectralCut_antitone a (hst.trans htv)), + ((spectralCut_isProjection a v).le_iff_mul_eq_right (spectralCut_isProjection a t)).mp (spectralCut_antitone a htv),sub_self] + +theorem spectralBand_orthogonal (a : ConcreteAlgebra M) {s t v w : ℝ} + (hst : s ≤ t) (htv : t ≤ v) (hvw : v ≤ w) : spectralBand a s t*spectralBand a v w=0 := by + change spectralBand a s t*(spectralCut a v-spectralCut a w)=0 + rw [mul_sub,spectralBand_mul_cut a hst htv, + spectralBand_mul_cut a hst (htv.trans hvw),sub_self] + +theorem partition_error_bound {ι : Type*} [Fintype ι] (a : ConcreteAlgebra M) + (p : ι → ConcreteAlgebra M) (c : ι → ℝ) {δ : ℝ} (hδ : 0 ≤ δ) + (hsum : ∑ i, p i=1) + (hlow : ∀ i, 0 ≤ (a-algebraMap ℝ (ConcreteAlgebra M) (c i))*p i) + (hupp : ∀ i, 0 ≤ (algebraMap ℝ (ConcreteAlgebra M) (c i+δ)-a)*p i) : + ‖a-∑ i, (c i : ℂ) • p i‖ ≤ δ := by + classical + have he : a-∑ i, (c i : ℂ) • p i = ∑ i, (a-algebraMap ℝ (ConcreteAlgebra M) (c i))*p i := by + simp only [sub_mul,Finset.sum_sub_distrib,← Finset.mul_sum,hsum,mul_one, + ← Algebra.smul_def,Complex.coe_smul] + have hpos : 0 ≤ a-∑ i, (c i : ℂ) • p i := by + rw [he] + exact Finset.sum_nonneg (fun i hi => hlow i) + apply (CStarAlgebra.norm_le_iff_le_algebraMap _ hδ hpos).mpr + rw [he] + calc + _ ≤ ∑ i, algebraMap ℝ (ConcreteAlgebra M) δ*p i := by + apply Finset.sum_le_sum + intro i hi + have h := hupp i + rw [map_add] at h + have hh : (algebraMap ℝ (ConcreteAlgebra M) (c i)+algebraMap ℝ (ConcreteAlgebra M) δ-a)*p i = + algebraMap ℝ (ConcreteAlgebra M) δ*p i-(a-algebraMap ℝ (ConcreteAlgebra M) (c i))*p i := by noncomm_ring + apply sub_nonneg.mp + rw [← hh] + exact h + _ = _ := by rw [← Finset.mul_sum,hsum,mul_one] + +theorem finite_spectrum_approximation_central (M : VonNeumannAlgebra H) + (a : ConcreteAlgebra M) (ha : IsSelfAdjoint a) (ε : ℝ) (hε : 0 < ε) : + ∃ (n : ℕ) (p : Fin n → ConcreteAlgebra M) (c : Fin n → ℝ), + (∀ i, IsStarProjection (p i)) ∧ (∀ i j, i ≠ j → p i*p j=0) ∧ + (∑ i, p i=1) ∧ (∀ i, Commute a (p i)) ∧ + (∀ b, Commute b a → ∀ i, Commute b (p i)) ∧ + ‖a - ∑ i, (c i : ℂ) • p i‖ < ε := by + classical + let δ := ε/2 + have hδ : 0 < δ := half_pos hε + let B := ‖a‖+1 + obtain ⟨n,hn⟩ := exists_nat_gt ((2*B)/δ) + have hnB : 2*B < (n:ℝ)*δ := (div_lt_iff₀ hδ).mp hn + let t : ℕ → ℝ := fun i => -B+(i:ℝ)*δ + have ht : Monotone t := by + intro i j hij + dsimp [t] + exact add_le_add_right (mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hij) hδ.le) _ + let p : Fin n → ConcreteAlgebra M := fun i => spectralBand a (t i) (t (i+1)) + have hp (i : Fin n) : IsStarProjection (p i) := spectralBand_isProjection a (ht (Nat.le_succ i)) + have hq0 : spectralCut a (t 0)=1 := spectralCut_eq_one a ha (by dsimp [t,B]; simp only [Nat.cast_zero,zero_mul,add_zero]; linarith) + have hqn : spectralCut a (t n)=0 := spectralCut_eq_zero a (by dsimp [t,B] at *; linarith) + have hsum : ∑ i, p i=1 := by + change ∑ i : Fin n, (spectralCut a (t i)-spectralCut a (t (i+1)))=1 + rw [Fin.sum_univ_eq_sum_range (fun i => spectralCut a (t i)-spectralCut a (t (i+1))) n, + Finset.sum_range_sub',hq0,hqn,sub_zero] + refine ⟨n,p,(fun i => t i),hp,?_,hsum,(fun i => spectralBand_commute a ha _ _),?_,?_⟩ + · intro i j hij + rcases lt_or_gt_of_ne hij with hij | hji + · exact spectralBand_orthogonal a (ht (Nat.le_succ i)) (ht (Nat.succ_le_of_lt hij)) (ht (Nat.le_succ j)) + · have h := spectralBand_orthogonal a (ht (Nat.le_succ j)) (ht (Nat.succ_le_of_lt hji)) (ht (Nat.le_succ i)) + change p j*p i=0 at h + simpa only [star_mul,(hp i).isSelfAdjoint.star_eq,(hp j).isSelfAdjoint.star_eq,star_zero] using congrArg star h + · intro b hba i + exact (spectralCut_commute_of_commute ha hba _).sub_right (spectralCut_commute_of_commute ha hba _) + · apply lt_of_le_of_lt (partition_error_bound a p (fun i => t i) hδ.le hsum ?_ ?_) (by dsimp [δ]; linarith) + · intro i + exact spectralBand_lower a ha (ht (Nat.le_succ i)) + · intro i + have hid : t i+δ=t (i+1) := by dsimp [t]; push_cast; ring + rw [hid] + exact spectralBand_upper a ha (ht (Nat.le_succ i)) + +theorem finite_spectrum_approximation (M : VonNeumannAlgebra H) + (a : ConcreteAlgebra M) (ha : IsSelfAdjoint a) (ε : ℝ) (hε : 0 < ε) : + ∃ (n : ℕ) (p : Fin n → ConcreteAlgebra M) (c : Fin n → ℝ), + (∀ i, IsStarProjection (p i)) ∧ (∀ i j, i ≠ j → p i*p j=0) ∧ + (∑ i, p i=1) ∧ (∀ i, Commute a (p i)) ∧ + ‖a - ∑ i, (c i : ℂ) • p i‖ < ε := by + obtain ⟨n,p,c,hp,ho,h1,hc,_,he⟩ := finite_spectrum_approximation_central M a ha ε hε + exact ⟨n,p,c,hp,ho,h1,hc,he⟩ + +end + +end KKSpectralSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FiniteSubalgebraWitness.lean b/lean/OAI/Analysis/FreeWords/FiniteSubalgebraWitness.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb05720a80860d5230ca6364b70e091ab961f690 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FiniteSubalgebraWitness.lean @@ -0,0 +1,78 @@ +import Mathlib +import OAI.Analysis.FreeWords.FiniteDimensionalWitness +import OAI.Analysis.FreeWords.VariableUltraAlgebra + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKUltraTrace KKFactorSupport + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable (R : StarSubalgebra ℂ A) [IsClosed (R : Set A)] + +local instance subTraceOrder : PartialOrder R := CStarAlgebra.spectralOrder _ + +local instance : LE R := (subTraceOrder R).toLE + +local instance : Preorder R := (subTraceOrder R).toPreorder + +local instance : StarOrderedRing R := CStarAlgebra.spectralOrderedRing _ + +def subTrace (τ : A →ₚ[ℂ] ℂ) : R →ₚ[ℂ] ℂ where + toLinearMap := τ.toLinearMap.comp R.subtype.toLinearMap + monotone' := by + intro x y hxy + apply τ.monotone' + apply sub_nonneg.mp + obtain ⟨v,hv⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp (sub_nonneg.mpr hxy) + have he : y.val-x.val=star v.val*v.val := congrArg Subtype.val hv + change 0≤y.val-x.val + rw [he] + exact star_mul_self_nonneg _ + +@[simp] theorem subTrace_apply (τ : A →ₚ[ℂ] ℂ) (x : R) : subTrace R τ x=τ x.val := rfl + +theorem gns_subTrace_norm (τ : A →ₚ[ℂ] ℂ) (x : R) : + ‖gnsVector (subTrace R τ) x‖=‖gnsVector τ x.val‖ := by + rw [gns_norm_sqrt,gns_norm_sqrt] + rfl + +theorem gns_subTrace_injective (τ : A →ₚ[ℂ] ℂ) + (hinj : Function.Injective (gnsVector τ)) : Function.Injective (gnsVector (subTrace R τ)) := by + intro x y hxy + have hz : ‖gnsVector (subTrace R τ) (x-y)‖=0 := by + rw [map_sub,hxy,sub_self,norm_zero] + rw [gns_subTrace_norm] at hz + change ‖gnsVector τ (x.val-y.val)‖=0 at hz + apply Subtype.ext + apply hinj + exact sub_eq_zero.mp (by simpa only [map_sub] using norm_eq_zero.mp hz) + +theorem finite_subalgebra_commutator_witness [FiniteDimensional ℂ R] + (τ : A →ₚ[ℂ] ℂ) (htr : ∀ x y, τ (x*y)=τ (y*x)) (h1 : τ 1=1) + (hinj : Function.Injective (gnsVector τ)) + (hcenter : ∀ a : R, (∀ b : R, Commute a b) → ∃ c : ℂ, a=c•1) + (x : A) (hx : x∈R) : ∃ u : unitary A, u.val∈R ∧ + ‖gnsVector τ (x-τ x•1)‖≤2*‖gnsVector τ (x*u.val-u.val*x)‖ := by + let a : R := ⟨x,hx⟩ + obtain ⟨v,hv⟩ := finite_commutator_witness (subTrace R τ) + (fun p q => htr p.val q.val) h1 (gns_subTrace_injective R τ hinj) hcenter a + let u : unitary A := ⟨v.val.val,Unitary.map_mem R.subtype v.property⟩ + refine ⟨u,v.val.property,?_⟩ + rw [gns_subTrace_norm,gns_subTrace_norm] at hv + exact hv + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FlipAverage.lean b/lean/OAI/Analysis/FreeWords/FlipAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9b65a43f9e03c3e544bd79152d342e7d7e8eb50 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FlipAverage.lean @@ -0,0 +1,59 @@ +import Mathlib +import OAI.Analysis.FreeWords.FlipBasic + +namespace OAI + +noncomputable section + +namespace KKFreeLiftDiagnostic + +open scoped BigOperators Matrix.Norms.L2Operator Kronecker + +noncomputable section + +def leftAverage {d : ℕ} (A : Block d) : Block d := + (d : ℂ)⁻¹ • ∑ i : Fin d, ∑ j : Fin d, + left (Matrix.single i j 1)*A*left (Matrix.single j i 1) + +theorem left_single_mul {d : ℕ} (i j : Fin d) (A : Block d) + (k l : Fin d × Fin d) : + (left (Matrix.single i j 1)*A) k l = if k.1=i then A (j,k.2) l else 0 := by + classical + simp only [Matrix.mul_apply] + rw [Fintype.sum_prod_type] + by_cases hk : k.1=i + · simp [left,Matrix.kroneckerMap_apply,Matrix.single_apply,Matrix.one_apply,hk] + · simp [left,Matrix.kroneckerMap_apply,Matrix.one_apply,hk,Ne.symm hk] + +theorem mul_left_single {d : ℕ} (i j : Fin d) (A : Block d) + (k l : Fin d × Fin d) : + (A*left (Matrix.single i j 1)) k l = if l.1=j then A k (i,l.2) else 0 := by + classical + simp only [Matrix.mul_apply] + rw [Fintype.sum_prod_type] + by_cases hl : l.1=j + · simp [left,Matrix.kroneckerMap_apply,Matrix.single_apply,Matrix.one_apply,hl] + · simp [left,Matrix.kroneckerMap_apply,Matrix.one_apply,hl,Ne.symm hl] + +theorem leftAverage_eq_partialTrace {d : ℕ} (A : Block d) : + leftAverage A=right (partialTrace A) := by + classical + ext k l + simp only [leftAverage,Matrix.smul_apply,smul_eq_mul,Matrix.sum_apply, + mul_left_single,left_single_mul] + by_cases hkl : k.1=l.1 + · simp [right,partialTrace,Matrix.one_apply,hkl] + · simp [right,partialTrace,hkl] + +theorem leftAverage_centeredFlip {d : ℕ} (hd : 0 < d) : + leftAverage (centeredFlip d)=0 := by + rw [leftAverage_eq_partialTrace,partialTrace_centeredFlip hd] + ext i j + simp [right] + +end + +end KKFreeLiftDiagnostic +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FlipBasic.lean b/lean/OAI/Analysis/FreeWords/FlipBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..810d05faa4a8308dbb82c75ad53fdbd01a30e8b1 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FlipBasic.lean @@ -0,0 +1,152 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKFreeLiftDiagnostic + +open scoped BigOperators Matrix.Norms.L2Operator Kronecker + +noncomputable section + +abbrev Block (d : ℕ) := Matrix (Fin d × Fin d) (Fin d × Fin d) ℂ + +def flip (d : ℕ) : Block d := fun i j => if i = j.swap then 1 else 0 + +def left {d : ℕ} (U : Matrix (Fin d) (Fin d) ℂ) : Block d := U ⊗ₖ 1 + +def partialTrace {d : ℕ} (A : Block d) : Matrix (Fin d) (Fin d) ℂ := + fun i j => (d : ℂ)⁻¹ * ∑ k, A (k,i) (k,j) + +def normalizedTrace {d : ℕ} (A : Block d) : ℂ := + ((d : ℂ)^2)⁻¹ * Matrix.trace A + +def centeredFlip (d : ℕ) : Block d := flip d - (d : ℂ)⁻¹ • 1 + +def mixedWord {d : ℕ} (U : Matrix (Fin d) (Fin d) ℂ) (X : Block d) : Block d := + left U * X * left U * X * star (left U) * X * star (left U) * X + +def right {d : ℕ} (U : Matrix (Fin d) (Fin d) ℂ) : Block d := 1 ⊗ₖ U + +@[simp] theorem mul_flip {d : ℕ} (A : Block d) (i j : Fin d × Fin d) : + (A * flip d) i j = A i j.swap := by + classical + simp [Matrix.mul_apply, flip] + +@[simp] theorem flip_mul {d : ℕ} (A : Block d) (i j : Fin d × Fin d) : + (flip d * A) i j = A i.swap j := by + classical + have he (k : Fin d × Fin d) : i = k.swap ↔ k = i.swap := by + constructor <;> intro h + · simpa using (congrArg Prod.swap h).symm + · simpa using (congrArg Prod.swap h).symm + simp [Matrix.mul_apply, flip,he] + +@[simp] theorem flip_mul_flip (d : ℕ) : flip d * flip d = 1 := by + ext i j + simp [flip, Matrix.one_apply] + +@[simp] theorem flip_star (d : ℕ) : star (flip d) = flip d := by + ext i j + have he : j = i.swap ↔ i = j.swap := by + constructor <;> intro h <;> simpa using (congrArg Prod.swap h).symm + simp [flip, Matrix.star_apply,he] + +theorem flip_unitary (d : ℕ) : flip d ∈ unitary (Block d) := by + exact ⟨by simp,by simp⟩ + +@[simp] theorem flip_left_flip {d : ℕ} (U : Matrix (Fin d) (Fin d) ℂ) : + flip d * left U * flip d = right U := by + ext i j + simp [left,right,Prod.swap,mul_comm] + +@[simp] theorem left_star {d : ℕ} (U : Matrix (Fin d) (Fin d) ℂ) : + star (left U)=left (star U) := by + ext i j + by_cases hij : i.2=j.2 <;> simp [left, Matrix.star_apply,Matrix.one_apply,eq_comm,hij] + +theorem left_unitary {d : ℕ} (U : Matrix.unitaryGroup (Fin d) ℂ) : + left (U : Matrix (Fin d) (Fin d) ℂ) ∈ unitary (Block d) := by + have h1 : star (U.val)*U.val=1 := U.property.1 + have h2 : U.val*star (U.val)=1 := U.property.2 + constructor + · rw [left_star] + dsimp [left] + rw [← Matrix.mul_kronecker_mul,h1,one_mul,Matrix.one_kronecker_one] + · rw [left_star] + dsimp [left] + rw [← Matrix.mul_kronecker_mul,h2,one_mul,Matrix.one_kronecker_one] + +theorem mixedWord_flip {d : ℕ} (U : Matrix.unitaryGroup (Fin d) ℂ) : + mixedWord (U : Matrix (Fin d) (Fin d) ℂ) (flip d)=1 := by + have hU : U.val*star (U.val)=1 := U.property.2 + calc + _ = (left U.val*(flip d*left U.val*flip d))* + (star (left U.val)*(flip d*star (left U.val)*flip d)) := by + dsimp [mixedWord] + noncomm_ring + _ = (left U.val*right U.val)*(left (star U.val)*right (star U.val)) := by + rw [left_star,flip_left_flip,flip_left_flip] + _ = (U.val*star (U.val)) ⊗ₖ (U.val*star (U.val)) := by + dsimp [left,right] + rw [← Matrix.mul_kronecker_mul,← Matrix.mul_kronecker_mul] + simp only [mul_one,one_mul] + exact (Matrix.mul_kronecker_mul _ _ _ _).symm + _ = 1 := by rw [hU,Matrix.one_kronecker_one] + +@[simp] theorem partialTrace_sub {d : ℕ} (A B : Block d) : + partialTrace (A-B)=partialTrace A-partialTrace B := by + ext i j + simp [partialTrace,Finset.sum_sub_distrib,mul_sub] + +@[simp] theorem partialTrace_smul {d : ℕ} (c : ℂ) (A : Block d) : + partialTrace (c • A)=c • partialTrace A := by + ext i j + simp [partialTrace,Finset.mul_sum,mul_left_comm] + +@[simp] theorem partialTrace_one {d : ℕ} (hd : 0 < d) : + partialTrace (1 : Block d)=1 := by + have hd0 : (d : ℂ) ≠ 0 := by exact_mod_cast hd.ne' + ext i j + by_cases hij : i=j + · subst j + simp [partialTrace,hd0] + · simp [partialTrace,hij] + +@[simp] theorem partialTrace_flip (d : ℕ) : + partialTrace (flip d)=(d : ℂ)⁻¹ • (1 : Matrix (Fin d) (Fin d) ℂ) := by + ext i j + by_cases hij : i=j + · subst j + simp [partialTrace,flip,Prod.mk.injEq,eq_comm] + · have hh (k : Fin d) : ¬(k=j ∧ i=k) := by aesop + simp [partialTrace,flip,Prod.mk.injEq,hh,hij] + +@[simp] theorem partialTrace_centeredFlip {d : ℕ} (hd : 0 < d) : + partialTrace (centeredFlip d)=0 := by + simp [centeredFlip,partialTrace_one hd] + +@[simp] theorem trace_flip (d : ℕ) : Matrix.trace (flip d)=(d : ℂ) := by + change (∑ i : Fin d × Fin d, if i=i.swap then (1 : ℂ) else 0) = _ + rw [Fintype.sum_prod_type] + simp [Prod.mk.injEq,eq_comm] + +@[simp] theorem normalizedTrace_one {d : ℕ} (hd : 0 < d) : + normalizedTrace (1 : Block d)=1 := by + have hd0 : (d : ℂ) ≠ 0 := by exact_mod_cast hd.ne' + simp only [normalizedTrace,Matrix.trace_one,Fintype.card_prod,Fintype.card_fin, Nat.cast_mul] + field_simp + +@[simp] theorem normalizedTrace_centeredFlip {d : ℕ} (hd : 0 < d) : + normalizedTrace (centeredFlip d)=0 := by + have hd0 : (d : ℂ) ≠ 0 := by exact_mod_cast hd.ne' + simp [normalizedTrace,centeredFlip,Matrix.trace_sub,Matrix.trace_smul, + Matrix.trace_one,Fintype.card_prod,smul_eq_mul,pow_two,hd0] + +end + +end KKFreeLiftDiagnostic +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FlipEnd.lean b/lean/OAI/Analysis/FreeWords/FlipEnd.lean new file mode 100644 index 0000000000000000000000000000000000000000..14b0831dd2fd9526821a3b3fe8f6d0842ba4b803 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FlipEnd.lean @@ -0,0 +1,76 @@ +import Mathlib +import OAI.Analysis.FreeWords.FlipNorm + +namespace OAI + +noncomputable section + +namespace KKFreeLiftDiagnostic + +open scoped BigOperators Matrix.Norms.L2Operator Kronecker + +noncomputable section + +theorem mixedWord_centeredFlip_close {d : ℕ} (hd : 0 < d) + (U : Matrix.unitaryGroup (Fin d) ℂ) : + ‖mixedWord (U : Matrix (Fin d) (Fin d) ℂ) (centeredFlip d)-1‖ ≤ 15*(d : ℝ)⁻¹ := by + let V := left (U : Matrix (Fin d) (Fin d) ℂ) + let X := centeredFlip d + let F := flip d + have hV : ‖V‖=1 := left_norm hd U + have hVs : ‖star V‖=1 := by rw [norm_star,hV] + have hX : ‖X‖≤2 := centeredFlip_norm_le hd + have hF : ‖F‖=1 := flip_norm hd + have ht : 0 ≤ (d : ℝ)⁻¹ := by positivity + have hAX (A : Block d) (hA : ‖A‖=1) : ‖A*X‖≤2 := by + calc + _ ≤ ‖A‖*‖X‖ := norm_mul_le _ _ + _ ≤ 1*2 := by rw [hA]; gcongr + _ = _ := by norm_num + have hAF (A : Block d) (hA : ‖A‖=1) : ‖A*F‖≤1 := by + calc + _ ≤ ‖A‖*‖F‖ := norm_mul_le _ _ + _ = 1 := by rw [hA,hF]; norm_num + have hAD (A : Block d) (hA : ‖A‖=1) : ‖A*X-A*F‖≤(d : ℝ)⁻¹ := by + rw [← mul_sub] + calc + _ ≤ ‖A‖*‖X-F‖ := norm_mul_le _ _ + _ = _ := by rw [hA,centeredFlip_close hd,one_mul] + have hh := four_product_difference (V*X) (V*X) (star V*X) (star V*X) + (V*F) (V*F) (star V*F) (star V*F) (d : ℝ)⁻¹ ht + (hAX V hV) (hAX V hV) (hAX (star V) hVs) (hAX (star V) hVs) + (hAF V hV) (hAF V hV) (hAF (star V) hVs) (hAF (star V) hVs) + (hAD V hV) (hAD V hV) (hAD (star V) hVs) (hAD (star V) hVs) + have he : V*F*(V*F)*(star V*F)*(star V*F)=1 := by + simpa only [V,F,mixedWord,mul_assoc] using mixedWord_flip U + rw [he] at hh + simpa only [V,X,mixedWord,mul_assoc] using hh + +theorem flip_obstruction (d : ℕ) (hd : 64 ≤ d) : + normalizedTrace (centeredFlip d)=0 ∧ partialTrace (centeredFlip d)=0 ∧ + ‖centeredFlip d‖ ≤ 2 ∧ + ∀ U : Matrix.unitaryGroup (Fin d) ℂ, + (1/2 : ℝ) ≤ ‖normalizedTrace (mixedWord (U : Matrix (Fin d) (Fin d) ℂ) (centeredFlip d))‖ := by + have hdp : 0 < d := by omega + refine ⟨normalizedTrace_centeredFlip hdp,partialTrace_centeredFlip hdp, + centeredFlip_norm_le hdp,fun U => ?_⟩ + have hh := (normalizedTrace_norm_le hdp + (mixedWord (U : Matrix (Fin d) (Fin d) ℂ) (centeredFlip d)-1)).trans + (mixedWord_centeredFlip_close hdp U) + rw [normalizedTrace_sub,normalizedTrace_one hdp] at hh + have hn := norm_sub_norm_le (1 : ℂ) + (normalizedTrace (mixedWord (U : Matrix (Fin d) (Fin d) ℂ) (centeredFlip d))) + rw [norm_one,norm_sub_rev] at hn + have hdR : (0 : ℝ) < d := by exact_mod_cast hdp + have hd64 : (64 : ℝ) ≤ d := by exact_mod_cast hd + have hb : 15*(d : ℝ)⁻¹ ≤ 1/2 := by + rw [← div_eq_mul_inv,div_le_iff₀ hdR] + linarith + linarith + +end + +end KKFreeLiftDiagnostic +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FlipNorm.lean b/lean/OAI/Analysis/FreeWords/FlipNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..2054d773a535bb5a31bf9a7313e966d9a7292f63 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FlipNorm.lean @@ -0,0 +1,107 @@ +import Mathlib +import OAI.Analysis.FreeWords.FlipBasic + +namespace OAI + +noncomputable section + +namespace KKFreeLiftDiagnostic + +open scoped BigOperators Matrix.Norms.L2Operator Kronecker + +noncomputable section + +theorem norm_entry_le_opNorm {ι : Type*} [Fintype ι] [DecidableEq ι] + (A : Matrix ι ι ℂ) (i j : ι) : ‖A i j‖ ≤ ‖A‖ := by + have hh := Matrix.l2_opNorm_mulVec A (EuclideanSpace.single j (1 : ℂ)) + have hc := PiLp.norm_apply_le + ((EuclideanSpace.equiv ι ℂ).symm (A.mulVec (EuclideanSpace.single j (1:ℂ)).ofLp)) i + have he : (EuclideanSpace.single j (1:ℂ)).ofLp=Pi.single j 1 := by + funext k + simp [Pi.single_apply] + rw [he,Matrix.mulVec_single_one] at hh hc + simpa using hc.trans hh + +theorem normalizedTrace_norm_le {d : ℕ} (hd : 0 < d) (A : Block d) : + ‖normalizedTrace A‖ ≤ ‖A‖ := by + have hdR : (0 : ℝ) < d := by exact_mod_cast hd + have ht : ‖Matrix.trace A‖ ≤ (d : ℝ)^2*‖A‖ := by + calc + _ ≤ ∑ i, ‖A i i‖ := norm_sum_le _ _ + _ ≤ ∑ _ : Fin d × Fin d, ‖A‖ := Finset.sum_le_sum (fun i _ => norm_entry_le_opNorm A i i) + _ = _ := by simp [Fintype.card_prod,pow_two] + simp only [normalizedTrace,norm_mul,norm_inv,norm_pow,Complex.norm_natCast] + calc + _ ≤ ((d : ℝ)^2)⁻¹*((d : ℝ)^2*‖A‖) := mul_le_mul_of_nonneg_left ht (by positivity) + _ = ‖A‖ := by field_simp + +@[simp] theorem normalizedTrace_sub {d : ℕ} (A B : Block d) : + normalizedTrace (A-B)=normalizedTrace A-normalizedTrace B := by + simp [normalizedTrace,Matrix.trace_sub,mul_sub] + +theorem flip_norm {d : ℕ} (hd : 0 < d) : ‖flip d‖=1 := by + let : NeZero d := ⟨hd.ne'⟩ + exact CStarRing.norm_coe_unitary ⟨flip d,flip_unitary d⟩ + +theorem left_norm {d : ℕ} (hd : 0 < d) (U : Matrix.unitaryGroup (Fin d) ℂ) : + ‖left (U : Matrix (Fin d) (Fin d) ℂ)‖=1 := by + let : NeZero d := ⟨hd.ne'⟩ + exact CStarRing.norm_coe_unitary ⟨left (U : Matrix (Fin d) (Fin d) ℂ),left_unitary U⟩ + +theorem centeredFlip_close {d : ℕ} (hd : 0 < d) : + ‖centeredFlip d-flip d‖=(d : ℝ)⁻¹ := by + let : NeZero d := ⟨hd.ne'⟩ + have he : centeredFlip d-flip d = -((d : ℂ)⁻¹ • (1 : Block d)) := by + dsimp [centeredFlip]; abel + rw [he,norm_neg,norm_smul,norm_one,mul_one,norm_inv,Complex.norm_natCast] + +theorem centeredFlip_norm_le {d : ℕ} (hd : 0 < d) : ‖centeredFlip d‖ ≤ 2 := by + have hdR : (1 : ℝ) ≤ d := by exact_mod_cast hd + have hi : (d : ℝ)⁻¹ ≤ 1 := inv_le_one_of_one_le₀ hdR + have hh := norm_sub_le (centeredFlip d-flip d) (-flip d) + rw [sub_neg_eq_add,sub_add_cancel,norm_neg,centeredFlip_close hd,flip_norm hd] at hh + linarith + +theorem norm_product_difference {A : Type*} [NormedRing A] (a b c d : A) : + ‖a*b-c*d‖ ≤ ‖a-c‖*‖b‖+‖c‖*‖b-d‖ := by + have he : a*b-c*d=(a-c)*b+c*(b-d) := by noncomm_ring + rw [he] + exact (norm_add_le _ _).trans (add_le_add (norm_mul_le _ _) (norm_mul_le _ _)) + +theorem four_product_difference {A : Type*} [NormedRing A] + (a b c e a' b' c' e' : A) (t : ℝ) (ht : 0 ≤ t) + (_ : ‖a‖≤2) (hb : ‖b‖≤2) (hc : ‖c‖≤2) (he : ‖e‖≤2) + (ha' : ‖a'‖≤1) (hb' : ‖b'‖≤1) (hc' : ‖c'‖≤1) (_ : ‖e'‖≤1) + (had : ‖a-a'‖≤t) (hbd : ‖b-b'‖≤t) (hcd : ‖c-c'‖≤t) (hed : ‖e-e'‖≤t) : + ‖a*b*c*e-a'*b'*c'*e'‖ ≤ 15*t := by + have h12 : ‖a*b-a'*b'‖≤3*t := by + calc + _ ≤ ‖a-a'‖*‖b‖+‖a'‖*‖b-b'‖ := norm_product_difference _ _ _ _ + _ ≤ t*2+1*t := by gcongr + _ = _ := by ring + have hb12 : ‖a'*b'‖≤1 := by + calc + _ ≤ ‖a'‖*‖b'‖ := norm_mul_le _ _ + _ ≤ 1*1 := by gcongr + _ = 1 := by norm_num + have hb123 : ‖a'*b'*c'‖≤1 := by + calc + _ ≤ ‖a'*b'‖*‖c'‖ := norm_mul_le _ _ + _ ≤ 1*1 := by gcongr + _ = 1 := by norm_num + have h123 : ‖a*b*c-a'*b'*c'‖≤7*t := by + calc + _ ≤ ‖a*b-a'*b'‖*‖c‖+‖a'*b'‖*‖c-c'‖ := norm_product_difference _ _ _ _ + _ ≤ (3*t)*2+1*t := by gcongr + _ = _ := by ring + calc + _ ≤ ‖a*b*c-a'*b'*c'‖*‖e‖+‖a'*b'*c'‖*‖e-e'‖ := norm_product_difference _ _ _ _ + _ ≤ (7*t)*2+1*t := by gcongr + _ = _ := by ring + +end + +end KKFreeLiftDiagnostic +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FreeCompressionMoments.lean b/lean/OAI/Analysis/FreeWords/FreeCompressionMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..dad85d0a0f8c909bd7763dd122faa337efd3fb18 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FreeCompressionMoments.lean @@ -0,0 +1,267 @@ +import Mathlib +import OAI.Analysis.FreeWords.FreeWordCore + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {ι : Type*} {τ : A →ₚ[ℂ] ℂ} {S : ι → StarSubalgebra ℂ A} + +variable {i j : ι} + +omit [StarOrderedRing A] in +theorem free_centered_two (hfree : ScalarFree τ S) (hij : i ≠ j) + {a b : A} (ha : a ∈ S i) (hb : b ∈ S j) (hta : τ a = 0) (htb : τ b = 0) : + τ (a*b) = 0 := by + have hz := hfree [(i,a),(j,b)] (by simp) (by simpa using hij) + (by intro x hx; simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl <;> exact ⟨‹_›,‹_›⟩) + simpa using hz + +omit [StarOrderedRing A] in +theorem free_centered_four (hfree : ScalarFree τ S) (hij : i ≠ j) + {a b c d : A} (ha : a ∈ S i) (hb : b ∈ S j) (hc : c ∈ S i) (hd : d ∈ S j) + (hta : τ a = 0) (htb : τ b = 0) (htc : τ c = 0) (htd : τ d = 0) : + τ (a*b*c*d) = 0 := by + have hz := hfree [(i,a),(j,b),(i,c),(j,d)] (by simp) + (by simp [List.isChain_cons, hij, hij.symm]) + (by intro x hx; simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl | rfl | rfl <;> exact ⟨‹_›,‹_›⟩) + simpa [mul_assoc] using hz + +omit [StarOrderedRing A] in +theorem free_centered_six (hfree : ScalarFree τ S) (hij : i ≠ j) + {a b c d e f : A} (ha : a ∈ S i) (hb : b ∈ S j) (hc : c ∈ S i) (hd : d ∈ S j) + (he : e ∈ S i) (hf : f ∈ S j) + (hta : τ a = 0) (htb : τ b = 0) (htc : τ c = 0) (htd : τ d = 0) + (hte : τ e = 0) (htf : τ f = 0) : τ (a*b*c*d*e*f) = 0 := by + have hz := hfree [(i,a),(j,b),(i,c),(j,d),(i,e),(j,f)] (by simp) + (by simp [List.isChain_cons, hij, hij.symm]) + (by intro x hx; simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl | rfl | rfl | rfl | rfl <;> exact ⟨‹_›,‹_›⟩) + simpa [mul_assoc] using hz + +omit [StarOrderedRing A] in +theorem free_centered_eight (hfree : ScalarFree τ S) (hij : i ≠ j) + {a b c d e f g h : A} + (ha : a ∈ S i) (hb : b ∈ S j) (hc : c ∈ S i) (hd : d ∈ S j) + (he : e ∈ S i) (hf : f ∈ S j) (hg : g ∈ S i) (hh : h ∈ S j) + (hta : τ a = 0) (htb : τ b = 0) (htc : τ c = 0) (htd : τ d = 0) + (hte : τ e = 0) (htf : τ f = 0) (htg : τ g = 0) (hth : τ h = 0) : + τ (a*b*c*d*e*f*g*h) = 0 := by + have hz := hfree [(i,a),(j,b),(i,c),(j,d),(i,e),(j,f),(i,g),(j,h)] (by simp) + (by simp [List.isChain_cons, hij, hij.symm]) + (by intro x hx; simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl <;> exact ⟨‹_›,‹_›⟩) + simpa [mul_assoc] using hz + +omit [StarOrderedRing A] in +theorem free_trace_pair (hτ : τ 1 = 1) (hfree : ScalarFree τ S) (hij : i ≠ j) + {a b : A} (ha : a ∈ S i) (hb : b ∈ S j) : τ (a*b) = τ a * τ b := by + have hc (x : A) : τ (x - τ x • (1:A)) = 0 := by simp [map_sub,map_smul,hτ] + have hz := free_centered_two hfree hij + ((S i).sub_mem ha ((S i).smul_mem (S i).one_mem (τ a))) + ((S j).sub_mem hb ((S j).smul_mem (S j).one_mem (τ b))) (hc a) (hc b) + simp only [sub_mul,mul_sub,smul_mul_assoc,mul_smul_comm,one_mul,mul_one, + map_sub,map_smul,smul_eq_mul,hτ,mul_one] at hz + linear_combination hz + +omit [StarOrderedRing A] in +theorem free_trace_four (hτ : FaithfulTracial τ) (hfree : ScalarFree τ S) (hij : i ≠ j) + {a b c d : A} (ha : a ∈ S i) (hb : b ∈ S j) (hc : c ∈ S i) (hd : d ∈ S j) + (hta : τ a = 0) (htc : τ c = 0) : + τ (a*b*c*d) = τ (a*c) * τ b * τ d := by + have cen (x : A) : τ (x - τ x • (1:A)) = 0 := by simp [map_sub,map_smul,hτ.1] + have hz := free_centered_four hfree hij ha + ((S j).sub_mem hb ((S j).smul_mem (S j).one_mem (τ b))) hc + ((S j).sub_mem hd ((S j).smul_mem (S j).one_mem (τ d))) hta (cen b) htc (cen d) + have h1 : τ (a*c*d) = τ (a*c) * τ d := free_trace_pair hτ.1 hfree hij ((S i).mul_mem ha hc) hd + have h2 : τ (a*b*c) = τ (a*c) * τ b := by + rw [hτ.2.1 (a*b) c, ← mul_assoc, free_trace_pair hτ.1 hfree hij ((S i).mul_mem hc ha) hb, + hτ.2.1 c a] + simp only [sub_mul,mul_sub,smul_mul_assoc,mul_smul_comm,mul_one, + map_sub,map_smul,smul_eq_mul] at hz + rw [h1,h2] at hz + linear_combination hz + +omit [StarOrderedRing A] in +theorem free_trace_six_partial (hτ : FaithfulTracial τ) + (hfree : ScalarFree τ S) (hij : i ≠ j) + {q a b c : A} (hq : q ∈ S j) (htq : τ q = 0) + (ha : a ∈ S i) (hb : b ∈ S i) (hc : c ∈ S i) + (hta : τ a = 0) (htb : τ b = 0) : τ (q*a*q*b*q*c) = 0 := by + have h0 : τ (q*a*q*b*q) = 0 := by + calc τ (q*a*q*b*q) = τ (a*q*b*(q*q)) := by + simpa only [mul_assoc] using hτ.2.1 q (a*q*b*q) + _ = 0 := by rw [free_trace_four hτ hfree hij ha hq hb ((S j).mul_mem hq hq) hta htb,htq]; simp + have hz := free_centered_six hfree hij.symm hq ha hq hb hq + ((S i).sub_mem hc ((S i).smul_mem (S i).one_mem (τ c))) htq hta htq htb htq + (by simp [map_sub,map_smul,hτ.1]) + simpa only [mul_sub,mul_smul_comm,mul_one,map_sub,map_smul,smul_eq_mul,h0,mul_zero, + sub_zero] using hz + +omit [StarOrderedRing A] in +theorem free_compression_four (hτ : FaithfulTracial τ) + (hfree : ScalarFree τ S) (hij : i ≠ j) + {p a b c d : A} (hp : p ∈ S j) + (ha : a ∈ S i) (hb : b ∈ S i) (hc : c ∈ S i) (hd : d ∈ S i) + (hta : τ a = 0) (htb : τ b = 0) (htc : τ c = 0) (htd : τ d = 0) : + τ (p*a*p*b*p*c*p*d) = + (τ p)^4 * τ (a*b*c*d) + (τ p)^2 * (τ (p*p) - (τ p)^2) * + (τ (a*b)*τ (c*d) + τ (b*c)*τ (d*a)) := by + let q := p - τ p • (1:A) + have hq : q ∈ S j := (S j).sub_mem hp ((S j).smul_mem (S j).one_mem (τ p)) + have htq : τ q = 0 := by simp [q,map_sub,map_smul,hτ.1] + have hqq : τ (q*q) = τ (p*p) - (τ p)^2 := by + simp only [q,sub_mul,mul_sub,smul_mul_assoc,mul_smul_comm,one_mul,mul_one, + map_sub,map_smul,smul_eq_mul,hτ.1,mul_one] + ring + have h1 (x : A) (hx : x ∈ S i) : τ (q*x) = 0 := by + rw [free_trace_pair hτ.1 hfree hij.symm hq hx, htq,zero_mul] + have h2 (x y : A) (hx : x ∈ S i) (hy : y ∈ S i) : + τ (q*x*q*y) = τ (q*q) * τ x * τ y := + free_trace_four hτ hfree hij.symm hq hx hq hy htq htq + have h31 : τ (q*a*q*b*q*c*d) = 0 := by + simpa only [mul_assoc] using free_trace_six_partial hτ hfree hij hq htq ha hb + ((S i).mul_mem hc hd) hta htb + have h32 : τ (q*a*q*b*c*q*d) = 0 := by + calc τ (q*a*q*b*c*q*d) = τ (q*d*q*a*q*(b*c)) := by + simpa only [mul_assoc] using hτ.2.1 (q*a*q*b*c) (q*d) + _ = 0 := free_trace_six_partial hτ hfree hij hq htq hd ha + ((S i).mul_mem hb hc) htd hta + have h33 : τ (q*a*b*q*c*q*d) = 0 := by + calc τ (q*a*b*q*c*q*d) = τ (q*c*q*d*q*(a*b)) := by + simpa only [mul_assoc] using hτ.2.1 (q*a*b) (q*c*q*d) + _ = 0 := free_trace_six_partial hτ hfree hij hq htq hc hd + ((S i).mul_mem ha hb) htc htd + have h34 : τ (a*q*b*q*c*q*d) = 0 := by + calc τ (a*q*b*q*c*q*d) = τ (q*b*q*c*q*(d*a)) := by + simpa only [mul_assoc] using hτ.2.1 a (q*b*q*c*q*d) + _ = 0 := free_trace_six_partial hτ hfree hij hq htq hb hc + ((S i).mul_mem hd ha) htb htc + have h4 : τ (q*a*q*b*q*c*q*d) = 0 := + free_centered_eight hfree hij.symm hq ha hq hb hq hc hq hd + htq hta htq htb htq htc htq htd + have h11 : τ (q*a*b*c*d) = 0 := by + simpa only [mul_assoc] using h1 (a*b*c*d) + ((S i).mul_mem ((S i).mul_mem ((S i).mul_mem ha hb) hc) hd) + have h12 : τ (a*q*b*c*d) = 0 := by + calc τ (a*q*b*c*d) = τ (q*(b*c*d*a)) := by + simpa only [mul_assoc] using hτ.2.1 a (q*b*c*d) + _ = 0 := h1 _ ((S i).mul_mem ((S i).mul_mem ((S i).mul_mem hb hc) hd) ha) + have h13 : τ (a*b*q*c*d) = 0 := by + calc τ (a*b*q*c*d) = τ (q*(c*d*a*b)) := by + simpa only [mul_assoc] using hτ.2.1 (a*b) (q*c*d) + _ = 0 := h1 _ ((S i).mul_mem ((S i).mul_mem ((S i).mul_mem hc hd) ha) hb) + have h14 : τ (a*b*c*q*d) = 0 := by + calc τ (a*b*c*q*d) = τ (q*(d*a*b*c)) := by + simpa only [mul_assoc] using hτ.2.1 (a*b*c) (q*d) + _ = 0 := h1 _ ((S i).mul_mem ((S i).mul_mem ((S i).mul_mem hd ha) hb) hc) + have h21 : τ (q*a*q*b*c*d) = 0 := by + have hz := h2 a (b*c*d) ha ((S i).mul_mem ((S i).mul_mem hb hc) hd) + simpa only [mul_assoc,hta,mul_zero,zero_mul] using hz + have h22 : τ (q*a*b*q*c*d) = τ (q*q) * τ (a*b) * τ (c*d) := by + simpa only [mul_assoc] using h2 (a*b) (c*d) ((S i).mul_mem ha hb) ((S i).mul_mem hc hd) + have h23 : τ (q*a*b*c*q*d) = 0 := by + have hz := h2 (a*b*c) d ((S i).mul_mem ((S i).mul_mem ha hb) hc) hd + simpa only [mul_assoc,htd,mul_zero] using hz + have h24 : τ (a*q*b*q*c*d) = 0 := by + calc τ (a*q*b*q*c*d) = τ (q*b*q*(c*d*a)) := by + simpa only [mul_assoc] using hτ.2.1 a (q*b*q*c*d) + _ = 0 := by rw [h2 b (c*d*a) hb + ((S i).mul_mem ((S i).mul_mem hc hd) ha),htb]; simp + have h25 : τ (a*q*b*c*q*d) = τ (q*q) * τ (b*c) * τ (d*a) := by + calc τ (a*q*b*c*q*d) = τ (q*(b*c)*q*(d*a)) := by + simpa only [mul_assoc] using hτ.2.1 a (q*b*c*q*d) + _ = _ := h2 (b*c) (d*a) ((S i).mul_mem hb hc) ((S i).mul_mem hd ha) + have h26 : τ (a*b*q*c*q*d) = 0 := by + calc τ (a*b*q*c*q*d) = τ (q*c*q*(d*a*b)) := by + simpa only [mul_assoc] using hτ.2.1 (a*b) (q*c*q*d) + _ = 0 := by rw [h2 c (d*a*b) hc + ((S i).mul_mem ((S i).mul_mem hd ha) hb),htc]; simp + have hpq : p = q + τ p • (1:A) := by simp [q] + conv_lhs => rw [hpq] + simp only [add_mul,mul_add,smul_mul_assoc,mul_smul_comm,one_mul,mul_one, + map_add,map_smul,smul_eq_mul] + rw [h4,h31,h32,h33,h34,h11,h12,h13,h14,h21,h22,h23,h24,h25,h26,hqq] + ring + +theorem trace_star (x : A) : τ (star x) = star (τ x) := by + have h := inner_conj_symm (𝕜 := ℂ) (τ.toPreGNS x) (τ.toPreGNS 1) + simpa only [PositiveLinearMap.preGNS_inner_def,star_one,one_mul,mul_one, + PositiveLinearMap.ofPreGNS_toPreGNS, Complex.star_def] using h.symm + +theorem projection_compression_second (hτ : FaithfulTracial τ) + (hfree : ScalarFree τ S) (hij : i ≠ j) + {p a : A} (hp : p ∈ S j) (hps : star p = p) (hpp : p*p = p) + (ha : a ∈ S i) (hta : τ a = 0) : + τ ((p*a*p)*star (p*a*p)) = (τ p)^2 * τ (a*star a) := by + have hp' (x : A) : p*(p*x) = p*x := by rw [← mul_assoc,hpp] + have he : (p*a*p)*star (p*a*p) = p*a*p*star a*p := by + simp only [star_mul,hps,mul_assoc,hp'] + rw [he,hτ.2.1 (p*a*p*star a) p] + simp only [mul_assoc,hp'] + have hz := free_trace_four hτ hfree hij ha hp (star_mem ha) hp hta (by rw [trace_star,hta]; simp) + calc τ (p*(a*(p*star a))) = τ (a*p*star a*p) := by + simpa only [mul_assoc] using hτ.2.1 p (a*p*star a) + _ = _ := by rw [hz]; ring + +theorem projection_compression_fourth (hτ : FaithfulTracial τ) + (hfree : ScalarFree τ S) (hij : i ≠ j) + {p a : A} (hp : p ∈ S j) (hps : star p = p) (hpp : p*p = p) + (ha : a ∈ S i) (hta : τ a = 0) : + τ (((p*a*p)*star (p*a*p))^2) = + (τ p)^4 * τ ((a*star a)^2) + + 2*(τ p)^3*(1-τ p)*(τ (a*star a))^2 := by + have hp' (x : A) : p*(p*x) = p*x := by rw [← mul_assoc,hpp] + have he : ((p*a*p)*star (p*a*p))^2 = p*a*p*star a*p*a*p*star a*p := by + simp only [pow_two,star_mul,hps,mul_assoc,hp'] + have he' : τ (((p*a*p)*star (p*a*p))^2) = τ (p*a*p*star a*p*a*p*star a) := by + rw [he,hτ.2.1 (p*a*p*star a*p*a*p*star a) p] + simp only [mul_assoc,hp'] + rw [he', free_compression_four hτ hfree hij hp ha (star_mem ha) ha (star_mem ha) + hta (by rw [trace_star,hta]; simp) hta (by rw [trace_star,hta]; simp),hpp, + hτ.2.1 (star a) a] + simp only [pow_two,mul_assoc] + ring + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FreePreimage.lean b/lean/OAI/Analysis/FreeWords/FreePreimage.lean new file mode 100644 index 0000000000000000000000000000000000000000..c550335dce01c9d3a5196ea56be4ac5be3eff787 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FreePreimage.lean @@ -0,0 +1,66 @@ +import Mathlib +import OAI.Analysis.FreeWords.FreeSurjectiveImage + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {A B : Type*} [CStarAlgebra A] [CStarAlgebra B] + +theorem unitary_map_zpow (φ : A →⋆ₐ[ℂ] B) (u : unitary A) (k : ℤ) : + φ ((u^k).val)=((Unitary.map (StarMonoidHom.ofClass φ) u)^k).val := by + exact congrArg Subtype.val (map_zpow (Unitary.map (StarMonoidHom.ofClass φ)) u k) + +theorem unitary_map_word (φ : A →⋆ₐ[ℂ] B) (u : unitary A) (w : List (ℤ × A)) : + φ ((w.map (fun z => (u^z.1).val*z.2)).prod)= + ((w.map (fun z => (z.1,φ z.2))).map + (fun z => ((Unitary.map (StarMonoidHom.ofClass φ) u)^z.1).val*z.2)).prod := by + simp only [map_list_prod,List.map_map,Function.comp_def,map_mul,unitary_map_zpow] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem finite_free_preimage (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M) (hF : IsFactor M) (hD : IsDiffuse M) + (φ : A →⋆ₐ[ℂ] ConcreteAlgebra M) (hsur : Function.Surjective φ) + (T : A → ℂ) (he : ∀ x, τ.map (φ x)=T x) + (K : Finset ℤ) (F : Finset (List (ℤ × A))) + (hFne : ∀ w∈F, w≠[]) (hcenter : ∀ w∈F, ∀ z∈w, z.1≠0 ∧ T z.2=0) + (ε : ℝ) (hε : 0<ε) : + ∃ v : unitary A, + (∀ k∈K, k≠0 → ‖T ((v^k).val)‖<ε) ∧ + (∀ w∈F, ‖T ((w.map (fun z => (v^z.1).val*z.2)).prod)‖<ε) := by + classical + let wf : List (ℤ × A) → List (ℤ × ConcreteAlgebra M) := + List.map (fun z => (z.1,φ z.2)) + have hn : ∀ w∈F.image wf, w≠[] := by + intro w hw + obtain ⟨v,hv,rfl⟩ := Finset.mem_image.mp hw + intro hz + exact hFne v hv (List.map_eq_nil_iff.mp hz) + have hc : ∀ w∈F.image wf, ∀ z∈w, z.1≠0 ∧ τ.map z.2=0 := by + intro w hw z hz + obtain ⟨v,hv,rfl⟩ := Finset.mem_image.mp hw + obtain ⟨a,ha,rfl⟩ := List.mem_map.mp hz + exact ⟨(hcenter v hv a ha).1,(he a.2).trans (hcenter v hv a ha).2⟩ + obtain ⟨v,hvK,hvF⟩ := finite_free_in_surjective_image M τ hF hD φ hsur + K (F.image wf) hn hc ε hε + refine ⟨v,?_,?_⟩ + · intro k hk hk0 + rw [← he,unitary_map_zpow] + exact hvK k hk hk0 + · intro w hw + rw [← he,unitary_map_word] + exact hvF (wf w) (Finset.mem_image.mpr ⟨w,hw,rfl⟩) + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FreeSurjectiveImage.lean b/lean/OAI/Analysis/FreeWords/FreeSurjectiveImage.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b3ef08c16ee05410832281c7fec535f04ca6719 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FreeSurjectiveImage.lean @@ -0,0 +1,78 @@ +import Mathlib +import OAI.Analysis.FreeWords.ScalarFreeApprox +import OAI.Analysis.FreeWords.SurjectiveExponentialLift +import OAI.Analysis.FreeWords.UnitaryTraceContinuity + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKLocalPatching + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} + +local instance freeSurjectiveImageConcreteOrder : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance freeSurjectiveImageConcretePreorder : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance freeSurjectiveImageConcreteLE : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance freeSurjectiveImageConcreteSOR : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem finite_free_in_surjective_image (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M) (hF : IsFactor M) (hD : IsDiffuse M) + (φ : A →⋆ₐ[ℂ] ConcreteAlgebra M) (hsur : Function.Surjective φ) + (K : Finset ℤ) (F : Finset (List (ℤ × ConcreteAlgebra M))) + (hFne : ∀ w∈F, w≠[]) (hcenter : ∀ w∈F, ∀ z∈w, z.1≠0 ∧ τ.map z.2=0) + (ε : ℝ) (hε : 0<ε) : + ∃ v : unitary A, let u := Unitary.map (StarMonoidHom.ofClass φ) v + (∀ k∈K, k≠0 → ‖τ.map ((u^k).val)‖<ε) ∧ + (∀ w∈F, ‖τ.map ((w.map (fun z => ((u^z.1).val)*z.2)).prod)‖<ε) := by + classical + obtain ⟨u,huK,huF⟩ := finite_scalar_free_approximation M τ hF hD K F hFne hcenter (ε/2) (half_pos hε) + choose v hv using (fun j : ℕ => unitary_dense_image M φ hsur u (((j:ℝ)+1)⁻¹) (by positivity)) + let f (j : ℕ) := Unitary.map (StarMonoidHom.ofClass φ) (v j) + have hf : Tendsto (fun j => gnsVector (tracePositive τ) (f j).val) atTop + (𝓝 (gnsVector (tracePositive τ) u.val)) := by + apply (tendsto_gns_iff τ).mpr + have hb (j : ℕ) : traceNorm τ ((f j).val-u.val) ≤ ((j:ℝ)+1)⁻¹ := by + apply (traceNorm_le_norm τ _).trans + rw [norm_sub_rev] + exact (hv j).le + apply squeeze_zero (fun j => traceNorm_nonneg τ _) hb + simpa only [Function.comp_def,Nat.cast_add,Nat.cast_one] using + (tendsto_inv_atTop_nhds_zero_nat (𝕜 := ℝ)).comp (tendsto_add_atTop_nat 1) + have hKevent : ∀ᶠ j in atTop, ∀ k∈K, k≠0 → ‖τ.map (((f j)^k).val)‖<ε := by + apply (Filter.eventually_all_finset K).mpr + intro k hk + by_cases hk0 : k=0 + · exact Eventually.of_forall (fun _ h => (h hk0).elim) + · have ht := (tendsto_gns_trace τ (tendsto_gns_unitary_zpow τ hf k)).norm + have hh := (tendsto_order.mp ht).2 ε ((huK k hk hk0).trans (half_lt_self hε)) + filter_upwards [hh] with j hj + exact fun _ => hj + have hFevent : ∀ᶠ j in atTop, ∀ w∈F, + ‖τ.map ((w.map (fun z => (((f j)^z.1).val)*z.2)).prod)‖<ε := by + apply (Filter.eventually_all_finset F).mpr + intro w hw + have ht := (tendsto_gns_trace τ (tendsto_gns_unitary_word τ hf w)).norm + exact (tendsto_order.mp ht).2 ε ((huF w hw).trans (half_lt_self hε)) + obtain ⟨j,hjK,hjF⟩ := (hKevent.and hFevent).exists + exact ⟨v j,hjK,hjF⟩ + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FreeWordCore.lean b/lean/OAI/Analysis/FreeWords/FreeWordCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7d5135df42bba5fd8344182801d1895af7ffb5b --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FreeWordCore.lean @@ -0,0 +1,826 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +def ScalarFree {ι : Type*} (τ : A →ₚ[ℂ] ℂ) (S : ι → StarSubalgebra ℂ A) : Prop := + ∀ w : List (ι × A), w ≠ [] → + w.IsChain (fun x y => x.1 ≠ y.1) → + (∀ x ∈ w, x.2 ∈ S x.1 ∧ τ x.2 = 0) → + τ ((w.map Prod.snd).prod) = 0 + +def FaithfulTracial (τ : A →ₚ[ℂ] ℂ) : Prop := + τ 1 = 1 ∧ (∀ x y : A, τ (x * y) = τ (y * x)) ∧ + ∀ x : A, τ (star x * x) = 0 → x = 0 + +structure FreePartitions (τ : A →ₚ[ℂ] ℂ) (r d : ℕ) where + S : Fin r → StarSubalgebra ℂ A + e : Fin r → Fin d → A + mem : ∀ j a, e j a ∈ S j + selfadjoint : ∀ j a, star (e j a) = e j a + mul : ∀ j a b, e j a * e j b = if a = b then e j a else 0 + sum : ∀ j, ∑ a, e j a = 1 + trace : ∀ j a, τ (e j a) = (d : ℂ)⁻¹ + free : ScalarFree τ S + +def wordSum {τ : A →ₚ[ℂ] ℂ} {r d : ℕ} (P : FreePartitions τ r d) + (W : Sym (Fin d) r) : A := + ∑ a ∈ (Finset.univ : Finset (Fin r → Fin d)).filter + (fun a => (List.ofFn a : Multiset (Fin d)) = (W : Multiset (Fin d))), + ((List.ofFn (fun j => P.e j (a j))).reverse).prod + +variable {ι : Type*} {τ : A →ₚ[ℂ] ℂ} {S : ι → StarSubalgebra ℂ A} + +def wordValue (w : List (ι × A)) : A := (w.map Prod.snd).prod + +def adjointWord (w : List (ι × A)) : List (ι × A) := + w.reverse.map (fun x => (x.1, star x.2)) + +def Reduced (w : List (ι × A)) : Prop := + w.IsChain (fun x y => x.1 ≠ y.1) ∧ + ∀ x ∈ w, x.2 ∈ S x.1 ∧ τ x.2 = 0 + +omit [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem wordValue_nil : wordValue ([] : List (ι × A)) = 1 := rfl + +omit [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem wordValue_cons (x : ι × A) (w : List (ι × A)) : + wordValue (x :: w) = x.2 * wordValue w := rfl + +omit [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem wordValue_append (u v : List (ι × A)) : + wordValue (u ++ v) = wordValue u * wordValue v := by + simp [wordValue] + +omit [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem adjointWord_nil : adjointWord ([] : List (ι × A)) = [] := rfl + +omit [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem adjointWord_cons (x : ι × A) (w : List (ι × A)) : + adjointWord (x :: w) = adjointWord w ++ [(x.1, star x.2)] := by + simp [adjointWord] + +omit [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem wordValue_adjointWord (w : List (ι × A)) : + wordValue (adjointWord w) = star (wordValue w) := by + induction w with + | nil => simp + | cons x w ih => simp [ih] + +omit [StarOrderedRing A] in +theorem Reduced.tail {x : ι × A} {w : List (ι × A)} + (h : Reduced (τ := τ) (S := S) (x :: w)) : Reduced (τ := τ) (S := S) w := by + exact ⟨h.1.tail, fun y hy => h.2 y (List.mem_cons_of_mem x hy)⟩ + +omit [StarOrderedRing A] in +theorem Reduced.head {x : ι × A} {w : List (ι × A)} + (h : Reduced (τ := τ) (S := S) (x :: w)) : x.2 ∈ S x.1 ∧ τ x.2 = 0 := + h.2 x (by simp) + +theorem Reduced.adjointWord {w : List (ι × A)} + (h : Reduced (τ := τ) (S := S) w) : + Reduced (τ := τ) (S := S) (adjointWord w) := by + constructor + · rw [KKFreeWords.adjointWord, List.isChain_map, List.isChain_reverse] + exact h.1.imp (fun _ _ hxy => Ne.symm hxy) + · intro x hx + simp only [KKFreeWords.adjointWord, List.mem_map, List.mem_reverse] at hx + obtain ⟨y, hy, rfl⟩ := hx + obtain ⟨hm, hz⟩ := h.2 y hy + exact ⟨star_mem hm, by simpa [hz] using (map_star τ y.2)⟩ + +omit [StarOrderedRing A] in +theorem Reduced.trace_zero (hfree : ScalarFree τ S) {w : List (ι × A)} + (h : Reduced (τ := τ) (S := S) w) (hne : w ≠ []) : τ (wordValue w) = 0 := + hfree w hne h.1 h.2 + +omit [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] in +theorem chain_iff_indices (w : List (ι × A)) : + w.IsChain (fun x y => x.1 ≠ y.1) ↔ (w.map Prod.fst).IsChain Ne := by + rw [List.isChain_map] + +omit [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem adjointWord_indices (w : List (ι × A)) : + (adjointWord w).map Prod.fst = (w.map Prod.fst).reverse := by + simp [adjointWord, List.map_reverse, Function.comp_def] + +omit [PartialOrder A] [StarOrderedRing A] in +theorem chain_junction {i : ι} {a b c : A} {u v : List (ι × A)} + (hu : ((i,a) :: u).IsChain (fun x y => x.1 ≠ y.1)) + (hv : ((i,b) :: v).IsChain (fun x y => x.1 ≠ y.1)) : + (adjointWord u ++ (i,c) :: v).IsChain (fun x y => x.1 ≠ y.1) := by + rw [chain_iff_indices, List.map_append, List.map_cons, + adjointWord_indices, List.isChain_split] + constructor + · change ((u.map Prod.fst).reverse ++ [i]).IsChain Ne + rw [← List.reverse_cons, List.isChain_reverse] + exact ((chain_iff_indices ((i,a) :: u)).mp hu).imp (fun _ _ hxy => Ne.symm hxy) + · exact (chain_iff_indices ((i,b) :: v)).mp hv + +omit [PartialOrder A] [StarOrderedRing A] in +theorem chain_distinct_junction {i j : ι} {a b : A} {u v : List (ι × A)} + (hu : ((i,a) :: u).IsChain (fun x y => x.1 ≠ y.1)) + (hv : ((j,b) :: v).IsChain (fun x y => x.1 ≠ y.1)) (hne : i ≠ j) : + (adjointWord ((i,a) :: u) ++ (j,b) :: v).IsChain + (fun x y => x.1 ≠ y.1) := by + simp only [adjointWord_cons, List.append_assoc, List.singleton_append] + rw [List.isChain_append_cons_cons] + refine ⟨?_, hne, hv⟩ + have hc := (chain_iff_indices ((i,a) :: u)).mp hu + rw [chain_iff_indices, List.map_append, adjointWord_indices] + change ((u.map Prod.fst).reverse ++ [i]).IsChain Ne + rw [← List.reverse_cons, List.isChain_reverse] + exact hc.imp (fun _ _ hxy => Ne.symm hxy) + +theorem trace_centered_junction (hfree : ScalarFree τ S) + {i : ι} {a b c : A} {u v : List (ι × A)} + (hu : Reduced (τ := τ) (S := S) ((i,a) :: u)) + (hv : Reduced (τ := τ) (S := S) ((i,b) :: v)) + (hc : c ∈ S i ∧ τ c = 0) : + τ (star (wordValue u) * c * wordValue v) = 0 := by + have hred : Reduced (τ := τ) (S := S) (adjointWord u ++ (i,c) :: v) := by + refine ⟨chain_junction hu.1 hv.1, ?_⟩ + intro x hx + rcases List.mem_append.mp hx with hx | hx + · exact hu.tail.adjointWord.2 x hx + · rcases List.mem_cons.mp hx with rfl | hx + · exact hc + · exact hv.tail.2 x hx + have h := hred.trace_zero hfree (by simp) + simpa only [wordValue_append, wordValue_adjointWord, wordValue_cons, mul_assoc] + using h + +theorem trace_distinct_junction (hfree : ScalarFree τ S) + {i j : ι} {a b : A} {u v : List (ι × A)} + (hu : Reduced (τ := τ) (S := S) ((i,a) :: u)) + (hv : Reduced (τ := τ) (S := S) ((j,b) :: v)) (hne : i ≠ j) : + τ (star (wordValue ((i,a)::u)) * wordValue ((j,b)::v)) = 0 := by + have hred : Reduced (τ := τ) (S := S) + (adjointWord ((i,a)::u) ++ (j,b)::v) := by + refine ⟨chain_distinct_junction hu.1 hv.1 hne, ?_⟩ + intro x hx + rcases List.mem_append.mp hx with hx | hx + · exact hu.adjointWord.2 x hx + · exact hv.2 x hx + simpa only [wordValue_append, wordValue_adjointWord] using + hred.trace_zero hfree (by simp) + +theorem trace_same_junction (hfree : ScalarFree τ S) (hτ : τ 1 = 1) + {i : ι} {a b : A} {u v : List (ι × A)} + (hu : Reduced (τ := τ) (S := S) ((i,a) :: u)) + (hv : Reduced (τ := τ) (S := S) ((i,b) :: v)) : + τ (star (wordValue ((i,a)::u)) * wordValue ((i,b)::v)) = + τ (star a * b) * τ (star (wordValue u) * wordValue v) := by + let z : ℂ := τ (star a * b) + let c : A := star a * b - z • 1 + have hc : c ∈ S i ∧ τ c = 0 := by + constructor + · exact sub_mem (mul_mem (star_mem hu.head.1) hv.head.1) + ((S i).smul_mem (one_mem _) z) + · simp [c, z, map_sub, map_smul, hτ] + have hzero := trace_centered_junction hfree hu hv hc + have heq : τ (star (wordValue u) * (star a * b) * wordValue v) = + z * τ (star (wordValue u) * wordValue v) := by + apply sub_eq_zero.mp + simpa only [c, mul_sub, sub_mul, mul_smul_comm, smul_mul_assoc, mul_one, + map_sub, map_smul, smul_eq_mul] using hzero + simpa only [wordValue_cons, star_mul, mul_assoc] using heq + +theorem trace_reduced_inner [DecidableEq ι] (hfree : ScalarFree τ S) (hτ : τ 1 = 1) + (u v : List (ι × A)) (hu : Reduced (τ := τ) (S := S) u) + (hv : Reduced (τ := τ) (S := S) v) : + τ (star (wordValue u) * wordValue v) = + if u.map Prod.fst = v.map Prod.fst then + (u.zipWith (fun x y => τ (star x.2 * y.2)) v).prod else 0 := by + classical + induction u generalizing v with + | nil => + cases v with + | nil => simp [hτ] + | cons y v => + simpa using hv.trace_zero hfree (by simp) + | cons x u ih => + cases v with + | nil => + have hz := hu.adjointWord.trace_zero hfree (by simp) + simpa using hz + | cons y v => + obtain ⟨i,a⟩ := x + obtain ⟨j,b⟩ := y + by_cases hij : i = j + · subst j + rw [trace_same_junction hfree hτ hu hv, ih v hu.tail hv.tail] + simp only [List.map_cons, List.cons.injEq, true_and, List.zipWith_cons_cons, + List.prod_cons] + split_ifs <;> simp_all + · rw [trace_distinct_junction hfree hu hv hij] + simp [hij] + +open scoped InnerProductSpace + +def gnsVector (τ : A →ₚ[ℂ] ℂ) : A →ₗ[ℂ] τ.GNS := + UniformSpace.Completion.toComplL.toLinearMap ∘ₗ τ.toPreGNS.toLinearMap + +@[simp] theorem gnsVector_inner (x y : A) : + ⟪gnsVector τ x, gnsVector τ y⟫_ℂ = τ (star x * y) := by + change ⟪(τ.toPreGNS x : τ.GNS), (τ.toPreGNS y : τ.GNS)⟫_ℂ = _ + rw [UniformSpace.Completion.inner_coe, PositiveLinearMap.preGNS_inner_def] + rfl + +@[simp] theorem gnsStarAlgHom_vector (x y : A) : + τ.gnsStarAlgHom x (gnsVector τ y) = gnsVector τ (x * y) := by + change τ.gnsNonUnitalStarAlgHom x (τ.toPreGNS y : τ.GNS) = + (τ.toPreGNS (x * y) : τ.GNS) + simp + +theorem gnsVector_injective (hfaith : ∀ x : A, τ (star x * x) = 0 → x = 0) : + Function.Injective (gnsVector τ) := by + intro x y hxy + have hz : gnsVector τ (x - y) = 0 := by simpa only [map_sub, sub_eq_zero] using hxy + have hc : τ (star (x-y) * (x-y)) = 0 := by + rw [← gnsVector_inner, hz, inner_zero_left] + exact sub_eq_zero.mp (hfaith _ hc) + +theorem gnsStarAlgHom_injective + (hfaith : ∀ x : A, τ (star x * x) = 0 → x = 0) : + Function.Injective τ.gnsStarAlgHom := by + intro x y hxy + apply gnsVector_injective hfaith + have h := congrArg (fun T : τ.GNS →L[ℂ] τ.GNS => T (gnsVector τ 1)) hxy + simpa only [gnsStarAlgHom_vector, mul_one] using h + +theorem gnsStarAlgHom_norm + (hfaith : ∀ x : A, τ (star x * x) = 0 → x = 0) (x : A) : + ‖τ.gnsStarAlgHom x‖ = ‖x‖ := + NonUnitalStarAlgHom.norm_map τ.gnsStarAlgHom (gnsStarAlgHom_injective hfaith) x + +theorem gnsVector_word_inner [DecidableEq ι] (hfree : ScalarFree τ S) (hτ : τ 1 = 1) + (u v : List (ι × A)) (hu : Reduced (τ := τ) (S := S) u) + (hv : Reduced (τ := τ) (S := S) v) : + ⟪gnsVector τ (wordValue u), gnsVector τ (wordValue v)⟫_ℂ = + if u.map Prod.fst = v.map Prod.fst then + (u.zipWith (fun x y => τ (star x.2 * y.2)) v).prod else 0 := by + rw [gnsVector_inner] + exact trace_reduced_inner hfree hτ u v hu hv + +def HeadOutside (i : ι) (w : List (ι × A)) : Prop := + (w.map Prod.fst).head? ≠ some i + +omit [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem headOutside_nil (i : ι) : HeadOutside i ([] : List (ι × A)) := by + simp [HeadOutside] + +omit [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem headOutside_cons (i : ι) (x : ι × A) (w : List (ι × A)) : + HeadOutside i (x :: w) ↔ x.1 ≠ i := by simp [HeadOutside] + +omit [StarOrderedRing A] in +theorem Reduced.cons_of_headOutside {i : ι} {a : A} {w : List (ι × A)} + (hw : Reduced (τ := τ) (S := S) w) (ho : HeadOutside i w) + (ha : a ∈ S i ∧ τ a = 0) : Reduced (τ := τ) (S := S) ((i,a) :: w) := by + constructor + · cases w with + | nil => simp + | cons x w => + rw [List.isChain_cons_cons] + exact ⟨Ne.symm ((headOutside_cons i x w).mp ho), hw.1⟩ + · intro x hx + rcases List.mem_cons.mp hx with rfl | hx + · exact ha + · exact hw.2 x hx + +def tailWords (τ : A →ₚ[ℂ] ℂ) (S : ι → StarSubalgebra ℂ A) (i : ι) : Set τ.GNS := + {ξ | ∃ w, Reduced (τ := τ) (S := S) w ∧ HeadOutside i w ∧ + ξ = gnsVector τ (wordValue w)} + +def tailSpace (τ : A →ₚ[ℂ] ℂ) (S : ι → StarSubalgebra ℂ A) (i : ι) : + Submodule ℂ τ.GNS := (Submodule.span ℂ (tailWords τ S i)).topologicalClosure + +theorem inner_create_span (hfree : ScalarFree τ S) (hτ : τ 1 = 1) + {i : ι} {a b : A} (ha : a ∈ S i ∧ τ a = 0) (hb : b ∈ S i ∧ τ b = 0) + {ξ η : τ.GNS} (hξ : ξ ∈ Submodule.span ℂ (tailWords τ S i)) + (hη : η ∈ Submodule.span ℂ (tailWords τ S i)) : + ⟪τ.gnsStarAlgHom a ξ, τ.gnsStarAlgHom b η⟫_ℂ = + τ (star a * b) * ⟪ξ, η⟫_ℂ := by + refine Submodule.span_induction₂ (p := fun ξ η _ _ => + ⟪τ.gnsStarAlgHom a ξ, τ.gnsStarAlgHom b η⟫_ℂ = + τ (star a * b) * ⟪ξ, η⟫_ℂ) ?_ ?_ ?_ ?_ ?_ ?_ ?_ hξ hη + · intro ξ η hξ hη + obtain ⟨u, hu, hou, rfl⟩ := hξ + obtain ⟨v, hv, hov, rfl⟩ := hη + simp only [gnsStarAlgHom_vector, gnsVector_inner] + exact trace_same_junction hfree hτ (hu.cons_of_headOutside hou ha) + (hv.cons_of_headOutside hov hb) + · intro y hy; simp + · intro x hx; simp + · intro x y z hx hy hz h₁ h₂ + simp only [map_add, inner_add_left, h₁, h₂, mul_add] + · intro x y z hx hy hz h₁ h₂ + simp only [map_add, inner_add_right, h₁, h₂, mul_add] + · intro z x y hx hy h + simp only [map_smul, inner_smul_left, h] + ring + · intro z x y hx hy h + simp only [map_smul, inner_smul_right, h] + ring + +theorem inner_create (hfree : ScalarFree τ S) (hτ : τ 1 = 1) + {i : ι} {a b : A} (ha : a ∈ S i ∧ τ a = 0) (hb : b ∈ S i ∧ τ b = 0) + {ξ η : τ.GNS} (hξ : ξ ∈ tailSpace τ S i) (hη : η ∈ tailSpace τ S i) : + ⟪τ.gnsStarAlgHom a ξ, τ.gnsStarAlgHom b η⟫_ℂ = + τ (star a * b) * ⟪ξ, η⟫_ℂ := by + have hleft : ∀ y ∈ Submodule.span ℂ (tailWords τ S i), + ∀ x ∈ tailSpace τ S i, + ⟪τ.gnsStarAlgHom a x, τ.gnsStarAlgHom b y⟫_ℂ = + τ (star a * b) * ⟪x,y⟫_ℂ := by + intro y hy x hx + apply (closure_minimal (t := {z | ⟪τ.gnsStarAlgHom a z, τ.gnsStarAlgHom b y⟫_ℂ = + τ (star a * b) * ⟪z,y⟫_ℂ}) ?_ ?_) hx + · intro z hz; exact inner_create_span hfree hτ ha hb hz hy + · exact isClosed_eq (by fun_prop) (by fun_prop) + apply (closure_minimal (t := {z | ⟪τ.gnsStarAlgHom a ξ, τ.gnsStarAlgHom b z⟫_ℂ = + τ (star a * b) * ⟪ξ,z⟫_ℂ}) ?_ ?_) hη + · intro z hz; exact hleft z hz ξ hξ + · exact isClosed_eq (by fun_prop) (by fun_prop) + +theorem closedSpan_orthogonal {E : Type*} [NormedAddCommGroup E] + [InnerProductSpace ℂ E] (s t : Set E) + (h : ∀ x ∈ s, ∀ y ∈ t, ⟪x,y⟫_ℂ = 0) : + (Submodule.span ℂ s).topologicalClosure ≤ + (Submodule.span ℂ t).topologicalClosureᗮ := by + rw [Submodule.orthogonal_closure] + apply Submodule.topologicalClosure_minimal _ _ (Submodule.isClosed_orthogonal _) + refine Submodule.span_le.mpr ?_ + intro x hx + change x ∈ (Submodule.span ℂ t)ᗮ + rw [Submodule.mem_orthogonal'] + intro y hy + induction hy using Submodule.span_induction with + | mem y hy => exact h x hx y hy + | zero => simp + | add y z hy hz iy iz => simp [inner_add_right, iy, iz] + | smul c y hy iy => simp [inner_smul_right, iy] + +def reducedWords (τ : A →ₚ[ℂ] ℂ) (S : ι → StarSubalgebra ℂ A) : Set τ.GNS := + {ξ | ∃ w, Reduced (τ := τ) (S := S) w ∧ ξ = gnsVector τ (wordValue w)} + +def reducedSpace (τ : A →ₚ[ℂ] ℂ) (S : ι → StarSubalgebra ℂ A) : Submodule ℂ τ.GNS := + (Submodule.span ℂ (reducedWords τ S)).topologicalClosure + +def headWords (τ : A →ₚ[ℂ] ℂ) (S : ι → StarSubalgebra ℂ A) (i : ι) : Set τ.GNS := + {ξ | ∃ w, Reduced (τ := τ) (S := S) w ∧ (w.map Prod.fst).head? = some i ∧ + ξ = gnsVector τ (wordValue w)} + +def headSpace (τ : A →ₚ[ℂ] ℂ) (S : ι → StarSubalgebra ℂ A) (i : ι) : Submodule ℂ τ.GNS := + (Submodule.span ℂ (headWords τ S i)).topologicalClosure + +instance reducedSpace_complete : CompleteSpace (reducedSpace τ S) := + (Submodule.isClosed_topologicalClosure _).completeSpace_coe + +instance headSpace_complete (i : ι) : CompleteSpace (headSpace τ S i) := + (Submodule.isClosed_topologicalClosure _).completeSpace_coe + +instance tailSpace_complete (i : ι) : CompleteSpace (tailSpace τ S i) := + (Submodule.isClosed_topologicalClosure _).completeSpace_coe + +theorem headSpace_orthogonal_tail (hfree : ScalarFree τ S) (hτ : τ 1 = 1) (i : ι) : + headSpace τ S i ≤ (tailSpace τ S i)ᗮ := by + classical + apply closedSpan_orthogonal + rintro x ⟨u, hu, hou, rfl⟩ y ⟨v, hv, hov, rfl⟩ + have hne : u.map Prod.fst ≠ v.map Prod.fst := by + intro he + exact hov (he ▸ hou) + simp only [gnsVector_word_inner hfree hτ u v hu hv, ite_eq_right hne] + +theorem headSpace_le_tailSpace {i j : ι} (hij : i ≠ j) : + headSpace τ S i ≤ tailSpace τ S j := by + apply Submodule.topologicalClosure_mono + apply Submodule.span_mono + rintro x ⟨w, hw, ho, hx⟩ + exact ⟨w, hw, by simpa [HeadOutside, ho] using hij, hx⟩ + +theorem headSpace_le_reducedSpace (i : ι) : headSpace τ S i ≤ reducedSpace τ S := by + apply Submodule.topologicalClosure_mono + apply Submodule.span_mono + rintro x ⟨w, hw, ho, hx⟩ + exact ⟨w, hw, hx⟩ + +theorem tailSpace_le_reducedSpace (i : ι) : tailSpace τ S i ≤ reducedSpace τ S := by + apply Submodule.topologicalClosure_mono + apply Submodule.span_mono + rintro x ⟨w, hw, ho, hx⟩ + exact ⟨w, hw, hx⟩ + +theorem reducedVector_mem {w : List (ι × A)} (hw : Reduced (τ := τ) (S := S) w) : + gnsVector τ (wordValue w) ∈ reducedSpace τ S := + Submodule.le_topologicalClosure _ (Submodule.subset_span ⟨w, hw, rfl⟩) + +theorem vacuum_mem_reducedSpace : gnsVector τ 1 ∈ reducedSpace τ S := by + apply reducedVector_mem (w := []) + exact ⟨by simp, by simp⟩ + +theorem headVector_mem {w : List (ι × A)} (hw : Reduced (τ := τ) (S := S) w) + {i : ι} (ho : (w.map Prod.fst).head? = some i) : + gnsVector τ (wordValue w) ∈ headSpace τ S i := + Submodule.le_topologicalClosure _ (Submodule.subset_span ⟨w, hw, ho, rfl⟩) + +theorem tailVector_mem {w : List (ι × A)} (hw : Reduced (τ := τ) (S := S) w) + {i : ι} (ho : HeadOutside i w) : + gnsVector τ (wordValue w) ∈ tailSpace τ S i := + Submodule.le_topologicalClosure _ (Submodule.subset_span ⟨w, hw, ho, rfl⟩) + +theorem head_add_tail_projection (hfree : ScalarFree τ S) (hτ : τ 1 = 1) (i : ι) : + (headSpace τ S i).starProjection + (tailSpace τ S i).starProjection = + (reducedSpace τ S).starProjection := by + classical + let Q := (headSpace τ S i).starProjection + let T := (tailSpace τ S i).starProjection + have horth := headSpace_orthogonal_tail hfree hτ i + have horth' : tailSpace τ S i ≤ (headSpace τ S i)ᗮ := by + intro x hx + exact fun y hy => Submodule.inner_left_of_mem_orthogonal hx (horth hy) + have hw : ∀ x ∈ reducedWords τ S, Q x + T x = x := by + rintro x ⟨w, hw, rfl⟩ + by_cases ho : (w.map Prod.fst).head? = some i + · have hm := headVector_mem hw ho + rw [show Q (gnsVector τ (wordValue w)) = gnsVector τ (wordValue w) from + Submodule.starProjection_eq_self_iff.mpr hm, + show T (gnsVector τ (wordValue w)) = 0 from + (Submodule.starProjection_apply_eq_zero_iff _).mpr (horth hm), add_zero] + · have hm := tailVector_mem hw ho + rw [show T (gnsVector τ (wordValue w)) = gnsVector τ (wordValue w) from + Submodule.starProjection_eq_self_iff.mpr hm, + show Q (gnsVector τ (wordValue w)) = 0 from + (Submodule.starProjection_apply_eq_zero_iff _).mpr (horth' hm), zero_add] + have hall : ∀ x ∈ reducedSpace τ S, Q x + T x = x := by + intro x hx + apply (closure_minimal (t := {z | Q z + T z = z}) ?_ ?_) hx + · intro z hz + change Q z + T z = z + induction hz using Submodule.span_induction with + | mem z hz => exact hw z hz + | zero => simp + | add x y hx hy ix iy => rw [map_add, map_add, add_add_add_comm, ix, iy] + | smul c x hx ix => simp only [map_smul, ← smul_add, ix] + · exact isClosed_eq (by fun_prop) (by fun_prop) + ext x + symm + apply Submodule.eq_starProjection_of_mem_of_inner_eq_zero + · exact (reducedSpace τ S).add_mem + (headSpace_le_reducedSpace i (Submodule.starProjection_apply_mem _ _)) + (tailSpace_le_reducedSpace i (Submodule.starProjection_apply_mem _ _)) + · intro y hy + change ⟪x - (Q x + T x), y⟫_ℂ = 0 + rw [inner_sub_left, inner_add_left] + rw [Submodule.inner_starProjection_left_eq_right, + Submodule.inner_starProjection_left_eq_right, ← inner_add_right, hall y hy, sub_self] + +def centerOf (τ : A →ₚ[ℂ] ℂ) (a : A) : A := a - τ a • 1 + +omit [StarOrderedRing A] in +theorem centerOf_mem {i : ι} {a : A} (ha : a ∈ S i) : centerOf τ a ∈ S i := + sub_mem ha ((S i).smul_mem (one_mem _) _) + +omit [StarOrderedRing A] in +@[simp] theorem centerOf_trace (hτ : τ 1 = 1) (a : A) : τ (centerOf τ a) = 0 := by + simp [centerOf, map_sub, map_smul, hτ] + +theorem gnsVector_mul_split (a b : A) : + gnsVector τ (a * b) = τ a • gnsVector τ b + gnsVector τ (centerOf τ a * b) := by + rw [← map_smul, ← map_add] + congr 1 + simp [centerOf, sub_mul] + +omit [StarOrderedRing A] in +theorem Reduced.tail_headOutside {x : ι × A} {w : List (ι × A)} + (h : Reduced (τ := τ) (S := S) (x :: w)) : HeadOutside x.1 w := by + cases w with + | nil => simp + | cons y w => + rw [headOutside_cons] + exact Ne.symm (List.isChain_cons_cons.mp h.1).1 + +theorem map_closedSpan_mem {E F : Type*} [NormedAddCommGroup E] [NormedAddCommGroup F] + [NormedSpace ℂ E] [NormedSpace ℂ F] (L : E →L[ℂ] F) (s : Set E) + (V : Submodule ℂ F) (hV : IsClosed (V : Set F)) + (hs : ∀ x ∈ s, L x ∈ V) {x : E} (hx : x ∈ (Submodule.span ℂ s).topologicalClosure) : + L x ∈ V := by + exact (Submodule.topologicalClosure_minimal _ + (show Submodule.span ℂ s ≤ V.comap L.toLinearMap from Submodule.span_le.mpr hs) + (hV.preimage L.continuous)) hx + +theorem mul_reducedVector_mem (hτ : τ 1 = 1) {i : ι} {a : A} (ha : a ∈ S i) + {w : List (ι × A)} (hw : Reduced (τ := τ) (S := S) w) : + τ.gnsStarAlgHom a (gnsVector τ (wordValue w)) ∈ reducedSpace τ S := by + rw [gnsStarAlgHom_vector] + by_cases ho : HeadOutside i w + · rw [gnsVector_mul_split] + apply (reducedSpace τ S).add_mem + ((reducedSpace τ S).smul_mem _ (reducedVector_mem hw)) + exact reducedVector_mem (hw.cons_of_headOutside ho + ⟨centerOf_mem ha, centerOf_trace hτ a⟩) + · cases w with + | nil => exact (ho (headOutside_nil i)).elim + | cons x w => + have hi : x.1 = i := by simpa using ho + rw [wordValue_cons, ← mul_assoc, gnsVector_mul_split] + apply (reducedSpace τ S).add_mem + ((reducedSpace τ S).smul_mem _ (reducedVector_mem hw.tail)) + have hx : x.2 ∈ S i := hi ▸ hw.head.1 + exact reducedVector_mem (hw.tail.cons_of_headOutside (hi ▸ hw.tail_headOutside) + ⟨centerOf_mem (mul_mem ha hx), centerOf_trace hτ (a * x.2)⟩) + +theorem mul_reducedSpace_mem (hτ : τ 1 = 1) {i : ι} {a : A} (ha : a ∈ S i) + {x : τ.GNS} (hx : x ∈ reducedSpace τ S) : + τ.gnsStarAlgHom a x ∈ reducedSpace τ S := by + refine map_closedSpan_mem _ _ _ (Submodule.isClosed_topologicalClosure _) ?_ hx + rintro y ⟨w, hw, rfl⟩ + exact mul_reducedVector_mem hτ ha hw + +theorem create_mem_headSpace {i : ι} {a : A} (ha : a ∈ S i ∧ τ a = 0) + {x : τ.GNS} (hx : x ∈ tailSpace τ S i) : + τ.gnsStarAlgHom a x ∈ headSpace τ S i := by + refine map_closedSpan_mem _ _ _ (Submodule.isClosed_topologicalClosure _) ?_ hx + rintro y ⟨w, hw, ho, rfl⟩ + rw [gnsStarAlgHom_vector] + exact headVector_mem (hw.cons_of_headOutside ho ha) rfl + +theorem commute_projection_of_invariant {E : Type*} [NormedAddCommGroup E] + [InnerProductSpace ℂ E] [CompleteSpace E] (V : Submodule ℂ E) [V.HasOrthogonalProjection] + (L : E →L[ℂ] E) + (hL : ∀ x ∈ V, L x ∈ V) (hLs : ∀ x ∈ V, star L x ∈ V) : + Commute L V.starProjection := by + apply ContinuousLinearMap.ext + intro x + change L (V.starProjection x) = V.starProjection (L x) + symm + apply Submodule.eq_starProjection_of_mem_of_inner_eq_zero + (hL _ (Submodule.starProjection_apply_mem _ _)) + intro y hy + rw [← map_sub, ← ContinuousLinearMap.adjoint_inner_right] + exact Submodule.inner_left_of_mem_orthogonal (hLs y hy) + (Submodule.sub_starProjection_mem_orthogonal x) + +theorem copy_commutes_reducedProjection (hτ : τ 1 = 1) {i : ι} {a : A} (ha : a ∈ S i) : + Commute (τ.gnsStarAlgHom a) (reducedSpace τ S).starProjection := by + apply commute_projection_of_invariant + · intro x hx; exact mul_reducedSpace_mem hτ ha hx + · intro x hx + rw [← map_star] + exact mul_reducedSpace_mem hτ (star_mem ha) hx + +def reductionAlgebra (τ : A →ₚ[ℂ] ℂ) (V : Submodule ℂ τ.GNS) [V.HasOrthogonalProjection] : + StarSubalgebra ℂ A := + (StarSubalgebra.centralizer ℂ {V.starProjection}).comap τ.gnsStarAlgHom + +theorem mem_reductionAlgebra (V : Submodule ℂ τ.GNS) [V.HasOrthogonalProjection] (a : A) : + a ∈ reductionAlgebra τ V ↔ Commute (τ.gnsStarAlgHom a) V.starProjection := by + simp only [reductionAlgebra, StarSubalgebra.mem_comap, StarSubalgebra.mem_centralizer_iff, + Set.mem_singleton_iff, forall_eq, (isSelfAdjoint_starProjection V).star_eq, and_self] + exact eq_comm + +instance reductionAlgebra_closed (V : Submodule ℂ τ.GNS) [V.HasOrthogonalProjection] : + IsClosed (reductionAlgebra τ V : Set A) := by + have he : (reductionAlgebra τ V : Set A) = + {a | τ.gnsStarAlgHom a * V.starProjection = V.starProjection * τ.gnsStarAlgHom a} := by + ext a; exact mem_reductionAlgebra V a + rw [he] + exact isClosed_eq (by fun_prop) (by fun_prop) + +def compressedHom (V : Submodule ℂ τ.GNS) [V.HasOrthogonalProjection] : + reductionAlgebra τ V →⋆ₙₐ[ℂ] (τ.GNS →L[ℂ] τ.GNS) where + toFun a := τ.gnsStarAlgHom a * V.starProjection + map_zero' := by simp + map_add' a b := by simp [add_mul] + map_smul' c a := by simp + map_mul' a b := by + change τ.gnsStarAlgHom ((a : A) * b) * V.starProjection = _ + rw [map_mul] + have hb := (mem_reductionAlgebra V (b : A)).mp b.prop + have hp := V.isIdempotentElem_starProjection.eq + calc + (τ.gnsStarAlgHom (a:A) * τ.gnsStarAlgHom (b:A)) * V.starProjection = + τ.gnsStarAlgHom (a:A) * (τ.gnsStarAlgHom (b:A) * + (V.starProjection * V.starProjection)) := by rw [hp, mul_assoc] + _ = (τ.gnsStarAlgHom (a:A) * V.starProjection) * + (τ.gnsStarAlgHom (b:A) * V.starProjection) := by + calc + _ = τ.gnsStarAlgHom (a:A) * ((τ.gnsStarAlgHom (b:A) * V.starProjection) * + V.starProjection) := by simp only [mul_assoc] + _ = τ.gnsStarAlgHom (a:A) * ((V.starProjection * τ.gnsStarAlgHom (b:A)) * + V.starProjection) := congrArg (fun t => τ.gnsStarAlgHom (a:A) * (t * V.starProjection)) hb.eq + _ = _ := by simp only [mul_assoc] + map_star' a := by + change τ.gnsStarAlgHom (star (a : A)) * V.starProjection = _ + rw [star_mul, (isSelfAdjoint_starProjection V).star_eq, ← map_star] + exact (mem_reductionAlgebra V (star (a : A))).mp (star_mem a.prop) + +theorem compressedHom_injective (V : Submodule ℂ τ.GNS) [V.HasOrthogonalProjection] + (hV : gnsVector τ 1 ∈ V) (hf : ∀ x : A, τ (star x * x) = 0 → x = 0) : + Function.Injective (compressedHom (τ := τ) V) := by + intro a b hab + apply Subtype.ext + apply gnsVector_injective hf + have h := congrArg (fun L : τ.GNS →L[ℂ] τ.GNS => L (gnsVector τ 1)) hab + change τ.gnsStarAlgHom (a:A) (V.starProjection (gnsVector τ 1)) = + τ.gnsStarAlgHom (b:A) (V.starProjection (gnsVector τ 1)) at h + simpa only [Submodule.starProjection_eq_self_iff.mpr hV, gnsStarAlgHom_vector, mul_one] using h + +theorem norm_compressed (V : Submodule ℂ τ.GNS) [V.HasOrthogonalProjection] + (hV : gnsVector τ 1 ∈ V) (hf : ∀ x : A, τ (star x * x) = 0 → x = 0) + (a : A) (ha : Commute (τ.gnsStarAlgHom a) V.starProjection) : + ‖τ.gnsStarAlgHom a * V.starProjection‖ = ‖a‖ := by + exact NonUnitalStarAlgHom.norm_map (compressedHom (τ := τ) V) + (compressedHom_injective V hV hf) ⟨a, (mem_reductionAlgebra V a).mpr ha⟩ + +def creationOp (τ : A →ₚ[ℂ] ℂ) (S : ι → StarSubalgebra ℂ A) (i : ι) (a : A) := + τ.gnsStarAlgHom a * (tailSpace τ S i).starProjection + +def preservationOp (τ : A →ₚ[ℂ] ℂ) (S : ι → StarSubalgebra ℂ A) (i : ι) (a : A) := + (headSpace τ S i).starProjection * τ.gnsStarAlgHom a * (headSpace τ S i).starProjection + +def letterOp (τ : A →ₚ[ℂ] ℂ) (S : ι → StarSubalgebra ℂ A) (a : A) := + τ.gnsStarAlgHom a * (reducedSpace τ S).starProjection + +theorem head_mul_creation {i : ι} {a : A} (ha : a ∈ S i ∧ τ a = 0) : + (headSpace τ S i).starProjection * creationOp τ S i a = creationOp τ S i a := by + ext x + apply Submodule.starProjection_eq_self_iff.mpr + exact create_mem_headSpace ha (Submodule.starProjection_apply_mem _ _) + +theorem annihilation_mul_head {i : ι} {a : A} (ha : a ∈ S i ∧ τ a = 0) : + star (creationOp τ S i a) * (headSpace τ S i).starProjection = + star (creationOp τ S i a) := by + simpa only [star_mul, (isSelfAdjoint_starProjection _).star_eq] using + congrArg star (head_mul_creation ha) + +theorem head_mul_preservation (i : ι) (a : A) : + (headSpace τ S i).starProjection * preservationOp τ S i a = preservationOp τ S i a := by + simp only [preservationOp, ← mul_assoc, (headSpace τ S i).isIdempotentElem_starProjection.eq] + +theorem preservation_mul_head (i : ι) (a : A) : + preservationOp τ S i a * (headSpace τ S i).starProjection = preservationOp τ S i a := by + simp only [preservationOp, mul_assoc, (headSpace τ S i).isIdempotentElem_starProjection.eq] + +theorem head_mul_head_zero (hfree : ScalarFree τ S) (hτ : τ 1 = 1) {i j : ι} (hij : i ≠ j) : + (headSpace τ S i).starProjection * (headSpace τ S j).starProjection = 0 := by + ext x + apply (Submodule.starProjection_apply_eq_zero_iff _).mpr + exact Submodule.orthogonal_le (headSpace_le_tailSpace hij) + (headSpace_orthogonal_tail hfree hτ j (Submodule.starProjection_apply_mem _ _)) + +theorem letterOp_decomposition (hfree : ScalarFree τ S) (hτ : τ 1 = 1) + {i : ι} {a : A} (ha : a ∈ S i ∧ τ a = 0) (hsa : star a = a) : + letterOp τ S a = creationOp τ S i a + star (creationOp τ S i a) + + preservationOp τ S i a := by + let Q := (headSpace τ S i).starProjection + let T := (tailSpace τ S i).starProjection + let V := (reducedSpace τ S).starProjection + let L := τ.gnsStarAlgHom a + have hvq : V * Q = Q := by + ext x + exact Submodule.starProjection_eq_self_iff.mpr + (headSpace_le_reducedSpace i (Submodule.starProjection_apply_mem _ _)) + have hvl : V * L = L * V := (copy_commutes_reducedProjection hτ ha.1).symm.eq + have hsum : Q + T = V := head_add_tail_projection hfree hτ i + have hstar : star (creationOp τ S i a) = T * L := by + simp only [creationOp, star_mul, ← map_star, hsa, (isSelfAdjoint_starProjection _).star_eq] + rfl + have hsupport : T * L * Q = T * L := by + rw [← hstar, annihilation_mul_head ha] + change L * V = _ + calc + L * V = L * Q + L * T := by rw [← hsum, mul_add] + _ = (Q * L * Q + T * L * Q) + L * T := by + congr 1 + rw [← add_mul, ← add_mul, hsum, hvl, mul_assoc, hvq] + _ = creationOp τ S i a + star (creationOp τ S i a) + preservationOp τ S i a := by + rw [hsupport, ← hstar] + dsimp only [creationOp, preservationOp, Q, T, L] + abel + +theorem annihilation_mul_creation_zero (hfree : ScalarFree τ S) (hτ : τ 1 = 1) + {i j : ι} (hij : i ≠ j) {a b : A} + (ha : a ∈ S i ∧ τ a = 0) (hb : b ∈ S j ∧ τ b = 0) : + star (creationOp τ S i a) * creationOp τ S j b = 0 := by + calc + _ = (star (creationOp τ S i a) * (headSpace τ S i).starProjection) * + ((headSpace τ S j).starProjection * creationOp τ S j b) := by + rw [annihilation_mul_head ha, head_mul_creation hb] + _ = 0 := by + simp only [mul_assoc, ← mul_assoc (headSpace τ S i).starProjection, + head_mul_head_zero hfree hτ hij, zero_mul, mul_zero] + +theorem preservation_mul_creation_zero (hfree : ScalarFree τ S) (hτ : τ 1 = 1) + {i j : ι} (hij : i ≠ j) {a b : A} (hb : b ∈ S j ∧ τ b = 0) : + preservationOp τ S i a * creationOp τ S j b = 0 := by + calc + _ = (preservationOp τ S i a * (headSpace τ S i).starProjection) * + ((headSpace τ S j).starProjection * creationOp τ S j b) := by + rw [preservation_mul_head, head_mul_creation hb] + _ = 0 := by + simp only [mul_assoc, ← mul_assoc (headSpace τ S i).starProjection, + head_mul_head_zero hfree hτ hij, zero_mul, mul_zero] + +theorem annihilation_mul_preservation_zero (hfree : ScalarFree τ S) (hτ : τ 1 = 1) + {i j : ι} (hij : i ≠ j) {a b : A} (ha : a ∈ S i ∧ τ a = 0) : + star (creationOp τ S i a) * preservationOp τ S j b = 0 := by + calc + _ = (star (creationOp τ S i a) * (headSpace τ S i).starProjection) * + ((headSpace τ S j).starProjection * preservationOp τ S j b) := by + rw [annihilation_mul_head ha, head_mul_preservation] + _ = 0 := by + simp only [mul_assoc, ← mul_assoc (headSpace τ S i).starProjection, + head_mul_head_zero hfree hτ hij, zero_mul, mul_zero] + +theorem preservation_mul_preservation_zero (hfree : ScalarFree τ S) (hτ : τ 1 = 1) + {i j : ι} (hij : i ≠ j) (a b : A) : + preservationOp τ S i a * preservationOp τ S j b = 0 := by + calc + _ = (preservationOp τ S i a * (headSpace τ S i).starProjection) * + ((headSpace τ S j).starProjection * preservationOp τ S j b) := by + rw [preservation_mul_head, head_mul_preservation] + _ = 0 := by + simp only [mul_assoc, ← mul_assoc (headSpace τ S i).starProjection, + head_mul_head_zero hfree hτ hij, zero_mul, mul_zero] + +namespace FreePartitions + +variable {r d : ℕ} (P : FreePartitions τ r d) + +def centered (j : Fin r) (a : Fin d) : A := P.e j a - (d : ℂ)⁻¹ • 1 + +omit [StarOrderedRing A] in +@[simp] theorem centered_star (j : Fin r) (a : Fin d) : + star (P.centered j a) = P.centered j a := by + simp only [centered, star_sub, P.selfadjoint, star_smul, star_inv₀, star_natCast, + star_one] + +omit [StarOrderedRing A] in +theorem centered_mem (j : Fin r) (a : Fin d) : P.centered j a ∈ P.S j := + sub_mem (P.mem j a) ((P.S j).smul_mem (one_mem _) _) + +omit [StarOrderedRing A] in +@[simp] theorem centered_trace (hτ : τ 1 = 1) (j : Fin r) (a : Fin d) : + τ (P.centered j a) = 0 := by + simp [centered, map_sub, map_smul, P.trace, hτ] + +omit [StarOrderedRing A] in +theorem centered_gram (hτ : τ 1 = 1) (j : Fin r) (a b : Fin d) : + τ (star (P.centered j a) * P.centered j b) = + (if a = b then (d : ℂ)⁻¹ else 0) - (d : ℂ)⁻¹ * (d : ℂ)⁻¹ := by + rw [P.centered_star] + simp only [centered, sub_mul, mul_sub, smul_mul_assoc, mul_smul_comm, + mul_one, one_mul, map_sub, map_smul, P.trace, P.mul, hτ, smul_eq_mul] + split_ifs <;> simp [P.trace] + +theorem inner_create_row (hτ : τ 1 = 1) (j : Fin r) (ξ : Fin d → τ.GNS) + (hξ : ∀ a, ξ a ∈ tailSpace τ P.S j) : + ⟪∑ a, τ.gnsStarAlgHom (P.centered j a) (ξ a), + ∑ a, τ.gnsStarAlgHom (P.centered j a) (ξ a)⟫_ℂ = + (d : ℂ)⁻¹ * (∑ a, ⟪ξ a, ξ a⟫_ℂ) - + ((d : ℂ)⁻¹ * (d : ℂ)⁻¹) * ⟪∑ a, ξ a, ∑ a, ξ a⟫_ℂ := by + classical + simp only [sum_inner, inner_sum] + have heq : ∀ a b : Fin d, + ⟪τ.gnsStarAlgHom (P.centered j a) (ξ a), + τ.gnsStarAlgHom (P.centered j b) (ξ b)⟫_ℂ = + (if a = b then (d : ℂ)⁻¹ * ⟪ξ a, ξ b⟫_ℂ else 0) - + ((d : ℂ)⁻¹ * (d : ℂ)⁻¹) * ⟪ξ a, ξ b⟫_ℂ := by + intro a b + rw [inner_create P.free hτ ⟨P.centered_mem j a, P.centered_trace hτ j a⟩ + ⟨P.centered_mem j b, P.centered_trace hτ j b⟩ (hξ a) (hξ b), + P.centered_gram hτ, sub_mul] + split_ifs <;> simp + simp only [heq, Finset.sum_sub_distrib, Finset.mul_sum] + simp + +theorem norm_create_row_sq (hτ : τ 1 = 1) (j : Fin r) (ξ : Fin d → τ.GNS) + (hξ : ∀ a, ξ a ∈ tailSpace τ P.S j) : + ‖∑ a, τ.gnsStarAlgHom (P.centered j a) (ξ a)‖ ^ 2 = + (d : ℝ)⁻¹ * (∑ a, ‖ξ a‖ ^ 2) - + ((d : ℝ)⁻¹ * (d : ℝ)⁻¹) * ‖∑ a, ξ a‖ ^ 2 := by + have h := P.inner_create_row hτ j ξ hξ + simp only [inner_self_eq_norm_sq_to_K] at h + apply Complex.ofReal_injective + push_cast + simpa only [RCLike.ofReal_eq_complex_ofReal, Complex.ofReal_sum, Complex.ofReal_pow] using h + +end FreePartitions + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FreeWords.lean b/lean/OAI/Analysis/FreeWords/FreeWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae754ef9032e1866b7158b9655e1f380288acd1a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FreeWords.lean @@ -0,0 +1,133 @@ +import Mathlib +import OAI.Analysis.FreeWords.GNSCutNorms +import OAI.Analysis.FreeWords.GNSProjectionRemainder +import OAI.Analysis.FreeWords.NumericCuts + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder InnerProductSpace + +noncomputable section + +def freeWordsError (r : ℕ) : ℝ := + (2*r+1)*r.factorial+(r.factorial:ℝ)*2^r*(3*r+1) + +theorem freeWordsError_nonneg (r : ℕ) : 0 ≤ freeWordsError r := by + unfold freeWordsError + positivity + +theorem decay_pow (d m : ℕ) : decay d^m = (d:ℝ)^(-(m:ℝ)/2) := by + rw [decay, Real.sqrt_eq_rpow, ← Real.rpow_natCast, + ← Real.rpow_mul (inv_nonneg.mpr (Nat.cast_nonneg d)), Real.inv_rpow (Nat.cast_nonneg d), + ← Real.rpow_neg (Nat.cast_nonneg d)] + congr 1 + ring + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {r d : ℕ} + +namespace FreePartitions + +variable (P : FreePartitions τ r d) + +theorem centeredSum_bound (hτ : FaithfulTracial τ) (hr : 1 ≤ r) (hd : 1 ≤ d) + (W : Multiset (Fin d)) : + ‖P.centeredSum W‖ ≤ 5*Real.sqrt ((r-1).factorial:ℝ)*decay d^(r-1) + + (2*r+1:ℝ)*r.factorial*decay d^r := by + obtain ⟨m, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : r ≠ 0) + have h := P.centeredSum_cut_bound hτ (by omega) W + have hnum := sum_cuts_numeric m (decay_nonneg d) (decay_le_one hd) + simpa only [Nat.succ_eq_add_one, Nat.add_sub_cancel, Nat.cast_add, Nat.cast_one] using h.trans hnum + +theorem forwardSum_bound (hτ : FaithfulTracial τ) (hr : 1 ≤ r) (hd : 1 ≤ d) + (W : Multiset (Fin d)) : + ‖P.forwardSum W‖ ≤ 5*Real.sqrt ((r-1).factorial:ℝ)*decay d^(r-1) + + freeWordsError r*decay d^r := by + have hc := P.centeredSum_bound hτ hr hd W + have hrem := P.forwardSum_remainder hτ hd W + have ht := norm_add_le (P.centeredSum W) (P.forwardSum W-P.centeredSum W) + rw [add_sub_cancel] at ht + unfold freeWordsError + nlinarith + +omit [StarOrderedRing A] in +theorem wordSum_eq_star_forwardSum (W : Sym (Fin d) r) : + wordSum P W = star (P.forwardSum (W:Multiset (Fin d))) := by + classical + have hstar (l : List A) (hl : ∀ x ∈ l, star x = x) : star l.prod = l.reverse.prod := by + induction l with + | nil => simp + | cons x l ih => + simp only [List.prod_cons, star_mul, List.reverse_cons, List.prod_append, + List.prod_cons, List.prod_nil, mul_one] + rw [hl x List.mem_cons_self, ih (fun y hy => hl y (List.mem_cons_of_mem x hy))] + simp only [wordSum, forwardSum, Finset.sum_filter, star_sum] + apply Finset.sum_congr rfl + intro a ha + simp only [tupleLabels] + split_ifs with h + · simp only [h, ite_true] + exact (hstar _ (by + intro x hx + obtain ⟨j, rfl⟩ := List.mem_ofFn.mp hx + exact P.selfadjoint j (a j))).symm + · simp only [h, ite_false, star_zero] + +theorem wordSum_bound (hτ : FaithfulTracial τ) (hr : 1 ≤ r) (hd : 1 ≤ d) + (W : Sym (Fin d) r) : + ‖wordSum P W‖ ≤ 5*Real.sqrt ((r-1).factorial:ℝ)*decay d^(r-1) + + freeWordsError r*decay d^r := by + rw [P.wordSum_eq_star_forwardSum] + exact (norm_star _).le.trans (P.forwardSum_bound hτ hr hd _) + +end FreePartitions + +theorem free_projection_words (r : ℕ) (hr : 1 ≤ r) : + ∃ C : ℝ, 0 < C ∧ ∃ d₀ : ℕ, r ≤ d₀ ∧ + ∀ d : ℕ, d₀ ≤ d → ∀ (A : Type*) [CStarAlgebra A] [PartialOrder A] + [StarOrderedRing A] (τ : A →ₚ[ℂ] ℂ), FaithfulTracial τ → + ∀ (P : FreePartitions τ r d) (W : Sym (Fin d) r), + ‖wordSum P W‖ ≤ + (if (W : Multiset (Fin d)).Nodup then + 7 * Real.sqrt ((r - 1).factorial : ℝ) else C) * + (d : ℝ) ^ (-((r - 1 : ℕ) : ℝ) / 2) := by + let K := freeWordsError r + have hK : 0 ≤ K := freeWordsError_nonneg r + have hS : 1 ≤ Real.sqrt ((r-1).factorial:ℝ) := Real.one_le_sqrt.mpr + (by exact_mod_cast Nat.factorial_pos (r-1)) + obtain ⟨n, hn⟩ := exists_nat_ge (K^2) + refine ⟨7*Real.sqrt ((r-1).factorial:ℝ), by nlinarith, max r n, le_max_left _ _, ?_⟩ + intro d hd A instA instO instS τ hτ P W + have hd1 : 1 ≤ d := hr.trans ((le_max_left r n).trans hd) + have hd0 : (0:ℝ) < d := by exact_mod_cast hd1 + have hKd : K^2 ≤ (d:ℝ) := hn.trans (by exact_mod_cast (le_max_right r n).trans hd) + have hKs : (K*decay d)^2 ≤ 1 := by + rw [mul_pow, decay_sq] + exact (mul_inv_le_iff₀ hd0).mpr (by simpa using hKd) + have hKt : K*decay d ≤ 1 := (sq_le_sq₀ (mul_nonneg hK (decay_nonneg d)) zero_le_one).mp + (by simpa using hKs) + have hp : decay d^r = decay d^(r-1)*decay d := by + conv_lhs => rw [show r=(r-1)+1 by omega] + rw [pow_succ] + have hb := P.wordSum_bound hτ hr hd1 W + rw [hp] at hb + simp only [ite_self] + rw [← decay_pow] + apply hb.trans + change 5*Real.sqrt ((r-1).factorial:ℝ)*decay d^(r-1) + K*(decay d^(r-1)*decay d) ≤ _ + calc + _ = (5*Real.sqrt ((r-1).factorial:ℝ)+K*decay d)*decay d^(r-1) := by ring + _ ≤ (7*Real.sqrt ((r-1).factorial:ℝ))*decay d^(r-1) := + mul_le_mul_of_nonneg_right (by nlinarith) (pow_nonneg (decay_nonneg d) _) + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/FullThroughLabel.lean b/lean/OAI/Analysis/FreeWords/FullThroughLabel.lean new file mode 100644 index 0000000000000000000000000000000000000000..788ab2d1adfcc8a95ab35f27f4a61e4528a2ce05 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/FullThroughLabel.lean @@ -0,0 +1,57 @@ +import Mathlib +import OAI.Analysis.FreeWords.FreeWords +import OAI.Analysis.FreeWords.ThroughLabel + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +universe u + +theorem free_words_through_label : + ∃ C : ℕ → ℝ, (∀ r, 0 < C r) ∧ + ∀ N : ℕ, 1 ≤ N → ∃ d₀ : ℕ, N ≤ d₀ ∧ + ∀ d : ℕ, d₀ ≤ d → + (∀ r : ℕ, 1 ≤ r → r ≤ N → + ∀ (A : Type u) [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + (τ : A →ₚ[ℂ] ℂ), FaithfulTracial τ → + ∀ (P : FreePartitions τ r d) (W : Sym (Fin d) r), + ‖wordSum P W‖ ≤ KKThroughLabel.beta C d r W) ∧ + (∀ r : ℕ, 1 ≤ r → r ≤ N → ∀ a : Fin d, + KKThroughLabel.throughSum C d r a ≤ 64) := by + have h : ∀ r : ℕ, ∃ C : ℝ, 0 < C ∧ ∃ D : ℕ, r ≤ D ∧ + ∀ d : ℕ, D ≤ d → 1 ≤ r → + ∀ (A : Type u) [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + (τ : A →ₚ[ℂ] ℂ), FaithfulTracial τ → + ∀ (P : FreePartitions τ r d) (W : Sym (Fin d) r), + ‖wordSum P W‖ ≤ + (if (W : Multiset (Fin d)).Nodup then 7*Real.sqrt ((r-1).factorial:ℝ) + else C) * (d:ℝ)^(-((r-1:ℕ):ℝ)/2) := by + intro r + by_cases hr : 1 ≤ r + · obtain ⟨C, hC, D, hD, hb⟩ := free_projection_words r hr + exact ⟨C, hC, D, hD, fun d hd _ => hb d hd⟩ + · exact ⟨1, zero_lt_one, r, le_rfl, fun _ _ hr' => (hr hr').elim⟩ + choose C hC D hD hbound using h + refine ⟨C, hC, ?_⟩ + intro N hN + obtain ⟨d₀, hd₀, hthreshold, hsum⟩ := KKThroughLabel.through_label C D N hN + refine ⟨d₀, (hD N).trans (hthreshold N hN le_rfl), ?_⟩ + intro d hd + constructor + · intro r hr hrN A instA instO instS τ hτ P W + exact hbound r d ((hthreshold r hr hrN).trans hd) hr A τ hτ P W + · exact hsum d hd + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/GNSCutBridge.lean b/lean/OAI/Analysis/FreeWords/GNSCutBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..b40d92d4e5768f2c7dae8a9f214cafcbf096b607 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/GNSCutBridge.lean @@ -0,0 +1,125 @@ +import Mathlib +import OAI.Analysis.FreeWords.CutAlgebra +import OAI.Analysis.FreeWords.FreeWordCore +import OAI.Analysis.FreeWords.TupleCombinatorics + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder InnerProductSpace + +noncomputable section + +variable {A ι : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S : ι → StarSubalgebra ℂ A} + +theorem letterOp_product {κ : Type*} (f : κ → A) + (hf : ∀ i, Commute (τ.gnsStarAlgHom (f i)) (reducedSpace τ S).starProjection) + (w : List κ) (hw : w ≠ []) : + (w.map (fun i => letterOp τ S (f i))).prod = + letterOp τ S ((w.map f).prod) := by + let V := reducedSpace τ S + let g : κ → reductionAlgebra τ V := fun i => ⟨f i, (mem_reductionAlgebra V _).mpr (hf i)⟩ + have hn : w.map g ≠ [] := by simpa using hw + calc + _ = ((w.map g).map (compressedHom V)).prod := by + simp only [List.map_map] + rfl + _ = compressedHom V ((w.map g).prod) := List.prod_hom_nonempty _ hn + _ = _ := by + change τ.gnsStarAlgHom (((w.map g).prod : reductionAlgebra τ V) : A) * + V.starProjection = _ + have h : (((w.map g).prod : reductionAlgebra τ V) : A) = (w.map f).prod := by + change (reductionAlgebra τ V).subtype ((w.map g).prod) = _ + rw [map_list_prod, List.map_map] + rfl + rw [h] + rfl + +namespace FreePartitions + +variable {r d : ℕ} (P : FreePartitions τ r d) + +def create (j : Fin r) (a : Fin d) := creationOp τ P.S j (P.centered j a) + +def annihilate (j : Fin r) (a : Fin d) := star (P.create j a) + +def preserve (j : Fin r) (a : Fin d) := preservationOp τ P.S j (P.centered j a) + +def letter (j : Fin r) (a : Fin d) := letterOp τ P.S (P.centered j a) + +theorem letter_eq (hτ : τ 1 = 1) (j : Fin r) (a : Fin d) : + P.letter j a = P.create j a + P.annihilate j a + P.preserve j a := + letterOp_decomposition P.free hτ ⟨P.centered_mem j a, P.centered_trace hτ j a⟩ + (P.centered_star j a) + +theorem cutCompatible (hτ : τ 1 = 1) (a : Fin r → Fin d) {i j : Fin r} (hij : i ≠ j) : + CutCompatible (fun j => P.create j (a j)) (fun j => P.annihilate j (a j)) + (fun j => P.preserve j (a j)) i j := by + have hi := And.intro (P.centered_mem i (a i)) (P.centered_trace hτ i (a i)) + have hj := And.intro (P.centered_mem j (a j)) (P.centered_trace hτ j (a j)) + exact ⟨annihilation_mul_creation_zero P.free hτ hij hi hj, + preservation_mul_creation_zero P.free hτ hij hj, + annihilation_mul_preservation_zero P.free hτ hij hi, + preservation_mul_preservation_zero P.free hτ hij _ _⟩ + +theorem product_letter_eq_cuts (hτ : τ 1 = 1) (a : Fin r → Fin d) : + (List.ofFn (fun j => P.letter j (a j))).prod = + (∑ q : Fin (r+1), noPresCut (fun j => P.create j (a j)) + (fun j => P.annihilate j (a j)) q) + + ∑ j : Fin r, presCut (fun j => P.create j (a j)) + (fun j => P.annihilate j (a j)) (fun j => P.preserve j (a j)) j := by + have hchain : (List.ofFn (id : Fin r → Fin r)).IsChain + (CutCompatible (fun j => P.create j (a j)) (fun j => P.annihilate j (a j)) + (fun j => P.preserve j (a j))) := by + apply List.Pairwise.isChain + apply List.Pairwise.imp (fun hij => P.cutCompatible hτ a hij) + exact List.nodup_ofFn.mpr Function.injective_id + rw [← cutSum_eq_cuts, ← product_eq_cutSum _ _ _ _ hchain] + simp only [List.map_ofFn, id_eq, Function.comp_def, P.letter_eq hτ] + +def centeredSum (W : Multiset (Fin d)) : A := + ∑ a : Fin r → Fin d, if tupleLabels a = W then + (List.ofFn (fun j => P.centered j (a j))).prod else 0 + +theorem centeredSum_mem_reduction (hτ : τ 1 = 1) (W : Multiset (Fin d)) : + P.centeredSum W ∈ reductionAlgebra τ (reducedSpace τ P.S) := by + apply sum_mem + intro a ha + split_ifs + · apply list_prod_mem + intro x hx + obtain ⟨j, rfl⟩ := List.mem_ofFn.mp hx + exact (mem_reductionAlgebra _ _).mpr + (copy_commutes_reducedProjection hτ (P.centered_mem j (a j))) + · exact zero_mem _ + +theorem norm_centeredSum (hτ : FaithfulTracial τ) (hr : r ≠ 0) (W : Multiset (Fin d)) : + ‖P.centeredSum W‖ = + ‖∑ a : Fin r → Fin d, if tupleLabels a = W then + (List.ofFn (fun j => P.letter j (a j))).prod else 0‖ := by + rw [← norm_compressed (reducedSpace τ P.S) vacuum_mem_reducedSpace hτ.2.2 + (P.centeredSum W) ((mem_reductionAlgebra _ _).mp (P.centeredSum_mem_reduction hτ.1 W))] + congr 1 + simp only [centeredSum, map_sum, Finset.sum_mul, apply_ite, map_zero, ite_mul, zero_mul] + apply Finset.sum_congr rfl + intro a ha + split_ifs + · have h := letterOp_product (fun j => P.centered j (a j)) + (fun j => copy_commutes_reducedProjection hτ.1 (P.centered_mem j (a j))) + (List.ofFn (id : Fin r → Fin r)) (by simpa using hr) + simpa only [List.map_ofFn, id_eq, Function.comp_def, letterOp, letter] using h.symm + · rfl + +end FreePartitions + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/GNSCutNorms.lean b/lean/OAI/Analysis/FreeWords/GNSCutNorms.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3b5d39959236ffa1e089a84a0e332e7f9d98a87 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/GNSCutNorms.lean @@ -0,0 +1,119 @@ +import Mathlib +import OAI.Analysis.FreeWords.FreeWordCore +import OAI.Analysis.FreeWords.CutNorms +import OAI.Analysis.FreeWords.GNSRows +import OAI.Analysis.FreeWords.GNSCutBridge + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {r d : ℕ} + +def decay (d : ℕ) : ℝ := Real.sqrt ((d:ℝ)⁻¹) + +theorem decay_nonneg (d : ℕ) : 0 ≤ decay d := Real.sqrt_nonneg _ + +theorem decay_sq (d : ℕ) : decay d ^ 2 = (d:ℝ)⁻¹ := Real.sq_sqrt (by positivity) + +theorem decay_le_one {d : ℕ} (hd : 1 ≤ d) : decay d ≤ 1 := by + apply (Real.sqrt_le_one).mpr + exact inv_le_one_of_one_le₀ (by exact_mod_cast hd) + +namespace FreePartitions + +variable (P : FreePartitions τ r d) + +theorem create_row (hτ : τ 1 = 1) (j : Fin r) : + RowSqBound (P.create j) (decay d ^ 2) := by + rw [decay_sq] + exact P.creation_row hτ j + +theorem annihilate_col (hτ : τ 1 = 1) (j : Fin r) : + ColSqBound (P.annihilate j) (decay d ^ 2) := + (P.create_row hτ j).star_col (sq_nonneg _) + +theorem noPresCut_norm (hτ : τ 1 = 1) (W : Multiset (Fin d)) (q : ℕ) (hq : q ≤ r) : + ‖∑ a : Fin r → Fin d, if tupleLabels a = W then + noPresCut (fun j => P.create j (a j)) (fun j => P.annihilate j (a j)) q else 0‖ ≤ + Real.sqrt ((q.factorial:ℝ) * (r-q).factorial) * decay d ^ r := by + obtain ⟨p, rfl⟩ := Nat.exists_eq_add_of_le hq + simpa only [Nat.add_sub_cancel_left] using + sum_noPresCut_norm p q W P.create P.annihilate (decay_nonneg d) + (P.create_row hτ) (P.annihilate_col hτ) + +theorem presCut_norm (hτ : τ 1 = 1) (W : Multiset (Fin d)) (j : Fin r) : + ‖∑ a : Fin r → Fin d, if tupleLabels a = W then + presCut (fun j => P.create j (a j)) (fun j => P.annihilate j (a j)) + (fun j => P.preserve j (a j)) j else 0‖ ≤ + (Real.sqrt ((j.val.factorial:ℝ) * (r-1-j).factorial) + + decay d ^ 2 * Real.sqrt (((j.val+1).factorial:ℝ) * (r-j).factorial)) * + decay d ^ (r-1) := by + rcases j with ⟨q, hq⟩ + obtain ⟨p, hr⟩ := Nat.exists_eq_add_of_le (show q+1 ≤ r by omega) + have hr' : r = q+(p+1) := by omega + clear hr + subst r + have hj : (⟨q,hq⟩ : Fin (q+(p+1))) = Fin.natAdd q 0 := by ext; simp + have h := sum_presCut_norm p q W P.create P.annihilate P.preserve (decay_nonneg d) + (P.create_row hτ) (P.annihilate_col hτ) + (fun c => τ.gnsStarAlgHom (P.e (Fin.natAdd q 0) c)) + (P.gns_projection _) (P.gns_projection_orthogonal _) (P.gns_projection_sum _) + (headSpace τ P.S (Fin.natAdd q 0)).starProjection + (headSpace τ P.S (Fin.natAdd q 0)).starProjection_norm_le (d:ℂ)⁻¹ + (P.preservation_eq_compress _) + rw [hj] + have hd : ‖(d:ℂ)⁻¹‖ = decay d ^ 2 := by rw [decay_sq]; simp + simpa only [hd, Fin.val_natAdd, Fin.val_zero, Nat.add_zero, + show q+(p+1)-1-q=p by omega, show q+(p+1)-q=p+1 by omega, + show q+(p+1)-1=q+p by omega, show q+p-q=p by omega] using h + +theorem centeredSum_cut_bound (hτ : FaithfulTracial τ) (hr : r ≠ 0) + (W : Multiset (Fin d)) : + ‖P.centeredSum W‖ ≤ + (∑ q : Fin (r+1), Real.sqrt ((q.val.factorial:ℝ) * (r-q).factorial) * decay d ^ r) + + ∑ j : Fin r, (Real.sqrt ((j.val.factorial:ℝ) * (r-1-j).factorial) + + decay d ^ 2 * Real.sqrt (((j.val+1).factorial:ℝ) * (r-j).factorial)) * + decay d ^ (r-1) := by + rw [P.norm_centeredSum hτ hr W] + have he : (∑ a : Fin r → Fin d, if tupleLabels a = W then + (List.ofFn (fun j => P.letter j (a j))).prod else 0) = + (∑ q : Fin (r+1), ∑ a : Fin r → Fin d, if tupleLabels a = W then + noPresCut (fun j => P.create j (a j)) (fun j => P.annihilate j (a j)) q else 0) + + ∑ j : Fin r, ∑ a : Fin r → Fin d, if tupleLabels a = W then + presCut (fun j => P.create j (a j)) (fun j => P.annihilate j (a j)) + (fun j => P.preserve j (a j)) j else 0 := by + rw [Finset.sum_comm (f := fun (q : Fin (r+1)) (a : Fin r → Fin d) => if tupleLabels a = W then + noPresCut (fun j => P.create j (a j)) (fun j => P.annihilate j (a j)) q else 0), + Finset.sum_comm (f := fun (j : Fin r) (a : Fin r → Fin d) => if tupleLabels a = W then + presCut (fun j => P.create j (a j)) (fun j => P.annihilate j (a j)) + (fun j => P.preserve j (a j)) j else 0), ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro a ha + split_ifs with h + · exact P.product_letter_eq_cuts hτ.1 a + · simp only [Finset.sum_const_zero, add_zero] + rw [he] + apply (norm_add_le _ _).trans + apply add_le_add + · apply (norm_sum_le _ _).trans + exact Finset.sum_le_sum (fun q _ => P.noPresCut_norm hτ.1 W q (by omega)) + · apply (norm_sum_le _ _).trans + exact Finset.sum_le_sum (fun j _ => P.presCut_norm hτ.1 W j) + +end FreePartitions + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/GNSProjectionRemainder.lean b/lean/OAI/Analysis/FreeWords/GNSProjectionRemainder.lean new file mode 100644 index 0000000000000000000000000000000000000000..d20c997f5c073a623c263096d0b0817cfb372522 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/GNSProjectionRemainder.lean @@ -0,0 +1,73 @@ +import Mathlib +import OAI.Analysis.FreeWords.GNSCutBridge +import OAI.Analysis.FreeWords.GNSSingleWords +import OAI.Analysis.FreeWords.ScalarExpansion + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {r d : ℕ} + +namespace FreePartitions + +variable (P : FreePartitions τ r d) + +theorem single_projection_remainder (hτ : FaithfulTracial τ) (hd : 1 ≤ d) + (a : Fin r → Fin d) : + ‖(List.ofFn (fun j => P.e j (a j))).prod - + (List.ofFn (fun j => P.centered j (a j))).prod‖ ≤ + (2:ℝ)^r*(3*r+1)*decay d^r := by + have hn : (List.ofFn (id : Fin r → Fin r)).Nodup := + List.nodup_ofFn.mpr Function.injective_id + have hc : ‖(d:ℂ)⁻¹‖ = decay d^2 := by rw [decay_sq]; simp + have h := projection_word_remainder (f := fun j => P.centered j (a j)) + (List.ofFn (id : Fin r → Fin r)) hn (decay_nonneg d) (decay_le_one hd) hc + (IsStarProjection.norm_le 1 (IsStarProjection.one A)) + (fun s hs hsn => P.single_centered_word_norm hτ hd a s hsn + (List.Pairwise.isChain (hn.sublist hs))) + simpa only [List.length_ofFn, List.map_ofFn, Function.comp_def, id_eq, + centered, add_sub_cancel] using h + +def forwardSum (W : Multiset (Fin d)) : A := + ∑ a : Fin r → Fin d, if tupleLabels a = W then + (List.ofFn (fun j => P.e j (a j))).prod else 0 + +theorem forwardSum_remainder (hτ : FaithfulTracial τ) (hd : 1 ≤ d) + (W : Multiset (Fin d)) : + ‖P.forwardSum W - P.centeredSum W‖ ≤ + (r.factorial:ℝ)*(2:ℝ)^r*(3*r+1)*decay d^r := by + classical + have he : P.forwardSum W - P.centeredSum W = + ∑ a ∈ tupleFiber r W, ((List.ofFn (fun j => P.e j (a j))).prod - + (List.ofFn (fun j => P.centered j (a j))).prod) := by + simp only [forwardSum, centeredSum, tupleFiber, Finset.sum_filter, ← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro a ha + split_ifs <;> simp + rw [he] + calc + _ ≤ ∑ a ∈ tupleFiber r W, (2:ℝ)^r*(3*r+1)*decay d^r := + norm_sum_le_of_le _ (fun a _ => P.single_projection_remainder hτ hd a) + _ = ((tupleFiber r W).card:ℝ)*((2:ℝ)^r*(3*r+1)*decay d^r) := by simp + _ ≤ (r.factorial:ℝ)*((2:ℝ)^r*(3*r+1)*decay d^r) := + mul_le_mul_of_nonneg_right (by exact_mod_cast tupleFiber_card r W) + (mul_nonneg (by positivity) (pow_nonneg (decay_nonneg d) r)) + _ = _ := by ring + +end FreePartitions + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/GNSQuotient.lean b/lean/OAI/Analysis/FreeWords/GNSQuotient.lean new file mode 100644 index 0000000000000000000000000000000000000000..799fd09bb660a508973aec747a9c771eb6a21807 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/GNSQuotient.lean @@ -0,0 +1,167 @@ +import Mathlib +import OAI.Analysis.FreeWords.UltraTrace + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace.seqOrder + +attribute [local instance] KKUltraTrace.seqSOR + +open scoped InnerProductSpace + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +theorem tracial_null_right (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y : A, τ (x*y) = τ (y*x)) (x : A) + (hx : τ (star x*x) = 0) (b : A) : τ (star (x*b) * (x*b)) = 0 := by + apply le_antisymm _ (τ.map_nonneg (star_mul_self_nonneg _)) + calc + τ (star (x*b) * (x*b)) = τ (x * (b * star b) * star x) := by + rw [htr (star (x*b)) (x*b), star_mul] + congr 1 + noncomm_ring + _ ≤ τ (‖b * star b‖ • (x * star x)) := + τ.monotone' (CStarAlgebra.star_right_conjugate_le_norm_smul x (b * star b)) + _ = 0 := by simp [← Complex.coe_smul, htr x (star x), hx] + +def gnsQuotient (τ : A →ₚ[ℂ] ℂ) : StarSubalgebra ℂ (τ.GNS →L[ℂ] τ.GNS) := + τ.gnsStarAlgHom.range.topologicalClosure + +instance gnsQuotient_closed (τ : A →ₚ[ℂ] ℂ) : + IsClosed (gnsQuotient τ : Set (τ.GNS →L[ℂ] τ.GNS)) := isClosed_closure + +@[instance_reducible] def quotientOrder (τ : A →ₚ[ℂ] ℂ) : PartialOrder (gnsQuotient τ) := + CStarAlgebra.spectralOrder _ + +attribute [local instance] KKUltraTrace.quotientOrder + +@[instance_reducible] def quotientLE (τ : A →ₚ[ℂ] ℂ) : LE (gnsQuotient τ) := (quotientOrder τ).toLE + +attribute [local instance] KKUltraTrace.quotientLE + +@[instance_reducible] def quotientPreorder (τ : A →ₚ[ℂ] ℂ) : Preorder (gnsQuotient τ) := (quotientOrder τ).toPreorder + +attribute [local instance] KKUltraTrace.quotientPreorder + +theorem quotientSOR (τ : A →ₚ[ℂ] ℂ) : StarOrderedRing (gnsQuotient τ) := + CStarAlgebra.spectralOrderedRing _ + +attribute [local instance] KKUltraTrace.quotientSOR + +def gnsExpectation (τ : A →ₚ[ℂ] ℂ) (x : τ.GNS →L[ℂ] τ.GNS) : ℂ := + ⟪gnsVector τ 1, x (gnsVector τ 1)⟫_ℂ + +@[simp] theorem gnsExpectation_image (τ : A →ₚ[ℂ] ℂ) (a : A) : + gnsExpectation τ (τ.gnsStarAlgHom a) = τ a := by + rw [gnsExpectation, gnsStarAlgHom_vector, mul_one, gnsVector_inner, star_one, one_mul] + +theorem continuous_gnsExpectation (τ : A →ₚ[ℂ] ℂ) : Continuous (gnsExpectation τ) := by + unfold gnsExpectation + fun_prop + +def gnsQuotientState (τ : A →ₚ[ℂ] ℂ) : gnsQuotient τ →ₚ[ℂ] ℂ where + toFun x := gnsExpectation τ x.1 + map_add' x y := by simp [gnsExpectation, inner_add_right] + map_smul' c x := by simp [gnsExpectation] + monotone' x y hxy := by + obtain ⟨v, hv⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp (sub_nonneg.mpr hxy) + apply sub_nonneg.mp + change 0 ≤ ⟪gnsVector τ 1, y.1 (gnsVector τ 1)⟫_ℂ - + ⟪gnsVector τ 1, x.1 (gnsVector τ 1)⟫_ℂ + rw [← inner_sub_right] + have he : y.1 (gnsVector τ 1) - x.1 (gnsVector τ 1) = + (star v.1) (v.1 (gnsVector τ 1)) := + congrArg (fun z : gnsQuotient τ => z.1 (gnsVector τ 1)) hv + rw [he] + change 0 ≤ ⟪gnsVector τ 1, v.1.adjoint (v.1 (gnsVector τ 1))⟫_ℂ + rw [ContinuousLinearMap.adjoint_inner_right, ← inner_self_ofReal_re] + exact Complex.zero_le_real.mpr (inner_self_nonneg (𝕜 := ℂ) (x := v.1 (gnsVector τ 1))) + +@[simp] theorem gnsQuotientState_star_mul (τ : A →ₚ[ℂ] ℂ) (x : gnsQuotient τ) : + gnsQuotientState τ (star x * x) = + ⟪x.1 (gnsVector τ 1), x.1 (gnsVector τ 1)⟫_ℂ := by + change ⟪gnsVector τ 1, x.1.adjoint (x.1 (gnsVector τ 1))⟫_ℂ = _ + exact ContinuousLinearMap.adjoint_inner_right _ _ _ + +theorem gnsQuotientState_tracial (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y : A, τ (x * y) = τ (y * x)) (x y : gnsQuotient τ) : + gnsQuotientState τ (x * y) = gnsQuotientState τ (y * x) := by + have hb : ∀ a ∈ τ.gnsStarAlgHom.range, ∀ b ∈ τ.gnsStarAlgHom.range, + gnsExpectation τ (a * b) = gnsExpectation τ (b * a) := by + rintro a ⟨a', rfl⟩ b ⟨b', rfl⟩ + change gnsExpectation τ (τ.gnsStarAlgHom a' * τ.gnsStarAlgHom b') = + gnsExpectation τ (τ.gnsStarAlgHom b' * τ.gnsStarAlgHom a') + rw [← map_mul τ.gnsStarAlgHom, ← map_mul τ.gnsStarAlgHom, + gnsExpectation_image, gnsExpectation_image] + exact htr a' b' + have hc : ∀ b ∈ τ.gnsStarAlgHom.range.topologicalClosure, + ∀ a ∈ τ.gnsStarAlgHom.range, gnsExpectation τ (a * b) = gnsExpectation τ (b * a) := by + intro b hb' a ha + apply (closure_minimal (t := {z | gnsExpectation τ (a * z) = gnsExpectation τ (z * a)}) + (fun z hz => hb a ha z hz) ?_) hb' + exact isClosed_eq ((continuous_gnsExpectation τ).comp (continuous_const.mul continuous_id)) + ((continuous_gnsExpectation τ).comp (continuous_id.mul continuous_const)) + change gnsExpectation τ (x.1 * y.1) = gnsExpectation τ (y.1 * x.1) + apply (closure_minimal (t := {z | gnsExpectation τ (z * y.1) = gnsExpectation τ (y.1 * z)}) + (fun z hz => hc y.1 y.2 z hz) ?_) x.2 + exact isClosed_eq ((continuous_gnsExpectation τ).comp (continuous_id.mul continuous_const)) + ((continuous_gnsExpectation τ).comp (continuous_const.mul continuous_id)) + +theorem gnsQuotientState_faithful (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y : A, τ (x * y) = τ (y * x)) (x : gnsQuotient τ) + (hx : gnsQuotientState τ (star x * x) = 0) : x = 0 := by + have hzero : ∀ b : gnsQuotient τ, x.1 (b.1 (gnsVector τ 1)) = 0 := by + intro b + have hab := tracial_null_right (gnsQuotientState τ) (gnsQuotientState_tracial τ htr) x hx b + rw [gnsQuotientState_star_mul] at hab + exact (inner_self_eq_zero (𝕜 := ℂ)).mp hab + have hvec : ∀ a : A, x.1 (gnsVector τ a) = 0 := by + intro a + let b : gnsQuotient τ := ⟨τ.gnsStarAlgHom a, subset_closure ⟨a, rfl⟩⟩ + have hb := hzero b + simpa only [b, gnsStarAlgHom_vector, mul_one] using hb + apply Subtype.ext + ext ξ + induction ξ using UniformSpace.Completion.induction_on with + | hp => exact isClosed_eq x.1.continuous continuous_const + | ih a => exact hvec (τ.ofPreGNS a) + +theorem gnsQuotient_has_faithful_trace (τ : A →ₚ[ℂ] ℂ) (h1 : τ 1 = 1) + (htr : ∀ x y : A, τ (x * y) = τ (y * x)) : + ∃ T : gnsQuotient τ →ₚ[ℂ] ℂ, + (∀ x, T x = ⟪(τ.toPreGNS 1 : τ.GNS), x.1 (τ.toPreGNS 1 : τ.GNS)⟫_ℂ) ∧ + T 1 = 1 ∧ (∀ x y, T (x * y) = T (y * x)) ∧ + (∀ x, T (star x * x) = 0 → x = 0) := by + refine ⟨gnsQuotientState τ, fun _ => rfl, ?_, gnsQuotientState_tracial τ htr, + gnsQuotientState_faithful τ htr⟩ + change ⟪gnsVector τ 1, gnsVector τ 1⟫_ℂ = 1 + simpa only [gnsVector_inner, star_one, one_mul] using h1 + +end + +end KKUltraTrace +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/GNSRows.lean b/lean/OAI/Analysis/FreeWords/GNSRows.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1ac3259f2b983a2583b5373a6a5723532d27a2e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/GNSRows.lean @@ -0,0 +1,72 @@ +import Mathlib +import OAI.Analysis.FreeWords.FreeWordCore +import OAI.Analysis.FreeWords.OperatorRows + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {r d : ℕ} + +namespace FreePartitions + +variable (P : FreePartitions τ r d) + +theorem creation_row (hτ : τ 1 = 1) (j : Fin r) : + RowSqBound (fun a => creationOp τ P.S j (P.centered j a)) (d : ℝ)⁻¹ := by + intro x + let T := (tailSpace τ P.S j).starProjection + have hn a : ‖T (x a)‖ ≤ ‖x a‖ := + (T.le_opNorm _).trans (by + have hh := (tailSpace τ P.S j).starProjection_norm_le + calc + _ ≤ 1 * ‖x a‖ := mul_le_mul_of_nonneg_right hh (norm_nonneg _) + _ = _ := one_mul _) + change ‖∑ a, τ.gnsStarAlgHom (P.centered j a) (T (x a))‖ ^ 2 ≤ _ + rw [P.norm_create_row_sq hτ j (fun a => T (x a)) + (fun a => Submodule.starProjection_apply_mem _ _)] + apply (sub_le_self _ (by positivity)).trans + exact mul_le_mul_of_nonneg_left + (Finset.sum_le_sum (fun a _ => pow_le_pow_left₀ (norm_nonneg _) (hn a) 2)) + (inv_nonneg.mpr (Nat.cast_nonneg _)) + +theorem gns_projection (j : Fin r) (a : Fin d) : + IsStarProjection (τ.gnsStarAlgHom (P.e j a)) := by + constructor + · change τ.gnsStarAlgHom (P.e j a) * τ.gnsStarAlgHom (P.e j a) = _ + rw [← map_mul, P.mul] + simp + · change star (τ.gnsStarAlgHom (P.e j a)) = _ + rw [← map_star, P.selfadjoint] + +theorem gns_projection_orthogonal (j : Fin r) (a b : Fin d) (hab : a ≠ b) : + τ.gnsStarAlgHom (P.e j a) * τ.gnsStarAlgHom (P.e j b) = 0 := by + rw [← map_mul, P.mul, ite_eq_right hab, map_zero] + +theorem gns_projection_sum (j : Fin r) : + (∑ a, τ.gnsStarAlgHom (P.e j a)) = 1 := by + rw [← map_sum, P.sum, map_one] + +theorem preservation_eq_compress (j : Fin r) (a : Fin d) : + preservationOp τ P.S j (P.centered j a) = + (headSpace τ P.S j).starProjection * + (τ.gnsStarAlgHom (P.e j a) - (d : ℂ)⁻¹ • 1) * + (headSpace τ P.S j).starProjection := by + simp only [preservationOp, centered, map_sub, map_smul, map_one] + +end FreePartitions + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/GNSSingleWords.lean b/lean/OAI/Analysis/FreeWords/GNSSingleWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..58f838db4c777f9c8e36414327fa4f585aaffc12 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/GNSSingleWords.lean @@ -0,0 +1,94 @@ +import Mathlib +import OAI.Analysis.FreeWords.FreeWordCore +import OAI.Analysis.FreeWords.GNSCutBridge +import OAI.Analysis.FreeWords.GNSCutNorms +import OAI.Analysis.FreeWords.GNSRows +import OAI.Analysis.FreeWords.SingleCutNorm + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {r d : ℕ} + +namespace FreePartitions + +variable (P : FreePartitions τ r d) + +theorem create_norm (hτ : τ 1 = 1) (j : Fin r) (a : Fin d) : + ‖P.create j a‖ ≤ decay d := (P.create_row hτ j).norm_le (decay_nonneg d) a + +theorem annihilate_norm (hτ : τ 1 = 1) (j : Fin r) (a : Fin d) : + ‖P.annihilate j a‖ ≤ decay d := by + exact (norm_star (P.create j a)).le.trans (P.create_norm hτ j a) + +theorem preserve_norm (hd : 1 ≤ d) (j : Fin r) (a : Fin d) : + ‖P.preserve j a‖ ≤ 2 := by + change ‖preservationOp τ P.S j (P.centered j a)‖ ≤ _ + rw [P.preservation_eq_compress] + let Q := (headSpace τ P.S j).starProjection + have hQ : ‖Q‖ ≤ 1 := (headSpace τ P.S j).starProjection_norm_le + have hz : ‖(d:ℂ)⁻¹‖ ≤ 1 := by + rw [norm_inv, Complex.norm_natCast] + exact inv_le_one_of_one_le₀ (by exact_mod_cast hd) + have hL : ‖τ.gnsStarAlgHom (P.e j a) - (d:ℂ)⁻¹ • 1‖ ≤ 2 := by + apply (norm_sub_le _ _).trans + have hscalar : ‖(d:ℂ)⁻¹ • (1 : τ.GNS →L[ℂ] τ.GNS)‖ ≤ 1 := by + rw [norm_smul] + exact (mul_le_mul hz ContinuousLinearMap.norm_id_le (norm_nonneg _) zero_le_one).trans_eq (one_mul 1) + linarith [(P.gns_projection j a).norm_le] + calc + _ ≤ ‖Q‖ * ‖τ.gnsStarAlgHom (P.e j a) - (d:ℂ)⁻¹ • 1‖ * ‖Q‖ := + (norm_mul_le _ _).trans (mul_le_mul_of_nonneg_right (norm_mul_le _ _) (norm_nonneg _)) + _ ≤ 1 * 2 * 1 := mul_le_mul (mul_le_mul hQ hL (norm_nonneg _) zero_le_one) + hQ (norm_nonneg _) (by norm_num) + _ = _ := by norm_num + +theorem single_centered_word_norm (hτ : FaithfulTracial τ) (hd : 1 ≤ d) + (a : Fin r → Fin d) (w : List (Fin r)) (hw : w ≠ []) + (hchain : w.IsChain (· ≠ ·)) : + ‖(w.map (fun j => P.centered j (a j))).prod‖ ≤ + (3*w.length+1:ℝ) * decay d ^ (w.length-1) := by + have hc : w.IsChain (CutCompatible (fun j => P.create j (a j)) + (fun j => P.annihilate j (a j)) (fun j => P.preserve j (a j))) := + hchain.imp (fun _ _ hij => P.cutCompatible hτ.1 a hij) + have hprod : (w.map (fun j => P.letter j (a j))).prod = + cutSum (fun j => P.create j (a j)) (fun j => P.annihilate j (a j)) + (fun j => P.preserve j (a j)) w := by + rw [← product_eq_cutSum _ _ _ _ hc] + simp only [P.letter_eq hτ.1] + have hm : (w.map (fun j => P.centered j (a j))).prod ∈ + reductionAlgebra τ (reducedSpace τ P.S) := by + apply list_prod_mem + intro x hx + obtain ⟨j, hj, rfl⟩ := List.mem_map.mp hx + exact (mem_reductionAlgebra _ _).mpr + (copy_commutes_reducedProjection hτ.1 (P.centered_mem j (a j))) + have he := letterOp_product (fun j => P.centered j (a j)) + (fun j => copy_commutes_reducedProjection hτ.1 (P.centered_mem j (a j))) w hw + rw [← norm_compressed (reducedSpace τ P.S) vacuum_mem_reducedSpace hτ.2.2 + _ ((mem_reductionAlgebra _ _).mp hm)] + change ‖letterOp τ P.S ((w.map (fun j => P.centered j (a j))).prod)‖ ≤ _ + rw [← he] + change ‖(w.map (fun j => P.letter j (a j))).prod‖ ≤ _ + rw [hprod] + exact norm_cutSum_le_simple _ _ _ w ContinuousLinearMap.norm_id_le (decay_nonneg d) (decay_le_one hd) hw + (fun j => P.create_norm hτ.1 j (a j)) (fun j => P.annihilate_norm hτ.1 j (a j)) + (fun j => P.preserve_norm hd j (a j)) + +end FreePartitions + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/GramCounting.lean b/lean/OAI/Analysis/FreeWords/GramCounting.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a039f8630951e12aa619a2787cd3eacd3cacc4c --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/GramCounting.lean @@ -0,0 +1,54 @@ +import Mathlib +import OAI.Analysis.FreeWords.PermutationDistance +import OAI.Analysis.FreeWords.TensorGram + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators Matrix.Norms.L2Operator InnerProductSpace + +noncomputable section + +theorem permutationGram_count {r d : ℕ} (π σ : Equiv.Perm (Fin r)) : + permutationGram r d π σ=(d : ℂ)^Fintype.card (Quotient (matchingSetoid π σ)) := by + classical + rw [permutationGram_apply,matrixPair_apply] + have he (a : Fin r → Fin d) : + (∑ b,star (positionMatrix π a b)*positionMatrix σ a b)= + if a ∘ π=a ∘ σ then (1 : ℂ) else 0 := by + simp [positionMatrix,eq_comm] + simp_rw [he] + have hc := Fintype.card_congr (matchingEquiv (β := Fin d) π σ) + rw [Fintype.card_fun,Fintype.card_fin] at hc + rw [← Nat.cast_pow,← hc] + simp [Fintype.card_subtype] + +theorem permutationGram_distance {r d : ℕ} (π σ : Equiv.Perm (Fin r)) : + permutationGram r d π σ=(d : ℂ)^(r-permutationDistance π σ) := by + rw [permutationGram_count] + congr 1 + have h := permutationDistance_add_classes π σ + omega + +def distanceMatrix {ι : Type*} (δ : ι → ι → ℕ) (t : ℝ) : Matrix ι ι ℂ := + fun i j => (t : ℂ)^(δ i j) + +theorem permutationGram_scalar_distance {r d : ℕ} (hd : 0 < d) : + permutationGram r d=(d : ℂ)^r • distanceMatrix permutationDistance (d : ℝ)⁻¹ := by + ext π σ + have hd0 : (d : ℂ) ≠ 0 := by exact_mod_cast hd.ne' + have h := permutationDistance_add_classes π σ + simp only [Matrix.smul_apply,smul_eq_mul,distanceMatrix,Complex.ofReal_inv,Complex.ofReal_natCast] + rw [permutationGram_count] + conv_rhs => lhs; rw [← h,pow_add] + simp [inv_pow,mul_comm,hd0] + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarEndpointLimits.lean b/lean/OAI/Analysis/FreeWords/HaarEndpointLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..516bb7383a11fc9caebf9ce229342f15b214a83a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarEndpointLimits.lean @@ -0,0 +1,92 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarEndpointLimitsDefinitions +import OAI.Analysis.FreeWords.HaarEndpoints + +namespace OAI + +noncomputable section + +namespace KKHaarEndpoints + +noncomputable section + +open Filter + +open scoped Topology + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] + +theorem haar_endpoint_limits : HaarEndpointLimits (A := A) := by + intro ι L τ B u h1 htr hH hC + have hp (j : ι) (k l : ℤ) : (u j^k).val*(u j^l).val=(u j^(k+l)).val := by simp [zpow_add] + have aux : ∀n:ℕ, ∀w:List (ℤ×A), w.length=n → CenteredPowerWord τ B w → + ∀k:ℤ,k≠0 → Tendsto (fun j => τ (powerWord (u j) w*(u j^k).val)) L (𝓝 0) := by + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro w hlen hc k hk + cases w with + | nil => simpa only [powerWord_nil,one_mul] using hH k hk + | cons z t => + have hz := hc z List.mem_cons_self + have ht : CenteredPowerWord τ B t := fun a ha => hc a (List.mem_cons_of_mem _ ha) + have hrot (j : ι) : τ (powerWord (u j) (z::t)*(u j^k).val)= + τ ((u j^(k+z.1)).val*z.2*powerWord (u j) t) := by + rw [powerWord_cons,htr] + congr 1 + rw [← hp] + simp only [mul_assoc] + simp_rw [hrot] + by_cases hsum : k+z.1=0 + · simp only [hsum,zpow_zero,OneMemClass.coe_one,one_mul] + induction t using List.reverseRecOn with + | nil => simpa only [powerWord_nil,mul_one,hz.2.2] using + (tendsto_const_nhds : Tendsto (fun _ : ι => (0:ℂ)) L (𝓝 0)) + | append_singleton v a unused => + have hv : CenteredPowerWord τ B v := by + intro b hb + exact ht b (List.mem_append_left _ hb) + have ha := ht a (List.mem_append_right _ (List.mem_singleton_self _)) + let d := a.2*z.2 + let d₀ := d-(τ d) • (1:A) + have hd₀ : d₀∈B ∧ τ d₀=0 := by + refine ⟨B.sub_mem (B.mul_mem ha.2.1 hz.2.1) (B.smul_mem B.one_mem _),?_⟩ + simp [d₀,map_sub,map_smul,h1] + have hvc : CenteredPowerWord τ B (v++[(a.1,d₀)]) := by + intro b hb + rcases List.mem_append.mp hb with hb | hb + · exact hv b hb + · have he := List.mem_singleton.mp hb + subst b + exact ⟨ha.1,hd₀⟩ + have hc0 := hC (v++[(a.1,d₀)]) (by simp) hvc + have hlenv : v.length τ ((u j^k).val)) L (𝓝 0)) → + (∀ w : List (ℤ×A),w≠[] → CenteredPowerWord τ B w → + Tendsto (fun j => τ (powerWord (u j) w)) L (𝓝 0)) → + ∀ w : List (ℤ×A),CenteredPowerWord τ B w → ∀ k : ℤ,k≠0 → + Tendsto (fun j => τ (powerWord (u j) w*(u j^k).val)) L (𝓝 0) + +end + +end KKHaarEndpoints +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarEndpoints.lean b/lean/OAI/Analysis/FreeWords/HaarEndpoints.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f9712bce6b711d58b956f463ae78c98b4f35ddf --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarEndpoints.lean @@ -0,0 +1,97 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarEndpointsDefinitions + +namespace OAI + +noncomputable section + +namespace KKHaarEndpoints + +noncomputable section + +variable {A : Type*} [Ring A] [StarRing A] + +@[simp] theorem powerWord_nil (u : unitary A) : powerWord u []=1 := rfl + +@[simp] theorem powerWord_cons (u : unitary A) (z : ℤ×A) (w : List (ℤ×A)) : + powerWord u (z::w)=(u^z.1).val*z.2*powerWord u w := rfl + +@[simp] theorem powerWord_append (u : unitary A) (v w : List (ℤ×A)) : + powerWord u (v++w)=powerWord u v*powerWord u w := by simp [powerWord] + +variable [Algebra ℂ A] + +theorem haar_endpoint_completion : HaarEndpointCompletion (A := A) := by + intro τ B u h1 htr hH hC + have hp (k l : ℤ) : (u^k).val*(u^l).val=(u^(k+l)).val := by simp [zpow_add] + have aux : ∀n:ℕ, ∀w:List (ℤ×A), w.length=n → CenteredPowerWord τ B w → + ∀k:ℤ,k≠0 → τ (powerWord u w*(u^k).val)=0 := by + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro w hlen hc k hk + cases w with + | nil => simpa only [powerWord_nil,one_mul] using hH k hk + | cons z t => + have hz := hc z List.mem_cons_self + have ht : CenteredPowerWord τ B t := fun a ha => hc a (List.mem_cons_of_mem _ ha) + have hrot : τ (powerWord u (z::t)*(u^k).val)= + τ ((u^(k+z.1)).val*z.2*powerWord u t) := by + rw [powerWord_cons,htr] + congr 1 + rw [← hp] + simp only [mul_assoc] + rw [hrot] + by_cases hsum : k+z.1=0 + · simp only [hsum,zpow_zero,OneMemClass.coe_one,one_mul] + induction t using List.reverseRecOn with + | nil => simpa only [powerWord_nil,mul_one] using hz.2.2 + | append_singleton v a unused => + have hv : CenteredPowerWord τ B v := by + intro b hb + exact ht b (List.mem_append_left _ hb) + have ha := ht a (List.mem_append_right _ (List.mem_singleton_self _)) + let d := a.2*z.2 + let d₀ := d-(τ d) • (1:A) + have hd₀ : d₀∈B ∧ τ d₀=0 := by + refine ⟨B.sub_mem (B.mul_mem ha.2.1 hz.2.1) (B.smul_mem B.one_mem _),?_⟩ + simp [d₀,map_sub,map_smul,h1] + have hvc : CenteredPowerWord τ B (v++[(a.1,d₀)]) := by + intro b hb + rcases List.mem_append.mp hb with hb | hb + · exact hv b hb + · have he := List.mem_singleton.mp hb + subst b + exact ⟨ha.1,hd₀⟩ + have hc0 := hC (v++[(a.1,d₀)]) (by simp) hvc + have hlenv : v.length (u^z.1).val*z.2).prod + +def CenteredPowerWord (τ : A →ₗ[ℂ] ℂ) (B : Subalgebra ℂ A) (w : List (ℤ×A)) : Prop := + ∀z∈w,z.1≠0 ∧ z.2∈B ∧ τ z.2=0 + +def HaarEndpointCompletion : Prop := + ∀ (τ : A →ₗ[ℂ] ℂ) (B : Subalgebra ℂ A) (u : unitary A), + τ 1=1 → (∀a b,τ (a*b)=τ (b*a)) → + (∀k:ℤ,k≠0 → τ (u^k).val=0) → + (∀w:List (ℤ×A),w≠[] → CenteredPowerWord τ B w → τ (powerWord u w)=0) → + ∀w:List (ℤ×A),CenteredPowerWord τ B w → ∀k:ℤ,k≠0 → + τ (powerWord u w*(u^k).val)=0 + +end + +end KKHaarEndpoints +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarExistence.lean b/lean/OAI/Analysis/FreeWords/HaarExistence.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa4781d0df5157305a6bec3a91fb9a59be6d2873 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarExistence.lean @@ -0,0 +1,137 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarGridElement + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +noncomputable section + +open scoped BigOperators + +variable {ι A : Type*} [Fintype ι] [DecidableEq ι] [Ring A] [Algebra ℂ A] + +variable [StarRing A] [StarModule ℂ A] + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance haarExistencePartialOrder (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance haarExistencePreorder (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance haarExistenceLE (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance haarExistenceStarOrderedRing (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +noncomputable section + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (hD : IsDiffuse M) + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKFreeLiftFrontier Filter Topology + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance haarExistencePartialOrder_1 (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance haarExistencePreorder_1 (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance haarExistenceLE_1 (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance haarExistenceStarOrderedRing_1 (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem gridElement_cauchy (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hD : IsDiffuse M) : CauchySeq (gridElement M τ hD) := by + apply cauchySeq_of_dist_le_of_summable (fun n => 2*Real.pi/(2:ℝ)^(n+1)) + · intro n + rw [dist_comm,dist_eq_norm] + exact gridElement_step M τ hD n + · have hs : Summable (fun n : ℕ => Real.pi * (1/2:ℝ)^n) := + (summable_geometric_of_norm_lt_one (by norm_num : ‖(1/2:ℝ)‖<1)).mul_left _ + convert hs using 1 + ext n + rw [div_pow,one_pow,pow_succ] + field_simp + +theorem exists_haar_unitary (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hD : IsDiffuse M) : ∃ u : unitary (ConcreteAlgebra M), + ∀ k : ℤ, k ≠ 0 → τ.map (u ^ k).val = 0 := by + obtain ⟨u,hu⟩ := cauchySeq_tendsto_of_complete (gridElement_cauchy M τ hD) + have hmem : u ∈ unitary (ConcreteAlgebra M) := + isClosed_unitary.mem_of_tendsto hu (Eventually.of_forall (gridElement_unitary M τ hD)) + have hm (k : ℕ) (hk : 0 τ.map (gridElement M τ hD n^k)) atTop (𝓝 (τ.map (u^k))) := + (map_continuous (tracePositive τ)).continuousAt.tendsto.comp (hu.pow k) + have he : (fun n => τ.map (gridElement M τ hD n^k)) =ᶠ[atTop] (fun _ => 0) := by + filter_upwards [eventually_ge_atTop k] with n hn + rw [gridElement_moment M τ hD n k] + exact phaseMoment_eq_zero n k hk (hn.trans_lt (Nat.lt_two_pow_self)) + exact tendsto_nhds_unique ht (tendsto_const_nhds.congr' he.symm) + refine ⟨⟨u,hmem⟩,?_⟩ + intro k hk + cases k with + | ofNat k => + have he := zpow_natCast (⟨u,hmem⟩ : unitary (ConcreteAlgebra M)) k + have hτ := congrArg (fun v : unitary (ConcreteAlgebra M) => τ.map v.val) he + exact hτ.trans (by simpa only [SubmonoidClass.coe_pow] using hm k (Nat.pos_of_ne_zero (by intro h; subst k; exact hk rfl))) + | negSucc k => + rw [zpow_negSucc,← Unitary.star_eq_inv,Unitary.coe_star,SubmonoidClass.coe_pow] + change τ.map (star (u^(k+1)))=0 + change (tracePositive τ) (star (u^(k+1)))=0 + rw [map_star,show (tracePositive τ) (u^(k+1))=0 from hm _ (by omega),star_zero] + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarFiniteEndpoints.lean b/lean/OAI/Analysis/FreeWords/HaarFiniteEndpoints.lean new file mode 100644 index 0000000000000000000000000000000000000000..fbd92c7430bec61c8e561309edc5886285f673a7 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarFiniteEndpoints.lean @@ -0,0 +1,71 @@ +import Mathlib +import OAI.Analysis.FreeWords.FiniteMomentNet +import OAI.Analysis.FreeWords.HaarEndpointLimits +import OAI.Analysis.FreeWords.HaarFiniteEndpointsDefinitions + +namespace OAI + +noncomputable section + +namespace KKHaarEndpoints + +noncomputable section + +open Filter + +open scoped Topology + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] + +theorem haar_finite_endpoints : HaarFiniteEndpoints (A := A) := by + classical + intro τ B Good h1 htr happ K F E hF hE ε hε + let T := {k : ℤ // k≠0} ⊕ {w : List (ℤ×A) // w≠[] ∧ CenteredPowerWord τ B w} + let f : T → unitary A → ℂ := fun t u => match t with + | .inl k => τ (u^k.val).val + | .inr w => τ (powerWord u w.val) + have hfinite : ∀L:Finset T, ∀η:ℝ,0<η → ∃u,Good u ∧ ∀t∈L,‖f t u‖<η := by + intro L η hη + let K₀ : Finset ℤ := L.image (fun t => match t with | .inl k => k.val | .inr _ => 0) + let F₀ : Finset (List (ℤ×A)) := L.biUnion (fun t => match t with | .inl _ => ∅ | .inr w => {w.val}) + have hF₀ : ∀w∈F₀,w≠[] ∧ CenteredPowerWord τ B w := by + intro w hw + obtain ⟨t,ht,hw⟩ := Finset.mem_biUnion.mp hw + cases t with + | inl k => simp at hw + | inr v => have he := Finset.mem_singleton.mp hw; subst w; exact v.property + obtain ⟨u,hgood,hK₀,hF₀'⟩ := happ K₀ F₀ hF₀ η hη + refine ⟨u,hgood,?_⟩ + intro t ht + cases t with + | inl k => exact hK₀ k.val (Finset.mem_image.mpr ⟨.inl k,ht,rfl⟩) k.property + | inr w => exact hF₀' w.val (Finset.mem_biUnion.mpr ⟨.inr w,ht,by simp⟩) + obtain ⟨u,hgood,hu⟩ := KKFiniteMomentNet.finite_moment_net Good f hfinite + have hH (k : ℤ) (hk : k≠0) : Tendsto (fun j => τ (u j^k).val) atTop (𝓝 0) := hu (.inl ⟨k,hk⟩) + have hC (w : List (ℤ×A)) (hne : w≠[]) (hc : CenteredPowerWord τ B w) : + Tendsto (fun j => τ (powerWord (u j) w)) atTop (𝓝 0) := hu (.inr ⟨w,hne,hc⟩) + have hO := haar_endpoint_limits (A := A) (Finset T×ℕ) atTop τ B u h1 htr hH hC + have hKsmall : ∀ᶠj in atTop,∀k∈K,k≠0 → ‖τ (u j^k).val‖<ε := by + apply (Filter.eventually_all_finset K).2 + intro k hk + by_cases hk0 : k=0 + · exact Eventually.of_forall (fun _ h => (h hk0).elim) + · have hh := Metric.tendsto_nhds.mp (hH k hk0) ε hε + simpa only [dist_zero_right] using hh.mono (fun j hj _ => hj) + have hFsmall : ∀ᶠj in atTop,∀w∈F,‖τ (powerWord (u j) w)‖<ε := by + apply (Filter.eventually_all_finset F).2 + intro w hw + simpa only [dist_zero_right] using Metric.tendsto_nhds.mp (hC w (hF w hw).1 (hF w hw).2) ε hε + have hEsmall : ∀ᶠj in atTop,∀z∈E,‖τ (powerWord (u j) z.1*(u j^z.2).val)‖<ε := by + apply (Filter.eventually_all_finset E).2 + intro z hz + simpa only [dist_zero_right] using Metric.tendsto_nhds.mp (hO z.1 (hE z hz).1 z.2 (hE z hz).2) ε hε + obtain ⟨j,hjK,hjF,hjE⟩ := (hKsmall.and (hFsmall.and hEsmall)).exists + exact ⟨u j,hgood j,hjK,hjF,hjE⟩ + +end + +end KKHaarEndpoints +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarFiniteEndpointsDefinitions.lean b/lean/OAI/Analysis/FreeWords/HaarFiniteEndpointsDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9397178f6c2af3d881e4d1ecb6d0ac717b0f8fc --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarFiniteEndpointsDefinitions.lean @@ -0,0 +1,37 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarEndpointsDefinitions + +namespace OAI + +noncomputable section + +namespace KKHaarEndpoints + +noncomputable section + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] + +def FiniteCyclicApprox (τ : A →ₗ[ℂ] ℂ) (B : Subalgebra ℂ A) (Good : unitary A → Prop) : Prop := + ∀ (K : Finset ℤ) (F : Finset (List (ℤ×A))), + (∀w∈F,w≠[] ∧ CenteredPowerWord τ B w) → ∀ε:ℝ,0<ε → + ∃u:unitary A, Good u ∧ + (∀k∈K,k≠0 → ‖τ (u^k).val‖<ε) ∧ (∀w∈F,‖τ (powerWord u w)‖<ε) + +def HaarFiniteEndpoints : Prop := + ∀ (τ : A →ₗ[ℂ] ℂ) (B : Subalgebra ℂ A) (Good : unitary A → Prop), + τ 1=1 → (∀a b,τ (a*b)=τ (b*a)) → FiniteCyclicApprox τ B Good → + ∀ (K : Finset ℤ) (F : Finset (List (ℤ×A))) + (E : Finset (List (ℤ×A) × ℤ)), + (∀w∈F,w≠[] ∧ CenteredPowerWord τ B w) → + (∀z∈E,CenteredPowerWord τ B z.1 ∧ z.2≠0) → ∀ε:ℝ,0<ε → + ∃u:unitary A, Good u ∧ + (∀k∈K,k≠0 → ‖τ (u^k).val‖<ε) ∧ + (∀w∈F,‖τ (powerWord u w)‖<ε) ∧ + (∀z∈E,‖τ (powerWord u z.1*(u^z.2).val)‖<ε) + +end + +end KKHaarEndpoints +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarGridElement.lean b/lean/OAI/Analysis/FreeWords/HaarGridElement.lean new file mode 100644 index 0000000000000000000000000000000000000000..57bd0fda7c4119f0dd578f4a34460317bf9b843b --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarGridElement.lean @@ -0,0 +1,122 @@ +import Mathlib +import OAI.Analysis.FreeWords.DyadicPhases +import OAI.Analysis.FreeWords.PartitionHom + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +noncomputable section + +open scoped BigOperators + +variable {ι A : Type*} [Fintype ι] [DecidableEq ι] [Ring A] [Algebra ℂ A] + +variable [StarRing A] [StarModule ℂ A] + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance haarGridElementConcreteOrder (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance haarGridElementConcretePreorder (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance haarGridElementConcreteLE (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance haarGridElementConcreteSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +noncomputable section + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (hD : IsDiffuse M) + +def gridHom (n : ℕ) : (BitWords n → ℂ) →⋆ₐ[ℂ] ConcreteAlgebra M := + partitionHom (dyadicGrid M τ hD n).p (dyadicGrid M τ hD n).proj + (dyadicGrid M τ hD n).orth (dyadicGrid M τ hD n).sum + +def gridElement (n : ℕ) : ConcreteAlgebra M := gridHom M τ hD n (dyadicPhase n) + +theorem gridElement_unitary (n : ℕ) : gridElement M τ hD n ∈ unitary (ConcreteAlgebra M) := by + change (gridHom M τ hD n) (dyadicPhase n) ∈ unitary (ConcreteAlgebra M) + apply Unitary.map_mem (gridHom M τ hD n) + rw [Unitary.mem_iff] + constructor <;> ext w + · change star (dyadicPhase n w)*dyadicPhase n w=1 + rw [RCLike.star_def,mul_comm,Complex.mul_conj,Complex.normSq_eq_norm_sq,dyadicPhase_norm] + norm_num + · change dyadicPhase n w*star (dyadicPhase n w)=1 + rw [RCLike.star_def,Complex.mul_conj,Complex.normSq_eq_norm_sq,dyadicPhase_norm] + norm_num + +theorem gridElement_refine (n : ℕ) : + gridElement M τ hD n=gridHom M τ hD (n+1) (fun w => dyadicPhase n w.1) := by + change (∑ w, dyadicPhase n w • (dyadicGrid M τ hD n).p w)= + ∑ w : BitWords n × Bool, dyadicPhase n w.1 • (dyadicGrid M τ hD (n+1)).p w + rw [Fintype.sum_prod_type] + simp only [Fintype.sum_bool,← smul_add,dyadicGrid_refine] + +theorem gridElement_step (n : ℕ) : + ‖gridElement M τ hD (n+1)-gridElement M τ hD n‖ ≤ 2*Real.pi/(2:ℝ)^(n+1) := by + rw [gridElement_refine M τ hD n] + change ‖gridHom M τ hD (n+1) (dyadicPhase (n+1))- + gridHom M τ hD (n+1) (fun w => dyadicPhase n w.1)‖ ≤ _ + rw [← map_sub] + refine (NonUnitalStarAlgHom.norm_apply_le (gridHom M τ hD (n+1)) _).trans ?_ + apply (pi_norm_le_iff_of_nonneg (by positivity)).mpr + intro w + rcases w with ⟨w,b⟩ + cases b + · change ‖dyadicPhase n w*1-dyadicPhase n w‖ ≤ _ + rw [mul_one,sub_self,norm_zero] + positivity + · change ‖dyadicPhase n w*dyadicRoot (n+1)-dyadicPhase n w‖ ≤ _ + have he : dyadicPhase n w*dyadicRoot (n+1)-dyadicPhase n w= + dyadicPhase n w*(dyadicRoot (n+1)-1) := by ring + rw [he,norm_mul,dyadicPhase_norm,one_mul] + exact dyadicRoot_sub_one (n+1) + +theorem gridElement_moment (n k : ℕ) : + τ.map (gridElement M τ hD n^k)=phaseMoment n k := by + change τ.map ((partitionHom _ _ _ _) _ ^ k)=_ + rw [partitionHom_pow,map_sum] + simp only [map_smul,(dyadicGrid M τ hD n).trace,smul_eq_mul] + simp only [Complex.ofReal_pow,Complex.ofReal_div,Complex.ofReal_one,Complex.ofReal_ofNat] + rw [← Finset.sum_mul,mul_comm] + rfl + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarLeftEndpoint.lean b/lean/OAI/Analysis/FreeWords/HaarLeftEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb40c6569f6aba4ff816b35b4e1964f0737ff89d --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarLeftEndpoint.lean @@ -0,0 +1,63 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarEndpointLimits +import OAI.Analysis.FreeWords.HaarLeftEndpointDefinitions + +namespace OAI + +noncomputable section + +namespace KKHaarEndpoints + +noncomputable section + +open Filter + +open scoped Topology + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] + +theorem haar_left_endpoint_limits : HaarLeftEndpointLimits (A := A) := by + intro ι L τ B u h1 htr hH hC w hne hw a ha + have hO := haar_endpoint_limits ι L τ B u h1 htr hH hC + induction w using List.reverseRecOn with + | nil => exact (hne rfl).elim + | append_singleton v z unused => + have hv : CenteredPowerWord τ B v := by + intro b hb + exact hw b (List.mem_append_left _ hb) + have hz := hw z (List.mem_append_right _ (List.mem_singleton_self _)) + let d := z.2*a + let d₀ := d-(τ d) • (1:A) + have hd₀ : d₀∈B ∧ τ d₀=0 := by + refine ⟨B.sub_mem (B.mul_mem hz.2.1 ha) (B.smul_mem B.one_mem _),?_⟩ + simp [d₀,map_sub,map_smul,h1] + have hvc : CenteredPowerWord τ B (v++[(z.1,d₀)]) := by + intro b hb + rcases List.mem_append.mp hb with hb | hb + · exact hv b hb + · have he := List.mem_singleton.mp hb + subst b + exact ⟨hz.1,hd₀⟩ + have hc0 := hC (v++[(z.1,d₀)]) (by simp) hvc + have ho0 := hO v hv z.1 hz.1 + have hr (j : ι) : τ (a*powerWord (u j) (v++[z]))= + τ (powerWord (u j) v*(u j^z.1).val*d) := by + rw [htr,powerWord_append,powerWord_cons,powerWord_nil,mul_one] + congr 1 + dsimp [d] + simp only [mul_assoc] + simp_rw [hr] + have he (j : ι) : powerWord (u j) v*(u j^z.1).val*d= + powerWord (u j) (v++[(z.1,d₀)])+(τ d) • (powerWord (u j) v*(u j^z.1).val) := by + simp only [powerWord_append,powerWord_cons,powerWord_nil,mul_one,d₀, + mul_sub,mul_smul_comm,mul_assoc] + abel + simp_rw [he,map_add,map_smul,smul_eq_mul] + simpa using hc0.add (ho0.const_mul (τ d)) + +end + +end KKHaarEndpoints +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarLeftEndpointDefinitions.lean b/lean/OAI/Analysis/FreeWords/HaarLeftEndpointDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..f41362486d200b2fba852db1363844d7d92dc7f4 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarLeftEndpointDefinitions.lean @@ -0,0 +1,33 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarEndpointsDefinitions + +namespace OAI + +noncomputable section + +namespace KKHaarEndpoints + +noncomputable section + +open Filter + +open scoped Topology + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] + +def HaarLeftEndpointLimits : Prop := + ∀ (ι : Type*) (L : Filter ι) (τ : A →ₗ[ℂ] ℂ) (B : Subalgebra ℂ A) + (u : ι → unitary A), τ 1=1 → + (∀ a b,τ (a*b)=τ (b*a)) → + (∀ k : ℤ,k≠0 → Tendsto (fun j => τ ((u j^k).val)) L (𝓝 0)) → + (∀ w : List (ℤ×A),w≠[] → CenteredPowerWord τ B w → + Tendsto (fun j => τ (powerWord (u j) w)) L (𝓝 0)) → + ∀ w : List (ℤ×A),w≠[] → CenteredPowerWord τ B w → ∀ a∈B, + Tendsto (fun j => τ (a*powerWord (u j) w)) L (𝓝 0) + +end + +end KKHaarEndpoints +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarMoment.lean b/lean/OAI/Analysis/FreeWords/HaarMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..c09648cd86561e7ba8bc8dbd69b17e1733213914 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarMoment.lean @@ -0,0 +1,128 @@ +import Mathlib +import OAI.Analysis.FreeWords.TensorGram +import OAI.Analysis.FreeWords.TensorHaar + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators Matrix.Norms.L2Operator InnerProductSpace + +open MeasureTheory Matrix + +noncomputable section + +def matrixPairCLM {ι : Type*} [Fintype ι] (S : Matrix ι ι ℂ) : Matrix ι ι ℂ →L[ℂ] ℂ := + LinearMap.toContinuousLinearMap + { toFun := matrixPair S + map_add' := fun T R => by simp [matrixPair,mul_add] + map_smul' := fun c T => by simp [matrixPair,Matrix.mul_smul] } + +@[simp] theorem matrixPairCLM_apply {ι : Type*} [Fintype ι] (S T : Matrix ι ι ℂ) : + matrixPairCLM S T=matrixPair S T := rfl + +theorem positionPair_conjugation {r d : ℕ} (π : Equiv.Perm (Fin r)) + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) + (U : Matrix.unitaryGroup (Fin d) ℂ) : + matrixPair (positionMatrix π) + (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)*T* + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ))) = + matrixPair (positionMatrix π) T := by + let X := tensorMatrix (r := r) (U : Matrix (Fin d) (Fin d) ℂ) + have hc : Commute (star (positionMatrix (d := d) π)) X := by + apply Commute.star_left + simpa only [tensorMatrix_star] using positionMatrix_tensorMatrix_commute (d := d) π (star (U : Matrix (Fin d) (Fin d) ℂ)) + have he : star X*star (positionMatrix π)*X=star (positionMatrix π) := + (commute_unitary_iff_star_left_conjugate (tensorMatrix_unitary U)).mp hc.symm + change Matrix.trace (star (positionMatrix π)*(X*T*star X))= + Matrix.trace (star (positionMatrix π)*T) + calc + _ = Matrix.trace ((star X*star (positionMatrix π)*X)*T) := by + simpa only [mul_assoc] using Matrix.trace_mul_cycle (star (positionMatrix π)) (X*T) (star X) + _ = _ := by rw [he] + +theorem positionPair_average {r d : ℕ} + (μ : Measure (Matrix.unitaryGroup (Fin d) ℂ)) [IsProbabilityMeasure μ] + (π : Equiv.Perm (Fin r)) (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) : + matrixPair (positionMatrix π) (tensorAverage μ T)=matrixPair (positionMatrix π) T := by + have hint := (continuous_tensorConjugation T).integrable_of_hasCompactSupport (μ := μ) + (HasCompactSupport.of_compactSpace _) + change matrixPairCLM (positionMatrix π) (∫ U, tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)*T* + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)) ∂μ)=_ + rw [← ContinuousLinearMap.integral_comp_comm _ hint] + simp only [matrixPairCLM_apply,positionPair_conjugation] + simp + +theorem tensorAverage_gram_formula {r d : ℕ} (hrd : r ≤ d) + (μ : Measure (Matrix.unitaryGroup (Fin d) ℂ)) [IsProbabilityMeasure μ] + [μ.IsMulLeftInvariant] (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) : + tensorAverage μ T = ∑ π, + (∑ σ,(permutationGram r d)⁻¹ π σ * matrixPair (positionMatrix σ) T) • positionMatrix π := by + classical + obtain ⟨c,hc⟩ := tensorAverage_span r d hrd μ T + have hv : permutationGram r d *ᵥ c = fun σ => matrixPair (positionMatrix σ) T := by + funext σ + have hh := positionPair_average μ σ T + rw [hc,matrixPair_sum_smul] at hh + simpa only [Matrix.mulVec,dotProduct,permutationGram_apply,mul_comm] using hh + have he := congrArg (fun v => (permutationGram r d)⁻¹ *ᵥ v) hv + rw [Matrix.mulVec_mulVec,Matrix.nonsing_inv_mul _ (isUnit_iff_ne_zero.mpr + (permutationGram_det_ne_zero hrd)),Matrix.one_mulVec] at he + rw [hc,he] + rfl + +def matrixApplyCLM {ι : Type*} [Fintype ι] (a b : ι) : Matrix ι ι ℂ →L[ℂ] ℂ := + LinearMap.toContinuousLinearMap + { toFun := fun T => T a b + map_add' := fun _ _ => rfl + map_smul' := fun _ _ => rfl } + +@[simp] theorem matrixApplyCLM_apply {ι : Type*} [Fintype ι] (a b : ι) (T : Matrix ι ι ℂ) : + matrixApplyCLM a b T=T a b := rfl + +theorem tensorAverage_single_apply {r d : ℕ} + (μ : Measure (Matrix.unitaryGroup (Fin d) ℂ)) [IsProbabilityMeasure μ] + (a b c e : Fin r → Fin d) : + tensorAverage μ (Matrix.single b e 1) a c = + ∫ U : Matrix.unitaryGroup (Fin d) ℂ, + tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ) a b * + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ) c e) ∂μ := by + classical + have hint := (continuous_tensorConjugation (Matrix.single b e (1 : ℂ))).integrable_of_hasCompactSupport (μ := μ) + (HasCompactSupport.of_compactSpace _) + change matrixApplyCLM a c (∫ U, tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)*Matrix.single b e 1* + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)) ∂μ)=_ + rw [← ContinuousLinearMap.integral_comp_comm _ hint] + apply integral_congr_ae + filter_upwards [] with U + simp [matrixApplyCLM_apply,Matrix.mul_apply,Matrix.single_apply,Matrix.star_apply,ite_and] + +theorem matrixPair_single {ι : Type*} [Fintype ι] [DecidableEq ι] + (S : Matrix ι ι ℂ) (b e : ι) : + matrixPair S (Matrix.single b e 1)=star (S b e) := by + simp [matrixPair,Matrix.trace_mul_single,Matrix.star_apply] + +theorem haar_moment_formula (r d : ℕ) (hrd : r ≤ d) + (a b c e : Fin r → Fin d) : + (∫ U : Matrix.unitaryGroup (Fin d) ℂ, + tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ) a b * + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ) c e) ∂matrixHaar d) = + ∑ π,∑ σ,(permutationGram r d)⁻¹ π σ * + positionMatrix π a c * star (positionMatrix σ b e) := by + classical + rw [← tensorAverage_single_apply,tensorAverage_gram_formula hrd] + simp only [Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul,matrixPair_single,Finset.sum_mul] + apply Finset.sum_congr rfl + intro π _ + apply Finset.sum_congr rfl + intro σ _ + ring + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarSignedTrace.lean b/lean/OAI/Analysis/FreeWords/HaarSignedTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..c0b2581d6400bfca1911ce663f115e6ddcf91897 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarSignedTrace.lean @@ -0,0 +1,196 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarSignedWords + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +omit [StarOrderedRing A] + +theorem trace_signedWord_last (hτ : τ 1 = 1) (s : unitary A) (hs : (s:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) {w : List (ℤ × A)} + (hw : ∀ a ∈ w, a.1 ≠ 0 ∧ a.2 ∈ P ∧ τ a.2 = 0) + (k : ℤ) (hk : k ≠ 0) (x : A) (hx : x ∈ P) : + τ (signedWord s (w ++ [(k,x)])) = 0 := by + have hxc : τ (x - τ x • (1:A)) = 0 := by simp [map_sub, map_smul, hτ] + have hmem : x - τ x • (1:A) ∈ P := P.sub_mem hx (P.smul_mem P.one_mem _) + have hz := trace_signedWord_centered s hs hHaar hfree + (w := w ++ [(k, x - τ x • (1:A))]) (by simp) (by + intro a ha + rcases List.mem_append.mp ha with ha | ha + · exact hw a ha + · have he : a = (k, x - τ x • (1:A)) := by simpa using ha + subst a + exact ⟨hk,hmem,hxc⟩) + have he := trace_signedWord_end s hs hHaar hfree hw k hk + have hsub : + τ (signedWord s (w ++ [(k, x - τ x • (1:A))])) = + τ (signedWord s (w ++ [(k,x)])) - τ x * τ (signedWord s w * upow s k) := by + simp [signedWord, List.prod_append, mul_sub, map_sub, map_smul] + rw [hz,he,mul_zero,sub_zero] at hsub + exact hsub.symm + +theorem trace_signedWord_interior (hτ : τ 1 = 1) (s : unitary A) (hs : (s:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) {w : List (ℤ × A)} (hne : w ≠ []) + (hw : ∀ a ∈ w, a.1 ≠ 0 ∧ a.2 ∈ P) + (hc : ∀ a ∈ w.dropLast, τ a.2 = 0) : τ (signedWord s w) = 0 := by + have he := List.dropLast_append_getLast hne + rw [← he] + have hl := hw _ (List.getLast_mem hne) + exact trace_signedWord_last hτ s hs hHaar hfree (fun a ha => + ⟨(hw a (List.mem_of_mem_dropLast ha)).1, + (hw a (List.mem_of_mem_dropLast ha)).2, hc a ha⟩) _ hl.1 _ hl.2 + +theorem trace_signedWord_split (s : unitary A) (p r : List (ℤ × A)) + (k l : ℤ) (x y : A) : + τ (signedWord s (p ++ (k,x)::(l,y)::r)) = + τ (signedWord s (p ++ (k,x-τ x • (1:A))::(l,y)::r)) + + τ x * τ (signedWord s (p ++ (k+l,y)::r)) := by + simp only [signedWord, List.map_append, List.map_cons, List.prod_append, List.prod_cons, + upow_add, mul_sub, sub_mul, mul_smul_comm, smul_mul_assoc, mul_one, + map_sub, map_smul, smul_eq_mul] + simp only [mul_assoc] + ring + +def badSeparators (τ : A →ₚ[ℂ] ℂ) (w : List (ℤ × A)) : ℕ := + w.countP (fun a => decide (τ a.2 ≠ 0)) + +theorem badSeparators_center (p r : List (ℤ × A)) (k l : ℤ) (x x' y : A) + (hx : τ x ≠ 0) (hx' : τ x' = 0) : + badSeparators τ (p ++ (k,x')::(l,y)::r) + 1 = + badSeparators τ (p ++ (k,x)::(l,y)::r) := by + simp [badSeparators, List.countP_cons, hx, hx']; omega + +theorem badSeparators_merge (p r : List (ℤ × A)) (k l : ℤ) (x y : A) + (hx : τ x ≠ 0) : + badSeparators τ (p ++ (k+l,y)::r) + 1 = + badSeparators τ (p ++ (k,x)::(l,y)::r) := by + simp [badSeparators, List.countP_cons, hx]; omega + +theorem exists_bad_separator {w : List (ℤ × A)} + (h : ¬ ∀ a ∈ w.dropLast, τ a.2 = 0) : + ∃ p a b r, w = p ++ a::b::r ∧ τ a.2 ≠ 0 := by + induction w with + | nil => simp at h + | cons a w ih => + cases w with + | nil => simp at h + | cons b r => + by_cases ha : τ a.2 = 0 + · have ht : ¬ ∀ c ∈ (b::r).dropLast, τ c.2 = 0 := by + intro hc + apply h + simpa [List.dropLast_cons_cons, ha] using hc + obtain ⟨p,c,d,t,hp,hc⟩ := ih ht + exact ⟨a::p,c,d,t,by simp [hp],hc⟩ + · exact ⟨[],a,b,r,rfl,ha⟩ + +theorem trace_signedWord (hτ : τ 1 = 1) (s : unitary A) (hs : (s:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) {w : List (ℤ × A)} + (hne : w ≠ []) (hw : ∀ a ∈ w, a.1 ≠ 0 ∧ a.2 ∈ P) + (hc : w.IsChain (SignedRelation τ)) : τ (signedWord s w) = 0 := by + classical + suffices H : ∀ n : ℕ, ∀ w : List (ℤ × A), badSeparators τ w ≤ n → w ≠ [] → + (∀ a ∈ w, a.1 ≠ 0 ∧ a.2 ∈ P) → w.IsChain (SignedRelation τ) → + τ (signedWord s w) = 0 from H _ w le_rfl hne hw hc + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro w hn hne hw hc + by_cases hi : ∀ a ∈ w.dropLast, τ a.2 = 0 + · exact trace_signedWord_interior hτ s hs hHaar hfree hne hw hi + · obtain ⟨p,⟨k,x⟩,⟨l,y⟩,r,rfl,hx⟩ := exists_bad_separator hi + have hkx := hw (k,x) (by simp) + have hly := hw (l,y) (by simp) + have hkl : SameSign k l := by + have hrel := (List.isChain_append_cons_cons.mp hc).2.1 + exact hrel.resolve_left hx + have hxc : τ (x - τ x • (1:A)) = 0 := by simp [map_sub, map_smul, hτ] + have hxp : x - τ x • (1:A) ∈ P := P.sub_mem hkx.2 (P.smul_mem P.one_mem _) + let w₀ := p ++ (k,x-τ x • (1:A))::(l,y)::r + let w₁ := p ++ (k+l,y)::r + have hn₀ : badSeparators τ w₀ < n := by + have hh := badSeparators_center p r k l x (x-τ x • (1:A)) y hx hxc + change badSeparators τ w₀ + 1 = _ at hh + omega + have hn₁ : badSeparators τ w₁ < n := by + have hh := badSeparators_merge p r k l x y hx + change badSeparators τ w₁ + 1 = _ at hh + omega + have hm₀ : ∀ a ∈ w₀, a.1 ≠ 0 ∧ a.2 ∈ P := by + intro a ha + rcases List.mem_append.mp ha with ha | ha + · exact hw a (List.mem_append_left _ ha) + · rcases List.mem_cons.mp ha with rfl | ha + · exact ⟨hkx.1,hxp⟩ + · exact hw a (List.mem_append_right _ (List.mem_cons_of_mem _ ha)) + have hm₁ : ∀ a ∈ w₁, a.1 ≠ 0 ∧ a.2 ∈ P := by + intro a ha + rcases List.mem_append.mp ha with ha | ha + · exact hw a (List.mem_append_left _ ha) + · rcases List.mem_cons.mp ha with rfl | ha + · exact ⟨hkl.add_left.nonzero_left,hly.2⟩ + · exact hw a (by simp only [List.mem_append,List.mem_cons]; tauto) + have hz₀ := ih _ hn₀ w₀ le_rfl (by simp [w₀]) hm₀ (signedChain_center hxc hc) + have hz₁ := ih _ hn₁ w₁ le_rfl (by simp [w₁]) hm₁ (signedChain_merge hkl hc) + exact (trace_signedWord_split s p r k l x y).trans (by rw [hz₀,hz₁,mul_zero,add_zero]) + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarSignedWords.lean b/lean/OAI/Analysis/FreeWords/HaarSignedWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..1027e5825afbe2a6fd7b7669f89d8071e0892583 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarSignedWords.lean @@ -0,0 +1,197 @@ +import Mathlib +import OAI.Analysis.FreeWords.ConjugateFree + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +def SameSign (k l : ℤ) : Prop := (0 < k ∧ 0 < l) ∨ (k < 0 ∧ l < 0) + +theorem SameSign.symm {k l : ℤ} (h : SameSign k l) : SameSign l k := by + rcases h with h | h <;> [left; right] <;> exact ⟨h.2,h.1⟩ + +theorem SameSign.trans {k l m : ℤ} (h : SameSign k l) (h' : SameSign l m) : + SameSign k m := by + rcases h with h | h <;> rcases h' with h' | h' + · exact Or.inl ⟨h.1,h'.2⟩ + · omega + · omega + · exact Or.inr ⟨h.1,h'.2⟩ + +theorem SameSign.add_left {k l : ℤ} (h : SameSign k l) : SameSign (k+l) k := by + rcases h with h | h <;> [left; right] <;> constructor <;> omega + +theorem SameSign.add_right {k l : ℤ} (h : SameSign k l) : SameSign (k+l) l := by + exact h.add_left.trans h + +theorem SameSign.nonzero_left {k l : ℤ} (h : SameSign k l) : k ≠ 0 := by + rcases h with h | h <;> omega + +def SignedRelation (τ : A →ₚ[ℂ] ℂ) (a b : ℤ × A) : Prop := + τ a.2 = 0 ∨ SameSign a.1 b.1 + +def signedWord (s : unitary A) (w : List (ℤ × A)) : A := + (w.map (fun a => upow s a.1 * a.2)).prod + +def signedExpansion (s : unitary A) (w : List (ℤ × A)) : List (Bool × A) := + w.flatMap (fun a => [(false, upow s a.1), (true, a.2)]) + +omit [PartialOrder A] [StarOrderedRing A] in +theorem signedExpansion_value (s : unitary A) (w : List (ℤ × A)) : + ((signedExpansion s w).map Prod.snd).prod = signedWord s w := by + induction w with + | nil => simp [signedExpansion, signedWord] + | cons a w ih => + simp only [signedExpansion, List.flatMap_cons, List.cons_append, List.nil_append, + List.map_cons, List.prod_cons] at * + rw [ih] + simp [signedWord, mul_assoc] + +omit [PartialOrder A] [StarOrderedRing A] in +theorem signedExpansion_chain (s : unitary A) (w : List (ℤ × A)) : + (signedExpansion s w).IsChain (fun a b => a.1 ≠ b.1) := by + induction w with + | nil => simp [signedExpansion] + | cons a w ih => + cases w with + | nil => simp [signedExpansion] + | cons b w => + simpa [signedExpansion, List.isChain_cons_cons] using ih + +omit [PartialOrder A] [StarOrderedRing A] in +theorem signedExpansion_end_chain (s : unitary A) (w : List (ℤ × A)) (k : ℤ) : + (signedExpansion s w ++ [(false, upow s k)]).IsChain (fun a b => a.1 ≠ b.1) := by + induction w with + | nil => simp [signedExpansion] + | cons a w ih => + cases w with + | nil => simp [signedExpansion] + | cons b w => + simpa [signedExpansion, List.isChain_cons_cons] using ih + +omit [StarOrderedRing A] in +theorem signedExpansion_centered (s : unitary A) (hs : (s:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) {w : List (ℤ × A)} + (hw : ∀ a ∈ w, a.1 ≠ 0 ∧ a.2 ∈ P ∧ τ a.2 = 0) : + ∀ a ∈ signedExpansion s w, a.2 ∈ binaryCopy S P a.1 ∧ τ a.2 = 0 := by + intro a ha + obtain ⟨b,hb,ha⟩ := List.mem_flatMap.mp ha + simp only [List.mem_cons, List.not_mem_nil, or_false] at ha + rcases ha with rfl | rfl + · exact ⟨upow_mem s hs _,hHaar _ (hw b hb).1⟩ + · exact (hw b hb).2 + +omit [StarOrderedRing A] in +theorem trace_signedWord_centered (s : unitary A) (hs : (s:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) {w : List (ℤ × A)} (hne : w ≠ []) + (hw : ∀ a ∈ w, a.1 ≠ 0 ∧ a.2 ∈ P ∧ τ a.2 = 0) : + τ (signedWord s w) = 0 := by + have hne' : signedExpansion s w ≠ [] := by + cases w with + | nil => contradiction + | cons a w => simp [signedExpansion] + simpa only [signedExpansion_value] using + hfree _ hne' (signedExpansion_chain s w) (signedExpansion_centered s hs hHaar hw) + +omit [StarOrderedRing A] in +theorem trace_signedWord_end (s : unitary A) (hs : (s:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) {w : List (ℤ × A)} + (hw : ∀ a ∈ w, a.1 ≠ 0 ∧ a.2 ∈ P ∧ τ a.2 = 0) (k : ℤ) (hk : k ≠ 0) : + τ (signedWord s w * upow s k) = 0 := by + have h := hfree (signedExpansion s w ++ [(false, upow s k)]) (by simp) + (signedExpansion_end_chain s w k) (by + intro a ha + rcases List.mem_append.mp ha with ha | ha + · exact signedExpansion_centered s hs hHaar hw a ha + · have he : a = (false, upow s k) := by simpa using ha + subst a + exact ⟨upow_mem s hs _,hHaar _ hk⟩) + simpa only [List.map_append, List.prod_append, List.map_cons, List.map_nil, + List.prod_cons, List.prod_nil, mul_one, signedExpansion_value] using h + +omit [StarOrderedRing A] in +theorem signedChain_center {p r : List (ℤ × A)} {k l : ℤ} {x x' y : A} + (hx' : τ x' = 0) (h : (p ++ (k,x)::(l,y)::r).IsChain (SignedRelation τ)) : + (p ++ (k,x')::(l,y)::r).IsChain (SignedRelation τ) := by + induction p with + | nil => + exact List.isChain_cons_cons.mpr ⟨Or.inl hx', (List.isChain_cons_cons.mp h).2⟩ + | cons a p ih => + cases p with + | nil => + obtain ⟨ha,ht⟩ := List.isChain_cons_cons.mp h + exact List.isChain_cons_cons.mpr ⟨ha,ih ht⟩ + | cons b p => + obtain ⟨ha,ht⟩ := List.isChain_cons_cons.mp h + exact List.isChain_cons_cons.mpr ⟨ha,ih ht⟩ + +omit [StarOrderedRing A] in +theorem signedChain_merge {p r : List (ℤ × A)} {k l : ℤ} {x y : A} + (hkl : SameSign k l) (h : (p ++ (k,x)::(l,y)::r).IsChain (SignedRelation τ)) : + (p ++ (k+l,y)::r).IsChain (SignedRelation τ) := by + induction p with + | nil => + cases r with + | nil => simp + | cons b r => + obtain ⟨hb,ht⟩ := (List.isChain_cons_cons.mp (List.isChain_cons_cons.mp h).2) + exact List.isChain_cons_cons.mpr ⟨by + rcases hb with hb | hb + · exact Or.inl hb + · exact Or.inr (hkl.add_right.trans hb), ht⟩ + | cons a p ih => + cases p with + | nil => + obtain ⟨ha,ht⟩ := List.isChain_cons_cons.mp h + exact List.isChain_cons_cons.mpr ⟨by + rcases ha with ha | ha + · exact Or.inl ha + · exact Or.inr (ha.trans hkl.add_left.symm), ih ht⟩ + | cons b p => + obtain ⟨ha,ht⟩ := List.isChain_cons_cons.mp h + exact List.isChain_cons_cons.mpr ⟨ha,ih ht⟩ + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarTwistEndpoints.lean b/lean/OAI/Analysis/FreeWords/HaarTwistEndpoints.lean new file mode 100644 index 0000000000000000000000000000000000000000..92d11d5e00c762c8e100d0c4ce609492978dc94a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarTwistEndpoints.lean @@ -0,0 +1,208 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarTwistMoments + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +omit [StarOrderedRing A] in +theorem powerBlocks_chain_last_free {w : List (ℤ × A)} + (hw : w.IsChain (fun a _ => τ a.2 = 0)) : + (powerBlocks w).IsChain (LetterRelation τ) := by + induction w with + | nil => simp [powerBlocks] + | cons a w ih => + cases w with + | nil => simpa [powerBlocks] using powerBlock_chain a.1 a.2 + | cons b w => + have hx : τ a.2 = 0 := (List.isChain_cons_cons.mp hw).1 + exact powerBlock_chain_append a.1 a.2 hx + (ih (List.isChain_cons_cons.mp hw).2) + +omit [StarOrderedRing A] in +theorem trace_twisted_signedWord (hτ : FaithfulTracial τ) + (s U : unitary A) (hs : (s:A) ∈ S) (hU : (U:A) ∈ P) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) {w : List (ℤ × A)} (hne : w ≠ []) + (hw : ∀ a ∈ w, a.1 ≠ 0 ∧ a.2 ∈ P) + (hc : w.IsChain (fun a _ => τ a.2 = 0)) : + τ (signedWord (s*U) w) = 0 := by + have hk : ∀ a ∈ w, a.1 ≠ 0 := fun a ha => (hw a ha).1 + have hz := trace_letterWord hτ.1 hτ.2.1 s U hs hU hHaar hfree + (powerBlocks_ne_nil hne hk) (powerBlocks_mem (fun a ha => (hw a ha).2)) + (powerBlocks_chain_last_free hc) + simpa only [powerBlocks_value _ hk] using hz + +def signedMulLast (t : A) : List (ℤ × A) → List (ℤ × A) + | [] => [] + | [(k,x)] => [(k,x*t)] + | a::b::w => a :: signedMulLast t (b::w) + +omit [PartialOrder A] [StarOrderedRing A] in +theorem signedMulLast_value (u : unitary A) (t : A) {w : List (ℤ × A)} (hne : w ≠ []) : + signedWord u (signedMulLast t w) = signedWord u w * t := by + induction w with + | nil => contradiction + | cons a w ih => + cases w with + | nil => simp [signedMulLast,signedWord,mul_assoc] + | cons b w => + simpa only [signedMulLast,signedWord,List.map_cons,List.prod_cons,mul_assoc] + using congrArg (fun z => upow u a.1 * a.2 * z) (ih (by simp)) + +omit [PartialOrder A] [StarOrderedRing A] in +theorem signedMulLast_ne_nil (t : A) {w : List (ℤ × A)} (hne : w ≠ []) : + signedMulLast t w ≠ [] := by + cases w with + | nil => contradiction + | cons a w => cases w <;> simp [signedMulLast] + +omit [PartialOrder A] [StarOrderedRing A] in +theorem signedMulLast_mem (t : A) (ht : t ∈ P) {w : List (ℤ × A)} + (hw : ∀ a ∈ w, a.1 ≠ 0 ∧ a.2 ∈ P) : + ∀ a ∈ signedMulLast t w, a.1 ≠ 0 ∧ a.2 ∈ P := by + induction w with + | nil => simp [signedMulLast] + | cons a w ih => + have ha := hw a (by simp) + cases w with + | nil => + intro b hb + simp only [signedMulLast,List.mem_singleton] at hb + subst b + exact ⟨ha.1,P.mul_mem ha.2 ht⟩ + | cons b w => + intro c hc + rcases List.mem_cons.mp hc with rfl | hc + · exact ha + · exact ih (fun z hz => hw z (List.mem_cons_of_mem _ hz)) c hc + +omit [StarOrderedRing A] in +theorem signedMulLast_chain (t : A) {w : List (ℤ × A)} + (hw : w.IsChain (fun a _ => τ a.2 = 0)) : + (signedMulLast t w).IsChain (fun a _ => τ a.2 = 0) := by + induction w with + | nil => simp [signedMulLast] + | cons a w ih => + cases w with + | nil => simp [signedMulLast] + | cons b w => + have ha : τ a.2 = 0 := (List.isChain_cons_cons.mp hw).1 + have hb := ih (List.isChain_cons_cons.mp hw).2 + cases w with + | nil => simpa [signedMulLast] using ha + | cons c w => + exact List.isChain_cons_cons.mpr ⟨ha,hb⟩ + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarTwistGenerators.lean b/lean/OAI/Analysis/FreeWords/HaarTwistGenerators.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c3f33846ebce528d02b81645147e97677956093 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarTwistGenerators.lean @@ -0,0 +1,226 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarTwistEndpoints + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +def powerPSet (τ : A →ₚ[ℂ] ℂ) (u : unitary A) (P : StarSubalgebra ℂ A) + (b : Bool) : Set A := + if b then {x | x ∈ P ∧ τ x = 0} else {x | ∃ k : ℤ, k ≠ 0 ∧ upow u k = x} + +omit [StarOrderedRing A] in +theorem parse_power_word (u : unitary A) {a : A} {w : List (Bool × A)} + (hchain : ((false,a)::w).IsChain (fun x y => x.1 ≠ y.1)) + (hmem : ∀ x ∈ (false,a)::w, x.2 ∈ powerPSet τ u P x.1) : + ∃ v : List (ℤ × A), v ≠ [] ∧ + (∀ x ∈ v, x.1 ≠ 0 ∧ x.2 ∈ P) ∧ + v.IsChain (fun x _ => τ x.2 = 0) ∧ + (((false,a)::w).map Prod.snd).prod = signedWord u v := by + induction w using List.twoStepInduction generalizing a with + | nil => + obtain ⟨k,hk,rfl⟩ := hmem (false,a) (by simp) + refine ⟨[(k,1)],by simp,?_,by simp,?_⟩ + · simpa using And.intro hk P.one_mem + · simp [signedWord] + | singleton b => + obtain ⟨b,y⟩ := b + cases b with + | false => simp at hchain + | true => + obtain ⟨k,hk,rfl⟩ := hmem (false,a) (by simp) + have hy : y ∈ P ∧ τ y = 0 := hmem (true,y) (by simp) + refine ⟨[(k,y)],by simp,?_,by simp,?_⟩ + · simpa using And.intro hk hy.1 + · simp [signedWord] + | cons_cons b c w ih _ => + obtain ⟨b,y⟩ := b + obtain ⟨c,z⟩ := c + cases b with + | false => simp at hchain + | true => + cases c with + | true => simp at hchain + | false => + obtain ⟨k,hk,rfl⟩ := hmem (false,a) (by simp) + have hy : y ∈ P ∧ τ y = 0 := hmem (true,y) (by simp) + have hct := (List.isChain_cons_cons.mp (List.isChain_cons_cons.mp hchain).2).2 + have hmt : ∀ x ∈ (false,z)::w, x.2 ∈ powerPSet τ u P x.1 := + fun x hx => hmem x (by simp only [List.mem_cons] at hx ⊢; tauto) + obtain ⟨v,hvn,hvm,hvc,hvv⟩ := ih hct hmt + refine ⟨(k,y)::v,by simp,?_,?_,?_⟩ + · intro x hx + rcases List.mem_cons.mp hx with rfl | hx + · exact ⟨hk,hy.1⟩ + · exact hvm x hx + · cases v with + | nil => contradiction + | cons x v => exact List.isChain_cons_cons.mpr ⟨hy.2,hvc⟩ + · simp only [List.map_cons,List.prod_cons,signedWord] at hvv ⊢ + rw [← mul_assoc, hvv] + +omit [StarOrderedRing A] in +theorem trace_twisted_generator_word (hτ : FaithfulTracial τ) + (s U : unitary A) (hs : (s:A) ∈ S) (hU : (U:A) ∈ P) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) {w : List (Bool × A)} (hne : w ≠ []) + (hchain : w.IsChain (fun x y => x.1 ≠ y.1)) + (hmem : ∀ x ∈ w, x.2 ∈ powerPSet τ (s*U) P x.1) : + τ ((w.map Prod.snd).prod) = 0 := by + cases w with + | nil => contradiction + | cons a w => + obtain ⟨b,x⟩ := a + cases b with + | false => + obtain ⟨v,hvn,hvm,hvc,hvv⟩ := parse_power_word (s*U) hchain hmem + rw [hvv] + exact trace_twisted_signedWord hτ s U hs hU hHaar hfree hvn hvm hvc + | true => + have hx : x ∈ P ∧ τ x = 0 := hmem (true,x) (by simp) + cases w with + | nil => simpa using hx.2 + | cons b w => + obtain ⟨b,y⟩ := b + cases b with + | true => simp at hchain + | false => + have hct := (List.isChain_cons_cons.mp hchain).2 + have hmt : ∀ a ∈ (false,y)::w, a.2 ∈ powerPSet τ (s*U) P a.1 := + fun a ha => hmem a (List.mem_cons_of_mem _ ha) + obtain ⟨v,hvn,hvm,hvc,hvv⟩ := parse_power_word (s*U) hct hmt + have hz := trace_twisted_signedWord hτ s U hs hU hHaar hfree + (signedMulLast_ne_nil x hvn) (signedMulLast_mem x hx.1 hvm) + (signedMulLast_chain x hvc) + rw [signedMulLast_value (s*U) x hvn] at hz + simp only [List.map_cons,List.prod_cons] + rw [show y * (w.map Prod.snd).prod = signedWord (s*U) v from hvv, + hτ.2.1] + exact hz + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarTwistLaurent.lean b/lean/OAI/Analysis/FreeWords/HaarTwistLaurent.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ea1c63eb74afb347a8ca85332d4afb52f38f225 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarTwistLaurent.lean @@ -0,0 +1,188 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarTwistGenerators +import OAI.Analysis.FreeWords.LaurentSpan + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +omit [StarOrderedRing A] in +theorem haar_twist_laurent_free (hτ : FaithfulTracial τ) + (s U : unitary A) (hs : (s:A) ∈ S) (hU : (U:A) ∈ P) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) : + ScalarFree τ (binaryCopy (laurentAlgebra (s*U)) P) := by + have hvHaar := (haar_twist_moments hτ s U hs hU hHaar hfree).1 + intro w hne hchain hcenter + apply linear_prod_zero_of_span (powerPSet τ (s*U) P) w τ.toLinearMap + · intro a ha + obtain ⟨b,x⟩ := a + have hx := hcenter (b,x) ha + cases b with + | false => + exact trace_zero_laurent_mem_span hτ.1 (s*U) hvHaar hx.1 hx.2 + | true => exact Submodule.subset_span hx + · intro y hy hmem + have hyn : y ≠ [] := by + intro h + subst y + have he : w = [] := List.map_eq_nil_iff.mp hy.symm + exact hne he + have hyc : y.IsChain (fun a b => a.1 ≠ b.1) := by + have hc : (w.map Prod.fst).IsChain Ne := (List.isChain_map Prod.fst).mpr hchain + rw [← hy] at hc + exact (List.isChain_map Prod.fst).mp hc + exact trace_twisted_generator_word hτ s U hs hU hHaar hfree hyn hyc hmem + +omit [StarOrderedRing A] in +theorem twisted_conjugates_scalarFree (hτ : FaithfulTracial τ) + (s U : unitary A) (hs : (s:A) ∈ S) (hU : (U:A) ∈ P) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) : + ScalarFree τ (fun k : ℤ => conjugateCopy (s*U) P k) := by + apply conjugates_scalarFree hτ.2.1 + (s*U) (S := laurentAlgebra (s*U)) + · exact StarAlgebra.subset_adjoin ℂ _ (Set.mem_singleton _) + · exact (haar_twist_moments hτ s U hs hU hHaar hfree).1 + · exact haar_twist_laurent_free hτ s U hs hU hHaar hfree + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarTwistLetters.lean b/lean/OAI/Analysis/FreeWords/HaarTwistLetters.lean new file mode 100644 index 0000000000000000000000000000000000000000..73e4652bb08c4bedc9e90bef2f8a9a892ac973b0 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarTwistLetters.lean @@ -0,0 +1,249 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarSignedTrace + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +def signInt (b : Bool) : ℤ := if b then 1 else -1 + +def unitaryLetter (u : unitary A) (b : Bool) : A := if b then u else star (u:A) + +def twistLeft (U : unitary A) (b : Bool) : A := if b then 1 else star (U:A) + +def twistRight (U : unitary A) (b : Bool) : A := if b then U else 1 + +def letterWord (u : unitary A) (w : List (Bool × A)) : A := + (w.map (fun a => unitaryLetter u a.1 * a.2)).prod + +def twistExpansion (U : unitary A) (t : A) : List (Bool × A) → List (ℤ × A) + | [] => [] + | [(b,x)] => [(signInt b, twistRight U b * x * t)] + | (b,x)::(c,y)::r => + (signInt b, twistRight U b * x * twistLeft U c) :: twistExpansion U t ((c,y)::r) + +omit [PartialOrder A] [StarOrderedRing A] in +theorem unitaryLetter_factor (s U : unitary A) (b : Bool) : + twistLeft U b * upow s (signInt b) * twistRight U b = unitaryLetter (s*U) b := by + cases b <;> simp [twistLeft,twistRight,signInt,unitaryLetter,upow, ← Unitary.star_eq_inv] + +omit [PartialOrder A] [StarOrderedRing A] in +theorem twistLeft_mem (U : unitary A) (hU : (U:A) ∈ P) (b : Bool) : + twistLeft U b ∈ P := by + cases b <;> simp only [twistLeft,Bool.false_eq_true,ite_false,ite_true] + · exact star_mem hU + · exact P.one_mem + +omit [PartialOrder A] [StarOrderedRing A] in +theorem twistRight_mem (U : unitary A) (hU : (U:A) ∈ P) (b : Bool) : + twistRight U b ∈ P := by + cases b <;> simp only [twistRight,Bool.false_eq_true,ite_false,ite_true] + · exact P.one_mem + · exact hU + +omit [PartialOrder A] [StarOrderedRing A] in +theorem twistExpansion_mem (U : unitary A) (hU : (U:A) ∈ P) (t : A) (ht : t ∈ P) + {w : List (Bool × A)} (hw : ∀ a ∈ w, a.2 ∈ P) : + ∀ a ∈ twistExpansion U t w, a.1 ≠ 0 ∧ a.2 ∈ P := by + induction w with + | nil => simp [twistExpansion] + | cons a w ih => + obtain ⟨b,x⟩ := a + cases w with + | nil => + intro a ha + have he : a = (signInt b, twistRight U b*x*t) := by simpa [twistExpansion] using ha + subst a + exact ⟨by cases b <;> simp [signInt], + P.mul_mem (P.mul_mem (twistRight_mem U hU b) (hw (b,x) (by simp))) ht⟩ + | cons c r => + obtain ⟨c,y⟩ := c + intro a ha + rcases List.mem_cons.mp ha with rfl | ha + · exact ⟨by cases b <;> simp [signInt], + P.mul_mem (P.mul_mem (twistRight_mem U hU b) (hw (b,x) (by simp))) + (twistLeft_mem U hU c)⟩ + · exact ih (fun a ha => hw a (List.mem_cons_of_mem _ ha)) a ha + +def LetterRelation (τ : A →ₚ[ℂ] ℂ) (a b : Bool × A) : Prop := + a.1 ≠ b.1 → τ a.2 = 0 + +omit [StarOrderedRing A] in +theorem trace_unitarySandwich (hτ : ∀ x y, τ (x*y) = τ (y*x)) + (U : unitary A) (x : A) : τ ((U:A) * x * star (U:A)) = τ x := by + rw [hτ] + simp only [← mul_assoc] + rw [Unitary.star_mul_self_of_mem U.property, one_mul] + +omit [StarOrderedRing A] in +theorem twist_separator_relation (hτ : ∀ x y, τ (x*y) = τ (y*x)) + (U : unitary A) (b c : Bool) (x y : A) + (h : b ≠ c → τ x = 0) : + SignedRelation τ (signInt b,twistRight U b*x*twistLeft U c) (signInt c,y) := by + cases b <;> cases c + · right; norm_num [signInt,SameSign] + · left; simpa [twistRight,twistLeft] using h (by decide) + · left + simpa only [twistRight,twistLeft,ite_true,Bool.false_eq_true,ite_false, + trace_unitarySandwich hτ] using h (by decide) + · right; norm_num [signInt,SameSign] + +omit [StarOrderedRing A] in +theorem twistExpansion_chain (hτ : ∀ x y, τ (x*y) = τ (y*x)) + (U : unitary A) (t : A) {w : List (Bool × A)} + (h : w.IsChain (LetterRelation τ)) : + (twistExpansion U t w).IsChain (SignedRelation τ) := by + induction w with + | nil => simp [twistExpansion] + | cons a w ih => + obtain ⟨b,x⟩ := a + cases w with + | nil => simp [twistExpansion] + | cons a r => + obtain ⟨c,y⟩ := a + obtain ⟨hb,ht⟩ := List.isChain_cons_cons.mp h + have hh := ih ht + cases r with + | nil => + exact List.isChain_cons_cons.mpr ⟨twist_separator_relation hτ U b c x _ hb, hh⟩ + | cons a r => + obtain ⟨d,z⟩ := a + exact List.isChain_cons_cons.mpr ⟨twist_separator_relation hτ U b c x _ hb, hh⟩ + +omit [PartialOrder A] [StarOrderedRing A] in +theorem twistExpansion_value (s U : unitary A) (t : A) (a : Bool × A) + (w : List (Bool × A)) : + twistLeft U a.1 * signedWord s (twistExpansion U t (a::w)) = + letterWord (s*U) (a::w) * t := by + induction w generalizing a with + | nil => + obtain ⟨b,x⟩ := a + calc + _ = (twistLeft U b * upow s (signInt b) * twistRight U b) * x * t := by + simp [twistExpansion,signedWord,mul_assoc] + _ = _ := by rw [unitaryLetter_factor]; simp [letterWord,mul_assoc] + | cons c w ih => + obtain ⟨b,x⟩ := a + obtain ⟨c,y⟩ := c + calc + _ = (twistLeft U b * upow s (signInt b) * twistRight U b) * x * + (twistLeft U c * signedWord s (twistExpansion U t ((c,y)::w))) := by + simp only [twistExpansion,signedWord,List.map_cons,List.prod_cons] + simp only [mul_assoc] + _ = unitaryLetter (s*U) b * x * (letterWord (s*U) ((c,y)::w) * t) := by + rw [unitaryLetter_factor,ih (c,y)] + _ = _ := by simp [letterWord,mul_assoc] + +omit [PartialOrder A] [StarOrderedRing A] in +theorem twistExpansion_right (s U : unitary A) (t : A) (a : Bool × A) + (w : List (Bool × A)) : + signedWord s (twistExpansion U t (a::w)) = + signedWord s (twistExpansion U 1 (a::w)) * t := by + induction w generalizing a with + | nil => obtain ⟨b,x⟩ := a; simp [twistExpansion,signedWord,mul_assoc] + | cons c w ih => + obtain ⟨b,x⟩ := a + obtain ⟨c,y⟩ := c + change (upow s (signInt b) * (twistRight U b*x*twistLeft U c)) * + signedWord s (twistExpansion U t ((c,y)::w)) = _ + rw [ih] + simp only [twistExpansion,signedWord,List.map_cons,List.prod_cons,mul_assoc] + +omit [StarOrderedRing A] in +theorem trace_letterWord (hτ₁ : τ 1 = 1) (hτ : ∀ x y, τ (x*y) = τ (y*x)) + (s U : unitary A) (hs : (s:A) ∈ S) (hU : (U:A) ∈ P) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) {w : List (Bool × A)} (hne : w ≠ []) + (hw : ∀ a ∈ w, a.2 ∈ P) (hc : w.IsChain (LetterRelation τ)) : + τ (letterWord (s*U) w) = 0 := by + cases w with + | nil => contradiction + | cons a w => + have hn : twistExpansion U (twistLeft U a.1) (a::w) ≠ [] := by + obtain ⟨b,x⟩ := a + cases w with + | nil => simp [twistExpansion] + | cons a w => obtain ⟨c,y⟩ := a; simp [twistExpansion] + have hh := trace_signedWord hτ₁ s hs hHaar hfree hn + (twistExpansion_mem U hU _ (twistLeft_mem U hU a.1) hw) + (twistExpansion_chain hτ U _ hc) + have hv := twistExpansion_value s U 1 a w + rw [mul_one] at hv + calc + τ (letterWord (s*U) (a::w)) + = τ (twistLeft U a.1 * signedWord s (twistExpansion U 1 (a::w))) := by rw [hv] + _ = τ (signedWord s (twistExpansion U 1 (a::w)) * twistLeft U a.1) := hτ _ _ + _ = τ (signedWord s (twistExpansion U (twistLeft U a.1) (a::w))) := by + rw [twistExpansion_right s U (twistLeft U a.1) a w] + _ = 0 := hh + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/HaarTwistMoments.lean b/lean/OAI/Analysis/FreeWords/HaarTwistMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..7270ad75481b8a8f35610870f18cdebe26d46250 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/HaarTwistMoments.lean @@ -0,0 +1,266 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarTwistLetters + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +def letterBlock (b : Bool) (n : ℕ) (x : A) : List (Bool × A) := + List.replicate n (b,(1:A)) ++ [(b,x)] + +def powerBlock (k : ℤ) (x : A) : List (Bool × A) := + match k with + | .ofNat 0 => [] + | .ofNat (n+1) => letterBlock true n x + | .negSucc n => letterBlock false n x + +omit [PartialOrder A] [StarOrderedRing A] in +theorem letterBlock_value (u : unitary A) (b : Bool) (n : ℕ) (x : A) : + letterWord u (letterBlock b n x) = unitaryLetter u b ^ (n+1) * x := by + simp [letterWord,letterBlock,List.map_replicate,List.prod_replicate,pow_succ,mul_assoc] + +omit [PartialOrder A] [StarOrderedRing A] in +theorem powerBlock_value (u : unitary A) (k : ℤ) (hk : k ≠ 0) (x : A) : + letterWord u (powerBlock k x) = upow u k * x := by + cases k with + | ofNat n => + cases n with + | zero => contradiction + | succ n => + rw [powerBlock,letterBlock_value] + change unitaryLetter u true ^ (n+1) * x = upow u ((n+1:ℕ):ℤ) * x + simp only [unitaryLetter,ite_true,upow,zpow_natCast,SubmonoidClass.coe_pow] + | negSucc n => + rw [powerBlock,letterBlock_value] + have he : Int.negSucc n = -((n+1:ℕ):ℤ) := by omega + rw [he,← star_upow] + simp only [unitaryLetter,Bool.false_eq_true,ite_false,upow,zpow_natCast, + SubmonoidClass.coe_pow,star_pow] + +omit [PartialOrder A] [StarOrderedRing A] in +theorem letterBlock_mem (b : Bool) (n : ℕ) (x : A) (hx : x ∈ P) : + ∀ a ∈ letterBlock b n x, a.2 ∈ P := by + intro a ha + rcases List.mem_append.mp ha with ha | ha + · have he := List.eq_of_mem_replicate ha + subst a + exact P.one_mem + · have he : a = (b,x) := by simpa using ha + subst a + exact hx + +omit [PartialOrder A] [StarOrderedRing A] in +theorem powerBlock_mem (k : ℤ) (x : A) (hx : x ∈ P) : + ∀ a ∈ powerBlock k x, a.2 ∈ P := by + cases k with + | ofNat n => + cases n with + | zero => simp [powerBlock] + | succ n => exact letterBlock_mem true n x hx + | negSucc n => exact letterBlock_mem false n x hx + +omit [PartialOrder A] [StarOrderedRing A] in +theorem powerBlock_ne_nil (k : ℤ) (hk : k ≠ 0) (x : A) : powerBlock k x ≠ [] := by + cases k with + | ofNat n => + cases n with + | zero => contradiction + | succ n => simp [powerBlock,letterBlock] + | negSucc n => simp [powerBlock,letterBlock] + +omit [StarOrderedRing A] in +theorem letterBlock_chain (b : Bool) (n : ℕ) (x : A) : + (letterBlock b n x).IsChain (LetterRelation τ) := by + induction n with + | zero => simp [letterBlock] + | succ n ih => + cases n with + | zero => simp [letterBlock,LetterRelation] + | succ n => simpa [letterBlock,List.replicate_succ,List.isChain_cons_cons,LetterRelation] using ih + +omit [StarOrderedRing A] in +theorem letterBlock_chain_append (b : Bool) (n : ℕ) (x : A) (hx : τ x = 0) + {w : List (Bool × A)} (hw : w.IsChain (LetterRelation τ)) : + (letterBlock b n x ++ w).IsChain (LetterRelation τ) := by + induction n with + | zero => + cases w with + | nil => simp [letterBlock] + | cons a w => + exact List.isChain_cons_cons.mpr ⟨fun _ => hx,hw⟩ + | succ n ih => + cases n with + | zero => + exact List.isChain_cons_cons.mpr ⟨fun h => (h rfl).elim,ih⟩ + | succ n => + exact List.isChain_cons_cons.mpr ⟨fun h => (h rfl).elim,ih⟩ + +omit [StarOrderedRing A] in +theorem powerBlock_chain (k : ℤ) (x : A) : + (powerBlock k x).IsChain (LetterRelation τ) := by + cases k with + | ofNat n => + cases n with + | zero => simp [powerBlock] + | succ n => exact letterBlock_chain true n x + | negSucc n => exact letterBlock_chain false n x + +omit [StarOrderedRing A] in +theorem powerBlock_chain_append (k : ℤ) (x : A) (hx : τ x = 0) + {w : List (Bool × A)} (hw : w.IsChain (LetterRelation τ)) : + (powerBlock k x ++ w).IsChain (LetterRelation τ) := by + cases k with + | ofNat n => + cases n with + | zero => simpa [powerBlock] using hw + | succ n => exact letterBlock_chain_append true n x hx hw + | negSucc n => exact letterBlock_chain_append false n x hx hw + +def powerBlocks (w : List (ℤ × A)) : List (Bool × A) := + w.flatMap (fun a => powerBlock a.1 a.2) + +omit [PartialOrder A] [StarOrderedRing A] in +theorem powerBlocks_value (u : unitary A) {w : List (ℤ × A)} + (hw : ∀ a ∈ w, a.1 ≠ 0) : letterWord u (powerBlocks w) = signedWord u w := by + induction w with + | nil => simp [powerBlocks,letterWord,signedWord] + | cons a w ih => + have htail : ∀ a ∈ w, a.1 ≠ 0 := fun a ha => hw a (List.mem_cons_of_mem _ ha) + calc + _ = letterWord u (powerBlock a.1 a.2) * letterWord u (powerBlocks w) := by + simp [powerBlocks,letterWord,List.map_append,List.prod_append] + _ = _ := by + rw [powerBlock_value u a.1 (hw a (by simp)),ih htail] + simp [signedWord] + +omit [PartialOrder A] [StarOrderedRing A] in +theorem powerBlocks_mem {w : List (ℤ × A)} (hw : ∀ a ∈ w, a.2 ∈ P) : + ∀ a ∈ powerBlocks w, a.2 ∈ P := by + intro a ha + obtain ⟨b,hb,ha⟩ := List.mem_flatMap.mp ha + exact powerBlock_mem b.1 b.2 (hw b hb) a ha + +omit [StarOrderedRing A] in +theorem powerBlocks_chain {w : List (ℤ × A)} (hw : ∀ a ∈ w, τ a.2 = 0) : + (powerBlocks w).IsChain (LetterRelation τ) := by + induction w with + | nil => simp [powerBlocks] + | cons a w ih => + exact powerBlock_chain_append a.1 a.2 (hw a (by simp)) + (ih (fun b hb => hw b (List.mem_cons_of_mem _ hb))) + +omit [PartialOrder A] [StarOrderedRing A] in +theorem powerBlocks_ne_nil {w : List (ℤ × A)} (hne : w ≠ []) + (hw : ∀ a ∈ w, a.1 ≠ 0) : powerBlocks w ≠ [] := by + cases w with + | nil => contradiction + | cons a w => + intro h + have he : powerBlock a.1 a.2 = [] := (List.append_eq_nil_iff.mp h).1 + exact powerBlock_ne_nil a.1 (hw a (by simp)) a.2 he + +omit [StarOrderedRing A] in +theorem haar_twist_moments (hτ : FaithfulTracial τ) + (s U : unitary A) (hs : (s:A) ∈ S) (hU : (U:A) ∈ P) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow s k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) : + (∀ k : ℤ, k ≠ 0 → τ (upow (s*U) k) = 0) ∧ + (∀ w : List (ℤ × A), w ≠ [] → + (∀ a ∈ w, a.1 ≠ 0 ∧ a.2 ∈ P ∧ τ a.2 = 0) → + τ ((w.map (fun a => upow (s*U) a.1 * a.2)).prod) = 0) := by + constructor + · intro k hk + have hz := trace_letterWord hτ.1 hτ.2.1 s U hs hU hHaar hfree + (powerBlock_ne_nil k hk 1) (powerBlock_mem k 1 P.one_mem) (powerBlock_chain k 1) + simpa only [powerBlock_value _ _ hk, mul_one] using hz + · intro w hne hw + have hk : ∀ a ∈ w, a.1 ≠ 0 := fun a ha => (hw a ha).1 + have hz := trace_letterWord hτ.1 hτ.2.1 s U hs hU hHaar hfree + (powerBlocks_ne_nil hne hk) (powerBlocks_mem (fun a ha => (hw a ha).2.1)) + (powerBlocks_chain (fun a ha => (hw a ha).2.2)) + simpa only [powerBlocks_value _ hk, signedWord] using hz + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/KronExpansion.lean b/lean/OAI/Analysis/FreeWords/KronExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd907557c81e452efb172b6b42e899197710916b --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/KronExpansion.lean @@ -0,0 +1,28 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +noncomputable section + +variable {ι κ A : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + [Ring A] [Algebra ℂ A] [StarRing A] [StarModule ℂ A] + +theorem kronecker_one_expansion (a : Matrix ι ι ℂ) : + Matrix.kronecker a (1 : Matrix κ κ ℂ)=∑ i,∑ j,∑ k, a i j • Matrix.single (i,k) (j,k) 1 := by + apply Matrix.ext + rintro ⟨i,k⟩ ⟨j,l⟩ + change a i j * (if k=l then 1 else 0) = _ + simp only [Matrix.sum_apply,Matrix.smul_apply, + Matrix.single_apply,Prod.mk.injEq,ite_and,smul_eq_mul] + simp + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/LaurentSpan.lean b/lean/OAI/Analysis/FreeWords/LaurentSpan.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8facccb4c84fe55f0359d5efc17e0ff457a1d8e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/LaurentSpan.lean @@ -0,0 +1,223 @@ +import Mathlib +import OAI.Analysis.FreeWords.ConjugateFree + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +def laurentAlgebra (u : unitary A) : StarSubalgebra ℂ A := + StarAlgebra.adjoin ℂ {(u:A)} + +def laurentSpan (u : unitary A) : Submodule ℂ A := + Submodule.span ℂ (Set.range (upow u)) + +def centeredLaurentSpan (u : unitary A) : Submodule ℂ A := + Submodule.span ℂ {x | ∃ k : ℤ, k ≠ 0 ∧ upow u k = x} + +omit [PartialOrder A] [StarOrderedRing A] in +theorem upow_mem_laurentSpan (u : unitary A) (k : ℤ) : + upow u k ∈ laurentSpan u := Submodule.subset_span ⟨k,rfl⟩ + +omit [PartialOrder A] [StarOrderedRing A] in +theorem laurentSpan_mul (u : unitary A) {x y : A} + (hx : x ∈ laurentSpan u) (hy : y ∈ laurentSpan u) : x*y ∈ laurentSpan u := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨k,rfl⟩ := hx + induction hy using Submodule.span_induction with + | mem y hy => + obtain ⟨l,rfl⟩ := hy + rw [← upow_add] + exact upow_mem_laurentSpan u _ + | zero => simp + | add a b ha hb ia ib => simpa only [mul_add] using (laurentSpan u).add_mem ia ib + | smul c a ha ia => simpa only [mul_smul_comm] using (laurentSpan u).smul_mem c ia + | zero => simp + | add a b ha hb ia ib => simpa only [add_mul] using (laurentSpan u).add_mem ia ib + | smul c a ha ia => simpa only [smul_mul_assoc] using (laurentSpan u).smul_mem c ia + +omit [PartialOrder A] [StarOrderedRing A] in +theorem laurentSpan_star (u : unitary A) {x : A} (hx : x ∈ laurentSpan u) : + star x ∈ laurentSpan u := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨k,rfl⟩ := hx + rw [star_upow] + exact upow_mem_laurentSpan u _ + | zero => simp + | add a b ha hb ia ib => simpa only [star_add] using (laurentSpan u).add_mem ia ib + | smul c a ha ia => simpa only [star_smul] using (laurentSpan u).smul_mem (star c) ia + +omit [PartialOrder A] [StarOrderedRing A] in +theorem laurentAlgebra_le_span (u : unitary A) {x : A} (hx : x ∈ laurentAlgebra u) : + x ∈ laurentSpan u := by + induction hx using StarAlgebra.adjoin_induction with + | mem x hx => + obtain rfl := Set.mem_singleton_iff.mp hx + simpa using upow_mem_laurentSpan u 1 + | algebraMap c => + have h1 : (1:A) ∈ laurentSpan u := by simpa using upow_mem_laurentSpan u 0 + simpa [Algebra.algebraMap_eq_smul_one] using (laurentSpan u).smul_mem c h1 + | add x y hx hy ihx ihy => exact (laurentSpan u).add_mem ihx ihy + | mul x y hx hy ihx ihy => exact laurentSpan_mul u ihx ihy + | star x hx ih => exact laurentSpan_star u ih + +omit [StarOrderedRing A] in +theorem centered_mem_laurentSpan (hτ : τ 1 = 1) (u : unitary A) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) + {x : A} (hx : x ∈ laurentSpan u) : x - τ x • 1 ∈ centeredLaurentSpan u := by + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨k,rfl⟩ := hx + by_cases hk : k=0 + · simp [hk,hτ] + · rw [hHaar k hk,zero_smul,sub_zero] + exact Submodule.subset_span ⟨k,hk,rfl⟩ + | zero => simp + | add a b ha hb ia ib => + have he : a+b-τ (a+b) • (1:A) = (a-τ a • 1)+(b-τ b • 1) := by + rw [map_add,add_smul] + abel + rw [he] + exact (centeredLaurentSpan u).add_mem ia ib + | smul c a ha ia => + rw [map_smul,smul_eq_mul,← smul_smul,← smul_sub] + exact (centeredLaurentSpan u).smul_mem c ia + +omit [StarOrderedRing A] in +theorem trace_zero_laurent_mem_span (hτ : τ 1 = 1) (u : unitary A) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) + {x : A} (hx : x ∈ laurentAlgebra u) (hz : τ x = 0) : + x ∈ centeredLaurentSpan u := by + simpa only [hz,zero_smul,sub_zero] using + centered_mem_laurentSpan hτ u hHaar (laurentAlgebra_le_span u hx) + +omit [PartialOrder A] [StarOrderedRing A] in +theorem linear_prod_zero_of_span {ι : Type*} (T : ι → Set A) + (w : List (ι × A)) (φ : A →ₗ[ℂ] ℂ) + (hw : ∀ a ∈ w, a.2 ∈ Submodule.span ℂ (T a.1)) + (hzero : ∀ y : List (ι × A), y.map Prod.fst = w.map Prod.fst → + (∀ a ∈ y, a.2 ∈ T a.1) → φ ((y.map Prod.snd).prod) = 0) : + φ ((w.map Prod.snd).prod) = 0 := by + induction w generalizing φ with + | nil => exact hzero [] rfl (by simp) + | cons a w ih => + obtain ⟨i,x⟩ := a + have htail : ∀ a ∈ w, a.2 ∈ Submodule.span ℂ (T a.1) := + fun a ha => hw a (List.mem_cons_of_mem _ ha) + have hx := hw (i,x) (by simp) + change x ∈ Submodule.span ℂ (T i) at hx + simp only [List.map_cons] at hzero + clear hw + simp only [List.map_cons,List.prod_cons] + induction hx using Submodule.span_induction with + | mem x hx => + apply ih (φ.comp (LinearMap.mulLeft ℂ x)) htail + intro y hy hmem + simpa using hzero ((i,x)::y) (by simpa using hy) (by + intro a ha + rcases List.mem_cons.mp ha with rfl | ha + · exact hx + · exact hmem a ha) + | zero => simp + | add x z hx hz ix iz => simp only [add_mul,map_add,ix,iz,add_zero] + | smul c x hx ix => simp only [smul_mul_assoc,map_smul,ix,smul_zero] + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/LocalCompression.lean b/lean/OAI/Analysis/FreeWords/LocalCompression.lean new file mode 100644 index 0000000000000000000000000000000000000000..71068dea0a53d6c569d2284860ccb9714593755a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/LocalCompression.lean @@ -0,0 +1,88 @@ +import Mathlib +import OAI.Analysis.FreeWords.CompressionMoment +import OAI.Analysis.FreeWords.MatrixQuantizationLarge + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +theorem local_small_compression + {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {ι : Type*} [Fintype ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) + (x : ι → ConcreteAlgebra M) (hx : ∀ i, τ.map (x i)=0) + (ε : ℝ) (hε : 0 < ε) : + ∃ q : ConcreteAlgebra M, IsStarProjection q ∧ q ≠ 0 ∧ + (τ.map q).re < ε ∧ + ∑ i, (traceNorm τ (q*x i*q))^2 < ε*(τ.map q).re := by + classical + let A : ℝ := ∑ i,(traceNorm τ (x i))^2 + have hA : 0 ≤ A := Finset.sum_nonneg (fun _ _ => sq_nonneg _) + let k : ℝ := Fintype.card ι + have hk : 0 ≤ k := Nat.cast_nonneg _ + let δ : ℝ := min 1 (ε/(4*(k+1))) + have hδ : 0 < δ := lt_min (by norm_num) (by positivity) + have hδ1 : δ ≤ 1 := min_le_left _ _ + have hδb : δ ≤ ε/(4*(k+1)) := min_le_right _ _ + have hδk : k*δ ≤ ε/4 := by + have hmul := (le_div_iff₀ (by positivity : 0 < 4*(k+1))).mp hδb + nlinarith + obtain ⟨N,hN⟩ := exists_nat_gt (2+(2*A+1)/ε) + obtain ⟨d,hd,ρ,hρ,hNd,hsmall⟩ := matrix_commutant_quantization_large M τ hF hD x hx N δ hδ + have hdR : 0 < (d : ℝ) := Nat.cast_pos.mpr hd + have hNdR : (N : ℝ) ≤ d := Nat.cast_le.mpr hNd + have hdim : 2+(2*A+1)/ε < (d : ℝ) := hN.trans_le hNdR + have hd2 : 2 ≤ d := by + have hfrac : 0 ≤ (2*A+1)/ε := by positivity + have : (2 : ℝ) < d := by linarith + exact_mod_cast this.le + have hdA : 2*A+1 < ε*(d : ℝ) := by + have hh : (2*A+1)/ε < (d : ℝ) := by linarith + have hmul := (div_lt_iff₀ hε).mp hh + nlinarith + have hB : (∑ i,(traceNorm τ (matrixAverage ρ (x i)))^2) ≤ ε/4 := by + calc + _ ≤ ∑ _ : ι,δ := by + apply Finset.sum_le_sum + intro i hi + have hz := traceNorm_nonneg τ (matrixAverage ρ (x i)) + have hhi := hsmall i + nlinarith + _ = k*δ := by simp [k] + _ ≤ ε/4 := hδk + have hb : (A+(d : ℝ)*∑ i,(traceNorm τ (matrixAverage ρ (x i)))^2)/ + ((d : ℝ)*((d : ℝ)+1)) < ε/(d : ℝ) := by + apply (div_lt_iff₀ (by positivity : 0 < (d : ℝ)*((d : ℝ)+1))).mpr + have hm : ε/(d : ℝ)*((d : ℝ)*((d : ℝ)+1))=ε*((d : ℝ)+1) := by field_simp + rw [hm] + have hh := mul_le_mul_of_nonneg_left hB hdR.le + nlinarith + let z : Fin d := ⟨0,hd⟩ + obtain ⟨U,hU⟩ := exists_rankOne_small_compression τ ρ hd2 z x ε hb + have htrace : (τ.map (rankOne ρ z U)).re=(d : ℝ)⁻¹ := by + rw [rankOne_trace] + rw [← Complex.ofReal_natCast,← Complex.ofReal_inv,Complex.ofReal_re] + refine ⟨rankOne ρ z U,rankOne_projection ρ z U,?_,?_,?_⟩ + · intro hq + have ht := htrace + rw [hq,map_zero,Complex.zero_re] at ht + exact (inv_ne_zero hdR.ne').symm ht + · rw [htrace,← one_div] + apply (div_lt_iff₀ hdR).mpr + nlinarith + · rw [htrace] + simpa only [div_eq_mul_inv] using hU + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/LocalPatch.lean b/lean/OAI/Analysis/FreeWords/LocalPatch.lean new file mode 100644 index 0000000000000000000000000000000000000000..430c30597728ec840ed0d8ace051a7db42c7c80e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/LocalPatch.lean @@ -0,0 +1,57 @@ +import Mathlib +import OAI.Analysis.FreeWords.CenteredCornerCompression +import OAI.Analysis.FreeWords.CornerWeakPowers + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKProjectionSupport KKMatrixQuantization + +noncomputable section + +theorem local_patch + {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {ι κ : Type*} [Fintype ι] [Fintype κ] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) + (p : ConcreteAlgebra M) (hp : IsStarProjection p) (hp0 : p≠0) + (x : ι → ConcreteAlgebra M) (z : κ → ConcreteAlgebra M) + (k : κ → ℤ) (hk : ∀ i, k i ≠ 0) (ε : ℝ) (hε : 0<ε) : + ∃ v : PartialUnitary (ConcreteAlgebra M), + v.support≠0 ∧ v.support*p=v.support ∧ (τ.map v.support).re<ε ∧ + (∑ i, (traceNorm τ (v.support*x i*v.support- + ((τ.map p)⁻¹*τ.map (p*x i*p)) • v.support))^2 < ε*(τ.map v.support).re) ∧ + ∀ i, ‖τ.map (v.power (k i)*z i)‖<ε*(τ.map v.support).re := by + let y (i : ι) := p*x i*p + have hy (i:ι) : p*y i*p=y i := by + dsimp only [y] + simp only [← mul_assoc,hp.isIdempotentElem.eq] + rw [mul_assoc (p*x i) p p,hp.isIdempotentElem.eq] + obtain ⟨q,hq,hq0,hqp,hqt,hqs⟩ := corner_centered_compression M τ hF hD p hp hp0 y hy ε hε + have hpq : p*q=q := by + have h := congrArg star hqp + simpa only [star_mul,hp.isSelfAdjoint.star_eq,hq.isSelfAdjoint.star_eq] using h + have he (i:ι) : q*y i*q=q*x i*q := by + dsimp only [y] + calc + q*(p*x i*p)*q = (q*p)*x i*(p*q) := by noncomm_ring + _ = q*x i*q := by rw [hqp,hpq] + have hqτ : 0<(τ.map q).re := trace_projection_pos τ hq hq0 + obtain ⟨v,hv,hsmall⟩ := corner_weakly_small_powers M τ hF hD q hq hq0 z k hk + (ε*(τ.map q).re) (mul_pos hε hqτ) + refine ⟨v,hv ▸ hq0,?_,?_,?_,?_⟩ + · rw [hv]; exact hqp + · rw [hv]; exact hqt + · rw [hv] + simpa only [he] using hqs + · rw [hv]; exact hsmall + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/Main.lean b/lean/OAI/Analysis/FreeWords/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..2bfe6f672c79fa7d9d97c5fa8ee73e8e58d9c9b8 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/Main.lean @@ -0,0 +1,266 @@ +import OAI.Analysis.FreeWords.FreeWordCore +import OAI.Analysis.FreeWords.OperatorRows +import OAI.Analysis.FreeWords.TupleCombinatorics +import OAI.Analysis.FreeWords.CutAlgebra +import OAI.Analysis.FreeWords.GNSRows +import OAI.Analysis.FreeWords.TupleMatrices +import OAI.Analysis.FreeWords.CutTuples +import OAI.Analysis.FreeWords.CutNorms +import OAI.Analysis.FreeWords.GNSCutBridge +import OAI.Analysis.FreeWords.GNSCutNorms +import OAI.Analysis.FreeWords.SingleCutNorm +import OAI.Analysis.FreeWords.GNSSingleWords +import OAI.Analysis.FreeWords.ScalarExpansion +import OAI.Analysis.FreeWords.GNSProjectionRemainder +import OAI.Analysis.FreeWords.FactorialSum +import OAI.Analysis.FreeWords.NumericCuts +import OAI.Analysis.FreeWords.FreeWords +import OAI.Analysis.FreeWords.ThroughLabel +import OAI.Analysis.FreeWords.FullThroughLabel +import OAI.Analysis.FreeWords.ConjugateCopies +import OAI.Analysis.FreeWords.VNAModel +import OAI.Analysis.FreeWords.ConcreteWords +import OAI.Analysis.FreeWords.WeakCompact +import OAI.Analysis.FreeWords.TraceTransferDefinitions +import OAI.Analysis.FreeWords.MatrixL2Definitions +import OAI.Analysis.FreeWords.MatrixL2WordDefinitions +import OAI.Analysis.FreeWords.MatrixDyadicArithmetic +import OAI.Analysis.FreeWords.CenteredMatrixDensityDefinitions +import OAI.Analysis.FreeWords.RestrictedDerivationDefinitions +import OAI.Analysis.FreeWords.KronExpansion +import OAI.Analysis.FreeWords.HaarEndpointsDefinitions +import OAI.Analysis.FreeWords.HaarLeftEndpointDefinitions +import OAI.Analysis.FreeWords.HaarEndpointLimitsDefinitions +import OAI.Analysis.FreeWords.MatrixRangeCenter +import OAI.Analysis.FreeWords.EntryWords +import OAI.Analysis.FreeWords.MatrixLeftEndpointDefinitions +import OAI.Analysis.FreeWords.UltraTrace +import OAI.Analysis.FreeWords.WeakMeanAlgebra +import OAI.Analysis.FreeWords.FactorBase +import OAI.Analysis.FreeWords.TraceTransfer +import OAI.Analysis.FreeWords.FactorHullGeneric +import OAI.Analysis.FreeWords.FactorStructure +import OAI.Analysis.FreeWords.FactorCorners +import OAI.Analysis.FreeWords.ProjectionSmall +import OAI.Analysis.FreeWords.NumericalModelDefinitions +import OAI.Analysis.FreeWords.RecoveryArithmetic +import OAI.Analysis.FreeWords.RelativeMatrixDefinitions +import OAI.Analysis.FreeWords.MatrixModelDefinitions +import OAI.Analysis.FreeWords.UltraDiagonal +import OAI.Analysis.FreeWords.ScalarAmalgamatedDefinitions +import OAI.Analysis.FreeWords.ScalarAmalgamated +import OAI.Analysis.FreeWords.MatrixConditionalExpectation +import OAI.Analysis.FreeWords.AmplifiedModelDefinitions +import OAI.Analysis.FreeWords.FiniteFreeDefinitions +import OAI.Analysis.FreeWords.BoundedStrongContinuity +import OAI.Analysis.FreeWords.TraceStrongContinuity +import OAI.Analysis.FreeWords.CenteredMatrixDensity +import OAI.Analysis.FreeWords.DenseFreeSequenceDefinitions +import OAI.Analysis.FreeWords.FiniteMomentNet +import OAI.Analysis.FreeWords.HaarFiniteEndpointsDefinitions +import OAI.Analysis.FreeWords.MatrixAverageBasic +import OAI.Analysis.FreeWords.MatrixTraceUnique +import OAI.Analysis.FreeWords.BlockMatrixEmbedding +import OAI.Analysis.FreeWords.PartialIsoAlgebra +import OAI.Analysis.FreeWords.PartialIsoResidual +import OAI.Analysis.FreeWords.PartialIsoChain +import OAI.Analysis.FreeWords.PolarGeometry +import OAI.Analysis.FreeWords.Bicommutant +import OAI.Analysis.FreeWords.PolarBounds +import OAI.Analysis.FreeWords.ProjectionStructure +import OAI.Analysis.FreeWords.UnitaryExtension +import OAI.Analysis.FreeWords.ProjectionChain +import OAI.Analysis.FreeWords.ProjectionSubdivision +import OAI.Analysis.FreeWords.ProjectionPartition +import OAI.Analysis.FreeWords.MatrixUnitHom +import OAI.Analysis.FreeWords.MatrixSubfactor +import OAI.Analysis.FreeWords.UnitaryRangePreimage +import OAI.Analysis.FreeWords.MatrixProduct +import OAI.Analysis.FreeWords.MatrixCorner +import OAI.Analysis.FreeWords.MatrixCommutant +import OAI.Analysis.FreeWords.MatrixCommutantTrace +import OAI.Analysis.FreeWords.MatrixReindex +import OAI.Analysis.FreeWords.MatrixExtendSize +import OAI.Analysis.FreeWords.MatrixRangeProjections +import OAI.Analysis.FreeWords.BicommutantTrace +import OAI.Analysis.FreeWords.VariableUltraAlgebra +import OAI.Analysis.FreeWords.VariableUltraBall +import OAI.Analysis.FreeWords.SpectralClip +import OAI.Analysis.FreeWords.TracialClipApprox +import OAI.Analysis.FreeWords.GNSQuotient +import OAI.Analysis.FreeWords.TracialBicommutant +import OAI.Analysis.FreeWords.VariableUltraBundle +import OAI.Analysis.FreeWords.VariableUltraProjection +import OAI.Analysis.FreeWords.UnitaryTraceWitnessSupport +import OAI.Analysis.FreeWords.FiniteDimensionalWitness +import OAI.Analysis.FreeWords.FiniteSubalgebraWitness +import OAI.Analysis.FreeWords.MatrixRangeWitness +import OAI.Analysis.FreeWords.FactorDiffuseCriterion +import OAI.Analysis.FreeWords.VariableUltraFactor +import OAI.Analysis.FreeWords.VariableMatrixUltra +import OAI.Analysis.FreeWords.CanonicalMatrixExtension +import OAI.Analysis.FreeWords.RationalWeights +import OAI.Analysis.FreeWords.ProjectionRound +import OAI.Analysis.FreeWords.PartitionHom +import OAI.Analysis.FreeWords.SupportProjections +import OAI.Analysis.FreeWords.PositiveSupport +import OAI.Analysis.FreeWords.SpectralCuts +import OAI.Analysis.FreeWords.FiniteSpectrum +import OAI.Analysis.FreeWords.NormalFiniteSpectrum +import OAI.Analysis.FreeWords.UnitaryFiniteSpectrum +import OAI.Analysis.FreeWords.ExponentialUnitaryApprox +import OAI.Analysis.FreeWords.SurjectiveExponentialLift +import OAI.Analysis.FreeWords.MatrixAverageTrace +import OAI.Analysis.FreeWords.TraceL2Convergence +import OAI.Analysis.FreeWords.MixedScaling +import OAI.Analysis.FreeWords.PartialUnitaryAlgebra +import OAI.Analysis.FreeWords.PartialWords +import OAI.Analysis.FreeWords.PatchingWordFamilies +import OAI.Analysis.FreeWords.MixedToPatching +import OAI.Analysis.FreeWords.PartialUnitaryOrder +import OAI.Analysis.FreeWords.PartialUnitaryTrace +import OAI.Analysis.FreeWords.PartialUnitaryNorm +import OAI.Analysis.FreeWords.PartialUnitaryChain +import OAI.Analysis.FreeWords.PatchingMaximal +import OAI.Analysis.FreeWords.PatchTraceBounds +import OAI.Analysis.FreeWords.ColoredExpansion +import OAI.Analysis.FreeWords.PatchingGapWords +import OAI.Analysis.FreeWords.PatchingExpansion +import OAI.Analysis.FreeWords.PatchingTermTrace +import OAI.Analysis.FreeWords.ColoredSplit +import OAI.Analysis.FreeWords.PatchingFill +import OAI.Analysis.FreeWords.PatchingBudget +import OAI.Analysis.FreeWords.PatchingCornerBounds +import OAI.Analysis.FreeWords.ConcreteCornerGeometry +import OAI.Analysis.FreeWords.ConcreteCornerAlgebra +import OAI.Analysis.FreeWords.ConcreteCornerTrace +import OAI.Analysis.FreeWords.TupleHull +import OAI.Analysis.FreeWords.CornerCentralScalar +import OAI.Analysis.FreeWords.ConcreteCornerFactor +import OAI.Analysis.FreeWords.CyclicMatrix +import OAI.Analysis.FreeWords.CyclicBasis +import OAI.Analysis.FreeWords.WeakPowers +import OAI.Analysis.FreeWords.CornerWeakPowers +import OAI.Analysis.FreeWords.TensorCalculus +import OAI.Analysis.FreeWords.TensorLieKernel +import OAI.Analysis.FreeWords.TensorLieSpan +import OAI.Analysis.FreeWords.TensorGram +import OAI.Analysis.FreeWords.TensorUnitaryEnd +import OAI.Analysis.FreeWords.TensorHaar +import OAI.Analysis.FreeWords.HaarMoment +import OAI.Analysis.FreeWords.SecondMoment +import OAI.Analysis.FreeWords.RankOneCompression +import OAI.Analysis.FreeWords.MatrixAverageCycle +import OAI.Analysis.FreeWords.SimultaneousDispersion +import OAI.Analysis.FreeWords.PartitionRefine +import OAI.Analysis.FreeWords.RoundingMatrixUnitary +import OAI.Analysis.FreeWords.ChosenUnitaryMatrix +import OAI.Analysis.FreeWords.MatrixEnergyDecrease +import OAI.Analysis.FreeWords.MatrixEnergyExtend +import OAI.Analysis.FreeWords.MatrixQuantizationEnd +import OAI.Analysis.FreeWords.MatrixQuantizationLarge +import OAI.Analysis.FreeWords.CompressionMoment +import OAI.Analysis.FreeWords.LocalCompression +import OAI.Analysis.FreeWords.CornerCompression +import OAI.Analysis.FreeWords.CenteredCornerCompression +import OAI.Analysis.FreeWords.LocalPatch +import OAI.Analysis.FreeWords.PatchingTerms +import OAI.Analysis.FreeWords.PatchingTermBound +import OAI.Analysis.FreeWords.PatchingExtension +import OAI.Analysis.FreeWords.PatchingNearFull +import OAI.Analysis.FreeWords.PatchingSmall +import OAI.Analysis.FreeWords.ScalarFreeApprox +import OAI.Analysis.FreeWords.UnitaryTraceContinuity +import OAI.Analysis.FreeWords.FreeSurjectiveImage +import OAI.Analysis.FreeWords.FreePreimage +import OAI.Analysis.FreeWords.CoordinateFreeExtract +import OAI.Analysis.FreeWords.CoordinateConstantFree +import OAI.Analysis.FreeWords.NumericalModel +import OAI.Analysis.FreeWords.AmplifiedModel +import OAI.Analysis.FreeWords.AmplifiedCyclicApprox +import OAI.Analysis.FreeWords.RelativeConjugationDefinitions +import OAI.Analysis.FreeWords.ControlledMatrixConjugation +import OAI.Analysis.FreeWords.RelativeEndpointLimitsDefinitions +import OAI.Analysis.FreeWords.RelativeFiniteEndpointsDefinitions +import OAI.Analysis.FreeWords.HaarEndpoints +import OAI.Analysis.FreeWords.HaarEndpointLimits +import OAI.Analysis.FreeWords.HaarLeftEndpoint +import OAI.Analysis.FreeWords.MatrixLeftEndpoint +import OAI.Analysis.FreeWords.RelativeEndpointLimits +import OAI.Analysis.FreeWords.CyclicApproxNet +import OAI.Analysis.FreeWords.RelativeFiniteEndpoints +import OAI.Analysis.FreeWords.MatrixTraceCyclic +import OAI.Analysis.FreeWords.MatrixPowerBlockLimitsDefinitions +import OAI.Analysis.FreeWords.MatrixPowerBlockLimits +import OAI.Analysis.FreeWords.AmplifiedBlockModelDefinitions +import OAI.Analysis.FreeWords.AmplifiedBlockModel +import OAI.Analysis.FreeWords.TransportBlocks +import OAI.Analysis.FreeWords.TransportTestsDefinitions +import OAI.Analysis.FreeWords.MatrixExpectationContinuous +import OAI.Analysis.FreeWords.TransportTests +import OAI.Analysis.FreeWords.AmplifiedBlockBoundsDefinitions +import OAI.Analysis.FreeWords.MatrixUnitaryBounds +import OAI.Analysis.FreeWords.AsymptoticBlockTransportDefinitions +import OAI.Analysis.FreeWords.AsymptoticProduct +import OAI.Analysis.FreeWords.AsymptoticBlockTransport +import OAI.Analysis.FreeWords.AmplifiedBlockBounds +import OAI.Analysis.FreeWords.TransportLimits +import OAI.Analysis.FreeWords.FiniteMatrixFreeApproximation +import OAI.Analysis.FreeWords.CountableFreeLift +import OAI.Analysis.FreeWords.DenseFreeSequence +import OAI.Analysis.FreeWords.RemainingFreeLiftLifting +import OAI.Analysis.FreeWords.MatrixModel +import OAI.Analysis.FreeWords.MatrixAveraging +import OAI.Analysis.FreeWords.MatrixHilbertDefinitions +import OAI.Analysis.FreeWords.MatrixHilbertCore +import OAI.Analysis.FreeWords.ScalarMatrixCommutator +import OAI.Analysis.FreeWords.ControlledLiftCommutator +import OAI.Analysis.FreeWords.TraceBallDensity +import OAI.Analysis.FreeWords.PermutationDistance +import OAI.Analysis.FreeWords.GramCounting +import OAI.Analysis.FreeWords.WeightedInverse +import OAI.Analysis.FreeWords.PowerMetricInverse +import OAI.Analysis.FreeWords.WeingartenDecay +import OAI.Analysis.FreeWords.HaarFiniteEndpoints +import OAI.Analysis.FreeWords.ScalarMatrixFree +import OAI.Analysis.FreeWords.MatrixTraceL2 +import OAI.Analysis.FreeWords.MatrixL2Closure +import OAI.Analysis.FreeWords.FlipBasic +import OAI.Analysis.FreeWords.FlipNorm +import OAI.Analysis.FreeWords.FlipEnd +import OAI.Analysis.FreeWords.RelativeMatrix +import OAI.Analysis.FreeWords.RelativeConjugation +import OAI.Analysis.FreeWords.Stability +import OAI.Analysis.FreeWords.FlipAverage +import OAI.Analysis.FreeWords.DirichletCounts +import OAI.Analysis.FreeWords.PolarApproximation +import OAI.Analysis.FreeWords.UnitaryLift +import OAI.Analysis.FreeWords.FactorVarianceStructure +import OAI.Analysis.FreeWords.UltraExpectationDefs +import OAI.Analysis.FreeWords.UltraQuotientRange +import OAI.Analysis.FreeWords.UltraExpectation +import OAI.Analysis.FreeWords.UltraFactorStructure +import OAI.Analysis.FreeWords.DyadicGrid +import OAI.Analysis.FreeWords.MatrixL2Word +import OAI.Analysis.FreeWords.ProjectionMatrix +import OAI.Analysis.FreeWords.DyadicPhases +import OAI.Analysis.FreeWords.UltraBallFull +import OAI.Analysis.FreeWords.HaarGridElement +import OAI.Analysis.FreeWords.ConjugateFree +import OAI.Analysis.FreeWords.HaarExistence +import OAI.Analysis.FreeWords.ConjugateCopies2 +import OAI.Analysis.FreeWords.FreeCompressionMoments +import OAI.Analysis.FreeWords.DirichletMoments +import OAI.Analysis.FreeWords.HaarSignedWords +import OAI.Analysis.FreeWords.PositiveMoments +import OAI.Analysis.FreeWords.RegularizedOrder +import OAI.Analysis.FreeWords.HaarSignedTrace +import OAI.Analysis.FreeWords.HaarTwistLetters +import OAI.Analysis.FreeWords.CornerState +import OAI.Analysis.FreeWords.ScalarRecovery +import OAI.Analysis.FreeWords.HaarTwistMoments +import OAI.Analysis.FreeWords.LaurentSpan +import OAI.Analysis.FreeWords.HaarTwistEndpoints +import OAI.Analysis.FreeWords.HaarTwistGenerators +import OAI.Analysis.FreeWords.HaarTwistLaurent +import OAI.Analysis.FreeWords.UltraExpectationFull diff --git a/lean/OAI/Analysis/FreeWords/MatrixAverageBasic.lean b/lean/OAI/Analysis/FreeWords/MatrixAverageBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc02c77c22e42e9bd7286bbd1548cf2ccca175fe --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixAverageBasic.lean @@ -0,0 +1,103 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +noncomputable section + +variable {ι A : Type*} [Fintype ι] [DecidableEq ι] [Ring A] [Algebra ℂ A] [StarRing A] + +def matrixAverage (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) (x : A) : A := + (Fintype.card ι : ℂ)⁻¹ • ∑ i, ∑ j, + ρ (Matrix.single i j 1) * x * ρ (Matrix.single j i 1) + +end + +end KKMatrixQuantization + +namespace KKMatrixQuantization + +noncomputable section + +variable {ι A : Type*} [Fintype ι] [DecidableEq ι] [Ring A] [Algebra ℂ A] [StarRing A] + +variable (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) + +def matrixUnit (i j : ι) : A := ρ (Matrix.single i j 1) + +@[simp] theorem matrixUnit_star (i j : ι) : star (matrixUnit ρ i j)=matrixUnit ρ j i := by + simp only [matrixUnit,← map_star,Matrix.star_eq_conjTranspose,Matrix.conjTranspose_single,star_one] + +theorem matrixUnit_mul (i j k l : ι) : + matrixUnit ρ i j*matrixUnit ρ k l=if j=k then matrixUnit ρ i l else 0 := by + simp only [matrixUnit,← map_mul] + split_ifs with h + · subst k; simp only [Matrix.single_mul_single_same,one_mul] + · rw [Matrix.single_mul_single_of_ne 1 i j k h 1,map_zero] + +@[simp] theorem matrixUnit_mul_same (i j k : ι) : + matrixUnit ρ i j*matrixUnit ρ j k=matrixUnit ρ i k := by + rw [matrixUnit_mul,ite_eq_left rfl] + +@[simp] theorem matrixUnit_sum_diag : (∑ i, matrixUnit ρ i i)=1 := by + simp only [matrixUnit,← map_sum,Matrix.sum_single_one,map_one] + +theorem matrix_representation (x : Matrix ι ι ℂ) : ρ x=∑ i, ∑ j, x i j • matrixUnit ρ i j := by + conv_lhs => rw [Matrix.matrix_eq_sum_single x] + simp only [map_sum,matrixUnit] + congr 1; ext i + congr 1; ext j + rw [← map_smul,Matrix.smul_single,smul_eq_mul,mul_one] + +theorem matrixAverage_add (x y : A) : matrixAverage ρ (x+y)=matrixAverage ρ x+matrixAverage ρ y := by + simp only [matrixAverage,mul_add,add_mul,Finset.sum_add_distrib,smul_add] + +theorem matrixAverage_smul (c : ℂ) (x : A) : matrixAverage ρ (c • x)=c • matrixAverage ρ x := by + simp only [matrixAverage,mul_smul_comm,smul_mul_assoc,← Finset.smul_sum] + rw [smul_comm] + +def matrixAverageLinear : A →ₗ[ℂ] A where + toFun := matrixAverage ρ + map_add' := matrixAverage_add ρ + map_smul' := fun c x => by exact matrixAverage_smul ρ c x + +theorem matrixAverage_commute (x : A) (k l : ι) : + Commute (matrixAverage ρ x) (matrixUnit ρ k l) := by + change matrixAverage ρ x*matrixUnit ρ k l=matrixUnit ρ k l*matrixAverage ρ x + change ((Fintype.card ι:ℂ)⁻¹ • (∑ i, ∑ j, matrixUnit ρ i j*x*matrixUnit ρ j i))*matrixUnit ρ k l= + matrixUnit ρ k l*((Fintype.card ι:ℂ)⁻¹ • (∑ i, ∑ j, matrixUnit ρ i j*x*matrixUnit ρ j i)) + simp only [smul_mul_assoc,mul_smul_comm,Finset.sum_mul,Finset.mul_sum] + congr 1 + calc + (∑ i, ∑ j, matrixUnit ρ i j*x*matrixUnit ρ j i*matrixUnit ρ k l) = + ∑ j, matrixUnit ρ k j*x*matrixUnit ρ j l := by + simp only [mul_assoc,matrixUnit_mul,mul_ite,mul_zero,Finset.sum_ite_irrel, + Finset.sum_const_zero,Finset.sum_ite_eq',Finset.mem_univ,ite_true] + _ = ∑ i, ∑ j, matrixUnit ρ k l*(matrixUnit ρ i j*x*matrixUnit ρ j i) := by + symm + simp only [← mul_assoc,matrixUnit_mul,ite_mul,zero_mul,Finset.sum_ite_irrel, + Finset.sum_const_zero,Finset.sum_ite_eq,Finset.mem_univ,ite_true] + +theorem matrixAverage_fixed [Nonempty ι] (x : A) + (hx : ∀ i j, Commute x (matrixUnit ρ i j)) : matrixAverage ρ x=x := by + have hc : (Fintype.card ι:ℂ)≠0 := Nat.cast_ne_zero.mpr (Fintype.card_ne_zero) + change (Fintype.card ι:ℂ)⁻¹ • (∑ i, ∑ j, matrixUnit ρ i j*x*matrixUnit ρ j i)=x + have he (i j : ι) : matrixUnit ρ i j*x*matrixUnit ρ j i=matrixUnit ρ i i*x := by + rw [mul_assoc,(hx j i).eq,← mul_assoc,matrixUnit_mul_same] + simp only [he,Finset.sum_const,Finset.card_univ,← Finset.smul_sum,matrixUnit_sum_diag, + ← Finset.sum_mul,one_mul] + rw [← Nat.cast_smul_eq_nsmul ℂ,smul_smul,inv_mul_cancel₀ hc,one_smul] + +theorem matrixAverage_idempotent [Nonempty ι] (x : A) : + matrixAverage ρ (matrixAverage ρ x)=matrixAverage ρ x := + matrixAverage_fixed ρ _ (matrixAverage_commute ρ x) + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixAverageCycle.lean b/lean/OAI/Analysis/FreeWords/MatrixAverageCycle.lean new file mode 100644 index 0000000000000000000000000000000000000000..d922c186e48461da2427a40de31e0865d874cdf2 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixAverageCycle.lean @@ -0,0 +1,47 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixAverageBasic + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +noncomputable section + +variable {ι A : Type*} [Fintype ι] [DecidableEq ι] [Ring A] [Algebra ℂ A] [StarRing A] + +variable (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) + +theorem matrixAverage_cycle_unit (x : A) (k l : ι) : + matrixAverage ρ (matrixUnit ρ k l*x)=matrixAverage ρ (x*matrixUnit ρ k l) := by + change (Fintype.card ι:ℂ)⁻¹ • (∑ i,∑ j,matrixUnit ρ i j*(matrixUnit ρ k l*x)*matrixUnit ρ j i)= + (Fintype.card ι:ℂ)⁻¹ • (∑ i,∑ j,matrixUnit ρ i j*(x*matrixUnit ρ k l)*matrixUnit ρ j i) + congr 1 + apply Finset.sum_congr rfl + intro i hi + conv_lhs => arg 2; intro j; rw [← mul_assoc,matrixUnit_mul] + simp only [ite_mul,zero_mul,Finset.sum_ite_eq',Finset.mem_univ,ite_true] + conv_rhs => arg 2; intro j; rw [mul_assoc,mul_assoc,matrixUnit_mul] + simp only [mul_ite,mul_zero,Finset.sum_ite_eq,Finset.mem_univ,ite_true,mul_assoc] + +theorem matrixAverage_sum {κ : Type*} (s : Finset κ) (f : κ → A) : + matrixAverage ρ (∑ i∈s, f i)=∑ i∈s, matrixAverage ρ (f i) := + map_sum (matrixAverageLinear ρ) f s + +theorem matrixAverage_cycle (a : Matrix ι ι ℂ) (x : A) : + matrixAverage ρ (ρ a*x)=matrixAverage ρ (x*ρ a) := by + rw [matrix_representation ρ a] + simp only [Finset.sum_mul,Finset.mul_sum,smul_mul_assoc,mul_smul_comm,matrixAverage_sum, + matrixAverage_smul,matrixAverage_cycle_unit] + +theorem matrixAverage_conjugate (a : unitary (Matrix ι ι ℂ)) (x : A) : + matrixAverage ρ (ρ a.val*x*ρ (star a.val))=matrixAverage ρ x := by + rw [mul_assoc,matrixAverage_cycle,mul_assoc,← map_mul,Unitary.coe_star_mul_self,map_one,mul_one] + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixAverageTrace.lean b/lean/OAI/Analysis/FreeWords/MatrixAverageTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..3748cb76721e0b730e10cf8d9dd4d6d44c93e9cc --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixAverageTrace.lean @@ -0,0 +1,104 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixAverageBasic +import OAI.Analysis.FreeWords.ProjectionRound + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +open KKTraceTransfer KKUltraTrace + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] {M : VonNeumannAlgebra H} + +variable (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] ConcreteAlgebra M) (τ : FaithfulNormalTrace M) + +omit [Nonempty ι] in +theorem matrixAverage_star (x : ConcreteAlgebra M) : + star (matrixAverage ρ x)=matrixAverage ρ (star x) := by + change star ((Fintype.card ι:ℂ)⁻¹ • ∑ i, ∑ j, matrixUnit ρ i j*x*matrixUnit ρ j i)=_ + simp only [star_smul,star_sum,star_mul,matrixUnit_star] + simp only [matrixAverage,matrixUnit,mul_assoc] + congr 1 + simp + +omit [Nonempty ι] in +theorem matrixAverage_trace_symm (x y : ConcreteAlgebra M) : + τ.map (matrixAverage ρ x*y)=τ.map (x*matrixAverage ρ y) := by + change τ.map (((Fintype.card ι:ℂ)⁻¹ • ∑ i,∑ j,matrixUnit ρ i j*x*matrixUnit ρ j i)*y)= + τ.map (x*((Fintype.card ι:ℂ)⁻¹ • ∑ i,∑ j,matrixUnit ρ i j*y*matrixUnit ρ j i)) + simp only [smul_mul_assoc,mul_smul_comm,Finset.sum_mul,Finset.mul_sum,map_smul,map_sum] + congr 1 + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + simp only [mul_assoc] + rw [τ.tracial (matrixUnit ρ j i)] + simp only [mul_assoc] + +theorem matrixAverage_one : matrixAverage ρ 1=1 := + matrixAverage_fixed ρ 1 (fun _ _ => Commute.one_left _) + +theorem matrixAverage_trace (x : ConcreteAlgebra M) : τ.map (matrixAverage ρ x)=τ.map x := by + have hh := matrixAverage_trace_symm ρ τ x 1 + simpa only [mul_one,matrixAverage_one] using hh + +omit [Nonempty ι] in +theorem matrixAverage_inner (x y : ConcreteAlgebra M) : + (tracePositive τ) (star (matrixAverage ρ x)*y)= + (tracePositive τ) (star x*matrixAverage ρ y) := by + change τ.map (star (matrixAverage ρ x)*y)=τ.map (star x*matrixAverage ρ y) + rw [matrixAverage_star,matrixAverage_trace_symm] + +theorem matrixAverage_traceNorm_le (x : ConcreteAlgebra M) : + traceNorm τ (matrixAverage ρ x) ≤ traceNorm τ x := by + let v := gnsVector (tracePositive τ) x + let z := gnsVector (tracePositive τ) (matrixAverage ρ x) + have hin : ⟪v,z⟫_ℂ=⟪z,z⟫_ℂ := by + simp only [v,z,gnsVector_inner,matrixAverage_inner,matrixAverage_idempotent] + have hh := norm_inner_le_norm (𝕜 := ℂ) v z + rw [hin,inner_self_eq_norm_sq_to_K,norm_pow,RCLike.norm_ofReal,abs_norm] at hh + simp only [traceNorm_eq_gns] + by_cases hz : ‖z‖=0 + · change ‖z‖ ≤ ‖v‖ + rw [hz]; exact norm_nonneg _ + · have hp : 0 < ‖z‖ := lt_of_le_of_ne (norm_nonneg _) (Ne.symm hz) + change ‖z‖ ≤ ‖v‖ + nlinarith + +theorem traceNorm_smul (c : ℂ) (x : ConcreteAlgebra M) : + traceNorm τ (c • x)=‖c‖*traceNorm τ x := by + simp only [traceNorm_eq_gns,map_smul,norm_smul] + +theorem traceNorm_star (x : ConcreteAlgebra M) : traceNorm τ (star x)=traceNorm τ x := by + simp only [traceNorm,star_star] + rw [τ.tracial] + +theorem traceNorm_mul_right_le (x y : ConcreteAlgebra M) : + traceNorm τ (x*y) ≤ traceNorm τ x*‖y‖ := by + rw [← traceNorm_star τ (x*y),star_mul] + simpa only [norm_star,traceNorm_star,mul_comm] using traceNorm_mul_le τ (star y) (star x) + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixAveraging.lean b/lean/OAI/Analysis/FreeWords/MatrixAveraging.lean new file mode 100644 index 0000000000000000000000000000000000000000..d738ea7fa6c30561c56c9f78ff000b349b7a8221 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixAveraging.lean @@ -0,0 +1,92 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKMatrixAveraging + +noncomputable section + +open MeasureTheory TopologicalSpace + +open scoped Topology + +theorem finite_dimensional_commutant_approximation + {B A : Type*} [CStarAlgebra B] [FiniteDimensional ℂ B] [CStarAlgebra A] + (ρ : B →⋆ₐ[ℂ] A) (h : A) (δ : ℝ) + (hδ : ∀ u : unitary B, ‖h * ρ u.val - ρ u.val * h‖ ≤ δ) : + ∃ h₀ : A, (∀ b : B, Commute h₀ (ρ b)) ∧ ‖h-h₀‖ ≤ δ := by + classical + have hδ0 : 0 ≤ δ := by simpa using hδ 1 + rcases subsingleton_or_nontrivial B with hB|hB + · let := hB + refine ⟨h,?_,by simpa using hδ0⟩ + intro b + rw [Subsingleton.elim b 0,map_zero] + exact Commute.zero_right h + let := hB + let : CompactSpace (unitary B) := by + apply isCompact_iff_compactSpace.mp + apply (isCompact_closedBall (0:B) 1).of_isClosed_subset isClosed_unitary + intro b hb + simp [Metric.mem_closedBall,dist_zero_right,CStarRing.norm_coe_unitary (⟨b,hb⟩:unitary B)] + let : MeasurableSpace (unitary B) := borel (unitary B) + let : BorelSpace (unitary B) := ⟨rfl⟩ + let K : PositiveCompacts (unitary B) := ⟨⟨Set.univ,isCompact_univ⟩,by simp⟩ + let μ : Measure (unitary B) := Measure.haarMeasure K + let : IsProbabilityMeasure μ := ⟨Measure.haarMeasure_self⟩ + let U (u:unitary B) : unitary A := ⟨ρ u.val,by + constructor + · rw [← map_star,← map_mul,u.property.1,map_one] + · rw [← map_star,← map_mul,u.property.2,map_one]⟩ + let f (u:unitary B) : A := ρ u.val*h*star (ρ u.val) + have hρ : Continuous ρ := ρ.toAlgHom.toLinearMap.continuous_of_finiteDimensional + have hf : Continuous f := by dsimp only [f]; fun_prop + have hfi : Integrable f μ := hf.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace f) + let h₀ : A := ∫ u, f u ∂μ + have hfix (u:unitary B) : ρ u.val*h₀*star (ρ u.val)=h₀ := by + have hfi' : Integrable (fun v => ρ u.val*f v) μ := + (by fun_prop : Continuous (fun v => ρ u.val*f v)).integrable_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) + change ρ u.val*(∫v,f v ∂μ)*star (ρ u.val)=∫v,f v ∂μ + rw [← integral_const_mul_of_integrable hfi,← integral_mul_const_of_integrable hfi'] + convert integral_mul_left_eq_self (μ:=μ) f u using 1 + congr 1 + funext v + simp only [f,Submonoid.coe_mul,map_mul,star_mul] + simp only [mul_assoc] + have hcomm (u:unitary B) : Commute h₀ (ρ u.val) := by + have hh := congrArg (fun x:A => x*ρ u.val) (hfix u) + have hu : star (ρ u.val)*ρ u.val=1 := (U u).property.1 + change h₀*ρ u.val=ρ u.val*h₀ + simpa only [mul_assoc,hu,mul_one] using hh.symm + refine ⟨h₀,?_,?_⟩ + · intro b + have hb : b∈Submodule.span ℂ (unitary B:Set B) := by rw [CStarAlgebra.span_unitary]; trivial + induction hb using Submodule.span_induction with + | mem b hb => exact hcomm ⟨b,hb⟩ + | zero => rw [map_zero]; exact Commute.zero_right _ + | add x y hx hy ihx ihy => rw [map_add]; exact ihx.add_right ihy + | smul c x hx ih => rw [map_smul]; exact ih.smul_right c + · have hn (u:unitary B) : ‖h-f u‖≤δ := by + have hu : ρ u.val*star (ρ u.val)=1 := (U u).property.2 + have he : h-f u=(h*ρ u.val-ρ u.val*h)*star (ρ u.val) := by + dsimp only [f] + rw [sub_mul,mul_assoc h,hu,mul_one] + rw [he] + change ‖(h*ρ u.val-ρ u.val*h)*((star (U u)).val)‖≤δ + rw [CStarRing.norm_mul_coe_unitary] + exact hδ u + have he : h-h₀=∫u,h-f u ∂μ := by + rw [integral_sub (integrable_const h) hfi,integral_const] + simp [h₀] + rw [he] + simpa using norm_integral_le_of_norm_le_const (μ:=μ) (Filter.Eventually.of_forall hn) + +end + +end KKMatrixAveraging +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixCommutant.lean b/lean/OAI/Analysis/FreeWords/MatrixCommutant.lean new file mode 100644 index 0000000000000000000000000000000000000000..71ae69fc8a82cf0d0236fee2c7bd4527bccf7990 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixCommutant.lean @@ -0,0 +1,110 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorStructure +import OAI.Analysis.FreeWords.MatrixCorner + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def vnaCentralizer (s : Set (H →L[ℂ] H)) : VonNeumannAlgebra H where + toStarSubalgebra := StarSubalgebra.centralizer ℂ s + centralizer_centralizer' := by + change Set.centralizer (Set.centralizer (Set.centralizer (s ∪ star s))) = _ + exact Set.centralizer_centralizer_centralizer _ + +def vnaMeet (M N : VonNeumannAlgebra H) : VonNeumannAlgebra H where + toStarSubalgebra := M.toStarSubalgebra ⊓ N.toStarSubalgebra + centralizer_centralizer' := by + apply Set.Subset.antisymm + · intro x hx + exact ⟨by + have hh := Set.centralizer_subset (Set.centralizer_subset (show + (M.toStarSubalgebra ⊓ N.toStarSubalgebra : Set (H →L[ℂ] H)) ⊆ M from fun _ h => h.1)) hx + simpa only [M.centralizer_centralizer,VonNeumannAlgebra.coe_toStarSubalgebra] using hh, + by + have hh := Set.centralizer_subset (Set.centralizer_subset (show + (M.toStarSubalgebra ⊓ N.toStarSubalgebra : Set (H →L[ℂ] H)) ⊆ N from fun _ h => h.2)) hx + simpa only [N.centralizer_centralizer,VonNeumannAlgebra.coe_toStarSubalgebra] using hh⟩ + · exact Set.subset_centralizer_centralizer + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] {M : VonNeumannAlgebra H} + +variable (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] ConcreteAlgebra M) + +def matrixCommutant : VonNeumannAlgebra H := + vnaMeet M (vnaCentralizer (Set.range fun a : Matrix ι ι ℂ => (ρ a : H →L[ℂ] H))) + +theorem mem_matrixCommutant (x : H →L[ℂ] H) : + x ∈ matrixCommutant ρ ↔ x ∈ M ∧ ∀ i j, Commute x ((matrixUnit ρ i j : ConcreteAlgebra M) : H →L[ℂ] H) := by + change (x ∈ M ∧ x ∈ StarSubalgebra.centralizer ℂ _) ↔ _ + rw [StarSubalgebra.mem_centralizer_iff] + constructor + · rintro ⟨hx,hc⟩ + refine ⟨hx,fun i j => ?_⟩ + exact ((hc _ ⟨Matrix.single i j 1,rfl⟩).1).symm + · rintro ⟨hx,hc⟩ + refine ⟨hx,?_⟩ + have ha (a : Matrix ι ι ℂ) : Commute x (ρ a : H →L[ℂ] H) := by + change Commute x ((M.toStarSubalgebra.subtype.comp ρ) a) + rw [matrix_representation] + apply Commute.sum_right + intro i hi + apply Commute.sum_right + intro j hj + exact (hc i j).smul_right (a i j) + rintro y ⟨a,rfl⟩ + exact ⟨(ha a).eq.symm,by + have hh := (ha (star a)).eq.symm + rw [map_star] at hh + exact hh⟩ + +def commutantInclusion : ConcreteAlgebra (matrixCommutant ρ) →⋆ₐ[ℂ] ConcreteAlgebra M where + toFun x := ⟨x.val,((mem_matrixCommutant ρ _).mp x.property).1⟩ + map_one' := rfl + map_mul' _ _ := rfl + map_zero' := rfl + map_add' _ _ := rfl + commutes' _ := rfl + map_star' _ := rfl + +theorem commutantInclusion_injective : Function.Injective (commutantInclusion ρ) := + fun _ _ h => Subtype.ext (congrArg (fun z : ConcreteAlgebra M => z.val) h) + +def inCommutant (x : ConcreteAlgebra M) (hx : ∀ i j, Commute x (matrixUnit ρ i j)) : + ConcreteAlgebra (matrixCommutant ρ) := + ⟨x.val,(mem_matrixCommutant ρ _).mpr ⟨x.property,fun i j => congrArg Subtype.val (hx i j).eq⟩⟩ + +@[simp] theorem inclusion_inCommutant (x : ConcreteAlgebra M) (hx) : + commutantInclusion ρ (inCommutant ρ x hx)=x := rfl + +theorem inclusion_commute (x : ConcreteAlgebra (matrixCommutant ρ)) (i j : ι) : + Commute (commutantInclusion ρ x) (matrixUnit ρ i j) := by + apply Subtype.ext + exact ((mem_matrixCommutant ρ _).mp x.property).2 i j + +theorem matrixCommutant_factor [Nonempty ι] (hF : IsFactor M) : IsFactor (matrixCommutant ρ) := by + intro x hx + let o : ι := Classical.choice inferInstance + obtain ⟨c,hc⟩ := hF (commutantInclusion ρ x) (commute_of_matrix_coordinates ρ o _ + (inclusion_commute ρ x) (fun y => by + have hh := congrArg (commutantInclusion ρ) (hx (inCommutant ρ (cornerLift ρ o y) (cornerLift_commute ρ o y))).eq + change _ * _ = _ * _ + simpa only [map_mul,inclusion_inCommutant] using hh)) + refine ⟨c, ?_⟩ + apply commutantInclusion_injective ρ + exact hc + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixCommutantTrace.lean b/lean/OAI/Analysis/FreeWords/MatrixCommutantTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..b85df614b744dd328ad8b16cdf55a438859f8e10 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixCommutantTrace.lean @@ -0,0 +1,106 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixCommutant +import OAI.Analysis.FreeWords.ProjectionSmall + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +open KKTraceTransfer KKFreeLiftFrontier + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] {M : VonNeumannAlgebra H} + +variable (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] ConcreteAlgebra M) + +def commutantTrace (τ : FaithfulNormalTrace M) : FaithfulNormalTrace (matrixCommutant ρ) where + map := τ.map.comp (commutantInclusion ρ).toLinearMap + positive x hx := τ.positive _ hx + normalized := τ.normalized + tracial x y := by + change τ.map (commutantInclusion ρ x*commutantInclusion ρ y)= + τ.map (commutantInclusion ρ y*commutantInclusion ρ x) + exact τ.tracial _ _ + faithful x hx hτ := commutantInclusion_injective ρ (τ.faithful _ hx hτ) + normal r := by + let f : WeakAlgebra (matrixCommutant ρ) → WeakAlgebra M := + fun T => ⟨T.val,((mem_matrixCommutant ρ _).mp T.property).1⟩ + have hf : Continuous f := continuous_subtype_val.subtype_mk _ + exact (τ.normal r).comp hf.continuousOn (fun T hT => hT) + +@[simp] theorem commutantTrace_apply (τ : FaithfulNormalTrace M) (x : ConcreteAlgebra (matrixCommutant ρ)) : + (commutantTrace ρ τ).map x=τ.map (commutantInclusion ρ x) := rfl + +@[simp] theorem commutantTrace_norm (τ : FaithfulNormalTrace M) (x : ConcreteAlgebra (matrixCommutant ρ)) : + traceNorm (commutantTrace ρ τ) x=traceNorm τ (commutantInclusion ρ x) := by + simp only [traceNorm,commutantTrace_apply,map_mul,map_star] + +theorem cornerLift_zero (o : ι) : cornerLift ρ o 0=0 := by simp [cornerLift] + +theorem matrixCommutant_diffuse [Nonempty ι] (hD : IsDiffuse M) : IsDiffuse (matrixCommutant ρ) := by + intro p hp hp0 + let o : ι := Classical.choice inferInstance + let b := commutantInclusion ρ p + let e := matrixUnit ρ o o + have hb : IsStarProjection b := hp.map _ + have he : IsStarProjection e := ⟨matrixUnit_mul_same ρ o o o,matrixUnit_star ρ o o⟩ + have hbe : Commute b e := inclusion_commute ρ p o o + let a := e*b*e + have haeq : a=e*b := by + change e*b*e=e*b + rw [mul_assoc,hbe.eq,← mul_assoc,he.isIdempotentElem.eq] + have ha : IsStarProjection a := by rw [haeq]; exact he.mul hb hbe.symm + have hab : cornerLift ρ o a=b := cornerLift_fixed ρ o b (inclusion_commute ρ p) + have ha0 : a≠0 := by + intro hh + have hh' : b=0 := by rw [← hab,hh,cornerLift_zero] + exact hp0 (commutantInclusion_injective ρ hh') + obtain ⟨q,hq,hq0,hqa,hqq⟩ := hD a ha ha0 + have hae : a*e=a := by dsimp [a]; rw [mul_assoc,he.isIdempotentElem.eq] + have hqe : q*e=q := by rw [← hqq,mul_assoc,hae,hqq] + have heq : e*q=q := by + simpa only [star_mul,he.isSelfAdjoint.star_eq,hq.isSelfAdjoint.star_eq] using congrArg star hqe + let c := cornerLift ρ o q + have hc : IsStarProjection c := by + constructor + · change cornerLift ρ o q*cornerLift ρ o q=cornerLift ρ o q + rw [cornerLift_mul_cornerLift,hqe,hq.isIdempotentElem.eq] + · change star (cornerLift ρ o q)=cornerLift ρ o q + rw [cornerLift_star,hq.isSelfAdjoint.star_eq] + have hcompress : e*c*e=q := by + change matrixUnit ρ o o*cornerLift ρ o q*matrixUnit ρ o o=q + rw [cornerLift_compression] + change e*q*e=q + rw [heq,hqe] + let Q := inCommutant ρ c (cornerLift_commute ρ o q) + refine ⟨Q,?_,?_,?_,?_⟩ + · constructor + · apply (commutantInclusion_injective ρ) + simpa only [map_mul,Q,inclusion_inCommutant] using hc.isIdempotentElem.eq + · apply (commutantInclusion_injective ρ) + simpa only [map_star,Q,inclusion_inCommutant] using hc.isSelfAdjoint.star_eq + · intro hh + have hcz : c=0 := congrArg (commutantInclusion ρ) hh + exact hq0 (by simpa only [hcz,mul_zero,zero_mul] using hcompress.symm) + · intro hh + have hcb : c=b := congrArg (commutantInclusion ρ) hh + exact hqa (by rw [← hcompress,hcb]) + · apply commutantInclusion_injective ρ + change c*b=c + rw [← hab] + change cornerLift ρ o q*cornerLift ρ o a=cornerLift ρ o q + rw [cornerLift_mul_cornerLift,hqe,hqq] + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixConditionalExpectation.lean b/lean/OAI/Analysis/FreeWords/MatrixConditionalExpectation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c2ac27215eec7e99e644334739a25f161d6e644 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixConditionalExpectation.lean @@ -0,0 +1,123 @@ +import Mathlib +import OAI.Analysis.FreeWords.ScalarAmalgamated + +namespace OAI + +noncomputable section + +namespace KKMatrixExpectation + +open KKAmalgamatedTransport + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] [StarModule ℂ A] + +def numericalHom (n : ℕ) : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] Matrix (Fin n) (Fin n) A := + { (Algebra.ofId ℂ A).mapMatrix with + map_star' := by + intro x + ext i j + exact map_star (StarAlgHom.ofId ℂ A) (x j i) } + +@[simp] theorem numericalHom_apply (n : ℕ) (a : Matrix (Fin n) (Fin n) ℂ) (i j : Fin n) : + numericalHom (A := A) n a i j=algebraMap ℂ A (a i j) := rfl + +def matrixTraceMap (τ : A →ₗ[ℂ] ℂ) (n : ℕ) : Matrix (Fin n) (Fin n) A →ₗ[ℂ] ℂ := + (n:ℂ)⁻¹ • (Matrix.traceLinearMap (Fin n) ℂ ℂ).comp τ.mapMatrix + +def matrixExpectation (τ : A →ₗ[ℂ] ℂ) (n : ℕ) : + Matrix (Fin n) (Fin n) A →ₗ[ℂ] Matrix (Fin n) (Fin n) A := + (numericalHom (A := A) n).toLinearMap.comp τ.mapMatrix + +@[simp] theorem matrixExpectation_apply (τ : A →ₗ[ℂ] ℂ) (n : ℕ) + (x : Matrix (Fin n) (Fin n) A) (i j : Fin n) : + matrixExpectation τ n x i j=algebraMap ℂ A (τ (x i j)) := rfl + +omit [StarRing A] [StarModule ℂ A] in +@[simp] theorem matrixTraceMap_apply (τ : A →ₗ[ℂ] ℂ) (n : ℕ) + (x : Matrix (Fin n) (Fin n) A) : + matrixTraceMap τ n x=(n:ℂ)⁻¹*∑i,τ (x i i) := rfl + +omit [StarRing A] [StarModule ℂ A] in +theorem trace_algebraMap (τ : A →ₗ[ℂ] ℂ) (hτ1 : τ 1=1) (z : ℂ) : + τ (algebraMap ℂ A z)=z := by + rw [Algebra.algebraMap_eq_smul_one,map_smul,hτ1,smul_eq_mul,mul_one] + +theorem matrixTraceMap_numerical (τ : A →ₗ[ℂ] ℂ) (hτ1 : τ 1=1) (n : ℕ) + (z : Matrix (Fin n) (Fin n) ℂ) : + matrixTraceMap τ n (numericalHom (A := A) n z)=(n:ℂ)⁻¹*Matrix.trace z := by + simp only [matrixTraceMap_apply,numericalHom_apply,trace_algebraMap τ hτ1,Matrix.trace,Matrix.diag] + +theorem matrixTraceMap_one (τ : A →ₗ[ℂ] ℂ) (hτ1 : τ 1=1) {n : ℕ} (hn : 0 + arg 2; intro i; arg 2; intro j + rw [← mul_assoc (matrixUnit ρ o j) (matrixUnit ρ i o),matrixUnit_mul] + simp only [ite_mul,zero_mul,mul_ite,mul_zero,Finset.sum_ite_eq',Finset.mem_univ,ite_true] + +theorem cornerLift_fixed (x : A) (hx : ∀ i j, Commute x (matrixUnit ρ i j)) : + cornerLift ρ o (matrixUnit ρ o o*x*matrixUnit ρ o o)=x := by + have he (i : ι) : matrixUnit ρ i o*(matrixUnit ρ o o*x*matrixUnit ρ o o)*matrixUnit ρ o i= + matrixUnit ρ i i*x := by + simp only [← mul_assoc,matrixUnit_mul_same] + rw [mul_assoc,matrixUnit_mul_same,mul_assoc,(hx o i).eq,← mul_assoc,matrixUnit_mul_same] + simp only [cornerLift,he,← Finset.sum_mul,matrixUnit_sum_diag,one_mul] + +theorem matrix_corner_expansion (x : A) : + x = ∑ i, ∑ j, matrixUnit ρ i o*cornerLift ρ o (matrixUnit ρ o i*x*matrixUnit ρ j o)*matrixUnit ρ o j := by + have he (i j : ι) : matrixUnit ρ i o*cornerLift ρ o (matrixUnit ρ o i*x*matrixUnit ρ j o)*matrixUnit ρ o j= + matrixUnit ρ i i*x*matrixUnit ρ j j := by + rw [mul_cornerLift] + simp only [← mul_assoc,matrixUnit_mul_same] + simp only [mul_assoc,matrixUnit_mul_same] + simp only [he,← Finset.mul_sum,matrixUnit_sum_diag,mul_one,← Finset.sum_mul,one_mul] + +theorem commute_of_matrix_coordinates (x : A) + (he : ∀ i j, Commute x (matrixUnit ρ i j)) + (hL : ∀ y, Commute x (cornerLift ρ o y)) (y : A) : Commute x y := by + rw [matrix_corner_expansion ρ o y] + apply Commute.sum_right + intro i hi + apply Commute.sum_right + intro j hj + exact ((he i o).mul_right (hL _)).mul_right (he o j) + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixDyadicArithmetic.lean b/lean/OAI/Analysis/FreeWords/MatrixDyadicArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..2dab7905d41859b1aa97f0fac0a59657ad2a335b --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixDyadicArithmetic.lean @@ -0,0 +1,22 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +theorem dyadic_rank_trace (d m j : ℕ) (hd : 0 + have := h + rw [Subsingleton.elim u.val 0,norm_zero] + norm_num + | inr h => + have := h + exact (CStarRing.norm_coe_unitary u).le + +theorem algebraConj_traceNorm_sub_le (u v : unitary (ConcreteAlgebra M)) + (x : ConcreteAlgebra M) : + traceNorm τ (algebraConj u x-algebraConj v x) ≤ + (2*‖x‖)*traceNorm τ (u.val-v.val) := by + have he : algebraConj u x-algebraConj v x= + (u.val-v.val)*x*star u.val+v.val*x*star (u.val-v.val) := by + simp only [algebraConj,star_sub] + noncomm_ring + rw [he] + have h1 := traceNorm_mul_right_le τ ((u.val-v.val)*x) (star u.val) + have h2 := traceNorm_mul_right_le τ (u.val-v.val) x + have h3 := traceNorm_mul_le τ (v.val*x) (star (u.val-v.val)) + have h4 := norm_mul_le v.val x + rw [norm_star] at h1 + rw [traceNorm_star] at h3 + have hu := unitary_norm_le_one u + have hv := unitary_norm_le_one v + have ha : traceNorm τ ((u.val-v.val)*x*star u.val) ≤ + traceNorm τ (u.val-v.val)*‖x‖ := + h1.trans ((mul_le_mul h2 hu (norm_nonneg _) (mul_nonneg (traceNorm_nonneg _ _) (norm_nonneg _))).trans (by simp)) + have hb : traceNorm τ (v.val*x*star (u.val-v.val)) ≤ + ‖x‖*traceNorm τ (u.val-v.val) := by + apply h3.trans + apply mul_le_mul_of_nonneg_right _ (traceNorm_nonneg _ _) + exact h4.trans (by nlinarith [norm_nonneg x]) + have hh := (traceNorm_add_le τ _ _).trans (add_le_add ha hb) + nlinarith [hh] + +theorem finite_polynomial_slack {ι : Type*} [Fintype ι] + (a b : ι → ℝ) (s : ℝ) (hs : 0 < s) + (ha : ∑ i, (a i)^2 ≤ 3*s) : + ∃ ε : ℝ, 0 < ε ∧ ∑ i, (a i+b i*ε)^2 < 7/2*s := by + have hc : Continuous (fun t : ℝ => ∑ i, (a i+b i*t)^2) := by fun_prop + have h0 : (∑ i, (a i+b i*0)^2) < 7/2*s := by simp only [mul_zero,add_zero]; linarith + have hn := hc.continuousAt.eventually_lt_const h0 + obtain ⟨δ,hδ,hd⟩ := Metric.mem_nhds_iff.mp hn + refine ⟨δ/2,half_pos hδ,hd ?_⟩ + rw [Metric.mem_ball,Real.dist_eq] + simpa [abs_of_pos (half_pos hδ)] using (half_lt_self hδ) + +theorem exists_matrix_energy_decrease {ι : Type*} [Fintype ι] + (hF : IsFactor M) (hD : IsDiffuse M) (x : ι → ConcreteAlgebra M) + (hx : ∀ i, τ.map (x i)=0) (hs : 0 < ∑ i, (traceNorm τ (x i))^2) : + ∃ (n : ℕ) (_hn : 0 < n) + (ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M), + Function.Injective ρ ∧ + ∑ i, (traceNorm τ (matrixAverage ρ (x i)))^2 < + 7/8*∑ i, (traceNorm τ (x i))^2 := by + classical + obtain ⟨u,hu⟩ := exists_simultaneous_dispersion τ hF x hx + obtain ⟨ε,hε,hεb⟩ := finite_polynomial_slack + (fun i => traceNorm τ (x i+algebraConj u (x i))) (fun i => 2*‖x i‖) _ hs hu + obtain ⟨n,hn,ρ,v,hρ,hv⟩ := chosen_unitary_matrix_approximation M τ hF hD u ε hε + have : NeZero n := ⟨Nat.ne_of_gt hn⟩ + let V : unitary (ConcreteAlgebra M) := ⟨ρ v.val,Unitary.map_mem ρ v.property⟩ + have hpoint (i : ι) : 2*traceNorm τ (matrixAverage ρ (x i)) ≤ + traceNorm τ (x i+algebraConj u (x i))+2*‖x i‖*ε := by + have he : matrixAverage ρ (x i+algebraConj V (x i))= + (2:ℂ) • matrixAverage ρ (x i) := by + rw [matrixAverage_add] + change matrixAverage ρ (x i)+matrixAverage ρ (ρ v.val*x i*star (ρ v.val))=_ + rw [← map_star,matrixAverage_conjugate] + module + have hh := matrixAverage_traceNorm_le ρ τ (x i+algebraConj V (x i)) + rw [he,traceNorm_smul] at hh + norm_num at hh + change 2*traceNorm τ (matrixAverage ρ (x i)) ≤ + traceNorm τ (x i+algebraConj V (x i)) at hh + have ht := traceNorm_add_le τ (x i+algebraConj u (x i)) + (algebraConj V (x i)-algebraConj u (x i)) + have he2 : x i+algebraConj u (x i)+(algebraConj V (x i)-algebraConj u (x i))= + x i+algebraConj V (x i) := by abel + rw [he2] at ht + have hb := algebraConj_traceNorm_sub_le τ V u (x i) + have hv' : traceNorm τ (V.val-u.val) < ε := by + simpa only [traceNorm_eq_gns,map_sub,norm_sub_rev] using hv + nlinarith [traceNorm_nonneg τ (matrixAverage ρ (x i)), norm_nonneg (x i)] + refine ⟨n,hn,ρ,hρ,?_⟩ + have hh : 4*(∑ i, (traceNorm τ (matrixAverage ρ (x i)))^2) ≤ + ∑ i, (traceNorm τ (x i+algebraConj u (x i))+2*‖x i‖*ε)^2 := by + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro i hi + have hp := hpoint i + have hn0 := traceNorm_nonneg τ (matrixAverage ρ (x i)) + nlinarith + linarith + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixEnergyExtend.lean b/lean/OAI/Analysis/FreeWords/MatrixEnergyExtend.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef24d320fe7fc3f8be839f78ade9e6a994a43282 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixEnergyExtend.lean @@ -0,0 +1,79 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixCommutantTrace +import OAI.Analysis.FreeWords.MatrixEnergyDecrease +import OAI.Analysis.FreeWords.MatrixProduct +import OAI.Analysis.FreeWords.MatrixReindex + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem map_matrixAverage {ι A B : Type*} [Fintype ι] [DecidableEq ι] + [Ring A] [Algebra ℂ A] [StarRing A] [StarModule ℂ A] + [Ring B] [Algebra ℂ B] [StarRing B] [StarModule ℂ B] + (f : A →⋆ₐ[ℂ] B) (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) (x : A) : + f (matrixAverage ρ x)=matrixAverage (f.comp ρ) (f x) := by + simp only [matrixAverage,map_smul,map_sum,map_mul,StarAlgHom.comp_apply] + +theorem exists_extended_energy_decrease {ι : Type*} [Fintype ι] + {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) (x : ι → ConcreteAlgebra M) + (hx : ∀ i, τ.map (x i)=0) (n : ℕ) (hn : 0 < n) + (ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M) + (hs : 0 < ∑ i, (traceNorm τ (matrixAverage ρ (x i)))^2) : + ∃ (m : ℕ) (_hm : 0 < m) + (σ : Matrix (Fin m) (Fin m) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M), + Function.Injective σ ∧ + ∑ i, (traceNorm τ (matrixAverage σ (x i)))^2 < + 7/8*∑ i, (traceNorm τ (matrixAverage ρ (x i)))^2 := by + classical + have : NeZero n := ⟨Nat.ne_of_gt hn⟩ + let B := matrixCommutant ρ + let τB := commutantTrace ρ τ + let y (i : ι) : ConcreteAlgebra B := + inCommutant ρ (matrixAverage ρ (x i)) (matrixAverage_commute ρ (x i)) + have hy (i : ι) : τB.map (y i)=0 := by + change τ.map (matrixAverage ρ (x i))=0 + rw [matrixAverage_trace,hx] + have hnrm (i : ι) : traceNorm τB (y i)=traceNorm τ (matrixAverage ρ (x i)) := + commutantTrace_norm ρ τ (y i) + obtain ⟨k,hk,σ,vσ,hσ⟩ := exists_matrix_energy_decrease τB + (matrixCommutant_factor ρ hF) (matrixCommutant_diffuse ρ hD) y hy (by simpa only [hnrm] using hs) + have : NeZero k := ⟨Nat.ne_of_gt hk⟩ + let σ' := (commutantInclusion ρ).comp σ + have hc (i j : Fin n) (a b : Fin k) : Commute (matrixUnit ρ i j) (matrixUnit σ' a b) := + (inclusion_commute ρ (matrixUnit σ a b) i j).symm + let P := matrixProduct ρ σ' hc + let e : Fin n × Fin k ≃ Fin (n*k) := finProdFinEquiv + let Q := P.comp (matrixReindex e.symm) + have : Nontrivial (ConcreteAlgebra M) := ⟨⟨0,1,fun h => by + have ht := congrArg τ.map h + rw [map_zero,τ.normalized] at ht + exact zero_ne_one ht⟩⟩ + have : NeZero (n*k) := ⟨Nat.ne_of_gt (Nat.mul_pos hn hk)⟩ + refine ⟨n*k,Nat.mul_pos hn hk,Q,Q.toAlgHom.toRingHom.injective,?_⟩ + have he (i : ι) : traceNorm τ (matrixAverage Q (x i))= + traceNorm τB (matrixAverage σ (y i)) := by + rw [commutantTrace_norm] + change traceNorm τ (matrixAverage (P.comp (matrixReindex e.symm)) (x i))= + traceNorm τ ((commutantInclusion ρ) (matrixAverage σ (y i))) + rw [reindex_average,map_matrixAverage] + change traceNorm τ (matrixAverage (matrixProduct ρ σ' hc) (x i))= + traceNorm τ (matrixAverage σ' (matrixAverage ρ (x i))) + rw [matrixProduct_average] + simpa only [he,hnrm] using hσ + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixExpectationContinuous.lean b/lean/OAI/Analysis/FreeWords/MatrixExpectationContinuous.lean new file mode 100644 index 0000000000000000000000000000000000000000..a78fa339a6df8725fc67d19b2183c85e96d75578 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixExpectationContinuous.lean @@ -0,0 +1,70 @@ +import Mathlib +import OAI.Analysis.FreeWords.AmplifiedModelDefinitions + +namespace OAI + +noncomputable section + +namespace KKMatrixExpectation + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +open scoped Matrix.Norms.Operator ComplexOrder + +variable {H:Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance concreteOrder (M:VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := + CStarAlgebra.spectralOrder _ + +local instance concreteLE (M:VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance concretePreorder (M:VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance concreteSOR (M:VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := + CStarAlgebra.spectralOrderedRing _ + +def matrixExpectationCLM {M:VonNeumannAlgebra H} (τ:FaithfulNormalTrace M) (n:ℕ) : + MatrixAlgebra n M →L[ℂ] MatrixAlgebra n M := + { matrixExpectation τ.map n with + cont := by + apply continuous_pi + intro i + apply continuous_pi + intro j + exact (continuous_algebraMap ℂ (ConcreteAlgebra M)).comp + ((map_continuous (tracePositive τ)).comp (by fun_prop)) } + +@[simp] theorem matrixExpectationCLM_apply {M:VonNeumannAlgebra H} (τ:FaithfulNormalTrace M) (n:ℕ) + (x:MatrixAlgebra n M) : matrixExpectationCLM τ n x=matrixExpectation τ.map n x := rfl + +theorem matrixExpectation_idem {M:VonNeumannAlgebra H} (τ:FaithfulNormalTrace M) (n:ℕ) + (x:MatrixAlgebra n M) : matrixExpectationCLM τ n (matrixExpectationCLM τ n x)=matrixExpectationCLM τ n x := + matrixExpectation_fix τ.map τ.normalized n _ (matrixExpectation_range τ.map n x) + +theorem matrixExpectationCLM_right {M:VonNeumannAlgebra H} (τ:FaithfulNormalTrace M) (n:ℕ) + (a b:MatrixAlgebra n M) : matrixExpectationCLM τ n (a*matrixExpectationCLM τ n b)= + matrixExpectationCLM τ n a*matrixExpectationCLM τ n b := + matrixExpectation_right τ.map n a _ (matrixExpectation_range τ.map n b) + +theorem matrixExpectation_zero_iff {M:VonNeumannAlgebra H} (τ:FaithfulNormalTrace M) (n:ℕ) + (x:MatrixAlgebra n M) : matrixExpectation τ.map n x=0 ↔ ∀i j,τ.map (x i j)=0 := by + constructor + · intro hx i j + have h := congrArg (fun X:MatrixAlgebra n M => τ.map (X i j)) hx + simpa only [matrixExpectation_apply,trace_algebraMap τ.map τ.normalized,Matrix.zero_apply,map_zero] using h + · intro h + ext i j + simp only [matrixExpectation_apply,h,map_zero,Matrix.zero_apply] + +theorem trace_center_entry {M:VonNeumannAlgebra H} (τ:FaithfulNormalTrace M) (n:ℕ) + (x:MatrixAlgebra n M) (i j:Fin n) : τ.map ((x-matrixExpectation τ.map n x) i j)=0 := by + simp only [Matrix.sub_apply,map_sub,matrixExpectation_apply,trace_algebraMap τ.map τ.normalized,sub_self] + +end + +end KKMatrixExpectation +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixExtendSize.lean b/lean/OAI/Analysis/FreeWords/MatrixExtendSize.lean new file mode 100644 index 0000000000000000000000000000000000000000..0cf68cdc718167f27df58ce40ee0282e0cc394bd --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixExtendSize.lean @@ -0,0 +1,83 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixCommutantTrace +import OAI.Analysis.FreeWords.MatrixProduct +import OAI.Analysis.FreeWords.MatrixReindex +import OAI.Analysis.FreeWords.MatrixSubfactor +import OAI.Analysis.FreeWords.MatrixTraceUnique + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKFreeLiftFrontier KKProjectionSupport KKMatrixQuantization + +noncomputable section + +variable {ι κ A : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + [Ring A] [Algebra ℂ A] [StarRing A] [StarModule ℂ A] + +theorem matrixProduct_contains_left + (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) (σ : Matrix κ κ ℂ →⋆ₐ[ℂ] A) + (hc : ∀ i j k l, Commute (matrixUnit ρ i j) (matrixUnit σ k l)) : + ρ.range ≤ (matrixProduct ρ σ hc).range := by + rintro x ⟨a,rfl⟩ + refine ⟨∑ i,∑ j,∑ k, a i j • Matrix.single (i,k) (j,k) 1,?_⟩ + change matrixProduct ρ σ hc (∑ i,∑ j,∑ k, a i j • Matrix.single (i,k) (j,k) 1)=ρ a + simp only [map_sum,map_smul] + change (∑ i,∑ j,∑ k, a i j • matrixUnit (matrixProduct ρ σ hc) (i,k) (j,k))=ρ a + simp only [matrixProduct_unit,productUnits] + simp only [← Finset.smul_sum,← Finset.mul_sum,matrixUnit_sum_diag,mul_one] + exact (matrix_representation ρ a).symm + +theorem matrixReindex_comp_range (e : ι ≃ κ) (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) : + (ρ.comp (matrixReindex e.symm)).range=ρ.range := by + apply le_antisymm + · rintro x ⟨a,rfl⟩ + exact ⟨matrixReindex e.symm a,rfl⟩ + · rintro x ⟨a,rfl⟩ + refine ⟨matrixReindex e a,?_⟩ + change ρ (matrixReindex e.symm (matrixReindex e a))=ρ a + congr 1 + ext i j + change a (e.symm (e i)) (e.symm (e j))=a i j + simp only [Equiv.symm_apply_apply] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem matrix_extension_size (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) (n k : ℕ) (hn : 0 by + have ht := congrArg τ.map h + rw [map_zero,τ.normalized] at ht + exact zero_ne_one ht⟩⟩ + have : NeZero (n*k) := ⟨Nat.ne_of_gt (Nat.mul_pos hn hk)⟩ + refine ⟨Q,Q.toAlgHom.toRingHom.injective,?_,?_⟩ + · change β.range≤(P.comp (matrixReindex e.symm)).range + rw [matrixReindex_comp_range] + exact matrixProduct_contains_left β σ' hc + · intro x + simpa only [Fintype.card_fin] using matrixHom_trace Q τ.map τ.normalized τ.tracial x + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixHilbertCore.lean b/lean/OAI/Analysis/FreeWords/MatrixHilbertCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..e15f18877d8ce94a78820e88fe548fdfd7138fc2 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixHilbertCore.lean @@ -0,0 +1,91 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixHilbertDefinitions + +namespace OAI + +noncomputable section + +namespace KKMatrixHilbert + +noncomputable section + +open scoped InnerProductSpace + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {n:ℕ} + +omit [CompleteSpace H] in +theorem matrixOperator_add (a b:Matrix (Fin n) (Fin n) (H →L[ℂ] H)) : + matrixOperator (a+b)=matrixOperator a+matrixOperator b := by + ext x i + simp [matrixOperator_apply,Matrix.add_apply,Finset.sum_add_distrib] + +omit [CompleteSpace H] in +theorem matrixOperator_mul (a b:Matrix (Fin n) (Fin n) (H →L[ℂ] H)) : + matrixOperator (a*b)=matrixOperator a*matrixOperator b := by + ext x i + simp only [matrixOperator_apply,Matrix.mul_apply,sum_apply, + mul_apply_eq_comp,map_sum] + rw [Finset.sum_comm] + +omit [CompleteSpace H] in +theorem matrixOperator_one : matrixOperator (1:Matrix (Fin n) (Fin n) (H →L[ℂ] H))=1 := by + ext x i + simp only [matrixOperator_apply,Matrix.one_apply] + rw [Finset.sum_eq_single i] + · simp + · intro j _ hji; simp [Ne.symm hji] + · simp + +theorem matrixOperator_star (a:Matrix (Fin n) (Fin n) (H →L[ℂ] H)) : + matrixOperator (star a)=star (matrixOperator a) := by + rw [ContinuousLinearMap.star_eq_adjoint,ContinuousLinearMap.eq_adjoint_iff] + intro x y + simp only [PiLp.inner_apply,matrixOperator_apply,Matrix.star_apply,sum_inner,inner_sum, + ContinuousLinearMap.star_eq_adjoint,ContinuousLinearMap.adjoint_inner_left] + exact Finset.sum_comm + +def matrixOperatorHom : Matrix (Fin n) (Fin n) (H →L[ℂ] H) →⋆ₐ[ℂ] + (Amplification n H →L[ℂ] Amplification n H) where + toFun := matrixOperator + map_zero' := by ext x i; simp + map_one' := matrixOperator_one + map_add' := matrixOperator_add + map_mul' := matrixOperator_mul + commutes' c := by + ext x i + simp only [matrixOperator_apply,Matrix.algebraMap_eq_diagonal,Matrix.diagonal_apply] + rw [Finset.sum_eq_single i] + · simp + · intro j _ hji; simp [Ne.symm hji] + · simp + map_star' := matrixOperator_star + +omit [CompleteSpace H] in +theorem matrixOperator_diagonal_apply (h:H →L[ℂ] H) (x:Amplification n H) (i:Fin n) : + matrixOperator (Matrix.diagonal fun _:Fin n => h) x i=h (x i) := by + simp only [matrixOperator_apply,Matrix.diagonal_apply] + rw [Finset.sum_eq_single i] + · simp + · intro j _ hji; simp [Ne.symm hji] + · simp + +omit [CompleteSpace H] in +theorem norm_diagonal_le (h:H →L[ℂ] H) : + ‖matrixOperator (Matrix.diagonal fun _:Fin n => h)‖≤‖h‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) + intro x + apply (sq_le_sq₀ (norm_nonneg _) (mul_nonneg (norm_nonneg _) (norm_nonneg _))).mp + rw [PiLp.norm_sq_eq_of_L2,mul_pow,PiLp.norm_sq_eq_of_L2,Finset.mul_sum] + apply Finset.sum_le_sum + intro i hi + rw [matrixOperator_diagonal_apply] + simpa only [mul_pow] using pow_le_pow_left₀ (norm_nonneg _) (h.le_opNorm (x i)) 2 + +end + +end KKMatrixHilbert +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixHilbertDefinitions.lean b/lean/OAI/Analysis/FreeWords/MatrixHilbertDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..40f0d6f51c8dcc59b47c1d80592650a02015ddd4 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixHilbertDefinitions.lean @@ -0,0 +1,39 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKMatrixHilbert + +noncomputable section + +open scoped InnerProductSpace + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +abbrev Amplification (n:ℕ) (H:Type*) := PiLp 2 (fun _:Fin n => H) + +def matrixOperator {n:ℕ} (a:Matrix (Fin n) (Fin n) (H →L[ℂ] H)) : + Amplification n H →L[ℂ] Amplification n H where + toFun x := WithLp.toLp 2 (fun i => ∑j,a i j (x j)) + map_add' := by intro x y; ext i; simp [map_add,Finset.sum_add_distrib] + map_smul' := by intro c x; ext i; simp [map_smul,Finset.smul_sum] + cont := by + apply (PiLp.continuous_toLp 2 (fun _:Fin n => H)).comp + apply continuous_pi + intro i + apply continuous_finsetSum + intro j hj + exact (a i j).continuous.comp (PiLp.continuous_apply 2 _ j) + +omit [CompleteSpace H] in +@[simp] theorem matrixOperator_apply {n:ℕ} (a:Matrix (Fin n) (Fin n) (H →L[ℂ] H)) + (x:Amplification n H) (i:Fin n) : matrixOperator a x i=∑j,a i j (x j) := rfl + +end + +end KKMatrixHilbert +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixL2Closure.lean b/lean/OAI/Analysis/FreeWords/MatrixL2Closure.lean new file mode 100644 index 0000000000000000000000000000000000000000..24add1bbc8ec9672b43093a63f97246a4f4cf2ce --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixL2Closure.lean @@ -0,0 +1,69 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixAverageTrace +import OAI.Analysis.FreeWords.MatrixL2Definitions + +namespace OAI + +noncomputable section + +namespace KKMatrixL2 + +open KKTraceTransfer KKUltraTrace KKProjectionSupport KKMatrixQuantization Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +local instance matrixL2ClosurePartialOrder : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance matrixL2ClosurePreorder : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance matrixL2ClosureLE : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance matrixL2ClosureStarOrderedRing : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +lemma traceNorm_sum_le {J : Type*} (s : Finset J) (a : J → ConcreteAlgebra M) : + traceNorm τ (∑ j∈s,a j) ≤ ∑ j∈s,traceNorm τ (a j) := by + simp only [traceNorm_eq_gns,map_sum] + exact norm_sum_le _ _ + +theorem matrix_l2_asymp_mul {I : Type*} {l : Filter I} + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (n : ℕ) + (f f' g g' : I → MatrixAlg M n) (C D : ℝ) + (hC : ∀ t i j, ‖f' t i j‖ ≤ C) (hD : ∀ t i j, ‖g t i j‖ ≤ D) + (hf : ∀ i j, Tendsto (fun t => traceNorm τ (f t i j-f' t i j)) l (𝓝 0)) + (hg : ∀ i j, Tendsto (fun t => traceNorm τ (g t i j-g' t i j)) l (𝓝 0)) : + ∀ i j, Tendsto (fun t => traceNorm τ ((f t*g t-f' t*g' t) i j)) l (𝓝 0) := by + intro i j + have hb (t:I) (k:Fin n) : + traceNorm τ (f t i k*g t k j-f' t i k*g' t k j) ≤ + traceNorm τ (f t i k-f' t i k)*D+C*traceNorm τ (g t k j-g' t k j) := by + have he : f t i k*g t k j-f' t i k*g' t k j = + (f t i k-f' t i k)*g t k j+f' t i k*(g t k j-g' t k j) := by noncomm_ring + rw [he] + exact (traceNorm_add_le τ _ _).trans (add_le_add + ((traceNorm_mul_right_le τ _ _).trans + (mul_le_mul_of_nonneg_left (hD t k j) (traceNorm_nonneg τ _))) + ((traceNorm_mul_le τ _ _).trans + (mul_le_mul_of_nonneg_right (hC t i k) (traceNorm_nonneg τ _)))) + have ht (k:Fin n) : Tendsto + (fun t => traceNorm τ (f t i k-f' t i k)*D+C*traceNorm τ (g t k j-g' t k j)) + l (𝓝 0) := by + simpa only [zero_mul,mul_zero,zero_add] using ((hf i k).mul_const D).add ((hg k j).const_mul C) + have hs : Tendsto (fun t => ∑ k:Fin n, + (traceNorm τ (f t i k-f' t i k)*D+C*traceNorm τ (g t k j-g' t k j))) l (𝓝 0) := by + simpa only [Finset.sum_const_zero] using tendsto_finsetSum Finset.univ (fun k _ => ht k) + apply squeeze_zero (fun t => traceNorm_nonneg τ _) _ hs + intro t + change traceNorm τ ((f t*g t) i j-(f' t*g' t) i j) ≤ _ + simp only [Matrix.mul_apply,←Finset.sum_sub_distrib] + exact (traceNorm_sum_le τ _ _).trans (Finset.sum_le_sum (fun k _ => hb t k)) + +end + +end KKMatrixL2 +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixL2Definitions.lean b/lean/OAI/Analysis/FreeWords/MatrixL2Definitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd2a7d89e2deb90070f6393ee8dbb38b0db4687c --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixL2Definitions.lean @@ -0,0 +1,24 @@ +import Mathlib +import OAI.Analysis.FreeWords.TraceTransferDefinitions + +namespace OAI + +noncomputable section + +namespace KKMatrixL2 + +open KKTraceTransfer + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +abbrev MatrixAlg (M : VonNeumannAlgebra H) (n : ℕ) := + Matrix (Fin n) (Fin n) (ConcreteAlgebra M) + +end + +end KKMatrixL2 +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixL2Word.lean b/lean/OAI/Analysis/FreeWords/MatrixL2Word.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9690c25942c580aae23b057ab98b087cbfe686a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixL2Word.lean @@ -0,0 +1,119 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixL2Closure +import OAI.Analysis.FreeWords.MatrixL2WordDefinitions + +namespace OAI + +noncomputable section + +namespace KKMatrixL2 + +open KKTraceTransfer Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {I : Type*} {M : VonNeumannAlgebra H} {n : ℕ} + +theorem EntryBound.const (a : MatrixAlg M n) : EntryBound (fun _ : I => a) := by + refine ⟨∑ i,∑ j,‖a i j‖,by positivity,?_⟩ + intro t i j + exact (Finset.single_le_sum (fun k _ => norm_nonneg (a i k)) (Finset.mem_univ j)).trans + (Finset.single_le_sum (fun k _ => Finset.sum_nonneg (fun l _ => norm_nonneg (a k l))) (Finset.mem_univ i)) + +theorem EntryBound.mul {f g : I → MatrixAlg M n} (hf : EntryBound f) (hg : EntryBound g) : + EntryBound (fun t => f t*g t) := by + obtain ⟨C,hC,hf⟩ := hf + obtain ⟨D,hD,hg⟩ := hg + refine ⟨(n:ℝ)*(C*D),by positivity,?_⟩ + intro t i j + change ‖∑ k,f t i k*g t k j‖ ≤ _ + calc + _ ≤ ∑ k,‖f t i k*g t k j‖ := norm_sum_le _ _ + _ ≤ ∑ k:Fin n,C*D := Finset.sum_le_sum (fun k _ => + (norm_mul_le _ _).trans (mul_le_mul (hf t i k) (hg t k j) (norm_nonneg _) hC)) + _ = _ := by simp + +theorem EntryBound.list_prod (w : List (I → MatrixAlg M n)) + (hw : ∀ f ∈ w, EntryBound f) : EntryBound (fun t => (w.map fun f => f t).prod) := by + induction w with + | nil => exact EntryBound.const 1 + | cons f w ih => + exact (hw f List.mem_cons_self).mul (ih (fun g hg => hw g (List.mem_cons_of_mem _ hg))) + +theorem EntryBound.pair_list_prod + (w : List ((I → MatrixAlg M n) × (I → MatrixAlg M n))) + (hw : ∀ z ∈ w, EntryBound z.1) : + EntryBound (I := I) (M := M) (n := n) (fun t => (w.map fun z => z.1 t).prod) := by + induction w with + | nil => exact EntryBound.const 1 + | cons z w ih => + exact (hw z List.mem_cons_self).mul (ih (fun g hg => hw g (List.mem_cons_of_mem _ hg))) + +lemma matrix_l2_asymp_mul_bounded {l : Filter I} + (τ : FaithfulNormalTrace M) (f f' g g' : I → MatrixAlg M n) + (hC : EntryBound f') (hD : EntryBound g) + (hf : ∀ i j, Tendsto (fun t => traceNorm τ (f t i j-f' t i j)) l (𝓝 0)) + (hg : ∀ i j, Tendsto (fun t => traceNorm τ ((g t-g' t) i j)) l (𝓝 0)) : + ∀ i j, Tendsto (fun t => traceNorm τ ((f t*g t-f' t*g' t) i j)) l (𝓝 0) := by + obtain ⟨C,_,hC⟩ := hC + obtain ⟨D,_,hD⟩ := hD + exact matrix_l2_asymp_mul M τ n f f' g g' C D hC hD hf (fun i j => hg i j) + +lemma matrix_l2_word_cons {l : Filter I} + (τ : FaithfulNormalTrace M) + (z : (I → MatrixAlg M n) × (I → MatrixAlg M n)) + (w : List ((I → MatrixAlg M n) × (I → MatrixAlg M n))) + (hz2 : EntryBound z.2) + (hw1 : EntryBound (I := I) (M := M) (n := n) (fun t => (w.map fun v => v.1 t).prod)) + (hz : ∀ i j, Tendsto (fun t => traceNorm τ (z.1 t i j-z.2 t i j)) l (𝓝 0)) + (hw : ∀ i j, Tendsto (fun t => traceNorm τ + (((w.map fun v => v.1 t).prod-(w.map fun v => v.2 t).prod) i j)) l (𝓝 0)) : + ∀ i j, Tendsto (fun t => traceNorm τ + ((((z::w).map fun v => v.1 t).prod-((z::w).map fun v => v.2 t).prod) i j)) l (𝓝 0) := by + let g : I → MatrixAlg M n := fun t => (w.map fun v => v.1 t).prod + let g' : I → MatrixAlg M n := fun t => (w.map fun v => v.2 t).prod + have hD : EntryBound g := hw1 + have hg : ∀ i j, Tendsto (fun t => traceNorm τ ((g t-g' t) i j)) l (𝓝 0) := hw + intro i j + have ht := matrix_l2_asymp_mul_bounded (I := I) (M := M) (n := n) (l := l) + τ z.1 z.2 g g' hz2 hD hz hg i j + exact ht + +theorem matrix_l2_asymp_word {I : Type*} {l : Filter I} + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (n : ℕ) + (w : List ((I → MatrixAlg M n) × (I → MatrixAlg M n))) + (hb : ∀ z ∈ w, EntryBound z.1 ∧ EntryBound z.2) + (hz : ∀ z ∈ w, ∀ i j, Tendsto (fun t => traceNorm τ (z.1 t i j-z.2 t i j)) l (𝓝 0)) : + ∀ i j, Tendsto (fun t => traceNorm τ + (((w.map fun z => z.1 t).prod-(w.map fun z => z.2 t).prod) i j)) l (𝓝 0) := by + induction w with + | nil => + intro i j + simpa [traceNorm] using (tendsto_const_nhds (x := (0:ℝ)) (f := l)) + | cons z w ih => + exact matrix_l2_word_cons (I := I) (M := M) (n := n) (l := l) τ z w (hb z List.mem_cons_self).2 + (EntryBound.pair_list_prod w (fun v hv => (hb v (List.mem_cons_of_mem _ hv)).1)) + (hz z List.mem_cons_self) + (ih (fun v hv => hb v (List.mem_cons_of_mem _ hv)) + (fun v hv => hz v (List.mem_cons_of_mem _ hv))) + +open KKUltraTrace KKProjectionSupport + +open scoped InnerProductSpace + +local instance matrixL2WordPartialOrder : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance matrixL2WordPreorder : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance matrixL2WordLE : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance matrixL2WordStarOrderedRing : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +end + +end KKMatrixL2 +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixL2WordDefinitions.lean b/lean/OAI/Analysis/FreeWords/MatrixL2WordDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..db9156eede48c30be0b2205f4f80eda865590b3c --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixL2WordDefinitions.lean @@ -0,0 +1,24 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixL2Definitions + +namespace OAI + +noncomputable section + +namespace KKMatrixL2 + +open KKTraceTransfer Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def EntryBound {I : Type*} {M : VonNeumannAlgebra H} {n : ℕ} + (f : I → MatrixAlg M n) : Prop := ∃ C : ℝ, 0 ≤ C ∧ ∀ t i j, ‖f t i j‖ ≤ C + +end + +end KKMatrixL2 +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixLeftEndpoint.lean b/lean/OAI/Analysis/FreeWords/MatrixLeftEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea3bf9b970f1bf708acf91394797b5735874ccb1 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixLeftEndpoint.lean @@ -0,0 +1,54 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarLeftEndpoint +import OAI.Analysis.FreeWords.MatrixLeftEndpointDefinitions + +namespace OAI + +noncomputable section + +namespace KKRelativeMatrix + +noncomputable section + +open Filter KKHaarEndpoints + +open scoped Topology + +variable {A:Type*} [Ring A] [StarRing A] [Algebra ℂ A] + +theorem matrix_left_endpoint_limits : MatrixLeftEndpointLimits (A := A) := by + intro ι L τ B u h1 htr hH hC n w hne hw a ha i j + have hLeft := haar_left_endpoint_limits ι L τ B u h1 htr hH hC + have hv (b c:Fin n) (v:List (ℤ×A)) (hmem:v∈entryWords w b c) : + v≠[] ∧ CenteredPowerWord τ B v := by + refine ⟨?_,?_⟩ + · intro he + have hl := entryWords_length hmem + rw [he,List.length_nil] at hl + exact hne (List.eq_nil_of_length_eq_zero hl.symm) + · intro z hz + obtain ⟨q,hq,b,c,rfl⟩ := entryWords_letters hmem z hz + exact ⟨(hw q hq).1,(hw q hq).2 b c⟩ + have hsum (b:Fin n) : Tendsto (fun t => τ (a i b* + ((entryWords w b j).map (scalarWord (fun k => (u t^k).val))).sum)) L (𝓝 0) := by + have haux : ∀v∈entryWords w b j, + Tendsto (fun t => τ (a i b*scalarWord (fun k => (u t^k).val) v)) L (𝓝 0) := by + intro v hm + exact hLeft v (hv b j v hm).1 (hv b j v hm).2 (a i b) (ha i b) + generalize he : entryWords w b j=l at haux ⊢ + clear he + induction l with + | nil => simpa using (tendsto_const_nhds : Tendsto (fun _:ι => (0:ℂ)) L (𝓝 0)) + | cons v l ih => + have hv0 := haux v List.mem_cons_self + have hl0 := ih (fun z hz => haux z (List.mem_cons_of_mem _ hz)) + simpa only [List.map_cons,List.sum_cons,mul_add,map_add,add_zero] using hv0.add hl0 + have hh := tendsto_finsetSum Finset.univ (fun b _ => hsum b) + simpa only [Matrix.mul_apply,entryWords_sum,map_sum,Finset.sum_const_zero] using hh + +end + +end KKRelativeMatrix +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixLeftEndpointDefinitions.lean b/lean/OAI/Analysis/FreeWords/MatrixLeftEndpointDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..e5607ed29d2c95787cc45a11a3b84bafe7aa3fb1 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixLeftEndpointDefinitions.lean @@ -0,0 +1,35 @@ +import Mathlib +import OAI.Analysis.FreeWords.EntryWords +import OAI.Analysis.FreeWords.HaarEndpointsDefinitions + +namespace OAI + +noncomputable section + +namespace KKRelativeMatrix + +noncomputable section + +open Filter KKHaarEndpoints + +open scoped Topology + +variable {A:Type*} [Ring A] [StarRing A] [Algebra ℂ A] + +def MatrixLeftEndpointLimits : Prop := + ∀ (ι:Type*) (L:Filter ι) (τ:A →ₗ[ℂ] ℂ) (B:Subalgebra ℂ A) (u:ι → unitary A), + τ 1=1 → (∀a b,τ (a*b)=τ (b*a)) → + (∀k:ℤ,k≠0 → Tendsto (fun j => τ (u j^k).val) L (𝓝 0)) → + (∀w:List (ℤ×A),w≠[] → CenteredPowerWord τ B w → + Tendsto (fun j => τ (powerWord (u j) w)) L (𝓝 0)) → + ∀n:ℕ,∀w:List (ℤ×Matrix (Fin n) (Fin n) A),w≠[] → + (∀z∈w,z.1≠0 ∧ ∀a b,z.2 a b∈B ∧ τ (z.2 a b)=0) → + ∀a:Matrix (Fin n) (Fin n) A,(∀i j,a i j∈B) → ∀i j, + Tendsto (fun t => τ ((a*matrixWord (fun k => (u t^k).val) w) i j)) L (𝓝 0) + +end + +end KKRelativeMatrix +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixModel.lean b/lean/OAI/Analysis/FreeWords/MatrixModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..318aada14034c5aea20d21070879a643d1472fe2 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixModel.lean @@ -0,0 +1,51 @@ +import Mathlib +import OAI.Analysis.FreeWords.CoordinateConstantFree +import OAI.Analysis.FreeWords.MatrixExtendSize +import OAI.Analysis.FreeWords.MatrixModelDefinitions +import OAI.Analysis.FreeWords.VariableMatrixUltra + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKFactorSupport + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance matrixModelConcreteOrder (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance matrixModelConcretePreorder (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance matrixModelConcreteLE (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance matrixModelConcreteSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem finite_matrix_model : FiniteMatrixModel (H := H) := by + classical + intro M τ hF hD n hn β K F hFne hcenter ε hε + choose ρ hρ hβ hτρ using (fun j : ℕ => matrix_extension_size M τ hF hD n (2^j) + hn (by positivity) β) + let ω : Ultrafilter ℕ := Ultrafilter.of atTop + have hω : (ω : Filter ℕ)≤atTop := Ultrafilter.of_le atTop + have hf := matrix_ultra_factor n ρ (tracePositive τ) τ.normalized τ.tracial + (gnsVector_injective τ) hρ ω hω + have hd := matrix_ultra_diffuse n ρ hn (tracePositive τ) τ.normalized τ.tracial + (gnsVector_injective τ) hρ hτρ ω hω + obtain ⟨j,_,u,huR,huK,huF⟩ := coordinate_constant_free (fun j => (ρ j).range) + (tracePositive τ) τ.normalized τ.tracial ω hω hf hd K F hFne + (fun w hw z hz => ⟨(hcenter w hw z hz).1,(hcenter w hw z hz).2.1⟩) + (fun w hw z hz j => hβ j (hcenter w hw z hz).2.2) ε hε 0 + exact ⟨j,ρ j,hρ j,hβ j,u,huR,huK,huF⟩ + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixModelDefinitions.lean b/lean/OAI/Analysis/FreeWords/MatrixModelDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..d48649bfceeb4689b516fcb9f563d4ffa4154ce3 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixModelDefinitions.lean @@ -0,0 +1,33 @@ +import Mathlib +import OAI.Analysis.FreeWords.ProjectionSmall + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def FiniteMatrixModel : Prop := + ∀ (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M), IsFactor M → IsDiffuse M → + ∀ (n : ℕ), 0 (u^z.1).val*z.2)).prod)‖<ε) + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixPowerBlockLimits.lean b/lean/OAI/Analysis/FreeWords/MatrixPowerBlockLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a57858e2195bca3775f25f75799b7a4b9e3d37f --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixPowerBlockLimits.lean @@ -0,0 +1,61 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarEndpointLimits +import OAI.Analysis.FreeWords.MatrixPowerBlockLimitsDefinitions +import OAI.Analysis.FreeWords.MatrixTraceCyclic + +namespace OAI + +noncomputable section + +namespace KKMatrixExpectation + +noncomputable section + +open Filter KKHaarEndpoints + +open scoped Topology + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] [StarModule ℂ A] + +theorem matrix_power_block_limits : MatrixPowerBlockLimits (A := A) := by + intro ι L τ h1 htr n hn u hH hC w hw k hk a b + let τn := matrixTraceMap τ n + let B := (numericalHom (A := A) n).range.toSubalgebra + have hn1 : τn 1=1 := matrixTraceMap_one τ h1 hn + have hc := matrixTraceMap_cyclic τ htr n + have hO := haar_endpoint_limits (A := Matrix (Fin n) (Fin n) A) ι L τn B u hn1 hc hH hC + let e := numericalHom (A := A) n (Matrix.single b a 1) + let e₀ := e-(τn e) • 1 + have he : e∈B := ⟨Matrix.single b a 1,rfl⟩ + have he₀ : e₀∈B ∧ τn e₀=0 := by + refine ⟨B.sub_mem he (B.smul_mem B.one_mem _),?_⟩ + simp [e₀,map_sub,map_smul,hn1] + have hw' : CenteredPowerWord τn B (w++[(k,e₀)]) := by + intro z hz + rcases List.mem_append.mp hz with hz | hz + · exact hw z hz + · have hze := List.mem_singleton.mp hz + subst z + exact ⟨hk,he₀⟩ + have hclosed := hC (w++[(k,e₀)]) (by simp) hw' + have hopen := hO w hw k hk + have htest : Tendsto (fun j => τn (powerWord (u j) w*(u j^k).val*e)) L (𝓝 0) := by + have hsum := hclosed.add (hopen.const_mul (τn e)) + have hid (j : ι) : τn (powerWord (u j) w*(u j^k).val*e)= + τn (powerWord (u j) (w++[(k,e₀)]))+(τn e)*τn (powerWord (u j) w*(u j^k).val) := by + simp only [powerWord_append,powerWord_cons,powerWord_nil,mul_one,e₀,mul_sub, + mul_smul_comm,map_sub,map_smul,smul_eq_mul,mul_assoc] + ring + simp_rw [hid] + simpa only [τn,zero_add,mul_zero] using hsum + have hentry (j:ι) : τ ((powerWord (u j) w*(u j^k).val) a b)= + (n:ℂ)*τn (powerWord (u j) w*(u j^k).val*e) := matrixTraceMap_test_entry τ hn _ a b + simp_rw [hentry] + simpa using htest.const_mul (n:ℂ) + +end + +end KKMatrixExpectation +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixPowerBlockLimitsDefinitions.lean b/lean/OAI/Analysis/FreeWords/MatrixPowerBlockLimitsDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d5a14bd7261c85411dbea773096be5dd44ebb21 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixPowerBlockLimitsDefinitions.lean @@ -0,0 +1,37 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarEndpointsDefinitions +import OAI.Analysis.FreeWords.MatrixConditionalExpectation + +namespace OAI + +noncomputable section + +namespace KKMatrixExpectation + +noncomputable section + +open Filter KKHaarEndpoints + +open scoped Topology + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] [StarModule ℂ A] + +def MatrixPowerBlockLimits : Prop := + ∀(ι:Type*) (L:Filter ι) (τ:A →ₗ[ℂ] ℂ),τ 1=1 → + (∀a b,τ (a*b)=τ (b*a)) → ∀n:ℕ,0 matrixTraceMap τ n (u j^k).val) L (𝓝 0)) → + (∀w:List (ℤ×Matrix (Fin n) (Fin n) A),w≠[] → + CenteredPowerWord (matrixTraceMap τ n) (numericalHom n).range.toSubalgebra w → + Tendsto (fun j => matrixTraceMap τ n (powerWord (u j) w)) L (𝓝 0)) → + ∀w:List (ℤ×Matrix (Fin n) (Fin n) A), + CenteredPowerWord (matrixTraceMap τ n) (numericalHom n).range.toSubalgebra w → + ∀k:ℤ,k≠0 → ∀a b:Fin n, + Tendsto (fun j => τ ((powerWord (u j) w*(u j^k).val) a b)) L (𝓝 0) + +end + +end KKMatrixExpectation +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixProduct.lean b/lean/OAI/Analysis/FreeWords/MatrixProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ef8a389cdb06f2a73c656c55f1b40f6410c666c --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixProduct.lean @@ -0,0 +1,92 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixAverageBasic +import OAI.Analysis.FreeWords.MatrixUnitHom + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +open KKProjectionSupport + +noncomputable section + +variable {ι κ A : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + [Ring A] [Algebra ℂ A] [StarRing A] [StarModule ℂ A] + +variable (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) (σ : Matrix κ κ ℂ →⋆ₐ[ℂ] A) + +variable (hc : ∀ i j k l, Commute (matrixUnit ρ i j) (matrixUnit σ k l)) + +def productUnits (a b : ι × κ) := matrixUnit ρ a.1 b.1*matrixUnit σ a.2 b.2 + +omit [StarModule ℂ A] in +include hc in +theorem productUnits_mul (a b c d : ι × κ) : + productUnits ρ σ a b*productUnits ρ σ c d=if b=c then productUnits ρ σ a d else 0 := by + dsimp only [productUnits] + rw [(hc c.1 d.1 a.2 b.2).symm.mul_mul_mul_comm _ _,matrixUnit_mul,matrixUnit_mul] + by_cases h1 : b.1=c.1 <;> by_cases h2 : b.2=c.2 + · have hh : b=c := Prod.ext h1 h2 + simp only [ite_eq_left h1,ite_eq_left h2,ite_eq_left hh] + · have hh : b≠c := fun h => h2 (congrArg Prod.snd h) + simp only [ite_eq_left h1,ite_eq_right h2,ite_eq_right hh,mul_zero] + · have hh : b≠c := fun h => h1 (congrArg Prod.fst h) + simp only [ite_eq_right h1,ite_eq_left h2,ite_eq_right hh,zero_mul] + · have hh : b≠c := fun h => h1 (congrArg Prod.fst h) + simp only [ite_eq_right h1,ite_eq_right h2,ite_eq_right hh,zero_mul] + +omit [StarModule ℂ A] in +theorem productUnits_one : (∑ i : ι × κ, productUnits ρ σ i i)=1 := by + simp only [productUnits,Fintype.sum_prod_type,← Finset.mul_sum,matrixUnit_sum_diag,mul_one] + +omit [StarModule ℂ A] in +include hc in +theorem productUnits_star (a b : ι × κ) : star (productUnits ρ σ a b)=productUnits ρ σ b a := by + simp only [productUnits,star_mul,matrixUnit_star] + exact (hc b.1 a.1 b.2 a.2).eq.symm + +def matrixProduct : Matrix (ι × κ) (ι × κ) ℂ →⋆ₐ[ℂ] A := + matrixUnitHom (productUnits ρ σ) (productUnits_mul ρ σ hc) (productUnits_one ρ σ) + (productUnits_star ρ σ hc) + +@[simp] theorem matrixProduct_unit (a b : ι × κ) : + matrixUnit (matrixProduct ρ σ hc) a b=productUnits ρ σ a b := by + change (∑ i, ∑ j, Matrix.single a b (1:ℂ) i j • productUnits ρ σ i j)=_ + simp only [Matrix.single_apply,ite_and,ite_smul,zero_smul,one_smul, + Finset.sum_ite_irrel,Finset.sum_const_zero,Finset.sum_ite_eq,Finset.mem_univ,ite_true] + +theorem matrixProduct_average (x : A) : + matrixAverage (matrixProduct ρ σ hc) x=matrixAverage σ (matrixAverage ρ x) := by + change (Fintype.card (ι × κ):ℂ)⁻¹ • (∑ a,∑ b,matrixUnit (matrixProduct ρ σ hc) a b*x* + matrixUnit (matrixProduct ρ σ hc) b a)=_ + simp only [matrixProduct_unit,productUnits,Fintype.card_prod,Nat.cast_mul,mul_inv_rev, + Fintype.sum_prod_type] + change ((Fintype.card κ:ℂ)⁻¹*(Fintype.card ι:ℂ)⁻¹) • + (∑ i,∑ k,∑ j,∑ l,(matrixUnit ρ i j*matrixUnit σ k l)*x*(matrixUnit ρ j i*matrixUnit σ l k))= + (Fintype.card κ:ℂ)⁻¹ • (∑ k,∑ l,matrixUnit σ k l* + ((Fintype.card ι:ℂ)⁻¹ • (∑ i,∑ j,matrixUnit ρ i j*x*matrixUnit ρ j i))*matrixUnit σ l k) + simp only [mul_smul_comm,smul_mul_assoc,← Finset.smul_sum,smul_smul] + congr 1 + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k hk + conv_lhs => arg 2; intro i; rw [Finset.sum_comm] + rw [Finset.sum_comm] + simp only [Finset.mul_sum,Finset.sum_mul] + apply Finset.sum_congr rfl + intro l hl + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + rw [(hc i j k l).eq] + simp only [mul_assoc] + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixQuantizationEnd.lean b/lean/OAI/Analysis/FreeWords/MatrixQuantizationEnd.lean new file mode 100644 index 0000000000000000000000000000000000000000..8bb6eba60ecd20494e2f3714e9f78d5b4241934f --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixQuantizationEnd.lean @@ -0,0 +1,69 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixEnergyExtend +import OAI.Analysis.FreeWords.MatrixSubfactor + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +open KKTraceTransfer KKFreeLiftFrontier KKProjectionSupport + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem contracting_nonnegative_set_inf_zero (S : Set ℝ) (hne : S.Nonempty) + (hpos : ∀ s∈S, 0 ≤ s) + (hdec : ∀ s∈S, 0 < s → ∃ t∈S, t < 7/8*s) : sInf S=0 := by + have hb : BddBelow S := ⟨0,hpos⟩ + have hi : 0 ≤ sInf S := le_csInf hne hpos + apply le_antisymm _ hi + by_contra hh + have hp : 0 < sInf S := lt_of_not_ge hh + obtain ⟨s,hs,hsl⟩ := exists_lt_of_csInf_lt hne (show sInf S < 8/7*sInf S by linarith) + have hsi := csInf_le hb hs + obtain ⟨t,ht,htl⟩ := hdec s hs (by linarith) + have hti := csInf_le hb ht + linarith + +theorem matrix_commutant_quantization {ι : Type*} [Fintype ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) + (x : ι → ConcreteAlgebra M) (hx : ∀ i, τ.map (x i)=0) + (ε : ℝ) (hε : 0 < ε) : + ∃ (n : ℕ) (_hn : 0 < n) + (ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M), + Function.Injective ρ ∧ ∀ i, traceNorm τ (matrixAverage ρ (x i)) < ε := by + classical + let S : Set ℝ := {s | ∃ (n : ℕ) (_hn : 0 < n) + (ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M), + Function.Injective ρ ∧ s=∑ i, (traceNorm τ (matrixAverage ρ (x i)))^2} + have hne : S.Nonempty := by + obtain ⟨ρ,hρ,_⟩ := exists_matrix_subfactor M τ hF hD 1 (by omega) + exact ⟨_,1,by omega,ρ,hρ,rfl⟩ + have hpos : ∀ s∈S, 0 ≤ s := by + rintro s ⟨n,hn,ρ,hρ,rfl⟩ + exact Finset.sum_nonneg (fun _ _ => sq_nonneg _) + have hdec : ∀ s∈S, 0 < s → ∃ t∈S, t < 7/8*s := by + rintro s ⟨n,hn,ρ,hρ,rfl⟩ hs + obtain ⟨m,hm,σ,hσ,ht⟩ := exists_extended_energy_decrease τ hF hD x hx n hn ρ hs + exact ⟨_,⟨m,hm,σ,hσ,rfl⟩,ht⟩ + have hi := contracting_nonnegative_set_inf_zero S hne hpos hdec + obtain ⟨s,hs,hsε⟩ := exists_lt_of_csInf_lt hne (show sInf S < ε^2 by rw [hi]; positivity) + obtain ⟨n,hn,ρ,hρ,rfl⟩ := hs + refine ⟨n,hn,ρ,hρ,fun i => ?_⟩ + have hh : (traceNorm τ (matrixAverage ρ (x i)))^2 ≤ + ∑ j, (traceNorm τ (matrixAverage ρ (x j)))^2 := + Finset.single_le_sum (f := fun j => (traceNorm τ (matrixAverage ρ (x j)))^2) + (fun _ _ => sq_nonneg _) (Finset.mem_univ i) + have hz := traceNorm_nonneg τ (matrixAverage ρ (x i)) + nlinarith + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixQuantizationLarge.lean b/lean/OAI/Analysis/FreeWords/MatrixQuantizationLarge.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd841a0689b202db335bf34e3d752073201637ba --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixQuantizationLarge.lean @@ -0,0 +1,102 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixQuantizationEnd + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +open KKTraceTransfer KKFreeLiftFrontier KKProjectionSupport + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem exists_extended_energy_decrease_large {ι : Type*} [Fintype ι] + {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) (x : ι → ConcreteAlgebra M) + (hx : ∀ i, τ.map (x i)=0) (n : ℕ) (hn : 0 < n) + (ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M) + (hs : 0 < ∑ i, (traceNorm τ (matrixAverage ρ (x i)))^2) : + ∃ (m : ℕ) (_hm : 0 < m) + (σ : Matrix (Fin m) (Fin m) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M), + Function.Injective σ ∧ n ≤ m ∧ + ∑ i, (traceNorm τ (matrixAverage σ (x i)))^2 < + 7/8*∑ i, (traceNorm τ (matrixAverage ρ (x i)))^2 := by + classical + have : NeZero n := ⟨Nat.ne_of_gt hn⟩ + let B := matrixCommutant ρ + let τB := commutantTrace ρ τ + let y (i : ι) : ConcreteAlgebra B := + inCommutant ρ (matrixAverage ρ (x i)) (matrixAverage_commute ρ (x i)) + have hy (i : ι) : τB.map (y i)=0 := by + change τ.map (matrixAverage ρ (x i))=0 + rw [matrixAverage_trace,hx] + have hnrm (i : ι) : traceNorm τB (y i)=traceNorm τ (matrixAverage ρ (x i)) := + commutantTrace_norm ρ τ (y i) + obtain ⟨k,hk,σ,vσ,hσ⟩ := exists_matrix_energy_decrease τB + (matrixCommutant_factor ρ hF) (matrixCommutant_diffuse ρ hD) y hy (by simpa only [hnrm] using hs) + have : NeZero k := ⟨Nat.ne_of_gt hk⟩ + let σ' := (commutantInclusion ρ).comp σ + have hc (i j : Fin n) (a b : Fin k) : Commute (matrixUnit ρ i j) (matrixUnit σ' a b) := + (inclusion_commute ρ (matrixUnit σ a b) i j).symm + let P := matrixProduct ρ σ' hc + let e : Fin n × Fin k ≃ Fin (n*k) := finProdFinEquiv + let Q := P.comp (matrixReindex e.symm) + have : Nontrivial (ConcreteAlgebra M) := ⟨⟨0,1,fun h => by + have ht := congrArg τ.map h + rw [map_zero,τ.normalized] at ht + exact zero_ne_one ht⟩⟩ + have : NeZero (n*k) := ⟨Nat.ne_of_gt (Nat.mul_pos hn hk)⟩ + refine ⟨n*k,Nat.mul_pos hn hk,Q,Q.toAlgHom.toRingHom.injective, Nat.le_mul_of_pos_right n hk,?_⟩ + have he (i : ι) : traceNorm τ (matrixAverage Q (x i))= + traceNorm τB (matrixAverage σ (y i)) := by + rw [commutantTrace_norm] + change traceNorm τ (matrixAverage (P.comp (matrixReindex e.symm)) (x i))= + traceNorm τ ((commutantInclusion ρ) (matrixAverage σ (y i))) + rw [reindex_average,map_matrixAverage] + change traceNorm τ (matrixAverage (matrixProduct ρ σ' hc) (x i))= + traceNorm τ (matrixAverage σ' (matrixAverage ρ (x i))) + rw [matrixProduct_average] + simpa only [he,hnrm] using hσ + +theorem matrix_commutant_quantization_large {ι : Type*} [Fintype ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) + (x : ι → ConcreteAlgebra M) (hx : ∀ i, τ.map (x i)=0) + (N : ℕ) (ε : ℝ) (hε : 0 < ε) : + ∃ (n : ℕ) (_hn : 0 < n) + (ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M), + Function.Injective ρ ∧ N ≤ n ∧ ∀ i, traceNorm τ (matrixAverage ρ (x i)) < ε := by + classical + let S : Set ℝ := {s | ∃ (n : ℕ) (_hn : 0 < n) + (ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M), + Function.Injective ρ ∧ N ≤ n ∧ s=∑ i, (traceNorm τ (matrixAverage ρ (x i)))^2} + have hne : S.Nonempty := by + obtain ⟨ρ,hρ,_⟩ := exists_matrix_subfactor M τ hF hD (max 1 N) (by omega) + exact ⟨_, max 1 N, by omega,ρ,hρ,le_max_right _ _,rfl⟩ + have hpos : ∀ s∈S, 0 ≤ s := by + rintro s ⟨n,hn,ρ,hρ,hN,rfl⟩ + exact Finset.sum_nonneg (fun _ _ => sq_nonneg _) + have hdec : ∀ s∈S, 0 < s → ∃ t∈S, t < 7/8*s := by + rintro s ⟨n,hn,ρ,hρ,hN,rfl⟩ hs + obtain ⟨m,hm,σ,hσ,hnm,ht⟩ := exists_extended_energy_decrease_large τ hF hD x hx n hn ρ hs + exact ⟨_,⟨m,hm,σ,hσ,hN.trans hnm,rfl⟩,ht⟩ + have hi := contracting_nonnegative_set_inf_zero S hne hpos hdec + obtain ⟨s,hs,hsε⟩ := exists_lt_of_csInf_lt hne (show sInf S < ε^2 by rw [hi]; positivity) + obtain ⟨n,hn,ρ,hρ,hN,rfl⟩ := hs + refine ⟨n,hn,ρ,hρ,hN,fun i => ?_⟩ + have hh : (traceNorm τ (matrixAverage ρ (x i)))^2 ≤ + ∑ j, (traceNorm τ (matrixAverage ρ (x j)))^2 := + Finset.single_le_sum (f := fun j => (traceNorm τ (matrixAverage ρ (x j)))^2) + (fun _ _ => sq_nonneg _) (Finset.mem_univ i) + have hz := traceNorm_nonneg τ (matrixAverage ρ (x i)) + nlinarith + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixRangeCenter.lean b/lean/OAI/Analysis/FreeWords/MatrixRangeCenter.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a0a2bcce4beeb87da2ec10b235d0e7f8d080fa8 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixRangeCenter.lean @@ -0,0 +1,37 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +noncomputable section + +variable {A ι : Type*} [Ring A] [Algebra ℂ A] [StarRing A] [StarModule ℂ A] + [Fintype ι] [DecidableEq ι] + +theorem matrix_range_center (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) (hρ : Function.Injective ρ) + (a : ρ.range) (ha : ∀ b : ρ.range, Commute a b) : ∃ c : ℂ, a=c•1 := by + obtain ⟨x,hx⟩ := a.property + change ρ x=a.val at hx + have hc : ∀ y : Matrix ι ι ℂ, Commute x y := by + intro y + apply hρ + rw [map_mul,map_mul] + have hh := congrArg Subtype.val (ha ⟨ρ y,⟨y,rfl⟩⟩).eq + change a.val*ρ y=ρ y*a.val at hh + simpa only [hx] using hh + obtain ⟨c,hc⟩ := Matrix.mem_range_scalar_of_commute_single (fun i j _ => (hc (Matrix.single i j 1)).symm) + refine ⟨c,Subtype.ext ?_⟩ + change a.val=c•(1:A) + rw [← hx,← hc] + change ρ (algebraMap ℂ (Matrix ι ι ℂ) c)=c•(1:A) + simp only [Algebra.algebraMap_eq_smul_one,map_smul,map_one] + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixRangeProjections.lean b/lean/OAI/Analysis/FreeWords/MatrixRangeProjections.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5a17906c0ae692a73d5784ee52c96a28e572de1 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixRangeProjections.lean @@ -0,0 +1,55 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +def diagonalProjection {n : ℕ} (S : Finset (Fin n)) : Matrix (Fin n) (Fin n) ℂ := + Matrix.diagonal (fun i => if i∈S then 1 else 0) + +theorem diagonalProjection_isProjection {n : ℕ} (S : Finset (Fin n)) : + IsStarProjection (diagonalProjection S) := by + classical + constructor + · change Matrix.diagonal _ * Matrix.diagonal _ = Matrix.diagonal _ + rw [Matrix.diagonal_mul_diagonal] + congr 1; funext i + split_ifs <;> simp + · ext i j + simp only [diagonalProjection,Matrix.star_eq_conjTranspose,Matrix.conjTranspose_apply, + Matrix.diagonal_apply] + split_ifs <;> simp_all + +theorem diagonalProjection_trace {n : ℕ} (S : Finset (Fin n)) : + Matrix.trace (diagonalProjection S)=(S.card:ℂ) := by + classical + simp [diagonalProjection,Matrix.trace_diagonal] + +omit [StarOrderedRing A] in +theorem matrix_range_projection (n r : ℕ) (hr : r≤n) + (ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] A) (τ : A →ₚ[ℂ] ℂ) + (hτ : ∀ x, τ (ρ x)=(n:ℂ)⁻¹*Matrix.trace x) : + ∃ p : A, p∈ρ.range ∧ IsStarProjection p ∧ ‖p‖≤1 ∧ τ p=(n:ℂ)⁻¹*(r:ℂ) := by + classical + obtain ⟨S,_,hScard⟩ := Finset.exists_subset_card_eq (s := Finset.univ (α := Fin n)) + (by simpa using hr) + let p := ρ (diagonalProjection S) + have hp : IsStarProjection p := (diagonalProjection_isProjection S).map ρ + refine ⟨p,⟨diagonalProjection S,rfl⟩,hp,hp.norm_le,?_⟩ + change τ (ρ (diagonalProjection S))=_ + rw [hτ,diagonalProjection_trace,hScard] + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixRangeWitness.lean b/lean/OAI/Analysis/FreeWords/MatrixRangeWitness.lean new file mode 100644 index 0000000000000000000000000000000000000000..02144648f9504ec6e5494d9087a6a8d06d4f7917 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixRangeWitness.lean @@ -0,0 +1,45 @@ +import Mathlib +import OAI.Analysis.FreeWords.FiniteSubalgebraWitness +import OAI.Analysis.FreeWords.MatrixRangeCenter + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKUltraTrace KKTraceTransfer + +open scoped ComplexOrder + +noncomputable section + +variable {A ι : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + [Fintype ι] [DecidableEq ι] + +instance matrix_range_finiteDimensional (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) : + FiniteDimensional ℂ ρ.range := by + apply FiniteDimensional.of_surjective ρ.rangeRestrict.toLinearMap + intro x + obtain ⟨a,ha⟩ := x.property + exact ⟨a,Subtype.ext ha⟩ + +instance matrix_range_isClosed (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) : IsClosed (ρ.range : Set A) := + by + exact ρ.toLinearMap.range.closed_of_finiteDimensional + +theorem matrix_range_commutator_witness (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) + (hρ : Function.Injective ρ) (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (h1 : τ 1=1) + (hinj : Function.Injective (gnsVector τ)) (x : A) (hx : x∈ρ.range) : + ∃ u : unitary A, u.val∈ρ.range ∧ + ‖gnsVector τ (x-τ x•1)‖≤2*‖gnsVector τ (x*u.val-u.val*x)‖ := by + exact finite_subalgebra_commutator_witness ρ.range τ htr h1 hinj + (matrix_range_center ρ hρ) x hx + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixReindex.lean b/lean/OAI/Analysis/FreeWords/MatrixReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..15e310d89d7bea89f2e61c688e08b4e4e61f789c --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixReindex.lean @@ -0,0 +1,39 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixAverageBasic + +namespace OAI + +noncomputable section + +namespace KKMatrixQuantization + +noncomputable section + +variable {ι κ A : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + [Ring A] [Algebra ℂ A] [StarRing A] [StarModule ℂ A] + +def matrixReindex (e : ι ≃ κ) : Matrix ι ι ℂ →⋆ₐ[ℂ] Matrix κ κ ℂ where + __ := (Matrix.reindexAlgEquiv ℂ ℂ e).toAlgHom + map_star' x := by ext i j; rfl + +@[simp] theorem matrixReindex_single (e : ι ≃ κ) (i j : ι) (c : ℂ) : + matrixReindex e (Matrix.single i j c)=Matrix.single (e i) (e j) c := by + ext k l + change Matrix.single i j c (e.symm k) (e.symm l)=Matrix.single (e i) (e j) c k l + simp only [Matrix.single_apply,Equiv.eq_symm_apply] + +omit [StarModule ℂ A] in +theorem reindex_average (e : ι ≃ κ) (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) (x : A) : + matrixAverage (ρ.comp (matrixReindex e.symm)) x=matrixAverage ρ x := by + simp only [matrixAverage,StarAlgHom.comp_apply,matrixReindex_single] + rw [Fintype.card_congr e.symm] + congr 1 + exact Fintype.sum_equiv e.symm _ _ (fun i => by + exact Fintype.sum_equiv e.symm _ _ (fun j => rfl)) + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixSubfactor.lean b/lean/OAI/Analysis/FreeWords/MatrixSubfactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..11dd50ef92ac52e493cb934239e379e44b343754 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixSubfactor.lean @@ -0,0 +1,144 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixUnitHom +import OAI.Analysis.FreeWords.ProjectionPartition +import OAI.Analysis.FreeWords.UnitaryExtension + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance matrixSubfactorPartialOrder (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance matrixSubfactorPreorder (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance matrixSubfactorLE (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance matrixSubfactorStarOrderedRing (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +noncomputable section + +open scoped BigOperators + +variable {ι A : Type*} [Fintype ι] [DecidableEq ι] [Ring A] [Algebra ℂ A] + +variable [StarRing A] [StarModule ℂ A] + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance matrixSubfactorSystemPartialOrder (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance matrixSubfactorSystemPreorder (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance matrixSubfactorSystemLE (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance matrixSubfactorSystemStarOrderedRing (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem partial_matrix_system {ι : Type*} [Fintype ι] [DecidableEq ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (hF : IsFactor M) + (p : ι → ConcreteAlgebra M) (hp : ∀ i, IsStarProjection (p i)) + (horth : ∀ i j, i≠j → p i*p j=0) (h1 : ∑ i, p i=1) + (i₀ : ι) (hτ : ∀ i, τ.map (p i)=τ.map (p i₀)) : + ∃ e : ι → ι → ConcreteAlgebra M, + (∀ i j k l, e i j*e k l=if j=k then e i l else 0) ∧ + (∑ i, e i i)=1 ∧ (∀ i j, star (e i j)=e j i) ∧ + (∀ i j, τ.map (e i j)=if i=j then τ.map (p i₀) else 0) := by + choose v hv using fun i => projection_equivalent_of_trace M τ hF (p i₀) (p i) + (hp i₀) (hp i) (hτ i).symm + have hvpartial (i : ι) : Partial (v i) := partial_of_initial_projection (by rw [(hv i).1]; exact hp i₀) + have hvp (i : ι) : v i*p i₀=v i := by rw [← (hv i).1,← mul_assoc]; exact hvpartial i + have hpv (i : ι) : p i*v i=v i := by rw [← (hv i).2]; exact hvpartial i + have hsvp (i : ι) : star (v i)*p i=star (v i) := by + simpa only [star_mul,(hp i).isSelfAdjoint.star_eq] using congrArg star (hpv i) + have hprod (i j : ι) : star (v i)*v j=if i=j then p i₀ else 0 := by + by_cases hij : i=j + · subst j; simpa only [ite_true] using (hv i).1 + · rw [ite_eq_right hij] + calc + star (v i)*v j = (star (v i)*p i)*(p j*v j) := by rw [hsvp,hpv] + _ = star (v i)*(p i*p j)*v j := by simp only [mul_assoc] + _ = 0 := by rw [horth i j hij,mul_zero,zero_mul] + let e (i j : ι) := v i*star (v j) + refine ⟨e,?_,?_,?_,?_⟩ + · intro i j k l + change (v i*star (v j))*(v k*star (v l))=if j=k then v i*star (v l) else 0 + calc + (v i*star (v j))*(v k*star (v l)) = (v i*(star (v j)*v k))*star (v l) := by simp only [mul_assoc] + _ = if j=k then v i*star (v l) else 0 := by rw [hprod]; split_ifs <;> simp only [hvp,mul_zero,zero_mul] + · simpa only [e,funext (fun i => (hv i).2)] using h1 + · intro i j; simp only [e,star_mul,star_star] + · intro i j + change τ.map (v i*star (v j))=if i=j then τ.map (p i₀) else 0 + rw [τ.tracial,hprod] + by_cases hij : i=j + · subst j; simp + · simp only [ite_eq_right hij,ite_eq_right (Ne.symm hij),map_zero] + +theorem exists_matrix_subfactor (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) (n : ℕ) (hn : 0 < n) : + ∃ ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M, + Function.Injective ρ ∧ ∀ x, τ.map (ρ x) = (n : ℂ)⁻¹ * Matrix.trace x := by + classical + let i₀ : Fin n := ⟨0,hn⟩ + let : Nonempty (Fin n) := ⟨i₀⟩ + let : Nontrivial (ConcreteAlgebra M) := ⟨⟨0,1,fun h => by + have ht := congrArg τ.map h + rw [map_zero,τ.normalized] at ht + exact zero_ne_one ht⟩⟩ + have hn0 : (n:ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hn) + have htr : τ.map (1 : ConcreteAlgebra M)=(n:ℂ)*(((n:ℝ)⁻¹:ℝ):ℂ) := by + rw [τ.normalized,Complex.ofReal_inv,Complex.ofReal_natCast,mul_inv_cancel₀ hn0] + obtain ⟨p,hp,hp1,horth,h1,hτp⟩ := projection_partition M τ hD n 1 (IsStarProjection.one _) + (n:ℝ)⁻¹ (inv_nonneg.mpr (Nat.cast_nonneg n)) htr + obtain ⟨e,hm,he1,hes,het⟩ := partial_matrix_system M τ hF p hp horth h1 i₀ + (fun i => (hτp i).trans (hτp i₀).symm) + let ρ := matrixUnitHom e hm he1 hes + refine ⟨ρ,ρ.toAlgHom.toRingHom.injective,?_⟩ + intro x + change τ.map (∑ i, ∑ j, x i j • e i j)=(n:ℂ)⁻¹*Matrix.trace x + simp only [map_sum,map_smul,het,smul_eq_mul,mul_ite,mul_zero,Finset.sum_ite_eq,Finset.mem_univ, + ite_true,smul_eq_mul,hτp,Complex.ofReal_inv,Complex.ofReal_natCast] + rw [Matrix.trace,Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + exact mul_comm _ _ + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixTraceCyclic.lean b/lean/OAI/Analysis/FreeWords/MatrixTraceCyclic.lean new file mode 100644 index 0000000000000000000000000000000000000000..2af49b17c98c2504355feb593b2e8b95773d54aa --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixTraceCyclic.lean @@ -0,0 +1,46 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixConditionalExpectation + +namespace OAI + +noncomputable section + +namespace KKMatrixExpectation + +noncomputable section + +variable {A : Type*} [Ring A] [StarRing A] [Algebra ℂ A] [StarModule ℂ A] + +omit [StarRing A] [StarModule ℂ A] in +theorem matrixTraceMap_cyclic (τ : A →ₗ[ℂ] ℂ) + (htr : ∀a b,τ (a*b)=τ (b*a)) (n : ℕ) + (x y : Matrix (Fin n) (Fin n) A) : matrixTraceMap τ n (x*y)=matrixTraceMap τ n (y*x) := by + simp only [matrixTraceMap_apply,Matrix.mul_apply,map_sum] + congr 1 + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + exact htr _ _ + +theorem matrixTraceMap_test_entry (τ : A →ₗ[ℂ] ℂ) {n : ℕ} (hn : 0 simp + rw [hsingle,matrixTraceMap_apply,← map_sum] + change τ (x i j)=(n:ℂ)*((n:ℂ)⁻¹*τ (Matrix.trace (x*Matrix.single j i 1))) + rw [Matrix.trace_mul_single] + simp only [MulOpposite.op_one,one_smul] + have hn0 : (n:ℂ)≠0 := Nat.cast_ne_zero.mpr hn.ne' + field_simp + +end + +end KKMatrixExpectation +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixTraceL2.lean b/lean/OAI/Analysis/FreeWords/MatrixTraceL2.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2a629cb9864d3c29bdbedf75c419ed7bb364517 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixTraceL2.lean @@ -0,0 +1,53 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixL2Definitions +import OAI.Analysis.FreeWords.ProjectionRound + +namespace OAI + +noncomputable section + +namespace KKMatrixL2 + +open KKTraceTransfer Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {I : Type*} {M : VonNeumannAlgebra H} {n : ℕ} + +open KKUltraTrace KKProjectionSupport + +open scoped InnerProductSpace + +local instance : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +lemma norm_trace_le_traceNorm (τ : FaithfulNormalTrace M) (x : ConcreteAlgebra M) : + ‖τ.map x‖ ≤ traceNorm τ x := by + have hh := norm_inner_le_norm (𝕜 := ℂ) (gnsVector (tracePositive τ) (1:ConcreteAlgebra M)) + (gnsVector (tracePositive τ) x) + simp only [gnsVector_inner,star_one,one_mul,←traceNorm_eq_gns,traceNorm_one,one_mul] at hh + change ‖τ.map x‖ ≤ traceNorm τ x at hh + exact hh + +theorem matrix_trace_l2_null {l : Filter I} (τ : FaithfulNormalTrace M) + (f : I → MatrixAlg M n) + (hf : ∀ i j, Tendsto (fun t => traceNorm τ (f t i j)) l (𝓝 0)) : + Tendsto (fun t => (n:ℂ)⁻¹ * ∑ i,τ.map (f t i i)) l (𝓝 0) := by + have ht (i:Fin n) : Tendsto (fun t => τ.map (f t i i)) l (𝓝 0) := + squeeze_zero_norm (fun t => norm_trace_le_traceNorm τ _) (hf i i) + have hs := tendsto_finsetSum Finset.univ (fun i _ => ht i) + simpa only [Finset.sum_const_zero,mul_zero] using hs.const_mul (n:ℂ)⁻¹ + +end + +end KKMatrixL2 +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixTraceUnique.lean b/lean/OAI/Analysis/FreeWords/MatrixTraceUnique.lean new file mode 100644 index 0000000000000000000000000000000000000000..49b4a32c726c74d1f9073983a708fb9ad6a40771 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixTraceUnique.lean @@ -0,0 +1,57 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixAverageBasic + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKMatrixQuantization + +noncomputable section + +variable {A ι : Type*} [Ring A] [Algebra ℂ A] [StarRing A] + [Fintype ι] [DecidableEq ι] [Nonempty ι] + +theorem matrixHom_trace (ρ : Matrix ι ι ℂ →⋆ₐ[ℂ] A) (τ : A →ₗ[ℂ] ℂ) + (h1 : τ 1=1) (htr : ∀ x y, τ (x*y)=τ (y*x)) (x : Matrix ι ι ℂ) : + τ (ρ x)=(Fintype.card ι:ℂ)⁻¹*Matrix.trace x := by + classical + let o : ι := Classical.choice inferInstance + have he (i j : ι) : τ (matrixUnit ρ i j)=if i=j then τ (matrixUnit ρ o o) else 0 := by + by_cases hij : i=j + · subst j + have hh := htr (matrixUnit ρ i o) (matrixUnit ρ o i) + simpa only [matrixUnit_mul,ite_true] using hh + · have hh := htr (matrixUnit ρ i i) (matrixUnit ρ i j) + simpa only [matrixUnit_mul,ite_true,ite_eq_right hij,ite_eq_right (Ne.symm hij),map_zero] using hh + have hd (i : ι) : τ (matrixUnit ρ i i)=τ (matrixUnit ρ o o) := by + have hh := he i i + simpa only [ite_true] using hh + have hs : (Fintype.card ι:ℂ)*τ (matrixUnit ρ o o)=1 := by + calc + (Fintype.card ι:ℂ)*τ (matrixUnit ρ o o) = ∑ i : ι, τ (matrixUnit ρ o o) := by + simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] + _ = ∑ i : ι, τ (matrixUnit ρ i i) := Finset.sum_congr rfl (fun i _ => (hd i).symm) + _ = τ (∑ i : ι, matrixUnit ρ i i) := (map_sum τ _ _).symm + _ = 1 := by rw [matrixUnit_sum_diag,h1] + have hc : (Fintype.card ι:ℂ)≠0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt Fintype.card_pos) + have ho : τ (matrixUnit ρ o o)=(Fintype.card ι:ℂ)⁻¹ := by + apply mul_left_cancel₀ hc + rw [hs,mul_inv_cancel₀ hc] + have he' (i j : ι) : τ (matrixUnit ρ i j)=if i=j then (Fintype.card ι:ℂ)⁻¹ else 0 := by + rw [he i j,ho] + rw [matrix_representation] + simp only [map_sum,map_smul,he',smul_eq_mul,mul_ite,mul_zero,Finset.sum_ite_eq, + Finset.mem_univ,ite_true,Matrix.trace,Matrix.diag,Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + exact mul_comm _ _ + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixUnitHom.lean b/lean/OAI/Analysis/FreeWords/MatrixUnitHom.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad490a9e418d48a12faa8a2c6bd94aaa3d953ffc --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixUnitHom.lean @@ -0,0 +1,81 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +noncomputable section + +open scoped BigOperators + +variable {ι A : Type*} [Fintype ι] [DecidableEq ι] [Ring A] [Algebra ℂ A] + +def matrixUnitLinear (e : ι → ι → A) : Matrix ι ι ℂ →ₗ[ℂ] A where + toFun x := ∑ i, ∑ j, x i j • e i j + map_add' x y := by simp only [Matrix.add_apply,add_smul,Finset.sum_add_distrib] + map_smul' c x := by simp only [Matrix.smul_apply,smul_smul,Finset.smul_sum]; rfl + +omit [DecidableEq ι] in +@[simp] theorem matrixUnitLinear_apply (e : ι → ι → A) (x : Matrix ι ι ℂ) : + matrixUnitLinear e x=∑ i, ∑ j, x i j • e i j := rfl + +theorem matrixUnitLinear_mul (e : ι → ι → A) + (hm : ∀ i j k l, e i j * e k l = if j=k then e i l else 0) + (x y : Matrix ι ι ℂ) : matrixUnitLinear e (x*y)=matrixUnitLinear e x*matrixUnitLinear e y := by + symm + calc + matrixUnitLinear e x*matrixUnitLinear e y = + ∑ i, ∑ j, ∑ k, ∑ l, (x i j*y k l) • (e i j*e k l) := by + simp only [matrixUnitLinear_apply] + simp only [Finset.sum_mul] + simp only [Finset.mul_sum] + simp only [smul_mul_assoc,mul_smul_comm,smul_smul,mul_comm] + _ = ∑ i, ∑ j, ∑ l, (x i j*y j l) • e i l := by + simp only [hm,smul_ite,smul_zero,Finset.sum_ite_irrel,Finset.sum_const_zero] + simp only [Finset.sum_ite_eq,Finset.mem_univ,ite_true] + _ = matrixUnitLinear e (x*y) := by + simp only [matrixUnitLinear_apply,Matrix.mul_apply,Finset.sum_smul,mul_smul] + apply Finset.sum_congr rfl + intro i hi + rw [Finset.sum_comm] + +theorem matrixUnitLinear_one (e : ι → ι → A) (h1 : ∑ i, e i i=1) : + matrixUnitLinear e 1=1 := by + simpa only [matrixUnitLinear_apply,Matrix.one_apply,ite_smul,one_smul,zero_smul, + Finset.sum_ite_eq,Finset.mem_univ,ite_true] using h1 + +variable [StarRing A] [StarModule ℂ A] + +omit [DecidableEq ι] in +theorem matrixUnitLinear_star (e : ι → ι → A) (hs : ∀ i j, star (e i j)=e j i) + (x : Matrix ι ι ℂ) : matrixUnitLinear e (star x)=star (matrixUnitLinear e x) := by + simp only [matrixUnitLinear_apply,star_sum,star_smul,hs,Matrix.star_apply] + rw [Finset.sum_comm] + +def matrixUnitHom (e : ι → ι → A) + (hm : ∀ i j k l, e i j*e k l=if j=k then e i l else 0) + (h1 : ∑ i, e i i=1) (hs : ∀ i j, star (e i j)=e j i) : + Matrix ι ι ℂ →⋆ₐ[ℂ] A where + toFun := matrixUnitLinear e + map_zero' := (matrixUnitLinear e).map_zero + map_one' := matrixUnitLinear_one e h1 + map_add' := (matrixUnitLinear e).map_add + map_mul' := matrixUnitLinear_mul e hm + commutes' c := by + rw [Algebra.algebraMap_eq_smul_one,map_smul,matrixUnitLinear_one e h1, + Algebra.algebraMap_eq_smul_one] + map_star' := matrixUnitLinear_star e hs + +@[simp] theorem matrixUnitHom_apply (e : ι → ι → A) + (hm : ∀ i j k l, e i j*e k l=if j=k then e i l else 0) + (h1 : ∑ i, e i i=1) (hs : ∀ i j, star (e i j)=e j i) (x : Matrix ι ι ℂ) : + matrixUnitHom e hm h1 hs x=∑ i, ∑ j, x i j • e i j := rfl + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MatrixUnitaryBounds.lean b/lean/OAI/Analysis/FreeWords/MatrixUnitaryBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd81de45c93d9fb741cdf6af8692461f78e32936 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MatrixUnitaryBounds.lean @@ -0,0 +1,44 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKMatrixBounds + +noncomputable section + +open scoped Matrix.Norms.Operator + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +theorem unitary_entry_norm_le_one {n:ℕ} (U:unitary (Matrix (Fin n) (Fin n) A)) (i j:Fin n) : + ‖U.val i j‖≤1 := by + have hcol : ∑k:Fin n,star (U.val k j)*U.val k j=1 := by + have h := congrArg (fun X : Matrix (Fin n) (Fin n) A => X j j) (Unitary.coe_star_mul_self U) + simpa only [Matrix.mul_apply,Matrix.star_apply,Matrix.one_apply_eq] using h + have hle : star (U.val i j)*U.val i j≤1 := by + rw [←hcol] + exact Finset.single_le_sum (fun k _ => star_mul_self_nonneg (U.val k j)) (Finset.mem_univ i) + have hnorm := (CStarAlgebra.norm_le_one_iff_of_nonneg _ (star_mul_self_nonneg _)).2 hle + rw [CStarRing.norm_star_mul_self] at hnorm + nlinarith [norm_nonneg (U.val i j)] + +theorem unitary_rowSum_norm_le {n:ℕ} (U:unitary (Matrix (Fin n) (Fin n) A)) : + ‖U.val‖≤n := by + rw [Matrix.linfty_opNorm_def] + change (↑(Finset.univ.sup fun i => ∑j:Fin n,‖U.val i j‖₊):ℝ)≤((n:NNReal):ℝ) + apply NNReal.coe_le_coe.mpr + apply Finset.sup_le + intro i hi + change (∑j:Fin n,‖U.val i j‖₊:NNReal)≤(n:NNReal) + calc + _ ≤ ∑j:Fin n,(1:NNReal) := Finset.sum_le_sum (fun j _ => show ‖U.val i j‖₊≤1 from unitary_entry_norm_le_one U i j) + _ = _ := by simp + +end + +end KKMatrixBounds +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/MixedScaling.lean b/lean/OAI/Analysis/FreeWords/MixedScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd97f49212bde4889b24f3ed7b8ebecffd02bd81 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/MixedScaling.lean @@ -0,0 +1,50 @@ +import Mathlib +import OAI.Analysis.FreeWords.TraceTransferDefinitions + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +def mixedValue (u : ℤ → ConcreteAlgebra M) (s : List (ℤ × ConcreteAlgebra M)) : ConcreteAlgebra M := + (s.map (fun z => u z.1*z.2)).prod + +def scaledMixed (c : ℂ) (s : List (ℤ × ConcreteAlgebra M)) : List (ℤ × ConcreteAlgebra M) := + s.map (fun z => (z.1,c • z.2)) + +theorem mixedValue_scaled (u : ℤ → ConcreteAlgebra M) (c : ℂ) + (s : List (ℤ × ConcreteAlgebra M)) : + mixedValue u (scaledMixed c s)=c^s.length • mixedValue u s := by + induction s with + | nil => simp [mixedValue,scaledMixed] + | cons z s ih => + change u z.1*(c • z.2)*mixedValue u (scaledMixed c s)= + c^(s.length+1) • (u z.1*z.2*mixedValue u s) + simp only [ih,mul_smul_comm,smul_mul_assoc,smul_smul,pow_succ] + +theorem mixedValue_restore (u : ℤ → ConcreteAlgebra M) (c : ℂ) (hc : c≠0) + (s : List (ℤ × ConcreteAlgebra M)) : + mixedValue u s=c^s.length • mixedValue u (scaledMixed c⁻¹ s) := by + rw [mixedValue_scaled,smul_smul,← mul_pow,mul_inv_cancel₀ hc,one_pow,one_smul] + +theorem norm_trace_scaled (u : ℤ → ConcreteAlgebra M) (R : ℝ) (hR : 0 ⟨1,k,[],x⟩ + | (l,y)::s => let w := ofMixedHead l y s; ⟨1,k,(x,l)::w.middle,w.right⟩ + +@[simp] theorem ofMixedHead_left (k : ℤ) (x : A) (s : List (ℤ × A)) : + (ofMixedHead k x s).left=1 := by cases s <;> rfl + +@[simp] theorem ofMixedHead_first (k : ℤ) (x : A) (s : List (ℤ × A)) : + (ofMixedHead k x s).first=k := by cases s <;> rfl + +@[simp] theorem ofMixedHead_length (k : ℤ) (x : A) (s : List (ℤ × A)) : + (ofMixedHead k x s).length=s.length+1 := by + induction s generalizing k x with + | nil => rfl + | cons z s ih => + have h := ih z.1 z.2 + change 1+(ofMixedHead z.1 z.2 s).middle.length=s.length+1 at h + change 1+((x,z.1)::(ofMixedHead z.1 z.2 s).middle).length=(z::s).length+1 + simp only [List.length_cons] + omega + +theorem ofMixedHead_value (u : ℤ → A) (k : ℤ) (x : A) (s : List (ℤ × A)) : + (ofMixedHead k x s).value u=(u k*x)*(s.map (fun z => u z.1*z.2)).prod := by + induction s generalizing k x with + | nil => simp [ofMixedHead,value] + | cons z s ih => + have h := ih z.1 z.2 + simp only [value,ofMixedHead_left,ofMixedHead_first,one_mul] at h + simp only [ofMixedHead,value,one_mul,tailValue_cons,List.map_cons,List.prod_cons] + rw [show u k*(x*u z.1*tailValue u (ofMixedHead z.1 z.2 s).middle)* + (ofMixedHead z.1 z.2 s).right= + (u k*x)*(u z.1*tailValue u (ofMixedHead z.1 z.2 s).middle*(ofMixedHead z.1 z.2 s).right) by noncomm_ring,h] + +theorem ofMixedHead_admissible {X : Set A} {K : Set ℤ} {N : ℕ} + (k : ℤ) (x : A) (s : List (ℤ × A)) + (hk : k∈K) (hx : x∈X) (hs : ∀ z∈s, z.1∈K ∧ z.2∈X) + (hn : s.length+1≤N) : Admissible X K N (ofMixedHead k x s) := by + induction s generalizing k x with + | nil => exact ⟨Set.mem_insert _ _,hk,Set.mem_insert_of_mem _ hx,by simp [ofMixedHead],hn⟩ + | cons z s ih => + have hz := hs z List.mem_cons_self + have ht := ih z.1 z.2 hz.1 hz.2 (fun a ha => hs a (List.mem_cons_of_mem _ ha)) (by simp only [List.length_cons] at hn; omega) + refine ⟨Set.mem_insert _ _,hk,ht.2.2.1,?_,?_⟩ + · intro a ha + rcases List.mem_cons.mp ha with rfl | ha + · exact ⟨hx,hz.1⟩ + · exact ht.2.2.2.1 a ha + · simpa only [ofMixedHead_length] using hn + +end KKLocalPatching.PatchingWord +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/NormalFiniteSpectrum.lean b/lean/OAI/Analysis/FreeWords/NormalFiniteSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..4bd365fb36ed6bbf5e96462422338685e4d8a656 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/NormalFiniteSpectrum.lean @@ -0,0 +1,92 @@ +import Mathlib +import OAI.Analysis.FreeWords.FiniteSpectrum + +namespace OAI + +noncomputable section + +namespace KKSpectralSupport + +open KKTraceTransfer KKPolarSupport + +open scoped ComplexStarModule + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} + +theorem product_partition_sum {ι κ : Type*} [Fintype ι] [Fintype κ] + (p : ι → ConcreteAlgebra M) (q : κ → ConcreteAlgebra M) + (hp : ∑ i, p i=1) (hq : ∑ j, q j=1) : ∑ ij : ι × κ, p ij.1*q ij.2=1 := by + rw [Fintype.sum_prod_type] + simp only [← Finset.mul_sum,hq,mul_one,hp] + +theorem product_partition_weight {ι κ : Type*} [Fintype ι] [Fintype κ] + (p : ι → ConcreteAlgebra M) (q : κ → ConcreteAlgebra M) + (hp : ∑ i, p i=1) (hq : ∑ j, q j=1) (c : ι → ℂ) (d : κ → ℂ) : + ∑ ij : ι × κ, (c ij.1 + Complex.I*d ij.2) • (p ij.1*q ij.2)= + (∑ i, c i • p i)+Complex.I • (∑ j, d j • q j) := by + classical + rw [Fintype.sum_prod_type] + simp only [add_smul,Finset.sum_add_distrib] + congr 1 + · simp only [← smul_mul_assoc,← Finset.mul_sum,hq,mul_one] + · simp only [← mul_smul_comm,← Finset.mul_sum,← Finset.sum_mul,hp,one_mul, + mul_smul,Finset.smul_sum] + +theorem normal_finite_spectrum_approximation (M : VonNeumannAlgebra H) + (a : ConcreteAlgebra M) (ha : IsStarNormal a) (ε : ℝ) (hε : 0 < ε) : + ∃ (m n : ℕ) (p : Fin m × Fin n → ConcreteAlgebra M) (c : Fin m × Fin n → ℂ), + (∀ i, IsStarProjection (p i)) ∧ (∀ i j, i ≠ j → p i*p j=0) ∧ + (∑ i, p i=1) ∧ (∀ i, Commute a (p i)) ∧ + ‖a-∑ i, c i • p i‖ < ε := by + classical + let r : ConcreteAlgebra M := ℜ a + let s : ConcreteAlgebra M := ℑ a + have hrs : Commute r s := isStarNormal_iff_commute_realPart_imaginaryPart.mp ha + obtain ⟨m,p,c,hp,hpo,hp1,hpr,hpc,hpre⟩ := finite_spectrum_approximation_central M r (ℜ a).property (ε/2) (half_pos hε) + obtain ⟨n,q,d,hq,hqo,hq1,hqs,hqc,hqre⟩ := finite_spectrum_approximation_central M s (ℑ a).property (ε/2) (half_pos hε) + have hpq (i : Fin m) (j : Fin n) : Commute (p i) (q j) := + (hpc (q j) (hqc r hrs j).symm i).symm + have hpa (i : Fin m) : Commute a (p i) := by + rw [← realPart_add_I_smul_imaginaryPart a] + exact (hpr i).add_left ((hpc s hrs.symm i).smul_left _) + have hqa (j : Fin n) : Commute a (q j) := by + rw [← realPart_add_I_smul_imaginaryPart a] + exact (hqc r hrs j).add_left ((hqs j).smul_left _) + let f : Fin m × Fin n → ConcreteAlgebra M := fun ij => p ij.1*q ij.2 + let z : Fin m × Fin n → ℂ := fun ij => (c ij.1:ℂ)+Complex.I*(d ij.2:ℂ) + refine ⟨m,n,f,z,(fun ij => (hp ij.1).mul (hq ij.2) (hpq ij.1 ij.2)),?_, + product_partition_sum p q hp1 hq1,(fun ij => (hpa ij.1).mul_right (hqa ij.2)),?_⟩ + · intro ij kl hne + change (p ij.1*q ij.2)*(p kl.1*q kl.2)=0 + have he : (p ij.1*q ij.2)*(p kl.1*q kl.2)=(p ij.1*p kl.1)*(q ij.2*q kl.2) := by + calc + _ = p ij.1*(q ij.2*p kl.1)*q kl.2 := by simp only [mul_assoc] + _ = p ij.1*(p kl.1*q ij.2)*q kl.2 := by rw [← (hpq kl.1 ij.2).eq] + _ = _ := by simp only [mul_assoc] + rw [he] + by_cases hi : ij.1=kl.1 + · have hj : ij.2≠kl.2 := fun hj => hne (Prod.ext hi hj) + rw [hqo _ _ hj,mul_zero] + · rw [hpo _ _ hi,zero_mul] + · dsimp only [f,z] + rw [product_partition_weight p q hp1 hq1 (fun i => (c i : ℂ)) (fun j => (d j : ℂ))] + have he : a-((∑ i, (c i:ℂ) • p i)+Complex.I • (∑ j, (d j:ℂ) • q j))= + (r-∑ i, (c i:ℂ) • p i)+Complex.I • (s-∑ j, (d j:ℂ) • q j) := by + rw [smul_sub] + have ha' : a=r+Complex.I • s := (realPart_add_I_smul_imaginaryPart a).symm + rw [ha']; abel + rw [he] + refine (norm_add_le _ _).trans_lt ?_ + rw [norm_smul,Complex.norm_I,one_mul] + linarith + +end + +end KKSpectralSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/NumericCuts.lean b/lean/OAI/Analysis/FreeWords/NumericCuts.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2d2697a647356bcefe746b8a0ffcb90d3d3eb96 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/NumericCuts.lean @@ -0,0 +1,67 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorialSum + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators + +noncomputable section + +theorem factorial_sqrt_bound {r p q : ℕ} (hp : p ≤ r) (hq : q ≤ r) : + Real.sqrt ((p.factorial:ℝ) * q.factorial) ≤ (r.factorial:ℝ) := by + apply (sq_le_sq₀ (Real.sqrt_nonneg _) (Nat.cast_nonneg _)).mp + rw [Real.sq_sqrt (by positivity), pow_two] + exact mul_le_mul (by exact_mod_cast Nat.factorial_le hp) + (by exact_mod_cast Nat.factorial_le hq) (Nat.cast_nonneg _) (Nat.cast_nonneg _) + +theorem sum_cuts_numeric (m : ℕ) {t : ℝ} (ht : 0 ≤ t) (ht1 : t ≤ 1) : + (∑ q : Fin (m+2), Real.sqrt ((q.val.factorial:ℝ) * (m+1-q).factorial) * t^(m+1)) + + (∑ j : Fin (m+1), (Real.sqrt ((j.val.factorial:ℝ) * (m-j).factorial) + + t ^ 2 * Real.sqrt (((j.val+1).factorial:ℝ) * (m+1-j).factorial)) * t^m) ≤ + 5 * Real.sqrt (m.factorial:ℝ) * t^m + + ((2*(m+1)+1:ℝ) * (m+1).factorial) * t^(m+1) := by + have hn : (∑ q : Fin (m+2), Real.sqrt ((q.val.factorial:ℝ) * (m+1-q).factorial) * t^(m+1)) ≤ + (m+2:ℝ) * (m+1).factorial * t^(m+1) := by + calc + _ ≤ ∑ q : Fin (m+2), ((m+1).factorial:ℝ) * t^(m+1) := by + exact Finset.sum_le_sum (fun q _ => mul_le_mul_of_nonneg_right + (factorial_sqrt_bound (by omega) (Nat.sub_le _ _)) (pow_nonneg ht _)) + _ = _ := by simp; ring + have hl : (∑ j : Fin (m+1), Real.sqrt ((j.val.factorial:ℝ) * (m-j).factorial)) ≤ + 5 * Real.sqrt (m.factorial:ℝ) := by + simpa only [← Fin.sum_univ_eq_sum_range, factorialRoot] using factorialRoot_sum m + have hs : (∑ j : Fin (m+1), Real.sqrt (((j.val+1).factorial:ℝ) * (m+1-j).factorial)) ≤ + (m+1:ℝ) * (m+1).factorial := by + calc + _ ≤ ∑ j : Fin (m+1), ((m+1).factorial:ℝ) := by + exact Finset.sum_le_sum (fun j _ => factorial_sqrt_bound (by omega) (Nat.sub_le _ _)) + _ = _ := by simp + have ht' : t^2*t^m ≤ t^(m+1) := by + calc + _ = t^(m+1)*t := by rw [pow_succ t m, pow_two]; ring + _ ≤ _ := mul_le_of_le_one_right (pow_nonneg ht (m+1)) ht1 + have hs' : (t^2 * (∑ j : Fin (m+1), Real.sqrt (((j.val+1).factorial:ℝ) * (m+1-j).factorial))) * t^m ≤ + ((m+1:ℝ) * (m+1).factorial) * t^(m+1) := by + calc + _ = (∑ j : Fin (m+1), Real.sqrt (((j.val+1).factorial:ℝ) * (m+1-j).factorial)) * (t^2*t^m) := by ring + _ ≤ ((m+1:ℝ) * (m+1).factorial) * (t^2*t^m) := mul_le_mul_of_nonneg_right hs (by positivity) + _ ≤ _ := mul_le_mul_of_nonneg_left ht' (by positivity) + have hl' := mul_le_mul_of_nonneg_right hl (pow_nonneg ht m) + have he : (∑ j : Fin (m+1), (Real.sqrt ((j.val.factorial:ℝ) * (m-j).factorial) + + t ^ 2 * Real.sqrt (((j.val+1).factorial:ℝ) * (m+1-j).factorial)) * t^m) = + (∑ j : Fin (m+1), Real.sqrt ((j.val.factorial:ℝ) * (m-j).factorial))*t^m + + (t^2 * (∑ j : Fin (m+1), Real.sqrt (((j.val+1).factorial:ℝ) * (m+1-j).factorial)))*t^m := by + simp only [add_mul, Finset.sum_add_distrib, Finset.sum_mul, Finset.mul_sum] + rw [he] + nlinarith + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/NumericalModel.lean b/lean/OAI/Analysis/FreeWords/NumericalModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..3789da5912091c795340a5e72b16d46bb6418cf1 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/NumericalModel.lean @@ -0,0 +1,97 @@ +import Mathlib +import OAI.Analysis.FreeWords.CanonicalMatrixExtension +import OAI.Analysis.FreeWords.CoordinateConstantFree +import OAI.Analysis.FreeWords.MatrixExtendSize +import OAI.Analysis.FreeWords.NumericalModelDefinitions +import OAI.Analysis.FreeWords.UnitaryRangePreimage +import OAI.Analysis.FreeWords.VariableMatrixUltra + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKFactorSupport KKProjectionSupport KKMatrixQuantization + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem finite_numerical_model : FiniteNumericalModel (H := H) := by + classical + intro M τ hF hD n hn K F hFne hcenter ε hε + have : NeZero n := ⟨hn.ne'⟩ + obtain ⟨β,hβ,hτβ⟩ := exists_matrix_subfactor M τ hF hD n hn + choose ρ hρ hβρ hτρ using (fun j : ℕ => matrix_extension_canonical M τ hF hD n (2^j) + hn (by positivity) β) + let ω : Ultrafilter ℕ := Ultrafilter.of atTop + have hω : (ω : Filter ℕ)≤atTop := Ultrafilter.of_le atTop + have hf := matrix_ultra_factor n ρ (tracePositive τ) τ.normalized τ.tracial + (gnsVector_injective τ) hρ ω hω + have hd := matrix_ultra_diffuse n ρ hn (tracePositive τ) τ.normalized τ.tracial + (gnsVector_injective τ) hρ hτρ ω hω + let wf : List (ℤ × Matrix (Fin n) (Fin n) ℂ) → List (ℤ × ConcreteAlgebra M) := + List.map (fun z => (z.1,β z.2)) + have hnF : ∀ w∈F.image wf, w≠[] := by + intro w hw + obtain ⟨v,hv,rfl⟩ := Finset.mem_image.mp hw + exact fun he => hFne v hv (List.map_eq_nil_iff.mp he) + have hcF : ∀ w∈F.image wf, ∀ z∈w, z.1≠0 ∧ (tracePositive τ) z.2=0 := by + intro w hw z hz + obtain ⟨v,hv,rfl⟩ := Finset.mem_image.mp hw + obtain ⟨a,ha,rfl⟩ := List.mem_map.mp hz + refine ⟨(hcenter v hv a ha).1,?_⟩ + change τ.map (β a.2)=0 + rw [matrixHom_trace β τ.map τ.normalized τ.tracial,(hcenter v hv a ha).2,mul_zero] + have hmF : ∀ w∈F.image wf, ∀ z∈w, ∀j, z.2∈(ρ j).range := by + intro w hw z hz j + obtain ⟨v,hv,rfl⟩ := Finset.mem_image.mp hw + obtain ⟨a,ha,rfl⟩ := List.mem_map.mp hz + exact ⟨matrixReindex finProdFinEquiv (Matrix.kronecker a.2 1),hβρ j a.2⟩ + obtain ⟨j,_,u,huR,huK,huF⟩ := coordinate_constant_free (fun j => (ρ j).range) + (tracePositive τ) τ.normalized τ.tracial ω hω hf hd K (F.image wf) hnF hcF hmF ε hε 0 + let d := 2^j + have hdpos : 0 (U^z.1).val*Matrix.kronecker z.2 1)).prod)= + ((wf w).map (fun z => (u^z.1).val*z.2)).prod := by + simp only [map_list_prod,List.map_map,Function.comp_def,map_mul,hφB, + unitary_preimage_zpow φ U u hU,wf] + rw [he] + exact hh + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/NumericalModelDefinitions.lean b/lean/OAI/Analysis/FreeWords/NumericalModelDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..a17e78068d3c9886b97ea63d36b1c97915841643 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/NumericalModelDefinitions.lean @@ -0,0 +1,31 @@ +import Mathlib +import OAI.Analysis.FreeWords.ProjectionSmall + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def FiniteNumericalModel : Prop := + ∀ (M : VonNeumannAlgebra H), FaithfulNormalTrace M → IsFactor M → IsDiffuse M → + ∀ n : ℕ, 0 (U^z.1).val*Matrix.kronecker z.2 (1 : Matrix (Fin d) (Fin d) ℂ))).prod)‖<ε) + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/OperatorRows.lean b/lean/OAI/Analysis/FreeWords/OperatorRows.lean new file mode 100644 index 0000000000000000000000000000000000000000..49a444f58379cd4a6ca83690d0c4ec954e75742b --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/OperatorRows.lean @@ -0,0 +1,347 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder InnerProductSpace + +noncomputable section + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + +variable {α β γ : Type*} [Fintype α] [Fintype β] [Fintype γ] + +def RowSqBound (C : α → E →L[ℂ] E) (k : ℝ) : Prop := + ∀ x : α → E, ‖∑ a, C a (x a)‖ ^ 2 ≤ k * ∑ a, ‖x a‖ ^ 2 + +def ColSqBound (C : α → E →L[ℂ] E) (k : ℝ) : Prop := + ∀ x : E, (∑ a, ‖C a x‖ ^ 2) ≤ k * ‖x‖ ^ 2 + +def MatrixSqBound (T : α → β → E →L[ℂ] E) (k : ℝ) : Prop := + ∀ x : β → E, (∑ a, ‖∑ b, T a b (x b)‖ ^ 2) ≤ k * ∑ b, ‖x b‖ ^ 2 + +theorem RowSqBound.norm_le {C : α → E →L[ℂ] E} {t : ℝ} + (h : RowSqBound C (t^2)) (ht : 0 ≤ t) (a : α) : ‖C a‖ ≤ t := by + classical + apply ContinuousLinearMap.opNorm_le_bound _ ht + intro x + apply (sq_le_sq₀ (norm_nonneg _) (mul_nonneg ht (norm_nonneg _))).mp + have h' := h (Pi.single a x) + simpa only [Pi.single_apply, apply_ite, map_zero, norm_zero, + ite_pow, zero_pow two_ne_zero, Finset.sum_ite_eq', Finset.mem_univ, ite_true, + mul_pow] using h' + +theorem RowSqBound.star_col [CompleteSpace E] {C : α → E →L[ℂ] E} {k : ℝ} + (h : RowSqBound C k) + (hk : 0 ≤ k) : ColSqBound (fun a => star (C a)) k := by + intro x + let s : ℝ := ∑ a, ‖star (C a) x‖ ^ 2 + let y : E := ∑ a, C a (star (C a) x) + have hs : 0 ≤ s := Finset.sum_nonneg (fun _ _ => sq_nonneg _) + have hi : ⟪y,x⟫_ℂ = (s : ℂ) := by + dsimp only [y, s] + simp only [sum_inner, Complex.ofReal_sum, Complex.ofReal_pow] + apply Finset.sum_congr rfl + intro a ha + rw [← ContinuousLinearMap.adjoint_inner_right] + change ⟪star (C a) x, star (C a) x⟫_ℂ = _ + simp only [inner_self_eq_norm_sq_to_K, RCLike.ofReal_eq_complex_ofReal] + have hineq : s ≤ ‖y‖ * ‖x‖ := by + have hh := norm_inner_le_norm (𝕜 := ℂ) y x + rw [hi, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hs] at hh + exact hh + have hy : ‖y‖ ^ 2 ≤ k * s := h (fun a => star (C a) x) + have hsquare : s ^ 2 ≤ (‖y‖ * ‖x‖) ^ 2 := + (sq_le_sq₀ hs (mul_nonneg (norm_nonneg _) (norm_nonneg _))).mpr hineq + have hmul := mul_le_mul_of_nonneg_right hy (sq_nonneg ‖x‖) + change s ≤ k * ‖x‖ ^ 2 + by_cases hzero : s = 0 + · rw [hzero]; positivity + · have hspos : 0 < s := lt_of_le_of_ne hs (Ne.symm hzero) + nlinarith [mul_pow ‖y‖ ‖x‖ 2] + +theorem RowSqBound.reindex {C : α → E →L[ℂ] E} {k : ℝ} (h : RowSqBound C k) + (e : β ≃ α) : RowSqBound (fun b => C (e b)) k := by + intro x + have hr := h (fun a => x (e.symm a)) + simpa only [← Equiv.sum_comp e, e.symm_apply_apply] using hr + +theorem RowSqBound.prod {C : α → E →L[ℂ] E} {D : β → E →L[ℂ] E} {k l : ℝ} + (hC : RowSqBound C k) (hD : RowSqBound D l) (hk : 0 ≤ k) : + RowSqBound (fun p : α × β => C p.1 * D p.2) (k * l) := by + intro x + calc + _ = ‖∑ a, C a (∑ b, D b (x (a,b)))‖ ^ 2 := by + simp only [Fintype.sum_prod_type, map_sum, mul_apply_eq_comp] + _ ≤ k * ∑ a, ‖∑ b, D b (x (a,b))‖ ^ 2 := hC _ + _ ≤ k * ∑ a, l * ∑ b, ‖x (a,b)‖ ^ 2 := by + apply mul_le_mul_of_nonneg_left _ hk + exact Finset.sum_le_sum (fun a _ => hD _) + _ = (k * l) * ∑ p, ‖x p‖ ^ 2 := by + simp only [Finset.mul_sum, Fintype.sum_prod_type, mul_assoc] + +theorem row_matrix_col {C : α → E →L[ℂ] E} {D : β → E →L[ℂ] E} + {T : α → β → E →L[ℂ] E} {k m l : ℝ} + (hC : RowSqBound C k) (hT : MatrixSqBound T m) (hD : ColSqBound D l) + (hk : 0 ≤ k) (hm : 0 ≤ m) (x : E) : + ‖∑ a, ∑ b, (C a * T a b * D b) x‖ ^ 2 ≤ (k * m * l) * ‖x‖ ^ 2 := by + calc + _ = ‖∑ a, C a (∑ b, T a b (D b x))‖ ^ 2 := by + simp only [map_sum, mul_apply_eq_comp] + _ ≤ k * ∑ a, ‖∑ b, T a b (D b x)‖ ^ 2 := hC _ + _ ≤ k * (m * ∑ b, ‖D b x‖ ^ 2) := mul_le_mul_of_nonneg_left (hT _) hk + _ ≤ k * (m * (l * ‖x‖ ^ 2)) := by + exact mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left (hD x) hm) hk + _ = _ := by ring + +def tupleOp {n : ℕ} (C : Fin n → α → E →L[ℂ] E) (a : Fin n → α) : E →L[ℂ] E := + (List.ofFn (fun j => C j (a j))).prod + +theorem tupleOp_row {n : ℕ} {C : Fin n → α → E →L[ℂ] E} {k : ℝ} + (hk : 0 ≤ k) (hC : ∀ j, RowSqBound (C j) k) : + RowSqBound (tupleOp C) (k ^ n) := by + induction n with + | zero => + intro x + simp [tupleOp] + | succ n ih => + have h := (hC 0).prod (ih (fun j => hC j.succ)) hk + have hr := h.reindex (Fin.consEquiv (fun _ : Fin (n+1) => α)).symm + rw [pow_succ'] + convert hr using 1 + funext a + simp only [tupleOp, List.ofFn_succ, List.prod_cons, Fin.consEquiv_symm_apply] + rfl + +theorem ColSqBound.reindex {C : α → E →L[ℂ] E} {k : ℝ} (h : ColSqBound C k) + (e : β ≃ α) : ColSqBound (fun b => C (e b)) k := by + intro x + calc + _ = ∑ a, ‖C a x‖ ^ 2 := Equiv.sum_comp e _ + _ ≤ _ := h x + +theorem ColSqBound.prod {C : α → E →L[ℂ] E} {D : β → E →L[ℂ] E} {k l : ℝ} + (hC : ColSqBound C k) (hD : ColSqBound D l) (hk : 0 ≤ k) : + ColSqBound (fun p : α × β => C p.1 * D p.2) (k * l) := by + intro x + calc + _ = ∑ b, ∑ a, ‖C a (D b x)‖ ^ 2 := by + simp only [Fintype.sum_prod_type, mul_apply_eq_comp] + exact Finset.sum_comm + _ ≤ ∑ b, k * ‖D b x‖ ^ 2 := Finset.sum_le_sum (fun b _ => hC _) + _ = k * ∑ b, ‖D b x‖ ^ 2 := by rw [Finset.mul_sum] + _ ≤ k * (l * ‖x‖ ^ 2) := mul_le_mul_of_nonneg_left (hD x) hk + _ = _ := by ring + +theorem tupleOp_col {n : ℕ} {C : Fin n → α → E →L[ℂ] E} {k : ℝ} + (hk : 0 ≤ k) (hC : ∀ j, ColSqBound (C j) k) : + ColSqBound (tupleOp C) (k ^ n) := by + induction n with + | zero => + intro x + simp [tupleOp] + | succ n ih => + have h := (hC 0).prod (ih (fun j => hC j.succ)) hk + have hr := h.reindex (Fin.consEquiv (fun _ : Fin (n+1) => α)).symm + rw [pow_succ'] + convert hr using 1 + funext a + simp only [tupleOp, List.ofFn_succ, List.prod_cons, Fin.consEquiv_symm_apply] + rfl + +theorem row_matrix_col_norm {C : α → E →L[ℂ] E} {D : β → E →L[ℂ] E} + {T : α → β → E →L[ℂ] E} {k m l : ℝ} + (hC : RowSqBound C (k ^ 2)) (hT : MatrixSqBound T (m ^ 2)) + (hD : ColSqBound D (l ^ 2)) (hk : 0 ≤ k) (hm : 0 ≤ m) (hl : 0 ≤ l) : + ‖∑ a, ∑ b, C a * T a b * D b‖ ≤ k * m * l := by + apply ContinuousLinearMap.opNorm_le_bound _ (by positivity) + intro x + apply (sq_le_sq₀ (norm_nonneg _) (by positivity)).mp + have h := row_matrix_col hC hT hD (sq_nonneg _) (sq_nonneg _) x + simpa only [sum_apply, mul_pow, mul_assoc] using h + +theorem matrixSqBound_iff {T : α → β → E →L[ℂ] E} {k : ℝ} (hk : 0 ≤ k) : + MatrixSqBound T (k ^ 2) ↔ + ∀ x : β → E, + ‖WithLp.toLp 2 (fun a => ∑ b, T a b (x b))‖ ≤ k * ‖WithLp.toLp 2 x‖ := by + constructor + · intro h x + apply (sq_le_sq₀ (norm_nonneg _) (mul_nonneg hk (norm_nonneg _))).mp + simpa only [PiLp.norm_sq_eq_of_L2, mul_pow, WithLp.ofLp_toLp] using h x + · intro h x + have hs := (sq_le_sq₀ (norm_nonneg _) (mul_nonneg hk (norm_nonneg _))).mpr (h x) + simpa only [PiLp.norm_sq_eq_of_L2, mul_pow, WithLp.ofLp_toLp] using hs + +theorem MatrixSqBound.add {S T : α → β → E →L[ℂ] E} {k l : ℝ} + (hS : MatrixSqBound S (k ^ 2)) (hT : MatrixSqBound T (l ^ 2)) + (hk : 0 ≤ k) (hl : 0 ≤ l) : + MatrixSqBound (fun a b => S a b + T a b) ((k + l) ^ 2) := by + apply (matrixSqBound_iff (add_nonneg hk hl)).mpr + intro x + have he : (fun a => ∑ b, (S a b + T a b) (x b)) = + (fun a => ∑ b, S a b (x b)) + (fun a => ∑ b, T a b (x b)) := by + funext a + simp only [add_apply, Finset.sum_add_distrib, Pi.add_apply] + rw [he, WithLp.toLp_add] + exact (norm_add_le _ _).trans (by + simpa only [add_mul] using add_le_add ((matrixSqBound_iff hk).mp hS x) + ((matrixSqBound_iff hl).mp hT x)) + +omit [InnerProductSpace ℂ E] [Fintype α] in +theorem norm_sum_sq_le_card (s : Finset α) (x : α → E) : + ‖∑ a ∈ s, x a‖ ^ 2 ≤ (s.card : ℝ) * ∑ a ∈ s, ‖x a‖ ^ 2 := by + have h := Finset.sum_mul_sq_le_sq_mul_sq s (fun _ => (1 : ℝ)) (fun a => ‖x a‖) + have hn := pow_le_pow_left₀ (norm_nonneg _) (norm_sum_le s x) 2 + exact hn.trans (by simpa using h) + +theorem projection_sum_norm_sq [CompleteSpace E] (P : α → E →L[ℂ] E) + (hP : ∀ a, IsStarProjection (P a)) + (horth : ∀ a b, a ≠ b → P a * P b = 0) (x : α → E) : + ‖∑ a, P a (x a)‖ ^ 2 = ∑ a, ‖P a (x a)‖ ^ 2 := by + classical + apply Complex.ofReal_injective + simp only [Complex.ofReal_sum, Complex.ofReal_pow] + have he a b (hab : a ≠ b) : ⟪P a (x a), P b (x b)⟫_ℂ = 0 := by + rw [← ContinuousLinearMap.adjoint_inner_right] + change ⟪x a, star (P a) (P b (x b))⟫_ℂ = 0 + rw [(hP a).isSelfAdjoint.star_eq, + ← mul_apply_eq_comp, horth a b hab, zero_apply, inner_zero_right] + have hi : ⟪∑ a, P a (x a), ∑ a, P a (x a)⟫_ℂ = + ∑ a, ⟪P a (x a), P a (x a)⟫_ℂ := by + simp only [sum_inner, inner_sum] + apply Finset.sum_congr rfl + intro a ha + exact Finset.sum_eq_single a (fun b _ hba => he b a hba) (by simp) + simpa only [inner_self_eq_norm_sq_to_K, RCLike.ofReal_eq_complex_ofReal, + Complex.ofReal_pow] using hi + +variable [DecidableEq β] + +theorem sum_incidence (s : α → Finset β) (f : β → ℝ) : + (∑ a, ∑ b ∈ s a, f b) = + ∑ b, ((Finset.univ.filter (fun a => b ∈ s a)).card : ℝ) * f b := by + classical + calc + _ = ∑ a, ∑ b, if b ∈ s a then f b else 0 := by simp + _ = ∑ b, ∑ a, if b ∈ s a then f b else 0 := Finset.sum_comm + _ = _ := by simp only [← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul] + +theorem projection_incidence_bound [CompleteSpace E] + (P : γ → E →L[ℂ] E) (hP : ∀ c, IsStarProjection (P c)) + (horth : ∀ c e, c ≠ e → P c * P e = 0) (hsum : ∑ c, P c = 1) + (s : α → γ → Finset β) (R C : ℕ) + (hrow : ∀ a c, (s a c).card ≤ R) + (hcol : ∀ b c, (Finset.univ.filter (fun a => b ∈ s a c)).card ≤ C) : + MatrixSqBound (fun a b => ∑ c, if b ∈ s a c then P c else 0) + ((R : ℝ) * C) := by + classical + intro x + have he a : (∑ b, (∑ c, if b ∈ s a c then P c else 0) (x b)) = + ∑ c, P c (∑ b ∈ s a c, x b) := by + simp only [sum_apply, map_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro c hc + have hi b : (if b ∈ s a c then P c else (0 : E →L[ℂ] E)) (x b) = + if b ∈ s a c then P c (x b) else 0 := by split_ifs <;> rfl + simp only [hi] + simp + simp only [he, projection_sum_norm_sq P hP horth] + have hind c : (∑ a, ∑ b ∈ s a c, ‖P c (x b)‖ ^ 2) ≤ + (C : ℝ) * ∑ b, ‖P c (x b)‖ ^ 2 := by + rw [sum_incidence, Finset.mul_sum] + exact Finset.sum_le_sum (fun b _ => mul_le_mul_of_nonneg_right + (by exact_mod_cast hcol b c) (sq_nonneg _)) + have hnorm b : (∑ c, ‖P c (x b)‖ ^ 2) = ‖x b‖ ^ 2 := by + rw [← projection_sum_norm_sq P hP horth, ← sum_apply, hsum] + rfl + calc + _ ≤ ∑ a, ∑ c, (R : ℝ) * ∑ b ∈ s a c, ‖P c (x b)‖ ^ 2 := by + apply Finset.sum_le_sum + intro a ha + apply Finset.sum_le_sum + intro c hc + rw [map_sum] + exact (norm_sum_sq_le_card _ _).trans + (mul_le_mul_of_nonneg_right (by exact_mod_cast hrow a c) + (Finset.sum_nonneg (fun _ _ => sq_nonneg _))) + _ = (R : ℝ) * ∑ c, ∑ a, ∑ b ∈ s a c, ‖P c (x b)‖ ^ 2 := by + rw [Finset.sum_comm] + simp only [Finset.mul_sum] + _ ≤ (R : ℝ) * ∑ c, (C : ℝ) * ∑ b, ‖P c (x b)‖ ^ 2 := by + exact mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun c _ => hind c)) + (Nat.cast_nonneg _) + _ = ((R : ℝ) * C) * ∑ b, ‖x b‖ ^ 2 := by + simp only [← Finset.mul_sum] + rw [Finset.sum_comm, show (∑ b, ∑ c, ‖P c (x b)‖ ^ 2) = + ∑ b, ‖x b‖ ^ 2 from Finset.sum_congr rfl (fun b _ => hnorm b)] + ring + +omit [DecidableEq β] + +theorem scalar_matrix_bound (w : α → β → ℝ) (hw : ∀ a b, 0 ≤ w a b) + (R C : ℝ) (hR : 0 ≤ R) (_hC : 0 ≤ C) + (hrow : ∀ a, ∑ b, w a b ≤ R) (hcol : ∀ b, ∑ a, w a b ≤ C) : + MatrixSqBound (fun a b => (w a b : ℂ) • (1 : E →L[ℂ] E)) (R * C) := by + intro x + have hs a : ‖∑ b, ((w a b : ℂ) • (1 : E →L[ℂ] E)) (x b)‖ ^ 2 ≤ + R * ∑ b, w a b * ‖x b‖ ^ 2 := by + have hn : ‖∑ b, ((w a b : ℂ) • (1 : E →L[ℂ] E)) (x b)‖ ≤ + ∑ b, w a b * ‖x b‖ := by + simpa only [smul_apply, one_apply_eq_self, norm_smul, Complex.norm_real, + Real.norm_eq_abs, abs_of_nonneg (hw _ _)] using + norm_sum_le Finset.univ (fun b => ((w a b : ℂ) • (1 : E →L[ℂ] E)) (x b)) + have hh := Finset.sum_sq_le_sum_mul_sum_of_sq_le_mul Finset.univ + (f := fun b => w a b) (g := fun b => w a b * ‖x b‖ ^ 2) + (r := fun b => w a b * ‖x b‖) + (fun b _ => hw a b) (fun b _ => mul_nonneg (hw a b) (sq_nonneg _)) + (fun b _ => by nlinarith) + exact (pow_le_pow_left₀ (norm_nonneg _) hn 2).trans (hh.trans + (mul_le_mul_of_nonneg_right (hrow a) + (Finset.sum_nonneg (fun b _ => mul_nonneg (hw _ _) (sq_nonneg _))))) + calc + _ ≤ ∑ a, R * ∑ b, w a b * ‖x b‖ ^ 2 := Finset.sum_le_sum (fun a _ => hs a) + _ = R * ∑ b, (∑ a, w a b) * ‖x b‖ ^ 2 := by + rw [← Finset.mul_sum, Finset.sum_comm] + simp only [Finset.sum_mul] + _ ≤ R * ∑ b, C * ‖x b‖ ^ 2 := by + exact mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun b _ => + mul_le_mul_of_nonneg_right (hcol b) (sq_nonneg _))) hR + _ = (R * C) * ∑ b, ‖x b‖ ^ 2 := by simp only [← Finset.mul_sum, mul_assoc] + +theorem MatrixSqBound.compress {T : α → β → E →L[ℂ] E} {k : ℝ} + (hT : MatrixSqBound T k) (hk : 0 ≤ k) (Q : E →L[ℂ] E) (hQ : ‖Q‖ ≤ 1) : + MatrixSqBound (fun a b => Q * T a b * Q) k := by + have hn (x : E) : ‖Q x‖ ≤ ‖x‖ := + (Q.le_opNorm x).trans (by nlinarith [norm_nonneg x]) + intro x + calc + _ = ∑ a, ‖Q (∑ b, T a b (Q (x b)))‖ ^ 2 := by + simp only [mul_apply_eq_comp, map_sum] + _ ≤ ∑ a, ‖∑ b, T a b (Q (x b))‖ ^ 2 := by + exact Finset.sum_le_sum (fun a _ => pow_le_pow_left₀ (norm_nonneg _) (hn _) 2) + _ ≤ k * ∑ b, ‖Q (x b)‖ ^ 2 := hT _ + _ ≤ k * ∑ b, ‖x b‖ ^ 2 := by + exact mul_le_mul_of_nonneg_left + (Finset.sum_le_sum (fun b _ => pow_le_pow_left₀ (norm_nonneg _) (hn _) 2)) hk + +theorem MatrixSqBound.smul {T : α → β → E →L[ℂ] E} {k : ℝ} + (hT : MatrixSqBound T k) (c : ℂ) : + MatrixSqBound (fun a b => c • T a b) (‖c‖ ^ 2 * k) := by + intro x + calc + _ = ‖c‖ ^ 2 * ∑ a, ‖∑ b, T a b (x b)‖ ^ 2 := by + simp only [smul_apply, ← Finset.smul_sum, norm_smul, mul_pow, Finset.mul_sum] + _ ≤ ‖c‖ ^ 2 * (k * ∑ b, ‖x b‖ ^ 2) := + mul_le_mul_of_nonneg_left (hT x) (sq_nonneg _) + _ = _ := by ring + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PartialIsoAlgebra.lean b/lean/OAI/Analysis/FreeWords/PartialIsoAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..149367d3ed172edc63b97e7f086957f8f314c2ff --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PartialIsoAlgebra.lean @@ -0,0 +1,89 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] + +def Partial (v : A) : Prop := v*star v*v = v + +theorem partial_initial {v : A} (hv : Partial v) : IsStarProjection (star v*v) := by + constructor + · change (star v*v)*(star v*v) = star v*v + calc + (star v*v)*(star v*v) = star v*(v*star v*v) := by simp only [mul_assoc] + _ = star v*v := by rw [hv] + · change star (star v*v) = star v*v + simp only [star_mul, star_star] + +theorem partial_star {v : A} (hv : Partial v) : Partial (star v) := by + have h := congrArg star hv + simpa only [Partial, star_mul, star_star, ← mul_assoc] using h + +theorem partial_final {v : A} (hv : Partial v) : IsStarProjection (v*star v) := by + simpa only [star_star] using partial_initial (partial_star hv) + +theorem partial_norm {v : A} (hv : Partial v) : ‖v‖ ≤ 1 := by + have h := (partial_initial hv).norm_le + rw [CStarRing.norm_star_mul_self] at h + nlinarith [norm_nonneg v] + +def Extends (v w : A) : Prop := w*(star v*v)=v ∧ star v*w=star v*v + +theorem extends_refl {v : A} (hv : Partial v) : Extends v v := by + exact ⟨by simpa only [Partial, ← mul_assoc] using hv, rfl⟩ + +theorem extends_initial {v w : A} (h : Extends v w) : + (star w*w)*(star v*v)=star v*v := by + have hs : star w*v=star v*v := by + simpa only [star_mul, star_star] using congrArg star h.2 + rw [mul_assoc, h.1, hs] + +theorem extends_initial' {v w : A} (h : Extends v w) : + (star v*v)*(star w*w)=star v*v := by + simpa only [star_mul, star_star] using congrArg star (extends_initial h) + +theorem extends_trans {v w z : A} (h : Extends v w) (k : Extends w z) : Extends v z := by + constructor + · calc + z*(star v*v) = z*((star w*w)*(star v*v)) := by rw [extends_initial h] + _ = (z*(star w*w))*(star v*v) := by simp only [mul_assoc] + _ = v := by rw [k.1, h.1] + · have hs : star v = (star v*v)*star w := by + simpa only [star_mul, star_star] using (congrArg star h.1).symm + calc + star v*z = ((star v*v)*star w)*z := by conv_lhs => rw [hs] + _ = (star v*v)*(star w*z) := by simp only [mul_assoc] + _ = star v*v := by rw [k.2, extends_initial' h] + +theorem extends_antisymm {v w : A} (_ : Partial v) (hw : Partial w) + (h : Extends v w) (k : Extends w v) : v=w := by + have hp : star v*v=star w*w := (extends_initial' h).symm.trans (extends_initial k) + calc + v = w*(star v*v) := h.1.symm + _ = w := by rw [hp]; simpa only [Partial, ← mul_assoc] using hw + +structure PartialIso (A : Type*) [CStarAlgebra A] where + value : A + isPartial : Partial value + +@[ext] theorem PartialIso.ext {v w : PartialIso A} (h : v.value=w.value) : v=w := by + cases v; cases w; simp_all + +instance : PartialOrder (PartialIso A) where + le v w := Extends v.value w.value + le_refl v := extends_refl v.isPartial + le_trans _ _ _ := extends_trans + le_antisymm v w h k := PartialIso.ext (extends_antisymm v.isPartial w.isPartial h k) + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PartialIsoChain.lean b/lean/OAI/Analysis/FreeWords/PartialIsoChain.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cdef58494fc255dfa03a5dfeb5fedaa7a831f0d --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PartialIsoChain.lean @@ -0,0 +1,168 @@ +import Mathlib +import OAI.Analysis.FreeWords.PartialIsoAlgebra +import OAI.Analysis.FreeWords.WeakCompact + +namespace OAI + +noncomputable section + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +namespace UniversalStrongKK + +section OperatorMean + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +variable (m : ScalarMean G) + +variable [CompleteSpace H] + +end OperatorMean + +end UniversalStrongKK + +open scoped Topology + +namespace UniversalStrongKK + +section UltraMean + +variable {I : Type*} [TopologicalSpace I] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UltraMean + +end UniversalStrongKK + +namespace KKProjectionSupport + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open Filter Topology + +open UniversalStrongKK + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem exists_bounded_wot_ultralimit {I : Type*} (ω : Ultrafilter I) + (f : I → (H →L[ℂ] H)) (hf : ∀ i, ‖f i‖ ≤ 1) : + ∃ V : H →L[ℂ] H, Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (f i)) + (ω : Filter I) (𝓝 (ContinuousLinearMapWOT.ofCLM V)) := by + let : TopologicalSpace I := ⊥ + let : DiscreteTopology I := ⟨rfl⟩ + let F : I →ᵇ (H →L[ℂ] H) := BoundedContinuousFunction.ofNormedAddCommGroup f + continuous_of_discreteTopology 1 hf + exact ⟨operatorMean (ultrafilterMean ω) F, tendsto_operatorMean ω F⟩ + +omit [CompleteSpace H] in +theorem wot_mul_const {I : Type*} {l : Filter I} {f : I → (H →L[ℂ] H)} + {V : H →L[ℂ] H} (h : Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (f i)) l + (𝓝 (ContinuousLinearMapWOT.ofCLM V))) (a : H →L[ℂ] H) : + Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (f i*a)) l + (𝓝 (ContinuousLinearMapWOT.ofCLM (V*a))) := by + simpa only [ContinuousLinearMapWOT.ofCLM_mul] using h.mul_const (ContinuousLinearMapWOT.ofCLM a) + +omit [CompleteSpace H] in +theorem wot_const_mul {I : Type*} {l : Filter I} {f : I → (H →L[ℂ] H)} + {V : H →L[ℂ] H} (h : Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (f i)) l + (𝓝 (ContinuousLinearMapWOT.ofCLM V))) (a : H →L[ℂ] H) : + Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (a*f i)) l + (𝓝 (ContinuousLinearMapWOT.ofCLM (a*V))) := by + simpa only [ContinuousLinearMapWOT.ofCLM_mul] using h.const_mul (ContinuousLinearMapWOT.ofCLM a) + +omit [CompleteSpace H] in +theorem wot_limit_eq {I : Type*} {l : Filter I} [l.NeBot] + {f : I → (H →L[ℂ] H)} {V W : H →L[ℂ] H} + (h : Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (f i)) l + (𝓝 (ContinuousLinearMapWOT.ofCLM V))) (he : ∀ᶠ i in l, f i = W) : V=W := by + have h' : (fun i => ContinuousLinearMapWOT.ofCLM (f i)) =ᶠ[l] + (fun _ => ContinuousLinearMapWOT.ofCLM W) := he.mono (fun i hi => congrArg _ hi) + exact congrArg ContinuousLinearMapWOT.toCLM (tendsto_nhds_unique h (tendsto_const_nhds.congr' h'.symm)) + +theorem partialIso_directed_limit {I : Type*} [Preorder I] [IsDirectedOrder I] [Nonempty I] + (f : I → PartialIso (H →L[ℂ] H)) (hf : Monotone f) : + ∃ V : PartialIso (H →L[ℂ] H), (∀ i, f i ≤ V) ∧ + ∃ ω : Ultrafilter I, (ω : Filter I) ≤ atTop ∧ + Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (f i).value) (ω : Filter I) + (𝓝 (ContinuousLinearMapWOT.ofCLM V.value)) := by + let ω : Ultrafilter I := Ultrafilter.of atTop + have hω : (ω : Filter I) ≤ atTop := Ultrafilter.of_le atTop + obtain ⟨V, hV⟩ := exists_bounded_wot_ultralimit ω (fun i => (f i).value) + (fun i => partial_norm (f i).isPartial) + let p (i : I) := star (f i).value*(f i).value + obtain ⟨P, hP⟩ := exists_bounded_wot_ultralimit ω p + (fun i => (partial_initial (f i).isPartial).norm_le) + have hVi (i : I) : V*p i=(f i).value := by + apply wot_limit_eq (wot_mul_const hV (p i)) + filter_upwards [(eventually_ge_atTop i).filter_mono hω] with j hij + exact (hf hij).1 + have hiV (i : I) : star (f i).value*V=p i := by + apply wot_limit_eq (wot_const_mul hV (star (f i).value)) + filter_upwards [(eventually_ge_atTop i).filter_mono hω] with j hij + exact (hf hij).2 + have hsVi (i : I) : star V*(f i).value=p i := by + simpa only [star_mul, star_star, p] using congrArg star (hiV i) + have hVV : star V*V=P := by + have ht := wot_const_mul hV (star V) + have hh : (fun i => ContinuousLinearMapWOT.ofCLM (star V*(f i).value)) = + (fun i => ContinuousLinearMapWOT.ofCLM (p i)) := funext (fun i => congrArg _ (hsVi i)) + rw [hh] at ht + exact congrArg ContinuousLinearMapWOT.toCLM (tendsto_nhds_unique ht hP) + have hVP : V*P=V := by + have ht := wot_const_mul hP V + have hh : (fun i => ContinuousLinearMapWOT.ofCLM (V*p i)) = + (fun i => ContinuousLinearMapWOT.ofCLM (f i).value) := funext (fun i => congrArg _ (hVi i)) + rw [hh] at ht + exact congrArg ContinuousLinearMapWOT.toCLM (tendsto_nhds_unique ht hV) + refine ⟨⟨V, ?_⟩, (fun i => ⟨hVi i, hiV i⟩), ω, hω, hV⟩ + change V*star V*V=V + rw [mul_assoc, hVV, hVP] + +theorem exists_maximal_partialIso (M : VonNeumannAlgebra H) (p q : H →L[ℂ] H) : + ∃ V : PartialIso (H →L[ℂ] H), Maximal + (fun v : PartialIso (H →L[ℂ] H) => v.value ∈ M ∧ v.value*p=v.value ∧ q*v.value=v.value) V := by + let S := {v : PartialIso (H →L[ℂ] H) | v.value ∈ M ∧ v.value*p=v.value ∧ q*v.value=v.value} + let z : PartialIso (H →L[ℂ] H) := ⟨0, by simp [Partial]⟩ + have hz : z ∈ S := ⟨zero_mem M, by simp [z], by simp [z]⟩ + obtain ⟨V, hzV, hV⟩ := zorn_le_nonempty₀ S (fun c hc hchain y hy => by + let : Nonempty c := ⟨⟨y, hy⟩⟩ + let : IsDirectedOrder c := ⟨fun a b => by + obtain ⟨k, hk, hak, hbk⟩ := hchain.directedOn a.val a.property b.val b.property + exact ⟨⟨k,hk⟩,hak,hbk⟩⟩ + obtain ⟨W, hW, ω, hω, hlim⟩ := partialIso_directed_limit (fun i : c => i.val) + (fun _ _ hij => hij) + refine ⟨W, ⟨mem_of_wot_tendsto M hlim (Eventually.of_forall fun i => (hc i.property).1), ?_, ?_⟩, + fun j hj => hW ⟨j,hj⟩⟩ + · have he := wot_mul_const hlim p + have hh : (fun i : c => ContinuousLinearMapWOT.ofCLM (i.val.value*p)) = + (fun i : c => ContinuousLinearMapWOT.ofCLM i.val.value) := by + funext i; rw [(hc i.property).2.1] + rw [hh] at he + exact congrArg ContinuousLinearMapWOT.toCLM (tendsto_nhds_unique he hlim) + · have he := wot_const_mul hlim q + have hh : (fun i : c => ContinuousLinearMapWOT.ofCLM (q*i.val.value)) = + (fun i : c => ContinuousLinearMapWOT.ofCLM i.val.value) := by + funext i; rw [(hc i.property).2.2] + rw [hh] at he + exact congrArg ContinuousLinearMapWOT.toCLM (tendsto_nhds_unique he hlim)) z hz + exact ⟨V,hV⟩ + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PartialIsoResidual.lean b/lean/OAI/Analysis/FreeWords/PartialIsoResidual.lean new file mode 100644 index 0000000000000000000000000000000000000000..73ed8e3a1d49ef46be914f92b865681470a0e809 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PartialIsoResidual.lean @@ -0,0 +1,88 @@ +import Mathlib +import OAI.Analysis.FreeWords.PartialIsoAlgebra + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] + +theorem projection_sub {p e : A} (hp : IsStarProjection p) (he : IsStarProjection e) + (hep : e*p=e) : IsStarProjection (p-e) := by + have hpe : p*e=e := by + simpa only [star_mul, hp.isSelfAdjoint.star_eq, he.isSelfAdjoint.star_eq] using congrArg star hep + constructor + · change (p-e)*(p-e)=p-e + rw [sub_mul, mul_sub, mul_sub, hp.isIdempotentElem.eq, he.isIdempotentElem.eq, hep, hpe] + abel + · change star (p-e)=p-e + rw [star_sub, hp.isSelfAdjoint.star_eq, he.isSelfAdjoint.star_eq] + +theorem initial_bound {v p : A} (hp : IsStarProjection p) (hvp : v*p=v) : + (star v*v)*p=star v*v ∧ p*(star v*v)=star v*v := by + have h : (star v*v)*p=star v*v := by rw [mul_assoc, hvp] + exact ⟨h, by simpa only [star_mul, star_star, hp.isSelfAdjoint.star_eq] using congrArg star h⟩ + +theorem final_bound {v q : A} (hq : IsStarProjection q) (hqv : q*v=v) : + (v*star v)*q=v*star v ∧ q*(v*star v)=v*star v := by + have h : q*(v*star v)=v*star v := by rw [← mul_assoc, hqv] + exact ⟨by simpa only [star_mul, star_star, hq.isSelfAdjoint.star_eq] using congrArg star h, h⟩ + +theorem partial_add_orthogonal {v w : A} (hv : Partial v) (hw : Partial w) + (hvw : star v*w=0) (hvsw : v*star w=0) : + Partial (v+w) ∧ Extends v (v+w) := by + have hwv : star w*v=0 := by simpa only [star_mul, star_star, star_zero] using congrArg star hvw + have hwsv : w*star v=0 := by simpa only [star_mul, star_star, star_zero] using congrArg star hvsw + have hs : star (v+w)*(v+w)=star v*v+star w*w := by + rw [star_add, add_mul, mul_add, mul_add, hvw, hwv, zero_add, add_zero] + constructor + · change (v+w)*star (v+w)*(v+w)=v+w + rw [mul_assoc, hs, add_mul, mul_add, mul_add, ← mul_assoc v (star w), hvsw, + ← mul_assoc w (star v), hwsv, zero_mul, zero_mul, add_zero, zero_add] + rw [← mul_assoc, ← mul_assoc, hv, hw] + · constructor + · rw [add_mul, ← mul_assoc, hv, ← mul_assoc, hwsv, zero_mul, add_zero] + · rw [mul_add, hvw, add_zero] + +theorem orthogonal_of_residual {v w p q : A} (hv : Partial v) + (hp : IsStarProjection p) (hq : IsStarProjection q) (hvp : v*p=v) (hqv : q*v=v) + (hwp : w*(p-star v*v)=w) (hqw : (q-v*star v)*w=w) : + star v*w=0 ∧ v*star w=0 := by + have hs : star v*q=star v := by + simpa only [star_mul, hq.isSelfAdjoint.star_eq] using congrArg star hqv + have hs0 : star v*(q-v*star v)=0 := by + have hvs : star v*v*star v=star v := by + simpa only [Partial, star_star] using partial_star hv + rw [mul_sub, hs, ← mul_assoc, hvs, sub_self] + have h0 : v*(p-star v*v)=0 := by + rw [mul_sub, hvp, ← mul_assoc, hv, sub_self] + constructor + · calc + star v*w=star v*((q-v*star v)*w) := by rw [hqw] + _=0 := by rw [← mul_assoc, hs0, zero_mul] + · have hsw : (p-star v*v)*star w=star w := by + simpa only [star_mul, star_sub, star_star, hp.isSelfAdjoint.star_eq] using congrArg star hwp + calc + v*star w=v*((p-star v*v)*star w) := by rw [hsw] + _=0 := by rw [← mul_assoc, h0, zero_mul] + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PartialUnitaryAlgebra.lean b/lean/OAI/Analysis/FreeWords/PartialUnitaryAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..99a04840d95add4e26cbdd1e35dfdbcad380018e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PartialUnitaryAlgebra.lean @@ -0,0 +1,89 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +structure PartialUnitary (A : Type*) [Ring A] [StarRing A] where + power : ℤ → A + add : ∀ k l, power (k+l)=power k*power l + power_star : ∀ k, star (power k)=power (-k) + +namespace PartialUnitary + +variable {A : Type*} [Ring A] [StarRing A] + +def support (v : PartialUnitary A) : A := v.power 0 + +@[simp] theorem support_mul (v : PartialUnitary A) (k : ℤ) : v.support*v.power k=v.power k := by + rw [support,← v.add,zero_add] + +@[simp] theorem mul_support (v : PartialUnitary A) (k : ℤ) : v.power k*v.support=v.power k := by + rw [support,← v.add,add_zero] + +theorem projection (v : PartialUnitary A) : IsStarProjection v.support := by + constructor + · exact v.mul_support 0 + · change star (v.power 0)=v.power 0 + rw [v.power_star,neg_zero] + +@[simp] theorem star_power_mul (v : PartialUnitary A) (k : ℤ) : star (v.power k)*v.power k=v.support := by + rw [v.power_star,← v.add,neg_add_cancel] + rfl + +@[simp] theorem power_mul_star (v : PartialUnitary A) (k : ℤ) : v.power k*star (v.power k)=v.support := by + rw [v.power_star,← v.add,add_neg_cancel] + rfl + +def zero : PartialUnitary A where + power _ := 0 + add _ _ := (zero_mul _).symm + power_star _ := star_zero A + +theorem orthogonal_power (v w : PartialUnitary A) (ho : v.support*w.support=0) (k l : ℤ) : + v.power k*w.power l=0 := by + calc + _ = (v.power k*v.support)*(w.support*w.power l) := by simp + _ = v.power k*(v.support*w.support)*w.power l := by noncomm_ring + _ = 0 := by rw [ho,mul_zero,zero_mul] + +theorem orthogonal_symm (v w : PartialUnitary A) (ho : v.support*w.support=0) : + w.support*v.support=0 := by + have h := congrArg star ho + simpa only [star_mul,(v.projection).isSelfAdjoint.star_eq, + (w.projection).isSelfAdjoint.star_eq,star_zero] using h + +def sum (v w : PartialUnitary A) (ho : v.support*w.support=0) : PartialUnitary A where + power k := v.power k+w.power k + add k l := by + rw [v.add,w.add,add_mul,mul_add,mul_add,orthogonal_power v w ho, + orthogonal_power w v (orthogonal_symm v w ho),add_zero,zero_add] + power_star k := by rw [star_add,v.power_star,w.power_star] + +@[simp] theorem sum_power (v w : PartialUnitary A) (ho) (k : ℤ) : + (v.sum w ho).power k=v.power k+w.power k := rfl + +@[simp] theorem sum_support (v w : PartialUnitary A) (ho) : + (v.sum w ho).support=v.support+w.support := rfl + +def toUnitary (v : PartialUnitary A) (hv : v.support=1) : unitary A := + ⟨v.power 1, by constructor <;> simp only [star_power_mul,power_mul_star,hv]⟩ + +theorem toUnitary_power (v : PartialUnitary A) (hv : v.support=1) (k : ℤ) : + ((v.toUnitary hv)^k).val=v.power k := by + let f : Multiplicative ℤ →* unitary A := + { toFun k := ⟨v.power k.toAdd, by constructor <;> simp only [star_power_mul,power_mul_star,hv]⟩ + map_one' := Subtype.ext hv + map_mul' k l := Subtype.ext (v.add k.toAdd l.toAdd) } + have h := congrArg Subtype.val (f.map_zpow (Multiplicative.ofAdd 1) k) + change v.power (k • (1:ℤ))=((v.toUnitary hv)^k).val at h + simpa only [smul_eq_mul,mul_one] using h.symm + +end PartialUnitary + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PartialUnitaryChain.lean b/lean/OAI/Analysis/FreeWords/PartialUnitaryChain.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b8ba9ef5a1cfd782a0eca7fe54302270e60bcef --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PartialUnitaryChain.lean @@ -0,0 +1,106 @@ +import Mathlib +import OAI.Analysis.FreeWords.PartialUnitaryNorm +import OAI.Analysis.FreeWords.PartialUnitaryTrace +import OAI.Analysis.FreeWords.TraceL2Convergence + +namespace OAI + +noncomputable section + +namespace KKLocalPatching.PartialUnitary + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKFactorSupport + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +local instance : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem directed_power_cauchy {I : Type*} [Nonempty I] [SemilatticeSup I] + (f : I → PartialUnitary (ConcreteAlgebra M)) (hf : Monotone f) (k : ℤ) : + CauchySeq (fun i => gnsVector (tracePositive τ) ((f i).power k)) := by + let t (i:I) := (τ.map (f i).support).re + have ht : Monotone t := fun i j hij => support_trace_mono τ (hf hij) + have hb : BddAbove (Set.range t) := ⟨1,fun _ ⟨i,hi⟩ => hi ▸ support_trace_le_one τ (f i)⟩ + let T := ⨆ i,t i + have hle (i:I) : t i≤T := le_ciSup hb i + have hlim : Tendsto t atTop (𝓝 T) := tendsto_atTop_ciSup ht hb + have hz : Tendsto (fun i => Real.sqrt (T-t i)) atTop (𝓝 0) := by + have hh := Real.continuous_sqrt.continuousAt.tendsto.comp ((tendsto_const_nhds (x := T)).sub hlim) + simpa only [Function.comp_def,sub_self,Real.sqrt_zero] using hh + apply cauchySeq_of_le_tendsto_0' (fun i => Real.sqrt (T-t i)) ?_ hz + intro i j hij + have hsq := power_dist_sq τ (hf hij) k + have hh := Real.sq_sqrt (sub_nonneg.mpr (hle i)) + have hn := Real.sqrt_nonneg (T-t i) + have hd := dist_nonneg (x := gnsVector (tracePositive τ) ((f i).power k)) + (y := gnsVector (tracePositive τ) ((f j).power k)) + change _ = t j-t i at hsq + nlinarith [hle j] + +theorem directed_limit {I : Type*} [Nonempty I] [SemilatticeSup I] + (f : I → PartialUnitary (ConcreteAlgebra M)) (hf : Monotone f) : + ∃ v : PartialUnitary (ConcreteAlgebra M), (∀ i, f i≤v) ∧ + ∀ k, Tendsto (fun i => gnsVector (tracePositive τ) ((f i).power k)) atTop + (𝓝 (gnsVector (tracePositive τ) (v.power k))) := by + have hex (k:ℤ) : ∃ a : ConcreteAlgebra M, ‖a‖≤1 ∧ + Tendsto (fun i => gnsVector (tracePositive τ) ((f i).power k)) atTop + (𝓝 (gnsVector (tracePositive τ) a)) := by + obtain ⟨z,hz,hlim⟩ := cauchySeq_tendsto_of_isComplete + (gnsVector_closedBall_isClosed τ 1).isComplete + (fun i => (show gnsVector (tracePositive τ) ((f i).power k) ∈ + gnsVector (tracePositive τ) '' Metric.closedBall (0:ConcreteAlgebra M) 1 from + ⟨(f i).power k, by simpa only [Metric.mem_closedBall,dist_zero_right] using (f i).norm_power_le_one k,rfl⟩)) + (directed_power_cauchy τ f hf k) + obtain ⟨a,ha,rfl⟩ := hz + exact ⟨a,by simpa only [Metric.mem_closedBall,dist_zero_right] using ha,hlim⟩ + choose a ha hlim using hex + have hadd (k l:ℤ) : a (k+l)=a k*a l := by + apply gnsVector_injective τ + have hm := tendsto_gns_mul τ 1 zero_le_one (fun i => (f i).norm_power_le_one k) (hlim k) (hlim l) + have he (i:I) : (f i).power k*(f i).power l=(f i).power (k+l) := ((f i).add _ _).symm + simp only [he] at hm + exact tendsto_nhds_unique (hlim (k+l)) hm + have hstar (k:ℤ) : star (a k)=a (-k) := by + apply gnsVector_injective τ + have hs := tendsto_gns_star τ (hlim k) + simp only [power_star] at hs + exact tendsto_nhds_unique hs (hlim (-k)) + let v : PartialUnitary (ConcreteAlgebra M) := ⟨a,hadd,hstar⟩ + refine ⟨v,?_,hlim⟩ + intro i k + constructor + · apply gnsVector_injective τ + have hm := tendsto_gns_mul τ 1 zero_le_one (fun j => (f j).norm_power_le_one k) + (hlim k) (tendsto_const_nhds (x := gnsVector (tracePositive τ) (f i).support)) + have he : (fun j => gnsVector (tracePositive τ) ((f j).power k*(f i).support)) =ᶠ[atTop] + (fun _ => gnsVector (tracePositive τ) ((f i).power k)) := by + filter_upwards [eventually_ge_atTop i] with j hij + rw [(hf hij k).1] + exact tendsto_nhds_unique hm (tendsto_const_nhds.congr' he.symm) + · apply gnsVector_injective τ + have hm := tendsto_gns_mul τ 1 zero_le_one (fun (_:I) => (f i).norm_support_le_one) + (tendsto_const_nhds (x := gnsVector (tracePositive τ) (f i).support)) (hlim k) + have he : (fun j => gnsVector (tracePositive τ) ((f i).support*(f j).power k)) =ᶠ[atTop] + (fun _ => gnsVector (tracePositive τ) ((f i).power k)) := by + filter_upwards [eventually_ge_atTop i] with j hij + rw [(hf hij k).2] + exact tendsto_nhds_unique hm (tendsto_const_nhds.congr' he.symm) + +end + +end KKLocalPatching.PartialUnitary +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PartialUnitaryNorm.lean b/lean/OAI/Analysis/FreeWords/PartialUnitaryNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..9342deef52df3a93b4b8be29322f56d16fe4b1d4 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PartialUnitaryNorm.lean @@ -0,0 +1,25 @@ +import Mathlib +import OAI.Analysis.FreeWords.PartialUnitaryAlgebra + +namespace OAI + +noncomputable section + +namespace KKLocalPatching.PartialUnitary + +variable {A : Type*} [NormedRing A] [StarRing A] [CStarRing A] + +theorem norm_support_le_one (v : PartialUnitary A) : ‖v.support‖≤1 := by + have h := CStarRing.norm_star_mul_self (x := v.support) + rw [v.projection.isSelfAdjoint.star_eq,v.projection.isIdempotentElem.eq] at h + nlinarith [norm_nonneg v.support] + +theorem norm_power_le_one (v : PartialUnitary A) (k : ℤ) : ‖v.power k‖≤1 := by + have h := CStarRing.norm_star_mul_self (x := v.power k) + rw [v.star_power_mul] at h + nlinarith [v.norm_support_le_one,norm_nonneg (v.power k)] + +end KKLocalPatching.PartialUnitary +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PartialUnitaryOrder.lean b/lean/OAI/Analysis/FreeWords/PartialUnitaryOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..49d65a2731da315a03547b6690d8dd337b03f06b --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PartialUnitaryOrder.lean @@ -0,0 +1,78 @@ +import Mathlib +import OAI.Analysis.FreeWords.PartialUnitaryAlgebra + +namespace OAI + +noncomputable section + +namespace KKLocalPatching.PartialUnitary + +variable {A : Type*} [Ring A] [StarRing A] + +@[ext] theorem ext {v w : PartialUnitary A} (h : ∀ k, v.power k=w.power k) : v=w := by + cases v; cases w + simp_all only [mk.injEq,funext_iff] + intro; trivial + +def Extends (v w : PartialUnitary A) : Prop := + ∀ k, w.power k*v.support=v.power k ∧ v.support*w.power k=v.power k + +instance : PartialOrder (PartialUnitary A) where + le := Extends + le_refl v k := ⟨v.mul_support k,v.support_mul k⟩ + le_trans v w z hvw hwz k := by + constructor + · calc + _ = z.power k*(w.support*v.support) := by rw [show w.support*v.support=v.support from (hvw 0).1] + _ = (z.power k*w.support)*v.support := by rw [mul_assoc] + _ = _ := by rw [(hwz k).1,(hvw k).1] + · calc + _ = (v.support*w.support)*z.power k := by rw [show v.support*w.support=v.support from (hvw 0).2] + _ = v.support*(w.support*z.power k) := by rw [mul_assoc] + _ = _ := by rw [(hwz k).2,(hvw k).2] + le_antisymm v w hvw hwv := by + have hs : v.support=w.support := (hvw 0).1.symm.trans (hwv 0).2 + ext k + rw [← (hvw k).1,hs,w.mul_support] + +theorem cross_power {v w : PartialUnitary A} (h : v≤w) (k l : ℤ) : + w.power k*v.power l=v.power (k+l) := by + calc + _ = w.power k*(v.support*v.power l) := by rw [v.support_mul] + _ = (w.power k*v.support)*v.power l := by rw [mul_assoc] + _ = _ := by rw [(h k).1,← v.add] + +theorem cross_power' {v w : PartialUnitary A} (h : v≤w) (k l : ℤ) : + v.power k*w.power l=v.power (k+l) := by + calc + _ = (v.power k*v.support)*w.power l := by rw [v.mul_support] + _ = v.power k*(v.support*w.power l) := by rw [mul_assoc] + _ = _ := by rw [(h l).2,← v.add] + +theorem difference_square {v w : PartialUnitary A} (h : v≤w) (k : ℤ) : + star (w.power k-v.power k)*(w.power k-v.power k)=w.support-v.support := by + rw [star_sub,sub_mul,mul_sub,mul_sub,w.star_power_mul,v.star_power_mul, + w.power_star,v.power_star,cross_power h,cross_power' h,neg_add_cancel] + change w.support-v.support-(v.support-v.support)=_ + rw [sub_self,sub_zero] + +theorem le_sum (v w : PartialUnitary A) (ho : v.support*w.support=0) : v≤v.sum w ho := by + intro k + constructor + · change (v.power k+w.power k)*v.support=v.power k + rw [add_mul,v.mul_support] + change v.power k+w.power k*v.power 0=v.power k + rw [orthogonal_power w v (orthogonal_symm v w ho),add_zero] + · change v.support*(v.power k+w.power k)=v.power k + rw [mul_add,v.support_mul] + change v.power k+v.power 0*w.power k=v.power k + rw [orthogonal_power v w ho,add_zero] + +theorem zero_le (v : PartialUnitary A) : zero≤v := by + intro k + constructor <;> simp [zero,support] + +end KKLocalPatching.PartialUnitary +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PartialUnitaryTrace.lean b/lean/OAI/Analysis/FreeWords/PartialUnitaryTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..d157d0bcf50505a57262b7d3bacb18b1075f9994 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PartialUnitaryTrace.lean @@ -0,0 +1,54 @@ +import Mathlib +import OAI.Analysis.FreeWords.PartialUnitaryNorm +import OAI.Analysis.FreeWords.PartialUnitaryOrder +import OAI.Analysis.FreeWords.ProjectionRound + +namespace OAI + +noncomputable section + +namespace KKLocalPatching.PartialUnitary + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +local instance partialUnitaryTraceConcreteOrder : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance partialUnitaryTraceConcretePreorder : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance partialUnitaryTraceConcreteLE : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance partialUnitaryTraceConcreteSOR : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem power_dist_sq {v w : PartialUnitary (ConcreteAlgebra M)} (h : v≤w) (k : ℤ) : + dist (gnsVector (tracePositive τ) (v.power k)) (gnsVector (tracePositive τ) (w.power k))^2 = + (τ.map w.support).re-(τ.map v.support).re := by + have hh := congrArg Complex.re (traceNorm_sq τ (w.power k-v.power k)) + simp only [Complex.ofReal_re,difference_square h,map_sub,Complex.sub_re] at hh + rw [dist_comm,dist_eq_norm,← map_sub,← traceNorm_eq_gns] + exact hh + +theorem support_trace_mono {v w : PartialUnitary (ConcreteAlgebra M)} (h : v≤w) : + (τ.map v.support).re≤(τ.map w.support).re := by + have hsq := power_dist_sq τ h 0 + nlinarith [sq_nonneg (dist (gnsVector (tracePositive τ) (v.power 0)) (gnsVector (tracePositive τ) (w.power 0)))] + +theorem support_trace_le_one (v : PartialUnitary (ConcreteAlgebra M)) : + (τ.map v.support).re≤1 := by + rw [← traceNorm_projection_sq τ v.projection] + have h := (traceNorm_le_norm τ v.support).trans v.norm_support_le_one + nlinarith [traceNorm_nonneg τ v.support] + +end + +end KKLocalPatching.PartialUnitary +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PartialWords.lean b/lean/OAI/Analysis/FreeWords/PartialWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b322fb9a1e3256007cb79fdebb6df67fd9ba632 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PartialWords.lean @@ -0,0 +1,130 @@ +import Mathlib +import OAI.Analysis.FreeWords.PartialUnitaryAlgebra +import OAI.Analysis.FreeWords.PartialUnitaryNorm +import OAI.Analysis.FreeWords.TraceL2Convergence + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +open Filter Topology + +noncomputable section + +structure PatchingWord (A : Type*) where + left : A + first : ℤ + middle : List (A × ℤ) + right : A + +namespace PatchingWord + +variable {A : Type*} [Ring A] + +def tailValue (u : ℤ → A) (s : List (A × ℤ)) : A := + (s.map (fun z => z.1*u z.2)).prod + +def value (w : PatchingWord A) (u : ℤ → A) : A := + w.left*u w.first*tailValue u w.middle*w.right + +def length (w : PatchingWord A) : ℕ := 1+w.middle.length + +@[simp] theorem tailValue_nil (u : ℤ → A) : tailValue u []=1 := rfl + +@[simp] theorem tailValue_cons (u : ℤ → A) (z : A × ℤ) (s : List (A × ℤ)) : + tailValue u (z::s)=z.1*u z.2*tailValue u s := rfl + +@[simp] theorem value_zero (w : PatchingWord A) : w.value (fun _ => 0)=0 := by + simp [value] + +theorem tailValue_append (u : ℤ → A) (s t : List (A × ℤ)) : + tailValue u (s++t)=tailValue u s*tailValue u t := by + simp only [tailValue,List.map_append,List.prod_append] + +end PatchingWord + +namespace PatchingWord + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +local instance partialWordsConcreteOrder : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance partialWordsConcretePreorder : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance partialWordsConcreteLE : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance partialWordsConcreteSOR : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem concrete_norm_one_le : ‖(1:ConcreteAlgebra M)‖≤1 := by + have h := CStarRing.norm_star_mul_self (x := (1:ConcreteAlgebra M)) + simp only [star_one,mul_one] at h + nlinarith [norm_nonneg (1:ConcreteAlgebra M)] + +theorem norm_tailValue_le (v : PartialUnitary (ConcreteAlgebra M)) + (s : List (ConcreteAlgebra M × ℤ)) : + ‖tailValue v.power s‖ ≤ (s.map (fun z => ‖z.1‖)).prod := by + induction s with + | nil => simpa only [tailValue_nil,List.map_nil,List.prod_nil] using (concrete_norm_one_le (M := M)) + | cons z s ih => + simp only [tailValue_cons,List.map_cons,List.prod_cons] + calc + _ ≤ ‖z.1*v.power z.2‖*‖tailValue v.power s‖ := norm_mul_le _ _ + _ ≤ (‖z.1‖*1)*(s.map (fun z => ‖z.1‖)).prod := + mul_le_mul ((norm_mul_le _ _).trans (mul_le_mul_of_nonneg_left (v.norm_power_le_one _) (norm_nonneg _))) + ih (norm_nonneg _) (mul_nonneg (norm_nonneg _) zero_le_one) + _ = _ := by rw [mul_one] + +theorem tendsto_tailValue {I : Type*} {l : Filter I} + {f : I → PartialUnitary (ConcreteAlgebra M)} {v : PartialUnitary (ConcreteAlgebra M)} + (hf : ∀ k, Tendsto (fun i => gnsVector (tracePositive τ) ((f i).power k)) l + (𝓝 (gnsVector (tracePositive τ) (v.power k)))) + (s : List (ConcreteAlgebra M × ℤ)) : + Tendsto (fun i => gnsVector (tracePositive τ) (tailValue (f i).power s)) l + (𝓝 (gnsVector (tracePositive τ) (tailValue v.power s))) := by + induction s with + | nil => exact tendsto_const_nhds + | cons z s ih => + simp only [tailValue_cons] + apply tendsto_gns_mul τ ‖z.1‖ (norm_nonneg _) ?_ ?_ ih + · intro i + simpa only [mul_one] using (norm_mul_le z.1 ((f i).power z.2)).trans + (mul_le_mul_of_nonneg_left ((f i).norm_power_le_one z.2) (norm_nonneg z.1)) + · exact tendsto_gns_mul τ ‖z.1‖ (norm_nonneg _) (fun _ => le_rfl) + tendsto_const_nhds (hf z.2) + +theorem tendsto_value {I : Type*} {l : Filter I} + {f : I → PartialUnitary (ConcreteAlgebra M)} {v : PartialUnitary (ConcreteAlgebra M)} + (hf : ∀ k, Tendsto (fun i => gnsVector (tracePositive τ) ((f i).power k)) l + (𝓝 (gnsVector (tracePositive τ) (v.power k)))) (w : PatchingWord (ConcreteAlgebra M)) : + Tendsto (fun i => τ.map (w.value (f i).power)) l (𝓝 (τ.map (w.value v.power))) := by + apply tendsto_gns_trace τ + have h₁ := tendsto_gns_mul τ ‖w.left‖ (norm_nonneg _) (fun (_:I) => le_rfl) + tendsto_const_nhds (hf w.first) + have hb (i:I) : ‖w.left*(f i).power w.first‖≤‖w.left‖ := by + simpa only [mul_one] using (norm_mul_le w.left ((f i).power w.first)).trans + (mul_le_mul_of_nonneg_left ((f i).norm_power_le_one w.first) (norm_nonneg w.left)) + have h₂ := tendsto_gns_mul τ ‖w.left‖ (norm_nonneg _) hb h₁ (tendsto_tailValue τ hf w.middle) + have hp : 0≤(w.middle.map (fun z => ‖z.1‖)).prod := by + apply List.prod_nonneg + intro a ha + obtain ⟨z,hz,rfl⟩ := List.mem_map.mp ha + exact norm_nonneg _ + exact tendsto_gns_mul τ (‖w.left‖*(w.middle.map (fun z => ‖z.1‖)).prod) + (mul_nonneg (norm_nonneg _) hp) + (fun i => (norm_mul_le _ _).trans (mul_le_mul (hb i) (norm_tailValue_le (f i) w.middle) + (norm_nonneg _) (norm_nonneg _))) h₂ tendsto_const_nhds + +end PatchingWord + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PartitionHom.lean b/lean/OAI/Analysis/FreeWords/PartitionHom.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e3fb75248ba03722fec1be945c6099dc10a4fac --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PartitionHom.lean @@ -0,0 +1,69 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +noncomputable section + +open scoped BigOperators + +variable {ι A : Type*} [Fintype ι] [DecidableEq ι] [Ring A] [Algebra ℂ A] + +def partitionLinear (p : ι → A) : (ι → ℂ) →ₗ[ℂ] A where + toFun c := ∑ i, c i • p i + map_add' c d := by simp only [Pi.add_apply,add_smul,Finset.sum_add_distrib] + map_smul' c d := by simp only [Pi.smul_apply,smul_smul,Finset.smul_sum]; rfl + +omit [DecidableEq ι] in +@[simp] theorem partitionLinear_apply (p : ι → A) (c : ι → ℂ) : + partitionLinear p c=∑ i, c i • p i := rfl + +theorem partitionLinear_mul (p : ι → A) + (hp : ∀ i j, p i*p j=if i=j then p i else 0) (c d : ι → ℂ) : + partitionLinear p (c*d)=partitionLinear p c*partitionLinear p d := by + symm + calc + partitionLinear p c*partitionLinear p d = ∑ i, ∑ j, (c i*d j) • (p i*p j) := by + simp only [partitionLinear_apply] + simp only [Finset.sum_mul] + simp only [Finset.mul_sum] + simp only [smul_mul_assoc,mul_smul_comm,smul_smul,mul_comm] + _ = partitionLinear p (c*d) := by + simp only [hp,smul_ite,smul_zero,Finset.sum_ite_eq,Finset.mem_univ,ite_true, + partitionLinear_apply,Pi.mul_apply] + +variable [StarRing A] [StarModule ℂ A] + +def partitionHom (p : ι → A) (hp : ∀ i, IsStarProjection (p i)) + (hort : ∀ i j, i≠j → p i*p j=0) (h1 : ∑ i, p i=1) : (ι → ℂ) →⋆ₐ[ℂ] A where + toFun := partitionLinear p + map_zero' := (partitionLinear p).map_zero + map_one' := by simpa only [partitionLinear_apply,Pi.one_apply,one_smul] using h1 + map_add' := (partitionLinear p).map_add + map_mul' := partitionLinear_mul p (fun i j => by + split_ifs with h + · subst j; exact (hp i).isIdempotentElem.eq + · exact hort i j h) + commutes' c := by simp only [Algebra.algebraMap_eq_smul_one,map_smul, + partitionLinear_apply,Pi.one_apply,one_smul,h1] + map_star' c := by simp only [partitionLinear_apply,star_sum,star_smul,Pi.star_apply, + fun i => (hp i).isSelfAdjoint.star_eq] + +@[simp] theorem partitionHom_apply (p : ι → A) (hp : ∀ i, IsStarProjection (p i)) + (hort : ∀ i j, i≠j → p i*p j=0) (h1 : ∑ i, p i=1) (c : ι → ℂ) : + partitionHom p hp hort h1 c=∑ i, c i • p i := rfl + +@[simp] theorem partitionHom_pow (p : ι → A) (hp : ∀ i, IsStarProjection (p i)) + (hort : ∀ i j, i≠j → p i*p j=0) (h1 : ∑ i, p i=1) (c : ι → ℂ) (k : ℕ) : + (partitionHom p hp hort h1 c)^k=∑ i, (c i)^k • p i := by + rw [← map_pow]; rfl + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PartitionRefine.lean b/lean/OAI/Analysis/FreeWords/PartitionRefine.lean new file mode 100644 index 0000000000000000000000000000000000000000..0aae0046c616aee15f1f1411eccec1e933e18635 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PartitionRefine.lean @@ -0,0 +1,118 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixUnitHom +import OAI.Analysis.FreeWords.ProjectionPartition +import OAI.Analysis.FreeWords.ProjectionRound + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance partitionRefinePartialOrder (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance partitionRefinePreorder (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance partitionRefineLE (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance partitionRefineStarOrderedRing (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem refine_projection_partition {ι : Type*} [Fintype ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (hD : IsDiffuse M) + (p : ι → ConcreteAlgebra M) (hp : ∀ i, IsStarProjection (p i)) + (ho : ∀ i j, i≠j → p i*p j=0) (h1 : ∑ i, p i=1) + (k : ι → ℕ) (t : ℝ) (ht : 0 ≤ t) (hτ : ∀ i, τ.map (p i)=(k i:ℂ)*(t:ℂ)) : + ∃ e : (Σ i, Fin (k i)) → ConcreteAlgebra M, + (∀ i, IsStarProjection (e i)) ∧ + (∀ i j, i≠j → e i*e j=0) ∧ (∑ i, e i)=1 ∧ + (∀ i, τ.map (e i)=(t:ℂ)) ∧ (∀ i, ∑ a, e ⟨i,a⟩=p i) := by + classical + choose f hf hfp hfo hfs hfτ using fun i => projection_partition M τ hD + (k i) (p i) (hp i) t ht (hτ i) + let e : (Σ i, Fin (k i)) → ConcreteAlgebra M := fun i => f i.1 i.2 + refine ⟨e,fun i => hf i.1 i.2,?_,?_,fun i => hfτ i.1 i.2,hfs⟩ + · rintro ⟨i,a⟩ ⟨j,b⟩ hij + by_cases he : i=j + · subst j + exact hfo i a b (fun hab => hij (by cases hab; rfl)) + · exact subprojections_orthogonal (hp i) (hp j) (hf i a) (hf j b) + (hfp i a) (hfp j b) (ho i j he) + · simpa only [Fintype.sum_sigma,e,hfs] using h1 + +theorem unitary_of_equal_partition {ι : Type*} [Fintype ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (hF : IsFactor M) + (p : ι → ConcreteAlgebra M) (hp : ∀ i, IsStarProjection (p i)) + (ho : ∀ i j, i≠j → p i*p j=0) (h1 : ∑ i, p i=1) + (hτ : ∀ i j, τ.map (p i)=τ.map (p j)) + (c : ι → ℂ) (hc : ∀ i, ‖c i‖=1) : + ∃ (n : ℕ) (_hn : 0 < n) + (ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M) + (v : unitary (Matrix (Fin n) (Fin n) ℂ)), + Function.Injective ρ ∧ ρ v.val=∑ i, c i • p i := by + classical + let : Nontrivial (ConcreteAlgebra M) := ⟨⟨0,1,fun h => by + have ht := congrArg τ.map h + rw [map_zero,τ.normalized] at ht + exact zero_ne_one ht⟩⟩ + have hn : 0 < Fintype.card ι := by + by_contra h + have h0 : Fintype.card ι=0 := Nat.eq_zero_of_not_pos h + let : IsEmpty ι := Fintype.card_eq_zero_iff.mp h0 + simp at h1 + let f := (Fintype.equivFin ι).symm + let q : Fin (Fintype.card ι) → ConcreteAlgebra M := p ∘ f + have hq (i) : IsStarProjection (q i) := hp (f i) + have hqo (i j) (hij : i≠j) : q i*q j=0 := ho (f i) (f j) (fun h => hij (f.injective h)) + have hq1 : ∑ i, q i=1 := by rw [show (∑ i, q i)=∑ i, p i from f.sum_comp p]; exact h1 + let i₀ : Fin (Fintype.card ι) := ⟨0,hn⟩ + let : Nonempty (Fin (Fintype.card ι)) := ⟨i₀⟩ + obtain ⟨e,hm,he1,hes,hed⟩ := partial_matrix_system_diagonal M τ hF q hq hqo hq1 i₀ + (fun i => hτ (f i) (f i₀)) + let ρ := matrixUnitHom e hm he1 hes + let b : Matrix (Fin (Fintype.card ι)) (Fin (Fintype.card ι)) ℂ := + Matrix.diagonal (fun i => c (f i)) + have hb : b ∈ unitary _ := by + rw [Unitary.mem_iff] + constructor + · simp only [b,Matrix.star_eq_conjTranspose,Matrix.diagonal_conjTranspose] + change (Matrix.diagonal (fun i => star (c (f i)))) * + Matrix.diagonal (fun i => c (f i))=1 + rw [Matrix.diagonal_mul_diagonal] + ext i j + simp only [Matrix.diagonal_apply,Matrix.one_apply] + split_ifs + · rw [Complex.star_def,← Complex.normSq_eq_conj_mul_self,Complex.normSq_eq_norm_sq,hc] + norm_num + · rfl + · simp only [b,Matrix.star_eq_conjTranspose,Matrix.diagonal_conjTranspose] + change Matrix.diagonal (fun i => c (f i)) * + (Matrix.diagonal (fun i => star (c (f i))))=1 + rw [Matrix.diagonal_mul_diagonal] + ext i j + simp only [Matrix.diagonal_apply,Matrix.one_apply] + split_ifs + · rw [Complex.star_def,Complex.mul_conj,Complex.normSq_eq_norm_sq,hc] + norm_num + · rfl + refine ⟨Fintype.card ι,hn,ρ,⟨b,hb⟩,ρ.toAlgHom.toRingHom.injective,?_⟩ + change (∑ i, ∑ j, b i j • e i j)=∑ i, c i • p i + simp only [b,Matrix.diagonal_apply,ite_smul,zero_smul,Finset.sum_ite_eq, + Finset.mem_univ,ite_true,hed] + exact f.sum_comp (fun i => c i • p i) + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchTraceBounds.lean b/lean/OAI/Analysis/FreeWords/PatchTraceBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd9c8323b163f94b7b0ab481027719965fa636e8 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchTraceBounds.lean @@ -0,0 +1,93 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixAverageTrace +import OAI.Analysis.FreeWords.PartialUnitaryAlgebra +import OAI.Analysis.FreeWords.PartialUnitaryNorm + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +local instance patchTracePartialOrder : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance patchTracePreorder : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance patchTraceLE : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance patchTraceStarOrderedRing : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem trace_mul_cs (a b : ConcreteAlgebra M) : + ‖τ.map (a*b)‖ ≤ traceNorm τ a*traceNorm τ b := by + have h := norm_inner_le_norm (𝕜 := ℂ) (gnsVector (tracePositive τ) (star a)) + (gnsVector (tracePositive τ) b) + simp only [gnsVector_inner,star_star,← traceNorm_eq_gns,traceNorm_star] at h + change ‖τ.map (a*b)‖ ≤ _ at h + exact h + +theorem traceNorm_power (v : PartialUnitary (ConcreteAlgebra M)) (k:ℤ) : + traceNorm τ (v.power k)=traceNorm τ v.support := by + simp only [traceNorm,v.star_power_mul,v.projection.isSelfAdjoint.star_eq, + v.projection.isIdempotentElem.eq] + +theorem trace_supported_le (q a : ConcreteAlgebra M) (hq : IsStarProjection q) + (ha : q*a=a) : ‖τ.map a‖ ≤ traceNorm τ q^2*‖a‖ := by + have he : τ.map a=τ.map (q*a*q) := by + rw [τ.tracial (q*a) q,← mul_assoc,hq.isIdempotentElem.eq,ha] + rw [he] + calc + _ ≤ traceNorm τ q*traceNorm τ (a*q) := by + simpa only [mul_assoc] using trace_mul_cs τ q (a*q) + _ ≤ traceNorm τ q*(‖a‖*traceNorm τ q) := + mul_le_mul_of_nonneg_left (traceNorm_mul_le τ a q) (traceNorm_nonneg τ q) + _ = _ := by ring + +theorem gap_trace_bound (v : PartialUnitary (ConcreteAlgebra M)) + (k l : ℤ) (Y Z : ConcreteAlgebra M) (c : ℂ) : + ‖τ.map (v.power k*Y*v.power l*Z)‖ ≤ + (traceNorm τ (v.support*Y*v.support-c • v.support)+‖c‖*traceNorm τ v.support)* + traceNorm τ v.support*‖Z‖ := by + let q := v.support + let A := q*Y*q + have hj : v.power k*Y*v.power l*Z=v.power k*A*v.power l*Z := by + dsimp only [A,q] + simp only [← mul_assoc,v.mul_support] + rw [mul_assoc (v.power k*Y) v.support (v.power l),v.support_mul] + rw [hj,τ.tracial (v.power k*A*v.power l) Z] + have he : Z*(v.power k*A*v.power l)=(Z*v.power k)*A*v.power l := by noncomm_ring + rw [he,τ.tracial ((Z*v.power k)*A) (v.power l)] + have he : v.power l*((Z*v.power k)*A)=(v.power l*Z*v.power k)*A := by noncomm_ring + rw [he,τ.tracial (v.power l*Z*v.power k) A] + have hA : traceNorm τ A≤traceNorm τ (A-c • q)+‖c‖*traceNorm τ q := by + calc + _ = traceNorm τ ((A-c • q)+c • q) := by rw [sub_add_cancel] + _ ≤ _ := by simpa only [traceNorm_smul] using traceNorm_add_le τ (A-c • q) (c • q) + have hZ : traceNorm τ (v.power l*Z*v.power k)≤traceNorm τ q*‖Z‖ := by + calc + _ ≤ ‖v.power l‖*traceNorm τ (Z*v.power k) := by + simpa only [mul_assoc] using traceNorm_mul_le τ (v.power l) (Z*v.power k) + _ ≤ 1*traceNorm τ (Z*v.power k) := mul_le_mul_of_nonneg_right (v.norm_power_le_one l) (traceNorm_nonneg τ _) + _ ≤ ‖Z‖*traceNorm τ (v.power k) := by simpa only [one_mul] using traceNorm_mul_le τ Z (v.power k) + _ = traceNorm τ q*‖Z‖ := by rw [traceNorm_power]; ring + calc + _ ≤ traceNorm τ A*traceNorm τ (v.power l*Z*v.power k) := trace_mul_cs τ _ _ + _ ≤ (traceNorm τ (A-c • q)+‖c‖*traceNorm τ q)*(traceNorm τ q*‖Z‖) := + mul_le_mul hA hZ (traceNorm_nonneg τ _) (add_nonneg (traceNorm_nonneg τ _) (mul_nonneg (norm_nonneg _) (traceNorm_nonneg τ _))) + _ = _ := by ring + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingBudget.lean b/lean/OAI/Analysis/FreeWords/PatchingBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..b73acc188775ae3d0206e1c1f05e7bb816c47415 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingBudget.lean @@ -0,0 +1,55 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +noncomputable section + +def patchingBudget (δ C t : ℝ) : ℝ := δ*(Real.exp (C*t)-1) + +theorem continuous_patchingBudget (δ C : ℝ) : Continuous (patchingBudget δ C) := by + unfold patchingBudget + fun_prop + +@[simp] theorem patchingBudget_zero (δ C : ℝ) : patchingBudget δ C 0=0 := by + simp [patchingBudget] + +theorem patchingBudget_nonneg {δ C t : ℝ} (hδ : 0 ≤ δ) (hC : 0 ≤ C) (ht : 0 ≤ t) : + 0 ≤ patchingBudget δ C t := by + exact mul_nonneg hδ (sub_nonneg.mpr (Real.one_le_exp (mul_nonneg hC ht))) + +theorem patchingBudget_increment {δ C D η t s : ℝ} + (hδ : 0 ≤ δ) (hD : 0 ≤ D) (hη : 0 < η) (hC : 0 ≤ C) + (hdom : D*(2/η+1) ≤ C) (ht : 0 ≤ t) (hs : 0 ≤ s) : + patchingBudget δ C t+D*(2*patchingBudget δ C t/η+δ)*s ≤ patchingBudget δ C (t+s) := by + let E := Real.exp (C*t) + have hE : 1 ≤ E := Real.one_le_exp (mul_nonneg hC ht) + have hE0 : 0 ≤ E := (zero_le_one.trans hE) + have hB : patchingBudget δ C t ≤ δ*E := by + dsimp only [patchingBudget,E] + nlinarith + have hδE : δ ≤ δ*E := by nlinarith + have hcoeff : D*(2*patchingBudget δ C t/η+δ) ≤ δ*E*C := by + calc + _ ≤ D*(2*(δ*E)/η+δ*E) := mul_le_mul_of_nonneg_left + (add_le_add (div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hB (by norm_num)) hη.le) hδE) hD + _ = (δ*E)*(D*(2/η+1)) := by ring + _ ≤ δ*E*C := mul_le_mul_of_nonneg_left hdom (mul_nonneg hδ hE0) + have hex : C*s+1 ≤ Real.exp (C*s) := Real.add_one_le_exp (C*s) + have hstep : patchingBudget δ C t+(δ*E*C)*s ≤ patchingBudget δ C (t+s) := by + have h := mul_le_mul_of_nonneg_left hex (mul_nonneg hδ hE0) + dsimp only [patchingBudget] + rw [mul_add,Real.exp_add] + change δ*(E-1)+δ*E*C*s ≤ δ*(E*Real.exp (C*s)-1) + nlinarith + exact (add_le_add (le_refl (patchingBudget δ C t)) (mul_le_mul_of_nonneg_right hcoeff hs)).trans hstep + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingCornerBounds.lean b/lean/OAI/Analysis/FreeWords/PatchingCornerBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c153c62034527dcfac6cfce970807ba1e41e9f6 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingCornerBounds.lean @@ -0,0 +1,85 @@ +import Mathlib +import OAI.Analysis.FreeWords.PatchTraceBounds + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +local instance patchCornerPartialOrder : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance patchCornerPreorder : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance patchCornerLE : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance patchCornerStarOrderedRing : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem corner_scalar_bound (e Y : ConcreteAlgebra M) (he : IsStarProjection e) + {b η : ℝ} (hη : 0<η) (ht : (τ.map e).re≤1-η) + (hY : ‖τ.map Y‖≤b) (heY : ‖τ.map (e*Y)‖≤b) : + ‖(τ.map (1-e))⁻¹*τ.map ((1-e)*Y*(1-e))‖≤2*b/η := by + have hp : IsStarProjection (1-e) := he.one_sub + have hr : τ.map (1-e)=((1-(τ.map e).re:ℝ):ℂ) := by + rw [map_sub,τ.normalized] + have hre : τ.map e=((τ.map e).re:ℂ) := by + apply Complex.ext + · rfl + · exact (Complex.nonneg_iff.mp (trace_projection_nonneg τ he)).2.symm + rw [hre] + push_cast + rfl + have htpos : 0<1-(τ.map e).re := by linarith + have hc : τ.map ((1-e)*Y*(1-e))=τ.map Y-τ.map (e*Y) := by + rw [τ.tracial ((1-e)*Y) (1-e),← mul_assoc,hp.isIdempotentElem.eq,sub_mul,one_mul,map_sub] + rw [hr,hc,norm_mul,norm_inv,Complex.norm_real,Real.norm_eq_abs,abs_of_pos htpos] + have heB : 0≤2*b := by linarith [norm_nonneg (τ.map Y)] + have hnum : ‖τ.map Y-τ.map (e*Y)‖≤2*b := (norm_sub_le _ _).trans (by linarith) + calc + _ ≤ (1-(τ.map e).re)⁻¹*(2*b) := mul_le_mul_of_nonneg_left hnum (inv_nonneg.mpr htpos.le) + _ ≤ η⁻¹*(2*b) := mul_le_mul_of_nonneg_right (inv_anti₀ hη (by linarith)) heB + _ = _ := by ring + +theorem gap_trace_small (v : PartialUnitary (ConcreteAlgebra M)) + (k l : ℤ) (Y Z : ConcreteAlgebra M) (c : ℂ) {a b : ℝ} + (ha : 0≤a) (hb : ‖c‖≤b) (hZ : ‖Z‖≤1) + (hcomp : (traceNorm τ (v.support*Y*v.support-c • v.support))^2≤a*(τ.map v.support).re) : + ‖τ.map (v.power k*Y*v.power l*Z)‖≤(Real.sqrt a+b)*(τ.map v.support).re := by + let q := traceNorm τ v.support + let e := traceNorm τ (v.support*Y*v.support-c • v.support) + have hq : 0≤q := traceNorm_nonneg τ _ + have he : 0≤e := traceNorm_nonneg τ _ + have hsq : q^2=(τ.map v.support).re := traceNorm_projection_sq τ v.projection + have hs : (Real.sqrt a)^2=a := Real.sq_sqrt ha + have hsn := Real.sqrt_nonneg a + have herr : e≤Real.sqrt a*q := by + change e^2≤a*(τ.map v.support).re at hcomp + rw [← hsq] at hcomp + have hn := mul_nonneg hsn hq + nlinarith [sq_nonneg (e-Real.sqrt a*q)] + have hbound := gap_trace_bound τ v k l Y Z c + change _≤(e+‖c‖*q)*q*‖Z‖ at hbound + calc + _ ≤ (e+‖c‖*q)*q*1 := hbound.trans (mul_le_mul_of_nonneg_left hZ + (mul_nonneg (add_nonneg he (mul_nonneg (norm_nonneg _) hq)) hq)) + _ ≤ (Real.sqrt a*q+b*q)*q := by + rw [mul_one] + exact mul_le_mul_of_nonneg_right (add_le_add herr (mul_le_mul_of_nonneg_right hb hq)) hq + _ = (Real.sqrt a+b)*(τ.map v.support).re := by rw [← hsq]; ring + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingExpansion.lean b/lean/OAI/Analysis/FreeWords/PatchingExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..c52041be35839896cfdac46fcc352406845d48e7 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingExpansion.lean @@ -0,0 +1,77 @@ +import Mathlib +import OAI.Analysis.FreeWords.ColoredExpansion +import OAI.Analysis.FreeWords.PartialUnitaryNorm +import OAI.Analysis.FreeWords.PatchingGapWords + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +theorem norm_list_sum_le_length_mul {ι : Type*} (s : List ι) (f : ι → ℂ) {b : ℝ} + (hf : ∀ i∈s, ‖f i‖≤b) : ‖(s.map f).sum‖≤ s.length*b := by + induction s with + | nil => simp + | cons a s ih => + simp only [List.map_cons,List.sum_cons,List.length_cons,Nat.cast_add,Nat.cast_one] + calc + _ ≤ ‖f a‖+‖(s.map f).sum‖ := norm_add_le _ _ + _ ≤ b+s.length*b := add_le_add (hf a List.mem_cons_self) + (ih fun i hi => hf i (List.mem_cons_of_mem _ hi)) + _ = _ := by ring + +theorem expanded_value (w : PatchingWord (ConcreteAlgebra M)) + (u v : ℤ → ConcreteAlgebra M) : + w.value (fun k => u k+v k)=w.value u+ + ((Colored.changes w.raw).map (fun c => Colored.value u v c*w.right)).sum := by + rw [PatchingWord.value_raw,PatchingWord.tailValue,Colored.expansion,add_mul] + rw [List.sum_map_mul_right] + rfl + +theorem expanded_trace_bound (w : PatchingWord (ConcreteAlgebra M)) + (u v : ℤ → ConcreteAlgebra M) {b : ℝ} (hb : 0≤b) + (hterms : ∀ c∈Colored.changes w.raw, ‖τ.map (Colored.value u v c*w.right)‖≤b) : + ‖τ.map (w.value (fun k => u k+v k))‖≤‖τ.map (w.value u)‖+2^w.length*b := by + rw [expanded_value,map_add,map_list_sum,List.map_map] + have he := Colored.changes_length w.raw + have hlen : (Colored.changes w.raw).length≤2^w.length := by + rw [PatchingWord.raw_length] at he + omega + calc + _ ≤ ‖τ.map (w.value u)‖+ + ‖((Colored.changes w.raw).map (fun c => τ.map (Colored.value u v c*w.right))).sum‖ := norm_add_le _ _ + _ ≤ ‖τ.map (w.value u)‖+(Colored.changes w.raw).length*b := + add_le_add le_rfl (norm_list_sum_le_length_mul _ _ hterms) + _ ≤ ‖τ.map (w.value u)‖+2^w.length*b := add_le_add le_rfl + (mul_le_mul_of_nonneg_right (by exact_mod_cast hlen) hb) + +theorem norm_colored_value_le_one (v w : PartialUnitary (ConcreteAlgebra M)) + (c : List (Colored.Cell (ConcreteAlgebra M))) + (hc : ∀ z∈c, ‖z.1.1‖≤1) : ‖Colored.value v.power w.power c‖≤1 := by + induction c with + | nil => exact PatchingWord.concrete_norm_one_le + | cons z c ih => + rw [Colored.value_cons] + have hk : ‖(if z.2 then w.power z.1.2 else v.power z.1.2)‖≤1 := by + split <;> exact PartialUnitary.norm_power_le_one _ _ + have hz : ‖z.1.1*(if z.2 then w.power z.1.2 else v.power z.1.2)‖≤1 := by + simpa only [one_mul] using (norm_mul_le _ _).trans + (mul_le_mul (hc z List.mem_cons_self) hk (norm_nonneg _) zero_le_one) + simpa only [one_mul] using (norm_mul_le _ _).trans + (mul_le_mul hz (ih fun a ha => hc a (List.mem_cons_of_mem _ ha)) (norm_nonneg _) zero_le_one) + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingExtension.lean b/lean/OAI/Analysis/FreeWords/PatchingExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..d429a4cfd94a61b0a3342c78644a4cfbf67b93db --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingExtension.lean @@ -0,0 +1,124 @@ +import Mathlib +import OAI.Analysis.FreeWords.LocalPatch +import OAI.Analysis.FreeWords.PatchingBudget +import OAI.Analysis.FreeWords.PatchingMaximal +import OAI.Analysis.FreeWords.PatchingTermBound + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +theorem patching_extension + (hF : IsFactor M) (hD : IsDiffuse M) + {X : Set (ConcreteAlgebra M)} {K : Set ℤ} {N : ℕ} + (hXfin : X.Finite) (hKfin : K.Finite) + (hXnorm : ∀ x∈X, ‖x‖≤1) (hXcenter : ∀ x∈X, τ.map x=0) + (hKzero : ∀ k∈K, k≠0) (hK1 : 1∈K) (hKm1 : -1∈K) + {δ C η : ℝ} (hδ : 0<δ) (hC : 0≤C) (hη : 0<η) + (hdom : (2:ℝ)^N*(2/η+1)≤C) + (v : PartialUnitary (ConcreteAlgebra M)) + (ht : (τ.map v.support).re<1-η) + (hv : ∀ a, PatchingWord.Admissible X K N a → + ‖τ.map (a.value v.power)‖≤patchingBudget δ C (τ.map v.support).re) : + ∃ v' : PartialUnitary (ConcreteAlgebra M), v i.split.gap v.power) + (fun i:PatchingTerms W => i.split.coefficient v.power i.1.val.right) + (fun i:PatchingTerms W => i.split.exponent) + (fun i => i.exponent_ne_zero hKzero (fun _ h => h)) ε hε + have hq0 : 0<(τ.map w.support).re := trace_projection_pos τ w.projection hw0 + have horth : v.support*w.support=0 := by + have hright : w.support*v.support=0 := by + change w.support*(1-v.support)=w.support at hwp + rw [mul_sub,mul_one] at hwp + exact sub_eq_self.mp hwp + have hh := congrArg star hright + simpa only [star_mul,v.projection.isSelfAdjoint.star_eq, + w.projection.isSelfAdjoint.star_eq,star_zero] using hh + let v' := v.sum w horth + have hts : (τ.map v'.support).re=t+(τ.map w.support).re := by + change (τ.map (v.support+w.support)).re=_ + rw [map_add,Complex.add_re] + have hlt : v h) v hb hv + have hscalar : ‖scalar‖≤2*b/η := + corner_scalar_bound τ v.support (i.split.gap v.power) v.projection hη ht.le hgap.1 hgap.2 + have hcompress : (traceNorm τ (w.support*i.split.gap v.power*w.support-scalar • w.support))^2 + ≤a*(τ.map w.support).re := by + have hi := (Finset.single_le_sum (fun j _ => sq_nonneg (traceNorm τ + (w.support*j.split.gap v.power*w.support- + ((τ.map p)⁻¹*τ.map (p*j.split.gap v.power*p)) • w.support))) (Finset.mem_univ i)).trans hcomp.le + exact hi.trans (mul_le_mul_of_nonneg_right (min_le_left _ _) hq0.le) + have hweak' : ‖τ.map (w.power i.split.exponent*i.split.coefficient v.power i.1.val.right)‖≤ + a*(τ.map w.support).re := (hweak i).le.trans + (mul_le_mul_of_nonneg_right (min_le_left _ _) hq0.le) + have hnorm := norm_raw_coefficients hXnorm hA + have hi := patching_term_bound τ v w i ha.le (by positivity) scalar hscalar hnorm.1 hnorm.2 hcompress hweak' + exact hi.trans (mul_le_mul_of_nonneg_right (by linarith) hq0.le) + have hB0 : 0≤(2*b/η+δ)*(τ.map w.support).re := by positivity + have hbound := expanded_trace_bound τ A v.power w.power hB0 hterms + have hpown : (2:ℝ)^A.length≤2^N := pow_le_pow_right₀ (by norm_num) hA.2.2.2.2 + have hbig : ‖τ.map (A.value v'.power)‖≤b+2^N*(2*b/η+δ)*(τ.map w.support).re := by + calc + _ ≤ ‖τ.map (A.value v.power)‖+2^A.length*((2*b/η+δ)*(τ.map w.support).re) := hbound + _ ≤ b+2^N*((2*b/η+δ)*(τ.map w.support).re) := + add_le_add (hv A hA) (mul_le_mul_of_nonneg_right hpown hB0) + _ = _ := by ring + rw [hts] + exact hbig.trans (patchingBudget_increment hδ.le (by positivity) hη hC hdom ht0 hq0.le) + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingFill.lean b/lean/OAI/Analysis/FreeWords/PatchingFill.lean new file mode 100644 index 0000000000000000000000000000000000000000..720ee3ac281d6aa5618b2f7840f154dfc8a6b3dc --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingFill.lean @@ -0,0 +1,106 @@ +import Mathlib +import OAI.Analysis.FreeWords.ColoredSplit +import OAI.Analysis.FreeWords.PatchTraceBounds +import OAI.Analysis.FreeWords.PatchingTermTrace + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +theorem trace_colored_first (v w : PartialUnitary (ConcreteAlgebra M)) + (p : List (ConcreteAlgebra M × ℤ)) (z : ConcreteAlgebra M × ℤ) + (r : List (Colored.Cell (ConcreteAlgebra M))) (right : ConcreteAlgebra M) : + τ.map (Colored.value v.power w.power (Colored.old p++(z,true)::r)*right)= + τ.map (w.power z.2*(Colored.value v.power w.power r*right*PatchingWord.tailValue v.power p*z.1)) := by + simp only [Colored.value_append,Colored.value_cons,ite_true,Colored.value_old] + change τ.map ((PatchingWord.tailValue v.power p*(z.1*w.power z.2*Colored.value v.power w.power r))*right)=_ + rw [show (PatchingWord.tailValue v.power p*(z.1*w.power z.2*Colored.value v.power w.power r))*right= + (PatchingWord.tailValue v.power p*z.1)*(w.power z.2*(Colored.value v.power w.power r*right)) by noncomm_ring] + rw [τ.tracial] + congr 1 + +theorem trace_changed_le (v w : PartialUnitary (ConcreteAlgebra M)) + (A : PatchingWord (ConcreteAlgebra M)) (c : List (Colored.Cell (ConcreteAlgebra M))) + (hc : c∈Colored.changes A.raw) + (hnorm : ∀ z∈A.raw, ‖z.1‖≤1) (hright : ‖A.right‖≤1) : + ‖τ.map (Colored.value v.power w.power c*A.right)‖≤(τ.map w.support).re := by + have hall : ∀ z∈c, ‖z.1.1‖≤1 := by + intro z hz + apply hnorm z.1 + rw [← Colored.erase_of_mem_changes hc] + exact List.mem_map_of_mem hz + obtain ⟨p,z,r,he⟩ := Colored.first_true_split c (Colored.true_of_mem_changes hc) + rw [he,trace_colored_first] + have hall' := he ▸ hall + have hz : ‖z.1‖≤1 := hall' (z,true) (List.mem_append_right _ List.mem_cons_self) + have hp : ‖PatchingWord.tailValue v.power p‖≤1 := by + have hh := norm_colored_value_le_one v w (Colored.old p) + (fun a ha => hall' a (List.mem_append_left _ ha)) + simpa only [Colored.value_old,PatchingWord.tailValue] using hh + have hr : ‖Colored.value v.power w.power r‖≤1 := by + apply norm_colored_value_le_one v w r + intro a ha + exact hall' a (List.mem_append_right _ (List.mem_cons_of_mem _ ha)) + let Z := Colored.value v.power w.power r*A.right*PatchingWord.tailValue v.power p*z.1 + have hZ : ‖Z‖≤1 := norm_mul_le_one (norm_mul_le_one (norm_mul_le_one hr hright) hp) hz + have hA : w.support*(w.power z.2*Z)=w.power z.2*Z := by rw [← mul_assoc,w.support_mul] + have hb := trace_supported_le τ w.support (w.power z.2*Z) w.projection hA + rw [traceNorm_projection_sq τ w.projection] at hb + have ht : 0≤(τ.map w.support).re := by + rw [← traceNorm_projection_sq τ w.projection]; exact sq_nonneg _ + exact hb.trans ((mul_le_mul_of_nonneg_left (norm_mul_le_one (w.norm_power_le_one _) hZ) ht).trans_eq (mul_one _)) + +def projectionUnitary (p : ConcreteAlgebra M) (hp : IsStarProjection p) : PartialUnitary (ConcreteAlgebra M) where + power _ := p + add _ _ := hp.isIdempotentElem.eq.symm + power_star _ := hp.isSelfAdjoint.star_eq + +theorem fill_partial_bound (v : PartialUnitary (ConcreteAlgebra M)) + {X : Set (ConcreteAlgebra M)} {K : Set ℤ} {N : ℕ} + (hX : ∀ x∈X, ‖x‖≤1) {b η : ℝ} + (ht : (τ.map v.support).re=1-η) + (hv : ∀ A, PatchingWord.Admissible X K N A → ‖τ.map (A.value v.power)‖≤b) : + ∃ u : unitary (ConcreteAlgebra M), ∀ A, PatchingWord.Admissible X K N A → + ‖τ.map (A.value (fun k => (u^k).val))‖≤b+2^N*η := by + let w := projectionUnitary (1-v.support) v.projection.one_sub + have ho : v.support*w.support=0 := by + change v.support*(1-v.support)=0 + rw [mul_sub,mul_one,v.projection.isIdempotentElem.eq,sub_self] + let z := v.sum w ho + have hz : z.support=1 := by + change v.support+(1-v.support)=1 + abel + have htrace : (τ.map w.support).re=η := by + change (τ.map (1-v.support)).re=η + rw [map_sub,τ.normalized,Complex.sub_re,Complex.one_re,ht] + ring + have hη : 0≤η := by + rw [← htrace,← traceNorm_projection_sq τ w.projection] + exact sq_nonneg _ + refine ⟨z.toUnitary hz,fun A hA => ?_⟩ + simp only [z.toUnitary_power] + have hnorm := norm_raw_coefficients hX hA + have hterms : ∀ c∈Colored.changes A.raw, + ‖τ.map (Colored.value v.power w.power c*A.right)‖≤η := by + intro c hc + simpa only [htrace] using trace_changed_le τ v w A c hc hnorm.1 hnorm.2 + have hb := expanded_trace_bound τ A v.power w.power hη hterms + have hpow : (2:ℝ)^A.length≤2^N := pow_le_pow_right₀ (by norm_num) hA.2.2.2.2 + exact hb.trans (add_le_add (hv A hA) (mul_le_mul_of_nonneg_right hpow hη)) + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingGapWords.lean b/lean/OAI/Analysis/FreeWords/PatchingGapWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..12a34123052d230c2a856cc9ddb0eadd28009dd9 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingGapWords.lean @@ -0,0 +1,111 @@ +import Mathlib +import OAI.Analysis.FreeWords.PatchingWordFamilies + +namespace OAI + +noncomputable section + +namespace KKLocalPatching.PatchingWord + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +noncomputable section + +variable {A : Type*} [Ring A] + +def raw (w : PatchingWord A) : List (A × ℤ) := (w.left,w.first)::w.middle + +omit [Ring A] in +@[simp] theorem raw_length (w : PatchingWord A) : w.raw.length=w.length := by + simp only [raw,List.length_cons,length,Nat.add_comm] + +theorem value_raw (w : PatchingWord A) (u : ℤ → A) : w.value u=tailValue u w.raw*w.right := rfl + +omit [Ring A] in +theorem middle_of_raw_split (w : PatchingWord A) (p g r : List (A × ℤ)) (z y : A × ℤ) + (he : w.raw=p++z::(g++y::r)) : + (∀ a∈g, a∈w.middle) ∧ y∈w.middle ∧ g.length+2≤w.length := by + have hlen := congrArg List.length he + rw [raw_length] at hlen + simp only [List.length_append,List.length_cons] at hlen + have hglen : g.length+2≤w.length := by omega + refine ⟨?_,?_,hglen⟩ + · cases p with + | nil => + have h := (List.cons.inj he).2 + rw [h] + intro a ha + exact List.mem_append_left _ ha + | cons b p => + have h := (List.cons.inj he).2 + rw [h] + intro a ha + exact List.mem_append_right _ (List.mem_cons_of_mem _ (List.mem_append_left _ ha)) + · cases p with + | nil => + have h := (List.cons.inj he).2 + rw [h] + exact List.mem_append_right _ List.mem_cons_self + | cons b p => + have h := (List.cons.inj he).2 + rw [h] + exact List.mem_append_right _ (List.mem_cons_of_mem _ (List.mem_append_right _ List.mem_cons_self)) + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +theorem gap_and_endpoint_bounds {X : Set (ConcreteAlgebra M)} {K : Set ℤ} {N : ℕ} + (hX : ∀ x∈X, τ.map x=0) (hK1 : 1∈K) (hKm1 : -1∈K) + (v : PartialUnitary (ConcreteAlgebra M)) {b : ℝ} (hb : 0≤b) + (hv : ∀ a, Admissible X K N a → ‖τ.map (a.value v.power)‖≤b) + {w : PatchingWord (ConcreteAlgebra M)} (hw : Admissible X K N w) + (p g r : List (ConcreteAlgebra M × ℤ)) (z y : ConcreteAlgebra M × ℤ) + (he : w.raw=p++z::(g++y::r)) : + ‖τ.map (tailValue v.power g*y.1)‖≤b ∧ + ‖τ.map (v.support*(tailValue v.power g*y.1))‖≤b := by + obtain ⟨hg,hy,hlen⟩ := middle_of_raw_split w p g r z y he + have hgX : ∀ a∈g, a.1∈X ∧ a.2∈K := fun a ha => hw.2.2.2.1 a (hg a ha) + have hyX := (hw.2.2.2.1 y hy).1 + constructor + · cases g with + | nil => simpa only [tailValue_nil,one_mul,hX y.1 hyX,norm_zero] using hb + | cons a s => + let W : PatchingWord (ConcreteAlgebra M) := ⟨a.1,a.2,s,y.1⟩ + have hW : Admissible X K N W := by + refine ⟨Set.mem_insert_of_mem _ (hgX a List.mem_cons_self).1, + (hgX a List.mem_cons_self).2,Set.mem_insert_of_mem _ hyX,?_,?_⟩ + · intro d hd + exact hgX d (List.mem_cons_of_mem _ hd) + · change 1+s.length≤N + have hn := hlen.trans hw.2.2.2.2 + simp only [List.length_cons] at hn + omega + simpa only [W,value,tailValue_cons] using hv W hW + · let W : PatchingWord (ConcreteAlgebra M) := ⟨1,1,g++[(y.1,-1)],1⟩ + have hW : Admissible X K N W := by + refine ⟨Set.mem_insert _ _,hK1,Set.mem_insert _ _,?_,?_⟩ + · intro a ha + rcases List.mem_append.mp ha with ha | ha + · exact hgX a ha + · have he : a=(y.1,-1) := List.mem_singleton.mp ha + simpa only [he] using And.intro hyX hKm1 + · change 1+(g++[(y.1,-1)]).length≤N + simp only [List.length_append,List.length_cons,List.length_nil] + have hn := hlen.trans hw.2.2.2.2 + omega + have htrace : τ.map (W.value v.power)=τ.map (v.support*(tailValue v.power g*y.1)) := by + simp only [W,value,tailValue_append,tailValue_cons,tailValue_nil,mul_one,one_mul] + rw [show v.power 1*(tailValue v.power g*(y.1*v.power (-1)))= + (v.power 1*(tailValue v.power g*y.1))*v.power (-1) by noncomm_ring] + rw [τ.tracial,← mul_assoc,← v.add] + norm_num + rfl + simpa only [htrace] using hv W hW + +end + +end KKLocalPatching.PatchingWord +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingMaximal.lean b/lean/OAI/Analysis/FreeWords/PatchingMaximal.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e177906aac563934cf129b2c91c3c1c8df41099 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingMaximal.lean @@ -0,0 +1,55 @@ +import Mathlib +import OAI.Analysis.FreeWords.PartialUnitaryChain +import OAI.Analysis.FreeWords.PartialWords + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +variable (W : Set (PatchingWord (ConcreteAlgebra M))) (B : ℝ → ℝ) (T : ℝ) + +def PatchingBounds (v : PartialUnitary (ConcreteAlgebra M)) : Prop := + (τ.map v.support).re ≤ T ∧ ∀ w∈W, ‖τ.map (w.value v.power)‖≤B (τ.map v.support).re + +theorem maximal_patching_bounds (hB : Continuous B) (hB0 : 0≤B 0) (hT : 0≤T) : + ∃ v : PartialUnitary (ConcreteAlgebra M), Maximal (PatchingBounds τ W B T) v := by + classical + apply zorn_le₀ {v | PatchingBounds τ W B T v} + intro c hc hchain + rcases c.eq_empty_or_nonempty with rfl | hne + · refine ⟨PartialUnitary.zero,?_,by simp⟩ + constructor + · simpa only [PartialUnitary.zero,PartialUnitary.support,map_zero,Complex.zero_re] using hT + · intro w hw + simpa only [PartialUnitary.zero,PatchingWord.value_zero,map_zero,norm_zero, + PartialUnitary.support,Complex.zero_re] using hB0 + · let : Nonempty c := hne.to_subtype + let : LinearOrder c := hchain.lt_of_le.linearOrder + obtain ⟨v,hv,hlim⟩ := PartialUnitary.directed_limit τ (fun i:c => i.val) (fun _ _ h => h) + have ht : Tendsto (fun i:c => (τ.map i.val.support).re) atTop (𝓝 (τ.map v.support).re) := + Complex.continuous_re.continuousAt.tendsto.comp (tendsto_gns_trace τ (hlim 0)) + refine ⟨v,⟨?_,?_⟩,fun z hz => hv ⟨z,hz⟩⟩ + · exact le_of_tendsto ht (Eventually.of_forall (fun i:c => (hc i.property).1)) + · intro w hw + exact le_of_tendsto_of_tendsto (PatchingWord.tendsto_value τ hlim w).norm + (hB.continuousAt.tendsto.comp ht) + (Eventually.of_forall (fun i:c => (hc i.property).2 w hw)) + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingNearFull.lean b/lean/OAI/Analysis/FreeWords/PatchingNearFull.lean new file mode 100644 index 0000000000000000000000000000000000000000..07ac33344374cba753e2fb0638eece6793adb082 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingNearFull.lean @@ -0,0 +1,46 @@ +import Mathlib +import OAI.Analysis.FreeWords.PatchingExtension +import OAI.Analysis.FreeWords.PatchingFill + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +theorem unitary_admissible_bound + (hF : IsFactor M) (hD : IsDiffuse M) + {X : Set (ConcreteAlgebra M)} {K : Set ℤ} {N : ℕ} + (hXfin : X.Finite) (hKfin : K.Finite) + (hXnorm : ∀ x∈X, ‖x‖≤1) (hXcenter : ∀ x∈X, τ.map x=0) + (hKzero : ∀ k∈K, k≠0) (hK1 : 1∈K) (hKm1 : -1∈K) + {δ C η : ℝ} (hδ : 0<δ) (hC : 0≤C) (hη : 0<η) (hη1 : η≤1) + (hdom : (2:ℝ)^N*(2/η+1)≤C) : + ∃ u : unitary (ConcreteAlgebra M), ∀ A, PatchingWord.Admissible X K N A → + ‖τ.map (A.value (fun k => (u^k).val))‖≤patchingBudget δ C (1-η)+2^N*η := by + obtain ⟨v,hv⟩ := maximal_patching_bounds τ {a | PatchingWord.Admissible X K N a} + (patchingBudget δ C) (1-η) (continuous_patchingBudget δ C) + (by rw [patchingBudget_zero]) (sub_nonneg.mpr hη1) + have ht : (τ.map v.support).re=1-η := by + apply le_antisymm hv.1.1 + by_contra h + have hstrict : (τ.map v.support).re<1-η := lt_of_not_ge h + obtain ⟨v',hvv',hv'⟩ := patching_extension τ hF hD hXfin hKfin hXnorm hXcenter + hKzero hK1 hKm1 hδ hC hη hdom v hstrict hv.1.2 + exact (not_le_of_gt hvv') (hv.2 hv' hvv'.le) + exact fill_partial_bound τ v hXnorm ht (fun A hA => ht ▸ hv.1.2 A hA) + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingSmall.lean b/lean/OAI/Analysis/FreeWords/PatchingSmall.lean new file mode 100644 index 0000000000000000000000000000000000000000..22caf31a8ec417462b088100841fbf1e10d46878 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingSmall.lean @@ -0,0 +1,60 @@ +import Mathlib +import OAI.Analysis.FreeWords.PatchingNearFull + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +theorem unitary_admissible_small + (hF : IsFactor M) (hD : IsDiffuse M) + {X : Set (ConcreteAlgebra M)} {K : Set ℤ} {N : ℕ} + (hXfin : X.Finite) (hKfin : K.Finite) + (hXnorm : ∀ x∈X, ‖x‖≤1) (hXcenter : ∀ x∈X, τ.map x=0) + (hKzero : ∀ k∈K, k≠0) (hK1 : 1∈K) (hKm1 : -1∈K) + (ε : ℝ) (hε : 0<ε) : + ∃ u : unitary (ConcreteAlgebra M), ∀ A, PatchingWord.Admissible X K N A → + ‖τ.map (A.value (fun k => (u^k).val))‖<ε := by + let D : ℝ := 2^N + have hD0 : 0 ?_⟩ + have hb := hu A hA + change _≤patchingBudget δ C (1-η)+D*η at hb + linarith + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingTermBound.lean b/lean/OAI/Analysis/FreeWords/PatchingTermBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb2055b3189488b7e6274c9ab9d05dd379486aac --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingTermBound.lean @@ -0,0 +1,58 @@ +import Mathlib +import OAI.Analysis.FreeWords.PatchingCornerBounds +import OAI.Analysis.FreeWords.PatchingTermTrace +import OAI.Analysis.FreeWords.PatchingTerms + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +theorem patching_term_bound {W : Set (PatchingWord (ConcreteAlgebra M))} + (v w : PartialUnitary (ConcreteAlgebra M)) (t : PatchingTerms W) + {a β : ℝ} (ha : 0≤a) (hβ : 0≤β) (c : ℂ) + (hc : ‖c‖≤β) + (hnorm : ∀ z∈t.1.val.raw, ‖z.1‖≤1) (hright : ‖t.1.val.right‖≤1) + (hcomp : (traceNorm τ (w.support*t.split.gap v.power*w.support-c • w.support))^2≤a*(τ.map w.support).re) + (hweak : ‖τ.map (w.power t.split.exponent*t.split.coefficient v.power t.1.val.right)‖≤a*(τ.map w.support).re) : + ‖τ.map (Colored.value v.power w.power t.2.val*t.1.val.right)‖≤ + (β+Real.sqrt a+a)*(τ.map w.support).re := by + have htq : 0≤(τ.map w.support).re := by + rw [← traceNorm_projection_sq τ w.projection] + exact sq_nonneg _ + have hall : ∀ z∈t.2.val, ‖z.1.1‖≤1 := by + intro z hz + apply hnorm z.1 + rw [← Colored.erase_of_mem_changes t.2.property] + exact List.mem_map_of_mem hz + cases he : t.split with + | single p z s h => + rw [he] at hweak + rw [h,trace_colored_single] + have hh : ‖τ.map (w.power z.2*(PatchingWord.tailValue v.power s*t.1.val.right* + PatchingWord.tailValue v.power p*z.1))‖≤a*(τ.map w.support).re := hweak + exact hh.trans (mul_le_mul_of_nonneg_right (by linarith [Real.sqrt_nonneg a]) htq) + | multiple p z g y r h => + rw [he] at hcomp + rw [h,trace_colored_multiple] + have hrest := norm_colored_multiple_rest v w p g z y r t.1.val.right (h ▸ hall) hright + have hh := gap_trace_small τ w z.2 y.2 (PatchingWord.tailValue v.power g*y.1) + (Colored.value v.power w.power r*t.1.val.right*PatchingWord.tailValue v.power p*z.1) + c ha hc hrest hcomp + exact hh.trans (mul_le_mul_of_nonneg_right (by linarith) htq) + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingTermTrace.lean b/lean/OAI/Analysis/FreeWords/PatchingTermTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4077ef8ffe4ba2dc196d644c0ef2553ea853c63 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingTermTrace.lean @@ -0,0 +1,86 @@ +import Mathlib +import OAI.Analysis.FreeWords.PatchingExpansion + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +theorem trace_colored_single (v w : PartialUnitary (ConcreteAlgebra M)) + (p s : List (ConcreteAlgebra M × ℤ)) (z : ConcreteAlgebra M × ℤ) (right : ConcreteAlgebra M) : + τ.map (Colored.value v.power w.power (Colored.old p++(z,true)::Colored.old s)*right)= + τ.map (w.power z.2*(PatchingWord.tailValue v.power s*right*PatchingWord.tailValue v.power p*z.1)) := by + simp only [Colored.value_append,Colored.value_cons,ite_true,Colored.value_old] + change τ.map ((PatchingWord.tailValue v.power p*(z.1*w.power z.2*PatchingWord.tailValue v.power s))*right)=_ + rw [show (PatchingWord.tailValue v.power p*(z.1*w.power z.2*PatchingWord.tailValue v.power s))*right= + (PatchingWord.tailValue v.power p*z.1)*(w.power z.2*(PatchingWord.tailValue v.power s*right)) by noncomm_ring] + rw [τ.tracial] + congr 1 + +theorem trace_colored_multiple (v w : PartialUnitary (ConcreteAlgebra M)) + (p g : List (ConcreteAlgebra M × ℤ)) (z y : ConcreteAlgebra M × ℤ) + (r : List (Colored.Cell (ConcreteAlgebra M))) (right : ConcreteAlgebra M) : + τ.map (Colored.value v.power w.power (Colored.old p++(z,true)::(Colored.old g++(y,true)::r))*right)= + τ.map (w.power z.2*(PatchingWord.tailValue v.power g*y.1)*w.power y.2* + (Colored.value v.power w.power r*right*PatchingWord.tailValue v.power p*z.1)) := by + simp only [Colored.value_append,Colored.value_cons,ite_true,Colored.value_old] + change τ.map ((PatchingWord.tailValue v.power p* + (z.1*w.power z.2*(PatchingWord.tailValue v.power g*(y.1*w.power y.2*Colored.value v.power w.power r))))*right)=_ + rw [show (PatchingWord.tailValue v.power p* + (z.1*w.power z.2*(PatchingWord.tailValue v.power g*(y.1*w.power y.2*Colored.value v.power w.power r))))*right= + (PatchingWord.tailValue v.power p*z.1)* + (w.power z.2*(PatchingWord.tailValue v.power g*y.1)*w.power y.2*Colored.value v.power w.power r*right) by noncomm_ring] + rw [τ.tracial] + congr 1 + +theorem norm_mul_le_one {a b : ConcreteAlgebra M} (ha : ‖a‖≤1) (hb : ‖b‖≤1) : ‖a*b‖≤1 := by + simpa only [one_mul] using (norm_mul_le a b).trans (mul_le_mul ha hb (norm_nonneg _) zero_le_one) + +theorem norm_raw_coefficients {X : Set (ConcreteAlgebra M)} {K : Set ℤ} {N : ℕ} + (hX : ∀ x∈X, ‖x‖≤1) {w : PatchingWord (ConcreteAlgebra M)} + (hw : PatchingWord.Admissible X K N w) : + (∀ z∈w.raw, ‖z.1‖≤1) ∧ ‖w.right‖≤1 := by + have hE : ∀ x∈insert (1:ConcreteAlgebra M) X, ‖x‖≤1 := by + intro x hx + rcases hx with rfl | hx + · exact PatchingWord.concrete_norm_one_le + · exact hX x hx + refine ⟨?_,hE _ hw.2.2.1⟩ + intro z hz + rcases List.mem_cons.mp hz with rfl | hz + · exact hE _ hw.1 + · exact hX _ (hw.2.2.2.1 z hz).1 + +theorem norm_colored_multiple_rest (v w : PartialUnitary (ConcreteAlgebra M)) + (p g : List (ConcreteAlgebra M × ℤ)) (z y : ConcreteAlgebra M × ℤ) + (r : List (Colored.Cell (ConcreteAlgebra M))) (right : ConcreteAlgebra M) + (h : ∀ a∈Colored.old p++(z,true)::(Colored.old g++(y,true)::r), ‖a.1.1‖≤1) + (hright : ‖right‖≤1) : + ‖Colored.value v.power w.power r*right*PatchingWord.tailValue v.power p*z.1‖≤1 := by + have hz : ‖z.1‖≤1 := h (z,true) (List.mem_append_right _ List.mem_cons_self) + have hp : ‖PatchingWord.tailValue v.power p‖≤1 := by + have hh := norm_colored_value_le_one v w (Colored.old p) + (fun a ha => h a (List.mem_append_left _ ha)) + simpa only [Colored.value_old,PatchingWord.tailValue] using hh + have hr : ‖Colored.value v.power w.power r‖≤1 := by + apply norm_colored_value_le_one v w r + intro a ha + exact h a (List.mem_append_right _ (List.mem_cons_of_mem _ + (List.mem_append_right _ (List.mem_cons_of_mem _ ha)))) + exact norm_mul_le_one (norm_mul_le_one (norm_mul_le_one hr hright) hp) hz + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingTerms.lean b/lean/OAI/Analysis/FreeWords/PatchingTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..71e36be93496713c92318f16d4616d80e52250cb --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingTerms.lean @@ -0,0 +1,73 @@ +import Mathlib +import OAI.Analysis.FreeWords.ColoredSplit +import OAI.Analysis.FreeWords.PatchingGapWords + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} + +abbrev PatchingTerms (W : Set (PatchingWord (ConcreteAlgebra M))) := + Σ w : W, {c : List (Colored.Cell (ConcreteAlgebra M)) // c∈Colored.changes w.val.raw} + +instance termsFintype (W : Set (PatchingWord (ConcreteAlgebra M))) [Fintype W] : Fintype (PatchingTerms W) := by + letI (w:W) : Fintype {c : List (Colored.Cell (ConcreteAlgebra M)) // c∈Colored.changes w.val.raw} := + (List.finite_toSet _).fintype + infer_instance + +namespace PatchingTerms + +variable {W : Set (PatchingWord (ConcreteAlgebra M))} + +def split (t : PatchingTerms W) : Colored.Split t.2.val := Colored.split t.2.property + +theorem exponent_ne_zero {X : Set (ConcreteAlgebra M)} {K : Set ℤ} {N : ℕ} + (hK : ∀ k∈K, k≠0) (hW : ∀ w∈W, PatchingWord.Admissible X K N w) + (t : PatchingTerms W) : t.split.exponent≠0 := by + cases he : t.split with + | single p z s h => + change z.2≠0 + have hraw : t.1.val.raw=p++z::s := by + rw [← Colored.erase_of_mem_changes t.2.property,h] + simp [Colored.erase,Colored.old,List.map_map,Function.comp_def] + have hz : z∈t.1.val.raw := by rw [hraw]; exact List.mem_append_right _ List.mem_cons_self + have hw := hW t.1.val t.1.property + rcases List.mem_cons.mp hz with hz | hz + · rw [hz]; exact hK _ hw.2.1 + · exact hK _ (hw.2.2.2.1 z hz).2 + | multiple p z g y r h => exact one_ne_zero + +theorem gap_bounds (τ : FaithfulNormalTrace M) + {X : Set (ConcreteAlgebra M)} {K : Set ℤ} {N : ℕ} + (hX : ∀ x∈X, τ.map x=0) (hK1 : 1∈K) (hKm1 : -1∈K) + (hW : ∀ w∈W, PatchingWord.Admissible X K N w) + (v : PartialUnitary (ConcreteAlgebra M)) {b : ℝ} (hb : 0≤b) + (hv : ∀ a, PatchingWord.Admissible X K N a → ‖τ.map (a.value v.power)‖≤b) + (t : PatchingTerms W) : + ‖τ.map (t.split.gap v.power)‖≤b ∧ ‖τ.map (v.support*t.split.gap v.power)‖≤b := by + cases he : t.split with + | single p z s h => simpa only [Colored.Split.gap,mul_zero,map_zero,norm_zero] using And.intro hb hb + | multiple p z g y r h => + have hraw : t.1.val.raw=p++z::(g++y::Colored.erase r) := by + rw [← Colored.erase_of_mem_changes t.2.property,h] + simp [Colored.erase,Colored.old,List.map_map,Function.comp_def] + exact PatchingWord.gap_and_endpoint_bounds τ hX hK1 hKm1 v hb hv + (hW _ t.1.property) p g (Colored.erase r) z y hraw + +end PatchingTerms + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PatchingWordFamilies.lean b/lean/OAI/Analysis/FreeWords/PatchingWordFamilies.lean new file mode 100644 index 0000000000000000000000000000000000000000..d04f07fa5dd6db39eef4b9d55aebd3b17b0b6233 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PatchingWordFamilies.lean @@ -0,0 +1,101 @@ +import Mathlib +import OAI.Analysis.FreeWords.PartialWords + +namespace OAI + +noncomputable section + +namespace KKLocalPatching.PatchingWord + +noncomputable section + +open KKTraceTransfer KKFreeLiftFrontier + +variable {A : Type*} [Ring A] + +def Admissible (X : Set A) (K : Set ℤ) (N : ℕ) (w : PatchingWord A) : Prop := + w.left∈insert 1 X ∧ w.first∈K ∧ w.right∈insert 1 X ∧ + (∀ z∈w.middle, z.1∈X ∧ z.2∈K) ∧ w.length≤N + +theorem admissible_finite {X : Set A} {K : Set ℤ} (hX : X.Finite) (hK : K.Finite) (N : ℕ) : + {w | Admissible X K N w}.Finite := by + classical + let := hX.fintype + let := hK.fintype + let E : Set A := insert 1 X + let : Fintype ↥E := (hX.insert 1).fintype + let S := {l : List (↥X × ↥K) | l.length≤N} + have hS : S.Finite := List.finite_length_le _ N + let := hS.fintype + let f (a : ↥E × ↥K × ↥S × ↥E) : PatchingWord A := + ⟨a.1.val,a.2.1.val,a.2.2.1.val.map (fun z => (z.1.val,z.2.val)),a.2.2.2.val⟩ + have hfin : (Set.range f).Finite := Set.finite_range f + apply hfin.subset + intro w hw + rcases hw with ⟨hl,hk,hr,hm,hn⟩ + let l : List (↥X × ↥K) := w.middle.attach.map + (fun z => (⟨z.val.1,(hm z.val z.property).1⟩,⟨z.val.2,(hm z.val z.property).2⟩)) + have hlen : l.length≤N := by + simp only [l,List.length_map,List.length_attach] + exact (Nat.le_add_left _ _).trans hn + refine ⟨(⟨w.left,hl⟩,⟨w.first,hk⟩,⟨l,hlen⟩,⟨w.right,hr⟩),?_⟩ + have he : l.map (fun z => (z.1.val,z.2.val))=w.middle := by + simp only [l,List.map_map,Function.comp_def] + simp only [Prod.mk.eta, List.attach_map_subtype_val] + cases w + simp only [f,he] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} + +theorem norm_value_le_one (v : PartialUnitary (ConcreteAlgebra M)) + {X : Set (ConcreteAlgebra M)} {K : Set ℤ} {N : ℕ} + (hX : ∀ x∈X, ‖x‖≤1) {w : PatchingWord (ConcreteAlgebra M)} + (hw : Admissible X K N w) : ‖w.value v.power‖≤1 := by + have hE : ∀ x∈insert (1:ConcreteAlgebra M) X, ‖x‖≤1 := by + intro x hx + rcases hx with rfl | hx + · exact concrete_norm_one_le + · exact hX x hx + have htail : ∀ (s : List (ConcreteAlgebra M × ℤ)), + (∀ z∈s, ‖z.1‖≤1) → ‖tailValue v.power s‖≤1 := by + intro s + induction s with + | nil => intro _; exact concrete_norm_one_le + | cons z s ih => + intro hs + have hz : ‖z.1*v.power z.2‖≤1 := by + calc + _ ≤ ‖z.1‖*‖v.power z.2‖ := norm_mul_le _ _ + _ ≤ 1*1 := mul_le_mul (hs z List.mem_cons_self) (v.norm_power_le_one _) + (norm_nonneg _) zero_le_one + _ = 1 := one_mul 1 + have ht := ih (fun a ha => hs a (List.mem_cons_of_mem _ ha)) + calc + _ ≤ ‖z.1*v.power z.2‖*‖tailValue v.power s‖ := norm_mul_le _ _ + _ ≤ 1*1 := mul_le_mul hz ht (norm_nonneg _) zero_le_one + _ = 1 := one_mul 1 + have ht := htail w.middle (fun z hz => hX z.1 (hw.2.2.2.1 z hz).1) + have hleft : ‖w.left*v.power w.first‖≤1 := by + calc + _ ≤ ‖w.left‖*‖v.power w.first‖ := norm_mul_le _ _ + _ ≤ 1*1 := mul_le_mul (hE _ hw.1) (v.norm_power_le_one _) + (norm_nonneg _) zero_le_one + _ = 1 := one_mul 1 + have hmid : ‖w.left*v.power w.first*tailValue v.power w.middle‖≤1 := by + calc + _ ≤ ‖w.left*v.power w.first‖*‖tailValue v.power w.middle‖ := norm_mul_le _ _ + _ ≤ 1*1 := mul_le_mul hleft ht (norm_nonneg _) zero_le_one + _ = 1 := one_mul 1 + calc + _ ≤ ‖w.left*v.power w.first*tailValue v.power w.middle‖*‖w.right‖ := norm_mul_le _ _ + _ ≤ 1*1 := mul_le_mul hmid (hE _ hw.2.2.1) (norm_nonneg _) zero_le_one + _ = 1 := one_mul 1 + +end + +end KKLocalPatching.PatchingWord +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PermutationDistance.lean b/lean/OAI/Analysis/FreeWords/PermutationDistance.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b9efd2447bb0df3658643b5d3ebcf7763136599 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PermutationDistance.lean @@ -0,0 +1,99 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators + +noncomputable section + +def permutationLinear {ι : Type*} (π : Equiv.Perm ι) : (ι → ℂ) →ₗ[ℂ] (ι → ℂ) where + toFun f := f ∘ π + map_add' _ _ := rfl + map_smul' _ _ := rfl + +def permutationDistance {r : ℕ} (π σ : Equiv.Perm (Fin r)) : ℕ := + Module.finrank ℂ (LinearMap.range (permutationLinear π-permutationLinear σ)) + +def matchingSetoid {ι : Type*} (π σ : Equiv.Perm ι) : Setoid ι := + Relation.EqvGen.setoid (fun i j => ∃ k, i=π k ∧ j=σ k) + +instance matchingQuotientFintype {ι : Type*} [Fintype ι] (π σ : Equiv.Perm ι) : + Fintype (Quotient (matchingSetoid π σ)) := Fintype.ofFinite _ + +theorem matching_respects {ι β : Type*} {π σ : Equiv.Perm ι} (f : ι → β) + (hf : f ∘ π=f ∘ σ) {i j : ι} (h : matchingSetoid π σ i j) : f i=f j := by + induction h with + | rel a b hab => + obtain ⟨k,rfl,rfl⟩ := hab + exact congrFun hf k + | refl a => rfl + | symm a b h ih => exact ih.symm + | trans a b c h₁ h₂ ih₁ ih₂ => exact ih₁.trans ih₂ + +def matchingEquiv {ι β : Type*} (π σ : Equiv.Perm ι) : + {f : ι → β // f ∘ π=f ∘ σ} ≃ (Quotient (matchingSetoid π σ) → β) where + toFun f := Quotient.lift f.val (fun _ _ h => matching_respects f.val f.property h) + invFun F := ⟨fun i => F (Quotient.mk _ i),by + funext i + exact congrArg F (Quotient.sound (.rel _ _ ⟨i,rfl,rfl⟩))⟩ + left_inv _ := rfl + right_inv F := by funext q; exact Quotient.inductionOn q (fun _ => rfl) + +def matchingLinearEquiv {ι : Type*} (π σ : Equiv.Perm ι) : + LinearMap.ker (permutationLinear π-permutationLinear σ) ≃ₗ[ℂ] + (Quotient (matchingSetoid π σ) → ℂ) where + toFun f := (matchingEquiv π σ) ⟨f.val, sub_eq_zero.mp f.property⟩ + invFun F := ⟨(matchingEquiv π σ).symm F,sub_eq_zero.mpr ((matchingEquiv π σ).symm F).property⟩ + left_inv f := by apply Subtype.ext; rfl + right_inv F := (matchingEquiv π σ).apply_symm_apply F + map_add' f g := by funext q; exact Quotient.inductionOn q (fun _ => rfl) + map_smul' z f := by funext q; exact Quotient.inductionOn q (fun _ => rfl) + +theorem permutationDistance_add_classes {r : ℕ} (π σ : Equiv.Perm (Fin r)) : + permutationDistance π σ+Fintype.card (Quotient (matchingSetoid π σ))=r := by + have h := LinearMap.finrank_range_add_finrank_ker (permutationLinear π-permutationLinear σ) + rw [(matchingLinearEquiv π σ).finrank_eq,Module.finrank_pi,Module.finrank_pi,Fintype.card_fin] at h + exact h + +theorem permutationDistance_self {r : ℕ} (π : Equiv.Perm (Fin r)) : + permutationDistance π π=0 := by simp [permutationDistance] + +theorem permutationDistance_eq_zero {r : ℕ} (π σ : Equiv.Perm (Fin r)) : + permutationDistance π σ=0 ↔ π=σ := by + classical + constructor + · intro h + have he := LinearMap.range_eq_bot.mp (Submodule.finrank_eq_zero.mp h) + have hl : permutationLinear π=permutationLinear σ := sub_eq_zero.mp he + apply Equiv.ext + intro i + by_contra hn + have hv := congrArg (fun L : (Fin r → ℂ) →ₗ[ℂ] (Fin r → ℂ) => + L (fun j => if j=π i then 1 else 0) i) hl + simp [permutationLinear,Ne.symm hn] at hv + · rintro rfl; exact permutationDistance_self π + +theorem permutationDistance_symm {r : ℕ} (π σ : Equiv.Perm (Fin r)) : + permutationDistance π σ=permutationDistance σ π := by + unfold permutationDistance + rw [← neg_sub (permutationLinear σ) (permutationLinear π),LinearMap.range_neg] + +theorem permutationDistance_triangle {r : ℕ} (π σ ρ : Equiv.Perm (Fin r)) : + permutationDistance π ρ ≤ permutationDistance π σ+permutationDistance σ ρ := by + unfold permutationDistance + have he : permutationLinear π-permutationLinear ρ= + (permutationLinear π-permutationLinear σ)+(permutationLinear σ-permutationLinear ρ) := by abel + rw [he] + exact (Submodule.finrank_mono (LinearMap.range_add_le _ _)).trans + (Submodule.finrank_add_le_finrank_add_finrank _ _) + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PolarApproximation.lean b/lean/OAI/Analysis/FreeWords/PolarApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d51c0a74e40c176f953907839173d8957a86f93 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PolarApproximation.lean @@ -0,0 +1,150 @@ +import Mathlib +import OAI.Analysis.FreeWords.UnitaryExtension + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKFreeLiftFrontier + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance polarApproximationPartialOrder (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance polarApproximationPreorder (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance polarApproximationLE (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance polarApproximationStarOrderedRing (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem polar_unitary_factorization (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M) (hM : IsFactor M) (a : ConcreteAlgebra M) : + ∃ u : unitary (ConcreteAlgebra M), + (u : ConcreteAlgebra M)*cfc Real.sqrt (star a*a)=a := by + let S : ConcreteAlgebra M := cfc Real.sqrt (star a*a) + have hScoe : (S : H →L[ℂ] H)=KKPolarSupport.opAbs (a : H →L[ℂ] H) := by + exact M.toStarSubalgebra.subtype.map_cfc Real.sqrt (star a*a) + obtain ⟨v,hvM,hva,hpi,hv,hker⟩ := KKPolarSupport.polar_decomposition M + (a : H →L[ℂ] H) a.property + let V : ConcreteAlgebra M := ⟨v,hvM⟩ + have hV : Partial V := Subtype.ext hv + have hVa : V*S=a := by + apply Subtype.ext + change v*(S : H →L[ℂ] H)=(a : H →L[ℂ] H) + rw [hScoe]; exact hva + have hS : IsSelfAdjoint S := IsSelfAdjoint.cfc + have hSS : S*S=star a*a := by + apply Subtype.ext + change (S : H →L[ℂ] H)*(S : H →L[ℂ] H)=star (a : H →L[ℂ] H)*(a : H →L[ℂ] H) + rw [hScoe]; exact KKPolarSupport.opAbs_mul_self _ + have hPS := polar_initial_support hV hS hVa hSS + obtain ⟨u,hu⟩ := partial_unitary_extension M τ hM V hV + refine ⟨u,?_⟩ + change (u : ConcreteAlgebra M)*S=a + calc + (u : ConcreteAlgebra M)*S=(u : ConcreteAlgebra M)*((star V*V)*S) := by rw [hPS] + _=((u : ConcreteAlgebra M)*(star V*V))*S := (mul_assoc _ _ _).symm + _=a := by rw [hu,hVa] + +theorem sqrt_sub_one_sq_le {t : ℝ} (ht : 0 ≤ t) : + (Real.sqrt t-1)^2 ≤ (t-1)^2 := by + have hs := Real.sqrt_nonneg t + have hsq := Real.sq_sqrt ht + have hm : 0 ≤ Real.sqrt t*(Real.sqrt t+2)*(Real.sqrt t-1)^2 := + mul_nonneg (mul_nonneg hs (by linarith)) (sq_nonneg _) + conv_rhs => rw [← hsq] + nlinarith only [hm] + +theorem trace_polar_unitary_approximation (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M) (hM : IsFactor M) (a : ConcreteAlgebra M) : + ∃ u : unitary (ConcreteAlgebra M), + traceNorm τ (a-(u : ConcreteAlgebra M)) ≤ traceNorm τ (star a*a-1) := by + obtain ⟨u,hu⟩ := polar_unitary_factorization M τ hM a + let T := star a*a + let S := cfc Real.sqrt T + have hT : IsSelfAdjoint T := IsSelfAdjoint.of_nonneg (star_mul_self_nonneg a) + have hS : IsSelfAdjoint S := IsSelfAdjoint.cfc + have hU : (u : ConcreteAlgebra M)*S=a := hu + have hdiff : a-(u : ConcreteAlgebra M)=(u : ConcreteAlgebra M)*(S-1) := by + rw [mul_sub,mul_one,hU] + have hsq : star (a-(u : ConcreteAlgebra M))*(a-(u : ConcreteAlgebra M))=(S-1)^2 := by + rw [hdiff,star_mul,star_sub,hS.star_eq,star_one] + calc + (S-1)*star (u : ConcreteAlgebra M)*((u : ConcreteAlgebra M)*(S-1)) = + (S-1)*(star (u : ConcreteAlgebra M)*(u : ConcreteAlgebra M))*(S-1) := by simp only [mul_assoc] + _=(S-1)^2 := by rw [Unitary.coe_star_mul_self,mul_one,sq] + have hsqT : star (star a*a-1)*(star a*a-1)=(T-1)^2 := by + change star (T-1)*(T-1)=(T-1)^2 + rw [star_sub,hT.star_eq,star_one,sq] + have hle : (S-1)^2 ≤ (T-1)^2 := by + calc + (S-1)^2 = cfc (fun t : ℝ => (Real.sqrt t-1)^2) T := by + rw [cfc_pow (fun t : ℝ => Real.sqrt t-1) 2 T (by fun_prop) hT, + cfc_sub Real.sqrt (fun _ : ℝ => 1) T (by fun_prop) (by fun_prop), + cfc_const (1 : ℝ) T hT] + simp only [map_one]; rfl + _ ≤ cfc (fun t : ℝ => (t-1)^2) T := by + apply (cfc_le_iff (fun t : ℝ => (Real.sqrt t-1)^2) (fun t : ℝ => (t-1)^2) T + (by fun_prop) (by fun_prop) hT).mpr + intro t ht + exact sqrt_sub_one_sq_le (spectrum_nonneg_of_nonneg (star_mul_self_nonneg a) ht) + _ = (T-1)^2 := by + rw [cfc_pow (fun t : ℝ => t-1) 2 T (by fun_prop) hT, + cfc_sub (fun t : ℝ => t) (fun _ : ℝ => 1) T (by fun_prop) (by fun_prop), + cfc_id' ℝ T, cfc_const (1 : ℝ) T hT, map_one] + have htrace : τ.map ((S-1)^2) ≤ τ.map ((T-1)^2) := OrderHomClass.mono (tracePositive τ) hle + refine ⟨u,?_⟩ + unfold traceNorm + rw [hsq,hsqT] + exact Real.sqrt_le_sqrt (Complex.le_def.mp htrace).1 + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PolarBounds.lean b/lean/OAI/Analysis/FreeWords/PolarBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..15116337b4c4ef777808b3cd85732bf05090b639 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PolarBounds.lean @@ -0,0 +1,203 @@ +import Mathlib +import OAI.Analysis.FreeWords.Bicommutant +import OAI.Analysis.FreeWords.PolarGeometry + +namespace OAI + +noncomputable section + +namespace UniversalStrongKK + +open scoped InnerProductSpace + +noncomputable section + +end + +end UniversalStrongKK + +namespace KKPolarSupport + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKPolarSupport + +namespace KKPolarSupport + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem polarOp_ker (a S : H →L[ℂ] H) (hS : IsSelfAdjoint S) (x : H) (hx : S x = 0) : + polarOp a S x = 0 := by + have hxorth : x ∈ (closedRange S)ᗮ := by + rw [closedRange, Submodule.orthogonal_closure, Submodule.mem_orthogonal] + rintro y ⟨z, rfl⟩ + rw [ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mp hS] + change ⟪z, S x⟫_ℂ = 0 + rw [hx, inner_zero_right] + have hp := ((closedRange S).starProjection_apply_eq_zero_iff).mpr hxorth + have hp' : (closedRange S).orthogonalProjectionOnto x = 0 := Subtype.ext hp + simp [polarOp, hp'] + +omit [CompleteSpace H] in +theorem closedRange_invariant (S B : H →L[ℂ] H) (h : Commute B S) : + ∀ x ∈ closedRange S, B x ∈ closedRange S := by + change S.toLinearMap.range.topologicalClosure ≤ (closedRange S).comap B.toLinearMap + apply Submodule.topologicalClosure_minimal + · rintro y ⟨x, rfl⟩ + change B (S x) ∈ closedRange S + rw [← mul_apply_eq_comp, h.eq, mul_apply_eq_comp] + exact Submodule.le_topologicalClosure _ ⟨B x, rfl⟩ + · exact (Submodule.isClosed_topologicalClosure _).preimage B.continuous + +theorem polarOp_commute (a S B : H →L[ℂ] H) (hAS : ∀ x, ‖a x‖ = ‖S x‖) + (hBa : Commute B a) (hBS : Commute B S) (hBsS : Commute (star B) S) : + Commute B (polarOp a S) := by + have hp : Commute B (closedRange S).starProjection := + UniversalStrongKK.commute_projection_of_invariant _ _ + (closedRange_invariant S B hBS) (closedRange_invariant S (star B) hBsS) + have heq : ∀ x : closedRange S, B (polarOp a S x) = polarOp a S (B x) := by + intro z + refine (closedRangeMap_dense S).induction_on (p := fun z => B (polarOp a S z) = polarOp a S (B z)) z ?_ ?_ + · exact isClosed_eq (by fun_prop) (by fun_prop) + · intro x + change B (polarOp a S (S x)) = polarOp a S (B (S x)) + have hBSx : B (S x) = S (B x) := congrArg (fun T : H →L[ℂ] H => T x) hBS.eq + rw [polarOp_apply_range a S hAS, hBSx, polarOp_apply_range a S hAS] + exact congrArg (fun T : H →L[ℂ] H => T x) hBa.eq + have hVp : ∀ x, polarOp a S ((closedRange S).starProjection x) = polarOp a S x := by + intro x + change polarOnRange a S ((closedRange S).orthogonalProjectionOnto ((closedRange S).starProjection x)) = + polarOnRange a S ((closedRange S).orthogonalProjectionOnto x) + congr 1 + apply Subtype.ext + exact Submodule.starProjection_eq_self_iff.mpr (Submodule.starProjection_apply_mem _ _) + ext x + change B (polarOp a S x) = polarOp a S (B x) + calc + B (polarOp a S x) = B (polarOp a S ((closedRange S).starProjection x)) := by rw [hVp] + _ = polarOp a S (B ((closedRange S).starProjection x)) := heq ((closedRange S).orthogonalProjectionOnto x) + _ = polarOp a S ((closedRange S).starProjection (B x)) := by + exact congrArg (polarOp a S) (congrArg (fun T : H →L[ℂ] H => T x) hp.eq) + _ = polarOp a S (B x) := hVp _ + +def opAbs (a : H →L[ℂ] H) : H →L[ℂ] H := cfc Real.sqrt (star a*a) + +theorem opAbs_selfadjoint (a : H →L[ℂ] H) : IsSelfAdjoint (opAbs a) := IsSelfAdjoint.cfc + +theorem opAbs_mul_self (a : H →L[ℂ] H) : opAbs a * opAbs a = star a*a := by + change cfc Real.sqrt (star a*a) * cfc Real.sqrt (star a*a) = _ + rw [← sq, ← cfc_pow Real.sqrt 2 (star a*a) Real.continuous_sqrt.continuousOn + (IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _))] + calc + cfc (fun x : ℝ => Real.sqrt x ^ 2) (star a*a) = cfc (fun x : ℝ => x) (star a*a) := by + apply cfc_congr + intro x hx + exact Real.sq_sqrt (spectrum_nonneg_of_nonneg (star_mul_self_nonneg a) hx) + _ = star a*a := cfc_id' ℝ _ + +theorem opAbs_norm (a : H →L[ℂ] H) (x : H) : ‖a x‖ = ‖opAbs a x‖ := by + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [@norm_sq_eq_re_inner ℂ, @norm_sq_eq_re_inner ℂ] + congr 1 + rw [← ContinuousLinearMap.adjoint_inner_right, ← ContinuousLinearMap.adjoint_inner_right] + change ⟪x, (star a*a) x⟫_ℂ = ⟪x, (star (opAbs a)*opAbs a) x⟫_ℂ + rw [(opAbs_selfadjoint a).star_eq, opAbs_mul_self] + +theorem opAbs_commute (a B : H →L[ℂ] H) (hBa : Commute B a) (hBas : Commute B (star a)) : + Commute B (opAbs a) := by + have habs : Commute (star a*a) B := (hBas.mul_right hBa).symm + have hself : IsSelfAdjoint (star a*a) := IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _) + exact (habs.cfc (by simpa only [hself.star_eq] using habs) Real.sqrt).symm + +theorem polar_decomposition (M : VonNeumannAlgebra H) (a : H →L[ℂ] H) (ha : a ∈ M) : + ∃ v : H →L[ℂ] H, v ∈ M ∧ + v * cfc Real.sqrt (star a*a) = a ∧ + IsStarProjection (star v*v) ∧ v*star v*v = v ∧ + (∀ x : H, cfc Real.sqrt (star a*a) x = 0 → v x = 0) := by + refine ⟨polarOp a (opAbs a), ?_, polarOp_mul a _ (opAbs_norm a), + polarOp_projection a _ (opAbs_norm a), polarOp_partial a _ (opAbs_norm a), + polarOp_ker a _ (opAbs_selfadjoint a)⟩ + rw [← M.commutant_commutant, VonNeumannAlgebra.mem_commutant_iff] + intro B hB + have hBa : Commute B a := (VonNeumannAlgebra.mem_commutant_iff.mp hB a ha).symm + have hBas : Commute B (star a) := (VonNeumannAlgebra.mem_commutant_iff.mp hB _ (star_mem ha)).symm + have hBsa : Commute (star B) a := + (VonNeumannAlgebra.mem_commutant_iff.mp (star_mem hB) a ha).symm + have hBsas : Commute (star B) (star a) := + (VonNeumannAlgebra.mem_commutant_iff.mp (star_mem hB) _ (star_mem ha)).symm + exact (polarOp_commute a _ B (opAbs_norm a) hBa (opAbs_commute a B hBa hBas) + (opAbs_commute a (star B) hBsa hBsas)).eq + +end + +end KKPolarSupport + +namespace KKPolarSupport + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem polar_decomposition_bounds (M : VonNeumannAlgebra H) (a : H →L[ℂ] H) + (ha : a ∈ M) (p q : H →L[ℂ] H) (_ : IsStarProjection p) (hq : IsStarProjection q) + (hap : a*p=a) (hqa : q*a=a) : + ∃ v : H →L[ℂ] H, v ∈ M ∧ v*star v*v=v ∧ v*p=v ∧ q*v=v ∧ + (v=0 → a=0) := by + obtain ⟨v, hvM, hva, hvi, hv, hk⟩ := polar_decomposition M a ha + change v*opAbs a=a at hva + change ∀ x : H, opAbs a x=0 → v x=0 at hk + have hvp0 : v*(1-p)=0 := by + ext x + change v ((1-p) x)=0 + apply hk + apply norm_eq_zero.mp + rw [← opAbs_norm] + have he : a*(1-p)=0 := by rw [mul_sub, mul_one, hap, sub_self] + exact (congrArg (fun T : H →L[ℂ] H => ‖T x‖) he).trans (by simp) + have hvp : v*p=v := by + rw [mul_sub, mul_one] at hvp0 + exact (sub_eq_zero.mp hvp0).symm + have hsa : opAbs a*star v=star a := by + simpa only [star_mul, (opAbs_selfadjoint a).star_eq] using congrArg star hva + have haq : star a*q=star a := by + simpa only [star_mul, hq.isSelfAdjoint.star_eq] using congrArg star hqa + have heS : opAbs a*(star v*(1-q))=0 := by + rw [← mul_assoc, hsa, mul_sub, mul_one, haq, sub_self] + have heV : (v*star v)*(1-q)=0 := by + ext x + change v (star v ((1-q) x))=0 + apply hk + exact congrArg (fun T : H →L[ℂ] H => T x) heS + have heV' : (1-q)*(v*star v)=0 := by + simpa only [star_mul, star_sub, star_one, hq.isSelfAdjoint.star_eq, star_star, star_zero] + using congrArg star heV + have hqv0 : (1-q)*v=0 := by + calc + (1-q)*v = (1-q)*(v*star v*v) := by rw [hv] + _ = ((1-q)*(v*star v))*v := by simp only [mul_assoc] + _ = 0 := by rw [heV', zero_mul] + have hqv : q*v=v := by + rw [sub_mul, one_mul] at hqv0 + exact (sub_eq_zero.mp hqv0).symm + refine ⟨v,hvM,hv,hvp,hqv,?_⟩ + intro h0 + simpa only [h0, zero_mul] using hva.symm + +end + +end KKPolarSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PolarGeometry.lean b/lean/OAI/Analysis/FreeWords/PolarGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..463646c1c948984049f2ec296949cdb237b10dc5 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PolarGeometry.lean @@ -0,0 +1,106 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKPolarSupport + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def closedRange (S : H →L[ℂ] H) : Submodule ℂ H := S.toLinearMap.range.topologicalClosure + +instance closedRange_complete (S : H →L[ℂ] H) : CompleteSpace (closedRange S) := + (Submodule.isClosed_topologicalClosure _).completeSpace_coe + +def closedRangeMap (S : H →L[ℂ] H) : H →L[ℂ] closedRange S := + S.codRestrict _ (fun x => Submodule.le_topologicalClosure _ ⟨x, rfl⟩) + +omit [CompleteSpace H] in +@[simp] theorem closedRangeMap_val (S : H →L[ℂ] H) (x : H) : + (closedRangeMap S x).1 = S x := rfl + +omit [CompleteSpace H] in +theorem closedRangeMap_dense (S : H →L[ℂ] H) : DenseRange (closedRangeMap S) := by + change DenseRange (Set.inclusion subset_closure ∘ Set.rangeFactorization S) + exact ((denseRange_inclusion_iff subset_closure).2 subset_rfl).comp + Set.rangeFactorization_surjective.denseRange (continuous_inclusion subset_closure) + +def polarOnRange (a S : H →L[ℂ] H) : closedRange S →L[ℂ] H := + a.toLinearMap.extendOfNorm (closedRangeMap S).toLinearMap + +theorem polarOnRange_apply (a S : H →L[ℂ] H) (hAS : ∀ x, ‖a x‖ = ‖S x‖) (x : H) : + polarOnRange a S (closedRangeMap S x) = a x := by + apply LinearMap.extendOfNorm_eq (closedRangeMap_dense S) + exact ⟨1, fun x => by + change ‖a x‖ ≤ 1 * ‖S x‖ + simpa only [one_mul] using (hAS x).le⟩ + +theorem polarOnRange_norm (a S : H →L[ℂ] H) (hAS : ∀ x, ‖a x‖ = ‖S x‖) + (x : closedRange S) : ‖polarOnRange a S x‖ = ‖x‖ := by + refine (closedRangeMap_dense S).induction_on (p := fun x => ‖polarOnRange a S x‖ = ‖x‖) x ?_ ?_ + · exact isClosed_eq (by fun_prop) continuous_norm + · intro y + rw [polarOnRange_apply a S hAS] + exact hAS y + +def polarOp (a S : H →L[ℂ] H) : H →L[ℂ] H := + (polarOnRange a S).comp (closedRange S).orthogonalProjectionOnto + +theorem polarOp_apply_range (a S : H →L[ℂ] H) (hAS : ∀ x, ‖a x‖ = ‖S x‖) (x : H) : + polarOp a S (S x) = a x := by + change polarOnRange a S ((closedRange S).orthogonalProjectionOnto (S x)) = _ + have he : (closedRange S).orthogonalProjectionOnto (S x) = closedRangeMap S x := by + apply Subtype.ext + exact Submodule.starProjection_eq_self_iff.mpr (Submodule.le_topologicalClosure _ ⟨x, rfl⟩) + rw [he, polarOnRange_apply a S hAS] + +theorem polarOp_mul (a S : H →L[ℂ] H) (hAS : ∀ x, ‖a x‖ = ‖S x‖) : + polarOp a S * S = a := by + ext x + exact polarOp_apply_range a S hAS x + +theorem polarOp_star_mul (a S : H →L[ℂ] H) (hAS : ∀ x, ‖a x‖ = ‖S x‖) : + star (polarOp a S) * polarOp a S = (closedRange S).starProjection := by + let V : closedRange S →ₗᵢ[ℂ] H := + { toLinearMap := (polarOnRange a S).toLinearMap + norm_map' := polarOnRange_norm a S hAS } + apply ContinuousLinearMap.ext + intro y + apply ext_inner_left ℂ + intro x + change ⟪x, (polarOp a S).adjoint (polarOp a S y)⟫_ℂ = _ + rw [ContinuousLinearMap.adjoint_inner_right] + change ⟪V ((closedRange S).orthogonalProjectionOnto x), + V ((closedRange S).orthogonalProjectionOnto y)⟫_ℂ = _ + rw [V.inner_map_map] + change ⟪(closedRange S).starProjection x, (closedRange S).starProjection y⟫_ℂ = _ + rw [Submodule.inner_starProjection_left_eq_right] + congr 1 + exact Submodule.starProjection_eq_self_iff.mpr (Submodule.starProjection_apply_mem _ _) + +theorem polarOp_projection (a S : H →L[ℂ] H) (hAS : ∀ x, ‖a x‖ = ‖S x‖) : + IsStarProjection (star (polarOp a S)*polarOp a S) := by + rw [polarOp_star_mul a S hAS] + exact isStarProjection_starProjection + +theorem polarOp_partial (a S : H →L[ℂ] H) (hAS : ∀ x, ‖a x‖ = ‖S x‖) : + polarOp a S*star (polarOp a S)*polarOp a S = polarOp a S := by + rw [mul_assoc, polarOp_star_mul a S hAS] + ext x + change polarOnRange a S ((closedRange S).orthogonalProjectionOnto ((closedRange S).starProjection x)) = + polarOnRange a S ((closedRange S).orthogonalProjectionOnto x) + congr 1 + apply Subtype.ext + exact (Submodule.starProjection_eq_self_iff.mpr (Submodule.starProjection_apply_mem _ _)) + +end + +end KKPolarSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PositiveMoments.lean b/lean/OAI/Analysis/FreeWords/PositiveMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..e51c9d4a74af60fdde80b7df994a3c1d58d58579 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PositiveMoments.lean @@ -0,0 +1,148 @@ +import Mathlib +import OAI.Analysis.FreeWords.DirichletMoments + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped BigOperators + +noncomputable section + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +omit [StarOrderedRing A] in +theorem positiveMap_re_nonneg {x : A} (hx : 0 ≤ x) : 0 ≤ (τ x).re := + (Complex.nonneg_iff.mp (τ.map_nonneg hx)).1 + +omit [StarOrderedRing A] in +theorem positiveMap_norm_of_nonneg {x : A} (hx : 0 ≤ x) : ‖τ x‖ = (τ x).re := by + have h := Complex.nonneg_iff.mp (τ.map_nonneg hx) + have he : τ x = ((τ x).re : ℂ) := by apply Complex.ext <;> simp [h.2.symm] + rw [he,Complex.norm_of_nonneg h.1] + simp + +theorem positiveMap_cauchy_schwarz (x y : A) : + ‖τ (star x*y)‖^2 ≤ (τ (star x*x)).re * (τ (star y*y)).re := by + have h := pow_le_pow_left₀ (norm_nonneg _) + (norm_inner_le_norm (𝕜 := ℂ) (τ.toPreGNS x) (τ.toPreGNS y)) 2 + rw [mul_pow,← inner_self_eq_norm_sq (𝕜 := ℂ) (τ.toPreGNS x), + ← inner_self_eq_norm_sq (𝕜 := ℂ) (τ.toPreGNS y)] at h + simpa only [PositiveLinearMap.preGNS_inner_def,PositiveLinearMap.ofPreGNS_toPreGNS, RCLike.re_eq_complex_re] using h + +theorem positiveMap_moment_interpolation {x : A} (hx : 0 ≤ x) : + (τ (x^2)).re^3 ≤ (τ x).re^2 * (τ (x^4)).re := by + let s := CFC.sqrt x + have hs0 : 0 ≤ s := CFC.sqrt_nonneg x + have hss : star s = s := (IsSelfAdjoint.of_nonneg hs0).star_eq + have hs2 : s^2 = x := by simpa only [s,pow_two] using CFC.sqrt_mul_sqrt_self x hx + have hxs : star x = x := (IsSelfAdjoint.of_nonneg hx).star_eq + have h2 (n : ℕ) : s^(2*n) = x^n := by rw [pow_mul,hs2] + have h12 := positiveMap_cauchy_schwarz (τ := τ) s (s^3) + have hs13 : star s * s^3 = x^2 := by rw [hss,← pow_succ']; exact h2 2 + have hs33 : star (s^3)*s^3 = x^3 := by rw [star_pow,hss,← pow_add]; exact h2 3 + rw [hs13,hs33,hss,← pow_two,hs2, + positiveMap_norm_of_nonneg (τ := τ) (CStarAlgebra.pow_nonneg x 2 hx)] at h12 + have h23 := positiveMap_cauchy_schwarz (τ := τ) x (x^2) + have hx12 : star x*x^2 = x^3 := by rw [hxs,← pow_succ'] + have hx22 : star (x^2)*x^2 = x^4 := by rw [star_pow,hxs,← pow_add] + rw [hx12,hx22,hxs,← pow_two, + positiveMap_norm_of_nonneg (τ := τ) (CStarAlgebra.pow_nonneg x 3 hx)] at h23 + have hm1 := positiveMap_re_nonneg (τ := τ) hx + have hm2 := positiveMap_re_nonneg (τ := τ) (CStarAlgebra.pow_nonneg x 2 hx) + have hm3 := positiveMap_re_nonneg (τ := τ) (CStarAlgebra.pow_nonneg x 3 hx) + have hm4 := positiveMap_re_nonneg (τ := τ) (CStarAlgebra.pow_nonneg x 4 hx) + have h12s := pow_le_pow_left₀ (sq_nonneg (τ (x^2)).re) h12 2 + have h23m := mul_le_mul_of_nonneg_left h23 (sq_nonneg (τ x).re) + by_cases hm2z : (τ (x^2)).re = 0 + · simp [hm2z,mul_nonneg (sq_nonneg (τ x).re) hm4] + · have hm2p : 0 < (τ (x^2)).re := lt_of_le_of_ne hm2 (Ne.symm hm2z) + have hcancel : (τ (x^2)).re * (τ (x^2)).re^3 ≤ + (τ (x^2)).re * ((τ x).re^2 * (τ (x^4)).re) := by nlinarith + exact (mul_le_mul_iff_right₀ hm2p).mp hcancel + +theorem positiveMap_fourth_le (a : A) : + (τ ((a*star a)^2)).re ≤ ‖a‖^2 * (τ (a*star a)).re := by + have ho := star_right_conjugate_le_conjugate + (CStarAlgebra.star_mul_le_algebraMap_norm_sq (a := a)) a + have he : a * (star a*a) * star a = (a*star a)^2 := by noncomm_ring + have he' : a * (algebraMap ℝ A (‖a‖^2)) * star a = ‖a‖^2 • (a*star a) := by + rw [Algebra.algebraMap_eq_smul_one] + simp only [mul_smul_comm,mul_one,smul_mul_assoc] + rw [he,he'] at ho + have h := (Complex.le_def.mp (τ.monotone' ho)).1 + change (τ ((a*star a)^2)).re ≤ (τ (‖a‖^2 • (a*star a))).re at h + simpa only [positiveMap_real_smul,Complex.smul_re,smul_eq_mul] using h + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PositiveSupport.lean b/lean/OAI/Analysis/FreeWords/PositiveSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ecf8a2bf6ea2db1bb88293ff63dd809971427d6 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PositiveSupport.lean @@ -0,0 +1,168 @@ +import Mathlib +import OAI.Analysis.FreeWords.SupportProjections + +namespace OAI + +noncomputable section + +namespace KKSpectralSupport + +open KKTraceTransfer KKPolarSupport + +open scoped InnerProductSpace ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {M : VonNeumannAlgebra H} + +end + +end KKSpectralSupport + +namespace KKSpectralSupport + +open KKTraceTransfer KKPolarSupport + +open scoped InnerProductSpace ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {M : VonNeumannAlgebra H} + +theorem positive_sqrt_square {a : ConcreteAlgebra M} (ha : 0 ≤ a) : + cfc Real.sqrt a * cfc Real.sqrt a = a := by + rw [← sq,← cfc_pow Real.sqrt 2 a Real.continuous_sqrt.continuousOn (IsSelfAdjoint.of_nonneg ha)] + calc + cfc (fun t : ℝ => Real.sqrt t^2) a = cfc (fun t : ℝ => t) a := by + apply cfc_congr + intro t ht + exact Real.sq_sqrt (spectrum_nonneg_of_nonneg ha ht) + _ = a := cfc_id' ℝ _ (IsSelfAdjoint.of_nonneg ha) + +theorem positive_annihilate {a p : ConcreteAlgebra M} (ha : 0 ≤ a) + (hp : IsSelfAdjoint p) (h : p*a*p=0) : a*p=0 := by + let s := cfc Real.sqrt a + have hs : IsSelfAdjoint s := IsSelfAdjoint.cfc + have hss : s*s=a := positive_sqrt_square ha + have he : star (s*p)*(s*p)=0 := by + rw [star_mul,hp.star_eq,hs.star_eq] + calc p*s*(s*p)=p*(s*s)*p := by simp only [mul_assoc] + _ = 0 := by rw [hss,h] + have hn : ‖s*p‖^2=0 := by rw [pow_two,← CStarRing.norm_star_mul_self,he,norm_zero] + have hsp : s*p=0 := norm_eq_zero.mp (sq_eq_zero_iff.mp hn) + rw [← hss,mul_assoc,hsp,mul_zero] + +theorem supportProjection_mono {a b : ConcreteAlgebra M} (ha : 0 ≤ a) (hab : a ≤ b) : + supportProjection a ≤ supportProjection b := by + have hb : 0 ≤ b := ha.trans hab + let q := 1-supportProjection b + have hq : IsStarProjection q := (supportProjection_isProjection b).one_sub + have hbq : b*q=0 := by + dsimp [q] + rw [mul_sub,mul_one,mul_supportProjection (IsSelfAdjoint.of_nonneg hb),sub_self] + have hle : q*a*q ≤ 0 := by + have hh := star_left_conjugate_le_conjugate hab q + rw [hq.isSelfAdjoint.star_eq,mul_assoc q b,hbq,mul_zero] at hh + exact hh + have heq : q*a*q=0 := le_antisymm hle (hq.isSelfAdjoint.conjugate_nonneg ha) + have haq := positive_annihilate ha hq.isSelfAdjoint heq + have hap : a*supportProjection b=a := by + dsimp [q] at haq + rw [mul_sub,mul_one] at haq + exact (sub_eq_zero.mp haq).symm + have hpa : supportProjection b*a=a := by + simpa only [star_mul,(supportProjection_isProjection b).isSelfAdjoint.star_eq, + (IsSelfAdjoint.of_nonneg ha).star_eq] using congrArg star hap + exact supportProjection_le (supportProjection_isProjection b) hpa + +def positiveCut (a : ConcreteAlgebra M) (t : ℝ) : ConcreteAlgebra M := cfc (fun x : ℝ => max (x-t) 0) a + +def negativeCut (a : ConcreteAlgebra M) (t : ℝ) : ConcreteAlgebra M := cfc (fun x : ℝ => max (t-x) 0) a + +def spectralCut (a : ConcreteAlgebra M) (t : ℝ) : ConcreteAlgebra M := supportProjection (positiveCut a t) + +theorem positiveCut_nonneg (a : ConcreteAlgebra M) (t : ℝ) : 0 ≤ positiveCut a t := + cfc_nonneg (fun _ _ => le_max_right _ _) + +theorem negativeCut_nonneg (a : ConcreteAlgebra M) (t : ℝ) : 0 ≤ negativeCut a t := + cfc_nonneg (fun _ _ => le_max_right _ _) + +theorem spectralCut_isProjection (a : ConcreteAlgebra M) (t : ℝ) : IsStarProjection (spectralCut a t) := + supportProjection_isProjection _ + +theorem cuts_difference (a : ConcreteAlgebra M) (ha : IsSelfAdjoint a) (t : ℝ) : + positiveCut a t-negativeCut a t=a-algebraMap ℝ (ConcreteAlgebra M) t := by + calc + _ = cfc (fun x : ℝ => max (x-t) 0 - max (t-x) 0) a := by + exact (cfc_sub (fun x : ℝ => max (x-t) 0) (fun x : ℝ => max (t-x) 0) a).symm + _ = cfc (fun x : ℝ => x-t) a := by + apply cfc_congr + intro x hx + change max (x-t) 0-max (t-x) 0=x-t + by_cases h : t ≤ x + · simp only [max_eq_left (sub_nonneg.mpr h),max_eq_right (sub_nonpos.mpr h),sub_zero] + · have h' := le_of_not_ge h + simp only [max_eq_right (sub_nonpos.mpr h'),max_eq_left (sub_nonneg.mpr h'),zero_sub] + ring + _ = _ := by rw [cfc_sub (fun x : ℝ => x) (fun _ : ℝ => t) a,cfc_id' ℝ a ha,cfc_const t a ha] + +theorem cuts_product (a : ConcreteAlgebra M) (ha : IsSelfAdjoint a) (t : ℝ) : + negativeCut a t*positiveCut a t=0 := by + rw [negativeCut,positiveCut,← cfc_mul (fun x : ℝ => max (t-x) 0) (fun x : ℝ => max (x-t) 0) a] + calc + cfc (fun x : ℝ => max (t-x) 0*max (x-t) 0) a=cfc (fun _ : ℝ => 0) a := by + apply cfc_congr + intro x hx + change max (t-x) 0*max (x-t) 0=0 + by_cases ht : t ≤ x + · rw [max_eq_right (sub_nonpos.mpr ht),zero_mul] + · rw [max_eq_right (sub_nonpos.mpr (le_of_not_ge ht)),mul_zero] + _ = 0 := by rw [cfc_const 0 a ha,map_zero] + +theorem spectralCut_commute (a : ConcreteAlgebra M) (ha : IsSelfAdjoint a) (t : ℝ) : + Commute a (spectralCut a t) := by + apply supportProjection_commute (IsSelfAdjoint.of_nonneg (positiveCut_nonneg a t)) + change Commute a (cfc (fun x : ℝ => max (x-t) 0) a) + exact ((Commute.refl a).cfc (by simpa only [ha.star_eq] using Commute.refl a) _).symm + +theorem spectralCut_compression (a : ConcreteAlgebra M) (ha : IsSelfAdjoint a) (t : ℝ) : + (a-algebraMap ℝ (ConcreteAlgebra M) t)*spectralCut a t=positiveCut a t := by + rw [← cuts_difference a ha t,sub_mul,spectralCut,mul_supportProjection (IsSelfAdjoint.of_nonneg (positiveCut_nonneg a t)), + annihilate_supportProjection (cuts_product a ha t),sub_zero] + +theorem spectralCut_complement (a : ConcreteAlgebra M) (ha : IsSelfAdjoint a) (t : ℝ) : + (a-algebraMap ℝ (ConcreteAlgebra M) t)*(1-spectralCut a t)=-negativeCut a t := by + rw [mul_sub,mul_one,spectralCut_compression a ha t,← cuts_difference a ha t] + abel + +theorem spectralCut_antitone (a : ConcreteAlgebra M) : Antitone (spectralCut a) := by + intro s t hst + apply supportProjection_mono (positiveCut_nonneg a t) + exact cfc_mono (fun x hx => max_le_max (sub_le_sub_left hst x) le_rfl) + +end + +end KKSpectralSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/PowerMetricInverse.lean b/lean/OAI/Analysis/FreeWords/PowerMetricInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..a29cf70ac95f3df6bacd445ef2739dc81c817cac --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/PowerMetricInverse.lean @@ -0,0 +1,65 @@ +import Mathlib +import OAI.Analysis.FreeWords.GramCounting +import OAI.Analysis.FreeWords.WeightedInverse + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators + +noncomputable section + +theorem power_weight_bound (L t : ℝ) (hL : 1 ≤ L) (ht : 0 < t) (hs : L*t ≤ 1) + (a b c : ℕ) (ha : 0 < a) (hc : c ≤ a+b) : + t^a*(L*t)^b/(L*t)^c ≤ L⁻¹ := by + have hL0 : 0 < L := lt_of_lt_of_le zero_lt_one hL + have hs0 : 0 < L*t := mul_pos hL0 ht + have hi : L⁻¹ ≤ 1 := (inv_le_one₀ hL0).mpr hL + have htval : L⁻¹*(L*t)=t := by field_simp + have hp : (L⁻¹)^a ≤ L⁻¹ := by + simpa only [pow_one] using pow_le_pow_of_le_one (inv_nonneg.mpr hL0.le) hi ha + calc + _ = ((L⁻¹)^a*(L*t)^(a+b))/(L*t)^c := by + rw [pow_add,← mul_assoc,← mul_pow,htval] + _ ≤ (L⁻¹*(L*t)^c)/(L*t)^c := by + apply div_le_div_of_nonneg_right _ (pow_nonneg hs0.le _) + exact mul_le_mul hp (pow_le_pow_of_le_one hs0.le hs hc) (pow_nonneg hs0.le _) (inv_nonneg.mpr hL0.le) + _ = _ := mul_div_cancel_right₀ _ (pow_ne_zero _ hs0.ne') + +theorem distanceMatrix_inverse_bound {ι : Type*} [Fintype ι] [Nonempty ι] [DecidableEq ι] + (δ : ι → ι → ℕ) (hself : ∀ i, δ i i=0) + (hpos : ∀ i k, i ≠ k → 0 < δ i k) + (htri : ∀ i k j, δ i j ≤ δ i k+δ k j) + (t : ℝ) (ht : 0 < t) (hs : 2*(Fintype.card ι : ℝ)*t ≤ 1) + (B : Matrix ι ι ℂ) (hB : distanceMatrix δ t*B=1) : + ∀ i j, ‖B i j‖ ≤ 2*(2*(Fintype.card ι : ℝ)*t)^(δ i j) := by + have hm : (0 : ℝ) < Fintype.card ι := by exact_mod_cast Fintype.card_pos + have hL : 1 ≤ 2*(Fintype.card ι : ℝ) := by + have hm1 : (1 : ℝ) ≤ Fintype.card ι := by exact_mod_cast Fintype.card_pos + linarith + have hs0 : 0 < 2*(Fintype.card ι : ℝ)*t := by positivity + intro i j + apply inverse_entry_bound_of_scaled_error (distanceMatrix δ t) B hB + (fun k => (2*(Fintype.card ι : ℝ)*t)^(δ k j)) (fun _ => pow_pos hs0 _) j + (by simp [hself]) _ i + intro a b + by_cases hab : a=b + · subst b + have hzc : (((2*(Fintype.card ι : ℝ)*t)^(δ a j) : ℝ) : ℂ) ≠ 0 := by + exact_mod_cast (pow_pos hs0 (δ a j)).ne' + simp only [distanceMatrix,hself,pow_zero,one_mul,ite_true,div_self hzc,sub_self,norm_zero] + positivity + · have hh := power_weight_bound (2*(Fintype.card ι : ℝ)) t hL ht hs + (δ a b) (δ b j) (δ a j) (hpos a b hab) (htri a b j) + simpa [distanceMatrix,hab,norm_div,norm_mul,norm_pow, + Complex.norm_real,Real.norm_eq_abs,abs_of_pos ht,abs_of_pos hs0,abs_of_pos hm] using hh + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ProjectionChain.lean b/lean/OAI/Analysis/FreeWords/ProjectionChain.lean new file mode 100644 index 0000000000000000000000000000000000000000..c79233d1cb0ce1205f9b751cfdf1feb13208eafd --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ProjectionChain.lean @@ -0,0 +1,93 @@ +import Mathlib +import OAI.Analysis.FreeWords.ProjectionStructure + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport + +open UniversalStrongKK Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem trace_tendsto_bounded_wot {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + {I : Type*} {l : Filter I} {f : I → ConcreteAlgebra M} {v : ConcreteAlgebra M} + (hf : ∀ i, ‖f i‖ ≤ 1) (hv : ‖v‖ ≤ 1) + (ht : Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (f i : H →L[ℂ] H)) l + (𝓝 (ContinuousLinearMapWOT.ofCLM (v : H →L[ℂ] H)))) : + Tendsto (fun i => τ.map (f i)) l (𝓝 (τ.map v)) := by + let fw : I → WeakAlgebra M := fun i => ⟨ContinuousLinearMapWOT.ofCLM (f i : H →L[ℂ] H),(f i).property⟩ + let vw : WeakAlgebra M := ⟨ContinuousLinearMapWOT.ofCLM (v : H →L[ℂ] H),v.property⟩ + have htw : Tendsto fw l (𝓝 vw) := tendsto_subtype_rng.mpr ht + have htw' : Tendsto fw l (𝓝[{T : WeakAlgebra M | ‖T.val.toCLM‖ ≤ 1}] vw) := + tendsto_nhdsWithin_iff.mpr ⟨htw,Eventually.of_forall hf⟩ + exact (τ.normal 1 vw hv).tendsto.comp htw' + +theorem projection_directed_limit {M : VonNeumannAlgebra H} + {I : Type*} [Preorder I] [IsDirectedOrder I] [Nonempty I] + (f : I → ConcreteAlgebra M) (hp : ∀ i, IsStarProjection (f i)) (hf : Monotone f) : + ∃ v : ConcreteAlgebra M, IsStarProjection v ∧ (∀ i, f i ≤ v) ∧ + ∃ ω : Ultrafilter I, (ω : Filter I) ≤ atTop ∧ + Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (f i : H →L[ℂ] H)) (ω : Filter I) + (𝓝 (ContinuousLinearMapWOT.ofCLM (v : H →L[ℂ] H))) := by + let F (i : I) : PartialIso (H →L[ℂ] H) := ⟨(f i : H →L[ℂ] H),by + have hh := concrete_projection_coe (hp i) + change (f i : H →L[ℂ] H)*star (f i : H →L[ℂ] H)*(f i : H →L[ℂ] H)=f i + rw [hh.isSelfAdjoint.star_eq,hh.isIdempotentElem.eq,hh.isIdempotentElem.eq]⟩ + have hF : Monotone F := by + intro i j hij + have hi := hp i + have hji := hi.le_iff_mul_eq_right (hp j) |>.mp (hf hij) + have hij' := hi.le_iff_mul_eq_left (hp j) |>.mp (hf hij) + constructor + · change (f j : H →L[ℂ] H)*(star (f i : H →L[ℂ] H)*(f i : H →L[ℂ] H))=f i + rw [(concrete_projection_coe hi).isSelfAdjoint.star_eq, + (concrete_projection_coe hi).isIdempotentElem.eq] + exact congrArg Subtype.val hji + · change star (f i : H →L[ℂ] H)*(f j : H →L[ℂ] H)=star (f i : H →L[ℂ] H)*(f i : H →L[ℂ] H) + rw [(concrete_projection_coe hi).isSelfAdjoint.star_eq, + (concrete_projection_coe hi).isIdempotentElem.eq] + exact congrArg Subtype.val hij' + obtain ⟨V,hV,ω,hω,hlim⟩ := partialIso_directed_limit F hF + have hVM : V.value ∈ M := mem_of_wot_tendsto M hlim (Eventually.of_forall fun i => (f i).property) + have hVs : star V.value=V.value := by + have hs := hlim.star + change Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (star (f i : H →L[ℂ] H))) (ω : Filter I) + (𝓝 (ContinuousLinearMapWOT.ofCLM (star V.value))) at hs + have he (i : I) : star (f i : H →L[ℂ] H)=(f i : H →L[ℂ] H) := + (concrete_projection_coe (hp i)).isSelfAdjoint.star_eq + simp only [he] at hs + exact congrArg ContinuousLinearMapWOT.toCLM (tendsto_nhds_unique hs hlim) + have hVi (i : I) : V.value*(f i : H →L[ℂ] H)=f i := by + have hh := (hV i).1 + change V.value*(star (f i : H →L[ℂ] H)*(f i : H →L[ℂ] H))=f i at hh + simpa only [(concrete_projection_coe (hp i)).isSelfAdjoint.star_eq, + (concrete_projection_coe (hp i)).isIdempotentElem.eq] using hh + have hVV : V.value*V.value=V.value := by + have ht := wot_const_mul hlim V.value + change Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (V.value*(f i : H →L[ℂ] H))) _ _ at ht + simp only [hVi] at ht + exact congrArg ContinuousLinearMapWOT.toCLM (tendsto_nhds_unique ht hlim) + let v : ConcreteAlgebra M := ⟨V.value,hVM⟩ + have hv : IsStarProjection v := ⟨Subtype.ext hVV,Subtype.ext hVs⟩ + exact ⟨v,hv,(fun i => ((hp i).le_iff_mul_eq_right hv).mpr (Subtype.ext (hVi i))),ω,hω,hlim⟩ + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ProjectionMatrix.lean b/lean/OAI/Analysis/FreeWords/ProjectionMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b534b85e4149ec1da74d29970b49dea5157334f --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ProjectionMatrix.lean @@ -0,0 +1,143 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped InnerProductSpace BigOperators + +namespace UniversalStrongKK + +section Matrices + +variable {ι κ H : Type*} [Fintype ι] [Fintype κ] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +abbrev HilbertSum (ι H : Type*) [Fintype ι] [NormedAddCommGroup H] := PiLp 2 (fun _ : ι => H) + +noncomputable def operatorMatrix (T : ι → κ → (H →L[ℂ] H)) : + HilbertSum κ H →L[ℂ] HilbertSum ι H := + (PiLp.continuousLinearEquiv 2 ℂ (fun _ : ι => H)).symm.toContinuousLinearMap.comp + (ContinuousLinearMap.pi (fun i => ∑ j, (T i j).comp (PiLp.proj 2 (fun _ : κ => H) j))) + +@[simp] theorem operatorMatrix_apply (T : ι → κ → (H →L[ℂ] H)) + (x : HilbertSum κ H) (i : ι) : + (operatorMatrix T x).ofLp i = ∑ j, T i j (x.ofLp j) := by + simp [operatorMatrix] + +theorem operatorMatrix_add (S T : ι → κ → (H →L[ℂ] H)) : + operatorMatrix (fun i j => S i j + T i j) = operatorMatrix S + operatorMatrix T := by + ext x i + simp [Finset.sum_add_distrib] + +theorem operatorMatrix_smul (c : ℂ) (T : ι → κ → (H →L[ℂ] H)) : + operatorMatrix (fun i j => c • T i j) = c • operatorMatrix T := by + ext x i + simp [Finset.smul_sum] + +theorem operatorMatrix_mul {ν : Type*} [Fintype ν] + (S : ι → κ → (H →L[ℂ] H)) (T : κ → ν → (H →L[ℂ] H)) : + operatorMatrix (fun i k => ∑ j, S i j * T j k) = + (operatorMatrix S).comp (operatorMatrix T) := by + ext x i + simp only [operatorMatrix_apply, sum_apply, mul_apply_eq_comp, + ContinuousLinearMap.comp_apply, map_sum] + exact Finset.sum_comm + +variable [CompleteSpace H] + +theorem operatorMatrix_star (T : ι → κ → (H →L[ℂ] H)) : + operatorMatrix (fun i j => star (T j i)) = (operatorMatrix T).adjoint := by + apply ContinuousLinearMap.ext + intro x + apply ext_inner_left ℂ + intro y + rw [ContinuousLinearMap.adjoint_inner_right] + simp only [PiLp.inner_apply, operatorMatrix_apply, inner_sum, sum_inner, + ContinuousLinearMap.star_eq_adjoint, ContinuousLinearMap.adjoint_inner_right] + exact Finset.sum_comm + +end Matrices + +end UniversalStrongKK + +namespace UniversalStrongKK + +section ProjectionMatrix + +variable {ι κ H : Type*} [Fintype ι] [Fintype κ] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem sum_pairwise_starProjection (p : ι → (H →L[ℂ] H)) + (hp : ∀ i, IsStarProjection (p i)) + (horth : ∀ i j, i ≠ j → p i * p j = 0) : + IsStarProjection (∑ i, p i) := by + classical + constructor + · change (∑ i, p i) * (∑ i, p i) = ∑ i, p i + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro i hi + rw [Finset.mul_sum, Finset.sum_eq_single i] + · exact (hp i).isIdempotentElem.eq + · intro j hj hji + exact horth i j hji.symm + · simp + · change star (∑ i, p i) = ∑ i, p i + simp only [star_sum, (hp _).isSelfAdjoint.star_eq] + +omit [CompleteSpace H] in +theorem diagonalFamily_norm_le [DecidableEq κ] (p : κ → (H →L[ℂ] H)) (hp : ∀ j, ‖p j‖ ≤ 1) : + ‖operatorMatrix (fun i j => if i = j then p i else 0)‖ ≤ 1 := by + classical + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro x + rw [one_mul] + apply nonneg_le_nonneg_of_sq_le_sq (norm_nonneg _) + rw [← sq, ← sq] + simp_rw [← @inner_self_eq_norm_sq ℂ, PiLp.inner_apply, map_sum] + apply Finset.sum_le_sum + intro i hi + have he : (operatorMatrix (fun i j => if i = j then p i else 0) x).ofLp i = p i (x.ofLp i) := by + rw [operatorMatrix_apply, Finset.sum_eq_single i] + · simp + · intro j hj hji; simp [Ne.symm hji] + · simp + rw [he] + simp only [inner_self_eq_norm_sq] + have hn : ‖p i (x.ofLp i)‖ ≤ ‖x.ofLp i‖ := by + calc + _ ≤ ‖p i‖ * ‖x.ofLp i‖ := (p i).le_opNorm _ + _ ≤ 1 * ‖x.ofLp i‖ := mul_le_mul_of_nonneg_right (hp i) (norm_nonneg _) + _ = _ := one_mul _ + exact pow_le_pow_left₀ (norm_nonneg _) hn 2 + +theorem orthogonal_projection_matrix_contraction (p : ι → κ → (H →L[ℂ] H)) + (hp : ∀ i j, IsStarProjection (p i j)) + (hrow : ∀ i j k, j ≠ k → p i j * p i k = 0) + (hcol : ∀ i l j, i ≠ l → p i j * p l j = 0) : + ‖operatorMatrix p‖ ≤ 1 := by + classical + let P (j : κ) := ∑ i, p i j + have hP j : IsStarProjection (P j) := + sum_pairwise_starProjection (fun i => p i j) (fun i => hp i j) (fun i l h => hcol i l j h) + have heq : (operatorMatrix p).adjoint.comp (operatorMatrix p) = + operatorMatrix (fun j k => if j = k then P j else 0) := by + rw [← operatorMatrix_star, ← operatorMatrix_mul] + congr 1 + funext j k + by_cases hjk : j = k + · subst k + simp only [ite_true, (hp _ _).isSelfAdjoint.star_eq, (hp _ _).isIdempotentElem.eq, P] + · simp only [ite_eq_right hjk, (hp _ _).isSelfAdjoint.star_eq, hrow _ _ _ hjk, + Finset.sum_const_zero] + have hn := diagonalFamily_norm_le P (fun j => (hP j).norm_le (P j)) + rw [← heq, ContinuousLinearMap.norm_adjoint_comp_self] at hn + nlinarith [norm_nonneg (operatorMatrix p)] + +end ProjectionMatrix + +end UniversalStrongKK +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ProjectionPartition.lean b/lean/OAI/Analysis/FreeWords/ProjectionPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..07ed3a9b830c5baf991c95958a10285246e27739 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ProjectionPartition.lean @@ -0,0 +1,84 @@ +import Mathlib +import OAI.Analysis.FreeWords.ProjectionSubdivision + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem projection_partition (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hD : IsDiffuse M) (n : ℕ) (p : ConcreteAlgebra M) (hp : IsStarProjection p) + (t : ℝ) (ht : 0 ≤ t) (hτ : τ.map p=(n : ℂ)*(t : ℂ)) : + ∃ f : Fin n → ConcreteAlgebra M, (∀ i, IsStarProjection (f i)) ∧ + (∀ i, f i ≤ p) ∧ (∀ i j, i≠j → f i*f j=0) ∧ + (∑ i, f i)=p ∧ (∀ i, τ.map (f i)=(t : ℂ)) := by + classical + induction n generalizing p with + | zero => + have hp0 : p=0 := by + by_contra h + exact trace_projection_ne_zero τ hp h (by simpa using hτ) + exact ⟨Fin.elim0,(by intro i; exact Fin.elim0 i),(by intro i; exact Fin.elim0 i), + (by intro i; exact Fin.elim0 i),(by simp [hp0]),(by intro i; exact Fin.elim0 i)⟩ + | succ n ih => + have htp : t ≤ (τ.map p).re := by + rw [hτ] + norm_num only [Nat.cast_add,Nat.cast_one,Complex.add_re,Complex.natCast_re, + Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,Complex.add_im,Complex.natCast_im, + Complex.one_re,Complex.one_im,mul_zero,sub_zero,zero_add] + nlinarith [show (0:ℝ) ≤ (n:ℝ) from Nat.cast_nonneg n] + obtain ⟨q,hq,hqp,hτq⟩ := projection_with_trace M τ hD p hp t ht htp + have hle : q ≤ p := (hq.le_iff_mul_eq_left hp).mpr hqp + have hr : IsStarProjection (p-q) := (hq.le_iff_sub hp).mp hle + have hτr : τ.map (p-q)=(n:ℂ)*(t:ℂ) := by + rw [map_sub,hτ,hτq,Nat.cast_add,Nat.cast_one] + ring + obtain ⟨f,hf,hfp,hff,hfs,hfτ⟩ := ih (p-q) hr hτr + have hqf (i : Fin n) : q*f i=0 := by + calc + q*f i = q*((p-q)*f i) := by rw [((hf i).le_iff_mul_eq_right hr).mp (hfp i)] + _ = (q*(p-q))*f i := (mul_assoc _ _ _).symm + _ = 0 := by rw [mul_sub,hqp,hq.isIdempotentElem.eq,sub_self,zero_mul] + have hfq (i : Fin n) : f i*q=0 := by + simpa only [star_mul,hq.isSelfAdjoint.star_eq,(hf i).isSelfAdjoint.star_eq,star_zero] using congrArg star (hqf i) + refine ⟨Fin.cons q f,?_,?_,?_,?_,?_⟩ + · exact Fin.forall_fin_succ.mpr ⟨hq,hf⟩ + · exact Fin.forall_fin_succ.mpr ⟨hle,fun i => (hfp i).trans (sub_le_self _ hq.nonneg)⟩ + · intro i j hij + cases i using Fin.cases with + | zero => + cases j using Fin.cases with + | zero => exact (hij rfl).elim + | succ j => simpa only [Fin.cons_zero,Fin.cons_succ] using hqf j + | succ i => + cases j using Fin.cases with + | zero => simpa only [Fin.cons_zero,Fin.cons_succ] using hfq i + | succ j => exact hff i j (fun h => hij (congrArg Fin.succ h)) + · rw [Fin.sum_univ_succ] + simp only [Fin.cons_zero,Fin.cons_succ,hfs] + abel + · exact Fin.forall_fin_succ.mpr ⟨hτq,hfτ⟩ + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ProjectionRound.lean b/lean/OAI/Analysis/FreeWords/ProjectionRound.lean new file mode 100644 index 0000000000000000000000000000000000000000..845931675e2f980c2bcb45138568b149821bd3be --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ProjectionRound.lean @@ -0,0 +1,239 @@ +import Mathlib +import OAI.Analysis.FreeWords.ProjectionSubdivision +import OAI.Analysis.FreeWords.RationalWeights +import OAI.Analysis.FreeWords.UnitaryExtension + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +noncomputable section + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance projectionRoundPartialOrder₁ (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance projectionRoundPreorder₁ (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance projectionRoundLE₁ (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance projectionRoundStarOrderedRing₁ (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem partial_matrix_system_diagonal {ι : Type*} [Fintype ι] [DecidableEq ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (hF : IsFactor M) + (p : ι → ConcreteAlgebra M) (hp : ∀ i, IsStarProjection (p i)) + (horth : ∀ i j, i≠j → p i*p j=0) (h1 : ∑ i, p i=1) + (i₀ : ι) (hτ : ∀ i, τ.map (p i)=τ.map (p i₀)) : + ∃ e : ι → ι → ConcreteAlgebra M, + (∀ i j k l, e i j*e k l=if j=k then e i l else 0) ∧ + (∑ i, e i i)=1 ∧ (∀ i j, star (e i j)=e j i) ∧ + (∀ i, e i i=p i) := by + choose v hv using fun i => projection_equivalent_of_trace M τ hF (p i₀) (p i) + (hp i₀) (hp i) (hτ i).symm + have hvpartial (i : ι) : Partial (v i) := partial_of_initial_projection (by rw [(hv i).1]; exact hp i₀) + have hvp (i : ι) : v i*p i₀=v i := by rw [← (hv i).1,← mul_assoc]; exact hvpartial i + have hpv (i : ι) : p i*v i=v i := by rw [← (hv i).2]; exact hvpartial i + have hsvp (i : ι) : star (v i)*p i=star (v i) := by + simpa only [star_mul,(hp i).isSelfAdjoint.star_eq] using congrArg star (hpv i) + have hprod (i j : ι) : star (v i)*v j=if i=j then p i₀ else 0 := by + by_cases hij : i=j + · subst j; simpa only [ite_true] using (hv i).1 + · rw [ite_eq_right hij] + calc + star (v i)*v j = (star (v i)*p i)*(p j*v j) := by rw [hsvp,hpv] + _ = star (v i)*(p i*p j)*v j := by simp only [mul_assoc] + _ = 0 := by rw [horth i j hij,mul_zero,zero_mul] + let e (i j : ι) := v i*star (v j) + refine ⟨e,?_,?_,?_,?_⟩ + · intro i j k l + change (v i*star (v j))*(v k*star (v l))=if j=k then v i*star (v l) else 0 + calc + (v i*star (v j))*(v k*star (v l)) = (v i*(star (v j)*v k))*star (v l) := by simp only [mul_assoc] + _ = if j=k then v i*star (v l) else 0 := by rw [hprod]; split_ifs <;> simp only [hvp,mul_zero,zero_mul] + · simpa only [e,funext (fun i => (hv i).2)] using h1 + · intro i j; simp only [e,star_mul,star_star] + · intro i + exact (hv i).2 + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance projectionRoundPartialOrder₂ (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance projectionRoundPreorder₂ (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance projectionRoundLE₂ (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance projectionRoundStarOrderedRing₂ (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem subprojections_orthogonal {M : VonNeumannAlgebra H} + {p q a b : ConcreteAlgebra M} (hp : IsStarProjection p) (hq : IsStarProjection q) + (ha : IsStarProjection a) (hb : IsStarProjection b) + (hap : a ≤ p) (hbq : b ≤ q) (hpq : p*q=0) : a*b=0 := by + calc + a*b = (a*p)*(q*b) := by rw [(ha.le_iff_mul_eq_left hp).mp hap, + (hb.le_iff_mul_eq_right hq).mp hbq] + _ = a*(p*q)*b := by simp only [mul_assoc] + _ = 0 := by rw [hpq,mul_zero,zero_mul] + +theorem orthogonal_sum_projection {ι A : Type*} [Fintype ι] [Ring A] [StarRing A] + (p : ι → A) (hp : ∀ i, IsStarProjection (p i)) + (ho : ∀ i j, i≠j → p i*p j=0) : IsStarProjection (∑ i, p i) := by + classical + have hm (i j : ι) : p i*p j=if i=j then p i else 0 := by + split_ifs with h + · subst j; exact (hp i).isIdempotentElem.eq + · exact ho i j h + constructor + · change (∑ i, p i)*(∑ i, p i)=∑ i, p i + simp only [Finset.sum_mul,Finset.mul_sum,hm,Finset.sum_ite_eq',Finset.mem_univ,ite_true] + · change star (∑ i, p i)=∑ i, p i + simp only [star_sum,fun i => (hp i).isSelfAdjoint.star_eq] + +theorem round_projection_partition {ι : Type*} [Fintype ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (hD : IsDiffuse M) + (p : ι → ConcreteAlgebra M) (hp : ∀ i, IsStarProjection (p i)) + (ho : ∀ i j, i≠j → p i*p j=0) (h1 : ∑ i, p i=1) + (ε : ℝ) (hε : 0 < ε) : + ∃ (n : ℕ) (_ : 0 < n) (k : ι → ℕ) (r : ℕ) + (q : ι → ConcreteAlgebra M) (s : ConcreteAlgebra M), + (∑ i, k i)+r=n ∧ + (∀ i, IsStarProjection (q i)) ∧ (∀ i, q i ≤ p i) ∧ + (∀ i j, i≠j → q i*q j=0) ∧ + (∀ i, τ.map (q i)=(k i:ℂ)*(n:ℂ)⁻¹) ∧ + IsStarProjection s ∧ s=1-∑ i, q i ∧ + τ.map s=(r:ℂ)*(n:ℂ)⁻¹ ∧ (τ.map s).re < ε := by + classical + let w : ι → ℝ := fun i => (τ.map (p i)).re + have hw (i : ι) : 0 ≤ w i := (Complex.nonneg_iff.mp (trace_projection_nonneg τ (hp i))).1 + have hw1 : ∑ i, w i=1 := by + change (∑ i, (τ.map (p i)).re)=1 + rw [← Complex.re_sum,← map_sum,h1,τ.normalized,Complex.one_re] + obtain ⟨n,hn,k,r,hkr,hkw,hr⟩ := round_probability_weights w hw hw1 ε hε + have hnC : (n:ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.ne_of_gt hn) + have hnR : (0:ℝ) < n := Nat.cast_pos.mpr hn + choose q hq hqp hτq using fun i => projection_with_trace M τ hD (p i) (hp i) + ((k i:ℝ)/(n:ℝ)) (div_nonneg (Nat.cast_nonneg _) hnR.le) (hkw i) + have hqle (i : ι) : q i ≤ p i := ((hq i).le_iff_mul_eq_left (hp i)).mpr (hqp i) + have hqo (i j : ι) (hij : i≠j) : q i*q j=0 := + subprojections_orthogonal (hp i) (hp j) (hq i) (hq j) (hqle i) (hqle j) (ho i j hij) + have hsum := orthogonal_sum_projection q hq hqo + have hle : (∑ i, q i) ≤ (1 : ConcreteAlgebra M) := by + rw [← h1] + exact Finset.sum_le_sum (fun i _ => hqle i) + let s : ConcreteAlgebra M := 1-∑ i, q i + have hs : IsStarProjection s := (hsum.le_iff_sub (IsStarProjection.one _)).mp hle + have hτq' (i : ι) : τ.map (q i)=(k i:ℂ)*(n:ℂ)⁻¹ := by + rw [hτq i,Complex.ofReal_div,Complex.ofReal_natCast,Complex.ofReal_natCast,div_eq_mul_inv] + have hτs : τ.map s=(r:ℂ)*(n:ℂ)⁻¹ := by + dsimp only [s] + rw [map_sub,τ.normalized,map_sum] + simp only [hτq',← Finset.sum_mul,← Nat.cast_sum] + have hkrC : ((∑ i, k i):ℂ)+(r:ℂ)=(n:ℂ) := by exact_mod_cast hkr + push_cast + field_simp + linear_combination -hkrC + refine ⟨n,hn,k,r,q,s,hkr,hq,hqle,hqo,hτq',hs,rfl,hτs,?_⟩ + rw [hτs] + have he : ((r:ℂ)*(n:ℂ)⁻¹).re=(r:ℝ)/(n:ℝ) := by + rw [← div_eq_mul_inv,← Complex.ofReal_natCast r,← Complex.ofReal_natCast n, + ← Complex.ofReal_div,Complex.ofReal_re] + rw [he] + exact hr + +end + +end KKProjectionSupport + +namespace KKTraceTransfer + +open KKUltraTrace KKProjectionSupport + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance projectionRoundPartialOrder₃ (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance projectionRoundPreorder₃ (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance projectionRoundLE₃ (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance projectionRoundStarOrderedRing₃ (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem traceNorm_eq_gns {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (a : ConcreteAlgebra M) : traceNorm τ a=‖gnsVector (tracePositive τ) a‖ := by + rw [@norm_eq_sqrt_re_inner ℂ,gnsVector_inner] + rfl + +theorem traceNorm_nonneg {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (a : ConcreteAlgebra M) : 0 ≤ traceNorm τ a := Real.sqrt_nonneg _ + +theorem traceNorm_add_le {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (a b : ConcreteAlgebra M) : traceNorm τ (a+b) ≤ traceNorm τ a+traceNorm τ b := by + simp only [traceNorm_eq_gns,map_add] + exact norm_add_le _ _ + +theorem traceNorm_mul_le {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (a b : ConcreteAlgebra M) : traceNorm τ (a*b) ≤ ‖a‖*traceNorm τ b := by + simp only [traceNorm_eq_gns] + rw [← gnsStarAlgHom_vector] + exact (((tracePositive τ).gnsStarAlgHom a).le_opNorm _).trans + (mul_le_mul_of_nonneg_right (NonUnitalStarAlgHom.norm_apply_le _ _) (norm_nonneg _)) + +theorem traceNorm_one {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) : + traceNorm τ 1=1 := by + simp only [traceNorm,star_one,mul_one,τ.normalized,Complex.one_re,Real.sqrt_one] + +theorem traceNorm_le_norm {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (a : ConcreteAlgebra M) : traceNorm τ a ≤ ‖a‖ := by + simpa only [mul_one,traceNorm_one] using traceNorm_mul_le τ a 1 + +theorem traceNorm_projection_sq {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + {p : ConcreteAlgebra M} (hp : IsStarProjection p) : (traceNorm τ p)^2=(τ.map p).re := by + have h := congrArg Complex.re (traceNorm_sq τ p) + simpa only [Complex.ofReal_re,hp.isSelfAdjoint.star_eq,hp.isIdempotentElem.eq] using h + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ProjectionSmall.lean b/lean/OAI/Analysis/FreeWords/ProjectionSmall.lean new file mode 100644 index 0000000000000000000000000000000000000000..35a3e645b06a4fcc9e5a5129c5259ace60e7a40a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ProjectionSmall.lean @@ -0,0 +1,102 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorCorners +import OAI.Analysis.FreeWords.TraceTransfer + +namespace OAI + +noncomputable section + +namespace KKFreeLiftFrontier + +open KKTraceTransfer + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def IsDiffuse (M : VonNeumannAlgebra H) : Prop := + ∀ p : ConcreteAlgebra M, IsStarProjection p → p ≠ 0 → + ∃ q : ConcreteAlgebra M, IsStarProjection q ∧ q ≠ 0 ∧ q ≠ p ∧ q * p = q + +end KKFreeLiftFrontier + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +open Filter Topology + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance projectionSmallPartialOrder (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance projectionSmallPreorder (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance projectionSmallLE (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance projectionSmallStarOrderedRing (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem trace_projection_nonneg {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + {p : ConcreteAlgebra M} (hp : IsStarProjection p) : 0 ≤ τ.map p := by + have h := trace_square_nonneg τ p + simpa only [hp.isSelfAdjoint.star_eq,hp.isIdempotentElem.eq] using h + +theorem trace_projection_pos {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + {p : ConcreteAlgebra M} (hp : IsStarProjection p) (hp0 : p ≠ 0) : 0 < (τ.map p).re := by + have hn := Complex.nonneg_iff.mp (trace_projection_nonneg τ hp) + apply lt_of_le_of_ne hn.1 + intro he + exact trace_projection_ne_zero τ hp hp0 (Complex.ext he.symm hn.2.symm) + +theorem projection_half {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (hD : IsDiffuse M) {p : ConcreteAlgebra M} (hp : IsStarProjection p) (hp0 : p ≠ 0) : + ∃ q : ConcreteAlgebra M, IsStarProjection q ∧ q ≠ 0 ∧ q ≤ p ∧ + (τ.map q).re ≤ (τ.map p).re/2 := by + obtain ⟨q,hq,hq0,hqp0,hqp⟩ := hD p hp hp0 + have hle : q ≤ p := (hq.le_iff_mul_eq_left hp).mpr hqp + have hr : IsStarProjection (p-q) := (hq.le_iff_sub hp).mp hle + have hr0 : p-q ≠ 0 := fun h => hqp0 (sub_eq_zero.mp h).symm + by_cases hqsmall : (τ.map q).re ≤ (τ.map p).re/2 + · exact ⟨q,hq,hq0,hle,hqsmall⟩ + · refine ⟨p-q,hr,hr0,?_,?_⟩ + · exact sub_le_self _ hq.nonneg + · simp only [map_sub,Complex.sub_re] + linarith + +theorem projection_trace_dyadic {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (hD : IsDiffuse M) {p : ConcreteAlgebra M} (hp : IsStarProjection p) (hp0 : p ≠ 0) + (n : ℕ) : ∃ q : ConcreteAlgebra M, IsStarProjection q ∧ q ≠ 0 ∧ q ≤ p ∧ + (τ.map q).re ≤ (τ.map p).re/(2:ℝ)^n := by + induction n with + | zero => exact ⟨p,hp,hp0,le_rfl,by simp⟩ + | succ n ih => + obtain ⟨q,hq,hq0,hqp,hτq⟩ := ih + obtain ⟨r,hr,hr0,hrq,hτr⟩ := projection_half τ hD hq hq0 + refine ⟨r,hr,hr0,hrq.trans hqp,?_⟩ + calc + (τ.map r).re ≤ (τ.map q).re/2 := hτr + _ ≤ ((τ.map p).re/(2:ℝ)^n)/2 := div_le_div_of_nonneg_right hτq (by norm_num) + _ = (τ.map p).re/(2:ℝ)^(n+1) := by rw [pow_succ,div_div] + +theorem exists_small_projection {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (hD : IsDiffuse M) {p : ConcreteAlgebra M} (hp : IsStarProjection p) (hp0 : p ≠ 0) + (ε : ℝ) (hε : 0 < ε) : + ∃ q : ConcreteAlgebra M, IsStarProjection q ∧ q ≠ 0 ∧ q ≤ p ∧ (τ.map q).re < ε := by + have ht : Tendsto (fun n : ℕ => (τ.map p).re/(2:ℝ)^n) atTop (𝓝 0) := by + exact tendsto_const_nhds.div_atTop (tendsto_pow_atTop_atTop_of_one_lt (by norm_num : (1:ℝ)<2)) + obtain ⟨n,hn⟩ := (ht.eventually (eventually_lt_nhds hε)).exists + obtain ⟨q,hq,hq0,hqp,hτq⟩ := projection_trace_dyadic τ hD hp hp0 n + exact ⟨q,hq,hq0,hqp,hτq.trans_lt hn⟩ + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ProjectionStructure.lean b/lean/OAI/Analysis/FreeWords/ProjectionStructure.lean new file mode 100644 index 0000000000000000000000000000000000000000..61514de8a18d9fbca9a858c69811669f67fc6daf --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ProjectionStructure.lean @@ -0,0 +1,119 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorCorners +import OAI.Analysis.FreeWords.PartialIsoChain +import OAI.Analysis.FreeWords.PartialIsoResidual +import OAI.Analysis.FreeWords.PolarBounds + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem concrete_projection_coe {M : VonNeumannAlgebra H} {p : ConcreteAlgebra M} + (hp : IsStarProjection p) : IsStarProjection (p : H →L[ℂ] H) := + ⟨congrArg Subtype.val hp.1, congrArg Subtype.val hp.2⟩ + +theorem exists_maximal_concrete_partialIso (M : VonNeumannAlgebra H) + (p q : ConcreteAlgebra M) : ∃ v : PartialIso (ConcreteAlgebra M), + Maximal (fun v : PartialIso (ConcreteAlgebra M) => v.value*p=v.value ∧ q*v.value=v.value) v := by + obtain ⟨V,hV⟩ := exists_maximal_partialIso M (p : H →L[ℂ] H) (q : H →L[ℂ] H) + let v : PartialIso (ConcreteAlgebra M) := + ⟨⟨V.value,hV.1.1⟩, by apply Subtype.ext; exact V.isPartial⟩ + refine ⟨v, ⟨Subtype.ext hV.1.2.1, Subtype.ext hV.1.2.2⟩, ?_⟩ + intro w hw hvw + let W : PartialIso (H →L[ℂ] H) := + ⟨(w.value : H →L[ℂ] H), congrArg Subtype.val w.isPartial⟩ + have hW : W.value ∈ M ∧ W.value*(p : H →L[ℂ] H)=W.value ∧ (q : H →L[ℂ] H)*W.value=W.value := + ⟨w.value.property, congrArg Subtype.val hw.1, congrArg Subtype.val hw.2⟩ + have hVW : V ≤ W := ⟨congrArg Subtype.val hvw.1, congrArg Subtype.val hvw.2⟩ + have hWV := hV.2 hW hVW + exact ⟨Subtype.ext hWV.1, Subtype.ext hWV.2⟩ + +theorem factor_partial_in_corner {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (hM : IsFactor M) {p q : ConcreteAlgebra M} (hp : IsStarProjection p) + (hq : IsStarProjection q) (hp0 : p ≠ 0) (hq0 : q ≠ 0) : + ∃ v : ConcreteAlgebra M, Partial v ∧ v*p=v ∧ q*v=v ∧ v ≠ 0 := by + obtain ⟨a,ha⟩ := factor_nonzero_corner τ hM hp hp0 hq0 + let b : ConcreteAlgebra M := q*a*p + have hbp : b*p=b := by dsimp [b]; rw [mul_assoc, hp.isIdempotentElem.eq] + have hqb : q*b=b := by dsimp [b]; rw [← mul_assoc, ← mul_assoc, hq.isIdempotentElem.eq] + obtain ⟨v,hvM,hv,hvp,hqv,hv0⟩ := KKPolarSupport.polar_decomposition_bounds M + (b : H →L[ℂ] H) b.property (p : H →L[ℂ] H) (q : H →L[ℂ] H) + (concrete_projection_coe hp) (concrete_projection_coe hq) + (congrArg Subtype.val hbp) (congrArg Subtype.val hqb) + refine ⟨⟨v,hvM⟩, Subtype.ext hv, Subtype.ext hvp, Subtype.ext hqv, ?_⟩ + intro h0 + exact ha (Subtype.ext (hv0 (congrArg Subtype.val h0))) + +theorem projection_comparable_by_trace (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M) (hM : IsFactor M) (p q : ConcreteAlgebra M) + (hp : IsStarProjection p) (hq : IsStarProjection q) : + ∃ v : ConcreteAlgebra M, Partial v ∧ v*p=v ∧ q*v=v ∧ + (star v*v=p ∨ v*star v=q) := by + obtain ⟨V,hV⟩ := exists_maximal_concrete_partialIso M p q + let v : ConcreteAlgebra M := V.value + have hv : Partial v := V.isPartial + have hvp : v*p=v := hV.1.1 + have hqv : q*v=v := hV.1.2 + have hpi := initial_bound hp hvp + have hqi := final_bound hq hqv + have hpr := projection_sub hp (partial_initial hv) hpi.1 + have hqr := projection_sub hq (partial_final hv) hqi.1 + refine ⟨v,hv,hvp,hqv,?_⟩ + by_contra! hne + have hp0 : p-star v*v ≠ 0 := fun h => hne.1 (sub_eq_zero.mp h).symm + have hq0 : q-v*star v ≠ 0 := fun h => hne.2 (sub_eq_zero.mp h).symm + obtain ⟨w,hw,hwp,hqw,hw0⟩ := factor_partial_in_corner τ hM hpr hqr hp0 hq0 + have hcross := orthogonal_of_residual hv hp hq hvp hqv hwp hqw + have hsum := partial_add_orthogonal hv hw hcross.1 hcross.2 + have hwp' : w*p=w := by + calc + w*p = (w*(p-star v*v))*p := by rw [hwp] + _ = w*((p-star v*v)*p) := mul_assoc _ _ _ + _ = w*(p-star v*v) := by rw [sub_mul, hp.isIdempotentElem.eq, hpi.1] + _ = w := hwp + have hqw' : q*w=w := by + calc + q*w = q*((q-v*star v)*w) := by rw [hqw] + _ = (q*(q-v*star v))*w := (mul_assoc _ _ _).symm + _ = (q-v*star v)*w := by rw [mul_sub, hq.isIdempotentElem.eq, hqi.2] + _ = w := hqw + let W : PartialIso (ConcreteAlgebra M) := ⟨v+w,hsum.1⟩ + have hW : W.value*p=W.value ∧ q*W.value=W.value := by + exact ⟨by change (v+w)*p=v+w; rw [add_mul,hvp,hwp'], + by change q*(v+w)=v+w; rw [mul_add,hqv,hqw']⟩ + have he : V=W := hV.eq_of_le hW hsum.2 + have he' : v=v+w := congrArg PartialIso.value he + exact hw0 (add_left_cancel (show v+w=v+0 by rw [← he',add_zero])) + +theorem projection_equivalent_of_trace (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M) (hM : IsFactor M) (p q : ConcreteAlgebra M) + (hp : IsStarProjection p) (hq : IsStarProjection q) (hτ : τ.map p = τ.map q) : + ∃ v : ConcreteAlgebra M, star v*v = p ∧ v*star v = q := by + obtain ⟨v,hv,hvp,hqv,he⟩ := projection_comparable_by_trace M τ hM p q hp hq + have hpr := projection_sub hp (partial_initial hv) (initial_bound hp hvp).1 + have hqr := projection_sub hq (partial_final hv) (final_bound hq hqv).1 + have hτr : τ.map (p-star v*v)=τ.map (q-v*star v) := by + rw [map_sub,map_sub,hτ,τ.tracial] + have hzero {e : ConcreteAlgebra M} (he : IsStarProjection e) (ht : τ.map e=0) : e=0 := by + by_contra hz + exact trace_projection_ne_zero τ he hz ht + rcases he with he | he + · have ht : τ.map (q-v*star v)=0 := by rw [← hτr,he,sub_self,map_zero] + exact ⟨v,he,(sub_eq_zero.mp (hzero hqr ht)).symm⟩ + · have ht : τ.map (p-star v*v)=0 := by rw [hτr,he,sub_self,map_zero] + exact ⟨v,(sub_eq_zero.mp (hzero hpr ht)).symm,he⟩ + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ProjectionSubdivision.lean b/lean/OAI/Analysis/FreeWords/ProjectionSubdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..89b1e0cb8175c6e413bf5289948d578fecbe3425 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ProjectionSubdivision.lean @@ -0,0 +1,176 @@ +import Mathlib +import OAI.Analysis.FreeWords.ProjectionChain +import OAI.Analysis.FreeWords.ProjectionSmall + +namespace OAI + +noncomputable section + +namespace KKFreeLiftFrontier + +open KKTraceTransfer + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end KKFreeLiftFrontier + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +open Filter Topology + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance projectionSubdivisionPartialOrder₁ (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance projectionSubdivisionPreorder₁ (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance projectionSubdivisionLE₁ (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance projectionSubdivisionStarOrderedRing₁ (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport + +open UniversalStrongKK Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance projectionSubdivisionPartialOrder₂ (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance projectionSubdivisionPreorder₂ (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance projectionSubdivisionLE₂ (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance projectionSubdivisionStarOrderedRing₂ (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport KKFreeLiftFrontier + +open UniversalStrongKK Filter Topology + +open scoped ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance projectionSubdivisionPartialOrder₃ (M : VonNeumannAlgebra H) : + PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance projectionSubdivisionPreorder₃ (M : VonNeumannAlgebra H) : + Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance projectionSubdivisionLE₃ (M : VonNeumannAlgebra H) : + LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance projectionSubdivisionStarOrderedRing₃ (M : VonNeumannAlgebra H) : + StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem exists_maximal_projection_trace (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (p : ConcreteAlgebra M) (hp : IsStarProjection p) (t : ℝ) (ht : 0 ≤ t) : + ∃ q : {x : ConcreteAlgebra M // IsStarProjection x}, + Maximal (fun q : {x : ConcreteAlgebra M // IsStarProjection x} => + q.val ≤ p ∧ (τ.map q.val).re ≤ t) q := by + let P := {x : ConcreteAlgebra M // IsStarProjection x} + let S : Set P := {q | q.val ≤ p ∧ (τ.map q.val).re ≤ t} + let z : P := ⟨0,IsStarProjection.zero _⟩ + have hz : z ∈ S := ⟨hp.nonneg,by simpa [z] using ht⟩ + obtain ⟨q,hzq,hq⟩ := zorn_le_nonempty₀ S (fun c hc hchain y hy => by + let : Nonempty c := ⟨⟨y,hy⟩⟩ + let : IsDirectedOrder c := ⟨fun a b => by + obtain ⟨k,hk,hak,hbk⟩ := hchain.directedOn a.val a.property b.val b.property + exact ⟨⟨k,hk⟩,hak,hbk⟩⟩ + obtain ⟨v,hv,hfv,ω,hω,hlim⟩ := projection_directed_limit + (fun i : c => i.val.val) (fun i => i.val.property) (fun _ _ hij => hij) + have hvp : v ≤ p := by + apply (hv.le_iff_mul_eq_left hp).mpr + apply Subtype.ext + have ht' := wot_mul_const hlim (p : H →L[ℂ] H) + have he (i : c) : (i.val.val : H →L[ℂ] H)*(p : H →L[ℂ] H)=i.val.val := + congrArg Subtype.val ((i.val.property.le_iff_mul_eq_left hp).mp (hc i.property).1) + simp only [he] at ht' + exact congrArg ContinuousLinearMapWOT.toCLM (tendsto_nhds_unique ht' hlim) + have htrace := trace_tendsto_bounded_wot τ (fun i : c => i.val.property.norm_le) hv.norm_le hlim + have htr : (τ.map v).re ≤ t := le_of_tendsto + (Complex.continuous_re.tendsto _ |>.comp htrace) (Eventually.of_forall fun i => (hc i.property).2) + exact ⟨⟨v,hv⟩,⟨hvp,htr⟩,fun i hi => hfv ⟨i,hi⟩⟩) z hz + exact ⟨q,hq⟩ + +theorem projection_with_trace (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hD : IsDiffuse M) (p : ConcreteAlgebra M) (hp : IsStarProjection p) + (t : ℝ) (ht0 : 0 ≤ t) (htp : t ≤ (τ.map p).re) : + ∃ q : ConcreteAlgebra M, IsStarProjection q ∧ q*p=q ∧ τ.map q=(t : ℂ) := by + obtain ⟨Q,hQ⟩ := exists_maximal_projection_trace M τ p hp t ht0 + let q : ConcreteAlgebra M := Q.val + have hq : IsStarProjection q := Q.property + have hqp : q ≤ p := hQ.1.1 + have hqt : (τ.map q).re ≤ t := hQ.1.2 + have hτ : (τ.map q).re=t := by + by_contra hne + have hlt : (τ.map q).re + (U : Matrix (Fin d) (Fin d) ℂ) a b) := + (matrixApplyCLM a b).continuous.comp continuous_subtype_val + exact (((he i z).mul (he j z).star).mul (he k z)).mul (he l z).star + +theorem rankOne_pair_expansion (z : Fin d) (U : Matrix.unitaryGroup (Fin d) ℂ) + (x y : ConcreteAlgebra M) : + τ.map (rankOne ρ z U*x*rankOne ρ z U*y)= + ∑ i,∑ j,∑ k,∑ l, columnQuartic z i j k l U * τ.map (matrixUnit ρ i j*x*matrixUnit ρ k l*y) := by + have hleft (A : ConcreteAlgebra M) : + τ.map (rankOne ρ z U*x*A*y)=∑ i,∑ j, + ((U : Matrix (Fin d) (Fin d) ℂ) i z*star ((U : Matrix (Fin d) (Fin d) ℂ) j z)) * + τ.map (matrixUnit ρ i j*x*A*y) := by + rw [rankOne_expansion] + simp only [Finset.sum_mul,smul_mul_assoc,map_sum,map_smul,smul_eq_mul] + rw [hleft] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + rw [rankOne_expansion] + simp only [Finset.mul_sum,Finset.sum_mul,mul_smul_comm,smul_mul_assoc, + map_sum,map_smul,smul_eq_mul,columnQuartic] + apply Finset.sum_congr rfl + intro k hk + apply Finset.sum_congr rfl + intro l hl + ring + +theorem continuous_rankOne_pair (z : Fin d) (x y : ConcreteAlgebra M) : + Continuous (fun U => τ.map (rankOne ρ z U*x*rankOne ρ z U*y)) := by + simp_rw [rankOne_pair_expansion] + apply continuous_finsetSum _ + intro i hi + apply continuous_finsetSum _ + intro j hj + apply continuous_finsetSum _ + intro k hk + apply continuous_finsetSum _ + intro l hl + exact (continuous_columnQuartic z i j k l).mul continuous_const + +theorem integral_rankOne_pair (hd : 2 ≤ d) (z : Fin d) (x y : ConcreteAlgebra M) : + (∫ U : Matrix.unitaryGroup (Fin d) ℂ, τ.map (rankOne ρ z U*x*rankOne ρ z U*y) ∂matrixHaar d) = + ((d : ℂ)*((d : ℂ)+1))⁻¹ * (τ.map (x*y)+(d : ℂ)*τ.map (matrixAverage ρ x*y)) := by + have : NeZero d := ⟨by omega⟩ + have hint (i j k l : Fin d) : + Integrable (fun U => columnQuartic z i j k l U*τ.map (matrixUnit ρ i j*x*matrixUnit ρ k l*y)) (matrixHaar d) := + ((continuous_columnQuartic z i j k l).mul continuous_const).integrable_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) + have hfour (f : Fin d → Fin d → Fin d → Fin d → Matrix.unitaryGroup (Fin d) ℂ → ℂ) + (hf : ∀ i j k l, Integrable (f i j k l) (matrixHaar d)) : + (∫ U, ∑ i,∑ j,∑ k,∑ l,f i j k l U ∂matrixHaar d)= + ∑ i,∑ j,∑ k,∑ l,∫ U,f i j k l U ∂matrixHaar d := by + rw [integral_finsetSum _ (fun _ _ => integrable_finsetSum _ (fun _ _ => integrable_finsetSum _ + (fun _ _ => integrable_finsetSum _ (fun _ _ => hf _ _ _ _))))] + apply Finset.sum_congr rfl + intro i hi + rw [integral_finsetSum _ (fun _ _ => integrable_finsetSum _ + (fun _ _ => integrable_finsetSum _ (fun _ _ => hf _ _ _ _)))] + apply Finset.sum_congr rfl + intro j hj + rw [integral_finsetSum _ (fun _ _ => integrable_finsetSum _ (fun _ _ => hf _ _ _ _))] + apply Finset.sum_congr rfl + intro k hk + rw [integral_finsetSum _ (fun _ _ => hf _ _ _ _)] + have hm (i j k l : Fin d) : (∫ U,columnQuartic z i j k l U ∂matrixHaar d)= + ((d : ℂ)*((d : ℂ)+1))⁻¹ * + ((if i=j ∧ k=l then 1 else 0)+(if i=l ∧ k=j then 1 else 0)) := haar_column_fourth d hd z i j k l + simp_rw [rankOne_pair_expansion] + rw [hfour _ hint] + simp_rw [integral_mul_const,hm] + simp only [mul_assoc,← Finset.mul_sum] + congr 1 + simp only [add_mul,Finset.sum_add_distrib,ite_mul,one_mul,zero_mul,ite_and] + simp only [Finset.sum_const_zero,Finset.sum_ite_irrel,Finset.sum_ite_eq,Finset.sum_ite_eq',Finset.mem_univ,ite_true] + have hd0 : (d : ℂ)≠0 := by exact_mod_cast (by omega : d≠0) + have hfirst : (∑ i,∑ k, τ.map (matrixUnit ρ i i*x*matrixUnit ρ k k*y))=τ.map (x*y) := by + simp only [← map_sum,← Finset.mul_sum,← Finset.sum_mul,matrixUnit_sum_diag,mul_one,one_mul] + simp only [← mul_assoc] at ⊢ + rw [hfirst] + congr 1 + simp only [matrixAverage,matrixUnit,Fintype.card_fin,smul_mul_assoc,Finset.sum_mul,map_smul,map_sum,smul_eq_mul, + mul_inv_cancel_left₀ hd0] + +end + +end KKMatrixQuantization +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RationalWeights.lean b/lean/OAI/Analysis/FreeWords/RationalWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..93f6478d36455d14a6680805333d16b4d42ff1a2 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RationalWeights.lean @@ -0,0 +1,53 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +noncomputable section + +theorem round_probability_weights {ι : Type*} [Fintype ι] + (w : ι → ℝ) (hw : ∀ i, 0 ≤ w i) (h1 : ∑ i, w i=1) + (ε : ℝ) (hε : 0 < ε) : + ∃ (n : ℕ) (_ : 0 < n) (k : ι → ℕ) (r : ℕ), + (∑ i, k i)+r=n ∧ (∀ i, (k i:ℝ)/(n:ℝ) ≤ w i) ∧ (r:ℝ)/(n:ℝ) < ε := by + classical + obtain ⟨n,hn⟩ := exists_nat_gt (max (1:ℝ) ((Fintype.card ι : ℝ)/ε)) + have hn0 : 0 < n := by + have : (0:ℝ) < n := lt_trans zero_lt_one ((le_max_left _ _).trans_lt hn) + exact_mod_cast this + have hnr : (0:ℝ) < n := Nat.cast_pos.mpr hn0 + let k : ι → ℕ := fun i => ⌊(n:ℝ)*w i⌋₊ + have hk (i : ι) : (k i : ℝ) ≤ (n:ℝ)*w i := Nat.floor_le (mul_nonneg hnr.le (hw i)) + have hkn : (∑ i, k i) ≤ n := by + have hh := Finset.sum_le_sum (fun i (_hi : i ∈ Finset.univ) => hk i) + rw [← Finset.mul_sum,h1,mul_one,← Nat.cast_sum] at hh + exact_mod_cast hh + let r := n-∑ i, k i + refine ⟨n,hn0,k,r,Nat.add_sub_of_le hkn,?_,?_⟩ + · intro i + exact (div_le_iff₀ hnr).mpr (by simpa only [mul_comm] using hk i) + · have hsum := Finset.sum_le_sum (fun i (_hi : i ∈ Finset.univ) => + (Nat.lt_floor_add_one ((n:ℝ)*w i)).le) + change (∑ i, (n:ℝ)*w i) ≤ ∑ i, ((k i:ℝ)+1) at hsum + rw [← Finset.mul_sum,h1,mul_one,Finset.sum_add_distrib,Finset.sum_const, + Finset.card_univ,nsmul_eq_mul,mul_one,← Nat.cast_sum] at hsum + have hr : (r:ℝ) ≤ (Fintype.card ι:ℝ) := by + dsimp only [r] + rw [Nat.cast_sub hkn] + linarith + have hcard : (Fintype.card ι:ℝ)/(n:ℝ) < ε := by + apply (div_lt_iff₀ hnr).mpr + have hn' := (le_max_right (1:ℝ) ((Fintype.card ι:ℝ)/ε)).trans_lt hn + have hh := (div_lt_iff₀ hε).mp hn' + nlinarith + exact (div_le_div_of_nonneg_right hr hnr.le).trans_lt hcard + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RecoveryArithmetic.lean b/lean/OAI/Analysis/FreeWords/RecoveryArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5c3608ed8d22f7813f8ad1707707540370cb5bb --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RecoveryArithmetic.lean @@ -0,0 +1,35 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +theorem recovery_moment_arithmetic {n N m2 m4 b2 b4 s : ℝ} + (hn : 0 < n) (hN : 100*n ≤ N) (henergy : 2*N/3 ≤ m2) + (hfourth : m4 ≤ N^2*m2) (hb2 : n*b2 = m2) + (hb4 : n^3*b4 = m4+2*(n-1)*m2^2) + (hs0 : 0 ≤ s) (hinterp : b2^3 ≤ s^2*b4) : 3/5 ≤ s := by + have hN0 : 0 ≤ N := by linarith + have hm2 : 0 < m2 := by linarith + have hn2 : 8*n ≤ m2 := by linarith + have hNN : N ≤ 3/2*m2 := by linarith + have hNN2 := pow_le_pow_left₀ hN0 hNN 2 + have hNm := mul_le_mul_of_nonneg_right hNN2 hm2.le + have hnm := mul_le_mul_of_nonneg_right hn2 (sq_nonneg m2) + have hD : n^3*b4 ≤ 5/2*m2^3 := by nlinarith [sq_nonneg m2] + have hI : m2^3 ≤ s^2*(n^3*b4) := by + calc m2^3 = (n*b2)^3 := by rw [hb2] + _ = n^3*b2^3 := mul_pow n b2 3 + _ ≤ n^3*(s^2*b4) := mul_le_mul_of_nonneg_left hinterp (by positivity) + _ = _ := by ring + have hI' := hI.trans (mul_le_mul_of_nonneg_left hD (sq_nonneg s)) + have he : m2^3*1 ≤ m2^3*(5/2*s^2) := by nlinarith [hI'] + have hs := (mul_le_mul_iff_right₀ (pow_pos hm2 3)).mp he + nlinarith + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RegularizedOrder.lean b/lean/OAI/Analysis/FreeWords/RegularizedOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..255f92e33f0853e4eb26827185f344ffd984b482 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RegularizedOrder.lean @@ -0,0 +1,150 @@ +import Mathlib +import OAI.Analysis.FreeWords.DirichletMoments + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped BigOperators + +noncomputable section + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +theorem real_regularization_lower {x : ℝ} (hx : 0 ≤ x) : + Real.sqrt x - 1/10 ≤ x * (Real.sqrt (x+1/100))⁻¹ := by + have ha := Real.sqrt_nonneg x + have hb := Real.sqrt_nonneg (x+1/100) + have ha2 := Real.sq_sqrt hx + have hb2 := Real.sq_sqrt (by linarith : 0 ≤ x+1/100) + have hbp : 0 < Real.sqrt (x+1/100) := Real.sqrt_pos.mpr (by linarith) + have hab : Real.sqrt (x+1/100) ≤ Real.sqrt x + 1/10 := by nlinarith + rw [← div_eq_mul_inv] + apply (le_div_iff₀ hbp).mpr + by_cases h : Real.sqrt x ≤ 1/10 + · have hm := mul_nonpos_of_nonpos_of_nonneg (sub_nonpos.mpr h) hb + linarith + · have hm := mul_le_mul_of_nonneg_left hab (by linarith : 0 ≤ Real.sqrt x-1/10) + nlinarith + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +theorem regularizer_continuous {x : A} (hx : 0 ≤ x) : + ContinuousOn (fun t : ℝ => (Real.sqrt (t+1/100))⁻¹) (spectrum ℝ x) := by + apply ContinuousOn.inv₀ ((continuous_id.add continuous_const).sqrt.continuousOn) + intro t ht + apply ne_of_gt + apply Real.sqrt_pos.mpr + have := spectrum_nonneg_of_nonneg hx ht + change 0 < t + 1/100 + linarith + +theorem regularized_order_lower {x : A} (hx : 0 ≤ x) : + CFC.sqrt x - (1/10:ℝ) • (1:A) ≤ + x*cfc (fun t : ℝ => (Real.sqrt (t+1/100))⁻¹) x := by + have hxs : IsSelfAdjoint x := IsSelfAdjoint.of_nonneg hx + have hr := regularizer_continuous hx + have h := (cfc_le_iff (fun t : ℝ => Real.sqrt t-1/10) + (fun t : ℝ => t * (Real.sqrt (t+1/100))⁻¹) x + ((Real.continuous_sqrt.sub continuous_const).continuousOn) + (continuousOn_id.mul hr) hxs).mpr (fun t ht => + real_regularization_lower (spectrum_nonneg_of_nonneg hx ht)) + rw [cfc_sub Real.sqrt (fun _ : ℝ => 1/10),cfc_const (1/10:ℝ) x hxs, + cfc_mul (fun t : ℝ => t) (fun t : ℝ => (Real.sqrt (t+1/100))⁻¹) x continuousOn_id hr, + cfc_id' ℝ x hxs,Algebra.algebraMap_eq_smul_one] at h + rw [CFC.sqrt_eq_real_sqrt x hx,cfcₙ_eq_cfc] + exact h + +theorem regularized_state_lower (hτ : τ 1 = 1) {x : A} (hx : 0 ≤ x) : + (τ (CFC.sqrt x)).re - 1/10 ≤ + (τ (x*cfc (fun t : ℝ => (Real.sqrt (t+1/100))⁻¹) x)).re := by + have h := (Complex.le_def.mp (τ.monotone' (regularized_order_lower hx))).1 + change (τ (CFC.sqrt x-(1/10:ℝ) • (1:A))).re ≤ + (τ (x*cfc (fun t : ℝ => (Real.sqrt (t+1/100))⁻¹) x)).re at h + simpa only [map_sub,positiveMap_real_smul,hτ,Complex.sub_re,Complex.smul_re, + Complex.one_re,smul_eq_mul,mul_one] using h + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RelativeConjugation.lean b/lean/OAI/Analysis/FreeWords/RelativeConjugation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d028f70c7a40801915c5f3f35239a63427503359 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RelativeConjugation.lean @@ -0,0 +1,71 @@ +import Mathlib +import OAI.Analysis.FreeWords.RelativeConjugationDefinitions +import OAI.Analysis.FreeWords.RelativeMatrix + +namespace OAI + +noncomputable section + +namespace KKRelativeMatrix + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def conjugationWord {M : VonNeumannAlgebra H} {n : ℕ} + (w : List (Matrix (Fin n) (Fin n) (ConcreteAlgebra M) × Matrix (Fin n) (Fin n) (ConcreteAlgebra M))) : List (ℤ × Matrix (Fin n) (Fin n) (ConcreteAlgebra M)) := + w.flatMap (fun z => [(1,z.1),(-1,z.2)]) + +theorem conjugationWord_ne_nil {M : VonNeumannAlgebra H} {n : ℕ} + {w : List (Matrix (Fin n) (Fin n) (ConcreteAlgebra M) × Matrix (Fin n) (Fin n) (ConcreteAlgebra M))} (h : w≠[]) : + conjugationWord w≠[] := by + cases w with + | nil => exact (h rfl).elim + | cons z w => simp [conjugationWord] + +theorem conjugationWord_value {M : VonNeumannAlgebra H} {n : ℕ} + (u : unitary (ConcreteAlgebra M)) + (w : List (Matrix (Fin n) (Fin n) (ConcreteAlgebra M) × Matrix (Fin n) (Fin n) (ConcreteAlgebra M))) : + ((conjugationWord w).map (fun z => + Matrix.diagonal (fun _ : Fin n => (u^z.1).val)*z.2)).prod= + (w.map (fun z => scalarConjugate u z.1*z.2)).prod := by + induction w with + | nil => simp [conjugationWord] + | cons z w ih => + simp only [conjugationWord,List.flatMap_cons,List.map_append,List.prod_append, + List.map_cons,List.map_nil,List.prod_cons,List.prod_nil,mul_one,zpow_one,zpow_neg_one] + change _ * ((conjugationWord w).map _).prod=_ + rw [ih] + simp only [scalarConjugate,mul_assoc] + +theorem finite_relative_conjugation : FiniteRelativeConjugation (H := H) := by + classical + intro M τ hF hD n K F hne hc ε hε + have hn' : ∀w∈F.image conjugationWord, w≠[] := by + intro w hw + obtain ⟨v,hv,rfl⟩ := Finset.mem_image.mp hw + exact conjugationWord_ne_nil (hne v hv) + have hc' : ∀w∈F.image conjugationWord, ∀z∈w, + z.1≠0 ∧ ∀i j,τ.map (z.2 i j)=0 := by + intro w hw z hz + obtain ⟨v,hv,rfl⟩ := Finset.mem_image.mp hw + obtain ⟨a,ha,hza⟩ := List.mem_flatMap.mp hz + simp only [List.mem_cons,List.not_mem_nil,or_false] at hza + rcases hza with rfl | rfl + · exact ⟨by norm_num,fun i j => (hc v hv a ha i j).1⟩ + · exact ⟨by norm_num,fun i j => (hc v hv a ha i j).2⟩ + obtain ⟨u,hK,hW⟩ := finite_relative_matrix_independence M τ hF hD n K + (F.image conjugationWord) hn' hc' ε hε + refine ⟨u,hK,?_⟩ + intro w hw i j + have hh := hW (conjugationWord w) (Finset.mem_image.mpr ⟨w,hw,rfl⟩) i j + rwa [conjugationWord_value] at hh + +end + +end KKRelativeMatrix +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RelativeConjugationDefinitions.lean b/lean/OAI/Analysis/FreeWords/RelativeConjugationDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..a958546bc4a8e672e4903e551cce00b5c427a77e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RelativeConjugationDefinitions.lean @@ -0,0 +1,36 @@ +import Mathlib +import OAI.Analysis.FreeWords.ProjectionSmall + +namespace OAI + +noncomputable section + +namespace KKRelativeMatrix + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def scalarConjugate {M : VonNeumannAlgebra H} {n : ℕ} + (u : unitary (ConcreteAlgebra M)) (X : Matrix (Fin n) (Fin n) (ConcreteAlgebra M)) : Matrix (Fin n) (Fin n) (ConcreteAlgebra M) := + Matrix.diagonal (fun _ : Fin n => u.val)*X* + Matrix.diagonal (fun _ : Fin n => (u⁻¹).val) + +def FiniteRelativeConjugation : Prop := + ∀ (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M), IsFactor M → IsDiffuse M → + ∀ (n : ℕ) (K : Finset ℤ) (F : Finset (List (Matrix (Fin n) (Fin n) (ConcreteAlgebra M) × Matrix (Fin n) (Fin n) (ConcreteAlgebra M)))), + (∀ w∈F, w≠[]) → + (∀ w∈F, ∀ z∈w, ∀ i j, τ.map (z.1 i j)=0 ∧ τ.map (z.2 i j)=0) → + ∀ ε : ℝ, 0<ε → ∃ u : unitary (ConcreteAlgebra M), + (∀ k∈K, k≠0 → ‖τ.map ((u^k).val)‖<ε) ∧ + (∀ w∈F, ∀ i j, + ‖τ.map (((w.map (fun (z : Matrix (Fin n) (Fin n) (ConcreteAlgebra M) × Matrix (Fin n) (Fin n) (ConcreteAlgebra M)) => scalarConjugate u z.1*z.2)).prod) i j)‖<ε) + +end + +end KKRelativeMatrix +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RelativeEndpointLimits.lean b/lean/OAI/Analysis/FreeWords/RelativeEndpointLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c4400758e0c8c29a723c07a9c3e6192fe1ebb6d --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RelativeEndpointLimits.lean @@ -0,0 +1,108 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixLeftEndpoint +import OAI.Analysis.FreeWords.RelativeEndpointLimitsDefinitions + +namespace OAI + +noncomputable section + +namespace KKRelativeEndpoints + +noncomputable section + +open Filter KKHaarEndpoints KKControlledConjugation KKRelativeMatrix + +open scoped Topology + +variable {A:Type*} [Ring A] [StarRing A] [Algebra ℂ A] + +def balancedWord {n:ℕ} + (w:List (Matrix (Fin n) (Fin n) A×Matrix (Fin n) (Fin n) A)) := + w.flatMap fun z => [((1:ℤ),z.1),(-1,z.2)] + +theorem amplifyConj_diagonal (n:ℕ) (u:unitary A) (X:Matrix (Fin n) (Fin n) A) : + amplifyConj n u X=Matrix.diagonal (fun _:Fin n => u.val)*X* + Matrix.diagonal (fun _:Fin n => (u⁻¹).val) := by + ext i j + simp only [amplifyConj_apply,Matrix.diagonal_mul,Matrix.mul_diagonal] + rfl + +theorem balancedWord_value {n:ℕ} (u:unitary A) + (w:List (Matrix (Fin n) (Fin n) A×Matrix (Fin n) (Fin n) A)) : + matrixWord (fun k => (u^k).val) (balancedWord w)=relativePair u w := by + induction w with + | nil => rfl + | cons z w ih => + simp only [matrixWord,balancedWord,List.flatMap_cons,List.map_append,List.prod_append, + List.map_cons,List.map_nil,List.prod_cons,List.prod_nil,mul_one,zpow_one,zpow_neg_one] + change _* matrixWord (fun k => (u^k).val) (balancedWord w)=_ + rw [ih] + simp only [relativePair,List.map_cons,List.prod_cons,amplifyConj_diagonal,mul_assoc] + +omit [StarRing A] in +theorem balancedWord_centered (τ:A →ₗ[ℂ] ℂ) {n:ℕ} + (w:List (Matrix (Fin n) (Fin n) A×Matrix (Fin n) (Fin n) A)) + (hw:∀z∈w,∀a b,τ (z.1 a b)=0 ∧ τ (z.2 a b)=0) : + ∀z∈balancedWord w,z.1≠0 ∧ ∀a b,z.2 a b∈(⊤:Subalgebra ℂ A) ∧ τ (z.2 a b)=0 := by + intro z hz + obtain ⟨c,hc,hz⟩ := List.mem_flatMap.mp hz + simp only [List.mem_cons,List.not_mem_nil,or_false] at hz + rcases hz with rfl | rfl + · exact ⟨by norm_num,fun a b => ⟨by trivial,(hw c hc a b).1⟩⟩ + · exact ⟨by norm_num,fun a b => ⟨by trivial,(hw c hc a b).2⟩⟩ + +theorem oddWord_value {n:ℕ} (u:unitary A) + (z:Matrix (Fin n) (Fin n) A×Matrix (Fin n) (Fin n) A) + (w:List (Matrix (Fin n) (Fin n) A×Matrix (Fin n) (Fin n) A)) + (c:Matrix (Fin n) (Fin n) A) : + relativePair u (z::w)*amplifyConj n u c= + amplifyConj n u (z.1*matrixWord (fun k => (u^k).val) + ((-1,z.2)::balancedWord w++[(1,c)])) := by + simp only [relativePair,List.map_cons,List.prod_cons,amplifyConj_diagonal,matrixWord, + List.map_append,List.prod_append,List.map_cons,List.map_nil,List.prod_cons,List.prod_nil, + mul_one,zpow_neg_one,zpow_one] + have hb := balancedWord_value u w + simp only [matrixWord] at hb + rw [hb] + simp only [relativePair,amplifyConj_diagonal,mul_assoc] + +theorem relative_endpoint_limits : RelativeEndpointLimits (A := A) := by + intro ι L τ u h1 htr hH hC n w hw + have hleft := matrix_left_endpoint_limits ι L τ ⊤ u h1 htr hH hC + refine ⟨?_,?_⟩ + · intro hn a b + have hbn : balancedWord w≠[] := by + cases w with + | nil => exact (hn rfl).elim + | cons z w => simp [balancedWord] + have hh := hleft n (balancedWord w) hbn (balancedWord_centered τ w hw) 1 + (fun _ _ => by trivial) a b + simpa only [one_mul,balancedWord_value] using hh + · intro c hc a b + cases w with + | nil => + simpa only [relativePair,List.map_nil,List.prod_nil,one_mul,amplifyConj_apply, + conj_trace τ htr,hc] using (tendsto_const_nhds : Tendsto (fun _:ι => (0:ℂ)) L (𝓝 0)) + | cons z w => + have hz := hw z List.mem_cons_self + have hwt := fun x hx => hw x (List.mem_cons_of_mem _ hx) + have hcw : ∀x∈(-1,z.2)::balancedWord w++[(1,c)], + x.1≠0 ∧ ∀a b,x.2 a b∈(⊤:Subalgebra ℂ A) ∧ τ (x.2 a b)=0 := by + intro x hx + rcases List.mem_cons.mp hx with rfl | hx + · exact ⟨by norm_num,fun a b => ⟨by trivial,(hz a b).2⟩⟩ + rcases List.mem_append.mp hx with hx | hx + · exact balancedWord_centered τ w hwt x hx + · have he := List.mem_singleton.mp hx + subst x + exact ⟨by norm_num,fun a b => ⟨by trivial,hc a b⟩⟩ + have hh := hleft n ((-1,z.2)::balancedWord w++[(1,c)]) (by simp) hcw z.1 + (fun _ _ => by trivial) a b + simpa only [oddWord_value,amplifyConj_apply,conj_trace τ htr] using hh + +end + +end KKRelativeEndpoints +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RelativeEndpointLimitsDefinitions.lean b/lean/OAI/Analysis/FreeWords/RelativeEndpointLimitsDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..f50a65879b1928bd49f4e12be2e26e7c937d7d2e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RelativeEndpointLimitsDefinitions.lean @@ -0,0 +1,40 @@ +import Mathlib +import OAI.Analysis.FreeWords.ControlledMatrixConjugation +import OAI.Analysis.FreeWords.HaarEndpointsDefinitions + +namespace OAI + +noncomputable section + +namespace KKRelativeEndpoints + +noncomputable section + +open Filter KKHaarEndpoints KKControlledConjugation KKRelativeMatrix + +open scoped Topology + +variable {A:Type*} [Ring A] [StarRing A] [Algebra ℂ A] [StarModule ℂ A] + +def relativePair {n:ℕ} (u:unitary A) + (w:List (Matrix (Fin n) (Fin n) A×Matrix (Fin n) (Fin n) A)) := + (w.map fun z => amplifyConj n u z.1*z.2).prod + +def RelativeEndpointLimits : Prop := + ∀ (ι:Type*) (L:Filter ι) (τ:A →ₗ[ℂ] ℂ) (u:ι → unitary A), + τ 1=1 → (∀a b,τ (a*b)=τ (b*a)) → + (∀k:ℤ,k≠0 → Tendsto (fun j => τ (u j^k).val) L (𝓝 0)) → + (∀w:List (ℤ×A),w≠[] → CenteredPowerWord τ ⊤ w → + Tendsto (fun j => τ (powerWord (u j) w)) L (𝓝 0)) → + ∀n:ℕ,∀w:List (Matrix (Fin n) (Fin n) A×Matrix (Fin n) (Fin n) A), + (∀z∈w,∀a b,τ (z.1 a b)=0 ∧ τ (z.2 a b)=0) → + (w≠[] → ∀a b,Tendsto (fun j => τ (relativePair (u j) w a b)) L (𝓝 0)) ∧ + (∀c:Matrix (Fin n) (Fin n) A,(∀a b,τ (c a b)=0) → ∀a b, + Tendsto (fun j => τ ((relativePair (u j) w*amplifyConj n (u j) c) a b)) L (𝓝 0)) + +end + +end KKRelativeEndpoints +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RelativeFiniteEndpoints.lean b/lean/OAI/Analysis/FreeWords/RelativeFiniteEndpoints.lean new file mode 100644 index 0000000000000000000000000000000000000000..c02f9b04e6ec06ef7c51eb1ea4807593aef5d2c3 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RelativeFiniteEndpoints.lean @@ -0,0 +1,62 @@ +import Mathlib +import OAI.Analysis.FreeWords.CyclicApproxNet +import OAI.Analysis.FreeWords.RelativeEndpointLimits +import OAI.Analysis.FreeWords.RelativeFiniteEndpointsDefinitions +import OAI.Analysis.FreeWords.ScalarFreeApprox + +namespace OAI + +noncomputable section + +namespace KKRelativeEndpoints + +noncomputable section + +open Filter KKHaarEndpoints KKControlledConjugation KKRelativeMatrix + +open KKTraceTransfer KKFreeLiftFrontier + +open scoped Topology + +variable {H:Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem relative_finite_endpoints : RelativeFiniteEndpoints (H := H) := by + classical + intro M τ hF hD n F E hFdata hEdata ε hε + have happ : FiniteCyclicApprox τ.map ⊤ (fun _ => True) := by + intro K F hdata η hη + obtain ⟨u,hK,hL⟩ := KKLocalPatching.finite_scalar_free_approximation M τ hF hD K F + (fun w hw => (hdata w hw).1) (fun w hw z hz => + ⟨((hdata w hw).2 z hz).1,((hdata w hw).2 z hz).2.2⟩) η hη + exact ⟨u,True.intro,hK,hL⟩ + obtain ⟨u,_,hH,hC⟩ := cyclic_approx_net τ.map ⊤ (fun _ => True) happ + have hrel := relative_endpoint_limits (CyclicIndex τ.map ⊤) atTop τ.map u + τ.normalized τ.tracial hH hC n + have hsmallF : ∀ᶠj in atTop,∀w∈F,∀a b,‖τ.map (relativePair (u j) w a b)‖<ε := by + apply (Filter.eventually_all_finset F).2 + intro w hw + apply Filter.eventually_all.2 + intro a + apply Filter.eventually_all.2 + intro b + simpa only [dist_zero_right] using Metric.tendsto_nhds.mp + ((hrel w (hFdata w hw).2).1 (hFdata w hw).1 a b) ε hε + have hsmallE : ∀ᶠj in atTop,∀v∈E,∀a b, + ‖τ.map ((relativePair (u j) v.1*amplifyConj n (u j) v.2) a b)‖<ε := by + apply (Filter.eventually_all_finset E).2 + intro v hv + apply Filter.eventually_all.2 + intro a + apply Filter.eventually_all.2 + intro b + simpa only [dist_zero_right] using Metric.tendsto_nhds.mp + ((hrel v.1 (hEdata v hv).1).2 v.2 (hEdata v hv).2 a b) ε hε + obtain ⟨j,hjF,hjE⟩ := (hsmallF.and hsmallE).exists + exact ⟨u j,hjF,hjE⟩ + +end + +end KKRelativeEndpoints +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RelativeFiniteEndpointsDefinitions.lean b/lean/OAI/Analysis/FreeWords/RelativeFiniteEndpointsDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..4626c4c857e1fe47e2ade909c42a715f1d2df0b1 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RelativeFiniteEndpointsDefinitions.lean @@ -0,0 +1,33 @@ +import Mathlib +import OAI.Analysis.FreeWords.AmplifiedModelDefinitions +import OAI.Analysis.FreeWords.RelativeEndpointLimitsDefinitions + +namespace OAI + +noncomputable section + +namespace KKRelativeEndpoints + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H:Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def RelativeFiniteEndpoints : Prop := + ∀(M:VonNeumannAlgebra H) (τ:FaithfulNormalTrace M),IsFactor M → IsDiffuse M → + ∀n:ℕ,∀F:Finset (List (MatrixAlgebra n M×MatrixAlgebra n M)), + ∀E:Finset (List (MatrixAlgebra n M×MatrixAlgebra n M)×MatrixAlgebra n M), + (∀w∈F,w≠[] ∧ ∀z∈w,∀a b,τ.map (z.1 a b)=0 ∧ τ.map (z.2 a b)=0) → + (∀v∈E,(∀z∈v.1,∀a b,τ.map (z.1 a b)=0 ∧ τ.map (z.2 a b)=0) ∧ + ∀a b,τ.map (v.2 a b)=0) → ∀ε:ℝ,0<ε → + ∃u:unitary (ConcreteAlgebra M), + (∀w∈F,∀a b,‖τ.map (relativePair u w a b)‖<ε) ∧ + (∀v∈E,∀a b,‖τ.map ((relativePair u v.1*KKControlledConjugation.amplifyConj n u v.2) a b)‖<ε) + +end + +end KKRelativeEndpoints +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RelativeMatrix.lean b/lean/OAI/Analysis/FreeWords/RelativeMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..eef3c6f97ae31b3a6cc12d79a340be3c901e278b --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RelativeMatrix.lean @@ -0,0 +1,89 @@ +import Mathlib +import OAI.Analysis.FreeWords.EntryWords +import OAI.Analysis.FreeWords.RelativeMatrixDefinitions +import OAI.Analysis.FreeWords.ScalarFreeApprox + +namespace OAI + +noncomputable section + +namespace KKRelativeMatrix + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem entryWord_trace_bound {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + {n : ℕ} (u : ℤ → ConcreteAlgebra M) + (w : List (ℤ × Matrix (Fin n) (Fin n) (ConcreteAlgebra M))) + (i j : Fin n) (δ : ℝ) + (h : ∀ v∈entryWords w i j, ‖τ.map (scalarWord u v)‖≤δ) : + ‖τ.map (matrixWord u w i j)‖ ≤ (entryWords w i j).length*δ := by + rw [entryWords_sum, map_list_sum, List.map_map] + calc + _ ≤ (((entryWords w i j).map (fun v => τ.map (scalarWord u v))).map norm).sum := norm_list_sum_le _ + _ ≤ ((entryWords w i j).map (fun _ => δ)).sum := by + rw [List.map_map] + exact List.sum_le_sum h + _ = _ := by rw [List.map_const',List.sum_replicate]; simp only [nsmul_eq_mul] + +theorem finite_relative_matrix_independence : FiniteRelativeMatrixIndependence (H := H) := by + classical + intro M τ hF hD n K F hFne hcenter ε hε + let S : Finset (List (ℤ × ConcreteAlgebra M)) := + F.biUnion fun w => Finset.univ.biUnion fun i : Fin n => + Finset.univ.biUnion fun j : Fin n => (entryWords w i j).toFinset + have hS (w) (hw : w∈F) (i j : Fin n) (v) (hv : v∈entryWords w i j) : v∈S := by + exact Finset.mem_biUnion.mpr ⟨w,hw,Finset.mem_biUnion.mpr ⟨i,Finset.mem_univ _, + Finset.mem_biUnion.mpr ⟨j,Finset.mem_univ _,List.mem_toFinset.mpr hv⟩⟩⟩ + have hSdata (v) (hv : v∈S) : ∃ w∈F, ∃ i j : Fin n, v∈entryWords w i j := by + obtain ⟨w,hw,hv⟩ := Finset.mem_biUnion.mp hv + obtain ⟨i,_,hv⟩ := Finset.mem_biUnion.mp hv + obtain ⟨j,_,hv⟩ := Finset.mem_biUnion.mp hv + exact ⟨w,hw,i,j,List.mem_toFinset.mp hv⟩ + have hSne : ∀ v∈S, v≠[] := by + intro v hv hv0 + obtain ⟨w,hw,i,j,hv⟩ := hSdata v hv + have hl := entryWords_length hv + rw [hv0,List.length_nil] at hl + exact hFne w hw (List.eq_nil_of_length_eq_zero hl.symm) + have hSc : ∀ v∈S, ∀ y∈v, y.1≠0 ∧ τ.map y.2=0 := by + intro v hv y hy + obtain ⟨w,hw,i,j,hv⟩ := hSdata v hv + obtain ⟨z,hz,a,b,rfl⟩ := entryWords_letters hv y hy + exact ⟨(hcenter w hw z hz).1,(hcenter w hw z hz).2 a b⟩ + let T : ℕ := ∑ w∈F, ∑ i : Fin n, ∑ j : Fin n, (entryWords w i j).length + have hT (w) (hw : w∈F) (i j : Fin n) : (entryWords w i j).length≤T := by + calc + _ ≤ ∑ j : Fin n, (entryWords w i j).length := + Finset.single_le_sum (f := fun j : Fin n => (entryWords w i j).length) (fun _ _ => Nat.zero_le _) (Finset.mem_univ j) + _ ≤ ∑ i : Fin n, ∑ j : Fin n, (entryWords w i j).length := + Finset.single_le_sum (f := fun i : Fin n => ∑ j : Fin n, (entryWords w i j).length) (fun _ _ => Nat.zero_le _) (Finset.mem_univ i) + _ ≤ T := by + dsimp only [T] + exact Finset.single_le_sum (f := fun w => ∑ i : Fin n, ∑ j : Fin n, (entryWords w i j).length) (fun _ _ => Nat.zero_le _) hw + let δ : ℝ := ε/(T+1) + have hden : 0<(T:ℝ)+1 := by positivity + have hδ : 0<δ := div_pos hε hden + have hδle : δ≤ε := div_le_self hε.le (le_add_of_nonneg_left (Nat.cast_nonneg T)) + obtain ⟨u,huK,huS⟩ := KKLocalPatching.finite_scalar_free_approximation M τ hF hD K S hSne hSc δ hδ + refine ⟨u,fun k hk hk0 => (huK k hk hk0).trans_le hδle,?_⟩ + intro w hw i j + have hb := entryWord_trace_bound τ (fun k => (u^k).val) w i j δ + (fun v hv => (huS v (hS w hw i j v hv)).le) + have hmul : (entryWords w i j).length*δ≤(T:ℝ)*δ := + mul_le_mul_of_nonneg_right (by exact_mod_cast hT w hw i j) hδ.le + have hstrict : (T:ℝ)*δ<ε := by + dsimp only [δ] + rw [← mul_div_assoc,div_lt_iff₀ hden] + nlinarith + exact hb.trans_lt (hmul.trans_lt hstrict) + +end + +end KKRelativeMatrix +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RelativeMatrixDefinitions.lean b/lean/OAI/Analysis/FreeWords/RelativeMatrixDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8a5bcc5268534ef5263a6795bc2d162adcf31dd --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RelativeMatrixDefinitions.lean @@ -0,0 +1,31 @@ +import Mathlib +import OAI.Analysis.FreeWords.ProjectionSmall + +namespace OAI + +noncomputable section + +namespace KKRelativeMatrix + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def FiniteRelativeMatrixIndependence : Prop := + ∀ (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M), IsFactor M → IsDiffuse M → + ∀ (n : ℕ) (K : Finset ℤ) (F : Finset (List (ℤ × Matrix (Fin n) (Fin n) (ConcreteAlgebra M)))), + (∀ w∈F, w≠[]) → + (∀ w∈F, ∀ z∈w, z.1≠0 ∧ ∀ i j, τ.map (z.2 i j)=0) → + ∀ ε : ℝ, 0<ε → ∃ u : unitary (ConcreteAlgebra M), + (∀ k∈K, k≠0 → ‖τ.map ((u^k).val)‖<ε) ∧ + (∀ w∈F, ∀ i j, + ‖τ.map (((w.map (fun (z : ℤ × Matrix (Fin n) (Fin n) (ConcreteAlgebra M)) => Matrix.diagonal (fun _ : Fin n => (u^z.1).val)*z.2)).prod) i j)‖<ε) + +end + +end KKRelativeMatrix +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RemainingFreeLiftLifting.lean b/lean/OAI/Analysis/FreeWords/RemainingFreeLiftLifting.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8003912a127746e190ee7833dadad13ce425048 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RemainingFreeLiftLifting.lean @@ -0,0 +1,32 @@ +import Mathlib +import OAI.Analysis.FreeWords.FiniteFreeDefinitions + +namespace OAI + +noncomputable section + +namespace KKFreeLiftFrontier + +open KKTraceTransfer Filter Topology + +noncomputable section + +def AllConstantMatrixFreeSequence : Prop := + ∀ (H : Type*) [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [TopologicalSpace.SeparableSpace H] [Nontrivial H] (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M), IsFactor M → IsDiffuse M → + ∀ n : ℕ, 0 < n → + ∃ d : ℕ → ℕ, (∀ j, 0 < d j) ∧ + ∃ ρ : ∀ j, Matrix (Fin (d j)) (Fin (d j)) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M, + (∀ j, Function.Injective (ρ j)) ∧ ∃ U : ℕ → unitary (MatrixAlgebra n M), + (∀ j i k, (U j).val i k ∈ (ρ j).range) ∧ + (∀ k : ℤ, k ≠ 0 → Tendsto (fun j => matrixTrace τ n (U j ^ k).val) atTop (𝓝 0)) ∧ + (∀ w : List (ℤ × MatrixAlgebra n M), IsCenteredTest τ w → + Tendsto (fun j => mixedMoment τ (U j) w) atTop (𝓝 0)) + +end + +end KKFreeLiftFrontier +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RestrictedDerivationDefinitions.lean b/lean/OAI/Analysis/FreeWords/RestrictedDerivationDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a625500e6b98e9f2785e66d0f41de8811443bf7 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RestrictedDerivationDefinitions.lean @@ -0,0 +1,28 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKMatrixHilbert + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def restrictedDerivation (S : StarSubalgebra ℂ (H →L[ℂ] H)) (h : H →L[ℂ] H) : + S →L[ℂ] (H →L[ℂ] H) where + toFun a := h * (a : H →L[ℂ] H) - (a : H →L[ℂ] H) * h + map_add' := by + intro a b + change h * ((a:H →L[ℂ] H)+(b:H →L[ℂ] H)) - ((a:H →L[ℂ] H)+(b:H →L[ℂ] H)) * h = _ + noncomm_ring + map_smul' := by intro scalar operator; simp [smul_sub] + cont := by fun_prop + +end + +end KKMatrixHilbert +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/RoundingMatrixUnitary.lean b/lean/OAI/Analysis/FreeWords/RoundingMatrixUnitary.lean new file mode 100644 index 0000000000000000000000000000000000000000..85bd23659ac8a9b33f56e07966d6d42053353bed --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/RoundingMatrixUnitary.lean @@ -0,0 +1,155 @@ +import Mathlib +import OAI.Analysis.FreeWords.PartitionRefine +import OAI.Analysis.FreeWords.UnitaryFiniteSpectrum + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFreeLiftFrontier KKSpectralSupport + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem projection_mul_sum_self {ι A : Type*} [Fintype ι] [Ring A] [StarRing A] + (p : ι → A) (hp : ∀ i, IsStarProjection (p i)) + (ho : ∀ i j, i≠j → p i*p j=0) (i : ι) : p i*(∑ j, p j)=p i := by + classical + rw [Finset.mul_sum] + rw [Finset.sum_eq_single i] + · simp only [hp i |>.isIdempotentElem.eq] + · intro j hj hji; exact ho i j (Ne.symm hji) + · simp + +theorem option_complement_partition {ι A : Type*} [Fintype ι] [Ring A] [StarRing A] + (p : ι → A) (hp : ∀ i, IsStarProjection (p i)) + (ho : ∀ i j, i≠j → p i*p j=0) (s : A) (hs : IsStarProjection s) + (he : s=1-∑ i, p i) : + (∀ i, IsStarProjection (Option.elim i s p)) ∧ + (∀ i j : Option ι, i≠j → Option.elim i s p*Option.elim j s p=0) ∧ + (∑ i : Option ι, Option.elim i s p)=1 := by + classical + have hps (i : ι) : p i*s=0 := by + rw [he,mul_sub,mul_one,projection_mul_sum_self p hp ho,sub_self] + have hsp (i : ι) : s*p i=0 := by + simpa only [star_mul,hs.isSelfAdjoint.star_eq,(hp i).isSelfAdjoint.star_eq,star_zero] + using congrArg star (hps i) + refine ⟨?_,?_,?_⟩ + · intro i; cases i with + | none => exact hs + | some i => exact hp i + · intro i j hij + cases i with + | none => + cases j with + | none => exact (hij rfl).elim + | some j => exact hsp j + | some i => + cases j with + | none => exact hps i + | some j => exact ho i j (fun h => hij (congrArg some h)) + · rw [Fintype.sum_option] + simpa only [Option.elim_none,Option.elim_some,he] using sub_add_cancel (1:A) (∑ i, p i) + +theorem weighted_partition_mul_subprojection {ι : Type*} [Fintype ι] + {M : VonNeumannAlgebra H} (p : ι → ConcreteAlgebra M) + (hp : ∀ i, IsStarProjection (p i)) (ho : ∀ i j, i≠j → p i*p j=0) + (c : ι → ℂ) (i : ι) (q : ConcreteAlgebra M) (hq : IsStarProjection q) + (hle : q ≤ p i) : (∑ j, c j • p j)*q=c i • q := by + classical + rw [Finset.sum_mul] + rw [Finset.sum_eq_single i] + · rw [smul_mul_assoc,(hq.le_iff_mul_eq_right (hp i)).mp hle] + · intro j hj hji + rw [smul_mul_assoc] + have he : p j*q=0 := by + calc + p j*q = p j*(p i*q) := by rw [(hq.le_iff_mul_eq_right (hp i)).mp hle] + _ = (p j*p i)*q := (mul_assoc _ _ _).symm + _ = 0 := by rw [ho j i hji,zero_mul] + rw [he,smul_zero] + · simp + +theorem rounded_unitary_matrix {ι : Type*} [Fintype ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) (hF : IsFactor M) (hD : IsDiffuse M) + (p : ι → ConcreteAlgebra M) (hp : ∀ i, IsStarProjection (p i)) + (ho : ∀ i j, i≠j → p i*p j=0) (h1 : ∑ i, p i=1) + (c : ι → ℂ) (hc : ∀ i, ‖c i‖=1) (ε : ℝ) (hε : 0 < ε) : + ∃ (n : ℕ) (_hn : 0 < n) + (ρ : Matrix (Fin n) (Fin n) ℂ →⋆ₐ[ℂ] ConcreteAlgebra M) + (v : unitary (Matrix (Fin n) (Fin n) ℂ)), + Function.Injective ρ ∧ traceNorm τ ((∑ i, c i • p i)-ρ v.val) < ε := by + classical + let : Nontrivial (ConcreteAlgebra M) := ⟨⟨0,1,fun h => by + have ht := congrArg τ.map h + rw [map_zero,τ.normalized] at ht + exact zero_ne_one ht⟩⟩ + obtain ⟨n,hn,k,r,q,s,hkr,hq,hqp,hqo,hτq,hs,hseq,hτs,hsmall⟩ := + round_projection_partition M τ hD p hp ho h1 (ε^2/4) (by positivity) + let p' : Option ι → ConcreteAlgebra M := fun i => Option.elim i s q + let k' : Option ι → ℕ := fun i => Option.elim i r k + let c' : Option ι → ℂ := fun i => Option.elim i 1 c + obtain ⟨hp',ho',h1'⟩ := option_complement_partition q hq hqo s hs hseq + have hτ' (i : Option ι) : τ.map (p' i)=(k' i:ℂ)*(((n:ℝ)⁻¹:ℝ):ℂ) := by + simp only [Complex.ofReal_inv,Complex.ofReal_natCast] + cases i with + | none => exact hτs + | some i => exact hτq i + obtain ⟨e,he,heo,he1,heτ,hes⟩ := refine_projection_partition M τ hD p' hp' ho' h1' + k' (n:ℝ)⁻¹ (inv_nonneg.mpr (Nat.cast_nonneg n)) hτ' + have hc' (i : Option ι) : ‖c' i‖=1 := by + cases i with + | none => exact norm_one + | some i => exact hc i + obtain ⟨m,hm,ρ,v,hρ,hv⟩ := unitary_of_equal_partition M τ hF e he heo he1 + (fun i j => (heτ i).trans (heτ j).symm) (fun i => c' i.1) (fun i => hc' i.1) + have hv' : ρ v.val=s+∑ i, c i • q i := by + rw [hv,Fintype.sum_sigma] + simp only [← Finset.smul_sum,hes] + rw [Fintype.sum_option] + simp only [c',p',Option.elim_none,Option.elim_some,one_smul] + let w := ∑ i, c i • p i + have hw : w ∈ unitary _ := phase_partition_unitary p hp ho h1 c hc + have hnw : ‖w‖ ≤ 1 := by + have h := CStarRing.norm_coe_unitary_mul (⟨w,hw⟩ : unitary _) (1 : ConcreteAlgebra M) + simpa only [mul_one,norm_one] using h.le + have hws : w*s=w-∑ i, c i • q i := by + rw [hseq,mul_sub,mul_one,Finset.mul_sum] + congr 1 + apply Finset.sum_congr rfl + intro i hi + exact weighted_partition_mul_subprojection p hp ho c i (q i) (hq i) (hqp i) + have herr : w-ρ v.val=(w-1)*s := by + rw [hv',sub_mul,one_mul,hws] + abel + have hns : 0 ≤ traceNorm τ s := traceNorm_nonneg τ s + have hsq : (traceNorm τ s)^2 < ε^2/4 := by + rw [traceNorm_projection_sq τ hs] + exact hsmall + have hlt : 2*traceNorm τ s < ε := by nlinarith + refine ⟨m,hm,ρ,v,hρ,?_⟩ + change traceNorm τ (w-ρ v.val) < ε + rw [herr] + calc + traceNorm τ ((w-1)*s) ≤ ‖w-1‖*traceNorm τ s := traceNorm_mul_le τ _ _ + _ ≤ 2*traceNorm τ s := mul_le_mul_of_nonneg_right + ((norm_sub_le _ _).trans (by rw [norm_one]; linarith)) hns + _ < ε := hlt + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ScalarAmalgamated.lean b/lean/OAI/Analysis/FreeWords/ScalarAmalgamated.lean new file mode 100644 index 0000000000000000000000000000000000000000..e59a90aeff0f8294d2fe6491b8417e6159f1301e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ScalarAmalgamated.lean @@ -0,0 +1,166 @@ +import Mathlib +import OAI.Analysis.FreeWords.ScalarAmalgamatedDefinitions + +namespace OAI + +noncomputable section + +namespace KKAmalgamatedTransport + +noncomputable section + +variable {A : Type*} [Ring A] + +@[simp] theorem pairProd_nil : pairProd ([] : List (A×A))=1 := rfl + +@[simp] theorem pairProd_cons (z : A×A) (w : List (A×A)) : + pairProd (z::w)=z.1*z.2*pairProd w := rfl + +@[simp] theorem pairProd_append (w v : List (A×A)) : + pairProd (w++v)=pairProd w*pairProd v := by + simp [pairProd,List.map_append,List.prod_append] + +def Blocks (S T : Set A) : Set A := + {a | ∃ w : List (A×A), ∃ c : A, + (∀ z∈w, z.1∈S ∧ z.2∈T) ∧ c∈S ∧ a=pairProd w*c} + +theorem block_single {S T : Set A} {a : A} (ha : a∈S) : a∈Blocks S T := by + exact ⟨[],a,by simp,ha,by simp⟩ + +theorem block_join {S T : Set A} {a b c : A} + (ha : a∈Blocks S T) (hb : b∈T) (hc : c∈Blocks S T) : + a*b*c∈Blocks S T := by + obtain ⟨w,d,hw,hd,rfl⟩ := ha + obtain ⟨v,e,hv,he,rfl⟩ := hc + refine ⟨w++[(d,b)]++v,e,?_,he,?_⟩ + · intro z hz + rcases List.mem_append.mp hz with hz | hz + · rcases List.mem_append.mp hz with hz | hz + · exact hw z hz + · have hz' : z=(d,b) := List.mem_singleton.mp hz + subst z + exact ⟨hd,hb⟩ + · exact hv z hz + · simp [mul_assoc] + +variable [StarRing A] [Algebra ℂ A] [StarModule ℂ A] + +theorem block_mem {S T : Set A} (Q : StarSubalgebra ℂ A) + (hS : S⊆Q) (hT : T⊆Q) {a : A} (ha : a∈Blocks S T) : a∈Q := by + obtain ⟨w,c,hw,hc,rfl⟩ := ha + apply Q.mul_mem _ (hS hc) + induction w with + | nil => exact Q.one_mem + | cons z w ih => + have hz := hw z List.mem_cons_self + apply Q.mul_mem (Q.mul_mem (hS hz.1) (hT hz.2)) + exact ih (fun a ha => hw a (List.mem_cons_of_mem _ ha)) + +theorem block_expectation_zero + (τ : A →ₗ[ℂ] ℂ) (E : A →ₗ[ℂ] A) (B C : StarSubalgebra ℂ A) + (hτ1 : τ 1=1) (hErange : ∀ a, E a∈B) + (hEright : ∀ a b, b∈B → E (a*b)=E a*b) + (hτE : ∀ a, τ (E a)=τ a) + (hfaith : ∀ b∈B, τ (b*star b)=0 → b=0) + (hfree : AlternatingMoments τ (Centered τ C) (Centered τ B)) + {a : A} (ha : a∈Blocks (Centered τ C) (Centered τ B)) : E a=0 := by + obtain ⟨w,c,hw,hc,rfl⟩ := ha + let a := pairProd w*c + have hzero : τ a=0 := (hfree w hw).2 c hc + have htest (b : A) (hb : b∈B) : τ (a*b)=0 := by + let b₀ := b-(τ b) • (1:A) + have hb₀ : b₀∈Centered τ B := by + refine ⟨B.sub_mem hb (B.smul_mem B.one_mem _),?_⟩ + simp [b₀,map_sub,map_smul,hτ1] + have hw' : ∀ z∈w++[(c,b₀)], z.1∈Centered τ C ∧ z.2∈Centered τ B := by + intro z hz + rcases List.mem_append.mp hz with hz | hz + · exact hw z hz + · have hz' := List.mem_singleton.mp hz + subst z + exact ⟨hc,hb₀⟩ + have hh := (hfree (w++[(c,b₀)]) hw').1 (by simp) + have hh' : τ (a*b₀)=0 := by simpa [a,mul_assoc] using hh + simpa [b₀,mul_sub,mul_smul_comm,map_sub,map_smul,hzero] using hh' + apply hfaith _ (hErange _) + rw [← hEright _ _ (star_mem (hErange _)),hτE] + exact htest _ (star_mem (hErange _)) + +theorem scalar_amalgamated_cyclic_transport : ScalarAmalgamatedCyclicTransport (A := A) := by + intro τ E B C P Q hτ1 hBP hBQ hCQ hErange hEfix hEright hτE hfaith hscalar hrelative + let S := Blocks (Centered τ C) (Centered τ B) + have hSQ : S⊆RelativeCentered E Q := by + intro a ha + exact ⟨block_mem Q (fun _ h => hCQ h.1) (fun _ h => hBQ h.1) ha, + block_expectation_zero τ E B C hτ1 hErange hEright hτE hfaith hscalar ha⟩ + have hdecomp (x : A) (hx : x∈Centered τ P) : + (x-E x)∈RelativeCentered E P ∧ E x∈Centered τ B := by + refine ⟨⟨P.sub_mem hx.1 (hBP (hErange x)),?_⟩,hErange x,?_⟩ + · rw [map_sub,hEfix _ (hErange x),sub_self] + · rw [hτE,hx.2] + have haux : ∀ w : List (A×A), + (∀ z∈w, z.1∈Centered τ C ∧ z.2∈Centered τ P) → + ∀ p : List (A×A), + (∀ z∈p, z.1∈RelativeCentered E Q ∧ z.2∈RelativeCentered E P) → + ∀ c∈S, ∀ x∈Centered τ P, + E (pairProd p*c*x*pairProd w)=0 := by + intro w + induction w with + | nil => + intro _ p hp c hc x hx + obtain ⟨hx₀,hxB⟩ := hdecomp x hx + have hp' : ∀ z∈p++[(c,x-E x)], + z.1∈RelativeCentered E Q ∧ z.2∈RelativeCentered E P := by + intro z hz + rcases List.mem_append.mp hz with hz | hz + · exact hp z hz + · have hz' := List.mem_singleton.mp hz + subst z + exact ⟨hSQ hc,hx₀⟩ + have h₀ := (hrelative (p++[(c,x-E x)]) hp').1 (by simp) + have hB : E (pairProd p*c*E x)=0 := by + rw [hEright _ _ (hErange x),(hrelative p hp).2 c (hSQ hc),zero_mul] + have he : pairProd p*c*x*pairProd [] = + pairProd (p++[(c,x-E x)])+pairProd p*c*E x := by + simp only [pairProd_nil,pairProd_append,pairProd_cons,mul_one] + noncomm_ring + rw [he,map_add,h₀,hB,add_zero] + | cons z w ih => + intro hw p hp c hc x hx + have hz := hw z List.mem_cons_self + have hw' := fun a ha => hw a (List.mem_cons_of_mem _ ha) + obtain ⟨hx₀,hxB⟩ := hdecomp x hx + have hp' : ∀ a∈p++[(c,x-E x)], + a.1∈RelativeCentered E Q ∧ a.2∈RelativeCentered E P := by + intro a ha + rcases List.mem_append.mp ha with ha | ha + · exact hp a ha + · have ha' := List.mem_singleton.mp ha + subst a + exact ⟨hSQ hc,hx₀⟩ + have hzc : z.1∈S := block_single hz.1 + have hnew : c*E x*z.1∈S := block_join hc hxB hzc + have h₀ := ih hw' (p++[(c,x-E x)]) hp' z.1 hzc z.2 hz.2 + have hB := ih hw' p hp (c*E x*z.1) hnew z.2 hz.2 + have he : pairProd p*c*x*pairProd (z::w) = + pairProd (p++[(c,x-E x)])*z.1*z.2*pairProd w+ + pairProd p*(c*E x*z.1)*z.2*pairProd w := by + simp only [pairProd_append,pairProd_cons,pairProd_nil,mul_one] + noncomm_ring + rw [he,map_add,h₀,hB,add_zero] + intro w hne hw + cases w with + | nil => exact (hne rfl).elim + | cons z w => + have hz := hw z List.mem_cons_self + have hh := haux w (fun a ha => hw a (List.mem_cons_of_mem _ ha)) [] (by simp) + z.1 (block_single hz.1) z.2 hz.2 + have he : E (pairProd (z::w))=0 := by simpa only [pairProd_cons,pairProd_nil,one_mul] using hh + rw [← hτE,he,map_zero] + +end + +end KKAmalgamatedTransport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ScalarAmalgamatedDefinitions.lean b/lean/OAI/Analysis/FreeWords/ScalarAmalgamatedDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..d88832ba8944119d398f6c17f23575bda337f919 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ScalarAmalgamatedDefinitions.lean @@ -0,0 +1,45 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKAmalgamatedTransport + +noncomputable section + +variable {A D : Type*} [Ring A] [StarRing A] [Algebra ℂ A] [StarModule ℂ A] + [AddCommGroup D] [Module ℂ D] + +def pairProd (w : List (A × A)) : A := (w.map fun z => z.1*z.2).prod + +def Centered (τ : A →ₗ[ℂ] ℂ) (S : StarSubalgebra ℂ A) : Set A := + {a | a∈S ∧ τ a=0} + +def RelativeCentered (E : A →ₗ[ℂ] A) (S : StarSubalgebra ℂ A) : Set A := + {a | a∈S ∧ E a=0} + +def AlternatingMoments (f : A →ₗ[ℂ] D) (S T : Set A) : Prop := + ∀ w : List (A × A), (∀ z∈w, z.1∈S ∧ z.2∈T) → + (w≠[] → f (pairProd w)=0) ∧ (∀ c∈S, f (pairProd w*c)=0) + +def ScalarAmalgamatedCyclicTransport : Prop := + ∀ (τ : A →ₗ[ℂ] ℂ) (E : A →ₗ[ℂ] A) + (B C P Q : StarSubalgebra ℂ A), + τ 1=1 → B≤P → B≤Q → C≤Q → + (∀ a, E a∈B) → (∀ b∈B, E b=b) → + (∀ a b, b∈B → E (a*b)=E a*b) → + (∀ a, τ (E a)=τ a) → + (∀ b∈B, τ (b*star b)=0 → b=0) → + AlternatingMoments τ (Centered τ C) (Centered τ B) → + AlternatingMoments E (RelativeCentered E Q) (RelativeCentered E P) → + ∀ w : List (A × A), w≠[] → + (∀ z∈w, z.1∈Centered τ C ∧ z.2∈Centered τ P) → + τ (pairProd w)=0 + +end + +end KKAmalgamatedTransport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ScalarExpansion.lean b/lean/OAI/Analysis/FreeWords/ScalarExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2e262f7d48914c975d5332d5dd3359e5055648a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ScalarExpansion.lean @@ -0,0 +1,117 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators + +noncomputable section + +variable {A ι : Type*} [NormedRing A] [NormedAlgebra ℂ A] + +def scalarTerm (c : ℂ) (f : ι → A) (n : ℕ) (w : List ι) : A := + c^(n-w.length) • (w.map f).prod + +theorem prod_scalar_add (c : ℂ) (f : ι → A) (w : List ι) : + (w.map (fun j => c • 1 + f j)).prod = + (w.sublists'.map (scalarTerm c f w.length)).sum := by + induction w with + | nil => simp [scalarTerm] + | cons j w ih => + rw [List.map_cons, List.prod_cons, add_mul, smul_mul_assoc, one_mul, ih, + List.sublists'_cons, List.map_append, List.sum_append, List.map_map] + congr 1 + · rw [List.smul_sum, List.map_map] + apply congrArg List.sum + apply List.map_congr_left + intro s hs + have hlen := (List.mem_sublists'.mp hs).length_le + simp only [Function.comp_def, scalarTerm, List.length_cons] + rw [show w.length+1-s.length=(w.length-s.length)+1 by omega, pow_succ', mul_smul] + · rw [← List.sum_map_mul_left] + apply congrArg List.sum + apply List.map_congr_left + intro s hs + simp only [Function.comp_def, scalarTerm, List.length_cons, Nat.add_sub_add_right, + List.map_cons, List.prod_cons, mul_smul_comm] + +omit [NormedAlgebra ℂ A] in +theorem norm_list_sum_le (L : List ι) (f : ι → A) (B : ℝ) + (h : ∀ i ∈ L, ‖f i‖ ≤ B) : ‖(L.map f).sum‖ ≤ (L.length:ℝ)*B := by + induction L with + | nil => simp + | cons i L ih => + simp only [List.map_cons, List.sum_cons, List.length_cons, Nat.cast_add, Nat.cast_one] + have hih := ih (fun j hj => h j (List.mem_cons_of_mem i hj)) + have hi := h i (List.mem_cons_self) + have ht := norm_add_le (f i) ((L.map f).sum) + nlinarith + +theorem norm_scalarTerm_le {c : ℂ} {f : ι → A} {n : ℕ} {s : List ι} {t : ℝ} + (ht : 0 ≤ t) (ht1 : t ≤ 1) (hc : ‖c‖ = t^2) (h1 : ‖(1:A)‖ ≤ 1) + (hln : s.length < n) + (hf : s ≠ [] → ‖(s.map f).prod‖ ≤ (3*s.length+1:ℝ)*t^(s.length-1)) : + ‖scalarTerm c f n s‖ ≤ (3*n+1:ℝ)*t^n := by + rw [scalarTerm, norm_smul, norm_pow, hc] + have hn : 0 ≤ (3*n+1:ℝ) := by positivity + by_cases hs : s = [] + · subst s + simp only [List.length_nil, Nat.sub_zero, List.map_nil, List.prod_nil] + have hp : (t^2)^n ≤ t^n := by + rw [← pow_mul] + exact pow_le_pow_of_le_one ht ht1 (by omega) + calc + _ ≤ (t^2)^n * 1 := mul_le_mul_of_nonneg_left h1 (by positivity) + _ ≤ t^n := by simpa using hp + _ ≤ (3*n+1:ℝ)*t^n := le_mul_of_one_le_left (pow_nonneg ht _) (by nlinarith [show (0:ℝ) ≤ (n:ℝ) from Nat.cast_nonneg n]) + · have hlen : 1 ≤ s.length := List.length_pos_iff.mpr hs + have hp : (t^2)^(n-s.length)*t^(s.length-1) ≤ t^n := by + rw [← pow_mul, ← pow_add] + exact pow_le_pow_of_le_one ht ht1 (by omega) + calc + _ ≤ (t^2)^(n-s.length)*((3*s.length+1:ℝ)*t^(s.length-1)) := + mul_le_mul_of_nonneg_left (hf hs) (by positivity) + _ = (3*s.length+1:ℝ)*((t^2)^(n-s.length)*t^(s.length-1)) := by ring + _ ≤ (3*n+1:ℝ)*t^n := mul_le_mul + (by exact_mod_cast (show 3*s.length+1 ≤ 3*n+1 by omega)) hp (by positivity) hn + +theorem projection_word_remainder {c : ℂ} {f : ι → A} {t : ℝ} (w : List ι) + (hw : w.Nodup) (ht : 0 ≤ t) (ht1 : t ≤ 1) (hc : ‖c‖ = t^2) + (h1 : ‖(1:A)‖ ≤ 1) + (hf : ∀ s, s.Sublist w → s ≠ [] → + ‖(s.map f).prod‖ ≤ (3*s.length+1:ℝ)*t^(s.length-1)) : + ‖(w.map (fun j => c • 1 + f j)).prod - (w.map f).prod‖ ≤ + (2:ℝ)^w.length*(3*w.length+1)*t^w.length := by + classical + let : BEq (List ι) := instBEqOfDecidableEq + let L := w.sublists'.erase w + have he : ((w.sublists').map (scalarTerm c f w.length)).sum = + (w.map f).prod + (L.map (scalarTerm c f w.length)).sum := by + simpa only [L, scalarTerm, Nat.sub_self, pow_zero, one_smul] using + (List.sum_map_erase (scalarTerm c f w.length) (List.mem_sublists'.mpr (List.Sublist.refl w))).symm + rw [prod_scalar_add, he, add_sub_cancel_left] + have hB : 0 ≤ (3*w.length+1:ℝ)*t^w.length := by positivity + calc + _ ≤ (L.length:ℝ)*((3*w.length+1:ℝ)*t^w.length) := by + apply norm_list_sum_le + intro s hs + have hmm := (List.nodup_sublists'.mpr hw).mem_erase_iff.mp hs + have hsub := List.mem_sublists'.mp hmm.2 + have hlt : s.length < w.length := lt_of_le_of_ne hsub.length_le + (fun heq => hmm.1 (hsub.eq_of_length heq)) + exact norm_scalarTerm_le ht ht1 hc h1 hlt (hf s hsub) + _ ≤ (2:ℝ)^w.length*((3*w.length+1:ℝ)*t^w.length) := + mul_le_mul_of_nonneg_right (by + exact_mod_cast (List.length_erase_le (a := w) (l := w.sublists')).trans_eq + (List.length_sublists' w)) hB + _ = _ := by ring + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ScalarFreeApprox.lean b/lean/OAI/Analysis/FreeWords/ScalarFreeApprox.lean new file mode 100644 index 0000000000000000000000000000000000000000..55de138f5788141acfe80a1da91909e9f586f142 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ScalarFreeApprox.lean @@ -0,0 +1,125 @@ +import Mathlib +import OAI.Analysis.FreeWords.MixedScaling +import OAI.Analysis.FreeWords.MixedToPatching +import OAI.Analysis.FreeWords.PatchingSmall + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +theorem finite_scalar_free_approximation + {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) + (K : Finset ℤ) (F : Finset (List (ℤ × ConcreteAlgebra M))) + (hFne : ∀ w∈F, w≠[]) + (hcenter : ∀ w∈F, ∀ z∈w, z.1≠0 ∧ τ.map z.2=0) + (ε : ℝ) (hε : 0<ε) : + ∃ u : unitary (ConcreteAlgebra M), + (∀ k∈K, k≠0 → ‖τ.map ((u^k).val)‖<ε) ∧ + (∀ w∈F, ‖τ.map ((w.map (fun z => ((u^z.1).val)*z.2)).prod)‖<ε) := by + classical + let S : Finset (ConcreteAlgebra M) := F.biUnion (fun w => w.toFinset.image Prod.snd) + have hS (w) (hw : w∈F) (z) (hz : z∈w) : z.2∈S := by + exact Finset.mem_biUnion.mpr ⟨w,hw,Finset.mem_image.mpr ⟨z,List.mem_toFinset.mpr hz,rfl⟩⟩ + have hScenter : ∀ x∈S, τ.map x=0 := by + intro x hx + obtain ⟨w,hw,hx⟩ := Finset.mem_biUnion.mp hx + obtain ⟨z,hz,rfl⟩ := Finset.mem_image.mp hx + exact (hcenter w hw z (List.mem_toFinset.mp hz)).2 + let R : ℝ := 1+∑ x∈S, ‖x‖ + have hR1 : 1≤R := by + dsimp only [R] + exact le_add_of_nonneg_right (Finset.sum_nonneg fun _ _ => norm_nonneg _) + have hR : 0 norm_nonneg z) hx + dsimp only [R] + linarith + let c : ℂ := (R:ℂ)⁻¹ + let X : Set (ConcreteAlgebra M) := (fun x => c • x) '' (S : Set (ConcreteAlgebra M)) + have hXfin : X.Finite := S.finite_toSet.image _ + have hXnorm : ∀ x∈X, ‖x‖≤1 := by + rintro x ⟨y,hy,rfl⟩ + rw [norm_smul,show ‖c‖=R⁻¹ by simp [c,norm_inv,Complex.norm_real,Real.norm_eq_abs,abs_of_pos hR]] + exact (mul_le_mul_of_nonneg_left (hSbound y hy) (inv_nonneg.mpr hR.le)).trans_eq (inv_mul_cancel₀ hR.ne') + have hXcenter : ∀ x∈X, τ.map x=0 := by + rintro x ⟨y,hy,rfl⟩ + simp only [map_smul,hScenter y hy,smul_zero] + let L : Finset ℤ := insert 1 (insert (-1) ((K ∪ F.biUnion (fun w => w.toFinset.image Prod.fst)).erase 0)) + have hLzero : ∀ k∈(L:Set ℤ), k≠0 := by + intro k hk + simp only [L,Finset.mem_coe,Finset.mem_insert,Finset.mem_erase] at hk + rcases hk with rfl | rfl | ⟨hk,_⟩ + · norm_num + · norm_num + · exact hk + have hL1 : (1:ℤ)∈(L:Set ℤ) := Finset.mem_insert_self _ _ + have hLm1 : (-1:ℤ)∈(L:Set ℤ) := Finset.mem_insert_of_mem (Finset.mem_insert_self _ _) + have hLK : ∀ k∈K, k≠0 → k∈(L:Set ℤ) := by + intro k hk hk0 + exact Finset.mem_insert_of_mem (Finset.mem_insert_of_mem + (Finset.mem_erase.mpr ⟨hk0,Finset.mem_union_left _ hk⟩)) + have hLF : ∀ w∈F, ∀ z∈w, z.1∈(L:Set ℤ) := by + intro w hw z hz + exact Finset.mem_insert_of_mem (Finset.mem_insert_of_mem + (Finset.mem_erase.mpr ⟨(hcenter w hw z hz).1,Finset.mem_union_right _ + (Finset.mem_biUnion.mpr ⟨w,hw,Finset.mem_image.mpr ⟨z,List.mem_toFinset.mpr hz,rfl⟩⟩)⟩)) + let N : ℕ := 1+∑ w∈F, w.length + have hN1 : 1≤N := Nat.le_add_right _ _ + have hNF : ∀ w∈F, w.length≤N := by + intro w hw + exact (Finset.single_le_sum (fun _ _ => Nat.zero_le _) hw).trans (Nat.le_add_left _ _) + let ξ := ε/R^N + have hξ : 0<ξ := div_pos hε (pow_pos hR _) + obtain ⟨u,hu⟩ := unitary_admissible_small τ hF hD hXfin L.finite_toSet + hXnorm hXcenter hLzero hL1 hLm1 (N := N) ξ hξ + have hξle : ξ≤ε := div_le_self hε.le (one_le_pow₀ hR1) + refine ⟨u,?_,?_⟩ + · intro k hk hk0 + let A : PatchingWord (ConcreteAlgebra M) := ⟨1,k,[],1⟩ + have hA : PatchingWord.Admissible X (L:Set ℤ) N A := + ⟨Set.mem_insert _ _,hLK k hk hk0,Set.mem_insert _ _,by simp [A],hN1⟩ + have hh := hu A hA + simpa only [A,PatchingWord.value,PatchingWord.tailValue_nil,one_mul,mul_one] using hh.trans_le hξle + · intro w hw + have hn := hNF w hw + have hcword : ∀ z∈scaledMixed c w, z.1∈(L:Set ℤ) ∧ z.2∈X := by + intro z hz + obtain ⟨y,hy,rfl⟩ := List.mem_map.mp hz + exact ⟨hLF w hw y hy,⟨y.2,hS w hw y hy,rfl⟩⟩ + have hscaled : ‖τ.map (mixedValue (fun k => (u^k).val) (scaledMixed c w))‖<ξ := by + cases w with + | nil => exact (hFne [] hw rfl).elim + | cons z s => + have hhead := hcword (z.1,c • z.2) List.mem_cons_self + have htail : ∀ y∈scaledMixed c s, y.1∈(L:Set ℤ) ∧ y.2∈X := + fun y hy => hcword y (List.mem_cons_of_mem _ hy) + have hlen : (scaledMixed c s).length+1≤N := by + simpa only [scaledMixed,List.length_map,List.length_cons] using hn + have hA := PatchingWord.ofMixedHead_admissible z.1 (c • z.2) (scaledMixed c s) + hhead.1 hhead.2 htail hlen + have hh := hu _ hA + simpa only [PatchingWord.ofMixedHead_value,mixedValue,scaledMixed,List.map_cons,List.prod_cons] using hh + have hpow : R^w.length≤R^N := pow_le_pow_right₀ hR1 hn + have hbound : R^w.length*ξ≤ε := by + calc + _ ≤ R^N*ξ := mul_le_mul_of_nonneg_right hpow hξ.le + _ = ε := by dsimp only [ξ]; field_simp + rw [show (w.map (fun z => ((u^z.1).val)*z.2)).prod=mixedValue (fun k => (u^k).val) w from rfl] + rw [norm_trace_scaled τ _ R hR w] + exact (mul_lt_mul_of_pos_left hscaled (pow_pos hR _)).trans_le hbound + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ScalarMatrixCommutator.lean b/lean/OAI/Analysis/FreeWords/ScalarMatrixCommutator.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac83a9565fcec5269523e7743f514078d8c2c42c --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ScalarMatrixCommutator.lean @@ -0,0 +1,59 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixAveraging +import OAI.Analysis.FreeWords.MatrixHilbertCore + +namespace OAI + +noncomputable section + +namespace KKMatrixHilbert + +noncomputable section + +open scoped Matrix.Norms.L2Operator + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem scalar_matrix_commutator_bound {n d:ℕ} + (ρ:Matrix (Fin d) (Fin d) ℂ →⋆ₐ[ℂ] (H →L[ℂ] H)) (h:H →L[ℂ] H) (δ:ℝ) + (hδ:∀u:unitary (Matrix (Fin d) (Fin d) ℂ),‖h*ρ u.val-ρ u.val*h‖≤δ) + (s:unitary (Matrix (Fin n) (Fin n) (H →L[ℂ] H))) + (hs:∀i j,s.val i j∈ρ.range) : + ‖matrixOperator (Matrix.diagonal fun _:Fin n => h)*matrixOperator s.val- + matrixOperator s.val*matrixOperator (Matrix.diagonal fun _:Fin n => h)‖≤2*δ := by + obtain ⟨h₀,hcomm,hnear⟩ := KKMatrixAveraging.finite_dimensional_commutant_approximation ρ h δ hδ + let D (a:H →L[ℂ] H) := matrixOperator (Matrix.diagonal fun _:Fin n => a) + let V : unitary (Amplification n H →L[ℂ] Amplification n H) := + ⟨matrixOperator s.val,by + constructor + · rw [←matrixOperator_star,←matrixOperator_mul,s.property.1,matrixOperator_one] + · rw [←matrixOperator_star,←matrixOperator_mul,s.property.2,matrixOperator_one]⟩ + have hd : D h₀*V.val=V.val*D h₀ := by + change matrixOperator _*matrixOperator _=matrixOperator _*matrixOperator _ + rw [←matrixOperator_mul,←matrixOperator_mul] + apply congrArg matrixOperator + apply Matrix.ext + intro i j + rw [Matrix.diagonal_mul,Matrix.mul_diagonal] + obtain ⟨a,ha⟩ := hs i j + rw [←ha] + exact (hcomm a).eq + have hsub : D (h-h₀)=D h-D h₀ := by + ext x i + simp only [D,matrixOperator_diagonal_apply,sub_apply,PiLp.sub_apply] + have he : D h*V.val-V.val*D h=D (h-h₀)*V.val-V.val*D (h-h₀) := by + rw [hsub,sub_mul,mul_sub,hd] + abel + change ‖D h*V.val-V.val*D h‖≤2*δ + rw [he] + calc + _ ≤ ‖D (h-h₀)*V.val‖+‖V.val*D (h-h₀)‖ := norm_sub_le _ _ + _ = 2*‖D (h-h₀)‖ := by rw [CStarRing.norm_mul_coe_unitary,CStarRing.norm_coe_unitary_mul];ring + _ ≤ 2*δ := mul_le_mul_of_nonneg_left ((norm_diagonal_le (h-h₀)).trans hnear) (by norm_num) + +end + +end KKMatrixHilbert +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ScalarMatrixFree.lean b/lean/OAI/Analysis/FreeWords/ScalarMatrixFree.lean new file mode 100644 index 0000000000000000000000000000000000000000..62d90a0cca1b12a3b4aba831457a47a0f53211aa --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ScalarMatrixFree.lean @@ -0,0 +1,79 @@ +import Mathlib +import OAI.Analysis.FreeWords.ScalarFreeApprox +import OAI.Analysis.FreeWords.UnitaryTraceContinuity + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} + +local instance : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +theorem finite_scalar_matrix_free_approximation + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) + (K : Finset ℤ) (F : Finset (List (ℤ × ConcreteAlgebra M))) + (hFne : ∀ w∈F, w≠[]) + (hcenter : ∀ w∈F, ∀ z∈w, z.1≠0 ∧ τ.map z.2=0) + (ε : ℝ) (hε : 0<ε) : + ∃ d : ℕ, 0 ((u^z.1).val)*z.2)).prod)‖<ε) := by + classical + obtain ⟨u,huK,huF⟩ := finite_scalar_free_approximation M τ hF hD K F hFne hcenter (ε/2) (half_pos hε) + have hex (j : ℕ) := chosen_unitary_matrix_approximation M τ hF hD u + (((j:ℝ)+1)⁻¹) (by positivity) + choose d hd ρ v hρ hclose using hex + let f (j : ℕ) : unitary (ConcreteAlgebra M) := ⟨ρ j (v j).val, Unitary.map_mem (ρ j) (v j).property⟩ + have hf : Tendsto (fun j => gnsVector (tracePositive τ) (f j).val) atTop + (𝓝 (gnsVector (tracePositive τ) u.val)) := by + apply (tendsto_gns_iff τ).mpr + have hb (j : ℕ) : traceNorm τ ((f j).val-u.val) ≤ ((j:ℝ)+1)⁻¹ := by + rw [traceNorm_eq_gns,map_sub,norm_sub_rev,← map_sub,← traceNorm_eq_gns] + exact (hclose j).le + apply squeeze_zero (fun j => traceNorm_nonneg τ _) hb + simpa only [Function.comp_def,Nat.cast_add,Nat.cast_one] using + (tendsto_inv_atTop_nhds_zero_nat (𝕜 := ℝ)).comp (tendsto_add_atTop_nat 1) + have hKevent : ∀ᶠ j in atTop, ∀ k∈K, k≠0 → ‖τ.map (((f j)^k).val)‖<ε := by + apply (Filter.eventually_all_finset K).mpr + intro k hk + by_cases hk0 : k=0 + · exact Eventually.of_forall (fun _ h => (h hk0).elim) + · have ht := (tendsto_gns_trace τ (tendsto_gns_unitary_zpow τ hf k)).norm + have hh := (tendsto_order.mp ht).2 ε ((huK k hk hk0).trans (half_lt_self hε)) + filter_upwards [hh] with j hj + exact fun _ => hj + have hFevent : ∀ᶠ j in atTop, ∀ w∈F, + ‖τ.map ((w.map (fun z => (((f j)^z.1).val)*z.2)).prod)‖<ε := by + apply (Filter.eventually_all_finset F).mpr + intro w hw + have ht := (tendsto_gns_trace τ (tendsto_gns_unitary_word τ hf w)).norm + exact (tendsto_order.mp ht).2 ε ((huF w hw).trans (half_lt_self hε)) + obtain ⟨j,hjK,hjF⟩ := (hKevent.and hFevent).exists + exact ⟨d j,hd j,ρ j,hρ j,f j,⟨(v j).val,rfl⟩,hjK,hjF⟩ + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ScalarRecovery.lean b/lean/OAI/Analysis/FreeWords/ScalarRecovery.lean new file mode 100644 index 0000000000000000000000000000000000000000..163eeb36739b910e0659fc24339d3a1ecf1cb286 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ScalarRecovery.lean @@ -0,0 +1,235 @@ +import Mathlib +import OAI.Analysis.FreeWords.CornerState +import OAI.Analysis.FreeWords.FreeCompressionMoments +import OAI.Analysis.FreeWords.RecoveryArithmetic +import OAI.Analysis.FreeWords.RegularizedOrder + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {ι : Type*} {τ : A →ₚ[ℂ] ℂ} {S : ι → StarSubalgebra ℂ A} + +variable {i j : ι} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped BigOperators + +noncomputable section + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +end + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} + +end + +end KKFreeWords + +namespace KKFreeWords + +end KKFreeWords + +namespace KKFreeWords + +open scoped ComplexOrder BigOperators + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {τ : A →ₚ[ℂ] ℂ} {S P : StarSubalgebra ℂ A} + +theorem scalar_recovery_bound (hτ : FaithfulTracial τ) + (u : unitary A) (hu : (u:A) ∈ S) + (hHaar : ∀ k : ℤ, k ≠ 0 → τ (upow u k) = 0) + (hfree : ScalarFree τ (binaryCopy S P)) + {p : A} (hp : p ∈ P) (hps : star p = p) (hpp : p*p = p) + {n N : ℕ} (hn : 2 ≤ n) (htp : τ p = (n : ℂ)⁻¹) + (hN : 100 * (n : ℝ) * (100 * Real.pi)^3 ≤ (N : ℝ)) : + 1/2 ≤ regularizedScalar τ n p (dirichletRow u N) := by + have hn0 : 0 < n := by omega + have hnr : (0:ℝ) < n := by exact_mod_cast hn0 + have hnz : (n:ℂ) ≠ 0 := Nat.cast_ne_zero.mpr hn0.ne' + have hpi : 1 ≤ (100*Real.pi)^3 := by + calc 1 = (1:ℝ)^3 := by norm_num + _ ≤ _ := pow_le_pow_left₀ zero_le_one (by linarith [Real.pi_gt_three]) 3 + have hN100 : 100*(n:ℝ) ≤ (N:ℝ) := by + have := mul_le_mul_of_nonneg_left hpi (by positivity : (0:ℝ) ≤ 100*(n:ℝ)) + linarith + have hNr : (0:ℝ) < N := by linarith + have hN0 : 0 < N := by exact_mod_cast hNr + let a := (dirichletRow u N)^2 + let B := (p*a*p)*star (p*a*p) + let σ := cornerState τ n p + have ha : a ∈ S := by + apply S.pow_mem + change dirichletRow u N ∈ S + unfold dirichletRow + simpa only [Complex.coe_smul] using + S.smul_mem (S.sum_mem (t := Finset.range N) (fun r hr => upow_mem u hu ((r:ℤ)+1))) + (((Real.sqrt (N:ℝ))⁻¹ : ℝ) : ℂ) + have hta : τ a = 0 := dirichletRow_square_centered hτ u hHaar hN0 + have hb : 0 ≤ B := mul_star_self_nonneg _ + have hpb : p*B = B := by + dsimp [B] + simp only [← mul_assoc,hpp] + have hB2 := projection_compression_second hτ hfree (i := false) (j := true) + (by decide) hp hps hpp ha hta + have hB4 := projection_compression_fourth hτ hfree (i := false) (j := true) + (by decide) hp hps hpp ha hta + change τ B = (τ p)^2*τ (a*star a) at hB2 + change τ (B^2) = (τ p)^4*τ ((a*star a)^2) + + 2*(τ p)^3*(1-τ p)*(τ (a*star a))^2 at hB4 + have hsB : σ B = (n:ℂ)*τ B := cornerState_supported hτ n hps hpp hpb + have hsB2 : σ (B^2) = (n:ℂ)*τ (B^2) := by + simpa only [pow_two] using cornerState_leftMul_supported hτ n hps hpp hpb B + have he2 : (n:ℂ)*σ B = τ (a*star a) := by + rw [hsB,hB2,htp] + field_simp + have he4 : (n:ℂ)^3*σ (B^2) = τ ((a*star a)^2) + + 2*((n:ℂ)-1)*(τ (a*star a))^2 := by + rw [hsB2,hB4,htp] + field_simp + have htareal : τ (a*star a) = ((τ (a*star a)).re : ℂ) := by + have hz := (Complex.nonneg_iff.mp (τ.map_nonneg (mul_star_self_nonneg a))).2 + apply Complex.ext <;> simp [hz.symm] + have he2r : (n:ℝ)*(σ B).re = (τ (a*star a)).re := by + have := congrArg Complex.re he2 + simpa only [Complex.mul_re,Complex.natCast_re,Complex.natCast_im,zero_mul,sub_zero] using this + have he4r : (n:ℝ)^3*(σ (B^2)).re = (τ ((a*star a)^2)).re + + 2*((n:ℝ)-1)*(τ (a*star a)).re^2 := by + rw [htareal] at he4 + have := congrArg Complex.re he4 + simpa only [← Complex.ofReal_natCast,← Complex.ofReal_pow,← Complex.ofReal_sub, + ← Complex.ofReal_one,← Complex.ofReal_ofNat,← Complex.ofReal_mul, + Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im,zero_mul,sub_zero,Complex.add_re] using this + have hroot : (CFC.sqrt B)^2 = B := by + simpa only [pow_two] using CFC.sqrt_mul_sqrt_self B hb + have hroot4 : (CFC.sqrt B)^4 = B^2 := by + rw [show 4 = 2*2 from rfl,pow_mul,hroot] + have hinter := positiveMap_moment_interpolation (τ := σ) (CFC.sqrt_nonneg B) + rw [hroot,hroot4] at hinter + have hs : (3:ℝ)/5 ≤ (σ (CFC.sqrt B)).re := recovery_moment_arithmetic hnr hN100 + (dirichletRow_energy_lower hτ u hHaar hN0) + (dirichletRow_fourth_upper hτ u hN0) he2r he4r + (positiveMap_re_nonneg (CFC.sqrt_nonneg B)) hinter + have hσ1 : σ 1 = 1 := cornerState_one hn0 hps hpp htp + have hreg := regularized_state_lower hσ1 hb + have hreg_eq : (σ (B*cfc (fun t : ℝ => (Real.sqrt (t+1/100))⁻¹) B)).re = + regularizedScalar τ n p (dirichletRow u N) := by + change (cornerState τ n p (B*cfc (fun t : ℝ => (Real.sqrt (t+1/100))⁻¹) B)).re = _ + rw [cornerState_leftMul_supported hτ n hps hpp hpb] + simp only [Complex.mul_re,Complex.natCast_re,Complex.natCast_im,zero_mul,sub_zero] + rfl + rw [hreg_eq] at hreg + linarith + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/SecondMoment.lean b/lean/OAI/Analysis/FreeWords/SecondMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..391a1c07dc07261f3a0eb76affe996f59e536d82 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/SecondMoment.lean @@ -0,0 +1,130 @@ +import Mathlib +import OAI.Analysis.FreeWords.HaarMoment + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators Matrix.Norms.L2Operator InnerProductSpace + +open MeasureTheory Matrix + +noncomputable section + +theorem perm_two_cases (π : Equiv.Perm (Fin 2)) : + π=Equiv.refl _ ∨ π=Equiv.swap 0 1 := by + fin_cases π <;> decide + +theorem sum_perm_two {A : Type*} [AddCommMonoid A] (f : Equiv.Perm (Fin 2) → A) : + ∑ π,f π=f (Equiv.refl _)+f (Equiv.swap 0 1) := by + have he : (Finset.univ : Finset (Equiv.Perm (Fin 2)))={Equiv.refl _,Equiv.swap 0 1} := by + ext π + simp only [Finset.mem_univ,Finset.mem_insert,Finset.mem_singleton,true_iff] + exact perm_two_cases π + rw [he,Finset.sum_pair (by decide)] + +@[simp] theorem positionMatrix_refl {r d : ℕ} : + positionMatrix (d := d) (Equiv.refl (Fin r))=1 := by + ext a b + simp [positionMatrix,Matrix.one_apply,eq_comm] + +@[simp] theorem pair_position_refl {d : ℕ} : + matrixPair (positionMatrix (d := d) (Equiv.refl (Fin 2))) + (positionMatrix (Equiv.refl (Fin 2)))=(d : ℂ)^2 := by + simp [matrixPair,pow_two] + +theorem pair_position_swap {d : ℕ} : + matrixPair (positionMatrix (d := d) (Equiv.refl (Fin 2))) + (positionMatrix (Equiv.swap 0 1))=(d : ℂ) := by + simp only [positionMatrix_refl,matrixPair,star_one,one_mul,Matrix.trace,Matrix.diag,positionMatrix] + have h (a : Fin 2 → Fin d) : a=a ∘ Equiv.swap 0 1 ↔ a 0=a 1 := by + constructor + · intro he; simpa using congrFun he 0 + · intro he; funext i; fin_cases i <;> simp [Function.comp_apply,he] + simp_rw [h] + calc + _ = ∑ p : Fin d × Fin d, if p.1=p.2 then (1 : ℂ) else 0 := + Fintype.sum_equiv (finTwoArrowEquiv (Fin d)) _ _ (fun a => rfl) + _ = _ := by rw [Fintype.sum_prod_type]; simp + +@[simp] theorem pair_position_self {r d : ℕ} (π : Equiv.Perm (Fin r)) : + matrixPair (positionMatrix (d := d) π) (positionMatrix π)=(d : ℂ)^r := by + classical + simp [matrixPair_apply,positionMatrix] + +theorem pair_swap_refl {d : ℕ} : + matrixPair (positionMatrix (d := d) (Equiv.swap (0 : Fin 2) 1)) + (positionMatrix (Equiv.refl (Fin 2)))=(d : ℂ) := by + have hh : matrixPair (positionMatrix (d := d) (Equiv.swap (0 : Fin 2) 1)) 1 = + star (matrixPair 1 (positionMatrix (d := d) (Equiv.swap (0 : Fin 2) 1))) := by + simp [matrixPair,Matrix.trace,Matrix.diag,Matrix.star_apply] + rw [positionMatrix_refl] at ⊢ + rw [hh] + simpa only [positionMatrix_refl,star_natCast] using congrArg star (pair_position_swap (d := d)) + +theorem tensorAverage_column_pair (d : ℕ) (hd : 2 ≤ d) (z : Fin d) : + tensorAverage (matrixHaar d) (Matrix.single (fun _ : Fin 2 => z) (fun _ => z) 1) = + ((d : ℂ)*((d : ℂ)+1))⁻¹ • + (1+positionMatrix (d := d) (Equiv.swap (0 : Fin 2) 1)) := by + classical + let b : Fin 2 → Fin d := fun _ => z + let T : Matrix (Fin 2 → Fin d) (Fin 2 → Fin d) ℂ := Matrix.single b b 1 + obtain ⟨c,hc⟩ := tensorAverage_span 2 d hd (matrixHaar d) T + have h0 := positionPair_average (matrixHaar d) (Equiv.refl (Fin 2)) T + have h1 := positionPair_average (matrixHaar d) (Equiv.swap (0 : Fin 2) 1) T + rw [hc,matrixPair_sum_smul,sum_perm_two] at h0 h1 + simp only [pair_position_swap,pair_swap_refl,pair_position_self] at h0 h1 + have hb (π : Equiv.Perm (Fin 2)) : matrixPair (positionMatrix (d := d) π) T=1 := by + rw [matrixPair_single] + simp [positionMatrix,b,Function.comp_def] + rw [hb] at h0 h1 + have hn : (d : ℂ)≠0 := by exact_mod_cast (by omega : d≠0) + have hn1 : (d : ℂ)-1≠0 := by + have h : (1 : ℂ)≠(d : ℂ) := by exact_mod_cast (by omega : 1≠d) + exact sub_ne_zero.mpr h.symm + have hs : (d : ℂ)*((d : ℂ)+1)≠0 := by + apply mul_ne_zero hn + have h : (0 : ℝ)<(d : ℝ)+1 := by positivity + exact_mod_cast ne_of_gt h + have he : c (Equiv.refl (Fin 2))=c (Equiv.swap 0 1) := by + have he : (c (Equiv.refl (Fin 2))-c (Equiv.swap 0 1))*((d : ℂ)*((d : ℂ)-1))=0 := by + linear_combination h0-h1 + exact sub_eq_zero.mp ((mul_eq_zero.mp he).resolve_right (mul_ne_zero hn hn1)) + have hv : c (Equiv.refl (Fin 2))=((d : ℂ)*((d : ℂ)+1))⁻¹ := by + rw [← he] at h0 + rw [← one_div] + apply (eq_div_iff hs).mpr + linear_combination h0 + change tensorAverage (matrixHaar d) T=_ + rw [hc,sum_perm_two,← he,hv,positionMatrix_refl,smul_add] + +theorem haar_column_fourth (d : ℕ) (hd : 2 ≤ d) (z i j k l : Fin d) : + (∫ U : Matrix.unitaryGroup (Fin d) ℂ, + (U : Matrix (Fin d) (Fin d) ℂ) i z * star ((U : Matrix (Fin d) (Fin d) ℂ) j z) * + (U : Matrix (Fin d) (Fin d) ℂ) k z * star ((U : Matrix (Fin d) (Fin d) ℂ) l z) + ∂matrixHaar d) = + ((d : ℂ)*((d : ℂ)+1))⁻¹ * + ((if i=j ∧ k=l then 1 else 0)+(if i=l ∧ k=j then 1 else 0)) := by + classical + have hh := congrArg (fun A : Matrix (Fin 2 → Fin d) (Fin 2 → Fin d) ℂ => + A ![i,k] ![j,l]) (tensorAverage_column_pair d hd z) + rw [tensorAverage_single_apply] at hh + have he : (![i,k] : Fin 2 → Fin d)=![j,l] ↔ i=j ∧ k=l := by simp [funext_iff,Fin.forall_fin_two] + have he' : (![j,l] : Fin 2 → Fin d)=![i,k] ∘ Equiv.swap 0 1 ↔ i=l ∧ k=j := by + simp [funext_iff,Fin.forall_fin_two,eq_comm,and_comm] + simp only [Matrix.smul_apply,smul_eq_mul,Matrix.add_apply,Matrix.one_apply,positionMatrix] at hh + simp only [he,he'] at hh + convert hh using 1 + apply integral_congr_ae + filter_upwards [] with U + simp [tensorMatrix,Fin.prod_univ_two,star_mul] + ring + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/SimultaneousDispersion.lean b/lean/OAI/Analysis/FreeWords/SimultaneousDispersion.lean new file mode 100644 index 0000000000000000000000000000000000000000..72cd75bcdd1eea09bb0f8ca8ebcc34928219e596 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/SimultaneousDispersion.lean @@ -0,0 +1,120 @@ +import Mathlib +import OAI.Analysis.FreeWords.TraceTransfer +import OAI.Analysis.FreeWords.TupleHull + +namespace OAI + +noncomputable section + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) {ι : Type*} [Fintype ι] + +end + +end KKFactorSupport + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) {ι : Type*} [Fintype ι] + +theorem tupleVector_norm_sq (x : ι → ConcreteAlgebra M) : + ‖tupleVector τ x‖^2 = ∑ i, (traceNorm τ (x i))^2 := by + rw [PiLp.norm_sq_eq_of_L2] + apply Finset.sum_congr rfl + intro i hi + change ‖gnsVector (tracePositive τ) (x i)‖^2 = _ + rw [@norm_sq_eq_re_inner ℂ,gnsVector_inner] + have he := congrArg Complex.re (traceNorm_sq τ (x i)) + exact he.symm + +omit [Fintype ι] in +theorem tupleVector_add (x y : ι → ConcreteAlgebra M) : + tupleVector τ (fun i => x i + y i) = tupleVector τ x + tupleVector τ y := by + ext i + exact map_add (gnsVector (tracePositive τ)) (x i) (y i) + +omit [Fintype ι] in +@[simp] theorem tupleVector_zero : tupleVector τ (fun _ : ι => 0) = 0 := by + ext i + exact map_zero (gnsVector (tracePositive τ)) + +theorem exists_simultaneous_dispersion (hM : KKFreeLiftFrontier.IsFactor M) + (x : ι → ConcreteAlgebra M) (hx : ∀ i, τ.map (x i) = 0) : + ∃ u : unitary (ConcreteAlgebra M), + ∑ i, (traceNorm τ (x i + algebraConj u (x i)))^2 ≤ + 3 * ∑ i, (traceNorm τ (x i))^2 := by + let : InnerProductSpace ℝ (TupleSpace τ (ι := ι)) := + InnerProductSpace.rclikeToReal ℂ (TupleSpace τ (ι := ι)) + let v := tupleVector τ x + have hz : (0 : TupleSpace τ (ι := ι)) ∈ tupleHull τ x := by + simpa only [hx,zero_smul,tupleVector_zero] using tuple_trace_in_hull τ hM x + have hout : ∃ u : unitary (ConcreteAlgebra M), ‖v + tupleConj τ u v‖^2 ≤ 3 * ‖v‖^2 := by + by_cases hv : v = 0 + · exact ⟨1,by simp [hv]⟩ + · have hc : 0 < ‖v‖^2/2 := by positivity + let c := ‖v‖^2/2 + let φ : TupleSpace τ (ι := ι) →L[ℝ] ℝ := innerSL ℝ v + have hex : ∃ u : unitary (ConcreteAlgebra M), φ (tupleConj τ u v) ≤ c := by + by_contra hh + push Not at hh + have ho : tupleOrbit τ x ⊆ φ ⁻¹' Set.Ici c := by + rintro _ ⟨u,rfl⟩ + change c ≤ φ (tupleVector τ (fun i => algebraConj u (x i))) + rw [← tupleConj_vector] + exact (hh u).le + have hcv : Convex ℝ (φ ⁻¹' Set.Ici c) := + (convex_Ici c).linear_preimage φ.toLinearMap + have hall : tupleHull τ x ⊆ φ ⁻¹' Set.Ici c := + closure_minimal (convexHull_min ho hcv) (isClosed_Ici.preimage φ.continuous) + have hh0 := hall hz + change c ≤ φ 0 at hh0 + rw [map_zero] at hh0 + exact (not_le_of_gt hc) hh0 + obtain ⟨u,hu⟩ := hex + refine ⟨u,?_⟩ + simp only [norm_add_sq_real,tupleConj_norm] + change ⟪v,tupleConj τ u v⟫_ℝ ≤ ‖v‖^2/2 at hu + linarith only [hu] + obtain ⟨u,hu⟩ := hout + refine ⟨u,?_⟩ + simpa only [v,tupleConj_vector,← tupleVector_add,tupleVector_norm_sq] using hu + +end + +end KKFactorSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/SingleCutNorm.lean b/lean/OAI/Analysis/FreeWords/SingleCutNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..40272d56db45f0189d12f046b36704d08deb99f2 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/SingleCutNorm.lean @@ -0,0 +1,66 @@ +import Mathlib +import OAI.Analysis.FreeWords.CutAlgebra + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators + +noncomputable section + +variable {R ι : Type*} [NormedRing R] + +theorem norm_word_le_pow (D : ι → R) (w : List ι) {t : ℝ} + (h1 : ‖(1:R)‖ ≤ 1) (ht : 0 ≤ t) (hD : ∀ i, ‖D i‖ ≤ t) : + ‖(w.map D).prod‖ ≤ t^w.length := by + induction w with + | nil => simpa using h1 + | cons i w ih => + simp only [List.map_cons, List.prod_cons, List.length_cons, pow_succ'] + exact (norm_mul_le _ _).trans (mul_le_mul (hD i) ih (norm_nonneg _) ht) + +theorem norm_cutSum_le (C D K : ι → R) (w : List ι) {t : ℝ} + (h1 : ‖(1:R)‖ ≤ 1) (ht : 0 ≤ t) + (hC : ∀ i, ‖C i‖ ≤ t) (hD : ∀ i, ‖D i‖ ≤ t) (hK : ∀ i, ‖K i‖ ≤ 2) : + ‖cutSum C D K w‖ ≤ (w.length + 1 : ℝ) * t^w.length + + (2*w.length : ℝ) * t^(w.length-1) := by + induction w with + | nil => simpa [cutSum] using h1 + | cons i w ih => + have hprod := norm_word_le_pow D w h1 ht hD + have hDK : ‖D i + K i‖ ≤ t+2 := (norm_add_le _ _).trans (add_le_add (hD i) (hK i)) + have h : ‖cutSum C D K (i :: w)‖ ≤ + t*((w.length+1:ℝ)*t^w.length+(2*w.length:ℝ)*t^(w.length-1)) + + (t+2)*t^w.length := by + apply (norm_add_le _ _).trans + exact add_le_add ((norm_mul_le _ _).trans + (mul_le_mul (hC i) ih (norm_nonneg _) ht)) + ((norm_mul_le _ _).trans (mul_le_mul hDK hprod (norm_nonneg _) (by positivity))) + apply h.trans_eq + simp only [List.length_cons, Nat.cast_add, Nat.cast_one, Nat.add_sub_cancel, pow_succ'] + cases hn : w.length with + | zero => simp; ring + | succ n => simp only [Nat.succ_sub_one, Nat.cast_add, Nat.cast_one, pow_succ']; ring + +theorem norm_cutSum_le_simple (C D K : ι → R) (w : List ι) {t : ℝ} + (h1 : ‖(1:R)‖ ≤ 1) (ht : 0 ≤ t) (ht1 : t ≤ 1) (hw : w ≠ []) + (hC : ∀ i, ‖C i‖ ≤ t) (hD : ∀ i, ‖D i‖ ≤ t) (hK : ∀ i, ‖K i‖ ≤ 2) : + ‖cutSum C D K w‖ ≤ (3*w.length+1:ℝ) * t^(w.length-1) := by + apply (norm_cutSum_le C D K w h1 ht hC hD hK).trans + have hn : 1 ≤ w.length := List.length_pos_iff.mpr hw + have hp : t^w.length ≤ t^(w.length-1) := by + have he : w.length = (w.length-1)+1 := by omega + rw [he, Nat.add_sub_cancel, pow_succ] + exact mul_le_of_le_one_right (pow_nonneg ht _) ht1 + have hmul := mul_le_mul_of_nonneg_left hp (show 0 ≤ (w.length+1:ℝ) by positivity) + nlinarith + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/SpectralClip.lean b/lean/OAI/Analysis/FreeWords/SpectralClip.lean new file mode 100644 index 0000000000000000000000000000000000000000..268cfa89faa58143358dde63f8d51c958943b1be --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/SpectralClip.lean @@ -0,0 +1,288 @@ +import Mathlib +import OAI.Analysis.FreeWords.UltraTrace + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace.seqOrder + +attribute [local instance] KKUltraTrace.seqSOR + +open scoped InnerProductSpace + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +def clipFunction (b u : ℝ) : ℝ := b / max b u + +def spectralClip (b : ℝ) (x : A) : A := + x * cfc (clipFunction b) (CFC.sqrt (star x * x)) + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +noncomputable section + +theorem clipFunction_zero {b : ℝ} (hb : 0 < b) : clipFunction b 0 = 1 := by + simp [clipFunction, max_eq_left hb.le, ne_of_gt hb] + +theorem clipFunction_pos {b u : ℝ} (hb : 0 < b) (hu : 0 < u) : + clipFunction b u = min 1 (b/u) := by + by_cases h : u ≤ b + · rw [clipFunction, max_eq_left h, div_self (ne_of_gt hb), min_eq_left] + exact (le_div_iff₀ hu).mpr (by simpa using h) + · have h' : b ≤ u := le_of_lt (lt_of_not_ge h) + rw [clipFunction, max_eq_right h', min_eq_right] + exact (div_le_one hu).mpr h' + +theorem continuous_clipFunction {b : ℝ} (hb : 0 < b) : Continuous (clipFunction b) := by + unfold clipFunction + exact continuous_const.div (continuous_const.max continuous_id) + (fun u => ne_of_gt (lt_of_lt_of_le hb (le_max_left b u))) + +def clipWeight (b t : ℝ) : ℝ := clipFunction b (Real.sqrt t) + +theorem continuous_clipWeight {b : ℝ} (hb : 0 < b) : Continuous (clipWeight b) := + (continuous_clipFunction hb).comp Real.continuous_sqrt + +theorem clipWeight_bounds {b t : ℝ} (hb : 0 < b) (ht : 0 ≤ t) : + 0 ≤ clipWeight b t ∧ clipWeight b t ≤ 1 ∧ + t * (clipWeight b t)^2 ≤ b^2 ∧ t * (clipWeight b t)^2 ≤ t ∧ + t * (1-clipWeight b t)^2 ≤ t := by + have hmax : 0 < max b (Real.sqrt t) := lt_of_lt_of_le hb (le_max_left _ _) + have hw0 : 0 ≤ clipWeight b t := div_nonneg hb.le hmax.le + have hw1 : clipWeight b t ≤ 1 := (div_le_one hmax).mpr (le_max_left _ _) + have hu := Real.sqrt_nonneg t + have hu2 := Real.sq_sqrt ht + have hprod : Real.sqrt t * clipWeight b t ≤ b := by + dsimp [clipWeight,clipFunction] + rw [← mul_div_assoc] + apply (div_le_iff₀ hmax).mpr + nlinarith [mul_le_mul_of_nonneg_left (le_max_right b (Real.sqrt t)) hb.le] + have hsq : (Real.sqrt t * clipWeight b t)^2 ≤ b^2 := + pow_le_pow_left₀ (mul_nonneg hu hw0) hprod 2 + rw [mul_pow,hu2] at hsq + have hw2 : (clipWeight b t)^2 ≤ 1 := by nlinarith + have he2 : (1-clipWeight b t)^2 ≤ 1 := by nlinarith + exact ⟨hw0,hw1,hsq,by simpa using mul_le_mul_of_nonneg_left hw2 ht, + by simpa using mul_le_mul_of_nonneg_left he2 ht⟩ + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +theorem spectralClip_eq {b : ℝ} (hb : 0 < b) (x : A) : + spectralClip b x = x*cfc (clipWeight b) (star x*x) := by + unfold spectralClip + rw [CFC.sqrt_eq_real_sqrt _ (star_mul_self_nonneg _),cfcₙ_eq_cfc] + congr 1 + exact (cfc_comp (clipFunction b) Real.sqrt (star x*x) + (IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _)) + (continuous_clipFunction hb).continuousOn Real.continuous_sqrt.continuousOn).symm + +theorem weighted_square (x : A) (w : ℝ → ℝ) (hw : Continuous w) : + star (x*cfc w (star x*x)) * (x*cfc w (star x*x)) = + cfc (fun t => t*(w t)^2) (star x*x) := by + have hs : IsSelfAdjoint (star x*x) := IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _) + have hc : Commute (cfc w (star x*x)) (star x*x) := + (Commute.refl _).cfc (by simpa only [hs.star_eq] using Commute.refl (star x*x)) w + rw [star_mul, IsSelfAdjoint.cfc.star_eq] + calc + (cfc w (star x*x)*star x)*(x*cfc w (star x*x)) = + (star x*x)*(cfc w (star x*x)*cfc w (star x*x)) := by + calc + _ = (cfc w (star x*x)*(star x*x))*cfc w (star x*x) := by noncomm_ring + _ = _ := by rw [hc.eq,mul_assoc] + _ = cfc (fun t => t*(w t)^2) (star x*x) := by + rw [cfc_mul (fun t : ℝ => t) (fun t => (w t)^2) _ continuousOn_id + (hw.pow 2).continuousOn,cfc_id' ℝ _ hs,cfc_pow w 2 _ hw.continuousOn,pow_two] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +theorem spectralClip_square {b : ℝ} (hb : 0 < b) (x : A) : + star (spectralClip b x)*spectralClip b x = + cfc (fun t => t*(clipWeight b t)^2) (star x*x) := by + rw [spectralClip_eq hb, weighted_square x _ (continuous_clipWeight hb)] + +theorem spectralClip_error_square {b : ℝ} (hb : 0 < b) (x : A) : + star (x-spectralClip b x)*(x-spectralClip b x) = + cfc (fun t => t*(1-clipWeight b t)^2) (star x*x) := by + have hs : IsSelfAdjoint (star x*x) := IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _) + have he : x-spectralClip b x = x*cfc (fun t => 1-clipWeight b t) (star x*x) := by + rw [spectralClip_eq hb,cfc_sub (fun _ : ℝ => 1) (clipWeight b) _ continuousOn_const + (continuous_clipWeight hb).continuousOn,cfc_const (1:ℝ) _ hs,map_one,mul_sub,mul_one] + rw [he] + exact weighted_square x (fun t => 1-clipWeight b t) (continuous_const.sub (continuous_clipWeight hb)) + +theorem norm_spectralClip_le {b : ℝ} (hb : 0 < b) (x : A) : ‖spectralClip b x‖ ≤ b := by + have h : ‖star (spectralClip b x)*spectralClip b x‖ ≤ b^2 := by + rw [spectralClip_square hb] + apply norm_cfc_le (sq_nonneg b) + intro t ht + have ht0 := spectrum_nonneg_of_nonneg (star_mul_self_nonneg x) ht + rw [Real.norm_eq_abs,abs_of_nonneg (mul_nonneg ht0 (sq_nonneg _))] + exact (clipWeight_bounds hb ht0).2.2.1 + rw [CStarRing.norm_star_mul_self] at h + nlinarith [norm_nonneg (spectralClip b x)] + +theorem spectralClip_square_le {b : ℝ} (hb : 0 < b) (x : A) : + star (spectralClip b x)*spectralClip b x ≤ star x*x := by + rw [spectralClip_square hb] + conv_rhs => rw [← cfc_id' ℝ (star x*x) (IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _))] + apply (cfc_le_iff _ _ _ ((continuous_id.mul ((continuous_clipWeight hb).pow 2)).continuousOn) + continuousOn_id).mpr + intro t ht + exact (clipWeight_bounds hb (spectrum_nonneg_of_nonneg (star_mul_self_nonneg x) ht)).2.2.2.1 + +theorem spectralClip_error_square_le {b : ℝ} (hb : 0 < b) (x : A) : + star (x-spectralClip b x)*(x-spectralClip b x) ≤ star x*x := by + rw [spectralClip_error_square hb] + conv_rhs => rw [← cfc_id' ℝ (star x*x) (IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _))] + apply (cfc_le_iff (fun t => t*(1-clipWeight b t)^2) (fun t => t) (star x*x) ((continuous_id.mul ((continuous_const.sub (continuous_clipWeight hb)).pow 2)).continuousOn) + continuousOn_id).mpr + intro t ht + exact (clipWeight_bounds hb (spectrum_nonneg_of_nonneg (star_mul_self_nonneg x) ht)).2.2.2.2 + +theorem spectralClip_right_support {b : ℝ} (hb : 0 < b) (x p : A) + (hp : IsStarProjection p) (hxp : x*p=x) : spectralClip b x*p = spectralClip b x := by + have hs : IsSelfAdjoint (star x*x) := IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _) + have hsp : (star x*x)*p = star x*x := by rw [mul_assoc,hxp] + have hps : p*(star x*x) = star x*x := by + simpa only [star_mul,hp.isSelfAdjoint.star_eq,hs.star_eq] using congrArg star hsp + have hc : Commute (cfc (clipWeight b) (star x*x)) p := + (show Commute (star x*x) p from hsp.trans hps.symm).cfc + (by simpa only [hs.star_eq] using (show Commute (star x*x) p from hsp.trans hps.symm)) + (clipWeight b) + rw [spectralClip_eq hb,mul_assoc,hc.eq,← mul_assoc,hxp] + +theorem spectralClip_eq_self {b : ℝ} (hb : 0 < b) (x : A) (hx : ‖x‖ ≤ b) : + spectralClip b x = x := by + nontriviality A + have hs : IsSelfAdjoint (star x*x) := IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _) + have hw : (spectrum ℝ (star x*x)).EqOn (clipWeight b) (fun _ => 1) := by + intro t ht + have ht0 := spectrum_nonneg_of_nonneg (star_mul_self_nonneg x) ht + have htn : t ≤ ‖x‖^2 := by + have hn := spectrum.norm_le_norm_of_mem ht + simpa only [Real.norm_eq_abs,abs_of_nonneg ht0,CStarRing.norm_star_mul_self,pow_two] using hn + have hsqrt : Real.sqrt t ≤ b := + ((Real.sqrt_le_iff).mpr ⟨norm_nonneg x,htn⟩).trans hx + simp only [clipWeight,clipFunction,max_eq_left hsqrt,div_self (ne_of_gt hb)] + rw [spectralClip_eq hb,cfc_congr hw,cfc_const (1:ℝ) _ hs,map_one,mul_one] + +variable {B : Type*} [CStarAlgebra B] [PartialOrder B] [StarOrderedRing B] + +theorem map_spectralClip (φ : A →⋆ₐ[ℂ] B) {b : ℝ} (hb : 0 < b) (x : A) : + φ (spectralClip b x) = spectralClip b (φ x) := by + have hs : IsSelfAdjoint (star x*x) := IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _) + have hm := φ.map_cfc (clipWeight b) (star x*x) (continuous_clipWeight hb).continuousOn + (by fun_prop) hs (hs.map φ) + rw [spectralClip_eq hb,spectralClip_eq hb,map_mul,hm,map_mul,map_star] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +@[instance_reducible] def _seqOrder : PartialOrder (ℕ →ᵇ A) := CStarAlgebra.spectralOrder _ + +attribute [local instance] KKUltraTrace._seqOrder + +omit [PartialOrder A] [StarOrderedRing A] in +theorem _seqSOR : StarOrderedRing (ℕ →ᵇ A) := CStarAlgebra.spectralOrderedRing _ + +attribute [local instance] KKUltraTrace._seqSOR + +def sequenceEval (j : ℕ) : (ℕ →ᵇ A) →⋆ₐ[ℂ] A where + toFun x := x j + map_one' := rfl + map_mul' _ _ := rfl + map_zero' := rfl + map_add' _ _ := rfl + commutes' _ := rfl + map_star' _ := rfl + +omit [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem sequenceEval_apply (j : ℕ) (x : ℕ →ᵇ A) : sequenceEval j x = x j := rfl + +@[simp] theorem spectralClip_apply {b : ℝ} (hb : 0 < b) (x : ℕ →ᵇ A) (j : ℕ) : + spectralClip b x j = spectralClip b (x j) := + map_spectralClip (sequenceEval j) hb x + +theorem spectral_clipping_transfer (τ : A →ₚ[ℂ] ℂ) (_ : τ 1 = 1) + (htr : ∀ x y : A, τ (x*y) = τ (y*x)) (ω : Ultrafilter ℕ) + (x : ℕ →ᵇ A) {b : ℝ} (hb : 0 < b) + (hn : ‖(ultraTrace τ ω).gnsStarAlgHom x‖ ≤ b) : + (∀ j, ‖spectralClip b (x j)‖ ≤ b ∧ + star (spectralClip b (x j)) * spectralClip b (x j) ≤ star (x j) * x j ∧ + star (x j-spectralClip b (x j)) * (x j-spectralClip b (x j)) ≤ star (x j)*x j) ∧ + (∀ j (p : A), IsStarProjection p → x j * p = x j → + spectralClip b (x j) * p = spectralClip b (x j)) ∧ + Tendsto (fun j => Real.sqrt (τ (star (x j-spectralClip b (x j)) * + (x j-spectralClip b (x j)))).re) (ω : Filter ℕ) (𝓝 0) := by + refine ⟨fun j => ⟨norm_spectralClip_le hb _, spectralClip_square_le hb _, + spectralClip_error_square_le hb _⟩, ?_, ?_⟩ + · exact fun j p hp hxp => spectralClip_right_support hb _ _ hp hxp + · let e : ℕ →ᵇ A := x - spectralClip b x + have hz : (ultraTrace τ ω).gnsStarAlgHom e = 0 := by + dsimp [e] + rw [map_sub, map_spectralClip _ hb, spectralClip_eq_self hb _ hn, sub_self] + have ht : ultraTrace τ ω (star e * e) = 0 := + (tracial_gns_zero _ (ultraTrace_tracial τ ω htr) e).mp hz + have hl := Complex.continuous_re.continuousAt.tendsto.comp (tendsto_ultraTraceValue τ ω (star e * e)) + change Tendsto (fun j => (τ ((star e * e) j)).re) (ω : Filter ℕ) + (𝓝 (ultraTrace τ ω (star e * e)).re) at hl + rw [ht, Complex.zero_re] at hl + have hs := Real.continuous_sqrt.continuousAt.tendsto.comp hl + simpa [e, spectralClip_apply hb, Function.comp_def] using hs + +end + +end KKUltraTrace +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/SpectralCuts.lean b/lean/OAI/Analysis/FreeWords/SpectralCuts.lean new file mode 100644 index 0000000000000000000000000000000000000000..095fd9447cf892a18b2729c74f9b2a9298d649f6 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/SpectralCuts.lean @@ -0,0 +1,161 @@ +import Mathlib +import OAI.Analysis.FreeWords.PositiveSupport + +namespace OAI + +noncomputable section + +namespace KKSpectralSupport + +open KKTraceTransfer KKPolarSupport + +open scoped InnerProductSpace ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {M : VonNeumannAlgebra H} + +end + +end KKSpectralSupport + +namespace KKSpectralSupport + +open KKTraceTransfer KKPolarSupport + +open scoped InnerProductSpace ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {M : VonNeumannAlgebra H} + +end + +end KKSpectralSupport + +namespace KKSpectralSupport + +open KKTraceTransfer KKPolarSupport + +open scoped InnerProductSpace ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {M : VonNeumannAlgebra H} + +theorem supportProjection_of_isUnit {a : ConcreteAlgebra M} (ha : IsUnit a) : + supportProjection a=1 := by + obtain ⟨u,rfl⟩ := ha + have h := congrArg (fun x : ConcreteAlgebra M => x*↑u⁻¹) (supportProjection_mul (u : ConcreteAlgebra M)) + simpa only [mul_assoc,Units.mul_inv, mul_one] using h + +theorem spectralCut_eq_one (a : ConcreteAlgebra M) (ha : IsSelfAdjoint a) {t : ℝ} + (ht : t < -‖a‖) : spectralCut a t=1 := by + rcases subsingleton_or_nontrivial (ConcreteAlgebra M) with h | h + · exact Subsingleton.elim _ _ + apply supportProjection_of_isUnit + apply (isUnit_cfc_iff (fun x : ℝ => max (x-t) 0) a (by fun_prop) ha).mpr + intro x hx + have hb : -‖a‖ ≤ x := by + have hh := spectrum.norm_le_norm_of_mem hx + exact (neg_le_neg hh).trans (neg_abs_le x) + exact ne_of_gt ((sub_pos.mpr (ht.trans_le hb)).trans_le (le_max_left _ _)) + +theorem spectralCut_eq_zero (a : ConcreteAlgebra M) {t : ℝ} (ht : ‖a‖ ≤ t) : + spectralCut a t=0 := by + rcases subsingleton_or_nontrivial (ConcreteAlgebra M) with h | h + · exact Subsingleton.elim _ _ + have he : positiveCut a t=0 := by + change cfc (fun x : ℝ => max (x-t) 0) a=0 + calc + _ = cfc (fun _ : ℝ => 0) a := by + apply cfc_congr + intro x hx + exact max_eq_right (sub_nonpos.mpr ((Real.le_norm_self x).trans ((spectrum.norm_le_norm_of_mem hx).trans ht))) + _ = 0 := cfc_const_zero ℝ a + rw [spectralCut,he,supportProjection_zero] + +theorem spectralCut_commute_of_commute {a b : ConcreteAlgebra M} + (_ : IsSelfAdjoint a) (hba : Commute b a) (t : ℝ) : Commute b (spectralCut a t) := by + apply supportProjection_commute (IsSelfAdjoint.of_nonneg (positiveCut_nonneg a t)) + exact (hba.symm.cfc_real _).symm + +theorem projection_restrict_nonneg {b p d : ConcreteAlgebra M} + (hp : IsStarProjection p) (hd : IsStarProjection d) (hdp : d ≤ p) + (hbd : Commute b d) (hpos : 0 ≤ b*p) : 0 ≤ b*d := by + have h := hd.isSelfAdjoint.conjugate_nonneg hpos + have he : d*(b*p)*d=b*d := by + calc + d*(b*p)*d=(d*b)*(p*d) := by simp only [mul_assoc] + _ = (b*d)*d := by rw [← hbd.eq,(hd.le_iff_mul_eq_right hp).mp hdp] + _ = b*d := by rw [mul_assoc,hd.isIdempotentElem.eq] + rwa [he] at h + +def spectralBand (a : ConcreteAlgebra M) (s t : ℝ) : ConcreteAlgebra M := + spectralCut a s-spectralCut a t + +theorem spectralBand_isProjection (a : ConcreteAlgebra M) {s t : ℝ} (hst : s ≤ t) : + IsStarProjection (spectralBand a s t) := + ((spectralCut_isProjection a t).le_iff_sub (spectralCut_isProjection a s)).mp (spectralCut_antitone a hst) + +theorem spectralBand_commute (a : ConcreteAlgebra M) (ha : IsSelfAdjoint a) (s t : ℝ) : + Commute a (spectralBand a s t) := (spectralCut_commute a ha s).sub_right (spectralCut_commute a ha t) + +theorem spectralBand_lower (a : ConcreteAlgebra M) (ha : IsSelfAdjoint a) {s t : ℝ} (hst : s ≤ t) : + 0 ≤ (a-algebraMap ℝ (ConcreteAlgebra M) s)*spectralBand a s t := by + apply projection_restrict_nonneg (spectralCut_isProjection a s) (spectralBand_isProjection a hst) + · exact sub_le_self _ (spectralCut_isProjection a t).nonneg + · exact (spectralBand_commute a ha s t).sub_left (Algebra.commutes _ _) + · rw [spectralCut_compression a ha s] + exact positiveCut_nonneg a s + +theorem spectralBand_upper (a : ConcreteAlgebra M) (ha : IsSelfAdjoint a) {s t : ℝ} (hst : s ≤ t) : + 0 ≤ (algebraMap ℝ (ConcreteAlgebra M) t-a)*spectralBand a s t := by + have hd := spectralBand_isProjection a hst + have htd : spectralCut a t*spectralBand a s t=0 := by + rw [spectralBand,mul_sub,((spectralCut_isProjection a t).le_iff_mul_eq_left + (spectralCut_isProjection a s)).mp (spectralCut_antitone a hst), + (spectralCut_isProjection a t).isIdempotentElem.eq,sub_self] + have hdle : spectralBand a s t ≤ 1-spectralCut a t := + (hd.le_iff_mul_eq_right (spectralCut_isProjection a t).one_sub).mpr (by rw [sub_mul,one_mul,htd,sub_zero]) + apply projection_restrict_nonneg (spectralCut_isProjection a t).one_sub hd hdle + · exact (show Commute (algebraMap ℝ (ConcreteAlgebra M) t) (spectralBand a s t) from Algebra.commutes _ _).sub_left (spectralBand_commute a ha s t) + · rw [← neg_sub a,neg_mul,spectralCut_complement a ha t,neg_neg] + exact negativeCut_nonneg a t + +end + +end KKSpectralSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/Stability.lean b/lean/OAI/Analysis/FreeWords/Stability.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d4bc09a230d684b14fce71ef4eb3c5802457903 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/Stability.lean @@ -0,0 +1,39 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace UniversalStrongKK + +universe u + +variable {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + [CompleteSpace H] + +def algebraUnitBall (M : VonNeumannAlgebra H) : Set (H →L[ℂ] H) := + {x | x ∈ M ∧ ‖x‖ ≤ 1} + +noncomputable def directedGap (M N : VonNeumannAlgebra H) : ℝ := + sSup ((fun x : H →L[ℂ] H => + sInf ((fun y : H →L[ℂ] H => ‖x - y‖) '' algebraUnitBall N)) '' algebraUnitBall M) + +noncomputable def kkDistance (M N : VonNeumannAlgebra H) : ℝ := + max (directedGap M N) (directedGap N M) + +def Implements (u : H →L[ℂ] H) (M N : VonNeumannAlgebra H) : Prop := + (fun x : H →L[ℂ] H => u * x * star u) '' (M : Set (H →L[ℂ] H)) = + (N : Set (H →L[ℂ] H)) + +def StrongKKStatement : Prop := + ∀ ε : ℝ, 0 < ε → ∃ δ : ℝ, 0 < δ ∧ + ∀ (H : Type u) [NormedAddCommGroup H] [InnerProductSpace ℂ H] + [CompleteSpace H] (M N : VonNeumannAlgebra H), + kkDistance M N < δ → + ∃ u : H →L[ℂ] H, u ∈ unitary (H →L[ℂ] H) ∧ + Implements u M N ∧ ‖u - 1‖ < ε + +end UniversalStrongKK +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/SupportProjections.lean b/lean/OAI/Analysis/FreeWords/SupportProjections.lean new file mode 100644 index 0000000000000000000000000000000000000000..f7bb53a25b61736ae4b6eabd1394b289d83cfa16 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/SupportProjections.lean @@ -0,0 +1,113 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorBase +import OAI.Analysis.FreeWords.PolarBounds + +namespace OAI + +noncomputable section + +namespace KKSpectralSupport + +open KKTraceTransfer KKPolarSupport + +open scoped InnerProductSpace ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def rangeProjection (a : H →L[ℂ] H) : H →L[ℂ] H := (closedRange a).starProjection + +theorem rangeProjection_isProjection (a : H →L[ℂ] H) : IsStarProjection (rangeProjection a) := + isStarProjection_starProjection + +theorem rangeProjection_mul (a : H →L[ℂ] H) : rangeProjection a*a=a := by + ext x + exact Submodule.starProjection_eq_self_iff.mpr (Submodule.le_topologicalClosure _ ⟨x,rfl⟩) + +theorem mul_rangeProjection {a : H →L[ℂ] H} (ha : IsSelfAdjoint a) : a*rangeProjection a=a := by + simpa only [star_mul,ha.star_eq,(rangeProjection_isProjection a).isSelfAdjoint.star_eq] + using congrArg star (rangeProjection_mul a) + +theorem annihilate_rangeProjection {a b : H →L[ℂ] H} (hab : b*a=0) : b*rangeProjection a=0 := by + have hb : ∀ z : closedRange a, b z=0 := by + intro z + refine (closedRangeMap_dense a).induction_on (p := fun z => b z=0) z ?_ ?_ + · exact isClosed_eq (by fun_prop) continuous_const + · intro x + exact congrArg (fun T : H →L[ℂ] H => T x) hab + ext x + exact hb ((closedRange a).orthogonalProjectionOnto x) + +theorem rangeProjection_commute {a b : H →L[ℂ] H} + (hba : Commute b a) (hbsa : Commute (star b) a) : Commute b (rangeProjection a) := + UniversalStrongKK.commute_projection_of_invariant _ _ + (closedRange_invariant a b hba) (closedRange_invariant a (star b) hbsa) + +theorem rangeProjection_mem (M : VonNeumannAlgebra H) {a : H →L[ℂ] H} (ha : a ∈ M) : + rangeProjection a ∈ M := by + rw [← M.commutant_commutant,VonNeumannAlgebra.mem_commutant_iff] + intro b hb + exact (rangeProjection_commute + (VonNeumannAlgebra.mem_commutant_iff.mp hb a ha).symm + (VonNeumannAlgebra.mem_commutant_iff.mp (star_mem hb) a ha).symm).eq + +local instance supportConcreteOrder (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := + concreteOrder M + +local instance supportConcretePreorder (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := + (concreteOrder M).toPreorder + +local instance supportConcreteLE (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := + (concreteOrder M).toLE + +local instance supportConcreteSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := + concreteSOR M + +variable {M : VonNeumannAlgebra H} + +def supportProjection (a : ConcreteAlgebra M) : ConcreteAlgebra M := + ⟨rangeProjection (a : H →L[ℂ] H),rangeProjection_mem M a.property⟩ + +theorem supportProjection_isProjection (a : ConcreteAlgebra M) : IsStarProjection (supportProjection a) := by + constructor + · exact Subtype.ext (rangeProjection_isProjection (a : H →L[ℂ] H)).isIdempotentElem.eq + · exact Subtype.ext (rangeProjection_isProjection (a : H →L[ℂ] H)).isSelfAdjoint.star_eq + +theorem supportProjection_mul (a : ConcreteAlgebra M) : supportProjection a*a=a := + Subtype.ext (rangeProjection_mul (a : H →L[ℂ] H)) + +theorem mul_supportProjection {a : ConcreteAlgebra M} (ha : IsSelfAdjoint a) : + a*supportProjection a=a := by + simpa only [star_mul,ha.star_eq,(supportProjection_isProjection a).isSelfAdjoint.star_eq] + using congrArg star (supportProjection_mul a) + +theorem annihilate_supportProjection {a b : ConcreteAlgebra M} (hab : b*a=0) : + b*supportProjection a=0 := Subtype.ext (annihilate_rangeProjection (congrArg Subtype.val hab)) + +theorem supportProjection_commute {a b : ConcreteAlgebra M} (ha : IsSelfAdjoint a) + (hba : Commute b a) : Commute b (supportProjection a) := by + have hbsa : Commute (star b) a := by simpa only [ha.star_eq] using hba.star_star + exact Subtype.ext (rangeProjection_commute (congrArg Subtype.val hba.eq) + (congrArg Subtype.val hbsa.eq)).eq + +@[simp] theorem supportProjection_zero : supportProjection (0 : ConcreteAlgebra M)=0 := by + have h := annihilate_supportProjection (a := (0 : ConcreteAlgebra M)) (b := 1) (mul_zero 1) + simpa only [one_mul] using h + +@[simp] theorem supportProjection_one : supportProjection (1 : ConcreteAlgebra M)=1 := by + simpa only [mul_one] using supportProjection_mul (1 : ConcreteAlgebra M) + +theorem supportProjection_le {a : ConcreteAlgebra M} {p : ConcreteAlgebra M} + (hp : IsStarProjection p) (hpa : p*a=a) : supportProjection a ≤ p := by + have h : (1-p)*a=0 := by rw [sub_mul,one_mul,hpa,sub_self] + have hh := annihilate_supportProjection h + rw [sub_mul,one_mul] at hh + exact ((supportProjection_isProjection a).le_iff_mul_eq_right hp).mpr (sub_eq_zero.mp hh).symm + +end + +end KKSpectralSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/SurjectiveExponentialLift.lean b/lean/OAI/Analysis/FreeWords/SurjectiveExponentialLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..8279a38efae6e52ae35d99d8977b6466e66174f5 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/SurjectiveExponentialLift.lean @@ -0,0 +1,48 @@ +import Mathlib +import OAI.Analysis.FreeWords.ExponentialUnitaryApprox + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer + +noncomputable section + +variable {A B : Type*} [CStarAlgebra A] [CStarAlgebra B] + +theorem selfAdjoint_preimage (φ : A →⋆ₐ[ℂ] B) (hsur : Function.Surjective φ) + (b : selfAdjoint B) : ∃ a : selfAdjoint A, φ a.val=b.val := by + obtain ⟨x,hx⟩ := hsur b.val + let y := (2:ℂ)⁻¹ • (x+star x) + have hy : IsSelfAdjoint y := by + change star y=y + simp [y,star_smul,star_add,add_comm] + refine ⟨⟨y,hy⟩,?_⟩ + change φ ((2:ℂ)⁻¹ • (x+star x))=b.val + rw [map_smul,map_add,map_star,hx,b.property.star_eq] + rw [← two_smul ℂ,smul_smul] + norm_num + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem unitary_dense_image (M : VonNeumannAlgebra H) + (φ : A →⋆ₐ[ℂ] ConcreteAlgebra M) (hsur : Function.Surjective φ) + (u : unitary (ConcreteAlgebra M)) (ε : ℝ) (hε : 0<ε) : + ∃ v : unitary A, ‖u.val-φ v.val‖<ε := by + obtain ⟨b,hb⟩ := unitary_exponential_approximation M u ε hε + obtain ⟨a,ha⟩ := selfAdjoint_preimage φ hsur b + refine ⟨(selfAdjoint.expUnitary a),?_⟩ + rw [map_expUnitary] + have he : (⟨φ a.val,a.property.map φ⟩ : selfAdjoint (ConcreteAlgebra M))=b := Subtype.ext ha + rw [he] + exact hb + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TensorCalculus.lean b/lean/OAI/Analysis/FreeWords/TensorCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e2eb399a1c2f23cb46f62188e6826e1b4c17690 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TensorCalculus.lean @@ -0,0 +1,101 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators Matrix.Norms.L2Operator + +open NormedSpace + +noncomputable section + +def tensorMatrix {r d : ℕ} (U : Matrix (Fin d) (Fin d) ℂ) : + Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ := + fun a b => ∏ i, U (a i) (b i) + +def lieMatrix {r d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) : + Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ := + fun a b => ∑ s, (∏ t ∈ Finset.univ.erase s, if a t=b t then (1 : ℂ) else 0)*A (a s) (b s) + +theorem lieMatrix_add {r d : ℕ} (A B : Matrix (Fin d) (Fin d) ℂ) : + lieMatrix (r := r) (A+B)=lieMatrix A+lieMatrix B := by + ext a b + simp [lieMatrix,mul_add,Finset.sum_add_distrib] + +theorem lieMatrix_smul {r d : ℕ} (c : ℂ) (A : Matrix (Fin d) (Fin d) ℂ) : + lieMatrix (r := r) (c • A)=c • lieMatrix A := by + ext a b + simp [lieMatrix,Finset.mul_sum,mul_left_comm] + +theorem lieMatrix_sub {r d : ℕ} (A B : Matrix (Fin d) (Fin d) ℂ) : + lieMatrix (r := r) (A-B)=lieMatrix A-lieMatrix B := by + ext a b + simp [lieMatrix,mul_sub,Finset.sum_sub_distrib] + +def matrixEntryCLM {d : ℕ} (i j : Fin d) : Matrix (Fin d) (Fin d) ℂ →L[ℝ] ℂ := + LinearMap.toContinuousLinearMap + { toFun := fun A => A i j + map_add' := fun _ _ => rfl + map_smul' := fun _ _ => rfl } + +@[simp] theorem matrixEntryCLM_apply {d : ℕ} (i j : Fin d) (A : Matrix (Fin d) (Fin d) ℂ) : + matrixEntryCLM i j A=A i j := rfl + +theorem hasDerivAt_tensor_exp {r d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) + (a b : Fin r → Fin d) : + HasDerivAt (fun t : ℝ => tensorMatrix (exp (t • A)) a b) (lieMatrix A a b) 0 := by + have he : HasDerivAt (fun t : ℝ => exp (t • A)) A 0 := by + simpa using hasDerivAt_exp_smul_const A (0 : ℝ) + have hel (i j : Fin d) : HasDerivAt (fun t : ℝ => (exp (t • A)) i j) (A i j) 0 := by + simpa only [Function.comp_def,matrixEntryCLM_apply] using (matrixEntryCLM i j).hasFDerivAt.comp_hasDerivAt 0 he + have hp := HasDerivAt.fun_finsetProd (u := Finset.univ) (fun s _ => hel (a s) (b s)) + simpa [tensorMatrix,lieMatrix,Matrix.one_apply,smul_eq_mul] using hp + +theorem commute_lieMatrix_skew {r d : ℕ} + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) + (hT : ∀ U : Matrix.unitaryGroup (Fin d) ℂ, + Commute T (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ))) + (A : Matrix (Fin d) (Fin d) ℂ) (hA : star A= -A) : Commute T (lieMatrix A) := by + let _ : NormedAlgebra ℚ (Matrix (Fin d) (Fin d) ℂ) := .restrictScalars ℚ ℂ _ + ext a b + have hp (t : ℝ) : exp (t • A) ∈ unitary (Matrix (Fin d) (Fin d) ℂ) := by + apply exp_mem_unitary_of_mem_skewAdjoint + change star (t • A)= -(t • A) + simp [hA] + have heq (t : ℝ) : + (∑ c, T a c*tensorMatrix (exp (t • A)) c b)= + ∑ c, tensorMatrix (exp (t • A)) a c*T c b := by + exact congrFun (congrFun (hT ⟨exp (t • A),hp t⟩).eq a) b + have hL : HasDerivAt (fun t : ℝ => ∑ c, T a c*tensorMatrix (exp (t • A)) c b) + (∑ c, T a c*lieMatrix A c b) 0 := by + exact HasDerivAt.fun_sum (fun c _ => (hasDerivAt_tensor_exp A c b).const_mul (T a c)) + have hR : HasDerivAt (fun t : ℝ => ∑ c, tensorMatrix (exp (t • A)) a c*T c b) + (∑ c, lieMatrix A a c*T c b) 0 := by + exact HasDerivAt.fun_sum (fun c _ => (hasDerivAt_tensor_exp A a c).mul_const (T c b)) + exact hL.unique (hR.congr_of_eventuallyEq (Filter.Eventually.of_forall (fun t => heq t))) + +theorem commute_lieMatrix {r d : ℕ} + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) + (hT : ∀ U : Matrix.unitaryGroup (Fin d) ℂ, + Commute T (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ))) + (A : Matrix (Fin d) (Fin d) ℂ) : Commute T (lieMatrix A) := by + have h1 : star (A-star A)= -(A-star A) := by simp [star_sub] + have h2 : star (Complex.I • (A+star A))= -(Complex.I • (A+star A)) := by + simp [star_smul,star_add,Complex.conj_I,add_comm] + have hc1 := commute_lieMatrix_skew T hT (A-star A) h1 + have hc2 := commute_lieMatrix_skew T hT (Complex.I • (A+star A)) h2 + have he : A=(1/2 : ℂ) • ((A-star A)-Complex.I • (Complex.I • (A+star A))) := by + simp only [smul_smul,Complex.I_mul_I,neg_one_smul,sub_neg_eq_add] + module + rw [he,lieMatrix_smul,lieMatrix_sub,lieMatrix_smul] + exact (hc1.sub_right (hc2.smul_right Complex.I)).smul_right (1/2 : ℂ) + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TensorGram.lean b/lean/OAI/Analysis/FreeWords/TensorGram.lean new file mode 100644 index 0000000000000000000000000000000000000000..901b5c94de11ca91424342a5460e05e2e6b648f5 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TensorGram.lean @@ -0,0 +1,89 @@ +import Mathlib +import OAI.Analysis.FreeWords.TensorCalculus +import OAI.Analysis.FreeWords.TensorLieSpan + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators Matrix.Norms.L2Operator InnerProductSpace + +noncomputable section + +theorem positionMatrix_tensorMatrix_commute {r d : ℕ} (π : Equiv.Perm (Fin r)) + (U : Matrix (Fin d) (Fin d) ℂ) : Commute (positionMatrix (d := d) π) (tensorMatrix U) := by + classical + ext a b + have hh (c : Fin r → Fin d) : b=c ∘ π ↔ c=b ∘ π.symm := by + constructor + · intro he + funext s + have h := congrFun he (π.symm s) + simpa only [Function.comp_apply,Equiv.apply_symm_apply] using h.symm + · rintro rfl + funext s + simp + simp only [Matrix.mul_apply,positionMatrix,hh] + simp only [ite_mul,one_mul,zero_mul,mul_ite,mul_one,mul_zero,Finset.sum_ite_eq', + Finset.mem_univ,ite_true] + unfold tensorMatrix + simpa only [Function.comp_apply,Equiv.symm_apply_apply] using + Equiv.prod_comp π (fun s => U (a s) (b (π.symm s))) + +def positionVector {r d : ℕ} (π : Equiv.Perm (Fin r)) : + EuclideanSpace ℂ ((Fin r → Fin d) × (Fin r → Fin d)) := + WithLp.toLp 2 (fun p => positionMatrix π p.1 p.2) + +theorem positionVector_linearIndependent {r d : ℕ} (hrd : r ≤ d) : + LinearIndependent ℂ (positionVector (r := r) (d := d)) := by + classical + rw [Fintype.linearIndependent_iff] + intro c hc + let a : Fin r → Fin d := Fin.castLE hrd + have ha : Function.Injective a := Fin.castLE_injective hrd + intro σ + have he (π : Equiv.Perm (Fin r)) : a ∘ σ=a ∘ π ↔ σ=π := by + constructor + · intro h + apply Equiv.ext + intro s + exact ha (congrFun h s) + · rintro rfl; rfl + have hz := congrArg (fun v : EuclideanSpace ℂ ((Fin r → Fin d) × (Fin r → Fin d)) => + v (a,a ∘ σ)) hc + simpa [positionVector,positionMatrix,he] using hz + +def permutationGram (r d : ℕ) : Matrix (Equiv.Perm (Fin r)) (Equiv.Perm (Fin r)) ℂ := + Matrix.gram ℂ (positionVector (d := d)) + +theorem permutationGram_det_ne_zero {r d : ℕ} (hrd : r ≤ d) : + (permutationGram r d).det ≠ 0 := + Matrix.det_gram_ne_zero_iff_linearIndependent.mpr (positionVector_linearIndependent hrd) + +def matrixPair {ι : Type*} [Fintype ι] (S T : Matrix ι ι ℂ) : ℂ := + Matrix.trace (star S*T) + +theorem matrixPair_apply {ι : Type*} [Fintype ι] (S T : Matrix ι ι ℂ) : + matrixPair S T=∑ a,∑ b,star (S a b)*T a b := by + simp only [matrixPair,Matrix.trace,Matrix.diag,Matrix.mul_apply,Matrix.star_apply] + rw [Finset.sum_comm] + +theorem permutationGram_apply {r d : ℕ} (π σ : Equiv.Perm (Fin r)) : + permutationGram r d π σ=matrixPair (positionMatrix (d := d) π) (positionMatrix σ) := by + rw [matrixPair_apply] + simp [permutationGram,Matrix.gram_apply,positionVector,PiLp.inner_apply, + RCLike.inner_apply,Fintype.sum_prod_type,mul_comm] + +theorem matrixPair_sum_smul {ι κ : Type*} [Fintype ι] [Fintype κ] + (S : Matrix ι ι ℂ) (T : κ → Matrix ι ι ℂ) (c : κ → ℂ) : + matrixPair S (∑ j,c j • T j)=∑ j,c j*matrixPair S (T j) := by + simp [matrixPair,Matrix.mul_sum,Matrix.mul_smul,Matrix.trace_smul,smul_eq_mul] + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TensorHaar.lean b/lean/OAI/Analysis/FreeWords/TensorHaar.lean new file mode 100644 index 0000000000000000000000000000000000000000..b021c0c9fe16c2a74ad042fdc3e542c0c9d67357 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TensorHaar.lean @@ -0,0 +1,137 @@ +import Mathlib +import OAI.Analysis.FreeWords.TensorUnitaryEnd + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators Matrix.Norms.L2Operator + +open MeasureTheory + +noncomputable section + +instance matrixUnitaryMeasurable (d : ℕ) : MeasurableSpace (Matrix.unitaryGroup (Fin d) ℂ) := borel _ + +instance matrixUnitaryBorel (d : ℕ) : BorelSpace (Matrix.unitaryGroup (Fin d) ℂ) := ⟨rfl⟩ + +instance matrixUnitaryCompact (d : ℕ) : CompactSpace (Matrix.unitaryGroup (Fin d) ℂ) := by + apply isCompact_iff_compactSpace.mp + apply Metric.isCompact_of_isClosed_isBounded isClosed_unitary + rw [Metric.isBounded_iff_subset_closedBall (0 : Matrix (Fin d) (Fin d) ℂ)] + refine ⟨1,fun U hU => ?_⟩ + simp only [Metric.mem_closedBall,dist_zero_right] + rcases subsingleton_or_nontrivial (Matrix (Fin d) (Fin d) ℂ) with h | h + · simp [Subsingleton.elim U 0] + · exact le_of_eq (CStarRing.norm_coe_unitary ⟨U,hU⟩) + +def matrixHaar (d : ℕ) : Measure (Matrix.unitaryGroup (Fin d) ℂ) := + Measure.haarMeasure ⟨⟨Set.univ,isCompact_univ⟩,by simp⟩ + +instance matrixHaar_probability (d : ℕ) : IsProbabilityMeasure (matrixHaar d) := by + constructor + exact Measure.haarMeasure_self + +instance matrixHaar_leftInvariant (d : ℕ) : (matrixHaar d).IsMulLeftInvariant := by + unfold matrixHaar + infer_instance + +theorem tensorMatrix_mul {r d : ℕ} (U V : Matrix (Fin d) (Fin d) ℂ) : + tensorMatrix (r := r) (U*V)=tensorMatrix U*tensorMatrix V := by + classical + ext a b + simp only [tensorMatrix,Matrix.mul_apply] + rw [Fintype.prod_sum] + apply Finset.sum_congr rfl + intro c _ + exact Finset.prod_mul_distrib + +theorem tensorMatrix_one {r d : ℕ} : + tensorMatrix (r := r) (1 : Matrix (Fin d) (Fin d) ℂ)=1 := by + classical + ext a b + simp only [tensorMatrix,Matrix.one_apply,prod_delta_eq] + have he : (∀ t∈(Finset.univ : Finset (Fin r)), a t=b t) ↔ a=b := by simp [funext_iff] + simp only [he] + +theorem tensorMatrix_star {r d : ℕ} (U : Matrix (Fin d) (Fin d) ℂ) : + tensorMatrix (r := r) (star U)=star (tensorMatrix U) := by + ext a b + simp [tensorMatrix,Matrix.star_apply,star_prod] + +theorem tensorMatrix_unitary {r d : ℕ} (U : Matrix.unitaryGroup (Fin d) ℂ) : + tensorMatrix (r := r) (U : Matrix (Fin d) (Fin d) ℂ) ∈ + Matrix.unitaryGroup (Fin r → Fin d) ℂ := by + rw [Matrix.mem_unitaryGroup_iff,← tensorMatrix_star,← tensorMatrix_mul] + rw [Unitary.mul_star_self_of_mem U.property,tensorMatrix_one] + +theorem continuous_tensorMatrix {r d : ℕ} : + Continuous (tensorMatrix (r := r) (d := d)) := by + unfold tensorMatrix + fun_prop + +def tensorAverage {r d : ℕ} (μ : Measure (Matrix.unitaryGroup (Fin d) ℂ)) + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) := + ∫ U, tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)*T* + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)) ∂μ + +theorem continuous_tensorConjugation {r d : ℕ} + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) : + Continuous (fun U : Matrix.unitaryGroup (Fin d) ℂ => + tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)*T* + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ))) := by + exact ((continuous_tensorMatrix.comp continuous_subtype_val).mul continuous_const).mul + (continuous_tensorMatrix.comp continuous_subtype_val).star + +theorem tensorAverage_commute {r d : ℕ} + (μ : Measure (Matrix.unitaryGroup (Fin d) ℂ)) [IsProbabilityMeasure μ] + [μ.IsMulLeftInvariant] (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) + (V : Matrix.unitaryGroup (Fin d) ℂ) : + Commute (tensorAverage μ T) (tensorMatrix (V : Matrix (Fin d) (Fin d) ℂ)) := by + let S : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ := tensorMatrix (V : Matrix (Fin d) (Fin d) ℂ) + have hint := (continuous_tensorConjugation T).integrable_of_hasCompactSupport (μ := μ) + (HasCompactSupport.of_compactSpace _) + have hint' := ((continuous_tensorConjugation T).mul (continuous_const (y := star S))).integrable_of_hasCompactSupport (μ := μ) + (HasCompactSupport.of_compactSpace _) + change Integrable (fun U : Matrix.unitaryGroup (Fin d) ℂ => + tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)*T* + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ))*star S) μ at hint' + have he : S*tensorAverage μ T*star S=tensorAverage μ T := by + unfold tensorAverage + rw [mul_assoc,← integral_mul_const_of_integrable hint,← integral_const_mul_of_integrable hint'] + have heq (U : Matrix.unitaryGroup (Fin d) ℂ) : + S*(tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)*T* + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)))*star S = + tensorMatrix ((V*U : Matrix.unitaryGroup (Fin d) ℂ) : Matrix (Fin d) (Fin d) ℂ)*T* + star (tensorMatrix ((V*U : Matrix.unitaryGroup (Fin d) ℂ) : Matrix (Fin d) (Fin d) ℂ)) := by + change S*(tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)*T* + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)))*star S = + tensorMatrix ((V : Matrix (Fin d) (Fin d) ℂ)*(U : Matrix (Fin d) (Fin d) ℂ))*T* + star (tensorMatrix ((V : Matrix (Fin d) (Fin d) ℂ)*(U : Matrix (Fin d) (Fin d) ℂ))) + simp only [tensorMatrix_mul,star_mul,S,mul_assoc] + have hrewrite (U : Matrix.unitaryGroup (Fin d) ℂ) := + (mul_assoc S (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)*T* + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ))) (star S)).symm.trans (heq U) + simp_rw [hrewrite] + exact integral_mul_left_eq_self + (fun U : Matrix.unitaryGroup (Fin d) ℂ => tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ)*T* + star (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ))) V (μ := μ) + have hu : star S*S=1 := Unitary.star_mul_self_of_mem (tensorMatrix_unitary V) + have hh := congrArg (fun A => A*S) he + change tensorAverage μ T*S=S*tensorAverage μ T + simpa only [mul_assoc,hu,mul_one] using hh.symm + +theorem tensorAverage_span (r d : ℕ) (hrd : r ≤ d) + (μ : Measure (Matrix.unitaryGroup (Fin d) ℂ)) [IsProbabilityMeasure μ] + [μ.IsMulLeftInvariant] (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) : + ∃ c : Equiv.Perm (Fin r) → ℂ, tensorAverage μ T=∑ π,c π • positionMatrix π := by + exact unitary_tensor_commutant r d hrd _ (tensorAverage_commute μ T) + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TensorLieKernel.lean b/lean/OAI/Analysis/FreeWords/TensorLieKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..cda5549970dc122ad93ceb5de2c43ec8b8dc9141 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TensorLieKernel.lean @@ -0,0 +1,94 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators + +noncomputable section + +def LieInvariant {r d : ℕ} (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) : Prop := + ∀ (i j : Fin d) (a b : Fin r → Fin d), + (∑ s, if a s = i then T (Function.update a s j) b else 0) = + ∑ s, if b s = j then T a (Function.update b s i) else 0 + +theorem image_update_duplicate {r d : ℕ} (a : Fin r → Fin d) + (s t : Fin r) (hst : s ≠ t) (hat : a s = a t) (k : Fin d) : + Finset.univ.image (Function.update a s k) = insert k (Finset.univ.image a) := by + classical + ext z + simp only [Finset.mem_image, Finset.mem_univ, true_and, Finset.mem_insert] + constructor + · rintro ⟨u,hu⟩ + by_cases hus : u=s + · subst u + left + simpa using hu.symm + · right + exact ⟨u,by simpa [Function.update_of_ne hus] using hu⟩ + · rintro (rfl | ⟨u,rfl⟩) + · exact ⟨s,by simp⟩ + · by_cases hus : u=s + · subst u + exact ⟨t,by simpa [Function.update_of_ne hst.symm] using hat.symm⟩ + · exact ⟨u,by simp [Function.update_of_ne hus]⟩ + +theorem lieInvariant_eq_zero_of_injective_rows {r d : ℕ} (hrd : r ≤ d) + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) (hT : LieInvariant T) + (hz : ∀ a, Function.Injective a → ∀ b, T a b=0) : T=0 := by + classical + have hmain (m : ℕ) : ∀ a : Fin r → Fin d, + r - (Finset.univ.image a).card=m → ∀ b, T a b=0 := by + induction m using Nat.strong_induction_on with + | h m ih => + intro a hm b + by_cases hai : Function.Injective a + · exact hz a hai b + · obtain ⟨s,t,hat,hst⟩ := Function.not_injective_iff.mp hai + have hc : (Finset.univ.image a).card < r := by + have hle := Finset.card_image_le (s := Finset.univ) (f := a) + have hne : (Finset.univ.image a).card ≠ r := by + intro heq + have hh := Finset.card_image_iff.mp (show (Finset.univ.image a).card = Finset.univ.card by simpa using heq) + exact hai (fun x y hxy => hh (Finset.mem_univ x) (Finset.mem_univ y) hxy) + simpa using lt_of_le_of_ne (by simpa using hle) hne + obtain ⟨k,hk⟩ : ∃ k : Fin d, k ∉ Finset.univ.image a := by + by_contra hh + push Not at hh + have heq : Finset.univ.image a = Finset.univ := Finset.eq_univ_of_forall hh + have hcard := congrArg Finset.card heq + simp only [Finset.card_univ,Fintype.card_fin] at hcard + omega + let a' := Function.update a s k + have hc' : (Finset.univ.image a').card = (Finset.univ.image a).card+1 := by + rw [show a'=Function.update a s k from rfl, image_update_duplicate a s t hst hat, + Finset.card_insert_of_notMem hk] + have hlt : r - (Finset.univ.image a').card < m := by omega + have ha' : ∀ b, T a' b=0 := ih _ hlt a' rfl + have hsp : ∀ u : Fin r, a' u=k ↔ u=s := by + intro u + by_cases hus : u=s + · subst u; simp [a'] + · have hau : a u ≠ k := fun heq => hk (Finset.mem_image.mpr ⟨u,Finset.mem_univ u,heq⟩) + simp [a',hus,hau] + have hid : Function.update a' s (a s)=a := by + simp [a',Function.update_idem] + have he := hT k (a s) a' b + simp only [hsp] at he + rw [Finset.sum_eq_single s] at he + · simpa [hid,ha'] using he + · intro u _ hus + simp [hus] + · simp + ext a b + exact hmain _ a rfl b + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TensorLieSpan.lean b/lean/OAI/Analysis/FreeWords/TensorLieSpan.lean new file mode 100644 index 0000000000000000000000000000000000000000..7d957b0c323434ea6856a975c6b25b423a75ff1b --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TensorLieSpan.lean @@ -0,0 +1,177 @@ +import Mathlib +import OAI.Analysis.FreeWords.TensorLieKernel + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators + +noncomputable section + +def positionMatrix {r d : ℕ} (π : Equiv.Perm (Fin r)) : + Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ := + fun a b => if b = a ∘ π then 1 else 0 + +def labelCount {r d : ℕ} (a : Fin r → Fin d) (i : Fin d) : ℕ := + (Finset.univ.filter (fun s => a s=i)).card + +theorem labelCount_pos_iff {r d : ℕ} (a : Fin r → Fin d) (i : Fin d) : + 0 < labelCount a i ↔ ∃ s, a s=i := by + classical + simp [labelCount,Finset.card_pos,Finset.Nonempty] + +theorem LieInvariant.count_eq {r d : ℕ} {T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ} + (hT : LieInvariant T) {a b : Fin r → Fin d} (hne : T a b ≠ 0) (i : Fin d) : + labelCount a i=labelCount b i := by + classical + have hl : ∀ s, (if a s=i then T (Function.update a s i) b else 0) = + (if a s=i then T a b else 0) := by + intro s + split_ifs with hs + · rw [← hs,Function.update_eq_self] + · rfl + have hr : ∀ s, (if b s=i then T a (Function.update b s i) else 0) = + (if b s=i then T a b else 0) := by + intro s + split_ifs with hs + · rw [← hs,Function.update_eq_self] + · rfl + have he := hT i i a b + simp only [hl,hr,← Finset.sum_filter] at he + have he' : (labelCount a i : ℂ)*T a b = (labelCount b i : ℂ)*T a b := by + simpa [labelCount] using he + exact_mod_cast mul_right_cancel₀ hne he' + +theorem orbit_of_labelCount_eq {r d : ℕ} (a b : Fin r → Fin d) + (ha : Function.Injective a) (hcount : ∀ i, labelCount a i=labelCount b i) : + ∃ π : Equiv.Perm (Fin r), b=a ∘ π := by + classical + have hf : ∀ s, ∃ t, a t=b s := by + intro s + apply (labelCount_pos_iff a (b s)).mp + rw [hcount] + exact (labelCount_pos_iff b (b s)).mpr ⟨s,rfl⟩ + choose f hf using hf + have hsur : Function.Surjective f := by + intro t + have hh : 0 < labelCount b (a t) := by + rw [← hcount] + exact (labelCount_pos_iff a (a t)).mpr ⟨t,rfl⟩ + obtain ⟨s,hs⟩ := (labelCount_pos_iff b (a t)).mp hh + exact ⟨s,ha ((hf s).trans hs)⟩ + refine ⟨Equiv.ofBijective f hsur.bijective_of_finite,?_⟩ + funext s + exact (hf s).symm + +theorem update_exchange {ι α : Type*} [DecidableEq ι] (a b : ι → α) (s : ι) (i j : α) : + (a s=i ∧ b=Function.update a s j) ↔ + (b s=j ∧ a=Function.update b s i) := by + constructor <;> rintro ⟨h,rfl⟩ + · constructor + · simp + · simp [Function.update_idem,← h] + · constructor + · simp + · simp [Function.update_idem,← h] + +theorem positionMatrix_lieInvariant {r d : ℕ} (π : Equiv.Perm (Fin r)) : + LieInvariant (positionMatrix (d := d) π) := by + classical + intro i j a b + conv_rhs => rw [← Equiv.sum_comp π.symm] + apply Finset.sum_congr rfl + intro s _ + have hc : Function.update a s j ∘ π = Function.update (a ∘ π) (π.symm s) j := by + simpa using Function.update_comp_eq_of_injective a π.injective (π.symm s) j + have he := update_exchange (a ∘ π) b (π.symm s) i j + simp only [Function.comp_apply,Equiv.apply_symm_apply] at he + simp only [positionMatrix,hc,← ite_and] + have he' : (a s=i ∧ b=Function.update (a ∘ π) (π.symm s) j) ↔ + (b (π.symm s)=j ∧ Function.update b (π.symm s) i=a ∘ π) := by + simpa only [eq_comm] using he + simp only [he'] + +theorem LieInvariant.sub {r d : ℕ} {S T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ} + (hS : LieInvariant S) (hT : LieInvariant T) : LieInvariant (S-T) := by + classical + intro i j a b + have hh (p : Prop) [Decidable p] (x y : ℂ) : + (if p then x-y else 0)=(if p then x else 0)-(if p then y else 0) := by + split_ifs <;> simp + simp only [Matrix.sub_apply,hh,Finset.sum_sub_distrib] + rw [hS i j a b,hT i j a b] + +theorem position_sum_lieInvariant {r d : ℕ} (c : Equiv.Perm (Fin r) → ℂ) : + LieInvariant (∑ π, c π • positionMatrix (d := d) π) := by + classical + intro i j a b + have hh (p : Prop) [Decidable p] (f : Equiv.Perm (Fin r) → ℂ) : + (if p then ∑ π, c π*f π else 0)=∑ π, c π*(if p then f π else 0) := by + split_ifs <;> simp + simp only [Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul] + simp_rw [hh] + rw [Finset.sum_comm] + conv_rhs => rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro π _ + simp only [← Finset.mul_sum] + rw [positionMatrix_lieInvariant π i j a b] + +theorem lie_label_span {r d : ℕ} (hrd : r ≤ d) + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) (hT : LieInvariant T) + (hlabel : ∀ (g : Equiv.Perm (Fin d)) a b, T (g ∘ a) (g ∘ b)=T a b) : + ∃ c : Equiv.Perm (Fin r) → ℂ, T=∑ π, c π • positionMatrix π := by + classical + let a₀ : Fin r → Fin d := Fin.castLE hrd + have ha₀ : Function.Injective a₀ := Fin.castLE_injective hrd + let c : Equiv.Perm (Fin r) → ℂ := fun π => T a₀ (a₀ ∘ π) + let S : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ := ∑ π, c π • positionMatrix π + have hrow (b : Fin r → Fin d) : T a₀ b=S a₀ b := by + by_cases ho : ∃ π : Equiv.Perm (Fin r), b=a₀ ∘ π + · obtain ⟨π,rfl⟩ := ho + have he (σ : Equiv.Perm (Fin r)) : a₀ ∘ π=a₀ ∘ σ ↔ π=σ := by + constructor + · intro hh + apply Equiv.ext + intro s + exact ha₀ (congrFun hh s) + · rintro rfl; rfl + simp [S,Matrix.sum_apply,positionMatrix,he,c] + · have hz : T a₀ b=0 := by + by_contra hne + exact ho (orbit_of_labelCount_eq a₀ b ha₀ (hT.count_eq hne)) + simp [S,Matrix.sum_apply,positionMatrix,hz,show ∀ π : Equiv.Perm (Fin r), b ≠ a₀ ∘ π from fun π hh => ho ⟨π,hh⟩] + have hSl (g : Equiv.Perm (Fin d)) (a b : Fin r → Fin d) : S (g ∘ a) (g ∘ b)=S a b := by + dsimp only [S] + simp only [Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul] + apply Finset.sum_congr rfl + intro π _ + have hh : g ∘ b=(g ∘ a) ∘ π ↔ b=a ∘ π := by + constructor + · intro he + funext s + exact g.injective (congrFun he s) + · rintro rfl; rfl + simp only [positionMatrix,hh] + have hz : T-S=0 := by + apply lieInvariant_eq_zero_of_injective_rows hrd (T-S) (hT.sub (position_sum_lieInvariant c)) + intro a ha b + obtain ⟨g,hg⟩ := Equiv.Perm.exists_extending_pair a₀ a ha₀ ha + have hga : g ∘ a₀=a := funext hg + have hgb : g ∘ (g.symm ∘ b)=b := by ext; simp + have ht := hlabel g a₀ (g.symm ∘ b) + have hs := hSl g a₀ (g.symm ∘ b) + rw [hga,hgb] at ht hs + change T a b-S a b=0 + rw [ht,hs,hrow,sub_self] + exact ⟨c,sub_eq_zero.mp hz⟩ + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TensorUnitaryEnd.lean b/lean/OAI/Analysis/FreeWords/TensorUnitaryEnd.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad893275a372aa5ecdfb4eddd0c4d379a3ec475c --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TensorUnitaryEnd.lean @@ -0,0 +1,140 @@ +import Mathlib +import OAI.Analysis.FreeWords.TensorCalculus +import OAI.Analysis.FreeWords.TensorLieSpan + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators + +noncomputable section + +theorem prod_delta_eq {r d : ℕ} (s : Finset (Fin r)) (a b : Fin r → Fin d) : + (∏ t ∈ s, if a t=b t then (1 : ℂ) else 0)= + if ∀ t∈s, a t=b t then 1 else 0 := by + classical + by_cases h : ∀ t∈s, a t=b t + · rw [ite_eq_left h] + exact Finset.prod_eq_one (fun t ht => ite_eq_left (h t ht)) + · rw [ite_eq_right h] + obtain ⟨t,ht,hab⟩ : ∃ t∈s, a t ≠ b t := by + by_contra hh + apply h + intro t ht + by_contra hab + exact hh ⟨t,ht,hab⟩ + exact Finset.prod_eq_zero ht (by simp [hab]) + +theorem lieMatrix_single_apply {r d : ℕ} (i j : Fin d) (a b : Fin r → Fin d) : + lieMatrix (Matrix.single i j (1 : ℂ)) a b = + ∑ s, if a s=i ∧ b=Function.update a s j then 1 else 0 := by + classical + apply Finset.sum_congr rfl + intro s _ + rw [prod_delta_eq,Matrix.single_apply] + have hh : ((∀ t∈Finset.univ.erase s, a t=b t) ∧ (i=a s ∧ j=b s)) ↔ + (a s=i ∧ b=Function.update a s j) := by + constructor + · rintro ⟨hp,hi,hj⟩ + refine ⟨hi.symm,?_⟩ + funext t + by_cases hts : t=s + · subst t; simp [hj] + · simpa [Function.update_of_ne hts] using (hp t (Finset.mem_erase.mpr ⟨hts,Finset.mem_univ t⟩)).symm + · rintro ⟨hi,rfl⟩ + refine ⟨fun t ht => ?_,hi.symm,by simp⟩ + simp [Function.update_of_ne (Finset.mem_erase.mp ht).1] + have hb (p q : Prop) [Decidable p] [Decidable q] : + (if p then (1 : ℂ) else 0)*(if q then 1 else 0)=(if p ∧ q then 1 else 0) := by + split_ifs <;> simp_all + rw [hb] + simp only [hh] + +theorem lieMatrix_single_mul {r d : ℕ} (i j : Fin d) + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) (a b : Fin r → Fin d) : + (lieMatrix (r := r) (Matrix.single i j (1 : ℂ))*T) a b = + ∑ s, if a s=i then T (Function.update a s j) b else 0 := by + classical + simp only [Matrix.mul_apply,lieMatrix_single_apply,Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro s _ + by_cases hs : a s=i + · simp [hs] + · simp [hs] + +theorem mul_lieMatrix_single {r d : ℕ} (i j : Fin d) + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) (a b : Fin r → Fin d) : + (T*lieMatrix (r := r) (Matrix.single i j (1 : ℂ))) a b = + ∑ s, if b s=j then T a (Function.update b s i) else 0 := by + classical + simp only [Matrix.mul_apply,lieMatrix_single_apply,Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro s _ + have hx (x : Fin r → Fin d) : + (if x s=i ∧ b=Function.update x s j then (1 : ℂ) else 0) = + (if b s=j ∧ x=Function.update b s i then 1 else 0) := by + exact if_congr (update_exchange x b s i j) rfl rfl + simp only [hx] + by_cases hs : b s=j + · simp [hs] + · simp [hs] + +theorem lieInvariant_of_tensor_commute {r d : ℕ} + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) + (hT : ∀ U : Matrix.unitaryGroup (Fin d) ℂ, + Commute T (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ))) : LieInvariant T := by + intro i j a b + have he := congrFun (congrFun (commute_lieMatrix T hT (Matrix.single i j 1)).eq a) b + simpa only [mul_lieMatrix_single,lieMatrix_single_mul] using he.symm + +theorem tensor_permMatrix {r d : ℕ} (g : Equiv.Perm (Fin d)) (a b : Fin r → Fin d) : + tensorMatrix (g.permMatrix ℂ) a b=if b=g ∘ a then 1 else 0 := by + classical + have hp : ∀ i j, g.permMatrix ℂ i j = if g i=j then (1 : ℂ) else 0 := by + intro i j + simp [Equiv.Perm.permMatrix,PEquiv.toMatrix,Equiv.toPEquiv_apply] + simp only [tensorMatrix,hp] + rw [prod_delta_eq] + have hh : (∀ t∈(Finset.univ : Finset (Fin r)), g (a t)=b t) ↔ b=g ∘ a := by + simp only [Finset.mem_univ,true_implies,funext_iff,Function.comp_apply] + exact forall_congr' (fun _ => eq_comm) + simp only [hh] + +theorem labelInvariant_of_tensor_commute {r d : ℕ} + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) + (hT : ∀ U : Matrix.unitaryGroup (Fin d) ℂ, + Commute T (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ))) + (g : Equiv.Perm (Fin d)) (a b : Fin r → Fin d) : + T (g ∘ a) (g ∘ b)=T a b := by + classical + have hp : g.permMatrix ℂ ∈ Matrix.unitaryGroup (Fin d) ℂ := by + rw [Matrix.mem_unitaryGroup_iff,Matrix.star_eq_conjTranspose,Matrix.conjTranspose_permMatrix, + ← Matrix.permMatrix_mul] + simp + have hh (c : Fin r → Fin d) : g ∘ b=g ∘ c ↔ b=c := by + constructor + · intro he + funext s + exact g.injective (congrFun he s) + · rintro rfl; rfl + have he := congrFun (congrFun (hT ⟨g.permMatrix ℂ,hp⟩).eq a) (g ∘ b) + simpa [Matrix.mul_apply,tensor_permMatrix,hh] using he.symm + +theorem unitary_tensor_commutant (r d : ℕ) (hrd : r ≤ d) + (T : Matrix (Fin r → Fin d) (Fin r → Fin d) ℂ) + (hT : ∀ U : Matrix.unitaryGroup (Fin d) ℂ, + Commute T (tensorMatrix (U : Matrix (Fin d) (Fin d) ℂ))) : + ∃ c : Equiv.Perm (Fin r) → ℂ, T = ∑ π, c π • positionMatrix π := + lie_label_span hrd T (lieInvariant_of_tensor_commute T hT) (labelInvariant_of_tensor_commute T hT) + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/ThroughLabel.lean b/lean/OAI/Analysis/FreeWords/ThroughLabel.lean new file mode 100644 index 0000000000000000000000000000000000000000..3491066c63acc701cad32e862fcb12e0151c1a4f --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/ThroughLabel.lean @@ -0,0 +1,307 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKThroughLabel + +open scoped BigOperators + +noncomputable section + +def beta (C : ℕ → ℝ) (d r : ℕ) (W : Sym (Fin d) r) : ℝ := + (if (W : Multiset (Fin d)).Nodup then 7 * Real.sqrt ((r - 1).factorial : ℝ) + else C r) * (d : ℝ) ^ (-((r - 1 : ℕ) : ℝ) / 2) + +def throughSum (C : ℕ → ℝ) (d r : ℕ) (a : Fin d) : ℝ := + ∑ W ∈ (Finset.univ : Finset (Sym (Fin d) r)).filter (fun W => a ∈ W), + beta C d r W ^ 2 + +section Counting + +variable {α : Type*} [Fintype α] [DecidableEq α] + +def wordsThrough (r : ℕ) (a : α) : Finset (Sym α r) := + Finset.univ.filter (fun W => a ∈ W) + +def distinctThrough (r : ℕ) (a : α) : Finset (Sym α r) := + (wordsThrough r a).filter (fun W => (W : Multiset α).Nodup) + +def repeatedThrough (r : ℕ) (a : α) : Finset (Sym α r) := + (wordsThrough r a).filter (fun W => ¬(W : Multiset α).Nodup) + +@[simp] theorem mem_wordsThrough {r : ℕ} {a : α} {W : Sym α r} : + W ∈ wordsThrough r a ↔ a ∈ W := by simp [wordsThrough] + +@[simp] theorem mem_distinctThrough {r : ℕ} {a : α} {W : Sym α r} : + W ∈ distinctThrough r a ↔ a ∈ W ∧ (W : Multiset α).Nodup := by + simp [distinctThrough] + +@[simp] theorem mem_repeatedThrough {r : ℕ} {a : α} {W : Sym α r} : + W ∈ repeatedThrough r a ↔ a ∈ W ∧ ¬(W : Multiset α).Nodup := by + simp [repeatedThrough] + +theorem card_sym_le_pow (r : ℕ) : Fintype.card (Sym α r) ≤ Fintype.card α ^ r := by + induction r with + | zero => simp + | succ r ih => + have hsurj : Function.Surjective + (fun p : α × Sym α r => Sym.cons p.1 p.2) := by + intro W + obtain ⟨a, ha⟩ := W.exists_mem + exact ⟨(a, W.erase a ha), Sym.cons_erase ha⟩ + calc + Fintype.card (Sym α (r + 1)) ≤ Fintype.card (α × Sym α r) := + Fintype.card_le_of_surjective _ hsurj + _ = Fintype.card α * Fintype.card (Sym α r) := Fintype.card_prod _ _ + _ ≤ Fintype.card α * Fintype.card α ^ r := Nat.mul_le_mul_left _ ih + _ = Fintype.card α ^ (r + 1) := by rw [pow_succ, mul_comm] + +theorem card_distinctThrough_le_choose (r : ℕ) (a : α) : + (distinctThrough (r + 1) a).card ≤ (Fintype.card α).choose r := by + let f : Sym α (r + 1) → Finset α := fun W => (W : Multiset α).erase a |>.toFinset + have hcard (W : Sym α (r + 1)) (hW : W ∈ distinctThrough (r + 1) a) : + (f W).card = r := by + obtain ⟨ha, hn⟩ := mem_distinctThrough.mp hW + change a ∈ (W : Multiset α) at ha + change ((W : Multiset α).erase a).toFinset.card = r + rw [Multiset.toFinset_card_of_nodup (hn.erase a), Multiset.card_erase_of_mem ha, + Sym.card_coe, Nat.pred_succ] + have hinj : Set.InjOn f (distinctThrough (r + 1) a : Set (Sym α (r + 1))) := by + intro W hW V hV h + obtain ⟨haW, hnW⟩ := mem_distinctThrough.mp hW + obtain ⟨haV, hnV⟩ := mem_distinctThrough.mp hV + change a ∈ (W : Multiset α) at haW + change a ∈ (V : Multiset α) at haV + have he : (W : Multiset α).erase a = (V : Multiset α).erase a := + (hnW.erase a).toFinset_inj (hnV.erase a) h + apply Sym.ext + simpa only [Multiset.cons_erase haW, Multiset.cons_erase haV] using + congrArg (Multiset.cons a) he + calc + (distinctThrough (r + 1) a).card ≤ (Finset.univ.powersetCard r : Finset (Finset α)).card := by + apply Finset.card_le_card_of_injOn f _ hinj + intro W hW + exact Finset.mem_powersetCard.mpr ⟨Finset.subset_univ _, hcard W hW⟩ + _ = (Fintype.card α).choose r := by simp + +omit [Fintype α] [DecidableEq α] in +theorem exists_double_cons {r : ℕ} (W : Sym α (r + 2)) + (hW : ¬ (W : Multiset α).Nodup) : + ∃ (b : α) (V : Sym α r), W = Sym.cons b (Sym.cons b V) := by + rw [Multiset.nodup_iff_ne_cons_cons] at hW + push Not at hW + obtain ⟨b, V, hV⟩ := hW + have hcard : V.card = r := by + have := congrArg Multiset.card hV + simp only [Multiset.card_cons, Sym.card_coe] at this + omega + exact ⟨b, ⟨V, hcard⟩, Sym.ext hV⟩ + +theorem repeatedThrough_subset (r : ℕ) (a : α) : + repeatedThrough (r + 3) a ⊆ + (Finset.univ : Finset (Sym α (r + 1))).image (fun V => Sym.cons a (Sym.cons a V)) ∪ + (Finset.univ : Finset α).biUnion (fun b => + (Finset.univ : Finset (Sym α r)).image (fun V => Sym.cons a (Sym.cons b (Sym.cons b V)))) := by + intro W hW + obtain ⟨ha, hn⟩ := mem_repeatedThrough.mp hW + obtain ⟨V, rfl⟩ := Sym.exists_cons_of_mem ha + by_cases hav : a ∈ V + · obtain ⟨Z, rfl⟩ := Sym.exists_cons_of_mem hav + exact Finset.mem_union_left _ (Finset.mem_image.mpr ⟨Z, Finset.mem_univ _, rfl⟩) + · change a ∉ (V : Multiset α) at hav + have hV : ¬ (V : Multiset α).Nodup := by + simpa only [Sym.coe_cons, Multiset.nodup_cons, hav, not_false_eq_true, true_and] using hn + obtain ⟨b, Z, rfl⟩ := exists_double_cons V hV + exact Finset.mem_union_right _ (Finset.mem_biUnion.mpr + ⟨b, Finset.mem_univ _, Finset.mem_image.mpr ⟨Z, Finset.mem_univ _, rfl⟩⟩) + +theorem card_repeatedThrough_le (r : ℕ) (a : α) : + (repeatedThrough (r + 3) a).card ≤ 2 * Fintype.card α ^ (r + 1) := by + calc + (repeatedThrough (r + 3) a).card ≤ + ((Finset.univ : Finset (Sym α (r + 1))).image + (fun V => Sym.cons a (Sym.cons a V)) ∪ + (Finset.univ : Finset α).biUnion (fun b => + (Finset.univ : Finset (Sym α r)).image + (fun V => Sym.cons a (Sym.cons b (Sym.cons b V))))).card := + Finset.card_le_card (repeatedThrough_subset r a) + _ ≤ Fintype.card (Sym α (r + 1)) + + Fintype.card α * Fintype.card (Sym α r) := by + refine (Finset.card_union_le _ _).trans (Nat.add_le_add ?_ ?_) + · simpa using Finset.card_image_le + (s := (Finset.univ : Finset (Sym α (r + 1)))) + (f := fun V => Sym.cons a (Sym.cons a V)) + · refine (Finset.card_biUnion_le).trans ?_ + calc + _ ≤ ∑ _b : α, Fintype.card (Sym α r) := by + apply Finset.sum_le_sum + intro b hb + simpa using Finset.card_image_le + (s := (Finset.univ : Finset (Sym α r))) + (f := fun V => Sym.cons a (Sym.cons b (Sym.cons b V))) + _ = _ := by simp + _ ≤ Fintype.card α ^ (r + 1) + Fintype.card α * Fintype.card α ^ r := + Nat.add_le_add (card_sym_le_pow _) (Nat.mul_le_mul_left _ (card_sym_le_pow _)) + _ = 2 * Fintype.card α ^ (r + 1) := by rw [pow_succ]; ring + +@[simp] theorem repeatedThrough_one (a : α) : repeatedThrough 1 a = ∅ := by + apply Finset.eq_empty_iff_forall_notMem.mpr + intro W hW + obtain ⟨ha, hn⟩ := mem_repeatedThrough.mp hW + obtain ⟨V, rfl⟩ := Sym.exists_cons_of_mem ha + have hV : V = Sym.nil := Subsingleton.elim _ _ + subst V + exact hn (by simp [Sym.coe_cons]) + +@[simp] theorem repeatedThrough_two (a : α) : + repeatedThrough 2 a = {Sym.cons a (Sym.cons a Sym.nil)} := by + ext W + constructor + · intro hW + obtain ⟨ha, hn⟩ := mem_repeatedThrough.mp hW + obtain ⟨b, V, rfl⟩ := exists_double_cons W hn + have hV : V = Sym.nil := Subsingleton.elim _ _ + subst V + have hab : a = b := by simpa using ha + subst b + simp + · intro hW + obtain rfl := Finset.mem_singleton.mp hW + simp [Sym.coe_cons] + +theorem card_repeatedThrough_le_all (r : ℕ) (a : α) : + (repeatedThrough (r + 2) a).card ≤ 2 * Fintype.card α ^ r := by + cases r with + | zero => simp + | succ r => exact card_repeatedThrough_le r a + +end Counting + +theorem neg_half_rpow_sq (d n : ℕ) : + ((d : ℝ) ^ (-(n : ℝ) / 2)) ^ 2 = 1 / (d : ℝ) ^ n := by + calc + ((d : ℝ) ^ (-(n : ℝ) / 2)) ^ 2 = + (d : ℝ) ^ ((-(n : ℝ) / 2) * (2 : ℝ)) := by + rw [Real.rpow_mul (Nat.cast_nonneg d), Real.rpow_two] + _ = (d : ℝ) ^ (-(n : ℝ)) := by congr 1; ring + _ = 1 / (d : ℝ) ^ n := by + rw [Real.rpow_neg (Nat.cast_nonneg d), Real.rpow_natCast, one_div] + +theorem beta_sq (C : ℕ → ℝ) (d n : ℕ) (W : Sym (Fin d) (n + 1)) : + beta C d (n + 1) W ^ 2 = + if (W : Multiset (Fin d)).Nodup then + 49 * (n.factorial : ℝ) / (d : ℝ) ^ n + else C (n + 1) ^ 2 / (d : ℝ) ^ n := by + simp only [beta, Nat.add_sub_cancel, mul_pow, neg_half_rpow_sq] + split_ifs with hW + · rw [mul_pow, Real.sq_sqrt (Nat.cast_nonneg _)] + ring + · ring + +theorem throughSum_eq (C : ℕ → ℝ) (d n : ℕ) (a : Fin d) : + throughSum C d (n + 1) a = + ((distinctThrough (n + 1) a).card : ℝ) * + (49 * (n.factorial : ℝ) / (d : ℝ) ^ n) + + ((repeatedThrough (n + 1) a).card : ℝ) * + (C (n + 1) ^ 2 / (d : ℝ) ^ n) := by + change (∑ W ∈ wordsThrough (n + 1) a, beta C d (n + 1) W ^ 2) = _ + rw [← Finset.sum_filter_add_sum_filter_not (wordsThrough (n + 1) a) + (fun W => (W : Multiset (Fin d)).Nodup) (fun W => beta C d (n + 1) W ^ 2)] + have h₁ : (∑ W ∈ distinctThrough (n + 1) a, beta C d (n + 1) W ^ 2) = + ((distinctThrough (n + 1) a).card : ℝ) * + (49 * (n.factorial : ℝ) / (d : ℝ) ^ n) := by + calc + _ = ∑ _W ∈ distinctThrough (n + 1) a, + (49 * (n.factorial : ℝ) / (d : ℝ) ^ n) := by + apply Finset.sum_congr rfl + intro W hW + rw [beta_sq, ite_eq_left (mem_distinctThrough.mp hW).2] + _ = _ := by simp + have h₂ : (∑ W ∈ repeatedThrough (n + 1) a, beta C d (n + 1) W ^ 2) = + ((repeatedThrough (n + 1) a).card : ℝ) * + (C (n + 1) ^ 2 / (d : ℝ) ^ n) := by + calc + _ = ∑ _W ∈ repeatedThrough (n + 1) a, C (n + 1) ^ 2 / (d : ℝ) ^ n := by + apply Finset.sum_congr rfl + intro W hW + rw [beta_sq, ite_eq_right (mem_repeatedThrough.mp hW).2] + _ = _ := by simp + exact congrArg₂ (· + ·) h₁ h₂ + +theorem distinct_contribution_le (d n : ℕ) (hd : 0 < d) (a : Fin d) : + ((distinctThrough (n + 1) a).card : ℝ) * + (49 * (n.factorial : ℝ) / (d : ℝ) ^ n) ≤ 49 := by + have hdR : (0 : ℝ) < d := Nat.cast_pos.mpr hd + have hf : (0 : ℝ) < n.factorial := Nat.cast_pos.mpr n.factorial_pos + have hcard : ((distinctThrough (n + 1) a).card : ℝ) ≤ (d.choose n : ℝ) := by + exact_mod_cast (show (distinctThrough (n + 1) a).card ≤ d.choose n by + simpa only [Fintype.card_fin] using card_distinctThrough_le_choose n a) + calc + _ ≤ (d.choose n : ℝ) * (49 * (n.factorial : ℝ) / (d : ℝ) ^ n) := + mul_le_mul_of_nonneg_right hcard (by positivity) + _ ≤ ((d : ℝ) ^ n / (n.factorial : ℝ)) * + (49 * (n.factorial : ℝ) / (d : ℝ) ^ n) := + mul_le_mul_of_nonneg_right (Nat.choose_le_pow_div n d) (by positivity) + _ = 49 := by field_simp + +theorem repeated_contribution_le (C : ℕ → ℝ) (d n : ℕ) (hd : 0 < d) (a : Fin d) : + ((repeatedThrough (n + 2) a).card : ℝ) * + (C (n + 2) ^ 2 / (d : ℝ) ^ (n + 1)) ≤ 2 * C (n + 2) ^ 2 / d := by + have hdR : (0 : ℝ) < d := Nat.cast_pos.mpr hd + have hcard : ((repeatedThrough (n + 2) a).card : ℝ) ≤ 2 * (d : ℝ) ^ n := by + exact_mod_cast (show (repeatedThrough (n + 2) a).card ≤ 2 * d ^ n by + simpa only [Fintype.card_fin] using card_repeatedThrough_le_all n a) + calc + _ ≤ (2 * (d : ℝ) ^ n) * (C (n + 2) ^ 2 / (d : ℝ) ^ (n + 1)) := + mul_le_mul_of_nonneg_right hcard (by positivity) + _ = 2 * C (n + 2) ^ 2 / d := by rw [pow_succ]; field_simp; ring + +theorem throughSum_le (C : ℕ → ℝ) (d r : ℕ) (hd : 0 < d) + (hr : 1 ≤ r) (a : Fin d) : throughSum C d r a ≤ 49 + 2 * C r ^ 2 / d := by + obtain ⟨r, rfl⟩ := Nat.exists_eq_add_of_le hr + rw [Nat.add_comm 1 r] + cases r with + | zero => + change throughSum C d 1 a ≤ 49 + 2 * C 1 ^ 2 / d + rw [throughSum_eq C d 0 a] + change ((distinctThrough 1 a).card : ℝ) * + (49 * (Nat.factorial 0 : ℝ) / (d : ℝ) ^ 0) + + ((repeatedThrough 1 a).card : ℝ) * (C 1 ^ 2 / (d : ℝ) ^ 0) ≤ _ + rw [repeatedThrough_one, Finset.card_empty, Nat.cast_zero, zero_mul, add_zero] + exact (distinct_contribution_le d 0 hd a).trans (le_add_of_nonneg_right (by positivity)) + | succ r => + rw [throughSum_eq] + exact add_le_add (distinct_contribution_le d (r + 1) hd a) + (repeated_contribution_le C d r hd a) + +theorem through_label (C : ℕ → ℝ) (D : ℕ → ℕ) (N : ℕ) (_ : 1 ≤ N) : + ∃ d₀ : ℕ, 1 ≤ d₀ ∧ + (∀ r : ℕ, 1 ≤ r → r ≤ N → D r ≤ d₀) ∧ + ∀ d : ℕ, d₀ ≤ d → ∀ r : ℕ, 1 ≤ r → r ≤ N → + ∀ a : Fin d, throughSum C d r a ≤ 64 := by + let b : ℕ → ℕ := fun r => max (D r) ⌈2 * C r ^ 2 / 15⌉₊ + let d₀ : ℕ := max 1 ((Finset.Icc 1 N).sup b) + have hb (r : ℕ) (hr : 1 ≤ r) (hrN : r ≤ N) : b r ≤ d₀ := + (Finset.le_sup (f := b) (Finset.mem_Icc.mpr ⟨hr, hrN⟩)).trans (le_max_right _ _) + refine ⟨d₀, le_max_left _ _, ?_, ?_⟩ + · intro r hr hrN + exact (le_max_left _ _).trans (hb r hr hrN) + · intro d hd r hr hrN a + have hdpos : 0 < d := lt_of_lt_of_le Nat.zero_lt_one ((le_max_left _ _).trans hd) + have hdR : (0 : ℝ) < d := Nat.cast_pos.mpr hdpos + have hceil : ⌈2 * C r ^ 2 / 15⌉₊ ≤ d := + (le_max_right _ _).trans ((hb r hr hrN).trans hd) + have hsize : 2 * C r ^ 2 / 15 ≤ (d : ℝ) := Nat.ceil_le.mp hceil + have herr : 2 * C r ^ 2 / d ≤ 15 := by + apply (div_le_iff₀ hdR).mpr + linarith + exact (throughSum_le C d r hdpos hr a).trans (by linarith) + +end + +end KKThroughLabel +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TraceBallDensity.lean b/lean/OAI/Analysis/FreeWords/TraceBallDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..16a861d2c73d7f3006ddbb5d8ca14069e7fefe36 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TraceBallDensity.lean @@ -0,0 +1,57 @@ +import Mathlib +import OAI.Analysis.FreeWords.BoundedStrongContinuity +import OAI.Analysis.FreeWords.TraceStrongContinuity + +namespace OAI + +noncomputable section + +namespace KKTraceTransfer + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem trace_unit_ball_countable_dense [TopologicalSpace.SeparableSpace H] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) : + ∃ a : ℕ → ConcreteAlgebra M, (∀ j, ‖a j‖ ≤ 1) ∧ + ∀ x : ConcreteAlgebra M, ‖x‖ ≤ 1 → ∀ ε : ℝ, 0 < ε → + ∃ j, traceNorm τ (a j - x) < ε := by + classical + obtain ⟨D,hD⟩ := TopologicalSpace.exists_dense_seq H + let B := {x : ConcreteAlgebra M // ‖x‖ ≤ 1} + let : Inhabited B := ⟨⟨0,by simp⟩⟩ + let E : B → (ℕ → H) := fun a j => (a.val : H →L[ℂ] H) (D j) + let : TopologicalSpace B := TopologicalSpace.induced E inferInstance + have hE : Topology.IsInducing E := ⟨rfl⟩ + let : SecondCountableTopology B := hE.secondCountableTopology + have hec : Continuous E := continuous_induced_dom + have hc (ξ : H) : Continuous (fun a : B => (a.val : H →L[ℂ] H) ξ) := by + apply bounded_evals_continuous (fun a : B => (a.val : H →L[ℂ] H)) + (fun a => a.property) D hD + intro j + exact (continuous_apply j).comp hec + obtain ⟨a,ha⟩ := TopologicalSpace.exists_dense_seq B + refine ⟨fun j => (a j).val,fun j => (a j).property,?_⟩ + intro x hx ε hε + have ht : Continuous (fun b : B => traceNorm τ (b.val-x)) := + traceNorm_strong_continuous M τ (fun b : B => b.val) (fun b => b.property) hc x hx + have ho : IsOpen {b : B | traceNorm τ (b.val-x) < ε} := isOpen_Iio.preimage ht + have hn : ({b : B | traceNorm τ (b.val-x) < ε} : Set B).Nonempty := by + refine ⟨⟨x,hx⟩,?_⟩ + change traceNorm τ (x-x) < ε + simpa [traceNorm] using hε + obtain ⟨b,hb,j,hj⟩ := ha.inter_open_nonempty _ ho hn + refine ⟨j,?_⟩ + change traceNorm τ ((a j).val-x) < ε + rw [hj] + exact hb + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TraceL2Convergence.lean b/lean/OAI/Analysis/FreeWords/TraceL2Convergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..c14743c29fb8571e3c945e74606c0f44b0b7b7bf --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TraceL2Convergence.lean @@ -0,0 +1,76 @@ +import Mathlib +import OAI.Analysis.FreeWords.MatrixAverageTrace + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKProjectionSupport KKMatrixQuantization + +open Filter Topology + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +local instance : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {I : Type*} {l : Filter I} {x y : I → ConcreteAlgebra M} {a b : ConcreteAlgebra M} + +theorem tendsto_gns_iff : + Tendsto (fun i => gnsVector (tracePositive τ) (x i)) l (𝓝 (gnsVector (tracePositive τ) a)) ↔ + Tendsto (fun i => traceNorm τ (x i-a)) l (𝓝 0) := by + rw [tendsto_iff_norm_sub_tendsto_zero] + simp only [traceNorm_eq_gns,map_sub] + +theorem tendsto_gns_star + (hx : Tendsto (fun i => gnsVector (tracePositive τ) (x i)) l (𝓝 (gnsVector (tracePositive τ) a))) : + Tendsto (fun i => gnsVector (tracePositive τ) (star (x i))) l (𝓝 (gnsVector (tracePositive τ) (star a))) := by + apply (tendsto_gns_iff τ).mpr + have he (i:I) : traceNorm τ (star (x i)-star a)=traceNorm τ (x i-a) := by rw [← star_sub,traceNorm_star] + simpa only [he] using (tendsto_gns_iff τ).mp hx + +theorem tendsto_gns_mul (C : ℝ) (_ : 0≤C) (hb : ∀ i, ‖x i‖≤C) + (hx : Tendsto (fun i => gnsVector (tracePositive τ) (x i)) l (𝓝 (gnsVector (tracePositive τ) a))) + (hy : Tendsto (fun i => gnsVector (tracePositive τ) (y i)) l (𝓝 (gnsVector (tracePositive τ) b))) : + Tendsto (fun i => gnsVector (tracePositive τ) (x i*y i)) l (𝓝 (gnsVector (tracePositive τ) (a*b))) := by + apply (tendsto_gns_iff τ).mpr + have hh (i:I) : traceNorm τ (x i*y i-a*b)≤C*traceNorm τ (y i-b)+traceNorm τ (x i-a)*‖b‖ := by + have he : x i*y i-a*b=x i*(y i-b)+(x i-a)*b := by noncomm_ring + rw [he] + exact (traceNorm_add_le τ _ _).trans (add_le_add + ((traceNorm_mul_le τ _ _).trans (mul_le_mul_of_nonneg_right (hb i) (traceNorm_nonneg τ _))) + (traceNorm_mul_right_le τ _ _)) + have ht := (((tendsto_gns_iff τ).mp hy).const_mul C).add + (((tendsto_gns_iff τ).mp hx).mul_const ‖b‖) + simp only [mul_zero,zero_mul,zero_add] at ht + exact squeeze_zero (fun i => traceNorm_nonneg τ _) hh ht + +theorem tendsto_gns_trace + (hx : Tendsto (fun i => gnsVector (tracePositive τ) (x i)) l (𝓝 (gnsVector (tracePositive τ) a))) : + Tendsto (fun i => τ.map (x i)) l (𝓝 (τ.map a)) := by + have hh : Tendsto (fun i => ⟪gnsVector (tracePositive τ) (1:ConcreteAlgebra M), + gnsVector (tracePositive τ) (x i)⟫_ℂ) l + (𝓝 ⟪gnsVector (tracePositive τ) (1:ConcreteAlgebra M),gnsVector (tracePositive τ) a⟫_ℂ) := + tendsto_const_nhds.inner hx + simp only [gnsVector_inner,star_one,one_mul] at hh + exact hh + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TraceStrongContinuity.lean b/lean/OAI/Analysis/FreeWords/TraceStrongContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..847944b01f387e2b4d6f46bc26e8a0b2b41088c2 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TraceStrongContinuity.lean @@ -0,0 +1,47 @@ +import Mathlib +import OAI.Analysis.FreeWords.TraceTransferDefinitions + +namespace OAI + +noncomputable section + +namespace KKTraceTransfer + +open scoped InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem traceNorm_strong_continuous {X : Type*} [TopologicalSpace X] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (F : X → ConcreteAlgebra M) (hF : ∀ a, ‖F a‖ ≤ 1) + (hc : ∀ ξ : H, Continuous (fun a => (F a : H →L[ℂ] H) ξ)) + (b : ConcreteAlgebra M) (hb : ‖b‖ ≤ 1) : + Continuous (fun a => traceNorm τ (F a-b)) := by + let Q (a:X) : ConcreteAlgebra M := star (F a-b)*(F a-b) + let W (a:X) : WeakAlgebra M := ⟨ContinuousLinearMapWOT.ofCLM (Q a), (Q a).property⟩ + have hB (a:X) : ‖(W a).val.toCLM‖ ≤ 4 := by + have hs : ‖F a-b‖ ≤ 2 := (norm_sub_le _ _).trans (by linarith [hF a]) + change ‖star ((F a-b : ConcreteAlgebra M):H →L[ℂ] H) * ((F a-b:ConcreteAlgebra M):H →L[ℂ] H)‖ ≤ 4 + rw [CStarRing.norm_star_mul_self] + change ‖F a-b‖*‖F a-b‖ ≤ 4 + nlinarith [norm_nonneg (F a-b)] + have hW : Continuous W := by + apply Continuous.subtype_mk + apply ContinuousLinearMapWOT.continuous_iff.mpr + intro ξ η + change Continuous (fun a => ⟪η, (star ((F a-b :ConcreteAlgebra M):H →L[ℂ] H) * + ((F a-b :ConcreteAlgebra M):H →L[ℂ] H)) ξ⟫_ℂ) + simp only [mul_apply_eq_comp,ContinuousLinearMap.star_eq_adjoint, + ContinuousLinearMap.adjoint_inner_right] + exact ((hc η).sub continuous_const).inner ((hc ξ).sub continuous_const) + have hτ := (τ.normal 4).comp_continuous hW hB + exact Real.continuous_sqrt.comp (Complex.continuous_re.comp hτ) + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TraceTransfer.lean b/lean/OAI/Analysis/FreeWords/TraceTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..80d81665d737ae7dcc6e0618334bc31f2f6e54ff --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TraceTransfer.lean @@ -0,0 +1,147 @@ +import Mathlib +import OAI.Analysis.FreeWords.TraceTransferDefinitions + +namespace OAI + +noncomputable section + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +namespace UniversalStrongKK + +section OperatorMean + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +variable (m : ScalarMean G) + +variable [CompleteSpace H] + +end OperatorMean + +end UniversalStrongKK + +open scoped Topology + +namespace UniversalStrongKK + +section UltraMean + +variable {I : Type*} [TopologicalSpace I] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UltraMean + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped InnerProductSpace + +open Filter Topology + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UniversalStrongKK + +namespace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKTraceTransfer + +namespace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +lemma trace_square_nonneg {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (x : ConcreteAlgebra M) : 0 ≤ τ.map (star x * x) := by + apply τ.positive + exact ContinuousLinearMap.isPositive_adjoint_comp_self (x : H →L[ℂ] H) + +lemma traceNorm_sq {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (x : ConcreteAlgebra M) : (((traceNorm τ x)^2 : ℝ) : ℂ) = τ.map (star x * x) := by + have hp := Complex.nonneg_iff.mp (trace_square_nonneg τ x) + apply Complex.ext + · simp only [Complex.ofReal_re] + simpa [traceNorm] using Real.sq_sqrt hp.1 + · simpa only [Complex.ofReal_im] using hp.2 + +lemma trace_square_tendsto {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (ω : Ultrafilter ℕ) (x : ℕ → ConcreteAlgebra M) + (hnull : Tendsto (fun j => traceNorm τ (x j)) (ω : Filter ℕ) (𝓝 0)) : + Tendsto (fun j => τ.map (star (x j) * x j)) (ω : Filter ℕ) (𝓝 0) := by + have h := Complex.continuous_ofReal.continuousAt.tendsto.comp (hnull.pow 2) + simp only [zero_pow (by decide : 2 ≠ 0), Complex.ofReal_zero] at h + convert h using 1 + funext j + exact (traceNorm_sq τ (x j)).symm + +theorem trace_transfer {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (ω : Ultrafilter ℕ) (x : ℕ → ConcreteAlgebra M) + (hbound : ∃ C : ℝ, ∀ j, ‖x j‖ ≤ C) + (hnull : Tendsto (fun j => traceNorm τ (x j)) (ω : Filter ℕ) (𝓝 0)) (ξ : H) : + Tendsto (fun j => ‖(x j : H →L[ℂ] H) ξ‖) (ω : Filter ℕ) (𝓝 0) := by + obtain ⟨C, hC⟩ := hbound + have hC0 : 0 ≤ C := (norm_nonneg (x 0)).trans (hC 0) + have hTb (j : ℕ) : ‖(star (x j) * x j : ConcreteAlgebra M)‖ ≤ C^2 := by + change ‖star (x j : H →L[ℂ] H) * (x j : H →L[ℂ] H)‖ ≤ C^2 + rw [CStarRing.norm_star_mul_self, ← sq] + exact pow_le_pow_left₀ (norm_nonneg _) (hC j) 2 + let T : ℕ →ᵇ (H →L[ℂ] H) := BoundedContinuousFunction.ofNormedAddCommGroup + (fun j => (star (x j) * x j : ConcreteAlgebra M)) continuous_of_discreteTopology + (C^2) hTb + let A := UniversalStrongKK.operatorMean (UniversalStrongKK.ultrafilterMean ω) T + have ht := UniversalStrongKK.tendsto_operatorMean ω T + have hm (j : ℕ) : T j ∈ M := (star (x j) * x j : ConcreteAlgebra M).property + have hA : A ∈ M := UniversalStrongKK.mem_of_wot_tendsto M ht + (Filter.Eventually.of_forall hm) + have hAp : A.IsPositive := UniversalStrongKK.positive_of_wot_tendsto ht + (Filter.Eventually.of_forall fun j => + ContinuousLinearMap.isPositive_adjoint_comp_self (x j : H →L[ℂ] H)) + have hAb : ‖A‖ ≤ C^2 := UniversalStrongKK.norm_le_of_wot_tendsto (sq_nonneg C) ht + (Filter.Eventually.of_forall hTb) + let Aw : WeakAlgebra M := ⟨ContinuousLinearMapWOT.ofCLM A, hA⟩ + let Tw : ℕ → WeakAlgebra M := fun j => ⟨ContinuousLinearMapWOT.ofCLM (T j), hm j⟩ + have ht' : Tendsto Tw (ω : Filter ℕ) (𝓝 Aw) := tendsto_subtype_rng.mpr ht + have ht'' : Tendsto Tw (ω : Filter ℕ) (𝓝[{T : WeakAlgebra M | ‖T.val.toCLM‖ ≤ C^2}] Aw) := + tendsto_nhdsWithin_iff.mpr ⟨ht', Filter.Eventually.of_forall hTb⟩ + have hτA := (τ.normal (C^2) Aw hAb).tendsto.comp ht'' + have hτ0 := trace_square_tendsto τ ω x hnull + have hz : τ.map (weakToAlgebra Aw) = 0 := tendsto_nhds_unique hτA hτ0 + have hAz : A = 0 := congrArg Subtype.val (τ.faithful (weakToAlgebra Aw) hAp hz) + have hv := (Complex.continuous_re.continuousAt.tendsto.comp + (ContinuousLinearMapWOT.tendsto_iff_forall_inner_apply_tendsto.mp ht ξ ξ)) + change Tendsto (fun j => (⟪ξ, (star (x j : H →L[ℂ] H) * + (x j : H →L[ℂ] H)) ξ⟫_ℂ).re) (ω : Filter ℕ) (𝓝 ((⟪ξ, A ξ⟫_ℂ).re)) at hv + have hnormsq : Tendsto (fun j => ‖(x j : H →L[ℂ] H) ξ‖^2) (ω : Filter ℕ) (𝓝 0) := by + simp only [hAz, zero_apply, inner_zero_right, Complex.zero_re, mul_apply_eq_comp, + ContinuousLinearMap.star_eq_adjoint, ContinuousLinearMap.adjoint_inner_right] at hv + change Tendsto (fun j => RCLike.re ⟪(x j : H →L[ℂ] H) ξ, (x j : H →L[ℂ] H) ξ⟫_ℂ) + (ω : Filter ℕ) (𝓝 0) at hv + simpa only [inner_self_eq_norm_sq] using hv + have hs := Real.continuous_sqrt.continuousAt.tendsto.comp hnormsq + simpa only [Function.comp_def, Real.sqrt_zero, Real.sqrt_sq (norm_nonneg _)] using hs + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TraceTransferDefinitions.lean b/lean/OAI/Analysis/FreeWords/TraceTransferDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..eafe4e99083378ce0258fd58688b4a13b71a53d8 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TraceTransferDefinitions.lean @@ -0,0 +1,84 @@ +import Mathlib +import OAI.Analysis.FreeWords.WeakCompact + +namespace OAI + +noncomputable section + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +namespace UniversalStrongKK + +section OperatorMean + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +variable (m : ScalarMean G) + +variable [CompleteSpace H] + +end OperatorMean + +end UniversalStrongKK + +open scoped Topology + +namespace UniversalStrongKK + +section UltraMean + +variable {I : Type*} [TopologicalSpace I] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UltraMean + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped InnerProductSpace + +open Filter Topology + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UniversalStrongKK + +namespace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +abbrev WeakAlgebra (M : VonNeumannAlgebra H) := + {T : H →WOT[ℂ] H // T.toCLM ∈ M} + +abbrev ConcreteAlgebra (M : VonNeumannAlgebra H) := ↥M.toStarSubalgebra + +noncomputable def weakToAlgebra {M : VonNeumannAlgebra H} (T : WeakAlgebra M) : ConcreteAlgebra M := + ⟨T.val.toCLM, T.property⟩ + +structure FaithfulNormalTrace (M : VonNeumannAlgebra H) where + map : ConcreteAlgebra M →ₗ[ℂ] ℂ + positive : ∀ x : ConcreteAlgebra M, (x : H →L[ℂ] H).IsPositive → 0 ≤ map x + normalized : map 1 = 1 + tracial : ∀ x y : ConcreteAlgebra M, map (x * y) = map (y * x) + faithful : ∀ x : ConcreteAlgebra M, (x : H →L[ℂ] H).IsPositive → map x = 0 → x = 0 + normal : ∀ r : ℝ, ContinuousOn (fun T : WeakAlgebra M => map (weakToAlgebra T)) + {T | ‖T.val.toCLM‖ ≤ r} + +def traceNorm {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) (x : ConcreteAlgebra M) : ℝ := + Real.sqrt (τ.map (star x * x)).re + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TracialBicommutant.lean b/lean/OAI/Analysis/FreeWords/TracialBicommutant.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd9a160aecac44cd3d1b7ee63a635683aaf8384c --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TracialBicommutant.lean @@ -0,0 +1,159 @@ +import Mathlib +import OAI.Analysis.FreeWords.BicommutantTrace +import OAI.Analysis.FreeWords.GNSQuotient +import OAI.Analysis.FreeWords.TracialClipApprox + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open scoped InnerProductSpace ComplexOrder Pointwise + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +attribute [local instance] KKUltraTrace.biOrder + +attribute [local instance] KKUltraTrace.biLE + +attribute [local instance] KKUltraTrace.biPreorder + +attribute [local instance] KKUltraTrace.biSOR + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped InnerProductSpace ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] biOrder biLE biPreorder biSOR + +def gnsBiHom (τ : A →ₚ[ℂ] ℂ) : A →⋆ₐ[ℂ] bicommutantAlg τ.gnsStarAlgHom.range := + τ.gnsStarAlgHom.codRestrict _ (fun a => subset_bicommutantAlg _ ⟨a, rfl⟩) + +@[simp] theorem gnsBiHom_coe (τ : A →ₚ[ℂ] ℂ) (a : A) : + (gnsBiHom τ a).1 = τ.gnsStarAlgHom a := rfl + +theorem gns_bicommutantState_tracial (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y : A, τ (x*y) = τ (y*x)) : + ∀ x y, bicommutantState τ.gnsStarAlgHom.range (gnsVector τ 1) (x*y) = + bicommutantState τ.gnsStarAlgHom.range (gnsVector τ 1) (y*x) := by + apply bicommutantState_tracial + rintro a ⟨a', rfl⟩ b ⟨b', rfl⟩ + change gnsExpectation τ (τ.gnsStarAlgHom a' * τ.gnsStarAlgHom b') = + gnsExpectation τ (τ.gnsStarAlgHom b' * τ.gnsStarAlgHom a') + rw [← map_mul, ← map_mul, gnsExpectation_image, gnsExpectation_image] + exact htr a' b' + +theorem bicommutantState_star_mul {H : Type*} [NormedAddCommGroup H] + [InnerProductSpace ℂ H] [CompleteSpace H] + (S : StarSubalgebra ℂ (H →L[ℂ] H)) (Ω : H) (x : bicommutantAlg S) : + bicommutantState S Ω (star x*x) = ⟪x.1 Ω, x.1 Ω⟫_ℂ := by + change ⟪Ω, x.1.adjoint (x.1 Ω)⟫_ℂ = _ + exact ContinuousLinearMap.adjoint_inner_right _ _ _ + +theorem bicommutant_gns_norm {H : Type*} [NormedAddCommGroup H] + [InnerProductSpace ℂ H] [CompleteSpace H] + (S : StarSubalgebra ℂ (H →L[ℂ] H)) (Ω : H) (x : bicommutantAlg S) : + ‖gnsVector (bicommutantState S Ω) x‖ = ‖x.1 Ω‖ := by + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [gnsVector_norm_sq, bicommutantState_star_mul, @norm_sq_eq_re_inner ℂ] + rfl + +theorem gns_bicommutantState_faithful (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y : A, τ (x*y) = τ (y*x)) (x : bicommutantAlg τ.gnsStarAlgHom.range) + (hx : bicommutantState τ.gnsStarAlgHom.range (gnsVector τ 1) (star x*x) = 0) : + x = 0 := by + have hzero : ∀ b : bicommutantAlg τ.gnsStarAlgHom.range, + x.1 (b.1 (gnsVector τ 1)) = 0 := by + intro b + have hab := tracial_null_right (bicommutantState τ.gnsStarAlgHom.range (gnsVector τ 1)) + (gns_bicommutantState_tracial τ htr) x hx b + rw [bicommutantState_star_mul] at hab + exact (inner_self_eq_zero (𝕜 := ℂ)).mp hab + have hvec (a : A) : x.1 (gnsVector τ a) = 0 := by + have hb := hzero (gnsBiHom τ a) + simpa only [gnsBiHom_coe, gnsStarAlgHom_vector, mul_one] using hb + apply Subtype.ext + ext ξ + induction ξ using UniformSpace.Completion.induction_on with + | hp => exact isClosed_eq x.1.continuous continuous_const + | ih a => exact hvec (τ.ofPreGNS a) + +theorem gns_bicommutant_separating (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y : A, τ (x*y) = τ (y*x)) (x y : bicommutantAlg τ.gnsStarAlgHom.range) + (hxy : x.1 (gnsVector τ 1) = y.1 (gnsVector τ 1)) : x = y := by + apply sub_eq_zero.mp + apply gns_bicommutantState_faithful τ htr + rw [bicommutantState_star_mul] + have he : (x-y).1 (gnsVector τ 1) = 0 := sub_eq_zero.mpr hxy + rw [he, inner_zero_left] + +theorem tracialGNS_bicommutant_of_closed_balls (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y : A, τ (x*y) = τ (y*x)) + (hclosed : ∀ b : ℝ, IsClosed (gnsVector τ '' Metric.closedBall (0 : A) b)) : + Set.centralizer (Set.centralizer (τ.gnsStarAlgHom.range : Set (τ.GNS →L[ℂ] τ.GNS))) = + τ.gnsStarAlgHom.range := by + apply Set.Subset.antisymm _ Set.subset_centralizer_centralizer + intro T hT + let S := τ.gnsStarAlgHom.range + let Ω := gnsVector τ 1 + let x : bicommutantAlg S := ⟨T, by change T ∈ (bicommutantAlg S : Set _); rwa [coe_bicommutantAlg]⟩ + let b : ℝ := 2*‖x‖+1 + have hb : 0 < b := by dsimp [b]; positivity + have hx : 2*‖x‖ ≤ b := by dsimp [b]; linarith + have happrox : T Ω ∈ closure (gnsVector τ '' Metric.closedBall (0:A) b) := by + apply Metric.mem_closure_iff.mpr + intro ε hε + obtain ⟨a, ⟨a', rfl⟩, ha⟩ := UniversalStrongKK.bicommutant_strong_approximation + S T hT 1 (fun _ => Ω) (ε/3) (by positivity) + refine ⟨gnsVector τ (spectralClip b a'), ⟨spectralClip b a', ?_, rfl⟩, ?_⟩ + · simpa only [Metric.mem_closedBall, dist_zero_right] using norm_spectralClip_le hb a' + · have hc := tracial_clip_approximation (bicommutantState S Ω) + (gns_bicommutantState_tracial τ htr) hb (gnsBiHom τ a') x hx + simp only [bicommutant_gns_norm, ← map_spectralClip (gnsBiHom τ) hb] at hc + change ‖(τ.gnsStarAlgHom (spectralClip b a')) Ω-T Ω‖ ≤ + 3*‖τ.gnsStarAlgHom a' Ω-T Ω‖ at hc + have ha' : ‖τ.gnsStarAlgHom a' Ω-T Ω‖ < ε/3 := by + have hh := ha 0 + change ‖(τ.gnsStarAlgHom a'-T) Ω‖ < ε/3 at hh + simpa only [norm_sub_rev, sub_apply] using hh + have he (a : A) : τ.gnsStarAlgHom a Ω = gnsVector τ a := by + dsimp [Ω]; rw [gnsStarAlgHom_vector, mul_one] + rw [he] at hc + rw [dist_eq_norm, norm_sub_rev] + linarith + obtain ⟨a, ha, hae⟩ := (hclosed b).closure_subset happrox + refine ⟨a, ?_⟩ + have heq : gnsBiHom τ a = x := by + apply gns_bicommutant_separating τ htr + simpa only [gnsBiHom_coe, gnsStarAlgHom_vector, mul_one] using hae + exact congrArg Subtype.val heq + +end + +end KKUltraTrace +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TracialClipApprox.lean b/lean/OAI/Analysis/FreeWords/TracialClipApprox.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1823b41da3ff2373eddbdb626d6e445a4e9dd54 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TracialClipApprox.lean @@ -0,0 +1,118 @@ +import Mathlib +import OAI.Analysis.FreeWords.SpectralClip + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +theorem gnsVector_norm_sq (τ : A →ₚ[ℂ] ℂ) (a : A) : + ‖gnsVector τ a‖^2 = (τ (star a*a)).re := by + rw [@norm_sq_eq_re_inner ℂ, gnsVector_inner] + rfl + +theorem gnsVector_star_norm (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y : A, τ (x*y) = τ (y*x)) (a : A) : + ‖gnsVector τ (star a)‖ = ‖gnsVector τ a‖ := by + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [gnsVector_norm_sq, gnsVector_norm_sq, star_star, htr] + +theorem gnsVector_mul_norm_left (τ : A →ₚ[ℂ] ℂ) (a b : A) : + ‖gnsVector τ (a*b)‖ ≤ ‖a‖*‖gnsVector τ b‖ := by + rw [← gnsStarAlgHom_vector] + exact ((τ.gnsStarAlgHom a).le_opNorm _).trans + (mul_le_mul_of_nonneg_right (NonUnitalStarAlgHom.norm_apply_le _ _) (norm_nonneg _)) + +theorem gnsVector_mul_norm_right (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y : A, τ (x*y) = τ (y*x)) (a b : A) : + ‖gnsVector τ (a*b)‖ ≤ ‖b‖*‖gnsVector τ a‖ := by + rw [← gnsVector_star_norm τ htr (a*b), star_mul] + simpa only [norm_star, gnsVector_star_norm τ htr] using + gnsVector_mul_norm_left τ (star b) (star a) + +theorem clipWeight_excess_support {b t : ℝ} (hb : 0 < b) (ht : 0 ≤ t) : + b^2 * (1-clipWeight b t)^2 ≤ t * (1-clipWeight b t)^2 := by + by_cases hs : Real.sqrt t ≤ b + · simp only [clipWeight, clipFunction, max_eq_left hs, div_self (ne_of_gt hb), sub_self, zero_pow (by decide : 2 ≠ 0), mul_zero, le_refl] + · have hb2 : b^2 ≤ t := by nlinarith [Real.sq_sqrt ht, Real.sqrt_nonneg t, lt_of_not_ge hs] + exact mul_le_mul_of_nonneg_right hb2 (sq_nonneg _) + +def clipRemainderWeight (b : ℝ) (a : A) : A := cfc (fun t => 1-clipWeight b t) (star a*a) + +theorem spectralClip_sub {b : ℝ} (hb : 0 < b) (a : A) : + a-spectralClip b a = a*clipRemainderWeight b a := by + rw [clipRemainderWeight, cfc_sub (fun _ : ℝ => 1) (clipWeight b) _ continuousOn_const + (continuous_clipWeight hb).continuousOn, cfc_const (1:ℝ) _ (IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _)), + map_one, mul_sub, mul_one, spectralClip_eq hb] + +theorem norm_clipRemainderWeight_le {b : ℝ} (hb : 0 < b) (a : A) : + ‖clipRemainderWeight b a‖ ≤ 1 := by + apply norm_cfc_le zero_le_one + intro t ht + have hw := clipWeight_bounds hb (spectrum_nonneg_of_nonneg (star_mul_self_nonneg a) ht) + rw [Real.norm_eq_abs, abs_of_nonneg (by linarith : 0 ≤ 1-clipWeight b t)] + linarith + +theorem clipRemainder_norm_lower (τ : A →ₚ[ℂ] ℂ) {b : ℝ} (hb : 0 < b) (a : A) : + b * ‖gnsVector τ (clipRemainderWeight b a)‖ ≤ ‖gnsVector τ (a-spectralClip b a)‖ := by + let q := clipRemainderWeight b a + have hs : IsSelfAdjoint (star a*a) := IsSelfAdjoint.of_nonneg (star_mul_self_nonneg _) + have hq : star q*q = cfc (fun t => (1-clipWeight b t)^2) (star a*a) := by + dsimp [q, clipRemainderWeight] + rw [IsSelfAdjoint.cfc.star_eq, ← pow_two] + exact (cfc_pow (fun t => 1-clipWeight b t) 2 (star a*a) + (continuous_const.sub (continuous_clipWeight hb)).continuousOn hs).symm + have horder : b^2 • (star q*q) ≤ star (a-spectralClip b a)*(a-spectralClip b a) := by + rw [hq, spectralClip_error_square hb, ← cfc_smul (b^2) (fun t => (1-clipWeight b t)^2) (star a*a) + ((continuous_const.sub (continuous_clipWeight hb)).pow 2).continuousOn] + apply (cfc_le_iff _ _ _ + (((continuous_const.sub (continuous_clipWeight hb)).pow 2).const_mul (b^2)).continuousOn + (continuous_id.mul ((continuous_const.sub (continuous_clipWeight hb)).pow 2)).continuousOn).mpr + intro t ht + exact clipWeight_excess_support hb (spectrum_nonneg_of_nonneg (star_mul_self_nonneg a) ht) + have hre := (τ.monotone' horder).1 + change (τ (b^2 • (star q*q))).re ≤ (τ (star (a-spectralClip b a)*(a-spectralClip b a))).re at hre + have heq : (τ (b^2 • (star q*q))).re = b^2 * (τ (star q*q)).re := by + simp [← Complex.coe_smul, -Complex.ofReal_pow] + rw [heq, ← gnsVector_norm_sq, ← gnsVector_norm_sq] at hre + change b*‖gnsVector τ q‖ ≤ _ + nlinarith [norm_nonneg (gnsVector τ q), norm_nonneg (gnsVector τ (a-spectralClip b a))] + +theorem tracial_clip_approximation (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y : A, τ (x*y) = τ (y*x)) {b : ℝ} (hb : 0 < b) + (a x : A) (hx : 2*‖x‖ ≤ b) : + ‖gnsVector τ (spectralClip b a-x)‖ ≤ 3*‖gnsVector τ (a-x)‖ := by + let q := clipRemainderWeight b a + have hq : ‖q‖ ≤ 1 := norm_clipRemainderWeight_le hb a + have hlow : b*‖gnsVector τ q‖ ≤ ‖gnsVector τ (a-spectralClip b a)‖ := + clipRemainder_norm_lower τ hb a + have hupp : ‖gnsVector τ (a-spectralClip b a)‖ ≤ + ‖gnsVector τ (a-x)‖+‖x‖*‖gnsVector τ q‖ := by + rw [spectralClip_sub hb] + have he : a*q = (a-x)*q+x*q := by noncomm_ring + rw [he, map_add] + exact (norm_add_le _ _).trans (add_le_add + ((gnsVector_mul_norm_right τ htr (a-x) q).trans + (by nlinarith [norm_nonneg (gnsVector τ (a-x))])) + (gnsVector_mul_norm_left τ x q)) + have herr : ‖gnsVector τ (a-spectralClip b a)‖ ≤ 2*‖gnsVector τ (a-x)‖ := by + nlinarith [mul_le_mul_of_nonneg_right hx (norm_nonneg (gnsVector τ q))] + have he : spectralClip b a-x = -(a-spectralClip b a)+(a-x) := by abel + rw [he, map_add, map_neg] + have hn := norm_add_le (-gnsVector τ (a-spectralClip b a)) (gnsVector τ (a-x)) + rw [norm_neg] at hn + linarith + +end + +end KKUltraTrace +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TransportBlocks.lean b/lean/OAI/Analysis/FreeWords/TransportBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..7d0d2fd5b8bc0f6c1da9d939927d9803dded9e1a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TransportBlocks.lean @@ -0,0 +1,91 @@ +import Mathlib +import OAI.Analysis.FreeWords.AmplifiedCyclicApprox +import OAI.Analysis.FreeWords.ControlledMatrixConjugation +import OAI.Analysis.FreeWords.HaarEndpoints + +namespace OAI + +noncomputable section + +namespace KKFiniteTransport + +noncomputable section + +open KKTraceTransfer KKFreeLiftFrontier KKMatrixExpectation KKHaarEndpoints KKControlledConjugation + +open scoped Matrix.Norms.Operator + +variable {H:Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M:VonNeumannAlgebra H} + +abbrev Block (τ:FaithfulNormalTrace M) (n:ℕ) := + {z:List (ℤ×MatrixAlgebra n M)×ℤ // + CenteredPowerWord (matrixTraceMap τ.map n) (numericalHom n).range.toSubalgebra z.1 ∧ z.2≠0} + +def blockValue {τ:FaithfulNormalTrace M} {n:ℕ} (U:unitary (MatrixAlgebra n M)) (b:Block τ n) := + powerWord U b.val.1*(U^b.val.2).val + +def blockCenter (τ:FaithfulNormalTrace M) {n:ℕ} (U:unitary (MatrixAlgebra n M)) (b:Block τ n) := + blockValue U b-matrixExpectation τ.map n (blockValue U b) + +def conjStarMonoid {n:ℕ} (u:unitary (ConcreteAlgebra M)) : + MatrixAlgebra n M →⋆* MatrixAlgebra n M := + { (amplifyConj n u).toAlgHom.toMonoidHom with map_star' := map_star (amplifyConj n u) } + +def conjUnitary {n:ℕ} (u:unitary (ConcreteAlgebra M)) (U:unitary (MatrixAlgebra n M)) := + Unitary.map (conjStarMonoid u) U + +@[simp] theorem conjUnitary_val {n:ℕ} (u:unitary (ConcreteAlgebra M)) (U:unitary (MatrixAlgebra n M)) : + (conjUnitary u U).val=amplifyConj n u U.val := rfl + +theorem conjUnitary_zpow {n:ℕ} (u:unitary (ConcreteAlgebra M)) (U:unitary (MatrixAlgebra n M)) (k:ℤ) : + (conjUnitary u U^k).val=amplifyConj n u (U^k).val := by + change ((Unitary.map (conjStarMonoid u) U)^k).val=_ + rw [← map_zpow] + rfl + +theorem conjUnitary_good {n:ℕ} (u:unitary (ConcreteAlgebra M)) (U:unitary (MatrixAlgebra n M)) + (h:FullMatrixUnitary n U) : FullMatrixUnitary n (conjUnitary u U) := by + obtain ⟨d,hd,ρ,hρ,hentry⟩ := h + refine ⟨d,hd,(Unitary.conjStarAlgAut ℂ (ConcreteAlgebra M) u).toStarAlgHom.comp ρ,?_,?_⟩ + · exact (Unitary.conjStarAlgAut ℂ (ConcreteAlgebra M) u).injective.comp hρ + · exact amplifyConj_entry_range u ρ U.val hentry + +theorem powerWord_conj {τ:FaithfulNormalTrace M} {n:ℕ} (u:unitary (ConcreteAlgebra M)) + (U:unitary (MatrixAlgebra n M)) (w:List (ℤ×MatrixAlgebra n M)) + (h:CenteredPowerWord (matrixTraceMap τ.map n) (numericalHom n).range.toSubalgebra w) : + powerWord (A := MatrixAlgebra n M) (conjUnitary (n := n) u U) w= + amplifyConj n u (powerWord U w) := by + induction w with + | nil => simp [powerWord] + | cons z w ih => + have hz := (h z List.mem_cons_self).2.1 + have ht := fun a ha => h a (List.mem_cons_of_mem _ ha) + obtain ⟨b,hb⟩ := hz + have hfix : amplifyConj n u z.2=z.2 := by + rw [← hb] + exact amplifyConj_numerical n u b + simp only [powerWord_cons,conjUnitary_zpow,ih ht,map_mul,hfix] + +theorem blockValue_conj {τ:FaithfulNormalTrace M} {n:ℕ} (u:unitary (ConcreteAlgebra M)) + (U:unitary (MatrixAlgebra n M)) (b:Block τ n) : + blockValue (conjUnitary u U) b=amplifyConj n u (blockValue U b) := by + rw [blockValue,powerWord_conj u U _ b.property.1,conjUnitary_zpow,← map_mul] + rfl + +theorem blockCenter_conj (τ:FaithfulNormalTrace M) {n:ℕ} (u:unitary (ConcreteAlgebra M)) + (U:unitary (MatrixAlgebra n M)) (b:Block τ n) : + blockCenter τ (conjUnitary u U) b=amplifyConj n u (blockCenter τ U b) := by + have hfix : amplifyConj n u (matrixExpectation τ.map n (blockValue U b))= + matrixExpectation τ.map n (blockValue U b) := by + exact amplifyConj_numerical n u _ + simp only [blockCenter,blockValue_conj,map_sub, + amplifyConj_expectation τ.map τ.tracial,hfix] + +end + +end KKFiniteTransport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TransportLimits.lean b/lean/OAI/Analysis/FreeWords/TransportLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..cecdc54bacc3e62d5b2921445375557abcd1df4f --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TransportLimits.lean @@ -0,0 +1,144 @@ +import Mathlib +import OAI.Analysis.FreeWords.AmplifiedBlockBounds +import OAI.Analysis.FreeWords.AsymptoticBlockTransport +import OAI.Analysis.FreeWords.FiniteFreeDefinitions +import OAI.Analysis.FreeWords.MatrixExpectationContinuous +import OAI.Analysis.FreeWords.TransportTestsDefinitions + +namespace OAI + +noncomputable section + +namespace KKFiniteTransport + +noncomputable section + +open KKTraceTransfer KKFreeLiftFrontier KKMatrixExpectation KKHaarEndpoints KKMatrixBounds + +open KKAsymptoticTransport Filter + +open scoped Matrix.Norms.Operator Topology ComplexOrder + +variable {H:Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M:VonNeumannAlgebra H} + +local instance concreteOrder (M:VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := + CStarAlgebra.spectralOrder _ + +local instance concreteLE (M:VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance concretePreorder (M:VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance concreteSOR (M:VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := + CStarAlgebra.spectralOrderedRing _ + +theorem expectation_tendsto_zero_any (I:Type*) (L:Filter I) (τ:FaithfulNormalTrace M) (n:ℕ) + (X:I → MatrixAlgebra n M) + (h:∀a b,Tendsto (fun j => τ.map (X j a b)) L (𝓝 0)) : + Tendsto (fun j => matrixExpectation τ.map n (X j)) L (𝓝 0) := by + apply tendsto_pi_nhds.mpr + intro a + apply tendsto_pi_nhds.mpr + intro b + simpa only [matrixExpectation_apply,Pi.zero_apply,Matrix.zero_apply,map_zero,Function.comp_def] using + ((continuous_algebraMap ℂ (ConcreteAlgebra M)).tendsto 0).comp (h a b) + +theorem block_bound (τ:FaithfulNormalTrace M) (n:ℕ) {I:Type*} + (U:I → unitary (MatrixAlgebra n M)) (b:Block τ n) : NetBound (fun j => blockValue (U j) b) := by + refine ⟨wordBound n b.val.1*(n:ℝ),mul_nonneg (wordBound_nonneg _ _) (Nat.cast_nonneg _),?_⟩ + intro j + exact (norm_mul_le _ _).trans (mul_le_mul (powerWord_norm_le n (U j) b.val.1) + (unitary_rowSum_norm_le ((U j)^b.val.2)) (norm_nonneg _) (wordBound_nonneg _ _)) + +def joinBlock (τ:FaithfulNormalTrace M) {n:ℕ} (c d:Block τ n) (x:MatrixAlgebra n M) + (hx:matrixTraceMap τ.map n x=0) : Block τ n := + ⟨(c.val.1++(c.val.2,matrixExpectation τ.map n x)::d.val.1,d.val.2),by + refine ⟨?_,d.property.2⟩ + intro z hz + rcases List.mem_append.mp hz with hz | hz + · exact c.property.1 z hz + · rcases List.mem_cons.mp hz with rfl | hz + · exact ⟨c.property.2,matrixExpectation_range τ.map n x,by + rw [matrixExpectation_trace τ.map τ.normalized n]; exact hx⟩ + · exact d.property.1 z hz⟩ + +theorem blockValue_join (τ:FaithfulNormalTrace M) {n:ℕ} (U:unitary (MatrixAlgebra n M)) + (c d:Block τ n) (x:MatrixAlgebra n M) (hx:matrixTraceMap τ.map n x=0) : + blockValue U (joinBlock τ c d x hx)=blockValue U c*matrixExpectation τ.map n x*blockValue U d := by + simp only [blockValue,joinBlock,powerWord_append,powerWord_cons] + simp only [mul_assoc] + +theorem lift_relWord (τ:FaithfulNormalTrace M) {n:ℕ} {I:Type*} + (U:I → unitary (MatrixAlgebra n M)) (w:List ((I → MatrixAlgebra n M)×MatrixAlgebra n M)) + (hw:∀z∈w,z.1∈Set.range (fun b:Block τ n => fun j => blockValue (U j) b) ∧ + matrixExpectation τ.map n z.2=0) : + ∃v:RelWord τ n,w=v.map (fun z => ((fun j => blockValue (U j) z.1),z.2.val)) := by + induction w with + | nil => exact ⟨[],rfl⟩ + | cons z w ih => + obtain ⟨b,hb⟩ := (hw z List.mem_cons_self).1 + obtain ⟨v,hv⟩ := ih (fun a ha => hw a (List.mem_cons_of_mem _ ha)) + refine ⟨(b,⟨z.2,(hw z List.mem_cons_self).2⟩)::v,?_⟩ + simp only [List.map_cons] + rw [← hv] + congr 1 + exact Prod.ext hb.symm rfl + +theorem transport_limits (τ:FaithfulNormalTrace M) {n:ℕ} {I:Type*} (L:Filter I) + (U:I → unitary (MatrixAlgebra n M)) + (ht:∀t:TransportTest τ n,Tendsto (fun j => testValue τ t (U j)) L (𝓝 0)) + (w:List (ℤ×MatrixAlgebra n M)) (hw:IsCenteredTest τ w) : + Tendsto (fun j => matrixExpectation τ.map n (powerWord (U j) w)) L (𝓝 0) := by + let E := matrixExpectationCLM τ n + let S := Set.range (fun b:Block τ n => fun j => blockValue (U j) b) + let T:Set (MatrixAlgebra n M) := {x | matrixTraceMap τ.map n x=0} + have hz : ∀c∈S,Tendsto (fun j => E (c j)) L (𝓝 0) := by + rintro c ⟨b,rfl⟩ + exact expectation_tendsto_zero_any I L τ n _ (fun a b' => ht (.block b a b')) + have hj : ∀c∈S,∀d∈S,∀x∈T,(fun j => c j*E x*d j)∈S := by + rintro c ⟨b,rfl⟩ d ⟨b',rfl⟩ x hx + exact ⟨joinBlock τ b b' x hx,funext (fun j => blockValue_join τ (U j) b b' x hx)⟩ + have hr : RelativeBlockLimits L E S := by + intro v hv + obtain ⟨v',rfl⟩ := lift_relWord τ U v hv + have he (j:I) : netPair (centeredWord E + (v'.map fun z => ((fun j => blockValue (U j) z.1),z.2.val))) j= + transportPair τ (U j) v' := by + simp only [netPair,centeredWord,List.map_map,Function.comp_def,centerNet,transportPair, + blockCenter,E] + rfl + refine ⟨?_,?_⟩ + · intro hn + have hn' : v'≠[] := by intro h; subst v'; simp at hn + simp only [he] + exact expectation_tendsto_zero_any I L τ n _ (fun a b => ht (.cyclic v' hn' a b)) + · rintro c ⟨b,rfl⟩ + simp only [he] + exact expectation_tendsto_zero_any I L τ n _ (fun a b' => ht (.endpoint v' b a b')) + let pure (k:ℤ) (hk:k≠0) : Block τ n := ⟨([],k),⟨by simp [CenteredPowerWord],hk⟩⟩ + let v : List ((I → MatrixAlgebra n M)×MatrixAlgebra n M) := + w.map fun z => ((fun j => ((U j)^z.1).val),z.2) + have hv : ∀z∈v,z.1∈S ∧ z.2∈T := by + intro z hzv + obtain ⟨a,ha,rfl⟩ := List.mem_map.mp hzv + refine ⟨⟨pure a.1 (hw.2 a ha).1,?_⟩,(hw.2 a ha).2⟩ + funext j + simp [blockValue,pure,powerWord] + have hn : v≠[] := by simpa [v] using hw.1 + have hh := asymptotic_block_transport L E S T (matrixExpectation_idem τ n) + (matrixExpectationCLM_right τ n) (by rintro c ⟨b,rfl⟩; exact block_bound τ n U b) + hz hj hr v hn hv + change Tendsto (fun j => matrixExpectation τ.map n (netPair v j)) L (𝓝 0) at hh + have he (j:I) : netPair v j=powerWord (U j) w := by + simp only [v,netPair,powerWord,List.map_map,Function.comp_def] + convert hh using 1 + · exact funext (fun j => congrArg (matrixExpectation τ.map n) (he j).symm) + · rfl + +end + +end KKFiniteTransport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TransportTests.lean b/lean/OAI/Analysis/FreeWords/TransportTests.lean new file mode 100644 index 0000000000000000000000000000000000000000..1419a701493c0e3bcd56056fbdbfe749aa4452b2 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TransportTests.lean @@ -0,0 +1,104 @@ +import Mathlib +import OAI.Analysis.FreeWords.AmplifiedBlockModel +import OAI.Analysis.FreeWords.MatrixExpectationContinuous +import OAI.Analysis.FreeWords.RelativeFiniteEndpoints +import OAI.Analysis.FreeWords.TransportTestsDefinitions + +namespace OAI + +noncomputable section + +namespace KKFiniteTransport + +noncomputable section + +open KKTraceTransfer KKFreeLiftFrontier KKMatrixExpectation KKControlledConjugation KKRelativeEndpoints + +variable {H:Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M:VonNeumannAlgebra H} + +theorem transportPair_conj (τ:FaithfulNormalTrace M) {n:ℕ} (u:unitary (ConcreteAlgebra M)) + (U:unitary (MatrixAlgebra n M)) (w:RelWord τ n) : + transportPair τ (conjUnitary u U) w=relativePair u (modelWord τ U w) := by + simp only [transportPair,relativePair,modelWord,List.map_map,Function.comp_def,blockCenter_conj] + +theorem modelWord_centered (τ:FaithfulNormalTrace M) {n:ℕ} (U:unitary (MatrixAlgebra n M)) + (w:RelWord τ n) : ∀z∈modelWord τ U w,∀a b,τ.map (z.1 a b)=0 ∧ τ.map (z.2 a b)=0 := by + intro z hz + obtain ⟨c,hc,rfl⟩ := List.mem_map.mp hz + intro a b + exact ⟨trace_center_entry τ n _ a b,(matrixExpectation_zero_iff τ n c.2.val).1 c.2.property a b⟩ + +theorem finite_transport_tests : FiniteTransportTests (H := H) := by + classical + intro M τ hfac hdiff n hn L ε hε + let K:Finset ℤ := L.biUnion fun t => match t with + | .haar k _ => {k} + | _ => ∅ + let E:Finset (List (ℤ×MatrixAlgebra n M)×ℤ) := L.biUnion fun t => match t with + | .block b _ _ => {b.val} + | _ => ∅ + have hE : ∀z∈E,KKHaarEndpoints.CenteredPowerWord (matrixTraceMap τ.map n) + (numericalHom n).range.toSubalgebra z.1 ∧ z.2≠0 := by + intro z hz + obtain ⟨t,ht,hz⟩ := Finset.mem_biUnion.mp hz + cases t with + | block b i j => have he := Finset.mem_singleton.mp hz; subst z; exact b.property + | _ => simp at hz + obtain ⟨d,hd,ρ,hρ,V,hentry,hK,_,hEsmall⟩ := + finite_amplified_block_model M τ hfac hdiff n hn K ∅ E (by simp) hE ε hε + let F:Finset (List (MatrixAlgebra n M×MatrixAlgebra n M)) := L.biUnion fun t => match t with + | .cyclic w _ _ _ => {modelWord τ V w} + | _ => ∅ + let G:Finset (List (MatrixAlgebra n M×MatrixAlgebra n M)×MatrixAlgebra n M) := + L.biUnion fun t => match t with + | .endpoint w b _ _ => {(modelWord τ V w,blockCenter τ V b)} + | _ => ∅ + have hF : ∀w∈F,w≠[] ∧ ∀z∈w,∀a b,τ.map (z.1 a b)=0 ∧ τ.map (z.2 a b)=0 := by + intro w hw + obtain ⟨t,ht,hw⟩ := Finset.mem_biUnion.mp hw + cases t with + | cyclic v hv i j => + have he := Finset.mem_singleton.mp hw + subst w + exact ⟨by simpa [modelWord] using hv,modelWord_centered τ V v⟩ + | _ => simp at hw + have hG : ∀z∈G,(∀c∈z.1,∀a b,τ.map (c.1 a b)=0 ∧ τ.map (c.2 a b)=0) ∧ + ∀a b,τ.map (z.2 a b)=0 := by + intro z hz + obtain ⟨t,ht,hz⟩ := Finset.mem_biUnion.mp hz + cases t with + | endpoint w b i j => + have he := Finset.mem_singleton.mp hz + subst z + exact ⟨modelWord_centered τ V w,trace_center_entry τ n _⟩ + | _ => simp at hz + obtain ⟨u,huF,huG⟩ := relative_finite_endpoints M τ hfac hdiff n F G hF hG ε hε + refine ⟨conjUnitary u V,conjUnitary_good u V ⟨d,hd,ρ,hρ,hentry⟩,?_⟩ + intro t ht + cases t with + | haar k hk => + have hkm : k∈K := Finset.mem_biUnion.mpr ⟨.haar k hk,ht,by simp⟩ + have hh := hK k hkm hk + change ‖matrixTraceMap τ.map n (V^k).val‖<ε at hh + simpa only [testValue,conjUnitary_zpow,amplifyConj_trace τ.map τ.tracial] using hh + | block b i j => + have hbm : b.val∈E := Finset.mem_biUnion.mpr ⟨.block b i j,ht,by simp⟩ + change ‖τ.map (blockValue (conjUnitary u V) b i j)‖<ε + rw [blockValue_conj] + simpa only [amplifyConj_apply,conj_trace τ.map τ.tracial,blockValue] using hEsmall b.val hbm i j + | cyclic w hw i j => + have hwm : modelWord τ V w∈F := Finset.mem_biUnion.mpr ⟨.cyclic w hw i j,ht,by simp⟩ + simpa only [testValue,transportPair_conj] using huF _ hwm i j + | endpoint w b i j => + have hwm : (modelWord τ V w,blockCenter τ V b)∈G := + Finset.mem_biUnion.mpr ⟨.endpoint w b i j,ht,by simp⟩ + simpa only [testValue,transportPair_conj,blockCenter_conj] using huG _ hwm i j + +end + +end KKFiniteTransport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TransportTestsDefinitions.lean b/lean/OAI/Analysis/FreeWords/TransportTestsDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..a6d21784475006ee40eba313cb9eeeffbea07a09 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TransportTestsDefinitions.lean @@ -0,0 +1,50 @@ +import Mathlib +import OAI.Analysis.FreeWords.TransportBlocks + +namespace OAI + +noncomputable section + +namespace KKFiniteTransport + +noncomputable section + +open KKTraceTransfer KKFreeLiftFrontier KKMatrixExpectation KKControlledConjugation + +variable {H:Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M:VonNeumannAlgebra H} + +abbrev RelWord (τ:FaithfulNormalTrace M) (n:ℕ) := List (Block τ n× + {x:MatrixAlgebra n M // matrixExpectation τ.map n x=0}) + +inductive TransportTest (τ:FaithfulNormalTrace M) (n:ℕ) where + | haar (k:ℤ) (hk:k≠0) + | block (b:Block τ n) (i j:Fin n) + | cyclic (w:RelWord τ n) (hne:w≠[]) (i j:Fin n) + | endpoint (w:RelWord τ n) (b:Block τ n) (i j:Fin n) + +def transportPair (τ:FaithfulNormalTrace M) {n:ℕ} (U:unitary (MatrixAlgebra n M)) (w:RelWord τ n) := + (w.map fun z => blockCenter τ U z.1*z.2.val).prod + +def modelWord (τ:FaithfulNormalTrace M) {n:ℕ} (U:unitary (MatrixAlgebra n M)) (w:RelWord τ n) := + w.map fun z => (blockCenter τ U z.1,z.2.val) + +def testValue (τ:FaithfulNormalTrace M) {n:ℕ} (t:TransportTest τ n) (U:unitary (MatrixAlgebra n M)) : ℂ := + match t with + | .haar k _ => matrixTraceMap τ.map n (U^k).val + | .block b i j => τ.map (blockValue U b i j) + | .cyclic w _ i j => τ.map (transportPair τ U w i j) + | .endpoint w b i j => τ.map ((transportPair τ U w*blockCenter τ U b) i j) + +def FiniteTransportTests : Prop := + ∀(M:VonNeumannAlgebra H) (τ:FaithfulNormalTrace M),IsFactor M → IsDiffuse M → + ∀n:ℕ,0 tupleLabels a = W) + +theorem tupleFiber_card (n : ℕ) (W : Multiset α) : + (tupleFiber n W).card ≤ n.factorial := by + classical + by_cases h : (tupleFiber n W).Nonempty + · obtain ⟨a, ha⟩ := h + have haW : tupleLabels a = W := (Finset.mem_filter.mp ha).2 + calc + _ = ((tupleFiber n W).image List.ofFn).card := + (Finset.card_image_of_injective _ List.ofFn_injective).symm + _ ≤ ((List.ofFn a).permutations.toFinset).card := by + apply Finset.card_le_card + intro l hl + obtain ⟨b, hb, rfl⟩ := Finset.mem_image.mp hl + apply List.mem_toFinset.mpr + apply List.mem_permutations.mpr + apply Multiset.coe_eq_coe.mp + exact ((Finset.mem_filter.mp hb).2).trans haW.symm + _ ≤ (List.ofFn a).permutations.length := List.toFinset_card_le _ + _ = n.factorial := by rw [List.length_permutations, List.length_ofFn] + · rw [Finset.not_nonempty_iff_eq_empty.mp h] + simp + +theorem tuple_completion_card (n : ℕ) (U W : Multiset α) : + (Finset.univ.filter (fun a : Fin n → α => U + tupleLabels a = W)).card ≤ + n.factorial := by + classical + let s := Finset.univ.filter (fun a : Fin n → α => U + tupleLabels a = W) + by_cases hs : s.Nonempty + · obtain ⟨a, ha⟩ := hs + have he : s = tupleFiber n (tupleLabels a) := by + ext b + simp only [s, tupleFiber, Finset.mem_filter, Finset.mem_univ, true_and] + rw [← (Finset.mem_filter.mp ha).2, add_left_cancel_iff] + change s.card ≤ _ + rw [he] + exact tupleFiber_card n (tupleLabels a) + · exact (Finset.card_eq_zero.mpr (Finset.not_nonempty_iff_eq_empty.mp hs)).le.trans + (Nat.zero_le _) + +omit [Fintype α] [DecidableEq α] in +@[simp] theorem tupleLabels_cons {n : ℕ} (c : α) (a : Fin n → α) : + tupleLabels (Fin.cons c a) = {c} + tupleLabels a := by + simp [tupleLabels, Multiset.singleton_add] + +theorem sum_card_tuple_completion (n : ℕ) (U W : Multiset α) : + (∑ a : Fin n → α, + (Finset.univ.filter (fun c : α => U + {c} + tupleLabels a = W)).card) ≤ + (n + 1).factorial := by + have he : (∑ a : Fin n → α, + (Finset.univ.filter (fun c : α => U + {c} + tupleLabels a = W)).card) = + (Finset.univ.filter (fun a : Fin (n+1) → α => U + tupleLabels a = W)).card := by + simp only [Finset.card_filter] + rw [← Equiv.sum_comp (Fin.consEquiv (fun _ : Fin (n+1) => α)) + (fun a => if U + tupleLabels a = W then (1 : ℕ) else 0)] + rw [Fintype.sum_prod_type] + have hc (c : α) (a : Fin n → α) : + tupleLabels ((Fin.consEquiv (fun _ : Fin (n+1) => α)) (c,a)) = + {c} + tupleLabels a := tupleLabels_cons c a + simp only [hc, ← add_assoc] + exact Finset.sum_comm + rw [he] + exact tuple_completion_card (n+1) U W + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TupleHull.lean b/lean/OAI/Analysis/FreeWords/TupleHull.lean new file mode 100644 index 0000000000000000000000000000000000000000..7642d4819e3cac098f198a7d20040802772b31e2 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TupleHull.lean @@ -0,0 +1,140 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorStructure + +namespace OAI + +noncomputable section + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) {ι : Type*} [Fintype ι] + +abbrev TupleSpace := PiLp 2 (fun _ : ι => (tracePositive τ).GNS) + +def tupleVector (x : ι → ConcreteAlgebra M) : TupleSpace τ (ι := ι) := + WithLp.toLp 2 (fun i => gnsVector (tracePositive τ) (x i)) + +def tupleConj (u : unitary (ConcreteAlgebra M)) : TupleSpace τ (ι := ι) →L[ℂ] TupleSpace τ (ι := ι) := + (PiLp.continuousLinearEquiv 2 ℂ _).symm.toContinuousLinearMap.comp + (ContinuousLinearMap.pi (fun i => + (gnsConj (tracePositive τ) (tracePositive_tracial τ) u).comp (PiLp.proj 2 _ i))) + +def tupleOrbit (x : ι → ConcreteAlgebra M) : Set (TupleSpace τ (ι := ι)) := + Set.range (fun u : unitary (ConcreteAlgebra M) => tupleVector τ (fun i => algebraConj u (x i))) + +def tupleHull (x : ι → ConcreteAlgebra M) : Set (TupleSpace τ (ι := ι)) := + closure (convexHull ℝ (tupleOrbit τ x)) + +omit [Fintype ι] in +@[simp] theorem tupleConj_apply (u : unitary (ConcreteAlgebra M)) + (v : TupleSpace τ (ι := ι)) (i : ι) : + tupleConj τ u v i = gnsConj (tracePositive τ) (tracePositive_tracial τ) u (v i) := rfl + +omit [Fintype ι] in +@[simp] theorem tupleConj_vector (u : unitary (ConcreteAlgebra M)) (x : ι → ConcreteAlgebra M) : + tupleConj τ u (tupleVector τ x) = tupleVector τ (fun i => algebraConj u (x i)) := by + ext i + exact gnsConj_vector _ _ _ _ + +theorem tupleConj_norm (u : unitary (ConcreteAlgebra M)) (v : TupleSpace τ (ι := ι)) : + ‖tupleConj τ u v‖ = ‖v‖ := by + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + simp only [PiLp.norm_sq_eq_of_L2, tupleConj_apply, gnsConj_norm] + +theorem mapsTo_hull_codomain {F G : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + [NormedAddCommGroup G] [NormedSpace ℝ G] (f : F →L[ℝ] G) {S : Set F} {T : Set G} + (hf : Set.MapsTo f S T) : + Set.MapsTo f (closure (convexHull ℝ S)) (closure (convexHull ℝ T)) := by + apply Set.MapsTo.closure _ f.continuous + intro x hx + have hh : f x ∈ f '' convexHull ℝ S := ⟨x,hx,rfl⟩ + rw [show f '' convexHull ℝ S = convexHull ℝ (f '' S) from + f.toLinearMap.image_convexHull S] at hh + exact convexHull_mono hf.image_subset hh + +theorem tupleHull_component (x : ι → ConcreteAlgebra M) + (v : TupleSpace τ (ι := ι)) (hv : v ∈ tupleHull τ x) (i : ι) : + v i ∈ conjugacyHull τ (x i) := by + let f : TupleSpace τ (ι := ι) →L[ℝ] (tracePositive τ).GNS := + (PiLp.proj 2 (fun _ : ι => (tracePositive τ).GNS) i : + TupleSpace τ (ι := ι) →L[ℂ] (tracePositive τ).GNS).restrictScalars ℝ + have hm : Set.MapsTo f (tupleOrbit τ x) (conjugacyOrbit τ (x i)) := by + rintro _ ⟨u,rfl⟩ + exact ⟨u,rfl⟩ + exact mapsTo_hull_codomain f hm hv + +theorem tupleConj_hull (x : ι → ConcreteAlgebra M) (u : unitary (ConcreteAlgebra M)) : + Set.MapsTo (tupleConj τ u) (tupleHull τ x) (tupleHull τ x) := by + change Set.MapsTo (tupleConj τ u) (closure (convexHull ℝ (tupleOrbit τ x))) + (closure (convexHull ℝ (tupleOrbit τ x))) + apply mapsTo_hull ((tupleConj τ u).restrictScalars ℝ) (S := tupleOrbit τ x) + rintro _ ⟨w,rfl⟩ + refine ⟨u*w,?_⟩ + change tupleVector τ (fun i => algebraConj (u*w) (x i)) = + tupleConj τ u (tupleVector τ (fun i => algebraConj w (x i))) + rw [tupleConj_vector] + congr 1 + funext i + simp only [algebraConj_apply,Submonoid.coe_mul,star_mul,mul_assoc] + +theorem tuple_trace_in_hull (hM : KKFreeLiftFrontier.IsFactor M) (x : ι → ConcreteAlgebra M) : + tupleVector τ (fun i => τ.map (x i) • 1) ∈ tupleHull τ x := by + let : InnerProductSpace ℝ (TupleSpace τ (ι := ι)) := + InnerProductSpace.rclikeToReal ℂ (TupleSpace τ (ι := ι)) + have hc : Convex ℝ (tupleHull τ x) := (convex_convexHull ℝ _).closure + have hn : (tupleHull τ x).Nonempty := by + refine ⟨tupleVector τ x,subset_closure (subset_convexHull ℝ _ ?_)⟩ + refine ⟨1,?_⟩ + ext i + change gnsVector (tracePositive τ) (algebraConj 1 (x i)) = gnsVector (tracePositive τ) (x i) + simp only [algebraConj_apply,OneMemClass.coe_one,star_one,one_mul,mul_one] + obtain ⟨v,hv,hmin⟩ := exists_norm_eq_iInf_of_complete_convex hn isClosed_closure.isComplete hc 0 + have hf (u : unitary (ConcreteAlgebra M)) : tupleConj τ u v = v := by + exact (norm_minimizer_unique hc hv (tupleConj_hull τ x u hv) hmin + (tupleConj_norm τ u v)).symm + have he : tupleVector τ (fun i => τ.map (x i) • 1) = v := by + ext i + have hi := tupleHull_component τ x v hv i + obtain ⟨a,ha,hav⟩ := conjugacyHull_bounded τ (x i) hi + have hcentral : ∀ b, Commute a b := by + apply commute_all_of_unitary + intro u + have he : algebraConj u a = a := by + apply gnsVector_injective τ + rw [← gnsConj_vector,hav] + exact congrArg (fun z : TupleSpace τ (ι := ι) => z i) (hf u) + have he' := congrArg (fun z => z * (u : ConcreteAlgebra M)) he + simp only [algebraConj_apply,mul_assoc,Unitary.coe_star_mul_self,mul_one] at he' + exact he'.symm + obtain ⟨c,hcc⟩ := hM a hcentral + have ht := conjugacyHull_trace τ (x i) (v i) hi + rw [← hav,gnsVector_inner,star_one,one_mul] at ht + change τ.map a = τ.map (x i) at ht + rw [hcc,map_smul,τ.normalized,smul_eq_mul,mul_one] at ht + change gnsVector (tracePositive τ) (τ.map (x i) • 1) = v i + rw [← ht,← hcc] + exact hav + exact he ▸ hv + +end + +end KKFactorSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/TupleMatrices.lean b/lean/OAI/Analysis/FreeWords/TupleMatrices.lean new file mode 100644 index 0000000000000000000000000000000000000000..07263e99df7b8e236c7ce124d72a8f96e419e645 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/TupleMatrices.lean @@ -0,0 +1,142 @@ +import Mathlib +import OAI.Analysis.FreeWords.OperatorRows +import OAI.Analysis.FreeWords.TupleCombinatorics + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder InnerProductSpace + +noncomputable section + +variable {E α : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E] + +variable [Fintype α] [DecidableEq α] + +def tupleScalarMatrix (p q : ℕ) (W : Multiset α) + (a : Fin q → α) (b : Fin p → α) : E →L[ℂ] E := + if tupleLabels a + tupleLabels b = W then 1 else 0 + +omit [CompleteSpace E] in +theorem tupleScalarMatrix_bound (p q : ℕ) (W : Multiset α) : + MatrixSqBound (tupleScalarMatrix (E := E) p q W) + ((p.factorial : ℝ) * q.factorial) := by + let w (a : Fin q → α) (b : Fin p → α) : ℝ := + if tupleLabels a + tupleLabels b = W then 1 else 0 + have hr a : ∑ b, w a b ≤ (p.factorial : ℝ) := by + simpa only [w, Finset.sum_boole] using + (Nat.cast_le (α := ℝ)).mpr (tuple_completion_card p (tupleLabels a) W) + have hc b : ∑ a, w a b ≤ (q.factorial : ℝ) := by + simpa only [w, add_comm (tupleLabels _) (tupleLabels b), Finset.sum_boole] using + (Nat.cast_le (α := ℝ)).mpr (tuple_completion_card q (tupleLabels b) W) + have h := scalar_matrix_bound (E := E) w (fun a b => by dsimp [w]; split_ifs <;> positivity) + _ _ (Nat.cast_nonneg _) (Nat.cast_nonneg _) hr hc + convert h using 1 + funext a b + dsimp only [tupleScalarMatrix, w] + split_ifs <;> simp + +def tupleProjectionMatrix (P : α → E →L[ℂ] E) (p q : ℕ) (W : Multiset α) + (a : Fin q → α) (b : Fin p → α) : E →L[ℂ] E := + ∑ c, if tupleLabels a + {c} + tupleLabels b = W then P c else 0 + +def tupleMissingWeight (p q : ℕ) (W : Multiset α) + (a : Fin q → α) (b : Fin p → α) : ℝ := + ((Finset.univ.filter (fun c => tupleLabels a + {c} + tupleLabels b = W)).card : ℝ) + +theorem tupleProjectionMatrix_bound (P : α → E →L[ℂ] E) + (hP : ∀ c, IsStarProjection (P c)) + (horth : ∀ c e, c ≠ e → P c * P e = 0) (hsum : ∑ c, P c = 1) + (p q : ℕ) (W : Multiset α) : + MatrixSqBound (tupleProjectionMatrix P p q W) + ((p.factorial : ℝ) * q.factorial) := by + let s (a : Fin q → α) (c : α) := + Finset.univ.filter (fun b : Fin p → α => tupleLabels a + {c} + tupleLabels b = W) + have hr a c : (s a c).card ≤ p.factorial := + tuple_completion_card p (tupleLabels a + {c}) W + have hc b c : (Finset.univ.filter (fun a => b ∈ s a c)).card ≤ q.factorial := by + simpa only [s, Finset.mem_filter, Finset.mem_univ, true_and, + show ∀ a : Fin q → α, tupleLabels a + {c} + tupleLabels b = + tupleLabels b + {c} + tupleLabels a from fun a => by ac_rfl] using + tuple_completion_card q (tupleLabels b + {c}) W + have h := projection_incidence_bound P hP horth hsum s _ _ hr hc + convert h using 1 + funext a b + simp only [tupleProjectionMatrix, s, Finset.mem_filter, Finset.mem_univ, true_and] + +theorem tupleMissingWeight_rows (p q : ℕ) (W : Multiset α) (a : Fin q → α) : + (∑ b, tupleMissingWeight p q W a b) ≤ ((p+1).factorial : ℝ) := by + dsimp only [tupleMissingWeight] + exact_mod_cast sum_card_tuple_completion p (tupleLabels a) W + +theorem tupleMissingWeight_cols (p q : ℕ) (W : Multiset α) (b : Fin p → α) : + (∑ a, tupleMissingWeight p q W a b) ≤ ((q+1).factorial : ℝ) := by + have h := tupleMissingWeight_rows (α := α) q p W b + have he (a : Fin q → α) (c : α) : tupleLabels b + {c} + tupleLabels a = + tupleLabels a + {c} + tupleLabels b := by ac_rfl + simpa only [tupleMissingWeight, he] using h + +omit [CompleteSpace E] in +theorem tupleMissingMatrix_bound (p q : ℕ) (W : Multiset α) : + MatrixSqBound (fun a b => (tupleMissingWeight p q W a b : ℂ) • (1 : E →L[ℂ] E)) + (((p+1).factorial : ℝ) * (q+1).factorial) := by + apply scalar_matrix_bound _ (fun _ _ => Nat.cast_nonneg _) _ _ + (Nat.cast_nonneg _) (Nat.cast_nonneg _) + · exact tupleMissingWeight_rows p q W + · exact tupleMissingWeight_cols p q W + +def tuplePresMatrix (P : α → E →L[ℂ] E) (Q : E →L[ℂ] E) (z : ℂ) + (p q : ℕ) (W : Multiset α) (a : Fin q → α) (b : Fin p → α) : E →L[ℂ] E := + ∑ c, if tupleLabels a + {c} + tupleLabels b = W then Q * (P c - z • 1) * Q else 0 + +omit [CompleteSpace E] in +theorem tuplePresMatrix_eq (P : α → E →L[ℂ] E) (Q : E →L[ℂ] E) (z : ℂ) + (p q : ℕ) (W : Multiset α) (a : Fin q → α) (b : Fin p → α) : + tuplePresMatrix P Q z p q W a b = + Q * (tupleProjectionMatrix P p q W a b + + (-z) • ((tupleMissingWeight p q W a b : ℂ) • 1)) * Q := by + have hcount : ((tupleMissingWeight p q W a b : ℂ) • (1 : E →L[ℂ] E)) = + ∑ c, if tupleLabels a + {c} + tupleLabels b = W then 1 else 0 := by + simp only [tupleMissingWeight, Complex.ofReal_natCast, ← Finset.sum_filter, + Finset.sum_const, Nat.cast_smul_eq_nsmul] + rw [hcount] + simp only [tuplePresMatrix, tupleProjectionMatrix, Finset.smul_sum, + ← Finset.sum_add_distrib, Finset.mul_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro c hc + split_ifs <;> simp [sub_eq_add_neg] + +theorem tuplePresMatrix_bound (P : α → E →L[ℂ] E) + (hP : ∀ c, IsStarProjection (P c)) + (horth : ∀ c e, c ≠ e → P c * P e = 0) (hsum : ∑ c, P c = 1) + (Q : E →L[ℂ] E) (hQ : ‖Q‖ ≤ 1) (z : ℂ) + (p q : ℕ) (W : Multiset α) : + MatrixSqBound (tuplePresMatrix P Q z p q W) + ((Real.sqrt ((p.factorial : ℝ) * q.factorial) + + ‖z‖ * Real.sqrt (((p+1).factorial : ℝ) * (q+1).factorial)) ^ 2) := by + have hpq : 0 ≤ (p.factorial : ℝ) * q.factorial := by positivity + have hpq' : 0 ≤ ((p+1).factorial : ℝ) * (q+1).factorial := by positivity + have hPmat : MatrixSqBound (tupleProjectionMatrix P p q W) + ((Real.sqrt ((p.factorial : ℝ) * q.factorial)) ^ 2) := by + rw [Real.sq_sqrt hpq] + exact tupleProjectionMatrix_bound P hP horth hsum p q W + have hSmat : MatrixSqBound + (fun a b => (-z) • ((tupleMissingWeight p q W a b : ℂ) • (1 : E →L[ℂ] E))) + ((‖z‖ * Real.sqrt (((p+1).factorial : ℝ) * (q+1).factorial)) ^ 2) := by + rw [mul_pow, Real.sq_sqrt hpq'] + simpa only [norm_neg] using (tupleMissingMatrix_bound (E := E) p q W).smul (-z) + have h := (hPmat.add hSmat (Real.sqrt_nonneg _) + (mul_nonneg (norm_nonneg _) (Real.sqrt_nonneg _))).compress (sq_nonneg _) Q hQ + convert h using 1 + funext a b + exact tuplePresMatrix_eq P Q z p q W a b + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UltraBallFull.lean b/lean/OAI/Analysis/FreeWords/UltraBallFull.lean new file mode 100644 index 0000000000000000000000000000000000000000..3476174ab3d9e5bcef7eaf9aedf7ad54b09cdd2e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UltraBallFull.lean @@ -0,0 +1,152 @@ +import Mathlib +import OAI.Analysis.FreeWords.UltraDiagonal +import OAI.Analysis.FreeWords.UnitaryLift + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace.seqOrder + +attribute [local instance] KKUltraTrace.seqSOR + +open scoped InnerProductSpace + +end + +end KKUltraTrace + +namespace KKFactorSupport + +open KKUltraTrace + +open scoped ComplexOrder InnerProductSpace BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +local instance ultraBallFullSeqOrder : PartialOrder (ℕ →ᵇ A) := + CStarAlgebra.spectralOrder _ + +local instance ultraBallFullSeqStarOrderedRing : StarOrderedRing (ℕ →ᵇ A) := + CStarAlgebra.spectralOrderedRing _ + +end + +end KKFactorSupport + +namespace KKUltraTrace + +open Filter Topology + +noncomputable section + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped BoundedContinuousFunction ComplexOrder + +open Filter Topology KKFactorSupport + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +local instance ultraBallFullSeqOrder : PartialOrder (ℕ →ᵇ A) := + CStarAlgebra.spectralOrder _ + +local instance ultraBallFullSeqStarOrderedRing : StarOrderedRing (ℕ →ᵇ A) := + CStarAlgebra.spectralOrderedRing _ + +theorem tendsto_ultraVector_norm (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) (x : ℕ →ᵇ A) : + Tendsto (fun j => ‖gnsVector τ (x j)‖) (ω : Filter ℕ) + (𝓝 ‖gnsVector (ultraTrace τ ω) x‖) := by + rw [gnsVector_norm_eq_sqrt] + exact tendsto_gnsVector_norm τ ω x + +theorem ultraVectorBall_isClosed (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) + (hω : (ω : Filter ℕ) ≤ atTop) (R : ℝ) : + IsClosed (gnsVector (ultraTrace τ ω) '' Metric.closedBall (0 : ℕ →ᵇ A) R) := by + apply isClosed_of_closure_subset + intro y hy + let e (n : ℕ) : ℝ := ((n : ℝ)+1)⁻¹ + have he (n : ℕ) : 0 < e n := by dsimp [e]; positivity + have hchoose (n : ℕ) : ∃ s : ℕ →ᵇ A, ‖s‖ ≤ R ∧ + ‖gnsVector (ultraTrace τ ω) s - y‖ < e n := by + obtain ⟨z, ⟨s, hs, rfl⟩, hz⟩ := Metric.mem_closure_iff.mp hy (e n) (he n) + exact ⟨s, by simpa using hs, by simpa only [dist_eq_norm, norm_sub_rev] using hz⟩ + choose s hs hsclose using hchoose + have hR : 0 ≤ R := (norm_nonneg (s 0)).trans (hs 0) + have hemono {m n : ℕ} (hmn : m ≤ n) : e n ≤ e m := by + dsimp [e] + exact inv_anti₀ (by positivity) (by exact_mod_cast Nat.add_le_add_right hmn 1) + have hpair {m n : ℕ} (hmn : m ≤ n) : + ‖gnsVector (ultraTrace τ ω) (s n - s m)‖ < 2 * e m := by + rw [map_sub] + calc + ‖gnsVector (ultraTrace τ ω) (s n) - gnsVector (ultraTrace τ ω) (s m)‖ + ≤ ‖gnsVector (ultraTrace τ ω) (s n) - y‖ + + ‖gnsVector (ultraTrace τ ω) (s m) - y‖ := by simpa only [norm_sub_rev] using norm_sub_le_norm_sub_add_norm_sub (gnsVector (ultraTrace τ ω) (s n)) y (gnsVector (ultraTrace τ ω) (s m)) + _ < e n + e m := add_lt_add (hsclose n) (hsclose m) + _ ≤ 2 * e m := by linarith [hemono hmn] + let S (n : ℕ) : Set ℕ := {j | ∀ m ≤ n, ‖gnsVector τ ((s n - s m) j)‖ < 3 * e m} + have hS (n : ℕ) : S n ∈ (ω : Filter ℕ) := by + have ht (m : ℕ) (hm : m ∈ Finset.range (n+1)) : + ∀ᶠ j in (ω : Filter ℕ), ‖gnsVector τ ((s n - s m) j)‖ < 3*e m := by + have hmn : m ≤ n := Nat.lt_succ_iff.mp (Finset.mem_range.mp hm) + have hb : ‖gnsVector (ultraTrace τ ω) (s n - s m)‖ < 3*e m := by + linarith [hpair hmn, he m] + exact (tendsto_order.mp (tendsto_ultraVector_norm τ ω (s n - s m))).2 _ hb + have hh := (Filter.eventually_all_finset (Finset.range (n+1))).mpr ht + filter_upwards [hh] with j hj + intro m hm + exact hj m (Finset.mem_range.mpr (Nat.lt_succ_iff.mpr hm)) + obtain ⟨k, hk, hkS⟩ := ultrafilter_diagonal_indices ω hω S hS + let x : ℕ →ᵇ A := BoundedContinuousFunction.ofNormedAddCommGroup + (fun j => s (k j) j) continuous_of_discreteTopology R + (fun j => (s (k j)).norm_coe_le_norm j |>.trans (hs (k j))) + have hx : ‖x‖ ≤ R := (BoundedContinuousFunction.norm_le hR).mpr + (fun j => (s (k j)).norm_coe_le_norm j |>.trans (hs (k j))) + have hdist (m : ℕ) : ‖gnsVector (ultraTrace τ ω) x - gnsVector (ultraTrace τ ω) (s m)‖ ≤ 3*e m := by + rw [← map_sub] + apply le_of_tendsto (tendsto_ultraVector_norm τ ω (x - s m)) + filter_upwards [hkS, (tendsto_atTop.mp hk) m] with j hj hm + exact (hj m hm).le + have htotal (m : ℕ) : ‖gnsVector (ultraTrace τ ω) x - y‖ ≤ 4*e m := by + calc + ‖gnsVector (ultraTrace τ ω) x - y‖ ≤ + ‖gnsVector (ultraTrace τ ω) x - gnsVector (ultraTrace τ ω) (s m)‖ + + ‖gnsVector (ultraTrace τ ω) (s m)-y‖ := norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ 3*e m + e m := add_le_add (hdist m) (hsclose m).le + _ = 4*e m := by ring + have hlim : Tendsto (fun m => 4*e m) atTop (𝓝 0) := by + have ht : Tendsto (fun m : ℕ => ((m : ℝ)+1)⁻¹) atTop (𝓝 0) := by + simpa only [Function.comp_def, Nat.cast_add, Nat.cast_one] using + (tendsto_inv_atTop_nhds_zero_nat (𝕜 := ℝ)).comp (tendsto_add_atTop_nat 1) + simpa [e] using ht.const_mul 4 + have hz : ‖gnsVector (ultraTrace τ ω) x-y‖ ≤ 0 := + le_of_tendsto_of_tendsto tendsto_const_nhds hlim (Filter.Eventually.of_forall htotal) + exact ⟨x, by simpa using hx, sub_eq_zero.mp (norm_eq_zero.mp (le_antisymm hz (norm_nonneg _)))⟩ + +end + +end KKUltraTrace +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UltraDiagonal.lean b/lean/OAI/Analysis/FreeWords/UltraDiagonal.lean new file mode 100644 index 0000000000000000000000000000000000000000..fff87fc8ec3f0f302dcb143696be2ffd6db1e7f8 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UltraDiagonal.lean @@ -0,0 +1,42 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open Filter Topology + +noncomputable section + +theorem ultrafilter_diagonal_indices (ω : Ultrafilter ℕ) + (hω : (ω : Filter ℕ) ≤ atTop) (S : ℕ → Set ℕ) (hS : ∀ n, S n ∈ (ω : Filter ℕ)) : + ∃ k : ℕ → ℕ, Tendsto k (ω : Filter ℕ) atTop ∧ + ∀ᶠ j in (ω : Filter ℕ), j ∈ S (k j) := by + classical + let P (j n : ℕ) := ∀ m ≤ n, j ∈ S m + let k (j : ℕ) := Nat.findGreatest (P j) j + have hP (n : ℕ) : ∀ᶠ j in (ω : Filter ℕ), P j n := by + induction n with + | zero => simpa [P] using hS 0 + | succ n ih => + filter_upwards [ih, hS (n+1)] with j hj hn + intro m hm + rcases Nat.le_or_eq_of_le_add_one hm with h | rfl + · exact hj m h + · exact hn + refine ⟨k, tendsto_atTop.2 ?_, ?_⟩ + · intro n + filter_upwards [hP n, hω (eventually_ge_atTop n)] with j hj hjn + exact Nat.le_findGreatest hjn hj + · filter_upwards [hP 0] with j hj + have hg : P j (k j) := Nat.findGreatest_spec (Nat.zero_le j) hj + exact hg (k j) le_rfl + +end + +end KKUltraTrace +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UltraExpectation.lean b/lean/OAI/Analysis/FreeWords/UltraExpectation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3dbb9d52d23c51d7782006fb48a30dd6f7321a14 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UltraExpectation.lean @@ -0,0 +1,332 @@ +import Mathlib +import OAI.Analysis.FreeWords.TraceTransfer +import OAI.Analysis.FreeWords.UltraExpectationDefs +import OAI.Analysis.FreeWords.UltraQuotientRange + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace.seqOrder + +attribute [local instance] KKUltraTrace.seqSOR + +open scoped InnerProductSpace + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {B : Type*} [CStarAlgebra B] [PartialOrder B] [StarOrderedRing B] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace._seqOrder + +attribute [local instance] KKUltraTrace._seqSOR + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +noncomputable section + +variable {A B : Type*} [CStarAlgebra A] [CStarAlgebra B] + [PartialOrder A] [StarOrderedRing A] [PartialOrder B] [StarOrderedRing B] + +local instance ultraExpectationSeqOrder : PartialOrder (ℕ →ᵇ A) := CStarAlgebra.spectralOrder _ + +local instance ultraExpectationSeqSOR : StarOrderedRing (ℕ →ᵇ A) := CStarAlgebra.spectralOrderedRing _ + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace.quotientOrder + +attribute [local instance] KKUltraTrace.quotientLE + +attribute [local instance] KKUltraTrace.quotientPreorder + +attribute [local instance] KKUltraTrace.quotientSOR + +end + +end KKUltraTrace + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +namespace UniversalStrongKK + +section OperatorMean + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +variable (m : ScalarMean G) + +variable [CompleteSpace H] + +end OperatorMean + +end UniversalStrongKK + +open scoped Topology + +namespace UniversalStrongKK + +section UltraMean + +variable {I : Type*} [TopologicalSpace I] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UltraMean + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped InnerProductSpace + +open Filter Topology + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +section OperatorMeanAlgebra + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable (m : ScalarMean G) + +end OperatorMeanAlgebra + +end UniversalStrongKK + +namespace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKTraceTransfer + +namespace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKTraceTransfer + +namespace KKTraceTransfer + +open scoped BoundedContinuousFunction ComplexOrder InnerProductSpace + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +attribute [local instance] KKTraceTransfer.concreteOrder + +attribute [local instance] KKTraceTransfer.concreteLE + +attribute [local instance] KKTraceTransfer.concretePreorder + +attribute [local instance] KKTraceTransfer.concreteSOR + +attribute [local instance] KKTraceTransfer.seqOrder + +attribute [local instance] KKTraceTransfer.seqLE + +attribute [local instance] KKTraceTransfer.seqPreorder + +attribute [local instance] KKTraceTransfer.seqSOR + +end + +end KKTraceTransfer + +namespace KKTraceTransfer + +open scoped BoundedContinuousFunction ComplexOrder InnerProductSpace + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance ultraExpectationConcreteOrder (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance ultraExpectationConcretePreorder (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance ultraExpectationConcreteLE (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance ultraExpectationConcreteSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +local instance ultraExpectationConcreteSeqOrder (M : VonNeumannAlgebra H) : PartialOrder (ℕ →ᵇ ConcreteAlgebra M) := seqOrder M + +local instance ultraExpectationConcreteSeqPreorder (M : VonNeumannAlgebra H) : Preorder (ℕ →ᵇ ConcreteAlgebra M) := (seqOrder M).toPreorder + +local instance ultraExpectationConcreteSeqLE (M : VonNeumannAlgebra H) : LE (ℕ →ᵇ ConcreteAlgebra M) := (seqOrder M).toLE + +local instance ultraExpectationConcreteSeqSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ℕ →ᵇ ConcreteAlgebra M) := seqSOR M + +@[instance_reducible] def ultraOrder {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) : + PartialOrder (ultraAlgebra τ ω) := CStarAlgebra.spectralOrder _ + +attribute [local instance] KKTraceTransfer.ultraOrder + +local instance ultraExpectationUltraPreorder {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) : + Preorder (ultraAlgebra τ ω) := (ultraOrder τ ω).toPreorder + +local instance ultraExpectationUltraLE {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) : + LE (ultraAlgebra τ ω) := (ultraOrder τ ω).toLE + +local instance ultraExpectationUltraSOR {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) : + type_of% (CStarAlgebra.spectralOrderedRing (ultraAlgebra τ ω)) := + CStarAlgebra.spectralOrderedRing (ultraAlgebra τ ω) + +private theorem closure_range_surjective {A B : Type*} [TopologicalSpace B] + (f : A → B) (hclosed : IsClosed (Set.range f)) : + Function.Surjective (fun x : A => + (⟨f x, subset_closure ⟨x, rfl⟩⟩ : closure (Set.range f))) := by + rintro ⟨y, hy⟩ + rw [hclosed.closure_eq] at hy + obtain ⟨x, hx⟩ := hy + exact ⟨x, Subtype.ext hx⟩ + +theorem ultraProjection_surjective {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (ω : Ultrafilter ℕ) : Function.Surjective (ultraProjection τ ω) := + closure_range_surjective (KKUltraTrace.ultraTrace (tracePositive τ) ω).gnsStarAlgHom + (KKUltraTrace.ultra_gns_image_closed (tracePositive τ) ω) + +private theorem trace_star_mul_zero_of_gns_zero {A : Type*} [CStarAlgebra A] + [PartialOrder A] [StarOrderedRing A] (τ : A →ₚ[ℂ] ℂ) (x : A) + (hx : τ.gnsStarAlgHom x = 0) : τ (star x * x) = 0 := by + rw [← KKUltraTrace.gnsExpectation_image, map_mul, map_star, hx, star_zero, mul_zero] + simp [KKUltraTrace.gnsExpectation] + +theorem sequenceMean_zero_of_projection_zero {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) (x : ℕ →ᵇ ConcreteAlgebra M) + (hx : ultraProjection τ ω x = 0) : sequenceMean M ω x = 0 := by + have h0 : KKUltraTrace.ultraTrace (tracePositive τ) ω (star x * x) = 0 := by + have hh : (KKUltraTrace.ultraTrace (tracePositive τ) ω).gnsStarAlgHom x = 0 := + congrArg Subtype.val hx + exact trace_star_mul_zero_of_gns_zero (KKUltraTrace.ultraTrace (tracePositive τ) ω) x hh + have ht := KKUltraTrace.tendsto_ultraTraceValue (tracePositive τ) ω (star x * x) + change Tendsto (fun j => τ.map (star (x j) * x j)) (ω : Filter ℕ) + (𝓝 (KKUltraTrace.ultraTrace (tracePositive τ) ω (star x*x))) at ht + rw [h0] at ht + have htn : Tendsto (fun j => traceNorm τ (x j)) (ω : Filter ℕ) (𝓝 0) := by + have hh := Real.continuous_sqrt.continuousAt.tendsto.comp + (Complex.continuous_re.continuousAt.tendsto.comp ht) + simpa only [traceNorm, Complex.zero_re, Real.sqrt_zero, Function.comp_def] using hh + have hs (ξ : H) := trace_transfer τ ω x ⟨‖x‖, x.norm_coe_le_norm⟩ htn ξ + have hstrong (ξ : H) : Tendsto (fun j => (x j : H →L[ℂ] H) ξ) (ω : Filter ℕ) (𝓝 0) := + (tendsto_zero_iff_norm_tendsto_zero).mpr (hs ξ) + have hweak : Tendsto (fun j => ContinuousLinearMapWOT.ofCLM (x j : H →L[ℂ] H)) + (ω : Filter ℕ) (𝓝 0) := by + apply ContinuousLinearMapWOT.tendsto_iff_forall_inner_apply_tendsto.mpr + intro ξ η + simpa using tendsto_const_nhds.inner (hstrong ξ) + have heq := tendsto_nhds_unique (tendsto_sequenceMean ω x) hweak + apply Subtype.ext + exact congrArg ContinuousLinearMapWOT.toCLM heq + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UltraExpectationDefs.lean b/lean/OAI/Analysis/FreeWords/UltraExpectationDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d17b660d45cedc45e23099e57315ae80282be32 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UltraExpectationDefs.lean @@ -0,0 +1,246 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorBase +import OAI.Analysis.FreeWords.GNSQuotient +import OAI.Analysis.FreeWords.SpectralClip + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace.seqOrder + +attribute [local instance] KKUltraTrace.seqSOR + +open scoped InnerProductSpace + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {B : Type*} [CStarAlgebra B] [PartialOrder B] [StarOrderedRing B] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace._seqOrder + +attribute [local instance] KKUltraTrace._seqSOR + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +noncomputable section + +variable {A B : Type*} [CStarAlgebra A] [CStarAlgebra B] + [PartialOrder A] [StarOrderedRing A] [PartialOrder B] [StarOrderedRing B] + +local instance ultraExpectationDefsPartialOrder : PartialOrder (ℕ →ᵇ A) := + CStarAlgebra.spectralOrder _ + +local instance ultraExpectationDefsStarOrderedRing : StarOrderedRing (ℕ →ᵇ A) := + CStarAlgebra.spectralOrderedRing _ + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace.quotientOrder + +attribute [local instance] KKUltraTrace.quotientLE + +attribute [local instance] KKUltraTrace.quotientPreorder + +attribute [local instance] KKUltraTrace.quotientSOR + +end + +end KKUltraTrace + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +namespace UniversalStrongKK + +section OperatorMean + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +variable (m : ScalarMean G) + +variable [CompleteSpace H] + +end OperatorMean + +end UniversalStrongKK + +open scoped Topology + +namespace UniversalStrongKK + +section UltraMean + +variable {I : Type*} [TopologicalSpace I] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UltraMean + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped InnerProductSpace + +open Filter Topology + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +section OperatorMeanAlgebra + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable (m : ScalarMean G) + +end OperatorMeanAlgebra + +end UniversalStrongKK + +namespace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKTraceTransfer + +namespace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKTraceTransfer + +namespace KKTraceTransfer + +open scoped BoundedContinuousFunction ComplexOrder InnerProductSpace + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +attribute [local instance] KKTraceTransfer.concreteOrder + +attribute [local instance] KKTraceTransfer.concreteSOR + +attribute [local instance] KKTraceTransfer.seqOrder + +attribute [local instance] KKTraceTransfer.seqSOR + +abbrev ultraAlgebra {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (ω : Ultrafilter ℕ) := KKUltraTrace.gnsQuotient (KKUltraTrace.ultraTrace (tracePositive τ) ω) + +def ultraProjection {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) : + (ℕ →ᵇ ConcreteAlgebra M) →⋆ₐ[ℂ] ultraAlgebra τ ω := + (KKUltraTrace.ultraTrace (tracePositive τ) ω).gnsStarAlgHom.codRestrict _ + (fun x => subset_closure ⟨x, rfl⟩) + +def ultraConstant {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) + (a : ConcreteAlgebra M) : ultraAlgebra τ ω := + ultraProjection τ ω (BoundedContinuousFunction.const ℕ a) + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UltraExpectationFull.lean b/lean/OAI/Analysis/FreeWords/UltraExpectationFull.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9566132116e615fdbb933e221f2569e5d1f532c --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UltraExpectationFull.lean @@ -0,0 +1,452 @@ +import Mathlib +import OAI.Analysis.FreeWords.UltraExpectation + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace.seqOrder + +attribute [local instance] KKUltraTrace.seqSOR + +open scoped InnerProductSpace + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {B : Type*} [CStarAlgebra B] [PartialOrder B] [StarOrderedRing B] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace._seqOrder + +attribute [local instance] KKUltraTrace._seqSOR + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +noncomputable section + +variable {A B : Type*} [CStarAlgebra A] [CStarAlgebra B] + [PartialOrder A] [StarOrderedRing A] [PartialOrder B] [StarOrderedRing B] + +local instance ultraExpectationFullBoundedOrder : PartialOrder (ℕ →ᵇ A) := CStarAlgebra.spectralOrder _ + +local instance ultraExpectationFullBoundedSOR : StarOrderedRing (ℕ →ᵇ A) := CStarAlgebra.spectralOrderedRing _ + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace.quotientOrder + +attribute [local instance] KKUltraTrace.quotientLE + +attribute [local instance] KKUltraTrace.quotientPreorder + +attribute [local instance] KKUltraTrace.quotientSOR + +end + +end KKUltraTrace + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +namespace UniversalStrongKK + +section OperatorMean + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +variable (m : ScalarMean G) + +variable [CompleteSpace H] + +end OperatorMean + +end UniversalStrongKK + +open scoped Topology + +namespace UniversalStrongKK + +section UltraMean + +variable {I : Type*} [TopologicalSpace I] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UltraMean + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped InnerProductSpace + +open Filter Topology + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +section OperatorMeanAlgebra + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable (m : ScalarMean G) + +end OperatorMeanAlgebra + +end UniversalStrongKK + +namespace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKTraceTransfer + +namespace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKTraceTransfer + +namespace KKTraceTransfer + +open scoped BoundedContinuousFunction ComplexOrder InnerProductSpace + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +attribute [local instance] KKTraceTransfer.concreteOrder + +attribute [local instance] KKTraceTransfer.concreteLE + +attribute [local instance] KKTraceTransfer.concretePreorder + +attribute [local instance] KKTraceTransfer.concreteSOR + +attribute [local instance] KKTraceTransfer.seqOrder + +attribute [local instance] KKTraceTransfer.seqLE + +attribute [local instance] KKTraceTransfer.seqPreorder + +attribute [local instance] KKTraceTransfer.seqSOR + +end + +end KKTraceTransfer + +namespace KKTraceTransfer + +open scoped BoundedContinuousFunction ComplexOrder InnerProductSpace + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance ultraExpectationFullConcreteOrder (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance ultraExpectationFullConcretePreorder (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance ultraExpectationFullConcreteLE (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance ultraExpectationFullConcreteSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +local instance ultraExpectationFullSeqOrder (M : VonNeumannAlgebra H) : PartialOrder (ℕ →ᵇ ConcreteAlgebra M) := seqOrder M + +local instance ultraExpectationFullSeqPreorder (M : VonNeumannAlgebra H) : Preorder (ℕ →ᵇ ConcreteAlgebra M) := (seqOrder M).toPreorder + +local instance ultraExpectationFullSeqLE (M : VonNeumannAlgebra H) : LE (ℕ →ᵇ ConcreteAlgebra M) := (seqOrder M).toLE + +local instance ultraExpectationFullSeqSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ℕ →ᵇ ConcreteAlgebra M) := seqSOR M + +attribute [local instance] KKTraceTransfer.ultraOrder + +local instance ultraExpectationFullUltraPreorder {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) : + Preorder (ultraAlgebra τ ω) := (ultraOrder τ ω).toPreorder + +local instance ultraExpectationFullUltraLE {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) : + LE (ultraAlgebra τ ω) := (ultraOrder τ ω).toLE + +local instance ultraExpectationFullUltraSOR {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) : + type_of% (ultraExpectationUltraSOR τ ω) := ultraExpectationUltraSOR τ ω + +def linearSurjDescend {A B C : Type*} [AddCommGroup A] [Module ℂ A] + [AddCommGroup B] [Module ℂ B] [AddCommGroup C] [Module ℂ C] + (f : A →ₗ[ℂ] B) (hf : Function.Surjective f) (e : A →ₗ[ℂ] C) + (he : f.ker ≤ e.ker) : B →ₗ[ℂ] C := + (f.ker.liftQ e he).comp (f.quotKerEquivOfSurjective hf).symm.toLinearMap + +theorem linearSurjDescend_apply {A B C : Type*} [AddCommGroup A] [Module ℂ A] + [AddCommGroup B] [Module ℂ B] [AddCommGroup C] [Module ℂ C] + (f : A →ₗ[ℂ] B) (hf : Function.Surjective f) (e : A →ₗ[ℂ] C) + (he : f.ker ≤ e.ker) (a : A) : linearSurjDescend f hf e he (f a) = e a := by + change (f.ker.liftQ e he) ((f.quotKerEquivOfSurjective hf).symm (f a)) = e a + rw [LinearMap.quotKerEquivOfSurjective_symm_apply] + rfl + +theorem linearSurjDescend_starAlgHom_apply {A B C : Type*} + [CStarAlgebra A] [CStarAlgebra B] [AddCommGroup C] [Module ℂ C] + (f : A →⋆ₐ[ℂ] B) (hf : Function.Surjective f) (e : A →ₗ[ℂ] C) + (he : f.toAlgHom.toLinearMap.ker ≤ e.ker) (a : A) : + linearSurjDescend f.toAlgHom.toLinearMap hf e he (f a) = e a := + linearSurjDescend_apply f.toAlgHom.toLinearMap hf e he a + +def linearSurjDescendStarAlgHomWithSpec {A B C : Type*} + [CStarAlgebra A] [CStarAlgebra B] [AddCommGroup C] [Module ℂ C] + (f : A →⋆ₐ[ℂ] B) (hf : Function.Surjective f) (e : A →ₗ[ℂ] C) + (he : f.toAlgHom.toLinearMap.ker ≤ e.ker) : + {g : B →ₗ[ℂ] C // ∀ a, g (f a) = e a} := + ⟨linearSurjDescend f.toAlgHom.toLinearMap hf e he, + linearSurjDescend_starAlgHom_apply f hf e he⟩ + +def ultraExpectationLinearWithSpec {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (ω : Ultrafilter ℕ) : + {g : ultraAlgebra τ ω →ₗ[ℂ] ConcreteAlgebra M // + ∀ x, g (ultraProjection τ ω x) = sequenceMean M ω x} := + linearSurjDescendStarAlgHomWithSpec (ultraProjection τ ω) + (ultraProjection_surjective τ ω) (sequenceMean M ω) (fun x hx => + sequenceMean_zero_of_projection_zero τ ω x hx) + +def ultraExpectationLinear {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (ω : Ultrafilter ℕ) : ultraAlgebra τ ω →ₗ[ℂ] ConcreteAlgebra M := + (ultraExpectationLinearWithSpec τ ω).val + +@[simp] theorem ultraExpectationLinear_projection {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) (x : ℕ →ᵇ ConcreteAlgebra M) : + ultraExpectationLinear τ ω (ultraProjection τ ω x) = sequenceMean M ω x := + (ultraExpectationLinearWithSpec τ ω).property x + +theorem contractive_descend {A B C : Type*} [CStarAlgebra A] [CStarAlgebra B] + [PartialOrder A] [StarOrderedRing A] [PartialOrder B] [StarOrderedRing B] + [NormedAddCommGroup C] [NormedSpace ℂ C] + (f : A →⋆ₐ[ℂ] B) (hf : Function.Surjective f) (e : B →ₗ[ℂ] C) + (he : ∀ a, ‖e (f a)‖ ≤ ‖a‖) (b : B) : ‖e b‖ ≤ ‖b‖ := by + obtain ⟨x, rfl⟩ := hf b + apply le_of_forall_pos_le_add + intro ε hε + obtain ⟨y, hy, hyn⟩ := KKUltraTrace.starHom_controlled_lift f x + (add_pos_of_nonneg_of_pos (norm_nonneg _) hε) (le_add_of_nonneg_right hε.le) + calc + ‖e (f x)‖ = ‖e (f y)‖ := congrArg (fun z => ‖e z‖) hy.symm + _ ≤ ‖y‖ := he y + _ ≤ ‖f x‖ + ε := hyn + +private theorem contractive_descend_cstar {A B C : Type*} + [CStarAlgebra A] [CStarAlgebra B] [NormedAddCommGroup C] [NormedSpace ℂ C] + (f : A →⋆ₐ[ℂ] B) (hf : Function.Surjective f) (e : B →ₗ[ℂ] C) + (he : ∀ a, ‖e (f a)‖ ≤ ‖a‖) (b : B) : ‖e b‖ ≤ ‖b‖ := by + let := CStarAlgebra.spectralOrder A + let := CStarAlgebra.spectralOrderedRing A + let := CStarAlgebra.spectralOrder B + let := CStarAlgebra.spectralOrderedRing B + exact contractive_descend f hf e he b + +theorem ultraExpectationLinear_norm_le {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) (z : ultraAlgebra τ ω) : + ‖ultraExpectationLinear τ ω z‖ ≤ ‖z‖ := + contractive_descend_cstar (ultraProjection τ ω) (ultraProjection_surjective τ ω) + (ultraExpectationLinear τ ω) (fun a => by + rw [ultraExpectationLinear_projection] + exact norm_sequenceMean_le ω a) z + +def ultraExpectation {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (ω : Ultrafilter ℕ) : ultraAlgebra τ ω →L[ℂ] ConcreteAlgebra M := + (ultraExpectationLinear τ ω).mkContinuous 1 (fun z => by + simpa only [one_mul] using ultraExpectationLinear_norm_le τ ω z) + +@[simp] theorem ultraExpectation_projection {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) (x : ℕ →ᵇ ConcreteAlgebra M) : + ultraExpectation τ ω (ultraProjection τ ω x) = sequenceMean M ω x := + ultraExpectationLinear_projection τ ω x + +theorem descend_bimodule {A B C : Type*} [CStarAlgebra A] [CStarAlgebra B] + [CStarAlgebra C] (f : A →⋆ₐ[ℂ] B) (hf : Function.Surjective f) + (k : C → A) (e : B → C) (m : A → C) (he : ∀ x, e (f x) = m x) + (hm : ∀ a b x, m (k a * x * k b) = a * m x * b) : + ∀ a b z, e (f (k a) * z * f (k b)) = a * e z * b := by + intro a b z + obtain ⟨x, rfl⟩ := hf z + rw [← map_mul f, ← map_mul f, he, he] + exact hm a b x + +theorem descend_square {A B C : Type*} [CStarAlgebra A] [CStarAlgebra B] + (f : A →⋆ₐ[ℂ] B) (hf : Function.Surjective f) + (e : B → C) (m : A → C) (he : ∀ x, e (f x) = m x) + (p : C → Prop) (hm : ∀ x, p (m (star x * x))) : ∀ z, p (e (star z * z)) := by + intro z + obtain ⟨x, rfl⟩ := hf z + rw [← map_star f, ← map_mul f, he] + exact hm x + +theorem ultraExpectation_bimodule {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) : + ∀ a b x, ultraExpectation τ ω (ultraConstant τ ω a * x * ultraConstant τ ω b) = + a * ultraExpectation τ ω x * b := + descend_bimodule (ultraProjection τ ω) (ultraProjection_surjective τ ω) + (BoundedContinuousFunction.const ℕ) (ultraExpectation τ ω) (sequenceMean M ω) + (ultraExpectation_projection τ ω) (sequenceMean_bimodule ω) + +theorem ultraExpectation_square {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) : + ∀ x, ((ultraExpectation τ ω (star x * x) : ConcreteAlgebra M) : H →L[ℂ] H).IsPositive := by + refine descend_square (ultraProjection τ ω) (ultraProjection_surjective τ ω) + (ultraExpectation τ ω) (sequenceMean M ω) (ultraExpectation_projection τ ω) + (fun z : ConcreteAlgebra M => (z : H →L[ℂ] H).IsPositive) ?_ + intro s + apply UniversalStrongKK.positive_of_wot_tendsto (tendsto_sequenceMean ω (star s*s)) + exact Filter.Eventually.of_forall fun j => + ContinuousLinearMap.isPositive_adjoint_comp_self (s j : H →L[ℂ] H) + +theorem descend_trace {A B C D : Type*} (f : A → B) (hf : Function.Surjective f) + (e : B → C) (m : A → C) (he : ∀ x, e (f x) = m x) + (t : C → D) (r : B → D) (q : A → D) + (hm : ∀ x, t (m x) = q x) (hr : ∀ x, r (f x) = q x) : + ∀ z, t (e z) = r z := by + intro z + obtain ⟨x, rfl⟩ := hf z + rw [he, hm, hr] + +theorem ultraQuotientState_projection {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) (s : ℕ →ᵇ ConcreteAlgebra M) : + KKUltraTrace.gnsQuotientState (KKUltraTrace.ultraTrace (tracePositive τ) ω) + (ultraProjection τ ω s) = KKUltraTrace.ultraTrace (tracePositive τ) ω s := + KKUltraTrace.gnsExpectation_image (KKUltraTrace.ultraTrace (tracePositive τ) ω) s + +theorem ultraExpectation_trace {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (ω : Ultrafilter ℕ) : + ∀ x, τ.map (ultraExpectation τ ω x) = KKUltraTrace.gnsQuotientState + (KKUltraTrace.ultraTrace (tracePositive τ) ω) x := + descend_trace (ultraProjection τ ω) (ultraProjection_surjective τ ω) + (ultraExpectation τ ω) (sequenceMean M ω) (ultraExpectation_projection τ ω) + τ.map (KKUltraTrace.gnsQuotientState (KKUltraTrace.ultraTrace (tracePositive τ) ω)) + (KKUltraTrace.ultraTrace (tracePositive τ) ω) + (trace_sequenceMean τ ω) (ultraQuotientState_projection τ ω) + +theorem ultra_expectation_exists {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + (ω : Ultrafilter ℕ) : + ∃ E : ultraAlgebra τ ω →L[ℂ] ConcreteAlgebra M, + (∀ x, ‖E x‖ ≤ ‖x‖) ∧ + (∀ a, E (ultraConstant τ ω a) = a) ∧ + (∀ a b x, E (ultraConstant τ ω a * x * ultraConstant τ ω b) = a * E x * b) ∧ + (∀ x, ((E (star x * x) : ConcreteAlgebra M) : H →L[ℂ] H).IsPositive) ∧ + (∀ x, τ.map (E x) = KKUltraTrace.gnsQuotientState + (KKUltraTrace.ultraTrace (tracePositive τ) ω) x) ∧ + (∀ x : ℕ →ᵇ ConcreteAlgebra M, + Filter.Tendsto (fun j => ContinuousLinearMapWOT.ofCLM (x j : H →L[ℂ] H)) + (ω : Filter ℕ) (nhds (ContinuousLinearMapWOT.ofCLM + (E (ultraProjection τ ω x) : H →L[ℂ] H)))) := by + refine ⟨ultraExpectation τ ω, ultraExpectationLinear_norm_le τ ω, ?_, + ultraExpectation_bimodule τ ω, ultraExpectation_square τ ω, ultraExpectation_trace τ ω, ?_⟩ + · intro a + exact (ultraExpectation_projection τ ω _).trans (sequenceMean_const ω a) + · intro x + rw [ultraExpectation_projection] + exact tendsto_sequenceMean ω x + +end + +end KKTraceTransfer +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UltraFactorStructure.lean b/lean/OAI/Analysis/FreeWords/UltraFactorStructure.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d8f9243065263c3ee22cae3d3d3b8c7a0014b4e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UltraFactorStructure.lean @@ -0,0 +1,150 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorVarianceStructure +import OAI.Analysis.FreeWords.UltraExpectation +import OAI.Analysis.FreeWords.UnitaryLift + +namespace OAI + +noncomputable section + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +local instance ultraFactorStructureBoundedOrder : PartialOrder (ℕ →ᵇ A) := CStarAlgebra.spectralOrder _ + +local instance ultraFactorStructureBoundedSOR : StarOrderedRing (ℕ →ᵇ A) := CStarAlgebra.spectralOrderedRing _ + +theorem gnsUltra_center_scalar_of_witness (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y) = τ (y*x)) + (hw : ∀ x : A, ∃ u : unitary A, + ‖gnsVector τ (x - τ x • 1)‖ ≤ 2*‖gnsVector τ (x*(u:A)-(u:A)*x)‖) + (ω : Ultrafilter ℕ) (x : ℕ →ᵇ A) + (hx : ∀ y : ℕ →ᵇ A, + Commute ((ultraTrace τ ω).gnsStarAlgHom x) ((ultraTrace τ ω).gnsStarAlgHom y)) : + (ultraTrace τ ω).gnsStarAlgHom x = (ultraTrace τ ω x) • 1 := by + choose u hu using (fun j => hw (x j)) + let y : ℕ →ᵇ A := BoundedContinuousFunction.ofNormedAddCommGroup + (fun j => (u j : A)) continuous_of_discreteTopology ‖(1 : A)‖ + (fun j => by simpa only [mul_one] using (CStarRing.norm_coe_unitary_mul (u j) (1 : A)).le) + let w := x*y-y*x + have hzero : (ultraTrace τ ω).gnsStarAlgHom w = 0 := by + dsimp [w] + rw [map_sub, map_mul, map_mul, (hx y).eq, sub_self] + have hwτ := (tracial_gns_zero _ (ultraTrace_tracial τ ω htr) w).mp hzero + have hwlim : Tendsto (fun j => ‖gnsVector τ (w j)‖) (ω : Filter ℕ) (𝓝 0) := by + simpa only [hwτ, Complex.zero_re, Real.sqrt_zero] using tendsto_gnsVector_norm τ ω w + let c := ultraTrace τ ω x + let v : ℕ →ᵇ A := x - c • 1 + have hbound (j : ℕ) : ‖gnsVector τ (v j)‖ ≤ + 2*‖gnsVector τ (w j)‖ + ‖τ (x j)-c‖ * ‖gnsVector τ 1‖ := by + have hid : v j = (x j - τ (x j) • 1) + (τ (x j)-c) • 1 := by + change x j - c • 1 = _ + rw [sub_smul] + abel + rw [hid, map_add] + apply (norm_add_le _ _).trans + rw [map_smul, norm_smul] + exact add_le_add (hu j) le_rfl + have hlim : Tendsto (fun j => ‖gnsVector τ (v j)‖) (ω : Filter ℕ) (𝓝 0) := by + have hc : Tendsto (fun j => ‖τ (x j)-c‖) (ω : Filter ℕ) (𝓝 0) := by + have ht : Tendsto (fun j => τ (x j)) (ω : Filter ℕ) (𝓝 c) := + tendsto_ultraTraceValue τ ω x + simpa only [sub_self, norm_zero] using (ht.sub_const c).norm + have hr : Tendsto (fun j => 2*‖gnsVector τ (w j)‖ + ‖τ (x j)-c‖ * ‖gnsVector τ 1‖) + (ω : Filter ℕ) (𝓝 0) := by + simpa only [mul_zero, zero_mul, zero_add] using + (hwlim.const_mul 2).add (hc.mul_const ‖gnsVector τ 1‖) + exact squeeze_zero (fun j => norm_nonneg _) hbound hr + have hv := gnsStarAlgHom_zero_of_gnsNorm_tendsto_zero τ htr ω v hlim + change (ultraTrace τ ω).gnsStarAlgHom (x-c•1) = 0 at hv + rw [map_sub, map_smul, map_one, sub_eq_zero] at hv + exact hv + +end + +end KKFactorSupport + +namespace KKFactorSupport + +section + +variable {A B C : Type*} [Ring A] [Ring B] [Ring C] + [StarRing A] [StarRing B] [StarRing C] + [Algebra ℂ A] [Algebra ℂ B] [Algebra ℂ C] + +theorem center_scalar_descend (f : A →⋆ₐ[ℂ] B) (g : B →⋆ₐ[ℂ] C) + (hf : Function.Surjective f) (hg : Function.Injective g) + (h : ∀ a : A, (∀ b : A, Commute (g (f a)) (g (f b))) → + ∃ c : ℂ, g (f a) = c • 1) + (x : B) (hx : ∀ y : B, Commute x y) : ∃ c : ℂ, x = c • 1 := by + obtain ⟨a, ha⟩ := hf x + have hh : ∀ b, Commute (g (f a)) (g (f b)) := by + intro b + rw [ha] + exact (hx (f b)).map g + obtain ⟨c, hc⟩ := h a hh + refine ⟨c, hg ?_⟩ + simpa only [ha, map_smul, map_one] using hc + +end + +end KKFactorSupport + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace BoundedContinuousFunction + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance ultraFactorStructureConcreteOrder (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance ultraFactorStructureConcretePreorder (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance ultraFactorStructureConcreteLE (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance ultraFactorStructureConcreteSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +local instance ultraFactorStructureSeqOrder (M : VonNeumannAlgebra H) : PartialOrder (ℕ →ᵇ ConcreteAlgebra M) := seqOrder M + +local instance ultraFactorStructureSeqPreorder (M : VonNeumannAlgebra H) : Preorder (ℕ →ᵇ ConcreteAlgebra M) := (seqOrder M).toPreorder + +local instance ultraFactorStructureSeqLE (M : VonNeumannAlgebra H) : LE (ℕ →ᵇ ConcreteAlgebra M) := (seqOrder M).toLE + +local instance ultraFactorStructureSeqSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ℕ →ᵇ ConcreteAlgebra M) := seqSOR M + +theorem ultraAlgebra_center_scalar {M : VonNeumannAlgebra H} + (τ : FaithfulNormalTrace M) (hM : KKFreeLiftFrontier.IsFactor M) (ω : Ultrafilter ℕ) + (x : ultraAlgebra τ ω) (hx : ∀ y : ultraAlgebra τ ω, Commute x y) : + ∃ c : ℂ, x = c • 1 := by + apply center_scalar_descend (ultraProjection τ ω) + (gnsQuotient (ultraTrace (tracePositive τ) ω)).subtype + (ultraProjection_surjective τ ω) Subtype.val_injective _ x hx + intro s hs + have hw : ∀ a : ConcreteAlgebra M, ∃ u : unitary (ConcreteAlgebra M), + ‖gnsVector (tracePositive τ) (a - (tracePositive τ) a • 1)‖ ≤ + 2 * ‖gnsVector (tracePositive τ) (a * (u : ConcreteAlgebra M) - (u : ConcreteAlgebra M) * a)‖ := by + intro a + exact factor_commutator_witness τ hM a + exact ⟨ultraTrace (tracePositive τ) ω s, + gnsUltra_center_scalar_of_witness (tracePositive τ) + (tracePositive_tracial τ) hw ω s hs⟩ + +end + +end KKFactorSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UltraQuotientRange.lean b/lean/OAI/Analysis/FreeWords/UltraQuotientRange.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba6a7cdbfdaf573128724cfc821c6d535281483e --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UltraQuotientRange.lean @@ -0,0 +1,147 @@ +import Mathlib +import OAI.Analysis.FreeWords.SpectralClip + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace.seqOrder + +attribute [local instance] KKUltraTrace.seqSOR + +open scoped InnerProductSpace + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable {B : Type*} [CStarAlgebra B] [PartialOrder B] [StarOrderedRing B] + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +attribute [local instance] KKUltraTrace._seqOrder + +attribute [local instance] KKUltraTrace._seqSOR + +end + +end KKUltraTrace + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +noncomputable section + +variable {A B : Type*} [CStarAlgebra A] [CStarAlgebra B] + [PartialOrder A] [StarOrderedRing A] [PartialOrder B] [StarOrderedRing B] + +theorem starHom_controlled_lift (φ : A →⋆ₐ[ℂ] B) (x : A) {b : ℝ} + (hb : 0 < b) (hx : ‖φ x‖ ≤ b) : + ∃ y : A, φ y = φ x ∧ ‖y‖ ≤ b := by + refine ⟨spectralClip b x, ?_, norm_spectralClip_le hb x⟩ + rw [map_spectralClip φ hb, spectralClip_eq_self hb _ hx] + +theorem starHom_image_closed (φ : A →⋆ₐ[ℂ] B) : IsClosed (Set.range φ) := by + let f : A →L[ℂ] B := ⟨φ.toAlgHom.toLinearMap, by change Continuous φ; fun_prop⟩ + let K : Submodule ℂ A := f.ker + let : IsClosed (K : Set A) := f.isClosed_ker + let q : A ⧸ K →L[ℂ] B := K.liftQL f le_rfl + have hbound : ∀ a : A ⧸ K, ‖a‖ ≤ ‖q a‖ := by + intro a + induction a using Submodule.Quotient.induction_on K with + | H x => + change ‖(Submodule.Quotient.mk x : A ⧸ K)‖ ≤ ‖φ x‖ + apply le_of_forall_pos_le_add + intro ε hε + have hb : 0 < ‖φ x‖ + ε := add_pos_of_nonneg_of_pos (norm_nonneg _) hε + obtain ⟨y, hy, hyn⟩ := starHom_controlled_lift φ x hb (le_add_of_nonneg_right hε.le) + have heq : (Submodule.Quotient.mk x : A ⧸ K) = Submodule.Quotient.mk y := by + apply (Submodule.Quotient.eq K).mpr + change φ (x - y) = 0 + rw [map_sub, hy, sub_self] + rw [heq] + exact (Submodule.Quotient.norm_mk_le K y).trans hyn + have hanti : AntilipschitzWith 1 q := + q.antilipschitz_of_bound (by simpa only [NNReal.coe_one, one_mul] using hbound) + have heq : Set.range q = Set.range φ := by + ext b + constructor + · rintro ⟨a, rfl⟩ + induction a using Submodule.Quotient.induction_on K with + | H x => exact ⟨x, rfl⟩ + · rintro ⟨x, rfl⟩ + exact ⟨Submodule.Quotient.mk x, rfl⟩ + rw [← heq] + exact hanti.isClosed_range q.uniformContinuous + +local instance : PartialOrder (ℕ →ᵇ A) := CStarAlgebra.spectralOrder _ + +local instance : StarOrderedRing (ℕ →ᵇ A) := CStarAlgebra.spectralOrderedRing _ + +theorem ultra_gns_image_closed (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) : + IsClosed (Set.range (ultraTrace τ ω).gnsStarAlgHom) := by + exact starHom_image_closed _ + +end + +end KKUltraTrace +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UltraTrace.lean b/lean/OAI/Analysis/FreeWords/UltraTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..83b535e5ad0fe1970f8913ddde46dba86e8069ad --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UltraTrace.lean @@ -0,0 +1,150 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKUltraTrace + +open scoped ComplexOrder BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +@[instance_reducible] def seqOrder : PartialOrder (ℕ →ᵇ A) := CStarAlgebra.spectralOrder _ + +attribute [local instance] KKUltraTrace.seqOrder + +omit [PartialOrder A] [StarOrderedRing A] in +theorem seqSOR : StarOrderedRing (ℕ →ᵇ A) := CStarAlgebra.spectralOrderedRing _ + +attribute [local instance] KKUltraTrace.seqSOR + +def ultraTraceValue (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) (x : ℕ →ᵇ A) : ℂ := + Filter.limUnder (ω : Filter ℕ) (fun j => τ (x j)) + +theorem tendsto_ultraTraceValue (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) (x : ℕ →ᵇ A) : + Tendsto (fun j => τ (x j)) (ω : Filter ℕ) (𝓝 (ultraTraceValue τ ω x)) := by + obtain ⟨C, hC⟩ := τ.exists_norm_apply_le + have hb : ∀ j, τ (x j) ∈ Metric.closedBall (0 : ℂ) (C * ‖x‖) := by + intro j + simp only [Metric.mem_closedBall, dist_zero_right] + exact (hC _).trans (mul_le_mul_of_nonneg_left (x.norm_coe_le_norm j) C.coe_nonneg) + obtain ⟨z, hz, hlim⟩ := (isCompact_closedBall (0 : ℂ) (C * ‖x‖)).ultrafilter_le_nhds' + (ω.map fun j => τ (x j)) (show Metric.closedBall (0 : ℂ) (C * ‖x‖) ∈ + ω.map (fun j => τ (x j)) from Ultrafilter.mem_map.mpr (Filter.Eventually.of_forall hb)) + exact tendsto_nhds_limUnder ⟨z, hlim⟩ + +theorem ultraTraceValue_add (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) (x y : ℕ →ᵇ A) : + ultraTraceValue τ ω (x + y) = ultraTraceValue τ ω x + ultraTraceValue τ ω y := by + exact (show Tendsto (fun j => τ ((x + y) j)) (ω : Filter ℕ) + (𝓝 (ultraTraceValue τ ω x + ultraTraceValue τ ω y)) by + simpa using (tendsto_ultraTraceValue τ ω x).add (tendsto_ultraTraceValue τ ω y)).limUnder_eq + +theorem ultraTraceValue_smul (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) (c : ℂ) (x : ℕ →ᵇ A) : + ultraTraceValue τ ω (c • x) = c • ultraTraceValue τ ω x := by + exact (show Tendsto (fun j => τ ((c • x) j)) (ω : Filter ℕ) + (𝓝 (c • ultraTraceValue τ ω x)) by + simpa using (tendsto_ultraTraceValue τ ω x).const_smul c).limUnder_eq + +theorem ultraTraceValue_mono (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) : + Monotone (ultraTraceValue τ ω) := by + intro x y hxy + have heval : ∀ j, x j ≤ y j := by + obtain ⟨v, hv⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp (sub_nonneg.mpr hxy) + intro j + have hj := congrArg (fun z : ℕ →ᵇ A => z j) hv + have hj' : y j - x j = star (v j) * v j := hj + exact sub_nonneg.mp (hj'.symm ▸ star_mul_self_nonneg (v j)) + exact le_of_tendsto_of_tendsto (tendsto_ultraTraceValue τ ω x) + (tendsto_ultraTraceValue τ ω y) (Eventually.of_forall fun j => OrderHomClass.mono τ (heval j)) + +def ultraTrace (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) : (ℕ →ᵇ A) →ₚ[ℂ] ℂ where + toFun := ultraTraceValue τ ω + map_add' := ultraTraceValue_add τ ω + map_smul' := ultraTraceValue_smul τ ω + monotone' := ultraTraceValue_mono τ ω + +@[simp] theorem ultraTrace_one (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) (h1 : τ 1 = 1) : + ultraTrace τ ω 1 = 1 := by + change Filter.limUnder (ω : Filter ℕ) (fun j => τ ((1 : ℕ →ᵇ A) j)) = 1 + exact (show Tendsto (fun j => τ ((1 : ℕ →ᵇ A) j)) (ω : Filter ℕ) (𝓝 1) by + simp [h1]).limUnder_eq + +theorem ultraTrace_tracial (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) + (htr : ∀ x y : A, τ (x * y) = τ (y * x)) (x y : ℕ →ᵇ A) : + ultraTrace τ ω (x * y) = ultraTrace τ ω (y * x) := by + change Filter.limUnder (ω : Filter ℕ) (fun j => τ (x j * y j)) = + Filter.limUnder (ω : Filter ℕ) (fun j => τ (y j * x j)) + congr 1 + funext j + exact htr _ _ + +open scoped InnerProductSpace + +def gnsVector (τ : A →ₚ[ℂ] ℂ) : A →ₗ[ℂ] τ.GNS := + UniformSpace.Completion.toComplL.toLinearMap ∘ₗ τ.toPreGNS.toLinearMap + +@[simp] theorem gnsVector_inner (τ : A →ₚ[ℂ] ℂ) (x y : A) : + ⟪gnsVector τ x, gnsVector τ y⟫_ℂ = τ (star x * y) := by + change ⟪(τ.toPreGNS x : τ.GNS), (τ.toPreGNS y : τ.GNS)⟫_ℂ = _ + rw [UniformSpace.Completion.inner_coe, PositiveLinearMap.preGNS_inner_def] + rfl + +@[simp] theorem gnsStarAlgHom_vector (τ : A →ₚ[ℂ] ℂ) (x y : A) : + τ.gnsStarAlgHom x (gnsVector τ y) = gnsVector τ (x * y) := by + change τ.gnsNonUnitalStarAlgHom x (τ.toPreGNS y : τ.GNS) = + (τ.toPreGNS (x * y) : τ.GNS) + simp + +theorem tracial_gns_zero (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y : A, τ (x * y) = τ (y * x)) (x : A) : + τ.gnsStarAlgHom x = 0 ↔ τ (star x * x) = 0 := by + constructor + · intro hx + have hv : gnsVector τ x = 0 := by + have he := congrArg (fun T : τ.GNS →L[ℂ] τ.GNS => T (gnsVector τ 1)) hx + simpa only [gnsStarAlgHom_vector, mul_one, zero_apply] using he + rw [← gnsVector_inner, hv, inner_zero_left] + · intro hx + have hvec : ∀ b : A, gnsVector τ (x * b) = 0 := by + intro b + apply (inner_self_eq_zero (𝕜 := ℂ)).mp + rw [gnsVector_inner] + apply le_antisymm _ (τ.map_nonneg (star_mul_self_nonneg _)) + calc + τ (star (x * b) * (x * b)) = τ (x * (b * star b) * star x) := by + rw [htr (star (x * b)) (x * b), star_mul] + congr 1 + noncomm_ring + _ ≤ τ (‖b * star b‖ • (x * star x)) := + OrderHomClass.mono τ (CStarAlgebra.star_right_conjugate_le_norm_smul x (b * star b)) + _ = 0 := by simp [← Complex.coe_smul, htr x (star x), hx] + ext ξ + induction ξ using UniformSpace.Completion.induction_on with + | hp => exact isClosed_eq (τ.gnsStarAlgHom x).continuous continuous_const + | ih b => + change τ.gnsStarAlgHom x (gnsVector τ (τ.ofPreGNS b)) = 0 + rw [gnsStarAlgHom_vector] + exact hvec _ + +theorem ultraTrace_exists (τ : A →ₚ[ℂ] ℂ) (h1 : τ 1 = 1) + (htr : ∀ x y : A, τ (x * y) = τ (y * x)) (ω : Ultrafilter ℕ) : + ∃ T : (ℕ →ᵇ A) →ₚ[ℂ] ℂ, + (∀ x, T x = ultraTraceValue τ ω x) ∧ + (∀ x, Filter.Tendsto (fun j => τ (x j)) (ω : Filter ℕ) (nhds (T x))) ∧ + T 1 = 1 ∧ (∀ x y, T (x * y) = T (y * x)) ∧ + (∀ x, T.gnsStarAlgHom x = 0 ↔ T (star x * x) = 0) := by + refine ⟨ultraTrace τ ω, fun _ => rfl, tendsto_ultraTraceValue τ ω, + ultraTrace_one τ ω h1, ultraTrace_tracial τ ω htr, ?_⟩ + exact tracial_gns_zero _ (ultraTrace_tracial τ ω htr) + +end + +end KKUltraTrace +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UnitaryExtension.lean b/lean/OAI/Analysis/FreeWords/UnitaryExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..724d100ff9da5b49d9936a0875743a1654fd2a30 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UnitaryExtension.lean @@ -0,0 +1,106 @@ +import Mathlib +import OAI.Analysis.FreeWords.ProjectionStructure + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] + +theorem partial_of_initial_projection {v : A} (hp : IsStarProjection (star v*v)) : Partial v := by + let p := star v*v + have hp2 : p*p=p := hp.isIdempotentElem.eq + have hsp : star p=p := hp.isSelfAdjoint.star_eq + have hz : star (v*p-v)*(v*p-v)=0 := by + calc + star (v*p-v)*(v*p-v) = p*p*p-p*p-p*p+p := by + simp only [star_sub, star_mul, hsp, p] + noncomm_ring + _ = 0 := by simp only [hp2, sub_self, zero_sub, neg_add_cancel] + have he := (CStarRing.star_mul_self_eq_zero_iff _).mp hz + simpa only [Partial, sub_eq_zero, p, mul_assoc] using he + +theorem polar_initial_support {v S a : A} (hv : Partial v) (hS : IsSelfAdjoint S) + (hva : v*S=a) (hSS : S*S=star a*a) : (star v*v)*S=S := by + let p := star v*v + have hp := partial_initial hv + have hep := projection_sub (IsStarProjection.one A) hp (mul_one _) + have he2 : (1-p)*(1-p)=1-p := hep.isIdempotentElem.eq + have hsp : star p=p := hp.isSelfAdjoint.star_eq + have hSpS : S*p*S=S*S := by + calc + S*p*S=star (v*S)*(v*S) := by rw [star_mul,hS.star_eq]; simp only [p,mul_assoc] + _=star a*a := by rw [hva] + _=S*S := hSS.symm + have hz : star ((1-p)*S)*((1-p)*S)=0 := by + calc + star ((1-p)*S)*((1-p)*S)=S*((1-p)*(1-p))*S := by + simp only [star_mul,star_sub,star_one,hS.star_eq,hsp,mul_assoc] + _=S*(1-p)*S := by rw [he2] + _=S*S-S*p*S := by noncomm_ring + _=0 := by rw [hSpS,sub_self] + have he := (CStarRing.star_mul_self_eq_zero_iff _).mp hz + rw [sub_mul,one_mul] at he + exact (sub_eq_zero.mp he).symm + +end + +end KKProjectionSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKFreeLiftFrontier + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem partial_unitary_extension (M : VonNeumannAlgebra H) + (τ : FaithfulNormalTrace M) (hM : IsFactor M) (v : ConcreteAlgebra M) (hv : Partial v) : + ∃ u : unitary (ConcreteAlgebra M), (u : ConcreteAlgebra M)*(star v*v)=v := by + have hp := partial_initial hv + have hq := partial_final hv + have hpc := projection_sub (IsStarProjection.one _) hp (mul_one _) + have hqc := projection_sub (IsStarProjection.one _) hq (mul_one _) + have hτ : τ.map (1-star v*v)=τ.map (1-v*star v) := by rw [map_sub,map_sub,τ.tracial] + obtain ⟨w,hwp,hqw⟩ := projection_equivalent_of_trace M τ hM _ _ hpc hqc hτ + have hw : Partial w := partial_of_initial_projection (hwp.symm ▸ hpc) + have hwpc : w*(1-star v*v)=w := by rw [← hwp,←mul_assoc]; exact hw + have hqcw : (1-v*star v)*w=w := by rw [← hqw]; exact hw + have hc := orthogonal_of_residual hv (IsStarProjection.one _) (IsStarProjection.one _) + (mul_one _) (one_mul _) hwpc hqcw + have hcw : star w*v=0 := by simpa only [star_mul,star_star,star_zero] using congrArg star hc.1 + have hcs : w*star v=0 := by simpa only [star_mul,star_star,star_zero] using congrArg star hc.2 + have hunit : v+w ∈ unitary (ConcreteAlgebra M) := by + rw [Unitary.mem_iff] + constructor + · rw [star_add,add_mul,mul_add,mul_add,hc.1,hcw,add_zero,zero_add,hwp] + abel + · rw [star_add,mul_add,add_mul,add_mul,hc.2,hcs,add_zero,zero_add,hqw] + abel + refine ⟨⟨v+w,hunit⟩,?_⟩ + change (v+w)*(star v*v)=v + rw [add_mul,←mul_assoc,←mul_assoc,hv,hcs,zero_mul,add_zero] + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UnitaryFiniteSpectrum.lean b/lean/OAI/Analysis/FreeWords/UnitaryFiniteSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..f4e3e9ae9c9ae0f89b41fd96e81dfb70ae289f39 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UnitaryFiniteSpectrum.lean @@ -0,0 +1,142 @@ +import Mathlib +import OAI.Analysis.FreeWords.NormalFiniteSpectrum +import OAI.Analysis.FreeWords.PartitionHom + +namespace OAI + +noncomputable section + +namespace KKProjectionSupport + +noncomputable section + +open scoped BigOperators + +variable {ι A : Type*} [Fintype ι] [DecidableEq ι] [Ring A] [Algebra ℂ A] + +variable [StarRing A] [StarModule ℂ A] + +end + +end KKProjectionSupport + +namespace KKSpectralSupport + +open KKTraceTransfer KKProjectionSupport + +noncomputable section + +def complexPhase (z : ℂ) : ℂ := if z=0 then 1 else (‖z‖:ℂ)⁻¹*z + +theorem complexPhase_norm (z : ℂ) : ‖complexPhase z‖=1 := by + by_cases hz : z=0 + · simp [complexPhase,hz] + · rw [complexPhase,ite_eq_right hz,norm_mul,norm_inv,Complex.norm_real,Real.norm_eq_abs, + abs_of_nonneg (norm_nonneg _),inv_mul_cancel₀ (norm_ne_zero_iff.mpr hz)] + +theorem complexPhase_dist (z : ℂ) : ‖z-complexPhase z‖=|‖z‖-1| := by + by_cases hz : z=0 + · simp [complexPhase,hz] + · have hzn : ‖z‖≠0 := norm_ne_zero_iff.mpr hz + have he : z-complexPhase z=((‖z‖-1:ℝ):ℂ)*complexPhase z := by + rw [complexPhase,ite_eq_right hz] + push_cast + field_simp [Complex.ofReal_ne_zero.mpr hzn] + rw [he,norm_mul,complexPhase_norm,mul_one,Complex.norm_real,Real.norm_eq_abs] + +theorem projection_norm_one {A : Type*} [CStarAlgebra A] {p : A} + (hp : IsStarProjection p) (hp0 : p≠0) : ‖p‖=1 := by + have h := CStarRing.norm_star_mul_self (x := p) + rw [hp.isSelfAdjoint.star_eq,hp.isIdempotentElem.eq] at h + have hpos := norm_pos_iff.mpr hp0 + nlinarith + +theorem partition_weight_mul {ι A : Type*} [Fintype ι] [DecidableEq ι] + [CStarAlgebra A] (p : ι → A) (hp : ∀ i, IsStarProjection (p i)) + (hort : ∀ i j, i≠j → p i*p j=0) (c : ι → ℂ) (j : ι) : + (∑ i, c i • p i)*p j=c j • p j := by + rw [Finset.sum_mul] + rw [Finset.sum_eq_single j] + · rw [smul_mul_assoc,(hp j).isIdempotentElem.eq] + · intro i hi hij; rw [smul_mul_assoc,hort i j hij,smul_zero] + · simp + +theorem phase_partition_unitary {ι A : Type*} [Fintype ι] [DecidableEq ι] + [CStarAlgebra A] (p : ι → A) (hp : ∀ i, IsStarProjection (p i)) + (hort : ∀ i j, i≠j → p i*p j=0) (h1 : ∑ i, p i=1) + (c : ι → ℂ) (hc : ∀ i, ‖c i‖=1) : ∑ i, c i • p i ∈ unitary A := by + change partitionHom p hp hort h1 c ∈ unitary A + apply Unitary.map_mem (partitionHom p hp hort h1) + rw [Unitary.mem_iff] + constructor <;> ext i + · change star (c i)*c i=1 + rw [Complex.star_def,← Complex.normSq_eq_conj_mul_self,Complex.normSq_eq_norm_sq,hc] + norm_num + · change c i*star (c i)=1 + rw [Complex.star_def,Complex.mul_conj,Complex.normSq_eq_norm_sq,hc] + norm_num + +theorem partition_phase_error {ι A : Type*} [Fintype ι] [DecidableEq ι] + [CStarAlgebra A] (p : ι → A) (hp : ∀ i, IsStarProjection (p i)) + (hort : ∀ i j, i≠j → p i*p j=0) (h1 : ∑ i, p i=1) + (c : ι → ℂ) (u : unitary A) : + ‖(∑ i, c i • p i)-(∑ i, complexPhase (c i) • p i)‖ ≤ + ‖u.val-∑ i, c i • p i‖ := by + classical + let D := ‖u.val-∑ i, c i • p i‖ + have hbound (i : ι) (hi : p i≠0) : ‖c i-complexPhase (c i)‖ ≤ D := by + rw [complexPhase_dist] + have hp1 := projection_norm_one (hp i) hi + have hnorm := abs_norm_sub_norm_le ((c i) • p i) (u.val*p i) + rw [norm_smul,hp1,mul_one,CStarRing.norm_coe_unitary_mul,hp1] at hnorm + refine hnorm.trans ?_ + rw [norm_sub_rev] + have he : u.val*p i-c i • p i=(u.val-∑ j, c j • p j)*p i := by + rw [sub_mul,partition_weight_mul p hp hort] + rw [he] + exact (norm_mul_le _ _).trans (by rw [hp1,mul_one]) + let d : ι → ℂ := fun i => if p i=0 then 0 else c i-complexPhase (c i) + have he : (∑ i, c i • p i)-(∑ i, complexPhase (c i) • p i)=partitionHom p hp hort h1 d := by + rw [← Finset.sum_sub_distrib,partitionHom_apply] + apply Finset.sum_congr rfl + intro i hi + dsimp only [d] + split_ifs with hz + · simp [hz] + · rw [sub_smul] + rw [he] + refine (NonUnitalStarAlgHom.norm_apply_le (partitionHom p hp hort h1) d).trans ?_ + apply (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr + intro i + dsimp only [d] + split_ifs with hz + · rw [norm_zero]; exact norm_nonneg _ + · exact hbound i hz + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem unitary_finite_spectrum_approximation (M : VonNeumannAlgebra H) + (u : unitary (ConcreteAlgebra M)) (ε : ℝ) (hε : 0 < ε) : + ∃ (m n : ℕ) (p : Fin m × Fin n → ConcreteAlgebra M) + (c : Fin m × Fin n → ℂ), + (∀ i, IsStarProjection (p i)) ∧ (∀ i j, i≠j → p i*p j=0) ∧ + (∑ i, p i=1) ∧ (∀ i, ‖c i‖=1) ∧ ‖u.val-∑ i, c i • p i‖ < ε := by + classical + have hun : IsStarNormal u.val := ⟨by + change star u.val*u.val=u.val*star u.val + rw [Unitary.star_mul_self_of_mem u.property,Unitary.mul_star_self_of_mem u.property]⟩ + obtain ⟨m,n,p,c,hp,ho,h1,hc,he⟩ := normal_finite_spectrum_approximation M u.val hun + (ε/2) (half_pos hε) + refine ⟨m,n,p,fun i => complexPhase (c i),hp,ho,h1,fun i => complexPhase_norm (c i),?_⟩ + have hb := partition_phase_error p hp ho h1 c u + have ht := norm_add_le (u.val-(∑ i, c i • p i)) + ((∑ i, c i • p i)-(∑ i, complexPhase (c i) • p i)) + rw [sub_add_sub_cancel] at ht + linarith + +end + +end KKSpectralSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UnitaryLift.lean b/lean/OAI/Analysis/FreeWords/UnitaryLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..84b6db17018ab224ba6dd844d92045bdc5185d9a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UnitaryLift.lean @@ -0,0 +1,130 @@ +import Mathlib +import OAI.Analysis.FreeWords.PolarApproximation + +namespace OAI + +noncomputable section + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +theorem gnsVector_norm_eq_sqrt (τ : A →ₚ[ℂ] ℂ) (x : A) : + ‖gnsVector τ x‖ = Real.sqrt (τ (star x * x)).re := by + rw [@norm_eq_sqrt_re_inner ℂ, gnsVector_inner] + rfl + +local instance unitaryLiftSequenceOrder : PartialOrder (ℕ →ᵇ A) := CStarAlgebra.spectralOrder _ + +local instance unitaryLiftSequenceSOR : StarOrderedRing (ℕ →ᵇ A) := CStarAlgebra.spectralOrderedRing _ + +@[simp] theorem ultraTrace_apply_value (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) (x : ℕ →ᵇ A) : + ultraTrace τ ω x = ultraTraceValue τ ω x := rfl + +theorem tendsto_gnsVector_norm (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) (x : ℕ →ᵇ A) : + Tendsto (fun j => ‖gnsVector τ (x j)‖) (ω : Filter ℕ) + (𝓝 (Real.sqrt ((ultraTrace τ ω) (star x * x)).re)) := by + have ht := Real.continuous_sqrt.tendsto _ |>.comp + (Complex.continuous_re.tendsto _ |>.comp (tendsto_ultraTraceValue τ ω (star x*x))) + change Tendsto (fun j => Real.sqrt (τ (star (x j) * x j)).re) (ω : Filter ℕ) _ at ht + simpa only [gnsVector_norm_eq_sqrt, ultraTrace_apply_value] using ht + +theorem gnsStarAlgHom_zero_of_gnsNorm_tendsto_zero (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y) = τ (y*x)) (ω : Ultrafilter ℕ) (x : ℕ →ᵇ A) + (hx : Tendsto (fun j => ‖gnsVector τ (x j)‖) (ω : Filter ℕ) (𝓝 0)) : + (ultraTrace τ ω).gnsStarAlgHom x = 0 := by + apply (tracial_gns_zero _ (ultraTrace_tracial τ ω htr) x).mpr + have heq (j : ℕ) : τ (star (x j) * x j) = (‖gnsVector τ (x j)‖ : ℂ)^2 := by + rw [← gnsVector_inner, inner_self_eq_norm_sq_to_K] + rfl + have hz : Tendsto (fun j => τ (star (x j) * x j)) (ω : Filter ℕ) (𝓝 0) := by + have ht := (Complex.continuous_ofReal.tendsto 0 |>.comp hx).pow 2 + simpa only [heq, Function.comp_apply, Complex.ofReal_zero, zero_pow (by decide : (2 : ℕ) ≠ 0)] using ht + exact tendsto_nhds_unique (tendsto_ultraTraceValue τ ω (star x*x)) hz + +theorem ultrapower_unitary_lift_of_gns_approximation (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ a b, τ (a*b) = τ (b*a)) (ω : Ultrafilter ℕ) (x : ℕ →ᵇ A) + (hx : (ultraTrace τ ω).gnsStarAlgHom x ∈ + unitary ((ultraTrace τ ω).GNS →L[ℂ] (ultraTrace τ ω).GNS)) + (happrox : ∀ j, ∃ u : unitary A, + ‖gnsVector τ (x j - (u : A))‖ ≤ ‖gnsVector τ (star (x j) * x j - 1)‖) : + ∃ y : ℕ →ᵇ A, (∀ j, y j ∈ unitary A) ∧ + (ultraTrace τ ω).gnsStarAlgHom y = (ultraTrace τ ω).gnsStarAlgHom x := by + choose u hu using happrox + let y : ℕ →ᵇ A := BoundedContinuousFunction.ofNormedAddCommGroup + (fun j => (u j : A)) continuous_of_discreteTopology ‖(1 : A)‖ + (fun j => by simpa only [mul_one] using (CStarRing.norm_coe_unitary_mul (u j) (1 : A)).le) + let z : ℕ →ᵇ A := star x*x-1 + have hz : (ultraTrace τ ω).gnsStarAlgHom z = 0 := by + change (ultraTrace τ ω).gnsStarAlgHom (star x*x-1) = 0 + rw [map_sub, map_mul, map_star, map_one, (Unitary.mem_iff.mp hx).1, sub_self] + have hτz := (tracial_gns_zero _ (ultraTrace_tracial τ ω htr) z).mp hz + have hlim : Tendsto (fun j => ‖gnsVector τ (z j)‖) (ω : Filter ℕ) (𝓝 0) := by + simpa only [hτz, Complex.zero_re, Real.sqrt_zero] using tendsto_gnsVector_norm τ ω z + have hdiff : Tendsto (fun j => ‖gnsVector τ ((x-y) j)‖) (ω : Filter ℕ) (𝓝 0) := by + apply squeeze_zero (fun j => norm_nonneg _) _ hlim + exact hu + have he := gnsStarAlgHom_zero_of_gnsNorm_tendsto_zero τ htr ω (x-y) hdiff + rw [map_sub, sub_eq_zero] at he + exact ⟨y, fun j => (u j).property, he.symm⟩ + +end + +end KKFactorSupport + +namespace KKProjectionSupport + +open KKTraceTransfer KKUltraTrace KKFactorSupport + +open Filter Topology + +open scoped BoundedContinuousFunction ComplexOrder + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +local instance unitaryLiftConcreteOrder (M : VonNeumannAlgebra H) : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance unitaryLiftConcretePreorder (M : VonNeumannAlgebra H) : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance unitaryLiftConcreteLE (M : VonNeumannAlgebra H) : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance unitaryLiftConcreteSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +local instance unitaryLiftConcreteSequenceOrder (M : VonNeumannAlgebra H) : PartialOrder (ℕ →ᵇ ConcreteAlgebra M) := CStarAlgebra.spectralOrder _ + +local instance unitaryLiftConcreteSequenceSOR (M : VonNeumannAlgebra H) : StarOrderedRing (ℕ →ᵇ ConcreteAlgebra M) := CStarAlgebra.spectralOrderedRing _ + +theorem map_unitary_defect_eq_zero {A B : Type*} [Ring A] [StarRing A] [Ring B] [StarRing B] + [Algebra ℂ A] [Algebra ℂ B] (φ : A →⋆ₐ[ℂ] B) (x : A) (hx : φ x ∈ unitary B) : φ (star x*x-1)=0 := by + rw [map_sub,map_mul,map_star,map_one,(Unitary.mem_iff.mp hx).1,sub_self] + +theorem ultrapower_unitary_lift (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hM : KKFreeLiftFrontier.IsFactor M) (ω : Ultrafilter ℕ) (x : ℕ →ᵇ ConcreteAlgebra M) + (hx : (ultraTrace (tracePositive τ) ω).gnsStarAlgHom x ∈ + unitary ((ultraTrace (tracePositive τ) ω).GNS →L[ℂ] (ultraTrace (tracePositive τ) ω).GNS)) : + ∃ y : ℕ →ᵇ ConcreteAlgebra M, (∀ j, y j ∈ unitary (ConcreteAlgebra M)) ∧ + (ultraTrace (tracePositive τ) ω).gnsStarAlgHom y = + (ultraTrace (tracePositive τ) ω).gnsStarAlgHom x := by + apply ultrapower_unitary_lift_of_gns_approximation (tracePositive τ) τ.tracial ω x hx + intro j + obtain ⟨u, hu⟩ := trace_polar_unitary_approximation M τ hM (x j) + refine ⟨u, ?_⟩ + rw [gnsVector_norm_eq_sqrt, gnsVector_norm_eq_sqrt] + exact hu + +end + +end KKProjectionSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UnitaryRangePreimage.lean b/lean/OAI/Analysis/FreeWords/UnitaryRangePreimage.lean new file mode 100644 index 0000000000000000000000000000000000000000..201492a5d99bc4acc63287982925ff9a933863b6 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UnitaryRangePreimage.lean @@ -0,0 +1,45 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +noncomputable section + +variable {A B : Type*} [Ring A] [StarRing A] [Algebra ℂ A] + [Ring B] [StarRing B] [Algebra ℂ B] [StarModule ℂ A] [StarModule ℂ B] + +omit [StarModule ℂ A] in +theorem unitary_range_preimage (φ : A →⋆ₐ[ℂ] B) (hi : Function.Injective φ) + (u : unitary B) (hu : u.val∈φ.range) : + ∃ v : unitary A, φ v.val=u.val := by + obtain ⟨a,ha⟩ := hu + change φ a=u.val at ha + have hsa : star a*a=1 := by + apply hi + simp only [map_mul,map_star,map_one] + rw [ha] + exact u.property.1 + have has : a*star a=1 := by + apply hi + simp only [map_mul,map_star,map_one] + rw [ha] + exact u.property.2 + exact ⟨⟨a,⟨hsa,has⟩⟩,ha⟩ + +omit [StarModule ℂ A] [StarModule ℂ B] in +theorem unitary_preimage_zpow (φ : A →⋆ₐ[ℂ] B) (u : unitary A) (v : unitary B) + (h : φ u.val=v.val) (k : ℤ) : φ ((u^k).val)=(v^k).val := by + have hv : Unitary.map (StarMonoidHom.ofClass φ) u=v := Subtype.ext h + have hh := congrArg Subtype.val (map_zpow (Unitary.map (StarMonoidHom.ofClass φ)) u k) + change φ ((u^k).val)=_ at hh + rwa [hv] at hh + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UnitaryTraceContinuity.lean b/lean/OAI/Analysis/FreeWords/UnitaryTraceContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..57e958a08e791889a24007af824854d969c9e0a9 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UnitaryTraceContinuity.lean @@ -0,0 +1,83 @@ +import Mathlib +import OAI.Analysis.FreeWords.PartialWords + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace + +open Filter Topology + +noncomputable section + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable {M : VonNeumannAlgebra H} (τ : FaithfulNormalTrace M) + +local instance : PartialOrder (ConcreteAlgebra M) := concreteOrder M + +local instance : Preorder (ConcreteAlgebra M) := (concreteOrder M).toPreorder + +local instance : LE (ConcreteAlgebra M) := (concreteOrder M).toLE + +local instance : StarOrderedRing (ConcreteAlgebra M) := concreteSOR M + +variable {I : Type*} {l : Filter I} + +theorem unitary_norm_le (u : unitary (ConcreteAlgebra M)) : ‖u.val‖≤1 := by + have hh := CStarRing.norm_coe_unitary_mul u (1:ConcreteAlgebra M) + simpa only [mul_one] using hh.le.trans (PatchingWord.concrete_norm_one_le (M := M)) + +theorem tendsto_gns_unitary_pow {f : I → unitary (ConcreteAlgebra M)} + {u : unitary (ConcreteAlgebra M)} + (hf : Tendsto (fun i => gnsVector (tracePositive τ) (f i).val) l + (𝓝 (gnsVector (tracePositive τ) u.val))) (n : ℕ) : + Tendsto (fun i => gnsVector (tracePositive τ) ((f i)^n).val) l + (𝓝 (gnsVector (tracePositive τ) (u^n).val)) := by + induction n with + | zero => simpa only [pow_zero, Submonoid.coe_one] using (tendsto_const_nhds (x := gnsVector (tracePositive τ) (1:ConcreteAlgebra M))) + | succ n ih => + simpa only [pow_succ,Submonoid.coe_mul] using + tendsto_gns_mul τ 1 zero_le_one (fun i => unitary_norm_le ((f i)^n)) ih hf + +theorem tendsto_gns_unitary_zpow {f : I → unitary (ConcreteAlgebra M)} + {u : unitary (ConcreteAlgebra M)} + (hf : Tendsto (fun i => gnsVector (tracePositive τ) (f i).val) l + (𝓝 (gnsVector (tracePositive τ) u.val))) (k : ℤ) : + Tendsto (fun i => gnsVector (tracePositive τ) ((f i)^k).val) l + (𝓝 (gnsVector (tracePositive τ) (u^k).val)) := by + cases k with + | ofNat n => simpa only [Int.ofNat_eq_natCast, zpow_natCast] using tendsto_gns_unitary_pow τ hf n + | negSucc n => + simpa only [zpow_negSucc, ← Unitary.star_eq_inv, Unitary.coe_star] using + tendsto_gns_star τ (tendsto_gns_unitary_pow τ hf (n+1)) + +theorem tendsto_gns_unitary_word {f : I → unitary (ConcreteAlgebra M)} + {u : unitary (ConcreteAlgebra M)} + (hf : Tendsto (fun i => gnsVector (tracePositive τ) (f i).val) l + (𝓝 (gnsVector (tracePositive τ) u.val))) (w : List (ℤ × ConcreteAlgebra M)) : + Tendsto (fun i => gnsVector (tracePositive τ) + ((w.map fun z => ((f i)^z.1).val*z.2).prod)) l + (𝓝 (gnsVector (tracePositive τ) ((w.map fun z => (u^z.1).val*z.2).prod))) := by + induction w with + | nil => exact tendsto_const_nhds + | cons z s ih => + simp only [List.map_cons,List.prod_cons] + have hb (i:I) : ‖((f i)^z.1).val*z.2‖ ≤ ‖z.2‖ := by + calc + ‖((f i)^z.1).val*z.2‖ ≤ ‖((f i)^z.1).val‖ * ‖z.2‖ := norm_mul_le _ _ + _ ≤ 1 * ‖z.2‖ := mul_le_mul_of_nonneg_right (unitary_norm_le ((f i)^z.1)) (norm_nonneg z.2) + _ = ‖z.2‖ := one_mul _ + exact tendsto_gns_mul τ ‖z.2‖ (norm_nonneg _) hb + (tendsto_gns_mul τ 1 zero_le_one (fun i => unitary_norm_le ((f i)^z.1)) + (tendsto_gns_unitary_zpow τ hf z.1) tendsto_const_nhds) ih + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/UnitaryTraceWitnessSupport.lean b/lean/OAI/Analysis/FreeWords/UnitaryTraceWitnessSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..28b85276dbe05bfd1a851b1ac51ffb9025108d76 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/UnitaryTraceWitnessSupport.lean @@ -0,0 +1,50 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorStructure + +namespace OAI + +noncomputable section + +namespace KKFactorSupport + +open KKTraceTransfer KKUltraTrace + +open scoped ComplexOrder InnerProductSpace + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +theorem gnsVector_mul_unitary_norm (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y) = τ (y*x)) (x : A) (u : unitary A) : + ‖gnsVector τ (x * (u : A))‖ = ‖gnsVector τ x‖ := by + have heq : τ (star (x * (u : A)) * (x * (u : A))) = τ (star x * x) := by + rw [star_mul, htr] + calc + τ ((x * (u : A)) * (star (u : A) * star x)) = τ (x * star x) := by + congr 1 + calc + x * (u : A) * (star (u : A) * star x) = x * ((u : A) * star (u : A)) * star x := by + simp only [mul_assoc] + _ = x * star x := by rw [← Unitary.coe_star, Unitary.coe_mul_star_self, mul_one] + _ = _ := htr _ _ + have hh : ‖gnsVector τ (x * (u : A))‖ ^ 2 = ‖gnsVector τ x‖ ^ 2 := by + rw [@norm_sq_eq_re_inner ℂ, @norm_sq_eq_re_inner ℂ, gnsVector_inner, gnsVector_inner, heq] + nlinarith [norm_nonneg (gnsVector τ (x * (u : A))), norm_nonneg (gnsVector τ x)] + +theorem gnsVector_conj_sub_norm (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y) = τ (y*x)) (x : A) (u : unitary A) : + ‖gnsVector τ x - gnsVector τ (algebraConj u x)‖ = + ‖gnsVector τ (x * (u : A) - (u : A) * x)‖ := by + rw [← map_sub] + have heq : x - algebraConj u x = (x * (u : A) - (u : A) * x) * (↑(star u) : A) := by + simp only [Unitary.coe_star, sub_mul, algebraConj_apply] + rw [mul_assoc x, ← Unitary.coe_star, Unitary.coe_mul_star_self, mul_one] + rw [heq, gnsVector_mul_unitary_norm τ htr] + +end + +end KKFactorSupport +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/VNAModel.lean b/lean/OAI/Analysis/FreeWords/VNAModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..37eca3d3d267c67b5713c8326045c92040de2eff --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/VNAModel.lean @@ -0,0 +1,45 @@ +import Mathlib +import OAI.Analysis.FreeWords.ConjugateCopies + +namespace OAI + +noncomputable section + +namespace KKFreeWords + +open scoped BigOperators ComplexOrder + +noncomputable section + +universe u + +variable {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +instance vnaClosed (V : VonNeumannAlgebra H) : + IsClosed (V.toStarSubalgebra : Set (H →L[ℂ] H)) := by + rw [VonNeumannAlgebra.coe_toStarSubalgebra, ← V.centralizer_centralizer] + exact Set.isClosed_centralizer _ + +local instance vnaOrder (V : VonNeumannAlgebra H) : PartialOrder V.toStarSubalgebra := + CStarAlgebra.spectralOrder _ + +local instance vnaStarOrder (V : VonNeumannAlgebra H) : StarOrderedRing V.toStarSubalgebra := + CStarAlgebra.spectralOrderedRing _ + +def NormalTrace (V : VonNeumannAlgebra H) (τ : V.toStarSubalgebra →ₚ[ℂ] ℂ) : Prop := + ∀ s : Set V.toStarSubalgebra, s.Nonempty → DirectedOn (· ≤ ·) s → + BddAbove s → (∀ x ∈ s, 0 ≤ x) → + ∀ x : V.toStarSubalgebra, IsLUB s x → IsLUB (τ '' s) (τ x) + +def matrixWordSum (V : VonNeumannAlgebra H) {τ : V.toStarSubalgebra →ₚ[ℂ] ℂ} + {r d : ℕ} (F : FreeMatrixCopies τ r d) (W : Sym (Fin d) r) : V.toStarSubalgebra := + ∑ a ∈ (Finset.univ : Finset (Fin r → Fin d)).filter + (fun a => (List.ofFn a : Multiset (Fin d)) = (W : Multiset (Fin d))), + ((List.ofFn (fun j => F.diagonal j (a j))).reverse).prod + +end + +end KKFreeWords +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/VariableMatrixUltra.lean b/lean/OAI/Analysis/FreeWords/VariableMatrixUltra.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef726818bb89b659c072bb3709e2474504e54cc8 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/VariableMatrixUltra.lean @@ -0,0 +1,81 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorDiffuseCriterion +import OAI.Analysis.FreeWords.MatrixDyadicArithmetic +import OAI.Analysis.FreeWords.MatrixRangeProjections +import OAI.Analysis.FreeWords.MatrixRangeWitness +import OAI.Analysis.FreeWords.VariableUltraFactor +import OAI.Analysis.FreeWords.VariableUltraProjection + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKUltraTrace KKFreeLiftFrontier + +open Filter Topology + +open scoped ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable (d : ℕ) (ρ : ∀ j : ℕ, Matrix (Fin (d*2^j)) (Fin (d*2^j)) ℂ →⋆ₐ[ℂ] A) + +local instance matrixUltraOrder : PartialOrder (coordinateAlgebra (fun j => (ρ j).range)) := CStarAlgebra.spectralOrder _ + +local instance : LE (coordinateAlgebra (fun j => (ρ j).range)) := (matrixUltraOrder d ρ).toLE + +local instance : Preorder (coordinateAlgebra (fun j => (ρ j).range)) := (matrixUltraOrder d ρ).toPreorder + +local instance : StarOrderedRing (coordinateAlgebra (fun j => (ρ j).range)) := CStarAlgebra.spectralOrderedRing _ + +def matrixUltraNormalTrace (τ : A →ₚ[ℂ] ℂ) (h1 : τ 1=1) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (ω : Ultrafilter ℕ) : + FaithfulNormalTrace (gnsVonNeumann (coordinateTrace (fun j => (ρ j).range) τ ω)) := + gnsNormalTrace (coordinateTrace (fun j => (ρ j).range) τ ω) + (coordinateTrace_one (fun j => (ρ j).range) τ ω h1) + (coordinateTrace_tracial (fun j => (ρ j).range) τ ω htr) + +theorem matrix_ultra_factor (τ : A →ₚ[ℂ] ℂ) (h1 : τ 1=1) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (hinj : Function.Injective (gnsVector τ)) + (hρ : ∀ j, Function.Injective (ρ j)) (ω : Ultrafilter ℕ) (hω : (ω : Filter ℕ)≤atTop) : + IsFactor (gnsVonNeumann (coordinateTrace (fun j => (ρ j).range) τ ω)) := by + apply coordinate_factor _ τ htr _ ω hω + intro j x hx + exact matrix_range_commutator_witness (ρ j) (hρ j) τ htr h1 hinj x hx + +theorem matrix_ultra_projection (hd : 0 (ρ j).range) τ ω)), + IsStarProjection p ∧ + (matrixUltraNormalTrace d ρ τ h1 htr ω).map p=(((2:ℝ)^m)⁻¹:ℝ) := by + have hr (j : ℕ) : d*2^(j-m)≤d*2^j := + Nat.mul_le_mul_left d (Nat.pow_le_pow_right (by omega) (Nat.sub_le j m)) + choose p hpR hp hpB hpτ using (fun j => matrix_range_projection (d*2^j) + (d*2^(j-m)) (hr j) (ρ j) τ (hτ j)) + apply coordinate_projection (fun j => (ρ j).range) τ h1 htr ω p hp hpR + apply tendsto_const_nhds.congr' + filter_upwards [hω (eventually_ge_atTop m)] with j hj + exact ((hpτ j).trans (dyadic_rank_trace d m j hd hj)).symm + +theorem matrix_ultra_diffuse (hd : 0 (ρ j).range) τ ω)) := by + exact factor_diffuse_of_dyadic_projections _ (matrixUltraNormalTrace d ρ τ h1 htr ω) + (matrix_ultra_factor d ρ τ h1 htr hinj hρ ω hω) + (matrix_ultra_projection d ρ hd τ h1 htr hτ ω hω) + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/VariableUltraAlgebra.lean b/lean/OAI/Analysis/FreeWords/VariableUltraAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..94f9067f89728f21fd2957f589ff0dc54eba5880 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/VariableUltraAlgebra.lean @@ -0,0 +1,103 @@ +import Mathlib +import OAI.Analysis.FreeWords.UltraTrace + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKUltraTrace + +open scoped BoundedContinuousFunction ComplexOrder InnerProductSpace + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +local instance : PartialOrder (ℕ →ᵇ A) := CStarAlgebra.spectralOrder _ + +local instance : StarOrderedRing (ℕ →ᵇ A) := CStarAlgebra.spectralOrderedRing _ + +def coordinateAlgebra (R : ℕ → StarSubalgebra ℂ A) : StarSubalgebra ℂ (ℕ →ᵇ A) where + carrier := {x | ∀ j, x j ∈ R j} + zero_mem' := fun j => (R j).zero_mem + add_mem' := fun hx hy j => (R j).add_mem (hx j) (hy j) + one_mem' := fun j => (R j).one_mem + mul_mem' := fun hx hy j => (R j).mul_mem (hx j) (hy j) + algebraMap_mem' := fun c j => (R j).algebraMap_mem c + star_mem' := fun hx j => star_mem (hx j) + +omit [PartialOrder A] [StarOrderedRing A] in +@[simp] theorem mem_coordinateAlgebra (R : ℕ → StarSubalgebra ℂ A) (x : ℕ →ᵇ A) : + x ∈ coordinateAlgebra R ↔ ∀ j, x j ∈ R j := Iff.rfl + +instance coordinateAlgebra_closed (R : ℕ → StarSubalgebra ℂ A) + [hR : ∀ j, IsClosed (R j : Set A)] : + IsClosed (coordinateAlgebra R : Set (ℕ →ᵇ A)) := by + change IsClosed {x : ℕ →ᵇ A | ∀ j, x j ∈ R j} + have hset : {x : ℕ →ᵇ A | ∀ j, x j ∈ R j} = + ⋂ j, (fun x : ℕ →ᵇ A => x j) ⁻¹' (R j : Set A) := by ext; simp + rw [hset] + apply isClosed_iInter + intro j + exact (hR j).preimage (by fun_prop) + +variable (R : ℕ → StarSubalgebra ℂ A) [∀ j, IsClosed (R j : Set A)] + +local instance coordOrder : PartialOrder (coordinateAlgebra R) := CStarAlgebra.spectralOrder _ + +local instance coordLE : LE (coordinateAlgebra R) := (coordOrder R).toLE + +local instance coordPreorder : Preorder (coordinateAlgebra R) := (coordOrder R).toPreorder + +local instance coordSOR : StarOrderedRing (coordinateAlgebra R) := CStarAlgebra.spectralOrderedRing _ + +def coordinateTrace (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) : coordinateAlgebra R →ₚ[ℂ] ℂ where + toLinearMap := (ultraTrace τ ω).toLinearMap.comp (coordinateAlgebra R).subtype.toLinearMap + monotone' := by + intro x y hxy + apply (ultraTrace τ ω).monotone' + apply sub_nonneg.mp + obtain ⟨v,hv⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp (sub_nonneg.mpr hxy) + have he : y.val-x.val = star v.val*v.val := congrArg Subtype.val hv + change 0 ≤ y.val-x.val + rw [he] + exact star_mul_self_nonneg _ + +@[simp] theorem coordinateTrace_apply (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) + (x : coordinateAlgebra R) : coordinateTrace R τ ω x = ultraTrace τ ω x.val := rfl + +theorem coordinateTrace_one (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) (h1 : τ 1=1) : + coordinateTrace R τ ω 1=1 := ultraTrace_one τ ω h1 + +theorem coordinateTrace_tracial (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (x y : coordinateAlgebra R) : + coordinateTrace R τ ω (x*y)=coordinateTrace R τ ω (y*x) := + ultraTrace_tracial τ ω htr x.val y.val + +theorem gns_norm_sqrt (τ : A →ₚ[ℂ] ℂ) (x : A) : + ‖gnsVector τ x‖ = Real.sqrt (τ (star x*x)).re := by + rw [@norm_eq_sqrt_re_inner ℂ,gnsVector_inner] + rfl + +theorem coordinate_norm_tendsto (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) + (x : coordinateAlgebra R) : + Tendsto (fun j => ‖gnsVector τ (x.val j)‖) (ω : Filter ℕ) + (𝓝 ‖gnsVector (coordinateTrace R τ ω) x‖) := by + rw [gns_norm_sqrt] + have ht := Real.continuous_sqrt.tendsto _ |>.comp + (Complex.continuous_re.tendsto _ |>.comp (tendsto_ultraTraceValue τ ω (star x.val*x.val))) + change Tendsto (fun j => Real.sqrt (τ (star (x.val j)*x.val j)).re) + (ω : Filter ℕ) (𝓝 (Real.sqrt (ultraTraceValue τ ω (star x.val*x.val)).re)) at ht + simp only [gns_norm_sqrt] + exact ht + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/VariableUltraBall.lean b/lean/OAI/Analysis/FreeWords/VariableUltraBall.lean new file mode 100644 index 0000000000000000000000000000000000000000..96a08f08fa1cc74477ddd52c17bbaf58159e12f5 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/VariableUltraBall.lean @@ -0,0 +1,121 @@ +import Mathlib +import OAI.Analysis.FreeWords.UltraDiagonal +import OAI.Analysis.FreeWords.VariableUltraAlgebra + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKUltraTrace + +open scoped BoundedContinuousFunction ComplexOrder + +open Filter Topology + +noncomputable section + +theorem ultrafilter_diagonal_indices (ω : Ultrafilter ℕ) + (hω : (ω : Filter ℕ) ≤ atTop) (S : ℕ → Set ℕ) (hS : ∀ n, S n ∈ (ω : Filter ℕ)) : + ∃ k : ℕ → ℕ, Tendsto k (ω : Filter ℕ) atTop ∧ + ∀ᶠ j in (ω : Filter ℕ), j ∈ S (k j) := by + classical + let P (j n : ℕ) := ∀ m ≤ n, j ∈ S m + let k (j : ℕ) := Nat.findGreatest (P j) j + have hP (n : ℕ) : ∀ᶠ j in (ω : Filter ℕ), P j n := by + induction n with + | zero => simpa [P] using hS 0 + | succ n ih => + filter_upwards [ih, hS (n+1)] with j hj hn + intro m hm + rcases Nat.le_or_eq_of_le_add_one hm with h | rfl + · exact hj m h + · exact hn + refine ⟨k, tendsto_atTop.2 ?_, ?_⟩ + · intro n + filter_upwards [hP n, hω (eventually_ge_atTop n)] with j hj hjn + exact Nat.le_findGreatest hjn hj + · filter_upwards [hP 0] with j hj + have hg : P j (k j) := Nat.findGreatest_spec (Nat.zero_le j) hj + exact hg (k j) le_rfl + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable (R : ℕ → StarSubalgebra ℂ A) [∀ j, IsClosed (R j : Set A)] + +local instance : PartialOrder (coordinateAlgebra R) := CStarAlgebra.spectralOrder _ + +local instance : StarOrderedRing (coordinateAlgebra R) := CStarAlgebra.spectralOrderedRing _ + +theorem coordinateVectorBall_isClosed (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) + (hω : (ω : Filter ℕ) ≤ atTop) (b : ℝ) : + IsClosed (gnsVector (coordinateTrace R τ ω) '' Metric.closedBall (0 : coordinateAlgebra R) b) := by + apply isClosed_of_closure_subset + intro y hy + let e (n : ℕ) : ℝ := ((n : ℝ)+1)⁻¹ + have he (n : ℕ) : 0 < e n := by dsimp [e]; positivity + have hchoose (n : ℕ) : ∃ s : coordinateAlgebra R, ‖s‖ ≤ b ∧ + ‖gnsVector (coordinateTrace R τ ω) s - y‖ < e n := by + obtain ⟨z, ⟨s, hs, rfl⟩, hz⟩ := Metric.mem_closure_iff.mp hy (e n) (he n) + exact ⟨s, by simpa using hs, by simpa only [dist_eq_norm, norm_sub_rev] using hz⟩ + choose s hs hsclose using hchoose + have hR : 0 ≤ b := (norm_nonneg (s 0)).trans (hs 0) + have hemono {m n : ℕ} (hmn : m ≤ n) : e n ≤ e m := by + dsimp [e] + exact inv_anti₀ (by positivity) (by exact_mod_cast Nat.add_le_add_right hmn 1) + have hpair {m n : ℕ} (hmn : m ≤ n) : + ‖gnsVector (coordinateTrace R τ ω) (s n - s m)‖ < 2 * e m := by + rw [map_sub] + calc + ‖gnsVector (coordinateTrace R τ ω) (s n) - gnsVector (coordinateTrace R τ ω) (s m)‖ + ≤ ‖gnsVector (coordinateTrace R τ ω) (s n) - y‖ + + ‖gnsVector (coordinateTrace R τ ω) (s m) - y‖ := by simpa only [norm_sub_rev] using norm_sub_le_norm_sub_add_norm_sub (gnsVector (coordinateTrace R τ ω) (s n)) y (gnsVector (coordinateTrace R τ ω) (s m)) + _ < e n + e m := add_lt_add (hsclose n) (hsclose m) + _ ≤ 2 * e m := by linarith [hemono hmn] + let S (n : ℕ) : Set ℕ := {j | ∀ m ≤ n, ‖gnsVector τ ((s n - s m).val j)‖ < 3 * e m} + have hS (n : ℕ) : S n ∈ (ω : Filter ℕ) := by + have ht (m : ℕ) (hm : m ∈ Finset.range (n+1)) : + ∀ᶠ j in (ω : Filter ℕ), ‖gnsVector τ ((s n - s m).val j)‖ < 3*e m := by + have hmn : m ≤ n := Nat.lt_succ_iff.mp (Finset.mem_range.mp hm) + have hb : ‖gnsVector (coordinateTrace R τ ω) (s n - s m)‖ < 3*e m := by + linarith [hpair hmn, he m] + exact (tendsto_order.mp (coordinate_norm_tendsto R τ ω (s n - s m))).2 _ hb + have hh := (Filter.eventually_all_finset (Finset.range (n+1))).mpr ht + filter_upwards [hh] with j hj + intro m hm + exact hj m (Finset.mem_range.mpr (Nat.lt_succ_iff.mpr hm)) + obtain ⟨k, hk, hkS⟩ := ultrafilter_diagonal_indices ω hω S hS + let x₀ : ℕ →ᵇ A := BoundedContinuousFunction.ofNormedAddCommGroup + (fun j => (s (k j)).val j) continuous_of_discreteTopology b + (fun j => (s (k j)).val.norm_coe_le_norm j |>.trans (hs (k j))) + let x : coordinateAlgebra R := ⟨x₀,fun j => (s (k j)).property j⟩ + have hx : ‖x‖ ≤ b := (BoundedContinuousFunction.norm_le hR).mpr + (fun j => (s (k j)).val.norm_coe_le_norm j |>.trans (hs (k j))) + have hdist (m : ℕ) : ‖gnsVector (coordinateTrace R τ ω) x - gnsVector (coordinateTrace R τ ω) (s m)‖ ≤ 3*e m := by + rw [← map_sub] + apply le_of_tendsto (coordinate_norm_tendsto R τ ω (x - s m)) + filter_upwards [hkS, (tendsto_atTop.mp hk) m] with j hj hm + exact (hj m hm).le + have htotal (m : ℕ) : ‖gnsVector (coordinateTrace R τ ω) x - y‖ ≤ 4*e m := by + calc + ‖gnsVector (coordinateTrace R τ ω) x - y‖ ≤ + ‖gnsVector (coordinateTrace R τ ω) x - gnsVector (coordinateTrace R τ ω) (s m)‖ + + ‖gnsVector (coordinateTrace R τ ω) (s m)-y‖ := norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ 3*e m + e m := add_le_add (hdist m) (hsclose m).le + _ = 4*e m := by ring + have hlim : Tendsto (fun m => 4*e m) atTop (𝓝 0) := by + have ht : Tendsto (fun m : ℕ => ((m : ℝ)+1)⁻¹) atTop (𝓝 0) := by + simpa only [Function.comp_def, Nat.cast_add, Nat.cast_one] using + (tendsto_inv_atTop_nhds_zero_nat (𝕜 := ℝ)).comp (tendsto_add_atTop_nat 1) + simpa [e] using ht.const_mul 4 + have hz : ‖gnsVector (coordinateTrace R τ ω) x-y‖ ≤ 0 := + le_of_tendsto_of_tendsto tendsto_const_nhds hlim (Filter.Eventually.of_forall htotal) + exact ⟨x, by simpa using hx, sub_eq_zero.mp (norm_eq_zero.mp (le_antisymm hz (norm_nonneg _)))⟩ + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/VariableUltraBundle.lean b/lean/OAI/Analysis/FreeWords/VariableUltraBundle.lean new file mode 100644 index 0000000000000000000000000000000000000000..522b3f946fd23f02f602103570e87f05bb723436 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/VariableUltraBundle.lean @@ -0,0 +1,92 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorBase +import OAI.Analysis.FreeWords.TracialBicommutant +import OAI.Analysis.FreeWords.VariableUltraBall + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKUltraTrace KKTraceTransfer + +open scoped InnerProductSpace ComplexOrder + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +def gnsVonNeumann (τ : A →ₚ[ℂ] ℂ) : VonNeumannAlgebra τ.GNS where + toStarSubalgebra := bicommutantAlg τ.gnsStarAlgHom.range + centralizer_centralizer' := by + change Set.centralizer (Set.centralizer (bicommutantAlg τ.gnsStarAlgHom.range : Set (τ.GNS →L[ℂ] τ.GNS))) = + (bicommutantAlg τ.gnsStarAlgHom.range : Set (τ.GNS →L[ℂ] τ.GNS)) + simp only [coe_bicommutantAlg,Set.centralizer_centralizer_centralizer] + +local instance (τ : A →ₚ[ℂ] ℂ) : PartialOrder (ConcreteAlgebra (gnsVonNeumann τ)) := concreteOrder _ + +local instance (τ : A →ₚ[ℂ] ℂ) : LE (ConcreteAlgebra (gnsVonNeumann τ)) := (concreteOrder _).toLE + +local instance (τ : A →ₚ[ℂ] ℂ) : Preorder (ConcreteAlgebra (gnsVonNeumann τ)) := (concreteOrder _).toPreorder + +local instance (τ : A →ₚ[ℂ] ℂ) : StarOrderedRing (ConcreteAlgebra (gnsVonNeumann τ)) := concreteSOR _ + +def gnsNormalTrace (τ : A →ₚ[ℂ] ℂ) (h1 : τ 1=1) + (htr : ∀ x y, τ (x*y)=τ (y*x)) : FaithfulNormalTrace (gnsVonNeumann τ) where + map := { + toFun := fun x => ⟪gnsVector τ 1, x.val (gnsVector τ 1)⟫_ℂ + map_add' := by + intro x y + change ⟪gnsVector τ 1, x.val (gnsVector τ 1) + y.val (gnsVector τ 1)⟫_ℂ = _ + exact inner_add_right _ _ _ + map_smul' := by intros; simp } + positive x hx := hx.inner_nonneg_right _ + normalized := by + change ⟪gnsVector τ 1, gnsVector τ 1⟫_ℂ = 1 + simpa only [gnsVector_inner,star_one,one_mul] using h1 + tracial := gns_bicommutantState_tracial τ htr + faithful x hx hz := by + obtain ⟨v,hv⟩ := CStarAlgebra.nonneg_iff_eq_star_mul_self.mp + ((ContinuousLinearMap.nonneg_iff_isPositive (f := x.val)).mpr hx) + have hz' : ⟪gnsVector τ 1, x.val (gnsVector τ 1)⟫_ℂ=0 := hz + rw [hv] at hz' + change ⟪gnsVector τ 1, v.adjoint (v (gnsVector τ 1))⟫_ℂ=0 at hz' + rw [ContinuousLinearMap.adjoint_inner_right] at hz' + have hv0 := (inner_self_eq_zero (𝕜 := ℂ)).mp hz' + apply gns_bicommutant_separating τ htr x 0 + change x.val (gnsVector τ 1)=0 + rw [hv] + change v.adjoint (v (gnsVector τ 1))=0 + rw [hv0,map_zero] + normal r := by + exact (ContinuousLinearMapWOT.continuous_inner_apply continuous_subtype_val + (gnsVector τ 1) (gnsVector τ 1)).continuousOn + +@[simp] theorem gnsNormalTrace_image (τ : A →ₚ[ℂ] ℂ) (h1 : τ 1=1) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (a : A) : + (gnsNormalTrace τ h1 htr).map (gnsBiHom τ a)=τ a := by + change ⟪gnsVector τ 1, τ.gnsStarAlgHom a (gnsVector τ 1)⟫_ℂ=τ a + rw [gnsStarAlgHom_vector,mul_one,gnsVector_inner,star_one,one_mul] + +local instance (R : ℕ → StarSubalgebra ℂ A) [∀ j, IsClosed (R j : Set A)] : + PartialOrder (coordinateAlgebra R) := CStarAlgebra.spectralOrder _ + +local instance (R : ℕ → StarSubalgebra ℂ A) [∀ j, IsClosed (R j : Set A)] : + StarOrderedRing (coordinateAlgebra R) := CStarAlgebra.spectralOrderedRing _ + +theorem coordinate_gns_range (R : ℕ → StarSubalgebra ℂ A) [∀ j, IsClosed (R j : Set A)] + (τ : A →ₚ[ℂ] ℂ) (htr : ∀ x y, τ (x*y)=τ (y*x)) (ω : Ultrafilter ℕ) + (hω : (ω : Filter ℕ) ≤ Filter.atTop) : + (coordinateTrace R τ ω).gnsStarAlgHom.range = (gnsVonNeumann (coordinateTrace R τ ω)).toStarSubalgebra := by + apply SetLike.coe_injective + exact ((coe_bicommutantAlg _).trans + (tracialGNS_bicommutant_of_closed_balls _ (coordinateTrace_tracial R τ ω htr) + (coordinateVectorBall_isClosed R τ ω hω))).symm + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/VariableUltraFactor.lean b/lean/OAI/Analysis/FreeWords/VariableUltraFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9b832a1f491fa97df2c50f3f62b8f9a431a8cc3 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/VariableUltraFactor.lean @@ -0,0 +1,167 @@ +import Mathlib +import OAI.Analysis.FreeWords.FactorStructure +import OAI.Analysis.FreeWords.VariableUltraBundle + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKUltraTrace KKFreeLiftFrontier + +open scoped ComplexOrder InnerProductSpace BoundedContinuousFunction + +open Filter Topology + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +theorem gns_factor_of_center_scalar (τ : A →ₚ[ℂ] ℂ) + (hrange : τ.gnsStarAlgHom.range = (gnsVonNeumann τ).toStarSubalgebra) + (hcenter : ∀ a : A, (∀ b : A, Commute (τ.gnsStarAlgHom a) (τ.gnsStarAlgHom b)) → + τ.gnsStarAlgHom a = τ a • 1) : IsFactor (gnsVonNeumann τ) := by + intro x hx + have hmem : x.val ∈ τ.gnsStarAlgHom.range := by + rw [hrange] + exact x.property + obtain ⟨a, ha⟩ := hmem + change τ.gnsStarAlgHom a = x.val at ha + have hac : ∀ b : A, Commute (τ.gnsStarAlgHom a) (τ.gnsStarAlgHom b) := by + intro b + rw [ha] + exact congrArg Subtype.val (hx (gnsBiHom τ b)).eq + refine ⟨τ a, ?_⟩ + apply Subtype.ext + change x.val = τ a • 1 + rw [← ha] + exact hcenter a hac + +variable (R : ℕ → StarSubalgebra ℂ A) [∀ j, IsClosed (R j : Set A)] + +local instance ultraFactorOrder : PartialOrder (coordinateAlgebra R) := CStarAlgebra.spectralOrder _ + +local instance ultraFactorLE : LE (coordinateAlgebra R) := (ultraFactorOrder R).toLE + +local instance ultraFactorPreorder : Preorder (coordinateAlgebra R) := (ultraFactorOrder R).toPreorder + +local instance ultraFactorSOR : StarOrderedRing (coordinateAlgebra R) := CStarAlgebra.spectralOrderedRing _ + +theorem map_commutator_zero {B C : Type*} [Ring B] [Ring C] + [Algebra ℂ B] [Algebra ℂ C] [StarRing B] [StarRing C] + (f : B →⋆ₐ[ℂ] C) (x y : B) (h : Commute (f x) (f y)) : f (x*y-y*x)=0 := by + rw [map_sub,map_mul,map_mul,h.eq,sub_self] + +theorem gns_commutator_norm_zero (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (x y : A) + (hxy : Commute (τ.gnsStarAlgHom x) (τ.gnsStarAlgHom y)) : + ‖gnsVector τ (x*y-y*x)‖ = 0 := by + have hzero := map_commutator_zero τ.gnsStarAlgHom x y hxy + have hτ := (tracial_gns_zero τ htr (x*y-y*x)).mp hzero + rw [gns_norm_sqrt,hτ,Complex.zero_re,Real.sqrt_zero] + +theorem map_eq_scalar_of_centered_zero {B C : Type*} [Ring B] [Ring C] + [Algebra ℂ B] [Algebra ℂ C] [StarRing B] [StarRing C] + (f : B →⋆ₐ[ℂ] C) (x : B) (c : ℂ) (hx : f (x-c•1)=0) : + f x = c • 1 := by + rwa [map_sub,map_smul,map_one,sub_eq_zero] at hx + +theorem gns_center_scalar_of_commutator_norm (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (x : A) + (hx : ∀ y : A, Commute (τ.gnsStarAlgHom x) (τ.gnsStarAlgHom y)) + (hbound : ∃ y : A, ‖gnsVector τ (x*y-y*x)‖ = 0 → + ‖gnsVector τ (x-τ x•1)‖ = 0) : + τ.gnsStarAlgHom x = τ x • 1 := by + obtain ⟨y, hy⟩ := hbound + have hzero := norm_eq_zero.mp (hy (gns_commutator_norm_zero τ htr x y (hx y))) + have hτ : τ (star (x-τ x•1)*(x-τ x•1)) = 0 := by + rw [← gnsVector_inner,hzero,inner_zero_left] + exact map_eq_scalar_of_centered_zero τ.gnsStarAlgHom x (τ x) + ((tracial_gns_zero τ htr (x-τ x•1)).mpr hτ) + +theorem coordinate_gns_zero_of_norm_tendsto (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (ω : Ultrafilter ℕ) (x : coordinateAlgebra R) + (hx : Tendsto (fun j => ‖gnsVector τ (x.val j)‖) (ω : Filter ℕ) (𝓝 0)) : + (coordinateTrace R τ ω).gnsStarAlgHom x=0 := by + apply (tracial_gns_zero _ (coordinateTrace_tracial R τ ω htr) x).mpr + have hn := tendsto_nhds_unique (coordinate_norm_tendsto R τ ω x) hx + have hz := norm_eq_zero.mp hn + rw [← gnsVector_inner, hz,inner_zero_left] + +theorem coordinate_centered_norm_tendsto_zero (τ : A →ₚ[ℂ] ℂ) (ω : Ultrafilter ℕ) + (x w : coordinateAlgebra R) + (hbound : ∀ j, ‖gnsVector τ (x.val j - τ (x.val j) • 1)‖ ≤ + 2 * ‖gnsVector τ (w.val j)‖) + (hwlim : Tendsto (fun j => ‖gnsVector τ (w.val j)‖) (ω : Filter ℕ) (𝓝 0)) : + Tendsto (fun j => ‖gnsVector τ ((x - (coordinateTrace R τ ω x) • 1).val j)‖) + (ω : Filter ℕ) (𝓝 0) := by + let c := coordinateTrace R τ ω x + have hbound' (j : ℕ) : ‖gnsVector τ ((x-c•1).val j)‖ ≤ + 2*‖gnsVector τ (w.val j)‖+‖τ (x.val j)-c‖*‖gnsVector τ 1‖ := by + have hid : (x-c•1).val j=(x.val j-τ (x.val j)•1)+(τ (x.val j)-c)•1 := by + change x.val j-c•1=_ + rw [sub_smul]; abel + rw [hid,map_add] + apply (norm_add_le _ _).trans + rw [map_smul,norm_smul] + exact add_le_add (hbound j) le_rfl + have hc : Tendsto (fun j => ‖τ (x.val j)-c‖) (ω : Filter ℕ) (𝓝 0) := by + have ht : Tendsto (fun j => τ (x.val j)) (ω : Filter ℕ) (𝓝 c) := + tendsto_ultraTraceValue τ ω x.val + simpa only [sub_self,norm_zero] using (ht.sub_const c).norm + have hr : Tendsto (fun j => 2*‖gnsVector τ (w.val j)‖+‖τ (x.val j)-c‖*‖gnsVector τ 1‖) + (ω : Filter ℕ) (𝓝 0) := by + simpa only [mul_zero,zero_mul,zero_add] using + (hwlim.const_mul 2).add (hc.mul_const ‖gnsVector τ 1‖) + exact squeeze_zero (fun j => norm_nonneg _) hbound' hr + +omit [∀ j, IsClosed (R j : Set A)] in +theorem coordinate_commutator_bound (τ : A →ₚ[ℂ] ℂ) + (hw : ∀ j, ∀ x∈R j, ∃ u : unitary A, u.val∈R j ∧ + ‖gnsVector τ (x-τ x•1)‖ ≤ 2*‖gnsVector τ (x*u.val-u.val*x)‖) + (x : coordinateAlgebra R) : + ∃ y : coordinateAlgebra R, ∀ j, ‖gnsVector τ (x.val j-τ (x.val j)•1)‖ ≤ + 2*‖gnsVector τ ((x*y-y*x).val j)‖ := by + choose u huR hu using (fun j => hw j (x.val j) (x.property j)) + let y₀ : ℕ →ᵇ A := BoundedContinuousFunction.ofNormedAddCommGroup + (fun j => (u j).val) continuous_of_discreteTopology ‖(1 : A)‖ + (fun j => by simpa only [mul_one] using (CStarRing.norm_coe_unitary_mul (u j) (1 : A)).le) + exact ⟨⟨y₀,huR⟩, hu⟩ + +theorem coordinate_center_scalar (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y)=τ (y*x)) + (hw : ∀ j, ∀ x∈R j, ∃ u : unitary A, u.val∈R j ∧ + ‖gnsVector τ (x-τ x•1)‖ ≤ 2*‖gnsVector τ (x*u.val-u.val*x)‖) + (ω : Ultrafilter ℕ) (x : coordinateAlgebra R) + (hx : ∀ y : coordinateAlgebra R, + Commute ((coordinateTrace R τ ω).gnsStarAlgHom x) + ((coordinateTrace R τ ω).gnsStarAlgHom y)) : + (coordinateTrace R τ ω).gnsStarAlgHom x=(coordinateTrace R τ ω x)•1 := by + apply gns_center_scalar_of_commutator_norm (coordinateTrace R τ ω) + (coordinateTrace_tracial R τ ω htr) x hx + obtain ⟨y, hu⟩ := coordinate_commutator_bound R τ hw x + refine ⟨y, fun hwnorm => ?_⟩ + let w := x*y-y*x + have hwlim : Tendsto (fun j => ‖gnsVector τ (w.val j)‖) (ω : Filter ℕ) (𝓝 0) := by + simpa only [w,hwnorm] using coordinate_norm_tendsto R τ ω w + let c := coordinateTrace R τ ω x + let v : coordinateAlgebra R := x-c•1 + have hlim := coordinate_centered_norm_tendsto_zero R τ ω x w hu hwlim + exact tendsto_nhds_unique (coordinate_norm_tendsto R τ ω v) hlim + +theorem coordinate_factor (τ : A →ₚ[ℂ] ℂ) + (htr : ∀ x y, τ (x*y)=τ (y*x)) + (hw : ∀ j, ∀ x∈R j, ∃ u : unitary A, u.val∈R j ∧ + ‖gnsVector τ (x-τ x•1)‖ ≤ 2*‖gnsVector τ (x*u.val-u.val*x)‖) + (ω : Ultrafilter ℕ) (hω : (ω : Filter ℕ) ≤ atTop) : + IsFactor (gnsVonNeumann (coordinateTrace R τ ω)) := by + exact gns_factor_of_center_scalar (coordinateTrace R τ ω) + (coordinate_gns_range R τ htr ω hω) (coordinate_center_scalar R τ htr hw ω) + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/VariableUltraProjection.lean b/lean/OAI/Analysis/FreeWords/VariableUltraProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..739a51af27dd54294ae6d71947a980264f44946d --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/VariableUltraProjection.lean @@ -0,0 +1,57 @@ +import Mathlib +import OAI.Analysis.FreeWords.VariableUltraBundle + +namespace OAI + +noncomputable section + +namespace KKVariableUltra + +open KKTraceTransfer KKUltraTrace + +open Filter Topology + +open scoped ComplexOrder BoundedContinuousFunction + +noncomputable section + +variable {A : Type*} [CStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + +variable (R : ℕ → StarSubalgebra ℂ A) [∀ j, IsClosed (R j : Set A)] + +local instance projUltraOrder : PartialOrder (coordinateAlgebra R) := CStarAlgebra.spectralOrder _ + +local instance : LE (coordinateAlgebra R) := (projUltraOrder R).toLE + +local instance : Preorder (coordinateAlgebra R) := (projUltraOrder R).toPreorder + +local instance : StarOrderedRing (coordinateAlgebra R) := CStarAlgebra.spectralOrderedRing _ + +theorem coordinate_projection (τ : A →ₚ[ℂ] ℂ) (h1 : τ 1=1) + (htr : ∀ x y, τ (x*y)=τ (y*x)) (ω : Ultrafilter ℕ) + (p : ℕ → A) (hp : ∀ j, IsStarProjection (p j)) (hpR : ∀ j, p j∈R j) + (c : ℂ) (hc : Tendsto (fun j => τ (p j)) (ω : Filter ℕ) (𝓝 c)) : + ∃ q : ConcreteAlgebra (gnsVonNeumann (coordinateTrace R τ ω)), + IsStarProjection q ∧ + (gnsNormalTrace _ (coordinateTrace_one R τ ω h1) (coordinateTrace_tracial R τ ω htr)).map q=c := by + let p₀ : ℕ →ᵇ A := BoundedContinuousFunction.ofNormedAddCommGroup p + continuous_of_discreteTopology 1 (fun j => (hp j).norm_le) + let a : coordinateAlgebra R := ⟨p₀,hpR⟩ + have ha : IsStarProjection a := by + constructor + · apply Subtype.ext + ext j + exact (hp j).isIdempotentElem.eq + · apply Subtype.ext + ext j + exact (hp j).isSelfAdjoint.star_eq + refine ⟨gnsBiHom (coordinateTrace R τ ω) a,ha.map _,?_⟩ + rw [gnsNormalTrace_image] + exact tendsto_nhds_unique (tendsto_ultraTraceValue τ ω p₀) hc + +end + +end KKVariableUltra +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/WeakCompact.lean b/lean/OAI/Analysis/FreeWords/WeakCompact.lean new file mode 100644 index 0000000000000000000000000000000000000000..96df8df261d60a240dd1a3ef964a4a6f750ce6b0 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/WeakCompact.lean @@ -0,0 +1,244 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +namespace UniversalStrongKK + +section OperatorMean + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +structure ScalarMean (G : Type*) [TopologicalSpace G] where + map : (G →ᵇ ℂ) →L[ℂ] ℂ + norm_map_le : ‖map‖ ≤ 1 + map_one : map 1 = 1 + map_star : ∀ f, map (star f) = star (map f) + positive : ∀ f, (∀ g, 0 ≤ (f g).re) → 0 ≤ (map f).re + +variable (m : ScalarMean G) + +noncomputable def operatorCoefficient (T : G →ᵇ (H →L[ℂ] H)) (x y : H) : G →ᵇ ℂ := + BoundedContinuousFunction.ofNormedAddCommGroup + (fun g => ⟪T g x, y⟫_ℂ) + (by fun_prop) + (‖T‖ * ‖x‖ * ‖y‖) + (fun g => (norm_inner_le_norm _ _).trans + (mul_le_mul_of_nonneg_right + ((T g).le_opNorm x |>.trans + (mul_le_mul_of_nonneg_right (T.norm_coe_le_norm g) (norm_nonneg x))) + (norm_nonneg y))) + +@[simp] theorem operatorCoefficient_apply (T : G →ᵇ (H →L[ℂ] H)) (x y : H) (g : G) : + operatorCoefficient T x y g = ⟪T g x, y⟫_ℂ := rfl + +theorem norm_operatorCoefficient_le (T : G →ᵇ (H →L[ℂ] H)) (x y : H) : + ‖operatorCoefficient T x y‖ ≤ ‖T‖ * ‖x‖ * ‖y‖ := by + apply BoundedContinuousFunction.norm_le (by positivity) |>.mpr + intro g + exact (norm_inner_le_norm _ _).trans + (mul_le_mul_of_nonneg_right + ((T g).le_opNorm x |>.trans + (mul_le_mul_of_nonneg_right (T.norm_coe_le_norm g) (norm_nonneg x))) + (norm_nonneg y)) + +noncomputable def meanBilinear (T : G →ᵇ (H →L[ℂ] H)) : H →L⋆[ℂ] H →L[ℂ] ℂ := + LinearMap.mkContinuous₂ + { toFun := fun x => + { toFun := fun y => m.map (operatorCoefficient T x y) + map_add' := fun y z => by + rw [show operatorCoefficient T x (y + z) = + operatorCoefficient T x y + operatorCoefficient T x z by ext; simp] + exact map_add m.map _ _ + map_smul' := fun c y => by + rw [show operatorCoefficient T x (c • y) = c • operatorCoefficient T x y by + ext; simp] + exact map_smul m.map c _ } + map_add' := fun x z => by + ext y + change m.map (operatorCoefficient T (x + z) y) = _ + rw [show operatorCoefficient T (x + z) y = + operatorCoefficient T x y + operatorCoefficient T z y by + ext; simp] + exact map_add m.map _ _ + map_smul' := fun c x => by + ext y + change m.map (operatorCoefficient T (c • x) y) = _ + rw [show operatorCoefficient T (c • x) y = star c • operatorCoefficient T x y by + ext; simp [mul_comm]] + exact map_smul m.map (star c) _ } + ‖T‖ (fun x y => by + calc + _ ≤ ‖m.map‖ * ‖operatorCoefficient T x y‖ := m.map.le_opNorm _ + _ ≤ ‖operatorCoefficient T x y‖ := by + nlinarith [m.norm_map_le, norm_nonneg (operatorCoefficient T x y)] + _ ≤ _ := norm_operatorCoefficient_le T x y) + +variable [CompleteSpace H] + +noncomputable def operatorMean (T : G →ᵇ (H →L[ℂ] H)) : H →L[ℂ] H := + InnerProductSpace.continuousLinearMapOfBilin (meanBilinear m T) + +@[simp] theorem inner_operatorMean (T : G →ᵇ (H →L[ℂ] H)) (x y : H) : + ⟪operatorMean m T x, y⟫_ℂ = m.map (operatorCoefficient T x y) := + InnerProductSpace.continuousLinearMapOfBilin_apply _ _ _ + +theorem norm_operatorMean_le (T : G →ᵇ (H →L[ℂ] H)) : ‖operatorMean m T‖ ≤ ‖T‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) + intro x + have hb (y : H) : ‖⟪operatorMean m T x, y⟫_ℂ‖ ≤ ‖T‖ * ‖x‖ * ‖y‖ := by + rw [inner_operatorMean] + calc + _ ≤ ‖m.map‖ * ‖operatorCoefficient T x y‖ := m.map.le_opNorm _ + _ ≤ ‖operatorCoefficient T x y‖ := by + nlinarith [m.norm_map_le, norm_nonneg (operatorCoefficient T x y)] + _ ≤ _ := norm_operatorCoefficient_le T x y + have hs := hb (operatorMean m T x) + rw [← inner_self_re_eq_norm, inner_self_eq_norm_sq] at hs + have hn := norm_nonneg (operatorMean m T x) + have ht : 0 ≤ ‖T‖ * ‖x‖ := by positivity + nlinarith + +end OperatorMean + +end UniversalStrongKK + +open scoped Topology + +namespace UniversalStrongKK + +section UltraMean + +variable {I : Type*} [TopologicalSpace I] + +theorem exists_ultrafilter_mean (u : Ultrafilter I) : + ∃ m : ScalarMean I, ∀ f : I →ᵇ ℂ, + Filter.Tendsto (fun i => f i) (u : Filter I) (𝓝 (m.map f)) := by + let q (i : I) : WeakDual ℂ (I →ᵇ ℂ) := + StrongDual.toWeakDual (BoundedContinuousFunction.evalCLM ℂ i : StrongDual ℂ (I →ᵇ ℂ)) + have hqn (i : I) : ‖(BoundedContinuousFunction.evalCLM ℂ i : StrongDual ℂ (I →ᵇ ℂ))‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro f + simpa using f.norm_coe_le_norm i + obtain ⟨m, hm, ht⟩ := (WeakDual.isCompact_closedBall + (0 : StrongDual ℂ (I →ᵇ ℂ)) 1).ultrafilter_le_nhds (u.map q) (by + rw [Ultrafilter.coe_map, Filter.map_le_iff_le_comap, Filter.comap_principal] + apply Filter.le_principal_iff.mpr + exact Filter.Eventually.of_forall (fun i => by + simpa [q, Metric.mem_closedBall, dist_zero_right] using hqn i)) + have hlim (f : I →ᵇ ℂ) : Filter.Tendsto (fun i => f i) ↑u (𝓝 (m f)) := + (WeakDual.eval_continuous f).continuousAt.tendsto.comp + (show Filter.Tendsto q ↑u (𝓝 m) from ht) + refine ⟨⟨m.toStrongDual, ?_, ?_, ?_, ?_⟩, ?_⟩ + · simpa [Metric.mem_closedBall, dist_zero_right] using hm + · exact tendsto_nhds_unique (hlim 1) tendsto_const_nhds + · intro f + exact tendsto_nhds_unique (hlim (star f)) (by + simpa only [WeakDual.toStrongDual_apply, BoundedContinuousFunction.star_apply] using (hlim f).star) + · intro f hf + exact ge_of_tendsto ((Complex.continuous_re.tendsto _).comp (hlim f)) + (Filter.Eventually.of_forall hf) + · exact hlim + +noncomputable def ultrafilterMean (u : Ultrafilter I) : ScalarMean I := + (exists_ultrafilter_mean u).choose + +theorem tendsto_ultrafilterMean (u : Ultrafilter I) (f : I →ᵇ ℂ) : + Filter.Tendsto (fun i => f i) (u : Filter I) (𝓝 ((ultrafilterMean u).map f)) := + (exists_ultrafilter_mean u).choose_spec f + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem tendsto_operatorMean (u : Ultrafilter I) (T : I →ᵇ (H →L[ℂ] H)) : + Filter.Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (T i)) (u : Filter I) + (𝓝 (ContinuousLinearMapWOT.ofCLM (operatorMean (ultrafilterMean u) T))) := by + apply ContinuousLinearMapWOT.tendsto_iff_forall_inner_apply_tendsto.mpr + intro x y + have h := (tendsto_ultrafilterMean u (operatorCoefficient T x y)).star + simpa only [operatorCoefficient_apply, ← inner_operatorMean, Complex.star_def, inner_conj_symm, ContinuousLinearMapWOT.ofCLM_apply] using h + +theorem norm_le_of_wot_tendsto {J : Type*} {l : Filter J} [l.NeBot] + {T : J → (H →L[ℂ] H)} {A : H →L[ℂ] H} {r : ℝ} (hr : 0 ≤ r) + (hT : Filter.Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (T i)) l (𝓝 (ContinuousLinearMapWOT.ofCLM A))) + (hb : ∀ᶠ i in l, ‖T i‖ ≤ r) : ‖A‖ ≤ r := by + apply ContinuousLinearMap.opNorm_le_bound _ hr + intro x + have hh (y : H) : ‖⟪y, A x⟫_ℂ‖ ≤ r * ‖x‖ * ‖y‖ := by + apply le_of_tendsto + ((ContinuousLinearMapWOT.tendsto_iff_forall_inner_apply_tendsto.mp hT x y).norm) + filter_upwards [hb] with i hi + calc + _ ≤ ‖y‖ * ‖T i x‖ := norm_inner_le_norm _ _ + _ ≤ ‖y‖ * (r * ‖x‖) := by + gcongr + exact ((T i).le_opNorm x).trans (mul_le_mul_of_nonneg_right hi (norm_nonneg x)) + _ = _ := by ring + have h := hh (A x) + rw [← inner_self_re_eq_norm, inner_self_eq_norm_sq] at h + have hx : 0 ≤ r * ‖x‖ := by positivity + nlinarith [norm_nonneg (A x)] + +theorem mem_of_wot_tendsto (M : VonNeumannAlgebra H) {J : Type*} {l : Filter J} [l.NeBot] + {T : J → (H →L[ℂ] H)} {A : H →L[ℂ] H} + (hT : Filter.Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (T i)) l (𝓝 (ContinuousLinearMapWOT.ofCLM A))) + (hb : ∀ᶠ i in l, T i ∈ M) : A ∈ M := by + rw [← M.commutant_commutant] + apply VonNeumannAlgebra.mem_commutant_iff.mpr + intro B hB + ext x + apply ext_inner_left ℂ + intro y + have hl := ContinuousLinearMapWOT.tendsto_iff_forall_inner_apply_tendsto.mp hT (B x) y + have hr := ContinuousLinearMapWOT.tendsto_iff_forall_inner_apply_tendsto.mp hT x (star B y) + have he : (fun i => ⟪y, T i (B x)⟫_ℂ) =ᶠ[l] + (fun i => ⟪star B y, T i x⟫_ℂ) := by + filter_upwards [hb] with i hi + rw [ContinuousLinearMap.star_eq_adjoint, ContinuousLinearMap.adjoint_inner_left] + have hc := VonNeumannAlgebra.mem_commutant_iff.mp hB (T i) hi + exact congrArg (fun C : H →L[ℂ] H => ⟪y, C x⟫_ℂ) hc + have hh := tendsto_nhds_unique hl (hr.congr' he.symm) + simpa only [ContinuousLinearMap.star_eq_adjoint, + ContinuousLinearMap.adjoint_inner_left, mul_apply_eq_comp, + ContinuousLinearMapWOT.ofCLM_apply] using hh.symm + +end UltraMean + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped InnerProductSpace + +open Filter Topology + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +theorem positive_of_wot_tendsto {I : Type*} {l : Filter I} [l.NeBot] + {T : I → (H →L[ℂ] H)} {A : H →L[ℂ] H} + (hT : Filter.Tendsto (fun i => ContinuousLinearMapWOT.ofCLM (T i)) l + (𝓝 (ContinuousLinearMapWOT.ofCLM A))) + (hp : ∀ᶠ i in l, (T i).IsPositive) : A.IsPositive := by + have hh := ContinuousLinearMapWOT.tendsto_iff_forall_inner_apply_tendsto.mp hT + constructor + · intro x y + have hl := (hh x y).star + simp only [Complex.star_def, inner_conj_symm] at hl + have he : (fun i => ⟪T i x, y⟫_ℂ) =ᶠ[l] (fun i => ⟪x, T i y⟫_ℂ) := by + filter_upwards [hp] with i hi + exact hi.inner_left_eq_inner_right x y + exact tendsto_nhds_unique hl ((hh y x).congr' he.symm) + · intro x + change 0 ≤ RCLike.re (⟪A x, x⟫_ℂ) + rw [inner_re_symm] + apply ge_of_tendsto ((Complex.continuous_re.tendsto _).comp (hh x x)) + filter_upwards [hp] with i hi + exact hi.re_inner_nonneg_right x + +end UniversalStrongKK +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/WeakMeanAlgebra.lean b/lean/OAI/Analysis/FreeWords/WeakMeanAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e03aa7cca4d89f20fca5ef9cb1082c96c6a5774 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/WeakMeanAlgebra.lean @@ -0,0 +1,138 @@ +import Mathlib +import OAI.Analysis.FreeWords.WeakCompact + +namespace OAI + +noncomputable section + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +namespace UniversalStrongKK + +section OperatorMean + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +variable (m : ScalarMean G) + +variable [CompleteSpace H] + +end OperatorMean + +end UniversalStrongKK + +open scoped Topology + +namespace UniversalStrongKK + +section UltraMean + +variable {I : Type*} [TopologicalSpace I] + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UltraMean + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped InnerProductSpace + +open Filter Topology + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +end UniversalStrongKK + +namespace UniversalStrongKK + +open scoped ComplexConjugate InnerProductSpace BoundedContinuousFunction + +section OperatorMeanAlgebra + +variable {G H : Type*} [TopologicalSpace G] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +variable (m : ScalarMean G) + +theorem operatorMean_add (S T : G →ᵇ (H →L[ℂ] H)) : + operatorMean m (S + T) = operatorMean m S + operatorMean m T := by + ext x + apply ext_inner_right ℂ + intro y + simp only [add_apply, inner_add_left, inner_operatorMean] + rw [show operatorCoefficient (S + T) x y = + operatorCoefficient S x y + operatorCoefficient T x y by ext; simp] + exact map_add m.map _ _ + +theorem operatorMean_smul (c : ℂ) (T : G →ᵇ (H →L[ℂ] H)) : + operatorMean m (c • T) = c • operatorMean m T := by + ext x + apply ext_inner_right ℂ + intro y + simp only [smul_apply, inner_smul_left, inner_operatorMean] + rw [show operatorCoefficient (c • T) x y = star c • operatorCoefficient T x y by + ext; simp [mul_comm]] + exact map_smul m.map (star c) _ + +noncomputable def operatorMeanCLM : (G →ᵇ (H →L[ℂ] H)) →L[ℂ] (H →L[ℂ] H) := + LinearMap.mkContinuous + { toFun := operatorMean m + map_add' := operatorMean_add m + map_smul' := operatorMean_smul m } + 1 (fun T => by simpa using norm_operatorMean_le m T) + +@[simp] theorem operatorMeanCLM_apply (T : G →ᵇ (H →L[ℂ] H)) : + operatorMeanCLM m T = operatorMean m T := rfl + +theorem ScalarMean.map_const (c : ℂ) : m.map (BoundedContinuousFunction.const G c) = c := by + rw [show BoundedContinuousFunction.const G c = c • (1 : G →ᵇ ℂ) by ext; simp] + simp [m.map_one] + +@[simp] theorem operatorMean_const (T : H →L[ℂ] H) : + operatorMean m (BoundedContinuousFunction.const G T) = T := by + ext x + apply ext_inner_right ℂ + intro y + rw [inner_operatorMean] + rw [show operatorCoefficient (BoundedContinuousFunction.const G T) x y = + BoundedContinuousFunction.const G ⟪T x, y⟫_ℂ by ext; rfl] + exact m.map_const _ + +theorem operatorMean_bimodule (B C : H →L[ℂ] H) (T : G →ᵇ (H →L[ℂ] H)) : + operatorMean m (BoundedContinuousFunction.const G B * T * + BoundedContinuousFunction.const G C) = B * operatorMean m T * C := by + ext x + apply ext_inner_right ℂ + intro y + rw [inner_operatorMean] + change _ = ⟪B (operatorMean m T (C x)), y⟫_ℂ + rw [← ContinuousLinearMap.adjoint_inner_right, inner_operatorMean] + congr 1 + ext g + simp only [operatorCoefficient_apply, BoundedContinuousFunction.mul_apply, + BoundedContinuousFunction.const_apply, mul_apply_eq_comp] + exact (ContinuousLinearMap.adjoint_inner_right B _ _).symm + +theorem operatorMean_star (T : G →ᵇ (H →L[ℂ] H)) : + operatorMean m (star T) = star (operatorMean m T) := by + ext x + apply ext_inner_right ℂ + intro y + rw [inner_operatorMean] + rw [show operatorCoefficient (star T) x y = star (operatorCoefficient T y x) by + ext g + simp only [operatorCoefficient_apply, BoundedContinuousFunction.star_apply] + rw [ContinuousLinearMap.star_eq_adjoint, ContinuousLinearMap.adjoint_inner_left, + ← starRingEnd_apply, inner_conj_symm]] + rw [m.map_star, ← inner_operatorMean, ContinuousLinearMap.star_eq_adjoint, + ContinuousLinearMap.adjoint_inner_left, ← starRingEnd_apply, inner_conj_symm] + +end OperatorMeanAlgebra + +end UniversalStrongKK +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/WeakPowers.lean b/lean/OAI/Analysis/FreeWords/WeakPowers.lean new file mode 100644 index 0000000000000000000000000000000000000000..52258ad07f20545d030c64363258e5dcb236a829 --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/WeakPowers.lean @@ -0,0 +1,96 @@ +import Mathlib +import OAI.Analysis.FreeWords.CyclicBasis +import OAI.Analysis.FreeWords.MatrixReindex +import OAI.Analysis.FreeWords.MatrixSubfactor + +namespace OAI + +noncomputable section + +namespace KKLocalPatching + +open KKTraceTransfer KKFreeLiftFrontier KKUltraTrace KKFactorSupport KKProjectionSupport KKMatrixQuantization + +noncomputable section + +def embeddedShift {G A : Type*} [Fintype G] [DecidableEq G] [AddCommGroup G] + [Ring A] [Algebra ℂ A] [StarRing A] [StarModule ℂ A] + (ρ : Matrix G G ℂ →⋆ₐ[ℂ] A) : Multiplicative G →* unitary A := + let f : Matrix G G ℂ →⋆* A := { + toFun := ρ + map_one' := map_one ρ + map_mul' := map_mul ρ + map_star' := map_star ρ } + (Unitary.map f).toMonoidHom.comp shiftHom + +@[simp] theorem embeddedShift_val {G A : Type*} [Fintype G] [DecidableEq G] [AddCommGroup G] + [Ring A] [Algebra ℂ A] [StarRing A] [StarModule ℂ A] + (ρ : Matrix G G ℂ →⋆ₐ[ℂ] A) (g : G) : + (embeddedShift ρ (Multiplicative.ofAdd g)).val = ρ (shiftMatrix g) := rfl + +@[simp] theorem embeddedShift_power {G A : Type*} [Fintype G] [DecidableEq G] [AddCommGroup G] + [Ring A] [Algebra ℂ A] [StarRing A] [StarModule ℂ A] + (ρ : Matrix G G ℂ →⋆ₐ[ℂ] A) (g : G) (k : ℤ) : + ((embeddedShift ρ (Multiplicative.ofAdd g))^k).val = ρ (shiftMatrix (k • g)) := by + rw [← map_zpow] + rfl + +theorem weakly_small_powers + {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {ι : Type*} [Fintype ι] + (M : VonNeumannAlgebra H) (τ : FaithfulNormalTrace M) + (hF : IsFactor M) (hD : IsDiffuse M) + (x : ι → ConcreteAlgebra M) (k : ι → ℤ) (hk : ∀ i, k i ≠ 0) + (ε : ℝ) (hε : 0 < ε) : + ∃ u : unitary (ConcreteAlgebra M), + ∀ i, ‖τ.map ((u^(k i) : unitary (ConcreteAlgebra M)).val*x i)‖ < ε := by + classical + let S := ∑ i, (traceNorm τ (x i))^2 + obtain ⟨N,hN⟩ := exists_nat_gt (S/ε^2) + let K := Finset.univ.sup (fun i => (k i).natAbs) + obtain ⟨p,hpN,hpPrime⟩ := Nat.exists_infinite_primes (N+K+1) + have : Fact (Nat.Prime p) := ⟨hpPrime⟩ + have : NeZero p := ⟨hpPrime.ne_zero⟩ + have hp : 0

(k i).natAbs) (Finset.mem_univ i) + have hpos : 0<(k i).natAbs := Int.natAbs_pos.mpr (hk i) + have hle := Nat.le_of_dvd hpos hd' + omega + obtain ⟨ρ,_,hρ⟩ := exists_matrix_subfactor M τ hF hD p hp + let e : Fin p ≃ ZMod p := (ZMod.finEquiv p).toEquiv + let σ := ρ.comp (matrixReindex e.symm) + have hσ (a : Matrix (ZMod p) (ZMod p) ℂ) : + τ.map (σ a)=(Fintype.card (ZMod p):ℂ)⁻¹*Matrix.trace a := by + rw [show σ a=ρ (matrixReindex e.symm a) from rfl,hρ,ZMod.card] + congr 1 + exact Fintype.sum_equiv e _ _ (fun i => rfl) + let f (g : ZMod p) (i : ι) := ‖τ.map (σ (shiftMatrix ((k i : ZMod p)*g))*x i)‖^2 + have hsum (i:ι) : ∑ g, f g i ≤ (traceNorm τ (x i))^2 := by + have heq : ∑ g, f g i=∑ g:ZMod p, ‖τ.map (σ (shiftMatrix g)*x i)‖^2 := + Fintype.sum_equiv (Equiv.mulLeft₀ (k i : ZMod p) (hkz i)) _ _ (fun _ => rfl) + rw [heq] + exact cyclic_bessel τ σ hσ (x i) + have htotal : (∑ g:ZMod p, ∑ i, f g i) < ∑ g:ZMod p, ε^2 := by + rw [Finset.sum_comm,Finset.sum_const,Finset.card_univ,ZMod.card,nsmul_eq_mul] + exact (Finset.sum_le_sum (fun i _ => hsum i)).trans_lt hep + obtain ⟨g,_,hg⟩ := Finset.exists_lt_of_sum_lt htotal + refine ⟨embeddedShift σ (Multiplicative.ofAdd g),fun i => ?_⟩ + rw [embeddedShift_power,zsmul_eq_mul] + have hi : f g i≤∑ j, f g j := Finset.single_le_sum (fun j _ => show 0≤f g j from sq_nonneg _) (Finset.mem_univ i) + have hh : ‖τ.map (σ (shiftMatrix ((k i : ZMod p)*g))*x i)‖^2 < ε^2 := hi.trans_lt hg + nlinarith [norm_nonneg (τ.map (σ (shiftMatrix ((k i : ZMod p)*g))*x i))] + +end + +end KKLocalPatching +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/WeightedInverse.lean b/lean/OAI/Analysis/FreeWords/WeightedInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f0b02fa65927cb1d9de268566a61e8b26530a3a --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/WeightedInverse.lean @@ -0,0 +1,73 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators + +noncomputable section + +theorem small_matrix_vector_bound {ι : Type*} [Fintype ι] + (v r : ι → ℂ) (E : Matrix ι ι ℂ) (q : ℝ) (hq : 0 ≤ q) + (hcard : (Fintype.card ι : ℝ)*q ≤ 1/2) + (hE : ∀ i k, ‖E i k‖ ≤ q) (hr : ∀ i, ‖r i‖ ≤ 1) + (heq : ∀ i, v i+∑ k,E i k*v k=r i) : ‖v‖ ≤ 2 := by + have hi (i : ι) : ‖v i‖ ≤ 1+(1/2)*‖v‖ := by + have hv : v i=r i-∑ k,E i k*v k := by linear_combination heq i + rw [hv] + calc + _ ≤ ‖r i‖+‖∑ k,E i k*v k‖ := norm_sub_le _ _ + _ ≤ 1+∑ k,‖E i k*v k‖ := add_le_add (hr i) (norm_sum_le _ _) + _ ≤ 1+∑ k,q*‖v‖ := by + gcongr with k + rw [norm_mul] + exact mul_le_mul (hE i k) (norm_le_pi_norm v k) (norm_nonneg _) hq + _ = 1+((Fintype.card ι : ℝ)*q)*‖v‖ := by simp; ring + _ ≤ _ := by gcongr + have hnorm := (pi_norm_le_iff_of_nonneg (by positivity : 0 ≤ 1+(1/2 : ℝ)*‖v‖)).mpr hi + linarith + +theorem inverse_entry_bound_of_scaled_error {ι : Type*} [Fintype ι] [Nonempty ι] + [DecidableEq ι] (A B : Matrix ι ι ℂ) (hAB : A*B=1) + (w : ι → ℝ) (hw : ∀ i, 0 < w i) (j : ι) (hwj : w j=1) + (hsmall : ∀ i k, ‖A i k*(w k : ℂ)/(w i : ℂ)-(if i=k then 1 else 0)‖ ≤ + (2*(Fintype.card ι : ℝ))⁻¹) : ∀ i, ‖B i j‖ ≤ 2*w i := by + let v : ι → ℂ := fun i => B i j/(w i : ℂ) + let E : Matrix ι ι ℂ := fun i k => A i k*(w k : ℂ)/(w i : ℂ)-(if i=k then 1 else 0) + let r : ι → ℂ := fun i => (if i=j then 1 else 0)/(w i : ℂ) + have hw0 (i : ι) : (w i : ℂ) ≠ 0 := by exact_mod_cast (hw i).ne' + have hcard : (0 : ℝ) < Fintype.card ι := by exact_mod_cast Fintype.card_pos + have heq (i : ι) : v i+∑ k,E i k*v k=r i := by + have he := congrArg (fun T : Matrix ι ι ℂ => T i j) hAB + simp only [Matrix.mul_apply,Matrix.one_apply] at he + have hs : ∑ k,E i k*v k=(∑ k,A i k*B k j)/(w i : ℂ)-v i := by + simp only [E,v,sub_mul,Finset.sum_sub_distrib] + congr 1 + · rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro k _ + field_simp [hw0] + · simp + rw [hs,he] + simp [r] + have hr (i : ι) : ‖r i‖ ≤ 1 := by + by_cases hi : i=j + · subst i; simp [r,hwj] + · simp [r,hi] + have hv : ‖v‖ ≤ 2 := small_matrix_vector_bound v r E _ (by positivity) + (by field_simp; nlinarith) hsmall hr heq + intro i + have hvi := (norm_le_pi_norm v i).trans hv + change ‖B i j/(w i : ℂ)‖ ≤ 2 at hvi + rw [norm_div,Complex.norm_real,Real.norm_eq_abs,abs_of_pos (hw i)] at hvi + exact (div_le_iff₀ (hw i)).mp hvi + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/FreeWords/WeingartenDecay.lean b/lean/OAI/Analysis/FreeWords/WeingartenDecay.lean new file mode 100644 index 0000000000000000000000000000000000000000..639226fa99e375661b992c4030e60b288c43f1ec --- /dev/null +++ b/lean/OAI/Analysis/FreeWords/WeingartenDecay.lean @@ -0,0 +1,68 @@ +import Mathlib +import OAI.Analysis.FreeWords.PowerMetricInverse + +namespace OAI + +noncomputable section + +namespace KKWeingarten + +open scoped BigOperators + +noncomputable section + +theorem weingarten_decay (r : ℕ) : ∃ (C : ℝ) (D : ℕ), 0 < C ∧ 0 < D ∧ + ∀ d : ℕ, D ≤ d → ∀ π σ : Equiv.Perm (Fin r), + ‖(permutationGram r d)⁻¹ π σ‖ ≤ C / (d : ℝ)^(r+permutationDistance π σ) := by + classical + let m := Fintype.card (Equiv.Perm (Fin r)) + have hm : 0 < m := Fintype.card_pos + have hmR : (0 : ℝ) < m := by exact_mod_cast hm + have hL : (1 : ℝ) ≤ 2*m := by + have hm1 : (1 : ℝ) ≤ m := by exact_mod_cast hm + linarith + refine ⟨2*(2*(m : ℝ))^r,max r (2*m),by positivity,lt_of_lt_of_le (by omega) (le_max_right _ _),?_⟩ + intro d hd π σ + have hrd : r ≤ d := (le_max_left _ _).trans hd + have hLd : 2*m ≤ d := (le_max_right _ _).trans hd + have hdpos : 0 < d := by omega + have hdR : (0 : ℝ) < d := by exact_mod_cast hdpos + have hds : 2*(m : ℝ)*(d : ℝ)⁻¹ ≤ 1 := by + rw [← div_eq_mul_inv] + exact (div_le_one hdR).mpr (by exact_mod_cast hLd) + let B := (d : ℂ)^r • (permutationGram r d)⁻¹ + have hB : distanceMatrix permutationDistance (d : ℝ)⁻¹*B=1 := by + dsimp [B] + rw [Matrix.mul_smul,← Matrix.smul_mul,← permutationGram_scalar_distance hdpos] + exact Matrix.mul_nonsing_inv _ (isUnit_iff_ne_zero.mpr (permutationGram_det_ne_zero hrd)) + have hb := distanceMatrix_inverse_bound permutationDistance permutationDistance_self + (fun i k hik => Nat.pos_of_ne_zero (fun he => hik ((permutationDistance_eq_zero i k).mp he))) + permutationDistance_triangle (d : ℝ)⁻¹ (inv_pos.mpr hdR) hds B hB π σ + change ‖(d : ℂ)^r*((permutationGram r d)⁻¹ π σ)‖ ≤ + 2*(2*(m : ℝ)*(d : ℝ)⁻¹)^permutationDistance π σ at hb + rw [norm_mul,norm_pow,Complex.norm_natCast] at hb + have hdist : permutationDistance π σ ≤ r := by + have hh := permutationDistance_add_classes π σ + omega + have he : (2*(m : ℝ)*(d : ℝ)⁻¹)^permutationDistance π σ*(d : ℝ)^permutationDistance π σ = + (2*(m : ℝ))^permutationDistance π σ := by + rw [← mul_pow] + congr 1 + field_simp + have hb' := mul_le_mul_of_nonneg_right hb (pow_nonneg hdR.le (permutationDistance π σ)) + have hb'' : ‖(permutationGram r d)⁻¹ π σ‖*(d : ℝ)^(r+permutationDistance π σ) ≤ + 2*(2*(m : ℝ))^permutationDistance π σ := by + rw [pow_add] + calc + _ = ((d : ℝ)^r*‖(permutationGram r d)⁻¹ π σ‖)*(d : ℝ)^permutationDistance π σ := by ring + _ ≤ 2 * ((2*(m : ℝ)*(d : ℝ)⁻¹)^permutationDistance π σ * (d : ℝ)^permutationDistance π σ) := by nlinarith [hb'] + _ = _ := by rw [he] + apply (le_div_iff₀ (pow_pos hdR _)).mpr + exact hb''.trans (mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hL hdist) (by norm_num)) + +end + +end KKWeingarten +end + +end OAI diff --git a/lean/OAI/Analysis/Graph/Gradients.lean b/lean/OAI/Analysis/Graph/Gradients.lean new file mode 100644 index 0000000000000000000000000000000000000000..86cd9ba729ab368261c4501af5fe4a90975c194c --- /dev/null +++ b/lean/OAI/Analysis/Graph/Gradients.lean @@ -0,0 +1,235 @@ +import Mathlib + +namespace OAI + +/-! Closed gradient subspaces of connected oriented multigraphs. -/ + +open scoped lp + +noncomputable section + +namespace SingerFour + +structure OrientedGraph (V E : Type*) where + tail : E → V + head : E → V + +namespace OrientedGraph + +variable {V E : Type*} (G : OrientedGraph V E) + +inductive Walk : V → V → Type _ + | nil (v : V) : Walk v v + | forward {v : V} (e : E) (p : Walk v (G.tail e)) : Walk v (G.head e) + | backward {v : V} (e : E) (p : Walk v (G.head e)) : Walk v (G.tail e) + +def Connected : Prop := ∀ v w : V, Nonempty (G.Walk v w) + +def gradients : Submodule ℝ (ℓ²(E, ℝ)) where + carrier := {c | ∃ f : V → ℝ, ∀ e, c e = f (G.head e) - f (G.tail e)} + zero_mem' := ⟨0, by intro e; simp⟩ + add_mem' := by + rintro c d ⟨f, hf⟩ ⟨g, hg⟩ + refine ⟨f + g, ?_⟩ + intro e + change c e + d e = (f (G.head e) + g (G.head e)) - + (f (G.tail e) + g (G.tail e)) + rw [hf e, hg e] + ring + smul_mem' := by + rintro r c ⟨f, hf⟩ + refine ⟨r • f, ?_⟩ + intro e + change r * c e = r * f (G.head e) - r * f (G.tail e) + rw [hf e, mul_sub] + +@[simp] +theorem mem_gradients (c : ℓ²(E, ℝ)) : + c ∈ G.gradients ↔ ∃ f : V → ℝ, ∀ e, c e = f (G.head e) - f (G.tail e) := Iff.rfl + +def Walk.integral {G : OrientedGraph V E} {v w : V} : G.Walk v w → (ℓ²(E, ℝ) →L[ℝ] ℝ) + | .nil _ => 0 + | .forward e p => p.integral + lp.evalCLM ℝ (fun _ : E => ℝ) 2 e + | .backward e p => p.integral - lp.evalCLM ℝ (fun _ : E => ℝ) 2 e + +theorem Walk.integral_gradient {G : OrientedGraph V E} {c : ℓ²(E, ℝ)} {f : V → ℝ} + (hf : ∀ e, c e = f (G.head e) - f (G.tail e)) {v w : V} + (p : G.Walk v w) : p.integral c = f w - f v := by + induction p with + | nil => simp [Walk.integral] + | forward e p ih => + change p.integral c + c e = f (G.head e) - f v + rw [ih, hf e] + ring + | backward e p ih => + change p.integral c - c e = f (G.tail e) - f v + rw [ih, hf e] + ring + +theorem eq_of_zero_differences (hG : G.Connected) {f : V → ℝ} + (hf : ∀ e, f (G.head e) = f (G.tail e)) (v w : V) : f v = f w := by + have hgrad : ∀ e, (0 : ℓ²(E, ℝ)) e = f (G.head e) - f (G.tail e) := by + intro e + simp [hf e] + have h := (Classical.choice (hG v w)).integral_gradient hgrad + simpa only [map_zero, eq_comm, sub_eq_zero] using h.symm + +theorem potential_unique (hG : G.Connected) (o : V) {f g : V → ℝ} + (hedges : ∀ e, f (G.head e) - f (G.tail e) = g (G.head e) - g (G.tail e)) + (ho : f o = g o) : f = g := by + funext v + have hzero : ∀ e, (f - g) (G.head e) = (f - g) (G.tail e) := by + intro e + have := hedges e + dsimp + linarith + have h := G.eq_of_zero_differences hG hzero o v + dsimp at h + linarith + +theorem l2_eq_zero_of_constant [Infinite V] (f : ℓ²(V, ℝ)) {r : ℝ} + (hf : ∀ v, f v = r) : f = 0 := by + have hs : Summable (fun v : V => ‖r‖ ^ (2 : ℕ)) := by + simpa only [hf, ENNReal.toReal_ofNat, Real.rpow_two] using + (lp.memℓp f).summable (by norm_num : 0 < (2 : ENNReal).toReal) + have hr : r = 0 := by + have h := (summable_const_iff (β := V) (‖r‖ ^ (2 : ℕ))).mp hs + simpa using h + apply lp.ext + funext v + simpa only [lp.coeFn_zero, Pi.zero_apply, hr] using hf v + +theorem l2_eq_zero_of_zero_differences [Infinite V] (hG : G.Connected) + (f : ℓ²(V, ℝ)) (hf : ∀ e, f (G.head e) = f (G.tail e)) : f = 0 := by + let o : V := Classical.choice (inferInstance : Nonempty V) + exact l2_eq_zero_of_constant f (fun v => G.eq_of_zero_differences hG hf v o) + +noncomputable def normalizedPotential (hG : G.Connected) (o v : V) : + ℓ²(E, ℝ) →L[ℝ] ℝ := + (Classical.choice (hG o v)).integral + +theorem normalizedPotential_gradient (hG : G.Connected) (o v : V) + {c : ℓ²(E, ℝ)} {f : V → ℝ} + (hf : ∀ e, c e = f (G.head e) - f (G.tail e)) : + G.normalizedPotential hG o v c = f v - f o := + Walk.integral_gradient hf _ + +theorem mem_gradients_iff_normalized (hG : G.Connected) (o : V) (c : ℓ²(E, ℝ)) : + c ∈ G.gradients ↔ ∀ e, + c e = G.normalizedPotential hG o (G.head e) c - + G.normalizedPotential hG o (G.tail e) c := by + constructor + · rintro ⟨f, hf⟩ e + rw [G.normalizedPotential_gradient hG o (G.head e) hf, + G.normalizedPotential_gradient hG o (G.tail e) hf, hf e] + ring + · intro hc + exact ⟨fun v => G.normalizedPotential hG o v c, hc⟩ + +theorem isClosed_gradients (hG : G.Connected) (o : V) : + IsClosed (G.gradients : Set (ℓ²(E, ℝ))) := by + have hset : (G.gradients : Set (ℓ²(E, ℝ))) = + ⋂ e : E, {c : ℓ²(E, ℝ) | c e = + G.normalizedPotential hG o (G.head e) c - + G.normalizedPotential hG o (G.tail e) c} := by + ext c + simp only [SetLike.mem_coe, Set.mem_iInter, Set.mem_ofPred, + G.mem_gradients_iff_normalized hG o c] + rw [hset] + apply isClosed_iInter + intro e + exact isClosed_eq (lp.evalCLM ℝ (fun _ : E => ℝ) 2 e).continuous + ((G.normalizedPotential hG o (G.head e)).continuous.sub + (G.normalizedPotential hG o (G.tail e)).continuous) + +theorem completeSpace_gradients (hG : G.Connected) (o : V) : + CompleteSpace G.gradients := + (G.isClosed_gradients hG o).completeSpace_coe + +def finiteSupportGradients : Submodule ℝ (ℓ²(E, ℝ)) where + carrier := {c | ∃ f : V →₀ ℝ, ∀ e, c e = f (G.head e) - f (G.tail e)} + zero_mem' := ⟨0, by intro e; simp⟩ + add_mem' := by + rintro c d ⟨f, hf⟩ ⟨g, hg⟩ + refine ⟨f + g, ?_⟩ + intro e + change c e + d e = (f (G.head e) + g (G.head e)) - + (f (G.tail e) + g (G.tail e)) + rw [hf e, hg e] + ring + smul_mem' := by + rintro r c ⟨f, hf⟩ + refine ⟨r • f, ?_⟩ + intro e + change r * c e = r * f (G.head e) - r * f (G.tail e) + rw [hf e, mul_sub] + +def LocallyFinite : Prop := + ∀ v : V, Set.Finite {e : E | G.tail e = v ∨ G.head e = v} + +theorem hasFiniteSupport_differential (hG : G.LocallyFinite) (f : V →₀ ℝ) : + (Function.support (fun e => f (G.head e) - f (G.tail e))).Finite := by + classical + have hfinite : (⋃ v ∈ (f.support : Set V), + {e : E | G.tail e = v ∨ G.head e = v}).Finite := + f.support.finite_toSet.biUnion (fun v _ => hG v) + apply hfinite.subset + intro e he + change f (G.head e) - f (G.tail e) ≠ 0 at he + have hside : G.head e ∈ f.support ∨ G.tail e ∈ f.support := by + by_contra h + push Not at h + simp [Finsupp.notMem_support_iff.mp h.1, Finsupp.notMem_support_iff.mp h.2] at he + rcases hside with hh | ht + · exact Set.mem_iUnion₂.mpr ⟨G.head e, hh, Or.inr rfl⟩ + · exact Set.mem_iUnion₂.mpr ⟨G.tail e, ht, Or.inl rfl⟩ + +def finiteSupportDifferential (hG : G.LocallyFinite) : + (V →₀ ℝ) →ₗ[ℝ] ℓ²(E, ℝ) where + toFun f := ⟨fun e => f (G.head e) - f (G.tail e), + (memℓp_zero (G.hasFiniteSupport_differential hG f)).of_exponent_ge (by positivity)⟩ + map_add' f g := by + apply lp.ext + funext e + change f (G.head e) + g (G.head e) - (f (G.tail e) + g (G.tail e)) = + (f (G.head e) - f (G.tail e)) + (g (G.head e) - g (G.tail e)) + ring + map_smul' r f := by + apply lp.ext + funext e + exact mul_sub r (f (G.head e)) (f (G.tail e)) |>.symm + +@[simp] +theorem finiteSupportDifferential_apply (hG : G.LocallyFinite) (f : V →₀ ℝ) (e : E) : + G.finiteSupportDifferential hG f e = f (G.head e) - f (G.tail e) := rfl + +theorem range_finiteSupportDifferential (hG : G.LocallyFinite) : + LinearMap.range (G.finiteSupportDifferential hG) = G.finiteSupportGradients := by + ext c + constructor + · rintro ⟨f, rfl⟩ + exact ⟨f, fun e => rfl⟩ + · rintro ⟨f, hf⟩ + refine ⟨f, ?_⟩ + apply lp.ext + funext e + exact (hf e).symm + +def zeroBoundaryGradients : Submodule ℝ (ℓ²(E, ℝ)) := + G.finiteSupportGradients.topologicalClosure + +theorem finiteSupportGradients_le : G.finiteSupportGradients ≤ G.gradients := by + rintro c ⟨f, hf⟩ + exact ⟨f, hf⟩ + +theorem zeroBoundaryGradients_le (hG : G.Connected) (o : V) : + G.zeroBoundaryGradients ≤ G.gradients := + G.finiteSupportGradients.topologicalClosure_minimal G.finiteSupportGradients_le + (G.isClosed_gradients hG o) + +end OrientedGraph +end SingerFour + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/BinaryMatrices.lean b/lean/OAI/Analysis/GroupDeterminants/BinaryMatrices.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3d589cfa1bcfe4446fb802b00be84be7f24858c --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/BinaryMatrices.lean @@ -0,0 +1,53 @@ +import OAI.Analysis.GroupDeterminants.LampDenominators + +namespace OAI + +universe uH + +noncomputable section +open scoped BigOperators Pointwise + +namespace GroupRingDeterminant +variable {H : Type uH} [Group H] + +lemma zmodTwo_eq_one_of_ne_zero (z : ZMod 2) (hz : z ≠ 0) : z = 1 := by + exact (by decide : ∀ z : ZMod 2, z ≠ 0 → z = 1) z hz + +lemma binary_support_expansion (a : MonoidAlgebra (ZMod 2) H) (ha : a.coeff 1 = 1) : + ∃ S : Finset H, 1 ∉ S ∧ a = 1 + ∑ s ∈ S, MonoidAlgebra.single s 1 := by + classical + have hm : 1 ∈ a.coeff.support := Finsupp.mem_support_iff.mpr (ha ▸ one_ne_zero) + refine ⟨a.coeff.support.erase 1, Finset.notMem_erase _ _, ?_⟩ + calc + a = ∑ s ∈ a.coeff.support, MonoidAlgebra.single s (a.coeff s) := + (MonoidAlgebra.sum_coeff_single a).symm + _ = MonoidAlgebra.single 1 (a.coeff 1) + + ∑ s ∈ a.coeff.support.erase 1, MonoidAlgebra.single s (a.coeff s) := + (Finset.add_sum_erase _ _ hm).symm + _ = _ := by + rw [ha, ← MonoidAlgebra.one_def] + congr 1 + apply Finset.sum_congr rfl + intro s hs + rw [zmodTwo_eq_one_of_ne_zero (a.coeff s) + (Finsupp.mem_support_iff.mp (Finset.mem_of_mem_erase hs))] + +lemma binary_coefficient_normalize (a : MonoidAlgebra (ZMod 2) H) (ha : a ≠ 0) : + ∃ h : H, ∃ S : Finset H, 1 ∉ S ∧ + MonoidAlgebra.single h⁻¹ 1 * a = 1 + ∑ s ∈ S, MonoidAlgebra.single s 1 := by + classical + obtain ⟨h, hh⟩ : ∃ h, a.coeff h ≠ 0 := by + by_contra! hn + apply ha + ext h + exact hn h + have he : (MonoidAlgebra.single h⁻¹ 1 * a).coeff 1 = 1 := by + rw [MonoidAlgebra.coeff_single_mul_eq_mul_coeff h (by simp [inv_mul_eq_one, eq_comm])] + exact one_mul _ |>.trans (zmodTwo_eq_one_of_ne_zero _ hh) + obtain ⟨S, hS, he⟩ := binary_support_expansion _ he + exact ⟨h, S, hS, he⟩ +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/ClosedAlgebra.lean b/lean/OAI/Analysis/GroupDeterminants/ClosedAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf036faa9eb8ef9eeddf04889d6657be25a4f419 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/ClosedAlgebra.lean @@ -0,0 +1,98 @@ +import OAI.Analysis.GroupDeterminants.ProjectionLog + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +section GroupAlgebraClosure +variable {G : Type} [Group G] {n : ℕ} + +theorem complexOperator_single (i j : Fin n) (g : G) (z : ℂ) : + complexOperator (Matrix.single i j (MonoidAlgebra.single g z)) = + z • elementaryOperator i j g := by + classical + unfold complexOperator + simp only [Matrix.single_apply] + rw [Finset.sum_eq_single i] + · rw [Finset.sum_eq_single j] + · simp [MonoidAlgebra.coeff_single, + Finsupp.sum_single_index + (h := fun groupElement coefficient => coefficient • elementaryOperator i j groupElement) + (zero_smul ℂ (elementaryOperator i j g))] + · intro b _ hbj + simp [Ne.symm hbj] + · simp + · intro a _ hai + simp [Ne.symm hai] + · simp + +def finiteGroupAlgebra : Subalgebra ℂ (Hilbert G n →L[ℂ] Hilbert G n) := + complexAlgebraRepresentation.range + +theorem elementaryOperator_mem (i j : Fin n) (g : G) : + elementaryOperator i j g ∈ finiteGroupAlgebra := by + refine ⟨Matrix.single i j (MonoidAlgebra.single g 1), ?_⟩ + exact (complexOperator_single i j g 1).trans (one_smul _ _) + +theorem finiteGroupAlgebra_star {T : Hilbert G n →L[ℂ] Hilbert G n} + (hT : T ∈ finiteGroupAlgebra) : star T ∈ finiteGroupAlgebra := by + classical + obtain ⟨A, rfl⟩ := hT + change star (complexOperator A) ∈ finiteGroupAlgebra + rw [complexOperator, star_sum (R := Hilbert G n →L[ℂ] Hilbert G n)] + apply Subalgebra.sum_mem + intro i _ + rw [star_sum (R := Hilbert G n →L[ℂ] Hilbert G n)] + apply Subalgebra.sum_mem + intro j _ + rw [Finsupp.sum, star_sum (R := Hilbert G n →L[ℂ] Hilbert G n)] + apply Subalgebra.sum_mem + intro g _ + rw [star_smul, elementaryOperator_star] + exact Subalgebra.smul_mem _ (elementaryOperator_mem j i g⁻¹) _ + +def finiteGroupStarAlgebra : StarSubalgebra ℂ (Hilbert G n →L[ℂ] Hilbert G n) := + { finiteGroupAlgebra with star_mem' := finiteGroupAlgebra_star } + +def closedGroupAlgebra : StarSubalgebra ℂ (Hilbert G n →L[ℂ] Hilbert G n) := + finiteGroupStarAlgebra.topologicalClosure + +theorem continuous_groupTrace : Continuous (groupTrace (G := G) (n := n)) := by + have he : (fun T => groupTraceCLM (G := G) (n := n) T) = groupTrace := + funext groupTraceCLM_apply + rw [← he] + exact groupTraceCLM.continuous + +theorem groupTrace_closed_mul_comm {S T : Hilbert G n →L[ℂ] Hilbert G n} + (hS : S ∈ closedGroupAlgebra) (hT : T ∈ closedGroupAlgebra) : + groupTrace (S * T) = groupTrace (T * S) := by + have hfinite {X Y : Hilbert G n →L[ℂ] Hilbert G n} + (hX : X ∈ finiteGroupStarAlgebra) (hY : Y ∈ finiteGroupStarAlgebra) : + groupTrace (X * Y) = groupTrace (Y * X) := by + obtain ⟨A, rfl⟩ := hX + obtain ⟨B, rfl⟩ := hY + exact groupTrace_complex_mul_comm A B + have hleft {X Y : Hilbert G n →L[ℂ] Hilbert G n} + (hX : X ∈ finiteGroupStarAlgebra) (hY : Y ∈ closedGroupAlgebra) : + groupTrace (X * Y) = groupTrace (Y * X) := by + apply closure_minimal (fun Z hZ => hfinite hX hZ) + (isClosed_eq (continuous_groupTrace.comp (continuous_const.mul continuous_id)) + (continuous_groupTrace.comp (continuous_id.mul continuous_const))) hY + exact closure_minimal (fun X hX => hleft hX hT) + (isClosed_eq (continuous_groupTrace.comp (continuous_id.mul continuous_const)) + (continuous_groupTrace.comp (continuous_const.mul continuous_id))) hS + +theorem groupTrace_one : groupTrace (1 : Hilbert G n →L[ℂ] Hilbert G n) = n := by + rw [← complexOperator_one, groupTrace_complex] + simp + +end GroupAlgebraClosure + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/ClosedTrace.lean b/lean/OAI/Analysis/GroupDeterminants/ClosedTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..792fe8f4fc9fa5b6b598053e9151b6f3152264f3 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/ClosedTrace.lean @@ -0,0 +1,120 @@ +import OAI.Analysis.GroupDeterminants.TraceLog + +namespace OAI + +universe uA + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +open Filter Topology + +section SubTrace +variable {A : Type uA} [CStarAlgebra A] +variable (D : StarSubalgebra ℂ A) [IsClosed (D : Set A)] + +def subTrace (τ : A →L[ℝ] ℂ) : D →L[ℝ] ℂ := + τ.comp (D.toSubalgebra.toSubmodule.subtypeL.restrictScalars ℝ) + +@[simp] lemma subTrace_apply (τ : A →L[ℝ] ℂ) (a : D) : subTrace D τ a = τ a := rfl + +lemma subalgebra_log_coe (a : D) (ha : IsSelfAdjoint a) (hu : IsUnit a) : + ((CFC.log a : D) : A) = CFC.log (a : A) := by + exact D.subtype.map_cfc (p := IsSelfAdjoint) (q := IsSelfAdjoint) Real.log a + (Real.continuousOn_log.mono (fun x hx hzero => + (spectrum.zero_notMem_iff ℝ).mpr hu (by simpa only [Set.mem_singleton_iff.mp hzero] using hx))) + continuous_subtype_val ha (ha.map D.subtype) + +lemma subTrace_mul_comm (τ : A →L[ℝ] ℂ) + (hτ : ∀ a ∈ D, ∀ b ∈ D, τ (a * b) = τ (b * a)) (a b : D) : + subTrace D τ (a * b) = subTrace D τ (b * a) := hτ a a.property b b.property + +lemma subTrace_star (τ : A →L[ℝ] ℂ) (hτ : ∀ a, τ (star a) = star (τ a)) (a : D) : + subTrace D τ (star a) = star (subTrace D τ a) := hτ a + +lemma trace_log_shear_invariant_subalgebra (τ : A →L[ℝ] ℂ) + (hτ : ∀ a ∈ D, ∀ b ∈ D, τ (a * b) = τ (b * a)) + (hstar : ∀ a, τ (star a) = star (τ a)) + (B S T : D) (hB : IsUnit B) (hS : S * S = 0) (hT : T * T = 0) + (htS : τ (S : A) = 0) (htT : τ (T : A) = 0) (x : ℝ) : + τ (CFC.log (star ((1 + x • (S : A)) * (B : A) * (1 + x • (T : A))) * + ((1 + x • (S : A)) * (B : A) * (1 + x • (T : A))))) = + τ (CFC.log (star (B : A) * (B : A))) := by + cases subsingleton_or_nontrivial D with + | inl h => + have he : (1 + x • S) * B * (1 + x • T) = B := Subsingleton.elim _ _ + have he' := congrArg (fun a : D => (a : A)) he + change (1 + x • (S : A)) * (B : A) * (1 + x • (T : A)) = (B : A) at he' + rw [he'] + | inr h => + have H := trace_log_shear_invariant (subTrace D τ) (subTrace_mul_comm D τ hτ) + (subTrace_star D τ hstar) B S T hB hS hT htS htT x + have hM : IsUnit ((1 + x • S) * B * (1 + x • T)) := + (((nilpotentShearUnit S hS x).isUnit).mul hB).mul (nilpotentShearUnit T hT x).isUnit + change τ ((CFC.log (star ((1 + x • S) * B * (1 + x • T)) * + ((1 + x • S) * B * (1 + x • T))) : D) : A) = + τ ((CFC.log (star B * B) : D) : A) at H + rw [subalgebra_log_coe _ _ (IsSelfAdjoint.star_mul_self _) (hM.star.mul hM), + subalgebra_log_coe _ _ (IsSelfAdjoint.star_mul_self _) (hB.star.mul hB)] at H + exact H + +end SubTrace + +section ClosedTraceCalculus +variable {G : Type} [Group G] {n : ℕ} + +instance closedGroupAlgebra_isClosed : + IsClosed (closedGroupAlgebra (G := G) (n := n) : Set (Hilbert G n →L[ℂ] Hilbert G n)) := + StarSubalgebra.isClosed_topologicalClosure _ + +def closedRepresentation : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G) →+* + closedGroupAlgebra (G := G) (n := n) := + complexRepresentation.codRestrict closedGroupAlgebra (fun A => + StarSubalgebra.le_topologicalClosure _ ⟨A, rfl⟩) + +@[simp] theorem closedRepresentation_coe (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) : + (closedRepresentation A : Hilbert G n →L[ℂ] Hilbert G n) = complexOperator A := rfl + +theorem groupTrace_log_shear_invariant (B S T : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) + (hB : IsUnit B) (hS : S * S = 0) (hT : T * T = 0) + (htS : ∑ i, (S i i).coeff 1 = 0) (htT : ∑ i, (T i i).coeff 1 = 0) (x : ℝ) : + groupTrace (CFC.log (star ((1 + x • complexOperator S) * complexOperator B * + (1 + x • complexOperator T)) * ((1 + x • complexOperator S) * complexOperator B * + (1 + x • complexOperator T)))) = + groupTrace (CFC.log (star (complexOperator B) * complexOperator B)) := by + let B' := closedRepresentation B + let S' := closedRepresentation S + let T' := closedRepresentation T + have hu : IsUnit B' := hB.map closedRepresentation + have hs : S' * S' = 0 := by simpa [S'] using congrArg closedRepresentation hS + have ht : T' * T' = 0 := by simpa [T'] using congrArg closedRepresentation hT + have hcyc : ∀ a ∈ closedGroupAlgebra (G := G) (n := n), + ∀ b ∈ closedGroupAlgebra (G := G) (n := n), + groupTraceCLM (a * b) = groupTraceCLM (b * a) := by + intro a ha b hb + simp only [groupTraceCLM_apply] + exact groupTrace_closed_mul_comm ha hb + have hstar : ∀ a : Hilbert G n →L[ℂ] Hilbert G n, + groupTraceCLM (star a) = star (groupTraceCLM a) := by + simp only [groupTraceCLM_apply] + exact groupTrace_star + have hts : groupTraceCLM (S' : Hilbert G n →L[ℂ] Hilbert G n) = 0 := by + simpa only [S', closedRepresentation_coe, groupTraceCLM_apply, groupTrace_complex] using htS + have htt : groupTraceCLM (T' : Hilbert G n →L[ℂ] Hilbert G n) = 0 := by + simpa only [T', closedRepresentation_coe, groupTraceCLM_apply, groupTrace_complex] using htT + have H := trace_log_shear_invariant_subalgebra closedGroupAlgebra + (groupTraceCLM.restrictScalars ℝ) hcyc hstar B' S' T' hu hs ht hts htt x + change groupTraceCLM _ = groupTraceCLM _ at H + simp only [groupTraceCLM_apply, S', B', T', closedRepresentation_coe] at H + convert H using 1 + rfl + +end ClosedTraceCalculus + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/CompanionTransfer.lean b/lean/OAI/Analysis/GroupDeterminants/CompanionTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..78ffc781e89373847ac3249d0b6bb703da74c6ee --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/CompanionTransfer.lean @@ -0,0 +1,26 @@ +import OAI.Analysis.GroupDeterminants.ProjectionCriterion + +namespace OAI + +noncomputable section +open scoped BigOperators Pointwise + +namespace GroupRingDeterminant + +theorem main_of_companion_input (input : CompanionInput) : MainStatement := by + obtain ⟨K, hK, hKfinite, hKchar, H, hH, hHfg, a, b, hab, hba⟩ := input + let := hK + let := hKfinite + let := hKchar + let := hH + let := hHfg + obtain ⟨d, hd, X, Y, hXY, hYX⟩ := binary_matrix_of_finite_field K H a b hab hba + let : Nonempty (Fin d) := ⟨⟨0, by omega⟩⟩ + obtain ⟨D, hD, P, hP, hPs, ht, Z, hZ, u, v, huv⟩ := lamp_projection_data X Y hXY hYX + exact projection_criterion D hD P ⟨hP, hPs⟩ ht Z hZ u v huv + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/ComplexRepresentation.lean b/lean/OAI/Analysis/GroupDeterminants/ComplexRepresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f0b2be3f6406bbae2dc666ca8b83c12f4a18e50 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/ComplexRepresentation.lean @@ -0,0 +1,197 @@ +import OAI.Analysis.GroupDeterminants.IntegralTransfer + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +section ComplexRegular +variable {G : Type} [Group G] {n : ℕ} + +def shiftFunctions : G →* Module.End ℂ (G → ℂ) where + toFun g := { + toFun f h := f (g⁻¹ * h) + map_add' _ _ := rfl + map_smul' _ _ := rfl } + map_one' := by ext f h; simp + map_mul' g h := by ext f a; simp [mul_assoc] + +def convolutionHom : MonoidAlgebra ℂ G →ₐ[ℂ] Module.End ℂ (G → ℂ) := + MonoidAlgebra.lift ℂ (Module.End ℂ (G → ℂ)) G shiftFunctions + +theorem convolutionHom_apply (a : MonoidAlgebra ℂ G) (f : G → ℂ) (h : G) : + convolutionHom a f h = a.coeff.sum fun g z => z * f (g⁻¹ * h) := by + simp only [convolutionHom, MonoidAlgebra.lift_apply, Finsupp.sum, + LinearMap.sum_apply, LinearMap.smul_apply, Finset.sum_apply, + Pi.smul_apply, smul_eq_mul] + rfl + +local instance functionModule : Module (MonoidAlgebra ℂ G) (G → ℂ) := + Module.compHom (G → ℂ) convolutionHom.toRingHom + +open scoped Matrix.Module + +def complexOperator (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) : + Hilbert G n →L[ℂ] Hilbert G n := + ∑ i : Fin n, ∑ j : Fin n, (A i j).coeff.sum + (fun g z => z • elementaryOperator i j g) + +theorem complexOperator_apply (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) + (ξ : Hilbert G n) (i : Fin n) (h : G) : + complexOperator A ξ (i, h) = ∑ j : Fin n, + (A i j).coeff.sum fun g z => z * ξ (j, g⁻¹ * h) := by + classical + simp only [complexOperator, Finsupp.sum, sum_apply, + smul_apply, lp.coeFn_sum, Finset.sum_apply, lp.coeFn_smul, + Pi.smul_apply, smul_eq_mul, elementaryOperator_apply] + rw [Finset.sum_eq_single i] + · simp + · intro b _ hbi + simp [Ne.symm hbi] + · simp + +theorem complexOperator_curry (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) + (ξ : Hilbert G n) : + Function.curry (complexOperator A ξ) = A • Function.curry (ξ : Fin n × G → ℂ) := by + funext i h + rw [Matrix.Module.smul_apply] + simp only [Finset.sum_apply] + rw [Function.curry_apply, complexOperator_apply] + apply Finset.sum_congr rfl + intro j _ + exact (convolutionHom_apply (A i j) (fun g => ξ (j, g)) h).symm + +theorem complexOperator_mul (A B : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) : + complexOperator (A * B) = complexOperator A * complexOperator B := by + apply ContinuousLinearMap.ext + intro ξ + apply lp.ext + funext a + obtain ⟨i, h⟩ := a + have he : Function.curry (complexOperator (A * B) ξ) = + Function.curry (complexOperator A (complexOperator B ξ)) := by + rw [complexOperator_curry, mul_smul, complexOperator_curry, complexOperator_curry] + exact congrFun (congrFun he i) h + +theorem complexOperator_one : complexOperator (1 : Matrix (Fin n) (Fin n) + (MonoidAlgebra ℂ G)) = 1 := by + apply ContinuousLinearMap.ext + intro ξ + apply lp.ext + funext a + obtain ⟨i, h⟩ := a + have he := complexOperator_curry (1 : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) ξ + rw [one_smul] at he + exact congrFun (congrFun he i) h + +theorem complexOperator_add (A B : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) : + complexOperator (A + B) = complexOperator A + complexOperator B := by + apply ContinuousLinearMap.ext + intro ξ + apply lp.ext + funext a + obtain ⟨i, h⟩ := a + have he : Function.curry (complexOperator (A + B) ξ) = + Function.curry (complexOperator A ξ) + Function.curry (complexOperator B ξ) := by + rw [complexOperator_curry, add_smul, complexOperator_curry, complexOperator_curry] + exact congrFun (congrFun he i) h + +theorem complexOperator_zero : complexOperator (0 : Matrix (Fin n) (Fin n) + (MonoidAlgebra ℂ G)) = 0 := by + simp [complexOperator, MonoidAlgebra.coeff_zero] + +def complexRepresentation : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G) →+* + (Hilbert G n →L[ℂ] Hilbert G n) where + toFun := complexOperator + map_one' := complexOperator_one + map_mul' := complexOperator_mul + map_zero' := complexOperator_zero + map_add' := complexOperator_add + +theorem complexOperator_isUnit {A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)} + (hA : IsUnit A) : IsUnit (complexOperator A) := hA.map complexRepresentation + +theorem complexOperator_integer (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)) : + complexOperator (A.map (MonoidAlgebra.mapRingHom G (Int.castRingHom ℂ))) = + regularOperator A := by + classical + unfold complexOperator regularOperator + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + change (MonoidAlgebra.map (Int.castRingHom ℂ).toAddMonoidHom (A i j)).coeff.sum _ = _ + rw [MonoidAlgebra.coeff_map] + exact Finsupp.sum_mapRange_index + (h := fun groupElement coefficient => coefficient • elementaryOperator i j groupElement) + (fun groupElement => zero_smul ℂ (elementaryOperator i j groupElement)) + +theorem regularOperator_isUnit {A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)} + (hA : IsUnit (rationalMatrix A)) : IsUnit (regularOperator A) := by + let f : MonoidAlgebra ℚ G →+* MonoidAlgebra ℂ G := + MonoidAlgebra.mapRingHom G (Rat.castHom ℂ) + have h := complexOperator_isUnit (hA.map f.mapMatrix) + have hf : f.comp (MonoidAlgebra.mapRingHom G (Int.castRingHom ℚ)) = + MonoidAlgebra.mapRingHom G (Int.castRingHom ℂ) := by + rw [← MonoidAlgebra.mapRingHom_comp] + congr 1 + change IsUnit (complexOperator (A.map + (f.comp (MonoidAlgebra.mapRingHom G (Int.castRingHom ℚ))))) at h + rw [hf, complexOperator_integer] at h + exact h + +def groupTraceCLM : (Hilbert G n →L[ℂ] Hilbert G n) →L[ℂ] ℂ := + ∑ i : Fin n, (innerSL ℂ (identityVector i)).comp + (ContinuousLinearMap.apply ℂ (Hilbert G n) (identityVector i)) + +theorem groupTraceCLM_apply (T : Hilbert G n →L[ℂ] Hilbert G n) : + groupTraceCLM T = groupTrace T := by + simp [groupTraceCLM, groupTrace] + +theorem groupTrace_complex (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) : + groupTrace (complexOperator A) = ∑ i : Fin n, (A i i).coeff 1 := by + classical + unfold groupTrace + apply Finset.sum_congr rfl + intro i _ + have hi (ξ : Hilbert G n) : inner ℂ (identityVector i) ξ = ξ (i, 1) := by + simp [identityVector, lp.inner_single_left, RCLike.inner_apply] + rw [hi, complexOperator_apply] + rw [Finset.sum_eq_single i] + · rw [(A i i).coeff.sum_eq_single 1] + · simp [identityVector_apply] + · intro g _ hg + simp [identityVector_apply, hg] + · simp + · intro j _ hji + simp [identityVector_apply, hji] + · simp + +theorem coefficient_mul_comm (a b : MonoidAlgebra ℂ G) : + (a * b).coeff 1 = (b * a).coeff 1 := by + rw [MonoidAlgebra.coeff_mul_apply_left a b, MonoidAlgebra.coeff_mul_apply_right b a] + simp only [mul_one, one_mul, mul_comm] + +theorem groupTrace_complex_mul_comm + (A B : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) : + groupTrace (complexOperator A * complexOperator B) = + groupTrace (complexOperator B * complexOperator A) := by + classical + rw [← complexOperator_mul, ← complexOperator_mul, groupTrace_complex, groupTrace_complex] + simp only [Matrix.mul_apply, MonoidAlgebra.coeff_sum, Finsupp.finsetSum_apply] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + exact coefficient_mul_comm _ _ + +end ComplexRegular + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/CyclicAverage.lean b/lean/OAI/Analysis/GroupDeterminants/CyclicAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..9433c92b81943a630e2dda7405683e27024c474d --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/CyclicAverage.lean @@ -0,0 +1,39 @@ +import OAI.Analysis.GroupDeterminants.GroupAlgebraStar + +namespace OAI + +universe uA + +noncomputable section +open scoped BigOperators + +namespace AverageDraft +section Algebra +variable {A : Type uA} [Ring A] [Algebra ℚ A] +def thirdAverage (z : A) : A := (1 / 3 : ℚ) • (1 + z + z * z) +lemma thirdAverage_square (z : A) (hz : z * z * z = 1) : + thirdAverage z * thirdAverage z = thirdAverage z := by + have hz4 : z * z * (z * z) = z := by rw [← mul_assoc, hz, one_mul] + have he : (1 + z + z * z) * (1 + z + z * z) = + (3 : ℚ) • (1 + z + z * z) := by + calc + _ = 1 + z + z + z * z + z * z + z * z + + z * z * z + z * z * z + z * z * (z * z) := by noncomm_ring + _ = _ := by rw [hz, hz4]; simp only [show (3 : ℚ) = 1 + 1 + 1 by norm_num, + add_smul, one_smul]; abel + simp only [thirdAverage, smul_mul_smul_comm, he, smul_smul] + norm_num + +lemma thirdAverage_commute (z w : A) (h : Commute z w) : + Commute (thirdAverage z) (thirdAverage w) := by + apply Commute.smul_left + apply Commute.smul_right + have h' : Commute (1 + z + z * z) w := + ((Commute.one_left _).add_left h).add_left (h.mul_left h) + exact ((Commute.one_right _).add_right h').add_right (h'.mul_right h') +end Algebra +end AverageDraft + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/DefectProjections.lean b/lean/OAI/Analysis/GroupDeterminants/DefectProjections.lean new file mode 100644 index 0000000000000000000000000000000000000000..a91b5dd51a20755690d4cbc9ee2e976f5616633c --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/DefectProjections.lean @@ -0,0 +1,74 @@ +import OAI.Analysis.GroupDeterminants.BinaryMatrices + +namespace OAI + +noncomputable section +open scoped BigOperators Pointwise + +namespace GroupRingDeterminant +open LampDraft LampProjectionDraft +variable {H : Type} [Group H] + +def lampRingEmbedding (R : Type) [Semiring R] : + MonoidAlgebra R H →+* MonoidAlgebra R (LampGroup H) := + MonoidAlgebra.mapDomainRingHom R (shift H) + +lemma lampRingEmbedding_injective (R : Type) [Semiring R] : + Function.Injective (lampRingEmbedding (H := H) R) := by + exact MonoidAlgebra.mapDomain_injective (shift_injective H) + +lemma binaryProjection_isolates {a : MonoidAlgebra (ZMod 2) H} {h : H} {S : Finset H} + (he : MonoidAlgebra.single h⁻¹ 1 * a = 1 + ∑ s ∈ S, MonoidAlgebra.single s 1) : + binaryProjection H S * LampProjectionDraft.shiftSymbol H h⁻¹ * + lampRingEmbedding (ZMod 2) a * binaryProjection H S = binaryProjection H S := by + have hmap := congrArg (lampRingEmbedding (H := H) (ZMod 2)) he + simp only [map_mul, map_add, map_one, map_sum] at hmap + have hn : LampProjectionDraft.shiftSymbol H h⁻¹ * lampRingEmbedding (ZMod 2) a = + 1 + ∑ s ∈ S, LampProjectionDraft.shiftSymbol H s := by + simpa [lampRingEmbedding, LampProjectionDraft.shiftSymbol] using hmap + rw [mul_assoc (binaryProjection H S), hn, mul_add, mul_one, add_mul, + (binaryProjection_idempotent H S).eq, Finset.mul_sum, Finset.sum_mul] + rw [Finset.sum_eq_zero (fun s hs => binaryProjection_separates H S hs), add_zero] + +lemma binary_defect_factorization_lamp {d : Type} [Fintype d] [DecidableEq d] + (X Y : Matrix d d (MonoidAlgebra (ZMod 2) H)) (hXY : X * Y = 1) (hYX : Y * X ≠ 1) : + ∃ S : Finset H, 1 ∉ S ∧ + ∃ u : Matrix (d ⊕ Unit) d (MonoidAlgebra (ZMod 2) (LampGroup H)), + ∃ v : Matrix d (d ⊕ Unit) (MonoidAlgebra (ZMod 2) (LampGroup H)), + u * v = Matrix.fromBlocks 1 0 0 (fun _ _ : Unit => binaryProjection H S) := by + classical + let C := 1 - Y * X + have hC : C ≠ 0 := sub_ne_zero.mpr (Ne.symm hYX) + obtain ⟨i, j, hij⟩ : ∃ i j, C i j ≠ 0 := by + by_contra! he + exact hC (Matrix.ext fun i j => he i j) + obtain ⟨h, S, hS, he⟩ := binary_coefficient_normalize (C i j) hij + let φ := lampRingEmbedding (H := H) (ZMod 2) + let Xm := X.map φ + let Ym := Y.map φ + let Cm := C.map φ + let p := binaryProjection H S + let f : Matrix Unit d (MonoidAlgebra (ZMod 2) (LampGroup H)) := + Matrix.single () i (p * LampProjectionDraft.shiftSymbol H h⁻¹) + let w : Matrix d Unit (MonoidAlgebra (ZMod 2) (LampGroup H)) := Matrix.single j () p + have hXYm : Xm * Ym = 1 := by + change X.map φ * Y.map φ = 1 + rw [← Matrix.map_mul, hXY, Matrix.map_one _ (map_zero _) (map_one _)] + have hCm : Cm = 1 - Ym * Xm := by + dsimp [Cm, C, Ym, Xm] + rw [Matrix.map_sub _ (map_sub _) _ _, Matrix.map_one _ (map_zero _) (map_one _), Matrix.map_mul] + have hfcw : f * Cm * w = fun _ _ : Unit => p := by + apply Matrix.ext + intro a b + cases a; cases b + dsimp only [f, w] + rw [Matrix.mul_single_apply_same, Matrix.single_mul_apply_same] + exact binaryProjection_isolates he + refine ⟨S, hS, Matrix.fromRows Xm (f * Cm), Matrix.fromCols Ym (Cm * w), ?_⟩ + rw [hCm, defect_factorization Xm Ym hXYm f w, ← hCm, hfcw] + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/Defects.lean b/lean/OAI/Analysis/GroupDeterminants/Defects.lean new file mode 100644 index 0000000000000000000000000000000000000000..aab147096105d4006370cad1730aab5d7bce1662 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/Defects.lean @@ -0,0 +1,132 @@ +import OAI.Analysis.GroupDeterminants.Model + +namespace OAI + +universe uR ud ul um ur + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +def CompanionInput : Prop := + ∃ (K : Type) (_ : Field K) (_ : Finite K) (_ : CharP K 2) + (H : Type) (_ : Group H) (_ : Group.FG H) + (a b : MonoidAlgebra K H), a * b = 1 ∧ b * a ≠ 1 + +theorem no_finite_group_input (K H : Type) [Field K] [Finite K] [Group H] [Finite H] + (a b : MonoidAlgebra K H) (h : a * b = 1) : b * a = 1 := by + have : Finite (H →₀ K) := + Finite.of_injective (fun f : H →₀ K => (f : H → K)) DFunLike.coe_injective + have : Finite (MonoidAlgebra K H) := + Finite.of_equiv (H →₀ K) MonoidAlgebra.coeffEquiv.symm + exact mul_eq_one_symm h + +theorem regularOperator_unique {G : Type} [Group G] {n : ℕ} + {A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)} + {T S : Hilbert G n →L[ℂ] Hilbert G n} + (hT : IsRegularOperator A T) (hS : IsRegularOperator A S) : T = S := by + ext ξ ⟨i, h⟩ + exact (hT ξ i h).trans (hS ξ i h).symm + +theorem fkDet_pos {G : Type} [Group G] {n : ℕ} + (T : Hilbert G n →L[ℂ] Hilbert G n) : 0 < fkDet T := + Real.exp_pos _ + +section Defect +variable {R : Type uR} [Ring R] + +theorem defect_idempotent {x y : R} (h : x * y = 1) : + (1 - y * x) * (1 - y * x) = 1 - y * x := by + have hy : y * x * (y * x) = y * x := by + calc + y * x * (y * x) = y * (x * y) * x := by simp only [mul_assoc] + _ = y * x := by rw [h, mul_one] + calc + (1 - y * x) * (1 - y * x) = 1 - y * x - y * x + y * x * (y * x) := by + noncomm_ring + _ = 1 - y * x := by rw [hy]; noncomm_ring + +theorem mul_defect {x y : R} (h : x * y = 1) : x * (1 - y * x) = 0 := by + simp only [mul_sub, mul_one, ← mul_assoc, h, one_mul, sub_self] + +theorem defect_mul {x y : R} (h : x * y = 1) : (1 - y * x) * y = 0 := by + simp only [sub_mul, one_mul, mul_assoc, h, mul_one, sub_self] + +theorem defect_ne_zero {x y : R} (h : y * x ≠ 1) : 1 - y * x ≠ 0 := by + exact sub_ne_zero.mpr h.symm + +end Defect + +section MatrixDefect +variable {R : Type uR} {d : Type ud} {l : Type ul} [Ring R] [Fintype d] [DecidableEq d] + +theorem defect_factorization (X Y : Matrix d d R) (hXY : X * Y = 1) + (f : Matrix l d R) (w : Matrix d l R) : + Matrix.fromRows X (f * (1 - Y * X)) * Matrix.fromCols Y ((1 - Y * X) * w) = + Matrix.fromBlocks 1 0 0 (f * (1 - Y * X) * w) := by + rw [Matrix.fromRows_mul_fromCols, hXY] + congr 1 + · rw [← Matrix.mul_assoc, mul_defect hXY, Matrix.zero_mul] + · rw [Matrix.mul_assoc, defect_mul hXY, Matrix.mul_zero] + · rw [← Matrix.mul_assoc, Matrix.mul_assoc f, defect_idempotent hXY] + +end MatrixDefect + +section CornerLifting +variable {R : Type uR} [Ring R] + +def cornerSeries (e z : R) (k : ℕ) : R := + e * ∑ i ∈ Finset.range k, (e - z) ^ i + +theorem cornerSeries_spec (e z : R) (he : e * e = e) + (hez : e * z = z) (hze : z * e = z) (k : ℕ) (hk : (e - z) ^ k = 0) : + cornerSeries e z k * z = e ∧ z * cornerSeries e z k = e ∧ + e * cornerSeries e z k = cornerSeries e z k ∧ + cornerSeries e z k * e = cornerSeries e z k := by + let w := e - z + let s := ∑ i ∈ Finset.range k, w ^ i + have hew : e * w = w := by simp only [w, mul_sub, he, hez] + have hwe : w * e = w := by simp only [w, sub_mul, he, hze] + have hew' : Commute e w := hew.trans hwe.symm + have hes : Commute e s := + Commute.sum_right _ _ _ (fun i _ => hew'.pow_right i) + have hz : z = e * (1 - w) := by simp only [mul_sub, mul_one, hew, w]; noncomm_ring + have hinv : s * (1 - w) = 1 := by + simpa only [w, hk, sub_zero] using geom_sum_mul_neg w k + have hinv' : (1 - w) * s = 1 := by + simpa only [w, hk, sub_zero] using mul_neg_geom_sum w k + change (e * s) * z = e ∧ z * (e * s) = e ∧ + e * (e * s) = e * s ∧ (e * s) * e = e * s + have hq : (e * s) * e = e * s := by + rw [mul_assoc, ← hes.eq, ← mul_assoc, he] + refine ⟨?_, ?_, ?_, hq⟩ + · rw [hz, ← mul_assoc, hq, mul_assoc, hinv, mul_one] + · calc + z * (e * s) = z * s := by rw [← mul_assoc, hze] + _ = e := by rw [hz, mul_assoc, hinv', mul_one] + · rw [← mul_assoc, he] + +theorem lift_rectangular_factorization {m : Type um} {r : Type ur} [Fintype m] [DecidableEq m] + [Fintype r] (e : Matrix m m R) (he : e * e = e) + (u₀ : Matrix m r R) (v₀ : Matrix r m R) (k : ℕ) + (hk : (e - e * u₀ * v₀ * e) ^ k = 0) : + ∃ u : Matrix m r R, ∃ v : Matrix r m R, u * v = e := by + let z := e * u₀ * v₀ * e + have hez : e * z = z := by + dsimp [z] + rw [← Matrix.mul_assoc, ← Matrix.mul_assoc, ← Matrix.mul_assoc, he] + have hze : z * e = z := by + dsimp [z] + rw [Matrix.mul_assoc (e * u₀ * v₀), he] + obtain ⟨hqz, _, _, _⟩ := cornerSeries_spec e z he hez hze k hk + refine ⟨cornerSeries e z k * e * u₀, v₀ * e, ?_⟩ + simpa only [z, Matrix.mul_assoc] using hqz + +end CornerLifting + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/FiniteFields.lean b/lean/OAI/Analysis/GroupDeterminants/FiniteFields.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b0f1858904ab382adc59277a832fa0687b9f245 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/FiniteFields.lean @@ -0,0 +1,109 @@ +import OAI.Analysis.GroupDeterminants.ClosedAlgebra + +namespace OAI + +universe uK uF uG ud + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +section FiniteFieldPassage + +variable {K : Type uK} {F : Type uF} {G : Type uG} {d : Type ud} [Semiring K] [Semiring F] [Monoid G] +variable [Fintype d] [DecidableEq d] + +def coeffMatrix (φ : K →+* Matrix d d F) (a : MonoidAlgebra K G) : + Matrix d d (MonoidAlgebra F G) := fun i j => + MonoidAlgebra.ofCoeff (a.coeff.mapRange (fun k => φ k i j) (by simp)) + +omit [Monoid G] in +@[simp] theorem coeffMatrix_coeff (φ : K →+* Matrix d d F) (a : MonoidAlgebra K G) + (i j : d) (g : G) : (coeffMatrix φ a i j).coeff g = φ (a.coeff g) i j := rfl + +omit [Monoid G] in +@[simp] theorem coeffMatrix_single (φ : K →+* Matrix d d F) (g : G) (k : K) : + coeffMatrix φ (MonoidAlgebra.single g k) = Matrix.of (fun i j => MonoidAlgebra.single g (φ k i j)) := by + ext i j h + classical + by_cases h = g <;> simp_all [coeffMatrix_coeff, MonoidAlgebra.coeff_single] + +@[simp] theorem coeffMatrix_zero (φ : K →+* Matrix d d F) : coeffMatrix (G := G) φ 0 = 0 := by + ext i j h + simp + +@[simp] theorem coeffMatrix_add (φ : K →+* Matrix d d F) (a b : MonoidAlgebra K G) : + coeffMatrix φ (a + b) = coeffMatrix φ a + coeffMatrix φ b := by + ext i j h + simp + +theorem coeffMatrix_mul_single (φ : K →+* Matrix d d F) (g h : G) (k l : K) : + coeffMatrix φ (MonoidAlgebra.single g k * MonoidAlgebra.single h l) = + coeffMatrix φ (MonoidAlgebra.single g k) * coeffMatrix φ (MonoidAlgebra.single h l) := by + classical + apply Matrix.ext + intro i j + simp only [MonoidAlgebra.single_mul_single, coeffMatrix_single, map_mul, Matrix.mul_apply, Matrix.of_apply] + ext t + simp only [MonoidAlgebra.coeff_sum, Finsupp.finsetSum_apply, MonoidAlgebra.coeff_single] + by_cases ht : g * h = t <;> simp [ht] + +theorem coeffMatrix_mul (φ : K →+* Matrix d d F) (a b : MonoidAlgebra K G) : + coeffMatrix φ (a * b) = coeffMatrix φ a * coeffMatrix φ b := by + induction a using MonoidAlgebra.induction_linear with + | zero => simp + | single g k => + induction b using MonoidAlgebra.induction_linear with + | zero => simp + | single h l => exact coeffMatrix_mul_single φ g h k l + | add x y hx hy => simp_all [mul_add] + | add x y hx hy => simp_all [add_mul] + +@[simp] theorem coeffMatrix_one (φ : K →+* Matrix d d F) : coeffMatrix (G := G) φ 1 = 1 := by + classical + apply Matrix.ext + intro i j + by_cases hij : i = j <;> simp [MonoidAlgebra.one_def, Matrix.one_apply, hij] + +def coeffMatrixHom (φ : K →+* Matrix d d F) : + MonoidAlgebra K G →+* Matrix d d (MonoidAlgebra F G) where + toFun := coeffMatrix φ + map_one' := coeffMatrix_one φ + map_mul' := coeffMatrix_mul φ + map_zero' := coeffMatrix_zero φ + map_add' := coeffMatrix_add φ + +theorem coeffMatrix_injective (φ : K →+* Matrix d d F) (hφ : Function.Injective φ) : + Function.Injective (coeffMatrixHom (G := G) φ) := by + intro a b hab + ext g + apply hφ + ext i j + exact congrArg (fun A : Matrix d d (MonoidAlgebra F G) => (A i j).coeff g) hab + + theorem binary_matrix_of_finite_field (K H : Type) [Field K] [Finite K] [CharP K 2] + [Group H] (a b : MonoidAlgebra K H) (hab : a * b = 1) (hba : b * a ≠ 1) : + ∃ d : ℕ, 1 ≤ d ∧ ∃ X Y : Matrix (Fin d) (Fin d) (MonoidAlgebra (ZMod 2) H), + X * Y = 1 ∧ Y * X ≠ 1 := by + let : Algebra (ZMod 2) K := (ZMod.castHom (by simp) K).toAlgebra + let d := Module.finrank (ZMod 2) K + let φ : K →+* Matrix (Fin d) (Fin d) (ZMod 2) := + (Algebra.leftMulMatrix (Module.finBasis (ZMod 2) K)).toRingHom + have hφ : Function.Injective φ := Algebra.leftMulMatrix_injective _ + let f : MonoidAlgebra K H →+* Matrix (Fin d) (Fin d) (MonoidAlgebra (ZMod 2) H) := + coeffMatrixHom φ + refine ⟨d, Module.finrank_pos, f a, f b, ?_, ?_⟩ + · rw [← map_mul, hab, map_one] + · intro h + apply hba + apply coeffMatrix_injective φ hφ + simpa [f] using h + +end FiniteFieldPassage + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/GroupAlgebraStar.lean b/lean/OAI/Analysis/GroupDeterminants/GroupAlgebraStar.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae7f2cfa5f03fbb1d225da0bd93cb62683e868f1 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/GroupAlgebraStar.lean @@ -0,0 +1,88 @@ +import OAI.Analysis.GroupDeterminants.WeightedProjections + +namespace OAI + +universe uR uG uF uS uH + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +section GroupStar +variable {R : Type uR} {G : Type uG} [Semiring R] [StarRing R] [Group G] + +def groupStar (a : MonoidAlgebra R G) : MonoidAlgebra R G := + MonoidAlgebra.mapDomainAddEquiv R (Equiv.inv G) + (MonoidAlgebra.map (starAddEquiv : R ≃+ R).toAddMonoidHom a) + +@[simp] lemma groupStar_coeff (a : MonoidAlgebra R G) (g : G) : + (groupStar a).coeff g = star (a.coeff g⁻¹) := by + simp [groupStar, MonoidAlgebra.coeff_mapDomainAddEquiv] + +@[simp] lemma groupStar_single (g : G) (r : R) : + groupStar (MonoidAlgebra.single g r) = MonoidAlgebra.single g⁻¹ (star r) := by + classical + ext h + simp only [groupStar_coeff, MonoidAlgebra.coeff_single] + by_cases hh : g = h⁻¹ + · have he : g⁻¹ = h := by rw [hh, inv_inv] + simp [hh] + · have he : g⁻¹ ≠ h := fun he => hh (by rw [← he, inv_inv]) + simp [hh, he] + +@[simp] lemma groupStar_zero : groupStar (0 : MonoidAlgebra R G) = 0 := by ext; simp + +@[simp] lemma groupStar_add (a b : MonoidAlgebra R G) : + groupStar (a + b) = groupStar a + groupStar b := by ext; simp + +@[simp] lemma groupStar_star (a : MonoidAlgebra R G) : groupStar (groupStar a) = a := by ext; simp + +lemma groupStar_mul (a b : MonoidAlgebra R G) : groupStar (a * b) = groupStar b * groupStar a := by + induction a using MonoidAlgebra.induction_linear with + | zero => simp + | add a b ha hb => simp only [add_mul, groupStar_add, ha, hb, mul_add] + | single g r => + induction b using MonoidAlgebra.induction_linear with + | zero => simp + | add a b ha hb => simp only [mul_add, groupStar_add, ha, hb, add_mul] + | single h s => simp [MonoidAlgebra.single_mul_single] + +instance groupAlgebraStar : StarRing (MonoidAlgebra R G) where + star := groupStar + star_involutive := groupStar_star + star_mul := groupStar_mul + star_add := groupStar_add + +@[simp] lemma star_groupAlgebra_coeff (a : MonoidAlgebra R G) (g : G) : + (star a).coeff g = star (a.coeff g⁻¹) := groupStar_coeff a g + +@[simp] lemma star_groupAlgebra_single (g : G) (r : R) : + star (MonoidAlgebra.single g r) = MonoidAlgebra.single g⁻¹ (star r) := groupStar_single g r + +instance groupAlgebraStarModule {F : Type uF} [CommSemiring F] [StarRing F] + [Algebra F R] [StarModule F R] : StarModule F (MonoidAlgebra R G) where + star_smul c a := by ext; simp + +variable {S : Type uS} [Semiring S] [StarRing S] +lemma groupAlgebra_map_star (f : R →+* S) (hf : ∀ r, f (star r) = star (f r)) + (a : MonoidAlgebra R G) : + MonoidAlgebra.mapRingHom G f (star a) = star (MonoidAlgebra.mapRingHom G f a) := by + ext g + simp [hf] + +variable {H : Type uH} [Group H] +lemma groupAlgebra_mapDomain_star (f : G →* H) (a : MonoidAlgebra R G) : + MonoidAlgebra.mapDomainRingHom R f (star a) = star (MonoidAlgebra.mapDomainRingHom R f a) := by + induction a using MonoidAlgebra.induction_linear with + | zero => simp + | add a b ha hb => simp only [star_add, map_add, ha, hb] + | single g r => simp + +end GroupStar + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/IndexedRepresentation.lean b/lean/OAI/Analysis/GroupDeterminants/IndexedRepresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a55745c32dc4c1a4e4e7dda4336cacf42cf85e03 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/IndexedRepresentation.lean @@ -0,0 +1,64 @@ +import OAI.Analysis.GroupDeterminants.ProjectionData + +namespace OAI + +noncomputable section +open scoped BigOperators Pointwise + +namespace GroupRingDeterminant +section OperatorStar +variable {G : Type} [Group G] {n : ℕ} + +lemma complexOperator_star (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) : + complexOperator (star A) = star (complexOperator A) := by + classical + induction A using Matrix.induction_on' with + | h_zero => simp [complexOperator_zero, star_zero (R := Hilbert G n →L[ℂ] Hilbert G n)] + | h_add A B hA hB => + simp only [star_add, complexOperator_add, hA, hB, + star_add (R := Hilbert G n →L[ℂ] Hilbert G n)] + | h_std_basis i j a => + induction a using MonoidAlgebra.induction_linear with + | zero => simp [complexOperator_zero, star_zero (R := Hilbert G n →L[ℂ] Hilbert G n)] + | add a b ha hb => + simp only [Matrix.single_add, star_add, complexOperator_add, ha, hb, + star_add (R := Hilbert G n →L[ℂ] Hilbert G n)] + | single g z => + change complexOperator (Matrix.conjTranspose _) = _ + rw [Matrix.conjTranspose_single, star_groupAlgebra_single, + complexOperator_single, complexOperator_single, star_smul, elementaryOperator_star] + +end OperatorStar + +section IndexedRepresentation +variable {G I : Type} [Group G] [Fintype I] [DecidableEq I] + +def indexedComplexRepresentation : Matrix I I (MonoidAlgebra ℂ G) →ₐ[ℂ] + (Hilbert G (Fintype.card I) →L[ℂ] Hilbert G (Fintype.card I)) := + complexAlgebraRepresentation.comp (Matrix.reindexAlgEquiv ℂ (MonoidAlgebra ℂ G) + (Fintype.equivFin I)).toAlgHom + +lemma indexedComplexRepresentation_trace (A : Matrix I I (MonoidAlgebra ℂ G)) : + groupTrace (indexedComplexRepresentation A) = ∑ i, (A i i).coeff 1 := by + rw [show indexedComplexRepresentation A = complexOperator + (Matrix.reindex (Fintype.equivFin I) (Fintype.equivFin I) A) from rfl, + groupTrace_complex] + exact (Fintype.equivFin I).symm.sum_comp (fun i => (A i i).coeff 1) + +lemma indexedComplexRepresentation_star (A : Matrix I I (MonoidAlgebra ℂ G)) : + indexedComplexRepresentation (star A) = star (indexedComplexRepresentation A) := by + change complexOperator (Matrix.reindex _ _ (Matrix.conjTranspose A)) = + star (complexOperator (Matrix.reindex _ _ A)) + rw [← Matrix.conjTranspose_reindex] + exact complexOperator_star _ + +lemma indexedComplexRepresentation_mem (A : Matrix I I (MonoidAlgebra ℂ G)) : + indexedComplexRepresentation A ∈ closedGroupAlgebra := + StarSubalgebra.le_topologicalClosure _ ⟨_, rfl⟩ + +end IndexedRepresentation +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/IntegralTransfer.lean b/lean/OAI/Analysis/GroupDeterminants/IntegralTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..06398ebe9f7f11845426631f4eed526521559e0a --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/IntegralTransfer.lean @@ -0,0 +1,209 @@ +import OAI.Analysis.GroupDeterminants.RegularTrace + +namespace OAI + +universe uG um ur + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +section IntegralTransfer +variable {G : Type uG} {m : Type um} {r : Type ur} [Group G] [Fintype m] [DecidableEq m] + [Fintype r] [DecidableEq r] + +def divideGroup (q : ℕ) (a : MonoidAlgebra ℤ G) : MonoidAlgebra ℤ G := + MonoidAlgebra.ofCoeff (a.coeff.mapRange (fun z => z / (q : ℤ)) (by simp)) + +theorem kernel_integerReduction (q : ℕ) (a : MonoidAlgebra ℤ G) + (ha : MonoidAlgebra.mapRingHom G (Int.castRingHom (ZMod q)) a = 0) : + (q : ℤ) • divideGroup q a = a := by + apply MonoidAlgebra.ext + ext g + have hg := congrArg (fun x : MonoidAlgebra (ZMod q) G => x.coeff g) ha + change (a.coeff g : ZMod q) = 0 at hg + have hd : (q : ℤ) ∣ a.coeff g := (ZMod.intCast_zmod_eq_zero_iff_dvd _ q).mp (by + simpa only [MonoidAlgebra.coeff_mapRingHom, + MonoidAlgebra.coeff_zero, Finsupp.zero_apply] using hg) + rw [MonoidAlgebra.coeff_smul] + change (q : ℤ) * (a.coeff g / (q : ℤ)) = a.coeff g + exact Int.mul_ediv_cancel' hd + +def toRat : MonoidAlgebra ℤ G →+* MonoidAlgebra ℚ G := + MonoidAlgebra.mapRingHom G (Int.castRingHom ℚ) + +def toMod (q : ℕ) : MonoidAlgebra ℤ G →+* MonoidAlgebra (ZMod q) G := + MonoidAlgebra.mapRingHom G (Int.castRingHom (ZMod q)) + +omit [Fintype m] [DecidableEq m] [Fintype r] [DecidableEq r] in +theorem map_toRat_zsmul (t : ℤ) (A : Matrix m r (MonoidAlgebra ℤ G)) : + (t • A).map toRat = (t : ℚ) • A.map toRat := by + rw [Int.cast_smul_eq_zsmul] + exact Matrix.map_smul _ _ (fun a => map_zsmul toRat _ a) _ + +theorem integral_transfer_of_lifts (q : ℕ) (hq : q ≠ 0) + (P : Matrix m m (MonoidAlgebra ℚ G)) (hP : P * P = P) + (C : Matrix m m (MonoidAlgebra ℤ G)) + (hC : C.map toRat = P + (q : ℚ) • (1 - P)) + (U : Matrix m r (MonoidAlgebra ℤ G)) (V : Matrix r m (MonoidAlgebra ℤ G)) + (huv : (U * V).map (toMod q) = C.map (toMod q)) : + ∃ A : Matrix (r ⊕ m) (r ⊕ m) (MonoidAlgebra ℤ G), + A.map toRat = transferMatrix (q : ℚ) P (U.map toRat) (V.map toRat) ∧ + IsUnit (A.map toRat) := by + let W : Matrix m m (MonoidAlgebra ℤ G) := fun i j => divideGroup q ((U * V - C) i j) + have hw : (q : ℤ) • W = U * V - C := by + apply Matrix.ext + intro i j + apply kernel_integerReduction + have h := congrFun (congrFun huv i) j + change toMod q ((U * V) i j - C i j) = 0 + rw [map_sub, sub_eq_zero] + exact h + have hwq := congrArg (fun A : Matrix m m (MonoidAlgebra ℤ G) => A.map toRat) hw + rw [map_toRat_zsmul, Int.cast_natCast, Matrix.map_sub _ (map_sub _) _ _, Matrix.map_mul, hC] at hwq + have hq' : (q : ℚ) ≠ 0 := Nat.cast_ne_zero.mpr hq + have hw' : W.map toRat = (q : ℚ)⁻¹ • + (U.map toRat * V.map toRat - P - (q : ℚ) • (1 - P)) := by + rw [sub_sub, ← hwq, smul_smul, inv_mul_cancel₀ hq', one_smul] + refine ⟨Matrix.fromBlocks ((q : ℤ) • 1) V U W, ?_, ?_⟩ + · rw [Matrix.fromBlocks_map, map_toRat_zsmul, + Int.cast_natCast, Matrix.map_one _ (map_zero _) (map_one _), hw'] + rfl + · rw [Matrix.fromBlocks_map, map_toRat_zsmul, + Int.cast_natCast, Matrix.map_one _ (map_zero _) (map_one _), hw'] + exact transferMatrix_isUnit (q : ℚ) hq' P hP (U.map toRat) (V.map toRat) + +omit [Fintype m] [DecidableEq m] [Fintype r] [DecidableEq r] in +theorem map_toMod_zsmul (q : ℕ) (t : ℤ) (A : Matrix m r (MonoidAlgebra ℤ G)) : + (t • A).map (toMod q) = (t : ZMod q) • A.map (toMod q) := by + rw [Int.cast_smul_eq_zsmul] + exact Matrix.map_smul _ _ (fun a => map_zsmul (toMod q) _ a) _ + +omit [Fintype m] [DecidableEq m] [Fintype r] [DecidableEq r] in +theorem reduceGroupTwo_toMod (k : ℕ) (hk : 0 < k) (a : MonoidAlgebra ℤ G) : + reduceGroupTwo k hk (toMod (2 ^ k) a) = toMod 2 a := by + apply MonoidAlgebra.ext + ext g + simp only [reduceGroupTwo, toMod, MonoidAlgebra.coeff_mapRingHom] + exact map_intCast (reduceTwo k hk) _ + +omit [DecidableEq m] [Fintype r] [DecidableEq r] in +theorem integer_projection_square (P : Matrix m m (MonoidAlgebra ℚ G)) + (hP : P * P = P) (D : ℤ) (Z : Matrix m m (MonoidAlgebra ℤ G)) + (hZ : Z.map toRat = (D : ℚ) • P) : Z * Z = D • Z := by + have hi : Function.Injective (toRat (G := G)) := + MonoidAlgebra.map_injective (Int.castRingHom ℚ).toAddMonoidHom Int.cast_injective + apply Matrix.map_injective hi + change (Z * Z).map toRat = (D • Z).map toRat + rw [Matrix.map_mul, map_toRat_zsmul, hZ, Matrix.smul_mul, Matrix.mul_smul, hP] + +omit [Fintype r] [DecidableEq r] in + +theorem integral_reweight_mod_idempotent (q : ℕ) (D t : ℤ) + (hDt : D * t = 1 - (q : ℤ)) (Z : Matrix m m (MonoidAlgebra ℤ G)) + (hZ : Z * Z = D • Z) : + let C := (q : ℤ) • (1 : Matrix m m (MonoidAlgebra ℤ G)) + t • Z + C.map (toMod q) * C.map (toMod q) = C.map (toMod q) := by + dsimp only + have hqt : ((q : ℤ) : ZMod q) = 0 := by simp + have hdt : (D : ZMod q) * (t : ZMod q) = 1 := by + have h := congrArg (fun z : ℤ => (z : ZMod q)) hDt + simpa using h + have hzz : Z.map (toMod q) * Z.map (toMod q) = (D : ZMod q) • Z.map (toMod q) := by + rw [← Matrix.map_mul, hZ, map_toMod_zsmul] + simp only [Matrix.map_add _ (map_add _) _ _, map_toMod_zsmul, hqt, + zero_smul, zero_add] + rw [Matrix.smul_mul, Matrix.mul_smul, hzz, smul_smul, smul_smul] + congr 1 + calc + (t : ZMod q) * (t : ZMod q) * (D : ZMod q) = (t : ZMod q) * ((D : ZMod q) * t) := by ring + _ = (t : ZMod q) := by rw [hdt, mul_one] + +omit [Fintype m] [Fintype r] [DecidableEq r] in +theorem integral_reweight_rational (q : ℕ) (D t : ℤ) + (hDt : D * t = 1 - (q : ℤ)) (Z : Matrix m m (MonoidAlgebra ℤ G)) + (P : Matrix m m (MonoidAlgebra ℚ G)) (hZ : Z.map toRat = (D : ℚ) • P) : + ((q : ℤ) • (1 : Matrix m m (MonoidAlgebra ℤ G)) + t • Z).map toRat = + P + (q : ℚ) • (1 - P) := by + have hdt : (t : ℚ) * (D : ℚ) = 1 - (q : ℚ) := by + have h := congrArg (fun z : ℤ => (z : ℚ)) hDt + simpa [mul_comm] using h + rw [Matrix.map_add _ (map_add _) _ _, map_toRat_zsmul, map_toRat_zsmul, + Matrix.map_one _ (map_zero _) (map_one _), hZ, smul_smul, hdt] + simp only [Int.cast_natCast, sub_smul, one_smul, smul_sub] + abel + +theorem integral_transfer (D : ℕ) (hodd : Odd D) + (P : Matrix m m (MonoidAlgebra ℚ G)) (hP : P * P = P) + (Z : Matrix m m (MonoidAlgebra ℤ G)) (hZ : Z.map toRat = (D : ℚ) • P) + (u : Matrix m r (MonoidAlgebra (ZMod 2) G)) + (v : Matrix r m (MonoidAlgebra (ZMod 2) G)) (huv : u * v = Z.map (toMod 2)) + (k : ℕ) (hk : 0 < k) (t : ℤ) (hDt : (D : ℤ) * t = 1 - (2 ^ k : ℕ)) : + ∃ (U : Matrix m r (MonoidAlgebra ℤ G)) (V : Matrix r m (MonoidAlgebra ℤ G)) + (A : Matrix (r ⊕ m) (r ⊕ m) (MonoidAlgebra ℤ G)), + A.map toRat = transferMatrix ((2 ^ k : ℕ) : ℚ) P (U.map toRat) (V.map toRat) ∧ + IsUnit (A.map toRat) := by + classical + let q : ℕ := 2 ^ k + let C : Matrix m m (MonoidAlgebra ℤ G) := (q : ℤ) • 1 + t • Z + let e : Matrix m m (MonoidAlgebra (ZMod q) G) := C.map (toMod q) + have hZZ : Z * Z = (D : ℤ) • Z := + integer_projection_square P hP D Z (by simpa using hZ) + have he : e * e = e := integral_reweight_mod_idempotent q D t hDt Z hZZ + have htwo : (2 : ZMod 2) = 0 := by decide + have hD2 : (D : ZMod 2) = 1 := by + obtain ⟨a, rfl⟩ := hodd + simp only [Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat, htwo, zero_mul, + zero_add, Nat.cast_one] + have hq2 : (q : ZMod 2) = 0 := by + simp only [q, Nat.cast_pow, Nat.cast_ofNat, htwo, zero_pow hk.ne'] + have ht2 : (t : ZMod 2) = 1 := by + have h := congrArg (fun z : ℤ => (z : ZMod 2)) hDt + push_cast at h + simpa only [hD2, htwo, zero_pow hk.ne', one_mul, sub_zero] using h + have hC2 : C.map (toMod 2) = Z.map (toMod 2) := by + simp only [C, Matrix.map_add _ (map_add _) _ _, map_toMod_zsmul, + Int.cast_natCast, hq2, ht2, zero_smul, one_smul, zero_add] + have he2 : e.map (reduceGroupTwo k hk) = C.map (toMod 2) := by + apply Matrix.ext + intro i j + exact reduceGroupTwo_toMod k hk (C i j) + obtain ⟨u', v', hu'v'⟩ := lift_binary_factorization k hk e he u v (by + rw [he2, hC2] + exact huv) + have hs := integerReduction_surjective (G := G) q + choose U₀ hU₀ using fun i j => hs (u' i j) + choose V₀ hV₀ using fun i j => hs (v' i j) + let U : Matrix m r (MonoidAlgebra ℤ G) := U₀ + let V : Matrix r m (MonoidAlgebra ℤ G) := V₀ + have hU : U.map (toMod q) = u' := Matrix.ext hU₀ + have hV : V.map (toMod q) = v' := Matrix.ext hV₀ + have hUV : (U * V).map (toMod q) = C.map (toMod q) := by + rw [Matrix.map_mul, hU, hV, hu'v'] + have hC : C.map toRat = P + (q : ℚ) • (1 - P) := + integral_reweight_rational q D t hDt Z P (by simpa using hZ) + obtain ⟨A, ha, haunit⟩ := integral_transfer_of_lifts q + (pow_ne_zero _ (by decide)) P hP C hC U V hUV + exact ⟨U, V, A, ha, haunit⟩ + +theorem integral_transfer_of_congruence (D : ℕ) (hodd : Odd D) + (P : Matrix m m (MonoidAlgebra ℚ G)) (hP : P * P = P) + (Z : Matrix m m (MonoidAlgebra ℤ G)) (hZ : Z.map toRat = (D : ℚ) • P) + (u : Matrix m r (MonoidAlgebra (ZMod 2) G)) + (v : Matrix r m (MonoidAlgebra (ZMod 2) G)) (huv : u * v = Z.map (toMod 2)) + (k : ℕ) (hk : 0 < k) (hkD : Nat.ModEq D (2 ^ k) 1) : + ∃ (U : Matrix m r (MonoidAlgebra ℤ G)) (V : Matrix r m (MonoidAlgebra ℤ G)) + (A : Matrix (r ⊕ m) (r ⊕ m) (MonoidAlgebra ℤ G)), + A.map toRat = transferMatrix ((2 ^ k : ℕ) : ℚ) P (U.map toRat) (V.map toRat) ∧ + IsUnit (A.map toRat) := by + obtain ⟨t, ht⟩ := Nat.modEq_iff_dvd.mp hkD + exact integral_transfer D hodd P hP Z hZ u v huv k hk t (by simpa using ht.symm) + +end IntegralTransfer + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/LampCoefficients.lean b/lean/OAI/Analysis/GroupDeterminants/LampCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..e85bd6ef61a23e935bd0fc65b34e7f9f4be4bb73 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/LampCoefficients.lean @@ -0,0 +1,141 @@ +import OAI.Analysis.GroupDeterminants.LampProjections + +namespace OAI + +universe uH uR + +noncomputable section +open scoped BigOperators Pointwise + +namespace LampProjectionDraft +open LampDraft AverageDraft SupportDraft GroupRingDeterminant +variable (H : Type uH) [Group H] +local instance : DecidableEq H := Classical.decEq H + +variable (R : Type uR) [CommRing R] +def baseEmbedding : MonoidAlgebra R (BaseGroup H) →+* MonoidAlgebra R (LampGroup H) := + MonoidAlgebra.mapDomainRingHom R (BaseGroup H).subtype + +lemma baseEmbedding_injective : Function.Injective (baseEmbedding H R) := by + exact MonoidAlgebra.mapDomain_injective (Subgroup.subtype_injective (BaseGroup H)) + +@[simp] lemma baseEmbedding_coeff_one (a : MonoidAlgebra R (BaseGroup H)) : + (baseEmbedding H R a).coeff 1 = a.coeff 1 := by + exact Finsupp.mapDomain_apply_of_injective (Subgroup.subtype_injective (BaseGroup H)) a.coeff 1 + +variable {R} +def fullLampSymbol (h : H) : MonoidAlgebra R (LampGroup H) := MonoidAlgebra.single (lamp H h) 1 + +def shiftSymbol (h : H) : MonoidAlgebra R (LampGroup H) := MonoidAlgebra.single (shift H h) 1 + +lemma shiftSymbol_one_lamp (s : H) : + shiftSymbol H s * fullLampSymbol H (R := R) 1 = fullLampSymbol H s * shiftSymbol H s := by + simp only [shiftSymbol, fullLampSymbol, MonoidAlgebra.single_mul_single, one_mul] + congr 1 + have he := shift_conjugate_lamp H s 1 + simpa using (mul_inv_eq_iff_eq_mul.mp (by simpa using he)) + +def projection (S : Finset H) : MonoidAlgebra ℚ (LampGroup H) := + baseEmbedding H ℚ (baseProjection H S) + +def average (h : H) : MonoidAlgebra ℚ (LampGroup H) := baseEmbedding H ℚ (baseAverage H h) + +lemma average_def (h : H) : average H h = thirdAverage (fullLampSymbol H h) := by + unfold average baseAverage thirdAverage + change _ = (1 / 3 : ℚ) • (1 + _ + _) + rw [show (baseEmbedding H ℚ) ((1 / 3 : ℚ) • _) = (1 / 3 : ℚ) • + (baseEmbedding H ℚ) _ from map_rat_smul _ _ _] + simp only [map_add, map_one, map_mul] + simp [baseEmbedding, fullLampSymbol, baseLamp] + +lemma projection_idempotent (S : Finset H) : IsIdempotentElem (projection H S) := + (baseProjection_idempotent H S).map (baseEmbedding H ℚ) + +lemma projection_selfAdjoint (S : Finset H) : IsSelfAdjoint (projection H S) := by + change star (baseEmbedding H ℚ _) = _ + change star (MonoidAlgebra.mapDomainRingHom ℚ _ _) = _ + rw [← groupAlgebra_mapDomain_star] + exact congrArg (baseEmbedding H ℚ) (baseProjection_selfAdjoint H S) + +lemma projection_trace (S : Finset H) (hS : 1 ∉ S) : + (projection H S).coeff 1 = (1 / 3 : ℚ) * (2 / 3 : ℚ) ^ S.card := by + rw [projection, baseEmbedding_coeff_one, baseProjection_trace H S hS] + +lemma baseAverage_one_mul_projection (S : Finset H) : + baseAverage H 1 * baseProjection H S = baseProjection H S := by + rw [baseProjection, ← mul_assoc, baseAverage_idempotent H 1] + +lemma baseProjection_mul_average_eq_zero (S : Finset H) {s : H} (hs : s ∈ S) : + baseProjection H S * baseAverage H s = 0 := by + have he := Finset.mul_prod_erase S (fun t => 1 - baseAverage H t) hs + rw [baseProjection, ← he] + have hp := baseAverage_idempotent H s + change _ * _ = _ at hp + calc + _ = baseAverage H 1 * (∏ t ∈ S.erase s, (1 - baseAverage H t)) * + ((1 - baseAverage H s) * baseAverage H s) := by ring + _ = 0 := by rw [sub_mul, one_mul, hp, sub_self, mul_zero] + +lemma shift_average (s : H) : shiftSymbol H s * average H 1 = average H s * shiftSymbol H s := by + have hs := shiftSymbol_one_lamp H (R := ℚ) s + rw [average_def, average_def] + unfold thirdAverage + rw [mul_smul_comm, smul_mul_assoc] + congr 1 + simp only [mul_add, add_mul, mul_one, one_mul] + rw [hs] + congr 1 + rw [← mul_assoc, hs, mul_assoc, hs, ← mul_assoc] + +lemma projection_separates (S : Finset H) {s : H} (hs : s ∈ S) : + projection H S * shiftSymbol H s * projection H S = 0 := by + have h1 : average H 1 * projection H S = projection H S := by + simpa only [average, projection, ← map_mul] using + congrArg (baseEmbedding H ℚ) (baseAverage_one_mul_projection H S) + have h0 : projection H S * average H s = 0 := by + simpa only [average, projection, ← map_mul, map_zero] using + congrArg (baseEmbedding H ℚ) (baseProjection_mul_average_eq_zero H S hs) + calc + _ = projection H S * shiftSymbol H s * (average H 1 * projection H S) := by rw [h1] + _ = projection H S * (shiftSymbol H s * average H 1) * projection H S := by simp only [mul_assoc] + _ = projection H S * (average H s * shiftSymbol H s) * projection H S := by rw [shift_average] + _ = 0 := by rw [← mul_assoc, h0, zero_mul, zero_mul] + +def baseSum (h : H) : MonoidAlgebra ℤ (BaseGroup H) := + 1 + MonoidAlgebra.single (baseLamp H h) 1 + MonoidAlgebra.single (baseLamp H h) 1 ^ 2 + +def baseNumerator (S : Finset H) : MonoidAlgebra ℤ (BaseGroup H) := + baseSum H 1 * ∏ s ∈ S, (3 - baseSum H s) + +def denominator (S : Finset H) : ℕ := 3 ^ (S.card + 1) + +def numerator (S : Finset H) : MonoidAlgebra ℤ (LampGroup H) := + baseEmbedding H ℤ (baseNumerator H S) + +def intToRat : MonoidAlgebra ℤ (BaseGroup H) →+* MonoidAlgebra ℚ (BaseGroup H) := + MonoidAlgebra.mapRingHom _ (Int.castRingHom ℚ) + +lemma intToRat_baseSum (h : H) : intToRat H (baseSum H h) = (3 : ℚ) • baseAverage H h := by + simp [intToRat, baseSum, baseAverage, thirdAverage, smul_smul, pow_two] + +lemma intToRat_baseNumerator (S : Finset H) : + intToRat H (baseNumerator H S) = (denominator H S : ℚ) • baseProjection H S := by + have he (s : H) : intToRat H (3 - baseSum H s) = (3 : ℚ) • (1 - baseAverage H s) := by + rw [map_sub, map_ofNat, intToRat_baseSum, smul_sub] + simp only [← Algebra.algebraMap_eq_smul_one, map_ofNat] + simp only [baseNumerator, map_mul, map_prod, intToRat_baseSum, he] + rw [Finset.prod_smul, Finset.prod_const, smul_mul_smul_comm] + simp [denominator, baseProjection, pow_succ, mul_comm] + +omit [Group H] in +lemma denominator_pos (S : Finset H) : 0 < denominator H S := by + unfold denominator; positivity +omit [Group H] in +lemma denominator_odd (S : Finset H) : Odd (denominator H S) := by + exact (by decide : Odd 3).pow + +end LampProjectionDraft + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/LampDenominators.lean b/lean/OAI/Analysis/GroupDeterminants/LampDenominators.lean new file mode 100644 index 0000000000000000000000000000000000000000..076a8032c8b0324114514c85b8a70428814ba2e9 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/LampDenominators.lean @@ -0,0 +1,78 @@ +import OAI.Analysis.GroupDeterminants.LampCoefficients + +namespace OAI + +universe uH + +noncomputable section +open scoped BigOperators Pointwise + +namespace LampProjectionDraft +open LampDraft GroupRingDeterminant +variable (H : Type uH) [Group H] +local instance : DecidableEq H := Classical.decEq H + +def fullIntToRat : MonoidAlgebra ℤ (LampGroup H) →+* MonoidAlgebra ℚ (LampGroup H) := + MonoidAlgebra.mapRingHom _ (Int.castRingHom ℚ) +def fullIntToBin : MonoidAlgebra ℤ (LampGroup H) →+* MonoidAlgebra (ZMod 2) (LampGroup H) := + MonoidAlgebra.mapRingHom _ (Int.castRingHom (ZMod 2)) + +lemma fullIntToRat_injective : Function.Injective (fullIntToRat H) := + MonoidAlgebra.map_injective (Int.castRingHom ℚ).toAddMonoidHom Int.cast_injective + +lemma fullIntToRat_baseEmbedding (a : MonoidAlgebra ℤ (BaseGroup H)) : + fullIntToRat H (baseEmbedding H ℤ a) = baseEmbedding H ℚ (intToRat H a) := by + induction a using MonoidAlgebra.induction_linear with + | zero => simp + | add a b ha hb => simp only [map_add, ha, hb] + | single g z => simp [fullIntToRat, intToRat, baseEmbedding] + +lemma numerator_toRat (S : Finset H) : + fullIntToRat H (numerator H S) = (denominator H S : ℚ) • projection H S := by + rw [numerator, fullIntToRat_baseEmbedding, intToRat_baseNumerator, map_rat_smul] + rfl + +lemma fullIntToRat_zsmul (a : MonoidAlgebra ℤ (LampGroup H)) (D : ℤ) : + fullIntToRat H (D • a) = (D : ℚ) • fullIntToRat H a := by + rw [Int.cast_smul_eq_zsmul] + exact map_zsmul _ _ _ + +lemma fullIntToBin_zsmul (a : MonoidAlgebra ℤ (LampGroup H)) (D : ℤ) : + fullIntToBin H (D • a) = (D : ZMod 2) • fullIntToBin H a := by + rw [Int.cast_smul_eq_zsmul] + exact map_zsmul _ _ _ + +lemma numerator_square (S : Finset H) : + numerator H S * numerator H S = (denominator H S : ℤ) • numerator H S := by + apply fullIntToRat_injective H + rw [map_mul, fullIntToRat_zsmul, numerator_toRat, smul_mul_smul_comm, + projection_idempotent, smul_smul] + simp + +lemma numerator_separates (S : Finset H) {s : H} (hs : s ∈ S) : + numerator H S * shiftSymbol H s * numerator H S = 0 := by + apply fullIntToRat_injective H + rw [map_mul, map_mul, map_zero, numerator_toRat] + have hs' : fullIntToRat H (shiftSymbol H s) = shiftSymbol H s := by + simp [fullIntToRat, shiftSymbol] + rw [hs', smul_mul_assoc, smul_mul_smul_comm, projection_separates H S hs, smul_zero] + +def binaryProjection (S : Finset H) : MonoidAlgebra (ZMod 2) (LampGroup H) := + fullIntToBin H (numerator H S) + +lemma binaryProjection_idempotent (S : Finset H) : + IsIdempotentElem (binaryProjection H S) := by + change fullIntToBin H _ * fullIntToBin H _ = fullIntToBin H _ + rw [← map_mul, numerator_square, fullIntToBin_zsmul, Int.cast_natCast, + (denominator_odd H S).natCast_zmod_two, one_smul] + +lemma binaryProjection_separates (S : Finset H) {s : H} (hs : s ∈ S) : + binaryProjection H S * shiftSymbol H s * binaryProjection H S = 0 := by + have he := congrArg (fullIntToBin H) (numerator_separates H S hs) + simpa [binaryProjection, fullIntToBin, shiftSymbol] using he + +end LampProjectionDraft + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/LampProjections.lean b/lean/OAI/Analysis/GroupDeterminants/LampProjections.lean new file mode 100644 index 0000000000000000000000000000000000000000..d671c6c9fa6f230434c2d42c7fc2971e9faaa528 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/LampProjections.lean @@ -0,0 +1,97 @@ +import OAI.Analysis.GroupDeterminants.Lamps + +namespace OAI + +universe uH + +noncomputable section +open scoped BigOperators Pointwise + +namespace LampProjectionDraft +open LampDraft AverageDraft SupportDraft GroupRingDeterminant +variable (H : Type uH) [Group H] +local instance : DecidableEq H := Classical.decEq H + +def baseAverage (h : H) : MonoidAlgebra ℚ (BaseGroup H) := + thirdAverage (MonoidAlgebra.single (baseLamp H h) 1) + +lemma baseAverage_idempotent (h : H) : IsIdempotentElem (baseAverage H h) := by + apply thirdAverage_square + simp only [MonoidAlgebra.single_mul_single, one_mul] + have he : baseLamp H h * baseLamp H h * baseLamp H h = 1 := by + simpa only [pow_succ, pow_zero, one_mul] using baseLamp_cube H h + rw [he, ← MonoidAlgebra.one_def] + +lemma baseAverage_selfAdjoint (h : H) : IsSelfAdjoint (baseAverage H h) := by + have he : (baseLamp H h)⁻¹ = baseLamp H h * baseLamp H h := + inv_eq_of_mul_eq_one_right (by simpa only [pow_succ, pow_zero, one_mul, mul_assoc] + using (baseLamp_cube H h)) + have he2 : (baseLamp H h * baseLamp H h)⁻¹ = baseLamp H h := by + rw [← he, inv_inv] + change star (baseAverage H h) = baseAverage H h + simp only [baseAverage, thirdAverage, MonoidAlgebra.single_mul_single, one_mul, + star_smul, star_add, star_one, star_groupAlgebra_single, he, he2, star_trivial] + congr 1 + abel + +lemma baseAverage_supported (h : H) : SupportedOn (baseCoordinate H) {h} (baseAverage H h) := by + have hs : SupportedOn (baseCoordinate H) {h} + (MonoidAlgebra.single (baseLamp H h) (1 : ℚ)) := + supportedOn_single _ _ _ _ (by intro i hi; simp_all) + unfold baseAverage thirdAverage + apply supportedOn_smul + apply supportedOn_add + · exact supportedOn_add _ (supportedOn_one _ _) hs + · simpa only [Set.union_self] using supportedOn_mul _ hs hs + +lemma baseAverage_trace (h : H) : (baseAverage H h).coeff 1 = 1 / 3 := by + simp [baseAverage, thirdAverage, MonoidAlgebra.single_mul_single, + MonoidAlgebra.coeff_single, baseLamp_ne_one, baseLamp_sq_ne_one] + +def baseProjection (S : Finset H) : MonoidAlgebra ℚ (BaseGroup H) := + baseAverage H 1 * ∏ s ∈ S, (1 - baseAverage H s) + +lemma complement_prod_idempotent (S : Finset H) : + IsIdempotentElem (∏ s ∈ S, (1 - baseAverage H s)) := by + induction S using Finset.induction_on with + | empty => simp [IsIdempotentElem] + | @insert s S hs ih => + rw [Finset.prod_insert hs] + exact (baseAverage_idempotent H s).one_sub.mul ih + +lemma baseProjection_idempotent (S : Finset H) : IsIdempotentElem (baseProjection H S) := + (baseAverage_idempotent H 1).mul (complement_prod_idempotent H S) + +lemma complement_prod_selfAdjoint (S : Finset H) : + IsSelfAdjoint (∏ s ∈ S, (1 - baseAverage H s)) := by + induction S using Finset.induction_on with + | empty => simp + | @insert s S hs ih => + rw [Finset.prod_insert hs] + exact ((IsSelfAdjoint.one _).sub (baseAverage_selfAdjoint H s)).mul ih + +lemma baseProjection_selfAdjoint (S : Finset H) : IsSelfAdjoint (baseProjection H S) := + (baseAverage_selfAdjoint H 1).mul (complement_prod_selfAdjoint H S) + +lemma baseProjection_trace (S : Finset H) (hS : 1 ∉ S) : + (baseProjection H S).coeff 1 = (1 / 3 : ℚ) * (2 / 3 : ℚ) ^ S.card := by + have hi (b : BaseGroup H) (hb : ∀ i, baseCoordinate H i b = 1) : b = 1 := + baseCoordinate_injective H (by simpa using hb) + have hc (s : H) : SupportedOn (baseCoordinate H) {s} (1 - baseAverage H s) := + supportedOn_sub _ (supportedOn_one _ _) (baseAverage_supported H s) + rw [baseProjection, coeff_one_mul_of_disjoint (baseCoordinate H) hi (by simpa using hS) + _ _ (baseAverage_supported H 1) (supportedOn_prod _ _ _ (by intro i _; exact hc i)), + baseAverage_trace, coeff_one_prod (baseCoordinate H) hi _ _ (by intro i _; exact hc i)] + simp only [MonoidAlgebra.coeff_sub, Finsupp.sub_apply, MonoidAlgebra.one_def, MonoidAlgebra.coeff_single, baseAverage_trace] + norm_num [div_pow] + +lemma baseProjection_trace_pos (S : Finset H) (hS : 1 ∉ S) : + 0 < (baseProjection H S).coeff 1 := by + rw [baseProjection_trace H S hS] + positivity + +end LampProjectionDraft + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/Lamps.lean b/lean/OAI/Analysis/GroupDeterminants/Lamps.lean new file mode 100644 index 0000000000000000000000000000000000000000..71dc4f9e8b4260830f543e198bb15c5fa58cde26 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/Lamps.lean @@ -0,0 +1,150 @@ +import OAI.Analysis.GroupDeterminants.ProductSupport + +namespace OAI + +universe uH + +noncomputable section +open scoped BigOperators Pointwise + +namespace LampDraft +variable (H : Type uH) [Group H] +local instance : DecidableEq H := Classical.decEq H +abbrev FullLamp := Multiplicative (ZMod 3) ≀ᵣ H + +def coordinate (h : H) : FullLamp H := by + classical + exact ⟨fun t => if t = h then Multiplicative.ofAdd 1 else 1, 1⟩ + +def lampSubgroup : Subgroup (FullLamp H) := + (RegularWreathProduct.inl : H →* FullLamp H).range ⊔ + Subgroup.closure {coordinate H 1} + +abbrev LampGroup := lampSubgroup H + +instance lampGroup_fg [Group.FG H] : Group.FG (LampGroup H) := by + apply (Group.fg_iff_subgroup_fg _).mpr + apply Subgroup.FG.sup + · exact (Group.fg_iff_subgroup_fg _).mp inferInstance + · exact ⟨{coordinate H 1}, by simp⟩ + +def shift : H →* LampGroup H := + (RegularWreathProduct.inl : H →* FullLamp H).codRestrict (lampSubgroup H) + (fun h => (show (RegularWreathProduct.inl : H →* FullLamp H).range ≤ lampSubgroup H from le_sup_left) (show RegularWreathProduct.inl h ∈ + (RegularWreathProduct.inl : H →* FullLamp H).range from ⟨h, rfl⟩)) + +def lampSeed : LampGroup H := ⟨coordinate H 1, + (show Subgroup.closure {coordinate H 1} ≤ lampSubgroup H from le_sup_right) + (Subgroup.subset_closure (Set.mem_singleton _))⟩ + +def lamp (h : H) : LampGroup H := shift H h * lampSeed H * (shift H h)⁻¹ + +@[simp] theorem shift_coe (h : H) : (shift H h : FullLamp H) = RegularWreathProduct.inl h := rfl + +@[simp] theorem lamp_coe (h : H) : (lamp H h : FullLamp H) = coordinate H h := by + classical + apply RegularWreathProduct.ext + · funext t + simp only [lamp, Subgroup.coe_mul, Subgroup.coe_inv, shift_coe, lampSeed, + RegularWreathProduct.mul_left, RegularWreathProduct.mul_right, + RegularWreathProduct.left_inl, RegularWreathProduct.right_inl, + RegularWreathProduct.inv_left, Pi.mul_apply, Pi.one_apply, + Pi.inv_apply, inv_one, mul_one, one_mul, coordinate, inv_mul_eq_one, eq_comm] + · simp [lamp, lampSeed, coordinate] + +theorem lamp_commute (g h : H) : Commute (lamp H g) (lamp H h) := by + classical + apply Subtype.ext + ext t <;> simp [lamp_coe, coordinate, mul_comm] + +theorem lamp_cube (h : H) : lamp H h ^ 3 = 1 := by + classical + apply Subtype.ext + simp only [Subgroup.coe_pow, lamp_coe, Subgroup.coe_one] + simp only [pow_succ, pow_zero, one_mul] + ext t + · by_cases ht : t = h + · subst t + norm_num [coordinate] + decide + · simp [coordinate, ht] + · simp [coordinate] + +theorem shift_conjugate_lamp (s h : H) : + shift H s * lamp H h * (shift H s)⁻¹ = lamp H (s * h) := by + simp only [lamp, map_mul, mul_inv_rev] + group + +theorem shift_injective : Function.Injective (shift H) := by + intro a b hab + exact congrArg (fun g : LampGroup H => (g : FullLamp H).right) hab + +def lampRight : LampGroup H →* H := + (RegularWreathProduct.rightHom : FullLamp H →* H).comp (lampSubgroup H).subtype + +abbrev BaseGroup := (lampRight H).ker + +instance baseGroup_commGroup : CommGroup (BaseGroup H) := + { (inferInstance : Group (BaseGroup H)) with + mul_comm := by + intro a b + apply Subtype.ext + apply Subtype.ext + apply RegularWreathProduct.ext + · funext t + have ha : ((a : LampGroup H) : FullLamp H).right = 1 := a.property + have hb : ((b : LampGroup H) : FullLamp H).right = 1 := b.property + simp [RegularWreathProduct.mul_left, ha, hb, mul_comm] + · change ((a : LampGroup H) : FullLamp H).right * ((b : LampGroup H) : FullLamp H).right = + ((b : LampGroup H) : FullLamp H).right * ((a : LampGroup H) : FullLamp H).right + have ha : ((a : LampGroup H) : FullLamp H).right = 1 := a.property + have hb : ((b : LampGroup H) : FullLamp H).right = 1 := b.property + rw [ha, hb] } + +def baseLamp (h : H) : BaseGroup H := ⟨lamp H h, by + change ((lamp H h : LampGroup H) : FullLamp H).right = 1 + rw [lamp_coe]; rfl⟩ + +def baseCoordinate (h : H) : BaseGroup H →* Multiplicative (ZMod 3) where + toFun a := ((a : LampGroup H) : FullLamp H).left h + map_one' := rfl + map_mul' a b := by + have ha : ((a : LampGroup H) : FullLamp H).right = 1 := a.property + change (((a : LampGroup H) : FullLamp H).left h * + ((b : LampGroup H) : FullLamp H).left (((a : LampGroup H) : FullLamp H).right⁻¹ * h)) = _ + simp [ha] + +@[simp] lemma baseCoordinate_baseLamp (h t : H) : + baseCoordinate H t (baseLamp H h) = if t = h then Multiplicative.ofAdd 1 else 1 := by + classical + change (lamp H h : FullLamp H).left t = _ + rw [lamp_coe]; rfl + +lemma baseCoordinate_injective {a b : BaseGroup H} + (h : ∀ t, baseCoordinate H t a = baseCoordinate H t b) : a = b := by + apply Subtype.ext + apply Subtype.ext + apply RegularWreathProduct.ext + · exact funext h + · exact a.property.trans b.property.symm + +lemma baseLamp_cube (h : H) : baseLamp H h ^ 3 = 1 := by + apply Subtype.ext + exact lamp_cube H h + +lemma baseLamp_ne_one (h : H) : baseLamp H h ≠ 1 := by + intro he + have he' := congrArg (baseCoordinate H h) he + norm_num at he' + +lemma baseLamp_sq_ne_one (h : H) : baseLamp H h * baseLamp H h ≠ 1 := by + intro he + have he' := congrArg (baseCoordinate H h) he + norm_num at he' + exact (by decide : Multiplicative.ofAdd (1 : ZMod 3) * Multiplicative.ofAdd 1 ≠ 1) he' + +end LampDraft + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/LogSeries.lean b/lean/OAI/Analysis/GroupDeterminants/LogSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..d914e6ce1e943a5c5badcca54f577ff603409115 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/LogSeries.lean @@ -0,0 +1,174 @@ +import OAI.Analysis.GroupDeterminants.FiniteFields + +namespace OAI + +universe uA + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +open Filter Topology +section Analysis +variable {A : Type uA} [NormedRing A] [NormedAlgebra ℝ A] + +lemma trace_power_derivative (τ : A →L[ℝ] ℂ) (hτ : ∀ a b, τ (a * b) = τ (b * a)) + (a b : A) (n : ℕ) : + τ (∑ i ∈ Finset.range (n + 1), a ^ (n - i) * b * a ^ i) = + (n + 1 : ℝ) • τ (b * a ^ n) := by + rw [map_sum] + have hh (i : ℕ) (hi : i ∈ Finset.range (n + 1)) : + τ (a ^ (n - i) * b * a ^ i) = τ (b * a ^ n) := by + rw [mul_assoc, hτ, mul_assoc, ← pow_add] + rw [Nat.add_sub_of_le] + exact Nat.le_of_lt_succ (Finset.mem_range.mp hi) + simp_rw [Finset.sum_congr rfl hh] + simp [← Nat.cast_smul_eq_nsmul ℝ] + +lemma hasDerivAt_trace_pow_div (τ : A →L[ℝ] ℂ) + (hτ : ∀ a b, τ (a * b) = τ (b * a)) + {f : ℝ → A} {f' : A} {x : ℝ} (hf : HasDerivAt f f' x) (n : ℕ) : + HasDerivAt (fun y => τ ((n + 1 : ℝ)⁻¹ • f y ^ (n + 1))) + (τ (f' * f x ^ n)) x := by + have h := τ.hasFDerivAt.comp_hasDerivAt x ((hf.fun_pow' (n + 1)).const_smul (n + 1 : ℝ)⁻¹) + simpa only [Function.comp_def, Pi.smul_def, map_smul, Nat.pred_succ, + trace_power_derivative τ hτ, smul_smul, + inv_mul_cancel₀ (show (n + 1 : ℝ) ≠ 0 by positivity), one_smul] using h + +section Complete +variable [CompleteSpace A] [NormOneClass A] + +lemma summable_trace_pow_div (τ : A →L[ℝ] ℂ) (a : A) (ha : ‖a‖ < 1) : + Summable (fun n : ℕ => τ ((n + 1 : ℝ)⁻¹ • a ^ (n + 1))) := by + have hs : Summable (fun n : ℕ => (n + 1 : ℝ)⁻¹ • a ^ (n + 1)) := by + apply Summable.of_norm_bounded (g := fun n => ‖a‖ ^ (n + 1)) + · simpa only [pow_succ] using (summable_geometric_of_lt_one (norm_nonneg a) ha).mul_right ‖a‖ + · intro n + rw [norm_smul, Real.norm_of_nonneg (by positivity)] + exact (mul_le_mul_of_nonneg_left (norm_pow_le a (n + 1)) (by positivity)).trans + (mul_le_of_le_one_left (by positivity) + (inv_le_one_of_one_le₀ (by have := Nat.cast_nonneg (α := ℝ) n; linarith))) + exact τ.summable hs + +lemma hasDerivAt_trace_logSeries (τ : A →L[ℝ] ℂ) + (hτ : ∀ a b, τ (a * b) = τ (b * a)) + {f f' : ℝ → A} {s : Set ℝ} {x ρ B : ℝ} + (hs : IsOpen s) (hsc : IsPreconnected s) (hx : x ∈ s) + (hf : ∀ y ∈ s, HasDerivAt f (f' y) y) + (hρ : ρ < 1) (hρ₀ : 0 ≤ ρ) (hB : 0 ≤ B) + (hn : ∀ y ∈ s, ‖f y‖ ≤ ρ) (hn' : ∀ y ∈ s, ‖f' y‖ ≤ B) : + HasDerivAt (fun y => ∑' n : ℕ, τ ((n + 1 : ℝ)⁻¹ • f y ^ (n + 1))) + (τ (f' x * Ring.inverse (1 - f x))) x := by + have hsum : HasSum (fun n : ℕ => τ (f' x * f x ^ n)) + (τ (f' x * Ring.inverse (1 - f x))) := by + exact τ.hasSum ((hasSum_geom_series_inverse (f x) ((hn x hx).trans_lt hρ)).mul_left (f' x)) + have hd := hasDerivAt_tsum_of_isPreconnected + ((summable_geometric_of_lt_one hρ₀ hρ).mul_left (‖τ‖ * B)) hs hsc + (fun n y hy => hasDerivAt_trace_pow_div τ hτ (hf y hy) n) + (fun n y hy => show ‖τ (f' y * f y ^ n)‖ ≤ ‖τ‖ * B * ρ ^ n from + (τ.le_opNorm _).trans ((mul_le_mul_of_nonneg_left + ((norm_mul_le _ _).trans (mul_le_mul (hn' y hy) + ((norm_pow_le _ _).trans (pow_le_pow_left₀ (norm_nonneg _) (hn y hy) n)) + (by positivity) hB)) (norm_nonneg _)).trans (le_of_eq (mul_assoc _ _ _).symm))) + hx (summable_trace_pow_div τ (f x) ((hn x hx).trans_lt hρ)) hx + rwa [hsum.tsum_eq] at hd + +lemma hasDerivAt_trace_logSeries_local (τ : A →L[ℝ] ℂ) + (hτ : ∀ a b, τ (a * b) = τ (b * a)) + {f f' : ℝ → A} {x : ℝ} (hf : ∀ y, HasDerivAt f (f' y) y) + (hc : ContinuousAt f' x) (hn : ‖f x‖ < 1) : + HasDerivAt (fun y => ∑' n : ℕ, τ ((n + 1 : ℝ)⁻¹ • f y ^ (n + 1))) + (τ (f' x * Ring.inverse (1 - f x))) x := by + obtain ⟨ρ, hρx, hρ⟩ := exists_between hn + let B := ‖f' x‖ + 1 + have he : ∀ᶠ y in 𝓝 x, ‖f y‖ < ρ ∧ ‖f' y‖ < B := + ((hf x).continuousAt.norm.eventually (gt_mem_nhds hρx)).and + (hc.norm.eventually (gt_mem_nhds (show ‖f' x‖ < B by dsimp [B]; linarith))) + obtain ⟨ε, hε, he⟩ := Metric.eventually_nhds_iff.mp he + exact hasDerivAt_trace_logSeries τ hτ Metric.isOpen_ball (convex_ball x ε).isPreconnected + (Metric.mem_ball_self hε) (fun y _ => hf y) hρ ((norm_nonneg _).trans hρx.le) + (by dsimp [B]; positivity) (fun y hy => (he hy).1.le) (fun y hy => (he hy).2.le) + +end Complete + +end Analysis +section CFCSeries +variable {A : Type uA} [NormedRing A] [StarRing A] [NormedAlgebra ℝ A] + [CompleteSpace A] [NormOneClass A] [ContinuousFunctionalCalculus ℝ A IsSelfAdjoint] + +omit [StarRing A] [CompleteSpace A] [ContinuousFunctionalCalculus ℝ A IsSelfAdjoint] in +lemma norm_pow_div_le_geom (W : A) (n : ℕ) : + ‖(n + 1 : ℝ)⁻¹ • W ^ (n + 1)‖ ≤ ‖W‖ ^ (n + 1) := by + rw [norm_smul, Real.norm_of_nonneg (by positivity)] + exact (mul_le_mul_of_nonneg_left (norm_pow_le W (n + 1)) (by positivity)).trans + (mul_le_of_le_one_left (by positivity) (inv_le_one_of_one_le₀ (by have := Nat.cast_nonneg (α := ℝ) n; linarith))) + +omit [StarRing A] [ContinuousFunctionalCalculus ℝ A IsSelfAdjoint] in +lemma summable_pow_div (W : A) (hW : ‖W‖ < 1) : + Summable (fun n : ℕ => (n + 1 : ℝ)⁻¹ • W ^ (n + 1)) := by + apply Summable.of_norm_bounded (g := fun n => ‖W‖ ^ (n + 1)) + · simpa only [pow_succ] using (summable_geometric_of_lt_one (norm_nonneg W) hW).mul_right ‖W‖ + · exact norm_pow_div_le_geom W + +lemma hasSum_pow_div_cfc_log [Nontrivial A] (W : A) (hW : IsSelfAdjoint W) (hWn : ‖W‖ < 1) : + HasSum (fun n : ℕ => (n + 1 : ℝ)⁻¹ • W ^ (n + 1)) (-CFC.log (1 - W)) := by + let : Nonempty (spectrum ℝ W) := + (ContinuousFunctionalCalculus.spectrum_nonempty W hW).to_subtype + let X : C(spectrum ℝ W, ℝ) := ⟨Subtype.val, continuous_subtype_val⟩ + have hX : ‖X‖ ≤ ‖W‖ := by + apply (ContinuousMap.norm_le X (norm_nonneg W)).mpr + intro x + exact spectrum.norm_le_norm_of_mem x.property + have hXs : Summable (fun n : ℕ => (n + 1 : ℝ)⁻¹ • X ^ (n + 1)) := + summable_pow_div X (hX.trans_lt hWn) + have hc : ContinuousOn (fun x : ℝ => -Real.log (1 - x)) (spectrum ℝ W) := by + intro x hx + have hxn : |x| < 1 := (spectrum.norm_le_norm_of_mem hx).trans_lt hWn + have hne : 1 - x ≠ 0 := by have := (abs_lt.mp hxn).2; linarith + exact ((Real.continuousAt_log hne).comp (continuous_const.sub continuous_id).continuousAt).neg.continuousWithinAt + let L : C(spectrum ℝ W, ℝ) := ⟨fun x => -Real.log (1 - x.1), hc.domRestrict⟩ + have hs : HasSum (fun n : ℕ => (n + 1 : ℝ)⁻¹ • X ^ (n + 1)) L := by + rw [hXs.hasSum_iff] + ext x + rw [← ContinuousMap.tsum_apply hXs] + have hh := Real.hasSum_pow_div_log_of_abs_lt_one + ((spectrum.norm_le_norm_of_mem x.property).trans_lt hWn) + change (∑' n : ℕ, (n + 1 : ℝ)⁻¹ * (x.1) ^ (n + 1)) = -Real.log (1 - x.1) + simpa [div_eq_mul_inv, mul_comm] using hh.tsum_eq + have h := (cfcL hW).hasSum hs + have hterm (n : ℕ) : (cfcL hW) ((n + 1 : ℝ)⁻¹ • X ^ (n + 1)) = + (n + 1 : ℝ)⁻¹ • W ^ (n + 1) := by + rw [map_smul] + congr 1 + change cfcHom hW (X ^ (n + 1)) = _ + rw [map_pow] + congr 1 + exact (cfc_apply id W hW).symm.trans (cfc_id ℝ W hW) + have hL : (cfcL hW) L = -CFC.log (1 - W) := by + change cfcHom hW L = _ + change cfcHom hW ⟨(spectrum ℝ W).domRestrict (fun x : ℝ => -Real.log (1 - x)), _⟩ = _ + rw [← cfc_apply (fun x : ℝ => -Real.log (1 - x)) W hW hc] + rw [cfc_neg _ W] + congr 1 + have he : cfc (fun x : ℝ => 1 - x) W = 1 - W := by + rw [cfc_sub (fun _ : ℝ => 1) (fun x => x) W (by fun_prop) (by fun_prop), + cfc_const 1 W hW, cfc_id' ℝ W hW, map_one] + rw [CFC.log, ← he] + have hc' : ContinuousOn Real.log ((fun x : ℝ => 1 - x) '' spectrum ℝ W) := by + intro y hy + obtain ⟨x, hx, rfl⟩ := hy + apply (Real.continuousAt_log _).continuousWithinAt + have hxn : |x| < 1 := (spectrum.norm_le_norm_of_mem hx).trans_lt hWn + have := (abs_lt.mp hxn).2 + linarith + rw [← cfc_comp' Real.log (fun x : ℝ => 1 - x) W hc' (by fun_prop) hW] + simpa only [hterm, hL] using h + +end CFCSeries + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/Main.lean b/lean/OAI/Analysis/GroupDeterminants/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..96862b7e30d07bd89b8ef95f2c8b571d1e1b38fc --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/Main.lean @@ -0,0 +1,17 @@ +import OAI.Analysis.GroupDeterminants.CompanionTransfer +import OAI.RingTheory.DirectFiniteness.Main + +namespace OAI + +namespace GroupRingDeterminant + +theorem companion_input : CompanionInput := by + obtain ⟨K, hK, hKfin, hKchar, H, hH, hHfg, a, b, hab, hba⟩ := + KaplanskyCounterexample.main_theorem + exact ⟨K, hK, Fintype.finite hKfin, hKchar, H, hH, hHfg, a, b, hab, hba⟩ + +theorem main : MainStatement := main_of_companion_input companion_input + +end GroupRingDeterminant + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/Model.lean b/lean/OAI/Analysis/GroupDeterminants/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b5a8c00526ba2af2ee0940beeb04ed5656785b5 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/Model.lean @@ -0,0 +1,56 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +/-- The Hilbert space l²(G)^n, with the product coordinates flattened. -/ +abbrev Hilbert (G : Type) (n : ℕ) := lp (fun _ : Fin n × G => ℂ) 2 + +/-- The identity vector in component i. -/ +def identityVector {G : Type} [Group G] {n : ℕ} (i : Fin n) : Hilbert G n := + by + classical + exact lp.single 2 (i, 1) 1 + +/-- The unnormalized matrix trace, linear in its operator argument. -/ +def groupTrace {G : Type} [Group G] {n : ℕ} + (T : Hilbert G n →L[ℂ] Hilbert G n) : ℂ := + ∑ i : Fin n, inner ℂ (identityVector i) (T (identityVector i)) + +/-- The invertible-case Fuglede--Kadison determinant. +It is used below only for invertible regular operators. -/ +def fkDet {G : Type} [Group G] {n : ℕ} + (T : Hilbert G n →L[ℂ] Hilbert G n) : ℝ := + Real.exp ((groupTrace (CFC.log (star T * T))).re / 2) + +/-- Exact coordinate specification of the bounded left-regular operator of A. -/ +def IsRegularOperator {G : Type} [Group G] {n : ℕ} + (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)) + (T : Hilbert G n →L[ℂ] Hilbert G n) : Prop := + ∀ (ξ : Hilbert G n) (i : Fin n) (h : G), + (T ξ) (i, h) = ∑ j : Fin n, + (A i j).coeff.sum fun g z => (z : ℂ) * ξ (j, g⁻¹ * h) + +/-- Coefficientwise extension from the integral to the rational group ring. -/ +def rationalMatrix {G : Type} [Group G] {n : ℕ} + (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)) : + Matrix (Fin n) (Fin n) (MonoidAlgebra ℚ G) := + A.map (MonoidAlgebra.mapRingHom G (Int.castRingHom ℚ)) + +/-- An integral group-ring matrix with rational and bounded inverses and determinant in (0, 1). -/ +def MainStatement : Prop := + ∃ (G : Type) (_ : Group G) (_ : Group.FG G) (n : ℕ), + 1 ≤ n ∧ ∃ (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)) + (T : Hilbert G n →L[ℂ] Hilbert G n), + IsUnit (rationalMatrix A) ∧ IsRegularOperator A T ∧ IsUnit T ∧ + 0 < fkDet T ∧ fkDet T < 1 + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/ModularLifting.lean b/lean/OAI/Analysis/GroupDeterminants/ModularLifting.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c04ef3523ad73f204f3a0f0b362f7ea94145a80 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/ModularLifting.lean @@ -0,0 +1,124 @@ +import OAI.Analysis.GroupDeterminants.Defects + +namespace OAI + +universe uG uA um ur + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +section ModularKernel +variable (k : ℕ) (hk : 0 < k) + +def reduceTwo : ZMod (2 ^ k) →+* ZMod 2 := + ZMod.castHom (dvd_pow_self 2 (Nat.ne_of_gt hk)) (ZMod 2) + +theorem kernel_reduceTwo (a : ZMod (2 ^ k)) (ha : reduceTwo k hk a = 0) : + a = 2 * (a.val / 2 : ℕ) := by + have : NeZero (2 ^ k) := ⟨pow_ne_zero _ (by decide)⟩ + have hv : (a.val : ZMod 2) = 0 := by + rw [← map_natCast (reduceTwo k hk), ZMod.natCast_zmod_val] + exact ha + have hd : 2 ∣ a.val := (ZMod.natCast_eq_zero_iff _ _).mp hv + calc + a = (a.val : ZMod (2 ^ k)) := (ZMod.natCast_zmod_val a).symm + _ = ((2 * (a.val / 2) : ℕ) : ZMod (2 ^ k)) := by rw [Nat.mul_div_cancel' hd] + _ = _ := by push_cast; rfl + +variable {G : Type uG} [Group G] + +def reduceGroupTwo : MonoidAlgebra (ZMod (2 ^ k)) G →+* MonoidAlgebra (ZMod 2) G := + MonoidAlgebra.mapRingHom G (reduceTwo k hk) + +def halfGroup (a : MonoidAlgebra (ZMod (2 ^ k)) G) : + MonoidAlgebra (ZMod (2 ^ k)) G := + MonoidAlgebra.ofCoeff (a.coeff.mapRange + (fun c => (c.val / 2 : ℕ)) (by simp)) + +theorem kernel_reduceGroupTwo (a : MonoidAlgebra (ZMod (2 ^ k)) G) + (ha : reduceGroupTwo k hk a = 0) : a = 2 * halfGroup k a := by + apply MonoidAlgebra.ext + ext g + have hg := congrArg (fun c : MonoidAlgebra (ZMod 2) G => c.coeff g) ha + have hc : reduceTwo k hk (a.coeff g) = 0 := by + simpa only [reduceGroupTwo, MonoidAlgebra.coeff_mapRingHom, + MonoidAlgebra.coeff_zero, Finsupp.zero_apply] using hg + simpa [two_mul, halfGroup, MonoidAlgebra.coeff_add] using kernel_reduceTwo k hk _ hc + +theorem twice_pow_eq_zero {A : Type uA} [Ring A] [Algebra (ZMod (2 ^ k)) A] (v : A) : + (2 * v) ^ k = 0 := by + have htwo : (2 : ZMod (2 ^ k)) ^ k = 0 := by + simpa only [Nat.cast_pow, Nat.cast_ofNat] using ZMod.natCast_self (2 ^ k) + have ht : (2 : A) ^ k = 0 := by + simpa only [map_pow, map_ofNat, map_zero] using + congrArg (algebraMap (ZMod (2 ^ k)) A) htwo + have hc : Commute (2 : A) v := by + simpa only [Nat.cast_ofNat] using Nat.cast_commute 2 v + rw [hc.mul_pow, ht, zero_mul] + +theorem matrix_kernel_nilpotent {m : Type um} [Fintype m] [DecidableEq m] + (W : Matrix m m (MonoidAlgebra (ZMod (2 ^ k)) G)) + (hW : W.map (reduceGroupTwo k hk) = 0) : W ^ k = 0 := by + let V : Matrix m m (MonoidAlgebra (ZMod (2 ^ k)) G) := fun i j => halfGroup k (W i j) + have hv : W = 2 * V := by + rw [two_mul] + apply Matrix.ext + intro i j + have hc : reduceGroupTwo k hk (W i j) = 0 := congrFun (congrFun hW i) j + change W i j = halfGroup k (W i j) + halfGroup k (W i j) + simpa only [two_mul] using kernel_reduceGroupTwo k hk _ hc + rw [hv] + exact twice_pow_eq_zero k V + +theorem reduceGroupTwo_surjective : + Function.Surjective (reduceGroupTwo k hk (G := G)) := + MonoidAlgebra.map_surjective _ (ZMod.castHom_surjective (dvd_pow_self 2 (Nat.ne_of_gt hk))) + +theorem integerReduction_surjective (q : ℕ) : Function.Surjective + (MonoidAlgebra.mapRingHom G (Int.castRingHom (ZMod q))) := + MonoidAlgebra.map_surjective _ ZMod.intCast_surjective + +end ModularKernel + +section ModularFactorization +variable {G : Type uG} {m : Type um} {r : Type ur} [Group G] [Fintype m] [DecidableEq m] [Fintype r] + +theorem lift_binary_factorization (k : ℕ) (hk : 0 < k) + (e : Matrix m m (MonoidAlgebra (ZMod (2 ^ k)) G)) (he : e * e = e) + (u : Matrix m r (MonoidAlgebra (ZMod 2) G)) + (v : Matrix r m (MonoidAlgebra (ZMod 2) G)) + (huv : u * v = e.map (reduceGroupTwo k hk)) : + ∃ u' : Matrix m r (MonoidAlgebra (ZMod (2 ^ k)) G), + ∃ v' : Matrix r m (MonoidAlgebra (ZMod (2 ^ k)) G), u' * v' = e := by + classical + have hs := reduceGroupTwo_surjective (G := G) k hk + choose uRaw hu₀ using fun i j => hs (u i j) + choose vRaw hv₀ using fun i j => hs (v i j) + let u₀ : Matrix m r (MonoidAlgebra (ZMod (2 ^ k)) G) := uRaw + let v₀ : Matrix r m (MonoidAlgebra (ZMod (2 ^ k)) G) := vRaw + have hu : Matrix.map u₀ (reduceGroupTwo k hk) = u := Matrix.ext hu₀ + have hv : Matrix.map v₀ (reduceGroupTwo k hk) = v := Matrix.ext hv₀ + apply lift_rectangular_factorization e he u₀ v₀ k + apply matrix_kernel_nilpotent k hk + rw [Matrix.map_sub _ (map_sub _) _ _] + simp only [Matrix.map_mul, hu, hv] + rw [Matrix.mul_assoc (e.map _) u, huv] + have he' : e.map (reduceGroupTwo k hk) * e.map (reduceGroupTwo k hk) = + e.map (reduceGroupTwo k hk) := by rw [← Matrix.map_mul, he] + rw [he', he', sub_self] + +end ModularFactorization + +theorem exists_binary_modulus (D : ℕ) (hD : 0 < D) (hodd : Odd D) : + ∃ k : ℕ, 0 < k ∧ 1 < 2 ^ k ∧ Nat.ModEq D (2 ^ k) 1 := by + have hk : 0 < D.totient := Nat.totient_pos.mpr hD + refine ⟨D.totient, hk, one_lt_pow₀ (by decide) (Nat.ne_of_gt hk), ?_⟩ + exact Nat.ModEq.pow_totient (Nat.coprime_two_right.mpr hodd).symm + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/ProductSupport.lean b/lean/OAI/Analysis/GroupDeterminants/ProductSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..b41ebaec7c3c57e7c257e9dd4349f7b84391328f --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/ProductSupport.lean @@ -0,0 +1,118 @@ +import OAI.Analysis.GroupDeterminants.CyclicAverage + +namespace OAI + +universe uB uC uI + +noncomputable section +open scoped BigOperators Pointwise + +namespace SupportDraft +variable {B : Type uB} {C : Type uC} {I : Type uI} [CommGroup B] [Group C] +variable (coord : I → B →* C) + +def SupportedOn (s : Set I) (a : MonoidAlgebra ℚ B) : Prop := + ∀ b, a.coeff b ≠ 0 → ∀ i, i ∉ s → coord i b = 1 + +lemma supportedOn_mono {s t : Set I} {a : MonoidAlgebra ℚ B} + (ha : SupportedOn coord s a) (hst : s ⊆ t) : SupportedOn coord t a := + fun b hb i hi => ha b hb i (fun hs => hi (hst hs)) + +lemma supportedOn_single (s : Set I) (b : B) (q : ℚ) + (hb : ∀ i, i ∉ s → coord i b = 1) : SupportedOn coord s (MonoidAlgebra.single b q) := by + classical + intro g hg i hi + by_cases hgb : g = b + · subst g; exact hb i hi + · simp [MonoidAlgebra.coeff_single, Ne.symm hgb] at hg + +lemma supportedOn_one (s : Set I) : SupportedOn coord s (1 : MonoidAlgebra ℚ B) := by + rw [MonoidAlgebra.one_def] + exact supportedOn_single coord s 1 1 (by simp) + +lemma supportedOn_add {s : Set I} {a b : MonoidAlgebra ℚ B} + (ha : SupportedOn coord s a) (hb : SupportedOn coord s b) : SupportedOn coord s (a + b) := by + intro g hg i hi + by_cases hga : a.coeff g = 0 + · apply hb g _ i hi + simpa [hga] using hg + · exact ha g hga i hi + +lemma supportedOn_neg {s : Set I} {a : MonoidAlgebra ℚ B} + (ha : SupportedOn coord s a) : SupportedOn coord s (-a) := by + intro g hg i hi + exact ha g (by simpa using hg) i hi + +lemma supportedOn_sub {s : Set I} {a b : MonoidAlgebra ℚ B} + (ha : SupportedOn coord s a) (hb : SupportedOn coord s b) : SupportedOn coord s (a - b) := by + rw [sub_eq_add_neg] + exact supportedOn_add coord ha (supportedOn_neg coord hb) + +lemma supportedOn_smul {s : Set I} {a : MonoidAlgebra ℚ B} + (ha : SupportedOn coord s a) (q : ℚ) : SupportedOn coord s (q • a) := by + intro g hg i hi + apply ha g _ i hi + intro h + apply hg + simp [h] + +lemma supportedOn_mul {s t : Set I} {a b : MonoidAlgebra ℚ B} + (ha : SupportedOn coord s a) (hb : SupportedOn coord t b) : + SupportedOn coord (s ∪ t) (a * b) := by + classical + intro g hg i hi + have hm := MonoidAlgebra.support_coeff_mul_subset a b (Finsupp.mem_support_iff.mpr hg) + obtain ⟨x, hx, y, hy, rfl⟩ := Finset.mem_mul.mp hm + rw [map_mul, ha x (Finsupp.mem_support_iff.mp hx) i (fun h => hi (Or.inl h)), + hb y (Finsupp.mem_support_iff.mp hy) i (fun h => hi (Or.inr h)), one_mul] + +lemma coeff_one_mul_of_disjoint (hinj : ∀ b : B, (∀ i, coord i b = 1) → b = 1) + {s t : Set I} (hst : Disjoint s t) (a b : MonoidAlgebra ℚ B) + (ha : SupportedOn coord s a) (hb : SupportedOn coord t b) : + (a * b).coeff 1 = a.coeff 1 * b.coeff 1 := by + classical + rw [MonoidAlgebra.coeff_mul_apply_left] + simp only [mul_one] + rw [a.coeff.sum_eq_single 1] + · simp + · intro g hg hgne + by_cases hbg : b.coeff g⁻¹ = 0 + · simp [hbg] + · exfalso + apply hgne + apply hinj + intro i + by_cases his : i ∈ s + · have hit : i ∉ t := fun h => Set.disjoint_left.mp hst his h + have hh := hb g⁻¹ hbg i hit + simpa using hh + · exact ha g hg i his + · intro _ + simp + +lemma supportedOn_prod (s : Finset I) (a : I → MonoidAlgebra ℚ B) + (ha : ∀ i ∈ s, SupportedOn coord {i} (a i)) : SupportedOn coord (s : Set I) (∏ i ∈ s, a i) := by + classical + induction s using Finset.induction_on with + | empty => simpa using supportedOn_one coord ∅ + | @insert i s hi ih => + rw [Finset.prod_insert hi] + simpa using supportedOn_mul coord (ha i (by simp)) (ih (by aesop)) + +lemma coeff_one_prod (hinj : ∀ b : B, (∀ i, coord i b = 1) → b = 1) + (s : Finset I) (a : I → MonoidAlgebra ℚ B) + (ha : ∀ i ∈ s, SupportedOn coord {i} (a i)) : + (∏ i ∈ s, a i).coeff 1 = ∏ i ∈ s, (a i).coeff 1 := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + rw [Finset.prod_insert hi, Finset.prod_insert hi, + coeff_one_mul_of_disjoint coord hinj (by simpa using hi) _ _ (ha i (by simp)) + (supportedOn_prod coord s a (by aesop)), ih (by aesop)] + +end SupportDraft + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/ProjectionCriterion.lean b/lean/OAI/Analysis/GroupDeterminants/ProjectionCriterion.lean new file mode 100644 index 0000000000000000000000000000000000000000..569bce8948154f3a5eeed89c708e3eb26dc6fd03 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/ProjectionCriterion.lean @@ -0,0 +1,56 @@ +import OAI.Analysis.GroupDeterminants.RationalRepresentation + +namespace OAI + +noncomputable section +open scoped BigOperators Pointwise + +namespace GroupRingDeterminant +section ProjectionCriterion +variable {G r m : Type} [Group G] [Group.FG G] +variable [Fintype r] [Fintype m] [DecidableEq r] [DecidableEq m] [Nonempty r] + +theorem projection_criterion (D : ℕ) (hodd : Odd D) + (P : Matrix m m (MonoidAlgebra ℚ G)) (hP : P * P = P ∧ IsSelfAdjoint P) + (htrace : (Fintype.card r : ℚ) < ∑ i, (P i i).coeff 1) + (Z : Matrix m m (MonoidAlgebra ℤ G)) (hZ : Z.map toRat = (D : ℚ) • P) + (u : Matrix m r (MonoidAlgebra (ZMod 2) G)) + (v : Matrix r m (MonoidAlgebra (ZMod 2) G)) (huv : u * v = Z.map (toMod 2)) : + MainStatement := by + obtain ⟨k, hk, hq, hqD⟩ := exists_binary_modulus D hodd.pos hodd + obtain ⟨U, V, A, hA, hAu⟩ := integral_transfer_of_congruence D hodd P hP.1 Z hZ u v huv k hk hqD + let e := Fintype.equivFin (r ⊕ m) + let A' := Matrix.reindex e e A + have hAu' : IsUnit (rationalMatrix A') := reindexed_rational_isUnit A hAu + have hqR : (1 : ℝ) < (2 ^ k : ℕ) := by exact_mod_cast hq + have hPC : P.map rationalComplexMap * P.map rationalComplexMap = P.map rationalComplexMap := by + rw [← Matrix.map_mul, hP.1] + have hOp : regularOperator A' = indexedComplexRepresentation + (transferMatrix (((2 ^ k : ℕ) : ℚ) : ℝ) (P.map rationalComplexMap) + ((U.map toRat).map rationalComplexMap) ((V.map toRat).map rationalComplexMap)) := by + rw [← rationalIndexed_integer A, hA, transferMatrix_map_complex] + have hlog := transfer_trace_log (((2 ^ k : ℕ) : ℚ) : ℝ) + (lt_trans zero_lt_one hqR) (P.map rationalComplexMap) hPC + ((U.map toRat).map rationalComplexMap) ((V.map toRat).map rationalComplexMap) + dsimp only at hlog + rw [← hOp, rationalComplexMap_trace] at hlog + have htraceR : (Fintype.card r : ℝ) < ((∑ i, (P i i).coeff 1 : ℚ) : ℝ) := by + exact_mod_cast htrace + have hn : 2 * ((Fintype.card r : ℝ) - ((∑ i, (P i i).coeff 1 : ℚ) : ℝ)) * + Real.log (((2 ^ k : ℕ) : ℚ) : ℝ) < 0 := + mul_neg_of_neg_of_pos (mul_neg_of_pos_of_neg (by norm_num) (sub_neg.mpr htraceR)) + (Real.log_pos (by simpa using hqR)) + refine ⟨G, inferInstance, inferInstance, Fintype.card (r ⊕ m), + Fintype.card_pos, A', regularOperator A', hAu', regularOperator_spec A', + regularOperator_isUnit hAu', fkDet_pos _, ?_⟩ + unfold fkDet + apply Real.exp_lt_one_iff.mpr + rw [hlog, Complex.ofReal_re] + exact div_neg_of_neg_of_pos hn (by norm_num) + +end ProjectionCriterion +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/ProjectionData.lean b/lean/OAI/Analysis/GroupDeterminants/ProjectionData.lean new file mode 100644 index 0000000000000000000000000000000000000000..9617c470c99da6d1ed61ef67a7f2b3606c80559a --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/ProjectionData.lean @@ -0,0 +1,77 @@ +import OAI.Analysis.GroupDeterminants.DefectProjections + +namespace OAI + +noncomputable section +open scoped BigOperators Pointwise + +namespace GroupRingDeterminant +open LampDraft LampProjectionDraft +variable {H d : Type} [Group H] [Fintype d] [DecidableEq d] + +lemma lamp_projection_data (X Y : Matrix d d (MonoidAlgebra (ZMod 2) H)) + (hXY : X * Y = 1) (hYX : Y * X ≠ 1) : + ∃ (D : ℕ), Odd D ∧ ∃ P : Matrix (d ⊕ Unit) (d ⊕ Unit) (MonoidAlgebra ℚ (LampGroup H)), + P * P = P ∧ IsSelfAdjoint P ∧ (Fintype.card d : ℚ) < ∑ i, (P i i).coeff 1 ∧ + ∃ Z : Matrix (d ⊕ Unit) (d ⊕ Unit) (MonoidAlgebra ℤ (LampGroup H)), + Z.map toRat = (D : ℚ) • P ∧ + ∃ u : Matrix (d ⊕ Unit) d (MonoidAlgebra (ZMod 2) (LampGroup H)), + ∃ v : Matrix d (d ⊕ Unit) (MonoidAlgebra (ZMod 2) (LampGroup H)), + u * v = Z.map (toMod 2) := by + classical + obtain ⟨S, hS, u, v, huv⟩ := binary_defect_factorization_lamp X Y hXY hYX + let p := projection H S + let D := denominator H S + let P : Matrix (d ⊕ Unit) (d ⊕ Unit) (MonoidAlgebra ℚ (LampGroup H)) := + Matrix.fromBlocks 1 0 0 (Matrix.diagonal (fun _ : Unit => p)) + let Z : Matrix (d ⊕ Unit) (d ⊕ Unit) (MonoidAlgebra ℤ (LampGroup H)) := + Matrix.fromBlocks ((D : ℤ) • 1) 0 0 (Matrix.diagonal (fun _ : Unit => numerator H S)) + have hp : p * p = p := (projection_idempotent H S).eq + have hps : star p = p := (projection_selfAdjoint H S).star_eq + refine ⟨D, denominator_odd H S, P, ?_, ?_, ?_, Z, ?_, u, v, ?_⟩ + · dsimp only [P] + rw [Matrix.fromBlocks_multiply] + simp only [Matrix.one_mul, Matrix.mul_zero, Matrix.zero_mul, add_zero, zero_add, + Matrix.diagonal_mul_diagonal, hp] + · change Matrix.conjTranspose P = P + dsimp only [P] + rw [Matrix.fromBlocks_conjTranspose] + simp only [Matrix.conjTranspose_one, Matrix.conjTranspose_zero, Matrix.diagonal_conjTranspose] + congr 2 + funext i + exact hps + · have he : (∑ i, (P i i).coeff 1) = (Fintype.card d : ℚ) + (p.coeff 1) := by + simp [P, Fintype.sum_sum_type] + rw [he, lt_add_iff_pos_right] + rw [show p = projection H S from rfl, projection_trace H S hS] + positivity + · apply Matrix.ext + intro i j + rcases i with i | i <;> rcases j with j | j + · change fullIntToRat H (((D : ℤ) • (1 : Matrix d d _)) i j) = + (D : ℚ) • (1 : Matrix d d _) i j + rw [show (((D : ℤ) • (1 : Matrix d d _)) i j) = (D : ℤ) • ((1 : Matrix d d _) i j) from rfl, + fullIntToRat_zsmul] + simp [Matrix.one_apply] + · simp [Z, P, Matrix.map_apply] + · simp [Z, P, Matrix.map_apply] + · cases i; cases j + exact numerator_toRat H S + · rw [huv] + apply Matrix.ext + intro i j + rcases i with i | i <;> rcases j with j | j + · change (1 : Matrix d d _) i j = fullIntToBin H (((D : ℤ) • (1 : Matrix d d _)) i j) + rw [show (((D : ℤ) • (1 : Matrix d d _)) i j) = (D : ℤ) • ((1 : Matrix d d _) i j) from rfl, + fullIntToBin_zsmul] + simp [Matrix.one_apply, (denominator_odd H S).natCast_zmod_two, D] + · simp [Z, Matrix.map_apply, Matrix.fromBlocks] + · simp [Z, Matrix.map_apply, Matrix.fromBlocks] + · cases i; cases j + rfl + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/ProjectionLog.lean b/lean/OAI/Analysis/GroupDeterminants/ProjectionLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..27c7f152b4303f9ed7e2539eaa90401c4e0c418a --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/ProjectionLog.lean @@ -0,0 +1,55 @@ +import OAI.Analysis.GroupDeterminants.RegularAdjoint + +namespace OAI + +universe uA + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +section ProjectionLog +variable {A : Type uA} [CStarAlgebra A] + +theorem cfc_projectionReweight (P : A) (hP : IsSelfAdjoint P) (a b : ℝ) : + cfc (fun x : ℝ => a * x + b * (1 - x)) P = projectionReweight P a b := by + rw [cfc_add P (fun x : ℝ => a * x) (fun x : ℝ => b * (1 - x)) + (by fun_prop) (by fun_prop), + cfc_const_mul a (fun x : ℝ => x) P (by fun_prop), + cfc_const_mul b (fun x : ℝ => 1 - x) P (by fun_prop), + cfc_sub (fun _ : ℝ => 1) (fun x : ℝ => x) P (by fun_prop) (by fun_prop)] + simp [projectionReweight, cfc_id' ℝ P hP, cfc_const_one ℝ P hP] + +theorem log_projectionReweight (P : A) (hP : IsSelfAdjoint P) (hPP : P * P = P) + (a b : ℝ) (ha : a ≠ 0) (hb : b ≠ 0) : + CFC.log (projectionReweight P a b) = + projectionReweight P (Real.log a) (Real.log b) := by + have hp : IsIdempotentElem P := hPP + have hc : ContinuousOn Real.log ((fun x : ℝ => a * x + b * (1 - x)) '' spectrum ℝ P) := by + rintro y ⟨x, hx, rfl⟩ + rcases hp.spectrum_subset ℝ hx with h | h + · have hx0 : x = 0 := h + simp only [hx0, mul_zero, sub_zero, mul_one, zero_add] + exact (Real.continuousAt_log hb).continuousWithinAt + · have hx1 : x = 1 := h + simp only [hx1, mul_one, sub_self, mul_zero, add_zero] + exact (Real.continuousAt_log ha).continuousWithinAt + rw [CFC.log, ← cfc_projectionReweight P hP a b, + ← cfc_comp' Real.log (fun x : ℝ => a * x + b * (1 - x)) P hc (by fun_prop) hP, + ← cfc_projectionReweight P hP (Real.log a) (Real.log b)] + apply cfc_congr + intro x hx + rcases hp.spectrum_subset ℝ hx with h | h + · have hx0 : x = 0 := h + simp [hx0] + · have hx1 : x = 1 := h + simp [hx1] + +end ProjectionLog + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/RationalRepresentation.lean b/lean/OAI/Analysis/GroupDeterminants/RationalRepresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..51fd734ab6f5ddbeab69751501b717d58d196914 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/RationalRepresentation.lean @@ -0,0 +1,68 @@ +import OAI.Analysis.GroupDeterminants.TransferTrace + +namespace OAI + +noncomputable section +open scoped BigOperators Pointwise + +namespace GroupRingDeterminant +section RationalMap +variable {G I J : Type} [Group G] + +def rationalComplexMap : MonoidAlgebra ℚ G →+* MonoidAlgebra ℂ G := + MonoidAlgebra.mapRingHom G (Rat.castHom ℂ) + +lemma rationalComplexMap_smul (q : ℚ) (A : Matrix I J (MonoidAlgebra ℚ G)) : + (q • A).map rationalComplexMap = (q : ℝ) • A.map rationalComplexMap := by + apply Matrix.ext + intro i j + change rationalComplexMap (q • A i j) = (q : ℝ) • rationalComplexMap (A i j) + rw [map_rat_smul, Rat.cast_smul_eq_qsmul ℝ] + +variable [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] +omit [Fintype J] in +lemma transferMatrix_map_complex (q : ℚ) (P : Matrix J J (MonoidAlgebra ℚ G)) + (U : Matrix J I (MonoidAlgebra ℚ G)) (V : Matrix I J (MonoidAlgebra ℚ G)) : + (transferMatrix q P U V).map rationalComplexMap = + transferMatrix (q : ℝ) (P.map rationalComplexMap) (U.map rationalComplexMap) + (V.map rationalComplexMap) := by + simp only [transferMatrix, Matrix.fromBlocks_map, rationalComplexMap_smul, + Matrix.map_one _ (map_zero _) (map_one _), + Matrix.map_sub _ (map_sub _) _ _, Matrix.map_mul, Rat.cast_inv] + +omit [Fintype I] [DecidableEq I] in +lemma rationalComplexMap_star (P : Matrix I I (MonoidAlgebra ℚ G)) : + (star P).map rationalComplexMap = star (P.map rationalComplexMap) := by + apply Matrix.ext + intro i j + change rationalComplexMap (star (P j i)) = star (rationalComplexMap (P j i)) + exact groupAlgebra_map_star (Rat.castHom ℂ) (fun q => by simp) _ + +omit [DecidableEq I] in +lemma rationalComplexMap_trace (P : Matrix I I (MonoidAlgebra ℚ G)) : + (∑ i, ((P.map rationalComplexMap) i i).coeff 1).re = + ((∑ i, (P i i).coeff 1 : ℚ) : ℝ) := by + simp [Matrix.map_apply, rationalComplexMap] + +lemma reindexed_rational_isUnit (A : Matrix I I (MonoidAlgebra ℤ G)) + (hA : IsUnit (A.map toRat)) : + IsUnit (rationalMatrix (Matrix.reindex (Fintype.equivFin I) (Fintype.equivFin I) A)) := + hA.map (Matrix.reindexRingEquiv (MonoidAlgebra ℚ G) (Fintype.equivFin I)).toRingHom + +lemma rationalIndexed_integer (A : Matrix I I (MonoidAlgebra ℤ G)) : + indexedComplexRepresentation ((A.map toRat).map rationalComplexMap) = + regularOperator (Matrix.reindex (Fintype.equivFin I) (Fintype.equivFin I) A) := by + have hf : rationalComplexMap.comp (toRat (G := G)) = + MonoidAlgebra.mapRingHom G (Int.castRingHom ℂ) := by + rw [rationalComplexMap, toRat, ← MonoidAlgebra.mapRingHom_comp] + congr 1 + change complexOperator ((Matrix.reindex (Fintype.equivFin I) (Fintype.equivFin I) A).map + (rationalComplexMap.comp (toRat (G := G)))) = _ + rw [hf, complexOperator_integer] + +end RationalMap +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/RegularAdjoint.lean b/lean/OAI/Analysis/GroupDeterminants/RegularAdjoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..89a1a9fae654fa2e9f2b4874335ce9f6298a83ea --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/RegularAdjoint.lean @@ -0,0 +1,73 @@ +import OAI.Analysis.GroupDeterminants.ComplexRepresentation + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +section RegularStar +variable {G : Type} [Group G] {n : ℕ} + +theorem complexOperator_smul (z : ℂ) + (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G)) : + complexOperator (z • A) = z • complexOperator A := by + classical + unfold complexOperator + simp only [Matrix.smul_apply, MonoidAlgebra.coeff_smul] + rw [Finset.smul_sum] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.smul_sum] + apply Finset.sum_congr rfl + intro j _ + rw [Finsupp.sum_smul_index (fun g => zero_smul ℂ (elementaryOperator i j g)), + Finsupp.smul_sum] + simp only [smul_smul] + +def complexAlgebraRepresentation : Matrix (Fin n) (Fin n) (MonoidAlgebra ℂ G) →ₐ[ℂ] + (Hilbert G n →L[ℂ] Hilbert G n) := + AlgHom.ofLinearMap + { toFun := complexOperator + map_add' := complexOperator_add + map_smul' := complexOperator_smul } + complexOperator_one complexOperator_mul + +theorem elementaryOperator_star (i j : Fin n) (g : G) : + star (elementaryOperator i j g) = elementaryOperator j i g⁻¹ := by + classical + rw [eq_comm, ContinuousLinearMap.star_eq_adjoint, + ContinuousLinearMap.eq_adjoint_iff] + intro ξ η + rw [lp.inner_eq_tsum, lp.inner_eq_tsum] + let e : Fin n × G ≃ Fin n × G := + Equiv.prodCongr (Equiv.swap i j) (Equiv.mulLeft g) + rw [← e.tsum_eq (fun a => inner ℂ (ξ a) (elementaryOperator i j g η a))] + apply tsum_congr + rintro ⟨a, h⟩ + simp only [elementaryOperator_apply, e, Equiv.prodCongr_apply] + by_cases ha : a = j + · subst a + simp [elementaryOperator_apply] + · have hs : Equiv.swap i j a ≠ i := by + intro hsi + have := (Equiv.swap i j).injective (hsi.trans (Equiv.swap_apply_right i j).symm) + exact ha this + simp [elementaryOperator_apply, ha, hs] + +theorem groupTrace_star (T : Hilbert G n →L[ℂ] Hilbert G n) : + groupTrace (star T) = star (groupTrace T) := by + simp only [groupTrace, star_sum, ContinuousLinearMap.star_eq_adjoint, + ContinuousLinearMap.adjoint_inner_right] + apply Finset.sum_congr rfl + intro i _ + exact (inner_conj_symm (T (identityVector i)) (identityVector i)).symm + +end RegularStar + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/RegularOperators.lean b/lean/OAI/Analysis/GroupDeterminants/RegularOperators.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed5d3fb7f5c0110db3e07b1be40aa5d04c953cc1 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/RegularOperators.lean @@ -0,0 +1,88 @@ +import OAI.Analysis.GroupDeterminants.ModularLifting + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +section RegularAction +open scoped ENNReal +variable {G : Type} [Group G] {n : ℕ} + +def reindex (e : (Fin n × G) ≃ (Fin n × G)) : Hilbert G n →ₗᵢ[ℂ] Hilbert G n where + toFun ξ := ⟨fun a => ξ (e a), memℓp_gen + (((lp.memℓp ξ).summable (by norm_num)).comp_injective e.injective)⟩ + map_add' ξ η := by ext a; rfl + map_smul' z ξ := by ext a; rfl + norm_map' ξ := by + rw [lp.norm_eq_tsum_rpow (by norm_num), lp.norm_eq_tsum_rpow (by norm_num)] + congr 1 + exact e.tsum_eq (fun a => ‖ξ a‖ ^ (2 : ℝ≥0∞).toReal) + +def cutComponent (i : Fin n) : Hilbert G n →L[ℂ] Hilbert G n := by + classical + let f : Hilbert G n →ₗ[ℂ] Hilbert G n := { + toFun ξ := ⟨fun a => if a.1 = i then ξ a else 0, + (lp.memℓp ξ).mono' (fun a => by split_ifs <;> simp)⟩ + map_add' ξ η := by + ext a + change (if a.1 = i then ξ a + η a else 0) = + (if a.1 = i then ξ a else 0) + (if a.1 = i then η a else 0) + split_ifs <;> simp + map_smul' z ξ := by + ext a + change (if a.1 = i then z • ξ a else 0) = z • (if a.1 = i then ξ a else 0) + split_ifs <;> simp } + exact f.mkContinuous 1 (fun ξ => by + simpa only [one_mul] using lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + (x := f ξ) (y := ξ) (fun a => by + change ‖ite (a.1 = i) (ξ a) 0‖ ≤ ‖ξ a‖ + split_ifs <;> simp)) + +omit [Group G] in +@[simp] theorem cutComponent_apply (i : Fin n) (ξ : Hilbert G n) (a : Fin n × G) : + cutComponent i ξ a = if a.1 = i then ξ a else 0 := rfl + +def elementaryOperator (i j : Fin n) (g : G) : Hilbert G n →L[ℂ] Hilbert G n := + (cutComponent i).comp (reindex + (Equiv.prodCongr (Equiv.swap i j) (Equiv.mulLeft g⁻¹))).toContinuousLinearMap + +theorem elementaryOperator_apply (i j : Fin n) (g : G) (ξ : Hilbert G n) + (a : Fin n) (h : G) : + elementaryOperator i j g ξ (a, h) = if a = i then ξ (j, g⁻¹ * h) else 0 := by + classical + by_cases hi : a = i + · subst a + simp [elementaryOperator, reindex, cutComponent_apply] + · simp [elementaryOperator, cutComponent_apply, hi] + +def regularOperator (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)) : + Hilbert G n →L[ℂ] Hilbert G n := + ∑ i : Fin n, ∑ j : Fin n, (A i j).coeff.sum + (fun g z => (z : ℂ) • elementaryOperator i j g) + +theorem regularOperator_spec (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)) : + IsRegularOperator A (regularOperator A) := by + classical + intro ξ i h + simp only [regularOperator, Finsupp.sum, sum_apply, + smul_apply, lp.coeFn_sum, Finset.sum_apply, lp.coeFn_smul, + Pi.smul_apply, smul_eq_mul, elementaryOperator_apply] + rw [Finset.sum_eq_single i] + · simp + · intro b _ hbi + simp [Ne.symm hbi] + · simp + +theorem exists_regularOperator (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)) : + ∃ T, IsRegularOperator A T := ⟨regularOperator A, regularOperator_spec A⟩ + +end RegularAction + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/RegularTrace.lean b/lean/OAI/Analysis/GroupDeterminants/RegularTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab547a4889864da4da14889b852cd1dabfafd7ca --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/RegularTrace.lean @@ -0,0 +1,44 @@ +import OAI.Analysis.GroupDeterminants.TransferAlgebra + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +section RegularTrace +variable {G : Type} [Group G] {n : ℕ} + +theorem identityVector_apply [DecidableEq G] (i j : Fin n) (g : G) : + identityVector i (j, g) = if j = i ∧ g = 1 then 1 else 0 := by + classical + simp only [identityVector, lp.single_apply, Pi.single_apply, Prod.mk.injEq] + +theorem groupTrace_regular {A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)} + {T : Hilbert G n →L[ℂ] Hilbert G n} (hT : IsRegularOperator A T) : + groupTrace T = ∑ i : Fin n, ((A i i).coeff 1 : ℂ) := by + classical + unfold groupTrace + apply Finset.sum_congr rfl + intro i _ + have hi (ξ : Hilbert G n) : inner ℂ (identityVector i) ξ = ξ (i, 1) := by + simp [identityVector, lp.inner_single_left, RCLike.inner_apply] + rw [hi, hT] + rw [Finset.sum_eq_single i] + · rw [(A i i).coeff.sum_eq_single 1] + · simp [identityVector_apply] + · intro g _ hg + simp [identityVector_apply, hg] + · simp + · intro j _ hji + simp [identityVector_apply, hji] + · simp + +end RegularTrace + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/ShearTrace.lean b/lean/OAI/Analysis/GroupDeterminants/ShearTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..29bd19aff8e94a01607407612b0ec073e1b16b4e --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/ShearTrace.lean @@ -0,0 +1,36 @@ +import OAI.Analysis.GroupDeterminants.WeightedTrace + +namespace OAI + +noncomputable section +open scoped BigOperators Pointwise + +namespace GroupRingDeterminant +section IndexedShear +variable {G I : Type} [Group G] [Fintype I] [DecidableEq I] +lemma indexed_trace_log_shear (B S T : Matrix I I (MonoidAlgebra ℂ G)) + (hB : IsUnit B) (hS : S * S = 0) (hT : T * T = 0) + (htS : ∑ i, (S i i).coeff 1 = 0) (htT : ∑ i, (T i i).coeff 1 = 0) : + let φ := indexedComplexRepresentation (G := G) (I := I) + groupTrace (CFC.log (star (φ ((1 + S) * B * (1 + T))) * φ ((1 + S) * B * (1 + T)))) = + groupTrace (CFC.log (star (φ B) * φ B)) := by + let e := Matrix.reindexAlgEquiv ℂ (MonoidAlgebra ℂ G) (Fintype.equivFin I) + have hs : e S * e S = 0 := by rw [← map_mul, hS, map_zero] + have ht : e T * e T = 0 := by rw [← map_mul, hT, map_zero] + have hts : ∑ i, ((e S) i i).coeff 1 = 0 := + ((Fintype.equivFin I).symm.sum_comp (fun i => (S i i).coeff 1)).trans htS + have htt : ∑ i, ((e T) i i).coeff 1 = 0 := + ((Fintype.equivFin I).symm.sum_comp (fun i => (T i i).coeff 1)).trans htT + have H := groupTrace_log_shear_invariant (e B) (e S) (e T) + (hB.map e.toRingHom) hs ht hts htt 1 + change groupTrace (CFC.log (star (complexOperator (e ((1 + S) * B * (1 + T)))) * + complexOperator (e ((1 + S) * B * (1 + T))))) = + groupTrace (CFC.log (star (complexOperator (e B)) * complexOperator (e B))) + simpa only [map_mul, map_add, map_one, complexOperator_mul, complexOperator_add, + complexOperator_one, one_smul] using H +end IndexedShear +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/TraceLog.lean b/lean/OAI/Analysis/GroupDeterminants/TraceLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..a48cbb4df56fdb55db754bed553dfc1d543f1de6 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/TraceLog.lean @@ -0,0 +1,242 @@ +import OAI.Analysis.GroupDeterminants.LogSeries + +namespace OAI + +universe uA + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +open Filter Topology + +section TraceCFC +variable {A : Type uA} [CStarAlgebra A] [Nontrivial A] + +lemma hasDerivAt_trace_log_one_sub (τ : A →L[ℝ] ℂ) + (hτ : ∀ a b, τ (a * b) = τ (b * a)) + {f f' : ℝ → A} {x : ℝ} (hf : ∀ y, HasDerivAt f (f' y) y) + (hc : ContinuousAt f' x) (hn : ‖f x‖ < 1) (hself : ∀ y, IsSelfAdjoint (f y)) : + HasDerivAt (fun y => τ (CFC.log (1 - f y))) + (-τ (f' x * Ring.inverse (1 - f x))) x := by + have hd := (hasDerivAt_trace_logSeries_local τ hτ hf hc hn).neg + apply hd.congr_of_eventuallyEq + have he : ∀ᶠ y in 𝓝 x, ‖f y‖ < 1 := + (hf x).continuousAt.norm.eventually (gt_mem_nhds hn) + filter_upwards [he] with y hy + have hh := (τ.hasSum (hasSum_pow_div_cfc_log (f y) (hself y) hy)).tsum_eq + simpa only [map_neg, neg_neg, Pi.neg_apply] using (congrArg Neg.neg hh).symm + +omit [Nontrivial A] in +lemma log_smul_of_isUnit (V : A) (hV : IsSelfAdjoint V) (hu : IsUnit V) + (c : ℝ) (hc : 0 < c) : + CFC.log (c • V) = Real.log c • (1 : A) + CFC.log V := by + have hne (x : ℝ) (hx : x ∈ spectrum ℝ V) : x ≠ 0 := by + intro he + exact (spectrum.zero_notMem_iff ℝ).mpr hu (he ▸ hx) + have hl : ContinuousOn Real.log (spectrum ℝ V) := by + intro x hx + exact (Real.continuousAt_log (hne x hx)).continuousWithinAt + have hlc : ContinuousOn Real.log ((fun x : ℝ => c * x) '' spectrum ℝ V) := by + rintro y ⟨x, hx, rfl⟩ + exact (Real.continuousAt_log (mul_ne_zero hc.ne' (hne x hx))).continuousWithinAt + have he : cfc (fun x : ℝ => c * x) V = c • V := cfc_const_mul_id c V hV + rw [CFC.log, ← he, ← cfc_comp' Real.log (fun x : ℝ => c * x) V hlc (by fun_prop) hV] + calc + cfc (fun x : ℝ => Real.log (c * x)) V = + cfc (fun x : ℝ => Real.log c + Real.log x) V := by + apply cfc_congr + intro x hx + exact Real.log_mul hc.ne' (hne x hx) + _ = Real.log c • (1 : A) + CFC.log V := by + rw [cfc_add V (fun _ : ℝ => Real.log c) Real.log (by fun_prop) hl, + cfc_const (Real.log c) V hV, Algebra.algebraMap_eq_smul_one] + rfl + +lemma norm_one_sub_rescale_star_mul_self (M : A) (hu : IsUnit M) : + ‖1 - (‖star M * M‖ + 1)⁻¹ • (star M * M)‖ < 1 := by + let N := star M * M + let c := ‖N‖ + 1 + have hc : 0 < c := by dsimp [c]; positivity + have hN : IsSelfAdjoint N := IsSelfAdjoint.star_mul_self M + have huN : IsUnit N := hu.star.mul hu + have he : cfc (fun x : ℝ => 1 - c⁻¹ * x) N = 1 - c⁻¹ • N := by + rw [cfc_sub (fun _ : ℝ => 1) (fun x => c⁻¹ * x) N (by fun_prop) (by fun_prop), + cfc_const_one ℝ N hN, cfc_const_mul_id c⁻¹ N hN] + change ‖1 - c⁻¹ • N‖ < 1 + rw [← he] + apply norm_cfc_lt zero_lt_one + intro x hx + have hx₀ : 0 < x := by + have hn : 0 ≤ x := spectrum_star_mul_self_nonneg x hx + have hnz : x ≠ 0 := fun hz => (spectrum.zero_notMem_iff ℝ).mpr huN (hz ▸ hx) + exact lt_of_le_of_ne hn (Ne.symm hnz) + have hxn : x < c := by + have hb := spectrum.norm_le_norm_of_mem hx + dsimp [c] + rw [Real.norm_of_nonneg hx₀.le] at hb + linarith + rw [Real.norm_eq_abs, abs_lt] + have hxc : 0 < c⁻¹ * x := mul_pos (inv_pos.mpr hc) hx₀ + have hxc' : c⁻¹ * x < 1 := by + rw [mul_comm, ← div_eq_mul_inv] + exact (div_lt_one hc).mpr hxn + constructor <;> linarith + +omit [Nontrivial A] in +lemma ringInverse_smul (N : A) (hu : IsUnit N) (c : ℝ) (hc : c ≠ 0) : + Ring.inverse (c • N) = c⁻¹ • Ring.inverse N := by + have hu' : IsUnit (c • N) := by + rw [Algebra.smul_def] + exact ((isUnit_iff_ne_zero.mpr hc).map (algebraMap ℝ A)).mul hu + have hm : (c • N) * (c⁻¹ • Ring.inverse N) = 1 := by + rw [smul_mul_smul_comm, mul_inv_cancel₀ hc, one_smul, Ring.mul_inverse_cancel N hu] + calc + Ring.inverse (c • N) = Ring.inverse (c • N) * 1 := (mul_one _).symm + _ = Ring.inverse (c • N) * ((c • N) * (c⁻¹ • Ring.inverse N)) := by rw [hm] + _ = c⁻¹ • Ring.inverse N := Ring.inverse_mul_cancel_left _ _ hu' + +lemma hasDerivAt_trace_log_of_rescale (τ : A →L[ℝ] ℂ) + (hτ : ∀ a b, τ (a * b) = τ (b * a)) + {N N' : ℝ → A} {x c : ℝ} (hc : 0 < c) + (hd : ∀ y, HasDerivAt N (N' y) y) (hdc : ContinuousAt N' x) + (hself : ∀ y, IsSelfAdjoint (N y)) (hu : ∀ y, IsUnit (N y)) + (hn : ‖1 - c⁻¹ • N x‖ < 1) : + HasDerivAt (fun y => τ (CFC.log (N y))) + (τ (N' x * Ring.inverse (N x))) x := by + let W := fun y => (1 : A) - c⁻¹ • N y + let W' := fun y => -(c⁻¹ • N' y) + have hW (y : ℝ) : HasDerivAt W (W' y) y := by + simpa [W, W'] using (hd y).const_smul c⁻¹ |>.const_sub 1 + have hWc : ContinuousAt W' x := (hdc.const_smul c⁻¹).neg + have hWs (y : ℝ) : IsSelfAdjoint (W y) := + (IsSelfAdjoint.one A).sub ((IsSelfAdjoint.all (c⁻¹)).smul (hself y)) + have he (y : ℝ) : 1 - W y = c⁻¹ • N y := by dsimp [W]; abel + have hue (y : ℝ) : IsUnit (1 - W y) := by + rw [he, Algebra.smul_def] + exact ((isUnit_iff_ne_zero.mpr (inv_ne_zero hc.ne')).map (algebraMap ℝ A)).mul (hu y) + have hrescale (y : ℝ) : c • (1 - W y) = N y := by + rw [he, smul_smul, mul_inv_cancel₀ hc.ne', one_smul] + have hlog (y : ℝ) : CFC.log (N y) = Real.log c • (1 : A) + CFC.log (1 - W y) := by + rw [← hrescale y] + exact log_smul_of_isUnit (1 - W y) ((IsSelfAdjoint.one A).sub (hWs y)) (hue y) c hc + have H := (hasDerivAt_trace_log_one_sub τ hτ hW hWc hn hWs).const_add + (τ (Real.log c • (1 : A))) + have hdval : -τ (W' x * Ring.inverse (1 - W x)) = τ (N' x * Ring.inverse (N x)) := by + rw [he, ringInverse_smul (N x) (hu x) _ (inv_ne_zero hc.ne'), inv_inv] + dsimp [W'] + rw [neg_mul, smul_mul_smul_comm, inv_mul_cancel₀ hc.ne', one_smul, map_neg, neg_neg] + rw [hdval] at H + convert! H using 1 + ext y + rw [hlog, map_add] + +omit [Nontrivial A] in +lemma trace_star_mul_self_log_derivative_value (τ : A →L[ℝ] ℂ) + (hτ : ∀ a b, τ (a * b) = τ (b * a)) (hstar : ∀ a, τ (star a) = star (τ a)) + (M D : A) (hu : IsUnit M) : + τ ((star D * M + star M * D) * Ring.inverse (star M * M)) = + (2 * (τ (D * Ring.inverse M)).re : ℝ) := by + rw [add_mul, map_add] + have hfirst : τ (star D * M * Ring.inverse (star M * M)) = + star (τ (D * Ring.inverse M)) := by + rw [Ring.inverse_mul (Or.inl hu.star), ← mul_assoc, + Ring.mul_inverse_cancel_right M (star D) hu, hτ, Ring.inverse_star, + ← star_mul, hstar] + have hsecond : τ (star M * D * Ring.inverse (star M * M)) = τ (D * Ring.inverse M) := by + rw [mul_assoc, hτ, Ring.inverse_mul (Or.inl hu.star), mul_assoc D, + mul_assoc (Ring.inverse M), Ring.inverse_mul_cancel (star M) hu.star, mul_one] + rw [hfirst, hsecond, add_comm] + exact Complex.add_conj _ + +lemma hasDerivAt_trace_log_star_mul_self (τ : A →L[ℝ] ℂ) + (hτ : ∀ a b, τ (a * b) = τ (b * a)) (hstar : ∀ a, τ (star a) = star (τ a)) + {M M' : ℝ → A} {x : ℝ} (hd : ∀ y, HasDerivAt M (M' y) y) + (hdc : ContinuousAt M' x) (hu : ∀ y, IsUnit (M y)) : + HasDerivAt (fun y => τ (CFC.log (star (M y) * M y))) + (2 * (τ (M' x * Ring.inverse (M x))).re : ℝ) x := by + let N := fun y => star (M y) * M y + let N' := fun y => star (M' y) * M y + star (M y) * M' y + have hN (y : ℝ) : HasDerivAt N (N' y) y := (hd y).star.mul (hd y) + have hNc : ContinuousAt N' x := + (hdc.star.mul (hd x).continuousAt).add ((hd x).continuousAt.star.mul hdc) + have H := hasDerivAt_trace_log_of_rescale τ hτ + (show 0 < ‖N x‖ + 1 by positivity) hN hNc + (fun y => IsSelfAdjoint.star_mul_self (M y)) (fun y => (hu y).star.mul (hu y)) + (norm_one_sub_rescale_star_mul_self (M x) (hu x)) + rwa [trace_star_mul_self_log_derivative_value τ hτ hstar (M x) (M' x) (hu x)] at H + +omit [Nontrivial A] in +lemma trace_derivative_mul_value (τ : A →L[ℝ] ℂ) + (hτ : ∀ a b, τ (a * b) = τ (b * a)) (L R D E : A) + (hL : IsUnit L) (hR : IsUnit R) : + τ ((D * R + L * E) * Ring.inverse (L * R)) = + τ (D * Ring.inverse L) + τ (E * Ring.inverse R) := by + rw [add_mul, map_add, Ring.inverse_mul (Or.inl hL)] + congr 1 + · rw [← mul_assoc, Ring.mul_inverse_cancel_right R D hR] + · rw [mul_assoc L, hτ L, ← mul_assoc E, mul_assoc (E * Ring.inverse R), + Ring.inverse_mul_cancel L hL, mul_one] + +omit [Nontrivial A] in +def nilpotentShearUnit (S : A) (hS : S * S = 0) (x : ℝ) : Aˣ where + val := 1 + x • S + inv := 1 - x • S + val_inv := by + simp only [add_mul, mul_sub, one_mul, mul_one, smul_mul_smul_comm, hS, smul_zero] + abel + inv_val := by + simp only [sub_mul, mul_add, one_mul, mul_one, smul_mul_smul_comm, hS, smul_zero] + abel + +omit [Nontrivial A] in +lemma ringInverse_nilpotentShear (S : A) (hS : S * S = 0) (x : ℝ) : + Ring.inverse (1 + x • S) = 1 - x • S := + Ring.inverse_unit (nilpotentShearUnit S hS x) + +omit [Nontrivial A] in +lemma nilpotentShear_trace_derivative (τ : A →L[ℝ] ℂ) (S : A) + (hS : S * S = 0) (ht : τ S = 0) (x : ℝ) : + τ (S * Ring.inverse (1 + x • S)) = 0 := by + rw [ringInverse_nilpotentShear S hS x, mul_sub, mul_one, mul_smul_comm, hS, + smul_zero, sub_zero, ht] + +lemma trace_log_shear_invariant (τ : A →L[ℝ] ℂ) + (hτ : ∀ a b, τ (a * b) = τ (b * a)) (hstar : ∀ a, τ (star a) = star (τ a)) + (B S T : A) (hB : IsUnit B) (hS : S * S = 0) (hT : T * T = 0) + (htS : τ S = 0) (htT : τ T = 0) (x : ℝ) : + τ (CFC.log (star ((1 + x • S) * B * (1 + x • T)) * + ((1 + x • S) * B * (1 + x • T)))) = τ (CFC.log (star B * B)) := by + let M := fun y : ℝ => (1 + y • S) * B * (1 + y • T) + let M' := fun y : ℝ => S * B * (1 + y • T) + (1 + y • S) * B * T + have hL (y : ℝ) : HasDerivAt (fun y : ℝ => 1 + y • S) S y := by + simpa using ((hasDerivAt_id y).smul_const S).const_add 1 + have hR (y : ℝ) : HasDerivAt (fun y : ℝ => 1 + y • T) T y := by + simpa using ((hasDerivAt_id y).smul_const T).const_add 1 + have hd (y : ℝ) : HasDerivAt M (M' y) y := ((hL y).mul_const B).mul (hR y) + have hdc : Continuous M' := by dsimp [M']; fun_prop + have huL (y : ℝ) : IsUnit (1 + y • S) := (nilpotentShearUnit S hS y).isUnit + have huR (y : ℝ) : IsUnit (1 + y • T) := (nilpotentShearUnit T hT y).isUnit + have hu (y : ℝ) : IsUnit (M y) := ((huL y).mul hB).mul (huR y) + have hz (y : ℝ) : τ (M' y * Ring.inverse (M y)) = 0 := by + dsimp [M, M'] + rw [trace_derivative_mul_value τ hτ _ _ _ _ ((huL y).mul hB) (huR y), + Ring.inverse_mul (Or.inl (huL y)), ← mul_assoc, + Ring.mul_inverse_cancel_right B S hB, + nilpotentShear_trace_derivative τ S hS htS, + nilpotentShear_trace_derivative τ T hT htT, add_zero] + have H (y : ℝ) : HasDerivAt (fun y => τ (CFC.log (star (M y) * M y))) 0 y := by + simpa only [hz y, Complex.zero_re, mul_zero, Complex.ofReal_zero] using + hasDerivAt_trace_log_star_mul_self τ hτ hstar hd hdc.continuousAt hu (x := y) + have he := is_const_of_deriv_eq_zero (fun y => (H y).differentiableAt) + (fun y => (H y).deriv) x 0 + simpa [M] using he + +end TraceCFC + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/TransferAlgebra.lean b/lean/OAI/Analysis/GroupDeterminants/TransferAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b5d5f7ca0dd590f8fba5884b8dabe02c0527daa --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/TransferAlgebra.lean @@ -0,0 +1,126 @@ +import OAI.Analysis.GroupDeterminants.RegularOperators + +namespace OAI + +universe uF uR ur um + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +section ProjectionScalars +variable {F : Type uF} {R : Type uR} [Field F] [Ring R] [Algebra F R] + +def projectionReweight (P : R) (a b : F) : R := a • P + b • (1 - P) + +theorem projectionReweight_mul (P : R) (hP : P * P = P) (a b c d : F) : + projectionReweight P a b * projectionReweight P c d = + projectionReweight P (a * c) (b * d) := by + have h₁ : P * (1 - P) = 0 := by rw [mul_sub, mul_one, hP, sub_self] + have h₂ : (1 - P) * P = 0 := by rw [sub_mul, one_mul, hP, sub_self] + have h₃ : (1 - P) * (1 - P) = 1 - P := by + calc + (1 - P) * (1 - P) = 1 - P - P + P * P := by noncomm_ring + _ = 1 - P := by rw [hP]; noncomm_ring + simp only [projectionReweight, add_mul, mul_add, smul_mul_smul_comm, hP, + h₁, h₂, h₃, smul_zero, add_zero, zero_add] + +@[simp] theorem projectionReweight_one (P : R) : projectionReweight P (1 : F) 1 = 1 := by + simp [projectionReweight] + +def projectionReweightUnit (P : R) (hP : P * P = P) (a b : F) (ha : a ≠ 0) (hb : b ≠ 0) : + Rˣ where + val := projectionReweight P a b + inv := projectionReweight P a⁻¹ b⁻¹ + val_inv := by rw [projectionReweight_mul P hP]; simp [ha, hb] + inv_val := by rw [projectionReweight_mul P hP]; simp [ha, hb] + +end ProjectionScalars + +section ShearAlgebra +variable {R : Type uR} {r : Type ur} {m : Type um} [Ring R] [Fintype r] [Fintype m] [DecidableEq r] [DecidableEq m] + +def lowerShear (S : Matrix m r R) : Matrix (r ⊕ m) (r ⊕ m) R := + Matrix.fromBlocks 1 0 S 1 + +def upperShear (T : Matrix r m R) : Matrix (r ⊕ m) (r ⊕ m) R := + Matrix.fromBlocks 1 T 0 1 + +theorem lowerShear_neg (S : Matrix m r R) : lowerShear S * lowerShear (-S) = 1 := by + simp [lowerShear, Matrix.fromBlocks_multiply, Matrix.fromBlocks_one] + +theorem upperShear_neg (T : Matrix r m R) : upperShear T * upperShear (-T) = 1 := by + simp [upperShear, Matrix.fromBlocks_multiply, Matrix.fromBlocks_one] + +def lowerShearUnit (S : Matrix m r R) : (Matrix (r ⊕ m) (r ⊕ m) R)ˣ where + val := lowerShear S + inv := lowerShear (-S) + val_inv := lowerShear_neg S + inv_val := by simpa using lowerShear_neg (-S) + +def upperShearUnit (T : Matrix r m R) : (Matrix (r ⊕ m) (r ⊕ m) R)ˣ where + val := upperShear T + inv := upperShear (-T) + val_inv := upperShear_neg T + inv_val := by simpa using upperShear_neg (-T) + +def blockDiagonalUnit (a : (Matrix r r R)ˣ) (b : (Matrix m m R)ˣ) : + (Matrix (r ⊕ m) (r ⊕ m) R)ˣ where + val := Matrix.fromBlocks ↑a 0 0 ↑b + inv := Matrix.fromBlocks ↑a⁻¹ 0 0 ↑b⁻¹ + val_inv := by simp [Matrix.fromBlocks_multiply, Matrix.fromBlocks_one] + inv_val := by simp [Matrix.fromBlocks_multiply, Matrix.fromBlocks_one] + +end ShearAlgebra + +section TransferAlgebra +variable {F : Type uF} {R : Type uR} {r : Type ur} {m : Type um} [Field F] [Ring R] [Algebra F R] +variable [Fintype r] [Fintype m] [DecidableEq r] [DecidableEq m] + +def transferMatrix (q : F) (P : Matrix m m R) (U : Matrix m r R) (V : Matrix r m R) : + Matrix (r ⊕ m) (r ⊕ m) R := + Matrix.fromBlocks (q • 1) V U (q⁻¹ • (U * V - P - q • (1 - P))) + +theorem transferMatrix_factorization (q : F) (hq : q ≠ 0) (P : Matrix m m R) + (U : Matrix m r R) (V : Matrix r m R) : + lowerShear (q⁻¹ • U) * + Matrix.fromBlocks (q • (1 : Matrix r r R)) 0 0 + (projectionReweight P (-q⁻¹) (-1 : F)) * upperShear (q⁻¹ • V) = + transferMatrix q P U V := by + rw [lowerShear, upperShear, Matrix.fromBlocks_multiply, Matrix.fromBlocks_multiply] + simp only [Matrix.zero_mul, Matrix.mul_zero, Matrix.one_mul, Matrix.mul_one, + add_zero, zero_add, Matrix.smul_mul, Matrix.mul_smul, smul_smul] + simp only [inv_mul_cancel₀ hq, mul_inv_cancel₀ hq, one_smul] + apply Matrix.fromBlocks_inj.mpr + refine ⟨rfl, ?_, rfl, ?_⟩ + · simp + · simp only [projectionReweight, neg_smul, one_smul, smul_sub, smul_smul, + inv_mul_cancel₀ hq, mul_one, one_smul] + abel + +theorem transferMatrix_isUnit (q : F) (hq : q ≠ 0) (P : Matrix m m R) + (hP : P * P = P) (U : Matrix m r R) (V : Matrix r m R) : + IsUnit (transferMatrix q P U V) := by + have hu : IsUnit (q • (1 : Matrix r r R)) := by + rw [Algebra.smul_def, mul_one] + exact (isUnit_iff_ne_zero.mpr hq).map (algebraMap F (Matrix r r R)) + obtain ⟨a, ha⟩ := hu + let b := projectionReweightUnit P hP (-q⁻¹) (-1 : F) + (neg_ne_zero.mpr (inv_ne_zero hq)) (neg_ne_zero.mpr one_ne_zero) + rw [← transferMatrix_factorization q hq P U V] + have hd : IsUnit (Matrix.fromBlocks (q • (1 : Matrix r r R)) 0 0 + (projectionReweight P (-q⁻¹) (-1 : F))) := by + refine ⟨blockDiagonalUnit a b, ?_⟩ + change Matrix.fromBlocks (a : Matrix r r R) 0 0 + (projectionReweight P (-q⁻¹) (-1 : F)) = _ + rw [ha] + exact (lowerShearUnit (q⁻¹ • U)).isUnit.mul hd |>.mul (upperShearUnit (q⁻¹ • V)).isUnit + +end TransferAlgebra + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/TransferTrace.lean b/lean/OAI/Analysis/GroupDeterminants/TransferTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..1007f05d7f4a3a89a519e4617b185aed0504d1cf --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/TransferTrace.lean @@ -0,0 +1,99 @@ +import OAI.Analysis.GroupDeterminants.ShearTrace + +namespace OAI + +noncomputable section +open scoped BigOperators Pointwise + +namespace GroupRingDeterminant +section TransferTrace +variable {G r m : Type} [Group G] [Fintype r] [Fintype m] [DecidableEq r] [DecidableEq m] + +def topBlockIdentity : Matrix (r ⊕ m) (r ⊕ m) (MonoidAlgebra ℂ G) := + Matrix.fromBlocks 1 0 0 0 + +def bottomBlock (P : Matrix m m (MonoidAlgebra ℂ G)) : + Matrix (r ⊕ m) (r ⊕ m) (MonoidAlgebra ℂ G) := Matrix.fromBlocks 0 0 0 P + +def lowerNil (U : Matrix m r (MonoidAlgebra ℂ G)) : + Matrix (r ⊕ m) (r ⊕ m) (MonoidAlgebra ℂ G) := Matrix.fromBlocks 0 0 U 0 + +def upperNil (V : Matrix r m (MonoidAlgebra ℂ G)) : + Matrix (r ⊕ m) (r ⊕ m) (MonoidAlgebra ℂ G) := Matrix.fromBlocks 0 V 0 0 + +lemma lowerNil_square (U : Matrix m r (MonoidAlgebra ℂ G)) : lowerNil U * lowerNil U = 0 := by + simp [lowerNil, Matrix.fromBlocks_multiply, Matrix.fromBlocks_zero] +lemma upperNil_square (V : Matrix r m (MonoidAlgebra ℂ G)) : upperNil V * upperNil V = 0 := by + simp [upperNil, Matrix.fromBlocks_multiply, Matrix.fromBlocks_zero] +omit [Fintype r] [Fintype m] in +lemma lowerShear_eq_one_add (U : Matrix m r (MonoidAlgebra ℂ G)) : + lowerShear U = 1 + lowerNil U := by + rw [lowerShear, lowerNil, ← Matrix.fromBlocks_one, Matrix.fromBlocks_add] + simp +omit [Fintype r] [Fintype m] in +lemma upperShear_eq_one_add (V : Matrix r m (MonoidAlgebra ℂ G)) : + upperShear V = 1 + upperNil V := by + rw [upperShear, upperNil, ← Matrix.fromBlocks_one, Matrix.fromBlocks_add] + simp + +lemma transfer_diagonal_weightedPair (q : ℝ) (P : Matrix m m (MonoidAlgebra ℂ G)) : + Matrix.fromBlocks (q • (1 : Matrix r r (MonoidAlgebra ℂ G))) 0 0 + (projectionReweight P (-q⁻¹) (-1 : ℝ)) = + weightedPair topBlockIdentity (bottomBlock P) q (-q⁻¹) (-1) := by + apply Matrix.ext + intro i j + rcases i with i | i <;> rcases j with j | j + · by_cases hij : i = j <;> + simp [weightedPair, topBlockIdentity, bottomBlock, Matrix.fromBlocks, hij] + · simp [weightedPair, topBlockIdentity, bottomBlock, Matrix.fromBlocks] + · simp [weightedPair, topBlockIdentity, bottomBlock, Matrix.fromBlocks] + · simp [weightedPair, topBlockIdentity, bottomBlock, projectionReweight, + Matrix.fromBlocks, Matrix.one_apply] + +lemma transfer_trace_log (q : ℝ) (hq : 0 < q) + (P : Matrix m m (MonoidAlgebra ℂ G)) (hP : P * P = P) + (U : Matrix m r (MonoidAlgebra ℂ G)) (V : Matrix r m (MonoidAlgebra ℂ G)) : + let M := indexedComplexRepresentation (transferMatrix q P U V) + groupTrace (CFC.log (star M * M)) = + (2 * ((Fintype.card r : ℝ) - (∑ i, (P i i).coeff 1).re) * Real.log q : ℝ) := by + let Q : Matrix (r ⊕ m) (r ⊕ m) (MonoidAlgebra ℂ G) := topBlockIdentity + let R : Matrix (r ⊕ m) (r ⊕ m) (MonoidAlgebra ℂ G) := bottomBlock P + have hQ : Q * Q = Q := by simp [Q, topBlockIdentity, Matrix.fromBlocks_multiply] + have hR : R * R = R := by simp [R, bottomBlock, Matrix.fromBlocks_multiply, hP] + have hQR : Q * R = 0 := by + simp [Q, R, topBlockIdentity, bottomBlock, Matrix.fromBlocks_multiply, Matrix.fromBlocks_zero] + have hRQ : R * Q = 0 := by + simp [Q, R, topBlockIdentity, bottomBlock, Matrix.fromBlocks_multiply, Matrix.fromBlocks_zero] + have hQs : IsSelfAdjoint Q := by + change Matrix.conjTranspose Q = Q + simp [Q, topBlockIdentity, Matrix.fromBlocks_conjTranspose] + let B := weightedPair Q R q (-q⁻¹) (-1) + have hB : IsUnit B := weightedPair_unit Q R hQ hR hQR hRQ _ _ _ + hq.ne' (neg_ne_zero.mpr (inv_ne_zero hq.ne')) (by norm_num) + let S := lowerNil (q⁻¹ • U) + let T := upperNil (q⁻¹ • V) + have htS : ∑ i, (S i i).coeff 1 = 0 := by simp [S, lowerNil, Fintype.sum_sum_type] + have htT : ∑ i, (T i i).coeff 1 = 0 := by simp [T, upperNil, Fintype.sum_sum_type] + have hf : transferMatrix q P U V = (1 + S) * B * (1 + T) := by + rw [← transferMatrix_factorization q hq.ne', transfer_diagonal_weightedPair, + lowerShear_eq_one_add, upperShear_eq_one_add] + have H := indexed_trace_log_shear B S T hB (lowerNil_square _) (upperNil_square _) htS htT + have H' := indexed_trace_log_weightedPair Q R hQ hR hQR hRQ hQs (Real.log q) + have hexp : Real.exp (Real.log q) = q := Real.exp_log hq + have hexpn : Real.exp (-Real.log q) = q⁻¹ := by rw [Real.exp_neg, hexp] + dsimp only at H H' ⊢ + rw [hf, H] + have ht : (∑ i, ((Q - R) i i).coeff 1) = + (Fintype.card r : ℂ) - ∑ i, (P i i).coeff 1 := by + simp [Q, R, topBlockIdentity, bottomBlock, Fintype.sum_sum_type] + rw [hexp, hexpn, ht] at H' + calc + _ = ((Real.log q * (2 * ((Fintype.card r : ℂ) - ∑ i, (P i i).coeff 1).re) : ℝ) : ℂ) := H' + _ = _ := by congr 1; simp only [Complex.sub_re, Complex.natCast_re]; ring + +end TransferTrace +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/WeightedProjections.lean b/lean/OAI/Analysis/GroupDeterminants/WeightedProjections.lean new file mode 100644 index 0000000000000000000000000000000000000000..c24fb0e606b63013a3c69cb41fabf18b33cfe82b --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/WeightedProjections.lean @@ -0,0 +1,97 @@ +import OAI.Analysis.GroupDeterminants.ClosedTrace + +namespace OAI + +universe uA + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +open Filter Topology + +section WeightedPair +variable {A : Type uA} [Ring A] [Algebra ℝ A] +def weightedPair (Q R : A) (a b c : ℝ) : A := a • Q + b • R + c • (1 - Q - R) +lemma weightedPair_mul (Q R : A) (hQ : Q * Q = Q) (hR : R * R = R) + (hQR : Q * R = 0) (hRQ : R * Q = 0) (a b c d e f : ℝ) : + weightedPair Q R a b c * weightedPair Q R d e f = weightedPair Q R (a*d) (b*e) (c*f) := by + simp only [weightedPair, add_mul, mul_add, smul_mul_smul_comm, + mul_sub, sub_mul, one_mul, mul_one, hQ, hR, hQR, hRQ, smul_zero, + smul_sub] + module +lemma weightedPair_one (Q R : A) : weightedPair Q R 1 1 1 = 1 := by + simp only [weightedPair, one_smul]; abel +lemma weightedPair_unit (Q R : A) (hQ : Q * Q = Q) (hR : R * R = R) + (hQR : Q * R = 0) (hRQ : R * Q = 0) (a b c : ℝ) + (ha : a ≠ 0) (hb : b ≠ 0) (hc : c ≠ 0) : IsUnit (weightedPair Q R a b c) := by + refine ⟨⟨weightedPair Q R a b c, weightedPair Q R a⁻¹ b⁻¹ c⁻¹, ?_, ?_⟩, rfl⟩ + · rw [weightedPair_mul Q R hQ hR hQR hRQ, mul_inv_cancel₀ ha, mul_inv_cancel₀ hb, + mul_inv_cancel₀ hc, weightedPair_one] + · rw [weightedPair_mul Q R hQ hR hQR hRQ, inv_mul_cancel₀ ha, inv_mul_cancel₀ hb, + inv_mul_cancel₀ hc, weightedPair_one] +lemma weightedPair_inverse (Q R : A) (hQ : Q * Q = Q) (hR : R * R = R) + (hQR : Q * R = 0) (hRQ : R * Q = 0) (a b c : ℝ) + (ha : a ≠ 0) (hb : b ≠ 0) (hc : c ≠ 0) : + Ring.inverse (weightedPair Q R a b c) = weightedPair Q R a⁻¹ b⁻¹ c⁻¹ := by + have hu := weightedPair_unit Q R hQ hR hQR hRQ a b c ha hb hc + apply_fun (weightedPair Q R a b c * ·) using IsUnit.mul_right_injective hu + dsimp only + rw [Ring.mul_inverse_cancel _ hu, weightedPair_mul Q R hQ hR hQR hRQ, + mul_inv_cancel₀ ha, mul_inv_cancel₀ hb, mul_inv_cancel₀ hc, weightedPair_one] +end WeightedPair + +section PairTrace +variable {A : Type uA} [CStarAlgebra A] [Nontrivial A] + +lemma trace_log_weightedPair (τ : A →L[ℝ] ℂ) + (hτ : ∀ a b, τ (a * b) = τ (b * a)) (hstar : ∀ a, τ (star a) = star (τ a)) + (Q R : A) (hQ : Q * Q = Q) (hR : R * R = R) + (hQR : Q * R = 0) (hRQ : R * Q = 0) (hQs : IsSelfAdjoint Q) (x : ℝ) : + τ (CFC.log (star (weightedPair Q R (Real.exp x) (-Real.exp (-x)) (-1)) * + weightedPair Q R (Real.exp x) (-Real.exp (-x)) (-1))) = + (x * (2 * (τ (Q - R)).re) : ℝ) := by + let M := fun y : ℝ => weightedPair Q R (Real.exp y) (-Real.exp (-y)) (-1) + let M' := fun y : ℝ => weightedPair Q R (Real.exp y) (Real.exp (-y)) 0 + have hd (y : ℝ) : HasDerivAt M (M' y) y := by + have h1 := (Real.hasDerivAt_exp y).smul_const Q + have h2 := ((Real.hasDerivAt_exp (-y)).comp y ((hasDerivAt_id y).neg)).neg.smul_const R + simpa [M, M', weightedPair] using (h1.add h2).add_const ((-1 : ℝ) • (1 - Q - R)) + have hdc : Continuous M' := by dsimp [M', weightedPair]; fun_prop + have hu (y : ℝ) : IsUnit (M y) := + weightedPair_unit Q R hQ hR hQR hRQ _ _ _ (Real.exp_ne_zero y) + (neg_ne_zero.mpr (Real.exp_ne_zero (-y))) (by norm_num) + have hi (y : ℝ) : M' y * Ring.inverse (M y) = Q - R := by + dsimp [M, M'] + rw [weightedPair_inverse Q R hQ hR hQR hRQ _ _ _ (Real.exp_ne_zero y) + (neg_ne_zero.mpr (Real.exp_ne_zero (-y))) (by norm_num), + weightedPair_mul Q R hQ hR hQR hRQ] + simp [weightedPair, Real.exp_ne_zero, sub_eq_add_neg] + have hdlog (y : ℝ) : HasDerivAt (fun y => τ (CFC.log (star (M y) * M y))) + (2 * (τ (Q - R)).re : ℝ) y := by + simpa only [hi y] using + hasDerivAt_trace_log_star_mul_self τ hτ hstar hd hdc.continuousAt hu (x := y) + have hdz (y : ℝ) : HasDerivAt (fun y => τ (CFC.log (star (M y) * M y)) - + (y * (2 * (τ (Q - R)).re) : ℝ)) 0 y := by + have hh := (((hasDerivAt_id y).mul_const (2 * (τ (Q - R)).re)).ofReal_comp) + simpa only [Pi.sub_def, id_eq, one_mul, sub_self] using (hdlog y).sub hh + have he := is_const_of_deriv_eq_zero (fun y => (hdz y).differentiableAt) + (fun y => (hdz y).deriv) x 0 + have hz : star (M 0) * M 0 = 1 := by + have he0 : M 0 = (2 : ℝ) • Q - 1 := by simp [M, weightedPair]; module + rw [he0] + simp only [star_sub, star_smul, star_one, hQs.star_eq, star_ofNat] + simp only [sub_mul, mul_sub, smul_mul_assoc, mul_smul_comm, + mul_one, one_mul, hQ] + module + simp only [hz, CFC.log_one, map_zero, zero_mul, Complex.ofReal_zero, sub_zero] at he + exact sub_eq_zero.mp he + +end PairTrace + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/GroupDeterminants/WeightedTrace.lean b/lean/OAI/Analysis/GroupDeterminants/WeightedTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..e132d1fda42757ef52c56e93d453f1de23733d91 --- /dev/null +++ b/lean/OAI/Analysis/GroupDeterminants/WeightedTrace.lean @@ -0,0 +1,102 @@ +import OAI.Analysis.GroupDeterminants.IndexedRepresentation + +namespace OAI + +universe uA + +noncomputable section +open scoped BigOperators Pointwise + +namespace GroupRingDeterminant +section ClosedPair +variable {A : Type uA} [CStarAlgebra A] +variable (D : StarSubalgebra ℂ A) [IsClosed (D : Set A)] + +lemma trace_log_weightedPair_subalgebra (τ : A →L[ℝ] ℂ) + (hτ : ∀ a ∈ D, ∀ b ∈ D, τ (a * b) = τ (b * a)) + (hstar : ∀ a, τ (star a) = star (τ a)) + (Q R : D) (hQ : Q * Q = Q) (hR : R * R = R) + (hQR : Q * R = 0) (hRQ : R * Q = 0) (hQs : IsSelfAdjoint Q) (x : ℝ) : + τ (CFC.log (star (weightedPair (Q : A) (R : A) (Real.exp x) (-Real.exp (-x)) (-1)) * + weightedPair (Q : A) (R : A) (Real.exp x) (-Real.exp (-x)) (-1))) = + (x * (2 * (τ ((Q : A) - (R : A))).re) : ℝ) := by + cases subsingleton_or_nontrivial D with + | inl h => + have hz : (0 : A) = 1 := congrArg (fun a : D => (a : A)) (Subsingleton.elim 0 1) + let := subsingleton_of_zero_eq_one hz + simp only [Subsingleton.elim (CFC.log _) (0 : A), + Subsingleton.elim ((Q : A) - (R : A)) (0 : A), map_zero, Complex.zero_re, + mul_zero, Complex.ofReal_zero] + | inr h => + have H := trace_log_weightedPair (subTrace D τ) (subTrace_mul_comm D τ hτ) + (subTrace_star D τ hstar) Q R hQ hR hQR hRQ hQs x + let M := weightedPair Q R (Real.exp x) (-Real.exp (-x)) (-1) + have hu : IsUnit M := weightedPair_unit Q R hQ hR hQR hRQ _ _ _ + (Real.exp_ne_zero x) (neg_ne_zero.mpr (Real.exp_ne_zero (-x))) (by norm_num) + change τ ((CFC.log (star M * M) : D) : A) = _ at H + rw [subalgebra_log_coe _ _ (IsSelfAdjoint.star_mul_self _) (hu.star.mul hu)] at H + exact H + +end ClosedPair + +section IndexedTraceCalculus +variable {G I : Type} [Group G] [Fintype I] [DecidableEq I] + +def indexedClosedRepresentation : Matrix I I (MonoidAlgebra ℂ G) →ₐ[ℂ] + closedGroupAlgebra (G := G) (n := Fintype.card I) := + indexedComplexRepresentation.codRestrict closedGroupAlgebra.toSubalgebra indexedComplexRepresentation_mem + +@[simp] lemma indexedClosedRepresentation_coe (A : Matrix I I (MonoidAlgebra ℂ G)) : + (indexedClosedRepresentation A : Hilbert G (Fintype.card I) →L[ℂ] Hilbert G (Fintype.card I)) = + indexedComplexRepresentation A := rfl + +lemma indexedClosedRepresentation_star (A : Matrix I I (MonoidAlgebra ℂ G)) : + indexedClosedRepresentation (star A) = star (indexedClosedRepresentation A) := + Subtype.ext (indexedComplexRepresentation_star A) + +lemma indexed_trace_log_weightedPair (Q R : Matrix I I (MonoidAlgebra ℂ G)) + (hQ : Q * Q = Q) (hR : R * R = R) (hQR : Q * R = 0) (hRQ : R * Q = 0) + (hQs : IsSelfAdjoint Q) (x : ℝ) : + let M := indexedComplexRepresentation (weightedPair Q R (Real.exp x) (-Real.exp (-x)) (-1)) + groupTrace (CFC.log (star M * M)) = + (x * (2 * (∑ i, ((Q - R) i i).coeff 1).re) : ℝ) := by + let φ := indexedClosedRepresentation (G := G) (I := I) + have hQ' : φ Q * φ Q = φ Q := by rw [← map_mul, hQ] + have hR' : φ R * φ R = φ R := by rw [← map_mul, hR] + have hQR' : φ Q * φ R = 0 := by rw [← map_mul, hQR, map_zero] + have hRQ' : φ R * φ Q = 0 := by rw [← map_mul, hRQ, map_zero] + have hQs' : IsSelfAdjoint (φ Q) := by + change star (φ Q) = φ Q + rw [← indexedClosedRepresentation_star, hQs.star_eq] + have hcyc : ∀ a ∈ closedGroupAlgebra (G := G) (n := Fintype.card I), + ∀ b ∈ closedGroupAlgebra, groupTraceCLM (a * b) = groupTraceCLM (b * a) := by + intro a ha b hb + simp only [groupTraceCLM_apply] + exact groupTrace_closed_mul_comm ha hb + have hstar : ∀ a : Hilbert G (Fintype.card I) →L[ℂ] Hilbert G (Fintype.card I), + groupTraceCLM (star a) = star (groupTraceCLM a) := by + simp only [groupTraceCLM_apply] + exact groupTrace_star + have H := trace_log_weightedPair_subalgebra closedGroupAlgebra + (groupTraceCLM.restrictScalars ℝ) hcyc hstar (φ Q) (φ R) hQ' hR' hQR' hRQ' hQs' x + change groupTraceCLM (G := G) (n := Fintype.card I) _ = + ((x * (2 * (groupTraceCLM (G := G) (n := Fintype.card I) _).re) : ℝ) : ℂ) at H + simp only [groupTraceCLM_apply, φ, indexedClosedRepresentation_coe] at H + have hmap (a b c : ℝ) : indexedComplexRepresentation (weightedPair Q R a b c) = + weightedPair (indexedComplexRepresentation Q) (indexedComplexRepresentation R) a b c := by + simp only [weightedPair, map_add, map_sub, map_one, AlgHom.map_smul_of_tower] + have ht : groupTrace (indexedComplexRepresentation Q - indexedComplexRepresentation R) = + ∑ i, ((Q - R) i i).coeff 1 := by + rw [← map_sub, indexedComplexRepresentation_trace] + dsimp only + rw [hmap] + rw [ht] at H + convert H using 1 + rfl + +end IndexedTraceCalculus +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/AllocatedLinearity.lean b/lean/OAI/Analysis/HardSphere/Allocation/AllocatedLinearity.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c5b6890bddc856f85115f99d108d122ce9bdbf7 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/AllocatedLinearity.lean @@ -0,0 +1,178 @@ +import Mathlib +import OAI.Analysis.HardSphere.Allocation.PhysicalCellUniform +import OAI.Analysis.HardSphere.Allocation.PhysicalReferenceRaw + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Comparison +variable {Ω A G Y J : Type*} [MeasurableSpace Ω] [MeasurableSpace Y] + [Fintype A] [DecidableEq A] [Fintype G] [DecidableEq G] [Fintype J] +omit [DecidableEq A] [Fintype G] [DecidableEq G] in +lemma allocatedTagLaw_sum (μ : J→Measure Ω) (I : G→Ω→Finset A) + (hI : ∀g i,MeasurableSet {ω | i∈I g ω}) (κ : A→Kernel Ω Y) (g : G) : + allocatedTagLaw (∑j,μ j) I κ g=∑j,allocatedTagLaw (μ j) I κ g := by + classical + apply Measure.ext + intro s hs + simp only [allocatedTagLaw,Measure.finsetSum_apply] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + simp only [Measure.bind_apply hs (κ i).aemeasurable,←lintegral_indicator (hI g i)] + exact lintegral_finsetSum_measure _ _ _ +end HardSphere.Comparison +end +end + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital +attribute [local instance] Classical.propDecidable +attribute [local instance] Comparison.permBathSpace Comparison.permBathSingleton + +def physicalRead {N K M G : ℕ} (L : Length) (extra tag : Fin 3→Fin K) (b : Bool) + (i : Fin (N+1)) : Kernel (ConfigurationPath (N+1) L×GridAllocation (N+1) K (G*M)) + (Torus L×Torus L×Configuration N L) := + ((physicalCellPost L extra tag b) ∘ₖ orderedKernel (uniformBathOrder N) i).comap + (fun p ↦ p.1 midpointTime) ((continuous_eval_const midpointTime).measurable.comp measurable_fst) + +lemma physical_branch_allocated_reference {N K M G : ℕ} [NeZero K] {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50.trans_lt g.isLt) + simpa using Nat.mul_le_mul_right (2*m) hg).trans hE + apply (measure_mono hsub).trans + rw [←Measure.map_apply hf (by exact MeasurableSet.of_discrete),hmap] + exact allocation_half_bad E B m hm hB + +lemma grid_group_joint_weak {N K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (p : BridgeEndpoints N L×(Fin N→Bool)) (m G : ℕ) (g : Fin G) + (B : (Fin 3→Fin K)→Finset (Fin N)) (A : Finset (Fin 3→Fin K)) + (hE : ∀v∈A,G*(2*m)≤(recordedList hL v p).card) + (hB : ∀v∈A,10*((recordedList hL v p)∩B v).card≤(recordedList hL v p).card) : + gridAllocationKernel hL (G*(2*m)) p {a | ∀v∈A,GroupWeak m G g (B v) (a v)}≤ + (ENNReal.ofReal ((2/5:ℝ)^m))^A.card := by + rw [gridAllocationKernel_apply] + rw [show (Measure.pi (fun v ↦ (allocationPMF (recordedList hL v p) (G*(2*m))).toMeasure)) + {a | ∀v∈A,GroupWeak m G g (B v) (a v)} = + ∏v∈A,(allocationPMF (recordedList hL v p) (G*(2*m))).toMeasure {a | GroupWeak m G g (B v) a} from + pi_failure_sets _ (fun v ↦ {a | GroupWeak m G g (B v) a}) A] + calc + _ ≤ ∏v∈A,ENNReal.ofReal ((2/5:ℝ)^m) := Finset.prod_le_prod (fun v hv ↦ + allocation_group_weak _ _ m G g (hE v hv) (hB v hv)) + _ = _ := by simp + +end HardSphere.Groups + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Groups +open Wiener Bridge GaussianPacking PathCutoff Comparison CellOrbital + +lemma endpointEligible_unique {N K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (hK : 1≤K) + {v w : Fin 3→Fin K} {s₀ : ℝ} {Y Z : Configuration N L} {i : Fin N} + (hv : EndpointEligible v s₀ Y Z i) (hw : EndpointEligible w s₀ Y Z i) : v=w := by + by_contra h + exact Set.disjoint_left.mp (centeredCell_disjoint hL hK h) hv.1 hw.1 + +lemma ownEligible_at {N K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (hK : 1≤K) + (m : ℕ) (r R C S s₀ t : ℝ) (u : Time) + (i : Fin N) (e : BridgeEndpoints N L) (β : Bridge.Noise) (v : Fin 3→Fin K) + (he : EndpointEligible v s₀ e.2 (bridgeEnd N L t e) i) : + ownEligible (K:=K) m r R C S s₀ t u i (e,β) ↔ + Regular m r R C u S (projectCurve L (leg t (labelStartLift e i) (labelEndLift t e i) β)) ∧ + Confined (gridCenter L v) (projectCurve L (leg t (labelStartLift e i) (labelEndLift t e i) β)) := by + have hp : ownPath i t (e,β)=projectCurve L (leg t (labelStartLift e i) (labelEndLift t e i) β) := by + exact labelBridgePath_lift t e (fun _ ↦ β) i + unfold ownEligible + rw [hp] + constructor + · rintro ⟨w,hw,hreg,hconf⟩ + have hh := endpointEligible_unique hL hK he hw + subst w + exact ⟨hreg,hconf⟩ + · rintro ⟨hreg,hconf⟩ + exact ⟨v,he,hreg,hconf⟩ + +lemma near_anchor_lift {L : Length} (hL : 1≤L.val) (y : Point) (v : Torus L) + (hy : projectPoint L y∈centeredCell L v) : + ∃c : Point,projectPoint L c=v ∧ ‖y-c‖≤1/2 := by + have hm := (centeredCell_image hL v (projectPoint L y)).mp hy + choose s hs he using hm + refine ⟨fun j ↦ y j-s j,?_,?_⟩ + · funext j + change ((y j-s j:ℝ):AddCircle L.val)=v j + rw [AddCircle.coe_sub,he j] + change ((y j:ℝ):AddCircle L.val)-(((y j:ℝ):AddCircle L.val)-v j)=v j + abel + · apply (pi_norm_le_iff_of_nonneg (by norm_num : (0:ℝ)≤1/2)).mpr + intro j + change |y j-(y j-s j)|≤1/2 + rw [sub_sub_cancel] + exact abs_le.mpr ⟨by linarith [(hs j).1],(hs j).2.le⟩ + +end HardSphere.Groups + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/CertificateMeasurable.lean b/lean/OAI/Analysis/HardSphere/Allocation/CertificateMeasurable.lean new file mode 100644 index 0000000000000000000000000000000000000000..38efa034c46acba4c92a545c0306fe8c0116af13 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/CertificateMeasurable.lean @@ -0,0 +1,137 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.ConfinedLift +import OAI.Analysis.HardSphere.PathBounds.GridTailTransfer + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Groups +open Wiener PathCutoff CellOrbital BathSlice + +lemma regular_mono_constants {L : Length} {m : ℕ} {r R C R' C' S : ℝ} {u : Time} + {ω : ConfigurationPath 1 L} (hR : R≤R') (hC : C≤C') + (h : Regular m r R C u S ω) : Regular m r R' C' u S ω := by + refine ⟨⟨fun j ↦ (h.1.1 j).trans hR,?_⟩,h.2⟩ + exact h.1.2.trans (mul_le_mul_of_nonneg_right hC (Nat.cast_nonneg _)) + +lemma certificate_mono_constants {N K : ℕ} [Nontrivial (Fin N)] {L : Length} + {m : ℕ} {r R C R' C' S s₀ ell θ H D : ℝ} {u : Time} {v : Fin 3→Fin K} + {ω : ConfigurationPath N L} (hR : R≤R') (hC : C≤C') + (h : Certificate m r R C S s₀ ell θ H D u v ω) : + Certificate m r R' C' S s₀ ell θ H D u v ω := + ⟨h.low,h.closeY,h.closeZ,h.visit,fun i hi ↦ regular_mono_constants hR hC (h.regular i hi),h.long⟩ + +lemma certificate_measurable {N K : ℕ} [Nontrivial (Fin N)] [NeZero K] {L : Length} + (m : ℕ) (r R C S s₀ ell θ H D : ℝ) (u : Time) (v : Fin 3→Fin K) : + MeasurableSet {ω : ConfigurationPath N L | Certificate m r R C S s₀ ell θ H D u v ω} := by + classical + have hc : Measurable (fun n : ℕ ↦ (n:ℝ)) := measurable_of_countable _ + have hlo : MeasurableSet {ω : ConfigurationPath N L | ell*D≤(centeredCount L (gridCenter L v) (ω 0):ℝ)} := + measurableSet_le measurable_const (hc.comp + ((centeredCount_measurable L (gridCenter L v)).comp (continuous_eval_const 0).measurable)) + have hY : MeasurableSet {ω : ConfigurationPath N L | ((localCloseLabels L s₀ (gridCenter L v) (ω 0)).card:ℝ)<θ*D} := + measurableSet_lt ((localCloseLabels_measurable L s₀ (gridCenter L v)).comp (continuous_eval_const 0).measurable) measurable_const + have hZ : MeasurableSet {ω : ConfigurationPath N L | ((localCloseLabels L s₀ (gridCenter L v) (ω 1)).card:ℝ)<θ*D} := + measurableSet_lt ((localCloseLabels_measurable L s₀ (gridCenter L v)).comp (continuous_eval_const 1).measurable) measurable_const + have hv : Measurable (fun ω : ConfigurationPath N L ↦ (visitors (gridCenter L v) ω).card) := by + have he : (fun ω : ConfigurationPath N L ↦ (visitors (gridCenter L v) ω).card) = + ShiftVisits.visitorCount L (gridShift L) Set.univ (gridSite v) := + funext fun ω ↦ (grid_visitors_eq L v ω).symm + rw [he] + exact ShiftVisits.visitorCount_measurable (n:=N) L (gridShift L) MeasurableSet.univ (gridSite v) + have ht : Measurable (fun ω : ConfigurationPath N L ↦ (longVisitors (gridCenter L v) ω).card) := by + have he : (fun ω : ConfigurationPath N L ↦ (longVisitors (gridCenter L v) ω).card) = + ShiftVisits.visitorCount L (gridShift L) {p | 1 < intervalDiameter 0 1 p} (gridSite v) := + funext fun ω ↦ (grid_longVisitors_eq L v ω).symm + rw [he] + exact ShiftVisits.visitorCount_measurable (n:=N) L (gridShift L) + (measurableSet_lt measurable_const (intervalDiameter_continuous L 0 1).measurable) (gridSite v) + have hreg : MeasurableSet {ω : ConfigurationPath N L | ∀i,pathVisitsBall L 12 (gridCenter L v) i ω→Regular m r R C u S (onePathAt i ω)} := by + simp only [Set.ofPred_forall] + apply MeasurableSet.iInter + intro i + have he : {ω : ConfigurationPath N L | pathVisitsBall L 12 (gridCenter L v) i ω→Regular m r R C u S (onePathAt i ω)}= + {ω | pathVisitsBall L 12 (gridCenter L v) i ω}ᶜ∪{ω | Regular m r R C u S (onePathAt i ω)} := by ext ω; simp [imp_iff_not_or] + rw [he] + exact (pathVisitsBall_isClosed L 12 (gridCenter L v) i).measurableSet.compl.union + ((regular_measurable m r R C u S).preimage (onePathAt_continuous i).measurable) + have he : {ω : ConfigurationPath N L | Certificate m r R C S s₀ ell θ H D u v ω}= + {ω | ell*D≤(centeredCount L (gridCenter L v) (ω 0):ℝ)} ∩ + ({ω | ((localCloseLabels L s₀ (gridCenter L v) (ω 0)).card:ℝ)<θ*D} ∩ + ({ω | ((localCloseLabels L s₀ (gridCenter L v) (ω 1)).card:ℝ)<θ*D} ∩ + ({ω | ((visitors (gridCenter L v) ω).card:ℝ)≤H*D} ∩ + ({ω | ∀i,pathVisitsBall L 12 (gridCenter L v) i ω→Regular m r R C u S (onePathAt i ω)} ∩ + {ω | ((longVisitors (gridCenter L v) ω).card:ℝ)<θ*D})))) := by + ext ω + constructor + · exact fun h ↦ ⟨h.low,h.closeY,h.closeZ,h.visit,h.regular,h.long⟩ + · exact fun h ↦ ⟨h.1,h.2.1,h.2.2.1,h.2.2.2.1,h.2.2.2.2.1,h.2.2.2.2.2⟩ + rw [he] + exact hlo.inter (hY.inter (hZ.inter ((measurableSet_le (hc.comp hv) measurable_const).inter + (hreg.inter (measurableSet_lt (hc.comp ht) measurable_const))))) + +end HardSphere.Groups + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology +namespace HardSphere.Groups +open Wiener Bridge GaussianPacking PathCutoff CellOrbital + +lemma projection_square_distance (L : Length) (x y : Point) : + (torusDistance L (projectPoint L x) (projectPoint L y))^2 ≤ square (x-y) := by + rw [torusDistance,Real.sq_sqrt (Finset.sum_nonneg (fun _ _ ↦ sq_nonneg _))] + unfold square + apply Finset.sum_le_sum + intro j _ + have h : dist (projectPoint L x j) (projectPoint L y j) ≤ |x j-y j| := by + rw [dist_eq_norm] + change ‖(x j:AddCircle L.val)-(y j:AddCircle L.val)‖ ≤ _ + rw [←AddCircle.coe_sub] + exact QuotientAddGroup.norm_mk_le_norm + simpa only [Pi.sub_apply,sq_abs] using pow_le_pow_left₀ dist_nonneg h 2 + +lemma eligible_near_lift {N K : ℕ} {L : Length} (hL : 50 simp + | some f => simp + +omit [Fintype I] in +lemma enumerated_bad_card {m : ℕ} (label : Fin m→I) (hinj : Function.Injective label) + (P : Fin m→Prop) : + ((Finset.univ.image label)∩((Finset.univ.filter (fun i ↦ ¬P i)).image label)).card= + (Finset.univ.filter (fun i ↦ ¬P i)).card := by + rw [Finset.inter_eq_right.mpr (Finset.image_subset_image (Finset.filter_subset _ _)), + Finset.card_image_of_injective _ hinj] + +lemma enumerated_failure_probability {m : ℕ} (label : Fin m→I) (hinj : Function.Injective label) + (P : Fin m→Prop) (hP : ((Finset.univ.filter (fun i ↦ ¬P i)).card:ℝ)≤(m:ℝ)/10) + (total q : ℕ) (htotal : total ≤ m) (group : Fin (2*q)↪Fin total) : + (allocationPMF (Finset.univ.image label) total).toMeasure + {a | ∃f,a=some f ∧ q ≤ (Finset.univ.filter + (fun k ↦ f (group k)∈(Finset.univ.filter (fun i ↦ ¬P i)).image label)).card}≤ + ENNReal.ofReal ((2/5:ℝ)^q) := by + have hcard : (Finset.univ.image label).card=m := by + rw [Finset.card_image_of_injective _ hinj] + simp + apply allocated_restriction_half_bad _ _ total q (by simpa [hcard] using htotal) group + rw [enumerated_bad_card label hinj P,hcard] + have h : (10:ℝ)*((Finset.univ.filter (fun i ↦ ¬P i)).card:ℝ)≤(m:ℝ) := by linarith + exact_mod_cast h + +end HardSphere.Sampling + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set Filter +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Groups +open Wiener Bridge GaussianPacking PathCutoff CellOrbital +attribute [local instance] Classical.propDecidable + +theorem certificate_useful_groups {ell b Alo A H : ℝ} + (hell : 0 < ell) (hb : 0 < b) (hAlo : 0 < Alo) (hA : 0 < A) (hH : 0 < H) : + ∃t₀ : ℝ,0 < t₀ ∧ ∀t : ℝ,0 < t → t ≤ t₀ → + ∃D₀ : ℝ,1 ≤ D₀ ∧ ∀D α : ℝ,D₀ ≤ D → Alo ≤ α → α ≤ A → + ∀(N K m n : ℕ) [Nontrivial (Fin N)] (L : Length),50 < L.val → + n=⌈t/(α/D)^2⌉₊ → ∀(w : Time),t*(w:ℝ)=D⁻¹ → + ∀(θ : ℝ),θ ≤ ell/6 → + ∀(v : Fin 3→Fin K) (c : Point),projectPoint L c=gridCenter L v → + ∀(ω : ConfigurationPath N L), + Certificate (n+n) (α/D) (D^(1/12:ℝ)) (64*(meanCost+1)) + (b*D^(-(1/3):ℝ)/8) (b*D^(-(1/3):ℝ)) ell θ H D (prefixTime midpointTime w) v ω → + ∀(label : Fin m→Fin N),Function.Injective label → + Finset.univ.image label=eligibleList (n+n) (α/D) (D^(1/12:ℝ)) (64*(meanCost+1)) + (b*D^(-(1/3):ℝ)/8) (b*D^(-(1/3):ℝ)) (prefixTime midpointTime w) v ω → + ∀(B : Fin 7→Set Point),(∀j,MeasurableSet (B j)) → (∀j,volume (B j)=1) → + (∀j u,u∈B j → ‖u-c‖ ≤ 3) → + ∃y z : Fin m→Point, + (∀i,projectPoint L (y i)=ω 0 (label i)) ∧ + (∀i,projectPoint L (z i)=ω 1 (label i)) ∧ + ((Finset.univ.filter (fun i ↦ ¬StrongExcept n t (α/D) (D^(1/12:ℝ)) (64*(meanCost+1)) + (b*D^(-(1/3):ℝ)/8) w (y i) (z i) c (fun j ↦ onePathAt j ω) (label i) B)).card:ℝ) ≤ (m:ℝ)/10 ∧ + ∀total q : ℕ,total ≤ m → ∀group : Fin (2*q)↪Fin total, + (Sampling.allocationPMF + (eligibleList (n+n) (α/D) (D^(1/12:ℝ)) (64*(meanCost+1)) + (b*D^(-(1/3):ℝ)/8) (b*D^(-(1/3):ℝ)) (prefixTime midpointTime w) v ω) total).toMeasure + {a | ∃f,a=some f ∧ q ≤ (Finset.univ.filter (fun k ↦ f (group k)∈ + (Finset.univ.filter (fun i ↦ ¬StrongExcept n t (α/D) (D^(1/12:ℝ)) (64*(meanCost+1)) + (b*D^(-(1/3):ℝ)/8) w (y i) (z i) c (fun j ↦ onePathAt j ω) (label i) B)).image label)).card}≤ + ENNReal.ofReal ((2/5:ℝ)^q) := by + obtain ⟨t₀,ht₀,hs⟩ := certificate_useful_list hell hb hAlo hA hH + refine ⟨t₀,ht₀,?_⟩ + intro t ht htt + obtain ⟨D₀,hD₀,hs⟩ := hs t ht htt + refine ⟨D₀,hD₀,?_⟩ + intro D α hDD hαlo hαA N K m n _ L hL hn w hw θ hθ v c hc ω cert label hinj himage B hB hBvol hBc + obtain ⟨y,z,hyp,hzp,huse⟩ := hs D α hDD hαlo hαA N K m n L hL hn w hw θ hθ v c hc ω cert label hinj himage B hB hBvol hBc + refine ⟨y,z,hyp,hzp,huse,?_⟩ + intro total q htotal group + have h := Sampling.enumerated_failure_probability label hinj + (fun i ↦ StrongExcept n t (α/D) (D^(1/12:ℝ)) (64*(meanCost+1)) + (b*D^(-(1/3):ℝ)/8) w (y i) (z i) c (fun j ↦ onePathAt j ω) (label i) B) huse total q htotal group + simpa only [himage] using h + +end HardSphere.Groups + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/CertificateWindow.lean b/lean/OAI/Analysis/HardSphere/Allocation/CertificateWindow.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b807c0b6172b4b3bdd673057d5f622f28b5e268 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/CertificateWindow.lean @@ -0,0 +1,148 @@ +import Mathlib +import OAI.Analysis.HardSphere.Allocation.CertificateSupply + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set Filter +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Groups +open Wiener PathCutoff CellOrbital BathSlice HardSphere.Lattice + +theorem ground_certificate_supply_ge_two : + ∃ α₀ ell : ℝ, 2≤α₀ ∧ 0 linarith + change ((AddCircle.equivIco L.val (-L.val/2)) ((y j:AddCircle L.val)-(c j:AddCircle L.val))).val+c j=y j + rw [←AddCircle.coe_sub,AddCircle.equivIco_coe_eq hmem] + simp + +lemma near_lift_unique {L : Length} (hL : 50 congr 10 + all_goals try exact Subsingleton.elim _ _ + all_goals rw [hd] + · filter_upwards [allocated_selected_flags hL μ g b a + (labelInteraction N L r (2*t)∩flagEvent (eligibilityFlag (K:=K) m r R C S s₀ (2*t) u) b)] with w hw + exact (hb (fun i ↦ hw i i.property)).elim + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/NormalizedNearestSeparated.lean b/lean/OAI/Analysis/HardSphere/Allocation/NormalizedNearestSeparated.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9c8ceafe9a80a47f7e9741a7795167e30c1ff90 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/NormalizedNearestSeparated.lean @@ -0,0 +1,77 @@ +import Mathlib + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter + +lemma normalized_nearest_separated {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {x y : E} (hx : x≠0) (hy : y≠0) (hxy : ‖x‖≤‖x-y‖) (hyx : ‖y‖≤‖x-y‖) : + 1≤‖‖x‖⁻¹ • x-‖y‖⁻¹ • y‖ := by + have aux {x y : E} (hx : x≠0) (hy : y≠0) (h : ‖y‖≤‖x‖) (hd : ‖x‖≤‖x-y‖) : + 1≤‖‖x‖⁻¹ • x-‖y‖⁻¹ • y‖ := by + have hx0 : 0<‖x‖ := norm_pos_iff.mpr hx + have hy0 : 0<‖y‖ := norm_pos_iff.mpr hy + have he : x-y=‖y‖ • (‖x‖⁻¹ • x-‖y‖⁻¹ • y)+(‖x‖-‖y‖) • (‖x‖⁻¹ • x) := by + rw [smul_sub,sub_smul,smul_smul,smul_smul,smul_smul, + mul_inv_cancel₀ hy0.ne',mul_inv_cancel₀ hx0.ne',one_smul,one_smul] + abel + have ht := norm_add_le (‖y‖ • (‖x‖⁻¹ • x-‖y‖⁻¹ • y)) ((‖x‖-‖y‖) • (‖x‖⁻¹ • x)) + rw [←he,norm_smul,norm_smul,Real.norm_of_nonneg hy0.le, + Real.norm_of_nonneg (sub_nonneg.mpr h)] at ht + have hn : ‖‖x‖⁻¹ • x‖=1 := by + rw [norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr hx0.le),inv_mul_cancel₀ hx0.ne'] + rw [hn,mul_one] at ht + nlinarith only [ht,hd,hy0] + rcases le_total ‖y‖ ‖x‖ with h | h + · exact aux hx hy h hxy + · have hd : ‖y‖≤‖y-x‖ := by simpa only [norm_sub_rev] using hyx + simpa only [norm_sub_rev] using aux hy hx h hd + +lemma nearest_incoming_card {ι E : Type*} [DecidableEq ι] [NormedAddCommGroup E] + [NormedSpace ℝ E] [FiniteDimensional ℝ E] (I : Finset ι) (v : ι→E) + (h0 : ∀ i∈I, v i≠0) + (hne : ∀ i∈I, ∀ j∈I, i≠j → ‖v i‖≤‖v i-v j‖) : + I.card≤5^Module.finrank ℝ E := by + classical + let d : ι→E := fun i ↦ ‖v i‖⁻¹ • v i + have hsep : ∀ i∈I, ∀ j∈I, i≠j → 1≤‖d i-d j‖ := by + intro i hi j hj hij + exact normalized_nearest_separated (h0 i hi) (h0 j hj) (hne i hi j hj hij) + (by simpa only [norm_sub_rev] using hne j hj i hi hij.symm) + have hinj : Set.InjOn d I := by + intro i hi j hj hd + by_contra hn + have hh := hsep i hi j hj hn + rw [hd,sub_self,norm_zero] at hh + norm_num at hh + rw [←Finset.card_image_of_injOn hinj] + apply Besicovitch.card_le_of_separated + · intro x hx + obtain ⟨i,hi,rfl⟩ := Finset.mem_image.mp hx + dsimp [d] + rw [norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr (norm_nonneg _)),inv_mul_cancel₀ (norm_ne_zero_iff.mpr (h0 i hi))] + norm_num + · intro x hx y hy hxy + obtain ⟨i,hi,rfl⟩ := Finset.mem_image.mp hx + obtain ⟨j,hj,rfl⟩ := Finset.mem_image.mp hy + exact hsep i hi j hj (fun hij ↦ hxy (congrArg d hij)) + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalAffinitySum.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalAffinitySum.lean new file mode 100644 index 0000000000000000000000000000000000000000..84016910047a95fbe951f761b93dea4e60c4eb32 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalAffinitySum.lean @@ -0,0 +1,215 @@ +import Mathlib +import OAI.Analysis.HardSphere.Paths.Admissible +import OAI.Analysis.HardSphere.Allocation.PhysicalGroupComparison +import OAI.Analysis.HardSphere.Orbitals.PhysicalOrbitalReference + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital _root_.OAI.HardSphere.Lattice HardSphere.DyadicSkeleton +attribute [local instance] Classical.propDecidable + +lemma measureAffinity_nsmul {X : Type*} [MeasurableSpace X] + (P Q : Measure X) [IsFiniteMeasure P] [IsFiniteMeasure Q] (n : ℕ) : + measureAffinity (n • P) (n • Q)=(n:ℝ)*measureAffinity P Q := by + have h := measureAffinity_smul P Q (n:ℝ) (Nat.cast_nonneg n) + rw [ENNReal.ofReal_natCast] at h + simpa only [Nat.cast_smul_eq_nsmul] using h + +lemma affinity_double_sum_bound {X I J : Type*} [MeasurableSpace X] [Fintype I] [Fintype J] + (A : I→J→Bool→Measure X) (Q : Bool→Measure X) (n : ℕ) + [∀i j b,IsFiniteMeasure (A i j b)] [∀b,IsFiniteMeasure (Q b)] + (h : ∀b,(∑i,∑j,A i j b)≤n • Q b) : + (∑i,∑j,measureAffinity (A i j true) (A i j false))≤(n:ℝ)*measureAffinity (Q true) (Q false) := by + have hb : (∑i,∑j,measureAffinity (A i j true) (A i j false))≤ + measureAffinity (∑i,∑j,A i j true) (∑i,∑j,A i j false) := by + refine (Finset.sum_le_sum (fun i _ ↦ measureAffinity_finset_sum Finset.univ (fun j ↦ A i j true) (fun j ↦ A i j false))).trans ?_ + exact measureAffinity_finset_sum Finset.univ (fun i ↦ ∑j,A i j true) (fun i ↦ ∑j,A i j false) + exact hb.trans ((measureAffinity_mono _ _ _ _ (h true) (h false)).trans_eq (measureAffinity_nsmul _ _ n)) + +lemma physical_total_posts {N K : ℕ} [NeZero K] {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (b : Bool) + (P : Measure (Torus L×Configuration N L)) [SFinite P] : + (∑ij : DiscreteTorus K×DiscreteTorus K, + physicalCellVolumePost L (siteIndex (if b then ij.2 else ij.1)) + (siteIndex (if b then ij.1 else ij.2)) b ∘ₘ P)= + (P.prod volume).map (cellObservation b) := by + rw [Fintype.sum_prod_type] + cases b <;> simp only [Bool.false_eq_true,ite_false,ite_true] + · rw [Finset.sum_comm] + have he := physical_cell_posts_sum hL hK false P + rw [←he] + exact (siteIndexEquiv.sum_comp (fun tag : Fin 3→Fin K ↦ + ∑extra : DiscreteTorus K,physicalCellVolumePost L (siteIndex extra) tag false ∘ₘ P)).trans + (Finset.sum_congr rfl (fun tag _ ↦ siteIndexEquiv.sum_comp + (fun extra : Fin 3→Fin K ↦ physicalCellVolumePost L extra tag false ∘ₘ P))) + · rw [←physical_cell_posts_sum hL hK true P] + exact (siteIndexEquiv.sum_comp (fun tag : Fin 3→Fin K ↦ + ∑extra : DiscreteTorus K,physicalCellVolumePost L (siteIndex extra) tag true ∘ₘ P)).trans + (Finset.sum_congr rfl (fun tag _ ↦ siteIndexEquiv.sum_comp + (fun extra : Fin 3→Fin K ↦ physicalCellVolumePost L extra tag true ∘ₘ P))) + +lemma physicalGroupReference_finite {N K M G : ℕ} [NeZero K] {L : Length} {r : ℝ} + (hL : L.val=(K:ℝ)) (hK : 1≤K) {ψ : Jet (N+1) L} (hψ : IsGroundVector (N+1) L r ψ) + (m : ℕ) (t R C S s₀ : ℝ) (ht : 0≤t) (u : Time) + (x y : DiscreteTorus K) (g : Fin G) (b : Bool) : + IsFiniteMeasure (physicalGroupReference (M:=M) (x:=x) (y:=y) hL ψ g m t r R C S s₀ u b) := by + let (flags : Fin (N+1)→Bool) (a : GridAllocation (N+1) K (G*M)) := + physicalBranchLaw_finite hL hK hψ g flags a m R C S s₀ (2*t) (by linarith) u + unfold physicalGroupReference + infer_instance + +lemma physical_group_references_le {N K M G : ℕ} [NeZero K] {L : Length} {r : ℝ} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50 simp [F, h] + +lemma recorded_density_sum {E J : Type*} [MeasurableSpace E] + [Fintype J] [MeasurableSpace J] [MeasurableSingletonClass J] + (μ : Measure E) (r : E → J) (hr : Measurable r) + (f : J → E → ℝ≥0∞) (hf : ∀ j, Measurable (f j)) : + (∑ j, (μ.withDensity (f j)).restrict {e | r e = j}) = + μ.withDensity (fun e ↦ f (r e) e) := by + classical + have hset (j : J) : MeasurableSet {e | r e = j} := + measurableSet_eq_fun hr measurable_const + have h := withDensity_tsum (μ := μ) + (fun j ↦ (hf j).indicator (hset j)) + rw [Measure.sum_fintype] at h + have heq : (∑' j, {e | r e = j}.indicator (f j)) = (fun e ↦ f (r e) e) := by + funext e + rw [tsum_fintype, Finset.sum_apply] + simp [Set.indicator] + rw [heq] at h + rw [h] + apply Finset.sum_congr rfl + intro j _ + rw [restrict_withDensity (hset j), withDensity_indicator (hset j)] + +lemma allocated_flag_joint {E Y J A : Type*} + [MeasurableSpace E] [MeasurableSpace Y] + [Fintype J] [MeasurableSpace J] [MeasurableSingletonClass J] + [Fintype A] [MeasurableSpace A] [MeasurableSingletonClass A] + (μ : Measure E) [SFinite μ] (ν : Measure Y) [SFinite ν] + (κ : Kernel (E × J) A) [IsSFiniteKernel κ] + (r : E × Y → J) (hr : Measurable r) + {B : Set (E × Y)} (hB : MeasurableSet B) : + (∑ b, ∑ a, (((μ.withDensity (fun e ↦ κ (e,b) {a})).prod ν).restrict + (B ∩ {z | r z = b})).map (fun z ↦ (z,a))) = + ((μ.prod ν).restrict B).compProd + (κ.comap (fun z ↦ (z.1,r z)) (measurable_fst.prodMk hr)) := by + classical + let μB := (μ.prod ν).restrict B + have hm (b : J) (a : A) : Measurable (fun e : E ↦ κ (e,b) {a}) := + (κ.measurable_coe (measurableSet_singleton a)).comp measurable_prodMk_right + have hs (b : J) : MeasurableSet {z : E × Y | r z = b} := + measurableSet_eq_fun hr measurable_const + have hd (a : A) : + (∑ b, ((μ.withDensity fun e ↦ κ (e,b) {a}).prod ν).restrict + (B ∩ {z | r z = b})) = μB.withDensity (fun z ↦ κ (z.1,r z) {a}) := by + trans ∑ b, (μB.withDensity (fun z ↦ κ (z.1,b) {a})).restrict {z | r z = b} + · apply Finset.sum_congr rfl + intro b _ + rw [prod_withDensity_left (hm b a), restrict_withDensity (hB.inter (hs b)), + restrict_withDensity (hs b)] + congr 1 + simp only [μB, Measure.restrict_restrict (hs b), Set.inter_comm] + · exact recorded_density_sum μB r hr _ (fun b ↦ (hm b a).comp measurable_fst) + rw [Finset.sum_comm] + trans ∑ a, (μB.withDensity (fun z ↦ κ (z.1,r z) {a})).map (fun z ↦ (z,a)) + · apply Finset.sum_congr rfl + intro a _ + rw [← Measure.map_finset_sum' measurable_prodMk_right.aemeasurable, hd a] + · exact finite_allocation_joint μB + (κ.comap (fun z ↦ (z.1,r z)) (measurable_fst.prodMk hr)) + +lemma map_retained_compProd {E F A : Type*} [MeasurableSpace E] + [MeasurableSpace F] [MeasurableSpace A] + (μ : Measure E) [SFinite μ] (f : E → F) (hf : Measurable f) + (κ : Kernel F A) [IsSFiniteKernel κ] : + (μ.compProd (κ.comap f hf)).map (fun z ↦ (f z.1,z.2)) = + (μ.map f).compProd κ := by + ext B hB + have hmap : Measurable (fun z : E × A ↦ (f z.1,z.2)) := + (hf.comp measurable_fst).prodMk measurable_snd + rw [Measure.map_apply hmap hB, Measure.compProd_apply (hB.preimage hmap), + Measure.compProd_apply hB, + lintegral_map (κ.measurable_kernel_prodMk_left hB) hf] + rfl + +end HardSphere.Comparison + +namespace HardSphere.Comparison +variable {E I A : Type*} [MeasurableSpace E] [Fintype I] +variable {X : I → Type*} [∀ i, MeasurableSpace (X i)] +attribute [local instance] Classical.propDecidable + +lemma allocated_exposure_joint [Fintype A] [MeasurableSpace A] + [MeasurableSingletonClass A] + (μ : Measure E) [SFinite μ] (ν : ∀ i, Measure (X i)) + [∀ i, IsProbabilityMeasure (ν i)] + (flag : ∀ i, E × X i → Bool) (hflag : ∀ i, Measurable (flag i)) + (κ : Kernel (E × (I → Bool)) A) [IsMarkovKernel κ] (p : A → I → Prop) + {B : Set (E × (∀ i, X i))} (hB : MeasurableSet B) : + (∑ b, ∑ a, ((exposedLaw (allocationBase μ κ b a) ν (p a) + (B ∩ flagEvent flag b)).compProd + (fiberNormalize (Kernel.const _ (Measure.pi fun i : {i // p a i} ↦ ν i)) + (blockEvent (p a) (B ∩ flagEvent flag b)))).map + (fun z ↦ (blockGlue (p a) z, a))) = + ((μ.prod (Measure.pi ν)).restrict B).compProd + (κ.comap (fun z ↦ (z.1, fun i ↦ flag i (z.1,z.2 i))) + (measurable_fst.prodMk (Measurable.of_eval (fun i ↦ + (hflag i).comp (measurable_fst.prodMk + ((measurable_pi_apply i).comp measurable_snd)))))) := by + have (b : I → Bool) (a : A) : + SFinite (exposedLaw (allocationBase μ κ b a) ν (p a) (B ∩ flagEvent flag b)) := by + unfold exposedLaw + infer_instance + trans ∑ b, ∑ a, (((allocationBase μ κ b a).prod (Measure.pi ν)).restrict + (B ∩ flagEvent flag b)).map (fun z ↦ (z,a)) + · apply Finset.sum_congr rfl + intro b _ + apply Finset.sum_congr rfl + intro a _ + have h := congrArg (fun m ↦ m.map (fun z : E × (∀ i, X i) ↦ (z,a))) + (exposed_block_reconstruct (allocationBase μ κ b a) ν (p a) + (hB.inter (flagEvent_measurable flag hflag b))) + simpa only [Measure.map_map measurable_prodMk_right (blockGlue_measurable (p a)), + Function.comp_def] using h + · simpa only [allocationBase, flagEvent, funext_iff] using + allocated_flag_joint μ (Measure.pi ν) κ + (fun z i ↦ flag i (z.1,z.2 i)) + (Measurable.of_eval (fun i ↦ (hflag i).comp + (measurable_fst.prodMk ((measurable_pi_apply i).comp measurable_snd)))) hB + +lemma allocationBase_ae_support {E J A : Type*} [MeasurableSpace E] + [MeasurableSpace J] [Fintype J] [MeasurableSpace A] [Fintype A] + [MeasurableSingletonClass A] (μ : Measure E) (κ : Kernel (E × J) A) + (b : J) (a : A) (P : E → A → Prop) + (hP : ∀ e, ∀ᵐ a' ∂κ (e,b), P e a') : + ∀ᵐ e ∂allocationBase μ κ b a, P e a := by + apply (ae_withDensity_iff ((κ.measurable_coe (measurableSet_singleton a)).comp + (measurable_id.prodMk measurable_const))).mpr + apply ae_of_all + intro e hn + by_contra h + apply hn + exact measure_mono_null (by simpa only [singleton_subset_iff, mem_ofPred_eq] using h) + (ae_iff.mp (hP e)) + +lemma exposed_endpoint_ae {E I : Type*} [MeasurableSpace E] [Fintype I] + {X : I → Type*} [∀ i, MeasurableSpace (X i)] + (μ : Measure E) [SFinite μ] (ν : ∀ i, Measure (X i)) + [∀ i, IsProbabilityMeasure (ν i)] (p : I → Prop) [DecidablePred p] + (B : Set (E × (∀ i, X i))) {P : E → Prop} (hP : ∀ᵐ e ∂μ, P e) : + ∀ᵐ w ∂exposedLaw μ ν p B, P w.1 := by + apply (withDensity_absolutelyContinuous _ _).ae_le + exact Measure.quasiMeasurePreserving_fst.ae hP + +end HardSphere.Comparison + +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison CellOrbital GaussianPacking +attribute [local instance] Classical.propDecidable + +lemma recorded_allocation_is_physical {N K : ℕ} {L : Length} + (hL : L.val = (K : ℝ)) (hK : 1 ≤ K) + (μ : Measure (BridgeEndpoints N L)) + (m q : ℕ) (r R C S s₀ t : ℝ) (u : Time) : + ∀ᵐ z ∂μ.prod (Measure.pi fun _ : Fin N ↦ Bridge.law), + gridAllocationKernel hL q + (z.1, fun i ↦ eligibilityFlag (K:=K) m r R C S s₀ t u i (z.1,z.2 i)) = + physicalAllocationKernel (K:=K) m q r R C S s₀ u (labelBridgePath N L t z) := by + have he : ∀ᵐ z ∂μ.prod (Measure.pi fun _ : Fin N ↦ Bridge.law), + labelBridgePath N L t z 0 = z.1.2 ∧ + labelBridgePath N L t z 1 = bridgeEnd N L t z.1 := by + apply (Measure.ae_prod_iff_ae_ae + ((measurableSet_eq_fun ((continuous_eval_const (0:Time)).measurable.comp + (labelBridgePath_measurable N L t)) measurable_fst.snd).inter + (measurableSet_eq_fun ((continuous_eval_const (1:Time)).measurable.comp + (labelBridgePath_measurable N L t)) + ((bridgeEnd_continuous N L t).measurable.comp measurable_fst)))).mpr + exact ae_of_all _ (exposed_endpoints t) + filter_upwards [he] with z hz + rw [gridAllocationKernel_apply, physicalAllocationKernel, Kernel.comap_apply] + change Measure.pi _ = Measure.pi _ + congr 1 + funext v + rw [recordedList_eq hL hK m r R C S s₀ t u v z.1 z.2 hz.1 hz.2] + +lemma genuine_ground_allocated_joint {N K : ℕ} {L : Length} + (hL : L.val = (K : ℝ)) (hK : 1 ≤ K) + (ψ : Jet N L) (m q : ℕ) (r R C S s₀ t : ℝ) (u : Time) + (p : GridAllocation N K q → Fin N → Prop) : + (∑ b, ∑ a, ((exposedLaw + (allocationBase (endpointWeightedBase ψ t) (gridAllocationKernel hL q) b a) + (fun _ : Fin N ↦ Bridge.law) (p a) + (labelInteraction N L r t ∩ + flagEvent (eligibilityFlag (K:=K) m r R C S s₀ t u) b)).compProd + (fiberNormalize (Kernel.const _ (Measure.pi fun _ : {i // p a i} ↦ Bridge.law)) + (blockEvent (p a) (labelInteraction N L r t ∩ + flagEvent (eligibilityFlag (K:=K) m r R C S s₀ t u) b)))).map + (fun z ↦ (labelBridgePath N L t (blockGlue (p a) z),a))) = + (groundPathLaw N L r t ψ).compProd + (physicalAllocationKernel (K:=K) m q r R C S s₀ u) := by + let flag := eligibilityFlag (N:=N) (K:=K) (L:=L) m r R C S s₀ t u + have hflag : ∀ i, Measurable (flag i) := + fun i ↦ eligibilityFlag_measurable m r R C S s₀ t u i + let base := ((endpointWeightedBase ψ t).prod + (Measure.pi fun _ : Fin N ↦ Bridge.law)).restrict (labelInteraction N L r t) + have hf : Measurable (fun z : (BridgeEndpoints N L × (Fin N → Bridge.Noise)) × + GridAllocation N K q ↦ (labelBridgePath N L t z.1,z.2)) := + ((labelBridgePath_measurable N L t).comp measurable_fst).prodMk measurable_snd + have h := congrArg (fun μ ↦ μ.map + (fun z : (BridgeEndpoints N L × (Fin N → Bridge.Noise)) × GridAllocation N K q ↦ + (labelBridgePath N L t z.1,z.2))) + (allocated_exposure_joint (endpointWeightedBase ψ t) + (fun _ : Fin N ↦ Bridge.law) flag hflag (gridAllocationKernel hL q) p + (labelInteraction_measurable N L r t)) + simp only [Measure.map_finset_sum' hf.aemeasurable, + Measure.map_map hf ((blockGlue_measurable _).prodMk measurable_const), + Function.comp_def] at h + have hκ : ∀ᵐ z ∂base, + ((gridAllocationKernel hL q).comap + (fun z ↦ (z.1, fun i ↦ flag i (z.1,z.2 i))) + (measurable_fst.prodMk (Measurable.of_eval (fun i ↦ + (hflag i).comp (measurable_fst.prodMk + ((measurable_pi_apply i).comp measurable_snd)))))) z = + ((physicalAllocationKernel (K:=K) m q r R C S s₀ u).comap + (labelBridgePath N L t) (labelBridgePath_measurable N L t)) z := by + simpa only [Kernel.comap_apply] using + (ae_restrict_of_ae (s:=labelInteraction N L r t) + (recorded_allocation_is_physical hL hK + (endpointWeightedBase ψ t) m q r R C S s₀ t u)) + rw [Measure.compProd_congr hκ] at h + rw [map_retained_compProd base (labelBridgePath N L t) + (labelBridgePath_measurable N L t) + (physicalAllocationKernel (K:=K) m q r R C S s₀ u)] at h + rw [show base.map (labelBridgePath N L t) = groundPathLaw N L r t ψ from + genuine_ground_label_bridge ψ r t] at h + convert h using 1 + congr 2 + exact Subsingleton.elim _ _ + +lemma allocated_selected_flags {N K M G : ℕ} {L : Length} + (hL : L.val = (K : ℝ)) (μ : Measure (BridgeEndpoints N L)) [SFinite μ] + (g : Fin G) (b : Fin N → Bool) (a : GridAllocation N K (G*M)) + (B : Set (BridgeEndpoints N L × (Fin N → Bridge.Noise))) : + ∀ᵐ _ ∂exposedLaw (allocationBase μ (gridAllocationKernel hL (G*M)) b a) + (fun _ : Fin N ↦ Bridge.law) (fun i ↦ i ∈ groupUnion g a) B, + ∀ i ∈ groupUnion g a, b i = true := by + apply exposed_endpoint_ae + (allocationBase μ (gridAllocationKernel hL (G*M)) b a) + (fun _ : Fin N ↦ Bridge.law) (fun i ↦ i ∈ groupUnion g a) B + (P:=fun _ ↦ ∀ i ∈ groupUnion g a, b i = true) + filter_upwards [allocationBase_ae_support μ (gridAllocationKernel hL (G*M)) b a + (fun e a' ↦ ∀ v, a' v ∈ (allocationPMF (recordedList hL v (e,b)) (G*M)).support) + (fun e ↦ gridAllocation_support_ae hL (G*M) (e,b))] with e he + intro i hi + obtain ⟨v, _, hiv⟩ := Finset.mem_biUnion.mp hi + exact (Finset.mem_filter.mp (groupAt_mem_list hL (e,b) a he g v hiv)).2.2 + +lemma true_flag_endpoint {N K : ℕ} {L : Length} + (hL : L.val = (K : ℝ)) (hK : 1 ≤ K) + (m : ℕ) (r R C S s₀ t : ℝ) (u : Time) + (i : Fin N) (e : BridgeEndpoints N L) (β : Bridge.Noise) + (hb : eligibilityFlag (K:=K) m r R C S s₀ t u i (e,β) = true) : + EndpointEligible (gridHome hL (e.2 i)) s₀ e.2 (bridgeEnd N L t e) i := by + have ho : ownEligible (K:=K) m r R C S s₀ t u i (e,β) := + of_decide_eq_true hb + obtain ⟨v, hv, _⟩ := ho + rwa [(gridHome_eq_iff hL hK _ _).mpr hv.1] + +lemma exposed_selected_endpoints {N K : ℕ} {L : Length} + (hL : L.val = (K : ℝ)) (hK : 1 ≤ K) + (μ : Measure (BridgeEndpoints N L)) [SFinite μ] + (m : ℕ) (r R C S s₀ t : ℝ) (u : Time) + (p : Fin N → Prop) (b : Fin N → Bool) + (hb : ∀ i : {i // p i}, b i = true) : + ∀ᵐ w ∂exposedLaw μ (fun _ : Fin N ↦ Bridge.law) p + (labelInteraction N L r t ∩ + flagEvent (eligibilityFlag (K:=K) m r R C S s₀ t u) b), + ∀ i : {i // p i}, EndpointEligible (gridHome hL (w.1.2 i)) + s₀ w.1.2 (bridgeEnd N L t w.1) i := by + filter_upwards [exposed_block_positive μ (fun _ : Fin N ↦ Bridge.law) p + ((labelInteraction_measurable N L r t).inter + (flagEvent_measurable _ (fun i ↦ eligibilityFlag_measurable m r R C S s₀ t u i) b))] + with w hw + obtain ⟨β,hβ⟩ := nonempty_of_measure_ne_zero hw.ne' + intro i + apply true_flag_endpoint hL hK m r R C S s₀ t u i w.1 (β i) + have hflag := hβ.2 i + simpa only [blockGlue_fst, blockGlue_inside, hb i] using hflag + +def exposedAnchorLift {N K : ℕ} {L : Length} (hL : L.val = (K : ℝ)) + (e : BridgeEndpoints N L) (i : Fin N) : Point := + nearestLift L (labelStartLift e i) (gridCenter L (gridHome hL (e.2 i))) + +lemma exposedAnchorLift_project {N K : ℕ} {L : Length} (hL : L.val = (K : ℝ)) + (e : BridgeEndpoints N L) (i : Fin N) : + projectPoint L (exposedAnchorLift hL e i) = gridCenter L (gridHome hL (e.2 i)) := + nearestLift_project .. + +lemma exposedAnchorLift_near {N K : ℕ} {L : Length} (hL : L.val = (K : ℝ)) + (hK : 1 ≤ K) (e : BridgeEndpoints N L) (i : Fin N) : + ‖labelStartLift e i - exposedAnchorLift hL e i‖ ≤ 3 := by + rw [norm_sub_rev] + change ‖nearestLift L (labelStartLift e i) _ - labelStartLift e i‖ ≤ 3 + refine (nearestLift_bound L _ _ (R:=1) ?_).trans (by norm_num) + have he : projectPoint L (labelStartLift e i) = e.2 i := by + exact congrFun (project_representative N L e.2) i + rw [he] + simpa only [torusDistance, dist_comm] using centeredCell_distance (gridHome_mem hL hK (e.2 i)) + +def ExposedPhysicalIdentity {N K : ℕ} {L : Length} + (hL : L.val = (K : ℝ)) (m : ℕ) (r R C S s₀ t : ℝ) (u : Time) + (p : Fin N → Prop) (b : Fin N → Bool) + (w : BridgeEndpoints N L × ({i // ¬p i} → Bridge.Noise)) : Prop := +(conditionedMeasure (Measure.pi fun _ : {i // p i} ↦ Bridge.law) + {β | blockGlue p (w,β) ∈ labelInteraction N L r (2*t) ∩ + flagEvent (eligibilityFlag (K:=K) m r R C S s₀ (2*t) u) b}).map + (fun β (i : {i // p i}) ↦ + leg (2*t) (labelStartLift w.1 i) (labelEndLift (2*t) w.1 i) (β i)) = +conditionedMeasure (Measure.pi fun i : {i // p i} ↦ + individualReference t (labelStartLift w.1 i) (labelEndLift (2*t) w.1 i) + (permittedPath m r R C S u (labelStartLift w.1 i) (labelEndLift (2*t) w.1 i) + (exposedAnchorLift hL w.1 i) (frozenPaths (2*t) w.1 p w.2))) + (physicalMutual (L:=L) r) + +lemma canonical_physical_reference {N K : ℕ} {L : Length} + (hL : L.val = (K : ℝ)) (hK : 1 ≤ K) (h50 : 50 < L.val) + (μ : Measure (BridgeEndpoints N L)) [SFinite μ] + (m : ℕ) (r R C S s₀ t : ℝ) (u : Time) + (p : Fin N → Prop) (b : Fin N → Bool) (hb : ∀i : {i // p i}, b i = true) : + ∀ᵐ w ∂exposedLaw μ (fun _ : Fin N ↦ Bridge.law) p + (labelInteraction N L r (2*t) ∩ + flagEvent (eligibilityFlag (K:=K) m r R C S s₀ (2*t) u) b), + ExposedPhysicalIdentity hL m r R C S s₀ t u p b w := by + unfold ExposedPhysicalIdentity + filter_upwards [physical_recorded_reference hL hK h50 μ m r R C S s₀ t u p b hb, + exposed_selected_endpoints hL hK μ m r R C S s₀ (2*t) u p b hb] with w hw he + exact hw (fun i ↦ gridHome hL (w.1.2 i)) (fun i ↦ exposedAnchorLift hL w.1 i) + (fun i ↦ exposedAnchorLift_project hL w.1 i) + (fun i ↦ exposedAnchorLift_near hL hK w.1 i) he + +theorem actual_allocated_physical_reference {N K M G : ℕ} {L : Length} + (hL : L.val = (K : ℝ)) (hK : 1 ≤ K) (h50 : 50 < L.val) + (μ : Measure (BridgeEndpoints N L)) [SFinite μ] + (m : ℕ) (r R C S s₀ t : ℝ) (u : Time) + (g : Fin G) (b : Fin N → Bool) (a : GridAllocation N K (G*M)) : + let p := fun i ↦ i ∈ groupUnion g a + ∀ᵐ w ∂exposedLaw (allocationBase μ (gridAllocationKernel hL (G*M)) b a) + (fun _ : Fin N ↦ Bridge.law) p + (labelInteraction N L r (2*t) ∩ + flagEvent (eligibilityFlag (K:=K) m r R C S s₀ (2*t) u) b), + ExposedPhysicalIdentity hL m r R C S s₀ t u p b w := by + dsimp only + let p := fun i ↦ i ∈ groupUnion g a + let base := allocationBase μ (gridAllocationKernel hL (G*M)) b a + by_cases hb : ∀ i : {i // p i}, b i = true + · have h := canonical_physical_reference hL hK h50 base m r R C S s₀ t u p b hb + have hd : (fun i ↦ Classical.propDecidable (p i)) = + (fun i ↦ Finset.decidableMem i (groupUnion g a)) := Subsingleton.elim _ _ + rw [hd] at h + exact h + · filter_upwards [allocated_selected_flags hL μ g b a + (labelInteraction N L r (2*t) ∩ + flagEvent (eligibilityFlag (K:=K) m r R C S s₀ (2*t) u) b)] with w hw + exact (hb (fun i ↦ hw i i.property)).elim + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalAverageMoment.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalAverageMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..bedfab462d200f72c1ca07c68049df5a9e470928 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalAverageMoment.lean @@ -0,0 +1,164 @@ +import Mathlib +import OAI.Analysis.HardSphere.Comparison.MixtureMoment +import OAI.Analysis.HardSphere.Allocation.LabelEncounterAverage + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital HardSphere.Lattice +attribute [local instance] Classical.propDecidable +variable {K : ℕ} [NeZero K] {x y : DiscreteTorus K} +variable {J : Type*} [Fintype J] [DecidableEq J] [MeasurableSpace J] [MeasurableSingletonClass J] + +def physicalAverageLikelihood {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (hxy : x≠y) (b : Bool) (ν : Kernel (PhysicalDatum N K M G L) (SimplePath x y)) + (d : PhysicalDatum N K M G L) (w : Option J→C(Time,Point)) : ℝ≥0∞ := + ∫⁻c,physicalRouteLikelihood hL g m t r R C S u particle hxy b (d,c) w + ∂(ν.prod (physicalLabels hL g m t r R C S u particle)) d + +omit [MeasurableSpace J] [MeasurableSingletonClass J] in +lemma physicalAverageLikelihood_measurable {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (hxy : x≠y) (b : Bool) (ν : Kernel (PhysicalDatum N K M G L) (SimplePath x y)) + [IsSFiniteKernel ν] : + Measurable (fun z : PhysicalDatum N K M G L×(Option J→C(Time,Point)) ↦ + physicalAverageLikelihood hL g m t r R C S u particle hxy b ν z.1 z.2) := by + exact ((physicalRouteLikelihood_measurable hL g m t r R C S u particle hxy b).comp + ((measurable_fst.fst.prodMk measurable_snd).prodMk measurable_fst.snd)).lintegral_kernel_prod_right' + (κ:=(ν.prod (physicalLabels hL g m t r R C S u particle)).comap Prod.fst measurable_fst) + +omit [MeasurableSpace J] [MeasurableSingletonClass J] in +lemma physicalAverageLikelihood_square {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (hxy : x≠y) (b : Bool) (ν : Kernel (PhysicalDatum N K M G L) (SimplePath x y)) + [IsMarkovKernel ν] (d : PhysicalDatum N K M G L) : + (∫⁻w,(physicalAverageLikelihood hL g m t r R C S u particle hxy b ν d w)^2 + ∂physicalPrimaryReference hL g m t r R C S u particle (siteIndex (if b then y else x)) d)= + ∫⁻p,∫⁻p',∫⁻z,∫⁻z',∫⁻w, + physicalRouteLikelihood hL g m t r R C S u particle hxy b (d,(p,z)) w * + physicalRouteLikelihood hL g m t r R C S u particle hxy b (d,(p',z')) w + ∂physicalPrimaryReference hL g m t r R C S u particle (siteIndex (if b then y else x)) d + ∂physicalLabels hL g m t r R C S u particle d + ∂physicalLabels hL g m t r R C S u particle d ∂ν d ∂ν d := by + unfold physicalAverageLikelihood + rw [mixed_likelihood_square _ _ (fun cw : PhysicalRouteCode x y J×(Option J→C(Time,Point)) ↦ + physicalRouteLikelihood hL g m t r R C S u particle hxy b (d,cw.1) cw.2) + ((physicalRouteLikelihood_measurable hL g m t r R C S u particle hxy b).comp + ((measurable_const.prodMk measurable_fst).prodMk measurable_snd))] + simp_rw [Kernel.prod_apply,lintegral_prod _ (measurable_of_countable _).aemeasurable] + apply lintegral_congr + intro p + exact lintegral_lintegral_swap (measurable_of_countable _).aemeasurable + +theorem physicalAverage_moment {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0 simp [physicalGoodLikelihood,hd] + simp_rw [hind] + rw [lintegral_indicator hE] + calc + _ ≤ ∫⁻d in E,ENNReal.ofReal B*(∫⁻p,∫⁻p',ENNReal.ofReal (Real.exp (κ*(simpleEncounter 30 p p':ℝ))) ∂ν d ∂ν d) ∂μ := by + apply lintegral_mono_ae + filter_upwards [hdata] with d hd + exact physicalAverage_moment hL g m t r R C S ht hr u particle d hxy ν hM hd.1 hd.2.1 hd.2.2.1 + q δ B κ hδ hB hBt hκ hd.2.2.2 hsmall b + _ = ENNReal.ofReal B*(∫⁻d in E,∫⁻p,∫⁻p',ENNReal.ofReal (Real.exp (κ*(simpleEncounter 30 p p':ℝ))) ∂ν d ∂ν d ∂μ) := by + rw [lintegral_const_mul' _ _ (by simp)] + _ ≤ _ := mul_le_mul' le_rfl henc + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalBranchEstimates.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalBranchEstimates.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c1b63356305a9beb7e67b9b5770b6334ee2f50b --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalBranchEstimates.lean @@ -0,0 +1,102 @@ +import Mathlib +import OAI.Analysis.HardSphere.Conditioning.RouteMatches +import OAI.Analysis.HardSphere.Collisions.PhysicalCollisionReference +import OAI.Analysis.HardSphere.Allocation.PhysicalLabelLaw + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital HardSphere.Lattice +attribute [local instance] Classical.propDecidable +attribute [local irreducible] datumHome datumSelected groupUnion datumStart datumEnd anchorPoint + +def branchParticles {N K M G : ℕ} (g : Fin G) (a : GridAllocation N K (G*M)) : + {i // i∈groupUnion g a}↪Fin N := ⟨Subtype.val,Subtype.val_injective⟩ + +lemma physicalBranchLaw_primary {N K M G : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50 linarith [h.1,h.2] + exact (Measure.map_mono (Measure.restrict_mono_set volume hsub) (projectPoint_continuous L).measurable).trans_eq + (point_chart_preserving L (anchorPoint v)).map_eq + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalCodedMoment.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalCodedMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..caf7eaae15984df199568580de1394e49b92a31c --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalCodedMoment.lean @@ -0,0 +1,188 @@ +import Mathlib +import OAI.Analysis.HardSphere.Allocation.PhysicalAmbientRN +import OAI.Analysis.HardSphere.Allocation.PhysicalFamilyLikelihood + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital HardSphere.Lattice +attribute [local instance] Classical.propDecidable +variable {K : ℕ} [NeZero K] {x y : DiscreteTorus K} +variable {J : Type*} [Fintype J] [DecidableEq J] + +omit [NeZero K] in +lemma simpleEncounter_comm (R : ℕ) (p q : SimplePath x y) : + simpleEncounter R p q=simpleEncounter R q p := by + unfold simpleEncounter + apply Finset.card_bij (fun z _ ↦ z.swap) + · intro z hz + obtain ⟨hp,hq,hn⟩ := (mem_encounterSet _ _ _ _ _).mp hz + exact (mem_encounterSet _ _ _ _ _).mpr ⟨hq,hp,torusNear_symm hn⟩ + · intro z _ w _ he + exact Prod.swap_injective he + · intro z hz + obtain ⟨hp,hq,hn⟩ := (mem_encounterSet _ _ _ _ _).mp hz + exact ⟨z.swap,(mem_encounterSet _ _ _ _ _).mpr ⟨hq,hp,torusNear_symm hn⟩,rfl⟩ + +theorem physicalCoded_moment {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0 + simp only [ite_true] + have H := physical_first_likelihood_moment hL g m t r R C S ht u particle f v steps f' v' steps' d A B + hc hc' (fun i ↦ (hh i).1) (fun i ↦ (hh' i).1) (fun i ↦ (hh i).2) (fun i ↦ (hh' i).2) + hn hn' (he1'.trans he1.symm) hm hp q a ha0 hq hsmall + have Hrn := physical_first_RN_cross hL g m t r R C S ht hr u particle f v steps f' v' steps' d A B + hc hc' (fun i ↦ (hh i).1) (fun i ↦ (hh' i).1) (fun i ↦ (hh i).2) (fun i ↦ (hh' i).2) hp (he1'.trans he1.symm) + rw [he1] at Hrn H + rw [Hrn] + apply H.trans + rw [div_eq_mul_inv,ENNReal.inv_pow,hover] + apply mul_le_mul' le_rfl + apply pow_le_pow_right₀ ha1 + have h1 := simpleRoute_near_first p p' (simpleRouteLength_eq hxy p) (simpleRouteLength_eq hxy p') + (fun j ↦ datumHome hL d (particle j)) f f' (fun i ↦ (hh i).1) (fun i ↦ (hh' i).1) 30 + have h2 := simpleRoute_near_first p' p (simpleRouteLength_eq hxy p') (simpleRouteLength_eq hxy p) + (fun j ↦ datumHome hL d (particle j)) f' f (fun i ↦ (hh' i).1) (fun i ↦ (hh i).1) 30 + rw [simpleEncounter_comm 30 p' p] at h2 + omega + | false => + simp only [Bool.false_eq_true,ite_false] + have H := physical_second_likelihood_moment hL g m t r R C S ht u particle f v steps f' v' steps' d A B + hc hc' (fun i ↦ (hh i).1) (fun i ↦ (hh' i).1) (fun i ↦ (hh i).2) (fun i ↦ (hh' i).2) + hn hn' (he0'.trans he0.symm) hm hp q a ha0 hq hsmall + have Hrn := physical_second_RN_cross hL g m t r R C S ht hr u particle f v steps f' v' steps' d A B + hc hc' (fun i ↦ (hh i).1) (fun i ↦ (hh' i).1) (fun i ↦ (hh i).2) (fun i ↦ (hh' i).2) hp (he0'.trans he0.symm) + rw [he0] at Hrn H + rw [Hrn] + apply H.trans + rw [div_eq_mul_inv,ENNReal.inv_pow,hover] + apply mul_le_mul' le_rfl + apply pow_le_pow_right₀ ha1 + have h1 := simpleRoute_near_second p p' (simpleRouteLength_eq hxy p) (simpleRouteLength_eq hxy p') + (fun j ↦ datumHome hL d (particle j)) f f' (fun i ↦ (hh i).1) (fun i ↦ (hh' i).1) 30 + have h2 := simpleRoute_near_second p' p (simpleRouteLength_eq hxy p') (simpleRouteLength_eq hxy p) + (fun j ↦ datumHome hL d (particle j)) f' f (fun i ↦ (hh' i).1) (fun i ↦ (hh i).1) 30 + rw [simpleEncounter_comm 30 p' p] at h2 + omega + +end HardSphere.Groups +end +end + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital HardSphere.Lattice +attribute [local instance] Classical.propDecidable +variable {K : ℕ} [NeZero K] {x y : DiscreteTorus K} +variable {J : Type*} [Fintype J] [DecidableEq J] + +theorem physicalCoded_density {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0 + simp only [ite_true] + rw [hd.1,←simpleRouteVertices_last p _ (simpleRouteLength_eq hxy p), + ←physicalPrimary_on_map hL g m t r R C S hr u particle _ d] + exact (withDensity_absolutelyContinuous _ _).map hf + | false => + simp only [Bool.false_eq_true,ite_false] + rw [hd.2,←simpleRouteVertices_zero p _,←physicalPrimary_on_map hL g m t r R C S hr u particle _ d] + exact (withDensity_absolutelyContinuous _ _).map hf + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalDatum.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalDatum.lean new file mode 100644 index 0000000000000000000000000000000000000000..30cc1df8c282495bc5f1c35db62a2472d17ab9cd --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalDatum.lean @@ -0,0 +1,171 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.GridAllocation +import OAI.Analysis.HardSphere.Geometry.SiteGroups +import OAI.Analysis.HardSphere.Bridges.PhysicalPair + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital +attribute [local instance] Classical.propDecidable + +abbrev PhysicalDatum (N K M G : ℕ) (L : Length) := + Configuration N L × Configuration N L × (Fin N → Bool) × + GridAllocation N K (G*M) × (Fin N → ConfigurationPath 1 L) + +def physicalDatum {N K M G : ℕ} {L : Length} (g : Fin G) + (m : ℕ) (r R C S s₀ : ℝ) (u : Time) + (z : ConfigurationPath N L × GridAllocation N K (G*M)) : PhysicalDatum N K M G L := + (z.1 0,z.1 1,(fun i ↦ decide (∃v : Fin 3 → Fin K, + Eligible m r R C S s₀ u v i z.1)),z.2, + fun i ↦ if i∈groupUnion g z.2 then 0 else onePathAt i z.1) + +lemma physicalDatum_measurable {N K M G : ℕ} {L : Length} (g : Fin G) + (m : ℕ) (r R C S s₀ : ℝ) (u : Time) : + Measurable (physicalDatum (N:=N) (K:=K) (M:=M) (L:=L) g m r R C S s₀ u) := by + unfold physicalDatum + apply ((continuous_eval_const 0).measurable.comp measurable_fst).prodMk + apply ((continuous_eval_const 1).measurable.comp measurable_fst).prodMk + apply Measurable.prodMk + · apply Measurable.of_eval + intro i + have h : MeasurableSet {z : ConfigurationPath N L × GridAllocation N K (G*M) | + ∃v : Fin 3 → Fin K, Eligible m r R C S s₀ u v i z.1} := by + simp only [Set.ofPred_exists] + exact MeasurableSet.iUnion fun v ↦ + (eligible_measurable m r R C S s₀ u v i).preimage measurable_fst + apply measurable_to_countable' + intro b + cases b + · simpa only [Set.preimage,Set.mem_singleton_iff,decide_eq_false_iff_not,←Set.compl_ofPred] using h.compl + · simpa only [Set.preimage,Set.mem_singleton_iff,decide_eq_true_eq] using h + apply measurable_snd.prodMk + apply Measurable.of_eval + intro i + apply Measurable.ite + (measurable_snd ((Set.to_countable {a : GridAllocation N K (G*M) | i∈groupUnion g a}).measurableSet)) + measurable_const + exact (onePathAt_continuous i).measurable.comp measurable_fst + +def physicalDatumLaw {N K M G : ℕ} {L : Length} (g : Fin G) + (ψ : Jet N L) (m : ℕ) (r R C S s₀ T : ℝ) (u : Time) : + Measure (PhysicalDatum N K M G L) := + ((groundPathLaw N L r T ψ).compProd + (physicalAllocationKernel (K:=K) m (G*M) r R C S s₀ u)).map + (physicalDatum g m r R C S s₀ u) + +lemma physicalDatumLaw_probability {N K M G : ℕ} {L : Length} (g : Fin G) + {ψ : Jet N L} {r : ℝ} (hψ : IsGroundVector N L r ψ) + (m : ℕ) (R C S s₀ T : ℝ) (hT : 0≤T) (u : Time) : + IsProbabilityMeasure (physicalDatumLaw (K:=K) (M:=M) g ψ m r R C S s₀ T u) := by + have := hψ.groundPathLaw_probability hT + unfold physicalDatumLaw + infer_instance + +def datumSelected {N K M G : ℕ} {L : Length} (g : Fin G) + (d : PhysicalDatum N K M G L) : Finset (Fin N) := groupUnion g d.2.2.2.1 + +def datumHome {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (d : PhysicalDatum N K M G L) (i : Fin N) : Fin 3 → Fin K := gridHome hL (d.1 i) + +def anchorPoint {K : ℕ} (v : Fin 3 → Fin K) : Point := fun j ↦ ((v j).val:ℝ) + +lemma anchorPoint_project {K : ℕ} (L : Length) (v : Fin 3 → Fin K) : + projectPoint L (anchorPoint v)=gridCenter L v := rfl + +def datumStart {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (d : PhysicalDatum N K M G L) (i : Fin N) : Point := + nearestLift L (anchorPoint (datumHome hL d i)) (d.1 i) + +def datumEnd {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (d : PhysicalDatum N K M G L) (i : Fin N) : Point := + nearestLift L (anchorPoint (datumHome hL d i)) (d.2.1 i) + +lemma datumHome_measurable {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (i : Fin N) : + Measurable (fun d : PhysicalDatum N K M G L ↦ datumHome hL d i) := + (gridHome_measurable hL).comp ((measurable_pi_apply i).comp measurable_fst) + +lemma datumAnchor_measurable {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (i : Fin N) : + Measurable (fun d : PhysicalDatum N K M G L ↦ anchorPoint (datumHome hL d i)) := + (measurable_of_countable (anchorPoint (K:=K))).comp (datumHome_measurable hL i) + +lemma nearestLift_measurable (L : Length) : + Measurable (fun p : Point × Torus L ↦ nearestLift L p.1 p.2) := by + apply Measurable.of_eval + intro j + exact (measurable_subtype_coe.comp ((AddCircle.measurableEquivIco L.val (-L.val/2)).measurable.comp + (((measurable_pi_apply j).comp measurable_snd).sub + (AddCircle.measurable_mk'.comp ((measurable_pi_apply j).comp measurable_fst))))).add + ((measurable_pi_apply j).comp measurable_fst) + +lemma datumStart_measurable {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (i : Fin N) : + Measurable (fun d : PhysicalDatum N K M G L ↦ datumStart hL d i) := by + unfold datumStart + exact (nearestLift_measurable L).comp + ((datumAnchor_measurable hL i).prodMk ((measurable_pi_apply i).comp measurable_fst)) + +lemma datumEnd_measurable {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (i : Fin N) : + Measurable (fun d : PhysicalDatum N K M G L ↦ datumEnd hL d i) := by + unfold datumEnd + exact (nearestLift_measurable L).comp + ((datumAnchor_measurable hL i).prodMk ((measurable_pi_apply i).comp measurable_snd.fst)) + +lemma datumFrozen_measurable {N K M G : ℕ} {L : Length} (j : Fin N) : + Measurable (fun d : PhysicalDatum N K M G L ↦ d.2.2.2.2 j) := + (measurable_pi_apply j).comp (measurable_snd.snd.snd.snd) + +attribute [local irreducible] TrialCollision + +lemma datumFrozen_collision_measurable {N K M G : ℕ} {L : Length} + (j : Fin N) (r : ℝ) : + MeasurableSet {p : PhysicalDatum N K M G L × C(Time,Point) | + TrialCollision (L:=L) r (p.1.2.2.2.2 j) p.2} := + by + have hm : Measurable (fun p : PhysicalDatum N K M G L × C(Time,Point) ↦ + (p.1.2.2.2.2 j,p.2)) := + (((datumFrozen_measurable (K:=K) (M:=M) (G:=G) (L:=L) j).comp measurable_fst).prodMk measurable_snd) + have H : MeasurableSet {q : ConfigurationPath 1 L × C(Time,Point) | TrialCollision (L:=L) r q.1 q.2} := + (trialCollision_joint_closed (L:=L) r).measurableSet + exact hm H + +def datumPermitted {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (g : Fin G) + (m : ℕ) (r R C S : ℝ) (u : Time) (i : Fin N) : + Set (PhysicalDatum N K M G L × C(Time,Point)) := + {p | Regular m r R C u S (projectCurve L p.2) ∧ + TrialConfined L (anchorPoint (datumHome hL p.1 i)) p.2 ∧ + p.2∈fixedEndpoints (datumStart hL p.1 i) (datumEnd hL p.1 i) ∧ + ∀j, j∉datumSelected g p.1 → ¬TrialCollision (L:=L) r (p.1.2.2.2.2 j) p.2} + +lemma datumPermitted_measurable {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (g : Fin G) + (m : ℕ) (r R C S : ℝ) (u : Time) (i : Fin N) : + MeasurableSet (datumPermitted (M:=M) hL g m r R C S u i) := by + apply ((regular_measurable m r R C u S).preimage + ((projectCurve_continuous L).measurable.comp measurable_snd)).inter + apply ((trialConfined_joint_closed L).measurableSet.preimage + (((datumAnchor_measurable hL i).comp measurable_fst).prodMk measurable_snd)).inter + apply MeasurableSet.inter + · exact (measurableSet_eq_fun ((continuous_eval_const 0).measurable.comp measurable_snd) + ((datumStart_measurable hL i).comp measurable_fst)).inter + (measurableSet_eq_fun ((continuous_eval_const 1).measurable.comp measurable_snd) + ((datumEnd_measurable hL i).comp measurable_fst)) + simp only [imp_iff_not_or,not_not] + change MeasurableSet {p : PhysicalDatum N K M G L × C(Time,Point) | ∀j, + j∈datumSelected g p.1 ∨ ¬TrialCollision (L:=L) r (p.1.2.2.2.2 j) p.2} + simp only [Set.ofPred_forall] + apply MeasurableSet.iInter + intro j + apply MeasurableSet.union + · exact (measurable_fst.snd.snd.snd.fst) + ((Set.to_countable {a : GridAllocation N K (G*M) | j∈groupUnion g a}).measurableSet) + · exact (datumFrozen_collision_measurable (K:=K) (M:=M) (G:=G) (L:=L) j r).compl + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalDisintegration.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalDisintegration.lean new file mode 100644 index 0000000000000000000000000000000000000000..574039af69e482492a62659473ecf8c5cd09d4fe --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalDisintegration.lean @@ -0,0 +1,209 @@ +import Mathlib +import OAI.Analysis.HardSphere.Allocation.CoarsePhysical + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital +attribute [local instance] Classical.propDecidable + +lemma label_endpoints_ae {N : ℕ} {L : Length} (T : ℝ) + (μ : Measure (BridgeEndpoints N L)) : + ∀ᵐ z ∂μ.prod (Measure.pi fun _ : Fin N ↦ Bridge.law), + labelBridgePath N L T z 0=z.1.2 ∧ + labelBridgePath N L T z 1=bridgeEnd N L T z.1 := by + apply (Measure.ae_prod_iff_ae_ae + ((measurableSet_eq_fun ((continuous_eval_const (0:Time)).measurable.comp + (labelBridgePath_measurable N L T)) measurable_fst.snd).inter + (measurableSet_eq_fun ((continuous_eval_const (1:Time)).measurable.comp + (labelBridgePath_measurable N L T)) + ((bridgeEnd_continuous N L T).measurable.comp measurable_fst)))).mpr + exact ae_of_all _ (exposed_endpoints T) + +lemma physicalDatum_branch_of {N K M G : ℕ} {L : Length} + (g : Fin G) (b : Fin N→Bool) (a : GridAllocation N K (G*M)) + (m : ℕ) (r R C S s₀ T : ℝ) (u : Time) + (z : BridgeEndpoints N L × (Fin N→Bridge.Noise)) + (h0 : labelBridgePath N L T z 0=z.1.2) + (h1 : labelBridgePath N L T z 1=bridgeEnd N L T z.1) + (hb : z∈flagEvent (eligibilityFlag (K:=K) m r R C S s₀ T u) b) : + physicalDatum g m r R C S s₀ u (labelBridgePath N L T z,a)= + physicalBranchDatum g b a T (blockExpose (fun i ↦ i∈groupUnion g a) z) := by + have hf : (fun i ↦ decide (∃v : Fin 3→Fin K, + Eligible m r R C S s₀ u v i (labelBridgePath N L T z)))=b := by + funext i + have hi := hb i + simpa only [eligibilityFlag,ownEligible,Eligible,h0,h1,ownPath_eq] using hi + simp only [physicalDatum,physicalBranchDatum,h0,h1,hf,blockExpose] + refine Prod.ext rfl (Prod.ext rfl (Prod.ext rfl (Prod.ext rfl ?_))) + funext i + by_cases hi : i∈groupUnion g a + · simp only [ite_eq_left hi,dite_eq_left hi] + · simp only [ite_eq_right hi,dite_eq_right hi] + rw [labelBridgePath_lift] + rfl + +theorem actual_physical_branch_joint {N K M G : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50 exact inferInstanceAs (IsProbabilityMeasure (cellPathReference v)) + | some i => exact hp i + exact physicalSlotOn_probability hL g m t r R C S u particle v d i + +omit [Fintype J] in +theorem physical_auxiliary_exists {N K M G n : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0 exact (hi rfl).elim + | some i => rfl + have hs : none∈s := by + exact Finset.mem_map.mpr ⟨Fin.last (n+1),Finset.mem_univ _,routeEmbedding_last labels⟩ + have h := ambient_two_primary_laws (X:=X) σ s (routePermutation_fixed labels) r + (fun j ↦ projectPoint L (anchorPoint (datumHome hL d (particle j)))) + (fun j ↦ physicalSlotAllowed hL g m r R C S u particle d (some j)) some (fun _ f ↦ f) (fun _ ↦ measurable_id) + none (fun _ ↦ Option.some_ne_none _) hs μ ν heq κ η hr z w () + have hρ : (fun i:s ↦ Kernel.const Unit ((μ i).compProd (κ i)))= + (fun i:s ↦ Kernel.const Unit (physicalSelectedOn hL g m t r R C S u particle labels v steps d i)) := by + funext i + rw [he i] + dsimp only at h + simp only [hρ] at h + exact h + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalMidpointReference.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalMidpointReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9fba89399e68afdc9d52c7da4f73800efd93aba --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalMidpointReference.lean @@ -0,0 +1,141 @@ +import Mathlib +import OAI.Analysis.HardSphere.Allocation.PhysicalBranchLaw + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital +attribute [local instance] Classical.propDecidable + +def rawPhysicalBranch {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (μ : Measure (BridgeEndpoints N L)) [SFinite μ] + (_group : Fin G) (b : Fin N→Bool) (a : GridAllocation N K (G*M)) + (m : ℕ) (r R C S s₀ T : ℝ) (u : Time) := + ((allocationBase μ (gridAllocationKernel hL (G*M)) b a).prod + (Measure.pi fun _ : Fin N ↦ Bridge.law)).restrict + (labelInteraction N L r T∩flagEvent (eligibilityFlag (K:=K) m r R C S s₀ T u) b) +instance rawPhysicalBranch_sfinite {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (μ : Measure (BridgeEndpoints N L)) [SFinite μ] + (g : Fin G) (b : Fin N→Bool) (a : GridAllocation N K (G*M)) + (m : ℕ) (r R C S s₀ T : ℝ) (u : Time) : + SFinite (rawPhysicalBranch hL μ g b a m r R C S s₀ T u) := by + unfold rawPhysicalBranch; infer_instance + +theorem physicalBranch_reference_raw {N K M G : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50 simp [physicalRecoveredPath,physicalDatum,hi] + +def physicalRecoveredMidpoint {N K M G : ℕ} {L : Length} (g : Fin G) + (a : GridAllocation N K (G*M)) + (z : PhysicalDatum N K M G L×({i // i∈groupUnion g a}→ ConfigurationPath 1 L)) : Configuration N L := + fun i ↦ physicalRecoveredPath g a z i midpointTime 0 +lemma physicalRecoveredMidpoint_measurable {N K M G : ℕ} {L : Length} (g : Fin G) + (a : GridAllocation N K (G*M)) : Measurable (physicalRecoveredMidpoint (L:=L) g a) := + Measurable.of_eval fun i ↦ (measurable_pi_apply 0).comp + ((continuous_eval_const midpointTime).measurable.comp + ((measurable_pi_apply i).comp (physicalRecoveredPath_measurable g a))) +lemma physicalRecoveredMidpoint_actual {N K M G : ℕ} {L : Length} (g : Fin G) + (a : GridAllocation N K (G*M)) (m : ℕ) (r R C S s₀ : ℝ) (u : Time) + (F : ConfigurationPath N L) : + physicalRecoveredMidpoint g a (physicalDatum g m r R C S s₀ u (F,a),fun i ↦ onePathAt i F)= + F midpointTime := by + unfold physicalRecoveredMidpoint + rw [physicalRecoveredPath_actual] + rfl + +theorem physicalBranch_midpoint_raw {N K M G : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50 simp only [Bool.false_eq_true,ite_false,ite_true] <;> exact measurable_fst.prodMk (by fun_prop)) +instance physicalCodeObserver_markov {N M G : ℕ} {L : Length} (particle : J↪Fin (N+1)) + (hxy : x≠y) (b : Bool) : + IsMarkovKernel (physicalCodeObserver (M:=M) (G:=G) (L:=L) particle hxy b) := by + unfold physicalCodeObserver; infer_instance + +theorem physicalCodedRoute_same_observed {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0 + (funext w + simp only [physicalCodeObserver,Kernel.comap_apply,taggedPhysicalBathKernel,Kernel.coe_mk, + physicalCodeTag,dite_eq_left hv,ite_true,Bool.false_eq_true,ite_false,physicalBathKernel]) + +end HardSphere.Groups +end +end + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital _root_.OAI.HardSphere.Lattice +attribute [local instance] Classical.propDecidable +variable {K : ℕ} [NeZero K] {x y : DiscreteTorus K} +variable {J : Type*} [Fintype J] [DecidableEq J] + +omit [NeZero K] in +lemma unitTarget_project {L : Length} (hL : 1≤L.val) (v : Fin 3→Fin K) (z : Point) + (hz : z∈unitTarget (anchorPoint v)) : projectPoint L z∈centeredCell L (gridCenter L v) := by + rw [centeredCell_image hL] + intro j + have hj := hz j (mem_univ j) + refine ⟨z j-(v j:ℝ),⟨?_,?_⟩,?_⟩ + · change (v j:ℝ)-1/2≤z j ∧ z j<(v j:ℝ)+1/2 at hj + linarith [hj.1] + · change (v j:ℝ)-1/2≤z j ∧ z j<(v j:ℝ)+1/2 at hj + linarith [hj.2] + · change ((z j-(v j:ℝ):ℝ):AddCircle L.val)=((z j:ℝ):AddCircle L.val)-((v j:ℝ):AddCircle L.val) + exact QuotientAddGroup.mk_sub _ _ _ + +omit [NeZero K] in +lemma cellPathReference_support {L : Length} (hL : 1≤L.val) (v : Fin 3→Fin K) : + ∀ᵐp ∂cellPathReference v,projectPoint L (p midpointTime)∈centeredCell L (gridCenter L v) := by + have hm : Measurable (fun p : C(Time,Point) ↦ projectPoint L (p midpointTime)) := + (projectPoint_continuous L).measurable.comp (continuous_eval_const midpointTime).measurable + rw [cellPathReference,ae_map_iff pointAsPath_measurable.aemeasurable ((centeredCell_measurable L _).preimage hm)] + unfold targetUniform + apply Measure.ae_smul_measure + filter_upwards [ae_restrict_mem (unitTarget_measurable (anchorPoint v))] with z hz + exact unitTarget_project hL v z hz + +omit [DecidableEq J] in +lemma physicalPrimary_extra {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (v : Fin 3→Fin K) (d : PhysicalDatum N K M G L) : + ∀ᵐw ∂physicalPrimaryReference hL g m t r R C S u particle v d, + physicalFullMidpoint particle (d,w) none∈centeredCell L (gridCenter L v) := by + have hL1 : 1≤L.val := by rw [hL]; exact_mod_cast NeZero.pos K + have hextra := (Measure.quasiMeasurePreserving_eval + (fun i ↦ physicalSlotReference hL g m t r R C S u particle v i d) none).ae (cellPathReference_support hL1 v) + rw [physicalPrimaryReference_apply,conditionedMeasure] + apply Measure.ae_smul_measure + filter_upwards [ae_restrict_of_ae hextra] with w hw + change fillGroup particle _ _ (optionParticle particle none)∈_ + rw [fillGroup_selected] + exact hw + +def physicalTagEvent {N M G : ℕ} {L : Length} (particle : J↪Fin N) + (v : Fin 3→Fin K) (i : Fin N) : Set (PhysicalDatum N K M G L×(Option J→C(Time,Point))) := + {z | i∈Set.range particle ∧ physicalFullMidpoint particle z (some i)∈centeredCell L (gridCenter L v)} +omit [NeZero K] [DecidableEq J] in +lemma physicalTagEvent_measurable {N M G : ℕ} {L : Length} (particle : J↪Fin N) + (v : Fin 3→Fin K) (i : Fin N) : MeasurableSet (physicalTagEvent (M:=M) (G:=G) (L:=L) particle v i) := + .inter (show MeasurableSet {z : PhysicalDatum N K M G L×(Option J→C(Time,Point)) | i∈Set.range particle} from by + by_cases h : i∈Set.range particle <;> simp [h]) ((centeredCell_measurable L _).preimage + ((measurable_pi_apply (some i)).comp (physicalFullMidpoint_measurable particle))) + +theorem physicalCodedRoute_tag_support {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0 simp <;> fun_prop + have hm : Measurable (fun w : Option J→C(Time,Point) ↦ physicalFullMidpoint particle (d,w) none) := + (measurable_pi_apply none).comp ((physicalFullMidpoint_measurable particle).comp measurable_prodMk_left) + have h' := (ae_map_iff hf.aemeasurable ((centeredCell_measurable L _).preimage hm)).mp h + cases b <;> simpa using h' + have hv := routeFieldValid_of_supported hL g m t r R C S u particle d p z hz ha + have hh := fieldRouteLabels_physical hL g m t r R C S u particle d hxy p z hz ha hv + have hmid := physicalPairedRoute_midpoint hL g m t r R C S ht u particle + (fieldRouteLabels hxy p z hv) (simpleRouteVertices p (p.val.length-1)) + (simpleRouteSteps hL p _ (simpleRouteLength_eq hxy p)) + (simpleRouteSteps_period hL p _ (simpleRouteLength_eq hxy p)) d + (fun i ↦ (hh i).1) (fun i ↦ (hh i).2) + have hmid' : ∀ᵐw ∂physicalCodedRoute hL g m t r R C S u particle hxy (p,z) d, + ∀i,physicalFullMidpoint particle (d,w.2) i=physicalFullMidpoint particle (d,w.1) + (routePermutation ((fieldRouteLabels hxy p z hv).trans particle) i) := by + simpa only [physicalCodedRoute,dite_eq_left hv] using hmid + filter_upwards [he true,he false,hmid'] with w h1 h2 hm + cases b with + | true => + simp only [physicalTagEvent,mem_ofPred_eq,physicalCodeTag,dite_eq_left hv,ite_true] + refine ⟨⟨_,rfl⟩,?_⟩ + have H := hm none + rw [routePermutation_star] at H + simp only [Function.Embedding.trans_apply] at H + change physicalFullMidpoint particle (d,w.1) (some (particle (fieldRouteLabels hxy p z hv 0)))∈_ + rw [←H] + exact h2 + | false => + simp only [physicalTagEvent,mem_ofPred_eq,physicalCodeTag,dite_eq_left hv,Bool.false_eq_true,ite_false] + refine ⟨⟨_,rfl⟩,?_⟩ + have H := hm (some (particle (fieldRouteLabels hxy p z hv (Fin.last (p.val.length-1))))) + change physicalFullMidpoint particle (d,w.2) (some (((fieldRouteLabels hxy p z hv).trans particle) (Fin.last (p.val.length-1)))) = physicalFullMidpoint particle (d,w.1) (routePermutation ((fieldRouteLabels hxy p z hv).trans particle) (some (((fieldRouteLabels hxy p z hv).trans particle) (Fin.last (p.val.length-1))))) at H + rw [routePermutation_lastLabel] at H + simp only [Function.Embedding.trans_apply] at H + rw [H] + exact h1 + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalObservedMass.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalObservedMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b08fcb24e55501d1d1ebac5b3285dfc7d945091 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalObservedMass.lean @@ -0,0 +1,198 @@ +import Mathlib +import OAI.Analysis.HardSphere.Thermodynamics.PhysicalScaleData +import OAI.Analysis.HardSphere.Allocation.PhysicalTaggedObservation + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital _root_.OAI.HardSphere.Lattice +attribute [local instance] Classical.propDecidable +variable {K : ℕ} [NeZero K] {x y : DiscreteTorus K} +variable {J : Type*} [Fintype J] [DecidableEq J] [MeasurableSpace J] [MeasurableSingletonClass J] + +omit [MeasurableSpace J] [MeasurableSingletonClass J] in +lemma physicalObservedMixture_mass_eq {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin (N+1)) + (hxy : x≠y) (ν : Kernel (PhysicalDatum (N+1) K M G L) (SimplePath x y)) [IsMarkovKernel ν] + (b : Bool) (d : PhysicalDatum (N+1) K M G L) : + physicalObservedMixture hL g m t r R C S u particle hxy ν b d univ= + physicalMixedRoutes hL g m t r R C S u particle hxy ν d univ := by + simp only [physicalObservedMixture,Kernel.snd_apply' _ _ MeasurableSet.univ,preimage_univ, + Kernel.compProd_apply_univ] + +omit [MeasurableSpace J] [MeasurableSingletonClass J] in +theorem physicalObservedMixture_mass {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0.comp measurable_prodMk_left + change (∫⁻w,(physicalCodeObserver particle hxy true) (d,w) A ∂physicalMixedRoutes hL g m t r R C S u particle hxy ν d)= + (∫⁻w,(physicalCodeObserver particle hxy false) (d,w) A ∂physicalMixedRoutes hL g m t r R C S u particle hxy ν d) + rw [hex true,hex false] + apply lintegral_congr_ae + rw [Kernel.prod_apply] + apply (Measure.ae_prod_iff_ae_ae (Set.to_countable _).measurableSet).mpr + filter_upwards [ha] with p hp + filter_upwards [physicalLabels_supported hL g m t r R C S u particle d] with z hz + have H := congrArg (fun μ ↦ μ A) (physicalCodedRoute_same_observed hL g m t r R C S ht u particle d hxy p z hz hp) + simpa only [Measure.bind_apply hA (Kernel.aemeasurable _),Kernel.comap_apply] using H + +theorem physicalObservedMixture_same_joint {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0 univ + | some i => Prod.mk d ⁻¹' datumPermitted hL g m r R C S u (particle i) + +omit [Fintype J] [DecidableEq J] in +lemma physicalSlotAllowed_measurable {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (r R C S : ℝ) (u : Time) + (particle : J→Fin N) (d : PhysicalDatum N K M G L) (i : Option J) : + MeasurableSet (physicalSlotAllowed hL g m r R C S u particle d i) := by + cases i with + | none => exact MeasurableSet.univ + | some i => exact (datumPermitted_measurable hL g m r R C S u (particle i)).preimage measurable_prodMk_left + +def physicalSlotOn {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) + (particle : J→Fin N) (v : Fin 3→Fin K) (d : PhysicalDatum N K M G L) : + (i : Option J)→Measure (physicalSlotAllowed hL g m r R C S u particle d i) + | none => subtypeConditional (cellPathReference v) univ + | some i => referenceOn t (datumStart hL d (particle i)) (datumEnd hL d (particle i)) + (Prod.mk d ⁻¹' datumPermitted hL g m r R C S u (particle i)) + +omit [Fintype J] [DecidableEq J] in +lemma physicalSlotOn_map {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) + (particle : J→Fin N) (v : Fin 3→Fin K) (d : PhysicalDatum N K M G L) (i : Option J) : + (physicalSlotOn hL g m t r R C S u particle v d i).map Subtype.val= + physicalSlotReference hL g m t r R C S u particle v i d := by + cases i with + | none => + change (subtypeConditional (cellPathReference v) (univ : Set C(Time,Point))).map + Subtype.val=cellPathReference v + rw [subtypeConditional_map _ MeasurableSet.univ,measure_univ,inv_one, + one_smul,Measure.restrict_univ] + | some i => + change (referenceOn t (datumStart hL d (particle i)) (datumEnd hL d (particle i)) + (Prod.mk d ⁻¹' datumPermitted hL g m r R C S u (particle i))).map Subtype.val= + datumIndividualReference hL g m r R C S t u (particle i) d + rw [referenceOn_map _ _ _ ((datumPermitted_measurable hL g m r R C S u (particle i)).preimage + measurable_prodMk_left),datumIndividualReference_apply] + +instance physicalSlotOn_finite {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) + (particle : J→Fin N) (v : Fin 3→Fin K) (d : PhysicalDatum N K M G L) (i : Option J) : + IsFiniteMeasure (physicalSlotOn hL g m t r R C S u particle v d i) := by + have hm := physicalSlotOn_map hL g m t r R C S u particle v d i + have : IsFiniteMeasure ((physicalSlotOn hL g m t r R C S u particle v d i).map Subtype.val) := by + rw [hm]; infer_instance + exact Measure.isFiniteMeasure_of_map measurable_subtype_coe.aemeasurable + +omit [Fintype J] [DecidableEq J] in +lemma physicalSlotOn_probability {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) + (particle : J→Fin N) (v : Fin 3→Fin K) (d : PhysicalDatum N K M G L) (i : Option J) + [IsProbabilityMeasure (physicalSlotReference hL g m t r R C S u particle v i d)] : + IsProbabilityMeasure (physicalSlotOn hL g m t r R C S u particle v d i) := by + have : IsProbabilityMeasure ((physicalSlotOn hL g m t r R C S u particle v d i).map Subtype.val) := by + rw [physicalSlotOn_map]; infer_instance + exact Measure.isProbabilityMeasure_of_map measurable_subtype_coe.aemeasurable + +omit [Fintype J] [DecidableEq J] in +lemma physicalAllowed_confined {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (r R C S : ℝ) (u : Time) + (particle : J→Fin N) (d : PhysicalDatum N K M G L) (i : J) + (f : physicalSlotAllowed hL g m r R C S u particle d (some i)) : + Confined (projectPoint L (anchorPoint (datumHome hL d (particle i)))) (projectCurve L f.val) := + fun s ↦ (f.property.2.1 s).2 + +lemma physicalAllowed_checks {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (r R C S : ℝ) (hr : r≤1) (u : Time) + (particle : J→Fin N) (d : PhysicalDatum N K M G L) : + (routeConfigMap (fun i ↦ (Subtype.val : physicalSlotAllowed hL g m r R C S u particle d i→_))) ⁻¹' + physicalSlotMutual (L:=L) r= + retainedEvent (primaryChecks r (fun j ↦ projectPoint L (anchorPoint (datumHome hL d (particle j)))) + (fun j ↦ physicalSlotAllowed hL g m r R C S u particle d (some j)) + some (fun _ f ↦ f) (fun _ ↦ measurable_id)) Finset.univ := by + ext x + constructor + · intro hx e he + exact hx e.2.val.1 e.2.val.2 e.2.property.1 + · intro hx + let allowed := physicalSlotAllowed hL g m r R C S u particle d + let anchor := fun j ↦ projectPoint L (anchorPoint (datumHome hL d (particle j))) + have hconf : ∀j,∀f : allowed (some j),Confined (anchor j) (projectCurve L f.val) := + physicalAllowed_confined hL g m r R C S u particle d + have hh := physicalSparseChecks_complete (I:=Option J) (V:=fun i ↦ allowed i) + r hr anchor (fun j ↦ allowed (some j)) hconf + (fun _ ↦ some) (fun _ _ f ↦ f) (fun _ _ ↦ measurable_id) x hx + exact hh false + +lemma physicalPrimary_on_map {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (hr : r≤1) (u : Time) + (particle : J→Fin N) (v : Fin 3→Fin K) (d : PhysicalDatum N K M G L) : + (conditionedMeasure (Measure.pi (physicalSlotOn hL g m t r R C S u particle v d)) + (retainedEvent (primaryChecks r (fun j ↦ projectPoint L (anchorPoint (datumHome hL d (particle j)))) + (fun j ↦ physicalSlotAllowed hL g m r R C S u particle d (some j)) + some (fun _ f ↦ f) (fun _ ↦ measurable_id)) Finset.univ)).map + (routeConfigMap (fun i ↦ (Subtype.val : physicalSlotAllowed hL g m r R C S u particle d i→_)))= + physicalPrimaryReference hL g m t r R C S u particle v d := by + rw [←physicalAllowed_checks hL g m r R C S hr u particle d, + physicalPrimaryReference_apply] + exact (conditioned_pi_map (physicalSlotOn hL g m t r R C S u particle v d) + (fun i ↦ (Subtype.val : physicalSlotAllowed hL g m r R C S u particle d i→_)) + (fun _ ↦ measurable_subtype_coe) (physicalSlotMutual_measurable r)).trans + (by simp only [physicalSlotOn_map]) + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalProjectedPrimary.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalProjectedPrimary.lean new file mode 100644 index 0000000000000000000000000000000000000000..6cd691bfb213df0f2ba284aa0003660b4b171c23 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalProjectedPrimary.lean @@ -0,0 +1,62 @@ +import Mathlib +import OAI.Analysis.HardSphere.Conditioning.PhysicalFullReference + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital +attribute [local instance] Classical.propDecidable + +theorem physicalBranch_primary_midpoint {N K M G : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50 + exact (projectPoint_continuous L).measurable.comp + ((continuous_eval_const midpointTime).measurable.comp measurable_snd) + | some i => + exact (measurable_pi_apply i).comp + ((continuous_eval_const midpointTime).measurable.comp + ((labelBridgePath_measurable N L (2*t)).comp measurable_fst)))] at H + have hf : Measurable (fun z ↦ labelBridgePath N L (2*t) z midpointTime) := + (continuous_eval_const midpointTime).measurable.comp (labelBridgePath_measurable N L (2*t)) + have he : Measurable (fun e : C(Time,Point) ↦ projectPoint L (e midpointTime)) := + (projectPoint_continuous L).measurable.comp (continuous_eval_const midpointTime).measurable + rw [Measure.map_prod_map _ _ hf he,Measure.map_map (by + apply Measurable.of_eval + intro i + cases i with + | none => exact measurable_snd + | some i => exact (measurable_pi_apply i).comp measurable_fst) (hf.prodMap he)] + exact H + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalReference.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..014eed8c88404873fb9780d5fd1cb1b6b09f9e11 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalReference.lean @@ -0,0 +1,170 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.ConfinedLift +import OAI.Analysis.HardSphere.Conditioning.ConditionTransport +import OAI.Analysis.HardSphere.Allocation.AllocationJoint + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Groups +open Wiener Bridge GaussianPacking PathCutoff Comparison CellOrbital +attribute [local instance] Classical.propDecidable + +def frozenPaths {N : ℕ} {L : Length} (t : ℝ) (e : BridgeEndpoints N L) + (p : Fin N→Prop) (w : {i // ¬p i}→Bridge.Noise) : {i // ¬p i} → ConfigurationPath 1 L := + fun j ↦ projectCurve L (leg t (labelStartLift e j) (labelEndLift t e j) (w j)) + +lemma actual_reference_event {N K : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50 simp [groupAt,he] at hi + | some f => + simp only [groupAt,he,Finset.mem_image,Finset.mem_univ,true_and] at hi + obtain ⟨k,rfl⟩ := hi + exact allocationPMF_support _ _ _ (ha v) f he _ + +lemma physical_groups_disjoint {N K M G : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (m : ℕ) (r R C S s₀ : ℝ) (u : Time) + (ω : ConfigurationPath N L) (a : GridAllocation N K (G*M)) + (ha : ∀v,a v∈(allocationPMF (eligibleList m r R C S s₀ u v ω) (G*M)).support) + (g h : Fin G) (hgh : g≠h) : Disjoint (groupUnion g a) (groupUnion h a) := by + apply Finset.disjoint_left.mpr + intro i hig hih + obtain ⟨v,_,hiv⟩ := Finset.mem_biUnion.mp hig + obtain ⟨w,_,hiw⟩ := Finset.mem_biUnion.mp hih + have hv := groupAt_mem_eligible m r R C S s₀ u ω a ha g v hiv + have hw := groupAt_mem_eligible m r R C S s₀ u ω a ha h w hiw + have hvw : v=w := by + by_contra hn + exact Finset.disjoint_left.mp (eligibleList_disjoint hL hK m r R C S s₀ u ω hn) hv hw + rw [←hvw] at hiw + cases he : a v with + | none => simp [groupAt,he] at hiv + | some f => + simp only [groupAt,he,Finset.mem_image,Finset.mem_univ,true_and] at hiv hiw + obtain ⟨k,hk⟩ := hiv + obtain ⟨l,hl⟩ := hiw + exact groupPosition_disjoint M G g h hgh k l (f.injective (hk.trans hl.symm)) + +lemma physicalAllocation_supported_ae {N K : ℕ} {L : Length} + (m total : ℕ) (r R C S s₀ : ℝ) (u : Time) (ω : ConfigurationPath N L) : + ∀ᵐa ∂physicalAllocationKernel (K:=K) m total r R C S s₀ u ω, + ∀v,a v∈(allocationPMF (eligibleList m r R C S s₀ u v ω) total).support := by + change ∀ᵐa ∂Measure.pi (fun v ↦ (allocationPMF (eligibleList m r R C S s₀ u v ω) total).toMeasure), _ + apply ae_all_iff.mpr + intro v + exact (MeasureTheory.measurePreserving_eval + (fun w ↦ (allocationPMF (eligibleList m r R C S s₀ u w ω) total).toMeasure) v).quasiMeasurePreserving.tendsto_ae + (allocation_support_ae _ _) + +theorem sum_physical_group_tags_le {N K M G : ℕ} {L : Length} + {Y : Type*} [MeasurableSpace Y] + (hL : L.val=(K:ℝ)) (hK : 1≤K) (m : ℕ) (r R C S s₀ : ℝ) (u : Time) + (μ : Measure (ConfigurationPath N L)) [SFinite μ] + (κ : Fin N→Kernel (ConfigurationPath N L×GridAllocation N K (G*M)) Y) : + (∑g,allocatedTagLaw (μ.compProd (physicalAllocationKernel m (G*M) r R C S s₀ u)) + (fun g p ↦ groupUnion g p.2) κ g) ≤ + ∑i,κ i ∘ₘ μ.compProd (physicalAllocationKernel m (G*M) r R C S s₀ u) := by + apply sum_allocatedTagLaw_le_ae + · intro g i + exact ((measurable_of_countable (fun a : GridAllocation N K (G*M) ↦ i∈groupUnion g a)).comp measurable_snd).setOf + · apply Measure.ae_compProd_of_ae_ae + (((measurable_of_countable (fun a : GridAllocation N K (G*M) ↦ + ∀g h : Fin G,g≠h→Disjoint (groupUnion g a) (groupUnion h a))).comp measurable_snd).setOf) + filter_upwards [] with ω + filter_upwards [physicalAllocation_supported_ae m (G*M) r R C S s₀ u ω] with a ha + exact fun g h hgh ↦ physical_groups_disjoint hL hK m r R C S s₀ u ω a ha g h hgh + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalRouteAuxiliary.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalRouteAuxiliary.lean new file mode 100644 index 0000000000000000000000000000000000000000..6945ad7bb865e31e6a07b6966a3b55b0c8146fc6 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalRouteAuxiliary.lean @@ -0,0 +1,260 @@ +import Mathlib +import OAI.Analysis.HardSphere.Allocation.PhysicalRouteMass +import OAI.Analysis.HardSphere.Bridges.RouteSecondMoment + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital +attribute [local instance] Classical.propDecidable +variable {J : Type*} [Fintype J] [DecidableEq J] +variable {N K M G n : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) + (particle : J↪Fin N) (labels : Fin (n+1)↪J) (v : Fin (n+2)→(Fin 3→Fin K)) + (steps : Fin (n+1)→Fin 7) (d : PhysicalDatum N K M G L) + +structure PhysicalRouteAux where + forward : ∀i,Kernel (physicalSlotAllowed hL g m r R C S u particle d i) + (physicalSlotAllowed hL g m r R C S u particle d ((routePermutation labels).symm i)) + backward : ∀i,Kernel (physicalSlotAllowed hL g m r R C S u particle d i) + (physicalSlotAllowed hL g m r R C S u particle d (routePermutation labels i)) + forward_finite : ∀i,IsFiniteKernel (forward i) + backward_finite : ∀i,IsFiniteKernel (backward i) + selected : ∀i:routeSlots labels, + (physicalSlotOn hL g m t r R C S u particle (v (Fin.last (n+1))) d i).compProd (forward i)= + physicalSelectedOn hL g m t r R C S u particle labels v steps d i + reverse : ∀i,((physicalSlotOn hL g m t r R C S u particle (v (Fin.last (n+1))) d (routePermutation labels i)).compProd + (forward (routePermutation labels i))).map (reverseFactor (X:=fun i ↦ physicalSlotAllowed hL g m r R C S u particle d i) + (routePermutation labels) i)=(physicalSlotOn hL g m t r R C S u particle (v 0) d i).compProd (backward i) + forward_bound : ∀i x,forward i x univ≤routeDensityBound t + backward_bound : ∀i x,backward i x univ≤routeDensityBound t + forward_mass : ∀i,∫⁻x,forward i x univ ∂physicalSlotOn hL g m t r R C S u particle (v (Fin.last (n+1))) d i=1 + backward_mass : ∀i,∫⁻x,backward i x univ ∂physicalSlotOn hL g m t r R C S u particle (v 0) d i=1 + firstSeed : ∀i,physicalSlotAllowed hL g m r R C S u particle d ((routePermutation labels).symm i) + secondSeed : ∀i,physicalSlotAllowed hL g m r R C S u particle d (routePermutation labels i) + +attribute [instance] PhysicalRouteAux.forward_finite PhysicalRouteAux.backward_finite + +omit [Fintype J] in +lemma physicalRouteAux_nonempty (ht : 0 infer_instance + +def routeFirstReference {N K M G n : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) + (labels : Fin (n+1)↪Fin N) (v : Fin (n+2)→(Fin 3→Fin K)) + (k : Fin (n+2)) (d : PhysicalDatum N K M G L) : Measure C(Time,Point) := + if hk : k.val fin_cases k <;> norm_num [targetStep] + +lemma targetStep_negative (i : Fin 3) : + targetStep ⟨2*i.val+2,by omega⟩=fun k ↦ if k=i then (-1:ℝ) else 0 := by + funext k + fin_cases i <;> fin_cases k <;> norm_num [targetStep] + +lemma nearest_targetStep {x y : Vertex} (h : nearestStep x y) : + ∃ j : Fin 7,targetStep j=fun k ↦ ((y k-x k:ℤ):ℝ) := by + obtain ⟨i,hi,hr⟩ := h + rcases (abs_eq (by norm_num : (0:ℤ)≤1)).mp hi with hp|hn + · refine ⟨⟨2*i.val+2,by omega⟩,?_⟩ + rw [targetStep_negative] + funext k + by_cases hk : k=i + · subst k + simp only + have H : y i-x i=-1 := by omega + rw [H]; norm_num + · simp only [ite_eq_right hk,hr k hk,sub_self,Int.cast_zero] + · refine ⟨⟨2*i.val+1,by omega⟩,?_⟩ + rw [targetStep_positive] + funext k + by_cases hk : k=i + · subst k + simp only + have H : y i-x i=1 := by omega + rw [H]; norm_num + · simp only [ite_eq_right hk,hr k hk,sub_self,Int.cast_zero] + +theorem adjacent_routeCellPeriod {K : ℕ} [NeZero K] {L : Length} + (hL : L.val=(K:ℝ)) {w v : DiscreteTorus K} (h : (torusNearestGraph K).Adj w v) : + ∃ j : Fin 7,projectPoint L (routeCellPeriod (siteIndex v) (siteIndex w) j)=0 := by + obtain ⟨_,x,y,hx,hy,hn⟩ := h + obtain ⟨j,hj⟩ := nearest_targetStep hn + refine ⟨j,?_⟩ + subst w v + have hx' := siteIndex_project_lift hL x + have hy' := siteIndex_project_lift hL y + ext k + change (((anchorPoint (siteIndex (torusProjection K y)) k- + (anchorPoint (siteIndex (torusProjection K x)) k+targetStep j k)):ℝ):AddCircle L.val)=0 + rw [AddCircle.coe_sub,AddCircle.coe_add,show targetStep j k=((y k-x k:ℤ):ℝ) from congrFun hj k] + have HX := congrFun hx' k + have HY := congrFun hy' k + change ((anchorPoint (siteIndex (torusProjection K x)) k:ℝ):AddCircle L.val)=((x k:ℝ):AddCircle L.val) at HX + change ((anchorPoint (siteIndex (torusProjection K y)) k:ℝ):AddCircle L.val)=((y k:ℝ):AddCircle L.val) at HY + rw [HX,HY,Int.cast_sub,AddCircle.coe_sub] + abel + +lemma self_routeCellPeriod {K : ℕ} {L : Length} (v : Fin 3→Fin K) : + projectPoint L (routeCellPeriod v v 0)=0 := by + simp only [routeCellPeriod,targetStep,Fin.val_zero,↓reduceIte,add_zero,sub_self] + rfl + +end HardSphere.Groups +end +end + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital HardSphere.Lattice + +lemma nearest_project_distance {L : Length} {x y : Vertex} (h : nearestStep x y) : + torusDistance L (projectPoint L (fun k ↦ (x k:ℝ))) + (projectPoint L (fun k ↦ (y k:ℝ)))≤1 := by + obtain ⟨j,hj,hh⟩ := h + have hc (i : Fin 3) : dist (((x i:ℝ):AddCircle L.val)) ((y i:ℝ):AddCircle L.val)≤ + if i=j then (1:ℝ) else 0 := by + rw [dist_eq_norm,←AddCircle.coe_sub] + refine (QuotientAddGroup.norm_mk_le_norm (m:=(x i:ℝ)-(y i:ℝ))).trans ?_ + rw [Real.norm_eq_abs] + by_cases hi : i=j + · subst i + simp only + exact_mod_cast le_of_eq hj + · simp only [ite_eq_right hi,hh i hi,sub_self,abs_zero,le_refl] + unfold torusDistance + apply (Real.sqrt_le_iff).mpr + refine ⟨by norm_num,?_⟩ + calc + _ ≤ ∑ i : Fin 3,(if i=j then (1:ℝ) else 0)^2 := Finset.sum_le_sum fun i _ ↦ + (sq_le_sq₀ dist_nonneg (by split_ifs <;> norm_num)).mpr (hc i) + _ = 1^2 := by simp + +lemma adjacent_center_distance {K : ℕ} [NeZero K] {L : Length} + (hL : L.val=(K:ℝ)) {x y : DiscreteTorus K} (h : (torusNearestGraph K).Adj x y) : + torusDistance L (gridCenter L (siteIndex x)) (gridCenter L (siteIndex y))≤1 := by + obtain ⟨_,v,w,hv,hw,hn⟩ := h + subst x y + change torusDistance L (projectPoint L (anchorPoint (siteIndex (torusProjection K v)))) + (projectPoint L (anchorPoint (siteIndex (torusProjection K w))))≤1 + rw [siteIndex_project_lift hL,siteIndex_project_lift hL] + exact nearest_project_distance hn + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/PhysicalRouteMass.lean b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalRouteMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..80884c837ba375940e7d31d45aabaf8b1819ab82 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/PhysicalRouteMass.lean @@ -0,0 +1,157 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.RouteInsertion +import OAI.Analysis.HardSphere.Bridges.RouteMass +import OAI.Analysis.HardSphere.Allocation.RouteCenters +import OAI.Analysis.HardSphere.Allocation.PhysicalLikelihood +import OAI.Analysis.HardSphere.Collisions.PhysicalCollisionReference + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital +attribute [local instance] Classical.propDecidable +variable {J : Type*} [Fintype J] [DecidableEq J] + +omit [Fintype J] [DecidableEq J] in +lemma physical_owner_centers {N K M G n : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (particle : J→Fin N) (labels : Fin (n+1)↪J) (v : Fin (n+2)→(Fin 3→Fin K)) + (d : PhysicalDatum N K M G L) + (hhome : ∀k,datumHome hL d (particle (labels k))=v k.castSucc) + (hneigh : ∀k : Fin (n+1),torusDistance L (gridCenter L (v k.castSucc)) (gridCenter L (v k.succ))≤1) : + ∀b j,torusDistance L (projectPoint L (anchorPoint (datumHome hL d (particle j)))) + (gridCenter L (slotCenter (fun j ↦ datumHome hL d (particle j)) (v (Fin.last (n+1))) + (routeOwner (routePermutation labels) some b j)))≤1 := by + intro b j + cases b + · change torusDistance L (gridCenter L (datumHome hL d (particle j))) + (gridCenter L (datumHome hL d (particle j)))≤1 + simp [torusDistance] + · exact (route_two_center_bounds (fun j ↦ datumHome hL d (particle j)) labels v hhome hneigh).1 j + +omit [Fintype J] [DecidableEq J] in +lemma physical_reverse_owner_centers {N K M G n : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (particle : J→Fin N) (labels : Fin (n+1)↪J) (v : Fin (n+2)→(Fin 3→Fin K)) + (d : PhysicalDatum N K M G L) + (hhome : ∀k,datumHome hL d (particle (labels k))=v k.castSucc) + (hneigh : ∀k : Fin (n+1),torusDistance L (gridCenter L (v k.castSucc)) (gridCenter L (v k.succ))≤1) : + ∀b j,torusDistance L (projectPoint L (anchorPoint (datumHome hL d (particle j)))) + (gridCenter L (slotCenter (fun j ↦ datumHome hL d (particle j)) (v 0) + (routeOwner (routePermutation labels).symm some b j)))≤1 := by + intro b j + cases b + · change torusDistance L (gridCenter L (datumHome hL d (particle j))) + (gridCenter L (datumHome hL d (particle j)))≤1 + simp [torusDistance] + · exact (route_two_center_bounds (fun j ↦ datumHome hL d (particle j)) labels v hhome hneigh).2 j + +lemma physical_forward_insertion {N K M G n : ℕ} [NeZero K] {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) + (particle : J↪Fin N) (labels : Fin (n+1)↪J) (v : Fin (n+2)→(Fin 3→Fin K)) + (d : PhysicalDatum N K M G L) + (hhome : ∀k,datumHome hL d (particle (labels k))=v k.castSucc) + (hneigh : ∀k : Fin (n+1),torusDistance L (gridCenter L (v k.castSucc)) (gridCenter L (v k.succ))≤1) + (hm : ∀w,(Finset.univ.filter (fun j ↦ datumHome hL d (particle j)=w)).card≤M) + (ν : ∀i,Measure (physicalSlotAllowed hL g m r R C S u particle d i × + physicalSlotAllowed hL g m r R C S u particle d ((routePermutation labels).symm i))) + [∀i,IsProbabilityMeasure (ν i)] (q a : ℝ≥0∞) + (hd : ∀b j,routeOwner (routePermutation labels) some b j∈routeSlots labels→ + (ν (routeOwner (routePermutation labels) some b j)).map + (routePath (X:=fun i ↦ physicalSlotAllowed hL g m r R C S u particle d i) (routePermutation labels) (routeSlots labels) (routePermutation_fixed labels) + (fun j ↦ physicalSlotAllowed hL g m r R C S u particle d (some j)) some (fun _ f ↦ f) b j)≤ + routeDensityBound t • physicalCollisionReference hL g m t r R C S u particle d j) + (hq : ∀ j k, j ≠ k → ∀f : physicalSlotAllowed hL g m r R C S u particle d (some k), + physicalCollisionReference hL g m t r R C S u particle d j + {p | TrialCollision r (projectCurve L f.val) p.val}≤q) + (hsmall : a+(4*(49^3*(M+1)):ℕ)*(routeDensityBound t*q)≤1) : + UniformInsertionOn (routeChecks (X:=fun i ↦ physicalSlotAllowed hL g m r R C S u particle d i) (routePermutation labels) (routeSlots labels) (routePermutation_fixed labels) + r (fun j ↦ projectPoint L (anchorPoint (datumHome hL d (particle j)))) + (fun j ↦ physicalSlotAllowed hL g m r R C S u particle d (some j)) some (fun _ f ↦ f) (fun _ ↦ measurable_id)) + ν a (routeSlots labels) := by + exact route_insertion (X:=fun i ↦ physicalSlotAllowed hL g m r R C S u particle d i) hL r _ (slotCenter (fun j ↦ datumHome hL d (particle j)) (v (Fin.last (n+1)))) (M+1) + (slotCenter_fiber _ _ M hm) _ some (Option.some_injective _) (fun _ f ↦ f) (fun _ ↦ measurable_id) + _ _ (routePermutation_fixed labels) (physical_owner_centers hL particle labels v d hhome hneigh) ν + (physicalCollisionReference hL g m t r R C S u particle d) (routeDensityBound t) q a hd hq hsmall + +lemma physicalSharedOn_mass_of {N K M G n : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) + (particle : J↪Fin N) (labels : Fin (n+1)↪J) (v : Fin (n+2)→(Fin 3→Fin K)) + (steps : Fin (n+1)→Fin 7) (d : PhysicalDatum N K M G L) + (hp : ∀j,IsProbabilityMeasure (datumIndividualReference hL g m r R C S t u (particle j) d)) + (ν : ∀i,Measure (physicalSlotAllowed hL g m r R C S u particle d i × + physicalSlotAllowed hL g m r R C S u particle d ((routePermutation labels).symm i))) + [∀i,IsProbabilityMeasure (ν i)] + (he : ∀i:routeSlots labels,ν i=physicalSelectedOn hL g m t r R C S u particle labels v steps d i) + (a : ℝ≥0∞) (ha : 0 simp <;> fun_prop + have hd : ∀ᵐd ∂μ.restrict E,∀ᵐc ∂(ν.prod (physicalLabels hL g m t r R C S u particle)) d, + physicalRouteView hL g m t r R C S u particle hxy b (d,c)= + (physicalPrimaryReference hL g m t r R C S u particle (siteIndex (if b then y else x)) d).withDensity + (physicalRouteLikelihood hL g m t r R C S u particle hxy b (d,c)) := by + filter_upwards [hdata] with d hd + rw [Kernel.prod_apply] + apply (Measure.ae_prod_iff_ae_ae (Set.to_countable _).measurableSet).mpr + filter_upwards [hd.1] with p hp + filter_upwards [physicalLabels_supported hL g m t r R C S u particle d] with z hz + simpa only [physicalRouteView,Kernel.map_apply _ hb,physicalRouteFamily,Kernel.coe_mk] using + (physicalCoded_density hL g m t r R C S ht hr u particle d hxy p z hz hp hd.2 b).symm + constructor + · exact conditionalTagged_density μ _ _ _ _ (measurable_of_countable _) _ + (physicalRouteLikelihood_measurable hL g m t r R C S u particle hxy b) E hE hd + · apply conditionalTagged_support μ _ _ _ (measurable_of_countable _) E _ + (physicalTagEvent_measurable particle (siteIndex (if b then x else y))) + filter_upwards [hdata] with d hd + rw [Kernel.prod_apply] + apply (Measure.ae_prod_iff_ae_ae (Set.to_countable _).measurableSet).mpr + filter_upwards [hd.1] with p hp + filter_upwards [physicalLabels_supported hL g m t r R C S u particle d] with z hz + simp only [physicalRouteView,Kernel.map_apply _ hb,physicalRouteFamily,Kernel.coe_mk] + rw [ae_map_iff hb.aemeasurable ((physicalTagEvent_measurable particle _ _).preimage measurable_prodMk_left)] + have H := physicalCodedRoute_tag_support hL g m t r R C S ht hr u particle d hxy p z hz hp hd.2 b + cases b <;> simpa using H + +end HardSphere.Groups +end +end + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital _root_.OAI.HardSphere.Lattice +attribute [local instance] Classical.propDecidable +variable {K : ℕ} [NeZero K] {x y : DiscreteTorus K} +variable {J : Type*} [Fintype J] [DecidableEq J] [MeasurableSpace J] [MeasurableSingletonClass J] + +def physicalTaggedReference {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin (N+1)) + (b : Bool) (μ : Measure (PhysicalDatum (N+1) K M G L)) := + taggedReference (μ.compProd (physicalPrimaryReference hL g m t r R C S u particle + (siteIndex (if b then y else x)))) (physicalTagEvent particle (siteIndex (if b then x else y))) + +theorem physicalTagged_observed_moment {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0 simp only [Bool.false_eq_true,ite_false,ite_true]; exact measurable_snd; exact measurable_fst) _ (measurable_of_countable _) _] + cases b <;> rfl + +omit [MeasurableSpace J] [MeasurableSingletonClass J] in +theorem physicalTaggedMixture_same {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0 linarith [hj.1,hj.2] + +def targetStep (j : Fin 7) : Point := + if j.val=0 then 0 else fun k ↦ + if k.val=(j.val-1)/2 then (if (j.val-1)%2=0 then 1 else -1) else 0 + +lemma targetStep_radius (j : Fin 7) : ‖targetStep j‖≤1 := by + apply (pi_norm_le_iff_of_nonneg (by norm_num : (0:ℝ)≤1)).mpr + intro k + unfold targetStep + change |(if j.val=0 then (0:Point) else fun k ↦ + if k.val=(j.val-1)/2 then (if (j.val-1)%2=0 then 1 else -1) else 0) k|≤1 + split_ifs <;> norm_num + all_goals split_ifs <;> norm_num + +lemma targetCell_radius (c : Point) (j : Fin 7) (u : Point) + (hu : u∈unitTarget (c+targetStep j)) : ‖u-c‖≤3 := by + have H := norm_add_le (u-(c+targetStep j)) (targetStep j) + have he : u-(c+targetStep j)+targetStep j = u-c := by abel + rw [he] at H + linarith [unitTarget_radius (c+targetStep j) u hu,targetStep_radius j] + +def datumSuccess {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (g : Fin G) + (m : ℕ) (t r R C S : ℝ) (u : Time) (i : Fin N) : + PhysicalDatum N K M G L × Point → ℝ≥0∞ := fun p ↦ + trialKernel t (datumStart hL p.1 i) (datumEnd hL p.1 i) p.2 + (Prod.mk p.1 ⁻¹' datumPermitted hL g m r R C S u i) + +lemma datumSuccess_measurable {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (g : Fin G) + (m : ℕ) (t r R C S : ℝ) (u : Time) (i : Fin N) : + Measurable (datumSuccess (M:=M) hL g m t r R C S u i) := by + let κ := parameterTrialKernel t (fun d : PhysicalDatum N K M G L ↦ datumStart hL d i) + (fun d ↦ datumEnd hL d i) (datumStart_measurable hL i) (datumEnd_measurable hL i) + have h := Kernel.measurable_kernel_prodMk_left (κ:=κ) + (exposedSuccess_measurable (datumPermitted_measurable (M:=M) hL g m r R C S u i)) + convert h using 1 + funext p + obtain ⟨d,U⟩ := p + simp only [κ,datumSuccess,parameterTrialKernel_apply] + rfl + +def datumTarget {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (g : Fin G) + (m : ℕ) (t r R C S : ℝ) (u : Time) (i : Fin N) (j : Fin 7) : + Set (PhysicalDatum N K M G L × Point) := + {p | p.2∈unitTarget (anchorPoint (datumHome hL p.1 i)+targetStep j) ∧ + ENNReal.ofReal (9/10:ℝ)≤datumSuccess hL g m t r R C S u i p} + +lemma datumTarget_measurable {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (g : Fin G) + (m : ℕ) (t r R C S : ℝ) (u : Time) (i : Fin N) (j : Fin 7) : + MeasurableSet (datumTarget (M:=M) hL g m t r R C S u i j) := by + simp only [datumTarget,Set.ofPred_and] + apply MeasurableSet.inter + · have he : {p : PhysicalDatum N K M G L × Point | + p.2∈unitTarget (anchorPoint (datumHome hL p.1 i)+targetStep j)} = + ⋂k : Fin 3, {p | anchorPoint (datumHome hL p.1 i) k+targetStep j k-1/2≤p.2 k ∧ + p.2 k linarith + +lemma unitTarget_sub (v c U : Point) : U-c∈unitTarget v ↔ U∈unitTarget (v+c) := by + simp only [unitTarget,mem_pi,mem_univ,forall_const,mem_Ico,Pi.sub_apply,Pi.add_apply] + constructor <;> intro h j <;> specialize h j <;> constructor <;> linarith [h.1,h.2] + +def routeCellPeriod {K : ℕ} (v w : Fin 3→Fin K) (j : Fin 7) : Point := + anchorPoint v-(anchorPoint w+targetStep j) + +lemma routeCellPeriod_chart {K : ℕ} (v w : Fin 3→Fin K) (j : Fin 7) : + anchorPoint w+targetStep j+routeCellPeriod v w j=anchorPoint v := by + unfold routeCellPeriod + abel + +def vertexTarget {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (i i' : Fin N) + (v w : Fin 3→Fin K) (j : Fin 7) : Set (PhysicalDatum N K M G L×Point) := + (univ×ˢunitTarget (anchorPoint v))∩ + (datumTarget hL g m t r R C S u i 0 ∩ + (fun p ↦ (p.1,p.2-routeCellPeriod v w j)) ⁻¹' + datumTarget hL g m t r R C S u i' j) + +lemma vertexTarget_measurable {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (i i' : Fin N) + (v w : Fin 3→Fin K) (j : Fin 7) : + MeasurableSet (vertexTarget (M:=M) hL g m t r R C S u i i' v w j) := + (MeasurableSet.univ.prod (unitTarget_measurable _)).inter + ((datumTarget_measurable hL g m t r R C S u i 0).inter + ((datumTarget_measurable hL g m t r R C S u i' j).preimage + (measurable_fst.prodMk (measurable_snd.sub measurable_const)))) + +lemma vertexTarget_subset {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (i i' : Fin N) + (v w : Fin 3→Fin K) (j : Fin 7) (d : PhysicalDatum N K M G L) : + Prod.mk d ⁻¹' vertexTarget hL g m t r R C S u i i' v w j ⊆ unitTarget (anchorPoint v) := + fun _ h ↦ h.1.2 + +lemma vertexTarget_volume {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (i i' : Fin N) + (v w : Fin 3→Fin K) (j : Fin 7) (d : PhysicalDatum N K M G L) + (hv : datumHome hL d i=v) (hw : datumHome hL d i'=w) + (hi : datumAccessible hL g m t r R C S u i d) + (hi' : datumAccessible hL g m t r R C S u i' d) : + ENNReal.ofReal (49/50:ℝ)≤volume + (Prod.mk d ⁻¹' vertexTarget hL g m t r R C S u i i' v w j) := by + let B := unitTarget (anchorPoint v) + let A := Prod.mk d ⁻¹' datumTarget hL g m t r R C S u i 0 + let T := (fun U : Point ↦ U-routeCellPeriod v w j) ⁻¹' + (Prod.mk d ⁻¹' datumTarget hL g m t r R C S u i' j) + have hA : MeasurableSet A := (datumTarget_measurable hL g m t r R C S u i 0).preimage measurable_prodMk_left + have hT : MeasurableSet T := ((datumTarget_measurable hL g m t r R C S u i' j).preimage + measurable_prodMk_left).preimage (measurable_id.sub measurable_const) + have hAB : A⊆B := by + intro U hU + have h := hU.1 + simpa [hv,targetStep,B] using h + have hTB : T⊆B := by + intro U hU + have h := hU.1 + rw [hw,unitTarget_sub,routeCellPeriod_chart] at h + exact h + have htvol : volume T=volume (Prod.mk d ⁻¹' datumTarget hL g m t r R C S u i' j) := by + exact (measurePreserving_add_right volume (-routeCellPeriod v w j)).measure_preimage + ((datumTarget_measurable hL g m t r R C S u i' j).preimage measurable_prodMk_left).nullMeasurableSet + let : IsProbabilityMeasure (volume.restrict B) := ⟨by + rw [Measure.restrict_apply_univ,unitTarget_volume]⟩ + have ha : ENNReal.ofReal (99/100:ℝ)≤(volume.restrict B) A := by + rw [Measure.restrict_apply hA,inter_eq_left.mpr hAB] + exact hi 0 + have ht : ENNReal.ofReal (99/100:ℝ)≤(volume.restrict B) T := by + rw [Measure.restrict_apply hT,inter_eq_left.mpr hTB,htvol] + exact hi' j + have H := probability_inter_98 (volume.restrict B) hA hT ha ht + rw [Measure.restrict_apply (hA.inter hT)] at H + convert H using 1 + congr 1 + ext U + simp only [vertexTarget,mem_preimage,mem_inter_iff,mem_prod,mem_univ,true_and,A,T,B] + tauto + +def shiftedDatumPermitted {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (r R C S : ℝ) (u : Time) (i : Fin N) (c : Point) : + Set (PhysicalDatum N K M G L×C(Time,Point)) := + (fun p ↦ (p.1,Bridge.shiftPath (-c) p.2)) ⁻¹' datumPermitted hL g m r R C S u i + +lemma shiftedDatumPermitted_measurable {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (r R C S : ℝ) (u : Time) (i : Fin N) (c : Point) : + MeasurableSet (shiftedDatumPermitted (M:=M) hL g m r R C S u i c) := + (datumPermitted_measurable hL g m r R C S u i).preimage + (measurable_fst.prodMk ((Bridge.shiftPath_continuous (-c)).measurable.comp measurable_snd)) + +lemma shiftedDatumPermitted_equiv {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (r R C S : ℝ) (u : Time) (i : Fin N) (c : Point) + (d : PhysicalDatum N K M G L) (f : C(Time,Point)) : + (d,Bridge.shiftPath c f)∈shiftedDatumPermitted hL g m r R C S u i c ↔ + (d,f)∈datumPermitted hL g m r R C S u i := by + simp only [shiftedDatumPermitted,mem_preimage,Bridge.shiftPath_cancel] + +lemma datumSuccess_shift {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (i : Fin N) (c : Point) + (d : PhysicalDatum N K M G L) (U : Point) : + trialKernel t (datumStart hL d i+c) (datumEnd hL d i+c) U + (Prod.mk d ⁻¹' shiftedDatumPermitted hL g m r R C S u i c)= + datumSuccess hL g m t r R C S u i (d,U-c) := by + have H := trialKernel_shift t (datumStart hL d i) (datumEnd hL d i) (U-c) c + rw [sub_add_cancel] at H + rw [←H,Measure.map_apply (Bridge.shiftPath_continuous c).measurable + ((shiftedDatumPermitted_measurable hL g m r R C S u i c).preimage measurable_prodMk_left)] + congr 1 + ext f + exact shiftedDatumPermitted_equiv hL g m r R C S u i c d f + +def vertexPair {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (g : Fin G) + (m : ℕ) (t r R C S : ℝ) (u : Time) (i i' : Fin N) + (v w : Fin 3→Fin K) (j : Fin 7) : + Kernel (PhysicalDatum N K M G L) (C(Time,Point)×C(Time,Point)) := + exposedPeriodPair + (parameterTargetKernel (B:=unitTarget (anchorPoint v)) (by rw [unitTarget_volume]; exact ENNReal.one_ne_top) + (vertexTarget hL g m t r R C S u i i' v w j) + (vertexTarget_measurable hL g m t r R C S u i i' v w j)) t + (fun d ↦ datumStart hL d i) (fun d ↦ datumEnd hL d i) + (fun d ↦ datumStart hL d i') (fun d ↦ datumEnd hL d i') + (datumStart_measurable hL i) (datumEnd_measurable hL i) + (datumStart_measurable hL i') (datumEnd_measurable hL i') (routeCellPeriod v w j) + (datumPermitted hL g m r R C S u i) + (shiftedDatumPermitted hL g m r R C S u i' (routeCellPeriod v w j)) + (datumPermitted_measurable hL g m r R C S u i) + (shiftedDatumPermitted_measurable hL g m r R C S u i' (routeCellPeriod v w j)) + +instance vertexPair_finite {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (g : Fin G) + (m : ℕ) (t r R C S : ℝ) (u : Time) (i i' : Fin N) + (v w : Fin 3→Fin K) (j : Fin 7) : + IsFiniteKernel (vertexPair (M:=M) hL g m t r R C S u i i' v w j) := by + unfold vertexPair exposedPeriodPair exposedPairedTrialKernel parameterPairedKernel + infer_instance + +def vertexDensityBound (t : ℝ) : ℝ≥0∞ := + (ENNReal.ofReal (9/10:ℝ))⁻¹*((ENNReal.ofReal (49/50:ℝ))⁻¹*(midpointLower t 13)⁻¹) + +theorem vertexPair_physical {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0 + have hj : j=labels 0 := by + have hh' := congrArg (routePermutation labels) he + rw [Equiv.apply_symm_apply,routePermutation_star] at hh' + exact Option.some.inj hh' + rw [hj,hh 0] + change torusDistance L (gridCenter L (v 0)) (gridCenter L (v 0))≤1 + simp [torusDistance] + | some k => + have hek : routePermutation labels (some k)=some j := by + rw [←he,Equiv.apply_symm_apply] + have hk := hf k + rw [hek] at hk + change torusDistance L (gridCenter L (home j)) (gridCenter L (home k))≤1 + change torusDistance L (gridCenter L (home k)) (gridCenter L (home j))≤1 at hk + rw [torusDistance_comm] + exact hk + +lemma slotCenter_fiber {K : ℕ} (home : J→Fin 3→Fin K) (v : Fin 3→Fin K) + (M : ℕ) (hm : ∀w,(Finset.univ.filter (fun j ↦ home j=w)).card≤M) (w : Fin 3→Fin K) : + (Finset.univ.filter (fun i ↦ slotCenter home v i=w)).card≤M+1 := by + have hs : Finset.univ.filter (fun i ↦ slotCenter home v i=w) ⊆ + insert none ((Finset.univ.filter (fun j ↦ home j=w)).image some) := by + intro i hi + cases i with + | none => exact Finset.mem_insert_self _ _ + | some j => + exact Finset.mem_insert_of_mem (Finset.mem_image.mpr ⟨j,Finset.mem_filter.mpr + ⟨Finset.mem_univ _,(Finset.mem_filter.mp hi).2⟩,rfl⟩) + exact (Finset.card_le_card hs).trans ((Finset.card_insert_le _ _).trans + (Nat.add_le_add_right (Finset.card_image_le.trans (hm w)) 1)) + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/RouteFields.lean b/lean/OAI/Analysis/HardSphere/Allocation/RouteFields.lean new file mode 100644 index 0000000000000000000000000000000000000000..e728a163677567718a6f2fc6e6efa2d897b8b8c0 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/RouteFields.lean @@ -0,0 +1,175 @@ +import Mathlib +import OAI.Analysis.HardSphere.Allocation.PhysicalPairedRoute +import OAI.Analysis.HardSphere.Paths.SimpleRouteGeometry +import OAI.Analysis.HardSphere.Allocation.PhysicalLabelLaw + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital HardSphere.Lattice +attribute [local instance] Classical.propDecidable +variable {K : ℕ} [NeZero K] {x y : DiscreteTorus K} +variable {J : Type*} [Fintype J] [DecidableEq J] + +def RouteFieldValid (p : SimplePath x y) (z : DiscreteTorus K→Option J) : Prop := + ∃ f : Fin p.val.length↪J, ∀i,z (pathVertexEmbedding p i.castSucc)=some (f i) +def fieldLabels (p : SimplePath x y) (z : DiscreteTorus K→Option J) (h : RouteFieldValid p z) : Fin p.val.length↪J := h.choose +omit [NeZero K] [Fintype J] [DecidableEq J] in +lemma fieldLabels_spec (p : SimplePath x y) (z : DiscreteTorus K→Option J) (h : RouteFieldValid p z) : + ∀i,z (pathVertexEmbedding p i.castSucc)=some (fieldLabels p z h i) := h.choose_spec + +omit [DecidableEq J] in +lemma branchAccessible_home {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J→Fin N) + (v : DiscreteTorus K) (d : PhysicalDatum N K M G L) (j : J) + (hj : j∈branchAccessible hL g m t r R C S u particle v d) : + datumHome hL d (particle j)=siteIndex v ∧ datumAccessible hL g m t r R C S u (particle j) d := by + exact (Finset.mem_filter.mp (Finset.mem_filter.mp hj).2).2 + +lemma routeFieldValid_of_supported {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J→Fin N) + (d : PhysicalDatum N K M G L) (p : SimplePath x y) (z : DiscreteTorus K→Option J) + (hz : ∀v,z v∈paddedLabels (branchAccessible hL g m t r R C S u particle v d)) + (ha : ∀i : Fin p.val.length,(branchAccessible hL g m t r R C S u particle (pathVertexEmbedding p i.castSucc) d).Nonempty) : + RouteFieldValid p z := by + have he : ∀i : Fin p.val.length,∃j : J, + j∈branchAccessible hL g m t r R C S u particle (pathVertexEmbedding p i.castSucc) d ∧ + z (pathVertexEmbedding p i.castSucc)=some j := by + intro i + have hh := hz (pathVertexEmbedding p i.castSucc) + rw [paddedLabels,ite_eq_left (ha i)] at hh + obtain ⟨j,hj,he⟩ := Finset.mem_image.mp hh + exact ⟨j,hj,he.symm⟩ + choose f hf hfe using he + have hhome : ∀i,gridSite (datumHome hL d (particle (f i)))=pathVertexEmbedding p i.castSucc := by + intro i + rw [(branchAccessible_home hL g m t r R C S u particle _ d _ (hf i)).1] + exact indexSite_siteIndex _ + exact ⟨departureEmbedding p (fun j ↦ gridSite (datumHome hL d (particle j))) f hhome,hfe⟩ + +lemma fieldLabels_physical {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J→Fin N) + (d : PhysicalDatum N K M G L) (p : SimplePath x y) (z : DiscreteTorus K→Option J) + (hz : ∀v,z v∈paddedLabels (branchAccessible hL g m t r R C S u particle v d)) + (ha : ∀i : Fin p.val.length,(branchAccessible hL g m t r R C S u particle (pathVertexEmbedding p i.castSucc) d).Nonempty) + (h : RouteFieldValid p z) : + ∀i,datumHome hL d (particle (fieldLabels p z h i))=siteIndex (pathVertexEmbedding p i.castSucc) ∧ + datumAccessible hL g m t r R C S u (particle (fieldLabels p z h i)) d := by + intro i + apply branchAccessible_home hL g m t r R C S u particle _ d _ + have hh := hz (pathVertexEmbedding p i.castSucc) + rw [paddedLabels,ite_eq_left (ha i),fieldLabels_spec p z h] at hh + simpa using hh + +omit [NeZero K] in +lemma simpleRouteLength_eq (hxy : x≠y) (p : SimplePath x y) : p.val.length-1+1=p.val.length := by + have hp : p.val.length≠0 := fun h ↦ hxy (SimpleGraph.Walk.eq_of_length_eq_zero h) + omega + +def fieldRouteLabels (hxy : x≠y) (p : SimplePath x y) (z : DiscreteTorus K→Option J) + (h : RouteFieldValid p z) : Fin (p.val.length-1+1)↪J := + (finCongr (simpleRouteLength_eq hxy p)).toEmbedding.trans (fieldLabels p z h) + +lemma fieldRouteLabels_physical {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J→Fin N) + (d : PhysicalDatum N K M G L) (hxy : x≠y) (p : SimplePath x y) (z : DiscreteTorus K→Option J) + (hz : ∀v,z v∈paddedLabels (branchAccessible hL g m t r R C S u particle v d)) + (ha : ∀i : Fin p.val.length,(branchAccessible hL g m t r R C S u particle (pathVertexEmbedding p i.castSucc) d).Nonempty) + (h : RouteFieldValid p z) : + ∀i,datumHome hL d (particle (fieldRouteLabels hxy p z h i))= + simpleRouteVertices p (p.val.length-1) i.castSucc ∧ + datumAccessible hL g m t r R C S u (particle (fieldRouteLabels hxy p z h i)) d := by + intro i + exact fieldLabels_physical hL g m t r R C S u particle d p z hz ha h (Fin.cast (simpleRouteLength_eq hxy p) i) + +end HardSphere.Groups +end +end + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital HardSphere.Lattice +attribute [local instance] Classical.propDecidable +variable {K : ℕ} [NeZero K] {x y : DiscreteTorus K} +variable {J : Type*} [Fintype J] [DecidableEq J] + +abbrev PhysicalRouteCode (x y : DiscreteTorus K) (J : Type*) := + SimplePath x y × (DiscreteTorus K→Option J) + +def physicalCodedRoute {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (hxy : x≠y) (c : PhysicalRouteCode x y J) : + Kernel (PhysicalDatum N K M G L) ((Option J→C(Time,Point))×(Option J→C(Time,Point))) := + if h : RouteFieldValid c.1 c.2 then + physicalPairedRoute hL g m t r R C S u particle (fieldRouteLabels hxy c.1 c.2 h) + (simpleRouteVertices c.1 (c.1.val.length-1)) + (simpleRouteSteps hL c.1 (c.1.val.length-1) (simpleRouteLength_eq hxy c.1)) + else 0 + +lemma physicalCodedRoute_mass_le_one {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (hxy : x≠y) (c : PhysicalRouteCode x y J) (d : PhysicalDatum N K M G L) : + physicalCodedRoute hL g m t r R C S u particle hxy c d univ≤1 := by + unfold physicalCodedRoute + split + · exact physicalPairedRoute_mass_le_one .. + · change (0 : ℝ≥0∞)≤1 + exact bot_le +instance physicalCodedRoute_finite {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (hxy : x≠y) (c : PhysicalRouteCode x y J) : + IsFiniteKernel (physicalCodedRoute (M:=M) hL g m t r R C S u particle hxy c) := + ⟨1,by simp,physicalCodedRoute_mass_le_one hL g m t r R C S u particle hxy c⟩ + +def physicalRouteFamily {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (hxy : x≠y) : + Kernel (PhysicalDatum N K M G L × PhysicalRouteCode x y J) + ((Option J→C(Time,Point))×(Option J→C(Time,Point))) where + toFun z := physicalCodedRoute hL g m t r R C S u particle hxy z.2 z.1 + measurable' := measurable_from_prod_countable_left fun c ↦ + (physicalCodedRoute hL g m t r R C S u particle hxy c).measurable +instance physicalRouteFamily_finite {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (hxy : x≠y) : IsFiniteKernel (physicalRouteFamily (M:=M) hL g m t r R C S u particle hxy) := + ⟨1,by simp,fun z ↦ physicalCodedRoute_mass_le_one hL g m t r R C S u particle hxy z.2 z.1⟩ + +def physicalMixedRoutes {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (hxy : x≠y) (ν : Kernel (PhysicalDatum N K M G L) (SimplePath x y)) [IsMarkovKernel ν] : + Kernel (PhysicalDatum N K M G L) + (PhysicalRouteCode x y J × ((Option J→C(Time,Point))×(Option J→C(Time,Point)))) := + (ν.prod (physicalLabels hL g m t r R C S u particle)) ⊗ₖ + physicalRouteFamily hL g m t r R C S u particle hxy +instance physicalMixedRoutes_finite {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (hxy : x≠y) (ν : Kernel (PhysicalDatum N K M G L) (SimplePath x y)) [IsMarkovKernel ν] : + IsFiniteKernel (physicalMixedRoutes hL g m t r R C S u particle hxy ν) := by + unfold physicalMixedRoutes; infer_instance + +lemma physicalMixedRoutes_mass_le_one {N M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) (particle : J↪Fin N) + (hxy : x≠y) (ν : Kernel (PhysicalDatum N K M G L) (SimplePath x y)) [IsMarkovKernel ν] + (d : PhysicalDatum N K M G L) : + physicalMixedRoutes hL g m t r R C S u particle hxy ν d univ≤1 := by + rw [physicalMixedRoutes,Kernel.compProd_apply MeasurableSet.univ] + simp only [preimage_univ] + calc + _ ≤ ∫⁻_c,1 ∂(ν.prod (physicalLabels hL g m t r R C S u particle)) d := + lintegral_mono fun c ↦ physicalCodedRoute_mass_le_one hL g m t r R C S u particle hxy c d + _ = 1 := by simp + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/SeparatedPhysical.lean b/lean/OAI/Analysis/HardSphere/Allocation/SeparatedPhysical.lean new file mode 100644 index 0000000000000000000000000000000000000000..6912b0a450a3d3c49c2833de472d2e91d00c9d4f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/SeparatedPhysical.lean @@ -0,0 +1,85 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.PhysicalSparse +import OAI.Analysis.HardSphere.Geometry.FrozenChecks + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {I C : Type*} [Fintype I] [DecidableEq I] [Fintype C] + {X : I → Type*} [∀i,MeasurableSpace (X i)] + +omit [Fintype I] [Fintype C] in +lemma separated_of_no_crossing (checks : C → LocalCheck X) (s t : Finset I) + (h : ∀c,∀i∈(checks c).support,∀j∈(checks c).support,i∈s → j∈t → False) : + SeparatedChecks checks s t := by + intro c hc + by_cases hs : (checks c).support⊆s + · exact Or.inl hs + · right + obtain ⟨j,hj,hjs⟩ := Finset.not_subset.mp hs + have hjt := (Finset.mem_union.mp (hc hj)).resolve_left hjs + intro i hi + exact (Finset.mem_union.mp (hc hi)).resolve_left (fun his ↦ h c i hi j hj his hjt) + +omit [Fintype I] [Fintype C] in +lemma frozen_separated_of_no_crossing (checks : C → LocalCheck X) (U s t : Finset I) + (x : ∀i,X i) + (h : ∀c,∀i∈(checks c).support,∀j∈(checks c).support,i∈s → j∈t → False) : + SeparatedChecks (frozenChecks checks U x) s t := by + apply separated_of_no_crossing + intro c i hi j hj his hjt + exact h c.val i (Finset.mem_inter.mp hi).1 j (Finset.mem_inter.mp hj).1 his hjt +end HardSphere.Comparison +namespace HardSphere.Bridge +open Wiener GaussianPacking Comparison Groups CellOrbital +attribute [local instance] Classical.propDecidable +variable {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + {L : Length} {V : I → Type*} [∀i,MeasurableSpace (V i)] + +omit [Fintype I] [Fintype J] [DecidableEq J] in +lemma physical_support_near (r : ℝ) (anchor : J → Torus L) (center : I → Torus L) + (allowed : J → Set C(Time,Point)) (owner : Bool → J → I) + (hc : ∀b j,torusDistance L (anchor j) (center (owner b j))≤1) + (path : ∀b j,V (owner b j)→allowed j) (hm : ∀b j,Measurable (path b j)) + (e : physicalEdges anchor) (i j : I) + (hi : i∈(physicalSparseChecks r anchor allowed owner path hm e).support) + (hj : j∈(physicalSparseChecks r anchor allowed owner path hm e).support) : + torusDistance L (center i) (center j)≤23 := by + have hbound := incident_centers_close anchor (fun k ↦ center (owner e.1 k)) id + (hc e.1) e.2.val.1 e.2.val.2 e.2.property.2 + have hie : i=owner e.1 e.2.val.1 ∨ i=owner e.1 e.2.val.2 := by + simpa only [physicalSparseChecks,factorPathCheck,dependentCheck,Finset.mem_insert,Finset.mem_singleton] using hi + have hje : j=owner e.1 e.2.val.1 ∨ j=owner e.1 e.2.val.2 := by + simpa only [physicalSparseChecks,factorPathCheck,dependentCheck,Finset.mem_insert,Finset.mem_singleton] using hj + rcases hie with rfl|rfl <;> rcases hje with rfl|rfl + · simp [torusDistance] + · exact hbound + · simpa only [id_eq,torusDistance_comm L (center (owner e.1 e.2.val.2))] using hbound + · simp [torusDistance] + +omit [Fintype I] [Fintype J] [DecidableEq J] in +lemma physical_frozen_separated (r : ℝ) (anchor : J → Torus L) (center : I → Torus L) + (allowed : J → Set C(Time,Point)) (owner : Bool → J → I) + (hc : ∀b j,torusDistance L (anchor j) (center (owner b j))≤1) + (path : ∀b j,V (owner b j)→allowed j) (hm : ∀b j,Measurable (path b j)) + (U s t : Finset I) (x : ∀i,V i) + (hfar : ∀i∈s,∀j∈t,23 ∅ + | some f => Finset.univ.image (fun i ↦ f (groupSlot M G g i)) + +omit [Fintype I] in +lemma groupLabels_disjoint {M G : ℕ} (a : Allocation (M*G) I) + {g h : Fin G} (hgh : g≠h) : Disjoint (groupLabels a g) (groupLabels a h) := by + cases a with + | none => simp [groupLabels] + | some f => + apply Finset.disjoint_left.mpr + intro i hi hj + obtain ⟨j,_,rfl⟩ := Finset.mem_image.mp hi + obtain ⟨k,_,hk⟩ := Finset.mem_image.mp hj + exact groupSlot_ne hgh j k (f.injective hk.symm) + +def fieldGroup {M G : ℕ} (E : V→Finset I) (a : V→Allocation (M*G) I) + (g : Fin G) : Finset I := + Finset.univ.biUnion (fun v ↦ groupLabels (a v) g∩E v) + +omit [Fintype I] in +lemma fieldGroup_disjoint {M G : ℕ} (E : V→Finset I) + (hd : ∀v w,v≠w→Disjoint (E v) (E w)) (a : V→Allocation (M*G) I) + {g h : Fin G} (hgh : g≠h) : Disjoint (fieldGroup E a g) (fieldGroup E a h) := by + apply Finset.disjoint_left.mpr + intro i hi hj + obtain ⟨v,_,hv⟩ := Finset.mem_biUnion.mp hi + obtain ⟨w,_,hw⟩ := Finset.mem_biUnion.mp hj + obtain ⟨hvg,hvE⟩ := Finset.mem_inter.mp hv + obtain ⟨hwh,hwE⟩ := Finset.mem_inter.mp hw + by_cases hvw : v=w + · subst w + exact Finset.disjoint_left.mp (groupLabels_disjoint (a v) hgh) hvg hwh + · exact Finset.disjoint_left.mp (hd v w hvw) hvE hwE + +omit [DecidableEq V] in +lemma fieldGroup_measurable {M G : ℕ} (g : Fin G) : + Measurable (fun p : (V→Finset I)×(V→Allocation (M*G) I) ↦ fieldGroup p.1 p.2 g) := + measurable_of_countable _ + +omit [Fintype I] in +lemma groupLabels_subset_supported {M G : ℕ} (E : Finset I) + (a : Allocation (M*G) I) (ha : a∈(allocationPMF E (M*G)).support) (g : Fin G) : + groupLabels a g⊆E := by + cases a with + | none => simp [groupLabels] + | some f => + intro i hi + obtain ⟨j,_,rfl⟩ := Finset.mem_image.mp hi + exact allocationPMF_support E (M*G) (some f) ha f rfl _ + +omit [Fintype I] [DecidableEq V] in +lemma fieldGroup_eq_raw_supported {M G : ℕ} (E : V→Finset I) + (a : V→Allocation (M*G) I) (ha : ∀v,a v∈(allocationPMF (E v) (M*G)).support) + (g : Fin G) : + fieldGroup E a g=Finset.univ.biUnion (fun v ↦ groupLabels (a v) g) := by + unfold fieldGroup + congr 1 + funext v + exact Finset.inter_eq_left.mpr (groupLabels_subset_supported (E v) (a v) (ha v) g) + +omit [DecidableEq I] [DecidableEq V] in +lemma siteAllocation_supported (E : V→Finset I) (total : ℕ) : + siteAllocationKernel total E {a | ∀v,a v∈(allocationPMF (E v) total).support}=1 := by + change Measure.pi (fun v ↦ (allocationPMF (E v) total).toMeasure) _=1 + have he : {a : V→Allocation total I | ∀v,a v∈(allocationPMF (E v) total).support}= + Set.univ.pi (fun v ↦ (allocationPMF (E v) total).support) := by ext a; simp + rw [he,Measure.pi_pi] + apply Finset.prod_eq_one + intro v _ + exact (PMF.toMeasure_apply_eq_one_iff _ (MeasurableSet.of_discrete)).mpr (Subset.refl _) + +end HardSphere.Sampling + +namespace HardSphere.Groups +open Sampling Wiener PathCutoff Comparison + +def allocatedPhysicalGroup {N K M G : ℕ} {L : Length} (m : ℕ) + (r R C S s₀ : ℝ) (u : Time) (g : Fin G) + (p : ConfigurationPath N L×((Fin 3→Fin K)→Allocation (M*G) (Fin N))) : Finset (Fin N) := + fieldGroup (fun v ↦ eligibleList m r R C S s₀ u v p.1) p.2 g + +lemma allocatedPhysicalGroup_mem_measurable {N K M G : ℕ} {L : Length} (m : ℕ) + (r R C S s₀ : ℝ) (u : Time) (g : Fin G) (i : Fin N) : + MeasurableSet {p : ConfigurationPath N L×((Fin 3→Fin K)→Allocation (M*G) (Fin N)) | + i∈allocatedPhysicalGroup m r R C S s₀ u g p} := by + have he : {p : ConfigurationPath N L×((Fin 3→Fin K)→Allocation (M*G) (Fin N)) | + i∈allocatedPhysicalGroup m r R C S s₀ u g p}= + ⋃v : Fin 3→Fin K, {p | i∈groupLabels (p.2 v) g}∩ + {p | Eligible m r R C S s₀ u v i p.1} := by + ext p + simp [allocatedPhysicalGroup,fieldGroup,eligibleList] + rw [he] + apply MeasurableSet.iUnion + intro v + have ha : MeasurableSet {a : (Fin 3→Fin K)→Allocation (M*G) (Fin N) | i∈groupLabels (a v) g} := + MeasurableSet.of_discrete + exact (ha.preimage measurable_snd).inter ((eligible_measurable m r R C S s₀ u v i).preimage measurable_fst) + +lemma allocatedPhysicalGroup_disjoint {N K M G : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (m : ℕ) (r R C S s₀ : ℝ) (u : Time) + (p : ConfigurationPath N L×((Fin 3→Fin K)→Allocation (M*G) (Fin N))) + {g h : Fin G} (hgh : g≠h) : + Disjoint (allocatedPhysicalGroup m r R C S s₀ u g p) + (allocatedPhysicalGroup m r R C S s₀ u h p) := + fieldGroup_disjoint _ (fun _ _ hh ↦ eligibleList_disjoint hL hK m r R C S s₀ u p.1 hh) _ hgh + +lemma allocatedPhysicalTag_sum_le {N K M G : ℕ} {L : Length} + {Y : Type*} [MeasurableSpace Y] + (hL : L.val=(K:ℝ)) (hK : 1≤K) (m : ℕ) (r R C S s₀ : ℝ) (u : Time) + (μ : Measure (ConfigurationPath N L×((Fin 3→Fin K)→Allocation (M*G) (Fin N)))) + (κ : Fin N→Kernel (ConfigurationPath N L×((Fin 3→Fin K)→Allocation (M*G) (Fin N))) Y) : + (∑g,allocatedTagLaw μ (allocatedPhysicalGroup m r R C S s₀ u) κ g)≤∑i,κ i ∘ₘ μ := by + apply sum_allocatedTagLaw_le + · intro g i + exact allocatedPhysicalGroup_mem_measurable (N:=N) (K:=K) (M:=M) (L:=L) m r R C S s₀ u g i + · intro p g h hgh + exact allocatedPhysicalGroup_disjoint hL hK m r R C S s₀ u p hgh + +end HardSphere.Groups + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Allocation/TargetSupply.lean b/lean/OAI/Analysis/HardSphere/Allocation/TargetSupply.lean new file mode 100644 index 0000000000000000000000000000000000000000..17c639f9f8b7440d18e249ce2dd90167991c0e72 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Allocation/TargetSupply.lean @@ -0,0 +1,86 @@ +import Mathlib + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal BigOperators +namespace HardSphere.Comparison +variable {U X : Type*} [MeasurableSpace U] [MeasurableSpace X] + +lemma failure_large_of_success_small (P : Measure X) [IsProbabilityMeasure P] + (S : Set X) (hS : MeasurableSet S) {a b : ℝ≥0∞} (hab : a+b≤1) + (hsmall : P S.prodMk ((bridgeEnd_continuous N L t).measurable.comp measurable_fst))).inter + (((PathCutoff.regular_measurable m r R C u S).preimage (ownPath_measurable i t)).inter + ((confined_closed (gridCenter L v)).measurableSet.preimage (ownPath_measurable i t))) + +def eligibilityFlag {N K : ℕ} {L : Length} (m : ℕ) (r R C S s₀ t : ℝ) (u : Time) + (i : Fin N) (p : BridgeEndpoints N L×Bridge.Noise) : Bool := + decide (ownEligible (K:=K) m r R C S s₀ t u i p) + +lemma eligibilityFlag_measurable {N K : ℕ} {L : Length} (m : ℕ) (r R C S s₀ t : ℝ) (u : Time) + (i : Fin N) : Measurable (eligibilityFlag (K:=K) (L:=L) m r R C S s₀ t u i) := by + apply measurable_to_countable' + intro b + cases b + · change MeasurableSet {p | decide (ownEligible (K:=K) m r R C S s₀ t u i p)=false} + simpa only [decide_eq_false_iff_not,←Set.compl_ofPred] + using (ownEligible_measurable (K:=K) (L:=L) m r R C S s₀ t u i).compl + · change MeasurableSet {p | decide (ownEligible (K:=K) m r R C S s₀ t u i p)=true} + simpa only [decide_eq_true_eq] + using ownEligible_measurable (K:=K) (L:=L) m r R C S s₀ t u i + +lemma exposed_endpoints {N : ℕ} {L : Length} (t : ℝ) (e : BridgeEndpoints N L) : + ∀ᵐβ ∂(Measure.pi fun _ : Fin N ↦ Bridge.law), + labelBridgePath N L t (e,β) 0=e.2 ∧ + labelBridgePath N L t (e,β) 1=bridgeEnd N L t e := by + have he : ∀ᵐβ ∂(Measure.pi fun _ : Fin N ↦ Bridge.law),∀i : Fin N, + leg t (labelStartLift e i) (labelEndLift t e i) (β i) 0=labelStartLift e i ∧ + leg t (labelStartLift e i) (labelEndLift t e i) (β i) 1=labelEndLift t e i := + ae_all_iff.mpr (fun i ↦ (measurePreserving_eval (fun _ : Fin N ↦ Bridge.law) i).quasiMeasurePreserving.ae + (leg_endpoints_ae t _ _)) + filter_upwards [he] with β hβ + constructor + · ext i j + have hi := congrFun (congrFun (congrArg (fun ω : ConfigurationPath 1 L ↦ ω 0) (labelBridgePath_lift t e β i)) 0) j + change _=((leg t (labelStartLift e i) (labelEndLift t e i) (β i) 0) j : AddCircle L.val) at hi + rw [(hβ i).1] at hi + exact hi.trans (congrFun (congrFun (project_representative N L e.2) i) j) + · ext i j + have hi := congrFun (congrFun (congrArg (fun ω : ConfigurationPath 1 L ↦ ω 1) (labelBridgePath_lift t e β i)) 0) j + change _=((leg t (labelStartLift e i) (labelEndLift t e i) (β i) 1) j : AddCircle L.val) at hi + rw [(hβ i).2] at hi + exact hi.trans (by + change ((labelStartLift e i j+Real.sqrt (2*t)*e.1 (i,j):ℝ):AddCircle L.val)=_ + rw [QuotientAddGroup.mk_add] + have hp := congrFun (congrFun (project_representative N L e.2) i) j + change ((labelStartLift e i j:ℝ):AddCircle L.val)=e.2 i j at hp + rw [hp] + rfl) + +def recordedList {N K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (v : Fin 3→Fin K) + (p : BridgeEndpoints N L×(Fin N→Bool)) : Finset (Fin N) := + Finset.univ.filter (fun i ↦ gridHome hL (p.1.2 i)=v ∧ p.2 i=true) + +lemma recordedList_measurable {N K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (v : Fin 3→Fin K) : + Measurable (recordedList (N:=N) hL v) := by + apply measurable_to_countable' + intro a + have h : recordedList (N:=N) hL v ⁻¹' {a}= + ⋂i : Fin N,{p | (i∈a) ↔ gridHome hL (p.1.2 i)=v ∧ p.2 i=true} := by + ext p + simp only [Set.mem_preimage,Set.mem_singleton_iff,Set.mem_iInter,Set.mem_ofPred_eq] + constructor + · intro h i + rw [←h] + simp [recordedList] + · intro h + ext i + simpa only [recordedList,Finset.mem_filter,Finset.mem_univ,true_and] using (h i).symm + rw [h] + apply MeasurableSet.iInter + intro i + have hm : MeasurableSet {p : BridgeEndpoints N L×(Fin N→Bool) | + gridHome hL (p.1.2 i)=v ∧ p.2 i=true} := + (measurableSet_eq_fun ((gridHome_measurable hL).comp (by fun_prop)) measurable_const).inter + (measurableSet_eq_fun (by fun_prop) measurable_const) + by_cases hi : i∈a + · simpa only [hi,true_iff] using hm + · simpa only [hi,false_iff,←Set.compl_ofPred] using hm.compl + +lemma recordedList_eq {N K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (hK : 1≤K) + (m : ℕ) (r R C S s₀ t : ℝ) (u : Time) (v : Fin 3→Fin K) (e : BridgeEndpoints N L) + (β : Fin N→Bridge.Noise) (h0 : labelBridgePath N L t (e,β) 0=e.2) + (h1 : labelBridgePath N L t (e,β) 1=bridgeEnd N L t e) : + recordedList hL v (e,fun i ↦ eligibilityFlag (K:=K) m r R C S s₀ t u i (e,β i))= + eligibleList m r R C S s₀ u v (labelBridgePath N L t (e,β)) := by + ext i + simp only [recordedList,eligibleList,Finset.mem_filter,Finset.mem_univ,true_and, + eligibilityFlag,decide_eq_true_eq,ownEligible,Eligible,h0,h1,ownPath_eq] + constructor + · rintro ⟨hi,w,hw,hr,hc⟩ + have hw' : gridHome hL (e.2 i)=w := (gridHome_eq_iff hL hK _ _).mpr hw.1 + have hvw : w=v := hw'.symm.trans hi + rw [hvw] at hw hc + exact ⟨hw,hr,hc⟩ + · intro hv + exact ⟨(gridHome_eq_iff hL hK _ _).mpr hv.1.1,v,hv⟩ + +end HardSphere.Groups + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/AccessibleAuxiliary.lean b/lean/OAI/Analysis/HardSphere/Bridges/AccessibleAuxiliary.lean new file mode 100644 index 0000000000000000000000000000000000000000..beb3da47df70bbf497f7c5947fd710b29fc52753 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/AccessibleAuxiliary.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.ExposedReference +import OAI.Analysis.HardSphere.Comparison.ParameterTarget + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology +namespace HardSphere.Bridge +open Wiener GaussianPacking Comparison +variable {E : Type*} [MeasurableSpace E] + [MeasurableSpace.CountableOrCountablyGenerated E C(Time,Point)] + +lemma accessible_physical_auxiliary + {t C : ℝ} (ht : 0 simp [rebuildPrimary,Function.updateFinset,hi] + +variable {J : Type*} [Fintype J] [DecidableEq J] + +lemma actual_two_primary_laws {L : Length} + (σ : Equiv.Perm I) (s : Finset I) (hf : ∀i,i∉s→σ i=i) + (r : ℝ) (anchor : J→Torus L) (allowed : J→Set C(Time,Point)) + (label : J→I) (get : ∀j,X (label j)→allowed j) (hg : ∀j,Measurable (get j)) + (star : I) (hstar : ∀j,label j≠star) (hs : star∈s) + (μ ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (μ i)] [∀i,IsProbabilityMeasure (ν i)] + (heq : ∀i,i≠star→μ i=ν i) + (κ : ∀i,Kernel (X i) (X (σ.symm i))) [∀i,IsFiniteKernel (κ i)] + (η : ∀i,Kernel (X i) (X (σ i))) [∀i,IsFiniteKernel (η i)] + (he : ∀j:s,((μ (σ j)).compProd (κ (σ j))).map (reverseFactor (X:=X) σ j)= + (ν j).compProd (η j)) + (z : ∀i,X (σ.symm i)) (w : ∀i,X (σ i)) : + let R := primaryChecks r anchor allowed label get hg + let C := routeChecks σ s hf r anchor allowed label get hg + let C' := routeChecks σ.symm s (reverse_fix σ s hf) r anchor allowed label get hg + let P := conditionedMeasure (Measure.pi μ) (retainedEvent R Finset.univ) + let Q := conditionedMeasure (Measure.pi ν) (retainedEvent R Finset.univ) + let T := P.compProd (proposalKernel C μ κ s (Finset.univ\s) z) + T.map (fun p ↦ Function.updateFinset p.1 s (fun i ↦ (p.2 i).1))= + P.withDensity (fun x ↦ conditionalLikelihood R C μ κ s (Finset.univ\s) x z) ∧ + T.map (fun p ↦ Function.updateFinset p.1 s (fun i ↦ (reverseSelected σ s hf p.2 i).1))= + Q.withDensity (fun x ↦ conditionalLikelihood R C' ν η s (Finset.univ\s) x w) := by + dsimp only + refine ⟨full_primary_law _ _ μ κ s z (fun y u ↦ routeChecks_primary_weight σ s hf r anchor allowed label get hg Finset.univ (fun i ↦ (y i,u i))),?_⟩ + have h := congrArg (fun M ↦ M.map (rebuildPrimary (X:=X) (Y:=fun i ↦ X (σ i)) s)) + (actual_reverse_trimmed σ s hf r anchor allowed label get hg star hstar hs μ ν heq μ ν κ η he z w) + rw [Measure.map_map (rebuildPrimary_measurable s) (show Measurable (fun p : (∀i,X i)×(∀i:s,X i×X (σ.symm i)) ↦ ((fun i:{i // i∉s} ↦ p.1 i), reverseSelected σ s hf p.2)) from + (Measurable.of_eval (fun i ↦ (measurable_pi_apply i.val).comp measurable_fst)).prodMk ((reverseSelected σ s hf).measurable.comp measurable_snd)), + Measure.map_map (rebuildPrimary_measurable s) (show Measurable (fun p : (∀i,X i)×(∀i:s,X i×X (σ i)) ↦ ((fun i:{i // i∉s} ↦ p.1 i), p.2)) from by fun_prop)] at h + simp only [Function.comp_def,rebuildPrimary_trim] at h + rw [h] + exact full_primary_law _ _ ν η s w + (fun y u ↦ routeChecks_primary_weight σ.symm s (reverse_fix σ s hf) r anchor allowed label get hg Finset.univ (fun i ↦ (y i,u i))) + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/AffineVolume.lean b/lean/OAI/Analysis/HardSphere/Bridges/AffineVolume.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad6aa18e5e39f4dac9c70b7319c6cbc9c1b57a39 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/AffineVolume.lean @@ -0,0 +1,140 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.IncrementMoment + +namespace OAI + +noncomputable section +open MeasureTheory MeasureTheory.Measure Set Filter ProbabilityTheory +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.GaussianPacking + +def affine (s : ℝ) (c : Point) (x : Point) : Point := fun j ↦ s*x j+c j +lemma affine_measurable (s : ℝ) (c : Point) : Measurable (affine s c) := by unfold affine; fun_prop +lemma affine_volume {s : ℝ} (hs : 0.const_mul s).add + ((measurable_pi_apply coordinate).comp (hc.comp measurable_fst)) + apply Measure.le_iff.mpr + intro E hE + rw [Measure.map_apply hm hE,Measure.prod_apply (hE.preimage hm),Measure.prod_apply hE] + apply lintegral_mono + intro ω + have hsec : MeasurableSet {x : Point | (ω,x)∈E} := hE.preimage measurable_prodMk_left + change ((volume : Measure Point).restrict B) ((affine s (c ω))⁻¹' {x | (ω,x)∈E}) ≤ _ + rw [←Measure.map_apply (affine_measurable s (c ω)) hsec] + exact affine_restrict_le B hs (c ω) _ + +end HardSphere.GaussianPacking + +namespace HardSphere.Bridge +open Wiener GaussianPacking + +lemma leg_segment_increment (t : ℝ) (y v : Point) (β : Noise) (s q : Time) (j : Fin 3) : + leg t y v β (suffixTime s q) j=leg t y v β s j+ + ((1-(s:ℝ))*(q:ℝ))*(v j-y j)+Real.sqrt (2*t)*(β j (suffixTime s q)-β j s) := by + simp only [leg,ContinuousMap.coe_mk,mean] + dsimp [suffixTime] + ring + +def uniformSegmentHit (t : ℝ) (y : Point) (s w : Time) (c : Time → Point) (r : ℝ) (B : Set Point) : Set (Noise×Point) := + {p | p.2∈B ∧ ∃q : Time,(q:ℝ) ≤ (w:ℝ) ∧ ‖leg t y p.2 p.1 (suffixTime s q)-c q‖ ≤ r} + +lemma uniform_segment_necessary {t r C A : ℝ} (hr : 0.const_mul r)) (hm j)).mem).and + (Measurable.forall fun j ↦ (measurableSet_le (hm j) (measurable_const.add + ((hR.comp measurable_fst).const_add A |>.const_mul r))).mem) + +theorem collision_volume_bound {Ω : Type*} [MeasurableSpace Ω] + (ν : Measure Ω) [IsProbabilityMeasure ν] (μ : Measure Point) [SFinite μ] + {R : Ω → ℝ} (hR : Measurable R) (hR0 : ∀ω,0≤R ω) (hR3 : MemLp R 3 ν) + (c : Point) {r A C : ℝ} (hr : 0≤r) (hA : 0≤A) (hC : 0≤C) + (hμ : μ ≤ ENNReal.ofReal C • (volume : Measure Point)) : + (ν.prod μ) {p : Ω×Point | p.2∈cube c (r*(A+R p.1))} ≤ + ENNReal.ofReal (8*C*r^3*(∫ω,(A+R ω)^3 ∂ν)) := by + have hInt : Integrable (fun ω ↦ (A+R ω)^3) ν := by + have h := ((memLp_const A).add hR3).integrable_norm_pow (by norm_num : (3:ℕ)≠0) + simpa only [Pi.add_apply,Real.norm_eq_abs,abs_of_nonneg (add_nonneg hA (hR0 _))] using h + rw [Measure.prod_apply (measurable_cube_event hR c r A)] + calc + _ ≤ ∫⁻ω,ENNReal.ofReal C*(volume : Measure Point) (cube c (r*(A+R ω))) ∂ν := by + apply lintegral_mono + intro ω + exact hμ (cube c (r*(A+R ω))) + _ = ∫⁻ω,ENNReal.ofReal (8*C*r^3*(A+R ω)^3) ∂ν := by + apply lintegral_congr + intro ω + have hp : 0≤R ω := hR0 ω + rw [cube_volume c (by positivity),←ENNReal.ofReal_mul hC] + congr 1 + ring + _ = _ := by + rw [←ofReal_integral_eq_lintegral_ofReal (hInt.const_mul _) + (Eventually.of_forall fun ω ↦ by have hp:=hR0 ω; positivity),integral_const_mul] + +theorem collision_cubic_bound {Ω : Type*} [MeasurableSpace Ω] + (ν : Measure Ω) [IsProbabilityMeasure ν] (μ : Measure Point) [SFinite μ] + {R : Ω → ℝ} (hR : Measurable R) (hR0 : ∀ω,0≤R ω) (hR3 : MemLp R 3 ν) + (c : Point) {r A C : ℝ} (hr : 0≤r) (hA : 0≤A) (hC : 0≤C) + (hμ : μ ≤ ENNReal.ofReal C • (volume : Measure Point)) : + (ν.prod μ) {p : Ω×Point | p.2∈cube c (r*(A+R p.1))} ≤ + ENNReal.ofReal (32*C*r^3*(A^3+∫ω,(R ω)^3 ∂ν)) := by + apply (collision_volume_bound ν μ hR hR0 hR3 c hr hA hC hμ).trans + apply ENNReal.ofReal_le_ofReal + have hInt0 : Integrable (fun ω ↦ (R ω)^3) ν := by + simpa only [Real.norm_eq_abs,abs_of_nonneg (hR0 _)] using hR3.integrable_norm_pow (by norm_num : (3:ℕ)≠0) + have hInt : Integrable (fun ω ↦ (A+R ω)^3) ν := by + simpa only [Pi.add_apply,Real.norm_eq_abs,abs_of_nonneg (add_nonneg hA (hR0 _))] using + ((memLp_const A).add hR3).integrable_norm_pow (by norm_num : (3:ℕ)≠0) + have hi : (∫ω,(A+R ω)^3 ∂ν) ≤ 4*(A^3+∫ω,R ω^3 ∂ν) := by + have h := integral_mono hInt (((integrable_const (A^3)).add hInt0).const_mul 4) + (fun ω ↦ Wiener.cube_add_le hA (hR0 ω)) + simpa only [Pi.add_apply,integral_const_mul,integral_add (integrable_const (A^3)) hInt0, + integral_const,Measure.real,measure_univ,ENNReal.toReal_one,one_smul] using h + nlinarith [mul_le_mul_of_nonneg_left hi (show 0≤8*C*r^3 by positivity)] + +end HardSphere.GaussianPacking + +end +end + +section +noncomputable section +open MeasureTheory MeasureTheory.Measure Set Filter ProbabilityTheory +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Bridge +open Wiener GaussianPacking + +lemma leg_segment (t : ℝ) (y v : Point) (β : Noise) (s q : Time) (j : Fin 3) : + leg t y v β (suffixTime s q) j=leg t y v β s j+ + (q:ℝ)*(v j-leg t y v β s j)+Real.sqrt (2*t)*remainder s β j q := by + simp only [leg,ContinuousMap.coe_mk,mean,remainder,bridgeRemainder_apply] + dsimp [suffixTime] + ring + +def segmentHit (t : ℝ) (y v : Point) (s w : Time) (c : Time → Point) (r C : ℝ) : Set Noise := + {β | ‖leg t y v β s-v‖≤C ∧ ∃q : Time,(q:ℝ)≤(w:ℝ) ∧ ‖leg t y v β (suffixTime s q)-c q‖≤r} + +lemma segment_necessary {t r C A : ℝ} (hr : 0 ev (some j) + | .inr s => ev (some j) - (1-(s:ℝ)) • ev none) + convert! (finite_bridge_gaussian loc).map_fun L using 1 + funext ω j + cases hj : j.val <;> simp [L,loc,ev,hj] + +lemma bridgeRemainder_independent (u : Time) : + IndepFun (fun ω ↦ bridge ω u) (fun ω ↦ bridgeRemainder u (bridge ω)) law := by + have hc (_ : Unit) (s : Time) : + cov[fun ω ↦ bridge ω u,fun ω ↦ bridgeRemainder u (bridge ω) s;law]=0 := by + simp only [bridgeRemainder_apply] + rw [covariance_fun_sub_right (bridge_eval_law u).hasGaussianLaw.memLp_two + (bridge_eval_law _).hasGaussianLaw.memLp_two ((bridge_eval_law u).hasGaussianLaw.memLp_two.const_mul _), + covariance_const_mul_right,bridge_covariance,bridge_covariance,min_self,min_eq_left (le_suffixTime u s)] + change (u:ℝ)-(u:ℝ)*((u:ℝ)+(1-(u:ℝ))*(s:ℝ))-(1-(s:ℝ))*((u:ℝ)-(u:ℝ)*(u:ℝ))=0 + ring + have hi := (bridgeRemainder_joint_gaussian u).indepFun_of_covariance_eq_zero + (fun _ ↦ ((continuous_eval_const u).measurable.comp measurable_bridge).aemeasurable) + (fun s ↦ ((continuous_eval_const s).measurable.comp ((bridgeRemainder u).continuous.measurable.comp measurable_bridge)).aemeasurable) hc + have hid := hi.comp (measurable_pi_apply ()) + (Measurable.of_eval fun index ↦ measurable_pi_apply (TopologicalSpace.denseSeq Time index)) + have hh := hid.comp measurable_id denseEval_embedding.measurable_invFun + convert hh using 1 + · rfl + · funext ω + exact (denseEval_embedding.leftInverse_invFun _).symm + +end HardSphere.Wiener + +namespace HardSphere +open Wiener + +def coordinateBridge (N : ℕ) : Measure (CoordinatePaths N) := Measure.pi (fun _ ↦ bridgeLaw) +instance coordinateBridge_probability (N : ℕ) : IsProbabilityMeasure (coordinateBridge N) := by + unfold coordinateBridge + infer_instance + +def gaussianCoordinates (N : ℕ) : Measure (Direction N → ℝ) := Measure.pi (fun _ ↦ gaussianReal 0 1) +instance gaussianCoordinates_probability (N : ℕ) : IsProbabilityMeasure (gaussianCoordinates N) := by + unfold gaussianCoordinates + infer_instance + +def reconstructCoordinates (N : ℕ) (p : (Direction N → ℝ)×CoordinatePaths N) : CoordinatePaths N := + fun j ↦ p.1 j • linearPath+p.2 j + +lemma reconstructCoordinates_continuous (N : ℕ) : Continuous (reconstructCoordinates N) := by + unfold reconstructCoordinates + fun_prop + +lemma reconstructCoordinates_preserving (N : ℕ) : + MeasurePreserving (reconstructCoordinates N) ((gaussianCoordinates N).prod (coordinateBridge N)) (coordinateWiener N) := by + refine ⟨(reconstructCoordinates_continuous N).measurable,?_⟩ + have h := measurePreserving_arrowProdEquivProdArrow ℝ C(Time,ℝ) (Direction N) + (fun _ ↦ gaussianReal 0 1) (fun _ ↦ bridgeLaw) + change (Measure.prod (Measure.pi (fun _ : Direction N ↦ gaussianReal 0 1)) + (Measure.pi (fun _ : Direction N ↦ bridgeLaw))).map _=Measure.pi (fun _ ↦ wiener) + rw [←h.map_eq,Measure.map_map (reconstructCoordinates_continuous N).measurable h.measurable] + change (Measure.pi (fun _ : Direction N ↦ (gaussianReal 0 1).prod bridgeLaw)).map + (fun p j ↦ (p j).1 • linearPath+(p j).2)=_ + rw [Measure.pi_map_pi (fun _ ↦ (show Measurable (fun p : ℝ×C(Time,ℝ) ↦ p.1 • linearPath+p.2) from by fun_prop).aemeasurable)] + simp_rw [←wiener_disintegration] + +lemma bridge_endpoints : ∀ᵐ β ∂bridgeLaw, β (0:Time)=0 ∧ β (1:Time)=0 := by + have hm : MeasurableSet {β : C(Time,ℝ) | β (0:Time)=0 ∧ β (1:Time)=0} := + ((isClosed_eq (continuous_eval_const (0:Time)) continuous_const).inter (isClosed_eq (continuous_eval_const (1:Time)) continuous_const)).measurableSet + rw [bridgeLaw,ae_map_iff measurable_bridge.aemeasurable hm] + exact ae_of_all _ (fun ω ↦ ⟨bridge_at_zero ω,bridge_at_one ω⟩) + +lemma coordinateBridge_endpoints (N : ℕ) : + ∀ᵐ β ∂coordinateBridge N, ∀j, β j (0:Time)=0 ∧ β j (1:Time)=0 := by + apply ae_all_iff.mpr + intro j + exact (measurePreserving_eval (fun _ : Direction N ↦ bridgeLaw) j).quasiMeasurePreserving.ae bridge_endpoints + +lemma reconstruct_free_endpoints (N : ℕ) (L : Length) (t : ℝ) : + ∀ᵐ β ∂coordinateBridge N, ∀ z : Direction N → ℝ, ∀ X : Configuration N L, + freeTrajectory N L t (reconstructCoordinates N (z,β)) X 0=X ∧ + freeTrajectory N L t (reconstructCoordinates N (z,β)) X 1= + fun i j ↦ X i j+((Real.sqrt (2*t)*z (i,j):ℝ):AddCircle L.val) := by + filter_upwards [coordinateBridge_endpoints N] with β hβ z X + constructor <;> ext i j + · change X i j+((Real.sqrt (2*t)*(z (i,j)*0+β (i,j) 0):ℝ):AddCircle L.val)=X i j + rw [(hβ (i,j)).1] + simp + · change X i j+((Real.sqrt (2*t)*(z (i,j)*1+β (i,j) 1):ℝ):AddCircle L.val)=_ + rw [(hβ (i,j)).2] + simp + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/BridgeSplit.lean b/lean/OAI/Analysis/HardSphere/Bridges/BridgeSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea372ec3938f400934d4654411b30be8a9064a35 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/BridgeSplit.lean @@ -0,0 +1,168 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.BridgeResidual + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory Set Filter ProbabilityTheory +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Wiener + +def bridgePrefix (u : Time) : C(Time,ℝ) →L[ℝ] C(Time,ℝ) := centerMap.comp (prefixMap u) +@[simp] lemma bridgePrefix_apply (u : Time) (f : C(Time,ℝ)) (s : Time) : + bridgePrefix u f s=f (prefixTime u s)-(s:ℝ)*f u := by + simp only [bridgePrefix,ContinuousLinearMap.comp_apply,centerMap_apply,prefixMap_apply] + congr 2 + congr 1 + apply Subtype.ext + simp [prefixTime] + +lemma bridgePrefix_eq (u : Time) (ω : Noise) : + bridgePrefix u (bridge ω)=centerMap (prefixMap u (path ω)) := by + ext s + simp only [bridgePrefix_apply,bridge_apply,centerMap_apply,prefixMap_apply] + have he : prefixTime u 1=u := by ext; simp [prefixTime] + rw [he] + change path ω (prefixTime u s)-((u:ℝ)*(s:ℝ))*path ω 1- + (s:ℝ)*(path ω u-(u:ℝ)*path ω 1)=_ + ring + +lemma bridgePrefix_law (u : Time) : + law.map (fun ω ↦ bridgePrefix u (bridge ω))= + bridgeLaw.map (fun β ↦ Real.sqrt (u:ℝ) • β) := by + calc + _ = (law.map (fun ω ↦ prefixMap u (path ω))).map centerMap := by + rw [Measure.map_map (f:=fun ω ↦ prefixMap u (path ω)) centerMap.continuous.measurable + ((prefixMap u).continuous.measurable.comp measurable_path)] + congr 1 + funext ω + exact bridgePrefix_eq u ω + _ = _ := by + rw [prefix_law,Measure.map_map (f:=fun ω ↦ Real.sqrt (u:ℝ) • path ω) centerMap.continuous.measurable ((show Continuous (fun w : C(Time,ℝ) ↦ Real.sqrt (u:ℝ) • w) from by fun_prop).measurable.comp measurable_path), + bridgeLaw,Measure.map_map (by fun_prop) measurable_bridge] + congr 1 + funext ω + exact (centerMap.map_smul _ _).trans (congrArg (fun β ↦ Real.sqrt (u:ℝ) • β) (centerMap_path ω)) + +lemma prefixRemainder_gaussian (u : Time) : + IsGaussianProcess (Sum.elim (fun s ω ↦ prefixMap u (bridge ω) s) + (fun s ω ↦ bridgeRemainder u (bridge ω) s)) law := by + classical + constructor + intro I + let loc : Option I → Time := fun i ↦ i.elim u + (fun j ↦ j.val.elim (prefixTime u) (suffixTime u)) + let ev (i : Option I) : (Option I → ℝ) →L[ℝ] ℝ := ContinuousLinearMap.proj i + let L : (Option I → ℝ) →L[ℝ] (I → ℝ) := ContinuousLinearMap.pi + (fun j ↦ match j.val with + | .inl _ => ev (some j) + | .inr s => ev (some j) - (1-(s:ℝ)) • ev none) + convert! (finite_bridge_gaussian loc).map_fun L using 1 + funext ω j + cases hj : j.val <;> simp [L,loc,ev,hj] + +lemma prefixRemainder_independent (u : Time) : + IndepFun (fun ω ↦ prefixMap u (bridge ω)) (fun ω ↦ bridgeRemainder u (bridge ω)) law := by + have hc (a s : Time) : + cov[fun ω ↦ prefixMap u (bridge ω) a,fun ω ↦ bridgeRemainder u (bridge ω) s;law]=0 := by + simp only [prefixMap_apply,bridgeRemainder_apply] + rw [covariance_fun_sub_right (bridge_eval_law _).hasGaussianLaw.memLp_two + (bridge_eval_law _).hasGaussianLaw.memLp_two ((bridge_eval_law u).hasGaussianLaw.memLp_two.const_mul _), + covariance_const_mul_right,bridge_covariance,bridge_covariance, + min_eq_left ((prefixTime_le u a).trans (le_suffixTime u s)),min_eq_left (prefixTime_le u a)] + change (u:ℝ)*(a:ℝ)-((u:ℝ)*(a:ℝ))*((u:ℝ)+(1-(u:ℝ))*(s:ℝ))- + (1-(s:ℝ))*((u:ℝ)*(a:ℝ)-((u:ℝ)*(a:ℝ))*(u:ℝ))=0 + ring + have hi := (prefixRemainder_gaussian u).indepFun_of_covariance_eq_zero + (fun s ↦ ((continuous_eval_const s).measurable.comp ((prefixMap u).continuous.measurable.comp measurable_bridge)).aemeasurable) + (fun s ↦ ((continuous_eval_const s).measurable.comp ((bridgeRemainder u).continuous.measurable.comp measurable_bridge)).aemeasurable) hc + have hid := hi.comp + (Measurable.of_eval fun n ↦ measurable_pi_apply (TopologicalSpace.denseSeq Time n)) + (Measurable.of_eval fun n ↦ measurable_pi_apply (TopologicalSpace.denseSeq Time n)) + have hh := hid.comp denseEval_embedding.measurable_invFun denseEval_embedding.measurable_invFun + convert hh using 1 <;> funext ω <;> exact (denseEval_embedding.leftInverse_invFun _).symm + +lemma prefixValue_gaussian (u : Time) : + IsGaussianProcess (Sum.elim (fun _ : Unit ↦ fun ω ↦ bridge ω u) + (fun s ω ↦ bridgePrefix u (bridge ω) s)) law := by + classical + constructor + intro I + let loc : Option I → Time := fun i ↦ i.elim u + (fun j ↦ j.val.elim (fun _ ↦ u) (prefixTime u)) + let ev (i : Option I) : (Option I → ℝ) →L[ℝ] ℝ := ContinuousLinearMap.proj i + let L : (Option I → ℝ) →L[ℝ] (I → ℝ) := ContinuousLinearMap.pi + (fun j ↦ match j.val with + | .inl _ => ev (some j) + | .inr s => ev (some j) - (s:ℝ) • ev none) + convert! (finite_bridge_gaussian loc).map_fun L using 1 + funext ω j + cases hj : j.val <;> simp [L,loc,ev,hj] + +lemma prefixValue_independent (u : Time) : + IndepFun (fun ω ↦ bridge ω u) (fun ω ↦ bridgePrefix u (bridge ω)) law := by + have hc (_ : Unit) (s : Time) : + cov[fun ω ↦ bridge ω u,fun ω ↦ bridgePrefix u (bridge ω) s;law]=0 := by + simp only [bridgePrefix_apply] + rw [covariance_fun_sub_right (bridge_eval_law _).hasGaussianLaw.memLp_two + (bridge_eval_law _).hasGaussianLaw.memLp_two ((bridge_eval_law u).hasGaussianLaw.memLp_two.const_mul _), + covariance_const_mul_right,bridge_covariance,bridge_covariance, + min_eq_right (prefixTime_le u s),min_self] + change (u:ℝ)*(s:ℝ)-(u:ℝ)*((u:ℝ)*(s:ℝ))- + (s:ℝ)*((u:ℝ)-(u:ℝ)*(u:ℝ))=0 + ring + have hi := (prefixValue_gaussian u).indepFun_of_covariance_eq_zero + (fun _ ↦ ((continuous_eval_const u).measurable.comp measurable_bridge).aemeasurable) + (fun s ↦ ((continuous_eval_const s).measurable.comp ((bridgePrefix u).continuous.measurable.comp measurable_bridge)).aemeasurable) hc + have hid := hi.comp (measurable_pi_apply ()) + (Measurable.of_eval fun n ↦ measurable_pi_apply (TopologicalSpace.denseSeq Time n)) + have hh := hid.comp measurable_id denseEval_embedding.measurable_invFun + convert hh using 1 + · rfl + · funext ω + exact (denseEval_embedding.leftInverse_invFun _).symm + +lemma bridge_three_law (u : Time) : + bridgeLaw.map (fun β ↦ ((β u,bridgePrefix u β),bridgeRemainder u β))= + ((gaussianReal 0 (Real.toNNReal ((u:ℝ)-(u:ℝ)^2))).prod + (bridgeLaw.map (fun β ↦ Real.sqrt (u:ℝ) • β))).prod + (bridgeLaw.map (fun β ↦ Real.sqrt (1-(u:ℝ)) • β)) := by + have hi := (prefixRemainder_independent u).comp + (show Measurable (fun f : C(Time,ℝ) ↦ (f 1,centerMap f)) from by fun_prop) measurable_id + have he : (fun ω ↦ (prefixMap u (bridge ω) 1,centerMap (prefixMap u (bridge ω))))= + (fun ω ↦ (bridge ω u,bridgePrefix u (bridge ω))) := by + funext ω + apply Prod.ext + · simp only [prefixMap_apply] + congr 1 + apply Subtype.ext + simp [prefixTime] + · rfl + simp only [Function.comp_def,id_eq] at hi + rw [he] at hi + rw [bridgeLaw,Measure.map_map (by fun_prop) measurable_bridge] + simp only [Function.comp_def] + have hh := hi.map_prod_eq_prod_map_map + ((((continuous_eval_const u).measurable.comp measurable_bridge).prodMk + ((bridgePrefix u).continuous.measurable.comp measurable_bridge)).aemeasurable) + (((bridgeRemainder u).continuous.measurable.comp measurable_bridge).aemeasurable) + simp only [Function.comp_def] at hh + rw [hh] + have hp := (prefixValue_independent u).map_prod_eq_prod_map_map + ((continuous_eval_const u).measurable.comp measurable_bridge).aemeasurable + ((bridgePrefix u).continuous.measurable.comp measurable_bridge).aemeasurable + simp only [Function.comp_def] at hp + rw [hp,(bridge_eval_law u).map_eq,bridgePrefix_law,bridgeRemainder_law] + rfl + +end HardSphere.Wiener + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/BridgeStrongRegular.lean b/lean/OAI/Analysis/HardSphere/Bridges/BridgeStrongRegular.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ad5aaa925cfb468ecad16696738c5ef1c2447ed --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/BridgeStrongRegular.lean @@ -0,0 +1,226 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.BridgeAverage + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Bridge +open Wiener GaussianPacking PathCutoff + +def LegMeshRegular (n : ℕ) (t r R C : ℝ) (y u : Point) (β : Noise) : Prop := + (∀j : Fin n,legMeshRatio t r y u j β≤R) ∧ + (∑j : Fin n,legCost t r y u j β)≤C*(n:ℝ) + +lemma legMeshRegular_measurable (n : ℕ) (t r R C : ℝ) (y u : Point) : + MeasurableSet {β | LegMeshRegular n t r R C y u β} := by + have he : {β | LegMeshRegular n t r R C y u β} = ((⋂j : Fin n,{β | legMeshRatio t r y u j β≤R}) ∩ + {β | (∑j : Fin n,legCost t r y u j β)≤C*(n:ℝ)}) := by ext β; simp [LegMeshRegular] + rw [he] + apply MeasurableSet.inter + · apply MeasurableSet.iInter + intro j + apply measurableSet_le _ measurable_const + unfold legMeshRatio + have hζ : Continuous (fun β : Noise ↦ fun i : Fin 3 ↦ + (pathCoordinates (leg t y u β) i).comp ⟨meshTime j,meshTime_continuous j⟩) := by + apply continuous_pi; intro i + apply ContinuousMap.continuous_of_continuous_uncurry + change Continuous (fun p : Noise×Time ↦ leg t y u p.1 (meshTime j p.2) i) + have hl := leg_continuous t y u + have hj := meshTime_continuous j + fun_prop + exact (((liftedDiameter_continuous 0 1).comp hζ).div_const r).measurable + · exact measurableSet_le (Finset.measurable_fun_sum _ (fun j _ ↦ (legCost_continuous j t r y u).measurable)) measurable_const + +lemma strong_mesh_of_free (L : Length) (n : ℕ) {t r R B C Creg : ℝ} (hr : 0 field_simp + ring + + have hc := hitConstant_pos.le + nlinarith + +end HardSphere.Bridge + +end +end + +section +noncomputable section +open MeasureTheory Set Filter ProbabilityTheory +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Bridge +open Wiener PathCutoff GaussianPacking + +def torusLegHit {L : Length} (t : ℝ) (y v : Point) (B : Set Point) (ω : ConfigurationPath 1 L) + (r C h : ℝ) : Set (Point×Noise) := + {p | p.1∈B ∧ (∀s : Time,‖leg t y p.1 p.2 s-v‖≤10 ∧ + torusDistance L (projectPoint L (leg t y p.1 p.2 s)) (projectPoint L v)≤10) ∧ + (∀s : Time,‖leg t y p.1 p.2 s-p.1‖≤ C) ∧ + ∃s : Time,h≤(s:ℝ) ∧ torusDistance L (projectPoint L (leg t y p.1 p.2 s)) (ω s 0)≤ r} + +lemma torusLegHit_subset {L : Length} {n : ℕ} (hn : 0< n) (I : Finset (Fin n)) + (t : ℝ) (y v : Point) (B : Set Point) (ω : ConfigurationPath 1 L) (ζ : EuclideanPath) + (hζ : IsPathLift ω ζ) {r C h : ℝ} (hL : 50< L.val) (hr : r≤1) + (hdiam : ∀j∈I,intervalDiameter (meshTime j 0) (meshTime j 1) ω≤1) + (hI : ∀j : Fin n,∀q : Time,h≤(meshTime j q:ℝ) → j∈I) : + torusLegHit t y v B ω r C h⊆meshHitUnion I t y B (meshLocalLift ω ζ v) r C := by + rintro ⟨u,β⟩ ⟨hu,hconf,hconf',s,hs,hit⟩ + obtain ⟨j,q,hq⟩ := mesh_covers hn s + have hj : j∈I := hI j q (by simpa only [hq] using hs) + have hh := (mesh_torus_hit_local hζ v (leg t y u β (meshTime j q)) j q hL + (le_refl 1) (hdiam j hj) (hconf (meshTime j q)).1 (hconf (meshTime j q)).2 hr + (by simpa only [hq] using hit)).2 + change (u,β)∈⋃j∈I,combinedSegmentHit t y B (meshTime j 0) (meshRemainder j) (meshLocalLift ω ζ v j) r C + refine mem_iUnion.mpr ⟨j,mem_iUnion.mpr ⟨hj,?_⟩⟩ + by_cases hearly : (meshTime j 0:ℝ)≤1/2 + · simp only [combinedSegmentHit,ite_eq_left hearly,jointSegmentHit,mem_ofPred_eq,segmentHit] + exact ⟨hconf' _,prefixTime (meshRemainder j) q,prefixTime_le _ _,by simpa only [mesh_suffix_time] using hh⟩ + · simp only [combinedSegmentHit,ite_eq_right hearly,mem_preimage,uniformSegmentHit,mem_ofPred_eq,Prod.swap_prod_mk] + exact ⟨hu,prefixTime (meshRemainder j) q,prefixTime_le _ _,by simpa only [mesh_suffix_time] using hh⟩ + +lemma torusLegHit_sum {L : Length} {m n k : ℕ} (hn : 0< n) (hk : 0< k) + (y : Fin m→Point) (v : Point) (I : Finset (Fin n)) (ω : ConfigurationPath 1 L) (A : Fin n→ℝ) + {t r C ε h R J : ℝ} + (hL : 50< L.val) (ht : 0< t) (hr : 0< r) (hr1 : r≤1) (hC : 0≤ C) (hε : 0<ε) (hR : 0≤ R) + (hsep : ∀i j,i≠j → ε^2≤ square (y i-y j)) + (hI : ∀j : Fin n,∀q : Time,h≤(meshTime j q:ℝ) → j∈I) + (hlow : ∀j∈I,k< j.val) + (hA0 : ∀j∈I,0≤ A j) (hAmax : ∀j∈I,A j≤ R) (hAsum : (∑j∈I,(1+A j)^3)≤ J) + (hsmall : ∀j∈I,r*A j≤1) + (hdiam : ∀j∈I,intervalDiameter (meshTime j 0) (meshTime j 1) ω≤ r*A j) + (hdrift : ∀j∈I,(meshTime j 0:ℝ)≤1/2 → (meshRemainder j:ℝ)*C≤ r) + (hlate : t/(n:ℝ)≤ r^2) (hdrift' : C/(n:ℝ)≤ r) + {B : Set Point} (hBm : MeasurableSet B) (hB : (volume : Measure Point) B≤1) + (hBdist : ∀i u,u∈B → ‖u-y i‖≤ C) : + (∑i,((volume.restrict B).prod law) (torusLegHit t (y i) v B ω r C h))≤ + ENNReal.ofReal (hitConstant*r^3*((ε⁻¹^3+(m:ℝ))*J+ + 2*(1+R)^3/((t/(n:ℝ))*Real.sqrt ((k:ℝ)*(t/(n:ℝ)))))) := by + obtain ⟨ζ,hζ⟩ := exists_pathLift ω + have hstart j (hj : j∈I) : 0<(meshTime j 0:ℝ) := by + change 0<((j:ℝ)+0)/(n:ℝ) + exact div_pos (by exact_mod_cast (lt_trans hk (hlow j hj))) (by exact_mod_cast hn) + apply (Finset.sum_le_sum (fun i _ ↦ measure_mono (torusLegHit_subset hn I t (y i) v B ω ζ hζ hL hr1 + (fun j hj ↦ (hdiam j hj).trans (hsmall j hj)) hI))).trans + apply (mesh_hit_sum y I (meshLocalLift ω ζ v) A ht hr hC hε hsep hA0 hstart + (fun j hj q hq ↦ meshLocalLift_increment hζ v j (by linarith [hsmall j hj]) (hdiam j hj) q hq) + hdrift hlate hdrift' hBm hB hBdist).trans + apply ENNReal.ofReal_le_ofReal + apply mul_le_mul_of_nonneg_left _ (mul_nonneg hitConstant_pos.le (pow_nonneg hr.le _)) + exact add_le_add (mul_le_mul_of_nonneg_left hAsum (by positivity)) + (mesh_tail_bound I A hk ht hR hlow hAmax hA0) + +end HardSphere.Bridge + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Bridge +open Wiener GaussianPacking PathCutoff + +def meshCount (t r : ℝ) : ℕ := ⌈t/r^2⌉₊ +lemma meshCount_pos {t r : ℝ} (ht : 0< t) (hr : 0< r) : 0< meshCount t r := by + exact Nat.ceil_pos.mpr (div_pos ht (sq_pos_of_pos hr)) +lemma meshCount_lower {t r : ℝ} (ht : 0< t) (hr : 0< r) : + t/(meshCount t r:ℝ)≤ r^2 := by + have hn : (0:ℝ)< meshCount t r := by exact_mod_cast meshCount_pos ht hr + apply (div_le_iff₀ hn).mpr + have h := Nat.le_ceil (t/r^2) + have hh := (div_le_iff₀ (sq_pos_of_pos hr)).mp h + simpa only [meshCount,mul_comm] using hh +lemma meshCount_upper {t r : ℝ} (ht : 0< t) (hr : 0< r) (hsmall : r^2≤ t) : + (meshCount t r:ℝ)*r^2≤2*t := by + have h := (Nat.ceil_lt_add_one (div_nonneg ht.le (sq_nonneg r))) + have hh := mul_lt_mul_of_pos_right h (sq_pos_of_pos hr) + dsimp [meshCount] + have he : (t/r^2+1)*r^2=t+r^2 := by field_simp + rw [he] at hh + linarith + +lemma mesh_endpoint_index {n : ℕ} (j : Fin n) (q : Time) {t h : ℝ} + (ht : 0< t) (hh : 2*(t/(n:ℝ))≤ h) (hs : h/t≤(meshTime j q:ℝ)) : + h/(2*t)≤(meshTime j 0:ℝ) := by + have hn : (0:ℝ)< n := by exact_mod_cast j.pos + have hs' : h*(n:ℝ)≤ t*((j:ℝ)+(q:ℝ)) := by + change h/t≤((j:ℝ)+(q:ℝ))/(n:ℝ) at hs + simpa only [mul_comm t] using (div_le_div_iff₀ ht hn).mp hs + have hh' : 2*t≤ h*(n:ℝ) := by + have := (div_le_iff₀ hn).mp (show 2*t/(n:ℝ)≤ h by simpa [mul_div_assoc] using hh) + linarith + change h/(2*t)≤((j:ℝ)+0)/(n:ℝ) + rw [add_zero] + apply (div_le_div_iff₀ (by positivity : 0<2*t) hn).mpr + have hq := q.property.2 + nlinarith + +def endpointIndex (n : ℕ) (t h : ℝ) : ℕ := ⌊(n:ℝ)*h/(4*t)⌋₊ +lemma endpointIndex_pos {n : ℕ} {t h : ℝ} (ht : 0< t) + (hlarge : 8*t≤(n:ℝ)*h) : 0< endpointIndex n t h := by + apply Nat.floor_pos.mpr + apply (le_div_iff₀ (by positivity : 0<4*t)).mpr + linarith +lemma endpointIndex_gap {n : ℕ} (j : Fin n) {t h : ℝ} (ht : 0< t) (hh : 0< h) + (hj : h/(2*t)≤(meshTime j 0:ℝ)) : endpointIndex n t h< j.val := by + have hn : (0:ℝ)< n := by exact_mod_cast j.pos + have hk := Nat.floor_le (show 0≤(n:ℝ)*h/(4*t) by positivity) + have hj' : h*(n:ℝ)≤(j:ℝ)*(2*t) := by + change h/(2*t)≤((j:ℝ)+0)/(n:ℝ) at hj + rw [add_zero] at hj + exact (div_le_div_iff₀ (by positivity : 0<2*t) hn).mp hj + have hc : (endpointIndex n t h:ℝ)<(j:ℝ) := by + apply lt_of_le_of_lt hk + apply (div_lt_iff₀ (by positivity : 0<4*t)).mpr + nlinarith + exact_mod_cast hc +lemma endpointIndex_scale {n : ℕ} (hn : 0< n) {t h : ℝ} (ht : 0< t) + (hlarge : 8*t≤(n:ℝ)*h) : h/8≤(endpointIndex n t h:ℝ)*(t/(n:ℝ)) := by + have hn' : (0:ℝ)< n := by exact_mod_cast hn + have hk : (n:ℝ)*h/(4*t)<(endpointIndex n t h:ℝ)+1 := Nat.lt_floor_add_one _ + have hk' := (div_lt_iff₀ (by positivity : 0<4*t)).mp hk + rw [←mul_div_assoc] + apply (le_div_iff₀ hn').mpr + change h/8*(n:ℝ)≤(endpointIndex n t h:ℝ)*t + nlinarith + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/ConfinedLift.lean b/lean/OAI/Analysis/HardSphere/Bridges/ConfinedLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b0993846e30f53590d6706006199c28140ba4f4 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/ConfinedLift.lean @@ -0,0 +1,183 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.PhysicalInsertionBound +import OAI.Analysis.HardSphere.Bridges.PhysicalInsertion + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology +namespace HardSphere.Bridge +open Wiener PathCutoff GaussianPacking +attribute [local irreducible] torusDistance + +lemma intervalTime_full (s : Time) : intervalTime 0 1 s=s := by + apply Subtype.ext + simp [intervalTime] + +lemma tube_diameter {L : Length} (ω : ConfigurationPath 1 L) (c : Torus L) + (hc : ∀s : Time,torusDistance L (ω s 0) c≤10) : intervalDiameter 0 1 ω≤20 := by + apply intervalDiameter_le _ _ _ (by norm_num) + intro s q + simp only [intervalTime_full] + have htri := torusDistance_triangle' L (ω s 0) c (ω q 0) + rw [torusDistance_comm L c] at htri + linarith [hc s,hc q] + +lemma lift_norm_increment {L : Length} (hL : 50 simp + +lemma earlyTorusHit_bound {L : Length} {n k : ℕ} (hn : 0 have h1:=hy.1 j <;> have h2:=hy.2 j <;> dsimp at * <;> linarith + +lemma square_triangle (x y : Point) : square (x+y)≤2*square x+2*square y := by + simp only [square,Pi.add_apply] + rw [Finset.mul_sum, Finset.mul_sum, ←Finset.sum_add_distrib] + apply Finset.sum_le_sum + intro j hj + nlinarith [sq_nonneg (x j-y j)] + +lemma square_le_of_coord {x : Point} {δ : ℝ} (hδ : 0≤δ) (hx : ∀j,|x j|≤δ) : + square x≤3*δ^2 := by + unfold square + calc + _ ≤ ∑_j : Fin 3,δ^2 := Finset.sum_le_sum (fun j _ ↦ by simpa only [sq_abs] using (sq_le_sq₀ (abs_nonneg _) hδ).mpr (hx j)) + _ = _ := by simp [Finset.sum_const] + +lemma cube_kernel_lower {b δ : ℝ} (hb : 0≤b) (hδ : 0≤δ) (x q : Point) + {y : Point} (hy : y∈cube q δ) : + kernel b (x-q) ≤ Real.exp (3*b*δ^2)*kernel (b/2) (x-y) := by + have ht : square (x-y)≤2*square (x-q)+6*δ^2 := by + have he : x-y=(x-q)+(q-y) := by ext j; simp + rw [he] + apply (square_triangle _ _).trans + have hx : square (q-y)≤3*δ^2 := square_le_of_coord hδ (fun j ↦ by + simpa only [Pi.sub_apply,abs_sub_comm] using cube_coord hy j) + linarith + rw [kernel,kernel,←Real.exp_add] + apply Real.exp_le_exp.mpr + nlinarith [mul_le_mul_of_nonneg_left ht hb] + +lemma cubes_disjoint {m : ℕ} (q : Fin m → Point) {ε δ : ℝ} (hε : 0<ε) (hδ : 0≤δ) + (hδε : 4*δ≤ε) (hsep : ∀i j,i≠j → ε^2 ≤ square (q i-q j)) : + Pairwise (fun i j ↦ Disjoint (cube (q i) δ) (cube (q j) δ)) := by + intro i j hij + apply disjoint_left.mpr + intro y hyi hyj + have hxy : square (q i-q j)≤3*(2*δ)^2 := square_le_of_coord (by positivity) (fun k ↦ by + have h1:=cube_coord hyi k + have h2:=cube_coord hyj k + rw [abs_le] at h1 h2 ⊢ + change -(2*δ)≤q i k-q j k ∧ q i k-q j k≤2*δ + constructor <;> linarith) + have he := hsep i j hij + have hd : (4*δ)^2≤ε^2 := (sq_le_sq₀ (by positivity) hε.le).mpr hδε + nlinarith [sq_pos_of_pos hε] + +lemma kernel_translate_integrable {b : ℝ} (hb : 0 < b) (x : Point) : + Integrable (fun y ↦ kernel b (x-y)) volume := + (integrable_comp_sub_left (kernel b) x).mpr (kernel_integrable hb) + +lemma sum_kernel_le {m : ℕ} (q : Fin m → Point) (x : Point) + {b ε δ : ℝ} (hb : 0 < b) (hε : 0 < ε) (hδ : 0 < δ) + (hδε : 4*δ ≤ ε) (hsep : ∀i j, i≠j → ε^2 ≤ square (q i-q j)) : + (∑i,kernel b (x-q i)) ≤ + Real.exp (3*b*δ^2)*(Real.sqrt (Real.pi/(b/2)))^3/(2*δ)^3 := by + have hi := kernel_translate_integrable (by positivity : 0 < b/2) x + have hp := cubes_disjoint q hε hδ.le hδε hsep + have hc (i : Fin m) : (2*δ)^3*kernel b (x-q i) ≤ + Real.exp (3*b*δ^2)*∫y in cube (q i) δ,kernel (b/2) (x-y) := by + have hn : (∫y in cube (q i) δ, kernel b (x-q i)) ≤ + ∫y in cube (q i) δ,Real.exp (3*b*δ^2)*kernel (b/2) (x-y) := by + apply integral_mono_ae (integrableOn_const (μ:=volume) (s:=cube (q i) δ) (C:=kernel b (x-q i)) (IsCompact.measure_lt_top isCompact_Icc).ne) + ((hi.const_mul _).integrableOn) + filter_upwards [ae_restrict_mem measurableSet_Icc] with y hy + exact cube_kernel_lower hb.le hδ.le x (q i) hy + simpa only [integral_const,measureReal_restrict_apply_univ,smul_eq_mul, + cube_real_volume _ hδ.le,integral_const_mul] using hn + have hs := Finset.sum_le_sum (fun i (_ : i∈Finset.univ) ↦ hc i) + rw [←Finset.mul_sum,←Finset.mul_sum] at hs + have heu : (∫y in ⋃i,cube (q i) δ,kernel (b/2) (x-y)) = ∑i,∫y in cube (q i) δ,kernel (b/2) (x-y) := + integral_iUnion_fintype (fun i ↦ (measurableSet_Icc : MeasurableSet (cube (q i) δ))) hp (fun _ ↦ hi.integrableOn) + rw [←heu] at hs + have hm : (∫y in ⋃i,cube (q i) δ,kernel (b/2) (x-y)) ≤ + (Real.sqrt (Real.pi/(b/2)))^3 := by + apply (integral_mono_measure Measure.restrict_le_self + (Eventually.of_forall (fun y ↦ (Real.exp_pos _).le)) hi).trans_eq + exact (integral_sub_left_eq_self (kernel (b/2)) volume x).trans (kernel_integral _) + have ht := hs.trans (mul_le_mul_of_nonneg_left hm (Real.exp_pos _).le) + exact (le_div_iff₀ (by positivity : 0 < (2*δ)^3)).mpr (by simpa only [mul_comm] using ht) + +end HardSphere.GaussianPacking + +end +end + +section +noncomputable section +open MeasureTheory MeasureTheory.Measure Set Filter ProbabilityTheory +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Bridge +open Wiener GaussianPacking +abbrev Noise := Fin 3 → C(Time,ℝ) +def law : Measure Noise := Measure.pi (fun _ ↦ bridgeLaw) +instance : IsProbabilityMeasure law := by unfold law; infer_instance + +def eval (s : Time) (β : Noise) : Point := fun j ↦ β j s +def remainder (s : Time) (β : Noise) : Noise := fun j ↦ bridgeRemainder s (β j) +lemma eval_measurable (s : Time) : Measurable (eval s) := + Measurable.of_eval fun coordinate ↦ + (continuous_eval_const s).measurable.comp (measurable_pi_apply coordinate) +lemma remainder_measurable (s : Time) : Measurable (remainder s) := by unfold remainder; fun_prop + +def variance (s : Time) : ℝ≥0 := Real.toNNReal ((s:ℝ)-(s:ℝ)^2) +lemma scalar_eval (s : Time) : bridgeLaw.map (fun β : C(Time,ℝ) ↦ β s)=gaussianReal 0 (variance s) := by + rw [bridgeLaw,Measure.map_map (continuous_eval_const s).measurable measurable_bridge] + exact (bridge_eval_law s).map_eq +lemma scalar_remainder (s : Time) : bridgeLaw.map (bridgeRemainder s)= + bridgeLaw.map (fun β ↦ Real.sqrt (1-(s:ℝ)) • β) := by + rw [bridgeLaw,Measure.map_map (bridgeRemainder s).continuous.measurable measurable_bridge] + exact bridgeRemainder_law s +lemma scalar_joint (s : Time) : bridgeLaw.map (fun β : C(Time,ℝ) ↦ (β s,bridgeRemainder s β))= + (gaussianReal 0 (variance s)).prod (bridgeLaw.map (fun β ↦ Real.sqrt (1-(s:ℝ)) • β)) := by + rw [bridgeLaw,Measure.map_map (by fun_prop) measurable_bridge] + simp only [Function.comp_def] + have hj := (bridgeRemainder_independent s).map_prod_eq_prod_map_map + (((continuous_eval_const s).measurable.comp measurable_bridge).aemeasurable) + (((bridgeRemainder s).continuous.measurable.comp measurable_bridge).aemeasurable) + simp only [Function.comp_def] at hj + rw [(bridge_eval_law s).map_eq,bridgeRemainder_law] at hj + exact hj + +lemma eval_law (s : Time) : law.map (eval s)=Measure.pi (fun _ : Fin 3 ↦ gaussianReal 0 (variance s)) := by + unfold law eval + rw [Measure.pi_map_pi (fun _ ↦ (show Measurable (fun β : C(Time,ℝ) ↦ β s) from (continuous_eval_const s).measurable).aemeasurable)] + simp_rw [scalar_eval] +lemma remainder_law (s : Time) : law.map (remainder s)= + law.map (fun β : Noise ↦ fun j ↦ Real.sqrt (1-(s:ℝ)) • β j) := by + unfold law remainder + rw [Measure.pi_map_pi (fun _ ↦ (bridgeRemainder s).continuous.measurable.aemeasurable), + Measure.pi_map_pi (fun _ ↦ (show Measurable (fun β : C(Time,ℝ) ↦ Real.sqrt (1-(s:ℝ)) • β) from by fun_prop).aemeasurable)] + simp_rw [scalar_remainder] + +lemma joint_law (s : Time) : law.map (fun β ↦ (eval s β,remainder s β))= + (Measure.pi (fun _ : Fin 3 ↦ gaussianReal 0 (variance s))).prod (law.map (remainder s)) := by + have hp := measurePreserving_arrowProdEquivProdArrow ℝ C(Time,ℝ) (Fin 3) + (fun _ ↦ gaussianReal 0 (variance s)) (fun _ ↦ bridgeLaw.map (fun β ↦ Real.sqrt (1-(s:ℝ)) • β)) + have he : law.map (fun β : Noise ↦ fun j ↦ (β j s,bridgeRemainder s (β j)))= + Measure.pi (fun _ : Fin 3 ↦ (gaussianReal 0 (variance s)).prod (bridgeLaw.map (fun β ↦ Real.sqrt (1-(s:ℝ)) • β))) := by + unfold law + rw [Measure.pi_map_pi (fun _ ↦ (show Measurable (fun β : C(Time,ℝ) ↦ (β s,bridgeRemainder s β)) from by fun_prop).aemeasurable)] + simp_rw [scalar_joint] + rw [remainder_law] + have her : law.map (fun β : Noise ↦ fun j ↦ Real.sqrt (1-(s:ℝ)) • β j)= + Measure.pi (fun _ : Fin 3 ↦ bridgeLaw.map (fun β ↦ Real.sqrt (1-(s:ℝ)) • β)) := by + unfold law + rw [Measure.pi_map_pi (fun _ ↦ (show Measurable (fun β : C(Time,ℝ) ↦ Real.sqrt (1-(s:ℝ)) • β) from by fun_prop).aemeasurable)] + rw [her,←hp.map_eq,←he,Measure.map_map hp.measurable (by fun_prop)] + rfl + +lemma independent (s : Time) : IndepFun (eval s) (remainder s) law := + (indepFun_iff_map_prod_eq_prod_map_map (eval_measurable s).aemeasurable (remainder_measurable s).aemeasurable).mpr + (by rw [eval_law]; exact joint_law s) + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/Geometry.lean b/lean/OAI/Analysis/HardSphere/Bridges/Geometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..620a8e6fe7dbbf5f23fed1d7ce2fd96ed475b6a1 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/Geometry.lean @@ -0,0 +1,146 @@ +import Mathlib + +namespace OAI + +section + +section +noncomputable section +open Filter MeasureTheory +open scoped Topology +namespace HardSphere.Bridge + +lemma power_div_identity {D : ℝ} (hD : 0 < D) (p : ℝ) : + D^p/D = D^(p-1) := by + rw [Real.rpow_sub hD,Real.rpow_one] + +lemma source_geometry_eventually {A b t : ℝ} (hA : 0 < A) (hb : 0 < b) (ht : 0 < t) : + ∀ᶠ D : ℝ in atTop, + 1 ≤ D ∧ A/D ≤ 1 ∧ (A/D)^2 ≤ t ∧ + (A/D)*D^(1/12:ℝ) ≤ 1 ∧ 2*A^2 ≤ D ∧ 8*A^2 ≤ D ∧ + 26*(A/D) ≤ t ∧ (13+Real.sqrt (2*t)*D^(1/12:ℝ))*(A/D) ≤ t ∧ + (D⁻¹/t)*13 ≤ (b*D^(-(1/3):ℝ)/8)/12 ∧ + 3*(1+D^(1/12:ℝ)/6) ≤ D^(1/12:ℝ) ∧ + A/D+2*(b*D^(-(1/3):ℝ)/8) < b*D^(-(1/3):ℝ) := by + have h1 : Tendsto (fun D : ℝ ↦ A/D) atTop (𝓝 0) := by + simpa [div_eq_mul_inv] using tendsto_inv_atTop_zero.const_mul A + have h2 : Tendsto (fun D : ℝ ↦ A*D^(-(11/12):ℝ)) atTop (𝓝 0) := by + simpa using (tendsto_rpow_neg_atTop (by norm_num : (0:ℝ) < 11/12)).const_mul A + have h3 : Tendsto (fun D : ℝ ↦ 13*(A/D)+Real.sqrt (2*t)*(A*D^(-(11/12):ℝ))) atTop (𝓝 0) := by + simpa using (h1.const_mul 13).add (h2.const_mul (Real.sqrt (2*t))) + have h4 : Tendsto (fun D : ℝ ↦ D^(-(2/3):ℝ)) atTop (𝓝 0) := + tendsto_rpow_neg_atTop (by norm_num) + have h5 : Tendsto (fun D : ℝ ↦ D^(1/12:ℝ)) atTop atTop := + tendsto_rpow_atTop (by norm_num) + filter_upwards [eventually_ge_atTop (1:ℝ),h1.eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1)), + (h1.pow 2).eventually (gt_mem_nhds (by simpa using ht)), + h2.eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1)), + eventually_ge_atTop (8*A^2), + (h1.const_mul 26).eventually (gt_mem_nhds (by simpa using ht)), + h3.eventually (gt_mem_nhds ht), + h4.eventually (gt_mem_nhds (by positivity : (0:ℝ) < b*t/(96*13))), + h5.eventually (eventually_ge_atTop (6:ℝ)), + h4.eventually (gt_mem_nhds (by positivity : (0:ℝ) < 3*b/(4*A)))] with D hD hd1 hd2 hd3 hd4 hd5 hd6 hd7 hd8 hd9 + have hDp : 0 < D := zero_lt_one.trans_le hD + have hp : (A/D)*D^(1/12:ℝ)=A*D^(-(11/12):ℝ) := by + calc + _ = A*(D^(1/12:ℝ)/D) := by ring + _ = _ := by rw [power_div_identity hDp]; norm_num + have hq : D⁻¹ = D^(-(2/3):ℝ)*D^(-(1/3):ℝ) := by + rw [←Real.rpow_add hDp] + norm_num [Real.rpow_neg_one] + refine ⟨hD,hd1.le,hd2.le,by rw [hp]; exact hd3.le,by nlinarith,hd4,hd5.le,?_,?_,by linarith,?_⟩ + · have he : (13+Real.sqrt (2*t)*D^(1/12:ℝ))*(A/D)= + 13*(A/D)+Real.sqrt (2*t)*(A*D^(-(11/12):ℝ)) := by rw [←hp]; ring + rw [he] + exact hd6.le + · have hh := (lt_div_iff₀ (by norm_num : (0:ℝ) < 96*13)).mp hd7 + rw [hq] + rw [div_mul_eq_mul_div] + apply (div_le_iff₀ ht).mpr + have hmul := mul_le_mul_of_nonneg_right hh.le (by positivity : 0 ≤ D^(-(1/3):ℝ)) + nlinarith + · have hh := (lt_div_iff₀ (by positivity : (0:ℝ) < 4*A)).mp hd9 + have hmul := mul_lt_mul_of_pos_right hh (by positivity : 0 < D^(-(1/3):ℝ)) + rw [div_eq_mul_inv,hq] + nlinarith + +lemma source_trial_geometry {A b t : ℝ} (hA : 0 < A) (hb : 0 < b) (ht : 0 < t) : + ∀ᶠ D : ℝ in atTop, ∀α : ℝ,0 < α → α ≤ A → + let r := α/D + let n := ⌈t/r^2⌉₊ + 1 ≤ D ∧ 0 < n ∧ r ≤ 1 ∧ r*D^(1/12:ℝ) ≤ 1 ∧ + t/(n:ℝ) ≤ r^2 ∧ (n:ℝ)*r^2 ≤ 2*t ∧ + 0 ≤ D⁻¹/t ∧ D⁻¹/t ≤ 1 ∧ + 2*(t/(n:ℝ)) ≤ D⁻¹ ∧ 8*t ≤ (n:ℝ)*D⁻¹ ∧ + 2*13/(n:ℝ) ≤ r ∧ (13+Real.sqrt (2*t)*D^(1/12:ℝ))/(n:ℝ) ≤ r ∧ + (D⁻¹/t)*13 ≤ (b*D^(-(1/3):ℝ)/8)/12 ∧ + 3*(1+D^(1/12:ℝ)/6) ≤ D^(1/12:ℝ) ∧ + r+2*(b*D^(-(1/3):ℝ)/8) < b*D^(-(1/3):ℝ) := by + filter_upwards [source_geometry_eventually hA hb ht,eventually_ge_atTop t⁻¹] with D h hd + rcases h with ⟨hD,hA1,hAsq,hAR,hD2,hD8,h26,hQ,hwin,hrelax,hiso⟩ + intro α hα hαA + dsimp only + let r := α/D + let n := ⌈t/r^2⌉₊ + have hDp : 0 < D := zero_lt_one.trans_le hD + have hr : 0 < r := by dsimp [r]; positivity + have hrA : r ≤ A/D := div_le_div_of_nonneg_right hαA hDp.le + have hn : 0 < n := Nat.ceil_pos.mpr (by positivity : 0 < t/r^2) + have hnp : 0 < (n:ℝ) := by exact_mod_cast hn + have hnr : t ≤ (n:ℝ)*r^2 := by + have hh := (div_le_iff₀ (sq_pos_of_pos hr)).mp (Nat.le_ceil (t/r^2)) + exact hh + have hτ : t/(n:ℝ) ≤ r^2 := (div_le_iff₀ hnp).mpr (by nlinarith [hnr]) + have hrs : r^2 ≤ t := (pow_le_pow_left₀ hr.le hrA 2).trans hAsq + have hup : (n:ℝ)*r^2 ≤ 2*t := by + have hh := mul_le_mul_of_nonneg_right (Nat.ceil_lt_add_one (by positivity : 0 ≤ t/r^2)).le (sq_nonneg r) + have he : (t/r^2+1)*r^2=t+r^2 := by field_simp + rw [he] at hh + nlinarith + have hsq : r^2 ≤ D⁻¹/8 := by + calc + _ ≤ (A/D)^2 := pow_le_pow_left₀ hr.le hrA 2 + _ ≤ (1/8)/D := by + apply (le_div_iff₀ hDp).mpr + have he : (A/D)^2*D=A^2/D := by field_simp + rw [he] + exact (div_le_iff₀ hDp).mpr (by linarith) + _ = _ := by ring + have htime : D⁻¹/t ≤ 1 := by + apply (div_le_iff₀ ht).mpr + simp only [one_mul] + rw [←one_div] + apply (div_le_iff₀ hDp).mpr + have hh := mul_le_mul_of_nonneg_left hd ht.le + simpa [mul_inv_cancel₀ ht.ne'] using hh + have hsmall : r*D^(1/12:ℝ) ≤ 1 := (mul_le_mul_of_nonneg_right hrA (by positivity)).trans hAR + have hdr : 26/(n:ℝ) ≤ r := by + apply (div_le_iff₀ hnp).mpr + have hh : 26*r ≤ t := (mul_le_mul_of_nonneg_left hrA (by norm_num)).trans h26 + nlinarith + have hdr' : (13+Real.sqrt (2*t)*D^(1/12:ℝ))/(n:ℝ) ≤ r := by + apply (div_le_iff₀ hnp).mpr + have hq : 0 ≤ 13+Real.sqrt (2*t)*D^(1/12:ℝ) := by positivity + have hh := (mul_le_mul_of_nonneg_left hrA hq).trans hQ + nlinarith + refine ⟨hD,hn,hrA.trans hA1,hsmall,hτ,hup,by positivity,htime,?_,?_,?_,hdr',hwin,hrelax,?_⟩ + · change 2*(t/(n:ℝ)) ≤ D⁻¹ + nlinarith [inv_pos.mpr hDp] + · change 8*t ≤ (n:ℝ)*D⁻¹ + have hh := mul_le_mul_of_nonneg_left hsq hnp.le + nlinarith + · change 2*13/(n:ℝ) ≤ r + convert hdr using 1 + norm_num + · change r+2*(b*D^(-(1/3):ℝ)/8) < b*D^(-(1/3):ℝ) + linarith + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/GroundBridge.lean b/lean/OAI/Analysis/HardSphere/Bridges/GroundBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..26a710ca25b90a5de75f3012afd10d4b28cce9d9 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/GroundBridge.lean @@ -0,0 +1,110 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.BridgeResidual +import OAI.Analysis.HardSphere.Geometry.GroundPathWeight + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set Filter +open scoped ENNReal NNReal Topology +namespace HardSphere +open Wiener + +lemma preserving_weighted {A B : Type*} [MeasurableSpace A] [MeasurableSpace B] + {μ : Measure A} {ν : Measure B} {T : A→B} (hT : MeasurePreserving T μ ν) + (f : B→ℝ≥0∞) (hf : Measurable f) : + MeasurePreserving T (μ.withDensity (f∘T)) (ν.withDensity f) := by + refine ⟨hT.measurable,?_⟩ + ext S hS + rw [Measure.map_apply hT.measurable hS,withDensity_apply _ (hS.preimage hT.measurable),withDensity_apply _ hS] + exact (hT.restrict_preimage hS).lintegral_comp hf + +abbrev BridgeEndpoints (N : ℕ) (L : Length) := (Direction N→ℝ)×Configuration N L + +def bridgeEndpointBase (N : ℕ) (L : Length) : Measure (BridgeEndpoints N L) := + (gaussianCoordinates N).prod volume + +def endpointBridgePath (N : ℕ) (L : Length) (t : ℝ) + (p : BridgeEndpoints N L×CoordinatePaths N) : ConfigurationPath N L := + freeTrajectory N L t (reconstructCoordinates N (p.1.1,p.2)) p.1.2 + +lemma endpointBridgePath_continuous (N : ℕ) (L : Length) (t : ℝ) : + Continuous (endpointBridgePath N L t) := by + exact (freeTrajectory_continuous N L t).comp + (((reconstructCoordinates_continuous N).comp (continuous_fst.fst.prodMk continuous_snd)).prodMk continuous_fst.snd) + +lemma endpointBridgePath_preserving (N : ℕ) (L : Length) (t : ℝ) : + MeasurePreserving (endpointBridgePath N L t) + ((bridgeEndpointBase N L).prod (coordinateBridge N)) (freePathLaw N L t) := by + have h₁ := measurePreserving_prodAssoc (gaussianCoordinates N) (volume : Measure (Configuration N L)) (coordinateBridge N) + have h₂ := (MeasurePreserving.id (gaussianCoordinates N)).prod + (Measure.measurePreserving_swap (μ:=(volume : Measure (Configuration N L))) (ν:=coordinateBridge N)) + have h₃ := (measurePreserving_prodAssoc (gaussianCoordinates N) (coordinateBridge N) (volume : Measure (Configuration N L))).symm MeasurableEquiv.prodAssoc + have h₄ := (reconstructCoordinates_preserving N).prod (MeasurePreserving.id (volume : Measure (Configuration N L))) + have h₅ : MeasurePreserving (fun p : CoordinatePaths N×Configuration N L ↦ freeTrajectory N L t p.1 p.2) + ((coordinateWiener N).prod volume) (freePathLaw N L t) := ⟨(freeTrajectory_continuous N L t).measurable,rfl⟩ + exact h₅.comp (h₄.comp (h₃.comp (h₂.comp h₁))) + +def bridgeEnd (N : ℕ) (L : Length) (t : ℝ) (e : BridgeEndpoints N L) : Configuration N L := + fun i j ↦ e.2 i j+((Real.sqrt (2*t)*e.1 (i,j):ℝ):AddCircle L.val) +lemma bridgeEnd_continuous (N : ℕ) (L : Length) (t : ℝ) : Continuous (bridgeEnd N L t) := by + unfold bridgeEnd + fun_prop + +def endpointWeight {N : ℕ} {L : Length} (u : Jet N L) (t : ℝ) (e : BridgeEndpoints N L) : ℝ≥0∞ := + ENNReal.ofReal (Real.exp (t*energy u)*(‖u.1 e.2‖*‖u.1 (bridgeEnd N L t e)‖)) +lemma endpointWeight_measurable {N : ℕ} {L : Length} (u : Jet N L) (t : ℝ) : Measurable (endpointWeight u t) := by + unfold endpointWeight + exact (measurable_const.mul (((Lp.stronglyMeasurable u.1).measurable.comp measurable_snd).norm.mul + (((Lp.stronglyMeasurable u.1).measurable.comp (bridgeEnd_continuous N L t).measurable).norm))).ennreal_ofReal + +lemma endpointBridge_weight {N : ℕ} {L : Length} (u : Jet N L) (t : ℝ) : + (fun p : BridgeEndpoints N L×CoordinatePaths N ↦ endpointWeight u t p.1)=ᵐ[(bridgeEndpointBase N L).prod (coordinateBridge N)] + fun p ↦ ENNReal.ofReal (groundPathWeight u t (endpointBridgePath N L t p)) := by + have h : ∀ᵐ p : BridgeEndpoints N L×CoordinatePaths N ∂(bridgeEndpointBase N L).prod (coordinateBridge N), + ∀j, p.2 j (0:Time)=0 ∧ p.2 j (1:Time)=0 := + (Measure.ae_prod_iff_ae_ae (by measurability)).mpr (ae_of_all _ (fun _ ↦ coordinateBridge_endpoints N)) + filter_upwards [h] with p hp + have h0 : endpointBridgePath N L t p 0=p.1.2 := by + ext i j + change p.1.2 i j+((Real.sqrt (2*t)*(p.1.1 (i,j) • linearPath+p.2 (i,j)) 0:ℝ):AddCircle L.val)=p.1.2 i j + simp [hp,linearPath] + have h1 : endpointBridgePath N L t p 1=bridgeEnd N L t p.1 := by + ext i j + change p.1.2 i j+((Real.sqrt (2*t)*(p.1.1 (i,j) • linearPath+p.2 (i,j)) 1:ℝ):AddCircle L.val)=_ + simp [hp,linearPath,bridgeEnd] + simp [endpointWeight,groundPathWeight,h0,h1] + +def endpointInteraction (N : ℕ) (L : Length) (a t : ℝ) : Set (BridgeEndpoints N L×CoordinatePaths N) := + endpointBridgePath N L t ⁻¹' staysAllowed N L a +lemma endpointInteraction_measurable (N : ℕ) (L : Length) (a t : ℝ) : MeasurableSet (endpointInteraction N L a t) := + (staysAllowed_open N L a).measurableSet.preimage (endpointBridgePath_continuous N L t).measurable + +def endpointWeightedBase {N : ℕ} {L : Length} (u : Jet N L) (t : ℝ) : Measure (BridgeEndpoints N L) := + (bridgeEndpointBase N L).withDensity (endpointWeight u t) + +lemma genuine_ground_bridge {N : ℕ} {L : Length} (u : Jet N L) (a t : ℝ) : + (((endpointWeightedBase u t).prod (coordinateBridge N)).restrict (endpointInteraction N L a t)).map (endpointBridgePath N L t)= + groundPathLaw N L a t u := by + have hf := endpointBridgePath_preserving N L t + have hw := preserving_weighted (hf.restrict_preimage (staysAllowed_open N L a).measurableSet) + (fun ω ↦ ENNReal.ofReal (groundPathWeight u t ω)) (groundPathWeight_measurable u t).ennreal_ofReal + change _=(killedPathLaw N L a t).withDensity _ + rw [endpointWeightedBase,prod_withDensity_left (endpointWeight_measurable u t),restrict_withDensity (endpointInteraction_measurable N L a t)] + have he : ((fun p : BridgeEndpoints N L×CoordinatePaths N ↦ endpointWeight u t p.1))=ᵐ[((bridgeEndpointBase N L).prod (coordinateBridge N)).restrict (endpointInteraction N L a t)] + ((fun ω ↦ ENNReal.ofReal (groundPathWeight u t ω))∘endpointBridgePath N L t) := + (Measure.absolutelyContinuous_of_le Measure.restrict_le_self).ae_le (endpointBridge_weight u t) + rw [withDensity_congr_ae he] + exact hw.map_eq + +end HardSphere + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/IncrementMoment.lean b/lean/OAI/Analysis/HardSphere/Bridges/IncrementMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa83e96504dec547b51a5fe66cc6d2e3b030e610 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/IncrementMoment.lean @@ -0,0 +1,160 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.BridgeNoise + +namespace OAI + +noncomputable section +open MeasureTheory MeasureTheory.Measure Set Filter ProbabilityTheory +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Wiener + +def incrementMap (s u : Time) : C(Time,ℝ) →L[ℝ] C(Time,ℝ) := (prefixMap u).comp (suffixMap s) +@[simp] lemma incrementMap_apply (s u : Time) (f : C(Time,ℝ)) (q : Time) : + incrementMap s u f q=f (suffixTime s (prefixTime u q))-f s := rfl +lemma suffix_wiener_law (s : Time) : wiener.map (suffixMap s)=wiener.map (fun β ↦ Real.sqrt (1-(s:ℝ)) • β) := by + rw [wiener,Measure.map_map (suffixMap s).continuous.measurable measurable_path, + Measure.map_map (by fun_prop) measurable_path] + exact suffix_law s +lemma increment_wiener_mean (s u : Time) : + ∫β : C(Time,ℝ),‖incrementMap s u β‖^3 ∂wiener = + (Real.sqrt ((1-(s:ℝ))*(u:ℝ)))^3*normCubeMean := by + change (∫β : C(Time,ℝ),‖prefixMap u (suffixMap s β)‖^3 ∂wiener)=_ + rw [←integral_map (f:=fun β : C(Time,ℝ) ↦ ‖prefixMap u β‖^3) (suffixMap s).continuous.measurable.aemeasurable (by fun_prop),suffix_wiener_law, + integral_map (by fun_prop) (by fun_prop)] + simp only [map_smul,norm_smul,Real.norm_eq_abs,abs_of_nonneg (Real.sqrt_nonneg _),mul_pow,integral_const_mul] + rw [prefix_normCube,Real.sqrt_mul (sub_nonneg.mpr s.property.2),mul_pow] + ring + +lemma increment_center_norm (s u : Time) (f : C(Time,ℝ)) : + ‖incrementMap s u (centerMap f)‖≤‖incrementMap s u f‖+((1-(s:ℝ))*(u:ℝ))*‖f‖ := by + apply (ContinuousMap.norm_le _ (add_nonneg (norm_nonneg _) (mul_nonneg (mul_nonneg (sub_nonneg.mpr s.property.2) u.property.1) (norm_nonneg _)))).mpr + intro q + have hs0 := sub_nonneg.mpr s.property.2 + have hu0 := u.property.1 + have hq0 := q.property.1 + have he : incrementMap s u (centerMap f) q=incrementMap s u f q- + ((1-(s:ℝ))*(u:ℝ)*(q:ℝ))*f 1 := by + simp only [incrementMap_apply,centerMap_apply] + dsimp [suffixTime,prefixTime] + ring + rw [he] + apply (norm_sub_le _ _).trans + apply add_le_add (ContinuousMap.norm_coe_le_norm _ _) + rw [norm_mul,Real.norm_eq_abs,abs_of_nonneg (by positivity)] + apply mul_le_mul _ (ContinuousMap.norm_coe_le_norm f 1) (norm_nonneg _) (by positivity) + exact mul_le_of_le_one_right (by positivity) q.property.2 + +lemma increment_bridge_mean (s u : Time) : + ∫β : C(Time,ℝ),‖incrementMap s u β‖^3 ∂bridgeLaw ≤ + 8*(Real.sqrt ((1-(s:ℝ))*(u:ℝ)))^3*normCubeMean := by + let δ := (1-(s:ℝ))*(u:ℝ) + have hd : 0≤δ := mul_nonneg (sub_nonneg.mpr s.property.2) u.property.1 + have hd1 : δ≤1 := by dsimp [δ]; nlinarith [s.property.1,s.property.2,u.property.1,u.property.2] + have hp : Integrable (fun f : C(Time,ℝ) ↦ ‖incrementMap s u (centerMap f)‖^3) wiener := + ((IsGaussian.memLp_id wiener 3 (by norm_num)).continuousLinearMap_comp ((incrementMap s u).comp centerMap)).integrable_norm_pow (by norm_num) + have hi : Integrable (fun f : C(Time,ℝ) ↦ ‖incrementMap s u f‖^3) wiener := + ((IsGaussian.memLp_id wiener 3 (by norm_num)).continuousLinearMap_comp (incrementMap s u)).integrable_norm_pow (by norm_num) + rw [bridgeLaw_center,integral_map centerMap.continuous.measurable.aemeasurable (by fun_prop)] + calc + _ ≤ ∫f : C(Time,ℝ),4*(‖incrementMap s u f‖^3+δ^3*‖f‖^3) ∂wiener := by + apply integral_mono hp ((hi.add (integrable_normCube.const_mul _)).const_mul _) + intro f + exact (pow_le_pow_left₀ (norm_nonneg _) (increment_center_norm s u f) 3).trans + (by simpa only [mul_pow,Pi.add_apply,δ] using cube_add_le (norm_nonneg (incrementMap s u f)) (mul_nonneg hd (norm_nonneg f))) + _ = 4*((Real.sqrt δ)^3*normCubeMean+δ^3*normCubeMean) := by + rw [integral_const_mul,integral_add hi (integrable_normCube.const_mul _),integral_const_mul,increment_wiener_mean] + rfl + _ ≤ _ := by + have hds : δ≤Real.sqrt δ := Real.le_sqrt_of_sq_le (by nlinarith) + have hh := mul_le_mul_of_nonneg_right (pow_le_pow_left₀ hd hds 3) normCubeMean_nonneg + change _ ≤ 8*(Real.sqrt δ)^3*normCubeMean + linarith + +end HardSphere.Wiener + +namespace HardSphere.Bridge +open Wiener GaussianPacking + +def incrementSize (s u : Time) (β : Noise) : ℝ := ∑j,‖incrementMap s u (β j)‖ +lemma incrementSize_nonneg (s u : Time) (β : Noise) : 0 ≤ incrementSize s u β := Finset.sum_nonneg (fun _ _ ↦ norm_nonneg _) +lemma incrementSize_continuous (s u : Time) : Continuous (incrementSize s u) := by unfold incrementSize; fun_prop +lemma incrementSize_smul (s u : Time) (c : ℝ) (β : Noise) : + incrementSize s u (fun j ↦ c • β j)=|c| *incrementSize s u β := by + simp only [incrementSize,map_smul,norm_smul,Real.norm_eq_abs,Finset.mul_sum] +lemma incrementSize_memLp (s u : Time) : MemLp (incrementSize s u) 3 law := by + apply memLp_finsetSum + intro j hj + have h := ((IsGaussian.memLp_id bridgeLaw 3 (by norm_num)).continuousLinearMap_comp (incrementMap s u)).norm + exact h.comp_measurePreserving (measurePreserving_eval (fun _ : Fin 3 ↦ bridgeLaw) j) + +lemma incrementSize_cube_integrable (s u : Time) : Integrable (fun β ↦ (incrementSize s u β)^3) law := by + simpa only [Real.norm_eq_abs,abs_of_nonneg (incrementSize_nonneg s u _)] using + (incrementSize_memLp s u).integrable_norm_pow (by norm_num : (3:ℕ)≠0) + +lemma incrementSize_cube_mean (s u : Time) : + ∫β,(incrementSize s u β)^3 ∂law ≤ 384*(Real.sqrt ((1-(s:ℝ))*(u:ℝ)))^3*normCubeMean := by + have hi j : Integrable (fun β : Noise ↦ ‖incrementMap s u (β j)‖^3) law := by + exact (((IsGaussian.memLp_id bridgeLaw 3 (by norm_num)).continuousLinearMap_comp (incrementMap s u)).comp_measurePreserving + (measurePreserving_eval (fun _ : Fin 3 ↦ bridgeLaw) j)).integrable_norm_pow (by norm_num : (3:ℕ)≠0) + calc + _ ≤ ∫β,16*(∑j,‖incrementMap s u (β j)‖^3) ∂law := by + apply integral_mono (incrementSize_cube_integrable s u) ((integrable_finsetSum _ (fun j _ ↦ hi j)).const_mul _) + intro β + exact sum_three_cube _ (fun j ↦ norm_nonneg _) + _ = 16*(∑j : Fin 3,∫β : C(Time,ℝ),‖incrementMap s u β‖^3 ∂bridgeLaw) := by + rw [integral_const_mul,integral_finsetSum _ (fun j _ ↦ hi j)] + congr 1 + apply Finset.sum_congr rfl + intro j hj + have hm := measurePreserving_eval (fun _ : Fin 3 ↦ bridgeLaw) j + rw [←hm.map_eq,integral_map hm.measurable.aemeasurable (show Continuous (fun β : C(Time,ℝ) ↦ ‖incrementMap s u β‖^3) from (incrementMap s u).continuous.norm.pow 3).aestronglyMeasurable] + rfl + _ ≤ 16*(∑_j : Fin 3,8*(Real.sqrt ((1-(s:ℝ))*(u:ℝ)))^3*normCubeMean) := by + exact mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun _ _ ↦ increment_bridge_mean s u)) (by norm_num) + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul]; ring + +def incrementFluctuation (t r : ℝ) (s w : Time) (β : Noise) : ℝ := Real.sqrt (2*t)/r*incrementSize s w β +lemma incrementFluctuation_continuous (t r : ℝ) (s w : Time) : Continuous (incrementFluctuation t r s w) := + (incrementSize_continuous s w).const_mul _ +lemma incrementFluctuation_nonneg {t r : ℝ} (hr : 0 ≤ r) (s w : Time) (β : Noise) : 0 ≤ incrementFluctuation t r s w β := + mul_nonneg (div_nonneg (Real.sqrt_nonneg _) hr) (incrementSize_nonneg s w β) +lemma incrementFluctuation_memLp (t r : ℝ) (s w : Time) : MemLp (incrementFluctuation t r s w) 3 law := + (incrementSize_memLp s w).const_mul _ + +lemma incrementFluctuation_mean {t r : ℝ} (ht : 0 ≤ t) (hr : 0.comp (tendsto_const_nhds.mul hω)).mul_const I) + have hlim' : Tendsto (fun n ↦ charFun (P.map (X n)) t) atTop + (𝓝 (charFun (gaussianReal m₀ v₀) t)) := by + simp_rw [(hX _).map_eq, charFun_gaussianReal] + exact continuous_exp.continuousAt.tendsto.comp + (((tendsto_const_nhds.mul (continuous_ofReal.tendsto _ |>.comp hm)).mul_const I).sub + (((continuous_ofReal.tendsto _ |>.comp (NNReal.continuous_coe.tendsto _ |>.comp hv)).mul_const + ((t : ℂ)^2)).div_const 2)) + exact tendsto_nhds_unique hlim hlim' + +lemma hasLaw_centered_gaussian_sum {ι Ω : Type*} [Fintype ι] [MeasurableSpace Ω] + {P : Measure Ω} [IsProbabilityMeasure P] {X : ι → Ω → ℝ} {v : ι → ℝ≥0} + (hX : ∀ i, HasLaw (X i) (gaussianReal 0 (v i)) P) (hind : iIndepFun X P) : + HasLaw (fun ω ↦ ∑ i, X i ω) (gaussianReal 0 (∑ i, v i)) P := by + classical + have hg := hind.hasGaussianLaw_fun_sum (fun i ↦ (hX i).hasGaussianLaw) + have hmean : ∫ ω, ∑ i, X i ω ∂P = 0 := by + rw [integral_finsetSum _ (fun i _ ↦ (hX i).hasGaussianLaw.integrable)] + simp only [(hX _).integral_eq, integral_id_gaussianReal, Finset.sum_const_zero] + have hvar : Var[fun ω ↦ ∑ i, X i ω; P] = ∑ i, (v i : ℝ) := by + have hh := IndepFun.variance_sum (s := Finset.univ) + (fun i _ ↦ (hX i).hasGaussianLaw.memLp_two) + (fun i _ j _ hij ↦ hind.indepFun hij) + have he : (fun ω ↦ ∑ i, X i ω) = ∑ i, X i := by funext ω; simp + rw [he] + simpa only [(hX _).variance_eq, variance_id_gaussianReal] using hh + refine ⟨hg.aemeasurable, ?_⟩ + rw [hg.map_eq_gaussianReal, hmean, hvar] + simp only [← NNReal.coe_sum, Real.toNNReal_coe] + +def leftIndex (n : ℕ) (k : Fin (2^n)) : Fin (2^(n+1)) := + ⟨k.val, by have := k.isLt; simp only [pow_succ]; omega⟩ +def rightIndex (n : ℕ) (k : Fin (2^n)) : Fin (2^(n+1)) := + ⟨2^n + k.val, by have := k.isLt; simp only [pow_succ]; omega⟩ + +lemma sum_split_level (n : ℕ) (f : Fin (2^(n+1)) → ℝ) : + ∑ k, f k = ∑ k, f (leftIndex n k) + ∑ k, f (rightIndex n k) := by + let e : Fin (2^n + 2^n) ≃ Fin (2^(n+1)) := + finCongr (by simp [pow_succ, Nat.mul_two]) + rw [← Equiv.sum_comp e, Fin.sum_univ_add] + rfl + +lemma tent_left (n : ℕ) (k : Fin (2^n)) (s : ℝ) : + tent (n+1) (leftIndex n k) s = tent n k (2*s) := by + unfold tent leftIndex + congr 3 + simp only [pow_succ] + ring + +lemma tent_right (n : ℕ) (k : Fin (2^n)) (s : ℝ) : + tent (n+1) (rightIndex n k) s = tent n k (2*s-1) := by + unfold tent rightIndex + congr 3 + simp only [pow_succ, Nat.cast_add, Nat.cast_pow, Nat.cast_ofNat] + ring + +lemma tent_nonpos (n : ℕ) (k : Fin (2^n)) {s : ℝ} (hs : s ≤ 0) : tent n k s = 0 := by + unfold tent + apply max_eq_left + have hpow : 0 ≤ (2:ℝ)^(n+1) := by positivity + have hx : (2:ℝ)^(n+1)*s ≤ 0 := mul_nonpos_of_nonneg_of_nonpos hpow hs + rw [abs_of_nonpos (by linarith [show (0:ℝ) ≤ k by positivity])] + linarith [show (0:ℝ) ≤ k by positivity] + +lemma tent_ge_one (n : ℕ) (k : Fin (2^n)) {s : ℝ} (hs : 1 ≤ s) : tent n k s = 0 := by + have hk : (k : ℝ) + 1 ≤ (2:ℝ)^n := by exact_mod_cast k.isLt + have hp : 0 < (2:ℝ)^n := by positivity + have hx : (2:ℝ)^n*2 ≤ (2:ℝ)^n*2*s := le_mul_of_one_le_right (by positivity) hs + unfold tent + simp only [pow_succ] + rw [abs_of_nonneg (by linarith : (0:ℝ) ≤ (2:ℝ)^n*2*s-(2*(k:ℝ)+1))] + exact max_eq_left (by linarith) + +def hatKernel (n : ℕ) (s t : ℝ) : ℝ := ∑ k : Fin (2^n), tent n k s * tent n k t + +def weight (n : ℕ) : ℝ := (1/4 : ℝ)*(1/2 : ℝ)^n + +def partialBridge (n : ℕ) (s t : ℝ) : ℝ := + ∑ m ∈ Finset.range n, weight m * hatKernel m s t + +lemma hatKernel_rec (n : ℕ) (s t : ℝ) : + hatKernel (n+1) s t = hatKernel n (2*s) (2*t) + hatKernel n (2*s-1) (2*t-1) := by + unfold hatKernel + rw [sum_split_level] + simp only [tent_left, tent_right] + +lemma partialBridge_zero_left (n : ℕ) {s : ℝ} (hs : s ≤ 0 ∨ 1 ≤ s) (t : ℝ) : + partialBridge n s t = 0 := by + rcases hs with hs | hs <;> simp [partialBridge, hatKernel, tent_nonpos, tent_ge_one, hs] + +lemma partialBridge_zero_right (n : ℕ) (s : ℝ) {t : ℝ} (ht : t ≤ 0 ∨ 1 ≤ t) : + partialBridge n s t = 0 := by + rcases ht with ht | ht <;> simp [partialBridge, hatKernel, tent_nonpos, tent_ge_one, ht] + +lemma partialBridge_rec (n : ℕ) (s t : ℝ) : + partialBridge (n+1) s t = (1/4 : ℝ) * tent 0 0 s * tent 0 0 t + + (1/2 : ℝ)*(partialBridge n (2*s) (2*t) + partialBridge n (2*s-1) (2*t-1)) := by + have h0 : hatKernel 0 s t = tent 0 0 s * tent 0 0 t := by + simp [hatKernel] + have hx : ∑ m ∈ Finset.range n, weight (m+1)*hatKernel (m+1) s t = + (1/2 : ℝ)*(partialBridge n (2*s) (2*t) + partialBridge n (2*s-1) (2*t-1)) := by + simp only [partialBridge, mul_add, Finset.mul_sum, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro m _ + rw [hatKernel_rec] + simp only [weight, pow_succ] + ring + change (∑ m ∈ Finset.range (n+1), weight m * hatKernel m s t) = _ + rw [Finset.sum_range_succ', hx, h0] + simp only [weight, pow_zero, mul_one] + ring + +lemma tent_zero_left {s : ℝ} (h0 : 0 ≤ s) (h1 : s ≤ 1/2) : tent 0 0 s = 2*s := by + simp only [tent, pow_one, Fin.val_zero, Nat.cast_zero, mul_zero, zero_add] + rw [abs_of_nonpos (by linarith), max_eq_right (by linarith)] + ring + +lemma tent_zero_right {s : ℝ} (h0 : 1/2 ≤ s) (h1 : s ≤ 1) : tent 0 0 s = 2*(1-s) := by + simp only [tent, pow_one, Fin.val_zero, Nat.cast_zero, mul_zero, zero_add] + rw [abs_of_nonneg (by linarith), max_eq_right (by linarith)] + ring + +lemma weight_step (n : ℕ) : weight (n+1) = (1/2 : ℝ)*weight n := by + simp only [weight, pow_succ] + ring + +lemma abs_half_mul (x : ℝ) : |(1/2 : ℝ)*x| = (1/2 : ℝ)*|x| := by + rw [abs_mul] + norm_num + +lemma partialBridge_error_ordered (n : ℕ) {s t : ℝ} + (hs : 0 ≤ s) (ht : t ≤ 1) (hst : s ≤ t) : + |partialBridge n s t - (s-s*t)| ≤ weight n := by + induction n generalizing s t with + | zero => + have hnn : 0 ≤ s-s*t := by nlinarith + have hb : s-s*t ≤ (1/4 : ℝ) := by nlinarith [sq_nonneg (s-1/2)] + simp only [partialBridge, Finset.range_zero, Finset.sum_empty, zero_sub, + abs_neg, abs_of_nonneg hnn, weight, pow_zero, mul_one] + exact hb + | succ n ih => + rw [partialBridge_rec, weight_step] + by_cases ht2 : t ≤ 1/2 + · have hs2 : s ≤ 1/2 := hst.trans ht2 + rw [tent_zero_left hs hs2, tent_zero_left (hs.trans hst) ht2, + partialBridge_zero_left n (Or.inl (by linarith : 2*s-1 ≤ 0)), add_zero] + have hh := ih (s := 2*s) (t := 2*t) (by linarith) (by linarith) (by linarith) + calc + _ = (1/2 : ℝ)*|partialBridge n (2*s) (2*t) - (2*s-(2*s)*(2*t))| := by + rw [← abs_half_mul] + congr 1 + ring + _ ≤ _ := mul_le_mul_of_nonneg_left hh (by norm_num) + · by_cases hs2 : 1/2 ≤ s + · rw [tent_zero_right hs2 (hst.trans ht), tent_zero_right (hs2.trans hst) ht, + partialBridge_zero_left n (Or.inr (by linarith : 1 ≤ 2*s)), zero_add] + have hh := ih (s := 2*s-1) (t := 2*t-1) (by linarith) (by linarith) (by linarith) + calc + _ = (1/2 : ℝ)*|partialBridge n (2*s-1) (2*t-1) - ((2*s-1)-(2*s-1)*(2*t-1))| := by + rw [← abs_half_mul] + congr 1 + ring + _ ≤ _ := mul_le_mul_of_nonneg_left hh (by norm_num) + · rw [tent_zero_left hs (by linarith), tent_zero_right (by linarith) ht, + partialBridge_zero_right n _ (Or.inr (by linarith : 1 ≤ 2*t)), + partialBridge_zero_left n (Or.inl (by linarith : 2*s-1 ≤ 0))] + have he : (1/4 : ℝ)*(2*s)*(2*(1-t)) + (1/2)*(0+0) - (s-s*t) = 0 := by ring + rw [he, abs_zero] + unfold weight + positivity + +end HardSphere.Wiener +end +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/JointCollision.lean b/lean/OAI/Analysis/HardSphere/Bridges/JointCollision.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4c57c9d575e97a33db046abc379a2340d122e7c --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/JointCollision.lean @@ -0,0 +1,64 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.PhysicalSuccess +import OAI.Analysis.HardSphere.Geometry.LocalCheck + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Bridge +open Wiener GaussianPacking Comparison + +lemma jointCollision_closed {L : Length} (r : ℝ) : + IsClosed {p : C(Time,Point)×C(Time,Point) | TrialCollision r (projectCurve L p.2) p.1} := by + let E : Set ((C(Time,Point)×C(Time,Point))×Time) := + {p | torusDistance L (projectPoint L (p.1.1 p.2)) (projectPoint L (p.1.2 p.2))≤r} + have hE : IsClosed E := by + apply isClosed_le _ continuous_const + apply (torusDistance_continuous_pair L).comp (f:=fun p : (C(Time,Point)×C(Time,Point))×Time ↦ + (projectPoint L (p.1.1 p.2),projectPoint L (p.1.2 p.2))) + unfold projectPoint + fun_prop + convert isClosedMap_fst_of_compactSpace E hE using 1 + ext p + simp only [TrialCollision,mem_ofPred_eq,mem_image,E] + exact ⟨fun ⟨s,hs⟩ ↦ ⟨(p,s),hs,rfl⟩,fun ⟨⟨q,s⟩,hs,hq⟩ ↦ by + change q=p at hq + subst q + exact ⟨s,hs⟩⟩ + +variable {I : Type*} [DecidableEq I] {L : Length} + (S : I→Set C(Time,Point)) + +def physicalPairCheck (r : ℝ) (i j : I) (hij : i≠j) : LocalCheck (fun i ↦ S i) where + support := {i,j} + nonempty := ⟨i,by simp⟩ + arity := (Finset.card_pair hij).le + pass x := ¬TrialCollision r (projectCurve L (x j).val) (x i).val + measurable_pass := by + have hm : Measurable (fun x : ∀i,S i ↦ ((x i).val,(x j).val)) := by fun_prop + exact ((jointCollision_closed (L:=L) r).measurableSet.preimage hm).compl + depends x y h := by + rw [h i (by simp),h j (by simp)] + +lemma physicalPairCheck_symmetric (r : ℝ) (f g : C(Time,Point)) : + TrialCollision (L:=L) r (projectCurve L g) f ↔ TrialCollision r (projectCurve L f) g := by + unfold TrialCollision + apply exists_congr + intro s + change torusDistance L (projectPoint L (f s)) (projectPoint L (g s))≤r ↔ + torusDistance L (projectPoint L (g s)) (projectPoint L (f s))≤r + rw [torusDistance_comm] + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/LocalReference.lean b/lean/OAI/Analysis/HardSphere/Bridges/LocalReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5817e71b9fc414bebb36fb53bf094f99c469bf6 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/LocalReference.lean @@ -0,0 +1,163 @@ +import Mathlib +import OAI.Analysis.HardSphere.Kernels.ParameterSuccess +import OAI.Analysis.HardSphere.Kernels.TrialObserved +import OAI.Analysis.HardSphere.Bridges.BridgeReference +import OAI.Analysis.HardSphere.Kernels.KernelDensity + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology +namespace HardSphere.Bridge +open Wiener GaussianPacking Comparison + +def targetUniform (A : Set Point) : Measure Point := (volume A)⁻¹ • volume.restrict A +lemma targetUniform_probability {A : Set Point} (hA0 : volume A≠0) (hAfinite : volume A≠⊤) : IsProbabilityMeasure (targetUniform A) := by + constructor + simp only [targetUniform,Measure.smul_apply,Measure.restrict_apply_univ,smul_eq_mul] + exact ENNReal.inv_mul_cancel hA0 hAfinite + +def midpointLower (t C : ℝ) : ℝ≥0∞ := ENNReal.ofReal (densityLower ((2*t)⁻¹) C) +lemma midpointLower_pos {t : ℝ} (ht : 0 ring_nf + +def meshHitUnion {n : ℕ} (I : Finset (Fin n)) (t : ℝ) (y : Point) (B : Set Point) + (c : Fin n→C(Time,Point)) (r C : ℝ) : Set (Point×Noise) := + ⋃j∈I,combinedSegmentHit t y B (meshTime j 0) (meshRemainder j) (c j) r C + +lemma mesh_hit_sum {m n : ℕ} (y : Fin m→Point) (I : Finset (Fin n)) + (c : Fin n→C(Time,Point)) (A : Fin n→ℝ) {t r C ε : ℝ} + (ht : 0.comp (continuous_fst.fst.prodMk continuous_snd)).prodMk + (freeTrajectory_continuous N L t |>.comp (continuous_fst.snd.prodMk + ((freeTrajectory_continuous N L s |>.comp (continuous_fst.fst.prodMk continuous_snd)).eval continuous_const)))).measurable + rw [freePathLaw,Measure.map_map + ((configurationPrefix_continuous N L _).prodMk (configurationSuffix_continuous N L _)).measurable + (freeTrajectory_continuous N L (s+t)).measurable,← h.map_eq,Measure.map_map hm h.measurable] + congr 1 + funext p + apply Prod.ext + · exact prefix_freeTrajectory N L s t hs ht p.1 p.2 + · dsimp only [Function.comp_def,Prod.map,id_eq] + rw [suffix_freeTrajectory N L s t hs ht] + congr 1 + have heq := congrArg (fun ω : ConfigurationPath N L ↦ ω 1) + (prefix_freeTrajectory N L s t hs ht p.1 p.2) + simpa only [configurationPrefix,ContinuousMap.comp_apply,prefixTime_one] using heq + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/NumericalSupply.lean b/lean/OAI/Analysis/HardSphere/Bridges/NumericalSupply.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e7e0968087e2029627ccc8c6ba07e2b114fb376 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/NumericalSupply.lean @@ -0,0 +1,106 @@ +import Mathlib + +namespace OAI + +section + +section +noncomputable section +open Filter MeasureTheory +open scoped Topology +namespace HardSphere.Bridge + +lemma separation_inverse_cube {D b : ℝ} (hD : 0 < D) : + ((b*D^(-(1/3):ℝ))⁻¹)^3=b⁻¹^3*D := by + have hp : ((D^(-(1/3):ℝ))⁻¹)^3 = D := by + rw [←Real.rpow_neg hD.le,←Real.rpow_natCast,←Real.rpow_mul hD.le] + norm_num + rw [mul_inv,mul_pow,hp] + +lemma boundary_ratio_le {D : ℝ} (hD : 1 ≤ D) : + D⁻¹*(1+D^(1/12:ℝ))^3/Real.sqrt (D⁻¹/2) ≤ 8*Real.sqrt 2*D^(-(1/4):ℝ) := by + have hDp : 0 < D := zero_lt_one.trans_le hD + have hR : 1 ≤ D^(1/12:ℝ) := Real.one_le_rpow hD (by norm_num) + have hcube : (1+D^(1/12:ℝ))^3 ≤ 8*D^(1/4:ℝ) := by + calc + _ ≤ (2*D^(1/12:ℝ))^3 := pow_le_pow_left₀ (by positivity) (by linarith) 3 + _ = _ := by + have hp : (D^(1/12:ℝ))^3 = D^(1/4:ℝ) := by + rw [←Real.rpow_natCast,←Real.rpow_mul hDp.le] + norm_num + rw [mul_pow,hp] + norm_num + have hs : Real.sqrt (D⁻¹)=D^(-(1/2):ℝ) := by + rw [Real.sqrt_inv,Real.sqrt_eq_rpow,Real.rpow_neg hDp.le] + calc + _ = (1+D^(1/12:ℝ))^3*(D⁻¹/Real.sqrt (D⁻¹))*Real.sqrt 2 := by + rw [Real.sqrt_div (inv_nonneg.mpr hDp.le)] + simp only [div_eq_mul_inv,mul_inv,inv_inv] + ring + _ = (1+D^(1/12:ℝ))^3*D^(-(1/2):ℝ)*Real.sqrt 2 := by rw [Real.div_sqrt,hs] + _ ≤ (8*D^(1/4:ℝ))*D^(-(1/2):ℝ)*Real.sqrt 2 := by gcongr + _ = _ := by + rw [mul_assoc (8:ℝ),←Real.rpow_add hDp] + norm_num + ring + +lemma boundary_ratio_tendsto : + Tendsto (fun D:ℝ ↦ D⁻¹*(1+D^(1/12:ℝ))^3/Real.sqrt (D⁻¹/2)) atTop (𝓝 0) := by + apply squeeze_zero' + · filter_upwards [eventually_ge_atTop (1:ℝ)] with D hD + positivity + · filter_upwards [eventually_ge_atTop (1:ℝ)] with D hD using boundary_ratio_le hD + · simpa using (tendsto_rpow_neg_atTop (by norm_num : (0:ℝ) < 1/4)).const_mul (8*Real.sqrt 2) + +lemma collision_error_majorant {D b A H C t α m : ℝ} + (hD : 1 ≤ D) (hb : 0 < b) (hA : 0 ≤ A) (hH : 0 ≤ H) (hC : 0 ≤ C) (ht : 0 ≤ t) + (hα : 0 ≤ α) (hαA : α ≤ A) (hm : 0 ≤ m) (hmH : m ≤ H*D) : + 8*C*t*(α/D)*(((b*D^(-(1/3):ℝ))⁻¹)^3+m)+ + 8*(α/D)*(1+D^(1/12:ℝ))^3/Real.sqrt (D⁻¹/2) ≤ + 8*C*t*A*(b⁻¹^3+H)+64*A*Real.sqrt 2*D^(-(1/4):ℝ) := by + have hDp : 0 < D := zero_lt_one.trans_le hD + rw [separation_inverse_cube hDp] + apply add_le_add + · calc + _ ≤ 8*C*t*(A/D)*(b⁻¹^3*D+H*D) := by + have hαD := div_nonneg hα hDp.le + gcongr + _ = _ := by field_simp + · calc + _ ≤ 8*(A/D)*(1+D^(1/12:ℝ))^3/Real.sqrt (D⁻¹/2) := by gcongr + _ = (8*A)*(D⁻¹*(1+D^(1/12:ℝ))^3/Real.sqrt (D⁻¹/2)) := by ring + _ ≤ (8*A)*(8*Real.sqrt 2*D^(-(1/4):ℝ)) := mul_le_mul_of_nonneg_left (boundary_ratio_le hD) (by positivity) + _ = _ := by ring + +theorem collision_error_small {b A H C J ε : ℝ} + (hb : 0 < b) (hA : 0 < A) (hH : 0 < H) (hC : 0 < C) (hJ : 0 < J) (hε : 0 < ε) : + ∃ t₀ : ℝ, 0 < t₀ ∧ ∀ t : ℝ, 0 < t → t ≤ t₀ → ∃ D₀ : ℝ, 1 ≤ D₀ ∧ + ∀ D α m : ℝ, D₀ ≤ D → 0 ≤ α → α ≤ A → 0 ≤ m → m ≤ H*D → + J*(8*C*t*(α/D)*(((b*D^(-(1/3):ℝ))⁻¹)^3+m)+ + 8*(α/D)*(1+D^(1/12:ℝ))^3/Real.sqrt (D⁻¹/2)) ≤ ε := by + let Q := 8*C*A*(b⁻¹^3+H) + have hQ : 0 < Q := by dsimp [Q]; positivity + refine ⟨ε/(2*J*Q),by positivity,?_⟩ + intro t ht htt + have hl : Tendsto (fun D:ℝ ↦ J*(64*A*Real.sqrt 2*D^(-(1/4):ℝ))) atTop (𝓝 0) := by + simpa using ((tendsto_rpow_neg_atTop (by norm_num : (0:ℝ) < 1/4)).const_mul (64*A*Real.sqrt 2)).const_mul J + obtain ⟨D₀,hD₀⟩ := eventually_atTop.1 (hl.eventually (gt_mem_nhds (by positivity : (0:ℝ) < ε/2))) + refine ⟨max 1 D₀,le_max_left _ _,?_⟩ + intro D α m hDD hα hαA hm hmH + have hD : 1 ≤ D := (le_max_left _ _).trans hDD + have hd := hD₀ D ((le_max_right _ _).trans hDD) + have hsmall : J*(8*C*t*A*(b⁻¹^3+H)) ≤ ε/2 := by + have hh := (le_div_iff₀ (by positivity : 0 < 2*J*Q)).mp htt + dsimp [Q] at hh + nlinarith + have he := mul_le_mul_of_nonneg_left (collision_error_majorant hD hb hA.le hH.le hC.le ht.le hα hαA hm hmH) hJ.le + nlinarith + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/PairSubtype.lean b/lean/OAI/Analysis/HardSphere/Bridges/PairSubtype.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c63a8ee21d4e1e710e71871c56ba79e3e37e616 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/PairSubtype.lean @@ -0,0 +1,193 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.PairedMarginal +import OAI.Analysis.HardSphere.Bridges.PhysicalInsertion +import OAI.Analysis.HardSphere.Conditioning.SupportedPair + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology +namespace HardSphere.Bridge +open Wiener GaussianPacking Comparison + +def pairedPathsRaw (t : ℝ) (y z y' z' : Point) (A : Set Point) + (S T : Set C(Time,Point)) (hS : MeasurableSet S) (hT : MeasurableSet T) : + Measure (C(Time,Point)×C(Time,Point)) := + (pairedTrialLaw t y z y' z' A S T hS hT).map (fun p ↦ (p.1,p.2.2)) + +lemma pairedPathsRaw_fst (t : ℝ) (y z y' z' : Point) (A : Set Point) + (S T : Set C(Time,Point)) (hS : MeasurableSet S) (hT : MeasurableSet T) : + (pairedPathsRaw t y z y' z' A S T hS hT).fst=(pairedTrialLaw t y z y' z' A S T hS hT).fst := by + rw [pairedPathsRaw,Measure.fst,Measure.map_map measurable_fst (by fun_prop)] + rfl +lemma pairedPathsRaw_snd (t : ℝ) (y z y' z' : Point) (A : Set Point) + (S T : Set C(Time,Point)) (hS : MeasurableSet S) (hT : MeasurableSet T) : + (pairedPathsRaw t y z y' z' A S T hS hT).snd=(pairedTrialLaw t y z y' z' A S T hS hT).map (fun p ↦ p.2.2) := by + rw [pairedPathsRaw,Measure.snd,Measure.map_map measurable_snd (by fun_prop)] + rfl + +def pairedPathsOn (t : ℝ) (y z y' z' : Point) (A : Set Point) + (S T : Set C(Time,Point)) (hS : MeasurableSet S) (hT : MeasurableSet T) : Measure (S×T) := + supportedPair (pairedPathsRaw t y z y' z' A S T hS hT) S T + +lemma pairedPathsOn_physical {t C C' : ℝ} (ht : 0 .inl u + | .inr ⟨m,k⟩ => .inr ⟨m.val,k⟩ + +lemma partialEmbed_injective (n : ℕ) : Function.Injective (partialEmbed n) := by + intro i j hij + cases i with + | inl u => + cases j with + | inl v => exact congrArg Sum.inl (Subsingleton.elim _ _) + | inr j => cases hij + | inr i => + cases j with + | inl u => cases hij + | inr j => + obtain ⟨m,k⟩ := i + obtain ⟨l,q⟩ := j + simp only [partialEmbed, Sum.inr.injEq] at hij + cases m; cases l + cases hij + rfl + +def coefficient (n : ℕ) (t : ℝ) : PartialIndex n → ℝ + | .inl _ => t + | .inr ⟨m,k⟩ => amplitude m.val * tent m.val k t + +def partialPath (n : ℕ) (ω : Noise) : C(Time,ℝ) := + ω (.inl ()) • ⟨fun t ↦ t.val, continuous_subtype_val⟩ + + ∑ m ∈ Finset.range n, level m ω + +lemma partialPath_expansion (n : ℕ) (t : Time) (ω : Noise) : + partialPath n ω t = ∑ i : PartialIndex n, coefficient n t i * ω (partialEmbed n i) := by + simp only [Fintype.sum_sum_type, Fintype.sum_sigma, coefficient, partialEmbed, + Fintype.sum_unique, partialPath, ContinuousMap.add_apply, ContinuousMap.smul_apply, + ContinuousMap.coe_mk, smul_eq_mul, ContinuousMap.sum_apply, level, tentMap, + ← Finset.mul_sum] + rw [Fin.sum_univ_eq_sum_range (fun m ↦ ∑ k : Fin (2^m), + amplitude m * tent m k t * ω (.inr ⟨m,k⟩)) n] + congr 1 + · ring + · apply Finset.sum_congr rfl + intro m _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro k _ + ring + +lemma coefficient_covariance (n : ℕ) (s t : ℝ) : + ∑ i : PartialIndex n, coefficient n s i * coefficient n t i = + s*t + partialBridge n s t := by + have hamp (m : ℕ) : amplitude m ^ 2 = weight m := by + have hs : (Real.sqrt 2)^2 = (2:ℝ) := Real.sq_sqrt (by norm_num) + simp only [amplitude, mul_pow, weight] + rw [← pow_mul, Nat.mul_comm m 2, pow_mul, inv_pow, hs] + norm_num + simp only [Fintype.sum_sum_type, Fintype.sum_sigma, coefficient, Fintype.sum_unique] + rw [Fin.sum_univ_eq_sum_range (fun m ↦ ∑ k : Fin (2^m), + amplitude m * tent m k s * (amplitude m * tent m k t)) n] + congr 1 + unfold partialBridge + apply Finset.sum_congr rfl + intro m _ + rw [hatKernel, Finset.mul_sum, ← hamp] + apply Finset.sum_congr rfl + intro k _ + ring + +lemma independent_coordinates : iIndepFun (fun i ω ↦ ω i) law := + iIndepFun_infinitePi (fun _ ↦ measurable_id) + +lemma finite_coordinate_law (n : ℕ) (c : PartialIndex n → ℝ) : + HasLaw (fun ω ↦ ∑ i, c i * ω (partialEmbed n i)) + (gaussianReal 0 (∑ i, NNReal.mk ((c i)^2) (sq_nonneg _))) law := by + have hh (i : PartialIndex n) : HasLaw (fun ω ↦ c i * ω (partialEmbed n i)) + (gaussianReal 0 (NNReal.mk ((c i)^2) (sq_nonneg _))) law := by + simpa only [mul_zero, mul_one] using + gaussianReal_const_mul (coordinate_preserving (partialEmbed n i)).hasLaw (c i) + exact hasLaw_centered_gaussian_sum hh + ((independent_coordinates.precomp (partialEmbed_injective n)).comp + (fun i x ↦ c i*x) (fun i ↦ by fun_prop)) + +lemma square_sum_covariance {ι κ : Type*} [Fintype ι] [Fintype κ] + (c : ι → ℝ) (f : ι → κ → ℝ) : + ∑ u, (∑ i, c i*f i u)^2 = ∑ i, ∑ j, c i*c j*(∑ u, f i u*f j u) := by + simp only [pow_two, Finset.mul_sum, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro u _ + ring + +lemma ae_partialPath_tendsto : ∀ᵐ ω ∂law, + Tendsto (fun n ↦ partialPath n ω) atTop (𝓝 (path ω)) := by + filter_upwards [ae_summable_level] with ω hω + exact tendsto_const_nhds.add hω.hasSum.tendsto_sum_nat + +lemma finite_projection_expansion {ι : Type*} [Fintype ι] + (n : ℕ) (c : ι → ℝ) (t : ι → Time) (ω : Noise) : + ∑ i, c i * partialPath n ω (t i) = + ∑ u : PartialIndex n, (∑ i, c i * coefficient n (t i) u) * ω (partialEmbed n u) := by + simp_rw [partialPath_expansion, Finset.mul_sum, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro u _ + apply Finset.sum_congr rfl + intro i _ + ring + +lemma finite_projection_variance {ι : Type*} [Fintype ι] + (n : ℕ) (c : ι → ℝ) (t : ι → Time) : + ∑ u : PartialIndex n, (∑ i, c i * coefficient n (t i) u)^2 = + ∑ i, ∑ j, c i*c j*((t i : ℝ)*(t j : ℝ)+partialBridge n (t i) (t j)) := by + rw [square_sum_covariance] + simp_rw [coefficient_covariance] + +lemma finite_projection_law {ι : Type*} [Fintype ι] + (n : ℕ) (c : ι → ℝ) (t : ι → Time) : + HasLaw (fun ω ↦ ∑ i, c i * partialPath n ω (t i)) + (gaussianReal 0 (Real.toNNReal + (∑ i, ∑ j, c i*c j*((t i : ℝ)*(t j : ℝ)+partialBridge n (t i) (t j))))) law := by + have hh := finite_coordinate_law n (fun u ↦ ∑ i, c i * coefficient n (t i) u) + simp_rw [finite_projection_expansion] + convert hh using 2 + rw [← finite_projection_variance] + change Real.toNNReal (∑ u : PartialIndex n, + ((NNReal.mk ((∑ i, c i * coefficient n (t i) u)^2) (sq_nonneg _) : ℝ≥0) : ℝ)) = _ + rw [← NNReal.coe_sum, Real.toNNReal_coe] + +lemma path_projection_law {ι : Type*} [Fintype ι] + (c : ι → ℝ) (t : ι → Time) : + HasLaw (fun ω ↦ ∑ i, c i * path ω (t i)) + (gaussianReal 0 (Real.toNNReal (∑ i, ∑ j, c i*c j*min (t i : ℝ) (t j : ℝ)))) law := by + refine hasLaw_gaussian_of_ae_tendsto (fun n ↦ finite_projection_law n c t) ?_ + tendsto_const_nhds ?_ + · filter_upwards [ae_partialPath_tendsto] with ω hω + apply tendsto_finsetSum + intro i _ + exact tendsto_const_nhds.mul ((continuous_eval_const (t i)).tendsto _ |>.comp hω) + · apply continuous_real_toNNReal.tendsto _ |>.comp + apply tendsto_finsetSum + intro i _ + apply tendsto_finsetSum + intro j _ + have hh := ((tendsto_const_nhds (x := (t i : ℝ)*(t j : ℝ))).add + (partialBridge_tendsto (t i).property (t j).property)).const_mul (c i*c j) + convert hh using 1 + congr 1 + ring + +lemma finite_linear_projection {ι : Type*} [Fintype ι] [DecidableEq ι] + (L : (ι → ℝ) →L[ℝ] ℝ) (x : ι → ℝ) : + L x = ∑ i, L (Pi.single i 1) * x i := by + conv_lhs => rw [pi_eq_sum_univ' x] + simp only [map_sum, map_smul, smul_eq_mul] + apply Finset.sum_congr rfl + intro i _ + ring + +lemma finite_path_gaussian {ι : Type*} [Fintype ι] (t : ι → Time) : + HasGaussianLaw (fun ω i ↦ path ω (t i)) law := by + classical + have hm : Measurable (fun ω i ↦ path ω (t i)) := + Measurable.of_eval fun coordinate ↦ + (continuous_eval_const (t coordinate)).measurable.comp measurable_path + refine ⟨hm.aemeasurable, ?_⟩ + apply isGaussian_of_map_eq_gaussianReal + intro L + refine ⟨0, Real.toNNReal (∑ i, ∑ j, + L (Pi.single i 1)*L (Pi.single j 1)*min (t i : ℝ) (t j : ℝ)), ?_⟩ + rw [Measure.map_map L.continuous.measurable hm] + convert (path_projection_law (fun i ↦ L (Pi.single i 1)) t).map_eq using 1 + congr 1 + funext ω + exact finite_linear_projection L _ + +lemma path_isGaussianProcess : IsGaussianProcess (fun t ω ↦ path ω t) law where + hasGaussianLaw I := finite_path_gaussian (fun t : I ↦ t.val) + +lemma path_eval_law (t : Time) : + HasLaw (fun ω ↦ path ω t) (gaussianReal 0 (Real.toNNReal t.val)) law := by + simpa using path_projection_law (fun _ : Unit ↦ (1:ℝ)) (fun _ ↦ t) + +lemma path_mean (t : Time) : ∫ ω, path ω t ∂law = 0 := by + rw [(path_eval_law t).integral_eq, integral_id_gaussianReal] + +lemma path_variance (t : Time) : Var[fun ω ↦ path ω t; law] = t.val := by + rw [(path_eval_law t).variance_eq, variance_id_gaussianReal, Real.coe_toNNReal _ t.property.1] + +lemma path_add_law (s t : Time) : + HasLaw (fun ω ↦ path ω s + path ω t) + (gaussianReal 0 ((s:ℝ)+(t:ℝ)+2*min (s:ℝ) (t:ℝ)).toNNReal) law := by + have hh := path_projection_law (fun _ : Bool ↦ (1:ℝ)) (fun b ↦ if b then s else t) + simp only [Fintype.sum_bool, Bool.false_eq_true, ↓reduceIte, mul_one, one_mul, min_self] at hh + convert hh using 1 + congr 1 + congr 1 + rw [min_comm (t:ℝ) (s:ℝ)] + ring + +lemma path_covariance (s t : Time) : + cov[fun ω ↦ path ω s, fun ω ↦ path ω t; law] = min (s:ℝ) (t:ℝ) := by + have hs : 0 ≤ (s:ℝ) := s.property.1 + have ht : 0 ≤ (t:ℝ) := t.property.1 + have hmin : 0 ≤ min (s:ℝ) (t:ℝ) := le_min hs ht + have hvar := variance_fun_add (path_eval_law s).hasGaussianLaw.memLp_two + (path_eval_law t).hasGaussianLaw.memLp_two + rw [path_variance s, path_variance t, (path_add_law s t).variance_eq, + variance_id_gaussianReal, Real.coe_toNNReal _ (by positivity)] at hvar + linarith + +lemma wiener_projection_law {ι : Type*} [Fintype ι] + (c : ι → ℝ) (t : ι → Time) : + HasLaw (fun ω : C(Time,ℝ) ↦ ∑ i, c i * ω (t i)) + (gaussianReal 0 (Real.toNNReal (∑ i, ∑ j, c i*c j*min (t i : ℝ) (t j : ℝ)))) wiener := by + have hm : Measurable (fun ω : C(Time,ℝ) ↦ ∑ i, c i * ω (t i)) := + (continuous_finsetSum _ fun i _ ↦ continuous_const.mul (continuous_eval_const (t i))).measurable + refine ⟨hm.aemeasurable, ?_⟩ + rw [wiener, Measure.map_map hm measurable_path] + exact (path_projection_law c t).map_eq + +abbrev BridgeIndex := Σ n : ℕ, Fin (2^n) +abbrev BridgeNoise := BridgeIndex → ℝ + +def linearPath : C(Time,ℝ) := ⟨fun t ↦ t.val, continuous_subtype_val⟩ +def rest (ω : Noise) : BridgeNoise := fun i ↦ ω (.inr i) +def embedRest (η : BridgeNoise) : Noise := Sum.elim (fun _ ↦ 0) η +def bridgeMap (η : BridgeNoise) : C(Time,ℝ) := path (embedRest η) +def bridge (ω : Noise) : C(Time,ℝ) := bridgeMap (rest ω) + +lemma measurable_bridgeMap : Measurable bridgeMap := by + apply measurable_path.comp + apply Measurable.of_eval + intro i + cases i with + | inl u => exact measurable_const + | inr i => exact measurable_pi_apply i + +lemma measurable_rest : Measurable rest := Measurable.of_eval fun _ ↦ measurable_pi_apply _ +lemma measurable_bridge : Measurable bridge := measurable_bridgeMap.comp measurable_rest + +lemma independent_base_rest : IndepFun (fun ω : Noise ↦ ω (.inl ())) rest law := by + classical + apply IndepFun.indepFun_process (measurable_pi_apply _) (fun i ↦ measurable_pi_apply _) + intro I + let S : Finset Index := {.inl ()} + let T : Finset Index := I.image Sum.inr + have hd : Disjoint S T := by simp [S,T] + have h := iIndepFun.indepFun_finset S T hd independent_coordinates (fun i ↦ measurable_pi_apply i) + let a : S := ⟨.inl (), by simp [S]⟩ + let b (i : I) : T := ⟨.inr i.val, Finset.mem_image.mpr ⟨i.val,i.property,rfl⟩⟩ + exact h.comp (measurable_pi_apply a) + (Measurable.of_eval fun coordinate ↦ measurable_pi_apply (b coordinate)) + +lemma independent_base_bridge : IndepFun (fun ω : Noise ↦ ω (.inl ())) bridge law := + independent_base_rest.comp measurable_id measurable_bridgeMap + +lemma bridge_eq (ω : Noise) : bridge ω = ∑' n, level n ω := by + simp only [bridge, bridgeMap, path, embedRest, Sum.elim_inl, zero_smul, zero_add] + congr 1 + +lemma path_decomposition (ω : Noise) : path ω = ω (.inl ()) • linearPath + bridge ω := by + rw [bridge_eq] + rfl + +lemma bridge_at_zero (ω : Noise) : bridge ω 0 = 0 := path_at_zero _ +lemma bridge_at_one (ω : Noise) : bridge ω 1 = 0 := path_at_one _ + +def bridgeLaw : Measure C(Time,ℝ) := law.map bridge +instance : IsProbabilityMeasure bridgeLaw := by unfold bridgeLaw; infer_instance + +lemma endpoint_bridge_law : + HasLaw (fun ω : Noise ↦ (ω (.inl ()), bridge ω)) + ((gaussianReal 0 1).prod bridgeLaw) law := by + refine ⟨((measurable_pi_apply _).prodMk measurable_bridge).aemeasurable, ?_⟩ + rw [independent_base_bridge.map_prod_eq_prod_map_map (measurable_pi_apply _).aemeasurable + measurable_bridge.aemeasurable, (coordinate_preserving (.inl ())).map_eq] + rfl + +lemma wiener_disintegration : wiener = ((gaussianReal 0 1).prod bridgeLaw).map + (fun p : ℝ × C(Time,ℝ) ↦ p.1 • linearPath + p.2) := by + rw [wiener, ← endpoint_bridge_law.map_eq, + Measure.map_map (by fun_prop) ((measurable_pi_apply _).prodMk measurable_bridge)] + congr 1 + funext ω + exact path_decomposition ω + +lemma bridge_apply (ω : Noise) (t : Time) : bridge ω t = path ω t - t.val * path ω 1 := by + have h := congrArg (fun f : C(Time,ℝ) ↦ f t) (path_decomposition ω) + simp only [ContinuousMap.add_apply, ContinuousMap.smul_apply, linearPath, + ContinuousMap.coe_mk, smul_eq_mul] at h + rw [path_at_one] + linarith + +lemma bridge_projection_algebra {ι : Type*} [Fintype ι] (c : ι → ℝ) (t : ι → Time) : + let a : Option ι → ℝ := fun i ↦ i.elim (-∑ i, c i*(t i:ℝ)) c + let u : Option ι → Time := fun i ↦ i.elim 1 t + (∑ i, ∑ j, a i*a j*min (u i:ℝ) (u j:ℝ)) = + ∑ i, ∑ j, c i*c j*(min (t i:ℝ) (t j:ℝ) - (t i:ℝ)*(t j:ℝ)) := by + let A : ℝ := ∑ i, c i*(t i:ℝ) + have hh : (∑ i, ∑ j, c i*c j*((t i:ℝ)*(t j:ℝ))) = A*A := by + dsimp only [A] + rw [Finset.sum_mul_sum] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + have h1 : (∑ i, (-A)*c i*(t i:ℝ)) = -A*A := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + ring + have h2 : (∑ i, c i*(-A)*(t i:ℝ)) = -A*A := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + ring + dsimp only + simp only [Fintype.sum_option, Option.elim_none, Option.elim_some, + show ((1:Time):ℝ) = 1 from rfl, min_self, min_eq_right (t _).property.2, + min_eq_left (t _).property.2, mul_one] + simp only [Finset.sum_add_distrib, mul_sub, Finset.sum_sub_distrib] + change (-A)*(-A) + (∑ i, (-A)*c i*(t i:ℝ)) + + ((∑ i, c i*(-A)*(t i:ℝ)) + _) = _ + rw [h1,h2,hh] + ring + +lemma bridge_projection_law {ι : Type*} [Fintype ι] (c : ι → ℝ) (t : ι → Time) : + HasLaw (fun ω ↦ ∑ i, c i*bridge ω (t i)) + (gaussianReal 0 (Real.toNNReal (∑ i, ∑ j, c i*c j* + (min (t i:ℝ) (t j:ℝ) - (t i:ℝ)*(t j:ℝ))))) law := by + have h := path_projection_law (fun i : Option ι ↦ i.elim (-∑ i, c i*(t i:ℝ)) c) + (fun i ↦ i.elim 1 t) + rw [bridge_projection_algebra] at h + convert h using 1 + funext ω + simp only [Fintype.sum_option, Option.elim_none, Option.elim_some, bridge_apply, + mul_sub, Finset.sum_sub_distrib, neg_mul, Finset.sum_mul] + simp only [mul_assoc] + ring + +def denseEval (f : C(Time,ℝ)) : ℕ → ℝ := fun n ↦ f (TopologicalSpace.denseSeq Time n) + +lemma denseEval_embedding : MeasurableEmbedding denseEval := by + apply Measurable.measurableEmbedding + · exact Measurable.of_eval fun _ ↦ (continuous_eval_const _).measurable + · intro f g h + apply DFunLike.coe_injective + exact (TopologicalSpace.denseRange_denseSeq Time).equalizer f.continuous g.continuous h + +lemma continuous_path_law_ext {X Y : Noise → C(Time,ℝ)} + (hX : Measurable X) (hY : Measurable Y) + (h : ∀ {ι : Type} [Fintype ι] (c : ι → ℝ) (t : ι → Time), + law.map (fun ω ↦ ∑ i, c i * X ω (t i)) = + law.map (fun ω ↦ ∑ i, c i * Y ω (t i))) : + law.map X = law.map Y := by + apply denseEval_embedding.map_injective + rw [Measure.map_map denseEval_embedding.measurable hX, + Measure.map_map denseEval_embedding.measurable hY] + apply (map_eq_iff_forall_finset_map_restrict_eq + (denseEval_embedding.measurable.comp hX).aemeasurable + (denseEval_embedding.measurable.comp hY).aemeasurable).mpr + intro I + apply Measure.ext_of_charFunDual + funext L + rw [charFunDual_eq_charFun_map_one, charFunDual_eq_charFun_map_one] + congr 1 + have hXm : Measurable (fun ω ↦ I.restrict (fun x ↦ denseEval (X ω) x)) := + Measurable.of_eval fun coordinate ↦ (measurable_pi_apply coordinate.val).comp + (denseEval_embedding.measurable.comp hX) + have hYm : Measurable (fun ω ↦ I.restrict (fun x ↦ denseEval (Y ω) x)) := + Measurable.of_eval fun coordinate ↦ (measurable_pi_apply coordinate.val).comp + (denseEval_embedding.measurable.comp hY) + simp only [Function.comp_def, Finset.restrict_def] at hXm hYm ⊢ + rw [Measure.map_map L.continuous.measurable hXm, + Measure.map_map L.continuous.measurable hYm] + convert h (fun i : I ↦ L (Pi.single i 1)) + (fun i : I ↦ TopologicalSpace.denseSeq Time i.val) using 1 <;> + congr 1 <;> funext ω <;> exact finite_linear_projection L _ + +def prefixTime (u : Time) : C(Time,Time) where + toFun t := ⟨(u:ℝ)*(t:ℝ), mul_nonneg u.property.1 t.property.1, + (mul_le_of_le_one_left t.property.1 u.property.2).trans t.property.2⟩ + continuous_toFun := (continuous_const.mul continuous_subtype_val).subtype_mk _ + +def suffixTime (u : Time) : C(Time,Time) where + toFun t := ⟨(u:ℝ)+(1-(u:ℝ))*(t:ℝ), by + constructor + · nlinarith [u.property.1,u.property.2,t.property.1] + · nlinarith [u.property.1,u.property.2,t.property.1,t.property.2]⟩ + continuous_toFun := (continuous_const.add (continuous_const.mul continuous_subtype_val)).subtype_mk _ + +end HardSphere.Wiener +end +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/PeriodShift.lean b/lean/OAI/Analysis/HardSphere/Bridges/PeriodShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b1854264687567143a513a28d6a0ea2663189ea --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/PeriodShift.lean @@ -0,0 +1,239 @@ +import Mathlib +import OAI.Analysis.HardSphere.PathBounds.InteractingVisits +import OAI.Analysis.HardSphere.Bridges.ConfinedLift +import OAI.Analysis.HardSphere.Conditioning.ConditionTransport +import OAI.Analysis.HardSphere.Bridges.PairSubtype + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology +namespace HardSphere.Bridge +open Wiener GaussianPacking PathCutoff Comparison + +def shiftPath (c : Point) (f : C(Time,Point)) : C(Time,Point) := + f+ContinuousMap.const _ c +@[fun_prop] lemma shiftPath_continuous (c : Point) : Continuous (shiftPath c) := by + unfold shiftPath + fun_prop + +lemma shiftPath_cancel (c : Point) (f : C(Time,Point)) : shiftPath (-c) (shiftPath c f)=f := by + ext s j + change (f s j+c j)+(-c j)=f s j + ring + +lemma project_shift {L : Length} (c : Point) (hc : projectPoint L c=0) (f : C(Time,Point)) : + projectCurve L (shiftPath c f)=projectCurve L f := by + ext s i j + change (((f s j+c j):ℝ):AddCircle L.val)=_ + rw [AddCircle.coe_add] + have h := congrFun hc j + change ((c j:ℝ):AddCircle L.val)=0 at h + rw [h,add_zero] + rfl + +lemma projectPoint_shift {L : Length} (c : Point) (hc : projectPoint L c=0) (v : Point) : + projectPoint L (v+c)=projectPoint L v := by + ext j + change (((v j+c j):ℝ):AddCircle L.val)=_ + rw [AddCircle.coe_add] + have h := congrFun hc j + change ((c j:ℝ):AddCircle L.val)=0 at h + rw [h,add_zero] + +lemma trialPath_shift (t : ℝ) (y z u c : Point) (β : Noise×Noise) : + trialPath t (y+c) (z+c) (u+c) β=shiftPath c (trialPath t y z u β) := by + ext s j + change (leg t (y+c) (u+c) (pinned β.1) (leftTime s) j + + leg t (z+c) (u+c) (pinned β.2) (reverseTime (rightTime s)) j)-(u j+c j)=_ + rw [leg_translate,leg_translate] + change ((leg t y u (pinned β.1) (leftTime s) j+c j)+ + (leg t z u (pinned β.2) (reverseTime (rightTime s)) j+c j))-(u j+c j)=_ + change _=((leg t y u (pinned β.1) (leftTime s) j+ + leg t z u (pinned β.2) (reverseTime (rightTime s)) j)-u j)+c j + ring + +lemma trialKernel_shift (t : ℝ) (y z u c : Point) : + (trialKernel t y z u).map (shiftPath c)=trialKernel t (y+c) (z+c) (u+c) := by + have hm : Measurable (trialPath t y z u) := + ((trialPath_continuous t y z).comp (continuous_const.prodMk continuous_id)).measurable + rw [trialKernel_apply,trialKernel_apply,Measure.map_map (shiftPath_continuous c).measurable hm] + congr 1 + funext β + exact (trialPath_shift t y z u c β).symm + +lemma permittedPath_shift {J : Type*} {L : Length} (n : ℕ) (r R C S : ℝ) + (w : Time) (y z v c : Point) (hc : projectPoint L c=0) (F : J → ConfigurationPath 1 L) + (f : C(Time,Point)) : + shiftPath c f∈permittedPath n r R C S w (y+c) (z+c) (v+c) F ↔ + f∈permittedPath n r R C S w y z v F := by + simp only [permittedPath,mem_ofPred_eq,project_shift c hc] + have hconf : TrialConfined L (v+c) (shiftPath c f) ↔ TrialConfined L v f := by + simp only [TrialConfined,shiftPath,ContinuousMap.add_apply,ContinuousMap.const_apply, + add_sub_add_right_eq_sub,projectPoint_shift c hc] + rw [hconf] + have hpin : shiftPath c f∈fixedEndpoints (y+c) (z+c) ↔ f∈fixedEndpoints y z := by + simp only [fixedEndpoints,mem_ofPred_eq,shiftPath,ContinuousMap.add_apply,ContinuousMap.const_apply, + add_left_inj] + rw [hpin] + have hp (s : Time) : projectPoint L (shiftPath c f s)=projectPoint L (f s) := + projectPoint_shift c hc (f s) + simp only [TrialCollision,hp] + +lemma individualReference_shift (t : ℝ) (y z c : Point) + (S T : Set C(Time,Point)) (hT : MeasurableSet T) + (hST : ∀f,shiftPath c f∈T ↔ f∈S) : + (individualReference t y z S).map (shiftPath c)= + individualReference t (y+c) (z+c) T := by + have he : S=(shiftPath c)⁻¹' T := by ext f;exact (hST f).symm + change (conditionedMeasure (law.map (leg (2*t) y z)) S).map (shiftPath c)=_ + rw [he,conditioned_map_preimage _ _ (shiftPath_continuous c).measurable hT, + Measure.map_map (shiftPath_continuous c).measurable (leg_continuous ..).measurable] + congr 1 + congr 1 + funext β + exact (leg_translate (2*t) y z c β).symm + +end HardSphere.Bridge + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology +namespace HardSphere.Bridge +open Wiener GaussianPacking PathCutoff Comparison + +lemma shiftPath_cancel' (c : Point) (f : C(Time,Point)) : + shiftPath c (shiftPath (-c) f)=f := by simpa only [neg_neg] using shiftPath_cancel (-c) f + +def shiftWithin (c : Point) (S T : Set C(Time,Point)) + (hST : ∀f,shiftPath c f∈T ↔ f∈S) : S ≃ᵐ T where + toFun f := ⟨shiftPath c f, (hST f).mpr f.property⟩ + invFun f := ⟨shiftPath (-c) f, (hST _).mp (by rw [shiftPath_cancel'];exact f.property)⟩ + left_inv f := by apply Subtype.ext;exact shiftPath_cancel c f + right_inv f := by apply Subtype.ext;exact shiftPath_cancel' c f + measurable_toFun := ((shiftPath_continuous c).measurable.comp measurable_subtype_coe).subtype_mk + measurable_invFun := ((shiftPath_continuous (-c)).measurable.comp measurable_subtype_coe).subtype_mk + +lemma referenceOn_shift (t : ℝ) (y z c : Point) (S T : Set C(Time,Point)) + (hS : MeasurableSet S) (hT : MeasurableSet T) (hST : ∀f,shiftPath c f∈T ↔ f∈S) : + (referenceOn t y z S).map (shiftWithin c S T hST)=referenceOn t (y+c) (z+c) T := by + apply (MeasurableEmbedding.subtype_coe hT).map_injective + rw [Measure.map_map measurable_subtype_coe (shiftWithin c S T hST).measurable, + referenceOn_map t (y+c) (z+c) hT] + change (referenceOn t y z S).map (shiftPath c ∘ Subtype.val)=_ + rw [←Measure.map_map (shiftPath_continuous c).measurable measurable_subtype_coe,referenceOn_map t y z hS] + exact individualReference_shift t y z c S T hT hST + +lemma referenceOn_unshift (t : ℝ) (y z c : Point) (S T : Set C(Time,Point)) + (hS : MeasurableSet S) (hT : MeasurableSet T) (hST : ∀f,shiftPath c f∈T ↔ f∈S) : + (referenceOn t (y+c) (z+c) T).map (shiftWithin c S T hST).symm=referenceOn t y z S := by + rw [←referenceOn_shift t y z c S T hS hT hST, + Measure.map_map (shiftWithin c S T hST).symm.measurable (shiftWithin c S T hST).measurable] + simp only [MeasurableEquiv.symm_comp_self,Measure.map_id] + +def pairedAcrossPeriod (t : ℝ) (y z y' z' c : Point) (A : Set Point) + (S T U : Set C(Time,Point)) (hS : MeasurableSet S) (hU : MeasurableSet U) + (hTU : ∀f,shiftPath c f∈U ↔ f∈T) : Measure (S×T) := + (pairedPathsOn t y z (y'+c) (z'+c) A S U hS hU).map + (fun p ↦ (p.1,(shiftWithin c T U hTU).symm p.2)) + +lemma pairedAcrossPeriod_physical {L : Length} {t C C' : ℝ} + (ht : 0 ext i j + · change (((1-(0:Time).val)*X i j+(0:Time).val*Y i j+Real.sqrt (2*t)*β (i,j) 0:ℝ):AddCircle L.val)=_ + simp [(hβ (i,j)).1] + rfl + · change (((1-(1:Time).val)*X i j+(1:Time).val*Y i j+Real.sqrt (2*t)*β (i,j) 1:ℝ):AddCircle L.val)=_ + simp [(hβ (i,j)).2] + rfl + +lemma killed_ae_lifted_bridges {N : ℕ} (L : Length) (a : ℝ) {t : ℝ} (ht : 0 ev (some i) + | .inr _ => ev (some i) - ev none) + convert! (finite_path_gaussian loc).map_fun L using 1 + funext ω i + cases hi : i.val <;> simp [L,loc,hi,ev] + +lemma independent_split (u : Time) : + IndepFun (fun ω ↦ prefixMap u (path ω)) (fun ω ↦ suffixMap u (path ω)) law := by + have hc (s t : Time) : + cov[fun ω ↦ prefixMap u (path ω) s, fun ω ↦ suffixMap u (path ω) t; law] = 0 := by + simp only [prefixMap_apply,suffixMap_apply] + rw [covariance_fun_sub_right + (path_eval_law _).hasGaussianLaw.memLp_two + (path_eval_law _).hasGaussianLaw.memLp_two + (path_eval_law _).hasGaussianLaw.memLp_two, + path_covariance,path_covariance, + min_eq_left ((prefixTime_le u s).trans (le_suffixTime u t)), + min_eq_left (prefixTime_le u s),sub_self] + have hi := (split_gaussian u).indepFun_of_covariance_eq_zero + (fun t ↦ ((continuous_eval_const t).measurable.comp + ((prefixMap u).continuous.measurable.comp measurable_path)).aemeasurable) + (fun t ↦ ((continuous_eval_const t).measurable.comp + ((suffixMap u).continuous.measurable.comp measurable_path)).aemeasurable) hc + have hid := hi.comp + (Measurable.of_eval fun index ↦ measurable_pi_apply (TopologicalSpace.denseSeq Time index)) + (Measurable.of_eval fun index ↦ measurable_pi_apply (TopologicalSpace.denseSeq Time index)) + have hh := hid.comp denseEval_embedding.measurable_invFun denseEval_embedding.measurable_invFun + convert hh using 1 <;> funext ω <;> + exact (denseEval_embedding.leftInverse_invFun _).symm + +lemma scaled_path_projection_law {ι : Type*} [Fintype ι] + (r : ℝ) (hr : 0 ≤ r) (c : ι → ℝ) (t : ι → Time) : + HasLaw (fun ω ↦ ∑ i, c i * (Real.sqrt r • path ω) (t i)) + (gaussianReal 0 (Real.toNNReal (r * ∑ i, ∑ j, + c i*c j*min (t i:ℝ) (t j:ℝ)))) law := by + have hh := path_projection_law (fun i ↦ c i * Real.sqrt r) t + convert hh using 1 + · funext ω + apply Finset.sum_congr rfl + intro i _ + simp only [ContinuousMap.smul_apply,smul_eq_mul] + ring + · congr 1 + congr 1 + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + calc + r * (c i*c j*min (t i:ℝ) (t j:ℝ)) = + Real.sqrt r ^ 2 * (c i*c j*min (t i:ℝ) (t j:ℝ)) := by rw [Real.sq_sqrt hr] + _ = _ := by ring + +lemma prefix_law (u : Time) : + law.map (fun ω ↦ prefixMap u (path ω)) = + law.map (fun ω ↦ Real.sqrt (u:ℝ) • path ω) := by + apply continuous_path_law_ext (X := fun ω ↦ prefixMap u (path ω)) + (Y := fun ω ↦ Real.sqrt (u:ℝ) • path ω) + ((prefixMap u).continuous.measurable.comp measurable_path) + ((show Measurable (fun f : C(Time,ℝ) ↦ Real.sqrt (u:ℝ) • f) from + (by fun_prop)).comp measurable_path) + intro ι _ c t + have h := path_projection_law c (fun i ↦ prefixTime u (t i)) + have hvar : (∑ i, ∑ j, c i*c j*min (prefixTime u (t i):ℝ) (prefixTime u (t j):ℝ)) = + (u:ℝ)*∑ i, ∑ j, c i*c j*min (t i:ℝ) (t j:ℝ) := by + simp only [prefixTime,ContinuousMap.coe_mk] + simp_rw [← mul_min_of_nonneg _ _ u.property.1] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + ring + rw [hvar] at h + exact h.map_eq.trans (scaled_path_projection_law _ u.property.1 c t).map_eq.symm + +lemma suffix_projection_algebra {ι : Type*} [Fintype ι] + (u : Time) (c : ι → ℝ) (t : ι → Time) : + let a : Option ι → ℝ := fun i ↦ i.elim (-∑ i, c i) c + let v : Option ι → Time := fun i ↦ i.elim u (fun j ↦ suffixTime u (t j)) + (∑ i, ∑ j, a i*a j*min (v i:ℝ) (v j:ℝ)) = + (1-(u:ℝ))*∑ i, ∑ j, c i*c j*min (t i:ℝ) (t j:ℝ) := by + let A : ℝ := ∑ i, c i + have hh : (∑ i, ∑ j, c i*c j*(u:ℝ)) = A*A*(u:ℝ) := by + dsimp only [A] + rw [Finset.sum_mul_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_mul] + have h1 : (∑ i, (-A)*c i*(u:ℝ)) = -A*A*(u:ℝ) := by + rw [← Finset.sum_mul, ← Finset.mul_sum] + have h2 : (∑ i, c i*(-A)*(u:ℝ)) = -A*A*(u:ℝ) := by + rw [← Finset.sum_mul, ← Finset.sum_mul] + dsimp only [A] + ring + have h3 : (∑ i, ∑ j, c i*c j*((1-(u:ℝ))*min (t i:ℝ) (t j:ℝ))) = + (1-(u:ℝ))*∑ i, ∑ j, c i*c j*min (t i:ℝ) (t j:ℝ) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + ring + dsimp only + simp only [Fintype.sum_option,Option.elim_none,Option.elim_some, + min_self,min_eq_left (le_suffixTime u (t _)),min_eq_right (le_suffixTime u (t _))] + have ht i j : min (suffixTime u (t i):ℝ) (suffixTime u (t j):ℝ) = + (u:ℝ)+(1-(u:ℝ))*min (t i:ℝ) (t j:ℝ) := by + change min ((u:ℝ)+(1-(u:ℝ))*(t i:ℝ)) ((u:ℝ)+(1-(u:ℝ))*(t j:ℝ)) = _ + rw [min_add_add_left,← mul_min_of_nonneg _ _ (sub_nonneg.mpr u.property.2)] + simp_rw [ht,mul_add,Finset.sum_add_distrib] + change (-A)*(-A)*(u:ℝ)+(∑ i,(-A)*c i*(u:ℝ))+ + ((∑ i,c i*(-A)*(u:ℝ))+((∑ i,∑ j,c i*c j*(u:ℝ))+_)) = _ + rw [hh,h1,h2,h3] + ring + +lemma suffix_law (u : Time) : + law.map (fun ω ↦ suffixMap u (path ω)) = + law.map (fun ω ↦ Real.sqrt (1-(u:ℝ)) • path ω) := by + apply continuous_path_law_ext (X := fun ω ↦ suffixMap u (path ω)) + (Y := fun ω ↦ Real.sqrt (1-(u:ℝ)) • path ω) + ((suffixMap u).continuous.measurable.comp measurable_path) + ((show Measurable (fun f : C(Time,ℝ) ↦ Real.sqrt (1-(u:ℝ)) • f) from + (by fun_prop)).comp measurable_path) + intro ι _ c t + have hh := path_projection_law (fun i : Option ι ↦ i.elim (-∑ i,c i) c) + (fun i ↦ i.elim u (fun j ↦ suffixTime u (t j))) + rw [suffix_projection_algebra] at hh + have heq : (fun ω ↦ ∑ i, c i*suffixMap u (path ω) (t i)) = + (fun ω ↦ ∑ i : Option ι, i.elim (-∑ i,c i) c * + path ω (i.elim u (fun j ↦ suffixTime u (t j)))) := by + funext ω + simp only [Fintype.sum_option,Option.elim_none,Option.elim_some,suffixMap_apply, + mul_sub,Finset.sum_sub_distrib,neg_mul,Finset.sum_mul] + ring + rw [heq, hh.map_eq, + (scaled_path_projection_law _ (sub_nonneg.mpr u.property.2) c t).map_eq] + +lemma split_path_law (u : Time) : + law.map (fun ω ↦ (prefixMap u (path ω),suffixMap u (path ω))) = + (wiener.map (fun f ↦ Real.sqrt (u:ℝ) • f)).prod + (wiener.map (fun f ↦ Real.sqrt (1-(u:ℝ)) • f)) := by + calc + _ = (law.map (fun ω ↦ prefixMap u (path ω))).prod + (law.map (fun ω ↦ suffixMap u (path ω))) := by + simpa only [Function.comp_def] using (independent_split u).map_prod_eq_prod_map_map + ((prefixMap u).continuous.measurable.comp measurable_path).aemeasurable + ((suffixMap u).continuous.measurable.comp measurable_path).aemeasurable + _ = _ := by + rw [prefix_law,suffix_law] + unfold wiener + rw [Measure.map_map (show Measurable (fun f : C(Time,ℝ) ↦ Real.sqrt (u:ℝ) • f) from by fun_prop) measurable_path, + Measure.map_map (show Measurable (fun f : C(Time,ℝ) ↦ Real.sqrt (1-(u:ℝ)) • f) from by fun_prop) measurable_path] + rfl + +end HardSphere.Wiener + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/PrimaryObserved.lean b/lean/OAI/Analysis/HardSphere/Bridges/PrimaryObserved.lean new file mode 100644 index 0000000000000000000000000000000000000000..399c1680d4f566b19af79c21ab72bb8ad16ea024 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/PrimaryObserved.lean @@ -0,0 +1,151 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.ActualReverse +import OAI.Analysis.HardSphere.Comparison.ActualCommon + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Bridge +open Comparison +variable {I E : Type*} [Fintype I] [DecidableEq I] [MeasurableSpace E] + {X : I→Type*} [∀i,MeasurableSpace (X i)] + +omit [Fintype I] [DecidableEq I] [MeasurableSpace E] in +lemma mid_fiberEquiv (mid : ∀i,X i→E) {i j : I} (h : i=j) (x : X i) : + mid j (fiberEquiv h x)=mid i x := by cases h; rfl + +omit [Fintype I] [MeasurableSpace E] in +lemma secondPositions_reverseSelected (σ : Equiv.Perm I) (s : Finset I) + (hf : ∀i,i∉s→σ i=i) (mid : ∀i,X i→E) (x : ∀i,X i) + (z : ∀i,X (σ.symm i)) (p : ∀i:s,X i×X (σ.symm i)) (j : I) : + secondPositions σ s mid (Function.updateFinset (fun i ↦ (x i,z i)) s p) j= + mid j (Function.updateFinset x s (fun i ↦ (reverseSelected σ s hf p i).1) j) := by + by_cases hj : j∈s + · have hσj := (move_mem_iff σ s hf j).mpr hj + simp only [secondPositions,ite_eq_left hj,Function.updateFinset,dite_eq_left hj,dite_eq_left hσj, + reverseSelected_apply,mid_fiberEquiv] + rfl + · simp only [secondPositions,ite_eq_right hj,Function.updateFinset,dite_eq_right hj] + +def primaryFirstObservation (σ : Equiv.Perm I) (star a b : I) (mid : ∀i,X i→E) + (x : ∀i,X i) : E×E×({i : I // i≠star ∧ i≠b}→E) := + (mid a (x a),mid star (x star),fun i ↦ mid (σ i) (x (σ i))) + +def primarySecondObservation (star b : I) (mid : ∀i,X i→E) + (x : ∀i,X i) : E×E×({i : I // i≠star ∧ i≠b}→E) := + (mid star (x star),mid b (x b),fun i ↦ mid i (x i)) + +omit [Fintype I] [DecidableEq I] in +lemma primaryFirstObservation_measurable (σ : Equiv.Perm I) (star a b : I) + (mid : ∀i,X i→E) (hm : ∀i,Measurable (mid i)) : + Measurable (primaryFirstObservation σ star a b mid) := by + exact ((hm a).comp (measurable_pi_apply a)).prodMk + (((hm star).comp (measurable_pi_apply star)).prodMk + (Measurable.of_eval (fun i ↦ (hm (σ i)).comp (measurable_pi_apply (σ i))))) +omit [Fintype I] [DecidableEq I] in +lemma primarySecondObservation_measurable (star b : I) + (mid : ∀i,X i→E) (hm : ∀i,Measurable (mid i)) : + Measurable (primarySecondObservation star b mid) := by + exact ((hm star).comp (measurable_pi_apply star)).prodMk + (((hm b).comp (measurable_pi_apply b)).prodMk + (Measurable.of_eval (fun i ↦ (hm i).comp (measurable_pi_apply i.val)))) + +omit [Fintype I] [MeasurableSpace E] in +lemma primary_observations_eq (σ : Equiv.Perm I) (s : Finset I) + (hf : ∀i,i∉s→σ i=i) (mid : ∀i,X i→E) + (x : ∀i,X i) (p : ∀i:s,X i×X (σ.symm i)) + (hp : ∀i:s,mid i (p i).1=mid (σ.symm i) (p i).2) + (star a b : I) (hs : σ star=a) (hb : σ b=star) : + primaryFirstObservation σ star a b mid (Function.updateFinset x s (fun i ↦ (p i).1))= + primarySecondObservation star b mid + (Function.updateFinset x s (fun i ↦ (reverseSelected σ s hf p i).1)) := by + have h (j : I) : mid j (Function.updateFinset x s (fun i ↦ (reverseSelected σ s hf p i).1) j)= + mid (σ j) (Function.updateFinset x s (fun i ↦ (p i).1) (σ j)) := by + by_cases hj : j∈s + · have hσj := (move_mem_iff σ s hf j).mpr hj + simp only [Function.updateFinset,dite_eq_left hj,dite_eq_left hσj,reverseSelected_apply,mid_fiberEquiv] + exact (hp (selectedPerm σ s hf ⟨j,hj⟩)).symm + · have he : σ j∉s := by simpa only [hf j hj] using hj + simp only [Function.updateFinset,dite_eq_right hj,dite_eq_right he] + exact congrArg (fun i ↦ mid i (x i)) (hf j hj).symm + simp only [primaryFirstObservation,primarySecondObservation,h] + let F : I→E := fun i ↦ mid i (Function.updateFinset x s (fun i ↦ (p i).1) i) + change (F a,F star,fun i : {i : I // i≠star ∧ i≠b} ↦ F (σ i))= + (F (σ star),F (σ b),fun i : {i : I // i≠star ∧ i≠b} ↦ F (σ i)) + rw [hs,hb] + +end HardSphere.Bridge + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Bridge +open Comparison Wiener GaussianPacking +variable {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + {X : I→Type*} [∀i,MeasurableSpace (X i)] +lemma actual_observed_likelihoods {L : Length} + (σ : Equiv.Perm I) (s : Finset I) (hf : ∀i,i∉s→σ i=i) + (r : ℝ) (anchor : J→Torus L) (allowed : J→Set C(Time,Point)) + (label : J→I) (get : ∀j,X (label j)→allowed j) (hg : ∀j,Measurable (get j)) + (star : I) (hstar : ∀j,label j≠star) (hs : star∈s) + (μ ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (μ i)] [∀i,IsProbabilityMeasure (ν i)] + (heq : ∀i,i≠star→μ i=ν i) + (κ : ∀i,Kernel (X i) (X (σ.symm i))) [∀i,IsFiniteKernel (κ i)] + (η : ∀i,Kernel (X i) (X (σ i))) [∀i,IsFiniteKernel (η i)] + (he : ∀j:s,((μ (σ j)).compProd (κ (σ j))).map (reverseFactor (X:=X) σ j)= + (ν j).compProd (η j)) + (z : ∀i,X (σ.symm i)) (w : ∀i,X (σ i)) + {E : Type*} [MeasurableSpace E] [MeasurableEq E] + (mid : ∀i,X i→E) (hm : ∀i,Measurable (mid i)) + (hmid : ∀i:s,∀ᵐp ∂(μ i).compProd (κ i),mid i p.1=mid (σ.symm i) p.2) + (a b : I) (hsa : σ star=a) (hbs : σ b=star) : + let R := primaryChecks r anchor allowed label get hg + let C := routeChecks σ s hf r anchor allowed label get hg + let C' := routeChecks σ.symm s (reverse_fix σ s hf) r anchor allowed label get hg + let P := conditionedMeasure (Measure.pi μ) (retainedEvent R Finset.univ) + let Q := conditionedMeasure (Measure.pi ν) (retainedEvent R Finset.univ) + (P.withDensity (fun x ↦ conditionalLikelihood R C μ κ s (Finset.univ\s) x z)).map + (primaryFirstObservation σ star a b mid)= + (Q.withDensity (fun x ↦ conditionalLikelihood R C' ν η s (Finset.univ\s) x w)).map + (primarySecondObservation star b mid) := by + dsimp only + obtain ⟨h₁,h₂⟩ := actual_two_primary_laws σ s hf r anchor allowed label get hg star hstar hs μ ν heq κ η he z w + let upd : ((∀i,X i)×(∀i:s,X i×X (σ.symm i)))→(∀i,X i) := + fun p ↦ Function.updateFinset p.1 s (fun i ↦ (p.2 i).1) + let rev : ((∀i,X i)×(∀i:s,X i×X (σ.symm i)))→(∀i,X i) := + fun p ↦ Function.updateFinset p.1 s (fun i ↦ (reverseSelected σ s hf p.2 i).1) + let π : (∀i:s,X i×X (σ.symm i))→(∀i:s,X i) := fun p i ↦ (p i).1 + have hπ : Measurable π := Measurable.of_eval (fun i ↦ measurable_fst.comp (measurable_pi_apply i)) + have hu : Measurable upd := measurable_updateFinset'.comp + (measurable_fst.prodMk (hπ.comp measurable_snd)) + have hv : Measurable rev := measurable_updateFinset'.comp + (measurable_fst.prodMk (Measurable.of_eval (fun i ↦ measurable_fst.comp + ((measurable_pi_apply i).comp ((reverseSelected σ s hf).measurable.comp measurable_snd))))) + rw [←h₁,←h₂,Measure.map_map (primaryFirstObservation_measurable σ star a b mid hm) hu, + Measure.map_map (primarySecondObservation_measurable star b mid hm) hv] + apply Measure.map_congr + have h := proposal_factorSupport + (routeChecks σ s hf r anchor allowed label get hg) μ κ s (Finset.univ\s) z + (conditionedMeasure (Measure.pi μ) (retainedEvent (primaryChecks r anchor allowed label get hg) Finset.univ)) + (fun i ↦ {p | mid i p.1=mid (σ.symm i) p.2}) + (fun i ↦ measurableSet_eq_fun ((hm i).comp measurable_fst) ((hm _).comp measurable_snd)) hmid + filter_upwards [h] with p hp + exact primary_observations_eq σ s hf mid p.1 p.2 hp star a b hsa hbs + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/ReferenceHit.lean b/lean/OAI/Analysis/HardSphere/Bridges/ReferenceHit.lean new file mode 100644 index 0000000000000000000000000000000000000000..899e225e936dd235263f60e41973669bf4454219 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/ReferenceHit.lean @@ -0,0 +1,183 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.PhysicalSuccess +import OAI.Analysis.HardSphere.Bridges.LocalReference +import OAI.Analysis.HardSphere.Bridges.EarlyTorusHit + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Bridge +open Wiener GaussianPacking PathCutoff +attribute [local irreducible] torusDistance + +lemma earlyTorusHit_measurable {L : Length} (t : ℝ) (y z v : Point) + (ω : ConfigurationPath 1 L) (r C h : ℝ) : MeasurableSet (earlyTorusHit t y z v ω r C h) := by + let E : Set (C(Time,Point)×Time) := {p | h≤(p.2:ℝ) ∧ (p.2:ℝ)≤1/2 ∧ + torusDistance L (projectPoint L (p.1 p.2)) (ω p.2 0)≤r} + have hc : Continuous (fun p : C(Time,Point)×Time ↦ + torusDistance L (projectPoint L (p.1 p.2)) (ω p.2 0)) := by + apply (torusDistance_continuous_pair L).comp (f := fun p : C(Time,Point)×Time ↦ + (projectPoint L (p.1 p.2),ω p.2 0)) + apply Continuous.prodMk + · change Continuous (fun p : C(Time,Point)×Time ↦ fun j : Fin 3 ↦ (p.1 p.2 j:AddCircle L.val)) + fun_prop + · exact (continuous_apply 0).comp (ω.continuous.comp continuous_snd) + have hE : IsClosed E := by + change IsClosed ({p : C(Time,Point)×Time | h≤(p.2:ℝ)} ∩ + ({p | (p.2:ℝ)≤1/2} ∩ {p | torusDistance L (projectPoint L (p.1 p.2)) (ω p.2 0)≤r})) + exact (isClosed_le continuous_const (by fun_prop)).inter + ((isClosed_le (by fun_prop) continuous_const).inter (isClosed_le hc continuous_const)) + have hhit : IsClosed {f : C(Time,Point) | ∃s : Time,h≤(s:ℝ) ∧ (s:ℝ)≤1/2 ∧ + torusDistance L (projectPoint L (f s)) (ω s 0)≤r} := by + convert isClosedMap_fst_of_compactSpace E hE using 1 + ext f + simp only [mem_ofPred_eq,mem_image,E] + exact ⟨fun ⟨s,hs⟩ ↦ ⟨(f,s),hs,rfl⟩,fun ⟨⟨g,s⟩,hs,hg⟩ ↦ by + change g=f at hg + subst g + exact ⟨s,hs⟩⟩ + have hnorm : IsClosed {f : C(Time,Point) | ∀s : Time,‖f s-z‖≤C} := by + simp only [ofPred_forall] + exact isClosed_iInter (fun s ↦ isClosed_le ((continuous_eval_const s).sub continuous_const).norm continuous_const) + exact (((trialConfined_measurable L v).inter (hnorm.measurableSet.inter hhit.measurableSet)).preimage + (leg_continuous t y z).measurable) + +lemma leg_reverse (t : ℝ) (y z : Point) (β : Noise) (s : Time) : + leg t z y (reverseNoise β) s=leg t y z β (reverseTime s) := by + ext j + simp only [leg,ContinuousMap.coe_mk,mean,reverseNoise,bridgeReverse, + ContinuousMap.compCLM_apply,ContinuousMap.comp_apply] + change (1-(s:ℝ))*z j+(s:ℝ)*y j+_= (1-(1-(s:ℝ)))*y j+(1-(s:ℝ))*z j+_ + ring + +lemma project_leg_reverse (L : Length) (t : ℝ) (y z : Point) (β : Noise) : + projectCurve L (leg t z y (reverseNoise β)) = + reverseConfigurationPath 1 L (projectCurve L (leg t y z β)) := by + ext s i j + change ((leg t z y (reverseNoise β) s) j : AddCircle L.val)=_ + rw [leg_reverse] + rfl + +lemma leg_endpoints_ae (t : ℝ) (y z : Point) : + ∀ᵐβ ∂law,leg t y z β 0=y ∧ leg t y z β 1=z := by + have he : ∀ᵐβ ∂law,∀j : Fin 3,β j 0=0 ∧ β j 1=0 := by + exact ae_all_iff.mpr (fun j ↦ (measurePreserving_eval (fun _ : Fin 3 ↦ bridgeLaw) j).quasiMeasurePreserving.ae bridge_endpoints) + filter_upwards [he] with β hβ + constructor <;> ext j <;> simp [leg,mean,(hβ j).1,(hβ j).2] + +lemma reference_collision {L : Length} {n : ℕ} (hn : 0 infer_instance + +omit [Fintype I] in +lemma extendSelectedPair_bounds (σ : Equiv.Perm I) (s : Finset I) + (μ ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (μ i)] [∀i,IsProbabilityMeasure (ν i)] + (ρ : ∀i:s,Measure (X i×X (σ.symm i))) {G : ℝ≥0∞} (hG : 1≤G) + (hfst : ∀i,(ρ i).fst≤G • μ i) (hsnd : ∀i,(ρ i).snd≤G • ν (σ.symm i)) (i : I) : + (extendSelectedPair σ s μ ν ρ i).fst≤G • μ i ∧ + (extendSelectedPair σ s μ ν ρ i).snd≤G • ν (σ.symm i) := by + unfold extendSelectedPair + split + · exact ⟨hfst _,hsnd _⟩ + · rw [Measure.fst_prod,Measure.snd_prod] + constructor <;> intro A + · simpa only [Measure.smul_apply,smul_eq_mul,one_mul] using (mul_le_mul' hG (le_refl (μ i A))) + · simpa only [Measure.smul_apply,smul_eq_mul,one_mul] using (mul_le_mul' hG (le_refl (ν (σ.symm i) A))) + +end HardSphere.Bridge +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/RouteFrozen.lean b/lean/OAI/Analysis/HardSphere/Bridges/RouteFrozen.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6e7973d24453694851d56721e8dc2ba6d9102a2 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/RouteFrozen.lean @@ -0,0 +1,137 @@ +import Mathlib +import OAI.Analysis.HardSphere.Conditioning.ReferenceResample +import OAI.Analysis.HardSphere.Bridges.SelectedReverse + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Bridge +open Wiener GaussianPacking Comparison +attribute [local instance] Classical.propDecidable +variable {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + {L : Length} {X : I → Type*} [∀i,MeasurableSpace (X i)] + (σ : Equiv.Perm I) (S : Finset I) (hfix : ∀i,i∉S → σ i=i) + (r : ℝ) (anchor : J → Torus L) (allowed : J → Set C(Time,Point)) + (label : J → I) (get : ∀j,X (label j) → allowed j) (hg : ∀j,Measurable (get j)) + +omit [Fintype I] [Fintype J] [DecidableEq J] in +lemma routeChecks_primary_weight (u : Finset I) (p : ∀i,X i×X (σ.symm i)) : + checkWeight (routeChecks σ S hfix r anchor allowed label get hg) u p≤ + checkWeight (primaryChecks r anchor allowed label get hg) u (fun i ↦ (p i).1) := by + by_cases hp : p∈retainedEvent (routeChecks σ S hfix r anchor allowed label get hg) u + · rw [checkWeight,Set.indicator_of_mem hp,checkWeight, + Set.indicator_of_mem (routeChecks_primary σ S hfix r anchor allowed label get hg u p hp)] + · rw [checkWeight,Set.indicator_of_notMem hp] + exact bot_le + +omit [Fintype J] [DecidableEq J] in +lemma routeChecks_frozen_outside (U o : Finset I) (hSU : S⊆U) (hSo : Disjoint S o) + (x : ∀i,X i) (z : ∀i,X (σ.symm i)) + (hx : x∈retainedEvent (primaryChecks r anchor allowed label get hg) (Finset.univ\U)) + (y : ∀i,X i) (u : ∀i,X (σ.symm i)) + (hy : y∈retainedEvent (frozenChecks (primaryChecks r anchor allowed label get hg) U x) o) : + (fun i ↦ (y i,u i))∈retainedEvent (frozenChecks (routeChecks σ S hfix r anchor allowed label get hg) + U (fun i ↦ (x i,z i))) o := by + have hSc : Disjoint S (Finset.univ\U) := Finset.disjoint_left.mpr (fun i hi hic ↦ + (Finset.mem_sdiff.mp hic).2 (hSU hi)) + have hz := routeChecks_outside σ S hfix r anchor allowed label get hg (Finset.univ\U) hSc + (fun i ↦ (x i,z i)) hx + apply (frozen_retained _ U o _ _ hz).mpr + have hyo := (frozen_retained _ U o _ _ hx).mp hy + apply routeChecks_outside σ S hfix r anchor allowed label get hg (o∪(Finset.univ\U)) + (Finset.disjoint_union_right.mpr ⟨hSo,hSc⟩) + convert hyo using 1 + funext i + by_cases hi : i∈U <;> simp only [freezeOutside,hi,ite_true,ite_false] + +omit [Fintype J] [DecidableEq J] in +lemma routeChecks_frozen_primary (U o : Finset I) (hSU : S⊆U) + (x : ∀i,X i) (z : ∀i,X (σ.symm i)) + (hx : x∈retainedEvent (primaryChecks r anchor allowed label get hg) (Finset.univ\U)) + (y : ∀i,X i) (u : ∀i,X (σ.symm i)) : + checkWeight (frozenChecks (routeChecks σ S hfix r anchor allowed label get hg) U (fun i ↦ (x i,z i))) o + (fun i ↦ (y i,u i))≤checkWeight (frozenChecks (primaryChecks r anchor allowed label get hg) U x) o y := by + have hSc : Disjoint S (Finset.univ\U) := Finset.disjoint_left.mpr (fun i hi hic ↦ + (Finset.mem_sdiff.mp hic).2 (hSU hi)) + have hz := routeChecks_outside σ S hfix r anchor allowed label get hg (Finset.univ\U) hSc + (fun i ↦ (x i,z i)) hx + rw [frozen_checkWeight _ U o _ _ hz,frozen_checkWeight _ U o _ _ hx] + convert routeChecks_primary_weight σ S hfix r anchor allowed label get hg (o∪(Finset.univ\U)) + (freezeOutside U (fun i ↦ (x i,z i)) (fun i ↦ (y i,u i))) using 1 + congr 2 + funext i + by_cases hi : i∈U <;> simp only [freezeOutside,hi,ite_true,ite_false] + +end HardSphere.Bridge + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Bridge +open Comparison Wiener GaussianPacking +variable {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + {X : I→Type*} [∀i,MeasurableSpace (X i)] + +lemma proposalKernel_reverse {L : Length} + (σ : Equiv.Perm I) (s : Finset I) (hf : ∀i,i∉s→σ i=i) + (r : ℝ) (anchor : J→Torus L) (allowed : J→Set C(Time,Point)) + (label : J→I) (get : ∀j,X (label j)→allowed j) (hg : ∀j,Measurable (get j)) + (μ ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (μ i)] [∀i,IsProbabilityMeasure (ν i)] + (κ : ∀i,Kernel (X i) (X (σ.symm i))) [∀i,IsFiniteKernel (κ i)] + (η : ∀i,Kernel (X i) (X (σ i))) [∀i,IsFiniteKernel (η i)] + (he : ∀j:s,((μ (σ j)).compProd (κ (σ j))).map (reverseFactor (X:=X) σ j)= + (ν j).compProd (η j)) + (z : ∀i,X (σ.symm i)) (w : ∀i,X (σ i)) : + (proposalKernel (routeChecks σ s hf r anchor allowed label get hg) μ κ s (Finset.univ\s) z).map + (reverseSelected σ s hf)= + proposalKernel (routeChecks σ.symm s (reverse_fix σ s hf) r anchor allowed label get hg) + ν η s (Finset.univ\s) w := by + ext x B hB + rw [Kernel.map_apply _ (reverseSelected σ s hf).measurable x, + proposalKernel_apply,proposalKernel_apply] + change ((conditionedMeasure (Measure.pi fun i:s ↦ (μ i).compProd (κ i)) + {p | Function.updateFinset (fun i ↦ (x i,z i)) s p∈ + retainedEvent (routeChecks σ s hf r anchor allowed label get hg) (s∪(Finset.univ\s))}).map + (reverseSelected σ s hf)) B=_ + simp only [Finset.union_sdiff_of_subset (Finset.subset_univ s)] + rw [selected_reverse_same_outside σ s hf r anchor allowed label get hg x z w] + simp_rw [show ∀j:s,((μ ((selectedPerm σ s hf) j)).compProd (κ ((selectedPerm σ s hf) j))).map + (reverseFactor (X:=X) σ j)=(ν j).compProd (η j) from he] + simp only [proposalFiber, Finset.union_sdiff_of_subset (Finset.subset_univ s)] + rfl + +lemma full_paired_reverse {L : Length} + (σ : Equiv.Perm I) (s : Finset I) (hf : ∀i,i∉s→σ i=i) + (r : ℝ) (anchor : J→Torus L) (allowed : J→Set C(Time,Point)) + (label : J→I) (get : ∀j,X (label j)→allowed j) (hg : ∀j,Measurable (get j)) + (μ ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (μ i)] [∀i,IsProbabilityMeasure (ν i)] + (κ : ∀i,Kernel (X i) (X (σ.symm i))) [∀i,IsFiniteKernel (κ i)] + (η : ∀i,Kernel (X i) (X (σ i))) [∀i,IsFiniteKernel (η i)] + (he : ∀j:s,((μ (σ j)).compProd (κ (σ j))).map (reverseFactor (X:=X) σ j)= + (ν j).compProd (η j)) + (z : ∀i,X (σ.symm i)) (w : ∀i,X (σ i)) + (ξ : Measure (∀i,X i)) [SFinite ξ] : + (ξ.compProd (proposalKernel (routeChecks σ s hf r anchor allowed label get hg) μ κ s (Finset.univ\s) z)).map + (Prod.map id (reverseSelected σ s hf))= + ξ.compProd (proposalKernel (routeChecks σ.symm s (reverse_fix σ s hf) r anchor allowed label get hg) + ν η s (Finset.univ\s) w) := by + rw [←Measure.compProd_map (reverseSelected σ s hf).measurable, + proposalKernel_reverse σ s hf r anchor allowed label get hg μ ν κ η he z w] + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/RouteInsertion.lean b/lean/OAI/Analysis/HardSphere/Bridges/RouteInsertion.lean new file mode 100644 index 0000000000000000000000000000000000000000..64d58c6d13a88192daa6162ab62c2d215a3a4909 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/RouteInsertion.lean @@ -0,0 +1,152 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.RouteFrozen +import OAI.Analysis.HardSphere.Collisions.FirstCoordinate +import OAI.Analysis.HardSphere.Allocation.SeparatedPhysical + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Bridge +open Wiener GaussianPacking Comparison Groups CellOrbital +attribute [local instance] Classical.propDecidable +variable {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + {L : Length} {X : I → Type*} [∀i,MeasurableSpace (X i)] +lemma route_insertion {K : ℕ} [NeZero K] (hL : L.val=(K:ℝ)) + (r : ℝ) (anchor : J→Torus L) (center : I→Fin 3→Fin K) + (M : ℕ) (hm : ∀v,(Finset.univ.filter (fun i : I ↦ center i=v)).card≤M) + (allowed : J→Set C(Time,Point)) (label : J→I) (hl : Function.Injective label) + (get : ∀j,X (label j)→allowed j) (hg : ∀j,Measurable (get j)) + (σ : Equiv.Perm I) (S : Finset I) (hfix : ∀i,i∉S → σ i=i) + (hc : ∀b j,torusDistance L (anchor j) (gridCenter L (center (routeOwner σ label b j)))≤1) + (ν : ∀i,Measure (X i×X (σ.symm i))) [∀i,IsProbabilityMeasure (ν i)] + (P : ∀j,Measure (allowed j)) (G q a : ℝ≥0∞) + (hdom : ∀b j,routeOwner σ label b j∈S → (ν (routeOwner σ label b j)).map + (routePath σ S hfix allowed label get b j)≤G • P j) + (hq : ∀j k,j≠k → ∀g : allowed k,P j {f | TrialCollision r (projectCurve L g.val) f.val}≤q) + (hsmall : a+(4*(49^3*M):ℕ)*(G*q)≤1) : + UniformInsertionOn (routeChecks σ S hfix r anchor allowed label get hg) ν a S := by + unfold routeChecks + exact physicalSparseChecks_insertion (V:=fun i ↦ X i×X (σ.symm i)) hL r anchor center M hm allowed (routeOwner σ label) + (routeOwner_injective σ label hl) hc (routePath σ S hfix allowed label get) + (routePath_measurable σ S hfix allowed label get hg) ν P G q a S hdom hq hsmall + +omit [Fintype I] [Fintype J] [DecidableEq J] in +lemma route_frozen_separated (r : ℝ) (anchor : J→Torus L) (center : I→Torus L) + (allowed : J→Set C(Time,Point)) (label : J→I) + (get : ∀j,X (label j)→allowed j) (hg : ∀j,Measurable (get j)) + (σ : Equiv.Perm I) (S : Finset I) (hfix : ∀i,i∉S → σ i=i) + (hc : ∀b j,torusDistance L (anchor j) (center (routeOwner σ label b j))≤1) + (U s t : Finset I) (x : ∀i,X i×X (σ.symm i)) + (hfar : ∀i∈s,∀j∈t,23 simp + | succ n ih => + rw [Finset.sum_range_succ] + have hp : 0.trans + exact mul_le_mul_of_nonneg_left hn (by positivity) + _ ≤ _ := by + unfold hitConstant + have ha0 : 0≤(1+A)^3 := by positivity + have hh : 32*(packingConstant*(8*ε⁻¹^3+1/((t*(s:ℝ))*Real.sqrt (t*(s:ℝ))))) ≤ + 256*(packingConstant+1)*(ε⁻¹^3+1/((t*(s:ℝ))*Real.sqrt (t*(s:ℝ)))) := by + nlinarith [mul_nonneg hk hd0] + have hmul := mul_le_mul_of_nonneg_right hh (mul_nonneg (pow_nonneg hr.le 3) (mul_nonneg hnon ha0)) + simpa only [mul_assoc,mul_comm,mul_left_comm] using hmul + +lemma joint_segment_sum_bound {m : ℕ} (y : Fin m → Point) (s w : Time) + (c : C(Time,Point)) {t r C A ε : ℝ} (ht : 0 simp [E,hji] + +lemma failure_integral_sum {L : Length} {N m : ℕ} (n : ℕ) (t r R C S : ℝ) (w : Time) + (y z : Fin m → Point) (v : Point) (ω : Fin N → ConfigurationPath 1 L) (label : Fin m → Fin N) + (J : Finset (Fin N)) {B : Set Point} (hB : MeasurableSet B) (hBvol : volume B≤1) + (hfar : ∀j,j∉J → ∀f,TrialCutoff L n r R C w S v f → ¬TrialCollision r (ω j) f) + (δ ζ : ℝ≥0∞) + (hcut : ∀i u,u∈B → trialKernel t (y i) (z i) u {f | ¬TrialCutoff L n r R C w S v f}≤δ) + (hhit : ∀j∈J, (∑i∈Finset.univ.filter (fun i ↦ j≠label i), + ((volume.restrict B).prod (law.prod law)) (trialCutoffHit n t r R C S (y i) (z i) v B w (ω j)))≤ζ) : + (∑i,∫⁻u in B,trialKernel t (y i) (z i) u (SuccessExcept n r R C S w v ω (label i))ᶜ)≤ + (m:ℝ≥0∞)*δ+(J.card:ℝ≥0∞)*ζ := by + classical + let H := fun i j ↦ ((volume.restrict B).prod (law.prod law)) + (trialCutoffHit n t r R C S (y i) (z i) v B w (ω j)) + have hi (i : Fin m) : (∫⁻u in B,trialKernel t (y i) (z i) u (SuccessExcept n r R C S w v ω (label i))ᶜ)≤ + δ+∑j∈J,if j=label i then 0 else H i j := by + apply (lintegral_mono fun u ↦ failure_except_le n t r R C S w (y i) (z i) v u ω (label i) J hfar).trans + have hcm : MeasurableSet {f | ¬TrialCutoff L n r R C w S v f} := (trialCutoff_measurable L n r R C w S v).compl + rw [lintegral_add_left ((trialKernel t (y i) (z i)).measurable_coe hcm)] + apply add_le_add + · calc + _ ≤ ∫⁻_ in B,δ := lintegral_mono_ae (by filter_upwards [ae_restrict_mem hB] with u hu using hcut i u hu) + _ = δ*volume B := by simp + _ ≤ δ := by simpa using mul_le_mul_right hBvol δ + · rw [lintegral_finsetSum' J] + · apply Finset.sum_le_sum + intro j hj + by_cases hji : j=label i + · simp [hji] + · simp only [hji,ite_false] + exact le_of_eq (trialCutoffHit_integral n t r R C S (y i) (z i) v hB w (ω j)) + · intro j hj + by_cases hji : j=label i + · simp only [hji,ite_true]; exact measurable_const.aemeasurable + · simp only [hji,ite_false] + exact ((trialKernel t (y i) (z i)).measurable_coe + ((trialCutoff_measurable L n r R C w S v).inter (trialCollision_closed r (ω j)).measurableSet)).aemeasurable + apply (Finset.sum_le_sum (fun i _ ↦ hi i)).trans + rw [Finset.sum_add_distrib,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul,Finset.sum_comm] + apply add_le_add le_rfl + calc + _ = ∑j∈J,∑i∈Finset.univ.filter (fun i ↦ j≠label i),H i j := by + apply Finset.sum_congr rfl + intro j hj + rw [Finset.sum_filter] + apply Finset.sum_congr rfl + intro i _ + by_cases hji : j=label i <;> simp [hji] + _ ≤ ∑_j∈J,ζ := Finset.sum_le_sum (fun j hj ↦ hhit j hj) + _ = _ := by simp [nsmul_eq_mul] + +lemma physical_failure_sum {L : Length} {N m n : ℕ} (hn : 0 linarith + +lemma isOpenMap_project (N : ℕ) (L : Length) : IsOpenMap (project N L) := by + have hcircle : Function.Surjective (fun t : ℝ ↦ (t : AddCircle L.val)) := by + intro x + exact ⟨(AddCircle.equivIco L.val 0 x).val,AddCircle.coe_equivIco⟩ + have hopen : IsOpenMap (fun X : Fin 3 → ℝ ↦ fun j ↦ (X j : AddCircle L.val)) := + IsOpenMap.piMap (fun _ ↦ QuotientAddGroup.isOpenMap_coe) (Eventually.of_forall (fun _ ↦ hcircle)) + exact IsOpenMap.piMap (fun _ : Fin N ↦ hopen) + (Eventually.of_forall (fun _ ↦ Function.Surjective.piMap (fun _ ↦ hcircle))) + +lemma project_ball_preserving {N : ℕ} (L : Length) (c : LiftedConfiguration N) {r : ℝ} + (hr : r≤L.val/2) : MeasurePreserving (project N L) (volume.restrict (Metric.ball c r)) + (volume.restrict ((project N L) '' Metric.ball c r)) := by + have hsub := ball_subset_localLiftChart L c hr + have he : (project N L) ⁻¹' ((project N L) '' Metric.ball c r) ∩ localLiftChart L c=Metric.ball c r := by + ext X + constructor + · rintro ⟨⟨Y,hY,hYX⟩,hX⟩ + exact (project_injOn_chart L c (hsub hY) hX hYX) ▸ hY + · intro hX + exact ⟨mem_image_of_mem _ hX,hsub hX⟩ + have h := (localLiftChart_preserving L c).restrict_preimage + ((isOpenMap_project N L) (Metric.ball c r) Metric.isOpen_ball).measurableSet + rw [Measure.restrict_restrict (((isOpenMap_project N L) (Metric.ball c r) Metric.isOpen_ball).measurableSet.preimage (continuous_project N L).measurable),he] at h + exact h + +lemma killed_ae_torus_local_pairs {N : ℕ} (L : Length) (a : ℝ) + {P : Configuration N L → Configuration N L → Prop} + (hPm : MeasurableSet {p : Configuration N L×Configuration N L | P p.1 p.2}) + (hP : ∀t, 0 linarith [hh.1,hh.2] + +end HardSphere.Bridge + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Bridge +open Wiener GaussianPacking PathCutoff Comparison +attribute [local instance] Classical.propDecidable + +def StrongExcept {L : Length} {N : ℕ} (n : ℕ) (t r R C S : ℝ) (w : Time) + (y z v : Point) (ω : Fin N → ConfigurationPath 1 L) (label : Fin N) + (B : Fin 7 → Set Point) : Prop := + ∀j, ENNReal.ofReal (99/100:ℝ)≤(volume.restrict (B j)) + {u | ENNReal.ofReal (9/10:ℝ)≤trialKernel t y z u (SuccessExcept n r R C S w v ω label)} + +lemma full_success_count {L : Length} {N m : ℕ} (n : ℕ) (t r R C S : ℝ) (w : Time) + (y z : Fin m → Point) (v : Point) (ω : Fin N → ConfigurationPath 1 L) + (label : Fin m → Fin N) (B : Fin 7 → Set Point) + (hB : ∀j,MeasurableSet (B j)) (hvol : ∀j,volume (B j)=1) + (herror : ∀j, (∑i,∫⁻u in B j,trialKernel t (y i) (z i) u + (SuccessExcept n r R C S w v ω (label i))ᶜ)≤ENNReal.ofReal ((m:ℝ)/70000)) : + ((Finset.univ.filter (fun i ↦ ¬StrongExcept n t r R C S w (y i) (z i) v ω (label i) B)).card:ℝ)≤(m:ℝ)/10 := by + classical + let f : Fin m → Fin 7 → ℝ≥0∞ := fun i j ↦ ∫⁻u in B j, + trialKernel t (y i) (z i) u (SuccessExcept n r R C S w v ω (label i))ᶜ + have hf_le (i : Fin m) (j : Fin 7) : f i j≤1 := by + calc + _ ≤ ∫⁻_ in B j,(1:ℝ≥0∞) := lintegral_mono (fun _ ↦ prob_le_one) + _ = _ := by simp [hvol] + have hf_fin (i : Fin m) (j : Fin 7) : f i j≠⊤ := ne_top_of_le_ne_top ENNReal.one_ne_top (hf_le i j) + have hsum (j : Fin 7) : (∑i,(f i j).toReal)≤(m:ℝ)/70000 := by + rw [←ENNReal.toReal_sum (fun i _ ↦ hf_fin i j)] + have hh := ENNReal.toReal_mono ENNReal.ofReal_ne_top (herror j) + simpa only [f,ENNReal.toReal_ofReal (by positivity : 0≤(m:ℝ)/70000)] using hh + have hc := seven_target_count (fun i j ↦ (f i j).toReal) (fun _ _ ↦ ENNReal.toReal_nonneg) hsum + have hsub : Finset.univ.filter (fun i ↦ ¬StrongExcept n t r R C S w (y i) (z i) v ω (label i) B)⊆ + Finset.univ.filter (fun i ↦ ∃j,(1/1000:ℝ)<(f i j).toReal) := by + intro i hi + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ i,?_⟩ + by_contra! hn + have hg : StrongExcept n t r R C S w (y i) (z i) v ω (label i) B := by + intro j + let _ : IsProbabilityMeasure (volume.restrict (B j)) := + ⟨by rw [Measure.restrict_apply' (hB j), Set.univ_inter, hvol]⟩ + apply good_target_mass_of_failure _ _ _ (successExcept_measurable n r R C S w v ω (label i)) + change f i j≤ENNReal.ofReal (1/1000:ℝ) + apply (ENNReal.toReal_le_toReal (hf_fin i j) ENNReal.ofReal_ne_top).mp + simpa using hn j + exact (Finset.mem_filter.mp hi).2 hg + exact (Nat.cast_le.mpr (Finset.card_le_card hsub)).trans hc + +lemma successExcept_mono_obstacles {L : Length} {N : ℕ} (n : ℕ) (r R C S : ℝ) + (w : Time) (v : Point) (ω : Fin N → ConfigurationPath 1 L) (i : Fin N) (J : Finset (Fin N)) + (hi : i∉J) : + SuccessExcept n r R C S w v ω i⊆ + {f | TrialCutoff L n r R C w S v f ∧ ∀j∈J,¬TrialCollision r (ω j) f} := by + intro f hf + exact ⟨hf.1,fun j hj ↦ hf.2 j (fun he ↦ hi (he ▸ hj))⟩ + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Bridges/WienerGaussian.lean b/lean/OAI/Analysis/HardSphere/Bridges/WienerGaussian.lean new file mode 100644 index 0000000000000000000000000000000000000000..d31464735038950484659af0fb32f55d4ebc01b8 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Bridges/WienerGaussian.lean @@ -0,0 +1,167 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.PartialIndex +import OAI.Analysis.HardSphere.Operators.Regularize + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory Filter Set ProbabilityTheory +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Wiener + +lemma norm_tent_combination_le (n : ℕ) (c : Fin (2^n) → ℝ) + (hc : ∀ k, |c k| ≤ 1) : ‖∑ k, c k • tentMap n k‖ ≤ 1 := by + apply (ContinuousMap.norm_le _ (by norm_num)).mpr + intro t + simp only [ContinuousMap.sum_apply, ContinuousMap.smul_apply, smul_eq_mul, Real.norm_eq_abs] + calc + |∑ k, c k * tentMap n k t| ≤ ∑ k, |c k * tentMap n k t| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ k, tent n k t := by + apply Finset.sum_le_sum + intro k _ + change |c k * tent n k t|≤_ + rw [abs_mul, abs_of_nonneg (tent_nonneg n k t)] + simpa only [one_mul] using mul_le_mul_of_nonneg_right (hc k) (tent_nonneg n k t) + _ ≤ 1 := sum_tent_le_one n t + +lemma dual_tent_sum_abs_le (L : C(Time,ℝ) →L[ℝ] ℝ) (n : ℕ) : + ∑ k, |L (tentMap n k)| ≤ ‖L‖ := by + classical + let c : Fin (2^n) → ℝ := fun k ↦ if 0 ≤ L (tentMap n k) then 1 else -1 + have hc : ∀ k, |c k|≤1 := by intro k; simp only [c]; split <;> norm_num + have he : L (∑ k, c k • tentMap n k) = ∑ k, |L (tentMap n k)| := by + rw [map_sum] + apply Finset.sum_congr rfl + intro k _ + rw [map_smul] + simp only [smul_eq_mul,c] + split_ifs with h + · simp [abs_of_nonneg h] + · simp [abs_of_neg (lt_of_not_ge h)] + calc + ∑ k, |L (tentMap n k)| ≤ |L (∑ k, c k • tentMap n k)| := by rw [he]; exact le_abs_self _ + _ ≤ ‖L‖ * ‖∑ k, c k • tentMap n k‖ := L.le_opNorm _ + _ ≤ ‖L‖ * 1 := mul_le_mul_of_nonneg_left (norm_tent_combination_le n c hc) (L.opNorm_nonneg) + _ = ‖L‖ := mul_one _ + +lemma dual_tent_sum_sq_le (L : C(Time,ℝ) →L[ℝ] ℝ) (n : ℕ) : + ∑ k, L (tentMap n k)^2 ≤ ‖L‖^2 := by + have h := dual_tent_sum_abs_le L n + calc + ∑ k, L (tentMap n k)^2 = ∑ k, |L (tentMap n k)|^2 := by simp + _ ≤ (∑ k, |L (tentMap n k)|)^2 := by + rw [sq, Finset.sum_mul_sum] + apply Finset.sum_le_sum + intro k _ + rw [sq] + exact Finset.single_le_sum (f := fun j ↦ |L (tentMap n k)| * |L (tentMap n j)|) + (fun j _ ↦ mul_nonneg (abs_nonneg _) (abs_nonneg _)) (Finset.mem_univ k) + _ ≤ ‖L‖^2 := pow_le_pow_left₀ (Finset.sum_nonneg (fun _ _ ↦ abs_nonneg _)) h 2 + +lemma amplitude_sq (n : ℕ) : amplitude n ^ 2 = (1/4:ℝ)*(1/2:ℝ)^n := by + simp only [amplitude,mul_pow] + rw [←pow_mul,Nat.mul_comm n 2,pow_mul,inv_pow,Real.sq_sqrt (by norm_num : (0:ℝ)≤2)] + norm_num + +lemma dual_variance_summable (L : C(Time,ℝ) →L[ℝ] ℝ) : + Summable (fun n ↦ amplitude n^2 * ∑ k, L (tentMap n k)^2) := by + apply Summable.of_nonneg_of_le (fun n ↦ by positivity) + (fun n ↦ mul_le_mul_of_nonneg_left (dual_tent_sum_sq_le L n) (sq_nonneg _)) + simp_rw [amplitude_sq] + simpa only [mul_assoc, mul_left_comm, mul_comm] using + (summable_geometric_of_lt_one (by norm_num : (0:ℝ)≤1/2) (by norm_num : (1/2:ℝ)<1)).mul_left ((1/4:ℝ)*‖L‖^2) + +def dualCoefficient (L : C(Time,ℝ) →L[ℝ] ℝ) (n : ℕ) : PartialIndex n → ℝ + | .inl _ => L linearPath + | .inr ⟨m,k⟩ => amplitude m * L (tentMap m k) + +lemma dual_partialPath_expansion (L : C(Time,ℝ) →L[ℝ] ℝ) (n : ℕ) (ω : Noise) : + L (partialPath n ω) = ∑ i, dualCoefficient L n i * ω (partialEmbed n i) := by + simp only [Fintype.sum_sum_type,Fintype.sum_sigma,dualCoefficient,partialEmbed, + Fintype.sum_unique,partialPath,map_add,map_smul,map_sum,level,smul_eq_mul] + rw [Fin.sum_univ_eq_sum_range (fun m ↦ ∑ k : Fin (2^m), amplitude m * L (tentMap m k) * ω (.inr ⟨m,k⟩)) n] + congr 1 + · change ω (.inl ()) * L linearPath = L linearPath * ω (.inl ()) + ring + · apply Finset.sum_congr rfl + intro m _ + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro k _ + ring + +lemma dual_partial_variance (L : C(Time,ℝ) →L[ℝ] ℝ) (n : ℕ) : + (∑ i : PartialIndex n, dualCoefficient L n i ^ 2) = + L linearPath ^ 2 + ∑ m ∈ Finset.range n, amplitude m^2 * ∑ k, L (tentMap m k)^2 := by + simp only [Fintype.sum_sum_type,Fintype.sum_sigma,dualCoefficient,Fintype.sum_unique,mul_pow,←Finset.mul_sum] + rw [Fin.sum_univ_eq_sum_range (fun m ↦ amplitude m^2 * ∑ k, L (tentMap m k)^2) n] + +lemma dual_path_law (L : C(Time,ℝ) →L[ℝ] ℝ) : + HasLaw (fun ω ↦ L (path ω)) + (gaussianReal 0 (Real.toNNReal (L linearPath^2 + ∑' n, amplitude n^2 * ∑ k, L (tentMap n k)^2))) law := by + have hv : Tendsto (fun n ↦ Real.toNNReal (∑ i : PartialIndex n, dualCoefficient L n i ^2)) atTop + (𝓝 (Real.toNNReal (L linearPath^2 + ∑' n, amplitude n^2 * ∑ k, L (tentMap n k)^2))) := by + simp_rw [dual_partial_variance] + exact continuous_real_toNNReal.tendsto _ |>.comp + (tendsto_const_nhds.add ((dual_variance_summable L).hasSum.tendsto_sum_nat)) + apply hasLaw_gaussian_of_ae_tendsto (X := fun n ω ↦ L (partialPath n ω)) (m := fun _ ↦ 0) + (v := fun n ↦ Real.toNNReal (∑ i : PartialIndex n, dualCoefficient L n i^2)) _ _ tendsto_const_nhds hv + · intro n + have h := finite_coordinate_law n (dualCoefficient L n) + simp_rw [←dual_partialPath_expansion] at h + convert h using 2 + rw [Real.toNNReal_sum_of_nonneg (fun i _ ↦ sq_nonneg (dualCoefficient L n i))] + apply Finset.sum_congr rfl + intro i _ + exact Real.toNNReal_of_nonneg (sq_nonneg _) + · filter_upwards [ae_partialPath_tendsto] with ω hω + exact L.continuous.tendsto _ |>.comp hω + +instance wiener_isGaussian : IsGaussian wiener := by + apply isGaussian_of_map_eq_gaussianReal + intro L + refine ⟨0,Real.toNNReal (L linearPath^2 + ∑' n, amplitude n^2 * ∑ k, L (tentMap n k)^2),?_⟩ + rw [wiener,Measure.map_map L.continuous.measurable measurable_path] + exact (dual_path_law L).map_eq + +theorem wiener_exists_integrable_exp_sq : + ∃ c, 0.aestronglyMeasurable measurableSet_Ioc)).mpr + exact hf.pow 2 |>.integrableOn_Icc |>.mono_set Ioc_subset_Icc_self + +lemma inv_sq_integral {r s : ℝ} (hr : 0 simp [activeLabels] + | succ n => + let μ := Measure.pi (fun a ↦ volume.restrict (cube (b (σ a)) l)) + let M := ∫⁻ X, ENNReal.ofReal (‖F X‖^2) ∂μ + let G := fun i ↦ ∫⁻ X, ENNReal.ofReal (particleGradSq F i X) ∂μ + let C := ENNReal.ofReal (Real.sqrt 3*l^3/r) + have hi (i : Fin (n+1)) (hi : i∈activeLabels σ) : M≤C*G i := by + obtain ⟨j,hji,hs⟩ := (mem_activeLabels σ i).mp hi + obtain ⟨k,rfl⟩ := Fin.exists_succAbove_eq hji + exact sector_coordinate_capacity hF hr hl (fun a ↦ b (σ a)) i k (congrArg b hs) hz + calc + _ = ∑ _ ∈ activeLabels σ, M := by simp only [Finset.sum_const,nsmul_eq_mul]; rfl + _ ≤ ∑ i ∈ activeLabels σ, C*G i := Finset.sum_le_sum hi + _ = C*∑ i ∈ activeLabels σ, G i := (Finset.mul_sum _ _ _).symm + _ ≤ C*∑ i, G i := by gcongr; exact Finset.subset_univ _ + _ = _ := rfl + +lemma activeLabels_reindex_card {I J C : Type*} [Fintype I] [Fintype J] + (e : I ≃ J) (σ : I → C) : (activeLabels (σ ∘ e.symm)).card=(activeLabels σ).card := by + classical + have he : (activeLabels (σ ∘ e.symm)).map e.symm.toEmbedding=activeLabels σ := by + ext i + simp only [Finset.mem_map,Equiv.toEmbedding_apply,mem_activeLabels,Function.comp_apply] + constructor + · rintro ⟨j,⟨k,hkj,hσ⟩,rfl⟩ + exact ⟨e.symm k,fun h ↦ hkj (e.symm.injective h),hσ⟩ + · rintro ⟨k,hki,hσ⟩ + refine ⟨e i,⟨e k,fun h ↦ hki (e.injective h),?_⟩,e.symm_apply_apply i⟩ + simpa only [Equiv.symm_apply_apply] using hσ + rw [←he,Finset.card_map] + +lemma finite_sector_active_capacity {I C : Type*} [Fintype I] [Fintype C] [DecidableEq I] + {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {F : (I → Point) → E} (hF : ContDiff ℝ 1 F) + {r l : ℝ} (hr : 0 omega + | succ n => + unfold insertFirst + have h := (cons_preserving (n:=n) L).comp + (Measure.measurePreserving_swap (μ:=(volume : Measure (Torus L))) (ν:=volume)) + convert h using 1 <;> simp [Function.comp_def] + +lemma bathFirst_preserving {N : ℕ} (hN : 0 rfl + rw [←he,closeLabels_cons] + simp only [Fin.tail_cons] + by_cases hvz : v=z + · subst v + simp only [ite_true] + split_ifs <;> omega + · have hzv : z≠v := Ne.symm hvz + rw [ite_eq_right hvz,ite_eq_right (hsep z v hzv (X 0) hx)] + +noncomputable def insertionCount {S : Type*} [DecidableEq S] (site : ℕ → S) (t : ℕ) (z : S) : ℕ := + ((Finset.range t).filter (fun i ↦ site i=z)).card + +lemma insertionCount_zero {S : Type*} [DecidableEq S] (site : ℕ → S) (z : S) : + insertionCount site 0 z=0 := by simp [insertionCount] + +lemma insertionCount_succ {S : Type*} [DecidableEq S] (site : ℕ → S) (t : ℕ) (z : S) : + insertionCount site (t+1) z=insertionCount site t z+(if site t=z then 1 else 0) := by + simp only [insertionCount,Finset.card_filter,Finset.sum_range_succ] + +lemma insertionCount_mono {S : Type*} [DecidableEq S] (site : ℕ → S) {t T : ℕ} (ht : t ≤ T) (z : S) : + insertionCount site t z ≤ insertionCount site T z := by + apply Finset.card_le_card + intro i hi + obtain ⟨hi,hiz⟩ := Finset.mem_filter.mp hi + exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr ((Finset.mem_range.mp hi).trans_le ht),hiz⟩ + +lemma local_insertion_iterated : ∃ C : ℝ, 0 + refine ⟨u,hu,rfl,?_,?_⟩ + · simp only [Nat.cast_zero,zero_mul,add_zero,le_refl] + · simpa only [insertionCount_zero,Nat.add_zero] using hk + | succ t ih => + obtain ⟨v,hv,hvn,hve,hvk⟩ := ih (Nat.le_trans (Nat.le_succ t) ht) + have hmass : C*(w (site t)).orbitalBound*(k+m:ℕ)*r^3 ≤ 1/4 := by + apply le_trans _ hs + simp only [Nat.cast_add] + apply mul_le_mul_of_nonneg_right _ (by positivity) + apply mul_le_mul_of_nonneg_right _ (by positivity) + exact mul_le_mul_of_nonneg_left (hB _) hC.le + have hbudget : ∀ᵐ X ∂volume, v.1 X≠0 → (closeLabels r (w (site t)) X).card ≤ k+m := by + filter_upwards [hvk] with X hX + intro hne + exact (hX hne (site t)).trans (Nat.add_le_add_left + ((insertionCount_mono site (Nat.le_trans (Nat.le_succ t) ht) _).trans (hct _)) k) + obtain ⟨v',hv',hvn',hve',hvs⟩ := hins (n+t) L r hr (w (site t)) (hw _) (hn _) (k+m) hmass v hv hbudget + refine ⟨v',hv',hvn'.trans hvn,?_,?_⟩ + · have hbound : C*((w (site t)).orbitalEnergy+(w (site t)).orbitalBound*(k+m:ℕ)*r) ≤ + C*(E+B*(k+m)*r) := by + apply mul_le_mul_of_nonneg_left _ hC.le + apply add_le_add (hE _) + rw [Nat.cast_add] + exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (hB _) (by positivity)) hr.le + rw [hvn] at hve' + have he := hve'.trans (add_le_add le_rfl (mul_le_mul_of_nonneg_right hbound (sq_nonneg _))) + rw [Nat.cast_add,Nat.cast_one] + nlinarith + · filter_upwards [hvs,(configurationTail_quasiPreserving (n+t) L).ae hvk] with X hX hOld + intro hne z + obtain ⟨hOldne,hOrb⟩ := hX hne + have hh := closeLabels_insert_le r w hsep (site t) z X hOrb + have hh' := hOld hOldne z + rw [insertionCount_succ] + omega + obtain ⟨v,hv,hvn,hve,_⟩ := hrec T le_rfl + exact ⟨v,hv,hvn,hve⟩ + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Collisions/InsertionMassIntegrable.lean b/lean/OAI/Analysis/HardSphere/Collisions/InsertionMassIntegrable.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cbe89a47eda7e9dfec0fb3a85dc78e20a027e95 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Collisions/InsertionMassIntegrable.lean @@ -0,0 +1,171 @@ +import Mathlib +import OAI.Analysis.HardSphere.FormDomain.EnergyInsertionJet +import OAI.Analysis.HardSphere.PathBounds.FiberDerivativeMulTailLocal + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate + +lemma SmoothMultiplier.insertion_mass_integrable {n : ℕ} {L : Length} + (f : SmoothMultiplier (n+1) L) (u : ScalarL2 n L) : + Integrable (fun Y : Configuration n L ↦ ‖u Y‖^2 * f.fiberMass Y) volume := by + have hm := ((memLp_configurationTail (Lp.memLp u)).mul f.memLp_top).integrable_norm_pow + (by decide : (2:ℕ)≠0) + let e := MeasurableEquiv.piFinSuccAbove (fun _ : Fin (n+1) ↦ Torus L) 0 + have he := (volume_preserving_piFinSuccAbove (fun _ : Fin (n+1) ↦ Torus L) 0).symm + have hi := (he.integrable_comp_emb e.symm.measurableEmbedding).mpr hm + simp only [MeasurableEquiv.piFinSuccAbove_symm_apply,Fin.insertNthEquiv, + Equiv.coe_fn_mk,Fin.insertNth_zero',Function.comp_def,Pi.mul_apply,Fin.tail_cons] at hi + convert hi.integral_prod_right using 1 + funext Y + rw [SmoothMultiplier.fiberMass,← integral_const_mul] + apply integral_congr_ae + exact Eventually.of_forall fun x ↦ by dsimp only; rw [norm_mul,mul_pow,mul_comm] + +lemma SmoothMultiplier.norm_insertionScalar_le {n : ℕ} {L : Length} + (f : SmoothMultiplier (n+1) L) (hn : ∀ Y, f.fiberMass Y≤1) (u : ScalarL2 n L) : + ‖f.insertionScalar u‖^2≤‖u‖^2 := by + rw [SmoothMultiplier.insertionScalar,ContinuousLinearMap.comp_apply,SmoothMultiplier.onScalar, + norm_weightedTail_sq,IndicatorStrong.norm_sq_integral] + exact integral_mono (f.insertion_mass_integrable u) + ((Lp.memLp u).integrable_norm_pow (by decide : (2:ℕ)≠0)) + (fun Y ↦ mul_le_of_le_one_right (sq_nonneg _) (hn Y)) + +lemma SmoothMultiplier.norm_insertionScalar_local {n : ℕ} {L : Length} + (f : SmoothMultiplier (n+1) L) (u : ScalarL2 n L) + (hn : ∀ᵐ Y ∂volume, u Y≠0 → f.fiberMass Y=1) : + ‖f.insertionScalar u‖=‖u‖ := by + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [SmoothMultiplier.insertionScalar,ContinuousLinearMap.comp_apply,SmoothMultiplier.onScalar, + norm_weightedTail_sq,IndicatorStrong.norm_sq_integral] + apply integral_congr_ae + filter_upwards [hn] with Y hY + by_cases hz : u Y=0 + · simp only [hz,norm_zero,zero_pow (by decide : 2≠0),zero_mul] + · change ‖u Y‖^2*f.fiberMass Y=_ + rw [hY hz,mul_one] + +lemma SmoothMultiplier.insertion_cross_zero_local {n : ℕ} {L : Length} + (f : SmoothMultiplier (n+1) L) (p : Direction (n+1)) (u v : ScalarL2 n L) + (ho : ∀ᵐ Y ∂volume, v Y≠0 → ∫ x : Torus L, + conj (f.toFun (Fin.cons x Y))*coordDerivative (n+1) L f.toFun p (Fin.cons x Y)=0) : + inner ℂ (f.insertionScalar u) + (L2Multiplier.clm _ (f.partial_memLp_top p) (configurationTailCLM n L v))=0 := by + rw [SmoothMultiplier.insertionScalar,ContinuousLinearMap.comp_apply,SmoothMultiplier.onScalar, + weightedTail_pairing] + apply integral_eq_zero_of_ae + filter_upwards [ho] with Y hY + simp only [Pi.zero_apply] + by_cases hz : v Y=0 + · rw [hz,mul_zero,zero_mul] + · rw [hY hz,mul_zero] + +lemma SmoothMultiplier.energy_insertionJet_local_le_sum {n : ℕ} {L : Length} + (f : SmoothMultiplier (n+1) L) (u : Jet n L) + (hn : ∀ Y, f.fiberMass Y≤1) + (ho : ∀ (i : Fin n) (j : Fin 3), ∀ᵐ Y ∂volume, u.1 Y≠0 → ∫ x : Torus L, + conj (f.toFun (Fin.cons x Y))*coordDerivative (n+1) L f.toFun (i.succ,j) (Fin.cons x Y)=0) : + energy (f.insertionJet u)≤energy u + ∑ p : Direction (n+1), + ‖L2Multiplier.clm _ (f.partial_memLp_top p) (configurationTailCLM n L u.1)‖^2 := by + have hz (j : Fin 3) : (f.insertionJet u).2 (0,j)= + L2Multiplier.clm _ (f.partial_memLp_top (0,j)) (configurationTailCLM n L u.1) := by + change f.insertionScalar 0 + _ = _ + rw [map_zero,zero_add] + rfl + have hs (i : Fin n) (j : Fin 3) : ‖(f.insertionJet u).2 (i.succ,j)‖^2≤ + ‖u.2 (i,j)‖^2+ + ‖L2Multiplier.clm _ (f.partial_memLp_top (i.succ,j)) (configurationTailCLM n L u.1)‖^2 := by + change ‖f.insertionScalar (u.2 (i,j)) + + L2Multiplier.clm _ (f.partial_memLp_top (i.succ,j)) (configurationTailCLM n L u.1)‖^2 ≤ _ + rw [@norm_add_sq ℂ, f.insertion_cross_zero_local (i.succ,j) (u.2 (i,j)) u.1 (ho i j),map_zero, + mul_zero,add_zero] + exact add_le_add_left (f.norm_insertionScalar_le hn (u.2 (i,j))) + (‖L2Multiplier.clm _ (f.partial_memLp_top (i.succ,j)) (configurationTailCLM n L u.1)‖^2) + simp only [energy,Fintype.sum_prod_type] + rw [Fin.sum_univ_succ (f := fun i : Fin (n+1) ↦ ∑ j : Fin 3, ‖(f.insertionJet u).2 (i,j)‖^2), + Fin.sum_univ_succ (f := fun i : Fin (n+1) ↦ ∑ j : Fin 3, + ‖L2Multiplier.clm _ (f.partial_memLp_top (i,j)) (configurationTailCLM n L u.1)‖^2)] + simp only [hz] + calc + _ ≤ (∑ j : Fin 3, ‖L2Multiplier.clm _ (f.partial_memLp_top (0,j)) (configurationTailCLM n L u.1)‖^2)+ + ∑ i : Fin n, ∑ j : Fin 3, (‖u.2 (i,j)‖^2+ + ‖L2Multiplier.clm _ (f.partial_memLp_top (i.succ,j)) (configurationTailCLM n L u.1)‖^2) := by + exact add_le_add_right (Finset.sum_le_sum fun i _ ↦ Finset.sum_le_sum fun j _ ↦ hs i j) _ + _ = _ := by simp only [Finset.sum_add_distrib]; ring + +lemma SmoothMultiplier.energy_insertionJet_local_le {n : ℕ} {L : Length} + (f : SmoothMultiplier (n+1) L) (u : Jet n L) + (hn : ∀ Y, f.fiberMass Y≤1) + (ho : ∀ (i : Fin n) (j : Fin 3), ∀ᵐ Y ∂volume, u.1 Y≠0 → ∫ x : Torus L, + conj (f.toFun (Fin.cons x Y))*coordDerivative (n+1) L f.toFun (i.succ,j) (Fin.cons x Y)=0) + (C : ℝ) (hC : ∀ᵐ Y ∂volume, u.1 Y≠0 → + ∑ p : Direction (n+1), ∫ x : Torus L, ‖coordDerivative (n+1) L f.toFun p (Fin.cons x Y)‖^2≤C) : + energy (f.insertionJet u)≤energy u+C*‖u.1‖^2 := by + apply (f.energy_insertionJet_local_le_sum u hn ho).trans + apply add_le_add_right + simp_rw [norm_weightedTail_sq] + rw [← integral_finsetSum _ (fun p _ ↦ f.insertion_derivative_integrable u.1 p), + IndicatorStrong.norm_sq_integral,← integral_const_mul] + apply integral_mono_ae + · exact integrable_finsetSum _ (fun p _ ↦ f.insertion_derivative_integrable u.1 p) + · exact (Lp.memLp u.1).integrable_norm_pow (by decide : (2:ℕ)≠0) |>.const_mul C + · filter_upwards [hC] with Y hY + rw [← Finset.mul_sum] + by_cases hz : u.1 Y=0 + · simp only [hz,norm_zero,zero_pow (by decide : 2≠0),mul_zero,zero_mul,le_refl] + · simpa only [mul_comm C] using mul_le_mul_of_nonneg_left (hY hz) (sq_nonneg ‖u.1 Y‖) + +lemma SmoothMultiplier.insertion_from_raw_local {n : ℕ} {L : Length} {a C z : ℝ} + (f : SmoothMultiplier (n+1) L) (hc : InsertionClearance a f) + (hr : ∀ X, conj (f.toFun X)=f.toFun X) (hz : 1/2 exact ⟨u,hu,rfl,by simp⟩ + | succ m ih => + have hs' : ((n+m:ℕ):ℝ)*(2*Real.pi*r)^3≤L.val^3/2 := by + exact (mul_le_mul_of_nonneg_right + (show ((n+m:ℕ):ℝ)≤((n+(m+1):ℕ):ℝ) by exact_mod_cast Nat.le_succ (n+m)) + (by positivity)).trans hs + obtain ⟨v,hv,hn,he⟩ := ih hs' + obtain ⟨w,hw,hnw,hew⟩ := hins (n+m) L r hr hs' v hv + refine ⟨w,hw,hnw.trans hn,?_⟩ + rw [hn] at hew + rw [Finset.sum_range_succ] + nlinarith + +lemma ground_energy_removal : ∃ C : ℝ, 0 + simp only [Finset.sum_empty] + filter_upwards [Measure.rnDeriv_zero ξ] with x hx + simp [hx] + | @insert i s hi hs => + simp only [Finset.sum_insert hi] + filter_upwards [Measure.rnDeriv_add (P i) (∑j∈s,P j) ξ,hs, + Measure.rnDeriv_lt_top (P i) ξ,Measure.rnDeriv_lt_top (∑j∈s,P j) ξ] with x hx hy ha hb + rw [hx,Pi.add_apply,ENNReal.toReal_add ha.ne hb.ne,hy] + +lemma measureAffinity_finset_sum {ι : Type*} (s : Finset ι) (P Q : ι→Measure α) + [∀i,IsFiniteMeasure (P i)] [∀i,IsFiniteMeasure (Q i)] : + (∑i∈s,measureAffinity (P i) (Q i)) ≤ measureAffinity (∑i∈s,P i) (∑i∈s,Q i) := by + let ξ := (∑i∈s,P i)+(∑i∈s,Q i) + have hsP : (∑i∈s,P i)≪ξ := Measure.AbsolutelyContinuous.rfl.add_right _ + have hsQ : (∑i∈s,Q i)≪ξ := Measure.AbsolutelyContinuous.rfl.add_right' _ + have hp : ∀i∈s,P i≪ξ := fun i hi ↦ + (Measure.absolutelyContinuous_of_le (Finset.single_le_sum (fun _ _ ↦ bot_le) hi)).trans hsP + have hq : ∀i∈s,Q i≪ξ := fun i hi ↦ + (Measure.absolutelyContinuous_of_le (Finset.single_le_sum (fun _ _ ↦ bot_le) hi)).trans hsQ + calc + _ = ∑i∈s,affinity ξ (fun x ↦ ((P i).rnDeriv ξ x).toReal) + (fun x ↦ ((Q i).rnDeriv ξ x).toReal) := Finset.sum_congr rfl + (fun i hi ↦ measureAffinity_eq_dominated _ _ _ (hp i hi) (hq i hi)) + _ ≤ affinity ξ (fun x ↦ ∑i∈s,((P i).rnDeriv ξ x).toReal) + (fun x ↦ ∑i∈s,((Q i).rnDeriv ξ x).toReal) := + affinity_finset_sum s ξ _ _ (fun _ _ ↦ Measure.integrable_toReal_rnDeriv) + (fun _ _ ↦ Measure.integrable_toReal_rnDeriv) + (fun _ _ ↦ ENNReal.toReal_nonneg) (fun _ _ ↦ ENNReal.toReal_nonneg) + _ = _ := by + rw [measureAffinity_eq_dominated _ _ ξ hsP hsQ] + unfold affinity + apply integral_congr_ae + filter_upwards [rnDeriv_real_finset_sum s P ξ,rnDeriv_real_finset_sum s Q ξ] with x hx hy + rw [hx,hy] + +lemma measureAffinity_smul (P Q : Measure α) [IsFiniteMeasure P] [IsFiniteMeasure Q] + (c : ℝ) (hc : 0≤c) : + measureAffinity (ENNReal.ofReal c • P) (ENNReal.ofReal c • Q)=c*measureAffinity P Q := by + let := P.smul_finite (c:=ENNReal.ofReal c) ENNReal.ofReal_ne_top + let := Q.smul_finite (c:=ENNReal.ofReal c) ENNReal.ofReal_ne_top + have hp : P≪P+Q := Measure.AbsolutelyContinuous.rfl.add_right Q + have hq : Q≪P+Q := Measure.AbsolutelyContinuous.rfl.add_right' P + rw [measureAffinity_eq_dominated _ _ (P+Q) (hp.smul_left _) (hq.smul_left _)] + unfold measureAffinity affinity + rw [← integral_const_mul] + apply integral_congr_ae + filter_upwards [Measure.rnDeriv_smul_left_of_ne_top P (P+Q) ENNReal.ofReal_ne_top, + Measure.rnDeriv_smul_left_of_ne_top Q (P+Q) ENNReal.ofReal_ne_top] with x hx hy + rw [hx,hy,Pi.smul_apply,Pi.smul_apply,smul_eq_mul,smul_eq_mul, + ENNReal.toReal_mul,ENNReal.toReal_mul,ENNReal.toReal_ofReal hc, + Real.sqrt_mul hc,Real.sqrt_mul hc] + have hs := Real.sq_sqrt hc + calc + _ = (Real.sqrt c)^2*(Real.sqrt ((P.rnDeriv (P+Q) x).toReal)* + Real.sqrt ((Q.rnDeriv (P+Q) x).toReal)) := by ring + _ = _ := by rw [hs] + +lemma affinity_tag_normalization {ι : Type*} (s : Finset ι) + (P Q : Measure α) (Pg Qg : ι→Measure α) + [IsFiniteMeasure P] [IsFiniteMeasure Q] [∀i,IsFiniteMeasure (Pg i)] + [∀i,IsFiniteMeasure (Qg i)] (D : ℝ) (hD : 0 simp [conditionalTagLikelihood,hd,tagLikelihood] + change _ = ∑i,∫⁻z,conditionalTagLikelihood σ tag L E i z*F (i,z) ∂μ.compProd P + simp_rw [hright] + rw [←lintegral_finsetSum] + · apply lintegral_congr + intro d + exact tagLikelihood_lintegral (σ d) (P d) tag ht _ + (hL.comp ((measurable_const.prodMk measurable_fst).prodMk measurable_snd)) _ + (hF.comp (measurable_fst.prodMk (measurable_const.prodMk measurable_snd))) + · intro i _ + have hm : Measurable (fun z : D×X ↦ + tagLikelihood (σ z.1) tag (fun qx ↦ L ((z.1,qx.1),qx.2)) i z.2) := by + exact (((hL.comp ((measurable_fst.fst.prodMk measurable_snd).prodMk measurable_fst.snd)).ite + (measurableSet_eq_fun (ht.comp measurable_snd) measurable_const) measurable_const)).lintegral_kernel_prod_right' + (κ:=σ.comap Prod.fst measurable_fst) + exact (hm.mul (hF.comp measurable_prodMk_left)).lintegral_kernel_prod_right + +end HardSphere.Comparison +end +end + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Comparison +variable {D Q X I Y : Type*} [MeasurableSpace D] [MeasurableSpace Q] [MeasurableSpace X] + [Fintype I] [MeasurableSpace I] [MeasurableSingletonClass I] [MeasurableSpace Y] + +lemma tagged_density_of_ae_support (P : Measure X) (ν : Measure (I×X)) + (S : I→Set X) (hS : ∀i,MeasurableSet (S i)) (f : I→X→ℝ≥0∞) + (hd : ν=(Measure.count.prod P).withDensity (fun p ↦ f p.1 p.2)) + (hs : ∀ᵐp ∂ν,p.2∈S p.1) : + ν=(taggedReference P S).withDensity (fun p ↦ f p.1 p.2) := by + rw [taggedReference,←restrict_withDensity (taggedEvent_measurable S hS),←hd] + exact (Measure.restrict_eq_self_of_ae_mem hs).symm + +lemma conditionalTagged_support (μ : Measure D) [SFinite μ] + (σ : Kernel D Q) [IsSFiniteKernel σ] (χ : Kernel (D×Q) X) [IsSFiniteKernel χ] + (tag : Q→I) (ht : Measurable tag) (E : Set D) + (S : I→Set (D×X)) (hS : ∀i,MeasurableSet (S i)) + (hs : ∀ᵐd ∂μ.restrict E,∀ᵐq ∂σ d,∀ᵐw ∂χ (d,q),(d,w)∈S (tag q)) : + ∀ᵐp ∂(((μ.restrict E).compProd (σ⊗ₖχ)).map (fun z : D×(Q×X) ↦ (tag z.2.1,(z.1,z.2.2)))),p.2∈S p.1 := by + have hm : Measurable (fun z : D×(Q×X) ↦ (tag z.2.1,(z.1,z.2.2))) := + (ht.comp measurable_snd.fst).prodMk (measurable_fst.prodMk measurable_snd.snd) + rw [ae_map_iff hm.aemeasurable (taggedEvent_measurable S hS)] + apply Measure.ae_compProd_of_ae_ae ((taggedEvent_measurable S hS).preimage hm) + filter_upwards [hs] with d hd + exact Kernel.ae_compProd_of_ae_ae ((taggedEvent_measurable S hS).preimage + ((ht.comp measurable_fst).prodMk (measurable_const.prodMk measurable_snd))) hd + +theorem tagged_observed_of_density (P : Measure X) [IsFiniteMeasure P] + (ν : Measure (I×X)) (S : I→Set X) (hS : ∀i,MeasurableSet (S i)) + (f : I→X→ℝ≥0∞) (hf : ∀i,Measurable (f i)) + (hd : ν=(Measure.count.prod P).withDensity (fun p ↦ f p.1 p.2)) + (hs : ∀ᵐp ∂ν,p.2∈S p.1) (κ : Kernel (I×X) Y) [IsMarkovKernel κ] + (C : ℝ) (hC : 0≤C) (hb : (∫⁻x,(∑i,f i x)^2 ∂P)≤ENNReal.ofReal C) : + Integrable (fun y ↦ (((ν.compProd κ).map Prod.snd).rnDeriv + (((taggedReference P S).compProd κ).map Prod.snd) y).toReal^2) + (((taggedReference P S).compProd κ).map Prod.snd) ∧ + (∫y,(((ν.compProd κ).map Prod.snd).rnDeriv + (((taggedReference P S).compProd κ).map Prod.snd) y).toReal^2 + ∂((taggedReference P S).compProd κ).map Prod.snd)≤C := by + have he := tagged_density_of_ae_support P ν S hS f hd hs + rw [he] + let R := taggedReference P S + let F : I×X→ℝ≥0∞ := fun p ↦ f p.1 p.2 + have hF : Measurable F := taggedFunction_measurable f hf + let _ : IsFiniteMeasure R := by dsimp [R,taggedReference]; infer_instance + have hm := tagged_density_moment P S f hf C hC hb + have hsq : (∫⁻p,(F p)^2 ∂ R)≤ENNReal.ofReal C := (tagged_density_square P S f hf).trans hb + let _ : IsFiniteMeasure (R.withDensity F) := + finite_density_of_square R F hF (ne_of_lt (hsq.trans_lt ENNReal.ofReal_lt_top)) + have hae : (fun p ↦ ((R.withDensity F).rnDeriv R p).toReal^2)=ᵐ[R] + (fun p ↦ (F p).toReal^2) := + (Measure.rnDeriv_withDensity R hF).fun_comp (fun x : ℝ≥0∞ ↦ x.toReal^2) + have h := observed_kernel_second_moment R (R.withDensity F) + (withDensity_absolutelyContinuous _ _) κ (hm.1.congr hae.symm) + refine ⟨h.1,h.2.trans ?_⟩ + rw [integral_congr_ae hae] + exact hm.2 + +end HardSphere.Comparison +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/DensityForcesTwoParticles.lean b/lean/OAI/Analysis/HardSphere/Comparison/DensityForcesTwoParticles.lean new file mode 100644 index 0000000000000000000000000000000000000000..bed8938de2f9c609ce6562d5ac52f0582b3de3c4 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/DensityForcesTwoParticles.lean @@ -0,0 +1,69 @@ +import Mathlib +import OAI.Analysis.HardSphere.PathBounds.CloseTailBaseTendsto +import OAI.Analysis.HardSphere.Conditioning.PairCloseLabels + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter +open scoped Topology + +lemma density_forces_two_particles {n : ℕ} (L : Length) {D : ℝ} + (hL : 100≤L.val) (hDeq : D=(n:ℝ)/L.val^3) (hD : 1≤D) : 2≤n := by + have hLp : 0 simp [Function.updateFinset,hi] + change (∫⁻y,F (Function.updateFinset x s y)*conditionalDensity checks κ s o (Function.updateFinset x s y) z + ∂Measure.pi (fun i : s ↦ μ i))= _ + change _=∫⁻p,F (fun i ↦ (Function.updateFinset (fun i ↦ (x i,z i)) s p i).1)* + checkWeight checks (s∪o) (Function.updateFinset (fun i ↦ (x i,z i)) s p) + ∂Measure.pi (fun i : s ↦ (μ i).compProd (κ i)) + simp_rw [he] + rw [show (fun p ↦ F (Function.updateFinset x s (fun i ↦ (p i).1))* + checkWeight checks (s∪o) (Function.updateFinset (fun i ↦ (x i,z i)) s p))=f from rfl, + lintegral_pi_compProd (fun i : s ↦ κ i) (fun i : s ↦ μ i) hf] + apply lintegral_congr + intro y + change F (Function.updateFinset x s y)* + (∫⁻u,checkWeight checks (s∪o) + (fun i ↦ (Function.updateFinset x s y i,Function.updateFinset z s u i)) + ∂Measure.pi (fun i : s ↦ κ i (Function.updateFinset x s y i)))=_ + have hμ : (fun i : s ↦ κ i (Function.updateFinset x s y i))=(fun i : s ↦ κ i (y i)) := by + funext i + simp [Function.updateFinset,i.property] + rw [hμ,←lintegral_const_mul _ (by + exact (measurable_checkWeight checks (s∪o)).comp + (Measurable.of_eval (fun i ↦ measurable_const.prodMk + ((measurable_pi_apply i).comp measurable_updateFinset))))] + apply lintegral_congr + intro u + have hp : (fun i ↦ (Function.updateFinset x s y i,Function.updateFinset z s u i))= + Function.updateFinset (fun i ↦ (x i,z i)) s (fun i ↦ (y i,u i)) := by + funext i + by_cases hi : i∈s <;> simp [Function.updateFinset,hi] + simp only [f,hp] + +omit [Fintype E] [Fintype R] [∀i,IsProbabilityMeasure (μ i)] [∀i,IsFiniteKernel (κ i)] in +lemma conditionalLikelihood_update (s o : Finset I) (x : ∀i,X i) (z : ∀i,Z i) (y : ∀i : s,X i) : + conditionalLikelihood reference checks μ κ s o (Function.updateFinset x s y) z= + (partialNormalizer reference μ s o x / + partialNormalizer checks (fun i ↦ (μ i).compProd (κ i)) s o (fun i ↦ (x i,z i)))* + conditionalDensity checks κ s o (Function.updateFinset x s y) z := by + unfold conditionalLikelihood + rw [partialNormalizer_updateFinset] + congr 2 + apply lmarginal_congr + intro i hi + simp [Function.updateFinset,hi] + +def proposalFiber (s o : Finset I) (x : ∀i,X i) (z : ∀i,Z i) : Measure (∀i : s,X i×Z i) := + conditionedMeasure (Measure.pi (fun i : s ↦ (μ i).compProd (κ i))) + {p | Function.updateFinset (fun i ↦ (x i,z i)) s p∈retainedEvent checks (s∪o)} + +def referenceFiber (s o : Finset I) (x : ∀i,X i) : Measure (∀i : s,X i) := + conditionedMeasure (Measure.pi (fun i : s ↦ μ i)) + {p | Function.updateFinset x s p∈retainedEvent reference (s∪o)} + +lemma fiber_lintegral {V : I → Type*} [∀i,MeasurableSpace (V i)] + {C : Type*} [Fintype C] (c : C → LocalCheck V) (ν : ∀i,Measure (V i)) + (s o : Finset I) (v : ∀i,V i) (f : (∀i : s,V i) → ℝ≥0∞) : + (∫⁻p,f p ∂conditionedMeasure (Measure.pi (fun i : s ↦ ν i)) + {p | Function.updateFinset v s p∈retainedEvent c (s∪o)})= + (partialNormalizer c ν s o v)⁻¹ * + ∫⁻p,f p*checkWeight c (s∪o) (Function.updateFinset v s p) + ∂Measure.pi (fun i : s ↦ ν i) := by + let A : Set (∀i : s,V i) := {p | Function.updateFinset v s p∈retainedEvent c (s∪o)} + have hA : MeasurableSet A := (measurableSet_retainedEvent c (s∪o)).preimage measurable_updateFinset + have hmass : (Measure.pi (fun i : s ↦ ν i)) A=partialNormalizer c ν s o v := by + change _=∫⁻p,A.indicator (fun _ ↦ (1:ℝ≥0∞)) p ∂Measure.pi (fun i : s ↦ ν i) + rw [lintegral_indicator_const hA,one_mul] + change (∫⁻p,f p ∂conditionedMeasure _ A)=_ + rw [conditionedMeasure,lintegral_smul_measure,hmass] + change _⁻¹ *(∫⁻p in A,f p ∂Measure.pi (fun i : s ↦ ν i))=_ + rw [←lintegral_indicator hA] + congr 1 + apply lintegral_congr + intro p + by_cases hp : p∈A + · simp only [Set.indicator_of_mem hp] + change f p=f p*A.indicator (fun _ ↦ (1:ℝ≥0∞)) p + rw [Set.indicator_of_mem hp,mul_one] + · simp only [Set.indicator_of_notMem hp] + change 0=f p*A.indicator (fun _ ↦ (1:ℝ≥0∞)) p + rw [Set.indicator_of_notMem hp,mul_zero] + +lemma proposalFiber_primary (s o : Finset I) (x : ∀i,X i) (z : ∀i,Z i) + (hZ : 0 + exact contDiff_zero.mpr (show Differentiable ℝ (fun z : E ↦ ∫ x in K, F (z,x) ∂μ) from + fun y ↦ (hasFDerivAt_integral hF hK y).differentiableAt).continuous + | succ n ih => + rw [show ((n+1:ℕ):WithTop ℕ∞)=(n:WithTop ℕ∞)+1 by simp,contDiff_succ_iff_fderiv] + refine ⟨fun y ↦ (hasFDerivAt_integral hF hK y).differentiableAt,by simp,?_⟩ + have hd : fderiv ℝ (fun z : E ↦ ∫ x in K, F (z,x) ∂μ)= + fun z ↦ ∫ x in K, (fderiv ℝ F (z,x)).comp (ContinuousLinearMap.inl ℝ E A) ∂μ := by + funext z + exact (hasFDerivAt_integral hF hK z).fderiv + rw [hd] + exact ih ((hF.fderiv_right (by simp)).clm_comp contDiff_const) + +lemma contDiff_integral {F : E × A → B} + (hF : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) F) {K : Set A} (hK : IsCompact K) : + ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (fun z : E ↦ ∫ x in K, F (z,x) ∂μ) := + contDiff_infty.mpr fun n ↦ contDiff_integral_nat n hF hK + +end CompactParameterIntegral + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/FiberNormalize.lean b/lean/OAI/Analysis/HardSphere/Comparison/FiberNormalize.lean new file mode 100644 index 0000000000000000000000000000000000000000..452796dda255861134b3c88e95aea04d7cf138cd --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/FiberNormalize.lean @@ -0,0 +1,87 @@ +import Mathlib + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {W V : Type*} [MeasurableSpace W] [MeasurableSpace V] + +def fiberRestrict (κ : Kernel W V) [IsSFiniteKernel κ] (C : Set (W×V)) : Kernel W V := + κ.withDensity (fun w v ↦ C.indicator (fun _ ↦ (1 : ℝ≥0∞)) (w,v)) + +lemma fiberRestrict_apply (κ : Kernel W V) [IsSFiniteKernel κ] {C : Set (W×V)} + (hC : MeasurableSet C) (w : W) : + fiberRestrict κ C w=(κ w).restrict {v | (w,v)∈C} := by + have hm : Measurable (Function.uncurry (fun w : W ↦ fun v : V ↦ C.indicator (fun _ ↦ (1 : ℝ≥0∞)) (w,v))) := by + change Measurable (C.indicator (fun _ ↦ (1 : ℝ≥0∞))) + exact measurable_const.indicator hC + rw [fiberRestrict,Kernel.withDensity_apply _ hm] + have he : (fun v ↦ C.indicator (fun _ ↦ (1 : ℝ≥0∞)) (w,v))= + {v | (w,v)∈C}.indicator (fun _ ↦ (1 : ℝ≥0∞)) := rfl + rw [he] + have hs : MeasurableSet {v : V | (w,v)∈C} := hC.preimage (measurable_const.prodMk measurable_id) + exact withDensity_indicator_one hs + +def fiberNormalize (κ : Kernel W V) [IsSFiniteKernel κ] (C : Set (W×V)) : Kernel W V where + toFun w := (fiberRestrict κ C w univ)⁻¹ • fiberRestrict κ C w + measurable' := by + refine Measure.measurable_of_measurable_coe _ fun B hB ↦ ?_ + simp only [Measure.smul_apply,smul_eq_mul] + exact ((fiberRestrict κ C).measurable_coe MeasurableSet.univ).inv.mul + ((fiberRestrict κ C).measurable_coe hB) + +instance fiberNormalize_finite (κ : Kernel W V) [IsSFiniteKernel κ] (C : Set (W×V)) : + IsFiniteKernel (fiberNormalize κ C) := ⟨1,by simp,fun w ↦ by + change ((fiberRestrict κ C w univ)⁻¹ • fiberRestrict κ C w) univ≤1 + rw [Measure.smul_apply,smul_eq_mul] + exact ENNReal.inv_mul_le_one _⟩ + +lemma fiberNormalize_mass (κ : Kernel W V) [IsFiniteKernel κ] {C : Set (W×V)} + (hC : MeasurableSet C) {w : W} (hw : 0<κ w {v | (w,v)∈C}) : + fiberNormalize κ C w univ=1 := by + change ((fiberRestrict κ C w univ)⁻¹ • fiberRestrict κ C w) univ=1 + rw [fiberRestrict_apply κ hC,Measure.smul_apply,smul_eq_mul,Measure.restrict_apply_univ] + exact ENNReal.inv_mul_cancel hw.ne' (measure_ne_top _ _) + +lemma fiberNormalize_ac (κ : Kernel W V) [IsFiniteKernel κ] {C : Set (W×V)} + (hC : MeasurableSet C) (w : W) : fiberNormalize κ C w ≪ κ w := by + change (fiberRestrict κ C w univ)⁻¹ • fiberRestrict κ C w ≪ κ w + rw [fiberRestrict_apply κ hC] + exact Measure.smul_absolutelyContinuous.trans Measure.restrict_le_self.absolutelyContinuous + +lemma fiberNormalize_fst (μ : Measure W) [SFinite μ] (κ : Kernel W V) [IsFiniteKernel κ] + {C : Set (W×V)} (hC : MeasurableSet C) + (hpos : ∀ᵐ w ∂μ,0<κ w {v | (w,v)∈C}) : + (μ.compProd (fiberNormalize κ C)).map Prod.fst=μ := by + ext B hB + rw [Measure.map_apply measurable_fst hB,Measure.compProd_apply (hB.preimage measurable_fst)] + have he : (fun w ↦ fiberNormalize κ C w ((fun v ↦ (w,v))⁻¹' (Prod.fst⁻¹' B)))=ᵐ[μ] + B.indicator (fun _ ↦ (1 : ℝ≥0∞)) := by + filter_upwards [hpos] with w hw + by_cases hb : w∈B + · have hs : (fun v : V ↦ (w,v))⁻¹' (Prod.fst⁻¹' B)=univ := by ext v; simp [hb] + rw [hs,fiberNormalize_mass κ hC hw,Set.indicator_of_mem hb] + · have hs : (fun v : V ↦ (w,v))⁻¹' (Prod.fst⁻¹' B)=∅ := by ext v; simp [hb] + rw [hs,measure_empty,Set.indicator_of_notMem hb] + rw [lintegral_congr_ae he,lintegral_indicator_const hB,one_mul] + +lemma fiberNormalize_compProd_mass (μ : Measure W) [IsProbabilityMeasure μ] + (κ : Kernel W V) [IsFiniteKernel κ] {C : Set (W×V)} (hC : MeasurableSet C) + (hpos : ∀ᵐ w ∂μ,0<κ w {v | (w,v)∈C}) : + μ.compProd (fiberNormalize κ C) univ=1 := by + have h := congrArg (fun ν : Measure W ↦ ν univ) (fiberNormalize_fst μ κ hC hpos) + simpa only [Measure.map_apply measurable_fst MeasurableSet.univ,preimage_univ,measure_univ] using h + +end HardSphere.Comparison + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/FiniteFiberSum.lean b/lean/OAI/Analysis/HardSphere/Comparison/FiniteFiberSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9d31bfddd3a27d8ce061def6cccb0962b54c0cc --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/FiniteFiberSum.lean @@ -0,0 +1,71 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.CenteredCircleLift + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter + +lemma finite_fiber_sum_le {ι : Type*} [Fintype ι] [DecidableEq ι] + (f : ι→ι) (a : ι→ℝ) (C : ℕ) (ha : ∀ i, 0≤a i) + (hc : ∀ k, (Finset.univ.filter (fun i ↦ f i=k)).card≤C) : + (∑ i, a (f i))≤(C:ℝ)*∑ i, a i := by + rw [←Finset.sum_fiberwise Finset.univ f (fun i ↦ a (f i)),Finset.mul_sum] + apply Finset.sum_le_sum + intro k _ + calc + _ = ∑ i∈Finset.univ.filter (fun i ↦ f i=k), a k := by + apply Finset.sum_congr rfl + intro i hi + rw [(Finset.mem_filter.mp hi).2] + _ = ((Finset.univ.filter (fun i ↦ f i=k)).card:ℝ)*a k := by simp + _ ≤ _ := mul_le_mul_of_nonneg_right (by exact_mod_cast hc k) (ha k) + +theorem nearestParticleDistance_sum_sq {ι : Type*} [Fintype ι] [DecidableEq ι] [Nontrivial ι] + (L : Length) (X Y : ι→Torus L) (hX : Function.Injective X) (hY : Function.Injective Y) : + (∑ i, (nearestParticleDistance L Y i-nearestParticleDistance L X i)^2)≤ + 502*∑ i, torusDistance L (X i) (Y i)^2 := by + let δ : ι→ℝ := fun i ↦ torusDistance L (X i) (Y i) + have hδ (i : ι) : 0≤δ i := Real.sqrt_nonneg _ + have hpoint (i : ι) : (nearestParticleDistance L Y i-nearestParticleDistance L X i)^2≤ + 2*(δ i)^2+2*(δ (nearestLabel L X i))^2+2*(δ (nearestLabel L Y i))^2 := by + have hp := nearestParticleDistance_sub_le L X Y i + have hm := nearestParticleDistance_sub_le L Y X i + have hs (j : ι) : torusDistance L (Y j) (X j)=δ j := by simp only [δ,torusDistance,dist_comm] + change nearestParticleDistance L Y i-nearestParticleDistance L X i≤δ i+δ (nearestLabel L X i) at hp + simp only [hs] at hm + by_cases h : 0≤nearestParticleDistance L Y i-nearestParticleDistance L X i + · have hsq := (sq_le_sq₀ h (add_nonneg (hδ i) (hδ _))).mpr hp + nlinarith only [hsq,sq_nonneg (δ i-δ (nearestLabel L X i)),sq_nonneg (δ (nearestLabel L Y i))] + · have h' : 0≤nearestParticleDistance L X i-nearestParticleDistance L Y i := by linarith only [h] + have hsq := (sq_le_sq₀ h' (add_nonneg (hδ i) (hδ _))).mpr hm + nlinarith only [hsq,sq_nonneg (δ i-δ (nearestLabel L Y i)),sq_nonneg (δ (nearestLabel L X i))] + have hSX := finite_fiber_sum_le (nearestLabel L X) (fun i ↦ (δ i)^2) 125 + (fun _ ↦ sq_nonneg _) (nearestLabel_fiber_card L X hX) + have hSY := finite_fiber_sum_le (nearestLabel L Y) (fun i ↦ (δ i)^2) 125 + (fun _ ↦ sq_nonneg _) (nearestLabel_fiber_card L Y hY) + calc + _ ≤ ∑ i, (2*(δ i)^2+2*(δ (nearestLabel L X i))^2+2*(δ (nearestLabel L Y i))^2) := + Finset.sum_le_sum (fun i _ ↦ hpoint i) + _ = 2*(∑ i, (δ i)^2)+2*(∑ i, (δ (nearestLabel L X i))^2)+2*(∑ i, (δ (nearestLabel L Y i))^2) := by + simp only [Finset.sum_add_distrib,Finset.mul_sum] + _ ≤ 502*∑ i, (δ i)^2 := by norm_num at hSX hSY; linarith only [hSX,hSY] + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/FrozenLikelihood.lean b/lean/OAI/Analysis/HardSphere/Comparison/FrozenLikelihood.lean new file mode 100644 index 0000000000000000000000000000000000000000..22188693baea4fc4ba48d5a2bdac18ef90121525 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/FrozenLikelihood.lean @@ -0,0 +1,160 @@ +import Mathlib +import OAI.Analysis.HardSphere.Comparison.ConditionalLikelihood +import OAI.Analysis.HardSphere.Comparison.LocalMoment + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {I C : Type*} [Fintype I] [DecidableEq I] [Fintype C] + {X : I → Type*} [∀i,MeasurableSpace (X i)] + +omit [Fintype I] [∀i,MeasurableSpace (X i)] in +lemma freezeOutside_updateFinset (U s : Finset I) (hs : s⊆U) (x y : ∀i,X i) (v : ∀i:s,X i) : + freezeOutside U x (Function.updateFinset y s v)=Function.updateFinset (freezeOutside U x y) s v := by + funext i + by_cases hi : i∈s + · simp [freezeOutside,Function.updateFinset,hi,hs hi] + · simp [freezeOutside,Function.updateFinset,hi] + +omit [Fintype C] in +lemma frozen_partialNormalizer (checks : C → LocalCheck X) (μ : ∀i,Measure (X i)) + (U s o : Finset I) (hs : s⊆U) (x y : ∀i,X i) + (hx : x∈retainedEvent checks (Finset.univ\U)) : + partialNormalizer (frozenChecks checks U x) μ s o y= + partialNormalizer checks μ s (o∪(Finset.univ\U)) (freezeOutside U x y) := by + apply lintegral_congr + intro v + rw [frozen_checkWeight checks U (s∪o) x _ hx,freezeOutside_updateFinset U s hs] + simp only [Finset.union_assoc] + +omit [Fintype I] [∀i,MeasurableSpace (X i)] in +lemma freezeOutside_pair {Z : I → Type*} (U : Finset I) (x y : ∀i,X i) (z u : ∀i,Z i) : + freezeOutside U (fun i ↦ (x i,z i)) (fun i ↦ (y i,u i))= + fun i ↦ (freezeOutside U x y i,freezeOutside U z u i) := by + funext i + by_cases hi : i∈U <;> simp [freezeOutside,hi] + +omit [Fintype C] in +lemma frozen_conditionalDensity {Z : I → Type*} [∀i,MeasurableSpace (Z i)] + (checks : C → LocalCheck (fun i ↦ X i×Z i)) + (κ : ∀i,Kernel (X i) (Z i)) [∀i,IsFiniteKernel (κ i)] + (U s o : Finset I) (hs : s⊆U) (x y : ∀i,X i) (z u : ∀i,Z i) + (hx : (fun i ↦ (x i,z i))∈retainedEvent checks (Finset.univ\U)) : + conditionalDensity (frozenChecks checks U (fun i ↦ (x i,z i))) κ s o y u= + conditionalDensity checks κ s (o∪(Finset.univ\U)) (freezeOutside U x y) (freezeOutside U z u) := by + unfold conditionalDensity lmarginal + have hκ : (fun i:s ↦ κ i (freezeOutside U x y i))=(fun i:s ↦ κ i (y i)) := by + funext i;simp only [freezeOutside,ite_eq_left (hs i.property)] + rw [hκ] + apply lintegral_congr + intro v + dsimp only + rw [frozen_checkWeight checks U (s∪o) _ _ hx,freezeOutside_pair,freezeOutside_updateFinset U s hs] + simp only [Finset.union_assoc] + +omit [Fintype C] in +lemma frozen_conditionalLikelihood {Z : I → Type*} [∀i,MeasurableSpace (Z i)] + {R : Type*} [Fintype R] (reference : R → LocalCheck X) + (checks : C → LocalCheck (fun i ↦ X i×Z i)) + (μ : ∀i,Measure (X i)) (κ : ∀i,Kernel (X i) (Z i)) [∀i,IsFiniteKernel (κ i)] + (U s o : Finset I) (hs : s⊆U) (x y : ∀i,X i) (z u : ∀i,Z i) + (hx : x∈retainedEvent reference (Finset.univ\U)) + (hz : (fun i ↦ (x i,z i))∈retainedEvent checks (Finset.univ\U)) : + conditionalLikelihood (frozenChecks reference U x) (frozenChecks checks U (fun i ↦ (x i,z i))) μ κ s o y u= + conditionalLikelihood reference checks μ κ s (o∪(Finset.univ\U)) (freezeOutside U x y) (freezeOutside U z u) := by + unfold conditionalLikelihood + rw [frozen_partialNormalizer reference μ U s o hs x y hx, + frozen_partialNormalizer checks _ U s o hs _ _ hz, + freezeOutside_pair, + frozen_conditionalDensity checks κ U s o hs x y z u hz] + +end HardSphere.Comparison + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {I R C D : Type*} [Fintype I] [DecidableEq I] [Fintype R] [Fintype C] [Fintype D] + {X Z W : I→Type*} [∀i,MeasurableSpace (X i)] [∀i,MeasurableSpace (Z i)] + [∀i,MeasurableSpace (W i)] + +omit [Fintype I] [∀i,MeasurableSpace (X i)] in +lemma freezeOutside_self (U : Finset I) (x : ∀i,X i) : freezeOutside U x x=x := by + funext i + by_cases hi : i∈U <;> simp [freezeOutside,hi] + +lemma local_complement (s o U : Finset I) (hso : Disjoint s o) (hU : s∪o=U) : + o∪(Finset.univ\U)=Finset.univ\s := by + ext i + have hd := Finset.disjoint_left.mp hso + simp only [Finset.mem_union,Finset.mem_sdiff,Finset.mem_univ,true_and] + rw [←hU] + simp only [Finset.mem_union] + constructor + · rintro (ho|hnot) + · exact fun hs ↦ hd hs ho + · exact fun hs ↦ hnot (Or.inl hs) + · intro hs + by_cases ho : i∈o + · exact Or.inl ho + · exact Or.inr (not_or.mpr ⟨hs,ho⟩) + +theorem frozen_pair_mean_integrates + (reference : R→LocalCheck X) (checks : C→LocalCheck (fun i ↦ X i×Z i)) + (other : D→LocalCheck (fun i ↦ X i×W i)) + (μ : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (μ i)] + (κ : ∀i,Kernel (X i) (Z i)) [∀i,IsFiniteKernel (κ i)] + (η : ∀i,Kernel (X i) (W i)) [∀i,IsFiniteKernel (η i)] + (s t os ot U : Finset I) (hs : s⊆U) (ht : t⊆U) + (hso : Disjoint s os) (hto : Disjoint t ot) (hsU : s∪os=U) (htU : t∪ot=U) + (z : ∀i,Z i) (w : ∀i,W i) + (hS : ∀x,x∈retainedEvent reference (Finset.univ\U) → + (fun i ↦ (x i,z i))∈retainedEvent checks (Finset.univ\U)) + (hT : ∀x,x∈retainedEvent reference (Finset.univ\U) → + (fun i ↦ (x i,w i))∈retainedEvent other (Finset.univ\U)) + (A : ℝ≥0∞) (hA : A≠⊤) + (hlocal : ∀x,x∈retainedEvent reference (Finset.univ\U) → + let Ref := frozenChecks reference U x + let ChS := frozenChecks checks U (fun i ↦ (x i,z i)) + let ChT := frozenChecks other U (fun i ↦ (x i,w i)) + lmarginal μ U (fun y ↦ checkWeight Ref U y * + conditionalLikelihood Ref ChS μ κ s os y z * + conditionalLikelihood Ref ChT μ η t ot y w) x / + checkNormalizer Ref μ U x≤A) : + (∫⁻x,conditionalLikelihood reference checks μ κ s (Finset.univ\s) x z * + conditionalLikelihood reference other μ η t (Finset.univ\t) x w + ∂conditionedMeasure (Measure.pi μ) (retainedEvent reference Finset.univ))≤A := by + apply local_mean_integrates reference μ U _ + ((measurable_conditionalLikelihood reference checks μ κ _ _ z).mul + (measurable_conditionalLikelihood reference other μ η _ _ w)) A hA + intro x hx + rw [←frozen_local_mean reference μ U x hx] + have h := hlocal x hx + dsimp only at h + convert h using 2 + apply congrArg (fun f ↦ lmarginal μ U f x) + funext y + rw [frozen_conditionalLikelihood reference checks μ κ U s os hs x y z z hx (hS x hx), + frozen_conditionalLikelihood reference other μ η U t ot ht x y w w hx (hT x hx), + freezeOutside_self,freezeOutside_self,local_complement s os U hso hsU, + local_complement t ot U hto htU] + exact (mul_assoc _ _ _).symm + +end HardSphere.Comparison + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/IntegratedFiber.lean b/lean/OAI/Analysis/HardSphere/Comparison/IntegratedFiber.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ac0c3f992f7da4e3b2e782c7ea20023710c7459 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/IntegratedFiber.lean @@ -0,0 +1,51 @@ +import Mathlib + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {W A B : Type*} [MeasurableSpace W] [MeasurableSpace A] [MeasurableSpace B] + +lemma integrated_primary_density (ξ : Measure W) [SFinite ξ] + (κ : Kernel W A) (η : Kernel W B) [IsSFiniteKernel κ] [IsSFiniteKernel η] + (f : A→B) (hf : Measurable f) (L : W×B→ℝ≥0∞) (hL : Measurable L) + (h : ∀ᵐw ∂ξ,(κ w).map f=(η w).withDensity (fun b ↦ L (w,b))) : + (ξ.compProd κ).map (fun p ↦ (p.1,f p.2))=(ξ.compProd η).withDensity L := by + apply Measure.ext_of_lintegral + intro F hF + have hm : Measurable (fun p : W×A ↦ (p.1,f p.2)) := measurable_fst.prodMk (hf.comp measurable_snd) + rw [lintegral_map hF hm,Measure.lintegral_compProd (show Measurable (fun p : W×A ↦ F (p.1,f p.2)) from hF.comp hm), + lintegral_withDensity_eq_lintegral_mul _ hL hF, + Measure.lintegral_compProd (hL.mul hF)] + apply lintegral_congr_ae + filter_upwards [h] with w hw + rw [←lintegral_map (show Measurable (fun b : B ↦ F (w,b)) from hF.comp measurable_prodMk_left) hf,hw, + lintegral_withDensity_eq_lintegral_mul _ + (show Measurable (fun b : B ↦ L (w,b)) from hL.comp measurable_prodMk_left) + (show Measurable (fun b : B ↦ F (w,b)) from hF.comp measurable_prodMk_left)] + rfl + +lemma map_density_comp (μ : Measure A) (f : A→B) (hf : Measurable f) + (L : B→ℝ≥0∞) (hL : Measurable L) : + (μ.withDensity (L∘f)).map f=(μ.map f).withDensity L := by + apply Measure.ext_of_lintegral + intro F hF + rw [lintegral_map hF hf] + change (∫⁻a,(F∘f) a ∂μ.withDensity (L∘f))=_ + rw [lintegral_withDensity_eq_lintegral_mul _ (hL.comp hf) (hF.comp hf), + lintegral_withDensity_eq_lintegral_mul _ hL hF,lintegral_map (hL.mul hF) hf] + rfl + +end HardSphere.Comparison + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/KilledLaplace.lean b/lean/OAI/Analysis/HardSphere/Comparison/KilledLaplace.lean new file mode 100644 index 0000000000000000000000000000000000000000..4fd5991f1f2b2bc4281a8d66163f778fe518a39f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/KilledLaplace.lean @@ -0,0 +1,95 @@ +import Mathlib +import OAI.Analysis.HardSphere.Operators.FreeResolventDenseRange +import OAI.Analysis.HardSphere.Geometry.AvoidanceReflectionNorm +import OAI.Analysis.HardSphere.Comparison.LaplaceIntegrand + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace HardSphere +open MeasureTheory Set Filter +open scoped Topology + +lemma killedTransition_clamped_continuous (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) : + Continuous (fun t : ℝ ↦ killedTransition N L a (max 0 t) f) := + semigroup_clamped_continuous (killedTransition N L a) (killedTransition_add_nonneg N L a) + (fun t _ ↦ killedTransition_apply_contraction N L a t) (killedTransition_tendsto_zero N L a) f + +def killedLaplace (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) : ScalarL2 N L := + semigroupLaplace (killedTransition N L a) f + +lemma killedLaplace_norm_le (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) : + ‖killedLaplace N L a f‖≤‖f‖ := + semigroupLaplace_norm_le (killedTransition N L a) (killedTransition_clamped_continuous N L a) + (fun t _ ↦ killedTransition_apply_contraction N L a t) f + +lemma killedLaplace_difference_tendsto (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) : + Tendsto (fun h : ℝ ↦ (h⁻¹:ℂ) • (killedLaplace N L a f-killedTransition N L a h (killedLaplace N L a f))) + (𝓝[>] 0) (𝓝 (allowedProjection N L a f-killedLaplace N L a f)) := by + simpa only [killedLaplace,killedTransition_zero] using semigroupLaplace_difference_tendsto_complex + (killedTransition N L a) (killedTransition_add_nonneg N L a) + (killedTransition_clamped_continuous N L a) + (fun t _ ↦ killedTransition_apply_contraction N L a t) f + +lemma killedLaplace_norm_sub_le (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) + {h : ℝ} (hh : 0 ≤ h) (hh1 : h ≤ 1) : + ‖killedLaplace N L a f-killedTransition N L a h (killedLaplace N L a f)‖≤ + (2*Real.exp 1)*h*‖f‖ := + semigroupLaplace_norm_sub_le (killedTransition N L a) (killedTransition_add_nonneg N L a) + (killedTransition_clamped_continuous N L a) + (fun t _ ↦ killedTransition_apply_contraction N L a t) f hh hh1 + +lemma killedLaplace_support (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) : + ∀ᵐ X ∂(volume : Measure (Configuration N L)), X∉allowed N L a → killedLaplace N L a f X=0 := by + have he := semigroupLaplace_project (killedTransition N L a) (killedTransition_add_nonneg N L a) + (killedTransition_clamped_continuous N L a) + (fun t _ ↦ killedTransition_apply_contraction N L a t) f + simpa only [killedLaplace,he] using killedTransition_support N L a 0 (killedLaplace N L a f) + +lemma killedLaplace_free_energy_bound (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) + {h : ℝ} (hh : 0 < h) (hh1 : h ≤ 1) : + h⁻¹ * (‖killedLaplace N L a f‖^2-(inner ℂ (killedLaplace N L a f) + (freeTransition N L h (killedLaplace N L a f))).re)≤4*Real.exp 1*‖f‖^2 := by + let u := killedLaplace N L a f + have hb := free_deficit_le_twice_killed N L a h u + have hi : ‖u‖^2-(inner ℂ u (killedTransition N L a h u)).re≤ + ‖u‖*‖u-killedTransition N L a h u‖ := by + have hinner := re_inner_le_norm (𝕜 := ℂ) u (u-killedTransition N L a h u) + change (inner ℂ u (u-killedTransition N L a h u)).re≤_ at hinner + rw [inner_sub_right,Complex.sub_re] at hinner + have he : (inner ℂ u u).re=‖u‖^2 := (norm_sq_eq_re_inner (𝕜 := ℂ) u).symm + rw [he] at hinner + exact hinner + have hc := mul_le_mul (killedLaplace_norm_le N L a f) + (killedLaplace_norm_sub_le N L a f hh.le hh1) + (norm_nonneg _) (norm_nonneg _) + have hd : ‖u‖^2-(inner ℂ u (freeTransition N L h u)).re≤ + 4*Real.exp 1*h*‖f‖^2 := by + nlinarith [hb,hi,hc] + have hm := mul_le_mul_of_nonneg_left hd (inv_nonneg.mpr hh.le) + calc + _ ≤ h⁻¹*(4*Real.exp 1*h*‖f‖^2) := hm + _ = _ := by field_simp + +lemma killedLaplace_free_graph (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) : + ∃ v : hilbertDomain N L (-1), scalarEmbedding N L (-1) v=killedLaplace N L a f ∧ + ‖v‖^2≤‖killedLaplace N L a f‖^2+4*Real.exp 1*‖f‖^2 := by + apply free_graph_lift_of_heat_bound N L (-1) (by norm_num) + intro n + apply killedLaplace_free_energy_bound N L a f + · positivity + · apply (div_le_one (by positivity : (0:ℝ)<(n:ℝ)+1)).mpr + linarith [Nat.cast_nonneg (α := ℝ) n] + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/LabelMoment.lean b/lean/OAI/Analysis/HardSphere/Comparison/LabelMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..cae760bf08bea64105564c82124dd2e99936cd16 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/LabelMoment.lean @@ -0,0 +1,78 @@ +import Mathlib + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped BigOperators ENNReal +namespace HardSphere.Comparison +variable {A : Type*} [Fintype A] [Nonempty A] [DecidableEq A] + [MeasurableSpace A] [MeasurableSingletonClass A] +lemma uniform_match_integral (G : ℝ) (x : A) : + (∫y, (if x=y then G else 1) ∂(PMF.uniformOfFintype A).toMeasure)= + 1+(G-1)/(Fintype.card A:ℝ) := by + rw [PMF.integral_eq_sum] + simp only [PMF.uniformOfFintype_apply,ENNReal.toReal_inv,ENNReal.toReal_natCast,smul_eq_mul] + rw [←Finset.mul_sum] + have h : (∑y:A,if x=y then G else (1:ℝ))=G+((Fintype.card A:ℝ)-1) := by + have he (y : A) : (if x=y then G else (1:ℝ))=1+(if x=y then G-1 else 0) := by + by_cases hxy : x=y <;> simp [hxy] + simp_rw [he] + rw [Finset.sum_add_distrib,Finset.sum_ite_eq] + simp + ring + rw [h] + have hn : (Fintype.card A:ℝ)≠0 := by exact_mod_cast Fintype.card_ne_zero + field_simp + ring +lemma uniform_pair_match_integral (G : ℝ) : + (∫p:A×A, (if p.1=p.2 then G else 1) + ∂((PMF.uniformOfFintype A).toMeasure.prod (PMF.uniformOfFintype A).toMeasure))= + 1+(G-1)/(Fintype.card A:ℝ) := by + rw [integral_prod _ (by exact Integrable.of_finite)] + simp only [uniform_match_integral] + simp + +lemma prod_match_eq_pow {ι : Type*} [Fintype ι] [DecidableEq ι] + {A : ι→Type*} [∀i,DecidableEq (A i)] (G : ℝ) (p : ∀i,A i×A i) : + (∏i,if (p i).1=(p i).2 then G else 1)= + G^(Finset.univ.filter (fun i ↦ (p i).1=(p i).2)).card := by + classical + rw [Finset.prod_ite] + simp + +lemma label_match_moment {ι : Type*} [Fintype ι] + (A : ι→Type*) [∀i,Fintype (A i)] [∀i,Nonempty (A i)] [∀i,DecidableEq (A i)] + [∀i,MeasurableSpace (A i)] [∀i,MeasurableSingletonClass (A i)] (G M : ℝ) + (hG : 1≤G) (hM : 0] 0) (𝓝 (K 0 f-semigroupLaplace K f)) := by + have hiC : Continuous (laplaceIntegrand K f) := + (Real.continuous_exp.comp continuous_neg).smul (hc f) + have hd := intervalIntegral.integral_hasDerivAt_right + (f := laplaceIntegrand K f) (a := 0) (b := 0) + (by simp) (hiC.stronglyMeasurableAtFilter volume (𝓝 0)) hiC.continuousAt + have hder := (Real.hasDerivAt_exp 0).smul + ((hasDerivAt_const (0:ℝ) (semigroupLaplace K f)).sub hd) + have hval : laplaceIntegrand K f 0=K 0 f := by simp [laplaceIntegrand] + change HasDerivAt (fun h : ℝ ↦ Real.exp h • + (semigroupLaplace K f-∫ s in (0:ℝ)..h, laplaceIntegrand K f s)) + (Real.exp 0 • (0-laplaceIntegrand K f 0)+Real.exp 0 • + (semigroupLaplace K f-∫ s in (0:ℝ)..0, laplaceIntegrand K f s)) 0 at hder + simp only [Real.exp_zero,intervalIntegral.integral_same,sub_zero,hval,zero_sub,one_smul] at hder + have hlim := hder.neg.tendsto_slope_zero.mono_left + (nhdsWithin_mono 0 (show Ioi (0:ℝ) ⊆ {0}ᶜ from fun h hh ↦ ne_of_gt hh)) + have hl : -(-K 0 f+semigroupLaplace K f)=K 0 f-semigroupLaplace K f := by module + rw [hl] at hlim + apply hlim.congr' + filter_upwards [eventually_mem_nhdsWithin] with h hh + change h⁻¹ • (-(Real.exp (0+h) • + (semigroupLaplace K f-∫ s in (0:ℝ)..(0+h), laplaceIntegrand K f s)) - + -(Real.exp 0 • (semigroupLaplace K f-∫ s in (0:ℝ)..0, laplaceIntegrand K f s)))=_ + rw [zero_add,Real.exp_zero,intervalIntegral.integral_same,sub_zero,one_smul, + semigroupLaplace_shift K hadd hc hnorm f (le_of_lt hh)] + module + +lemma semigroupLaplace_norm_sub_le (K : ℝ → E→L[ℂ] E) + (hadd : ∀ s t, 0 ≤ s → 0 ≤ t → K (s+t)=(K s).comp (K t)) + (hc : ∀ f, Continuous (fun t : ℝ ↦ K (max 0 t) f)) + (hnorm : ∀ t, 0 ≤ t → ∀ f, ‖K t f‖≤‖f‖) (f : E) {h : ℝ} + (hh : 0 ≤ h) (hh1 : h ≤ 1) : + ‖semigroupLaplace K f-K h (semigroupLaplace K f)‖≤ + (2*Real.exp 1)*h*‖f‖ := by + have hexp : Real.exp h-1≤Real.exp 1*h := by + have hm := mul_le_mul_of_nonneg_left (Real.add_one_le_exp (-h)) (Real.exp_nonneg h) + rw [← Real.exp_add,add_neg_cancel,Real.exp_zero] at hm + have hm2 := mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr hh1) hh + nlinarith + have he1 : 1≤Real.exp h := by simpa using Real.exp_le_exp.mpr hh + have hi : ‖∫ s in (0:ℝ)..h, laplaceIntegrand K f s‖≤h*‖f‖ := by + have hb : ∀ s ∈ Set.uIoc (0:ℝ) h, ‖laplaceIntegrand K f s‖≤‖f‖ := by + intro s hs + rw [Set.uIoc_of_le hh] at hs + dsimp only [laplaceIntegrand] + rw [max_eq_right (le_of_lt hs.1),norm_smul,Real.norm_eq_abs, + abs_of_pos (Real.exp_pos _)] + calc + _ ≤ Real.exp (-s)*‖f‖ := mul_le_mul_of_nonneg_left + (hnorm s (le_of_lt hs.1) f) (Real.exp_nonneg _) + _ ≤ 1*‖f‖ := mul_le_mul_of_nonneg_right (by + simpa using Real.exp_le_exp.mpr (neg_nonpos.mpr (le_of_lt hs.1))) (norm_nonneg _) + _ = ‖f‖ := one_mul _ + simpa only [sub_zero,abs_of_nonneg hh,mul_comm] using + intervalIntegral.norm_integral_le_of_norm_le_const hb + rw [semigroupLaplace_shift K hadd hc hnorm f hh] + have heq : semigroupLaplace K f-Real.exp h • + (semigroupLaplace K f-∫ s in (0:ℝ)..h, laplaceIntegrand K f s)= + (1-Real.exp h) • semigroupLaplace K f+ + Real.exp h • ∫ s in (0:ℝ)..h, laplaceIntegrand K f s := by module + rw [heq] + calc + _ ≤ ‖(1-Real.exp h) • semigroupLaplace K f‖+ + ‖Real.exp h • ∫ s in (0:ℝ)..h, laplaceIntegrand K f s‖ := norm_add_le _ _ + _ = (Real.exp h-1)*‖semigroupLaplace K f‖+ + Real.exp h*‖∫ s in (0:ℝ)..h, laplaceIntegrand K f s‖ := by + rw [norm_smul,norm_smul,Real.norm_eq_abs,Real.norm_eq_abs, + abs_of_nonpos (by linarith),abs_of_pos (Real.exp_pos _)] + ring + _ ≤ (Real.exp 1*h)*‖f‖+Real.exp 1*(h*‖f‖) := by + apply add_le_add + · exact mul_le_mul hexp (semigroupLaplace_norm_le K hc hnorm f) + (norm_nonneg _) (by positivity) + · exact mul_le_mul (Real.exp_le_exp.mpr hh1) hi (norm_nonneg _) (Real.exp_nonneg _) + _ = _ := by ring + +omit [CompleteSpace E] in +lemma laplaceIntegrand_eq_complex (K : ℝ → E→L[ℂ] E) (f : E) (t : ℝ) : + laplaceIntegrand K f t = (Real.exp (-t) : ℂ) • K (max 0 t) f := by + exact RCLike.real_smul_eq_coe_smul (K := ℂ) _ _ + +lemma semigroupLaplace_difference_tendsto_complex (K : ℝ → E→L[ℂ] E) + (hadd : ∀ s t, 0 ≤ s → 0 ≤ t → K (s+t)=(K s).comp (K t)) + (hc : ∀ f, Continuous (fun t : ℝ ↦ K (max 0 t) f)) + (hnorm : ∀ t, 0 ≤ t → ∀ f, ‖K t f‖≤‖f‖) (f : E) : + Tendsto (fun h : ℝ ↦ (h⁻¹ : ℂ) • (semigroupLaplace K f-K h (semigroupLaplace K f))) + (𝓝[>] 0) (𝓝 (K 0 f-semigroupLaplace K f)) := by + have hh := semigroupLaplace_difference_tendsto K hadd hc hnorm f + apply hh.congr + intro h + rw [← IsScalarTower.algebraMap_smul ℂ h⁻¹ + (semigroupLaplace K f-K h (semigroupLaplace K f))] + change ((h⁻¹:ℝ):ℂ) • (semigroupLaplace K f-K h (semigroupLaplace K f)) = _ + rw [Complex.ofReal_inv] + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/LocalMoment.lean b/lean/OAI/Analysis/HardSphere/Comparison/LocalMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..5be59f67e966e5fc7854935e87c5d0e55ff31c3c --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/LocalMoment.lean @@ -0,0 +1,103 @@ +import Mathlib +import OAI.Analysis.HardSphere.Conditioning.ProductNormalize +import OAI.Analysis.HardSphere.Geometry.FrozenChecks + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {I C : Type*} [Fintype I] [DecidableEq I] [Fintype C] + {X : I→Type*} [∀i,MeasurableSpace (X i)] + +omit [Fintype I] [∀i,MeasurableSpace (X i)] in +lemma freezeOutside_update_self (U : Finset I) (x : ∀i,X i) (u : ∀i:U,X i) : + freezeOutside U x (Function.updateFinset x U u)=Function.updateFinset x U u := by + funext i + by_cases hi : i∈U <;> simp [freezeOutside,Function.updateFinset,hi] + +omit [Fintype C] in +lemma frozen_local_mean (checks : C→LocalCheck X) (μ : ∀i,Measure (X i)) + (U : Finset I) (x : ∀i,X i) (hx : x∈retainedEvent checks (Finset.univ\U)) + (F : (∀i,X i)→ℝ≥0∞) : + lmarginal μ U (fun y ↦ checkWeight (frozenChecks checks U x) U y*F (freezeOutside U x y)) x / + checkNormalizer (frozenChecks checks U x) μ U x= + lmarginal μ U (fun y ↦ checkWeight checks Finset.univ y*F y) x / + lmarginal μ U (checkWeight checks Finset.univ) x := by + have hU : U∪(Finset.univ\U)=Finset.univ := Finset.union_sdiff_of_subset (Finset.subset_univ _) + unfold checkNormalizer lmarginal + congr 1 <;> apply lintegral_congr <;> intro u <;> (try dsimp only) <;> + rw [frozen_checkWeight checks U U _ _ hx,hU,freezeOutside_update_self] + +lemma local_mean_integrates (checks : C→LocalCheck X) (μ : ∀i,Measure (X i)) + [∀i,IsProbabilityMeasure (μ i)] (U : Finset I) (F : (∀i,X i)→ℝ≥0∞) + (hF : Measurable F) (A : ℝ≥0∞) (hA : A≠⊤) + (hlocal : ∀x,x∈retainedEvent checks (Finset.univ\U) → + lmarginal μ U (fun y ↦ checkWeight checks Finset.univ y*F y) x / + lmarginal μ U (checkWeight checks Finset.univ) x≤A) : + (∫⁻x,F x ∂conditionedMeasure (Measure.pi μ) (retainedEvent checks Finset.univ))≤A := by + let w := checkWeight checks Finset.univ + have hw : Measurable w := measurable_checkWeight checks _ + have hraw : (∫⁻x,w x*F x ∂Measure.pi μ)≤A*∫⁻x,w x ∂Measure.pi μ := by + rw [←lintegral_const_mul _ hw] + apply lintegral_le_of_lmarginal_le U (f:=fun y ↦ w y*F y) (g:=fun y ↦ A*w y) (hw.mul hF) (measurable_const.mul hw) + intro x + have hden : lmarginal μ U w x≠⊤ := by + have hd : lmarginal μ U w x≤1 := by + calc + _≤lmarginal μ U (fun _ ↦ 1) x := lmarginal_mono (checkWeight_le_one checks _) x + _=1 := by simp [lmarginal] + exact ne_top_of_le_ne_top ENNReal.one_ne_top hd + by_cases hx : x∈retainedEvent checks (Finset.univ\U) + · have h := (ENNReal.div_le_iff_le_mul (Or.inr hA) (Or.inl hden)).mp (hlocal x hx) + change _≤∫⁻u,A*w (Function.updateFinset x U u) ∂Measure.pi (fun i:U ↦ μ i) + rw [lintegral_const_mul _ (show Measurable (fun u : ∀i:U,X i ↦ w (Function.updateFinset x U u)) from hw.comp measurable_updateFinset)] + exact h + · have hz : lmarginal μ U (fun y ↦ w y*F y) x=0 := by + unfold lmarginal + apply lintegral_eq_zero_of_ae_eq_zero + apply ae_of_all + intro u + dsimp only + have hout : checkWeight checks (Finset.univ\U) (Function.updateFinset x U u)=0 := by + rw [checkWeight_depends checks (Finset.univ\U) (x:=Function.updateFinset x U u) (y:=x) + (fun i hi ↦ by simp [Function.updateFinset,(Finset.mem_sdiff.mp hi).2])] + exact Set.indicator_of_notMem hx _ + have hfull : w (Function.updateFinset x U u)=0 := le_antisymm + ((checkWeight_antitone checks (Finset.subset_univ (Finset.univ\U)) _).trans_eq hout) bot_le + simp only [hfull,zero_mul,Pi.zero_apply] + rw [hz] + exact bot_le + let Z := (Measure.pi μ) (retainedEvent checks Finset.univ) + have hZ : (∫⁻x,w x ∂Measure.pi μ)=Z := by + exact (lintegral_indicator_const (measurableSet_retainedEvent checks _) (1:ℝ≥0∞)).trans (one_mul _) + have hint : (∫⁻x,F x ∂conditionedMeasure (Measure.pi μ) (retainedEvent checks Finset.univ))= + Z⁻¹*∫⁻x,w x*F x ∂Measure.pi μ := by + rw [conditionedMeasure,lintegral_smul_measure,←lintegral_indicator (measurableSet_retainedEvent checks _)] + congr 1 + apply lintegral_congr + intro x + by_cases hx : x∈retainedEvent checks Finset.univ <;> simp [w,checkWeight,hx] + rw [hint] + calc + _≤Z⁻¹*(A*Z) := mul_le_mul' (le_refl _) (hraw.trans_eq (congrArg (A*·) hZ)) + _≤A := by + by_cases hz : Z=0 + · simp [hz] + · have ht : Z≠⊤ := measure_ne_top _ _ + calc + _=A*(Z⁻¹*Z) := by ac_rfl + _≤A := by rw [ENNReal.inv_mul_cancel hz ht,mul_one] + +end HardSphere.Comparison + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/MixtureMoment.lean b/lean/OAI/Analysis/HardSphere/Comparison/MixtureMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..55126788fd03791c3fbeb77b2ed376a04f352a5f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/MixtureMoment.lean @@ -0,0 +1,199 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.PairSubtype + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {Q X : Type*} [MeasurableSpace Q] [MeasurableSpace X] + +lemma mixed_likelihood_square (σ : Measure Q) (P : Measure X) [SFinite σ] [SFinite P] + (L : Q×X→ℝ≥0∞) (hL : Measurable L) : + (∫⁻x,(∫⁻q,L (q,x) ∂σ)^2 ∂P)= + ∫⁻q,∫⁻q',∫⁻x,L (q,x)*L (q',x) ∂P ∂σ ∂σ := by + have hslice (x : X) : Measurable (fun q ↦ L (q,x)) := hL.comp measurable_prodMk_right + have hs (x : X) : (∫⁻q,L (q,x) ∂σ)^2= + ∫⁻q,∫⁻q',L (q,x)*L (q',x) ∂σ ∂σ := by + simp_rw [lintegral_const_mul _ (hslice x)] + rw [lintegral_mul_const _ (hslice x),pow_two] + simp_rw [hs] + rw [lintegral_lintegral_swap] + · apply lintegral_congr + intro q + exact lintegral_lintegral_swap + (show Measurable (Function.uncurry (fun x q' ↦ L (q,x)*L (q',x))) from + ((hL.comp measurable_prodMk_left).comp measurable_fst).mul + (hL.comp (measurable_snd.prodMk measurable_fst))).aemeasurable + · apply Measurable.aemeasurable + change Measurable (fun p : X×Q ↦ ∫⁻q',L (p.2,p.1)*L (q',p.1) ∂σ) + exact (show Measurable (fun p : (X×Q)×Q ↦ L (p.1.2,p.1.1)*L (p.2,p.1.1)) from + (hL.comp (measurable_fst.snd.prodMk measurable_fst.fst)).mul + (hL.comp (measurable_snd.prodMk measurable_fst.fst))).lintegral_prod_right' + +lemma tag_likelihood_square {I : Type*} [Fintype I] (P : Measure X) + (f : I→X→ℝ≥0∞) (hf : ∀i,Measurable (f i)) : + (∑i,∫⁻x,(f i x)^2 ∂P)≤∫⁻x,(∑i,f i x)^2 ∂P := by + rw [←lintegral_finsetSum _ (fun i _ ↦ (hf i).pow_const 2)] + apply lintegral_mono + intro x + dsimp only + rw [pow_two,Finset.sum_mul] + apply Finset.sum_le_sum + intro i _ + rw [pow_two] + exact mul_le_mul' (le_refl _) ((show f i x ≤ ∑j,f j x from Finset.single_le_sum (f:=fun j ↦ f j x) (fun j _ ↦ bot_le) (Finset.mem_univ i))) + +end HardSphere.Comparison + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] + +lemma observed_second_moment (P ν : Measure X) [IsFiniteMeasure P] [IsFiniteMeasure ν] + (hac : ν≪P) (f : X→Y) (hf : Measurable f) + (hi : Integrable (fun x ↦ (ν.rnDeriv P x).toReal^2) P) : + Integrable (fun y ↦ ((ν.map f).rnDeriv (P.map f) y).toReal^2) (P.map f) ∧ + (∫y,((ν.map f).rnDeriv (P.map f) y).toReal^2 ∂P.map f)≤ + ∫x,(ν.rnDeriv P x).toReal^2 ∂P := by + let g : X→ℝ := fun x ↦ (ν.rnDeriv P x).toReal + let h : Y→ℝ := fun y ↦ ((ν.map f).rnDeriv (P.map f) y).toReal + have hg : Measurable g := (Measure.measurable_rnDeriv _ _).ennreal_toReal + have hh : Measurable h := (Measure.measurable_rnDeriv _ _).ennreal_toReal + have he : h∘f=ᵐ[P] P[g|MeasurableSpace.comap f inferInstance] := toReal_rnDeriv_map hac hf + have hl2 : MemLp g 2 P := (memLp_two_iff_integrable_sq hg.aestronglyMeasurable).mpr hi + have hc : MemLp (P[g|MeasurableSpace.comap f inferInstance]) 2 P := hl2.condExp (by norm_num) + have hci : Integrable (fun x ↦ (P[g|MeasurableSpace.comap f inferInstance] x)^2) P := + (memLp_two_iff_integrable_sq hc.aestronglyMeasurable).mp hc + have hcomp : Integrable (fun x ↦ h (f x)^2) P := hci.congr (he.symm.fun_comp (fun x : ℝ ↦ x^2)) + constructor + · exact (integrable_map_measure (hh.pow_const 2).aestronglyMeasurable hf.aemeasurable).mpr hcomp + · change (∫y,h y^2 ∂P.map f)≤_ + rw [integral_map hf.aemeasurable (hh.pow_const 2).aestronglyMeasurable] + calc + _ = ∫x,(P[g|MeasurableSpace.comap f inferInstance] x)^2 ∂P := + integral_congr_ae (he.fun_comp (fun x : ℝ ↦ x^2)) + _ ≤ ∫x,g x^2 ∂P := by + have hni : Integrable (fun x ↦ ‖g x‖^(2:ℝ)) P := by + simpa only [Real.rpow_two,Real.norm_eq_abs,sq_abs] using hi + have hineq := integral_norm_condExp_rpow_le (m:=MeasurableSpace.comap f inferInstance) + (by norm_num : (1:ℝ)≤2) hni + simpa only [Real.rpow_two,Real.norm_eq_abs,sq_abs] using hineq + +lemma observed_kernel_second_moment (P ν : Measure X) [IsFiniteMeasure P] [IsFiniteMeasure ν] + (hac : ν≪P) (κ : Kernel X Y) [IsMarkovKernel κ] + (hi : Integrable (fun x ↦ (ν.rnDeriv P x).toReal^2) P) : + Integrable (fun y ↦ (((ν.compProd κ).map Prod.snd).rnDeriv + ((P.compProd κ).map Prod.snd) y).toReal^2) ((P.compProd κ).map Prod.snd) ∧ + (∫y,(((ν.compProd κ).map Prod.snd).rnDeriv + ((P.compProd κ).map Prod.snd) y).toReal^2 ∂(P.compProd κ).map Prod.snd)≤ + ∫x,(ν.rnDeriv P x).toReal^2 ∂P := by + have hf : (P.compProd κ).map Prod.fst=P := Measure.fst_compProd P κ + have hm : Measurable (fun x ↦ (ν.rnDeriv P x).toReal^2) := + (Measure.measurable_rnDeriv _ _).ennreal_toReal.pow_const _ + have hi' : Integrable (fun p : X×Y ↦ (ν.rnDeriv P p.1).toReal^2) (P.compProd κ) := by + apply (integrable_map_measure hm.aestronglyMeasurable measurable_fst.aemeasurable).mp + rwa [hf] + have he : (fun p : X×Y ↦ ((ν.compProd κ).rnDeriv (P.compProd κ) p).toReal^2)=ᵐ[P.compProd κ] + (fun p ↦ (ν.rnDeriv P p.1).toReal^2) := + (rnDeriv_measure_compProd_left ν P κ).fun_comp (fun t : ℝ≥0∞ ↦ t.toReal^2) + have h := observed_second_moment (P.compProd κ) (ν.compProd κ) (hac.compProd_left κ) + Prod.snd measurable_snd (hi'.congr he.symm) + refine ⟨h.1,h.2.trans_eq ?_⟩ + rw [integral_congr_ae he,←integral_map measurable_fst.aemeasurable hm.aestronglyMeasurable,hf] + +end HardSphere.Comparison + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {U X Y : Type*} [MeasurableSpace U] [MeasurableSpace X] [MeasurableSpace Y] + +lemma pairedFactor_swap (μ : Measure U) [SFinite μ] + (κ : Kernel U X) (η : Kernel U Y) [IsFiniteKernel κ] [IsFiniteKernel η] + (S : Set X) (T : Set Y) (hS : MeasurableSet S) (hT : MeasurableSet T) : + (pairedFactor μ κ η S T hS hT).map (Prod.map id Prod.swap)= + pairedFactor μ η κ T S hT hS := by + unfold pairedFactor + rw [←Measure.compProd_map measurable_swap] + congr 1 + ext u B hB + rw [Kernel.map_apply _ measurable_swap u,Kernel.prod_apply,Kernel.prod_apply] + exact congrArg (fun m : Measure (Y×X) ↦ m B) Measure.prod_swap + +lemma supportedPair_swap (ρ : Measure (X×Y)) {S : Set X} {T : Set Y} + (hS : MeasurableSet S) (hT : MeasurableSet T) (hρ : ∀ᵐp ∂ρ,p.1∈S ∧ p.2∈T) : + (supportedPair ρ S T).map Prod.swap=supportedPair (ρ.map Prod.swap) T S := by + apply ((MeasurableEmbedding.subtype_coe hT).prodMap (MeasurableEmbedding.subtype_coe hS)).map_injective + have hr : ∀ᵐp ∂ρ.map Prod.swap,p.1∈T ∧ p.2∈S := by + apply (ae_map_iff measurable_swap.aemeasurable (by measurability)).mpr + exact hρ.mono (fun _ hp ↦ hp.symm) + rw [supportedPair_map _ hT hS hr,Measure.map_map (by fun_prop) measurable_swap] + have he := congrArg (fun μ : Measure (X×Y) ↦ μ.map Prod.swap) (supportedPair_map ρ hS hT hρ) + rw [Measure.map_map measurable_swap (by fun_prop)] at he + exact he +end HardSphere.Comparison +namespace HardSphere.Bridge +open Wiener GaussianPacking Comparison + +instance targetUniform_finite (A : Set Point) : IsFiniteMeasure (targetUniform A) := by + constructor + change ((volume A)⁻¹ • volume.restrict A) univ<⊤ + rw [Measure.smul_apply,Measure.restrict_apply_univ,smul_eq_mul] + exact (ENNReal.inv_mul_le_one _).trans_lt (by simp) + +lemma pairedPathsRaw_eq (t : ℝ) (y z y' z' : Point) (A : Set Point) + (S T : Set C(Time,Point)) (hS : MeasurableSet S) (hT : MeasurableSet T) : + pairedPathsRaw t y z y' z' A S T hS hT= + (pairedFactor (targetUniform A) (trialKernel t y z) (trialKernel t y' z') S T hS hT).map Prod.snd := by + unfold pairedPathsRaw pairedTrialLaw + rw [Measure.map_map (by fun_prop) (by fun_prop)] + rfl + +lemma pairedPathsRaw_support (t : ℝ) (y z y' z' : Point) (A : Set Point) + (S T : Set C(Time,Point)) (hS : MeasurableSet S) (hT : MeasurableSet T) : + ∀ᵐp ∂pairedPathsRaw t y z y' z' A S T hS hT,p.1∈S ∧ p.2∈T := by + rw [pairedPathsRaw_eq] + apply (ae_map_iff measurable_snd.aemeasurable (by measurability)).mpr + exact pairedFactor_support _ _ _ _ _ _ _ + +lemma pairedPathsRaw_swap (t : ℝ) (y z y' z' : Point) (A : Set Point) + (S T : Set C(Time,Point)) (hS : MeasurableSet S) (hT : MeasurableSet T) : + (pairedPathsRaw t y z y' z' A S T hS hT).map Prod.swap= + pairedPathsRaw t y' z' y z A T S hT hS := by + rw [pairedPathsRaw_eq,pairedPathsRaw_eq] + rw [←pairedFactor_swap (targetUniform A) (trialKernel t y z) (trialKernel t y' z') S T hS hT, + Measure.map_map measurable_snd (by fun_prop),Measure.map_map measurable_swap measurable_snd] + rfl + +lemma pairedPathsOn_swap (t : ℝ) (y z y' z' : Point) (A : Set Point) + (S T : Set C(Time,Point)) (hS : MeasurableSet S) (hT : MeasurableSet T) : + (pairedPathsOn t y z y' z' A S T hS hT).map Prod.swap= + pairedPathsOn t y' z' y z A T S hT hS := by + unfold pairedPathsOn + rw [supportedPair_swap _ hS hT (pairedPathsRaw_support t y z y' z' A S T hS hT), + pairedPathsRaw_swap] + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/ParameterTarget.lean b/lean/OAI/Analysis/HardSphere/Comparison/ParameterTarget.lean new file mode 100644 index 0000000000000000000000000000000000000000..0cb18d784c8c2bfd6a7ff646ab7ea4e30d50e27d --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/ParameterTarget.lean @@ -0,0 +1,120 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.LocalReference + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +open HardSphere.Bridge HardSphere.Wiener HardSphere.GaussianPacking +variable {E : Type*} [MeasurableSpace E] + +def parameterTargetKernel {B : Set Point} (hB : volume B ≠ ⊤) + (A : Set (E×Point)) (hA : MeasurableSet A) : Kernel E Point := by + letI : IsFiniteMeasure (volume.restrict B) := ⟨by simpa using hB.lt_top⟩ + exact parameterSuccessKernel (Kernel.const E (volume.restrict B)) A hA + +lemma parameterTargetKernel_apply {B : Set Point} (hB : volume B ≠ ⊤) + (A : Set (E×Point)) (hA : MeasurableSet A) + (hAB : ∀e,Prod.mk e ⁻¹' A ⊆ B) (e : E) : + parameterTargetKernel hB A hA e=targetUniform (Prod.mk e ⁻¹' A) := by + let : IsFiniteMeasure (volume.restrict B) := ⟨by simpa using hB.lt_top⟩ + have hs := hA.preimage (@measurable_prodMk_left E Point _ _ e) + change ((volume.restrict B) (Prod.mk e ⁻¹' A))⁻¹ • + (volume.restrict B).restrict (Prod.mk e ⁻¹' A)=_ + rw [Measure.restrict_apply hs,inter_eq_left.mpr (hAB e), + Measure.restrict_restrict hs,inter_eq_left.mpr (hAB e)] + rfl + +instance parameterTargetKernel_finite {B : Set Point} (hB : volume B ≠ ⊤) + (A : Set (E×Point)) (hA : MeasurableSet A) : + IsFiniteKernel (parameterTargetKernel hB A hA) := by + let : IsFiniteMeasure (volume.restrict B) := ⟨by simpa using hB.lt_top⟩ + exact inferInstanceAs (IsFiniteKernel (parameterSuccessKernel (Kernel.const E (volume.restrict B)) A hA)) + +lemma parameterTargetKernel_markov {B : Set Point} (hB : volume B ≠ ⊤) + (A : Set (E×Point)) (hA : MeasurableSet A) + (hAB : ∀e,Prod.mk e ⁻¹' A ⊆ B) + (hpos : ∀e,0 < volume (Prod.mk e ⁻¹' A)) : + IsMarkovKernel (parameterTargetKernel hB A hA) := by + constructor + intro e + rw [parameterTargetKernel_apply hB A hA hAB e] + exact targetUniform_probability (hpos e).ne' + (ne_top_of_le_ne_top hB (measure_mono (hAB e))) + +end HardSphere.Comparison + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology +namespace HardSphere.Comparison +variable {E U X Y : Type*} [MeasurableSpace E] [MeasurableSpace U] + [MeasurableSpace X] [MeasurableSpace Y] + +lemma probability_inter_98 (μ : Measure U) [IsProbabilityMeasure μ] + {s t : Set U} (_hs : MeasurableSet s) (ht : MeasurableSet t) + (hsm : ENNReal.ofReal (99/100:ℝ)≤μ s) (htm : ENNReal.ofReal (99/100:ℝ)≤μ t) : + ENNReal.ofReal (49/50:ℝ)≤μ (s∩t) := by + have he := congrArg ENNReal.toReal (measure_union_add_inter (μ:=μ) s ht) + rw [ENNReal.toReal_add (measure_ne_top _ _) (measure_ne_top _ _), + ENNReal.toReal_add (measure_ne_top _ _) (measure_ne_top _ _)] at he + have hu : (μ (s∪t)).toReal≤1 := by + exact_mod_cast ENNReal.toReal_mono ENNReal.one_ne_top (prob_le_one : μ (s∪t)≤1) + have hsr := ENNReal.toReal_mono (measure_ne_top _ _) hsm + have htr := ENNReal.toReal_mono (measure_ne_top _ _) htm + apply (ENNReal.toReal_le_toReal ENNReal.ofReal_ne_top (measure_ne_top _ _)).mp + norm_num at hsr htr ⊢ + linarith + +def accessibleTarget (κ : Kernel (E×U) X) (S : Set ((E×U)×X)) (c : ℝ≥0∞) : Set (E×U) := + {p | c≤κ p (Prod.mk p ⁻¹' S)} +lemma accessibleTarget_measurable (κ : Kernel (E×U) X) [IsFiniteKernel κ] + (S : Set ((E×U)×X)) (hS : MeasurableSet S) (c : ℝ≥0∞) : + MeasurableSet (accessibleTarget κ S c) := + measurableSet_le measurable_const (Kernel.measurable_kernel_prodMk_left hS) + +def commonAccessible (κ : Kernel (E×U) X) (η : Kernel (E×U) Y) + (S : Set ((E×U)×X)) (T : Set ((E×U)×Y)) (c d : ℝ≥0∞) (B : Set U) : Set (E×U) := + (univ×ˢB)∩(accessibleTarget κ S c∩accessibleTarget η T d) +lemma commonAccessible_measurable (κ : Kernel (E×U) X) (η : Kernel (E×U) Y) + [IsFiniteKernel κ] [IsFiniteKernel η] + (S : Set ((E×U)×X)) (T : Set ((E×U)×Y)) (hS : MeasurableSet S) (hT : MeasurableSet T) + (c d : ℝ≥0∞) (B : Set U) (hB : MeasurableSet B) : + MeasurableSet (commonAccessible κ η S T c d B) := + (MeasurableSet.univ.prod hB).inter + ((accessibleTarget_measurable κ S hS c).inter (accessibleTarget_measurable η T hT d)) + +lemma commonAccessible_volume (μ : Measure U) (κ : Kernel (E×U) X) (η : Kernel (E×U) Y) + [IsFiniteKernel κ] [IsFiniteKernel η] + (S : Set ((E×U)×X)) (T : Set ((E×U)×Y)) (hS : MeasurableSet S) (hT : MeasurableSet T) + (c d : ℝ≥0∞) (B : Set U) (_hB : MeasurableSet B) (hm : μ B=1) (e : E) + (hκ : ENNReal.ofReal (99/100:ℝ)≤(μ.restrict B) (Prod.mk e ⁻¹' accessibleTarget κ S c)) + (hη : ENNReal.ofReal (99/100:ℝ)≤(μ.restrict B) (Prod.mk e ⁻¹' accessibleTarget η T d)) : + ENNReal.ofReal (49/50:ℝ)≤μ (Prod.mk e ⁻¹' commonAccessible κ η S T c d B) := by + let _ : IsProbabilityMeasure (μ.restrict B) := ⟨by simp [hm]⟩ + have hs := (accessibleTarget_measurable κ S hS c).preimage (@measurable_prodMk_left E U _ _ e) + have ht := (accessibleTarget_measurable η T hT d).preimage (@measurable_prodMk_left E U _ _ e) + have hh := probability_inter_98 (μ.restrict B) hs ht hκ hη + rw [Measure.restrict_apply (hs.inter ht)] at hh + convert hh using 1 + congr 1 + ext u + simp [commonAccessible,and_comm] + +end HardSphere.Comparison + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/PartialLabelMoment.lean b/lean/OAI/Analysis/HardSphere/Comparison/PartialLabelMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..65b2d58b93438ee2f53a07da87ea2d399fe4f07f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/PartialLabelMoment.lean @@ -0,0 +1,76 @@ +import Mathlib +import OAI.Analysis.HardSphere.Comparison.LabelMoment + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped BigOperators ENNReal +namespace HardSphere.Comparison +lemma partial_match_eq_pow {ι : Type*} [Fintype ι] [DecidableEq ι] + {A : ι→Type*} [∀i,DecidableEq (A i)] (S : Finset ι) (G : ℝ) (p : ∀i,A i×A i) : + (∏i,if i∈S then (if (p i).1=(p i).2 then G else 1) else 1)= + G^(S.filter (fun i ↦ (p i).1=(p i).2)).card := by + have he (i : ι) : (if i∈S then (if (p i).1=(p i).2 then G else 1) else 1)= + if i∈S ∧ (p i).1=(p i).2 then G else 1 := by + by_cases hi : i∈S <;> simp [hi] + simp_rw [he] + rw [Finset.prod_ite] + have hs : (Finset.univ.filter (fun i:ι ↦ i∈S ∧ (p i).1=(p i).2))= + S.filter (fun i ↦ (p i).1=(p i).2) := by ext i; simp + simp only [Finset.prod_const, one_pow, mul_one, hs] + +lemma partial_label_match_moment {ι : Type*} [Fintype ι] [DecidableEq ι] + (A : ι→Type*) [∀i,Fintype (A i)] [∀i,Nonempty (A i)] [∀i,DecidableEq (A i)] + [∀i,MeasurableSpace (A i)] [∀i,MeasurableSingletonClass (A i)] + (S : Finset ι) (G M : ℝ) (hG : 1≤G) (hM : 0 rfl + | cons i l ih => + rw [Measure.tprod_cons, Measure.tprod_cons] + exact (h i).prod ih + +lemma pi_ac {ι : Type*} [Fintype ι] {X : ι → Type*} [∀ i, MeasurableSpace (X i)] + (μ ν : ∀i,Measure (X i)) [∀i,SigmaFinite (μ i)] [∀i,SigmaFinite (ν i)] + (h : ∀i,μ i ≪ ν i) : Measure.pi μ ≪ Measure.pi ν := by + classical + let : Encodable ι := Fintype.toEncodable ι + rw [←Measure.pi'_eq_pi μ,←Measure.pi'_eq_pi ν,Measure.pi',Measure.pi'] + simpa only [MeasurableEquiv.piMeasurableEquivTProd_symm_apply] using + (MeasurableEquiv.piMeasurableEquivTProd (Encodable.sortedUniv_nodup ι) (Encodable.mem_sortedUniv)).symm.measurableEmbedding.absolutelyContinuous_map + (tprod_ac μ ν h (Encodable.sortedUniv ι)) + +lemma ac_map {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] {μ ν : Measure X} + {f : X→Y} (hf : Measurable f) (h : μ ≪ ν) : μ.map f ≪ ν.map f := by + refine Measure.AbsolutelyContinuous.mk fun S hS hnull ↦ ?_ + rw [Measure.map_apply hf hS] at hnull ⊢ + exact h hnull + +end HardSphere.Measure + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Comparison/RawAngleLiftSumSquares.lean b/lean/OAI/Analysis/HardSphere/Comparison/RawAngleLiftSumSquares.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d18ce227a6d0a8bc9893e648ac9c471bcbf8449 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Comparison/RawAngleLiftSumSquares.lean @@ -0,0 +1,90 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.RawAngleLift + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open PeriodicCutoff + +lemma rawAngleLift_sum_squares (n : ℕ) (L : Length) (r : ℝ) (i : Fin n) + (R : LiftedConfiguration (n+1)) : + (∑ p : Direction (n+1), (fderiv ℝ (rawAngleLift n L r i) R + (Pi.single p.1 (Pi.single p.2 1)))^2)= + 2*∑ j : Fin 3, anglePartial L.val r (R 0-R i.succ) j^2 := by + simp only [rawAngleLift_fderiv_coord] + rw [Fintype.sum_prod_type,Fin.sum_univ_succ] + simp only [Fin.succ_ne_zero,Ne.symm (Fin.succ_ne_zero i),ite_true,ite_false,sub_zero,one_mul, + Fin.succ_inj,zero_sub,neg_mul,neg_sq] + have he : (∑ k : Fin n, ∑ j : Fin 3, + ((if k=i then (1:ℝ) else 0)*anglePartial L.val r (R 0-R i.succ) j)^2)= + ∑ j : Fin 3, anglePartial L.val r (R 0-R i.succ) j^2 := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + simp + rw [he] + ring + +lemma pairQ_representative (n : ℕ) (L : Length) (i : Fin n) (X : Configuration (n+1) L) : + pairQ L.val (X 0) (X i.succ)=qLift L.val + (representative (n+1) L X 0-representative (n+1) L X i.succ) := by + calc + _ = pairQ L.val (project (n+1) L (representative (n+1) L X) 0) + (project (n+1) L (representative (n+1) L X) i.succ) := by rw [project_representative] + _ = _ := pairQ_coe L.val _ _ + +lemma rawAngleLift_gradient_le (n : ℕ) (L : Length) {r M : ℝ} (hr : 0 omega + | succ n => + unfold insertFirst + have h := (cons_preserving (n:=n) L).comp + (Measure.measurePreserving_swap (μ:=(volume : Measure (Torus L))) (ν:=volume)) + convert h using 1 <;> simp [Function.comp_def] + + have bathFirst_preserving {N : ℕ} (hN : 0 omega + | succ n => + unfold insertFirst + have h := (cons_preserving (n:=n) L).comp + (Measure.measurePreserving_swap (μ:=(volume : Measure (Torus L))) (ν:=volume)) + convert h using 1 <;> simp [Function.comp_def] + + have bathFirst_preserving {N : ℕ} (hN : 0 omega + | succ n => + convert (MeasurableEquiv.piFinSuccAbove (fun _ : Fin (n+1) ↦ Torus L) 0).symm.measurableEmbedding.comp + (MeasurableEquiv.prodComm (α:=Configuration n L) (β:=Torus L)).measurableEmbedding using 1 <;> try rfl + funext p i + simp [insertFirst,MeasurableEquiv.piFinSuccAbove,MeasurableEquiv.prodComm]) + (fun X ↦ ‖ψ X‖^2) + rw [hm,Measure.real,volume_torus,ENNReal.toReal_ofReal (by positivity : 0≤L.val^3)] at hbound + unfold occupation + change (L.val^3)⁻¹*(∫Y,‖∫x,f (Y,x)‖^2)≤‖ψ‖^2 + calc + _ ≤ (L.val^3)⁻¹*(L.val^3*‖ψ‖^2) := mul_le_mul_of_nonneg_left hbound (by positivity) + _ = _ := by rw [←mul_assoc,inv_mul_cancel₀ (pow_ne_zero _ L.property.ne'),one_mul] + + have map_ae {N : ℕ} (hN : 0 + induction j using Fin.cases with + | zero => exact (hij rfl).elim + | succ j => + simpa using (lt_of_not_ge (fun h ↦ hx ⟨j,h⟩)) + | succ i => + induction j using Fin.cases with + | zero => + simpa [torusDistance_comm] using (lt_of_not_ge (fun h ↦ hx ⟨i,h⟩)) + | succ j => exact hY i j (fun h ↦ hij (congrArg Fin.succ h)) + +lemma IsGroundVector.phaseRepresentative_eq_of_joined {n : ℕ} {L : Length} {r : ℝ} + {u : Jet n L} (hu : IsGroundVector n L r u) {x y : Configuration n L} + (h : JoinedIn (allowed n L r) x y) : + groundPhaseRepresentative u x=groundPhaseRepresentative u y := by + obtain ⟨p,hp⟩ := h + apply hu.phaseRepresentative_eq_on_connected (S:=Set.range p) + (isPreconnected_range p.continuous) (by rintro z ⟨t,rfl⟩; exact hp t) + · exact ⟨0,p.source⟩ + · exact ⟨1,p.target⟩ + +lemma IsGroundVector.retained_phaseRepresentative {n : ℕ} {L : Length} {h r : ℝ} + {u : Jet (n+1) L} (hu : IsGroundVector (n+1) L r u) (hh : 0 simp only [Fin.cons_zero,Fin.cons_succ] <;> fun_prop + apply hu.phaseRepresentative_eq_of_joined + exact (hj.map hc.continuousOn).mono (by rintro _ ⟨z,hz,rfl⟩; exact allowed_cons hY hz) + +lemma commonPhase_of_ae_phase {α : Type*} [MeasurableSpace α] (μ : Measure α) {f : α → ℂ} + {U : Set α} {c : ℂ} (h : ∀ᵐ x ∂μ.restrict U, complexPhase (f x)=c) : + Phase.HasCommonPhase f U μ := by + by_cases hc : ‖c‖=1 + · refine ⟨c,hc,?_⟩ + filter_upwards [h] with x hx + rw [←hx,complexPhase_mul_norm] + · refine ⟨1,norm_one,?_⟩ + filter_upwards [h] with x hx + have hz : f x=0 := by + by_contra hn + exact hc (hx ▸ norm_complexPhase hn) + simp [hz] + +lemma IsGroundVector.ae_retained_commonPhase {n : ℕ} {L : Length} {h r : ℝ} + {u : Jet (n+1) L} (hu : IsGroundVector (n+1) L r u) (hh : 0 by_cases hj : p j + · simpa only [dite_eq_left hi,dite_eq_left hj] using hpair ⟨i,hi⟩ ⟨j,hj⟩ (fun h ↦ hij (congrArg Subtype.val h)) + · simpa only [dite_eq_left hi,dite_eq_right hj] using ((hown ⟨i,hi⟩ (mem_univ _)).2 ⟨j,hj⟩).1 + · simpa only [dite_eq_right hi,dite_eq_left hj] using ((hown ⟨j,hj⟩ (mem_univ _)).2 ⟨i,hi⟩).2 + · simpa only [dite_eq_right hi,dite_eq_right hj] using hout ⟨i,hi⟩ ⟨j,hj⟩ (fun h ↦ hij (congrArg Subtype.val h)) + · intro i + by_cases hi : p i + · simpa only [dite_eq_left hi] using (hown ⟨i,hi⟩ (mem_univ _)).1 + · simpa only [dite_eq_right hi] using hflag ⟨i,hi⟩ + +lemma pairEvent_measurable (C : ∀i j,X i→X j→Prop) + (hC : ∀i j,MeasurableSet {z : X i×X j | C i j z.1 z.2}) : + MeasurableSet (pairEvent C) := by + simp only [pairEvent,ofPred_forall] + exact MeasurableSet.iInter fun i ↦ MeasurableSet.iInter fun j ↦ + MeasurableSet.iInter fun (_ : i≠j) ↦ (hC i j).preimage ((measurable_pi_apply i).prodMk (measurable_pi_apply j)) + +lemma individualFiber_measurable (p : I→Prop) (C : ∀i j,X i→X j→Prop) + (hC : ∀i j,MeasurableSet {z : X i×X j | C i j z.1 z.2}) + (flag : ∀i,X i→Bool) (hflag : ∀i,Measurable (flag i)) (b : I→Bool) + (w : ∀i : {i // ¬p i},X i) (i : {i // p i}) : + MeasurableSet (individualFiber p C flag b w i) := by + have he : individualFiber p C flag b w i={v | flag i v=b i} ∩ + ⋂j : {j // ¬p j}, {v | C i j v (w j)} ∩ {v | C j i (w j) v} := by + ext v + simp [individualFiber] + rw [he] + apply (measurableSet_eq_fun (hflag i) measurable_const).inter + apply MeasurableSet.iInter + intro j + exact ((hC i j).preimage (measurable_id.prodMk measurable_const)).inter + ((hC j i).preimage (measurable_const.prodMk measurable_id)) + +lemma positive_product_factors (ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (ν i)] + (S : ∀i,Set (X i)) (B : Set (∀i,X i)) + (h : (Measure.pi ν) (B∩univ.pi S)≠0) : ∀i,ν i (S i)≠0 := by + have hpi : (Measure.pi ν) (univ.pi S)≠0 := ne_of_gt ((pos_iff_ne_zero.mpr h).trans_le (measure_mono inter_subset_right)) + rw [Measure.pi_pi] at hpi + exact fun i ↦ (Finset.prod_ne_zero_iff.mp hpi) i (Finset.mem_univ i) + +lemma conditional_pair_fiber (p : I→Prop) (C : ∀i j,X i→X j→Prop) + (hC : ∀i j,MeasurableSet {z : X i×X j | C i j z.1 z.2}) + (flag : ∀i,X i→Bool) (hflag : ∀i,Measurable (flag i)) (b : I→Bool) + (w : ∀i : {i // ¬p i},X i) + (ν : ∀i : {i // p i},Measure (X i)) [∀i,IsProbabilityMeasure (ν i)] + (hpos : (Measure.pi ν) {v | (fun i ↦ if h : p i then v ⟨i,h⟩ else w ⟨i,h⟩)∈pairEvent C ∧ + (∀i,flag i (if h : p i then v ⟨i,h⟩ else w ⟨i,h⟩)=b i)}≠0) : + frozenCompatible p C w ∧ + (∀i,ν i (individualFiber p C flag b w i)≠0) ∧ + conditionedMeasure (Measure.pi ν) + {v | (fun i ↦ if h : p i then v ⟨i,h⟩ else w ⟨i,h⟩)∈pairEvent C ∧ + (∀i,flag i (if h : p i then v ⟨i,h⟩ else w ⟨i,h⟩)=b i)}= + conditionedMeasure + (Measure.pi fun i ↦ conditionedMeasure (ν i) (individualFiber p C flag b w i)) + (pairEvent (fun i j : {i // p i} ↦ C i j)) := by + have he : {v | (fun i ↦ if h : p i then v ⟨i,h⟩ else w ⟨i,h⟩)∈pairEvent C ∧ + (∀i,flag i (if h : p i then v ⟨i,h⟩ else w ⟨i,h⟩)=b i)}= + pairEvent (fun i j : {i // p i} ↦ C i j) ∩ univ.pi (individualFiber p C flag b w) := by + obtain ⟨v,hv⟩ := nonempty_of_measure_ne_zero hpos + obtain ⟨hout,hf,_⟩ := (shifted_fiber p C flag b w v).mp hv + ext u + exact (shifted_fiber p C flag b w u).trans (by simp only [hout,hf,implies_true,true_and]) + rw [he] at hpos ⊢ + obtain ⟨v,hv⟩ := nonempty_of_measure_ne_zero hpos + have hout : frozenCompatible p C w := by + have hv' : v∈{v | (fun i ↦ if h : p i then v ⟨i,h⟩ else w ⟨i,h⟩)∈pairEvent C ∧ + (∀i,flag i (if h : p i then v ⟨i,h⟩ else w ⟨i,h⟩)=b i)} := by rw [he]; exact hv + exact ((shifted_fiber p C flag b w v).mp hv').1 + have hnormal := positive_product_factors ν (individualFiber p C flag b w) _ hpos + exact ⟨hout,hnormal,condition_product_factorization ν _ + (individualFiber_measurable p C hC flag hflag b w) hnormal _ + (pairEvent_measurable _ (fun i j ↦ hC i j)) hpos⟩ + +end HardSphere.Comparison + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology +namespace HardSphere +open Wiener Bridge GaussianPacking Comparison +attribute [local irreducible] torusDistance leg + +def noisePairAvoid {N : ℕ} {L : Length} (a t : ℝ) (e : BridgeEndpoints N L) + (i j : Fin N) (β γ : Bridge.Noise) : Prop := + ¬TrialCollision a + (projectCurve L (leg t (labelStartLift e j) (labelEndLift t e j) γ)) + (leg t (labelStartLift e i) (labelEndLift t e i) β) + +lemma noisePairAvoid_measurable {N : ℕ} {L : Length} (a t : ℝ) + (e : BridgeEndpoints N L) (i j : Fin N) : + MeasurableSet {z : Bridge.Noise×Bridge.Noise | noisePairAvoid a t e i j z.1 z.2} := by + exact ((jointCollision_closed (L:=L) a).measurableSet.preimage + (((leg_continuous t _ _).comp continuous_fst).prodMk + ((leg_continuous t _ _).comp continuous_snd)).measurable).compl + +lemma labelInteraction_pair {N : ℕ} {L : Length} (a t : ℝ) + (e : BridgeEndpoints N L) (β : Fin N→Bridge.Noise) : + (e,β)∈labelInteraction N L a t ↔ β∈pairEvent (noisePairAvoid a t e) := by + have hcoord (i : Fin N) (s : Time) : + labelBridgePath N L t (e,β) s i = + projectPoint L (leg t (labelStartLift e i) (labelEndLift t e i) (β i) s) := by + exact congrArg (fun f : C(Time,Configuration 1 L) ↦ f s 0) (labelBridgePath_lift t e β i) + change (∀X,X∈Set.range (labelBridgePath N L t (e,β))→X∈allowed N L a) ↔ _ + simp only [Set.forall_mem_range,allowed_iff_ne,pairEvent,mem_ofPred_eq, + noisePairAvoid,TrialCollision,not_exists,not_le] + constructor + · intro h i j hij s + change a ownedPairCheck avoid hm real id (fun _ ↦ Prod.fst) (fun _ ↦ measurable_fst) i j + | (true,i,j) => ownedPairCheck avoid hm real σ (fun k p ↦ if k∈S then p.2 else p.1) + (fun k ↦ by split_ifs <;> fun_prop) i j + +omit [Fintype I] in +lemma paired_check_primary (S : Finset I) (σ : Equiv.Perm I) (U : Finset I) (x z : I→P) : + checkWeight (pairedRouteChecks avoid hm real S σ) U (fun i ↦ (x i,z i)) ≤ + checkWeight (fun p : I×I ↦ primaryPairCheck avoid hm real p.1 p.2) U x := by + by_cases h : x∈retainedEvent (fun p : I×I ↦ primaryPairCheck avoid hm real p.1 p.2) U + · have he : checkWeight (fun p : I×I ↦ primaryPairCheck avoid hm real p.1 p.2) U x = 1 := by simp [checkWeight,h] + rw [he] + exact checkWeight_le_one _ _ _ + · have hn : (fun i ↦ (x i,z i))∉retainedEvent (pairedRouteChecks avoid hm real S σ) U := by + intro hp + apply h + intro c hc + exact hp (false,c.1,c.2) hc + simp only [checkWeight,Set.indicator_of_notMem hn,Set.indicator_of_notMem h,le_refl] + +omit [Fintype I] in +lemma perm_mem_of_fix_outside (S : Finset I) (σ : Equiv.Perm I) + (hσ : ∀i,i∉S→σ i=i) (i : I) : σ i∈S ↔ i∈S := by + constructor + · intro h + by_contra hi + rw [hσ i hi] at h + contradiction + · intro hi + by_contra hn + have he : σ (σ i)=σ i := hσ (σ i) hn + have he' : σ i=i := σ.injective he + exact hn (he'.symm ▸ hi) + +omit [Fintype I] in +lemma paired_outside_checks (S o : Finset I) (hso : Disjoint S o) (σ : Equiv.Perm I) + (hσ : ∀i,i∉S→σ i=i) (x z : I→P) + (hx : x∈retainedEvent (fun p : I×I ↦ primaryPairCheck avoid hm real p.1 p.2) o) : + (fun i ↦ (x i,z i))∈retainedEvent (pairedRouteChecks avoid hm real S σ) o := by + intro c hc + obtain ⟨b,i,j⟩ := c + cases b + · exact hx (i,j) hc + · have hi : σ i∈o := hc (by simp [pairedRouteChecks,ownedPairCheck]) + have hj : σ j∈o := hc (by simp [pairedRouteChecks,ownedPairCheck]) + have hin : i∉S := fun his ↦ Finset.disjoint_left.mp hso ((perm_mem_of_fix_outside S σ hσ i).mpr his) hi + have hjn : j∉S := fun hjs ↦ Finset.disjoint_left.mp hso ((perm_mem_of_fix_outside S σ hσ j).mpr hjs) hj + have hio : i∈o := by simpa only [hσ i hin] using hi + have hjo : j∈o := by simpa only [hσ j hjn] using hj + have hre := hx (i,j) (by simpa only [primaryPairCheck,Finset.insert_subset_iff,Finset.singleton_subset_iff] using And.intro hio hjo) + simpa only [pairedRouteChecks,ownedPairCheck,primaryPairCheck,hin,hjn,ite_false,hσ i hin,hσ j hjn] using hre + +lemma paired_full_event (S : Finset I) (σ : Equiv.Perm I) (x z : I→P) : + (fun i ↦ (x i,z i))∈retainedEvent (pairedRouteChecks avoid hm real S σ) Finset.univ ↔ + (∀i j,i≠j→ real i→ real j→avoid (x i) (x j)) ∧ + (∀i j,i≠j→ real i→ real j→avoid (if i∈S then z (σ i) else x (σ i)) + (if j∈S then z (σ j) else x (σ j))) := by + constructor + · intro h + exact ⟨fun i j ↦ h (false,i,j) (Finset.subset_univ _),fun i j ↦ h (true,i,j) (Finset.subset_univ _)⟩ + · rintro ⟨h₁,h₂⟩ ⟨b,i,j⟩ _ + cases b + · exact h₁ i j + · exact h₂ i j + +end HardSphere.Comparison + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Conditioning/PartialAlgebra.lean b/lean/OAI/Analysis/HardSphere/Conditioning/PartialAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..32bcdc24fef0d254e83be36903c2fd7078530d4f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Conditioning/PartialAlgebra.lean @@ -0,0 +1,114 @@ +import Mathlib +import OAI.Analysis.HardSphere.Operators.FreeResolventDenseRange +import OAI.Analysis.HardSphere.Geometry.GeneratorScalar + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open MeasureTheory Set Filter ContinuousLinearMap +open scoped Topology + +lemma smoothPartial_smooth {N : ℕ} {L : Length} (f : smoothAlgebra N L) (p : Direction N) : + smoothPartial f p∈smoothAlgebra N L := by + change ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ coordDerivative N L f.val p (project N L X)) + simp_rw [coordDerivative_project] + have hf : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ f.val (project N L X)) := f.property + exact (hf.fderiv_right (by simp)).clm_apply contDiff_const + +def partialAlgebra {N : ℕ} {L : Length} (f : smoothAlgebra N L) (p : Direction N) : + smoothAlgebra N L := ⟨smoothPartial f p,smoothPartial_smooth f p⟩ + +def smoothLaplacian {N : ℕ} {L : Length} (f : smoothAlgebra N L) : ScalarL2 N L := + -∑ p : Direction N, ContinuousMap.toLp 2 volume ℂ (smoothPartial (partialAlgebra f p) p) + +lemma smooth_form_pairing {N : ℕ} {L : Length} {a : ℝ} {v : Jet N L} + (hv : v∈dirichletDomain N L a) (f : smoothAlgebra N L) : + (∑ p : Direction N, inner ℂ (ContinuousMap.toLp 2 volume ℂ (smoothPartial f p)) (v.2 p))= + inner ℂ (smoothLaplacian f) v.1 := by + rw [smoothLaplacian,inner_neg_left,sum_inner] + rw [← Finset.sum_neg_distrib] + apply Finset.sum_congr rfl + intro p _ + exact eq_neg_of_add_eq_zero_left (weak_derivative hv (partialAlgebra f p) p) + +def SmoothTest.asSmooth {N : ℕ} {L : Length} {a : ℝ} (f : SmoothTest N L a) : + smoothAlgebra N L := ⟨⟨f.toFun,f.continuous⟩,f.smooth⟩ + +lemma SmoothTest.scalar_toLp {N : ℕ} {L : Length} {a : ℝ} (f : SmoothTest N L a) : + f.jet.1=ContinuousMap.toLp 2 volume ℂ f.asSmooth.val := by + apply Lp.ext + exact f.memLp.coeFn_toLp.trans (ContinuousMap.coeFn_toLp (𝕜 := ℂ) (p := 2) volume f.asSmooth.val).symm + +lemma SmoothTest.derivative_toLp {N : ℕ} {L : Length} {a : ℝ} (f : SmoothTest N L a) + (p : Direction N) : f.jet.2 p=ContinuousMap.toLp 2 volume ℂ (smoothPartial f.asSmooth p) := by + apply Lp.ext + exact (f.partial_memLp p).coeFn_toLp.trans + (ContinuousMap.coeFn_toLp (𝕜 := ℂ) (p := 2) volume (smoothPartial f.asSmooth p)).symm + +lemma SmoothTest.form_pairing {N : ℕ} {L : Length} {a b : ℝ} (f : SmoothTest N L a) + {v : Jet N L} (hv : v∈dirichletDomain N L b) : + (∑ p : Direction N, inner ℂ (f.jet.2 p) (v.2 p))=inner ℂ (smoothLaplacian f.asSmooth) v.1 := by + simp_rw [f.derivative_toLp] + exact smooth_form_pairing hv f.asSmooth + +def SmoothTest.freeTest {N : ℕ} {L : Length} {a : ℝ} (f : SmoothTest N L a) : + SmoothTest N L (-1) where + toFun := f.toFun + smooth := f.smooth + compact := f.compact + support_allowed := by rw [allowed_of_neg N L (by norm_num : (-1:ℝ)<0)]; exact subset_univ _ + memLp := f.memLp + partial_memLp := f.partial_memLp + +lemma SmoothTest.free_resolvent {N : ℕ} {L : Length} {a : ℝ} (f : SmoothTest N L a) : + formResolvent N L (-1) (f.jet.1+smoothLaplacian f.asSmooth)=f.jet.1 := by + let ug : hilbertDomain N L (-1) := ⟨(hilbertJetEquiv N L).symm f.jet,by + change hilbertJetEquiv N L ((hilbertJetEquiv N L).symm f.jet)∈dirichletDomain N L (-1) + rw [ContinuousLinearEquiv.apply_symm_apply] + exact subset_closure ⟨f.freeTest,rfl⟩⟩ + have heq : (scalarEmbedding N L (-1)).adjoint (f.jet.1+smoothLaplacian f.asSmooth)=ug := by + apply ext_inner_right ℂ + intro v + rw [adjoint_inner_left,inner_add_left] + change _=inner ℂ (ug : HilbertJet N L) (v : HilbertJet N L) + rw [hilbertJet_inner] + have hgu : hilbertJetEquiv N L (ug : HilbertJet N L)=f.jet := by simp [ug] + rw [hgu] + congr 1 + exact (f.form_pairing v.property).symm + change scalarEmbedding N L (-1) ((scalarEmbedding N L (-1)).adjoint _)=_ + rw [heq] + change (hilbertJetEquiv N L ((hilbertJetEquiv N L).symm f.jet)).1=f.jet.1 + rw [ContinuousLinearEquiv.apply_symm_apply] + +lemma SmoothTest.free_generator {N : ℕ} {L : Length} {a : ℝ} (f : SmoothTest N L a) + {ι : Type*} {l : Filter ι} {d : ι→ℝ} (hd : ∀ i,0 simp [f,Z,g,hz] + have hig : Integrable g (killedPathLaw N L a t) := + (Complex.reCLM.integrable_comp (hi.congr hg)).congr (Eventually.of_forall fun _ ↦ rfl) + have heg : ∫ω,g ω ∂killedPathLaw N L a t=0 := by + have hh := congrArg Complex.re ((integral_congr_ae hg).symm.trans he) + exact (Complex.reCLM.integral_comp_comm (hi.congr hg)).trans hh + have hgn : ∀ᵐ ω ∂killedPathLaw N L a t, 0≤g ω := ae_of_all _ (fun ω ↦ by dsimp [g]; split_ifs <;> positivity) + have hz := (integral_eq_zero_iff_of_nonneg_ae hgn hig).mp heg + filter_upwards [hz] with ω hω h0 + have hn : ‖u.1 (ω 1)‖=0 := by simpa [g,h0] using hω + exact norm_eq_zero.mp hn + +def complexPhase (z : ℂ) : ℂ := z/(‖z‖:ℂ) + +lemma complexPhase_eq_of_inner {z w : ℂ} (hz : z≠0) (hw : w≠0) + (h : conj z*w=(‖z‖*‖w‖:ℝ)) : complexPhase z=complexPhase w := by + have hnz : (‖z‖:ℂ)≠0 := Complex.ofReal_ne_zero.mpr (norm_ne_zero_iff.mpr hz) + have hnw : (‖w‖:ℂ)≠0 := Complex.ofReal_ne_zero.mpr (norm_ne_zero_iff.mpr hw) + apply (div_eq_div_iff hnz hnw).mpr + have hh := congrArg (fun u : ℂ ↦ z*u) h + rw [←mul_assoc,Complex.mul_conj',Complex.ofReal_mul] at hh + apply mul_left_cancel₀ hnz + calc + (‖z‖:ℂ)*(z*(‖w‖:ℂ))=z*((‖z‖:ℂ)*(‖w‖:ℂ)) := by ring + _ = (‖z‖:ℂ)^2*w := hh.symm + _ = (‖z‖:ℂ)*(w*(‖z‖:ℂ)) := by ring + +lemma complexPhase_mul_norm (z : ℂ) : complexPhase z*(‖z‖:ℂ)=z := by + by_cases hz : z=0 + · simp [complexPhase,hz] + · exact div_mul_cancel₀ _ (Complex.ofReal_ne_zero.mpr (norm_ne_zero_iff.mpr hz)) + +lemma norm_complexPhase {z : ℂ} (hz : z≠0) : ‖complexPhase z‖=1 := by + rw [complexPhase,norm_div,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg (norm_nonneg _)] + exact div_self (norm_ne_zero_iff.mpr hz) + +lemma inner_eq_of_complexPhase_eq {z w : ℂ} (h : complexPhase z=complexPhase w) : + conj z*w=(‖z‖*‖w‖:ℝ) := by + by_cases hz : z=0 + · simp [hz] + by_cases hw : w=0 + · simp [hw] + have hez := complexPhase_mul_norm z + have hew := complexPhase_mul_norm w + conv_lhs => rw [←hez,←hew,←h,map_mul] + simp only [Complex.conj_ofReal] + calc + conj (complexPhase z)*(‖z‖:ℂ)*(complexPhase z*(‖w‖:ℂ))= + (complexPhase z*conj (complexPhase z))*((‖z‖:ℂ)*(‖w‖:ℂ)) := by ring + _ = _ := by rw [Complex.mul_conj',norm_complexPhase hz]; simp + +lemma measurable_complexPhase : Measurable complexPhase := by unfold complexPhase; fun_prop + +lemma IsGroundVector.ae_killed_complexPhase {N : ℕ} {L : Length} {a t : ℝ} + {u : Jet N L} (hu : IsGroundVector N L a u) (ht : 0≤t) : + ∀ᵐ ω ∂killedPathLaw N L a t, complexPhase (u.1 (ω 0))=complexPhase (u.1 (ω 1)) := by + have hrev := (reverse_killedPath_preserving N L a t).quasiMeasurePreserving.ae + (hu.ae_killed_zero_propagation ht) + filter_upwards [hu.ae_killed_zero_propagation ht,hu.ae_killed_endpoints_phase ht,hrev] with ω h0 hphase h1 + have hr : u.1 (ω 1)=0 → u.1 (ω 0)=0 := by simpa [reverseConfigurationPath] using h1 + by_cases hz : u.1 (ω 0)=0 + · rw [hz,h0 hz] + · exact complexPhase_eq_of_inner hz (mt hr hz) hphase + +end HardSphere + +namespace HardSphere + +lemma IsGroundVector.phase_region {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : IsGroundVector N L a u) {x : Configuration N L} (hx : x∈allowed N L a) : + ∃z, x∈LocalAE.region volume (fun y ↦ complexPhase (u.1 y)=z) := by + have hm := measurable_complexPhase.comp (Lp.stronglyMeasurable u.1).measurable + have hpm : MeasurableSet {p : Configuration N L×Configuration N L | + complexPhase (u.1 p.1)=complexPhase (u.1 p.2)} := + measurableSet_eq_fun (hm.comp measurable_fst) (hm.comp measurable_snd) + obtain ⟨U,hU,hxU,hsub,hp⟩ := killed_ae_torus_local_pairs L a (P:=fun X Y ↦ complexPhase (u.1 X)=complexPhase (u.1 Y)) hpm + (fun t ht ↦ hu.ae_killed_complexPhase ht.le) hx + obtain ⟨z,hz⟩ := LocalAE.ae_local_const_of_ae_pairs volume (hU.measure_ne_zero volume ⟨x,hxU⟩) hp + exact ⟨z,U,hU,hxU,hz⟩ + +def groundPhaseRepresentative {N : ℕ} {L : Length} (u : Jet N L) : Configuration N L → ℂ := + LocalAE.representative volume (fun y ↦ complexPhase (u.1 y)) + +lemma IsGroundVector.ae_phaseRepresentative {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : IsGroundVector N L a u) : + ∀ᵐ x ∂volume.restrict (allowed N L a), complexPhase (u.1 x)=groundPhaseRepresentative u x := + LocalAE.representative_ae volume (isOpen_allowed N L a) (fun _ hx ↦ hu.phase_region hx) + +lemma IsGroundVector.phaseRepresentative_eq_on_connected {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : IsGroundVector N L a u) {S : Set (Configuration N L)} (hS : IsPreconnected S) + (hsub : S⊆allowed N L a) {x y : Configuration N L} (hx : x∈S) (hy : y∈S) : + groundPhaseRepresentative u x=groundPhaseRepresentative u y := + LocalAE.representative_eq_on_connected volume hS (fun _ hz ↦ hu.phase_region (hsub hz)) hx hy + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Conditioning/PhaseMeasure.lean b/lean/OAI/Analysis/HardSphere/Conditioning/PhaseMeasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf46184adf12da02b7c551387b3723be9755c279 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Conditioning/PhaseMeasure.lean @@ -0,0 +1,77 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.BridgeResidual +import OAI.Analysis.HardSphere.Comparison.PiAC + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory MeasureTheory.Measure Set Filter ProbabilityTheory +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere +open Wiener + +def localLiftBox {N : ℕ} (L : Length) (c : LiftedConfiguration N) : Set (LiftedConfiguration N) := + Set.univ.pi (fun i ↦ Set.univ.pi (fun j ↦ Icc (c i j-L.val/2) (c i j+L.val/2))) + +lemma localLiftBox_preserving {N : ℕ} (L : Length) (c : LiftedConfiguration N) : + MeasurePreserving (project N L) (volume.restrict (localLiftBox L c)) volume := by + have hi (i : Fin N) : MeasurePreserving (fun x : Fin 3 → ℝ ↦ fun j ↦ (x j : AddCircle L.val)) + (volume.restrict (Set.univ.pi (fun j ↦ Icc (c i j-L.val/2) (c i j+L.val/2)))) volume := by + have hp := measurePreserving_pi (fun j : Fin 3 ↦ volume.restrict (Icc (c i j-L.val/2) (c i j+L.val/2))) + (fun _ : Fin 3 ↦ (volume : Measure (AddCircle L.val))) + (f:=fun _ x ↦ (x:AddCircle L.val)) (fun j ↦ ?_) + · change MeasurePreserving _ ((Measure.pi (fun _ : Fin 3 ↦ (volume : Measure ℝ))).restrict _) (Measure.pi (fun _ : Fin 3 ↦ (volume : Measure (AddCircle L.val)))) + simpa only [Measure.restrict_pi_pi] using hp + · have hp := AddCircle.measurePreserving_mk L.val (c i j-L.val/2) + rw [restrict_Ioc_eq_restrict_Icc,show c i j-L.val/2+L.val=c i j+L.val/2 by ring] at hp + exact hp + have hp := measurePreserving_pi + (fun i ↦ volume.restrict (Set.univ.pi (fun j ↦ Icc (c i j-L.val/2) (c i j+L.val/2)))) + (fun _ : Fin N ↦ (volume : Measure (Torus L))) hi + change MeasurePreserving (fun X : LiftedConfiguration N ↦ fun i j ↦ (X i j : AddCircle L.val)) ((Measure.pi (fun _ : Fin N ↦ (volume : Measure (Fin 3 → ℝ)))).restrict _) (Measure.pi (fun _ : Fin N ↦ (volume : Measure (Torus L)))) + simpa only [project,localLiftBox,Measure.restrict_pi_pi] using hp + +lemma ball_subset_localLiftBox {N : ℕ} (L : Length) (c : LiftedConfiguration N) {r : ℝ} + (hr : r≤L.val/2) : Metric.ball c r ⊆ localLiftBox L c := by + intro X hX i hi j hj + have hd : dist (X i j) (c i j) linarith + +lemma gaussianCoordinates_ac (N : ℕ) : gaussianCoordinates N ≪ (volume : Measure (Direction N → ℝ)) := + Measure.pi_ac _ _ (fun _ ↦ gaussianReal_absolutelyContinuous 0 (by norm_num)) +lemma gaussianCoordinates_ac' (N : ℕ) : (volume : Measure (Direction N → ℝ)) ≪ gaussianCoordinates N := + Measure.pi_ac _ _ (fun _ ↦ gaussianReal_absolutelyContinuous' 0 (by norm_num)) + +def flattenEquiv (N : ℕ) : LiftedConfiguration N ≃L[ℝ] (Direction N → ℝ) := + (LinearEquiv.curry ℝ ℝ (Fin N) (Fin 3)).symm.toContinuousLinearEquiv + +lemma flatten_quasi (N : ℕ) : QuasiMeasurePreserving (flattenEquiv N) + (volume : Measure (LiftedConfiguration N)) (volume : Measure (Direction N → ℝ)) := by + let := (flattenEquiv N).isAddHaarMeasure_map (volume : Measure (LiftedConfiguration N)) + exact ⟨(flattenEquiv N).continuous.measurable,absolutelyContinuous_isAddHaarMeasure _ _⟩ + +lemma endpointNoise_quasi {N : ℕ} {t : ℝ} (ht : 0 + change fillGroup p _ _ (optionParticle p none)=_ + rw [fillGroup_selected] + rfl + | some i => + by_cases hi : i∈groupUnion g a + · change fillGroup p _ _ (optionParticle p (some ⟨i,hi⟩))=_ + rw [fillGroup_selected] + simp only [Option.elim_some,physicalRecoveredMidpoint,physicalRecoveredPath,dite_eq_left hi] + rfl + · have hn : some i∉Set.range (optionParticle p) := by + rintro ⟨j,hj⟩ + cases j with + | none => cases hj + | some j => exact hi ((Option.some.inj hj) ▸ j.property) + unfold physicalFullMidpoint fillGroup + rw [Function.extend_apply' _ _ _ hn] + simp only [Option.elim_some,physicalRecoveredMidpoint,physicalRecoveredPath,dite_eq_right hi] + +theorem physicalPrimary_joint_split {N K M G : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (μ : Measure (PhysicalDatum N K M G L)) [SFinite μ] + (g : Fin G) (a : GridAllocation N K (G*M)) (m : ℕ) (t r R C S : ℝ) (u : Time) + (v : Fin 3→Fin K) : + μ.compProd (physicalPrimaryReference hL g m t r R C S u + (fun i : {i // i∈groupUnion g a} ↦ i.val) v)= + ((μ.compProd (datumGroupReference hL g a m r R C S t u)).prod (cellPathReference v)).map + (fun z ↦ (z.1.1,(MeasurableEquiv.piOptionEquivProd + (fun _ : Option {i // i∈groupUnion g a} ↦ C(Time,Point))).symm (z.1.2,z.2))) := by + let e := (MeasurableEquiv.piOptionEquivProd + (fun _ : Option {i // i∈groupUnion g a} ↦ C(Time,Point))).symm + have he : physicalPrimaryReference hL g m t r R C S u + (fun i : {i // i∈groupUnion g a} ↦ i.val) v = + ((datumGroupReference hL g a m r R C S t u) ×ₖ Kernel.const _ (cellPathReference v)).map e := by + ext d : 1 + rw [physicalPrimaryReference_actual,Kernel.map_apply _ e.measurable,Kernel.prod_apply,Kernel.const_apply] + rw [he,Measure.compProd_map e.measurable] + rw [←compProd_prod_const μ (datumGroupReference hL g a m r R C S t u) (cellPathReference v), + Measure.map_map (by fun_prop) (by fun_prop)] + rfl + +theorem physicalBranch_full_midpoint_raw {N K M G : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) (h50 : 50 + exact (projectPoint_continuous L).measurable.comp + ((continuous_eval_const midpointTime).measurable.comp measurable_snd) + | some i => exact (measurable_pi_apply i).comp measurable_fst.snd + have hg : Measurable (fun z : PhysicalDatum N K M G L×({i // i∈groupUnion g a}→C(Time,Point)) ↦ + (z.1,physicalRecoveredMidpoint g a (z.1,projectGroup z.2))) := + measurable_fst.prodMk ((physicalRecoveredMidpoint_measurable g a).comp + (measurable_fst.prodMk (projectGroup_measurable.comp measurable_snd))) + have hr : Measurable (fun z : BridgeEndpoints N L×(Fin N→Bridge.Noise) ↦ + (physicalDatum g m r R C S s₀ u (labelBridgePath N L (2*t) z,a), + labelBridgePath N L (2*t) z midpointTime)) := + ((physicalDatum_measurable g m r R C S s₀ u).comp + ((labelBridgePath_measurable N L (2*t)).prodMk measurable_const)).prodMk + ((continuous_eval_const midpointTime).measurable.comp (labelBridgePath_measurable N L (2*t))) + have H := congrArg (fun ν ↦ (ν.prod (cellPathReference v)).map f) + (physicalBranch_midpoint_raw hL hK h50 μ g b a m r R C S s₀ t u) + have fix (η : Measure C(Time,Point)) : η.map id=η := Measure.map_id + conv_lhs at H => rw [←fix (cellPathReference v),Measure.map_prod_map _ _ hg measurable_id] + conv_rhs at H => rw [←fix (cellPathReference v),Measure.map_prod_map _ _ hr measurable_id] + rw [Measure.map_map hf (hg.prodMap measurable_id),Measure.map_map hf (hr.prodMap measurable_id)] at H + rw [physicalPrimary_joint_split,Measure.map_map + (measurable_fst.prodMk (physicalFullMidpoint_measurable _)) (by fun_prop)] + convert H using 1 + · apply Measure.map_congr + filter_upwards [] with z + simp only [Function.comp_def,Prod.map,Function.id_def,f,physicalFullMidpoint_split] + · rfl + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Conditioning/PhysicalObservation.lean b/lean/OAI/Analysis/HardSphere/Conditioning/PhysicalObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..163d5c804b69e1e01d40da6786f01b529833d1de --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Conditioning/PhysicalObservation.lean @@ -0,0 +1,175 @@ +import Mathlib +import OAI.Analysis.HardSphere.Allocation.PhysicalPairedRoute + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +attribute [local instance] Classical.propDecidable +variable {I J E : Type*} [DecidableEq I] [DecidableEq J] + +def optionParticle (particle : J↪I) : Option J↪Option I where + toFun := Option.map particle + inj' := by + intro i j h + cases i <;> cases j <;> simp_all only [Option.map_none,Option.map_some,Option.some.injEq, + reduceCtorEq] + exact particle.injective h + +omit [DecidableEq I] [DecidableEq J] in +lemma routeEmbedding_natural {d : ℕ} (particle : J↪I) (labels : Fin d↪J) (k : Fin (d+1)) : + routeEmbedding (labels.trans particle) k=optionParticle particle (routeEmbedding labels k) := by + change (if h : k.val simp only [hk,↓reduceDIte,Option.map_some,Option.map_none] + +omit [DecidableEq I] in +lemma routePermutation_natural {d : ℕ} (particle : J↪I) (labels : Fin d↪J) (i : Option J) : + routePermutation (labels.trans particle) (optionParticle particle i)= + optionParticle particle (routePermutation labels i) := by + by_cases hi : i∈routeSlots labels + · obtain ⟨k,_,hk⟩ := Finset.mem_map.mp hi + subst i + rw [←routeEmbedding_natural] + change (finRotate (d+1)).viaEmbedding _ _=optionParticle particle ((finRotate (d+1)).viaEmbedding _ _) + rw [Equiv.Perm.viaEmbedding_apply,Equiv.Perm.viaEmbedding_apply,routeEmbedding_natural] + · have hni : optionParticle particle i∉routeSlots (labels.trans particle) := by + rintro hj + obtain ⟨k,_,hk⟩ := Finset.mem_map.mp hj + apply hi + refine Finset.mem_map.mpr ⟨k,Finset.mem_univ _,?_⟩ + apply (optionParticle particle).injective + rwa [←routeEmbedding_natural] + rw [routePermutation_fixed _ _ hni,routePermutation_fixed _ _ hi] + +omit [DecidableEq I] [DecidableEq J] in +lemma fullRoute_fixed_outside {d : ℕ} (particle : J↪I) (labels : Fin d↪J) (i : Option I) + (hi : i∉Set.range (optionParticle particle)) : routePermutation (labels.trans particle) i=i := by + apply routePermutation_fixed + intro h + obtain ⟨k,_,rfl⟩ := Finset.mem_map.mp h + exact hi ⟨routeEmbedding labels k,(routeEmbedding_natural particle labels k).symm⟩ + +def fillGroup (particle : J↪I) (H : Option I→E) (F : Option J→E) : Option I→E := + Function.extend (optionParticle particle) F H + +omit [DecidableEq I] [DecidableEq J] in +lemma fillGroup_selected (particle : J↪I) (H : Option I→E) (F : Option J→E) (i : Option J) : + fillGroup particle H F (optionParticle particle i)=F i := + (optionParticle particle).injective.extend_apply F H i + +omit [DecidableEq I] in +lemma fillGroup_permutation {d : ℕ} (particle : J↪I) (labels : Fin d↪J) + (H : Option I→E) (F G : Option J→E) (hFG : ∀i,G i=F (routePermutation labels i)) : + ∀i,fillGroup particle H G i=fillGroup particle H F (routePermutation (labels.trans particle) i) := by + intro i + by_cases hi : i∈Set.range (optionParticle particle) + · obtain ⟨j,rfl⟩ := hi + rw [routePermutation_natural,fillGroup_selected,fillGroup_selected,hFG] + · rw [fullRoute_fixed_outside particle labels i hi] + exact (Function.extend_apply' G H i hi).trans (Function.extend_apply' F H i hi).symm + +omit [DecidableEq I] [DecidableEq J] in +lemma fillGroup_measurable [MeasurableSpace E] (particle : J↪I) : + Measurable (fun z : (Option I→E)×(Option J→E) ↦ fillGroup particle z.1 z.2) := by + apply Measurable.of_eval + intro i + by_cases hi : i∈Set.range (optionParticle particle) + · obtain ⟨j,rfl⟩ := hi + simpa only [fillGroup_selected,Function.comp_def] using (measurable_pi_apply j).comp measurable_snd + · have he : (fun z : (Option I→E)×(Option J→E) ↦ fillGroup particle z.1 z.2 i)=fun z ↦ z.1 i := by + funext z; exact Function.extend_apply' z.2 z.1 i hi + rw [he] + exact (measurable_pi_apply i).comp measurable_fst + +lemma ambient_midpoint_permutation [Fintype I] [MeasurableSpace E] + {V : I→Type*} [∀i,MeasurableSpace (V i)] (σ : Equiv.Perm I) (s : Finset I) + (hσ : ∀i,i∉s→σ i=i) (mid : ∀i,V i→E) + (z : (∀i,V i)×(∀i:s,V i×V (σ.symm i))) + (hz : ∀i:s,mid i (z.2 i).1=mid (σ.symm i) (z.2 i).2) : + ∀i,mid i (ambientSecond s σ hσ z i)=mid (σ i) (ambientFirst s σ z (σ i)) := by + intro i + by_cases hi : i∈s + · have hσi := (Bridge.move_mem_iff σ s hσ i).mpr hi + simp only [ambientFirst,ambientSecond,Function.updateFinset,dite_eq_left hi,dite_eq_left hσi, + Bridge.reverseSelected_apply,Bridge.mid_fiberEquiv] + exact (hz (Bridge.selectedPerm σ s hσ ⟨i,hi⟩)).symm + · have hσi : σ i∉s := by simpa only [hσ i hi] using hi + simp only [ambientFirst,ambientSecond,Function.updateFinset,dite_eq_right hi,dite_eq_right hσi] + exact congrArg (fun j ↦ mid j (z.1 j)) (hσ i hi).symm + +end HardSphere.Comparison +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital +attribute [local instance] Classical.propDecidable +variable {J : Type*} [Fintype J] [DecidableEq J] + +lemma projectPoint_continuous (L : Length) : Continuous (projectPoint L) := + continuous_pi (fun j ↦ (AddCircle.continuous_mk' L.val).comp (continuous_apply j)) + +def physicalFullMidpoint {N K M G : ℕ} {L : Length} (particle : J↪Fin N) + (z : PhysicalDatum N K M G L×(Option J→C(Time,Point))) : Option (Fin N)→Torus L := + fillGroup particle (fun i ↦ i.elim 0 (fun j ↦ z.1.2.2.2.2 j midpointTime 0)) + (fun i ↦ projectPoint L (z.2 i midpointTime)) + +omit [Fintype J] [DecidableEq J] in +lemma physicalFullMidpoint_measurable {N K M G : ℕ} {L : Length} (particle : J↪Fin N) : + Measurable (physicalFullMidpoint (K:=K) (M:=M) (G:=G) (L:=L) particle) := by + unfold physicalFullMidpoint + refine (fillGroup_measurable (E:=Torus L) particle).comp (f:=fun z : PhysicalDatum N K M G L×(Option J→C(Time,Point)) ↦ + ((fun i : Option (Fin N) ↦ i.elim 0 (fun j ↦ z.1.2.2.2.2 j midpointTime 0)), + (fun i : Option J ↦ projectPoint L (z.2 i midpointTime)))) ?_ + apply Measurable.prodMk + · apply Measurable.of_eval + intro i + cases i with + | none => exact measurable_const + | some i => + exact (measurable_pi_apply 0).comp ((continuous_eval_const midpointTime).measurable.comp + ((datumFrozen_measurable i).comp measurable_fst)) + · apply Measurable.of_eval + intro i + exact (projectPoint_continuous L).measurable.comp ((continuous_eval_const midpointTime).measurable.comp + ((measurable_pi_apply i).comp measurable_snd)) + +theorem physicalPairedRoute_midpoint {N K M G n : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (ht : 0 Kernel.const _ (cellPathReference v) + | some i => datumIndividualReference hL g m r R C S t u (particle i) + +instance physicalSlotReference_finite {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) + (particle : J→Fin N) (v : Fin 3→Fin K) (i : Option J) : + IsFiniteKernel (physicalSlotReference (M:=M) hL g m t r R C S u particle v i) := by + cases i <;> dsimp only [physicalSlotReference] <;> infer_instance + +lemma physicalSlot_first {N K M G n : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) + (particle : J↪Fin N) (labels : Fin (n+1)↪J) (v : Fin (n+2)→(Fin 3→Fin K)) + (k : Fin (n+2)) (d : PhysicalDatum N K M G L) : + physicalSlotReference hL g m t r R C S u particle (v (Fin.last (n+1))) + (routeEmbedding labels k) d=routeFirstReference hL g m t r R C S u (labels.trans particle) v k d := by + by_cases hk : k.val exact measurable_snd + | some i => exact (measurable_pi_apply i).comp measurable_fst + +def cellObservation (b : Bool) (z : (E×(Fin n→E))×E) : E×E×(Fin n→E) := + if b then (z.1.1,z.2,z.1.2) else (z.2,z.1.1,z.1.2) +lemma cellObservation_measurable (b : Bool) : Measurable (cellObservation (n:=n) (E:=E) b) := by + unfold cellObservation + split_ifs <;> fun_prop + +theorem primaryBath_product (P : Measure (Fin (n+1)→E)) [SFinite P] + (η : Measure E) [SFinite η] (b : Bool) (i : Fin (n+1)) : + primaryBathKernel b i ∘ₘ (P.prod η).map adjoinPoint = + (((P.prod (uniformBathOrder n)).map (orderedObservation i)).prod η).map (cellObservation b) := by + ext s hs + rw [Measure.bind_apply hs (primaryBathKernel b i).aemeasurable, + lintegral_map ((primaryBathKernel b i).measurable_coe hs) adjoinPoint_measurable, + lintegral_prod _ (show AEMeasurable (fun a ↦ primaryBathKernel b i (adjoinPoint a) s) (P.prod η) from + (((primaryBathKernel b i).measurable_coe hs).comp adjoinPoint_measurable).aemeasurable), + Measure.map_apply (cellObservation_measurable b) hs,Measure.prod_apply + ((cellObservation_measurable b) hs)] + have hm := measurable_measure_prodMk_left (ν:=η) ((cellObservation_measurable b) hs) + rw [lintegral_map hm (orderedObservation_measurable i), + lintegral_prod _ (show AEMeasurable (fun a ↦ η (Prod.mk (orderedObservation i a) ⁻¹' cellObservation b ⁻¹' s)) _ from + (hm.comp (orderedObservation_measurable i)).aemeasurable)] + apply lintegral_congr + intro X + simp_rw [primaryBathKernel_apply] + have hh : Measurable (fun z : E×Equiv.Perm (Fin n) ↦ + (s.indicator (fun _ ↦ (1:ℝ≥0∞))) + (orderedPrimaryObservation b i (adjoinPoint (X,z.1),z.2))) := + (measurable_const.indicator hs).comp ((orderedPrimaryObservation_measurable b i).comp + ((adjoinPoint_measurable.comp (measurable_const.prodMk measurable_fst)).prodMk measurable_snd)) + convert (lintegral_lintegral_swap (μ:=η) (ν:=uniformBathOrder n) + (f:=fun e τ ↦ s.indicator (fun _ ↦ (1:ℝ≥0∞)) + (orderedPrimaryObservation b i (adjoinPoint (X,e),τ))) hh.aemeasurable) using 1 + · apply lintegral_congr + intro e + rw [←lintegral_indicator_one hs] + exact lintegral_map (measurable_const.indicator hs) + (show Measurable (fun τ ↦ orderedPrimaryObservation b i (adjoinPoint (X,e),τ)) from + (orderedPrimaryObservation_measurable b i).comp (measurable_const.prodMk measurable_id)) + · apply lintegral_congr + intro τ + have he : (fun e ↦ orderedPrimaryObservation b i (adjoinPoint (X,e),τ))= + (fun e ↦ cellObservation b (orderedObservation i (X,τ),e)) := by + funext e + cases b <;> rfl + change η ((fun e ↦ cellObservation b (orderedObservation i (X,τ),e)) ⁻¹' s)=_ + have hm : Measurable (fun e ↦ cellObservation b (orderedObservation i (X,τ),e)) := + (cellObservation_measurable b).comp measurable_prodMk_left + rw [←Measure.map_apply hm hs,←lintegral_indicator_one hs] + refine (lintegral_map (measurable_const.indicator hs) hm).trans ?_ + exact congrArg (fun f ↦ ∫⁻e,s.indicator (fun _ ↦ (1:ℝ≥0∞)) (f e) ∂η) he.symm + +end HardSphere.Comparison +end +end + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Comparison +variable {n : ℕ} {E : Type*} [MeasurableSpace E] +attribute [local instance] permBathSpace permBathSingleton + +lemma prod_restrict_first (P : Measure E) [SFinite P] {Y : Type*} [MeasurableSpace Y] + (η : Measure Y) [SFinite η] (A : Set E) : + (P.restrict A).prod η=(P.prod η).restrict (Prod.fst ⁻¹' A) := by + have H := Measure.prod_restrict (μ:=P) (ν:=η) A univ + simpa only [Measure.restrict_univ,Set.prod_univ] using H + +lemma orderedKernel_restrict (P : Measure (Fin (n+1)→E)) [SFinite P] + (i : Fin (n+1)) (A : Set E) (hA : MeasurableSet A) : + (orderedKernel (uniformBathOrder n) i ∘ₘ P).restrict (Prod.fst ⁻¹' A)= + orderedKernel (uniformBathOrder n) i ∘ₘ P.restrict ((fun X ↦ X i) ⁻¹' A) := by + rw [orderedKernel_comp,orderedKernel_comp,Measure.restrict_map (orderedObservation_measurable i) + (hA.preimage measurable_fst),prod_restrict_first] + rfl + +theorem primaryBath_cell_reference (P : Measure (Fin (n+1)→E)) [SFinite P] + (η : Measure E) [SFinite η] (b : Bool) (i : Fin (n+1)) + (A : Set E) (hA : MeasurableSet A) : + primaryBathKernel b i ∘ₘ ((P.prod η).map adjoinPoint).restrict ((fun F ↦ F (some i)) ⁻¹' A)= + (((cellExtraKernel (Y:=Fin n→E) η A univ hA).map (cellObservation b)) ∘ₖ + orderedKernel (uniformBathOrder n) i) ∘ₘ P := by + rw [Measure.restrict_map adjoinPoint_measurable (hA.preimage (measurable_pi_apply (some i)))] + have he : adjoinPoint ⁻¹' ((fun F : Option (Fin (n+1))→E ↦ F (some i)) ⁻¹' A)= + Prod.fst ⁻¹' ((fun X : Fin (n+1)→E ↦ X i) ⁻¹' A) := rfl + rw [he,←prod_restrict_first,primaryBath_product,←orderedKernel_comp, + ←Measure.comp_assoc,←Measure.map_comp _ _ (cellObservation_measurable b), + cellExtraKernel_comp _ η A univ hA MeasurableSet.univ] + have he' : {p : (E×(Fin n→E))×E | p.1.1∈A ∧ p.2∈univ}= + Prod.fst ⁻¹' (Prod.fst ⁻¹' A) := by ext p; simp + rw [he',←prod_restrict_first,orderedKernel_restrict _ _ A hA] + +end HardSphere.Comparison +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Conditioning/ProductExpose.lean b/lean/OAI/Analysis/HardSphere/Conditioning/ProductExpose.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c86c0b96b04550f5cf154d17448dbbef5de87da --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Conditioning/ProductExpose.lean @@ -0,0 +1,69 @@ +import Mathlib +import OAI.Analysis.HardSphere.Conditioning.FiberDisintegrate + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {E I : Type*} [MeasurableSpace E] [Fintype I] +variable {X : I→Type*} [∀i,MeasurableSpace (X i)] + +def blockGlue (p : I→Prop) [DecidablePred p] + (z : (E×(∀i : {i // ¬p i},X i))×(∀i : {i // p i},X i)) : E×(∀i,X i) := + (z.1.1,(MeasurableEquiv.piEquivPiSubtypeProd X p).symm (z.2,z.1.2)) + +lemma blockGlue_preserving (μ : Measure E) [SFinite μ] (ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (ν i)] + (p : I→Prop) [DecidablePred p] : + MeasurePreserving (blockGlue (E:=E) p) + ((μ.prod (Measure.pi fun i : {i // ¬p i} ↦ ν i)).prod (Measure.pi fun i : {i // p i} ↦ ν i)) + (μ.prod (Measure.pi ν)) := by + have h₁ := measurePreserving_prodAssoc μ (Measure.pi fun i : {i // ¬p i} ↦ ν i) (Measure.pi fun i : {i // p i} ↦ ν i) + have h₂ := (MeasurePreserving.id μ).prod (Measure.measurePreserving_swap + (μ:=Measure.pi fun i : {i // ¬p i} ↦ ν i) (ν:=Measure.pi fun i : {i // p i} ↦ ν i)) + have h₃ := (MeasurePreserving.id μ).prod ((measurePreserving_piEquivPiSubtypeProd ν p).symm (MeasurableEquiv.piEquivPiSubtypeProd X p)) + exact h₃.comp (h₂.comp h₁) + +omit [Fintype I] in +lemma blockGlue_measurable (p : I→Prop) [DecidablePred p] : Measurable (blockGlue (E:=E) (X:=X) p) := + measurable_fst.fst.prodMk ((MeasurableEquiv.piEquivPiSubtypeProd X p).symm.measurable.comp (measurable_snd.prodMk measurable_fst.snd)) + +def blockEvent (p : I→Prop) [DecidablePred p] (B : Set (E×(∀i,X i))) := blockGlue p ⁻¹' B + +def exposedLaw (μ : Measure E) [SFinite μ] (ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (ν i)] + (p : I→Prop) [DecidablePred p] (B : Set (E×(∀i,X i))) : Measure (E×(∀i : {i // ¬p i},X i)) := + (μ.prod (Measure.pi fun i : {i // ¬p i} ↦ ν i)).withDensity + (fun w ↦ fiberRestrict (Kernel.const _ (Measure.pi fun i : {i // p i} ↦ ν i)) (blockEvent p B) w univ) + +lemma exposed_block_reconstruct (μ : Measure E) [SFinite μ] (ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (ν i)] + (p : I→Prop) [DecidablePred p] {B : Set (E×(∀i,X i))} (hB : MeasurableSet B) + [SFinite (exposedLaw μ ν p B)] : + ((exposedLaw μ ν p B).compProd + (fiberNormalize (Kernel.const _ (Measure.pi fun i : {i // p i} ↦ ν i)) (blockEvent p B))).map (blockGlue p)= + (μ.prod (Measure.pi ν)).restrict B := by + have hC : MeasurableSet (blockEvent p B) := hB.preimage (blockGlue_measurable p) + have h := fiber_disintegrate (μ.prod (Measure.pi fun i : {i // ¬p i} ↦ ν i)) + (Kernel.const _ (Measure.pi fun i : {i // p i} ↦ ν i)) hC + change ((exposedLaw μ ν p B).compProd _).map _=_ + rw [show (exposedLaw μ ν p B).compProd (fiberNormalize (Kernel.const _ (Measure.pi fun i : {i // p i} ↦ ν i)) (blockEvent p B))= + ((μ.prod (Measure.pi fun i : {i // ¬p i} ↦ ν i)).prod (Measure.pi fun i : {i // p i} ↦ ν i)).restrict (blockEvent p B) by simpa only [Measure.compProd_const,exposedLaw] using h] + exact ((blockGlue_preserving μ ν p).restrict_preimage hB).map_eq + +lemma exposed_block_positive (μ : Measure E) [SFinite μ] (ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (ν i)] + (p : I→Prop) [DecidablePred p] {B : Set (E×(∀i,X i))} (hB : MeasurableSet B) : + ∀ᵐw ∂exposedLaw μ ν p B,0<(Measure.pi fun i : {i // p i} ↦ ν i) {v | blockGlue p (w,v)∈B} := by + exact exposed_mass_positive (μ.prod (Measure.pi fun i : {i // ¬p i} ↦ ν i)) + (Kernel.const _ (Measure.pi fun i : {i // p i} ↦ ν i)) (hB.preimage (blockGlue_measurable p)) + +end HardSphere.Comparison + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Conditioning/ProductNormalize.lean b/lean/OAI/Analysis/HardSphere/Conditioning/ProductNormalize.lean new file mode 100644 index 0000000000000000000000000000000000000000..fecedaafadbb9d9e9c8e463f6f1f38e303ac9c7c --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Conditioning/ProductNormalize.lean @@ -0,0 +1,162 @@ +import Mathlib +import OAI.Analysis.HardSphere.Conditioning.ProductExpose + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Comparison +variable {I : Type*} [Fintype I] {X : I→Type*} [∀i,MeasurableSpace (X i)] + +def conditionedMeasure {A : Type*} [MeasurableSpace A] (μ : Measure A) (S : Set A) : Measure A := + (μ S)⁻¹ • μ.restrict S + +lemma conditioned_probability {A : Type*} [MeasurableSpace A] (μ : Measure A) [IsFiniteMeasure μ] + {S : Set A} (h : μ S≠0) : IsProbabilityMeasure (conditionedMeasure μ S) := by + constructor + simp only [conditionedMeasure,Measure.smul_apply,smul_eq_mul,Measure.restrict_apply_univ] + exact ENNReal.inv_mul_cancel h (measure_ne_top _ _) + +lemma pi_conditioned (ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (ν i)] + (S : ∀i,Set (X i)) (hS : ∀i,MeasurableSet (S i)) (hpos : ∀i,ν i (S i)≠0) : + Measure.pi (fun i ↦ conditionedMeasure (ν i) (S i))= + conditionedMeasure (Measure.pi ν) (univ.pi S) := by + let : ∀i,IsProbabilityMeasure (conditionedMeasure (ν i) (S i)) := fun i ↦ conditioned_probability (ν i) (hpos i) + apply Measure.pi_eq + intro B hB + simp only [conditionedMeasure,Measure.smul_apply,smul_eq_mul] + rw [Measure.restrict_apply (MeasurableSet.univ_pi hB),←Set.pi_inter_distrib,Measure.pi_pi,Measure.pi_pi] + simp_rw [Measure.restrict_apply' (hS _)] + rw [Finset.prod_mul_distrib] + congr 1 + exact ENNReal.prod_inv_distrib (fun i _ j _ _ ↦ Or.inl (hpos i)) + +lemma condition_product_factorization (ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (ν i)] + (S : ∀i,Set (X i)) (hS : ∀i,MeasurableSet (S i)) (hpos : ∀i,ν i (S i)≠0) + (B : Set (∀i,X i)) (hB : MeasurableSet B) (hfull : (Measure.pi ν) (B∩univ.pi S)≠0) : + conditionedMeasure (Measure.pi ν) (B∩univ.pi S)= + conditionedMeasure (Measure.pi (fun i ↦ conditionedMeasure (ν i) (S i))) B := by + rw [pi_conditioned ν S hS hpos] + let μ := Measure.pi ν + have hz : μ (univ.pi S)≠0 := by + change (Measure.pi ν) (univ.pi S)≠0 + exact ne_of_gt ((pos_iff_ne_zero.mpr hfull).trans_le (measure_mono inter_subset_right)) + have hzinf : μ (univ.pi S)≠⊤ := measure_ne_top _ _ + unfold conditionedMeasure + rw [Measure.smul_apply,smul_eq_mul,Measure.restrict_apply hB,Measure.restrict_smul, + Measure.restrict_restrict hB,smul_smul] + congr 1 + rw [ENNReal.mul_inv (Or.inr (measure_ne_top _ _)) (Or.inl (ENNReal.inv_ne_top.mpr hz)),inv_inv] + change (μ (B∩univ.pi S))⁻¹=μ (univ.pi S)*(μ (B∩univ.pi S))⁻¹*(μ (univ.pi S))⁻¹ + rw [mul_comm (μ (univ.pi S)),mul_assoc,ENNReal.mul_inv_cancel hz hzinf,mul_one] + +end HardSphere.Comparison + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Comparison +variable {E I J : Type*} [MeasurableSpace E] [Fintype I] [Fintype J] +variable {X : I→Type*} [∀i,MeasurableSpace (X i)] + +lemma restrict_finite_partition {A : Type*} [MeasurableSpace A] (μ : Measure A) + (B : Set A) (F : J→Set A) (hF : ∀j,MeasurableSet (F j)) + (hdis : Pairwise (fun i j ↦ Disjoint (F i) (F j))) (hcover : (⋃j,F j)=univ) : + ∑ j,(μ.restrict (B∩F j))=μ.restrict B := by + have h := (μ.restrict B).restrict_iUnion hdis hF + rw [hcover,Measure.restrict_univ,Measure.sum_fintype] at h + rw [h] + apply Finset.sum_congr rfl + intro j _ + rw [Measure.restrict_restrict (hF j),inter_comm] + +lemma masked_exposure_reconstruct (μ : Measure E) [SFinite μ] + (ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (ν i)] + (p : J→I→Prop) [∀j,DecidablePred (p j)] + {B : Set (E×(∀i,X i))} (hB : MeasurableSet B) + (F : J→Set (E×(∀i,X i))) (hF : ∀j,MeasurableSet (F j)) + (hdis : Pairwise (fun i j ↦ Disjoint (F i) (F j))) (hcover : (⋃j,F j)=univ) + [∀j,SFinite (exposedLaw μ ν (p j) (B∩F j))] : + (∑j,((exposedLaw μ ν (p j) (B∩F j)).compProd + (fiberNormalize (Kernel.const _ (Measure.pi fun i : {i // p j i} ↦ ν i)) + (blockEvent (p j) (B∩F j)))).map (blockGlue (p j)))=(μ.prod (Measure.pi ν)).restrict B := by + simp_rw [exposed_block_reconstruct μ ν _ (hB.inter (hF _))] + exact restrict_finite_partition _ B F hF hdis hcover + +def flagEvent (f : ∀i,E×X i→Bool) (b : I→Bool) : Set (E×(∀i,X i)) := + {z | ∀i,f i (z.1,z.2 i)=b i} + +lemma flagEvent_measurable (f : ∀i,E×X i→Bool) (hf : ∀i,Measurable (f i)) (b : I→Bool) : + MeasurableSet (flagEvent f b) := by + have he : flagEvent f b=⋂i,{z : E×(∀i,X i) | f i (z.1,z.2 i)=b i} := by ext z; simp [flagEvent] + rw [he] + apply MeasurableSet.iInter + intro i + exact measurableSet_eq_fun ((hf i).comp (measurable_fst.prodMk ((measurable_pi_apply i).comp measurable_snd))) measurable_const + +omit [MeasurableSpace E] [Fintype I] [∀i,MeasurableSpace (X i)] in +lemma flagEvent_partition (f : ∀i,E×X i→Bool) : + Pairwise (fun b c ↦ Disjoint (flagEvent f b) (flagEvent f c)) ∧ (⋃b,flagEvent f b)=univ := by + constructor + · intro b c hbc + apply Set.disjoint_left.mpr + intro z hb hc + apply hbc + funext i + exact (hb i).symm.trans (hc i) + · apply eq_univ_of_forall + intro z + exact mem_iUnion.mpr ⟨fun i ↦ f i (z.1,z.2 i),fun _ ↦ rfl⟩ + +omit [MeasurableSpace E] [Fintype I] in +lemma blockGlue_inside (p : I→Prop) [DecidablePred p] + (w : E×(∀i : {i // ¬p i},X i)) (v : ∀i : {i // p i},X i) (i : {i // p i}) : + (blockGlue p (w,v)).2 i=v i := by + simp [blockGlue,MeasurableEquiv.piEquivPiSubtypeProd,Equiv.piEquivPiSubtypeProd,i.property] + +omit [MeasurableSpace E] [Fintype I] in +lemma blockGlue_outside (p : I→Prop) [DecidablePred p] + (w : E×(∀i : {i // ¬p i},X i)) (v : ∀i : {i // p i},X i) (i : {i // ¬p i}) : + (blockGlue p (w,v)).2 i=w.2 i := by + simp [blockGlue,MeasurableEquiv.piEquivPiSubtypeProd,Equiv.piEquivPiSubtypeProd,i.property] + +omit [MeasurableSpace E] [Fintype I] in +lemma blockGlue_fst (p : I→Prop) [DecidablePred p] + (w : E×(∀i : {i // ¬p i},X i)) (v : ∀i : {i // p i},X i) : + (blockGlue p (w,v)).1=w.1 := rfl + +omit [MeasurableSpace E] [Fintype I] in +lemma flag_fiber_iff (f : ∀i,E×X i→Bool) (b : I→Bool) + (p : I→Prop) [DecidablePred p] + (w : E×(∀i : {i // ¬p i},X i)) (v : ∀i : {i // p i},X i) : + blockGlue p (w,v)∈flagEvent f b ↔ + (∀i : {i // ¬p i},f i (w.1,w.2 i)=b i) ∧ + (∀i : {i // p i},f i (w.1,v i)=b i) := by + constructor + · intro h + constructor + · intro i + simpa only [blockGlue_fst,blockGlue_outside] using h i + · intro i + simpa only [blockGlue_fst,blockGlue_inside] using h i + · rintro ⟨hout,hin⟩ i + by_cases hi : p i + · simpa [blockGlue,MeasurableEquiv.piEquivPiSubtypeProd,Equiv.piEquivPiSubtypeProd,hi] using hin ⟨i,hi⟩ + · simpa [blockGlue,MeasurableEquiv.piEquivPiSubtypeProd,Equiv.piEquivPiSubtypeProd,hi] using hout ⟨i,hi⟩ + +end HardSphere.Comparison + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Conditioning/ReferenceResample.lean b/lean/OAI/Analysis/HardSphere/Conditioning/ReferenceResample.lean new file mode 100644 index 0000000000000000000000000000000000000000..c947f0796b220f1c691523560fbe516736721b75 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Conditioning/ReferenceResample.lean @@ -0,0 +1,240 @@ +import Mathlib +import OAI.Analysis.HardSphere.Collisions.PartialPhysicalLaw +import OAI.Analysis.HardSphere.Comparison.ExactFiberLikelihood +import OAI.Analysis.HardSphere.Comparison.IntegratedFiber +import OAI.Analysis.HardSphere.Comparison.LocalMoment + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +instance conditioned_finite {A : Type*} [MeasurableSpace A] (μ : Measure A) (S : Set A) : + IsFiniteMeasure (conditionedMeasure μ S) := by + constructor + simp only [conditionedMeasure,Measure.smul_apply,smul_eq_mul,Measure.restrict_apply_univ] + exact lt_of_le_of_lt (ENNReal.inv_mul_le_one _) (by norm_num) + +variable {I C : Type*} [Fintype I] [DecidableEq I] [Fintype C] + {X : I→Type*} [∀i,MeasurableSpace (X i)] + +omit [Fintype I] in +lemma lmarginal_updateFinset (μ : ∀i,Measure (X i)) (s : Finset I) + (f : (∀i,X i)→ℝ≥0∞) (x : ∀i,X i) (u : ∀i:s,X i) : + lmarginal μ s f (Function.updateFinset x s u)=lmarginal μ s f x := by + apply lmarginal_congr + intro i hi + simp [Function.updateFinset,hi] + +lemma reference_resample (checks : C→LocalCheck X) (μ : ∀i,Measure (X i)) + [∀i,IsProbabilityMeasure (μ i)] (s : Finset I) : + (insertedLaw checks μ s (Finset.univ\s) + (conditionedMeasure (Measure.pi μ) (retainedEvent checks Finset.univ))).map + (fun p ↦ Function.updateFinset p.1 s p.2)= + conditionedMeasure (Measure.pi μ) (retainedEvent checks Finset.univ) := by + let w := checkWeight checks Finset.univ + have hw : Measurable w := measurable_checkWeight checks _ + have hs : s∪(Finset.univ\s)=Finset.univ := Finset.union_sdiff_of_subset (Finset.subset_univ s) + let Z := (Measure.pi μ) (retainedEvent checks Finset.univ) + have integral_ref (F : (∀i,X i)→ℝ≥0∞) : + (∫⁻x,F x ∂conditionedMeasure (Measure.pi μ) (retainedEvent checks Finset.univ))= + Z⁻¹*∫⁻x,w x*F x ∂Measure.pi μ := by + rw [conditionedMeasure,lintegral_smul_measure,←lintegral_indicator (measurableSet_retainedEvent checks _)] + congr 1 + apply lintegral_congr + intro x + by_cases hx : x∈retainedEvent checks Finset.univ <;> simp [w,checkWeight,hx] + apply Measure.ext_of_lintegral + intro F hF + rw [lintegral_map hF measurable_updateFinset',insertedLaw, + Measure.lintegral_compProd (show Measurable (fun p : (∀i,X i)×(∀i:s,X i) ↦ F (Function.updateFinset p.1 s p.2)) from hF.comp (measurable_updateFinset' (s:=s)))] + have hkernel (x : ∀i,X i) : + (∫⁻u,F (Function.updateFinset x s u) ∂fiberNormalize + (Kernel.const _ (Measure.pi fun i:s ↦ μ i)) + (insertionFiberEvent checks s (Finset.univ\s)) x)= + (lmarginal μ s w x)⁻¹*lmarginal μ s (fun y ↦ w y*F y) x := by + have he : fiberNormalize (Kernel.const _ (Measure.pi fun i:s ↦ μ i)) + (insertionFiberEvent checks s (Finset.univ\s)) x= + referenceFiber checks μ s (Finset.univ\s) x := by + change (fiberRestrict _ _ x univ)⁻¹ • fiberRestrict _ _ x=_ + rw [fiberRestrict_apply _ (insertionFiberEvent_measurable checks s (Finset.univ\s))] + simp only [Kernel.const_apply,Measure.restrict_apply_univ,referenceFiber,conditionedMeasure] + rfl + rw [he,referenceFiber,fiber_lintegral] + simp only [hs,partialNormalizer] + congr 1 + apply lintegral_congr + intro u + exact mul_comm _ _ + simp_rw [hkernel] + rw [integral_ref,integral_ref] + congr 1 + have hA : Measurable (lmarginal μ s w) := hw.lmarginal μ + have hB : Measurable (lmarginal μ s (fun y ↦ w y*F y)) := (hw.mul hF).lmarginal μ + apply lintegral_eq_of_lmarginal_eq s (hw.mul (hA.inv.mul hB)) (hw.mul hF) + funext x + change lmarginal μ s (fun y ↦ w y*((lmarginal μ s w y)⁻¹*lmarginal μ s (fun z ↦ w z*F z) y)) x = lmarginal μ s (fun y ↦ w y*F y) x + have hfin : lmarginal μ s w x≠⊤ := by + apply ne_top_of_le_ne_top ENNReal.one_ne_top + exact (lmarginal_mono (checkWeight_le_one checks _) x).trans_eq (by simp [lmarginal]) + have he : (fun u : ∀i:s,X i ↦ w (Function.updateFinset x s u)* + ((lmarginal μ s w (Function.updateFinset x s u))⁻¹* + lmarginal μ s (fun y ↦ w y*F y) (Function.updateFinset x s u)))= + (fun u ↦ w (Function.updateFinset x s u)*((lmarginal μ s w x)⁻¹* + lmarginal μ s (fun y ↦ w y*F y) x)) := by + funext u + simp only [lmarginal_updateFinset] + change (∫⁻u,w (Function.updateFinset x s u)* + ((lmarginal μ s w (Function.updateFinset x s u))⁻¹* + lmarginal μ s (fun y ↦ w y*F y) (Function.updateFinset x s u)) + ∂Measure.pi (fun i:s ↦ μ i))=_ + rw [he,lintegral_mul_const _ ((show Measurable (fun u : ∀i:s,X i ↦ w (Function.updateFinset x s u)) from hw.comp (measurable_updateFinset (s:=s) (x:=x))))] + change lmarginal μ s w x*((lmarginal μ s w x)⁻¹*lmarginal μ s (fun y ↦ w y*F y) x)=_ + by_cases hz : lmarginal μ s w x=0 + · have hwz : ∀ᵐu ∂Measure.pi (fun i:s ↦ μ i), w (Function.updateFinset x s u)=0 := + (lintegral_eq_zero_iff' ((show Measurable (fun u : ∀i:s,X i ↦ w (Function.updateFinset x s u)) from hw.comp (measurable_updateFinset (s:=s) (x:=x)))).aemeasurable).mp hz + have hb : lmarginal μ s (fun y ↦ w y*F y) x=0 := + lintegral_eq_zero_of_ae_eq_zero (hwz.mono fun u hu ↦ by simp [hu]) + rw [hz,hb,mul_zero,mul_zero] + · rw [←mul_assoc,ENNReal.mul_inv_cancel hz hfin,one_mul] + +lemma reference_fiber_positive (checks : C→LocalCheck X) (μ : ∀i,Measure (X i)) + [∀i,IsProbabilityMeasure (μ i)] (s : Finset I) : + ∀ᵐx ∂conditionedMeasure (Measure.pi μ) (retainedEvent checks Finset.univ), + 0 rw [← (reverse_freePath_preserving N L t).map_eq] + rw [Measure.restrict_map (reverseConfigurationPath_continuous N L).measurable + (staysAllowed_open N L a).measurableSet, staysAllowed_reverse] + +def reversePathEquiv (N : ℕ) (L : Length) : ConfigurationPath N L ≃ᵐ ConfigurationPath N L where + toFun := reverseConfigurationPath N L + invFun := reverseConfigurationPath N L + left_inv := reverseConfigurationPath_reverse N L + right_inv := reverseConfigurationPath_reverse N L + measurable_toFun := (reverseConfigurationPath_continuous N L).measurable + measurable_invFun := (reverseConfigurationPath_continuous N L).measurable + +lemma killedTransition_selfAdjoint (N : ℕ) (L : Length) (a t : ℝ) : + IsSelfAdjoint (killedTransition N L a t) := by + apply ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mpr + intro f g + change inner ℂ (killedTransition N L a t f) g = inner ℂ f (killedTransition N L a t g) + rw [← inner_conj_symm, killedTransition_pairing, ← integral_conj, killedTransition_pairing] + have h := (reverse_killedPath_preserving N L a t).integral_comp + (reversePathEquiv N L).measurableEmbedding + (fun ω : ConfigurationPath N L ↦ conj (f (ω 0)) * g (ω 1)) + rw [← h] + apply integral_congr_ae + filter_upwards [] with ω + simp only [map_mul,starRingEnd_self_apply,reverseConfigurationPath_apply,reverseTime_zero, + reverseTime_one] + ring + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Conditioning/RouteMatches.lean b/lean/OAI/Analysis/HardSphere/Conditioning/RouteMatches.lean new file mode 100644 index 0000000000000000000000000000000000000000..14dc09fa16ab2000736b62fbced21327c72d1498 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Conditioning/RouteMatches.lean @@ -0,0 +1,159 @@ +import Mathlib +import OAI.Analysis.HardSphere.Comparison.PartialLabelMoment +import OAI.Analysis.HardSphere.Geometry.PathSlots + +namespace OAI + +section + +section +noncomputable section +open scoped Classical +namespace HardSphere.Comparison +open _root_.OAI.HardSphere.Lattice MeasureTheory ProbabilityTheory +variable {K : ℕ} {x y : DiscreteTorus K} {J : Type*} [DecidableEq J] + +def departureSites (p : SimplePath x y) : Finset (DiscreteTorus K) := + Finset.univ.image (fun i : Fin p.val.length ↦ pathVertexEmbedding p i.castSucc) + +def matchingSites (p q : SimplePath x y) (f g : DiscreteTorus K→J) : Finset (DiscreteTorus K) := + (departureSites p∩departureSites q).filter (fun v ↦ f v=g v) + +lemma routeSlots_inter_card {d e : ℕ} (f : Fin d↪J) (g : Fin e↪J) : + (routeSlots f∩routeSlots g).card=1+((Finset.univ.image f)∩(Finset.univ.image g)).card := by + have he : routeSlots f∩routeSlots g=insert none + ((((Finset.univ.image f)∩(Finset.univ.image g))).image some) := by + ext j + cases j <;> simp [routeSlots_exact] + rw [he,Finset.card_insert_of_notMem (by simp)] + rw [Finset.card_image_of_injective _ (Option.some_injective _),Nat.add_comm] + +lemma matched_labels_bound (p q : SimplePath x y) (anchor : J→DiscreteTorus K) + (f g : DiscreteTorus K→J) + (hf : ∀v∈departureSites p,anchor (f v)=v) + (hg : ∀v∈departureSites q,anchor (g v)=v) : + ((Finset.univ.image (fun i : Fin p.val.length ↦ f (pathVertexEmbedding p i.castSucc)))∩ + (Finset.univ.image (fun i : Fin q.val.length ↦ g (pathVertexEmbedding q i.castSucc)))).card≤ + (matchingSites p q f g).card := by + let s := (Finset.univ.image (fun i : Fin p.val.length ↦ f (pathVertexEmbedding p i.castSucc)))∩ + (Finset.univ.image (fun i : Fin q.val.length ↦ g (pathVertexEmbedding q i.castSucc))) + have hip (i : Fin p.val.length) : pathVertexEmbedding p i.castSucc∈departureSites p := + Finset.mem_image_of_mem _ (Finset.mem_univ i) + have hiq (i : Fin q.val.length) : pathVertexEmbedding q i.castSucc∈departureSites q := + Finset.mem_image_of_mem _ (Finset.mem_univ i) + have hin : Set.InjOn anchor (s : Set J) := by + intro a ha b hb hab + obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp (Finset.mem_inter.mp ha).1 + obtain ⟨j,_,rfl⟩ := Finset.mem_image.mp (Finset.mem_inter.mp hb).1 + rw [hf _ (hip i),hf _ (hip j)] at hab + exact congrArg f hab + rw [←Finset.card_image_of_injOn hin] + apply Finset.card_le_card + intro v hv + obtain ⟨a,ha,rfl⟩ := Finset.mem_image.mp hv + obtain ⟨i,_,hi⟩ := Finset.mem_image.mp (Finset.mem_inter.mp ha).1 + obtain ⟨j,_,hj⟩ := Finset.mem_image.mp (Finset.mem_inter.mp ha).2 + have hia : anchor a=pathVertexEmbedding p i.castSucc := by rw [←hi,hf _ (hip i)] + have hja : anchor a=pathVertexEmbedding q j.castSucc := by rw [←hj,hg _ (hiq j)] + refine Finset.mem_filter.mpr ⟨Finset.mem_inter.mpr ⟨hia.symm ▸ hip i,hja.symm ▸ hiq j⟩,?_⟩ + calc + f (anchor a) = a := by rw [hia,hi] + _ = g (anchor a) := by rw [hja,hj] + +lemma route_shared_count_bound (p q : SimplePath x y) (anchor : J→DiscreteTorus K) + (f g : DiscreteTorus K→J) + (hf : ∀v∈departureSites p,anchor (f v)=v) + (hg : ∀v∈departureSites q,anchor (g v)=v) : + (routeSlots (departureEmbedding p anchor (fun i ↦ f (pathVertexEmbedding p i.castSucc)) + (fun i ↦ hf _ (Finset.mem_image_of_mem _ (Finset.mem_univ i))))∩ + routeSlots (departureEmbedding q anchor (fun i ↦ g (pathVertexEmbedding q i.castSucc)) + (fun i ↦ hg _ (Finset.mem_image_of_mem _ (Finset.mem_univ i))))).card≤ + 1+(matchingSites p q f g).card := by + rw [routeSlots_inter_card] + exact Nat.add_le_add_left (matched_labels_bound p q anchor f g hf hg) 1 + +end HardSphere.Comparison + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped BigOperators ENNReal Classical +namespace HardSphere.Comparison +open _root_.OAI.HardSphere.Lattice +variable {K : ℕ} {x y : DiscreteTorus K} {J : Type*} [DecidableEq J] + +lemma departureSites_subset (p : SimplePath x y) : departureSites p⊆p.val.support.toFinset := by + intro v hv + obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp hv + exact List.mem_toFinset.mpr (p.val.getVert_mem_support i.castSucc.val) + +lemma shared_departures_le_encounters (R : ℕ) (p q : SimplePath x y) : + (departureSites p∩departureSites q).card ≤ simpleEncounter R p q := by + let s := departureSites p∩departureSites q + have hi : Function.Injective (fun v : DiscreteTorus K ↦ (v,v)) := by + intro a b h;exact congrArg Prod.fst h + have hs : s.image (fun v ↦ (v,v))⊆encounterSet (torusNear K R) + p.val.support.toFinset q.val.support.toFinset := by + intro v hv + obtain ⟨a,ha,rfl⟩ := Finset.mem_image.mp hv + refine (mem_encounterSet _ _ _ _ _).mpr ⟨departureSites_subset p (Finset.mem_inter.mp ha).1, + departureSites_subset q (Finset.mem_inter.mp ha).2,?_⟩ + exact torusNear_refl K R a + have hc := Finset.card_le_card hs + rw [Finset.card_image_of_injective _ hi] at hc + exact hc + +lemma route_label_integral [NeZero K] (p q : SimplePath x y) (anchor : J→DiscreteTorus K) + (A : DiscreteTorus K→Type*) [∀v,Fintype (A v)] [∀v,Nonempty (A v)] + [∀v,DecidableEq (A v)] [∀v,MeasurableSpace (A v)] [∀v,MeasurableSingletonClass (A v)] + (decode : ∀v,A v→J) + (hd : ∀v∈departureSites p∩departureSites q,Function.Injective (decode v)) + (ha : ∀v∈departureSites p∪departureSites q,∀a,anchor (decode v a)=v) + (G M : ℝ) (hG : 1≤G) (hM : 0 by_cases hj : j.val simp + | succ k ih => + by_cases hkb : k+1≤b + · have hk : k≤n := by omega + have hkn' : k simp_all + exact (Finset.card_le_card hin).trans (Finset.card_insert_le _ _) + exact hcard.trans (by omega) + +end HardSphere.Comparison + +end +end + +section +noncomputable section +open scoped Classical +namespace HardSphere.Comparison +open HardSphere.Lattice +variable {K : ℕ} {x y : DiscreteTorus K} {J : Type*} +lemma routeSlots_start_sites (p : SimplePath x y) (anchor : J→DiscreteTorus K) + (pick : Fin p.val.length→J) + (hpick : ∀i,anchor (pick i)=pathVertexEmbedding p i.castSucc) : + (routeSlots (departureEmbedding p anchor pick hpick)).image (extendedAnchor anchor x)⊆p.val.support.toFinset := by + intro v hv + obtain ⟨a,ha,rfl⟩ := Finset.mem_image.mp hv + rw [routeSlots_exact] at ha + rcases Finset.mem_insert.mp ha with rfl|ha + · exact List.mem_toFinset.mpr p.val.start_mem_support + · obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp ha + change anchor (pick i)∈_ + rw [hpick i] + exact List.mem_toFinset.mpr (p.val.getVert_mem_support i.val) + +lemma second_primary_nearSlots_bound (R : ℕ) (p q : SimplePath x y) (anchor : J→DiscreteTorus K) + (f : Fin p.val.length→J) (g : Fin q.val.length→J) + (hf : ∀i,anchor (f i)=pathVertexEmbedding p i.castSucc) + (hg : ∀i,anchor (g i)=pathVertexEmbedding q i.castSucc) : + (nearSlots (torusNear K R) (extendedAnchor anchor x) + (routeSlots (departureEmbedding p anchor f hf)) (routeSlots (departureEmbedding q anchor g hg))).card≤ + 2*simpleEncounter R p q := by + have h := nearSlots_card_of_fiber (torusNear K R) (extendedAnchor anchor x) + (routeSlots (departureEmbedding p anchor f hf)) (routeSlots (departureEmbedding q anchor g hg)) + 2 (routeSlots_start_fiber p anchor f hf) + apply h.trans + apply Nat.mul_le_mul_left + apply Finset.card_le_card + intro v hv + obtain ⟨ha,hb,he⟩ := (mem_encounterSet _ _ _ _ _).mp hv + exact (mem_encounterSet _ _ _ _ _).mpr + ⟨routeSlots_start_sites p anchor f hf ha,routeSlots_start_sites q anchor g hg hb,he⟩ + +end HardSphere.Comparison + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Conditioning/SupportedPair.lean b/lean/OAI/Analysis/HardSphere/Conditioning/SupportedPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ad6f6dde7803ecb03956f677f8f423457a83312 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Conditioning/SupportedPair.lean @@ -0,0 +1,105 @@ +import Mathlib + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] + +def supportedPair (ρ : Measure (X×Y)) (S : Set X) (T : Set Y) : Measure (S×T) := + ρ.comap (Prod.map Subtype.val Subtype.val) + +lemma supportedPair_map (ρ : Measure (X×Y)) {S : Set X} {T : Set Y} + (hS : MeasurableSet S) (hT : MeasurableSet T) (hρ : ∀ᵐp ∂ρ,p.1∈S ∧ p.2∈T) : + (supportedPair ρ S T).map (Prod.map Subtype.val Subtype.val)=ρ := by + rw [supportedPair,((MeasurableEmbedding.subtype_coe hS).prodMap + (MeasurableEmbedding.subtype_coe hT)).map_comap] + apply Measure.restrict_eq_self_of_ae_mem + filter_upwards [hρ] with p hp + exact ⟨(⟨p.1,hp.1⟩,⟨p.2,hp.2⟩),rfl⟩ + +lemma supportedPair_probability (ρ : Measure (X×Y)) [IsProbabilityMeasure ρ] + {S : Set X} {T : Set Y} (hS : MeasurableSet S) (hT : MeasurableSet T) + (hρ : ∀ᵐp ∂ρ,p.1∈S ∧ p.2∈T) : IsProbabilityMeasure (supportedPair ρ S T) := by + constructor + have h := congrArg (fun μ : Measure (X×Y) ↦ μ univ) (supportedPair_map ρ hS hT hρ) + simpa only [Measure.map_apply (by fun_prop : Measurable (Prod.map (Subtype.val:S→X) (Subtype.val:T→Y))) + MeasurableSet.univ,preimage_univ,measure_univ] using h + +lemma map_le_reflect {A B : Type*} [MeasurableSpace A] [MeasurableSpace B] + {f : A→B} (hf : MeasurableEmbedding f) {μ ν : Measure A} + (h : μ.map f≤ν.map f) : μ≤ν := by + apply Measure.le_iff.mpr + intro C hC + have hh := h (f '' C) + simpa only [hf.map_apply,hf.injective.preimage_image] using hh + +lemma supportedPair_fst (ρ : Measure (X×Y)) {S : Set X} {T : Set Y} + (hS : MeasurableSet S) (hT : MeasurableSet T) (hρ : ∀ᵐp ∂ρ,p.1∈S ∧ p.2∈T) : + (supportedPair ρ S T).fst.map Subtype.val=ρ.fst := by + have h := congrArg (fun μ : Measure (X×Y) ↦ μ.fst) (supportedPair_map ρ hS hT hρ) + rw [Measure.fst,Measure.map_map measurable_fst (by fun_prop)] at h + rw [Measure.fst,Measure.map_map measurable_subtype_coe measurable_fst] + exact h + +lemma supportedPair_snd (ρ : Measure (X×Y)) {S : Set X} {T : Set Y} + (hS : MeasurableSet S) (hT : MeasurableSet T) (hρ : ∀ᵐp ∂ρ,p.1∈S ∧ p.2∈T) : + (supportedPair ρ S T).snd.map Subtype.val=ρ.snd := by + have h := congrArg (fun μ : Measure (X×Y) ↦ μ.snd) (supportedPair_map ρ hS hT hρ) + rw [Measure.snd,Measure.map_map measurable_snd (by fun_prop)] at h + rw [Measure.snd,Measure.map_map measurable_subtype_coe measurable_snd] + exact h + +lemma supportedPair_fst_le (ρ : Measure (X×Y)) {S : Set X} {T : Set Y} + (hS : MeasurableSet S) (hT : MeasurableSet T) (hρ : ∀ᵐp ∂ρ,p.1∈S ∧ p.2∈T) + (P : Measure S) {G : ℝ≥0∞} (hP : ρ.fst≤G • P.map Subtype.val) : + (supportedPair ρ S T).fst≤G • P := by + apply map_le_reflect (MeasurableEmbedding.subtype_coe hS) + rw [supportedPair_fst ρ hS hT hρ,Measure.map_smul _ measurable_subtype_coe.aemeasurable] + exact hP + +lemma supportedPair_snd_le (ρ : Measure (X×Y)) {S : Set X} {T : Set Y} + (hS : MeasurableSet S) (hT : MeasurableSet T) (hρ : ∀ᵐp ∂ρ,p.1∈S ∧ p.2∈T) + (P : Measure T) {G : ℝ≥0∞} (hP : ρ.snd≤G • P.map Subtype.val) : + (supportedPair ρ S T).snd≤G • P := by + apply map_le_reflect (MeasurableEmbedding.subtype_coe hT) + rw [supportedPair_snd ρ hS hT hρ,Measure.map_smul _ measurable_subtype_coe.aemeasurable] + exact hP + +lemma supported_of_marginals (ρ : Measure (X×Y)) {S : Set X} {T : Set Y} + (hS : MeasurableSet S) (hT : MeasurableSet T) (P : Measure S) (Q : Measure T) + {G H : ℝ≥0∞} (hP : ρ.fst≤G • P.map Subtype.val) (hQ : ρ.snd≤H • Q.map Subtype.val) : + ∀ᵐp ∂ρ,p.1∈S ∧ p.2∈T := by + have hp0 : (P.map Subtype.val) Sᶜ=0 := by + rw [Measure.map_apply measurable_subtype_coe hS.compl] + have he : (Subtype.val:S→X) ⁻¹' Sᶜ=∅ := by ext x; simp only [mem_preimage,mem_compl_iff,x.property,not_true,mem_empty_iff_false] + rw [he,measure_empty] + have hq0 : (Q.map Subtype.val) Tᶜ=0 := by + rw [Measure.map_apply measurable_subtype_coe hT.compl] + have he : (Subtype.val:T→Y) ⁻¹' Tᶜ=∅ := by ext x; simp only [mem_preimage,mem_compl_iff,x.property,not_true,mem_empty_iff_false] + rw [he,measure_empty] + have hpa : ∀ᵐx ∂ρ.fst,x∈S := by + rw [ae_iff] + change ρ.fst Sᶜ=0 + exact le_antisymm (by simpa only [Measure.smul_apply,smul_eq_mul,hp0,mul_zero] using hP Sᶜ) bot_le + have hqa : ∀ᵐy ∂ρ.snd,y∈T := by + rw [ae_iff] + change ρ.snd Tᶜ=0 + exact le_antisymm (by simpa only [Measure.smul_apply,smul_eq_mul,hq0,mul_zero] using hQ Tᶜ) bot_le + have hp' : ∀ᵐp ∂ρ,p.1∈S := (ae_map_iff measurable_fst.aemeasurable hS).mp hpa + have hq' : ∀ᵐp ∂ρ,p.2∈T := (ae_map_iff measurable_snd.aemeasurable hT).mp hqa + exact hp'.and hq' + +end HardSphere.Comparison + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Conditioning/SymmetricTag.lean b/lean/OAI/Analysis/HardSphere/Conditioning/SymmetricTag.lean new file mode 100644 index 0000000000000000000000000000000000000000..03076aaed5dcaf67c14e6c37590e619070d6bfa6 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Conditioning/SymmetricTag.lean @@ -0,0 +1,187 @@ +import Mathlib +import OAI.Analysis.HardSphere.Comparison.IntegratedFiber +import OAI.Analysis.HardSphere.Conditioning.BathPhase +import OAI.Analysis.HardSphere.Allocation.TaggedReference + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set Filter +open scoped ENNReal BigOperators +namespace HardSphere.Comparison +variable {n : ℕ} {E : Type*} [MeasurableSpace E] +local instance permSpace (n : ℕ) : MeasurableSpace (Equiv.Perm (Fin n)) := ⊤ +local instance permSingleton (n : ℕ) : MeasurableSingletonClass (Equiv.Perm (Fin n)) := ⟨fun _ ↦ trivial⟩ + +def tagOrderPerm (i : Fin (n+1)) (τ : Equiv.Perm (Fin n)) : Equiv.Perm (Fin (n+1)) := + (finSuccEquiv' 0).trans ((Equiv.optionCongr τ).trans (finSuccEquiv' i).symm) +@[simp] lemma tagOrderPerm_zero (i : Fin (n+1)) (τ : Equiv.Perm (Fin n)) : + tagOrderPerm i τ 0=i := by simp [tagOrderPerm] +@[simp] lemma tagOrderPerm_succ (i : Fin (n+1)) (τ : Equiv.Perm (Fin n)) (j : Fin n) : + tagOrderPerm i τ j.succ=i.succAbove (τ j) := by + change (finSuccEquiv' i).symm ((Equiv.optionCongr τ) ((finSuccEquiv' 0) j.succ))=_ + have hh : (finSuccEquiv' (0:Fin (n+1))) j.succ=some j := by + simpa only [Fin.succAbove_zero] using finSuccEquiv'_succAbove (0:Fin (n+1)) j + simp [hh] + +def splitFirst (x : Fin (n+1)→E) : E×(Fin n→E) := (x 0,fun j ↦ x j.succ) +lemma splitFirst_measurable : Measurable (splitFirst (E:=E) (n:=n)) := by + unfold splitFirst + fun_prop + +def orderedObservation (i : Fin (n+1)) (p : (Fin (n+1)→E)×Equiv.Perm (Fin n)) : E×(Fin n→E) := + (p.1 i,fun j ↦ p.1 (i.succAbove (p.2 j))) +lemma orderedObservation_measurable (i : Fin (n+1)) : Measurable (orderedObservation (E:=E) i) := by + unfold orderedObservation + have he (j : Fin n) : Measurable (fun p : (Fin (n+1)→E)×Equiv.Perm (Fin n) ↦ p.1 (i.succAbove (p.2 j))) := by + exact measurable_from_prod_countable_left (fun τ ↦ show Measurable (fun x : Fin (n+1)→E ↦ x (i.succAbove (τ j))) from measurable_pi_apply _) + exact ((measurable_pi_apply i).comp measurable_fst).prodMk (Measurable.of_eval he) + +omit [MeasurableSpace E] in +lemma orderedObservation_eq (i : Fin (n+1)) (x : Fin (n+1)→E) (τ : Equiv.Perm (Fin n)) : + orderedObservation i (x,τ)=splitFirst (fun j ↦ x (tagOrderPerm i τ j)) := by + simp [orderedObservation,splitFirst] + +lemma ordered_symmetric_law (μ : Measure (Fin (n+1)→E)) [SFinite μ] + (hμ : ∀σ : Equiv.Perm (Fin (n+1)),MeasurePreserving (fun x j ↦ x (σ j)) μ μ) + (β : Measure (Equiv.Perm (Fin n))) [IsProbabilityMeasure β] (i : Fin (n+1)) : + (μ.prod β).map (orderedObservation i)=μ.map splitFirst := by + ext s hs + rw [Measure.map_apply (orderedObservation_measurable i) hs,Measure.map_apply splitFirst_measurable hs] + rw [Measure.prod_apply_symm ((orderedObservation_measurable i) hs)] + have hh (τ : Equiv.Perm (Fin n)) : μ ((fun x : Fin (n+1)→E ↦ (x,τ)) ⁻¹' (orderedObservation i ⁻¹' s))=μ (splitFirst ⁻¹' s) := by + have he : ((fun x : Fin (n+1)→E ↦ (x,τ)) ⁻¹' (orderedObservation i ⁻¹' s))= + (fun x j ↦ x (tagOrderPerm i τ j)) ⁻¹' (splitFirst ⁻¹' s) := by + ext x + simp only [Set.mem_preimage,orderedObservation_eq] + rw [he] + exact (hμ (tagOrderPerm i τ)).measure_preimage ((splitFirst_measurable hs).nullMeasurableSet) + simp_rw [hh] + simp + +lemma ground_ordered_law {L : Length} (u : Jet (n+1) L) (hb : bosonic u.1) (hu : ‖u.1‖=1) + (β : Measure (Equiv.Perm (Fin n))) [IsProbabilityMeasure β] (i : Fin (n+1)) : + ((groundPositionLaw (n+1) L u).prod β).map (orderedObservation i)= + (groundPositionLaw (n+1) L u).map splitFirst := by + let := groundPositionLaw_probability u hu + apply ordered_symmetric_law + intro σ + exact groundPositionLaw_permute u hb σ +lemma ground_first_density {L : Length} (u : Jet (n+1) L) : + (groundPositionLaw (n+1) L u).map splitFirst= + ((volume : Measure (Torus L)).prod volume).withDensity + (fun p : Torus L×Configuration n L ↦ ENNReal.ofReal (‖u.1 (Fin.cons p.1 p.2)‖^2)) := by + let c : Torus L×Configuration n L → Configuration (n+1) L := fun p ↦ Fin.cons p.1 p.2 + have hc : Measurable c := by unfold c; fun_prop + have hcP : MeasurePreserving c ((volume : Measure (Torus L)).prod volume) volume := + (cons_preserving L).comp Measure.measurePreserving_swap + let g : Configuration (n+1) L→ℝ≥0∞ := fun X ↦ ENNReal.ofReal (‖u.1 X‖^2) + have hg : Measurable g := ((Lp.stronglyMeasurable u.1).measurable.norm.pow_const 2).ennreal_ofReal + have he := map_density_comp ((volume : Measure (Torus L)).prod volume) c hc g hg + rw [hcP.map_eq] at he + change _=groundPositionLaw (n+1) L u at he + rw [←he,Measure.map_map splitFirst_measurable hc] + have hid : splitFirst ∘ c=id := by + funext p + simp [c,splitFirst] + rw [hid,Measure.map_id] + rfl + +def orderedKernel (β : Measure (Equiv.Perm (Fin n))) (i : Fin (n+1)) : + Kernel (Fin (n+1)→E) (E×(Fin n→E)) := + (Kernel.id ×ₖ Kernel.const _ β).map (orderedObservation i) +instance orderedKernel_markov (β : Measure (Equiv.Perm (Fin n))) [IsProbabilityMeasure β] + (i : Fin (n+1)) : IsMarkovKernel (orderedKernel (E:=E) β i) := + Kernel.IsMarkovKernel.map _ (orderedObservation_measurable i) +lemma orderedKernel_comp (μ : Measure (Fin (n+1)→E)) [SFinite μ] + (β : Measure (Equiv.Perm (Fin n))) [IsProbabilityMeasure β] (i : Fin (n+1)) : + orderedKernel β i ∘ₘ μ=(μ.prod β).map (orderedObservation i) := by + unfold orderedKernel + rw [←Measure.map_comp _ _ (orderedObservation_measurable i),←Measure.compProd_eq_comp_prod, + Measure.compProd_const] + +lemma ground_ordered_bind {L : Length} (u : Jet (n+1) L) (hb : bosonic u.1) (hu : ‖u.1‖=1) + (β : Measure (Equiv.Perm (Fin n))) [IsProbabilityMeasure β] (i : Fin (n+1)) : + orderedKernel β i ∘ₘ groundPositionLaw (n+1) L u= + ((volume : Measure (Torus L)).prod volume).withDensity + (fun p : Torus L×Configuration n L ↦ ENNReal.ofReal (‖u.1 (Fin.cons p.1 p.2)‖^2)) := by + let := groundPositionLaw_probability u hu + rw [orderedKernel_comp,ground_ordered_law u hb hu,ground_first_density] + +lemma all_tags_reference {L : Length} {Y : Type*} [MeasurableSpace Y] + (u : Jet (n+1) L) (hb : bosonic u.1) (hu : ‖u.1‖=1) + (β : Measure (Equiv.Perm (Fin n))) [IsProbabilityMeasure β] + (post : Kernel (Torus L×Configuration n L) Y) : + (∑i : Fin (n+1),(post ∘ₖ orderedKernel β i) ∘ₘ groundPositionLaw (n+1) L u)= + (n+1) • (post ∘ₘ (((volume : Measure (Torus L)).prod volume).withDensity + (fun p : Torus L×Configuration n L ↦ ENNReal.ofReal (‖u.1 (Fin.cons p.1 p.2)‖^2)))) := by + simp_rw [←Measure.comp_assoc,ground_ordered_bind u hb hu β] + simp + +end HardSphere.Comparison + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +attribute [local instance] HardSphere.Comparison.permSpace HardSphere.Comparison.permSingleton +namespace HardSphere.Comparison +variable {A B C : Type*} [MeasurableSpace A] [MeasurableSpace B] [MeasurableSpace C] + +lemma comp_comap_map (μ : Measure A) (f : A→B) (hf : Measurable f) (κ : Kernel B C) : + κ.comap f hf ∘ₘ μ=κ ∘ₘ μ.map f := by + rw [←Kernel.comp_deterministic_eq_comap,←Measure.comp_assoc,Measure.deterministic_comp_eq_map] + +lemma allocation_slice_law {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : IsGroundVector N L a u) (T : ℝ) (hT : 0≤T) (q : Wiener.Time) + {Z : Type*} [MeasurableSpace Z] + (κ : Kernel (ConfigurationPath N L) Z) [IsMarkovKernel κ] : + ((groundPathLaw N L a T u) ⊗ₘ κ).map + (fun p : ConfigurationPath N L×Z ↦ p.1 q)=groundPositionLaw N L u := by + let := hu.groundPathLaw_probability hT + have he : (fun p : ConfigurationPath N L×Z ↦ p.1 q)= + (fun ω : ConfigurationPath N L ↦ ω q) ∘ Prod.fst := rfl + rw [he,←Measure.map_map (continuous_eval_const q).measurable measurable_fst] + change ((groundPathLaw N L a T u ⊗ₘ κ).fst).map _=_ + rw [Measure.fst_compProd] + exact (hu.groundPathLaw_marginal T hT q).map_eq + +end HardSphere.Comparison + +namespace HardSphere.Groups +open Sampling Wiener PathCutoff Comparison + +lemma physical_group_tag_reference {n K M G : ℕ} {L : Length} {a : ℝ} + {u : Jet (n+1) L} (hu : IsGroundVector (n+1) L a u) + (hL : L.val=(K:ℝ)) (hK : 1≤K) (m : ℕ) (r R C S s₀ T : ℝ) + (hT : 0≤T) (q : Time) + {Y : Type*} [MeasurableSpace Y] + (β : Measure (Equiv.Perm (Fin n))) [IsProbabilityMeasure β] + (post : Kernel (Torus L×Configuration n L) Y) : + let Q := groundPathLaw (n+1) L a T u ⊗ₘ + physicalAllocationKernel (N:=n+1) (K:=K) m (M*G) r R C S s₀ q + let read := fun i : Fin (n+1) ↦ (post ∘ₖ orderedKernel β i).comap + (fun p : ConfigurationPath (n+1) L×((Fin 3→Fin K)→Allocation (M*G) (Fin (n+1))) ↦ p.1 q) + ((continuous_eval_const q).measurable.comp measurable_fst) + (∑g : Fin G,allocatedTagLaw Q (allocatedPhysicalGroup m r R C S s₀ q) read g)≤ + (n+1) • (post ∘ₘ (((volume : Measure (Torus L)).prod volume).withDensity + (fun p : Torus L×Configuration n L ↦ ENNReal.ofReal (‖u.1 (Fin.cons p.1 p.2)‖^2)))) := by + dsimp only + refine (allocatedPhysicalTag_sum_le hL hK m r R C S s₀ q _ _).trans ?_ + simp_rw [comp_comap_map,allocation_slice_law hu T hT q] + exact le_of_eq (all_tags_reference u hu.2.1 hu.2.2.1 β post) + +end HardSphere.Groups + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Conditioning/TagPushforward.lean b/lean/OAI/Analysis/HardSphere/Conditioning/TagPushforward.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c8b66f453c68968ed68adedb9bb8caa316033a9 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Conditioning/TagPushforward.lean @@ -0,0 +1,50 @@ +import Mathlib +import OAI.Analysis.HardSphere.Comparison.TaggedMoment + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Comparison +variable {I X Y Z : Type*} [Fintype I] [MeasurableSpace I] [MeasurableSingletonClass I] + [MeasurableSpace X] [MeasurableSpace Y] [MeasurableSpace Z] + +lemma taggedReference_comp (P : Measure X) [SFinite P] (E : I→Set X) + (hE : ∀i,MeasurableSet (E i)) (κ : Kernel (I×X) Y) : + κ ∘ₘ taggedReference P E = + ∑i,(κ.comap (Prod.mk i) measurable_prodMk_left) ∘ₘ P.restrict (E i) := by + classical + apply Measure.ext + intro s hs + rw [Measure.bind_apply hs κ.aemeasurable] + simp only [Measure.finsetSum_apply,Measure.bind_apply hs (κ.comap _ _).aemeasurable, + Kernel.comap_apply] + unfold taggedReference + rw [←lintegral_indicator (taggedEvent_measurable E hE),lintegral_prod _ + (((κ.measurable_coe hs).indicator (taggedEvent_measurable E hE)).aemeasurable), + lintegral_count,tsum_fintype] + apply Finset.sum_congr rfl + intro i _ + rw [←lintegral_indicator (hE i)] + rfl + +lemma taggedReference_map (P : Measure X) [SFinite P] (f : X→Y) (hf : Measurable f) + (E : I→Set Y) (hE : ∀i,MeasurableSet (E i)) : + (taggedReference P (fun i ↦ f ⁻¹' E i)).map (Prod.map id f)= + taggedReference (P.map f) E := by + unfold taggedReference + have he : {p : I×X | p.2∈f ⁻¹' E p.1}= + (Prod.map id f) ⁻¹' {p : I×Y | p.2∈E p.1} := rfl + rw [he,←Measure.restrict_map (measurable_id.prodMap hf) (taggedEvent_measurable E hE)] + have H := Measure.map_prod_map (Measure.count (α:=I)) P measurable_id hf + rw [Measure.map_id] at H + rw [←H] + +end HardSphere.Comparison +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Conditioning/UnitPairCount.lean b/lean/OAI/Analysis/HardSphere/Conditioning/UnitPairCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..846d3163a115a3c624bbf5ff8c147ca391922ead --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Conditioning/UnitPairCount.lean @@ -0,0 +1,183 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.UnitCenter + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter SphericalCoordinates +open scoped ENNReal + +def unitPairCount {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (p : Fin n → Prop) [DecidablePred p] (v : CubeCell K) (X : Configuration n L) : ℝ := + (unitOccupation hL p v X:ℝ)*((unitOccupation hL p v X:ℝ)-1) + +lemma unitPairCount_nonneg {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (p : Fin n → Prop) [DecidablePred p] (v : CubeCell K) (X : Configuration n L) : + 0≤unitPairCount hL p v X := by + unfold unitPairCount + by_cases h : unitOccupation hL p v X=0 + · simp only [h,Nat.cast_zero,zero_mul,le_refl] + · have hp : (1:ℝ)≤unitOccupation hL p v X := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr h + exact mul_nonneg (Nat.cast_nonneg _) (sub_nonneg.mpr hp) + +lemma unitPairCount_measurable {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (p : Fin n → Prop) [DecidablePred p] (v : CubeCell K) : Measurable (unitPairCount hL p v) := by + have hm : Measurable (fun X : Configuration n L ↦ fun i ↦ unitSite hL (X i)) := + Measurable.of_eval (fun i ↦ (measurable_unitSite hL).comp (measurable_pi_apply i)) + let W : (Fin n → CubeCell K) → ℝ := fun σ ↦ + (Fintype.card {i : {i // p i} // σ i.val=v}:ℝ)*((Fintype.card {i : {i // p i} // σ i.val=v}:ℝ)-1) + have hW : Measurable W := measurable_of_finite W + change Measurable (W ∘ fun X : Configuration n L ↦ fun i ↦ unitSite hL (X i)) + exact hW.comp hm + +lemma spatialPartition_cell_weight {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (A : Finset (Torus L)) (H : ℝ) (X : Configuration n L) : + (∑ v : CubeCell K, if spatialSiteDistance L A (unitCenter L v)+1≤H then + unitPairCount hL (fun _ ↦ True) v X else 0)≤ + ∑ σ : Fin n → Bool, (∑ v : CubeCell K, unitPairCount hL (fun i ↦ σ i=true) v X)* + ‖(productPartition n L (spatialInside L A H) (spatialOutside L A H) σ).toFun X‖^2 := by + classical + simp_rw [Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_le_sum + intro v _ + by_cases hv : spatialSiteDistance L A (unitCenter L v)+1≤H + · rw [ite_eq_left hv] + apply le_of_eq + have hp := productPartition_norm_unity (spatialInside L A H) (spatialOutside L A H) + (spatialInside_real L A H) (spatialOutside_real L A H) (spatialPartition_unity L A H) X + calc + _ = unitPairCount hL (fun _ ↦ True) v X* + (∑ σ : Fin n → Bool, ‖(productPartition n L (spatialInside L A H) (spatialOutside L A H) σ).toFun X‖^2) := by rw [hp,mul_one] + _ = ∑ σ : Fin n → Bool, unitPairCount hL (fun _ ↦ True) v X* + ‖(productPartition n L (spatialInside L A H) (spatialOutside L A H) σ).toFun X‖^2 := Finset.mul_sum .. + _ = _ := by + apply Finset.sum_congr rfl + intro σ _ + by_cases hz : (productPartition n L (spatialInside L A H) (spatialOutside L A H) σ).toFun X=0 + · simp only [hz,norm_zero,zero_pow (by norm_num : 2≠0),mul_zero] + · unfold unitPairCount + rw [spatialPartition_cell_occupation hL A H σ X hz v hv] + · rw [ite_eq_right hv] + exact Finset.sum_nonneg (fun σ _ ↦ mul_nonneg (unitPairCount_nonneg hL _ v X) (sq_nonneg _)) + +lemma spatialPartition_cell_integral {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (A : Finset (Torus L)) (H : ℝ) {r : ℝ} (hr : 0 rw [Finset.mul_sum] + have hp (σ : Fin n → Bool) : 0≤c*((∑ v : CubeCell K, q (fun i ↦ σ i=true) v X)*‖(w σ).toFun X‖^2) := + mul_nonneg hc (mul_nonneg (hn σ X) (sq_nonneg _)) + rw [ENNReal.ofReal_sum_of_nonneg (fun σ _ ↦ hp σ)] at hh + simp_rw [←mul_assoc,ENNReal.ofReal_mul (mul_nonneg hc (hn _ X))] at hh + simp_rw [hX,norm_mul,mul_pow,ENNReal.ofReal_mul (sq_nonneg _),←mul_assoc,←Finset.sum_mul] + exact mul_le_mul_of_nonneg_right hh zero_le + _ = ∑ σ : Fin n → Bool, ∫⁻ X, ENNReal.ofReal (c*∑ v : CubeCell K, q (fun i ↦ σ i=true) v X)*ENNReal.ofReal (‖(w σ).onScalar u.1 X‖^2) := by + rw [lintegral_finsetSum _ (fun σ _ ↦ hm σ)] + _ ≤ ∑ σ : Fin n → Bool, ENNReal.ofReal (selectedEnergy (fun i ↦ σ i=true) ((w σ).onJet u)) := by + apply Finset.sum_le_sum + intro σ _ + have hh := dirichlet_physical_cell_energy hL (fun i ↦ σ i=true) hr ((w σ).onJet u) ((w σ).onJet_mem_domain hu) + refine (le_of_eq ?_).trans hh + apply lintegral_congr + intro X + congr 2 + dsimp [c,q,unitPairCount] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro v _ + ring + _ = _ := by rw [spatialPartitionEnergy,ENNReal.ofReal_sum_of_nonneg (fun σ _ ↦ selectedEnergy_nonneg _ _)] + apply le_trans _ havg + apply le_of_eq + have hp (X : Configuration n L) : + ENNReal.ofReal (c*(∑ v : CubeCell K, if spatialSiteDistance L A (unitCenter L v)+1≤H then q (fun _ ↦ True) v X else 0))*ENNReal.ofReal (‖u.1 X‖^2)= + ∑ v : CubeCell K, ENNReal.ofReal (c*(if spatialSiteDistance L A (unitCenter L v)+1≤H then q (fun _ ↦ True) v X else 0))*ENNReal.ofReal (‖u.1 X‖^2) := by + have hpv (v : CubeCell K) : 0≤c*(if spatialSiteDistance L A (unitCenter L v)+1≤H then q (fun _ ↦ True) v X else 0) := by + apply mul_nonneg hc + split_ifs + · exact unitPairCount_nonneg hL _ v X + · exact le_refl _ + rw [Finset.mul_sum,ENNReal.ofReal_sum_of_nonneg (fun v _ ↦ hpv v),Finset.sum_mul] + simp_rw [hp] + rw [lintegral_finsetSum] + · apply Finset.sum_congr rfl + intro v _ + by_cases hv : spatialSiteDistance L A (unitCenter L v)+1≤H + · rw [indicator_of_mem (show H∈Ici (spatialSiteDistance L A (unitCenter L v)+1) from hv)] + simp only [ite_eq_left hv,ENNReal.ofReal_mul hc,mul_assoc] + rw [lintegral_const_mul' _ _ (ENNReal.ofReal_ne_top)] + · rw [indicator_of_notMem (show H∉Ici (spatialSiteDistance L A (unitCenter L v)+1) from hv)] + simp only [ite_eq_right hv,mul_zero,ENNReal.ofReal_zero,zero_mul,lintegral_zero] + · intro v _ + by_cases hv : spatialSiteDistance L A (unitCenter L v)+1≤H + · simp only [ite_eq_left hv] + exact (((unitPairCount_measurable hL _ v).const_mul c).ennreal_ofReal.mul + ((Lp.stronglyMeasurable u.1).measurable.norm.pow_const 2).ennreal_ofReal) + · simp only [ite_eq_right hv,mul_zero,ENNReal.ofReal_zero,zero_mul] + exact measurable_const + +theorem spatial_cell_average {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (A : Finset (Torus L)) {r : ℝ} (hr : 0 simp + | @insert a s ha ih => + have hp : ∀ i∈s, 0≤h i := fun i hi ↦ h0 i (Finset.mem_insert_of_mem hi) + have hq : ∀ i∈s, h i≤1 := fun i hi ↦ h1 i (Finset.mem_insert_of_mem hi) + have hh := ih hp hq + have hn : 0≤∑ i∈s, (1-h i)*∏ j∈s.erase i,h j := by + apply Finset.sum_nonneg + intro i hi + exact mul_nonneg (sub_nonneg.mpr (hq i hi)) + (Finset.prod_nonneg fun j hj ↦ hp j (Finset.mem_of_mem_erase hj)) + have he : (∑ i∈insert a s, (1-h i)*∏ j∈(insert a s).erase i, h j)= + (1-h a)*(∏ j∈s,h j)+h a*(∑ i∈s, (1-h i)*∏ j∈s.erase i,h j) := by + rw [Finset.sum_insert ha,Finset.erase_insert ha,Finset.mul_sum] + congr 1 + apply Finset.sum_congr rfl + intro i hi + have hia : i≠a := fun he ↦ ha (he ▸ hi) + rw [Finset.erase_insert_of_ne hia.symm,Finset.prod_insert (by simp [ha])] + ring + rw [he,Finset.prod_insert ha] + nlinarith [mul_le_mul_of_nonneg_right (h1 a (Finset.mem_insert_self a s)) hn] + +lemma coefficients_sq_le {I : Type*} [DecidableEq I] (s : Finset I) (θ : I → ℝ) : + ∑ i∈s, (Real.cos (θ i)*∏ j∈s.erase i,Real.sin (θ j))^2≤1 := by + have h := one_failure_le s (fun i ↦ Real.sin (θ i)^2) (fun _ _ ↦ sq_nonneg _) + (fun i _ ↦ by nlinarith [Real.sin_sq_add_cos_sq (θ i),sq_nonneg (Real.cos (θ i))]) + have he : (∑ i∈s, (1-Real.sin (θ i)^2)*∏ j∈s.erase i,Real.sin (θ j)^2)= + ∑ i∈s, (Real.cos (θ i)*∏ j∈s.erase i,Real.sin (θ j))^2 := by + apply Finset.sum_congr rfl + intro i hi + rw [mul_pow,← Finset.prod_pow] + congr 1 + nlinarith [Real.sin_sq_add_cos_sq (θ i)] + rw [he] at h + exact le_trans (le_add_of_nonneg_right (Finset.prod_nonneg fun _ _ ↦ sq_nonneg _)) h + +lemma contraction_sq {I : Type*} [DecidableEq I] (s : Finset I) (θ d : I → ℝ) : + (∑ i∈s, (Real.cos (θ i)*∏ j∈s.erase i,Real.sin (θ j))*d i)^2≤∑ i∈s,d i^2 := by + exact (Finset.sum_mul_sq_le_sq_mul_sq s _ d).trans (by + simpa only [one_mul] using mul_le_mul_of_nonneg_right (coefficients_sq_le s θ) + (Finset.sum_nonneg fun _ _ ↦ sq_nonneg _)) + +lemma deriv_sq_le {I : Type*} [DecidableEq I] (s : Finset I) (θ : I → ℝ → ℝ) + (d : I → ℝ) (x : ℝ) (hd : ∀ i∈s, HasDerivAt (θ i) (d i) x) : + (deriv (fun y ↦ ∏ i∈s,Real.sin (θ i y)) x)^2≤∑ i∈s,d i^2 := by + have hp := HasDerivAt.fun_finsetProd (u := s) (fun i hi ↦ (hd i hi).sin) + rw [hp.deriv] + convert contraction_sq s (fun i ↦ θ i x) d using 1 + congr 1 + apply Finset.sum_congr rfl + intro i hi + ring + +lemma fderiv_sq_le {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {I : Type*} [DecidableEq I] (s : Finset I) (θ : I → E → ℝ) (x v : E) + (hd : ∀ i∈s, DifferentiableAt ℝ (θ i) x) : + (fderiv ℝ (fun y ↦ ∏ i∈s,Real.sin (θ i y)) x v)^2≤ + ∑ i∈s,(fderiv ℝ (θ i) x v)^2 := by + have hp := HasFDerivAt.finsetProd (u := s) (fun i hi ↦ (hd i hi).hasFDerivAt.sin) + rw [hp.fderiv,sum_apply] + simp only [smul_apply,smul_eq_mul] + convert contraction_sq s (fun i ↦ θ i x) (fun i ↦ fderiv ℝ (θ i) x v) using 1 + congr 1 + apply Finset.sum_congr rfl + intro i hi + ring + +end SineProduct + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Cutoffs/Mesh.lean b/lean/OAI/Analysis/HardSphere/Cutoffs/Mesh.lean new file mode 100644 index 0000000000000000000000000000000000000000..2148bd9e8764574aca95ec9cb3b0635c71e419ff --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Cutoffs/Mesh.lean @@ -0,0 +1,71 @@ +import Mathlib + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set Filter +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.PathCutoff + +def sourceMesh (t r : ℝ) : ℕ := 2*⌈t/r^2⌉₊ +def sourceStep (t r : ℝ) : ℝ := t/(⌈t/r^2⌉₊:ℝ) + +lemma sourceMesh_properties {t r : ℝ} (ht : 0 simpa using hB + | succ m hm ih => + intro X + let u := splitTime τ ((m:ℝ)*τ) hτ (mul_pos (by exact_mod_cast hm) hτ) + let G : CoordinatePaths 1 × CoordinatePaths 1 → ℝ≥0∞ := fun w ↦ + F (freeTrajectory 1 L τ w.1 X) * + meshProduct m F (freeTrajectory 1 L ((m:ℝ)*τ) w.2 (freeTrajectory 1 L τ w.1 X 1)) + have hfirst : Measurable (fun w : CoordinatePaths 1 × CoordinatePaths 1 ↦ F (freeTrajectory 1 L τ w.1 X)) := + hF.comp ((freeTrajectory_continuous 1 L τ).comp (continuous_fst.prodMk continuous_const)).measurable + have hsecond : Measurable (fun w : CoordinatePaths 1 × CoordinatePaths 1 ↦ + meshProduct m F (freeTrajectory 1 L ((m:ℝ)*τ) w.2 (freeTrajectory 1 L τ w.1 X 1))) := + (meshProduct_measurable m hF).comp + (measurable_snd.comp (split_fixedTrajectory_measurable 1 L τ ((m:ℝ)*τ) X)) + have hG : Measurable G := hfirst.mul hsecond + have he (w : CoordinatePaths 1) : + meshProduct (m+1) F (freeTrajectory 1 L (((m+1:ℕ):ℝ)*τ) w X)= + G (fun p ↦ normalizedPrefix u (w p), fun p ↦ normalizedSuffix u (w p)) := by + have hmul : (((m+1:ℕ):ℝ)*τ)=τ+(m:ℝ)*τ := by push_cast; ring + rw [hmul,meshProduct_succ hm F hτ] + have hp := congrArg Prod.fst (split_fixedTrajectory 1 L τ ((m:ℝ)*τ) hτ (mul_pos (by exact_mod_cast hm) hτ) w X) + have hq := congrArg Prod.snd (split_fixedTrajectory 1 L τ ((m:ℝ)*τ) hτ (mul_pos (by exact_mod_cast hm) hτ) w X) + dsimp only [Prod.fst,Prod.snd] at hp hq + rw [hp,hq] + calc + _ = ∫⁻w,G (fun p ↦ normalizedPrefix u (w p),fun p ↦ normalizedSuffix u (w p)) ∂coordinateWiener 1 := lintegral_congr he + _ = ∫⁻w,G w ∂(coordinateWiener 1).prod (coordinateWiener 1) := + (coordinateSplit_preserving 1 u (splitTime_pos _ _ _ _) (splitTime_lt_one _ _ _ _)).lintegral_comp hG + _ = ∫⁻w₁,∫⁻w₂,G (w₁,w₂) ∂coordinateWiener 1 ∂coordinateWiener 1 := lintegral_prod _ hG.aemeasurable + _ ≤ ∫⁻w₁,F (freeTrajectory 1 L τ w₁ X)*B^m ∂coordinateWiener 1 := by + apply lintegral_mono + intro w₁ + dsimp only [G] + have hmeas : Measurable (fun w₂ : CoordinatePaths 1 ↦ + meshProduct m F (freeTrajectory 1 L ((m:ℝ)*τ) w₂ (freeTrajectory 1 L τ w₁ X 1))) := + (meshProduct_measurable m hF).comp + ((freeTrajectory_continuous 1 L ((m:ℝ)*τ)).comp (continuous_id.prodMk continuous_const)).measurable + rw [lintegral_const_mul _ hmeas] + exact mul_le_mul_right (ih _) _ + _ = (∫⁻w₁,F (freeTrajectory 1 L τ w₁ X) ∂coordinateWiener 1)*B^m := + lintegral_mul_const _ (hF.comp ((freeTrajectory_continuous 1 L τ).comp (continuous_id.prodMk continuous_const)).measurable) + _ ≤ B*B^m := mul_le_mul_left (hB X) _ + _ = B^(m+1) := by rw [pow_succ]; exact mul_comm _ _ + +end HardSphere.PathCutoff + +namespace HardSphere.PathCutoff +open Wiener +attribute [local irreducible] torusDistance freeTrajectory + +def meshSum {L : Length} (m : ℕ) (F : ConfigurationPath 1 L → ℝ≥0∞) (ω : ConfigurationPath 1 L) := + ∑ j : Fin m, F (meshSegment j ω) + +lemma meshSum_measurable {L : Length} (m : ℕ) {F : ConfigurationPath 1 L → ℝ≥0∞} + (hF : Measurable F) : Measurable (meshSum m F) := by + unfold meshSum + exact Finset.measurable_sum _ (fun j _ ↦ hF.comp (meshSegment_continuous L j).measurable) + +@[simp] lemma meshSum_one {L : Length} (F : ConfigurationPath 1 L → ℝ≥0∞) (ω : ConfigurationPath 1 L) : + meshSum 1 F ω=F ω := by simp [meshSum] + +lemma meshSum_succ {L : Length} {m : ℕ} (hm : 0 < m) (F : ConfigurationPath 1 L → ℝ≥0∞) + {τ : ℝ} (hτ : 0<τ) (ω : ConfigurationPath 1 L) : + meshSum (m+1) F ω = + F (configurationPrefix 1 L (splitTime τ ((m:ℝ)*τ) hτ (mul_pos (by exact_mod_cast hm) hτ)) ω)+ + meshSum m F (configurationSuffix 1 L (splitTime τ ((m:ℝ)*τ) hτ (mul_pos (by exact_mod_cast hm) hτ)) ω) := by + rw [splitTime_mul hτ hm] + simp only [meshSum,Fin.sum_univ_succ,meshSegment_first hm,meshSegment_next hm] + +lemma meshSum_free_bound {L : Length} (F : ConfigurationPath 1 L → ℝ≥0∞) (hF : Measurable F) + {τ : ℝ} (hτ : 0<τ) (B : ℝ≥0∞) + (hB : ∀ X : Configuration 1 L, ∫⁻w,F (freeTrajectory 1 L τ w X) ∂coordinateWiener 1 ≤ B) : + ∀ m : ℕ, 0 < m → ∀ X : Configuration 1 L, + ∫⁻w, meshSum m F (freeTrajectory 1 L ((m:ℝ)*τ) w X) ∂coordinateWiener 1 ≤ (m:ℝ≥0∞)*B := by + intro m hm + induction m, hm using Nat.le_induction with + | base => simpa using hB + | succ m hm ih => + intro X + let u := splitTime τ ((m:ℝ)*τ) hτ (mul_pos (by exact_mod_cast hm) hτ) + let G : CoordinatePaths 1 × CoordinatePaths 1 → ℝ≥0∞ := fun w ↦ + F (freeTrajectory 1 L τ w.1 X) + + meshSum m F (freeTrajectory 1 L ((m:ℝ)*τ) w.2 (freeTrajectory 1 L τ w.1 X 1)) + have hfirst : Measurable (fun w : CoordinatePaths 1 × CoordinatePaths 1 ↦ F (freeTrajectory 1 L τ w.1 X)) := + hF.comp ((freeTrajectory_continuous 1 L τ).comp (continuous_fst.prodMk continuous_const)).measurable + have hsecond : Measurable (fun w : CoordinatePaths 1 × CoordinatePaths 1 ↦ + meshSum m F (freeTrajectory 1 L ((m:ℝ)*τ) w.2 (freeTrajectory 1 L τ w.1 X 1))) := + (meshSum_measurable m hF).comp + (measurable_snd.comp (split_fixedTrajectory_measurable 1 L τ ((m:ℝ)*τ) X)) + have hG : Measurable G := hfirst.add hsecond + have he (w : CoordinatePaths 1) : + meshSum (m+1) F (freeTrajectory 1 L (((m+1:ℕ):ℝ)*τ) w X)= + G (fun p ↦ normalizedPrefix u (w p), fun p ↦ normalizedSuffix u (w p)) := by + have hmul : (((m+1:ℕ):ℝ)*τ)=τ+(m:ℝ)*τ := by push_cast; ring + rw [hmul,meshSum_succ hm F hτ] + have hp := congrArg Prod.fst (split_fixedTrajectory 1 L τ ((m:ℝ)*τ) hτ (mul_pos (by exact_mod_cast hm) hτ) w X) + have hq := congrArg Prod.snd (split_fixedTrajectory 1 L τ ((m:ℝ)*τ) hτ (mul_pos (by exact_mod_cast hm) hτ) w X) + dsimp only [Prod.fst,Prod.snd] at hp hq + rw [hp,hq] + calc + _ = ∫⁻w,G (fun p ↦ normalizedPrefix u (w p),fun p ↦ normalizedSuffix u (w p)) ∂coordinateWiener 1 := lintegral_congr he + _ = ∫⁻w,G w ∂(coordinateWiener 1).prod (coordinateWiener 1) := + (coordinateSplit_preserving 1 u (splitTime_pos _ _ _ _) (splitTime_lt_one _ _ _ _)).lintegral_comp hG + _ = ∫⁻w₁,∫⁻w₂,G (w₁,w₂) ∂coordinateWiener 1 ∂coordinateWiener 1 := lintegral_prod _ hG.aemeasurable + _ ≤ ∫⁻w₁,F (freeTrajectory 1 L τ w₁ X)+(m:ℝ≥0∞)*B ∂coordinateWiener 1 := by + apply lintegral_mono + intro w₁ + dsimp only [G] + have hmeas : Measurable (fun w₂ : CoordinatePaths 1 ↦ + meshSum m F (freeTrajectory 1 L ((m:ℝ)*τ) w₂ (freeTrajectory 1 L τ w₁ X 1))) := + (meshSum_measurable m hF).comp + ((freeTrajectory_continuous 1 L ((m:ℝ)*τ)).comp (continuous_id.prodMk continuous_const)).measurable + rw [lintegral_add_left measurable_const,lintegral_const,measure_univ,mul_one] + exact add_le_add le_rfl (ih _) + _ = (∫⁻w₁,F (freeTrajectory 1 L τ w₁ X) ∂coordinateWiener 1)+(m:ℝ≥0∞)*B := by + have hmeas : Measurable (fun w : CoordinatePaths 1 ↦ F (freeTrajectory 1 L τ w X)) := hF.comp ((freeTrajectory_continuous 1 L τ).comp (continuous_id.prodMk continuous_const)).measurable + rw [lintegral_add_left hmeas,lintegral_const,measure_univ,mul_one] + _ ≤ B+(m:ℝ≥0∞)*B := add_le_add (hB X) le_rfl + _ = ((m+1:ℕ):ℝ≥0∞)*B := by push_cast; ring + +end HardSphere.PathCutoff + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Cutoffs/Near.lean b/lean/OAI/Analysis/HardSphere/Cutoffs/Near.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6b2f55fdbfd5ed77df64fc3ad78b1ca48642d7d --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Cutoffs/Near.lean @@ -0,0 +1,182 @@ +import Mathlib +import OAI.Analysis.HardSphere.Model +import OAI.Analysis.HardSphere.Cutoffs.ThreeTorus + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +noncomputable section +open scoped BigOperators ComplexConjugate +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +noncomputable section +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere.TightCutoff +open PeriodicCutoff MeasureTheory Set +noncomputable section + +variable (L : ℝ) [hL : Fact (0 nlinarith + simp only [angleFactor,transition_deriv_eq_zero ht,mul_zero] + +omit hL in +lemma anglePartial_eq_zero {r : ℝ} (hr : 0 first | rfl | simp only [one_mul]) + have he : (rawAngleLift n L r i ∘ fun t : ℝ ↦ R+t • v)= + (fun t : ℝ ↦ angleLift L.val r (fun j ↦ (R 0 j+t*v 0 j)-(R i.succ j+t*v i.succ j))) := rfl + rw [he] at hf + convert hf.unique ha using 1 + simp only [zero_mul,add_zero] + rfl + +lemma rawAngleLift_fderiv_coord (n : ℕ) (L : Length) (r : ℝ) (i : Fin n) + (R : LiftedConfiguration (n+1)) (p : Direction (n+1)) : + fderiv ℝ (rawAngleLift n L r i) R (Pi.single p.1 (Pi.single p.2 1)) = + ((if p.1=0 then (1:ℝ) else 0)-(if p.1=i.succ then 1 else 0))* + anglePartial L.val r (R 0-R i.succ) p.2 := by + rw [rawAngleLift_fderiv] + by_cases h0 : p.1=0 <;> by_cases hi : p.1=i.succ + · exact False.elim (Fin.succ_ne_zero i (hi.symm.trans h0)) + · simp [h0,Pi.single_apply,eq_comm,Finset.sum_ite_eq',mul_comm] + · simp [hi,Pi.single_apply,eq_comm,Finset.sum_ite_eq',mul_comm] + · simp [h0,hi,Ne.symm h0,Ne.symm hi] + +lemma rawCutoff_derivative_sq_le (n : ℕ) (L : Length) (r : ℝ) + (X : Configuration (n+1) L) (p : Direction (n+1)) : + ‖coordDerivative (n+1) L (rawCutoff n L r).toFun p X‖^2≤ + ∑ i : Fin n, (fderiv ℝ (rawAngleLift n L r i) (representative (n+1) L X) + (Pi.single p.1 (Pi.single p.2 1)))^2 := by + let R := representative (n+1) L X + let v : LiftedConfiguration (n+1) := Pi.single p.1 (Pi.single p.2 1) + have he : (fun Y : LiftedConfiguration (n+1) ↦ (rawCutoff n L r).toFun (project (n+1) L Y))= + Complex.ofRealCLM ∘ (fun Y : LiftedConfiguration (n+1) ↦ ∏ i : Fin n, Real.sin (rawAngleLift n L r i Y)) := by + funext Y + change (rawCutoffReal n L r (project (n+1) L Y) : ℂ)=_ + simp only [rawCutoffReal,angle_project,Function.comp_apply,Complex.ofRealCLM_apply] + have hd := (rawCutoffReal_smooth n L r).differentiable (by simp) + simp only [rawCutoffReal,angle_project] at hd + change ‖fderiv ℝ (fun Y ↦ (rawCutoff n L r).toFun (project (n+1) L Y)) R v‖^2≤_ + rw [he,fderiv_comp R Complex.ofRealCLM.differentiableAt (hd R),Complex.ofRealCLM.fderiv] + simp only [ContinuousLinearMap.comp_apply,Complex.ofRealCLM_apply,Complex.norm_real,Real.norm_eq_abs,sq_abs] + exact SineProduct.fderiv_sq_le Finset.univ (rawAngleLift n L r) R v + (fun i _ ↦ (rawAngleLift_smooth n L r i).differentiable (by simp) R) + +lemma rawAngleLift_sum_squares (n : ℕ) (L : Length) (r : ℝ) (i : Fin n) + (R : LiftedConfiguration (n+1)) : + (∑ p : Direction (n+1), (fderiv ℝ (rawAngleLift n L r i) R + (Pi.single p.1 (Pi.single p.2 1)))^2)= + 2*∑ j : Fin 3, anglePartial L.val r (R 0-R i.succ) j^2 := by + simp only [rawAngleLift_fderiv_coord] + rw [Fintype.sum_prod_type,Fin.sum_univ_succ] + simp only [Fin.succ_ne_zero,Ne.symm (Fin.succ_ne_zero i),ite_true,ite_false,sub_zero,one_mul, + Fin.succ_inj,zero_sub,neg_mul,neg_sq] + have he : (∑ k : Fin n, ∑ j : Fin 3, + ((if k=i then (1:ℝ) else 0)*anglePartial L.val r (R 0-R i.succ) j)^2)= + ∑ j : Fin 3, anglePartial L.val r (R 0-R i.succ) j^2 := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + simp + rw [he] + ring + +lemma pairQ_representative (n : ℕ) (L : Length) (i : Fin n) (X : Configuration (n+1) L) : + pairQ L.val (X 0) (X i.succ)=qLift L.val + (representative (n+1) L X 0-representative (n+1) L X i.succ) := by + calc + _ = pairQ L.val (project (n+1) L (representative (n+1) L X) 0) + (project (n+1) L (representative (n+1) L X) i.succ) := by rw [project_representative] + _ = _ := pairQ_coe L.val _ _ + +lemma rawAngleLift_gradient_le (n : ℕ) (L : Length) {r M : ℝ} (hr : 0.re_inner_nonneg_right f + have heval : cfc (p := IsSelfAdjoint) (fun x ↦ 1+δ⁻¹*(1-heatScalar δ x)) R = + 1+δ⁻¹ • (1-cfc (p := IsSelfAdjoint) (heatScalar δ) R) := by + have hh := (heatScalar_smooth δ).continuous.continuousOn (s := spectrum ℝ R) + rw [cfc_add (a := R) (fun _ : ℝ ↦ 1) (fun x:ℝ ↦ δ⁻¹*(1-heatScalar δ x)) continuousOn_const (continuousOn_const.mul (continuousOn_const.sub hh)), + cfc_mul (fun _ : ℝ ↦ δ⁻¹) (fun x:ℝ ↦ 1-heatScalar δ x) R continuousOn_const (continuousOn_const.sub hh), + cfc_sub (fun _ : ℝ ↦ 1) (heatScalar δ) R continuousOn_const hh, + cfc_const 1 R hRp.isSelfAdjoint,cfc_const δ⁻¹ R hRp.isSelfAdjoint] + simp only [Algebra.algebraMap_eq_smul_one,one_smul,smul_mul_assoc,one_mul] + change 0≤(inner ℂ f ((cfc (p := IsSelfAdjoint) (fun x ↦ 1+δ⁻¹*(1-heatScalar δ x)) R- + cfc (p := IsSelfAdjoint) (fun x ↦ x*(regularizationWeight δ x)^2) R) f)).re at hp + rw [sub_apply,inner_sub_right,Complex.sub_re,heval,add_apply,smul_apply,sub_apply, + one_apply_eq_self,inner_add_right,Complex.add_re] at hp + have hself : (inner ℂ f f).re=‖f‖^2 := (norm_sq_eq_re_inner (𝕜 := ℂ) f).symm + have hi : (inner ℂ f (δ⁻¹ • (f-(cfc (p := IsSelfAdjoint) (heatScalar δ) R) f))).re = + δ⁻¹*(‖f‖^2-(inner ℂ f ((cfc (p := IsSelfAdjoint) (heatScalar δ) R) f)).re) := by + rw [RCLike.real_smul_eq_coe_smul (K := ℂ),inner_smul_real_right,inner_sub_right,Complex.real_smul,Complex.mul_re,Complex.sub_re] + simp only [Complex.ofReal_re,Complex.ofReal_im,zero_mul,sub_zero,hself] + rw [hi,hself,← hnorm] at hp + linarith +end +end HardSphere + +namespace HardSphere +open ContinuousLinearMap Filter +open scoped Topology + +lemma regularization_scalar_mem {δ x : ℝ} (hδ : 0<δ) (hx : x∈Set.Icc (0:ℝ) 1) : + x*regularizationWeight δ x∈Set.Icc (0:ℝ) 1 := by + have hd := regularization_denom_pos hδ hx + change 0≤x*(δ+(1-δ)*x)⁻¹ ∧ x*(δ+(1-δ)*x)⁻¹≤1 + rw [← div_eq_mul_inv,div_le_one hd] + exact ⟨div_nonneg hx.1 hd.le,by nlinarith [mul_nonneg hδ.le (sub_nonneg.mpr hx.2)]⟩ + +lemma regularization_error_bound {δ x : ℝ} (hδ : 0<δ) (hx : x∈Set.Icc (0:ℝ) 1) : + |(x*regularizationWeight δ x-1)*x|≤δ := by + have hs := regularization_scalar_mem hδ hx + have he : (x*regularizationWeight δ x-1)*x = -δ*(1-x)*(x*regularizationWeight δ x) := by + have hd := regularization_denom_pos hδ hx + dsimp [regularizationWeight] + have hi : (δ+(1-δ)*x)*(δ+(1-δ)*x)⁻¹=1 := mul_inv_cancel₀ hd.ne' + nlinarith only [congrArg (fun y:ℝ ↦ y*x) hi] + rw [he,abs_mul,abs_mul,abs_neg,abs_of_pos hδ,abs_of_nonneg (sub_nonneg.mpr hx.2),abs_of_nonneg hs.1] + calc + _ ≤ δ*1*1 := mul_le_mul (mul_le_mul_of_nonneg_left (by linarith [hx.1] : 1-x≤1) hδ.le) + hs.2 hs.1 (by positivity) + _ = δ := by ring + +section +variable {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℂ F] + [CompleteSpace F] [Nontrivial F] +local instance : Algebra ℝ (F →L[ℂ] F) := Algebra.restrictScalars ℝ ℂ _ + +def regularizationOperator (R : F →L[ℂ] F) (δ : ℝ) : F →L[ℂ] F := + cfc (p := IsSelfAdjoint) (fun x ↦ x*regularizationWeight δ x) R + +lemma regularizationOperator_norm_le {R : F →L[ℂ] F} (hRp : R.IsPositive) (hRn : ‖R‖≤1) + {δ : ℝ} (hδ : 0<δ) : ‖regularizationOperator R δ‖≤1 := by + apply norm_cfc_le zero_le_one + intro x hx + have hs := regularization_scalar_mem hδ (positive_contraction_spectrum hRp hRn hx) + simpa only [Real.norm_eq_abs,abs_of_nonneg hs.1] using hs.2 + +lemma regularizationOperator_eq {R : F →L[ℂ] F} (hRp : R.IsPositive) (hRn : ‖R‖≤1) + {δ : ℝ} (hδ : 0<δ) : + regularizationOperator R δ = R*cfc (p := IsSelfAdjoint) (regularizationWeight δ) R := by + rw [regularizationOperator,cfc_mul (fun x:ℝ ↦ x) (regularizationWeight δ) R + continuous_id.continuousOn ((regularization_weight_continuous hδ).mono + (positive_contraction_spectrum hRp hRn)),cfc_id' ℝ R hRp.isSelfAdjoint] + +lemma regularizationOperator_range_error {R : F →L[ℂ] F} (hRp : R.IsPositive) (hRn : ‖R‖≤1) + {δ : ℝ} (hδ : 0<δ) : ‖(regularizationOperator R δ-1)*R‖≤δ := by + have hw := (regularization_weight_continuous hδ).mono (positive_contraction_spectrum hRp hRn) + have he : (regularizationOperator R δ-1)*R = + cfc (p := IsSelfAdjoint) (fun x ↦ (x*regularizationWeight δ x-1)*x) R := by + rw [cfc_mul (fun x:ℝ ↦ x*regularizationWeight δ x-1) (fun x:ℝ ↦ x) R + ((continuous_id.continuousOn.mul hw).sub continuousOn_const) continuous_id.continuousOn, + cfc_sub (fun x:ℝ ↦ x*regularizationWeight δ x) (fun _:ℝ ↦ 1) R + (continuous_id.continuousOn.mul hw) continuousOn_const, + cfc_const 1 R hRp.isSelfAdjoint,cfc_id' ℝ R hRp.isSelfAdjoint] + simp only [map_one,regularizationOperator] + rw [he] + exact norm_cfc_le hδ.le (fun x hx ↦ by + simpa only [Real.norm_eq_abs] using regularization_error_bound hδ (positive_contraction_spectrum hRp hRn hx)) + +lemma regularizationOperator_tendsto {ι : Type*} {l : Filter ι} {d : ι→ℝ} + (hd : ∀ i, 0.comp h + +lemma tendsto_differential (z : ℂ) {e : ℕ → ℝ} (he : Tendsto e atTop (𝓝 0)) : + Tendsto (fun n ↦ differential (e n) z) atTop (𝓝 (differential 0 z)) := by + by_cases hz : z = 0 + · simp only [hz, differential, map_zero, ContinuousLinearMap.comp_zero, smul_zero] + exact tendsto_const_nhds + have hp : Real.sqrt (‖z‖ ^ 2 + (0 : ℝ) ^ 2) ≠ 0 := by + simp [Real.sqrt_sq (norm_nonneg z), hz] + exact (((tendsto_const_nhds.add (he.pow 2)).sqrt.inv₀ hp).smul tendsto_const_nhds) + +end ComplexRegularization + +namespace HardSphere +open ComplexRegularization + +def regularization (ε : ℝ) (hε : 0 < ε) : SmoothContraction where + toFun := regularize ε + smooth := smooth hε + zero := zero hε.le + derivative_le z := by rw [fderiv_eq hε]; exact differential_le ε z + +def regularizationScale (n : ℕ) : ℝ := 1 / ((n : ℝ) + 1) + +lemma regularizationScale_pos (n : ℕ) : 0 < regularizationScale n := by + unfold regularizationScale + positivity + +lemma tendsto_regularizationScale : Tendsto regularizationScale atTop (𝓝 0) := + tendsto_one_div_add_atTop_nhds_zero_nat + +lemma modulus_lipschitz : LipschitzWith 1 (fun z : ℂ ↦ (‖z‖ : ℂ)) := by + apply LipschitzWith.of_dist_le_mul + intro z w + simpa only [dist_eq_norm, ← Complex.ofReal_sub, Complex.norm_real, NNReal.coe_one, one_mul] + using dist_norm_norm_le z w + +def modulusScalar {N : ℕ} {L : Length} (u : ScalarL2 N L) : ScalarL2 N L := + modulus_lipschitz.compLp (by simp) u + +lemma coe_modulusScalar {N : ℕ} {L : Length} (u : ScalarL2 N L) : + modulusScalar u =ᵐ[volume] fun X ↦ (‖u X‖ : ℂ) := + modulus_lipschitz.coeFn_compLp (by simp) u + +lemma modulusCoefficient_meas {N : ℕ} {L : Length} (u : ScalarL2 N L) : + AEStronglyMeasurable (fun X ↦ differential 0 (u X)) volume := by + apply aestronglyMeasurable_of_tendsto_ae atTop (f := fun n X ↦ + differential (regularizationScale n) (u X)) + · intro n + have he : differential (regularizationScale n) = + fderiv ℝ (regularize (regularizationScale n)) := + funext fun z ↦ (fderiv_eq (regularizationScale_pos n) z).symm + rw [he] + exact ((smooth (regularizationScale_pos n)).continuous_fderiv (by simp)).comp_aestronglyMeasurable + (Lp.aestronglyMeasurable u) + · exact Eventually.of_forall fun X ↦ tendsto_differential (u X) tendsto_regularizationScale + +def modulusPartial {N : ℕ} {L : Length} (u v : ScalarL2 N L) : ScalarL2 N L := + L2Contraction.fieldApply (fun X ↦ differential 0 (u X)) (modulusCoefficient_meas u) + (Eventually.of_forall fun X ↦ differential_le 0 (u X)) v + +def modulusJet {N : ℕ} {L : Length} (u : Jet N L) : Jet N L := + (modulusScalar u.1, fun p ↦ modulusPartial u.1 (u.2 p)) + +lemma coe_modulusPartial {N : ℕ} {L : Length} (u v : ScalarL2 N L) : + modulusPartial u v =ᵐ[volume] fun X ↦ differential 0 (u X) (v X) := + L2Contraction.coe_fieldApply _ _ _ v + +lemma tendsto_regularization_partial {N : ℕ} {L : Length} (u v : ScalarL2 N L) : + Tendsto (fun n ↦ (regularization (regularizationScale n) (regularizationScale_pos n)).onPartial u v) + atTop (𝓝 (modulusPartial u v)) := by + refine L2Contraction.tendsto_toLp_of_domination + (fun n ↦ L2Contraction.field_memLp _ + (L2Contraction.coeff_meas _ (regularization _ (regularizationScale_pos n)).derivative_continuous u) + (Eventually.of_forall fun X ↦ (regularization _ (regularizationScale_pos n)).derivative_le (u X)) v) + (L2Contraction.field_memLp _ (modulusCoefficient_meas u) + (Eventually.of_forall fun X ↦ differential_le 0 (u X)) v) + (Lp.memLp v) ?_ ?_ + · intro n + apply Eventually.of_forall + intro X + change ‖fderiv ℝ (regularize (regularizationScale n)) (u X) (v X)‖ ≤ ‖v X‖ + rw [fderiv_eq (regularizationScale_pos n)] + exact differential_apply_le _ _ _ + · apply Eventually.of_forall + intro X + change Tendsto (fun n ↦ fderiv ℝ (regularize (regularizationScale n)) (u X) (v X)) + atTop (𝓝 (differential 0 (u X) (v X))) + simp only [fderiv_eq (regularizationScale_pos _)] + exact ((ContinuousLinearMap.apply ℝ ℂ (v X)).continuous.tendsto _).comp + (tendsto_differential (u X) tendsto_regularizationScale) + +lemma tendsto_regularization_scalar {N : ℕ} {L : Length} (u : ScalarL2 N L) : + Tendsto (fun n ↦ (regularization (regularizationScale n) (regularizationScale_pos n)).onScalar u) + atTop (𝓝 (modulusScalar u)) := by + have he (f : ℂ → ℂ) (hf : LipschitzWith 1 f) (h0 : f 0 = 0) : + hf.compLp h0 u = (hf.comp_memLp h0 (Lp.memLp u)).toLp (f ∘ u) := by + apply Lp.ext + exact (hf.coeFn_compLp h0 u).trans (MemLp.coeFn_toLp _).symm + simp only [SmoothContraction.onScalar, modulusScalar, he] + refine L2Contraction.tendsto_toLp_of_domination + (fun n ↦ (regularization _ (regularizationScale_pos n)).lipschitz.comp_memLp + (regularization _ (regularizationScale_pos n)).zero (Lp.memLp u)) + (modulus_lipschitz.comp_memLp (by simp) (Lp.memLp u)) (Lp.memLp u) ?_ ?_ + · intro n + apply Eventually.of_forall + intro X + have h := (regularization (regularizationScale n) (regularizationScale_pos n)).lipschitz.norm_sub_le + (u X) 0 + simpa only [SmoothContraction.zero, sub_zero, NNReal.coe_one, one_mul, Function.comp_apply] using h + · exact Eventually.of_forall fun X ↦ tendsto_regularize (u X) tendsto_regularizationScale + +lemma tendsto_regularization_jet {N : ℕ} {L : Length} (u : Jet N L) : + Tendsto (fun n ↦ (regularization (regularizationScale n) (regularizationScale_pos n)).onJet u) + atTop (𝓝 (modulusJet u)) := + (tendsto_regularization_scalar u.1).prodMk_nhds + (tendsto_pi_nhds.mpr fun p ↦ tendsto_regularization_partial u.1 (u.2 p)) + +lemma modulusJet_mem_domain {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : u ∈ dirichletDomain N L a) : modulusJet u ∈ dirichletDomain N L a := + isClosed_closure.mem_of_tendsto (tendsto_regularization_jet u) + (Eventually.of_forall fun n ↦ + (regularization (regularizationScale n) (regularizationScale_pos n)).onJet_mem_domain hu) + +lemma norm_modulusScalar {N : ℕ} {L : Length} (u : ScalarL2 N L) : + ‖modulusScalar u‖ = ‖u‖ := by + have he : ∀ᵐ X ∂volume, ‖modulusScalar u X‖ = ‖u X‖ := by + filter_upwards [coe_modulusScalar u] with X hX + simp [hX] + exact le_antisymm (Lp.norm_le_norm_of_ae_le (he.mono fun _ hx ↦ hx.le)) + (Lp.norm_le_norm_of_ae_le (he.mono fun _ hx ↦ hx.ge)) + +lemma energy_modulusJet_le {N : ℕ} {L : Length} (u : Jet N L) : + energy (modulusJet u) ≤ energy u := by + apply Finset.sum_le_sum + intro p _ + apply pow_le_pow_left₀ (norm_nonneg _) _ 2 + exact L2Contraction.norm_fieldApply_le _ (modulusCoefficient_meas u.1) + (Eventually.of_forall fun X ↦ differential_le 0 (u.1 X)) (u.2 p) + +lemma bosonic_modulusScalar {N : ℕ} {L : Length} {u : ScalarL2 N L} + (hu : bosonic u) : bosonic (modulusScalar u) := by + intro σ + have hp : MeasurePreserving (fun X : Configuration N L ↦ fun i ↦ X (σ i)) volume volume := by + have h := volume_measurePreserving_piCongrLeft (fun _ : Fin N ↦ Torus L) σ.symm + convert h using 1 + funext X i + simp [MeasurableEquiv.coe_piCongrLeft, Equiv.piCongrLeft_apply] + have hae := hp.quasiMeasurePreserving.ae_eq_comp (coe_modulusScalar u) + filter_upwards [hae, coe_modulusScalar u, hu σ] with X h1 h2 h3 + change modulusScalar u (fun i ↦ X (σ i)) = (‖u (fun i ↦ X (σ i))‖ : ℂ) at h1 + rw [h1, h2, h3] + +lemma IsGroundVector.modulus {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : IsGroundVector N L a u) : IsGroundVector N L a (modulusJet u) := by + refine ⟨modulusJet_mem_domain hu.1, bosonic_modulusScalar hu.2.1, ?_, ?_⟩ + · exact (norm_modulusScalar u.1).trans hu.2.2.1 + · intro v hv hb hn + exact (energy_modulusJet_le u).trans (hu.2.2.2 v hv hb hn) + +lemma IsGroundVector.energy_modulus {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : IsGroundVector N L a u) : energy (modulusJet u) = energy u := + le_antisymm (energy_modulusJet_le u) + (hu.2.2.2 _ hu.modulus.1 hu.modulus.2.1 hu.modulus.2.2.1) + +end HardSphere + +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Cutoffs/SmoothCutoff.lean b/lean/OAI/Analysis/HardSphere/Cutoffs/SmoothCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..5653e02d6cf07af3d508225dd229d82c1163ec09 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Cutoffs/SmoothCutoff.lean @@ -0,0 +1,73 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.SmoothMultiplier + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace HardSphere +open scoped Topology + +lemma exists_smooth_cutoff (N : ℕ) (L : Length) {K U : Set (Configuration N L)} + (hK : IsClosed K) (hU : IsOpen U) (hKU : K⊆U) : + ∃ f : SmoothMultiplier N L, Set.EqOn f.toFun 1 K ∧ tsupport f.toFun⊆U := by + obtain ⟨c,hc0,hc1,_⟩ := exists_continuous_zero_one_of_isClosed hU.isClosed_compl hK + (Set.disjoint_left.mpr (fun X hX hKX ↦ hX (hKU hKX))) + let C : C(Configuration N L,ℂ) := ⟨fun X ↦ (c X:ℂ),Complex.continuous_ofReal.comp c.continuous⟩ + obtain ⟨g,hg⟩ := (smoothAlgebra_dense N L).denseRange_val.exists_dist_lt C + (show (0:ℝ)<1/8 by norm_num) + have hclose (X : Configuration N L) : |(g.val X).re-c X|<1/8 := by + have he := (ContinuousMap.dist_apply_le_dist (f := g.val) (g := C) X).trans_lt + (show dist g.val C<1/8 from by rwa [dist_comm]) + have hh := (Complex.abs_re_le_norm (g.val X-C X)).trans_lt + (show ‖g.val X-C X‖<1/8 from by simpa only [dist_eq_norm] using he) + simpa only [Complex.sub_re,Complex.ofReal_re,C,ContinuousMap.coe_mk] using hh + have hgSmooth : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ g.val (project N L X)) := g.property + let f : Configuration N L→ℂ := fun X ↦ (Real.smoothTransition (2*(g.val X).re-1/2):ℂ) + have hs : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (fun X : LiftedConfiguration N ↦ f (project N L X)) := + Complex.ofRealCLM.contDiff.comp (Real.smoothTransition.contDiff.comp + ((contDiff_const.mul (Complex.reCLM.contDiff.comp hgSmooth)).sub contDiff_const)) + let m : SmoothMultiplier N L := { + toFun := f + smooth := hs + memLp_top := (continuous_of_continuous_lift hs.continuous).memLp_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) + partial_memLp_top := fun p ↦ (continuous_coordDerivative hs p).memLp_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) } + refine ⟨m,?_,?_⟩ + · intro X hX + have hx := hclose X + have hc : c X=1 := hc1 hX + have hl : 1≤2*(g.val X).re-1/2 := by rw [hc] at hx; linarith [(abs_lt.mp hx).1] + change (Real.smoothTransition (2*(g.val X).re-1/2):ℂ)=1 + rw [Real.smoothTransition.one_of_one_le hl,Complex.ofReal_one] + · have hc : tsupport f⊆{X | 1/4≤(g.val X).re} := by + apply closure_minimal ?_ (isClosed_le continuous_const (Complex.continuous_re.comp g.val.continuous)) + intro X hX + by_contra h + change ¬1/4≤(g.val X).re at h + have hz : f X=0 := by + dsimp [f] + rw [Real.smoothTransition.zero_of_nonpos (by linarith [not_le.mp h]),Complex.ofReal_zero] + exact hX hz + intro X hX + have hh := hc hX + change 1/4≤(g.val X).re at hh + by_contra hn + have hc : c X=0 := hc0 hn + have hh' := hclose X + rw [hc,sub_zero] at hh' + linarith [(abs_lt.mp hh').2] + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Cutoffs/StandardRegular.lean b/lean/OAI/Analysis/HardSphere/Cutoffs/StandardRegular.lean new file mode 100644 index 0000000000000000000000000000000000000000..231dfd360dc57cc067d5a2ecac4ef3c0eae87890 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Cutoffs/StandardRegular.lean @@ -0,0 +1,61 @@ +import Mathlib +import OAI.Analysis.HardSphere.Cutoffs.RegularTail +import OAI.Analysis.HardSphere.Thermodynamics.CutoffAsymptotics + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set Filter +open scoped ENNReal Topology +namespace HardSphere.PathCutoff +open Wiener FreeVisits + +lemma scalarRegularBound_nonneg {C M : ℝ} (hC : 0 ≤ C) (hM : 0 ≤ M) (c a b D : ℝ) : + 0 ≤ scalarRegularBound C M c a b D := by unfold scalarRegularBound; positivity + +lemma regular_root_decay {C M c a b : ℝ} (hC : 0 ≤ C) (hM : 0 ≤ M) + (hc : 0 < c) (ha : 0 < a) (hb : 0 < b) : + Tendsto (fun D:ℝ ↦ D*(scalarRegularBound C M c a b D)^(1/3:ℝ)) atTop (𝓝 0) := by + have ht := (scalarRegularBound_decay (3:ℝ) C M hc ha hb).rpow_const (p:=(3⁻¹:ℝ)) (Or.inr (by positivity)) + rw [Real.zero_rpow (by norm_num : (3⁻¹:ℝ)≠0)] at ht + apply ht.congr' + filter_upwards [eventually_ge_atTop (0:ℝ)] with D hD + rw [Real.mul_rpow (Real.rpow_nonneg hD _) (scalarRegularBound_nonneg hC hM c a b D), + ←Real.rpow_mul hD] + norm_num + +lemma free_regular_standard_tail {c : ℝ} {M : ℝ≥0∞} (hM : M≠⊤) + (htail : ∀R:ℝ,0 ≤ R→wiener {w | R ≤ ‖w‖} ≤ M*ENNReal.ofReal (Real.exp (-c*R^2))) + {L : Length} {r τ D C a b : ℝ} (hr : 0 < r) (hτ : 0 < τ) (hτr : τ ≤ r^2) + (hc : 0 ≤ c) (hD : 1 ≤ D) (hC : 0 ≤ C) (ha : 0 ≤ a) (hb : 0 ≤ b) + (m : ℕ) (hm : 0 < m) (hmlo : a*D^2 ≤ (m:ℝ)) (hmhi : (m:ℝ) ≤ C*D^2) + (hhT : D⁻¹ < (m:ℝ)*τ) (X : Configuration 1 L) : + coordinateWiener 1 {w | ¬Regular m r (D^(1/12:ℝ)) (meanCost+1) + (splitTime (D⁻¹) ((m:ℝ)*τ-D⁻¹) (by positivity) (sub_pos.mpr hhT)) + (b*D^(-(1/3:ℝ))/8) (freeTrajectory 1 L ((m:ℝ)*τ) w X)} ≤ + ENNReal.ofReal (scalarRegularBound C (3*M.toReal) c a b D) := by + have hD0 : 0 < D := lt_of_lt_of_le zero_lt_one hD + have hh := free_regular_tail htail hr hτ hτr (Real.rpow_nonneg hD0.le (1/12:ℝ)) m hm + (by positivity : 0 < D⁻¹) hhT (by positivity : 0 ≤ b*D^(-(1/3:ℝ))/8) X + apply hh.trans + have hfinite : (m:ℝ≥0∞)*(3*M*ENNReal.ofReal (Real.exp (-c*(D^(1/12:ℝ)/36)^2)))+ + ENNReal.ofReal (Real.exp (-(m:ℝ)/((1+D^(1/12:ℝ))^3)))+ + 2*(3*M*ENNReal.ofReal (Real.exp (-c*((b*D^(-(1/3:ℝ))/8)/(36*Real.sqrt (D⁻¹)))^2)))≠⊤ := by finiteness + apply (ENNReal.le_ofReal_iff_toReal_le hfinite (scalarRegularBound_nonneg hC (by positivity) c a b D)).mpr + rw [ENNReal.toReal_add (by finiteness) (by finiteness), + ENNReal.toReal_add (by finiteness) (by finiteness)] + simp only [ENNReal.toReal_mul, + ENNReal.toReal_natCast,ENNReal.toReal_ofNat,ENNReal.toReal_ofReal (Real.exp_nonneg _)] + exact regularScale_majorant (M:=3*M.toReal) (b:=b) hD hC (by positivity) hc ha hmlo hmhi + +end HardSphere.PathCutoff + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Cutoffs/ThreeTorus.lean b/lean/OAI/Analysis/HardSphere/Cutoffs/ThreeTorus.lean new file mode 100644 index 0000000000000000000000000000000000000000..d6b82d1a0df2e0aa3e1186e8e4a165c9458759d0 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Cutoffs/ThreeTorus.lean @@ -0,0 +1,183 @@ +import Mathlib +import OAI.Analysis.HardSphere.Cutoffs.ChordLift +import OAI.Analysis.HardSphere.Operators.TransitionDerivative + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace PeriodicCutoff +variable (L : ℝ) [hL : Fact (0 nlinarith + simp only [angleFactor,transition_deriv_eq_zero ht,mul_zero] + +omit hL in +lemma anglePartial_eq_zero {r : ℝ} (hr : 0.const_mul C + · intro Y + simpa only [mul_comm C] using mul_le_mul_of_nonneg_left (hC Y) (sq_nonneg ‖u.1 Y‖) + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/FormDomain/EnergyParallelogram.lean b/lean/OAI/Analysis/HardSphere/FormDomain/EnergyParallelogram.lean new file mode 100644 index 0000000000000000000000000000000000000000..50ab7e6648a2bab4dad6c94696f85d0eca4a4bc5 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/FormDomain/EnergyParallelogram.lean @@ -0,0 +1,53 @@ +import Mathlib +import OAI.Analysis.HardSphere.FormDomain.Energy + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +noncomputable section +open scoped BigOperators ComplexConjugate +namespace HardSphere.Variational +variable {H J : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [Fintype J] + +lemma energy_parallelogram (u v : H × (J → H)) : + energy (u + v) + energy (u - v) = 2 * (energy u + energy v) := by + change (∑ i, ‖u.2 i + v.2 i‖ ^ 2) + (∑ i, ‖u.2 i - v.2 i‖ ^ 2) = _ + rw [← Finset.sum_add_distrib] + simp_rw [parallelogram_law_with_norm ℂ] + simp only [energy, Finset.mul_sum, Finset.sum_add_distrib, mul_add] + +theorem minimizer_eq_of_scalar_eq (M : Submodule ℂ (H × (J → H))) + (u : H × (J → H)) (hu : u ∈ M) (hnorm : ‖u.1‖ = 1) + (hmin : ∀ v ∈ M, ‖v.1‖ = 1 → energy u ≤ energy v) + (v : H × (J → H)) (hv : v ∈ M) (hscalar : v.1 = u.1) + (henergy : energy v ≤ energy u) : v = u := by + have hnormsum : ‖(u + v).1‖ ^ 2 = 4 := by + have he : (u + v).1 = (2 : ℂ) • u.1 := by simp [hscalar, two_smul] + rw [he, norm_smul, hnorm] + norm_num + have hr := rayleigh M u hmin (u + v) (M.add_mem hu hv) + rw [hnormsum] at hr + have hd : energy (u - v) = 0 := by + have hp := energy_parallelogram u v + have hn := energy_nonneg (u - v) + linarith + apply Prod.ext hscalar + funext i + have hi : ‖u.2 i - v.2 i‖ ^ 2 ≤ energy (u - v) := + Finset.single_le_sum (fun j _ ↦ sq_nonneg ‖u.2 j - v.2 j‖) (Finset.mem_univ i) + rw [hd] at hi + have hz : ‖u.2 i - v.2 i‖ = 0 := by nlinarith [norm_nonneg (u.2 i - v.2 i)] + exact (sub_eq_zero.mp (norm_eq_zero.mp hz)).symm + +end HardSphere.Variational + +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/FormDomain/HilbertJet.lean b/lean/OAI/Analysis/HardSphere/FormDomain/HilbertJet.lean new file mode 100644 index 0000000000000000000000000000000000000000..8720fff501aad01993722bbe044efaf70310b3a7 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/FormDomain/HilbertJet.lean @@ -0,0 +1,298 @@ +import Mathlib +import OAI.Analysis.HardSphere.Comparison.PermutationPullbackComp + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +noncomputable section +open scoped BigOperators ComplexConjugate +namespace HardSphere + +attribute [local instance] scalarL2_addCommMonoid scalarL2_module scalarL2_completeSpace + +def optionJetEquiv (N : ℕ) (L : Length) : + (Option (Direction N) → ScalarL2 N L) ≃L[ℂ] Jet N L where + toLinearEquiv := LinearEquiv.piOptionEquivProd ℂ + continuous_toFun := (continuous_apply none).prodMk + (continuous_pi fun i ↦ continuous_apply (some i)) + continuous_invFun := continuous_pi fun i ↦ by + cases i with + | none => exact continuous_fst + | some p => exact (continuous_apply p).comp continuous_snd + +def hilbertJetEquiv (N : ℕ) (L : Length) : HilbertJet N L ≃L[ℂ] Jet N L := + (PiLp.continuousLinearEquiv _ ℂ _).trans (optionJetEquiv N L) + +@[simp] lemma hilbertJetEquiv_fst {N : ℕ} {L : Length} (u : HilbertJet N L) : + (hilbertJetEquiv N L u).1 = u.ofLp none := rfl +@[simp] lemma hilbertJetEquiv_snd {N : ℕ} {L : Length} (u : HilbertJet N L) (p : Direction N) : + (hilbertJetEquiv N L u).2 p = u.ofLp (some p) := rfl + +lemma hilbertJet_inner {N : ℕ} {L : Length} (u v : HilbertJet N L) : + inner ℂ u v = inner ℂ (hilbertJetEquiv N L u).1 (hilbertJetEquiv N L v).1 + + ∑ p : Direction N, inner ℂ ((hilbertJetEquiv N L u).2 p) ((hilbertJetEquiv N L v).2 p) := by + rw [PiLp.inner_apply,Fintype.sum_option] + rfl + +lemma hilbertJet_norm_sq {N : ℕ} {L : Length} (u : HilbertJet N L) : + ‖u‖^2 = ‖(hilbertJetEquiv N L u).1‖^2 + energy (hilbertJetEquiv N L u) := by + rw [PiLp.norm_sq_eq_of_L2,Fintype.sum_option] + rfl + +def hilbertDomain (N : ℕ) (L : Length) (a : ℝ) : Submodule ℂ (HilbertJet N L) := + (dirichletSubmodule N L a).comap (hilbertJetEquiv N L).toLinearMap + +instance hilbertDomain_closed (N : ℕ) (L : Length) (a : ℝ) : + IsClosed (hilbertDomain N L a : Set (HilbertJet N L)) := + (Submodule.isClosed_topologicalClosure _).preimage (hilbertJetEquiv N L).continuous +instance hilbertDomain_complete (N : ℕ) (L : Length) (a : ℝ) : + CompleteSpace (hilbertDomain N L a) := IsClosed.completeSpace_coe + +def scalarEmbedding (N : ℕ) (L : Length) (a : ℝ) : + (hilbertDomain N L a) →L[ℂ] ScalarL2 N L := + (PiLp.proj _ _ none).comp (hilbertDomain N L a).subtypeL + +lemma scalarEmbedding_norm_le (N : ℕ) (L : Length) (a : ℝ) : ‖scalarEmbedding N L a‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro u + simpa [scalarEmbedding] using PiLp.norm_apply_le (u : HilbertJet N L) none + +def formResolvent (N : ℕ) (L : Length) (a : ℝ) : ScalarL2 N L →L[ℂ] ScalarL2 N L := + (scalarEmbedding N L a).comp (scalarEmbedding N L a).adjoint + +lemma formResolvent_isPositive (N : ℕ) (L : Length) (a : ℝ) : + (formResolvent N L a).IsPositive := by + simpa [formResolvent] using + ContinuousLinearMap.isPositive_adjoint_comp_self (scalarEmbedding N L a).adjoint + +lemma formResolvent_norm_le_one (N : ℕ) (L : Length) (a : ℝ) : + ‖formResolvent N L a‖ ≤ 1 := by + have ha : ‖(scalarEmbedding N L a).adjoint‖ = ‖scalarEmbedding N L a‖ := + ContinuousLinearMap.adjoint.norm_map _ + have hadj : ‖(scalarEmbedding N L a).adjoint‖ ≤ 1 := by + rw [ha] + exact scalarEmbedding_norm_le N L a + calc + _ ≤ ‖scalarEmbedding N L a‖ * ‖(scalarEmbedding N L a).adjoint‖ := + ContinuousLinearMap.opNorm_comp_le _ _ + _ ≤ 1*1 := mul_le_mul (scalarEmbedding_norm_le N L a) + hadj (ContinuousLinearMap.opNorm_nonneg _) zero_le_one + _ = 1 := one_mul 1 + +lemma resolvent_weak_equation {N : ℕ} {L : Length} {a : ℝ} (f : ScalarL2 N L) + (v : hilbertDomain N L a) : + let u : Jet N L := hilbertJetEquiv N L ((scalarEmbedding N L a).adjoint f : HilbertJet N L) + inner ℂ u.1 (hilbertJetEquiv N L (v : HilbertJet N L)).1 + + ∑ p : Direction N, inner ℂ (u.2 p) ((hilbertJetEquiv N L (v : HilbertJet N L)).2 p) = + inner ℂ f (scalarEmbedding N L a v) := by + exact (hilbertJet_inner _ _).symm.trans + (ContinuousLinearMap.adjoint_inner_left (scalarEmbedding N L a) v f) + +lemma IsGroundVector.resolvent_eigenvector {N : ℕ} {L : Length} {a : ℝ} + {u : Jet N L} (hu : IsGroundVector N L a u) : + formResolvent N L a u.1 = ((1+(energy u:ℂ))⁻¹) • u.1 := by + let ug : hilbertDomain N L a := ⟨(hilbertJetEquiv N L).symm u, by + change hilbertJetEquiv N L ((hilbertJetEquiv N L).symm u) ∈ dirichletSubmodule N L a + simpa using hu.1⟩ + have hE : 0 ≤ energy u := Finset.sum_nonneg fun _ _ ↦ sq_nonneg _ + have hne : 1+(energy u:ℂ) ≠ 0 := by + have hreal : (1:ℝ)+energy u ≠ 0 := ne_of_gt (by linarith) + exact_mod_cast hreal + have heq : (scalarEmbedding N L a).adjoint u.1 = ((1+(energy u:ℂ))⁻¹) • ug := by + apply ext_inner_right ℂ + intro v + rw [ContinuousLinearMap.adjoint_inner_left] + rw [inner_smul_left ug v ((1+(energy u:ℂ))⁻¹)] + have hv : hilbertJetEquiv N L (v : HilbertJet N L) ∈ dirichletDomain N L a := v.property + have hg : inner ℂ ug v = (1+(energy u:ℂ))*inner ℂ u.1 (scalarEmbedding N L a v) := by + change inner ℂ (ug : HilbertJet N L) (v : HilbertJet N L) = _ + rw [hilbertJet_inner] + have hgu : hilbertJetEquiv N L (ug : HilbertJet N L) = u := by simp [ug] + rw [hgu,hu.full_first_variation _ hv] + change inner ℂ u.1 (scalarEmbedding N L a v) + (energy u:ℂ)*inner ℂ u.1 (scalarEmbedding N L a v) = _ + ring + rw [hg] + simp only [map_inv₀,map_add,map_one,Complex.conj_ofReal] + rw [← mul_assoc,inv_mul_cancel₀ hne,one_mul] + change scalarEmbedding N L a ((scalarEmbedding N L a).adjoint u.1) = _ + rw [heq,map_smul] + congr 1 + +lemma strong_projection_limit {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + (K : Submodule ℂ E) (Kseq : ℕ → Submodule ℂ E) + [K.HasOrthogonalProjection] [∀ n, (Kseq n).HasOrthogonalProjection] + (hmono : Monotone Kseq) (hle : ∀ n, Kseq n ≤ K) + (hdense : closure (⋃ n, (Kseq n : Set E)) = K) (x : E) : + Tendsto (fun n ↦ (Kseq n).starProjection x) atTop (𝓝 (K.starProjection x)) := by + apply Metric.tendsto_atTop.mpr + intro ε hε + have hy : K.starProjection x ∈ closure (⋃ n, (Kseq n : Set E)) := by + rw [hdense] + exact K.starProjection_apply_mem x + obtain ⟨v, hv, hdist⟩ := Metric.mem_closure_iff.mp hy (ε/2) (half_pos hε) + obtain ⟨m, hm⟩ := mem_iUnion.mp hv + refine ⟨m, fun n hn ↦ ?_⟩ + have hvn : (Kseq n).starProjection v = v := + (Kseq n).starProjection_eq_self_iff.mpr (hmono hn hm) + have hcomp : (Kseq n).starProjection (K.starProjection x) = (Kseq n).starProjection x := + DFunLike.congr_fun (Submodule.starProjection_comp_starProjection_of_le (hle n)) x + have hnorm := (Kseq n).norm_starProjection_apply_le (K.starProjection x - v) + rw [map_sub, hcomp, hvn] at hnorm + calc + dist ((Kseq n).starProjection x) (K.starProjection x) = + ‖(Kseq n).starProjection x - K.starProjection x‖ := dist_eq_norm _ _ + _ ≤ ‖(Kseq n).starProjection x - v‖ + ‖v - K.starProjection x‖ := norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ ‖K.starProjection x - v‖ + ‖v - K.starProjection x‖ := add_le_add hnorm le_rfl + _ < ε := by rw [norm_sub_rev v]; rw [dist_eq_norm] at hdist; linarith + +lemma scalarAdjoint_eq_projection {N : ℕ} {L : Length} {a : ℝ} (f : ScalarL2 N L) : + ((scalarEmbedding N L a).adjoint f : HilbertJet N L) = + (hilbertDomain N L a).starProjection (PiLp.single 2 none f) := by + symm + apply Submodule.eq_starProjection_of_mem_of_inner_eq_zero + · exact ((scalarEmbedding N L a).adjoint f).property + · intro v hv + rw [inner_sub_left] + have hleft : inner ℂ (PiLp.single 2 none f : HilbertJet N L) v = inner ℂ f (v.ofLp none) := by + rw [PiLp.inner_apply, Fintype.sum_option] + simp + rw [hleft] + have hh := ContinuousLinearMap.adjoint_inner_left (scalarEmbedding N L a) ⟨v,hv⟩ f + change inner ℂ ((scalarEmbedding N L a).adjoint f : HilbertJet N L) v = _ at hh + rw [hh] + change inner ℂ f (v.ofLp none) - inner ℂ f (v.ofLp none) = 0 + exact sub_self _ + +lemma formResolvent_eq_projection {N : ℕ} {L : Length} {a : ℝ} (f : ScalarL2 N L) : + formResolvent N L a f = + ((hilbertDomain N L a).starProjection (PiLp.single 2 none f)).ofLp none := by + change (((scalarEmbedding N L a).adjoint f : HilbertJet N L)).ofLp none = _ + rw [scalarAdjoint_eq_projection] + +lemma continuous_torusDistance (L : Length) : Continuous (fun p : Torus L × Torus L ↦ torusDistance L p.1 p.2) := by + unfold torusDistance + fun_prop + +lemma isOpen_allowed (N : ℕ) (L : Length) (a : ℝ) : IsOpen (allowed N L a) := by + let P := {p : Fin N × Fin N // p.1 < p.2} + have heq : allowed N L a = ⋂ p : P, {X : Configuration N L | a < torusDistance L (X p.1.1) (X p.1.2)} := by + ext X + simp only [allowed, mem_ofPred_eq, mem_iInter] + exact ⟨fun h p ↦ h _ _ p.2, fun h i j hij ↦ h ⟨(i,j),hij⟩⟩ + rw [heq] + apply isOpen_iInter_of_finite + intro p + have hc : Continuous (fun X : Configuration N L ↦ torusDistance L (X p.1.1) (X p.1.2)) := by + unfold torusDistance + fun_prop + exact isOpen_lt continuous_const hc + +lemma allowed_antitone (N : ℕ) (L : Length) : Antitone (allowed N L) := by + intro a b hab X hX i j hij + exact lt_of_le_of_lt hab (hX i j hij) + +def innerRadius (a : ℝ) (n : ℕ) : ℝ := a + 1 / ((n:ℝ)+1) + +lemma innerRadius_gt (a : ℝ) (n : ℕ) : a < innerRadius a n := by + unfold innerRadius + have : 0 < 1 / ((n:ℝ)+1) := by positivity + linarith + +lemma innerRadius_antitone (a : ℝ) : Antitone (innerRadius a) := by + intro m n hmn + unfold innerRadius + apply add_le_add le_rfl + apply one_div_le_one_div_of_le (by positivity) + exact_mod_cast Nat.add_le_add_right hmn 1 + +lemma innerRadius_tendsto (a : ℝ) : Tendsto (innerRadius a) atTop (𝓝 a) := by + change Tendsto (fun n : ℕ ↦ a + 1 / ((n:ℝ)+1)) atTop (𝓝 a) + simpa only [add_zero] using (tendsto_const_nhds (x := a)).add (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)) + +lemma iUnion_allowed_innerRadius (N : ℕ) (L : Length) (a : ℝ) : + (⋃ n, allowed N L (innerRadius a n)) = allowed N L a := by + apply Subset.antisymm + · exact iUnion_subset fun n ↦ allowed_antitone N L (innerRadius_gt a n).le + · intro X hX + have h : ∀ i j : Fin N, ∀ᶠ n in atTop, i < j → innerRadius a n < torusDistance L (X i) (X j) := by + intro i j + by_cases hij : i < j + · exact ((innerRadius_tendsto a).eventually (gt_mem_nhds (hX i j hij))).mono fun _ hn _ ↦ hn + · exact Filter.Eventually.of_forall fun _ h ↦ (hij h).elim + have hh : ∀ᶠ n in atTop, ∀ i j : Fin N, i < j → innerRadius a n < torusDistance L (X i) (X j) := by + exact Filter.eventually_all.mpr fun i ↦ Filter.eventually_all.mpr (h i) + obtain ⟨n, hn⟩ := hh.exists + exact mem_iUnion.mpr ⟨n,hn⟩ + +lemma SmoothTest.exists_innerRadius {N : ℕ} {L : Length} {a : ℝ} (f : SmoothTest N L a) : + ∃ n, tsupport f.toFun ⊆ allowed N L (innerRadius a n) := by + apply f.compact.isCompact.elim_directed_cover (fun n ↦ allowed N L (innerRadius a n)) + · exact fun n ↦ isOpen_allowed _ _ _ + · rw [iUnion_allowed_innerRadius] + exact f.support_allowed + · intro m n + exact ⟨max m n, allowed_antitone N L (innerRadius_antitone a (le_max_left _ _)), + allowed_antitone N L (innerRadius_antitone a (le_max_right _ _))⟩ + +lemma dirichletDomain_antitone (N : ℕ) (L : Length) : Antitone (dirichletDomain N L) := by + intro a b hab + apply closure_mono + rintro _ ⟨f,rfl⟩ + let g : SmoothTest N L a := {f with support_allowed := fun X hX ↦ allowed_antitone N L hab (f.support_allowed hX)} + exact ⟨g,rfl⟩ + +lemma hilbertDomain_antitone (N : ℕ) (L : Length) : Antitone (hilbertDomain N L) := by + intro a b hab u hu + exact dirichletDomain_antitone N L hab hu + +lemma hilbertDomain_exhaustion (N : ℕ) (L : Length) (a : ℝ) : + closure (⋃ n, (hilbertDomain N L (innerRadius a n) : Set (HilbertJet N L))) = hilbertDomain N L a := by + apply Subset.antisymm + · apply closure_minimal + · exact iUnion_subset fun n ↦ hilbertDomain_antitone N L (innerRadius_gt a n).le + · exact hilbertDomain_closed N L a + · intro u hu + let S := closure (⋃ n, (hilbertDomain N L (innerRadius a n) : Set (HilbertJet N L))) + have hclosed : IsClosed ((hilbertJetEquiv N L).symm ⁻¹' S) := + isClosed_closure.preimage (hilbertJetEquiv N L).symm.continuous + have hsub : dirichletDomain N L a ⊆ (hilbertJetEquiv N L).symm ⁻¹' S := by + apply closure_minimal _ hclosed + rintro _ ⟨f,rfl⟩ + obtain ⟨n, hn⟩ := f.exists_innerRadius + let g : SmoothTest N L (innerRadius a n) := {f with support_allowed := hn} + apply subset_closure + apply mem_iUnion.mpr + refine ⟨n,?_⟩ + change hilbertJetEquiv N L ((hilbertJetEquiv N L).symm f.jet) ∈ dirichletDomain N L (innerRadius a n) + simp only [ContinuousLinearEquiv.apply_symm_apply] + exact subset_closure ⟨g,rfl⟩ + have hx := hsub hu + change (hilbertJetEquiv N L).symm (hilbertJetEquiv N L u) ∈ S at hx + rwa [ContinuousLinearEquiv.symm_apply_apply] at hx + +lemma formResolvent_innerRadius_tendsto (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) : + Tendsto (fun n ↦ formResolvent N L (innerRadius a n) f) atTop (𝓝 (formResolvent N L a f)) := by + simp only [formResolvent_eq_projection] + apply (PiLp.proj (𝕜 := ℂ) 2 (fun _ : Option (Direction N) ↦ ScalarL2 N L) none).continuous.tendsto _ |>.comp + apply strong_projection_limit + · exact fun m n hmn ↦ hilbertDomain_antitone N L (innerRadius_antitone a hmn) + · exact fun n ↦ hilbertDomain_antitone N L (innerRadius_gt a n).le + · exact hilbertDomain_exhaustion N L a + +end HardSphere + +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators + +end +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/FormDomain/RawCutoffGradientIntegral.lean b/lean/OAI/Analysis/HardSphere/FormDomain/RawCutoffGradientIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..facc39b8881d2f48130960df8adeb4fa731ce83c --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/FormDomain/RawCutoffGradientIntegral.lean @@ -0,0 +1,77 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.NormalizationDerivative +import OAI.Analysis.HardSphere.Comparison.RawAngleLiftSumSquares + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open PeriodicCutoff + +lemma rawCutoff_gradient_integral_le (n : ℕ) (L : Length) {r M : ℝ} (hr : 0 exact h + | succ m hnm ih => exact rayleigh_successor (hn.trans_le hnm) ih + +lemma IsGroundVector.rayleigh_larger {n m : ℕ} {L : Length} {a : ℝ} + {u : Jet n L} (hu : IsGroundVector n L a u) (hn : 0 < n) (hnm : n ≤ m) + (v : Jet m L) (hv : v∈dirichletDomain m L a) : + (energy u/(n:ℝ))*(m:ℝ)*‖v.1‖^2≤energy v := by + apply HardSphere.rayleigh_larger hn hnm (c := energy u/(n:ℝ)) ?_ v hv + intro w hw + rw [div_mul_cancel₀ _ (by exact_mod_cast hn.ne')] + exact hu.rayleigh_all w hw + +lemma IsGroundVector.energy_per_particle_mono {n m : ℕ} {L : Length} {a : ℝ} + {u : Jet n L} {v : Jet m L} (hu : IsGroundVector n L a u) + (hv : IsGroundVector m L a v) (hn : 0 < n) (hnm : n ≤ m) : + energy u/(n:ℝ)≤energy v/(m:ℝ) := by + have h := hu.rayleigh_larger hn hnm v hv.1 + rw [hv.2.2.1,pow_two,mul_one,mul_one] at h + exact (le_div_iff₀ (by exact_mod_cast hn.trans_le hnm)).mpr h + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/FormDomain/RmsPermuteFunBosonic.lean b/lean/OAI/Analysis/HardSphere/FormDomain/RmsPermuteFunBosonic.lean new file mode 100644 index 0000000000000000000000000000000000000000..bcd3e1775affc0943b8f0ab77cb4fd66594606e7 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/FormDomain/RmsPermuteFunBosonic.lean @@ -0,0 +1,71 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.FirstVariation +import OAI.Analysis.HardSphere.Geometry.TestVector + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +variable {N : ℕ} {L : Length} {a : ℝ} + +lemma rmsPermute_fun_bosonic (f : SmoothTest N L a) (ε : ℝ) (τ : Equiv.Perm (Fin N)) + (X : Configuration N L) : + rmsTestFun (fun σ ↦ f.permute σ) ε (permuteConfiguration τ X)= + rmsTestFun (fun σ ↦ f.permute σ) ε X := by + unfold rmsTestFun HilbertRegularization.regularize + have hsum : ‖testVector (fun σ ↦ f.permute σ) (permuteConfiguration τ X)‖^2= + ‖testVector (fun σ ↦ f.permute σ) X‖^2 := by + simp only [EuclideanSpace.norm_sq_eq,testVector,SmoothTest.permute,Function.comp_apply] + exact Equiv.sum_comp (Equiv.mulLeft τ) (fun σ ↦ ‖f.toFun (permuteConfiguration σ X)‖^2) + rw [hsum] + +lemma rmsPermute_bosonic (f : SmoothTest N L a) {ε : ℝ} (hε : 0<ε) : + bosonic (SmoothTest.rms (fun σ ↦ f.permute σ) hε).jet.1 := by + intro τ + let g := SmoothTest.rms (fun σ ↦ f.permute σ) hε + have hg : (g.jet.1 : Configuration N L → ℂ)=ᵐ[volume] g.toFun := g.memLp.coeFn_toLp + have hgt := (measurePreserving_permute τ).quasiMeasurePreserving.ae_eq_comp hg + filter_upwards [hgt,hg] with X hX hY + exact hX.trans ((rmsPermute_fun_bosonic f ε τ X).trans hY.symm) + +lemma IsGroundVector.rayleigh_smooth_all {u : Jet N L} (hu : IsGroundVector N L a u) + (f : SmoothTest N L a) : energy u*‖f.jet.1‖^2≤energy f.jet := by + classical + let e : ℕ → ℝ := fun k ↦ 1/((k:ℝ)+1) + have he (k) : 0 simpa only [Fin.insertNth_apply_same] using + (contDiff_const : ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) (fun _ : LiftedConfiguration n ↦ x)) + | p i => simpa only [Fin.insertNth_apply_succAbove] using + (contDiff_apply ℝ (Fin 3 → ℝ) i) + +lemma smooth_slice {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest (n+1) L a) + (j : Fin (n+1)) (x : Torus L) : + ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) + (fun Y : LiftedConfiguration n ↦ f.toFun (j.insertNth x (project n L Y))) := by + have h := f.smooth.comp (smooth_insertNth j (representative 1 L (fun _ ↦ x) 0)) + convert h using 1 + funext Y + congr 1 + ext i q + induction i using j.succAboveCases with + | x => + simp only [project,Fin.insertNth_apply_same] + exact (congr_fun (congr_fun (project_representative 1 L (fun _ ↦ x)) 0) q).symm + | p i => simp only [project,Fin.insertNth_apply_succAbove] + +lemma insertNth_coordinateLine {n : ℕ} {L : Length} (j : Fin (n+1)) (x : Torus L) + (Y : Configuration n L) (p : Direction n) (t : AddCircle L.val) : + j.insertNth x (coordinateLine Y p t)=coordinateLine (j.insertNth x Y) (j.succAbove p.1,p.2) t := by + ext i q + induction i using j.succAboveCases with + | x => simp [coordinateLine] + | p i => simp [coordinateLine,Pi.single_apply,Fin.succAbove_inj] + +lemma coordDerivative_slice {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest (n+1) L a) + (j : Fin (n+1)) (x : Torus L) (p : Direction n) : + coordDerivative n L (fun Y ↦ f.toFun (j.insertNth x Y)) p= + fun Y ↦ coordDerivative (n+1) L f.toFun (j.succAbove p.1,p.2) (j.insertNth x Y) := by + funext Y + have h1 := hasDerivAt_coordinateLine (f := fun Y ↦ f.toFun (j.insertNth x Y)) ((smooth_slice f j x).differentiable (by simp)) Y p 0 + have h2 := hasDerivAt_coordinateLine (f.smooth.differentiable (by simp)) + (j.insertNth x Y) (j.succAbove p.1,p.2) 0 + simp only [insertNth_coordinateLine] at h1 + have h := h1.unique h2 + simpa [coordinateLine] using h + +def SmoothTest.slice {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest (n+1) L a) + (j : Fin (n+1)) (x : Torus L) : SmoothTest n L a where + toFun Y := f.toFun (j.insertNth x Y) + smooth := smooth_slice f j x + compact := HasCompactSupport.of_compactSpace _ + support_allowed := by + intro Y hY i k hik + have h := f.support_allowed (tsupport_comp_subset_preimage f.toFun + (Continuous.finInsertNth j (continuous_const : Continuous (fun _ : Configuration n L ↦ x)) continuous_id) hY) + simpa only [Fin.insertNth_apply_succAbove,id_eq] using h (j.succAbove i) (j.succAbove k) + (Fin.strictMono_succAbove j hik) + memLp := (f.continuous.comp (Continuous.finInsertNth j (continuous_const : Continuous (fun _ : Configuration n L ↦ x)) continuous_id)).memLp_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) + partial_memLp := fun p ↦ by + rw [coordDerivative_slice] + exact ((f.continuous_partial (j.succAbove p.1,p.2)).comp + (Continuous.finInsertNth j (continuous_const : Continuous (fun _ : Configuration n L ↦ x)) continuous_id)).memLp_of_hasCompactSupport (HasCompactSupport.of_compactSpace _) + +lemma smoothTest_norm_sq {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest n L a) : + ‖f.jet.1‖^2=∫ X : Configuration n L, ‖f.toFun X‖^2 := by + rw [IndicatorStrong.norm_sq_integral] + exact integral_congr_ae ((MemLp.coeFn_toLp f.memLp).fun_comp (fun z : ℂ ↦ ‖z‖^2)) + +lemma smoothTest_partial_norm_sq {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest n L a) + (p : Direction n) : + ‖f.jet.2 p‖^2=∫ X : Configuration n L, ‖coordDerivative n L f.toFun p X‖^2 := by + rw [IndicatorStrong.norm_sq_integral] + exact integral_congr_ae ((MemLp.coeFn_toLp (f.partial_memLp p)).fun_comp (fun z : ℂ ↦ ‖z‖^2)) + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Fourier/ArgumentAdd.lean b/lean/OAI/Analysis/HardSphere/Fourier/ArgumentAdd.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5c8d4acbb24888e24faad1f9dc327714579efb9 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Fourier/ArgumentAdd.lean @@ -0,0 +1,208 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.PartialIndex +import OAI.Analysis.HardSphere.Geometry.ConfigurationPath + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace HardSphere.FreeFourier +lemma argument_add (L : ℝ) (n : ℤ) (x y : AddCircle L) : + fourier n (x+y) = fourier n x * fourier n y := by + simp only [fourier_apply, smul_add, AddCircle.toCircle_add, Circle.coe_mul] + +lemma gaussian_character (L : ℝ) (n : ℤ) (t : ℝ) (ht : 0 ≤ t) : + (∫ x : ℝ, fourier n ((Real.sqrt (2*t) * x : ℝ) : AddCircle L) + ∂gaussianReal 0 1) = (Real.exp (-t * (2*Real.pi*n/L)^2) : ℂ) := by + have h := charFun_gaussianReal (μ := 0) (v := 1) ((2*Real.pi*n/L)*Real.sqrt (2*t)) + rw [charFun_apply_real] at h + have he (x : ℝ) : fourier n ((Real.sqrt (2*t)*x : ℝ) : AddCircle L) = + Complex.exp (((2*Real.pi*n/L)*Real.sqrt (2*t)*x : ℝ) * Complex.I) := by + rw [fourier_coe_apply] + push_cast + congr 1 + ring + simp_rw [he] + simp only [Complex.ofReal_mul] at h ⊢ + rw [h, Complex.ofReal_exp] + congr 1 + have hs := Real.sq_sqrt (show 0 ≤ 2*t by positivity) + push_cast at hs ⊢ + simp only [mul_zero, zero_mul, one_mul, zero_sub] + rw [mul_pow] + norm_cast at hs + have hs' : (Real.sqrt (2*t) : ℂ)^2 = 2*t := by exact_mod_cast hs + rw [hs'] + ring +end HardSphere.FreeFourier + +namespace HardSphere +open Wiener ProbabilityTheory +open scoped ComplexConjugate + +def configurationCharacter (N : ℕ) (L : Length) (k : Direction N → ℤ) : + C(Configuration N L, ℂ) where + toFun X := ∏ p : Direction N, fourier (k p) (X p.1 p.2) + continuous_toFun := by fun_prop + +lemma configurationCharacter_norm (N : ℕ) (L : Length) (k : Direction N → ℤ) + (X : Configuration N L) : ‖configurationCharacter N L k X‖ = 1 := by + simp only [configurationCharacter, ContinuousMap.coe_mk, norm_prod, fourier_apply, + Circle.norm_coe, Finset.prod_const_one] + +lemma configurationCharacter_add_argument (N : ℕ) (L : Length) (k : Direction N → ℤ) + (X Y : Configuration N L) : + configurationCharacter N L k (X+Y) = + configurationCharacter N L k X * configurationCharacter N L k Y := by + simp only [configurationCharacter, ContinuousMap.coe_mk, Pi.add_apply, + FreeFourier.argument_add, Finset.prod_mul_distrib] + +lemma wiener_endpoint_law : HasLaw (fun w : C(Time,ℝ) ↦ w 1) (gaussianReal 0 1) wiener := by + simpa using wiener_projection_law (ι := Unit) (fun _ ↦ (1:ℝ)) (fun _ ↦ (1:Time)) + +lemma wiener_character (L : Length) (n : ℤ) (t : ℝ) (ht : 0 ≤ t) : + (∫ w : C(Time,ℝ), fourier n ((Real.sqrt (2*t)*w 1 : ℝ) : AddCircle L.val) ∂wiener) = + (Real.exp (-t*(2*Real.pi*n/L.val)^2) : ℂ) := by + have hcont : Continuous (fun x : ℝ ↦ fourier n ((Real.sqrt (2*t)*x : ℝ) : AddCircle L.val)) := by + fun_prop + exact (wiener_endpoint_law.integral_comp hcont.aestronglyMeasurable).trans + (FreeFourier.gaussian_character L.val n t ht) + +def fourierEnergy (N : ℕ) (L : Length) (k : Direction N → ℤ) : ℝ := + ∑ p : Direction N, (((2 : ℕ) : ℝ)*Real.pi*k p/L.val)^2 + +lemma fourierEnergy_nonneg (N : ℕ) (L : Length) (k : Direction N → ℤ) : + 0 ≤ fourierEnergy N L k := Finset.sum_nonneg fun _ _ ↦ sq_nonneg _ + +lemma freeTrajectory_character_integral (N : ℕ) (L : Length) (k : Direction N → ℤ) + (t : ℝ) (ht : 0 ≤ t) (X : Configuration N L) : + (∫ w, configurationCharacter N L k (freeTrajectory N L t w X 1) ∂coordinateWiener N) = + configurationCharacter N L k X * (Real.exp (-t * fourierEnergy N L k) : ℂ) := by + have hpoint (w : CoordinatePaths N) : + configurationCharacter N L k (freeTrajectory N L t w X 1) = + configurationCharacter N L k X * + ∏ p : Direction N, fourier (k p) ((Real.sqrt (2*t)*w p 1 : ℝ) : AddCircle L.val) := by + simp only [configurationCharacter, freeTrajectory, ContinuousMap.coe_mk, + FreeFourier.argument_add, Finset.prod_mul_distrib] + simp_rw [hpoint] + rw [integral_const_mul] + congr 1 + rw [coordinateWiener, integral_fintype_prod_eq_prod + (fun p (w : C(Time,ℝ)) ↦ fourier (k p) ((Real.sqrt (2*t)*w 1 : ℝ) : AddCircle L.val))] + simp_rw [wiener_character L _ t ht] + rw [← Complex.ofReal_prod, ← Real.exp_sum] + congr 2 + simp only [fourierEnergy, Nat.cast_ofNat, Finset.mul_sum] + +end HardSphere + +namespace HardSphere +open scoped ComplexConjugate +open Submodule Algebra +lemma configurationCharacter_neg (N : ℕ) (L : Length) (k : Direction N → ℤ) + (X : Configuration N L) : + configurationCharacter N L (-k) X = conj (configurationCharacter N L k X) := by + simp only [configurationCharacter, Pi.neg_apply, fourier_neg, ContinuousMap.coe_mk, map_prod] + +lemma configurationCharacter_add (N : ℕ) (L : Length) (k l : Direction N → ℤ) + (X : Configuration N L) : + configurationCharacter N L (k+l) X = + configurationCharacter N L k X * configurationCharacter N L l X := by + simp only [configurationCharacter, Pi.add_apply, fourier_add, ContinuousMap.coe_mk, + Finset.prod_mul_distrib] + +lemma configurationCharacter_zero (N : ℕ) (L : Length) : + configurationCharacter N L (0 : Direction N → ℤ) = 1 := by + ext X + simp only [configurationCharacter, Pi.zero_apply, fourier_zero, Finset.prod_const_one, + ContinuousMap.coe_mk, ContinuousMap.one_apply] + +lemma configurationCharacter_single (N : ℕ) (L : Length) (p : Direction N) + (X : Configuration N L) : + configurationCharacter N L (Pi.single p 1) X = fourier 1 (X p.1 p.2) := by + classical + change (∏ q : Direction N, fourier ((Pi.single p 1 : Direction N → ℤ) q) (X q.1 q.2)) = _ + rw [Finset.prod_eq_single p] + · simp + · intro q _ hqp + simp only [Pi.single_eq_of_ne hqp, fourier_zero] + · simp + +def characterAlgebra (N : ℕ) (L : Length) : StarSubalgebra ℂ C(Configuration N L, ℂ) where + toSubalgebra := Algebra.adjoin ℂ (range (configurationCharacter N L)) + star_mem' := by + change Algebra.adjoin ℂ (range (configurationCharacter N L)) ≤ + star (Algebra.adjoin ℂ (range (configurationCharacter N L))) + refine adjoin_le ?_ + rintro _ ⟨k,rfl⟩ + refine subset_adjoin ⟨-k, ?_⟩ + ext X + simp only [configurationCharacter_neg, starRingEnd_apply, ContinuousMap.star_apply] + +lemma characterAlgebra_eq_span (N : ℕ) (L : Length) : + (characterAlgebra N L).toSubalgebra.toSubmodule = + span ℂ (range (configurationCharacter N L)) := by + apply adjoin_eq_span_of_subset + refine .trans (fun x ↦ Submonoid.closure_induction (fun _ ↦ id) ⟨0, ?_⟩ ?_) subset_span + · exact configurationCharacter_zero N L + · rintro _ _ _ _ ⟨k,rfl⟩ ⟨l,rfl⟩ + exact ⟨k+l,ContinuousMap.ext fun X ↦ configurationCharacter_add N L k l X⟩ + +lemma characterAlgebra_separates (N : ℕ) (L : Length) : + (characterAlgebra N L).SeparatesPoints := by + classical + intro X Y hXY + obtain ⟨i,hi⟩ := Function.ne_iff.mp hXY + obtain ⟨j,hj⟩ := Function.ne_iff.mp hi + refine ⟨_, ⟨configurationCharacter N L (Pi.single (i,j) 1), + subset_adjoin ⟨Pi.single (i,j) 1,rfl⟩,rfl⟩, ?_⟩ + dsimp only + rw [configurationCharacter_single, configurationCharacter_single, fourier_one, fourier_one] + exact fun h ↦ hj (AddCircle.injective_toCircle L.property.ne' (Circle.coe_injective h)) + +lemma character_span_dense (N : ℕ) (L : Length) : + (span ℂ (range (configurationCharacter N L))).topologicalClosure = ⊤ := by + rw [← characterAlgebra_eq_span] + exact congrArg (Subalgebra.toSubmodule ∘ StarSubalgebra.toSubalgebra) + (ContinuousMap.starSubalgebra_topologicalClosure_eq_top_of_separatesPoints _ + (characterAlgebra_separates N L)) + +section + +attribute [local instance] scalarL2_addCommMonoid scalarL2_module + +local instance complexBoundedSMul : IsBoundedSMul ℂ ℂ := inferInstance + +def characterL2 (N : ℕ) (L : Length) (k : Direction N → ℤ) : ScalarL2 N L := + DFunLike.coe (F := C(Configuration N L, ℂ) →L[ℂ] ScalarL2 N L) + (β := fun _ ↦ ScalarL2 N L) + (@ContinuousMap.toLp _ ℂ _ _ volume _ _ _ _ _ _ ℂ _ _ _ complexBoundedSMul) + (configurationCharacter N L k) + +end + +lemma characterL2_ae (N : ℕ) (L : Length) (k : Direction N → ℤ) : + characterL2 N L k =ᵐ[volume] configurationCharacter N L k := + ContinuousMap.coeFn_toLp volume _ + +lemma characterL2_span_dense (N : ℕ) (L : Length) : + (span ℂ (range (characterL2 N L))).topologicalClosure = ⊤ := by + convert (ContinuousMap.toLp_denseRange ℂ (volume : Measure (Configuration N L)) ℂ + (show (2:ℝ≥0∞) ≠ ∞ by norm_num)).topologicalClosure_map_submodule + (character_span_dense N L) using 1 + rw [map_span] + unfold characterL2 + rw [range_comp'] + rfl + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Fourier/CharacterDerivativeFactor.lean b/lean/OAI/Analysis/HardSphere/Fourier/CharacterDerivativeFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..4cc995c1bff2c41dec7799ed305885ad03cae7b2 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Fourier/CharacterDerivativeFactor.lean @@ -0,0 +1,213 @@ +import Mathlib +import OAI.Analysis.HardSphere.Operators.FreeTransition +import OAI.Analysis.HardSphere.Geometry.CoordinateLine +import OAI.Analysis.HardSphere.Geometry.HeatScalar + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace HardSphere +open scoped ComplexConjugate + +lemma configurationCharacter_smooth (N : ℕ) (L : Length) (k : Direction N → ℤ) : + configurationCharacter N L k ∈ smoothAlgebra N L := by + change ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ ∏ p : Direction N, fourier (k p) (X p.1 p.2 : AddCircle L.val)) + apply contDiff_prod + intro p _ + simp_rw [fourier_coe_apply] + exact Complex.contDiff_exp.comp + ((((contDiff_const.mul contDiff_const).mul contDiff_const).mul contDiff_const).mul + (Complex.ofRealCLM.contDiff.comp (contDiff_apply_apply ℝ ℝ p.1 p.2)) |>.div_const _) + +lemma configurationCharacter_single_argument (N : ℕ) (L : Length) (k : Direction N → ℤ) + (p : Direction N) (z : AddCircle L.val) : + configurationCharacter N L k (Pi.single p.1 (Pi.single p.2 z))=fourier (k p) z := by + unfold configurationCharacter + simp only [ContinuousMap.coe_mk] + rw [Finset.prod_eq_single p] + · simp + · intro q _ hq + have hh : q.1≠p.1 ∨ q.2≠p.2 := by + by_contra hh + push Not at hh + exact hq (Prod.ext hh.1 hh.2) + rcases hh with h | h + · simp [Pi.single_eq_of_ne h] + · by_cases h' : q.1=p.1 <;> simp [h',Pi.single_eq_of_ne h] + · simp + +lemma configurationCharacter_coordinateLine (N : ℕ) (L : Length) (k : Direction N → ℤ) + (X : Configuration N L) (p : Direction N) (z : AddCircle L.val) : + configurationCharacter N L k (coordinateLine X p z)= + configurationCharacter N L k X * fourier (k p) z := by + rw [coordinateLine,configurationCharacter_add_argument,configurationCharacter_single_argument] + +def characterDerivativeFactor (L : Length) (n : ℤ) : ℂ := + ((2 : ℕ) : ℂ)*Real.pi*Complex.I*n/L.val + +lemma configurationCharacter_partial (N : ℕ) (L : Length) (k : Direction N → ℤ) + (p : Direction N) (X : Configuration N L) : + coordDerivative N L (configurationCharacter N L k) p X = + characterDerivativeFactor L (k p)*configurationCharacter N L k X := by + have h := hasDerivAt_coordinateLine + ((show ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) (fun Z : LiftedConfiguration N ↦ configurationCharacter N L k (project N L Z)) from configurationCharacter_smooth N L k).differentiable (by simp)) X p 0 + have g := (hasDerivAt_fourier L.val (k p) 0).const_mul (configurationCharacter N L k X) + simp_rw [configurationCharacter_coordinateLine] at h + have heq := h.unique g + simpa [coordinateLine,characterDerivativeFactor,mul_comm] using heq + +lemma character_smoothPartial (N : ℕ) (L : Length) (k : Direction N → ℤ) (p : Direction N) : + smoothPartial ⟨configurationCharacter N L k,configurationCharacter_smooth N L k⟩ p = + characterDerivativeFactor L (k p) • configurationCharacter N L k := by + ext X + exact configurationCharacter_partial N L k p X + +lemma character_weak_derivative {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : u∈dirichletDomain N L a) (k : Direction N → ℤ) (p : Direction N) : + inner ℂ (characterL2 N L k) (u.2 p) = + -conj (characterDerivativeFactor L (k p)) * inner ℂ (characterL2 N L k) u.1 := by + have h := weak_derivative hu ⟨configurationCharacter N L k,configurationCharacter_smooth N L k⟩ p + rw [character_smoothPartial,map_smul,inner_smul_left] at h + change inner ℂ (characterL2 N L k) (u.2 p) + + conj (characterDerivativeFactor L (k p)) * inner ℂ (characterL2 N L k) u.1 = 0 at h + linear_combination h + +lemma allowed_of_neg (N : ℕ) (L : Length) {a : ℝ} (ha : a<0) : allowed N L a=Set.univ := by + ext X + simp only [Set.mem_univ,iff_true] + intro i j _ + exact ha.trans_le (Real.sqrt_nonneg _) + +def characterTest (N : ℕ) (L : Length) (a : ℝ) (ha : a<0) (k : Direction N → ℤ) : + SmoothTest N L a where + toFun := configurationCharacter N L k + smooth := configurationCharacter_smooth N L k + compact := HasCompactSupport.of_compactSpace _ + support_allowed := by rw [allowed_of_neg N L ha]; exact Set.subset_univ _ + memLp := (configurationCharacter N L k).continuous.memLp_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) + partial_memLp p := by + have heq : coordDerivative N L (configurationCharacter N L k) p = + fun X ↦ characterDerivativeFactor L (k p)*configurationCharacter N L k X := + funext (configurationCharacter_partial N L k p) + rw [heq] + exact ((configurationCharacter N L k).continuous.const_mul _).memLp_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) + +lemma characterTest_jet (N : ℕ) (L : Length) (a : ℝ) (ha : a<0) (k : Direction N → ℤ) : + (characterTest N L a ha k).jet= + (characterL2 N L k,fun p ↦ characterDerivativeFactor L (k p) • characterL2 N L k) := by + apply Prod.ext + · apply Lp.ext + exact (characterTest N L a ha k).memLp.coeFn_toLp.trans (characterL2_ae N L k).symm + · funext p + apply Lp.ext + filter_upwards [(characterTest N L a ha k).partial_memLp p |>.coeFn_toLp, + Lp.coeFn_smul (characterDerivativeFactor L (k p)) (characterL2 N L k),characterL2_ae N L k] with X h₁ h₂ h₃ + change ((characterTest N L a ha k).partial_memLp p).toLp _ X = _ + rw [h₁,h₂] + change coordDerivative N L (configurationCharacter N L k) p X = + characterDerivativeFactor L (k p) * (characterL2 N L k) X + rw [h₃] + exact configurationCharacter_partial N L k p X + +lemma character_factor_square (L : Length) (n : ℤ) : + -(conj (characterDerivativeFactor L n))^2 = ((2*Real.pi*n/L.val)^2:ℝ) := by + simp only [characterDerivativeFactor,Nat.cast_ofNat,map_div₀,map_mul,map_ofNat,Complex.conj_ofReal, + Complex.conj_I,Complex.ofReal_pow,Complex.ofReal_div,Complex.ofReal_mul,Complex.ofReal_ofNat,map_intCast,Complex.ofReal_intCast] + ring_nf + simp only [Complex.I_sq] + ring + +lemma character_form_pairing (N : ℕ) (L : Length) (a : ℝ) (ha : a<0) + (k : Direction N → ℤ) {v : Jet N L} (hv : v∈dirichletDomain N L a) : + Variational.gradientPairing (characterTest N L a ha k).jet v = + (fourierEnergy N L k:ℂ) * inner ℂ (characterL2 N L k) v.1 := by + rw [characterTest_jet] + change (∑ p : Direction N, inner ℂ (characterDerivativeFactor L (k p) • characterL2 N L k) (v.2 p)) = _ + simp_rw [inner_smul_left,character_weak_derivative hv] + have hterm (p : Direction N) : + conj (characterDerivativeFactor L (k p)) * + (-conj (characterDerivativeFactor L (k p)) * inner ℂ (characterL2 N L k) v.1) = + (((2*Real.pi*k p/L.val)^2:ℝ):ℂ)*inner ℂ (characterL2 N L k) v.1 := by + rw [← character_factor_square] + ring + simp_rw [hterm] + rw [← Finset.sum_mul] + simp only [fourierEnergy,Nat.cast_ofNat,Complex.ofReal_sum] + +lemma character_resolvent (N : ℕ) (L : Length) (a : ℝ) (ha : a<0) (k : Direction N → ℤ) : + formResolvent N L a (characterL2 N L k) = + ((1+(fourierEnergy N L k:ℂ))⁻¹) • characterL2 N L k := by + let u := (characterTest N L a ha k).jet + have hu : u∈dirichletDomain N L a := subset_closure ⟨characterTest N L a ha k,rfl⟩ + have huf : u.1=characterL2 N L k := congrArg Prod.fst (characterTest_jet N L a ha k) + let ug : hilbertDomain N L a := ⟨(hilbertJetEquiv N L).symm u,by + change hilbertJetEquiv N L ((hilbertJetEquiv N L).symm u) ∈ dirichletSubmodule N L a + simpa using hu⟩ + have hE := fourierEnergy_nonneg N L k + have hne : 1+(fourierEnergy N L k:ℂ) ≠ 0 := by + have hreal : (1:ℝ)+fourierEnergy N L k ≠ 0 := ne_of_gt (by linarith) + exact_mod_cast hreal + have heq : (scalarEmbedding N L a).adjoint (characterL2 N L k) = + ((1+(fourierEnergy N L k:ℂ))⁻¹) • ug := by + apply ext_inner_right ℂ + intro v + rw [ContinuousLinearMap.adjoint_inner_left] + rw [inner_smul_left ug v ((1+(fourierEnergy N L k:ℂ))⁻¹)] + have hv : hilbertJetEquiv N L (v : HilbertJet N L) ∈ dirichletDomain N L a := v.property + have hg : inner ℂ ug v = (1+(fourierEnergy N L k:ℂ))* + inner ℂ (characterL2 N L k) (scalarEmbedding N L a v) := by + change inner ℂ (ug : HilbertJet N L) (v : HilbertJet N L) = _ + rw [hilbertJet_inner] + have hgu : hilbertJetEquiv N L (ug : HilbertJet N L) = u := by simp [ug] + rw [hgu,huf] + have hh := character_form_pairing N L a ha k hv + change (∑ p : Direction N, inner ℂ (u.2 p) + ((hilbertJetEquiv N L (v : HilbertJet N L)).2 p)) = _ at hh + rw [hh] + change inner ℂ (characterL2 N L k) (scalarEmbedding N L a v) + + (fourierEnergy N L k:ℂ)*inner ℂ (characterL2 N L k) (scalarEmbedding N L a v) = _ + ring + rw [hg] + simp only [map_inv₀,map_add,map_one,Complex.conj_ofReal] + rw [← mul_assoc,inv_mul_cancel₀ hne,one_mul] + change scalarEmbedding N L a ((scalarEmbedding N L a).adjoint (characterL2 N L k)) = _ + rw [heq,map_smul] + congr 1 + +lemma character_formHeat (N : ℕ) (L : Length) (a : ℝ) (ha : a<0) {t : ℝ} + (ht : 0 simp [h] + +lemma killedTransition_zero (N : ℕ) (L : Length) (a : ℝ) : + killedTransition N L a 0=allowedProjection N L a := by + apply ContinuousLinearMap.ext_on (s := Set.range (ContinuousMap.toLp 2 volume ℂ)) + · exact (ContinuousMap.toLp_denseRange ℂ volume ℂ (by norm_num : (2:ℝ≥0∞)≠∞)).mono + (Submodule.subset_span) + · rintro _ ⟨g,rfl⟩ + apply Lp.ext + filter_upwards [killedTransition_continuous_ae N L a 0 g, + allowedProjection_ae N L a (ContinuousMap.toLp 2 volume ℂ g), + ContinuousMap.coeFn_toLp (𝕜 := ℂ) (p := 2) volume g] with X h1 h2 h3 + rw [h1,killedAverage_zero,h2] + by_cases h : X∈allowed N L a + · simpa only [Set.indicator_of_mem h] using h3.symm + · simp only [Set.indicator_of_notMem h] + +lemma allowedProjection_killedTransition (N : ℕ) (L : Length) (a t : ℝ) : + (allowedProjection N L a).comp (killedTransition N L a t)=killedTransition N L a t := by + apply ContinuousLinearMap.ext_on (s := Set.range (ContinuousMap.toLp 2 volume ℂ)) + · exact (ContinuousMap.toLp_denseRange ℂ volume ℂ (by norm_num : (2:ℝ≥0∞)≠∞)).mono + (Submodule.subset_span) + · rintro _ ⟨g,rfl⟩ + apply Lp.ext + filter_upwards [killedTransition_continuous_ae N L a t g, + allowedProjection_ae N L a (killedTransition N L a t (ContinuousMap.toLp 2 volume ℂ g))] + with X h1 h2 + change (allowedProjection N L a (killedTransition N L a t (ContinuousMap.toLp 2 volume ℂ g))) X=_ + rw [h2] + by_cases h : X∈allowed N L a + · exact Set.indicator_of_mem h _ + · rw [Set.indicator_of_notMem h,h1,killedAverage_zero_of_not_allowed N L a t g h] + +lemma killedTransition_allowedProjection (N : ℕ) (L : Length) (a t : ℝ) : + (killedTransition N L a t).comp (allowedProjection N L a)=killedTransition N L a t := by + have he := congrArg ContinuousLinearMap.adjoint (allowedProjection_killedTransition N L a t) + rw [adjoint_comp,← killedTransition_zero N L a, + (killedTransition_selfAdjoint N L a 0).adjoint_eq, + (killedTransition_selfAdjoint N L a t).adjoint_eq] at he + simpa only [killedTransition_zero] using he + +lemma killedTransition_support (N : ℕ) (L : Length) (a t : ℝ) (f : ScalarL2 N L) : + ∀ᵐ X ∂(volume : Measure (Configuration N L)), X∉allowed N L a → killedTransition N L a t f X=0 := by + have he := congrArg (fun A : ScalarL2 N L→L[ℂ] ScalarL2 N L ↦ A f) + (allowedProjection_killedTransition N L a t) + change allowedProjection N L a (killedTransition N L a t f)=killedTransition N L a t f at he + filter_upwards [allowedProjection_ae N L a (killedTransition N L a t f)] with X hX + rw [he] at hX + intro hn + rw [hX,Set.indicator_of_notMem hn] + +lemma killedTransition_add_nonneg (N : ℕ) (L : Length) (a s t : ℝ) (hs : 0 ≤ s) (ht : 0 ≤ t) : + killedTransition N L a (s+t)=(killedTransition N L a s).comp (killedTransition N L a t) := by + rcases hs.eq_or_lt with hs | hs + · rw [← hs,zero_add,killedTransition_zero,allowedProjection_killedTransition] + rcases ht.eq_or_lt with ht | ht + · rw [← ht,add_zero,killedTransition_zero,killedTransition_allowedProjection] + exact killedTransition_add N L a s t hs ht + +end HardSphere + +namespace HardSphere + +lemma exists_bounded_lift_of_tendsto {E F ι : Type*} + [NormedAddCommGroup E] [NormedAddCommGroup F] + [InnerProductSpace ℂ E] [InnerProductSpace ℂ F] + [CompleteSpace E] [CompleteSpace F] + {l : Filter ι} [l.NeBot] (A : E →L[ℂ] F) (f : ι → E) + {C : ℝ} (hb : ∀ i, ‖f i‖≤C) {u : F} + (hu : Tendsto (fun i ↦ A (f i)) l (𝓝 u)) : + ∃ x : E, ‖x‖≤C ∧ A x=u := by + let φ : ι → WeakDual ℂ E := fun i ↦ (InnerProductSpace.toDual ℂ E (f i)).toWeakDual + have hφ : ∀ i, φ i∈WeakDual.toStrongDual ⁻¹' Metric.closedBall 0 C := by + intro i + simpa only [Set.mem_preimage,Metric.mem_closedBall,dist_zero_right,φ, + StrongDual.toStrongDual_toWeakDual,(InnerProductSpace.toDual ℂ E).norm_map] using hb i + obtain ⟨ψ,hψ,hcluster⟩ := (WeakDual.isCompact_closedBall (0 : StrongDual ℂ E) C).exists_mapClusterPt + (show Filter.map φ l≤𝓟 (WeakDual.toStrongDual ⁻¹' Metric.closedBall 0 C) from + Filter.le_principal_iff.mpr (Filter.eventually_map.mpr (Eventually.of_forall hφ))) + let x : E := (InnerProductSpace.toDual ℂ E).symm ψ.toStrongDual + refine ⟨x,?_,?_⟩ + · change ‖(InnerProductSpace.toDual ℂ E).symm ψ.toStrongDual‖≤C + simpa only [Set.mem_preimage,Metric.mem_closedBall,dist_zero_right, + (InnerProductSpace.toDual ℂ E).symm.norm_map] using hψ + · apply ext_inner_right ℂ + intro v + have hv : Tendsto (fun d : WeakDual ℂ E ↦ d (A.adjoint v)) + (Filter.map φ l) (𝓝 (inner ℂ u v)) := by + rw [tendsto_map'_iff] + have h := hu.inner (𝕜 := ℂ) (tendsto_const_nhds (x := v)) + simpa only [Function.comp_def,φ,StrongDual.toWeakDual_apply, + InnerProductSpace.toDual_apply_apply,ContinuousLinearMap.adjoint_inner_right] using h + have hct := hcluster.map (WeakDual.eval_continuous (A.adjoint v)).continuousAt hv + have he : ψ (A.adjoint v)=inner ℂ u v := by + exact eq_of_nhds_neBot hct + simpa only [x,← WeakDual.toStrongDual_apply,← InnerProductSpace.toDual_symm_apply, + ContinuousLinearMap.adjoint_inner_right] using he + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/AnimalFamily.lean b/lean/OAI/Analysis/HardSphere/Geometry/AnimalFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..daaee74d629a0bfd68020f51d7e1d96a7dbfc2c6 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/AnimalFamily.lean @@ -0,0 +1,167 @@ +import Mathlib +import OAI.Analysis.HardSphere.Conditioning.PairCloseLabels +import OAI.Analysis.HardSphere.Geometry.MicroPeriod +import OAI.Analysis.HardSphere.Geometry.BadGraph + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped BigOperators Classical ENNReal +namespace HardSphere.Lattice +universe u +variable {V : Type u} [Fintype V] [DecidableEq V] + +def animalFamily (G : SimpleGraph V) (m : ℕ) : Finset (Finset V) := + Finset.univ.biUnion (fun r : V ↦ rootedAnimals G r m) + +lemma animalFamily_card_le (G : SimpleGraph V) (Δ : ℕ) + (hΔ : ∀ x, G.degree x≤Δ) (m : ℕ) : + (animalFamily G m).card ≤ Fintype.card V * (2^Δ)^m := by + calc + _ ≤ ∑ r : V, (rootedAnimals G r m).card := Finset.card_biUnion_le + _ ≤ ∑ _r : V, (2^Δ)^m := Finset.sum_le_sum fun r _ ↦ rootedAnimals_card_le G Δ hΔ r m + _ = _ := by simp + +lemma mem_animalFamily_card (G : SimpleGraph V) (m : ℕ) {F : Finset V} + (hF : F∈animalFamily G m) : F.card=m := by + obtain ⟨r,_,hr⟩ := Finset.mem_biUnion.mp hF + exact (Finset.mem_filter.mp hr).2.2.1 + +def LargeBadComponent (G : SimpleGraph V) (B : Finset V) (m : ℕ) : Prop := + ∃ C∈badComponents G B, m≤C.card + +lemma largeBadComponent_contains_animal (G : SimpleGraph V) (B : Finset V) + (m : ℕ) (hm : 1 ≤ m) (hB : LargeBadComponent G B m) : + ∃ F∈animalFamily G m, F⊆B := by + obtain ⟨C,hC,hmC⟩ := hB + have hc := badComponents_candidate G B hC + simp only [candidateSets,Finset.mem_filter,Finset.mem_univ,true_and] at hc + obtain ⟨r,hr⟩ := hc.1 + obtain ⟨F,hFC,hF⟩ := exists_rooted_subanimal G C hr (hc.2 r hr) m hm hmC + exact ⟨F,Finset.mem_biUnion.mpr ⟨r,Finset.mem_univ r,hF⟩, + hFC.trans (badComponents_subset G B hC)⟩ + +theorem largeBadComponent_probability (G : SimpleGraph V) (Δ : ℕ) + (hΔ : ∀ x, G.degree x≤Δ) (μ : PMF (Finset V)) (p : ℝ≥0∞) + (hbad : JointBadLaw μ p) (m : ℕ) (hm : 1 ≤ m) : + (∑' B, if LargeBadComponent G B m then μ B else 0) ≤ + (Fintype.card V : ℝ≥0∞) * (((2^Δ:ℕ):ℝ≥0∞)*p)^m := by + have hpoint (B : Finset V) : + (if LargeBadComponent G B m then μ B else 0) ≤ + ∑ F∈animalFamily G m, if F⊆B then μ B else 0 := by + by_cases h : LargeBadComponent G B m + · obtain ⟨F,hF,hFB⟩ := largeBadComponent_contains_animal G B m hm h + rw [ite_eq_left h] + calc + μ B = if F⊆B then μ B else 0 := (ite_eq_left hFB).symm + _ ≤ _ := Finset.single_le_sum (f := fun F : Finset V ↦ if F ⊆ B then μ B else 0) + (fun _ _ ↦ zero_le) hF + · rw [ite_eq_right h] + exact zero_le + calc + _ ≤ ∑' B, ∑ F∈animalFamily G m, if F⊆B then μ B else 0 := + ENNReal.tsum_le_tsum hpoint + _ = ∑ F∈animalFamily G m, ∑' B, if F⊆B then μ B else 0 := by + simp only [tsum_fintype] + exact Finset.sum_comm + _ ≤ ∑ _F∈animalFamily G m, p^m := by + apply Finset.sum_le_sum + intro F hF + simpa only [mem_animalFamily_card G m hF] using hbad F + _ = ((animalFamily G m).card:ℝ≥0∞)*p^m := by simp + _ ≤ ((Fintype.card V*(2^Δ)^m:ℕ):ℝ≥0∞)*p^m := by + apply mul_le_mul' _ le_rfl + exact_mod_cast animalFamily_card_le G Δ hΔ m + _ = _ := by simp only [Nat.cast_mul,Nat.cast_pow,mul_pow]; ring + +end HardSphere.Lattice + +namespace HardSphere.BathSlice +open HardSphere.Lattice + +def parent (q : ℕ) (z : Vertex) : Vertex := fun i ↦ z i / (q : ℤ) + +def coarseCenter (L : Length) (v : Vertex) : Torus L := + liftPoint L (fun i ↦ (v i : ℝ)+1/2) + +lemma gridCorner_dist_parent {L : Length} {q : ℕ} (hq : 0 < q) (z : Vertex) : + torusDistance L (gridCorner L (1/(q:ℝ)) z) (coarseCenter L (parent q z)) ≤ 2 := by + change torusDistance L (liftPoint L _) (liftPoint L _) ≤ 2 + have hqr : (0:ℝ) nlinarith [hlo i,hhi i] + simpa only [mul_one] using torusDistance_lift_le_two (by norm_num : (0:ℝ)≤1) hbound + +lemma witnesses_pairClose {m : ℕ} {L : Length} {r s : ℝ} {Y : Configuration m L} + {z : Vertex} {q : ℕ} (hq : 0 < q) (hrs : 6*r ≤ s) {A : Finset (Fin m)} + (hnear : ∀ i ∈ A, torusDistance L (Y i) (gridCorner L (1/(q:ℝ)) z) ≤ 1) + (hpartner : ∀ i ∈ A, ∃ j ∈ A, j ≠ i ∧ torusDistance L (Y i) (Y j) ≤ 6*r) : + A ⊆ pairCloseLabels L s (coarseCenter L (parent q z)) Y := by + classical + intro i hi + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ i,?_,?_⟩ + · have hc := gridCorner_dist_parent (L := L) hq z + have ht := torusDistance_triangle' L (Y i) (gridCorner L (1/(q:ℝ)) z) + (coarseCenter L (parent q z)) + have hn := hnear i hi + linarith + · obtain ⟨j,_,hji,hj⟩ := hpartner i hi + exact ⟨j,hji,hj.trans hrs⟩ + +lemma pairClose_card_mono {m n : ℕ} (L : Length) (s : ℝ) (v : Torus L) + (e : Fin m ↪ Fin n) (X : Configuration n L) : + (pairCloseLabels L s v (fun i ↦ X (e i))).card ≤ (pairCloseLabels L s v X).card := by + classical + have hs : (pairCloseLabels L s v (fun i ↦ X (e i))).map e ⊆ pairCloseLabels L s v X := by + intro i hi + obtain ⟨j,hj,rfl⟩ := Finset.mem_map.mp hi + obtain ⟨_,hv,k,hkj,hk⟩ := Finset.mem_filter.mp hj + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _,hv,e k,fun he ↦ hkj (e.injective he),hk⟩ + simpa only [Finset.card_map] using Finset.card_le_card hs + +theorem large_component_forces_close {m n K : ℕ} {L : Length} {r s D θ : ℝ} + (hr : 0 < r) (hrsmall : r ≤ 1/4096) (hL : 10 < L.val) (hLK : L.val=(K:ℝ)) + (hrs : 6*r ≤ s) (hθ : θ*D ≤ 1/(1372*r)) + (e : Fin m ↪ Fin n) (X : Configuration n L) {z : Vertex} + (hz : z ∈ bad (microMesh r) r (fun i ↦ X (e i))) + (hlarge : ¬ (liftedBadComponent (bad (microMesh r) r (fun i ↦ X (e i))) z).Finite ∨ + ∃ C, IsBadComponent (bad (microMesh r) r (fun i ↦ X (e i))) C ∧ z ∈ C ∧ + ¬ SmallComponent (microMesh r) C) : + θ*D ≤ ((pairCloseLabels L s (coarseCenter L (parent (microPeriod r) z)) X).card:ℝ) := by + have hr1 : r ≤ 1 := by linarith + obtain ⟨hh,hhr,hrh⟩ := microMesh_bounds hr hr1 + have hq : (microPeriod r : ℝ) ≠ 0 := ne_of_gt (by exact_mod_cast microPeriod_pos hr) + have hperiod : L.val = microMesh r * ((K*microPeriod r : ℕ) : ℝ) := by + rw [hLK,Nat.cast_mul,microMesh]; field_simp + obtain ⟨A,hA,hnear,hpartner⟩ := large_component_witnesses hh hhr hrh hrsmall + hperiod hL (fun i ↦ X (e i)) hz hlarge + have hsub := witnesses_pairClose (microPeriod_pos hr) hrs hnear hpartner + have hcard : (A.card:ℝ) ≤ ((pairCloseLabels L s + (coarseCenter L (parent (microPeriod r) z)) X).card:ℝ) := by + exact_mod_cast (Finset.card_le_card hsub).trans (pairClose_card_mono L s _ e X) + apply hθ.trans + have hmul := mul_le_mul_of_nonneg_left hcard hr.le + apply (div_le_iff₀ (by positivity : (0:ℝ)<1372*r)).mpr + nlinarith + +end HardSphere.BathSlice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/AuxiliaryChecks.lean b/lean/OAI/Analysis/HardSphere/Geometry/AuxiliaryChecks.lean new file mode 100644 index 0000000000000000000000000000000000000000..de694c9793476a340ff7c973f5c9d41e5239beda --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/AuxiliaryChecks.lean @@ -0,0 +1,436 @@ +import Mathlib +import OAI.Analysis.HardSphere.Kernels.FiniteKernelPi +import OAI.Analysis.HardSphere.Geometry.LocalCheck + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped ENNReal +open MeasureTheory Function Set Filter +open scoped ENNReal BigOperators +namespace HardSphere.Comparison +open ProbabilityTheory + +section AuxiliaryMarginals +variable {ι : Type*} [DecidableEq ι] {X Z : ι → Type*} + [∀ i, MeasurableSpace (X i)] [∀ i, MeasurableSpace (Z i)] + {C : Type*} [Fintype C] + (checks : C → LocalCheck (fun i ↦ X i × Z i)) + (κ : ∀ i, Kernel (X i) (Z i)) [∀ i, IsFiniteKernel (κ i)] + +def auxiliaryChecks (x : ∀ i, X i) (c : C) : LocalCheck Z where + support := (checks c).support + nonempty := (checks c).nonempty + arity := (checks c).arity + pass := fun z ↦ (checks c).pass (fun i ↦ (x i, z i)) + measurable_pass := (by fun_prop : Measurable (fun z : ∀ i, Z i ↦ fun i ↦ (x i,z i))) + (checks c).measurable_pass + depends := by + intro z w h + apply (checks c).depends + intro i hi + exact Prod.ext rfl (h i hi) + +omit [DecidableEq ι] [Fintype C] in +lemma auxiliary_checkWeight (s : Finset ι) (x : ∀ i, X i) (z : ∀ i, Z i) : + checkWeight (auxiliaryChecks checks x) s z = + checkWeight checks s (fun i ↦ (x i,z i)) := rfl + +def auxiliaryDensity (s : Finset ι) (x : ∀ i, X i) (z : ∀ i, Z i) : ℝ≥0∞ := + checkNormalizer (auxiliaryChecks checks x) (fun i ↦ κ i (x i)) s z + +lemma auxiliaryDensity_delete_le {s t : Finset ι} (hst : Disjoint s t) + (x : ∀ i, X i) (z : ∀ i, Z i) : + auxiliaryDensity checks κ (s ∪ t) x z ≤ + auxiliaryDensity checks κ s x z * ∏ i ∈ t, κ i (x i) Set.univ := + checkNormalizer_delete_le (auxiliaryChecks checks x) hst z + +omit [Fintype C] [∀ i, IsFiniteKernel (κ i)] in +lemma auxiliaryDensity_depends (s : Finset ι) (z : ∀ i, Z i) : + DependsOn (fun x ↦ auxiliaryDensity checks κ s x z) (s : Set ι) := by + intro x y hxy + have hμ : (fun i : s ↦ κ i (x i)) = (fun i : s ↦ κ i (y i)) := by + funext i + rw [hxy i i.property] + change (∫⁻ u, checkWeight (auxiliaryChecks checks x) s + (Function.updateFinset z s u) ∂Measure.pi (fun i : s ↦ κ i (x i))) = _ + rw [hμ] + apply lintegral_congr + intro u + simp only [auxiliary_checkWeight] + apply checkWeight_depends + intro i hi + exact Prod.ext (hxy i hi) rfl + +lemma measurable_auxiliaryDensity (s : Finset ι) (z : ∀ i, Z i) : + Measurable (fun x ↦ auxiliaryDensity checks κ s x z) := by + let κ' (i : s) : Kernel (∀ j, X j) (Z i) := + (κ i).comap (fun x ↦ x i) (measurable_pi_apply (i : ι)) + let η := finiteKernelPi κ' + have hm : Measurable (fun p : (∀ i, X i) × (∀ i : s, Z i) ↦ + checkWeight checks s (fun i ↦ (p.1 i, Function.updateFinset z s p.2 i))) := by + apply (measurable_checkWeight checks s).comp + exact Measurable.of_eval fun i ↦ + ((measurable_pi_apply i).comp measurable_fst).prodMk + ((measurable_pi_apply i).comp ((measurable_updateFinset (x := z) (s := s)).comp + measurable_snd)) + have h := hm.lintegral_kernel_prod_right' (κ := η) + simpa only [η, finiteKernelPi_apply, κ', Kernel.comap_apply, + auxiliaryDensity, checkNormalizer, lmarginal, auxiliary_checkWeight] using h + +lemma auxiliaryDensity_integral (μ : ∀ i, Measure (X i)) [∀ i, IsFiniteMeasure (μ i)] + (s : Finset ι) (x : ∀ i, X i) (z : ∀ i, Z i) : + lmarginal μ s (fun y ↦ auxiliaryDensity checks κ s y z) x = + checkNormalizer checks (fun i ↦ (μ i).compProd (κ i)) s (fun i ↦ (x i,z i)) := by + let f (p : ∀ i : s, X i × Z i) := + checkWeight checks s (Function.updateFinset (fun i ↦ (x i,z i)) s p) + have hf : Measurable f := (measurable_checkWeight checks s).comp measurable_updateFinset + have hh := lintegral_pi_compProd (fun i : s ↦ κ i) (fun i : s ↦ μ i) hf + change (∫⁻ y, auxiliaryDensity checks κ s (Function.updateFinset x s y) z + ∂Measure.pi (fun i : s ↦ μ i)) = (∫⁻ p, f p ∂Measure.pi (fun i : s ↦ (μ i).compProd (κ i))) + rw [hh] + apply lintegral_congr + intro y + change (∫⁻ u, checkWeight (auxiliaryChecks checks (Function.updateFinset x s y)) s + (Function.updateFinset z s u) + ∂Measure.pi (fun i : s ↦ κ i (Function.updateFinset x s y i))) = _ + have hμ : (fun i : s ↦ κ i (Function.updateFinset x s y i)) = (fun i : s ↦ κ i (y i)) := by + funext i + simp [Function.updateFinset, i.property] + rw [hμ] + apply lintegral_congr + intro u + rw [auxiliary_checkWeight] + apply checkWeight_depends + intro i hi + simp [Function.updateFinset, hi] + +end AuxiliaryMarginals + +section OverlapProducts +variable {ι : Type*} [DecidableEq ι] {X : ι → Type*} + [∀ i, MeasurableSpace (X i)] + +def densityProduct (s : Finset ι) (g : ∀ i, X i → ℝ≥0∞) (x : ∀ i, X i) : ℝ≥0∞ := + ∏ i ∈ s, g i (x i) + +omit [DecidableEq ι] in +lemma measurable_densityProduct (s : Finset ι) (g : ∀ i, X i → ℝ≥0∞) + (hg : ∀ i, Measurable (g i)) : Measurable (densityProduct s g) := + Finset.measurable_prod s fun i _ ↦ (hg i).comp (measurable_pi_apply i) + +omit [DecidableEq ι] [∀ i, MeasurableSpace (X i)] in +lemma densityProduct_depends (s : Finset ι) (g : ∀ i, X i → ℝ≥0∞) : + DependsOn (densityProduct s g) (s : Set ι) := by + intro x y hxy + exact Finset.prod_congr rfl fun i hi ↦ congrArg (g i) (hxy i hi) + +omit [∀ i, MeasurableSpace (X i)] in +lemma densityProduct_union (s t : Finset ι) (g h : ∀ i, X i → ℝ≥0∞) + (x : ∀ i, X i) : + densityProduct s g x * densityProduct t h x = + ∏ i ∈ s ∪ t, (if i ∈ s then g i (x i) else 1) * + (if i ∈ t then h i (x i) else 1) := by + rw [Finset.prod_mul_distrib] + congr 1 + · rw [Finset.prod_ite, Finset.prod_const_one, mul_one] + simp only [Finset.filter_mem_eq_inter, Finset.union_inter_cancel_left, densityProduct] + · rw [Finset.prod_ite, Finset.prod_const_one, mul_one] + simp only [Finset.filter_mem_eq_inter, Finset.union_inter_cancel_right, densityProduct] + +lemma lmarginal_overlap_products {μ : ∀ i, Measure (X i)} + [∀ i, IsProbabilityMeasure (μ i)] (s t : Finset ι) + (g h : ∀ i, X i → ℝ≥0∞) (hg : ∀ i, Measurable (g i)) + (hh : ∀ i, Measurable (h i)) {G : ℝ≥0∞} + (hgb : ∀ i x, g i x ≤ G) + (hgm : ∀ i, ∫⁻ x, g i x ∂μ i = 1) + (hhm : ∀ i, ∫⁻ x, h i x ∂μ i = 1) (x : ∀ i, X i) : + lmarginal μ (s ∪ t) (fun y ↦ densityProduct s g y * densityProduct t h y) x ≤ + G ^ (s ∩ t).card := by + let f (i : ι) (y : X i) := + (if i ∈ s then g i y else 1) * (if i ∈ t then h i y else 1) + have hf : ∀ i, Measurable (f i) := by + intro i + dsimp [f] + split_ifs <;> fun_prop + rw [show (fun y ↦ densityProduct s g y * densityProduct t h y) = + (fun y ↦ ∏ i ∈ s ∪ t, f i (y i)) from funext (densityProduct_union s t g h)] + rw [lmarginal_prod_coordinates f hf] + have hi (i : ι) : (∫⁻ y, f i y ∂μ i) ≤ if i ∈ s ∩ t then G else 1 := by + by_cases his : i ∈ s <;> by_cases hit : i ∈ t + · simp only [f, his, hit, ite_true, Finset.mem_inter, and_self] + calc + (∫⁻ y, g i y * h i y ∂μ i) ≤ ∫⁻ y, G * h i y ∂μ i := + lintegral_mono fun y ↦ mul_le_mul_left (hgb i y) _ + _ = G := by rw [lintegral_const_mul _ (hh i), hhm, mul_one] + all_goals simp [f, his, hit, hgm, hhm] + calc + (∏ i ∈ s ∪ t, ∫⁻ y, f i y ∂μ i) ≤ + ∏ i ∈ s ∪ t, if i ∈ s ∩ t then G else 1 := + Finset.prod_le_prod fun i _ ↦ hi i + _ = G ^ (s ∩ t).card := by + rw [Finset.prod_ite, Finset.prod_const_one, mul_one] + have heq : (s ∪ t).filter (fun i ↦ i ∈ s ∩ t) = s ∩ t := by + ext i + simp only [Finset.mem_filter, Finset.mem_union, Finset.mem_inter] + tauto + rw [heq, Finset.prod_const] + +omit [∀ i, MeasurableSpace (X i)] in +lemma dependsOn_mul_union {s t : Finset ι} {f g : (∀ i, X i) → ℝ≥0∞} + (hf : DependsOn f (s : Set ι)) (hg : DependsOn g (t : Set ι)) : + DependsOn (fun x ↦ f x * g x) ((s ∪ t : Finset ι) : Set ι) := by + intro x y hxy + change f x * g x = f y * g y + rw [hf (fun i hi ↦ hxy i (Finset.mem_union_left t hi)), + hg (fun i hi ↦ hxy i (Finset.mem_union_right s hi))] + +end OverlapProducts + +section KernelOverlap +variable {ι : Type*} [DecidableEq ι] {X Z W : ι → Type*} + [∀ i, MeasurableSpace (X i)] [∀ i, MeasurableSpace (Z i)] + [∀ i, MeasurableSpace (W i)] + {C D : Type*} [Fintype C] [Fintype D] + (checks : C → LocalCheck (fun i ↦ X i × Z i)) + (other : D → LocalCheck (fun i ↦ X i × W i)) + (κ : ∀ i, Kernel (X i) (Z i)) [∀ i, IsFiniteKernel (κ i)] + (η : ∀ i, Kernel (X i) (W i)) [∀ i, IsFiniteKernel (η i)] + +lemma auxiliaryDensity_overlap_bound + {μ : ∀ i, Measure (X i)} [∀ i, IsProbabilityMeasure (μ i)] + (fs ft cs ct : Finset ι) + (hff : Disjoint fs ft) (hfn : Disjoint (fs ∪ ft) (cs ∪ ct)) + {G : ℝ≥0∞} + (hκb : ∀ i x, κ i x Set.univ ≤ G) + (hκm : ∀ i, ∫⁻ x, κ i x Set.univ ∂μ i = 1) + (hηm : ∀ i, ∫⁻ x, η i x Set.univ ∂μ i = 1) + (x : ∀ i, X i) (z : ∀ i, Z i) (w : ∀ i, W i) : + lmarginal μ ((fs ∪ ft) ∪ (cs ∪ ct)) + (fun y ↦ auxiliaryDensity checks κ (fs ∪ cs) y z * + auxiliaryDensity other η (ft ∪ ct) y w) x ≤ + (checkNormalizer checks (fun i ↦ (μ i).compProd (κ i)) fs (fun i ↦ (x i,z i)) * + checkNormalizer other (fun i ↦ (μ i).compProd (η i)) ft (fun i ↦ (x i,w i))) * + G ^ (cs ∩ ct).card := by + let g (i : ι) (y : X i) := κ i y Set.univ + let h (i : ι) (y : X i) := η i y Set.univ + have hg : ∀ i, Measurable (g i) := fun i ↦ (κ i).measurable_coe MeasurableSet.univ + have hh : ∀ i, Measurable (h i) := fun i ↦ (η i).measurable_coe MeasurableSet.univ + have hfs : Disjoint fs cs := hfn.mono Finset.subset_union_left Finset.subset_union_left + have hft : Disjoint ft ct := hfn.mono Finset.subset_union_right Finset.subset_union_right + let F (y : ∀ i, X i) := auxiliaryDensity checks κ fs y z + let H (y : ∀ i, X i) := auxiliaryDensity other η ft y w + let P (y : ∀ i, X i) := densityProduct cs g y * densityProduct ct h y + have hF : Measurable F := measurable_auxiliaryDensity checks κ fs z + have hH : Measurable H := measurable_auxiliaryDensity other η ft w + have hP : Measurable P := (measurable_densityProduct cs g hg).mul + (measurable_densityProduct ct h hh) + have hFd : DependsOn F (fs : Set ι) := auxiliaryDensity_depends checks κ fs z + have hHd : DependsOn H (ft : Set ι) := auxiliaryDensity_depends other η ft w + have hPd : DependsOn P ((cs ∪ ct : Finset ι) : Set ι) := + dependsOn_mul_union (densityProduct_depends cs g) (densityProduct_depends ct h) + calc + _ ≤ lmarginal μ ((fs ∪ ft) ∪ (cs ∪ ct)) (fun y ↦ (F y * H y) * P y) x := by + apply lmarginal_mono _ x + intro y + calc + _ ≤ (F y * densityProduct cs g y) * (H y * densityProduct ct h y) := + mul_le_mul' (auxiliaryDensity_delete_le checks κ hfs y z) + (auxiliaryDensity_delete_le other η hft y w) + _ = _ := by dsimp [P]; ac_rfl + _ = (lmarginal μ fs F x * lmarginal μ ft H x) * lmarginal μ (cs ∪ ct) P x := by + rw [lmarginal_mul_disjoint (f := fun y ↦ F y * H y) (g := P) hfn + (hF.mul hH) hP (dependsOn_mul_union hFd hHd) hPd, + lmarginal_mul_disjoint (f := F) (g := H) hff hF hH hFd hHd] + _ ≤ (lmarginal μ fs F x * lmarginal μ ft H x) * G ^ (cs ∩ ct).card := + mul_le_mul_right (lmarginal_overlap_products cs ct g h hg hh hκb hκm hηm x) _ + _ = _ := by rw [auxiliaryDensity_integral, auxiliaryDensity_integral] + +end KernelOverlap + +section ConditionalNormalizers +variable {ι : Type*} [DecidableEq ι] {X : ι → Type*} + [∀ i, MeasurableSpace (X i)] {C : Type*} [Fintype C] + (checks : C → LocalCheck X) + +def UniformInsertionOn (μ : ∀ i, Measure (X i)) (a : ℝ≥0∞) (r : Finset ι) : Prop := + ∀ i ∈ r, ∀ (s : Finset ι), i ∉ s → ∀ x : ∀ j, X j, + a ≤ ∫⁻ y, (insertionEvent checks s i).indicator (fun _ ↦ (1 : ℝ≥0∞)) + (Function.update x i y) ∂μ i + +omit [Fintype C] in +lemma insertion_integral_lower_on {μ : ∀ i, Measure (X i)} {a : ℝ≥0∞} + {r : Finset ι} (hcompat : UniformInsertionOn checks μ a r) + {s : Finset ι} {i : ι} (hir : i ∈ r) (hi : i ∉ s) (x : ∀ i, X i) : + a * checkWeight checks s x ≤ + ∫⁻ y, checkWeight checks (insert i s) (Function.update x i y) ∂μ i := by + classical + by_cases hx : x ∈ retainedEvent checks s + · have heq : (fun y ↦ checkWeight checks (insert i s) (Function.update x i y)) = + fun y ↦ (insertionEvent checks s i).indicator (fun _ ↦ (1 : ℝ≥0∞)) + (Function.update x i y) := by + funext y + have hu := (retainedEvent_update checks hi x y).2 hx + simp [checkWeight, retainedEvent_insert, Set.indicator_apply, hu] + rw [heq] + simpa [checkWeight, hx] using hcompat i hir s hi x + · simp [checkWeight, hx] + +def partialNormalizer (μ : ∀ i, Measure (X i)) (s o : Finset ι) + (x : ∀ i, X i) : ℝ≥0∞ := lmarginal μ s (checkWeight checks (s ∪ o)) x + +lemma partialNormalizer_insert_lower {μ : ∀ i, Measure (X i)} + [∀ i, SigmaFinite (μ i)] {a : ℝ≥0∞} {r : Finset ι} + (hcompat : UniformInsertionOn checks μ a r) {s o : Finset ι} {i : ι} + (hir : i ∈ r) (hi : i ∉ s ∪ o) (x : ∀ i, X i) : + a * partialNormalizer checks μ s o x ≤ + partialNormalizer checks μ (insert i s) o x := by + have his : i ∉ s := fun h ↦ hi (Finset.mem_union_left o h) + rw [partialNormalizer, partialNormalizer, Finset.insert_union, + lmarginal_insert' _ (measurable_checkWeight checks _) his] + calc + a * lmarginal μ s (checkWeight checks (s ∪ o)) x = + lmarginal μ s (fun x ↦ a * checkWeight checks (s ∪ o) x) x := by + dsimp [lmarginal] + exact (lintegral_const_mul a ((measurable_checkWeight checks (s ∪ o)).comp + (measurable_updateFinset (x := x) (s := s)))).symm + _ ≤ _ := lmarginal_mono (insertion_integral_lower_on checks hcompat hir hi) x + +lemma partialNormalizer_union_lower {μ : ∀ i, Measure (X i)} + [∀ i, SigmaFinite (μ i)] {a : ℝ≥0∞} {r : Finset ι} + (hcompat : UniformInsertionOn checks μ a r) + (s t o : Finset ι) (htr : t ⊆ r) (hto : Disjoint (s ∪ o) t) + (x : ∀ i, X i) : + a ^ t.card * partialNormalizer checks μ s o x ≤ + partialNormalizer checks μ (s ∪ t) o x := by + induction t using Finset.induction_on with + | empty => simp + | @insert i t hit ih => + have hino : i ∉ s ∪ o := (Finset.disjoint_insert_right.mp hto).1 + have hto' := (Finset.disjoint_insert_right.mp hto).2 + have hiu : i ∉ (s ∪ t) ∪ o := by + simp only [Finset.mem_union, not_or] at hino ⊢ + exact ⟨⟨hino.1, hit⟩, hino.2⟩ + calc + a ^ (insert i t).card * partialNormalizer checks μ s o x = + a * (a ^ t.card * partialNormalizer checks μ s o x) := by + rw [Finset.card_insert_of_notMem hit, pow_succ] + ac_rfl + _ ≤ a * partialNormalizer checks μ (s ∪ t) o x := + mul_le_mul_right (ih ((Finset.subset_insert _ _).trans htr) hto') a + _ ≤ partialNormalizer checks μ (insert i (s ∪ t)) o x := + partialNormalizer_insert_lower checks hcompat (htr (Finset.mem_insert_self _ _)) hiu x + _ = _ := by rw [Finset.union_insert] + +lemma partialNormalizer_pos {μ : ∀ i, Measure (X i)} [∀ i, SigmaFinite (μ i)] + {a : ℝ≥0∞} (ha : 0 < a) {s o : Finset ι} + (hcompat : UniformInsertionOn checks μ a s) (hso : Disjoint s o) + (x : ∀ i, X i) (hx : x ∈ retainedEvent checks o) : + 0 < partialNormalizer checks μ s o x := by + have h := partialNormalizer_union_lower checks hcompat ∅ s o (Finset.Subset.refl s) + (by simpa using hso.symm) x + simp only [partialNormalizer, Finset.empty_union, lmarginal_empty, checkWeight, + Set.indicator_of_mem hx, mul_one] at h + exact lt_of_lt_of_le (by positivity) h + +lemma partialNormalizer_far_eq {μ : ∀ i, Measure (X i)} [∀ i, SigmaFinite (μ i)] + {s o : Finset ι} (hso : Disjoint s o) (hsep : SeparatedChecks checks s o) + (x : ∀ i, X i) : + partialNormalizer checks μ s o x = checkNormalizer checks μ s x * checkWeight checks o x := by + rw [partialNormalizer] + have heq : checkWeight checks (s ∪ o) = fun y ↦ checkWeight checks s y * checkWeight checks o y := + funext (checkWeight_union checks hsep) + rw [heq] + change (∫⁻ y, checkWeight checks s (Function.updateFinset x s y) * + checkWeight checks o (Function.updateFinset x s y) ∂Measure.pi (fun i : s ↦ μ i)) = _ + have hu : ∀ y : ∀ i : s, X i, + checkWeight checks o (Function.updateFinset x s y) = checkWeight checks o x := by + intro y + apply checkWeight_depends + intro i hi + have his : i ∉ s := Finset.disjoint_right.mp hso hi + simp [Function.updateFinset, his] + simp_rw [hu] + exact lintegral_mul_const _ ((measurable_checkWeight checks s).comp + (measurable_updateFinset (x := x) (s := s))) + +lemma partialNormalizer_le_far {μ : ∀ i, Measure (X i)} [∀ i, IsProbabilityMeasure (μ i)] + {s t o : Finset ι} (hst : Disjoint s t) (x : ∀ i, X i) : + partialNormalizer checks μ (s ∪ t) o x ≤ checkNormalizer checks μ s x := by + calc + _ ≤ lmarginal μ (s ∪ t) (checkWeight checks s) x := + lmarginal_mono (checkWeight_antitone checks + (Finset.subset_union_left.trans Finset.subset_union_left)) x + _ = _ := by + rw [lmarginal_union' μ _ (measurable_checkWeight checks s) hst] + change (∫⁻ y, checkNormalizer checks μ s (Function.updateFinset x t y) + ∂Measure.pi (fun i : t ↦ μ i)) = _ + simp_rw [checkNormalizer_const checks s _ x] + simp + +end ConditionalNormalizers + +variable {ι : Type*} [DecidableEq ι] {X Z : ι → Type*} + [∀ i, MeasurableSpace (X i)] [∀ i, MeasurableSpace (Z i)] + {C : Type*} [Fintype C] + (checks : C → LocalCheck (fun i ↦ X i × Z i)) + (κ : ∀ i, Kernel (X i) (Z i)) [∀ i, IsFiniteKernel (κ i)] + +def conditionalDensity (s o : Finset ι) (x : ∀ i, X i) (z : ∀ i, Z i) : ℝ≥0∞ := + lmarginal (fun i ↦ κ i (x i)) s + (fun v ↦ checkWeight checks (s ∪ o) (fun i ↦ (x i,v i))) z + +omit [Fintype C] [∀ i, IsFiniteKernel (κ i)] in +lemma conditionalDensity_le_auxiliaryDensity (s o : Finset ι) + (x : ∀ i, X i) (z : ∀ i, Z i) : + conditionalDensity checks κ s o x z ≤ auxiliaryDensity checks κ s x z := + lmarginal_mono (fun v ↦ checkWeight_antitone checks Finset.subset_union_left + (fun i ↦ (x i,v i))) z + +lemma measurable_conditionalDensity (s o : Finset ι) (z : ∀ i, Z i) : + Measurable (fun x ↦ conditionalDensity checks κ s o x z) := by + let κ' (i : s) : Kernel (∀ j, X j) (Z i) := + (κ i).comap (fun x ↦ x i) (measurable_pi_apply (i : ι)) + let η := finiteKernelPi κ' + have hm : Measurable (fun p : (∀ i, X i) × (∀ i : s, Z i) ↦ + checkWeight checks (s ∪ o) (fun i ↦ (p.1 i, Function.updateFinset z s p.2 i))) := by + apply (measurable_checkWeight checks (s ∪ o)).comp + exact Measurable.of_eval fun i ↦ + ((measurable_pi_apply i).comp measurable_fst).prodMk + ((measurable_pi_apply i).comp ((measurable_updateFinset (x := z) (s := s)).comp + measurable_snd)) + have h := hm.lintegral_kernel_prod_right' (κ := η) + simpa only [η, finiteKernelPi_apply, κ', Kernel.comap_apply, + conditionalDensity, lmarginal] using h + +lemma conditionalDensity_integral (μ : ∀ i, Measure (X i)) [∀ i, IsFiniteMeasure (μ i)] + (s o : Finset ι) (x : ∀ i, X i) (z : ∀ i, Z i) : + lmarginal μ s (fun y ↦ conditionalDensity checks κ s o y z) x = + partialNormalizer checks (fun i ↦ (μ i).compProd (κ i)) s o (fun i ↦ (x i,z i)) := by + let f (p : ∀ i : s, X i × Z i) := + checkWeight checks (s ∪ o) (Function.updateFinset (fun i ↦ (x i,z i)) s p) + have hf : Measurable f := (measurable_checkWeight checks (s ∪ o)).comp measurable_updateFinset + have hh := lintegral_pi_compProd (fun i : s ↦ κ i) (fun i : s ↦ μ i) hf + change (∫⁻ y, conditionalDensity checks κ s o (Function.updateFinset x s y) z + ∂Measure.pi (fun i : s ↦ μ i)) = (∫⁻ p, f p ∂Measure.pi (fun i : s ↦ (μ i).compProd (κ i))) + rw [hh] + apply lintegral_congr + intro y + change (∫⁻ u, checkWeight checks (s ∪ o) + (fun i ↦ (Function.updateFinset x s y i, Function.updateFinset z s u i)) + ∂Measure.pi (fun i : s ↦ κ i (Function.updateFinset x s y i))) = _ + have hμ : (fun i : s ↦ κ i (Function.updateFinset x s y i)) = (fun i : s ↦ κ i (y i)) := by + funext i + simp [Function.updateFinset, i.property] + rw [hμ] + apply lintegral_congr + intro u + apply congrArg (checkWeight checks (s ∪ o)) + funext i + by_cases hi : i ∈ s <;> simp [Function.updateFinset, hi] + +end HardSphere.Comparison +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/AvoidanceReflectionNorm.lean b/lean/OAI/Analysis/HardSphere/Geometry/AvoidanceReflectionNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..81eeb7473af65325530a2e3085b7b07e9abcf78f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/AvoidanceReflectionNorm.lean @@ -0,0 +1,62 @@ +import Mathlib +import OAI.Analysis.HardSphere.Operators.FreeTransition + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace HardSphere +open Wiener +open scoped ComplexConjugate + +lemma avoidance_reflection_norm (N : ℕ) (L : Length) (a t : ℝ) (f : FreePathL2 N L t) : + ‖(2:ℂ) • avoidanceMultiplier N L a t f-f‖≤‖f‖ := by + apply Lp.norm_le_norm_of_ae_le + filter_upwards [Lp.coeFn_sub ((2:ℂ) • avoidanceMultiplier N L a t f) f, + Lp.coeFn_smul (2:ℂ) (avoidanceMultiplier N L a t f), + avoidanceMultiplier_ae N L a t f] with ω hsub hsmul hf + rw [hsub,Pi.sub_apply,hsmul,Pi.smul_apply,hf] + by_cases h : ω∈staysAllowed N L a + · simp only [Set.indicator_of_mem h,smul_eq_mul] + convert le_refl ‖f ω‖ using 1 + congr 1 + ring + · simp only [Set.indicator_of_notMem h,smul_zero,zero_sub,norm_neg,le_refl] + +lemma free_deficit_le_twice_killed (N : ℕ) (L : Length) (a t : ℝ) (f : ScalarL2 N L) : + ‖f‖^2-(inner ℂ f (freeTransition N L t f)).re ≤ + 2*(‖f‖^2-(inner ℂ f (killedTransition N L a t f)).re) := by + have h := re_inner_le_norm (𝕜 := ℂ) (endpointPull N L t 0 f) + ((2:ℂ) • avoidanceMultiplier N L a t (endpointPull N L t 1 f)-endpointPull N L t 1 f) + have hb := avoidance_reflection_norm N L a t (endpointPull N L t 1 f) + have hn0 := (endpointPull N L t 0).norm_map f + have hn1 := (endpointPull N L t 1).norm_map f + have hi0 : inner ℂ (endpointPull N L t 0 f) (endpointPull N L t 1 f) = + inner ℂ f (freeTransition N L t f) := by + rw [freeTransition,ContinuousLinearMap.comp_apply,ContinuousLinearMap.adjoint_inner_right] + rfl + have hi1 : inner ℂ (endpointPull N L t 0 f) + (avoidanceMultiplier N L a t (endpointPull N L t 1 f)) = + inner ℂ f (killedTransition N L a t f) := by + rw [killedTransition,ContinuousLinearMap.comp_apply,ContinuousLinearMap.comp_apply, + ContinuousLinearMap.adjoint_inner_right] + rfl + rw [inner_sub_right,inner_smul_right,hi0,hi1] at h + change (2 * inner ℂ f (killedTransition N L a t f)-inner ℂ f (freeTransition N L t f)).re≤_ at h + rw [Complex.sub_re,Complex.mul_re] at h + norm_num at h + simp only [LinearIsometry.norm_map] at hb + have hmul := mul_le_mul_of_nonneg_left hb (norm_nonneg f) + nlinarith + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/BadComponent.lean b/lean/OAI/Analysis/HardSphere/Geometry/BadComponent.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7877b72f7d3d0e50c94bd14989532b4b9904825 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/BadComponent.lean @@ -0,0 +1,194 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.MicroCubeCover + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +noncomputable section +open scoped BigOperators Classical +noncomputable section +open scoped BigOperators Classical +namespace HardSphere.Lattice + +lemma isBadComponent_iff (B : Set Vertex) (C : Finset Vertex) : + IsBadComponent B C ↔ C.Nonempty ∧ (↑C : Set Vertex) ⊆ B ∧ + starConnected (↑C) ∧ + ∀ c ∈ C, ∀ x, x ∈ B → starStep c x → x ∈ C := by + constructor + · intro hC + obtain ⟨z, hzB, hz⟩ := hC + have hzC : z ∈ C := by simpa only [← hz, Finset.mem_coe] using liftedBadComponent_self hzB + have hC : IsBadComponent B C := ⟨z, hzB, hz⟩ + exact ⟨⟨z, hzC⟩, hC.subset, hC.connected, fun _ hc _ hx hcx ↦ hC.closed hc hx hcx⟩ + · rintro ⟨⟨z, hz⟩, hsub, hconn, hclosed⟩ + refine ⟨z, hsub hz, ?_⟩ + ext w + constructor + · intro hw + exact ⟨hsub hz, hsub hw, withinReach_mono hsub (hconn z hz w hw)⟩ + · intro hw + exact withinReach_end hz + (withinReach_invariant (fun _ hu _ hv huv ↦ hclosed _ hu _ hv huv) hz hw.2.2) + +lemma finiteBadComponents_iff (B : Set Vertex) : + FiniteBadComponents B ↔ ∀ z ∈ B, ∃ C : Finset Vertex, IsBadComponent B C ∧ z ∈ C := by + classical + constructor + · intro h z hz + exact ⟨(h z hz).toFinset, ⟨z, hz, (h z hz).coe_toFinset⟩, + (h z hz).mem_toFinset.mpr (liftedBadComponent_self hz)⟩ + · intro h z hz + obtain ⟨C, hC, hzC⟩ := h z hz + apply C.finite_toSet.subset + intro w hw + exact withinReach_end hzC + (withinReach_invariant (fun _ hu _ hv huv ↦ hC.closed hu hv huv) hzC hw.2.2) + +end HardSphere.Lattice + +namespace HardSphere.BathSlice +open HardSphere.Lattice + +lemma measurable_component_test {n : ℕ} (L : Length) (h r : ℝ) (C : Finset Vertex) : + Measurable (fun Y : Configuration n L ↦ IsBadComponent (bad h r Y) C) := by + simp_rw [isBadComponent_iff] + apply Measurable.and measurable_const + apply Measurable.and + · change Measurable (fun Y : Configuration n L ↦ ∀ z, z ∈ C → z ∈ bad h r Y) + exact Measurable.forall fun z ↦ Measurable.imp measurable_const + (measurableSet_setOfPred.mp (measurableSet_bad_test L h r z)) + · apply Measurable.and measurable_const + apply Measurable.forall + intro c + apply Measurable.imp measurable_const + apply Measurable.forall + intro x + apply Measurable.imp + · exact measurableSet_setOfPred.mp (measurableSet_bad_test L h r x) + · exact Measurable.imp measurable_const measurable_const + +lemma measurable_finiteComponents_test {n : ℕ} (L : Length) (h r : ℝ) : + Measurable (fun Y : Configuration n L ↦ FiniteBadComponents (bad h r Y)) := by + simp_rw [finiteBadComponents_iff] + apply Measurable.forall + intro z + apply Measurable.imp + · exact measurableSet_setOfPred.mp (measurableSet_bad_test L h r z) + · exact Measurable.exists fun C ↦ (measurable_component_test L h r C).and measurable_const + +lemma measurable_exceptional {n : ℕ} (L : Length) (h r : ℝ) : + Measurable (fun Y : Configuration n L ↦ exceptional h r Y) := + ((isOpen_allowed n L r).measurableSet.mem.not).or + (measurable_finiteComponents_test L h r).not + +theorem measurableSet_omitted_graph {n : ℕ} (L : Length) (h r : ℝ) : + MeasurableSet {p : Configuration n L × Torus L | p.2 ∈ omitted h r p.1} := by + apply Measurable.setOf + apply Measurable.or ((measurable_exceptional L h r).comp measurable_fst) + apply Measurable.exists + intro C + apply Measurable.and ((measurable_component_test L h r C).comp measurable_fst) + apply Measurable.exists + intro z + exact Measurable.and measurable_const + (((isCompact_microCube L h z).isClosed.measurableSet.mem).comp measurable_snd) + +attribute [local irreducible] omitted + +lemma measurableSet_omitted {n : ℕ} {L : Length} (h r : ℝ) (Y : Configuration n L) : + MeasurableSet (omitted h r Y) := by + have hm : Measurable (fun x : Torus L ↦ (Y, x)) := + (measurable_const : Measurable (fun _ : Torus L ↦ Y)).prodMk measurable_id + exact (measurableSet_omitted_graph (n := n) L h r).preimage hm + +lemma measurableSet_retained {n : ℕ} {L : Length} (h r : ℝ) (Y : Configuration n L) : + MeasurableSet (retained h r Y) := (measurableSet_omitted h r Y).compl + +theorem measurable_omitted_volume {n : ℕ} (L : Length) (h r : ℝ) : + Measurable (fun Y : Configuration n L ↦ (volume : Measure (Torus L)) (omitted h r Y)) := + measurable_measure_prodMk_left (measurableSet_omitted_graph L h r) + +end HardSphere.BathSlice + +namespace HardSphere.Lattice + +theorem fill_column_meets (C : Finset Vertex) {x : Vertex} (hx : x ∈ fill C) + (i : Fin 3) : ∃ c ∈ C, ∀ j, j ≠ i → c j = x j := by + by_contra hn + apply hx + apply coordinateRay_exterior C x i 1 (by norm_num) + intro n hc + apply hn + refine ⟨coordinateRay x i 1 n, hc, ?_⟩ + intro j hj + simp [coordinateRay, hj] + +def columnCover (C : Finset Vertex) (i : Fin 3) (lo hi : ℤ) : Finset Vertex := + C.biUnion fun c ↦ (Finset.Icc lo hi).image fun k ↦ Function.update c i k + +lemma fill_subset_columnCover (C : Finset Vertex) (i : Fin 3) (lo hi : ℤ) + (hb : ∀ c ∈ C, lo ≤ c i ∧ c i ≤ hi) : fill C ⊆ ↑(columnCover C i lo hi) := by + intro x hx + obtain ⟨c, hc, hcol⟩ := fill_column_meets C hx i + have hbox := fill_subset_coordinateBox C hx i + obtain ⟨cl, hcl, hclx⟩ := hbox.1 + obtain ⟨cu, hcu, hxcu⟩ := hbox.2 + apply Finset.mem_biUnion.mpr + refine ⟨c, hc, Finset.mem_image.mpr ⟨x i, Finset.mem_Icc.mpr + ⟨(hb cl hcl).1.trans hclx, hxcu.trans (hb cu hcu).2⟩, ?_⟩⟩ + ext j + by_cases hj : j = i + · subst j; simp + · simp [Function.update_of_ne hj, hcol j hj] + +lemma card_columnCover_le (C : Finset Vertex) (i : Fin 3) (lo hi : ℤ) : + (columnCover C i lo hi).card ≤ C.card * (hi - lo + 1).toNat := by + calc + _ ≤ ∑ c ∈ C, ((Finset.Icc lo hi).image fun k ↦ Function.update c i k).card := + Finset.card_biUnion_le + _ ≤ ∑ _c ∈ C, (Finset.Icc lo hi).card := + Finset.sum_le_sum fun c _ ↦ Finset.card_image_le + _ = _ := by simp [Int.card_Icc, show hi + 1 - lo = hi - lo + 1 by omega] + +lemma finite_fill (C : Finset Vertex) : (fill C).Finite := by + classical + by_cases hc : C.Nonempty + · let lo := C.inf' hc (fun c ↦ c 0) + let hi := C.sup' hc (fun c ↦ c 0) + exact (columnCover C 0 lo hi).finite_toSet.subset + (fill_subset_columnCover C 0 lo hi fun c hc ↦ + ⟨Finset.inf'_le (fun c : Vertex ↦ c 0) hc, + Finset.le_sup' (fun c : Vertex ↦ c 0) hc⟩) + · have hC : C = ∅ := Finset.not_nonempty_iff_eq_empty.mp hc + subst C + have he : fill ∅ = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro x hx + obtain ⟨c, hc, _⟩ := fill_column_meets ∅ hx 0 + exact Finset.notMem_empty c hc + rw [he] + exact Set.finite_empty + +theorem ncard_fill_le_columns (C : Finset Vertex) (i : Fin 3) (lo hi : ℤ) + (hb : ∀ c ∈ C, lo ≤ c i ∧ c i ≤ hi) : + (fill C).ncard ≤ C.card * (hi - lo + 1).toNat := by + calc + _ ≤ (↑(columnCover C i lo hi) : Set Vertex).ncard := + Set.ncard_le_ncard (fill_subset_columnCover C i lo hi hb) + (columnCover C i lo hi).finite_toSet + _ = (columnCover C i lo hi).card := by simp + _ ≤ _ := card_columnCover_le C i lo hi + +end HardSphere.Lattice + +end +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/BadGraph.lean b/lean/OAI/Analysis/HardSphere/Geometry/BadGraph.lean new file mode 100644 index 0000000000000000000000000000000000000000..0528c621dba743af58e2608f408527a9d43e916b --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/BadGraph.lean @@ -0,0 +1,410 @@ +import Mathlib + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped BigOperators Classical ENNReal +namespace HardSphere.Lattice +universe u +variable {V : Type u} [Fintype V] [DecidableEq V] + +def badGraph (G : SimpleGraph V) (B : Finset V) : SimpleGraph V where + Adj x y := x∈B ∧ y∈B ∧ G.Adj x y + symm := ⟨by intro x y h; exact ⟨h.2.1,h.1,h.2.2.symm⟩⟩ + loopless := ⟨by intro x h; exact G.irrefl h.2.2⟩ + +def badComponent (G : SimpleGraph V) (B : Finset V) (x : V) : Finset V := + B.filter (fun y ↦ (badGraph G B).Reachable x y) + +def badComponents (G : SimpleGraph V) (B : Finset V) : Finset (Finset V) := + B.image (badComponent G B) + +lemma mem_badComponent (G : SimpleGraph V) (B : Finset V) (x y : V) : + y∈badComponent G B x ↔ y∈B ∧ (badGraph G B).Reachable x y := + Finset.mem_filter + +lemma mem_own_badComponent (G : SimpleGraph V) (B : Finset V) {x : V} (hx : x∈B) : + x∈badComponent G B x := (mem_badComponent G B x x).mpr ⟨hx,.refl x⟩ + +lemma badComponent_subset (G : SimpleGraph V) (B : Finset V) (x : V) : + badComponent G B x ⊆ B := Finset.filter_subset _ _ + +lemma badComponent_eq_of_reachable (G : SimpleGraph V) (B : Finset V) {x y : V} + (h : (badGraph G B).Reachable x y) : badComponent G B x=badComponent G B y := by + ext z + simp only [mem_badComponent] + exact ⟨fun ⟨hz,hxz⟩ ↦ ⟨hz,h.symm.trans hxz⟩, + fun ⟨hz,hyz⟩ ↦ ⟨hz,h.trans hyz⟩⟩ + +lemma badComponents_disjoint (G : SimpleGraph V) (B : Finset V) : + (↑(badComponents G B) : Set (Finset V)).PairwiseDisjoint id := by + rw [Finset.pairwiseDisjoint_iff] + rintro C hC D hD ⟨z,hz⟩ + obtain ⟨x,_,rfl⟩ := Finset.mem_image.mp hC + obtain ⟨y,_,rfl⟩ := Finset.mem_image.mp hD + obtain ⟨hzx,hzy⟩ := Finset.mem_inter.mp hz + exact badComponent_eq_of_reachable G B + (((mem_badComponent G B x z).mp hzx).2.trans + ((mem_badComponent G B y z).mp hzy).2.symm) + +lemma badComponents_subset (G : SimpleGraph V) (B : Finset V) {C : Finset V} + (hC : C∈badComponents G B) : C⊆B := by + obtain ⟨x,_,rfl⟩ := Finset.mem_image.mp hC + exact badComponent_subset G B x + +lemma badComponents_nonempty (G : SimpleGraph V) (B : Finset V) {C : Finset V} + (hC : C∈badComponents G B) : C.Nonempty := by + obtain ⟨x,hx,rfl⟩ := Finset.mem_image.mp hC + exact ⟨x,mem_own_badComponent G B hx⟩ + +def candidateSets (G : SimpleGraph V) : Finset (Finset V) := + Finset.univ.filter (fun F ↦ F.Nonempty ∧ + ∀ x∈F, ∀ y∈F, (badGraph G F).Reachable x y) + +lemma reachable_inside_component (G : SimpleGraph V) (B : Finset V) {x y : V} + (hy : (badGraph G B).Reachable x y) : + (badGraph G (badComponent G B x)).Reachable x y := by + rw [SimpleGraph.reachable_iff_reflTransGen] at hy ⊢ + induction hy with + | refl => exact .refl + | @tail y z hxy hyz ih => + apply ih.tail + have hreach : (badGraph G B).Reachable x y := + (SimpleGraph.reachable_iff_reflTransGen _ _).mpr hxy + refine ⟨(mem_badComponent G B x y).mpr ⟨hyz.1,hreach⟩, + (mem_badComponent G B x z).mpr ⟨hyz.2.1,hreach.trans hyz.reachable⟩,hyz.2.2⟩ + +lemma badComponents_candidate (G : SimpleGraph V) (B : Finset V) : + badComponents G B ⊆ candidateSets G := by + intro C hC + obtain ⟨x,hx,rfl⟩ := Finset.mem_image.mp hC + simp only [candidateSets, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨⟨x,mem_own_badComponent G B hx⟩, ?_⟩ + intro y hy z hz + have hxy := reachable_inside_component G B ((mem_badComponent G B x y).mp hy).2 + have hxz := reachable_inside_component G B ((mem_badComponent G B x z).mp hz).2 + exact hxy.symm.trans hxz + +abbrev ExploreState (V : Type u) := Finset V × Finset V + +def frontierHead (s : ExploreState V) (h : s.2.Nonempty) : V := h.choose + +omit [Fintype V] [DecidableEq V] in +lemma frontierHead_mem (s : ExploreState V) (h : s.2.Nonempty) : + frontierHead s h ∈ s.2 := h.choose_spec + +def exploreNext (s : ExploreState V) (A : Finset V) : ExploreState V := + if h : s.2.Nonempty then + let x := frontierHead s h + (insert x s.1, (s.2 ∪ A) \ insert x s.1) + else s + +def exploreStep (G : SimpleGraph V) (F : Finset V) (s : ExploreState V) : ExploreState V := + if h : s.2.Nonempty then exploreNext s ((G.neighborFinset (frontierHead s h)) ∩ F) + else s + +def exploration (G : SimpleGraph V) (F : Finset V) (r : V) : ℕ → ExploreState V + | 0 => (∅,{r}) + | n+1 => exploreStep G F (exploration G F r n) + +def ExploreInvariant (G : SimpleGraph V) (F : Finset V) (r : V) (s : ExploreState V) : Prop := + s.1 ⊆ F ∧ s.2 ⊆ F ∧ Disjoint s.1 s.2 ∧ r∈s.1∪s.2 ∧ + ∀ x∈s.1, ∀ y∈F, G.Adj x y → y∈s.1∪s.2 + +omit [Fintype V] in +lemma invariant_initial (G : SimpleGraph V) (F : Finset V) {r : V} (hr : r∈F) : + ExploreInvariant G F r (∅,{r}) := by + simp [ExploreInvariant,hr] + +lemma invariant_step (G : SimpleGraph V) (F : Finset V) (r : V) (s : ExploreState V) + (hs : ExploreInvariant G F r s) : ExploreInvariant G F r (exploreStep G F s) := by + rcases hs with ⟨h₁,h₂,hd,hr,hclosed⟩ + by_cases h : s.2.Nonempty + · let x := frontierHead s h + have hx : x∈s.2 := frontierHead_mem s h + have hxF : x∈F := h₂ hx + have hseen : s.1∪s.2 ⊆ (insert x s.1) ∪ + ((s.2 ∪ (G.neighborFinset x ∩ F)) \ insert x s.1) := by + intro y hy + by_cases hyp : y∈insert x s.1 + · exact Finset.mem_union_left _ hyp + · exact Finset.mem_union_right _ (Finset.mem_sdiff.mpr + ⟨Finset.mem_union_left _ (by + rcases Finset.mem_union.mp hy with hy|hy + · exact False.elim (hyp (Finset.mem_insert_of_mem hy)) + · exact hy),hyp⟩) + simp only [exploreStep,dite_eq_left h,exploreNext] + change ExploreInvariant G F r + (insert x s.1, (s.2 ∪ (G.neighborFinset x ∩ F)) \ insert x s.1) + refine ⟨Finset.insert_subset hxF h₁, ?_, (Finset.disjoint_left.mpr (fun _ hy hz ↦ (Finset.mem_sdiff.mp hz).2 hy)), hseen hr, ?_⟩ + · intro y hy + rcases Finset.mem_union.mp (Finset.mem_sdiff.mp hy).1 with hy|hy + · exact h₂ hy + · exact (Finset.mem_inter.mp hy).2 + · intro y hy z hz hyz + rcases Finset.mem_insert.mp hy with rfl|hy + · by_cases hzp : z∈insert x s.1 + · exact Finset.mem_union_left _ hzp + · exact Finset.mem_union_right _ (Finset.mem_sdiff.mpr + ⟨Finset.mem_union_right _ (Finset.mem_inter.mpr + ⟨(G.mem_neighborFinset x z).mpr hyz,hz⟩),hzp⟩) + · exact hseen (hclosed y hy z hz hyz) + · simpa only [exploreStep,dite_eq_right h] using + (show ExploreInvariant G F r s from ⟨h₁,h₂,hd,hr,hclosed⟩) + +lemma exploration_invariant (G : SimpleGraph V) (F : Finset V) {r : V} (hr : r∈F) (n : ℕ) : + ExploreInvariant G F r (exploration G F r n) := by + induction n with + | zero => exact invariant_initial G F hr + | succ n ih => exact invariant_step G F r _ ih + +omit [Fintype V] in +lemma invariant_empty_frontier (G : SimpleGraph V) (F : Finset V) (r : V) (s : ExploreState V) + (hs : ExploreInvariant G F r s) + (hconn : ∀ y∈F, (badGraph G F).Reachable r y) (he : s.2=∅) : s.1=F := by + apply Finset.Subset.antisymm hs.1 + intro y hy + have hreach := hconn y hy + rw [SimpleGraph.reachable_iff_reflTransGen] at hreach + induction hreach with + | refl => simpa only [he,Finset.union_empty] using hs.2.2.2.1 + | @tail y z _ hyz ih => + simpa only [he,Finset.union_empty] using hs.2.2.2.2 y (ih hyz.1) z hyz.2.1 hyz.2.2 + +lemma exploreStep_card (G : SimpleGraph V) (F : Finset V) (r : V) (s : ExploreState V) + (hs : ExploreInvariant G F r s) (h : s.2.Nonempty) : + (exploreStep G F s).1.card=s.1.card+1 := by + have hx := frontierHead_mem s h + have hn : frontierHead s h ∉ s.1 := fun hh ↦ Finset.disjoint_left.mp hs.2.2.1 hh hx + simp only [exploreStep,dite_eq_left h,exploreNext] + exact Finset.card_insert_of_notMem hn + +lemma exploration_covers (G : SimpleGraph V) (F : Finset V) {r : V} (hr : r∈F) + (hconn : ∀ y∈F, (badGraph G F).Reachable r y) : + (exploration G F r F.card).1=F := by + have hprogress (n : ℕ) : n≤(exploration G F r n).1.card ∨ (exploration G F r n).1=F := by + induction n with + | zero => exact Or.inl (Nat.zero_le _) + | succ n ih => + have hs := exploration_invariant G F hr n + by_cases h : (exploration G F r n).2.Nonempty + · by_cases hc : (exploration G F r n).1=F + · have hx := frontierHead_mem _ h + have hp := hs.2.1 hx + exact False.elim (Finset.disjoint_left.mp hs.2.2.1 (hc.ge hp) hx) + · refine Or.inl ?_ + obtain hn|hn := ih + · rw [exploration,exploreStep_card G F r _ hs h] + omega + · exact False.elim (hc hn) + · apply Or.inr + rw [exploration,exploreStep,dite_eq_right h] + exact invariant_empty_frontier G F r _ hs hconn (Finset.not_nonempty_iff_eq_empty.mp h) + rcases hprogress F.card with hc|hc + · exact Finset.eq_of_subset_of_card_le (exploration_invariant G F hr F.card).1 hc + · exact hc + +def possibleSteps (G : SimpleGraph V) (s : ExploreState V) : Finset (ExploreState V) := + if h : s.2.Nonempty then + (G.neighborFinset (frontierHead s h)).powerset.image (exploreNext s) + else {s} + +lemma exploreStep_mem_possible (G : SimpleGraph V) (F : Finset V) (s : ExploreState V) : + exploreStep G F s ∈ possibleSteps G s := by + by_cases h : s.2.Nonempty + · simp only [exploreStep,possibleSteps,dite_eq_left h] + exact Finset.mem_image.mpr ⟨_, Finset.mem_powerset.mpr (Finset.inter_subset_left),rfl⟩ + · simp only [exploreStep,possibleSteps,dite_eq_right h,Finset.mem_singleton] + +def possibleStates (G : SimpleGraph V) (r : V) : ℕ → Finset (ExploreState V) + | 0 => {(∅,{r})} + | n+1 => (possibleStates G r n).biUnion (possibleSteps G) + +lemma exploration_mem_possible (G : SimpleGraph V) (F : Finset V) (r : V) (n : ℕ) : + exploration G F r n ∈ possibleStates G r n := by + induction n with + | zero => simp only [exploration,possibleStates,Finset.mem_singleton] + | succ n ih => exact Finset.mem_biUnion.mpr ⟨_,ih,exploreStep_mem_possible G F _⟩ + +lemma possibleSteps_card_le (G : SimpleGraph V) (Δ : ℕ) + (hΔ : ∀ x, G.degree x≤Δ) (s : ExploreState V) : + (possibleSteps G s).card ≤ 2^Δ := by + by_cases h : s.2.Nonempty + · simp only [possibleSteps,dite_eq_left h] + calc + _ ≤ (G.neighborFinset (frontierHead s h)).powerset.card := Finset.card_image_le + _ = 2^(G.degree (frontierHead s h)) := by rw [Finset.card_powerset]; rfl + _ ≤ 2^Δ := Nat.pow_le_pow_right (by omega) (hΔ _) + · simp only [possibleSteps,dite_eq_right h,Finset.card_singleton] + exact Nat.one_le_pow _ _ (by omega) + +lemma possibleStates_card_le (G : SimpleGraph V) (Δ : ℕ) + (hΔ : ∀ x, G.degree x≤Δ) (r : V) (n : ℕ) : + (possibleStates G r n).card ≤ (2^Δ)^n := by + induction n with + | zero => simp only [possibleStates,Finset.card_singleton,pow_zero,le_refl] + | succ n ih => + calc + _ ≤ ∑ s∈possibleStates G r n, (possibleSteps G s).card := Finset.card_biUnion_le + _ ≤ ∑ _s∈possibleStates G r n, 2^Δ := + Finset.sum_le_sum fun s _ ↦ possibleSteps_card_le G Δ hΔ s + _ = (possibleStates G r n).card * 2^Δ := by simp + _ ≤ (2^Δ)^n * 2^Δ := Nat.mul_le_mul_right _ ih + _ = (2^Δ)^(n+1) := (pow_succ _ _).symm + +def rootedAnimals (G : SimpleGraph V) (r : V) (m : ℕ) : Finset (Finset V) := + Finset.univ.filter (fun F ↦ r∈F ∧ F.card=m ∧ ∀ y∈F, (badGraph G F).Reachable r y) + +lemma rootedAnimals_card_le (G : SimpleGraph V) (Δ : ℕ) + (hΔ : ∀ x, G.degree x≤Δ) (r : V) (m : ℕ) : + (rootedAnimals G r m).card ≤ (2^Δ)^m := by + have hsub : rootedAnimals G r m ⊆ (possibleStates G r m).image Prod.fst := by + intro F hF + simp only [rootedAnimals,Finset.mem_filter,Finset.mem_univ,true_and] at hF + rcases hF with ⟨hr,hm,hconn⟩ + refine Finset.mem_image.mpr ⟨exploration G F r m, exploration_mem_possible G F r m, ?_⟩ + rw [← hm] + exact exploration_covers G F hr hconn + exact (Finset.card_le_card hsub).trans (Finset.card_image_le.trans + (possibleStates_card_le G Δ hΔ r m)) + +omit [Fintype V] [DecidableEq V] in +lemma badGraph_mono (G : SimpleGraph V) {S F : Finset V} (h : S⊆F) : + badGraph G S ≤ badGraph G F := by + intro x y hxy + exact ⟨h hxy.1,h hxy.2.1,hxy.2.2⟩ + +omit [Fintype V] in +lemma internal_boundary (G : SimpleGraph V) (F S : Finset V) {r y : V} + (hr : r∈S) (hy : y∉S) (hp : (badGraph G F).Reachable r y) : + ∃ x∈S, ∃ z∈F, z∉S ∧ G.Adj x z := by + rw [SimpleGraph.reachable_iff_reflTransGen] at hp + induction hp with + | refl => exact False.elim (hy hr) + | @tail y z _ hyz ih => + by_cases h : y∈S + · exact ⟨y,h,z,hyz.2.1,hy,hyz.2.2⟩ + · exact ih h + +omit [Fintype V] in +lemma connected_insert (G : SimpleGraph V) (S : Finset V) (r : V) + (hconn : ∀ y∈S, (badGraph G S).Reachable r y) + {x z : V} (hx : x∈S) (hxz : G.Adj x z) : + ∀ y∈insert z S, (badGraph G (insert z S)).Reachable r y := by + have hmono := badGraph_mono G (Finset.subset_insert z S) + intro y hy + rcases Finset.mem_insert.mp hy with he|hy + · subst y + exact ((hconn x hx).mono hmono).trans + (show (badGraph G (insert z S)).Adj x z from + ⟨Finset.mem_insert_of_mem hx,Finset.mem_insert_self _ _,hxz⟩).reachable + · exact (hconn y hy).mono hmono + +lemma exists_rooted_subanimal (G : SimpleGraph V) (F : Finset V) {r : V} + (hr : r∈F) (hconn : ∀ y∈F, (badGraph G F).Reachable r y) + (m : ℕ) (hm : 1 ≤ m) (hmF : m ≤ F.card) : + ∃ S⊆F, S∈rootedAnimals G r m := by + have hex (k : ℕ) (hk : k+1≤F.card) : + ∃ S⊆F, r∈S ∧ S.card=k+1 ∧ ∀ y∈S, (badGraph G S).Reachable r y := by + induction k with + | zero => + refine ⟨{r},Finset.singleton_subset_iff.mpr hr,Finset.mem_singleton_self _,by simp,?_⟩ + intro y hy + have : y=r := Finset.mem_singleton.mp hy + subst y + exact .refl r + | succ k ih => + obtain ⟨S,hSF,hrS,hcard,hSconn⟩ := ih (by omega) + have hlt : S.card simp + rw [he,Finset.prod_mul_distrib] + exact mul_le_mul' (component_event_bound μ p hbad K hdisj hsub A) le_rfl + +end HardSphere.Lattice +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/BinaryValue.lean b/lean/OAI/Analysis/HardSphere/Geometry/BinaryValue.lean new file mode 100644 index 0000000000000000000000000000000000000000..3abf0c2acaa0df8e1f7309e114acc628b9265ea6 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/BinaryValue.lean @@ -0,0 +1,447 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped ENNReal NNReal +namespace HardSphere.Lattice + +def binaryValue : (n : ℕ) → (Fin n → Bool) → ℕ + | 0, _ => 0 + | n + 1, b => (b 0).toNat + 2 * binaryValue n (fun i ↦ b i.succ) + +lemma binaryValue_injective (n : ℕ) : Function.Injective (binaryValue n) := by + induction n with + | zero => intro b c _; exact Subsingleton.elim _ _ + | succ n ih => + intro b c h + have h0 : b 0 = c 0 := by + unfold binaryValue at h + cases hb : b 0 <;> cases hc : c 0 <;> simp_all <;> omega + have ht : (fun i : Fin n ↦ b i.succ) = (fun i : Fin n ↦ c i.succ) := by + apply ih + simp only [binaryValue, h0] at h + omega + funext i + refine Fin.cases h0 (fun j ↦ congrFun ht j) i + +def signedValue (n : ℕ) (b : Fin n → Bool) : ℤ := + 2 * (binaryValue n b : ℤ) - ((2 : ℤ) ^ n - 1) + +lemma signedValue_injective (n : ℕ) : Function.Injective (signedValue n) := by + intro b c h + apply binaryValue_injective n + have h' : (binaryValue n b : ℤ) = (binaryValue n c : ℤ) := by + unfold signedValue at h + omega + exact_mod_cast h' + +lemma pmf_map_injective_atom_le {A B : Type*} (p : PMF A) (f : A → B) + (hf : Function.Injective f) (b : B) (a : ℝ≥0∞) (ha : ∀ x, p x ≤ a) : + p.map f b ≤ a := by + classical + rw [PMF.map_apply] + by_cases hb : ∃ x, b = f x + · obtain ⟨x, hx⟩ := hb + rw [tsum_eq_single x] + · simpa [hx] using ha x + · intro y hy + have hby : b ≠ f y := fun h ↦ hy (hf (hx.symm.trans h)).symm + simp [hby] + · have hz : ∀ x, b ≠ f x := by simpa using hb + simp only [ite_eq_right (hz _), tsum_zero] + exact zero_le + +theorem signed_uniform_atom (n : ℕ) (z : ℤ) : + (PMF.uniformOfFintype (Fin n → Bool)).map (signedValue n) z ≤ + ((2 : ℝ≥0∞) ^ n)⁻¹ := by + apply pmf_map_injective_atom_le _ _ (signedValue_injective n) + intro b + simp [PMF.uniformOfFintype_apply] + +lemma pmf_independent_shift_atom_le {A : Type*} (q : PMF A) (p : PMF ℤ) + (f : A → ℤ) (a : ℝ≥0∞) (ha : ∀ z, p z ≤ a) (z : ℤ) : + (q.bind fun x ↦ p.map (fun y ↦ y + f x)) z ≤ a := by + rw [PMF.bind_apply] + calc + (∑' x, q x * (p.map (fun y ↦ y + f x)) z) ≤ ∑' x, q x * a := by + apply ENNReal.tsum_le_tsum + intro x + exact mul_le_mul_right + (pmf_map_injective_atom_le p _ (fun _ _ h ↦ add_right_cancel h) z a ha) _ + _ = a := by rw [ENNReal.tsum_mul_right, q.tsum_coe, one_mul] + +def spin (b : Bool) : ℤ := 2 * (b.toNat : ℤ) - 1 + +@[simp] lemma abs_spin (b : Bool) : |spin b| = 1 := by cases b <;> norm_num [spin] + +lemma binaryValue_snoc (n : ℕ) (b : Fin n → Bool) (c : Bool) : + binaryValue (n+1) (Fin.snoc b c) = binaryValue n b + 2^n * c.toNat := by + induction n with + | zero => + change (Fin.snoc (α := fun _ ↦ Bool) b c (Fin.last 0)).toNat + 2*0 = 0 + 1*c.toNat + rw [Fin.snoc_last] + omega + | succ n ih => + have ht : (fun i : Fin (n+1) ↦ Fin.snoc (α := fun _ ↦ Bool) b c i.succ) = + Fin.snoc (α := fun _ ↦ Bool) (fun i : Fin n ↦ b i.succ) c := by + funext i + refine Fin.lastCases ?_ (fun i ↦ ?_) i + · simp + · rw [Fin.snoc_castSucc] + exact Fin.snoc_castSucc (α := fun _ ↦ Bool) c b i.succ + change (Fin.snoc (α := fun _ ↦ Bool) b c 0).toNat + + 2 * binaryValue (n+1) (fun i ↦ Fin.snoc (α := fun _ ↦ Bool) b c i.succ) = + (b 0).toNat + 2 * binaryValue n (fun i ↦ b i.succ) + 2^(n+1)*c.toNat + rw [ht, ih, Fin.snoc_apply_zero, pow_succ] + ring + +lemma signedValue_snoc (n : ℕ) (b : Fin n → Bool) (c : Bool) : + signedValue (n+1) (Fin.snoc b c) = signedValue n b + (2 : ℤ)^n * spin c := by + rw [signedValue, binaryValue_snoc] + simp only [Nat.cast_add, Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat, pow_succ] + unfold signedValue spin + ring + +def OffSpine : ℕ → Type + | 0 => Unit + | n+1 => OffSpine n × (((Fin n → Bool) × OffSpine n) × ((Fin n → Bool) × OffSpine n)) + +instance offSpineFintype : ∀ n, Fintype (OffSpine n) + | 0 => inferInstanceAs (Fintype Unit) + | n+1 => by + let : Fintype (OffSpine n) := offSpineFintype n + exact inferInstanceAs (Fintype (OffSpine n × + (((Fin n → Bool) × OffSpine n) × ((Fin n → Bool) × OffSpine n)))) + +instance offSpineNonempty : ∀ n, Nonempty (OffSpine n) + | 0 => ⟨()⟩ + | n+1 => by + let : Nonempty (OffSpine n) := offSpineNonempty n + exact inferInstanceAs (Nonempty (OffSpine n × + (((Fin n → Bool) × OffSpine n) × ((Fin n → Bool) × OffSpine n)))) + +abbrev TreeNoise (n : ℕ) := (Fin n → Bool) × OffSpine n + +def leaves : (n : ℕ) → ℤ → TreeNoise n → List ℤ + | 0, s, _ => [s] + | n+1, s, w => + leaves n s (Fin.init w.1, w.2.1) ++ leaves n s w.2.2.1 ++ + leaves n (spin (w.1 (Fin.last n))) w.2.2.2 + +@[simp] lemma length_leaves (n : ℕ) (s : ℤ) (w : TreeNoise n) : + (leaves n s w).length = 3^n := by + induction n generalizing s with + | zero => rfl + | succ n ih => simp only [leaves, List.length_append, ih, pow_succ]; omega + +lemma abs_of_mem_leaves {n : ℕ} {s : ℤ} (hs : |s| = 1) (w : TreeNoise n) + {x : ℤ} (hx : x ∈ leaves n s w) : |x| = 1 := by + induction n generalizing s with + | zero => + simp only [leaves, List.mem_singleton] at hx + exact hx ▸ hs + | succ n ih => + simp only [leaves, List.mem_append] at hx + rcases hx with (hx | hx) | hx + · exact ih hs _ hx + · exact ih hs _ hx + · exact ih (abs_spin _) _ hx + +def offSum : (n : ℕ) → OffSpine n → ℤ + | 0, _ => 0 + | n+1, w => offSum n w.1 + + (signedValue n w.2.1.1 + offSum n w.2.1.2) + + (signedValue n w.2.2.1 + offSum n w.2.2.2) + +lemma sum_leaves (n : ℕ) (s : ℤ) (w : TreeNoise n) : + (leaves n s w).sum = (2 : ℤ)^n * s + signedValue n w.1 + offSum n w.2 := by + induction n generalizing s with + | zero => simp [leaves, signedValue, binaryValue, offSum] + | succ n ih => + simp only [leaves, List.sum_append, ih, offSum] + have hsnoc : Fin.snoc (Fin.init w.1) (w.1 (Fin.last n)) = w.1 := Fin.snoc_init_self _ + have hsv := signedValue_snoc n (Fin.init w.1) (w.1 (Fin.last n)) + rw [hsnoc] at hsv + rw [hsv, pow_succ] + ring + +lemma uniform_product {A B : Type*} [Fintype A] [Fintype B] [Nonempty A] [Nonempty B] : + PMF.uniformOfFintype (A × B) = + (PMF.uniformOfFintype B).bind (fun b ↦ + (PMF.uniformOfFintype A).map (fun a ↦ (a,b))) := by + classical + ext ⟨a,b⟩ + simp [PMF.bind_apply, PMF.map_apply, PMF.uniformOfFintype_apply, + Fintype.card_prod, ENNReal.mul_inv, Prod.mk.injEq, ite_and, mul_comm] + +theorem leaf_sum_atom (n : ℕ) (s x : ℤ) : + ((PMF.uniformOfFintype (TreeNoise n)).map (fun w ↦ (leaves n s w).sum)) x ≤ + ((2 : ℝ≥0∞)^n)⁻¹ := by + rw [uniform_product, PMF.map_bind] + simp_rw [PMF.map_comp, Function.comp_def, sum_leaves] + have h : (fun w : OffSpine n ↦ + (PMF.uniformOfFintype (Fin n → Bool)).map + (fun b ↦ (2:ℤ)^n * s + signedValue n b + offSum n w)) = + (fun w : OffSpine n ↦ + ((PMF.uniformOfFintype (Fin n → Bool)).map (signedValue n)).map + (fun y ↦ y + ((2:ℤ)^n * s + offSum n w))) := by + funext w + rw [PMF.map_comp] + congr 1 + funext b + dsimp + ring + rw [h] + exact pmf_independent_shift_atom_le _ _ _ _ (signed_uniform_atom n) x + +def branchEquiv (n : ℕ) : TreeNoise (n+1) ≃ + Bool × (TreeNoise n × (TreeNoise n × TreeNoise n)) where + toFun w := (w.1 (Fin.last n), ((Fin.init w.1, w.2.1), w.2.2)) + invFun w := (Fin.snoc w.2.1.1 w.1, (w.2.1.2, w.2.2)) + left_inv w := by rcases w with ⟨b, c, d⟩; simp + right_inv w := by simp + +abbrev BranchContext (n : ℕ) := Bool × (TreeNoise n × TreeNoise n) + +def branchAt (n : ℕ) (d : Fin 3) : TreeNoise (n+1) ≃ TreeNoise n × BranchContext n := + (branchEquiv n).trans (match d with + | ⟨0, _⟩ => + { toFun := fun w ↦ (w.2.1, (w.1, w.2.2)) + invFun := fun w ↦ (w.2.1, (w.1, w.2.2)) + left_inv := fun _ ↦ rfl + right_inv := fun _ ↦ rfl } + | ⟨1, _⟩ => + { toFun := fun w ↦ (w.2.2.1, (w.1, (w.2.1, w.2.2.2))) + invFun := fun w ↦ (w.2.1, (w.2.2.1, (w.1, w.2.2.2))) + left_inv := fun _ ↦ rfl + right_inv := fun _ ↦ rfl } + | ⟨2, _⟩ => + { toFun := fun w ↦ (w.2.2.2, (w.1, (w.2.1, w.2.2.1))) + invFun := fun w ↦ (w.2.1, (w.2.2.1, (w.2.2.2, w.1))) + left_inv := fun _ ↦ rfl + right_inv := fun _ ↦ rfl }) + +def branchRoot (d : Fin 3) (s : ℤ) (b : Bool) : ℤ := + if d = 2 then spin b else s + +def branchBefore (n : ℕ) (d : Fin 3) (s : ℤ) (c : BranchContext n) : List ℤ := + match d with + | ⟨0, _⟩ => [] + | ⟨1, _⟩ => leaves n s c.2.1 + | ⟨2, _⟩ => leaves n s c.2.1 ++ leaves n s c.2.2 + +def branchAfter (n : ℕ) (d : Fin 3) (s : ℤ) (c : BranchContext n) : List ℤ := + match d with + | ⟨0, _⟩ => leaves n s c.2.1 ++ leaves n (spin c.1) c.2.2 + | ⟨1, _⟩ => leaves n (spin c.1) c.2.2 + | ⟨2, _⟩ => [] + +lemma leaves_branchAt (n : ℕ) (d : Fin 3) (s : ℤ) (w : TreeNoise n) + (c : BranchContext n) : + leaves (n+1) s ((branchAt n d).symm (w,c)) = + branchBefore n d s c ++ leaves n (branchRoot d s c.1) w ++ branchAfter n d s c := by + fin_cases d <;> simp [branchAt, branchEquiv, branchRoot, branchBefore, branchAfter, + leaves, List.append_assoc] + +lemma length_branchBefore (n : ℕ) (d : Fin 3) (s : ℤ) (c : BranchContext n) : + (branchBefore n d s c).length = d.val * 3^n := by + fin_cases d <;> simp [branchBefore, two_mul] + +def BlockContext (q : ℕ) : ℕ → Type + | 0 => Unit + | h+1 => BranchContext (q+h) × BlockContext q h + +instance blockContextFintype (q : ℕ) : ∀ h, Fintype (BlockContext q h) + | 0 => inferInstanceAs (Fintype Unit) + | h+1 => by + let : Fintype (BlockContext q h) := blockContextFintype q h + exact inferInstanceAs (Fintype (BranchContext (q+h) × BlockContext q h)) + +instance blockContextNonempty (q : ℕ) : ∀ h, Nonempty (BlockContext q h) + | 0 => ⟨()⟩ + | h+1 => by + let : Nonempty (BlockContext q h) := blockContextNonempty q h + exact inferInstanceAs (Nonempty (BranchContext (q+h) × BlockContext q h)) + +private def rotateProd (A B C : Type*) : (A × B) × C ≃ A × (C × B) where + toFun w := (w.1.1, (w.2, w.1.2)) + invFun w := ((w.1,w.2.2),w.2.1) + left_inv _ := rfl + right_inv _ := rfl + +def extractNoise (q : ℕ) : (h : ℕ) → (Fin h → Fin 3) → + TreeNoise (q+h) ≃ TreeNoise q × BlockContext q h + | 0, _ => + { toFun := fun w ↦ (w, ()) + invFun := Prod.fst + left_inv := fun _ ↦ rfl + right_inv := fun w ↦ by rcases w with ⟨w,⟨⟩⟩; rfl } + | h+1, a => (branchAt (q+h) (a 0)).trans + ((Equiv.prodCongr (extractNoise q h (fun i ↦ a i.succ)) (Equiv.refl _)).trans + (rotateProd _ _ _)) + +def blockRoot (q : ℕ) : (h : ℕ) → (Fin h → Fin 3) → ℤ → BlockContext q h → ℤ + | 0, _, s, _ => s + | h+1, a, s, c => blockRoot q h (fun i ↦ a i.succ) (branchRoot (a 0) s c.1.1) c.2 + +def blockBefore (q : ℕ) : (h : ℕ) → (Fin h → Fin 3) → ℤ → BlockContext q h → List ℤ + | 0, _, _, _ => [] + | h+1, a, s, c => branchBefore (q+h) (a 0) s c.1 ++ + blockBefore q h (fun i ↦ a i.succ) (branchRoot (a 0) s c.1.1) c.2 + +def blockAfter (q : ℕ) : (h : ℕ) → (Fin h → Fin 3) → ℤ → BlockContext q h → List ℤ + | 0, _, _, _ => [] + | h+1, a, s, c => blockAfter q h (fun i ↦ a i.succ) (branchRoot (a 0) s c.1.1) c.2 ++ + branchAfter (q+h) (a 0) s c.1 + +lemma leaves_extractNoise (q h : ℕ) (a : Fin h → Fin 3) (s : ℤ) (w : TreeNoise q) + (c : BlockContext q h) : + leaves (q+h) s ((extractNoise q h a).symm (w,c)) = + blockBefore q h a s c ++ leaves q (blockRoot q h a s c) w ++ blockAfter q h a s c := by + induction h generalizing s with + | zero => simp [extractNoise, blockBefore, blockRoot, blockAfter] + | succ h ih => + change leaves (q+h+1) s ((branchAt (q+h) (a 0)).symm + ((extractNoise q h (fun i ↦ a i.succ)).symm (w,c.2), c.1)) = _ + rw [leaves_branchAt, ih] + simp only [blockBefore, blockRoot, blockAfter, List.append_assoc] + +def addressIndex : (h : ℕ) → (Fin h → Fin 3) → ℕ + | 0, _ => 0 + | h+1, a => (a 0).val * 3^h + addressIndex h (fun i ↦ a i.succ) + +lemma length_blockBefore (q h : ℕ) (a : Fin h → Fin 3) (s : ℤ) (c : BlockContext q h) : + (blockBefore q h a s c).length = addressIndex h a * 3^q := by + induction h generalizing s with + | zero => simp [blockBefore, addressIndex] + | succ h ih => + simp only [blockBefore, List.length_append, length_branchBefore, ih, addressIndex, pow_add] + ring + +lemma uniform_equiv {A B : Type*} [Fintype A] [Fintype B] [Nonempty A] [Nonempty B] + (e : A ≃ B) : PMF.uniformOfFintype A = (PMF.uniformOfFintype B).map e.symm := by + classical + ext a + rw [PMF.map_apply, tsum_eq_single (e a)] + · simp [PMF.uniformOfFintype_apply, Fintype.card_congr e] + · intro b hb + have h : a ≠ e.symm b := fun h ↦ hb ((congrArg e h).trans (e.apply_symm_apply b)).symm + simp [h] + +lemma pair_map_apply {A B C : Type*} [DecidableEq B] (p : PMF A) (b : B) (f : A → C) (y : B) (z : C) : + (p.map (fun x ↦ (b, f x))) (y,z) = if y = b then (p.map f) z else 0 := by + classical + by_cases h : y = b + · simp [PMF.map_apply, Prod.mk.injEq, h] + · simp [PMF.map_apply, Prod.mk.injEq, h] + +lemma conditional_atom {A B C : Type*} (p : PMF A) (q : B → PMF C) + (c : A → B) (f : A → C → ℤ) (a : ℝ≥0∞) + (ha : ∀ w z, ((q (c w)).map (f w)) z ≤ a) (H : B) (z : ℤ) : + (p.bind (fun w ↦ (q (c w)).map (fun x ↦ (c w, f w x)))) (H,z) ≤ + a * (p.map c) H := by + classical + rw [PMF.bind_apply, PMF.map_apply, ← ENNReal.tsum_mul_left] + apply ENNReal.tsum_le_tsum + intro w + rw [pair_map_apply] + split_ifs with h + · simpa [mul_comm] using mul_le_mul_right (ha w z) (p w) + · simp + +lemma addressIndex_lt (h : ℕ) (a : Fin h → Fin 3) : addressIndex h a < 3^h := by + induction h with + | zero => simp [addressIndex] + | succ h ih => + have hd := (a 0).isLt + rw [addressIndex, pow_succ] + have := ih (fun i ↦ a i.succ) + nlinarith + +lemma addressIndex_surjective (h : ℕ) (b : ℕ) (hb : b < 3^h) : + ∃ a : Fin h → Fin 3, addressIndex h a = b := by + induction h generalizing b with + | zero => + have : b = 0 := by simpa using hb + exact ⟨Fin.elim0, this.symm⟩ + | succ h ih => + have hp : 0 < 3^h := pow_pos (by omega) _ + have hd : b / 3^h < 3 := (Nat.div_lt_iff_lt_mul hp).mpr (by simpa [pow_succ, mul_comm] using hb) + obtain ⟨a, ha⟩ := ih (b % 3^h) (Nat.mod_lt _ hp) + refine ⟨Fin.cons ⟨b / 3^h, hd⟩ a, ?_⟩ + simp only [addressIndex, Fin.cons_zero, Fin.cons_succ, ha] + simpa [mul_comm] using Nat.div_add_mod b (3^h) + +lemma take_sum_block (l b r : List ℤ) (v : ℕ) (hv : l.length + b.length ≤ v) : + ((l ++ b ++ r).take v).sum = b.sum + + (l.sum + (r.take (v - (l.length + b.length))).sum) := by + rw [List.take_append, List.take_of_length_le (by simpa using hv), List.sum_append, + List.sum_append, List.length_append] + ring + +def walk (m : ℕ) (w : TreeNoise m) (j : ℕ) : ℤ := (leaves m 1 w |>.take j).sum + +def incrementHistory (m u : ℕ) (w : TreeNoise m) : List ℤ := (leaves m 1 w).take u + +theorem aligned_prediction (q h : ℕ) (b u v : ℕ) (hb : b < 3^h) + (hu : u ≤ b * 3^q) (hv : (b+1) * 3^q ≤ v) (H : List ℤ) (x : ℤ) : + ((PMF.uniformOfFintype (TreeNoise (q+h))).map + (fun w ↦ (incrementHistory (q+h) u w, walk (q+h) w v))) (H,x) ≤ + ((2 : ℝ≥0∞)^q)⁻¹ * + ((PMF.uniformOfFintype (TreeNoise (q+h))).map (incrementHistory (q+h) u)) H := by + classical + obtain ⟨a, ha⟩ := addressIndex_surjective h b hb + let pre (c : BlockContext q h) := blockBefore q h a 1 c + let post (c : BlockContext q h) := blockAfter q h a 1 c + let root (c : BlockContext q h) := blockRoot q h a 1 c + let hist (c : BlockContext q h) := (pre c).take u + let shift (c : BlockContext q h) := (pre c).sum + (post c |>.take (v - (b+1)*3^q)).sum + have hp (c : BlockContext q h) : (pre c).length = b * 3^q := by + simp [pre, length_blockBefore, ha] + have hhist (w : TreeNoise q) (c : BlockContext q h) : + incrementHistory (q+h) u ((extractNoise q h a).symm (w,c)) = hist c := by + simp only [incrementHistory, leaves_extractNoise, List.append_assoc] + exact List.take_append_of_le_length (by change u ≤ (pre c).length; rw [hp]; exact hu) + have hwalk (w : TreeNoise q) (c : BlockContext q h) : + walk (q+h) ((extractNoise q h a).symm (w,c)) v = (leaves q (root c) w).sum + shift c := by + rw [walk, leaves_extractNoise, take_sum_block] + · simp only [root, shift, pre, post, length_blockBefore, ha, length_leaves, add_mul, one_mul] + · change (pre c).length + (leaves q (root c) w).length ≤ v + rw [hp, length_leaves] + simpa [add_mul] using hv + rw [uniform_equiv (extractNoise q h a)] + simp only [PMF.map_comp] + rw [uniform_product] + simp only [PMF.map_bind, PMF.map_comp, Function.comp_def, hhist, hwalk] + have hr : (PMF.uniformOfFintype (BlockContext q h)).bind + (fun c ↦ (PMF.uniformOfFintype (TreeNoise q)).map (fun _ ↦ hist c)) = + (PMF.uniformOfFintype (BlockContext q h)).map hist := by + change (PMF.uniformOfFintype (BlockContext q h)).bind + (fun c ↦ (PMF.uniformOfFintype (TreeNoise q)).map (Function.const _ (hist c))) = _ + simp only [PMF.map_const] + rfl + rw [hr] + + rw [PMF.bind_apply, PMF.map_apply, ← ENNReal.tsum_mul_left] + apply ENNReal.tsum_le_tsum + intro c + rw [pair_map_apply] + split_ifs with hc + · have hh : ((PMF.uniformOfFintype (TreeNoise q)).map + (fun w ↦ (leaves q (root c) w).sum + shift c)) x ≤ ((2:ℝ≥0∞)^q)⁻¹ := by + change ((PMF.uniformOfFintype (TreeNoise q)).map + ((fun y ↦ y + shift c) ∘ (fun w ↦ (leaves q (root c) w).sum))) x ≤ _ + rw [← PMF.map_comp] + exact pmf_map_injective_atom_le _ _ (fun _ _ e ↦ add_right_cancel e) _ _ + (leaf_sum_atom q (root c)) + simpa [mul_comm] using mul_le_mul_right hh ((PMF.uniformOfFintype (BlockContext q h)) c) + · simp + +end HardSphere.Lattice +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/BoxWeight.lean b/lean/OAI/Analysis/HardSphere/Geometry/BoxWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..10eb02e66c9363b5bbbc42de54ffa5c39cc5ac83 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/BoxWeight.lean @@ -0,0 +1,213 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.LargeParentMarked +import OAI.Analysis.HardSphere.Geometry.TorusNear + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped BigOperators Classical ENNReal +namespace HardSphere.BathSlice +open HardSphere.Lattice + +def boxWeight (m : ℕ) : ℝ≥0∞ := ENNReal.ofReal ((2*((m:ℝ)+1))^3) + +lemma volume_largeBoxUnion_le {K : ℕ} [NeZero K] (L : Length) (B : Finset (DiscreteTorus K)) : + (volume : Measure (Torus L)) (largeBoxUnion L B) ≤ animalCost (torusRangeGraph K 1) B boxWeight := by + classical + unfold largeBoxUnion animalCost + apply (measure_iUnion_le _).trans + apply ENNReal.tsum_le_tsum + intro m + apply (measure_iUnion_le _).trans + rw [tsum_fintype] + apply Finset.sum_le_sum + intro v _ + apply (measure_biUnion_finset_le _ _).trans + apply Finset.sum_le_sum + intro A _ + by_cases hA : A⊆B + · simp only [hA,Set.iUnion_true,ite_true] + simpa only [boxWeight,Nat.cast_add,Nat.cast_one,add_assoc,one_add_one_eq_two] using + volume_rootBox_le L (siteRep v) (by positivity : (0:ℝ)≤(m:ℝ)+2) + · simp only [hA,Set.iUnion_of_empty,measure_empty,ite_false,le_refl] + +attribute [local irreducible] torusDistance + +lemma pairCloseLabels_measurable {m : ℕ} (L : Length) (s : ℝ) (v : Torus L) : + Measurable (fun Y : Configuration m L ↦ ((pairCloseLabels L s v Y).card:ℝ)) := by + classical + simp only [pairCloseLabels,Finset.card_filter,Nat.cast_sum,Nat.cast_ite,Nat.cast_one,Nat.cast_zero] + apply Finset.measurable_sum + intro i _ + have hd : Continuous (fun Y : Configuration m L ↦ torusDistance L (Y i) v) := + (continuous_torusDistance L).comp + ((continuous_apply i).prodMk (continuous_const : Continuous (fun _ : Configuration m L ↦ v))) + have hp : MeasurableSet {Y : Configuration m L | ∃ j, j≠i ∧ torusDistance L (Y i) (Y j)≤ s} := by + simp only [Set.ofPred_exists] + apply MeasurableSet.iUnion + intro j + have hc : Continuous (fun Y : Configuration m L ↦ torusDistance L (Y i) (Y j)) := + (continuous_torusDistance L).comp ((show Continuous (fun Y : Configuration m L ↦ Y i) from continuous_apply i).prodMk + (show Continuous (fun Y : Configuration m L ↦ Y j) from continuous_apply j)) + by_cases hji : j≠i + · convert measurableSet_le hc.measurable (show Measurable (fun _ : Configuration m L ↦ s) from measurable_const) using 1 + ext Y + exact and_iff_right hji + · convert (MeasurableSet.empty : MeasurableSet (∅ : Set (Configuration m L))) using 1 + ext Y + exact iff_false_intro (fun h ↦ hji h.1) + exact Measurable.ite ((measurableSet_le hd.measurable measurable_const).inter hp) + measurable_const measurable_const + +lemma measurable_closeSet {n K : ℕ} [NeZero K] (L : Length) (s T : ℝ) : + Measurable (closeSet (n := n) (K := K) L s T) := by + classical + apply measurable_finset_iff.mpr + intro v + simp only [closeSet,Finset.mem_filter,Finset.mem_univ,true_and] + apply measurableSet_setOfPred.mp + exact measurableSet_le measurable_const (pairCloseLabels_measurable L s (siteCenter L v)) + +lemma volume_torus (L : Length) : (volume : Measure (Torus L)) Set.univ = ENNReal.ofReal (L.val^3) := by + rw [volume_pi,Measure.pi_univ] + simp only [AddCircle.measure_univ,Finset.prod_const,Finset.card_univ,Fintype.card_fin, + ENNReal.ofReal_pow L.property.le] + +lemma microperiod_length {K : ℕ} {L : Length} {r : ℝ} (hr : 0 < r) + (hLK : L.val=(K:ℝ)) : L.val = microMesh r * ((microPeriod r*K : ℕ):ℝ) := by + have hq : (microPeriod r : ℝ) ≠ 0 := by exact_mod_cast (microPeriod_pos hr).ne' + rw [hLK,microMesh,Nat.cast_mul] + field_simp + +theorem omitted_volume_le {n K M : ℕ} [NeZero K] {L : Length} {r s T : ℝ} + (hr : 0 < r) (hrsmall : r ≤ 1/4096) (hL : 10 < L.val) (hLK : L.val=(K:ℝ)) + (hMK : M ≤ K) (hrs : 6*r ≤ s) (hT : T ≤ 1/(1372*r)) + (Y : Configuration n L) (hY : Y ∈ allowed n L r) : + (volume : Measure (Torus L)) (omitted (microMesh r) r Y) ≤ + ENNReal.ofReal (1029*r^2*n) + + animalCost (torusRangeGraph K 1) (closeSet L s T Y) boxWeight + + (if LargeBadComponent (torusRangeGraph K 1) (closeSet L s T Y) M then + ENNReal.ofReal (L.val^3) else 0) := by + classical + have hmesh := microMesh_bounds hr (by linarith : r ≤ 1) + have hmark : LargeParentMarked (microPeriod r) (microMesh r) r Y (closeSet (K := K) L s T Y) := by + simpa only [mul_one,Function.Embedding.refl_apply] using actual_large_parent_marked (K := K) (D := 1) (θ := T) + hr hrsmall hL hLK hrs (by simpa using hT) (Function.Embedding.refl _) Y + by_cases he : LargeBadComponent (torusRangeGraph K 1) (closeSet L s T Y) M + · simp only [he,ite_true] + calc + _ ≤ (volume : Measure (Torus L)) Set.univ := measure_mono (Set.subset_univ _) + _ = ENNReal.ofReal (L.val^3) := volume_torus L + _ ≤ _ := le_add_self + · simp only [he,ite_false,add_zero] + have hK : 2 < K := by rw [hLK] at hL; exact_mod_cast (show (2:ℝ).mpr hmesh.2.1 + exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hsq (by norm_num)) (Nat.cast_nonneg n) + · exact volume_largeBoxUnion_le L _ + +theorem omitted_mean_marginal {m n : ℕ} (L : Length) (h r : ℝ) + (e : Fin m ↪ Fin n) (μ : Measure (Configuration n L)) : + (∫⁻ Y, (volume : Measure (Torus L)) (omitted h r Y) + ∂(μ.map (fun X i ↦ X (e i)))) = + ∫⁻ X, (volume : Measure (Torus L)) (omitted h r (fun i ↦ X (e i))) ∂μ := by + exact lintegral_map (measurable_omitted_volume L h r) + (Measurable.of_eval (fun i ↦ measurable_pi_apply (e i))) + +end HardSphere.BathSlice + +namespace HardSphere.BathSlice +open HardSphere.Lattice + +lemma boxWeight_le (m : ℕ) : boxWeight (m+1) ≤ 64*(8:ℝ≥0∞)^m := by + have hnat : m+2 ≤ 2^(m+1) := by have := (Nat.lt_two_pow_self (n := m+1)); omega + have hbound : 8*(m+2)^3 ≤ 64*8^m := by + calc + _ ≤ 8*(2^(m+1))^3 := by gcongr + _ = 64*8^m := by rw [←pow_mul,Nat.mul_comm (m+1) 3,pow_mul]; norm_num; rw [pow_succ]; ring + have heq : boxWeight (m+1) = ((8*(m+2)^3:ℕ):ℝ≥0∞) := by + unfold boxWeight + norm_cast + ring + rw [heq] + exact_mod_cast hbound + +lemma box_series_le {q : ℝ≥0∞} (hq : 8*q ≤ (2:ℝ≥0∞)⁻¹) : + (∑' m : ℕ, boxWeight (m+1)*q^(m+1)) ≤ 128*q := by + calc + _ ≤ ∑' m : ℕ, (64*q)*((2:ℝ≥0∞)⁻¹)^m := by + apply ENNReal.tsum_le_tsum + intro m + calc + _ ≤ (64*8^m)*q^(m+1) := mul_le_mul' (boxWeight_le m) le_rfl + _ = (64*q)*(8*q)^m := by rw [mul_pow,pow_succ]; ring + _ ≤ _ := mul_le_mul' le_rfl (pow_le_pow_left' hq m) + _ = (64*q)*2 := by rw [ENNReal.tsum_mul_left,ENNReal.tsum_geometric_two] + _ = _ := by ring + +theorem omitted_mean_le {n K M : ℕ} [NeZero K] {L : Length} {r s T : ℝ} + (hr : 0 < r) (hrsmall : r ≤ 1/4096) (hL : 10 < L.val) (hLK : L.val=(K:ℝ)) + (hMK : M ≤ K) (hM : 1 ≤ M) (hrs : 6*r ≤ s) (hT : T ≤ 1/(1372*r)) + (μ : Measure (Configuration n L)) [IsProbabilityMeasure μ] + (hallowed : ∀ᵐ Y ∂μ, Y ∈ allowed n L r) (p : ℝ≥0∞) + (hbad : ∀ A : Finset (DiscreteTorus K), μ {Y | A ⊆ closeSet L s T Y} ≤ p^A.card) + (hp : 8*((2^27:ℕ):ℝ≥0∞)*p ≤ (2:ℝ≥0∞)⁻¹) : + (∫⁻ Y, (volume : Measure (Torus L)) (omitted (microMesh r) r Y) ∂μ) ≤ + ENNReal.ofReal (1029*r^2*n) + + (K:ℝ≥0∞)^3*(128*(((2^27:ℕ):ℝ≥0∞)*p)) + + ENNReal.ofReal (L.val^3)*(K:ℝ≥0∞)^3*(((2^27:ℕ):ℝ≥0∞)*p)^M := by + classical + let B := closeSet (n := n) (K := K) L s T + let E := {Y : Configuration n L | LargeBadComponent (torusRangeGraph K 1) (B Y) M} + have hB : Measurable B := measurable_closeSet L s T + have hE : MeasurableSet E := by + exact (Set.to_countable {C : Finset (DiscreteTorus K) | + LargeBadComponent (torusRangeGraph K 1) C M}).measurableSet.preimage hB + have hdegree (v : DiscreteTorus K) : (torusRangeGraph K 1).degree v ≤ 27 := by + simpa using torusRange_degree 1 v + have hcard : Fintype.card (DiscreteTorus K) = K^3 := by + simp only [DiscreteTorus,Fintype.card_fun,ZMod.card,Fintype.card_fin] + have hcost := animalCost_mean_le (torusRangeGraph K 1) 27 hdegree μ B hB p hbad boxWeight + rw [hcard,Nat.cast_pow] at hcost + have hprob := largeBadComponent_measure (torusRangeGraph K 1) 27 hdegree μ B p hbad M hM + rw [hcard,Nat.cast_pow] at hprob + have hi : (fun Y ↦ if Y∈E then ENNReal.ofReal (L.val^3) else 0) = + E.indicator (fun _ ↦ ENNReal.ofReal (L.val^3)) := by + ext Y + simp only [Set.indicator_apply] + calc + _ ≤ ∫⁻ Y, ENNReal.ofReal (1029*r^2*n) + animalCost (torusRangeGraph K 1) (B Y) boxWeight + + (if Y∈E then ENNReal.ofReal (L.val^3) else 0) ∂μ := by + apply lintegral_mono_ae + filter_upwards [hallowed] with Y hY + exact omitted_volume_le hr hrsmall hL hLK hMK hrs hT Y hY + _ = ENNReal.ofReal (1029*r^2*n) + (∫⁻ Y, animalCost (torusRangeGraph K 1) (B Y) boxWeight ∂μ) + + ENNReal.ofReal (L.val^3)*μ E := by + have hm : Measurable (fun Y ↦ ENNReal.ofReal (1029*r^2*n) + + animalCost (torusRangeGraph K 1) (B Y) boxWeight) := + measurable_const.add (measurable_animalCost _ B hB _) + rw [lintegral_add_left hm, + lintegral_add_left measurable_const,hi,lintegral_indicator_const hE,lintegral_const] + simp only [measure_univ,mul_one] + _ ≤ _ := by + apply add_le_add + · apply add_le_add_right + exact hcost.trans (mul_le_mul' le_rfl (box_series_le (by simpa only [mul_assoc] using hp))) + · exact (mul_le_mul' le_rfl hprob).trans_eq (by ring) + +end HardSphere.BathSlice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/BufferedAllowed.lean b/lean/OAI/Analysis/HardSphere/Geometry/BufferedAllowed.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9484b13486eb6fa07465b6cf9277d5f8ef7e592 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/BufferedAllowed.lean @@ -0,0 +1,108 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.NormSqIntegral +import OAI.Analysis.HardSphere.Comparison.KilledLaplace +import OAI.Analysis.HardSphere.FormDomain.DirichletScalarInjective + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace HardSphere +open MeasureTheory Set Filter +open scoped Topology + +lemma killedLaplace_innerRadius_tendsto (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) : + Tendsto (fun n ↦ killedLaplace N L (innerRadius a n) f) atTop (𝓝 (killedLaplace N L a f)) := by + apply tendsto_integral_of_dominated_convergence (fun t : ℝ ↦ Real.exp (-t)*‖f‖) + · intro n + exact (laplaceIntegrand_integrable (killedTransition N L (innerRadius a n)) + (killedTransition_clamped_continuous N L (innerRadius a n)) + (fun t _ ↦ killedTransition_apply_contraction N L (innerRadius a n) t) f 0).aestronglyMeasurable + · exact (integrableOn_exp_neg_Ioi 0).mul_const ‖f‖ + · intro n + apply Eventually.of_forall + intro t + rw [laplaceIntegrand_eq_complex] + rw [norm_smul,Complex.norm_real,Real.norm_eq_abs,abs_of_pos (Real.exp_pos _)] + exact mul_le_mul_of_nonneg_left (killedTransition_apply_contraction N L (innerRadius a n) _ f) + (Real.exp_nonneg _) + · apply Eventually.of_forall + intro t + simp_rw [laplaceIntegrand_eq_complex] + exact tendsto_const_nhds.smul (killedTransition_innerRadius_tendsto N L a (max 0 t) f) + +def bufferedAllowed (N : ℕ) (L : Length) (b : ℝ) : Set (Configuration N L) := + {X | ∀ i j : Fin N, i.mpr hub + _ = C := Real.sq_sqrt hC + +end HardSphere + +open ProbabilityTheory + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/CandidateConstant.lean b/lean/OAI/Analysis/HardSphere/Geometry/CandidateConstant.lean new file mode 100644 index 0000000000000000000000000000000000000000..efd486eaf1ec67420fd2bdab173d2f969dccf500 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/CandidateConstant.lean @@ -0,0 +1,211 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.EnnrealTsumFinset +import OAI.Analysis.HardSphere.Geometry.NominalDrift + +namespace OAI + +noncomputable section +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped ENNReal NNReal +namespace HardSphere.Lattice + +lemma geometricEnvelope_ne_top (A R : ℕ) (b q : ℝ≥0∞) (hb : b≠⊤) (hq : q<1) + (z : ℤ×ℤ) : radiusEnvelope (geometricRadiusWeights A R b q) z≠⊤ := by + rw [geometricRadiusWeights_envelope] + apply ENNReal.add_ne_top.mpr + constructor + · split_ifs <;> simp_all + · apply ne_top_of_le_ne_top (b:=∑' m : ℕ, q^(m+1)) + · have he : (∑' m : ℕ, q^(m+1))=q*(∑' m : ℕ,q^m) := by + simp_rw [pow_succ',ENNReal.tsum_mul_left] + rw [he,ENNReal.tsum_geometric] + exact ENNReal.mul_ne_top (ne_of_lt (hq.trans (by norm_num))) + (ENNReal.inv_ne_top.mpr (ne_of_gt (tsub_pos_iff_lt.mpr hq))) + · exact ENNReal.tsum_le_tsum fun m ↦ by split_ifs <;> simp + +def candidateConstant (a : ℕ) : ℕ := (2*(a+3)+1)^3*2^((2*a+1)^3)+(12*a+24) + +def encounterConstant (R : ℕ) : ℕ := 343*(2*R+1)^3 + +lemma candidateConstant_growth (a : ℕ) : + (2*(a+3)+1)^3*2^((2*a+1)^3)≤candidateConstant a := Nat.le_add_right _ _ + +lemma candidateConstant_radius (a : ℕ) : 12*a+24≤candidateConstant a := Nat.le_add_left _ _ + +lemma encounterConstant_detour (R : ℕ) : 52*(2*R+1)^3≤encounterConstant R := by + exact Nat.mul_le_mul_right _ (by norm_num) + +theorem nominal_potential_bound {K m n : ℕ} [NeZero K] (R : ℕ) + (hn : 0 positivity)] + apply Finset.sum_congr rfl + intro F _ + split_ifs <;> simp [ENNReal.ofReal_pow ht0] + rw [hcast] + refine hF.trans (Finset.sum_le_sum fun i _ ↦ ENNReal.tsum_le_tsum fun l ↦ ?_) + by_cases h : torusNear K ((12*(R+2)+24)*(l+1)) (torusProjection K (U i)) (torusProjection K (U' i)) + · have hz : z i∈square (A*(l+1)) := (hnear _ i).mp + (torusNear_mono (Nat.mul_le_mul_right _ (candidateConstant_radius (R+2))) h) + rw [ite_eq_left h,ite_eq_left hz] + apply pow_le_pow_left' + rw [ENNReal.ofReal_mul (Nat.cast_nonneg _),ENNReal.ofReal_natCast] + apply mul_le_mul' _ le_rfl + exact_mod_cast candidateConstant_growth (R+2) + · rw [ite_eq_right h]; exact zero_le + have hfinite (i : Fin (n+1)) : radiusEnvelope weights (z i)≠⊤ := by + apply geometricEnvelope_ne_top _ _ _ _ ENNReal.ofReal_ne_top + exact (ENNReal.ofReal_lt_one).mpr hqt + have hbound := add_le_add hNen hFen + rw [← Finset.sum_add_distrib] at hbound + have hrw (i : Fin (n+1)) : + (if z i∈square (4*(R+6)) then ENNReal.ofReal ((C:ℝ)*κ) else 0)+ + (∑' l : ℕ, if z i∈square (A*(l+1)) then (ENNReal.ofReal ((A:ℝ)*t))^(l+1) else 0)= + ENNReal.ofReal (radiusPotential weights (z i)) := by + rw [radiusPotential,ENNReal.ofReal_toReal (hfinite i)] + exact (geometricRadiusWeights_envelope _ _ _ _ _).symm + simp_rw [hrw] at hbound + rw [← ENNReal.ofReal_sum_of_nonneg (fun i _ ↦ radiusPotential_nonneg weights (z i))] at hbound + rw [← ENNReal.ofReal_add (mul_nonneg hκ (Nat.cast_nonneg _)) + (Finset.sum_nonneg (by intro F _; split_ifs <;> positivity))] at hbound + have hreal := (ENNReal.ofReal_le_ofReal_iff (Finset.sum_nonneg + (fun i _ ↦ radiusPotential_nonneg weights (z i)))).mp hbound + dsimp only [z] at hreal + rw [Fin.sum_univ_eq_sum_range (fun j ↦ radiusPotential weights (differenceAt m (min j (n-j)) w)) (n+1)] at hreal + exact hreal + +end HardSphere.Lattice + +open scoped ENNReal +namespace HardSphere.Lattice +universe u +variable {V : Type u} [Fintype V] [DecidableEq V] +omit [Fintype V] in + +lemma prod_one_add_ofReal_le_exp_sum {I : Type*} (Q : Finset I) (w : I → ℝ) + (hw : ∀ i ∈ Q, 0 ≤ w i) : + ∏ i ∈ Q, (1 + ENNReal.ofReal (w i)) ≤ + ENNReal.ofReal (Real.exp (∑ i ∈ Q, w i)) := by + classical + induction Q using Finset.induction_on with + | empty => simp + | @insert i Q hi ih => + rw [Finset.prod_insert hi, Finset.sum_insert hi, Real.exp_add, + ENNReal.ofReal_mul (Real.exp_pos _).le] + have hwi := hw i (Finset.mem_insert_self i Q) + have hQ : ∀ j ∈ Q, 0 ≤ w j := fun j hj ↦ hw j (Finset.mem_insert_of_mem hj) + apply mul_le_mul' _ (ih hQ) + rw [← ENNReal.ofReal_one, ← ENNReal.ofReal_add (by norm_num) hwi] + exact ENNReal.ofReal_le_ofReal (by simpa [add_comm] using Real.add_one_le_exp (w i)) + +theorem badComponents_exponential_bound (G : SimpleGraph V) + (μ : PMF (Finset V)) (p β : ℝ) (hp : 0 ≤ p) + (hbad : JointBadLaw μ (ENNReal.ofReal p)) (P : Finset V → Prop) : + (∑' B, μ B * ENNReal.ofReal (Real.exp + (β * ∑ F∈badComponents G B, if P F then (F.card:ℝ) else 0))) ≤ + ENNReal.ofReal (Real.exp (∑ F∈candidateSets G, + if P F then (p * Real.exp β)^F.card else 0)) := by + let w : Finset V → ℝ≥0∞ := fun F ↦ if P F then + ENNReal.ofReal (Real.exp (β * (F.card:ℝ))) else 0 + have hpoint (B : Finset V) : + ENNReal.ofReal (Real.exp + (β * ∑ F∈badComponents G B, if P F then (F.card:ℝ) else 0)) ≤ + ∏ F∈badComponents G B, (1+w F) := by + rw [Finset.mul_sum, Real.exp_sum] + rw [ENNReal.ofReal_prod_of_nonneg (fun _ _ ↦ (Real.exp_pos _).le)] + apply Finset.prod_le_prod + intro F _ + by_cases h : P F + · simp only [ite_eq_left h,w] + exact le_add_self + · simp only [ite_eq_right h,w,mul_zero,Real.exp_zero,ENNReal.ofReal_one,add_zero] + exact le_rfl + calc + _ ≤ ∑' B, μ B * ∏ F∈badComponents G B, (1+w F) := by + exact ENNReal.tsum_le_tsum fun B ↦ mul_le_mul' le_rfl (hpoint B) + _ ≤ ∏ F∈candidateSets G, (1+(ENNReal.ofReal p)^F.card*w F) := + environment_product_bound μ _ hbad (badComponents G) + (badComponents_disjoint G) (fun B F hF ↦ badComponents_subset G B hF) + (candidateSets G) (badComponents_candidate G) w + _ = ∏ F∈candidateSets G, + (1+ENNReal.ofReal (if P F then (p*Real.exp β)^F.card else 0)) := by + apply Finset.prod_congr rfl + intro F _ + dsimp only [w] + by_cases h : P F + · simp only [ite_eq_left h] + rw [← ENNReal.ofReal_pow hp,← ENNReal.ofReal_mul (pow_nonneg hp _), + mul_comm β (F.card:ℝ),Real.exp_nat_mul,mul_pow] + · simp only [ite_eq_right h,mul_zero,ENNReal.ofReal_zero] + _ ≤ _ := prod_one_add_ofReal_le_exp_sum _ _ (by + intro F _ + split_ifs + · exact pow_nonneg (mul_nonneg hp (Real.exp_pos _).le) _ + · exact le_rfl) + +end HardSphere.Lattice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/CenteredCircleLift.lean b/lean/OAI/Analysis/HardSphere/Geometry/CenteredCircleLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..b38d66dec2b236cd23151cd8806dfc0f4fb22861 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/CenteredCircleLift.lean @@ -0,0 +1,175 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.EuclideanTorus +import OAI.Analysis.HardSphere.Allocation.NormalizedNearestSeparated + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter + +def centeredCircleLift (L : Length) (x : AddCircle L.val) : ℝ := + let t := ((AddCircle.equivIco L.val 0) x).val + t-(round (L.val⁻¹*t):ℝ)*L.val + +lemma centeredCircleLift_coe (L : Length) (x : AddCircle L.val) : + (centeredCircleLift L x : AddCircle L.val)=x := by + unfold centeredCircleLift + rw [AddCircle.coe_sub,←zsmul_eq_mul,AddCircle.coe_zsmul,AddCircle.coe_period,zsmul_zero,sub_zero] + exact AddCircle.coe_equivIco + +lemma centeredCircleLift_abs (L : Length) (x : AddCircle L.val) : + |centeredCircleLift L x|=‖x‖ := by + conv_rhs => rw [←(show ((((AddCircle.equivIco L.val 0) x).val):AddCircle L.val)=x from AddCircle.coe_equivIco)] + exact (AddCircle.norm_eq L.val).symm + +def centeredTorusVector (L : Length) (x c : Torus L) : EuclideanSpace ℝ (Fin 3) := + WithLp.toLp 2 (fun q ↦ centeredCircleLift L (x q-c q)) + +lemma centeredTorusVector_norm (L : Length) (x c : Torus L) : + ‖centeredTorusVector L x c‖=torusDistance L x c := by + rw [EuclideanSpace.norm_eq] + unfold torusDistance + congr 1 + apply Finset.sum_congr rfl + intro q _ + change ‖centeredCircleLift L (x q-c q)‖^2=dist (x q) (c q)^2 + rw [Real.norm_eq_abs,centeredCircleLift_abs,dist_eq_norm] + +lemma centeredTorusVector_coe (L : Length) (x c : Torus L) (q : Fin 3) : + ((centeredTorusVector L x c q):AddCircle L.val)=x q-c q := + centeredCircleLift_coe L _ + +lemma centeredTorusVector_distance (L : Length) (x y c : Torus L) : + torusDistance L x y≤‖centeredTorusVector L x c-centeredTorusVector L y c‖ := by + rw [EuclideanSpace.norm_eq] + unfold torusDistance + apply Real.sqrt_le_sqrt + apply Finset.sum_le_sum + intro q _ + have hcoe : (((centeredTorusVector L x c q-centeredTorusVector L y c q):ℝ):AddCircle L.val)=x q-y q := by + rw [AddCircle.coe_sub,centeredTorusVector_coe,centeredTorusVector_coe] + abel + have hnorm : dist (x q) (y q)≤‖centeredTorusVector L x c q-centeredTorusVector L y c q‖ := by + rw [dist_eq_norm,←hcoe] + exact QuotientAddGroup.norm_mk_le_norm + exact (sq_le_sq₀ dist_nonneg (norm_nonneg _)).mpr hnorm + +theorem torus_nearest_incoming_card {ι : Type*} [DecidableEq ι] + (L : Length) (X : ι→Torus L) (c : Torus L) (I : Finset ι) + (h0 : ∀ i∈I, X i≠c) + (hne : ∀ i∈I, ∀ j∈I, i≠j → torusDistance L (X i) c≤torusDistance L (X i) (X j)) : + I.card≤125 := by + have hz : ∀ i∈I, centeredTorusVector L (X i) c≠0 := by + intro i hi he + apply h0 i hi + funext q + have h := centeredTorusVector_coe L (X i) c q + rw [he] at h + exact sub_eq_zero.mp (by simpa using h.symm) + have hsep : ∀ i∈I, ∀ j∈I, i≠j → + ‖centeredTorusVector L (X i) c‖≤‖centeredTorusVector L (X i) c-centeredTorusVector L (X j) c‖ := by + intro i hi j hj hij + rw [centeredTorusVector_norm] + exact (hne i hi j hj hij).trans (centeredTorusVector_distance L (X i) (X j) c) + have h := nearest_incoming_card I (fun i ↦ centeredTorusVector L (X i) c) hz hsep + simpa using h + +end HardSphere + +namespace HardSphere +open MeasureTheory Set Filter + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nontrivial ι] + +lemma otherLabels_nonempty (i : ι) : (Finset.univ.erase i).Nonempty := by + obtain ⟨j,hj⟩ := exists_ne i + exact ⟨j,Finset.mem_erase.mpr ⟨hj,Finset.mem_univ _⟩⟩ + +lemma nearestLabel_exists (L : Length) (X : ι→Torus L) (i : ι) : + ∃ j : ι, j≠i ∧ ∀ k : ι, k≠i → torusDistance L (X i) (X j)≤torusDistance L (X i) (X k) := by + obtain ⟨j,hj,hm⟩ := (Finset.univ.erase i).exists_min_image + (fun j ↦ torusDistance L (X i) (X j)) (otherLabels_nonempty i) + exact ⟨j,(Finset.mem_erase.mp hj).1,fun k hk ↦ hm k (Finset.mem_erase.mpr ⟨hk,Finset.mem_univ _⟩)⟩ + +def nearestLabel (L : Length) (X : ι→Torus L) (i : ι) : ι := + Classical.choose (nearestLabel_exists L X i) + +lemma nearestLabel_ne (L : Length) (X : ι→Torus L) (i : ι) : nearestLabel L X i≠i := + (Classical.choose_spec (nearestLabel_exists L X i)).1 + +def nearestParticleDistance (L : Length) (X : ι→Torus L) (i : ι) : ℝ := + torusDistance L (X i) (X (nearestLabel L X i)) + +lemma nearestParticleDistance_le (L : Length) (X : ι→Torus L) (i j : ι) (hji : j≠i) : + nearestParticleDistance L X i≤torusDistance L (X i) (X j) := + (Classical.choose_spec (nearestLabel_exists L X i)).2 j hji + +lemma nearestParticleDistance_nonneg (L : Length) (X : ι→Torus L) (i : ι) : + 0≤nearestParticleDistance L X i := Real.sqrt_nonneg _ + +lemma nearestParticleDistance_inf (L : Length) (X : ι→Torus L) (i : ι) : + nearestParticleDistance L X i=(Finset.univ.erase i).inf' (otherLabels_nonempty i) + (fun j ↦ torusDistance L (X i) (X j)) := by + apply le_antisymm + · apply Finset.le_inf' + intro j hj + exact nearestParticleDistance_le L X i j (Finset.mem_erase.mp hj).1 + · exact Finset.inf'_le _ (Finset.mem_erase.mpr ⟨nearestLabel_ne L X i,Finset.mem_univ _⟩) + +lemma nearestParticleDistance_continuous (L : Length) (i : ι) : + Continuous (fun X : ι→Torus L ↦ nearestParticleDistance L X i) := by + simp_rw [nearestParticleDistance_inf] + apply Continuous.finset_inf'_apply + intro j _ + unfold torusDistance + fun_prop + +lemma nearestLabel_fiber_card (L : Length) (X : ι→Torus L) (hX : Function.Injective X) (k : ι) : + (Finset.univ.filter (fun i ↦ nearestLabel L X i=k)).card≤125 := by + apply torus_nearest_incoming_card L X (X k) + · intro i hi + have hik : i≠k := by + intro he + have hm := nearestLabel_ne L X i + exact hm ((Finset.mem_filter.mp hi).2.trans he.symm) + exact fun he ↦ hik (hX he) + · intro i hi j _ hij + have hm := nearestParticleDistance_le L X i j hij.symm + simpa only [nearestParticleDistance,(Finset.mem_filter.mp hi).2] using hm + +lemma torusDistance_triangle' (L : Length) (x y z : Torus L) : + torusDistance L x z≤torusDistance L x y+torusDistance L y z := by + simpa only [euclideanTorusPoint_dist] using dist_triangle + (euclideanTorusPoint L x) (euclideanTorusPoint L y) (euclideanTorusPoint L z) + +lemma nearestParticleDistance_sub_le (L : Length) (X Y : ι→Torus L) (i : ι) : + nearestParticleDistance L Y i-nearestParticleDistance L X i≤ + torusDistance L (X i) (Y i)+torusDistance L (X (nearestLabel L X i)) (Y (nearestLabel L X i)) := by + have hm := nearestParticleDistance_le L Y i (nearestLabel L X i) (nearestLabel_ne L X i) + have ht := torusDistance_triangle' L (Y i) (X i) (Y (nearestLabel L X i)) + have ht' := torusDistance_triangle' L (X i) (X (nearestLabel L X i)) (Y (nearestLabel L X i)) + have hs : torusDistance L (Y i) (X i)=torusDistance L (X i) (Y i) := by + simp only [torusDistance,dist_comm] + rw [hs] at ht + dsimp [nearestParticleDistance] + dsimp [nearestParticleDistance] at hm + linarith only [hm,ht,ht'] + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/CoeScalar.lean b/lean/OAI/Analysis/HardSphere/Geometry/CoeScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d3134a91b3b744fbd478853cf1d359ac4b9bf0f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/CoeScalar.lean @@ -0,0 +1,60 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.InnerClmRealRight +import OAI.Analysis.HardSphere.Geometry.NormSqIntegral +import OAI.Analysis.HardSphere.Geometry.SmoothMultiplier + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate + +lemma SmoothMultiplier.coe_onScalar {n : ℕ} {L : Length} (f : SmoothMultiplier n L) (u : ScalarL2 n L) : + f.onScalar u =ᵐ[volume] fun X ↦ f.toFun X*u X := L2Multiplier.coe_clm _ _ _ + +lemma SmoothMultiplier.coe_derivativeScalar {n : ℕ} {L : Length} (f : SmoothMultiplier n L) + (p : Direction n) (u : ScalarL2 n L) : + f.derivativeScalar p u =ᵐ[volume] fun X ↦ coordDerivative n L f.toFun p X*u X := + L2Multiplier.coe_clm _ _ _ + +lemma SmoothMultiplier.gradient_norm_le {S : Type*} {n : ℕ} {L : Length} + (A : Finset S) (f : SmoothMultiplier n L) (g : S → SmoothMultiplier n L) (C : ℝ) + (hfg : ∀ X, (∑ p : Direction n, ‖coordDerivative n L f.toFun p X‖^2) ≤ + C*∑ s∈A, ‖(g s).toFun X‖^2) (u : ScalarL2 n L) : + (∑ p : Direction n, ‖f.derivativeScalar p u‖^2) ≤ C*∑ s∈A, ‖(g s).onScalar u‖^2 := by + have hi (p : Direction n) : Integrable (fun X ↦ ‖(f.derivativeScalar p u) X‖^2) volume := + (Lp.memLp _).integrable_norm_pow (by norm_num) + have hj (s : S) : Integrable (fun X ↦ ‖((g s).onScalar u) X‖^2) volume := + (Lp.memLp _).integrable_norm_pow (by norm_num) + simp_rw [IndicatorStrong.norm_sq_integral] + rw [← integral_finsetSum Finset.univ (fun p _ ↦ hi p), + ← integral_finsetSum A (fun s _ ↦ hj s),← integral_const_mul] + apply integral_mono_ae (integrable_finsetSum _ (fun p _ ↦ hi p)) + ((integrable_finsetSum _ (fun s _ ↦ hj s)).const_mul C) + have hd : ∀ᵐ X ∂volume, ∀ p, (f.derivativeScalar p u) X=coordDerivative n L f.toFun p X*u X := + ae_all_iff.mpr (fun p ↦ f.coe_derivativeScalar p u) + have hg : ∀ᵐ X ∂volume, ∀ s∈A, ((g s).onScalar u) X=(g s).toFun X*u X := + (ae_ball_iff A.countable_toSet).mpr (fun s _ ↦ (g s).coe_onScalar u) + filter_upwards [hd,hg] with X hX hY + simp_rw [hX,norm_mul,mul_pow] + have he : (∑ s∈A, ‖((g s).onScalar u) X‖^2)= + (∑ s∈A, ‖(g s).toFun X‖^2)*‖u X‖^2 := by + rw [Finset.sum_mul] + exact Finset.sum_congr rfl fun s hs ↦ by rw [hY s hs,norm_mul,mul_pow] + rw [he,← Finset.sum_mul,← mul_assoc] + exact mul_le_mul_of_nonneg_right (hfg X) (sq_nonneg _) + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/ConfigurationPath.lean b/lean/OAI/Analysis/HardSphere/Geometry/ConfigurationPath.lean new file mode 100644 index 0000000000000000000000000000000000000000..59808c776e0b5b307953dbd97e32f3673b223930 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/ConfigurationPath.lean @@ -0,0 +1,261 @@ +import Mathlib +import OAI.Analysis.HardSphere.FormDomain.HilbertJet +import OAI.Analysis.HardSphere.Bridges.Index + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +noncomputable section +open scoped BigOperators ComplexConjugate +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere +open Wiener + +instance configurationBorel (N : ℕ) (L : Length) : BorelSpace (Configuration N L) := by + unfold Configuration + exact Pi.borelSpace + +abbrev ConfigurationPath (N : ℕ) (L : Length) := C(Time, Configuration N L) +instance configurationPathMeasurable (N : ℕ) (L : Length) : MeasurableSpace (ConfigurationPath N L) := borel _ +instance configurationPathBorel (N : ℕ) (L : Length) : BorelSpace (ConfigurationPath N L) := ⟨rfl⟩ + +def staysAllowed (N : ℕ) (L : Length) (a : ℝ) : Set (ConfigurationPath N L) := + {f | Set.range f ⊆ allowed N L a} + +lemma staysAllowed_open (N : ℕ) (L : Length) (a : ℝ) : IsOpen (staysAllowed N L a) := + ContinuousMap.isOpen_setOfPred_range_subset (isOpen_allowed N L a) + +lemma staysAllowed_antitone (N : ℕ) (L : Length) : Antitone (staysAllowed N L) := by + intro a b hab f hf + exact hf.trans (allowed_antitone N L hab) + +lemma staysAllowed_innerRadius (N : ℕ) (L : Length) (a : ℝ) : + (⋃ n, staysAllowed N L (innerRadius a n)) = staysAllowed N L a := by + apply Set.Subset.antisymm + · exact iUnion_subset fun n ↦ staysAllowed_antitone N L (innerRadius_gt a n).le + · intro f hf + have hcompact : IsCompact (Set.range f) := isCompact_range f.continuous + obtain ⟨n,hn⟩ := hcompact.elim_directed_cover (fun n ↦ allowed N L (innerRadius a n)) + (fun n ↦ isOpen_allowed N L _) (by rw [iUnion_allowed_innerRadius]; exact hf) + (fun m n ↦ ⟨max m n,allowed_antitone N L (innerRadius_antitone a (le_max_left _ _)), + allowed_antitone N L (innerRadius_antitone a (le_max_right _ _))⟩) + exact mem_iUnion.mpr ⟨n,hn⟩ + +abbrev CoordinatePaths (N : ℕ) := Direction N → C(Time,ℝ) + +def coordinateWiener (N : ℕ) : Measure (CoordinatePaths N) := Measure.pi (fun _ ↦ wiener) +instance coordinateWiener_probability (N : ℕ) : IsProbabilityMeasure (coordinateWiener N) := by + unfold coordinateWiener + infer_instance + +def freeTrajectory (N : ℕ) (L : Length) (s : ℝ) (w : CoordinatePaths N) + (X : Configuration N L) : ConfigurationPath N L := + ⟨fun t i j ↦ X i j + ((Real.sqrt (2*s) * w (i,j) t : ℝ) : AddCircle L.val), by + continuity⟩ + +lemma freeTrajectory_continuous (N : ℕ) (L : Length) (s : ℝ) : + Continuous (fun p : CoordinatePaths N × Configuration N L ↦ freeTrajectory N L s p.1 p.2) := by + apply ContinuousMap.continuous_of_continuous_uncurry + unfold Function.uncurry + change Continuous (fun p : (CoordinatePaths N × Configuration N L) × Time ↦ + fun i j ↦ p.1.2 i j + ((Real.sqrt (2*s) * p.1.1 (i,j) p.2 : ℝ) : AddCircle L.val)) + fun_prop + +def freePathLaw (N : ℕ) (L : Length) (s : ℝ) : Measure (ConfigurationPath N L) := + ((coordinateWiener N).prod (volume : Measure (Configuration N L))).map + (fun p ↦ freeTrajectory N L s p.1 p.2) + +lemma freeTrajectory_marginal (N : ℕ) (L : Length) (s : ℝ) (t : Time) : + MeasurePreserving (fun p : CoordinatePaths N × Configuration N L ↦ freeTrajectory N L s p.1 p.2 t) + ((coordinateWiener N).prod volume) volume := by + let : (volume : Measure (Torus L)).IsAddLeftInvariant := by + rw [volume_pi] + exact Measure.pi.isAddLeftInvariant _ + let : (volume : Measure (Configuration N L)).IsAddLeftInvariant := by + rw [volume_pi] + exact Measure.pi.isAddLeftInvariant _ + let : (volume : Measure (Configuration N L)).IsAddRightInvariant := + IsAddLeftInvariant.isAddRightInvariant + have hm : Measurable (fun p : CoordinatePaths N × Configuration N L ↦ freeTrajectory N L s p.1 p.2 t) := + ((freeTrajectory_continuous N L s).eval continuous_const).measurable + have hskew := (MeasurePreserving.id (coordinateWiener N)).skew_product hm + (Filter.Eventually.of_forall (fun w : CoordinatePaths N ↦ + map_add_right_eq_self (volume : Measure (Configuration N L)) + (fun i j ↦ ((Real.sqrt (2*s) * w (i,j) t : ℝ) : AddCircle L.val)))) + exact (measurePreserving_snd (μ := coordinateWiener N) (ν := (volume : Measure (Configuration N L)))).comp hskew + +lemma freePathLaw_marginal (N : ℕ) (L : Length) (s : ℝ) (t : Time) : + MeasurePreserving (fun f : ConfigurationPath N L ↦ f t) (freePathLaw N L s) volume := by + have he : Measurable (fun f : ConfigurationPath N L ↦ f t) := + (continuous_id.eval continuous_const).measurable + refine ⟨he,?_⟩ + rw [freePathLaw,Measure.map_map he (freeTrajectory_continuous N L s).measurable] + exact (freeTrajectory_marginal N L s t).map_eq + +def killedPathLaw (N : ℕ) (L : Length) (a s : ℝ) : Measure (ConfigurationPath N L) := + (freePathLaw N L s).restrict (staysAllowed N L a) + +end HardSphere + +namespace L2Multiplier +variable {α : Type*} [MeasurableSpace α] {μ : Measure α} + +def apply (f : α → ℂ) (hf : MemLp f ∞ μ) (u : Lp ℂ 2 μ) : Lp ℂ 2 μ := + (hf.mul (Lp.memLp u)).toLp (f * u) + +lemma coe_apply (f : α → ℂ) (hf : MemLp f ∞ μ) (u : Lp ℂ 2 μ) : + apply f hf u =ᵐ[μ] fun x ↦ f x * u x := + MemLp.coeFn_toLp _ + +def linearMap (f : α → ℂ) (hf : MemLp f ∞ μ) : Lp ℂ 2 μ →ₗ[ℂ] Lp ℂ 2 μ where + toFun := apply f hf + map_add' u v := by + apply Lp.ext + filter_upwards [coe_apply f hf (u + v), coe_apply f hf u, coe_apply f hf v, + Lp.coeFn_add u v, Lp.coeFn_add (apply f hf u) (apply f hf v)] with x huv hu hv h1 h2 + simp only [huv, h1, h2, Pi.add_apply, hu, hv, mul_add] + map_smul' c u := by + apply Lp.ext + filter_upwards [coe_apply f hf (c • u), coe_apply f hf u, + Lp.coeFn_smul c u, Lp.coeFn_smul c (apply f hf u)] with x h1 h2 h3 h4 + simp only [h1, h3, h4, Pi.smul_apply, h2, smul_eq_mul, RingHom.id_apply] + ring + +lemma norm_apply_le (f : α → ℂ) (hf : MemLp f ∞ μ) (u : Lp ℂ 2 μ) : + ‖apply f hf u‖ ≤ lpNorm f ∞ μ * ‖u‖ := by + apply Lp.norm_le_mul_norm_of_ae_le_mul + filter_upwards [coe_apply f hf u, ae_le_lpNorm_exponent_top hf] with x hx hfx + rw [hx, norm_mul] + exact mul_le_mul_of_nonneg_right hfx (norm_nonneg _) + +def clm (f : α → ℂ) (hf : MemLp f ∞ μ) : Lp ℂ 2 μ →L[ℂ] Lp ℂ 2 μ := + (linearMap f hf).mkContinuous (lpNorm f ∞ μ) (norm_apply_le f hf) + +lemma coe_clm (f : α → ℂ) (hf : MemLp f ∞ μ) (u : Lp ℂ 2 μ) : + clm f hf u =ᵐ[μ] fun x ↦ f x * u x := coe_apply f hf u + +lemma clm_mul (f g : α → ℂ) (hf : MemLp f ∞ μ) (hg : MemLp g ∞ μ) + (u : Lp ℂ 2 μ) : clm (f * g) (hf.mul hg) u = clm f hf (clm g hg u) := by + apply Lp.ext + filter_upwards [coe_clm (f * g) (hf.mul hg) u, coe_clm f hf (clm g hg u), + coe_clm g hg u] with x h1 h2 h3 + simp only [h1, h2, h3, Pi.mul_apply, mul_assoc] + +lemma inner_clm_right (f : α → ℂ) (hf : MemLp f ∞ μ) (u v : Lp ℂ 2 μ) : + inner ℂ u (clm f hf v) = inner ℂ (clm (fun x ↦ conj (f x)) hf.star u) v := by + simp only [L2.inner_def] + apply integral_congr_ae + filter_upwards [coe_clm f hf v, coe_clm (fun x ↦ conj (f x)) hf.star u] with x h1 h2 + simp only [h1, h2, RCLike.inner_apply, map_mul, starRingEnd_self_apply] + ring + +end L2Multiplier + +namespace HardSphere +open Wiener +open scoped ComplexConjugate + +abbrev FreePathL2 (N : ℕ) (L : Length) (t : ℝ) := + Lp ℂ 2 (freePathLaw N L t) + +def endpointPull (N : ℕ) (L : Length) (t : ℝ) (s : Time) : + ScalarL2 N L →ₗᵢ[ℂ] FreePathL2 N L t := + Lp.compMeasurePreservingₗᵢ ℂ (fun ω : ConfigurationPath N L ↦ ω s) + (freePathLaw_marginal N L t s) + +lemma endpointPull_ae (N : ℕ) (L : Length) (t : ℝ) (s : Time) (f : ScalarL2 N L) : + endpointPull N L t s f =ᵐ[freePathLaw N L t] fun ω ↦ f (ω s) := + Lp.coeFn_compMeasurePreserving f (freePathLaw_marginal N L t s) + +lemma avoidanceIndicator_memLp (N : ℕ) (L : Length) (a t : ℝ) : + MemLp ((staysAllowed N L a).indicator (fun _ ↦ (1:ℂ))) ∞ (freePathLaw N L t) := by + exact MemLp.indicator (staysAllowed_open N L a).measurableSet (memLp_top_const (1:ℂ)) + +def avoidanceMultiplier (N : ℕ) (L : Length) (a t : ℝ) : FreePathL2 N L t →L[ℂ] FreePathL2 N L t := + L2Multiplier.clm _ (avoidanceIndicator_memLp N L a t) + +lemma avoidanceMultiplier_ae (N : ℕ) (L : Length) (a t : ℝ) (f : FreePathL2 N L t) : + avoidanceMultiplier N L a t f =ᵐ[freePathLaw N L t] (staysAllowed N L a).indicator f := by + filter_upwards [L2Multiplier.coe_clm _ (avoidanceIndicator_memLp N L a t) f] with ω hω + rw [avoidanceMultiplier, hω] + by_cases h : ω ∈ staysAllowed N L a <;> simp [h] + +lemma avoidanceMultiplier_contraction (N : ℕ) (L : Length) (a t : ℝ) (f : FreePathL2 N L t) : + ‖avoidanceMultiplier N L a t f‖ ≤ ‖f‖ := by + apply Lp.norm_le_norm_of_ae_le + filter_upwards [avoidanceMultiplier_ae N L a t f] with ω hω + rw [hω] + by_cases h : ω ∈ staysAllowed N L a <;> simp [h] + +lemma avoidanceMultiplier_norm_le (N : ℕ) (L : Length) (a t : ℝ) : + ‖avoidanceMultiplier N L a t‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + simpa only [one_mul] using avoidanceMultiplier_contraction N L a t + +lemma integrable_killed_endpoints (N : ℕ) (L : Length) (a t : ℝ) + (f g : ScalarL2 N L) (u v : Time) : + Integrable (fun ω : ConfigurationPath N L ↦ conj (f (ω u)) * g (ω v)) + (killedPathLaw N L a t) := by + exact (((Lp.memLp f).comp_measurePreserving (freePathLaw_marginal N L t u)).star.integrable_mul + ((Lp.memLp g).comp_measurePreserving (freePathLaw_marginal N L t v))).restrict + +def killedTransition (N : ℕ) (L : Length) (a t : ℝ) : ScalarL2 N L →L[ℂ] ScalarL2 N L := + (endpointPull N L t 0).toContinuousLinearMap.adjoint ∘L + (avoidanceMultiplier N L a t ∘L (endpointPull N L t 1).toContinuousLinearMap) + +lemma killedTransition_pairing (N : ℕ) (L : Length) (a t : ℝ) (f g : ScalarL2 N L) : + inner ℂ f (killedTransition N L a t g) = + ∫ ω, conj (f (ω 0)) * g (ω 1) ∂killedPathLaw N L a t := by + rw [killedTransition,ContinuousLinearMap.comp_apply,ContinuousLinearMap.adjoint_inner_right] + rw [L2.inner_def] + change (∫ ω, inner ℂ (endpointPull N L t 0 f ω) + (avoidanceMultiplier N L a t (endpointPull N L t 1 g) ω) ∂freePathLaw N L t) = _ + rw [killedPathLaw, ← integral_indicator (staysAllowed_open N L a).measurableSet] + apply integral_congr_ae + filter_upwards [endpointPull_ae N L t 0 f,endpointPull_ae N L t 1 g, + avoidanceMultiplier_ae N L a t (endpointPull N L t 1 g)] with ω hf hg ha + rw [hf,ha] + by_cases h : ω ∈ staysAllowed N L a + · simp only [Set.indicator_of_mem h,hg,RCLike.inner_apply,mul_comm] + · simp only [Set.indicator_of_notMem h,inner_zero_right] + +lemma killedTransition_norm_le (N : ℕ) (L : Length) (a t : ℝ) : + ‖killedTransition N L a t‖ ≤ 1 := by + unfold killedTransition + calc + _ ≤ ‖(endpointPull N L t 0).toContinuousLinearMap.adjoint‖ * + (‖avoidanceMultiplier N L a t‖ * ‖(endpointPull N L t 1).toContinuousLinearMap‖) := + (ContinuousLinearMap.opNorm_comp_le _ _).trans + (mul_le_mul_of_nonneg_left (ContinuousLinearMap.opNorm_comp_le _ _) (norm_nonneg _)) + _ ≤ 1* (1*1) := by + rw [ContinuousLinearMap.adjoint.norm_map] + exact mul_le_mul (LinearIsometry.norm_toContinuousLinearMap_le _) (mul_le_mul + (avoidanceMultiplier_norm_le N L a t) (LinearIsometry.norm_toContinuousLinearMap_le _) + (norm_nonneg _) zero_le_one) (by positivity) zero_le_one + _ = 1 := by norm_num + +lemma killedTransition_apply_contraction (N : ℕ) (L : Length) (a t : ℝ) (g : ScalarL2 N L) : + ‖killedTransition N L a t g‖ ≤ ‖g‖ := by + simpa only [one_mul] using (ContinuousLinearMap.le_opNorm (killedTransition N L a t) g).trans + (mul_le_mul_of_nonneg_right (killedTransition_norm_le N L a t) (norm_nonneg g)) + +end HardSphere + +noncomputable section +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate + +end +end +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/CoordinateLine.lean b/lean/OAI/Analysis/HardSphere/Geometry/CoordinateLine.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea1d340c9a2721a67c143637342ccefef55ffa38 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/CoordinateLine.lean @@ -0,0 +1,385 @@ +import Mathlib +import OAI.Analysis.HardSphere.Model + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace HardSphere +@[simp] lemma project_representative (N : ℕ) (L : Length) (X : Configuration N L) : + project N L (representative N L X) = X := by + funext i j + exact AddCircle.coe_equivIco + +@[simp] lemma project_add {N : ℕ} {L : Length} (X Y : LiftedConfiguration N) : + project N L (X + Y) = project N L X + project N L Y := by + funext i j + exact map_add (QuotientAddGroup.mk' _) _ _ + +@[simp] lemma project_sub {N : ℕ} {L : Length} (X Y : LiftedConfiguration N) : + project N L (X - Y) = project N L X - project N L Y := by + funext i j + exact map_sub (QuotientAddGroup.mk' _) _ _ + +lemma continuous_project (N : ℕ) (L : Length) : Continuous (project N L) := by + apply continuous_pi + intro i + apply continuous_pi + intro j + exact (AddCircle.continuous_mk' L.val).comp + ((continuous_apply j).comp (continuous_apply i)) + +lemma isQuotientMap_project (N : ℕ) (L : Length) : + Topology.IsQuotientMap (project N L) := by + have hcircle : Function.Surjective (fun t : ℝ ↦ (t : AddCircle L.val)) := by + intro x + exact ⟨(AddCircle.equivIco L.val 0 x).val, AddCircle.coe_equivIco⟩ + have hopen : IsOpenMap (fun X : Fin 3 → ℝ ↦ fun j ↦ (X j : AddCircle L.val)) := + IsOpenMap.piMap (fun _ ↦ QuotientAddGroup.isOpenMap_coe) + (Filter.Eventually.of_forall (fun _ ↦ hcircle)) + have hsurj : Function.Surjective + (fun X : Fin 3 → ℝ ↦ fun j ↦ (X j : AddCircle L.val)) := by + intro X + exact ⟨fun j ↦ (AddCircle.equivIco L.val 0 (X j)).val, + funext (fun _ ↦ AddCircle.coe_equivIco)⟩ + exact (IsOpenMap.piMap (fun _ : Fin N ↦ hopen) + (Filter.Eventually.of_forall (fun _ ↦ hsurj))).isQuotientMap + (continuous_project N L) (fun X ↦ ⟨representative N L X, project_representative N L X⟩) + +lemma continuous_of_continuous_lift {N : ℕ} {L : Length} + {E : Type*} [TopologicalSpace E] {f : Configuration N L → E} + (hf : Continuous (fun X : LiftedConfiguration N ↦ f (project N L X))) : + Continuous f := + (isQuotientMap_project N L).continuous_iff.mpr hf + +lemma fderiv_lift_eq {N : ℕ} {L : Length} (f : Configuration N L → ℂ) + {X Y : LiftedConfiguration N} (hXY : project N L X = project N L Y) : + fderiv ℝ (fun Z ↦ f (project N L Z)) X = + fderiv ℝ (fun Z ↦ f (project N L Z)) Y := by + have hfun : (fun Z ↦ f (project N L (Z + (X - Y)))) = + (fun Z ↦ f (project N L Z)) := by + funext Z + rw [project_add, project_sub, hXY, sub_self, add_zero] + have h := congrArg (fun g : LiftedConfiguration N → ℂ ↦ fderiv ℝ g Y) hfun + have he := fderiv_comp_add_right (𝕜 := ℝ) + (f := fun Z ↦ f (project N L Z)) (x := Y) (X - Y) + rw [he] at h + simpa only [show Y + (X - Y) = X by abel] using h + +lemma coordDerivative_project {N : ℕ} {L : Length} (f : Configuration N L → ℂ) + (p : Direction N) (X : LiftedConfiguration N) : + coordDerivative N L f p (project N L X) = + fderiv ℝ (fun Y ↦ f (project N L Y)) X + (Pi.single p.1 (Pi.single p.2 1)) := by + unfold coordDerivative + rw [fderiv_lift_eq f (project_representative N L (project N L X))] + +lemma continuous_coordDerivative {N : ℕ} {L : Length} {f : Configuration N L → ℂ} + (hf : ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ f (project N L X))) (p : Direction N) : + Continuous (coordDerivative N L f p) := by + apply continuous_of_continuous_lift + simp_rw [coordDerivative_project] + exact (hf.continuous_fderiv (by simp)).clm_apply continuous_const + +lemma SmoothTest.continuous {N : ℕ} {L : Length} {a : ℝ} (f : SmoothTest N L a) : + Continuous f.toFun := continuous_of_continuous_lift f.smooth.continuous + +lemma SmoothTest.continuous_partial {N : ℕ} {L : Length} {a : ℝ} + (f : SmoothTest N L a) (p : Direction N) : + Continuous (coordDerivative N L f.toFun p) := continuous_coordDerivative f.smooth p + +def coordinateLine {N : ℕ} {L : Length} (X : Configuration N L) + (p : Direction N) (t : AddCircle L.val) : Configuration N L := + X + Pi.single p.1 (Pi.single p.2 t) + +lemma project_coordinateLine {N : ℕ} {L : Length} (X : Configuration N L) + (p : Direction N) (t : ℝ) : + project N L (representative N L X + t • (Pi.single p.1 (Pi.single p.2 1) : LiftedConfiguration N)) = + coordinateLine X p (t : AddCircle L.val) := by + rw [project_add, project_representative] + congr 1 + funext i j + by_cases hi : i = p.1 <;> by_cases hj : j = p.2 <;> + simp [project, hi, hj] + +lemma hasDerivAt_coordinateLine {N : ℕ} {L : Length} {f : Configuration N L → ℂ} + (hf : Differentiable ℝ (fun X : LiftedConfiguration N ↦ f (project N L X))) + (X : Configuration N L) (p : Direction N) (t : ℝ) : + HasDerivAt (fun s : ℝ ↦ f (coordinateLine X p (s : AddCircle L.val))) + (coordDerivative N L f p (coordinateLine X p (t : AddCircle L.val))) t := by + let e : LiftedConfiguration N := Pi.single p.1 (Pi.single p.2 1) + have he : HasDerivAt (fun s : ℝ ↦ representative N L X + s • e) e t := by + simpa using ((hasDerivAt_id t).smul_const e).const_add (representative N L X) + have h := (hf (representative N L X + t • e)).hasFDerivAt.comp_hasDerivAt t he + have hfun : (fun s : ℝ ↦ f (project N L (representative N L X + s • e))) = + (fun s : ℝ ↦ f (coordinateLine X p (s : AddCircle L.val))) := by + funext s + rw [project_coordinateLine] + change HasDerivAt (fun s ↦ f (project N L (representative N L X + s • e))) + (fderiv ℝ (fun Y ↦ f (project N L Y)) (representative N L X + t • e) e) t at h + rw [hfun] at h + rw [← coordDerivative_project f p (representative N L X + t • e), + project_coordinateLine] at h + exact h + +lemma continuous_coordinateLine {N : ℕ} {L : Length} + (X : Configuration N L) (p : Direction N) : Continuous (coordinateLine X p) := by + unfold coordinateLine + apply Continuous.add continuous_const + apply continuous_pi + intro i + apply continuous_pi + intro j + by_cases hi : i = p.1 <;> by_cases hj : j = p.2 <;> + simp only [Pi.single_apply, hi, hj, ↓reduceIte] + · exact continuous_id + all_goals exact continuous_const + +lemma integral_partial_coordinateLine {N : ℕ} {L : Length} {f : Configuration N L → ℂ} + (hf : ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ f (project N L X))) + (X : Configuration N L) (p : Direction N) : + (∫ t : AddCircle L.val, coordDerivative N L f p (coordinateLine X p t)) = 0 := by + rw [← AddCircle.intervalIntegral_preimage L.val 0] + have hcont : Continuous (fun t : ℝ ↦ + coordDerivative N L f p (coordinateLine X p (t : AddCircle L.val))) := + (continuous_coordDerivative hf p).comp + ((continuous_coordinateLine X p).comp (AddCircle.continuous_mk' L.val)) + rw [intervalIntegral.integral_eq_sub_of_hasDerivAt + (fun t _ ↦ hasDerivAt_coordinateLine (hf.differentiable (by simp)) X p t) + (hcont.intervalIntegrable _ _)] + rw [zero_add, AddCircle.coe_period, AddCircle.coe_zero, sub_self] + +lemma integral_coordDerivative {N : ℕ} {L : Length} {f : Configuration N L → ℂ} + (hf : ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ f (project N L X))) (p : Direction N) : + (∫ X : Configuration N L, coordDerivative N L f p X) = 0 := by + let : BorelSpace (Configuration N L) := Pi.borelSpace + have hcont : Continuous (fun z : AddCircle L.val × Configuration N L ↦ + coordDerivative N L f p (coordinateLine z.2 p z.1)) := by + apply (continuous_coordDerivative hf p).comp + unfold coordinateLine + apply Continuous.add continuous_snd + apply continuous_pi + intro i + apply continuous_pi + intro j + by_cases hi : i = p.1 <;> by_cases hj : j = p.2 <;> + simp [hi, hj, continuous_const, continuous_fst] + have hint : Integrable (fun z : AddCircle L.val × Configuration N L ↦ + coordDerivative N L f p (coordinateLine z.2 p z.1)) (volume.prod volume) := by + exact integrableOn_univ.mp (hcont.continuousOn.integrableOn_compact isCompact_univ) + have hswap := integral_integral_swap + (f := fun t X ↦ coordDerivative N L f p (coordinateLine X p t)) hint + have hcir := integral_partial_coordinateLine hf + simp_rw [hcir] at hswap + simp only [integral_zero] at hswap + let : (volume : Measure (Torus L)).IsAddLeftInvariant := by + rw [volume_pi] + exact Measure.pi.isAddLeftInvariant _ + let : (volume : Measure (Configuration N L)).IsAddLeftInvariant := by + rw [volume_pi] + exact Measure.pi.isAddLeftInvariant _ + let : (volume : Measure (Configuration N L)).IsAddRightInvariant := + IsAddLeftInvariant.isAddRightInvariant + have hc : ∀ t : AddCircle L.val, + (∫ X : Configuration N L, coordDerivative N L f p (coordinateLine X p t)) = + ∫ X : Configuration N L, coordDerivative N L f p X := fun t ↦ + integral_add_right_eq_self _ _ + simp_rw [hc] at hswap + have hvol : (volume (univ : Set (AddCircle L.val))).toReal = L.val := by + rw [AddCircle.measure_univ, ENNReal.toReal_ofReal L.property.le] + simp only [integral_const, Measure.real, hvol, Complex.real_smul] at hswap + exact (mul_eq_zero.mp hswap).resolve_left (Complex.ofReal_ne_zero.mpr L.property.ne') + +open scoped ComplexConjugate + +lemma coordDerivative_mul {N : ℕ} {L : Length} {f g : Configuration N L → ℂ} + (hf : Differentiable ℝ (fun X : LiftedConfiguration N ↦ f (project N L X))) + (hg : Differentiable ℝ (fun X : LiftedConfiguration N ↦ g (project N L X))) + (p : Direction N) : + coordDerivative N L (f * g) p = f * coordDerivative N L g p + g * coordDerivative N L f p := by + funext X + simp only [coordDerivative, Pi.mul_apply] + rw [fderiv_fun_mul hf.differentiableAt hg.differentiableAt] + simp only [add_apply, smul_apply, + smul_eq_mul, project_representative, Pi.add_apply, Pi.mul_apply] + rfl + +lemma coordDerivative_conj {N : ℕ} {L : Length} {f : Configuration N L → ℂ} + (hf : Differentiable ℝ (fun X : LiftedConfiguration N ↦ f (project N L X))) + (p : Direction N) : + coordDerivative N L (fun X ↦ conj (f X)) p = fun X ↦ conj (coordDerivative N L f p X) := by + funext X + unfold coordDerivative + have h := Complex.conjCLE.toContinuousLinearMap.hasFDerivAt.comp (representative N L X) + (hf _).hasFDerivAt + exact congrArg (fun A : LiftedConfiguration N →L[ℝ] ℂ ↦ + A (Pi.single p.1 (Pi.single p.2 1))) h.fderiv + +section + +local instance complexTopologicalSemiring : IsTopologicalSemiring ℂ := inferInstance + +local instance configurationContinuousMapStarModule (N : ℕ) (L : Length) : + StarModule ℂ C(Configuration N L, ℂ) := inferInstance + +def smoothAlgebra (N : ℕ) (L : Length) : StarSubalgebra ℂ C(Configuration N L, ℂ) where + carrier := {f | ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ f (project N L X))} + mul_mem' := by + intro f g hf hg + simp only [Set.mem_ofPred_eq] at * + exact hf.mul hg + add_mem' := by + intro f g hf hg + simp only [Set.mem_ofPred_eq] at * + exact hf.add hg + algebraMap_mem' := by + intro c + simp only [Set.mem_ofPred_eq, algebraMap_apply] + exact contDiff_const + star_mem' := by + intro f hf + simp only [Set.mem_ofPred_eq] at * + exact Complex.conjCLE.contDiff.comp hf + zero_mem' := by + simp only [Set.mem_ofPred_eq, ContinuousMap.zero_apply] + exact contDiff_const + one_mem' := by + simp only [Set.mem_ofPred_eq, ContinuousMap.one_apply] + exact contDiff_const + +end + +def coordinateCharacter {N : ℕ} {L : Length} (p : Direction N) : C(Configuration N L, ℂ) := + (fourier 1).comp ⟨fun X ↦ X p.1 p.2, + (continuous_apply p.2).comp (continuous_apply p.1)⟩ + +lemma coordinateCharacter_smooth {N : ℕ} {L : Length} (p : Direction N) : + coordinateCharacter p ∈ smoothAlgebra N L := by + change ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ fourier 1 (X p.1 p.2 : AddCircle L.val)) + simp_rw [fourier_coe_apply] + exact Complex.contDiff_exp.comp + ((((contDiff_const.mul contDiff_const).mul contDiff_const).mul contDiff_const).mul + (Complex.ofRealCLM.contDiff.comp (contDiff_apply_apply ℝ ℝ p.1 p.2)) |>.div_const _) + +lemma smoothAlgebra_separatesPoints (N : ℕ) (L : Length) : + (smoothAlgebra N L).SeparatesPoints := by + intro X Y hXY + obtain ⟨i, hi⟩ := Function.ne_iff.mp hXY + obtain ⟨j, hj⟩ := Function.ne_iff.mp hi + refine ⟨_, ⟨coordinateCharacter (i,j), coordinateCharacter_smooth (i,j), rfl⟩, ?_⟩ + change fourier 1 (X i j) ≠ fourier 1 (Y i j) + rw [fourier_one, fourier_one] + intro he + apply hj + exact AddCircle.injective_toCircle L.property.ne' (Subtype.ext he) + +lemma smoothAlgebra_dense (N : ℕ) (L : Length) : + Dense (smoothAlgebra N L : Set C(Configuration N L, ℂ)) := by + have hh := ContinuousMap.starSubalgebra_topologicalClosure_eq_top_of_separatesPoints + (smoothAlgebra N L) (smoothAlgebra_separatesPoints N L) + rw [dense_iff_closure_eq] + exact congrArg (fun A : StarSubalgebra ℂ C(Configuration N L, ℂ) ↦ (A : Set C(Configuration N L, ℂ))) hh + +lemma smoothAlgebra_toLp_dense (N : ℕ) (L : Length) : + DenseRange (fun f : smoothAlgebra N L ↦ + ContinuousMap.toLp 2 volume ℂ (f : C(Configuration N L, ℂ))) := by + exact (ContinuousMap.toLp_denseRange ℂ volume ℂ (by simp : (2 : ℝ≥0∞) ≠ ∞)).comp + (smoothAlgebra_dense N L).denseRange_val (ContinuousMap.toLp 2 volume ℂ).continuous + +lemma integral_integration_by_parts {N : ℕ} {L : Length} + {f g : Configuration N L → ℂ} + (hf : ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ f (project N L X))) + (hg : ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ g (project N L X))) (p : Direction N) : + (∫ X, conj (f X) * coordDerivative N L g p X) + + (∫ X, conj (coordDerivative N L f p X) * g X) = 0 := by + have hconj := Complex.conjCLE.contDiff.comp hf + have h := integral_coordDerivative (f := (fun X ↦ conj (f X)) * g) + (hconj.mul hg) p + rw [coordDerivative_mul (hconj.differentiable (by simp)) (hg.differentiable (by simp)), + coordDerivative_conj (hf.differentiable (by simp))] at h + have hfg : Integrable (fun X ↦ conj (f X) * coordDerivative N L g p X) := by + exact integrableOn_univ.mp + ((((continuous_of_continuous_lift hf.continuous).star).mul + (continuous_coordDerivative hg p)).continuousOn.integrableOn_compact isCompact_univ) + have hgf : Integrable (fun X ↦ g X * conj (coordDerivative N L f p X)) := by + exact integrableOn_univ.mp + (((continuous_of_continuous_lift hg.continuous).mul + (continuous_coordDerivative hf p).star).continuousOn.integrableOn_compact isCompact_univ) + simp only [Pi.add_apply, Pi.mul_apply] at h + rw [integral_add hfg hgf] at h + simpa only [Pi.mul_apply, mul_comm (g _)] using h + +def smoothPartial {N : ℕ} {L : Length} (f : smoothAlgebra N L) (p : Direction N) : + C(Configuration N L, ℂ) := + ⟨coordDerivative N L f.val p, continuous_coordDerivative f.property p⟩ + +section + +local instance configurationProductBorel (N : ℕ) (L : Length) : + BorelSpace (Configuration N L) := Pi.borelSpace + +lemma SmoothTest.weak_derivative {N : ℕ} {L : Length} {a : ℝ} + (u : SmoothTest N L a) (f : smoothAlgebra N L) (p : Direction N) : + inner ℂ (ContinuousMap.toLp 2 volume ℂ f.val) (u.jet.2 p) + + inner ℂ (ContinuousMap.toLp 2 volume ℂ (smoothPartial f p)) u.jet.1 = 0 := by + rw [L2.inner_def, L2.inner_def] + have h₁ : (∫ X, inner ℂ ((ContinuousMap.toLp 2 volume ℂ f.val) X) ((u.jet.2 p) X)) = + ∫ X, conj (f.val X) * coordDerivative N L u.toFun p X := by + apply integral_congr_ae + filter_upwards [ContinuousMap.coeFn_toLp (𝕜 := ℂ) (p := 2) volume f.val, (u.partial_memLp p).coeFn_toLp] + with X hX hY + change inner ℂ _ ((u.partial_memLp p).toLp _ X) = _ + rw [hX, hY, RCLike.inner_apply, mul_comm] + have h₂ : (∫ X, inner ℂ ((ContinuousMap.toLp 2 volume ℂ (smoothPartial f p)) X) (u.jet.1 X)) = + ∫ X, conj (coordDerivative N L f.val p X) * u.toFun X := by + apply integral_congr_ae + filter_upwards [ContinuousMap.coeFn_toLp (𝕜 := ℂ) (p := 2) volume (smoothPartial f p), u.memLp.coeFn_toLp] + with X hX hY + change inner ℂ _ (u.memLp.toLp _ X) = _ + rw [hX, hY, RCLike.inner_apply, mul_comm] + rfl + rw [h₁, h₂] + exact integral_integration_by_parts f.property u.smooth p + +lemma weak_derivative {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : u ∈ dirichletDomain N L a) (f : smoothAlgebra N L) (p : Direction N) : + inner ℂ (ContinuousMap.toLp 2 volume ℂ f.val) (u.2 p) + + inner ℂ (ContinuousMap.toLp 2 volume ℂ (smoothPartial f p)) u.1 = 0 := by + have hc : IsClosed {v : Jet N L | + inner ℂ (ContinuousMap.toLp 2 volume ℂ f.val) (v.2 p) + + inner ℂ (ContinuousMap.toLp 2 volume ℂ (smoothPartial f p)) v.1 = 0} := + isClosed_eq ((continuous_const.inner ((continuous_apply p).comp continuous_snd)).add + (continuous_const.inner continuous_fst)) continuous_const + exact closure_minimal (by rintro _ ⟨v, rfl⟩; exact v.weak_derivative f p) hc hu + +end + +lemma derivative_zero_of_scalar_zero {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : u ∈ dirichletDomain N L a) (hz : u.1 = 0) : u.2 = 0 := by + funext p + apply (inner_self_eq_zero (𝕜 := ℂ)).mp + refine (smoothAlgebra_toLp_dense N L).induction_on + (p := fun w ↦ inner ℂ w (u.2 p) = 0) (u.2 p) + (isClosed_eq (continuous_id.inner continuous_const) continuous_const) ?_ + intro f + have h := weak_derivative hu f p + simpa only [hz, inner_zero_right, add_zero] using h + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/CoordinateLineConsSucc.lean b/lean/OAI/Analysis/HardSphere/Geometry/CoordinateLineConsSucc.lean new file mode 100644 index 0000000000000000000000000000000000000000..280b8616de6dc3c6af9e93096de41315c3b76470 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/CoordinateLineConsSucc.lean @@ -0,0 +1,98 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.SmoothMultiplier + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate + +lemma coordinateLine_cons_succ {n : ℕ} {L : Length} (x : Torus L) + (Y : Configuration n L) (i : Fin n) (j : Fin 3) (t : AddCircle L.val) : + coordinateLine (Fin.cons x Y) (i.succ,j) t=Fin.cons x (coordinateLine Y (i,j) t) := by + funext k q + refine Fin.cases ?_ (fun k ↦ ?_) k + · simp [coordinateLine] + · by_cases h : k=i + · subst k; simp [coordinateLine] + · simp [coordinateLine,Pi.single_eq_of_ne h,Pi.single_eq_of_ne (fun e ↦ h (Fin.succ_injective _ e))] + +lemma SmoothMultiplier.hasDerivAt_fiberIntegral {n : ℕ} {L : Length} + (f : SmoothMultiplier (n+1) L) (Y : Configuration n L) (i : Fin n) (j : Fin 3) : + HasDerivAt (fun t : ℝ ↦ ∫ x : Torus L, + f.toFun (Fin.cons x (coordinateLine Y (i,j) (t : AddCircle L.val)))) + (∫ x : Torus L, coordDerivative (n+1) L f.toFun (i.succ,j) (Fin.cons x Y)) 0 := by + let F : ℝ → Torus L → ℂ := fun t x ↦ + f.toFun (Fin.cons x (coordinateLine Y (i,j) (t : AddCircle L.val))) + let D : ℝ → Torus L → ℂ := fun t x ↦ + coordDerivative (n+1) L f.toFun (i.succ,j) + (Fin.cons x (coordinateLine Y (i,j) (t : AddCircle L.val))) + have cF (t) : Continuous (F t) := + (continuous_of_continuous_lift f.smooth.continuous).comp + ((continuous_id : Continuous (id : Torus L → Torus L)).finCons + (continuous_const : Continuous (fun _ : Torus L ↦ coordinateLine Y (i,j) (t : AddCircle L.val)))) + have cD (t) : Continuous (D t) := + (continuous_coordDerivative f.smooth (i.succ,j)).comp + ((continuous_id : Continuous (id : Torus L → Torus L)).finCons + (continuous_const : Continuous (fun _ : Torus L ↦ coordinateLine Y (i,j) (t : AddCircle L.val)))) + let d : C(Configuration (n+1) L,ℂ) := + ⟨_,continuous_coordDerivative f.smooth (i.succ,j)⟩ + have h := hasDerivAt_integral_of_dominated_loc_of_deriv_le + (F := F) (F' := D) (μ := (volume : Measure (Torus L))) (s := Set.univ) (x₀ := 0) + (bound := fun _ ↦ ‖d‖) univ_mem + (Eventually.of_forall fun t ↦ (cF t).aestronglyMeasurable) + ((cF 0).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)) + (cD 0).aestronglyMeasurable + (Eventually.of_forall fun x t _ ↦ d.norm_coe_le_norm _) + (integrable_const _) (Eventually.of_forall fun x t _ ↦ by + have hh := hasDerivAt_coordinateLine (f.smooth.differentiable (by simp)) + (Fin.cons x Y) (i.succ,j) t + simpa only [coordinateLine_cons_succ] using hh) + simpa only [F,D,Complex.ofReal_zero,AddCircle.coe_zero,coordinateLine,Pi.single_zero,add_zero] using h.2 + +lemma SmoothMultiplier.insertion_orthogonal {n : ℕ} {L : Length} + (f : SmoothMultiplier (n+1) L) + (hr : ∀ X, conj (f.toFun X)=f.toFun X) + (hn : ∀ Y : Configuration n L, ∫ x : Torus L, ‖f.toFun (Fin.cons x Y)‖^2=1) + (i : Fin n) (j : Fin 3) (Y : Configuration n L) : + ∫ x : Torus L, conj (f.toFun (Fin.cons x Y))* + coordDerivative (n+1) L f.toFun (i.succ,j) (Fin.cons x Y)=0 := by + have he (X) : f.toFun X*f.toFun X = ((‖f.toFun X‖^2 : ℝ) : ℂ) := by + calc + _ = f.toFun X*conj (f.toFun X) := by rw [hr] + _ = _ := by rw [Complex.mul_conj,Complex.sq_norm] + have hc (Y) : (∫ x : Torus L, (f.mul f).toFun (Fin.cons x Y))=1 := by + simp only [SmoothMultiplier.mul,Pi.mul_apply,he] + rw [integral_complex_ofReal,hn,Complex.ofReal_one] + have h := (f.mul f).hasDerivAt_fiberIntegral Y i j + simp only [hc] at h + have hz := h.unique (hasDerivAt_const (0:ℝ) (1:ℂ)) + have hd := coordDerivative_mul (f.smooth.differentiable (by simp)) + (f.smooth.differentiable (by simp)) (i.succ,j) + change (∫ x : Torus L, coordDerivative (n+1) L (f.toFun*f.toFun) (i.succ,j) (Fin.cons x Y))=0 at hz + rw [hd] at hz + have hfactor : (∫ x : Torus L, + (f.toFun * coordDerivative (n+1) L f.toFun (i.succ,j) + + f.toFun * coordDerivative (n+1) L f.toFun (i.succ,j)) (Fin.cons x Y))= + (2:ℂ)*(∫ x : Torus L, conj (f.toFun (Fin.cons x Y))* + coordDerivative (n+1) L f.toFun (i.succ,j) (Fin.cons x Y)) := by + rw [← integral_const_mul] + apply integral_congr_ae + exact Eventually.of_forall fun x ↦ by simp only [Pi.add_apply,Pi.mul_apply,hr]; ring + rw [hfactor] at hz + exact (mul_eq_zero.mp hz).resolve_left (by norm_num) + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/CubeCell.lean b/lean/OAI/Analysis/HardSphere/Geometry/CubeCell.lean new file mode 100644 index 0000000000000000000000000000000000000000..e007723c7d82cf497b9bfc1b56e1fa9c26c11714 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/CubeCell.lean @@ -0,0 +1,203 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.PointFin +import OAI.Analysis.HardSphere.Geometry.SubsetPointLinear + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +noncomputable section +open scoped BigOperators ComplexConjugate +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +noncomputable section +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology +noncomputable section +open MeasureTheory Set +open scoped ENNReal +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +namespace HardSphere +open SphericalCoordinates +open scoped BigOperators + +abbrev CubeCell (K : ℕ) := Fin K × Fin K × Fin K + +noncomputable def unitSectorMeasure (n K : ℕ) (σ : Fin n → CubeCell K) : Measure (Fin n → Point) := + Measure.pi (fun i ↦ volume.restrict (cube (subcubeBase 0 1 (σ i)) 1)) + +lemma unitSectorMeasure_le {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (σ : Fin n → CubeCell K) : + unitSectorMeasure n K σ≤Measure.pi (fun _ : Fin n ↦ volume.restrict (cube 0 L.val)) := by + rw [hL,← mul_one (K:ℝ),cube_configuration_subdivision 0 (by norm_num : (0:ℝ)≤1)] + exact Measure.le_sum _ σ + +noncomputable def unitSectorRestriction {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (σ : Fin n → CubeCell K) : ScalarL2 n L →L[ℝ] Lp ℂ 2 (unitSectorMeasure n K σ) := + (Lp.LpToLpOfMeasureLeSMul (c := (1:ℝ≥0∞)) (by norm_num) + (show unitSectorMeasure n K σ≤1 • Measure.pi (fun _ : Fin n ↦ volume.restrict (cube 0 L.val)) by + simpa only [one_smul] using unitSectorMeasure_le hL σ)).comp + (Lp.compMeasurePreservingₗᵢ ℝ (cubeParameter n L) (cubeParameter_preserving n L)).toContinuousLinearMap + +lemma unitSectorRestriction_ae {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (σ : Fin n → CubeCell K) (u : ScalarL2 n L) : + unitSectorRestriction hL σ u=ᵐ[unitSectorMeasure n K σ] fun X ↦ u (cubeParameter n L X) := by + have h₁ := Lp.coeFn_LpToLpOfMeasureLeSMul (c := (1:ℝ≥0∞)) (by norm_num) + (show unitSectorMeasure n K σ≤1 • Measure.pi (fun _ : Fin n ↦ volume.restrict (cube 0 L.val)) by + simpa only [one_smul] using unitSectorMeasure_le hL σ) + ((Lp.compMeasurePreservingₗᵢ ℝ (cubeParameter n L) (cubeParameter_preserving n L)) u) + apply h₁.trans + apply (Measure.absolutelyContinuous_of_le (unitSectorMeasure_le hL σ)).ae_eq + exact Lp.coeFn_compMeasurePreserving u (cubeParameter_preserving n L) + +lemma SmoothTest.unitSector_norm {n K : ℕ} {L : Length} {a : ℝ} (f : SmoothTest n L a) + (hL : L.val=(K:ℝ)) (σ : Fin n → CubeCell K) : + ENNReal.ofReal (‖unitSectorRestriction hL σ f.jet.1‖^2)= + ∫⁻ X,ENNReal.ofReal (‖f.toFun (cubeParameter n L X)‖^2) ∂unitSectorMeasure n K σ := by + have h₁ := unitSectorRestriction_ae hL σ f.jet.1 + have h₂ : (fun X ↦ f.jet.1 (cubeParameter n L X))=ᵐ[unitSectorMeasure n K σ] + fun X ↦ f.toFun (cubeParameter n L X) := by + apply (Measure.absolutelyContinuous_of_le (unitSectorMeasure_le hL σ)).ae_eq + exact (cubeParameter_preserving n L).quasiMeasurePreserving.ae_eq_comp f.memLp.coeFn_toLp + have hn := smooth_norm_lintegral (Lp.memLp (unitSectorRestriction hL σ f.jet.1)) + rw [Lp.toLp_coeFn] at hn + rw [hn] + apply lintegral_congr_ae + filter_upwards [h₁.trans h₂] with X hX + rw [hX] + +noncomputable def unitCellPenalty {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (a : ℝ) (u : ScalarL2 n L) : ℝ := + ∑ σ : Fin n → CubeCell K, + (∑ v : CubeCell K,1/(64*Real.sqrt 3)*a*(Fintype.card {i // σ i=v}:ℝ)* + ((Fintype.card {i // σ i=v}:ℝ)-1))*‖unitSectorRestriction hL σ u‖^2 + +lemma continuous_unitCellPenalty {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (a : ℝ) : + Continuous (unitCellPenalty (n := n) hL a) := by + apply continuous_finsetSum + intro σ _ + exact continuous_const.mul ((unitSectorRestriction hL σ).continuous.norm.pow 2) + +lemma SmoothTest.cell_energy {n K : ℕ} {L : Length} {a : ℝ} (f : SmoothTest n L a) + (hL : L.val=(K:ℝ)) (ha : 0 omega + have heq := small_multiple_zero hzero hsmall + rw [show cutLift cut x i-cutLift cut y i= -d i by omega,abs_neg] + exact hd i + +theorem small_set_lift {K : ℕ} [NeZero K] (S : Finset (DiscreteTorus K)) (a : ℕ) + (hsmall : a*S.card simp + | @cons u v w huv p ih => + calc + |f u i-f w i| ≤ |f u i-f v i|+|f v i-f w i| := abs_sub_le _ _ _ + _ ≤ (a:ℤ)+(a:ℤ)*p.length := add_le_add (hedge u v huv i) ih + _ = (a:ℤ)*(SimpleGraph.Walk.cons huv p).length := by simp only [SimpleGraph.Walk.length_cons,Nat.cast_add,Nat.cast_one]; ring + have hlen' : (q.val.length:ℤ) omega) + dsimp only [Pi.sub_apply] + omega + +lemma lift_offset_reach {K a : ℕ} (hK : 2*a rfl + | @tail u v _ huv ih => exact (lift_offset_step hK S f hf hedge huv.1 huv.2.1 huv.2.2).trans ih + +lemma translated_projection {K : ℕ} (f : DiscreteTorus K → Vertex) + (hf : ∀ x, torusProjection K (f x)=x) (r : Vertex) (x : DiscreteTorus K) : + torusProjection K (f x+(r-f (torusProjection K r)))=x := by + ext i + have h₁ := congrFun (hf x) i + have h₂ := congrFun (hf (torusProjection K r)) i + change ((f x i:ℤ):ZMod K)=x i at h₁ + change ((f (torusProjection K r) i:ℤ):ZMod K)=(r i:ZMod K) at h₂ + simp only [torusProjection,Pi.add_apply,Pi.sub_apply,Int.cast_add,Int.cast_sub,h₁,h₂, + sub_self,add_zero] + +lemma rangeStep_translate {a : ℕ} {x y : Vertex} (h : rangeStep a x y) (t : Vertex) : + rangeStep a (x+t) (y+t) := by + refine ⟨fun he ↦ h.1 (add_right_cancel he),fun i ↦ ?_⟩ + simpa only [Pi.add_apply,add_sub_add_right_eq_sub] using h.2 i + +lemma translated_reach {K a : ℕ} (S : Finset (DiscreteTorus K)) + (hS : ((torusRangeGraph K a).induce (↑S)).Preconnected) + (f : DiscreteTorus K → Vertex) (hf : ∀ x, torusProjection K (f x)=x) + (hedge : ∀ x∈S, ∀ y∈S, torusRangeStep K a x y → rangeStep a (f x) (f y)) + (r : Vertex) (hr : torusProjection K r∈S) (x : DiscreteTorus K) (hx : x∈S) : + f x+(r-f (torusProjection K r))∈periodicLift K a S r := by + refine ⟨by simpa only [translated_projection f hf] using hx,?_⟩ + have hp := (SimpleGraph.reachable_iff_reflTransGen _ _).mp + (hS ⟨torusProjection K r,hr⟩ ⟨x,hx⟩) + have hmap : ∀ {u v : ↑(↑S : Set (DiscreteTorus K))}, + Relation.ReflTransGen ((torusRangeGraph K a).induce (↑S)).Adj u v → + Relation.ReflTransGen + (fun u v ↦ torusProjection K u∈S ∧ torusProjection K v∈S ∧ rangeStep a u v) + (f u.val+(r-f (torusProjection K r))) (f v.val+(r-f (torusProjection K r))) := by + intro u v huv + induction huv using Relation.ReflTransGen.trans_induction_on with + | refl => exact .refl + | @single u v huv => + apply Relation.ReflTransGen.single + refine ⟨?_,?_,rangeStep_translate (hedge u.val u.property v.val v.property huv) _⟩ + · simpa only [translated_projection f hf,Finset.mem_coe] using u.property + · simpa only [translated_projection f hf,Finset.mem_coe] using v.property + | trans _ _ ih₁ ih₂ => exact ih₁.trans ih₂ + have h := hmap hp + rw [show f (torusProjection K r)+(r-f (torusProjection K r))=r by abel] at h + exact h + +theorem small_periodic_lifts {K a : ℕ} [NeZero K] (hK : 2*a norm_num + | succ m ih => + rw [pow_succ] + have hp := Nat.one_le_pow m 2 (by norm_num) + omega + calc + _ ≤ (3*2^m)^3 := Nat.pow_le_pow_left (by nlinarith) 3 + _ = _ := by rw [mul_pow,← pow_mul,Nat.mul_comm m 3,pow_mul]; norm_num + +lemma endpoint_series_le (q : ℝ≥0∞) (hq : q≤1/16) : + (∑' m : ℕ, ((2*(m+1)+1)^3:ℕ)*q^(m+1))≤54*q := by + have h8 : (8:ℝ≥0∞)*q≤1/2 := by + calc + _ ≤ 8*(1/16:ℝ≥0∞) := mul_le_mul' le_rfl hq + _ = _ := by + have h : (8:ℝ≥0)*(1/16)=1/2 := by norm_num + have hh := congrArg (fun x : ℝ≥0 ↦ (x:ℝ≥0∞)) h + simpa only [ENNReal.coe_mul,ENNReal.coe_div (show (16:ℝ≥0)≠0 by norm_num), + ENNReal.coe_div (show (2:ℝ≥0)≠0 by norm_num),ENNReal.coe_ofNat,ENNReal.coe_one] using hh + calc + _ ≤ ∑' m : ℕ, 27*q*((1/2:ℝ≥0∞)^m) := by + apply ENNReal.tsum_le_tsum + intro m + calc + _ ≤ (27*8^m:ℝ≥0∞)*q^(m+1) := by + apply mul_le_mul' _ le_rfl + exact_mod_cast endpoint_polynomial_le m + _ = 27*q*((8*q)^m) := by rw [pow_succ,mul_pow]; ring + _ ≤ _ := mul_le_mul' le_rfl (pow_le_pow_left' h8 m) + _ = _ := by rw [ENNReal.tsum_mul_left,ENNReal.tsum_geometric]; norm_num; ring + +lemma rejection_probability {K a : ℕ} [NeZero K] (hK : 2 simp [hx] + have hn : (∑' x, if ¬E x then μ x else 0)≠∞ := ne_of_lt (h.trans_lt (by norm_num)) + calc + (1/2:ℝ≥0∞)=1-(1/2) := by norm_num + _ ≤ 1-(∑' x, if ¬E x then μ x else 0) := tsub_le_tsub_left h 1 + _ = _ := by rw [← he,ENNReal.add_sub_cancel_right hn] + +theorem acceptedEnvironment_mass (a : ℕ) (ha : 1≤a) : + ∃ p₀ : ℝ, 0 intro hx; exact .refl _ + | @cons x z y he p ih => + intro hx + exact (show (G.induce (↑S)).Adj ⟨x,hx⟩ ⟨z,he.2.1⟩ from he.2.2).reachable.trans (ih hy he.2.1) + +lemma periodicLift_internalReach {K a : ℕ} (S : Finset (DiscreteTorus K)) + {r x : Vertex} (hx : x∈periodicLift K a S r) : + withinReach (rangeStep a) (periodicLift K a S r) r x := by + obtain ⟨_,hp⟩ := hx + induction hp with + | refl => exact .refl + | @tail u v hru huv ih => + exact (ih huv.1).tail ⟨⟨huv.1,hru⟩,⟨huv.2.1,hru.tail huv⟩,huv.2.2⟩ + +lemma exists_bad_lift {K : ℕ} [NeZero K] (hK : 2 simp + | @insert i S hi ih => simp only [Finset.sum_insert hi, ENNReal.tsum_add, ih] + +lemma cardinal_weight_sum {V : Type*} [DecidableEq V] (S : Finset (Finset V)) + (hS : ∀ F∈S, F.Nonempty) (t : ℝ≥0∞) : + (∑ F∈S, t^F.card) = ∑' m : ℕ, ((S.filter (fun F ↦ F.card=m+1)).card:ℝ≥0∞)*t^(m+1) := by + have hsingle (F : Finset V) (hF : F∈S) : + (∑' m : ℕ, if F.card=m+1 then t^(m+1) else 0)=t^F.card := by + have hpos := Finset.card_pos.mpr (hS F hF) + rw [tsum_eq_single (F.card-1) (by intro m hm; exact ite_eq_right (by omega))] + have he : F.card-1+1=F.card := by omega + simp [he] + have he (m : ℕ) : + ((S.filter (fun F ↦ F.card=m+1)).card:ℝ≥0∞)*t^(m+1) = + ∑ F∈S, if F.card=m+1 then t^(m+1) else 0 := by + rw [← Finset.sum_filter] + simp + simp_rw [he] + rw [ennreal_tsum_finset] + exact Finset.sum_congr rfl fun F hF ↦ (hsingle F hF).symm + +theorem contact_candidate_potential {K n : ℕ} [NeZero K] (a : ℕ) (hnK : 2*n≤K) + (U U' : Fin (n+1) → Vertex) (b : ℤ) + (hfirst : ∀ i, U i 0=b+i.val) (hfirst' : ∀ i, U' i 0=b+i.val) + (hspeed : ∀ i j k, |U' i k-U' j k|≤3*|(i.val:ℤ)-j.val|) + (Γ Γ' : Finset (DiscreteTorus K)) + (hcover : ∀ x∈Γ, ∃ i, torusNear K 3 (torusProjection K (U i)) x) + (hcover' : ∀ x∈Γ', ∃ i, torusNear K 3 (torusProjection K (U' i)) x) + (t : ℝ≥0∞) : + (∑ F∈candidateSets (torusRangeGraph K a), + if torusContact a F Γ ∧ torusContact a F Γ' then t^F.card else 0) ≤ + ∑ i : Fin (n+1), ∑' m : ℕ, + if torusNear K ((12*a+24)*(m+1)) (torusProjection K (U i)) (torusProjection K (U' i)) + then ((((2*(a+3)+1)^3*2^((2*a+1)^3):ℕ):ℝ≥0∞)*t)^(m+1) else 0 := by + let S := (candidateSets (torusRangeGraph K a)).filter + (fun F ↦ torusContact a F Γ ∧ torusContact a F Γ') + have hS : ∀ F∈S, F.Nonempty := fun F hF ↦ candidate_nonempty _ (Finset.mem_filter.mp hF).1 + rw [← Finset.sum_filter] + change (∑ F∈S, t^F.card)≤_ + rw [cardinal_weight_sum S hS t] + rw [← ennreal_tsum_finset] + apply ENNReal.tsum_le_tsum + intro m + have hcard := contact_candidates_card a hnK U U' b hfirst hfirst' hspeed Γ Γ' hcover hcover' (m+1) (by omega) + have he : S.filter (fun F ↦ F.card=m+1) = + (candidateSets (torusRangeGraph K a)).filter + (fun F ↦ F.card=m+1 ∧ torusContact a F Γ ∧ torusContact a F Γ') := by + ext F; simp only [S,Finset.mem_filter]; tauto + rw [he] + calc + _ ≤ (((((2*(a+3)+1)^3*2^((2*a+1)^3))^(m+1))* + (Finset.univ.filter (fun i ↦ torusNear K ((12*a+24)*(m+1)) + (torusProjection K (U i)) (torusProjection K (U' i)))).card : ℕ):ℝ≥0∞)*t^(m+1) := by + apply mul_le_mul' _ le_rfl + exact_mod_cast hcard + _ = _ := by + rw [← Finset.sum_filter] + simp only [Finset.sum_const,Nat.cast_mul,Nat.cast_pow,mul_pow] + ring + +end HardSphere.Lattice + +open scoped ENNReal NNReal + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/EuclideanTorus.lean b/lean/OAI/Analysis/HardSphere/Geometry/EuclideanTorus.lean new file mode 100644 index 0000000000000000000000000000000000000000..e20b22851c76f121550c54c563a581af19f0217e --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/EuclideanTorus.lean @@ -0,0 +1,261 @@ +import Mathlib +import OAI.Analysis.HardSphere.Orbitals.Profile +import OAI.Analysis.HardSphere.Geometry.SelectedEnergyAddCompl + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter ContinuousLinearMap +open scoped NNReal ComplexConjugate + +abbrev EuclideanTorus (L : Length) := PiLp 2 (fun _ : Fin 3 ↦ AddCircle L.val) + +def euclideanTorusPoint (L : Length) (x : Torus L) : EuclideanTorus L := WithLp.toLp 2 x + +lemma euclideanTorusPoint_dist (L : Length) (x y : Torus L) : + dist (euclideanTorusPoint L x) (euclideanTorusPoint L y)=torusDistance L x y := + PiLp.dist_eq_of_L2 _ _ + +def spatialSiteDistance (L : Length) (A : Finset (Torus L)) (x : Torus L) : ℝ := + Metric.infDist (euclideanTorusPoint L x) (euclideanTorusPoint L '' (A:Set (Torus L))) + +def spatialMetricConstant : ℝ≥0 := (3:ℝ≥0)^((1/(2:ENNReal)).toReal) + +lemma spatialMetricConstant_pos : 0<(spatialMetricConstant:ℝ) := by + unfold spatialMetricConstant + positivity + +lemma spatialSiteDistance_lipschitz (L : Length) (A : Finset (Torus L)) : + LipschitzWith spatialMetricConstant (spatialSiteDistance L A) := by + apply LipschitzWith.of_dist_le_mul + intro x y + have h := (Metric.lipschitz_infDist_pt (euclideanTorusPoint L '' (A:Set (Torus L)))).dist_le_mul + (euclideanTorusPoint L x) (euclideanTorusPoint L y) + have ht := (PiLp.lipschitzWith_toLp 2 (fun _ : Fin 3 ↦ AddCircle L.val)).dist_le_mul x y + apply h.trans + rw [NNReal.coe_one,one_mul] + convert ht using 1 <;> rfl + +lemma spatialSiteDistance_nonneg (L : Length) (A : Finset (Torus L)) (x : Torus L) : + 0≤ spatialSiteDistance L A x := Metric.infDist_nonneg + +lemma spatialSiteDistance_le (L : Length) (A : Finset (Torus L)) (x y : Torus L) (hy : y∈A) : + spatialSiteDistance L A x≤torusDistance L x y := by + rw [←euclideanTorusPoint_dist] + exact Metric.infDist_le_dist_of_mem ⟨y,hy,rfl⟩ + +lemma spatialSiteDistance_attained (L : Length) (A : Finset (Torus L)) (hA : A.Nonempty) (x : Torus L) : + ∃ y∈A, spatialSiteDistance L A x=torusDistance L x y := by + have hc : IsCompact (euclideanTorusPoint L '' (A:Set (Torus L))) := + (A.finite_toSet.image _).isCompact + obtain ⟨y,⟨z,hz,rfl⟩,he⟩ := hc.exists_infDist_eq_dist (by exact Set.Nonempty.image _ hA.to_set) (euclideanTorusPoint L x) + exact ⟨z,hz,he.trans (euclideanTorusPoint_dist L x z)⟩ + +def spatialDistanceBump : ContDiffBump (0 : SpatialLift) where + rIn := 1/(2*((spatialMetricConstant:ℝ)+1)) + rOut := 1/((spatialMetricConstant:ℝ)+1) + rIn_pos := by positivity + rIn_lt_rOut := by + have hp : 0<(spatialMetricConstant:ℝ)+1 := by positivity + apply one_div_lt_one_div_of_lt hp + linarith + +def smoothSpatialDistance (L : Length) (A : Finset (Torus L)) : Torus L → ℝ := + torusMollify L spatialDistanceBump (spatialSiteDistance L A) + +lemma smoothSpatialDistance_lipschitz (L : Length) (A : Finset (Torus L)) : + LipschitzWith spatialMetricConstant (smoothSpatialDistance L A) := + torusMollify_lipschitz L _ (spatialSiteDistance_lipschitz L A) + +lemma smoothSpatialDistance_approximation (L : Length) (A : Finset (Torus L)) (x : Torus L) : + |smoothSpatialDistance L A x-spatialSiteDistance L A x|≤1 := by + apply (torusMollify_approximation L spatialDistanceBump (spatialSiteDistance_lipschitz L A) x).trans + change (spatialMetricConstant:ℝ)*(1/((spatialMetricConstant:ℝ)+1))≤1 + rw [mul_one_div,(div_le_one (by positivity : 0<(spatialMetricConstant:ℝ)+1))] + linarith + +def spatialDistanceMultiplier (L : Length) (A : Finset (Torus L)) : SmoothMultiplier 1 L := + mollifiedSpatialMultiplier L spatialDistanceBump (spatialSiteDistance L A) + (spatialSiteDistance_lipschitz L A).continuous + +lemma spatialDistanceMultiplier_apply (L : Length) (A : Finset (Torus L)) (X : Configuration 1 L) : + (spatialDistanceMultiplier L A).toFun X=(smoothSpatialDistance L A (X 0):ℂ) := rfl + +lemma spatialDistanceMultiplier_real (L : Length) (A : Finset (Torus L)) (X : Configuration 1 L) : + conj ((spatialDistanceMultiplier L A).toFun X)=(spatialDistanceMultiplier L A).toFun X := by + rw [spatialDistanceMultiplier_apply,Complex.conj_ofReal] + +lemma spatialDistanceMultiplier_partial_bound (L : Length) (A : Finset (Torus L)) + (p : Direction 1) (X : Configuration 1 L) : + ‖coordDerivative 1 L (spatialDistanceMultiplier L A).toFun p X‖≤ spatialMetricConstant := by + have hLip : LipschitzWith spatialMetricConstant + (fun Y : LiftedConfiguration 1 ↦ (spatialDistanceMultiplier L A).toFun (project 1 L Y)) := by + apply LipschitzWith.of_dist_le_mul + intro Y Z + change dist ((smoothSpatialDistance L A (spatialProject L (Y 0))):ℂ) + ((smoothSpatialDistance L A (spatialProject L (Z 0))):ℂ)≤_ + rw [dist_eq_norm,←Complex.ofReal_sub,Complex.norm_real,Real.norm_eq_abs,←Real.dist_eq] + apply ((smoothSpatialDistance_lipschitz L A).dist_le_mul _ _).trans + apply mul_le_mul_of_nonneg_left _ spatialMetricConstant.coe_nonneg + exact ((lipschitz_spatialProject L).dist_le_mul (Y 0) (Z 0)).trans + (by simpa using dist_le_pi_dist Y Z 0) + unfold coordDerivative + apply (ContinuousLinearMap.le_opNorm _ _).trans + have hv : ‖(Pi.single p.1 (Pi.single p.2 (1:ℝ)) : LiftedConfiguration 1)‖≤1 := by + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro i + by_cases hi : i=p.1 + · subst i + simp only [Pi.single_eq_same] + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro j + by_cases hj : j=p.2 + · subst j; simp + · simp [Pi.single_eq_of_ne hj] + · simp [Pi.single_eq_of_ne hi] + exact (mul_le_mul_of_nonneg_left hv (norm_nonneg _)).trans (by + simpa only [mul_one] using norm_fderiv_le_of_lipschitz ℝ hLip) + +end HardSphere + +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate + +def spatialAngle (H t : ℝ) : ℝ := Real.pi/2*CellOrbital.profile 1 (t-H) +def spatialSine (H t : ℝ) : ℝ := Real.sin (spatialAngle H t) +def spatialCosine (H t : ℝ) : ℝ := Real.cos (spatialAngle H t) + +lemma spatialAngle_smooth (H : ℝ) : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (spatialAngle H) := + contDiff_const.mul ((CellOrbital.profile_smooth 1).comp (contDiff_id.sub contDiff_const)) +lemma spatialSine_smooth (H : ℝ) : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (spatialSine H) := + Real.contDiff_sin.comp (spatialAngle_smooth H) +lemma spatialCosine_smooth (H : ℝ) : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (spatialCosine H) := + Real.contDiff_cos.comp (spatialAngle_smooth H) + +lemma spatialAngle_hasDerivAt (H t : ℝ) : + HasDerivAt (spatialAngle H) (Real.pi/2*deriv (CellOrbital.profile 1) (t-H)) t := by + have hd := (((CellOrbital.profile_smooth 1).differentiable (by simp)) (t-H)).hasDerivAt + convert (hd.comp t ((hasDerivAt_id t).sub_const H)).const_mul (Real.pi/2) using 1 <;> + first | rfl | simp only [mul_one] + +lemma spatialSine_deriv (H t : ℝ) : deriv (spatialSine H) t= + Real.cos (spatialAngle H t)*(Real.pi/2*deriv (CellOrbital.profile 1) (t-H)) := + (spatialAngle_hasDerivAt H t).sin.deriv +lemma spatialCosine_deriv (H t : ℝ) : deriv (spatialCosine H) t= + -Real.sin (spatialAngle H t)*(Real.pi/2*deriv (CellOrbital.profile 1) (t-H)) := + (spatialAngle_hasDerivAt H t).cos.deriv + +def spatialInside (L : Length) (A : Finset (Torus L)) (H : ℝ) : SmoothMultiplier 1 L := + (spatialDistanceMultiplier L A).realComp (spatialSine H) (spatialSine_smooth H) +def spatialOutside (L : Length) (A : Finset (Torus L)) (H : ℝ) : SmoothMultiplier 1 L := + (spatialDistanceMultiplier L A).realComp (spatialCosine H) (spatialCosine_smooth H) + +lemma spatialInside_apply (L : Length) (A : Finset (Torus L)) (H : ℝ) (X : Configuration 1 L) : + (spatialInside L A H).toFun X=(spatialSine H (smoothSpatialDistance L A (X 0)):ℂ) := rfl +lemma spatialOutside_apply (L : Length) (A : Finset (Torus L)) (H : ℝ) (X : Configuration 1 L) : + (spatialOutside L A H).toFun X=(spatialCosine H (smoothSpatialDistance L A (X 0)):ℂ) := rfl +lemma spatialInside_real (L : Length) (A : Finset (Torus L)) (H : ℝ) (X : Configuration 1 L) : + conj ((spatialInside L A H).toFun X)=(spatialInside L A H).toFun X := by + rw [spatialInside_apply,Complex.conj_ofReal] +lemma spatialOutside_real (L : Length) (A : Finset (Torus L)) (H : ℝ) (X : Configuration 1 L) : + conj ((spatialOutside L A H).toFun X)=(spatialOutside L A H).toFun X := by + rw [spatialOutside_apply,Complex.conj_ofReal] + +lemma spatialPartition_unity (L : Length) (A : Finset (Torus L)) (H : ℝ) (x : Torus L) : + (spatialInside L A H).orbital x*(spatialInside L A H).orbital x+ + (spatialOutside L A H).orbital x*(spatialOutside L A H).orbital x=1 := by + change (Real.sin (spatialAngle H (smoothSpatialDistance L A x)):ℂ)* + (Real.sin (spatialAngle H (smoothSpatialDistance L A x)):ℂ)+ + (Real.cos (spatialAngle H (smoothSpatialDistance L A x)):ℂ)* + (Real.cos (spatialAngle H (smoothSpatialDistance L A x)):ℂ)=1 + have h := Real.sin_sq_add_cos_sq (spatialAngle H (smoothSpatialDistance L A x)) + exact_mod_cast (show Real.sin (spatialAngle H (smoothSpatialDistance L A x))* + Real.sin (spatialAngle H (smoothSpatialDistance L A x))+ + Real.cos (spatialAngle H (smoothSpatialDistance L A x))*Real.cos (spatialAngle H (smoothSpatialDistance L A x))=1 by nlinarith only [h]) + +lemma spatialInside_norm_le (L : Length) (A : Finset (Torus L)) (H : ℝ) (x : Torus L) : + ‖(spatialInside L A H).orbital x‖≤1 := by + change ‖(Real.sin (spatialAngle H (smoothSpatialDistance L A x)):ℂ)‖≤1 + rw [Complex.norm_real,Real.norm_eq_abs] + exact Real.abs_sin_le_one _ + +lemma spatialInside_one (L : Length) (A : Finset (Torus L)) (H : ℝ) (x : Torus L) + (hx : spatialSiteDistance L A x≤H) : (spatialInside L A H).orbital x=1 := by + have hm := (abs_le.mp (smoothSpatialDistance_approximation L A x)).2 + have h : smoothSpatialDistance L A x-H≤1 := by linarith + change (Real.sin (Real.pi/2*CellOrbital.profile 1 (smoothSpatialDistance L A x-H)):ℂ)=1 + rw [CellOrbital.profile_one (by norm_num : (0:ℝ)<1) h,mul_one,Real.sin_pi_div_two,Complex.ofReal_one] + +lemma spatialInside_zero (L : Length) (A : Finset (Torus L)) (H : ℝ) (x : Torus L) + (hx : H+3≤ spatialSiteDistance L A x) : (spatialInside L A H).orbital x=0 := by + have hm := (abs_le.mp (smoothSpatialDistance_approximation L A x)).1 + have h : 2*1≤ smoothSpatialDistance L A x-H := by linarith + change (Real.sin (Real.pi/2*CellOrbital.profile 1 (smoothSpatialDistance L A x-H)):ℂ)=0 + rw [CellOrbital.profile_zero (by norm_num : (0:ℝ)<1) h,mul_zero,Real.sin_zero,Complex.ofReal_zero] + +lemma spatialInside_partial (L : Length) (A : Finset (Torus L)) (H : ℝ) + (p : Direction 1) (X : Configuration 1 L) : + coordDerivative 1 L (spatialInside L A H).toFun p X= + ((deriv (spatialSine H) (smoothSpatialDistance L A (X 0)):ℝ):ℂ)* + coordDerivative 1 L (spatialDistanceMultiplier L A).toFun p X := by + rw [spatialInside,SmoothMultiplier.partial_realComp _ _ _ (spatialDistanceMultiplier_real L A)] + rfl +lemma spatialOutside_partial (L : Length) (A : Finset (Torus L)) (H : ℝ) + (p : Direction 1) (X : Configuration 1 L) : + coordDerivative 1 L (spatialOutside L A H).toFun p X= + ((deriv (spatialCosine H) (smoothSpatialDistance L A (X 0)):ℝ):ℂ)* + coordDerivative 1 L (spatialDistanceMultiplier L A).toFun p X := by + rw [spatialOutside,SmoothMultiplier.partial_realComp _ _ _ (spatialDistanceMultiplier_real L A)] + rfl + +lemma spatialPartition_partial_zero (L : Length) (A : Finset (Torus L)) (H : ℝ) + (p : Direction 1) (X : Configuration 1 L) (hx : H+3 dsimp [c] at * <;> linarith + calc + _ ≤ volume (Set.univ.pi (fun j ↦ + Metric.closedBall ((c j : ℝ) : AddCircle L.val) (h/2))) := measure_mono hsub + _ = ∏ j : Fin 3, ENNReal.ofReal (min L.val (2 * (h/2))) := by + rw [volume_pi_pi] + simp only [AddCircle.volume_closedBall] + _ ≤ ∏ _j : Fin 3, ENNReal.ofReal h := by + apply Finset.prod_le_prod + intro j _ + apply ENNReal.ofReal_le_ofReal + simpa only [mul_div_cancel₀ _ (by norm_num : (2 : ℝ) ≠ 0)] using + (min_le_right L.val (2 * (h / 2))) + _ = ENNReal.ofReal (h^3) := by simp [ENNReal.ofReal_pow hh] + +def filledRegion (L : Length) (h : ℝ) (C : Finset Vertex) : Set (Torus L) := + ⋃ z ∈ fill C, microCube L h z + +lemma volume_finite_microCubes_le (L : Length) {h : ℝ} (hh : 0 ≤ h) + (S : Finset Vertex) : + (volume : Measure (Torus L)) (⋃ z ∈ S, microCube L h z) ≤ + ENNReal.ofReal ((S.card : ℝ) * h^3) := by + calc + _ ≤ ∑ z ∈ S, volume (microCube L h z) := measure_biUnion_finset_le S _ + _ ≤ ∑ _z ∈ S, ENNReal.ofReal (h^3) := + Finset.sum_le_sum fun z _ ↦ volume_microCube_le L hh z + _ = _ := by simp [ENNReal.ofReal_mul, nsmul_eq_mul] + +lemma volume_filledRegion_le_columns (L : Length) {h : ℝ} (hh : 0 ≤ h) + (C : Finset Vertex) (i : Fin 3) (lo hi : ℤ) + (hb : ∀ c ∈ C, lo ≤ c i ∧ c i ≤ hi) : + (volume : Measure (Torus L)) (filledRegion L h C) ≤ + ENNReal.ofReal ((C.card : ℝ) * ((hi - lo + 1).toNat : ℝ) * h^3) := by + have hsub : filledRegion L h C ⊆ + ⋃ z ∈ columnCover C i lo hi, microCube L h z := by + intro x hx + obtain ⟨z, hz, hx⟩ := Set.mem_iUnion₂.mp hx + exact Set.mem_iUnion₂.mpr ⟨z, fill_subset_columnCover C i lo hi hb hz, hx⟩ + calc + _ ≤ volume (⋃ z ∈ columnCover C i lo hi, microCube L h z) := measure_mono hsub + _ ≤ ENNReal.ofReal (((columnCover C i lo hi).card : ℝ) * h^3) := + volume_finite_microCubes_le L hh _ + _ ≤ _ := by + apply ENNReal.ofReal_le_ofReal + apply mul_le_mul_of_nonneg_right _ (pow_nonneg hh 3) + exact_mod_cast card_columnCover_le C i lo hi + +theorem volume_small_filledRegion (L : Length) {h : ℝ} (hh : 0 ≤ h) (hh1 : h ≤ 1) + (C : Finset Vertex) (i : Fin 3) (lo hi : ℤ) (hlh : lo ≤ hi) + (hb : ∀ c ∈ C, lo ≤ c i ∧ c i ≤ hi) + (hspan : h * ((hi : ℝ) - lo) ≤ 1) : + (volume : Measure (Torus L)) (filledRegion L h C) ≤ + ENNReal.ofReal (3 * h^2 * C.card) := by + apply (volume_filledRegion_le_columns L hh C i lo hi hb).trans + apply ENNReal.ofReal_le_ofReal + have hw : ((hi - lo + 1).toNat : ℝ) = (hi : ℝ) - lo + 1 := by + have ht : ((hi - lo + 1).toNat : ℤ) = hi - lo + 1 := Int.toNat_of_nonneg (by omega) + exact_mod_cast ht + rw [hw] + have hs : h * ((hi : ℝ) - lo + 1) ≤ 3 := by nlinarith + have hm := mul_le_mul_of_nonneg_right hs (sq_nonneg h) + have hc := mul_le_mul_of_nonneg_right hm (show (0 : ℝ) ≤ C.card by positivity) + nlinarith + +def witnessBox (h : ℝ) (c : Point) : Finset Vertex := + Finset.Icc (fun j ↦ ⌊(c j + 1/2) / h⌋ - 3) + (fun j ↦ ⌊(c j + 1/2) / h⌋ + 3) + +lemma card_witnessBox (h : ℝ) (c : Point) : (witnessBox h c).card = 343 := by + unfold witnessBox + rw [Pi.card_Icc] + have hc (j : Fin 3) : + (Finset.Icc (⌊(c j + 1/2) / h⌋ - 3) (⌊(c j + 1/2) / h⌋ + 3)).card = 7 := by + rw [Int.card_Icc] + omega + simp only [hc, Finset.prod_const, Finset.card_univ, Fintype.card_fin] + norm_num + +lemma interval_ball_witness {h r c u : ℝ} {z : ℤ} + (hh : 0 < h) (hr : r ≤ 2*h) + (hul : h * z - 1/2 ≤ u) (huu : u ≤ h * ((z : ℝ)+1) - 1/2) + (hud : |u - c| ≤ r) : + ⌊(c + 1/2) / h⌋ - 3 ≤ z ∧ z ≤ ⌊(c + 1/2) / h⌋ + 3 := by + have hl := (le_div_iff₀ hh).mp (Int.floor_le ((c + 1/2) / h)) + have hu := (div_lt_iff₀ hh).mp (Int.lt_floor_add_one ((c + 1/2) / h)) + obtain ⟨hd₁, hd₂⟩ := abs_le.mp hud + constructor + · have he : ((⌊(c + 1/2) / h⌋ : ℤ) : ℝ) - 3 ≤ z := by nlinarith + exact_mod_cast he + · have he : (z : ℝ) ≤ (⌊(c + 1/2) / h⌋ : ℝ) + 3 := by nlinarith + exact_mod_cast he + +lemma ball_microCube_witness {L : Length} {J : ℕ} {h r : ℝ} (hh : 0 < h) + (hperiod : L.val = h * J) (hr : r ≤ 2*h) + (c : Point) {z : Vertex} {x : Torus L} + (hx : x ∈ microCube L h z) (hd : torusDistance L x (liftPoint L c) ≤ r) : + ∃ w ∈ witnessBox h c, torusProjection J w = torusProjection J z := by + obtain ⟨u, hu, rfl⟩ := hx + let k : Vertex := fun j ↦ round (L.val⁻¹ * (u j - c j)) + let w : Vertex := fun j ↦ z j - k j * (J : ℤ) + refine ⟨w, ?_, ?_⟩ + · apply Finset.mem_Icc.mpr + have hb (j : Fin 3) : + ⌊(c j + 1/2) / h⌋ - 3 ≤ w j ∧ w j ≤ ⌊(c j + 1/2) / h⌋ + 3 := by + have hdj := (CellOrbital.dist_coord_le_torusDistance L + (liftPoint L u) (liftPoint L c) j).trans hd + change dist (u j : AddCircle L.val) (c j : AddCircle L.val) ≤ r at hdj + rw [dist_eq_norm, ← AddCircle.coe_sub, AddCircle.norm_eq] at hdj + have hk : |(u j - (k j : ℝ) * L.val) - c j| ≤ r := by + convert hdj using 1 + dsimp [k] + ring_nf + apply interval_ball_witness hh hr (u := u j - (k j : ℝ) * L.val) + · have hl := hu.1 j + change h * (z j : ℝ) - 1/2 ≤ u j at hl + dsimp [w] + push_cast + rw [hperiod] + nlinarith + · have hl := hu.2 j + change u j ≤ h * ((z j : ℝ)+1) - 1/2 at hl + dsimp [w] + push_cast + rw [hperiod] + nlinarith + · exact hk + exact ⟨fun j ↦ (hb j).1, fun j ↦ (hb j).2⟩ + · ext j + simp [torusProjection, w] + +theorem ncard_ball_bad_sites_le {L : Length} {J : ℕ} {h r : ℝ} (hh : 0 < h) + (hperiod : L.val = h * J) (hr : r ≤ 2*h) (y : Torus L) : + (torusProjection J '' {z | ∃ x ∈ microCube L h z, + torusDistance L x y ≤ r}).ncard ≤ 343 := by + let c : Point := fun j ↦ (AddCircle.equivIco L.val 0 (y j)).val + have hc : liftPoint L c = y := by ext j; exact AddCircle.coe_equivIco + have hsub : torusProjection J '' {z | ∃ x ∈ microCube L h z, + torusDistance L x y ≤ r} ⊆ ↑((witnessBox h c).image (torusProjection J)) := by + rintro v ⟨z, ⟨x, hx, hd⟩, rfl⟩ + obtain ⟨w, hw, he⟩ := ball_microCube_witness hh hperiod hr c hx (by simpa [hc] using hd) + exact Finset.mem_image.mpr ⟨w, hw, he⟩ + calc + _ ≤ (↑((witnessBox h c).image (torusProjection J)) : Set (DiscreteTorus J)).ncard := + Set.ncard_le_ncard hsub (Finset.finite_toSet _) + _ = ((witnessBox h c).image (torusProjection J)).card := Set.ncard_coe_finset _ + _ ≤ (witnessBox h c).card := Finset.card_image_le + _ = 343 := card_witnessBox h c + +end HardSphere.BathSlice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/FinsetEraseRecursion.lean b/lean/OAI/Analysis/HardSphere/Geometry/FinsetEraseRecursion.lean new file mode 100644 index 0000000000000000000000000000000000000000..060096fe8df412fc1bc494b0c7fe4b960da4254f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/FinsetEraseRecursion.lean @@ -0,0 +1,46 @@ +import Mathlib + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open MeasureTheory Set Filter + +lemma finset_erase_recursion {S : Type*} [DecidableEq S] (a : Finset S → ℝ) (q : ℝ) + (hq : 0 ≤ q) (h0 : a ∅ ≤ 1) + (hr : ∀ A : Finset S, A.Nonempty → (A.card : ℝ)*a A ≤ q*∑ s∈A, a (A.erase s)) : + ∀ A : Finset S, a A ≤ q^A.card := by + intro A + induction A using Finset.strongInductionOn with + | _ A ih => + by_cases hA : A.Nonempty + · have hc : 0 < (A.card : ℝ) := by exact_mod_cast hA.card_pos + have hs : (∑ s∈A, a (A.erase s)) ≤ (A.card : ℝ)*q^(A.card-1) := by + calc + _ ≤ ∑ _s∈A, q^(A.card-1) := Finset.sum_le_sum fun s hs ↦ by + have hh := ih (A.erase s) (Finset.erase_ssubset hs) + rwa [Finset.card_erase_of_mem hs] at hh + _ = _ := by simp + have he : q*((A.card : ℝ)*q^(A.card-1))=(A.card : ℝ)*q^A.card := by + rw [show q^A.card=q^(A.card-1)*q by + conv_lhs => rw [← Nat.sub_add_cancel hA.card_pos] + rw [pow_succ]] + ring + have ht := (hr A hA).trans ((mul_le_mul_of_nonneg_left hs hq).trans_eq he) + exact (mul_le_mul_iff_right₀ hc).mp (by simpa only [mul_comm (A.card : ℝ)] using ht) + · have he : A=∅ := Finset.not_nonempty_iff_eq_empty.mp hA + simpa [he] using h0 + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/FinsetEraseRecursion2.lean b/lean/OAI/Analysis/HardSphere/Geometry/FinsetEraseRecursion2.lean new file mode 100644 index 0000000000000000000000000000000000000000..aed7e05938db1be8743b28f3ceb678b0216cd880 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/FinsetEraseRecursion2.lean @@ -0,0 +1,124 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.GroundPositionLaw +import OAI.Analysis.HardSphere.Geometry.SpatialScalarSquare +import OAI.Analysis.HardSphere.Geometry.MollifiedCloseJoint + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate + +lemma finset_erase_recursion_on {S : Type*} [DecidableEq S] (a : Finset S → ℝ) + (P : Finset S → Prop) (hP : ∀ A s, P A → P (A.erase s)) (q : ℝ) + (hq : 0≤q) (h0 : a ∅≤1) + (hr : ∀ A : Finset S, P A → A.Nonempty → (A.card:ℝ)*a A≤q*∑ s∈A, a (A.erase s)) : + ∀ A : Finset S, P A → a A≤q^A.card := by + intro A + induction A using Finset.strongInductionOn with + | _ A ih => + intro hPA + by_cases hA : A.Nonempty + · have hc : 0<(A.card:ℝ) := by exact_mod_cast hA.card_pos + have hs : (∑ s∈A, a (A.erase s))≤(A.card:ℝ)*q^(A.card-1) := by + calc + _ ≤ ∑ _s∈A, q^(A.card-1) := Finset.sum_le_sum fun s hs ↦ by + have hh := ih (A.erase s) (Finset.erase_ssubset hs) (hP A s hPA) + rwa [Finset.card_erase_of_mem hs] at hh + _ = _ := by simp + have he : q*((A.card:ℝ)*q^(A.card-1))=(A.card:ℝ)*q^A.card := by + rw [show q^A.card=q^(A.card-1)*q by + conv_lhs => rw [←Nat.sub_add_cancel hA.card_pos] + rw [pow_succ]] + ring + have ht := (hr A hPA hA).trans ((mul_le_mul_of_nonneg_left hs hq).trans_eq he) + exact (mul_le_mul_iff_right₀ hc).mp (by simpa only [mul_comm (A.card:ℝ)] using ht) + · have he : A=∅ := Finset.not_nonempty_iff_eq_empty.mp hA + simpa [he] using h0 + +variable {n : ℕ} [Nontrivial (Fin n)] + +lemma mollifiedCloseJoint_empty_onScalar (L : Length) (s h : ℝ) + (φ : ContDiffBump (0 : EuclideanConfiguration (Fin n))) (u : ScalarL2 n L) : + (mollifiedCloseJoint L s φ h ∅).onScalar u=u := by + apply Lp.ext + filter_upwards [(mollifiedCloseJoint L s φ h ∅).coe_onScalar u] with X hX + simpa only [mollifiedCloseJoint_apply,Finset.prod_empty,one_mul] using hX + +lemma groundPositionLaw_le_closeJoint (L : Length) {s h : ℝ} (hs : 0 by_cases h2 : q.2=p.2 <;> + simp [euclideanFlatten_apply,EuclideanSpace.basisFun_apply,Prod.ext_iff,h1,h2] + +lemma realEuclidean_lift_smooth {n : ℕ} (L : Length) (f : Configuration n L→ℝ) + (hf : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (fun x : EuclideanConfiguration (Fin n) ↦ f (euclideanProject L x))) : + ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (fun x : LiftedConfiguration n ↦ (f (project n L x):ℂ)) := + Complex.ofRealCLM.contDiff.comp (hf.comp (euclideanFlatten n).contDiff) + +def realEuclideanMultiplier {n : ℕ} (L : Length) (f : Configuration n L→ℝ) + (hf : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (fun x : EuclideanConfiguration (Fin n) ↦ f (euclideanProject L x))) : + SmoothMultiplier n L := SmoothMultiplier.ofSmooth (fun X ↦ (f X:ℂ)) (realEuclidean_lift_smooth L f hf) + +lemma coordDerivative_real_euclidean {n : ℕ} (L : Length) (f : Configuration n L→ℝ) + (hf : Differentiable ℝ (fun x : EuclideanConfiguration (Fin n) ↦ f (euclideanProject L x))) + (p : Direction n) (X : Configuration n L) : + coordDerivative n L (fun Y ↦ (f Y:ℂ)) p X= + ((fderiv ℝ (fun x : EuclideanConfiguration (Fin n) ↦ f (euclideanProject L x)) + (euclideanFlatten n (representative n L X)) (EuclideanSpace.basisFun (Direction n) ℝ p)):ℂ) := by + have hh := (Complex.ofRealCLM.hasFDerivAt.comp _ (hf _).hasFDerivAt).comp + (representative n L X) (euclideanFlatten n).hasFDerivAt + have he : ((Complex.ofRealCLM ∘ (fun x : EuclideanConfiguration (Fin n) ↦ f (euclideanProject L x))) ∘ euclideanFlatten n)= + (fun x : LiftedConfiguration n ↦ (f (project n L x):ℂ)) := by + funext x + rfl + rw [he] at hh + unfold coordDerivative + rw [hh.fderiv] + simp only [ContinuousLinearMap.comp_apply,euclideanFlatten_single,Complex.ofRealCLM_apply] + +end HardSphere + +namespace HardSphere +open MeasureTheory Set Filter +variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nontrivial ι] + +lemma clippedNearest_le (L : Length) (X Y : ι→Torus L) (i k : ι) (t : ℝ) + (hi : X i=Y i) (hrest : ∀ j, j≠k → X j=Y j) + (hfar : t≤torusDistance L (Y i) (Y k)) : + min (nearestParticleDistance L X i) t≤nearestParticleDistance L Y i := by + by_cases he : nearestLabel L Y i=k + · simpa only [nearestParticleDistance,he] using (min_le_right (nearestParticleDistance L X i) t).trans hfar + · have hn := nearestParticleDistance_le L X i (nearestLabel L Y i) (nearestLabel_ne L Y i) + rw [hi,hrest _ he] at hn + exact (min_le_left _ _).trans hn + +lemma clippedNearest_eq (L : Length) (X Y : ι→Torus L) (i k : ι) (t : ℝ) + (hi : X i=Y i) (hrest : ∀ j, j≠k → X j=Y j) + (hXfar : t≤torusDistance L (X i) (X k)) (hYfar : t≤torusDistance L (Y i) (Y k)) : + min (nearestParticleDistance L X i) t=min (nearestParticleDistance L Y i) t := + le_antisymm (le_min (clippedNearest_le L X Y i k t hi hrest hYfar) (min_le_right _ _)) + (le_min (clippedNearest_le L Y X i k t hi.symm (fun j h ↦ (hrest j h).symm) hXfar) (min_le_right _ _)) + +lemma closeRamp_clipped {s d : ℝ} (hs : 0 simp [freePathExpectation] + | succ n ih => + change (∫⁻ w : CoordinatePaths (n+1), ∏ i, h (onePathAt i (freeTrajectory (n+1) L t w X)) + ∂coordinateWiener (n+1))=_ + let Xm := (splitConfiguration n 1 L X).1 + let X1 := (splitConfiguration n 1 L X).2 + have hXm : Measurable (fun w : CoordinatePaths n ↦ + ∏ i, h (onePathAt i (freeTrajectory n L t w Xm))) := + (pathProduct_measurable Finset.univ hh).comp + ((freeTrajectory_continuous n L t).measurable.comp (measurable_id.prodMk measurable_const)) + have hX1 : Measurable (fun w : CoordinatePaths 1 ↦ h (freeTrajectory 1 L t w X1)) := + hh.comp ((freeTrajectory_continuous 1 L t).measurable.comp (measurable_id.prodMk measurable_const)) + have hfull : Measurable (fun w : CoordinatePaths (n+1) ↦ + ∏ i, h (onePathAt i (freeTrajectory (n+1) L t w X))) := + (pathProduct_measurable Finset.univ hh).comp + ((freeTrajectory_continuous (n+1) L t).measurable.comp (measurable_id.prodMk measurable_const)) + rw [←(joinCoordinatePaths_preserving n 1).lintegral_comp hfull] + have he (w : CoordinatePaths n × CoordinatePaths 1) : + freeTrajectory (n+1) L t (joinCoordinatePaths n 1 w) X= + joinConfigurationPath n 1 L (freeTrajectory n L t w.1 Xm,freeTrajectory 1 L t w.2 X1) := by + rw [←freeTrajectory_join,join_splitConfiguration] + simp only [he,Fin.prod_univ_add,onePathAt_join_left,onePathAt_join_right, + Fin.prod_univ_one,onePathAt_single] + rw [lintegral_prod_mul hXm.aemeasurable hX1.aemeasurable] + change freePathExpectation t (fun ω : ConfigurationPath n L ↦ ∏ i,h (onePathAt i ω)) Xm * + freePathExpectation t h X1 = _ + rw [ih] + congr 1 + change freePathExpectation t h X1 = freePathExpectation t h (oneConfiguration (X (Fin.natAdd n 0))) + congr 1 + funext i + have hi : i=0 := Subsingleton.elim _ _ + subst i + rfl + +end HardSphere + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/FrozenChecks.lean b/lean/OAI/Analysis/HardSphere/Geometry/FrozenChecks.lean new file mode 100644 index 0000000000000000000000000000000000000000..89696b2e989dabfd42329b5adbd0d1564da2112e --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/FrozenChecks.lean @@ -0,0 +1,133 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.AuxiliaryChecks + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +variable {I C : Type*} [Fintype I] [DecidableEq I] [Fintype C] + {X : I → Type*} [∀i,MeasurableSpace (X i)] + +def freezeOutside (U : Finset I) (x y : ∀i,X i) : ∀i,X i := + fun i ↦ if i∈U then y i else x i +omit [Fintype I] in +lemma freezeOutside_measurable (U : Finset I) (x : ∀i,X i) : Measurable (freezeOutside U x) := by + apply Measurable.of_eval + intro i + by_cases hi : i∈U + · simpa only [freezeOutside,ite_eq_left hi] using (measurable_pi_apply i) + · simp only [freezeOutside,ite_eq_right hi] + exact measurable_const + +omit [Fintype I] [∀i,MeasurableSpace (X i)] in +lemma freezeOutside_update (U : Finset I) (x y : ∀i,X i) {i : I} (hi : i∈U) (v : X i) : + freezeOutside U x (Function.update y i v)=Function.update (freezeOutside U x y) i v := by + funext j + by_cases hj : j=i + · subst j;simp [freezeOutside,hi] + · simp [freezeOutside,Function.update_of_ne hj] + +def FrozenCheckIndex (checks : C → LocalCheck X) (U : Finset I) := + {c : C // ((checks c).support∩U).Nonempty} + +instance (checks : C → LocalCheck X) (U : Finset I) : Fintype (FrozenCheckIndex checks U) := + by + classical + unfold FrozenCheckIndex + infer_instance + +def frozenChecks (checks : C → LocalCheck X) (U : Finset I) (x : ∀i,X i) : + FrozenCheckIndex checks U → LocalCheck X := fun c ↦ { + support := (checks c.val).support∩U + nonempty := c.property + arity := (Finset.card_le_card Finset.inter_subset_left).trans (checks c.val).arity + pass := fun y ↦ (checks c.val).pass (freezeOutside U x y) + measurable_pass := (checks c.val).measurable_pass.preimage (freezeOutside_measurable U x) + depends := by + intro y z hyz + apply (checks c.val).depends + intro i hi + by_cases hu : i∈U + · simp only [freezeOutside,ite_eq_left hu] + exact hyz i (Finset.mem_inter.mpr ⟨hi,hu⟩) + · simp only [freezeOutside,ite_eq_right hu] +} + +omit [Fintype C] +lemma frozen_support_subset (checks : C → LocalCheck X) (U t : Finset I) (c : C) : + (checks c).support ⊆ t∪(Finset.univ \ U) ↔ (checks c).support∩U ⊆t := by + constructor + · intro h i hi + rcases Finset.mem_union.mp (h (Finset.mem_inter.mp hi).1) with ht|ho + · exact ht + · exact False.elim ((Finset.mem_sdiff.mp ho).2 (Finset.mem_inter.mp hi).2) + · intro h i hi + by_cases hu : i∈U + · exact Finset.mem_union_left _ (h (Finset.mem_inter.mpr ⟨hi,hu⟩)) + · exact Finset.mem_union_right _ (Finset.mem_sdiff.mpr ⟨Finset.mem_univ _,hu⟩) + +lemma frozen_retained (checks : C → LocalCheck X) (U t : Finset I) (x y : ∀i,X i) + (hx : x∈retainedEvent checks (Finset.univ \ U)) : + y∈retainedEvent (frozenChecks checks U x) t ↔ + freezeOutside U x y∈retainedEvent checks (t∪(Finset.univ \ U)) := by + constructor + · intro hy c hc + by_cases he : ((checks c).support∩U).Nonempty + · exact hy ⟨c,he⟩ ((frozen_support_subset checks U t c).mp hc) + · have hout : (checks c).support⊆Finset.univ \ U := by + intro i hi + refine Finset.mem_sdiff.mpr ⟨Finset.mem_univ _,?_⟩ + intro hu + exact he ⟨i,Finset.mem_inter.mpr ⟨hi,hu⟩⟩ + apply ((checks c).depends x (freezeOutside U x y) ?_).mp (hx c hout) + intro i hi + simp only [freezeOutside,ite_eq_right (Finset.mem_sdiff.mp (hout hi)).2] + · intro hy c hc + exact hy c.val ((frozen_support_subset checks U t c.val).mpr hc) + +lemma frozen_checkWeight (checks : C → LocalCheck X) (U t : Finset I) (x y : ∀i,X i) + (hx : x∈retainedEvent checks (Finset.univ \ U)) : + checkWeight (frozenChecks checks U x) t y= + checkWeight checks (t∪(Finset.univ \ U)) (freezeOutside U x y) := by + classical + simp only [checkWeight,Set.indicator_apply,frozen_retained checks U t x y hx] + +lemma frozen_insertion (checks : C → LocalCheck X) (U s : Finset I) (x y : ∀i,X i) (i : I) : + freezeOutside U x y∈insertionEvent checks (s∪(Finset.univ \ U)) i → + y∈insertionEvent (frozenChecks checks U x) s i := by + intro hy c hc hcs + apply hy c.val + · rw [←Finset.insert_union] + exact (frozen_support_subset checks U (insert i s) c.val).mpr hc + · intro hs + exact hcs ((frozen_support_subset checks U s c.val).mp hs) + +lemma frozen_uniformInsertion (checks : C → LocalCheck X) (U : Finset I) (x : ∀i,X i) + (μ : ∀i,Measure (X i)) {a : ℝ≥0∞} + (h : UniformInsertionOn checks μ a U) : + UniformInsertionOn (frozenChecks checks U x) μ a U := by + intro i hi s his y + have hin : i∉s∪(Finset.univ \ U) := by simp [Finset.mem_union,his,hi] + apply (h i hi (s∪(Finset.univ \ U)) hin (freezeOutside U x y)).trans + apply lintegral_mono + intro v + dsimp only + rw [←freezeOutside_update U x y hi v] + by_cases hp : freezeOutside U x (Function.update y i v)∈insertionEvent checks (s∪(Finset.univ \ U)) i + · rw [Set.indicator_of_mem hp,Set.indicator_of_mem (frozen_insertion checks U s x (Function.update y i v) i hp)] + · rw [Set.indicator_of_notMem hp] + exact bot_le + +end HardSphere.Comparison + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/GeneratorScalar.lean b/lean/OAI/Analysis/HardSphere/Geometry/GeneratorScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..5aa3a738e0250866ae2bd514b15cc3c314a98356 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/GeneratorScalar.lean @@ -0,0 +1,189 @@ +import Mathlib +import OAI.Analysis.HardSphere.Cutoffs.RegularizationWeight + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +noncomputable section +open scoped BigOperators ComplexConjugate +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +noncomputable section +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open ContinuousLinearMap Filter +open scoped Topology + +lemma heatScalar_eq_exp {t x : ℝ} (ht : 0 assumption + +def gridSite {K : ℕ} (v : Fin 3→Fin K) : DiscreteTorus K := fun j ↦ ((v j).val:ZMod K) +lemma gridSite_injective {K : ℕ} [NeZero K] : Function.Injective (gridSite (K:=K)) := by + intro v w h + funext j + apply Fin.ext + have hh := congrArg (fun f : DiscreteTorus K ↦ (f j).val) h + simpa only [gridSite,ZMod.val_natCast_of_lt (v j).isLt,ZMod.val_natCast_of_lt (w j).isLt] using hh + +lemma siteCube_gridSite {K : ℕ} [NeZero K] (v : Fin 3→Fin K) : siteCube (gridSite v)=gridCube v := by + apply Prod.ext + · apply Fin.ext + exact ZMod.val_natCast_of_lt (v 0).isLt + · apply Prod.ext <;> apply Fin.ext + · exact ZMod.val_natCast_of_lt (v 1).isLt + · exact ZMod.val_natCast_of_lt (v 2).isLt + +def gridShift (L : Length) : Torus L := fun _ ↦ ((-1/2:ℝ):AddCircle L.val) + +lemma shifted_unitCenter {K : ℕ} (L : Length) (v : Fin 3→Fin K) : + unitCenter L (gridCube v)+gridShift L=gridCenter L v := by + funext j + fin_cases j <;> change ((((_:ℝ)+1/2:ℝ):AddCircle L.val)+((-1/2:ℝ):AddCircle L.val))=(_ : AddCircle L.val) + all_goals + rw [←AddCircle.coe_add] + congr 1 + simp only [gridCube] + ring_nf + rfl + +lemma shifted_siteCenter {K : ℕ} [NeZero K] (L : Length) (v : Fin 3→Fin K) : + ShiftVisits.center L (gridShift L) (gridSite v)=gridCenter L v := by + rw [ShiftVisits.center,←unitCenter_siteCube,siteCube_gridSite] + exact shifted_unitCenter L v + +lemma grid_visitorCount {n K : ℕ} [NeZero K] (L : Length) (E : Set (ConfigurationPath 1 L)) + (v : Fin 3→Fin K) (ω : ConfigurationPath n L) : + ShiftVisits.visitorCount L (gridShift L) E (gridSite v) ω= + (Finset.univ.filter (fun i : Fin n ↦ onePathAt i ω∈E ∧ pathVisitsBall L 12 (gridCenter L v) i ω)).card := by + classical + simp only [ShiftVisits.visitorCount,shifted_siteCenter] + +end HardSphere.Groups + +end +end + +section +noncomputable section +open MeasureTheory Set Filter +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Groups +open HardSphere.Lattice HardSphere.FreeVisits HardSphere.CellOrbital +attribute [local instance] Classical.propDecidable + +def rangePackingBox (c : Fin 3→ℝ) : Finset Vertex := + Finset.Icc (fun j ↦ ⌊c j⌋-24) (fun j ↦ ⌊c j⌋+24) +lemma card_rangePackingBox (c : Fin 3→ℝ) : (rangePackingBox c).card=49^3 := by + unfold rangePackingBox + rw [Pi.card_Icc] + have h (j : Fin 3) : (Finset.Icc (⌊c j⌋-24) (⌊c j⌋+24)).card=49 := by rw [Int.card_Icc]; omega + simp only [h,Finset.prod_const,Finset.card_univ,Fintype.card_fin] + +lemma grid_packing_witness {K : ℕ} [NeZero K] (L : Length) (hL : L.val=(K:ℝ)) + (c : Fin 3→ℝ) (v : Fin 3→Fin K) + (hv : ∀j,dist (gridCenter L v j) ((c j:ℝ):AddCircle L.val)≤23) : + ∃z∈rangePackingBox c,torusProjection K z=gridSite v := by + let k : Vertex := fun j ↦ round (L.val⁻¹*((v j).val-c j)) + let z : Vertex := fun j ↦ ((v j).val:ℤ)-k j*(K:ℤ) + refine ⟨z,?_,?_⟩ + · apply Finset.mem_Icc.mpr + have hz (j : Fin 3) : ⌊c j⌋-24≤z j ∧ z j≤⌊c j⌋+24 := by + have hd := hv j + change dist (((v j).val:ℝ):AddCircle L.val) ((c j:ℝ):AddCircle L.val)≤23 at hd + rw [dist_eq_norm,←AddCircle.coe_sub,AddCircle.norm_eq] at hd + have hd' : |(z j:ℝ)-c j|≤23 := by + convert hd using 1 + dsimp [z,k] + push_cast + rw [hL] + ring_nf + have hl := Int.floor_le (c j) + have hu := Int.lt_floor_add_one (c j) + obtain ⟨h₁,h₂⟩ := abs_le.mp hd' + constructor <;> (apply (Int.cast_le (R:=ℝ)).mp; push_cast; linarith) + exact ⟨fun j ↦ (hz j).1,fun j ↦ (hz j).2⟩ + · ext j + simp [torusProjection,z,gridSite] + +lemma card_near_grid_le {K : ℕ} [NeZero K] (L : Length) (hL : L.val=(K:ℝ)) + (x : Torus L) (A : Finset (Fin 3→Fin K)) + (hA : ∀v∈A,torusDistance L (gridCenter L v) x≤23) : A.card≤49^3 := by + let c : Fin 3→ℝ := fun j ↦ (AddCircle.equivIco L.val 0 (x j)).val + have hc (j : Fin 3) : ((c j:ℝ):AddCircle L.val)=x j := AddCircle.coe_equivIco + have hsub : A.image gridSite⊆(rangePackingBox c).image (torusProjection K) := by + intro v hv + obtain ⟨w,hw,rfl⟩ := Finset.mem_image.mp hv + obtain ⟨z,hz,he⟩ := grid_packing_witness L hL c w (fun j ↦ by + rw [hc] + exact (dist_coord_le_torusDistance L (gridCenter L w) x j).trans (hA w hw)) + exact Finset.mem_image.mpr ⟨z,hz,he⟩ + have hh : (A.image gridSite).card≤49^3 := + (Finset.card_le_card hsub).trans (Finset.card_image_le.trans (card_rangePackingBox c).le) + rwa [Finset.card_image_of_injective A gridSite_injective] at hh + +lemma card_near_labels {I : Type*} [Fintype I] {K : ℕ} [NeZero K] + (L : Length) (hL : L.val=(K:ℝ)) (anchor : I→Fin 3→Fin K) (M : ℕ) + (hm : ∀v,(Finset.univ.filter (fun i : I ↦ anchor i=v)).card≤M) (x : Torus L) : + (Finset.univ.filter (fun i : I ↦ torusDistance L (gridCenter L (anchor i)) x≤23)).card≤49^3*M := by + let A : Finset (Fin 3→Fin K) := Finset.univ.filter (fun v ↦ torusDistance L (gridCenter L v) x≤23) + let S : Finset I := Finset.univ.filter (fun i ↦ torusDistance L (gridCenter L (anchor i)) x≤23) + have hs : ∀i∈S,anchor i∈A := by intro i hi; exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp hi).2⟩ + have hcard := Finset.card_eq_sum_card_fiberwise hs + change S.card≤_ + rw [hcard] + calc + _ ≤ ∑_v∈A,M := Finset.sum_le_sum (fun v _ ↦ (Finset.card_le_card (by + intro i hi + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp hi).2⟩)).trans (hm v)) + _ = A.card*M := by simp + _ ≤ 49^3*M := Nat.mul_le_mul_right _ (card_near_grid_le L hL x A (fun v hv ↦ (Finset.mem_filter.mp hv).2)) + +end HardSphere.Groups + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/GridAllocation.lean b/lean/OAI/Analysis/HardSphere/Geometry/GridAllocation.lean new file mode 100644 index 0000000000000000000000000000000000000000..92fc3eca3f69542bb9389a179d92e6574f9e831d --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/GridAllocation.lean @@ -0,0 +1,180 @@ +import Mathlib +import OAI.Analysis.HardSphere.Kernels.FiniteKernelPi +import OAI.Analysis.HardSphere.Allocation.WeightedExpose + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison CellOrbital +attribute [local instance] Classical.propDecidable + +abbrev GridAllocation (N K q : ℕ) := (Fin 3→Fin K)→Allocation q (Fin N) + +def gridAllocationKernel {N K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (q : ℕ) : + Kernel (BridgeEndpoints N L×(Fin N→Bool)) (GridAllocation N K q) := + finiteKernelPi (fun v : Fin 3→Fin K ↦ (allocationKernel q).comap (recordedList hL v) (recordedList_measurable hL v)) + +lemma gridAllocationKernel_apply {N K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (q : ℕ) + (p : BridgeEndpoints N L×(Fin N→Bool)) : + gridAllocationKernel hL q p=Measure.pi (fun v ↦ (allocationPMF (recordedList hL v p) q).toMeasure) := by + rw [gridAllocationKernel,finiteKernelPi_apply] + rfl + +instance gridAllocationKernel_markov {N K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (q : ℕ) : + IsMarkovKernel (gridAllocationKernel (N:=N) hL q) := by + constructor + intro p + rw [gridAllocationKernel_apply] + infer_instance + +def groupPosition (M G : ℕ) (g : Fin G) : Fin M↪Fin (G*M) where + toFun k := ⟨g.val*M+k.val, by + have hg : g.val+1≤G := g.isLt + have hk := k.isLt + calc + g.val*M+k.val < g.val*M+M := Nat.add_lt_add_left hk _ + _ = (g.val+1)*M := by rw [Nat.add_mul,Nat.one_mul] + _ ≤ G*M := Nat.mul_le_mul_right M hg⟩ + inj' := by intros a b h; apply Fin.ext; have he := congrArg Fin.val h; dsimp at he; omega + +lemma groupPosition_disjoint (M G : ℕ) (g h : Fin G) (hgh : g≠h) (k l : Fin M) : + groupPosition M G g k≠groupPosition M G h l := by + intro he + have he' := congrArg Fin.val he + change g.val*M+k.val=h.val*M+l.val at he' + wlog hlt : g.val ∅ + | some f => Finset.univ.image (fun k ↦ f (groupPosition M G g k)) + +def groupUnion {N K M G : ℕ} (g : Fin G) (a : GridAllocation N K (G*M)) : Finset (Fin N) := + Finset.univ.biUnion (groupAt g a) + +lemma groupAt_mem_list {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (p : BridgeEndpoints N L×(Fin N→Bool)) (a : GridAllocation N K (G*M)) + (ha : ∀v,a v∈(allocationPMF (recordedList hL v p) (G*M)).support) + (g : Fin G) (v : Fin 3→Fin K) : groupAt g a v⊆recordedList hL v p := by + intro i hi + cases he : a v with + | none => simp [groupAt,he] at hi + | some f => + simp only [groupAt,he,Finset.mem_image,Finset.mem_univ,true_and] at hi + obtain ⟨k,rfl⟩ := hi + exact allocationPMF_support _ _ _ (ha v) f he _ + +lemma groups_disjoint {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (p : BridgeEndpoints N L×(Fin N→Bool)) (a : GridAllocation N K (G*M)) + (ha : ∀v,a v∈(allocationPMF (recordedList hL v p) (G*M)).support) + (g h : Fin G) (hgh : g≠h) : Disjoint (groupUnion g a) (groupUnion h a) := by + apply Finset.disjoint_left.mpr + intro i hig hih + obtain ⟨v,_,hiv⟩ := Finset.mem_biUnion.mp hig + obtain ⟨w,_,hiw⟩ := Finset.mem_biUnion.mp hih + have hv := (Finset.mem_filter.mp (groupAt_mem_list hL p a ha g v hiv)).2.1 + have hw := (Finset.mem_filter.mp (groupAt_mem_list hL p a ha h w hiw)).2.1 + have hvw : v=w := hv.symm.trans hw + rw [←hvw] at hiw + cases he : a v with + | none => simp [groupAt,he] at hiv + | some f => + simp only [groupAt,he,Finset.mem_image,Finset.mem_univ,true_and] at hiv hiw + obtain ⟨k,hk⟩ := hiv + obtain ⟨l,hl⟩ := hiw + exact groupPosition_disjoint M G g h hgh k l (f.injective (hk.trans hl.symm)) + +end HardSphere.Groups + +end +end + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison CellOrbital +attribute [local instance] Classical.propDecidable + +lemma allocation_support_ae {I : Type*} [Fintype I] [DecidableEq I] + (E : Finset I) (m : ℕ) : ∀ᵐa ∂(allocationPMF E m).toMeasure,a∈(allocationPMF E m).support := by + have h := ae_restrict_mem (μ:=(allocationPMF E m).toMeasure) ((allocationPMF E m).support_countable.measurableSet) + rw [PMF.restrict_toMeasure_support] at h + exact h + +lemma gridAllocation_support_ae {N K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (q : ℕ) + (p : BridgeEndpoints N L×(Fin N→Bool)) : + ∀ᵐa ∂gridAllocationKernel hL q p,∀v,a v∈(allocationPMF (recordedList hL v p) q).support := by + rw [gridAllocationKernel_apply] + apply ae_all_iff.mpr + intro v + exact (MeasureTheory.measurePreserving_eval (fun w ↦ (allocationPMF (recordedList hL w p) q).toMeasure) v).quasiMeasurePreserving.tendsto_ae + (allocation_support_ae _ _) + +lemma groups_disjoint_ae {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (p : BridgeEndpoints N L×(Fin N→Bool)) : + ∀ᵐa ∂gridAllocationKernel hL (G*M) p,∀g h : Fin G,g≠h→Disjoint (groupUnion g a) (groupUnion h a) := by + filter_upwards [gridAllocation_support_ae hL (G*M) p] with a ha + exact fun g h hgh ↦ groups_disjoint hL p a ha g h hgh + +lemma pi_failure_sets {V A : Type*} [Fintype V] [DecidableEq V] [MeasurableSpace A] + (μ : V→Measure A) [∀v,IsProbabilityMeasure (μ v)] (E : V→Set A) (S : Finset V) : + (Measure.pi μ) {a | ∀v∈S,a v∈E v}=∏v∈S,μ v (E v) := by + classical + have he : {a : V→A | ∀v∈S,a v∈E v}=Set.pi Set.univ (fun v ↦ if v∈S then E v else Set.univ) := by + ext a + simp only [Set.mem_ofPred_eq,Set.mem_pi,Set.mem_univ,true_implies] + constructor + · intro h v; by_cases hv : v∈S <;> simp [hv,h v] + · intro h v hv; simpa [hv] using h v + rw [he,Measure.pi_pi] + simp only [apply_ite,measure_univ] + exact Fintype.prod_ite_mem S (fun v ↦ μ v (E v)) + +lemma grid_group_law {N K M G : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (p : BridgeEndpoints N L×(Fin N→Bool)) (v : Fin 3→Fin K) (g : Fin G) + (hsize : G*M≤(recordedList hL v p).card) : + (gridAllocationKernel hL (G*M) p).map + (fun a ↦ Option.map (fun f ↦ (groupPosition M G g).trans f) (a v))= + (allocationPMF (recordedList hL v p) M).toMeasure := by + rw [gridAllocationKernel_apply] + have he := (measurePreserving_eval (fun w ↦ (allocationPMF (recordedList hL w p) (G*M)).toMeasure) v).map_eq + change (Measure.pi (fun w ↦ (allocationPMF (recordedList hL w p) (G*M)).toMeasure)).map (fun a ↦ a v) = + (allocationPMF (recordedList hL v p) (G*M)).toMeasure at he + have hf : Measurable (fun a : GridAllocation N K (G*M) ↦ a v) := measurable_pi_apply v + have hg : Measurable (Option.map (fun f : Fin (G*M)↪Fin N ↦ (groupPosition M G g).trans f)) := + measurable_of_countable _ + calc + _ = ((Measure.pi (fun w ↦ (allocationPMF (recordedList hL w p) (G*M)).toMeasure)).map + (fun a : GridAllocation N K (G*M) ↦ a v)).map + (Option.map (fun f : Fin (G*M)↪Fin N ↦ (groupPosition M G g).trans f)) := + (Measure.map_map hg hf).symm + _ = _ := by + rw [he,PMF.toMeasure_map _ _ hg,allocated_group_uniform _ _ _ hsize] + +end HardSphere.Groups + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/GridCorner.lean b/lean/OAI/Analysis/HardSphere/Geometry/GridCorner.lean new file mode 100644 index 0000000000000000000000000000000000000000..6af819c9c024504f41cf2ccb0f703951c0926a9a --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/GridCorner.lean @@ -0,0 +1,198 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.CenteredCircleLift +import OAI.Analysis.HardSphere.Geometry.StarGraph + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators Classical +open scoped BigOperators Classical +namespace HardSphere.BathSlice +open HardSphere.Lattice + +lemma torusDistance_lift_le_two {L : Length} {x y : Point} {b : ℝ} (hb : 0 ≤ b) + (hxy : ∀ i, |x i - y i| ≤ b) : + torusDistance L (liftPoint L x) (liftPoint L y) ≤ 2*b := by + have hcoord (i : Fin 3) : dist ((x i : ℝ) : AddCircle L.val) (y i : AddCircle L.val) ≤ b := by + rw [dist_eq_norm, ← AddCircle.coe_sub] + exact (QuotientAddGroup.norm_mk_le_norm (m := x i-y i)).trans (by simpa only [Real.norm_eq_abs] using hxy i) + unfold torusDistance + apply (Real.sqrt_le_iff).mpr + refine ⟨by positivity, ?_⟩ + calc + _ ≤ ∑ _i : Fin 3, b^2 := Finset.sum_le_sum fun i _ ↦ + sq_le_sq₀ dist_nonneg hb |>.mpr (hcoord i) + _ ≤ (2*b)^2 := by simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul]; norm_num only [Nat.cast_ofNat]; nlinarith [sq_nonneg b] + +def gridCorner (L : Length) (h : ℝ) (z : Vertex) : Torus L := + liftPoint L (fun i ↦ h*(z i : ℝ)-1/2) + +lemma microCube_dist_corner {L : Length} {h d : ℝ} (hh : 0 ≤ h) (hd : 0 ≤ d) + {z w : Vertex} (hw : ∀ i, h * |(w i : ℝ)-z i| ≤ d) + {x : Torus L} (hx : x ∈ microCube L h w) : + torusDistance L x (gridCorner L h z) ≤ 2*(d+h) := by + obtain ⟨u,hu,rfl⟩ := hx + apply torusDistance_lift_le_two (add_nonneg hd hh) + intro i + have hab : |h*((w i : ℝ)-z i)| ≤ d := by + simpa only [abs_mul, abs_of_nonneg hh] using hw i + have hl := hu.1 i + have hr := hu.2 i + change h*(w i : ℝ)-1/2 ≤ u i at hl + change u i ≤ h*((w i : ℝ)+1)-1/2 at hr + obtain ⟨ha,hb⟩ := abs_le.mp hab + apply abs_le.mpr + constructor <;> nlinarith + +lemma microCube_dist_adjacent {L : Length} {h : ℝ} (hh : 0 ≤ h) + {z w : Vertex} (hzw : starStep z w) {x y : Torus L} + (hx : x ∈ microCube L h z) (hy : y ∈ microCube L h w) : + torusDistance L x y ≤ 4*h := by + obtain ⟨u,hu,rfl⟩ := hx + obtain ⟨v,hv,rfl⟩ := hy + have hc := torusDistance_lift_le_two (L := L) (x := u) (y := v) (b := 2*h) (by positivity) + rw [show 4*h = 2*(2*h) by ring] + apply hc + intro i + have he : |(z i : ℝ)-w i| ≤ 1 := by exact_mod_cast hzw.2 i + have hmul := mul_le_mul_of_nonneg_left he hh + have hab : |h*((z i : ℝ)-w i)| ≤ h := by + simpa only [abs_mul, abs_of_nonneg hh, mul_one] using hmul + obtain ⟨ha,hb⟩ := abs_le.mp hab + have huz := hu.1 i + have huz' := hu.2 i + have hvw := hv.1 i + have hvw' := hv.2 i + dsimp [liftedCube] at huz huz' hvw hvw' + apply abs_le.mpr + constructor <;> nlinarith + +lemma adjacent_witnesses_close {n : ℕ} {L : Length} {h r : ℝ} (hh : 0 ≤ h) (hr : h ≤ r) + (Y : Configuration n L) {z w : Vertex} (hzw : starStep z w) {i j : Fin n} + (hi : ∃ x ∈ microCube L h z, torusDistance L x (Y i) ≤ r) + (hj : ∃ y ∈ microCube L h w, torusDistance L y (Y j) ≤ r) : + torusDistance L (Y i) (Y j) ≤ 6*r := by + obtain ⟨x,hx,hxi⟩ := hi + obtain ⟨y,hy,hyj⟩ := hj + have hc := microCube_dist_adjacent hh hzw hx hy + have ht := torusDistance_triangle' L (Y i) x (Y j) + have ht' := torusDistance_triangle' L x y (Y j) + rw [torusDistance_comm L (Y i) x] at ht + linarith + +end HardSphere.BathSlice + +namespace SimpleGraph.Walk +open scoped _root_.SimpleGraph _root_.SimpleGraph.Walk + +lemma label_boundary {α β : Type*} {G : SimpleGraph α} {u v : α} (p : G.Walk u v) + (f : α → β) {a : β} (hu : f u = a) (hv : f v ≠ a) : + ∃ x ∈ p.support, ∃ y ∈ p.support, G.Adj x y ∧ f x = a ∧ f y ≠ a := by + induction p with + | nil => exact (hv hu).elim + | @cons u v w huv p ih => + by_cases he : f v = a + · obtain ⟨x,hx,y,hy,hxy,hfx,hfy⟩ := ih he hv + exact ⟨x,by simp [hx],y,by simp [hy],hxy,hfx,hfy⟩ + · exact ⟨u,by simp,v,by simp [p.start_mem_support],huv,hu,he⟩ + +lemma each_label_has_boundary {α β : Type*} [DecidableEq α] [DecidableEq β] + {G : SimpleGraph α} {u v : α} (p : G.Walk u v) (f : α → β) + (hc : 1 < (p.support.toFinset.image f).card) {a : β} + (ha : a ∈ p.support.toFinset.image f) : + ∃ x ∈ p.support, ∃ y ∈ p.support, G.Adj x y ∧ f x = a ∧ f y ≠ a := by + obtain ⟨x,hx,hxa⟩ := Finset.mem_image.mp ha + obtain ⟨b,hb,c,hc',hbc⟩ := Finset.one_lt_card.mp hc + have hd : ∃ d ∈ p.support.toFinset.image f, d ≠ a := by + by_cases he : b = a + · exact ⟨c,hc',by simpa [he] using Ne.symm hbc⟩ + · exact ⟨b,hb,he⟩ + obtain ⟨d,hd,hda⟩ := hd + obtain ⟨y,hy,hyd⟩ := Finset.mem_image.mp hd + have hx' : x ∈ p.support := List.mem_toFinset.mp hx + have hy' : y ∈ p.support := List.mem_toFinset.mp hy + obtain ⟨q⟩ := p.connected_induce_support.preconnected ⟨x,hx'⟩ ⟨y,hy'⟩ + obtain ⟨s,_,t,_,hst,hsa,hta⟩ := _root_.OAI.SimpleGraph.Walk.label_boundary q + (fun z ↦ f z.val) hxa (by simpa [hyd] using hda) + exact ⟨s.val,s.property,t.val,t.property,hst,hsa,hta⟩ + +end SimpleGraph.Walk + +namespace HardSphere.BathSlice +open HardSphere.Lattice + +theorem first_exit_witnesses {n : ℕ} {L : Length} {J : ℕ} {h r : ℝ} + (hh : 0 < h) (hhr : h ≤ r) (hrh : r ≤ 2*h) (hr : r ≤ 1/4096) + (hperiod : L.val = h * J) (hL : 10 < L.val) + (Y : Configuration n L) {z w : Vertex} + (hz : z ∈ bad h r Y) (hp : withinReach starStep (bad h r Y) z w) + (hw : ∃ i, (1:ℝ)/4 ≤ h * |(w i : ℝ)-z i|) : + ∃ A : Finset (Fin n), + (1:ℝ)/1372 ≤ r * A.card ∧ + (∀ i ∈ A, torusDistance L (Y i) (gridCorner L h z) ≤ 1) ∧ + (∀ i ∈ A, ∃ j ∈ A, j ≠ i ∧ torusDistance L (Y i) (Y j) ≤ 6*r) := by + classical + obtain ⟨v,p,hlocal,ih,hspan⟩ := star_first_exit hh (by norm_num : (0:ℝ)<1/4) hz hp hw + let S := p.support.toFinset + have hS : ∀ x ∈ S, x ∈ bad h r Y := fun x hx ↦ (hlocal x (List.mem_toFinset.mp hx)).1 + obtain ⟨x0,hx0,j0,hj0⟩ := hz + have hex (x : Vertex) : ∃ j : Fin n, x ∈ S → + ∃ u ∈ microCube L h x, torusDistance L u (Y j) ≤ r := by + by_cases hx : x ∈ S + · obtain ⟨u,hu,j,hj⟩ := hS x hx + exact ⟨j,fun _ ↦ ⟨u,hu,hj⟩⟩ + · exact ⟨j0,fun h ↦ (hx h).elim⟩ + choose f hf using hex + let A := S.image f + have hinj : Set.InjOn (torusProjection J) (↑S : Set Vertex) := by + apply (local_projection_injective hh (d := (1:ℝ)/4+h) (z := z) ?_).mono + · intro x hx + exact (hlocal x (List.mem_toFinset.mp hx)).2 + · linarith + have hcount : S.card ≤ 343*A.card := by + apply Finset.card_le_mul_card_image S 343 + intro j _ + apply card_witness_sites_le hh hperiod hrh Y _ (hinj.mono (Finset.filter_subset _ _)) j + intro x hx + obtain ⟨hxS,hfx⟩ := Finset.mem_filter.mp hx + simpa only [hfx] using hf x hxS + have hpSpan : |(v ih : ℝ)-z ih| ≤ (S.card : ℝ)-1 := by + have he := star_path_span p ih + rw [abs_sub_comm] at he + exact_mod_cast he + have hcR : (S.card : ℝ) ≤ 343*(A.card : ℝ) := by exact_mod_cast hcount + have hlarge : (1:ℝ)/1372 ≤ r*A.card := by + have ht := mul_le_mul_of_nonneg_left hpSpan hh.le + have hcount' := mul_le_mul_of_nonneg_left hcR hh.le + have hhr' := mul_le_mul_of_nonneg_right hhr (Nat.cast_nonneg A.card : (0:ℝ)≤A.card) + nlinarith + have htwo : 1 < A.card := by + by_contra hn + have hc : (A.card : ℝ) ≤ 1 := by exact_mod_cast (show A.card ≤ 1 by omega) + have h0 : 0 ≤ r := hh.le.trans hhr + have ht := mul_le_mul_of_nonneg_left hc h0 + nlinarith + refine ⟨A,hlarge,?_,?_⟩ + · intro i hi + obtain ⟨x,hx,hxi⟩ := Finset.mem_image.mp hi + obtain ⟨u,hu,huf⟩ := hf x hx + rw [hxi] at huf + have hd := microCube_dist_corner hh.le (show (0:ℝ)≤1/4+h by positivity) + (hlocal x (List.mem_toFinset.mp hx)).2 hu + have ht := torusDistance_triangle' L (Y i) u (gridCorner L h z) + rw [torusDistance_comm L (Y i) u] at ht + linarith + · intro i hi + obtain ⟨x,hx,y,hy,hxy,hfi,hfj⟩ := _root_.OAI.SimpleGraph.Walk.each_label_has_boundary p f htwo hi + refine ⟨f y,Finset.mem_image.mpr ⟨y,List.mem_toFinset.mpr hy,rfl⟩,hfj,?_⟩ + rw [← hfi] + exact adjacent_witnesses_close hh.le hhr Y hxy (hf x (List.mem_toFinset.mpr hx)) + (hf y (List.mem_toFinset.mpr hy)) + +end HardSphere.BathSlice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/GridNear.lean b/lean/OAI/Analysis/HardSphere/Geometry/GridNear.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe3a728f4977aabf9ed7bb80891776f312d003c2 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/GridNear.lean @@ -0,0 +1,48 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.GridAlignment + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory Set +namespace HardSphere.Groups +open HardSphere.Lattice HardSphere.CellOrbital +attribute [local instance] Classical.propDecidable +lemma grid_near_of_distance {K : ℕ} [NeZero K] (L : Length) (hL : L.val=(K:ℝ)) + (v w : Fin 3→Fin K) (h : torusDistance L (gridCenter L v) (gridCenter L w)≤23) : + torusNear K 24 (gridSite w) (gridSite v) := by + obtain ⟨z,hz,he⟩ := grid_packing_witness L hL (fun j ↦ ((w j).val:ℝ)) v + (fun j ↦ (dist_coord_le_torusDistance L (gridCenter L v) (gridCenter L w) j).trans h) + refine ⟨fun j ↦ z j-(w j).val,?_,?_⟩ + · intro j + obtain ⟨hl,hu⟩ := Finset.mem_Icc.mp hz + have hl' := hl j + have hu' := hu j + simp only [Int.floor_natCast] at hl' hu' + change |z j-(w j).val|≤24 + exact abs_le.mpr ⟨by omega,by omega⟩ + · intro j + have hj := congrFun he j + dsimp [torusProjection,gridSite] at hj ⊢ + push_cast + rw [←hj] + ring +lemma distance_far_of_grid_far {K : ℕ} [NeZero K] (L : Length) (hL : L.val=(K:ℝ)) + {R : ℕ} (hR : 24≤R) (v w : Fin 3→Fin K) + (h : ¬torusNear K R (gridSite v) (gridSite w)) : + 23 try rfl + funext x i + fin_cases i <;> rfl + +lemma configurationFin_preserving_base (n : ℕ) (b : Point) (h : ℝ) : + MeasurePreserving (configurationFin n) + (Measure.pi (fun _ : Fin n ↦ volume.restrict (cube b h))) + (Measure.pi (fun _ : Fin n ↦ Measure.pi (fun q : Fin 3 ↦ (volume : Measure ℝ).restrict (Icc (pointFin b q) (pointFin b q+h))))) := + measurePreserving_pi _ _ (fun _ ↦ pointFin_preserving_base b h) +end HardSphere.SphericalCoordinates + +namespace HardSphere +open SphericalCoordinates +open scoped BigOperators +lemma cubeParameter_preserving_base (n : ℕ) (L : Length) (b : Point) : + MeasurePreserving (cubeParameter n L) + (Measure.pi (fun _ : Fin n ↦ volume.restrict (cube b L.val))) volume := by + have hp := measurePreserving_pi (fun q : Fin 3 ↦ (volume : Measure ℝ).restrict (Icc (pointFin b q) (pointFin b q+L.val))) + (fun _ : Fin 3 ↦ (volume : Measure (AddCircle L.val))) + (f := fun _ x ↦ (x : AddCircle L.val)) (fun q ↦ by + simpa only [restrict_Ioc_eq_restrict_Icc] using AddCircle.measurePreserving_mk L.val (pointFin b q)) + exact (measurePreserving_pi _ _ (fun _ : Fin n ↦ hp)).comp (configurationFin_preserving_base n b L.val) + +noncomputable def gridSectorMeasure (n j : ℕ) (b : Point) (l : ℝ) (σ : Fin n → CubeCell j) : Measure (Fin n → Point) := + Measure.pi (fun i ↦ volume.restrict (cube (subcubeBase b l (σ i)) l)) + +lemma gridSectorMeasure_le {n j : ℕ} {L : Length} {l : ℝ} (hl : 0≤l) (hL : L.val=(j:ℝ)*l) (b : Point) (σ : Fin n → CubeCell j) : + gridSectorMeasure n j b l σ≤Measure.pi (fun _ : Fin n ↦ volume.restrict (cube b L.val)) := by + rw [hL,cube_configuration_subdivision b hl] + exact Measure.le_sum _ σ + +noncomputable def gridSectorRestriction {n j : ℕ} {L : Length} {l : ℝ} (hl : 0≤l) (hL : L.val=(j:ℝ)*l) + (b : Point) (σ : Fin n → CubeCell j) : ScalarL2 n L →L[ℝ] Lp ℂ 2 (gridSectorMeasure n j b l σ) := + (Lp.LpToLpOfMeasureLeSMul (c := (1:ℝ≥0∞)) (by norm_num) + (show gridSectorMeasure n j b l σ≤1 • Measure.pi (fun _ : Fin n ↦ volume.restrict (cube b L.val)) by + simpa only [one_smul] using gridSectorMeasure_le hl hL b σ)).comp + (Lp.compMeasurePreservingₗᵢ ℝ (cubeParameter n L) (cubeParameter_preserving_base n L b)).toContinuousLinearMap + +lemma gridSectorRestriction_ae {n j : ℕ} {L : Length} {l : ℝ} (hl : 0≤l) (hL : L.val=(j:ℝ)*l) + (b : Point) (σ : Fin n → CubeCell j) (u : ScalarL2 n L) : + gridSectorRestriction hl hL b σ u=ᵐ[gridSectorMeasure n j b l σ] fun X ↦ u (cubeParameter n L X) := by + have h₁ := Lp.coeFn_LpToLpOfMeasureLeSMul (c := (1:ℝ≥0∞)) (by norm_num) + (show gridSectorMeasure n j b l σ≤1 • Measure.pi (fun _ : Fin n ↦ volume.restrict (cube b L.val)) by + simpa only [one_smul] using gridSectorMeasure_le hl hL b σ) + ((Lp.compMeasurePreservingₗᵢ ℝ (cubeParameter n L) (cubeParameter_preserving_base n L b)) u) + apply h₁.trans + apply (Measure.absolutelyContinuous_of_le (gridSectorMeasure_le hl hL b σ)).ae_eq + exact Lp.coeFn_compMeasurePreserving u (cubeParameter_preserving_base n L b) + +lemma gridSector_norm {n j : ℕ} {L : Length} {l : ℝ} (hl : 0≤l) (hL : L.val=(j:ℝ)*l) + (b : Point) (σ : Fin n → CubeCell j) (u : ScalarL2 n L) : + ENNReal.ofReal (‖gridSectorRestriction hl hL b σ u‖^2)= + ∫⁻ X,ENNReal.ofReal (‖u (cubeParameter n L X)‖^2) ∂gridSectorMeasure n j b l σ := by + have hn := smooth_norm_lintegral (Lp.memLp (gridSectorRestriction hl hL b σ u)) + rw [Lp.toLp_coeFn] at hn + rw [hn] + apply lintegral_congr_ae + filter_upwards [gridSectorRestriction_ae hl hL b σ u] with X hX + rw [hX] + +lemma SmoothTest.gridSector_norm {n j : ℕ} {L : Length} {a l : ℝ} (f : SmoothTest n L a) + (hl : 0≤l) (hL : L.val=(j:ℝ)*l) (b : Point) (σ : Fin n → CubeCell j) : + ENNReal.ofReal (‖gridSectorRestriction hl hL b σ f.jet.1‖^2)= + ∫⁻ X,ENNReal.ofReal (‖f.toFun (cubeParameter n L X)‖^2) ∂gridSectorMeasure n j b l σ := by + rw [HardSphere.gridSector_norm] + apply lintegral_congr_ae + have h₂ : (fun X ↦ f.jet.1 (cubeParameter n L X))=ᵐ[gridSectorMeasure n j b l σ] + fun X ↦ f.toFun (cubeParameter n L X) := by + apply (Measure.absolutelyContinuous_of_le (gridSectorMeasure_le hl hL b σ)).ae_eq + exact (cubeParameter_preserving_base n L b).quasiMeasurePreserving.ae_eq_comp f.memLp.coeFn_toLp + filter_upwards [h₂] with X hX + rw [hX] + +lemma SmoothTest.cube_gradient_lintegral_base {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest n L a) + (b : Point) (i : Fin n) : + (∫⁻ X, ENNReal.ofReal (particleGradSq (fun X ↦ f.toFun (cubeParameter n L X)) i X) + ∂Measure.pi (fun _ ↦ volume.restrict (cube b L.val)))= + ∑ q : Fin 3, ENNReal.ofReal (‖f.jet.2 (i,q)‖^2) := by + simp_rw [f.cube_gradient,ENNReal.ofReal_sum_of_nonneg (fun _ _ ↦ sq_nonneg _)] + rw [lintegral_finsetSum _ (fun q _ ↦ by + exact (((f.continuous_partial (i,q)).measurable.comp (cubeParameter_preserving_base n L b).measurable).norm.pow_const 2).ennreal_ofReal)] + apply Finset.sum_congr rfl + intro q _ + rw [(cubeParameter_preserving_base n L b).lintegral_comp + (f := fun x ↦ ENNReal.ofReal (‖coordDerivative n L f.toFun (i,q) x‖^2)) + (((f.continuous_partial (i,q)).measurable.norm.pow_const 2).ennreal_ofReal),← smooth_norm_lintegral (f.partial_memLp (i,q))] + rfl +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/HeadLift.lean b/lean/OAI/Analysis/HardSphere/Geometry/HeadLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e6efb147f978b40c1354d75b314e694ad631f68 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/HeadLift.lean @@ -0,0 +1,92 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.SmoothMultiplier +import OAI.Analysis.HardSphere.Geometry.TorusLiftBox + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate + +def headLift (n : ℕ) : LiftedConfiguration (n+1) →L[ℝ] LiftedConfiguration 1 := + .pi fun _ ↦ .proj 0 + +lemma headLift_direction_zero (n : ℕ) (j : Fin 3) : + headLift n (Pi.single 0 (Pi.single j 1))=Pi.single 0 (Pi.single j 1) := by + ext i k + have hi : i=0 := Subsingleton.elim _ _ + subst i + simp [headLift] + +lemma headLift_direction_succ (n : ℕ) (i : Fin n) (j : Fin 3) : + headLift n (Pi.single i.succ (Pi.single j 1))=0 := by + ext k q + simp [headLift] + +def SmoothMultiplier.orbital {L : Length} (w : SmoothMultiplier 1 L) (x : Torus L) : ℂ := + w.toFun (fun _ ↦ x) + +lemma SmoothMultiplier.orbital_continuous {L : Length} (w : SmoothMultiplier 1 L) : + Continuous w.orbital := + (continuous_of_continuous_lift w.smooth.continuous).comp (continuous_pi fun _ ↦ continuous_id) + +def SmoothMultiplier.orbitalBound {L : Length} (w : SmoothMultiplier 1 L) : ℝ := + ‖(⟨w.orbital,w.orbital_continuous⟩ : C(Torus L,ℂ))‖^2 + +lemma SmoothMultiplier.orbital_le_bound {L : Length} (w : SmoothMultiplier 1 L) (x : Torus L) : + ‖w.orbital x‖^2≤w.orbitalBound := by + exact pow_le_pow_left₀ (norm_nonneg _) ((⟨w.orbital,w.orbital_continuous⟩ : C(Torus L,ℂ)).norm_coe_le_norm x) 2 + +def SmoothMultiplier.orbitalEnergy {L : Length} (w : SmoothMultiplier 1 L) : ℝ := + ∑ j : Fin 3, ∫ x : Torus L, ‖coordDerivative 1 L w.toFun (0,j) (fun _ ↦ x)‖^2 + +def SmoothMultiplier.liftHead {L : Length} (w : SmoothMultiplier 1 L) (n : ℕ) : + SmoothMultiplier (n+1) L := + .ofSmooth (fun X ↦ w.orbital (X 0)) (w.smooth.comp (headLift n).contDiff) + +lemma SmoothMultiplier.coordDerivative_liftHead_zero {L : Length} + (w : SmoothMultiplier 1 L) (n : ℕ) (j : Fin 3) : + coordDerivative (n+1) L (w.liftHead n).toFun (0,j)= + fun X ↦ coordDerivative 1 L w.toFun (0,j) (fun _ ↦ X 0) := by + funext X + have h := (w.smooth.differentiable (by simp) + (headLift n (representative (n+1) L X))).hasFDerivAt.comp + (representative (n+1) L X) (headLift n).hasFDerivAt + change (fderiv ℝ ((fun Y : LiftedConfiguration 1 ↦ w.toFun (project 1 L Y)) ∘ headLift n) + (representative (n+1) L X)) (Pi.single 0 (Pi.single j 1))=_ + rw [h.fderiv,ContinuousLinearMap.comp_apply,headLift_direction_zero] + rfl + +lemma SmoothMultiplier.coordDerivative_liftHead_succ {L : Length} + (w : SmoothMultiplier 1 L) (n : ℕ) (i : Fin n) (j : Fin 3) : + coordDerivative (n+1) L (w.liftHead n).toFun (i.succ,j)=0 := by + funext X + have h := (w.smooth.differentiable (by simp) + (headLift n (representative (n+1) L X))).hasFDerivAt.comp + (representative (n+1) L X) (headLift n).hasFDerivAt + change (fderiv ℝ ((fun Y : LiftedConfiguration 1 ↦ w.toFun (project 1 L Y)) ∘ headLift n) + (representative (n+1) L X)) (Pi.single i.succ (Pi.single j 1))=0 + rw [h.fderiv,ContinuousLinearMap.comp_apply,headLift_direction_succ,map_zero] + +lemma SmoothMultiplier.liftHead_gradient_sum {L : Length} + (w : SmoothMultiplier 1 L) (n : ℕ) (X : Configuration (n+1) L) : + (∑ p : Direction (n+1), ‖coordDerivative (n+1) L (w.liftHead n).toFun p X‖^2)= + ∑ j : Fin 3, ‖coordDerivative 1 L w.toFun (0,j) (fun _ ↦ X 0)‖^2 := by + rw [Fintype.sum_prod_type,Fin.sum_univ_succ] + simp only [w.coordDerivative_liftHead_zero,w.coordDerivative_liftHead_succ, + Pi.zero_apply,norm_zero,zero_pow (by decide : 2≠0),Finset.sum_const_zero,add_zero] + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/HeatScalar.lean b/lean/OAI/Analysis/HardSphere/Geometry/HeatScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..31613718f2450c1313bd6ea3a4c8174e295a58f4 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/HeatScalar.lean @@ -0,0 +1,200 @@ +import Mathlib +import OAI.Analysis.HardSphere.FormDomain.HilbertJet + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace HardSphere + +lemma cfc_eigen_apply {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [CompleteSpace E] (T : E →L[ℂ] E) (hT : IsSelfAdjoint T) + (f : ℝ → ℝ) (hf : Continuous f) (r : ℝ) (hd : DifferentiableAt ℝ f r) + (u : E) (hu : T u = r • u) : + cfc (p := IsSelfAdjoint) f T u = f r • u := by + have hg : Continuous (dslope f r) := by + rw [← continuousOn_univ] + exact (continuousOn_dslope (s := Set.univ) (Filter.univ_mem)).mpr ⟨hf.continuousOn,hd⟩ + have heq : (fun x ↦ dslope f r x * (x-r) + f r) = f := by + funext x + have hh := sub_smul_dslope f r x + simp only [smul_eq_mul] at hh + rw [mul_comm,hh,sub_add_cancel] + have hcalc : cfc (p := IsSelfAdjoint) f T = cfc (p := IsSelfAdjoint) (dslope f r) T * (T - algebraMap ℝ (E →L[ℂ] E) r) + + algebraMap ℝ (E →L[ℂ] E) (f r) := by + conv_lhs => rw [← heq] + rw [cfc_add T (fun x ↦ dslope f r x * (x-r)) (fun _ ↦ f r) + (hg.mul (continuous_id.sub continuous_const)).continuousOn continuousOn_const, + cfc_mul (dslope f r) (fun x ↦ x-r) T hg.continuousOn (continuous_id.sub continuous_const).continuousOn, + cfc_sub (fun x ↦ x) (fun _ ↦ r) T continuous_id.continuousOn continuousOn_const, + cfc_id' ℝ T hT,cfc_const r T hT,cfc_const (f r) T hT] + rw [hcalc] + simp only [add_apply,mul_apply_eq_comp, + sub_apply,ContinuousLinearMap.algebraMap_apply,hu,sub_self,map_zero,zero_add] + +def heatScalar (t x : ℝ) : ℝ := Real.exp t * expNegInvGlue (x/t) + +lemma heatScalar_smooth (t : ℝ) : ContDiff ℝ 1 (heatScalar t) := by + unfold heatScalar + exact contDiff_const.mul (expNegInvGlue.contDiff.comp (contDiff_id.div_const t)) + +lemma heatScalar_nonneg (t x : ℝ) : 0 ≤ heatScalar t x := + mul_nonneg (Real.exp_pos t).le (expNegInvGlue.nonneg _) + +lemma heatScalar_zero (t : ℝ) : heatScalar t 0 = 0 := by simp [heatScalar] + +lemma heatScalar_of_pos {t x : ℝ} (ht : 0 < t) (hx : 0 < x) : + heatScalar t x = Real.exp (t - t/x) := by + unfold heatScalar expNegInvGlue + rw [ite_eq_right (not_le.mpr (div_pos hx ht)),← Real.exp_add] + congr 1 + field_simp + ring + +lemma heatScalar_resolvent {t E : ℝ} (ht : 0 < t) (hE : 0 ≤ E) : + heatScalar t (1+E)⁻¹ = Real.exp (-t*E) := by + rw [heatScalar_of_pos ht (inv_pos.mpr (by linarith))] + congr 1 + rw [div_inv_eq_mul] + ring + +lemma heatScalar_add {s t : ℝ} (hs : 0 < s) (ht : 0 < t) (x : ℝ) : + heatScalar (s+t) x = heatScalar s x * heatScalar t x := by + by_cases hx : 0 < x + · rw [heatScalar_of_pos (add_pos hs ht) hx,heatScalar_of_pos hs hx,heatScalar_of_pos ht hx,← Real.exp_add] + congr 1 + ring + · have hx' : x ≤ 0 := le_of_not_gt hx + simp [heatScalar,expNegInvGlue.zero_of_nonpos (div_nonpos_of_nonpos_of_nonneg hx' hs.le), + expNegInvGlue.zero_of_nonpos (div_nonpos_of_nonpos_of_nonneg hx' (add_pos hs ht).le)] + +local instance scalarOperatorRealAlgebra (N : ℕ) (L : Length) : + Algebra ℝ (ScalarL2 N L →L[ℂ] ScalarL2 N L) := Algebra.restrictScalars ℝ ℂ _ + +def formHeat (N : ℕ) (L : Length) (a t : ℝ) : ScalarL2 N L →L[ℂ] ScalarL2 N L := + cfc (p := IsSelfAdjoint) (heatScalar t) (formResolvent N L a) + +lemma formHeat_add (N : ℕ) (L : Length) (a : ℝ) {s t : ℝ} (hs : 0 < s) (ht : 0 < t) : + formHeat N L a (s+t) = formHeat N L a s * formHeat N L a t := by + unfold formHeat + rw [show heatScalar (s+t) = (fun x ↦ heatScalar s x * heatScalar t x) from funext (heatScalar_add hs ht)] + exact cfc_mul _ _ _ (heatScalar_smooth s).continuous.continuousOn (heatScalar_smooth t).continuous.continuousOn + +lemma formHeat_nonneg (N : ℕ) (L : Length) (a t : ℝ) : 0 ≤ formHeat N L a t := by + unfold formHeat + exact cfc_nonneg (fun x _ ↦ heatScalar_nonneg t x) + +lemma IsGroundVector.heat_eigenvector {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : IsGroundVector N L a u) {t : ℝ} (ht : 0 < t) : + formHeat N L a t u.1 = (Real.exp (-t*energy u):ℂ) • u.1 := by + have hE : 0 ≤ energy u := Finset.sum_nonneg fun _ _ ↦ sq_nonneg _ + have hh : formResolvent N L a u.1 = ((1+energy u)⁻¹:ℝ) • u.1 := by + rw [← IsScalarTower.algebraMap_smul ℂ ((1+energy u)⁻¹:ℝ) u.1] + change formResolvent N L a u.1 = (((1+energy u)⁻¹:ℝ):ℂ) • u.1 + simpa only [Complex.ofReal_inv,Complex.ofReal_add,Complex.ofReal_one] using hu.resolvent_eigenvector + rw [formHeat, cfc_eigen_apply _ (formResolvent_isPositive N L a).isSelfAdjoint _ + (heatScalar_smooth t).continuous _ ((heatScalar_smooth t).differentiable (by norm_num)).differentiableAt _ hh, + heatScalar_resolvent ht hE] + exact (IsScalarTower.algebraMap_smul ℂ _ _).symm + +lemma strong_apply_tendsto {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] + (T : ℕ → E →L[ℂ] E) (T₀ : E →L[ℂ] E) (C : ℝ) + (hC : ∀ n, ‖T n‖ ≤ C) (hT : ∀ u, Tendsto (fun n ↦ T n u) atTop (𝓝 (T₀ u))) + (v : ℕ → E) (v₀ : E) (hv : Tendsto v atTop (𝓝 v₀)) : + Tendsto (fun n ↦ T n (v n)) atTop (𝓝 (T₀ v₀)) := by + have hzero : Tendsto (fun n ↦ T n (v n-v₀)) atTop (𝓝 0) := by + apply squeeze_zero_norm (fun n ↦ (T n).le_opNorm _ |>.trans + (mul_le_mul_of_nonneg_right (hC n) (norm_nonneg _))) + simpa using (tendsto_const_nhds.mul ((hv.sub_const v₀).norm)) + have hh := hzero.add (hT v₀) + simpa only [map_sub,sub_add_cancel,zero_add] using hh + +lemma strong_pow_tendsto {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] + (T : ℕ → E →L[ℂ] E) (T₀ : E →L[ℂ] E) + (hC : ∀ n, ‖T n‖ ≤ 1) (hT : ∀ u, Tendsto (fun n ↦ T n u) atTop (𝓝 (T₀ u))) + (k : ℕ) (u : E) : Tendsto (fun n ↦ (T n ^ k) u) atTop (𝓝 ((T₀^k) u)) := by + induction k with + | zero => simp + | succ k ih => + simpa only [pow_succ',mul_apply_eq_comp] using + strong_apply_tendsto T T₀ 1 hC hT (fun n ↦ (T n^k) u) ((T₀^k) u) ih + +lemma strong_polynomial_tendsto {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [CompleteSpace E] (T : ℕ → E →L[ℂ] E) (T₀ : E →L[ℂ] E) + (hC : ∀ n, ‖T n‖ ≤ 1) (hT : ∀ u, Tendsto (fun n ↦ T n u) atTop (𝓝 (T₀ u))) + (q : Polynomial ℝ) (u : E) : + Tendsto (fun n ↦ (Polynomial.aeval (T n) q) u) atTop (𝓝 ((Polynomial.aeval T₀ q) u)) := by + induction q using Polynomial.induction_on' with + | add p q hp hq => simpa only [map_add,add_apply] using hp.add hq + | monomial k a => + simpa only [Polynomial.aeval_monomial,mul_apply_eq_comp,ContinuousLinearMap.algebraMap_apply] using + (strong_pow_tendsto T T₀ hC hT k u).const_smul a + +lemma strong_cfc_tendsto {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] + [CompleteSpace E] (T : ℕ → E →L[ℂ] E) (T₀ : E →L[ℂ] E) + (hC : ∀ n, ‖T n‖ ≤ 1) (hC₀ : ‖T₀‖ ≤ 1) + (hsa : ∀ n, IsSelfAdjoint (T n)) (hsa₀ : IsSelfAdjoint T₀) + (hT : ∀ u, Tendsto (fun n ↦ T n u) atTop (𝓝 (T₀ u))) + (f : ℝ → ℝ) (hf : Continuous f) (u : E) : + Tendsto (fun n ↦ cfc (p := IsSelfAdjoint) f (T n) u) atTop + (𝓝 (cfc (p := IsSelfAdjoint) f T₀ u)) := by + nontriviality E + rw [Metric.tendsto_atTop] + intro ε hε + let δ : ℝ := ε / (3 * (‖u‖+1)) + have hδ : 0 < δ := div_pos hε (by positivity) + obtain ⟨q,hq⟩ := exists_polynomial_near_of_continuousOn (-1) 1 f hf.continuousOn δ hδ + have herr (S : E →L[ℂ] E) (hS : ‖S‖ ≤ 1) (hsaS : IsSelfAdjoint S) : + ‖cfc (p := IsSelfAdjoint) f S - Polynomial.aeval S q‖ ≤ δ := by + rw [← cfc_polynomial q S hsaS,← cfc_sub f q.eval S hf.continuousOn q.continuous.continuousOn] + apply norm_cfc_le hδ.le + intro x hx + have hx' : x ∈ Icc (-1:ℝ) 1 := by + have hh := (spectrum.norm_le_norm_of_mem hx).trans hS + simpa only [Real.norm_eq_abs,abs_le,Set.mem_Icc] using hh + simpa only [Real.norm_eq_abs,abs_sub_comm] using (hq x hx').le + obtain ⟨n₀,hn₀⟩ := Metric.tendsto_atTop.mp (strong_polynomial_tendsto T T₀ hC hT q u) + (ε/3) (by positivity) + refine ⟨n₀,fun n hn ↦ ?_⟩ + have hn' := hn₀ n hn + have he₁ : ‖cfc (p := IsSelfAdjoint) f (T n) u - (Polynomial.aeval (T n) q) u‖ ≤ δ * ‖u‖ := by + change ‖(cfc (p := IsSelfAdjoint) f (T n) - Polynomial.aeval (T n) q) u‖ ≤ _ + exact (ContinuousLinearMap.le_opNorm _ _).trans + (mul_le_mul_of_nonneg_right (herr (T n) (hC n) (hsa n)) (norm_nonneg u)) + have he₂ : ‖(Polynomial.aeval T₀ q) u - cfc (p := IsSelfAdjoint) f T₀ u‖ ≤ δ * ‖u‖ := by + rw [norm_sub_rev] + change ‖(cfc (p := IsSelfAdjoint) f T₀ - Polynomial.aeval T₀ q) u‖ ≤ _ + exact (ContinuousLinearMap.le_opNorm _ _).trans + (mul_le_mul_of_nonneg_right (herr T₀ hC₀ hsa₀) (norm_nonneg u)) + have hδn : δ * ‖u‖ < ε/3 := by + have hden : 0 < 3 * (‖u‖+1) := by positivity + dsimp [δ] + rw [div_mul_eq_mul_div,div_lt_div_iff₀ hden (by norm_num : (0:ℝ)<3)] + nlinarith [norm_nonneg u] + rw [dist_eq_norm] at hn' ⊢ + have hh := dist_triangle (cfc (p := IsSelfAdjoint) f (T n) u) + ((Polynomial.aeval (T n) q) u) (cfc (p := IsSelfAdjoint) f T₀ u) + have hh' := dist_triangle ((Polynomial.aeval (T n) q) u) + ((Polynomial.aeval T₀ q) u) (cfc (p := IsSelfAdjoint) f T₀ u) + simp only [dist_eq_norm] at hh hh' + linarith + +lemma formHeat_innerRadius_tendsto (N : ℕ) (L : Length) (a t : ℝ) (f : ScalarL2 N L) : + Tendsto (fun n ↦ formHeat N L (innerRadius a n) t f) atTop (𝓝 (formHeat N L a t f)) := by + exact strong_cfc_tendsto (fun n ↦ formResolvent N L (innerRadius a n)) + (formResolvent N L a) (fun n ↦ formResolvent_norm_le_one N L _) + (formResolvent_norm_le_one N L a) (fun n ↦ (formResolvent_isPositive N L _).isSelfAdjoint) + (formResolvent_isPositive N L a).isSelfAdjoint (formResolvent_innerRadius_tendsto N L a) + (heatScalar t) (heatScalar_smooth t).continuous f + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/InjectiveNear.lean b/lean/OAI/Analysis/HardSphere/Geometry/InjectiveNear.lean new file mode 100644 index 0000000000000000000000000000000000000000..a916869e7cf16c980091a0528c31757c2feab1ad --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/InjectiveNear.lean @@ -0,0 +1,210 @@ +import Mathlib +import OAI.Analysis.HardSphere.Comparison.FiniteFiberSum + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter + +lemma exists_injective_near {ι E : Type*} [Fintype ι] [DecidableEq ι] + [MetricSpace E] [PerfectSpace E] (X : ι→E) {ε : ℝ} (hε : 0<ε) : + ∃ Y : ι→E, Function.Injective Y ∧ ∀ i, dist (Y i) (X i)<ε := by + classical + have aux (I : Finset ι) : ∃ Y : ι→E, Set.InjOn Y I ∧ ∀ i∈I, dist (Y i) (X i)<ε := by + induction I using Finset.induction_on with + | empty => exact ⟨X,by simp [Set.InjOn],by simp⟩ + | @insert a I ha ih => + obtain ⟨Y,hinj,hclose⟩ := ih + have hd := dense_univ.sdiff_finset (I.image Y) + obtain ⟨y,hy,hball⟩ := hd.exists_mem_open Metric.isOpen_ball (Metric.nonempty_ball.mpr hε) + refine ⟨Function.update Y a y,?_,?_⟩ + · intro i hi j hj he + rcases Finset.mem_insert.mp hi with hi | hi + · subst i + rcases Finset.mem_insert.mp hj with hj | hj + · exact hj.symm + · have hja : j≠a := fun h ↦ ha (h ▸ hj) + rw [Function.update_self,Function.update_of_ne hja] at he + exact (hy.2 (by rw [he]; exact Finset.mem_image.mpr ⟨j,hj,rfl⟩)).elim + · rcases Finset.mem_insert.mp hj with hj | hj + · subst j + have hia : i≠a := fun h ↦ ha (h ▸ hi) + rw [Function.update_self,Function.update_of_ne hia] at he + exact (hy.2 (Finset.mem_image.mpr ⟨i,hi,he⟩)).elim + · have hia : i≠a := fun h ↦ ha (h ▸ hi) + have hja : j≠a := fun h ↦ ha (h ▸ hj) + rw [Function.update_of_ne hia,Function.update_of_ne hja] at he + exact hinj hi hj he + · intro i hi + rcases Finset.mem_insert.mp hi with rfl | hi + · simpa using hball + · rw [Function.update_of_ne (show i≠a from fun h ↦ ha (h ▸ hi))] + exact hclose i hi + obtain ⟨Y,hi,hc⟩ := aux Finset.univ + exact ⟨Y,fun i j h ↦ hi (Finset.mem_univ _) (Finset.mem_univ _) h,fun i ↦ hc i (Finset.mem_univ _)⟩ + +lemma dense_injective_configurations {ι E : Type*} [Fintype ι] [DecidableEq ι] + [MetricSpace E] [PerfectSpace E] : Dense {X : ι→E | Function.Injective X} := by + apply Metric.dense_iff.mpr + intro X ε hε + obtain ⟨Y,hY,hclose⟩ := exists_injective_near X hε + refine ⟨Y,?_,hY⟩ + exact (dist_pi_lt_iff hε).mpr hclose + +lemma torus_nontrivial (L : Length) : Nontrivial (Torus L) := by + let hc : Nontrivial (AddCircle L.val) := by + refine ⟨⟨((L.val/2:ℝ):AddCircle L.val),0,?_⟩⟩ + intro he + have hh := AddCircle.norm_half_period_eq L.val + rw [he,norm_zero,abs_of_pos L.property] at hh + linarith only [L.property,hh] + let := hc + infer_instance + +lemma torusDistance_continuous_pair (L : Length) : + Continuous (fun p : Torus L×Torus L ↦ torusDistance L p.1 p.2) := by + unfold torusDistance + fun_prop + +attribute [local irreducible] torusDistance nearestParticleDistance + +lemma nearestDifference_continuous {ι : Type*} [Fintype ι] [DecidableEq ι] [Nontrivial ι] + (L : Length) : Continuous (fun p : (ι→Torus L)×(ι→Torus L) ↦ + ∑ i, (nearestParticleDistance L p.2 i-nearestParticleDistance L p.1 i)^2) := by + apply continuous_finsetSum + intro i _ + exact (((nearestParticleDistance_continuous L i).comp continuous_snd).sub + ((nearestParticleDistance_continuous L i).comp continuous_fst)).pow 2 + +lemma torusMotion_continuous {ι : Type*} [Fintype ι] (L : Length) : + Continuous (fun p : (ι→Torus L)×(ι→Torus L) ↦ 502*∑ i, torusDistance L (p.1 i) (p.2 i)^2) := by + apply continuous_const.mul + apply continuous_finsetSum + intro i _ + apply Continuous.pow + exact (torusDistance_continuous_pair L).comp + (f := fun p : (ι→Torus L)×(ι→Torus L) ↦ (p.1 i,p.2 i)) + (((continuous_apply i).comp continuous_fst).prodMk ((continuous_apply i).comp continuous_snd)) + +theorem nearestParticleDistance_sum_sq_all {ι : Type*} [Fintype ι] [DecidableEq ι] [Nontrivial ι] + (L : Length) (X Y : ι→Torus L) : + (∑ i, (nearestParticleDistance L Y i-nearestParticleDistance L X i)^2)≤ + 502*∑ i, torusDistance L (X i) (Y i)^2 := by + let := torus_nontrivial L + let S : Set (ι→Torus L) := {X | Function.Injective X} + have hd : Dense (S×ˢS) := dense_injective_configurations.prod dense_injective_configurations + have hc : IsClosed {p : (ι→Torus L)×(ι→Torus L) | + (∑ i, (nearestParticleDistance L p.2 i-nearestParticleDistance L p.1 i)^2)≤ + 502*∑ i, torusDistance L (p.1 i) (p.2 i)^2} := + isClosed_le (nearestDifference_continuous L) (torusMotion_continuous L) + exact closure_minimal (fun p hp ↦ nearestParticleDistance_sum_sq L p.1 p.2 hp.1 hp.2) hc (hd (X,Y)) + +end HardSphere + +namespace HardSphere +open MeasureTheory Set Filter + +def closeRamp (t : ℝ) : ℝ := max 0 (min 1 t) + +lemma closeRamp_nonneg (t : ℝ) : 0≤closeRamp t := le_max_left _ _ +lemma closeRamp_le_one (t : ℝ) : closeRamp t≤1 := max_le zero_le_one (min_le_left _ _) +lemma closeRamp_one {t : ℝ} (ht : 1≤t) : closeRamp t=1 := by simp [closeRamp,min_eq_left ht] +lemma closeRamp_zero {t : ℝ} (ht : t≤0) : closeRamp t=0 := by + exact max_eq_left ((min_le_right 1 t).trans ht) +lemma closeRamp_lipschitz : LipschitzWith 1 closeRamp := + (LipschitzWith.id.const_min 1).const_max 0 + +lemma closeRamp_sub_le (x y : ℝ) : |closeRamp x-closeRamp y|≤|x-y| := by + simpa only [Real.dist_eq,NNReal.coe_one,one_mul] using closeRamp_lipschitz.dist_le_mul x y + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nontrivial ι] + +def closeAmplitude (L : Length) (s : ℝ) (v : Torus L) (X : ι→Torus L) (i : ι) : ℝ := + closeRamp (6-torusDistance L (X i) v)*closeRamp (2-nearestParticleDistance L X i/s) + +def localCloseRoot (L : Length) (s : ℝ) (v : Torus L) (X : ι→Torus L) : ℝ := + ‖(WithLp.toLp 2 (closeAmplitude L s v X) : EuclideanSpace ℝ ι)‖ + +def localCloseSmoothCount (L : Length) (s : ℝ) (v : Torus L) (X : ι→Torus L) : ℝ := + ∑ i, closeAmplitude L s v X i^2 + +lemma localCloseRoot_sq (L : Length) (s : ℝ) (v : Torus L) (X : ι→Torus L) : + localCloseRoot L s v X^2=localCloseSmoothCount L s v X := + EuclideanSpace.real_norm_sq_eq _ + +lemma closeAmplitude_nonneg (L : Length) (s : ℝ) (v : Torus L) (X : ι→Torus L) (i : ι) : + 0≤closeAmplitude L s v X i := mul_nonneg (closeRamp_nonneg _) (closeRamp_nonneg _) +lemma closeAmplitude_le_one (L : Length) (s : ℝ) (v : Torus L) (X : ι→Torus L) (i : ι) : + closeAmplitude L s v X i≤1 := + (mul_le_of_le_one_left (closeRamp_nonneg _) (closeRamp_le_one _)).trans + (closeRamp_le_one _) + +lemma closeAmplitude_one (L : Length) {s : ℝ} (hs : 0 simpa only [joinConfiguration,Fin.addCases_left,Function.comp_def] using + ((continuous_apply i).comp continuous_fst) + | right i => simpa only [joinConfiguration,Fin.addCases_right,Function.comp_def] using + ((continuous_apply i).comp continuous_snd) + +lemma splitConfiguration_continuous (m n : ℕ) (L : Length) : + Continuous (splitConfiguration m n L) := by unfold splitConfiguration; fun_prop + +@[simp] lemma split_joinConfiguration (m n : ℕ) (L : Length) + (p : Configuration m L × Configuration n L) : + splitConfiguration m n L (joinConfiguration m n L p)=p := by + ext <;> simp [splitConfiguration,joinConfiguration] + +@[simp] lemma join_splitConfiguration (m n : ℕ) (L : Length) (X : Configuration (m+n) L) : + joinConfiguration m n L (splitConfiguration m n L X)=X := by + ext i j + induction i using Fin.addCases <;> simp [splitConfiguration,joinConfiguration] + +lemma joinConfiguration_preserving (m n : ℕ) (L : Length) : + MeasurePreserving (joinConfiguration m n L) + ((volume : Measure (Configuration m L)).prod volume) volume := by + have h := (volume_measurePreserving_piCongrLeft (fun _ : Fin (m+n) ↦ Torus L) + (finSumFinEquiv (m:=m) (n:=n))).comp + (volume_measurePreserving_sumPiEquivProdPi_symm (fun _ : Fin m ⊕ Fin n ↦ Torus L)) + convert h using 1 + try rfl + funext p i + induction i using Fin.addCases <;> simp [joinConfiguration,MeasurableEquiv.coe_piCongrLeft, + MeasurableEquiv.coe_sumPiEquivProdPi_symm,Equiv.piCongrLeft_apply,Equiv.sumPiEquivProdPi_symm_apply] + +lemma splitConfiguration_preserving (m n : ℕ) (L : Length) : + MeasurePreserving (splitConfiguration m n L) volume + ((volume : Measure (Configuration m L)).prod volume) := by + refine ⟨(splitConfiguration_continuous m n L).measurable,?_⟩ + rw [← (joinConfiguration_preserving m n L).map_eq, + Measure.map_map (splitConfiguration_continuous m n L).measurable + (joinConfiguration_continuous m n L).measurable] + simp only [Function.comp_def,split_joinConfiguration,Measure.map_id'] + +def joinConfigurationPath (m n : ℕ) (L : Length) + (p : ConfigurationPath m L × ConfigurationPath n L) : ConfigurationPath (m+n) L := + ⟨fun t ↦ joinConfiguration m n L (p.1 t,p.2 t), + (joinConfiguration_continuous m n L).comp (p.1.continuous.prodMk p.2.continuous)⟩ + +def splitConfigurationPath (m n : ℕ) (L : Length) (ω : ConfigurationPath (m+n) L) : + ConfigurationPath m L × ConfigurationPath n L := + (⟨fun t i ↦ ω t (Fin.castAdd n i),by fun_prop⟩, + ⟨fun t i ↦ ω t (Fin.natAdd m i),by fun_prop⟩) + +lemma joinConfigurationPath_continuous (m n : ℕ) (L : Length) : + Continuous (joinConfigurationPath m n L) := by + apply ContinuousMap.continuous_of_continuous_uncurry + exact (joinConfiguration_continuous m n L).comp + ((continuous_fst.fst.eval continuous_snd).prodMk + (continuous_fst.snd.eval continuous_snd)) + +lemma splitConfigurationPath_continuous (m n : ℕ) (L : Length) : + Continuous (splitConfigurationPath m n L) := by + apply Continuous.prodMk + all_goals + apply ContinuousMap.continuous_of_continuous_uncurry + apply continuous_pi + intro i + change Continuous (fun p : ConfigurationPath (m+n) L × Time ↦ p.1 p.2 _) + exact (continuous_apply _).comp (continuous_fst.eval continuous_snd) + +@[simp] lemma split_joinConfigurationPath (m n : ℕ) (L : Length) + (p : ConfigurationPath m L × ConfigurationPath n L) : + splitConfigurationPath m n L (joinConfigurationPath m n L p)=p := by + ext <;> simp [splitConfigurationPath,joinConfigurationPath,joinConfiguration] + +@[simp] lemma join_splitConfigurationPath (m n : ℕ) (L : Length) + (ω : ConfigurationPath (m+n) L) : + joinConfigurationPath m n L (splitConfigurationPath m n L ω)=ω := by + apply ContinuousMap.ext + intro t + exact join_splitConfiguration m n L (ω t) + +lemma measurePreserving_shuffle {A B C D : Type*} [MeasurableSpace A] [MeasurableSpace B] + [MeasurableSpace C] [MeasurableSpace D] (μ : Measure A) (ν : Measure B) + (ξ : Measure C) (ζ : Measure D) [SFinite μ] [SFinite ν] [SFinite ξ] [SFinite ζ] : + MeasurePreserving (fun p : (A×B)×(C×D) ↦ ((p.1.1,p.2.1),(p.1.2,p.2.2))) + ((μ.prod ν).prod (ξ.prod ζ)) ((μ.prod ξ).prod (ν.prod ζ)) := by + have h1 := measurePreserving_prodAssoc μ ν (ξ.prod ζ) + have h2 := (MeasurePreserving.id μ).prod (measurePreserving_prodAssoc ν ξ ζ).symm + have h3 := (MeasurePreserving.id μ).prod + ((Measure.measurePreserving_swap (μ:=ν) (ν:=ξ)).prod (MeasurePreserving.id ζ)) + have h4 := (MeasurePreserving.id μ).prod (measurePreserving_prodAssoc ξ ν ζ) + have h5 := (measurePreserving_prodAssoc μ ξ (ν.prod ζ)).symm + exact h5.comp (h4.comp (h3.comp (h2.comp h1))) + +def directionSumEquiv (m n : ℕ) : Direction m ⊕ Direction n ≃ Direction (m+n) := + (Equiv.sumProdDistrib (Fin m) (Fin n) (Fin 3)).symm.trans + ((finSumFinEquiv (m:=m) (n:=n)).prodCongr (Equiv.refl (Fin 3))) + +def joinCoordinatePaths (m n : ℕ) (p : CoordinatePaths m × CoordinatePaths n) : CoordinatePaths (m+n) := + fun d ↦ Sum.elim p.1 p.2 ((directionSumEquiv m n).symm d) + +lemma joinCoordinatePaths_preserving (m n : ℕ) : + MeasurePreserving (joinCoordinatePaths m n) + ((coordinateWiener m).prod (coordinateWiener n)) (coordinateWiener (m+n)) := by + convert (measurePreserving_piCongrLeft (fun _ : Direction (m+n) ↦ wiener) + (directionSumEquiv m n)).comp + (measurePreserving_sumPiEquivProdPi_symm (fun _ : Direction m ⊕ Direction n ↦ wiener)) using 1 <;> try rfl + funext p d + simp [joinCoordinatePaths,MeasurableEquiv.coe_piCongrLeft, + MeasurableEquiv.coe_sumPiEquivProdPi_symm,Equiv.piCongrLeft_apply,Equiv.sumPiEquivProdPi_symm_apply] + cases (directionSumEquiv m n).symm d <;> rfl + +lemma freeTrajectory_join (m n : ℕ) (L : Length) (t : ℝ) + (w : CoordinatePaths m × CoordinatePaths n) (X : Configuration m L × Configuration n L) : + freeTrajectory (m+n) L t (joinCoordinatePaths m n w) (joinConfiguration m n L X)= + joinConfigurationPath m n L (freeTrajectory m L t w.1 X.1,freeTrajectory n L t w.2 X.2) := by + ext s i j + induction i using Fin.addCases <;> + simp [freeTrajectory,joinConfigurationPath,joinConfiguration,joinCoordinatePaths,directionSumEquiv] + +lemma joinConfigurationPath_preserving (m n : ℕ) (L : Length) (t : ℝ) : + MeasurePreserving (joinConfigurationPath m n L) + ((freePathLaw m L t).prod (freePathLaw n L t)) (freePathLaw (m+n) L t) := by + refine ⟨(joinConfigurationPath_continuous m n L).measurable,?_⟩ + have hj := ((joinCoordinatePaths_preserving m n).prod (joinConfiguration_preserving m n L)).comp + (measurePreserving_shuffle (coordinateWiener m) (volume : Measure (Configuration m L)) + (coordinateWiener n) (volume : Measure (Configuration n L))) + simp only [freePathLaw,Measure.map_prod_map _ _ (freeTrajectory_continuous m L t).measurable + (freeTrajectory_continuous n L t).measurable] + rw [Measure.map_map (joinConfigurationPath_continuous m n L).measurable + ((freeTrajectory_continuous m L t).measurable.prodMap (freeTrajectory_continuous n L t).measurable)] + rw [← hj.map_eq,Measure.map_map (freeTrajectory_continuous (m+n) L t).measurable hj.measurable] + congr 1 + funext p + exact (freeTrajectory_join m n L t (p.1.1,p.2.1) (p.1.2,p.2.2)).symm + +lemma splitConfigurationPath_preserving (m n : ℕ) (L : Length) (t : ℝ) : + MeasurePreserving (splitConfigurationPath m n L) (freePathLaw (m+n) L t) + ((freePathLaw m L t).prod (freePathLaw n L t)) := by + refine ⟨(splitConfigurationPath_continuous m n L).measurable,?_⟩ + rw [← (joinConfigurationPath_preserving m n L t).map_eq, + Measure.map_map (splitConfigurationPath_continuous m n L).measurable + (joinConfigurationPath_continuous m n L).measurable] + simp only [Function.comp_def,split_joinConfigurationPath,Measure.map_id'] + +lemma staysAllowed_join_subset_bath (m n : ℕ) (L : Length) (a : ℝ) : + joinConfigurationPath m n L ⁻¹' staysAllowed (m+n) L a ⊆ + Prod.snd ⁻¹' staysAllowed n L a := by + rintro ⟨ω,η⟩ h x ⟨s,rfl⟩ i j hij + have hh := h ⟨s,rfl⟩ (Fin.natAdd m i) (Fin.natAdd m j) (by simpa using hij) + simpa [joinConfigurationPath,joinConfiguration] using hh +end +end HardSphere + +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/KilledAverage.lean b/lean/OAI/Analysis/HardSphere/Geometry/KilledAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..f71e13bac5a9b81f7f1342f16b4e73eed50194d6 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/KilledAverage.lean @@ -0,0 +1,77 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.NormSqLpIntegral +import OAI.Analysis.HardSphere.Orbitals.StrongContractionLimitDense +import OAI.Analysis.HardSphere.Bridges.WienerStart + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace HardSphere +open Wiener + +lemma killedAverage_zero (N : ℕ) (L : Length) (a : ℝ) + (g : Configuration N L → ℂ) (X : Configuration N L) : + killedAverage N L a 0 g X=(allowed N L a).indicator g X := by + have h : ∀ w : CoordinatePaths N, + killedObservable N L a g (freeTrajectory N L 0 w X)=(allowed N L a).indicator g X := by + intro w + rw [freeTrajectory_zero] + by_cases hX : X∈allowed N L a + · have ha : ContinuousMap.const Time X∈staysAllowed N L a := by + rintro _ ⟨t,rfl⟩ + exact hX + simp only [killedObservable,Set.indicator_of_mem ha,ContinuousMap.const_apply, + Set.indicator_of_mem hX] + · have ha : ContinuousMap.const Time X∉staysAllowed N L a := + fun h ↦ hX (h (Set.mem_range_self (0:Time))) + simp only [killedObservable,Set.indicator_of_notMem ha,Set.indicator_of_notMem hX] + simp only [killedAverage,h,integral_const,measureReal_def,measure_univ,ENNReal.toReal_one,one_smul] + +lemma killedTransition_tendsto_zero_continuous (N : ℕ) (L : Length) (a : ℝ) + (g : C(Configuration N L,ℂ)) : + Tendsto (fun t : ℝ ↦ killedTransition N L a t (ContinuousMap.toLp 2 volume ℂ g)) + (𝓝 0) (𝓝 (killedTransition N L a 0 (ContinuousMap.toLp 2 volume ℂ g))) := by + have hgLp : MemLp (fun X ↦ g X) 2 (volume : Measure (Configuration N L)) := + MemLp.of_bound g.continuous.measurable.aestronglyMeasurable ‖g‖ + (Eventually.of_forall g.norm_coe_le_norm) + have hge : ContinuousMap.toLp 2 volume ℂ g = hgLp.toLp g := by + apply Lp.ext + exact (ContinuousMap.coeFn_toLp (𝕜 := ℂ) (p := 2) volume g).trans hgLp.coeFn_toLp.symm + have hEq : ∀ t, killedTransition N L a t (ContinuousMap.toLp 2 volume ℂ g)= + (killedAverage_memLp N L a t g.continuous.measurable (norm_nonneg g) + g.norm_coe_le_norm).toLp (killedAverage N L a t g) := by + intro t + rw [hge] + exact killedTransition_bounded N L a t g.continuous.measurable + hgLp (norm_nonneg g) g.norm_coe_le_norm + simp_rw [hEq] + apply bounded_toLp_tendsto _ _ (norm_nonneg g) + (fun t X ↦ killedAverage_bound N L a t (norm_nonneg g) g.norm_coe_le_norm X) + (fun X ↦ killedAverage_bound N L a 0 (norm_nonneg g) g.norm_coe_le_norm X) + apply Eventually.of_forall + intro X + rw [killedAverage_zero] + exact killedAverage_tendsto_zero N L a g X + +lemma killedTransition_tendsto_zero (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) : + Tendsto (fun t : ℝ ↦ killedTransition N L a t f) (𝓝 0) + (𝓝 (killedTransition N L a 0 f)) := by + exact strong_contraction_limit_of_dense (fun t ↦ killedTransition N L a t) + (killedTransition N L a 0) (fun t ↦ killedTransition_apply_contraction N L a t) + (killedTransition_apply_contraction N L a 0) + (fun g : C(Configuration N L,ℂ) ↦ ContinuousMap.toLp 2 volume ℂ g) + (ContinuousMap.toLp_denseRange ℂ volume ℂ (by norm_num : (2:ℝ≥0∞)≠∞)) + (killedTransition_tendsto_zero_continuous N L a) f + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/KilledEigenvector.lean b/lean/OAI/Analysis/HardSphere/Geometry/KilledEigenvector.lean new file mode 100644 index 0000000000000000000000000000000000000000..7632011822a9636266dc881091a3f87bd5fe746f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/KilledEigenvector.lean @@ -0,0 +1,193 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.PositiveTimeSeqTendsto +import OAI.Analysis.HardSphere.Operators.SemigroupLaplaceDerivWithin + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +noncomputable section +open scoped BigOperators ComplexConjugate +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +noncomputable section +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open MeasureTheory Set Filter ContinuousLinearMap +open scoped Topology + +lemma IsGroundVector.killed_eigenvector {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : IsGroundVector N L a u) {t : ℝ} (ht : 0 ≤ t) : + killedTransition N L a t u.1=(Real.exp (-t*energy u):ℂ) • u.1 := by + have hE : 0 ≤ energy u := Finset.sum_nonneg fun _ _ ↦ sq_nonneg _ + have he : semigroupLaplace (killedTransition N L a) u.1=((1+energy u)⁻¹:ℝ) • u.1 := by + change killedLaplace N L a u.1=_ + rw [killedLaplace_eq_formResolvent] + rw [← IsScalarTower.algebraMap_smul ℂ ((1+energy u)⁻¹:ℝ) u.1] + change formResolvent N L a u.1=(((1+energy u)⁻¹:ℝ):ℂ) • u.1 + simpa only [Complex.ofReal_inv,Complex.ofReal_add,Complex.ofReal_one] using hu.resolvent_eigenvector + have hh := semigroupLaplace_eigenvector (killedTransition N L a) + (killedTransition_add_nonneg N L a) (killedTransition_clamped_continuous N L a) + (fun t _ ↦ killedTransition_apply_contraction N L a t) u.1 (by positivity) he ht + simp only [inv_inv] at hh + rw [show (1-(1+energy u))*t= -t*energy u by ring] at hh + exact hh.trans (IsScalarTower.algebraMap_smul ℂ _ _).symm + +end HardSphere + +namespace HardSphere +open Filter Set ContinuousLinearMap +open scoped Topology +variable {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℂ F] [CompleteSpace F] [Nontrivial F] +local instance : Algebra ℝ (F →L[ℂ] F) := Algebra.restrictScalars ℝ ℂ _ + +def regularHeat (R : F →L[ℂ] F) (t : ℝ) : F →L[ℂ] F := + if 0] 0) (𝓝 v)) : + HasDerivWithinAt f v (Ici a) a := by + rw [hasDerivWithinAt_iff_tendsto_slope,Ici_sdiff_left] + have hs : Tendsto (fun s : ℝ ↦ s-a) (𝓝[>] a) (𝓝[>] 0) := by + apply tendsto_nhdsWithin_iff.mpr + constructor + · have hc : ContinuousAt (fun s : ℝ ↦ s-a) a := by fun_prop + have hh : Tendsto (fun s : ℝ ↦ s-a) (𝓝 a) (𝓝 (a-a)) := hc.tendsto + rw [sub_self] at hh + exact hh.mono_left nhdsWithin_le_nhds + · filter_upwards [self_mem_nhdsWithin] with s hs + exact sub_pos.mpr (show a] a) (𝓝 v) + simpa only [Function.comp_def,add_sub_cancel] using h.comp hs + +lemma regularHeat_range_generator_tendsto {R : F →L[ℂ] F} (hRp : R.IsPositive) (hRn : ‖R‖≤1) + (f : F) : Tendsto (fun h : ℝ ↦ generatorOperator R h (R f)) (𝓝[>] 0) (𝓝 ((1-R) (R f))) := by + rw [← tendsto_sub_nhds_zero_iff,tendsto_zero_iff_norm_tendsto_zero] + apply squeeze_zero' (g := fun h : ℝ ↦ h*‖f‖) (Eventually.of_forall (fun _ ↦ norm_nonneg _)) ?_ ?_ + · filter_upwards [self_mem_nhdsWithin] with h hh + change ‖((generatorOperator R h-(1-R))*R) f‖≤_ + exact (le_opNorm _ _).trans (mul_le_mul_of_nonneg_right + (generatorOperator_range_error hRp hRn hh) (norm_nonneg f)) + · simpa only [id_eq,zero_mul] using ((tendsto_id : Tendsto (fun h : ℝ ↦ h) (𝓝 0) (𝓝 0)).mono_left nhdsWithin_le_nhds).mul_const ‖f‖ + +lemma regularHeat_range_hasDerivWithinAt {R : F →L[ℂ] F} (hRp : R.IsPositive) (hRn : ‖R‖≤1) + (f : F) {t : ℝ} (ht : 0 ≤ t) : + HasDerivWithinAt (fun s : ℝ ↦ regularHeat R s (R (R f))) + (regularHeat R t (R (R f)-R f)) (Ici t) t := by + have hg := ((regularHeat_range_generator_tendsto hRp hRn f).neg) + simp only [sub_apply,one_apply_eq_self,neg_sub] at hg + have hh := (regularHeat R t).continuous.tendsto (R (R f)-R f) |>.comp hg + apply hasDerivWithinAt_Ici_of_slope_right + apply hh.congr' + filter_upwards [self_mem_nhdsWithin] with h hh0 + change 0.comp (continuous_fst.prodMk continuous_const)).prodMk + (freeTrajectory_continuous N L t |>.comp (continuous_snd.prodMk + ((freeTrajectory_continuous N L s |>.comp (continuous_fst.prodMk continuous_const)).eval continuous_const)))).measurable + +lemma split_fixedTrajectory (N : ℕ) (L : Length) (s t : ℝ) (hs : 0 dsimp [Point,liftedCube] at * <;> nlinarith + +lemma coarseCenter_eq_of_projection {L : Length} {K : ℕ} + (hLK : L.val=(K:ℝ)) {w z : Vertex} + (he : torusProjection K w = torusProjection K z) : + coarseCenter L w = coarseCenter L z := by + ext j + change (((w j : ℝ)+1/2 : ℝ) : AddCircle L.val) = + (((z j : ℝ)+1/2 : ℝ) : AddCircle L.val) + obtain ⟨k,hk⟩ := (ZMod.intCast_eq_intCast_iff_dvd_sub (w j) (z j) K).mp (congrFun he j) + have hkr : (z j : ℝ)-(w j : ℝ)=(K:ℝ)*(k:ℝ) := by exact_mod_cast hk + have hr : (z j : ℝ)+1/2=((w j : ℝ)+1/2)+(k:ℝ)*L.val := by + rw [hLK]; linarith + rw [hr] + have hz : (((k:ℝ)*L.val:ℝ) : AddCircle L.val)=0 := by + rw [←zsmul_eq_mul,AddCircle.coe_zsmul,AddCircle.coe_period,smul_zero] + simp only [AddCircle.coe_add,hz,add_zero] + +lemma rootBox_eq_of_projection {L : Length} {K : ℕ} + (hLK : L.val=(K:ℝ)) {w z : Vertex} + (he : torusProjection K w = torusProjection K z) (R : ℝ) : + rootBox L w R = rootBox L z R := by + have hc := coarseCenter_eq_of_projection hLK he + change (Set.univ.pi fun i ↦ Metric.closedBall (coarseCenter L w i) R) = + (Set.univ.pi fun i ↦ Metric.closedBall (coarseCenter L z i) R) + rw [hc] + +def siteRep {K : ℕ} (v : DiscreteTorus K) : Vertex := fun i ↦ (v i).val + +lemma siteRep_projection {K : ℕ} [NeZero K] (v : DiscreteTorus K) : + torusProjection K (siteRep v)=v := by + ext i + change (((v i).val:ℤ):ZMod K)=v i + simp only [Int.cast_natCast,ZMod.natCast_zmod_val] + +def siteCenter {K : ℕ} (L : Length) (v : DiscreteTorus K) : Torus L := + coarseCenter L (siteRep v) + +def closeSet {n K : ℕ} [NeZero K] (L : Length) (s T : ℝ) + (X : Configuration n L) : Finset (DiscreteTorus K) := by + classical + exact Finset.univ.filter fun v ↦ T ≤ ((pairCloseLabels L s (siteCenter L v) X).card:ℝ) + +theorem actual_large_parent_marked {m n K : ℕ} [NeZero K] {L : Length} {r s D θ : ℝ} + (hr : 0 < r) (hrsmall : r ≤ 1/4096) (hL : 10 < L.val) (hLK : L.val=(K:ℝ)) + (hrs : 6*r ≤ s) (hθ : θ*D ≤ 1/(1372*r)) + (e : Fin m ↪ Fin n) (X : Configuration n L) : + LargeParentMarked (microPeriod r) (microMesh r) r (fun i ↦ X (e i)) + (closeSet (K := K) L s (θ*D) X) := by + intro z hz hlarge + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _,?_⟩ + have hc : siteCenter L (torusProjection K (parent (microPeriod r) z)) = + coarseCenter L (parent (microPeriod r) z) := + coarseCenter_eq_of_projection hLK (siteRep_projection _) + rw [hc] + exact large_component_forces_close hr hrsmall hL hLK hrs hθ e X hz hlarge + +def largeBoxUnion {K : ℕ} [NeZero K] (L : Length) (B : Finset (DiscreteTorus K)) : Set (Torus L) := + ⋃ m : ℕ, ⋃ v : DiscreteTorus K, ⋃ S ∈ rootedAnimals (torusRangeGraph K 1) v (m+1), + ⋃ (_ : S ⊆ B), rootBox L (siteRep v) ((m:ℝ)+2) + +theorem omitted_subset_small_and_boxes {n q K M : ℕ} [NeZero K] {L : Length} {r : ℝ} + (hq : 0 < q) (hK : 2 < K) (hLK : L.val=(K:ℝ)) (hMK : M ≤ K) + (Y : Configuration n L) (hY : Y ∈ allowed n L r) + (B : Finset (DiscreteTorus K)) (hmark : LargeParentMarked q (1/(q:ℝ)) r Y B) + (he : ¬LargeBadComponent (torusRangeGraph K 1) B M) : + omitted (1/(q:ℝ)) r Y ⊆ smallFills (1/(q:ℝ)) r Y ∪ largeBoxUnion L B := by + intro x hx + rcases hx with hex | ⟨C,hC,z,hz,hxz⟩ + · exact (hex.elim (fun h ↦ h hY) (fun h ↦ h + (finite_components_of_no_large hq hK hMK Y B hmark he))).elim + by_cases hsmall : SmallComponent (1/(q:ℝ)) C + · exact Or.inl ⟨C,hC,hsmall,Set.mem_iUnion₂.mpr ⟨z,hz,hxz⟩⟩ + right + obtain ⟨w,hw,_⟩ := fill_column_meets C hz 0 + let v := torusProjection K (parent q w) + let S := badComponent (torusRangeGraph K 1) B v + obtain ⟨hSpos,hSan,hSB,hspan⟩ := large_finite_parent_lift hq hK hMK Y B hmark he hC hsmall hw + change 1 ≤ S.card at hSpos + change S ∈ rootedAnimals (torusRangeGraph K 1) v S.card at hSan + change S ⊆ B at hSB + change ∀ u ∈ C, ∀ i, |parent q u i-parent q w i| ≤ (S.card:ℤ)-1 at hspan + have hxbox : x ∈ rootBox L (parent q w) ((S.card:ℝ)+1) := by + apply filledRegion_subset_rootBox hq C (parent q w) (m := S.card) + (fun u hu i ↦ (hspan u hu i).trans (by omega)) + exact Set.mem_iUnion₂.mpr ⟨z,hz,hxz⟩ + have hrad : ((S.card-1:ℕ):ℝ)+2=(S.card:ℝ)+1 := by + rw [Nat.cast_sub hSpos]; push_cast; ring + change x ∈ ⋃ m : ℕ, ⋃ v : DiscreteTorus K, ⋃ S ∈ rootedAnimals (torusRangeGraph K 1) v (m+1), + ⋃ (_ : S ⊆ B), rootBox L (siteRep v) ((m:ℝ)+2) + refine Set.mem_iUnion.mpr ⟨S.card-1,Set.mem_iUnion.mpr ⟨v, + Set.mem_iUnion.mpr ⟨S,Set.mem_iUnion.mpr ⟨?_,Set.mem_iUnion.mpr ⟨hSB,?_⟩⟩⟩⟩⟩ + · simpa only [Nat.sub_add_cancel hSpos] using hSan + · rw [hrad,rootBox_eq_of_projection hLK (siteRep_projection v)] + exact hxbox + +end HardSphere.BathSlice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/LiftedBadComponent.lean b/lean/OAI/Analysis/HardSphere/Geometry/LiftedBadComponent.lean new file mode 100644 index 0000000000000000000000000000000000000000..507111004b0c35b077da016f05eaa94b0bf17e48 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/LiftedBadComponent.lean @@ -0,0 +1,176 @@ +import Mathlib +import OAI.Analysis.HardSphere.Model +import OAI.Analysis.HardSphere.Geometry.RoundBox + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators Classical +open scoped BigOperators Classical +namespace HardSphere.Lattice + +def liftedBadComponent (B : Set Vertex) (z : Vertex) : Set Vertex := + {w | z ∈ B ∧ w ∈ B ∧ withinReach starStep B z w} + +def FiniteBadComponents (B : Set Vertex) : Prop := + ∀ z ∈ B, (liftedBadComponent B z).Finite + +lemma liftedBadComponent_self {B : Set Vertex} {z : Vertex} (hz : z ∈ B) : + z ∈ liftedBadComponent B z := ⟨hz, hz, .refl⟩ + +lemma liftedBadComponent_subset (B : Set Vertex) (z : Vertex) : liftedBadComponent B z ⊆ B := + fun _ h ↦ h.2.1 + +lemma liftedBadComponent_closed {B : Set Vertex} {z c x : Vertex} + (hc : c ∈ liftedBadComponent B z) (hx : x ∈ B) (hcx : starStep c x) : + x ∈ liftedBadComponent B z := + ⟨hc.1, hx, hc.2.2.tail ⟨hc.2.1, hx, hcx⟩⟩ + +lemma liftedBadComponent_connected (B : Set Vertex) (z : Vertex) : + starConnected (liftedBadComponent B z) := by + intro c hc x hx + have hcx := (withinReach_symm (fun _ _ ↦ starStep_symm) hc.2.2).trans hx.2.2 + exact withinReach_invariant (fun _ hu _ hv huv ↦ liftedBadComponent_closed hu hv huv) hc hcx + +def IsBadComponent (B : Set Vertex) (C : Finset Vertex) : Prop := + ∃ z ∈ B, (↑C : Set Vertex) = liftedBadComponent B z + +lemma IsBadComponent.connected {B : Set Vertex} {C : Finset Vertex} + (hC : IsBadComponent B C) : starConnected (↑C) := by + obtain ⟨z, _, hz⟩ := hC + rw [hz] + exact liftedBadComponent_connected B z + +lemma IsBadComponent.subset {B : Set Vertex} {C : Finset Vertex} + (hC : IsBadComponent B C) : (↑C : Set Vertex) ⊆ B := by + obtain ⟨z, _, hz⟩ := hC + rw [hz] + exact liftedBadComponent_subset B z + +lemma IsBadComponent.closed {B : Set Vertex} {C : Finset Vertex} + (hC : IsBadComponent B C) {c x : Vertex} + (hc : c ∈ C) (hx : x ∈ B) (hcx : starStep c x) : x ∈ C := by + obtain ⟨z, _, hz⟩ := hC + change x ∈ (↑C : Set Vertex) + rw [hz] + exact liftedBadComponent_closed (by simpa only [← hz, Finset.mem_coe] using hc) hx hcx + +lemma intervalBox_finite (x y : Vertex) : (intervalBox x y).Finite := by + have he : intervalBox x y = Set.Icc (x ⊓ y) (x ⊔ y) := by + ext z + simp only [intervalBox, Set.mem_ofPred, Set.mem_Icc, Pi.le_def, + Pi.inf_apply, Pi.sup_apply] + exact forall_and + rw [he] + exact Set.finite_Icc _ _ + +theorem exterior_all_liftedBadComponents_reach (B : Set Vertex) + (hfin : FiniteBadComponents B) {v w : Vertex} + (hv : ∀ C, IsBadComponent B C → v ∈ exterior C) + (hw : ∀ C, IsBadComponent B C → w ∈ exterior C) : + withinReach nearestStep Bᶜ v w := by + classical + let Γ := intervalBox v w + let f : {z : Vertex // z ∈ B} → Finset Vertex := fun z ↦ (hfin z z.2).toFinset + let roots : Finset {z : Vertex // z ∈ B} := + ((intervalBox_finite v w).inter_of_left B).toFinset.attach.image + (fun z ↦ ⟨z.1, (Set.Finite.mem_toFinset _).mp z.2 |>.2⟩) + let Cs := roots.image f + have hf (z : {z : Vertex // z ∈ B}) : IsBadComponent B (f z) := + ⟨z, z.2, (hfin z z.2).coe_toFinset⟩ + have hCs : ∀ C ∈ Cs, IsBadComponent B C := by + intro C hC + obtain ⟨z, _, rfl⟩ := Finset.mem_image.mp hC + exact hf z + have hcover : ∀ z ∈ Γ, z ∈ B → ∃ C ∈ Cs, z ∈ C := by + intro z hzΓ hzB + have hz : z ∈ ((intervalBox_finite v w).inter_of_left B).toFinset := by + exact ((intervalBox_finite v w).inter_of_left B).mem_toFinset.mpr ⟨hzΓ, hzB⟩ + have hzroot : (⟨z, hzB⟩ : {z : Vertex // z ∈ B}) ∈ roots := by + apply Finset.mem_image.mpr + exact ⟨⟨z, hz⟩, Finset.mem_attach _ _, rfl⟩ + refine ⟨f ⟨z, hzB⟩, Finset.mem_image.mpr ⟨⟨z, hzB⟩, hzroot, rfl⟩, ?_⟩ + exact (hfin z hzB).mem_toFinset.mpr (liftedBadComponent_self hzB) + have hvΓ : v ∈ Γ := by intro i; exact ⟨min_le_left _ _, le_max_left _ _⟩ + have hwΓ : w ∈ Γ := by intro i; exact ⟨min_le_right _ _, le_max_right _ _⟩ + have hd := good_detour_reach Γ B Cs + (fun _ h ↦ (hCs _ h).connected) (fun _ h ↦ (hCs _ h).subset) + (fun _ h _ hc _ hx hcx ↦ (hCs _ h).closed hc hx hcx) hcover hvΓ hwΓ + (fun _ h ↦ hv _ (hCs _ h)) (fun _ h ↦ hw _ (hCs _ h)) (intervalBox_reach v w) + exact withinReach_mono (fun _ h ↦ h.2) hd + +end HardSphere.Lattice + +namespace HardSphere.BathSlice +open HardSphere.Lattice + +abbrev Point := Fin 3 → ℝ + +def liftPoint (L : Length) (x : Point) : Torus L := fun j ↦ (x j : AddCircle L.val) + +def liftedCube (h : ℝ) (z : Vertex) : Set Point := + Set.Icc (fun j ↦ h * (z j : ℝ) - 1/2) (fun j ↦ h * ((z j : ℝ) + 1) - 1/2) + +def microCube (L : Length) (h : ℝ) (z : Vertex) : Set (Torus L) := + liftPoint L '' liftedCube h z + +def forbidden {n : ℕ} {L : Length} (r : ℝ) (Y : Configuration n L) : Set (Torus L) := + {x | ∃ j, torusDistance L x (Y j) ≤ r} + +def slice {n : ℕ} {L : Length} (r : ℝ) (Y : Configuration n L) : Set (Torus L) := + (forbidden r Y)ᶜ + +def bad {n : ℕ} {L : Length} (h r : ℝ) (Y : Configuration n L) : Set Vertex := + {z | ∃ x ∈ microCube L h z, x ∈ forbidden r Y} + +def exceptional {n : ℕ} {L : Length} (h r : ℝ) (Y : Configuration n L) : Prop := + Y ∉ allowed n L r ∨ ¬ FiniteBadComponents (bad h r Y) + +def omitted {n : ℕ} {L : Length} (h r : ℝ) (Y : Configuration n L) : Set (Torus L) := + {x | exceptional h r Y ∨ + ∃ C : Finset Vertex, IsBadComponent (bad h r Y) C ∧ + ∃ z ∈ fill C, x ∈ microCube L h z} + +def retained {n : ℕ} {L : Length} (h r : ℝ) (Y : Configuration n L) : Set (Torus L) := + (omitted h r Y)ᶜ + +lemma continuous_liftPoint (L : Length) : Continuous (liftPoint L) := by + exact continuous_pi fun j ↦ continuous_quotient_mk'.comp (continuous_apply j) + +lemma isCompact_microCube (L : Length) (h : ℝ) (z : Vertex) : + IsCompact (microCube L h z) := + isCompact_Icc.image (continuous_liftPoint L) + +lemma microCube_pathConnected (L : Length) {h : ℝ} (hh : 0 ≤ h) (z : Vertex) : + IsPathConnected (microCube L h z) := by + apply ((convex_Icc (𝕜 := ℝ) _ _).isPathConnected ?_).image (continuous_liftPoint L) + refine ⟨fun j ↦ h * (z j : ℝ) - 1/2, le_rfl, ?_⟩ + intro j + dsimp + nlinarith + +lemma goodCube_subset_slice {n : ℕ} {L : Length} {h r : ℝ} {Y : Configuration n L} + {z : Vertex} (hz : z ∉ bad h r Y) : microCube L h z ⊆ slice r Y := by + intro x hx hxf + exact hz ⟨x, hx, hxf⟩ + +lemma retained_finiteComponents {n : ℕ} {L : Length} {h r : ℝ} + {Y : Configuration n L} {x : Torus L} (hx : x ∈ retained h r Y) : + FiniteBadComponents (bad h r Y) := by + by_contra hn + exact hx (Or.inl (Or.inr hn)) + +lemma retained_mem_exterior {n : ℕ} {L : Length} {h r : ℝ} + {Y : Configuration n L} {x : Torus L} (hx : x ∈ retained h r Y) + {z : Vertex} (hxz : x ∈ microCube L h z) (C : Finset Vertex) + (hC : IsBadComponent (bad h r Y) C) : z ∈ exterior C := by + by_contra hn + exact hx (Or.inr ⟨C, hC, z, hn, hxz⟩) + +end HardSphere.BathSlice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/LocalAE.lean b/lean/OAI/Analysis/HardSphere/Geometry/LocalAE.lean new file mode 100644 index 0000000000000000000000000000000000000000..94d2f2dd15e8ef2b6b202d24812fe05721c4791d --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/LocalAE.lean @@ -0,0 +1,123 @@ +import Mathlib + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory MeasureTheory.Measure Set Filter +open scoped Topology +namespace LocalAE +variable {α β : Type*} [TopologicalSpace α] [MeasurableSpace α] (μ : Measure α) + +def region (P : α → Prop) : Set α := + {x | ∃U : Set α, IsOpen U ∧ x∈U ∧ ∀ᵐ y ∂μ.restrict U, P y} + +lemma isOpen_region (P : α → Prop) : IsOpen (region μ P) := by + rw [isOpen_iff_mem_nhds] + rintro x ⟨U,hU,hx,hP⟩ + apply mem_of_superset (hU.mem_nhds hx) + intro y hy + exact ⟨U,hU,hy,hP⟩ + +lemma ae_region [SecondCountableTopology α] (P : α → Prop) : + ∀ᵐ x ∂μ.restrict (region μ P), P x := by + let I := {U : Set α // IsOpen U ∧ ∀ᵐ x ∂μ.restrict U,P x} + have he : region μ P=⋃U : I,U.val := by + ext x + simp only [region,mem_ofPred_eq,mem_iUnion] + constructor + · rintro ⟨U,hU,hx,hP⟩ + exact ⟨⟨U,hU,hP⟩,hx⟩ + · rintro ⟨U,hx⟩ + exact ⟨U.val,U.property.1,hx,U.property.2⟩ + obtain ⟨T,hT,heT⟩ := TopologicalSpace.isOpen_iUnion_countable + (fun U : I ↦ U.val) (fun U ↦ U.property.1) + rw [he,←heT,ae_restrict_biUnion_iff _ hT] + intro U hU + exact U.property.2 + +lemma region_unique [IsOpenPosMeasure μ] {f : α → β} {z w : β} {x : α} + (hz : x∈region μ (fun y ↦ f y=z)) (hw : x∈region μ (fun y ↦ f y=w)) : z=w := by + obtain ⟨U,hU,hx,hz⟩ := hz + obtain ⟨V,hV,hy,hw⟩ := hw + have hne := (hU.inter hV).measure_ne_zero μ ⟨x,hx,hy⟩ + have hp : ∀ᵐ y ∂μ.restrict (U∩V), f y=z ∧ f y=w := + (ae_restrict_of_ae_restrict_of_subset inter_subset_left hz).and + (ae_restrict_of_ae_restrict_of_subset inter_subset_right hw) + obtain ⟨y,hy,h1,h2⟩ := exists_mem_of_measure_ne_zero_of_ae hne hp + exact h1.symm.trans h2 + +lemma connected_region [IsOpenPosMeasure μ] {f : α → β} {S : Set α} + (hS : IsPreconnected S) (hcover : ∀x∈S, ∃z, x∈region μ (fun y ↦ f y=z)) + {x : α} (hx : x∈S) {z : β} (hz : x∈region μ (fun y ↦ f y=z)) : + S⊆region μ (fun y ↦ f y=z) := by + let U := region μ (fun y ↦ f y=z) + let V := ⋃w≠z,region μ (fun y ↦ f y=w) + have hU : IsOpen U := isOpen_region μ _ + have hV : IsOpen V := isOpen_iUnion (fun w ↦ isOpen_iUnion (fun _ ↦ isOpen_region μ _)) + have hd : Disjoint U V := by + apply disjoint_left.mpr + intro y hy hyv + obtain ⟨w,hw'⟩ := mem_iUnion.mp hyv + obtain ⟨hw,hy'⟩ := mem_iUnion.mp hw' + exact hw (region_unique μ hy' hy) + have hc : S⊆U∪V := by + intro y hy + obtain ⟨w,hw⟩ := hcover y hy + by_cases he : w=z + · exact Or.inl (by simpa only [U,he] using hw) + · exact Or.inr (mem_iUnion.mpr ⟨w,mem_iUnion.mpr ⟨he,hw⟩⟩) + exact hS.subset_left_of_subset_union hU hV hd hc ⟨x,hx,hz⟩ + +omit [TopologicalSpace α] in +lemma ae_local_const_of_ae_pairs {f : α → β} {U : Set α} (hU : μ U≠0) + (h : ∀ᵐ x ∂μ.restrict U, ∀ᵐ y ∂μ.restrict U,f x=f y) : + ∃z,∀ᵐ y ∂μ.restrict U,f y=z := by + obtain ⟨x,hx,hp⟩ := exists_mem_of_measure_ne_zero_of_ae hU h + exact ⟨f x,hp.mono (fun _ hy ↦ hy.symm)⟩ + +def representative [Inhabited β] (f : α → β) (x : α) : β := by + classical + exact if h : ∃z,x∈region μ (fun y ↦ f y=z) then Classical.choose h else default + +lemma representative_mem [Inhabited β] {f : α → β} {x : α} + (h : ∃z,x∈region μ (fun y ↦ f y=z)) : + x∈region μ (fun y ↦ f y=representative μ f x) := by + simp only [representative,dite_eq_left h] + exact Classical.choose_spec h + +lemma representative_eq [Inhabited β] [IsOpenPosMeasure μ] {f : α → β} {x : α} {z : β} + (h : x∈region μ (fun y ↦ f y=z)) : representative μ f x=z := + region_unique μ (representative_mem μ ⟨z,h⟩) h + +lemma representative_ae [Inhabited β] [IsOpenPosMeasure μ] [SecondCountableTopology α] + [OpensMeasurableSpace α] {f : α → β} {S : Set α} (hS : IsOpen S) + (hcover : ∀x∈S,∃z,x∈region μ (fun y ↦ f y=z)) : + ∀ᵐ x ∂μ.restrict S,f x=representative μ f x := by + have hsub : S⊆region μ (fun y ↦ f y=representative μ f y) := by + intro x hx + obtain ⟨z,U,hU,hxU,hf⟩ := hcover x hx + refine ⟨U∩S,hU.inter hS,⟨hxU,hx⟩,?_⟩ + filter_upwards [ae_restrict_of_ae_restrict_of_subset inter_subset_left hf, + ae_restrict_mem (hU.inter hS).measurableSet] with y hy hym + exact hy.trans (representative_eq μ (show y∈region μ (fun y ↦ f y=z) from ⟨U,hU,hym.1,hf⟩)).symm + exact ae_restrict_of_ae_restrict_of_subset hsub (ae_region μ _) + +lemma representative_eq_on_connected [Inhabited β] [IsOpenPosMeasure μ] + {f : α → β} {S : Set α} (hS : IsPreconnected S) + (hcover : ∀x∈S,∃z,x∈region μ (fun y ↦ f y=z)) {x y : α} (hx : x∈S) (hy : y∈S) : + representative μ f x=representative μ f y := by + have hz := representative_mem μ (hcover x hx) + have hzy := connected_region μ hS hcover hx hz hy + exact (representative_eq μ hzy).symm + +end LocalAE + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/LocalCheck.lean b/lean/OAI/Analysis/HardSphere/Geometry/LocalCheck.lean new file mode 100644 index 0000000000000000000000000000000000000000..47e2a344218a0b59220a4cbb081ef2c75f9a68cf --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/LocalCheck.lean @@ -0,0 +1,389 @@ +import Mathlib + +namespace OAI + +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped ENNReal +open MeasureTheory Function Set Filter +open scoped ENNReal BigOperators +namespace HardSphere.Comparison + +variable {ι : Type*} [DecidableEq ι] {X : ι → Type*} + [∀ i, MeasurableSpace (X i)] + +structure LocalCheck (X : ι → Type*) [∀ i, MeasurableSpace (X i)] where + support : Finset ι + nonempty : support.Nonempty + arity : support.card ≤ 2 + pass : (∀ i, X i) → Prop + measurable_pass : MeasurableSet {x | pass x} + depends : ∀ x y, (∀ i ∈ support, x i = y i) → (pass x ↔ pass y) + +variable {C : Type*} [Fintype C] (checks : C → LocalCheck X) + +def retainedEvent (s : Finset ι) : Set (∀ i, X i) := + {x | ∀ c, (checks c).support ⊆ s → (checks c).pass x} + +def insertionEvent (s : Finset ι) (i : ι) : Set (∀ i, X i) := + {x | ∀ c, (checks c).support ⊆ insert i s → + ¬ (checks c).support ⊆ s → (checks c).pass x} + +lemma measurableSet_retainedEvent (s : Finset ι) : MeasurableSet (retainedEvent checks s) := by + classical + have heq : retainedEvent checks s = + ⋂ c, if (checks c).support ⊆ s then {x | (checks c).pass x} else Set.univ := by + ext x + simp [retainedEvent] + rw [heq] + apply MeasurableSet.iInter + intro c + split_ifs + · exact (checks c).measurable_pass + · exact MeasurableSet.univ + +lemma measurableSet_insertionEvent (s : Finset ι) (i : ι) : + MeasurableSet (insertionEvent checks s i) := by + classical + have heq : insertionEvent checks s i = + ⋂ c, if (checks c).support ⊆ insert i s ∧ ¬ (checks c).support ⊆ s then + {x | (checks c).pass x} else Set.univ := by + ext x + simp [insertionEvent, and_imp] + rw [heq] + apply MeasurableSet.iInter + intro c + split_ifs + · exact (checks c).measurable_pass + · exact MeasurableSet.univ + +omit [Fintype C] in +lemma retainedEvent_insert (s : Finset ι) (i : ι) : + retainedEvent checks (insert i s) = + retainedEvent checks s ∩ insertionEvent checks s i := by + classical + ext x + constructor + · intro h + exact ⟨fun c hc ↦ h c (hc.trans (Finset.subset_insert _ _)), fun c hc _ ↦ h c hc⟩ + · rintro ⟨hs, hi⟩ c hc + by_cases hold : (checks c).support ⊆ s + · exact hs c hold + · exact hi c hc hold + +omit [Fintype C] in +lemma retainedEvent_update {s : Finset ι} {i : ι} (hi : i ∉ s) + (x : ∀ j, X j) (y : X i) : + Function.update x i y ∈ retainedEvent checks s ↔ x ∈ retainedEvent checks s := by + apply forall_congr' + intro c + apply imp_congr_right + intro hc + apply (checks c).depends + intro j hj + exact Function.update_of_ne (ne_of_mem_of_not_mem (hc hj) hi) y x + +def checkWeight (s : Finset ι) : (∀ i, X i) → ℝ≥0∞ := + (retainedEvent checks s).indicator (fun _ ↦ 1) + +lemma measurable_checkWeight (s : Finset ι) : Measurable (checkWeight checks s) := + measurable_const.indicator (measurableSet_retainedEvent checks s) + +omit [DecidableEq ι] [Fintype C] in +lemma checkWeight_le_one (s : Finset ι) (x : ∀ i, X i) : checkWeight checks s x ≤ 1 := by + classical + simp only [checkWeight, Set.indicator_apply] + split_ifs <;> simp + +def UniformInsertion (μ : ∀ i, Measure (X i)) (a : ℝ≥0∞) : Prop := + ∀ (s : Finset ι) (i : ι), i ∉ s → ∀ x : ∀ j, X j, + a ≤ ∫⁻ y, (insertionEvent checks s i).indicator (fun _ ↦ (1 : ℝ≥0∞)) + (Function.update x i y) ∂μ i + +omit [Fintype C] in +lemma insertion_integral_lower {μ : ∀ i, Measure (X i)} {a : ℝ≥0∞} + (hcompat : UniformInsertion checks μ a) {s : Finset ι} {i : ι} (hi : i ∉ s) + (x : ∀ i, X i) : + a * checkWeight checks s x ≤ + ∫⁻ y, checkWeight checks (insert i s) (Function.update x i y) ∂μ i := by + classical + by_cases hx : x ∈ retainedEvent checks s + · have heq : (fun y ↦ checkWeight checks (insert i s) (Function.update x i y)) = + fun y ↦ (insertionEvent checks s i).indicator (fun _ ↦ (1 : ℝ≥0∞)) + (Function.update x i y) := by + funext y + have hu := (retainedEvent_update checks hi x y).2 hx + simp [checkWeight, retainedEvent_insert, Set.indicator_apply, hu] + rw [heq] + simpa [checkWeight, hx] using hcompat s i hi x + · simp [checkWeight, hx] + +def checkNormalizer (μ : ∀ i, Measure (X i)) (s : Finset ι) + (x : ∀ i, X i) : ℝ≥0∞ := lmarginal μ s (checkWeight checks s) x + +lemma checkNormalizer_insert_lower {μ : ∀ i, Measure (X i)} [∀ i, SigmaFinite (μ i)] + {a : ℝ≥0∞} (hcompat : UniformInsertion checks μ a) + {s : Finset ι} {i : ι} (hi : i ∉ s) (x : ∀ i, X i) : + a * checkNormalizer checks μ s x ≤ checkNormalizer checks μ (insert i s) x := by + rw [checkNormalizer, checkNormalizer, + lmarginal_insert' _ (measurable_checkWeight checks _) hi] + calc + a * lmarginal μ s (checkWeight checks s) x = + lmarginal μ s (fun x ↦ a * checkWeight checks s x) x := by + dsimp [lmarginal] + exact (lintegral_const_mul a ((measurable_checkWeight checks s).comp + (measurable_updateFinset (x := x) (s := s)))).symm + _ ≤ _ := lmarginal_mono (insertion_integral_lower checks hcompat hi) x + +omit [DecidableEq ι] [Fintype C] in +lemma checkWeight_depends (s : Finset ι) {x y : ∀ i, X i} + (hxy : ∀ i ∈ s, x i = y i) : checkWeight checks s x = checkWeight checks s y := by + classical + have h : x ∈ retainedEvent checks s ↔ y ∈ retainedEvent checks s := by + apply forall_congr' + intro c + apply imp_congr_right + intro hc + exact (checks c).depends x y fun i hi ↦ hxy i (hc hi) + simp only [checkWeight, Set.indicator_apply, h] + +omit [Fintype C] in +lemma checkNormalizer_const {μ : ∀ i, Measure (X i)} (s : Finset ι) + (x y : ∀ i, X i) : checkNormalizer checks μ s x = checkNormalizer checks μ s y := by + apply lintegral_congr + intro z + apply checkWeight_depends + intro i hi + simp [Function.updateFinset, hi] + +omit [Fintype C] in +lemma checkNormalizer_empty {μ : ∀ i, Measure (X i)} (x : ∀ i, X i) : + checkNormalizer checks μ ∅ x = 1 := by + have h : x ∈ retainedEvent checks ∅ := by + intro c hc + exact False.elim ((checks c).nonempty.ne_empty (Finset.subset_empty.mp hc)) + simp [checkNormalizer, checkWeight, h] + +omit [Fintype C] in +lemma checkNormalizer_le_one {μ : ∀ i, Measure (X i)} [∀ i, IsProbabilityMeasure (μ i)] + (s : Finset ι) (x : ∀ i, X i) : checkNormalizer checks μ s x ≤ 1 := by + calc + checkNormalizer checks μ s x ≤ ∫⁻ _, (1 : ℝ≥0∞) ∂Measure.pi (fun i : s ↦ μ i) := + lintegral_mono fun _ ↦ checkWeight_le_one checks _ _ + _ = 1 := by simp + +lemma checkNormalizer_union_lower {μ : ∀ i, Measure (X i)} [∀ i, SigmaFinite (μ i)] + {a : ℝ≥0∞} (hcompat : UniformInsertion checks μ a) + (s t : Finset ι) (hst : Disjoint s t) (x : ∀ i, X i) : + a ^ t.card * checkNormalizer checks μ s x ≤ checkNormalizer checks μ (s ∪ t) x := by + induction t using Finset.induction_on with + | empty => simp + | @insert i t hit ih => + have his : i ∉ s := (Finset.disjoint_insert_right.mp hst).1 + have hst' : Disjoint s t := (Finset.disjoint_insert_right.mp hst).2 + have hiu : i ∉ s ∪ t := by simp [his, hit] + calc + a ^ (insert i t).card * checkNormalizer checks μ s x = + a * (a ^ t.card * checkNormalizer checks μ s x) := by + rw [Finset.card_insert_of_notMem hit, pow_succ] + ac_rfl + _ ≤ a * checkNormalizer checks μ (s ∪ t) x := mul_le_mul_right (ih hst') a + _ ≤ checkNormalizer checks μ (insert i (s ∪ t)) x := + checkNormalizer_insert_lower checks hcompat hiu x + _ = _ := by rw [Finset.union_insert] + +lemma checkNormalizer_pos {μ : ∀ i, Measure (X i)} [∀ i, SigmaFinite (μ i)] + {a : ℝ≥0∞} (ha : 0 < a) (hcompat : UniformInsertion checks μ a) + (s : Finset ι) (x : ∀ i, X i) : 0 < checkNormalizer checks μ s x := by + have h := checkNormalizer_union_lower checks hcompat ∅ s (Finset.disjoint_empty_left s) x + simp only [checkNormalizer_empty, mul_one, Finset.empty_union] at h + exact lt_of_lt_of_le (by positivity) h + +omit [DecidableEq ι] [Fintype C] in +lemma checkWeight_antitone {s t : Finset ι} (hst : s ⊆ t) : + checkWeight checks t ≤ checkWeight checks s := by + classical + intro x + by_cases ht : x ∈ retainedEvent checks t + · have hs : x ∈ retainedEvent checks s := fun c hc ↦ ht c (hc.trans hst) + simp [checkWeight, ht, hs] + · simp [checkWeight, ht] + +lemma checkNormalizer_antitone {μ : ∀ i, Measure (X i)} [∀ i, IsProbabilityMeasure (μ i)] + {s t : Finset ι} (hst : s ⊆ t) (x : ∀ i, X i) : + checkNormalizer checks μ t x ≤ checkNormalizer checks μ s x := by + calc + checkNormalizer checks μ t x ≤ lmarginal μ t (checkWeight checks s) x := + lmarginal_mono (checkWeight_antitone checks hst) x + _ = checkNormalizer checks μ s x := by + rw [← Finset.union_sdiff_of_subset hst, + lmarginal_union' μ _ (measurable_checkWeight checks s) Finset.disjoint_sdiff] + change (∫⁻ y, checkNormalizer checks μ s (Function.updateFinset x (t \ s) y) + ∂Measure.pi (fun i : ↥(t \ s) ↦ μ i)) = checkNormalizer checks μ s x + simp_rw [checkNormalizer_const checks s _ x] + simp + +def SeparatedChecks (s t : Finset ι) : Prop := + ∀ c, (checks c).support ⊆ s ∪ t → + (checks c).support ⊆ s ∨ (checks c).support ⊆ t + +omit [Fintype C] in +lemma checkWeight_union {s t : Finset ι} (hsep : SeparatedChecks checks s t) + (x : ∀ i, X i) : + checkWeight checks (s ∪ t) x = checkWeight checks s x * checkWeight checks t x := by + classical + have hevent : x ∈ retainedEvent checks (s ∪ t) ↔ + x ∈ retainedEvent checks s ∧ x ∈ retainedEvent checks t := by + constructor + · intro h + exact ⟨fun c hc ↦ h c (hc.trans Finset.subset_union_left), + fun c hc ↦ h c (hc.trans Finset.subset_union_right)⟩ + · rintro ⟨hs, ht⟩ c hc + exact (hsep c hc).elim (hs c) (ht c) + simp only [checkWeight, Set.indicator_apply, hevent] + split_ifs <;> simp_all + +lemma checkNormalizer_union_eq_mul {μ : ∀ i, Measure (X i)} [∀ i, SigmaFinite (μ i)] + {s t : Finset ι} (hst : Disjoint s t) (hsep : SeparatedChecks checks s t) + (x : ∀ i, X i) : + checkNormalizer checks μ (s ∪ t) x = + checkNormalizer checks μ s x * checkNormalizer checks μ t x := by + have hin : ∀ y, lmarginal μ t + (fun y ↦ checkWeight checks s y * checkWeight checks t y) y = + checkWeight checks s y * checkNormalizer checks μ t y := by + intro y + simp only [lmarginal, checkNormalizer] + have hu : ∀ z : ∀ i : t, X i, + checkWeight checks s (Function.updateFinset y t z) = checkWeight checks s y := by + intro z + apply checkWeight_depends + intro i hi + have hit : i ∉ t := Finset.disjoint_left.mp hst hi + simp [Function.updateFinset, hit] + simp_rw [hu] + exact lintegral_const_mul _ ((measurable_checkWeight checks t).comp + (measurable_updateFinset (x := y) (s := t))) + rw [checkNormalizer, show checkWeight checks (s ∪ t) = + (fun y ↦ checkWeight checks s y * checkWeight checks t y) from + funext (checkWeight_union checks hsep)] + rw [lmarginal_union μ (fun y ↦ checkWeight checks s y * checkWeight checks t y) + ((measurable_checkWeight checks s).mul (measurable_checkWeight checks t)) hst] + simp_rw [show lmarginal μ t (fun y ↦ checkWeight checks s y * checkWeight checks t y) = + (fun y ↦ checkWeight checks s y * checkNormalizer checks μ t y) from funext hin] + simp only [lmarginal] + simp_rw [checkNormalizer_const checks t _ x] + exact lintegral_mul_const _ ((measurable_checkWeight checks s).comp + (measurable_updateFinset (x := x) (s := s))) + +lemma checkNormalizer_far_lower {μ : ∀ i, Measure (X i)} [∀ i, SigmaFinite (μ i)] + {a : ℝ≥0∞} (hcompat : UniformInsertion checks μ a) + {s t u : Finset ι} (hst : Disjoint s t) (hu : Disjoint (s ∪ t) u) + (hsep : SeparatedChecks checks s t) (x : ∀ i, X i) : + a ^ u.card * (checkNormalizer checks μ s x * checkNormalizer checks μ t x) ≤ + checkNormalizer checks μ (s ∪ t ∪ u) x := by + rw [← checkNormalizer_union_eq_mul checks hst hsep x] + exact checkNormalizer_union_lower checks hcompat _ _ hu x + +omit [Fintype C] in +lemma lmarginal_eq_const_of_depends {μ : ∀ i, Measure (X i)} + {s : Finset ι} {f : (∀ i, X i) → ℝ≥0∞} + (hf : DependsOn f (s : Set ι)) (x y : ∀ i, X i) : + lmarginal μ s f x = lmarginal μ s f y := by + apply lintegral_congr + intro z + apply hf + intro i hi + change i ∈ s at hi + simp [Function.updateFinset, hi] + +omit [Fintype C] in +lemma lmarginal_of_disjoint_depends {μ : ∀ i, Measure (X i)} + [∀ i, IsProbabilityMeasure (μ i)] + {s t : Finset ι} {f : (∀ i, X i) → ℝ≥0∞} + (hf : DependsOn f (s : Set ι)) (hst : Disjoint s t) (x : ∀ i, X i) : + lmarginal μ t f x = f x := by + have hu : ∀ z : ∀ i : t, X i, f (Function.updateFinset x t z) = f x := by + intro z + apply hf + intro i hi + have hit : i ∉ t := Finset.disjoint_left.mp hst hi + simp [Function.updateFinset, hit] + simp only [lmarginal] + simp_rw [hu] + simp + +omit [Fintype C] in +lemma lmarginal_mul_disjoint {μ : ∀ i, Measure (X i)} [∀ i, SigmaFinite (μ i)] + {s t : Finset ι} (hst : Disjoint s t) {f g : (∀ i, X i) → ℝ≥0∞} + (hf : Measurable f) (hg : Measurable g) + (hfs : DependsOn f (s : Set ι)) (hgt : DependsOn g (t : Set ι)) + (x : ∀ i, X i) : + lmarginal μ (s ∪ t) (fun y ↦ f y * g y) x = + lmarginal μ s f x * lmarginal μ t g x := by + have hin : ∀ y, lmarginal μ t (fun y ↦ f y * g y) y = + f y * lmarginal μ t g y := by + intro y + simp only [lmarginal] + have hu : ∀ z : ∀ i : t, X i, f (Function.updateFinset y t z) = f y := by + intro z + apply hfs + intro i hi + have hit : i ∉ t := Finset.disjoint_left.mp hst hi + simp [Function.updateFinset, hit] + simp_rw [hu] + exact lintegral_const_mul _ (hg.comp (measurable_updateFinset (x := y) (s := t))) + rw [lmarginal_union μ (fun y ↦ f y * g y) (hf.mul hg) hst] + simp_rw [show lmarginal μ t (fun y ↦ f y * g y) = + (fun y ↦ f y * lmarginal μ t g y) from funext hin] + change (∫⁻ y, f (Function.updateFinset x s y) * + lmarginal μ t g (Function.updateFinset x s y) + ∂Measure.pi (fun i : s ↦ μ i)) = _ + simp_rw [lmarginal_eq_const_of_depends hgt _ x] + exact lintegral_mul_const _ (hf.comp (measurable_updateFinset (x := x) (s := s))) + +omit [Fintype C] in +lemma lmarginal_prod_coordinates {μ : ∀ i, Measure (X i)} [∀ i, SigmaFinite (μ i)] + (g : ∀ i, X i → ℝ≥0∞) (hg : ∀ i, Measurable (g i)) + (s : Finset ι) (x : ∀ i, X i) : + lmarginal μ s (fun y ↦ ∏ i ∈ s, g i (y i)) x = + ∏ i ∈ s, ∫⁻ y, g i y ∂μ i := by + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + have hm (s : Finset ι) : Measurable (fun y : ∀ i, X i ↦ ∏ i ∈ s, g i (y i)) := + Finset.measurable_prod s fun i _ ↦ (hg i).comp (measurable_pi_apply i) + have hs : DependsOn (fun y : ∀ i, X i ↦ ∏ i ∈ s, g i (y i)) (s : Set ι) := by + intro y z hyz + exact Finset.prod_congr rfl fun i hi ↦ congrArg (g i) (hyz i hi) + have hu : (insert i s : Finset ι) = {i} ∪ s := by simp + simp only [Finset.prod_insert hi] + rw [hu, lmarginal_mul_disjoint (μ := μ) + (f := fun y ↦ g i (y i)) (g := fun y ↦ ∏ i ∈ s, g i (y i)) + (Finset.disjoint_singleton_left.mpr hi) + ((hg i).comp (measurable_pi_apply i)) (hm s) + (by intro y z hyz; exact congrArg (g i) (hyz i (by simp))) hs x] + rw [ih, lmarginal_singleton] + simp + +lemma checkNormalizer_delete_le {μ : ∀ i, Measure (X i)} [∀ i, SigmaFinite (μ i)] + {s t : Finset ι} (hst : Disjoint s t) (x : ∀ i, X i) : + checkNormalizer checks μ (s ∪ t) x ≤ + checkNormalizer checks μ s x * ∏ i ∈ t, μ i Set.univ := by + calc + checkNormalizer checks μ (s ∪ t) x ≤ lmarginal μ (s ∪ t) (checkWeight checks s) x := + lmarginal_mono (checkWeight_antitone checks Finset.subset_union_left) x + _ = checkNormalizer checks μ s x * ∏ i ∈ t, μ i Set.univ := by + rw [lmarginal_union' μ _ (measurable_checkWeight checks s) hst] + change (∫⁻ y, checkNormalizer checks μ s (Function.updateFinset x t y) + ∂Measure.pi (fun i : t ↦ μ i)) = _ + simp_rw [checkNormalizer_const checks s _ x] + rw [lintegral_const] + rw [Measure.pi_univ] + exact congrArg (checkNormalizer checks μ s x * ·) + (Finset.prod_coe_sort t (fun i ↦ μ i Set.univ)) + +end HardSphere.Comparison + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/LocalCloseLabels.lean b/lean/OAI/Analysis/HardSphere/Geometry/LocalCloseLabels.lean new file mode 100644 index 0000000000000000000000000000000000000000..144da4c47e9885a567b02edcc6a09128730483b4 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/LocalCloseLabels.lean @@ -0,0 +1,176 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.LocalizedNearLabels +import OAI.Analysis.HardSphere.Geometry.SqTwiceSqAbs + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter + +variable {n : ℕ} [Nontrivial (Fin n)] + +def localCloseLabels (L : Length) (s : ℝ) (v : Torus L) (X : Configuration n L) : Finset (Fin n) := by + classical + exact Finset.univ.filter (fun i ↦ torusDistance L (X i) v≤5 ∧ nearestParticleDistance L X i ≤ s) + +lemma localCloseSmoothCount_nonneg (L : Length) (s : ℝ) (v : Torus L) (X : Configuration n L) : + 0≤localCloseSmoothCount L s v X := Finset.sum_nonneg (fun _ _ ↦ sq_nonneg _) + +lemma localCloseSmoothCount_covers (L : Length) {s : ℝ} (hs : 0 norm_num + · have hz : closeAmplitude L s v X i=0 := not_ne_iff.mp (fun h ↦ he ⟨v,hv,h⟩) + rw [hz]; norm_num + calc + _ ≤ ∑ i, if i∈localizedNearLabels L A s X then (1:ℝ) else 0 := Finset.sum_le_sum (fun i _ ↦ hp i) + _ = _ := by simp + +end HardSphere + +namespace HardSphere +open MeasureTheory Set Filter ContinuousLinearMap +open scoped Convolution NNReal + +variable {ι : Type*} [Fintype ι] + +def configurationMollify (L : Length) (φ : ContDiffBump (0 : EuclideanConfiguration ι)) + (f : (ι→Torus L)→ℝ) (X : ι→Torus L) : ℝ := + ∫ y : EuclideanConfiguration ι, φ.normed volume y*f (X-euclideanProject L y) + +lemma configurationMollify_lift (L : Length) (φ : ContDiffBump (0 : EuclideanConfiguration ι)) + (f : (ι→Torus L)→ℝ) : + (fun x : EuclideanConfiguration ι ↦ configurationMollify L φ f (euclideanProject L x))= + φ.normed volume ⋆[lsmul ℝ ℝ,volume] (fun x ↦ f (euclideanProject L x)) := by + funext x + simp only [configurationMollify,convolution,lsmul_apply,smul_eq_mul,euclideanProject_sub] + +lemma configurationMollify_integrable (L : Length) (φ : ContDiffBump (0 : EuclideanConfiguration ι)) + (f : (ι→Torus L)→ℝ) (hf : Continuous f) (X : ι→Torus L) : + Integrable (fun y : EuclideanConfiguration ι ↦ φ.normed volume y*f (X-euclideanProject L y)) volume := + (φ.continuous_normed.mul (hf.comp (continuous_const.sub (euclideanProject_continuous L)))).integrable_of_hasCompactSupport + (φ.hasCompactSupport_normed.mul_right) + +lemma configurationMollify_smooth (L : Length) (φ : ContDiffBump (0 : EuclideanConfiguration ι)) + (f : (ι→Torus L)→ℝ) (hf : Continuous f) : + ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) + (fun x : EuclideanConfiguration ι ↦ configurationMollify L φ f (euclideanProject L x)) := by + rw [configurationMollify_lift] + exact φ.hasCompactSupport_normed.contDiff_convolution_left (lsmul ℝ ℝ) φ.contDiff_normed + (hf.comp (euclideanProject_continuous L)).locallyIntegrable + +lemma configurationMollify_nonneg (L : Length) (φ : ContDiffBump (0 : EuclideanConfiguration ι)) + (f : (ι→Torus L)→ℝ) (hf : ∀ X, 0≤f X) (X : ι→Torus L) : + 0≤configurationMollify L φ f X := + integral_nonneg (fun y ↦ mul_nonneg (φ.nonneg_normed y) (hf _)) + +lemma configurationMollify_lipschitz (L : Length) (φ : ContDiffBump (0 : EuclideanConfiguration ι)) + {f : (ι→Torus L)→ℝ} (hf : Continuous f) {C : ℝ≥0} + (hLip : LipschitzWith C (fun x : EuclideanConfiguration ι ↦ f (euclideanProject L x))) : + LipschitzWith C (fun x : EuclideanConfiguration ι ↦ configurationMollify L φ f (euclideanProject L x)) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [dist_eq_norm,configurationMollify,configurationMollify,←integral_sub + (configurationMollify_integrable L φ f hf _) (configurationMollify_integrable L φ f hf _)] + calc + _ ≤ ∫ z : EuclideanConfiguration ι, φ.normed volume z*((C:ℝ)*dist x y) := by + apply norm_integral_le_of_norm_le (φ.integrable_normed.mul_const _) (Eventually.of_forall ?_) + intro z + rw [←mul_sub,norm_mul,Real.norm_eq_abs,abs_of_nonneg (φ.nonneg_normed z)] + apply mul_le_mul_of_nonneg_left _ (φ.nonneg_normed z) + have h := hLip.dist_le_mul (x-z) (y-z) + simpa only [euclideanProject_sub,dist_sub_right,Real.dist_eq,Real.norm_eq_abs] using h + _ = (C:ℝ)*dist x y := by rw [integral_mul_const,φ.integral_normed,one_mul] + +lemma configurationMollify_approximation (L : Length) (φ : ContDiffBump (0 : EuclideanConfiguration ι)) + {f : (ι→Torus L)→ℝ} (hf : Continuous f) {C : ℝ≥0} + (hLip : LipschitzWith C (fun x : EuclideanConfiguration ι ↦ f (euclideanProject L x))) (X : ι→Torus L) : + dist (configurationMollify L φ f X) (f X)≤(C:ℝ)*φ.rOut := by + obtain ⟨x,rfl⟩ := euclideanProject_surjective L X + rw [show configurationMollify L φ f (euclideanProject L x)= + (φ.normed volume ⋆[lsmul ℝ ℝ,volume] (fun y ↦ f (euclideanProject L y))) x from + congrFun (configurationMollify_lift L φ f) x] + apply φ.dist_normed_convolution_le (hf.comp (euclideanProject_continuous L)).aestronglyMeasurable + intro y hy + exact (hLip.dist_le_mul y x).trans (mul_le_mul_of_nonneg_left (Metric.mem_ball.mp hy).le C.coe_nonneg) + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/LocalCloseLabelsMeasurable.lean b/lean/OAI/Analysis/HardSphere/Geometry/LocalCloseLabelsMeasurable.lean new file mode 100644 index 0000000000000000000000000000000000000000..09391c80dc4f585a3341328072144cc845c2b921 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/LocalCloseLabelsMeasurable.lean @@ -0,0 +1,65 @@ +import Mathlib +import OAI.Analysis.HardSphere.Allocation.SpatialSeparatedCloseJoint + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter + +variable {n : ℕ} [Nontrivial (Fin n)] + +attribute [local irreducible] torusDistance nearestParticleDistance + +lemma localCloseLabels_measurable (L : Length) (s : ℝ) (v : Torus L) : + Measurable (fun X : Configuration n L ↦ ((localCloseLabels L s v X).card:ℝ)) := by + classical + simp only [localCloseLabels,Finset.card_filter,Nat.cast_sum,Nat.cast_ite,Nat.cast_one,Nat.cast_zero] + apply Finset.measurable_sum + intro i _ + have hd : Continuous (fun X : Configuration n L ↦ torusDistance L (X i) v) := + (torusDistance_continuous_pair L).comp + ((continuous_apply i).prodMk (continuous_const : Continuous (fun _ : Configuration n L ↦ v))) + exact Measurable.ite ((measurableSet_le hd.measurable measurable_const).inter + (measurableSet_le (nearestParticleDistance_continuous L i).measurable measurable_const)) + measurable_const measurable_const + +theorem spatial_separated_close_probability : ∃ C c G : ℝ, 0 intro j <;> dsimp only + · by_cases hj : j = i + · subst j + rw [step_apply_same, Int.cast_add, Int.cast_one] + nlinarith + · rw [step_apply_ne z hj] + · by_cases hj : j = i + · subst j + rw [step_apply_same, Int.cast_add, Int.cast_one] + · rw [step_apply_ne z hj] + nlinarith + +lemma adjacent_microCubes_inter (L : Length) {h : ℝ} (hh : 0 ≤ h) + {z w : Vertex} (hzw : nearestStep z w) : + (microCube L h z ∩ microCube L h w).Nonempty := by + have hf (v : Vertex) (i : Fin 3) : + (microCube L h v ∩ microCube L h (step v i)).Nonempty := by + let y : Point := fun j ↦ h * (step v i j : ℝ) - 1/2 + exact ⟨liftPoint L y, ⟨y, step_corner_mem hh v i, rfl⟩, + ⟨y, lower_corner_mem hh (step v i), rfl⟩⟩ + obtain ⟨i, rfl | rfl⟩ := nearestStep_eq_step hzw + · exact hf z i + · simpa only [Set.inter_comm] using hf w i + +lemma exterior_all_liftedBadComponents_good (B : Set Vertex) (hfin : FiniteBadComponents B) + {z : Vertex} (hz : ∀ C, IsBadComponent B C → z ∈ exterior C) : z ∉ B := by + intro hzB + let C := (hfin z hzB).toFinset + have hC : IsBadComponent B C := ⟨z, hzB, (hfin z hzB).coe_toFinset⟩ + exact (hz C hC).1 ((hfin z hzB).mem_toFinset.mpr (liftedBadComponent_self hzB)) + +lemma goodCubes_reach_joined {n : ℕ} {L : Length} {h r : ℝ} + {Y : Configuration n L} (hh : 0 ≤ h) {z w : Vertex} + (hz : z ∉ bad h r Y) (hzw : withinReach nearestStep (bad h r Y)ᶜ z w) + {x y : Torus L} (hx : x ∈ microCube L h z) (hy : y ∈ microCube L h w) : + JoinedIn (slice r Y) x y := by + induction hzw generalizing y with + | refl => + exact ((microCube_pathConnected L hh z).joinedIn x hx y hy).mono + (goodCube_subset_slice hz) + | @tail w u hzw hwu ih => + obtain ⟨p, hpw, hpu⟩ := adjacent_microCubes_inter L hh hwu.2.2 + exact (ih hpw).trans (((microCube_pathConnected L hh u).joinedIn p hpu y hy).mono + (goodCube_subset_slice hwu.2.1)) + +theorem retained_joined {n : ℕ} {L : Length} {h r : ℝ} + {Y : Configuration n L} (hh : 0 < h) {x y : Torus L} + (hx : x ∈ retained h r Y) (hy : y ∈ retained h r Y) : + JoinedIn (slice r Y) x y := by + obtain ⟨z, hxz⟩ := microCube_cover L hh x + obtain ⟨w, hyw⟩ := microCube_cover L hh y + have hf := retained_finiteComponents hx + have hz := retained_mem_exterior hx hxz + have hw := retained_mem_exterior hy hyw + exact goodCubes_reach_joined hh.le + (exterior_all_liftedBadComponents_good _ hf hz) + (exterior_all_liftedBadComponents_reach _ hf hz hw) hxz hyw + +end HardSphere.BathSlice + +namespace HardSphere + +end HardSphere + +namespace HardSphere.BathSlice +open HardSphere.Lattice + +attribute [local irreducible] torusDistance + +theorem retained_strict_clearance {n : ℕ} {L : Length} {h r : ℝ} + {Y : Configuration n L} (hh : 0 < h) {x y : Torus L} + (hx : x ∈ retained h r Y) (hy : y ∈ retained h r Y) : + ∃ γ : Path x y, ∃ δ : ℝ, 0 < δ ∧ + ∀ (t : unitInterval) (j : Fin n), r + δ ≤ torusDistance L (γ t) (Y j) := by + classical + obtain ⟨γ, hγ⟩ := retained_joined hh hx hy + cases isEmpty_or_nonempty (Fin n) with + | inl he => + let := he + exact ⟨γ, 1, by norm_num, fun _ j ↦ isEmptyElim j⟩ + | inr hn => + let := hn + let f : unitInterval × Fin n → ℝ := fun p ↦ torusDistance L (γ p.1) (Y p.2) - r + have hf : Continuous f := by + apply Continuous.sub _ continuous_const + exact (continuous_torusDistance L).comp + ((γ.continuous.comp continuous_fst).prodMk + ((continuous_of_discreteTopology : Continuous Y).comp continuous_snd)) + obtain ⟨p, _, hp⟩ := isCompact_univ.exists_isMinOn Set.univ_nonempty hf.continuousOn + have hpos : 0 < f p := by + have hd : r < torusDistance L (γ p.1) (Y p.2) := by + apply lt_of_not_ge + intro he + exact hγ p.1 ⟨p.2, he⟩ + exact sub_pos.mpr hd + refine ⟨γ, f p, hpos, ?_⟩ + intro t j + have hm := hp (Set.mem_univ (t, j)) + dsimp [f] at hm ⊢ + linarith + +lemma isClosed_bad_test {n : ℕ} (L : Length) (h r : ℝ) (z : Vertex) : + IsClosed {Y : Configuration n L | z ∈ bad h r Y} := by + let A : Set (Torus L × Configuration n L) := + {p | p.1 ∈ microCube L h z ∧ ∃ j, torusDistance L p.1 (p.2 j) ≤ r} + have hA : IsClosed A := by + apply IsClosed.inter ((isCompact_microCube L h z).isClosed.preimage continuous_fst) + have he : {p : Torus L × Configuration n L | ∃ j, torusDistance L p.1 (p.2 j) ≤ r} = + ⋃ j : Fin n, {p | torusDistance L p.1 (p.2 j) ≤ r} := by ext p; simp + change IsClosed {p : Torus L × Configuration n L | ∃ j, torusDistance L p.1 (p.2 j) ≤ r} + rw [he] + apply isClosed_iUnion_of_finite + intro j + exact isClosed_le ((continuous_torusDistance L).comp + (continuous_fst.prodMk ((continuous_apply j).comp continuous_snd))) continuous_const + have he : {Y : Configuration n L | z ∈ bad h r Y} = Prod.snd '' A := by + ext Y + constructor + · rintro ⟨x, hx, hxf⟩ + exact ⟨(x, Y), ⟨hx, hxf⟩, rfl⟩ + · rintro ⟨⟨x, Z⟩, hZ, he⟩ + cases he + exact ⟨x, hZ⟩ + rw [he] + exact isClosedMap_snd_of_compactSpace A hA + +lemma measurableSet_bad_test {n : ℕ} (L : Length) (h r : ℝ) (z : Vertex) : + MeasurableSet {Y : Configuration n L | z ∈ bad h r Y} := + (isClosed_bad_test L h r z).measurableSet + +end HardSphere.BathSlice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/MicroPeriod.lean b/lean/OAI/Analysis/HardSphere/Geometry/MicroPeriod.lean new file mode 100644 index 0000000000000000000000000000000000000000..e41ad8563e0a353e44400452586b4dcb2c752d91 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/MicroPeriod.lean @@ -0,0 +1,76 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.SmallComponent +import OAI.Analysis.HardSphere.Geometry.GridCorner +import OAI.Analysis.HardSphere.Thermodynamics.FiniteScaledBox + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators Classical +open scoped BigOperators Classical +namespace HardSphere.BathSlice +open HardSphere.Lattice + +lemma not_small_has_exit {B : Set Vertex} {C : Finset Vertex} {z : Vertex} {h : ℝ} + (hh : 0 < h) (hC : IsBadComponent B C) (hz : z ∈ C) (hlarge : ¬ SmallComponent h C) : + ∃ w, withinReach starStep B z w ∧ ∃ i, (1:ℝ)/4 ≤ h * |(w i : ℝ)-z i| := by + classical + have hex : ∃ w ∈ C, ∃ i, (1:ℝ)/4 ≤ h * |(w i : ℝ)-z i| := by + by_contra hn + push Not at hn + apply hlarge + intro u hu v hv i + have hu' := hn u hu i + have hv' := hn v hv i + have ht := abs_sub_le (u i : ℝ) (z i) (v i) + rw [abs_sub_comm (z i : ℝ) (v i)] at ht + have hm := mul_le_mul_of_nonneg_left ht hh.le + nlinarith + obtain ⟨w,hw,i,hi⟩ := hex + exact ⟨w,withinReach_mono hC.subset (hC.connected z hz w hw),i,hi⟩ + +theorem large_component_witnesses {n : ℕ} {L : Length} {J : ℕ} {h r : ℝ} + (hh : 0 < h) (hhr : h ≤ r) (hrh : r ≤ 2*h) (hr : r ≤ 1/4096) + (hperiod : L.val = h * J) (hL : 10 < L.val) + (Y : Configuration n L) {z : Vertex} (hz : z ∈ bad h r Y) + (hlarge : ¬ (liftedBadComponent (bad h r Y) z).Finite ∨ + ∃ C, IsBadComponent (bad h r Y) C ∧ z ∈ C ∧ ¬ SmallComponent h C) : + ∃ A : Finset (Fin n), + (1:ℝ)/1372 ≤ r * A.card ∧ + (∀ i ∈ A, torusDistance L (Y i) (gridCorner L h z) ≤ 1) ∧ + (∀ i ∈ A, ∃ j ∈ A, j ≠ i ∧ torusDistance L (Y i) (Y j) ≤ 6*r) := by + have hex : ∃ w, withinReach starStep (bad h r Y) z w ∧ + ∃ i, (1:ℝ)/4 ≤ h * |(w i : ℝ)-z i| := by + rcases hlarge with hinf | ⟨C,hC,hzC,hClarge⟩ + · exact infinite_component_has_exit hh hinf + · exact not_small_has_exit hh hC hzC hClarge + obtain ⟨w,hp,hw⟩ := hex + exact first_exit_witnesses hh hhr hrh hr hperiod hL Y hz hp hw + +def microPeriod (r : ℝ) : ℕ := ⌈1/r⌉₊ +def microMesh (r : ℝ) : ℝ := 1/(microPeriod r : ℝ) + +lemma microPeriod_pos {r : ℝ} (hr : 0 < r) : 0 < microPeriod r := by + exact Nat.ceil_pos.mpr (by positivity) + +lemma microMesh_bounds {r : ℝ} (hr : 0 < r) (hr1 : r ≤ 1) : + 0 < microMesh r ∧ microMesh r ≤ r ∧ r ≤ 2*microMesh r := by + have hq : (0:ℝ) < microPeriod r := by exact_mod_cast microPeriod_pos hr + have hceil : 1/r ≤ (microPeriod r : ℝ) := Nat.le_ceil _ + have hceil' : (microPeriod r : ℝ) < 1/r + 1 := by + exact Nat.ceil_lt_add_one (by positivity) + have hcr := (div_le_iff₀ hr).mp hceil + have hcr' := (lt_div_iff₀ hr).mp (show (microPeriod r : ℝ)-1 < 1/r by linarith) + refine ⟨one_div_pos.mpr hq,?_,?_⟩ + · exact (div_le_iff₀ hq).mpr (by nlinarith) + · change r ≤ 2*(1/(microPeriod r : ℝ)) + rw [← div_eq_mul_one_div] + exact (le_div_iff₀ hq).mpr (by nlinarith) + +end HardSphere.BathSlice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/MollifiedCloseCountMultiplier.lean b/lean/OAI/Analysis/HardSphere/Geometry/MollifiedCloseCountMultiplier.lean new file mode 100644 index 0000000000000000000000000000000000000000..c92decffac93079649ef31fe5a6544a4740b1914 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/MollifiedCloseCountMultiplier.lean @@ -0,0 +1,182 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.FlattenLinear + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate +variable {n : ℕ} [Nontrivial (Fin n)] + +def mollifiedCloseCountMultiplier (L : Length) (s : ℝ) (v : Torus L) + (φ : ContDiffBump (0 : EuclideanConfiguration (Fin n))) : SmoothMultiplier n L := + realEuclideanMultiplier L (mollifiedCloseCount L s v φ) (mollifiedCloseCount_smooth L s v φ) + +lemma mollifiedCloseCountMultiplier_apply (L : Length) (s : ℝ) (v : Torus L) + (φ : ContDiffBump (0 : EuclideanConfiguration (Fin n))) (X : Configuration n L) : + (mollifiedCloseCountMultiplier L s v φ).toFun X=(mollifiedCloseCount L s v φ X:ℂ) := rfl + +lemma mollifiedCloseCountMultiplier_real (L : Length) (s : ℝ) (v : Torus L) + (φ : ContDiffBump (0 : EuclideanConfiguration (Fin n))) (X : Configuration n L) : + conj ((mollifiedCloseCountMultiplier L s v φ).toFun X)=(mollifiedCloseCountMultiplier L s v φ).toFun X := + Complex.conj_ofReal _ + +lemma mollifiedCloseCountMultiplier_gradient (L : Length) {s : ℝ} (hs : 0 linarith only [h.1,h.2] + +lemma closeHighProfile_zero {h : ℝ} (hh : 0.deriv + +lemma closeHighProfile_deriv_zero {h : ℝ} (hh : 0 simp [nominalVertices,nominalDrift] + +lemma nominal_final (m n : ℕ) (hn : 0 simp [nominalVertices,nominalDrift,Int.mul_ediv_cancel_left _ hn0] + +lemma nominal_speed (m n : ℕ) (hn : 0 simp [nominalVertices,firstPathNoise,secondPathNoise,differenceAt,pairDifference] + +def nominalCover {n : ℕ} (U : Fin (n+1) → Vertex) : Finset Vertex := + Finset.univ.biUnion fun i ↦ (torusOffsets 3).image (fun d ↦ U i+d) + +lemma mem_nominalCover {n : ℕ} (U : Fin (n+1) → Vertex) (x : Vertex) : + x∈nominalCover U ↔ ∃ i, ∀ k, |x k-U i k|≤3 := by + constructor + · intro hx + obtain ⟨i,_,hx⟩ := Finset.mem_biUnion.mp hx + obtain ⟨d,hd,rfl⟩ := Finset.mem_image.mp hx + refine ⟨i,?_⟩ + simpa only [torusOffsets,Fintype.mem_piFinset,Finset.mem_Icc,Pi.add_apply, + add_sub_cancel_left,← abs_le,Nat.cast_ofNat] using hd + · rintro ⟨i,hi⟩ + refine Finset.mem_biUnion.mpr ⟨i,Finset.mem_univ _,Finset.mem_image.mpr ⟨x-U i,?_,?_⟩⟩ + · simpa only [torusOffsets,Fintype.mem_piFinset,Finset.mem_Icc,Pi.sub_apply,← abs_le,Nat.cast_ofNat] using hi + · abel + +lemma nominal_mem_cover {n : ℕ} (U : Fin (n+1) → Vertex) (i : Fin (n+1)) : + U i∈nominalCover U := (mem_nominalCover U _).mpr ⟨i,by simp⟩ + +lemma nominalCover_projection {K n : ℕ} (U : Fin (n+1) → Vertex) + {x : DiscreteTorus K} (hx : x∈(nominalCover U).image (torusProjection K)) : + ∃ i, torusNear K 3 (torusProjection K (U i)) x := by + obtain ⟨z,hz,rfl⟩ := Finset.mem_image.mp hx + obtain ⟨i,hi⟩ := (mem_nominalCover U z).mp hz + exact ⟨i,torusNear_symm (projection_near hi)⟩ + +lemma nominalCover_reach {n : ℕ} (U : Fin (n+1) → Vertex) + (hspeed : ∀ i j k, |U i k-U j k|≤3*|(i.val:ℤ)-j.val|) : + withinReach nearestStep (↑(nominalCover U)) (U 0) (U (Fin.last n)) := by + have hpath : ∀ j : ℕ, (hj : j≤n) → withinReach nearestStep (↑(nominalCover U)) + (U 0) (U ⟨j,by omega⟩) := by + intro j + induction j with + | zero => intro _; exact .refl + | succ j ih => + intro hj + have hj' : j≤n := by omega + apply (ih hj').trans + apply box_reach + intro x hx + apply (mem_nominalCover U x).mpr + refine ⟨⟨j,by omega⟩,fun k ↦ ?_⟩ + have hs := hspeed ⟨j,by omega⟩ ⟨j+1,by omega⟩ k + have hb : |U ⟨j,by omega⟩ k-U ⟨j+1,by omega⟩ k|≤3 := by + simpa using hs + have hbox := hx k + obtain ⟨hl,hu⟩ := abs_le.mp hb + exact abs_le.mpr ⟨by omega,by omega⟩ + exact hpath n le_rfl + +lemma torusNear_least_iff {K R : ℕ} (x y : Vertex) + (hsmall : ∀ k, 2*|x k-y k|≤K) : + torusNear K R (torusProjection K x) (torusProjection K y) ↔ ∀ k, |x k-y k|≤R := by + constructor + · rintro ⟨d,hd,he⟩ k + have hcast : (((y k-x k):ℤ):ZMod K)=(d k:ZMod K) := by + have h := he k + simp only [torusProjection,Int.cast_sub] at h ⊢ + linear_combination h + rw [abs_sub_comm] + exact (shortest_representative (by simpa only [abs_sub_comm] using hsmall k) hcast).trans (hd k) + · exact projection_near + +lemma pairDifference_abs_le (m t : ℕ) (ht : t≤3^m) (w : PairNoise m) : + |pairDifference m t w|≤2*t := by + exact (abs_sub_le (walk m w.1 t) 0 (walk m w.2 t)).trans (by + simpa only [sub_zero,zero_sub,abs_neg,two_mul] using + add_le_add (walk_abs_le m w.1 ht) (walk_abs_le m w.2 ht)) + +lemma nominal_near_iff {K n : ℕ} (m R : ℕ) (hnK : 2*n≤K) (ht : n/2≤3^m) + (v : Vertex) (Δ₂ Δ₃ : ℤ) (w : FourNoise m) (j : Fin (n+1)) : + torusNear K R (torusProjection K (nominalVertices m n v Δ₂ Δ₃ (firstPathNoise w) j)) + (torusProjection K (nominalVertices m n v Δ₂ Δ₃ (secondPathNoise w) j)) ↔ + differenceAt m (min j.val (n-j.val)) w ∈ square R := by + let s := min j.val (n-j.val) + have hj := j.isLt + have hs : s≤n/2 := by dsimp [s]; omega + have h₂ := pairDifference_abs_le m s (hs.trans ht) w.1 + have h₃ := pairDifference_abs_le m s (hs.trans ht) w.2 + dsimp only [s] at h₂ h₃ + have he := nominal_difference m n v Δ₂ Δ₃ w j + have hsmall : ∀ k, 2*|nominalVertices m n v Δ₂ Δ₃ (firstPathNoise w) j k- + nominalVertices m n v Δ₂ Δ₃ (secondPathNoise w) j k|≤K := by + intro k + have hk := congrFun he k + simp only [Pi.sub_apply] at hk + rw [hk] + fin_cases k <;> simp [differenceAt] <;> omega + rw [torusNear_least_iff _ _ hsmall] + change (∀ k, |(nominalVertices m n v Δ₂ Δ₃ (firstPathNoise w) j- + nominalVertices m n v Δ₂ Δ₃ (secondPathNoise w) j) k|≤(R:ℤ)) ↔ _ + rw [he] + simp [square,Fin.forall_fin_succ,abs_le] + +end HardSphere.Lattice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/NormSqIntegral.lean b/lean/OAI/Analysis/HardSphere/Geometry/NormSqIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..885984c20dde428b3e8b39be439bb592158b445b --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/NormSqIntegral.lean @@ -0,0 +1,106 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.ConfigurationPath + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace IndicatorStrong +variable {α : Type*} [MeasurableSpace α] {μ : Measure α} + +lemma norm_sq_integral (f : Lp ℂ 2 μ) : ‖f‖^2 = ∫ x, ‖f x‖^2 ∂μ := by + rw [@norm_sq_eq_re_inner ℂ, L2.inner_def, ← integral_re] + · congr 1 + ext x + simp only [inner_self_eq_norm_sq_to_K, RCLike.re_ofReal_pow] + · exact L2.integrable_inner f f + +lemma tendsto_L2_of_norm_dominated {F : ℕ → Lp ℂ 2 μ} {f : Lp ℂ 2 μ} + (b : α → ℝ) (hb : Integrable b μ) + (hbound : ∀ n, ∀ᵐ x ∂μ, ‖(F n - f) x‖^2 ≤ b x) + (hlim : ∀ᵐ x ∂μ, Tendsto (fun n ↦ (F n - f) x) atTop (𝓝 0)) : + Tendsto F atTop (𝓝 f) := by + have hs : Tendsto (fun n ↦ ‖F n - f‖^2) atTop (𝓝 0) := by + simp_rw [norm_sq_integral] + have hi := tendsto_integral_of_dominated_convergence b + (fun n ↦ (show AEStronglyMeasurable (fun x ↦ ‖(F n - f) x‖^2) μ from (Lp.aestronglyMeasurable (F n - f)).norm.pow 2)) hb + (fun n ↦ (hbound n).mono fun x hx ↦ by simpa only [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg (‖(F n - f) x‖))] using hx) + (hlim.mono fun x hx ↦ by simpa using hx.norm.pow 2) + simpa using hi + have hn : Tendsto (fun n ↦ ‖F n - f‖) atTop (𝓝 0) := by + simpa only [Function.comp_def, Real.sqrt_sq_eq_abs, abs_norm, Real.sqrt_zero] using + Real.continuous_sqrt.continuousAt.tendsto.comp hs + exact tendsto_iff_norm_sub_tendsto_zero.mpr hn + +lemma indicator_tendsto {S : ℕ → Set α} (hS : ∀ n, MeasurableSet (S n)) + (hmono : Monotone S) (f : Lp ℂ 2 μ) : + Tendsto (fun n ↦ ((Lp.memLp f).indicator (hS n)).toLp ((S n).indicator f)) + atTop (𝓝 (((Lp.memLp f).indicator (MeasurableSet.iUnion hS)).toLp ((⋃ n, S n).indicator f))) := by + let F n := ((Lp.memLp f).indicator (hS n)).toLp ((S n).indicator f) + let g := ((Lp.memLp f).indicator (MeasurableSet.iUnion hS)).toLp ((⋃ n, S n).indicator f) + have hF n : F n =ᵐ[μ] (S n).indicator f := MemLp.coeFn_toLp _ + have hg : g =ᵐ[μ] (⋃ n, S n).indicator f := MemLp.coeFn_toLp _ + apply tendsto_L2_of_norm_dominated (fun x ↦ ‖f x‖^2) + ((Lp.memLp f).integrable_norm_pow (by norm_num)) + · intro n + filter_upwards [Lp.coeFn_sub (F n) g, hF n, hg] with x hx hfx hgx + rw [hx, Pi.sub_apply, hfx, hgx] + by_cases hn : x ∈ S n + · have hu : x ∈ ⋃ n, S n := mem_iUnion.mpr ⟨n,hn⟩ + simp [hn,hu] + · by_cases hu : x ∈ ⋃ n, S n <;> simp [hn,hu] + · filter_upwards [ae_all_iff.mpr (fun n ↦ Lp.coeFn_sub (F n) g), ae_all_iff.mpr hF, hg] + with x hx hfx hgx + have heq n : (F n - g) x = (S n).indicator f x - (⋃ n, S n).indicator f x := by + rw [hx n,Pi.sub_apply,hfx n,hgx] + change Tendsto (fun n ↦ (F n - g) x) atTop (𝓝 (0:ℂ)) + simp_rw [heq] + by_cases hu : x ∈ ⋃ n, S n + · obtain ⟨n,hn⟩ := mem_iUnion.mp hu + apply tendsto_const_nhds.congr' + filter_upwards [eventually_ge_atTop n] with m hm + simp [hmono hm hn, hu] + · simpa only [Set.indicator_of_notMem hu, sub_zero] using + (tendsto_const_nhds : Tendsto (fun _ : ℕ ↦ (0:ℂ)) atTop (𝓝 0)).congr' + (Filter.Eventually.of_forall fun n ↦ by + rw [Set.indicator_of_notMem (fun h ↦ hu (mem_iUnion.mpr ⟨n,h⟩))]) + +end IndicatorStrong + +namespace HardSphere +open Wiener + +lemma avoidanceMultiplier_innerRadius_tendsto (N : ℕ) (L : Length) (a t : ℝ) + (f : FreePathL2 N L t) : + Tendsto (fun n ↦ avoidanceMultiplier N L (innerRadius a n) t f) atTop + (𝓝 (avoidanceMultiplier N L a t f)) := by + have h := IndicatorStrong.indicator_tendsto + (fun n ↦ (staysAllowed_open N L (innerRadius a n)).measurableSet) + (fun m n hmn ↦ staysAllowed_antitone N L (innerRadius_antitone a hmn)) f + simp only [staysAllowed_innerRadius] at h + have heq (b : ℝ) : avoidanceMultiplier N L b t f = + ((Lp.memLp f).indicator (staysAllowed_open N L b).measurableSet).toLp + ((staysAllowed N L b).indicator f) := by + apply Lp.ext + exact (avoidanceMultiplier_ae N L b t f).trans (MemLp.coeFn_toLp _).symm + simp_rw [← heq] at h + exact h + +lemma killedTransition_innerRadius_tendsto (N : ℕ) (L : Length) (a t : ℝ) + (f : ScalarL2 N L) : + Tendsto (fun n ↦ killedTransition N L (innerRadius a n) t f) atTop + (𝓝 (killedTransition N L a t f)) := by + exact ((endpointPull N L t 0).toContinuousLinearMap.adjoint.continuous.tendsto _).comp + (avoidanceMultiplier_innerRadius_tendsto N L a t (endpointPull N L t 1 f)) + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/NormSqLpIntegral.lean b/lean/OAI/Analysis/HardSphere/Geometry/NormSqLpIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..6831b98773450dcd062c5164c66f6165804b0638 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/NormSqLpIntegral.lean @@ -0,0 +1,55 @@ +import Mathlib + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace HardSphere + +lemma norm_sq_toLp_eq_integral {α : Type*} [MeasurableSpace α] {μ : Measure α} + {f : α → ℂ} (hf : MemLp f 2 μ) : + ‖hf.toLp f‖^2=∫ x, ‖f x‖^2 ∂μ := by + rw [norm_sq_eq_re_inner (𝕜 := ℂ),L2.inner_def,← integral_re] + · apply integral_congr_ae + filter_upwards [hf.coeFn_toLp] with x hx + rw [hx,inner_self_eq_norm_sq] + · exact L2.integrable_inner _ _ + +lemma bounded_toLp_tendsto {α ι : Type*} [MeasurableSpace α] {μ : Measure α} + [IsFiniteMeasure μ] {l : Filter ι} [l.IsCountablyGenerated] + {F : ι → α → ℂ} {f : α → ℂ} (hF : ∀ t, MemLp (F t) 2 μ) (hf : MemLp f 2 μ) + {C : ℝ} (_hC : 0≤C) (hFb : ∀ t x, ‖F t x‖≤C) (hfb : ∀ x, ‖f x‖≤C) + (ht : ∀ᵐ x ∂μ, Tendsto (fun t ↦ F t x) l (𝓝 (f x))) : + Tendsto (fun t ↦ (hF t).toLp (F t)) l (𝓝 (hf.toLp f)) := by + have H : Tendsto (fun t ↦ ∫ x, ‖F t x-f x‖^2 ∂μ) l (𝓝 0) := by + have h := tendsto_integral_filter_of_dominated_convergence (fun _ ↦ (2*C)^2) + (l := l) (F := fun t x ↦ ‖F t x-f x‖^2) (f := fun _ ↦ (0:ℝ)) + (Eventually.of_forall fun t ↦ ((hF t).aestronglyMeasurable.sub hf.aestronglyMeasurable).norm.pow 2) + (Eventually.of_forall fun t ↦ Eventually.of_forall fun x ↦ by + rw [Real.norm_eq_abs,abs_of_nonneg (sq_nonneg _)] + apply pow_le_pow_left₀ (norm_nonneg _) + exact (norm_sub_le _ _).trans (by linarith [hFb t x,hfb x])) + (integrable_const _) ?_ + · simpa only [integral_zero] using h + · filter_upwards [ht] with x hx + simpa using ((hx.sub (tendsto_const_nhds (x := f x))).norm.pow 2) + rw [tendsto_iff_dist_tendsto_zero] + have hsq : ∀ t, (dist ((hF t).toLp (F t)) (hf.toLp f))^2= + ∫ x, ‖F t x-f x‖^2 ∂μ := by + intro t + rw [dist_eq_norm,← MemLp.toLp_sub (hF t) hf] + exact norm_sq_toLp_eq_integral _ + have hroot := Real.continuous_sqrt.continuousAt.tendsto.comp H + simpa only [Function.comp_def,← hsq,Real.sqrt_sq (dist_nonneg),Real.sqrt_zero] using hroot + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/NormalizationDerivative.lean b/lean/OAI/Analysis/HardSphere/Geometry/NormalizationDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..03bfd775a8fe8d57ad31b5e4c69cd66bdae5ebae --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/NormalizationDerivative.lean @@ -0,0 +1,70 @@ +import Mathlib +import OAI.Analysis.HardSphere.Collisions.NormalizedInsertion +import OAI.Analysis.HardSphere.Geometry.TorusLiftBox + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate + +lemma SmoothMultiplier.normalization_derivative_le {n : ℕ} {L : Length} + (f : SmoothMultiplier (n+1) L) (hr : ∀ X, conj (f.toFun X)=f.toFun X) + (hp : ∀ Y, 0 + calc + encounterMass m t l = 1 := by + rw [encounterMass, show encounterEvent m t l = Set.univ by ext w; simp [encounterEvent], + pmf_outer_univ] + _ ≤ ∏ i, radiusFactor (l i) * gapKernel (timeGaps t i) := by rw [Fin.prod_univ_zero] + | succ n ih => + cases n with + | zero => + have h := encounter_singleton_bound m (t 0) (l 0) (hT 0) + have he : (fun _ : Fin 1 ↦ t 0) = t := by + funext i; exact congrArg t (Fin.ext (by omega)) + have hl : (fun _ : Fin 1 ↦ l 0) = l := by + funext i; exact congrArg l (Fin.ext (by omega)) + rw [he, hl] at h + rw [Fin.prod_univ_one, timeGaps_zero] + exact h + | succ n => + have hin : StrictMono (Fin.init t) := ht.comp (Fin.strictMono_castSucc) + have hb := ih (Fin.init t) (Fin.init l) hin (fun i ↦ hT i.castSucc) + have hlt : t (Fin.last n).castSucc < t (Fin.last (n+1)) := + ht (by simp) + have ha := encounter_append_bound m (t (Fin.last n).castSucc) (t (Fin.last (n+1))) + hlt (hT _) (Fin.init t) (Fin.init l) + (fun i ↦ ht.monotone (by exact_mod_cast Fin.le_last i)) (l (Fin.last (n+1))) + rw [Fin.snoc_init_self, Fin.snoc_init_self] at ha + refine ha.trans ?_ + rw [Fin.prod_univ_castSucc] + calc + _ ≤ radiusFactor (l (Fin.last (n+1))) * + gapKernel (t (Fin.last (n+1))-t (Fin.last n).castSucc) * + ∏ i, radiusFactor (Fin.init l i) * gapKernel (timeGaps (Fin.init t) i) := + mul_le_mul' le_rfl hb + _ = _ := by + simp_rw [timeGaps_castSucc] + change _ = _ * (radiusFactor (l (Fin.last (n+1))) * + gapKernel (t (Fin.last (n+1))-t (Fin.last n).castSucc)) + exact mul_comm _ _ + +lemma atomCoefficient_sq (k : ℕ) : + (atomCoefficient k)^2 = ENNReal.ofReal + (((6:ℝ)^sigma)^2 * (k:ℝ)^(-2*sigma)) := by + rw [atomCoefficient, ← ENNReal.ofReal_pow (by positivity), mul_pow] + congr 2 + rw [← Real.rpow_natCast, ← Real.rpow_mul (Nat.cast_nonneg k)] + congr 1 + ring + +lemma gapKernel_sum_ne_top : (∑' k, gapKernel k) ≠ ∞ := by + have hs : Summable (fun k : ℕ ↦ ((6:ℝ)^sigma)^2 * (k:ℝ)^(-2*sigma)) := + (Real.summable_nat_rpow.mpr (by linarith [sigma_gt_half])).mul_left _ + have he : (∑' k, (atomCoefficient k)^2) = + ENNReal.ofReal (∑' k : ℕ, ((6:ℝ)^sigma)^2 * (k:ℝ)^(-2*sigma)) := by + simp_rw [atomCoefficient_sq] + exact (ENNReal.ofReal_tsum_of_nonneg (fun _ ↦ by positivity) hs).symm + have hb : (∑' k, gapKernel k) ≤ 1 + ∑' k, (atomCoefficient k)^2 := by + calc + _ ≤ (∑' k : ℕ, ((if k = 0 then 1 else 0) + (atomCoefficient k)^2)) := by + apply ENNReal.tsum_le_tsum + intro k + by_cases h : k = 0 <;> simp [gapKernel, h] + _ = _ := by rw [ENNReal.tsum_add]; simp + rw [he] at hb + exact ne_top_of_le_ne_top (by finiteness) hb + +lemma gapKernel_sum_one_le : (1 : ℝ≥0∞) ≤ ∑' k, gapKernel k := by + simpa only [gapKernel, ↓reduceIte] using ENNReal.le_tsum (f := gapKernel) 0 + +def orderedEncounterConstant : ℝ := (4 * ∑' k, gapKernel k).toReal + +lemma orderedEncounterConstant_pos : 0 < orderedEncounterConstant := by + apply ENNReal.toReal_pos + · exact mul_ne_zero (by norm_num) (ne_of_gt (lt_of_lt_of_le (by norm_num) gapKernel_sum_one_le)) + · exact ENNReal.mul_ne_top (by norm_num) gapKernel_sum_ne_top + +lemma orderedEncounterConstant_cast : ENNReal.ofReal orderedEncounterConstant = + 4 * ∑' k, gapKernel k := + ENNReal.ofReal_toReal (ENNReal.mul_ne_top (by norm_num) gapKernel_sum_ne_top) + +lemma radiusFactor_le (l : ℕ) : radiusFactor l ≤ 4 * ((1+l : ℕ) : ℝ≥0∞)^2 := by + unfold radiusFactor + have h : (2*l+1)^2 ≤ 4*(1+l)^2 := by + calc + (2*l+1)^2 ≤ (2*(1+l))^2 := Nat.pow_le_pow_left (by omega) 2 + _ = _ := by ring + exact_mod_cast h + +theorem ordered_encounter_sum (m T n : ℕ) (hT : T ≤ 3^m) (l : Fin n → ℕ) : + (∑' t : {t : Fin n → ℕ // StrictMono t ∧ ∀ i, t i ≤ T}, encounterMass m t.val l) ≤ + ∏ i, ENNReal.ofReal orderedEncounterConstant * ((1+l i : ℕ) : ℝ≥0∞)^2 := by + calc + _ ≤ ∑' t : {t : Fin n → ℕ // StrictMono t ∧ ∀ i, t i ≤ T}, + ∏ i, radiusFactor (l i) * gapKernel (timeGaps t.val i) := by + exact ENNReal.tsum_le_tsum fun t ↦ encounterMass_le_gap_prod m n t.val l + t.property.1 (fun i ↦ (t.property.2 i).trans hT) + _ = (∏ i, radiusFactor (l i)) * + ∑' t : {t : Fin n → ℕ // StrictMono t ∧ ∀ i, t i ≤ T}, + ∏ i, gapKernel (timeGaps t.val i) := by + simp_rw [Finset.prod_mul_distrib, ENNReal.tsum_mul_left] + _ ≤ (∏ i, radiusFactor (l i)) * (∑' k, gapKernel k)^n := + mul_le_mul' le_rfl (ordered_gap_sum_bound T n gapKernel) + _ = ∏ i, radiusFactor (l i) * (∑' k, gapKernel k) := by + rw [Finset.prod_mul_distrib] + simp + _ ≤ ∏ i, ENNReal.ofReal orderedEncounterConstant * ((1+l i : ℕ) : ℝ≥0∞)^2 := by + apply Finset.prod_le_prod fun i _ ↦ ?_ + rw [orderedEncounterConstant_cast] + exact (mul_le_mul' (radiusFactor_le (l i)) le_rfl).trans_eq (by ring) + +def radiusEnvelope (a : ℕ → ℝ≥0∞) (z : ℤ × ℤ) : ℝ≥0∞ := + ∑' l, if z ∈ square l then a l else 0 + +lemma prod_ite_all {n : ℕ} (P : Fin n → Prop) (v : Fin n → ℝ≥0∞) : + (∏ i, if P i then v i else 0) = if ∀ i, P i then ∏ i, v i else 0 := by + by_cases h : ∀ i, P i + · simp [h] + · rw [ite_eq_right h] + obtain ⟨i,hi⟩ := not_forall.mp h + exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi) + +lemma radiusEnvelope_prod (m : ℕ) {n : ℕ} (t : Fin n → ℕ) (a : ℕ → ℝ≥0∞) + (w : FourNoise m) : + (∏ i, radiusEnvelope a (differenceAt m (t i) w)) = + ∑' l : Fin n → ℕ, if w ∈ encounterEvent m t l then ∏ i, a (l i) else 0 := by + unfold radiusEnvelope + rw [← tsum_vector_prod] + apply tsum_congr + intro l + by_cases h : w ∈ encounterEvent m t l + · rw [ite_eq_left h] + apply Finset.prod_congr rfl + intro i _ + exact ite_eq_left (h i) + · rw [ite_eq_right h] + have hn : ¬ ∀ i, differenceAt m (t i) w ∈ square (l i) := h + obtain ⟨i,hi⟩ := not_forall.mp hn + exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi) + +def weightedEncounterMass (m : ℕ) {n : ℕ} (t : Fin n → ℕ) (a : ℕ → ℝ≥0∞) : ℝ≥0∞ := + ∑' w, fourLaw m w * ∏ i, radiusEnvelope a (differenceAt m (t i) w) + +lemma weightedEncounterMass_eq (m : ℕ) {n : ℕ} (t : Fin n → ℕ) (a : ℕ → ℝ≥0∞) : + weightedEncounterMass m t a = + ∑' l : Fin n → ℕ, (∏ i, a (l i)) * encounterMass m t l := by + unfold weightedEncounterMass + calc + _ = ∑' w, ∑' l : Fin n → ℕ, fourLaw m w * + (if w ∈ encounterEvent m t l then ∏ i, a (l i) else 0) := by + apply tsum_congr + intro w + rw [radiusEnvelope_prod, ENNReal.tsum_mul_left] + _ = ∑' l : Fin n → ℕ, ∑' w, fourLaw m w * + (if w ∈ encounterEvent m t l then ∏ i, a (l i) else 0) := ENNReal.tsum_comm + _ = _ := by + apply tsum_congr + intro l + rw [encounterMass, PMF.toOuterMeasure_apply, ← ENNReal.tsum_mul_left] + apply tsum_congr + intro w + by_cases h : w ∈ encounterEvent m t l <;> simp [Set.indicator, h, mul_comm] + +def radiusActivity (a : ℕ → ℝ≥0∞) : ℝ≥0∞ := + ENNReal.ofReal orderedEncounterConstant * ∑' l, a l * ((1+l : ℕ) : ℝ≥0∞)^2 + +lemma weighted_ordered_sum_bound (m T n : ℕ) (hT : T ≤ 3^m) (a : ℕ → ℝ≥0∞) : + (∑' t : BoundedTimes T n, weightedEncounterMass m t.val a) ≤ (radiusActivity a)^n := by + simp_rw [weightedEncounterMass_eq] + rw [ENNReal.tsum_comm] + calc + _ = ∑' l : Fin n → ℕ, (∏ i, a (l i)) * + ∑' t : BoundedTimes T n, encounterMass m t.val l := by + apply tsum_congr + intro l + rw [ENNReal.tsum_mul_left] + _ ≤ ∑' l : Fin n → ℕ, (∏ i, a (l i)) * + ∏ i, ENNReal.ofReal orderedEncounterConstant * ((1+l i : ℕ) : ℝ≥0∞)^2 := by + exact ENNReal.tsum_le_tsum fun l ↦ mul_le_mul' le_rfl (ordered_encounter_sum m T n hT l) + _ = ∑' l : Fin n → ℕ, ∏ i, + ENNReal.ofReal orderedEncounterConstant * (a (l i) * ((1+l i : ℕ) : ℝ≥0∞)^2) := by + apply tsum_congr + intro l + rw [← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro i _ + ring + _ = _ := by + rw [tsum_vector_prod (fun (_ : Fin n) k ↦ + ENNReal.ofReal orderedEncounterConstant * (a k * ((1+k : ℕ) : ℝ≥0∞)^2))] + simp only [ENNReal.tsum_mul_left, radiusActivity, Finset.prod_const, + Finset.card_univ, Fintype.card_fin] + +lemma ordered_product_bound_envelope (m T : ℕ) (hT : T ≤ 3^m) (a : ℕ → ℝ≥0∞) : + (∑' w, fourLaw m w * ∏ u ∈ Finset.range (T+1), + (1+radiusEnvelope a (differenceAt m u w))) ≤ (1-radiusActivity a)⁻¹ := by + calc + _ ≤ ∑' w, fourLaw m w * ∑' n, ∑' t : BoundedTimes T n, + ∏ i, radiusEnvelope a (differenceAt m (t.val i) w) := by + exact ENNReal.tsum_le_tsum fun w ↦ mul_le_mul' le_rfl + (prod_one_add_le_ordered_series T (fun u ↦ radiusEnvelope a (differenceAt m u w))) + _ = ∑' n, ∑' t : BoundedTimes T n, weightedEncounterMass m t.val a := by + simp_rw [← ENNReal.tsum_mul_left] + rw [ENNReal.tsum_comm] + apply tsum_congr + intro n + rw [ENNReal.tsum_comm] + rfl + _ ≤ ∑' n, (radiusActivity a)^n := + ENNReal.tsum_le_tsum fun n ↦ weighted_ordered_sum_bound m T n hT a + _ = _ := ENNReal.tsum_geometric _ + +theorem ordered_product_bound (m T : ℕ) (hT : T ≤ 3^m) (a : ℕ → ℝ≥0∞) + (f : ℤ × ℤ → ℝ≥0∞) (hf : ∀ z, f z ≤ radiusEnvelope a z) + (ha : radiusActivity a < 1) : + (∑' w, fourLaw m w * ∏ u ∈ Finset.range (T+1), (1+f (differenceAt m u w))) ≤ + (1-radiusActivity a)⁻¹ ∧ (1-radiusActivity a)⁻¹ < ∞ := by + constructor + · refine (ENNReal.tsum_le_tsum fun w ↦ mul_le_mul' le_rfl ?_).trans + (ordered_product_bound_envelope m T hT a) + exact Finset.prod_le_prod fun u _ ↦ add_le_add_right (hf _) 1 + · exact ENNReal.inv_lt_top.mpr (tsub_pos_iff_lt.mpr ha) + +lemma exp_sub_one_le_slope {x B : ℝ} (hx : 0 ≤ x) (hB : x ≤ B) : + Real.exp x - 1 ≤ Real.exp B * x := by + have h := mul_le_mul_of_nonneg_left (Real.add_one_le_exp (-x)) (Real.exp_pos x).le + rw [← Real.exp_add, add_neg_cancel, Real.exp_zero] at h + have he : Real.exp x ≤ Real.exp B := Real.exp_le_exp.mpr hB + nlinarith [mul_le_mul_of_nonneg_right he hx] + +lemma radiusEnvelope_smul (c : ℝ≥0∞) (a : ℕ → ℝ≥0∞) (z : ℤ × ℤ) : + radiusEnvelope (fun l ↦ c*a l) z = c*radiusEnvelope a z := by + unfold radiusEnvelope + rw [← ENNReal.tsum_mul_left] + apply tsum_congr + intro l + by_cases h : z ∈ square l <;> simp [h] + +end HardSphere.Lattice +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/ParentStep.lean b/lean/OAI/Analysis/HardSphere/Geometry/ParentStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..dcada8256017eb247ad378720fbe8c8bd2ee2f13 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/ParentStep.lean @@ -0,0 +1,177 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.AnimalFamily + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +noncomputable section +open scoped BigOperators Classical +noncomputable section +open scoped BigOperators Classical +noncomputable section +open scoped BigOperators Classical ENNReal +namespace HardSphere.BathSlice +open HardSphere.Lattice + +lemma parent_step {q : ℕ} (hq : 0 < q) {z w : Vertex} (hzw : starStep z w) : + parent q z = parent q w ∨ rangeStep 1 (parent q z) (parent q w) := by + by_cases he : parent q z = parent q w + · exact Or.inl he + right + refine ⟨he,fun i ↦ ?_⟩ + have hqz : (0:ℤ) intro i + · change (q:ℤ)*v i ≤ z i + have he := Int.mul_ediv_add_emod (z i) q + have hi : z i/(q:ℤ)=v i := congrFun hz i + have hn := Int.emod_nonneg (z i) hqz.ne' + rw [hi] at he + omega + · change z i ≤ (q:ℤ)*v i+q + have he := Int.mul_ediv_add_emod (z i) q + have hi : z i/(q:ℤ)=v i := congrFun hz i + have hn := Int.emod_lt_of_pos (z i) hqz + rw [hi] at he + omega + +lemma parent_preimage_finite {q : ℕ} (hq : 0 < q) (C : Finset Vertex) : + ((parent q) ⁻¹' (↑C : Set Vertex)).Finite := by + have hf : (⋃ v ∈ (↑C : Set Vertex), {z | parent q z=v}).Finite := + C.finite_toSet.biUnion (fun v _ ↦ parent_fiber_finite hq v) + apply hf.subset + intro z hz + exact Set.mem_iUnion.mpr ⟨parent q z,Set.mem_iUnion.mpr ⟨hz,rfl⟩⟩ + +lemma parent_reach {q : ℕ} (hq : 0 < q) {D E : Set Vertex} + (hDE : ∀ z ∈ D, parent q z ∈ E) {z w : Vertex} + (hp : withinReach starStep D z w) : + withinReach (rangeStep 1) E (parent q z) (parent q w) := by + induction hp with + | refl => exact .refl + | @tail u v _ huv ih => + rcases parent_step hq huv.2.2 with he | he + · simpa only [←he] using ih + · exact ih.tail ⟨hDE u huv.1,hDE v huv.2.1,he⟩ + +lemma parent_projection_reachable {q K : ℕ} (hq : 0 < q) (hK : 2 < K) + {D : Set Vertex} {B : Finset (DiscreteTorus K)} + (hDB : ∀ z ∈ D, torusProjection K (parent q z) ∈ B) {z w : Vertex} + (hp : withinReach starStep D z w) : + (badGraph (torusRangeGraph K 1) B).Reachable + (torusProjection K (parent q z)) (torusProjection K (parent q w)) := by + rw [SimpleGraph.reachable_iff_reflTransGen] + induction hp with + | refl => exact .refl + | @tail u v _ huv ih => + rcases parent_step hq huv.2.2 with he | he + · simpa only [←he] using ih + · exact ih.tail ⟨hDB u huv.1,hDB v huv.2.1, + rangeStep_projection (by simpa only [mul_one] using hK) he⟩ +end HardSphere.BathSlice + +namespace HardSphere.Lattice +universe v +variable {V : Type v} [Fintype V] [DecidableEq V] + +omit [Fintype V] [DecidableEq V] in +lemma badGraph_reachable_induce {G : SimpleGraph V} {B : Finset V} {x y : V} + (hp : (badGraph G B).Reachable x y) (hx : x ∈ B) (hy : y ∈ B) : + (G.induce (↑B : Set V)).Reachable ⟨x,hx⟩ ⟨y,hy⟩ := by + rw [SimpleGraph.reachable_iff_reflTransGen] at hp ⊢ + induction hp with + | refl => exact .refl + | @tail u v _ huv ih => exact (ih huv.1).tail huv.2.2 + +lemma badComponent_preconnected (G : SimpleGraph V) (B : Finset V) (x : V) : + (G.induce (↑(badComponent G B x) : Set V)).Preconnected := by + intro u v + have hu := (mem_badComponent G B x u).mp u.property + have hv := (mem_badComponent G B x v).mp v.property + have hp := (reachable_inside_component G B hu.2).symm.trans + (reachable_inside_component G B hv.2) + exact badGraph_reachable_induce hp u.property v.property +end HardSphere.Lattice + +namespace HardSphere.BathSlice +open HardSphere.Lattice + +theorem parent_component_lift {q K : ℕ} [NeZero K] (hq : 0 < q) (hK : 2 < K) + {D : Set Vertex} (hD : starConnected D) {z : Vertex} (hz : z ∈ D) + (B : Finset (DiscreteTorus K)) (hDB : ∀ w ∈ D, torusProjection K (parent q w) ∈ B) + (hsmall : (badComponent (torusRangeGraph K 1) B (torusProjection K (parent q z))).card < K) : + ∃ C : Finset Vertex, + (∀ w ∈ D, parent q w ∈ C) ∧ + Set.BijOn (torusProjection K) (↑C) + (↑(badComponent (torusRangeGraph K 1) B (torusProjection K (parent q z)))) ∧ + (∀ u∈C, ∀ v∈C, ∀ i, |u i-v i| ≤ + ((badComponent (torusRangeGraph K 1) B (torusProjection K (parent q z))).card:ℤ)-1) := by + classical + let S := badComponent (torusRangeGraph K 1) B (torusProjection K (parent q z)) + have hmem : ∀ w ∈ D, torusProjection K (parent q w) ∈ S := by + intro w hw + apply (mem_badComponent _ _ _ _).mpr + exact ⟨hDB w hw,parent_projection_reachable hq hK hDB (hD z hz w hw)⟩ + obtain ⟨C,hC,hbij,hspan⟩ := small_periodic_lifts (a := 1) + (by simpa only [mul_one] using hK) S (by simpa only [one_mul] using hsmall) + (badComponent_preconnected _ _ _) (parent q z) (hmem z hz) + refine ⟨C,?_,hbij,?_⟩ + · intro w hw + change parent q w ∈ (↑C : Set Vertex) + rw [hC] + exact ⟨hmem w hw,parent_reach hq (fun u hu ↦ hmem u hu) (hD z hz w hw)⟩ + · simpa only [Nat.cast_one,one_mul] using hspan + +theorem finite_of_parent_component_small {q K : ℕ} [NeZero K] (hq : 0 < q) (hK : 2 < K) + {D : Set Vertex} (hD : starConnected D) {z : Vertex} (hz : z ∈ D) + (B : Finset (DiscreteTorus K)) (hDB : ∀ w ∈ D, torusProjection K (parent q w) ∈ B) + (hsmall : (badComponent (torusRangeGraph K 1) B (torusProjection K (parent q z))).card < K) : + D.Finite := by + obtain ⟨C,hC,_,_⟩ := parent_component_lift hq hK hD hz B hDB hsmall + exact (parent_preimage_finite hq C).subset hC + +end HardSphere.BathSlice + +namespace HardSphere.Lattice +lemma liftedBadComponent_eq_of_mem {B : Set Vertex} {z w : Vertex} + (hw : w ∈ liftedBadComponent B z) : liftedBadComponent B w = liftedBadComponent B z := by + ext v + constructor + · intro hv + exact ⟨hw.1,hv.2.1,hw.2.2.trans hv.2.2⟩ + · intro hv + exact ⟨hw.2.1,hv.2.1,(withinReach_symm (fun _ _ ↦ starStep_symm) hw.2.2).trans hv.2.2⟩ + +lemma own_badComponent_card_lt {V : Type*} [Fintype V] [DecidableEq V] + (G : SimpleGraph V) (B : Finset V) {M : ℕ} (he : ¬LargeBadComponent G B M) + {v : V} (hv : v ∈ B) : (badComponent G B v).card < M := by + apply lt_of_not_ge + intro h + exact he ⟨_,Finset.mem_image.mpr ⟨v,hv,rfl⟩,h⟩ +end HardSphere.Lattice + +end +end +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/ParticleGradSq.lean b/lean/OAI/Analysis/HardSphere/Geometry/ParticleGradSq.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac9197f3d18476b87818752e4d9dffeb16e16490 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/ParticleGradSq.lean @@ -0,0 +1,115 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.RadialIndicator + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere.SphericalCoordinates +open Filter +open scoped Topology BigOperators + +def particleGradSq {n : ℕ} {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (F : (Fin n → Point) → E) (i : Fin n) (X : Fin n → Point) : ℝ := + ‖fderiv ℝ F X (Pi.single i axis0)‖^2+ + ‖fderiv ℝ F X (Pi.single i axis1)‖^2+ + ‖fderiv ℝ F X (Pi.single i axis2)‖^2 + +lemma insertNth_affine {n : ℕ} (i : Fin (n+1)) (Y : Fin n → Point) (x : Point) : + i.insertNth x Y=(ContinuousLinearMap.single ℝ (fun _ : Fin (n+1) ↦ Point) i) x+i.insertNth 0 Y := by + funext k + induction k using i.succAboveCases with + | x => simp + | p k => simp [Fin.succAbove_ne] + +lemma contDiff_coordinate_slice {n : ℕ} {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {F : (Fin (n+1) → Point) → E} (hF : ContDiff ℝ 1 F) (i : Fin (n+1)) (Y : Fin n → Point) : + ContDiff ℝ 1 (fun x ↦ F (i.insertNth x Y)) := by + have he : (fun x : Point ↦ i.insertNth x Y)=fun x ↦ + (ContinuousLinearMap.single ℝ (fun _ : Fin (n+1) ↦ Point) i) x+i.insertNth 0 Y := funext (insertNth_affine i Y) + change ContDiff ℝ 1 (F ∘ fun x : Point ↦ i.insertNth x Y) + rw [he] + exact hF.comp ((ContinuousLinearMap.contDiff _).add contDiff_const) + +lemma fderiv_coordinate_slice {n : ℕ} {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {F : (Fin (n+1) → Point) → E} (hF : ContDiff ℝ 1 F) + (i : Fin (n+1)) (Y : Fin n → Point) (x : Point) : + fderiv ℝ (fun z ↦ F (i.insertNth z Y)) x= + (fderiv ℝ F (i.insertNth x Y)).comp (ContinuousLinearMap.single ℝ (fun _ : Fin (n+1) ↦ Point) i) := by + have hi : HasFDerivAt (fun z : Point ↦ i.insertNth z Y) + (ContinuousLinearMap.single ℝ (fun _ : Fin (n+1) ↦ Point) i) x := by + have he : (fun x : Point ↦ i.insertNth x Y)=fun x ↦ + (ContinuousLinearMap.single ℝ (fun _ : Fin (n+1) ↦ Point) i) x+i.insertNth 0 Y := funext (insertNth_affine i Y) + rw [he] + exact (ContinuousLinearMap.hasFDerivAt _).add_const _ + have hf := ((hF.differentiable (by norm_num) (i.insertNth x Y)).hasFDerivAt).comp x hi + simpa only [Function.comp_def] using hf.fderiv + +lemma gradSq_coordinate_slice {n : ℕ} {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {F : (Fin (n+1) → Point) → E} (hF : ContDiff ℝ 1 F) + (i : Fin (n+1)) (Y : Fin n → Point) (x : Point) : + gradSq (fun z ↦ F (i.insertNth z Y)) x=particleGradSq F i (i.insertNth x Y) := by + simp only [gradSq,fderiv_coordinate_slice hF,ContinuousLinearMap.comp_apply, + ContinuousLinearMap.single_apply,particleGradSq] + +lemma continuous_particleGradSq {n : ℕ} {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {F : (Fin n → Point) → E} (hF : ContDiff ℝ 1 F) (i : Fin n) : + Continuous (particleGradSq F i) := by + have hd := hF.continuous_fderiv (by norm_num) + unfold particleGradSq + exact (((hd.clm_apply continuous_const).norm.pow 2).add + ((hd.clm_apply continuous_const).norm.pow 2)).add + ((hd.clm_apply continuous_const).norm.pow 2) + +lemma lintegral_insertNth {n : ℕ} (μ : Fin (n+1) → Measure Point) [∀i,SigmaFinite (μ i)] + (i : Fin (n+1)) (H : (Fin (n+1) → Point) → ℝ≥0∞) (hH : Measurable H) : + (∫⁻ X, H X ∂Measure.pi μ)= + ∫⁻ Y, ∫⁻ x, H (i.insertNth x Y) ∂μ i ∂Measure.pi (fun j ↦ μ (i.succAbove j)) := by + let e := MeasurableEquiv.piFinSuccAbove (fun _ : Fin (n+1) ↦ Point) i + have he := (measurePreserving_piFinSuccAbove μ i).symm + rw [← he.lintegral_comp_emb e.symm.measurableEmbedding H] + simp only [MeasurableEquiv.piFinSuccAbove_symm_apply,Fin.insertNthEquiv,Equiv.coe_fn_mk] + apply lintegral_prod_symm + exact (hH.comp e.symm.measurable).aemeasurable + +lemma sector_coordinate_capacity {n : ℕ} {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {F : (Fin (n+1) → Point) → E} (hF : ContDiff ℝ 1 F) + {r l : ℝ} (hr : 0 simp + simp_rw [he] + simpa using binary_product_sum f (fun b ↦ if b then f j true else 0) j hf + +lemma productPartition_selected_probability {n : ℕ} {L : Length} (a c : SmoothMultiplier 1 L) + (ha : ∀ X, conj (a.toFun X)=a.toFun X) (hc : ∀ X, conj (c.toFun X)=c.toFun X) + (hp : ∀ x : Torus L, a.orbital x*a.orbital x+c.orbital x*c.orbital x=1) + (X : Configuration n L) (i : Fin n) : + (∑ σ : Fin n → Bool, (if σ i then (1:ℝ) else 0)*‖(productPartition n L a c σ).toFun X‖^2)= + ‖a.orbital (X i)‖^2 := by + simp_rw [productPartition_apply,norm_prod,← Finset.prod_pow] + apply binary_product_membership (fun j b ↦ ‖(cond b a c).orbital (X j)‖^2) i + intro j + change ‖a.orbital (X j)‖^2+‖c.orbital (X j)‖^2=1 + rw [real_norm_sq (a.orbital (X j)) (ha (fun _ ↦ X j)), + real_norm_sq (c.orbital (X j)) (hc (fun _ ↦ X j)),← Complex.add_re,hp,Complex.one_re] + +theorem productPartition_removal_cost {n : ℕ} {L : Length} (a c : SmoothMultiplier 1 L) + (ha : ∀ X, conj (a.toFun X)=a.toFun X) (hc : ∀ X, conj (c.toFun X)=c.toFun X) + (hp : ∀ x : Torus L, a.orbital x*a.orbital x+c.orbital x*c.orbital x=1) (u : ScalarL2 n L) : + (∑ σ : Fin n → Bool, (∑ i : Fin n, if σ i then (1:ℝ) else 0)* + ‖(productPartition n L a c σ).onScalar u‖^2)= + ∫ X, (∑ i : Fin n, ‖a.orbital (X i)‖^2)*‖u X‖^2 := by + simp_rw [IndicatorStrong.norm_sq_integral,← integral_const_mul] + rw [← integral_finsetSum Finset.univ (fun σ _ ↦ + ((Lp.memLp ((productPartition n L a c σ).onScalar u)).integrable_norm_pow (by norm_num)).const_mul _)] + have hcoe : ∀ᵐ X ∂volume, ∀ σ, ((productPartition n L a c σ).onScalar u) X= + (productPartition n L a c σ).toFun X*u X := + ae_all_iff.mpr (fun _ ↦ SmoothMultiplier.coe_onScalar _ _) + apply integral_congr_ae + filter_upwards [hcoe] with X hX + simp_rw [hX,norm_mul,mul_pow,← mul_assoc] + rw [← Finset.sum_mul] + congr 1 + simp_rw [Finset.sum_mul] + rw [Finset.sum_comm] + simp_rw [productPartition_selected_probability a c ha hc hp] + +end HardSphere + +namespace HardSphere +open MeasureTheory Set Filter + +noncomputable def selectedEnergy {n : ℕ} {L : Length} (p : Fin n → Prop) [DecidablePred p] + (u : Jet n L) : ℝ := ∑ i : {i // p i}, ∑ q : Fin 3, ‖u.2 (i.val,q)‖^2 + +lemma continuous_selectedEnergy {n : ℕ} {L : Length} (p : Fin n → Prop) [DecidablePred p] : + Continuous (selectedEnergy (L:=L) p) := + continuous_finsetSum _ (fun i _ ↦ continuous_finsetSum _ + (fun q _ ↦ ((continuous_apply (i.val,q)).comp continuous_snd).norm.pow 2)) + +def selectedAllEquiv {n : ℕ} (p : Fin n → Prop) (hp : ∀ i, p i) : {i // p i} ≃ Fin n := + Equiv.ofBijective Subtype.val ⟨Subtype.val_injective,fun i ↦ ⟨⟨i,hp i⟩,rfl⟩⟩ + +lemma selectedEnergy_all {n : ℕ} {L : Length} (p : Fin n → Prop) [DecidablePred p] + (hp : ∀ i, p i) (u : Jet n L) : selectedEnergy p u=energy u := by + rw [selectedEnergy,energy,Fintype.sum_prod_type] + exact Fintype.sum_equiv (selectedAllEquiv p hp) _ _ (fun _ ↦ rfl) + +def selectedDeleteEquiv {n : ℕ} (p : Fin (n+1) → Prop) (j : Fin (n+1)) (hj : ¬p j) : + {i : Fin n // p (j.succAbove i)} ≃ {i : Fin (n+1) // p i} := + Equiv.ofBijective (fun i ↦ ⟨j.succAbove i.val,i.property⟩) (by + constructor + · intro x y h + apply Subtype.ext + exact Fin.succAbove_right_injective (congrArg Subtype.val h) + · intro x + have hx : x.val≠j := by intro h; exact hj (h ▸ x.property) + obtain ⟨i,hi⟩ := Fin.exists_succAbove_eq hx + refine ⟨⟨i,hi ▸ x.property⟩,?_⟩ + exact Subtype.ext hi) + +lemma SmoothTest.selected_slice_integrable {n : ℕ} {L : Length} {a : ℝ} + (f : SmoothTest (n+1) L a) (p : Fin n → Prop) [DecidablePred p] (j : Fin (n+1)) : + Integrable (fun x : Torus L ↦ selectedEnergy p (f.slice j x).jet) volume := + integrable_finsetSum _ (fun i _ ↦ integrable_finsetSum _ (fun q _ ↦ f.slice_partial_integrable j (i.val,q))) + +lemma SmoothTest.integral_selected_slice {n : ℕ} {L : Length} {a : ℝ} + (f : SmoothTest (n+1) L a) (p : Fin (n+1) → Prop) [DecidablePred p] + (j : Fin (n+1)) (hj : ¬p j) : + (∫ x : Torus L, selectedEnergy (fun i ↦ p (j.succAbove i)) (f.slice j x).jet)=selectedEnergy p f.jet := by + simp only [selectedEnergy] + rw [integral_finsetSum _ (fun i _ ↦ + integrable_finsetSum _ (fun q _ ↦ f.slice_partial_integrable j (i.val,q)))] + simp_rw [integral_finsetSum _ (fun q _ ↦ f.slice_partial_integrable j (_,q)), + f.integral_slice_partial] + exact Fintype.sum_equiv (selectedDeleteEquiv p j hj) _ _ (fun _ ↦ rfl) + +theorem selected_rayleigh (n : ℕ) : + ∀ (k : ℕ) (L : Length) (a c : ℝ), + (∀ v : Jet k L, v∈dirichletDomain k L a → c*‖v.1‖^2≤energy v) → + ∀ (p : Fin n → Prop) [DecidablePred p], Fintype.card {i // p i}=k → + ∀ u : Jet n L, u∈dirichletDomain n L a → c*‖u.1‖^2≤ selectedEnergy p u := by + induction n with + | zero => + intro k L a c h p _ hp u hu + have hk : k=0 := by simpa using hp.symm + rw [hk] at h + simpa [selectedEnergy,energy,Direction] using h u hu + | succ n ih => + intro k L a c h p _ hp u hu + by_cases hall : ∀ i, p i + · have hk : k=n+1 := by + rw [←hp,Fintype.card_congr (selectedAllEquiv p hall),Fintype.card_fin] + rw [hk] at h + rw [selectedEnergy_all p hall] + exact h u hu + · obtain ⟨j,hj⟩ := not_forall.mp hall + have hk : Fintype.card {i : Fin n // p (j.succAbove i)}=k := + (Fintype.card_congr (selectedDeleteEquiv p j hj)).trans hp + have htest (f : SmoothTest (n+1) L a) : c*‖f.jet.1‖^2≤ selectedEnergy p f.jet := by + have hh := integral_mono ((f.slice_norm_sq_integrable j).const_mul c) + (f.selected_slice_integrable (fun i ↦ p (j.succAbove i)) j) + (fun x ↦ ih k L a c h (fun i ↦ p (j.succAbove i)) hk + (f.slice j x).jet (subset_closure ⟨f.slice j x,rfl⟩)) + rw [integral_const_mul,f.integral_slice_norm_sq,f.integral_selected_slice p j hj] at hh + exact hh + have hc : IsClosed {u : Jet (n+1) L | c*‖u.1‖^2≤ selectedEnergy p u} := + isClosed_le (continuous_const.mul (continuous_fst.norm.pow 2)) (continuous_selectedEnergy p) + exact hc.closure_subset_iff.mpr (by rintro _ ⟨f,rfl⟩; exact htest f) hu + +theorem selected_ground_removal : ∃ C : ℝ, 0 rfl + · congr 2 + apply Finset.sum_congr rfl + intro F hF + split_ifs <;> rfl + _ = _ := by rw [← ENNReal.ofReal_mul (Real.exp_pos _).le,← Real.exp_add] + +def pathEncounter {K : ℕ} (R : ℕ) {B : Finset (DiscreteTorus K)} {x y : DiscreteTorus K} + (p q : SimpleGoodPath B x y) : ℕ := + (encounterSet (torusNear K R) p.val.support.toFinset q.val.support.toFinset).card + +def pathKernelMoment {K : ℕ} (R : ℕ) (κ : ℝ) {B : Finset (DiscreteTorus K)} {x y : DiscreteTorus K} + (ν : PMF (SimpleGoodPath B x y)) : ℝ≥0∞ := + ∑' p, ν p*∑' q, ν q*ENNReal.ofReal (Real.exp (κ*(pathEncounter R p q:ℝ))) + +lemma goodPathKernel_moment_noises {K m n : ℕ} [NeZero K] (hK : 2 try rfl + funext w p + simp [permuteCoordinatePaths,MeasurableEquiv.coe_piCongrLeft,Equiv.piCongrLeft_apply_eq_cast] + rfl + +lemma freeTrajectory_permute {n : ℕ} (L : Length) (t : ℝ) (σ : Equiv.Perm (Fin n)) + (w : CoordinatePaths n) (X : Configuration n L) : + freeTrajectory n L t (permuteCoordinatePaths σ w) (permuteConfiguration σ X)= + permuteConfigurationPath σ (freeTrajectory n L t w X) := rfl + +lemma permute_freePath_preserving {n : ℕ} (L : Length) (t : ℝ) (σ : Equiv.Perm (Fin n)) : + MeasurePreserving (permuteConfigurationPath σ) (freePathLaw n L t) (freePathLaw n L t) := by + refine ⟨(permuteConfigurationPath_continuous σ).measurable,?_⟩ + have h := (permuteCoordinatePaths_preserving σ).prod (measurePreserving_permute (L:=L) σ) + rw [freePathLaw,Measure.map_map (permuteConfigurationPath_continuous σ).measurable + (freeTrajectory_continuous n L t).measurable] + conv_rhs => rw [←h.map_eq] + rw [Measure.map_map (freeTrajectory_continuous n L t).measurable h.measurable] + rfl + +lemma permute_staysAllowed {n : ℕ} (L : Length) (r : ℝ) (σ : Equiv.Perm (Fin n)) : + permuteConfigurationPath σ ⁻¹' staysAllowed n L r = staysAllowed n L r := by + ext ω + simp only [Set.mem_preimage,staysAllowed,Set.mem_ofPred_eq,Set.range_subset_iff] + constructor + · intro h s + exact (allowed_permute σ (ω s)).mp (h s) + · intro h s + exact (allowed_permute σ (ω s)).mpr (h s) + +lemma permute_killedPath_preserving {n : ℕ} (L : Length) (r t : ℝ) (σ : Equiv.Perm (Fin n)) : + MeasurePreserving (permuteConfigurationPath σ) (killedPathLaw n L r t) (killedPathLaw n L r t) := by + have h := (permute_freePath_preserving L t σ).restrict_preimage (staysAllowed_open n L r).measurableSet + rw [permute_staysAllowed] at h + exact h + +lemma measurePreserving_weighted_ae_invariant {α : Type*} [MeasurableSpace α] + {μ : Measure α} {R : α → α} (hR : MeasurePreserving R μ μ) + (w : α → ℝ≥0∞) (hw : Measurable w) (hi : (fun x ↦ w (R x)) =ᵐ[μ] w) : + MeasurePreserving R (μ.withDensity w) (μ.withDensity w) := by + refine ⟨hR.measurable,Measure.ext fun S hS ↦ ?_⟩ + rw [Measure.map_apply hR.measurable hS,withDensity_apply _ (hS.preimage hR.measurable), + withDensity_apply _ hS,←lintegral_indicator (hS.preimage hR.measurable),←lintegral_indicator hS] + calc + _ = ∫⁻ x, (S.indicator w) (R x) ∂μ := by + apply lintegral_congr_ae + filter_upwards [hi] with x hx + by_cases h : R x∈S + · simp only [Set.indicator_of_mem h,Set.indicator_of_mem (show x∈R ⁻¹' S from h),hx] + · simp only [Set.indicator_of_notMem h,Set.indicator_of_notMem (show x∉R ⁻¹' S from h)] + _ = _ := hR.lintegral_comp (hw.indicator hS) + +lemma groundPositionLaw_permute {n : ℕ} {L : Length} (u : Jet n L) (hb : bosonic u.1) + (σ : Equiv.Perm (Fin n)) : + MeasurePreserving (permuteConfiguration σ) (groundPositionLaw n L u) (groundPositionLaw n L u) := by + apply measurePreserving_weighted_ae_invariant (measurePreserving_permute σ) _ + ((Lp.stronglyMeasurable u.1).measurable.norm.pow_const 2).ennreal_ofReal + filter_upwards [hb σ] with X hX + change ENNReal.ofReal (‖u.1 (fun i ↦ X (σ i))‖^2)=ENNReal.ofReal (‖u.1 X‖^2) + rw [hX] + +lemma groundPathLaw_permute {n : ℕ} {L : Length} (u : Jet n L) (hb : bosonic u.1) + (r t : ℝ) (σ : Equiv.Perm (Fin n)) : + MeasurePreserving (permuteConfigurationPath σ) (groundPathLaw n L r t u) (groundPathLaw n L r t u) := by + apply measurePreserving_weighted_ae_invariant (permute_killedPath_preserving L r t σ) _ + (groundPathWeight_measurable u t).ennreal_ofReal + have hp (s : Time) := (((freePathLaw_marginal n L t s).quasiMeasurePreserving.ae_eq_comp + (hb σ)).filter_mono (ae_mono (Measure.restrict_le_self (s:=staysAllowed n L r)))) + filter_upwards [hp 0,hp 1] with ω h0 h1 + simp only [Function.comp_def] at h0 h1 + change ENNReal.ofReal (Real.exp (t*energy u)*(‖u.1 (fun i ↦ ω 0 (σ i))‖* + ‖u.1 (fun i ↦ ω 1 (σ i))‖))=ENNReal.ofReal (Real.exp (t*energy u)*(‖u.1 (ω 0)‖*‖u.1 (ω 1)‖)) + rw [h0,h1] + +end HardSphere + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/PathSlots.lean b/lean/OAI/Analysis/HardSphere/Geometry/PathSlots.lean new file mode 100644 index 0000000000000000000000000000000000000000..c1c4f8a54092e7b7fe91ad3ab16dc87b64a89d97 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/PathSlots.lean @@ -0,0 +1,103 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.SimplePath +import OAI.Analysis.HardSphere.Conditioning.RoutePartition + +namespace OAI + +section + +section +noncomputable section +open scoped Classical +namespace HardSphere.Comparison +open HardSphere.Lattice +variable {K : ℕ} {x y : DiscreteTorus K} {J : Type*} + +def pathVertexEmbedding (p : SimplePath x y) : Fin (p.val.length+1)↪DiscreteTorus K where + toFun i := p.val.getVert i.val + inj' := by + intro i j hij + apply Fin.ext + exact p.property.getVert_injOn (Nat.le_of_lt_succ i.isLt) + (Nat.le_of_lt_succ j.isLt) hij +@[simp] lemma pathVertex_zero (p : SimplePath x y) : pathVertexEmbedding p 0=x := by + exact p.val.getVert_zero +@[simp] lemma pathVertex_last (p : SimplePath x y) : + pathVertexEmbedding p (Fin.last p.val.length)=y := p.val.getVert_length + +def departureEmbedding (p : SimplePath x y) (anchor : J→DiscreteTorus K) + (pick : Fin p.val.length→J) + (hpick : ∀i,anchor (pick i)=pathVertexEmbedding p i.castSucc) : Fin p.val.length↪J where + toFun := pick + inj' := by + intro i j h + have he := congrArg anchor h + rw [hpick i,hpick j] at he + have hv := (pathVertexEmbedding p).injective he + exact Fin.ext (congrArg (fun k : Fin (p.val.length+1) ↦ k.val) hv) +def extendedAnchor (anchor : J→DiscreteTorus K) (y : DiscreteTorus K) : Option J→DiscreteTorus K := + fun o ↦ o.elim y anchor + +lemma routeEmbedding_anchor (p : SimplePath x y) (anchor : J→DiscreteTorus K) + (pick : Fin p.val.length→J) + (hpick : ∀i,anchor (pick i)=pathVertexEmbedding p i.castSucc) + (i : Fin (p.val.length+1)) : + extendedAnchor anchor y (routeEmbedding (departureEmbedding p anchor pick hpick) i)= + pathVertexEmbedding p i := by + by_cases hi : i.val simp [groupAt,he] at hi + | some f => + simp only [groupAt,he,Finset.mem_image,Finset.mem_univ,true_and] at hi + obtain ⟨k,rfl⟩ := hi + exact (Finset.mem_filter.mp (allocationPMF_support _ _ _ (ha v) f he _)).2 + +theorem physicalDatum_selected_geometry {N K M G : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) + (g : Fin G) (m : ℕ) (r R C S s₀ : ℝ) (u : Time) + (ω : ConfigurationPath N L) (a : GridAllocation N K (G*M)) + (ha : ∀v,a v∈(allocationPMF (eligibleList m r R C S s₀ u v ω) (G*M)).support) + (i : Fin N) (hi : i∈groupUnion g a) : + let d := physicalDatum g m r R C S s₀ u (ω,a) + ‖datumStart hL d i-anchorPoint (datumHome hL d i)‖≤3 ∧ + ‖datumEnd hL d i-anchorPoint (datumHome hL d i)‖≤3 ∧ + ∀j,j≠i→s₀ simp [groupAt,he] + | some f => simpa only [groupAt,he,Finset.card_univ,Fintype.card_fin] using + (Finset.card_image_le (s:=Finset.univ) (f:=fun k : Fin M ↦ f (groupPosition M G g k))) + +theorem physicalDatum_group_multiplicity {N K M G : ℕ} {L : Length} + (hL : L.val=(K:ℝ)) (hK : 1≤K) + (g : Fin G) (m : ℕ) (r R C S s₀ : ℝ) (u : Time) + (ω : ConfigurationPath N L) (a : GridAllocation N K (G*M)) + (ha : ∀v,a v∈(allocationPMF (eligibleList m r R C S s₀ u v ω) (G*M)).support) + (v : Fin 3→Fin K) : + (Finset.univ.filter (fun i : {i // i∈groupUnion g a} ↦ + datumHome hL (physicalDatum g m r R C S s₀ u (ω,a)) i=v)).card≤M := by + let s := Finset.univ.filter (fun i : {i // i∈groupUnion g a} ↦ + datumHome hL (physicalDatum g m r R C S s₀ u (ω,a)) i=v) + have hs : s.image Subtype.val⊆groupAt g a v := by + intro i hi + obtain ⟨j,hj,rfl⟩ := Finset.mem_image.mp hi + obtain ⟨w,_,hjw⟩ := Finset.mem_biUnion.mp j.property + have he := supported_groupAt_eligible g m r R C S s₀ u ω a ha w j hjw + have hh := physicalDatum_home hL hK g m r R C S s₀ u ω a w j he + have hv := (Finset.mem_filter.mp hj).2 + have hw : w=v := hh.symm.trans hv + simpa only [hw] using hjw + have hc := (Finset.card_le_card hs).trans (groupAt_card_le g a v) + rw [Finset.card_image_of_injective _ Subtype.val_injective] at hc + exact hc + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/PhysicalPathComparison.lean b/lean/OAI/Analysis/HardSphere/Geometry/PhysicalPathComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..6052486464450c42cc770eb0911d044035e7a6e8 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/PhysicalPathComparison.lean @@ -0,0 +1,90 @@ +import Mathlib +import OAI.Analysis.HardSphere.Paths.Admissible +import OAI.Analysis.HardSphere.Allocation.PhysicalGroupComparison + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal BigOperators +namespace HardSphere.Groups +open Wiener Bridge Sampling Comparison GaussianPacking PathCutoff CellOrbital HardSphere.Lattice HardSphere.DyadicSkeleton +attribute [local instance] Classical.propDecidable + +lemma physical_lattice_bad_joint {N K M G : ℕ} [NeZero K] {L : Length} + (hL : L.val=(K:ℝ)) (g : Fin G) (m : ℕ) (t r R C S : ℝ) (u : Time) + (μ : Measure (PhysicalDatum N K M G L)) (p : ℝ≥0∞) + (hb : ∀A : Finset (Fin 3→Fin K),μ {d | A⊆datumBad hL g m t r R C S u d} ≤ p^A.card) + (A : Finset (DiscreteTorus K)) : + μ {d | A⊆latticeDatumBad hL g m t r R C S u d} ≤ p^A.card := by + have he : {d : PhysicalDatum N K M G L | A⊆latticeDatumBad hL g m t r R C S u d}= + {d | A.image siteIndex⊆datumBad hL g m t r R C S u d} := by + ext d + constructor + · intro hh v hv + obtain ⟨w,hw,rfl⟩ := Finset.mem_image.mp hv + exact (mem_latticeDatumBad hL g m t r R C S u d w).mp (hh hw) + · intro hh v hv + exact (mem_latticeDatumBad hL g m t r R C S u d v).mpr + (hh (Finset.mem_image.mpr ⟨v,hv,rfl⟩)) + rw [he] + have hinj : Function.Injective (siteIndex : DiscreteTorus K→Fin 3→Fin K) := + Function.LeftInverse.injective indexSite_siteIndex + simpa only [Finset.card_image_of_injective _ hinj] using hb (A.image siteIndex) + +theorem physical_path_comparison : + ∃p₀ κ : ℝ, 0 < p₀ ∧ 0 < κ ∧ ∃K₀ : ℕ, + ∀K : ℕ,K₀ ≤ K → ∀_ : NeZero K, + ∀{N M G : ℕ} {L : Length},∀hL : L.val=(K:ℝ),1 ≤ K → 50 < L.val → + ∀{ψ : Jet (N+1) L} {r : ℝ},IsGroundVector (N+1) L r ψ → + ∀g : Fin G,∀m : ℕ,∀t R C S s₀ h : ℝ,∀u : Time, + PhysicalScaleBounds m t r R C S s₀ h u → + ∀p : ℝ,0 ≤ p → p ≤ p₀ → + (∀A : Finset (Fin 3→Fin K), + (physicalDatumLaw (M:=M) g ψ m r R C S s₀ (2*t) u) + {d | A⊆datumBad hL g m t r R C S u d} ≤ (ENNReal.ofReal p)^A.card) → + 0 < M → ∀δ B : ℝ,0 < δ → 1 ≤ B → routeDensityBound t ≤ ENNReal.ofReal B → + 2*(B-1)/(M:ℝ)-8*Real.log δ ≤ κ → + ENNReal.ofReal δ+(4*(49^3*(M+1)):ℕ)*(routeDensityBound t*datumCollisionBound t r h R C) ≤ 1 → + ∀x y : DiscreteTorus K,currentAdmissiblePair x y → + ∃σ : Measure (Torus L×Torus L×Configuration N L),IsFiniteMeasure σ ∧ + (1/2:ℝ≥0∞) ≤ σ univ ∧ + ∀b, + let P := physicalGroupReference (M:=M) (x:=x) (y:=y) hL ψ g m t r R C S s₀ u b + IsFiniteMeasure P ∧ σ≪P ∧ Integrable (fun z ↦ (σ.rnDeriv P z).toReal^2) P ∧ + (∫z,(σ.rnDeriv P z).toReal^2 ∂P) ≤ 2*B := by + obtain ⟨p₀,κ,hp₀,hκ,K₀,H⟩ := HardSphere.DyadicSkeleton.current_good_paths 30 + refine ⟨p₀,κ,hp₀,hκ,K₀,?_⟩ + intro K hK inst N M G L hL h1 h50 ψ r hψ g m t R C S s₀ h u hs p hp hpp hbad hM δ B hδ hB hBt hk hsmall x y hxy + have := physicalDatumLaw_probability (K:=K) (M:=M) g hψ m R C S s₀ (2*t) (by linarith [hs.time_pos]) u + obtain ⟨E,hE,hm,ν,hi,hgood,henc⟩ := (H K hK inst).2 + (physicalDatumLaw (K:=K) (M:=M) g ψ m r R C S s₀ (2*t) u) inferInstance + (latticeDatumBad hL g m t r R C S u) (latticeDatumBad_measurable hL g m t r R C S u) + p hp hpp (physical_lattice_bad_joint hL g m t r R C S u _ _ hbad) x y hxy + have := hi + have hne : x≠y := by + intro he + obtain ⟨n,hl,hu,d,hd,hy⟩ := hxy + have hz := congrArg (fun z : DiscreteTorus K ↦ z 0) hy + rw [←he] at hz + simp only [Pi.add_apply,Matrix.cons_val_zero] at hz + have hn0 : (n:ZMod K)=0 := by exact add_left_cancel (hz.symm.trans (add_zero _).symm) + have hvn := congrArg ZMod.val hn0 + simp only [ZMod.val_natCast,ZMod.val_zero] at hvn + rw [Nat.mod_eq_of_lt (by have := NeZero.pos K; omega)] at hvn + have := NeZero.pos K + omega + have hc : (∫⁻d in E,∫⁻q,∫⁻q',ENNReal.ofReal (Real.exp (κ*(simpleEncounter 30 q q':ℝ))) ∂ν d ∂ν d + ∂physicalDatumLaw g ψ m r R C S s₀ (2*t) u) ≤ ENNReal.ofReal (2:ℝ) := by + simpa only [lintegral_indicator hE,ENNReal.ofReal_ofNat] using henc + obtain ⟨σ,hσ,hmass,hest⟩ := physical_group_common_comparison hL h1 h50 hψ g m t R C S s₀ h u hs + hne E hE ν hgood hM δ B κ 2 hδ hB (by norm_num) hBt hk hsmall hc + exact ⟨σ,hσ,hmass ▸ hm,fun b ↦ by simpa only [mul_comm B 2] using hest b⟩ + +end HardSphere.Groups +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/Point.lean b/lean/OAI/Analysis/HardSphere/Geometry/Point.lean new file mode 100644 index 0000000000000000000000000000000000000000..bdf7d6dc3bccb4a7a9a9108e89ce11b9b6fd0bfa --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/Point.lean @@ -0,0 +1,177 @@ +import Mathlib + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere.SphericalCoordinates + +abbrev Point := ℝ × (ℝ × ℝ) +def angle : Set ℝ := Ioo (-Real.pi) Real.pi + +def spherePoint (r φ θ : ℝ) : Point := + (r*Real.sin φ,(r*Real.cos φ*Real.cos θ,r*Real.cos φ*Real.sin θ)) + +lemma measurable_angle : MeasurableSet angle := measurableSet_Ioo + +lemma polar_integral (F : ℝ × ℝ → ℝ≥0∞) (hF : Measurable F) : + (∫⁻ p, F p) = ∫⁻ θ in angle, ∫⁻ r in Ioi (0:ℝ), + ENNReal.ofReal r*F (r*Real.cos θ,r*Real.sin θ) := by + rw [← lintegral_comp_polarCoord_symm F] + exact setLIntegral_prod_symm _ (by fun_prop) + +lemma cylindrical_integral (F : Point → ℝ≥0∞) (hF : Measurable F) : + (∫⁻ p, F p)=∫⁻ θ in angle, ∫⁻ z : ℝ, ∫⁻ r : ℝ, + ENNReal.ofReal r*F (z,(r*Real.cos θ,r*Real.sin θ)) := by + rw [Measure.volume_eq_prod,lintegral_prod _ hF.aemeasurable] + have hp (z : ℝ) := polar_integral (fun p ↦ F (z,p)) (hF.comp (measurable_const.prodMk measurable_id)) + conv_lhs => arg 2; ext z; rw [hp z] + have he (z θ : ℝ) : (∫⁻ r in Ioi (0:ℝ), ENNReal.ofReal r*F (z,(r*Real.cos θ,r*Real.sin θ)))= + ∫⁻ r : ℝ, ENNReal.ofReal r*F (z,(r*Real.cos θ,r*Real.sin θ)) := by + apply setLIntegral_eq_of_support_subset + intro r hr + by_contra h + have hr0 : r≤0 := not_lt.mp h + simp only [ENNReal.ofReal_of_nonpos hr0,zero_mul,Function.mem_support,ne_eq,not_true_eq_false] at hr + simp_rw [he] + apply lintegral_lintegral_swap + exact (by fun_prop : Measurable (fun p : (ℝ × ℝ) × ℝ ↦ + ENNReal.ofReal p.2*F (p.1.1,(p.2*Real.cos p.1.2,p.2*Real.sin p.1.2)))).lintegral_prod_right.aemeasurable + +lemma spherical_integral (F : Point → ℝ≥0∞) (hF : Measurable F) : + (∫⁻ p, F p)=∫⁻ θ in angle, ∫⁻ φ in angle, ∫⁻ r in Ioi (0:ℝ), + ENNReal.ofReal (r^2*Real.cos φ)*F (spherePoint r φ θ) := by + rw [cylindrical_integral F hF] + apply lintegral_congr + intro θ + let G : ℝ × ℝ → ℝ≥0∞ := fun p ↦ + ENNReal.ofReal p.1*F (p.2,(p.1*Real.cos θ,p.1*Real.sin θ)) + have hG : Measurable G := by unfold G; fun_prop + rw [← lintegral_prod_symm G hG.aemeasurable,← Measure.volume_eq_prod,polar_integral G hG] + apply lintegral_congr + intro φ + apply setLIntegral_congr_fun measurableSet_Ioi + intro r hr + dsimp [G,spherePoint] + rw [← mul_assoc,← ENNReal.ofReal_mul (le_of_lt hr)] + congr 2 + ring + +open Filter +open scoped Topology BigOperators + +def sqRadius (x : Point) : ℝ := x.1^2+x.2.1^2+x.2.2^2 + +def direction (φ θ : ℝ) : Point := + (Real.sin φ,(Real.cos φ*Real.cos θ,Real.cos φ*Real.sin θ)) + +lemma spherePoint_eq (r φ θ : ℝ) : spherePoint r φ θ=r • direction φ θ := by + ext <;> simp [spherePoint,direction,mul_assoc] + +lemma sqRadius_smul (t : ℝ) (x : Point) : sqRadius (t • x)=t^2*sqRadius x := by + simp only [sqRadius,Prod.smul_fst,Prod.smul_snd,smul_eq_mul] + ring + +lemma direction_unit (φ θ : ℝ) : sqRadius (direction φ θ)=1 := by + have hp := Real.sin_sq_add_cos_sq φ + have ht := Real.cos_sq_add_sin_sq θ + dsimp [sqRadius,direction] + nlinarith [sq_nonneg (Real.cos φ)] + +lemma ray_terminal {K : Set Point} (hk : IsClosed K) (hc : Convex ℝ K) (h0 : (0:Point)∈K) + {B : ℝ} (hB : 0≤B) (hb : ∀ x∈K, sqRadius x≤B^2) {ω : Point} (hu : sqRadius ω=1) : + ∃ R : ℝ, 0≤R ∧ R≤B ∧ {t : ℝ | 0≤t ∧ t • ω∈K}=Icc 0 R := by + let S : Set ℝ := {t : ℝ | 0≤t ∧ t • ω∈K} + have hs0 : (0:ℝ)∈S := by simpa [S] using h0 + have hsclosed : IsClosed S := isClosed_Ici.inter (hk.preimage (continuous_id.smul continuous_const)) + have hsub : S⊆Icc 0 B := by + intro t ht + have hn := hb (t • ω) ht.2 + rw [sqRadius_smul,hu,mul_one] at hn + exact ⟨ht.1,(sq_le_sq₀ ht.1 hB).mp hn⟩ + have hscompact : IsCompact S := isCompact_Icc.of_isClosed_subset hsclosed hsub + have hsconvex : Convex ℝ S := by + intro x hx y hy a b ha hb hab + refine ⟨add_nonneg (mul_nonneg ha hx.1) (mul_nonneg hb hy.1),?_⟩ + simpa only [smul_eq_mul,add_smul,mul_smul] using hc hx.2 hy.2 ha hb hab + let R := sSup S + have hR : R∈S := hscompact.sSup_mem ⟨0,hs0⟩ + refine ⟨R,(hsub hR).1,(hsub hR).2,?_⟩ + ext t + constructor + · intro ht + exact ⟨ht.1,le_csSup hscompact.bddAbove ht⟩ + · intro ht + exact hsconvex.ordConnected.out hs0 hR ht + +end HardSphere.SphericalCoordinates + +namespace HardSphere.SphericalCoordinates +open scoped Topology + +def axis0 : Point := (1,(0,0)) +def axis1 : Point := (0,(1,0)) +def axis2 : Point := (0,(0,1)) + +def gradSq {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (f : Point → E) (x : Point) : ℝ := + ‖fderiv ℝ f x axis0‖^2+‖fderiv ℝ f x axis1‖^2+‖fderiv ℝ f x axis2‖^2 + +lemma linear_unit_bound {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (D : Point →L[ℝ] E) {ω : Point} (hu : sqRadius ω=1) : + ‖D ω‖^2 ≤ ‖D axis0‖^2+‖D axis1‖^2+‖D axis2‖^2 := by + have he : ω=ω.1 • axis0+ω.2.1 • axis1+ω.2.2 • axis2 := by + ext <;> simp [axis0,axis1,axis2] + have hn : ‖D ω‖ ≤ |ω.1| * ‖D axis0‖+|ω.2.1| * ‖D axis1‖+|ω.2.2| * ‖D axis2‖ := by + have hd := congrArg D he + simp only [map_add,map_smul] at hd + rw [hd] + calc + _ ≤ (‖ω.1 • D axis0‖+‖ω.2.1 • D axis1‖)+‖ω.2.2 • D axis2‖ := + (norm_add_le _ _).trans (add_le_add (norm_add_le _ _) le_rfl) + _ = _ := by simp only [norm_smul,Real.norm_eq_abs] + have hcs (a b c A B C : ℝ) : (a*A+b*B+c*C)^2≤(a^2+b^2+c^2)*(A^2+B^2+C^2) := by + nlinarith [sq_nonneg (a*B-b*A),sq_nonneg (a*C-c*A),sq_nonneg (b*C-c*B)] + have hs := hcs |ω.1| |ω.2.1| |ω.2.2| ‖D axis0‖ ‖D axis1‖ ‖D axis2‖ + simp only [sq_abs] at hs + change ω.1^2+ω.2.1^2+ω.2.2^2=1 at hu + rw [hu,one_mul] at hs + exact (pow_le_pow_left₀ (norm_nonneg _) hn 2).trans hs + +lemma gradSq_nonneg {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (f : Point → E) (x : Point) : 0≤gradSq f x := by unfold gradSq; positivity + +lemma continuous_gradSq {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {f : Point → E} (hf : ContDiff ℝ 1 f) : Continuous (gradSq f) := by + have hd := hf.continuous_fderiv (by norm_num) + unfold gradSq + exact (((hd.clm_apply continuous_const).norm.pow 2).add + ((hd.clm_apply continuous_const).norm.pow 2)).add + ((hd.clm_apply continuous_const).norm.pow 2) + +lemma ray_deriv_bound {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {f : Point → E} (hf : ContDiff ℝ 1 f) {ω : Point} (hu : sqRadius ω=1) (t : ℝ) : + ‖deriv (fun s : ℝ ↦ f (s • ω)) t‖^2≤gradSq f (t • ω) := by + have hd := ((hf.differentiable (by norm_num) (t • ω)).hasFDerivAt).comp_hasDerivAt t + ((hasDerivAt_id t).smul_const ω) + have he : deriv (fun s : ℝ ↦ f (s • ω)) t=fderiv ℝ f (t • ω) ω := by + simpa only [Function.comp_def,id_eq,one_smul] using hd.deriv + rw [he] + simpa only [one_smul,gradSq] using linear_unit_bound (fderiv ℝ f (t • ω)) hu + +end HardSphere.SphericalCoordinates + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/PointFin.lean b/lean/OAI/Analysis/HardSphere/Geometry/PointFin.lean new file mode 100644 index 0000000000000000000000000000000000000000..d48ee4f912815ce2ce982ad4e4900d6301bb3d39 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/PointFin.lean @@ -0,0 +1,235 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.CoordinateLine +import OAI.Analysis.HardSphere.Geometry.SubcubeBase + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere.SphericalCoordinates +open scoped BigOperators + +noncomputable def pointFin : Point →L[ℝ] (Fin 3 → ℝ) := + ContinuousLinearMap.pi ![ContinuousLinearMap.fst ℝ ℝ (ℝ×ℝ), + (ContinuousLinearMap.fst ℝ ℝ ℝ).comp (ContinuousLinearMap.snd ℝ ℝ (ℝ×ℝ)), + (ContinuousLinearMap.snd ℝ ℝ ℝ).comp (ContinuousLinearMap.snd ℝ ℝ (ℝ×ℝ))] + +lemma pointFin_apply (x : Point) : pointFin x=![x.1,x.2.1,x.2.2] := by + ext i + fin_cases i <;> rfl + +lemma pointFin_preserving (b h : ℝ) : + MeasurePreserving pointFin (volume.restrict (cube (b,(b,b)) h)) + (Measure.pi (fun _ : Fin 3 ↦ (volume : Measure ℝ).restrict (Icc b (b+h)))) := by + rw [cube_volume] + let μ := (volume : Measure ℝ).restrict (Icc b (b+h)) + have hp := (measurePreserving_piFinSuccAbove (fun _ : Fin 3 ↦ μ) 0).symm + have hq := (MeasurePreserving.id μ).prod (measurePreserving_piFinTwo (fun _ : Fin 2 ↦ μ)).symm + convert hp.comp hq using 1 + funext x i + fin_cases i <;> rfl + +noncomputable def configurationFin (n : ℕ) : (Fin n → Point) →L[ℝ] (Fin n → Fin 3 → ℝ) := + ContinuousLinearMap.pi (fun i ↦ pointFin.comp (ContinuousLinearMap.proj i)) + +lemma configurationFin_apply {n : ℕ} (X : Fin n → Point) (i : Fin n) : + configurationFin n X i=pointFin (X i) := rfl + +lemma configurationFin_single {n : ℕ} (i : Fin n) (q : Fin 3) : + configurationFin n (Pi.single i (![axis0,axis1,axis2] q))=Pi.single i (Pi.single q 1) := by + funext k t + by_cases hk : k=i + · subst k + fin_cases q <;> fin_cases t <;> simp [configurationFin_apply,pointFin_apply,axis0,axis1,axis2] + · simp [configurationFin_apply,hk] + +lemma configurationFin_preserving (n : ℕ) (b h : ℝ) : + MeasurePreserving (configurationFin n) + (Measure.pi (fun _ : Fin n ↦ volume.restrict (cube (b,(b,b)) h))) + (Measure.pi (fun _ : Fin n ↦ Measure.pi (fun _ : Fin 3 ↦ (volume : Measure ℝ).restrict (Icc b (b+h))))) := + measurePreserving_pi _ _ (fun _ ↦ pointFin_preserving b h) + +lemma sqRadius_eq_sum (x : Point) : sqRadius x=∑ j : Fin 3,(pointFin x j)^2 := by + simp [sqRadius,pointFin_apply,Fin.sum_univ_succ,add_assoc] + +end HardSphere.SphericalCoordinates + +namespace HardSphere +open SphericalCoordinates +open scoped BigOperators + +noncomputable def cubeParameter (n : ℕ) (L : Length) (X : Fin n → Point) : Configuration n L := + project n L (configurationFin n X) + +lemma cubeParameter_preserving (n : ℕ) (L : Length) : + MeasurePreserving (cubeParameter n L) + (Measure.pi (fun _ : Fin n ↦ volume.restrict (cube 0 L.val))) volume := by + have hp := measurePreserving_pi (fun _ : Fin 3 ↦ (volume : Measure ℝ).restrict (Icc 0 L.val)) + (fun _ : Fin 3 ↦ (volume : Measure (AddCircle L.val))) + (f := fun _ x ↦ (x : AddCircle L.val)) (fun _ ↦ by + simpa only [zero_add,restrict_Ioc_eq_restrict_Icc] using AddCircle.measurePreserving_mk L.val 0) + have hq := measurePreserving_pi _ _ (fun _ : Fin n ↦ hp) + have hs := configurationFin_preserving n 0 L.val + simp only [zero_add] at hs + exact hq.comp hs + +lemma addCircle_dist_coe_sq_le (L : Length) (x y : ℝ) : + dist (x : AddCircle L.val) (y : AddCircle L.val)^2≤(x-y)^2 := by + have hn : dist (x : AddCircle L.val) (y : AddCircle L.val)≤|x-y| := by + rw [dist_eq_norm,← QuotientAddGroup.mk_sub] + exact QuotientAddGroup.norm_mk_le_norm + have hh := (sq_le_sq₀ dist_nonneg (abs_nonneg (x-y))).mpr hn + simpa only [sq_abs] using hh + +lemma cubeParameter_distance {n : ℕ} (L : Length) (X : Fin n → Point) (i j : Fin n) + {a : ℝ} (ha : 0≤a) (hd : sqRadius (X i-X j)≤a^2) : + torusDistance L (cubeParameter n L X i) (cubeParameter n L X j)≤a := by + apply Real.sqrt_le_iff.mpr + refine ⟨ha,le_trans ?_ hd⟩ + rw [sqRadius_eq_sum] + apply Finset.sum_le_sum + intro q _ + simpa only [cubeParameter,project,configurationFin_apply,map_sub,Pi.sub_apply] using + addCircle_dist_coe_sq_le L (pointFin (X i) q) (pointFin (X j) q) + +lemma SmoothTest.cube_zero {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest n L a) (ha : 0≤a) + (X : Fin n → Point) (i j : Fin n) (hij : i≠j) (hd : sqRadius (X i-X j)≤a^2) : + f.toFun (cubeParameter n L X)=0 := by + by_contra hz + have h := f.support_allowed (subset_tsupport _ hz) + have hdist := cubeParameter_distance L X i j ha hd + rcases lt_or_gt_of_ne hij with hlt | hgt + · exact (not_lt_of_ge hdist) (h i j hlt) + · have hs : torusDistance L (cubeParameter n L X j) (cubeParameter n L X i)= + torusDistance L (cubeParameter n L X i) (cubeParameter n L X j) := by + simp only [torusDistance,dist_comm] + rw [← hs] at hdist + exact (not_lt_of_ge hdist) (h j i hgt) + +lemma SmoothTest.cube_smooth {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest n L a) : + ContDiff ℝ 1 (fun X : Fin n → Point ↦ f.toFun (cubeParameter n L X)) := + (f.smooth.of_le (by simp)).comp (configurationFin n).contDiff + +lemma SmoothTest.cube_derivative {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest n L a) + (X : Fin n → Point) (i : Fin n) (q : Fin 3) : + fderiv ℝ (fun X : Fin n → Point ↦ f.toFun (cubeParameter n L X)) X + (Pi.single i (![axis0,axis1,axis2] q))= + coordDerivative n L f.toFun (i,q) (cubeParameter n L X) := by + rw [cubeParameter,coordDerivative_project] + have h := ((f.smooth.differentiable (by simp) (configurationFin n X)).hasFDerivAt).comp X + (configurationFin n).hasFDerivAt + rw [show (fun X ↦ f.toFun (cubeParameter n L X))= + (fun Y ↦ f.toFun (project n L Y)) ∘ configurationFin n from rfl,h.fderiv] + simp only [ContinuousLinearMap.comp_apply,configurationFin_single] + +lemma SmoothTest.cube_gradient {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest n L a) + (X : Fin n → Point) (i : Fin n) : + particleGradSq (fun X ↦ f.toFun (cubeParameter n L X)) i X= + ∑ q : Fin 3, ‖coordDerivative n L f.toFun (i,q) (cubeParameter n L X)‖^2 := by + have h0 := f.cube_derivative X i 0 + have h1 := f.cube_derivative X i 1 + have h2 := f.cube_derivative X i 2 + change fderiv ℝ (fun X ↦ f.toFun (cubeParameter n L X)) X (Pi.single i axis0)=_ at h0 + change fderiv ℝ (fun X ↦ f.toFun (cubeParameter n L X)) X (Pi.single i axis1)=_ at h1 + change fderiv ℝ (fun X ↦ f.toFun (cubeParameter n L X)) X (Pi.single i axis2)=_ at h2 + simp only [particleGradSq,h0,h1,h2,Fin.sum_univ_succ,Fin.succ_zero_eq_one,Fin.succ_one_eq_two, + Fin.sum_univ_zero,add_zero] + ring + +lemma smooth_norm_lintegral {α : Type*} [MeasurableSpace α] {μ : Measure α} {f : α → ℂ} + (hf : MemLp f 2 μ) : + ENNReal.ofReal (‖hf.toLp f‖^2)=∫⁻ x,ENNReal.ofReal (‖f x‖^2) ∂μ := by + have he : ‖hf.toLp f‖^2=∫ x,‖f x‖^2 ∂μ := by + rw [@norm_sq_eq_re_inner ℂ,L2.inner_def,← integral_re (L2.integrable_inner (hf.toLp f) (hf.toLp f))] + apply integral_congr_ae + filter_upwards [hf.coeFn_toLp] with x hx + simp only [hx,inner_self_eq_norm_sq_to_K,RCLike.re_ofReal_pow] + rw [he,ofReal_integral_eq_lintegral_ofReal (hf.integrable_norm_pow (by decide : (2:ℕ)≠0)) + (Filter.Eventually.of_forall (fun x ↦ sq_nonneg ‖f x‖))] + +lemma cube_energy_coefficient_nonneg (n : ℕ) {a l : ℝ} (ha : 0≤a) (hl : 0≤l) : + 0≤1/(64*Real.sqrt 3)*a/l^3*(n:ℝ)*((n:ℝ)-1) := by + cases n with + | zero => simp + | succ n => + have hn : (0:ℝ)≤((n+1:ℕ):ℝ)-1 := by norm_num + positivity + +lemma SmoothTest.cube_gradient_lintegral {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest n L a) + (i : Fin n) : + (∫⁻ X, ENNReal.ofReal (particleGradSq (fun X ↦ f.toFun (cubeParameter n L X)) i X) + ∂Measure.pi (fun _ ↦ volume.restrict (cube 0 L.val)))= + ∑ q : Fin 3, ENNReal.ofReal (‖f.jet.2 (i,q)‖^2) := by + simp_rw [f.cube_gradient,ENNReal.ofReal_sum_of_nonneg (fun _ _ ↦ sq_nonneg _)] + rw [lintegral_finsetSum _ (fun q _ ↦ by + exact (((f.continuous_partial (i,q)).measurable.comp (cubeParameter_preserving n L).measurable).norm.pow_const 2).ennreal_ofReal)] + apply Finset.sum_congr rfl + intro q _ + rw [(cubeParameter_preserving n L).lintegral_comp + (f := fun x ↦ ENNReal.ofReal (‖coordDerivative n L f.toFun (i,q) x‖^2)) + (((f.continuous_partial (i,q)).measurable.norm.pow_const 2).ennreal_ofReal),← smooth_norm_lintegral (f.partial_memLp (i,q))] + rfl + +lemma SmoothTest.energy_lower {n : ℕ} {L : Length} {a : ℝ} (f : SmoothTest n L a) (ha : 0] 0) := + tendsto_nhdsWithin_iff.mpr ⟨tendsto_one_div_add_atTop_nhds_zero_nat, + Eventually.of_forall fun _ ↦ by simp only [mem_Ioi]; positivity⟩ + +lemma SmoothTest.killed_generator {N : ℕ} {L : Length} {a : ℝ} (f : SmoothTest N L a) : + Tendsto (fun n : ℕ ↦ (((1/((n:ℝ)+1))⁻¹:ℝ):ℂ) • + (f.jet.1-killedTransition N L a (1/((n:ℝ)+1)) f.jet.1)) + atTop (𝓝 (smoothLaplacian f.asSmooth)) := by + have ht := positiveTimeSeq_tendsto + have hb := (killedTransition_free_firstOrder N L a f.asSmooth.val f.support_allowed).comp ht + rw [← f.scalar_toLp] at hb + have hf := f.free_generator (fun n : ℕ ↦ by positivity : ∀ n : ℕ,0<1/((n:ℝ)+1)) + tendsto_one_div_add_atTop_nhds_zero_nat + simp only [RCLike.real_smul_eq_coe_smul (K := ℂ),RCLike.ofReal_inv] at hb + have h := hf.sub hb + simp only [sub_zero] at h + convert h using 1 + funext n + dsimp only [Function.comp_apply] + simp only [Complex.ofReal_inv] + module + +lemma SmoothTest.allowedProjection {N : ℕ} {L : Length} {a : ℝ} (f : SmoothTest N L a) : + allowedProjection N L a f.jet.1=f.jet.1 := by + apply Lp.ext + filter_upwards [allowedProjection_ae N L a f.jet.1,f.memLp.coeFn_toLp] with X hP hf + rw [hP] + by_cases hX : X∈allowed N L a + · rw [Set.indicator_of_mem hX] + · rw [Set.indicator_of_notMem hX] + change 0=f.memLp.toLp f.toFun X + rw [hf] + exact (image_eq_zero_of_notMem_tsupport (fun hs ↦ hX (f.support_allowed hs))).symm + +lemma SmoothTest.killedLaplace_pairing {N : ℕ} {L : Length} {a : ℝ} (g : SmoothTest N L a) + (f : ScalarL2 N L) : + inner ℂ (smoothLaplacian g.asSmooth) (killedLaplace N L a f)= + inner ℂ g.jet.1 f-inner ℂ g.jet.1 (killedLaplace N L a f) := by + let u := killedLaplace N L a f + have hL := g.killed_generator.inner (𝕜 := ℂ) (tendsto_const_nhds (x := u)) + have hR := (tendsto_const_nhds (x := g.jet.1)).inner (𝕜 := ℂ) + ((killedLaplace_difference_tendsto N L a f).comp positiveTimeSeq_tendsto) + have he (n : ℕ) : inner ℂ ((((1/((n:ℝ)+1))⁻¹:ℝ):ℂ) • + (g.jet.1-killedTransition N L a (1/((n:ℝ)+1)) g.jet.1)) u= + inner ℂ g.jet.1 ((((1/((n:ℝ)+1))⁻¹:ℝ):ℂ) • (u-killedTransition N L a (1/((n:ℝ)+1)) u)) := by + rw [inner_smul_left,inner_smul_right,inner_sub_left,inner_sub_right] + have hs : inner ℂ ((killedTransition N L a (1/((n:ℝ)+1))) g.jet.1) u = + inner ℂ g.jet.1 ((killedTransition N L a (1/((n:ℝ)+1))) u) := + (isSelfAdjoint_iff_isSymmetric.mp (killedTransition_selfAdjoint N L a (1/((n:ℝ)+1)))) g.jet.1 u + rw [hs] + simp only [Complex.conj_ofReal] + simp_rw [he] at hL + simp only [Complex.ofReal_inv] at hL + have hh := tendsto_nhds_unique hL hR + rw [inner_sub_right] at hh + have hp : inner ℂ g.jet.1 (HardSphere.allowedProjection N L a f)=inner ℂ g.jet.1 f := by + rw [← killedTransition_zero] + have hs : inner ℂ (killedTransition N L a 0 g.jet.1) f= + inner ℂ g.jet.1 (killedTransition N L a 0 f) := + (isSelfAdjoint_iff_isSymmetric.mp (killedTransition_selfAdjoint N L a 0)) g.jet.1 f + rw [← hs] + rw [killedTransition_zero,g.allowedProjection] + exact hh.trans (by rw [hp]) + +lemma killedLaplace_variational {N : ℕ} {L : Length} {a : ℝ} (f : ScalarL2 N L) + {u : hilbertDomain N L a} (hu : scalarEmbedding N L a u=killedLaplace N L a f) + {v : Jet N L} (hv : v∈dirichletDomain N L a) : + inner ℂ v.1 (hilbertJetEquiv N L (u : HilbertJet N L)).1+ + (∑ p : Direction N,inner ℂ (v.2 p) ((hilbertJetEquiv N L (u : HilbertJet N L)).2 p))= + inner ℂ v.1 f := by + have hc : IsClosed {w : Jet N L | inner ℂ w.1 (hilbertJetEquiv N L (u : HilbertJet N L)).1+ + (∑ p : Direction N,inner ℂ (w.2 p) ((hilbertJetEquiv N L (u : HilbertJet N L)).2 p))= + inner ℂ w.1 f} := by + apply isClosed_eq + · fun_prop + · fun_prop + apply closure_minimal (t := {w : Jet N L | _}) ?_ hc hv + rintro _ ⟨g,rfl⟩ + change inner ℂ g.jet.1 (hilbertJetEquiv N L (u : HilbertJet N L)).1+ + (∑ p : Direction N,inner ℂ (g.jet.2 p) ((hilbertJetEquiv N L (u : HilbertJet N L)).2 p))=_ + have hp := g.form_pairing u.property + change (∑ p : Direction N,inner ℂ (g.jet.2 p) ((hilbertJetEquiv N L (u : HilbertJet N L)).2 p))= + inner ℂ (smoothLaplacian g.asSmooth) (scalarEmbedding N L a u) at hp + rw [hp,hu] + change inner ℂ g.jet.1 (scalarEmbedding N L a u)+_=_ + rw [hu,g.killedLaplace_pairing] + abel + +lemma killedLaplace_eq_formResolvent (N : ℕ) (L : Length) (a : ℝ) (f : ScalarL2 N L) : + killedLaplace N L a f=formResolvent N L a f := by + obtain ⟨u,hu,_⟩ := killedLaplace_graph N L a f + have he : u=(scalarEmbedding N L a).adjoint f := by + apply ext_inner_left ℂ + intro v + rw [adjoint_inner_right] + change inner ℂ (v : HilbertJet N L) (u : HilbertJet N L)=_ + rw [hilbertJet_inner] + exact killedLaplace_variational f hu v.property + rw [← hu,he] + rfl + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/RadialIndicator.lean b/lean/OAI/Analysis/HardSphere/Geometry/RadialIndicator.lean new file mode 100644 index 0000000000000000000000000000000000000000..61d390b5df10f9cdac45e915dbc775be94cce85b --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/RadialIndicator.lean @@ -0,0 +1,167 @@ +import Mathlib +import OAI.Analysis.HardSphere.Capacity.IntegralMulSq +import OAI.Analysis.HardSphere.Geometry.Point + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere.SphericalCoordinates + +lemma radial_indicator {K : Set Point} {ω : Point} {R : ℝ} + (hR : {t : ℝ | 0≤t ∧ t • ω∈K}=Icc 0 R) (a : ℝ → ℝ≥0∞) (H : Point → ℝ≥0∞) : + (∫⁻ t in Ioi (0:ℝ), a t*(K.indicator H) (t • ω))= + ∫⁻ t in Ioc (0:ℝ) R, a t*H (t • ω) := by + classical + rw [← lintegral_indicator measurableSet_Ioi,← lintegral_indicator measurableSet_Ioc] + apply lintegral_congr + intro t + by_cases ht0 : 0 simp [hx] + have : (volume : Measure Point).IsAddLeftInvariant := by + rw [Measure.volume_eq_prod,Measure.volume_eq_prod] + apply Measure.prod.instIsAddLeftInvariant + rw [he,lintegral_add_left_eq_self] + +lemma convex_capacity_center {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {f : Point → E} (hf : ContDiff ℝ 1 f) {K : Set Point} + (hk : IsClosed K) (hc : Convex ℝ K) {y : Point} (hy : y∈K) + {r B : ℝ} (hr : 0.add + (((Complex.continuous_ofReal.comp (spatialCosine_deriv_continuous_radius _)).mul continuous_const).norm.pow 2) + +lemma spatialInside_average (L : Length) (A : Finset (Torus L)) (x : Torus L) : + Integrable (fun H ↦ ‖(spatialInside L A H).orbital x‖^2) radiusLaw ∧ + (∫ H, ‖(spatialInside L A H).orbital x‖^2 ∂radiusLaw)≤Real.exp 3*Real.exp (-spatialSiteDistance L A x) := by + have hmeas : Measurable (fun H ↦ ‖(spatialInside L A H).orbital x‖^2) := by + change Measurable (fun H ↦ ‖(Real.sin (Real.pi/2*CellOrbital.profile 1 (smoothSpatialDistance L A x-H)):ℂ)‖^2) + exact (Complex.continuous_ofReal.comp + (Real.continuous_sin.comp (continuous_const.mul ((CellOrbital.profile_smooth 1).continuous.comp + (continuous_const.sub continuous_id))))).norm.pow 2 |>.measurable + simpa only [one_mul] using radius_integral_bound (B:=1) (d:=spatialSiteDistance L A x) (by norm_num) hmeas + (fun H ↦ sq_nonneg _) (fun H ↦ by nlinarith only [spatialInside_norm_le L A H x,norm_nonneg ((spatialInside L A H).orbital x)]) + (fun H hH ↦ by rw [spatialInside_zero L A H x hH.le]; simp) + +theorem spatialEnergyError_average : ∃ C : ℝ, 0.mpr h1, + sq_le_sq₀ (norm_nonneg _) hB.le |>.mpr h2] + _ = 6*B^2 := by simp; ring + · intro H hH + unfold spatialEnergyError + apply Finset.sum_eq_zero + intro j _ + obtain ⟨h1,h2⟩ := spatialPartition_partial_zero L A H (0,j) (fun _ ↦ x) hH + rw [h1,h2]; simp + +end HardSphere + +namespace HardSphere +open MeasureTheory Set Filter + +lemma L2_bounded_weight_integrable {n : ℕ} {L : Length} (u : ScalarL2 n L) + {v : Configuration n L → ℝ} {B : ℝ} (hv : Measurable v) (hb : ∀ X, |v X|≤B) : + Integrable (fun X ↦ v X*‖u X‖^2) volume := by + have hi := ((Lp.memLp u).integrable_norm_pow (by norm_num)).const_mul B + apply hi.mono' (hv.mul ((Lp.stronglyMeasurable u).measurable.norm.pow_const 2)).aestronglyMeasurable + exact Eventually.of_forall fun X ↦ by + change ‖v X*‖u X‖^2‖≤B*‖u X‖^2 + rw [Real.norm_eq_abs,abs_mul,abs_of_nonneg (sq_nonneg ‖u X‖)] + exact mul_le_mul_of_nonneg_right (hb X) (sq_nonneg _) + +lemma radius_configuration_bound {n : ℕ} {L : Length} (u : ScalarL2 n L) + {f : ℝ → Configuration n L → ℝ} {B M : ℝ} {v : Configuration n L → ℝ} + (hf : Measurable (Function.uncurry f)) (hb : ∀ H X, |f H X|≤B) + (hv : Measurable v) (hM : ∀ X, |v X|≤M) + (havg : ∀ X, (∫ H, f H X ∂radiusLaw)≤v X) : + Integrable (fun H ↦ ∫ X, f H X*‖u X‖^2) radiusLaw ∧ + (∫ H, (∫ X, f H X*‖u X‖^2) ∂radiusLaw)≤∫ X, v X*‖u X‖^2 := by + have hd := ((Lp.memLp u).integrable_norm_pow (by norm_num)).comp_snd radiusLaw + have hprod : Integrable (fun z : ℝ×Configuration n L ↦ f z.1 z.2*‖u z.2‖^2) (radiusLaw.prod volume) := by + apply (hd.const_mul B).mono' + (hf.mul (((Lp.stronglyMeasurable u).measurable.comp measurable_snd).norm.pow_const 2)).aestronglyMeasurable + exact Eventually.of_forall fun z ↦ by + change ‖f z.1 z.2*‖u z.2‖^2‖≤B*‖u z.2‖^2 + rw [Real.norm_eq_abs,abs_mul,abs_of_nonneg (sq_nonneg ‖u z.2‖)] + exact mul_le_mul_of_nonneg_right (hb z.1 z.2) (sq_nonneg _) + refine ⟨hprod.integral_prod_left,?_⟩ + rw [integral_integral_swap hprod] + apply integral_mono hprod.integral_prod_right (L2_bounded_weight_integrable u hv hM) + intro X + change (∫ H, f H X*‖u X‖^2 ∂radiusLaw)≤v X*‖u X‖^2 + rw [integral_mul_const] + exact mul_le_mul_of_nonneg_right (havg X) (sq_nonneg _) + +lemma spatialInside_joint_continuous (L : Length) (A : Finset (Torus L)) : + Continuous (fun z : ℝ×Torus L ↦ (spatialInside L A z.1).orbital z.2) := by + change Continuous (fun z : ℝ×Torus L ↦ + (Real.sin (Real.pi/2*CellOrbital.profile 1 (smoothSpatialDistance L A z.2-z.1)):ℂ)) + exact Complex.continuous_ofReal.comp (Real.continuous_sin.comp + (continuous_const.mul ((CellOrbital.profile_smooth 1).continuous.comp + (((smoothSpatialDistance_lipschitz L A).continuous.comp continuous_snd).sub continuous_fst)))) + +lemma spatialEnergyError_joint_continuous (L : Length) (A : Finset (Torus L)) : + Continuous (fun z : ℝ×Torus L ↦ spatialEnergyError L A z.1 z.2) := by + unfold spatialEnergyError + apply continuous_finsetSum + intro j _ + simp_rw [spatialInside_partial,spatialOutside_partial,spatialSine_deriv,spatialCosine_deriv,spatialAngle] + have hh : Continuous (fun z : ℝ×Torus L ↦ smoothSpatialDistance L A z.2-z.1) := + ((smoothSpatialDistance_lipschitz L A).continuous.comp continuous_snd).sub continuous_fst + have hp := (CellOrbital.profile_smooth 1).continuous.comp hh + have hd := ((CellOrbital.profile_smooth 1).continuous_deriv (by simp)).comp hh + have hc : Continuous (fun z : ℝ×Torus L ↦ coordDerivative 1 L (spatialDistanceMultiplier L A).toFun (0,j) (fun _ ↦ z.2)) := + (continuous_coordDerivative (spatialDistanceMultiplier L A).smooth (0,j)).comp (continuous_pi fun _ ↦ continuous_snd) + exact ((Complex.continuous_ofReal.comp ((Real.continuous_cos.comp (continuous_const.mul hp)).mul + (continuous_const.mul hd))).mul hc).norm.pow 2 |>.add + (((Complex.continuous_ofReal.comp ((Real.continuous_sin.comp (continuous_const.mul hp)).neg.mul + (continuous_const.mul hd))).mul hc).norm.pow 2) + +def weightedSiteCount {n : ℕ} (L : Length) (A : Finset (Torus L)) (X : Configuration n L) : ℝ := + if A.Nonempty then ∑ i : Fin n, Real.exp (-spatialSiteDistance L A (X i)) else 0 + +lemma weightedSiteCount_nonneg {n : ℕ} (L : Length) (A : Finset (Torus L)) (X : Configuration n L) : + 0≤ weightedSiteCount L A X := by + unfold weightedSiteCount + split_ifs <;> positivity + +lemma weightedSiteCount_le {n : ℕ} (L : Length) (A : Finset (Torus L)) (X : Configuration n L) : + weightedSiteCount L A X≤(n:ℝ) := by + unfold weightedSiteCount + split_ifs + · calc + _ ≤ ∑ _i : Fin n, (1:ℝ) := Finset.sum_le_sum (fun i _ ↦ Real.exp_le_one_iff.mpr (neg_nonpos.mpr (spatialSiteDistance_nonneg L A _))) + _ = _ := by simp + · positivity + +lemma weightedSiteCount_continuous {n : ℕ} (L : Length) (A : Finset (Torus L)) : + Continuous (weightedSiteCount (n:=n) L A) := by + unfold weightedSiteCount + split_ifs + · exact continuous_finsetSum _ (fun i _ ↦ Real.continuous_exp.comp + (((spatialSiteDistance_lipschitz L A).continuous.comp (continuous_apply i)).neg)) + · exact continuous_const + +lemma spatialInside_configuration_average {n : ℕ} (L : Length) (A : Finset (Torus L)) + (hA : A.Nonempty) (u : ScalarL2 n L) : + Integrable (fun H ↦ ∫ X, (∑ i : Fin n, ‖(spatialInside L A H).orbital (X i)‖^2)*‖u X‖^2) radiusLaw ∧ + (∫ H, (∫ X, (∑ i : Fin n, ‖(spatialInside L A H).orbital (X i)‖^2)*‖u X‖^2) ∂radiusLaw)≤ + Real.exp 3*(∫ X, weightedSiteCount L A X*‖u X‖^2) := by + rw [← integral_const_mul] + simp_rw [← mul_assoc] + apply radius_configuration_bound u (B:=(n:ℝ)) (M:=Real.exp 3*(n:ℝ)) + · exact (continuous_finsetSum _ (fun i _ ↦ ((spatialInside_joint_continuous L A).comp + (continuous_fst.prodMk ((continuous_apply i).comp continuous_snd))).norm.pow 2)).measurable + · intro H X + rw [abs_of_nonneg (Finset.sum_nonneg (fun _ _ ↦ sq_nonneg _))] + calc + _ ≤ ∑ _i : Fin n, (1:ℝ) := by + apply Finset.sum_le_sum + intro i _ + nlinarith only [spatialInside_norm_le L A H (X i),norm_nonneg ((spatialInside L A H).orbital (X i))] + _ = _ := by simp + · exact (continuous_const.mul (weightedSiteCount_continuous L A)).measurable + · intro X + rw [abs_of_nonneg (mul_nonneg (Real.exp_pos _).le (weightedSiteCount_nonneg L A X))] + exact mul_le_mul_of_nonneg_left (weightedSiteCount_le L A X) (Real.exp_pos _).le + · intro X + rw [integral_finsetSum Finset.univ (fun i _ ↦ (spatialInside_average L A (X i)).1),weightedSiteCount,ite_eq_left hA,Finset.mul_sum] + exact Finset.sum_le_sum (fun i _ ↦ (spatialInside_average L A (X i)).2) + +theorem spatialEnergyError_configuration_average : ∃ C : ℝ, 0.mpr h1, + sq_le_sq₀ (norm_nonneg _) hB.le |>.mpr h2] + _ = _ := by simp; ring + _ = _ := by simp; ring + · exact (continuous_const.mul (weightedSiteCount_continuous L A)).measurable + · intro X + rw [abs_of_nonneg (mul_nonneg hC.le (weightedSiteCount_nonneg L A X))] + exact mul_le_mul_of_nonneg_left (weightedSiteCount_le L A X) hC.le + · intro X + rw [integral_finsetSum Finset.univ (fun i _ ↦ (havg L A (X i)).1),weightedSiteCount,ite_eq_left hA,Finset.mul_sum] + exact Finset.sum_le_sum (fun i _ ↦ (havg L A (X i)).2) + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/RadiusPotential.lean b/lean/OAI/Analysis/HardSphere/Geometry/RadiusPotential.lean new file mode 100644 index 0000000000000000000000000000000000000000..87d5b6f9c8251f5e49665b305dc2427b6ca31705 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/RadiusPotential.lean @@ -0,0 +1,394 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.PairHistory + +namespace OAI + +noncomputable section +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped ENNReal NNReal +namespace HardSphere.Lattice + +lemma radiusActivity_smul (c : ℝ≥0∞) (a : ℕ → ℝ≥0∞) : + radiusActivity (fun l ↦ c*a l) = c*radiusActivity a := by + unfold radiusActivity + simp only [mul_assoc] + rw [ENNReal.tsum_mul_left] + ac_rfl + +lemma ofReal_exp_finset_sum {ι : Type*} (s : Finset ι) (f : ι → ℝ) : + ENNReal.ofReal (Real.exp (∑ i ∈ s, f i)) = ∏ i ∈ s, ENNReal.ofReal (Real.exp (f i)) := by + rw [Real.exp_sum, ENNReal.ofReal_prod_of_nonneg] + intro i _ + exact (Real.exp_pos _).le + +theorem radius_exponential_bound (m T : ℕ) (hT : T ≤ 3^m) + (a : ℕ → ℝ≥0∞) (U : ℤ × ℤ → ℝ) + (hU0 : ∀ z, 0 ≤ U z) (hU1 : ∀ z, U z ≤ 1) + (hUa : ∀ z, ENNReal.ofReal (U z) ≤ radiusEnvelope a z) + (ha : ENNReal.ofReal (2*Real.exp 2) * radiusActivity a ≤ (1/2:ℝ≥0∞)) : + (∑' w, fourLaw m w * ENNReal.ofReal + (Real.exp (2 * ∑ u ∈ Finset.range (T+1), U (differenceAt m u w)))) ≤ 2 := by + let c := ENNReal.ofReal (2*Real.exp 2) + let b := fun l ↦ c*a l + let f := fun z ↦ ENNReal.ofReal (Real.exp (2*U z)-1) + have hba : radiusActivity b ≤ (1/2:ℝ≥0∞) := by + simpa only [b, radiusActivity_smul, c] using ha + have hbf : ∀ z, f z ≤ radiusEnvelope b z := by + intro z + calc + f z ≤ ENNReal.ofReal (2*Real.exp 2 * U z) := by + apply ENNReal.ofReal_le_ofReal + simpa only [mul_assoc, mul_left_comm, mul_comm] using + exp_sub_one_le_slope (by linarith [hU0 z] : 0 ≤ 2*U z) (by linarith [hU1 z] : 2*U z ≤ 2) + _ = c * ENNReal.ofReal (U z) := by rw [ENNReal.ofReal_mul (by positivity)] + _ ≤ c * radiusEnvelope a z := mul_le_mul' le_rfl (hUa z) + _ = radiusEnvelope b z := (radiusEnvelope_smul c a z).symm + have he (z : ℤ × ℤ) : 1+f z = ENNReal.ofReal (Real.exp (2*U z)) := by + have hx : 0 ≤ Real.exp (2*U z)-1 := by + have := Real.one_le_exp_iff.mpr (by linarith [hU0 z] : 0 ≤ 2*U z) + linarith + change 1+ENNReal.ofReal (Real.exp (2*U z)-1) = _ + rw [← ENNReal.ofReal_one, ← ENNReal.ofReal_add (by norm_num) hx] + congr 1 + ring + have h := (ordered_product_bound m T hT b f hbf (hba.trans_lt (by norm_num))).1 + have hh : (∑' w, fourLaw m w * ENNReal.ofReal + (Real.exp (2 * ∑ u ∈ Finset.range (T+1), U (differenceAt m u w)))) = + ∑' w, fourLaw m w * ∏ u ∈ Finset.range (T+1), (1+f (differenceAt m u w)) := by + apply tsum_congr + intro w + congr 1 + rw [Finset.mul_sum, ofReal_exp_finset_sum] + exact Finset.prod_congr rfl (fun u _ ↦ (he _).symm) + rw [hh] + refine h.trans ?_ + have hd : (1/2:ℝ≥0∞) ≤ 1-radiusActivity b := by + simpa using tsub_le_tsub_left hba (1:ℝ≥0∞) + exact (ENNReal.inv_le_inv.mpr hd).trans_eq (by norm_num) + +lemma orderedEncounterConstant_one_le : 1 ≤ orderedEncounterConstant := by + have hn : (4 * ∑' k, gapKernel k) ≠ ∞ := + ENNReal.mul_ne_top (by norm_num) gapKernel_sum_ne_top + have h : (1:ℝ≥0∞) ≤ 4 * ∑' k, gapKernel k := by + calc + (1:ℝ≥0∞) ≤ 4*1 := by norm_num + _ ≤ _ := mul_le_mul' le_rfl gapKernel_sum_one_le + exact_mod_cast (ENNReal.toReal_mono hn h) + +lemma radiusEnvelope_le_activity (a : ℕ → ℝ≥0∞) (z : ℤ × ℤ) : + radiusEnvelope a z ≤ radiusActivity a := by + have hc : 1 ≤ ENNReal.ofReal orderedEncounterConstant := by + simpa only [ENNReal.ofReal_one] using ENNReal.ofReal_le_ofReal orderedEncounterConstant_one_le + calc + _ ≤ ∑' l, a l := by + apply ENNReal.tsum_le_tsum + intro l + split_ifs <;> simp + _ ≤ ∑' l, a l * ((1+l : ℕ) : ℝ≥0∞)^2 := by + apply ENNReal.tsum_le_tsum + intro l + have h : (1:ℝ≥0∞) ≤ ((1+l : ℕ) : ℝ≥0∞) := by exact_mod_cast (by omega : 1 ≤ 1+l) + simpa using mul_le_mul' (le_refl (a l)) (one_le_pow₀ (n:=2) h) + _ ≤ _ := by simpa [radiusActivity] using + mul_le_mul' hc (le_refl (∑' l, a l * ((1+l : ℕ) : ℝ≥0∞)^2)) + +def radiusPotential (a : ℕ → ℝ≥0∞) (z : ℤ × ℤ) : ℝ := (radiusEnvelope a z).toReal + +lemma radiusPotential_nonneg (a : ℕ → ℝ≥0∞) (z : ℤ × ℤ) : 0 ≤ radiusPotential a z := + ENNReal.toReal_nonneg + +lemma expSlope_one_le : 1 ≤ ENNReal.ofReal (2*Real.exp 2) := by + have h : (1:ℝ) ≤ Real.exp 2 := Real.one_le_exp_iff.mpr (by norm_num) + simpa only [ENNReal.ofReal_one] using ENNReal.ofReal_le_ofReal (by linarith : (1:ℝ) ≤ 2*Real.exp 2) + +lemma small_activity_envelope_le_one (a : ℕ → ℝ≥0∞) + (ha : ENNReal.ofReal (2*Real.exp 2) * radiusActivity a ≤ (1/2:ℝ≥0∞)) + (z : ℤ × ℤ) : radiusEnvelope a z ≤ 1 := by + refine (radiusEnvelope_le_activity a z).trans ?_ + calc + radiusActivity a ≤ ENNReal.ofReal (2*Real.exp 2)*radiusActivity a := by + simpa using mul_le_mul' expSlope_one_le (le_refl (radiusActivity a)) + _ ≤ (1/2:ℝ≥0∞) := ha + _ ≤ 1 := by norm_num + +lemma radiusPotential_cast (a : ℕ → ℝ≥0∞) (z : ℤ × ℤ) + (h : radiusEnvelope a z ≤ 1) : ENNReal.ofReal (radiusPotential a z) = radiusEnvelope a z := + ENNReal.ofReal_toReal (ne_top_of_le_ne_top (by norm_num) h) + +theorem small_radius_potential_moment (m T : ℕ) (hT : T ≤ 3^m) (a : ℕ → ℝ≥0∞) + (ha : ENNReal.ofReal (2*Real.exp 2) * radiusActivity a ≤ (1/2:ℝ≥0∞)) : + (∑' w, fourLaw m w * ENNReal.ofReal (Real.exp + (2 * ∑ u ∈ Finset.range (T+1), radiusPotential a (differenceAt m u w)))) ≤ 2 := by + apply radius_exponential_bound m T hT a (radiusPotential a) (radiusPotential_nonneg a) + · intro z + exact ENNReal.toReal_le_of_le_ofReal (by norm_num) (by simpa using small_activity_envelope_le_one a ha z) + · intro z + exact (radiusPotential_cast a z (small_activity_envelope_le_one a ha z)).le + · exact ha + +def geometricRadiusWeights (A R : ℕ) (b q : ℝ≥0∞) (l : ℕ) : ℝ≥0∞ := + (if l=R then b else 0) + ∑' m : ℕ, if l=A*(m+1) then q^(m+1) else 0 + +lemma geometricRadiusWeights_activity (A R : ℕ) (b q : ℝ≥0∞) : + radiusActivity (geometricRadiusWeights A R b q) = + ENNReal.ofReal orderedEncounterConstant * + (b*((1+R : ℕ) : ℝ≥0∞)^2 + + ∑' m : ℕ, q^(m+1) * ((1+A*(m+1) : ℕ) : ℝ≥0∞)^2) := by + unfold radiusActivity geometricRadiusWeights + congr 1 + simp_rw [add_mul, ← ENNReal.tsum_mul_right] + rw [ENNReal.tsum_add, ENNReal.tsum_comm] + simp only [ite_mul, zero_mul, tsum_ite_eq] + +lemma geometricRadiusWeights_envelope (A R : ℕ) (b q : ℝ≥0∞) (z : ℤ × ℤ) : + radiusEnvelope (geometricRadiusWeights A R b q) z = + (if z ∈ square R then b else 0) + + ∑' m : ℕ, if z ∈ square (A*(m+1)) then q^(m+1) else 0 := by + unfold radiusEnvelope geometricRadiusWeights + have he (l : ℕ) : + (if z ∈ square l then + (if l=R then b else 0) + ∑' m : ℕ, if l=A*(m+1) then q^(m+1) else 0 else 0) = + (if l=R then (if z ∈ square R then b else 0) else 0) + + ∑' m : ℕ, if l=A*(m+1) then (if z ∈ square (A*(m+1)) then q^(m+1) else 0) else 0 := by + by_cases hz : z ∈ square l + · simp only [ite_eq_left hz] + congr 1 + · rcases eq_or_ne l R with rfl | hl + · simp [hz] + · simp [hl] + · apply tsum_congr + intro m + rcases eq_or_ne l (A*(m+1)) with rfl | hl + · simp [hz] + · simp [hl] + · rw [ite_eq_right hz] + have hb : (if l=R then (if z ∈ square R then b else 0) else 0) = 0 := by + rcases eq_or_ne l R with rfl | hl + · simp [hz] + · simp [hl] + rw [hb, zero_add] + symm + apply ENNReal.tsum_eq_zero.mpr + intro m + rcases eq_or_ne l (A*(m+1)) with rfl | hl + · simp [hz] + · simp [hl] + simp_rw [he] + rw [ENNReal.tsum_add, ENNReal.tsum_comm] + simp only [tsum_ite_eq] + +lemma succ_le_two_pow (n : ℕ) : n+1 ≤ 2^n := by + induction n with + | zero => norm_num + | succ n ih => + rw [pow_succ] + have hp : 1 ≤ 2^n := Nat.one_le_pow n 2 (by norm_num) + omega + +lemma radius_polynomial_le (A m : ℕ) : + (1+A*(m+1))^2 ≤ (1+A)^2 * 4^m := by + calc + _ ≤ ((1+A)*2^m)^2 := Nat.pow_le_pow_left (by + calc + 1+A*(m+1) ≤ (1+A)*(m+1) := by nlinarith + _ ≤ (1+A)*2^m := Nat.mul_le_mul_left _ (succ_le_two_pow m)) 2 + _ = _ := by rw [mul_pow, ← pow_mul, Nat.mul_comm m 2, pow_mul]; norm_num + +lemma geometric_radius_tail_le (A : ℕ) (q : ℝ≥0∞) (hq : q ≤ 1/8) : + (∑' m : ℕ, q^(m+1) * ((1+A*(m+1) : ℕ) : ℝ≥0∞)^2) ≤ + 2*q*((1+A : ℕ) : ℝ≥0∞)^2 := by + have h4q : (4:ℝ≥0∞)*q ≤ 1/2 := by + calc + _ ≤ 4*(1/8:ℝ≥0∞) := mul_le_mul' le_rfl hq + _ = _ := by + have h : (4:ℝ≥0)*(1/8)=1/2 := by norm_num + have hh := congrArg (fun x : ℝ≥0 ↦ (x:ℝ≥0∞)) h + simpa only [ENNReal.coe_mul, ENNReal.coe_div (show (8:ℝ≥0) ≠ 0 by norm_num), + ENNReal.coe_div (show (2:ℝ≥0) ≠ 0 by norm_num), ENNReal.coe_ofNat, + ENNReal.coe_one] using hh + calc + _ ≤ ∑' m : ℕ, q * ((1+A : ℕ) : ℝ≥0∞)^2 * ((1/2:ℝ≥0∞)^m) := by + apply ENNReal.tsum_le_tsum + intro m + calc + _ ≤ q^(m+1) * (((1+A : ℕ) : ℝ≥0∞)^2 * 4^m) := by + apply mul_le_mul' le_rfl + exact_mod_cast radius_polynomial_le A m + _ = q * ((1+A : ℕ) : ℝ≥0∞)^2 * ((4*q)^m) := by + rw [pow_succ, mul_pow] + ring + _ ≤ _ := mul_le_mul' le_rfl (pow_le_pow_left' h4q m) + _ = _ := by + rw [ENNReal.tsum_mul_left, ENNReal.tsum_geometric] + norm_num + ring + +lemma small_parameters (A R : ℕ) (C S : ℝ) (hC : 0 ≤ C) (hS : 0 ≤ S) : + ∃ κ p₀ : ℝ, 0 < κ ∧ 0 < p₀ ∧ + ∀ p : ℝ, 0 ≤ p → p ≤ p₀ → + let q := (A:ℝ)*p*Real.exp (κ*C) + 0 ≤ q ∧ q ≤ 1/8 ∧ + S * (C*κ*((1+R:ℕ):ℝ)^2 + 2*q*((1+A:ℕ):ℝ)^2) ≤ 1/2 := by + let B : ℝ := S*(C*((1+R:ℕ):ℝ)^2+2*((1+A:ℕ):ℝ)^2) + have hB : 0 ≤ B := by dsimp [B]; positivity + obtain ⟨η, hη, hηB⟩ := exists_pos_mul_lt (by norm_num : (0:ℝ) < 1/2) B + let κ := min η (1/8:ℝ) + have hκ : 0 < κ := lt_min hη (by norm_num) + have hκ8 : κ ≤ 1/8 := min_le_right _ _ + have hκB : B*κ ≤ 1/2 := + (mul_le_mul_of_nonneg_left (min_le_left _ _) hB).trans hηB.le + obtain ⟨p₀, hp₀, hp₀κ⟩ := exists_pos_mul_lt hκ ((A:ℝ)*Real.exp (κ*C)) + refine ⟨κ, p₀, hκ, hp₀, ?_⟩ + intro p hp hpp + dsimp only + have hq0 : 0 ≤ (A:ℝ)*p*Real.exp (κ*C) := by positivity + have hqκ : (A:ℝ)*p*Real.exp (κ*C) ≤ κ := by + calc + _ = ((A:ℝ)*Real.exp (κ*C))*p := by ring + _ ≤ ((A:ℝ)*Real.exp (κ*C))*p₀ := mul_le_mul_of_nonneg_left hpp (by positivity) + _ ≤ κ := hp₀κ.le + refine ⟨hq0, hqκ.trans hκ8, ?_⟩ + calc + _ ≤ S*(C*κ*((1+R:ℕ):ℝ)^2+2*κ*((1+A:ℕ):ℝ)^2) := by + apply mul_le_mul_of_nonneg_left _ hS + linarith [mul_le_mul_of_nonneg_right hqκ (by positivity : 0 ≤ 2*((1+A:ℕ):ℝ)^2)] + _ = B*κ := by dsimp [B]; ring + _ ≤ 1/2 := hκB + +def foldIndex (n : ℕ) (j : Fin (n+1)) : Fin (n/2+1) × Bool := + if hj : j.val ≤ n/2 then (⟨j.val, by omega⟩, false) + else (⟨n-j.val, by omega⟩, true) + +lemma foldIndex_value (n : ℕ) (j : Fin (n+1)) : + (foldIndex n j).1.val = min j.val (n-j.val) := by + unfold foldIndex + split_ifs with h <;> simp only + · omega + · omega + +lemma foldIndex_injective (n : ℕ) : Function.Injective (foldIndex n) := by + intro i j h + have h₁ := congrArg (fun x : Fin (n/2+1) × Bool ↦ x.1.val) h + have h₂ := congrArg Prod.snd h + unfold foldIndex at h₁ h₂ + split_ifs at h₁ h₂ <;> simp_all only + all_goals apply Fin.ext; omega + +lemma folded_sum_le (n : ℕ) (f : ℕ → ℝ) (hf : ∀ j, 0 ≤ f j) : + (∑ j ∈ Finset.range (n+1), f (min j (n-j))) ≤ + 2 * ∑ j ∈ Finset.range (n/2+1), f j := by + let g : Fin (n/2+1) × Bool → ℝ := fun x ↦ f x.1.val + have hs : (∑ x ∈ Finset.univ.image (foldIndex n), g x) ≤ ∑ x, g x := by + exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) (fun x _ _ ↦ hf _) + rw [Finset.sum_image (fun i _ j _ hij ↦ foldIndex_injective n hij)] at hs + have hleft : (∑ i : Fin (n+1), g (foldIndex n i)) = + ∑ j ∈ Finset.range (n+1), f (min j (n-j)) := by + simp only [g, foldIndex_value] + exact Fin.sum_univ_eq_sum_range (fun j ↦ f (min j (n-j))) (n+1) + have hright : (∑ x : Fin (n/2+1) × Bool, g x) = + 2 * ∑ j ∈ Finset.range (n/2+1), f j := by + simp only [Fintype.sum_prod_type, Fintype.sum_bool, g, ← two_mul, ← Finset.mul_sum, + Fin.sum_univ_eq_sum_range] + simpa only [hleft, hright] using hs + +lemma geometricRadiusWeights_activity_le (A R : ℕ) (b q : ℝ≥0∞) (hq : q ≤ 1/8) : + radiusActivity (geometricRadiusWeights A R b q) ≤ + ENNReal.ofReal orderedEncounterConstant * + (b*((1+R:ℕ):ℝ≥0∞)^2 + 2*q*((1+A:ℕ):ℝ≥0∞)^2) := by + rw [geometricRadiusWeights_activity] + exact mul_le_mul' le_rfl (add_le_add le_rfl (geometric_radius_tail_le A q hq)) + +lemma folded_radius_potential_moment (m n : ℕ) (hn : n/2 ≤ 3^m) + (a : ℕ → ℝ≥0∞) + (ha : ENNReal.ofReal (2*Real.exp 2)*radiusActivity a ≤ (1/2:ℝ≥0∞)) : + (∑' w, fourLaw m w * ENNReal.ofReal (Real.exp + (∑ j ∈ Finset.range (n+1), radiusPotential a (differenceAt m (min j (n-j)) w)))) ≤ 2 := by + refine le_trans ?_ (small_radius_potential_moment m (n/2) hn a ha) + apply ENNReal.tsum_le_tsum + intro w + apply mul_le_mul' le_rfl + apply ENNReal.ofReal_le_ofReal + apply Real.exp_le_exp.mpr + exact folded_sum_le n (fun u ↦ radiusPotential a (differenceAt m u w)) + (fun _ ↦ radiusPotential_nonneg a _) + +theorem geometric_folded_moment (A R : ℕ) (C : ℝ) (hC : 0 ≤ C) : + ∃ κ p₀ : ℝ, 0 < κ ∧ 0 < p₀ ∧ + ∀ p : ℝ, 0 ≤ p → p ≤ p₀ → + ∀ m n : ℕ, n/2 ≤ 3^m → + let a := geometricRadiusWeights A R (ENNReal.ofReal (C*κ)) + (ENNReal.ofReal ((A:ℝ)*p*Real.exp (κ*C))) + (∑' w, fourLaw m w * ENNReal.ofReal (Real.exp + (∑ j ∈ Finset.range (n+1), radiusPotential a (differenceAt m (min j (n-j)) w)))) ≤ 2 := by + have hcan := orderedEncounterConstant_pos + let S : ℝ := (2*Real.exp 2)*orderedEncounterConstant + have hS : 0 ≤ S := by dsimp [S]; positivity + obtain ⟨κ, p₀, hκ, hp₀, hpars⟩ := small_parameters A R C S hC hS + refine ⟨κ, p₀, hκ, hp₀, ?_⟩ + intro p hp hpp m n hn + dsimp only + rcases hpars p hp hpp with ⟨hq0, hq8, hbound⟩ + let q := (A:ℝ)*p*Real.exp (κ*C) + have hq0' : 0 ≤ q := hq0 + have hq8' : ENNReal.ofReal q ≤ (1/8:ℝ≥0∞) := by + simpa only [ENNReal.ofReal_div_of_pos (by norm_num : (0:ℝ)<8), + ENNReal.ofReal_one, ENNReal.ofReal_ofNat] using ENNReal.ofReal_le_ofReal hq8 + apply folded_radius_potential_moment m n hn + calc + _ ≤ ENNReal.ofReal (2*Real.exp 2) * (ENNReal.ofReal orderedEncounterConstant * + (ENNReal.ofReal (C*κ)*((1+R:ℕ):ℝ≥0∞)^2 + + 2*ENNReal.ofReal q*((1+A:ℕ):ℝ≥0∞)^2)) := by + exact mul_le_mul' le_rfl (geometricRadiusWeights_activity_le A R _ _ hq8') + _ = ENNReal.ofReal (S*(C*κ*((1+R:ℕ):ℝ)^2+2*q*((1+A:ℕ):ℝ)^2)) := by + dsimp only [S] + simp (disch := positivity) only [ENNReal.ofReal_mul, ENNReal.ofReal_add, + ENNReal.ofReal_pow, ENNReal.ofReal_natCast, ENNReal.ofReal_ofNat] + ring + _ ≤ (1/2:ℝ≥0∞) := by + simpa only [ENNReal.ofReal_div_of_pos (by norm_num : (0:ℝ)<2), + ENNReal.ofReal_one, ENNReal.ofReal_ofNat] using ENNReal.ofReal_le_ofReal hbound + +lemma integer_step_lipschitz (f : ℕ → ℤ) (H : ℕ) (L : ℤ) + (hstep : ∀ i simp + | @succ b hab ih => + have h := hstep b (by omega) + have hh := ih (by omega) + calc + |f (b+1)-f a| ≤ |f (b+1)-f b|+|f b-f a| := abs_sub_le _ _ _ + _ ≤ L+L*((b:ℤ)-a) := add_le_add h hh + _ = _ := by push_cast; ring + rcases le_total i j with h|h + · rw [abs_sub_comm (f i),abs_sub_comm (i:ℤ),abs_of_nonneg (by omega : 0≤(j:ℤ)-i)] + exact hforward i j h hj + · rw [abs_of_nonneg (by omega : 0≤(i:ℤ)-j)] + exact hforward j i h hi + +lemma walk_lipschitz (m : ℕ) (w : TreeNoise m) {i j : ℕ} (hi : i≤3^m) (hj : j≤3^m) : + |walk m w i-walk m w j|≤|(i:ℤ)-j| := by + simpa only [one_mul] using integer_step_lipschitz (walk m w) (3^m) 1 + (fun k hk ↦ (walk_increment m w k hk).le) hi hj + +lemma walk_abs_le (m : ℕ) (w : TreeNoise m) {j : ℕ} (hj : j≤3^m) : |walk m w j|≤j := by + simpa using walk_lipschitz m w hj (show 0≤3^m by omega) + +lemma folded_index_lipschitz (n : ℕ) (i j : Fin (n+1)) : + |((min i.val (n-i.val):ℕ):ℤ)-(min j.val (n-j.val):ℕ)|≤|(i.val:ℤ)-j.val| := by + have hi := i.isLt + have hj := j.isLt + have h := abs_min_sub_min_le_max (i.val:ℤ) ((n:ℤ)-i.val) (j.val:ℤ) ((n:ℤ)-j.val) + have he : |((n:ℤ)-i.val)-((n:ℤ)-j.val)|=|(i.val:ℤ)-j.val| := by + rw [sub_sub_sub_cancel_left,abs_sub_comm] + simpa only [Nat.cast_min,Int.natCast_sub (show i.val≤n by omega), + Int.natCast_sub (show j.val≤n by omega),he,max_self] using h + +end HardSphere.Lattice +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/RawAngleLift.lean b/lean/OAI/Analysis/HardSphere/Geometry/RawAngleLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..a46464a020191004dc78347dc94ab9bb2e3fa17c --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/RawAngleLift.lean @@ -0,0 +1,202 @@ +import Mathlib +import OAI.Analysis.HardSphere.PathBounds.ConfigurationTailLp +import OAI.Analysis.HardSphere.Geometry.TorusLiftBox +import OAI.Analysis.HardSphere.Cutoffs.ThreeTorus +import OAI.Analysis.HardSphere.Cutoffs.Failure + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open PeriodicCutoff +open scoped ComplexConjugate + +def rawAngleLift (n : ℕ) (L : Length) (r : ℝ) (i : Fin n) (R : LiftedConfiguration (n+1)) : ℝ := + angleLift L.val r (R 0-R i.succ) + +def rawCutoffReal (n : ℕ) (L : Length) (r : ℝ) (X : Configuration (n+1) L) : ℝ := + ∏ i : Fin n, Real.sin (angle L.val r (X 0) (X i.succ)) + +lemma rawAngleLift_smooth (n : ℕ) (L : Length) (r : ℝ) (i : Fin n) : + ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (rawAngleLift n L r i) := + (angleLift_smooth L.val r).comp ((contDiff_apply ℝ (Fin 3 → ℝ) 0).sub + (contDiff_apply ℝ (Fin 3 → ℝ) i.succ)) + +lemma angle_project (n : ℕ) (L : Length) (r : ℝ) (i : Fin n) (R : LiftedConfiguration (n+1)) : + angle L.val r (project (n+1) L R 0) (project (n+1) L R i.succ)=rawAngleLift n L r i R := by + change Real.pi/2*Real.smoothTransition ((pairQ L.val (fun j ↦ (R 0 j : AddCircle L.val)) + (fun j ↦ (R i.succ j : AddCircle L.val))-2*r^2)/(2*r^2))=_ + rw [pairQ_coe] + rfl + +lemma rawCutoffReal_smooth (n : ℕ) (L : Length) (r : ℝ) : + ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (fun R : LiftedConfiguration (n+1) ↦ + rawCutoffReal n L r (project (n+1) L R)) := by + simp only [rawCutoffReal,angle_project] + exact contDiff_prod (fun i _ ↦ (rawAngleLift_smooth n L r i).sin) + +def rawCutoff (n : ℕ) (L : Length) (r : ℝ) : SmoothMultiplier (n+1) L := + .ofSmooth (fun X ↦ (rawCutoffReal n L r X : ℂ)) + (Complex.ofRealCLM.contDiff.comp (rawCutoffReal_smooth n L r)) + +lemma rawCutoff_real (n : ℕ) (L : Length) (r : ℝ) (X : Configuration (n+1) L) : + conj ((rawCutoff n L r).toFun X)=(rawCutoff n L r).toFun X := Complex.conj_ofReal _ + +lemma rawCutoff_norm_sq (n : ℕ) (L : Length) (r : ℝ) (X : Configuration (n+1) L) : + ‖(rawCutoff n L r).toFun X‖^2=rawCutoffReal n L r X^2 := by + change ‖(rawCutoffReal n L r X : ℂ)‖^2=_ + rw [Complex.norm_real,Real.norm_eq_abs,sq_abs] + +lemma rawCutoff_clearance (n : ℕ) (L : Length) {r : ℝ} (hr : 0 first | rfl | simp only [one_mul]) + have he : (rawAngleLift n L r i ∘ fun t : ℝ ↦ R+t • v)= + (fun t : ℝ ↦ angleLift L.val r (fun j ↦ (R 0 j+t*v 0 j)-(R i.succ j+t*v i.succ j))) := rfl + rw [he] at hf + convert hf.unique ha using 1 + simp only [zero_mul,add_zero] + rfl + +lemma rawAngleLift_fderiv_coord (n : ℕ) (L : Length) (r : ℝ) (i : Fin n) + (R : LiftedConfiguration (n+1)) (p : Direction (n+1)) : + fderiv ℝ (rawAngleLift n L r i) R (Pi.single p.1 (Pi.single p.2 1)) = + ((if p.1=0 then (1:ℝ) else 0)-(if p.1=i.succ then 1 else 0))* + anglePartial L.val r (R 0-R i.succ) p.2 := by + rw [rawAngleLift_fderiv] + by_cases h0 : p.1=0 <;> by_cases hi : p.1=i.succ + · exact False.elim (Fin.succ_ne_zero i (hi.symm.trans h0)) + · simp [h0,Pi.single_apply,eq_comm,Finset.sum_ite_eq',mul_comm] + · simp [hi,Pi.single_apply,eq_comm,Finset.sum_ite_eq',mul_comm] + · simp [h0,hi,Ne.symm h0,Ne.symm hi] + +lemma rawCutoff_derivative_sq_le (n : ℕ) (L : Length) (r : ℝ) + (X : Configuration (n+1) L) (p : Direction (n+1)) : + ‖coordDerivative (n+1) L (rawCutoff n L r).toFun p X‖^2≤ + ∑ i : Fin n, (fderiv ℝ (rawAngleLift n L r i) (representative (n+1) L X) + (Pi.single p.1 (Pi.single p.2 1)))^2 := by + let R := representative (n+1) L X + let v : LiftedConfiguration (n+1) := Pi.single p.1 (Pi.single p.2 1) + have he : (fun Y : LiftedConfiguration (n+1) ↦ (rawCutoff n L r).toFun (project (n+1) L Y))= + Complex.ofRealCLM ∘ (fun Y : LiftedConfiguration (n+1) ↦ ∏ i : Fin n, Real.sin (rawAngleLift n L r i Y)) := by + funext Y + change (rawCutoffReal n L r (project (n+1) L Y) : ℂ)=_ + simp only [rawCutoffReal,angle_project,Function.comp_apply,Complex.ofRealCLM_apply] + have hd := (rawCutoffReal_smooth n L r).differentiable (by simp) + simp only [rawCutoffReal,angle_project] at hd + change ‖fderiv ℝ (fun Y ↦ (rawCutoff n L r).toFun (project (n+1) L Y)) R v‖^2≤_ + rw [he,fderiv_comp R Complex.ofRealCLM.differentiableAt (hd R),Complex.ofRealCLM.fderiv] + simp only [ContinuousLinearMap.comp_apply,Complex.ofRealCLM_apply,Complex.norm_real,Real.norm_eq_abs,sq_abs] + exact SineProduct.fderiv_sq_le Finset.univ (rawAngleLift n L r) R v + (fun i _ ↦ (rawAngleLift_smooth n L r i).differentiable (by simp) R) + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/RealComp.lean b/lean/OAI/Analysis/HardSphere/Geometry/RealComp.lean new file mode 100644 index 0000000000000000000000000000000000000000..10453e203b2f6f6747d69cfd07d594d1fd384f5f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/RealComp.lean @@ -0,0 +1,59 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.InnerClmRealRight +import OAI.Analysis.HardSphere.Geometry.TorusLiftBox + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate + +def SmoothMultiplier.realComp {n : ℕ} {L : Length} (f : SmoothMultiplier n L) + (φ : ℝ → ℝ) (hφ : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) φ) : SmoothMultiplier n L := + .ofSmooth (fun X ↦ (φ (f.toFun X).re : ℂ)) + (Complex.ofRealCLM.contDiff.comp (hφ.comp (Complex.reCLM.contDiff.comp f.smooth))) + +lemma SmoothMultiplier.partial_realComp {n : ℕ} {L : Length} (f : SmoothMultiplier n L) + (φ : ℝ → ℝ) (hφ : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) φ) + (hf : ∀ X, conj (f.toFun X)=f.toFun X) (p : Direction n) (X : Configuration n L) : + coordDerivative n L (f.realComp φ hφ).toFun p X= + ((deriv φ (f.toFun X).re : ℝ) : ℂ)*coordDerivative n L f.toFun p X := by + let R := representative n L X + let v : LiftedConfiguration n := Pi.single p.1 (Pi.single p.2 (1:ℝ)) + have hline : HasDerivAt (fun t : ℝ ↦ R+t • v) v 0 := by + simpa using ((hasDerivAt_id (0:ℝ)).smul_const v).const_add R + have hdf := (f.smooth.differentiable (by simp) R).hasFDerivAt.comp_hasDerivAt_of_eq 0 hline (by simp) + have hdφ := (hφ.differentiable (by simp) (f.toFun (project n L R)).re).hasDerivAt + have hreal := Complex.reCLM.hasFDerivAt.comp_hasDerivAt 0 hdf + have hchain := Complex.ofRealCLM.hasFDerivAt.comp_hasDerivAt 0 (hdφ.comp_of_eq 0 hreal (by simp)) + have hnew := ((f.realComp φ hφ).smooth.differentiable (by simp) R).hasFDerivAt.comp_hasDerivAt_of_eq + 0 hline (by simp) + have he := hnew.unique hchain + change coordDerivative n L (f.realComp φ hφ).toFun p X = _ at he + simp only [Complex.ofRealCLM_apply,Complex.reCLM_apply] at he + rw [show project n L R=X from project_representative n L X] at he + have hder : ((coordDerivative n L f.toFun p X).re : ℂ)=coordDerivative n L f.toFun p X := by + apply Complex.ext + · rfl + · have h := congrArg Complex.im (f.partial_real hf p X) + simp only [Complex.conj_im] at h + simp only [Complex.ofReal_im] + linarith + change _ = ((deriv φ (f.toFun X).re * (coordDerivative n L f.toFun p X).re : ℝ) : ℂ) at he + rw [Complex.ofReal_mul,hder] at he + exact he + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/RoundBox.lean b/lean/OAI/Analysis/HardSphere/Geometry/RoundBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..a254f57f5b265f354147c322b954eb3024f5b5e6 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/RoundBox.lean @@ -0,0 +1,365 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.StarOffsets + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators Classical +namespace HardSphere.Lattice +variable {A : Type*} [AddCommGroup A] + +lemma double_avoiding_step (C : Finset Vertex) {x y : Vertex} + (hx : x∉C) (hy : y∉C) (hxy : nearestStep x y) : + withinReach nearestStep ((↑(thicken C))ᶜ) (doubleVertex x) (doubleVertex y) := by + have hpos : ∀ u (i : Fin 3), u∉C → step u i∉C → + withinReach nearestStep ((↑(thicken C))ᶜ) (doubleVertex u) (doubleVertex (step u i)) := by + intro u i hu hui + have hu' : doubleVertex u∉thicken C := by simpa only [double_mem_thicken_iff] using hu + have hui' : doubleVertex (step u i)∉thicken C := by simpa only [double_mem_thicken_iff] using hui + have hm := splitPoint_not_thicken C u i hu hui + have hs : nearestStep (step (doubleVertex u) i) (doubleVertex (step u i)) := by + rw [double_step]; exact nearestStep_step _ _ + exact (Relation.ReflTransGen.single ⟨hu',hm,nearestStep_step _ i⟩).tail ⟨hm,hui',hs⟩ + obtain ⟨i,hi|hi⟩ := nearestStep_eq_step hxy + · subst y; exact hpos x i hx hy + · subst x; exact withinReach_symm (fun _ _ ↦ nearestStep_symm) (hpos y i hy hx) + +lemma double_avoidingReach (C : Finset Vertex) {x y : Vertex} + (h : avoidingReach C x y) : + withinReach nearestStep ((↑(thicken C))ᶜ) (doubleVertex x) (doubleVertex y) := by + induction h using Relation.ReflTransGen.trans_induction_on with + | refl => exact .refl + | single h => exact double_avoiding_step C h.1 h.2.1 h.2.2 + | trans _ _ ih₁ ih₂ => exact ih₁.trans ih₂ + +def roundBox (z : Vertex) : Set Vertex := {x | ∀ i, |2*x i-z i|≤1} + +lemma roundBox_nonempty (z : Vertex) : (roundBox z).Nonempty := by + refine ⟨fun i ↦ z i/2,fun i ↦ abs_le.mpr ?_⟩ + dsimp only + constructor <;> omega + +lemma roundBox_NNConnected (z : Vertex) : NNConnected (roundBox z) := by + intro x hx y hy + apply box_reach + intro u hu i + have hxi := abs_le.mp (hx i) + have hyi := abs_le.mp (hy i) + have hui := hu i + apply abs_le.mpr + constructor <;> omega + +lemma roundBox_overlap {z w : Vertex} (hzw : ∀ i, |z i-w i|≤1) : + (roundBox z ∩ roundBox w).Nonempty := by + refine ⟨fun i ↦ max (z i) (w i)/2,?_,?_⟩ <;> intro i + · have h := abs_le.mp (hzw i) + dsimp only + apply abs_le.mpr + constructor <;> omega + · have h := abs_le.mp (hzw i) + dsimp only + apply abs_le.mpr + constructor <;> omega + +lemma nearestStep_starBound {x y : Vertex} (h : nearestStep x y) : + ∀ i, |x i-y i|≤1 := by + obtain ⟨j,hj,hrest⟩ := h + intro i + by_cases hi : i=j + · subst i; exact hj.le + · rw [hrest i hi,sub_self,abs_zero]; omega + +lemma roundBox_avoids (C : Finset Vertex) {z : Vertex} (hz : z∉thicken C) : + roundBox z⊆((↑C : Set Vertex)ᶜ) := by + intro x hx hxc + apply hz + apply (mem_thicken C z).mpr + refine ⟨x,hxc,fun i ↦ ?_⟩ + rw [abs_sub_comm] + exact hx i + +lemma round_nearest_reach {D : Set Vertex} {z w x y : Vertex} + (hz : roundBox z⊆D) (hw : roundBox w⊆D) + (hzw : ∀ i, |z i-w i|≤1) (hx : x∈roundBox z) (hy : y∈roundBox w) : + withinReach nearestStep D x y := by + obtain ⟨m,hmz,hmw⟩ := roundBox_overlap hzw + exact (withinReach_mono hz (roundBox_NNConnected z x hx m hmz)).trans + (withinReach_mono hw (roundBox_NNConnected w m hmw y hy)) + +lemma round_avoidingReach (C : Finset Vertex) {z w : Vertex} + (h : withinReach nearestStep ((↑(thicken C))ᶜ) z w) + (hz : z∉thicken C) {x y : Vertex} (hx : x∈roundBox z) (hy : y∈roundBox w) : + avoidingReach C x y := by + induction h using Relation.ReflTransGen.trans_induction_on generalizing x y with + | refl => exact withinReach_mono (roundBox_avoids C hz) (roundBox_NNConnected _ x hx y hy) + | single h => + exact round_nearest_reach (roundBox_avoids C h.1) (roundBox_avoids C h.2.1) + (nearestStep_starBound h.2.2) hx hy + | @trans a b c hab hbc ih₁ ih₂ => + have hb : b∉thicken C := withinReach_end hz hab + obtain ⟨m,hm⟩ := roundBox_nonempty b + exact (ih₁ hz hx hm).trans (ih₂ hb hm hy) + +lemma mem_round_double (x : Vertex) : x∈roundBox (doubleVertex x) := by + intro i; simp [doubleVertex] + +lemma round_component_exterior (C : Finset Vertex) {r z x : Vertex} + (hr : r∈exterior C) (hz : z∈complementComponent (↑(thicken C)) (doubleVertex r)) + (hx : x∈roundBox z) : x∈exterior C := by + apply exterior_of_reach C hr + exact round_avoidingReach C hz.2 (by simpa only [double_mem_thicken_iff] using hr.1) + (mem_round_double r) hx + +lemma round_boundary_shell (C : Finset Vertex) {r z : Vertex} (hr : r∈exterior C) + (hz : z∈nnBoundary (↑(thicken C)) (complementComponent (↑(thicken C)) (doubleVertex r))) : + roundBox z⊆exteriorShell C := by + intro x hx + refine ⟨round_component_exterior C hr hz.1 hx,?_⟩ + obtain ⟨a,ha,haz⟩ := hz.2 + obtain ⟨c,hc,hca⟩ := (mem_thicken C a).mp ha + refine ⟨c,hc,?_,?_⟩ + · intro he + exact (round_component_exterior C hr hz.1 hx).1 (he ▸ hc) + · intro i + have ha' := abs_le.mp (hca i) + have hz' := abs_le.mp (nearestStep_starBound haz i) + have hx' := abs_le.mp (hx i) + apply abs_le.mpr + constructor <;> omega + +lemma withinReach_first_entry {D A : Set Vertex} {x y : Vertex} + (h : withinReach nearestStep D x y) (hxD : x∈D) (hx : x∉A) (hy : y∈A) : + ∃ u v, withinReach nearestStep (D∩Aᶜ) x u ∧ u∈D ∧ u∉A ∧ v∈A ∧ nearestStep u v := by + induction h using Relation.ReflTransGen.head_induction_on with + | refl => exact (hx hy).elim + | @head z w hzw _ ih => + by_cases hw : w∈A + · exact ⟨z,w,.refl,hxD,hx,hw,hzw.2.2⟩ + · obtain ⟨u,v,hu,huD,huA,hvA,huv⟩ := ih hzw.2.1 hw + exact ⟨u,v,hu.head ⟨⟨hxD,hx⟩,⟨hzw.2.1,hw⟩,hzw.2.2⟩,huD,huA,hvA,huv⟩ + +lemma shell_covered_by_boundary (C : Finset Vertex) {r x : Vertex} + (hr : r∈exterior C) (hx : x∈exteriorShell C) : + ∃ z∈nnBoundary (↑(thicken C)) (complementComponent (↑(thicken C)) (doubleVertex r)), + x∈roundBox z := by + obtain ⟨c,hc,hcx⟩ := hx.2 + let m : Vertex := x+c + let D : Set Vertex := {z | ∀ i, |z i-2*x i|≤1} + have hstart : doubleVertex x∈D := by intro i; simp [doubleVertex] + have hm : m∈thicken C := by + apply (mem_thicken C m).mpr + refine ⟨c,hc,fun i ↦ ?_⟩ + change |x i+c i-2*c i|≤1 + rw [show x i+c i-2*c i=x i-c i by ring,abs_sub_comm] + exact hcx.2 i + have hxnot : doubleVertex x∉thicken C := by simpa only [double_mem_thicken_iff] using hx.1.1 + have hp : withinReach nearestStep D (doubleVertex x) m := by + apply box_reach + intro z hz i + have hi := abs_le.mp (hcx.2 i) + have hz' := hz i + change min (2*x i) (x i+c i)≤z i ∧ z i≤ max (2*x i) (x i+c i) at hz' + apply abs_le.mpr + constructor <;> omega + obtain ⟨u,v,hu,huD,huA,hvA,huv⟩ := withinReach_first_entry hp hstart hxnot hm + have hb : u∈complementComponent (↑(thicken C)) (doubleVertex r) := by + refine ⟨huA,?_⟩ + exact (double_avoidingReach C (exterior_avoidingReach C hr hx.1)).trans + (withinReach_mono (fun _ hz ↦ hz.2) hu) + refine ⟨u,⟨hb,v,hvA,nearestStep_symm huv⟩,fun i ↦ ?_⟩ + rw [abs_sub_comm] + exact huD i + +lemma round_boundary_reach (C : Finset Vertex) {r z w : Vertex} (hr : r∈exterior C) + (h : withinReach starStep + (nnBoundary (↑(thicken C)) (complementComponent (↑(thicken C)) (doubleVertex r))) z w) + (hz : z∈nnBoundary (↑(thicken C)) (complementComponent (↑(thicken C)) (doubleVertex r))) + {x y : Vertex} (hx : x∈roundBox z) (hy : y∈roundBox w) : + withinReach nearestStep (exteriorShell C) x y := by + induction h using Relation.ReflTransGen.trans_induction_on generalizing x y with + | refl => exact withinReach_mono (round_boundary_shell C hr hz) (roundBox_NNConnected _ x hx y hy) + | single h => + exact round_nearest_reach (round_boundary_shell C hr h.1) (round_boundary_shell C hr h.2.1) + h.2.2.2 hx hy + | @trans a b c hab hbc ih₁ ih₂ => + have hb := withinReach_end hz hab + obtain ⟨m,hm⟩ := roundBox_nonempty b + exact (ih₁ hz hx hm).trans (ih₂ hb hm hy) + +theorem exteriorShell_NNConnected (C : Finset Vertex) (hC : starConnected (↑C)) : + NNConnected (exteriorShell C) := by + intro x hx y hy + obtain ⟨z,hz,hxz⟩ := shell_covered_by_boundary C hx.1 hx + obtain ⟨w,hw,hyw⟩ := shell_covered_by_boundary C hx.1 hy + have hc := nnBoundary_starConnected (thicken C).finite_toSet (thicken_NNConnected C hC) + (complementComponent_spec (↑(thicken C)) (doubleVertex x)) + exact round_boundary_reach C hx.1 (hc z hz w hw) hz hxz hyw + +lemma nearestStep_ne {x y : Vertex} (h : nearestStep x y) : x≠y := by + intro he + obtain ⟨i,hi,_⟩ := h + simp [he] at hi + +lemma nearestStep_star {x y : Vertex} (h : nearestStep x y) : starStep x y := + ⟨nearestStep_ne h,nearestStep_starBound h⟩ + +lemma mem_fill_of_mem (C : Finset Vertex) {x : Vertex} (hx : x∈C) : x∈fill C := + fun h ↦ h.1 hx + +def detourRegion (Γ : Set Vertex) (Cs : Finset (Finset Vertex)) : Set Vertex := + {x | x∈Γ ∨ ∃ C∈Cs, x∈exteriorShell C} + +def goodDetourRegion (Γ B : Set Vertex) (Cs : Finset (Finset Vertex)) : Set Vertex := + detourRegion Γ Cs ∩ Bᶜ + +theorem good_detour_reach (Γ B : Set Vertex) (Cs : Finset (Finset Vertex)) + (hCs : ∀ C∈Cs, starConnected (↑C)) + (hbad : ∀ C∈Cs, (↑C : Set Vertex)⊆B) + (hmax : ∀ C∈Cs, ∀ c∈C, ∀ x∈B, starStep c x → x∈C) + (hcover : ∀ x∈Γ, x∈B → ∃ C∈Cs, x∈C) + {v w : Vertex} (hvΓ : v∈Γ) (_hwΓ : w∈Γ) + (hv : ∀ C∈Cs, v∈exterior C) (hw : ∀ C∈Cs, w∈exterior C) + (hwalk : withinReach nearestStep Γ v w) : + withinReach nearestStep (goodDetourRegion Γ B Cs) v w := by + let D := goodDetourRegion Γ B Cs + have hvGood : v∉B := by + intro hvB + obtain ⟨C,hC,hvC⟩ := hcover v hvΓ hvB + exact (hv C hC).1 hvC + have hvD : v∈D := ⟨Or.inl hvΓ,hvGood⟩ + let R : Set Vertex := {x | x∈D ∧ withinReach nearestStep D v x} + have hvR : v∈R := ⟨hvD,.refl⟩ + have hstep : ∀ x∈R, ∀ y∈D, nearestStep x y → y∈R := by + intro x hx y hy hxy + exact ⟨hy,hx.2.tail ⟨hx.1,hy,hxy⟩⟩ + have hRext : ∀ C∈Cs, ∀ x∈R, x∈exterior C := by + intro C hC x hx + apply exterior_of_reach C (hv C hC) + apply withinReach_mono (D := D) _ hx.2 + intro y hy hyC + exact hy.2 (hbad C hC hyC) + have hshellD : ∀ C∈Cs, exteriorShell C⊆D := by + intro C hC x hx + exact ⟨Or.inr ⟨C,hC,hx⟩,exteriorShell_good C B (hmax C hC) hx⟩ + let active : Finset Vertex → Prop := fun C ↦ ∃ z∈exteriorShell C, z∈R + have hactive : ∀ C∈Cs, active C → exteriorShell C⊆R := by + intro C hC hact x hx + obtain ⟨z,hz,hzR⟩ := hact + have hp := withinReach_mono (hshellD C hC) ((exteriorShell_NNConnected C (hCs C hC)) z hz x hx) + exact ⟨hshellD C hC hx,hzR.2.trans hp⟩ + let E : Set Vertex := {x | x∈R ∨ ∃ C∈Cs, active C ∧ x∈fill C} + have hE : ∀ x∈E, ∀ y∈Γ, nearestStep x y → y∈E := by + intro x hx y hy hxy + rcases hx with hx|⟨C,hC,hact,hxfill⟩ + · by_cases hyB : y∈B + · obtain ⟨C,hC,hyC⟩ := hcover y hy hyB + have hxshell : x∈exteriorShell C := + ⟨hRext C hC x hx,y,hyC,nearestStep_star (nearestStep_symm hxy)⟩ + exact Or.inr ⟨C,hC,⟨x,hxshell,hx⟩,mem_fill_of_mem C hyC⟩ + · exact Or.inl (hstep x hx y ⟨Or.inl hy,hyB⟩ hxy) + · by_cases hyfill : y∈fill C + · exact Or.inr ⟨C,hC,hact,hyfill⟩ + · have hyext : y∈exterior C := by simpa only [fill,Set.mem_compl_iff,not_not] using hyfill + have hxC : x∈C := by + by_contra hxC + exact hxfill (exterior_of_reach C hyext (.single ⟨hyext.1,hxC,nearestStep_symm hxy⟩)) + have hyshell : y∈exteriorShell C := ⟨hyext,x,hxC,nearestStep_star hxy⟩ + exact Or.inl (hactive C hC hact hyshell) + have hpE := withinReach_invariant (D := Γ) hE (show v∈E from Or.inl hvR) hwalk + have hwE := withinReach_end (show v∈E from Or.inl hvR) hpE + rcases hwE with hwR|⟨C,hC,_,hwfill⟩ + · exact hwR.2 + · exact (hwfill (hw C hC)).elim + +def detourVertices (Γ : Finset Vertex) (Cs : Finset (Finset Vertex)) : Finset Vertex := + Γ ∪ Cs.biUnion (fun C ↦ (exteriorShell_finite C).toFinset) + +lemma mem_detourVertices (Γ : Finset Vertex) (Cs : Finset (Finset Vertex)) (x : Vertex) : + x∈detourVertices Γ Cs ↔ x∈detourRegion (↑Γ) Cs := by + simp only [detourVertices,Finset.mem_union,Finset.mem_biUnion,Set.Finite.mem_toFinset, + detourRegion,Set.mem_ofPred_eq,Finset.mem_coe] + +lemma detourVertices_card_le (Γ : Finset Vertex) (Cs : Finset (Finset Vertex)) : + (detourVertices Γ Cs).card≤Γ.card+26*∑ C∈Cs, C.card := by + calc + _ ≤ Γ.card+(Cs.biUnion (fun C ↦ (exteriorShell_finite C).toFinset)).card := Finset.card_union_le _ _ + _ ≤ Γ.card+∑ C∈Cs, (exteriorShell_finite C).toFinset.card := Nat.add_le_add_left Finset.card_biUnion_le _ + _ ≤ Γ.card+∑ C∈Cs, 26*C.card := by + apply Nat.add_le_add_left + apply Finset.sum_le_sum + intro C _ + rw [← Set.ncard_eq_toFinset_card (exteriorShell C) (exteriorShell_finite C)] + exact exteriorShell_card_le C + _ = Γ.card+26*∑ C∈Cs, C.card := by rw [Finset.mul_sum] + +def nearestGraph : SimpleGraph Vertex where + Adj := nearestStep + symm := ⟨by intro x y h; exact nearestStep_symm h⟩ + loopless := ⟨by intro x h; exact nearestStep_ne h rfl⟩ + +def restrictedNearestGraph (D : Set Vertex) : SimpleGraph Vertex where + Adj x y := x∈D ∧ y∈D ∧ nearestStep x y + symm := ⟨by intro x y h; exact ⟨h.2.1,h.1,nearestStep_symm h.2.2⟩⟩ + loopless := ⟨by intro x h; exact nearestStep_ne h.2.2 rfl⟩ + +lemma withinReach_simple_path {D : Set Vertex} {v w : Vertex} (hv : v∈D) + (h : withinReach nearestStep D v w) : + ∃ p : nearestGraph.Walk v w, p.IsPath ∧ ∀ x∈p.support, x∈D := by + have hr : (restrictedNearestGraph D).Reachable v w := + (SimpleGraph.reachable_iff_reflTransGen v w).mpr h + obtain ⟨q⟩ := hr + let f : restrictedNearestGraph D →g nearestGraph := + ⟨id,fun {_ _} h ↦ h.2.2⟩ + have hs : ∀ {u z : Vertex} (p : (restrictedNearestGraph D).Walk u z), + u∈D → ∀ x∈p.support, x∈D := by + intro u z p + induction p with + | nil => + intro hu x hx + simp only [SimpleGraph.Walk.support_nil,List.mem_singleton] at hx + subst x + exact hu + | @cons u v z huv p ih => + intro hu x hx + simp only [SimpleGraph.Walk.support_cons,List.mem_cons] at hx + rcases hx with rfl|hx + · exact hu + · exact ih huv.2.1 x hx + refine ⟨q.toPath.val.map f,SimpleGraph.Walk.IsPath.map (fun _ _ h ↦ h) q.toPath.isPath,?_⟩ + intro x hx + rw [SimpleGraph.Walk.support_map] at hx + obtain ⟨y,hy,he⟩ := List.mem_map.mp hx + change y=x at he + subst x + exact hs q.toPath.val hv y hy + +theorem simple_good_detour (Γ B : Set Vertex) (Cs : Finset (Finset Vertex)) + (hCs : ∀ C∈Cs, starConnected (↑C)) + (hbad : ∀ C∈Cs, (↑C : Set Vertex)⊆B) + (hmax : ∀ C∈Cs, ∀ c∈C, ∀ x∈B, starStep c x → x∈C) + (hcover : ∀ x∈Γ, x∈B → ∃ C∈Cs, x∈C) + (hmeet : ∀ C∈Cs, ∃ x∈Γ, x∈C) + {v w : Vertex} (hvΓ : v∈Γ) (hwΓ : w∈Γ) + (hv : ∀ C∈Cs, v∈exterior C) (hw : ∀ C∈Cs, w∈exterior C) + (hwalk : withinReach nearestStep Γ v w) : + ∃ p : nearestGraph.Walk v w, p.IsPath ∧ + ∀ x∈p.support, x∉B ∧ (x∈Γ ∨ ∃ C∈Cs, (∃ z∈Γ, z∈C) ∧ x∈exteriorShell C) := by + have hvD : v∈goodDetourRegion Γ B Cs := by + refine ⟨Or.inl hvΓ,?_⟩ + intro hvB + obtain ⟨C,hC,hvC⟩ := hcover v hvΓ hvB + exact (hv C hC).1 hvC + obtain ⟨p,hp,hpD⟩ := withinReach_simple_path hvD + (good_detour_reach Γ B Cs hCs hbad hmax hcover hvΓ hwΓ hv hw hwalk) + refine ⟨p,hp,fun x hx ↦ ⟨(hpD x hx).2,?_⟩⟩ + rcases (hpD x hx).1 with hxΓ|⟨C,hC,hxC⟩ + · exact Or.inl hxΓ + · exact Or.inr ⟨C,hC,hmeet C hC,hxC⟩ + +end HardSphere.Lattice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/ScalarNormSqIntegral.lean b/lean/OAI/Analysis/HardSphere/Geometry/ScalarNormSqIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..4fe930e70a2a7f5e16ff357e0e20989e96126c59 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/ScalarNormSqIntegral.lean @@ -0,0 +1,64 @@ +import Mathlib +import OAI.Analysis.HardSphere.Cutoffs.Regularize + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped Topology ENNReal BigOperators +open scoped RealInnerProductSpace +namespace HardSphere + +lemma scalar_norm_sq_integral {N : ℕ} {L : Length} (u : ScalarL2 N L) : + ‖u‖^2 = ∫ X, ‖u X‖^2 := by + rw [← real_inner_self_eq_norm_sq (F := ScalarL2 N L), L2.inner_def] + simp only [real_inner_self_eq_norm_sq] + +lemma ae_norm_eq_of_L2_norm_eq {N : ℕ} {L : Length} (u v : ScalarL2 N L) + (hle : ∀ᵐ X ∂volume, ‖u X‖ ≤ ‖v X‖) (he : ‖u‖ = ‖v‖) : + ∀ᵐ X ∂volume, ‖u X‖ = ‖v X‖ := by + have hiu := (Lp.memLp u).integrable_norm_pow (by norm_num : (2 : ℕ) ≠ 0) + have hiv := (Lp.memLp v).integrable_norm_pow (by norm_num : (2 : ℕ) ≠ 0) + have hp : ∀ᵐ X ∂volume, 0 ≤ ‖v X‖^2 - ‖u X‖^2 := + hle.mono fun X hX ↦ sub_nonneg.mpr (pow_le_pow_left₀ (norm_nonneg _) hX 2) + have hz : (∫ X, ‖v X‖^2 - ‖u X‖^2) = 0 := by + rw [integral_sub hiv hiu, ← scalar_norm_sq_integral, ← scalar_norm_sq_integral, he, sub_self] + have hae := (integral_eq_zero_iff_of_nonneg_ae hp (hiv.sub hiu)).mp hz + filter_upwards [hae] with X hX + exact (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp ((sub_eq_zero.mp hX).symm) + +lemma norm_modulusPartial_le {N : ℕ} {L : Length} (u v : ScalarL2 N L) : + ‖modulusPartial u v‖ ≤ ‖v‖ := + L2Contraction.norm_fieldApply_le _ (modulusCoefficient_meas u) + (Eventually.of_forall fun X ↦ ComplexRegularization.differential_le 0 (u X)) v + +lemma IsGroundVector.norm_modulusPartial {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : IsGroundVector N L a u) (p : Direction N) : + ‖modulusPartial u.1 (u.2 p)‖ = ‖u.2 p‖ := by + have he := hu.energy_modulus + have hle : ∀ p ∈ (Finset.univ : Finset (Direction N)), + ‖modulusPartial u.1 (u.2 p)‖^2 ≤ ‖u.2 p‖^2 := + fun p _ ↦ pow_le_pow_left₀ (norm_nonneg _) (norm_modulusPartial_le _ _) 2 + have h := (Finset.sum_eq_sum_iff_of_le hle).mp he p (Finset.mem_univ _) + exact (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp h + +lemma IsGroundVector.ae_norm_modulusPartial {N : ℕ} {L : Length} {a : ℝ} {u : Jet N L} + (hu : IsGroundVector N L a u) (p : Direction N) : + ∀ᵐ X ∂volume, ‖ComplexRegularization.differential 0 (u.1 X) (u.2 p X)‖ = ‖u.2 p X‖ := by + have hle : ∀ᵐ X ∂volume, ‖modulusPartial u.1 (u.2 p) X‖ ≤ ‖u.2 p X‖ := by + filter_upwards [coe_modulusPartial u.1 (u.2 p)] with X hX + rw [hX] + exact ComplexRegularization.differential_apply_le _ _ _ + have he := ae_norm_eq_of_L2_norm_eq _ _ hle (hu.norm_modulusPartial p) + filter_upwards [he, coe_modulusPartial u.1 (u.2 p)] with X h1 h2 + rwa [h2] at h1 + +end HardSphere + +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/ScalarPartitionIms.lean b/lean/OAI/Analysis/HardSphere/Geometry/ScalarPartitionIms.lean new file mode 100644 index 0000000000000000000000000000000000000000..186818db350cc1f750a41128e59d98027928570b --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/ScalarPartitionIms.lean @@ -0,0 +1,229 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.HeadLift +import OAI.Analysis.HardSphere.Geometry.InnerClmRealRight +import OAI.Analysis.HardSphere.Geometry.LabelLift +import OAI.Analysis.HardSphere.Geometry.FinsetProd +import OAI.Analysis.HardSphere.Geometry.CoeScalar + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +noncomputable section +open scoped BigOperators ComplexConjugate +noncomputable section +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +noncomputable section +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology +noncomputable section +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate +noncomputable section + +lemma scalar_partition_ims {S : Type*} [Fintype S] (w d : S → ℂ) (u v : ℂ) + (hp : ∑ s, ‖w s‖^2=1) (hc : ∑ s, w s*conj (d s)=0) : + (∑ s, ‖w s*v+d s*u‖^2)=‖v‖^2+∑ s, ‖d s*u‖^2 := by + have hc' : (∑ s, (w s*v*conj (d s*u)).re)=0 := by + rw [← Complex.re_sum] + have hs : (∑ s, w s*v*conj (d s*u))=(v*conj u)*(∑ s, w s*conj (d s)) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro s _ + rw [map_mul] + ring + rw [hs,hc,mul_zero,Complex.zero_re] + simp_rw [← Complex.normSq_eq_norm_sq,Complex.normSq_add] + simp_rw [Complex.normSq_mul,Complex.normSq_eq_norm_sq] + rw [Finset.sum_add_distrib,Finset.sum_add_distrib,← Finset.sum_mul,hp,one_mul, + ← Finset.mul_sum,hc',mul_zero,add_zero] + +lemma real_norm_sq (z : ℂ) (hz : conj z=z) : ‖z‖^2=(z*z).re := by + have he := congrArg Complex.re (Complex.normSq_eq_conj_mul_self (z:=z)) + simpa only [hz,Complex.ofReal_re,Complex.normSq_eq_norm_sq] using he + +lemma SmoothMultiplier.partition_derivative {S : Type*} [Fintype S] {n : ℕ} {L : Length} + (w : S → SmoothMultiplier n L) (hp : ∀ X, ∑ s, (w s).toFun X*(w s).toFun X=1) + (p : Direction n) (X : Configuration n L) : + (∑ s, (w s).toFun X*coordDerivative n L (w s).toFun p X)=0 := by + let f := SmoothMultiplier.sum (fun s ↦ (w s).mul (w s)) + have hf : f.toFun=fun _ ↦ 1 := funext hp + have hd : coordDerivative n L f.toFun p X=0 := by + rw [hf] + simp [coordDerivative] + rw [SmoothMultiplier.partial_sum] at hd + have he (s : S) : coordDerivative n L ((w s).mul (w s)).toFun p X= + 2*((w s).toFun X*coordDerivative n L (w s).toFun p X) := by + change coordDerivative n L ((w s).toFun*(w s).toFun) p X=_ + rw [coordDerivative_mul ((w s).smooth.differentiable (by simp)) + ((w s).smooth.differentiable (by simp))] + change (w s).toFun X*_+_*_= _ + ring + simp_rw [he] at hd + rw [← Finset.mul_sum] at hd + exact (mul_eq_zero.mp hd).resolve_left (by norm_num) + +lemma SmoothMultiplier.partition_norm {S : Type*} [Fintype S] {n : ℕ} {L : Length} + (w : S → SmoothMultiplier n L) (hr : ∀ s X, conj ((w s).toFun X)=(w s).toFun X) + (hp : ∀ X, ∑ s, (w s).toFun X*(w s).toFun X=1) (X : Configuration n L) : + (∑ s, ‖(w s).toFun X‖^2)=1 := by + simp_rw [real_norm_sq _ (hr _ _)] + rw [← Complex.re_sum,hp,Complex.one_re] + +lemma SmoothMultiplier.partition_scalar_norm {S : Type*} [Fintype S] {n : ℕ} {L : Length} + (w : S → SmoothMultiplier n L) (hr : ∀ s X, conj ((w s).toFun X)=(w s).toFun X) + (hp : ∀ X, ∑ s, (w s).toFun X*(w s).toFun X=1) (u : ScalarL2 n L) : + (∑ s, ‖(w s).onScalar u‖^2)=‖u‖^2 := by + simp_rw [IndicatorStrong.norm_sq_integral] + rw [← integral_finsetSum Finset.univ (fun s _ ↦ + (Lp.memLp ((w s).onScalar u)).integrable_norm_pow (by norm_num))] + apply integral_congr_ae + have hc : ∀ᵐ X ∂volume, ∀ s, ((w s).onScalar u) X=(w s).toFun X*u X := + ae_all_iff.mpr (fun s ↦ (w s).coe_onScalar u) + filter_upwards [hc] with X hX + simp_rw [hX,norm_mul,mul_pow] + rw [← Finset.sum_mul,SmoothMultiplier.partition_norm w hr hp,one_mul] + +lemma SmoothMultiplier.partition_direction_ims {S : Type*} [Fintype S] {n : ℕ} {L : Length} + (w : S → SmoothMultiplier n L) (hr : ∀ s X, conj ((w s).toFun X)=(w s).toFun X) + (hp : ∀ X, ∑ s, (w s).toFun X*(w s).toFun X=1) (u : Jet n L) (p : Direction n) : + (∑ s, ‖((w s).onJet u).2 p‖^2)=‖u.2 p‖^2+∑ s, ‖(w s).derivativeScalar p u.1‖^2 := by + have hi (s : S) : Integrable (fun X ↦ ‖((w s).derivativeScalar p u.1) X‖^2) volume := + (Lp.memLp _).integrable_norm_pow (by norm_num) + simp_rw [IndicatorStrong.norm_sq_integral] + rw [← integral_finsetSum Finset.univ (fun s _ ↦ + (Lp.memLp (((w s).onJet u).2 p)).integrable_norm_pow (by norm_num)), + ← integral_finsetSum Finset.univ (fun s _ ↦ hi s), + ← integral_add ((Lp.memLp (u.2 p)).integrable_norm_pow (by norm_num)) (integrable_finsetSum _ (fun s _ ↦ hi s))] + apply integral_congr_ae + have hc (s : S) : ∀ᵐ X ∂volume, + (((w s).onJet u).2 p) X=(w s).toFun X*(u.2 p) X+coordDerivative n L (w s).toFun p X*u.1 X := by + filter_upwards [(w s).coe_onScalar (u.2 p),(w s).coe_derivativeScalar p u.1, + Lp.coeFn_add ((w s).onScalar (u.2 p)) ((w s).derivativeScalar p u.1)] with X h1 h2 h3 + change (((w s).onScalar (u.2 p)+(w s).derivativeScalar p u.1) : ScalarL2 n L) X=_ + rw [h3,Pi.add_apply,h1,h2] + have hd : ∀ᵐ X ∂volume, ∀ s, ((w s).derivativeScalar p u.1) X=coordDerivative n L (w s).toFun p X*u.1 X := + ae_all_iff.mpr (fun s ↦ (w s).coe_derivativeScalar p u.1) + filter_upwards [ae_all_iff.mpr hc,hd] with X hX hY + simp_rw [hX,hY] + apply scalar_partition_ims _ _ _ _ (SmoothMultiplier.partition_norm w hr hp X) + simp_rw [(w _).partial_real (hr _) p X] + exact SmoothMultiplier.partition_derivative w hp p X + +theorem SmoothMultiplier.partition_ims {S : Type*} [Fintype S] {n : ℕ} {L : Length} + (w : S → SmoothMultiplier n L) (hr : ∀ s X, conj ((w s).toFun X)=(w s).toFun X) + (hp : ∀ X, ∑ s, (w s).toFun X*(w s).toFun X=1) (u : Jet n L) : + (∑ s, energy ((w s).onJet u))=energy u+∑ p : Direction n, ∑ s, ‖(w s).derivativeScalar p u.1‖^2 := by + change (∑ s, ∑ p, ‖((w s).onJet u).2 p‖^2)=_ + rw [Finset.sum_comm] + simp_rw [SmoothMultiplier.partition_direction_ims w hr hp u] + rw [Finset.sum_add_distrib] + rfl + +end +end HardSphere + +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate +noncomputable section + +def productPartition (n : ℕ) (L : Length) (a c : SmoothMultiplier 1 L) (σ : Fin n → Bool) : + SmoothMultiplier n L := + SmoothMultiplier.finsetProd Finset.univ (fun i ↦ (cond (σ i) a c).liftLabel n i) + +lemma productPartition_apply (n : ℕ) (L : Length) (a c : SmoothMultiplier 1 L) + (σ : Fin n → Bool) (X : Configuration n L) : + (productPartition n L a c σ).toFun X=∏ i, (cond (σ i) a c).orbital (X i) := rfl + +lemma productPartition_real {n : ℕ} {L : Length} (a c : SmoothMultiplier 1 L) + (ha : ∀ X, conj (a.toFun X)=a.toFun X) (hc : ∀ X, conj (c.toFun X)=c.toFun X) + (σ : Fin n → Bool) (X : Configuration n L) : + conj ((productPartition n L a c σ).toFun X)=(productPartition n L a c σ).toFun X := by + simp only [productPartition_apply,map_prod] + apply Finset.prod_congr rfl + intro i _ + cases σ i <;> simp only [Bool.cond_false,Bool.cond_true,SmoothMultiplier.orbital,ha,hc] + +lemma productPartition_unity {n : ℕ} {L : Length} (a c : SmoothMultiplier 1 L) + (hp : ∀ x : Torus L, a.orbital x*a.orbital x+c.orbital x*c.orbital x=1) + (X : Configuration n L) : + (∑ σ : Fin n → Bool, (productPartition n L a c σ).toFun X*(productPartition n L a c σ).toFun X)=1 := by + simp_rw [productPartition_apply,← Finset.prod_mul_distrib] + rw [← Fintype.prod_sum (fun (i : Fin n) (b : Bool) ↦ + (cond b a c).orbital (X i)*(cond b a c).orbital (X i))] + simp only [Fintype.sum_bool,Bool.cond_true,Bool.cond_false,hp,Finset.prod_const_one] + +lemma productPartition_partial {n : ℕ} {L : Length} (a c : SmoothMultiplier 1 L) + (σ : Fin n → Bool) (p : Direction n) (X : Configuration n L) : + coordDerivative n L (productPartition n L a c σ).toFun p X= + (∏ i∈Finset.univ.erase p.1, (cond (σ i) a c).orbital (X i))* + coordDerivative 1 L (cond (σ p.1) a c).toFun (0,p.2) (fun _ ↦ X p.1) := by + classical + rw [productPartition,SmoothMultiplier.partial_finsetProd] + simp_rw [SmoothMultiplier.partial_liftLabel] + rw [Finset.sum_eq_single p.1] + · rw [ite_eq_left rfl] + rfl + · intro i _ hi + rw [ite_eq_right (Ne.symm hi),mul_zero] + · simp + +lemma binary_product_sum {I : Type*} [Fintype I] [DecidableEq I] + (f : I → Bool → ℝ) (d : Bool → ℝ) (j : I) + (hf : ∀ i, f i true+f i false=1) : + (∑ σ : I → Bool, (∏ i∈Finset.univ.erase j, f i (σ i))*d (σ j))=d true+d false := by + let g (i : I) (b : Bool) := if i=j then d b else f i b + have he (σ : I → Bool) : (∏ i∈Finset.univ.erase j, f i (σ i))*d (σ j)=∏ i, g i (σ i) := by + rw [← Finset.prod_erase_mul Finset.univ (fun i ↦ g i (σ i)) (Finset.mem_univ j)] + dsimp only [g] + rw [ite_eq_left rfl] + congr 1 + apply Finset.prod_congr rfl + intro i hi + rw [ite_eq_right (Finset.mem_erase.mp hi).1] + simp_rw [he] + rw [← Fintype.prod_sum,Finset.prod_eq_single j] + · simp [g] + · intro i _ hi + simpa only [g,ite_eq_right hi,Fintype.sum_bool] using hf i + · simp + +lemma productPartition_gradient_partition {n : ℕ} {L : Length} (a c : SmoothMultiplier 1 L) + (ha : ∀ X, conj (a.toFun X)=a.toFun X) (hc : ∀ X, conj (c.toFun X)=c.toFun X) + (hp : ∀ x : Torus L, a.orbital x*a.orbital x+c.orbital x*c.orbital x=1) + (p : Direction n) (X : Configuration n L) : + (∑ σ : Fin n → Bool, ‖coordDerivative n L (productPartition n L a c σ).toFun p X‖^2)= + ‖coordDerivative 1 L a.toFun (0,p.2) (fun _ ↦ X p.1)‖^2+ + ‖coordDerivative 1 L c.toFun (0,p.2) (fun _ ↦ X p.1)‖^2 := by + have hnorm (i : Fin n) : ‖a.orbital (X i)‖^2+‖c.orbital (X i)‖^2=1 := by + rw [real_norm_sq (a.orbital (X i)) (ha (fun _ ↦ X i)), + real_norm_sq (c.orbital (X i)) (hc (fun _ ↦ X i)),← Complex.add_re,hp,Complex.one_re] + simp_rw [productPartition_partial,norm_mul,mul_pow,norm_prod,← Finset.prod_pow] + exact binary_product_sum (fun i b ↦ ‖(cond b a c).orbital (X i)‖^2) + (fun b ↦ ‖coordDerivative 1 L (cond b a c).toFun (0,p.2) (fun _ ↦ X p.1)‖^2) p.1 hnorm + +end +end HardSphere + +end +end +end +end +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/SelectedEnergyAddCompl.lean b/lean/OAI/Analysis/HardSphere/Geometry/SelectedEnergyAddCompl.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f7c46f2fa6dc34426aeb040fb4c62c9d57555b4 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/SelectedEnergyAddCompl.lean @@ -0,0 +1,170 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.PartitionErrorIntegral + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate + +lemma selectedEnergy_add_compl {n : ℕ} {L : Length} (p : Fin n → Prop) [DecidablePred p] (u : Jet n L) : + selectedEnergy p u+selectedEnergy (fun i ↦ ¬p i) u=energy u := by + rw [selectedEnergy,selectedEnergy,energy,Fintype.sum_prod_type] + exact Fintype.sum_subtype_add_sum_subtype p (fun i ↦ ∑ j : Fin 3, ‖u.2 (i,j)‖^2) + +lemma complement_removed_card {n : ℕ} (σ : Fin n → Bool) : + ((n-Fintype.card {i : Fin n // ¬σ i=true} : ℕ):ℝ)=∑ i : Fin n, if σ i then (1:ℝ) else 0 := by + have hc : Fintype.card {i : Fin n // σ i=true}≤n := by + simpa only [Fintype.card_fin] using Fintype.card_le_of_injective + (fun i : {i : Fin n // σ i=true} ↦ i.val) Subtype.val_injective + rw [Fintype.card_subtype_compl,Fintype.card_fin,Nat.sub_sub_self hc,Fintype.card_subtype] + symm + simpa only [Finset.mem_univ,ite_true] using + (Finset.sum_boole (R:=ℝ) (fun i : Fin n ↦ σ i=true) (Finset.univ : Finset (Fin n))) + +theorem productPartition_spectral_localization : ∃ C : ℝ, 0.preimage measurable_snd)] + simp only [Kernel.const_apply,mem_preimage] + +omit [Fintype I] in +lemma ambientShared_constant_of (s : Finset I) (σ : Equiv.Perm I) (hσ : ∀i,i∉s→σ i=i) + (ξ : Kernel E (∀i,X i)) [IsFiniteKernel ξ] + (ρ : ∀i:s,Kernel E (X i×X (σ.symm i))) [∀i,IsFiniteKernel (ρ i)] + (A : Set (E×(∀i,X i))) (hA : MeasurableSet A) (e : E) + (μ : Measure (∀i,X i)) [IsFiniteMeasure μ] + (ν : ∀i:s,Measure (X i×X (σ.symm i))) [∀i,IsFiniteMeasure (ν i)] + (B : Set (∀i,X i)) (hμ : ξ e=μ) (hν : ∀i,ρ i e=ν i) + (hB : Prod.mk e ⁻¹' A=B) : + ambientSharedKernel s σ hσ ξ ρ A e= + ambientSharedKernel s σ hσ (Kernel.const Unit μ) + (fun i ↦ Kernel.const Unit (ν i)) (Prod.snd ⁻¹' B) () := by + simpa only [hμ,hν,hB] using ambientShared_constant s σ hσ ξ ρ A hA e + +end HardSphere.Comparison +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/SharedIdentities.lean b/lean/OAI/Analysis/HardSphere/Geometry/SharedIdentities.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8f3b8bdbe98477d72d87b59b0a46d7a9087386f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/SharedIdentities.lean @@ -0,0 +1,158 @@ +import Mathlib +import OAI.Analysis.HardSphere.Allocation.CoarsePhysical +import OAI.Analysis.HardSphere.Conditioning.SharedTransport + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +open HardSphere.Bridge HardSphere.Wiener HardSphere.GaussianPacking +attribute [local instance] Classical.propDecidable +variable {E I : Type*} [MeasurableSpace E] [Fintype I] [DecidableEq I] + {X Y : I→Type*} [∀i,MeasurableSpace (X i)] [∀i,MeasurableSpace (Y i)] + +omit [Fintype I] in +lemma ambientShared_map (f : ∀i,X i→Y i) (hf : ∀i,Measurable (f i)) + (s : Finset I) (σ : Equiv.Perm I) (hσ : ∀i,i∉s→σ i=i) + (ξ : Kernel E (∀i,X i)) [IsFiniteKernel ξ] + (ρ : ∀i:s,Kernel E (X i×X (σ.symm i))) [∀i,IsFiniteKernel (ρ i)] + (A : Set (E×(∀i,Y i))) (hA : MeasurableSet A) (e : E) : + (ambientSharedKernel s σ hσ ξ ρ + ((fun p : E×(∀i,X i) ↦ (p.1,routeConfigMap f p.2)) ⁻¹' A) e).map + (routePairedMap f s σ)= + ambientSharedKernel s σ hσ (ξ.map (routeConfigMap f)) + (fun i ↦ (ρ i).map (Prod.map (f i) (f (σ.symm i)))) A e := by + rw [ambientSharedKernel_apply_measure,ambientSharedKernel_apply_measure, + Kernel.map_apply _ (routeConfigMap_measurable f hf)] + apply coarse_joint_reference (ξ e) _ _ _ (routeConfigMap_measurable f hf) + (fun p ↦ routeFactorMap f s σ p.2) ((routeFactorMap_measurable f hf s σ).comp measurable_snd) + exact ae_of_all _ (fun x ↦ ambientRefresh_map f hf s σ hσ ρ A hA e x) + +variable {J : Type*} [Fintype J] [DecidableEq J] {L : HardSphere.Length} + +omit [Fintype I] [∀i,MeasurableSpace (X i)] in +lemma ambientFirst_updated (s : Finset I) (σ : Equiv.Perm I) + (x : ∀i,X i) (z : ∀i,X (σ.symm i)) (p : ∀i:s,X i×X (σ.symm i)) : + (fun i ↦ (Function.updateFinset (fun i ↦ (x i,z i)) s p i).1)= + ambientFirst s σ (x,p) := by + funext i + by_cases hi : i∈s + · simp only [ambientFirst,Function.updateFinset,dite_eq_left hi] + · simp only [ambientFirst,Function.updateFinset,dite_eq_right hi] + +omit [Fintype I] in +lemma ambientSecond_updated (s : Finset I) (σ : Equiv.Perm I) (hσ : ∀i,i∉s→σ i=i) + (x : ∀i,X i) (z : ∀i,X (σ.symm i)) (p : ∀i:s,X i×X (σ.symm i)) : + (fun i ↦ (partialReversePairs σ s hσ (Function.updateFinset (fun i ↦ (x i,z i)) s p) i).1)= + ambientSecond s σ hσ (x,p) := by + rw [partialReverse_update] + funext i + by_cases hi : i∈s + · simp only [ambientSecond,Function.updateFinset,dite_eq_left hi] + · simp only [ambientSecond,Function.updateFinset,dite_eq_right hi, + partialReversePairs_outside_fst σ s hσ _ i hi] + +omit [Fintype J] [DecidableEq J] in +lemma routeChecks_both (σ : Equiv.Perm I) (s : Finset I) (hσ : ∀i,i∉s→σ i=i) + (r : ℝ) (anchor : J→HardSphere.Torus L) (allowed : J→Set C(Time,Point)) + (label : J→I) (get : ∀j,X (label j)→allowed j) (hg : ∀j,Measurable (get j)) + (p : ∀i,X i×X (σ.symm i)) : + p∈retainedEvent (routeChecks σ s hσ r anchor allowed label get hg) Finset.univ ↔ + (fun i ↦ (p i).1)∈retainedEvent (primaryChecks r anchor allowed label get hg) Finset.univ ∧ + (fun i ↦ (partialReversePairs σ s hσ p i).1)∈ + retainedEvent (primaryChecks r anchor allowed label get hg) Finset.univ := by + constructor + · intro hp + refine ⟨routeChecks_primary σ s hσ r anchor allowed label get hg _ p hp,?_⟩ + intro e _ + rcases e with ⟨b,e⟩ + change ¬TrialCollision r + (projectCurve L (get e.val.2 (partialReversePairs σ s hσ p (label e.val.2)).1).val) + (get e.val.1 (partialReversePairs σ s hσ p (label e.val.1)).1).val + rw [partialReverse_primary_path σ s hσ allowed label get p e.val.2, + partialReverse_primary_path σ s hσ allowed label get p e.val.1] + exact hp (true,e) (Finset.subset_univ _) + · rintro ⟨hp,hq⟩ ⟨b,e⟩ _ + cases b + · exact hp (false,e) (Finset.subset_univ _) + · have h := hq (false,e) (Finset.subset_univ _) + change ¬TrialCollision r + (projectCurve L (get e.val.2 (partialReversePairs σ s hσ p (label e.val.2)).1).val) + (get e.val.1 (partialReversePairs σ s hσ p (label e.val.1)).1).val at h + rw [partialReverse_primary_path σ s hσ allowed label get p e.val.2, + partialReverse_primary_path σ s hσ allowed label get p e.val.1] at h + exact h + +omit [Fintype J] [DecidableEq J] in +lemma ambient_proposalEvent (σ : Equiv.Perm I) (s : Finset I) (hσ : ∀i,i∉s→σ i=i) + (r : ℝ) (anchor : J→HardSphere.Torus L) (allowed : J→Set C(Time,Point)) + (label : J→I) (get : ∀j,X (label j)→allowed j) (hg : ∀j,Measurable (get j)) + (z : ∀i,X (σ.symm i)) : + {p : (∀i,X i)×(∀i:s,X i×X (σ.symm i)) | + ambientFirst s σ p∈retainedEvent (primaryChecks r anchor allowed label get hg) Finset.univ ∧ + ambientSecond s σ hσ p∈retainedEvent (primaryChecks r anchor allowed label get hg) Finset.univ} = + proposalEvent (routeChecks σ s hσ r anchor allowed label get hg) s (Finset.univ\s) z := by + ext p + simp only [proposalEvent,mem_ofPred_eq,Finset.union_sdiff_of_subset (Finset.subset_univ s)] + rw [routeChecks_both,ambientFirst_updated,ambientSecond_updated] + +lemma ambientRefresh_constant (σ : Equiv.Perm I) (s : Finset I) (hσ : ∀i,i∉s→σ i=i) + (r : ℝ) (anchor : J→HardSphere.Torus L) (allowed : J→Set C(Time,Point)) + (label : J→I) (get : ∀j,X (label j)→allowed j) (hg : ∀j,Measurable (get j)) + (μ : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (μ i)] + (κ : ∀i,Kernel (X i) (X (σ.symm i))) [∀i,IsFiniteKernel (κ i)] + (z : ∀i,X (σ.symm i)) (e : E) (x : ∀i,X i) : + ambientRefreshKernel s σ hσ (fun i ↦ Kernel.const E ((μ i).compProd (κ i))) + (Prod.snd ⁻¹' retainedEvent (primaryChecks r anchor allowed label get hg) Finset.univ) (e,x)= + proposalKernel (routeChecks σ s hσ r anchor allowed label get hg) μ κ s (Finset.univ\s) z x := by + rw [ambientRefreshKernel_apply _ _ _ _ _ + ((measurableSet_retainedEvent _ _).preimage measurable_snd),proposalKernel_apply] + simp only [Kernel.const_apply] + have he := congrArg (fun A ↦ Prod.mk x ⁻¹' A) + (ambient_proposalEvent σ s hσ r anchor allowed label get hg z) + change conditionedMeasure _ _=conditionedMeasure _ _ + congr 1 + +lemma ambient_two_primary_laws (σ : Equiv.Perm I) (s : Finset I) (hσ : ∀i,i∉s→σ i=i) + (r : ℝ) (anchor : J→HardSphere.Torus L) (allowed : J→Set C(Time,Point)) + (label : J→I) (get : ∀j,X (label j)→allowed j) (hg : ∀j,Measurable (get j)) + (star : I) (hstar : ∀j,label j≠star) (hs : star∈s) + (μ ν : ∀i,Measure (X i)) [∀i,IsProbabilityMeasure (μ i)] [∀i,IsProbabilityMeasure (ν i)] + (heq : ∀i,i≠star→μ i=ν i) + (κ : ∀i,Kernel (X i) (X (σ.symm i))) [∀i,IsFiniteKernel (κ i)] + (η : ∀i,Kernel (X i) (X (σ i))) [∀i,IsFiniteKernel (η i)] + (he : ∀j:s,((μ (σ j)).compProd (κ (σ j))).map (reverseFactor (X:=X) σ j)= + (ν j).compProd (η j)) + (z : ∀i,X (σ.symm i)) (w : ∀i,X (σ i)) (e : E) : + let R := primaryChecks r anchor allowed label get hg + let C := routeChecks σ s hσ r anchor allowed label get hg + let C' := routeChecks σ.symm s (reverse_fix σ s hσ) r anchor allowed label get hg + let P := conditionedMeasure (Measure.pi μ) (retainedEvent R Finset.univ) + let Q := conditionedMeasure (Measure.pi ν) (retainedEvent R Finset.univ) + let T := ambientSharedKernel s σ hσ (Kernel.const E P) + (fun i ↦ Kernel.const E ((μ i).compProd (κ i))) (Prod.snd ⁻¹' retainedEvent R Finset.univ) e + T.map (ambientFirst s σ)= + P.withDensity (fun x ↦ conditionalLikelihood R C μ κ s (Finset.univ\s) x z) ∧ + T.map (ambientSecond s σ hσ)= + Q.withDensity (fun x ↦ conditionalLikelihood R C' ν η s (Finset.univ\s) x w) := by + dsimp only + rw [ambientSharedKernel_apply_measure,Kernel.const_apply] + have hk : (ambientRefreshKernel s σ hσ + (fun i : s ↦ Kernel.const E ((μ i).compProd (κ i))) + (Prod.snd ⁻¹' retainedEvent (primaryChecks r anchor allowed label get hg) Finset.univ)).comap + (Prod.mk e) measurable_prodMk_left= + proposalKernel (routeChecks σ s hσ r anchor allowed label get hg) μ κ s (Finset.univ\s) z := by + ext x A hA + exact congrArg (fun m ↦ m A) (ambientRefresh_constant σ s hσ r anchor allowed label get hg μ κ z e x) + rw [hk] + exact actual_two_primary_laws σ s hσ r anchor allowed label get hg star hstar hs μ ν heq κ η he z w + +end HardSphere.Comparison +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/ShiftClose.lean b/lean/OAI/Analysis/HardSphere/Geometry/ShiftClose.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c1f7e6ca3f8f7bfe37cadf93e59fb45dbcd85fc --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/ShiftClose.lean @@ -0,0 +1,75 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.LocalCloseLabelsMeasurable +import OAI.Analysis.HardSphere.Allocation.FinsetSeparatedNet +import OAI.Analysis.HardSphere.PathBounds.InteractingVisits + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory Set Filter +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere +theorem spatial_translated_grid_close_probability : ∃ Q : ℕ, 0 simp_all + exact hh.trans (by simpa using (mul_le_mul_left ha + (((PMF.uniformOfFintype (TreeNoise m)).map (incrementHistory m u)) H))) + +@[simp] theorem walk_zero (m : ℕ) (w : TreeNoise m) : walk m w 0 = 0 := by simp [walk] + +theorem walk_increment (m : ℕ) (w : TreeNoise m) (j : ℕ) (hj : j < 3^m) : + |walk m w (j+1) - walk m w j| = 1 := by + have hl : j < (leaves m 1 w).length := by simpa using hj + rw [walk, walk, List.take_succ_eq_append_getElem hl, List.sum_append] + simp only [List.sum_cons, List.sum_nil, add_zero, add_sub_cancel_left] + exact abs_of_mem_leaves (by norm_num) w (List.getElem_mem hl) + +lemma map_pair_fiber {A B C : Type*} [DecidableEq B] [DecidableEq C] + (p : PMF (A × C)) (g : A → B) (H : B) (x : C) : + (p.map (fun z ↦ (g z.1,z.2))) (H,x) = + ∑' a, if H = g a then p (a,x) else 0 := by + classical + rw [PMF.map_apply, ENNReal.tsum_prod'] + congr 1 + funext a + by_cases h : H = g a + · simp [Prod.mk.injEq, h] + · simp [Prod.mk.injEq, h] + +lemma conditional_push_history {A B C : Type*} (p : PMF (A × C)) (g : A → B) + (a : ℝ≥0∞) (ha : ∀ h x, p (h,x) ≤ a * (p.map Prod.fst) h) (H : B) (x : C) : + (p.map (fun z ↦ (g z.1,z.2))) (H,x) ≤ a * (p.map (g ∘ Prod.fst)) H := by + classical + rw [map_pair_fiber, ← PMF.map_comp, PMF.map_apply, ← ENNReal.tsum_mul_left] + apply ENNReal.tsum_le_tsum + intro h + split_ifs with hh + · exact ha h x + · simp + +def positionHistory (m u : ℕ) (w : TreeNoise m) : Fin (u+1) → ℤ := fun j ↦ walk m w j.val + +def positionsFromIncrements (u : ℕ) (l : List ℤ) : Fin (u+1) → ℤ := + fun j ↦ (l.take j.val).sum + +lemma positionHistory_eq (m u : ℕ) (w : TreeNoise m) : + positionHistory m u w = positionsFromIncrements u (incrementHistory m u w) := by + funext j + have hj : j.val ≤ u := by omega + simp [positionHistory, positionsFromIncrements, incrementHistory, walk, List.take_take, + min_eq_left hj] + +theorem position_prediction (m u k : ℕ) (hk : 0 < k) (ht : u+k ≤ 3^m) + (H : Fin (u+1) → ℤ) (x : ℤ) : + ((PMF.uniformOfFintype (TreeNoise m)).map + (fun w ↦ (positionHistory m u w, walk m w (u+k)))) (H,x) ≤ + ENNReal.ofReal ((6:ℝ)^sigma * (k:ℝ)^(-sigma)) * + ((PMF.uniformOfFintype (TreeNoise m)).map (positionHistory m u)) H := by + let p := (PMF.uniformOfFintype (TreeNoise m)).map + (fun w ↦ (incrementHistory m u w, walk m w (u+k))) + have hp : ∀ h x, p (h,x) ≤ ENNReal.ofReal ((6:ℝ)^sigma * (k:ℝ)^(-sigma)) * + (p.map Prod.fst) h := by + intro h x + simpa [p, PMF.map_comp, Function.comp_def] using prediction m u k hk ht h x + have hh := conditional_push_history p (positionsFromIncrements u) _ hp H x + simpa only [p, PMF.map_comp, Function.comp_def, ← positionHistory_eq] using hh + +theorem finite_prediction_walk (T : ℕ) : ∃ m : ℕ, T ≤ 3^m ∧ + (∀ w : TreeNoise m, walk m w 0 = 0) ∧ + (∀ (w : TreeNoise m) j, j < T → |walk m w (j+1) - walk m w j| = 1) ∧ + ∀ u k, 0 < k → u+k ≤ T → ∀ (H : Fin (u+1) → ℤ) (x : ℤ), + ((PMF.uniformOfFintype (TreeNoise m)).map + (fun w ↦ (positionHistory m u w, walk m w (u+k)))) (H,x) ≤ + ENNReal.ofReal ((6:ℝ)^sigma * (k:ℝ)^(-sigma)) * + ((PMF.uniformOfFintype (TreeNoise m)).map (positionHistory m u)) H := by + have ht : T ≤ 3^T := (Nat.lt_pow_self (by omega : 1 < 3)).le + exact ⟨T, ht, walk_zero T, fun w j hj ↦ walk_increment T w j (hj.trans_le ht), + fun u k hk hu H x ↦ position_prediction T u k hk (hu.trans ht) H x⟩ + +def independentPair {A B : Type*} (p : PMF A) (q : PMF B) : PMF (A × B) := + p.bind fun a ↦ q.map fun b ↦ (a,b) + +lemma independentPair_apply {A B : Type*} (p : PMF A) (q : PMF B) (a : A) (b : B) : + independentPair p q (a,b) = p a * q b := by + classical + simp only [independentPair, PMF.bind_apply, PMF.map_apply, Prod.mk.injEq] + calc + _ = ∑' a', if a = a' then p a' * q b else 0 := by + apply tsum_congr + intro a' + by_cases h : a = a' + · simp [h] + · simp [h] + _ = _ := by simp + +lemma independentPair_map {A B C D : Type*} (p : PMF A) (q : PMF B) + (f : A → C) (g : B → D) : + (independentPair p q).map (fun z ↦ (f z.1,g z.2)) = + independentPair (p.map f) (q.map g) := by + simp only [independentPair, PMF.map_bind, PMF.map_comp, PMF.bind_map, + Function.comp_def] + +lemma pmf_fst {A B : Type*} (p : PMF (A × B)) (a : A) : + (p.map Prod.fst) a = ∑' b, p (a,b) := by + classical + rw [PMF.map_apply, ENNReal.tsum_prod', ENNReal.tsum_comm] + simp + +lemma enn_tsum_ite_const {A : Type*} (P : Prop) [Decidable P] (f : A → ℝ≥0∞) : + (∑' a, if P then f a else 0) = if P then ∑' a, f a else 0 := by + by_cases h : P <;> simp [h] + +lemma independent_difference_fiber {H J : Type*} (p : PMF (H × ℤ)) (q : PMF (J × ℤ)) + (h : H) (j : J) (z : ℤ) : + ((independentPair p q).map (fun v ↦ ((v.1.1,v.2.1),v.1.2-v.2.2))) ((h,j),z) = + ∑' y : ℤ, p (h,z+y) * q (j,y) := by + classical + rw [PMF.map_apply] + simp only [ENNReal.tsum_prod', independentPair_apply, Prod.mk.injEq] + simp_rw [show ∀ x y : ℤ, z = x-y ↔ x = z+y by omega] + simp only [ite_and] + simp_rw [enn_tsum_ite_const] + simp only [tsum_ite_eq'] + rw [ENNReal.tsum_comm] + simp + +lemma independent_difference_bound {H J : Type*} (p : PMF (H × ℤ)) (q : PMF (J × ℤ)) + (b : ℝ≥0∞) (hp : ∀ h x, p (h,x) ≤ b * (p.map Prod.fst) h) + (h : H) (j : J) (z : ℤ) : + ((independentPair p q).map (fun v ↦ ((v.1.1,v.2.1),v.1.2-v.2.2))) ((h,j),z) ≤ + b * ((p.map Prod.fst) h * (q.map Prod.fst) j) := by + rw [independent_difference_fiber, pmf_fst q, ← mul_assoc, + ← ENNReal.tsum_mul_left] + exact ENNReal.tsum_le_tsum fun y ↦ mul_le_mul' (hp h (z+y)) le_rfl + +def independentJoint {H J A B : Type*} (p : PMF (H × A)) (q : PMF (J × B)) : + PMF ((H × J) × (A × B)) := + (independentPair p q).map fun v ↦ ((v.1.1,v.2.1),(v.1.2,v.2.2)) + +lemma independentJoint_apply {H J A B : Type*} (p : PMF (H × A)) (q : PMF (J × B)) + (h : H) (j : J) (x : A) (y : B) : + independentJoint p q ((h,j),(x,y)) = p (h,x) * q (j,y) := by + classical + simp only [independentJoint, PMF.map_apply, ENNReal.tsum_prod', + independentPair_apply, Prod.mk.injEq, ite_and] + simp_rw [enn_tsum_ite_const] + simp + +lemma independentJoint_fst {H J A B : Type*} (p : PMF (H × A)) (q : PMF (J × B)) : + (independentJoint p q).map Prod.fst = + independentPair (p.map Prod.fst) (q.map Prod.fst) := by + rw [independentJoint, PMF.map_comp] + exact independentPair_map p q Prod.fst Prod.fst + +lemma independentJoint_bound {H J A B : Type*} (p : PMF (H × A)) (q : PMF (J × B)) + (b c : ℝ≥0∞) (hp : ∀ h x, p (h,x) ≤ b * (p.map Prod.fst) h) + (hq : ∀ j y, q (j,y) ≤ c * (q.map Prod.fst) j) (h : H) (j : J) (x : A) (y : B) : + independentJoint p q ((h,j),(x,y)) ≤ + (b*c) * ((independentJoint p q).map Prod.fst) (h,j) := by + rw [independentJoint_apply, independentJoint_fst, independentPair_apply] + exact (mul_le_mul' (hp h x) (hq j y)).trans_eq (by ring) + +lemma joint_region_mass {H X : Type*} (p : PMF (H × X)) (E : Set H) (F : Finset X) : + p.toOuterMeasure {v | v.1 ∈ E ∧ v.2 ∈ F} = + ∑' h, if h ∈ E then ∑ x ∈ F, p (h,x) else 0 := by + classical + rw [PMF.toOuterMeasure_apply, ENNReal.tsum_prod'] + apply tsum_congr + intro h + by_cases he : h ∈ E + · simp only [Set.indicator, Set.mem_ofPred_eq, he, true_and] + rw [tsum_eq_sum (s := F) (fun x hx ↦ ite_eq_right hx)] + exact Finset.sum_congr rfl (fun x hx ↦ ite_eq_left hx) + · simp [Set.indicator, he] + +lemma joint_region_bound {H X : Type*} (p : PMF (H × X)) (b : ℝ≥0∞) + (hp : ∀ h x, p (h,x) ≤ b * (p.map Prod.fst) h) (E : Set H) (F : Finset X) : + p.toOuterMeasure {v | v.1 ∈ E ∧ v.2 ∈ F} ≤ + (F.card : ℝ≥0∞) * b * (p.map Prod.fst).toOuterMeasure E := by + classical + rw [joint_region_mass, PMF.toOuterMeasure_apply, ← ENNReal.tsum_mul_left] + apply ENNReal.tsum_le_tsum + intro h + by_cases he : h ∈ E + · simp only [he, ite_true, Set.indicator_of_mem] + calc + ∑ x ∈ F, p (h,x) ≤ ∑ _x ∈ F, b * (p.map Prod.fst) h := + Finset.sum_le_sum fun x _ ↦ hp h x + _ = _ := by simp [nsmul_eq_mul, mul_assoc] + · simp [Set.indicator, he] + +def timeGaps : {n : ℕ} → (Fin n → ℕ) → Fin n → ℕ + | 0, _ => Fin.elim0 + | _+1, t => Fin.cases (t 0) (fun i ↦ t i.succ - t i.castSucc) + +@[simp] lemma timeGaps_zero {n : ℕ} (t : Fin (n+1) → ℕ) : timeGaps t 0 = t 0 := rfl +@[simp] lemma timeGaps_succ {n : ℕ} (t : Fin (n+1) → ℕ) (i : Fin n) : + timeGaps t i.succ = t i.succ - t i.castSucc := rfl + +lemma timeGaps_castSucc {n : ℕ} (t : Fin (n+1) → ℕ) (i : Fin n) : + timeGaps t i.castSucc = timeGaps (Fin.init t) i := by + cases n with + | zero => exact Fin.elim0 i + | succ n => exact Fin.cases rfl (fun _ ↦ rfl) i + +lemma timeGaps_injective {n : ℕ} : + Function.Injective (fun t : {t : Fin n → ℕ // Monotone t} ↦ timeGaps t.val) := by + intro t s h + apply Subtype.ext + funext i + cases n with + | zero => exact Fin.elim0 i + | succ n => + refine Fin.induction ?_ (fun j ih ↦ ?_) i + · exact congrFun h 0 + · have he := congrFun h j.succ + simp only [timeGaps_succ] at he + have ht := t.property (Fin.castSucc_le_succ j) + have hs := s.property (Fin.castSucc_le_succ j) + omega + +def splitVectorEquiv (n : ℕ) (A : Type*) : (Fin (n+1) → A) ≃ A × (Fin n → A) where + toFun f := (f 0, fun i ↦ f i.succ) + invFun v := Fin.cases v.1 v.2 + left_inv f := by funext i; exact Fin.cases rfl (fun _ ↦ rfl) i + right_inv v := rfl + +lemma tsum_vector_prod {n : ℕ} (f : Fin n → ℕ → ℝ≥0∞) : + (∑' g : Fin n → ℕ, ∏ i, f i (g i)) = ∏ i, ∑' k, f i k := by + induction n with + | zero => simp + | succ n ih => + rw [← (splitVectorEquiv n ℕ).symm.tsum_eq] + change (∑' v : ℕ × (Fin n → ℕ), ∏ i, f i (Fin.cases v.1 v.2 i)) = _ + rw [ENNReal.tsum_prod'] + simp only [Fin.prod_univ_succ, Fin.cases_zero, Fin.cases_succ] + simp_rw [ENNReal.tsum_mul_left, ih] + rw [ENNReal.tsum_mul_right] + +lemma ordered_gap_sum_bound (T n : ℕ) (b : ℕ → ℝ≥0∞) : + (∑' t : {t : Fin n → ℕ // StrictMono t ∧ ∀ i, t i ≤ T}, ∏ i, b (timeGaps t.val i)) ≤ + (∑' k, b k)^n := by + let g : {t : Fin n → ℕ // StrictMono t ∧ ∀ i, t i ≤ T} → (Fin n → ℕ) := + fun t ↦ timeGaps t.val + have hg : Function.Injective g := by + intro t s he + have hv := timeGaps_injective (a₁ := ⟨t.val,t.property.1.monotone⟩) + (a₂ := ⟨s.val,s.property.1.monotone⟩) he + exact Subtype.ext (congrArg (fun q : {f : Fin n → ℕ // Monotone f} ↦ q.val) hv) + have h := ENNReal.tsum_comp_le_tsum_of_injective hg (fun v : Fin n → ℕ ↦ ∏ i, b (v i)) + simpa only [g, tsum_vector_prod, Finset.prod_const, Finset.card_univ, Fintype.card_fin] using h + +abbrev BoundedTimes (T n : ℕ) := {t : Fin n → ℕ // StrictMono t ∧ ∀ i, t i ≤ T} +abbrev TimeSubset (T : ℕ) := {s : Finset ℕ // s ∈ (Finset.range (T+1)).powerset} + +def encodeTimeSubset (T : ℕ) (s : TimeSubset T) : Σ n, BoundedTimes T n := + ⟨s.val.card, ⟨s.val.orderEmbOfFin rfl, (s.val.orderEmbOfFin rfl).strictMono, + fun i ↦ by + have h := (Finset.mem_powerset.mp s.property) (s.val.orderEmbOfFin_mem rfl i) + exact Nat.le_of_lt_succ (Finset.mem_range.mp h)⟩⟩ + +def decodeTimes {T : ℕ} (v : Σ n, BoundedTimes T n) : Finset ℕ := + Finset.univ.image v.2.val + +lemma decode_encode (T : ℕ) (s : TimeSubset T) : decodeTimes (encodeTimeSubset T s) = s.val := by + exact s.val.image_orderEmbOfFin_univ rfl + +lemma encodeTimeSubset_injective (T : ℕ) : Function.Injective (encodeTimeSubset T) := by + intro s t h + apply Subtype.ext + simpa only [decode_encode] using congrArg decodeTimes h + +lemma prod_encode (T : ℕ) (s : TimeSubset T) (f : ℕ → ℝ≥0∞) : + (∏ i, f ((encodeTimeSubset T s).2.val i)) = ∏ u ∈ s.val, f u := by + change (∏ i, f (s.val.orderEmbOfFin rfl i)) = _ + conv_rhs => rw [← s.val.map_orderEmbOfFin_univ rfl, Finset.prod_map] + rfl + +lemma prod_one_add_le_ordered_series (T : ℕ) (f : ℕ → ℝ≥0∞) : + (∏ u ∈ Finset.range (T+1), (1+f u)) ≤ + ∑' n, ∑' t : BoundedTimes T n, ∏ i, f (t.val i) := by + rw [Finset.prod_one_add] + calc + _ = ∑' s : TimeSubset T, ∏ u ∈ s.val, f u := by + rw [tsum_fintype] + exact (Finset.sum_attach _ _).symm + _ = ∑' s : TimeSubset T, ∏ i, f ((encodeTimeSubset T s).2.val i) := by + apply tsum_congr + intro s + exact (prod_encode T s f).symm + _ ≤ ∑' v : Σ n, BoundedTimes T n, ∏ i, f (v.2.val i) := + ENNReal.tsum_comp_le_tsum_of_injective (encodeTimeSubset_injective T) + (fun v : Σ n, BoundedTimes T n ↦ ∏ i, f (v.2.val i)) + _ = _ := ENNReal.tsum_sigma' _ + +abbrev PairNoise (m : ℕ) := TreeNoise m × TreeNoise m +abbrev FourNoise (m : ℕ) := PairNoise m × PairNoise m +abbrev PairHistory (u : ℕ) := (Fin (u+1) → ℤ) × (Fin (u+1) → ℤ) +abbrev FourHistory (u : ℕ) := PairHistory u × PairHistory u + +def pairLaw (m : ℕ) : PMF (PairNoise m) := + independentPair (PMF.uniformOfFintype (TreeNoise m)) (PMF.uniformOfFintype (TreeNoise m)) + +def fourLaw (m : ℕ) : PMF (FourNoise m) := independentPair (pairLaw m) (pairLaw m) + +end HardSphere.Lattice +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/SimplePath.lean b/lean/OAI/Analysis/HardSphere/Geometry/SimplePath.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbfe222a118ddee8eb8f2fb893de808a5f51afa2 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/SimplePath.lean @@ -0,0 +1,153 @@ +import Mathlib +import OAI.Analysis.HardSphere.Paths.AdmissiblePair + +namespace OAI + +noncomputable section +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped ENNReal NNReal +open scoped ENNReal +namespace HardSphere.Lattice +open MeasureTheory ProbabilityTheory + +abbrev SimplePath {K : ℕ} (x y : DiscreteTorus K) := + {p : (torusNearestGraph K).Walk x y // p.IsPath} + +instance simplePathMeasurableSpace {K : ℕ} (x y : DiscreteTorus K) : + MeasurableSpace (SimplePath x y) := ⊤ + +instance simplePathCountable {K : ℕ} [NeZero K] (x y : DiscreteTorus K) : + Countable (SimplePath x y) := by + let : Countable ((torusNearestGraph K).Walk x y) := SimpleGraph.Walk.support_injective.countable + infer_instance + +instance environmentMeasurableSpace (K : ℕ) : MeasurableSpace (Finset (DiscreteTorus K)) := ⊤ + +def forgetGood {K : ℕ} {B : Finset (DiscreteTorus K)} {x y : DiscreteTorus K} + (p : SimpleGoodPath B x y) : SimplePath x y := ⟨p.val,p.property.1⟩ + +def simpleEncounter {K : ℕ} (R : ℕ) {x y : DiscreteTorus K} (p q : SimplePath x y) : ℕ := + (encounterSet (torusNear K R) p.val.support.toFinset q.val.support.toFinset).card + +def simplePathGood {K : ℕ} (B : Finset (DiscreteTorus K)) {x y : DiscreteTorus K} + (p : SimplePath x y) : Prop := ∀ z∈p.val.support, z∉B + +lemma pmf_lintegral_discrete {α : Type*} [Countable α] [MeasurableSpace α] + [MeasurableSingletonClass α] (μ : PMF α) (f : α → ℝ≥0∞) : + (∫⁻ x, f x ∂μ.toMeasure)=∑' x, μ x*f x := by + rw [lintegral_countable'] + apply tsum_congr + intro x + rw [μ.toMeasure_apply_singleton x (measurableSet_singleton x),mul_comm] + +lemma pmf_event_discrete {α : Type*} [MeasurableSpace α] [DiscreteMeasurableSpace α] + (μ : PMF α) (E : α → Prop) [DecidablePred E] : + μ.toMeasure {x | E x}=∑' x, if E x then μ x else 0 := by + rw [μ.toMeasure_apply MeasurableSet.of_discrete] + apply tsum_congr + intro x + exact Set.indicator_apply _ _ _ + +lemma forgetGood_full_mass {K : ℕ} {B : Finset (DiscreteTorus K)} {x y : DiscreteTorus K} + (ν : PMF (SimpleGoodPath B x y)) : + (ν.map forgetGood).toMeasure {p | simplePathGood B p}=1 := by + apply (PMF.toMeasure_apply_eq_one_iff _ MeasurableSet.of_discrete).mpr + intro p hp + obtain ⟨q,_,rfl⟩ := (PMF.mem_support_map_iff forgetGood ν p).mp hp + exact q.property.2 + +lemma forgetGood_double_moment {K : ℕ} [NeZero K] (R : ℕ) (κ : ℝ) + {B : Finset (DiscreteTorus K)} {x y : DiscreteTorus K} (ν : PMF (SimpleGoodPath B x y)) : + (∫⁻ p, ∫⁻ q, ENNReal.ofReal (Real.exp (κ*(simpleEncounter R p q:ℝ))) + ∂(ν.map forgetGood).toMeasure ∂(ν.map forgetGood).toMeasure)=pathKernelMoment R κ ν := by + simp_rw [pmf_lintegral_discrete,pmf_map_expectation] + rfl + +lemma mapped_bad_law {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + {K : ℕ} [NeZero K] (b : Ω → Finset (DiscreteTorus K)) (hb : Measurable b) + (p : ℝ≥0∞) (hbad : ∀ A : Finset (DiscreteTorus K), P {d | A⊆b d}≤p^A.card) : + let := (Measure.isProbabilityMeasure_map_iff (μ := P) hb.aemeasurable).mpr inferInstance + JointBadLaw (P.map b).toPMF p := by + dsimp only + let := (Measure.isProbabilityMeasure_map_iff (μ := P) hb.aemeasurable).mpr inferInstance + intro A + rw [← pmf_event_discrete (P.map b).toPMF (fun B ↦ A⊆B),Measure.toPMF_toMeasure, + Measure.map_apply (μ := P) hb MeasurableSet.of_discrete] + exact hbad A + +lemma finite_datum_expectation {Ω α : Type*} [MeasurableSpace Ω] [MeasurableSpace α] + [DiscreteMeasurableSpace α] [Countable α] (P : Measure Ω) [IsProbabilityMeasure P] + (b : Ω → α) (hb : Measurable b) (f : α → ℝ≥0∞) : + let := (Measure.isProbabilityMeasure_map_iff (μ := P) hb.aemeasurable).mpr inferInstance + (∫⁻ d, f (b d) ∂P)=∑' a, (P.map b).toPMF a*f a := by + dsimp only + let := (Measure.isProbabilityMeasure_map_iff (μ := P) hb.aemeasurable).mpr inferInstance + rw [← pmf_lintegral_discrete,Measure.toPMF_toMeasure,lintegral_map Measurable.of_discrete hb] + +theorem good_paths_measurable (R : ℕ) : + ∃ p₀ κ : ℝ, 0 apply ZMod.val_injective <;> assumption + +def siteCubeEmbedding {K : ℕ} [NeZero K] : DiscreteTorus K ↪ CubeCell K := + ⟨siteCube, siteCube_injective⟩ + +lemma unitCenter_siteCube {K : ℕ} [NeZero K] (L : Length) (v : DiscreteTorus K) : + unitCenter L (siteCube v) = siteCenter L v := by + funext j + fin_cases j <;> rfl + +lemma spatial_event_siteCube {m K : ℕ} [NeZero K] (L : Length) (s T : ℝ) + (A : Finset (DiscreteTorus K)) : + {Y : Configuration m L | ∀ v ∈ A.map siteCubeEmbedding, + T ≤ ((pairCloseLabels L s (unitCenter L v) Y).card : ℝ)} = + {Y : Configuration m L | A ⊆ closeSet L s T Y} := by + classical + ext Y + simp only [Finset.mem_map, Function.Embedding.coeFn_mk, siteCubeEmbedding, + forall_exists_index, and_imp, forall_apply_eq_imp_iff₂, unitCenter_siteCube, + Set.mem_ofPred_eq, Finset.subset_iff, closeSet, Finset.mem_filter, Finset.mem_univ, true_and] + +lemma IsGroundVector.positionLaw_ae_allowed {n : ℕ} {L : Length} {r : ℝ} + {g : Jet n L} (hg : HardSphere.IsGroundVector n L r g) : + ∀ᵐ X ∂groundPositionLaw n L g, X ∈ allowed n L r := by + have he := hg.killed_eigenvector (t := 0) (le_refl 0) + simp only [killedTransition_zero, zero_mul, neg_zero, Real.exp_zero, + Complex.ofReal_one, one_smul] at he + have hproj := allowedProjection_ae n L r g.1 + rw [he] at hproj + rw [groundPositionLaw, ae_withDensity_iff] + · filter_upwards [hproj] with X hX hpos + by_contra hnot + rw [indicator_of_notMem hnot] at hX + simp [hX] at hpos + · exact ((Lp.stronglyMeasurable g.1).measurable.norm.pow_const 2).ennreal_ofReal + +lemma allowed_restrict {m n : ℕ} {L : Length} {r : ℝ} (e : Fin m ↪ Fin n) + {X : Configuration n L} (hX : X ∈ allowed n L r) : + (fun i ↦ X (e i)) ∈ allowed m L r := by + rw [allowed_iff_ne] at hX ⊢ + intro i j hij + exact hX (e i) (e j) (fun he ↦ hij (e.injective he)) + +lemma IsGroundVector.bathLaw_ae_allowed {m n : ℕ} {L : Length} {r : ℝ} + {g : Jet n L} (hg : HardSphere.IsGroundVector n L r g) (e : Fin m ↪ Fin n) : + ∀ᵐ Y ∂(groundPositionLaw n L g).map (fun X i ↦ X (e i)), Y ∈ allowed m L r := by + have hm : Measurable (fun X : Configuration n L ↦ (fun i ↦ X (e i))) := + Measurable.of_eval (fun i ↦ measurable_pi_apply (e i)) + exact (ae_map_iff hm.aemeasurable (isOpen_allowed m L r).measurableSet).mpr + ((IsGroundVector.positionLaw_ae_allowed hg).mono (fun _ hX ↦ allowed_restrict e hX)) + +theorem physical_close_tail : ∃ Q : ℕ, 0.aestronglyMeasurable + +lemma bath_slice_quadratic_ae {m n : ℕ} {L : Length} (u : ScalarL2 (m+n) L) (a t : ℝ) : + ∀ᵐ ω : ConfigurationPath m L ∂freePathLaw m L t, + (∫⁻ η : ConfigurationPath n L, + ENNReal.ofReal (‖u (joinConfiguration m n L (ω 0,η 0))‖* + ‖u (joinConfiguration m n L (ω 1,η 1))‖) ∂killedPathLaw n L a t) ≤ + ENNReal.ofReal (‖killedTransition n L a t‖/2)* + (ENNReal.ofReal (sliceNormSq u (ω 0))+ENNReal.ofReal (sliceNormSq u (ω 1))) := by + filter_upwards [(freePathLaw_marginal m L t 0).quasiMeasurePreserving.ae (memLp_slice_ae u), + (freePathLaw_marginal m L t 1).quasiMeasurePreserving.ae (memLp_slice_ae u)] with ω h0 h1 + exact killed_endpoint_quadratic_function a t h0 h1 +end +end HardSphere + +noncomputable section +open MeasureTheory Filter Set +open scoped Topology ENNReal BigOperators + +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/SmallComponent.lean b/lean/OAI/Analysis/HardSphere/Geometry/SmallComponent.lean new file mode 100644 index 0000000000000000000000000000000000000000..95610be9d1d9d8b0ca7593e67ef08e7ec2a43d3a --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/SmallComponent.lean @@ -0,0 +1,162 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.FilledRegion + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators Classical +open scoped BigOperators Classical +namespace HardSphere.BathSlice +open HardSphere.Lattice + +def SmallComponent (h : ℝ) (C : Finset Vertex) : Prop := + ∀ u ∈ C, ∀ v ∈ C, ∀ j, h * |(u j : ℝ) - v j| ≤ 1 + +lemma small_fill_coordinate {h : ℝ} (hh : 0 ≤ h) {C : Finset Vertex} + (hC : SmallComponent h C) {z c : Vertex} (hz : z ∈ fill C) (hc : c ∈ C) + (i : Fin 3) : h * |(z i : ℝ) - c i| ≤ 1 := by + obtain ⟨⟨u, hu, huz⟩, ⟨v, hv, hzv⟩⟩ := fill_subset_coordinateBox C hz i + have hu' : (u i : ℝ) ≤ z i := by exact_mod_cast huz + have hv' : (z i : ℝ) ≤ v i := by exact_mod_cast hzv + have huc := hC u hu c hc i + have hvc := hC v hv c hc i + have huv := le_abs_self ((u i : ℝ) - c i) + have hcu := neg_abs_le ((u i : ℝ) - c i) + have hvv := le_abs_self ((v i : ℝ) - c i) + rw [show h * |(z i : ℝ) - c i| = |h * ((z i : ℝ) - c i)| by + rw [abs_mul, abs_of_nonneg hh], abs_le] + have hm₁ := mul_le_mul_of_nonneg_left hu' hh + have hm₂ := mul_le_mul_of_nonneg_left hv' hh + have hm₃ := mul_le_mul_of_nonneg_left hcu hh + have hm₄ := mul_le_mul_of_nonneg_left hvv hh + constructor <;> nlinarith + +def microColumn (L : Length) (h : ℝ) (z : Vertex) : Set (Torus L) := + Set.univ.pi fun j ↦ Metric.closedBall + ((h * (z j : ℝ) + h/2 - 1/2 : ℝ) : AddCircle L.val) + (if j = 0 then 1 + h/2 else h/2) + +lemma small_fill_subset_columns {L : Length} {h : ℝ} (hh : 0 ≤ h) + {C : Finset Vertex} (hC : SmallComponent h C) : + filledRegion L h C ⊆ ⋃ c ∈ C, microColumn L h c := by + intro x hx + obtain ⟨z, hz, hx⟩ := Set.mem_iUnion₂.mp hx + obtain ⟨c, hc, hcol⟩ := fill_column_meets C hz 0 + refine Set.mem_iUnion₂.mpr ⟨c, hc, ?_⟩ + obtain ⟨u, hu, rfl⟩ := hx + intro j _ + apply (coordinate_dist_lift_le L (u j) (h * (c j : ℝ) + h/2 - 1/2)).trans + have hl := hu.1 j + have hr := hu.2 j + change h * (z j : ℝ) - 1/2 ≤ u j at hl + change u j ≤ h * ((z j : ℝ)+1) - 1/2 at hr + by_cases hj : j = 0 + · subst j + simp only [ite_true] + have hb := small_fill_coordinate hh hC hz hc 0 + have hb' : |h * ((z 0 : ℝ) - c 0)| ≤ 1 := by + simpa only [abs_mul, abs_of_nonneg hh] using hb + obtain ⟨hb₁, hb₂⟩ := abs_le.mp hb' + apply abs_le.mpr + constructor <;> nlinarith + · simp only [ite_eq_right hj] + have he := hcol j hj + rw [← he] at hl hr + apply abs_le.mpr + constructor <;> nlinarith + +lemma volume_microColumn_le (L : Length) {h : ℝ} (hh : 0 ≤ h) (hh1 : h ≤ 1) + (z : Vertex) : + (volume : Measure (Torus L)) (microColumn L h z) ≤ ENNReal.ofReal (3*h^2) := by + unfold microColumn + rw [volume_pi_pi] + simp only [AddCircle.volume_closedBall] + have hb (j : Fin 3) : ENNReal.ofReal (min L.val + (2 * (if j = 0 then 1 + h/2 else h/2))) ≤ + (if j = 0 then ENNReal.ofReal 3 else ENNReal.ofReal h) := by + split_ifs with hj + · apply ENNReal.ofReal_le_ofReal + exact (min_le_right _ _).trans (by linarith) + · apply ENNReal.ofReal_le_ofReal + exact (min_le_right _ _).trans (by linarith) + calc + _ ≤ ∏ j : Fin 3, (if j = 0 then ENNReal.ofReal 3 else ENNReal.ofReal h) := + Finset.prod_le_prod fun j _ ↦ hb j + _ = ENNReal.ofReal (3*h^2) := by + simp [Fin.prod_univ_succ, ENNReal.ofReal_mul (by norm_num : (0:ℝ) ≤ 3), + ENNReal.ofReal_mul hh, pow_two] + +lemma microColumn_eq_of_projection {L : Length} {J : ℕ} {h : ℝ} + (hperiod : L.val = h * J) {w z : Vertex} + (he : torusProjection J w = torusProjection J z) : + microColumn L h w = microColumn L h z := by + have hc (j : Fin 3) : + ((h * (w j : ℝ) + h/2 - 1/2 : ℝ) : AddCircle L.val) = + ((h * (z j : ℝ) + h/2 - 1/2 : ℝ) : AddCircle L.val) := by + have hj := congrFun he j + obtain ⟨k, hk⟩ := (ZMod.intCast_eq_intCast_iff_dvd_sub (w j) (z j) J).mp hj + have hkr : (z j : ℝ) - w j = (J : ℝ) * k := by exact_mod_cast hk + have hr : h * (z j : ℝ) + h/2 - 1/2 = + (h * (w j : ℝ) + h/2 - 1/2) + (k : ℝ) * L.val := by + rw [hperiod] + linear_combination h * hkr + rw [hr, AddCircle.coe_add] + have hk0 : (((k : ℝ) * L.val : ℝ) : AddCircle L.val) = 0 := by + rw [← zsmul_eq_mul, AddCircle.coe_zsmul, AddCircle.coe_period, smul_zero] + rw [hk0, add_zero] + simp only [microColumn, hc] + +def bathWitnessCover {n : ℕ} {L : Length} (h : ℝ) (Y : Configuration n L) : Finset Vertex := + Finset.univ.biUnion fun i ↦ witnessBox h + (fun j ↦ (AddCircle.equivIco L.val 0 (Y i j)).val) + +lemma card_bathWitnessCover_le {n : ℕ} {L : Length} (h : ℝ) (Y : Configuration n L) : + (bathWitnessCover h Y).card ≤ 343 * n := by + apply Finset.card_biUnion_le.trans + simp only [card_witnessBox, Finset.sum_const, Finset.card_univ, Fintype.card_fin, + smul_eq_mul] + omega + +lemma bad_has_bathWitness {n : ℕ} {L : Length} {J : ℕ} {h r : ℝ} (hh : 0 < h) + (hperiod : L.val = h * J) (hr : r ≤ 2*h) (Y : Configuration n L) + {z : Vertex} (hz : z ∈ bad h r Y) : + ∃ w ∈ bathWitnessCover h Y, torusProjection J w = torusProjection J z := by + obtain ⟨x, hx, i, hi⟩ := hz + let c : Point := fun j ↦ (AddCircle.equivIco L.val 0 (Y i j)).val + have hc : liftPoint L c = Y i := by ext j; exact AddCircle.coe_equivIco + obtain ⟨w, hw, he⟩ := ball_microCube_witness hh hperiod hr c hx (by simpa [hc] using hi) + exact ⟨w, Finset.mem_biUnion.mpr ⟨i, Finset.mem_univ _, hw⟩, he⟩ + +def smallFills {n : ℕ} {L : Length} (h r : ℝ) (Y : Configuration n L) : Set (Torus L) := + {x | ∃ C, IsBadComponent (bad h r Y) C ∧ SmallComponent h C ∧ x ∈ filledRegion L h C} + +theorem volume_smallFills_le {n : ℕ} {L : Length} {J : ℕ} {h r : ℝ} + (hh : 0 < h) (hh1 : h ≤ 1) (hperiod : L.val = h * J) (hr : r ≤ 2*h) + (Y : Configuration n L) : + (volume : Measure (Torus L)) (smallFills h r Y) ≤ ENNReal.ofReal (1029*h^2*n) := by + have hsub : smallFills h r Y ⊆ ⋃ w ∈ bathWitnessCover h Y, microColumn L h w := by + rintro x ⟨C, hC, hs, hx⟩ + obtain ⟨c, hc, hxc⟩ := Set.mem_iUnion₂.mp (small_fill_subset_columns hh.le hs hx) + obtain ⟨w, hw, he⟩ := bad_has_bathWitness hh hperiod hr Y (hC.subset hc) + refine Set.mem_iUnion₂.mpr ⟨w, hw, ?_⟩ + rwa [microColumn_eq_of_projection hperiod he] + calc + _ ≤ volume (⋃ w ∈ bathWitnessCover h Y, microColumn L h w) := measure_mono hsub + _ ≤ ∑ w ∈ bathWitnessCover h Y, volume (microColumn L h w) := measure_biUnion_finset_le _ _ + _ ≤ ∑ _w ∈ bathWitnessCover h Y, ENNReal.ofReal (3*h^2) := + Finset.sum_le_sum fun w _ ↦ volume_microColumn_le L hh.le hh1 w + _ = ENNReal.ofReal (((bathWitnessCover h Y).card : ℝ) * (3*h^2)) := by + simp [ENNReal.ofReal_mul, nsmul_eq_mul] + _ ≤ _ := by + apply ENNReal.ofReal_le_ofReal + have hc : ((bathWitnessCover h Y).card : ℝ) ≤ 343*n := by + exact_mod_cast card_bathWitnessCover_le h Y + nlinarith [mul_le_mul_of_nonneg_right hc (sq_nonneg h)] + +end HardSphere.BathSlice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/SmoothMultiplier.lean b/lean/OAI/Analysis/HardSphere/Geometry/SmoothMultiplier.lean new file mode 100644 index 0000000000000000000000000000000000000000..53748528f0ab211c4cdf7b6da68e245822a122df --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/SmoothMultiplier.lean @@ -0,0 +1,98 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.ConfigurationPath +import OAI.Analysis.HardSphere.Geometry.CoordinateLine + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +namespace HardSphere +structure SmoothMultiplier (N : ℕ) (L : Length) where + toFun : Configuration N L → ℂ + smooth : ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) + (fun X : LiftedConfiguration N ↦ toFun (project N L X)) + memLp_top : MemLp toFun ∞ (volume : Measure (Configuration N L)) + partial_memLp_top : ∀ p : Direction N, MemLp (coordDerivative N L toFun p) ∞ volume + +def SmoothMultiplier.mul {N : ℕ} {L : Length} (f g : SmoothMultiplier N L) : + SmoothMultiplier N L where + toFun := f.toFun * g.toFun + smooth := f.smooth.mul g.smooth + memLp_top := f.memLp_top.mul g.memLp_top + partial_memLp_top := by + intro p + rw [coordDerivative_mul (f.smooth.differentiable (by simp)) + (g.smooth.differentiable (by simp))] + exact (f.memLp_top.mul (g.partial_memLp_top p)).add + (g.memLp_top.mul (f.partial_memLp_top p)) + +def SmoothTest.multiply {N : ℕ} {L : Length} {a : ℝ} (f : SmoothMultiplier N L) + (g : SmoothTest N L a) : SmoothTest N L a where + toFun := f.toFun * g.toFun + smooth := f.smooth.mul g.smooth + compact := g.compact.mul_left + support_allowed := tsupport_mul_subset_right.trans g.support_allowed + memLp := f.memLp_top.mul g.memLp + partial_memLp := by + intro p + rw [coordDerivative_mul (f.smooth.differentiable (by simp)) + (g.smooth.differentiable (by simp))] + exact (f.memLp_top.mul (g.partial_memLp p)).add + (g.memLp.mul (f.partial_memLp_top p)) + +def SmoothMultiplier.onScalar {N : ℕ} {L : Length} (f : SmoothMultiplier N L) : + ScalarL2 N L →L[ℂ] ScalarL2 N L := L2Multiplier.clm f.toFun f.memLp_top + +def SmoothMultiplier.onJet {N : ℕ} {L : Length} (f : SmoothMultiplier N L) : + Jet N L →L[ℂ] Jet N L := + (f.onScalar.comp (.fst ℂ _ _)).prod (.pi fun p ↦ + f.onScalar.comp ((ContinuousLinearMap.proj p).comp (ContinuousLinearMap.snd ℂ _ _)) + + (L2Multiplier.clm _ (f.partial_memLp_top p)).comp (.fst ℂ _ _)) + +lemma SmoothTest.jet_multiply {N : ℕ} {L : Length} {a : ℝ} + (f : SmoothMultiplier N L) (g : SmoothTest N L a) : + (g.multiply f).jet = f.onJet g.jet := by + apply Prod.ext + · apply Lp.ext + filter_upwards [MemLp.coeFn_toLp (g.multiply f).memLp, MemLp.coeFn_toLp g.memLp, + L2Multiplier.coe_clm f.toFun f.memLp_top g.jet.1] with X h1 h2 h3 + change _ = (f.onScalar g.jet.1) X + exact h1.trans (by simpa only [SmoothTest.multiply, Pi.mul_apply, SmoothTest.jet, + SmoothMultiplier.onScalar, h2] using h3.symm) + · funext p + apply Lp.ext + have hder := coordDerivative_mul (f.smooth.differentiable (by simp)) + (g.smooth.differentiable (by simp)) p + filter_upwards [MemLp.coeFn_toLp ((g.multiply f).partial_memLp p), + MemLp.coeFn_toLp g.memLp, MemLp.coeFn_toLp (g.partial_memLp p), + L2Multiplier.coe_clm f.toFun f.memLp_top (g.jet.2 p), + L2Multiplier.coe_clm _ (f.partial_memLp_top p) g.jet.1, + Lp.coeFn_add (f.onScalar (g.jet.2 p)) + (L2Multiplier.clm _ (f.partial_memLp_top p) g.jet.1)] with X h1 h2 h3 h4 h5 h6 + change _ = (f.onScalar (g.jet.2 p) + L2Multiplier.clm _ (f.partial_memLp_top p) g.jet.1) X + rw [h6, Pi.add_apply, SmoothMultiplier.onScalar, h4, h5] + simp only [SmoothTest.jet] + rw [h1] + change coordDerivative N L (f.toFun * g.toFun) p X = _ + rw [hder] + simp only [Pi.add_apply, Pi.mul_apply, h2, h3] + ring + +lemma SmoothMultiplier.onJet_mem_domain {N : ℕ} {L : Length} {a : ℝ} + (f : SmoothMultiplier N L) {u : Jet N L} (hu : u ∈ dirichletDomain N L a) : + f.onJet u ∈ dirichletDomain N L a := by + apply map_mem_closure f.onJet.continuous hu + rintro _ ⟨g, rfl⟩ + exact ⟨g.multiply f, g.jet_multiply f⟩ + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/SmoothSiteWeight.lean b/lean/OAI/Analysis/HardSphere/Geometry/SmoothSiteWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..261dedffff33468c043b664e44251bcfc8f12a83 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/SmoothSiteWeight.lean @@ -0,0 +1,195 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.GroundPositionLaw +import OAI.Analysis.HardSphere.Geometry.RadiusLaw + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate + +def smoothSiteWeight (L : Length) (A : Finset (Torus L)) (x : Torus L) : ℝ := + Real.exp (-smoothSpatialDistance L A x) + +lemma smoothSiteWeight_pos (L : Length) (A : Finset (Torus L)) (x : Torus L) : + 0 < smoothSiteWeight L A x := Real.exp_pos _ + +lemma smoothSiteWeight_bounds (L : Length) (A : Finset (Torus L)) (x : Torus L) : + Real.exp (-1)*Real.exp (-spatialSiteDistance L A x) ≤ smoothSiteWeight L A x ∧ + smoothSiteWeight L A x ≤ Real.exp 1*Real.exp (-spatialSiteDistance L A x) := by + have h := abs_le.mp (smoothSpatialDistance_approximation L A x) + constructor <;> rw [←Real.exp_add] <;> apply Real.exp_le_exp.mpr <;> linarith only [h.1,h.2] + +lemma smoothSiteWeight_le (L : Length) (A : Finset (Torus L)) (x : Torus L) : + smoothSiteWeight L A x ≤ Real.exp 1 := by + apply (smoothSiteWeight_bounds L A x).2.trans + exact mul_le_of_le_one_right (Real.exp_pos 1).le (Real.exp_le_one_iff.mpr (neg_nonpos.mpr (spatialSiteDistance_nonneg L A x))) + +def smoothSiteWeightMultiplier (L : Length) (A : Finset (Torus L)) : SmoothMultiplier 1 L := + (spatialDistanceMultiplier L A).realComp (fun t ↦ Real.exp (-t)) + (Real.contDiff_exp.comp contDiff_id.neg) + +lemma smoothSiteWeightMultiplier_apply (L : Length) (A : Finset (Torus L)) (X : Configuration 1 L) : + (smoothSiteWeightMultiplier L A).toFun X=(smoothSiteWeight L A (X 0):ℂ) := rfl + +lemma smoothSiteWeightMultiplier_real (L : Length) (A : Finset (Torus L)) (X : Configuration 1 L) : + conj ((smoothSiteWeightMultiplier L A).toFun X)=(smoothSiteWeightMultiplier L A).toFun X := by + rw [smoothSiteWeightMultiplier_apply,Complex.conj_ofReal] + +lemma smoothSiteWeight_continuous (L : Length) (A : Finset (Torus L)) : Continuous (smoothSiteWeight L A) := + Real.continuous_exp.comp (smoothSpatialDistance_lipschitz L A).continuous.neg + +lemma smoothSiteWeight_partial_sq (L : Length) (A : Finset (Torus L)) (j : Fin 3) (x : Torus L) : + ‖coordDerivative 1 L (smoothSiteWeightMultiplier L A).toFun (0,j) (fun _ ↦ x)‖^2 ≤ + ((spatialMetricConstant:ℝ)^2*Real.exp 1)*smoothSiteWeight L A x := by + rw [smoothSiteWeightMultiplier,SmoothMultiplier.partial_realComp _ _ _ (spatialDistanceMultiplier_real L A)] + have hd (t : ℝ) : deriv (fun t : ℝ ↦ Real.exp (-t)) t= -Real.exp (-t) := by + simpa using (((hasDerivAt_id t).neg).exp).deriv + rw [hd,norm_mul,mul_pow,Complex.norm_real,Real.norm_eq_abs,sq_abs] + change (-smoothSiteWeight L A x)^2 * ‖coordDerivative 1 L (spatialDistanceMultiplier L A).toFun (0,j) (fun _ ↦ x)‖^2 ≤ _ + rw [neg_sq] + have h := sq_le_sq₀ (norm_nonneg _) spatialMetricConstant.coe_nonneg |>.mpr + (spatialDistanceMultiplier_partial_bound L A (0,j) (fun _ ↦ x)) + have hw := mul_le_mul_of_nonneg_left (smoothSiteWeight_le L A x) (smoothSiteWeight_pos L A x).le + calc + _ ≤ (smoothSiteWeight L A x)^2*(spatialMetricConstant:ℝ)^2 := mul_le_mul_of_nonneg_left h (sq_nonneg _) + _ ≤ (Real.exp 1*smoothSiteWeight L A x)*(spatialMetricConstant:ℝ)^2 := by + apply mul_le_mul_of_nonneg_right _ (sq_nonneg _) + nlinarith only [hw] + _ = _ := by ring + +def smoothWeightedCount {n : ℕ} (L : Length) (A : Finset (Torus L)) (X : Configuration n L) : ℝ := + ∑ i, smoothSiteWeight L A (X i) + +def smoothWeightedCountMultiplier (n : ℕ) (L : Length) (A : Finset (Torus L)) : SmoothMultiplier n L := + SmoothMultiplier.sum (fun i : Fin n ↦ (smoothSiteWeightMultiplier L A).liftLabel n i) + +lemma smoothWeightedCountMultiplier_apply (n : ℕ) (L : Length) (A : Finset (Torus L)) (X : Configuration n L) : + (smoothWeightedCountMultiplier n L A).toFun X=(smoothWeightedCount L A X:ℂ) := by + change (∑ i : Fin n, (smoothSiteWeightMultiplier L A).toFun (fun _ ↦ X i))=_ + simp_rw [smoothSiteWeightMultiplier_apply] + exact (Complex.ofReal_sum _ _).symm + +lemma smoothWeightedCountMultiplier_real (n : ℕ) (L : Length) (A : Finset (Torus L)) (X : Configuration n L) : + conj ((smoothWeightedCountMultiplier n L A).toFun X)=(smoothWeightedCountMultiplier n L A).toFun X := by + rw [smoothWeightedCountMultiplier_apply,Complex.conj_ofReal] + +lemma smoothWeightedCount_nonneg {n : ℕ} (L : Length) (A : Finset (Torus L)) (X : Configuration n L) : + 0 ≤ smoothWeightedCount L A X := Finset.sum_nonneg (fun i _ ↦ (smoothSiteWeight_pos L A (X i)).le) + +lemma smoothWeightedCount_le {n : ℕ} (L : Length) (A : Finset (Torus L)) (X : Configuration n L) : + smoothWeightedCount L A X ≤ Real.exp 1*(n:ℝ) := by + calc + _ ≤ ∑ _i : Fin n, Real.exp 1 := Finset.sum_le_sum (fun i _ ↦ smoothSiteWeight_le L A (X i)) + _ = _ := by simp; ring + +lemma smoothWeightedCount_bounds {n : ℕ} (L : Length) (A : Finset (Torus L)) (hA : A.Nonempty) (X : Configuration n L) : + Real.exp (-1)*weightedSiteCount L A X ≤ smoothWeightedCount L A X ∧ + smoothWeightedCount L A X ≤ Real.exp 1*weightedSiteCount L A X := by + simp only [weightedSiteCount,ite_eq_left hA,smoothWeightedCount,Finset.mul_sum] + exact ⟨Finset.sum_le_sum (fun i _ ↦ (smoothSiteWeight_bounds L A (X i)).1), + Finset.sum_le_sum (fun i _ ↦ (smoothSiteWeight_bounds L A (X i)).2)⟩ + +lemma smoothWeightedCount_continuous {n : ℕ} (L : Length) (A : Finset (Torus L)) : + Continuous (smoothWeightedCount (n:=n) L A) := + continuous_finsetSum _ (fun i _ ↦ (smoothSiteWeight_continuous L A).comp (continuous_apply i)) + +lemma smoothWeightedCount_gradient {n : ℕ} (L : Length) (A : Finset (Torus L)) (X : Configuration n L) : + (∑ p : Direction n, ‖coordDerivative n L (smoothWeightedCountMultiplier n L A).toFun p X‖^2) ≤ + (3*(spatialMetricConstant:ℝ)^2*Real.exp 1)*smoothWeightedCount L A X := by + have hp (p : Direction n) : coordDerivative n L (smoothWeightedCountMultiplier n L A).toFun p X= + coordDerivative 1 L (smoothSiteWeightMultiplier L A).toFun (0,p.2) (fun _ ↦ X p.1) := by + classical + rw [smoothWeightedCountMultiplier,SmoothMultiplier.partial_sum] + simp_rw [SmoothMultiplier.partial_liftLabel] + simp + simp_rw [hp] + rw [Fintype.sum_prod_type] + calc + _ ≤ ∑ i : Fin n, ∑ _j : Fin 3, ((spatialMetricConstant:ℝ)^2*Real.exp 1)*smoothSiteWeight L A (X i) := by + exact Finset.sum_le_sum (fun i _ ↦ Finset.sum_le_sum (fun j _ ↦ smoothSiteWeight_partial_sq L A j (X i))) + _ = _ := by + simp only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul,smoothWeightedCount,Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + ring + +end HardSphere + +namespace HardSphere +open MeasureTheory Set Filter ProbabilityTheory + +lemma groundPositionLaw_integral {n : ℕ} {L : Length} (u : Jet n L) (f : Configuration n L → ℝ) : + (∫ X, f X ∂groundPositionLaw n L u)=∫ X, f X*‖u.1 X‖^2 := by + rw [groundPositionLaw,integral_withDensity_eq_integral_toReal_smul + (((Lp.stronglyMeasurable u.1).measurable.norm.pow_const 2).ennreal_ofReal) + (Eventually.of_forall (fun _ ↦ ENNReal.ofReal_lt_top))] + simp only [ENNReal.toReal_ofReal (sq_nonneg _),smul_eq_mul,mul_comm] + +lemma groundPositionLaw_integrable {n : ℕ} {L : Length} (u : Jet n L) (f : Configuration n L → ℝ) : + Integrable f (groundPositionLaw n L u) ↔ Integrable (fun X ↦ f X*‖u.1 X‖^2) volume := by + rw [groundPositionLaw,integrable_withDensity_iff + (((Lp.stronglyMeasurable u.1).measurable.norm.pow_const 2).ennreal_ofReal) + (Eventually.of_forall (fun _ ↦ ENNReal.ofReal_lt_top))] + simp only [ENNReal.toReal_ofReal (sq_nonneg _)] + +lemma groundPositionLaw_probability {n : ℕ} {L : Length} (u : Jet n L) (hu : ‖u.1‖=1) : + IsProbabilityMeasure (groundPositionLaw n L u) := by + constructor + rw [groundPositionLaw,withDensity_apply _ MeasurableSet.univ,Measure.restrict_univ, + ←ofReal_integral_eq_lintegral_ofReal + ((Lp.memLp u.1).integrable_norm_pow (by norm_num : (2:ℕ)≠0)) + (Eventually.of_forall (fun X ↦ sq_nonneg ‖u.1 X‖)),←IndicatorStrong.norm_sq_integral,hu] + norm_num + +lemma bounded_mgf_integrable {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ] + {F : Ω → ℝ} {B : ℝ} (hF : Measurable F) (hb : ∀ x, |F x| ≤B) (t : ℝ) : + Integrable (fun x ↦ Real.exp (t*F x)) μ := by + apply (integrable_const (Real.exp (|t| *B))).mono' (hF.const_mul t).exp.aestronglyMeasurable + exact Eventually.of_forall (fun x ↦ by + rw [Real.norm_eq_abs,abs_of_pos (Real.exp_pos _)] + apply Real.exp_le_exp.mpr + calc + t*F x ≤ |t*F x| := le_abs_self _ + _ = |t| *|F x| := abs_mul _ _ + _ ≤ |t| *B := mul_le_mul_of_nonneg_left (hb x) (abs_nonneg t)) + +lemma bounded_integrableExpSet {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ] + {F : Ω → ℝ} {B : ℝ} (hF : Measurable F) (hb : ∀ x, |F x| ≤B) : + integrableExpSet F μ=univ := by + ext t + simp only [mem_univ,iff_true] + exact bounded_mgf_integrable μ hF hb t + +lemma bounded_cgf_le {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] + {F : Ω → ℝ} {B T C : ℝ} (hF : Measurable F) (hb : ∀ x, |F x| ≤B) (hT : 0≤T) + (hd : ∀ t∈Icc 0 T, (∫ x, F x*Real.exp (t*F x) ∂μ)≤C*mgf F μ t) : + ∀ t∈Icc 0 T, cgf F μ t≤C*t := by + have hm (t : ℝ) : t∈interior (integrableExpSet F μ) := by rw [bounded_integrableExpSet μ hF hb,interior_univ]; trivial + have hf : Differentiable ℝ (cgf F μ) := fun t ↦ (analyticAt_cgf (hm t)).differentiableAt + have hd' (t : ℝ) (ht : t∈interior (Icc 0 T)) : deriv (cgf F μ) t≤C := by + rw [deriv_cgf (hm t)] + exact (div_le_iff₀ (mgf_pos (bounded_mgf_integrable μ hF hb t))).mpr (hd t (interior_subset ht)) + intro t ht + have h := (convex_Icc (0:ℝ) T).image_sub_le_mul_sub_of_deriv_le hf.continuous.continuousOn + hf.differentiableOn hd' 0 ⟨le_rfl,hT⟩ t ht ht.1 + simpa using h + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/SmoothSpatialCountMgf.lean b/lean/OAI/Analysis/HardSphere/Geometry/SmoothSpatialCountMgf.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b76d51ad3843fadc5c6efa320c0ea1d817137f1 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/SmoothSpatialCountMgf.lean @@ -0,0 +1,135 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.ExpWeightedMultiplier + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter ProbabilityTheory +open scoped ComplexConjugate + +lemma smooth_spatial_count_mgf : ∃ C αstar : ℝ, 0 < C ∧ 0 < αstar ∧ + ∀ (n K : ℕ) (L : Length) (_hL : L.val=(K:ℝ)) (r D : ℝ), + D=(n:ℝ)/L.val^3 → 1≤D → αstar≤D*r → 0 apply Finset.sum_congr rfl <;> intro v _ <;> ring + _ ≤ c/D*weightedUnitPairCount hL A X+(V*Q)*D*(A.card:ℝ) := by + have heq : V*D*(Q*(A.card:ℝ))=(V*Q)*D*(A.card:ℝ) := by ring + rw [←heq] + exact add_le_add le_rfl hg + +lemma weighted_count_coercivity_integral (c M : ℝ) (hc : 0< c) (hM : 0< M) : ∃ B : ℝ, 0< B ∧ + ∀ (n K : ℕ) (L : Length) (hL : L.val=(K:ℝ)) (A : Finset (Torus L)), A.Nonempty → + ∀ (D : ℝ), 1≤ D → ∀ (u : ScalarL2 n L), + M*(∫ X, weightedSiteCount L A X*‖u X‖^2)≤ + c/D*(∫ X, weightedUnitPairCount hL A X*‖u X‖^2)+B*D*(A.card:ℝ)*‖u‖^2 := by + obtain ⟨B,hB,hbound⟩ := weighted_count_coercivity c M hc hM + refine ⟨B,hB,?_⟩ + intro n K L hL A hA D hD u + have hf := weightedSiteCount_integrable L A u + have hq := weightedUnitPairCount_integrable hL A u + have hn : Integrable (fun X ↦ ‖u X‖^2) volume := (Lp.memLp u).integrable_norm_pow (by norm_num) + have hh := integral_mono ((hf.const_mul M)) ((hq.const_mul (c/D)).add (hn.const_mul (B*D*(A.card:ℝ)))) + (fun X ↦ by have hp := mul_le_mul_of_nonneg_right (hbound n K L hL A hA D hD X) (sq_nonneg ‖u X‖); simpa only [Pi.add_apply,add_mul,mul_assoc] using hp) + simp only [Pi.add_apply] at hh + rw [integral_add (hq.const_mul (c/D)) (hn.const_mul _)] at hh + simp only [integral_const_mul,←IndicatorStrong.norm_sq_integral] at hh + exact hh + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/SqTwiceSqAbs.lean b/lean/OAI/Analysis/HardSphere/Geometry/SqTwiceSqAbs.lean new file mode 100644 index 0000000000000000000000000000000000000000..87b97ff63133ac2687a46dbd54be38e216fef660 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/SqTwiceSqAbs.lean @@ -0,0 +1,148 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.InjectiveNear + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter + +lemma sq_le_twice_sq_of_abs_le {a b c : ℝ} (h : |a|≤b+c) : a^2≤2*b^2+2*c^2 := by + have hn : 0≤b+c := (abs_nonneg a).trans h + have hh := (sq_le_sq₀ (abs_nonneg a) hn).mpr h + rw [sq_abs] at hh + nlinarith only [hh,sq_nonneg (b-c)] + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nontrivial ι] + +lemma closeAmplitude_sum_sq (L : Length) {s : ℝ} (hs : 0 + intro hu x hx + simp only [SimpleGraph.Walk.support_nil, List.mem_singleton] at hx + subst x + exact hu + | @cons u v z huv p ih => + intro hu x hx + simp only [SimpleGraph.Walk.support_cons, List.mem_cons] at hx + rcases hx with rfl | hx + · exact hu + · exact ih huv.2.1 x hx + refine ⟨q.toPath.val.map f, SimpleGraph.Walk.IsPath.map (fun _ _ h ↦ h) q.toPath.isPath, ?_⟩ + intro x hx + rw [SimpleGraph.Walk.support_map] at hx + obtain ⟨y,hy,he⟩ := List.mem_map.mp hx + change y = x at he + subst x + exact hs q.toPath.val hv y hy + +lemma withinReach_star_first_entry {D A : Set Vertex} {x y : Vertex} + (h : withinReach starStep D x y) (hxD : x ∈ D) (hx : x ∉ A) (hy : y ∈ A) : + ∃ u v, withinReach starStep (D ∩ Aᶜ) x u ∧ u ∈ D ∧ u ∉ A ∧ + v ∈ D ∧ v ∈ A ∧ starStep u v := by + induction h using Relation.ReflTransGen.head_induction_on with + | refl => exact (hx hy).elim + | @head z w hzw _ ih => + by_cases hw : w ∈ A + · exact ⟨z,w,.refl,hxD,hx,hzw.2.1,hw,hzw.2.2⟩ + · obtain ⟨u,v,hu,huD,huA,hvD,hvA,huv⟩ := ih hzw.2.1 hw + exact ⟨u,v,hu.head ⟨⟨hxD,hx⟩,⟨hzw.2.1,hw⟩,hzw.2.2⟩,huD,huA,hvD,hvA,huv⟩ + +theorem star_first_exit {D : Set Vertex} {z w : Vertex} {h d : ℝ} + (hh : 0 < h) (hd : 0 < d) (hz : z ∈ D) + (hp : withinReach starStep D z w) (hw : ∃ i, d ≤ h * |(w i : ℝ) - z i|) : + ∃ v, ∃ p : starGraph.Walk z v, + (∀ x ∈ p.support, x ∈ D ∧ ∀ i, h * |(x i : ℝ) - z i| ≤ d + h) ∧ + (∃ i, d ≤ h * |(v i : ℝ) - z i|) := by + let A : Set Vertex := {x | ∃ i, d ≤ h * |(x i : ℝ) - z i|} + have hzA : z ∉ A := by simpa [A] using hd + obtain ⟨u,v,hu,_,huA,hvD,hvA,huv⟩ := withinReach_star_first_entry hp hz hzA hw + obtain ⟨p,_,hpD⟩ := withinReach_star_path (D := D ∩ Aᶜ) ⟨hz,hzA⟩ hu + let q : starGraph.Walk z v := p.concat huv + refine ⟨v,q,?_,hvA⟩ + intro x hx + have hlocal (x : Vertex) (hx : x ∉ A) (i : Fin 3) : + h * |(x i : ℝ) - z i| < d := by + exact lt_of_not_ge (fun hi ↦ hx ⟨i,hi⟩) + change x ∈ (p.concat (show starGraph.Adj u v from huv)).support at hx + rw [SimpleGraph.Walk.support_concat] at hx + simp only [List.mem_append, List.mem_singleton] at hx + rcases hx with hx | he + · exact ⟨(hpD x hx).1, fun i ↦ (hlocal x (hpD x hx).2 i).le.trans (by linarith)⟩ + · subst x + refine ⟨hvD,fun i ↦ ?_⟩ + have hedge : |(v i : ℝ) - u i| ≤ 1 := by + exact_mod_cast (starStep_symm huv).2 i + calc + h * |(v i : ℝ) - z i| ≤ h * (|(v i : ℝ) - u i| + |(u i : ℝ) - z i|) := + mul_le_mul_of_nonneg_left (abs_sub_le _ _ _) hh.le + _ ≤ h * (1 + |(u i : ℝ) - z i|) := mul_le_mul_of_nonneg_left (add_le_add hedge le_rfl) hh.le + _ ≤ d + h := by nlinarith [hlocal u huA i] + +lemma star_path_span {z v : Vertex} (p : starGraph.Walk z v) (i : Fin 3) : + |z i - v i| ≤ p.support.toFinset.card - 1 := by + classical + let S : Set Vertex := {x | x ∈ p.support} + have hfin : S.Finite := p.support.finite_toSet + let : Fintype S := hfin.fintype + have hs : Fintype.card S = p.support.toFinset.card := by + rw [Set.fintypeCard_eq_ncard] + change {x | x ∈ p.support}.ncard = p.support.toFinset.card + simpa only [List.coe_toFinset] using Set.ncard_coe_finset p.support.toFinset + have hspan := connected_coordinate_span (starGraph.induce S) + p.connected_induce_support.preconnected (fun x ↦ x.val) 1 + (fun x y hxy j ↦ hxy.2 j) ⟨z,p.start_mem_support⟩ ⟨v,p.end_mem_support⟩ i + simpa only [Nat.cast_one, one_mul, hs] using hspan + +end HardSphere.Lattice + +namespace HardSphere.BathSlice +open HardSphere.Lattice + +lemma local_projection_injective {J : ℕ} {h d : ℝ} (hh : 0 < h) + (hwide : 2*d < h*J) (z : Vertex) : + Set.InjOn (torusProjection J) {x | ∀ i, h * |(x i : ℝ) - z i| ≤ d} := by + intro x hx y hy he + ext i + apply sub_eq_zero.mp + apply small_multiple_zero + · simp only [Int.cast_sub] + exact sub_eq_zero.mpr (congrFun he i) + · have hab : h * |(x i : ℝ) - y i| < h*J := by + calc + _ ≤ h * (|(x i : ℝ) - z i| + |(y i : ℝ) - z i|) := by + apply mul_le_mul_of_nonneg_left _ hh.le + simpa only [abs_sub_comm (z i : ℝ) (y i : ℝ)] using abs_sub_le (x i : ℝ) (z i : ℝ) (y i : ℝ) + _ ≤ 2*d := by nlinarith [hx i, hy i] + _ < _ := hwide + have hc : |(x i : ℝ) - y i| < (J : ℝ) := (mul_lt_mul_iff_right₀ hh).mp hab + exact_mod_cast hc + +lemma card_witness_sites_le {n : ℕ} {L : Length} {J : ℕ} {h r : ℝ} + (hh : 0 < h) (hperiod : L.val = h * J) (hr : r ≤ 2*h) + (Y : Configuration n L) (S : Finset Vertex) + (hinj : Set.InjOn (torusProjection J) (↑S)) (j : Fin n) + (hw : ∀ z ∈ S, ∃ x ∈ microCube L h z, torusDistance L x (Y j) ≤ r) : + S.card ≤ 343 := by + have hJ : J ≠ 0 := by + intro he + have hp := L.property + simp only [he, Nat.cast_zero, mul_zero] at hperiod + linarith + let : NeZero J := ⟨hJ⟩ + calc + S.card = (torusProjection J '' (↑S : Set Vertex)).ncard := by + rw [hinj.ncard_image, Set.ncard_coe_finset] + _ ≤ (torusProjection J '' {z | ∃ x ∈ microCube L h z, + torusDistance L x (Y j) ≤ r}).ncard := + Set.ncard_le_ncard (Set.image_mono hw) (Set.toFinite _) + _ ≤ 343 := ncard_ball_bad_sites_le hh hperiod hr (Y j) + +end HardSphere.BathSlice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/StarOffsets.lean b/lean/OAI/Analysis/HardSphere/Geometry/StarOffsets.lean new file mode 100644 index 0000000000000000000000000000000000000000..6218dd31c36510c56ebecc0cab574d7ba560a148 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/StarOffsets.lean @@ -0,0 +1,424 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.Vertex + +namespace OAI + +section +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +noncomputable section +open scoped BigOperators Classical +namespace HardSphere.Lattice +variable {A : Type*} [AddCommGroup A] + +lemma lower_ray_exterior (C : Finset Vertex) (x : Vertex) (i : Fin 3) + (hx : ∀ c∈C, x i omega + +lemma exteriorShell_subset_offsets (C : Finset Vertex) : + exteriorShell C ⊆ ↑(C.biUnion fun c ↦ starOffsets.image (fun d ↦ c+d)) := by + rintro x ⟨_, c,hc,hcx⟩ + exact Finset.mem_biUnion.mpr ⟨c,hc,starStep_mem_offsets c x hcx⟩ + +lemma exteriorShell_finite (C : Finset Vertex) : (exteriorShell C).Finite := + (C.biUnion fun c ↦ starOffsets.image (fun d ↦ c+d)).finite_toSet.subset + (exteriorShell_subset_offsets C) + +theorem exteriorShell_card_le (C : Finset Vertex) : + (exteriorShell C).ncard ≤ 26*C.card := by + calc + (exteriorShell C).ncard ≤ + (C.biUnion fun c ↦ starOffsets.image (fun d ↦ c+d)).card := by + simpa only [Set.ncard_coe_finset] using + Set.ncard_le_ncard (exteriorShell_subset_offsets C) + _ ≤ ∑ c∈C, (starOffsets.image (fun d ↦ c+d)).card := Finset.card_biUnion_le + _ ≤ ∑ _c∈C, 26 := by + apply Finset.sum_le_sum + intro c _ + exact (Finset.card_image_le).trans (le_of_eq starOffsets_card) + _ = 26*C.card := by simp [Nat.mul_comm] + +lemma withinReach_symm {D : Set Vertex} {e : Vertex → Vertex → Prop} + (he : ∀ x y, e x y → e y x) {x y : Vertex} (h : withinReach e D x y) : + withinReach e D y x := by + induction h using Relation.ReflTransGen.trans_induction_on with + | refl => exact .refl + | single h => exact .single ⟨h.2.1,h.1,he _ _ h.2.2⟩ + | trans _ _ ih₁ ih₂ => exact ih₂.trans ih₁ + +lemma withinReach_mono {D E : Set Vertex} {e : Vertex → Vertex → Prop} + (hDE : D⊆E) {x y : Vertex} (h : withinReach e D x y) : + withinReach e E x y := by + induction h using Relation.ReflTransGen.trans_induction_on with + | refl => exact .refl + | single h => exact .single ⟨hDE h.1,hDE h.2.1,h.2.2⟩ + | trans _ _ ih₁ ih₂ => exact ih₁.trans ih₂ + +lemma nearestStep_update (x : Vertex) (i : Fin 3) (k : ℤ) : + nearestStep (Function.update x i k) (Function.update x i (k+1)) := by + refine ⟨i,?_,?_⟩ + · simp + · intro j hj + simp [hj] + +lemma withinReach_axis_le {D : Set Vertex} (x : Vertex) (i : Fin 3) + (a b : ℤ) (hab : a≤b) + (hD : ∀ k, a≤k → k≤b → Function.update x i k∈D) : + withinReach nearestStep D (Function.update x i a) (Function.update x i b) := by + have hpath : ∀ n : ℕ, (n:ℤ)≤b-a → + withinReach nearestStep D (Function.update x i a) (Function.update x i (a+(n:ℤ))) := by + intro n + induction n with + | zero => intro _; simp only [Nat.cast_zero,add_zero]; exact .refl + | succ n ih => + intro hn + have hn' : (n:ℤ)≤b-a := by omega + have hprev := ih hn' + have hu := hD (a+(n:ℤ)) (by omega) (by omega) + have hv := hD (a+((n+1:ℕ):ℤ)) (by omega) (by omega) + apply hprev.tail + refine ⟨hu,hv,?_⟩ + convert nearestStep_update x i (a+(n:ℤ)) using 1; push_cast; abel_nf + have hc : a+((b-a).toNat:ℤ)=b := by omega + simpa only [hc] using hpath (b-a).toNat (by omega) + +lemma withinReach_axis {D : Set Vertex} (x : Vertex) (i : Fin 3) + (a b : ℤ) + (hD : ∀ k, min a b≤k → k≤ max a b → Function.update x i k∈D) : + withinReach nearestStep D (Function.update x i a) (Function.update x i b) := by + rcases le_total a b with hab|hba + · apply withinReach_axis_le x i a b hab + simpa only [min_eq_left hab,max_eq_right hab] using hD + · apply withinReach_symm (fun _ _ ↦ nearestStep_symm) + apply withinReach_axis_le x i b a hba + simpa only [min_eq_right hba,max_eq_left hba] using hD + +def intervalBox (x y : Vertex) : Set Vertex := + {z | ∀ i, min (x i) (y i)≤z i ∧ z i≤ max (x i) (y i)} + +def mixVertex (x y : Vertex) (n : ℕ) : Vertex := fun i ↦ if i.val simp [mixVertex,hi] +lemma mixVertex_succ (x y : Vertex) (n : ℕ) (hn : n<3) : + mixVertex x y (n+1)=Function.update (mixVertex x y n) ⟨n,hn⟩ (y ⟨n,hn⟩) := by + ext i + by_cases hi : i=⟨n,hn⟩ + · subst i; simp [mixVertex] + · have hin : i.val≠n := fun h ↦ hi (Fin.ext h) + have hlt : (i.val intro _; rw [mixVertex_zero]; exact .refl + | succ n ih => + intro hn + have hn' : n<3 := by omega + let i : Fin 3 := ⟨n,hn'⟩ + have hprev := ih (by omega) + rw [mixVertex_succ x y n hn'] + apply hprev.trans + have hold : mixVertex x y n i=x i := by simp [mixVertex,i] + have haxis := withinReach_axis (D := intervalBox x y) (mixVertex x y n) i (x i) (y i) ?_ + · simpa only [withinReach,← hold,Function.update_eq_self,i] using haxis + · intro k hk₁ hk₂ j + by_cases hj : j=i + · subst j + simpa using And.intro hk₁ hk₂ + · rw [Function.update_of_ne hj] + exact mixVertex_box x y n j + simpa only [mixVertex_three] using hpath 3 (by omega) + +lemma box_reach {D : Set Vertex} (x y : Vertex) (hD : intervalBox x y⊆D) : + withinReach nearestStep D x y := withinReach_mono hD (intervalBox_reach x y) + +lemma withinReach_end {D : Set Vertex} {e : Vertex → Vertex → Prop} {x y : Vertex} + (hx : x∈D) (h : withinReach e D x y) : y∈D := by + rcases h.cases_tail with he|⟨z,_,hzy⟩ + · exact he ▸ hx + · exact hzy.2.1 + +lemma withinReach_invariant {D E : Set Vertex} {e : Vertex → Vertex → Prop} + (hclosed : ∀ u∈E, ∀ v∈D, e u v → v∈E) + {x y : Vertex} (hx : x∈E) (h : withinReach e D x y) : withinReach e E x y := by + induction h using Relation.ReflTransGen.head_induction_on with + | refl => exact .refl + | head h' _ ih => + have hv := hclosed _ hx _ h'.2.1 h'.2.2 + exact (ih hv).head ⟨hx,hv,h'.2.2⟩ + +lemma avoidingReach_symm (C : Finset Vertex) {x y : Vertex} + (h : avoidingReach C x y) : avoidingReach C y x := + withinReach_symm (D := (↑C)ᶜ) (fun _ _ ↦ nearestStep_symm) h + +lemma exterior_of_reach (C : Finset Vertex) {x y : Vertex} + (hx : x∈exterior C) (hxy : avoidingReach C x y) : y∈exterior C := by + have hy : y∉C := withinReach_end (D := (↑C)ᶜ) hx.1 hxy + refine ⟨hy,hx.2.mono ?_⟩ + intro z hz + exact (avoidingReach_symm C hxy).trans hz + +def integerBox (M : ℤ) : Finset Vertex := + Fintype.piFinset fun _ : Fin 3 ↦ Finset.Icc (-M) M + +lemma mem_integerBox (M : ℤ) (x : Vertex) : x∈integerBox M ↔ ∀ i, |x i|≤M := by + simp only [integerBox,Fintype.mem_piFinset,Finset.mem_Icc,abs_le] + +lemma finite_coordinate_bound (C : Finset Vertex) : + ∃ M : ℤ, 0≤M ∧ ∀ c∈C, ∀ i, |c i|≤M := by + let s : Finset ℤ := C.biUnion (fun c ↦ Finset.univ.image (fun i : Fin 3 ↦ |c i|)) + obtain ⟨M,hM⟩ := s.finite_toSet.exists_le + refine ⟨max M 0,le_max_right _ _,?_⟩ + intro c hc i + apply (hM _ ?_).trans (le_max_left M 0) + exact Finset.mem_biUnion.mpr ⟨c,hc,Finset.mem_image.mpr ⟨i,Finset.mem_univ i,rfl⟩⟩ + +lemma outside_box_reach (C : Finset Vertex) (M : ℤ) (hM : 0≤M) + (hC : ∀ c∈C, ∀ i, |c i|≤M) (x : Vertex) (hx : x∉integerBox M) : + avoidingReach C x (fun _ ↦ M+1) := by + have hex : ∃ i, M < |x i| := by + by_contra hn + push Not at hn + exact hx ((mem_integerBox M x).mpr hn) + obtain ⟨i,hi⟩ := hex + let r : Vertex := fun _ ↦ M+1 + let z : Vertex := Function.update r i (x i) + have hxz : withinReach nearestStep ((↑C : Set Vertex)ᶜ) x z := by + apply box_reach + intro u hu huc + have hui := hu i + have hzi : z i=x i := by simp [z] + rw [hzi,min_self,max_self] at hui + have hueq : u i=x i := le_antisymm hui.2 hui.1 + have hbound := hC u huc i + rw [hueq] at hbound + omega + have hzr : withinReach nearestStep ((↑C : Set Vertex)ᶜ) z r := by + obtain ⟨j,hj⟩ : ∃ j : Fin 3, j≠i := exists_ne i + apply box_reach + intro u hu huc + have huj := hu j + have hzj : z j=M+1 := by simp [z,r,Function.update_of_ne hj] + change min (z j) (M+1)≤u j ∧ u j≤ max (z j) (M+1) at huj + rw [hzj,min_self,max_self] at huj + have hueq : u j=M+1 := le_antisymm huj.2 huj.1 + have hbound := hC u huc j + rw [hueq,abs_of_nonneg (by omega : 0≤M+1)] at hbound + omega + exact hxz.trans hzr + +lemma exterior_reach_anchor (C : Finset Vertex) (M : ℤ) (hM : 0≤M) + (hC : ∀ c∈C, ∀ i, |c i|≤M) {x : Vertex} (hx : x∈exterior C) : + avoidingReach C x (fun _ ↦ M+1) := by + obtain ⟨y,hxy,hy⟩ := hx.2.exists_notMem_finset (integerBox M) + exact hxy.trans (outside_box_reach C M hM hC y hy) + +theorem exterior_avoidingReach (C : Finset Vertex) {x y : Vertex} + (hx : x∈exterior C) (hy : y∈exterior C) : avoidingReach C x y := by + obtain ⟨M,hM,hC⟩ := finite_coordinate_bound C + exact (exterior_reach_anchor C M hM hC hx).trans + (avoidingReach_symm C (exterior_reach_anchor C M hM hC hy)) + +theorem exterior_NNConnected (C : Finset Vertex) : NNConnected (exterior C) := by + intro x hx y hy + apply withinReach_invariant (D := (↑C)ᶜ) _ hx (exterior_avoidingReach C hx hy) + intro u hu v hv huv + exact exterior_of_reach C hu (.single ⟨hu.1,hv,huv⟩) + +def doubleVertex (x : Vertex) : Vertex := fun i ↦ 2*x i + +def thickCube (c : Vertex) : Set Vertex := {z | ∀ i, |z i-2*c i|≤1} + +def thicken (C : Finset Vertex) : Finset Vertex := + C.biUnion fun c ↦ Fintype.piFinset fun i : Fin 3 ↦ Finset.Icc (2*c i-1) (2*c i+1) + +lemma mem_thicken (C : Finset Vertex) (z : Vertex) : + z∈thicken C ↔ ∃ c∈C, z∈thickCube c := by + simp only [thicken,Finset.mem_biUnion,Fintype.mem_piFinset,Finset.mem_Icc] + constructor + · rintro ⟨c,hc,hz⟩ + refine ⟨c,hc,fun i ↦ abs_le.mpr ?_⟩ + have h := hz i + constructor <;> omega + · rintro ⟨c,hc,hz⟩ + refine ⟨c,hc,fun i ↦ ?_⟩ + have h := abs_le.mp (hz i) + constructor <;> omega + +lemma double_mem_cube (c : Vertex) : doubleVertex c∈thickCube c := by + intro i; simp [doubleVertex] + +lemma thickCube_subset (C : Finset Vertex) {c : Vertex} (hc : c∈C) : + thickCube c⊆(↑(thicken C) : Set Vertex) := fun z hz ↦ (mem_thicken C z).mpr ⟨c,hc,hz⟩ + +lemma thickCube_NNConnected (c : Vertex) : NNConnected (thickCube c) := by + intro x hx y hy + apply box_reach + intro z hz i + have hx' := abs_le.mp (hx i) + have hy' := abs_le.mp (hy i) + have hz' := hz i + apply abs_le.mpr + constructor <;> omega + +lemma thicken_adjacent_centers (C : Finset Vertex) {c d : Vertex} + (hc : c∈C) (hd : d∈C) (hcd : starStep c d) : + withinReach nearestStep (↑(thicken C)) (doubleVertex c) (doubleVertex d) := by + let m : Vertex := c+d + have hmC : m∈thickCube c := by + intro i + change |c i+d i-2*c i|≤1 + rw [show c i+d i-2*c i=d i-c i by ring,abs_sub_comm] + exact hcd.2 i + have hmD : m∈thickCube d := by + intro i + change |c i+d i-2*d i|≤1 + rw [show c i+d i-2*d i=c i-d i by ring] + exact hcd.2 i + exact (withinReach_mono (thickCube_subset C hc) + (thickCube_NNConnected c _ (double_mem_cube c) m hmC)).trans + (withinReach_mono (thickCube_subset C hd) + (thickCube_NNConnected d m hmD _ (double_mem_cube d))) + +lemma thicken_star_reach (C : Finset Vertex) {c d : Vertex} + (h : withinReach starStep (↑C) c d) : + withinReach nearestStep (↑(thicken C)) (doubleVertex c) (doubleVertex d) := by + induction h using Relation.ReflTransGen.trans_induction_on with + | refl => exact .refl + | single h => exact thicken_adjacent_centers C h.1 h.2.1 h.2.2 + | trans _ _ ih₁ ih₂ => exact ih₁.trans ih₂ + +lemma thicken_NNConnected (C : Finset Vertex) (hC : starConnected (↑C)) : + NNConnected (↑(thicken C)) := by + intro x hx y hy + obtain ⟨c,hc,hcx⟩ := (mem_thicken C x).mp hx + obtain ⟨d,hd,hdy⟩ := (mem_thicken C y).mp hy + exact (withinReach_mono (thickCube_subset C hc) + (thickCube_NNConnected c x hcx _ (double_mem_cube c))).trans + ((thicken_star_reach C (hC c hc d hd)).trans + (withinReach_mono (thickCube_subset C hd) + (thickCube_NNConnected d _ (double_mem_cube d) y hdy))) + +def complementComponent (A : Set Vertex) (r : Vertex) : Set Vertex := + {x | x∉A ∧ withinReach nearestStep Aᶜ r x} + +lemma complementComponent_spec (A : Set Vertex) (r : Vertex) : + NNComplementComponent A (complementComponent A r) := by + have hclosed : ∀ x∈complementComponent A r, ∀ y, y∉A → nearestStep x y → + y∈complementComponent A r := by + intro x hx y hy hxy + exact ⟨hy,hx.2.tail ⟨hx.1,hy,hxy⟩⟩ + refine ⟨Set.disjoint_left.mpr (fun _ ha hb ↦ hb.1 ha),?_,hclosed⟩ + intro x hx y hy + apply withinReach_invariant (D := Aᶜ) (fun u hu v hv huv ↦ hclosed u hu v hv huv) hx + exact (withinReach_symm (fun _ _ ↦ nearestStep_symm) hx.2).trans hy.2 + +lemma double_mem_thicken_iff (C : Finset Vertex) (x : Vertex) : + doubleVertex x∈thicken C ↔ x∈C := by + constructor + · intro hx + obtain ⟨c,hc,hcx⟩ := (mem_thicken C _).mp hx + have he : x=c := by + ext i + have h := abs_le.mp (hcx i) + dsimp [doubleVertex] at h + omega + exact he ▸ hc + · intro hx + exact (mem_thicken C _).mpr ⟨x,hx,double_mem_cube x⟩ + +lemma double_step (x : Vertex) (i : Fin 3) : + doubleVertex (step x i)=step (step (doubleVertex x) i) i := by + ext j + by_cases hj : j=i + · subst j + simp only [doubleVertex,step_apply_same] + ring + · simp [doubleVertex,step,hj] + +lemma splitPoint_not_thicken (C : Finset Vertex) (x : Vertex) (i : Fin 3) + (hx : x∉C) (hy : step x i∉C) : step (doubleVertex x) i∉thicken C := by + intro hm + obtain ⟨c,hc,hcm⟩ := (mem_thicken C _).mp hm + have hrest : ∀ j, j≠i → c j=x j := by + intro j hj + have h := abs_le.mp (hcm j) + rw [step_apply_ne _ hj] at h + dsimp [doubleVertex] at h + omega + have hi := abs_le.mp (hcm i) + rw [step_apply_same] at hi + dsimp [doubleVertex] at hi + have hci : c i=x i ∨ c i=x i+1 := by omega + rcases hci with hci|hci + · have he : c=x := by + ext j + by_cases hj : j=i + · subst j; exact hci + · exact hrest j hj + exact hx (he ▸ hc) + · have he : c=step x i := by + ext j + by_cases hj : j=i + · subst j; rw [step_apply_same]; exact hci + · rw [step_apply_ne _ hj]; exact hrest j hj + exact hy (he ▸ hc) + +end HardSphere.Lattice +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/SubcubeBase.lean b/lean/OAI/Analysis/HardSphere/Geometry/SubcubeBase.lean new file mode 100644 index 0000000000000000000000000000000000000000..d492f7c468f4654bba3188f71070947b8701ab3f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/SubcubeBase.lean @@ -0,0 +1,185 @@ +import Mathlib +import OAI.Analysis.HardSphere.Comparison.ActiveLabels + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere.SphericalCoordinates +open scoped BigOperators + +lemma interval_subdivision (b : ℝ) {h : ℝ} (hh : 0≤h) (j : ℕ) : + (volume : Measure ℝ).restrict (Icc b (b+j*h))= + Measure.sum (fun i : Fin j ↦ volume.restrict (Icc (b+(i:ℝ)*h) (b+((i:ℝ)+1)*h))) := by + simp_rw [← restrict_Ioc_eq_restrict_Icc,Measure.sum_fintype] + induction j with + | zero => simp + | succ j ih => + rw [Fin.sum_univ_castSucc] + simp only [Fin.val_castSucc,Fin.val_last,Nat.cast_add,Nat.cast_one] + rw [← ih] + rw [← Measure.restrict_union (Set.Ioc_disjoint_Ioc_of_le (le_refl _)) measurableSet_Ioc, + Set.Ioc_union_Ioc_eq_Ioc (le_add_of_nonneg_right (mul_nonneg (Nat.cast_nonneg j) hh)) (by nlinarith : b+(j:ℝ)*h≤b+((j:ℝ)+1)*h)] + +def subcubeBase {j : ℕ} (b : Point) (h : ℝ) (v : Fin j × Fin j × Fin j) : Point := + (b.1+(v.1:ℝ)*h,(b.2.1+(v.2.1:ℝ)*h,b.2.2+(v.2.2:ℝ)*h)) + +lemma cube_volume (b : Point) (h : ℝ) : + volume.restrict (cube b h)= + ((volume : Measure ℝ).restrict (Icc b.1 (b.1+h))).prod + (((volume : Measure ℝ).restrict (Icc b.2.1 (b.2.1+h))).prod + ((volume : Measure ℝ).restrict (Icc b.2.2 (b.2.2+h)))) := by + rw [Measure.prod_restrict,Measure.prod_restrict,← Measure.volume_eq_prod,← Measure.volume_eq_prod] + congr 1 + ext x + rcases b with ⟨b1,b2,b3⟩ + rcases x with ⟨x1,x2,x3⟩ + simp only [cube,Set.mem_Icc,Set.mem_prod,Prod.mk_le_mk,Prod.mk_add_mk] + tauto + +lemma cube_subdivision (b : Point) {h : ℝ} (hh : 0≤h) (j : ℕ) : + volume.restrict (cube b (j*h))= + Measure.sum (fun v : Fin j × Fin j × Fin j ↦ volume.restrict (cube (subcubeBase b h v) h)) := by + rw [cube_volume] + simp_rw [interval_subdivision _ hh j] + rw [Measure.prod_sum,Measure.prod_sum] + congr 1 + funext v + rw [cube_volume] + simp only [subcubeBase,add_mul,one_mul,add_assoc] + +lemma pi_sum_sectors {α ι β : Type*} [Fintype α] [Fintype ι] [MeasurableSpace β] + (ν : ι → Measure β) [∀v,IsFiniteMeasure (ν v)] : + Measure.pi (fun _ : α ↦ Measure.sum ν)= + Measure.sum (fun σ : α → ι ↦ Measure.pi (fun i ↦ ν (σ i))) := by + classical + apply Measure.pi_eq + intro s hs + rw [Measure.sum_apply _ (MeasurableSet.pi Set.countable_univ (fun i _ ↦ hs i))] + simp_rw [Measure.pi_pi,Measure.sum_apply _ (hs _),tsum_fintype] + exact (Fintype.prod_sum (fun i v ↦ ν v (s i))).symm + +lemma cube_configuration_subdivision {n j : ℕ} (b : Point) {h : ℝ} (hh : 0≤h) : + Measure.pi (fun _ : Fin n ↦ volume.restrict (cube b (j*h)))= + Measure.sum (fun σ : Fin n → Fin j × Fin j × Fin j ↦ + Measure.pi (fun i ↦ volume.restrict (cube (subcubeBase b h (σ i)) h))) := by + rw [cube_subdivision b hh j] + have : ∀v : Fin j × Fin j × Fin j,IsFiniteMeasure (volume.restrict (cube (subcubeBase b h v) h)) := + fun v ↦ by rw [cube_volume]; infer_instance + exact pi_sum_sectors _ + +lemma subdivision_index {n : ℕ} (hn : 2≤n) : + ∃j : ℕ, 1≤j ∧ 2*j^3≤n ∧ n≤16*j^3 := by + have hex : ∃k : ℕ, n<2*k^3 := by + refine ⟨n+1,?_⟩ + nlinarith [sq_nonneg (n:ℤ)] + let k := Nat.find hex + have hk : n<2*k^3 := Nat.find_spec hex + have hk0 : k≠0 := by intro he; simp [he] at hk + obtain ⟨j,hj⟩ := Nat.exists_eq_succ_of_ne_zero hk0 + have hmin : 2*j^3≤n := by + have ht : j simp + +end HardSphere.SphericalCoordinates + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/SubsetPointLinear.lean b/lean/OAI/Analysis/HardSphere/Geometry/SubsetPointLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..11e2a233f7aa21c1bc30eeb878052c6e819a1348 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/SubsetPointLinear.lean @@ -0,0 +1,168 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.SpatialPartitionEnergy + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +namespace HardSphere.SphericalCoordinates +open scoped BigOperators + +noncomputable def subsetPointLinear {I : Type*} [Fintype I] (p : I → Prop) [DecidablePred p] : + ({i // p i} → Point) →L[ℝ] (I → Point) := + ContinuousLinearMap.pi (fun i ↦ if hi : p i then ContinuousLinearMap.proj ⟨i,hi⟩ else 0) + +def subsetPointFill {I : Type*} (p : I → Prop) [DecidablePred p] + (Y : {i // ¬p i} → Point) (X : {i // p i} → Point) (i : I) : Point := + if hi : p i then X ⟨i,hi⟩ else Y ⟨i,hi⟩ + +lemma subsetPointFill_affine {I : Type*} [Fintype I] (p : I → Prop) [DecidablePred p] + (Y : {i // ¬p i} → Point) (X : {i // p i} → Point) : + subsetPointFill p Y X=subsetPointLinear p X+subsetPointFill p Y 0 := by + funext i + by_cases hi : p i <;> simp [subsetPointFill,subsetPointLinear,hi] + +lemma subsetPointLinear_single {I : Type*} [Fintype I] [DecidableEq I] + (p : I → Prop) [DecidablePred p] (i : {i // p i}) (v : Point) : + subsetPointLinear p (Pi.single i v)=Pi.single i.val v := by + funext j + by_cases hj : p j + · by_cases he : j=i.val + · subst j + simp [subsetPointLinear,hj] + · have hn : (⟨j,hj⟩ : Subtype p)≠i := fun h ↦ he (congrArg Subtype.val h) + simp [subsetPointLinear,hj,he,hn] + · have he : j≠i.val := by rintro rfl; exact hj i.property + simp [subsetPointLinear,hj,he] + +lemma contDiff_subsetPointFill {I : Type*} [Fintype I] + (p : I → Prop) [DecidablePred p] (Y : {i // ¬p i} → Point) : + ContDiff ℝ 1 (subsetPointFill p Y) := by + have he : subsetPointFill p Y=fun X ↦ subsetPointLinear p X+subsetPointFill p Y 0 := + funext (subsetPointFill_affine p Y) + rw [he] + exact (subsetPointLinear p).contDiff.add contDiff_const + +lemma indexGradSq_subset {I : Type*} [Fintype I] [DecidableEq I] + {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {F : (I → Point) → E} (hF : ContDiff ℝ 1 F) + (p : I → Prop) [DecidablePred p] (Y : {i // ¬p i} → Point) + (X : {i // p i} → Point) (i : {i // p i}) : + indexGradSq (F ∘ subsetPointFill p Y) i X=indexGradSq F i.val (subsetPointFill p Y X) := by + have hd : HasFDerivAt (subsetPointFill p Y) (subsetPointLinear p) X := by + have he : subsetPointFill p Y=fun X ↦ subsetPointLinear p X+subsetPointFill p Y 0 := + funext (subsetPointFill_affine p Y) + rw [he] + exact (subsetPointLinear p).hasFDerivAt.add_const _ + have hf := ((hF.differentiable (by norm_num) (subsetPointFill p Y X)).hasFDerivAt).comp X hd + simp only [indexGradSq,hf.fderiv,ContinuousLinearMap.comp_apply,subsetPointLinear_single] + +lemma lintegral_subsetPointFill {I : Type*} [Fintype I] + (μ : I → Measure Point) [∀i,SigmaFinite (μ i)] + (p : I → Prop) [DecidablePred p] (H : (I → Point) → ℝ≥0∞) (hH : Measurable H) : + (∫⁻ X,H X ∂Measure.pi μ)= + ∫⁻ Y, ∫⁻ X, H (subsetPointFill p Y X) + ∂Measure.pi (fun i : {i // p i} ↦ μ i.val) + ∂Measure.pi (fun i : {i // ¬p i} ↦ μ i.val) := by + let e := MeasurableEquiv.piEquivPiSubtypeProd (fun _ : I ↦ Point) p + have he := (measurePreserving_piEquivPiSubtypeProd μ p).symm + rw [← he.lintegral_comp_emb e.symm.measurableEmbedding H] + apply lintegral_prod_symm + exact (hH.comp e.symm.measurable).aemeasurable + +lemma subset_cube_energy {I : Type*} [Fintype I] [DecidableEq I] + {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + {F : (I → Point) → E} (hF : ContDiff ℝ 1 F) + (p : I → Prop) [DecidablePred p] {r l : ℝ} (hr : 0.integrable_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _))] + apply integral_mono + · exact ((SmoothTest.rms F hε).continuous_partial p).norm.pow 2 |>.integrable_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) + · exact (continuous_finsetSum _ (fun i _ ↦ ((F i).continuous_partial p).norm.pow 2)).integrable_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) + · intro X + exact rmsTest_derivative_le F hε X p + +lemma rmsTest_norm_limit (F : I → SmoothTest N L a) {e : ℕ → ℝ} + (he : ∀ k,0 exact torusNear_refl _ _ _ + | @cons u v w he p ih => + simpa only [SimpleGraph.Walk.length_cons, Nat.mul_add, Nat.mul_one, Nat.add_comm] using + torusNear_add (show torusNear K a u.val v.val from he.2) ih + have hlen : p.val.length rfl + have hs := CompactParameterIntegral.contDiff_integral (μ := (volume : Measure (Fin 3 → ℝ))) + (f.smooth.comp c.contDiff) (isCompact_torusLiftBox L) + convert hs using 1 + funext Y + simp only [Function.comp_def,hc] + exact (integral_torusLiftBox _ ((continuous_of_continuous_lift f.smooth.continuous).comp + ((continuous_id : Continuous (id : Torus L → Torus L)).finCons + (continuous_const : Continuous (fun _ : Torus L ↦ project n L Y))))).symm + +def SmoothMultiplier.fiberMass {n : ℕ} {L : Length} (f : SmoothMultiplier (n+1) L) + (Y : Configuration n L) : ℝ := ∫ x : Torus L, ‖f.toFun (Fin.cons x Y)‖^2 + +lemma SmoothMultiplier.smooth_fiberMass {n : ℕ} {L : Length} (f : SmoothMultiplier (n+1) L) + (hr : ∀ X, conj (f.toFun X)=f.toFun X) : + ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (fun Y : LiftedConfiguration n ↦ f.fiberMass (project n L Y)) := by + have hs := Complex.reCLM.contDiff.comp (f.mul f).smooth_fiberIntegral + convert hs using 1 + funext Y + have he (X) : (f.mul f).toFun X=((‖f.toFun X‖^2:ℝ):ℂ) := by + change f.toFun X*f.toFun X=_ + calc + _ = f.toFun X*conj (f.toFun X) := by rw [hr] + _ = _ := by rw [Complex.mul_conj,Complex.sq_norm] + simp only [Function.comp_def,he,Complex.reCLM_apply,integral_complex_ofReal,Complex.ofReal_re, + SmoothMultiplier.fiberMass] + +end +end HardSphere + +namespace HardSphere +open MeasureTheory Set Filter +open scoped ComplexConjugate +noncomputable section + +def SmoothMultiplier.ofSmooth {n : ℕ} {L : Length} (f : Configuration n L → ℂ) + (hs : ContDiff ℝ ((⊤:ℕ∞):WithTop ℕ∞) (fun X : LiftedConfiguration n ↦ f (project n L X))) : + SmoothMultiplier n L where + toFun := f + smooth := hs + memLp_top := (continuous_of_continuous_lift hs.continuous).memLp_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) + partial_memLp_top := fun p ↦ (continuous_coordDerivative hs p).memLp_of_hasCompactSupport + (HasCompactSupport.of_compactSpace _) + +def SmoothMultiplier.massRoot {n : ℕ} {L : Length} (f : SmoothMultiplier (n+1) L) + (hr : ∀ X, conj (f.toFun X)=f.toFun X) (hp : ∀ Y, 0 + simp only [coordDerivative_tail_zero hs j,mul_zero,zero_add] at hd + rw [show (fun X ↦ g.toFun X*r.toFun (Fin.tail X))=g.toFun*(fun X ↦ r.toFun (Fin.tail X)) from rfl,hd] + simp only [Pi.mul_apply,Fin.tail_cons,norm_mul,mul_pow] + rw [integral_const_mul] + | succ k => + have he := g.insertion_orthogonal hr hn k j Y + have ho : (∫ x : Torus L, + conj (g.toFun (Fin.cons x Y)*coordDerivative n L r.toFun (k,j) Y)* + (r.toFun Y*coordDerivative (n+1) L g.toFun (k.succ,j) (Fin.cons x Y)))=0 := by + calc + _ = (conj (coordDerivative n L r.toFun (k,j) Y)*r.toFun Y)* + ∫ x : Torus L, conj (g.toFun (Fin.cons x Y))* + coordDerivative (n+1) L g.toFun (k.succ,j) (Fin.cons x Y) := by + rw [← integral_const_mul] + apply integral_congr_ae + exact Eventually.of_forall fun x ↦ by simp only [map_mul]; ring + _ = 0 := by rw [he,mul_zero] + have heq := integral_norm_add_sq_orthogonal (hg.mul continuous_const) (continuous_const.mul hdg) ho + simp only [Pi.mul_apply,Function.comp_def] at heq + have hd' := coordDerivative_mul (g := fun X : Configuration (n+1) L ↦ r.toFun (Fin.tail X)) + (g.smooth.differentiable (by simp)) + ((smooth_tail r.smooth).differentiable (by simp)) (k.succ,j) + rw [coordDerivative_tail_succ hs k j] at hd' + rw [show (fun X ↦ g.toFun X*r.toFun (Fin.tail X))=g.toFun*(fun X ↦ r.toFun (Fin.tail X)) from rfl,hd'] + simp only [Pi.mul_apply,Pi.add_apply,Fin.tail_cons] + rw [heq] + simp only [norm_mul,mul_pow] + rw [integral_const_mul] + exact le_add_of_nonneg_left (integral_nonneg fun x ↦ mul_nonneg (sq_nonneg _) (sq_nonneg _)) + +end +end HardSphere + +end +end +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/TorusNear.lean b/lean/OAI/Analysis/HardSphere/Geometry/TorusNear.lean new file mode 100644 index 0000000000000000000000000000000000000000..564bd8df4b51714a1b875f8c278a5518ed1ee367 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/TorusNear.lean @@ -0,0 +1,161 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.AnimalFamily + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators Classical +open scoped BigOperators Classical +open scoped BigOperators Classical ENNReal +namespace HardSphere.Lattice + +def torusNear (K R : ℕ) (x y : DiscreteTorus K) : Prop := + ∃ d : Vertex, (∀ i, |d i|≤R) ∧ ∀ i, y i=x i+(d i : ZMod K) + +lemma torusNear_refl (K R : ℕ) (x : DiscreteTorus K) : torusNear K R x x := by + exact ⟨0,fun i ↦ by simp,fun i ↦ by simp⟩ + +lemma torusNear_symm {K R : ℕ} {x y : DiscreteTorus K} (h : torusNear K R x y) : + torusNear K R y x := by + obtain ⟨d,hd,he⟩ := h + refine ⟨-d,fun i ↦ by simpa using hd i,fun i ↦ ?_⟩ + simp only [Pi.neg_apply,Int.cast_neg,he i] + abel + +lemma torusNear_mono {K R S : ℕ} {x y : DiscreteTorus K} (hRS : R≤S) (h : torusNear K R x y) : + torusNear K S x y := by + obtain ⟨d,hd,he⟩ := h + exact ⟨d,fun i ↦ (hd i).trans (by exact_mod_cast hRS),he⟩ + +lemma torusNear_add {K R S : ℕ} {x y z : DiscreteTorus K} + (hxy : torusNear K R x y) (hyz : torusNear K S y z) : torusNear K (R+S) x z := by + obtain ⟨d,hd,he⟩ := hxy + obtain ⟨e,he',hf⟩ := hyz + refine ⟨d+e,fun i ↦ ?_,fun i ↦ ?_⟩ + · exact (abs_add_le (d i) (e i)).trans (by simpa only [Nat.cast_add] using add_le_add (hd i) (he' i)) + · simp only [Pi.add_apply,Int.cast_add,hf i,he i,add_assoc] + +def torusOffsets (R : ℕ) : Finset Vertex := + Fintype.piFinset fun _ : Fin 3 ↦ Finset.Icc (-(R:ℤ)) R + +lemma torusOffsets_card (R : ℕ) : (torusOffsets R).card=(2*R+1)^3 := by + have hcard : (Finset.Icc (-(R:ℤ)) R).card=2*R+1 := by rw [Int.card_Icc]; omega + simp only [torusOffsets,Fintype.card_piFinset,hcard,Finset.prod_const,Finset.card_univ,Fintype.card_fin] + +lemma torusNear_mem_image {K R : ℕ} (x y : DiscreteTorus K) : + torusNear K R x y ↔ y∈(torusOffsets R).image (fun d ↦ x+torusProjection K d) := by + constructor + · rintro ⟨d,hd,he⟩ + refine Finset.mem_image.mpr ⟨d,?_,?_⟩ + · simpa only [torusOffsets,Fintype.mem_piFinset,Finset.mem_Icc,← abs_le] using hd + · ext i; exact (he i).symm + · intro hy + obtain ⟨d,hd,rfl⟩ := Finset.mem_image.mp hy + refine ⟨d,?_,fun i ↦ rfl⟩ + simpa only [torusOffsets,Fintype.mem_piFinset,Finset.mem_Icc,← abs_le] using hd + +lemma torusNear_ball_card {K : ℕ} [NeZero K] (R : ℕ) (x : DiscreteTorus K) : + (Finset.univ.filter (torusNear K R x)).card≤(2*R+1)^3 := by + have he : Finset.univ.filter (torusNear K R x)=(torusOffsets R).image (fun d ↦ x+torusProjection K d) := by + ext y + simp only [Finset.mem_filter,Finset.mem_univ,true_and,torusNear_mem_image] + rw [he] + exact Finset.card_image_le.trans (torusOffsets_card R).le + +lemma torusRange_degree {K : ℕ} [NeZero K] (a : ℕ) (x : DiscreteTorus K) : + (torusRangeGraph K a).degree x≤(2*a+1)^3 := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply (Finset.card_le_card (t := Finset.univ.filter (torusNear K a x)) ?_).trans (torusNear_ball_card a x) + intro y hy + have hxy : (torusRangeGraph K a).Adj x y := by simpa using hy + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,hxy.2⟩ + +open MeasureTheory +variable {W V : Type*} [MeasurableSpace W] [Fintype V] [DecidableEq V] + +theorem largeBadComponent_measure (G : SimpleGraph V) (Δ : ℕ) + (hΔ : ∀ x, G.degree x≤Δ) (μ : Measure W) (B : W → Finset V) (p : ℝ≥0∞) + (hbad : ∀ A : Finset V, μ {ω | A⊆B ω} ≤ p^A.card) (m : ℕ) (hm : 1 ≤ m) : + μ {ω | LargeBadComponent G (B ω) m} ≤ + (Fintype.card V : ℝ≥0∞) * (((2^Δ:ℕ):ℝ≥0∞)*p)^m := by + classical + have hsub : {ω | LargeBadComponent G (B ω) m} ⊆ + ⋃ A∈animalFamily G m, {ω | A⊆B ω} := by + intro ω hω + obtain ⟨A,hA,hAB⟩ := largeBadComponent_contains_animal G (B ω) m hm hω + exact Set.mem_iUnion₂.mpr ⟨A,hA,hAB⟩ + calc + _ ≤ μ (⋃ A∈animalFamily G m, {ω | A⊆B ω}) := measure_mono hsub + _ ≤ ∑ A∈animalFamily G m, μ {ω | A⊆B ω} := measure_biUnion_finset_le _ _ + _ ≤ ∑ _A∈animalFamily G m, p^m := by + apply Finset.sum_le_sum + intro A hA + simpa only [mem_animalFamily_card G m hA] using hbad A + _ = ((animalFamily G m).card:ℝ≥0∞)*p^m := by simp + _ ≤ ((Fintype.card V*(2^Δ)^m:ℕ):ℝ≥0∞)*p^m := by + apply mul_le_mul' _ le_rfl + exact_mod_cast animalFamily_card_le G Δ hΔ m + _ = _ := by simp only [Nat.cast_mul,Nat.cast_pow,mul_pow]; ring + +def animalCost (G : SimpleGraph V) (B : Finset V) (w : ℕ → ℝ≥0∞) : ℝ≥0∞ := + ∑' m : ℕ, ∑ v : V, ∑ A∈rootedAnimals G v (m+1), if A⊆B then w (m+1) else 0 + +lemma measurable_animalCost (G : SimpleGraph V) (B : W → Finset V) + (hB : Measurable B) (w : ℕ → ℝ≥0∞) : Measurable (fun ω ↦ animalCost G (B ω) w) := by + apply Measurable.tsum + intro m + apply Finset.measurable_sum + intro v _ + apply Finset.measurable_sum + intro A _ + apply Measurable.ite _ measurable_const measurable_const + have hm : MeasurableSet {C : Finset V | A⊆C} := (Set.to_countable _).measurableSet + exact hm.preimage hB + +theorem animalCost_mean_le (G : SimpleGraph V) (Δ : ℕ) + (hΔ : ∀ x, G.degree x≤Δ) (μ : Measure W) (B : W → Finset V) + (hB : Measurable B) (p : ℝ≥0∞) + (hbad : ∀ A : Finset V, μ {ω | A⊆B ω} ≤ p^A.card) (w : ℕ → ℝ≥0∞) : + (∫⁻ ω, animalCost G (B ω) w ∂μ) ≤ + (Fintype.card V:ℝ≥0∞) * ∑' m : ℕ, w (m+1) * (((2^Δ:ℕ):ℝ≥0∞)*p)^(m+1) := by + classical + have hm (A : Finset V) : MeasurableSet {ω | A⊆B ω} := + (Set.to_countable {C : Finset V | A⊆C}).measurableSet.preimage hB + have hi (A : Finset V) (t : ℝ≥0∞) : Measurable (fun ω ↦ if A⊆B ω then t else 0) := + Measurable.ite (hm A) measurable_const measurable_const + unfold animalCost + rw [lintegral_tsum (fun m ↦ (Finset.measurable_sum _ fun v _ ↦ + Finset.measurable_sum _ fun A _ ↦ hi A _).aemeasurable)] + rw [←ENNReal.tsum_mul_left] + apply ENNReal.tsum_le_tsum + intro m + rw [lintegral_finsetSum _ (fun v _ ↦ Finset.measurable_sum _ fun A _ ↦ hi A _)] + calc + _ ≤ ∑ _v : V, (((2^Δ:ℕ):ℝ≥0∞)^(m+1)) * (w (m+1)*p^(m+1)) := by + apply Finset.sum_le_sum + intro v _ + rw [lintegral_finsetSum _ (fun A _ ↦ hi A _)] + calc + _ ≤ ∑ _A∈rootedAnimals G v (m+1), w (m+1)*p^(m+1) := by + apply Finset.sum_le_sum + intro A hA + have hc : A.card=m+1 := (Finset.mem_filter.mp hA).2.2.1 + have heq : (fun ω ↦ if A⊆B ω then w (m+1) else 0) = + {ω | A⊆B ω}.indicator (fun _ ↦ w (m+1)) := by + ext ω + simp only [Set.indicator_apply, Set.mem_ofPred_eq] + rw [heq,lintegral_indicator_const (hm A)] + exact mul_le_mul' le_rfl (by simpa only [hc] using hbad A) + _ = ((rootedAnimals G v (m+1)).card:ℝ≥0∞)*(w (m+1)*p^(m+1)) := by simp + _ ≤ _ := by + apply mul_le_mul' _ le_rfl + exact_mod_cast rootedAnimals_card_le G Δ hΔ v (m+1) + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_pow]; ring + +end HardSphere.Lattice + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/UniformBath.lean b/lean/OAI/Analysis/HardSphere/Geometry/UniformBath.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3c6636265f8f145e47b08b752653b0d637af1e8 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/UniformBath.lean @@ -0,0 +1,96 @@ +import Mathlib +import OAI.Analysis.HardSphere.Conditioning.PermutationObserved + +namespace OAI + +section + +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal +namespace HardSphere.Comparison +attribute [local instance] Classical.propDecidable +variable {n : ℕ} {E : Type*} [MeasurableSpace E] +local instance permBathSpace (n : ℕ) : MeasurableSpace (Equiv.Perm (Fin n)) := ⊤ +local instance permBathSingleton (n : ℕ) : MeasurableSingletonClass (Equiv.Perm (Fin n)) := ⟨fun _ ↦ trivial⟩ + +lemma uniform_of_equiv {A : Type*} [Fintype A] [Nonempty A] + [MeasurableSpace A] [MeasurableSingletonClass A] (e : Equiv.Perm A) : + (PMF.uniformOfFintype A).toMeasure.map e=(PMF.uniformOfFintype A).toMeasure := by + apply Measure.ext_of_singleton + intro a + rw [Measure.map_apply (measurable_of_countable _) (measurableSet_singleton a)] + have he : (e:A→A) ⁻¹' {a}={e.symm a} := by ext b; simp [Equiv.eq_symm_apply] + rw [he,PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _), + PMF.toMeasure_apply_singleton _ _ (measurableSet_singleton _)] + simp + +def bathFinEquiv (a : Fin (n+1)) : Fin n ≃ {j : Option (Fin (n+1)) // j≠none ∧ j≠some a} := + Equiv.ofBijective (fun k ↦ ⟨some (a.succAbove k), + ⟨Option.some_ne_none _,fun equality ↦ Fin.succAbove_ne a k (Option.some.inj equality)⟩⟩) (by + constructor + · intro j k h + exact Fin.succAbove_right_injective (Option.some_injective _ (congrArg Subtype.val h)) + · rintro ⟨j,hj⟩ + cases j with + | none => exact False.elim (hj.1 rfl) + | some j => + have hja : j≠a := fun h ↦ hj.2 (congrArg some h) + obtain ⟨k,hk⟩ := Fin.exists_succAbove_eq hja + exact ⟨k,Subtype.ext (congrArg some hk)⟩) + +lemma bathFinEquiv_apply (a : Fin (n+1)) (j : Fin n) : + (bathFinEquiv a j).val=some (a.succAbove j) := rfl + +def bathIndexPermutation (σ : Equiv.Perm (Option (Fin (n+1)))) + (a b : Fin (n+1)) (hs : σ none=some a) (hb : σ (some b)=none) : Equiv.Perm (Fin n) := + (bathFinEquiv b).trans ((bathPermutation σ none (some a) (some b) hs hb).trans + ((Equiv.subtypeEquivRight fun _ ↦ and_comm).trans (bathFinEquiv a).symm)) + +lemma bathIndexPermutation_apply (σ : Equiv.Perm (Option (Fin (n+1)))) + (a b : Fin (n+1)) (hs : σ none=some a) (hb : σ (some b)=none) (j : Fin n) : + some (a.succAbove (bathIndexPermutation σ a b hs hb j))=σ (some (b.succAbove j)) := by + exact congrArg Subtype.val ((bathFinEquiv a).apply_symm_apply + ((Equiv.subtypeEquivRight fun _ ↦ and_comm) (bathPermutation σ none (some a) (some b) hs hb (bathFinEquiv b j)))) + +def uniformBathOrder (n : ℕ) : Measure (Equiv.Perm (Fin n)) := + (PMF.uniformOfFintype (Equiv.Perm (Fin n))).toMeasure +instance uniformBathOrder_probability (n : ℕ) : IsProbabilityMeasure (uniformBathOrder n) := by + unfold uniformBathOrder; infer_instance + +def orderedPrimaryObservation (b : Bool) (i : Fin (n+1)) + (z : (Option (Fin (n+1))→E)×Equiv.Perm (Fin n)) : E×E×(Fin n→E) := + if b then (z.1 (some i),z.1 none,fun j ↦ z.1 (some (i.succAbove (z.2 j)))) + else (z.1 none,z.1 (some i),fun j ↦ z.1 (some (i.succAbove (z.2 j)))) + +lemma orderedPrimaryObservation_measurable (b : Bool) (i : Fin (n+1)) : + Measurable (orderedPrimaryObservation (E:=E) b i) := by + apply measurable_from_prod_countable_left + intro τ + cases b <;> dsimp [orderedPrimaryObservation] <;> fun_prop + +theorem uniformBath_same_observation (σ : Equiv.Perm (Option (Fin (n+1)))) + (a b : Fin (n+1)) (hs : σ none=some a) (hb : σ (some b)=none) + (F G : Option (Fin (n+1))→E) (hFG : ∀j,G j=F (σ j)) : + (uniformBathOrder n).map (fun τ ↦ orderedPrimaryObservation true a (F,τ))= + (uniformBathOrder n).map (fun τ ↦ orderedPrimaryObservation false b (G,τ)) := by + let θ := bathIndexPermutation σ a b hs hb + have hβ : (uniformBathOrder n).map (Equiv.mulLeft θ)=uniformBathOrder n := + uniform_of_equiv (Equiv.mulLeft θ) + nth_rw 1 [←hβ] + rw [Measure.map_map (measurable_of_countable _) (measurable_of_countable _)] + apply Measure.map_congr + apply ae_of_all + intro τ + dsimp [Function.comp_def,orderedPrimaryObservation] + rw [hFG none,hFG (some b),hs,hb] + congr 2 + funext j + rw [hFG]; apply congrArg F + exact bathIndexPermutation_apply σ a b hs hb (τ j) + +end HardSphere.Comparison +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/UnitCenter.lean b/lean/OAI/Analysis/HardSphere/Geometry/UnitCenter.lean new file mode 100644 index 0000000000000000000000000000000000000000..f38797c24a68544cab704d067b0fd911bead2b31 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/UnitCenter.lean @@ -0,0 +1,80 @@ +import Mathlib +import OAI.Analysis.HardSphere.Geometry.LocalizedNearLabels + +namespace OAI + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators +open scoped BigOperators ComplexConjugate +open MeasureTheory ProbabilityTheory Filter Set +open scoped ENNReal NNReal Topology BigOperators +open MeasureTheory ProbabilityTheory Real Complex +open scoped ENNReal ComplexConjugate +open ProbabilityTheory +open MeasureTheory Filter Set +open scoped ENNReal Topology +open MeasureTheory Set +open scoped ENNReal +namespace HardSphere +open MeasureTheory Set Filter SphericalCoordinates +open scoped ENNReal + +def unitCenter {K : ℕ} (L : Length) (v : CubeCell K) : Torus L := + fun j ↦ ((pointFin ((v.1:ℝ)+1/2,(v.2.1:ℝ)+1/2,(v.2.2:ℝ)+1/2) j : ℝ) : AddCircle L.val) + +lemma unitIndex_dist_center {K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (x : AddCircle L.val) : + dist x ((((unitIndex hL x).val:ℝ)+1/2:ℝ) : AddCircle L.val)≤1/2 := by + let t := ((AddCircle.equivIco L.val 0) x).val + have ht : 0≤t := ((AddCircle.equivIco L.val 0) x).property.1 + have hlo := Nat.floor_le ht + have hhi := Nat.lt_floor_add_one t + have hab : |t-((⌊t⌋₊:ℝ)+1/2)|≤1/2 := by rw [abs_le]; constructor <;> linarith + change dist x (((⌊t⌋₊:ℝ)+1/2:ℝ) : AddCircle L.val)≤1/2 + have he : (t:AddCircle L.val)=x := AddCircle.coe_equivIco + rw [←he,dist_eq_norm,←QuotientAddGroup.mk_sub] + exact (QuotientAddGroup.norm_mk_le_norm).trans (by simpa only [Real.norm_eq_abs] using hab) + +lemma unitSite_dist_center {K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) (x : Torus L) : + torusDistance L x (unitCenter L (unitSite hL x))≤1 := by + have hc (j : Fin 3) : dist (x j) (unitCenter L (unitSite hL x) j)≤1/2 := by + fin_cases j + · exact unitIndex_dist_center hL (x 0) + · exact unitIndex_dist_center hL (x 1) + · exact unitIndex_dist_center hL (x 2) + apply (Real.sqrt_le_iff).mpr + refine ⟨by norm_num,?_⟩ + calc + _ ≤ ∑ j : Fin 3, (1/2:ℝ)^2 := Finset.sum_le_sum (fun j _ ↦ pow_le_pow_left₀ dist_nonneg (hc j) 2) + _ ≤ (1:ℝ)^2 := by norm_num + +lemma unitOccupation_eq_full {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (p : Fin n → Prop) [DecidablePred p] (v : CubeCell K) (X : Configuration n L) + (hp : ∀ i, unitSite hL (X i)=v → p i) : + unitOccupation hL p v X=unitOccupation hL (fun _ ↦ True) v X := by + classical + apply Fintype.card_congr + exact { + toFun := fun i ↦ ⟨⟨i.val.val,trivial⟩,i.property⟩ + invFun := fun i ↦ ⟨⟨i.val.val,hp i.val.val i.property⟩,i.property⟩ + left_inv := fun _ ↦ rfl + right_inv := fun _ ↦ rfl } + +lemma spatialPartition_cell_occupation {n K : ℕ} {L : Length} (hL : L.val=(K:ℝ)) + (A : Finset (Torus L)) (H : ℝ) (σ : Fin n → Bool) (X : Configuration n L) + (hn : (productPartition n L (spatialInside L A H) (spatialOutside L A H) σ).toFun X≠0) + (v : CubeCell K) (hv : spatialSiteDistance L A (unitCenter L v)+1≤H) : + unitOccupation hL (fun i ↦ σ i=true) v X=unitOccupation hL (fun _ ↦ True) v X := by + apply unitOccupation_eq_full + intro i hi + apply spatialPartition_forces_inside L A H σ X hn + have hd := spatialSiteDistance_triangle L A (X i) (unitCenter L v) + have hc := unitSite_dist_center hL (X i) + rw [hi] at hc + linarith only [hd,hc,hv] + +end HardSphere + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Geometry/Vertex.lean b/lean/OAI/Analysis/HardSphere/Geometry/Vertex.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e3d8589be1a132fb1252cd60c70f93c4bf5ea69 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Geometry/Vertex.lean @@ -0,0 +1,406 @@ +import Mathlib + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators + +noncomputable section +open scoped BigOperators Classical +namespace HardSphere.Lattice +abbrev Vertex := Fin 3 → ℤ + +def step (x : Vertex) (i : Fin 3) : Vertex := Function.update x i (x i+1) + +lemma step_apply_same (x : Vertex) (i : Fin 3) : step x i i=x i+1 := by + simp [step] +lemma step_apply_ne (x : Vertex) {i j : Fin 3} (h : j≠i) : step x i j=x j := by + simp [step,h] +lemma step_comm (x : Vertex) (i j : Fin 3) : step (step x i) j=step (step x j) i := by + ext k + by_cases hi : k=i <;> by_cases hj : k=j <;> simp_all [step,Function.update_apply] + +variable {A : Type*} [AddCommGroup A] + +def cubicalPotential (f : Fin 3 → Vertex → A) (l : ℤ) (x : Vertex) : A := + ∑ k∈Finset.range (x 0-l).toNat, f 0 (Function.update x 0 (l+(k:ℤ))) + +lemma update_step_zero (x : Vertex) (k : ℤ) : + Function.update (step x 0) 0 k=Function.update x 0 k := by simp [step] +lemma step_update_zero (x : Vertex) (k : ℤ) : + step (Function.update x 0 k) 0=Function.update x 0 (k+1) := by simp [step] +lemma update_step_other (x : Vertex) (k : ℤ) {j : Fin 3} (hj : j≠0) : + Function.update (step x j) 0 k=step (Function.update x 0 k) j := by + ext i + by_cases hi : i=0 <;> by_cases hij : i=j <;> simp_all [step,Function.update_apply] + +theorem cubicalPotential_step (f : Fin 3 → Vertex → A) (l : ℤ) + (hl : ∀ i x, x 0≤l → f i x=0) + (hsq : ∀ i j x, f i x+f j (step x i)=f j x+f i (step x j)) + (x : Vertex) (i : Fin 3) : + cubicalPotential f l (step x i)-cubicalPotential f l x=f i x := by + by_cases hi : i=0 + · subst i + by_cases hx : l≤x 0 + · have hn : (step x 0 0-l).toNat=(x 0-l).toNat+1 := by + rw [step_apply_same] + omega + simp only [cubicalPotential,hn,update_step_zero,Finset.sum_range_succ] + have hcast : l+((x 0-l).toNat:ℤ)=x 0 := by omega + rw [hcast,Function.update_eq_self] + abel + · have hx' : x 0≤l := by omega + have hlen : (x 0-l).toNat=0 := by omega + have hlen' : (step x 0 0-l).toNat=0 := by rw [step_apply_same]; omega + simp [cubicalPotential,hlen,hlen',hl 0 x hx'] + · have hi0 : 0≠i := Ne.symm hi + by_cases hx : l≤x 0 + · have hbase : f i (Function.update x 0 l)=0 := hl i _ (by simp) + have hcast : l+((x 0-l).toNat:ℤ)=x 0 := by omega + simp only [cubicalPotential,step_apply_ne x hi0,← Finset.sum_sub_distrib] + calc + _ = ∑ k∈Finset.range (x 0-l).toNat, + (f i (Function.update x 0 (l+((k+1:ℕ):ℤ)))- + f i (Function.update x 0 (l+(k:ℤ)))) := by + apply Finset.sum_congr rfl + intro k _ + rw [update_step_other x _ hi] + have h := hsq 0 i (Function.update x 0 (l+(k:ℤ))) + rw [step_update_zero] at h + simp only [Nat.cast_add,Nat.cast_one] + rw [show l+((k:ℤ)+1)=l+(k:ℤ)+1 by omega] + exact sub_eq_sub_iff_add_eq_add.mpr (by simpa only [add_comm] using h.symm) + _ = f i (Function.update x 0 (l+((x 0-l).toNat:ℤ)))- + f i (Function.update x 0 (l+(0:ℤ))) := by + exact Finset.sum_range_sub (fun k : ℕ ↦ f i (Function.update x 0 (l+(k:ℤ)))) _ + _ = f i x := by rw [hcast,add_zero,Function.update_eq_self,hbase,sub_zero] + · have hlen : (x 0-l).toNat=0 := by omega + have hx' : x 0≤l := by omega + simp [cubicalPotential,step_apply_ne x hi0,hlen,hl i x hx'] + +def nearestStep (x y : Vertex) : Prop := + ∃ i : Fin 3, |x i-y i|=1 ∧ ∀ j, j≠i → x j=y j + +def starStep (x y : Vertex) : Prop := x≠y ∧ ∀ i, |x i-y i|≤1 + +lemma nearestStep_symm {x y : Vertex} (h : nearestStep x y) : nearestStep y x := by + obtain ⟨i,hi,hrest⟩ := h + exact ⟨i,by simpa only [abs_sub_comm] using hi,fun j hj ↦ (hrest j hj).symm⟩ +lemma nearestStep_step (x : Vertex) (i : Fin 3) : nearestStep x (step x i) := by + refine ⟨i,?_,fun j hj ↦ (step_apply_ne x hj).symm⟩ + rw [step_apply_same] + norm_num +lemma nearestStep_eq_step {x y : Vertex} (h : nearestStep x y) : + ∃ i, y=step x i ∨ x=step y i := by + obtain ⟨i,hi,hrest⟩ := h + rcases (abs_eq (by norm_num : (0:ℤ)≤1)).mp hi with hp|hm + · refine ⟨i,Or.inr ?_⟩ + ext j + by_cases hj : j=i + · subst j; rw [step_apply_same]; omega + · rw [step_apply_ne y hj]; exact hrest j hj + · refine ⟨i,Or.inl ?_⟩ + ext j + by_cases hj : j=i + · subst j; rw [step_apply_same]; omega + · rw [step_apply_ne x hj]; exact (hrest j hj).symm + +def withinReach (e : Vertex → Vertex → Prop) (D : Set Vertex) (x y : Vertex) : Prop := + Relation.ReflTransGen (fun u v ↦ u∈D ∧ v∈D ∧ e u v) x y + +def NNConnected (D : Set Vertex) : Prop := + ∀ x∈D, ∀ y∈D, withinReach nearestStep D x y + +def starConnected (D : Set Vertex) : Prop := + ∀ x∈D, ∀ y∈D, withinReach starStep D x y + +def NNComplementComponent (A B : Set Vertex) : Prop := + Disjoint A B ∧ NNConnected B ∧ + ∀ x∈B, ∀ y, y∉A → nearestStep x y → y∈B + +def nnBoundary (A B : Set Vertex) : Set Vertex := + {x | x∈B ∧ ∃ a∈A, nearestStep a x} + +lemma boundary_of_cross {A B : Set Vertex} (hB : NNComplementComponent A B) + {x y : Vertex} (hx : x∈B) (hy : y∉B) (hxy : nearestStep x y) : + x∈nnBoundary A B := by + refine ⟨hx,y,?_,nearestStep_symm hxy⟩ + by_contra hya + exact hy (hB.2.2 x hx y hya hxy) + +def unitCube (x : Vertex) : Set Vertex := {y | ∀ i, x i≤y i ∧ y i≤x i+1} + +lemma unitCube_self (x : Vertex) : x∈unitCube x := by intro i; omega +lemma unitCube_step (x : Vertex) (i : Fin 3) : step x i∈unitCube x := by + intro j + by_cases hj : j=i + · subst j; rw [step_apply_same]; omega + · rw [step_apply_ne x hj]; omega +lemma unitCube_step_step (x : Vertex) {i j : Fin 3} (hij : i≠j) : + step (step x i) j∈unitCube x := by + intro k + by_cases hk : k=i + · subst k + rw [step_apply_ne _ hij,step_apply_same] + omega + · by_cases hkj : k=j + · subst k + rw [step_apply_same,step_apply_ne _ hk] + omega + · rw [step_apply_ne _ hkj,step_apply_ne _ hk]; omega + +lemma unitCube_star {x y z : Vertex} (hy : y∈unitCube x) (hz : z∈unitCube x) + (hyz : y≠z) : starStep y z := by + refine ⟨hyz,fun i ↦ abs_le.mpr ?_⟩ + have h := hy i + have h' := hz i + constructor <;> omega + +def edgeLabel (B S : Set Vertex) (x y : Vertex) : ZMod 2 := + (if x∈S then 1 else 0)*(1-if y∈B then 1 else 0)+ + (if y∈S then 1 else 0)*(1-if x∈B then 1 else 0) + +def cubeFlag (S : Set Vertex) (x : Vertex) : ZMod 2 := + if ∃ y∈S, y∈unitCube x then 1 else 0 + +def indicatorTwo (B : Set Vertex) (x : Vertex) : ZMod 2 := if x∈B then 1 else 0 + +lemma edgeLabel_symm (B S : Set Vertex) (x y : Vertex) : + edgeLabel B S x y=edgeLabel B S y x := by unfold edgeLabel; ring + +lemma edgeLabel_zero_of_same {B S : Set Vertex} (hSB : S⊆B) {x y : Vertex} + (hxy : x∈B ↔ y∈B) : edgeLabel B S x y=0 := by + by_cases hx : x∈B + · simp [edgeLabel,hx,hxy.mp hx] + · have hy : y∉B := fun h ↦ hx (hxy.mpr h) + have hsx : x∉S := fun h ↦ hx (hSB h) + have hsy : y∉S := fun h ↦ hy (hSB h) + simp [edgeLabel,hsx,hsy] + +lemma cubeFlag_eq {A B S : Set Vertex} (hS : S⊆nnBoundary A B) + (hcoh : ∀ u∈nnBoundary A B, ∀ v∈nnBoundary A B, + starStep u v → (u∈S ↔ v∈S)) {x y : Vertex} + (hy : y∈nnBoundary A B) (hyc : y∈unitCube x) : + cubeFlag S x=indicatorTwo S y := by + by_cases hys : y∈S + · simp [cubeFlag,indicatorTwo,hys,show ∃ z∈S,z∈unitCube x from ⟨y,hys,hyc⟩] + · have he : ¬∃ z∈S,z∈unitCube x := by + rintro ⟨z,hzs,hzc⟩ + by_cases hzy : z=y + · exact hys (hzy ▸ hzs) + · exact hys ((hcoh z (hS hzs) y hy (unitCube_star hzc hyc hzy)).mp hzs) + simp [cubeFlag,indicatorTwo,hys,he] + +lemma edgeLabel_unitCube {A B S : Set Vertex} (hB : NNComplementComponent A B) + (hS : S⊆nnBoundary A B) + (hcoh : ∀ u∈nnBoundary A B, ∀ v∈nnBoundary A B, + starStep u v → (u∈S ↔ v∈S)) {x u v : Vertex} + (hu : u∈unitCube x) (hv : v∈unitCube x) (huv : nearestStep u v) : + edgeLabel B S u v=cubeFlag S x*(indicatorTwo B v-indicatorTwo B u) := by + have hSB : S⊆B := fun _ hz ↦ (hS hz).1 + by_cases hub : u∈B <;> by_cases hvb : v∈B + · simp [edgeLabel,indicatorTwo,hub,hvb] + · have hsv : v∉S := fun h ↦ hvb (hSB h) + have hf := cubeFlag_eq hS hcoh (boundary_of_cross hB hub hvb huv) hu + rw [hf] + by_cases hus : u∈S + · norm_num [edgeLabel,indicatorTwo,hub,hvb,hsv,hus] + decide + · simp [edgeLabel,indicatorTwo,hub,hvb,hsv,hus] + · have hsu : u∉S := fun h ↦ hub (hSB h) + have hf := cubeFlag_eq hS hcoh + (boundary_of_cross hB hvb hub (nearestStep_symm huv)) hv + rw [hf] + by_cases hvs : v∈S <;> norm_num [edgeLabel,indicatorTwo,hub,hvb,hsu,hvs] + · have hsu : u∉S := fun h ↦ hub (hSB h) + have hsv : v∉S := fun h ↦ hvb (hSB h) + simp [edgeLabel,indicatorTwo,hub,hvb,hsu,hsv] + +lemma edgeLabel_square {A B S : Set Vertex} (hB : NNComplementComponent A B) + (hS : S⊆nnBoundary A B) + (hcoh : ∀ u∈nnBoundary A B, ∀ v∈nnBoundary A B, + starStep u v → (u∈S ↔ v∈S)) (x : Vertex) (i j : Fin 3) : + edgeLabel B S x (step x i)+edgeLabel B S (step x i) (step (step x i) j)= + edgeLabel B S x (step x j)+edgeLabel B S (step x j) (step (step x j) i) := by + by_cases hij : i=j + · subst j; rfl + have htop := unitCube_step_step x hij + have htop' := unitCube_step_step x (Ne.symm hij) + rw [edgeLabel_unitCube hB hS hcoh (unitCube_self x) (unitCube_step x i) (nearestStep_step x i), + edgeLabel_unitCube hB hS hcoh (unitCube_step x i) htop (nearestStep_step _ j), + edgeLabel_unitCube hB hS hcoh (unitCube_self x) (unitCube_step x j) (nearestStep_step x j), + edgeLabel_unitCube hB hS hcoh (unitCube_step x j) htop' (nearestStep_step _ i), + step_comm x i j] + ring + +lemma zmod_two_neg (z : ZMod 2) : -z=z := by fin_cases z <;> rfl + +lemma starStep_symm {x y : Vertex} (h : starStep x y) : starStep y x := + ⟨Ne.symm h.1,fun i ↦ by simpa only [abs_sub_comm] using h.2 i⟩ + +lemma withinReach_preserves {D : Set Vertex} {e : Vertex → Vertex → Prop} + {W : Type*} (q : Vertex → W) + (hstep : ∀ x∈D, ∀ y∈D, e x y → q x=q y) + {x y : Vertex} (h : withinReach e D x y) : q x=q y := by + induction h using Relation.ReflTransGen.head_induction_on with + | refl => rfl + | head h' _ ih => exact (hstep _ h'.1 _ h'.2.1 h'.2.2).trans ih + +lemma exists_boundary_potential {A B S : Set Vertex} (hA : A.Finite) + (hB : NNComplementComponent A B) (hS : S⊆nnBoundary A B) + (hcoh : ∀ u∈nnBoundary A B, ∀ v∈nnBoundary A B, + starStep u v → (u∈S ↔ v∈S)) : + ∃ q : Vertex → ZMod 2, ∀ x y, nearestStep x y → + q y-q x=edgeLabel B S x y := by + obtain ⟨b,hb⟩ := (hA.image (fun x : Vertex ↦ x 0)).bddBelow + have hmin (a : Vertex) (ha : a∈A) : b≤a 0 := + hb (Set.mem_image_of_mem _ ha) + let l : ℤ := b-2 + let f : Fin 3 → Vertex → ZMod 2 := fun i x ↦ edgeLabel B S x (step x i) + have hSB : S⊆B := fun _ hz ↦ (hS hz).1 + have hl : ∀ i x, x 0≤l → f i x=0 := by + intro i x hx + have hx0 : x 0 rw [coordinateRay_zero]; exact Relation.ReflTransGen.refl + | succ n ih => exact ih.tail ⟨hC n, hC (n+1), coordinateRay_step x i d hd n⟩ + +lemma coordinateRay_exterior (C : Finset Vertex) (x : Vertex) (i : Fin 3) + (d : ℤ) (hd : |d|=1) (hC : ∀ n, coordinateRay x i d n∉C) : x∈exterior C := by + have hd0 : d≠0 := by intro h; simp [h] at hd + refine ⟨by simpa only [coordinateRay_zero] using hC 0, ?_⟩ + have hi := Set.infinite_range_of_injective (coordinateRay_injective x i d hd0) + exact hi.mono (by + rintro y ⟨n,rfl⟩ + exact coordinateRay_reachable C x i d hd hC n) + +lemma upper_ray_exterior (C : Finset Vertex) (x : Vertex) (i : Fin 3) + (hx : ∀ c∈C, c i assumption + +lemma exposedPairedTrialKernel_physical (Q : Kernel E Point) [IsFiniteKernel Q] (t : ℝ) + (y z y' z' : E→Point) (hy : Measurable y) (hz : Measurable z) + (hy' : Measurable y') (hz' : Measurable z') + (S T : Set (E×C(Time,Point))) (hS : MeasurableSet S) (hT : MeasurableSet T) + (A : E→Set Point) (hQ : ∀e,Q e=targetUniform (A e)) (e : E) : + exposedPairedTrialKernel Q t y z y' z' hy hz hy' hz' S T hS hT e= + pairedTrialLaw t (y e) (z e) (y' e) (z' e) (A e) + (Prod.mk e ⁻¹' S) (Prod.mk e ⁻¹' T) + (hS.preimage measurable_prodMk_left) (hT.preimage measurable_prodMk_left) := by + rw [exposedPairedTrialKernel_apply,hQ] + rfl + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Kernels/ExposedTrials.lean b/lean/OAI/Analysis/HardSphere/Kernels/ExposedTrials.lean new file mode 100644 index 0000000000000000000000000000000000000000..72c2863601bcbb9a83c51cf645950190283d6331 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Kernels/ExposedTrials.lean @@ -0,0 +1,89 @@ +import Mathlib +import OAI.Analysis.HardSphere.Bridges.SupplyIntegral + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal Topology BigOperators +namespace HardSphere.Bridge +open Wiener GaussianPacking PathCutoff +attribute [local irreducible] torusDistance + +lemma trialPath_all_continuous (t : ℝ) : + Continuous (fun p : (Point×(Point×Point))×(Noise×Noise) ↦ + trialPath t p.1.1 p.1.2.1 p.1.2.2 p.2) := by + apply ContinuousMap.continuous_of_continuous_uncurry + change Continuous (fun p : ((Point×(Point×Point))×(Noise×Noise))×Time ↦ fun j ↦ + (mean p.1.1.1 p.1.1.2.2 (leftTime p.2) j+Real.sqrt (2*t)*center (p.1.2.1 j) (leftTime p.2))+ + (mean p.1.1.2.1 p.1.1.2.2 (reverseTime (rightTime p.2)) j+ + Real.sqrt (2*t)*center (p.1.2.2 j) (reverseTime (rightTime p.2)))-p.1.1.2.2 j) + unfold mean + have hl := leftTime_continuous + have hr := reverseTime.continuous.comp rightTime_continuous + have hc := center_continuous + fun_prop + +def exposedTrialKernel (t : ℝ) : Kernel (Point×(Point×Point)) C(Time,Point) := + ((Kernel.deterministic id measurable_id).prod + (Kernel.const (Point×(Point×Point)) (law.prod law))).map + (fun p ↦ trialPath t p.1.1 p.1.2.1 p.1.2.2 p.2) + +instance exposedTrialKernel_markov (t : ℝ) : IsMarkovKernel (exposedTrialKernel t) := by + unfold exposedTrialKernel + exact Kernel.IsMarkovKernel.map _ (trialPath_all_continuous t).measurable + +lemma exposedTrialKernel_apply (t : ℝ) (y z u : Point) : + exposedTrialKernel t (y,z,u)=trialKernel t y z u := by + rw [exposedTrialKernel,Kernel.map_apply _ (trialPath_all_continuous t).measurable, + Kernel.prod_apply,Kernel.deterministic_apply,Kernel.const_apply,Measure.dirac_prod, + Measure.map_map (trialPath_all_continuous t).measurable + (measurable_const.prodMk measurable_id : Measurable (Prod.mk (id (y,z,u)))), + trialKernel_apply] + rfl + +lemma trialCollision_joint_closed {L : Length} (r : ℝ) : + IsClosed {p : ConfigurationPath 1 L×C(Time,Point) | TrialCollision r p.1 p.2} := by + let E : Set ((ConfigurationPath 1 L×C(Time,Point))×Time) := + {p | torusDistance L (projectPoint L (p.1.2 p.2)) (p.1.1 p.2 0) ≤ r} + have hE : IsClosed E := by + apply isClosed_le _ continuous_const + apply (torusDistance_continuous_pair L).comp (f := fun p : (ConfigurationPath 1 L×C(Time,Point))×Time ↦ + (projectPoint L (p.1.2 p.2),p.1.1 p.2 0)) + apply Continuous.prodMk + · change Continuous (fun p : (ConfigurationPath 1 L×C(Time,Point))×Time ↦ + fun j : Fin 3 ↦ (p.1.2 p.2 j:AddCircle L.val)) + fun_prop + · fun_prop + convert isClosedMap_fst_of_compactSpace E hE using 1 + ext p + simp only [TrialCollision,mem_ofPred_eq,mem_image,E] + exact ⟨fun ⟨s,hs⟩ ↦ ⟨(p,s),hs,rfl⟩,fun ⟨⟨q,s⟩,hs,hq⟩ ↦ by + change q=p at hq + subst q + exact ⟨s,hs⟩⟩ + +lemma successExcept_joint_measurable {L : Length} {N : ℕ} (n : ℕ) + (r R C S : ℝ) (w : Time) (v : Point) (i : Fin N) : + MeasurableSet {p : (Fin N → ConfigurationPath 1 L)×C(Time,Point) | + p.2∈SuccessExcept n r R C S w v p.1 i} := by + have hm (j : Fin N) : Measurable (fun p : (Fin N → ConfigurationPath 1 L)×C(Time,Point) ↦ + (p.1 j,p.2)) := ((measurable_pi_apply j).comp measurable_fst).prodMk measurable_snd + have hh : MeasurableSet {p : (Fin N → ConfigurationPath 1 L)×C(Time,Point) | + ∀j,j≠i→¬TrialCollision r (p.1 j) p.2} := by + simp only [ofPred_forall] + exact MeasurableSet.iInter fun j ↦ MeasurableSet.iInter fun _ ↦ + ((trialCollision_joint_closed r).measurableSet.preimage (hm j)).compl + exact ((trialCutoff_measurable L n r R C w S v).preimage measurable_snd).inter hh + +end HardSphere.Bridge + +end +end + +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Kernels/FiniteKernelPi.lean b/lean/OAI/Analysis/HardSphere/Kernels/FiniteKernelPi.lean new file mode 100644 index 0000000000000000000000000000000000000000..95538876820aa0b62b52372bf77b07347e484c7f --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Kernels/FiniteKernelPi.lean @@ -0,0 +1,173 @@ +import Mathlib + +namespace OAI + +section + +section + +noncomputable section +open MeasureTheory ProbabilityTheory +open scoped ENNReal + +namespace HardSphere.Comparison + +private theorem exists_kernel_pi_fin {α : Type*} [MeasurableSpace α] (n : ℕ) + (β : Fin n → Type*) [∀ i, MeasurableSpace (β i)] + (κ : ∀ i, Kernel α (β i)) [∀ i, IsFiniteKernel (κ i)] : + ∃ η : Kernel α (∀ i, β i), IsFiniteKernel η ∧ + ∀ a, η a = Measure.pi (fun i ↦ κ i a) := by + induction n with + | zero => + let η : Kernel α (∀ i, β i) := Kernel.deterministic (fun _ i ↦ Fin.elim0 i) measurable_const + refine ⟨η, inferInstance, fun a ↦ ?_⟩ + rw [Kernel.deterministic_apply, Measure.pi_of_empty (fun i ↦ κ i a) (fun i ↦ Fin.elim0 i)] + | succ n ih => + obtain ⟨η, hη, heq⟩ := ih (fun i ↦ β ((0 : Fin (n+1)).succAbove i)) + (fun i ↦ κ ((0 : Fin (n+1)).succAbove i)) + let := hη + let e := (MeasurableEquiv.piFinSuccAbove β 0).symm + refine ⟨((κ 0).prod η).map e, inferInstance, fun a ↦ ?_⟩ + rw [Kernel.map_apply _ e.measurable, Kernel.prod_apply, heq] + exact ((measurePreserving_piFinSuccAbove (fun i ↦ κ i a) 0).symm + (MeasurableEquiv.piFinSuccAbove β 0)).map_eq + +theorem exists_kernel_pi {α ι : Type*} [MeasurableSpace α] [Fintype ι] + (β : ι → Type*) [∀ i, MeasurableSpace (β i)] + (κ : ∀ i, Kernel α (β i)) [∀ i, IsFiniteKernel (κ i)] : + ∃ η : Kernel α (∀ i, β i), IsFiniteKernel η ∧ + ∀ a, η a = Measure.pi (fun i ↦ κ i a) := by + classical + let e := (Fintype.equivFin ι).symm + obtain ⟨η, hη, heq⟩ := exists_kernel_pi_fin (Fintype.card ι) + (fun i ↦ β (e i)) (fun i ↦ κ (e i)) + let := hη + let E := MeasurableEquiv.piCongrLeft β e + refine ⟨η.map E, inferInstance, fun a ↦ ?_⟩ + rw [Kernel.map_apply _ E.measurable, heq] + exact (measurePreserving_piCongrLeft (fun i ↦ κ i a) e).map_eq + +noncomputable def finiteKernelPi {α ι : Type*} [MeasurableSpace α] [Fintype ι] + {β : ι → Type*} [∀ i, MeasurableSpace (β i)] + (κ : ∀ i, Kernel α (β i)) [∀ i, IsFiniteKernel (κ i)] : Kernel α (∀ i, β i) := + (exists_kernel_pi β κ).choose + +instance {α ι : Type*} [MeasurableSpace α] [Fintype ι] + {β : ι → Type*} [∀ i, MeasurableSpace (β i)] + (κ : ∀ i, Kernel α (β i)) [∀ i, IsFiniteKernel (κ i)] : + IsFiniteKernel (finiteKernelPi κ) := (exists_kernel_pi β κ).choose_spec.1 + +lemma finiteKernelPi_apply {α ι : Type*} [MeasurableSpace α] [Fintype ι] + {β : ι → Type*} [∀ i, MeasurableSpace (β i)] + (κ : ∀ i, Kernel α (β i)) [∀ i, IsFiniteKernel (κ i)] (a : α) : + finiteKernelPi κ a = Measure.pi (fun i ↦ κ i a) := + (exists_kernel_pi β κ).choose_spec.2 a + +private lemma lintegral_fin_prod {n : ℕ} {β : Fin n → Type*} + [∀ i, MeasurableSpace (β i)] (μ : ∀ i, Measure (β i)) [∀ i, SigmaFinite (μ i)] + (f : ∀ i, β i → ℝ≥0∞) (hf : ∀ i, Measurable (f i)) : + (∫⁻ x, ∏ i, f i (x i) ∂Measure.pi μ) = ∏ i, ∫⁻ x, f i x ∂μ i := by + classical + induction n with + | zero => simp [Measure.pi_of_empty μ] + | succ n ih => + have hp := (measurePreserving_piFinSuccAbove μ 0).symm + (MeasurableEquiv.piFinSuccAbove β 0) + rw [← hp.lintegral_comp (f := fun x ↦ ∏ i, f i (x i)) (Finset.measurable_prod _ fun i _ ↦ + (hf i).comp (measurable_pi_apply i))] + have heq : (fun z ↦ ∏ i, f i ((MeasurableEquiv.piFinSuccAbove β 0).symm z i)) = + (fun z ↦ f 0 z.1 * ∏ j, f ((0 : Fin (n+1)).succAbove j) (z.2 j)) := by + funext z + rw [Fin.prod_univ_succAbove _ 0] + simp only [MeasurableEquiv.piFinSuccAbove_symm_apply, Fin.insertNthEquiv, + Equiv.coe_fn_mk, Fin.insertNth_apply_same, Fin.insertNth_apply_succAbove] + rw [heq] + have hm : Measurable (fun z : ∀ j : Fin n, β ((0 : Fin (n+1)).succAbove j) ↦ + ∏ j, f ((0 : Fin (n+1)).succAbove j) (z j)) := + Finset.measurable_prod _ fun i _ ↦ + (hf ((0 : Fin (n+1)).succAbove i)).comp (measurable_pi_apply i) + rw [lintegral_prod_mul (hf 0).aemeasurable hm.aemeasurable] + rw [ih _ _ (fun i ↦ hf ((0 : Fin (n+1)).succAbove i))] + exact (Fin.prod_univ_succAbove (fun i ↦ ∫⁻ x, f i x ∂μ i) 0).symm + +lemma lintegral_finite_prod {ι : Type*} [Fintype ι] {β : ι → Type*} + [∀ i, MeasurableSpace (β i)] (μ : ∀ i, Measure (β i)) [∀ i, SigmaFinite (μ i)] + (f : ∀ i, β i → ℝ≥0∞) (hf : ∀ i, Measurable (f i)) : + (∫⁻ x, ∏ i, f i (x i) ∂Measure.pi μ) = ∏ i, ∫⁻ x, f i x ∂μ i := by + classical + let e := (Fintype.equivFin ι).symm + rw [← (measurePreserving_piCongrLeft μ e).lintegral_comp (f := fun x ↦ ∏ i, f i (x i)) + (Finset.measurable_prod _ fun i _ ↦ (hf i).comp (measurable_pi_apply i))] + simp_rw [← e.prod_comp, MeasurableEquiv.coe_piCongrLeft, + Equiv.piCongrLeft_apply_apply] + exact lintegral_fin_prod _ _ (fun i ↦ hf (e i)) + +section CoordinateKernels +variable {ι : Type*} [Fintype ι] {X Z : ι → Type*} + [∀ i, MeasurableSpace (X i)] [∀ i, MeasurableSpace (Z i)] + (κ : ∀ i, Kernel (X i) (Z i)) [∀ i, IsFiniteKernel (κ i)] + +def coordinateKernel : Kernel (∀ i, X i) (∀ i, Z i) := + finiteKernelPi (fun i ↦ (κ i).comap (fun x ↦ x i) (measurable_pi_apply (i : ι))) + +instance : IsFiniteKernel (coordinateKernel κ) := by + unfold coordinateKernel + infer_instance + +lemma coordinateKernel_apply (x : ∀ i, X i) : + coordinateKernel κ x = Measure.pi (fun i ↦ κ i (x i)) := by + simp only [coordinateKernel, finiteKernelPi_apply, Kernel.comap_apply] + +lemma pi_compProd (μ : ∀ i, Measure (X i)) [∀ i, IsFiniteMeasure (μ i)] : + Measure.map (fun p : (∀ i, X i) × (∀ i, Z i) ↦ fun i ↦ (p.1 i, p.2 i)) + ((Measure.pi μ).compProd (coordinateKernel κ)) = + Measure.pi (fun i ↦ (μ i).compProd (κ i)) := by + classical + have hm : Measurable (fun p : (∀ i, X i) × (∀ i, Z i) ↦ fun i ↦ (p.1 i, p.2 i)) := by + fun_prop + symm + apply Measure.pi_eq + intro s hs + rw [Measure.map_apply hm (MeasurableSet.univ_pi hs), + Measure.compProd_apply (hm (MeasurableSet.univ_pi hs))] + have heq (x : ∀ i, X i) : (Prod.mk x ⁻¹' + ((fun p : (∀ i, X i) × (∀ i, Z i) ↦ fun i ↦ (p.1 i, p.2 i)) ⁻¹' Set.pi Set.univ s)) = + Set.pi Set.univ (fun i ↦ Prod.mk (x i) ⁻¹' s i) := by + ext z + simp + simp_rw [heq, coordinateKernel_apply, Measure.pi_pi] + rw [lintegral_finite_prod _ _ (fun i ↦ Kernel.measurable_kernel_prodMk_left (hs i))] + congr 1 + funext i + exact (Measure.compProd_apply (hs i)).symm + +lemma measurable_kernelPi_integral {f : (∀ i, X i) × (∀ i, Z i) → ℝ≥0∞} + (hf : Measurable f) : + Measurable (fun x ↦ ∫⁻ z, f (x,z) ∂Measure.pi (fun i ↦ κ i (x i))) := by + simpa only [coordinateKernel_apply] using + (hf.lintegral_kernel_prod_right' (κ := coordinateKernel κ)) + +lemma lintegral_pi_compProd (μ : ∀ i, Measure (X i)) [∀ i, IsFiniteMeasure (μ i)] + {f : (∀ i, X i × Z i) → ℝ≥0∞} (hf : Measurable f) : + (∫⁻ p, f p ∂Measure.pi (fun i ↦ (μ i).compProd (κ i))) = + ∫⁻ x, ∫⁻ z, f (fun i ↦ (x i,z i)) ∂Measure.pi (fun i ↦ κ i (x i)) ∂Measure.pi μ := by + have hm : Measurable (fun p : (∀ i, X i) × (∀ i, Z i) ↦ fun i ↦ (p.1 i, p.2 i)) := by + fun_prop + rw [← pi_compProd κ μ, lintegral_map hf hm] + rw [Measure.lintegral_compProd (f := fun p : (∀ i, X i) × (∀ i, Z i) ↦ f (fun i ↦ (p.1 i, p.2 i))) + (hf.comp hm)] + simp only [coordinateKernel_apply] + +end CoordinateKernels +end HardSphere.Comparison + +noncomputable section +open MeasureTheory Function Set Filter +open scoped ENNReal BigOperators + +end +end +end +end + +end OAI diff --git a/lean/OAI/Analysis/HardSphere/Kernels/KernelDensity.lean b/lean/OAI/Analysis/HardSphere/Kernels/KernelDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..de3b82f82c39624cfb0f52379c888ba5d07cbb60 --- /dev/null +++ b/lean/OAI/Analysis/HardSphere/Kernels/KernelDensity.lean @@ -0,0 +1,84 @@ +import Mathlib +import OAI.Analysis.HardSphere.Kernels.TrialKernel + +namespace OAI + +section + +section +noncomputable section +open MeasureTheory ProbabilityTheory Set +open scoped ENNReal NNReal +namespace HardSphere.Comparison +variable {U X : Type*} [MeasurableSpace U] [MeasurableSpace X] + +lemma successKernel_restrict_le (κ : Kernel U X) [IsFiniteKernel κ] (S : Set X) (hS : MeasurableSet S) + {u : U} {c : ℝ≥0∞} (hc : c≤κ u S) : + successKernel κ S hS u≤c⁻¹ • (κ u).restrict S := by + rw [successKernel_apply] + intro B + simp only [Measure.smul_apply,smul_eq_mul] + exact mul_le_mul_left (ENNReal.inv_le_inv.mpr hc) _ + +lemma successful_marginal_le (μ ν : Measure U) [SFinite μ] [SFinite ν] + (κ : Kernel U X) [IsFiniteKernel κ] (S : Set X) (hS : MeasurableSet S) + {c A : ℝ≥0∞} (hμ : μ≤A • ν) (hc : ∀ᵐu ∂μ,c≤κ u S) : + (μ.compProd (successKernel κ S hS)).map Prod.snd ≤ + (c⁻¹*A) • (((ν.compProd κ).map Prod.snd).restrict S) := by + apply Measure.le_iff.mpr + intro B hB + rw [Measure.map_apply measurable_snd hB,Measure.compProd_apply (hB.preimage measurable_snd), + Measure.smul_apply,smul_eq_mul,Measure.restrict_apply hB, + Measure.map_apply measurable_snd (hB.inter hS),Measure.compProd_apply ((hB.inter hS).preimage measurable_snd)] + calc + _ ≤ ∫⁻u,c⁻¹*(κ u (B∩S)) ∂μ := by + apply lintegral_mono_ae + filter_upwards [hc] with u hu + change successKernel κ S hS u B≤_ + simpa only [preimage_preimage,preimage_id,Measure.smul_apply,smul_eq_mul,Measure.restrict_apply hB] using + successKernel_restrict_le κ S hS hu B + _ = c⁻¹*(∫⁻u,κ u (B∩S) ∂μ) := lintegral_const_mul _ (κ.measurable_coe (hB.inter hS)) + _ ≤ c⁻¹*(∫⁻u,κ u (B∩S) ∂A • ν) := mul_le_mul_right (lintegral_mono' hμ le_rfl) _ + _ = _ := by rw [lintegral_smul_measure]; simp only [smul_eq_mul]; rw [mul_assoc]; rfl + +lemma normalizer_positive_of_uniform_success (μ ν : Measure U) [IsProbabilityMeasure μ] [SFinite ν] + (κ : Kernel U X) [IsFiniteKernel κ] (S : Set X) (hS : MeasurableSet S) + {c A : ℝ≥0∞} (hc0 : 0