Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Warehouse request queue: FIFO allocation and threshold dispatch

Definition
owmr_queue_engine

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

approximation-algorithmsinventoryinventory-theoryoperations-researchstochastic-control

This definition encodes the period-by-period mechanics shared by the FIFO policy (Definition 1) and the consolidation policy (Definition 2) once they have started. In each period ttt, after the scheduled receipts:

  1. each retailer iii applies its (si,Si)(s_i,S_i)(si​,Si​) rule to its inventory position including outstanding requests, P^i=Pi+Δi+Ri\widehat P_i=P_i+\Delta_i+R_iPi​=Pi​+Δi​+Ri​, where PiP_iPi​ is its net inventory plus stock in transit to it, Δi\Delta_iΔi​ the unallocated quantity of its requests, and RiR_iRi​ its reserve, the stock allocated to its requests but still held at the warehouse; if P^i≤si\widehat P_i\le s_iPi​≤si​ it requests Si−P^iS_i-\widehat P_iSi​−Pi​, and positive requests join the end of one first-in, first-out queue, simultaneous requests in increasing retailer index;
  2. the warehouse applies its (s0,S0)(s_0,S_0)(s0​,S0​) rule to W+O+∑i(Pi−ci)W+O+\sum_i(P_i-c_i)W+O+∑i​(Pi​−ci​), where WWW is warehouse stock, OOO supplier stock in transit, and cic_ici​ fixed centers; the order arrives L0L_0L0​ periods later (at once if L0=0L_0=0L0​=0), and each new request of a batch retailer receives an offset ϑ\varthetaϑ from an offset rule;
  3. the unallocated warehouse stock is allocated to the requests in queue order, the last one possibly in part;
  4. a request of a non-batch retailer ships each allocation at once, while a request of a batch retailer, of size QQQ, ships its whole reserve in a period in which its cumulative allocation rises to or past 3Qϑ/43Q\vartheta/43Qϑ/4, rises to or past 3Q(1+ϑ)/43Q(1+\vartheta)/43Q(1+ϑ)/4 when ϑ<1/3\vartheta<1/3ϑ<1/3, or reaches QQQ; all portions sent to one retailer in a period form one dispatch, which arrives LiL_iLi​ periods later (at once if Li=0L_i=0Li​=0);
  5. demand occurs.

The state also defines the starting step: the policy may append initial requests of prescribed sizes before running these rules.

Formalization Note The state records the unallocated warehouse stock, the retailer net inventories, the scheduled arrivals by period, and the queue, where each request carries its retailer, size, cumulative allocation, shipped quantity, offset, and creation period. Initial requests are not ordinary requests; ordinary requests are indexed j=1,2,…j=1,2,\dotsj=1,2,… in creation order. Tpipe=max⁡(L0,max⁡iLi)T_{\rm pipe}=\max(L_0,\max_iL_i)Tpipe​=max(L0​,maxi​Li​); every prescribed pipeline quantity arrives by period Tpipe−1T_{\rm pipe}-1Tpipe​−1.

Definition code
import Definitions.Def_owmr_single_location

/-!
# The warehouse request queue shared by the FIFO and consolidation policies

Source: M. Hu, "A 5/2 Guarantee for Echelon Stock (s,S) Policies in One-Warehouse
Multi-Retailer Systems": Definition 1 (ii)–(iii) (FIFO policy), Definition 2 (ii)–(iv)
(consolidation policy), Section 5.1, and Appendix C.2.

Both policies run the same mechanism once started. In each period `t`, after the scheduled
receipts:
1. each retailer `i` applies its `(s_i, S_i)` rule to its inventory position including
   outstanding requests, `P̂_i = P_i + Δ_i + R_i` (`P_i`: net inventory plus stock in transit to
   `i`; `Δ_i`: unallocated quantity of its requests; `R_i`: reserve, i.e. stock allocated to its
   requests but still held at the warehouse); if `P̂_i ≤ s_i` it requests `S_i - P̂_i`, and a
   positive request joins the end of one FIFO queue (requests of one period in increasing
   retailer index);
2. the warehouse applies its `(s₀, S₀)` rule to `W + O + ∑_i (P_i - c_i)` (`W`: warehouse stock,
   `O`: supplier stock in transit, `c_i`: the retailer centers); an order arrives `L₀` periods
   later (at once if `L₀ = 0`);
3. the unallocated warehouse stock is allocated to the requests in queue order, the last one
   possibly in part;
4. a request of a non-batch retailer ships every allocation at once; a request of a batch
   retailer, of size `Q` and offset `ϑ`, ships its whole reserve in a period in which its
   cumulative allocation rises to or past a dispatch threshold (`3Qϑ/4`, and also
   `3Q(1+ϑ)/4` if `ϑ < 1/3`) or reaches `Q`; all portions sent to one retailer in a period form
   one dispatch, which arrives `L_i` periods later (at once if `L_i = 0`);
5. demand occurs.
-/

open MeasureTheory
open scoped ENNReal NNReal

noncomputable section

namespace OWMR

variable {n : ℕ}

/-- A retailer request in the warehouse queue. -/
structure Req (n : ℕ) where
  /-- requesting retailer -/
  ret : Fin n
  /-- request size `Q` -/
  size : ℝ
  /-- cumulative allocation -/
  alloc : ℝ
  /-- quantity shipped so far -/
  shipped : ℝ
  /-- offset `ϑ` (used only for requests of batch retailers) -/
  offset : ℝ
  /-- creation period -/
  born : ℕ

/-- State of a policy at the start of a period, before receipts. -/
structure EngState (n : ℕ) where
  /-- whether the policy has started (preparation finished) -/
  running : Bool
  /-- unallocated warehouse stock -/
  Wbar : ℝ
  /-- retailer net inventories -/
  I : Fin n → ℝ
  /-- scheduled supplier arrivals, by arrival period -/
  supPipe : ℕ → ℝ
  /-- scheduled arrivals at each retailer, by arrival period -/
  retPipe : Fin n → ℕ → ℝ
  /-- FIFO queue of requests (head first) -/
  queue : List (Req n)
  /-- number of ordinary requests created so far -/
  nOrd : ℕ

