Download data/lean/OAI/MeasureTheory/FalconerCompletion/Recursion/NominalRadius.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 14.8 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MeasureTheory/FalconerCompletion/Recursion/NominalRadius.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/MeasureTheory/FalconerCompletion/Recursion/NominalRadius.lean
-
curl -L -o NominalRadius.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/MeasureTheory/FalconerCompletion/Recursion/NominalRadius.lean
14.8 kB
| import Mathlib | |
| import OAI.MeasureTheory.Falconer.Model | |
| import OAI.MeasureTheory.Falconer.Recursion.MinimalDescriptorLength | |
| import OAI.MeasureTheory.Falconer.Recursion.PolicyDescriptors | |
| import OAI.MeasureTheory.FalconerCompletion.Graphs.SharedBinSupportCollision | |
| namespace OAI | |
| /-! Recursive policies and quantitative depth estimates. -/ | |
| open _root_.OAI.PlanarFalconer | |
| section | |
| section | |
| open Set MeasureTheory | |
| open scoped ComplexConjugate RealInnerProductSpace | |
| namespace GraphLiteralSupport | |
| namespace CurrentFalconer.TreeND | |
| open Set Metric MeasureTheory PlanarFalconer | |
| open scoped ENNReal RealInnerProductSpace | |
| variable {d : β} | |
| noncomputable def nominalRadius (N : β) (sig : β) (l : β) : β := | |
| min 1 (1/(2:β)^l*((2:β)^N)^(50*sig)) | |
| lemma testWidth_gap (N : β) (sig : β) {J : β} (hJ : 0<J) (i n : β) : | |
| testWidth N J i n sig-testWidth N J (i+1) n sig = | |
| ((2:β)^N)^(500*sig)/((J:β)*(2:β)^n) := by | |
| have hj : (J:β) β 0 := by exact_mod_cast hJ.ne' | |
| simp only [testWidth,Nat.cast_add,Nat.cast_one,Real.rpow_neg (by norm_num : (0:β)β€2), | |
| Real.rpow_natCast] | |
| field_simp | |
| ring | |
| lemma uniform_testWidth_gap {sig : β} (hsig : 0<sig) {J : β} (hJ : 0<J) | |
| (C : β) (hC : 0β€C) : | |
| β Nβ : β, β N β₯ Nβ, β g n : β, gβ€n β β i : β, | |
| testWidth N J (i+1) n sig + (C/(2:β)^g)*nominalRadius N sig (n-g) β€ | |
| testWidth N J i n sig := by | |
| obtain β¨Nβ,hββ© := fixed_constant_absorbed (by positivity : 0<450*sig) (C*J) | |
| refine β¨Nβ,?_β© | |
| intro N hN g n hgn i | |
| have hj : 0<(J:β) := by exact_mod_cast hJ | |
| have hRp : 0<(2:β)^N := by positivity | |
| have hc := mul_le_mul_of_nonneg_right (hβ N hN) | |
| (by positivity : 0β€((2:β)^N)^(50*sig)) | |
| have he : ((2:β)^N)^(450*sig)*((2:β)^N)^(50*sig)=((2:β)^N)^(500*sig) := by | |
| rw [β Real.rpow_add hRp]; congr 1; ring | |
| rw [he] at hc | |
| have hp : (2:β)^g*(2:β)^(n-g)=(2:β)^n := by rw [β pow_add,Nat.add_sub_of_le hgn] | |
| have hb : (C/(2:β)^g)*nominalRadius N sig (n-g) β€ | |
| ((2:β)^N)^(500*sig)/((J:β)*(2:β)^n) := by | |
| calc | |
| _ β€ (C/(2:β)^g)*(1/(2:β)^(n-g)*((2:β)^N)^(50*sig)) := | |
| mul_le_mul_of_nonneg_left (min_le_right _ _) (by positivity) | |
| _ = (C*(J:β)*((2:β)^N)^(50*sig))/((J:β)*(2:β)^n) := by | |
| rw [β hp]; field_simp | |
| _ β€ _ := div_le_div_of_nonneg_right hc (by positivity) | |
| rw [β testWidth_gap N sig hJ i n] at hb | |
| linarith | |
| lemma fullParallelCount_transfer (Ο : Measure (EuclideanSpace β (Fin d))) | |
| (g p : β) (P : CellPath d) {W W' Ξ΅ : β} {v w : EuclideanSpace β (Fin d)} | |
| (hv : βvβ=1) (hw : βwβ=1) (hd : dist v w β€ Ξ΅) | |
| (hW : W'+(20*(d+1:β)/(2:β)^g)*Ξ΅ β€ W) : | |
| fullParallelCount Ο g p P W' w β€ fullParallelCount Ο g p P W v := by | |
| apply Finset.card_le_card | |
| intro Q hQ | |
| obtain β¨hQ,hpos,hr,hperpβ© := Finset.mem_filter.mp hQ | |
| refine Finset.mem_filter.mpr β¨hQ,hpos,hr,?_β© | |
| have hΞ΅ : 0β€Ξ΅ := dist_nonneg.trans hd | |
| have hchange := graphPerpND_change_direction w v (treeCenter Q-treeCenter P) hw hv | |
| have hnorm : βgraphPerpND v (treeCenter Q-treeCenter P)β β€ | |
| βgraphPerpND w (treeCenter Q-treeCenter P)β+ | |
| 2*βtreeCenter Q-treeCenter Pβ*dist v w := by | |
| rw [dist_comm w v] at hchange | |
| exact (norm_le_norm_sub_add _ _).trans (by linarith) | |
| have hr' : βtreeCenter Q-treeCenter Pβ β€ 10*(d+1:β)/(2:β)^g := by | |
| simpa only [dist_eq_norm] using hr.le | |
| have htotal := mul_le_mul (mul_le_mul_of_nonneg_left hr' (by norm_num : (0:β)β€2)) hd | |
| dist_nonneg (by positivity : 0β€2*(10*(d+1:β)/(2:β)^g)) | |
| simp only [div_eq_mul_inv] at htotal hW | |
| nlinarith | |
| lemma classConditional_ae_mem (Ο : Measure (EuclideanSpace β (Fin d))) (P : CellPath d) : | |
| βα΅ x βclassConditional Ο P, x β treeCell P := | |
| Measure.ae_smul_measure (ae_restrict_mem (measurableSet_treeCell P)) _ | |
| lemma fullProjectionCollision_transfer (Ο : Measure (EuclideanSpace β (Fin d))) | |
| [IsFiniteMeasure Ο] (P : CellPath d) {W W' Ξ΅ : β} {v w : EuclideanSpace β (Fin d)} | |
| (hd : dist v w β€ Ξ΅) | |
| (hW : W'+((d+1:β)/(2:β)^P.length)*Ξ΅ β€ W) : | |
| fullProjectionCollision Ο P W' w β€ fullProjectionCollision Ο P W v := by | |
| apply measure_mono_ae | |
| filter_upwards [Measure.quasiMeasurePreserving_fst.ae (classConditional_ae_mem Ο P), | |
| Measure.quasiMeasurePreserving_snd.ae (classConditional_ae_mem Ο P)] with z hz hz' | |
| intro hproj | |
| change |inner β (z.1-z.2) w| β€ W' at hproj | |
| have hdiam : βz.1-z.2β β€ (d+1:β)/(2:β)^P.length := by | |
| simpa only [dist_eq_norm] using ambientGridCell_dist_le hz' hz | |
| have hn : βv-wβ β€ Ξ΅ := by simpa only [dist_eq_norm] using hd | |
| have hb := abs_real_inner_le_norm (z.1-z.2) (v-w) | |
| rw [inner_sub_right] at hb | |
| have hb' := hb.trans (mul_le_mul hdiam hn (norm_nonneg _) (by positivity)) | |
| have ht := abs_add_le (inner β (z.1-z.2) v-inner β (z.1-z.2) w) | |
| (inner β (z.1-z.2) w) | |
| simp only [sub_add_cancel] at ht | |
| exact ht.trans (by linarith) | |
| def ValidDescriptor (N : β) : PolicyDescriptor β Prop | |
| | .parallel g p => g β€ p β§ p β€ N | |
| | .projection p t => p β€ t β§ t β€ N | |
| lemma policyDescriptor_valid (A : β β β) {N q a t : β} (hq : 0 < q) (ht : t β€ N) | |
| {b : PolicyDescriptor} (hb : b β policyDescriptorList A N q a t) : ValidDescriptor N b := by | |
| obtain β¨s,u,_,hut,_,_,hpos,_,hboundβ© := policyDescriptor_origin A hq hb | |
| cases b <;> simp only [descriptorLength,descriptorAnchor,ValidDescriptor] at * <;> omega | |
| lemma policyDescriptor_anchor_le_end (A : β β β) {N q a t : β} | |
| (hq : 0 < q) {b : PolicyDescriptor} (hb : b β policyDescriptorList A N q a t) : | |
| descriptorAnchor b β€ t := by | |
| obtain β¨_,u,_,hut,_,_,_,_,huβ© := policyDescriptor_origin A hq hb | |
| omega | |
| lemma uniform_descriptorGood_transfer {sig : β} (hsig : 0<sig) {J : β} (hJ : 0<J) : | |
| β Nβ : β, β N β₯ Nβ, β (Ο : Measure (EuclideanSpace β (Fin d))), IsFiniteMeasure Ο β | |
| β (m : β β β) (C : β) (i : β) (b : PolicyDescriptor), ValidDescriptor N b β | |
| β P : CellPath d, P.length=descriptorAnchor b β | |
| β v w : EuclideanSpace β (Fin d), βwβ=1 β | |
| dist v w β€ nominalRadius N sig (descriptorLength b) β | |
| v β descriptorGood Ο m N sig C J i P b β | |
| w β descriptorGood Ο m N sig C J (i+1) P b := by | |
| obtain β¨Nβ,hββ© := uniform_testWidth_gap hsig hJ (20*(d+1)) (by positivity) | |
| obtain β¨Nβ,hββ© := uniform_testWidth_gap hsig hJ (d+1) (by positivity) | |
| refine β¨max Nβ Nβ,?_β© | |
| intro N hN Ο hf m C i b hb P hP v w hw hd hg | |
| have := hf | |
| cases b with | |
| | parallel g p => | |
| exact β¨hw,(Nat.cast_le.mpr (fullParallelCount_transfer Ο g p P hg.1 hw hd | |
| (hβ N ((le_max_left _ _).trans hN) g p hb.1 i))).trans hg.2β© | |
| | projection p t => | |
| apply And.intro hw | |
| apply (fullProjectionCollision_transfer Ο P hd ?_).trans hg.2 | |
| simp only [descriptorAnchor] at hP | |
| rw [hP] | |
| exact hβ N ((le_max_right _ _).trans hN) p t hb.1 i | |
| lemma dyadic_ratio_nominal {a p l N : β} {sig : β} (hsig : 0 β€ sig) (hl : a+lβ€p) : | |
| (2:β)^a/(2:β)^p β€ nominalRadius N sig l := by | |
| have hb : (2:β)^a/(2:β)^p β€ 1/(2:β)^l := by | |
| apply (div_le_div_iffβ (by positivity) (by positivity)).mpr | |
| rw [one_mul,β pow_add] | |
| exact pow_le_pow_rightβ (by norm_num) hl | |
| have hR : 1 β€ ((2:β)^N)^(50*sig) := | |
| Real.one_le_rpow (one_le_powβ (by norm_num)) (by positivity) | |
| apply le_min | |
| Β· exact (div_le_one (by positivity)).mpr (pow_le_pow_rightβ (by norm_num) (by omega)) | |
| Β· exact hb.trans (by simpa only [mul_one] using | |
| mul_le_mul_of_nonneg_left hR (by positivity : 0β€1/(2:β)^l)) | |
| lemma same_tree_ancestor {P A : CellPath d} {a p : β} (hP : P.length=p) | |
| (hA : A.length=a) (hap : aβ€p) {x x' : EuclideanSpace β (Fin d)} | |
| (hxA : x β treeCell A) (hx : x β treeCell P) (hx' : x' β treeCell P) : | |
| x' β treeCell A := by | |
| have hlen : (P.take a).length=A.length := by simp [List.length_take,hP,hA,hap] | |
| have he : P.take a=A := by | |
| by_contra hn | |
| exact Set.disjoint_left.mp (treeCell_disjoint hlen hn) (treeCell_subset_take _ _ hx) hxA | |
| simpa only [he] using treeCell_subset_take P a hx' | |
| lemma fine_radial_dist {X Y P Q : CellPath d} {a p : β} {K : β} | |
| (hK : 1000*(d+1:β)<K) (hX : X.length=a) (hY : Y.length=a) | |
| (hsep : CentreSeparated X Y a K) (hP : P.length=p) (hQ : Q.length=p) | |
| (hPX : P.take a=X) (hQY : Q.take a=Y) | |
| {x y x' y' : EuclideanSpace β (Fin d)} (hx : x β treeCell P) (hy : y β treeCell Q) | |
| (hx' : x' β treeCell P) (hy' : y' β treeCell Q) : | |
| dist (radialVector x y) (radialVector x' y') β€ (2:β)^a/(2:β)^p := by | |
| have hPx : treeCell P β treeCell X := by simpa only [hPX] using treeCell_subset_take P a | |
| have hQy : treeCell Q β treeCell Y := by simpa only [hQY] using treeCell_subset_take Q a | |
| have hd := separated_parent_points hK hX hY hsep (hPx hx) (hQy hy) | |
| have hd' := separated_parent_points hK hX hY hsep (hPx hx') (hQy hy') | |
| have hpos : 0<100*(d+1:β)/(2:β)^a := by positivity | |
| rw [dist_eq_norm] at hd hd' | |
| have hmove : β(x-y)-(x'-y')β β€ 2*(d+1:β)/(2:β)^p := by | |
| have he : (x-y)-(x'-y')=(x-x')-(y-y') := by abel | |
| rw [he] | |
| have hxmove := ambientGridCell_dist_le hx' hx | |
| have hymove := ambientGridCell_dist_le hy' hy | |
| change dist x x' β€ (d+1:β)/(2:β)^P.length at hxmove | |
| change dist y y' β€ (d+1:β)/(2:β)^Q.length at hymove | |
| rw [hP,dist_eq_norm] at hxmove | |
| rw [hQ,dist_eq_norm] at hymove | |
| exact (norm_sub_le _ _).trans (by simp only [div_eq_mul_inv] at hxmove hymove β’; linarith) | |
| apply (normalized_direction_distND (x-y) (x'-y') (hpos.trans_le hd) (hpos.trans_le hd')).trans | |
| apply (div_le_divβ (by positivity) (mul_le_mul_of_nonneg_left hmove (by norm_num : (0:β) β€ 2)) hpos hd).trans | |
| have he : 2*(2*(d+1:β)/(2:β)^p)/(100*(d+1:β)/(2:β)^a) = | |
| (1/25:β)*((2:β)^a/(2:β)^p) := by | |
| field_simp | |
| ring_nf | |
| rw [he] | |
| have hg : 0β€(2:β)^a/(2:β)^p := by positivity | |
| linarith | |
| namespace PositiveDistanceState | |
| lemma uniform_suffix_good_transport {sig : β} (hsig : 0<sig) {J : β} (hJ : 0<J) : | |
| β Nβ : β, β e : PositiveDistanceState d, e.sig=sig β e.J=J β Nββ€e.N β | |
| IsFiniteMeasure e.Ο β β K : β, 1000*(d+1:β)<K β CentreSeparated e.X e.Y e.a K β | |
| e.X.length=e.a β e.Y.length=e.a β 0<e.q β | |
| β p : β, e.aβ€p β pβ€e.t β e.tβ€e.N β | |
| β P Q : CellPath d, P.length=p β Q.length=p β P.take e.a=e.X β Q.take e.a=e.Y β | |
| β x β treeCell P, β y β treeCell Q, (x,y) β e.good β | |
| β x' β treeCell P, β y' β treeCell Q, | |
| (x',y') β ({e with t := p,i := e.i+1} : PositiveDistanceState d).good := by | |
| obtain β¨Nβ,hββ© := uniform_descriptorGood_transfer (d := d) hsig hJ | |
| refine β¨Nβ,?_β© | |
| intro e hsig' hJ' hN hf K hK hsep hX hY hq p hap hpt htN P Q hP hQ hPX hQY x hx y hy hg x' hx' y' hy' | |
| have hmove := fine_radial_dist hK hX hY hsep hP hQ hPX hQY hx hy hx' hy' | |
| have hPx : treeCell P β treeCell e.X := by simpa only [hPX] using treeCell_subset_take P e.a | |
| have hQy : treeCell Q β treeCell e.Y := by simpa only [hQY] using treeCell_subset_take Q e.a | |
| have hne : x' β y' := by | |
| have hh := separated_parent_points hK hX hY hsep (hPx hx') (hQy hy') | |
| exact dist_pos.mp ((by positivity : 0<100*(d+1:β)/(2:β)^e.a).trans_le hh) | |
| intro b hb | |
| change b β policyDescriptorList (adjustedProfile (d := d) e.mass e.N) e.N e.q e.a p at hb | |
| have hb' := policyDescriptorList_mono (adjustedProfile (d := d) e.mass e.N) le_rfl hpt hb | |
| have hbg := hg b hb' | |
| have ha := policyDescriptor_anchor_le_end (adjustedProfile (d := d) e.mass e.N) hq hb | |
| have hl := policyDescriptor_twice_length (adjustedProfile (d := d) e.mass e.N) hq hb | |
| have hv := policyDescriptor_valid (adjustedProfile (d := d) e.mass e.N) hq (hpt.trans htN) hb | |
| have hrad := hmove.trans (dyadic_ratio_nominal (N := e.N) hsig.le (by omega : e.a+descriptorLength bβ€p)) | |
| have htransfer (A : CellPath d) (hA : A.length=descriptorAnchor b) | |
| (hw : radialVector x y β descriptorGood e.Ο e.mass e.N e.sig e.C e.J e.i A b) : | |
| radialVector x' y' β descriptorGood e.Ο e.mass e.N e.sig e.C e.J (e.i+1) A b := by | |
| rw [hsig',hJ'] at hw β’ | |
| exact hβ e.N hN e.Ο hf e.mass e.C e.i b hv A hA _ _ (norm_radialVector hne) hrad hw | |
| constructor | |
| Β· intro A hA hxA | |
| have hlen := (mem_dyadicPaths _ _).mp hA | |
| apply htransfer A hlen | |
| apply hbg.1 A hA | |
| exact same_tree_ancestor hP hlen ha hxA hx' hx | |
| Β· intro A hA hyA | |
| have hlen := (mem_dyadicPaths _ _).mp hA | |
| apply htransfer A hlen | |
| apply hbg.2 A hA | |
| exact same_tree_ancestor hQ hlen ha hyA hy' hy | |
| end PositiveDistanceState | |
| end CurrentFalconer.TreeND | |
| end GraphLiteralSupport | |
| end | |
| end | |
| section | |
| section | |
| open Set MeasureTheory | |
| open scoped ComplexConjugate RealInnerProductSpace | |
| namespace GraphLiteralSupport | |
| namespace CurrentFalconer | |
| open Filter Real | |
| open scoped Topology | |
| noncomputable def sourceMaskScaleND (l : β) (R Ο : β) : β := | |
| max 1 ((2:β)^l*R^(-50*Ο)) | |
| noncomputable def sourceMaskRadiusND (d l : β) (R Ο : β) : β := | |
| (sourceMaskScaleND l R Ο)β»ΒΉ/(100*(d+1)^2) | |
| noncomputable def sourceTestWidthND (J i n : β) (R Ο : β) : β := | |
| (2-(i:β)/J)*((2:β)^n)β»ΒΉ*R^(500*Ο) | |
| lemma sourceMaskScaleND_one_le (l : β) (R Ο : β) : 1 β€ sourceMaskScaleND l R Ο := le_max_left _ _ | |
| lemma sourceMaskScaleND_pos (l : β) (R Ο : β) : 0<sourceMaskScaleND l R Ο := | |
| zero_lt_one.trans_le (sourceMaskScaleND_one_le l R Ο) | |
| lemma sourceMaskRadiusND_pos (d l : β) (R Ο : β) : 0<sourceMaskRadiusND d l R Ο := | |
| div_pos (inv_pos.mpr (sourceMaskScaleND_pos l R Ο)) (by positivity) | |
| lemma sourceMaskScaleND_mono {l L : β} (h : l β€ L) {R Ο : β} (hR : 0 β€ R) : | |
| sourceMaskScaleND l R Ο β€ sourceMaskScaleND L R Ο := by | |
| apply max_le_max_left | |
| exact mul_le_mul_of_nonneg_right (pow_le_pow_rightβ (by norm_num) h) (Real.rpow_nonneg hR _) | |
| lemma sourceMaskScaleND_inv_depth {g p : β} (hgp : g β€ p) {R Ο : β} (hR : 0<R) : | |
| ((2:β)^g)β»ΒΉ*(sourceMaskScaleND (p-g) R Ο)β»ΒΉ β€ ((2:β)^p)β»ΒΉ*R^(50*Ο) := by | |
| have hpos : 0<(2:β)^(p-g)*R^(-50*Ο) := by positivity | |
| have hh := inv_antiβ hpos (le_max_right (1:β) ((2:β)^(p-g)*R^(-50*Ο))) | |
| apply (mul_le_mul_of_nonneg_left hh (by positivity : (0:β) β€ ((2:β)^g)β»ΒΉ)).trans_eq | |
| rw [mul_inv_rev,show -50*Ο=-(50*Ο) by ring,Real.rpow_neg hR.le,inv_inv] | |
| calc | |
| _ = (((2:β)^g)*((2:β)^(p-g)))β»ΒΉ*R^(50*Ο) := by rw [mul_inv_rev]; ring | |
| _ = _ := by rw [β pow_add,Nat.add_sub_of_le hgp] | |
| end CurrentFalconer | |
| end GraphLiteralSupport | |
| end | |
| end | |
| end OAI | |