Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Bounded execution of rational downward grid rounding

Proved
Lax109476Proofs.RamRounding.roundFraction_spec_native

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

algorithmscomputational-complexitygraph-theory

Let x=(−1)sn/dx=(-1)^s n/dx=(−1)sn/d, with s≤1s\le1s≤1, n,d,D≤Mn,d,D\le Mn,d,D≤M and d,D>0d,D>0d,D>0. Under 2M2+3<B2M^2+3<B2M2+3<B, the operand and grid registers specify a fixed command returning downward rounding to the 1/D1/D1/D grid. Its cost is at most 36size⁡(D)+9636\operatorname{size}(D)+9636size(D)+96:

xout=⌊Dx⌋/D.x_{\rm out}=\lfloor Dx\rfloor/D.xout​=⌊Dx⌋/D.

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

Preamble
import Definitions.Def_EdgeSublinearMWIS_Main_NativeDetailedInterfaces
namespace Lax109476Proofs.RamRounding
end Lax109476Proofs.RamRounding
Formal statement
theorem Lax109476Proofs.RamRounding.roundFraction_spec_native : ∀ (B M s n d D : Nat),
  @LT.lt Nat instLTNat
      (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat)
        (@HMul.hMul Nat Nat Nat (@instHMul Nat instMulNat) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))
          (@HPow.hPow Nat Nat Nat (@instHPow Nat Nat (@NPow.toPow Nat (@Monoid.toNPow Nat Nat.instMonoid))) M
            (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))
        (@OfNat.ofNat Nat (nat_lit 3) (instOfNatNat (nat_lit 3))))
      B →
    @LE.le Nat instLENat s (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) →
      @LE.le Nat instLENat n M →
        @LE.le Nat instLENat d M →
          @LE.le Nat instLENat D M →
            @LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) d →
              @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 "left.s") s)
                      (And (@Eq Nat (σ.vars "left.n") n)
                        (And (@Eq Nat (σ.vars "left.d") d) (@Eq Nat (σ.vars "grid.D") D))))
                  Lax109476Proofs.RamRounding.roundFraction
                  (fun (x σ' : Lax808846Proofs.Imp.Env) =>
                    Lax109476Proofs.RamRational.FractionOutput
                      (Lax109476Proofs.RationalRounding.roundDown (Lax109476Proofs.RamRational.fractionValue s n d) 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 96) (instOfNatNat (nat_lit 96)))) := by sorry
Source
https://github.com/EdouardBonnet/lax-109476/blob/0a042604c7ae1ef4cd9a4c7d82eb902f313d4864/proofs/Lax109476Proofs/RamRounding.lean, theorem roundFraction_spec (lines 62–91)

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