Skip to content
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

pcal.trans outputs blank lines in translation if block comments are present in PlusCal source #906

Open
ahelwer opened this issue Apr 10, 2024 · 1 comment
Labels
enhancement Lets change things for the better PlusCal PlusCal Algorithm Language Tools The command line tools - TLC, SANY, ... usability UX design related issues

Comments

@ahelwer
Copy link
Contributor

ahelwer commented Apr 10, 2024

You can notice this in tlaplus/examples/specifications/byzpaxos/BPConProof.tla; here's a relevant excerpt of the PlusCal source:

    KnowsSafeAt(ac, b, v) ==
      (*********************************************************************)
      (* True for an acceptor ac, ballot b, and value v iff the set of 1b  *)
      (* messages in knowsSent[ac] implies that value v is safe at ballot  *)
      (* b in the PaxosConsensus algorithm being emulated by the good      *)
      (* acceptors.  To understand the definition, see the definition of   *)
      (* ShowsSafeAt in module PConProof and recall (a) the meaning of the *)
      (* mCBal and mCVal fields of a 1b message and (b) that the set of    *)
      (* real acceptors in a ByzQuorum forms a quorum of the               *)
      (* PaxosConsensus algorithm.                                         *)
      (*********************************************************************)
      LET S == {m \in knowsSent[ac] : m.bal = b}
      IN  \/ \E BQ \in ByzQuorum :
               \A a \in BQ : \E m \in S : /\ m.acc = a
                                          /\ m.mbal = -1
          \/ \E c \in 0..(b-1):
               /\ \E BQ \in ByzQuorum :
                    \A a \in BQ : \E m \in S : /\ m.acc = a
                                               /\ m.mbal =< c
                                               /\ (m.mbal = c) => (m.mval = v)
               /\ \E WQ \in WeakQuorum :
                    \A a \in WQ :
                      \E m \in S : /\ m.acc = a
                                   /\ \E r \in m.m2av : /\ r.bal >= c
                                                        /\ r.val = v
   }

Here is the corresponding translation:

KnowsSafeAt(ac, b, v) ==










  LET S == {m \in knowsSent[ac] : m.bal = b}
  IN  \/ \E BQ \in ByzQuorum :
           \A a \in BQ : \E m \in S : /\ m.acc = a
                                      /\ m.mbal = -1
      \/ \E c \in 0..(b-1):
           /\ \E BQ \in ByzQuorum :
                \A a \in BQ : \E m \in S : /\ m.acc = a
                                           /\ m.mbal =< c
                                           /\ (m.mbal = c) => (m.mval = v)
           /\ \E WQ \in WeakQuorum :
                \A a \in WQ :
                  \E m \in S : /\ m.acc = a
                               /\ \E r \in m.m2av : /\ r.bal >= c
                                                    /\ r.val = v

These blank lines should probably not be output, and either seem to have been manually removed in specs present in tlaplus/examples or were generated by an older version of the tools that did not output these blank lines. Other specs exhibiting this behavior are specifications/byzpaxos/VoteProof.tla and specifications/byzpaxos/PConProof.tla.

Issue is with latest tla2tools.jar build from this repo, on linux. Found during the course of this PR: tlaplus/Examples#136

@lemmy
Copy link
Member

lemmy commented Apr 10, 2024

IIRC, this has always been the translator's behavior. Instead of removing empty lines, the comments could also be carried over.

@lemmy lemmy added enhancement Lets change things for the better Tools The command line tools - TLC, SANY, ... PlusCal PlusCal Algorithm Language usability UX design related issues labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Lets change things for the better PlusCal PlusCal Algorithm Language Tools The command line tools - TLC, SANY, ... usability UX design related issues
Development

No branches or pull requests

2 participants