/-- Parameters of the queue mechanism: retailer rules `(s_i, S_i)`, centers `c_i` in the supplier
position, batch flags, and the supplier rule `(s₀, S₀)`. -/
structure EngParams (n : ℕ) where
  s : Fin n → ℝ
  S : Fin n → ℝ
  center : Fin n → ℝ
  batch : Fin n → Bool
  s0 : ℝ
  S0 : ℝ

/-- An offset rule: given the state at creation, the period, the ordinary-request index `j`
(starting at `1`), the retailer, and the request size, returns the offset `ϑ`. -/
abbrev OffsetRule (n : ℕ) := EngState n → ℕ → ℕ → Fin n → ℝ → ℝ

/-- The initial engine state for a prescribed initial state. -/
def initEngState (N : Network n) (x : InitState n) : EngState n where
  running := false
  Wbar := x.W
  I := x.I
  supPipe := fun t => if t < N.L0 then x.supPipe t else 0
  retPipe := fun i t => if t < N.L i then x.retPipe i t else 0
  queue := []
  nOrd := 0

/-- Scheduled receipts of period `t`. -/
def receive (st : EngState n) (t : ℕ) : EngState n :=
  { st with Wbar := st.Wbar + st.supPipe t, I := fun i => st.I i + st.retPipe i t }

/-- Demand of period `t`. -/
def applyDemand (st : EngState n) (dt : DemandVec n) : EngState n :=
  { st with I := fun i => st.I i - (dt i : ℝ) }

/-- Stock in transit to retailer `i` after the receipts of period `t`. -/
def inTransit (L : Fin n → ℕ) (st : EngState n) (t : ℕ) (i : Fin n) : ℝ :=
  ∑ k ∈ Finset.range (L i), st.retPipe i (t + 1 + k)

/-- Supplier stock in transit after the receipts of period `t`. -/
def supInTransit (L0 : ℕ) (st : EngState n) (t : ℕ) : ℝ :=
  ∑ k ∈ Finset.range L0, st.supPipe (t + 1 + k)

/-- `Δ_i`: unallocated quantity of retailer `i`'s requests. -/
def unalloc (st : EngState n) (i : Fin n) : ℝ :=
  ((st.queue.filter (fun r => r.ret = i)).map (fun r => r.size - r.alloc)).sum

/-- `R_i`: reserve of retailer `i`'s requests (allocated, not yet shipped). -/
def reserve (st : EngState n) (i : Fin n) : ℝ :=
  ((st.queue.filter (fun r => r.ret = i)).map (fun r => r.alloc - r.shipped)).sum

/-- `P_i`: net inventory plus stock in transit to retailer `i`. -/
def physPos (L : Fin n → ℕ) (st : EngState n) (t : ℕ) (i : Fin n) : ℝ :=
  st.I i + inTransit L st t i

/-- `P̂_i = P_i + Δ_i + R_i`: inventory position including outstanding requests. -/
def phat (L : Fin n → ℕ) (st : EngState n) (t : ℕ) (i : Fin n) : ℝ :=
  physPos L st t i + unalloc st i + reserve st i

/-- Retailer `i`'s request in period `t` under its `(s_i, S_i)` rule. -/
def reqSize (L : Fin n → ℕ) (P : EngParams n) (st : EngState n) (t : ℕ) (i : Fin n) : ℝ :=
  if phat L st t i ≤ P.s i then P.S i - phat L st t i else 0

/-- Steps 1–2 of a running period (after receipts): retailer requests, the supplier order, and
the offsets of the new requests. Returns the state at creation (before allocation) and the
supplier order. -/
def phaseA (L0 : ℕ) (L : Fin n → ℕ) (P : EngParams n) (rule : OffsetRule n) (t : ℕ)
    (st : EngState n) : EngState n × ℝ :=
  let rs := (List.finRange n).filter (fun i => 0 < reqSize L P st t i)
  let pos := st.Wbar + ∑ i, reserve st i + supInTransit L0 st t
    + ∑ i, (physPos L st t i - P.center i)
  let q0 := if pos ≤ P.s0 then P.S0 - pos else 0
  let mk : Fin n → ℝ → Req n := fun i θ =>
    { ret := i, size := reqSize L P st t i, alloc := 0, shipped := 0, offset := θ, born := t }
  let st1 : EngState n :=
    { st with
      Wbar := if L0 = 0 then st.Wbar + q0 else st.Wbar
      supPipe := if L0 = 0 then st.supPipe
        else Function.update st.supPipe (t + L0) (st.supPipe (t + L0) + q0)
      queue := st.queue ++ rs.map (fun i => mk i 0)
      nOrd := st.nOrd + rs.length }
  let newReqs := rs.mapIdx (fun k i =>
    mk i (if P.batch i then rule st1 t (st.nOrd + k + 1) i (reqSize L P st t i) else 0))
  ({ st1 with queue := st.queue ++ newReqs }, q0)

/-- Whether the cumulative allocation of a batch request of size `Q` and offset `ϑ`, moving from
`prev` to `new` in one period, rises to or past a dispatch threshold (`3Qϑ/4`, and `3Q(1+ϑ)/4`
if `ϑ < 1/3`) or reaches `Q`. -/
abbrev crossesThreshold (Q θ prev new : ℝ) : Prop :=
  (prev < 3 * Q / 4 * θ ∧ 3 * Q / 4 * θ ≤ new) ∨
  (θ < 1 / 3 ∧ prev < 3 * Q / 4 * (1 + θ) ∧ 3 * Q / 4 * (1 + θ) ≤ new) ∨
  (prev < Q ∧ new = Q)

/-- FIFO allocation of the unallocated stock `w` and the resulting shipments; returns the updated
queue, the remaining unallocated stock, and the quantity shipped to each retailer. -/
def serve (batch : Fin n → Bool) : List (Req n) → ℝ → List (Req n) × ℝ × (Fin n → ℝ)
  | [], w => ([], w, 0)
  | r :: rs, w =>
    let a := min (r.size - r.alloc) w
    let r1 : Req n := { r with alloc := r.alloc + a }
    let ship : ℝ :=
      if batch r.ret = false ∨ crossesThreshold r.size r.offset r.alloc r1.alloc then
        r1.alloc - r1.shipped else 0
    let rest := serve batch rs (w - a)
    ({ r1 with shipped := r1.shipped + ship } :: rest.1, rest.2.1,
      rest.2.2 + Pi.single r.ret ship)

