Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proof of Theorem 5.2, Eq. (2) — the A-jobs before the B-job of a feasible schedule solve KNAPSACK

Proved
TwoAgentSched.Knapsack.eq_2

by mikedeng1 · Oct 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

knapsackp2o-batch-pfp2bp2o-gran-per-chapterp2o-plan-paperp2o-v1reductionschedulingtwo-agent

Let (u,w,b,W)(u,w,b,W)(u,w,b,W) be a KNAPSACK instance with nnn items such that

∑i=1nwiui>0,\sum_{i=1}^n w_iu_i>0,i=1∑n​wi​ui​>0,

and consider the two-agent instance of the proof of Theorem 5.2 (piA=uip^A_i=u_ipiA​=ui​, wiA=wiw^A_i=w_iwiA​=wi​, one BBB-job with p1B=w^u^p^B_1=\hat w\hat up1B​=w^u^, QB=b+p1BQ_B=b+p^B_1QB​=b+p1B​, QA=w^u^+(w^−W)p1BQ_A=\hat w\hat u+(\hat w-W)p^B_1QA​=w^u^+(w^−W)p1B​). If a sequence σ\sigmaσ of all n+1n+1n+1 jobs satisfies ∑iwiCiA(σ)≤QA\sum_iw_iC^A_i(\sigma)\le Q_A∑i​wi​CiA​(σ)≤QA​ and C1B(σ)≤QBC^B_1(\sigma)\le Q_BC1B​(σ)≤QB​, then the set SSS of indices of the AAA-jobs sequenced before the BBB-job satisfies

∑i∈Sui≤band∑i∈Swi≥W.\sum_{i\in S}u_i\le b\qquad\text{and}\qquad\sum_{i\in S}w_i\ge W .i∈S∑​ui​≤bandi∈S∑​wi​≥W.

This is the "schedule yes ⇒\Rightarrow⇒ KNAPSACK yes" direction of the reduction.

Formalization Note The hypothesis ∑iwiui>0\sum_iw_iu_i>0∑i​wi​ui​>0 is added: the strict inequalities of (2) need it. Without it the statement is false: for n=1n=1n=1, u1=0u_1=0u1​=0, w1=1w_1=1w1​=1, b=0b=0b=0, W=2W=2W=2 one gets p1B=0p^B_1=0p1B​=0, QA=QB=0Q_A=Q_B=0QA​=QB​=0, every sequence meets both thresholds, yet no subset has ∑i∈Swi≥2\sum_{i\in S}w_i\ge2∑i∈S​wi​≥2. Instances with ∑iwiui=0\sum_iw_iu_i=0∑i​wi​ui​=0 are handled separately by the reduction of Theorem 5.2.

Preamble
import Mathlib
import Definitions.Def_TwoAgentSched_Knapsack_Construction
Formal statement
namespace TwoAgentSched.Knapsack

/-- Proof of Theorem 5.2, Eq. (2) (Agnetis et al. 2004, p. 233): if `∑_i w_i u_i > 0` and a
sequence `l` of the constructed instance meets both thresholds `Q_A` and `Q_B`, then the set `S`
of A-jobs sequenced before the B-job solves KNAPSACK: `∑_{i∈S} u_i ≤ b` and `∑_{i∈S} w_i ≥ W`. -/
theorem eq_2 {n : ℕ} (u w : Fin n → ℕ) (b W : ℤ) (hpos : 0 < ∑ i, w i * u i)
    (l : List (Fin (construction u w).nA ⊕ Fin (construction u w).nB))
    (hl : (construction u w).Meets ((QA u w W : ℤ) : ℝ) ((QB u w b : ℤ) : ℝ) l) :
    ((∑ i ∈ Finset.univ.filter (fun i : Fin n => l.idxOf (aJob u w i) < l.idxOf (bJob u w)),
        u i : ℕ) : ℤ) ≤ b ∧
      W ≤ ((∑ i ∈ Finset.univ.filter (fun i : Fin n => l.idxOf (aJob u w i) < l.idxOf (bJob u w)),
        w i : ℕ) : ℤ) := by sorry

end TwoAgentSched.Knapsack
Source
Agnetis, Mirchandani, Pacciarelli & Pacifici, Scheduling Problems with Two Competing Agents, Oper. Res. 52(2) (2004), p. 233, proof of Theorem 5.2, Eq. (2)
Human review
  • Endorsed by Shuze Chen · Oct 8, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 8, 2026

    Confirmed by the mission captain (proposal self-audit).

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