Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Complete physical coefficient-list carry traversal with exact output and linear loop clock

Proved
IntMul.CarryBatch.carry_batch

by raresbuhai · Oct 10, 2026 · Mathlib 0df444a (Lean v4.33.1)

algorithmsfixed-tape-routinginteger-multiplicationturing-machines

Let x1,…,xmx_1,\ldots,x_mx1​,…,xm​ be binary coefficient words and yyy an incoming carry word, all of width n=val⁡(l)+1n=\operatorname{val}(l)+1n=val(l)+1. Write B=val⁡(z)+1B=\operatorname{val}(z)+1B=val(z)+1 and assume B≤n+1B\le n+1B≤n+1. From an explicit prepared caller configuration, a fixed fifteen-tape machine processes the entire coefficient list and halts in its exact terminal configuration after at most

m(41n+13B+21∣z∣+4∣l∣+126)+3m\bigl(41n+13B+21|z|+4|l|+126\bigr)+3m(41n+13B+21∣z∣+4∣l∣+126)+3

physical transitions. Its emitted low digits and retained final carry agree with the ordinary base-2B2^B2B carry scan. The input and accumulated output are retained with advanced cursors, descriptors and width templates are restored, and all temporary banks are empty with heads zero. The empty-list check and every coefficient restart are included in the bound. This result supplies the complete finite-state carry traversal needed after product coefficients have been generated; incoming data and descriptor preparation remain explicit caller obligations.

Preamble
import Definitions.Def_IntMul_CarryBatch
import Mathlib.Tactic
import Definitions.Def_IntMul_BinaryAdder
import Definitions.Def_IntMul_MultitapeModel
import Mathlib.Data.Nat.Bits
import Definitions.Def_IntMul_CarryNormalization

open IntMul IntMul.CarryBatch

Formal statement
theorem IntMul.CarryBatch.carry_batch (pre : List Bool) (xs : List (List Bool)) (a y z l : List Bool)
    (hy : y.length=val l+1) (hx : ∀ w ∈ xs, w.length=val l+1)
    (hB : CarryStep.blockSize z ≤ val l+2) :
    ∃ t : ℕ, t ≤ xs.length*(41*(val l+1)+13*CarryStep.blockSize z+21*z.length+4*l.length+126)+3 ∧
      machine.step^[t] (initialFrame pre xs a y z l)=finalFrame pre xs a y z l ∧
      (machine.step^[t] (initialFrame pre xs a y z l)).state=machine.qHalt ∧
      (scanWords z xs y).1=
        (CarryNormalization.scan (2^CarryStep.blockSize z) (xs.map val) (val y)).1.flatMap
          (fun d => (bin (CarryStep.blockSize z) d).reverse) ∧
      val (scanWords z xs y).2=
        (CarryNormalization.scan (2^CarryStep.blockSize z) (xs.map val) (val y)).2 := by sorry
Source
Original complete actual finite-state coefficient carry traversal. Privately owns setup, full loop configuration invariant, arithmetic restarts, exact boundary dispatches, linear clock summation, binary encoding and abstract carry-scan agreement. Written by Codex.

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