/-- Dispatch `q` in period `t`: arrives at once if `L_i = 0`, otherwise `L_i` periods later. -/
def sendOut (L : Fin n → ℕ) (t : ℕ) (q : Fin n → ℝ) (st : EngState n) : EngState n :=
  { st with
    I := fun i => if L i = 0 then st.I i + q i else st.I i
    retPipe := fun i => if L i = 0 then st.retPipe i
      else Function.update (st.retPipe i) (t + L i) (st.retPipe i (t + L i) + q i) }

/-- Steps 3–4 of a running period: allocation and dispatch. Fully shipped requests leave the
queue. Returns the new state and the dispatches. -/
def phaseB (L : Fin n → ℕ) (P : EngParams n) (t : ℕ) (st : EngState n) :
    EngState n × (Fin n → ℝ) :=
  let res := serve P.batch st.queue st.Wbar
  (sendOut L t res.2.2
    { st with Wbar := res.2.1, queue := res.1.filter (fun r => r.shipped < r.size) }, res.2.2)

/-- A running period after receipts: returns the state before demand, the supplier order, and
the dispatches. -/
def runStep (L0 : ℕ) (L : Fin n → ℕ) (P : EngParams n) (rule : OffsetRule n) (t : ℕ)
    (st : EngState n) : EngState n × ℝ × (Fin n → ℝ) :=
  let a := phaseA L0 L P rule t st
  let b := phaseB L P t a.1
  (b.1, a.2, b.2)

/-- Start the policy: append initial requests of the given sizes (the positive ones, in
increasing retailer index), with the given offsets; initial requests are not ordinary requests. -/
def startWith (st : EngState n) (t : ℕ) (sizes θ0 : Fin n → ℝ) : EngState n :=
  { st with
    running := true
    queue := st.queue ++ ((List.finRange n).filter (fun i => 0 < sizes i)).map (fun i =>
      { ret := i, size := sizes i, alloc := 0, shipped := 0, offset := θ0 i, born := t }) }

/-- The period by which every prescribed pipeline has arrived: `max(L₀, max_i L_i)`. -/
def Network.Tpipe (N : Network n) : ℕ := max N.L0 (Finset.univ.sup N.L)

end OWMR
Source
M. Hu, "A 5/2 Guarantee for Echelon Stock (s,S) Policies in One-Warehouse Multi-Retailer Systems", working paper (manuscript of November 2026), Definition 1 (ii)-(iii) (p. 8), Definition 2 (ii)-(iv) (p. 27), Section 5.1 (pp. 21-22), and Appendix C.2 (pp. E.10-E.12).
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Conventions. Every declaration below has an implicit natural-number parameter nnn (the case n=0n=0n=0 is allowed), and [n]={0,1,…,n−1}[n]=\{0,1,\dots,n-1\}[n]={0,1,…,n−1} carries its usual increasing order. Lists are finite sequences, read from first to last entry. The scalars named L0, s0, S0 are written L0L_0L0​, s0s_0s0​, S0S_0S0​. To keep them apart from entries at index 000, the values of the functions LLL, sss, SSS on [n][n][n] are written L(i)L(i)L(i), s(i)s(i)s(i), S(i)S(i)S(i). All real-valued data are unrestricted reals, since no sign or ordering condition appears anywhere in the file. The file contains no natural-number subtraction: all index arithmetic (t+L0t+L_0t+L0​, t+L(i)t+L(i)t+L(i), t+1+kt+1+kt+1+k, nOrd+k+1\mathrm{nOrd}+k+1nOrd+k+1, nOrd+m\mathrm{nOrd}+mnOrd+m) is addition. ej∈R[n]e_j\in\mathbb R^{[n]}ej​∈R[n] is the vector with entry 111 at jjj and 000 elsewhere.

Imported notions used. A network NNN is a record that contains a natural number L0L_0L0​ and a function L:[n]→NL:[n]\to\mathbb NL:[n]→N. It also has components this file never uses: a probability measure on R≥0[n]\mathbb R_{\ge0}^{[n]}R≥0[n]​, real numbers named K0, h, p, and real functions named K, H on [n][n][n]. An initial state xxx is a record of a real number WxW^xWx, a vector Ix∈R[n]I^x\in\mathbb R^{[n]}Ix∈R[n], a function supPipex:N→R\mathrm{supPipe}^x:\mathbb N\to\mathbb RsupPipex:N→R, and functions retPipeix:N→R\mathrm{retPipe}^x_i:\mathbb N\to\mathbb RretPipeix​:N→R for i∈[n]i\in[n]i∈[n]. The imported validity predicate for initial states (nonnegativity of WxW^xWx and of both pipe functions) is not assumed anywhere in this file. A demand vector is an element d∈R≥0[n]d\in\mathbb R_{\ge0}^{[n]}d∈R≥0[n]​.

Req. A request rrr is a record with these fields: an index retr∈[n]\mathrm{ret}_r\in[n]retr​∈[n], four real numbers sizer\mathrm{size}_rsizer​, allocr\mathrm{alloc}_rallocr​, shippedr\mathrm{shipped}_rshippedr​, offsetr\mathrm{offset}_roffsetr​, and a natural number bornr\mathrm{born}_rbornr​. No relation among the fields is imposed; for example, 0≤shippedr≤allocr≤sizer0\le\mathrm{shipped}_r\le\mathrm{alloc}_r\le\mathrm{size}_r0≤shippedr​≤allocr​≤sizer​ is not required. When n=0n=0n=0 no request exists, because retr\mathrm{ret}_rretr​ would have to lie in the empty set [0][0][0], so every list of requests is empty. Declarations in this file write the field bornr\mathrm{born}_rbornr​ but never read it.

EngState. A state σ\sigmaσ is a record of the following fields:

  • a Boolean flag runningσ\mathrm{running}^\sigmarunningσ;
  • a real number Wˉσ\bar W^\sigmaWˉσ (field Wbar);
  • a vector Iσ=(Iiσ)i∈[n]∈R[n]I^\sigma=(I^\sigma_i)_{i\in[n]}\in\mathbb R^{[n]}Iσ=(Iiσ​)i∈[n]​∈R[n];
  • a function SPσ:N→R\mathrm{SP}^\sigma:\mathbb N\to\mathbb RSPσ:N→R (field supPipe);
  • for each i∈[n]i\in[n]i∈[n], a function RPiσ:N→R\mathrm{RP}^\sigma_i:\mathbb N\to\mathbb RRPiσ​:N→R (field retPipe);
  • a list queueσ\mathrm{queue}^\sigmaqueueσ of requests;
  • a natural number nOrdσ\mathrm{nOrd}^\sigmanOrdσ.

