Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ faster than real time.
| `vh.molecular` | From-scratch JAX engine: AMBER ff14SB force field, GB-OBC2 implicit water, autodiff forces, Langevin (BAOAB) and Verlet dynamics, L-BFGS minimization | Matches OpenMM (used only as a referee) term by term to ~1e-14 relative on real proteins; trajectories identical step by step; energy conserved ([`docs/validation_molecular.md`](docs/validation_molecular.md)) |
| `vh.body` | From-scratch whole-body PBPK: 13 organs + blood, Rodgers & Rowland tissue partitioning, liver (well-stirred, IVIVE), kidney (filtration), oral absorption (stomach + 7-segment intestine) with gut-wall first-pass, virtual populations; solved exactly with matrix exponentials | Bottom-up midazolam predictions vs 100 clinical datasets (IV and oral) digitized by the Open Systems Pharmacology project |
| `vh.bridge` | Unbound drug at the target organ → receptor occupancy over time; Kd ↔ binding free energy | Analytic round-trip; kinetic occupancy |
| `vh.graph` | **Formalizes the body as a typed graph** across scales (organs↔blood flow, species↔reactions, atoms↔bonds); graph algorithms for reachability, pathways, cycles, flow balance, bottlenecks; **conserved-flow graphs** with R/C/L edge laws, gravity, Bernoulli, Starling collapse and valves; renders and verifies subgraphs; imports SBML reaction networks with exact conservation and consistency invariants | Blood conservation (Kirchhoff) to 1e-16 on the real PBPK model; a pure graph BFS reproduces the force field's exclusion list exactly; steady flow exact against Hagen–Poiseuille/Windkessel/Starling, and the standing foot venous pressure predicted at **88.7 mmHg** vs the physiological **85–90 mmHg** range; SBML trajectories and steady states match libRoadRunner to ~1e-9 ([`docs/graph_formalization.md`](docs/graph_formalization.md), [`docs/bernoulli_veins.md`](docs/bernoulli_veins.md)) |
| `vh.graph` | **Formalizes the body as a typed graph** across scales (organs↔blood flow, species↔reactions, atoms↔bonds); graph algorithms for reachability, pathways, cycles, flow balance, bottlenecks; **conserved-flow graphs** with R/C/L edge laws, gravity, Bernoulli, Starling collapse and valves; renders and verifies subgraphs; imports SBML reaction networks with exact conservation and consistency invariants; finds rate-dependent kinetic invariants such as exposure (AUC) identities | Blood conservation (Kirchhoff) to 1e-16 on the real PBPK model; a pure graph BFS reproduces the force field's exclusion list exactly; steady flow exact against Hagen–Poiseuille/Windkessel/Starling, and the standing foot venous pressure predicted at **88.7 mmHg** vs the physiological **85–90 mmHg** range; SBML trajectories and steady states match libRoadRunner to ~1e-9 ([`docs/graph_formalization.md`](docs/graph_formalization.md), [`docs/bernoulli_veins.md`](docs/bernoulli_veins.md)) |
| `web/` | Real-time demo: atom-level protein dynamics and a virtual patient, live in the browser | JS engine checked against the Python engine to ≤1e-12 |

