Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Literal saved-template counter reset in 2w+2 transitions

Proved
IntMul.CountedStream.template_reset_correct

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

algorithmsfixed-tape-routinginteger-multiplicationturing-machines

For any base configuration and two equal-width binary words of width w, the literal counted-stream machine, started in its resetLeft state with heads on the least significant counter and template cells, is exactly in its halted reset frame after 2w+2 transitions. Both working tapes then contain the original template word between unchanged separators, and both work heads are restored to the original least-significant position. The input and output tapes and their heads are exactly preserved from the arbitrary base configuration. The result includes width zero (adjacent delimiters). This establishes the physical saved-template reset and charges its head returns; full counted-stream setup, payload, and dispatch composition are separate obligations.

Preamble
import Definitions.Def_IntMul_CountedStream
import Mathlib.Data.List.GetD
import Mathlib.Tactic
Formal statement
theorem IntMul.CountedStream.template_reset_correct (base : IntMul.CountedStream.machine.Cfg) (bits template : List Bool)
    (h : bits.length = template.length) :
    IntMul.CountedStream.machine.step^[2 * bits.length + 2]
      (IntMul.CountedStream.resetFrame base .resetLeft bits template (bits.length + 1)) =
        IntMul.CountedStream.resetFrame base .halt template template (template.length + 1) := by sorry
Source
Counter arithmetic and amortized decrement analysis adapted from CrocSwap/integer-mult-bounds at 3b6b66891c0ac888521cf591fe306c6286601d4f, research/machine-transfer-verification/stream-transfer/counters/CounterArithmetic.lean and RippleCounter.lean (Apache-2.0). https://github.com/CrocSwap/integer-mult-bounds/tree/3b6b66891c0ac888521cf591fe306c6286601d4f/research/machine-transfer-verification/stream-transfer/counters . Their README explicitly leaves payload/reset/dispatcher composition outside its cost theorem. This finite table implements those phases in the campaign’s one-sided MultitapeTM model, reversing the counter orientation to fit the big-endian input descriptor. No claim is made of a new counter algorithm.

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