Download data/lean/OAI/Combinatorics/CycleDecomposition/CoupledResolution.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 40.1 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/CycleDecomposition/CoupledResolution.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/CycleDecomposition/CoupledResolution.lean
-
curl -L -o CoupledResolution.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/CycleDecomposition/CoupledResolution.lean
40.1 kB
| import OAI.Combinatorics.CycleDecomposition.BatchResolution | |
| 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 | |
| section | |
| namespace ErdosGallai.Batch.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.Batch.Splitting | |
| namespace ErdosGallai.Batch | |
| noncomputable section | |
| open Real | |
| def inductionPhi (x : β) : β := | |
| if x = 1 then 1/2 else max (1/2) (1 - 1 / sqrt (logb 2 x)) | |
| lemma inductionPhi_one : inductionPhi 1 = 1/2 := by simp [inductionPhi] | |
| lemma inductionPhi_bounds (x : β) : 1/2 β€ inductionPhi x β§ inductionPhi x β€ 1 := by | |
| by_cases hx : x = 1 | |
| Β· norm_num [inductionPhi, hx] | |
| Β· simp only [inductionPhi, hx, ite_false] | |
| exact β¨le_max_left _ _, max_le (by norm_num) (by linarith [one_div_nonneg.mpr (Real.sqrt_nonneg (logb 2 x))])β© | |
| lemma inductionPhi_monotone : MonotoneOn inductionPhi (Set.Ici 1) := by | |
| intro x hx y hy hxy | |
| by_cases hx1 : x = 1 | |
| Β· simpa [hx1, inductionPhi_one] using (inductionPhi_bounds y).1 | |
| have hxgt : 1 < x := lt_of_le_of_ne hx (Ne.symm hx1) | |
| have hygt : 1 < y := hxgt.trans_le hxy | |
| have hlog : logb 2 x β€ logb 2 y := Real.logb_le_logb_of_le (by norm_num) | |
| (by linarith) hxy | |
| have hxlog : 0 < logb 2 x := Real.logb_pos (by norm_num) hxgt | |
| have hinv := one_div_le_one_div_of_le (Real.sqrt_pos.mpr hxlog) (Real.sqrt_le_sqrt hlog) | |
| simp only [inductionPhi, hx1, ne_of_gt hygt, ite_false] | |
| exact max_le_max le_rfl (by linarith) | |
| lemma inductionPhi_nonconstant (x : β) (hlog : 4 β€ logb 2 x) : | |
| inductionPhi x = 1 - 1 / sqrt (logb 2 x) := by | |
| have hx : x β 1 := by intro hx; subst x; norm_num at hlog | |
| have hsqrt : 2 β€ sqrt (logb 2 x) := by | |
| convert Real.sqrt_le_sqrt hlog using 1 ; norm_num | |
| have hinv : 1 / sqrt (logb 2 x) β€ 1/2 := | |
| one_div_le_one_div_of_le (by norm_num) hsqrt | |
| simp only [inductionPhi, hx, ite_false] | |
| exact max_eq_right (by linarith) | |
| def inductionDelta : β := 1 / sqrt (3/10) - 1 | |
| lemma inductionDelta_pos : 0 < inductionDelta := by | |
| have hs : 0 < sqrt (3/10 : β) := Real.sqrt_pos.mpr (by norm_num) | |
| have hs1 : sqrt (3/10 : β) < 1 := by | |
| exact (Real.sqrt_lt' (by norm_num)).mpr (by norm_num) | |
| dsimp [inductionDelta] | |
| have hh := (one_lt_div hs).mpr hs1 | |
| linarith | |
| theorem induction_potential_gain (D n : β) (hD : 1 < D) (hn : D β€ n) | |
| (hw : 40/3 β€ logb 2 D) : | |
| inductionDelta / sqrt (logb 2 D) β€ inductionPhi n - inductionPhi (D^(3/10:β)) := by | |
| have hD0 : 0 < D := by linarith | |
| have hw0 : 0 < logb 2 D := by linarith | |
| have hnlog : logb 2 D β€ logb 2 n := | |
| Real.logb_le_logb_of_le (by norm_num) hD0 hn | |
| have hblog : logb 2 (D^(3/10:β)) = (3/10)*logb 2 D := by | |
| exact Real.logb_rpow_eq_mul_logb_of_pos hD0 | |
| rw [inductionPhi_nonconstant n (by linarith), | |
| inductionPhi_nonconstant (D^(3/10:β)) (by rw [hblog]; linarith), hblog] | |
| have hinv := one_div_le_one_div_of_le (Real.sqrt_pos.mpr hw0) | |
| (Real.sqrt_le_sqrt hnlog) | |
| have hid : 1 / sqrt ((3/10)*logb 2 D) - 1 / sqrt (logb 2 D) = | |
| inductionDelta / sqrt (logb 2 D) := by | |
| rw [Real.sqrt_mul (by norm_num : (0:β) β€ 3/10)] | |
| dsimp [inductionDelta] | |
| field_simp | |
| rw [β hid] | |
| linarith | |
| lemma induction_cutoff_absorption (A w : β) (hA : 0 β€ A) (hw0 : 0 < w) | |
| (hw : ((A+1)/inductionDelta)^2 β€ w) : | |
| (A+1)/w β€ inductionDelta / sqrt w := by | |
| have hd := inductionDelta_pos | |
| have hratio : 0 β€ (A+1)/inductionDelta := by positivity | |
| have hs : (A+1)/inductionDelta β€ sqrt w := by | |
| have hh := Real.sqrt_le_sqrt hw | |
| simpa [Real.sqrt_sq hratio] using hh | |
| have hm : A+1 β€ inductionDelta * sqrt w := by | |
| have := (div_le_iffβ hd).mp hs | |
| simpa [mul_comm] using this | |
| apply (div_le_div_iffβ hw0 (Real.sqrt_pos.mpr hw0)).mpr | |
| have hmul := mul_le_mul_of_nonneg_right hm (Real.sqrt_nonneg w) | |
| simpa [mul_assoc, Real.mul_self_sqrt hw0.le] using hmul | |
| theorem induction_cost_absorbed (D n S C Aβ Aβ : β) | |
| (hD : 1 < D) (hn : D β€ n) (hS : 0 β€ S) (hC : 0 β€ C) | |
| (hAβ : 0 β€ Aβ) (_hAβ : 0 β€ Aβ) (hCA : 7*Aβ β€ C) | |
| (hw : 40/3 β€ logb 2 D) | |
| (hcut : ((Aβ+1)/inductionDelta)^2 β€ logb 2 D) : | |
| Aβ*(S+n/logb 2 D) + (C/100)*S + | |
| C*inductionPhi (D^(3/10:β))*(n-S/3+Aβ*n/logb 2 D) β€ C*inductionPhi n*n := by | |
| let f := inductionPhi (D^(3/10:β)) | |
| obtain β¨hflo,hfhiβ© := inductionPhi_bounds (D^(3/10:β)) | |
| have hw0 : 0 < logb 2 D := by linarith | |
| have hn0 : 0 β€ n := by linarith | |
| have hnw : 0 β€ n/logb 2 D := div_nonneg hn0 hw0.le | |
| have hcoeff : Aβ+C/100-C*f/3 β€ 0 := by | |
| dsimp [f] | |
| nlinarith [mul_le_mul_of_nonneg_left hflo hC] | |
| have hScost := mul_nonpos_of_nonpos_of_nonneg hcoeff hS | |
| have hAβC : Aβ β€ C := by linarith | |
| have hAprod : C*f*Aβ β€ C*Aβ := by | |
| exact mul_le_mul_of_nonneg_right (by | |
| simpa [f] using mul_le_mul_of_nonneg_left hfhi hC) hAβ | |
| have how := mul_le_mul_of_nonneg_right (add_le_add hAβC hAprod) hnw | |
| have habs := induction_cutoff_absorption Aβ (logb 2 D) hAβ hw0 hcut | |
| have hgain := induction_potential_gain D n hD hn hw | |
| have hpay := mul_le_mul_of_nonneg_left (habs.trans hgain) (mul_nonneg hC hn0) | |
| change Aβ*(S+n/logb 2 D) + (C/100)*S + C*f*(n-S/3+Aβ*n/logb 2 D) β€ _ | |
| change C*n*((Aβ+1)/logb 2 D) β€ C*n*(inductionPhi n - f) at hpay | |
| simp only [div_eq_mul_inv] at hScost how hpay β’ | |
| nlinarith only [hScost, how, hpay] | |
| end | |
| end ErdosGallai.Batch | |
| namespace ErdosGallai.Batch | |
| noncomputable section | |
| open Finset SimpleGraph Real | |
| attribute [local instance] Classical.propDecidable | |
| variable {V : Type} [Fintype V] [DecidableEq V] | |
| lemma cutExpansionOn_of_induce (P : SimpleGraph V) [DecidableRel P.Adj] | |
| (W : Finset V) (h : β) (he : CutExpansion (P.induce (W:Set V)) h) : CutExpansionOn P W h := by | |
| intro A hA | |
| let B : Finset (W:Set V) := univ.filter (fun x => x.val β A) | |
| have him : B.image Subtype.val = A := by | |
| ext x | |
| simp only [Finset.mem_image] | |
| constructor | |
| Β· rintro β¨y,hy,rflβ©; exact (Finset.mem_filter.mp hy).2 | |
| Β· intro hx; exact β¨β¨x,hA hxβ©,by simp [B,hx],rflβ© | |
| have hcomp := subtype_image_compl W B | |
| rw [him] at hcomp | |
| have hh := he B | |
| rw [induced_interedges_card,him] at hh | |
| have hc : B.card = A.card := by rw [β him,Finset.card_image_of_injective _ Subtype.val_injective] | |
| have hcc : BαΆ.card = (W \ A).card := by rw [β hcomp,Finset.card_image_of_injective _ Subtype.val_injective] | |
| simpa only [hc,hcc] using hh | |
| lemma cutExpansionOn_mono {V : Type} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] {P Q : SimpleGraph V} [DecidableRel P.Adj] [DecidableRel Q.Adj] | |
| {W : Finset V} {h : β} (he : CutExpansionOn P W h) (hPQ : P β€ Q) : CutExpansionOn Q W h := by | |
| intro A hA | |
| exact (he A hA).trans (Nat.cast_le.mpr (Finset.card_le_card (by | |
| intro e he | |
| simp only [SimpleGraph.mem_interedges_iff] at he β’ | |
| exact β¨he.1,he.2.1,hPQ he.2.2β©))) | |
| theorem uniform_two_routers_on : β Dβ : β, β D β₯ Dβ, | |
| β (V : Type) [Fintype V] [DecidableEq V] (R : SimpleGraph V) (W : Finset V), | |
| (β β¦x yβ¦, R.Adj x y β x β W β§ y β W) β | |
| D^(9/10:β) β€ (W.card:β) β (W.card:β) β€ D^(51/50:β) β | |
| CutExpansionOn R W (D^(9/10:β)) β | |
| β P T : SimpleGraph V, P β€ R β§ T β€ R β§ Disjoint P.edgeSet T.edgeSet β§ | |
| P.edgeSet βͺ T.edgeSet = R.edgeSet β§ | |
| CutExpansionOn P W (D^(9/10:β)/4) β§ CutExpansionOn T W (D^(9/10:β)/4) := by | |
| obtain β¨Dβ,hsplitβ© := Splitting.edge_splitting_uniform 1 (by norm_num) 2 (by norm_num) | |
| refine β¨Dβ,?_β© | |
| intro D hD V _ _ R W hW hlo hhi he | |
| let R' := R.induce (W:Set V) | |
| have he' : Splitting.CutExpansion R' (D^(9/10:β)) := cutExpansion_induce R W _ he | |
| obtain β¨Ο,hΟ,hcover,hdisβ© := hsplit D hD (W:Set V) R' (D^(9/10:β)) | |
| (by simp) (by simpa using hlo) (by simpa using hhi) he' | |
| let f : (W:Set V) βͺ V := β¨Subtype.val,Subtype.val_injectiveβ© | |
| let Q (i : Fin 2) := (Splitting.colorGraph R' Ο i).map f | |
| have hQR (i : Fin 2) : Q i β€ R := by | |
| apply SimpleGraph.map_le_iff_le_comap.mpr | |
| exact fun _ _ h => h.1 | |
| have hind (i) : (Q i).induce (W:Set V) = Splitting.colorGraph R' Ο i := | |
| SimpleGraph.comap_map_eq f _ | |
| have hexp (i) : @CutExpansionOn V _ (Q i) (fun _ _ => Classical.propDecidable _) W (D^(9/10:β)/4) := by | |
| apply @cutExpansionOn_of_induce V _ _ (Q i) (fun _ _ => Classical.propDecidable _) W | |
| have hcol : CutExpansion (Splitting.colorGraph R' Ο i) (D^(9/10:β)/4) := by simpa only [CutExpansion, Splitting.CutExpansion, Nat.cast_ofNat, show (2:β)*2=4 by norm_num] using hΟ i | |
| convert hcol using 1 ; simp only [hind] | |
| have hQedge (i) : (Q i).edgeSet = Sym2.map (Subtype.val : β₯(W:Set V) β V) '' | |
| (Splitting.colorGraph R' Ο i).edgeSet := SimpleGraph.edgeSet_map f _ | |
| refine β¨Q 0,Q 1,hQR 0,hQR 1,?_,?_,hexp 0,hexp 1β© | |
| Β· rw [hQedge,hQedge] | |
| apply Set.disjoint_left.mpr | |
| rintro e β¨a,ha,haeβ© β¨b,hb,hbeβ© | |
| have hab := Sym2.map.injective Subtype.val_injective (hae.trans hbe.symm) | |
| subst b | |
| exact Set.disjoint_left.mp (hdis 0 1 (by decide)) ha hb | |
| Β· apply Set.Subset.antisymm | |
| Β· exact Set.union_subset (SimpleGraph.edgeSet_mono (hQR 0)) (SimpleGraph.edgeSet_mono (hQR 1)) | |
| Β· intro e heR | |
| induction e using Sym2.ind with | |
| | _ x y => | |
| have hxy : R.Adj x y := heR | |
| obtain β¨i,hiβ© := (hcover β¨x,(hW hxy).1β© β¨y,(hW hxy).2β©).mp hxy | |
| have hm : s(x,y) β (Q i).edgeSet := by | |
| rw [hQedge] | |
| exact β¨s(β¨x,(hW hxy).1β©,β¨y,(hW hxy).2β©),hi,rflβ© | |
| fin_cases i | |
| Β· exact Or.inl hm | |
| Β· exact Or.inr hm | |
| end | |
| end ErdosGallai.Batch | |
| namespace ErdosGallai.Batch | |
| noncomputable section | |
| open SimpleGraph Finset | |
| attribute [local instance] Classical.propDecidable | |
| lemma decompositionCost_adjoin_same {V I J : Type} [Fintype V] [Fintype I] [Fintype J] | |
| (G : SimpleGraph V) (parts : I β Set (Sym2 V)) | |
| (hp : β i, CycleOrSingleEdge G (parts i)) | |
| (hd : Pairwise fun i j => Disjoint (parts i) (parts j)) | |
| (H : J β SimpleGraph V) (hHG : β j, H j β€ G) | |
| (hHH : Pairwise fun i j => Disjoint (H i).edgeSet (H j).edgeSet) | |
| (hHP : β j i, Disjoint (H j).edgeSet (parts i)) | |
| (hu : (β i, parts i) βͺ (β j, (H j).edgeSet) = G.edgeSet) : | |
| decompositionCost G β€ Fintype.card I + β j, decompositionCost (H j) := by | |
| let f : β j, H j βg G := fun j => β¨id,fun h => hHG j hβ© | |
| have he (j) : Sym2.map (f j) '' (H j).edgeSet = (H j).edgeSet := by | |
| have hf : (f j : V β V) = id := rfl | |
| rw [hf, Sym2.map_id, Set.image_id] | |
| apply decompositionCost_adjoin G parts hp hd (fun _ => V) H f (fun _ => Function.injective_id) | |
| Β· simpa only [he] using hHH | |
| Β· simpa only [he] using hHP | |
| Β· simpa only [he] using hu | |
| lemma decompositionCost_assemble_same {V J : Type} [Fintype V] [Fintype J] | |
| (G : SimpleGraph V) (H : J β SimpleGraph V) (hHG : β j, H j β€ G) | |
| (hHH : Pairwise fun i j => Disjoint (H i).edgeSet (H j).edgeSet) | |
| (hu : (β j, (H j).edgeSet) = G.edgeSet) : | |
| decompositionCost G β€ β j, decompositionCost (H j) := by | |
| simpa using decompositionCost_adjoin_same (I := Empty) G Empty.elim (fun i => nomatch i) | |
| (by intro i; exact i.elim) H hHG hHH (fun _ i => nomatch i) (by simpa using hu) | |
| end | |
| end ErdosGallai.Batch | |
| namespace ErdosGallai.Batch | |
| noncomputable section | |
| open Finset SimpleGraph Real | |
| attribute [local instance] Classical.propDecidable | |
| def routerRemainder {V : Type} (R : SimpleGraph V) (used : Set (Sym2 V)) : SimpleGraph V := | |
| R \ SimpleGraph.fromEdgeSet used | |
| lemma routerRemainder_edges {V : Type} (R : SimpleGraph V) (used : Set (Sym2 V)) : | |
| (routerRemainder R used).edgeSet = R.edgeSet \ used := by | |
| simp [routerRemainder,SimpleGraph.edgeSet_sdiff] | |
| lemma routerRemainder_le {V : Type} (R : SimpleGraph V) (used : Set (Sym2 V)) : | |
| routerRemainder R used β€ R := fun _ _ h => h.1 | |
| lemma protected_le_remainder {V : Type} {R T : SimpleGraph V} {used : Set (Sym2 V)} | |
| (hTR : T β€ R) (htu : Disjoint T.edgeSet used) : T β€ routerRemainder R used := by | |
| apply SimpleGraph.edgeSet_subset_edgeSet.mp | |
| rw [routerRemainder_edges] | |
| exact fun _ he => β¨SimpleGraph.edgeSet_mono hTR he,fun hu => Set.disjoint_left.mp htu he huβ© | |
| lemma protected_avoids_used {V A : Type} (R P T : A β SimpleGraph V) | |
| (hRR : Pairwise fun i j => Disjoint (R i).edgeSet (R j).edgeSet) | |
| (hPR : β i, P i β€ R i) (hTR : β i, T i β€ R i) | |
| (hTP : β i, Disjoint (T i).edgeSet (P i).edgeSet) | |
| (used : Set (Sym2 V)) (hu : used β β i, (P i).edgeSet) : | |
| β i, Disjoint (T i).edgeSet used := by | |
| intro i | |
| apply Set.disjoint_left.mpr | |
| intro e he heu | |
| obtain β¨j,hjβ© := Set.mem_iUnion.mp (hu heu) | |
| by_cases hij : i = j | |
| Β· subst j; exact Set.disjoint_left.mp (hTP i) he hj | |
| Β· exact Set.disjoint_left.mp (hRR hij) (SimpleGraph.edgeSet_mono (hTR i) he) | |
| (SimpleGraph.edgeSet_mono (hPR j) hj) | |
| lemma batch_remainder_ledger {V A K : Type} [Fintype V] [Fintype A] [Fintype K] | |
| (G F : SimpleGraph V) (R : A β SimpleGraph V) | |
| (hRG : β i, R i β€ G) | |
| (hRR : Pairwise fun i j => Disjoint (R i).edgeSet (R j).edgeSet) | |
| (hFR : β i, Disjoint F.edgeSet (R i).edgeSet) | |
| (hcover : F.edgeSet βͺ (β i, (R i).edgeSet) = G.edgeSet) | |
| (parts : K β Set (Sym2 V)) (hp : β k, CycleOrSingleEdge G (parts k)) | |
| (hd : Pairwise fun j k => Disjoint (parts j) (parts k)) | |
| (used : Set (Sym2 V)) (hu : used β β i, (R i).edgeSet) | |
| (hparts : (β k, parts k) = F.edgeSet βͺ used) : | |
| decompositionCost G β€ Fintype.card K + β i, decompositionCost (routerRemainder (R i) used) := by | |
| apply decompositionCost_adjoin_same G parts hp hd (fun i => routerRemainder (R i) used) | |
| (fun i => (routerRemainder_le _ _).trans (hRG i)) | |
| Β· intro i j hij | |
| exact (hRR hij).mono (SimpleGraph.edgeSet_mono (routerRemainder_le _ _)) | |
| (SimpleGraph.edgeSet_mono (routerRemainder_le _ _)) | |
| Β· intro i k | |
| rw [routerRemainder_edges] | |
| apply Set.disjoint_left.mpr | |
| intro e he hp | |
| have hpe : e β F.edgeSet βͺ used := hparts βΈ Set.mem_iUnion.mpr β¨k,hpβ© | |
| rcases hpe with hpe | hpe | |
| Β· exact Set.disjoint_left.mp (hFR i) hpe he.1 | |
| Β· exact he.2 hpe | |
| Β· rw [hparts,β hcover] | |
| simp_rw [routerRemainder_edges] | |
| ext e | |
| simp only [Set.mem_union,Set.mem_iUnion,Set.mem_sdiff] | |
| constructor | |
| Β· rintro ((hf | hu') | β¨i,hi,_β©) | |
| Β· exact Or.inl hf | |
| Β· exact Or.inr (Set.mem_iUnion.mp (hu hu')) | |
| Β· exact Or.inr β¨i,hiβ© | |
| Β· rintro (hf | β¨i,hiβ©) | |
| Β· exact Or.inl (Or.inl hf) | |
| Β· by_cases he : e β used | |
| Β· exact Or.inl (Or.inr he) | |
| Β· exact Or.inr β¨i,hi,heβ© | |
| lemma prepared_quotient_cost {V I : Type} [Fintype V] [Fintype I] | |
| (J : SimpleGraph V) (X : I β Finset V) (hd : Pairwise fun i j => Disjoint (X i) (X j)) | |
| (p : PreparedBatch J X hd) (W : Finset V) | |
| (hW : β β¦x yβ¦, J.Adj x y β x β W β§ y β W) | |
| (hX : β i, X i β W) (n : β) (M t : β) (_ht : 0 β€ t) (hn : W.card < n) (hM : (W.card:β) β€ M) | |
| (ih : β (A : Type) [Fintype A] (H : SimpleGraph A), Fintype.card A < n β (Fintype.card A:β) β€ M β | |
| (decompositionCost H:β) β€ t * Fintype.card A) : | |
| β k, EdgeDecomposition p.quotient k β§ | |
| (k:β) β€ t * ((W.card:β) - β i, ((X i).card / 2:β)) := by | |
| classical | |
| let A := W.image (familyProject X hd p.pairing) | |
| let H := p.quotient.induce (A:Set (FamilyQuotient X p.pairing)) | |
| have ho : A.card + β i, (X i).card / 2 = W.card := family_quotient_image_order X hd p.pairing W hX | |
| have hn' : Fintype.card (A:Set (FamilyQuotient X p.pairing)) < n := by simp only [Finset.coe_sort_coe,Fintype.card_coe]; omega | |
| refine β¨decompositionCost H,edgeDecomposition_on _ A (p.quotient_supported W hW) (decompositionCost_spec H),?_β© | |
| have hc := ih (A:Set (FamilyQuotient X p.pairing)) H hn' (by simp only [Finset.coe_sort_coe,Fintype.card_coe]; exact (Nat.cast_le.mpr (by omega : A.card β€ W.card)).trans hM) | |
| simp only [Finset.coe_sort_coe,Fintype.card_coe] at hc | |
| have heq : (A.card:β) = (W.card:β) - β i, ((X i).card / 2:β) := by | |
| have hh : (A.card:β) + β i, ((X i).card / 2:β) = W.card := by exact_mod_cast ho | |
| linarith | |
| rwa [heq] at hc | |
| end | |
| end ErdosGallai.Batch | |
| namespace ErdosGallai.Batch | |
| noncomputable section | |
| open Finset SimpleGraph Real | |
| attribute [local instance] Classical.propDecidable | |
| theorem uniform_coupled_resolution_cost : β Dβ : β, 1 < Dβ β§ β D β₯ Dβ, | |
| β (V A B : Type) [Fintype V] [Fintype A] [Fintype B], | |
| β (G F : SimpleGraph V) (R : A β SimpleGraph V) (U : A β Finset V), | |
| F β€ G β (β r, R r β€ G) β | |
| Pairwise (fun r s => Disjoint (R r).edgeSet (R s).edgeSet) β | |
| Pairwise (fun r s => Disjoint (U r) (U s)) β | |
| (β r, β β¦x yβ¦, (R r).Adj x y β x β U r β§ y β U r) β | |
| (β r, Disjoint F.edgeSet (R r).edgeSet) β | |
| F.edgeSet βͺ (β r, (R r).edgeSet) = G.edgeSet β | |
| (β r, CutExpansionOn (R r) (U r) (D^(9/10:β))) β | |
| (β r, D^(9/10:β) β€ ((U r).card:β) β§ ((U r).card:β) β€ D^(51/50:β)) β | |
| β (J : B β SimpleGraph V) (W : B β Finset V), | |
| (β b, J b β€ F) β Pairwise (fun b c => Disjoint (J b).edgeSet (J c).edgeSet) β | |
| (β b, (J b).edgeSet) = F.edgeSet β | |
| (β b, β β¦x yβ¦, (J b).Adj x y β x β W b β§ y β W b) β | |
| (β b, ((W b).card:β) β€ D^(3/10:β)) β | |
| β (I : B β Type) [β b, Fintype (I b)] (X : β b, I b β Finset V) | |
| (_hXd : β b, Pairwise fun i j => Disjoint (X b i) (X b j)), | |
| (β b i, X b i β W b) β | |
| β rX : β b, I b β A, | |
| (β b i, X b i β U (rX b i)) β | |
| (β b i v, v β X b i β (F.degree v:β) β€ D^(1/100:β)) β | |
| 1 β€ D^(1/100:β) β (β b i, 8 β€ (X b i).card) β | |
| (β b i, (D^(1/100:β))^2 β€ (X b i).card) β | |
| β (n : β) (t : β), 0 β€ t β (β b, (W b).card < n) β | |
| (β (Q : Type) [Fintype Q] (H : SimpleGraph Q), Fintype.card Q < n β | |
| (Fintype.card Q:β) β€ D^(3/10:β) β (decompositionCost H:β) β€ t * Fintype.card Q) β | |
| β H : A β SimpleGraph V, | |
| (β r, H r β€ R r) β§ | |
| (β r, CutExpansionOn (H r) (U r) (D^(9/10:β)/4)) β§ | |
| (decompositionCost G:β) β€ | |
| t * ((β b, ((W b).card:β)) - β b, β i, ((X b i).card / 2:β)) + | |
| 8 * (β b, β i, ((X b i).card:β)) + β r, (decompositionCost (H r):β) := by | |
| obtain β¨Dβ,hsplitβ© := uniform_two_routers_on | |
| obtain β¨Dβ,hDβ,hresolveβ© := uniform_batch_resolution | |
| refine β¨max Dβ Dβ,lt_of_lt_of_le hDβ (le_max_right _ _),?_β© | |
| intro D hD V A B _ _ _ G F R U hFG hRG hRR hUU hRU hFR hcover he hr | |
| J W hJF hJJ hJu hW hWnum I _ X hXd hXW rX hXU hdeg ha hm hma n t ht hn ih | |
| have hs (r : A) := hsplit D ((le_max_left _ _).trans hD) V (R r) (U r) | |
| (hRU r) (hr r).1 (hr r).2 (he r) | |
| choose P T hPR hTR hPT hPu hPe hTe using hs | |
| have hPP : Pairwise fun r s => Disjoint (P r).edgeSet (P s).edgeSet := | |
| fun _ _ h => (hRR h).mono (SimpleGraph.edgeSet_mono (hPR _)) (SimpleGraph.edgeSet_mono (hPR _)) | |
| have hp (b : B) : Nonempty (PreparedBatch (J b) (X b) (hXd b)) := | |
| prepare_batch (J b) (X b) (hXd b) (D^(1/100:β)) ha (hm b) (hma b) | |
| (fun i v hv => (Nat.cast_le.mpr (SimpleGraph.degree_le_of_le (hJF b))).trans (hdeg b i v hv)) | |
| let prep (b : B) := Classical.choice (hp b) | |
| have hq (b : B) := prepared_quotient_cost (J b) (X b) (hXd b) (prep b) (W b) | |
| (hW b) (hXW b) n (D^(3/10:β)) t ht (hn b) (hWnum b) ih | |
| choose k hk hkc using hq | |
| obtain β¨K,hK,parts,used,hcount,hparts,hdis,hused,hFu,hpartscoverβ© := | |
| hresolve D ((le_max_right _ _).trans hD) V A B G F P U hFG | |
| (fun r => (hPR r).trans (hRG r)) hPP hUU | |
| (fun r => (hFR r).mono_right (SimpleGraph.edgeSet_mono (hPR r))) hPe hr | |
| J W hJF hJJ hJu hW hWnum I X hXd hXW rX hXU hdeg prep k hk | |
| let : Fintype K := hK | |
| have husedR : used β β r, (R r).edgeSet := hused.trans (Set.iUnion_mono fun r => SimpleGraph.edgeSet_mono (hPR r)) | |
| have hTu := protected_avoids_used R P T hRR hPR hTR (fun r => (hPT r).symm) used hused | |
| let H (r : A) := routerRemainder (R r) used | |
| have hcost := batch_remainder_ledger G F R hRG hRR hFR hcover parts hparts hdis used husedR hpartscover | |
| refine β¨H,fun r => routerRemainder_le _ _,fun r => ?_,?_β© | |
| Β· exact cutExpansionOn_mono (hTe r) (protected_le_remainder (hTR r) (hTu r)) | |
| Β· have hkreal : (Fintype.card K:β) β€ (β b, (k b:β)) + 8 * (β b, β i, ((X b i).card:β)) := by | |
| exact_mod_cast hcount | |
| have hqsum := Finset.sum_le_sum (s := univ) (fun b _ => hkc b) | |
| have hqsum' : (β b, (k b:β)) β€ | |
| t * ((β b, ((W b).card:β)) - β b, β i, ((X b i).card / 2:β)) := by | |
| simpa only [Finset.mul_sum,Finset.sum_sub_distrib,mul_sub,Nat.cast_sum] using hqsum | |
| have hc : (decompositionCost G:β) β€ (Fintype.card K:β) + β r, (decompositionCost (H r):β) := by | |
| exact_mod_cast hcost | |
| linarith | |
| end | |
| end ErdosGallai.Batch | |
| end | |
| end | |
| end | |
| end OAI | |