hv-chemical-life
Five chemical-life substrates in one NumPy-only toolkit. Hypercycle dynamics, nested zombie ecology, Eigen error threshold, self-modifying genome, and topological protection. One API, one retention ladder.
Size: ~18 KB source, no weights. Runtime: ~3 s for the full benchmark. Dependencies: NumPy only.
The retention ladder
The source archive organizes chemical information processing into seven rungs. This toolkit implements five:
| rung | memory type | mechanism | implemented |
|---|---|---|---|
| 1 | agent trajectory | fitness gradient | no |
| 2 | population pattern | hypercycle | yes |
| 3 | classical phase | parameter region | partial |
| 4 | genome sequence | error threshold | yes |
| 5 | quantum MBL | eigenstate property | no |
| 6 | topological invariant | crossing count | yes |
| 7 | self-modifying rule | evolved μ | yes |
Plus the nested-zombie host-parasite ecology as a fifth substrate.
The ladder's claim: each rung replaces a decaying quantity with a more protected one.
Headline numbers
Hypercycle — Eigen-Schuster instability at large N:
| N | parasite=False | parasite=True |
|---|---|---|
| 3 | stable | stable |
| 5 | stable | stable |
| 6 | critical N | critical N |
| 12 | unstable | unstable |
| 20 | unstable | unstable |
| 30 | unstable | unstable |
Critical N for this parameterization: N = 6. Below N, the cycle is stable. Above, the wave amplitude grows and individual species drop below the synthesis floor.
Nested zombie ecology — escape-rate transition:
| escape rate | regime |
|---|---|
| 0.1 | endosymbiont |
| 0.3 | parasite |
| 0.5 | parasite |
| 0.9 | parasite |
Eigen error threshold — sharp phase boundary:
| L | σ | μ_crit | L·μ_crit |
|---|---|---|---|
| 50 | 2 | 0.0400 | 2.000 |
| 100 | 2 | 0.0200 | 2.000 |
| 500 | 2 | 0.0040 | 2.000 |
| 1000 | 2 | 0.0020 | 2.000 |
L·μ_crit is the invariant, depending only on σ. Confirms
L·μ_crit = 1/(1-1/σ).
Self-modifying genome — μ tracks environmental drift:
| scenario | μ_init | μ_final |
|---|---|---|
| static | 0.01 | 0.00 |
| constant drift 0.05 | 0.01 | 0.25 |
| linear drift | 0.01 | 2.45 |
| sinusoidal drift | 0.01 | 0.00 |
Steady-state formula μ* = α·d/β = 0.25 confirmed exactly.
Topological protection — writhe mod 2:
| move | Δwrithe | Δmod-2 |
|---|---|---|
| R1 | ±1 | ±1 |
| R2 | ±2 | 0 |
| R3 | 0 | 0 |
Mod-2 writhe is invariant under R2 and R3.
27/27 consistency checks pass.
The two classical results reproduced
1. Eigen-Schuster hypercycle instability. Without a parasite, the hypercycle is only stable for small N. Above N* ≈ 6–10, internal mutants destabilize the cycle, and individual species drop below the synthesis floor. The instability is not driven by external invasion — it's internal. Compartmentalization is required for stability at large N.
2. Sharp vs smooth thresholds. Threshold sharpness is determined by state-space size. The Eigen threshold is sharp at L ≥ 100, smooth at L = 50. The hypercycle transition is sharp in N. The escape-rate transition in nested zombies has the same shape. All three are the same mathematical structure in different substrates.
How to use
from hv_chemical_life import (
Hypercycle, NestedEcology, ErrorThreshold,
SelfModifyingGenome, TopologicalMemory,
ChemicalLifeOS, critical_N,
)
os_ = ChemicalLifeOS()
# Hypercycle with and without a parasite
r = os_.simulate_hypercycle(N=6, parasite=True)
# r['collapsed'] = False or True
# r['final_C_min'] = smallest surviving member concentration
# Nested zombie
r = os_.simulate_zombie(e=0.5)
# r['regime'] = 'endosymbiont' | 'parasite' | 'host_only' | 'extinction'
# Error threshold
r = os_.simulate_threshold(L=100, sigma=2.0, mu=0.005)
# r['is_informational'] = True
# r['mu_crit'] = 0.02
# Self-modifying genome
r = os_.simulate_selfmod(drift_schedule=lambda i: 0.05, n_steps=500)
# r['mu_final'] = 0.25
# Topological
r = os_.simulate_topological(moves=('R3', 'R2_+', 'R1_+'))
# r['protected_quantity'] = final mod-2 writhe
# Retention ladder — all five substrates, unified output
ladder = os_.retention_ladder()
# Critical hypercycle size
Nc = critical_N(parasite=True, N_range=(2, 30))
- Downloads last month
- 19