FA-64936 / Epidemic compartment models / Open access
Reed-Frost expected chain-binomial generations: susceptible depletion · case 01
Generation sizes never decline and the final size exceeds the population.
ROOT CAUSE
The susceptible pool is not reduced by the newly infected generation.
THE FAILURE
The susceptible pool is not reduced by the newly infected generation.
Unsuccessful approach: Subtracting the previous generation size depletes the wrong cohort.
Case contract
Expected Reed-Frost: C[t+1] = S[t]*(1-(1-p)**C[t]), S[t+1]=S[t]-C[t+1]; cases are infectious for one generation only; stop early once expected cases fall below 1e-9; return [cases per generation including the index generation rounded to 4, final size including index cases rounded to 4]; None for invalid p or negative counts.
Why this case matters
Compartmental epidemic calculations drive outbreak forecasts, vaccine targets and hospital planning; a single wrong flow, rate conversion or boundary silently changes every downstream number.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(p, s0, i0, generations):
if not 0 <= p <= 1 or s0 < 0 or i0 < 0:
return None
q = 1 - p
s = float(s0)
c = float(i0)
cases = [round(c, 4)]
for _ in range(generations):
nxt = s * (1 - q ** c)
c = nxt
cases.append(round(c, 4))
if c < 1e-9:
break
return [cases, round(s0 + i0 - s, 4)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: household of 10',
(0.1, 9, 1, 6),
[[1.0, 0.9, 0.7328, 0.5474, 0.3822, 0.2541, 0.1633], 3.9798]),
('regression: school class',
(0.04, 29, 1, 8),
[[1.0, 1.16, 1.2876, 1.3596, 1.3602, 1.2872, 1.1541, 0.9844, 0.8038], 10.3969]),
('regression: high contact probability', (0.5, 20, 2, 5), [[2.0, 15.0, 4.9998, 0.0001, 0.0], 22.0]),
('regression: p zero no spread', (0.0, 10, 1, 4), [[1.0, 0.0], 1.0]),
('control: no index cases', (0.2, 10, 0, 4), [[0.0, 0.0], 0.0]),
('control: invalid p', (1.5, 10, 1, 4), None),
('control: zero generations', (0.3, 10, 2, 0), [[2.0], 2.0])],
[('regression: p zero no spread', (0.0, 10, 1, 4), [[1.0, 0.0], 1.0]),
('regression: p one immediate saturation', (1.0, 10, 1, 4), [[1.0, 10.0, 0.0], 11.0]),
('control: no index cases', (0.2, 10, 0, 4), [[0.0, 0.0], 0.0]),
('control: invalid p', (1.5, 10, 1, 4), None),
('control: zero generations', (0.3, 10, 2, 0), [[2.0], 2.0]),
('regression: fading chain',
(0.02, 30, 1, 10),
[[1.0, 0.6, 0.3542, 0.2071, 0.1204, 0.0698, 0.0404, 0.0233, 0.0135, 0.0078, 0.0045], 2.4409]),
('regression: large ward',
(0.03, 60, 3, 8),
[[3.0, 5.2396, 8.0777, 10.182, 9.733, 6.8673, 3.7561, 1.7453, 0.7455], 49.3465])],
[('regression: household of 10',
(0.1, 9, 1, 6),
[[1.0, 0.9, 0.7328, 0.5474, 0.3822, 0.2541, 0.1633], 3.9798]),
('control: no index cases', (0.2, 10, 0, 4), [[0.0, 0.0], 0.0]),
('control: invalid p', (1.5, 10, 1, 4), None),
('control: zero generations', (0.3, 10, 2, 0), [[2.0], 2.0]),
('regression: fading chain',
(0.02, 30, 1, 10),
[[1.0, 0.6, 0.3542, 0.2071, 0.1204, 0.0698, 0.0404, 0.0233, 0.0135, 0.0078, 0.0045], 2.4409]),
('regression: large ward',
(0.03, 60, 3, 8),
[[3.0, 5.2396, 8.0777, 10.182, 9.733, 6.8673, 3.7561, 1.7453, 0.7455], 49.3465]),
('regression: two generations only', (0.15, 40, 4, 2), [[4.0, 19.1198, 19.9465], 43.0662])],
[('regression: household of 10',
(0.1, 9, 1, 6),
[[1.0, 0.9, 0.7328, 0.5474, 0.3822, 0.2541, 0.1633], 3.9798]),
('regression: school class',
(0.04, 29, 1, 8),
[[1.0, 1.16, 1.2876, 1.3596, 1.3602, 1.2872, 1.1541, 0.9844, 0.8038], 10.3969]),
('control: no index cases', (0.2, 10, 0, 4), [[0.0, 0.0], 0.0]),
('control: invalid p', (1.5, 10, 1, 4), None),
('control: zero generations', (0.3, 10, 2, 0), [[2.0], 2.0]),
('regression: large ward',
(0.03, 60, 3, 8),
[[3.0, 5.2396, 8.0777, 10.182, 9.733, 6.8673, 3.7561, 1.7453, 0.7455], 49.3465]),
('regression: two generations only', (0.15, 40, 4, 2), [[4.0, 19.1198, 19.9465], 43.0662])],
[('regression: school class',
(0.04, 29, 1, 8),
[[1.0, 1.16, 1.2876, 1.3596, 1.3602, 1.2872, 1.1541, 0.9844, 0.8038], 10.3969]),
('regression: high contact probability', (0.5, 20, 2, 5), [[2.0, 15.0, 4.9998, 0.0001, 0.0], 22.0]),
('regression: p zero no spread', (0.0, 10, 1, 4), [[1.0, 0.0], 1.0]),
('regression: p one immediate saturation', (1.0, 10, 1, 4), [[1.0, 10.0, 0.0], 11.0]),
('control: no index cases', (0.2, 10, 0, 4), [[0.0, 0.0], 0.0]),
('control: invalid p', (1.5, 10, 1, 4), None),
('control: zero generations', (0.3, 10, 2, 0), [[2.0], 2.0])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: household of 10 | [[1.0, 0.9, 0.8142, 0.7399, 0.6749, 0.6178, 0.5671], 1.0] | [[1.0, 0.9, 0.7328, 0.5474, 0.3822, 0.2541, 0.1633], 3.9798] | Failed |
| regression: school class | [[1.0, 1.16, 1.3412, 1.5451, 1.7727, 2.0244, 2.3003, 2.5992, 2.9194], 1.0] | [[1.0, 1.16, 1.2876, 1.3596, 1.3602, 1.2872, 1.1541, 0.9844, 0.8038], 10.3969] | Failed |
| regression: high contact probability | [[2.0, 15.0, 19.9994, 20.0, 20.0, 20.0], 2.0] | [[2.0, 15.0, 4.9998, 0.0001, 0.0], 22.0] | Failed |
| regression: p zero no spread | [[1.0, 0.0], 1.0] | [[1.0, 0.0], 1.0] | Passed |
| control: no index cases | [[0.0, 0.0], 0.0] | [[0.0, 0.0], 0.0] | Passed |
| control: invalid p | None | None | Passed |
| control: zero generations | [[2.0], 2.0] | [[2.0], 2.0] | Passed |
SHA-256 / 50ca886f77b5de18dfddae5b1f6ef69df6e5d65a91144890579ebd341dfec90f
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(p, s0, i0, generations):
if not 0 <= p <= 1 or s0 < 0 or i0 < 0:
return None
q = 1 - p
s = float(s0)
c = float(i0)
cases = [round(c, 4)]
for _ in range(generations):
nxt = s * (1 - q ** c)
s -= c
c = nxt
cases.append(round(c, 4))
if c < 1e-9:
break
return [cases, round(s0 + i0 - s, 4)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: household of 10',
(0.1, 9, 1, 6),
[[1.0, 0.9, 0.7328, 0.5474, 0.3822, 0.2541, 0.1633], 3.9798]),
('regression: school class',
(0.04, 29, 1, 8),
[[1.0, 1.16, 1.2876, 1.3596, 1.3602, 1.2872, 1.1541, 0.9844, 0.8038], 10.3969]),
('regression: high contact probability', (0.5, 20, 2, 5), [[2.0, 15.0, 4.9998, 0.0001, 0.0], 22.0]),
('regression: p zero no spread', (0.0, 10, 1, 4), [[1.0, 0.0], 1.0]),
('control: no index cases', (0.2, 10, 0, 4), [[0.0, 0.0], 0.0]),
('control: invalid p', (1.5, 10, 1, 4), None),
('control: zero generations', (0.3, 10, 2, 0), [[2.0], 2.0])],
[('regression: p zero no spread', (0.0, 10, 1, 4), [[1.0, 0.0], 1.0]),
('regression: p one immediate saturation', (1.0, 10, 1, 4), [[1.0, 10.0, 0.0], 11.0]),
('control: no index cases', (0.2, 10, 0, 4), [[0.0, 0.0], 0.0]),
('control: invalid p', (1.5, 10, 1, 4), None),
('control: zero generations', (0.3, 10, 2, 0), [[2.0], 2.0]),
('regression: fading chain',
(0.02, 30, 1, 10),
[[1.0, 0.6, 0.3542, 0.2071, 0.1204, 0.0698, 0.0404, 0.0233, 0.0135, 0.0078, 0.0045], 2.4409]),
('regression: large ward',
(0.03, 60, 3, 8),
[[3.0, 5.2396, 8.0777, 10.182, 9.733, 6.8673, 3.7561, 1.7453, 0.7455], 49.3465])],
[('regression: household of 10',
(0.1, 9, 1, 6),
[[1.0, 0.9, 0.7328, 0.5474, 0.3822, 0.2541, 0.1633], 3.9798]),
('control: no index cases', (0.2, 10, 0, 4), [[0.0, 0.0], 0.0]),
('control: invalid p', (1.5, 10, 1, 4), None),
('control: zero generations', (0.3, 10, 2, 0), [[2.0], 2.0]),
('regression: fading chain',
(0.02, 30, 1, 10),
[[1.0, 0.6, 0.3542, 0.2071, 0.1204, 0.0698, 0.0404, 0.0233, 0.0135, 0.0078, 0.0045], 2.4409]),
('regression: large ward',
(0.03, 60, 3, 8),
[[3.0, 5.2396, 8.0777, 10.182, 9.733, 6.8673, 3.7561, 1.7453, 0.7455], 49.3465]),
('regression: two generations only', (0.15, 40, 4, 2), [[4.0, 19.1198, 19.9465], 43.0662])],
[('regression: household of 10',
(0.1, 9, 1, 6),
[[1.0, 0.9, 0.7328, 0.5474, 0.3822, 0.2541, 0.1633], 3.9798]),
('regression: school class',
(0.04, 29, 1, 8),
[[1.0, 1.16, 1.2876, 1.3596, 1.3602, 1.2872, 1.1541, 0.9844, 0.8038], 10.3969]),
('control: no index cases', (0.2, 10, 0, 4), [[0.0, 0.0], 0.0]),
('control: invalid p', (1.5, 10, 1, 4), None),
('control: zero generations', (0.3, 10, 2, 0), [[2.0], 2.0]),
('regression: large ward',
(0.03, 60, 3, 8),
[[3.0, 5.2396, 8.0777, 10.182, 9.733, 6.8673, 3.7561, 1.7453, 0.7455], 49.3465]),
('regression: two generations only', (0.15, 40, 4, 2), [[4.0, 19.1198, 19.9465], 43.0662])],
[('regression: school class',
(0.04, 29, 1, 8),
[[1.0, 1.16, 1.2876, 1.3596, 1.3602, 1.2872, 1.1541, 0.9844, 0.8038], 10.3969]),
('regression: high contact probability', (0.5, 20, 2, 5), [[2.0, 15.0, 4.9998, 0.0001, 0.0], 22.0]),
('regression: p zero no spread', (0.0, 10, 1, 4), [[1.0, 0.0], 1.0]),
('regression: p one immediate saturation', (1.0, 10, 1, 4), [[1.0, 10.0, 0.0], 11.0]),
('control: no index cases', (0.2, 10, 0, 4), [[0.0, 0.0], 0.0]),
('control: invalid p', (1.5, 10, 1, 4), None),
('control: zero generations', (0.3, 10, 2, 0), [[2.0], 2.0])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: household of 10 | [[1.0, 0.9, 0.7237, 0.5213, 0.3408, 0.2065, 0.1187], 4.6922] | [[1.0, 0.9, 0.7328, 0.5474, 0.3822, 0.2541, 0.1633], 3.9798] | Failed |
| regression: school class | [[1.0, 1.16, 1.295, 1.382, 1.4013, 1.3434, 1.2146, 1.0361, 0.8367], 10.8325] | [[1.0, 1.16, 1.2876, 1.3596, 1.3602, 1.2872, 1.1541, 0.9844, 0.8038], 10.3969] | Failed |
| regression: high contact probability | [[2.0, 15.0, 17.9995, 3.0, -13.1245], 39.9994] | [[2.0, 15.0, 4.9998, 0.0001, 0.0], 22.0] | Failed |
| regression: p zero no spread | [[1.0, 0.0], 2.0] | [[1.0, 0.0], 1.0] | Failed |
| control: no index cases | [[0.0, 0.0], 0.0] | [[0.0, 0.0], 0.0] | Passed |
| control: invalid p | None | None | Passed |
| control: zero generations | [[2.0], 2.0] | [[2.0], 2.0] | Passed |
SHA-256 / 5fd04b7b6408adfb074336efd31329d7b9762e336831c68d21791d88dc24a403
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
Deterministic bounded teaching model with a stipulated contract; not a validated scientific or public-health modelling library. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:47:29.451875+00:00.
Case digest / ac552830a2dd7b92d41276873aea42b5ebf981cbe544741e7a52fb9643e19105