module public import SubentropyCertificates.BinaryCrossoverOrder public import SubentropyCertificates.CrossoverEndpoints /-! The certified numerical bracket selects the unique interior crossover. -/ @[expose] public section noncomputable section open Set namespace SubentropyCertificates.BinaryCrossover open SubentropyCertificates.SmallOverlap SubentropyCertificates.ClassicalCurve /-- The unique interior root in the overlap has the stated rational enclosure. -/ theorem crossover_bracket : ∃! s : ℝ, s ∈ Ioo 0 1 ∧ gap (s^2) = 0 ∧ 767875711400/1000000000000 < s ∧ s < 767875711401/1000000000000 ∧ ∀ t ∈ Ioo (0:ℝ) 1, gap (t^2) = 0 ↔ t = s := by obtain ⟨u,hu,hu0,uniq,low,high⟩ := crossing_exists let a : ℝ := 767875711400/1000000000000 let b : ℝ := 767875711401/1000000000000 have ha : a ∈ Ioo (0:ℝ) 1 := by norm_num [a] have hb : b ∈ Ioo (0:ℝ) 1 := by norm_num [b] have hf := BinaryIntervals.crossover_endpoint_signs change conditionalCurve a - phi 0 (a^2/4) < 0 ∧ 0 < conditionalCurve b - phi 0 (b^2/4) at hf have hfa : gap (a^2) < 0 := by simpa [gap,Real.sqrt_sq ha.1.le] using hf.1 have hfb : 0 < gap (b^2) := by simpa [gap,Real.sqrt_sq hb.1.le] using hf.2 have huA : a^2 < u := by rcases lt_trichotomy (a^2) u with h|h|h · exact h · rw [h,hu0] at hfa; exact False.elim (lt_irrefl _ hfa) · have hle : a^2 ≤ 1 := by norm_num [a] exact False.elim ((not_lt.mpr (high _ ⟨h,hle⟩).le) hfa) have huB : u < b^2 := by rcases lt_trichotomy u (b^2) with h|h|h · exact h · rw [← h,hu0] at hfb; exact False.elim (lt_irrefl _ hfb) · exact False.elim (not_lt.mpr (low _ ⟨sq_pos_of_pos hb.1,h⟩).le hfb) have hroot := Real.sq_sqrt hu.1.le have rootpos := Real.sqrt_pos.2 hu.1 have hRa : a < Real.sqrt u := (Real.lt_sqrt ha.1.le).2 huA have hRb : Real.sqrt u < b := (Real.sqrt_lt' hb.1).2 huB have hR1 := lt_trans hRb hb.2 have idroot (s : ℝ) (hs : s ∈ Ioo 0 1) : gap (s^2) = 0 ↔ s = Real.sqrt u := by rw [uniq _ ⟨sq_pos_of_pos hs.1,by nlinarith [mul_pos hs.1 (sub_pos.mpr hs.2),hs.2]⟩] exact ⟨fun h ↦ (Real.sqrt_sq hs.1.le).symm.trans (congrArg Real.sqrt h), fun h ↦ h ▸ hroot⟩ refine ⟨Real.sqrt u, ⟨⟨rootpos,hR1⟩, by rwa [hroot], hRa,hRb,idroot⟩, ?_⟩ intro s hs exact (idroot s hs.1).mp hs.2.1 end SubentropyCertificates.BinaryCrossover