The explicit-solvent engine (`vh.molecular.periodic`, `.constraints`, `.explicit_md`) adds rung 3 of the accuracy ladder: every water molecule, exact long-range electrostatics (Ewald / smooth PME), rigid-water SHAKE/RATTLE and a Monte-Carlo barostat — validated term-by-term against OpenMM Ewald (energy to 1e-13, PME to 1e-11, constraints to 1e-16).
Expand Down Expand Up @@ -192,7 +192,8 @@ vh/molecular energy.py (force field), integrate.py, minimize.py, prep.py, io.p
vh/body physiology.py, partition.py, compound.py, pbpk.py
vh/bridge molecular → body coupling (Kd ↔ ΔG, receptor occupancy)
vh/graph core.py (typed property graph), algorithms.py, flow.py (conserved-flow solver), physiology_graph.py, render.py,
contracts.py (model interfaces), sbml.py (SBML import), stoichiometry.py (exact algebra)
contracts.py (model interfaces), sbml.py (SBML import), stoichiometry.py (exact algebra),
reactions.py (mass-action dynamics, ordered interventions, kinetic invariants)
tests/ pytest suite
scripts/ validation report + figure generators
docs/ accuracy_ladder, graph_formalization, feasibility, validation reports, architecture, roadmap
Expand Down Expand Up @@ -220,6 +221,7 @@ research tracks, and how to publish work under [`auto-research/`](auto-research/
- **OpenCode agent (DeepSeek V4.1 Flash Free)** — conserved-flow graph, vein model, Bernoulli derivation, and flow validation under the above direction.
- **OpenAI Codex** — graph interface contracts, clearance reference validation, conserved reaction/intervention experiments, and explicit evidence bindings, under the direction of [@ahrazzle](https://github.com/ahrazzle).
- **Claude** (Anthropic), Foundation-0 fork — SBML import with exact conservation and positive-mass consistency invariants.
- **Claude** (Anthropic), Foundation-0 fork — rate-dependent kinetic invariants (exposure/AUC and clearance identities) and the paraneoplastic antigen-exposure experiment for Project Asma.
- **MikeMike88 with Claude Code (Claude Opus 5.5)** — steady-state complementarity: uniqueness proof, finite pivoting solver, scaled convergence test, enumeration referee.

New contributors (human or agent): add yourself here in your pull request. See
Expand Down
186 changes: 186 additions & 0 deletions auto-research/2026-11-05-E-paraneoplastic-exposure/bridge-results.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
{
"as_of": "2026-11-05",
"asma_bridge": {
"asma_checkout": {
"commit": "a5086b8ccd19dcee50c2b34f0d1104e07e48d1e0",
"dirty": false
},
"asma_module_sha256": "baa093bb4162ce6f680d45a79f3a52190a3ae5e82d6d36ffd5cb811eda59b7fa",
"comparisons": 28,
"max_absolute_error": 8.526512829121202e-12
},
"authorities": [
"exact kinetic invariants (rational nullspace)",
"closed-form integrals",
"Project Asma exact rational module (optional bridge)"
],
"checks": {
"continuous_schedules": [
{
"best_position": 0,
"continuous_criterion_surgery_first": true,
"hypothesis": "burden",
"surgery_keep": 0.1
},
{
"best_position": 0,
"continuous_criterion_surgery_first": true,
"hypothesis": "release",
"surgery_keep": 0.1
},
{
"best_position": 6,
"continuous_criterion_surgery_first": false,
"hypothesis": "burden",
"surgery_keep": 0.75
},
{
"best_position": 0,
"continuous_criterion_surgery_first": true,
"hypothesis": "release",
"surgery_keep": 0.75
}
],
"discrete_schedules": [
{
"best_position": 0,
"exposure_by_position": [
21.71874999999823,
61.718750000007105,
81.71875000000739,
91.71875000000682,
96.71875000000796,
99.21875000000853,
100.46875000000739
],
"hazard_difference_late_minus_early": 0.6999999838016645,
"hypothesis": "burden",
"identity_error": 8.881784197001252e-14,
"identity_prediction": 0.6999999838017533,
"surgery_keep": 0.1,
"survival_exp_minus_h_error": 1.0345058143457209e-12,
"survival_ratio_late_to_early": 0.49658531183443677
},
{
"best_position": 0,
"exposure_by_position": [
9.84375,
54.84375,
77.34375,
88.59375,
94.21875,
97.03125,
98.4375
],
"hazard_difference_late_minus_early": 0.7874999914193581,
"hypothesis": "release",
"identity_error": 3.3306690738754696e-16,
"identity_prediction": 0.7874999914193578,
"surgery_keep": 0.1,
"survival_exp_minus_h_error": 1.2218004385999848e-12,
"survival_ratio_late_to_early": 0.45498083062086825
},
{
"best_position": 6,
"exposure_by_position": [
162.890625,
137.890625,
125.390625,
119.140625,
116.015625,
114.453125,
113.671875
],
"hazard_difference_late_minus_early": -0.437499989876045,
"hypothesis": "burden",
"identity_error": 2.886579864025407e-15,
"identity_prediction": -0.4374999898760421,
"surgery_keep": 0.75,
"survival_exp_minus_h_error": 7.252254352607679e-13,
"survival_ratio_late_to_early": 1.5488302829569598
},
{
"best_position": 0,
"exposure_by_position": [
73.828125,
86.328125,
92.578125,
95.703125,
97.265625,
98.046875,
98.4375
],
"hazard_difference_late_minus_early": 0.2187500122399817,
"hypothesis": "release",
"identity_error": 1.2490009027033011e-15,
"identity_prediction": 0.21875001223998294,
"surgery_keep": 0.75,
"survival_exp_minus_h_error": 1.1678991107544334e-12,
"survival_ratio_late_to_early": 0.8035225638529566
}
],
"exposure_identity_is_exact_kinetic_invariant": {
"burden_chemo_0": true,
"burden_chemo_1": true,
"release_chemo_0": true,
"release_chemo_1": true
},
"max_continuous_closed_form_relative_error": 5.0162540787823674e-12,
"max_exposure_invariant_drift": 8.651109342783236e-14,
"regimes_after_removal": {
"antigen_driven": {
"committed_error": 2.5673907444456745e-15,
"committed_hazard_bound": 0.09999999979388464,
"committed_hazard_observed": 0.09999999979388208,
"marker_ratio_t10_to_t2": 0.021889566863806328,
"marker_ratio_t20_to_t2": 0.00014793495189425375,
"remaining_neurons_at_end": 0.5488116362071094
},
"autonomous_cns": {
"marker_ratio_t10_to_t2": 0.3275330811131708,
"marker_ratio_t20_to_t2": 0.15051984165370738,
"remaining_neurons_at_end": 0.1060600326085199
}
},
"steady_state_signature": {
"burden": {
"max_rise": 7.220890552162018e-13,
"never_rises": true,
"rises_during_first_chemo": false
},
"release": {
"max_rise": 3.3137062052728794,
"never_rises": false,
"rises_during_first_chemo": true
}
}
},
"integration": {
"max_step": 0.005,
"method": "fixed-step RK4"
},
"limitations": [
"invented rates, burdens and units",
"no physiological conversion",
"tumor growth, resistance and order-dependent surgery omitted",
"no anti-Yo, NfL, patient or treatment-benefit claim"
],
"scope": "synthetic_mathematics_and_software_only_not_biological_validation",
"source_sha256": {
"validation_script": "66c506dc5f36d30776fb485b7a27736a2c044e540b876a915f5f4386eeb2ddca",
"vh_reactions_module": "c062e08a19e6a9ed39df2b2eec2d4f6de98c260e1c63f78381586d2108a51cde"
},
"status": "pass",
"tolerances": {
"asma": 1e-09,
"closed_form_relative": 1e-08,
"committed": 1e-08,
"drift": 1e-10,
"identity": 1e-10,
"survival": 1e-08
},
"virtual_human_checkout": {
"commit": "c88db663ad4193d12de595a1c8df8c784ad92c7d",
"dirty": false
}
}
107 changes: 107 additions & 0 deletions auto-research/2026-11-05-E-paraneoplastic-exposure/report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Kinetic invariants and paraneoplastic antigen exposure

- **Track**: E (graph and reaction formalization)
- **Author**: Claude (Anthropic), Foundation-0 fork, under the Project Asma owner's direction
- **Date**: 2026-11-05
- **Branch**: `claude/admiring-cori-0qyybb`
- **Code added**: `vh/graph/reactions.py` (`kinetic_invariant_basis`, `kinetic_residuals`),
`scripts/validate_paraneoplastic_exposure.py`, `tests/test_kinetic_invariants.py`,
`tests/test_paraneoplastic_exposure.py`

## Question

Project Asma asked what an irreversible, immune-mediated neural injury records
about a tumor's antigen over time, and whether treatment order can change it when
order provably cannot change the tumor endpoint. Answering that on this engine
needs a reusable capability the engine lacked: exact detection of conserved
quantities that depend on **rate values**, which is how an integral such as an
antigen exposure (AUC) or an eliminated amount becomes checkable.

## Method

**Library.** For mass-action `dC/dt = S v(C)`, group reactions by reactant
monomial. Distinct monomials are linearly independent functions, so `w` is a
linear invariant for every state exactly when `w` annihilates each group's
rate-weighted stoichiometry. `kinetic_invariant_basis()` solves that system with
the existing exact rational row reduction. Rates are the exact values of the
stored floats unless rationals are supplied whose float equals the stored rate.
`kinetic_residuals()` checks a declared invariant per monomial. Stoichiometric
pools are always included; rate-dependent vectors appear only when reactions share
a monomial.

**Experiment.** An invented, dimensionless network contains tumor burden `A`, an
antigen-driven effector `E`, target neurons `N`, an injury marker `F`, an
optional self-sustaining CNS effector `C`, and accumulators for burden exposure
`U`, burden killed in the body `R` and cumulative hazard `H`. Rate scales select
**burden-driven** presentation (`A -> A + E`) or **release-driven** presentation
(chemotherapy kill `A -> E + R`). Surgery is an instantaneous retain on `A`.
Schedules place one surgery among six chemotherapy cycles, either as instantaneous
operations matching Asma's exact null case, or with chemotherapy as a continuous
kill over one unit. Quantities are reused as mol/L and seconds only because the
engine requires units.

## Validation

Authorities: exact kinetic invariants, closed-form integrals and, as an optional
bridge, Project Asma's exact rational module `tools/analyze_paraneoplastic_exposure.py`.
Fixed-step RK4 with step 0.005.

| Quantity | This work | Authority | Error |
|---|---|---|---|
| Exposure identity `H + (κ/δ)E − (κα/δ)·source` | Found by the finder | Hand derivation | Exact (4/4 hypothesis × chemotherapy settings) |
| Clearance identity `X − kU` | Found by the finder | Hand derivation; bolus `dose/k` | Exact; numerical `≤ 1e-12` |
| Invariant drift along all discrete protocols | RK4 trajectories | Constant of motion | max `8.7e-14` |
| Hazard difference between surgery positions | RK4 | Identity at finite time | max `8.9e-14` |
| Survival `N = exp(−H)` | RK4 | Exact solution | max `1.2e-12` |
| Exposure and release by position (28 values) | `U`, `R` accumulators | Asma exact rationals | max `8.5e-12` absolute |
| Continuous-chemotherapy exposure, release, endpoint | RK4 | Closed-form integrals | max `5.0e-12` relative |
| Committed hazard after complete antigen removal | RK4 | `κE(t*)(1−e^{−δT})/δ` | `2.6e-15` |

Executed findings on the invented fixture:

| Finding | Result |
| --- | --- |
| Equal tumor endpoint, different neural exposure | Surgery first versus after three cycles, surgery retaining 1/10: hazard difference 0.700 (burden) and 0.7875 (release), each equal to κ times Asma's exact exposure difference of 70 and 78.75 |
| Hypotheses disagree when surgery is weak | Surgery retaining 3/4: burden-driven exposure is lowest with surgery last; release is lowest with surgery first |
| Continuous chemotherapy moves the threshold | Burden-driven optimum is surgery-first when `q < 1/(1 + c)` (here `q < 0.591`), not `q < a`; both endpoints confirmed by simulation |
| Regimes after antigen removal | Marker ratio t=20 to t=2: `1.5e-4` antigen-driven versus `0.15` autonomous |
| No-rise theorem | From steady state, burden-driven effector never rises (largest step `7.2e-13`, numerical noise); release-driven rises during the first chemotherapy cycle |

A wiring error was caught by the finder during development: the first version of
the release hypothesis left burden presentation on, and the pure release identity
correctly failed. The test suite now asserts that the pure identity fails for the
mixture.

## Limits

- Every rate, burden and unit is invented. Hazard differences show bookkeeping and
direction, not effect sizes. No anti-Yo biology, NfL behavior, patient course or
treatment benefit is claimed or validated.
- Tumor growth, resistance, order-dependent surgical effectiveness and drug
pharmacokinetics are omitted; each can change the order conclusions.
- The invariant finder is exact for the supplied mass-action equations only. It
does not find nonlinear invariants such as `ln N + H`, which is checked here
numerically. Exact rational elimination can be expensive for large networks.
- The Asma bridge needs a trusted local checkout and imports its module; Asma is
not a dependency of the library or the test suite.

## Reproduce

```bash
PYTHONPATH=. python -m pytest -q tests/test_kinetic_invariants.py tests/test_paraneoplastic_exposure.py
PYTHONPATH=. python scripts/validate_paraneoplastic_exposure.py > results.json
PYTHONPATH=. python scripts/validate_paraneoplastic_exposure.py \
--asma-root /path/to/project-asma > bridge-results.json
```

`results.json` and `bridge-results.json` in this folder record the executed runs,
checkout commits, dirty flags and SHA-256 hashes of the executed sources.

## References

- Project Asma record: [What the brain records](https://github.com/Foundation-0/project-asma/blob/main/docs/research/paraneoplastic-exposure-observability.md)
(public literature premises, exact rational results and the proposed study design).
- Albert ML et al. Tumor-specific killer cells in paraneoplastic cerebellar
degeneration. Nat Med 1998;4:1321–1324. doi:10.1038/3315 (motivates release-driven presentation).
- Venkatraman A, Opal P. Paraneoplastic cerebellar degeneration with anti-Yo
antibodies – a review. Ann Clin Transl Neurol 2016;3:655–663. doi:10.1002/acn3.328.
Loading
Loading