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

Translate quint variable initialization as equality, not assignment #2864

Closed
wants to merge 3 commits into from

Conversation

shonfeder
Copy link
Contributor

@shonfeder shonfeder commented Mar 15, 2024

Fixes #2863

Note that this presupposes #2860, and should be rebased on main after that is merged in.

  • Tests added for any new code
  • Ran make fmt-fix (or had formatting run automatically on all files edited)
  • Documentation added for any new functionality
  • Entries added to ./unreleased/ for any new functionality

Shon Feder added 3 commits March 13, 2024 23:09
We need to track both the names of nullary operators in scope and whether or not
we in are in the scope of the `q::init` operator. The latter is require
so that we can ensure all assignments in the init operator are unprimed.
So we expand the reader to store both these bits of data
Closes #2863

Fixes an incorrect translation that was translating initialization of
state variables in quint init predicates into assignments, when they
should only be equalities.
@codecov-commenter
Copy link

codecov-commenter commented Mar 15, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 90.64748% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ain/scala/at/forsyte/apalache/io/quint/Quint.scala 90.15% 13 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files with missing lines Coverage Δ
...cala/at/forsyte/apalache/io/lir/PrettyWriter.scala 90.71% <100.00%> (+0.10%) ⬆️
...ain/scala/at/forsyte/apalache/io/quint/Quint.scala 86.64% <90.15%> (+0.77%) ⬆️

... and 1 file with indirect coverage changes

@shonfeder
Copy link
Contributor Author

This isn't a full fix for #2863 yet: it only ensures primes are not added to assignments that occur within the body of the init predicate. For the general case, we need to ensure primes do not appear in any operator that is used by the init predicate.

We can solve that this way:

Some additional care will need to be take about where the init-relevant operators are placed back into the sequence of converted operators, in case there other operators that refer to them, which must occur later. Placing the init-relevant operators after all variable declarations but before any others should be safe, since they are guaranteed not to refer to other operators.

Alternatively, a different strategy could be employed on the quint side to remove the need for this complexity, as suggested on #2863.

Unfortunately, I won't have time to complete this work, as I am losing my company access to github etc. now.

<3

@shonfeder shonfeder requested a review from bugarela March 15, 2024 13:37
@shonfeder shonfeder marked this pull request as draft March 15, 2024 13:38
@shonfeder shonfeder closed this Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assignments in quint init operators need to be unprimed
2 participants