Download data/lean/OAI/Combinatorics/HalvingLines/PathLimits.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 18.7 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/HalvingLines/PathLimits.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/HalvingLines/PathLimits.lean
-
curl -L -o PathLimits.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/HalvingLines/PathLimits.lean
18.7 kB
| import OAI.Combinatorics.HalvingLines.ChainDrawing | |
| namespace OAI | |
| open Filter Topology | |
| namespace PlanarHalving.Batches | |
| open PlaneGraph RankCoordinates | |
| variable {R : β} | |
| lemma ConvexPath.extension_vertex (C : ConvexPath R) {l u : β} | |
| (hsl : β b : Fin R, C.point b.castSucc β C.point b.succ β | |
| l β€ slope (C.point b.castSucc) (C.point b.succ) β§ slope (C.point b.castSucc) (C.point b.succ) β€ u) | |
| (c : Fin (R+1)) : C.extension l u (C.point c).1 = (C.point c).2 := by | |
| induction c using Fin.induction with | |
| | zero => | |
| apply le_antisymm (C.extension_below_vertex hsl 0) | |
| have hh := le_envelope (C.extensionSlopes l u) (C.extensionIntercepts l u) (.inr false) (C.point 0).1 | |
| simp only [ConvexPath.extensionSlopes, ConvexPath.extensionIntercepts] at hh | |
| change _ β€ envelope (C.extensionSlopes l u) (C.extensionIntercepts l u) (C.point 0).1 | |
| linarith only [hh] | |
| | succ b ih => | |
| by_cases hb : C.point b.castSucc = C.point b.succ | |
| Β· rw [β hb] | |
| exact ih | |
| Β· exact C.extension_edge hsl b hb (right_mem_segment β _ _) | |
| lemma ConvexPath.extension_left (C : ConvexPath R) {l u : β} (hlu : l β€ u) | |
| (hsl : β b : Fin R, C.point b.castSucc β C.point b.succ β | |
| l β€ slope (C.point b.castSucc) (C.point b.succ) β§ slope (C.point b.castSucc) (C.point b.succ) β€ u) | |
| {x : β} (hx : x β€ (C.point 0).1) : | |
| C.extension l u x = (C.point 0).2 + l*(x-(C.point 0).1) := by | |
| apply le_antisymm | |
| Β· apply envelope_le | |
| intro i | |
| have hi := le_envelope (C.extensionSlopes l u) (C.extensionIntercepts l u) i (C.point 0).1 | |
| change _ β€ C.extension l u (C.point 0).1 at hi | |
| rw [C.extension_vertex hsl] at hi | |
| have hm := mul_nonpos_of_nonneg_of_nonpos | |
| (sub_nonneg.mpr (C.extension_slopes hlu hsl i).1) (sub_nonpos.mpr hx) | |
| nlinarith only [hi,hm] | |
| Β· have hh := le_envelope (C.extensionSlopes l u) (C.extensionIntercepts l u) (.inr false) x | |
| simp only [ConvexPath.extensionSlopes, ConvexPath.extensionIntercepts] at hh | |
| change _ β€ envelope (C.extensionSlopes l u) (C.extensionIntercepts l u) x | |
| linarith only [hh] | |
| lemma ConvexPath.extension_right (C : ConvexPath R) {l u : β} (hlu : l β€ u) | |
| (hsl : β b : Fin R, C.point b.castSucc β C.point b.succ β | |
| l β€ slope (C.point b.castSucc) (C.point b.succ) β§ slope (C.point b.castSucc) (C.point b.succ) β€ u) | |
| {x : β} (hx : (C.point (Fin.last R)).1 β€ x) : | |
| C.extension l u x = (C.point (Fin.last R)).2 + u*(x-(C.point (Fin.last R)).1) := by | |
| apply le_antisymm | |
| Β· apply envelope_le | |
| intro i | |
| have hi := le_envelope (C.extensionSlopes l u) (C.extensionIntercepts l u) i (C.point (Fin.last R)).1 | |
| change _ β€ C.extension l u (C.point (Fin.last R)).1 at hi | |
| rw [C.extension_vertex hsl] at hi | |
| have hm := mul_nonpos_of_nonpos_of_nonneg | |
| (sub_nonpos.mpr (C.extension_slopes hlu hsl i).2) (sub_nonneg.mpr hx) | |
| nlinarith only [hi,hm] | |
| Β· have hh := le_envelope (C.extensionSlopes l u) (C.extensionIntercepts l u) (.inr true) x | |
| simp only [ConvexPath.extensionSlopes, ConvexPath.extensionIntercepts] at hh | |
| change _ β€ envelope (C.extensionSlopes l u) (C.extensionIntercepts l u) x | |
| linarith only [hh] | |
| lemma finite_intermediate {R : β} (f : Fin (R+1) β β) {x : β} | |
| (hβ : f 0 β€ x) (hβ : x < f (Fin.last R)) : | |
| β b : Fin R, f b.castSucc β€ x β§ x < f b.succ := by | |
| have haux : β c : Fin (R+1), x < f c β β b : Fin R, f b.castSucc β€ x β§ x < f b.succ := by | |
| intro c | |
| induction c using Fin.induction with | |
| | zero => exact fun h => (not_lt_of_ge hβ h).elim | |
| | succ b ih => | |
| intro h | |
| by_cases hb : f b.castSucc β€ x | |
| Β· exact β¨b,hb,hβ© | |
| Β· exact ih (lt_of_not_ge hb) | |
| exact haux (Fin.last R) hβ | |
| lemma ConvexPath.extension_middle (C : ConvexPath R) {l u : β} | |
| (hsl : β b : Fin R, C.point b.castSucc β C.point b.succ β | |
| l β€ slope (C.point b.castSucc) (C.point b.succ) β§ slope (C.point b.castSucc) (C.point b.succ) β€ u) | |
| {x : β} (hβ : (C.point 0).1 β€ x) (hβ : x < (C.point (Fin.last R)).1) : | |
| β b : Fin R, C.point b.castSucc β C.point b.succ β§ | |
| (x,C.extension l u x) β segment β (C.point b.castSucc) (C.point b.succ) := by | |
| obtain β¨b,hbβ,hbββ© := finite_intermediate (fun c => (C.point c).1) hβ hβ | |
| have hbx : (C.point b.castSucc).1 < (C.point b.succ).1 := hbβ.trans_lt hbβ | |
| have hb : C.point b.castSucc β C.point b.succ := fun h => hbx.ne (congrArg Prod.fst h) | |
| let t := (x-(C.point b.castSucc).1)/((C.point b.succ).1-(C.point b.castSucc).1) | |
| have ht : t β Set.Icc (0:β) 1 := by | |
| refine β¨div_nonneg (sub_nonneg.mpr hbβ) (sub_nonneg.mpr hbx.le), ?_β© | |
| exact (div_le_one (sub_pos.mpr hbx)).mpr (by linarith only [hbβ]) | |
| let z : Point := (1-t) β’ C.point b.castSucc + t β’ C.point b.succ | |
| have hz : z β segment β (C.point b.castSucc) (C.point b.succ) := by | |
| rw [segment_eq_image] | |
| exact β¨t,ht,rflβ© | |
| have hzx : z.1 = x := by | |
| dsimp [z,t] | |
| field_simp [ne_of_gt (sub_pos.mpr hbx)] | |
| ring | |
| have hzy := C.extension_edge hsl b hb hz | |
| rw [hzx] at hzy | |
| have he : (x,C.extension l u x) = z := Prod.ext hzx.symm hzy | |
| exact β¨b,hb,he βΈ hzβ© | |
| lemma ConvexPath.extension_cases (C : ConvexPath R) {l u : β} (hlu : l β€ u) | |
| (hsl : β b : Fin R, C.point b.castSucc β C.point b.succ β | |
| l β€ slope (C.point b.castSucc) (C.point b.succ) β§ slope (C.point b.castSucc) (C.point b.succ) β€ u) | |
| {z : Point} (hz : C.extension l u z.1 = z.2) : | |
| (z.1 β€ (C.point 0).1 β§ z.2 = (C.point 0).2 + l*(z.1-(C.point 0).1)) β¨ | |
| ((C.point (Fin.last R)).1 β€ z.1 β§ z.2 = (C.point (Fin.last R)).2 + u*(z.1-(C.point (Fin.last R)).1)) β¨ | |
| (β b : Fin R, C.point b.castSucc β C.point b.succ β§ z β segment β (C.point b.castSucc) (C.point b.succ)) := by | |
| by_cases hl : z.1 β€ (C.point 0).1 | |
| Β· exact Or.inl β¨hl, hz.symm.trans (C.extension_left hlu hsl hl)β© | |
| by_cases hu : (C.point (Fin.last R)).1 β€ z.1 | |
| Β· exact Or.inr (Or.inl β¨hu,hz.symm.trans (C.extension_right hlu hsl hu)β©) | |
| obtain β¨b,hb,hz'β© := C.extension_middle hsl (le_of_not_ge hl) (lt_of_not_ge hu) | |
| rw [hz] at hz' | |
| exact Or.inr (Or.inr β¨b,hb,hz'β©) | |
| end PlanarHalving.Batches | |
| namespace PlanarHalving.Spatial | |
| open Set Filter Metric | |
| open scoped Topology | |
| theorem subsequence_of_asymptotic_continuity | |
| {X Y : Type*} [MetricSpace X] [SecondCountableTopology X] | |
| [MetricSpace Y] [CompleteSpace Y] | |
| (f : β β X β Y) (G : Set X) (hG : G.Nonempty) (K : Set Y) (hK : IsCompact K) | |
| (hbounded : β n p, p β G β f n p β K) | |
| (hcont : β p β G, β Ξ΅ > 0, β r > 0, | |
| βαΆ n in atTop, β q, dist q p < r β dist (f n q) (f n p) β€ Ξ΅) : | |
| β (Ο : β β β) (l : G β Y), StrictMono Ο β§ | |
| (β p, l p β K) β§ | |
| (β p : G, β u : β β X, Tendsto u atTop (π (p : X)) β | |
| Tendsto (fun n => f (Ο n) (u n)) atTop (π (l p))) := by | |
| classical | |
| let : Nonempty G := hG.to_subtype | |
| let : CompactSpace K := isCompact_iff_compactSpace.mp hK | |
| obtain β¨q,hqβ© := TopologicalSpace.exists_dense_seq G | |
| let F : β β β β K := fun n j => β¨f n (q j), hbounded n (q j) (q j).propertyβ© | |
| obtain β¨g,Ο,hΟ,hgβ© := CompactSpace.tendsto_subseq F | |
| have hgrid (j : β) : Tendsto (fun n => f (Ο n) (q j)) atTop (π (g j : Y)) := | |
| continuous_subtype_val.tendsto _ |>.comp ((tendsto_pi_nhds.mp hg) j) | |
| have hcauchy (p : G) : CauchySeq (fun n => f (Ο n) p) := by | |
| rw [Metric.cauchySeq_iff] | |
| intro Ξ΅ hΞ΅ | |
| obtain β¨r,hr,hrfβ© := hcont p p.property (Ξ΅/4) (by positivity) | |
| obtain β¨j,hjβ© := hq.exists_dist_lt p hr | |
| have hj' : dist (q j : X) p < r := by simpa only [Subtype.dist_eq, dist_comm] using hj | |
| obtain β¨N,hNβ© := eventually_atTop.mp (hΟ.tendsto_atTop.eventually hrf) | |
| obtain β¨N',hN'β© := Metric.cauchySeq_iff.mp (hgrid j).cauchySeq (Ξ΅/4) (by positivity) | |
| refine β¨max N N',fun m hm n hn => ?_β© | |
| have hm' := hN m (le_trans (le_max_left _ _) hm) (q j) hj' | |
| have hn' := hN n (le_trans (le_max_left _ _) hn) (q j) hj' | |
| have hmn := hN' m (le_trans (le_max_right _ _) hm) n (le_trans (le_max_right _ _) hn) | |
| have htri := dist_triangle4 (f (Ο m) p) (f (Ο m) (q j)) (f (Ο n) (q j)) (f (Ο n) p) | |
| rw [dist_comm (f (Ο m) p) (f (Ο m) (q j))] at htri | |
| linarith only [htri,hm',hn',hmn,hΞ΅] | |
| choose l hl using fun p => cauchySeq_tendsto_of_complete (hcauchy p) | |
| refine β¨Ο,l,hΟ,?_,?_β© | |
| Β· intro p | |
| exact hK.isClosed.mem_of_tendsto (hl p) (Eventually.of_forall (fun n => hbounded (Ο n) p p.property)) | |
| Β· intro p u hu | |
| apply Metric.tendsto_atTop.mpr | |
| intro Ξ΅ hΞ΅ | |
| obtain β¨r,hr,hrfβ© := hcont p p.property (Ξ΅/3) (by positivity) | |
| have hu' : βαΆ n in atTop, dist (u n) (p : X) < r := (Metric.tendsto_nhds.mp hu) r hr | |
| have hl' : βαΆ n in atTop, dist (f (Ο n) p) (l p) < Ξ΅/3 := | |
| (Metric.tendsto_nhds.mp (hl p)) (Ξ΅/3) (by positivity) | |
| apply eventually_atTop.mp | |
| filter_upwards [hΟ.tendsto_atTop.eventually hrf,hu',hl'] with n hn hnu hnl | |
| have hh := hn (u n) hnu | |
| have ht := dist_triangle (f (Ο n) (u n)) (f (Ο n) p) (l p) | |
| linarith only [hh,ht,hnl,hΞ΅] | |
| lemma asymptotic_continuity_of_radial | |
| {X Y : Type*} [MetricSpace X] [MetricSpace Y] | |
| (f : β β X β Y) (G : Set X) (r e : β β β) | |
| (hr : β j, 0 < r j) (he : Tendsto e atTop (π 0)) | |
| (hb : β p β G, β j, βαΆ n in atTop, | |
| β q, dist q p < r j β dist (f n q) (f n p) β€ e j) : | |
| β p β G, β Ξ΅ > 0, β Ξ΄ > 0, | |
| βαΆ n in atTop, β q, dist q p < Ξ΄ β dist (f n q) (f n p) β€ Ξ΅ := by | |
| intro p hp Ξ΅ hΞ΅ | |
| obtain β¨j,hjβ© := ((tendsto_order.mp he).2 Ξ΅ hΞ΅).exists | |
| refine β¨r j,hr j,?_β© | |
| filter_upwards [hb p hp j] with n hn q hq | |
| exact (hn q hq).trans hj.le | |
| lemma lower_distance_of_limit | |
| {X Y : Type*} [MetricSpace X] [MetricSpace Y] | |
| (f : β β X β Y) (Ο : β β β) (hΟ : StrictMono Ο) | |
| {p q : X} {x y : Y} (hp : Tendsto (fun n => f (Ο n) p) atTop (π x)) | |
| (hq : Tendsto (fun n => f (Ο n) q) atTop (π y)) | |
| {a : β} (ha : βαΆ n in atTop, a β€ dist (f n p) (f n q)) : a β€ dist x y := by | |
| exact ge_of_tendsto (hp.dist hq) (hΟ.tendsto_atTop.eventually ha) | |
| end PlanarHalving.Spatial | |
| namespace PlanarHalving.Spatial | |
| open Set Filter Metric | |
| open scoped Topology | |
| lemma geometric_scale {q h d : β} (hq : 0 < q) (hq1 : q < 1) | |
| (_hh : 0 < h) (hd : 0 < d) (hdh : d β€ h) : | |
| β j : β, 1 β€ j β§ h*q^j < d β§ q*d β€ h*q^j := by | |
| have ht : Tendsto (fun j : β => h*q^j) atTop (π 0) := by | |
| simpa using (tendsto_pow_atTop_nhds_zero_of_lt_one hq.le hq1).const_mul h | |
| have hex : β j : β, h*q^j < d := ((tendsto_order.mp ht).2 d hd).exists | |
| let j := Nat.find hex | |
| have hj : h*q^j < d := Nat.find_spec hex | |
| have hj0 : j β 0 := by | |
| intro h | |
| simp only [h,pow_zero,mul_one] at hj | |
| exact (not_lt_of_ge hdh) hj | |
| have hj1 : 1 β€ j := Nat.one_le_iff_ne_zero.mpr hj0 | |
| have hprev : d β€ h*q^(j-1) := by | |
| exact le_of_not_gt (Nat.find_min hex (show j-1 < j by omega)) | |
| refine β¨j,hj1,hj,?_β© | |
| have hp : q^j = q^(j-1)*q := by | |
| rw [β pow_succ] | |
| congr 1 | |
| omega | |
| rw [hp] | |
| nlinarith only [mul_le_mul_of_nonneg_left hprev hq.le] | |
| lemma geometric_lower_power {q h d s : β} (hq : 0 < q) (hq1 : q < 1) | |
| (hh : 0 < h) (hd : 0 < d) (hdh : d β€ h) (hs : 0 β€ s) : | |
| β j : β, 1 β€ j β§ h*q^j < d β§ | |
| q^s * (q/h)^s * d^s β€ (q^s)^(j+1) := by | |
| obtain β¨j,hj,hjd,hdjβ© := geometric_scale hq hq1 hh hd hdh | |
| refine β¨j,hj,hjd,?_β© | |
| have hdiv : q/h*d β€ q^j := by | |
| have hv : q*d/h β€ q^j := (div_le_iffβ hh).mpr (by nlinarith only [hdj]) | |
| convert hv using 1 | |
| ring | |
| have hp := Real.rpow_le_rpow (by positivity : 0 β€ q/h*d) hdiv hs | |
| rw [Real.mul_rpow (by positivity) hd.le] at hp | |
| rw [pow_succ, Real.rpow_pow_comm hq.le] | |
| have ht := mul_le_mul_of_nonneg_left hp (Real.rpow_nonneg hq.le s) | |
| nlinarith only [ht] | |
| lemma inverse_holder_of_radial_limits | |
| {X Y : Type*} [MetricSpace X] [MetricSpace Y] | |
| (f : β β X β Y) (Ο : β β β) (hΟ : StrictMono Ο) | |
| (G : Set X) (l : G β Y) | |
| (hl : β p : G, Tendsto (fun n => f (Ο n) p) atTop (π (l p))) | |
| {q h s : β} (hq : 0 < q) (hq1 : q < 1) (hh : 0 < h) (hs : 0 < s) | |
| (hdiam : β p p' : G, dist (p : X) p' β€ h) | |
| (hlower : β p : G, β j : β, 1 β€ j β βαΆ n in atTop, | |
| β p' : G, h*q^j < dist (p : X) p' β (q^s)^(j+1) β€ dist (f n p) (f n p')) : | |
| β p p' : G, (q^s * (q/h)^s) * dist (p : X) p' ^ s β€ dist (l p) (l p') := by | |
| intro p p' | |
| by_cases hpp : p = p' | |
| Β· subst p' | |
| simp [Real.zero_rpow hs.ne'] | |
| Β· have hd : 0 < dist (p : X) p' := dist_pos.mpr (Subtype.coe_ne_coe.mpr hpp) | |
| obtain β¨j,hj,hjd,hdjβ© := geometric_lower_power hq hq1 hh hd (hdiam p p') hs.le | |
| apply hdj.trans | |
| apply lower_distance_of_limit f Ο hΟ (hl p) (hl p') | |
| filter_upwards [hlower p j hj] with n hn | |
| exact hn p' hjd | |
| end PlanarHalving.Spatial | |
| namespace PlanarHalving.Limits | |
| open MeasureTheory Set Filter | |
| open scoped Topology NNReal | |
| theorem finiteMeasure_subsequence | |
| {X : Type*} [MetricSpace X] [CompactSpace X] [Nonempty X] | |
| [MeasurableSpace X] [BorelSpace X] | |
| (ΞΌ : β β β β FiniteMeasure X) (C : β β ββ₯0) | |
| (hbound : β n j, (ΞΌ n j).mass β€ C j) : | |
| β (Ο : β β β) (Ξ½ : β β FiniteMeasure X), StrictMono Ο β§ | |
| β j, Tendsto (fun n => ΞΌ (Ο n) j) atTop (π (Ξ½ j)) := by | |
| let F : β β β j : β, (Icc (0 : ββ₯0) (C j)) Γ ProbabilityMeasure X := | |
| fun n j => (β¨(ΞΌ n j).mass,zero_le,hbound n jβ©,(ΞΌ n j).normalize) | |
| obtain β¨g,Ο,hΟ,hgβ© := CompactSpace.tendsto_subseq F | |
| refine β¨Ο,fun j => (g j).1.val β’ (g j).2.toFiniteMeasure,hΟ,?_β© | |
| intro j | |
| have hj := (tendsto_pi_nhds.mp hg) j | |
| have hm := continuous_subtype_val.tendsto _ |>.comp ((continuous_fst.tendsto (g j)).comp hj) | |
| have hn := (ProbabilityMeasure.toFiniteMeasure_isEmbedding X).continuous.tendsto _ |>.comp | |
| ((continuous_snd.tendsto (g j)).comp hj) | |
| have ht := hm.smul hn | |
| convert ht using 1 | |
| funext n | |
| exact (ΞΌ (Ο n) j).self_eq_mass_smul_normalize | |
| end PlanarHalving.Limits | |
| namespace PlanarHalving.RankCoordinates | |
| open Set | |
| lemma variation_le_two {f : β β β} {n : β} | |
| (hf : β i β€ n, 0 β€ f i β§ f i β€ 1) | |
| (hqc : β i j k, i β€ j β j β€ k β k β€ n β min (f i) (f k) β€ f j) : | |
| β i β Finset.range n, |f (i+1)-f i| β€ 2 := by | |
| classical | |
| obtain β¨k,hk,hmaxβ© := (Finset.range (n+1)).exists_max_image f (by simp) | |
| have hkn : k β€ n := by simpa only [Finset.mem_range,Nat.lt_succ_iff] using hk | |
| have hleft : β i β Finset.range k, |f (i+1)-f i| = f k-f 0 := by | |
| rw [β Finset.sum_range_sub f k] | |
| apply Finset.sum_congr rfl | |
| intro i hi | |
| have hik : i < k := Finset.mem_range.mp hi | |
| apply abs_of_nonneg | |
| apply sub_nonneg.mpr | |
| have hq := hqc i (i+1) k (by omega) (by omega) hkn | |
| rw [min_eq_left (hmax i (by simp; omega))] at hq | |
| exact hq | |
| have hright : β i β Finset.Ico k n, |f (i+1)-f i| = f k-f n := by | |
| calc | |
| _ = - β i β Finset.Ico k n, (f (i+1)-f i) := by | |
| rw [β Finset.sum_neg_distrib] | |
| apply Finset.sum_congr rfl | |
| intro i hi | |
| obtain β¨hki,hinβ© := Finset.mem_Ico.mp hi | |
| apply abs_of_nonpos | |
| apply sub_nonpos.mpr | |
| have hq := hqc k i (i+1) hki (by omega) (by omega) | |
| rw [min_eq_right (hmax (i+1) (by simp; omega))] at hq | |
| exact hq | |
| _ = _ := by rw [Finset.sum_Ico_sub f hkn]; ring | |
| rw [β Finset.sum_range_add_sum_Ico (fun i => |f (i+1)-f i|) hkn,hleft,hright] | |
| have h0 := (hf 0 (Nat.zero_le n)).1 | |
| have hn := (hf n le_rfl).1 | |
| have hk1 := (hf k hkn).2 | |
| linarith only [h0,hn,hk1] | |
| lemma min_le_of_quasiconcave {f : β β β} (hf : QuasiconcaveOn β univ f) | |
| {x y z : β} (hxy : x β€ y) (hyz : y β€ z) : min (f x) (f z) β€ f y := by | |
| have hc := (hf (min (f x) (f z))).ordConnected | |
| have hx : x β univ β© {u | min (f x) (f z) β€ f u} := by | |
| refine β¨mem_univ _,?_β© | |
| change min (f x) (f z) β€ f x | |
| exact min_le_left _ _ | |
| have hz : z β univ β© {u | min (f x) (f z) β€ f u} := by | |
| refine β¨mem_univ _,?_β© | |
| change min (f x) (f z) β€ f z | |
| exact min_le_right _ _ | |
| exact (hc.out hx hz β¨hxy,hyzβ©).2 | |
| lemma concave_cdf_variation {f F : β β β} (hf : ConcaveOn β univ f) | |
| (hF : Monotone F) (hFrange : β x, F x β Icc 0 1) | |
| (x : β β β) (hx : Monotone x) (n : β) : | |
| β i β Finset.range n, |F (f (x (i+1)))-F (f (x i))| β€ 2 := by | |
| apply variation_le_two (fun i _ => hFrange (f (x i))) | |
| intro i j k hij hjk _ | |
| rw [β hF.map_min] | |
| exact hF (min_le_of_quasiconcave hf.quasiconcaveOn (hx hij) (hx hjk)) | |
| lemma sigmoid_variation {f : β β β} (hf : ConcaveOn β univ f) | |
| {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) (x : β β β) (hx : Monotone x) (n : β) : | |
| β i β Finset.range n, | |
| |Real.sigmoid (f (x (i+1))/Ξ΅)-Real.sigmoid (f (x i)/Ξ΅)| β€ 2 := by | |
| apply concave_cdf_variation hf | |
| (fun _ _ h => Real.sigmoid_strictMono.monotone (div_le_div_of_nonneg_right h hΞ΅.le)) | |
| (fun _ => β¨(Real.sigmoid_pos _).le,(Real.sigmoid_lt_one _).leβ©) x hx n | |
| lemma smoothed_variation {m : β} (hm : 0 < m) (g : Fin m β β β β) | |
| (hg : β j, ConvexOn β univ (g j)) {f : β β β} (hf : ConcaveOn β univ f) | |
| {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) (x : β β β) (hx : Monotone x) (n : β) : | |
| β i β Finset.range n, | |
| |smoothed g Ξ΅ (x (i+1),f (x (i+1)))-smoothed g Ξ΅ (x i,f (x i))| β€ 2 := by | |
| have hmR : (0 : β) < m := Nat.cast_pos.mpr hm | |
| have hterm (i : β) : | |
| |smoothed g Ξ΅ (x (i+1),f (x (i+1)))-smoothed g Ξ΅ (x i,f (x i))| β€ | |
| (β j, |Real.sigmoid ((f (x (i+1))-g j (x (i+1)))/Ξ΅) - | |
| Real.sigmoid ((f (x i)-g j (x i))/Ξ΅)|) / m := by | |
| unfold smoothed | |
| rw [β sub_div,abs_div,abs_of_pos hmR,β Finset.sum_sub_distrib] | |
| exact div_le_div_of_nonneg_right (Finset.abs_sum_le_sum_abs _ _) hmR.le | |
| calc | |
| _ β€ β i β Finset.range n, (β j, |Real.sigmoid ((f (x (i+1))-g j (x (i+1)))/Ξ΅) - | |
| Real.sigmoid ((f (x i)-g j (x i))/Ξ΅)|) / m := Finset.sum_le_sum (fun i _ => hterm i) | |
| _ = (β j : Fin m, β i β Finset.range n, | |
| |Real.sigmoid ((f (x (i+1))-g j (x (i+1)))/Ξ΅) - | |
| Real.sigmoid ((f (x i)-g j (x i))/Ξ΅)|) / m := by | |
| rw [β Finset.sum_div,Finset.sum_comm] | |
| _ β€ (β _j : Fin m, (2 : β))/m := by | |
| apply div_le_div_of_nonneg_right _ hmR.le | |
| exact Finset.sum_le_sum (fun j _ => sigmoid_variation (hf.sub (hg j)) hΞ΅ x hx n) | |
| _ = 2 := by simp; field_simp | |
| end PlanarHalving.RankCoordinates | |
| end OAI | |