# What successful operation selects from a random chemistry

Example for **Diffuse RAFs and productive operation: asymptotic singleton dominance in a random polymer model**, manuscript entry 30, SHA-256 `a93db4a9bd559971dc0dcc2654e5c205bbdf684cd53d9b44db7c722db9e5efaf`.

The paper compares two conditionings of the same chemistry. Given RAF existence alone, the smallest RAF grows in probability. Given the rare event of productive reactor output, a one-channel RAF is selected with probability tending to one. This is a statement about this random source, food-only startup and sufficient volume regime; it is not a universal obstruction to diffuse autocatalysis.

The package supplies the literal polymer kernel, correlated catalytic-row sampler, incidence-conditioned sampler, analytic source moments, candidate enumeration, exact kinetic budget checks and a reusable reactor with signed local-input attribution. A specified deterministic example illustrates catalytic deletion. It is kept separate from the asymptotic conditioning theorem.

## Run

Python 3.11 or newer, with pinned direct dependencies:

```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
# Optional small-volume count paths; these can stop unfinished:
python example.py --output exploratory --simulate
```

The default run takes seconds and writes five CSV tables, two figure pairs, structured results, console output and provenance hashes. It does not simulate the sufficient theorem volume. The optional direct count simulation uses a finite event budget; `completed=False` gives `productive=None`, not failure. Keep optional runs in a separate output directory when comparing with the bundled default outputs.

## Model, inputs and reusable components

The editable study inputs are at the top of `example.py`: maximum word length, named catalytic incidence, optional background incidences, mark seed, source-analysis sizes and exploratory count volume/budget. `polymer.py` is a self-contained copy of the original companion-example chemistry components, with incidence labels retained for this paper's attribution calculation; no other example package is needed.

`PolymerCatalogue(n)` contains every nonempty binary word of length at most n and every **ordered** split u+v <-> uv. The six words of lengths one and two are food. It preserves separate channels for distinct ordered splits, including coincident stoichiometries. `CatalyticEnvironment` assigns whole reversible channels to catalyst rows and provides reversible food closure, maxRAF and an inclusion-minimal RAF witness. That witness is not a minimum-cardinality solver.

`KineticParameters.sample` samples the manuscript marks from {1,3/2,2}: basal coefficients are epsilon*S_r*B_r and catalytic coefficients are 4*S_r*H_rz. Basal and catalytic coefficients sharing a channel retain their common S_r factor. Both directions share the same coefficient. Epsilon=1/500000000. Arbitrarily changing these bounds invalidates the displayed theorem budgets.

`FedReactor` retains every basal reaction, feeds each food species at rate V, washes each species out at its count, and starts each food at V molecules with no nonfood. Count propensities use falling factorials **without factorial divisors**. Catalysts remain in reactant multiplicities even though returned: product catalysis gives a reverse input of two product molecules; u=v=z gives a three-copy forward input. `rates(values, volume=None)` is the density-limit monomial rate; `rates(counts, V)` is the count rate. They are different kernels.

`erase_incidence` removes only the specified catalytic assignment in both directions. The basal channel, other assignments, kinetic marks, feed and initial state stay the same. `AttributedReactor` adds six integrated density rewards: total nonfood export, signed local/other/basal inputs, and positive basal/other inputs. A signed reverse firing subtracts mass. Its inherited count simulator reports aggregate catalytic input; event incidence labels let downstream users add other count rewards. The JSON explicitly identifies that aggregate count ledger.

The default density-limit reactor names product 0011 catalysing 00+11 <-> 0011, with no other incidences. Export on (1,100] is about **119.075**, falling to **0.0000495626** after deleting this incidence in the specified deterministic comparison. Signed local input on [0,100] is about 120.314. It can exceed the collected window export because the observation windows and retained inventory differ. The model checks mass conservation and nonfood balance and compares DOP853 against Radau.

These concentrations and time units are dimensionless manuscript conventions, not calibrated chemistry. Internal reaction pairs conserve polymer length. The generator identity is G L=10-L; it does not make a stochastic path's total mass constant. In the density-limit illustration, the food-only initial condition has L=10, so its deterministic total mass stays 10.

## Preserve correlated rows and the cap atom

`ZipfLaw(n)` implements a=2-2/n, K drawn from the ordinary Zipf law, and **D=min(K,R)-1**. Degrees 0 through R-2 have their ordinary probabilities; the entire Zipf tail is placed at R-1. This is not truncation and renormalization, and the maximum degree is not R.

Conditional on D, a row chooses a uniform D-subset without replacement. Different catalyst rows are independent, but assignments within one row are strongly dependent. The reusable `sample` method follows that law. Conditioning on a named incidence uses degree weights d*omega_d/E[D], then samples the other d-1 distinct assignments. Simply adding an incidence to an unconditioned row would have the wrong distribution. `empty_food=True` additionally conditions all six food rows to be empty, as in the imported constructive witness; incompatible food-row conditioning is rejected.

```python
import numpy as np
from example import ZipfLaw
from polymer import PolymerCatalogue
catalogue = PolymerCatalogue(4)
law = ZipfLaw(4)
ordinary = law.sample(catalogue, np.random.default_rng(1))
incidence_conditioned = law.sample(catalogue, np.random.default_rng(2),
    conditioned_incidence=('0011','00','11'))
```

