/-
Copyright 2026 The Formal Conjectures Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/
import FormalConjecturesUtilWritten on the Wall II - Conjecture 109
namespace WrittenOnTheWallII.GraphConjecture109
open Classical SimpleGraph
WOWII Conjecture 109
For a simple connected graph $G$, the independence number $\alpha(G)$ was conjectured to satisfy $\alpha(G) \le \lfloor (\mathrm{residue}(G) + 2 \cdot b(G)) / 3 \rfloor$, where $\mathrm{residue}(G)$ is the Havel--Hakimi residue and $b(G)$ is the size of a largest induced bipartite subgraph.
This is false. A connected graph on 21 vertices has an independent set of size 15, residue 8, and no induced bipartite subgraph with more than 18 vertices, so the conjectured right-hand side is at most 14.
@[category research solved, AMS 5,
formal_proof using formal_conjectures at "https://github.com/DomTheDeveloper/formal-conjectures/blob/cf59008ef1cd432bf9803275dcf5d62ab1f094a3/FormalConjectures/WrittenOnTheWallII/GraphConjecture109.lean"]
theorem conjecture109 : answer(False) ↔
∀ (α : Type) [Fintype α] [DecidableEq α] [Nontrivial α]
(G : SimpleGraph α) [DecidableRel G.Adj] (_h : G.Connected),
(G.indepNum : ℝ) ≤ ⌊((residue G : ℝ) + 2 * b G) / 3⌋ := ⊢ False ↔
∀ (α : Type) [inst : Fintype α] [DecidableEq α] [Nontrivial α] (G : SimpleGraph α) [inst_3 : DecidableRel G.Adj],
G.Connected → ↑α(G) ≤ ↑⌊(↑G.residue + 2 * G.b) / 3⌋
All goals completed! 🐙
-- Sanity checks
/-- The invariant `b G` is nonneg (cast of a natural number). -/
@[category test, AMS 5]
example (G : SimpleGraph (Fin 3)) : 0 ≤ b G := Nat.cast_nonneg _
/-- The residue of $K_2$ equals $1$: degree sequence is $[1, 1]$; one Havel-Hakimi
step gives $[0]$, leaving a single zero. -/
@[category test, AMS 5]
example : residue (⊤ : SimpleGraph (Fin 2)) = 1 := ⊢ ⊤.residue = 1
⊢ residueAux ((Multiset.map (fun v => ⊤.degree v) Finset.univ.val).sort fun x1 x2 => x1 ≥ x2) = 1
All goals completed! 🐙
end WrittenOnTheWallII.GraphConjecture109