Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 4.1(b) — optimal flows for linear latencies: ∑e∈P(2aefe∗+be)≤∑e∈P′(2aefe∗+be)\sum_{e\in P}(2a_ef^*_e+b_e)\le\sum_{e\in P'}(2a_ef^*_e+b_e)∑e∈P​(2ae​fe∗​+be​)≤∑e∈P′​(2ae​fe∗​+be​) on used paths

Proved
SelfishRouting.Linear.lemma_4_1_b

by mikedeng1 · Oct 7, 2026 · Mathlib 0df444a (Lean v4.33.1)

convex-optimizationlinear-latencyoptimal-flowp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1selfish-routing

Let every edge have a linear latency ℓe(x)=aex+be\ell_e(x)=a_ex+b_eℓe​(x)=ae​x+be​ with ae,be≥0a_e,b_e\ge 0ae​,be​≥0, let the rates be positive, and let the route incidences be 0/10/10/1. Then a flow f∗f^*f∗ is (globally) optimal, i.e. feasible with C(f∗)≤C(g)C(f^*)\le C(g)C(f∗)≤C(g) for every feasible ggg, if and only if f∗f^*f∗ is feasible and for each commodity iii and routes P,P′∈PiP,P'\in\mathcal P_iP,P′∈Pi​ with fP∗>0f^*_P>0fP∗​>0,

∑e∈P(2aefe∗+be)≤∑e∈P′(2aefe∗+be).\sum_{e\in P}\big(2a_ef^*_e+b_e\big)\le\sum_{e\in P'}\big(2a_ef^*_e+b_e\big).e∈P∑​(2ae​fe∗​+be​)≤e∈P′∑​(2ae​fe∗​+be​).

This is the first-order (Karush–Kuhn–Tucker) characterization of the convex quadratic program min⁡∑eaefe2+befe\min\sum_e a_ef_e^2+b_ef_emin∑e​ae​fe2​+be​fe​ over feasible flows: a flow is optimal exactly when it is at Nash equilibrium for the marginal costs ℓe∗(x)=2aex+be\ell^*_e(x)=2a_ex+b_eℓe∗​(x)=2ae​x+be​. Both directions are used in the proof of Theorem 4.5.

Formalization Note "Globally optimal" is optimality over all flows feasible for the same rates, not local optimality. The sums range over the edges with incidence 111 in each route; the page's ∑e∈P2aefe∗+be\sum_{e\in P}2a_ef^*_e+b_e∑e∈P​2ae​fe∗​+be​ means ∑e∈P(2aefe∗+be)\sum_{e\in P}(2a_ef^*_e+b_e)∑e∈P​(2ae​fe∗​+be​). Routes are 0/10/10/1 incidence columns (a disclosed generalization).

Preamble
import Mathlib
import Definitions.Def_KellyStochasticNetworks_Wardrop
import Definitions.Def_SelfishRouting_Linear_Model
import Definitions.Def_SelfishRouting_Linear_LinearLatency
Formal statement
namespace SelfishRouting.Linear

open KellyStochasticNetworks

/-- Lemma 4.1(b) (p. 15): with latencies `ℓ_e(x) = a_e x + b_e`, `a_e, b_e ≥ 0`, a flow is
(globally) optimal iff it is feasible and, for every commodity and routes `P, P'` serving it
with `f*_P > 0`, `∑_{e ∈ P} (2 a_e f*_e + b_e) ≤ ∑_{e ∈ P'} (2 a_e f*_e + b_e)`. -/
theorem lemma_4_1_b {J R Sd : ℕ} (A : Fin J → Fin R → ℝ) (hA : ∀ j r, A j r = 0 ∨ A j r = 1)
    (s : Fin R → Fin Sd) (rate : Fin Sd → ℝ) (hrate : ∀ i, 0 < rate i)
    (a b : Fin J → ℝ) (ha : ∀ j, 0 ≤ a j) (hb : ∀ j, 0 ≤ b j) (xstar : Fin R → ℝ) :
    IsOptimalFlow A s (linLatency a b) rate xstar ↔
      (xstar ∈ wardropFeasible s rate ∧
        ∀ P P' : Fin R, s P = s P' → 0 < xstar P →
          ∑ j ∈ Finset.univ.filter (fun j => A j P = 1), (2 * a j * linkFlow A xstar j + b j) ≤
            ∑ j ∈ Finset.univ.filter (fun j => A j P' = 1),
              (2 * a j * linkFlow A xstar j + b j)) := by sorry

end SelfishRouting.Linear
Source
Roughgarden & Tardos, How Bad is Selfish Routing?, J. ACM 49(2) (2002), author's manuscript of 5 Dec 2001, pp. 14–15, Lemma 4.1(b)
Human review
  • Endorsed by Shuze Chen · Oct 7, 2026

    Confirmed by the moderator at approval.

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