# Rest and rhythm in one phosphorylation reactor

A kinase adds phosphate groups in three sequential steps; a phosphatase removes them. Each catalytic step releases the substrate. All six enzyme–substrate complexes compete for the same two free-enzyme pools. This shared sequestration supplies the coupling: there is no added feedback reaction, and no Michaelis–Menten elimination.

At one fixed list of eighteen positive rates and one fixed set of three conserved totals, the model supports both a stable equilibrium and an attracting periodic orbit. The example reconstructs the literal twelve-species system, computes both behaviours, and numerically switches between them by modulating only one association rate. A separate nine-coordinate representation preserves the conserved totals exactly at the algebraic level; it removes redundant coordinates, not chemical reactions.

## Run

Use Python 3.11 or newer in a virtual environment:

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

The complete ZIP includes all local modules, exact source data, numerical orbit guesses, the imported orbit certificate and saved outputs. Direct dependencies are pinned. The driver normally runs in about a minute; use `--output another-directory` to preserve a separate experiment. Inputs at the top choose the exact source file, independent rate multipliers, actuator, pulse, settling horizons and illustrative physical units. The exact source JSON exposes twelve equilibrium concentrations, three catalytic currents and the distinguished reverse ratio as rationals.

## Reusable components

| Component | Responsibility |
| --- | --- |
| `Model` in `phos.py` | Exact reaction list, stoichiometry, equilibrium/flux construction, conservation chart, Jacobian and rational-interval Hopf analysis. |
| `MassActionReactor` | Arbitrary positive rates on the fixed class, numerical equilibrium relocation, analytic Jacobian, full nonlinear integration, reaction counters and periodic shooting. |
| `Signal`, `ZeroSignal`, `ResonantPulse` | A scalar time-dependent relative rate change. Signals can be replaced without changing the chemistry. |
| `SwitchingExperiment` | ON pulse, autonomous evolution, positive section crossing, phase-triggered OFF pulse and separate long-time readout windows. |
| `local_certificate.certify` | Fresh directed-interval generalized-Hopf root, negative quintic coefficient, stable complementary spectrum and regular unfolding. |
| `input_rank.certify` | Fresh interval Kalman ranks for all eighteen single-rate inputs, using the freshly enclosed root. |
| `clock.normal_form` | Independent high-precision numerical centre-manifold recurrence, rebuilt from the literal reaction model. |

For example, construct `MassActionReactor(finite_model(), input_rate='c2')`, then use `.controlled(your_signal)` to modulate that catalytic rate alone. A signal returns a relative change `u(t)`, so the actual rate is `k * (1 + u(t))`. The reactor rejects a nonpositive rate. Changing an enzyme total is a different intervention; it cannot be represented as a single-rate signal.

Small `RATE_MULTIPLIERS` changes are supported: the driver relocates the equilibrium, refines the orbit guesses, and rejects a computed pair that fails the numerical attraction checks. Large changes may require new guesses and section vectors in `ORBIT_SEEDS_FILE`; failure to converge is not proof that an orbit is absent. Reference interval certificates always concern the **published exact source or generalized-Hopf patch**, not edited parameters. For broader sweeps, call the reactor and shooting components directly and record unsuccessful solves rather than silently discarding them.

## Read the result

The default attracting orbit has numerical period about **28.69124** and fully phosphorylated-pool range about **2.34593**. Its leading nontrivial Floquet multiplier is about **0.92986**, while the same source's equilibrium has negative real parts in its restricted Jacobian. The inner unstable orbit is also numerically refined; its leading nontrivial multiplier is about 1.01604. It illustrates a switching threshold without supplying a complete nine-dimensional basin boundary.

The default pulse modulates `alpha1` by at most ten percent over three periods. ON starts at rest. OFF waits for a specified section crossing and uses a different phase. The saved trace carries the actual state through every segment; all other rates and all three totals are unchanged. Independent LSODA/Radau pulse solves agree to roughly 1e-8 in chart coordinates. After long autonomous evolution, the ON readout range is about 2.346 and the OFF range about 0.0003. The remaining OFF ripple is a transient, not a second settled rhythm.

`physical_interpretation.json` reports sequestration, period, recovery, catalytic turnover and a diagnostic readout-sampling calculation. Reaction counters show that the cycle turns over slightly less phosphate per period than the resting state. They count the effective irreversible catalytic reactions; they do not constitute a closed-system thermodynamic or stochastic fuel model.

The optional scales of 0.1 micromolar and 100 seconds give a period near 47.8 minutes. They are uncalibrated. Recovery remains slow in any units: about fourteen periods for the cycle and ninety for rest per e-fold. These are local relaxation times, not guaranteed settling times. The leading-order normal-form CSV shows why smaller possible control amplitudes near the organizing point accompany narrower parameter margins and slower recovery. It is not a full-reactor sweep or a calibrated actuator-effort law.

## Evidence boundaries

The generalized-Hopf and all-input-rank interval computations are freshly run, as is the finite-family subcritical Hopf calculation. The independent quintic calculation is high-precision numerical evidence. Numerical shooting freshly reproduces the finite orbit, variational multipliers, positivity on sampled trajectories and conservation ledgers.

The manuscript's separate finite-orbit proof is included as `imported_orbit_certificate.json` with its hash. This package does **not** rerun the approximately sixteen-minute multiple-shooting interval proof or the separate Fourier proof. The imported proof and fresh numerical orbit are clearly separated in the outputs; no formal identification of independently validated orbit neighbourhoods is added.

The switching theorem is local and qualitative: for a chosen duration and amplitude bound, suitable coexisting baselines exist sufficiently close to the generalized-Hopf point. It does not certify the finite witness's ten-percent pulse, arbitrary-phase OFF, an independent tolerance box on rates, or finite switching error tolerances. Full Kalman rank alone does not establish cheap or well-conditioned control. The finite-witness pulse is C1, not the compactly supported C-infinity signal in the theorem. Its successful simulation is labeled numerical throughout. No stochastic memory-retention bound or Lean replay is claimed.

## Provenance and license

Manuscript: `Rest_Rhythm_Bistability_Single_Rate_Switching_Phosphorylation.pdf`, SHA-256 `efe1d3ed4fc2b556aed9c0eb6b3b62957ffeb32c9cfbf1edf67d93e11728a266`. `source_provenance.json` records source-file hashes and adaptations. Exact model and rational-interval kernels are preserved; certificate wrappers return their results without modifying the research directory. Numerical NPZ seeds are converted to portable JSON. Run metadata records code, input and output hashes.

MIT is proposed for original example code, pending owner confirmation. This package does not grant that license or alter rights in imported material.
