AFTD Auto-Formalizing Theoretical Domains

op309_cubic_diamond_contains_incident_triangles

theoremverified

In a finite cubic simple graph, every triangle meeting a diamond is contained in that diamond.

Statement

theorem op309_cubic_diamond_contains_incident_triangles
    {V : Type*} [Fintype V] [DecidableEq V]
    (G : SimpleGraph V) [DecidableRel G.Adj] (hdegree : ∀ v, G.degree v = 3)
    (u v a b x y z : 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) (hab : ¬ G.Adj a b)
    (hx : x = u ∨ x = v ∨ x = a ∨ x = b)
    (hxy : G.Adj x y) (hxz : G.Adj x z) (hyz : G.Adj y z) :
    (y = u ∨ y = v ∨ y = a ∨ y = b) ∧
    (z = u ∨ z = v ∨ z = a ∨ z = b)
Source
Triangle and diamond decomposition for OP-309.
Verified
20 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

To show that any triangle incident to a diamond in a cubic simple graph is fully contained in the diamond, the proof first establishes that in a 3-regular graph, any three distinct neighbors of a vertex exhaust all its neighbors. For the central vertices u and v, their three neighbors in the diamond already account for all their neighbors, so any triangle containing u or v has its other vertices in the diamond. For the side vertices a and b, which are adjacent to u and v, the third vertex of the triangle must either be u or v (in which case the earlier characterization applies) or else forces the other triangle vertex to be u or v by degree counting on a or b.

  1. To prove that any neighbor t of u is one of a, b, c, we assume for contradiction that t is distinct from a, b, and c.

    We introduce an arbitrary neighbor t of u, and assume for contradiction that 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 set {a, b, c, t} is a subset of the neighbor set of u.

    By assumption, u is adjacent to each of a, b, c, and t. Therefore, every element of the four-element set {a, b, c, t} belongs to the neighbor finset of u.

    lines 10–14

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

      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} contains four distinct elements, so its cardinality is 4.

    Since a, b, c are pairwise distinct and t is distinct from each of them, we can build up the set by inserting elements not already present, starting from the pair {c, t} of cardinality 2, yielding cardinality 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. A vertex of degree 3 cannot have four distinct neighbors, which gives a contradiction.

    The cardinality of a subset of the neighbor set cannot exceed the degree of u, which is 3. But {a, b, c, t} has size 4, yielding 4 ≤ 3, an arithmetic contradiction.

    lines 19–21

    uses Finset.card_le_card, G.card_neighborFinset_eq_degree

      have := Finset.card_le_card hsub
      rw [hcard, G.card_neighborFinset_eq_degree, hdeg] at this
      omega
  5. The vertices u, v, a, b forming the diamond are all pairwise distinct.

    We simplify the condition that the list [u, v, a, b] has no duplicates, obtaining the explicit inequalities u ≠ v, u ≠ a, u ≠ b, v ≠ a, v ≠ b, and a ≠ b.

    lines 33–35

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

      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. Every neighbor of u lies in {v, a, b}, every neighbor of v lies in {u, a, b}, and y ≠ z.

    Both u and v have degree 3 and already have three distinct neighbors in the diamond: u has neighbors v, a, b, while v has neighbors u, a, b. By the auxiliary lemma op309_diamond_incident_nbrs3, these are all their neighbors. Furthermore, since y is adjacent to z in a simple graph, y ≠ z.

    lines 36–38

    uses op309_diamond_incident_nbrs3

      have Nu := op309_diamond_incident_nbrs3 G u v a b (hdegree u) huv hua hub hva' hvb' hab'
      have Nv := op309_diamond_incident_nbrs3 G v u a b (hdegree v) huv.symm hva hvb hua' hub' hab'
      have hyz' : y ≠ z := hyz.ne
  7. If a degree-3 vertex w ∈ {a, b} is adjacent to u, v, y, z, then both y and z belong to {u, v, a, b}.

    We split into two cases: if y ∈ {u, v}, then since y is adjacent to z, z is a neighbor of either u or v, so z ∈ {u, v, a, b}. If y ∉ {u, v}, then u, v, y are three distinct neighbors of w; by op309_diamond_incident_nbrs3, w's fourth neighbor z must be one of u, v, y. Since z ≠ y, z must be in {u, v}. Then, since z is adjacent to y, y must be a neighbor of u or v, so y ∈ {u, v, a, b}. In both cases, both y and z lie in {u, v, a, b}.

    lines 40–59

    uses op309_diamond_incident_nbrs3

      have key : ∀ w, (w = a ∨ w = b) → G.Adj w u → G.Adj w v → G.Adj w y → G.Adj w z →
          (y = u ∨ y = v ∨ y = a ∨ y = b) ∧ (z = u ∨ z = v ∨ z = a ∨ z = b) := by
        intro w hw hwu hwv hwy hwz
        have huv2 : u ≠ v := huv'
        by_cases hyuv : y = u ∨ y = v
        · rcases hyuv with rfl | rfl
          · rcases Nu z hyz with h | h | h <;> simp [h]
          · rcases Nv z hyz with h | h | h <;> simp [h]
        · push Not at hyuv
          have hz : z = u ∨ z = v := by
            by_contra hz
            push Not at hz
            rcases op309_diamond_incident_nbrs3 G w u v y (hdegree w) hwu hwv hwy huv2
              (Ne.symm hyuv.1) (Ne.symm hyuv.2) z hwz with h | h | h
            · exact hz.1 h
            · exact hz.2 h
            · exact hyz' h.symm
          rcases hz with rfl | rfl
          · rcases Nu y hyz.symm with h | h | h <;> simp [h]
          · rcases Nv y hyz.symm with h | h | h <;> simp [h]
  8. The remaining two vertices y and z of any triangle containing x also belong to {u, v, a, b}.

    We split on the four possible values of x ∈ {u, v, a, b}. If x = u, both y and z are neighbors of u, so by Nu both lie in {v, a, b}. If x = v, both are neighbors of v, so by Nv both lie in {u, a, b}. If x = a or x = b, the helper lemma key applies directly. In all four cases, y and z belong to the diamond.

    lines 60–64

    uses Or.inl, Or.inr

      rcases hx with rfl | rfl | rfl | rfl
      · rcases Nu y hxy with h | h | h <;> rcases Nu z hxz with h' | h' | h' <;> simp [h, h']
      · rcases Nv y hxy with h | h | h <;> rcases Nv z hxz with h' | h' | h' <;> simp [h, h']
      · exact key x (Or.inl rfl) hua.symm hva.symm hxy hxz
      · exact key x (Or.inr rfl) hub.symm hvb.symm hxy hxz