No constraints are imposed. In this file, initEngState sets the flag running\mathrm{running}running to false and startWith sets it to true; nothing reads it. Only phaseA reads and increases nOrd\mathrm{nOrd}nOrd.

EngParams. A parameter record PPP consists of:

  • three functions s,S,c:[n]→Rs,S,c:[n]\to\mathbb Rs,S,c:[n]→R (fields s, S, center);
  • a function β:[n]→{true,false}\beta:[n]\to\{\mathrm{true},\mathrm{false}\}β:[n]→{true,false} (field batch);
  • two real numbers s0s_0s0​, S0S_0S0​.

No constraints are imposed: neither s(i)<S(i)s(i)<S(i)s(i)<S(i) nor s0<S0s_0<S_0s0​<S0​ is required. Within the file, sss and SSS enter only through reqSize, ccc only through the quantity pos\mathrm{pos}pos of phaseA, s0s_0s0​ and S0S_0S0​ only through q0q_0q0​ of phaseA, and β\betaβ through phaseA and serve.

OffsetRule. An offset rule is an arbitrary function Θ\ThetaΘ. It assigns a real number Θ(σ,t,k,i,x)\Theta(\sigma,t,k,i,x)Θ(σ,t,k,i,x) to every state σ\sigmaσ, pair of natural numbers ttt and kkk, index i∈[n]i\in[n]i∈[n] and real number xxx. No property of Θ\ThetaΘ is required.

initEngState. For a network NNN and an initial state xxx, it returns the state σ\sigmaσ with runningσ=false\mathrm{running}^\sigma=\mathrm{false}runningσ=false, Wˉσ=Wx\bar W^\sigma=W^xWˉσ=Wx, Iσ=IxI^\sigma=I^xIσ=Ix, an empty queue and nOrdσ=0\mathrm{nOrd}^\sigma=0nOrdσ=0. Using L0L_0L0​ and LLL of NNN, the pipe functions are

SPσ(u)=supPipex(u)  for u<L0,SPσ(u)=0  for u≥L0;RPiσ(u)=retPipeix(u)  for u<L(i),RPiσ(u)=0  for u≥L(i).\mathrm{SP}^\sigma(u)=\mathrm{supPipe}^x(u)\ \text{ for } u<L_0,\quad \mathrm{SP}^\sigma(u)=0\ \text{ for } u\ge L_0;\qquad \mathrm{RP}^\sigma_i(u)=\mathrm{retPipe}^x_i(u)\ \text{ for } u<L(i),\quad \mathrm{RP}^\sigma_i(u)=0\ \text{ for } u\ge L(i).SPσ(u)=supPipex(u)  for u<L0​,SPσ(u)=0  for u≥L0​;RPiσ​(u)=retPipeix​(u)  for u<L(i),RPiσ​(u)=0  for u≥L(i).

Both comparisons are strict, so the values of xxx at indices u≥L0u\ge L_0u≥L0​ (resp. u≥L(i)u\ge L(i)u≥L(i)) are discarded. If L0=0L_0=0L0​=0 then SPσ≡0\mathrm{SP}^\sigma\equiv0SPσ≡0, and if L(i)=0L(i)=0L(i)=0 then RPiσ≡0\mathrm{RP}^\sigma_i\equiv0RPiσ​≡0. No other component of NNN is used.

receive and applyDemand. receive(σ,t)\mathrm{receive}(\sigma,t)receive(σ,t) returns σ\sigmaσ with Wˉ\bar WWˉ replaced by Wˉσ+SPσ(t)\bar W^\sigma+\mathrm{SP}^\sigma(t)Wˉσ+SPσ(t) and each IiI_iIi​ replaced by Iiσ+RPiσ(t)I^\sigma_i+\mathrm{RP}^\sigma_i(t)Iiσ​+RPiσ​(t). It does not modify the functions SP\mathrm{SP}SP and RPi\mathrm{RP}_iRPi​: their entries at index ttt are not reset to 000. All other fields are unchanged. For a demand vector ddd, applyDemand(σ,d)\mathrm{applyDemand}(\sigma,d)applyDemand(σ,d) returns σ\sigmaσ with each IiI_iIi​ replaced by Iiσ−diI^\sigma_i-d_iIiσ​−di​ and nothing else changed. There is no truncation at 000, so IiI_iIi​ may become negative. No other declaration in this file calls either function; in particular, runStep does not use them.

inTransit, supInTransit, unalloc, reserve, physPos, phat. Fix L0∈NL_0\in\mathbb NL0​∈N, L:[n]→NL:[n]\to\mathbb NL:[n]→N, a state σ\sigmaσ, t∈Nt\in\mathbb Nt∈N and i∈[n]i\in[n]i∈[n]. The two transit sums are

inTransiti(σ,t)=∑k=0L(i)−1RPiσ(t+1+k)=∑u=t+1t+L(i)RPiσ(u),supInTransit(σ,t)=∑u=t+1t+L0SPσ(u).\mathrm{inTransit}_i(\sigma,t)=\sum_{k=0}^{L(i)-1}\mathrm{RP}^\sigma_i(t+1+k)=\sum_{u=t+1}^{t+L(i)}\mathrm{RP}^\sigma_i(u),\qquad \mathrm{supInTransit}(\sigma,t)=\sum_{u=t+1}^{t+L_0}\mathrm{SP}^\sigma(u).inTransiti​(σ,t)=k=0∑L(i)−1​RPiσ​(t+1+k)=u=t+1∑t+L(i)​RPiσ​(u),supInTransit(σ,t)=u=t+1∑t+L0​​SPσ(u).

These windows exclude index ttt itself. Each sum is 000 when L(i)=0L(i)=0L(i)=0, resp. L0=0L_0=0L0​=0. The two queue sums are

