simple_graph_components_le_clique_cover
If the vertices of a finite graph are covered by m cliques, then the graph has at most m connected components.
Statement
theorem simple_graph_components_le_clique_cover {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (m : ℕ) (T : Fin m → Finset V) (hcover : ∀ v, ∃ i, v ∈ T i) (hclique : ∀ i, ∀ u ∈ T i, ∀ v ∈ T i, u ≠ v → G.Adj u v) : Nat.card G.ConnectedComponent ≤ m
- Source
- OP-1957: component bound for a clique cover.
- Verified
- 22 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- Arena.Reachable.transReachability is transitive.
The proof, explained
The proof establishes that the number of connected components is at most m by constructing an injective map f from the connected components to the m clique indices {0, ..., m - 1}. Each connected component is nonempty and thus contains a vertex, which in turn belongs to some covering clique; f chooses such an index for each component. If two components map to the same index, their witness vertices lie in that common clique and are therefore reachable from each other (either identical or adjacent), forcing the two components to coincide. Injectivity then implies that the number of components is at most the cardinality of Fin m, which is m.
Every connected component contains a vertex belonging to at least one of the covering cliques.
Enabling classical logic, we take an arbitrary connected component c. Because the support of any connected component is nonempty, there is some vertex v in c. Since the family of cliques covers the vertex set of the graph, v belongs to some clique T i, providing a vertex in both c and T i.
classical have hex : ∀ c : G.ConnectedComponent, ∃ i, ∃ v ∈ T i, v ∈ c.supp := by intro c obtain ⟨v,hv⟩ := c.nonempty_supp obtain ⟨i,hi⟩ := hcover v exact ⟨i,v,hi,hv⟩
There is a function f assigning to each connected component a clique index whose clique intersects that component.
Using the axiom of choice (Classical.choose), we define f(c) for each component c to be a clique index i ∈ {0, ..., m - 1} that contains a vertex of c. By Classical.choose_spec, there is indeed a vertex belonging to both T (f c) and the component c.
uses
Classical.choose,Classical.choose_speclet f : G.ConnectedComponent → Fin m := fun c => Classical.choose (hex c) have hf (c : G.ConnectedComponent) : ∃ v ∈ T (f c), v ∈ c.supp := Classical.choose_spec (hex c)
The assignment f from connected components to clique indices is injective.
Assume f c = f d for two components c and d. Let v ∈ c ∩ T (f c) and w ∈ d ∩ T (f d) be their witness vertices. Since f c = f d, both v and w belong to the clique T (f c). If v = w, they are trivially reachable from each other (SimpleGraph.Reachable.rfl). If v ≠ w, they are adjacent because T (f c) is a clique, and adjacent vertices are reachable. Since v and w are reachable, they belong to the same connected component (SimpleGraph.ConnectedComponent.eq.mpr). Because v ∈ c and w ∈ d mean that c and d are the components containing v and w respectively (SimpleGraph.ConnectedComponent.mem_supp_iff), it follows that c = d.
uses
SimpleGraph.Reachable.rfl,SimpleGraph.ConnectedComponent.eq.mpr,SimpleGraph.ConnectedComponent.mem_supp_iffhave hinj : Function.Injective f := by intro c d hcd obtain ⟨v,hvT,hvc⟩ := hf c obtain ⟨w,hwT,hwd⟩ := hf d have hwT' : w ∈ T (f c) := by rw [hcd]; exact hwT have hreach : G.Reachable v w := by by_cases h : v = w · subst w exact SimpleGraph.Reachable.rfl · exact (hclique (f c) v hvT w hwT' h).reachable have heq : G.connectedComponentMk v = G.connectedComponentMk w := SimpleGraph.ConnectedComponent.eq.mpr hreach rw [SimpleGraph.ConnectedComponent.mem_supp_iff] at hvc hwd exact hvc.symm.trans (heq.trans hwd)
The number of connected components of the graph is at most m.
The injective map f from connected components into Fin m implies that the cardinality of the component type is bounded by the cardinality of Fin m (Nat.card_le_card_of_injective). Simplifying this bound using |Fin m| = m yields the final inequality.
uses
Nat.card_le_card_of_injectivehave h := Nat.card_le_card_of_injective f hinj simpa using h
Classical.choose- Given an existential statement ∃ x, p x, returns an element x satisfying p.
Classical.choose_spec- The element selected by Classical.choose satisfies the given predicate p.
SimpleGraph.Reachable.rfl- Reachability in a graph is reflexive: every vertex is reachable from itself.
SimpleGraph.ConnectedComponent.eq.mpr- If two vertices are reachable from one another in a graph, they belong to the same connected component.
SimpleGraph.ConnectedComponent.mem_supp_iff- A vertex belongs to the support of a connected component if and only if that component is the one containing the vertex.
Nat.card_le_card_of_injective- An injective map from a type to a finite type implies that the cardinality of the domain is at most the cardinality of the codomain.
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 simple_graph_components_le_clique_cover {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (m : ℕ) (T : Fin m → Finset V) (hcover : ∀ v, ∃ i, v ∈ T i) (hclique : ∀ i, ∀ u ∈ T i, ∀ v ∈ T i, u ≠ v → G.Adj u v) : Nat.card G.ConnectedComponent ≤ m := by classical have hex : ∀ c : G.ConnectedComponent, ∃ i, ∃ v ∈ T i, v ∈ c.supp := by intro c obtain ⟨v,hv⟩ := c.nonempty_supp obtain ⟨i,hi⟩ := hcover v exact ⟨i,v,hi,hv⟩ let f : G.ConnectedComponent → Fin m := fun c => Classical.choose (hex c) have hf (c : G.ConnectedComponent) : ∃ v ∈ T (f c), v ∈ c.supp := Classical.choose_spec (hex c) have hinj : Function.Injective f := by intro c d hcd obtain ⟨v,hvT,hvc⟩ := hf c obtain ⟨w,hwT,hwd⟩ := hf d have hwT' : w ∈ T (f c) := by rw [hcd]; exact hwT have hreach : G.Reachable v w := by by_cases h : v = w · subst w exact SimpleGraph.Reachable.rfl · exact (hclique (f c) v hvT w hwT' h).reachable have heq : G.connectedComponentMk v = G.connectedComponentMk w := SimpleGraph.ConnectedComponent.eq.mpr hreach rw [SimpleGraph.ConnectedComponent.mem_supp_iff] at hvc hwd exact hvc.symm.trans (heq.trans hwd) have h := Nat.card_le_card_of_injective f hinj simpa using h