"""UPMV: falsifiable, uncalibrated kinetic assembly model. Python 3.10+. No molecular-dynamics, free-cluster geometry, or experimental claims are implied. All six protocols use the SAME transient continuous-time Markov chain. """ from __future__ import annotations import argparse, csv, json, math, platform from pathlib import Path from dataclasses import dataclass, asdict import numpy as np import scipy from scipy.linalg import expm ROOT=Path(__file__).resolve().parents[1] MODES=('random','coded','hierarchical','proofreading','proofreading_hierarchy','locking') @dataclass(frozen=True) class Parameters: kon: float=1e6 # M^-1 s^-1, illustrative c_total: float=1e-7 # M primary component concentration koff_correct: float=0.01 # s^-1 progress_rate: float=0.1 # s^-1, fuel-driven checking/capture gap_kbt: float=6.0 # total WRONG-CORRECT energy gap, not per base checks: int=2 b: int=4 hold_loss: float=1e-6 # s^-1, metastable retained-module loss fusion_error: float=1e-4 # per accepted join, illustrative fusion_delay: float=60.0 # s per level, counted inside total deadline dilution_exponent: float=1.0 # c(level)=c0*b^(-alpha*(level-1)) deadline: float=20000.0 # s def generator(lc,lw,dc,dw,mu,checks): """E <-> C_j/W_j; C_j/W_j -> next checkpoint -> AC/AW. Final capture = metastable retention. AC/AW absorbing during this local assay. Reverse checkpoint paths neglected: driven, NOT equilibrium proofreading. """ ns=checks+1; ac=1+2*ns; aw=ac+1 Q=np.zeros((aw+1,aw+1)); Q[0,1]=lc; Q[0,1+ns]=lw for start,dest,d in ((1,ac,dc),(1+ns,aw,dw)): for j in range(ns): Q[start+j,0]=d Q[start+j,(start+j+1 if j+1