Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Bounded execution of fraction normalization

Proved
Lax109476Proofs.RamArithmetic.normalizeFraction_spec_native

by Shuze Chen · Nov 18, 2026 · Mathlib 0df444a (Lean v4.33.1)

algorithmscomputational-complexitygraph-theory

Let B,n,dB,n,dB,n,d be natural numbers with n<Bn<Bn<B, 0<d<B0<d<B0<d<B. Starting with numerator nnn and denominator ddd in the rational registers, the normalization command divides both by g=gcd⁡(n,d)g=\gcd(n,d)g=gcd(n,d). It terminates in at most 36size⁡(d)+1636\operatorname{size}(d)+1636size(d)+16 instructions and leaves

nout=n/g,dout=d/g.n_{\rm out}=n/g,\qquad d_{\rm out}=d/g.nout​=n/g,dout​=d/g.

This is a reusable source interface for composing the complete finite-program implementation.

Preamble
import Definitions.Def_EdgeSublinearMWIS_Main_NativeDetailedInterfaces
namespace Lax109476Proofs.RamArithmetic
end Lax109476Proofs.RamArithmetic
Formal statement
theorem Lax109476Proofs.RamArithmetic.normalizeFraction_spec_native : ∀ (B n d : Nat),
  @LT.lt Nat instLTNat n B →
    @LT.lt Nat instLTNat d B →
      @LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) d →
        Lax808846Proofs.Reasoning.Spec B
          (fun (σ : Lax808846Proofs.Imp.Env) => And (@Eq Nat (σ.vars "rat.n") n) (@Eq Nat (σ.vars "rat.d") d))
          Lax109476Proofs.RamArithmetic.normalizeFraction
          (fun (x σ' : Lax808846Proofs.Imp.Env) =>
            And (@Eq Nat (σ'.vars "rat.n") (@HDiv.hDiv Nat Nat Nat (@instHDiv Nat Nat.instDiv) n (n.gcd d)))
              (@Eq Nat (σ'.vars "rat.d") (@HDiv.hDiv Nat Nat Nat (@instHDiv Nat Nat.instDiv) d (n.gcd d))))
          (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat)
            (@HMul.hMul Nat Nat Nat (@instHMul Nat instMulNat)
              (@OfNat.ofNat Nat (nat_lit 36) (instOfNatNat (nat_lit 36))) d.size)
            (@OfNat.ofNat Nat (nat_lit 16) (instOfNatNat (nat_lit 16)))) := by sorry
Source
https://github.com/EdouardBonnet/lax-109476/blob/0a042604c7ae1ef4cd9a4c7d82eb902f313d4864/proofs/Lax109476Proofs/RamArithmetic.lean, theorem normalizeFraction_spec (lines 133–144)

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me