op309_diamond_incident_nbrs3
In a simple graph, if a vertex u has degree 3 and is adjacent to three distinct vertices a, b, c, then any neighbor of u must be one of a, b, or c.
Finset.mem_insert
An element x belongs to the insert of an element into a finite set if and only if x equals that element or x belongs to the set.
Finset.mem_singleton
An element x belongs to a singleton set {a} if and only if x = a.
G.mem_neighborFinset
A vertex w is in the neighbor finset of v if and only if v is adjacent to w.
Finset.card_insert_of_notMem
Inserting an element not in a finite set increases its cardinality by 1.
Finset.card_pair
The cardinality of a pair {a, b} of distinct elements is 2.
Ne.symm
Symmetry of inequality: if a ≠ b then b ≠ a.
Finset.card_le_card
If one finite set is a subset of another, its cardinality is at most the cardinality of the other.
G.card_neighborFinset_eq_degree
The cardinality of the neighbor finset of a vertex equals its degree.
List.nodup_cons
A non-empty list a :: l has no duplicates if and only if a is not in l and l has no duplicates.
List.mem_cons
An element belongs to a cons list a :: l if and only if it equals a or belongs to l.
List.not_mem_nil
No element belongs to the empty list.
or_false
For any proposition p, p or False is equivalent to p.
not_or
The negation of a disjunction ¬(p ∨ q) is equivalent to ¬p ∧ ¬q.
List.nodup_nil
The empty list has no duplicates.
and_true
For any proposition p, p and True is equivalent to p.
Or.inl
Introduction rule for the left disjunct: if P holds, then P ∨ Q holds.
Or.inr
Introduction rule for the right disjunct: if Q holds, then P ∨ Q holds.

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_diamond_incident_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_diamond_contains_incident_triangles    {V : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (hdegree : ∀ v, G.degree v = 3)    (u v a b x y z : 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) (hab : ¬ G.Adj a b)    (hx : x = u ∨ x = v ∨ x = a ∨ x = b)    (hxy : G.Adj x y) (hxz : G.Adj x z) (hyz : G.Adj y z) :    (y = u ∨ y = v ∨ y = a ∨ y = b) ∧    (z = u ∨ z = v ∨ z = a ∨ z = b) := by  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_diamond_incident_nbrs3 G u v a b (hdegree u) huv hua hub hva' hvb' hab'  have Nv := op309_diamond_incident_nbrs3 G v u a b (hdegree v) huv.symm hva hvb hua' hub' hab'  have hyz' : y ≠ z := hyz.ne  -- a vertex with two adjacent neighbours y z, one of which lies in {u, v}  have key : ∀ w, (w = a ∨ w = b) → G.Adj w u → G.Adj w v → G.Adj w y → G.Adj w z →      (y = u ∨ y = v ∨ y = a ∨ y = b) ∧ (z = u ∨ z = v ∨ z = a ∨ z = b) := by    intro w hw hwu hwv hwy hwz    have huv2 : u ≠ v := huv'    by_cases hyuv : y = u ∨ y = v    · rcases hyuv with rfl | rfl      · rcases Nu z hyz with h | h | h <;> simp [h]      · rcases Nv z hyz with h | h | h <;> simp [h]    · push Not at hyuv      have hz : z = u ∨ z = v := by        by_contra hz        push Not at hz        rcases op309_diamond_incident_nbrs3 G w u v y (hdegree w) hwu hwv hwy huv2          (Ne.symm hyuv.1) (Ne.symm hyuv.2) z hwz with h | h | h        · exact hz.1 h        · exact hz.2 h        · exact hyz' h.symm      rcases hz with rfl | rfl      · rcases Nu y hyz.symm with h | h | h <;> simp [h]      · rcases Nv y hyz.symm with h | h | h <;> simp [h]  rcases hx with rfl | rfl | rfl | rfl  · rcases Nu y hxy with h | h | h <;> rcases Nu z hxz with h' | h' | h' <;> simp [h, h']  · rcases Nv y hxy with h | h | h <;> rcases Nv z hxz with h' | h' | h' <;> simp [h, h']  · exact key x (Or.inl rfl) hua.symm hva.symm hxy hxz  · exact key x (Or.inr rfl) hub.symm hvb.symm hxy hxz
See it in the graphDiscuss this resultChallenge it