question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generate definitions with labels when translating a PlusCal algorithm

See original GitHub issue

The PlusCal translator could generate a PCOK from the set of possible pc values that is manually added as a conjunct in a user-provided TypeOK, and that is robust against algorithm changes:


\* BEGIN TRANSLATION

... \*

PCOK == pc \in {"lbl1", "lbl2", ..., "Done"}

\* END TRANSLATION 
 
TypeOK ==
   /\ PCOK
   /\ ....

Alternatively, the translator could generate a definition with a set or even sequence of all labels.

\* BEGIN TRANSLATION

... \*

Labels == {"lbl1", "lbl2", ..., "Done"}

\* END TRANSLATION 
 

Related: https://github.com/tlaplus/Examples/issues/34

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Calvin-Lcommented, Apr 30, 2021

I’ve never needed this feature in my work, but I can see how it would be useful. Three quick comments:

I agree with @muenchnerkindl; legal PC values should be separated by process ID.

Between Labels and PCOK: Labels seems more generic and useful to me.

Although, rather than Labels, I would use a very long and descriptive name like PossiblePCValuesByProcessID. This is (1) self-documenting and (2) less likely to clash with identifiers in existing PlusCal modules.

1reaction
muenchnerkindlcommented, Apr 30, 2021

I think it would be nice to have, but in practice it would rather be something like

pc \in [p \in ProcSet |-> 
              CASE p \in Server -> ServerLabels
              [] p \in Client -> ClientLabels]

(and even more complicated for Distributed PlusCal if we ever get to release it).

Read more comments on GitHub >

github_iconTop Results From Across the Web

A PlusCal User's Manual - P-Syntax - Leslie Lamport
PlusCal uses labels to describe the algorithm's steps. However, you can omit the labels and let the PlusCal translator add them as necessary....
Read more >
ChangRoberts!TypeOK refers to non-existing PlusCal label "n2 ...
TypeOK refers to non-existing PlusCal label "n2" #34 ... Generate definitions with labels when translating a PlusCal algorithm tlaplus/tlaplus#613.
Read more >
Potentially confusing behavior of a PlusCal algorithm
quickly. The basic rule is that the PlusCal translator does not expand definitions; occurrences of defined operators appear in the translation exactly as...
Read more >
PlusCal / TLA : An Annotated Cheat Sheet
translator is invoked. However, TLA+ definitions may appear either before the. PlusCal algorithm or after the generated TLA+ specification.
Read more >
Re: [tlaplus] Use of labels in PlusCal - Mail Thread Index
on your first question: what do you mean by "nested labels"? ... the PlusCal algorithm and the TLA+ specification that it is translated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found