graph_iso_odd_components_card
A finite graph isomorphism preserves the number of odd connected components.
Statement
theorem graph_iso_odd_components_card {V W : Type*} [Fintype V] [Fintype W] (G : SimpleGraph V) (H : SimpleGraph W) (e : G ≃g H) : G.oddComponents.ncard = H.oddComponents.ncard
- Source
- Balanced-cut k=7 reduction for OP-1957; https://arxiv.org/abs/2611.22690.
- Verified
- 26 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- is_k_extendableFor a finite vertex type V (with [Fintype V]), a simple graph G : SimpleGraph V and k : ℕ, is_k_extendable G k is the Prop that is the…
- Used by 4
- extendible_essential_edge_ambient_odd_shoresFor an essential edge xy of a k-extendible graph on 4k vertices, there are disjoint ambient vertex sets X, Y and U and a natural number s:…
- induced_subgraph_barrier_liftA barrier in an induced graph maps to an ambient barrier of the same size, preserving the odd-component count after deletion.
- op1957_factorcritical_block_ambient_odd_components_boundIn a finite factor-critical induced block, odd components of an ambient subset anticomplete to the rest of a containing set are bounded by…
- boundary_saturated_block_factorcritical_opposite_cross_removableUnder the displayed four-block, saturation, separator, and degree hypotheses, if A has at least three vertices, B is factor-critical and…
The proof, explained
The graph isomorphism induces a bijection between the connected components of G and those of H. Because the isomorphism restricts to a bijection between the vertex sets of corresponding components, each component has the same number of vertices as its image, preserving oddness. Thus, the bijection maps the odd components of G onto the odd components of H, showing that both graphs have the same number of odd components.
Let f be the bijection between the connected components of G and the connected components of H induced by the isomorphism e.
The graph isomorphism e induces an equivalence f between the connected components of G and those of H (e.connectedComponentEquiv).
set_option maxHeartbeats 4000000 in classical let f := e.connectedComponentEquiv
A connected component c of G has an odd number of vertices if and only if f(c) has an odd number of vertices in H.
For any component c of G, the isomorphism e restricts to a bijection between the vertex sets of c and f(c) (SimpleGraph.ConnectedComponent.isoEquivSupp). By Nat.card_congr (and using Nat.card_coe_set_eq to relate subtype and set cardinalities), their vertex sets have equal cardinality. Since being an odd component means that this cardinality is odd, c is odd in G if and only if f(c) is odd in H.
uses
Nat.card_coe_set_eq,Nat.card_congr,SimpleGraph.ConnectedComponent.isoEquivSupphave hf : ∀ c : G.ConnectedComponent, c ∈ G.oddComponents ↔ f c ∈ H.oddComponents := by intro c have hc : c.supp.ncard = (f c).supp.ncard := by rw [← Nat.card_coe_set_eq,← Nat.card_coe_set_eq] exact Nat.card_congr (SimpleGraph.ConnectedComponent.isoEquivSupp e c) change Odd c.supp.ncard ↔ Odd (f c).supp.ncard rw [hc]
The image under f of the set of odd components of G is precisely the set of odd components of H.
We check both set inclusions. If a component of H has the form f(x) for an odd component x of G, it is odd by the forward direction of the equivalence proved in the previous step. Conversely, if c is an odd component of H, its preimage f⁻¹(c) is an odd component of G by the reverse direction, and f(f⁻¹(c)) = c.
have himage : f '' G.oddComponents = H.oddComponents := by ext c constructor · rintro ⟨x,hx,rfl⟩ exact (hf x).mp hx · intro hc refine ⟨f.symm c,?_,by simp⟩ apply (hf (f.symm c)).mpr simpa using hc
The number of odd components of G equals the number of odd components of H.
Since H.oddComponents is the image f '' G.oddComponents and f is injective (being an equivalence), the set cardinalities coincide by Set.ncard_image_of_injective.
uses
Set.ncard_image_of_injectiverw [← himage,Set.ncard_image_of_injective _ f.injective]
Nat.card_coe_set_eq- The cardinality of a set s viewed as a subtype equals the set cardinality s.ncard.
Nat.card_congr- A bijection between two types implies that their cardinalities are equal.
SimpleGraph.ConnectedComponent.isoEquivSupp- A graph isomorphism restricts to a bijection between the vertex support of any connected component and the vertex support of its image component.
Set.ncard_image_of_injective- An injective map preserves the cardinality of any set under its forward image.
- Line 11 uses Nat.card_coe_set_eq to convert between the set cardinality s.ncard and the type cardinality Nat.card ↑s of the subtype, a formal distinction that has no counterpart in informal mathematics.
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 graph_iso_odd_components_card {V W : Type*} [Fintype V] [Fintype W] (G : SimpleGraph V) (H : SimpleGraph W) (e : G ≃g H) : G.oddComponents.ncard = H.oddComponents.ncard := by set_option maxHeartbeats 4000000 in classical let f := e.connectedComponentEquiv have hf : ∀ c : G.ConnectedComponent, c ∈ G.oddComponents ↔ f c ∈ H.oddComponents := by intro c have hc : c.supp.ncard = (f c).supp.ncard := by rw [← Nat.card_coe_set_eq,← Nat.card_coe_set_eq] exact Nat.card_congr (SimpleGraph.ConnectedComponent.isoEquivSupp e c) change Odd c.supp.ncard ↔ Odd (f c).supp.ncard rw [hc] have himage : f '' G.oddComponents = H.oddComponents := by ext c constructor · rintro ⟨x,hx,rfl⟩ exact (hf x).mp hx · intro hc refine ⟨f.symm c,?_,by simp⟩ apply (hf (f.symm c)).mpr simpa using hc rw [← himage,Set.ncard_image_of_injective _ f.injective]