Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The classical economic order quantity model

Definition
InventoryControl_eoq

by naimengye · Sep 18, 2026 · Mathlib 0df444a (Lean v4.33.1)

inventory-controllot-sizingoperations-researchoptimization

The model underlying the classical economic order quantity (EOQ) formula, in the notation of Axsäter, Inventory Control, Sect. 4.1.

A single item faces constant, continuous demand at rate ddd units per time unit. Stock is replenished in batches of a fixed size QQQ; each order costs a fixed ordering (setup) cost AAA regardless of its size, and carrying one unit for one time unit costs the holding cost hhh. Shortages are not allowed, the whole batch arrives at once, and QQQ need not be an integer. Because a batch is delivered exactly when the previous one runs out, the stock level is a sawtooth between QQQ and 000, so the average stock on hand is Q/2Q/2Q/2 and orders are placed at the average rate d/Qd/Qd/Q. The cost per time unit is therefore

C(Q)  =  Q2h+dQA,C(Q) \;=\; \frac{Q}{2}h + \frac{d}{Q}A,C(Q)=2Q​h+Qd​A,

which is eoqCost A d h Q. The economic order quantity

Q∗  =  2AdhQ^{*} \;=\; \sqrt{\frac{2Ad}{h}}Q∗=h2Ad​​

is eoq A d h.

The second pair of definitions is the finite production rate variant of Sect. 4.2. There the batch is not delivered all at once but produced continuously at rate p>dp > dp>d, so stock builds at rate p−dp - dp−d for a time Q/pQ/pQ/p and then drains at rate ddd. The peak stock is Q(1−d/p)Q(1 - d/p)Q(1−d/p) and the average stock Q(1−d/p)/2Q(1 - d/p)/2Q(1−d/p)/2, giving

Cp(Q)  =  Q(1−d/p)2h+dQA,Qp∗  =  2Adh(1−d/p),C_p(Q) \;=\; \frac{Q(1 - d/p)}{2}h + \frac{d}{Q}A, \qquad Q_p^{*} \;=\; \sqrt{\frac{2Ad}{h(1 - d/p)}} ,Cp​(Q)=2Q(1−d/p)​h+Qd​A,Qp∗​=h(1−d/p)2Ad​​,

which are eoqCostFinite A d h p Q and eoqFinite A d h p. Letting p→∞p \to \inftyp→∞ recovers the classical model.

These four definitions are the shared vocabulary of the whole Inventory Control series: the cost-ratio identity built on eoqCost reappears in the analysis of powers-of-two policies and in Roundy's approximation for multi-echelon systems.

Formalization Note All four are plain real-valued functions of real parameters, with no positivity built in; each theorem states the hypotheses (A,d,h>0A, d, h > 0A,d,h>0, and d<pd < pd<p where relevant) it needs. Division in Lean is total, so eoqCost A d h 0 evaluates to 0 rather than being undefined — every statement below quantifies over Q>0Q > 0Q>0 explicitly.

Definition code
import Mathlib

namespace InventoryControl

/-- Cost per time unit of ordering in batches of size `Q`, for a single item facing constant
continuous demand `d`, with ordering cost `A` and holding cost `h` per unit and time unit.
Axsäter, *Inventory Control*, Eq. (4.1): the average stock `Q / 2` times `h`, plus the average
number of orders per time unit `d / Q` times `A`. -/
noncomputable def eoqCost (A d h Q : ℝ) : ℝ := Q / 2 * h + d / Q * A

/-- The economic order quantity `√(2Ad/h)`. Axsäter, *Inventory Control*, Eq. (4.3). -/
noncomputable def eoq (A d h : ℝ) : ℝ := Real.sqrt (2 * A * d / h)

/-- Cost per time unit when the batch is produced continuously at the finite rate `p > d`
instead of being delivered all at once: the average stock is `Q * (1 - d / p) / 2`.
Axsäter, *Inventory Control*, Eq. (4.6). -/
noncomputable def eoqCostFinite (A d h p Q : ℝ) : ℝ := Q * (1 - d / p) / 2 * h + d / Q * A

/-- The optimal batch quantity under a finite production rate `p > d`,
`√(2Ad / (h(1 - d/p)))`. Axsäter, *Inventory Control*, Eq. (4.7). -/
noncomputable def eoqFinite (A d h p : ℝ) : ℝ := Real.sqrt (2 * A * d / (h * (1 - d / p)))

end InventoryControl
Source
Sven Axsäter, Inventory Control, 3rd ed., Springer 2015, DOI 10.1007/978-3-319-15729-0, Chapter 4 'Single-Echelon Systems: Deterministic Lot Sizing', Sect. 4.1 pp. 45-47 (Eq. 4.1, 4.3) and Sect. 4.2 pp. 48-49 (Eq. 4.6, 4.7)

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