ThreeLabelPerturbationAnalysisInverse.lean
1module23public import SubentropyCertificates.ThreeLabelPerturbationAnalysis4public import SubentropyCertificates.SharpGuessingBound5public import SubentropyCertificates.QuadraticCurve67/-! The two genuine inverse bounds in the three-label example near zero perturbation. -/8@[expose] public section9noncomputable section10open Set Filter Asymptotics11open scoped Topology12namespace SubentropyCertificates.ThreeLabelPerturbation13open SubentropyCertificates.ClassicalCurve SubentropyCertificates.Discrimination14open SubentropyCertificates.Quadratic (inverse)1516private theorem small_right : βαΆ e : β in π[>] 0, e β Ioo 0 (1/12) :=17 Ioo_mem_nhdsGT_of_mem β¨le_rfl,by norm_numβ©1819private theorem leading {f : β β β} {a C : β}20 (h : β e β Ioo 0 (1/12:β), 0 β€ f e-a*e^2 β§ f e-a*e^2 β€ C*e^4) :21 Tendsto (fun e β¦ f e/e^2) (π[>] 0) (π a) := by22 have hz : Tendsto (fun e : β β¦ e) (π[>] 0) (π 0) := nhdsWithin_le_nhds23 have hh : Tendsto (fun e : β β¦ a+C*e^2) (π[>] 0) (π a) := by24 simpa using (tendsto_const_nhds (x := a)).add ((tendsto_const_nhds (x := C)).mul (hz.pow 2))25 apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hh26 Β· filter_upwards [small_right] with e he27 exact (le_div_iffβ (sq_pos_of_pos he.1)).2 (by linarith [(h e he).1])28 Β· filter_upwards [small_right] with e he29 exact (div_le_iffβ (sq_pos_of_pos he.1)).2 (by nlinarith [(h e he).2])3031theorem spectralDifference_leading :32 Tendsto (fun e : β β¦ spectralDifference e/e^2) (π[>] 0) (π alpha) := by33 apply leading (C := 48*alpha)34 intro e he35 exact spectralDifference_remainder (by simpa only [abs_of_pos he.1] using he.2.le)3637theorem quadratic_remainder {e : β} (he : |e| β€ 1/12) :38 0 β€ inverse 1 (e^2)-e^2 β§ inverse 1 (e^2)-e^2 β€ 3*e^4 := by39 have he2 := pow_le_pow_leftβ (abs_nonneg e) he 240 rw [sq_abs] at he241 have h := Quadratic.inverse_spec 1 (e^2) (show e^2 β Icc 0 (Quadratic.radius 1 / 2) by42 norm_num [Quadratic.radius]; constructor <;> nlinarith [sq_nonneg e])43 let x := inverse 1 (e^2)44 have hr : Quadratic.radius 1 = 2/3 := by norm_num [Quadratic.radius]45 have hx : x β Icc 0 (2/3:β) := by simpa only [x,hr] using h.146 have heq : x - x^2/(2*(2/3)) = e^2 := by simpa only [x,Quadratic.curve,hr] using h.247 field_simp at heq48 norm_num at heq49 have hu : x β€ 2*e^2 := by nlinarith [mul_nonneg hx.1 (sub_nonneg.mpr hx.2)]50 change 0 β€ x-e^2 β§ x-e^2 β€ 3*e^451 constructor52 Β· nlinarith [sq_nonneg x]53 Β· nlinarith [mul_nonneg (sub_nonneg.mpr hu) (add_nonneg (show 0 β€ 2*e^2 by positivity) hx.1)]5455theorem quadratic_expansion :56 (fun e β¦ inverse 1 (e^2)-e^2) =O[π[>] (0:β)] (fun e β¦ e^4) := by57 refine isBigO_iff.mpr β¨3,?_β©58 filter_upwards [small_right] with e he59 obtain β¨hl,huβ© := quadratic_remainder (e := e) (by simpa only [abs_of_pos he.1] using he.2.le)60 rw [Real.norm_eq_abs,abs_of_nonneg hl,Real.norm_eq_abs,abs_of_nonneg (by positivity : 0 β€ e^4)]61 exact hu6263theorem quadratic_leading :64 Tendsto (fun e : β β¦ inverse 1 (e^2)/e^2) (π[>] 0) (π 1) := by65 apply leading (C := 3)66 intro e he67 simpa only [one_mul] using quadratic_remainder (e := e) (by simpa only [abs_of_pos he.1] using he.2.le)6869private theorem spectralDifference_tendsto : Tendsto spectralDifference (π[>] 0) (π 0) := by70 have hz : Tendsto (fun e : β β¦ e) (π[>] 0) (π 0) := nhdsWithin_le_nhds71 have h := spectralDifference_leading.mul (hz.pow 2)72 simp only [zero_pow (by decide : (2:β) β 0),mul_zero] at h73 apply h.congr'74 filter_upwards [small_right] with e he75 exact div_mul_cancelβ _ (pow_ne_zero 2 he.1.ne')7677theorem spectralDifference_mem_eventually :78 βαΆ e : β in π[>] 0, 0 < spectralDifference e β§ spectralDifference e β curveRange 1 := by79 have hupper := spectralDifference_tendsto.eventually_lt_const80 (phi_pos 1 (show 0 < uniformError 1 by norm_num [uniformError]) le_rfl)81 have h := spectralDifference_leading.eventually_const_lt (show 0 < alpha from zero_lt_one.trans coefficient_gt_one)82 filter_upwards [small_right,hupper,h] with e he hu hp83 have hpos : 0 < spectralDifference e := by84 simpa only [zero_mul] using (lt_div_iffβ (sq_pos_of_pos he.1)).mp hp85 exact β¨hpos,hpos.le,hu.leβ©8687/-- A total extension for writing limits. Near zero its first branch is always the true inverse. -/88def spectralBound (e : β) : β := by89 classical90 exact if h : spectralDifference e β curveRange 1 then phiInverse 1 _ h else 09192theorem spectralBound_eq {e : β} (he : spectralDifference e β curveRange 1) :93 spectralBound e = phiInverse 1 _ he := by simp [spectralBound,he]9495private theorem bound_tendsto : Tendsto spectralBound (π[>] 0) (π[>] 0) := by96 have hlim : Tendsto spectralBound (π[>] 0) (π 0) := by97 apply tendsto_order.mpr98 constructor99 Β· intro b hb100 filter_upwards [spectralDifference_mem_eventually] with e he101 rw [spectralBound_eq he.2]102 exact hb.trans_le (phiInverse_mem 1 _ he.2).1103 Β· intro b hb104 by_cases hh : uniformError 1 < b105 Β· filter_upwards [spectralDifference_mem_eventually] with e he106 exact (spectralBound_eq he.2).trans_lt ((phiInverse_mem 1 _ he.2).2.trans_lt hh)107 have hm : b β Icc 0 (uniformError 1) := β¨hb.le,le_of_not_gt hhβ©108 have hq := spectralDifference_tendsto.eventually_lt_const (phi_pos 1 hb hm.2)109 filter_upwards [spectralDifference_mem_eventually,hq] with e he hlt110 have h := phiInverse_strictMono 1 he.2 (phi_maps_to_curveRange 1 hm) hlt111 rw [phiInverse_phi 1 b hm] at h112 rw [spectralBound_eq he.2]113 exact h114 apply tendsto_nhdsWithin_iff.mpr β¨hlim,?_β©115 filter_upwards [spectralDifference_mem_eventually] with e he116 rw [spectralBound_eq he.2]117 apply lt_of_le_of_ne (phiInverse_mem 1 _ he.2).1118 intro h119 have hq := phi_phiInverse 1 _ he.2120 rw [β h,phi_zero] at hq121 exact he.1.ne hq122123theorem spectralBound_leading :124 Tendsto (fun e : β β¦ spectralBound e/e^2) (π[>] 0) (π alpha) := by125 have hratio := (phi_div_error_tendsto_one 1).comp bound_tendsto126 have h := spectralDifference_leading.div hratio one_ne_zero127 rw [div_one] at h128 apply h.congr'129 filter_upwards [spectralDifference_mem_eventually] with e he130 change spectralDifference e/e^2/(phi 1 (spectralBound e)/spectralBound e) = _131 rw [spectralBound_eq he.2,phi_phiInverse]132 exact div_div_div_cancel_left' _ _ he.1.ne'133134theorem spectralBound_expansion :135 (fun e β¦ spectralBound e-alpha*e^2) =o[π[>] (0:β)] (fun e β¦ e^2) := by136 apply isLittleO_of_tendsto'137 Β· filter_upwards [small_right] with e he138 exact fun hz β¦ False.elim (pow_ne_zero 2 he.1.ne' hz)139 Β· have h := spectralBound_leading.sub (tendsto_const_nhds (x := alpha))140 rw [sub_self] at h141 apply h.congr'142 filter_upwards [small_right] with e he143 field_simp [he.1.ne']144145/-- For all sufficiently small positive Ξ΅ the actual subentropy inverse exceeds the146increasing-branch quadratic inverse. The bound here carries its own domain proof. -/147theorem spectralBound_stronger :148 βαΆ e : β in π[>] 0, β h : spectralDifference e β curveRange 1,149 inverse 1 (e^2) < phiInverse 1 (spectralDifference e) h := by150 have h := quadratic_leading.eventually_lt spectralBound_leading coefficient_gt_one151 filter_upwards [small_right,spectralDifference_mem_eventually,h] with e he hq hlt152 exact β¨hq.2,(spectralBound_eq hq.2) βΈ (div_lt_div_iff_of_pos_right (sq_pos_of_pos he.1)).mp hltβ©153154end SubentropyCertificates.ThreeLabelPerturbation
Axioms used
Choose a statement to see which axioms its proof uses.