import Mathlib import OAI.Analysis.HardSphere.Geometry.HeatScalar import OAI.Analysis.HardSphere.Orbitals.StrongContractionLimitDense 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 namespace HardSphere open scoped Topology open ContinuousLinearMap def regularizationWeight (δ x : ℝ) : ℝ := (δ+(1-δ)*x)⁻¹ lemma regularization_denom_pos {δ x : ℝ} (hδ : 0<δ) (hx : x∈Set.Icc (0:ℝ) 1) : 0<δ+(1-δ)*x := by have he : δ+(1-δ)*x=δ*(1-x)+x := by ring rw [he] by_cases h : x=0 · simp [h,hδ] · exact add_pos_of_nonneg_of_pos (mul_nonneg hδ.le (sub_nonneg.mpr hx.2)) (lt_of_le_of_ne hx.1 (Ne.symm h)) lemma regularization_weight_continuous {δ : ℝ} (hδ : 0<δ) : ContinuousOn (regularizationWeight δ) (Set.Icc (0:ℝ) 1) := by apply (continuous_const.add (continuous_const.mul continuous_id)).continuousOn.inv₀ exact fun x hx ↦ ne_of_gt (regularization_denom_pos hδ hx) lemma regularization_energy_bound {δ x : ℝ} (hδ : 0<δ) (hx : x∈Set.Icc (0:ℝ) 1) : x*(regularizationWeight δ x)^2 ≤ 1+δ⁻¹*(1-heatScalar δ x) := by by_cases hx0 : x=0 · simp only [hx0,zero_mul,heatScalar_zero,sub_zero,mul_one] positivity have hxp : 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