Artifacts generated from aeff4bf9d9d9088c357731c74378d24e614ca346
Home /
Input Output /
formal-ledger-specifications
May 18, 8-9 PM (0)
May 18, 9-10 PM (0)
May 18, 10-11 PM (0)
May 18, 11-12 AM (0)
May 19, 12-1 AM (0)
May 19, 1-2 AM (0)
May 19, 2-3 AM (0)
May 19, 3-4 AM (0)
May 19, 4-5 AM (0)
May 19, 5-6 AM (0)
May 19, 6-7 AM (0)
May 19, 7-8 AM (0)
May 19, 8-9 AM (0)
May 19, 9-10 AM (0)
May 19, 10-11 AM (0)
May 19, 11-12 PM (0)
May 19, 12-1 PM (0)
May 19, 1-2 PM (0)
May 19, 2-3 PM (0)
May 19, 3-4 PM (1)
May 19, 4-5 PM (0)
May 19, 5-6 PM (0)
May 19, 6-7 PM (0)
May 19, 7-8 PM (0)
May 19, 8-9 PM (8)
May 19, 9-10 PM (4)
May 19, 10-11 PM (6)
May 19, 11-12 AM (0)
May 20, 12-1 AM (7)
May 20, 1-2 AM (0)
May 20, 2-3 AM (0)
May 20, 3-4 AM (0)
May 20, 4-5 AM (0)
May 20, 5-6 AM (0)
May 20, 6-7 AM (0)
May 20, 7-8 AM (0)
May 20, 8-9 AM (0)
May 20, 9-10 AM (0)
May 20, 10-11 AM (1)
May 20, 11-12 PM (1)
May 20, 12-1 PM (4)
May 20, 1-2 PM (1)
May 20, 2-3 PM (0)
May 20, 3-4 PM (0)
May 20, 4-5 PM (0)
May 20, 5-6 PM (0)
May 20, 6-7 PM (0)
May 20, 7-8 PM (0)
May 20, 8-9 PM (0)
May 20, 9-10 PM (0)
May 20, 10-11 PM (0)
May 20, 11-12 AM (0)
May 21, 12-1 AM (4)
May 21, 1-2 AM (4)
May 21, 2-3 AM (1)
May 21, 3-4 AM (3)
May 21, 4-5 AM (1)
May 21, 5-6 AM (0)
May 21, 6-7 AM (0)
May 21, 7-8 AM (0)
May 21, 8-9 AM (2)
May 21, 9-10 AM (2)
May 21, 10-11 AM (0)
May 21, 11-12 PM (0)
May 21, 12-1 PM (1)
May 21, 1-2 PM (1)
May 21, 2-3 PM (0)
May 21, 3-4 PM (0)
May 21, 4-5 PM (0)
May 21, 5-6 PM (0)
May 21, 6-7 PM (1)
May 21, 7-8 PM (0)
May 21, 8-9 PM (0)
May 21, 9-10 PM (0)
May 21, 10-11 PM (1)
May 21, 11-12 AM (0)
May 22, 12-1 AM (0)
May 22, 1-2 AM (0)
May 22, 2-3 AM (0)
May 22, 3-4 AM (0)
May 22, 4-5 AM (0)
May 22, 5-6 AM (0)
May 22, 6-7 AM (0)
May 22, 7-8 AM (0)
May 22, 8-9 AM (0)
May 22, 9-10 AM (0)
May 22, 10-11 AM (0)
May 22, 11-12 PM (0)
May 22, 12-1 PM (0)
May 22, 1-2 PM (0)
May 22, 2-3 PM (0)
May 22, 3-4 PM (0)
May 22, 4-5 PM (0)
May 22, 5-6 PM (0)
May 22, 6-7 PM (0)
May 22, 7-8 PM (0)
May 22, 8-9 PM (0)
May 22, 9-10 PM (0)
May 22, 10-11 PM (0)
May 22, 11-12 AM (0)
May 23, 12-1 AM (0)
May 23, 1-2 AM (0)
May 23, 2-3 AM (0)
May 23, 3-4 AM (0)
May 23, 4-5 AM (0)
May 23, 5-6 AM (0)
May 23, 6-7 AM (0)
May 23, 7-8 AM (0)
May 23, 8-9 AM (0)
May 23, 9-10 AM (0)
May 23, 10-11 AM (0)
May 23, 11-12 PM (0)
May 23, 12-1 PM (0)
May 23, 1-2 PM (0)
May 23, 2-3 PM (0)
May 23, 3-4 PM (0)
May 23, 4-5 PM (0)
May 23, 5-6 PM (0)
May 23, 6-7 PM (0)
May 23, 7-8 PM (0)
May 23, 8-9 PM (0)
May 23, 9-10 PM (0)
May 23, 10-11 PM (0)
May 23, 11-12 AM (0)
May 24, 12-1 AM (0)
May 24, 1-2 AM (0)
May 24, 2-3 AM (0)
May 24, 3-4 AM (0)
May 24, 4-5 AM (0)
May 24, 5-6 AM (0)
May 24, 6-7 AM (0)
May 24, 7-8 AM (0)
May 24, 8-9 AM (0)
May 24, 9-10 AM (0)
May 24, 10-11 AM (0)
May 24, 11-12 PM (0)
May 24, 12-1 PM (0)
May 24, 1-2 PM (0)
May 24, 2-3 PM (0)
May 24, 3-4 PM (0)
May 24, 4-5 PM (0)
May 24, 5-6 PM (0)
May 24, 6-7 PM (0)
May 24, 7-8 PM (0)
May 24, 8-9 PM (0)
May 24, 9-10 PM (0)
May 24, 10-11 PM (0)
May 24, 11-12 AM (0)
May 25, 12-1 AM (0)
May 25, 1-2 AM (0)
May 25, 2-3 AM (0)
May 25, 3-4 AM (0)
May 25, 4-5 AM (0)
May 25, 5-6 AM (0)
May 25, 6-7 AM (0)
May 25, 7-8 AM (0)
May 25, 8-9 AM (3)
May 25, 9-10 AM (0)
May 25, 10-11 AM (0)
May 25, 11-12 PM (0)
May 25, 12-1 PM (0)
May 25, 1-2 PM (0)
May 25, 2-3 PM (0)
May 25, 3-4 PM (0)
May 25, 4-5 PM (0)
May 25, 5-6 PM (0)
May 25, 6-7 PM (0)
May 25, 7-8 PM (0)
May 25, 8-9 PM (0)
57 commits this week
May 18, 2026
-
May 25, 2026
Artifacts generated from 837e691a7022b5dab573ffbe7d2ca983efb9c7fe
Remove DepositsChange (#1204)
* Remove DepositsChange Calculate deposit changes from CertState and certificates in the tx --------- Co-authored-by: William DeMeo <[email protected]>
Adapt LEDGER computational instance to certState-threaded UTxOEnv
UTxOEnv now carries the pre-batch CertState directly rather than a
precomputed DepositsChange, so the LEDGER computational instance no
longer needs separate environments for the valid and invalid cases.
The two old builders (utxoΓ-valid : CertState → CertState → UTxOEnv,
utxoΓ-invalid : UTxOEnv) collapse into a single
utxoΓ : UTxOEnv
utxoΓ = ⟦ slot , pparams , treasury , utxo₀ , certState
, allScripts , RewardsOf certState ⟧
with certState (= the pre-batch state) used in both the LEDGER-V and
LEDGER-I cases. This resolves the [NotInScope] error from
calculateDepositsChange (which no longer exists) and removes the
vestigial CertState → CertState arguments to utxoΓ-valid that were
unused after the refactor.
The completeness side gets one small additional change: the implicit
argument order in the LEDGER-V destructuring is reorganised to match
the constructor's declared order
{utxoState₁ , govSt₁ , certSt₁ , certSt₂ , govSt₂ , utxoSt₂}
so the subsequent computeSubledgers / computeEntities / computeGov /
computeUtxow pattern matches against the right intermediate states.
Also adds a "Design Note: Cert-State Threading and Deposit Accounting"
subsection to Utxo.lagda.md explaining the rationale for the
refactor. Key points:
+ The UTXO rule has been promoted from a consumer of CertState data
to a secondary executor of certificate accounting:
updateCertDeposit recomputes the deposit evolution that the
CERT/ENTITIES rules also produce as part of their operational
semantics.
+ The same certificate-deposit logic now exists in two places --
inside the DELEG/POOL/GOVCERT sub-rules of CERT, and inside
updateCertDeposit in Utxo.lagda.md.
+ Any drift between the two is a soundness problem, since it would
admit transactions whose UTxO-side balance equation accepts but
whose actual CertState evolution doesn't balance. The note states
the consistency obligation as a lemma to be discharged alongside
LEDGER-pov.
Adapt LEDGER computational instance to certState-threaded UTxOEnv
UTxOEnv now carries the pre-batch CertState directly rather than a
precomputed DepositsChange, so the LEDGER computational instance no
longer needs separate environments for the valid and invalid cases.
The two old builders (utxoΓ-valid : CertState → CertState → UTxOEnv,
utxoΓ-invalid : UTxOEnv) collapse into a single
utxoΓ : UTxOEnv
utxoΓ = ⟦ slot , pparams , treasury , utxo₀ , certState
, allScripts , RewardsOf certState ⟧
with certState (= the pre-batch state) used in both the LEDGER-V and
LEDGER-I cases. This resolves the [NotInScope] error from
calculateDepositsChange (which no longer exists) and removes the
vestigial CertState → CertState arguments to utxoΓ-valid that were
unused after the refactor.
The completeness side gets one small additional change: the implicit
argument order in the LEDGER-V destructuring is reorganised to match
the constructor's declared order
{utxoState₁ , govSt₁ , certSt₁ , certSt₂ , govSt₂ , utxoSt₂}
so the subsequent computeSubledgers / computeEntities / computeGov /
computeUtxow pattern matches against the right intermediate states.
Also adds a "Design Note: Cert-State Threading and Deposit Accounting"
subsection to Utxo.lagda.md explaining the rationale for the
refactor. Key points:
+ The UTXO rule has been promoted from a consumer of CertState data
to a secondary executor of certificate accounting:
updateCertDeposit recomputes the deposit evolution that the
CERT/ENTITIES rules also produce as part of their operational
semantics.
+ The same certificate-deposit logic now exists in two places --
inside the DELEG/POOL/GOVCERT sub-rules of CERT, and inside
updateCertDeposit in Utxo.lagda.md.
+ Any drift between the two is a soundness problem, since it would
admit transactions whose UTxO-side balance equation accepts but
whose actual CertState evolution doesn't balance. The note states
the consistency obligation as a lemma to be discharged alongside
LEDGER-pov.
Remove DepositsChange
Calculate deposit changes from CertState and certificates in the tx
Remove DepositsChange
Calculate deposit changes from CertState and certificates in the tx
Run agda with RTS options (to improve tc time)
Improve tc time for Computational instance UTXO
Add missing premises
Add utxo0 binding in UTXOW
For consistency with SUBUTXOW
Artifacts generated from 743250bedc9bae83388cf2d0a951fffcbeb69f6b
fix Conway modules to use new lemmas in Ledger.Prelude
fix Conway PoV module to use new lemmas in Ledger.Prelude
Add ENTITIES preservation-of-value
Step 4 of the LEDGER preservation-of-value plan (#1187). Chains the
three lemmas already proved in steps 2-3 over the single ENTITIES
constructor:
applyWithdrawals-pov on (wdrls, r₀)
CERTS-pov on the inner ⟦ ... ,CERTS⦈ premise
applyDirectDeposits-pov on (dd, r₁)
The resulting equation is the value-flow statement for the whole rule:
getCoin s + getCoin (DirectDepositsOf Γ)
≡ getCoin s' + getCoin (WithdrawalsOf Γ)
ENTITIES-pov takes the two per-batch NetworkId witnesses as separate
arguments, mirroring extract-netId's output in the old #1190 LEDGER-pov
proof. These witnesses are produced at the call site by the
SUBUTXOW/UTXOW step and threaded into ENTITIES-pov from there.
The module ENTITIES-PoV inherits and re-exports the three set/map
parameters of ApplyToRewards-PoV (∪ˡ-lookup-preserve,
sum-map-proj₂≡getCoin, setToList-Unique), to be discharged in a
follow-up.
Also adds a top-level Entities.Properties module that re-exports the
two property submodules, matching the existing Certs.Properties
convention.
Add applyWithdrawals-pov and applyDirectDeposits-pov
Step 3 of the LEDGER preservation-of-value plan (#1187). These two lemmas describe the value flow through the per-transaction withdrawal and direct-deposit handling that bracket the inner CERTS step inside the new ENTITIES rule (#1201): + applyWithdrawals-pov: getCoin rwds ≡ getCoin (applyWithdrawals w r) + getCoin w + applyDirectDeposits-pov: getCoin (applyDirectDeposits d r) ≡ getCoin r + getCoin d Both are proved by induction over setToList of the underlying RewardAddress ⇀ Coin map, with a per-step lemma about applyOne (the lambda body of applyToRewards) at each inductive step. The withdrawal version requires the per-batch NetworkId witness and a Unique-on-stake-projection invariant on the remaining fold list, because truncating subtraction (_∸_) means an already-reduced balance must never be revisited. The direct-deposit version drops both -- addition is total and commutative, so a re-visit is harmless -- and the resulting signature is correspondingly leaner. The module ApplyToRewards-PoV is parameterised over three set/map identities to be discharged in a follow-up: + ∪ˡ-lookup-preserve + sum-map-proj₂≡getCoin + setToList-Unique (used only by applyWithdrawals-pov) File location reflects the post-#1201 home of applyWithdrawals and applyDirectDeposits: Entities.Specification.<...>, not Certs.Specification.<...>.
new helpers in Ledger.Prelude and Certs PoV
+ Add singleton/union/sum lemmas to Ledger.Prelude
Foundational identities used by the Dijkstra preservation-of-value
proofs (#1187) and likely useful elsewhere. All are stated at the
generic `A ⇀ Coin` (or `List A`) level and are independent of any
ledger-era rule.
Added definitions:
+ ≡ᵉ-getCoin, getCoin-cong, indexedSumᵛ'-∪, res-decomp: lift the
abstract-set-theory equational machinery (≡ᵉ, indexedSum-cong,
indexedSumᵐ-∪) to the `getCoin` interface.
+ getCoin-singleton, ∪ˡsingleton∈dom, ∪ˡsingleton∉dom, ∪ˡsingleton0≡:
left-biased union with a single-entry map, with the zero-valued
specialisation that arises in DELEG-delegate / DELEG-dereg.
+ sumConstZero, indexedSumL-proj₂-zero, setToList-∈: small list/set
bookkeeping used by sumConstZero.
+ sum-map-+, +-interleave: list-of-ℕ algebra that the eventual
LEDGER-pov chain will use to interleave summands.
+ dec-de-morgan: de Morgan rewrite for a decidable conjunction.
No semantic change to any ledger rule.
+ Add Certs preservation-of-value lemmas for Dijkstra
Step 2 of the LEDGER preservation-of-value plan (#1187). In Dijkstra
(post-#1201), CERTS is the plain reflexive-transitive closure of CERT,
with withdrawal and direct-deposit handling having migrated to the
surrounding ENTITIES rule. Consequently the value-preservation
statement for CERTS reduces to
getCoin s ≡ getCoin s'
This commit adds two new modules:
+ Certs.Properties.PoVLemmas: the per-step lemma CERT-pov, with all
four sub-rule cases (CERT-deleg DELEG-delegate, CERT-deleg
DELEG-dereg, CERT-pool, CERT-gov). The proofs use the
singleton/union helpers now in Ledger.Prelude.
+ Certs.Properties.PoV: the closure-level CERTS-pov, by induction on
the reflexive-transitive closure using CERT-pov at each step.
A one-line addition to Certs/Properties.lagda.md re-exports both new
modules from the top-level Properties namespace.
No parameterised wrapper modules. Both lemmas are top-level
definitions and threading-free for consumers.
Artifacts generated from bc11474494b97909854271e1a63d234cbaf1bffc
Artifacts generated from af5382d58af04abf3f5a7f0b6e5c942eb4eed469
Add HasCoin-LedgerState and promote coinFromDeposit to top level
Preliminary infrastructure for the LEDGER preservation-of-value proof (#1187). LedgerState contains three coin-bearing components: the UTxO state (fees and donations counted via the existing HasCoin-UTxOState instance), the rewards balance in DState.rewards, and the three deposit pots (stake-key, pool, DRep). The existing HasCoin-CertState instance only counts the rewards balance; the deposit pots have to be added at the LedgerState level for the LEDGER-pov equation to balance. This commit: + Promotes coinFromDeposit from a where-bound helper inside calculateDepositsChange to a top-level definition, so the PoV proof (and any future consumer) can reference it directly. + Adds a HasCoin-LedgerState instance summing UTxO state coin, the rewards balance, and coinFromDeposit applied to the CertState. No semantic change to LEDGER or any other rule.
Add Foreign Entities
Add Computational instance
Artifacts generated from e5755bd2483ee35548a1a9a54fa68b2e5eea4638