AFTD Auto-Formalizing Theoretical Domains

rational_matrix_max_denominator

def

For a natural number n and a rational matrix P : Matrix (Fin n) (Fin n) ℚ, rational_matrix_max_denominator P is the maximum of 1 and all entry denominators (P i j).den for (i, j) : Fin n × Fin n, computed by folding max starting at 1 over Finset.univ.

Statement

def rational_matrix_max_denominator {n : ℕ} (P : Matrix (Fin n) (Fin n) ℚ) : ℕ
Defined in
arXiv:2610.08949
Verified
26 Oct 2026
Axioms
none listed
Used by 1

Read back from the Lean

For a natural number $n$ (implicit) and an $n \times n$ matrix $P$ with rational entries, rational_matrix_max_denominator P is defined as the natural number obtained by folding the binary operation max over the set of all index pairs $(i, j) \in \text{Fin } n \times \text{Fin } n$ with initial value $1$, where each pair $(i, j)$ is mapped to the denominator of the rational entry $P_{i, j}$ ((P i j).den). In other words, it is the maximum of $1$ and the denominators of all entries in $P$ (or $1$ if $n = 0$).

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 maximum denominator of the rational entries in transition matrix P. -/
def rational_matrix_max_denominator {n : ℕ} (P : Matrix (Fin n) (Fin n) ℚ) : ℕ := Finset.fold max 1 (fun (ij : Fin n × Fin n) => (P ij.1 ij.2).den) Finset.univ
See it in the graphDiscuss this resultChallenge it