Hoist cert-deposit helpers from Utxo to Certs (#1208)
Move six closed-form cert-deposit helpers from
src/Ledger/Dijkstra/Specification/Utxo.lagda.md to
src/Ledger/Dijkstra/Specification/Certs.lagda.md:
+ updateCertDeposit
+ updateCertDepositsStep (new named extraction of the fold body)
+ updateCertDeposits
+ coinFromDeposits
+ depositsChange
+ newCertDeposits
+ refundCertDeposits
These helpers depend only on Certs-level definitions, so their natural
home is Certs.lagda.md. Their placement in Utxo.lagda.md forced any
proof referencing them to take the larger TransactionStructure /
AbstractFunctions parameter set, blocking proofs in
Certs.Properties.PoV(Lemmas) (parameterised only by GovStructure) from
referring to them.
govProposalsDeposits stays in Utxo.lagda.md — it depends on GovProposal
from Gov.Actions, not on a Certs-level type.
Bundled bug fixes to updateCertDeposits:
+ Typo: DState.deposits was being set from the GState delta instead
of the DState delta.
+ Fold direction: was foldr (right-to-left). CERTS processes certs
left-to-right via BS-ind's head-first decomposition. Changed to
foldl, matching Conway's left-to-right recursion and Dijkstra's
own applyToRewards. Counterexample under foldr:
[delegate c d, dereg c (just d)] on a fresh credential should
leave c ∉ deposits per CERTS, but foldr processes dereg first
(a no-op) then delegate, ending with c ∈ deposits.
updateCertDepositsStep is the inner fold body extracted as a named
function so downstream proofs in Certs.Properties.PoV can state and
use a per-step pots equation about it.
Also: add HasCoin-UTxOState (Utxo.lagda.md) and HasCoin-LedgerState
(Ledger.lagda.md). HasCoin-LedgerState sums UTxO state total, DState
rewards balance, and the three deposit pots via the hoisted
coinFromDeposits — the form needed to balance against the UTXO
batch-balance equation.
Closes #1208.