AFTD Auto-Formalizing Theoretical Domains

op309_triangle_template_rich_pair

theoremverified

For a triangle with exactly the displayed neighbor sets, if its three internal edges receive colors 2, 3, 4 and its external ports receive 0, 0, 1, then the two triangle edges incident with the third vertex are rich.

Statement

theorem op309_triangle_template_rich_pair
    {V : Type*} [DecidableEq V] (G : SimpleGraph V)
    (u v w x y z : V) (hdist : [u,v,w].Nodup)
    (hx : x ∉ [u,v,w]) (hy : y ∉ [u,v,w]) (hz : z ∉ [u,v,w])
    (hu : ∀ t, G.Adj u t ↔ t = v ∨ t = w ∨ t = x)
    (hv : ∀ t, G.Adj v t ↔ t = u ∨ t = w ∨ t = y)
    (hw : ∀ t, G.Adj w t ↔ t = u ∨ t = v ∨ t = z)
    (c : G.edgeSet → Fin 5)
    (h0 : ∀ e : G.edgeSet, e.1 = s(u,v) → c e = 2)
    (h1 : ∀ e : G.edgeSet, e.1 = s(u,w) → c e = 3)
    (h2 : ∀ e : G.edgeSet, e.1 = s(v,w) → c e = 4)
    (h3 : ∀ e : G.edgeSet, e.1 = s(u,x) → c e = 0)
    (h4 : ∀ e : G.edgeSet, e.1 = s(v,y) → c e = 0)
    (h5 : ∀ e : G.edgeSet, e.1 = s(w,z) → c e = 1) :
    (∀ e : G.edgeSet, e.1 = s(u,w) → simple_graph_edge_is_rich G c e) ∧
    (∀ e : G.edgeSet, e.1 = s(v,w) → simple_graph_edge_is_rich G c e)
Source
Local triangle template for the claw-free cubic route to OP-309; checked in experiments 31379, 31384, and 31393.
Verified
20 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • simple_graph_edge_is_richIn an edge colouring c, an edge e is rich if all edges adjacent to e receive pairwise distinct colours.

The proof, explained

