Continued fractions recover and from an approximation within
ProvedShorWiki.continued_fraction_recoversLet and be integers and let be a real number with
Then some convergent of the continued fraction expansion of equals
in lowest terms; that is, the continued fractions algorithm run on recovers both and .
This is the classical post-processing step that turns the measured approximation of a phase into the reduced fraction itself.
Formalization Note The article states the hypothesis with ; it is formalized with strict . With the statement fails for the standard continued fraction expansion used by Mathlib's Real.convergent: for and one has , but the convergents of are and , never . In the application the inequality is strict (milestone register size bound and ). The article's hypothesis " and are -bit integers" places no restriction and is omitted.
import Mathlib import Definitions.Def_ShorWiki_Defs open Matrix Kronecker
namespace ShorWiki
theorem continued_fraction_recovers (j r : ℕ) (hr : 0 < r) (φ : ℝ)
(h : |(j : ℝ) / r - φ| < 1 / (2 * (r : ℝ) ^ 2)) :
∃ m : ℕ, (Real.convergent φ m).num = ((j / Nat.gcd j r : ℕ) : ℤ) ∧
(Real.convergent φ m).den = r / Nat.gcd j r := by sorry
end ShorWiki
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.