Analytic moments use finite-sum identities expressed through zeta tails, so n=1024 does not allocate its enormous catalogue. For large arguments the tail is evaluated with twenty Euler–Maclaurin corrections at 90-digit working precision. These are high-precision numerical evaluations of exact formulas, not outward-rounded probability certificates. Explicit degree tables are limited to 10,000 entries, catalogues to 1,022 species, and dense reactor matrices to 20 million entries. Larger models need appropriate sparse or analytic implementations.

The source figure uses a fixed rectangle of **two rows and two columns**. With p=E[D]/R and q2=E[D(D-1)]/[R(R-1)], its two-or-more probability is

    2*q2 - q2^2 + (2*p-2*q2)^2.

The excess-count and pair-count bounds both decay relative to p, while the first-moment bound divided by p stays at 4. Replacing q2 by p^2 is wrong: q2/p tends to zero, but q2/p^2 grows strongly. This small rectangle illustrates the source mechanism only; it is **not** substituted for the theorem's K*=10^12 rectangle.

## Candidate counts, degree bias and conditional laws

For every n>=4, direct enumeration gives 224 productive candidate incidences: 192 food-catalyzed and 32 product-catalyzed. Including food-product channels gives 248 singleton-RAF witness incidences. A productive candidate is an eligible structural type, not a sufficient success test.

`candidate_union` groups incidences by catalyst row and uses the exact without-replacement row-miss formula and independence only across rows. The finite tables for n=4..8 evaluate actual candidate-union probabilities; they are not replaced by 224p or 248p. Their ratios have not reached those asymptotic limits in this small range. The selected catalyst's conditional mean degree is E[D^2]/E[D], rather than E[D], so its background cannot be replaced by an isolated motif without further analysis.

`ConditioningLaw` keeps three reweightings distinct for a supplied finite environment law: successful-run weights proportional to mu(e)*pi(e), reliable-environment weights mu(e) restricted to pi(e)>=eta, and structural weights restricted to a RAF flag. It requires success probabilities as inputs and does not manufacture them from RAF status or one observed trajectory. This helper is tested on a labelled finite arithmetic example; no invented reliability table is presented as the polymer source's result.

The manuscript's candidate decomposition leaves the exact success prefactor open: success/p is asymptotically the sum of 224 environment-averaged candidate-conditioned success probabilities. Neither an exact prefactor 224 nor posterior proportions 6/7 food-catalyzed and 1/7 product-catalyzed follow from counting.

## The kinetic exclusions and what the numerical bounds mean

`local_classification` distinguishes neutral, mixed, outsider and productive incidences. A mixed channel adds a=1 or 2 units of food mass to existing nonfood; the credit P=M-a*x_product has exactly zero local increment in either direction and is at least 3M/5. An outsider catalyst is neither supplied nor produced by the food-enabled channel; P=M+2000*x_catalyst lets washout absorb its local positive-input bound 1936*x_catalyst, leaving a margin of 64. The code verifies these stoichiometric identities including catalyst coincidences.

`ProofBudgets.algebra` reproduces the rational inequalities used in the proof: the mixed reward budget 0.0105 is below 0.03, the outsider export budget is 83950361/937500000 < 0.1, and other positive input is bounded by 3186831/156250000 < 1/40. Together with the paper's stopped-noise estimates, these yield exclusion and more-than-three-quarters local attribution under the stated hypotheses.

`ProofBudgets.evaluate` exposes the sufficient V>=10^60(n+1)^2 envelope and pointwise catalytic-deletion upper bound 4 exp(-cV/n), c=1/(1.44*10^49). The exploratory volume 20 fails the hypotheses and is reported inapplicable. Even at the sufficient volume, the enormous fixed K* rectangle makes the finite-n multiplicity and posterior bounds **vacuous** throughout the displayed range. The source's asymptotic theorem is not a practical convergence estimate at these n, and the code does not claim otherwise. Log probabilities preserve tiny noise bounds without replacing them by exact zero.

No simulation here demonstrates the universal asymptotic result. The paper proves that, conditional on successful output at its volume scale, a unique productive local incidence is typical, deleting it makes success exponentially unlikely, and its signed input supplies more than three quarters of window export. It permits exceptional successful diffuse environments and other active reactions. There is no pathwise monotonicity claim under deletion, no global uniqueness claim for all RAFs and no claim that an eligible candidate guarantees success.

## Checks and provenance

Seven scientific test groups verify singleton equivalence and counts; the cap atom, moments and conditioned sampler; correlated hypergeometric row probabilities; repeated-input falling factorials and incidence-only deletion; credit identities and rational budgets; distinct conditionings; and numerical attribution balances, independent solver agreement and unfinished count-run handling.

Manuscript map: source/kernel/event, Section 2; theorem and conditionings, Section 3; kinetic observables, Section 4; multiplicity and rate, Section 5; candidate counts/size bias/attribution, Section 7; capacity and stopped rewards, Appendix A. The companion model components are original Lixiviant example code, adapted locally. The manuscript's Lean development is not rerun.

Licensing: MIT is proposed for these original example files, pending the owner's decision. No license grant is made here; manuscript licensing remains separate.
