Download data/lean/OAI/Geometry/ProjectionBodies/SupportMeasures.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 15.1 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/ProjectionBodies/SupportMeasures.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Geometry/ProjectionBodies/SupportMeasures.lean
-
curl -L -o SupportMeasures.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/ProjectionBodies/SupportMeasures.lean
15.1 kB
| import OAI.Geometry.ProjectionBodies.Homothety | |
| namespace OAI | |
| universe uΞΉ | |
| noncomputable section | |
| open Set MeasureTheory Metric Filter Topology Function | |
| open scoped ENNReal NNReal RealInnerProductSpace Pointwise Gradient | |
| namespace PettyProjection | |
| open Spherical (Sphere norm_coe sigma mean) | |
| lemma gauge_pos_sphere {n : β} [NeZero n] {K : Set (Space n)} | |
| (hK : IsCompact K) (hc : Convex β K) (h0 : K β π (0 : Space n)) | |
| (u : Sphere n) : 0 < gauge K (u : Space n) := by | |
| let s : C(Sphere n,β) := β¨fun u => support K u,(support_continuous hK).comp continuous_subtype_valβ© | |
| have hs : β u,0 < s u := support_pos_of_nhds hK h0 | |
| have hw : wulff s = K := wulff_support hK hc β¨0,mem_of_mem_nhds h0β© | |
| rw [β hw,gauge_wulff_eq_max s hs] | |
| exact wulffMax_pos s hs (by intro h; simpa [h] using norm_coe u) | |
| def gaugeDensity {n : β} (K : Set (Space n)) (u : Sphere n) : ENNReal := | |
| ENNReal.ofReal ((gauge K (u : Space n))β»ΒΉ^n) | |
| def gaugeProjectionMeasure {n : β} (K : Set (Space n)) : Measure (Space n) := | |
| Measure.map (fun u : Sphere n => β (gauge K) (u : Space n)) | |
| ((sigma n).withDensity (gaugeDensity K)) | |
| lemma gaugeDensity_measurable {n : β} {K : Set (Space n)} | |
| (hc : Convex β K) (h0 : K β π (0 : Space n)) : Measurable (gaugeDensity K) := | |
| ENNReal.measurable_ofReal.comp ((((continuous_gauge hc h0).measurable.comp | |
| measurable_subtype_coe).inv).pow_const n) | |
| lemma gaugeDensity_toReal {n : β} (K : Set (Space n)) (u : Sphere n) : | |
| (gaugeDensity K u).toReal=(gauge K (u : Space n))β»ΒΉ^n := by | |
| exact ENNReal.toReal_ofReal (pow_nonneg (inv_nonneg.mpr (gauge_nonneg _)) _) | |
| lemma gaugeMeasure_integral {n : β} {K : Set (Space n)} | |
| (hc : Convex β K) (h0 : K β π (0 : Space n)) {f : Space n β β} | |
| (hf : StronglyMeasurable f) : | |
| β« x,f x βgaugeProjectionMeasure K = | |
| mean (fun u : Sphere n => (gauge K (u : Space n))β»ΒΉ^n*f (β (gauge K) (u : Space n))) := by | |
| have hm : Measurable (fun u : Sphere n => β (gauge K) (u : Space n)) := | |
| (measurable_gradient _).comp measurable_subtype_coe | |
| rw [gaugeProjectionMeasure,integral_map_of_stronglyMeasurable hm hf, | |
| integral_withDensity_eq_integral_toReal_smul (gaugeDensity_measurable hc h0) | |
| (Eventually.of_forall (fun _ => ENNReal.ofReal_lt_top))] | |
| simp only [gaugeDensity_toReal,smul_eq_mul,mean] | |
| lemma gaugeMeasure_finite {n : β} [NeZero n] {K : Set (Space n)} | |
| (hK : IsCompact K) (hc : Convex β K) (h0 : K β π (0 : Space n)) : | |
| IsFiniteMeasure (gaugeProjectionMeasure K) := by | |
| have hp := gauge_pos_sphere hK hc h0 | |
| have hcont : Continuous (fun u : Sphere n => (gauge K (u : Space n))β»ΒΉ^n) := | |
| (((continuous_gauge hc h0).comp continuous_subtype_val).invβ (fun u => (hp u).ne')).pow n | |
| have hi := hcont.integrable_of_hasCompactSupport (ΞΌ := sigma n) (HasCompactSupport.of_compactSpace _) | |
| have hf : β«β» u, gaugeDensity K u βsigma n β β€ := by | |
| unfold gaugeDensity | |
| rw [β ofReal_integral_eq_lintegral_ofReal hi | |
| (Eventually.of_forall (fun u => (pow_nonneg (inv_nonneg.mpr (hp u).le) n)))] | |
| exact ENNReal.ofReal_ne_top | |
| have := isFiniteMeasure_withDensity hf | |
| exact Measure.isFiniteMeasure_map _ _ | |
| lemma gaugeMeasure_mass {n : β} [NeZero n] {K : Set (Space n)} | |
| (hK : IsCompact K) (hc : Convex β K) (h0 : K β π (0 : Space n)) : | |
| (gaugeProjectionMeasure K).real univ=volume.real K/kappa n := by | |
| have hi := gaugeMeasure_integral hc h0 (f := fun _ => 1) stronglyMeasurable_const | |
| simp only [integral_const,smul_eq_mul,mul_one] at hi | |
| rw [hi,gauge_volume hc h0 (gauge_pos_sphere hK hc h0)] | |
| field_simp [(kappa_pos n).ne'] | |
| lemma gaugeMeasure_probability {n : β} [NeZero n] {K : Set (Space n)} | |
| (hK : IsCompact K) (hc : Convex β K) (h0 : K β π (0 : Space n)) | |
| (hv : volume.real K=kappa n) : IsProbabilityMeasure (gaugeProjectionMeasure K) := by | |
| constructor | |
| apply (ENNReal.toReal_eq_one_iff _).mp | |
| rw [show (gaugeProjectionMeasure K univ).toReal=(gaugeProjectionMeasure K).real univ from rfl, | |
| gaugeMeasure_mass hK hc h0,hv,div_self (kappa_pos n).ne'] | |
| lemma gaugeMeasure_bounded {n : β} {K : Set (Space n)} | |
| (hc : Convex β K) (h0 : K β π (0 : Space n)) : | |
| β B : β, 0 β€ B β§ βα΅ x βgaugeProjectionMeasure K, βxβ β€ B := by | |
| obtain β¨C,hCβ© := hc.lipschitz_gauge h0 | |
| refine β¨C,C.coe_nonneg,?_β© | |
| have hm : Measurable (fun u : Sphere n => β (gauge K) (u : Space n)) := | |
| (measurable_gradient _).comp measurable_subtype_coe | |
| apply (ae_map_iff hm.aemeasurable | |
| (measurableSet_le measurable_norm measurable_const)).mpr | |
| apply Eventually.of_forall | |
| intro u | |
| have he : ββ (gauge K) (u : Space n)β=βfderiv β (gauge K) (u : Space n)β := | |
| (InnerProductSpace.toDual β (Space n)).symm.norm_map _ | |
| rw [he] | |
| exact norm_fderiv_le_of_lipschitz β hC | |
| lemma boundedMeasure_integrable_continuous {n : β} {ΞΌ : Measure (Space n)} [IsFiniteMeasure ΞΌ] | |
| (hb : β B : β, 0 β€ B β§ βα΅ x βΞΌ, βxβ β€ B) {f : Space n β β} | |
| (hf : Continuous f) : Integrable f ΞΌ := by | |
| obtain β¨B,_,hBβ© := hb | |
| obtain β¨C,hCβ© := (isCompact_closedBall (0 : Space n) B).exists_bound_of_continuousOn hf.continuousOn | |
| apply (integrable_const C).mono' hf.aestronglyMeasurable | |
| filter_upwards [hB] with x hx | |
| exact hC x (by simpa only [mem_closedBall,dist_zero_right] using hx) | |
| lemma gaugeMeasure_shadow {n : β} [NeZero n] {K : Set (Space n)} | |
| (hK : IsCompact K) (hc : Convex β K) (h0 : K β π (0 : Space n)) (u : Sphere n) : | |
| 2*shadowVolume K u=n*kappa n*β« x,|βͺx,(u : Space n)β«| βgaugeProjectionMeasure K := by | |
| rw [gaugeMeasure_integral hc h0 (by fun_prop)] | |
| exact shadow_gauge_formula hK hc h0 u | |
| lemma gaugeMeasure_firstVariation {n : β} [NeZero n] {K M : Set (Space n)} | |
| (hK : IsCompact K) (hcK : Convex β K) (h0 : K β π (0 : Space n)) | |
| (hM : IsCompact M) (hcM : Convex β M) (hMn : M.Nonempty) : | |
| HasDerivWithinAt (fun t : β => volume.real (K+t β’ M)) | |
| (n*kappa n*β« x,support M x βgaugeProjectionMeasure K) (Ici 0) 0 := by | |
| rw [gaugeMeasure_integral hcK h0 (support_continuous hM).stronglyMeasurable] | |
| exact minkowski_volume_derivative hK hcK h0 hM hcM hMn | |
| end PettyProjection | |
| end | |
| noncomputable section | |
| open Set MeasureTheory Metric Filter Topology Function | |
| open scoped ENNReal NNReal RealInnerProductSpace Pointwise Gradient | |
| namespace PettyProjection | |
| open Spherical (Sphere norm_coe sigma mean) | |
| def supportFunctional {n : β} (ΞΌ : Measure (Space n)) (K : Set (Space n)) : β := | |
| β« x,support K x βΞΌ | |
| def normalizedVolume {n : β} (K : Set (Space n)) : β := | |
| volumeRoot K/(kappa n)^((n:β)β»ΒΉ) | |
| lemma normalizedVolume_formula {n : β} (K : Set (Space n)) : | |
| normalizedVolume K=(volume.real K/kappa n)^((n:β)β»ΒΉ) := by | |
| rw [Real.div_rpow measureReal_nonneg (kappa_pos n).le] | |
| rfl | |
| lemma gaugeMeasure_functional {n : β} (hn : 2 β€ n) [NeZero n] | |
| {K M : Set (Space n)} (hK : IsCompact K) (hcK : Convex β K) | |
| (h0 : K β π (0 : Space n)) (hv : volume.real K=kappa n) | |
| (hM : IsCompact M) (hcM : Convex β M) (hiM : (interior M).Nonempty) : | |
| normalizedVolume M β€ supportFunctional (gaugeProjectionMeasure K) M β§ | |
| (supportFunctional (gaugeProjectionMeasure K) M=normalizedVolume M β | |
| β z : Space n, β c : β, 0 < c β§ K=(fun x => z+c β’ x) '' M) := by | |
| have hiK : (interior K).Nonempty := β¨0,mem_interior_iff_mem_nhds.mpr h0β© | |
| have hV := gaugeMeasure_firstVariation hK hcK h0 hM hcM (hiM.mono interior_subset) | |
| obtain β¨hlow,heqβ© := minkowski_derivative_bound_equality hn hK hcK hiK hM hcM hiM hV | |
| have hnR : 0 < (n:β) := by exact_mod_cast (show 0<n by omega) | |
| have hp : 0 < (kappa n)^((n:β)β»ΒΉ) := Real.rpow_pos_of_pos (kappa_pos n) _ | |
| have hroot : volumeRoot K=(kappa n)^((n:β)β»ΒΉ) := by unfold volumeRoot; rw [hv] | |
| have hmul : n*kappa n*normalizedVolume M=(n:β)*volumeRoot K^(n-1)*volumeRoot M := by | |
| have hpow := volumeRoot_pow (show 0<n by omega) K | |
| have hsplit : volumeRoot K^(n-1)*volumeRoot K=kappa n := by | |
| rw [β pow_succ,Nat.sub_add_cancel (by omega),hpow,hv] | |
| rw [normalizedVolume,β hroot,β hsplit] | |
| field_simp [(volumeRoot_pos hK hiK).ne'] | |
| refine β¨?_,fun h => heq ?_β© | |
| Β· rw [β hmul] at hlow | |
| exact (mul_le_mul_iff_rightβ (mul_pos hnR (kappa_pos n))).mp hlow | |
| Β· change n*kappa n*supportFunctional (gaugeProjectionMeasure K) M=_ | |
| rw [h,hmul] | |
| lemma gaugeMeasure_self {n : β} [NeZero n] {K : Set (Space n)} | |
| (hK : IsCompact K) (hc : Convex β K) (h0 : K β π (0 : Space n)) : | |
| supportFunctional (gaugeProjectionMeasure K) K=volume.real K/kappa n := by | |
| have hKn : K.Nonempty := β¨0,mem_of_mem_nhds h0β© | |
| have hV := gaugeMeasure_firstVariation hK hc h0 hK hc hKn | |
| have hd : HasDerivAt (fun t : β => (1+t)^n*volume.real K) (n*volume.real K) 0 := by | |
| simpa only [id_eq,Pi.pow_apply,add_zero,one_pow,mul_one] using | |
| (((hasDerivAt_id (0:β)).const_add 1).pow n).mul_const (volume.real K) | |
| have he (t : β) (ht : t β Ici (0:β)) : | |
| volume.real (K+t β’ K)=(1+t)^n*volume.real K := by | |
| have he : K+t β’ K=(1+t) β’ K := by simpa only [one_smul] using (hc.add_smul (by norm_num : (0:β)β€1) ht).symm | |
| rw [he,volumeReal_smul_nonneg (by have := ht; change 0 β€ t at this; linarith : 0β€1+t)] | |
| simp only [finrank_euclideanSpace_fin] | |
| have hd' := hd.hasDerivWithinAt (s := Ici (0:β)) |>.congr he (he 0 (by norm_num)) | |
| have hdEq := (hV.derivWithin (uniqueDiffWithinAt_Ici (0:β))).symm.trans | |
| (hd'.derivWithin (uniqueDiffWithinAt_Ici (0:β))) | |
| change n*kappa n*supportFunctional (gaugeProjectionMeasure K) K=n*volume.real K at hdEq | |
| have hn : (n:β) β 0 := by exact_mod_cast (NeZero.ne n) | |
| apply (eq_div_iff (kappa_pos n).ne').mpr | |
| rw [mul_assoc] at hdEq | |
| simpa only [mul_comm] using (mul_left_cancelβ hn hdEq) | |
| lemma shadowVolume_pos {n : β} {K : Set (Space n)} | |
| (hK : IsCompact K) (h0 : K β π (0 : Space n)) (u : Space n) : 0 < shadowVolume K u := by | |
| obtain β¨r,hr,hrKβ© := Metric.mem_nhds_iff.mp h0 | |
| have hball : ball (0 : perpendicular u) r β (perpendicular u).orthogonalProjectionOnto '' K := by | |
| intro z hz | |
| refine β¨z,hrK ?_,?_β© | |
| Β· simpa only [mem_ball,dist_zero_right,Submodule.norm_coe] using hz | |
| Β· exact Submodule.orthogonalProjectionOnto_mem_subspace_eq_self z | |
| have hpos : 0 < (volume : Measure (perpendicular u)) | |
| ((perpendicular u).orthogonalProjectionOnto '' K) := | |
| (measure_ball_pos volume 0 hr).trans_le (measure_mono hball) | |
| exact ENNReal.toReal_pos hpos.ne' | |
| (hK.image (perpendicular u).orthogonalProjectionOnto.continuous).measure_ne_top | |
| end PettyProjection | |
| end | |
| noncomputable section | |
| open Set MeasureTheory Metric Filter Topology Function | |
| open scoped NNReal ENNReal RealInnerProductSpace Gradient | |
| namespace PettyProjection.Spherical | |
| lemma convex_deriv_limit {ΞΉ : Type uΞΉ} {l : Filter ΞΉ} {f : ΞΉ β β β β} | |
| {g : β β β} {d : ΞΉ β β} {a : β} | |
| (hf : β j, ConvexOn β univ (f j)) | |
| (hd : β j, HasDerivAt (f j) (d j) 0) | |
| (hg : HasDerivAt g a 0) | |
| (hlim : β t, Tendsto (fun j => f j t) l (π (g t))) : | |
| Tendsto d l (π a) := by | |
| have hs (t : β) : Tendsto (fun j => slope (f j) 0 t) l (π (slope g 0 t)) := by | |
| simpa only [slope, vsub_eq_sub, smul_eq_mul] using | |
| ((hlim t).sub (hlim 0)).const_mul (t - 0)β»ΒΉ | |
| rw [tendsto_order] | |
| constructor | |
| Β· intro b hb | |
| have hh : βαΆ t in π[<] (0 : β), b < slope g 0 t := | |
| (hg.tendsto_slope.mono_left (nhdsWithin_mono _ (by grind : Iio (0 : β) β {0}αΆ))).eventually | |
| (eventually_gt_nhds hb) | |
| have ht : βαΆ t in π[<] (0 : β), t < 0 := self_mem_nhdsWithin | |
| obtain β¨t, ht, hbtβ© := (ht.and hh).exists | |
| filter_upwards [(hs t).eventually (eventually_gt_nhds hbt)] with j hj | |
| have hj' := (hf j).slope_le_of_hasDerivAt (mem_univ t) (mem_univ 0) ht (hd j) | |
| rw [slope_comm] at hj' | |
| exact hj.trans_le hj' | |
| Β· intro b hb | |
| have hh : βαΆ t in π[>] (0 : β), slope g 0 t < b := | |
| (hg.tendsto_slope.mono_left (nhdsWithin_mono _ (by grind : Ioi (0 : β) β {0}αΆ))).eventually | |
| (eventually_lt_nhds hb) | |
| have ht : βαΆ t in π[>] (0 : β), 0 < t := self_mem_nhdsWithin | |
| obtain β¨t, ht, hbtβ© := (ht.and hh).exists | |
| filter_upwards [(hs t).eventually (eventually_lt_nhds hbt)] with j hj | |
| exact ((hf j).le_slope_of_hasDerivAt (mem_univ 0) (mem_univ t) ht (hd j)).trans_lt hj | |
| lemma convex_fderiv_apply_limit {n : β} {ΞΉ : Type uΞΉ} {l : Filter ΞΉ} | |
| {f : ΞΉ β Space n β β} {g : Space n β β} {x : Space n} | |
| (hf : β j, ConvexOn β univ (f j)) (hd : β j, DifferentiableAt β (f j) x) | |
| (hg : DifferentiableAt β g x) | |
| (hlim : β y, Tendsto (fun j => f j y) l (π (g y))) (w : Space n) : | |
| Tendsto (fun j => fderiv β (f j) x w) l (π (fderiv β g x w)) := by | |
| apply convex_deriv_limit (fun j => line_convex (hf j) x w) | |
| Β· intro j | |
| have h : HasFDerivAt (f j) (fderiv β (f j) x) (x + (0 : β) β’ w) := by | |
| simpa only [zero_smul, add_zero] using (hd j).hasFDerivAt | |
| exact h.comp_hasDerivAt 0 (line_hasDerivAt x w 0) | |
| Β· have h : HasFDerivAt g (fderiv β g x) (x + (0 : β) β’ w) := by | |
| simpa only [zero_smul, add_zero] using hg.hasFDerivAt | |
| exact h.comp_hasDerivAt 0 (line_hasDerivAt x w 0) | |
| Β· intro t | |
| exact hlim (x + t β’ w) | |
| lemma convex_gradient_limit {n : β} {ΞΉ : Type uΞΉ} {l : Filter ΞΉ} | |
| {f : ΞΉ β Space n β β} {g : Space n β β} {x : Space n} | |
| (hf : β j, ConvexOn β univ (f j)) (hd : β j, DifferentiableAt β (f j) x) | |
| (hg : DifferentiableAt β g x) | |
| (hlim : β y, Tendsto (fun j => f j y) l (π (g y))) : | |
| Tendsto (fun j => β (f j) x) l (π (β g x)) := by | |
| have hp : Tendsto (fun j i => (β (f j) x) i) l (π (fun i => (β g x) i)) := by | |
| apply tendsto_pi_nhds.mpr | |
| intro i | |
| have h := convex_fderiv_apply_limit hf hd hg hlim (EuclideanSpace.single i 1) | |
| simpa only [β inner_gradient_left, EuclideanSpace.inner_single_right, one_mul, conj_trivial] using h | |
| exact (PiLp.continuous_toLp 2 (fun _ : Fin n => β)).continuousAt.tendsto.comp hp | |
| lemma normSmooth_tendsto {n : β} (g : Seminorm β (Space n)) (x : Space n) : | |
| Tendsto (fun j => normSmooth g (shrinkingBump n j) x) atTop (π (g x)) := by | |
| obtain β¨C, hCβ© := seminorm_lipschitz n g | |
| apply tendsto_iff_dist_tendsto_zero.mpr | |
| exact squeeze_zero (fun _ => dist_nonneg) (fun j => normSmooth_dist_le g _ hC x) | |
| (by simpa only [mul_zero, shrinkingBump] using | |
| (tendsto_one_div_add_atTop_nhds_zero_nat (π := β)).const_mul (C : β)) | |
| lemma normSmooth_gradient_tendsto {n : β} (g : Seminorm β (Space n)) {x : Space n} | |
| (hx : DifferentiableAt β (g : Space n β β) x) : | |
| Tendsto (fun j => β (normSmooth g (shrinkingBump n j)) x) atTop (π (β (g : Space n β β) x)) := | |
| convex_gradient_limit (fun j => normSmooth_convex g _) | |
| (fun j => (normSmooth_contDiff g _).differentiable (by norm_num) x) hx (normSmooth_tendsto g) | |
| end PettyProjection.Spherical | |
| end | |
| end OAI | |