AFTD Auto-Formalizing Theoretical Domains

graphNumCollinearTriples

def

The number of collinear triples of a finite simple graph G is the number of 3-element subsets of vertices that are collinear according to IsCollinearTriple.

Statement

open scoped Classical in
noncomputable def graphNumCollinearTriples {V : Type*} [Fintype V] (G : SimpleGraph V) : ℕ
Defined in
arXiv:2610.39966 Section 2
Verified
02 Nov 2026
Axioms
none listed
Built on 1
  • IsCollinearTripleA set T of vertices in a simple graph G is collinear if there exist three pairwise distinct vertices x, y, z in T such that G.dist x y +…

Read back from the Lean

Given a finite type V and a simple graph G on V, graphNumCollinearTriples G is the number of 3-element subsets T of V that form a collinear triple with respect to G; that is, subsets T of size 3 for which there exist distinct vertices x, y, z ∈ T such that G.dist x y + G.dist y z = G.dist x z.

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

Lean source view module on GitHub

open scoped Classical in
/-- Number of collinear triples of distinct vertices in a finite simple graph. -/
noncomputable def graphNumCollinearTriples {V : Type*} [Fintype V] (G : SimpleGraph V) : ℕ :=
  (((Finset.univ : Finset V).powersetCard 3).filter (fun T => IsCollinearTriple G (T : Set V))).card
See it in the graphDiscuss this resultChallenge it