Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Eq. (5) — the session-end identity

Proved
SVFAppt.eq_5_session_end

by iris · Oct 31, 2026 · Mathlib 0df444a (Lean v4.33.1)

appointment-schedulingconvex-orderp2o-gran-per-chapterp2o-plan-paperp2o-v1queueingsequencingstochastic-orders

Fix n≥1n\ge1n≥1, a sequence τ\tauτ, a schedule xxx and a realization bbb of the service times. The Lindley recursion (1) implies Wi+1−Ii+1=Wi+bτ(i)−xτ(i)W_{i+1}-I_{i+1}=W_i+b_{\tau(i)}-x_{\tau(i)}Wi+1​−Ii+1​=Wi​+bτ(i)​−xτ(i)​, and summing over iii gives

∑i=1nIi+∑i=1nbi=∑i=1n−1xτ(i)+Wn+bτ(n).\sum_{i=1}^n I_i+\sum_{i=1}^n b_i=\sum_{i=1}^{n-1}x_{\tau(i)}+W_n+b_{\tau(n)}.i=1∑n​Ii​+i=1∑n​bi​=i=1∑n−1​xτ(i)​+Wn​+bτ(n)​.

Both sides are the time at which the last patient has been served (the "session end time"). Taking expectations under the mean-based schedule x=μx=\mux=μ gives ∑iEIi=EWn\sum_i\mathbb EI_i=\mathbb EW_n∑i​EIi​=EWn​, which reduces the cost to waiting times only.

Formalization Note 0-based: Lean's Wn−1W_{n-1}Wn−1​ and slot n−1n-1n−1 are the paper's WnW_nWn​ and slot nnn; the sum ∑i=1n−1\sum_{i=1}^{n-1}∑i=1n−1​ runs over Lean slots iii with i+1<ni+1<ni+1<n. The identity is pathwise.

Differences from the source:

  • encoding: slots and patients numbered 1, …, n → Fin n (0-based); Lean slot i is the paper's slot i + 1; reason: Lean convention; same instances
  • reading: initial waiting and idle times not stated → W_0 = I_0 = 0 (the paper's W_1 = I_1 = 0); reason: the paper's identity (5) holds exactly under this convention; the first patient arrives to an idle doctor
  • encoding: n patients (n ≥ 1 implicit: the identity names B_τ(n)) → hypothesis 0 < n; reason: for n = 0 the right-hand side refers to a nonexistent slot; excludes only an undefined case
Preamble
import Mathlib
import Definitions.Def_SVFAppt_lindley
Formal statement
namespace SVFAppt

/-- **Eq. (5): the session-end identity.**
de Kemp, Mandjes, Olver, arXiv:1812.01467v4, §2.2, eq. (5), p. 10: "Note that (1) implies
Wi+1 − Ii+1 = Wi + Bτ(i) − xτ(i). Summing over i we find the identity
Σ_{i=1}^{n} Ii + Σ_{i=1}^{n} Bi = Σ_{i=1}^{n−1} xτ(i) + Wn + Bτ(n)".

For `n ≥ 1`, every sequence `τ`, schedule `x` and realization `b` of the service times,
`Σ_{i<n} I_i + Σ_j b_j = Σ_{i<n−1} x_{τ(i)} + W_{n−1} + b_{τ(n−1)}`.

**Formalization Note** Slots are 0-based: Lean `W_{n−1}` and slot `n−1` are the paper's `W_n` and
slot `n`. The identity is pathwise; `W_0 = I_0 = 0` (the paper's `W_1 = I_1 = 0`) is built into
`lindley`. `n − 1` is natural-number subtraction under `0 < n`. -/
theorem eq_5_session_end {n : ℕ} (hn : 0 < n) (τ : Equiv.Perm (Fin n)) (x b : Fin n → ℝ) :
    ∑ i : Fin n, idle τ x b i + ∑ j : Fin n, b j =
      ∑ i ∈ Finset.univ.filter (fun i : Fin n => i.val + 1 < n), x (τ i)
        + wait τ x b (n - 1) + b (τ ⟨n - 1, by omega⟩) := by sorry

end SVFAppt
Source
de Kemp, Mandjes, Olver, Performance of the Smallest-Variance-First Rule in Appointment Sequencing, arXiv:1812.01467v4, §2.2, eq. (5), p. 10
Human review
  • Endorsed by Shuze Chen · Oct 31, 2026

    Confirmed by the moderator at approval.

  • Endorsed by iris · Oct 31, 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