Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Correctness and running time of source field multiplication

Proved
ExpandingCodes.Computation.SourceFieldArithmetic.multiply_stops

by vigyan · Nov 15, 2026 · Mathlib 0df444a (Lean v4.33.1)

coding-theorycomplexity-theoryexpanding-codes-polynomial-stretch

Let ℓ>0\ell>0ℓ>0 and q=2ℓq=2^\ellq=2ℓ. Encode polynomials of degree below ℓ\ellℓ by integers below qqq. Let a,ba,ba,b be two such encodings and let μ<q\mu<qμ<q encode the lower coefficients of a monic polynomial pμp_\mupμ​ of degree ℓ\ellℓ. No irreducibility assumption on pμp_\mupμ​ is required.

Let sss be a store with RRR registers and BBB buffers, rrr an injective placement of a 27-register workspace, and III any input. Assume M≥1M\ge1M≥1, all registers are at most MMM, and workspace registers 0,1,3,19,23,240,1,3,19,23,240,1,3,19,23,24 contain a,b,q+μ,3ℓ+1,q,q2a,b,q+\mu,3\ell+1,q,q^2a,b,q+μ,3ℓ+1,q,q2, respectively. The multiplication program halts with

t≤10000(M+1)6,s′[r(20)]=enc⁡(a(X)b(X) mod pμ(X)).t\le10000(M+1)^6,\qquad s'[r(20)]=\operatorname{enc}\bigl(a(X)b(X)\bmod p_\mu(X)\bigr).t≤10000(M+1)6,s′[r(20)]=enc(a(X)b(X)modpμ​(X)).

Its entire final store is the specified multiplication-result store. The input and parameter registers above, registers outside the workspace, and all tape payload are preserved; every register remains at most MMM. For the canonical irreducible modulus this computes multiplication in the binary extension field. The general modular-polynomial contract is reusable by both algorithms.

Preamble
import Definitions.Def_ExpandingCodes_PolynomialStretch_BinaryRuntime

set_option autoImplicit false

open scoped Classical
open NKtLB
Formal statement
theorem ExpandingCodes.Computation.SourceFieldArithmetic.multiply_stops {R B : ℕ} (r : Fin 27 → Fin R) (hr : Function.Injective r)
    (inp : Inputs) (ell : ℕ) (h : 0 < ell) (m a b : Fin (2^ell))
    (M : ℕ) (hM : 1 ≤ M) (d : ExpandingCodes.Computation.TapeStore R B) (hd : ∀ j, d.reg j ≤ M)
    (ha : d.reg (r 0) = a.val) (hb : d.reg (r 1) = b.val)
    (hm : d.reg (r 3) = 2^ell+m.val) (hN : d.reg (r 19) = 3*ell+1)
    (hq : d.reg (r 23) = 2^ell) (hQ : d.reg (r 24) = 2^(2*ell)) :
    ∃ t e, t ≤ 10000*(M+1)^6 ∧
      (ExpandingCodes.Computation.SourceFieldArithmetic.multiply r).Stops inp (d.toCfg (ExpandingCodes.Computation.SourceFieldArithmetic.multiply (B := B) r).entry) t e ∧
      e.store = ExpandingCodes.Computation.SourceFieldArithmetic.multiplyResult r d ∧
      e.reg (r 20) = (ExpandingCodes.PolynomialStretch.BinaryField.multiplyIndex ell h m (ExpandingCodes.PolynomialStretch.BinaryPolynomial.indexEquiv ell a) (ExpandingCodes.PolynomialStretch.BinaryPolynomial.indexEquiv ell b)).val ∧
      (∀ i, i < 2 ∨ i = 3 ∨ i = 19 ∨ i = 23 ∨ i = 24 → e.reg (r i) = d.reg (r i)) ∧
      (∀ j, (∀ i, j ≠ r i) → e.reg j = d.reg j) ∧
      (∀ j, e.reg j ≤ M) ∧ ExpandingCodes.Computation.FieldConvolution.tapeData e.store = ExpandingCodes.Computation.FieldConvolution.tapeData d := by sorry
Source
Algorithmic supporting lemma for Section 2 of Isaac M Hair and Amit Sahai, Expanding Codes with Polynomial Stretch; the explicit tape-machine implementation is formalized in ExpandingCodes.Computation.SourceFieldArithmetic. Supporting formal implementation contract, rather than a verbatim statement in the paper. Exact local source: ExpandingCodes/Computation/SourceFieldArithmetic.lean, declaration ExpandingCodes.Computation.SourceFieldArithmetic.multiply_stops; source file SHA256 82fb97d5572b62ae185bb5c6e4cda9100cd6cbac79b43d2f1a3514ef69bc0b6a. The public construction is at https://prove2.me/missions/Expanding_Codes_with_Polynomial_Stretch.

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