import OAI.Combinatorics.CycleDecomposition.ReservoirSampling namespace OAI universe cycleUniverse1 cycleUniverse2 cycleUniverse3 cycleUniverse4 cycleUniverse5 cycleUniverse6 cycleUniverse7 cycleUniverse8 section open Filter Asymptotics Real open scoped Topology noncomputable section open MeasureTheory ProbabilityTheory Finset noncomputable section namespace ErdosGallai.Splitting open MeasureTheory ProbabilityTheory Finset Real section BernoulliBounds variable {Ω : Type cycleUniverse1} {I : Type cycleUniverse2} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] lemma indicator_mem_Icc {Ω : Type cycleUniverse3} [_contextInstance1 : MeasurableSpace Ω] {X : Ω → ℝ} (hX : ∀ ω, X ω = 0 ∨ X ω = 1) (ω : Ω) : X ω ∈ Set.Icc (0 : ℝ) 1 := by rcases hX ω with h | h <;> simp [h] lemma mgf_indicator {X : Ω → ℝ} (hm : Measurable X) (hX : ∀ ω, X ω = 0 ∨ X ω = 1) (p t : ℝ) (hp : ∫ ω, X ω ∂μ = p) : mgf X μ t = 1 + p * (exp t - 1) := by have hXi : Integrable X μ := Integrable.of_mem_Icc 0 1 hm.aemeasurable (ae_of_all _ (indicator_mem_Icc hX)) have heq : (fun ω => exp (t * X ω)) = fun ω => (1 : ℝ) + (exp t - 1) * X ω := by funext ω rcases hX ω with h | h <;> simp [h] rw [mgf, heq, integral_add (integrable_const _) (hXi.const_mul _), integral_const_mul, hp, integral_const] simp [mul_comm] lemma mgf_indicator_sum_bound {X : I → Ω → ℝ} (s : Finset I) (hm : ∀ i, Measurable (X i)) (hi : iIndepFun X μ) (hX : ∀ i ω, X i ω = 0 ∨ X i ω = 1) (p t : ℝ) (hp : ∀ i, ∫ ω, X i ω ∂μ = p) : mgf (∑ i ∈ s, X i) μ t ≤ exp ((s.card : ℝ) * p * (exp t - 1)) := by by_cases hs : s.Nonempty swap · have he := Finset.not_nonempty_iff_eq_empty.mp hs simp [he] rw [hi.mgf_sum hm] have heq : (∏ i ∈ s, mgf (X i) μ t) = (1 + p * (exp t - 1)) ^ s.card := by simp_rw [mgf_indicator (hm _) (hX _) p t (hp _)] simp rw [heq] have hn : 0 ≤ 1 + p * (exp t - 1) := by obtain ⟨i, _⟩ := hs rw [← mgf_indicator (hm i) (hX i) p t (hp i)] exact mgf_nonneg calc (1 + p * (exp t - 1)) ^ s.card ≤ exp (p * (exp t - 1)) ^ s.card := pow_le_pow_left₀ hn (by linarith [add_one_le_exp (p * (exp t - 1))]) _ _ = _ := by rw [← exp_nat_mul]; congr 1; ring lemma exp_neg_half_bound : exp (-(1 / 2 : ℝ)) ≤ 5 / 8 := by have he : exp (1 / 2 : ℝ) * exp (1 / 2 : ℝ) = exp 1 := by rw [← exp_add]; norm_num have hlow : (8 / 5 : ℝ) ≤ exp (1 / 2 : ℝ) := by nlinarith [exp_one_gt_d9, exp_pos (1 / 2 : ℝ)] rw [exp_neg] exact (inv_le_comm₀ (exp_pos _) (by norm_num)).mpr (by norm_num at *; exact hlow) lemma exp_half_bound : exp (1 / 2 : ℝ) ≤ 5 / 3 := by have he : exp (1 / 2 : ℝ) * exp (1 / 2 : ℝ) = exp 1 := by rw [← exp_add]; norm_num nlinarith [exp_one_lt_d9, exp_pos (1 / 2 : ℝ)] theorem bernoulli_sum_lower_tail {X : I → Ω → ℝ} (s : Finset I) (hm : ∀ i, Measurable (X i)) (hi : iIndepFun X μ) (hX : ∀ i ω, X i ω = 0 ∨ X i ω = 1) (p : ℝ) (hp0 : 0 ≤ p) (hp : ∀ i, ∫ ω, X i ω ∂μ = p) : μ.real {ω | (∑ i ∈ s, X i ω) ≤ p * s.card / 2} ≤ exp (-p * s.card / 8) := by have hInt : Integrable (fun ω => exp (-(1 / 2 : ℝ) * (∑ i ∈ s, X i) ω)) μ := hi.integrable_exp_mul_sum hm (fun i _ => integrable_exp_mul_of_mem_Icc (hm i).aemeasurable (ae_of_all _ (indicator_mem_Icc (hX i)))) have hb := measure_le_le_exp_mul_mgf (X := ∑ i ∈ s, X i) (p * s.card / 2) (by norm_num : -(1 / 2 : ℝ) ≤ 0) hInt simp only [Finset.sum_apply] at hb apply hb.trans calc _ ≤ exp (-(-(1 / 2 : ℝ)) * (p * s.card / 2)) * exp ((s.card : ℝ) * p * (exp (-(1 / 2 : ℝ)) - 1)) := by exact mul_le_mul_of_nonneg_left (mgf_indicator_sum_bound s hm hi hX p _ hp) (exp_pos _).le _ = exp (p * s.card / 4 + (s.card : ℝ) * p * (exp (-(1 / 2 : ℝ)) - 1)) := by rw [← exp_add]; congr 1; ring _ ≤ _ := by apply exp_le_exp.mpr nlinarith [mul_le_mul_of_nonneg_left exp_neg_half_bound (mul_nonneg (Nat.cast_nonneg s.card) hp0)] theorem bernoulli_sum_upper_tail {X : I → Ω → ℝ} (s : Finset I) (hm : ∀ i, Measurable (X i)) (hi : iIndepFun X μ) (hX : ∀ i ω, X i ω = 0 ∨ X i ω = 1) (p : ℝ) (hp0 : 0 ≤ p) (hp : ∀ i, ∫ ω, X i ω ∂μ = p) : μ.real {ω | 2 * p * s.card ≤ ∑ i ∈ s, X i ω} ≤ exp (-p * s.card / 3) := by have hInt : Integrable (fun ω => exp ((1 / 2 : ℝ) * (∑ i ∈ s, X i) ω)) μ := hi.integrable_exp_mul_sum hm (fun i _ => integrable_exp_mul_of_mem_Icc (hm i).aemeasurable (ae_of_all _ (indicator_mem_Icc (hX i)))) have hb := measure_ge_le_exp_mul_mgf (X := ∑ i ∈ s, X i) (2 * p * s.card) (by norm_num : (0 : ℝ) ≤ 1 / 2) hInt simp only [Finset.sum_apply] at hb apply hb.trans calc _ ≤ exp (-(1 / 2 : ℝ) * (2 * p * s.card)) * exp ((s.card : ℝ) * p * (exp (1 / 2 : ℝ) - 1)) := by exact mul_le_mul_of_nonneg_left (mgf_indicator_sum_bound s hm hi hX p _ hp) (exp_pos _).le _ = exp (-p * s.card + (s.card : ℝ) * p * (exp (1 / 2 : ℝ) - 1)) := by rw [← exp_add]; congr 1; ring _ ≤ _ := by apply exp_le_exp.mpr nlinarith [mul_le_mul_of_nonneg_left exp_half_bound (mul_nonneg (Nat.cast_nonneg s.card) hp0)] end BernoulliBounds noncomputable section variable {V : Type cycleUniverse4} [Fintype V] [DecidableEq V] def CutExpansion (P : SimpleGraph V) [DecidableRel P.Adj] (h : ℝ) : Prop := ∀ U : Finset V, h * min (U.card : ℝ) (Uᶜ.card : ℝ) ≤ ((P.interedges U Uᶜ).card : ℝ) lemma boundary_sym2_injective (P : SimpleGraph V) [DecidableRel P.Adj] (U : Finset V) : Set.InjOn (fun e : V × V => s(e.1, e.2)) (P.interedges U Uᶜ : Set (V × V)) := by intro e he f hf hef rcases (Sym2.mk_eq_mk_iff.mp hef) with h | h · exact h · have he1 := (P.mem_interedges_iff.mp he).1 have hf2 := (P.mem_interedges_iff.mp hf).2.1 have hfirst : e.1 = f.2 := congrArg Prod.fst h exact False.elim ((Finset.mem_compl.mp hf2) (hfirst ▸ he1)) def edgeColorMeasure (V : Type cycleUniverse5) [Fintype V] (l : ℕ) [NeZero l] : Measure (Sym2 V → Fin l) := Measure.pi (fun _ : Sym2 V => (PMF.uniformOfFintype (Fin l)).toMeasure) instance edgeColorMeasure_probability (l : ℕ) [NeZero l] : IsProbabilityMeasure (edgeColorMeasure V l) := by unfold edgeColorMeasure infer_instance def colorIndicator {l : ℕ} (i : Fin l) (e : Sym2 V) (ω : Sym2 V → Fin l) : ℝ := if ω e = i then 1 else 0 lemma colorIndicator_indep {V : Type cycleUniverse6} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] {l : ℕ} [NeZero l] (i : Fin l) : iIndepFun (colorIndicator (V := V) i) (edgeColorMeasure V l) := by exact iIndepFun_pi (X := fun _ : Sym2 V => fun j : Fin l => if j = i then (1 : ℝ) else 0) (fun _ => (measurable_of_finite _).aemeasurable) lemma colorIndicator_integral {V : Type cycleUniverse7} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] {l : ℕ} [NeZero l] (i : Fin l) (e : Sym2 V) : ∫ ω, colorIndicator i e ω ∂edgeColorMeasure V l = 1/(l : ℝ) := by have hl := (measurePreserving_eval (fun _ : Sym2 V => (PMF.uniformOfFintype (Fin l)).toMeasure) e).hasLaw have hi := hl.integral_comp (f := fun j : Fin l => if j = i then (1 : ℝ) else 0) (measurable_of_finite _).aestronglyMeasurable rw [PMF.integral_eq_sum] at hi simpa [edgeColorMeasure, colorIndicator, PMF.uniformOfFintype_apply] using hi def colorGraph (P : SimpleGraph V) {l : ℕ} (ω : Sym2 V → Fin l) (i : Fin l) : SimpleGraph V where Adj x y := P.Adj x y ∧ ω s(x,y) = i symm := ⟨by intro x y h; exact ⟨h.1.symm, by simpa only [Sym2.eq_swap] using h.2⟩⟩ loopless := ⟨by intro x h; exact P.irrefl h.1⟩ instance colorGraph_decidable (P : SimpleGraph V) [DecidableRel P.Adj] {l : ℕ} (ω : Sym2 V → Fin l) (i : Fin l) : DecidableRel (colorGraph P ω i).Adj := fun _ _ => inferInstanceAs (Decidable (_ ∧ _)) lemma colorGraph_interedges {V : Type cycleUniverse8} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] (P : SimpleGraph V) [DecidableRel P.Adj] {l : ℕ} (ω : Sym2 V → Fin l) (i : Fin l) (S T : Finset V) : (colorGraph P ω i).interedges S T = (P.interedges S T).filter (fun e => ω s(e.1,e.2) = i) := by ext ⟨x,y⟩ simp only [SimpleGraph.mem_interedges_iff, Finset.mem_filter] change (x ∈ S ∧ y ∈ T ∧ (P.Adj x y ∧ ω s(x,y) = i)) ↔ _ tauto lemma color_cut_sum (P : SimpleGraph V) [DecidableRel P.Adj] {l : ℕ} (ω : Sym2 V → Fin l) (i : Fin l) (S : Finset V) : (∑ e ∈ (P.interedges S Sᶜ).image (fun e => s(e.1,e.2)), colorIndicator i e ω) = (((colorGraph P ω i).interedges S Sᶜ).card : ℝ) := by rw [Finset.sum_image (boundary_sym2_injective P S)] simp only [colorIndicator, Finset.sum_boole, colorGraph_interedges] lemma color_cut_lower_tail (P : SimpleGraph V) [DecidableRel P.Adj] {l : ℕ} [NeZero l] (i : Fin l) (S : Finset V) {h : ℝ} (hexp : CutExpansion P h) (hS : S.card ≤ Sᶜ.card) : (edgeColorMeasure V l).real {ω | (((colorGraph P ω i).interedges S Sᶜ).card : ℝ) < h*S.card/(2*l)} ≤ exp (-h*S.card/(8*l)) := by let E := (P.interedges S Sᶜ).image (fun e => s(e.1,e.2)) have hcard : E.card = (P.interedges S Sᶜ).card := Finset.card_image_of_injOn (boundary_sym2_injective P S) have hl : 0 < (l : ℝ) := by exact_mod_cast Nat.pos_of_ne_zero (NeZero.ne l) have hcut : h * S.card ≤ (E.card : ℝ) := by rw [hcard] have he := hexp S rwa [min_eq_left (by exact_mod_cast hS)] at he have hb := bernoulli_sum_lower_tail (μ := edgeColorMeasure V l) E (fun e => measurable_of_finite (colorIndicator i e)) (colorIndicator_indep i) (fun e ω => by simp only [colorIndicator]; split <;> simp) (1/(l : ℝ)) (by positivity) (colorIndicator_integral i) apply (measureReal_mono (show {ω | (((colorGraph P ω i).interedges S Sᶜ).card : ℝ) < h*S.card/(2*l)} ⊆ {ω | (∑ e ∈ E, colorIndicator i e ω) ≤ (1/(l : ℝ))*E.card/2} from ?_)).trans (hb.trans ?_) · intro ω hω change (∑ e ∈ E, colorIndicator i e ω) ≤ (1/(l : ℝ))*E.card/2 rw [show (∑ e ∈ E, colorIndicator i e ω) = (((colorGraph P ω i).interedges S Sᶜ).card : ℝ) from color_cut_sum P ω i S] calc _ ≤ h*S.card/(2*l) := le_of_lt hω _ ≤ (E.card : ℝ)/(2*l) := div_le_div_of_nonneg_right hcut (by positivity) _ = _ := by ring · apply exp_le_exp.mpr have he := div_le_div_of_nonneg_right hcut (show 0 ≤ 8*(l : ℝ) by positivity) calc _ = -((E.card : ℝ)/(8*l)) := by ring _ ≤ -(h*S.card/(8*l)) := neg_le_neg he _ = _ := by ring lemma cutExpansion_of_small_cuts (P : SimpleGraph V) [DecidableRel P.Adj] {h : ℝ} (hcut : ∀ S : Finset V, S.Nonempty → S.card ≤ Sᶜ.card → h*S.card ≤ ((P.interedges S Sᶜ).card : ℝ)) : CutExpansion P h := by intro S by_cases he : S = ∅ · simp [he] by_cases hc : Sᶜ = ∅ · simp [hc] by_cases hs : S.card ≤ Sᶜ.card · rw [min_eq_left (by exact_mod_cast hs)] exact hcut S (Finset.nonempty_iff_ne_empty.mpr he) hs · rw [min_eq_right (by exact_mod_cast le_of_not_ge hs)] have hi := hcut Sᶜ (Finset.nonempty_iff_ne_empty.mpr hc) (by simpa using le_of_not_ge hs) have hcomm : (P.interedges Sᶜ S).card = (P.interedges S Sᶜ).card := by have := P.symm exact Rel.card_interedges_comm Sᶜ S simpa only [compl_compl, hcomm] using hi lemma sum_nonempty_subsets_power (q : ℝ) : (∑ S ∈ (Finset.univ : Finset (Finset V)).erase ∅, q^S.card) = (1+q)^(Fintype.card V)-1 := by have hs := Finset.sum_erase_add (s := Finset.univ) (fun S : Finset V => q^S.card) (Finset.mem_univ (∅ : Finset V)) have hp := Finset.prod_one_add (s := (Finset.univ : Finset V)) (f := fun _ => q) simp only [Finset.prod_const, Finset.card_univ, Finset.powerset_univ] at hp simp only [Finset.card_empty, pow_zero] at hs linarith theorem edge_splitting_failure_bound (P : SimpleGraph V) [DecidableRel P.Adj] {l : ℕ} [NeZero l] {h : ℝ} (hexp : CutExpansion P h) : (edgeColorMeasure V l).real {ω | ∃ i, ¬CutExpansion (colorGraph P ω i) (h/(2*l))} ≤ l * (exp ((Fintype.card V : ℝ)*exp (-h/(8*l)))-1) := by let cuts : Finset (Finset V) := Finset.univ.erase ∅ let B (i : Fin l) (S : Finset V) : Set (Sym2 V → Fin l) := {ω | S.card ≤ Sᶜ.card ∧ (((colorGraph P ω i).interedges S Sᶜ).card : ℝ) < h*S.card/(2*l)} let q : ℝ := exp (-h/(8*l)) have cover : {ω | ∃ i, ¬CutExpansion (colorGraph P ω i) (h/(2*l))} ⊆ ⋃ i ∈ (Finset.univ : Finset (Fin l)), ⋃ S ∈ cuts, B i S := by intro ω hω rcases hω with ⟨i, hi⟩ by_contra hn apply hi apply cutExpansion_of_small_cuts intro S hS hs have hb : ω ∉ B i S := by intro hm apply hn exact Set.mem_iUnion.mpr ⟨i, Set.mem_iUnion.mpr ⟨Finset.mem_univ _, Set.mem_iUnion.mpr ⟨S, Set.mem_iUnion.mpr ⟨Finset.mem_erase.mpr ⟨hS.ne_empty, Finset.mem_univ _⟩, hm⟩⟩⟩⟩ have hc : h*S.card/(2*l) ≤ (((colorGraph P ω i).interedges S Sᶜ).card : ℝ) := by exact le_of_not_gt (fun hf => hb ⟨hs, hf⟩) convert hc using 1 ; ring have hbound (i : Fin l) (S : Finset V) : (edgeColorMeasure V l).real (B i S) ≤ q^S.card := by by_cases hs : S.card ≤ Sᶜ.card · calc _ ≤ (edgeColorMeasure V l).real {ω | (((colorGraph P ω i).interedges S Sᶜ).card : ℝ) < h*S.card/(2*l)} := measureReal_mono (fun _ hw => hw.2) _ ≤ exp (-h*S.card/(8*l)) := color_cut_lower_tail P i S hexp hs _ = q^S.card := by dsimp [q]; rw [← exp_nat_mul]; congr 1; ring · have he : B i S = ∅ := by ext ω; simp [B,hs] rw [he, measureReal_empty] exact pow_nonneg (exp_pos _).le _ calc _ ≤ (edgeColorMeasure V l).real (⋃ i ∈ (Finset.univ : Finset (Fin l)), ⋃ S ∈ cuts, B i S) := measureReal_mono cover (measure_ne_top _ _) _ ≤ ∑ i : Fin l, (edgeColorMeasure V l).real (⋃ S ∈ cuts, B i S) := measureReal_biUnion_finset_le _ _ _ ≤ ∑ i : Fin l, ∑ S ∈ cuts, (edgeColorMeasure V l).real (B i S) := Finset.sum_le_sum (fun _ _ => measureReal_biUnion_finset_le _ _) _ ≤ ∑ _i : Fin l, ∑ S ∈ cuts, q^S.card := by apply Finset.sum_le_sum; intro i _; exact Finset.sum_le_sum (fun S _ => hbound i S) _ = (l : ℝ)*((1+q)^(Fintype.card V)-1) := by simp only [cuts, sum_nonempty_subsets_power, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] _ ≤ l*(exp ((Fintype.card V : ℝ)*q)-1) := by apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg l) apply sub_le_sub_right calc _ ≤ (exp q)^(Fintype.card V) := pow_le_pow_left₀ (by dsimp [q]; positivity) (by linarith [add_one_le_exp q]) _ _ = _ := (exp_nat_mul _ _).symm theorem edge_splitting_of_error_lt_one (P : SimpleGraph V) [DecidableRel P.Adj] {l : ℕ} [NeZero l] {h : ℝ} (hexp : CutExpansion P h) (herror : (l : ℝ)*(exp ((Fintype.card V : ℝ)*exp (-h/(8*l)))-1) < 1) : ∃ ω : Sym2 V → Fin l, (∀ i, CutExpansion (colorGraph P ω i) (h/(2*l))) ∧ (∀ x y, P.Adj x y ↔ ∃ i, (colorGraph P ω i).Adj x y) ∧ (∀ i j, i ≠ j → Disjoint (colorGraph P ω i).edgeSet (colorGraph P ω j).edgeSet) := by have he := (edge_splitting_failure_bound P hexp).trans_lt herror have hh : ∃ ω : Sym2 V → Fin l, ∀ i, CutExpansion (colorGraph P ω i) (h/(2*l)) := by by_contra hn push Not at hn have hall : {ω : Sym2 V → Fin l | ∃ i, ¬CutExpansion (colorGraph P ω i) (h/(2*l))} = Set.univ := Set.eq_univ_of_forall hn simp only [hall, Measure.real, measure_univ, ENNReal.toReal_one] at he exact (lt_irrefl _ he) obtain ⟨ω, hω⟩ := hh refine ⟨ω, hω, ?_, ?_⟩ · intro x y exact ⟨fun hxy => ⟨ω s(x,y), hxy, rfl⟩, fun ⟨_, hxy, _⟩ => hxy⟩ · intro i j hij apply Set.disjoint_left.mpr intro e hei hej induction e using Sym2.ind with | _ x y => have hi : (colorGraph P ω i).Adj x y := by simpa using hei have hj : (colorGraph P ω j).Adj x y := by simpa using hej exact hij (hi.2.symm.trans hj.2) end open Filter Asymptotics open scoped Topology lemma tendsto_monomial_exp_neg_power (a b c : ℝ) (hb : 0 < b) (hc : 0 < c) : Tendsto (fun D : ℝ => D^a * exp (-c * D^b)) atTop (𝓝 0) := by have ht := (tendsto_rpow_mul_exp_neg_mul_atTop_nhds_zero (a/b) c hc).comp (tendsto_rpow_atTop hb) apply ht.congr' filter_upwards [eventually_gt_atTop (0 : ℝ)] with D hD dsimp only [Function.comp_def] rw [← Real.rpow_mul hD.le, mul_div_cancel₀ _ hb.ne'] noncomputable def edgeSplittingScaleError (c : ℝ) (l : ℕ) (D : ℝ) : ℝ := (l : ℝ) * (Real.exp (D^(51/50 : ℝ) * Real.exp ((-(c / (8*l))) * D^(9/10 : ℝ))) - 1) lemma edgeSplittingScaleError_tendsto (c : ℝ) (hc : 0 < c) (l : ℕ) (hl : 0 < l) : Tendsto (edgeSplittingScaleError c l) atTop (𝓝 0) := by have hlR : 0 < (l : ℝ) := by exact_mod_cast hl have ht := tendsto_monomial_exp_neg_power (51/50) (9/10) (c/(8*l)) (by norm_num) (by positivity) have hh := ((Real.continuous_exp.tendsto 0).comp ht).sub_const 1 |>.const_mul (l : ℝ) unfold edgeSplittingScaleError convert hh using 1 <;> norm_num universe u theorem edge_splitting_uniform (c : ℝ) (hc : 0 < c) (l : ℕ) (hl : 0 < l) : ∃ D₀ : ℝ, ∀ D : ℝ, D₀ ≤ D → ∀ (V : Type u) [Fintype V] [DecidableEq V] (P : SimpleGraph V) [DecidableRel P.Adj] (h : ℝ), c*D^(9/10 : ℝ) ≤ h → D^(9/10 : ℝ) ≤ (Fintype.card V : ℝ) → (Fintype.card V : ℝ) ≤ D^(51/50 : ℝ) → CutExpansion P h → ∃ ω : Sym2 V → Fin l, (∀ i, CutExpansion (colorGraph P ω i) (h/(2*l))) ∧ (∀ x y, P.Adj x y ↔ ∃ i, (colorGraph P ω i).Adj x y) ∧ (∀ i j, i ≠ j → Disjoint (colorGraph P ω i).edgeSet (colorGraph P ω j).edgeSet) := by have : NeZero l := ⟨hl.ne'⟩ have hlR : 0 < (l : ℝ) := by exact_mod_cast hl have hevent := (edgeSplittingScaleError_tendsto c hc l hl).eventually_lt_const (show (0 : ℝ) < 1 by norm_num) obtain ⟨D₀,hD₀⟩ := hevent.exists_forall_of_atTop refine ⟨D₀, ?_⟩ intro D hD V _ _ P _ h hh _hrlo hrhi hexp apply edge_splitting_of_error_lt_one P hexp apply lt_of_le_of_lt _ (hD₀ D hD) unfold edgeSplittingScaleError apply mul_le_mul_of_nonneg_left _ hlR.le apply sub_le_sub_right apply exp_le_exp.mpr apply mul_le_mul hrhi _ (exp_pos _).le ((Nat.cast_nonneg (Fintype.card V)).trans hrhi) apply exp_le_exp.mpr have he := div_le_div_of_nonneg_right hh (show 0 ≤ 8*(l : ℝ) by positivity) calc -h/(8*l) = -(h/(8*l)) := by ring _ ≤ -(c*D^(9/10 : ℝ)/(8*l)) := neg_le_neg he _ = -(c/(8*l))*D^(9/10 : ℝ) := by ring end ErdosGallai.Splitting end end end end OAI