Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Exact CU KS critical value and rejection of pooled actual arrivals

Definition
NHPPArrivals_LinearRate_Supplement_KSTest

by mikedeng1 · Nov 23, 2026 · Mathlib 0df444a (Lean v4.33.1)

conditional-arrival-lawnonhomogeneous-poisson-processp2o-batch-supp500p2o-gran-per-chapterp2o-plan-paperp2o-v1

For mmm observations xxx, put Dm(x)=sup⁡0≤t≤1∣Fˉm(t)−t∣D_m(x)=\sup_{0\le t\le1}|\bar F_m(t)-t|Dm​(x)=sup0≤t≤1​∣Fˉm​(t)−t∣. Let U(m)U^{(m)}U(m) have the product law of mmm independent uniforms on [0,1][0,1][0,1]. The exact null critical value is

δ(m,α)=inf⁡{d∈[0,1]:P(Dm(U(m))>d)≤α}.\delta(m,\alpha)=\inf\{d\in[0,1]:P(D_m(U^{(m)})>d)\le\alpha\}.δ(m,α)=inf{d∈[0,1]:P(Dm​(U(m))>d)≤α}.

For m≥1m\ge1m≥1 and 0<α<10<\alpha<10<α<1, continuity of the null statistic's distribution gives tail probability α\alphaα at this quantile. This is not the numerical approximation 1.36/m1.36/\sqrt m1.36/m​. For a process on [0,T][0,T][0,T] divided into kkk equal pieces, retain every observed arrival, rescaled within its piece by uj=fract⁡(kXj/T)u_j=\operatorname{fract}(kX_j/T)uj​=fract(kXj​/T). With the actual random total M=N(T)M=N(T)M=N(T), reject exactly on

{M>0, DM(u1,…,uM)>δ(M,α)}.\{M>0,\ D_M(u_1,\ldots,u_M)>\delta(M,\alpha)\}.{M>0, DM​(u1​,…,uM​)>δ(M,α)}.

The rejection probability is the probability of this event; the test does not reject at zero arrivals. Fixed endpoints and subinterval boundaries have probability zero under an NHPP with integrable intensity. The infimum set is nonempty (it contains 111) and bounded below by 000 at all significance levels used in Theorem 6. The model uses the published degree function, without changing it.

Definition code
import Mathlib
import Definitions.Def_NHPPArrivals_LinearRate_Supplement_EmpiricalCdf

namespace NHPPArrivals.LinearRate.Supplement

open MeasureTheory ProbabilityTheory

noncomputable def ks {n : ℕ} (x : Fin n → ℝ) : ℝ :=
  degree (empiricalCdf x)

/-- The null law of m independent uniforms. The unit interval has volume one. -/
noncomputable def uniformSampleLaw (m : ℕ) : Measure (Fin m → ℝ) :=
  Measure.pi (fun _ : Fin m => volume.restrict (Set.Icc (0 : ℝ) 1))

/-- Exact upper-tail critical value, not the asymptotic 1.36/sqrt(m).
For m>0 and 0<alpha<1 the null KS distribution is continuous and this
quantile has upper-tail probability alpha. At m=0 no test is performed. -/
noncomputable def criticalValue (m : ℕ) (alpha : ℝ) : ℝ :=
  sInf {d : ℝ | d ∈ Set.Icc (0 : ℝ) 1 ∧
    (uniformSampleLaw m).real {x | d < ks x} ≤ alpha}

/-- Fold every actual arrival into its own subinterval and retain every point.
Endpoints can be assigned to the interval on their right: they have zero law. -/
noncomputable def pooledVector {Ω : Type*} (N : ℝ → Ω → ℕ)
    (X : ℕ → Ω → ℝ) (T : ℝ) (k : ℕ) (ω : Ω) : Fin (N T ω) → ℝ :=
  fun i => Int.fract ((k : ℝ) * X (i : ℕ) ω / T)

noncomputable def rejectionEvent {Ω : Type*} (N : ℝ → Ω → ℕ)
    (X : ℕ → Ω → ℝ) (T : ℝ) (k : ℕ) (alpha : ℝ) : Set Ω :=
  {ω | 0 < N T ω ∧
    criticalValue (N T ω) alpha < ks (pooledVector N X T k ω)}

noncomputable def rejectionProbability {Ω : Type*} [MeasurableSpace Ω]
    (P : Measure Ω) (N : ℝ → Ω → ℕ) (X : ℕ → Ω → ℝ)
    (T : ℝ) (k : ℕ) (alpha : ℝ) : ℝ :=
  P.real (rejectionEvent N X T k alpha)

end NHPPArrivals.LinearRate.Supplement
Source
Kim and Whitt, Are call center and hospital arrivals well modeled by nonhomogeneous Poisson processes?, Manufacturing Service Oper. Management 16(3), 2014, DOI 10.1287/msom.2014.0490, pp. 465, 474, §1.1 (1)–(2), §3.7 THEOREM 6

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