unalloci(σ)=∑r∈queueσ: retr=i(sizer−allocr),reservei(σ)=∑r∈queueσ: retr=i(allocr−shippedr).\mathrm{unalloc}_i(\sigma)=\sum_{r\in\mathrm{queue}^\sigma:\ \mathrm{ret}_r=i}(\mathrm{size}_r-\mathrm{alloc}_r),\qquad \mathrm{reserve}_i(\sigma)=\sum_{r\in\mathrm{queue}^\sigma:\ \mathrm{ret}_r=i}(\mathrm{alloc}_r-\mathrm{shipped}_r).unalloci​(σ)=r∈queueσ: retr​=i∑​(sizer​−allocr​),reservei​(σ)=r∈queueσ: retr​=i∑​(allocr​−shippedr​).

They run over the queue entries whose index is iii, counted with multiplicity. Each is 000 if there is no such entry, and the summands may be negative. Finally, physPosi(σ,t)=Iiσ+inTransiti(σ,t)\mathrm{physPos}_i(\sigma,t)=I^\sigma_i+\mathrm{inTransit}_i(\sigma,t)physPosi​(σ,t)=Iiσ​+inTransiti​(σ,t) and

p^i(σ,t)=physPosi(σ,t)+unalloci(σ)+reservei(σ)=Iiσ+∑u=t+1t+L(i)RPiσ(u)+∑r∈queueσ: retr=i(sizer−shippedr).\hat p_i(\sigma,t)=\mathrm{physPos}_i(\sigma,t)+\mathrm{unalloc}_i(\sigma)+\mathrm{reserve}_i(\sigma)=I^\sigma_i+\sum_{u=t+1}^{t+L(i)}\mathrm{RP}^\sigma_i(u)+\sum_{r\in\mathrm{queue}^\sigma:\ \mathrm{ret}_r=i}(\mathrm{size}_r-\mathrm{shipped}_r).p^​i​(σ,t)=physPosi​(σ,t)+unalloci​(σ)+reservei​(σ)=Iiσ​+u=t+1∑t+L(i)​RPiσ​(u)+r∈queueσ: retr​=i∑​(sizer​−shippedr​).

reqSize. With LLL, PPP, σ\sigmaσ, ttt, iii as above, ρi(σ,t)=S(i)−p^i(σ,t)\rho_i(\sigma,t)=S(i)-\hat p_i(\sigma,t)ρi​(σ,t)=S(i)−p^​i​(σ,t) if p^i(σ,t)≤s(i)\hat p_i(\sigma,t)\le s(i)p^​i​(σ,t)≤s(i) (non-strict), and ρi(σ,t)=0\rho_i(\sigma,t)=0ρi​(σ,t)=0 otherwise. The first branch is not clipped: ρi<0\rho_i<0ρi​<0 when S(i)<p^i≤s(i)S(i)<\hat p_i\le s(i)S(i)<p^​i​≤s(i), and ρi=0\rho_i=0ρi​=0 when p^i=S(i)≤s(i)\hat p_i=S(i)\le s(i)p^​i​=S(i)≤s(i). Hence ρi(σ,t)>0\rho_i(\sigma,t)>0ρi​(σ,t)>0 exactly when p^i(σ,t)≤s(i)\hat p_i(\sigma,t)\le s(i)p^​i​(σ,t)≤s(i) and p^i(σ,t)<S(i)\hat p_i(\sigma,t)<S(i)p^​i​(σ,t)<S(i).

phaseA. Applied to (L0,L,P,Θ,t,σ)(L_0,L,P,\Theta,t,\sigma)(L0​,L,P,Θ,t,σ), it returns a pair made of a state and a real number. It is built in the following order, and steps 1 to 3 read only the input state σ\sigmaσ.

  1. Let (i0<i1<⋯<im−1)(i_0<i_1<\dots<i_{m-1})(i0​<i1​<⋯<im−1​) be the list of all i∈[n]i\in[n]i∈[n], in increasing order, with ρi(σ,t)>0\rho_i(\sigma,t)>0ρi​(σ,t)>0 (strict). Here ρi(σ,t)\rho_i(\sigma,t)ρi​(σ,t) is the size from reqSize: S(i)−p^i(σ,t)S(i)-\hat p_i(\sigma,t)S(i)−p^​i​(σ,t) when p^i(σ,t)≤s(i)\hat p_i(\sigma,t)\le s(i)p^​i​(σ,t)≤s(i), and 000 otherwise, where p^i\hat p_ip^​i​ involves the entire queue of σ\sigmaσ. The length is m≥0m\ge0m≥0, and m=0m=0m=0 whenever n=0n=0n=0.
  2. Let
pos=Wˉσ+∑r∈queueσ(allocr−shippedr)+∑u=t+1t+L0SPσ(u)+∑i∈[n](Iiσ+∑u=t+1t+L(i)RPiσ(u)−c(i)).\mathrm{pos}=\bar W^\sigma+\sum_{r\in\mathrm{queue}^\sigma}(\mathrm{alloc}_r-\mathrm{shipped}_r)+\sum_{u=t+1}^{t+L_0}\mathrm{SP}^\sigma(u)+\sum_{i\in[n]}\Big(I^\sigma_i+\sum_{u=t+1}^{t+L(i)}\mathrm{RP}^\sigma_i(u)-c(i)\Big).pos=Wˉσ+r∈queueσ∑​(allocr​−shippedr​)+u=t+1∑t+L0​​SPσ(u)+i∈[n]∑​(Iiσ​+u=t+1∑t+L(i)​RPiσ​(u)−c(i)).

The second term is ∑i∈[n]reservei(σ)\sum_{i\in[n]}\mathrm{reserve}_i(\sigma)∑i∈[n]​reservei​(σ), which covers every queue entry. The third term is added once, outside the sums over iii. The unallocated amounts sizer−allocr\mathrm{size}_r-\mathrm{alloc}_rsizer​−allocr​ do not enter pos\mathrm{pos}pos, and neither do the requests created in this call. 3. Let q0=S0−posq_0=S_0-\mathrm{pos}q0​=S0​−pos if pos≤s0\mathrm{pos}\le s_0pos≤s0​ (non-strict), and q0=0q_0=0q0​=0 otherwise. It is not clipped, so q0≤0q_0\le0q0​≤0 when S0≤pos≤s0S_0\le\mathrm{pos}\le s_0S0​≤pos≤s0​. 4. Form an intermediate state σ1\sigma_1σ1​ from σ\sigmaσ as follows. The amount q0q_0q0​ is added whatever its sign.

  • If L0=0L_0=0L0​=0, replace Wˉ\bar WWˉ by Wˉσ+q0\bar W^\sigma+q_0Wˉσ+q0​ and leave SP\mathrm{SP}SP unchanged.
  • If L0>0L_0>0L0​>0, leave Wˉ\bar WWˉ unchanged and add q0q_0q0​ to the single entry SP(t+L0)\mathrm{SP}(t+L_0)SP(t+L0​); all other entries stay the same.
  • Append mmm requests to the end of queueσ\mathrm{queue}^\sigmaqueueσ, for k=0,…,m−1k=0,\dots,m-1k=0,…,m−1 in this order. Request kkk has index iki_kik​, size ρik(σ,t)\rho_{i_k}(\sigma,t)ρik​​(σ,t), alloc 000, shipped 000, offset 000 and born ttt.
  • Set nOrdσ1=nOrdσ+m\mathrm{nOrd}^{\sigma_1}=\mathrm{nOrd}^\sigma+mnOrdσ1​=nOrdσ+m.

