Download data/lean/OAI/Combinatorics/CycleDecomposition/ScaleHierarchy.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 27.3 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/CycleDecomposition/ScaleHierarchy.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/CycleDecomposition/ScaleHierarchy.lean
-
curl -L -o ScaleHierarchy.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/CycleDecomposition/ScaleHierarchy.lean
27.3 kB
| import OAI.Combinatorics.CycleDecomposition.ScaleExtraction | |
| namespace OAI | |
| universe u | |
| universe cycleUniverse1 cycleUniverse2 cycleUniverse3 cycleUniverse4 cycleUniverse5 cycleUniverse6 | |
| section | |
| open Filter Asymptotics Real | |
| open scoped Topology | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory Finset | |
| section | |
| namespace ErdosGallai.Scale | |
| open Finset SimpleGraph Classical Real | |
| variable {V : Type cycleUniverse1} [Fintype V] [DecidableEq V] | |
| lemma edgeOccurrences_refine {I : Type cycleUniverse2} (L : List I) | |
| (g : I β SimpleGraph V) (f : I β List (SimpleGraph V)) | |
| (h : β i β L, GraphPartition (g i) (f i)) (x y : V) : | |
| edgeOccurrences (L.flatMap f) x y = edgeOccurrences (L.map g) x y := by | |
| induction L with | |
| | nil => simp | |
| | cons i L ih => | |
| simp only [List.flatMap_cons, edgeOccurrences_append, List.map_cons, | |
| edgeOccurrences_cons] | |
| rw [h i (by simp), ih (fun j hj => h j (by simp [hj]))] | |
| lemma graphPartition_refine {I : Type cycleUniverse3} {G : SimpleGraph V} | |
| {C : List (SimpleGraph V)} {L : List I} | |
| {g : I β SimpleGraph V} {f : I β List (SimpleGraph V)} | |
| (hp : GraphPartition G (C ++ L.map g)) | |
| (h : β i β L, GraphPartition (g i) (f i)) : | |
| GraphPartition G (C ++ L.flatMap f) := by | |
| intro x y | |
| simpa only [edgeOccurrences_append, edgeOccurrences_refine L g f h] using hp x y | |
| theorem scale_split : β Dsp : β, β D β₯ Dsp, | |
| β (V : Type u) [Fintype V] [DecidableEq V] | |
| (G : SimpleGraph V) (A : Finset V), A.Nonempty β SupportedOn G A β | |
| 2*(edgeCount G : β)/A.card β€ D β | |
| β (C : List (SimpleGraph V)) (L : List (AssignedPiece V)) | |
| (R : AssignedPiece V β List (AssignedPiece V)) | |
| (H : AssignedPiece V β SimpleGraph V), | |
| (β K β C, IsCycleGraph K β§ D^(101/100:β) β€ (edgeCount K : β)) β§ | |
| (C.length : β) β€ A.card/(2*D^(1/100:β)) β§ | |
| (β P β L, P.vertices β A β§ P.vertices.Nonempty β§ | |
| (P.vertices.card : β) β€ D^(51/50:β)) β§ | |
| (β x β A, β P β L, x β P.vertices) β§ | |
| (L.map (fun P => (P.vertices.card : β))).sum β€ (1+2/logb 2 D)*A.card β§ | |
| (β P β L, | |
| (β Q β R P, Q.vertices β P.vertices β§ | |
| D^(9/10:β) β€ Q.vertices.card β§ | |
| (Q.vertices.card:β) β€ D^(51/50:β) β§ | |
| CutExpansionOn Q.graph Q.vertices (D^(9/10:β))) β§ | |
| (R P).Pairwise (fun Q T => Disjoint Q.vertices T.vertices) β§ | |
| GraphPartition P.graph (H P :: (R P).map AssignedPiece.graph) β§ | |
| SupportedOn (H P) P.vertices β§ | |
| 2*(edgeCount (H P) : β)/P.vertices.card β€ D^(19/20:β)) β§ | |
| GraphPartition G (C ++ L.flatMap (fun P => H P :: (R P).map AssignedPiece.graph)) := by | |
| classical | |
| obtain β¨Dβ,hββ© := scale_boxes.{u} | |
| obtain β¨Dβ,hββ© := scale_cut_extraction.{u} | |
| refine β¨max Dβ Dβ, ?_β© | |
| intro D hD V _ _ G A hA hs hd | |
| obtain β¨C,L,hC,hCN,hL,hcover,hp,hcostβ© := | |
| hβ D ((le_max_left _ _).trans hD) V G A hA hs hd | |
| have hres : β P : AssignedPiece V, | |
| β (R : List (AssignedPiece V)) (H : SimpleGraph V), P β L β | |
| (β Q β R, Q.vertices β P.vertices β§ | |
| D^(9/10:β) β€ Q.vertices.card β§ | |
| (Q.vertices.card:β) β€ D^(51/50:β) β§ | |
| CutExpansionOn Q.graph Q.vertices (D^(9/10:β))) β§ | |
| R.Pairwise (fun Q T => Disjoint Q.vertices T.vertices) β§ | |
| GraphPartition P.graph (H :: R.map AssignedPiece.graph) β§ | |
| SupportedOn H P.vertices β§ | |
| 2*(edgeCount H : β)/P.vertices.card β€ D^(19/20:β) := by | |
| intro P | |
| by_cases hP : P β L | |
| Β· obtain β¨R,H,hgoodβ© := hβ D ((le_max_right _ _).trans hD) V | |
| P.graph P.vertices (hL P hP).2.1 P.supported (hL P hP).2.2 | |
| exact β¨R,H,fun _ => hgoodβ© | |
| Β· exact β¨[],β₯,fun hp => False.elim (hP hp)β© | |
| choose R H hR using hres | |
| refine β¨C,L,R,H,hC,hCN,hL,hcover,hcost,hR,?_β© | |
| exact graphPartition_refine hp (fun P hP => (hR P hP).2.2.1) | |
| end ErdosGallai.Scale | |
| namespace ErdosGallai.Scale | |
| noncomputable section | |
| open Real Filter Finset | |
| open scoped Topology | |
| def scaleTheta : β := 19/20 | |
| def inductionScale (n : β) (j : β) : β := n ^ (scaleTheta ^ j) | |
| lemma scaleTheta_pos : 0 < scaleTheta := by norm_num [scaleTheta] | |
| lemma scaleTheta_lt_one : scaleTheta < 1 := by norm_num [scaleTheta] | |
| lemma inductionScale_zero (n : β) : inductionScale n 0 = n := by | |
| simp [inductionScale] | |
| lemma inductionScale_pos (n : β) (hn : 0 < n) (j : β) : | |
| 0 < inductionScale n j := Real.rpow_pos_of_pos hn _ | |
| lemma inductionScale_succ (n : β) (hn : 0 β€ n) (j : β) : | |
| inductionScale n (j+1) = (inductionScale n j) ^ scaleTheta := by | |
| simp only [inductionScale, pow_succ, Real.rpow_mul hn] | |
| lemma inductionScale_gt_one (n : β) (hn : 1 < n) (j : β) : | |
| 1 < inductionScale n j := by | |
| simpa [inductionScale] using Real.rpow_lt_rpow_of_exponent_lt hn | |
| (pow_pos scaleTheta_pos j) | |
| lemma inductionScale_le (n : β) (hn : 1 β€ n) (j : β) : | |
| inductionScale n j β€ n := by | |
| have hp : scaleTheta ^ j β€ 1 := pow_le_oneβ scaleTheta_pos.le scaleTheta_lt_one.le | |
| simpa [inductionScale] using Real.rpow_le_rpow_of_exponent_le hn hp | |
| lemma inductionScale_log (n : β) (hn : 0 < n) (j : β) : | |
| logb 2 (inductionScale n j) = scaleTheta ^ j * logb 2 n := by | |
| exact Real.logb_rpow_eq_mul_logb_of_pos hn | |
| lemma inductionScale_log_pos (n : β) (hn : 1 < n) (j : β) : | |
| 0 < logb 2 (inductionScale n j) := by | |
| exact Real.logb_pos (by norm_num) (inductionScale_gt_one n hn j) | |
| lemma inductionScale_log_succ (n : β) (hn : 0 < n) (j : β) : | |
| logb 2 (inductionScale n (j+1)) = scaleTheta * logb 2 (inductionScale n j) := by | |
| rw [inductionScale_log n hn, inductionScale_log n hn, pow_succ] | |
| ring | |
| lemma inductionScale_add (n : β) (hn : 0 β€ n) (i K : β) : | |
| inductionScale n (i+K) = (inductionScale n i) ^ (scaleTheta ^ K) := by | |
| simp only [inductionScale, pow_add, Real.rpow_mul hn] | |
| lemma inductionScale_window : (51/50 : β) * scaleTheta ^ 200 < 1/1000 β§ | |
| scaleTheta ^ 201 < 1/1000 := by | |
| norm_num [scaleTheta] | |
| lemma inductionScale_tendsto (n : β) (hn : 0 < n) : | |
| Tendsto (inductionScale n) atTop (π 1) := by | |
| have ht := (Real.continuous_const_rpow (ne_of_gt hn)).tendsto 0 | |
| change Tendsto (fun j : β => n ^ (scaleTheta ^ j)) atTop (π 1) | |
| simpa only [Function.comp_def, Real.rpow_zero] using | |
| ht.comp (tendsto_pow_atTop_nhds_zero_of_lt_one scaleTheta_pos.le scaleTheta_lt_one) | |
| theorem inductionScale_first_cutoff (n Dstar : β) (hD : 1 < Dstar) (hn : Dstar β€ n) : | |
| β m : β, 0 < m β§ inductionScale n m < Dstar β§ | |
| β j < m, Dstar β€ inductionScale n j := by | |
| have hn0 : 0 < n := lt_trans (by norm_num) (hD.trans_le hn) | |
| have he : βαΆ j in atTop, inductionScale n j < Dstar := | |
| (inductionScale_tendsto n hn0).eventually (gt_mem_nhds hD) | |
| have hex : β j, inductionScale n j < Dstar := he.exists | |
| refine β¨Nat.find hex, ?_, Nat.find_spec hex, ?_β© | |
| Β· by_contra hm | |
| have hz : Nat.find hex = 0 := by omega | |
| have := Nat.find_spec hex | |
| rw [hz, inductionScale_zero] at this | |
| linarith | |
| Β· intro j hj | |
| exact le_of_not_gt (Nat.find_min hex hj) | |
| theorem scale_reciprocal_log_sum (n : β) (hn : 1 < n) (j : β) : | |
| (β l β Finset.range (j+1), 1 / logb 2 (inductionScale n l)) β€ | |
| 20 / logb 2 (inductionScale n j) := by | |
| induction j with | |
| | zero => | |
| simp only [zero_add, Finset.sum_range_succ, Finset.sum_range_zero, zero_add] | |
| exact div_le_div_of_nonneg_right (by norm_num) (inductionScale_log_pos n hn 0).le | |
| | succ j ih => | |
| rw [Finset.sum_range_succ] | |
| have hb : (β x β range (j + 1), 1 / logb 2 (inductionScale n x)) + | |
| 1 / logb 2 (inductionScale n (j+1)) β€ | |
| 20 / logb 2 (inductionScale n j) + 1 / logb 2 (inductionScale n (j+1)) := by | |
| linarith [ih] | |
| apply hb.trans_eq | |
| rw [inductionScale_log_succ n (by linarith)] | |
| have hz : logb 2 (inductionScale n j) β 0 := ne_of_gt (inductionScale_log_pos n hn j) | |
| dsimp [scaleTheta] | |
| field_simp | |
| ; ring | |
| lemma exp_le_one_add_twice {x : β} (hx : 0 β€ x) (hxhalf : x β€ 1/2) : | |
| exp x β€ 1+2*x := by | |
| apply (Real.exp_bound_div_one_sub_of_interval hx (by linarith)).trans | |
| apply (div_le_iffβ (by linarith : 0 < 1-x)).mpr | |
| nlinarith | |
| theorem scale_overlap_product (n Cβ : β) (hn : 1 < n) (hC : 0 β€ Cβ) (j : β) | |
| (hcut : 40*Cβ β€ logb 2 (inductionScale n j)) : | |
| (β l β Finset.range (j+1), (1 + Cβ / logb 2 (inductionScale n l))) β€ | |
| 1 + 40*Cβ / logb 2 (inductionScale n j) := by | |
| have hL := inductionScale_log_pos n hn j | |
| have hsum : (β l β Finset.range (j+1), Cβ / logb 2 (inductionScale n l)) β€ | |
| 20*Cβ / logb 2 (inductionScale n j) := by | |
| have hh := mul_le_mul_of_nonneg_left (scale_reciprocal_log_sum n hn j) hC | |
| calc | |
| _ β€ Cβ * (20 / logb 2 (inductionScale n j)) := by | |
| simpa only [Finset.mul_sum, mul_one_div] using hh | |
| _ = _ := by ring | |
| calc | |
| _ β€ β l β Finset.range (j+1), exp (Cβ / logb 2 (inductionScale n l)) := by | |
| apply Finset.prod_le_prodβ | |
| Β· intro l hl | |
| have := div_nonneg hC (inductionScale_log_pos n hn l).le | |
| linarith | |
| Β· intro l hl | |
| simpa [add_comm] using Real.add_one_le_exp (Cβ / logb 2 (inductionScale n l)) | |
| _ = exp (β l β Finset.range (j+1), Cβ / logb 2 (inductionScale n l)) := | |
| (Real.exp_sum _ _).symm | |
| _ β€ exp (20*Cβ / logb 2 (inductionScale n j)) := Real.exp_le_exp.mpr hsum | |
| _ β€ 1 + 2*(20*Cβ / logb 2 (inductionScale n j)) := by | |
| apply exp_le_one_add_twice (div_nonneg (by positivity) hL.le) | |
| apply (div_le_iffβ hL).mpr | |
| linarith | |
| _ = _ := by ring | |
| theorem scale_prefix_cycle_cost (n : β) (hn : 1 < n) (j : β) (A : β β β) | |
| (hA : β l β Finset.range (j+1), A l β€ 2*n) | |
| (hscale : β l β Finset.range (j+1), | |
| 1 / (inductionScale n l) ^ (1/100 : β) β€ 1 / logb 2 (inductionScale n l)) : | |
| (β l β Finset.range (j+1), A l / (2*(inductionScale n l) ^ (1/100 : β))) β€ | |
| 20*n / logb 2 (inductionScale n j) := by | |
| have hn0 : 0 < n := by linarith | |
| calc | |
| _ β€ β l β Finset.range (j+1), n * (1 / logb 2 (inductionScale n l)) := by | |
| apply Finset.sum_le_sum | |
| intro l hl | |
| have hp : 0 < (inductionScale n l) ^ (1/100 : β) := | |
| Real.rpow_pos_of_pos (inductionScale_pos n hn0 l) _ | |
| calc | |
| _ β€ 2*n / (2*(inductionScale n l) ^ (1/100 : β)) := | |
| div_le_div_of_nonneg_right (hA l hl) (by positivity) | |
| _ = n * (1 / (inductionScale n l) ^ (1/100 : β)) := by ring | |
| _ β€ _ := mul_le_mul_of_nonneg_left (hscale l hl) hn0.le | |
| _ = n * (β l β Finset.range (j+1), 1 / logb 2 (inductionScale n l)) := | |
| (Finset.mul_sum _ _ _).symm | |
| _ β€ n * (20 / logb 2 (inductionScale n j)) := | |
| mul_le_mul_of_nonneg_left (scale_reciprocal_log_sum n hn j) hn0.le | |
| _ = _ := by ring | |
| end | |
| end ErdosGallai.Scale | |
| namespace ErdosGallai.Scale | |
| noncomputable section | |
| open Finset SimpleGraph Real | |
| attribute [local instance] Classical.propDecidable | |
| variable {V : Type} [Fintype V] [DecidableEq V] | |
| structure StageSplit (P : AssignedPiece V) where | |
| cycles : List (SimpleGraph V) | |
| boxes : List (AssignedPiece V) | |
| pieces : AssignedPiece V β List (AssignedPiece V) | |
| remainder : AssignedPiece V β SimpleGraph V | |
| cycles_good : β K β cycles, IsCycleGraph K | |
| box_subset : β B β boxes, B.vertices β P.vertices | |
| box_nonempty : P.vertices.Nonempty β β B β boxes, B.vertices.Nonempty | |
| box_cover : β v β P.vertices, β B β boxes, v β B.vertices | |
| piece_subset : β B β boxes, β R β pieces B, R.vertices β B.vertices | |
| piece_disjoint : β B β boxes, (pieces B).Pairwise fun R S => Disjoint R.vertices S.vertices | |
| remainder_supported : β B β boxes, SupportedOn (remainder B) B.vertices | |
| box_partition : β B β boxes, GraphPartition B.graph (remainder B :: (pieces B).map AssignedPiece.graph) | |
| partition : GraphPartition P.graph (cycles ++ boxes.map AssignedPiece.graph) | |
| def StageSplit.Bounded {P : AssignedPiece V} (s : StageSplit P) (D : β) : Prop := | |
| (s.cycles.length:β) β€ P.vertices.card / (2*D^(1/100:β)) β§ | |
| (s.boxes.map (fun B => (B.vertices.card:β))).sum β€ (1+2/logb 2 D)*P.vertices.card β§ | |
| (β B β s.boxes, (B.vertices.card:β) β€ D^(51/50:β)) β§ | |
| (β B β s.boxes, β R β s.pieces B, | |
| D^(9/10:β) β€ (R.vertices.card:β) β§ (R.vertices.card:β) β€ D^(51/50:β) β§ | |
| CutExpansionOn R.graph R.vertices (D^(9/10:β))) β§ | |
| (β B β s.boxes, 2*(edgeCount (s.remainder B):β)/B.vertices.card β€ D^(19/20:β)) | |
| def StageSplit.trivial (P : AssignedPiece V) : StageSplit P where | |
| cycles := [] | |
| boxes := [P] | |
| pieces := fun _ => [] | |
| remainder := AssignedPiece.graph | |
| cycles_good := by simp | |
| box_subset := by simp | |
| box_nonempty := by simp | |
| box_cover := by intro v hv; exact β¨P,by simp,hvβ© | |
| piece_subset := by simp | |
| piece_disjoint := by simp | |
| remainder_supported := fun B _ => B.supported | |
| box_partition := by intro B _ x y; simp | |
| partition := by intro x y; simp | |
| theorem scale_splitter : β Dsp : β, β (V : Type) [Fintype V] [DecidableEq V], | |
| β split : β (_D : β) (P : AssignedPiece V), StageSplit P, | |
| β D β₯ Dsp, β P, P.vertices.Nonempty β | |
| 2*(edgeCount P.graph:β)/P.vertices.card β€ D β (split D P).Bounded D := by | |
| obtain β¨Dsp,hspβ© := scale_split | |
| refine β¨Dsp,?_β© | |
| intro V _ _ | |
| have hex (D : β) (P : AssignedPiece V) : β s : StageSplit P, | |
| Dsp β€ D β P.vertices.Nonempty β 2*(edgeCount P.graph:β)/P.vertices.card β€ D β s.Bounded D := by | |
| by_cases h : Dsp β€ D β§ P.vertices.Nonempty β§ 2*(edgeCount P.graph:β)/P.vertices.card β€ D | |
| Β· obtain β¨C,L,R,H,hC,hCl,hL,hcover,horder,hR,hpartβ© := | |
| hsp D h.1 V P.graph P.vertices h.2.1 P.supported h.2.2 | |
| have hpart' : GraphPartition P.graph (C ++ L.map AssignedPiece.graph) := by | |
| intro x y | |
| rw [edgeOccurrences_append, β edgeOccurrences_refine L AssignedPiece.graph | |
| (fun B => H B :: (R B).map AssignedPiece.graph) (fun B hB => (hR B hB).2.2.1)] | |
| simpa only [edgeOccurrences_append] using hpart x y | |
| let s : StageSplit P := { | |
| cycles := C, boxes := L, pieces := R, remainder := H | |
| cycles_good := fun K hK => (hC K hK).1 | |
| box_subset := fun B hB => (hL B hB).1 | |
| box_nonempty := fun _ B hB => (hL B hB).2.1 | |
| box_cover := hcover | |
| piece_subset := fun B hB Q hQ => (hR B hB).1 Q hQ |>.1 | |
| piece_disjoint := fun B hB => (hR B hB).2.1 | |
| remainder_supported := fun B hB => (hR B hB).2.2.2.1 | |
| box_partition := fun B hB => (hR B hB).2.2.1 | |
| partition := hpart' } | |
| refine β¨s,fun _ _ _ => β¨hCl,horder,fun B hB => (hL B hB).2.2,?_,?_β©β© | |
| Β· exact fun B hB Q hQ => (hR B hB).1 Q hQ |>.2 | |
| Β· exact fun B hB => (hR B hB).2.2.2.2 | |
| Β· exact β¨StageSplit.trivial P,fun hD hP hdeg => False.elim (h β¨hD,hP,hdegβ©)β© | |
| choose s hs using hex | |
| exact β¨s,fun D hD P hP hdeg => hs D P hD hP hdegβ© | |
| def StageSplit.children {P : AssignedPiece V} (s : StageSplit P) : List (AssignedPiece V) := | |
| s.boxes.pmap (fun B hB => β¨B.vertices,s.remainder B,s.remainder_supported B hBβ©) (fun _ h => h) | |
| lemma StageSplit.mem_children {V : Type} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] {P : AssignedPiece V} (s : StageSplit P) (Q : AssignedPiece V) : | |
| Q β s.children β β B β s.boxes, Q.vertices = B.vertices β§ Q.graph = s.remainder B := by | |
| simp only [StageSplit.children, List.mem_pmap] | |
| constructor | |
| Β· rintro β¨B,hB,rflβ©; exact β¨B,hB,rfl,rflβ© | |
| Β· rintro β¨B,hB,hv,hgβ© | |
| refine β¨B,hB,?_β© | |
| cases Q; cases B; simp_all | |
| lemma StageSplit.children_map {V : Type} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] {P : AssignedPiece V} (s : StageSplit P) | |
| {Ξ± : Type cycleUniverse4} (f : Finset V β SimpleGraph V β Ξ±) : | |
| s.children.map (fun Q => f Q.vertices Q.graph) = | |
| s.boxes.map (fun B => f B.vertices (s.remainder B)) := by | |
| unfold StageSplit.children | |
| rw [List.map_pmap] | |
| change List.pmap (fun B (_ : B β s.boxes) => f B.vertices (s.remainder B)) s.boxes _ = _ | |
| exact List.pmap_eq_map (fun B (h : B β s.boxes) => h) | |
| lemma list_disjoint_card_le {V : Type} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] (L : List (Finset V)) (A : Finset V) | |
| (hd : L.Pairwise Disjoint) (hA : β B β L, B β A) : | |
| (L.map Finset.card).sum β€ A.card := by | |
| induction L generalizing A with | |
| | nil => simp | |
| | cons B L ih => | |
| obtain β¨hBL,hdβ© := List.pairwise_cons.mp hd | |
| have hBA := hA B (by simp) | |
| have hLA : β C β L, C β A \ B := by | |
| intro C hC v hv | |
| exact Finset.mem_sdiff.mpr β¨hA C (by simp [hC]) hv, | |
| fun hb => Finset.disjoint_left.mp (hBL C hC) hb hvβ© | |
| have hh := ih (A \ B) hd hLA | |
| have hc := Finset.card_sdiff_of_subset hBA | |
| have hBAcard := Finset.card_le_card hBA | |
| simp only [List.map_cons,List.sum_cons] | |
| omega | |
| def vertexMass (L : List (AssignedPiece V)) : β := | |
| (L.map (fun P => (P.vertices.card:β))).sum | |
| lemma vertexMass_nonneg {V : Type} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] (L : List (AssignedPiece V)) : 0 β€ vertexMass L := | |
| List.sum_nonneg (fun x hx => by obtain β¨P,_,rflβ© := List.mem_map.mp hx; positivity) | |
| @[simp] lemma vertexMass_nil {V : Type} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] : vertexMass ([] : List (AssignedPiece V)) = 0 := rfl | |
| @[simp] lemma vertexMass_cons {V : Type} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] (P : AssignedPiece V) (L) : | |
| vertexMass (P::L) = P.vertices.card + vertexMass L := rfl | |
| @[simp] lemma vertexMass_append {V : Type} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] (L M : List (AssignedPiece V)) : | |
| vertexMass (L++M) = vertexMass L + vertexMass M := by simp [vertexMass] | |
| lemma vertexMass_flatMap {I : Type cycleUniverse5} (L : List I) (f : I β List (AssignedPiece V)) : | |
| vertexMass (L.flatMap f) = (L.map (fun i => vertexMass (f i))).sum := by | |
| induction L with | |
| | nil => simp | |
| | cons i L ih => simp [ih] | |
| lemma StageSplit.children_mass {P : AssignedPiece V} (s : StageSplit P) : | |
| vertexMass s.children = vertexMass s.boxes := by | |
| unfold vertexMass | |
| rw [s.children_map (fun A _ => (A.card:β))] | |
| lemma StageSplit.pieces_mass {P : AssignedPiece V} (s : StageSplit P) {B : AssignedPiece V} | |
| (hB : B β s.boxes) : vertexMass (s.pieces B) β€ B.vertices.card := by | |
| have hh := list_disjoint_card_le ((s.pieces B).map AssignedPiece.vertices) B.vertices | |
| (List.pairwise_map.mpr (s.piece_disjoint B hB)) (by | |
| intro A hA; obtain β¨Q,hQ,rflβ© := List.mem_map.mp hA | |
| exact s.piece_subset B hB Q hQ) | |
| simpa [vertexMass,List.map_map,Function.comp_def] using (Nat.cast_le.mpr hh : (_:β) β€ _) | |
| end | |
| end ErdosGallai.Scale | |
| namespace ErdosGallai.Scale | |
| noncomputable section | |
| open Finset SimpleGraph Real | |
| attribute [local instance] Classical.propDecidable | |
| variable {V : Type} [Fintype V] [DecidableEq V] | |
| abbrev SplitSystem (V : Type) [Fintype V] [DecidableEq V] := | |
| β β (P : AssignedPiece V) β StageSplit P | |
| def nextLayer (s : SplitSystem V) (j : β) (L : List (AssignedPiece V)) : List (AssignedPiece V) := | |
| L.flatMap fun P => (s j P).children | |
| def advance (s : SplitSystem V) (j : β) : β β List (AssignedPiece V) β List (AssignedPiece V) | |
| | 0,L => L | |
| | k+1,L => nextLayer s (j+k) (advance s j k L) | |
| @[simp] lemma advance_zero (s : SplitSystem V) (j) (L) : advance s j 0 L = L := rfl | |
| @[simp] lemma advance_succ (s : SplitSystem V) (j k) (L) : | |
| advance s j (k+1) L = nextLayer s (j+k) (advance s j k L) := rfl | |
| lemma advance_add (s : SplitSystem V) (j k l) (L) : | |
| advance s j (k+l) L = advance s (j+k) l (advance s j k L) := by | |
| induction l with | |
| | zero => simp | |
| | succ l ih => simp only [Nat.add_succ,advance_succ,ih,Nat.add_assoc] | |
| lemma advance_flatMap (s : SplitSystem V) (j k) {I : Type cycleUniverse6} | |
| (L : List I) (f : I β List (AssignedPiece V)) : | |
| advance s j k (L.flatMap f) = L.flatMap (fun i => advance s j k (f i)) := by | |
| induction k with | |
| | zero => rfl | |
| | succ k ih => simp only [advance_succ,nextLayer,ih,List.flatMap_assoc] | |
| lemma nextLayer_mem (s : SplitSystem V) (j) (L) (Q : AssignedPiece V) : | |
| Q β nextLayer s j L β β P β L, β B β (s j P).boxes, | |
| Q.vertices = B.vertices β§ Q.graph = (s j P).remainder B := by | |
| simp only [nextLayer,List.mem_flatMap,StageSplit.mem_children] | |
| lemma advance_subset (s : SplitSystem V) (j k) (L) (A : Finset V) | |
| (hA : β P β L, P.vertices β A) : | |
| β Q β advance s j k L, Q.vertices β A := by | |
| induction k with | |
| | zero => exact hA | |
| | succ k ih => | |
| intro Q hQ | |
| obtain β¨P,hP,B,hB,hv,_β© := (nextLayer_mem s (j+k) _ Q).mp hQ | |
| rw [hv] | |
| exact ((s (j+k) P).box_subset B hB).trans (ih P hP) | |
| lemma advance_nonempty (s : SplitSystem V) (j k) (L) | |
| (hL : β P β L, P.vertices.Nonempty) : | |
| β Q β advance s j k L, Q.vertices.Nonempty := by | |
| induction k with | |
| | zero => exact hL | |
| | succ k ih => | |
| intro Q hQ | |
| obtain β¨P,hP,B,hB,hv,_β© := (nextLayer_mem s (j+k) _ Q).mp hQ | |
| rw [hv] | |
| exact (s (j+k) P).box_nonempty (ih P hP) B hB | |
| lemma advance_cover (s : SplitSystem V) (j k) (L) (P : AssignedPiece V) (hP : P β L) | |
| (v : V) (hv : v β P.vertices) : β Q β advance s j k L, v β Q.vertices := by | |
| induction k with | |
| | zero => exact β¨P,hP,hvβ© | |
| | succ k ih => | |
| obtain β¨Q,hQ,hvQβ© := ih | |
| obtain β¨B,hB,hvBβ© := (s (j+k) Q).box_cover v hvQ | |
| let T : AssignedPiece V := β¨B.vertices,(s (j+k) Q).remainder B, | |
| (s (j+k) Q).remainder_supported B hBβ© | |
| exact β¨T,(nextLayer_mem s (j+k) _ T).mpr β¨Q,hQ,B,hB,rfl,rflβ©,hvBβ© | |
| lemma list_union_mem {V : Type} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] (L : List (AssignedPiece V)) (v : V) : | |
| v β L.foldr (fun (P : AssignedPiece V) (U : Finset V) => P.vertices βͺ U) β β β P β L, v β P.vertices := by | |
| induction L with | |
| | nil => simp | |
| | cons P L ih => | |
| simp only [List.foldr_cons,Finset.mem_union,ih,List.mem_cons] | |
| aesop | |
| lemma list_union_card {V : Type} [_contextInstance1 : Fintype V] [_contextInstance2 : DecidableEq V] (L : List (AssignedPiece V)) : | |
| ((L.foldr (fun (P : AssignedPiece V) (U : Finset V) => P.vertices βͺ U) β ).card:β) β€ vertexMass L := by | |
| induction L with | |
| | nil => simp | |
| | cons P L ih => | |
| simp only [List.foldr_cons,vertexMass_cons] | |
| have hc := Finset.card_union_le P.vertices (L.foldr (fun (P : AssignedPiece V) (U : Finset V) => P.vertices βͺ U) β ) | |
| have hc' : ((P.vertices βͺ L.foldr (fun (P : AssignedPiece V) (U : Finset V) => P.vertices βͺ U) β ).card:β) β€ | |
| P.vertices.card + (L.foldr (fun (P : AssignedPiece V) (U : Finset V) => P.vertices βͺ U) β ).card := by exact_mod_cast hc | |
| linarith | |
| lemma list_cover_card_le (L : List (AssignedPiece V)) (A : Finset V) | |
| (hcover : β v β A, β P β L, v β P.vertices) : (A.card:β) β€ vertexMass L := by | |
| have hsub : A β L.foldr (fun (P : AssignedPiece V) (U : Finset V) => P.vertices βͺ U) β := | |
| fun v hv => (list_union_mem L v).mpr (hcover v hv) | |
| exact (Nat.cast_le.mpr (Finset.card_le_card hsub)).trans (list_union_card L) | |
| lemma advance_mass_lower (s : SplitSystem V) (j k) (P : AssignedPiece V) : | |
| (P.vertices.card:β) β€ vertexMass (advance s j k [P]) := | |
| list_cover_card_le _ _ (fun v hv => advance_cover s j k [P] P (by simp) v hv) | |
| lemma nextLayer_mass_bound (s : SplitSystem V) (j) (L : List (AssignedPiece V)) (D : β) | |
| (hb : β P β L, (s j P).Bounded D) : | |
| vertexMass (nextLayer s j L) β€ (1+2/logb 2 D)*vertexMass L := by | |
| induction L with | |
| | nil => simp [nextLayer] | |
| | cons P L ih => | |
| have hP := (hb P (by simp)).2.1 | |
| have hL := ih (fun Q hQ => hb Q (by simp [hQ])) | |
| simp only [nextLayer,List.flatMap_cons,vertexMass_append,StageSplit.children_mass, | |
| vertexMass_cons] at hL β’ | |
| change vertexMass (s j P).boxes β€ _ at hP | |
| nlinarith | |
| lemma advance_valid (s : SplitSystem V) (n Dstar : β) (hn : 0 β€ n) | |
| (hs : β l P, Dstar β€ inductionScale n l β P.vertices.Nonempty β | |
| 2*(edgeCount P.graph:β)/P.vertices.card β€ inductionScale n l β | |
| (s l P).Bounded (inductionScale n l)) | |
| (j k : β) (L : List (AssignedPiece V)) | |
| (hL : β P β L, P.vertices.Nonempty) | |
| (hdeg : β P β L, 2*(edgeCount P.graph:β)/P.vertices.card β€ inductionScale n j) | |
| (hcut : β l, j β€ l β l < j+k β Dstar β€ inductionScale n l) : | |
| β P β advance s j k L, | |
| 2*(edgeCount P.graph:β)/P.vertices.card β€ inductionScale n (j+k) := by | |
| induction k with | |
| | zero => simpa using hdeg | |
| | succ k ih => | |
| intro Q hQ | |
| obtain β¨P,hP,B,hB,hv,hgβ© := (nextLayer_mem s (j+k) _ Q).mp hQ | |
| have hPdeg := ih (fun l hlj hl => hcut l hlj (by omega)) P hP | |
| have hb := hs (j+k) P (hcut (j+k) (by omega) (by omega)) | |
| (advance_nonempty s j k L hL P hP) hPdeg | |
| rw [hv,hg,show j+(k+1) = (j+k)+1 by omega,inductionScale_succ n hn] | |
| exact hb.2.2.2.2 B hB | |
| lemma advance_bounded (s : SplitSystem V) (n Dstar : β) (hn : 0 β€ n) | |
| (hs : β l P, Dstar β€ inductionScale n l β P.vertices.Nonempty β | |
| 2*(edgeCount P.graph:β)/P.vertices.card β€ inductionScale n l β | |
| (s l P).Bounded (inductionScale n l)) | |
| (j k : β) (L : List (AssignedPiece V)) | |
| (hL : β P β L, P.vertices.Nonempty) | |
| (hdeg : β P β L, 2*(edgeCount P.graph:β)/P.vertices.card β€ inductionScale n j) | |
| (hcut : β l, j β€ l β l β€ j+k β Dstar β€ inductionScale n l) : | |
| β P β advance s j k L, (s (j+k) P).Bounded (inductionScale n (j+k)) := by | |
| intro P hP | |
| exact hs (j+k) P (hcut _ (by omega) (by omega)) (advance_nonempty s j k L hL P hP) | |
| (advance_valid s n Dstar hn hs j k L hL hdeg (fun l hlj hl => hcut l hlj (by omega)) P hP) | |
| lemma advance_mass_global_product (s : SplitSystem V) (n : β) (hn : 1 < n) | |
| (j k : β) (L : List (AssignedPiece V)) | |
| (hb : β l < k, β P β advance s j l L, (s (j+l) P).Bounded (inductionScale n (j+l))) : | |
| vertexMass (advance s j k L) β€ vertexMass L * | |
| β l β Finset.range (j+k), (1+2/logb 2 (inductionScale n l)) := by | |
| have hfac (l) : 1 β€ 1+2/logb 2 (inductionScale n l) := by | |
| have := div_nonneg (by norm_num : (0:β) β€ 2) (inductionScale_log_pos n hn l).le | |
| linarith | |
| induction k with | |
| | zero => | |
| simp only [advance_zero,Nat.add_zero] | |
| exact le_mul_of_one_le_right (vertexMass_nonneg L) (Finset.one_le_prodβ (fun l _ => hfac l)) | |
| | succ k ih => | |
| have hm := nextLayer_mass_bound s (j+k) (advance s j k L) (inductionScale n (j+k)) | |
| (hb k (by omega)) | |
| have hi := mul_le_mul_of_nonneg_left (ih (fun l hl => hb l (by omega))) ((hfac (j+k)).trans' (by norm_num : (0:β) β€ 1)) | |
| rw [advance_succ,show j+(k+1) = (j+k)+1 by omega,Finset.prod_range_succ] | |
| calc | |
| _ β€ (1+2/logb 2 (inductionScale n (j+k))) * vertexMass (advance s j k L) := hm | |
| _ β€ _ := by nlinarith only [hi] | |
| end | |
| end ErdosGallai.Scale | |
| end | |
| end | |
| end | |
| end OAI | |