Pratik Patil

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.