Download data/lean/OAI/Combinatorics/CycleDecomposition/EdgeSplitting.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 19.3 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/CycleDecomposition/EdgeSplitting.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/CycleDecomposition/EdgeSplitting.lean
-
curl -L -o EdgeSplitting.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/CycleDecomposition/EdgeSplitting.lean
19.3 kB
| 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 | |