Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Correctness of row-major stack lookup

Proved
TensorAdjacencyLookup8.lookupProg_exec

by kmehltretter82 · Nov 1, 2026 · Mathlib 0df444a (Lean v4.33.1)

complexity-theorycomputation

Let vvv be a natural number and let i,j<vi,j<vi,j<v. Given a length-v2v^2v2 list representing a matrix in row-major order, the fixed eight-stack program prepends the entry at offset iv+jiv+jiv+j to an arbitrary output tail. It preserves the matrix and unary dimension and index stacks, clears all scratch stacks, and terminates within 50(v+1)250(v+1)^250(v+1)2 structured-program steps.

Preamble
import Definitions.Def_TensorAdjacencyLookup8
open CookPvsNP ProjSchedTW.Complexity
Formal statement
theorem TensorAdjacencyLookup8.lookupProg_exec (v i j : ℕ) (data tail : List BSym)
    (hi : i < v) (hj : j < v) (hlen : data.length = v*v) :
    ∃ steps, steps ≤ 50*(v+1)^2 ∧
      TensorAdjacencyLookup8.lookupProg.Exec
        (TensorAdjacencyLookup8.store data (List.replicate v .one)
          (List.replicate i .one) (List.replicate j .one) tail [] [] [])
        (TensorAdjacencyLookup8.store data (List.replicate v .one)
          (List.replicate i .one) (List.replicate j .one)
          (data.getD (i*v+j) .zero :: tail) [] [] []) steps := by
  sorry

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