Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Section 4.3.1 — the externality decomposition of dW/dνrdW/d\nu_rdW/dνr​

Proved
KellyStochasticNetworks.queueing_network_delay_deriv

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

analysisoperations-researchqueueing-theorystochastic-networks

Consider an open network of queues in which a route is a set of queues a customer must traverse. Queue jjj has service rate φj\varphi_jφj​, customers on route rrr arrive at rate νr\nu_rνr​, and the mean sojourn time at queue jjj is 1/(φj−λj)1/(\varphi_j - \lambda_j)1/(φj​−λj​) with λj=∑r′:j∈r′νr′\lambda_j = \sum_{r' : j \in r'}\nu_{r'}λj​=∑r′:j∈r′​νr′​, which is the behaviour of a network of ⋅\cdot⋅/M/1 queues. If a unit delay of a customer on route rrr costs wrw_rwr​, the mean cost per unit time is

W(ν;φ)=∑rwr∑j∈rνrφj−λj.W(\nu;\varphi) = \sum_r w_r \sum_{j \in r}\frac{\nu_r}{\varphi_j - \lambda_j}.W(ν;φ)=r∑​wr​j∈r∑​φj​−λj​νr​​.

Suppose every queue is stable, λj<φj\lambda_j < \varphi_jλj​<φj​. Then WWW is differentiable in the arrival rate on route rrr, with

dWdνr  =  ∑j∈r[  wrφj−λj⏟delay the extra customer suffers at j  +  ∑r′:j∈r′νr′wr′(φj−λj)2⏟knock-on cost to everyone else through j  ].\frac{dW}{d\nu_r} \;=\; \sum_{j \in r}\left[\; \underbrace{\frac{w_r}{\varphi_j - \lambda_j}}_{\text{delay the extra customer suffers at } j} \;+\; \underbrace{\sum_{r' : j \in r'}\frac{\nu_{r'}w_{r'}}{(\varphi_j - \lambda_j)^2}}_{\text{knock-on cost to everyone else through } j} \;\right].dνr​dW​=j∈r∑​​delay the extra customer suffers at jφj​−λj​wr​​​​+knock-on cost to everyone else through jr′:j∈r′∑​(φj​−λj​)2νr′​wr′​​​​​.

This is an exact derivative, not an approximation, and its two terms separate the private cost from the externality: one extra customer on route rrr is delayed at each queue on its route, and it also delays every other customer passing through those queues. The decomposition is what licenses shifting traffic towards routes with smaller derivatives, and it is the same accounting that makes a marginal-cost toll align selfish routing with the social optimum.

Formalization Note The derivative in νr\nu_rνr​ is stated as an ordinary derivative of the function obtained by varying the rrr-th coordinate of ν\nuν and holding the others fixed, so no partial-derivative API is presupposed. Sums over the queues of a route are written as sums over all queues weighted by the incidence matrix, whose entries are 000 or 111. The stability hypothesis λj<φj\lambda_j < \varphi_jλj​<φj​ is what keeps every denominator away from zero.

Preamble
import Mathlib
import Definitions.Def_KellyStochasticNetworks_Wardrop
Formal statement
namespace KellyStochasticNetworks

theorem queueing_network_delay_deriv {J R : ℕ} (A : Fin J → Fin R → ℝ) (w ν : Fin R → ℝ)
    (φ : Fin J → ℝ) (hA : ∀ j r, A j r = 0 ∨ A j r = 1)
    (hstab : ∀ j, (∑ r', A j r' * ν r') < φ j) (r : Fin R) :
    HasDerivAt (fun t : ℝ => queueingCost A w (Function.update ν r t) φ)
      (∑ j, A j r * (w r / (φ j - ∑ r', A j r' * ν r')
        + ∑ r', A j r' * (ν r' * w r') / (φ j - ∑ r'', A j r'' * ν r'') ^ 2))
      (ν r) := by sorry

end KellyStochasticNetworks
Source
Kelly & Yudovina, Stochastic Networks, CUP 2014, p. 101 (PDF p. 109), section 4.3.1: 'dW/dnu_r = sum_{j in r} [ w_r/(phi_j - lambda_j) + sum_{r' : j in r'} nu_{r'} w_{r'}/(phi_j - lambda_j)^2 ], where the first term is the extra delay at queue j of another customer on route r and the second is the knock-on cost, or externality, to later customers on routes through j of another customer on route r. The expression gives the exact derivative.' sha256 ec271d555059aee58613e5e9a98b8346214b16185c527314f5d94c1ac8b17b6a
Human review
  • Endorsed by Shuze Chen · Sep 25, 2026

    Confirmed by the moderator at approval.

  • Endorsed by naimengye · Sep 25, 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