# Single-lineage measurements and treatment order

This companion builds the paper's three-type branching family, the pruned observation experiment and the paired-sister assay as separate reusable components. Its central lesson is not that all lineage measurements fail: the specified retained-branch protocol removes a joint daughter coordinate that a full-family decision needs.

## Run and edit

Use Python 3.11+ in a virtual environment:

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

Edit the constants at the top of `example.py`. They control exact `x=exp(-pulse length)`, founder covariance, descendant division, optional persistent descendant marginals, founder configuration, marker noise and supplied agreement counts. All rates are synthetic paper units. The default 600 agreements in 800 pairs is illustrative input, not collected data. A mean founder waiting time of 24 hours is an optional dimensional interpretation, not a population doubling time or fitted parameter. It rescales every hazard together and cannot repair rate ratios.

The default pulse is `log(8/7)`, founder covariance 0.2 and descendant division 0.01. Try `EXP_MINUS_PULSE=49/50`, covariance ±1/4 and descendant division 1 to reproduce the short-pulse regime. Inputting `x` as a rational allows exact reference probabilities and outward logarithm enclosures. The implemented alternating series requires `1/2 < x < 1`. The algebraic boundary itself supports all `0 < x < 1`.

The configured source and assay outputs belong to edited inputs. The recurring-division witnesses, three finite-sample rules, effort comparison and observation-equivalence demonstration are fixed reference casebooks. The covariance curve uses the common half-marginal descendant kernel at the configured pulse and division rate; the optional persistent configuration is separately saved in `configured_source.json`.

## Source and components

`SisterKernel` holds a feasible binary joint law with a declared marginal and covariance. `FamilySource` starts from types P,S,T: P divides at rate one without dying; S and T divide at rate epsilon and die at action-dependent rates. A has death rates `(2,4)`, B `(3,3)`. Daughter subtrees are independent only after conditioning on both daughter states. Their states need not be independent. The backward ODE composes phases in reverse chronological order and uses no population cutoff. Terminal extinction probabilities default to zero for finite-time extinction. Other terminal vectors represent a separately specified continuation, not the same endpoint.

`RetainedBranchExperiment` simulates the exact marginal record, including timestamps, division labels, self-transitions, death and censoring. At each division a state-independent retained daughter has the common marginal. The omitted sister and its subtree are not observed. Exact event/transition signatures establish record-law equality; forty identical seeded records illustrate it. Equality of means is also checked but is a weaker fact. Full trees, sister observations, survivor selection and sister-dependent retention are outside this equivalence. Pure molecular partitioning may determine the omitted sister by conservation, so the free phenotype covariance must not be imported into that stronger model.

`ReferenceCertificate` supplies exact pulse and constant reference probabilities, the task-specific boundary, and the sensitivity reserve that bounds recurring descendant division in one direction. `exact_engine.py` is the attributed, unmodified manuscript integration engine. It rebuilds exponential-polynomial phase integrals and propagates rational logarithm enclosures. `DecisionBand` translates the two one-sided reserves into a decision or an unresolved interval. Its source response law is explicitly fixed; replacing A/B rates requires rederiving these certificates even though the numerical family model supports other death rates.

`PairedDecisionRule` uses exact integer binomial tails and keeps low/high decisions separate. `SymmetricReadout` prices known, conditionally independent symmetric marker flips. The confidence-interval function bisects exact tail tests outward; calibration projection preserves a shared attenuation interval. Additional functions expose the calibration-free pulse rule, an additive correlated-error reserve and minimax regret. No universal modeling framework is required.

## Results and evidence

The pulse contrast is **AB extinction minus BA extinction**. Positive favors AB. Its exact reference form is `slope*(threshold-covariance)`, with threshold about 0.137064 at `x=7/8`; a sign-only covariance measurement is insufficient. Fresh symbolic checks verify the full factorization and positivity of the derivative numerator. The unique crossing of threshold 1/4 lies at `x in (0.80120,0.80121)`. Longer pulses beyond that crossing favor AB for every feasible covariance. The manuscript Figure 2 caption reverses the below/above-pulse wording; the example follows Proposition 3 and the checked derivative.

Exact sensitivity reserves reproduce reversals at covariance ±1/5 through epsilon 1/30, ±1/4 through epsilon 1/16, and at `x=49/50`, ±1/4 through epsilon 1. The final case allows descendants to divide as fast as the founder. The arbitrary-descendant supersolution criterion is checked before transferring the certificate to persistent marginals or other descendant kernels. The optional persistence kernels have marginal S probabilities 0.6 and 0.4; founder covariance and descendant covariances remain different parameters.

The forty-pair constant-action rule chooses A at 25 or more agreements. It guarantees over 95% correct choice only on the specified separated class, with epsilon at most 1/4. It does not infer separation, provide a general confidence interval, or solve the pulse-order task. Constant actions have a different threshold near 0.084323 and the opposite covariance orientation.

The full-class rules at epsilon at most 0.01 permit abstention:

| Task | Pairs | Low-c choice | High-c choice |
| --- | ---: | --- | --- |
| Constant actions | 200 | B if agreements ≤106 | A if agreements ≥137 |
| Pulse order | 800 | AB if agreements ≤496 | BA if agreements ≥584 |
| Pulse order | 1600 | AB if agreements ≤1009 | BA if agreements ≥1153 |

Other counts return unresolved. Exact integer sums certify boundary error tails and resolution at covariance ±0.2. Reserves are rounded outward to a rational grid before the binomial calculation; tail probabilities are saved as outward rational decimal intervals to avoid enormous numerators in output files. The 5% bound is unconditional false-declaration probability, not error conditional on making a declaration. Resolution means either declaration, not necessarily the correct one.

Unknown symmetric noise can preserve the covariance sign but obscure a shifted threshold. `(c,eta)=(0.05,0)` and `(0.2,0.25)` give the same agreement probability 0.6 and opposite constant-action decisions. Calibration must be projected jointly and its coverage error charged. If attenuation includes zero, the implementation returns the whole covariance range when the bit interval includes 0.5; otherwise it requests a refined feasible-set calculation instead of inventing a bound. Correlated errors require an explicit bound on average conditional error covariance and the stated conditional-mean model. An agreement bit alone does not determine an asymmetric channel's unknown center.

The direct-endpoint benchmark is a sufficient Bernstein budget for the same separated constant-action task at epsilon ≤0.01: 2,688,960 roots per arm. It is not an optimal sample-complexity lower bound or proof that the paired assay is universally preferable. Paired collection costs are expectations under the specified independent deadline, with read/calibration costs additional. For residual ambiguity, the regret helper explicitly takes **first survival risk minus second survival risk**, the negative of the extinction contrast; it does not mix these signs.

The one-founder extinction probabilities are only about 3%, so both pulse orders leave survival near 97%. Multiple independent P founders preserve the rank but rapidly reduce the extinction difference. Random preparation requires averaging the full product; shared environments require conditional analysis. Comparing this menu does not optimize every possible treatment policy.

## Verification and scope

Seven scientific tests independently check the joint/marginal distinction, exact boundary, ODE composition, monotonicity/reserves with persistent descendants, binomial cutoff inequalities, outward confidence intervals, mean Jacobian, risk orientation and invalid-input rejection. The numerical curves are diagnostics. Exact certificates use the manuscript's stochastic comparison and observation-equivalence theorems; this package does not machine-prove those theorems or rerun Lean. Source hashes, the manuscript hash, provenance, rational certificates, CSVs and regenerated PNG/SVG figures are included.

MIT is proposed for newly authored code, pending owner confirmation; no license grant is asserted here. Preserve the manuscript engine's provenance when reusing it.
