Carlos Toledo
certified by duality · noindex
stock-constrained price formation · the stochastic water value

Make the resource finite, and the price acquires a second component — the water value, a martingale between the moments the stock binds.

The previous page's price is a multiplier on instantaneous clearing. Add a scarce stock — a reservoir — and the multiplier gains an intertemporal part. This is where the reproduction ends and my own work begins; the full note is Price formation with a stock constraint.
PROVED · discrete time, by LP duality CERTIFIED · zero duality gap OPEN · the continuum statement

On a finite scenario tree the problem is a linear program, so KKT holds with no constraint qualification and duality is exact. Let w be the multiplier on a node's water balance. Then stationarity in the release gives the Hotelling trichotomy of price against w; stationarity in the carried stock gives wn = E[wchild | n] at every node whose stock is interior, stepping down across a full reservoir and up across an empty one. That is the theorem: the water value is a martingale between stock-binding events, and it is proved by nothing deeper than LP duality.

The panel below solves the tree exactly — piecewise-linear concave value functions, every breakpoint tracked — and then certifies rather than trusts the answer: primal feasibility, the trichotomy, the dual wedge signs and complementary slackness, and a zero duality gap together prove optimality of the returned primal–dual pair. Only then is the martingale identity read off the certified dual. Move any control and watch which nodes leave the interior: those are exactly the nodes where the martingale is allowed to break.

The water value on a scenario tree — solved exactly, certified by duality

Price-taking hydro on a finite tree: release h ∈ [0, h̄] against price ϖ, spill s ≥ 0, carry stock R′ ∈ [0, R̄], linear salvage φR′ at the leaves. The solver is a guess; the certificate is the proof.

max Σ pnϖnhn + Σleaves plφR′lfinite LP · KKT needs no CQ
ϖn vs wn ⇒ h ∈ {0, interior, h̄}Hotelling trichotomy
wn = E[wchild|n] + α̃n − β̃nmartingale off the binding set
try

Certificates optimality proved, then the theorem read off the dual

duality gap (rel)
martingale residual
trichotomy violations
binding / total nodes
certified revenue
The duality gap is the load-bearing number: primal revenue minus the dual objective built from the same multipliers. Zero gap proves the returned pair is optimal — no tolerance, no convergence argument. The martingale residual is then max |wn − E[wchild|n]| over interior nodes only, because the theorem makes no claim at nodes where the stock binds; the display says how many nodes are excluded so the certificate cannot be flattered by excluding most of them. Lineage, plainly: water values and their martingale behaviour are classical in hydro scheduling (the SDDP / Pereira–Pinto line) and in commodity-storage economics. What is mine is the precise tree-LP statement, its one-page duality proof, and this certificate.

The tree, coloured by regime amber = interior, where the martingale must hold

Each node is drawn at its depth with its water value w. Amber: stock interior — w equals the probability-weighted average of its children, to machine precision. Oxblood: reservoir full, the value steps down. Teal: reservoir empty, it steps up. Edge width is conditional probability. The theorem is the picture: colour tells you exactly where the identity is permitted to break.

What this does not show

The continuum version is open, and is stated as open. What is proved here is the discrete-time statement on a finite tree. The continuum form — reflected FBSDE well-posedness through the mean-field coupling — is a conjecture in the note, not a result, and nothing on this page should be read as evidence for it.

Units are dimensionless, as everywhere in this lab. The real-data work — five years of Brazilian hourly prices against the flat-window prediction — lives in the note, where it is labelled consistency, not a test, for a reason worth reading: the published price is the administered output of the official dispatch model, whose hydro-marginal value is a constructed water value, so the agreement partly reflects the price's own construction rather than an independent market fact.

One weak check is flagged as weak. The tree's revenue-dominance test compares against random feasible policies, which is a weak null; there is no local-optimality witness for the tree yet. The deterministic case has one; the tree does not, and the note says so.

kernel     sin-mfg/tools/water_value_tree.js — embedded verbatim in this page, byte-identity gated
gate       mfg-lab/tests/test-water-value-diff.js — the two copies cannot drift
battery    sin-mfg/tests/test-water-value.js — 120-tree random sweep, every instance certified
full note  Price formation with a stock constraint — the model, the proofs, the data study
Carlos Toledo · one file — no libraries, no build step, no fonts fetched, and every number above computed in your browser. One script: a cookieless page counter, no cross-site tracking, no personal data.
The kernel between the VERBATIM markers is byte-identical to research/stock-constraint/tools/water_value_tree.js.
noindex,nofollow · extracted from the dissolved laboratory 2026-07-30 · 2026