# Chemical memory under load and hidden operating states

Companion to **Chemical Memory under Load: Productive Inheritance and Hidden Operating States**. Manuscript SHA-256: `41f71eaed3040751568bf085391b5021bde099b27d14335de005729d33233d1a`.

The same four-species resident chemistry supports two different questions. Under imposed extraction, can finite cells grow, divide, pass through a neutral bottleneck and recover while exporting the growth-supporting species? Under reservoir–consumer feedback, can identical proportions conceal different productive states? The package implements both arrangements and their exact resident-field bridge without transferring the first arrangement's inheritance guarantee to the second.

## Run

```sh
python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate
python -m pip install -r requirements.txt
python -m unittest -v test_example.py
python example.py --output outputs
python example.py --simulate --output outputs-small
```

Python 3.11+; direct dependencies are pinned. No downloads or private modules are needed. The main run takes seconds. Optional molecular diagnostics have a finite event budget and can return unfinished. The ZIP contains every module, tests, setup guide and outputs. `run_metadata.json` hashes the manuscript, source modules and generated files.

Edit the inputs at the top of `example.py`: extraction, theorem witness, target composition, renewal/mortality, recovery horizon, consumer perturbations, measurement-error assumptions, unit conversion, and separately labelled small-count diagnostics. The theorem certificate deliberately accepts only the published N, M and gamma witness and the certified extraction interval. Changing those numbers needs a fresh source-bound analysis, not a blind substitution. The numerical source components can still be used independently for exploration.

## Components

`resident.py` contains immutable `Cell` and `Channel` objects, fourteen literal chemical channels, falling-factorial count propensities, the resident ODE, equilibrium reconstruction, rational root isolation and the paper's extraction-specific energy matrices. Count size m normalizes concentration n/m; it is not the total number of resident molecules. The immutable tag records ancestry and never enters a rate.

`protocol.py` adapts the physical copying machinery of the earlier serial-transfer example. `PopulationSource` implements growth rate `gamma Q n_z/(4 W0)`, consuming one precursor and one z while increasing cell size by one. `ComplementaryDivision` partitions each molecular count once and gives the complement to the other daughter. `UniformTransfer` samples distinct intact cells without replacement. `SerialProtocol` transfers their actual counts, disables growth during recovery while keeping extraction active, and refills precursor for the next batch. Physical event logs retain extraction, signed internal z formation, growth consumption, discarded z and gross reservoir exchange. No chemical reset or ancestry-dependent selection is used.

`feedback.py` supplies `Community`, the full resident–reservoir–consumer field for any positive probability vector q, with self-limitation X_i/q_i. It also exposes total abundance, uptake, effective load, dispersion, composition dynamics, full Jacobian and integration with independent accumulated observables. `WindowReadout` computes finite-window abundance/reservoir estimates, propagates declared errors, and classifies only under explicit model, calibration and recovery assumptions.

`example.py` keeps the fixed-paper symbolic/rational audit, complete inheritance error budget and numerical demonstrations separate. `InheritanceCertificate` imports the source-kernel theorem and recomputes every Appendix B term in log form with an interval upper check. It does not replace tiny probabilities by zero after floating underflow. Repetition bounds are exact fractions; their final fraction/log-odds displays are labelled numerical.

Example use:

```python
from feedback import Community, WindowReadout
from resident import ResidentChemistry

community = Community(q=(.1, .2, .3, .4))
low, high = community.equilibria()
initial = low.copy()
initial[5:] *= [1.03, .98, 1.01, .99]
trajectory = community.integrate(initial, duration=500)
print(community.observables(high))

reader = WindowReadout(h=100)
print(reader.classify('.0224', '.0222', calibrated=True,
                     two_alternatives=True, recovery_bound='.001'))
resident = ResidentChemistry(rho='1/100')
print(resident.centers())
```

The feedback state order is A,B,z,H,R,X1,…; the imposed resident order is A,B,z,H. The feedback equilibrium bracket method is specific to d=0.05, mu=0.5. For other values, integrate the full field or supply a separately validated stationary analysis. New compositions change self-limitation coefficients; both low/high states within any one composition choice share those coefficients.

