>[!warning]
>This content has not been peer reviewed.
# Energy input (RST)
The engine can feel like it is "missing something" because **signal** $S$ and **noise** $a_0$ are set once per run; there is no way to **feed in** an external energy (e.g. from a potential, a Hamiltonian, or another code) and have it drive the dynamics. This note fixes the energy-input design and states the **mathematical theory** behind it.
---
## I. What is missing without energy input
- $S$ is per-node and constant (or $S_{\mathrm{eff}}$ from entanglement only). So the "source" $I$ that feeds the Resource Triangle is not tied to a real energy landscape.
- Without energy input, the engine does not favour low-$E$ states in an RST-consistent way for a given configuration.
---
## II. RST identities (reference)
From the **Resource Triangle** and the **field equation** (see [[../../../../expanded theory/Resource Triangle]], [[../../../../expanded theory/Fidelity Derivation]]):
**1. Triangle identity**
$W^n = \Omega^n + N^n$
**2. Fidelity**
$\mu = \frac{\Omega}{W} = \frac{\eta}{(1+\eta^n)^{1/n}}, \qquad \eta = \frac{\Omega}{N}.$
**3. Source**
$I = \Omega \cdot \mu.$
So $I$ (source), $N$ (noise), and $n$ determine $\Omega$ via the field equation and hence $\mu$. For fixed $N$ and $n$, $\mu$ is strictly increasing in $I$: higher source $\Rightarrow$ higher fidelity.
---
## III. Mathematical theory: energy as source
**Goal:** Let $E(\mathrm{state})$ be a scalar (e.g. Hamiltonian, free energy, or layer cost). We want the engine to favour **low-$E$** states (stable) with **high $\mu$** (high fidelity), without changing the RST identities.
**Requirement (RST-rigorous):** The Triangle and $\mu = \Omega/W$ are unchanged. Only the **effective source** $I$ may depend on $E$.
**Monotonicity:** We want
$E \downarrow \quad \Rightarrow \quad \mu \uparrow.$
Since $\mu$ is increasing in $I$ (for fixed $N$, $n$), this is equivalent to
$E \downarrow \quad \Rightarrow \quad I \uparrow.$
So the effective source must be a function of state such that $I_{\mathrm{eff}}$ is **decreasing** in $E$. The minimal linear choice is
$I_{\mathrm{eff}} = I_{\mathrm{base}} + \alpha\,(E_{\mathrm{ref}} - E), \qquad \alpha \geq 0.$
Then $E < E_{\mathrm{ref}}$ $\Rightarrow$ $I_{\mathrm{eff}} > I_{\mathrm{base}}$ $\Rightarrow$ higher $\mu$.
**In the engine:** The base source is the effective signal $S_{\mathrm{eff}}$ (from node signal plus entanglement bonus). So we set
$S_{\mathrm{eff}} = S_{\mathrm{base}} + \text{(entanglement bonus)} + \alpha\,(E_{\mathrm{ref}} - E).$
The engine then uses $I = S_{\mathrm{eff}}$ (and $N = a_0$) to solve for $\Omega$, $W$, $\mu$ via the Triangle. So:
- **Signal bonus** (additive to $S_{\mathrm{eff}}$):
$\boxed{\text{signal bonus} = \alpha\,(E_{\mathrm{ref}} - E).}$
- **Effective signal**:
$S_{\mathrm{eff}} = S_{\mathrm{base}} + \text{entanglement bonus} + \text{signal bonus}.$
**Summary:** The mapping $E \mapsto \text{bonus} = \alpha(E_{\mathrm{ref}} - E)$ is the unique affine choice that (i) makes low-$E$ states have higher $I$ and hence higher $\mu$, (ii) leaves the Triangle and Landauer accounting unchanged, and (iii) adds no new free parameters beyond $\alpha$ and $E_{\mathrm{ref}}$.
---
## IV. How to supply $E$
1. **Physics layer:** Use the same layer that gives $\mathrm{layer\_cost}(\mathrm{positions}, \mathrm{edges})$ as $E$; the engine can use that as energy input (e.g. bond energy).
2. **External callback:** Pass $\mathrm{energy\_fn}(\mathrm{positions}, \mathrm{edges}) \to \mathbb{R}$. The engine calls it each cycle and applies the bonus above.
3. **Config:** `graph.use_energy_input`, `graph.E_ref`, `graph.energy_scale` ($\alpha$). When `use_energy_input` is true and a layer is set, the layer's $\mathrm{layer\_cost}$ is used as $E$.
---
## V. Summary table
| Without energy input | With energy input |
|:---|:---|
| $S$ fixed or from entanglement only | $S_{\mathrm{eff}}$ includes $\alpha(E_{\mathrm{ref}} - E)$ |
| Dynamics not tied to a real energy | Low-$E$ states get higher $\mu$; engine favours stable states |
| Hard to plug in DFT/force field | Same engine; you supply $E(\mathrm{state})$ |
**Implementation:** Graph engine: $\mathrm{energy\_fn}(\mathrm{positions}, \mathrm{edges}) \to \mathrm{float}$, $E_{\mathrm{ref}}$, $\alpha$ (`energy_scale`). Each cycle: $E = \mathrm{energy\_fn}(\mathrm{state})$, signal bonus $= \alpha(E_{\mathrm{ref}} - E)$, $S_{\mathrm{eff}}$ += bonus. Cycle log returns `energy_input` and `signal_bonus_from_energy`. See [[Reality Engine - Code]].