Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Bounded execution of signed rational addition

Proved
Lax109476Proofs.RamRational.addFraction_spec_native

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

algorithmscomputational-complexitygraph-theory

Let xi=(−1)sini/dix_i=(-1)^{s_i}n_i/d_ixi​=(−1)si​ni​/di​, where si≤1s_i\le1si​≤1, ni,di≤Mn_i,d_i\le Mni​,di​≤M and di>0d_i>0di​>0. Assume 2M2+3<B2M^2+3<B2M2+3<B and that the operand registers contain these signed fractions. The fixed command returns a reduced representation of the exact result in at most 36size⁡(d1d2)+9636\operatorname{size}(d_1d_2)+9636size(d1​d2​)+96 instructions:

xout=x1+x2.x_{\rm out}=x_1+x_2.xout​=x1​+x2​.

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

Preamble
import Definitions.Def_EdgeSublinearMWIS_Main_NativeDetailedInterfaces
namespace Lax109476Proofs.RamRational
end Lax109476Proofs.RamRational
Formal statement
theorem Lax109476Proofs.RamRational.addFraction_spec_native : ∀ (B M s₁ n₁ d₁ s₂ n₂ 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 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 n₂ 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 (Lax109476Proofs.RamRational.fractionInputs s₁ n₁ d₁ s₂ n₂ d₂)
                      Lax109476Proofs.RamRational.addFraction
                      (fun (x σ' : Lax808846Proofs.Imp.Env) =>
                        Lax109476Proofs.RamRational.FractionOutput
                          (@HAdd.hAdd Rat Rat Rat (@instHAdd Rat Rat.instAdd)
                            (Lax109476Proofs.RamRational.fractionValue s₁ n₁ d₁)
                            (Lax109476Proofs.RamRational.fractionValue s₂ n₂ 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)))
                          (@HMul.hMul Nat Nat Nat (@instHMul Nat instMulNat) d₁ 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/RamRational.lean, theorem addFraction_spec (lines 177–209)

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