AFTD Auto-Formalizing Theoretical Domains

op_2282_exact_edge_localization_triangle_free

theoremverifiedformalization

Let G be a finite simple graph on vertex type V with at least two vertices and nonempty edgeFinset which is triangle-free (G.CliqueFree 3). In ℝ, the sum over all edges e ∈ G.edgeFinset of 1 / (SimpleGraph.turanGraph (Fintype.card V) (edge_max_clique_order G e)).edgeFinset.card is at most 1, with equality if and only if G is isomorphic to the Turán graph SimpleGraph.turanGraph (Fintype.card V) 2.

Statement

theorem op_2282_exact_edge_localization_triangle_free
    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
    (hn : 2 ≤ Fintype.card V) (hne : G.edgeFinset.Nonempty)
    (htf : G.CliqueFree 3) :
    (∑ e ∈ G.edgeFinset, (1 : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) (edge_max_clique_order G e)).edgeFinset.card ≤ 1) ∧
    ((∑ e ∈ G.edgeFinset, (1 : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) (edge_max_clique_order G e)).edgeFinset.card = 1) ↔
      Nonempty (G ≃g SimpleGraph.turanGraph (Fintype.card V) 2))
Formalizes
arXiv:2611.30029 after Theorem 1.4
Verified
25 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • edge_max_clique_orderFor a finite simple graph G and an edge e represented as an unordered pair in Sym2 V, edge_max_clique_order G e is the maximum cardinality…
  • edge_max_clique_order_ge_twoFor every edge e in the edge finset of a finite simple graph G, the maximum order of a clique containing e is at least two.

Read back from the Lean

For every finite type $V$ with decidable equality and every simple graph $G$ on $V$ with decidable adjacency: Assume: 1. $|V| \ge 2$ (2 ≤ Fintype.card V), 2. $G$ has at least one edge (G.edgeFinset.Nonempty), and 3. $G$ is triangle-free, i.e., contains no clique of size 3 (G.CliqueFree 3). Then: 1. The sum over all edges $e \in E(G)$ of $\frac{1}{|E(T(|V|, \omega(e)))|}$ is at most $1$, where $\omega(e)$ (edge_max_clique_order G e) is the maximum cardinality of a clique in $G$ containing both endpoints of $e$, and $T(|V|, k)$ (SimpleGraph.turanGraph (Fintype.card V) k) is the Turán graph on $|V|$ vertices with parameter $k$; and 2. This sum is equal to $1$ if and only if $G$ is isomorphic to the Turán graph $T(|V|, 2)$ (i.e., Nonempty (G ≃g SimpleGraph.turanGraph (Fintype.card V) 2)).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