## Productive inheritance under imposed extraction

The fourteen channels include the actual z→collector event at rate rho n_z. Duplex propensities use n(n−1); they vanish below two molecules and have no extra factorial divisor. The exact density correction relative to the zero-growth ODE is `(2eA,−eA,4z,−2z)/m`. Fresh symbolic checks verify this and the stationary scalar-to-vector reconstruction.

For rho in [0.009999,0.01], rational signs bracket low/high stationary z in [0.98172,0.98174] and [2.89014,2.89017]. The example checks the extraction-specific energy matrices' spectral bounds, not just those of the unloaded resident. The full uniform nonlinear dissipation and exponential-generator inequalities remain imported manuscript results. Ordinary root finding is not substituted for the bracket evidence.

At N=6.5536×10²², M=4×10⁹, gamma=10⁻¹¹, the complete two-cycle lower bound is **24482873/24500000≈0.999300938776**. Transfer uses ancestry floors 1/2 then 49/1600, giving failure allowances 1/25000 and 4/6125. The combined nontransfer allowance is 6×10⁻⁶. The implementation recomputes the chemical/division, deadline, size-odds, output, collection, batch-service, recovery and recovery-service terms, using the paper's spatial denominator **60**.

The newborn phase conversion pays one final log 2 penalty, giving high-ancestry fraction greater than about **0.6930453422**. Generic size phases would pay two log 2 penalties. The shared-inventory output barrier gives more than **5NM exported z per batch** on the same success event; it does not posit an independent exporter. The underlying sufficient condition is `16 gamma≤rho`. The whole finite law retains unsuccessful continuations rather than conditioning them away.

The finite-repetition consequence is also exposed: three and four cycles have lower bounds about 0.9886357147 and 0.8145555869; this sufficient bound is zero by five cycles. Zero is uninformative, not certain failure. With immutable tags and repeated neutral bottlenecks, indefinite uninterrupted retention has a separate obstruction: a monochromatic sample always has positive probability. The tests enumerate the small 8-cell/4-retained illustration, with 2 monochromatic subsets out of 70. It is a diagnostic of the sampling operation, not a substitute for the general argument.

Extraction at least 0.031 excludes any zero-growth stationary resident with z≥2. The exact positive-polynomial certificate and its quadratic discriminant are recomputed. The gap between 0.01 and 0.031 is not classified by the inheritance theorem; this package does not claim a certified bifurcation or finite-time memory-loss rate.

## What the small molecular option does

The published result is formulated on finite stopped jump kernels, including failure information and service/counter capacity. Enumerating that astronomical law is unnecessary for applying its theorem. The optional simulation instead exercises the literal physical channels with a small direct Gillespie method, accelerated growth and short recovery. It is explicitly **not** a numerical realization or empirical verification of the theorem witness. The default small run can exhaust its event budget partway through the second batch. It reports the partial population and physical counters without declaring theorem success or estimating a failure probability.

Exact propensity tests, a prescribed complementary division, an extraction-active recovery run, neutral subset enumeration and physical ledgers independently check the implementation. A completed small protocol also verifies

`signed internal z formation = final z − initial z + extraction + growth consumption + intact-cell discarded z`.

Recovery extraction is included. Growth count equals 3W0 only on each completed batch without intervening refill; the identity is not inferred from a final precursor count spanning multiple refills. This rules out confusing internal synthesis with simple depletion of initial z. It makes no claim about atom-labelled fresh-food provenance or energetic efficiency.

Gross service quotas and hard cutoffs are available in `PopulationSource.run`. The paper's fixed finite service stock is a sum over a huge finite domain; this example does not enumerate that compiled stock or claim the direct simulator supplies its finite-kernel proof. Prepared precursor at most 12NM and growth consumption at most 9NM are reported separately from resident-service stocks.

## Feedback: identical composition, different operation

The full field uses effective extraction coefficient lambda=R S and uptake J=R z S. Its resident projection equals the imposed-load field exactly at rho=R S; the consumers and reservoir still have their own dynamics. There is no division or transfer in this arrangement.

