# Inkhaven 1.5.4 — Computational `/calc` (RESRCH-4, first cut)

_1.5.3 paid down the research assistant's debt. 1.5.4 turns `/calc` from a unit/constant calculator into
a **computational research instrument**: it reads **this project's own World-book facts** and computes on
them with **astronomy/planetology formulas** — deterministically, `origin=computed`, gate-bypassed, and
**self-citing**. No new crates, no network._

_RFC: [RESRCH-4_RFC.md](../PROPOSALS/RESRCH-4_RFC.md) · track:
[RESRCH-4_TRACK.md](../PROPOSALS/RESRCH-4_TRACK.md)_

## World-book readers (R4-D) — the keystone

`/calc` can now pull the materialized **WORLD-4 simulation** facts into a calculation:

- **`world.get <path>`** — the value at a `Chapter/field[/index|key…]` path in the World book (e.g.
  `"Astronomy/year_length_planet_days"`, `"Climate/zones/0/annual_mean_c"`). Pushes a number, or
  **`NODATA`** when the path doesn't resolve — it never invents a value.
- **`world.has <path>`** tests a path; **`world.dict <Chapter>`** pushes a whole layer as a Bund dict.
- **Convenience words** for the materialized astronomy figures: `world.year`, `world.declared_year`,
  `world.tilt`, `world.star_mass`, `world.orbit_days`, `world.divergence`.
- **Transparent + self-citing:** every World read is echoed in the result (`world: <path> = <value>`),
  and a `/fact` taken from a World-grounded `/calc` records provenance **`computed · world:<path>`** — the
  deterministic tier of the trust ladder, now citing its source. (Requires a materialized World book —
  run `inkhaven realworld compile --materialize`.)

## Astronomy & planetology + math substrate (R4-B, R4-A)

Deterministic formulas in convenient units, tested against Earth/Sun known values, that **compose with
the World readers**:

- `kepler_period` (a [AU], M [M☉] → T [yr]), `surface_gravity` / `escape_velocity` (Earth units),
  `insolation` (L [L☉], d [AU] → W/m², inverse-square), `synodic_period`, `angular_size`, `hill_sphere`,
  `roche_limit`, `tidal_accel`.
- A scientific math substrate: `sqrt cbrt pow exp ln log10 log2 sin cos tan asin acos atan atan2 hypot
  abs floor ceil round`.
- The headline composition: **`/calc world.star_mass world.au kepler_period`** recomputes *this* system's
  year from its own World facts — deterministic, self-citing, gate-bypassed.

## Notes

- **No new runtime crates, no network.** Backed entirely by the in-tree Bund VM (`rust_multistackvm`) +
  the already-ambient `active_store()` reading the already-on-disk World JSON (read-only — no materialize,
  no writes). New provenance detail `world:<path>` on the existing `computed` origin (no schema change).
- Words register under `calc.<name>` with a best-effort short alias, so the prefixed form never collides
  with bundcore's arithmetic. Integer and float remain interchangeable in every word.
- **Deferred (honest):** the recompile-from-`world.hjson` fallback for a not-yet-materialized World book
  (route 2 in the RFC) — the words read the materialized book, the normal post-`compile --materialize`
  state. R4-C (climate/geography/economy), R4-E (coherence check), and the remaining R4-A reducers follow.
- Tutorial 103 expanded (scientific/astronomy words, World grounding); `Ctrl+B h` updated. Tests
  2201 → 2204.
