Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Proposition 2 — algorithm AllocOpt solves the allocation optimization (7.22)

Proved
ServiceParts.Allocation.allocOpt_correct

by mikedeng1 · Sep 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

allocationgreedy-algorithmmarginal-analysisp2o-batch-b23ap2o-gran-per-chapterp2o-plan-bookp2o-v1separable-convex

Let the data of Section 7.4 satisfy its standing assumptions (see AllocData): locations M={1,…,Mˉ}M = \{1, \dots, \bar M\}M={1,…,Mˉ} with Mˉ≥1\bar M \ge 1Mˉ≥1, integer gridpoints 0=r0m<⋯<rn(m)m0 = r^m_0 < \cdots < r^m_{n(m)}0=r0m​<⋯<rn(m)m​ with n(m)≥1n(m) \ge 1n(m)≥1 for m∈Mm \in Mm∈M and 0=r00<⋯<rn(0)00 = r^0_0 < \cdots < r^0_{n(0)}0=r00​<⋯<rn(0)0​ for location 000, values cnmc^m_ncnm​ of convex functions at the gridpoints, the slopes c^nm\hat c^m_nc^nm​ of (7.19), the piecewise linear functions C~m\tilde C_mC~m​ of (7.20)–(7.21), and a convex function fff on R+\mathbb R_+R+​.

Then Algorithm AllocOpt (Definition 4), run with any rule for breaking ties in its arg⁡min⁡\arg\minargmin steps, terminates with values c0=(cn0)n∈N0c^0 = (c^0_n)_{n \in N_0}c0=(cn0​)n∈N0​​ that satisfy (7.22) for every n∈N0={0,1,…,n(0)}n \in N_0 = \{0, 1, \dots, n(0)\}n∈N0​={0,1,…,n(0)}:

cn0=f(rn0)+min⁡rm≥0, rm integer, ∀m∈M;∑m∈Mrm=rn0 ∑m∈MC~m(rm).c^0_n = f(r^0_n) + \min_{\substack{r_m \ge 0,\ r_m \text{ integer},\ \forall m \in M;\\ \sum_{m \in M} r_m = r^0_n}} \ \sum_{m \in M} \tilde C_m(r_m).cn0​=f(rn0​)+rm​≥0, rm​ integer, ∀m∈M;∑m∈M​rm​=rn0​​min​ m∈M∑​C~m​(rm​).

In words, marginal allocation — repeatedly giving the next block of units to the location whose current marginal cost c^n∗(m)m\hat c^m_{n^*(m)}c^n∗(m)m​ is smallest — solves the separable convex piecewise linear allocation problem exactly, simultaneously for every target total rn0r^0_nrn0​. In Section 7.3 this computes the nested cost functions (7.14), (7.15) and (7.17) of the multi-echelon pooling model.

Formalization Note The book's Proposition 2 also bounds the number of calculations by O((1+log⁡2Mˉ)∑m∈M0n(m))O\bigl((1 + \log_2 \bar M) \sum_{m \in M_0} n(m)\bigr)O((1+log2​Mˉ)∑m∈M0​​n(m)); that half is not stated (an operation count with no machine model). The minimum is stated as (a) some feasible integer allocation r=(rm)r = (r_m)r=(rm​) attains the value and (b) no feasible integer allocation has a smaller value. Termination is structural in Lean (see AllocOpt). The tie-breaking rule is universally quantified; the book leaves it open.

Preamble
import Mathlib
import Definitions.Def_ServiceParts_Allocation_AllocData
import Definitions.Def_ServiceParts_Allocation_AllocOpt
Formal statement
namespace ServiceParts.Allocation

/-- Muckstadt (2005), Proposition 2, p. 179 (correctness half): algorithm AllocOpt
(Definition 4) terminates with values `c^0_k` satisfying (7.22) for each `k ∈ N₀`:
`c^0_k = f(r^0_k) + min { Σ_{m ∈ M} Ĉ_m(r_m) : r_m ≥ 0 integer, Σ_{m ∈ M} r_m = r^0_k }`.
The minimum is stated as attainment plus lower bound. Termination is structural in Lean.
Stated for every tie-breaking rule of the arg min. -/
theorem allocOpt_correct {Mbar : ℕ} (d : AllocData Mbar) (hd : d.WellFormed)
    (sel : (Fin Mbar → ℝ) → Fin Mbar) (hsel : IsArgminRule sel)
    (k : ℕ) (hk : k ≤ d.n0) :
    (∃ r : Fin Mbar → ℕ, ∑ m, (r m : ℤ) = d.grid0 k ∧
        d.allocOpt sel k = d.f (d.grid0 k) + ∑ m, d.pwl m (r m)) ∧
      ∀ r : Fin Mbar → ℕ, ∑ m, (r m : ℤ) = d.grid0 k →
        d.allocOpt sel k ≤ d.f (d.grid0 k) + ∑ m, d.pwl m (r m) := by sorry

end ServiceParts.Allocation
Source
Muckstadt, Analysis and Algorithms for Service Parts Supply Chains, Springer 2005, DOI 10.1007/b138879, p. 179, Proposition 2 (first sentence), with Eq. (7.22) on p. 178 and Definition 4 on pp. 178-179
Human review
  • Endorsed by Shuze Chen · Oct 2, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 2, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me