Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Finite tape simulation of a RAM multiplication instruction

Proved
Lax759944Proofs.RamToTM.finite_mul_instruction

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

algorithmscomputational-complexity

Fix a finite RAM program, an instruction-argument bound, a word width www, and a normalized sparse memory. Suppose the fetched instruction is multiplication by an operand with value vvv. Assume w>0w>0w>0. The finite local tape interpreter executes this instruction and returns to the next fetch boundary with accumulator

a′=a v(mod2w).a\prime=a\,v\pmod{2^w}.a′=av(mod2w).

The dispatch-state projection is preserved, the other encoded RAM fields are unchanged, and the number of actual local transitions is at most mulInstructionBound⁡(w,m)+3\operatorname{mulInstructionBound}(w,m)+3mulInstructionBound(w,m)+3.

This instruction theorem is reusable in finite simulation of any RAM program. Natural division includes its zero-divisor convention.

Preamble
import Definitions.Def_EdgeSublinearMWIS_Main_NativeSchemeInterfaces
Formal statement
theorem Lax759944Proofs.RamToTM.finite_mul_instruction : ∀ {p : Lax759944Proofs.Microcode.Program} {N pc w : ℕ} (hbound : Lax759944Proofs.RamToTM.programArgumentBound p ≤ N)
  (o : Lax759944Proofs.Microcode.Op),
  p[pc]? = Option.some (Lax759944Proofs.Microcode.Instr.mul o) →
    0 < w →
      ∀ (s : Lax759944Proofs.RamToTM.SparseState),
        Lax759944Proofs.RamToTM.SparseMemory.Normalized w s.mem →
          ∀ (state : Lax759944Proofs.RamToTM.FullInterpreterState N),
            ∃ steps ≤ Lax759944Proofs.RamToTM.mulInstructionBound w s.mem + 3,
              ∃ finalState,
                Lax759944Proofs.RamToTM.FullInterpreterState.dispatchLens.get finalState =
                    Lax759944Proofs.RamToTM.FullInterpreterState.dispatchLens.get state ∧
                  (fun x =>
                          x.bind
                            (Turing.TM2.step (Lax759944Proofs.RamToTM.finiteInterpreterProgram p N hbound)))^[steps]
                      (Option.some
                        (Lax759944Proofs.RamToTM.finiteInterpreterCfg
                          (Lax759944Proofs.RamToTM.FiniteInterpreterLabel.fetch (Lax759944Proofs.RamToTM.boundPC p pc))
                          state (Lax759944Proofs.RamToTM.coreStacks w s))) =
                    Option.some
                      (Lax759944Proofs.RamToTM.finiteInterpreterCfg
                        (Lax759944Proofs.RamToTM.FiniteInterpreterLabel.fetch
                          (Lax759944Proofs.RamToTM.nextPC p (Lax759944Proofs.RamToTM.boundPC p pc)))
                        finalState
                        (Lax759944Proofs.RamToTM.coreStacks w
                          { pc := s.pc, acc := s.acc * Lax759944Proofs.RamToTM.sparseValue w o s.mem % 2 ^ w,
                            mem := s.mem, inp := s.inp, out := s.out })) := by sorry
Source
https://github.com/szymtor/RAM-TM/blob/134e398cef46599371df99f10c9007bc34ba3868/proofs/Lax759944Proofs/RamToTM/FiniteSimulation.lean, theorem finite_mul_instruction

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