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

Recording possible triggers from inside let-expressions properly #771

Merged
merged 5 commits into from
Nov 10, 2023

Conversation

marcoeilers
Copy link
Contributor

When recording possible triggers while evaluating a quantifier body, this PR changes Silicon so that it records a version of the expression that has the let-bound variable replaced with its body. This is necessary because otherwise, possible triggers from inside let-expressions are essentially unavailable as triggers, since the let-bound variable is not available in the trigger itself, and without it, the expressions don't match syntactically.

@fpoli
Copy link
Member

fpoli commented Nov 9, 2023

Is the subscription exponential in the number of AST nodes in the worst case (e.g. a let variable used more than once and defined in the body of another let, used and defined in the body of another let, and so on)? I'm asking because we considered using this encoding stile in Prusti at some point (we currently don't) as a way to avoid generating an expression with a worst-case size exponential in the number of Rust statements.

@marcoeilers
Copy link
Contributor Author

Is the subscription exponential in the number of AST nodes in the worst case (e.g. a let variable used more than once and defined in the body of another let, used and defined in the body of another let, and so on)? I'm asking because we considered using this encoding stile in Prusti at some point (we currently don't) as a way to avoid generating an expression with a worst-case size exponential in the number of Rust statements.

I guess it would be, yes.
It would only be a problem if you have large expressions inside quantifier bodies though.
I thought that there were different places in Viper that deal with let-expressions by inlining them, but I can't actually find any, so maybe that's not actually true.

@marcoeilers marcoeilers merged commit 829142e into master Nov 10, 2023
4 checks passed
@marcoeilers marcoeilers deleted the meilers_let_triggers branch January 21, 2024 19:01
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