Skip to content

Commit c619dbf

Browse files
committed
indexedSumᵛ'-∪ and sumConstZero have proofs!
There were unresolved proof obligations from Conway.
1 parent f8a60cf commit c619dbf

10 files changed

Lines changed: 212 additions & 182 deletions

File tree

src/Ledger/Conway/Conformance/Properties.lagda.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ module _ (s : ChainState) where
124124
-- Transaction properties
125125
126126
module _ {slot} {tx} (let txb = body tx) (valid : validTxIn₂ s slot tx)
127-
(indexedSum-∪⁺-hom : ∀ {A V : Type} ⦃ _ : DecEq A ⦄ ⦃ _ : DecEq V ⦄ ⦃ mon : CommutativeMonoid 0ℓ 0ℓ V ⦄
128-
→ (d₁ d₂ : A ⇀ V) → indexedSumᵛ' id (d₁ ∪⁺ d₂) ≡ indexedSumᵛ' id d₁ ◇ indexedSumᵛ' id d₂)
129127
(indexedSum-⊆ : ∀ {A : Type} ⦃ _ : DecEq A ⦄ (d d' : A ⇀ ℕ) → d ˢ ⊆ d' ˢ
130128
→ indexedSumᵛ' id d ≤ indexedSumᵛ' id d') -- technically we could use an ordered monoid instead of ℕ
131129
where

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,16 @@ private variable
4646
instance
4747
_ = +-0-monoid
4848
49-
module Certs-PoV ( indexedSumᵛ'-∪' : {A : Type} ⦃ _ : DecEq A ⦄ (m m' : A ⇀ Coin)
50-
→ disjoint (dom m) (dom m')
51-
→ getCoin (m ∪ˡ m') ≡ getCoin m + getCoin m' )
49+
module Certs-PoV
5250
-- TODO: prove some or all of the following assumptions, used in roof of `CERTBASE-pov`.
53-
( sumConstZero' : {A : Type} ⦃ _ : DecEq A ⦄ {X : ℙ A} → getCoin (constMap X 0) ≡ 0 )
5451
( res-decomp' : {A : Type} ⦃ _ : DecEq A ⦄ (m m' : A ⇀ Coin)
5552
→ (m ∪ˡ m')ˢ ≡ᵉ (m ∪ˡ (m' ∣ dom (m ˢ) ᶜ))ˢ )
5653
( getCoin-cong' : {A : Type} ⦃ _ : DecEq A ⦄ (s : A ⇀ Coin) (s' : ℙ (A × Coin)) → s ˢ ≡ᵉ s'
5754
→ indexedSum' proj₂ (s ˢ) ≡ indexedSum' proj₂ s' )
5855
( ≡ᵉ-getCoinˢ' : {A A' : Type} ⦃ _ : DecEq A ⦄ ⦃ _ : DecEq A' ⦄ (s : ℙ (A × Coin)) {f : A → A'}
5956
→ InjectiveOn (dom s) f → getCoin (mapˢ (map₁ f) s) ≡ getCoin s )
6057
where
61-
open Certs-Pov-lemmas indexedSumᵛ'-∪' sumConstZero' res-decomp' getCoin-cong' ≡ᵉ-getCoinˢ'
58+
open Certs-Pov-lemmas res-decomp' getCoin-cong' ≡ᵉ-getCoinˢ'
6259
```
6360
-->
6461

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

Lines changed: 48 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,7 @@ private variable
4040
instance
4141
_ = +-0-monoid
4242
43-
getCoin-singleton : ⦃ _ : DecEq A ⦄ {(a , c) : A × Coin} → indexedSumᵛ' id ❴ (a , c) ❵ ≡ c
44-
getCoin-singleton = indexedSum-singleton' {M = Coin} (finiteness _)
45-
46-
∪ˡsingleton∈dom : ⦃ _ : DecEq A ⦄ (m : A ⇀ Coin) {(a , c) : A × Coin}
47-
→ a ∈ dom m → getCoin (m ∪ˡ ❴ (a , c) ❵ᵐ) ≡ getCoin m
48-
∪ˡsingleton∈dom m {(a , c)} a∈dom = ≡ᵉ-getCoin (m ∪ˡ ❴ (a , c) ❵) m (singleton-∈-∪ˡ {m = m} a∈dom)
49-
50-
module _ ( indexedSumᵛ'-∪ : {A : Type} ⦃ _ : DecEq A ⦄ (m m' : A ⇀ Coin)
51-
→ disjoint (dom m) (dom m')
52-
→ getCoin (m ∪ˡ m') ≡ getCoin m + getCoin m' )
53-
where
54-
open ≡-Reasoning
55-
open Equivalence
56-
57-
∪ˡsingleton∉dom : ⦃ _ : DecEq A ⦄ (m : A ⇀ Coin) {(a , c) : A × Coin}
58-
→ a ∉ dom m → getCoin (m ∪ˡ ❴ (a , c) ❵ᵐ) ≡ getCoin m + c
59-
∪ˡsingleton∉dom m {(a , c)} a∉dom = begin
60-
getCoin (m ∪ˡ ❴ a , c ❵ᵐ)
61-
≡⟨ indexedSumᵛ'-∪ m ❴ a , c ❵ᵐ
62-
( λ x y → a∉dom (subst (_∈ dom m) (from ∈-dom-singleton-pair y) x) ) ⟩
63-
getCoin m + getCoin ❴ a , c ❵ᵐ
64-
≡⟨ cong (getCoin m +_) getCoin-singleton ⟩
65-
getCoin m + c
66-
67-
68-
∪ˡsingleton0≡ : ⦃ _ : DecEq A ⦄ → (m : A ⇀ Coin) {a : A} → getCoin (m ∪ˡ ❴ (a , 0) ❵ᵐ) ≡ getCoin m
69-
∪ˡsingleton0≡ m {a} with a ∈? dom m
70-
... | yes a∈dom = ∪ˡsingleton∈dom m a∈dom
71-
... | no a∉dom = trans (∪ˡsingleton∉dom m a∉dom) (+-identityʳ (getCoin m))
43+
open ≡-Reasoning
7244
```
7345
-->
7446

@@ -83,61 +55,59 @@ some `dcert`{.AgdaBound} : `DCert`{.AgdaDatatype}. Then,
8355
*Formally*.
8456

8557
```agda
86-
CERT-pov : {Γ : CertEnv} {s s' : CertState}
87-
→ Γ ⊢ s ⇀⦇ dCert ,CERT⦈ s'
88-
→ getCoin s ≡ getCoin s'
58+
CERT-pov : {Γ : CertEnv} {s s' : CertState}
59+
→ Γ ⊢ s ⇀⦇ dCert ,CERT⦈ s' → getCoin s ≡ getCoin s'
8960
```
9061

9162
*Proof*. (Click the "Show more Agda" button to reveal the proof.)
9263

9364
<!--
9465
```agda
95-
CERT-pov (CERT-deleg (DELEG-delegate {rwds = rwds} _)) = sym (∪ˡsingleton0≡ rwds)
96-
CERT-pov (CERT-deleg (DELEG-reg {rwds = rwds} _)) = sym (∪ˡsingleton0≡ rwds)
97-
CERT-pov {s = ⟦ _ , stᵖ , stᵍ ⟧ᶜˢ}{⟦ _ , stᵖ' , stᵍ' ⟧ᶜˢ}
98-
(CERT-deleg (DELEG-dereg {c = c} {rwds} {vDelegs = vDelegs}{sDelegs} x)) = begin
99-
getCoin ⟦ ⟦ vDelegs , sDelegs , rwds ⟧ , stᵖ , stᵍ ⟧
100-
≡˘⟨ ≡ᵉ-getCoin rwds-∪ˡ-decomp rwds
101-
( ≡ᵉ.trans rwds-∪ˡ-∪ (≡ᵉ.trans ∪-sym (res-ex-∪ Dec-∈-singleton)) ) ⟩
102-
getCoin rwds-∪ˡ-decomp
103-
≡⟨ ≡ᵉ-getCoin rwds-∪ˡ-decomp ((rwds ∣ ❴ c ❵ ᶜ) ∪ˡ ❴ (c , 0) ❵ᵐ) rwds-∪ˡ≡sing-∪ˡ ⟩
104-
getCoin ((rwds ∣ ❴ c ❵ ᶜ) ∪ˡ ❴ (c , 0) ❵ᵐ )
105-
≡⟨ ∪ˡsingleton0≡ (rwds ∣ ❴ c ❵ ᶜ) ⟩
106-
getCoin ⟦ ⟦ vDelegs ∣ ❴ c ❵ ᶜ , sDelegs ∣ ❴ c ❵ ᶜ , rwds ∣ ❴ c ❵ ᶜ ⟧ , stᵖ' , stᵍ' ⟧
107-
108-
where
109-
module ≡ᵉ = IsEquivalence (≡ᵉ-isEquivalence {Credential × Coin})
110-
rwds-∪ˡ-decomp = (rwds ∣ ❴ c ❵ ᶜ) ∪ˡ (rwds ∣ ❴ c ❵ )
111-
112-
rwds-∪ˡ-∪ : rwds-∪ˡ-decomp ˢ ≡ᵉ (rwds ∣ ❴ c ❵ ᶜ)ˢ ∪ (rwds ∣ ❴ c ❵)ˢ
113-
rwds-∪ˡ-∪ = disjoint-∪ˡ-∪ (disjoint-sym res-ex-disjoint)
114-
115-
disj : disjoint (dom ((rwds ∣ ❴ c ❵ˢ ᶜ) ˢ)) (dom (❴ c , 0 ❵ᵐ ˢ))
116-
disj {a} a∈res a∈dom = res-comp-dom a∈res (dom-single→single a∈dom)
117-
118-
rwds-∪ˡ≡sing-∪ˡ : rwds-∪ˡ-decomp ˢ ≡ᵉ ((rwds ∣ ❴ c ❵ ᶜ) ∪ˡ ❴ (c , 0) ❵ᵐ )ˢ
119-
rwds-∪ˡ≡sing-∪ˡ = ≡ᵉ.trans rwds-∪ˡ-∪
120-
( ≡ᵉ.trans (∪-cong ≡ᵉ.refl (res-singleton'{m = rwds} x))
121-
(≡ᵉ.sym $ disjoint-∪ˡ-∪ disj) )
122-
CERT-pov (CERT-pool x) = refl
123-
CERT-pov (CERT-vdel x) = refl
124-
125-
injOn : (wdls : Withdrawals)
126-
→ ∀[ a ∈ dom (wdls ˢ) ] NetworkIdOf a ≡ NetworkId
127-
→ InjectiveOn (dom (wdls ˢ)) RewardAddress.stake
128-
injOn _ h {record { stake = stakex }} {record { stake = stakey }} x∈ y∈ refl =
129-
cong (λ u → record { net = u ; stake = stakex }) (trans (h x∈) (sym (h y∈)))
130-
131-
module Certs-Pov-lemmas
132-
-- TODO: prove some or all of the following assumptions, used in roof of `CERTBASE-pov`.
133-
( sumConstZero : {A : Type} ⦃ _ : DecEq A ⦄ {X : ℙ A} → getCoin (constMap X 0) ≡ 0 )
134-
( res-decomp : {A : Type} ⦃ _ : DecEq A ⦄ (m m' : A ⇀ Coin)
135-
→ (m ∪ˡ m')ˢ ≡ᵉ (m ∪ˡ (m' ∣ dom (m ˢ) ᶜ))ˢ )
136-
( getCoin-cong : {A : Type} ⦃ _ : DecEq A ⦄ (s : A ⇀ Coin) (s' : ℙ (A × Coin)) → s ˢ ≡ᵉ s'
137-
→ indexedSum' proj₂ (s ˢ) ≡ indexedSum' proj₂ s' )
138-
( ≡ᵉ-getCoinˢ : {A A' : Type} ⦃ _ : DecEq A ⦄ ⦃ _ : DecEq A' ⦄ (s : ℙ (A × Coin)) {f : A → A'}
139-
→ InjectiveOn (dom s) f → getCoin (mapˢ (map₁ f) s) ≡ getCoin s )
140-
where
66+
CERT-pov (CERT-deleg (DELEG-delegate {rwds = rwds} _)) = sym (∪ˡsingleton0≡ rwds)
67+
CERT-pov (CERT-deleg (DELEG-reg {rwds = rwds} _)) = sym (∪ˡsingleton0≡ rwds)
68+
CERT-pov {s = ⟦ _ , stᵖ , stᵍ ⟧ᶜˢ}{⟦ _ , stᵖ' , stᵍ' ⟧ᶜˢ}
69+
(CERT-deleg (DELEG-dereg {c = c} {rwds} {vDelegs = vDelegs}{sDelegs} x)) = begin
70+
getCoin ⟦ ⟦ vDelegs , sDelegs , rwds ⟧ , stᵖ , stᵍ ⟧
71+
≡˘⟨ ≡ᵉ-getCoin rwds-∪ˡ-decomp rwds
72+
( ≡ᵉ.trans rwds-∪ˡ-∪ (≡ᵉ.trans ∪-sym (res-ex-∪ Dec-∈-singleton)) ) ⟩
73+
getCoin rwds-∪ˡ-decomp
74+
≡⟨ ≡ᵉ-getCoin rwds-∪ˡ-decomp ((rwds ∣ ❴ c ❵ ᶜ) ∪ˡ ❴ (c , 0) ❵ᵐ) rwds-∪ˡ≡sing-∪ˡ ⟩
75+
getCoin ((rwds ∣ ❴ c ❵ ᶜ) ∪ˡ ❴ (c , 0) ❵ᵐ )
76+
≡⟨ ∪ˡsingleton0≡ (rwds ∣ ❴ c ❵ ᶜ) ⟩
77+
getCoin ⟦ ⟦ vDelegs ∣ ❴ c ❵ ᶜ , sDelegs ∣ ❴ c ❵ ᶜ , rwds ∣ ❴ c ❵ ᶜ ⟧ , stᵖ' , stᵍ' ⟧
78+
79+
where
80+
module ≡ᵉ = IsEquivalence (≡ᵉ-isEquivalence {Credential × Coin})
81+
rwds-∪ˡ-decomp = (rwds ∣ ❴ c ❵ ᶜ) ∪ˡ (rwds ∣ ❴ c ❵ )
82+
83+
rwds-∪ˡ-∪ : rwds-∪ˡ-decomp ˢ ≡ᵉ (rwds ∣ ❴ c ❵ ᶜ)ˢ ∪ (rwds ∣ ❴ c ❵)ˢ
84+
rwds-∪ˡ-∪ = disjoint-∪ˡ-∪ (disjoint-sym res-ex-disjoint)
85+
86+
disj : disjoint (dom ((rwds ∣ ❴ c ❵ˢ ᶜ) ˢ)) (dom (❴ c , 0 ❵ᵐ ˢ))
87+
disj {a} a∈res a∈dom = res-comp-dom a∈res (dom-single→single a∈dom)
88+
89+
rwds-∪ˡ≡sing-∪ˡ : rwds-∪ˡ-decomp ˢ ≡ᵉ ((rwds ∣ ❴ c ❵ ᶜ) ∪ˡ ❴ (c , 0) ❵ᵐ )ˢ
90+
rwds-∪ˡ≡sing-∪ˡ = ≡ᵉ.trans rwds-∪ˡ-∪
91+
( ≡ᵉ.trans (∪-cong ≡ᵉ.refl (res-singleton'{m = rwds} x))
92+
(≡ᵉ.sym $ disjoint-∪ˡ-∪ disj) )
93+
CERT-pov (CERT-pool x) = refl
94+
CERT-pov (CERT-vdel x) = refl
95+
96+
injOn : (wdls : Withdrawals)
97+
→ ∀[ a ∈ dom (wdls ˢ) ] NetworkIdOf a ≡ NetworkId
98+
→ InjectiveOn (dom (wdls ˢ)) RewardAddress.stake
99+
injOn _ h {record { stake = stakex }} {record { stake = stakey }} x∈ y∈ refl =
100+
cong (λ u → record { net = u ; stake = stakex }) (trans (h x∈) (sym (h y∈)))
101+
102+
module Certs-Pov-lemmas
103+
-- TODO: prove some or all of the following assumptions, used in roof of `CERTBASE-pov`.
104+
( res-decomp : {A : Type} ⦃ _ : DecEq A ⦄ (m m' : A ⇀ Coin)
105+
→ (m ∪ˡ m')ˢ ≡ᵉ (m ∪ˡ (m' ∣ dom (m ˢ) ᶜ))ˢ )
106+
( getCoin-cong : {A : Type} ⦃ _ : DecEq A ⦄ (s : A ⇀ Coin) (s' : ℙ (A × Coin)) → s ˢ ≡ᵉ s'
107+
→ indexedSum' proj₂ (s ˢ) ≡ indexedSum' proj₂ s' )
108+
( ≡ᵉ-getCoinˢ : {A A' : Type} ⦃ _ : DecEq A ⦄ ⦃ _ : DecEq A' ⦄ (s : ℙ (A × Coin)) {f : A → A'}
109+
→ InjectiveOn (dom s) f → getCoin (mapˢ (map₁ f) s) ≡ getCoin s )
110+
where
141111
```
142112
-->
143113

src/Ledger/Conway/Specification/Ledger/Properties/PoV.lagda.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ instance
3838
3939
module _
4040
(tx : Tx) (let open Tx tx; open TxBody body)
41-
( indexedSumᵛ'-∪ : {A : Type} ⦃ _ : DecEq A ⦄ (m m' : A ⇀ Coin)
42-
→ disjoint (dom m) (dom m') → getCoin (m ∪ˡ m') ≡ getCoin m + getCoin m' )
43-
( sumConstZero : {A : Type} ⦃ _ : DecEq A ⦄ {X : ℙ A} → getCoin (constMap X 0) ≡ 0 )
4441
( res-decomp : {A : Type} ⦃ _ : DecEq A ⦄ (m m' : A ⇀ Coin)
4542
→ (m ∪ˡ m')ˢ ≡ᵉ (m ∪ˡ (m' ∣ dom (m ˢ) ᶜ))ˢ )
4643
( getCoin-cong : {A : Type} ⦃ _ : DecEq A ⦄ (s : A ⇀ Coin) (s' : ℙ (A × Coin)) → s ˢ ≡ᵉ s'
@@ -84,7 +81,7 @@ then the coin values of `s`{.AgdaBound} and `s'`{.AgdaBound} are equal, that is,
8481
open LState s' renaming (utxoSt to utxoSt'; govSt to govSt'; certState to certState')
8582
open CertState certState'
8683
open ≡-Reasoning
87-
open Certs-PoV indexedSumᵛ'-∪ sumConstZero res-decomp getCoin-cong ≡ᵉ-getCoinˢ
84+
open Certs-PoV res-decomp getCoin-cong ≡ᵉ-getCoinˢ
8885
zeroMap = constMap (mapˢ RewardAddress.stake (dom txWithdrawals)) 0
8986
in
9087
begin

src/Ledger/Conway/Specification/Utxo/Properties/GenMinSpend.lagda.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ coin∅ = begin
5151
0 ∎
5252
where open Prelude.≡-Reasoning
5353
54-
getCoin-singleton : ((dp , c) : DepositPurpose × Coin) → indexedSumᵛ' id ❴ (dp , c) ❵ ≡ c
55-
getCoin-singleton _ = indexedSum-singleton' {A = DepositPurpose × Coin} {f = proj₂} (finiteness _)
56-
5754
module _ -- ASSUMPTION --
5855
(gc-hom : (d₁ d₂ : Deposits) → getCoin (d₁ ∪⁺ d₂) ≡ getCoin d₁ + getCoin d₂)
5956
where
@@ -63,7 +60,7 @@ module _ -- ASSUMPTION --
6360
getCoin (deps ∪⁺ ❴ (dp , c) ❵)
6461
≡⟨ gc-hom deps ❴ (dp , c) ❵ ⟩
6562
getCoin deps + getCoin{A = Deposits} ❴ (dp , c) ❵
66-
≡⟨ cong (getCoin deps +_) (getCoin-singleton (dp , c))
63+
≡⟨ cong (getCoin deps +_) getCoin-singleton ⟩
6764
getCoin deps + c
6865
6966
where open Prelude.≡-Reasoning

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

Lines changed: 53 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,13 @@ We parameterize over the standard finite-map sum lemmas (same pattern as Conway)
6868
<!--
6969
```agda
7070
module ApplyWithdrawals-PoV
71-
( indexedSumᵛ'-∪ : {A : Type} ⦃ _ : DecEq A ⦄ (m m' : A ⇀ Coin)
72-
→ disjoint (dom m) (dom m')
73-
→ getCoin (m ∪ˡ m') ≡ getCoin m + getCoin m' )
7471
( getCoin-cong : {A : Type} ⦃ _ : DecEq A ⦄ (s : A ⇀ Coin) (s' : ℙ (A × Coin))
7572
→ s ˢ ≡ᵉ s' → indexedSum' proj₂ (s ˢ) ≡ indexedSum' proj₂ s' )
7673
where
7774
open ≡-Reasoning
7875
open Equivalence
7976
module ≡ᵉ = IsEquivalence (≡ᵉ-isEquivalence {Credential × Coin})
77+
8078
```
8179
-->
8280

@@ -95,21 +93,58 @@ applying a single withdrawal decreases the total by exactly `amt`.
9593

9694
<!--
9795
```agda
98-
applyOne-pov acc addr amt bal lookup-eq amt≤bal = {!!}
99-
-- Proof sketch:
100-
--
101-
-- getCoin acc
102-
-- ≡ getCoin (acc ∣ ❴ c ❵ ᶜ) + getCoin (acc ∣ ❴ c ❵)
103-
-- -- by: acc ≡ᵉ (acc ∣ ❴ c ❵ ᶜ) ∪ (acc ∣ ❴ c ❵), then indexedSumᵛ'-∪
104-
-- ≡ getCoin (acc ∣ ❴ c ❵ ᶜ) + bal
105-
-- -- by: getCoin-cong on (acc ∣ ❴ c ❵) ≡ᵉ ❴ c , bal ❵ (from lookup-eq)
106-
-- ≡ getCoin (acc ∣ ❴ c ❵ ᶜ) + (bal ∸ amt + amt)
107-
-- -- by: m∸n+n≡m amt≤bal
108-
-- ≡ (bal ∸ amt) + getCoin (acc ∣ ❴ c ❵ ᶜ) + amt
109-
-- -- by: +-comm, +-assoc
110-
-- ≡ getCoin (❴ c , bal ∸ amt ❵ ∪ˡ (acc ∣ ❴ c ❵ ᶜ)) + amt
111-
-- -- by: indexedSumᵛ'-∪ (disjoint since c ∉ dom (acc ∣ ❴ c ❵ ᶜ))
112-
-- where c = stake addr
96+
applyOne-pov acc addr amt bal lookup-eq amt≤bal = trans acc≡decomp decomp≡goal
97+
where
98+
c : Credential
99+
c = stake addr
100+
101+
ξ : acc ˢ ≡ᵉ (acc ∣ ❴ c ❵) ˢ ∪ (acc ∣ ❴ c ❵ ᶜ) ˢ
102+
ξ = IsEquivalence.sym ≡ᵉ-isEquivalence (res-ex-∪ Dec-∈-singleton)
103+
104+
c∈acc : (c , bal) ∈ acc ˢ
105+
c∈acc with c ∈? dom (acc ˢ)
106+
... | yes c∈dom =
107+
subst (λ v → (c , v) ∈ acc ˢ)
108+
(just-injective lookup-eq) -- lookupᵐ acc c ≡ bal
109+
(lookupᵐ-∈ acc c c∈dom) -- (c , lookupᵐ acc c) ∈ acc ˢ
110+
... | no c∉dom = case lookup-eq of λ ()
111+
-- lookupᵐ? resolves to nothing, so nothing ≡ just bal is absurd
112+
113+
acc∣c≡bal : getCoin (acc ∣ ❴ c ❵) ≡ bal
114+
acc∣c≡bal =
115+
trans (getCoin-cong (acc ∣ ❴ c ❵) ❴ (c , bal) ❵ (res-singleton' c∈acc))
116+
getCoin-singleton
117+
118+
c∉dom-compl : c ∉ dom ((acc ∣ ❴ c ❵ ᶜ) ˢ)
119+
c∉dom-compl c∈ = res-comp-dom c∈ (∈-singleton .Equivalence.to refl)
120+
121+
122+
decomp : acc ≡ (acc ∣ ❴ c ❵ ᶜ) ∪ˡ (acc ∣ ❴ c ❵)
123+
decomp = ?
124+
125+
acc≡decomp : getCoin acc ≡ getCoin decomp
126+
acc≡decomp =
127+
≡ᵉ-getCoin decomp acc
128+
( ≡ᵉ.trans (disjoint-∪ˡ-∪ (disjoint-sym res-ex-disjoint))
129+
( ≡ᵉ.trans ∪-sym (res-ex-∪ Dec-∈-singleton)) ) ⟩
130+
131+
decomp≡goal : getCoin decomp ≡ getCoin (acc ∣ ❴ c ❵ ᶜ) + getCoin (acc ∣ ❴ c ❵)
132+
decomp≡goal = indexedSumᵛ'-∪ (acc ∣ ❴ c ❵ ᶜ) (acc ∣ ❴ c ❵) (disjoint-sym res-ex-disjoint) ⟩
133+
134+
-- Goal : getCoin acc ≡ getCoin (❴ c , bal ∸ amt ❵ᵐ ∪ˡ (acc ∣ ❴ c ❵ˢ ᶜ)) + amt
135+
-- Goal = begin
136+
-- getCoin acc
137+
-- ≡⟨ {!!} ⟩ -- by: acc ≡ᵉ (acc ∣ ❴ c ❵ ᶜ) ∪ (acc ∣ ❴ c ❵), then indexedSumᵛ'-∪
138+
-- getCoin (acc ∣ ❴ c ❵ ᶜ) + getCoin (acc ∣ ❴ c ❵)
139+
-- ≡⟨ {!!} ⟩ -- by: getCoin-cong on (acc ∣ ❴ c ❵) ≡ᵉ ❴ c , bal ❵ (from lookup-eq)
140+
-- getCoin (acc ∣ ❴ c ❵ ᶜ) + bal
141+
-- ≡⟨ {!!} ⟩ -- by: m∸n+n≡m amt≤bal
142+
-- getCoin (acc ∣ ❴ c ❵ ᶜ) + (bal ∸ amt + amt)
143+
-- ≡⟨ {!!} ⟩ -- by: +-comm, +-assoc
144+
-- (bal ∸ amt) + getCoin (acc ∣ ❴ c ❵ ᶜ) + amt
145+
-- ≡⟨ {!!} ⟩ -- by: indexedSumᵛ'-∪ (disjoint since c ∉ dom (acc ∣ ❴ c ❵ ᶜ))
146+
-- getCoin (❴ c , bal ∸ amt ❵ᵐ ∪ˡ (acc ∣ ❴ c ❵ˢ ᶜ)) + amt
147+
-- ∎
113148
```
114149
-->
115150

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ module Certs-PoV
6060
```agda
6161
CERTS-pov {Γ = Γ} validNetId (run (pre-cert , certs)) =
6262
trans (PRE-CERT-pov validNetId pre-cert)
63-
(cong (_+ getCoin (WithdrawalsOf Γ)) {!!}) -- (sts-pov certs))
63+
(cong (_+ getCoin (WithdrawalsOf Γ)) (sts-pov indexedSumᵛ'-∪' certs))
6464
```

0 commit comments

Comments
 (0)