cfahlgren1's picture
download
raw
17 kB
import OAI.Combinatorics.ListHadwiger.TerminalGrouping
namespace OAI
namespace LinearListHadwiger.CoarseDensity
open SimpleGraph Finset
open Knitting
variable {V : Type} [Fintype V] [DecidableEq V]
theorem connected_dominating (G : SimpleGraph V) [DecidableRel G.Adj]
(hc : G.Connected) {N k : ℕ} (hk : 0 < k)
(hn : Fintype.card V ≤ N)
(hd : ∀ v, k ≤ (Density.neighbors G univ v).card) :
∃ D : Finset V, (G.induce (↑D : Set V)).Connected ∧
(∀ v, ∃ w ∈ D, G.Adj v w) ∧
D.card ≤ 3*(N/k+1)*⌈10*((N:ℝ)/(3*k))*Real.log (2*N)⌉₊ := by
classical
have : Nonempty V := hc.nonempty
have hN : (1 : ℝ) ≤ N := by exact_mod_cast ((Nat.succ_le_iff.mpr Fintype.card_pos).trans hn)
obtain ⟨R,_,hR,hcover⟩ := ConnectivityTests.exists_neighborhood_cover G univ hN
(by positivity : (0:ℝ)<3*k) (by simp)
(by exact_mod_cast hn) (fun v _ => by
simpa only [mul_div_cancel_left₀ (k:ℝ) (by norm_num : (3:ℝ)≠0)] using
(show (k:ℝ) ≤ ((univ.filter (G.Adj v)).card:ℝ) by exact_mod_cast hd v))
have hRn : R.Nonempty := by
obtain ⟨w,hw,_⟩ := hcover (Classical.arbitrary V) (mem_univ _)
exact ⟨w,hw⟩
obtain ⟨r,hr⟩ := hRn
have hp : ∀ v : R, ∃ p : G.Walk r v.val, p.IsPath ∧ p.length < 3*(N/k+1) := by
intro v
obtain ⟨p,hp,hl⟩ := short_path G hc hk hd r v.val
exact ⟨p,hp,hl.trans_le (Nat.mul_le_mul_left 3 (Nat.add_le_add_right (Nat.div_le_div_right hn) 1))⟩
choose p hp hl using hp
let D : Finset V := univ.biUnion fun v : R => (p v).support.toFinset
have hsub (v : R) : {w | w ∈ (p v).support} ⊆ (↑D : Set V) := by
intro w hw
exact mem_biUnion.mpr ⟨v,mem_univ _,List.mem_toFinset.mpr hw⟩
have hrD : r ∈ D := hsub ⟨r,hr⟩ (Walk.start_mem_support _)
refine ⟨D,?_,?_,?_⟩
· have hre : ∀ v : (↑D : Set V), (G.induce (↑D : Set V)).Reachable ⟨r,hrD⟩ v := by
rintro ⟨v,hv⟩
obtain ⟨w,_,hw⟩ := mem_biUnion.mp hv
have hh := ((p w).connected_induce_support).preconnected
⟨r,Walk.start_mem_support _⟩ ⟨v,List.mem_toFinset.mp hw⟩
exact hh.map (G.induceHomOfLE (hsub w)).toHom
exact {preconnected := fun v w => (hre v).symm.trans (hre w), nonempty := ⟨⟨r,hrD⟩⟩}
· intro v
obtain ⟨w,hw,hvw⟩ := hcover v (mem_univ _)
exact ⟨w,hsub ⟨w,hw⟩ (Walk.end_mem_support _),hvw⟩
· calc
D.card ≤ ∑ v : R, (p v).support.toFinset.card := card_biUnion_le
_ ≤ ∑ _v : R, 3*(N/k+1) := by
apply sum_le_sum
intro v _
have he := (p v).length_support
have hh := List.toFinset_card_le (p v).support
have h := hl v
omega
_ = R.card * (3*(N/k+1)) := by simp [Nat.mul_comm]
_ ≤ _ := by simpa only [Nat.mul_comm] using Nat.mul_le_mul_left (3*(N/k+1)) hR
lemma neighbors_univ (G : SimpleGraph V) [DecidableRel G.Adj] (v : V) :
Density.neighbors G univ v = G.neighborFinset v := by ext; simp
lemma degree_delete (G : SimpleGraph V) [DecidableRel G.Adj] (D : Finset V)
(v : (↑(univ \ D) : Set V)) :
G.degree v.val ≤ (G.induce (↑(univ \ D) : Set V)).degree v + D.card := by
classical
have he : ((G.induce (↑(univ \ D) : Set V)).neighborFinset v).image Subtype.val =
G.neighborFinset v.val ∩ (univ \ D) := by
ext w
simp only [mem_image,mem_neighborFinset,induce_adj,mem_inter,mem_sdiff,mem_univ,true_and]
constructor
· rintro ⟨z,hz,rfl⟩
exact ⟨hz,(mem_sdiff.mp z.property).2⟩
· rintro ⟨hz,hD⟩
exact ⟨⟨w,mem_sdiff.mpr ⟨mem_univ _,hD⟩⟩,hz,rfl⟩
have hec := congrArg Finset.card he
rw [Finset.card_image_of_injective _ Subtype.val_injective,card_neighborFinset_eq_degree] at hec
have hu : G.neighborFinset v.val ⊆ G.neighborFinset v.val ∩ (univ \ D) ∪ D := by
intro w hw
by_cases hD : w ∈ D
· exact mem_union_right _ hD
· exact mem_union_left _ (mem_inter.mpr ⟨hw,mem_sdiff.mpr ⟨mem_univ _,hD⟩⟩)
have hh := (card_le_card hu).trans (card_union_le _ _)
rw [card_neighborFinset_eq_degree, ← hec] at hh
exact hh
lemma clique_successor (G : SimpleGraph V) (D : Finset V)
(hc : (G.induce (↑D : Set V)).Connected)
(hd : ∀ v, ∃ w ∈ D, G.Adj v w) {q : ℕ}
(hm : HasCliqueMinor (G.induce (↑(univ \ D) : Set V)) q) : HasCliqueMinor G (q+1) := by
classical
obtain ⟨B,hB,hdis,hE⟩ := hm
let M := model_induce G (univ \ D)
let C (i : Fin q) := M.expand (B i)
have hC (i : Fin q) : (G.induce (C i)).Connected := M.expand_connected (hB i)
have hCD (i : Fin q) : Disjoint (↑D : Set V) (C i) := by
apply Set.disjoint_left.mpr
rintro v hv ⟨w,_,hw⟩
have he : v=w.val := hw
exact (mem_sdiff.mp w.property).2 (he ▸ hv)
have hCC (i j : Fin q) (hne : i≠j) : Disjoint (C i) (C j) := M.expand_disjoint (hdis i j hne)
have had (i : Fin q) : ∃ v ∈ (↑D : Set V), ∃ w ∈ C i, G.Adj v w := by
obtain ⟨w⟩ := (hC i).nonempty
obtain ⟨v,hv,hvw⟩ := hd w.val
exact ⟨v,hv,w.val,w.property,hvw.symm⟩
have hCE (i j : Fin q) (hne : i≠j) : ∃ v ∈ C i, ∃ w ∈ C j, G.Adj v w := by
obtain ⟨v,hv,w,hw,hvw⟩ := hE i j hne
exact ⟨v.val,⟨v,hv,rfl⟩,w.val,⟨w,hw,rfl⟩,hvw⟩
refine ⟨Fin.cases (↑D : Set V) C,?_,?_,?_⟩
· intro i
refine Fin.cases ?_ (fun j => ?_) i
· exact hc
· exact hC j
· intro i j
refine Fin.cases ?_ (fun a => ?_) i
· refine Fin.cases ?_ (fun b _ => ?_) j
· exact fun h => (h rfl).elim
· exact hCD b
· refine Fin.cases (fun _ => ?_) (fun b h => ?_) j
· exact (hCD a).symm
· exact hCC a b (fun he => h (congrArg Fin.succ he))
· intro i j
refine Fin.cases ?_ (fun a => ?_) i
· refine Fin.cases ?_ (fun b _ => ?_) j
· exact fun h => (h rfl).elim
· exact had b
· refine Fin.cases (fun _ => ?_) (fun b h => ?_) j
· obtain ⟨v,hv,w,hw,hvw⟩ := had a
exact ⟨w,hw,v,hv,hvw.symm⟩
· exact hCE a b (fun he => h (congrArg Fin.succ he))
noncomputable def domBudget (N k : ℕ) : ℕ :=
3*(N/k+1)*⌈10*((N:ℝ)/(3*k))*Real.log (2*N)⌉₊
lemma component_degree (G : SimpleGraph V) [DecidableRel G.Adj] (v : V)
(w : (↑(G.connectedComponentMk v).supp.toFinset : Set V)) :
(G.induce (↑(G.connectedComponentMk v).supp.toFinset : Set V)).degree w = G.degree w.val := by
classical
have he : ((G.induce (↑(G.connectedComponentMk v).supp.toFinset : Set V)).neighborFinset w).image
Subtype.val = G.neighborFinset w.val := by
ext z
simp only [mem_image,mem_neighborFinset,induce_adj]
constructor
· rintro ⟨y,hy,rfl⟩
exact hy
· intro hz
have hw : w.val ∈ (G.connectedComponentMk v).supp := by simpa using w.property
have hy : z ∈ (G.connectedComponentMk v).supp.toFinset := by
simpa using (G.connectedComponentMk v).mem_supp_of_adj_mem_supp hw hz
exact ⟨⟨z,hy⟩,hz,rfl⟩
have hh := congrArg Finset.card he
rw [Finset.card_image_of_injective _ Subtype.val_injective] at hh
simpa only [card_neighborFinset_eq_degree] using hh
theorem clique_of_min_degree (N k q : ℕ) (hk : 0<k)
(V : Type) [Fintype V] [Nonempty V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hn : Fintype.card V ≤ N)
(hd : ∀ v, k+q*domBudget N k ≤ G.degree v) : HasCliqueMinor G (q+1) := by
classical
induction q generalizing V with
| zero => exact cliqueMinor_one G
| succ q ih =>
let v : V := Classical.arbitrary V
let C : Finset V := (G.connectedComponentMk v).supp.toFinset
let H := G.induce (↑C : Set V)
have hC : H.Connected := by
change (G.induce (↑(G.connectedComponentMk v).supp.toFinset : Set V)).Connected
erw [Set.coe_toFinset]
exact (G.connectedComponentMk v).connected_toSimpleGraph
have : Nonempty (↑C : Set V) := hC.nonempty
have hcard : Fintype.card (↑C : Set V) ≤ N := (Fintype.card_subtype_le _).trans hn
have hdeg : ∀ w : (↑C : Set V), k+(q+1)*domBudget N k ≤ H.degree w := by
intro w
have he : H.degree w = G.degree w.val := component_degree G v w
rw [he]
exact hd w.val
obtain ⟨D,hD,hdom,hsize⟩ := connected_dominating H hC hk hcard (fun w => by
rw [neighbors_univ,card_neighborFinset_eq_degree]
exact (Nat.le_add_right _ _).trans (hdeg w))
change D.card ≤ domBudget N k at hsize
have horder : D.card < Fintype.card (↑C : Set V) := by
obtain ⟨w⟩ := hC.nonempty
have hx := H.degree_lt_card_verts w
have hh := hdeg w
have hq : domBudget N k ≤ (q+1)*domBudget N k := by nlinarith
omega
have hR : (univ \ D).Nonempty := by
apply card_pos.mp
rw [card_sdiff_of_subset (subset_univ D),card_univ]
omega
have : Nonempty (↑(univ \ D) : Set (↑C : Set V)) := by
obtain ⟨w,hw⟩ := hR; exact ⟨⟨w,hw⟩⟩
have hdel : ∀ w : (↑(univ \ D) : Set (↑C : Set V)),
k+q*domBudget N k ≤ (H.induce (↑(univ \ D) : Set (↑C : Set V))).degree w := by
intro w
have hx := degree_delete H D w
have hh := hdeg w.val
rw [Nat.add_mul,one_mul] at hh
omega
have hm := ih (↑(univ \ D) : Set (↑C : Set V))
(H.induce (↑(univ \ D) : Set (↑C : Set V)))
((Fintype.card_subtype_le _).trans hcard) hdel
exact (model_induce G C).lift_clique (clique_successor H D hD hdom hm)
lemma log64_ge_one {x : ℝ} (hx : 1 ≤ x) : 1 ≤ Real.log (64*x) := by
have h2 := Real.one_sub_inv_le_log_of_pos (by norm_num : (0:ℝ)<2)
have h64 : (1:ℝ) ≤ Real.log 64 := by
have he : (64:ℝ)=2^6 := by norm_num
rw [he,Real.log_pow]
norm_num at h2 ⊢
linarith
exact h64.trans (Real.log_le_log (by norm_num) (by linarith))
lemma domBudget_bound {k : ℕ} (hk : 2≤k) :
(domBudget (32*k) (k/2) : ℝ) ≤ 100000*Real.log (64*k) := by
have hk' : 0<k/2 := by omega
have hratio : 32*k/(k/2) ≤96 := by
have hh := Nat.mod_lt k (by omega : 0<2)
have he := Nat.mod_add_div k 2
have hm : k ≤3*(k/2) := by omega
exact (Nat.div_le_iff_le_mul hk').mpr (by omega)
have hr : ((32*k:ℕ):ℝ)/(3*(k/2:ℕ)) ≤32 := by
have hm : k ≤3*(k/2) := by omega
apply (div_le_iff₀ (by positivity)).mpr
norm_num
exact_mod_cast hm
have hlog : 1 ≤ Real.log (64*k) := log64_ge_one (by exact_mod_cast (show 1≤k by omega))
have hval : 0 ≤ 10*(((32*k:ℕ):ℝ)/(3*(k/2:ℕ)))*Real.log (2*(32*k:ℕ)) := by
have he : (2*(32*k:ℕ):ℝ) = 64*k := by push_cast; ring
rw [he]; positivity
have hceil := Nat.ceil_lt_add_one hval
have he : (2*(32*k:ℕ):ℝ)=64*k := by push_cast; ring
rw [he] at hceil
have hv : 10*(((32*k:ℕ):ℝ)/(3*(k/2:ℕ)))*Real.log (64*k) ≤320*Real.log (64*k) :=
mul_le_mul_of_nonneg_right (by linarith) (by linarith)
have hb : (⌈10*(((32*k:ℕ):ℝ)/(3*(k/2:ℕ)))*Real.log (2*(32*k:ℕ))⌉₊:ℝ) ≤321*Real.log (64*k) := by
rw [he]
linarith
unfold domBudget
push_cast
have hrat : (32*k/(k/2):ℕ) + (1:ℝ) ≤97 := by exact_mod_cast (show 32*k/(k/2)+1≤97 by omega)
calc
_ ≤ 291*(321*Real.log (64*k)) := by
apply mul_le_mul
· linarith
· simpa only [Nat.cast_mul,Nat.cast_ofNat] using hb
· positivity
· norm_num
_ ≤ _ := by nlinarith
theorem core_size_obstruction (G : SimpleGraph V) {t : ℕ} (ht : 2≤t)
(hex : hadwigerNumber G < t) (hd : (16:ℚ)≤density G) :
∃ k : ℕ, 2≤k ∧ density G <8*(k+1) ∧
(k:ℝ)<200000*t*Real.log (64*k) := by
classical
obtain ⟨n,k,H,⟨M⟩,hc,hn,hden⟩ := small_minor_core G hd
have hk : 2≤k := by
by_contra hh
have hh : k≤1 := by omega
have hh' : (k:ℚ)≤1 := by exact_mod_cast hh
linarith
have hn' : 0<n := by have hh:=hc.1; simpa using (Nat.zero_le k).trans_lt hh
have : Nonempty (Fin n) := Fin.pos_iff_nonempty.mp hn'
have hdeg : ∀ v, k≤H.degree v := by
intro v
simpa only [neighbors_univ,card_neighborFinset_eq_degree] using min_degree H hc (mem_univ v)
have hnot : ¬ k/2+(t-1)*domBudget (32*k) (k/2) ≤ k := by
intro hh
have hm := clique_of_min_degree (32*k) (k/2) (t-1) (by omega) (Fin n) H
(by simpa using hn) (fun v => hh.trans (hdeg v))
have hle := cliqueMinor_le_hadwigerNumber (M.lift_clique hm)
omega
have hnat : k <2*t*domBudget (32*k) (k/2) := by
have hh := Nat.mod_lt k (by omega : 0<2)
have he := Nat.mod_add_div k 2
have htM : (t-1)*domBudget (32*k) (k/2) ≤ t*domBudget (32*k) (k/2) :=
Nat.mul_le_mul_right _ (by omega)
rw [Nat.mul_assoc]
omega
refine ⟨k,hk,hden,?_⟩
have hr : (k:ℝ)<2*t*(domBudget (32*k) (k/2):ℝ) := by exact_mod_cast hnat
have hb := domBudget_bound hk
nlinarith
lemma logarithmic_inversion {x t : ℝ} (hx : 1≤x) (ht : 2≤t)
(h : x<200000*t*Real.log (64*x)) : x<10400000*t*Real.log (2*t) := by
have hx0 : 0<x := by linarith
have ht0 : 0<t := by linarith
have hs0 : 0<Real.sqrt x := Real.sqrt_pos.mpr hx0
have hs1 : 1≤Real.sqrt x := by
have hh := Real.sqrt_le_sqrt hx
simpa using hh
have hsq : (Real.sqrt x)^2=x := Real.sq_sqrt (by linarith)
have hlog : Real.log (64*x) ≤8*Real.sqrt x := by
have h1 := Real.log_le_sub_one_of_pos hs0
rw [Real.log_sqrt (by linarith : 0≤x)] at h1
have h2 := Real.log_le_sub_one_of_pos (by norm_num : (0:ℝ)<2)
have he : (64:ℝ)=2^6 := by norm_num
rw [Real.log_mul (by norm_num) (ne_of_gt hx0),he,Real.log_pow]
norm_num at h2 ⊢
linarith
have hsl : Real.sqrt x<1600000*t := by
have hh := mul_le_mul_of_nonneg_left hlog (show 0≤200000*t by positivity)
nlinarith
have hxx : x<(1600000*t)^2 := by nlinarith
have hpow : 64*x≤(2:ℝ)^50*t^2 := by nlinarith [sq_nonneg t]
have hll := Real.log_le_log (show 0<64*x by positivity) hpow
rw [Real.log_mul (show (2:ℝ)^50≠0 by norm_num) (show t^2≠0 by positivity),Real.log_pow,Real.log_pow] at hll
have h2 : 0≤Real.log 2 := Real.log_nonneg (by norm_num)
have htt : 0≤Real.log t := Real.log_nonneg (by linarith)
have hl : Real.log (64*x) ≤52*Real.log (2*t) := by
rw [Real.log_mul (by norm_num) (ne_of_gt ht0)]
norm_num at hll
linarith
have hh := mul_le_mul_of_nonneg_left hl (show 0≤200000*t by positivity)
nlinarith
theorem density_bound (G : SimpleGraph V) {t : ℕ} (ht : 2≤t)
(hex : hadwigerNumber G<t) :
((density G : ℚ):ℝ) ≤100000000*t*Real.log (2*t) := by
classical
have htr : (2:ℝ)≤t := by exact_mod_cast ht
have hlog : 1≤Real.log (2*t) := by
have h2 := Real.one_sub_inv_le_log_of_pos (by norm_num : (0:ℝ)<2)
have h4 : (1:ℝ)≤Real.log 4 := by
have he : (4:ℝ)=2^2 := by norm_num
rw [he,Real.log_pow]
norm_num at h2 ⊢
linarith
exact h4.trans (Real.log_le_log (by norm_num) (by linarith))
by_cases hd : (16:ℚ)≤density G
· obtain ⟨k,hk,hden,hx⟩ := core_size_obstruction G ht hex hd
have hr := logarithmic_inversion (by exact_mod_cast (show 1≤k by omega)) htr hx
have hd' : ((density G:ℚ):ℝ)<8*((k:ℝ)+1) := by exact_mod_cast hden
have hh : (2:ℝ)≤(t:ℝ)*Real.log (2*t) := by nlinarith
nlinarith
· have hd' : ((density G:ℚ):ℝ)<16 := by exact_mod_cast (lt_of_not_ge hd)
nlinarith
lemma degree_induce_finset {V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (S : Finset V)
(v : (↑S : Set V)) : (G.induce (↑S : Set V)).degree v = (S.filter (G.Adj v.val)).card := by
classical
have he : ((G.induce (↑S : Set V)).neighborFinset v).image Subtype.val = S.filter (G.Adj v.val) := by
ext w
simp only [mem_image,mem_neighborFinset,induce_adj,mem_filter]
constructor
· rintro ⟨u,hu,rfl⟩
exact ⟨u.property,hu⟩
· rintro ⟨hw,hvw⟩
exact ⟨⟨w,hw⟩,hvw,rfl⟩
have hh := congrArg Finset.card he
rw [Finset.card_image_of_injective _ Subtype.val_injective,card_neighborFinset_eq_degree] at hh
exact hh
theorem coarse_list_bound (G : SimpleGraph V) {t : ℕ} (ht : 2≤t)
(hex : hadwigerNumber G<t) :
listChromaticNumber G ≤ ⌊200000000*t*Real.log (2*t)⌋₊+1 := by
classical
apply listChromaticNumber_le_of_degenerate
intro S _ hS
have : Nonempty (↑S : Set V) := by obtain ⟨v,hv⟩ := hS; exact ⟨⟨v,hv⟩⟩
let H := G.induce (↑S : Set V)
have hm : hadwigerNumber H ≤ hadwigerNumber G :=
cliqueMinor_le_hadwigerNumber ((model_induce G S).lift_clique (hasCliqueMinor_hadwigerNumber H))
have hd := density_bound H ht (hm.trans_lt hex)
obtain ⟨v,hv⟩ := degree_le_twice_density H Fintype.card_pos
have hv' : (H.degree v : ℝ) ≤2*((density H:ℚ):ℝ) := by exact_mod_cast hv
have hdeg : (H.degree v : ℝ) ≤200000000*t*Real.log (2*t) := by nlinarith
refine ⟨v.val,v.property,?_⟩
rw [←degree_induce_finset G S v]
exact Nat.le_floor hdeg
end LinearListHadwiger.CoarseDensity
end OAI

Xet Storage Details

Size:
17 kB
·
Xet hash:
ead079bf670804de700cba422bf6c4db86cfb3c6dea38ee3cd8abeca4e8e18e7

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.