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

spurious 'let variables in trigger' error #1347

Open
tjhance opened this issue Nov 14, 2024 · 0 comments
Open

spurious 'let variables in trigger' error #1347

tjhance opened this issue Nov 14, 2024 · 0 comments

Comments

@tjhance
Copy link
Collaborator

tjhance commented Nov 14, 2024

struct Node {
    child: Option<Box<Node>>,
}

impl Node {
    pub spec fn map(self) -> Map<int, int>;
}

impl Clone for Node {
    fn clone(&self) -> (res: Self)
        ensures forall |key: int| #[trigger] self.map().dom().contains(key) ==> key == 3
    {   
        Node { child: None }
    }   
}

This gives:

error: let variables in triggers not supported, use #![trigger ...] instead
tjhance added a commit that referenced this issue Dec 10, 2024
 #1347

triggers aren't allowed to have 'let' variables that are declared within a trigger.
However, the logic was wrong for the following corner case:

```
forall |x|
  let y ...;
  forall |z|
    #[trigger] foo(y, z)
```

The problem with this code is that while the trigger *does* contain a let-variable (y),
the trigger is not *for* the outer quantifier, but for the inner one
(where it's allowed because the 'let' is outside)
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

No branches or pull requests

1 participant