An edge is rich under a coloring if all edges incident to it receive pairwise distinct colors. The proof first establishes two lemmas: that any edge adjacent to {p, q} connects p or q to a distinct neighbor, and that an edge with four adjacent edges of distinct colors is rich. For each of the triangle edges {u, w} and {v, w}, the specified neighbor sets restrict the incident edges to exactly four candidates. In each case, these four edges receive distinct colors (2, 0, 4, 1 and 2, 0, 3, 1 respectively), proving that both edges are rich.

  1. Any edge f adjacent to e = s(p, q) in the line graph shares an endpoint y ∈ {p, q} with e and can be written as s(y, t) for some neighbor t of y.

    By SimpleGraph.lineGraph_adj_iff_exists, e and f are distinct edges sharing a vertex y. Because e = s(p, q), Sym2.mem_iff gives y = p or y = q. Since y ∈ f, Sym2.mem_iff_exists.mp yields a vertex t such that f = s(y, t). As f is an edge of G, y and t are adjacent by SimpleGraph.mem_edgeSet.

    lines 5–11

    uses SimpleGraph.lineGraph_adj_iff_exists, Sym2.mem_iff, Sym2.mem_iff_exists.mp, SimpleGraph.mem_edgeSet

      rw [SimpleGraph.lineGraph_adj_iff_exists] at hadj
      obtain ⟨hne, y, hye, hyf⟩ := hadj
      rw [he, Sym2.mem_iff] at hye
      obtain ⟨t, ht⟩ := Sym2.mem_iff_exists.mp hyf
      have hft : G.Adj y t := by
        have := f.2; rw [ht] at this; exact (SimpleGraph.mem_edgeSet G).mp this
      refine ⟨t, ?_⟩
  2. The neighbor t satisfies either t ≠ q with f = s(p, t), or t ≠ p with f = s(q, t).

    We split on whether y = p or y = q. If y = p, then f = s(p, t); if t were equal to q, f would equal e, contradicting e ≠ f by Subtype.ext, so t ≠ q. If y = q, then f = s(q, t); if t were equal to p, f would equal e by Sym2.eq_swap, again contradicting e ≠ f by Subtype.ext, so t ≠ p.

    lines 12–18

    uses Subtype.ext, Sym2.eq_swap

      rcases hye with rfl | rfl
      · left
        refine ⟨hft, ?_, ht⟩
        rintro rfl; exact hne (Subtype.ext (he.trans ht.symm))
      · right
        refine ⟨hft, ?_, ht⟩
        rintro rfl; exact hne (Subtype.ext (he.trans (ht.trans Sym2.eq_swap).symm))
  3. To show an edge e is rich, it suffices to derive a contradiction from assuming two distinct adjacent edges f and f2 share the same color.

    We introduce distinct edges f, f2 adjacent to e in the line graph with c(f) = c(f2), unfolding the definition of simple_graph_edge_is_rich, and unpack the hypothesis hdist into the six pairwise inequalities between colors a, b, c', and d.

    lines 27–28

      intro f f2 hf hg hfg hc
      obtain ⟨d1, d2, d3, d4, d5, d6⟩ := hdist
  4. If every adjacent edge is one of four edges A, B, C, D with pairwise distinct colors a, b, c', d, then e is rich.

    We case-split on which of the four edges f and f2 are. In the cases where f and f2 correspond to the same edge, their underlying unordered pairs are identical, so Subtype.ext implies f = f2, contradicting f ≠ f2. In the cases where f and f2 correspond to different candidate edges, their colors must be distinct by hdist, which contradicts the assumption c(f) = c(f2).

    lines 29–33

    uses Subtype.ext

      rcases h f hf with ⟨fA, fa⟩ | ⟨fA, fa⟩ | ⟨fA, fa⟩ | ⟨fA, fa⟩ <;>
      rcases h f2 hg with ⟨gA, ga⟩ | ⟨gA, ga⟩ | ⟨gA, ga⟩ | ⟨gA, ga⟩ <;>
      first
        | exact hfg (Subtype.ext (fA.trans gA.symm))
        | (rw [fa, ga] at hc; first | exact absurd hc ‹_› | exact absurd hc.symm ‹_›)
  5. To show {u, w} is rich, it suffices to show that any edge adjacent to it is one of {u, v}, {u, x}, {v, w}, {w, z} with respective colors 2, 0, 4, 1.

    We split the main conjunction into the two edge claims. For e = s(u, w), we apply op309_tri_tmpl_rich_of_four with candidate edges s(u, v), s(u, x), s(v, w), s(w, z) and colors 2, 0, 4, 1. The pairwise distinctness of these four values in Fin 5 is verified by decide.

    lines 51–53

    uses op309_tri_tmpl_rich_of_four

      constructor
      · intro e he
        refine op309_tri_tmpl_rich_of_four G c e s(u,v) s(u,x) s(v,w) s(w,z) 2 0 4 1 (by decide) ?_
  6. Every edge f adjacent to e = s(u, w) is one of s(u, v), s(u, x), s(v, w), s(w, z) and has color 2, 0, 4, 1, respectively.

    By op309_tri_tmpl_adj_cases, f must meet u at a neighbor t ≠ w, or meet w at a neighbor t ≠ u. If f meets u, the neighbors of u are v, w, x by hu; since t ≠ w, t is either v (yielding f = s(u, v) with color 2 by h0 and Or.inl) or x (yielding f = s(u, x) with color 0 by h3 and Or.inr). If f meets w, the neighbors of w are u, v, z by hw; since t ≠ u, t is either v (yielding f = s(w, v) = s(v, w) by Sym2.eq_swap, with color 4 by h2 and Or.inr) or z (yielding f = s(w, z) with color 1 by h5 and Or.inr).

    lines 54–64

    uses op309_tri_tmpl_adj_cases, Sym2.eq_swap, Or.inl, Or.inr

        intro f hf
        obtain ⟨t, ⟨ht, htq, hft⟩ | ⟨ht, htq, hft⟩⟩ := op309_tri_tmpl_adj_cases G e f u w he hf
        · rcases (hu t).mp ht with h | h | h <;> subst t
          · exact Or.inl ⟨hft, h0 f hft⟩
          · exact absurd rfl htq
          · exact Or.inr (Or.inl ⟨hft, h3 f hft⟩)
        · rcases (hw t).mp ht with h | h | h <;> subst t
          · exact absurd rfl htq
          · have : (f : Sym2 V) = s(v, w) := hft.trans Sym2.eq_swap
            exact Or.inr (Or.inr (Or.inl ⟨this, h2 f this⟩))
          · exact Or.inr (Or.inr (Or.inr ⟨hft, h5 f hft⟩))
  7. To show {v, w} is rich, it suffices to show that any edge adjacent to it is one of {u, v}, {v, y}, {u, w}, {w, z} with respective colors 2, 0, 3, 1.

    For e = s(v, w), we apply op309_tri_tmpl_rich_of_four with candidate edges s(u, v), s(v, y), s(u, w), s(w, z) and colors 2, 0, 3, 1. Pairwise distinctness of these four colors in Fin 5 is verified by decide.

    lines 65–66

    uses op309_tri_tmpl_rich_of_four

      · intro e he
        refine op309_tri_tmpl_rich_of_four G c e s(u,v) s(v,y) s(u,w) s(w,z) 2 0 3 1 (by decide) ?_
  8. Every edge f adjacent to e = s(v, w) is one of s(u, v), s(v, y), s(u, w), s(w, z) and has color 2, 0, 3, 1, respectively.

    By op309_tri_tmpl_adj_cases, f must meet v at a neighbor t ≠ w, or meet w at a neighbor t ≠ v. If f meets v, the neighbors of v are u, w, y by hv; since t ≠ w, t is either u (yielding f = s(v, u) = s(u, v) by Sym2.eq_swap, with color 2 by h0 and Or.inl) or y (yielding f = s(v, y) with color 0 by h4 and Or.inr). If f meets w, the neighbors of w are u, v, z by hw; since t ≠ v, t is either u (yielding f = s(w, u) = s(u, w) by Sym2.eq_swap, with color 3 by h1 and Or.inr) or z (yielding f = s(w, z) with color 1 by h5 and Or.inr).

    lines 67–78

    uses op309_tri_tmpl_adj_cases, Sym2.eq_swap, Or.inl, Or.inr

        intro f hf
        obtain ⟨t, ⟨ht, htq, hft⟩ | ⟨ht, htq, hft⟩⟩ := op309_tri_tmpl_adj_cases G e f v w he hf
        · rcases (hv t).mp ht with h | h | h <;> subst t
          · have : (f : Sym2 V) = s(u, v) := hft.trans Sym2.eq_swap
            exact Or.inl ⟨this, h0 f this⟩
          · exact absurd rfl htq
          · exact Or.inr (Or.inl ⟨hft, h4 f hft⟩)
        · rcases (hw t).mp ht with h | h | h <;> subst t
          · have : (f : Sym2 V) = s(u, w) := hft.trans Sym2.eq_swap
            exact Or.inr (Or.inr (Or.inl ⟨this, h1 f this⟩))
          · exact absurd rfl htq
          · exact Or.inr (Or.inr (Or.inr ⟨hft, h5 f hft⟩))
