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

Fixing injectivity checks for QPs with multiple quantified variables #542

Merged
merged 6 commits into from
Dec 30, 2024

Conversation

marcoeilers
Copy link
Contributor

This fixes #378. The injectivity check is not actually missing, but it's incorrect (also for fields).

For a QP of the form forall x, y :: cond ==> P(e1, e2), the current code essentially generated the following injectivity check:

assert forall x, x', y, y' :: (x != x' && y != y') && cond && cond' ==> (e1 != e1' || e2 != e2')

This is incorrect. We need to check that if the value of any quantified variable changes, we get a different tuple of receiver expressions, but we're checking that if the values of all quantified variables change, we get a different tuple. Essentially, we need to check that the receiver tuple is injective in all quantified variables, but the current check also succeeds if it's injective only in one of them.

So this PR changes the check to

assert forall x, x', y, y' :: (x != x' || y != y') && cond && cond' ==> (e1 != e1' || e2 != e2')

Copy link
Member

@viper-admin viper-admin left a comment

Choose a reason for hiding this comment

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

LGTM!

@marcoeilers marcoeilers merged commit 57b73a0 into master Dec 30, 2024
1 check passed
@marcoeilers marcoeilers deleted the meilers_fix_378 branch December 30, 2024 15:18
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.

Injectivity check for quantified predicates missing
2 participants