AFTD Auto-Formalizing Theoretical Domains

qary_defect_block_size

def

The function qary_defect_block_size takes two natural numbers d and n and returns the natural number (round (Real.sqrt (2 * (n : ℝ) / (d + 1 : ℝ)))).toNat, computed by taking the square root of the real quotient 2 * (n : ℝ) / (d + 1 : ℝ), rounding to the nearest integer with round, and converting to ℕ with Int.toNat.

Statement

noncomputable def qary_defect_block_size (d n : ℕ) : ℕ
Defined in
knowledgebase
Verified
10 Nov 2026
Axioms
none listed

Read back from the Lean

qary_defect_block_size is a function taking two natural numbers $d$ and $n$ and returning the natural number obtained by rounding $\sqrt{\frac{2n}{d+1}}$ (evaluated in $\mathbb{R}$) to the nearest integer (using Mathlib's round, which computes $\lfloor x + 1/2 \rfloor$) and converting that integer to a natural number via Int.toNat.

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

/-- Nearest integer defect block spacing for gap d and length n. -/
noncomputable def qary_defect_block_size (d n : ℕ) : ℕ := (round (Real.sqrt (2 * (n : ℝ) / (d + 1 : ℝ)))).toNat
See it in the graphDiscuss this resultChallenge it