Skip to content

Commit 52de5be

Browse files
committed
add proof of Is-just-isPoolRegistered⇒∈-dom
1 parent fcac7de commit 52de5be

3 files changed

Lines changed: 23 additions & 28 deletions

File tree

src/Ledger/Dijkstra/Specification/Certs/Properties/PoV.lagda.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ module CERTS-Deposits-Bridge
149149
→ PoolDepositsAligned (PStateOf s') )
150150
where
151151
152-
open CERT-Deposits-Bridge ∪ˡ-singleton-mem-≡ Is-just-isPoolRegistered⇒∈-dom
152+
open CERT-Deposits-Bridge ∪ˡ-singleton-mem-≡
153153
using (CERT-deposits-updateCertDeposit)
154154
```
155155

src/Ledger/Dijkstra/Specification/Certs/Properties/PoVLemmas.lagda.md

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -179,43 +179,39 @@ PoolDepositsAligned : PState → Type
179179
PoolDepositsAligned ps = dom (PoolsOf ps) ⊆ dom (DepositsOf ps)
180180
181181
module CERT-Deposits-Bridge
182-
( ∪ˡ-singleton-mem-≡ :
183-
∀ {A : Type} ⦃ _ : DecEq A ⦄
184-
(m : A ⇀ Coin) (k : A) (v : Coin)
185-
→ k ∈ dom m → m ∪ˡ ❴ k , v ❵ ≡ m )
186-
( Is-just-isPoolRegistered⇒∈-dom :
187-
∀ {pools : Pools} {kh : KeyHash}
188-
→ Is-just (isPoolRegistered pools kh) → kh ∈ dom pools )
182+
( ∪ˡ-singleton-mem-≡ : ∀ {A : Type} ⦃ _ : DecEq A ⦄ (m : A ⇀ Coin) (k : A) (v : Coin)
183+
→ k ∈ dom m → m ∪ˡ ❴ k , v ❵ ≡ m )
189184
where
190185
186+
Is-just-isPoolRegistered⇒∈-dom :
187+
∀ {pools : Pools} {kh : KeyHash}
188+
→ Is-just (isPoolRegistered pools kh) → kh ∈ dom (pools ˢ)
189+
Is-just-isPoolRegistered⇒∈-dom {pools = pools} {kh = kh} ij with kh ∈? dom (pools ˢ)
190+
... | yes kh∈ = kh∈
191+
... | no _ = case ij of λ ()
192+
193+
191194
-- Per-step bridge: the triple of deposit pots after a single `CERT` step
192195
-- equals `updateCertDeposit` applied to the pre-step triple.
193-
CERT-deposits-updateCertDeposit :
194-
{Γ : CertEnv} {s s' : CertState}
196+
CERT-deposits-updateCertDeposit : {Γ : CertEnv} {s s' : CertState}
195197
→ PoolDepositsAligned (PStateOf s)
196198
→ Γ ⊢ s ⇀⦇ dCert ,CERT⦈ s'
197-
→ ( DepositsOf (DStateOf s')
198-
, DepositsOf (PStateOf s')
199-
, DepositsOf (GStateOf s') )
200-
≡ updateCertDeposit (PParamsOf Γ) dCert
201-
( DepositsOf (DStateOf s)
202-
, DepositsOf (PStateOf s)
203-
, DepositsOf (GStateOf s) )
204-
205-
CERT-deposits-updateCertDeposit _ (CERT-deleg (DELEG-delegate _)) = refl
206-
CERT-deposits-updateCertDeposit _ (CERT-deleg (DELEG-dereg _)) = refl
207-
CERT-deposits-updateCertDeposit _ (CERT-pool (POOL-reg _)) = refl
208-
CERT-deposits-updateCertDeposit
209-
{Γ = Γ} {s = s} poolInv (CERT-pool (POOL-rereg {kh = kh} regd)) =
199+
→ ( DepositsOf (DStateOf s') , DepositsOf (PStateOf s') , DepositsOf (GStateOf s') )
200+
≡ updateCertDeposit (PParamsOf Γ) dCert
201+
( DepositsOf (DStateOf s) , DepositsOf (PStateOf s) , DepositsOf (GStateOf s) )
202+
203+
CERT-deposits-updateCertDeposit _ (CERT-deleg (DELEG-delegate _)) = refl
204+
CERT-deposits-updateCertDeposit _ (CERT-deleg (DELEG-dereg _)) = refl
205+
CERT-deposits-updateCertDeposit _ (CERT-pool (POOL-reg _)) = refl
206+
CERT-deposits-updateCertDeposit {s = s} plInv (CERT-pool (POOL-rereg {kh = kh} r)) =
210207
-- The rule's output pot is `deposits` (unchanged), but `updateCertDeposit`
211208
-- produces `deposits ∪ˡ ❴ kh , pp .poolDeposit ❵`. The pool-deposit
212-
-- invariant `poolInv` plus the rereg premise `regd : Is-just …`
213-
-- give `kh ∈ dom deposits`; `∪ˡ-singleton-mem-≡` then makes the union
214-
-- a no-op.
209+
-- invariant `plInv` plus the rereg premise `r : Is-just …` give
210+
-- `kh ∈ dom deposits`; `∪ˡ-singleton-mem-≡` then makes the union a no-op.
215211
cong (λ x → ( DepositsOf (DStateOf s) , x , DepositsOf (GStateOf s) ))
216212
(sym (∪ˡ-singleton-mem-≡
217213
(DepositsOf (PStateOf s)) kh _
218-
(poolInv (Is-just-isPoolRegistered⇒∈-dom regd))))
214+
(plInv (Is-just-isPoolRegistered⇒∈-dom r))))
219215
CERT-deposits-updateCertDeposit _ (CERT-pool POOL-retirepool) = refl
220216
CERT-deposits-updateCertDeposit _ (CERT-gov (GOVCERT-regdrep _)) = refl
221217
CERT-deposits-updateCertDeposit _ (CERT-gov (GOVCERT-deregdrep _)) = refl

src/Ledger/Dijkstra/Specification/Ledger.lagda.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ allColdCreds govSt es =
179179
-- the hoisted `coinFromDeposits` (plural) from `Certs.lagda.md`. See
180180
-- `Certs.lagda.md`, section "Cert-State Deposit Accounting".
181181
182-
183182
instance
184183
-- LedgerState holds three coin-bearing components:
185184
-- 1. UTxO state (UTxO balance plus fees plus donations) via HasCoin-UTxOState

0 commit comments

Comments
 (0)