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 quantifiers in ACSL #704

Merged
merged 6 commits into from
Jan 13, 2025
Merged

Support quantifiers in ACSL #704

merged 6 commits into from
Jan 13, 2025

Conversation

schuessf
Copy link
Contributor

@schuessf schuessf commented Jan 7, 2025

This PR adds support for quantifiers in ACSL.

  • We already had some rules in our grammar to parse quantifiers. These rules just always yielded a NotDefinedExpression. There was also a AST object for a QuantifierExpression that I just adapted to our needs.
  • To translate quantifiers from ACSL to Boogie, I added a new method to ACSLHandler. The crucial steps in this translation are that we have to handle the quantified variables in the expression inside the quantifier properly (track the variables in a ScopedHashMap and first lookup when handling an IdentifierExpression) and that we add type constraints over the quantified variables (ACSL may use bounded types that are translated to an unbounded type in Boogie).

Note that we can only handle quantified expressions, where the inner expressions is side-effect free (which also does not allow any auxiliary statements). Therefore, quantified expressions that contain dereferences are currently not supported, but this should be fixed in #703.

Copy link
Contributor

@maul-esel maul-esel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for taking care of this. Looks good to me, I've only left some smaller comments.

Could you maybe add some small test cases? (maybe some using verification/Automizer and some for Referee?)

@schuessf
Copy link
Contributor Author

schuessf commented Jan 7, 2025

Regarding the test cases: I wanted to wait for #703 to write some tests with quantifiers over arrays, but I will just add some simple tests to demonstrate the basic functionality,

@schuessf schuessf force-pushed the wip/fs/acsl-quantifiers branch 2 times, most recently from ca48b46 to d288eb8 Compare January 8, 2025 13:33
* Introduce ScopedHashMap for quantified variables and use it for the handling of IdentifierExpressions
* Use type constraints in Boogie-quantifiers (with implication for \forall and "and" for \exists)
Otherwise the tests with quantifiers fail
@schuessf schuessf force-pushed the wip/fs/acsl-quantifiers branch from 7253c6b to e4645c2 Compare January 10, 2025 12:51
@schuessf schuessf merged commit 9eea8a2 into dev Jan 13, 2025
3 of 4 checks passed
@schuessf schuessf deleted the wip/fs/acsl-quantifiers branch January 13, 2025 09:35
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.

3 participants