The two numerical equilibrium reconstructions lie within the paper's rational abundance intervals [0.04067409,0.04067412] and [0.07014930,0.07014933]. Both have p=q, but uptake is approximately **0.021991433513** versus **0.039995584124**, a factor greater than **1.8186**. Fresh rational interval images give gap at least **0.0180041302527156**, separating threshold **0.0309935091641322**, and half-gap **0.0090020651263578**. A predictor using only the common proportions must make at least that half-gap error on one alternative.

The full Jacobian, including every consumer mode, has negative numerical eigenvalue real parts in the demonstration. The manuscript proves full-community local attraction through aggregate energy plus dispersion; that proof is not replaced by these eigenvalues, and its whole enclosing box is not asserted to be a basin. The deliberately visible perturbations in the numerical examples are not certified to lie in its tiny invariant sublevel.

At any nonnegative stationary state, the exact square certificate gives **R S≤2239911/97656250≈0.02293668864**. Self-limitation sharpens the simpler 0.025 bound. This necessary cap does not assert an equilibrium at every point on the stationary curve. It also is not a transient cap: R=1,S=0.1 gives load 0.1. The high-uptake state has lower effective load because z is higher; neither operating load belongs to the imposed copying interval. No feedback inheritance theorem follows.

## Readout and observation limits

With dispersion `W=sum(q_i (X_i/q_i−S)^2)`, the exact instantaneous identity is `J=S'+mu S+S²+W`. The two finite-window identities use abundance accumulation plus its nonlinear and dispersion integrals, or reservoir renewal minus reservoir accumulation. The solver integrates uptake and the other observables independently and reports balance residuals. Using mean abundance alone omits temporal variance and dispersion.

`WindowReadout.estimates` computes numerical trapezoid estimates from matching time traces. It does **not** infer a rigorous quadrature ceiling from those samples. Supply independent ceilings in average-flux units; an unnormalized integral-error bound must first be divided by window length. The default synthetic assumptions give E_S=0.000791 and E_R=0.00036. With a separately admitted dynamic error 0.001, the example low and high measurements classify correctly. Missing calibration/recovery/alternatives, inconsistent balances, or observations incompatible with both intervals return `unresolved`.

`recovery_error` evaluates the paper's local exponential window bound only when an admitted invariant-sublevel premise is supplied. A plotted recovery trajectory is not that premise. The default synthetic classifier is deliberately separate from the simulated trajectory; no instrument specifications or measured data are implied.

Composition satisfies `p_i'=S p_i(kappa−p_i/q_i)` and a nonincreasing weighted chi-square dispersion. The example compares its numerical decay with the analytical integrated-abundance bound. The plot omits the tiny late-time range where floating-point noise dominates; CSV retains raw values. At p=q, composition remains constant even when abundance and function evolve. Away from q, exact composition derivatives can recover S through `v·p'/|v|²`; the example reports its error-amplification factor. Near q it becomes ill-conditioned, and at q it is unavailable. Thus composition-only observation fails uniformly, not for every possible time-resolved record.

## Outputs, units, and evidence

`results.json` separates rational/symbolic checks, imported theorem budgets, imposed states, numerical full feedback equilibria/trajectories and synthetic inference decisions. Recovery CSVs give observations and full states; `finite_repetition.csv` retains exact probability fractions. Figures are PNG/SVG.

The witness is constructive, not calibrated. At concentration normalization 1 mM, one newborn size corresponds to about **108.8 litres**, the initial population to **4.35×10¹¹ litres**, and two deadlines plus recovery to roughly **50,701 years** at one second per model time unit. Rescaling time rescales all rates and leaves rho/gamma about 10⁹. These costs are visible rather than presented as plausible experimental inputs. More practical parameter exploration is available, but it does not inherit the conservative proof guarantee.

Lean is not rerun. Fresh checks verify the stated finite algebra and error arithmetic; source-law probability, uniform nonlinear attraction and compiled finite-resource results remain attributed to the manuscript. Numerical integration, direct simulation and synthetic measurement examples are labelled separately. This package does not prove a global feedback basin, compute a validated fold, or provide biological identities for the formal species.

## License

MIT is proposed for the newly authored example, pending owner confirmation. This note does not grant a license. The manuscript and cited material retain their own terms.