The fields running\mathrm{running}running, III and RP\mathrm{RP}RP are unchanged. 5. For k=0,…,m−1k=0,\dots,m-1k=0,…,m−1 (the position in the list of step 1, counted from 000), set

θk=Θ(σ1, t, nOrdσ+k+1, ik, ρik(σ,t))  if β(ik)=true,θk=0  if β(ik)=false.\theta_k=\Theta\big(\sigma_1,\ t,\ \mathrm{nOrd}^\sigma+k+1,\ i_k,\ \rho_{i_k}(\sigma,t)\big)\ \text{ if }\beta(i_k)=\mathrm{true},\qquad \theta_k=0\ \text{ if }\beta(i_k)=\mathrm{false}.θk​=Θ(σ1​, t, nOrdσ+k+1, ik​, ρik​​(σ,t))  if β(ik​)=true,θk​=0  if β(ik​)=false.

The rule is called only for indices with β=true\beta=\mathrm{true}β=true. Its second argument is ttt. Its third argument uses the input count nOrdσ\mathrm{nOrd}^\sigmanOrdσ (not nOrdσ1\mathrm{nOrd}^{\sigma_1}nOrdσ1​) and runs through nOrdσ+1,…,nOrdσ+m\mathrm{nOrd}^\sigma+1,\dots,\mathrm{nOrd}^\sigma+mnOrdσ+1,…,nOrdσ+m. Every call receives the same state σ1\sigma_1σ1​. That state already reflects the update by q0q_0q0​ from step 4 and the count nOrdσ+m\mathrm{nOrd}^\sigma+mnOrdσ+m, and it holds all mmm new requests with offset 000, not the offsets being computed. The last argument is the size computed from σ\sigmaσ. 6. The output state is σ1\sigma_1σ1​ with its queue replaced by queueσ\mathrm{queue}^\sigmaqueueσ followed by mmm requests, for k=0,…,m−1k=0,\dots,m-1k=0,…,m−1 in this order. Request kkk has index iki_kik​, size ρik(σ,t)\rho_{i_k}(\sigma,t)ρik​​(σ,t), alloc 000, shipped 000, offset θk\theta_kθk​ and born ttt. The offset-000 copies from step 4 do not remain. The output number is q0q_0q0​.

So, relative to σ\sigmaσ, the output state differs only in four places:

  • Wˉ\bar WWˉ, when L0=0L_0=0L0​=0;
  • SP(t+L0)\mathrm{SP}(t+L_0)SP(t+L0​), when L0>0L_0>0L0​>0;
  • the appended requests, each of strictly positive size;
  • nOrd\mathrm{nOrd}nOrd, which increases by mmm.

When m=0m=0m=0, the queue and nOrd\mathrm{nOrd}nOrd are unchanged and Θ\ThetaΘ is never called. When n=0n=0n=0, pos=Wˉσ+∑u=t+1t+L0SPσ(u)\mathrm{pos}=\bar W^\sigma+\sum_{u=t+1}^{t+L_0}\mathrm{SP}^\sigma(u)pos=Wˉσ+∑u=t+1t+L0​​SPσ(u). The numbers L0L_0L0​ and LLL are explicit arguments here, and nothing ties them to the L0L_0L0​ and LLL of any network.

crossesThreshold. For real numbers QQQ, θ\thetaθ, prev\mathrm{prev}prev, new\mathrm{new}new, it is the statement

(prev<3Q4θ≤new) ∨ (θ<13 ∧ prev<3Q4(1+θ)≤new) ∨ (prev<Q ∧ new=Q).\Big(\mathrm{prev}<\tfrac{3Q}{4}\theta\le\mathrm{new}\Big)\ \lor\ \Big(\theta<\tfrac13\ \land\ \mathrm{prev}<\tfrac{3Q}{4}(1+\theta)\le\mathrm{new}\Big)\ \lor\ \Big(\mathrm{prev}<Q\ \land\ \mathrm{new}=Q\Big).(prev<43Q​θ≤new) ∨ (θ<31​ ∧ prev<43Q​(1+θ)≤new) ∨ (prev<Q ∧ new=Q).

In the first two disjuncts, the comparisons with prev\mathrm{prev}prev are strict and those with new\mathrm{new}new are non-strict. The third disjunct requires prev<Q\mathrm{prev}<Qprev<Q and the exact equality new=Q\mathrm{new}=Qnew=Q, with QQQ itself rather than 3Q4\tfrac{3Q}{4}43Q​. The condition θ<13\theta<\tfrac13θ<31​ is strict, with 13\tfrac1331​ the real number. No sign or range condition is placed on QQQ or θ\thetaθ. Each disjunct implies prev<new\mathrm{prev}<\mathrm{new}prev<new, so the statement is false whenever new≤prev\mathrm{new}\le\mathrm{prev}new≤prev.

serve. Its inputs are β:[n]→{true,false}\beta:[n]\to\{\mathrm{true},\mathrm{false}\}β:[n]→{true,false}, a list (r1,…,rK)(r_1,\dots,r_K)(r1​,…,rK​) of requests and a real number www. serveβ\mathrm{serve}_\betaserveβ​ returns a triple: a list of requests, a real number, and a vector in R[n]\mathbb R^{[n]}R[n]. For the empty list it returns the empty list, www and 000. Otherwise it treats the entries from first to last, passing on a remainder. Start with w0=ww_0=ww0​=w, and for k=1,…,Kk=1,\dots,Kk=1,…,K set

