# Reserve capacity and reliable eradication

This standalone companion builds the paper's inherited-mark target, delivered input and finite-capacity healthy reserve. The same concentration increases target erasure and reserve mortality. It teaches why target extinction at a deadline and reserve safety throughout a course are different events, and how initial filling, capacity and retained renewal provide different margins.

## Run and change inputs

Use Python 3.11+, create a virtual environment, then run:

```sh
python -m pip install -r requirements.txt
python -m unittest -v
python example.py --output outputs
```

The scenario constants at the top of `example.py` expose the reserve size, safety threshold, initial filling, return level, retained renewal, injury ceiling, selectivity, delivery/clearance, deadline, target configuration and uncertainty. Rates and times are synthetic paper units. There is no clinical calibration, unit conversion or fitted biological selectivity hidden in the defaults. Retained renewal is the effective rate after intervention, not a baseline rate silently presumed unchanged.

`configured_mission.json` belongs to your edited inputs. Preparation, capacity and small-chain scaling files are clearly fixed reference casebooks. The fixed target weight and erasure bands are sufficient certificates: an edited source can make them fail. A failed certificate is not a proof of impossibility. Resource violations are reported as failures of the full declared mission. Edits that invalidate the delivered band or reserve comparison raise an error instead of transferring the reference guarantee.

## Components

* `population.py`: arbitrary-site inherited molecular states, elementary chemical generator, correlated complementary daughters, branching PGF and mean operator. Adapted locally from example 65; provenance records the source hash.
* `mission.py`: rectangular administration with clearance and washout, healthy injury response, exact weighted drift with independent rate perturbations, backward time-dependent target PGF and union-bound mission assembly.
* `reserve.py`: logistic reserve specification, exact rational scale-function certificate, preparation distributions, numerical killed/full chains, high-precision small-chain calculation, capacity envelope, latency floor and fluid diagnostic.

No package-wide superclass or external project code is required. Replace the reserve mortality callable for a new delivered-input model, or use `Reserve.anchored(M,T)` directly for exact parameter sweeps. A general delivery model must separately establish its concentration/erasure bands; the rectangular-course formula must not be copied to an arbitrary waveform.

## What is verified

The target source has six molecular states in order `(0,0),(0,1),(0,2),(1,0),(1,1),(2,0)` and four initial AA founders. Exact arithmetic reconstructs the weight `(14,11,10,84,43,107)`, the chemical/division/death error envelope and the growth/contraction constants `59/400` and `171/2000`. Each positive chemical off-diagonal, division rate and death rate can have an independent fixed 1% factor; chemical diagonals must be rebuilt to keep row sums zero. The sister law and preparation remain fixed.

Administration is 0.29 until time 112, with clearance in `[0.99,1.01]` and zero initial concentration. Positive Taylor sums certify the concentration band from time 4, the concentration cap, and target survival at 112. Target extinction remains absorbing through deadline 120 without immigration. Healthy injury uses **`(0.3 + concentration)/selectivity + extra_death`**. The selectivity divides the baseline term too. Reserve safety includes washout. Amount and integrated exposure are different constraints and are both checked.

The reserve comparison assumes unit births/deaths, actual birth at least `r*h*(1-h/K)` and death at most `m*h`. At every time, falling **strictly below** the threshold is failure. At capacity 400, threshold 200 and return level 278, the normalized excursion bound is about `2.67048e-6`; dropping the scale-function denominator gives the simpler `<7e-6` bound. A fresh exponential series tightens the paper's target bound 0.00856 to about 0.00754054. Joint success uses **one minus the sum of failure bounds**, not independence. The original simple joint guarantee is saved separately.

Lower preparation has a separate pre-return risk. At 209 it still passes the 1% reserve tolerance; at 208 this certificate fails. A preparation distribution is averaged over its actual counts, not replaced by its mean. Scanning every feasible integer capacity through 300 gives 232 for the normalized certificate and 252 for the simpler bound in the specified rounded family; these are sufficient-design thresholds, not necessary capacities.

The killed chain transfers boundary-crossing mass to an absorbing failure state. A full-chain terminal shortfall is smaller because recovery is possible. These SciPy solutions are numerical diagnostics. The 60-digit small-chain matrix exponentials accumulate failure mass directly, avoiding cancellation from subtracting survival near one; high precision alone is not an outward error certificate. Exact high-renewal coefficients reproduce `8, 8, 625/48` and demonstrate the buffer-dependent power law. The capacity action law is displayed only in its required equilibrium regime.

Zero buffer has a renewal-independent first-death risk. Empty-pipeline replacement latency has an initial binomial failure floor. The low-equilibrium fluid example applies to its constant source, not every treatment policy. The baseline-unsafe example does not establish a treatment selectivity tradeoff. Delayed replacement, catastrophe jumps, immigration, altered daughter laws or unverified lower renewal invalidate the corresponding comparison premises.

Seven tests check conservative molecular rows, complementary allocation, worst independent perturbations, common delivery, exact harmonic hitting equations, preparation, capacity, killed-chain agreement, buffer coefficients and rejection of invalid inputs. The mathematical comparison/probability theorems are used from the paper; Lean and the paper's large Euler verification loop are not rerun. `provenance.json`, the manuscript hash, module hashes, rational certificates and CSVs make the calculation inspectable.

## Outputs and reuse

JSON files contain exact fractions and evidence labels; CSV files contain the scale products, rounded design sweep, shared-course trajectories and renewal comparison. PNG/SVG figures are regenerated locally. `run_metadata.json` records the manuscript and source/output hashes.

MIT is proposed for newly authored code, pending owner confirmation; no license grant is asserted here. Retain provenance when reusing adapted components.
