Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

A finite stack program writes a tagged PARTITION weight in linear time

Proved
TwoAgentSched.TotalTotal.stack_tagged_gadget_exec

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

complexity-theorypartitionstack-programtwo-agent-scheduling

Given the canonical binary code of a positive integer mmm and two counter stacks of lengths iii and ddd, the finite stack program PPP halts after exactly 5i+5d+95i+5d+95i+5d+9 source-program steps. It consumes both counters and leaves the output stack containing

enc⁡ ⁣(2(4i+d+1m+4i)).\operatorname{enc}\!\left(2(4^{i+d+1}m+4^i)\right).enc(2(4i+d+1m+4i)).

This is one explicit, linearly bounded component of the distinct-even PARTITION gadget used in the scheduling encoding reduction. The counters must already be available and the initial output must already contain the canonical code of mmm. The result does not assert that a complete reduction transducer, including parsing, sorting, and threshold computation, has been constructed.

Formalization Note The first two stacks supply the counter lengths, their symbol values being immaterial. The third stack starts with the separator-terminated least-significant-bit-first code.

Preamble
import Mathlib
import Definitions.Def_TwoAgentSched_TotalTotal_StackTaggedOutput
Formal statement
namespace TwoAgentSched.TotalTotal

open CookPvsNP ProjSchedTW.Complexity StackTaggedOutput

theorem stack_tagged_gadget_exec (i d : List BSym) (m : ℕ) (hm : 0 < m) :
    taggedOutput.Exec (store i d (encNat m))
      (store [] [] (encNat (2 * (4 ^ (i.length + d.length + 1) * m + 4 ^ i.length))))
      (5 * i.length + 5 * d.length + 9) := by sorry

end TwoAgentSched.TotalTotal
Source
Agnetis, Mirchandani, Pacciarelli and Pacifici, Scheduling Problems with Two Competing Agents, Operations Research 52(2), 2004, Theorem 9.2 and proof, pp. 237–238. The distinct-even PARTITION gadget and this explicit stack-program component are additional supporting constructions, not claims stated in the paper.

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