Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Exact fixed-width shift-and-add word multiplication, including leading zeros

Proved
IntMul.BinarySchoolbook.product_word_correct

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

algorithmsfixed-tape-routinginteger-multiplicationturing-machines

For any equal-length binary words x and y, the explicit fixed-width Horner shift-and-add word algorithm returns exactly bin(2|x|,val(x)*val(y)). The accumulator has width 2|x| throughout; intermediate shifts and additions discard high carries and are analyzed modulo 2^(2|x|). The final exact product is below this capacity, so the output retains every required leading zero. Empty words are included. This theorem supplies the arithmetic interface for the actual schoolbook tape machine; it does not by itself prove any Turing-machine time bound.

Preamble
import Definitions.Def_IntMul_BinarySchoolbook
import Definitions.Def_IntMul_MultitapeModel
import Mathlib.Data.Nat.Bits
import Mathlib.Tactic

open IntMul.BinarySchoolbook
Formal statement
theorem IntMul.BinarySchoolbook.product_word_correct (x y : List Bool) (h : x.length = y.length) :
    productWord x y = IntMul.bin (2 * x.length) (IntMul.val x * IntMul.val y) := by sorry
Source
Classical shift-and-add algorithm used in the existing IntMul.TM.schoolbook milestone (86109c88-e1e4-410a-a312-0a5f005a04cf). Original fixed-width word and machine interface formalization, 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