SimpleGraph.lineGraph_adj_iff_exists
Two edges in a graph are adjacent in the line graph if and only if they are distinct and share at least one vertex.
Sym2.mem_iff
A vertex belongs to the unordered pair s(b, c) if and only if it equals b or equals c.
Sym2.mem_iff_exists.mp
If an element belongs to an unordered pair, then that pair can be written as the unordered pair of that element and another element.
SimpleGraph.mem_edgeSet
An unordered pair s(v, w) is in the edge set of a graph if and only if v and w are adjacent in the graph.
Subtype.ext
Two elements of a subtype are equal if their underlying values are equal.
Sym2.eq_swap
The unordered pair s(a, b) equals s(b, a).
op309_tri_tmpl_rich_of_four
If all line-graph neighbors of an edge e come from a set of four edges having pairwise distinct colors, then e is rich.
op309_tri_tmpl_adj_cases
If an edge f is adjacent to e = s(p, q) in the line graph, then f connects p to some neighbor t ≠ q, or connects q to some neighbor t ≠ p.
Or.inl
Proves a disjunction a ∨ b given a proof of the left disjunct a.
Or.inr
Proves a disjunction a ∨ b given a proof of the right disjunct b.

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_tri_tmpl_adj_cases {V : Type*} (G : SimpleGraph V) (e f : G.edgeSet) (p q : V)    (he : (e : Sym2 V) = s(p, q)) (hadj : G.lineGraph.Adj e f) :    ∃ t, (G.Adj p t ∧ t ≠ q ∧ (f : Sym2 V) = s(p, t)) ∨         (G.Adj q t ∧ t ≠ p ∧ (f : Sym2 V) = s(q, t)) := by  rw [SimpleGraph.lineGraph_adj_iff_exists] at hadj  obtain ⟨hne, y, hye, hyf⟩ := hadj  rw [he, Sym2.mem_iff] at hye  obtain ⟨t, ht⟩ := Sym2.mem_iff_exists.mp hyf  have hft : G.Adj y t := by    have := f.2; rw [ht] at this; exact (SimpleGraph.mem_edgeSet G).mp this  refine ⟨t, ?_⟩  rcases hye with rfl | rfl  · left    refine ⟨hft, ?_, ht⟩    rintro rfl; exact hne (Subtype.ext (he.trans ht.symm))  · right    refine ⟨hft, ?_, ht⟩    rintro rfl; exact hne (Subtype.ext (he.trans (ht.trans Sym2.eq_swap).symm))theorem op309_tri_tmpl_rich_of_four {V : Type*} (G : SimpleGraph V) (c : G.edgeSet → Fin 5)    (e : G.edgeSet) (A B C D : Sym2 V) (a b c' d : Fin 5)    (hdist : a ≠ b ∧ a ≠ c' ∧ a ≠ d ∧ b ≠ c' ∧ b ≠ d ∧ c' ≠ d)    (h : ∀ f, G.lineGraph.Adj e f →      ((f : Sym2 V) = A ∧ c f = a) ∨ ((f : Sym2 V) = B ∧ c f = b) ∨      ((f : Sym2 V) = C ∧ c f = c') ∨ ((f : Sym2 V) = D ∧ c f = d)) :    simple_graph_edge_is_rich G c e := by  intro f f2 hf hg hfg hc  obtain ⟨d1, d2, d3, d4, d5, d6⟩ := hdist  rcases h f hf with ⟨fA, fa⟩ | ⟨fA, fa⟩ | ⟨fA, fa⟩ | ⟨fA, fa⟩ <;>  rcases h f2 hg with ⟨gA, ga⟩ | ⟨gA, ga⟩ | ⟨gA, ga⟩ | ⟨gA, ga⟩ <;>  first    | exact hfg (Subtype.ext (fA.trans gA.symm))    | (rw [fa, ga] at hc; first | exact absurd hc ‹_› | exact absurd hc.symm ‹_›)theorem op309_triangle_template_rich_pair    {V : Type*} [DecidableEq V] (G : SimpleGraph V)    (u v w x y z : V) (hdist : [u,v,w].Nodup)    (hx : x ∉ [u,v,w]) (hy : y ∉ [u,v,w]) (hz : z ∉ [u,v,w])    (hu : ∀ t, G.Adj u t ↔ t = v ∨ t = w ∨ t = x)    (hv : ∀ t, G.Adj v t ↔ t = u ∨ t = w ∨ t = y)    (hw : ∀ t, G.Adj w t ↔ t = u ∨ t = v ∨ t = z)    (c : G.edgeSet → Fin 5)    (h0 : ∀ e : G.edgeSet, e.1 = s(u,v) → c e = 2)    (h1 : ∀ e : G.edgeSet, e.1 = s(u,w) → c e = 3)    (h2 : ∀ e : G.edgeSet, e.1 = s(v,w) → c e = 4)    (h3 : ∀ e : G.edgeSet, e.1 = s(u,x) → c e = 0)    (h4 : ∀ e : G.edgeSet, e.1 = s(v,y) → c e = 0)    (h5 : ∀ e : G.edgeSet, e.1 = s(w,z) → c e = 1) :    (∀ e : G.edgeSet, e.1 = s(u,w) → simple_graph_edge_is_rich G c e) ∧    (∀ e : G.edgeSet, e.1 = s(v,w) → simple_graph_edge_is_rich G c e) := by  constructor  · intro e he    refine op309_tri_tmpl_rich_of_four G c e s(u,v) s(u,x) s(v,w) s(w,z) 2 0 4 1 (by decide) ?_    intro f hf    obtain ⟨t, ⟨ht, htq, hft⟩ | ⟨ht, htq, hft⟩⟩ := op309_tri_tmpl_adj_cases G e f u w he hf    · rcases (hu t).mp ht with h | h | h <;> subst t      · exact Or.inl ⟨hft, h0 f hft⟩      · exact absurd rfl htq      · exact Or.inr (Or.inl ⟨hft, h3 f hft⟩)    · rcases (hw t).mp ht with h | h | h <;> subst t      · exact absurd rfl htq      · have : (f : Sym2 V) = s(v, w) := hft.trans Sym2.eq_swap        exact Or.inr (Or.inr (Or.inl ⟨this, h2 f this⟩))      · exact Or.inr (Or.inr (Or.inr ⟨hft, h5 f hft⟩))  · intro e he    refine op309_tri_tmpl_rich_of_four G c e s(u,v) s(v,y) s(u,w) s(w,z) 2 0 3 1 (by decide) ?_    intro f hf    obtain ⟨t, ⟨ht, htq, hft⟩ | ⟨ht, htq, hft⟩⟩ := op309_tri_tmpl_adj_cases G e f v w he hf    · rcases (hv t).mp ht with h | h | h <;> subst t      · have : (f : Sym2 V) = s(u, v) := hft.trans Sym2.eq_swap        exact Or.inl ⟨this, h0 f this⟩      · exact absurd rfl htq      · exact Or.inr (Or.inl ⟨hft, h4 f hft⟩)    · rcases (hw t).mp ht with h | h | h <;> subst t      · have : (f : Sym2 V) = s(u, w) := hft.trans Sym2.eq_swap        exact Or.inr (Or.inr (Or.inl ⟨this, h1 f this⟩))      · exact absurd rfl htq      · exact Or.inr (Or.inr (Or.inr ⟨hft, h5 f hft⟩))
See it in the graphDiscuss this resultChallenge it