cert-machine · certified audit · energy — re-proved at every build

The water value, certified

In a hydro-dominated grid the marginal value of stored water is the shadow price that sets the whole dispatch — and it obeys a theorem: between the events where the reservoir hits full or empty, the water value is a MARTINGALE, stepping down across full-reservoir events and up across empty ones. On finite scenario trees that statement is proved by LP duality with no constraint qualification, and this page re-proves it at every build: the solver is extracted from the published artifact's own bytes, run on 120 random trees, and every certificate re-checked — duality gap, martingale residual, Hotelling trichotomy.

tl;dr
  • The finding. The stochastic water value on scenario trees is a certified theorem, not a heuristic: w = E[w(child)] at every interior-stock node, exact to 9.7e-13 across this build's 120-tree suite, with zero duality gap (worst relative gap 5.7e-14) and zero trichotomy violations. The deterministic case is proved outright; the continuum limit is honestly OPEN.
  • The mechanism. The dispatch problem is a finite LP; the water value is its balance multiplier. Weak duality makes the gap one-signed — a negative gap is structurally impossible and the build dies on it rather than reporting a magnitude. The solver ships VERBATIM inside the published page; this build extracts it from those bytes (sha-pinned), so the thing certified is the thing published.
  • Check it. node legacy/research/stock-constraint/tests/test-sin.js from a clone — the unit's own battery, 50 checks; the extracted solver ships beside this page as reports/water_value_tree.extracted.js and self-demos under node.
the theorem
PROVED (discrete)
deterministic: LP duality, no constraint qualification needed · scenario trees: w = E[w child] off-binding — the discrete content of dw = Z dB + dL⁰ − dL̄
duality gap
5.7e-14
worst RELATIVE gap across 120 seeded random trees, re-solved this build; the sign is checked separately — a negative gap dies, never rounds
martingale residual
9.7e-13
max |w − E[w child]| over every interior-stock node in the suite
unit batteries
50 checks green
the lifted unit's own gates re-run: kernel extracted from the artifact bytes; 2 adjoint mutants CAUGHT (the reds fired)
tree classes
116 · 67 · 4
trees with binding stock events · with spill · pure-martingale — all three certificate classes exercised or the build refuses
continuum limit
OPEN
the reflected-FBSDE well-posedness (OP-1) and the reflecting-boundary duality (OP-2) are stated, not claimed
§0 · the margin

Not "no tree failed" — how far from failing

A pass/fail suite reports one bit. What a reader should want is the margin, and the margin is a distribution: every one of the 120 seeded trees, binned by the relative gap between its primal revenue and its dual certificate. The gate the suite enforces is drawn where it actually sits.

0 12 1e-16 1e-15 1e-14 1e-13 1e-12 1e-11 relative duality gap (log scale) trees ← the suite REFUSES beyond here worst tree 5.7e-14
120 trees, of which 2 close the gap EXACTLY and cannot be drawn on a log axis — they are counted here and left off the plot rather than clamped to its floor. Across the 118 with a non-zero gap it runs from 1.1e-16 to 5.7e-14 — the worst tree in the suite is a factor of 177 inside the refusal threshold, and the off-binding martingale residual is bounded by 9.7e-13 across the same trees. The population sits where floating-point accumulation puts it, not where a tolerance was tuned to put it.
§1 · the object

A shadow price with a martingale inside

A hydro operator holding stock R releases h against price ϖ under a hard box 0 ≤ R ≤ R̄. The water value w is the multiplier of the stock balance, and optimality is the Hotelling trichotomy: release at full rate where ϖ > w, hold where ϖ < w, and at interior release the price IS the water value. In the deterministic case w is piecewise constant, jumping up across empty-reservoir events and down across full ones — proved here as the KKT system of a finite LP, where no constraint qualification is needed and strong duality is an identity you can print.

On a scenario tree the same proof gives the stochastic statement: at every node whose post-release stock is interior, w equals the conditional expectation of its children's w — the water value is a martingale between stock-binding events, and spilling nodes pin w = 0 (marginal water at a spilling dam is worthless, reappearing as a dual complementarity). That is the exact discrete content of the continuum equation dw = Z dB + dL⁰ − dL̄, with the local times acting only at the barriers.

§2 · re-proved at build

The certificate suite this page just ran

The scenario-tree solver ships verbatim inside the published water-value artifact, between markers, ending in its own module exports — so this build does not trust a copy: it extracts the solver from the page bytes, checks the extraction's sha256 against the pin, and refuses on a single flipped byte. The extracted source is then run on 120 seeded random trees (depths 3–5, branching 2–3, randomized prices, inflows, stock boxes and salvage), and on every tree four certificate families are re-checked: the KKT residuals (dynamics, boxes, wedge signs, spill duals), the Hotelling trichotomy (zero violations tolerated), the off-binding martingale residual, and the duality gap.

The gap check is one-signed on purpose. This is a maximization LP, so weak duality makes dual − primal non-negative for ANY feasible pair — a negative value cannot be a convergence artifact; it can only mean the assembly is wrong, and the build dies on it as a separate check rather than folding it into a magnitude. The red controls are the lifted unit's own: the adjoint-matched-operator battery must catch both of its planted mutants (it did — 2 CAUGHT this build), and the page-kernel battery re-extracts the browser kernel from the artifact and re-runs its full corner sweep.

§3 · the empirical layer

Five years of PLD, quoted as history — with its own downgrade

The unit tested the theorem's signature against Brazil's hourly spot price (PLD, submarket Sudeste, 2021–2025): between jumps the price should be flat where hydro is marginal. The record shows interior windows with flatness shrinkage up to 75× against a permutation null, and the flattest year is 2021 — the water crisis, when scarcity kept hydro marginal nearly year-round. The naive seasonal reading ("wet years flatter") is REFUTED by the same data: flatness tracks the hydro-marginal regime, not the calendar.

The unit's own adversarial review downgraded this layer from "confirmed" to DESCRIPTIVE CONSISTENCY, and this page keeps the downgrade: PLD is an administered price built from a model that already moves its water value slowly, the permutation null measures persistence rather than pinning, and the window selection is partly circular. These numbers are quoted as history because their data sits behind CCEE's access wall — the recipe to re-run them ships with the unit (docs/pld-data-run.md), and nothing in §2's certificates depends on them.

§4 · open, and said so

What the theorem does not yet reach

§5 · provenance

Where these bytes come from

Every source file behind this page was lifted FILE-LEVEL from the research unit's public set — the eligibility criterion is presence in the source lab's own published tree, checked against the live repository listing — and sits byte-preserved in this repository under legacy/research/stock-constraint/: the two original artifacts, the batteries this build re-ran, the reference implementations, and the model spec with its PROVED/SKETCHED/OPEN labels. The lineage is the price-formation program of the KAUST mean-field-games group (Gomes, Gutierrez, Ribeiro; Bakaryan, Aoun, de Lima Ribeiro, Hovakimyan, Gomes), whose results the source unit reproduces; the certification layer and this page are independent of that group and any error here is ours.