"""Deterministic algebra audit; no device benchmark or queue simulation.""" import json import math from pathlib import Path import sys def rates(arrival, service): if not all(math.isfinite(x) for x in (arrival, service)) or not 0 < arrival < service: raise ValueError("Require finite 0 < arrival < service") return service - arrival def quantile(p, arrival, service): gap = rates(arrival, service) if not math.isfinite(p) or not 0 < p < 1: raise ValueError("Require 0 < p < 1") value = -math.log1p(-p) / gap if not math.isfinite(value): raise ValueError("Quantile outside representable range") return value def cdf(t, arrival, service): gap = rates(arrival, service) if not math.isfinite(t) or t < 0: raise ValueError("Time must be finite and nonnegative") return -math.expm1(-gap * t) def printed_density_mass(arrival, service): rates(arrival, service) rho = arrival / service return rho * (1 - rho) def result(): arrival, service = 800, 1000 return { "kind": "deterministic algebra audit with hypothetical rates", "source_pdf_sha256": "721ad2860fb85711764b3a92a0eef6178e66a5b0e7951299b62ccddb23ee78ce", "source_url": "https://www.usenix.org/system/files/nsdi26-hu-chaolei.pdf", "source_equations": [1, 5, 6, 7], "assumptions": ["Stationary FCFS M/M/1", "Independent Poisson arrivals and exponential service", "0 < lambda < mu", "Total response includes waiting and service", "alpha = 1"], "arrival_per_second": arrival, "service_per_second": service, "printed_density_integral": printed_density_mass(arrival, service), "correct_density_integral": 1, "rows": [{"p": p, "printed_quantile_ms": -1000 * quantile(p, arrival, service), "cdf_consistent_quantile_ms": 1000 * quantile(p, arrival, service)} for p in (0.95, 0.99999)], "limitations": ["Not a reproduction of the operator's code or deployment", "A corrected formula does not validate a fitted tail-capacity estimator"], } if __name__ == "__main__": path = Path(__file__).with_name("results.json") value = json.dumps(result(), indent=2, allow_nan=False) + "\n" if "--check" in sys.argv: if path.read_text() != value: raise SystemExit("Generated result differs") else: path.write_text(value)