Download data/lean/OAI/Dynamics/EntropyCounterexample/AmbientRetraction.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 11.9 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Dynamics/EntropyCounterexample/AmbientRetraction.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Dynamics/EntropyCounterexample/AmbientRetraction.lean
-
curl -L -o AmbientRetraction.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Dynamics/EntropyCounterexample/AmbientRetraction.lean
11.9 kB
| import OAI.Dynamics.EntropyCounterexample.Embedding | |
| namespace OAI | |
| noncomputable section | |
| open scoped ContDiff | |
| namespace Problem340.AmbientRetraction | |
| variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace β E] | |
| def normalize (x : E) : E := βxββ»ΒΉ β’ x | |
| theorem contDiffAt_normalize {n : ββΟ} {x : E} (hx : x β 0) : | |
| ContDiffAt β n normalize x := by | |
| exact ((contDiffAt_id.norm β hx).inv (norm_ne_zero_iff.mpr hx)).smul contDiffAt_id | |
| theorem normalize_mem_sphere {x : E} (hx : x β 0) : | |
| normalize x β Metric.sphere (0 : E) 1 := by | |
| rw [mem_sphere_zero_iff_norm, normalize, norm_smul, norm_inv, norm_norm] | |
| exact inv_mul_cancelβ (norm_ne_zero_iff.mpr hx) | |
| theorem normalize_eq_self {x : E} (hx : x β Metric.sphere (0 : E) 1) : | |
| normalize x = x := by | |
| rw [normalize, mem_sphere_zero_iff_norm.mp hx, inv_one, one_smul] | |
| @[simp] | |
| theorem norm_smul_normalize (x : E) : βxβ β’ normalize x = x := by | |
| by_cases hx : x = 0 | |
| Β· simp [hx, normalize] | |
| Β· rw [normalize, smul_smul, mul_inv_cancelβ (norm_ne_zero_iff.mpr hx), one_smul] | |
| theorem norm_normalize_le_one (x : E) : βnormalize xβ β€ 1 := by | |
| by_cases hx : x = 0 | |
| Β· simp [hx, normalize] | |
| Β· exact le_of_eq (mem_sphere_zero_iff_norm.mp (normalize_mem_sphere hx)) | |
| theorem norm_normalize_sub_le {x : E} (hx : x β 0) (y : E) : | |
| βnormalize y - normalize xβ β€ (2 / βxβ) * βy - xβ := by | |
| have hid : βxβ β’ (normalize y - normalize x) = | |
| (βxβ - βyβ) β’ normalize y + (y - x) := by | |
| rw [smul_sub, sub_smul, norm_smul_normalize, norm_smul_normalize] | |
| abel | |
| have hscale : βxβ * βnormalize y - normalize xβ β€ 2 * βy - xβ := by | |
| calc | |
| βxβ * βnormalize y - normalize xβ = | |
| ββxβ β’ (normalize y - normalize x)β := by rw [norm_smul, norm_norm] | |
| _ = β(βxβ - βyβ) β’ normalize y + (y - x)β := congrArg norm hid | |
| _ β€ β(βxβ - βyβ) β’ normalize yβ + βy - xβ := norm_add_le _ _ | |
| _ = |βxβ - βyβ| * βnormalize yβ + βy - xβ := by | |
| rw [norm_smul, Real.norm_eq_abs] | |
| _ β€ |βxβ - βyβ| + βy - xβ := by | |
| nlinarith [norm_normalize_le_one y, abs_nonneg (βxβ - βyβ)] | |
| _ β€ 2 * βy - xβ := by | |
| have hnorm := abs_norm_sub_norm_le x y | |
| rw [norm_sub_rev x y] at hnorm | |
| linarith | |
| calc | |
| βnormalize y - normalize xβ β€ (2 * βy - xβ) / βxβ := | |
| (le_div_iffβ (norm_pos_iff.mpr hx)).mpr (by nlinarith [hscale]) | |
| _ = (2 / βxβ) * βy - xβ := by ring | |
| theorem norm_fderiv_normalize_le {x : E} (hx : x β 0) : | |
| βfderiv β normalize xβ β€ 2 / βxβ := by | |
| apply norm_fderiv_le_of_lip' β (by positivity) | |
| exact Filter.Eventually.of_forall (norm_normalize_sub_le hx) | |
| theorem norm_fderiv_normalize_le_four {x : E} (hx : (1 / 2 : β) β€ βxβ) : | |
| βfderiv β normalize xβ β€ 4 := by | |
| have hxpos : 0 < βxβ := by linarith | |
| apply (norm_fderiv_normalize_le (norm_pos_iff.mp hxpos)).trans | |
| apply (div_le_iffβ hxpos).mpr | |
| linarith | |
| def cylinder (x : β Γ E) : β Γ E := (x.1, normalize x.2) | |
| theorem contDiffAt_cylinder {n : ββΟ} {x : β Γ E} (hx : x.2 β 0) : | |
| ContDiffAt β n cylinder x := by | |
| exact contDiffAt_fst.prodMk ((contDiffAt_normalize hx).comp x contDiffAt_snd) | |
| theorem norm_cylinder_sub_le_four {x : β Γ E} (hx : (1 / 2 : β) β€ βx.2β) | |
| (y : β Γ E) : βcylinder y - cylinder xβ β€ 4 * βy - xβ := by | |
| have hxpos : 0 < βx.2β := by linarith | |
| have hratio : 2 / βx.2β β€ 4 := (div_le_iffβ hxpos).mpr (by linarith) | |
| change max βy.1 - x.1β βnormalize y.2 - normalize x.2β β€ 4 * βy - xβ | |
| apply max_le | |
| Β· have hfst := norm_fst_le (y - x) | |
| change βy.1 - x.1β β€ βy - xβ at hfst | |
| nlinarith [norm_nonneg (y - x)] | |
| Β· calc | |
| βnormalize y.2 - normalize x.2β β€ (2 / βx.2β) * βy.2 - x.2β := | |
| norm_normalize_sub_le (norm_pos_iff.mp hxpos) _ | |
| _ β€ 4 * βy.2 - x.2β := mul_le_mul_of_nonneg_right hratio (norm_nonneg _) | |
| _ β€ 4 * βy - xβ := mul_le_mul_of_nonneg_left (norm_snd_le (y - x)) (by norm_num) | |
| theorem norm_fderiv_cylinder_le_four {x : β Γ E} (hx : (1 / 2 : β) β€ βx.2β) : | |
| βfderiv β cylinder xβ β€ 4 := by | |
| apply norm_fderiv_le_of_lip' β (by norm_num) | |
| exact Filter.Eventually.of_forall (norm_cylinder_sub_le_four hx) | |
| @[simp] | |
| theorem cylinder_eq_self {x : β Γ E} (hx : βx.2β = 1) : cylinder x = x := by | |
| apply Prod.ext | |
| Β· rfl | |
| Β· exact normalize_eq_self (mem_sphere_zero_iff_norm.mpr hx) | |
| def cylinderDomain : Set (β Γ E) := {x | (1 / 2 : β) < βx.2β} | |
| omit [InnerProductSpace β E] in | |
| theorem isOpen_cylinderDomain : IsOpen (cylinderDomain (E := E)) := | |
| isOpen_lt continuous_const (continuous_norm.comp continuous_snd) | |
| theorem mapsTo_normalizedPredictor | |
| (G : β Γ E β β Γ E) | |
| (hG : β x : β Γ E, βx.2β = 1 β β(G x).2β = 1) : | |
| Set.MapsTo (G β cylinder) cylinderDomain cylinderDomain := by | |
| intro x hx | |
| change (1 / 2 : β) < βx.2β at hx | |
| have hxne : x.2 β 0 := norm_pos_iff.mp (by linarith [hx]) | |
| have hn : β(cylinder x).2β = 1 := | |
| mem_sphere_zero_iff_norm.mp (normalize_mem_sphere hxne) | |
| change (1 / 2 : β) < β(G (cylinder x)).2β | |
| rw [hG _ hn] | |
| norm_num | |
| theorem contDiffOn_normalizedPredictor {n : ββΟ} | |
| (G : β Γ E β β Γ E) (hG : ContDiff β n G) : | |
| ContDiffOn β n (G β cylinder) cylinderDomain := by | |
| intro x hx | |
| change (1 / 2 : β) < βx.2β at hx | |
| apply ContDiffAt.contDiffWithinAt | |
| exact hG.contDiffAt.comp x (contDiffAt_cylinder | |
| (norm_pos_iff.mp (by linarith [hx]))) | |
| theorem norm_fderiv_normalizedPredictor_le | |
| (G : β Γ E β β Γ E) (hG : ContDiff β 1 G) | |
| {B : β} (hB : 0 β€ B) | |
| (hbound : β x : β Γ E, βx.2β = 1 β βfderiv β G xβ β€ B) | |
| {x : β Γ E} (hx : x β cylinderDomain) : | |
| βfderiv β (G β cylinder) xβ β€ B * 4 := by | |
| change (1 / 2 : β) < βx.2β at hx | |
| have hxpos : 0 < βx.2β := by linarith [hx] | |
| have hnorm : β(cylinder x).2β = 1 := | |
| mem_sphere_zero_iff_norm.mp (normalize_mem_sphere (norm_pos_iff.mp hxpos)) | |
| rw [fderiv_comp x (hG.differentiable one_ne_zero _) | |
| ((contDiffAt_cylinder (n := 1) (norm_pos_iff.mp hxpos)).differentiableAt one_ne_zero)] | |
| apply (ContinuousLinearMap.opNorm_comp_le _ _).trans | |
| exact mul_le_mul (hbound _ hnorm) (norm_fderiv_cylinder_le_four (le_of_lt hx)) | |
| (norm_nonneg _) hB | |
| theorem normalizedPredictor_iterate_eq | |
| (G : β Γ E β β Γ E) | |
| (hG : β x : β Γ E, βx.2β = 1 β β(G x).2β = 1) | |
| {x : β Γ E} (hx : βx.2β = 1) (n : β) : | |
| (G β cylinder)^[n] x = G^[n] x := by | |
| have hinv : Set.MapsTo G {x : β Γ E | βx.2β = 1} {x : β Γ E | βx.2β = 1} := hG | |
| induction n with | |
| | zero => rfl | |
| | succ n hn => | |
| rw [Function.iterate_succ_apply', Function.iterate_succ_apply', hn] | |
| change G (cylinder (G^[n] x)) = G (G^[n] x) | |
| rw [cylinder_eq_self (hinv.iterate n hx)] | |
| theorem normalizedPredictor_iterate_succ_eq | |
| (G : β Γ E β β Γ E) | |
| (hG : β x : β Γ E, βx.2β = 1 β β(G x).2β = 1) | |
| {x : β Γ E} (hx : x.2 β 0) (n : β) : | |
| (G β cylinder)^[n + 1] x = G^[n + 1] (cylinder x) := by | |
| rw [Function.iterate_succ_apply, Function.comp_apply] | |
| have hn : β(G (cylinder x)).2β = 1 := | |
| hG _ (mem_sphere_zero_iff_norm.mp (normalize_mem_sphere hx)) | |
| rw [normalizedPredictor_iterate_eq G hG hn n, Function.iterate_succ_apply] | |
| def domain (q : β) : Set (CounterexampleAmbient q) := | |
| {x | x.1 β 0 β§ β i, x.2 i β 0} | |
| theorem isOpen_domain (q : β) : IsOpen (domain q) := by | |
| have hclock : IsOpen {x : CounterexampleAmbient q | x.1 β 0} := | |
| isOpen_ne.preimage continuous_fst | |
| have hsphere : IsOpen {x : CounterexampleAmbient q | β i, x.2 i β 0} := by | |
| rw [Set.ofPred_forall] | |
| exact isOpen_iInter_of_finite fun i => | |
| isOpen_ne.preimage ((continuous_apply i).comp continuous_snd) | |
| exact hclock.inter hsphere | |
| theorem standardEmbedding_mem_domain {q : β} (x : CounterexampleManifold q) : | |
| standardEmbedding q x β domain q := | |
| β¨ne_zero_of_mem_unit_sphere x.1, fun i => ne_zero_of_mem_unit_sphere (x.2 i)β© | |
| def project (q : β) (x : CounterexampleAmbient q) : CounterexampleAmbient q := | |
| (normalize x.1, fun i => normalize (x.2 i)) | |
| theorem contDiffOn_project (q : β) (n : ββΟ) : | |
| ContDiffOn β n (project q) (domain q) := by | |
| intro x hx | |
| apply ContDiffAt.contDiffWithinAt | |
| apply ContDiffAt.prodMk | |
| Β· exact (contDiffAt_normalize (E := ClockAmbient) (n := n) hx.1).comp x contDiffAt_fst | |
| Β· apply (contDiffAt_pi (F' := fun _ : Fin (q + 1) => SphereAmbient)).mpr | |
| intro i | |
| exact ContDiffAt.comp (f := fun y : CounterexampleAmbient q => y.2 i) | |
| (g := normalize (E := SphereAmbient)) x | |
| (contDiffAt_normalize (n := n) (hx.2 i)) | |
| ((contDiff_apply β SphereAmbient i).contDiffAt.comp x contDiffAt_snd) | |
| @[simp] | |
| theorem project_standardEmbedding {q : β} (x : CounterexampleManifold q) : | |
| project q (standardEmbedding q x) = standardEmbedding q x := by | |
| apply Prod.ext | |
| Β· exact normalize_eq_self x.1.property | |
| Β· funext i | |
| exact normalize_eq_self (x.2 i).property | |
| def toManifold (q : β) (x : domain q) : CounterexampleManifold q := | |
| (β¨normalize x.1.1, normalize_mem_sphere x.2.1β©, | |
| fun i => β¨normalize (x.1.2 i), normalize_mem_sphere (x.2.2 i)β©) | |
| @[simp] | |
| theorem standardEmbedding_toManifold (q : β) (x : domain q) : | |
| standardEmbedding q (toManifold q x) = project q x := rfl | |
| theorem continuous_toManifold (q : β) : Continuous (toManifold q) := by | |
| apply (continuous_iff_standardEmbedding q _).mpr | |
| exact (contDiffOn_project q 0).continuousOn.domRestrict | |
| @[simp] | |
| theorem toManifold_standardEmbedding {q : β} (x : CounterexampleManifold q) : | |
| toManifold q β¨standardEmbedding q x, standardEmbedding_mem_domain xβ© = x := by | |
| apply standardEmbedding_injective q | |
| exact project_standardEmbedding x | |
| def fromAmbient {q : β} (F : CounterexampleAmbient q β CounterexampleAmbient q) | |
| (hF : β x : CounterexampleManifold q, F (standardEmbedding q x) β domain q) | |
| (x : CounterexampleManifold q) : CounterexampleManifold q := | |
| toManifold q β¨F (standardEmbedding q x), hF xβ© | |
| @[simp] | |
| theorem standardEmbedding_fromAmbient {q : β} | |
| (F : CounterexampleAmbient q β CounterexampleAmbient q) | |
| (hF : β x : CounterexampleManifold q, F (standardEmbedding q x) β domain q) | |
| (x : CounterexampleManifold q) : | |
| standardEmbedding q (fromAmbient F hF x) = | |
| project q (F (standardEmbedding q x)) := rfl | |
| theorem isC1SelfMap_fromAmbient {q : β} | |
| (F : CounterexampleAmbient q β CounterexampleAmbient q) | |
| (hF : β x : CounterexampleManifold q, F (standardEmbedding q x) β domain q) | |
| {U : Set (CounterexampleAmbient q)} (hU : IsOpen U) | |
| (hmem : β x : CounterexampleManifold q, standardEmbedding q x β U) | |
| (hsmooth : ContDiffOn β 1 F U) : IsC1SelfMap q (fromAmbient F hF) := by | |
| have hlocal : β x : CounterexampleManifold q, | |
| β V : Set (CounterexampleAmbient q), | |
| IsOpen V β§ standardEmbedding q x β V β§ | |
| β G : CounterexampleAmbient q β CounterexampleAmbient q, | |
| ContDiffOn β 1 G V β§ | |
| β y : CounterexampleManifold q, | |
| standardEmbedding q y β V β | |
| standardEmbedding q (fromAmbient F hF y) = G (standardEmbedding q y) := by | |
| intro x | |
| refine β¨U β© F β»ΒΉ' domain q, | |
| hsmooth.continuousOn.isOpen_inter_preimage hU (isOpen_domain q), | |
| β¨hmem x, hF xβ©, project q β F, ?_, ?_β© | |
| Β· exact (contDiffOn_project q 1).comp_inter hsmooth | |
| Β· intro y _ | |
| rfl | |
| exact β¨continuous_of_local_contDiff_extension _ hlocal, hlocalβ© | |
| end Problem340.AmbientRetraction | |
| end | |
| end OAI | |