AFTD Auto-Formalizing Theoretical Domains

opl2_row_freq

def

Given a natural number n, an n × n partial array of pairs M : Fin n → Fin n → Option (Fin n × Fin n), and a row index r : Fin n, the row frequency opl2_row_freq M r is the cardinality of the finset of column indices c : Fin n such that M r c is not none.

Statement

def opl2_row_freq {n : ℕ} (M : Fin n → Fin n → Option (Fin n × Fin n)) (r : Fin n) : ℕ
Defined in
arXiv:2611.13961, Section 2
Verified
13 Nov 2026
Axioms
none listed

Read back from the Lean

Given a natural number $n$, a function $M : \text{Fin } n \to \text{Fin } n \to \text{Option } (\text{Fin } n \times \text{Fin } n)$, and a row index $r : \text{Fin } n$, opl2_row_freq is defined as the number of column indices $c : \text{Fin } n$ such that $M(r, c)$ is not none (that is, $(M(r, c)).\text{isSome}$ is true).

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 n × n partial array of pairs. -/
def opl2_row_freq {n : ℕ} (M : Fin n → Fin n → Option (Fin n × Fin n)) (r : Fin n) : ℕ :=
  (Finset.univ.filter (fun c : Fin n => (M r c).isSome)).card
See it in the graphDiscuss this resultChallenge it