-
Notifications
You must be signed in to change notification settings - Fork 15
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
agda2vec introduces extra empty lines #666
agda2vec introduces extra empty lines #666
Conversation
This closes issue #653. (It may be as simple as removing the extra new line character `+ \n` from the `file.write` line in the `write_file` function.)
04e613c
to
ff11336
Compare
@@ -113,7 +113,7 @@ rec { | |||
version = "0.1"; | |||
src = "${formalLedger}"; | |||
meta = { }; | |||
buildInputs = [ agdaWithDeps latex python3 ]; | |||
buildInputs = [ agdaWithDeps latex python310 ]; |
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.
So we can use the List
type annotation and type aliases in agda2vec.py
:
from typing import List, TypeAlias
StrVec: TypeAlias = List[str]
data _⊢_⇀⦇_,RATIFY'⦈_ : | ||
RatifyEnv → RatifyState → GovActionID × GovActionState → RatifyState → Type where | ||
|
||
RATIFY-Accept : {Γ : RatifyEnv} | ||
{es es' : EnactState} | ||
{removed : ℙ (GovActionID × GovActionState)} | ||
{d : Bool} | ||
{a : GovActionID × GovActionState} | ||
|
||
→ let open RatifyEnv Γ; st = a .proj₂; open GovActionState st in | ||
|
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.
This makes the code more transparent and much easier to understand, imo.
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 agree that making the bindings' type explicit makes it easier to understand the rule.
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.
LGTM
src/Ledger/Ratify.lagda
Outdated
Γ ⊢ ⟦ es , removed , d ⟧ʳ ⇀⦇ a ,RATIFY'⦈ | ||
⟦ es' , ❴ a ❵ ∪ removed , delayingAction action ⟧ʳ |
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.
No need for the extra indentation/whitespace since we're not relying on agda
to handle alignment here.
280be9e
to
d50868a
Compare
plus changes `Ratify.lagda`: experiments to improve layout of Fig 54 of cardano-ledger.pdf
d50868a
to
9533584
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.
LGTM.
There seems to be a small aligning glitch, which was already present before, in that sometimes lines containing vertical vectors aren't aligned with their surroundings. For example, see Ratify-Continue
and Ratify-Reject
in Figure 44.
data _⊢_⇀⦇_,RATIFY'⦈_ : | ||
RatifyEnv → RatifyState → GovActionID × GovActionState → RatifyState → Type where | ||
|
||
RATIFY-Accept : {Γ : RatifyEnv} | ||
{es es' : EnactState} | ||
{removed : ℙ (GovActionID × GovActionState)} | ||
{d : Bool} | ||
{a : GovActionID × GovActionState} | ||
|
||
→ let open RatifyEnv Γ; st = a .proj₂; open GovActionState st in | ||
|
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 agree that making the bindings' type explicit makes it easier to understand the rule.
data _⊢_⇀⦇_,RATIFY'⦈_ : | ||
RatifyEnv → RatifyState → GovActionID × GovActionState → RatifyState → Type where | ||
|
||
RATIFY-Accept : {Γ : RatifyEnv} | ||
{es es' : EnactState} | ||
{removed : ℙ (GovActionID × GovActionState)} | ||
{d : Bool} | ||
{a : GovActionID × GovActionState} | ||
|
||
→ let open RatifyEnv Γ; st = a .proj₂; open GovActionState st in | ||
|
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.
LGTM
You're absolutely right. I'm not sure how hard this would be to fix, but it would surely involve making the script more sophisticated (or, rather, less dumb). Right now agda2vec throws away some alignment information (in the form of the Agda generated escape sequences, like |
Description
This closes issue #653.
(It may be as simple as removing the extra new line character
+ \n
from thefile.write
line in thewrite_file
function.)Checklist
CHANGELOG.md