AFTD Auto-Formalizing Theoretical Domains

op_2378_petersen_even_factor_two_odd

theoremverified

There is an even factor of the witness graph with exactly two odd components.

Statement

theorem op_2378_petersen_even_factor_two_odd :
    ∃ H : SimpleGraph (Fin 10), is_even_factor op_2378_petersen_graph H ∧ H.oddComponents.ncard = 2
Source
step towards op_2378_partial_r_two
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 5
  • op_2378_petersen_graphThe Petersen graph on Fin 10, the graph whose edge set is op_2378_petersen_edges.
  • op_2378_petersen_graph_basicThe witness graph has exactly the 15 listed edges and is cubic: every vertex has exactly 3 neighbours.
  • is_even_factorAn even factor of a finite simple graph $G$ is a spanning subgraph $H$ of $G$ such that every vertex has even degree in $H$.
  • op_2378_petersen_edgesThe 15-edge list of the Petersen graph on Fin 10: outer 5-cycle 0-1-2-3-4, inner 5-cycle 5-7-9-6-8, spokes 05,16,27,38,49.
  • Arena.Reachable.transReachability is transitive.
Used by 2

The proof, explained

The proof demonstrates that the Petersen graph has an even factor with exactly two odd components by constructing an explicit subgraph H. This subgraph is the 2-factor formed by two disjoint 5-cycles: the outer pentagon on vertices {0,1,2,3,4} and the inner star on vertices {5,6,7,8,9}. Finite exhaustion (`decide`) confirms that H is a subgraph of the Petersen graph and that every vertex has degree 2 (hence even). Furthermore, no edges cross between the two 5-vertex sets while each set is connected, so the graph has precisely two connected components, each of size 5. Because 5 is odd, both are odd components, yielding exactly two odd components.

  1. Adjacency in the witness graph `in1203w_H` is characterized by membership of the pair in `in1203w_edges` and distinctness of the vertices.

    Unfolding the definition of `in1203w_H` as the graph induced by `in1203w_edges` via `SimpleGraph.fromEdgeSet_adj` and converting set membership to finset membership with `Finset.mem_coe` proves the adjacency equivalence.

    line 8

    uses SimpleGraph.fromEdgeSet_adj, Finset.mem_coe

      simp only [in1203w_H, SimpleGraph.fromEdgeSet_adj, Finset.mem_coe]
  2. If a vertex set S is closed under adjacency in a graph H, then reachability preserves membership in S.

    Let u and v be reachable, with u ∈ S. There is a walk p from u to v. We proceed by induction on p: if p is the empty walk, u = v and thus v ∈ S. If p begins with an edge from the current vertex to a neighbor, the adjacency closure hypothesis hS guarantees that the neighbor also belongs to S, and the induction hypothesis completes the step.

    lines 13–16

      obtain ⟨p⟩ := h
      induction p with
      | nil => exact hu
      | cons ha _ ih => exact ih (hS _ _ ha hu)
  3. The existence claim reduces to showing that the candidate graph `in1203w_H` is a subgraph of the Petersen graph, that every vertex in it has even degree, and that it has exactly two odd components.

    We provide the subgraph `in1203w_H` as an explicit witness. The goal splits into three subgoals: subgraph inclusion (H ≤ G), even degree at every vertex (making H an even factor), and the cardinality of odd components being 2.

    line 21

      refine ⟨in1203w_H, ⟨?_, ?_⟩, ?_⟩
  4. `in1203w_H` is a subgraph of the Petersen graph.

    Unfolding the adjacency relations for `in1203w_H` and the Petersen graph reduces the claim to verifying that each of the 10 edges in `in1203w_edges` belongs to `op_2378_petersen_edges`. Since the vertex set `Fin 10` is finite, this check is carried out by finite exhaustion using `decide`.

    lines 22–27

    uses in1203w_adj, SimpleGraph.fromEdgeSet_adj, Finset.mem_coe

      · intro x y h
        rw [in1203w_adj] at h
        simp only [op_2378_petersen_graph, SimpleGraph.fromEdgeSet_adj, Finset.mem_coe]
        revert h
        revert x y
        decide
  5. Every vertex in `in1203w_H` has even degree.

    For each vertex v, its neighbor set is characterized as the set of vertices w ≠ v adjacent to v via an edge in `in1203w_edges`. Rewriting this as the cardinality of a filtered finite set allows `decide` to evaluate the degree for all 10 vertices by finite exhaustion, verifying that each degree is even (each vertex has degree 2).

    lines 28–36

    uses SimpleGraph.mem_neighborSet, in1203w_adj, Set.mem_setOf_eq, Nat.card_coe_set_eq, Set.ncard_eq_toFinset_card', Set.toFinset_ofPred

      · intro v
        have e : in1203w_H.neighborSet v = {w | s(v, w) ∈ in1203w_edges ∧ v ≠ w} := by
          ext w
          simp only [SimpleGraph.mem_neighborSet, in1203w_adj, Set.mem_setOf_eq]
        rw [e, Nat.card_coe_set_eq, Set.ncard_eq_toFinset_card']
        simp only [Set.toFinset_ofPred]
        clear e
        revert v
        decide
  6. No edge in `in1203w_H` connects a vertex in {0,1,2,3,4} to a vertex in {5,6,7,8,9}.

    We prove two closure properties: if an edge connects u and v and u < 5, then v < 5 (`c0`); similarly, if u ≥ 5, then v ≥ 5 (`c1`). Both implications over all pairs of vertices in `Fin 10` are verified by finite exhaustion (`decide`).

    lines 37–50

    uses in1203w_adj, Set.mem_setOf_eq

      · have c0 : ∀ u v, in1203w_H.Adj u v → u ∈ {x : Fin 10 | x.val < 5} → v ∈ {x : Fin 10 | x.val < 5} := by
          intro u v h
          rw [in1203w_adj] at h
          simp only [Set.mem_setOf_eq]
          revert h
          revert u v
          decide
        have c1 : ∀ u v, in1203w_H.Adj u v → u ∈ {x : Fin 10 | 5 ≤ x.val} → v ∈ {x : Fin 10 | 5 ≤ x.val} := by
          intro u v h
          rw [in1203w_adj] at h
          simp only [Set.mem_setOf_eq]
          revert h
          revert u v
          decide
  7. All vertices in {0,1,2,3,4} are reachable from 0, and all vertices in {5,6,7,8,9} are reachable from 5.

    Adjacent vertices are reachable (`r`). By case analysis on all vertices of `Fin 10`, vertices v < 5 are connected to 0 along paths of the outer 5-cycle (0–1–2 and 0–4–3), establishing `r0`. Likewise, vertices v ≥ 5 are connected to 5 along paths of the inner 5-cycle (5–8–6 and 5–7–9), establishing `r5`.

    lines 51–68

    uses in1203w_adj

        have r : ∀ a b : Fin 10, s(a, b) ∈ in1203w_edges → a ≠ b → in1203w_H.Reachable a b :=
          fun a b h hne => ((in1203w_adj a b).2 ⟨h, hne⟩).reachable
        have r0 : ∀ v : Fin 10, v.val < 5 → in1203w_H.Reachable 0 v := by
          intro v hv
          fin_cases v <;> simp at hv
          · rfl
          · exact r 0 1 (by decide) (by decide)
          · exact (r 0 1 (by decide) (by decide)).trans (r 1 2 (by decide) (by decide))
          · exact (r 0 4 (by decide) (by decide)).trans (r 4 3 (by decide) (by decide))
          · exact r 0 4 (by decide) (by decide)
        have r5 : ∀ v : Fin 10, 5 ≤ v.val → in1203w_H.Reachable 5 v := by
          intro v hv
          fin_cases v <;> simp at hv
          · rfl
          · exact (r 5 8 (by decide) (by decide)).trans (r 8 6 (by decide) (by decide))
          · exact r 5 7 (by decide) (by decide)
          · exact r 5 8 (by decide) (by decide)
          · exact (r 5 7 (by decide) (by decide)).trans (r 7 9 (by decide) (by decide))
  8. The connected component of 0 is {x | x < 5}, and the connected component of 5 is {x | 5 ≤ x}.

    A vertex v belongs to the component of 0 if and only if v and 0 are mutually reachable. If v ≥ 5, reachability to 0 would contradict the closure of {x | 5 ≤ x} under adjacency (`in1203w_closed`), so v < 5. The converse holds by `r0`. Symmetrically, using `c0` and `r5`, the component of 5 is exactly {x | 5 ≤ x}.

    lines 69–88

    uses SimpleGraph.ConnectedComponent.mem_supp_iff, SimpleGraph.ConnectedComponent.eq, in1203w_closed

        have s0 : (in1203w_H.connectedComponentMk 0).supp = {x : Fin 10 | x.val < 5} := by
          ext v
          rw [SimpleGraph.ConnectedComponent.mem_supp_iff, SimpleGraph.ConnectedComponent.eq]
          constructor
          · intro h
            by_contra hv
            have := in1203w_closed _ c1 h (by simp at hv ⊢; omega)
            simp at this
          · intro hv
            exact (r0 v hv).symm
        have s5 : (in1203w_H.connectedComponentMk 5).supp = {x : Fin 10 | 5 ≤ x.val} := by
          ext v
          rw [SimpleGraph.ConnectedComponent.mem_supp_iff, SimpleGraph.ConnectedComponent.eq]
          constructor
          · intro h
            by_contra hv
            have := in1203w_closed _ c0 h (by simp at hv ⊢; omega)
            simp at this
          · intro hv
            exact (r5 v hv).symm
  9. Both components have odd cardinality 5, and they are distinct.

    Converting the sets to finite sets and counting their elements (`decide`) shows that both {x | x < 5} and {x | 5 ≤ x} have cardinality 5. If the component of 0 were equal to the component of 5, 0 and 5 would be mutually reachable (`SimpleGraph.ConnectedComponent.exact`), contradicting the closure of {x | x < 5} under adjacency (`in1203w_closed`).

    lines 89–99

    uses Set.ncard_eq_toFinset_card', SimpleGraph.ConnectedComponent.exact, in1203w_closed

        have n0 : ({x : Fin 10 | x.val < 5} : Set (Fin 10)).ncard = 5 := by
          rw [Set.ncard_eq_toFinset_card']
          decide
        have n5 : ({x : Fin 10 | 5 ≤ x.val} : Set (Fin 10)).ncard = 5 := by
          rw [Set.ncard_eq_toFinset_card']
          decide
        have hne : in1203w_H.connectedComponentMk 0 ≠ in1203w_H.connectedComponentMk 5 := by
          intro h
          have h' := SimpleGraph.ConnectedComponent.exact h
          have := in1203w_closed _ c0 h' (by simp)
          simp at this
  10. `in1203w_H` has exactly two odd components.

    By component induction (`SimpleGraph.ConnectedComponent.ind`), every component is generated by some vertex v. Since v < 5 or v ≥ 5, every component equals either the component of 0 or the component of 5. Both have odd cardinality 5, so the set of odd components is precisely the two-element set {cc(0), cc(5)}. Since these two components are distinct, `Set.ncard_pair` shows that the number of odd components is 2.

    lines 100–115

    uses SimpleGraph.ConnectedComponent.ind, Set.mem_insert_iff, Set.mem_singleton_iff, SimpleGraph.oddComponents, Set.mem_setOf_eq, Or.inl, Or.inr, SimpleGraph.ConnectedComponent.sound, Set.ncard_pair

        have hset : in1203w_H.oddComponents =
            {in1203w_H.connectedComponentMk 0, in1203w_H.connectedComponentMk 5} := by
          ext c
          induction c using SimpleGraph.ConnectedComponent.ind with
          | h v =>
            simp only [Set.mem_insert_iff, Set.mem_singleton_iff, SimpleGraph.oddComponents,
              Set.mem_setOf_eq]
            constructor
            · intro _
              by_cases hv : v.val < 5
              · exact Or.inl (SimpleGraph.ConnectedComponent.sound (r0 v hv).symm)
              · exact Or.inr (SimpleGraph.ConnectedComponent.sound (r5 v (by omega)).symm)
            · rintro (h | h) <;> rw [h]
              · rw [s0, n0]; decide
              · rw [s5, n5]; decide
        rw [hset, Set.ncard_pair hne]
in1203w_adj
In the witness graph, two vertices x and y are adjacent if and only if the pair {x, y} belongs to `in1203w_edges` and x ≠ y.
in1203w_closed
If a subset of vertices is closed under adjacency, then reachability preserves membership in that subset.
SimpleGraph.fromEdgeSet_adj
Two vertices are adjacent in a graph induced by an edge set if and only if their edge belongs to the set and the vertices are distinct.
Finset.mem_coe
An element belongs to the set coercion of a finite set if and only if it belongs to the finite set.
SimpleGraph.mem_neighborSet
A vertex w is in the neighbor set of v if and only if v and w are adjacent.
Set.mem_setOf_eq
Membership of an element x in a set comprehension {y | p y} is equivalent to p(x).
Nat.card_coe_set_eq
The cardinality of the subtype of a set equals the set cardinality `ncard`.
Set.ncard_eq_toFinset_card'
The `ncard` of a finite set equals the cardinality of its converted `Finset`.
Set.toFinset_ofPred
The finite set corresponding to a decidable predicate on a finite type equals the filter of all elements satisfying that predicate.
SimpleGraph.ConnectedComponent.mem_supp_iff
A vertex v belongs to the support (vertex set) of a connected component C if and only if the component containing v is C.
SimpleGraph.ConnectedComponent.eq
Two vertices determine the same connected component if and only if they are reachable from each other.
SimpleGraph.ConnectedComponent.exact
If two vertices define the same connected component, then they are reachable from each other.
SimpleGraph.ConnectedComponent.ind
To prove a property for all connected components, it suffices to prove it for the component of an arbitrary vertex.
SimpleGraph.oddComponents
The set of connected components of a graph whose vertex sets have odd cardinality.
SimpleGraph.ConnectedComponent.sound
If two vertices are reachable from each other, they define the same connected component.
Or.inl
From a proposition a, infer the disjunction a ∨ b.
Or.inr
From a proposition b, infer the disjunction a ∨ b.
Set.mem_insert_iff
An element belongs to {a} ∪ s if and only if it equals a or belongs to s.
Set.mem_singleton_iff
An element belongs to the singleton {b} if and only if it equals b.
Set.ncard_pair
A set consisting of two distinct elements has cardinality 2.

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

def in1203w_edges : Finset (Sym2 (Fin 10)) :=  {s(0,1), s(1,2), s(2,3), s(3,4), s(0,4), s(5,7), s(7,9), s(6,9), s(6,8), s(5,8)}def in1203w_H : SimpleGraph (Fin 10) :=  SimpleGraph.fromEdgeSet (↑in1203w_edges : Set (Sym2 (Fin 10)))theorem in1203w_adj (x y : Fin 10) : in1203w_H.Adj x y ↔ s(x, y) ∈ in1203w_edges ∧ x ≠ y := by  simp only [in1203w_H, SimpleGraph.fromEdgeSet_adj, Finset.mem_coe]theorem in1203w_closed {V : Type*} {H : SimpleGraph V} (S : Set V)    (hS : ∀ u v, H.Adj u v → u ∈ S → v ∈ S) {u v : V} (h : H.Reachable u v) (hu : u ∈ S) :    v ∈ S := by  obtain ⟨p⟩ := h  induction p with  | nil => exact hu  | cons ha _ ih => exact ih (hS _ _ ha hu)/-- The 8-cycle 0-1-2-7-5-8-3-4 together with the isolated vertices 6 and 9 is an even factor of the Petersen witness graph with exactly two odd components. -/theorem op_2378_petersen_even_factor_two_odd :    ∃ H : SimpleGraph (Fin 10), is_even_factor op_2378_petersen_graph H ∧ H.oddComponents.ncard = 2 := by  refine ⟨in1203w_H, ⟨?_, ?_⟩, ?_⟩  · intro x y h    rw [in1203w_adj] at h    simp only [op_2378_petersen_graph, SimpleGraph.fromEdgeSet_adj, Finset.mem_coe]    revert h    revert x y    decide  · intro v    have e : in1203w_H.neighborSet v = {w | s(v, w) ∈ in1203w_edges ∧ v ≠ w} := by      ext w      simp only [SimpleGraph.mem_neighborSet, in1203w_adj, Set.mem_setOf_eq]    rw [e, Nat.card_coe_set_eq, Set.ncard_eq_toFinset_card']    simp only [Set.toFinset_ofPred]    clear e    revert v    decide  · have c0 : ∀ u v, in1203w_H.Adj u v → u ∈ {x : Fin 10 | x.val < 5} → v ∈ {x : Fin 10 | x.val < 5} := by      intro u v h      rw [in1203w_adj] at h      simp only [Set.mem_setOf_eq]      revert h      revert u v      decide    have c1 : ∀ u v, in1203w_H.Adj u v → u ∈ {x : Fin 10 | 5 ≤ x.val} → v ∈ {x : Fin 10 | 5 ≤ x.val} := by      intro u v h      rw [in1203w_adj] at h      simp only [Set.mem_setOf_eq]      revert h      revert u v      decide    have r : ∀ a b : Fin 10, s(a, b) ∈ in1203w_edges → a ≠ b → in1203w_H.Reachable a b :=      fun a b h hne => ((in1203w_adj a b).2 ⟨h, hne⟩).reachable    have r0 : ∀ v : Fin 10, v.val < 5 → in1203w_H.Reachable 0 v := by      intro v hv      fin_cases v <;> simp at hv      · rfl      · exact r 0 1 (by decide) (by decide)      · exact (r 0 1 (by decide) (by decide)).trans (r 1 2 (by decide) (by decide))      · exact (r 0 4 (by decide) (by decide)).trans (r 4 3 (by decide) (by decide))      · exact r 0 4 (by decide) (by decide)    have r5 : ∀ v : Fin 10, 5 ≤ v.val → in1203w_H.Reachable 5 v := by      intro v hv      fin_cases v <;> simp at hv      · rfl      · exact (r 5 8 (by decide) (by decide)).trans (r 8 6 (by decide) (by decide))      · exact r 5 7 (by decide) (by decide)      · exact r 5 8 (by decide) (by decide)      · exact (r 5 7 (by decide) (by decide)).trans (r 7 9 (by decide) (by decide))    have s0 : (in1203w_H.connectedComponentMk 0).supp = {x : Fin 10 | x.val < 5} := by      ext v      rw [SimpleGraph.ConnectedComponent.mem_supp_iff, SimpleGraph.ConnectedComponent.eq]      constructor      · intro h        by_contra hv        have := in1203w_closed _ c1 h (by simp at hv ⊢; omega)        simp at this      · intro hv        exact (r0 v hv).symm    have s5 : (in1203w_H.connectedComponentMk 5).supp = {x : Fin 10 | 5 ≤ x.val} := by      ext v      rw [SimpleGraph.ConnectedComponent.mem_supp_iff, SimpleGraph.ConnectedComponent.eq]      constructor      · intro h        by_contra hv        have := in1203w_closed _ c0 h (by simp at hv ⊢; omega)        simp at this      · intro hv        exact (r5 v hv).symm    have n0 : ({x : Fin 10 | x.val < 5} : Set (Fin 10)).ncard = 5 := by      rw [Set.ncard_eq_toFinset_card']      decide    have n5 : ({x : Fin 10 | 5 ≤ x.val} : Set (Fin 10)).ncard = 5 := by      rw [Set.ncard_eq_toFinset_card']      decide    have hne : in1203w_H.connectedComponentMk 0 ≠ in1203w_H.connectedComponentMk 5 := by      intro h      have h' := SimpleGraph.ConnectedComponent.exact h      have := in1203w_closed _ c0 h' (by simp)      simp at this    have hset : in1203w_H.oddComponents =        {in1203w_H.connectedComponentMk 0, in1203w_H.connectedComponentMk 5} := by      ext c      induction c using SimpleGraph.ConnectedComponent.ind with      | h v =>        simp only [Set.mem_insert_iff, Set.mem_singleton_iff, SimpleGraph.oddComponents,          Set.mem_setOf_eq]        constructor        · intro _          by_cases hv : v.val < 5          · exact Or.inl (SimpleGraph.ConnectedComponent.sound (r0 v hv).symm)          · exact Or.inr (SimpleGraph.ConnectedComponent.sound (r5 v (by omega)).symm)        · rintro (h | h) <;> rw [h]          · rw [s0, n0]; decide          · rw [s5, n5]; decide    rw [hset, Set.ncard_pair hne]
See it in the graphDiscuss this resultChallenge it