-
Notifications
You must be signed in to change notification settings - Fork 20
Prove that EPOCH not depends on expired dreps #941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
185e3ef to
c242176
Compare
850ff61 to
6c43c81
Compare
6c43c81 to
d590f39
Compare
5b54a15 to
9b55dfe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just some (mostly minor) comments you might find helpful.
| filter-⇒ : (P⇒Q : U.Universal (P U.⇒ Q)) → filter sp-P (filter sp-Q X) ≡ᵉ filter sp-P X | ||
| filter-⇒ P⇒Q = filter-⇒-⊆ , filter-⇒-⊇ | ||
| where | ||
| filter-⇒-⊆ : filter sp-P (filter sp-Q X) ⊆ filter sp-P X | ||
| filter-⇒-⊆ p with from ∈-filter p | ||
| ... | (q , p) with from ∈-filter p | ||
| ... | (_ , p) = to ∈-filter (q , p) | ||
|
|
||
| filter-⇒-⊇ : filter sp-P X ⊆ filter sp-P (filter sp-Q X) | ||
| filter-⇒-⊇ p with from ∈-filter p | ||
| ... | (q , p) = to ∈-filter (q , (to ∈-filter (P⇒Q _ q , p))) | ||
|
|
||
| module _ {P : A → Type} {sp-P : specProperty P} {Q : B → Type} {sp-Q : specProperty Q} where | ||
|
|
||
| import Relation.Unary as U | ||
|
|
||
| module _ {f : A → B} (Qf⇒P : U.Universal ((Q ∘ f) U.⇒ P)) where | ||
|
|
||
| filter-map : filter sp-Q (map f X) ≡ᵉ filter sp-Q (map f (filter sp-P X)) | ||
| filter-map = filter-map-⊆ , filter-map-⊇ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love these theorems and the straight-forward way you prove them---nice work! ...although I'm wondering why the function f and the premise of the filter-map theorem are pulled out as module parameters instead of just making them part of the statement (type signature) of the filter-map theorem.
| open import Data.Bool using (if_then_else_) | ||
| open import Data.Nat using (_≤ᵇ_) | ||
| open import Data.List using (map) | ||
| open import Class.Monad hiding (Monad-TC) | ||
| open import Class.MonadTC | ||
| hiding (extendContext) | ||
| open import Class.MonadError | ||
| using (MonadError; MonadError-TC) | ||
| open import Class.Show | ||
| open import Meta.Prelude | ||
| open import Meta.Init public | ||
| renaming (TC to TCI) | ||
| hiding (Monad-TC; MonadError-TC; toℕ) | ||
| hiding (Monad-TC; MonadError-TC) | ||
| open import Reflection using (TC; extendContext) | ||
|
|
||
| open MonadTC ⦃...⦄ | ||
| open MonadError ⦃...⦄ using (error; catch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| open import Data.Nat using (_≤ᵇ_) | |
| open import Data.List using (map) | |
| open import Class.Monad hiding (Monad-TC) | |
| open import Class.MonadTC | |
| hiding (extendContext) | |
| open import Class.MonadError | |
| using (MonadError; MonadError-TC) | |
| open import Class.Show | |
| open import Meta.Prelude | |
| open import Meta.Init public | |
| renaming (TC to TCI) | |
| hiding (Monad-TC; MonadError-TC) | |
| open import Reflection using (TC; extendContext) | |
| open MonadTC ⦃...⦄ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently, the following lines can be omitted:
open import Data.Bool using (if_then_else_)and
open MonadError ⦃...⦄ using (error; catch)| import Relation.Unary as U | ||
| P⇒Q : U.Universal ((λ ((_ , e') : Credential × Epoch) → sucᵉ e ≤ sucᵉ e') U.⇒ (λ (_ , e') → e ≤ e')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import Relation.Unary as U | |
| P⇒Q : U.Universal ((λ ((_ , e') : Credential × Epoch) → sucᵉ e ≤ sucᵉ e') U.⇒ (λ (_ , e') → e ≤ e')) | |
| P⇒Q : Π[ (λ ((_ , e') : Credential × Epoch) → sucᵉ e ≤ sucᵉ e') ⇒ (λ (_ , e') → e ≤ e') ] |
| import Relation.Unary as U | ||
| module esp = HasPreorder (EpochStructure.preoEpoch epochStructure) | ||
| P⇒Q : U.Universal ((λ ((_ , e') : Credential × Epoch) → sucᵉ e ≤ e') U.⇒ (λ (_ , e') → e ≤ e')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import Relation.Unary as U | |
| module esp = HasPreorder (EpochStructure.preoEpoch epochStructure) | |
| P⇒Q : U.Universal ((λ ((_ , e') : Credential × Epoch) → sucᵉ e ≤ e') U.⇒ (λ (_ , e') → e ≤ e')) | |
| module esp = HasPreorder (EpochStructure.preoEpoch epochStructure) | |
| P⇒Q : Π[ (λ ((_ , e') : Credential × Epoch) → sucᵉ e ≤ e') ⇒ (λ (_ , e') → e ≤ e') ] |
| cong | ||
| : ∀ {rSt rSt' : RatifyState} (rSt≡rSt' : rSt ≡ rSt') {govSt govSt' : GovState} (govSt≡govSt' : govSt ≡ govSt') {rSt'' rSt''' : RatifyState} | ||
| → Γ ⊢ rSt ⇀⦇ govSt ,RATIFIES⦈ rSt'' | ||
| → Γ' ⊢ rSt' ⇀⦇ govSt' ,RATIFIES⦈ rSt''' | ||
| → rSt'' ≡ rSt''' | ||
| cong refl refl (BS-base Id-nop) (BS-base Id-nop) = refl | ||
| cong refl refl (BS-ind {sig = a} p ps) (BS-ind {sig = a'} q qs) | ||
| with RATIFY.cong Γ≈Γ' {a = a} {a' = a'} refl p q | ||
| ... | refl = cong refl refl ps qs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit surprised RATIFIES-deterministic isn't used here... I suppose because the gammas are not identical. 🤔
Also, I wonder if some of the cong lemmas should be factored out into their respective Properties modules; e.g., the congs for RATIFY and RATIFIES could go somewhere under Ratify/Properties/.
| @@ -0,0 +1,569 @@ | |||
| {-# OPTIONS --safe #-} | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you want to make this new file an .lagda.md file?
|
Blocked by #964 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. Nice work!! ...before you merge, would you mind converting your new ExpiredDReps.agda file to .lagda.md? Also, while it's fresh in your mind, please add some documentation that states the purpose of the module and explains the property you're proving. 🙏🏼
| module _ {Γ : EnactEnv} {eSt : EnactState} {ga : GovAction} where | ||
| -- TODO: Make this follow from computationalness or viceversa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just happened to see this PR, we actually have a lemma for this already: computational⇒rightUnique in Interface.ComputationalRelation.
Description
First step towards addressing #929.
Blocked by input-output-hk/agda-sets#16There are a couple of postulates at the beginning of the file that should be taken as assumptions of the EpochStructure type (discuss in meeting)Checklist
CHANGELOG.md