Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Classical (R,nQ)(R,nQ)(R,nQ) rules from compatible initializations

Definition
TwoStageRnQ_Rule

by Ming Hu · Nov 17, 2026 · Mathlib 0df444a (Lean v4.33.1)

inventoryoperations-researchstochastic-processes

Integer shorthands for classical controls and the operational class of classical (R,nQ)(R,nQ)(R,nQ) rules started from a compatible initialization, on the model TwoStageRnQ_Model.

For controls c=(R1,R2,Q,n,ρ)c=(R_1,R_2,Q,n,\rho)c=(R1​,R2​,Q,n,ρ) with 0≤ρ<Q0\le\rho<Q0≤ρ<Q (ρ\rhoρ is the remainder of the Stage-2 stock modulo QQQ), qZ, nZ, rZ, mZ, oZ are the integers QQQ, nnn, ρ\rhoρ, nQnQnQ and ℓ−ρ+(n−1)Q\ell-\rho+(n-1)Qℓ−ρ+(n−1)Q with ℓ=R2−R1\ell=R_2-R_1ℓ=R2​−R1​, and qc c is the pair of lot sizes (Q,nQ)(Q,nQ)(Q,nQ).

FollowsRnQ S π c says that the shipment policy π\piπ runs the classical rule with complete-lot matching from a compatible initialization: there is an integer process IP^1\widehat{IP}_1IP1​ (the nominal downstream position, that is, the actual position plus pending requests) such that, almost surely, for every t≥0t\ge0t≥0:

  1. IP2(0)−ρ≡IP^1(0)(modQ)IP_2(0)-\rho\equiv\widehat{IP}_1(0)\pmod QIP2​(0)−ρ≡IP1​(0)(modQ) (complete-lot pipelines and Stage-2 stock congruent to ρ\rhoρ);
  2. IP^1(t)+N(t)≡IP^1(0)+N(0)(modQ)\widehat{IP}_1(t)+N(t)\equiv\widehat{IP}_1(0)+N(0)\pmod QIP1​(t)+N(t)≡IP1​(0)+N(0)(modQ) (downstream requests come in lots of QQQ);
  3. nQnQnQ divides U2(t)−U2(0)U_2(t)-U_2(0)U2​(t)−U2​(0) (supplier orders come in lots of nQnQnQ);
  4. R2<IP2(t)≤R2+nQR_2<IP_2(t)\le R_2+nQR2​<IP2​(t)≤R2​+nQ;
  5. R1<IP^1(t)≤R1+QR_1<\widehat{IP}_1(t)\le R_1+QR1​<IP1​(t)≤R1​+Q;
  6. IP1(t)=min⁡{IP^1(t), IL2(t)−ρ}IP_1(t)=\min\{\widehat{IP}_1(t),\,IL_2(t)-\rho\}IP1​(t)=min{IP1​(t),IL2​(t)−ρ} (a request waits only when no complete lot is available).

Here IPi=xi+Ui−NIP_i=x_i+U_i-NIPi​=xi​+Ui​−N and IL2(t)=x2+U2(t−L2)−N(t)IL_2(t)=x_2+U_2(t-L_2)-N(t)IL2​(t)=x2​+U2​(t−L2​)−N(t).

Formalization Note The conditions are stated through positions, so they do not depend on the integer origins of the cumulative dispatch counts, and they are required almost surely. Every compatible initialization of Appendix A.2 together with the operating rule of Section 4.1 satisfies them, and so does the counter construction of eq. (A.6).

Definition code
import Definitions.Def_TwoStageRnQ_Model

/-!
# Classical `(R,nQ)` rules from compatible initializations

Definitions accompanying "A 5/3 Guarantee for Echelon Stock (R,nQ)
Policies in Two-Stage Stochastic Serial Systems" (manuscript `rq_167.tex`), Section 4 and
Appendices A.2-A.3, on the model `TwoStageRnQ_Model`.

For classical controls `c = (R₁, R₂, Q, n, ρ)` (`ρ < Q` is the remainder of the Stage-2 stock
modulo `Q`), `qZ, nZ, rZ, mZ, oZ` are the integers `Q, n, ρ, nQ, ℓ - ρ + (n - 1) Q` with
`ℓ = R₂ - R₁`, and `qc c = (Q, nQ)` are the two lot sizes.

