op309_uniform_role_structure_bipartite
If adjacent vertices have different roles 0, 1, 2 and every role-zero vertex has a uniform neighbor role, then the graph is bipartite.
Statement
theorem op309_uniform_role_structure_bipartite {V : Type*} (G : SimpleGraph V) (d : V → ℕ) (hbound : ∀ v, d v ≤ 2) (hdiff : ∀ u v, G.Adj u v → d u ≠ d v) (hhom : ∀ u v w, d u = 0 → G.Adj u v → G.Adj u w → d v = d w) : G.IsBipartite
- Source
- OP-309 analysis of uniform P3 hosts and their nonbipartite obstruction, experiments 42483–42485.
- Verified
- 28 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- OrderAn order of dimension d is a permutation of the attribute set {0, ..., d-1}, represented as a list without duplicates containing all…
- Used by 1
- op309_bipartite_eighteen_uniform_p3_host_selection_impossibleThe previously recorded connected cubic girth-six bipartite 18-vertex graph has no uniform-host selected P3 forest.
The proof, explained
The proof shows that G is bipartite by constructing an explicit bipartition (S, Sᶜ). The set S is defined to contain all vertices of role 2 and all role-0 vertices that have a role-1 neighbor. Because all neighbors of any role-0 vertex must have the identical role, any role-0 vertex with a role-2 neighbor cannot have a role-1 neighbor, placing it strictly in Sᶜ. Finally, a case analysis over all six possible role pairs for an edge verifies that every edge has one endpoint in S and the other in Sᶜ.
Define a candidate bipartite partition S and its complement.
Working under classical logic, define S ⊆ V as the set of vertices v such that either d(v) = 2, or d(v) = 0 and v has at least one neighbor w with d(w) = 1. The candidate bipartition of G is the pair (S, Sᶜ).
classical let S : Set V := {v | d v = 2 ∨ (d v = 0 ∧ ∃ w, G.Adj v w ∧ d w = 1)}Every vertex with role 2 belongs to S.
If d(v) = 2, the condition d(v) = 2 directly satisfies the first disjunct in the definition of S via Or.inl.
uses
Or.inlhave center_in {v : V} (hv : d v = 2) : v ∈ S := by change d v = 2 ∨ (d v = 0 ∧ ∃ w, G.Adj v w ∧ d w = 1) exact Or.inl hv
Every vertex with role 1 does not belong to S.
If d(v) = 1, then d(v) ≠ 2 and d(v) ≠ 0. Thus neither disjunct defining S can hold, which simp simplifies to false.
have leaf_out {v : V} (hv : d v = 1) : v ∉ S := by change ¬ (d v = 2 ∨ (d v = 0 ∧ ∃ w, G.Adj v w ∧ d w = 1)) simp [hv]
Every role-0 vertex with a role-1 neighbor belongs to S.
If d(v) = 0 and v is adjacent to some w with d(w) = 1, then the second disjunct in the definition of S is satisfied by the witness w via Or.inr.
uses
Or.inrhave empty_in {v w : V} (hv : d v = 0) (hvw : G.Adj v w) (hw : d w = 1) : v ∈ S := by change d v = 2 ∨ (d v = 0 ∧ ∃ w, G.Adj v w ∧ d w = 1) exact Or.inr ⟨hv, w, hvw, hw⟩
Every role-0 vertex with a role-2 neighbor does not belong to S.
Assume for contradiction that such a vertex v is in S. Then either d(v) = 2 (which contradicts d(v) = 0), or v has a neighbor z with d(z) = 1. But the hypothesis hhom states that all neighbors of a role-0 vertex have the same role, so d(z) = d(w). Since d(z) = 1 and d(w) = 2, this yields 1 = 2, a contradiction.
have empty_out {v w : V} (hv : d v = 0) (hvw : G.Adj v w) (hw : d w = 2) : v ∉ S := by change ¬ (d v = 2 ∨ (d v = 0 ∧ ∃ w, G.Adj v w ∧ d w = 1)) rintro (h | ⟨_, z, hvz, hz⟩) · omega · have heq := hhom v z w hv hvz hvw omega
To show that G is bipartite, it suffices to show that every edge connects S and Sᶜ.
Applying SimpleGraph.IsBipartiteWith.isBipartite with s = S and t = Sᶜ, bipartiteness requires two conditions: that S and Sᶜ are disjoint, and that every adjacent pair of vertices has one endpoint in S and the other in Sᶜ. The disjointness goal is discharged immediately by disjoint_compl_right.
uses
SimpleGraph.IsBipartiteWith.isBipartite,disjoint_compl_rightapply SimpleGraph.IsBipartiteWith.isBipartite (s := S) (t := Sᶜ) constructor · exact disjoint_compl_right
For any edge {v, w}, the role pair (d(v), d(w)) is one of the six ordered pairs of distinct values from {0, 1, 2}.
Let v and w be adjacent vertices. Since roles are bounded by 2 (hbound) and adjacent vertices cannot share the same role (hdiff), linear integer arithmetic (omega) exhausts all possibilities: (d(v), d(w)) must be one of (0, 1), (0, 2), (1, 0), (1, 2), (2, 0), or (2, 1).
· intro v w hvw have hv := hbound v have hw := hbound w have hne := hdiff v w hvw have hc : (d v = 0 ∧ d w = 1) ∨ (d v = 0 ∧ d w = 2) ∨ (d v = 1 ∧ d w = 0) ∨ (d v = 1 ∧ d w = 2) ∨ (d v = 2 ∧ d w = 0) ∨ (d v = 2 ∧ d w = 1) := by omega
Every edge connects a vertex in S to a vertex in Sᶜ, completing the proof.
We check the six possible cases for the role values (d(v), d(w)): - (0, 1): v ∈ S (by empty_in) and w ∈ Sᶜ (by leaf_out). - (0, 2): v ∈ Sᶜ (by empty_out) and w ∈ S (by center_in). - (1, 0): v ∈ Sᶜ (by leaf_out) and w ∈ S (by empty_in, using symmetry of adjacency). - (1, 2): v ∈ Sᶜ (by leaf_out) and w ∈ S (by center_in). - (2, 0): v ∈ S (by center_in) and w ∈ Sᶜ (by empty_out, using symmetry of adjacency). - (2, 1): v ∈ S (by center_in) and w ∈ Sᶜ (by leaf_out). In every case, one endpoint is in S and the other is in Sᶜ.
uses
Or.inl,Or.inrrcases hc with ⟨a,b⟩ | ⟨a,b⟩ | ⟨a,b⟩ | ⟨a,b⟩ | ⟨a,b⟩ | ⟨a,b⟩ · exact Or.inl ⟨empty_in a hvw b, leaf_out b⟩ · exact Or.inr ⟨empty_out a hvw b, center_in b⟩ · exact Or.inr ⟨leaf_out a, empty_in b hvw.symm a⟩ · exact Or.inr ⟨leaf_out a, center_in b⟩ · exact Or.inl ⟨center_in a, empty_out b hvw.symm a⟩ · exact Or.inl ⟨center_in a, leaf_out b⟩
Or.inl- From a proof of `a`, concludes the disjunction `a ∨ b`.
Or.inr- From a proof of `b`, concludes the disjunction `a ∨ b`.
SimpleGraph.IsBipartiteWith.isBipartite- If a simple graph is bipartite with parts `s` and `t`, then it is bipartite.
disjoint_compl_right- Any set and its complement are disjoint.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem op309_uniform_role_structure_bipartite {V : Type*} (G : SimpleGraph V) (d : V → ℕ) (hbound : ∀ v, d v ≤ 2) (hdiff : ∀ u v, G.Adj u v → d u ≠ d v) (hhom : ∀ u v w, d u = 0 → G.Adj u v → G.Adj u w → d v = d w) : G.IsBipartite := by classical let S : Set V := {v | d v = 2 ∨ (d v = 0 ∧ ∃ w, G.Adj v w ∧ d w = 1)} have center_in {v : V} (hv : d v = 2) : v ∈ S := by change d v = 2 ∨ (d v = 0 ∧ ∃ w, G.Adj v w ∧ d w = 1) exact Or.inl hv have leaf_out {v : V} (hv : d v = 1) : v ∉ S := by change ¬ (d v = 2 ∨ (d v = 0 ∧ ∃ w, G.Adj v w ∧ d w = 1)) simp [hv] have empty_in {v w : V} (hv : d v = 0) (hvw : G.Adj v w) (hw : d w = 1) : v ∈ S := by change d v = 2 ∨ (d v = 0 ∧ ∃ w, G.Adj v w ∧ d w = 1) exact Or.inr ⟨hv, w, hvw, hw⟩ have empty_out {v w : V} (hv : d v = 0) (hvw : G.Adj v w) (hw : d w = 2) : v ∉ S := by change ¬ (d v = 2 ∨ (d v = 0 ∧ ∃ w, G.Adj v w ∧ d w = 1)) rintro (h | ⟨_, z, hvz, hz⟩) · omega · have heq := hhom v z w hv hvz hvw omega apply SimpleGraph.IsBipartiteWith.isBipartite (s := S) (t := Sᶜ) constructor · exact disjoint_compl_right · intro v w hvw have hv := hbound v have hw := hbound w have hne := hdiff v w hvw have hc : (d v = 0 ∧ d w = 1) ∨ (d v = 0 ∧ d w = 2) ∨ (d v = 1 ∧ d w = 0) ∨ (d v = 1 ∧ d w = 2) ∨ (d v = 2 ∧ d w = 0) ∨ (d v = 2 ∧ d w = 1) := by omega rcases hc with ⟨a,b⟩ | ⟨a,b⟩ | ⟨a,b⟩ | ⟨a,b⟩ | ⟨a,b⟩ | ⟨a,b⟩ · exact Or.inl ⟨empty_in a hvw b, leaf_out b⟩ · exact Or.inr ⟨empty_out a hvw b, center_in b⟩ · exact Or.inr ⟨leaf_out a, empty_in b hvw.symm a⟩ · exact Or.inr ⟨leaf_out a, center_in b⟩ · exact Or.inl ⟨center_in a, empty_out b hvw.symm a⟩ · exact Or.inl ⟨center_in a, leaf_out b⟩