AFTD Auto-Formalizing Theoretical Domains

digraph_in_degree

def

The in-degree of a vertex v in a finite directed graph D is the number of vertices u such that D.Adj u v.

Statement

def digraph_in_degree {V : Type*} [Fintype V] (D : Digraph V) [DecidableRel D.Adj] (v : V) : ℕ
Defined in
folklore
Verified
15 Nov 2026
Axioms
none listed
Used by 2

Read back from the Lean

The definition digraph_in_degree assigns to each vertex v : V in a directed graph D on a finite type V (with decidable adjacency relation D.Adj) the natural number given by the cardinality of the set of all vertices u : V such that D.Adj u v holds (i.e., the in-degree of v, counting vertices with a directed edge to v).

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

/-- The in-degree of a vertex in a finite directed graph. -/
def digraph_in_degree {V : Type*} [Fintype V] (D : Digraph V) [DecidableRel D.Adj] (v : V) : ℕ := (Finset.univ.filter (fun u => D.Adj u v)).card
See it in the graphDiscuss this resultChallenge it