AFTD Auto-Formalizing Theoretical Domains

edges_ord_within

def

For a simple graph G and a finite subset S of vertices, the number of directed edges (ordered pairs of distinct adjacent vertices) spanned by S.

Statement

noncomputable def edges_ord_within {V : Type*} (G : SimpleGraph V) (S : Finset V) : ℕ
Defined in
scout/2610-24484-erd-h-o-s-gy-arf-as-balanced-five-colorings.md:1271
Verified
20 Oct 2026
Axioms
none listed
Used by 2

Read back from the Lean

Given a type V, a simple graph G on V, and a finite set of vertices S : Finset V, edges_ord_within G S is defined as the number of ordered pairs (u, v) in S.offDiag (i.e., pairs of distinct elements u, v ∈ S) such that u and v are adjacent in G. This corresponds to the number of ordered edges (or twice the number of undirected edges) of G with both endpoints in S.

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

/-- Number of ordered pairs of distinct adjacent vertices within a subset S. -/
noncomputable def edges_ord_within {V : Type*} (G : SimpleGraph V) (S : Finset V) : ℕ :=
  letI : DecidableRel G.Adj := Classical.decRel _
  (S.offDiag.filter (fun p => G.Adj p.1 p.2)).card
See it in the graphDiscuss this resultChallenge it