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

bugfix: handle trigger annotations for nested quantifiers #1343

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

tjhance
Copy link
Collaborator

@tjhance tjhance commented Nov 13, 2024

This fixes the second item in #717

Namely, it allows this to pass by not adding f(x) as a trigger on the inner quantifier:

        spec fn f(x: int) -> bool;
        spec fn g(x: int) -> bool;

        proof fn test() {
            // trigger for outer quantifier should be f(x)
            // trigger for inner quantifier should be g(y) (and NOT include f(x))
            assume(forall |x: int|
              forall |y: int|
                #[trigger] f(x) && #[trigger] g(y));

            let t = f(3);
            let u = g(4);
            assert(f(3) && g(4));
        }

As an incidental fix, we also fix a small issue with the trigger-collector not recognizing uses of const generic params. You can now write:

        pub open spec fn stuff(t: int) -> bool { true }

        #[verifier::external_body]
        pub broadcast proof fn broadcaster<const X: u8>()                                               
            ensures #[trigger] stuff(X as int) ==> 0 <= X < 255                                         
        {           
        }  

@tjhance tjhance merged commit 7925ad9 into main Nov 19, 2024
11 checks passed
@tjhance tjhance deleted the nested-trigger-tweaks branch November 19, 2024 16:29
utaal pushed a commit to principled-systems/verus that referenced this pull request Nov 21, 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.

2 participants