AFTD Auto-Formalizing Theoretical Domains

op309_cubic_overlapping_triangles_form_diamond

theoremverified

In a finite connected cubic simple graph other than K4, two triangles sharing an edge induce a diamond.

Statement

theorem op309_cubic_overlapping_triangles_form_diamond
    {V : Type*} [Fintype V] [DecidableEq V]
    (G : SimpleGraph V) [DecidableRel G.Adj] (hconn : G.Connected)
    (hdegree : ∀ v, G.degree v = 3)
    (hK4 : IsEmpty (G ≃g (⊤ : SimpleGraph (Fin 4))))
    (u v a b : V) (hdist : [u,v,a,b].Nodup)
    (huv : G.Adj u v) (hua : G.Adj u a) (hub : G.Adj u b)
    (hva : G.Adj v a) (hvb : G.Adj v b) : ¬ G.Adj a b
Source
Triangle and diamond decomposition for OP-309.
Verified
20 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

We argue by contradiction: suppose the non-shared vertices a and b of the two triangles are adjacent. Since the graph is 3-regular, each of the four vertices u, v, a, b has degree 3, and because they are already pairwise adjacent, none of them can have any other neighbors. Because the graph is connected, any vertex reachable from u by a walk must lie in {u, v, a, b}, so these four vertices constitute the entire graph. Consequently, the graph is isomorphic to K4, which contradicts the hypothesis that the graph is not K4.

  1. Assume for contradiction that the degree-3 vertex u has a neighbor t distinct from the three known neighbors a, b, and c.

    We introduce an arbitrary neighbor t of u and suppose for contradiction that t is not equal to any of a, b, or c. Pushing the negation through the disjunction yields three inequalities: t ≠ a, t ≠ b, and t ≠ c.

    lines 6–9

      intro t ht
      by_contra hne
      push Not at hne
      obtain ⟨h1, h2, h3⟩ := hne
  2. The four vertices a, b, c, t form a subset of the neighbor set of u.

    For any element x ∈ {a, b, c, t}, case analysis on set membership shows that x is one of a, b, c, or t. Since each of these four vertices is adjacent to u, x belongs to the neighbor finset of u.

    lines 10–14

    uses Finset.mem_insert, Finset.mem_singleton

      have hsub : ({a, b, c, t} : Finset V) ⊆ G.neighborFinset u := by
        intro x hx
        simp only [Finset.mem_insert, Finset.mem_singleton] at hx
        rw [G.mem_neighborFinset]
        rcases hx with rfl | rfl | rfl | rfl <;> assumption
  3. The set {a, b, c, t} has cardinality 4.

    Because a, b, c are pairwise distinct and t is distinct from all three, none of the successive insertions contains the element being inserted. Evaluating the cardinalities of the insertions and the disjoint pair yields |{a, b, c, t}| = 4.

    lines 15–18

    uses Finset.card_insert_of_notMem, Finset.card_pair, Ne.symm

      have hcard : ({a, b, c, t} : Finset V).card = 4 := by
        rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_pair (Ne.symm h3)]
        · simp [hbc, Ne.symm h2]
        · simp [hab, hac, Ne.symm h1]
  4. Contradiction: the neighborhood of u would contain at least 4 vertices, but u has degree 3.

    Since {a, b, c, t} is a subset of the neighbors of u, its cardinality 4 is at most the cardinality of the neighborhood, which equals the degree 3. This gives 4 ≤ 3, an immediate arithmetic contradiction.

    lines 19–21

    uses Finset.card_le_card

      have := Finset.card_le_card hsub
      rw [hcard, G.card_neighborFinset_eq_degree, hdeg] at this
      omega
  5. Assume for contradiction that a and b are adjacent, and extract the pairwise distinctness of u, v, a, b.

    We assume for contradiction that G.Adj a b. Simplifying the hypothesis that the list [u, v, a, b] has no duplicates extracts all six pairwise inequalities: u ≠ v, u ≠ a, u ≠ b, v ≠ a, v ≠ b, and a ≠ b.

    lines 31–34

    uses List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, List.nodup_nil, and_true

      intro hab
      simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or,
        List.nodup_nil, and_true] at hdist
      obtain ⟨⟨huv', hua', hub'⟩, ⟨hva', hvb'⟩, hab', -⟩ := hdist
  6. For each vertex in {u, v, a, b}, its only neighbors in G are the other three vertices.

    Because G is 3-regular, each of u, v, a, b has degree 3. Using the given edges together with the assumed edge a ~ b, each vertex already has three distinct neighbors in {u, v, a, b}. Applying op309_overlap_diamond_nbrs3 to each vertex shows that its entire neighborhood is exhausted by the other three vertices.

    lines 35–38

    uses op309_overlap_diamond_nbrs3

      have Nu := op309_overlap_diamond_nbrs3 G u v a b (hdegree u) huv hua hub hva' hvb' hab'
      have Nv := op309_overlap_diamond_nbrs3 G v u a b (hdegree v) huv.symm hva hvb hua' hub' hab'
      have Na := op309_overlap_diamond_nbrs3 G a u v b (hdegree a) hua.symm hva.symm hab huv' hub' hvb'
      have Nb := op309_overlap_diamond_nbrs3 G b u v a (hdegree b) hub.symm hvb.symm hab.symm huv' hua' hva'
  7. The set S = {u, v, a, b} is closed under adjacency in G.

    Let S be the set of vertices equal to u, v, a, or b. If x ∈ S and y is adjacent to x, case analysis on x shows by the neighbor characterizations Nu, Nv, Na, Nb that y must be one of the other three vertices, hence y ∈ S.

    lines 39–45

      let S : V → Prop := fun w => w = u ∨ w = v ∨ w = a ∨ w = b
      have closed : ∀ x y, S x → G.Adj x y → S y := by
        rintro x y (rfl | rfl | rfl | rfl) hxy
        · rcases Nu y hxy with h | h | h <;> simp [S, h]
        · rcases Nv y hxy with h | h | h <;> simp [S, h]
        · rcases Na y hxy with h | h | h <;> simp [S, h]
        · rcases Nb y hxy with h | h | h <;> simp [S, h]
  8. Every vertex of the connected graph G belongs to S = {u, v, a, b}.

    Because G is connected, there is a walk from u to any vertex w. Since u ∈ S, and S is closed under adjacency at each step along the walk, an induction on the length of the walk shows that the endpoint w must also lie in S.

    lines 46–53

    uses Or.inl, id

      have hall : ∀ w, S w := by
        intro w
        obtain ⟨p⟩ := hconn.preconnected u w
        suffices h : ∀ x y (q : G.Walk x y), S x → S y from h u w p (Or.inl rfl)
        intro x y q
        induction q with
        | nil => exact id
        | cons hadj _ ih => exact fun hx => ih (closed _ _ hx hadj)
  9. The map f : Fin 4 → V sending 0, 1, 2, 3 to u, v, a, b is a bijection, yielding an equivalence e : Fin 4 ≃ V.

    The indexing map f is injective because u, v, a, b are pairwise distinct, and surjective because every vertex of G belongs to S = {u, v, a, b}. Combining these yields the equivalence e.

    lines 54–65

    uses Equiv.ofBijective

      let f : Fin 4 → V := ![u, v, a, b]
      have finj : Function.Injective f := by
        intro i j hij
        fin_cases i <;> fin_cases j <;> simp_all [f]
      have fsurj : Function.Surjective f := by
        intro w
        rcases hall w with h | h | h | h
        · exact ⟨0, h.symm⟩
        · exact ⟨1, h.symm⟩
        · exact ⟨2, h.symm⟩
        · exact ⟨3, h.symm⟩
      let e : Fin 4 ≃ V := Equiv.ofBijective f ⟨finj, fsurj⟩
  10. The bijection e is a graph isomorphism between the complete graph K4 on Fin 4 and G.

    In the complete graph ⊤ on Fin 4, two vertices are adjacent if and only if they are distinct. By exhaustive verification over all pairs of indices, f(i) and f(j) are adjacent in G whenever i ≠ j, because all six edges among {u, v, a, b} exist.

    lines 66–74

    uses SimpleGraph.top_adj

      have iso : (⊤ : SimpleGraph (Fin 4)) ≃g G :=
        { toEquiv := e
          map_rel_iff' := by
            intro i j
            change G.Adj (f i) (f j) ↔ (⊤ : SimpleGraph (Fin 4)).Adj i j
            rw [SimpleGraph.top_adj]
            fin_cases i <;> fin_cases j <;>
              simp [f, huv, hua, hub, hva, hvb, hab, huv.symm, hua.symm, hub.symm, hva.symm,
                hvb.symm, hab.symm] }
  11. Contradiction: G is isomorphic to K4, contradicting the hypothesis that no such isomorphism exists.

    The inverted isomorphism iso.symm is an isomorphism from G to K4. Its existence contradicts the hypothesis hK4 that the type of such isomorphisms is empty, concluding the proof.

    line 75

      exact hK4.false iso.symm
and_true
For any proposition p, p ∧ True is equivalent to p.
Equiv.ofBijective
A function that is both injective and surjective induces an equivalence (bijection) between its domain and codomain.
Finset.card_insert_of_notMem
Inserting an element a into a finite set s that does not contain a increases its cardinality by 1.
Finset.card_le_card
If s ⊆ t for finite sets s and t, then |s| ≤ |t|.
Finset.card_pair
A pair of distinct elements {a, b} has cardinality 2.
Finset.mem_insert
An element x belongs to insert b s if and only if x = b or x ∈ s.
Finset.mem_singleton
An element b belongs to the singleton {a} if and only if b = a.
id
The identity function, which maps every element to itself.
List.mem_cons
An element a belongs to b :: l if and only if a = b or a ∈ l.
List.nodup_cons
A list a :: l has no duplicate elements if and only if a ∉ l and l has no duplicates.
List.nodup_nil
The empty list has no duplicate elements.
List.not_mem_nil
No element belongs to the empty list.
Ne.symm
Inequality is symmetric: if a ≠ b, then b ≠ a.
not_or
The negation ¬(p ∨ q) is logically equivalent to ¬p ∧ ¬q.
op309_overlap_diamond_nbrs3
In a graph where vertex u has degree 3 and a, b, c are three distinct neighbors of u, every neighbor of u must be equal to a, b, or c.
or_false
For any proposition p, p ∨ False is equivalent to p.
Or.inl
Given a proof of proposition a, constructs a proof of the disjunction a ∨ b.
SimpleGraph.top_adj
In the complete graph ⊤, two vertices are adjacent if and only if they are distinct.

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

theorem op309_overlap_diamond_nbrs3 {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (u a b c : V) (hdeg : G.degree u = 3)    (ha : G.Adj u a) (hb : G.Adj u b) (hc : G.Adj u c)    (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) :    ∀ t, G.Adj u t → t = a ∨ t = b ∨ t = c := by  intro t ht  by_contra hne  push Not at hne  obtain ⟨h1, h2, h3⟩ := hne  have hsub : ({a, b, c, t} : Finset V) ⊆ G.neighborFinset u := by    intro x hx    simp only [Finset.mem_insert, Finset.mem_singleton] at hx    rw [G.mem_neighborFinset]    rcases hx with rfl | rfl | rfl | rfl <;> assumption  have hcard : ({a, b, c, t} : Finset V).card = 4 := by    rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_pair (Ne.symm h3)]    · simp [hbc, Ne.symm h2]    · simp [hab, hac, Ne.symm h1]  have := Finset.card_le_card hsub  rw [hcard, G.card_neighborFinset_eq_degree, hdeg] at this  omegatheorem op309_cubic_overlapping_triangles_form_diamond    {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (hconn : G.Connected)    (hdegree : ∀ v, G.degree v = 3)    (hK4 : IsEmpty (G ≃g (⊤ : SimpleGraph (Fin 4))))    (u v a b : V) (hdist : [u,v,a,b].Nodup)    (huv : G.Adj u v) (hua : G.Adj u a) (hub : G.Adj u b)    (hva : G.Adj v a) (hvb : G.Adj v b) : ¬ G.Adj a b := by  intro hab  simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or,    List.nodup_nil, and_true] at hdist  obtain ⟨⟨huv', hua', hub'⟩, ⟨hva', hvb'⟩, hab', -⟩ := hdist  have Nu := op309_overlap_diamond_nbrs3 G u v a b (hdegree u) huv hua hub hva' hvb' hab'  have Nv := op309_overlap_diamond_nbrs3 G v u a b (hdegree v) huv.symm hva hvb hua' hub' hab'  have Na := op309_overlap_diamond_nbrs3 G a u v b (hdegree a) hua.symm hva.symm hab huv' hub' hvb'  have Nb := op309_overlap_diamond_nbrs3 G b u v a (hdegree b) hub.symm hvb.symm hab.symm huv' hua' hva'  let S : V → Prop := fun w => w = u ∨ w = v ∨ w = a ∨ w = b  have closed : ∀ x y, S x → G.Adj x y → S y := by    rintro x y (rfl | rfl | rfl | rfl) hxy    · rcases Nu y hxy with h | h | h <;> simp [S, h]    · rcases Nv y hxy with h | h | h <;> simp [S, h]    · rcases Na y hxy with h | h | h <;> simp [S, h]    · rcases Nb y hxy with h | h | h <;> simp [S, h]  have hall : ∀ w, S w := by    intro w    obtain ⟨p⟩ := hconn.preconnected u w    suffices h : ∀ x y (q : G.Walk x y), S x → S y from h u w p (Or.inl rfl)    intro x y q    induction q with    | nil => exact id    | cons hadj _ ih => exact fun hx => ih (closed _ _ hx hadj)  let f : Fin 4 → V := ![u, v, a, b]  have finj : Function.Injective f := by    intro i j hij    fin_cases i <;> fin_cases j <;> simp_all [f]  have fsurj : Function.Surjective f := by    intro w    rcases hall w with h | h | h | h    · exact ⟨0, h.symm⟩    · exact ⟨1, h.symm⟩    · exact ⟨2, h.symm⟩    · exact ⟨3, h.symm⟩  let e : Fin 4 ≃ V := Equiv.ofBijective f ⟨finj, fsurj⟩  have iso : (⊤ : SimpleGraph (Fin 4)) ≃g G :=    { toEquiv := e      map_rel_iff' := by        intro i j        change G.Adj (f i) (f j) ↔ (⊤ : SimpleGraph (Fin 4)).Adj i j        rw [SimpleGraph.top_adj]        fin_cases i <;> fin_cases j <;>          simp [f, huv, hua, hub, hva, hvb, hab, huv.symm, hua.symm, hub.symm, hva.symm,            hvb.symm, hab.symm] }  exact hK4.false iso.symm
See it in the graphDiscuss this resultChallenge it