math / data /lean /OAI /Geometry /Immersion /ClosedSurface /MeanError.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
7 kB
import OAI.Geometry.Immersion.ClosedSurface.GradientBounds
import OAI.Geometry.Immersion.ClosedSurface.QuadraticError
namespace OAI
noncomputable section
open Set Complex Bundle Manifold
open scoped ContDiff Matrix Topology Manifold BigOperators
namespace ClosedSurfaceR4.SmallModes
open ClosedSurfaceR4.WeightedEstimates
structure FreeCoefficient {n : β„•} (G : Field n) (U : Set Base) (V : Field n) : Prop where
smooth : ContDiffOn ℝ ∞ V U
perpX : βˆ€ p ∈ U, coordDeriv dx G p ⬝α΅₯ V p = 0
perpY : βˆ€ p ∈ U, coordDeriv dy G p ⬝α΅₯ V p = 0
perpSecond : βˆ€ p ∈ U, goodSecond G p ⬝α΅₯ V p = 0
lemma FreeCoefficient.sub {n : β„•} {G V W : Field n} {U : Set Base}
(hV : FreeCoefficient G U V) (hW : FreeCoefficient G U W) :
FreeCoefficient G U (fun p => V p - W p) := by
refine ⟨hV.smooth.sub hW.smooth, ?_, ?_, ?_⟩
Β· intro p hp; simp [dotProduct_sub, hV.perpX p hp, hW.perpX p hp]
Β· intro p hp; simp [dotProduct_sub, hV.perpY p hp, hW.perpY p hp]
Β· intro p hp; simp [dotProduct_sub, hV.perpSecond p hp, hW.perpSecond p hp]
def leadingDerivative {n : β„•} (Ο„ : ℝ) (V : Field n) (v : Base) : Field n :=
fun p => (Complex.I / (Ο„ : β„‚) * (v.1 : β„‚)) β€’ V p
lemma contDiffOn_leadingDerivative {n : β„•} (Ο„ : ℝ) {V : Field n} {U : Set Base}
(hV : ContDiffOn ℝ ∞ V U) (v : Base) :
ContDiffOn ℝ ∞ (leadingDerivative Ο„ V v) U := by
unfold leadingDerivative
simpa only [Pi.smul_def'] using
(contDiffOn_const (c := Complex.I / (Ο„ : β„‚) * (v.1 : β„‚))).smul hV
lemma weighted_leadingDerivative {n : β„•} {Ο„ : ℝ} (hΟ„ : 0 < Ο„) {V : Field n}
{U : Set Base} (hU : UniqueDiffOn ℝ U) {s C : ℝ} {m : β„•} (hs : 0 < s)
(hC : 0 ≀ C) (hV : ContDiffOn ℝ ∞ V U) (hb : WeightedBound U s m C V)
(v : Base) (hv : β€–vβ€– ≀ 1) : WeightedBound U s m (C / Ο„) (leadingDerivative Ο„ V v) := by
have hh := hb.complex_smul_pi hU hs hC hV (Complex.I / (Ο„ : β„‚) * (v.1 : β„‚))
apply hh.mono_const
have hn : β€–Complex.I / (Ο„ : β„‚) * (v.1 : β„‚)β€– ≀ 1 / Ο„ := by
rw [norm_mul, norm_div]
simp only [Complex.norm_I, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hΟ„]
exact mul_le_of_le_one_right (div_nonneg zero_le_one hΟ„.le)
(by simpa only [Real.norm_eq_abs] using (norm_fst_le v).trans hv)
simpa only [one_div, div_eq_mul_inv, mul_comm, mul_one] using mul_le_mul_of_nonneg_right hn hC
lemma weighted_gradient_free {n : β„•} {Ο„ : ℝ} (hΟ„ : 0 < Ο„) {G V : Field n}
(hG : ContDiff ℝ ∞ G) {U : Set Base} (h : ModeDomain G U)
{s K C : ℝ} (hs : 0 < s) (hΟ„s : Ο„ ≀ s) (hs1 : s ≀ 1) (hK : 0 ≀ K) (hC : 0 ≀ C)
(hV : FreeCoefficient G U V) (q m : β„•)
(hc : ReconstructionCoefficientBound G U s (m + q + 2) K)
(hbV : WeightedBound U s (m + q + 2) C V) (v : Base) (hv : β€–vβ€– ≀ 1) :
WeightedBound U s m ((1 + gradientErrorConstant n m K q) * (C / Ο„))
(gradientAmplitude Ο„ (modeApprox Ο„ G V (fun _ => 0) q) v) := by
have he := weighted_gradientAmplitude_free_error hΟ„ hG h hs hΟ„s hs1 hK hC
hV.smooth hV.perpX hV.perpY hV.perpSecond q m hc hbV v hv
have hl := weighted_leadingDerivative hΟ„ h.isOpen.uniqueDiffOn hs hC hV.smooth
(hbV.mono_order (show m ≀ m + q + 2 by omega)) v hv
have hE := (gradientErrorConstant_pos n m q hK).le
have hZ := contDiffOn_modeApprox Ο„ h hV.smooth (f := fun _ => 0) contDiffOn_const q
have hsZ := contDiffOn_gradientAmplitude h.isOpen hZ Ο„ v
have hsL := contDiffOn_leadingDerivative Ο„ hV.smooth v
have ha := he.add h.isOpen.uniqueDiffOn hs.le (hsZ.sub hsL) hsL hl
have ha' := ha.congr (fun p _ => (sub_add_cancel _ _).symm)
apply ha'.mono_const
have hdiv : C / s ≀ C / Ο„ := div_le_div_of_nonneg_left hC hΟ„ hΟ„s
nlinarith [mul_le_mul_of_nonneg_left hdiv hE]
def modeMeanError {n : β„•} (Ο„ : ℝ) (G V W : Field n) (q : β„•) (v w : Base) : Base β†’ ℝ :=
fun p => ClosedSurfaceR4.QuadraticMean.zeroPair
(gradientAmplitude Ο„ (modeApprox Ο„ G V (fun _ => 0) q) v p)
(gradientAmplitude Ο„ (modeApprox Ο„ G W (fun _ => 0) q) w p) -
ClosedSurfaceR4.QuadraticMean.zeroPair (leadingDerivative Ο„ V v p) (leadingDerivative Ο„ W w p)
def meanErrorConstant (n m : β„•) (K : ℝ) (q : β„•) : ℝ :=
(n : ℝ) * 2 ^ m * gradientErrorConstant n m K q * (2 + gradientErrorConstant n m K q)
lemma meanErrorConstant_nonneg (n m q : β„•) {K : ℝ} (hK : 0 ≀ K) :
0 ≀ meanErrorConstant n m K q := by
have hE := (gradientErrorConstant_pos n m q hK).le
unfold meanErrorConstant
positivity
theorem weighted_modeMeanError {n : β„•} {Ο„ : ℝ} (hΟ„ : 0 < Ο„) {G V W : Field n}
(hG : ContDiff ℝ ∞ G) {U : Set Base} (h : ModeDomain G U)
{s K C D : ℝ} (hs : 0 < s) (hΟ„s : Ο„ ≀ s) (hs1 : s ≀ 1)
(hK : 0 ≀ K) (hC : 0 ≀ C) (hD : 0 ≀ D)
(hV : FreeCoefficient G U V) (hW : FreeCoefficient G U W) (q m : β„•)
(hc : ReconstructionCoefficientBound G U s (m + q + 2) K)
(hbV : WeightedBound U s (m + q + 2) C V)
(hbW : WeightedBound U s (m + q + 2) D W)
(v w : Base) (hv : β€–vβ€– ≀ 1) (hw : β€–wβ€– ≀ 1) :
WeightedBound U s m (meanErrorConstant n m K q * (C * D / (s * Ο„)))
(modeMeanError Ο„ G V W q v w) := by
have hE := (gradientErrorConstant_pos n m q hK).le
have hZV := contDiffOn_modeApprox Ο„ h hV.smooth (f := fun _ => 0) contDiffOn_const q
have hZW := contDiffOn_modeApprox Ο„ h hW.smooth (f := fun _ => 0) contDiffOn_const q
have hA := contDiffOn_leadingDerivative Ο„ hV.smooth v
have hB := contDiffOn_leadingDerivative Ο„ hW.smooth w
have hZ := contDiffOn_gradientAmplitude h.isOpen hZV Ο„ v
have hY := contDiffOn_gradientAmplitude h.isOpen hZW Ο„ w
have hbA := weighted_leadingDerivative hΟ„ h.isOpen.uniqueDiffOn hs hC hV.smooth
(hbV.mono_order (show m ≀ m + q + 2 by omega)) v hv
have hbY := weighted_gradient_free hΟ„ hG h hs hΟ„s hs1 hK hD hW q m hc hbW w hw
have heZ := weighted_gradientAmplitude_free_error hΟ„ hG h hs hΟ„s hs1 hK hC
hV.smooth hV.perpX hV.perpY hV.perpSecond q m hc hbV v hv
have heY := weighted_gradientAmplitude_free_error hΟ„ hG h hs hΟ„s hs1 hK hD
hW.smooth hW.perpX hW.perpY hW.perpSecond q m hc hbW w hw
have hnC : 0 ≀ C / Ο„ := div_nonneg hC hΟ„.le
have hnD : 0 ≀ (1 + gradientErrorConstant n m K q) * (D / Ο„) := by positivity
have hnE : 0 ≀ gradientErrorConstant n m K q * (C / s) := by positivity
have hnF : 0 ≀ gradientErrorConstant n m K q * (D / s) := by positivity
have hh := ClosedSurfaceR4.QuadraticMean.weighted_zeroPair_error h.isOpen.uniqueDiffOn hs
hnC hnD hnE hnF hA hB hZ hY hbA hbY heZ heY
have heq : (n : ℝ) * 2 ^ m *
(gradientErrorConstant n m K q * (C / s) *
((1 + gradientErrorConstant n m K q) * (D / Ο„)) +
C / Ο„ * (gradientErrorConstant n m K q * (D / s))) =
meanErrorConstant n m K q * (C * D / (s * Ο„)) := by
unfold meanErrorConstant
ring
rw [heq] at hh
exact hh
end ClosedSurfaceR4.SmallModes
end
end OAI