Download lean/OAI/Geometry/CubicTorus/Regularity/SmoothApproxLip.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 43.3 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Geometry/CubicTorus/Regularity/SmoothApproxLip.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Geometry/CubicTorus/Regularity/SmoothApproxLip.lean
-
curl -L -o SmoothApproxLip.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Geometry/CubicTorus/Regularity/SmoothApproxLip.lean
43.3 kB
| import Mathlib | |
| import OAI.Geometry.CubicTorus.Regularity.BVRegularity | |
| namespace OAI | |
| section | |
| section | |
| noncomputable section | |
| open MeasureTheory Set | |
| open scoped ENNReal | |
| namespace CubicTorus | |
| lemma characteristic_dichotomy (E : Set Torus) (x : Torus) : | |
| characteristic E x = 0 ∨ characteristic E x = 1 := by | |
| classical | |
| by_cases hx : x ∈ E <;> simp [characteristic, hx] | |
| lemma characteristic_bound (E : Set Torus) (x : Torus) : |characteristic E x| ≤ 1 := by | |
| rcases characteristic_dichotomy E x with h | h <;> simp [h] | |
| lemma setIntegral_lift_measurable {f : Torus → ℝ} (hf : Measurable f) | |
| {E : Set Torus} (hE : MeasurableSet E) : | |
| (∫ z in E, f z ∂torusVolume) = | |
| ∫ x in fundamentalCube ∩ quotientMap ⁻¹' E, f (quotientMap x) := by | |
| change (∫ z in E, f z ∂Measure.map quotientMap (volume.restrict fundamentalCube)) = _ | |
| rw [setIntegral_map hE hf.aestronglyMeasurable measurable_quotientMap.aemeasurable, | |
| Measure.restrict_restrict (measurable_quotientMap hE), inter_comm] | |
| lemma torus_test_translation_bound {E : Set Torus} (hE : MeasurableSet E) | |
| (hP : perimeter E ≠ ⊤) {g : Torus → ℝ} (hg : Measurable g) | |
| (hb : ∀ x, |g x| ≤ 1) (a : Cover) : | |
| |∫ x in E, (g (x + quotientMap a) - g x) ∂torusVolume| | |
| ≤ ‖a‖ * (perimeter E).toReal := by | |
| rw [setIntegral_lift_measurable (f := fun x => g (x + quotientMap a) - g x) | |
| ((hg.comp (measurable_id.add_const _)).sub hg) hE] | |
| have hp : ∀ n x, g (quotientMap (x + latticeVector n)) = g (quotientMap x) := by | |
| intro n x | |
| rw [quotientMap_add, quotientMap_latticeVector, add_zero] | |
| simpa only [Function.comp_def, quotientMap_add] using | |
| measurable_test_translation_bound hP (hg.comp measurable_quotientMap) hp | |
| (fun x => hb (quotientMap x)) a | |
| lemma integral_difference_test {E : Set Torus} (hE : MeasurableSet E) | |
| {g : Torus → ℝ} (hg : Measurable g) (hb : ∀ x, |g x| ≤ 1) (a : Torus) : | |
| (∫ x in E, (g (x + a) - g x) ∂torusVolume) = | |
| ∫ x, (characteristic E (x - a) - characteristic E x) * g x ∂torusVolume := by | |
| have hi₁ : Integrable (fun x => characteristic E x * g (x + a)) torusVolume := by | |
| apply Integrable.of_bound ((measurable_characteristic hE).mul | |
| (hg.comp (measurable_id.add_const a))).aestronglyMeasurable 1 | |
| exact Filter.Eventually.of_forall fun x => by | |
| dsimp only [Pi.mul_apply, Function.comp_def, id_eq] | |
| rw [Real.norm_eq_abs, abs_mul] | |
| exact (mul_le_of_le_one_left (abs_nonneg _) (characteristic_bound E x)).trans (hb (x + a)) | |
| have hi₂ : Integrable (fun x => characteristic E x * g x) torusVolume := by | |
| apply Integrable.of_bound ((measurable_characteristic hE).mul hg).aestronglyMeasurable 1 | |
| exact Filter.Eventually.of_forall fun x => by | |
| dsimp only [Pi.mul_apply, Function.comp_def, id_eq] | |
| rw [Real.norm_eq_abs, abs_mul] | |
| exact (mul_le_of_le_one_left (abs_nonneg _) (characteristic_bound E x)).trans (hb x) | |
| have hi₃ : Integrable (fun x => characteristic E (x - a) * g x) torusVolume := by | |
| apply Integrable.of_bound (((measurable_characteristic hE).comp | |
| (measurable_id.sub_const a)).mul hg).aestronglyMeasurable 1 | |
| exact Filter.Eventually.of_forall fun x => by | |
| dsimp only [Pi.mul_apply, Function.comp_def, id_eq] | |
| rw [Real.norm_eq_abs, abs_mul] | |
| exact (mul_le_of_le_one_left (abs_nonneg _) (characteristic_bound E (x - a))).trans (hb x) | |
| have hs := (measurePreserving_add_right torusVolume a).integral_comp | |
| (Homeomorph.addRight a).measurableEmbedding (fun x => characteristic E (x - a) * g x) | |
| simp only [add_sub_cancel_right] at hs | |
| calc | |
| _ = ∫ x, characteristic E x * (g (x + a) - g x) ∂torusVolume := by | |
| rw [← integral_indicator hE] | |
| apply integral_congr_ae | |
| exact Filter.Eventually.of_forall fun x => by | |
| classical | |
| by_cases hx : x ∈ E <;> simp [characteristic, hx] | |
| _ = (∫ x, characteristic E x * g (x + a) ∂torusVolume) - | |
| ∫ x, characteristic E x * g x ∂torusVolume := by | |
| simp_rw [mul_sub] | |
| exact integral_sub hi₁ hi₂ | |
| _ = (∫ x, characteristic E (x - a) * g x ∂torusVolume) - | |
| ∫ x, characteristic E x * g x ∂torusVolume := by rw [hs] | |
| _ = _ := by simp_rw [sub_mul]; exact (integral_sub hi₃ hi₂).symm | |
| theorem characteristic_translation_bound {E : Set Torus} (hE : MeasurableSet E) | |
| (hP : perimeter E ≠ ⊤) (a : Cover) : | |
| (∫ x, |characteristic E (x - quotientMap a) - characteristic E x| ∂torusVolume) | |
| ≤ ‖a‖ * (perimeter E).toReal := by | |
| let g : Torus → ℝ := fun x => characteristic E (x - quotientMap a) - characteristic E x | |
| have hg : Measurable g := ((measurable_characteristic hE).comp | |
| (measurable_id.sub_const _)).sub (measurable_characteristic hE) | |
| have hb (x) : |g x| ≤ 1 := by | |
| rcases characteristic_dichotomy E (x - quotientMap a) with h | h <;> | |
| rcases characteristic_dichotomy E x with h' | h' <;> simp [g, h, h'] | |
| have heq (x) : g x * g x = |g x| := by | |
| rcases characteristic_dichotomy E (x - quotientMap a) with h | h <;> | |
| rcases characteristic_dichotomy E x with h' | h' <;> simp [g, h, h'] | |
| have h := torus_test_translation_bound hE hP hg hb a | |
| rw [integral_difference_test hE hg hb] at h | |
| change |∫ x, g x * g x ∂torusVolume| ≤ _ at h | |
| simp_rw [heq] at h | |
| rw [abs_of_nonneg (integral_nonneg fun x => abs_nonneg (g x))] at h | |
| exact h | |
| end CubicTorus | |
| namespace CubicTorus | |
| open Filter | |
| open scoped Topology Convolution | |
| def smoothApproxLip (n : ℕ) : NNReal := | |
| ⟨∫ y : Cover, ‖fderiv ℝ ((mollifier n).normed volume) y‖, | |
| integral_nonneg fun _ => norm_nonneg _⟩ | |
| lemma smoothApprox_lipschitz {g : Cover → ℝ} (hg : Measurable g) | |
| (hb : ∀ x, |g x| ≤ 1) (n : ℕ) : LipschitzWith (smoothApproxLip n) (smoothApprox g n) := by | |
| have hφ := (mollifier n).contDiff_normed (μ := volume) (n := (⊤ : ℕ∞)) | |
| have hφc := (mollifier n).hasCompactSupport_normed (μ := volume) | |
| have hd (x) := hφc.hasFDerivAt_convolution_left (ContinuousLinearMap.lsmul ℝ ℝ) | |
| (hφ.of_le (by simp : (1 : WithTop ℕ∞) ≤ (⊤ : ℕ∞))) | |
| (locallyIntegrable_of_bounded hg hb) x | |
| have hdi : Integrable (fun y : Cover => ‖fderiv ℝ ((mollifier n).normed volume) y‖) | |
| volume := | |
| (hφ.continuous_fderiv (by simp)).norm.integrable_of_hasCompactSupport (hφc.fderiv ℝ).norm | |
| apply lipschitzWith_of_nnnorm_fderiv_le ((smoothApprox_contDiff hg hb n).differentiable (by simp)) | |
| intro x | |
| apply NNReal.coe_le_coe.mp | |
| change ‖fderiv ℝ (smoothApprox g n) x‖ ≤ _ | |
| change ‖fderiv ℝ (((mollifier n).normed volume) ⋆ g) x‖ ≤ _ | |
| rw [(hd x).fderiv, convolution_def] | |
| apply norm_integral_le_of_norm_le hdi | |
| exact Eventually.of_forall fun y => by | |
| have heq : ((ContinuousLinearMap.lsmul ℝ ℝ).precompL Cover | |
| (fderiv ℝ ((mollifier n).normed volume) y)) (g (x - y)) = | |
| g (x - y) • fderiv ℝ ((mollifier n).normed volume) y := by | |
| ext v | |
| simp [ContinuousLinearMap.precompL_apply, mul_comm] | |
| rw [heq, norm_smul, Real.norm_eq_abs] | |
| exact mul_le_of_le_one_left (norm_nonneg _) (hb (x - y)) | |
| end CubicTorus | |
| namespace CubicTorus | |
| open Filter | |
| open scoped Topology Convolution | |
| lemma quotientMap_sub (x y : Cover) : quotientMap (x - y) = quotientMap x - quotientMap y := by | |
| simp only [sub_eq_add_neg, quotientMap_add, quotientMap_neg] | |
| def torusApprox (E : Set Torus) (n : ℕ) (x : Torus) : ℝ := | |
| smoothApprox (characteristic E ∘ quotientMap) n (representative x) | |
| lemma torusApprox_measurable {E : Set Torus} (hE : MeasurableSet E) (n : ℕ) : | |
| Measurable (torusApprox E n) := | |
| (smoothApprox_contDiff ((measurable_characteristic hE).comp measurable_quotientMap) | |
| (fun x => characteristic_bound E (quotientMap x)) n).continuous.measurable.comp | |
| measurable_representative | |
| lemma torusApprox_bound (E : Set Torus) (n : ℕ) (x : Torus) : |torusApprox E n x| ≤ 1 := | |
| smoothApprox_bound (fun y => characteristic_bound E (quotientMap y)) n (representative x) | |
| lemma torusApprox_integrable {E : Set Torus} (hE : MeasurableSet E) (n : ℕ) : | |
| Integrable (torusApprox E n) torusVolume := | |
| Integrable.of_bound (torusApprox_measurable hE n).aestronglyMeasurable 1 | |
| (Eventually.of_forall (torusApprox_bound E n)) | |
| lemma integrable_characteristic {E : Set Torus} (hE : MeasurableSet E) : | |
| Integrable (characteristic E) torusVolume := (integrable_const 1).indicator hE | |
| lemma torusApprox_sub_eq_integral {E : Set Torus} (hE : MeasurableSet E) (n : ℕ) (x : Torus) : | |
| torusApprox E n x - characteristic E x = | |
| ∫ y : Cover, (mollifier n).normed volume y * | |
| (characteristic E (x - quotientMap y) - characteristic E x) := by | |
| have hm : Measurable (fun y => characteristic E (x - quotientMap y)) := | |
| (measurable_characteristic hE).comp (measurable_const.sub measurable_quotientMap) | |
| have hi := ((mollifier n).integrable_normed (μ := volume)).mul_bdd hm.aestronglyMeasurable | |
| (Eventually.of_forall fun y => characteristic_bound E (x - quotientMap y)) | |
| simp_rw [mul_sub] | |
| rw [integral_sub hi ((mollifier n).integrable_normed.mul_const _), | |
| integral_mul_const, (mollifier n).integral_normed, one_mul] | |
| congr 1 | |
| simp only [torusApprox, smoothApprox, convolution_def, ContinuousLinearMap.lsmul_apply, | |
| smul_eq_mul, Function.comp_def, quotientMap_sub, quotientMap_representative] | |
| theorem torusApprox_error {E : Set Torus} (hE : MeasurableSet E) (hP : perimeter E ≠ ⊤) | |
| (n : ℕ) : | |
| (∫ x, |torusApprox E n x - characteristic E x| ∂torusVolume) ≤ | |
| (mollifier n).rOut * (perimeter E).toReal := by | |
| let φ : Cover → ℝ := (mollifier n).normed volume | |
| let d : Torus × Cover → ℝ := fun z => | |
| |characteristic E (z.1 - quotientMap z.2) - characteristic E z.1| | |
| have hφ : Integrable φ volume := (mollifier n).integrable_normed | |
| have hφm : Measurable φ := ((mollifier n).contDiff_normed (n := (⊤ : ℕ∞))).continuous.measurable | |
| have hd : Measurable d := by | |
| exact (((measurable_characteristic hE).comp | |
| (measurable_fst.sub (measurable_quotientMap.comp measurable_snd))).sub | |
| ((measurable_characteristic hE).comp measurable_fst)).abs | |
| have hd_bound (z) : |d z| ≤ 1 := by | |
| rcases characteristic_dichotomy E (z.1 - quotientMap z.2) with h | h <;> | |
| rcases characteristic_dichotomy E z.1 with h' | h' <;> simp [d, h, h'] | |
| have hbase : Integrable (fun z : Torus × Cover => φ z.2) (torusVolume.prod volume) := by | |
| simpa only [one_mul] using (integrable_const (1 : ℝ) (μ := torusVolume)).mul_prod hφ | |
| have hprod : Integrable (fun z : Torus × Cover => φ z.2 * d z) (torusVolume.prod volume) := | |
| hbase.mul_bdd hd.aestronglyMeasurable (Eventually.of_forall hd_bound) | |
| have hip (x : Torus) : Integrable | |
| (fun y : Cover => φ y * (characteristic E (x - quotientMap y) - characteristic E x)) volume := by | |
| apply hφ.mul_bdd (c := 1) | |
| (((measurable_characteristic hE).comp (measurable_const.sub measurable_quotientMap)).sub | |
| measurable_const).aestronglyMeasurable | |
| exact Eventually.of_forall fun y => by | |
| rcases characteristic_dichotomy E (x - quotientMap y) with h | h <;> | |
| rcases characteristic_dichotomy E x with h' | h' <;> simp [h, h'] | |
| have hinside (x : Torus) : |torusApprox E n x - characteristic E x| ≤ | |
| ∫ y : Cover, φ y * d (x, y) := by | |
| rw [torusApprox_sub_eq_integral hE] | |
| calc | |
| _ ≤ ∫ y : Cover, ‖φ y * (characteristic E (x - quotientMap y) - characteristic E x)‖ := | |
| norm_integral_le_integral_norm _ | |
| _ = _ := by | |
| apply integral_congr_ae | |
| exact Eventually.of_forall fun y => by | |
| simp [d, Real.norm_eq_abs, abs_of_nonneg ((mollifier n).nonneg_normed y), φ] | |
| have hipx (y : Cover) : Integrable (fun x : Torus => d (x, y)) torusVolume := by | |
| apply Integrable.of_bound (hd.comp (measurable_id.prodMk measurable_const)).aestronglyMeasurable 1 | |
| exact Eventually.of_forall fun x => hd_bound (x, y) | |
| have htrans (y : Cover) : (∫ x, d (x, y) ∂torusVolume) ≤ ‖y‖ * (perimeter E).toReal := | |
| characteristic_translation_bound hE hP y | |
| have hkernel (y : Cover) : φ y * (∫ x, d (x, y) ∂torusVolume) ≤ | |
| φ y * ((mollifier n).rOut * (perimeter E).toReal) := by | |
| by_cases hy : φ y = 0 | |
| · simp [hy] | |
| have hy' : y ∈ Metric.ball (0 : Cover) (mollifier n).rOut := by | |
| rw [← (mollifier n).support_normed_eq (μ := (volume : Measure Cover))] | |
| exact hy | |
| have hnorm : ‖y‖ ≤ (mollifier n).rOut := le_of_lt (by simpa using hy') | |
| exact mul_le_mul_of_nonneg_left | |
| ((htrans y).trans (mul_le_mul_of_nonneg_right hnorm ENNReal.toReal_nonneg)) | |
| ((mollifier n).nonneg_normed y) | |
| calc | |
| _ ≤ ∫ x, ∫ y : Cover, φ y * d (x, y) ∂volume ∂torusVolume := by | |
| exact integral_mono ((torusApprox_integrable hE n).sub (integrable_characteristic hE)).abs | |
| hprod.integral_prod_left hinside | |
| _ = ∫ y : Cover, ∫ x, φ y * d (x, y) ∂torusVolume := integral_integral_swap hprod | |
| _ = ∫ y : Cover, φ y * (∫ x, d (x, y) ∂torusVolume) := by | |
| simp_rw [integral_const_mul] | |
| _ ≤ ∫ y : Cover, φ y * ((mollifier n).rOut * (perimeter E).toReal) := by | |
| apply integral_mono _ (hφ.mul_const _) hkernel | |
| simpa only [integral_const_mul] using hprod.integral_prod_right | |
| _ = _ := by rw [integral_mul_const, (mollifier n).integral_normed, one_mul] | |
| end CubicTorus | |
| namespace CubicTorus | |
| open Filter | |
| open scoped Topology | |
| def closedFundamentalCube : Set Cover := | |
| (WithLp.toLp 2) '' (Icc (0 : Fin 3 → ℝ) 1) | |
| lemma isCompact_closedFundamentalCube : IsCompact closedFundamentalCube := | |
| isCompact_Icc.image (EuclideanSpace.equiv (Fin 3) ℝ).symm.continuous | |
| abbrev CompactCell := closedFundamentalCube | |
| instance : CompactSpace CompactCell := isCompact_iff_compactSpace.mp isCompact_closedFundamentalCube | |
| lemma representative_mem_closedCube (x : Torus) : representative x ∈ closedFundamentalCube := by | |
| refine ⟨fun i => ((AddCircle.equivIco (1 : ℝ) 0) (x i) : ℝ), ?_, rfl⟩ | |
| constructor | |
| · intro i | |
| exact ((AddCircle.equivIco (1 : ℝ) 0) (x i)).property.1 | |
| · intro i | |
| exact le_of_lt (by simpa using ((AddCircle.equivIco (1 : ℝ) 0) (x i)).property.2) | |
| def cubeRepresentative (x : Torus) : CompactCell := ⟨representative x, representative_mem_closedCube x⟩ | |
| lemma measurable_cubeRepresentative : Measurable cubeRepresentative := | |
| measurable_representative.subtype_mk | |
| lemma integrable_cubeEval (f : BoundedContinuousFunction CompactCell ℝ) : | |
| Integrable (fun x => f (cubeRepresentative x)) torusVolume := | |
| Integrable.of_bound (f.continuous.measurable.comp measurable_cubeRepresentative).aestronglyMeasurable | |
| ‖f‖ (Eventually.of_forall fun x => f.norm_coe_le_norm (cubeRepresentative x)) | |
| def cubeToL1 (f : BoundedContinuousFunction CompactCell ℝ) : Lp ℝ 1 torusVolume := | |
| (integrable_cubeEval f).toL1 (fun x => f (cubeRepresentative x)) | |
| lemma cubeToL1_lipschitz : LipschitzWith 1 cubeToL1 := by | |
| apply LipschitzWith.of_dist_le_mul | |
| intro f g | |
| rw [NNReal.coe_one, one_mul] | |
| have hi : Integrable (fun x => dist (f (cubeRepresentative x)) (g (cubeRepresentative x))) | |
| torusVolume := by | |
| simpa only [dist_eq_norm, Pi.sub_apply] using ((integrable_cubeEval f).sub (integrable_cubeEval g)).norm | |
| calc | |
| _ = ∫ x, dist (f (cubeRepresentative x)) (g (cubeRepresentative x)) ∂torusVolume := by | |
| rw [L1.dist_eq_integral_dist] | |
| apply integral_congr_ae | |
| filter_upwards [(integrable_cubeEval f).coeFn_toL1, (integrable_cubeEval g).coeFn_toL1] with x hx hx' | |
| change dist ((integrable_cubeEval f).toL1 _ x) ((integrable_cubeEval g).toL1 _ x) = _ | |
| rw [hx, hx'] | |
| _ ≤ ∫ _x : Torus, dist f g ∂torusVolume := | |
| integral_mono hi (integrable_const _) (fun x => BoundedContinuousFunction.dist_coe_le_dist _) | |
| _ = _ := by simp | |
| def characteristicL1 (E : Set Torus) (hE : MeasurableSet E) : Lp ℝ 1 torusVolume := | |
| (integrable_characteristic hE).toL1 (characteristic E) | |
| def torusApproxL1 (E : Set Torus) (hE : MeasurableSet E) (n : ℕ) : Lp ℝ 1 torusVolume := | |
| (torusApprox_integrable hE n).toL1 (torusApprox E n) | |
| lemma dist_torusApproxL1 {E : Set Torus} (hE : MeasurableSet E) (hP : perimeter E ≠ ⊤) (n : ℕ) : | |
| dist (characteristicL1 E hE) (torusApproxL1 E hE n) ≤ | |
| (mollifier n).rOut * (perimeter E).toReal := by | |
| calc | |
| _ = ∫ x, |torusApprox E n x - characteristic E x| ∂torusVolume := by | |
| rw [L1.dist_eq_integral_dist] | |
| apply integral_congr_ae | |
| filter_upwards [(integrable_characteristic hE).coeFn_toL1, | |
| (torusApprox_integrable hE n).coeFn_toL1] with x hx hx' | |
| change dist ((integrable_characteristic hE).toL1 _ x) ((torusApprox_integrable hE n).toL1 _ x) = _ | |
| rw [hx, hx', Real.dist_eq, abs_sub_comm] | |
| _ ≤ _ := torusApprox_error hE hP n | |
| lemma totallyBounded_torusApproxL1 {ι : Type*} (Es : ι → Set Torus) | |
| (hEs : ∀ i, MeasurableSet (Es i)) (n : ℕ) : | |
| TotallyBounded (range (fun i => torusApproxL1 (Es i) (hEs i) n)) := by | |
| let F : ι → BoundedContinuousFunction CompactCell ℝ := fun i => BoundedContinuousFunction.mkOfCompact | |
| ⟨fun x => smoothApprox (characteristic (Es i) ∘ quotientMap) n x, | |
| (smoothApprox_contDiff ((measurable_characteristic (hEs i)).comp measurable_quotientMap) | |
| (fun x => characteristic_bound (Es i) (quotientMap x)) n).continuous.comp continuous_subtype_val⟩ | |
| have hLip (i) : LipschitzWith (smoothApproxLip n) (F i) := by | |
| change LipschitzWith (smoothApproxLip n) | |
| (smoothApprox (characteristic (Es i) ∘ quotientMap) n ∘ (Subtype.val : CompactCell → Cover)) | |
| simpa only [mul_one] using | |
| (smoothApprox_lipschitz ((measurable_characteristic (hEs i)).comp measurable_quotientMap) | |
| (fun x => characteristic_bound (Es i) (quotientMap x)) n).comp | |
| (LipschitzWith.subtype_val closedFundamentalCube) | |
| have hEq : Equicontinuous ((↑) : range F → CompactCell → ℝ) := by | |
| apply UniformEquicontinuous.equicontinuous | |
| apply LipschitzWith.uniformEquicontinuous _ (smoothApproxLip n) | |
| rintro ⟨_, i, rfl⟩ | |
| exact hLip i | |
| have hbounded (f : BoundedContinuousFunction CompactCell ℝ) (x : CompactCell) (hf : f ∈ range F) : f x ∈ Icc (-1) 1 := by | |
| obtain ⟨i, rfl⟩ := hf | |
| exact abs_le.mp (smoothApprox_bound (fun y => characteristic_bound (Es i) (quotientMap y)) n x) | |
| have hcompact := BoundedContinuousFunction.arzela_ascoli (Icc (-1 : ℝ) 1) isCompact_Icc | |
| (range F) hbounded hEq | |
| apply ((hcompact.image cubeToL1_lipschitz.continuous).totallyBounded).subset | |
| rintro _ ⟨i, rfl⟩ | |
| exact ⟨F i, subset_closure (mem_range_self i), rfl⟩ | |
| end CubicTorus | |
| namespace CubicTorus | |
| open Filter | |
| open scoped Topology | |
| lemma totallyBounded_characteristicL1 {ι : Type*} (Es : ι → Set Torus) | |
| (hEs : ∀ i, MeasurableSet (Es i)) {C : ℝ} (hC : 0 ≤ C) | |
| (hP : ∀ i, perimeter (Es i) ≤ ENNReal.ofReal C) : | |
| TotallyBounded (range (fun i => characteristicL1 (Es i) (hEs i))) := by | |
| rw [Metric.totallyBounded_iff] | |
| intro ε hε | |
| have hconv : Tendsto (fun n => (mollifier n).rOut * C) atTop (𝓝 0) := by | |
| simpa only [zero_mul] using mollifier_rOut_tendsto.mul_const C | |
| obtain ⟨n, hn⟩ := (hconv.eventually (gt_mem_nhds (half_pos hε))).exists | |
| obtain ⟨t, ht, hcover⟩ := Metric.totallyBounded_iff.mp | |
| (totallyBounded_torusApproxL1 Es hEs n) (ε / 2) (half_pos hε) | |
| refine ⟨t, ht, ?_⟩ | |
| rintro _ ⟨i, rfl⟩ | |
| obtain ⟨y, hy, hiy⟩ := mem_iUnion₂.mp (hcover (mem_range_self i)) | |
| apply mem_iUnion₂.mpr | |
| refine ⟨y, hy, ?_⟩ | |
| change dist (characteristicL1 (Es i) (hEs i)) y < ε | |
| have hfin : perimeter (Es i) ≠ ⊤ := ne_top_of_le_ne_top ENNReal.ofReal_ne_top (hP i) | |
| have hreal : (perimeter (Es i)).toReal ≤ C := by | |
| simpa only [ENNReal.toReal_ofReal hC] using ENNReal.toReal_mono ENNReal.ofReal_ne_top (hP i) | |
| have hdist : dist (characteristicL1 (Es i) (hEs i)) (torusApproxL1 (Es i) (hEs i) n) < ε / 2 := | |
| ((dist_torusApproxL1 (hEs i) hfin n).trans | |
| (mul_le_mul_of_nonneg_left hreal (mollifier n).rOut_pos.le)).trans_lt hn | |
| have hiy' : dist (torusApproxL1 (Es i) (hEs i) n) y < ε / 2 := hiy | |
| exact (dist_triangle _ _ _).trans_lt (by linarith) | |
| end CubicTorus | |
| namespace CubicTorus | |
| open Filter | |
| open scoped Topology | |
| theorem exists_ae_tendsto_characteristic {Es : ℕ → Set Torus} | |
| (hEs : ∀ n, MeasurableSet (Es n)) {C : ℝ} (hC : 0 ≤ C) | |
| (hP : ∀ n, perimeter (Es n) ≤ ENNReal.ofReal C) : | |
| ∃ E : Set Torus, MeasurableSet E ∧ ∃ ns : ℕ → ℕ, StrictMono ns ∧ | |
| ∀ᵐ x ∂torusVolume, Tendsto (fun n => characteristic (Es (ns n)) x) atTop | |
| (𝓝 (characteristic E x)) := by | |
| let fs : ℕ → Lp ℝ 1 torusVolume := fun n => characteristicL1 (Es n) (hEs n) | |
| have hcompact : IsCompact (closure (range fs)) := | |
| (totallyBounded_characteristicL1 Es hEs hC hP).closure.isCompact_of_isClosed isClosed_closure | |
| obtain ⟨f, _, ns, hns, hconv⟩ := hcompact.isSeqCompact.subseq_of_frequently_in | |
| (Frequently.of_forall (fun n => subset_closure (mem_range_self n))) | |
| obtain ⟨ms, hms, hae⟩ := (tendstoInMeasure_of_tendsto_Lp hconv).exists_seq_tendsto_ae | |
| have hcoe : ∀ᵐ x ∂torusVolume, ∀ n, (fs (ns (ms n))) x = characteristic (Es (ns (ms n))) x := | |
| ae_all_iff.mpr (fun n => (integrable_characteristic (hEs (ns (ms n)))).coeFn_toL1) | |
| let E : Set Torus := {x | f x = 1} | |
| have hE : MeasurableSet E := (Lp.stronglyMeasurable f).measurable (measurableSet_singleton 1) | |
| refine ⟨E, hE, ns ∘ ms, hns.comp hms, ?_⟩ | |
| filter_upwards [hae, hcoe] with x hx hcx | |
| have ht : Tendsto (fun n => characteristic (Es (ns (ms n))) x) atTop (𝓝 (f x)) := by | |
| convert hx using 1 | |
| ext n | |
| exact (hcx n).symm | |
| have hfx : f x ∈ ({0, 1} : Set ℝ) := by | |
| apply ((finite_singleton (1 : ℝ)).insert 0).isClosed.mem_of_tendsto ht | |
| exact Eventually.of_forall fun n => by | |
| rcases characteristic_dichotomy (Es (ns (ms n))) x with h | h <;> simp [h] | |
| have hchar : characteristic E x = f x := by | |
| rcases mem_insert_iff.mp hfx with hzero | hone | |
| · have hxE : x ∉ E := by simp only [E, mem_ofPred_eq, hzero]; norm_num | |
| simp [characteristic, hxE, hzero] | |
| · have hxE : x ∈ E := hone | |
| simpa [characteristic, hxE] using hone.symm | |
| simpa only [Function.comp_apply, hchar] using ht | |
| end CubicTorus | |
| namespace CubicTorus | |
| def stripe (V : ℝ) : Set Torus := | |
| {x | ((AddCircle.equivIco (1 : ℝ) 0) (x 0) : ℝ) < V} | |
| def stripeUpper (V : ℝ) : Fin 3 → ℝ := Function.update 1 0 V | |
| lemma measurableSet_stripe (V : ℝ) : MeasurableSet (stripe V) := by | |
| apply measurableSet_lt _ measurable_const | |
| exact measurable_subtype_coe.comp | |
| ((AddCircle.measurableEquivIco (1 : ℝ) 0).measurable.comp (by fun_prop)) | |
| lemma stripe_lift_preimage {V : ℝ} (hV : V ∈ Icc 0 1) : | |
| (WithLp.toLp 2 : (Fin 3 → ℝ) → Cover) ⁻¹' | |
| (fundamentalCube ∩ quotientMap ⁻¹' stripe V) = | |
| univ.pi (fun i : Fin 3 => Ico 0 (stripeUpper V i)) := by | |
| ext x | |
| change ((∀ i, 0 ≤ x i ∧ x i < 1) ∧ | |
| ((AddCircle.equivIco (1 : ℝ) 0) (x 0 : AddCircle (1 : ℝ)) : ℝ) < V) ↔ _ | |
| constructor | |
| · rintro ⟨hc, hs⟩ i _ | |
| have he : ((AddCircle.equivIco (1 : ℝ) 0) (x 0 : AddCircle (1 : ℝ)) : ℝ) = x 0 := | |
| AddCircle.equivIco_coe_of_mem (by simpa using hc 0) | |
| rw [he] at hs | |
| by_cases hi : i = 0 | |
| · subst i | |
| simpa [stripeUpper] using And.intro (hc 0).1 hs | |
| · simpa [stripeUpper, hi] using hc i | |
| · intro hx | |
| have hc : ∀ i, 0 ≤ x i ∧ x i < 1 := by | |
| intro i | |
| have hh := hx i (mem_univ i) | |
| by_cases hi : i = 0 | |
| · subst i | |
| simp only [stripeUpper, Function.update_self, mem_Ico] at hh | |
| exact ⟨hh.1, lt_of_lt_of_le hh.2 hV.2⟩ | |
| · simpa [stripeUpper, hi] using hh | |
| refine ⟨hc, ?_⟩ | |
| rw [AddCircle.equivIco_coe_of_mem (by simpa using hc 0)] | |
| simpa [stripeUpper] using (hx 0 (mem_univ 0)).2 | |
| lemma volume_stripe {V : ℝ} (hV : V ∈ Icc 0 1) : | |
| torusVolume (stripe V) = ENNReal.ofReal V := by | |
| rw [torusVolume, Measure.map_apply measurable_quotientMap (measurableSet_stripe V), | |
| Measure.restrict_apply (measurable_quotientMap (measurableSet_stripe V)), inter_comm] | |
| have hm := (PiLp.volume_preserving_toLp (Fin 3)).measure_preimage | |
| ((measurableSet_fundamentalCube.inter (measurable_quotientMap (measurableSet_stripe V))).nullMeasurableSet) | |
| rw [stripe_lift_preimage hV] at hm | |
| rw [← hm, Real.volume_pi_Ico] | |
| norm_num [stripeUpper, Fin.prod_univ_succ] | |
| lemma integral_divergence_stripe {V : ℝ} (hV : V ∈ Icc 0 1) | |
| {F : Cover → Cover} (hF : AdmissibleField F) : | |
| (∫ x in fundamentalCube ∩ quotientMap ⁻¹' stripe V, divergence F x) = | |
| (∫ x in Icc (0 : Fin 2 → ℝ) 1, | |
| F (WithLp.toLp 2 ((0 : Fin 3).insertNth V x)) 0) - | |
| (∫ x in Icc (0 : Fin 2 → ℝ) 1, | |
| F (WithLp.toLp 2 ((0 : Fin 3).insertNth 0 x)) 0) := by | |
| let e := EuclideanSpace.equiv (Fin 3) ℝ | |
| let b := stripeUpper V | |
| let g : Fin 3 → (Fin 3 → ℝ) → ℝ := fun i x => F (e.symm x) i | |
| let dg : Fin 3 → (Fin 3 → ℝ) → (Fin 3 → ℝ) →L[ℝ] ℝ := | |
| fun i x => (EuclideanSpace.proj i).comp | |
| ((fderiv ℝ F (e.symm x)).comp e.symm.toContinuousLinearMap) | |
| have hdg : ∀ i x, HasFDerivAt (g i) (dg i x) x := by | |
| intro i x | |
| exact (EuclideanSpace.proj i).hasFDerivAt.comp x | |
| (((hF.1.differentiable (by simp)) (e.symm x)).hasFDerivAt.comp x e.symm.hasFDerivAt) | |
| have hd : (fun x => ∑ i : Fin 3, dg i x (Pi.single i 1)) = | |
| fun x => divergence F (e.symm x) := by | |
| funext x | |
| simp [dg, divergence, e, PiLp.toLp_single] | |
| have hct : Continuous (fun x => divergence F (e.symm x)) := | |
| (continuous_divergence hF.1).comp e.symm.continuous | |
| have hb : ∀ i, (0 : Fin 3 → ℝ) i ≤ b i := by | |
| intro i | |
| by_cases hi : i = 0 | |
| · subst i; simpa [b, stripeUpper] using hV.1 | |
| · simp [b, stripeUpper, hi] | |
| have hth := integral_divergence_of_hasFDerivAt_off_countable' | |
| (0 : Fin 3 → ℝ) b hb g dg ∅ countable_empty | |
| (fun i => ((EuclideanSpace.proj i).continuous.comp | |
| (hF.1.continuous.comp e.symm.continuous)).continuousOn) | |
| (fun x _ i => hdg i x) (by rw [hd]; exact hct.integrableOn_Icc) | |
| rw [hd] at hth | |
| have hzero : ∀ i : Fin 3, i ≠ 0 → | |
| (∫ x in Icc ((0 : Fin 3 → ℝ) ∘ i.succAbove) (b ∘ i.succAbove), | |
| g i (i.insertNth (b i) x)) - | |
| (∫ x in Icc ((0 : Fin 3 → ℝ) ∘ i.succAbove) (b ∘ i.succAbove), | |
| g i (i.insertNth 0 x)) = 0 := by | |
| intro i hi | |
| have heq : (fun x : Fin 2 → ℝ => g i (i.insertNth (b i) x)) = | |
| (fun x : Fin 2 → ℝ => g i (i.insertNth 0 x)) := by | |
| funext x | |
| have hbi : b i = 1 := by simp [b, stripeUpper, hi] | |
| rw [hbi] | |
| change F (WithLp.toLp 2 (i.insertNth 1 x)) i = F (WithLp.toLp 2 (i.insertNth 0 x)) i | |
| rw [adjacent_faces, hF.2.1] | |
| rw [heq, sub_self] | |
| simp only [Pi.zero_apply] at hth | |
| rw [Finset.sum_eq_single 0 (fun i _ hi => hzero i hi) (by simp)] at hth | |
| have hab : b ∘ (0 : Fin 3).succAbove = (1 : Fin 2 → ℝ) := by | |
| ext i | |
| simp [b, stripeUpper] | |
| have ha0 : (0 : Fin 3 → ℝ) ∘ (0 : Fin 3).succAbove = (0 : Fin 2 → ℝ) := rfl | |
| rw [hab, ha0] at hth | |
| rw [← (PiLp.volume_preserving_toLp (Fin 3)).setIntegral_preimage_emb | |
| e.symm.toHomeomorph.measurableEmbedding, stripe_lift_preimage hV] | |
| rw [volume_pi, setIntegral_congr_set Measure.univ_pi_Ico_ae_eq_Icc] | |
| rw [← volume_pi] | |
| convert hth using 1 <;> simp [g, b, stripeUpper, e] | |
| rfl | |
| end CubicTorus | |
| namespace CubicTorus | |
| lemma volume_square_face : volume (Icc (0 : Fin 2 → ℝ) 1) = 1 := by | |
| rw [Real.volume_Icc_pi] | |
| norm_num | |
| lemma stripe_flux_bound {F : Cover → Cover} (hF : AdmissibleField F) (a : ℝ) : | |
| |∫ x in Icc (0 : Fin 2 → ℝ) 1, | |
| F (WithLp.toLp 2 ((0 : Fin 3).insertNth a x)) 0| ≤ 1 := by | |
| have hh := norm_setIntegral_le_of_norm_le_const | |
| (show volume (Icc (0 : Fin 2 → ℝ) 1) < ⊤ by rw [volume_square_face]; norm_num) | |
| (fun x (_ : x ∈ Icc (0 : Fin 2 → ℝ) 1) => | |
| (PiLp.norm_apply_le (F (WithLp.toLp 2 ((0 : Fin 3).insertNth a x))) 0).trans (hF.2.2 _)) | |
| simpa only [Real.norm_eq_abs, Measure.real, volume_square_face, ENNReal.toReal_one, mul_one] using hh | |
| theorem perimeter_stripe_le {V : ℝ} (hV : V ∈ Icc 0 1) : perimeter (stripe V) ≤ 2 := by | |
| apply iSup_le | |
| intro F | |
| apply iSup_le | |
| intro hF | |
| rw [integral_divergence_stripe hV hF] | |
| have hupper := (abs_le.1 (stripe_flux_bound hF V)).2 | |
| have hlower := (abs_le.1 (stripe_flux_bound hF 0)).1 | |
| have hh : (∫ x in Icc (0 : Fin 2 → ℝ) 1, | |
| F (WithLp.toLp 2 ((0 : Fin 3).insertNth V x)) 0) - | |
| (∫ x in Icc (0 : Fin 2 → ℝ) 1, | |
| F (WithLp.toLp 2 ((0 : Fin 3).insertNth 0 x)) 0) ≤ 2 := by linarith | |
| exact (ENNReal.ofReal_le_ofReal hh).trans_eq (by norm_num) | |
| theorem finitePerimeter_stripe {V : ℝ} (hV : V ∈ Icc 0 1) : FinitePerimeter (stripe V) := | |
| ⟨(measurableSet_stripe V).nullMeasurableSet, (perimeter_stripe_le hV).trans_lt (by norm_num)⟩ | |
| theorem exists_bounded_competitor {V : ℝ} (hV : V ∈ Icc 0 1) : | |
| ∃ E : Set Torus, FinitePerimeter E ∧ torusVolume E = ENNReal.ofReal V ∧ perimeter E ≤ 2 := | |
| ⟨stripe V, finitePerimeter_stripe hV, volume_stripe hV, perimeter_stripe_le hV⟩ | |
| end CubicTorus | |
| namespace CubicTorus | |
| open Filter | |
| open scoped Topology | |
| theorem exists_isMinimizerAt {V : ℝ} (hV : V ∈ Ioo 0 1) : | |
| ∃ E : Set Torus, IsMinimizerAt V E := by | |
| let S : Set ℝ≥0∞ := {p | ∃ E : Set Torus, MeasurableSet E ∧ | |
| torusVolume E = ENNReal.ofReal V ∧ perimeter E = p ∧ p ≤ 2} | |
| have hV' : V ∈ Icc (0 : ℝ) 1 := ⟨hV.1.le, hV.2.le⟩ | |
| have hne : S.Nonempty := ⟨perimeter (stripe V), stripe V, measurableSet_stripe V, | |
| volume_stripe hV', rfl, perimeter_stripe_le hV'⟩ | |
| have hinf : sInf S ≤ 2 := (sInf_le hne.choose_spec).trans hne.choose_spec.choose_spec.2.2.2 | |
| obtain ⟨ps, _, hconv, hps⟩ := exists_seq_tendsto_sInf hne (OrderBot.bddBelow S) | |
| choose Es hEs hvol hpEq hpBound using hps | |
| have hbound : ∀ n, perimeter (Es n) ≤ ENNReal.ofReal 2 := by | |
| intro n | |
| rw [hpEq n] | |
| simpa using hpBound n | |
| obtain ⟨E, hE, ns, hns, hae⟩ := exists_ae_tendsto_characteristic hEs (by norm_num) hbound | |
| have hvo : torusVolume E = ENNReal.ofReal V := by | |
| have ht := tendsto_volume_of_ae_tendsto (fun n => (hEs (ns n)).nullMeasurableSet) | |
| hE.nullMeasurableSet hae | |
| have hc : Tendsto (fun n => torusVolume (Es (ns n))) atTop (𝓝 (ENNReal.ofReal V)) := by | |
| simpa only [hvol] using (tendsto_const_nhds : Tendsto (fun _ : ℕ => ENNReal.ofReal V) atTop _) | |
| exact tendsto_nhds_unique ht hc | |
| have hpe : perimeter E ≤ sInf S := | |
| perimeter_le_of_ae_tendsto_bound (fun n => (hEs (ns n)).nullMeasurableSet) | |
| hE.nullMeasurableSet hae (fun n => (hpEq (ns n)).le) (hconv.comp hns.tendsto_atTop) | |
| refine ⟨E, ⟨hE.nullMeasurableSet, (hpe.trans hinf).trans_lt (by norm_num)⟩, hvo, ?_⟩ | |
| intro F hF hFv | |
| by_cases hFp : perimeter F ≤ 2 | |
| · have hrep := hF.1.toMeasurable_ae_eq | |
| have hex : perimeter F ∈ S := by | |
| refine ⟨toMeasurable torusVolume F, measurableSet_toMeasurable _ _, ?_, ?_, hFp⟩ | |
| · exact (measure_congr hrep).trans hFv | |
| · exact perimeter_congr_ae hrep | |
| exact hpe.trans (sInf_le hex) | |
| · exact (hpe.trans hinf).trans (le_of_lt (lt_of_not_ge hFp)) | |
| end CubicTorus | |
| namespace CubicTorus | |
| open Filter | |
| open scoped Topology | |
| lemma characteristic_translation_ae_of_perimeter_zero {E : Set Torus} | |
| (hE : MeasurableSet E) (hP : perimeter E = 0) (a : Torus) : | |
| (fun x ↦ characteristic E (x - a)) =ᵐ[torusVolume] characteristic E := by | |
| have h := characteristic_translation_bound hE (hP ▸ ENNReal.zero_ne_top) (representative a) | |
| rw [quotientMap_representative, hP, ENNReal.toReal_zero, mul_zero] at h | |
| have hg : Measurable (fun x ↦ |characteristic E (x - a) - characteristic E x|) := | |
| (((measurable_characteristic hE).comp (measurable_id.sub_const a)).sub | |
| (measurable_characteristic hE)).abs | |
| have hi : Integrable (fun x ↦ |characteristic E (x - a) - characteristic E x|) torusVolume := by | |
| apply Integrable.of_bound hg.aestronglyMeasurable 1 | |
| exact Eventually.of_forall fun x ↦ by | |
| rcases characteristic_dichotomy E (x - a) with h | h <;> | |
| rcases characteristic_dichotomy E x with h' | h' <;> simp [h, h'] | |
| have hae := (integral_eq_zero_iff_of_nonneg (fun x ↦ abs_nonneg _) hi).1 | |
| (le_antisymm h (integral_nonneg fun x ↦ abs_nonneg _)) | |
| filter_upwards [hae] with x hx | |
| exact sub_eq_zero.1 (abs_eq_zero.1 hx) | |
| theorem volume_eq_zero_or_one_of_perimeter_zero {E : Set Torus} | |
| (hE : NullMeasurableSet E torusVolume) (hP : perimeter E = 0) : | |
| torusVolume E = 0 ∨ torusVolume E = 1 := by | |
| wlog hEm : MeasurableSet E generalizing E | |
| · have hae := hE.toMeasurable_ae_eq | |
| have hP' : perimeter (toMeasurable torusVolume E) = 0 := (perimeter_congr_ae hae).trans hP | |
| have hh := this (measurableSet_toMeasurable torusVolume E).nullMeasurableSet hP' | |
| (measurableSet_toMeasurable torusVolume E) | |
| rwa [measure_congr hae] at hh | |
| have hall : ∀ᵐ a ∂torusVolume, ∀ᵐ x ∂torusVolume, | |
| characteristic E (x + a) = characteristic E x := by | |
| exact Eventually.of_forall fun a ↦ by | |
| have hh := characteristic_translation_ae_of_perimeter_zero hEm hP (-a) | |
| filter_upwards [hh] with x hx | |
| simpa only [sub_neg_eq_add] using hx | |
| have hswap := (Measure.ae_ae_comm (μ := torusVolume) (ν := torusVolume) | |
| (p := fun a x ↦ characteristic E (x + a) = characteristic E x) | |
| (measurableSet_eq_fun ((measurable_characteristic hEm).comp (measurable_snd.add measurable_fst)) | |
| ((measurable_characteristic hEm).comp measurable_snd))).1 hall | |
| obtain ⟨x, hx⟩ := hswap.exists | |
| have hav := integral_congr_ae hx | |
| rw [integral_add_left_eq_self, integral_characteristic hE, integral_const] at hav | |
| simp only [Measure.real_def, torusVolume_univ, ENNReal.toReal_one, one_smul] at hav | |
| rcases characteristic_dichotomy E x with h0 | h1 | |
| · left | |
| exact ((ENNReal.toReal_eq_zero_iff _).1 (hav.trans h0)).resolve_right (measure_ne_top _ _) | |
| · right | |
| have hh := congrArg ENNReal.ofReal (hav.trans h1) | |
| simpa only [ENNReal.ofReal_toReal (measure_ne_top _ _), ENNReal.ofReal_one] using hh | |
| theorem perimeter_pos_of_volume {V : ℝ} (hV : V ∈ Ioo 0 1) {E : Set Torus} | |
| (hE : NullMeasurableSet E torusVolume) (hvolume : torusVolume E = ENNReal.ofReal V) : | |
| 0 < perimeter E := by | |
| apply bot_lt_iff_ne_bot.2 | |
| intro hzero | |
| rcases volume_eq_zero_or_one_of_perimeter_zero hE hzero with h0 | h1 | |
| · rw [hvolume] at h0 | |
| exact (ENNReal.ofReal_pos.2 hV.1).ne' h0 | |
| · rw [hvolume] at h1 | |
| have hh := congrArg ENNReal.toReal h1 | |
| rw [ENNReal.toReal_ofReal hV.1.le, ENNReal.toReal_one] at hh | |
| exact hV.2.ne hh | |
| end CubicTorus | |
| namespace CubicTorus | |
| open Filter | |
| open scoped Topology | |
| def isoperimetricProfile (V : ℝ) : ℝ := | |
| (sInf {p : ℝ≥0∞ | ∃ E : Set Torus, | |
| FinitePerimeter E ∧ torusVolume E = ENNReal.ofReal V ∧ perimeter E = p}).toReal / 2 | |
| lemma isoperimetricProfile_eq_of_isMinimizerAt {V : ℝ} {E : Set Torus} | |
| (hE : IsMinimizerAt V E) : isoperimetricProfile V = (perimeter E).toReal / 2 := by | |
| have heq : sInf {p : ℝ≥0∞ | ∃ F : Set Torus, | |
| FinitePerimeter F ∧ torusVolume F = ENNReal.ofReal V ∧ perimeter F = p} = perimeter E := by | |
| apply le_antisymm | |
| · exact sInf_le ⟨E, hE.1, hE.2.1, rfl⟩ | |
| · apply le_sInf | |
| rintro p ⟨F, hF, hFv, rfl⟩ | |
| exact hE.2.2 F hF hFv | |
| simp only [isoperimetricProfile, heq] | |
| lemma isMinimizerAt_empty : IsMinimizerAt 0 ∅ := by | |
| refine ⟨finitePerimeter_empty, by simp, ?_⟩ | |
| intro F _ _ | |
| rw [perimeter_empty] | |
| exact bot_le | |
| lemma isMinimizerAt_univ : IsMinimizerAt 1 univ := by | |
| have hh := (isMinimizerAt_compl (by norm_num : (0 : ℝ) ∈ Icc 0 1)).2 isMinimizerAt_empty | |
| simpa using hh | |
| theorem exists_isMinimizerAt_Icc {V : ℝ} (hV : V ∈ Icc 0 1) : | |
| ∃ E : Set Torus, IsMinimizerAt V E := by | |
| rcases hV.1.eq_or_lt with h | h | |
| · subst V | |
| exact ⟨∅, isMinimizerAt_empty⟩ | |
| rcases hV.2.eq_or_lt with h' | h' | |
| · subst V | |
| exact ⟨univ, isMinimizerAt_univ⟩ | |
| exact exists_isMinimizerAt ⟨h, h'⟩ | |
| lemma isoperimetricProfile_nonneg (V : ℝ) : 0 ≤ isoperimetricProfile V := | |
| div_nonneg ENNReal.toReal_nonneg (by norm_num) | |
| lemma isoperimetricProfile_zero : isoperimetricProfile 0 = 0 := by | |
| rw [isoperimetricProfile_eq_of_isMinimizerAt isMinimizerAt_empty, perimeter_empty, | |
| ENNReal.toReal_zero, zero_div] | |
| lemma isoperimetricProfile_one : isoperimetricProfile 1 = 0 := by | |
| rw [isoperimetricProfile_eq_of_isMinimizerAt isMinimizerAt_univ] | |
| have hh : perimeter (univ : Set Torus) = 0 := by | |
| simpa only [compl_empty, perimeter_empty] using perimeter_compl ((MeasurableSet.empty : MeasurableSet (∅ : Set Torus)).nullMeasurableSet (μ := torusVolume)) | |
| rw [hh, ENNReal.toReal_zero, zero_div] | |
| lemma isoperimetricProfile_pos {V : ℝ} (hV : V ∈ Ioo 0 1) : | |
| 0 < isoperimetricProfile V := by | |
| obtain ⟨E, hE⟩ := exists_isMinimizerAt hV | |
| rw [isoperimetricProfile_eq_of_isMinimizerAt hE] | |
| exact div_pos (ENNReal.toReal_pos (perimeter_pos_of_volume hV hE.1.1 hE.2.1).ne' | |
| hE.1.2.ne) (by norm_num) | |
| lemma isoperimetricProfile_le_competitor {V : ℝ} (hV : V ∈ Icc 0 1) | |
| {E : Set Torus} (hE : FinitePerimeter E) (hvol : torusVolume E = ENNReal.ofReal V) : | |
| isoperimetricProfile V ≤ (perimeter E).toReal / 2 := by | |
| obtain ⟨F, hF⟩ := exists_isMinimizerAt_Icc hV | |
| rw [isoperimetricProfile_eq_of_isMinimizerAt hF] | |
| exact div_le_div_of_nonneg_right (ENNReal.toReal_mono hE.2.ne (hF.2.2 E hE hvol)) (by norm_num) | |
| lemma isoperimetricProfile_le_one {V : ℝ} (hV : V ∈ Icc 0 1) : | |
| isoperimetricProfile V ≤ 1 := by | |
| have hh := isoperimetricProfile_le_competitor hV (finitePerimeter_stripe hV) (volume_stripe hV) | |
| have hb := ENNReal.toReal_mono (by norm_num : (2 : ℝ≥0∞) ≠ ⊤) (perimeter_stripe_le hV) | |
| norm_num at hb | |
| linarith | |
| lemma isoperimetricProfile_compl {V : ℝ} (hV : V ∈ Icc 0 1) : | |
| isoperimetricProfile (1 - V) = isoperimetricProfile V := by | |
| obtain ⟨E, hE⟩ := exists_isMinimizerAt_Icc hV | |
| rw [isoperimetricProfile_eq_of_isMinimizerAt hE, | |
| isoperimetricProfile_eq_of_isMinimizerAt ((isMinimizerAt_compl hV).2 hE), | |
| perimeter_compl hE.1.1] | |
| end CubicTorus | |
| namespace CubicTorus | |
| open Filter | |
| open scoped Topology | |
| lemma isClosed_profile_sublevel (a : ℝ) : | |
| IsClosed {V | V ∈ Icc (0 : ℝ) 1 ∧ isoperimetricProfile V ≤ a} := by | |
| apply IsSeqClosed.isClosed | |
| intro Vs V hVs hV | |
| have hVI : V ∈ Icc (0 : ℝ) 1 := isClosed_Icc.mem_of_tendsto hV | |
| (Eventually.of_forall fun n ↦ (hVs n).1) | |
| have ha : 0 ≤ a := (isoperimetricProfile_nonneg (Vs 0)).trans (hVs 0).2 | |
| have he : ∀ n, ∃ E : Set Torus, MeasurableSet E ∧ IsMinimizerAt (Vs n) E := by | |
| intro n | |
| obtain ⟨E, hE⟩ := exists_isMinimizerAt_Icc (hVs n).1 | |
| refine ⟨toMeasurable torusVolume E, measurableSet_toMeasurable _ _, ?_⟩ | |
| exact (isMinimizerAt_congr_ae hE.1.1.toMeasurable_ae_eq).2 hE | |
| choose Es hEs hmin using he | |
| have hbound : ∀ n, perimeter (Es n) ≤ ENNReal.ofReal (2 * a) := by | |
| intro n | |
| have hh := (hVs n).2 | |
| rw [isoperimetricProfile_eq_of_isMinimizerAt (hmin n)] at hh | |
| rw [← ENNReal.ofReal_toReal (hmin n).1.2.ne] | |
| exact ENNReal.ofReal_le_ofReal (by linarith) | |
| obtain ⟨E, hE, ns, hns, hae⟩ := exists_ae_tendsto_characteristic hEs | |
| (mul_nonneg (by norm_num) ha) hbound | |
| have hvol : torusVolume E = ENNReal.ofReal V := by | |
| have ht := tendsto_volume_of_ae_tendsto (fun n ↦ (hEs (ns n)).nullMeasurableSet) | |
| hE.nullMeasurableSet hae | |
| have ht' : Tendsto (fun n ↦ torusVolume (Es (ns n))) atTop (𝓝 (ENNReal.ofReal V)) := by | |
| simp_rw [(hmin _).2.1] | |
| exact ENNReal.continuous_ofReal.continuousAt.tendsto.comp (hV.comp hns.tendsto_atTop) | |
| exact tendsto_nhds_unique ht ht' | |
| have hP : perimeter E ≤ ENNReal.ofReal (2 * a) := | |
| perimeter_le_of_ae_tendsto (fun n ↦ (hEs (ns n)).nullMeasurableSet) | |
| hE.nullMeasurableSet hae (fun n ↦ hbound (ns n)) | |
| have hEF : FinitePerimeter E := ⟨hE.nullMeasurableSet, hP.trans_lt ENNReal.ofReal_lt_top⟩ | |
| refine ⟨hVI, ?_⟩ | |
| have hh := isoperimetricProfile_le_competitor hVI hEF hvol | |
| have hb := ENNReal.toReal_mono ENNReal.ofReal_ne_top hP | |
| rw [ENNReal.toReal_ofReal (mul_nonneg (by norm_num) ha)] at hb | |
| linarith | |
| theorem lowerSemicontinuousOn_isoperimetricProfile : | |
| LowerSemicontinuousOn isoperimetricProfile (Icc (0 : ℝ) 1) := by | |
| rw [lowerSemicontinuousOn_iff_preimage_Iic] | |
| intro b | |
| refine ⟨{V | V ∈ Icc (0 : ℝ) 1 ∧ isoperimetricProfile V ≤ b}, | |
| isClosed_profile_sublevel b, ?_⟩ | |
| ext V | |
| simp only [mem_inter_iff, mem_preimage, mem_Iic, mem_ofPred_eq, and_self_left] | |
| end CubicTorus | |
| namespace CubicTorus | |
| open Filter | |
| open scoped Topology RealInnerProductSpace | |
| lemma integrableOn_periodic_continuous {f : Cover → ℝ} (hf : Continuous f) | |
| (hp : ∀ n x, f (x + latticeVector n) = f x) : IntegrableOn f fundamentalCube := by | |
| let : IsFiniteMeasure (volume.restrict fundamentalCube) := | |
| ⟨by rw [Measure.restrict_apply_univ, volume_fundamentalCube]; norm_num⟩ | |
| obtain ⟨M, _, hM⟩ := periodic_bounded hf hp | |
| exact Integrable.of_bound hf.aestronglyMeasurable M (Eventually.of_forall hM) | |
| lemma divergence_smul_function {f : Cover → ℝ} {F : Cover → Cover} {point : Cover} | |
| (hf : DifferentiableAt ℝ f point) (hF : DifferentiableAt ℝ F point) : | |
| divergence (fun y ↦ f y • F y) point = f point * divergence F point + | |
| ⟪gradient f point, F point⟫ := by | |
| have ha : (∑ i : Fin 3, F point i • EuclideanSpace.single i 1) = F point := by | |
| ext j | |
| simp [Pi.single_apply] | |
| rw [inner_gradient_left] | |
| conv_rhs => rw [← ha, map_sum] | |
| change (∑ i : Fin 3, (fderiv ℝ (f • F) point (EuclideanSpace.single i 1)) i) = _ | |
| rw [fderiv_smul hf hF] | |
| simp only [add_apply, smul_apply, ContinuousLinearMap.smulRight_apply, | |
| PiLp.add_apply, PiLp.smul_apply, smul_eq_mul, Finset.sum_add_distrib, | |
| divergence, Finset.mul_sum, map_smul] | |
| congr 1 | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| simp [mul_comm] | |
| lemma admissible_cutoff {f : Cover → ℝ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) | |
| (hp : ∀ n x, f (x + latticeVector n) = f x) (hb : ∀ x, f x ∈ Icc 0 1) | |
| {F : Cover → Cover} (hF : AdmissibleField F) : | |
| AdmissibleField (fun x ↦ f x • F x) := by | |
| refine ⟨hf.smul hF.1, ?_, ?_⟩ | |
| · intro n x | |
| change f (x + latticeVector n) • F (x + latticeVector n) = _ | |
| rw [hp, hF.2.1] | |
| · intro x | |
| rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg (hb x).1] | |
| exact (mul_le_of_le_one_left (norm_nonneg _) (hb x).2).trans (hF.2.2 x) | |
| lemma gradient_contDiff {f : Cover → ℝ} (hf : ContDiff ℝ (⊤ : ℕ∞) f) : | |
| ContDiff ℝ (⊤ : ℕ∞) (gradient f) := by | |
| exact (InnerProductSpace.toDual ℝ Cover).symm.toContinuousLinearEquiv.contDiff.comp | |
| (hf.fderiv_right (m := (⊤ : ℕ∞)) (by simp)) | |
| lemma gradient_periodic {f : Cover → ℝ} | |
| (hp : ∀ n x, f (x + latticeVector n) = f x) (n : Fin 3 → ℤ) (x : Cover) : | |
| gradient f (x + latticeVector n) = gradient f x := by | |
| unfold gradient | |
| rw [fderiv_periodic hp] | |
| end CubicTorus | |
| end | |
| end | |
| end | |
| end OAI | |