`FollowsRnQ S π c` says that the shipment policy `π` operates the classical rule with complete-lot
matching from a compatible initialization. It is stated through positions, so it does not depend
on the integer origins chosen for the cumulative dispatch counts, and it is required almost
surely. There is an integer nominal downstream position `Î₁` (actual position plus pending
requests) such that, almost surely, for all `t ≥ 0`:
* the initial state is residue-compatible: `IP₂(0) - ρ ≡ Î₁(0) (mod Q)` (complete-lot pipelines and
  Stage-2 stock congruent to `ρ`);
* downstream requests come in lots of `Q`: `Î₁(t) + N(t) ≡ Î₁(0) + N(0) (mod Q)`;
* supplier orders come in lots of `nQ`;
* the Stage-2 position stays in `(R₂, R₂ + nQ]`;
* the nominal downstream position stays in `(R₁, R₁ + Q]`;
* complete-lot matching: `IP₁ = min(Î₁, IL₂ - ρ)` (a request waits only if no complete lot is
  available).
-/

open MeasureTheory

noncomputable section

namespace TwoStageRnQ

namespace Rule

/-- Downstream lot size `Q` as an integer. -/
def qZ (c : ClassicalControls) : ℤ := ((c.1.2.2.1 : ℕ) : ℤ)

/-- Upstream multiplier `n` as an integer. -/
def nZ (c : ClassicalControls) : ℤ := ((c.1.2.2.2.1 : ℕ) : ℤ)

/-- Upstream remainder `ρ` as an integer. -/
def rZ (c : ClassicalControls) : ℤ := ((c.1.2.2.2.2 : ℕ) : ℤ)

/-- Upstream lot size `m = nQ`. -/
def mZ (c : ClassicalControls) : ℤ := nZ c * qZ c

/-- Offset of the upstream counter, `ℓ - ρ + (n - 1) Q` with `ℓ = R₂ - R₁`. -/
def oZ (c : ClassicalControls) : ℤ := c.1.2.1 - c.1.1 - rZ c + (nZ c - 1) * qZ c

/-- The lot sizes `(Q, nQ)` of the classical rule. -/
def qc (c : ClassicalControls) : ℕ+ × ℕ+ := (c.1.2.2.1, c.1.2.2.2.1 * c.1.2.2.1)

/-- The shipment policy `π` follows the classical `(R, nQ)` rule with complete-lot matching from a
compatible initialization, for controls `c = (R₁, R₂, Q, n, ρ)` (see the module docstring). -/
def FollowsRnQ {P : Params} (S : DemandSpace P) (π : ShipmentPolicy P S) (c : ClassicalControls) :
    Prop :=
  ∃ Ihat : ℝ → S.Ω → ℤ, ∀ᵐ ω ∂S.ν,
    qZ c ∣ (π.x2 ω + π.U2 0 ω - S.N 0 ω) - rZ c - Ihat 0 ω ∧
    ∀ t : ℝ, 0 ≤ t →
      qZ c ∣ (Ihat t ω + S.N t ω) - (Ihat 0 ω + S.N 0 ω) ∧
      mZ c ∣ π.U2 t ω - π.U2 0 ω ∧
      (c.1.2.1 < π.x2 ω + π.U2 t ω - S.N t ω ∧ π.x2 ω + π.U2 t ω - S.N t ω ≤ c.1.2.1 + mZ c) ∧
      (c.1.1 < Ihat t ω ∧ Ihat t ω ≤ c.1.1 + qZ c) ∧
      π.x1 ω + π.U1 t ω - S.N t ω
        = min (Ihat t ω) (π.x2 ω + π.U2 (t - P.L2) ω - S.N t ω - rZ c)

end Rule

end TwoStageRnQ
Source
M. Hu, "A 5/3 Guarantee for Echelon Stock (R,nQ) Policies in Two-Stage Stochastic Serial Systems", manuscript rq_167.tex (Sept. 28, 2026 version); posted as arXiv:2609.06318. Section 4.1; Appendices A.2-A.3 (compatible initialization, Lemma A.2).

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