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

Support TLA+ 2 #170

Open
fhackett opened this issue Oct 16, 2021 · 1 comment
Open

Support TLA+ 2 #170

fhackett opened this issue Oct 16, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@fhackett
Copy link
Contributor

So far, PGo has been developed blissfully ignorant of TLA+ 2, and it had not caused problems.

When discussing how to implement the sum of a set of integers, however, it becomes apparent that we need at least a bit of TLA+ 2 in practice.

At minimum, this snippet of TLA+ declarations should work (taken from https://learntla.com/libraries/sets/):

Pick(S) == CHOOSE s \in S : TRUE
RECURSIVE SetReduce(_, _, _)
SetReduce(Op(_, _), S, value) == IF S = {} THEN value
                              ELSE LET s == Pick(S)
                              IN SetReduce(Op, S \ {s}, Op(s, value)) 

Note the RECURSIVE directive, which is what will not currently parse/scope.

I don't anticipate there being that much difficulty implementing this. The assumption that all operators are non-recursive is almost un-used in PGo as far as I recall, so the main obstacle would be getting parsing / scoping to cooperate with the new construct (especially in term rewrites!).

TLA+ 2 has a lot more features than just this, but perhaps those are less important. An initial PR would probably do well to have a limited scope.

Reference on TLA+ 2: http://lamport.azurewebsites.net/tla/tla2.html

@fhackett fhackett added the enhancement New feature or request label Oct 16, 2021
@fhackett fhackett self-assigned this Oct 16, 2021
@shayanh
Copy link
Contributor

shayanh commented Oct 21, 2021

Having RECURSIVE only would be really helpful for our 538B project to easily implement sum.

Also wanted to note that our syntax highlighting currently doesn't support TLA+ 2 directives. We should update that too.

@fhackett fhackett changed the title Support RECURSIVE directive Support TLA+ 2 Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants