AFTD Auto-Formalizing Theoretical Domains

op309_cubic_triangles_sharing_vertex_share_edge

theoremverified

In a finite cubic simple graph, any two triangles sharing a vertex also share an edge.

Statement

theorem op309_cubic_triangles_sharing_vertex_share_edge
    {V : Type*} [Fintype V] [DecidableEq V]
    (G : SimpleGraph V) [DecidableRel G.Adj] (hdegree : ∀ v, G.degree v = 3)
    (v a b c d : V)
    (ha : G.Adj v a) (hb : G.Adj v b) (hab : G.Adj a b)
    (hc : G.Adj v c) (hd : G.Adj v d) (hcd : G.Adj c d) :
    a = c ∨ a = d ∨ b = c ∨ b = d
Source
Triangle and diamond decomposition for OP-309.
Verified
20 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

We argue by contradiction: suppose two triangles sharing a vertex v do not share an edge, so the remaining vertices a, b of the first triangle and c, d of the second triangle are mutually distinct. Since all four vertices are adjacent to v, they form a 4-element subset of the neighbors of v. This implies that the degree of v is at least 4, contradicting the assumption that the graph is cubic (every vertex has degree 3).

  1. Assuming the conclusion is false yields that {a, b} and {c, d} are disjoint, meaning a ≠ c, a ≠ d, b ≠ c, and b ≠ d.

    We proceed by contradiction. Negating the disjunction a = c ∨ a = d ∨ b = c ∨ b = d and pushing the negation across the disjunctions gives four distinct non-equality hypotheses: a ≠ c, a ≠ d, b ≠ c, and b ≠ d.

    lines 8–10

      by_contra hne
      push Not at hne
      obtain ⟨h1, h2, h3, h4⟩ := hne
  2. The set {a, b, c, d} is a subset of the neighborhood of v.

    Let x be an element of {a, b, c, d}. By definition of the set, x is equal to a, b, c, or d. In each of the four cases, the given hypotheses that vab and vcd form triangles show that x is adjacent to v, so x belongs to the neighbor finset of v.

    lines 11–15

    uses Finset.mem_insert, Finset.mem_singleton, G.mem_neighborFinset

      have hsub : ({a, b, c, d} : Finset V) ⊆ G.neighborFinset v := 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, d} has cardinality 4.

    Since c and d are adjacent in a simple graph, c ≠ d, so the pair {c, d} has cardinality 2. The non-equality hypotheses from the contradiction assumption ensure that b ∉ {c, d}, so inserting b produces a set of cardinality 3. Finally, a is adjacent to b (so a ≠ b) and distinct from both c and d, meaning a ∉ {b, c, d}; inserting a thus yields a set of cardinality 4.

    lines 16–19

    uses Finset.card_insert_of_notMem, Finset.card_pair

      have hcard : ({a, b, c, d} : Finset V).card = 4 := by
        rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_pair hcd.ne]
        · simp [h3, h4]
        · simp [hab.ne, h1, h2]
  4. Contradiction.

    Since {a, b, c, d} is a subset of the neighbors of v, its cardinality is at most the number of neighbors of v. Substituting the cardinality 4 and the neighborhood size (which equals the degree of v, namely 3) yields 4 ≤ 3, which is an arithmetic contradiction.

    lines 20–22

    uses Finset.card_le_card, G.card_neighborFinset_eq_degree

      have := Finset.card_le_card hsub
      rw [hcard, G.card_neighborFinset_eq_degree, hdegree] at this
      omega
Finset.mem_insert
An element belongs to an inserted set insert b s if and only if it equals b or belongs to s.
Finset.mem_singleton
An element b belongs to the singleton set {a} if and only if b = a.
G.mem_neighborFinset
A vertex w belongs to the neighbor finset of v if and only if v and w are adjacent in G.
Finset.card_insert_of_notMem
Inserting an element a into a finite set s of which it is not a member increases the cardinality of s by 1.
Finset.card_pair
A pair of distinct elements {a, b} has cardinality 2.
Finset.card_le_card
If a finite set s is a subset of t, then the cardinality of s is at most the cardinality of t.
G.card_neighborFinset_eq_degree
The cardinality of the neighbor finset of a vertex v equals the degree of v in G.

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_cubic_triangles_sharing_vertex_share_edge    {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (hdegree : ∀ v, G.degree v = 3)    (v a b c d : V)    (ha : G.Adj v a) (hb : G.Adj v b) (hab : G.Adj a b)    (hc : G.Adj v c) (hd : G.Adj v d) (hcd : G.Adj c d) :    a = c ∨ a = d ∨ b = c ∨ b = d := by  by_contra hne  push Not at hne  obtain ⟨h1, h2, h3, h4⟩ := hne  have hsub : ({a, b, c, d} : Finset V) ⊆ G.neighborFinset v := 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, d} : Finset V).card = 4 := by    rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_pair hcd.ne]    · simp [h3, h4]    · simp [hab.ne, h1, h2]  have := Finset.card_le_card hsub  rw [hcard, G.card_neighborFinset_eq_degree, hdegree] at this  omega
See it in the graphDiscuss this resultChallenge it