BinaryCrossoverOrder.lean
1module23public import SubentropyCertificates.BinaryCrossoverConvex4public import Mathlib.Analysis.Convex.Slope56/-! Existence, uniqueness and sign of the crossing in Appendix F.3. -/7@[expose] public section8noncomputable section9set_option autoImplicit false10set_option backward.isDefEq.respectTransparency false11open Set Filter12open scoped Topology13namespace SubentropyCertificates.BinaryCrossover14open SubentropyCertificates.SmallOverlap15open SubentropyCertificates.ClassicalCurve16open SubentropyCertificates.Discrimination1718theorem gap_zero : gap 0 = 0 := by norm_num [gap,conditionalCurve,phi_zero]1920theorem gap_one_pos : 0 < gap 1 := by21 have h := phi_strictMono 022 (show (1/4 : ℝ) ∈ Icc 0 (uniformError 0) by norm_num [uniformError])23 (show (1/2 : ℝ) ∈ Icc 0 (uniformError 0) by norm_num [uniformError]) (by norm_num)24 simpa [gap, conditionalCurve, phi_zero, sub_pos] using h2526theorem gap_continuousOn : ContinuousOn gap (Icc (0 : ℝ) 1) := by27 have h1 : ContinuousOn (fun t : ℝ ↦ (1-Real.sqrt t)/2) (Icc 0 1) := by fun_prop28 have h2 : ContinuousOn (fun t : ℝ ↦ t/4) (Icc 0 1) := by fun_prop29 have h1' (t : ℝ) (ht : t ∈ Icc 0 1) : (1-Real.sqrt t)/2 ∈ Icc (0:ℝ) 1 := by30 have hh := Real.sqrt_le_sqrt ht.231 rw [Real.sqrt_one] at hh32 constructor <;> linarith [Real.sqrt_nonneg t]33 have h2' (t : ℝ) (ht : t ∈ Icc 0 1) : t/4 ∈ Icc (0:ℝ) 1 := by constructor <;> linarith [ht.1,ht.2]34 exact (continuousOn_const.sub ((phi_continuous 0).comp h1 h1')).sub35 ((phi_continuous 0).comp h2 h2')3637theorem gap_slope_tendsto : Tendsto (fun t ↦ gap t/t) (𝓝[>] (0:ℝ)) (𝓝 (-1/12)) := by38 have ht : Tendsto (fun x : ℝ ↦ x) (𝓝[>] 0) (𝓝 0) := nhdsWithin_le_nhds39 have htpos : ∀ᶠ t : ℝ in 𝓝[>] 0, 0 < t := self_mem_nhdsWithin40 have hs : Tendsto Real.sqrt (𝓝[>] (0:ℝ)) (𝓝[>] 0) := by41 apply tendsto_nhdsWithin_iff.mpr42 exact ⟨by simpa only [Function.comp_def, Real.sqrt_zero] using Real.continuous_sqrt.continuousAt.tendsto.comp ht,43 htpos.mono (fun t (h : 0 < t) ↦ Real.sqrt_pos.2 h)⟩44 have h4 : Tendsto (fun t : ℝ ↦ t/4) (𝓝[>] 0) (𝓝[>] 0) := by45 apply tendsto_nhdsWithin_iff.mpr46 exact ⟨by simpa using ht.div_const 4,47 htpos.mono (fun t (h : 0 < t) ↦ by change 0 < t/4; positivity)⟩48 have h := (overlap_leading_terms.1.comp hs).sub49 (((phi_div_error_tendsto_one 0).comp h4).div_const 4)50 have hl : (1/6:ℝ)-1/4 = -1/12 := by norm_num51 rw [← hl]52 apply h.congr'53 filter_upwards [self_mem_nhdsWithin] with t (ht : 0<t)54 change conditionalCurve (Real.sqrt t)/(Real.sqrt t)^2 - phi 0 (t/4)/(t/4)/4 = gap t/t55 rw [Real.sq_sqrt ht.le]56 unfold gap57 ring5859theorem gap_right_derivative : HasDerivWithinAt gap (-1/12) (Ioi 0) 0 := by60 apply (hasDerivWithinAt_iff_tendsto_slope' (show (0:ℝ) ∉ Ioi 0 from lt_irrefl _)).261 simpa only [slope_fun_def_field,gap_zero,sub_zero] using gap_slope_tendsto6263theorem gap_ratio_strictMono : StrictMonoOn (fun t : ℝ ↦ gap t/t) (Ioc 0 1) := by64 intro x hx y hy hxy65 have h := gap_strictConvex.secant_strict_mono_aux2 (show (0:ℝ) ∈ Icc 0 1 by norm_num)66 ⟨hy.1.le,hy.2⟩ hx.1 hxy67 simpa only [gap_zero,sub_zero] using h6869/-- The unique positive crossing in the squared overlap, with ordering on both sides. -/70theorem crossing_exists :71 ∃ u ∈ Ioo (0:ℝ) 1, gap u = 0 ∧72 (∀ t ∈ Ioc (0:ℝ) 1, gap t = 0 ↔ t = u) ∧73 (∀ t ∈ Ioo (0:ℝ) u, gap t < 0) ∧ (∀ t ∈ Ioc u 1, 0 < gap t) := by74 have hneg := gap_slope_tendsto.eventually_lt_const (show (-1/12:ℝ)<0 by norm_num)75 have hsmall : ∀ᶠ t : ℝ in 𝓝[>] 0, t ∈ Ioo 0 1 := Ioo_mem_nhdsGT_of_mem ⟨le_rfl,zero_lt_one⟩76 obtain ⟨w,hw,hw'⟩ := (hsmall.and hneg).exists77 have hwneg : gap w < 0 := by simpa using (div_lt_iff₀ hw.1).mp hw'78 have hsubset : Icc w 1 ⊆ Icc (0:ℝ) 1 := Icc_subset_Icc_left hw.1.le79 obtain ⟨u,hu,hu0⟩ := intermediate_value_Icc hw.2.le (gap_continuousOn.mono hsubset)80 (show (0:ℝ) ∈ Icc (gap w) (gap 1) from ⟨hwneg.le,gap_one_pos.le⟩)81 have hu1 : u < 1 := lt_of_le_of_ne hu.2 (fun he ↦ by rw [he] at hu0; linarith [gap_one_pos])82 have hu' := lt_of_lt_of_le hw.1 hu.183 have low (t : ℝ) (ht : t ∈ Ioo 0 u) : gap t < 0 := by84 have hh := gap_ratio_strictMono ⟨ht.1,ht.2.le.trans hu.2⟩ ⟨hu',hu.2⟩ ht.285 change gap t/t < gap u/u at hh86 rw [hu0,zero_div] at hh87 simpa using (div_lt_iff₀ ht.1).mp hh88 have high (t : ℝ) (ht : t ∈ Ioc u 1) : 0 < gap t := by89 have ht0 := hu'.trans ht.190 have hh := gap_ratio_strictMono ⟨hu',hu.2⟩ ⟨ht0,ht.2⟩ ht.191 change gap u/u < gap t/t at hh92 rw [hu0,zero_div] at hh93 simpa using (lt_div_iff₀ ht0).1 hh94 refine ⟨u,⟨hu',hu1⟩,hu0,?_,low,high⟩95 intro t ht96 refine ⟨fun h ↦ ?_, fun h ↦ h ▸ hu0⟩97 rcases lt_trichotomy t u with htu|he|hut98 · exact False.elim (ne_of_lt (low t ⟨ht.1,htu⟩) h)99 · exact he100 · exact False.elim (ne_of_gt (high t ⟨hut,ht.2⟩) h)101102/-- The sign comparison in the paper is between the original lower bound and s²/4. -/103theorem bound_comparison (s : Icc (0:ℝ) 1) :104 (subentropyBound s < (s:ℝ)^2/4 ↔ gap ((s:ℝ)^2) < 0) ∧105 (subentropyBound s = (s:ℝ)^2/4 ↔ gap ((s:ℝ)^2) = 0) ∧106 ((s:ℝ)^2/4 < subentropyBound s ↔ 0 < gap ((s:ℝ)^2)) := by107 have hq := phiInverse_mem 0 _ (conditionalCurve_mem s)108 have hs : (s:ℝ)^2/4 ∈ Icc 0 (uniformError 0) := by109 have hsq := pow_le_pow_left₀ s.2.1 s.2.2 2110 rw [one_pow] at hsq111 rw [show uniformError 0 = 1/2 by norm_num [uniformError]]112 constructor <;> nlinarith [sq_nonneg (s:ℝ)]113 change subentropyBound s ∈ Icc 0 (uniformError 0) at hq114 have hm := phi_strictMono 0115 unfold gap116 rw [Real.sqrt_sq s.2.1, ← phi_bound s, sub_neg, sub_eq_zero, sub_pos]117 exact ⟨(hm.lt_iff_lt hq hs).symm, (hm.eq_iff_eq hq hs).symm, (hm.lt_iff_lt hs hq).symm⟩118119120/-- The unique interior threshold in the physical overlap: the subentropy bound is smaller121than the fidelity bound below it and larger above it. Orthogonal signals give equality at zero. -/122theorem overlap_crossing :123 ∃ s₀ ∈ Ioo (0:ℝ) 1, ∀ s : Icc (0:ℝ) 1,124 (subentropyBound s = (s:ℝ)^2/4 ↔ (s:ℝ) = 0 ∨ (s:ℝ) = s₀) ∧125 (0 < (s:ℝ) → (s:ℝ) < s₀ → subentropyBound s < (s:ℝ)^2/4) ∧126 (s₀ < (s:ℝ) → (s:ℝ)^2/4 < subentropyBound s) := by127 obtain ⟨u,hu,hu0,huniq,hlo,hhi⟩ := crossing_exists128 have hr := Real.sq_sqrt hu.1.le129 have hrpos := Real.sqrt_pos.2 hu.1130 refine ⟨Real.sqrt u,⟨hrpos,?_⟩,?_⟩131 · exact (Real.sqrt_lt' zero_lt_one).2 (by simpa only [one_pow] using hu.2)132 intro s133 obtain ⟨hlt,heq,hgt⟩ := bound_comparison s134 have hs1 : (s:ℝ)^2 ≤ 1 := by simpa only [one_pow] using pow_le_pow_left₀ s.2.1 s.2.2 2135 constructor136 · rw [heq]137 by_cases h : (s:ℝ) = 0138 · simp [h, gap_zero]139 have hp := lt_of_le_of_ne s.2.1 (Ne.symm h)140 rw [huniq _ ⟨sq_pos_of_pos hp,hs1⟩, or_iff_right h]141 constructor142 · intro e143 exact (Real.sqrt_sq s.2.1).symm.trans (congrArg Real.sqrt e)144 · rintro e145 rw [e,hr]146 constructor147 · intro hs0 h148 apply hlt.2 (hlo _ ⟨sq_pos_of_pos hs0, ?_⟩)149 nlinarith [mul_pos (sub_pos.mpr h) (add_pos hrpos hs0)]150 · intro h151 apply hgt.2 (hhi _ ⟨?_,hs1⟩)152 nlinarith [mul_pos (sub_pos.mpr h) (add_pos hrpos (hrpos.trans h))]153154end SubentropyCertificates.BinaryCrossover
Axioms used
Choose a statement to see which axioms its proof uses.