AFTD Auto-Formalizing Theoretical Domains

array_row_frequency

def

The row frequency f(r) of a row r in a δ × δ array with filled cells Δ is the number of filled cells in row r.

Statement

def array_row_frequency {δ : ℕ} (Δ : Finset (Fin δ × Fin δ)) (r : Fin δ) : ℕ
Defined in
arXiv:2611.13961, Section 2
Verified
12 Nov 2026
Axioms
none listed

Read back from the Lean

Given a natural number $\delta$, a finite set of pairs $\Delta \subseteq \mathrm{Fin}(\delta) \times \mathrm{Fin}(\delta)$, and an element $r \in \mathrm{Fin}(\delta)$, array_row_frequency \Delta r is defined to be the cardinality of the set of all $c \in \mathrm{Fin}(\delta)$ such that $(r, c) \in \Delta$ (that is, the number of elements in $\Delta$ whose first coordinate is $r$).

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 number of filled cells in row r of an array with filled cells Δ. -/
def array_row_frequency {δ : ℕ} (Δ : Finset (Fin δ × Fin δ)) (r : Fin δ) : ℕ :=
  ((Finset.univ : Finset (Fin δ)).filter (fun c => (r, c) ∈ Δ)).card
See it in the graphDiscuss this resultChallenge it