math / data /lean /OAI /Analysis /HenonEmden /LayerAssembly.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
10.3 kB
import OAI.Analysis.HenonEmden.LayerSplit
namespace OAI
universe uZ
section LayerAssembly
open MeasureTheory Set
open scoped ENNReal
namespace HenonLaneEmden.LayerPressure
open LineComponents IntervalGeometry LayerTonelli
variable {Z : Type uZ} [NormedAddCommGroup Z] [MeasurableSpace Z] [BorelSpace Z] [SecondCountableTopology Z]
noncomputable def sourceWeight (f h d : Z Γ— ℝ β†’ ℝ) (Ξ΄ : ℝ) (a : (Z Γ— ℝ) Γ— ℝ) : ℝ :=
lineWeight {s | ((a.1.1,a.2),s) ∈ parameterLayer f} (fun s => h (a.1.1,s))
(fun s => d (a.1.1,s)) Ξ΄ a.1.2
noncomputable def sourceLower (f : Z Γ— ℝ β†’ ℝ) (a : (Z Γ— ℝ) Γ— ℝ) : Z Γ— ℝ :=
(a.1.1,lowerEndpoint (parameterLayer f) ((a.1.1,a.2),a.1.2))
noncomputable def sourceUpper (f : Z Γ— ℝ β†’ ℝ) (a : (Z Γ— ℝ) Γ— ℝ) : Z Γ— ℝ :=
(a.1.1,upperEndpoint (parameterLayer f) ((a.1.1,a.2),a.1.2))
omit [SecondCountableTopology Z] in
lemma measurable_sourceWeight {f h d : Z Γ— ℝ β†’ ℝ} (hf : IsOpen (parameterLayer f))
(hh : Continuous h) (hd : Continuous d) (Ξ΄ : ℝ) : Measurable (sourceWeight f h d Ξ΄) := by
let h' : (Z Γ— ℝ) Γ— ℝ β†’ ℝ := fun z => h (z.1.1,z.2)
let d' : (Z Γ— ℝ) Γ— ℝ β†’ ℝ := fun z => d (z.1.1,z.2)
have hh' : Continuous h' := hh.comp (continuous_fst.fst.prodMk continuous_snd)
have hd' : Continuous d' := hd.comp (continuous_fst.fst.prodMk continuous_snd)
have he : Measurable (fun p : (Z Γ— ℝ) Γ— ℝ =>
(setWeight (fun s => h' (p.1,s)) (fun s => d' (p.1,s)) Ξ΄
(connectedComponentIn {s | (p.1,s) ∈ parameterLayer f} p.2)).toReal) :=
(measurable_parametric_setWeight hf hh' hd' Ξ΄).ennreal_toReal
have hem := he.comp (tripleSwap : (Z Γ— ℝ) Γ— ℝ ≃ᡐ (Z Γ— ℝ) Γ— ℝ).measurable
unfold sourceWeight lineWeight
simpa only [Function.comp_def,tripleSwap_apply,h',d'] using hem
omit [SecondCountableTopology Z] in
lemma measurable_sourceLower {f : Z Γ— ℝ β†’ ℝ} (hf : IsOpen (parameterLayer f)) :
Measurable (sourceLower f) := by
exact measurable_fst.fst.prodMk ((measurable_lowerEndpoint hf).comp
(measurable_fst.fst.prodMk measurable_snd |>.prodMk measurable_fst.snd))
omit [SecondCountableTopology Z] in
lemma measurable_sourceUpper {f : Z Γ— ℝ β†’ ℝ} (hf : IsOpen (parameterLayer f)) :
Measurable (sourceUpper f) := by
exact measurable_fst.fst.prodMk ((measurable_upperEndpoint hf).comp
(measurable_fst.fst.prodMk measurable_snd |>.prodMk measurable_fst.snd))
omit [NormedAddCommGroup Z] [MeasurableSpace Z] [BorelSpace Z] [SecondCountableTopology Z] in
lemma sourceWeight_nonneg (f h d : Z Γ— ℝ β†’ ℝ) (Ξ΄ : ℝ) (a : (Z Γ— ℝ) Γ— ℝ) :
0 ≀ sourceWeight f h d Ξ΄ a := ENNReal.toReal_nonneg
omit [NormedAddCommGroup Z] [MeasurableSpace Z] [BorelSpace Z] [SecondCountableTopology Z] in
lemma sourceWeight_le {f h d : Z Γ— ℝ β†’ ℝ} {Ξ΄ : ℝ} {a : (Z Γ— ℝ) Γ— ℝ}
(ha : a ∈ sourceSubgraph f) (hh : 0 ≀ h a.1) : sourceWeight f h d Ξ΄ a ≀ h a.1 :=
lineWeight_le ha hh
noncomputable def splitKernel (n : β„•) (C : ℝ) (z : (Z Γ— ℝ) Γ— (Z Γ— ℝ)) : ℝ :=
kernel n β€–z.1.1-z.2.1β€– C (z.1.2-z.2.2)
noncomputable def splitDirection (z : (Z Γ— ℝ) Γ— (Z Γ— ℝ)) : ℝ :=
(z.1.2-z.2.2)^2/(β€–z.1.1-z.2.1β€–^2+(z.1.2-z.2.2)^2)
lemma measurable_splitKernel (n : β„•) (C : ℝ) : Measurable (splitKernel (Z := Z) n C) := by
unfold splitKernel kernel
fun_prop
lemma measurable_splitDirection : Measurable (splitDirection (Z := Z)) := by
unfold splitDirection
fun_prop
noncomputable def pairLeft (n : β„•) (C : ℝ) (f g h d : Z Γ— ℝ β†’ ℝ) (Ξ΄ : ℝ)
(z : ((Z Γ— ℝ) Γ— ℝ) Γ— ((Z Γ— ℝ) Γ— ℝ)) : ℝ :=
(sourceWeight f h d Ξ΄ z.1+sourceWeight g h d Ξ΄ z.2)*splitKernel n C (z.1.1,z.2.1)
noncomputable def pairRight (n : β„•) (C : ℝ) (f g h d : Z Γ— ℝ β†’ ℝ) (Ξ΄ : ℝ)
(z : ((Z Γ— ℝ) Γ— ℝ) Γ— ((Z Γ— ℝ) Γ— ℝ)) : ℝ :=
sourceWeight f h d Ξ΄ z.1 *
((splitKernel n C (sourceLower f z.1,z.2.1)+splitKernel n C (sourceUpper f z.1,z.2.1))/2) +
sourceWeight g h d Ξ΄ z.2 *
((splitKernel n C (z.1.1,sourceLower g z.2)+splitKernel n C (z.1.1,sourceUpper g z.2))/2) +
(((n:ℝ)-2)*h z.1.1*splitDirection (z.1.1,z.2.1)+
|sourceWeight f h d Ξ΄ z.1-sourceWeight g h d Ξ΄ z.2|)*splitKernel n C (z.1.1,z.2.1)
lemma measurable_pairLeft (n : β„•) (C : ℝ) {f g h d : Z Γ— ℝ β†’ ℝ}
(hf : IsOpen (parameterLayer f)) (hg : IsOpen (parameterLayer g))
(hh : Continuous h) (hd : Continuous d) (Ξ΄ : ℝ) : Measurable (pairLeft n C f g h d Ξ΄) := by
unfold pairLeft
have hχf := measurable_sourceWeight hf hh hd δ
have hχg := measurable_sourceWeight hg hh hd δ
have hk := measurable_splitKernel (Z := Z) n C
fun_prop
lemma measurable_pairRight (n : β„•) (C : ℝ) {f g h d : Z Γ— ℝ β†’ ℝ}
(hf : IsOpen (parameterLayer f)) (hg : IsOpen (parameterLayer g))
(hh : Continuous h) (hd : Continuous d) (Ξ΄ : ℝ) : Measurable (pairRight n C f g h d Ξ΄) := by
unfold pairRight
have hχf := measurable_sourceWeight hf hh hd δ
have hχg := measurable_sourceWeight hg hh hd δ
have hlof := measurable_sourceLower hf
have hlog := measurable_sourceLower hg
have hhif := measurable_sourceUpper hf
have hhig := measurable_sourceUpper hg
have hk := measurable_splitKernel (Z := Z) n C
have hD := measurable_splitDirection (Z := Z)
fun_prop
omit [MeasurableSpace Z] [BorelSpace Z] [SecondCountableTopology Z] in
lemma weighted_leftAverage_eq {f h d : Z Γ— ℝ β†’ ℝ} (hf : IsOpen (parameterLayer f))
(Ξ΄ : ℝ) {p : Z Γ— ℝ} {s : ℝ} (hs : (p,s) ∈ parameterLayer f)
(k : ℝ β†’ ℝ) (y : ℝ) :
lineWeight {s | (p,s) ∈ parameterLayer f} (fun s => h (p.1,s)) (fun s => d (p.1,s)) δ s *
leftAverage {s | (p,s) ∈ parameterLayer f} k s y =
lineWeight {s | (p,s) ∈ parameterLayer f} (fun s => h (p.1,s)) (fun s => d (p.1,s)) δ s *
((k (lowerEndpoint (parameterLayer f) (p,s)-y)+k (upperEndpoint (parameterLayer f) (p,s)-y))/2) := by
by_cases hz : lineWeight {s | (p,s) ∈ parameterLayer f} (fun s => h (p.1,s))
(fun s => d (p.1,s)) Ξ΄ s = 0
Β· rw [hz,zero_mul,zero_mul]
Β· have he := relative_endpoints_eq_of_weight_pos hf hs
(lt_of_le_of_ne (lineWeight_nonneg _ _ _ _ _) (Ne.symm hz))
simp only [leftAverage,he.1,he.2]
omit [MeasurableSpace Z] [BorelSpace Z] [SecondCountableTopology Z] in
lemma weighted_rightAverage_eq {g h d : Z Γ— ℝ β†’ ℝ} (hg : IsOpen (parameterLayer g))
(Ξ΄ : ℝ) {p : Z Γ— ℝ} {s : ℝ} (hs : (p,s) ∈ parameterLayer g)
(k : ℝ β†’ ℝ) (x : ℝ) :
lineWeight {s | (p,s) ∈ parameterLayer g} (fun s => h (p.1,s)) (fun s => d (p.1,s)) δ s *
rightAverage {s | (p,s) ∈ parameterLayer g} k x s =
lineWeight {s | (p,s) ∈ parameterLayer g} (fun s => h (p.1,s)) (fun s => d (p.1,s)) δ s *
((k (x-lowerEndpoint (parameterLayer g) (p,s))+k (x-upperEndpoint (parameterLayer g) (p,s)))/2) := by
by_cases hz : lineWeight {s | (p,s) ∈ parameterLayer g} (fun s => h (p.1,s))
(fun s => d (p.1,s)) Ξ΄ s = 0
Β· rw [hz,zero_mul,zero_mul]
Β· have he := relative_endpoints_eq_of_weight_pos hg hs
(lt_of_le_of_ne (lineWeight_nonneg _ _ _ _ _) (Ne.symm hz))
simp only [rightAverage,he.1,he.2]
omit [MeasurableSpace Z] [BorelSpace Z] [SecondCountableTopology Z] in
lemma pair_line_comparison (n : β„•) (hn : 3 ≀ n) {C : ℝ} (hC : 0 ≀ C)
{f g h d : Z Γ— ℝ β†’ ℝ} (hf : IsOpen (parameterLayer f)) (hg : IsOpen (parameterLayer g))
(hhn : βˆ€ x, 0 ≀ h x) (Ξ΄ : ℝ) (p : (Z Γ— ℝ) Γ— (Z Γ— ℝ)) (hp : p.1.1 β‰  p.2.1) :
(∫⁻ s : ℝ Γ— ℝ in {s | (p.1,s) ∈ parameterLayer f} Γ—Λ’ {s | (p.2,s) ∈ parameterLayer g},
ENNReal.ofReal (pairLeft n C f g h d Ξ΄ (((p.1.1,s.1),p.1.2),((p.2.1,s.2),p.2.2)))) ≀
∫⁻ s : ℝ Γ— ℝ in {s | (p.1,s) ∈ parameterLayer f} Γ—Λ’ {s | (p.2,s) ∈ parameterLayer g},
ENNReal.ofReal (pairRight n C f g h d Ξ΄ (((p.1.1,s.1),p.1.2),((p.2.1,s.2),p.2.2))) := by
have hfo := isOpen_section hf p.1
have hgo := isOpen_section hg p.2
have hl : 0 < β€–p.1.1-p.2.1β€– := norm_pos_iff.mpr (sub_ne_zero.mpr hp)
have hh := weighted_source_layer_comparison n hn hfo hgo
(fun s => h (p.1.1,s)) (fun s => h (p.2.1,s))
(fun s => d (p.1.1,s)) (fun s => d (p.2.1,s)) Ξ΄ hl hC (fun x _ => hhn _)
change (∫⁻ s in _, ENNReal.ofReal _) ≀ _ at hh
convert hh using 1
Β· rfl
Β· apply setLIntegral_congr_fun (hfo.measurableSet.prod hgo.measurableSet)
intro s hs
unfold pairRight splitKernel splitDirection sourceLower sourceUpper sourceWeight
dsimp only
rw [weighted_leftAverage_eq hf Ξ΄ hs.1,weighted_rightAverage_eq hg Ξ΄ hs.2]
lemma ae_distinct_transverse (ΞΌ : Measure Z) [SFinite ΞΌ] [NullSingletonClass ΞΌ] :
βˆ€α΅ p : (Z Γ— ℝ) Γ— (Z Γ— ℝ) βˆ‚(ΞΌ.prod volume).prod (ΞΌ.prod volume), p.1.1 β‰  p.2.1 := by
apply (Measure.ae_prod_iff_ae_ae (by measurability)).mpr
apply ae_of_all
intro x
apply (Measure.ae_prod_iff_ae_ae (by measurability)).mpr
filter_upwards [ΞΌ.ae_ne x.1] with z hz
exact ae_of_all _ (fun _ => Ne.symm hz)
/-- The globally integrated nonnegative interval comparison. No source,
endpoint, or energy integrability is assumed; all terms are still extended values. -/
lemma global_nonnegative_pressure (ΞΌ : Measure Z) [SFinite ΞΌ] [NullSingletonClass ΞΌ]
(n : β„•) (hn : 3 ≀ n) {C : ℝ} (hC : 0 ≀ C)
{f g h d : Z Γ— ℝ β†’ ℝ} (hf : Measurable f) (hg : Measurable g)
(hfo : IsOpen (parameterLayer f)) (hgo : IsOpen (parameterLayer g))
(hh : Continuous h) (hd : Continuous d) (hhn : βˆ€ x, 0 ≀ h x) (Ξ΄ : ℝ) :
(∫⁻ z, ENNReal.ofReal (pairLeft n C f g h d δ z)
βˆ‚(layerMeasure (ΞΌ.prod volume) f).prod (layerMeasure (ΞΌ.prod volume) g)) ≀
∫⁻ z, ENNReal.ofReal (pairRight n C f g h d δ z)
βˆ‚(layerMeasure (ΞΌ.prod volume) f).prod (layerMeasure (ΞΌ.prod volume) g) := by
rw [lintegral_pair_layer_split ΞΌ hf hg (measurable_pairLeft n C hfo hgo hh hd Ξ΄).ennreal_ofReal,
lintegral_pair_layer_split ΞΌ hf hg (measurable_pairRight n C hfo hgo hh hd Ξ΄).ennreal_ofReal]
apply lintegral_mono_ae
filter_upwards [ae_distinct_transverse ΞΌ] with p hp
exact pair_line_comparison n hn hC hfo hgo hhn Ξ΄ p hp
end HenonLaneEmden.LayerPressure
end LayerAssembly
end OAI