The proof establishes the edge localization of Turán's theorem for triangle-free graphs (Mantel's theorem) by first showing that every edge is contained in a maximum clique of size exactly 2. This makes every term in the edge sum equal to the constant 1 / |E(T(|V|, 2))|, simplifying the entire sum to |E(G)| / |E(T(|V|, 2))|. The inequality and equality characterization then follow from Turán's theorem for K₃, which states that any triangle-free graph has at most |E(T(|V|, 2))| edges, with equality if and only if the graph is isomorphic to T(|V|, 2).

  1. For every edge e in G, the maximum clique order containing e is equal to 2.

    Every edge e has two endpoints forming a 2-clique, so the maximum clique order containing e is at least 2. On the other hand, since G is triangle-free (htf : G.CliqueFree 3), any clique containing e cannot have size 3 or more; hence every such clique has size at most 2. Combining these inequalities shows the maximum clique order is exactly 2.

    lines 9–23

    uses edge_max_clique_order_ge_two, Finset.sup_le, Finset.mem_filter, Finset.exists_subset_card_eq, Finset.coe_subset.mpr

      have _ := hn
      have h_clique_order : ∀ e ∈ G.edgeFinset, edge_max_clique_order G e = 2 := by
        intro e he
        have h2 : 2 ≤ edge_max_clique_order G e := edge_max_clique_order_ge_two G he
        have hle : edge_max_clique_order G e ≤ 2 := by
          unfold edge_max_clique_order
          refine Finset.sup_le ?_
          intro s hs
          simp only [Finset.mem_filter] at hs
          have hc := hs.2.1
          by_contra! h
          obtain ⟨t, hts, ht3⟩ := Finset.exists_subset_card_eq (by omega : 3 ≤ s.card)
          have htc : G.IsClique (t : Set V) := hc.subset (Finset.coe_subset.mpr hts)
          exact htf t ⟨htc, ht3⟩
        omega
  2. The sum over all edges of 1 / |E(T(|V|, ω(e)))| simplifies to |E(G)| / |E(T(|V|, 2))|.

    Since the maximum clique order ω(e) containing e is 2 for every edge, each term in the sum is the constant 1 / |E(T(|V|, 2))|. Summing this constant over all edges in G yields |E(G)| * (1 / |E(T(|V|, 2))|) = |E(G)| / |E(T(|V|, 2))|. Rewriting with this equality reduces both the inequality and the equality condition to comparing the edge count |E(G)| with |E(T(|V|, 2))|.

    lines 24–32

    uses Finset.sum_congr, Finset.sum_const, nsmul_eq_mul, mul_one_div

      have h_sum_eq : (∑ e ∈ G.edgeFinset, (1 : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) (edge_max_clique_order G e)).edgeFinset.card) =
          (G.edgeFinset.card : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card := by
        have h_terms : ∀ e ∈ G.edgeFinset,
            (1 : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) (edge_max_clique_order G e)).edgeFinset.card =
            (1 : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card := by
          intro e he
          rw [h_clique_order e he]
        rw [Finset.sum_congr rfl h_terms, Finset.sum_const, nsmul_eq_mul, mul_one_div]
      rw [h_sum_eq]
  3. G contains no complete subgraph on 3 vertices (K₃-free), and the extremal number ex(|V|, K₃) equals |E(T(|V|, 2))|.

    Graph G being clique-free of order 3 means it contains no complete graph ⊤ on Fin 3. By Turán's theorem for complete graphs, the maximum number of edges in a K₃-free graph on |V| vertices is the edge count of the Turán graph T(|V|, 3 - 1) = T(|V|, 2).

    lines 33–42

    uses Fintype.card_fin, SimpleGraph.cliqueFree_iff_top_free.mp, SimpleGraph.extremalNumber_top

      have h_top_free : (⊤ : SimpleGraph (Fin 3)).Free G := by
        have hc : Fintype.card (Fin 3) = 3 := Fintype.card_fin 3
        rw [← hc] at htf
        exact SimpleGraph.cliqueFree_iff_top_free.mp htf
      have h_ext : SimpleGraph.extremalNumber (Fintype.card V) (⊤ : SimpleGraph (Fin 3)) =
          (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card := by
        have := @SimpleGraph.extremalNumber_top (Fintype.card V) (Fin 3) _ _
        have hc : Fintype.card (Fin 3) - 1 = 2 := by decide
        rw [hc] at this
        exact this
  4. |E(G)| ≤ |E(T(|V|, 2))|, and |E(T(|V|, 2))| is strictly positive.

    Because G avoids K₃, its edge count |E(G)| is at most the extremal number ex(|V|, K₃) = |E(T(|V|, 2))|. Since G has at least one edge, |E(G)| > 0, which implies that |E(T(|V|, 2))| > 0 in ℕ and hence in ℝ.

    lines 43–50

    uses SimpleGraph.card_edgeFinset_le_extremalNumber, Finset.Nonempty.card_pos, lt_of_lt_of_le, Nat.cast_pos.mpr

      have h_le_card : G.edgeFinset.card ≤ (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card := by
        rw [← h_ext]
        exact SimpleGraph.card_edgeFinset_le_extremalNumber h_top_free
      have h_pos_T : 0 < (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card := by
        have h_pos_G : 0 < G.edgeFinset.card := Finset.Nonempty.card_pos hne
        exact lt_of_lt_of_le h_pos_G h_le_card
      have h_pos_T_real : (0 : ℝ) < (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card :=
        Nat.cast_pos.mpr h_pos_T
  5. |E(G)| = |E(T(|V|, 2))| if and only if G is isomorphic to T(|V|, 2).

    By the uniqueness of the extremal graph in Turán's theorem, a K₃-free graph achieves the maximum edge count |E(T(|V|, 2))| if and only if it is isomorphic to the Turán graph T(|V|, 2).

    lines 51–56

    uses SimpleGraph.card_edgeFinset_eq_extremalNumber_top_iff_nonempty_iso_turanGraph

      have h_card_iso : G.edgeFinset.card = (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card ↔
          Nonempty (G ≃g SimpleGraph.turanGraph (Fintype.card V) 2) := by
        have h_iso_thm := @SimpleGraph.card_edgeFinset_eq_extremalNumber_top_iff_nonempty_iso_turanGraph V _ G _ (Fin 3) _ _
        have hc : Fintype.card (Fin 3) - 1 = 2 := by decide
        rw [hc, h_ext] at h_iso_thm
        exact ⟨fun heq => h_iso_thm.mp ⟨h_top_free, heq⟩, fun h => (h_iso_thm.mpr h).2⟩
  6. The sum of 1 / |E(T(|V|, ω(e)))| is at most 1, with equality if and only if G is isomorphic to T(|V|, 2).

    Splitting into the inequality and the equivalence: since |E(T(|V|, 2))| > 0, the quotient |E(G)| / |E(T(|V|, 2))| is at most 1 because |E(G)| ≤ |E(T(|V|, 2))|. Similarly, the quotient equals 1 if and only if |E(G)| = |E(T(|V|, 2))|, which holds if and only if G is isomorphic to T(|V|, 2).

    lines 57–61

    uses div_le_one, Nat.cast_le.mpr, div_eq_one_iff_eq, Nat.cast_inj

      constructor
      · rw [div_le_one h_pos_T_real]
        exact Nat.cast_le.mpr h_le_card
      · rw [div_eq_one_iff_eq h_pos_T_real.ne']
        exact (Nat.cast_inj (R := ℝ)).trans h_card_iso
edge_max_clique_order_ge_two
Any edge in a graph is contained in a clique of order at least 2.
Finset.sup_le
The supremum of a function over a finite set is at most a given bound if each value is at most that bound.
Finset.mem_filter
An element is in a filtered finite set if and only if it belongs to the base set and satisfies the predicate.
Finset.exists_subset_card_eq
A finite set of size at least n contains a subset of size exactly n.
Finset.coe_subset.mpr
Subset inclusion of finite sets implies subset inclusion of their coerced sets.
Finset.sum_congr
Two finite sums are equal if their index sets are equal and their summands agree on every element.
Finset.sum_const
The sum of a constant value over a finite set equals the cardinality of the set scalar-multiplied by that value.
nsmul_eq_mul
Natural scalar multiplication n • a in a semiring is equal to multiplication by n.
mul_one_div
Multiplying x by 1 / y equals the quotient x / y.
Fintype.card_fin
The cardinality of Fin n is n.
SimpleGraph.cliqueFree_iff_top_free.mp
A graph is clique-free of order |α| if and only if it contains no induced subgraph isomorphic to the complete graph ⊤ on α.
SimpleGraph.extremalNumber_top
The extremal number of edges on n vertices avoiding the complete graph on α is the number of edges in the Turán graph T(n, |α| - 1).
SimpleGraph.card_edgeFinset_le_extremalNumber
If a graph G avoids H as a subgraph, the number of edges of G is at most the extremal number of H on |V| vertices.
Finset.Nonempty.card_pos
A nonempty finite set has strictly positive cardinality.
lt_of_lt_of_le
In a preorder, if a < b and b ≤ c, then a < c.
Nat.cast_pos.mpr
A positive natural number casts to a positive real number.
SimpleGraph.card_edgeFinset_eq_extremalNumber_top_iff_nonempty_iso_turanGraph
A K_{|α|}-free graph achieves the extremal number of edges if and only if it is isomorphic to the Turán graph T(|V|, |α| - 1).
div_le_one
For b > 0, the quotient a / b is at most 1 if and only if a ≤ b.
Nat.cast_le.mpr
If m ≤ n for natural numbers, then their casts to the real numbers satisfy the same inequality.
div_eq_one_iff_eq
For b ≠ 0, the quotient a / b equals 1 if and only if a = b.
Nat.cast_inj
The cast from ℕ to ℝ is injective: ↑m = ↑n if and only if m = n.

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

/-- The exact edge localization of Turan's theorem holds for all triangle-free graphs (Mantel's theorem case). -/theorem op_2282_exact_edge_localization_triangle_free    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]    (hn : 2 ≤ Fintype.card V) (hne : G.edgeFinset.Nonempty)    (htf : G.CliqueFree 3) :    (∑ e ∈ G.edgeFinset, (1 : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) (edge_max_clique_order G e)).edgeFinset.card ≤ 1) ∧    ((∑ e ∈ G.edgeFinset, (1 : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) (edge_max_clique_order G e)).edgeFinset.card = 1) ↔      Nonempty (G ≃g SimpleGraph.turanGraph (Fintype.card V) 2)) := by  have _ := hn  have h_clique_order : ∀ e ∈ G.edgeFinset, edge_max_clique_order G e = 2 := by    intro e he    have h2 : 2 ≤ edge_max_clique_order G e := edge_max_clique_order_ge_two G he    have hle : edge_max_clique_order G e ≤ 2 := by      unfold edge_max_clique_order      refine Finset.sup_le ?_      intro s hs      simp only [Finset.mem_filter] at hs      have hc := hs.2.1      by_contra! h      obtain ⟨t, hts, ht3⟩ := Finset.exists_subset_card_eq (by omega : 3 ≤ s.card)      have htc : G.IsClique (t : Set V) := hc.subset (Finset.coe_subset.mpr hts)      exact htf t ⟨htc, ht3⟩    omega  have h_sum_eq : (∑ e ∈ G.edgeFinset, (1 : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) (edge_max_clique_order G e)).edgeFinset.card) =      (G.edgeFinset.card : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card := by    have h_terms : ∀ e ∈ G.edgeFinset,        (1 : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) (edge_max_clique_order G e)).edgeFinset.card =        (1 : ℝ) / (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card := by      intro e he      rw [h_clique_order e he]    rw [Finset.sum_congr rfl h_terms, Finset.sum_const, nsmul_eq_mul, mul_one_div]  rw [h_sum_eq]  have h_top_free : (⊤ : SimpleGraph (Fin 3)).Free G := by    have hc : Fintype.card (Fin 3) = 3 := Fintype.card_fin 3    rw [← hc] at htf    exact SimpleGraph.cliqueFree_iff_top_free.mp htf  have h_ext : SimpleGraph.extremalNumber (Fintype.card V) (⊤ : SimpleGraph (Fin 3)) =      (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card := by    have := @SimpleGraph.extremalNumber_top (Fintype.card V) (Fin 3) _ _    have hc : Fintype.card (Fin 3) - 1 = 2 := by decide    rw [hc] at this    exact this  have h_le_card : G.edgeFinset.card ≤ (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card := by    rw [← h_ext]    exact SimpleGraph.card_edgeFinset_le_extremalNumber h_top_free  have h_pos_T : 0 < (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card := by    have h_pos_G : 0 < G.edgeFinset.card := Finset.Nonempty.card_pos hne    exact lt_of_lt_of_le h_pos_G h_le_card  have h_pos_T_real : (0 : ℝ) < (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card :=    Nat.cast_pos.mpr h_pos_T  have h_card_iso : G.edgeFinset.card = (SimpleGraph.turanGraph (Fintype.card V) 2).edgeFinset.card ↔      Nonempty (G ≃g SimpleGraph.turanGraph (Fintype.card V) 2) := by    have h_iso_thm := @SimpleGraph.card_edgeFinset_eq_extremalNumber_top_iff_nonempty_iso_turanGraph V _ G _ (Fin 3) _ _    have hc : Fintype.card (Fin 3) - 1 = 2 := by decide    rw [hc, h_ext] at h_iso_thm    exact ⟨fun heq => h_iso_thm.mp ⟨h_top_free, heq⟩, fun h => (h_iso_thm.mpr h).2⟩  constructor  · rw [div_le_one h_pos_T_real]    exact Nat.cast_le.mpr h_le_card  · rw [div_eq_one_iff_eq h_pos_T_real.ne']    exact (Nat.cast_inj (R := ℝ)).trans h_card_iso
See it in the graphDiscuss this resultChallenge it