ak=min⁡(sizerk−allocrk, wk−1),wk=wk−1−ak,allock′=allocrk+ak.a_k=\min\big(\mathrm{size}_{r_k}-\mathrm{alloc}_{r_k},\ w_{k-1}\big),\qquad w_k=w_{k-1}-a_k,\qquad \mathrm{alloc}'_k=\mathrm{alloc}_{r_k}+a_k.ak​=min(sizerk​​−allocrk​​, wk−1​),wk​=wk−1​−ak​,allock′​=allocrk​​+ak​.

Then shipk=allock′−shippedrk\mathrm{ship}_k=\mathrm{alloc}'_k-\mathrm{shipped}_{r_k}shipk​=allock′​−shippedrk​​ if β(retrk)=false\beta(\mathrm{ret}_{r_k})=\mathrm{false}β(retrk​​)=false or crossesThreshold(sizerk,offsetrk,allocrk,allock′)\mathrm{crossesThreshold}(\mathrm{size}_{r_k},\mathrm{offset}_{r_k},\mathrm{alloc}_{r_k},\mathrm{alloc}'_k)crossesThreshold(sizerk​​,offsetrk​​,allocrk​​,allock′​) holds, and shipk=0\mathrm{ship}_k=0shipk​=0 otherwise. Finally shippedk′=shippedrk+shipk\mathrm{shipped}'_k=\mathrm{shipped}_{r_k}+\mathrm{ship}_kshippedk′​=shippedrk​​+shipk​. The three outputs are:

  • the list (r1′,…,rK′)(r'_1,\dots,r'_K)(r1′​,…,rK′​), where rk′r'_krk′​ is rkr_krk​ with alloc replaced by allock′\mathrm{alloc}'_kallock′​ and shipped by shippedk′\mathrm{shipped}'_kshippedk′​ (index, size, offset and born unchanged), in the same order and with nothing removed;
  • the real number wK=w−∑k=1Kakw_K=w-\sum_{k=1}^K a_kwK​=w−∑k=1K​ak​;
  • the vector v=∑k=1Kshipk eretrkv=\sum_{k=1}^K\mathrm{ship}_k\,e_{\mathrm{ret}_{r_k}}v=∑k=1K​shipk​eretrk​​​, so vjv_jvj​ is the sum of shipk\mathrm{ship}_kshipk​ over the entries with index jjj.

Further details:

  • The remainder is reduced by the allocations aka_kak​, not by the amounts shipk\mathrm{ship}_kshipk​.
  • The threshold test uses Q=sizerkQ=\mathrm{size}_{r_k}Q=sizerk​​ and θ=offsetrk\theta=\mathrm{offset}_{r_k}θ=offsetrk​​. It compares alloc before this call's allocation (prev\mathrm{prev}prev) with alloc after it (new\mathrm{new}new).
  • When shipping is triggered, shipk\mathrm{ship}_kshipk​ is the whole difference allock′−shippedrk\mathrm{alloc}'_k-\mathrm{shipped}_{r_k}allock′​−shippedrk​​, not just aka_kak​. This includes amounts allocated in earlier calls and not yet shipped.
  • For an index with β=false\beta=\mathrm{false}β=false the test is skipped, and shippedk′=allock′\mathrm{shipped}'_k=\mathrm{alloc}'_kshippedk′​=allock′​ after every call.
  • If sizerk−allocrk≤wk−1\mathrm{size}_{r_k}-\mathrm{alloc}_{r_k}\le w_{k-1}sizerk​​−allocrk​​≤wk−1​, then ak=sizerk−allocrka_k=\mathrm{size}_{r_k}-\mathrm{alloc}_{r_k}ak​=sizerk​​−allocrk​​, alloc becomes exactly sizerk\mathrm{size}_{r_k}sizerk​​, and wk=wk−1−(sizerk−allocrk)w_k=w_{k-1}-(\mathrm{size}_{r_k}-\mathrm{alloc}_{r_k})wk​=wk−1​−(sizerk​​−allocrk​​). If in addition allocrk<sizerk\mathrm{alloc}_{r_k}<\mathrm{size}_{r_k}allocrk​​<sizerk​​, the third disjunct of the threshold test holds, so the entry ships sizerk−shippedrk\mathrm{size}_{r_k}-\mathrm{shipped}_{r_k}sizerk​​−shippedrk​​.
  • If wk−1<sizerk−allocrkw_{k-1}<\mathrm{size}_{r_k}-\mathrm{alloc}_{r_k}wk−1​<sizerk​​−allocrk​​, then ak=wk−1a_k=w_{k-1}ak​=wk−1​ and wk=0w_k=0wk​=0. When wk−1≥0w_{k-1}\ge0wk−1​≥0, this is a partial allocation of the whole remainder.
  • There is no early stop. While the remainder is 000, each entry with size≥alloc\mathrm{size}\ge\mathrm{alloc}size≥alloc gets ak=0a_k=0ak​=0 and keeps its alloc, and the remainder stays 000. Since new=prev\mathrm{new}=\mathrm{prev}new=prev, such an entry fails the threshold test. It therefore ships 000 if β=true\beta=\mathrm{true}β=true, and ships its outstanding alloc−shipped\mathrm{alloc}-\mathrm{shipped}alloc−shipped if β=false\beta=\mathrm{false}β=false.
  • Nothing is clipped at 000. If wk−1<0w_{k-1}<0wk−1​<0 or sizerk<allocrk\mathrm{size}_{r_k}<\mathrm{alloc}_{r_k}sizerk​​<allocrk​​, then aka_kak​ can be negative, alloc decreases, and wk>wk−1w_k>w_{k-1}wk​>wk−1​. For example, with wk−1=0w_{k-1}=0wk−1​=0 and allocrk>sizerk\mathrm{alloc}_{r_k}>\mathrm{size}_{r_k}allocrk​​>sizerk​​, alloc drops to sizerk\mathrm{size}_{r_k}sizerk​​ and the positive remainder allocrk−sizerk\mathrm{alloc}_{r_k}-\mathrm{size}_{r_k}allocrk​​−sizerk​​ passes to later entries. shipk\mathrm{ship}_kshipk​ can also be negative, when shipping is triggered and allock′<shippedrk\mathrm{alloc}'_k<\mathrm{shipped}_{r_k}allock′​<shippedrk​​.

