Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Successful canonical block parses have an exact natural-number encoding

Proved
CookPvsNP.CanonicalBlockParser.success_exact_shape

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

complexity-theorycomputation

If the canonical block parser halts with a successful top status marker, then its input consists of the canonical encoding of a natural number followed by the returned unread tail. The returned digit stack is exactly the reversed canonical binary digits of that number, and the second status marker confirms that a separator was read. This holds for every execution, including executions started on malformed input.

Preamble
import Definitions.Def_CookPvsNP_CanonicalBlockParser
open CookPvsNP ProjSchedTW.Complexity
Formal statement
namespace CookPvsNP.CanonicalBlockParser

theorem success_exact_shape (input status rest digits markerTail : List BSym) (steps : ℕ)
    (h : CookPvsNP.CanonicalBlockParser.parseCanonicalBlockProg.Exec
      (CookPvsNP.CanonicalBlockParser.store input [] status)
      (CookPvsNP.CanonicalBlockParser.store rest digits (.one :: markerTail)) steps) :
    ∃ n : ℕ, input = encNat n ++ rest ∧
      digits = (n.bits.map (fun b ↦ if b then BSym.one else BSym.zero)).reverse ∧
      markerTail = .one :: status := by
  sorry

end CookPvsNP.CanonicalBlockParser

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