sendOut. For LLL, ttt, a vector q∈R[n]q\in\mathbb R^{[n]}q∈R[n] and a state σ\sigmaσ, it returns σ\sigmaσ modified separately for each i∈[n]i\in[n]i∈[n]. If L(i)=0L(i)=0L(i)=0, IiI_iIi​ is replaced by Iiσ+qiI^\sigma_i+q_iIiσ​+qi​ and RPi\mathrm{RP}_iRPi​ is unchanged. If L(i)>0L(i)>0L(i)>0, IiI_iIi​ is unchanged and qiq_iqi​ is added to the single entry RPi(t+L(i))\mathrm{RP}_i(t+L(i))RPi​(t+L(i)), with all other entries unchanged. Wˉ\bar WWˉ, SP\mathrm{SP}SP, the queue, nOrd\mathrm{nOrd}nOrd and running\mathrm{running}running are unchanged. There is no sign condition on qqq.

phaseB. Applied to (L,P,t,σ)(L,P,t,\sigma)(L,P,t,σ), it returns a pair made of a state and a vector in R[n]\mathbb R^{[n]}R[n]. Let (ℓ′,w′,v)=serveβ(queueσ,Wˉσ)(\ell',w',v)=\mathrm{serve}_\beta(\mathrm{queue}^\sigma,\bar W^\sigma)(ℓ′,w′,v)=serveβ​(queueσ,Wˉσ), with β\betaβ the flag function of PPP. Thus the queue is served in its stored order, starting from the amount Wˉσ\bar W^\sigmaWˉσ. The output state is obtained from σ\sigmaσ in three steps:

  1. Set Wˉ:=w′\bar W:=w'Wˉ:=w′, that is, Wˉσ\bar W^\sigmaWˉσ minus the total allocation ∑kak\sum_k a_k∑k​ak​.
  2. Replace the queue by the entries of ℓ′\ell'ℓ′ with shipped<size\mathrm{shipped}<\mathrm{size}shipped<size (strict), preserving their order. Entries with shipped≥size\mathrm{shipped}\ge\mathrm{size}shipped≥size are removed, and all others are kept regardless of their alloc.
  3. Apply sendOut(L,t,v,⋅)\mathrm{sendOut}(L,t,v,\cdot)sendOut(L,t,v,⋅) to the result.

The output vector is vvv. In particular, if an entry's alloc rises in this call from below its size to exactly its size, it gets shipped′=size\mathrm{shipped}'=\mathrm{size}shipped′=size and is removed. SP\mathrm{SP}SP, nOrd\mathrm{nOrd}nOrd and running\mathrm{running}running are not changed. Only β\betaβ is used from PPP, and ttt enters only as the index in sendOut. If the queue is empty, Wˉ\bar WWˉ and the queue stay as they are, v=0v=0v=0, and sendOut changes nothing numerically.

runStep. Applied to (L0,L,P,Θ,t,σ)(L_0,L,P,\Theta,t,\sigma)(L0​,L,P,Θ,t,σ), it returns the triple (σ′′,q0,v)(\sigma'',q_0,v)(σ′′,q0​,v), where (σ′,q0)=phaseA(L0,L,P,Θ,t,σ)(\sigma',q_0)=\mathrm{phaseA}(L_0,L,P,\Theta,t,\sigma)(σ′,q0​)=phaseA(L0​,L,P,Θ,t,σ) and (σ′′,v)=phaseB(L,P,t,σ′)(\sigma'',v)=\mathrm{phaseB}(L,P,t,\sigma')(σ′′,v)=phaseB(L,P,t,σ′). Consequently:

  • phaseB serves the queue of σ′\sigma'σ′, which ends with the requests that phaseA created in the same call, so these are served after all older entries.
  • Serving starts from Wˉσ′\bar W^{\sigma'}Wˉσ′, which includes q0q_0q0​ when L0=0L_0=0L0​=0 and does not when L0>0L_0>0L0​>0.
  • When L(i)=0L(i)=0L(i)=0, viv_ivi​ is added to IiI_iIi​ within the same call.
  • runStep does not call receive or applyDemand, neither reads nor changes running\mathrm{running}running, and uses the same ttt in both phases.

Indices relative to ttt: phaseA writes SP\mathrm{SP}SP at t+L0t+L_0t+L0​, and phaseB writes RPi\mathrm{RP}_iRPi​ at t+L(i)t+L(i)t+L(i). These are the last indices of the windows t+1,…,t+L0t+1,\dots,t+L_0t+1,…,t+L0​ and t+1,…,t+L(i)t+1,\dots,t+L(i)t+1,…,t+L(i) that the transit sums above add up at the same ttt. receive at index uuu reads the entries at uuu.

startWith. For a state σ\sigmaσ, t∈Nt\in\mathbb Nt∈N and functions sizes,θ0:[n]→R\mathrm{sizes},\theta^0:[n]\to\mathbb Rsizes,θ0:[n]→R, it returns σ\sigmaσ with running\mathrm{running}running set to true and with requests appended at the end of the queue. There is one request for each i∈[n]i\in[n]i∈[n] with sizes(i)>0\mathrm{sizes}(i)>0sizes(i)>0 (strict), in increasing order of iii. It has index iii, size sizes(i)\mathrm{sizes}(i)sizes(i), alloc 000, shipped 000, offset θ0(i)\theta^0(i)θ0(i) and born ttt. nOrd\mathrm{nOrd}nOrd is not increased, and Wˉ\bar WWˉ, III, SP\mathrm{SP}SP and RP\mathrm{RP}RP are unchanged. No offset rule or flag β\betaβ is consulted: the offsets θ0(i)\theta^0(i)θ0(i) are used as given, for every iii. If no sizes(i)\mathrm{sizes}(i)sizes(i) is positive (in particular if n=0n=0n=0), only running\mathrm{running}running changes.

Network.Tpipe. For a network NNN, it is the natural number max⁡(L0, max⁡i∈[n]L(i))\max\big(L_0,\ \max_{i\in[n]}L(i)\big)max(L0​, maxi∈[n]​L(i)), using the L0L_0L0​ and LLL of NNN. The inner maximum over the empty index set is 000, so for n=0n=0n=0 it equals L0L_0L0​. No other declaration in this file uses it.

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