-
Notifications
You must be signed in to change notification settings - Fork 271
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
ArgumentNullException in Translator.CheckDefiniteAssignment #2265
Comments
This only happens inside functions, if it's inside a lemma, we get the same error as in #2264 |
My temporary solution for this is to manually expand: if x :| prop(x) {
///...A...
} Into: if exist x :: prop(x) {
var x :| prop(x);
///...A...
} |
Internally, what's going on here is that the reference to I wonder whether @RustanLeino or @cpitclaudel have thoughts. |
I think this could use attention from someone familiar with the resolver code, so I'm unassigning myself for now. |
Modified example, simpler and closer to actual AST: module DefaultModule {
class DefaultClass {
static function BrokenFunction(): nat {
var y := 0;
assert true by {
if x: bool :| true {
assert x;
}
}
0
}
}
} |
Hi @jtristan! FYI I edited your snippet to add |
Additional information. The error is introduced during the verifier's translation. Checking that the let expression is well-formed triggers a variable substitution in the body of the let. The substitution appears to be erroneous when the body contains an if statement whose guard contains an existential. Indeed, in function Substitute, in the case where the expression is an existential expression, the substitution is forced when calling CreateBoundVarSubstitutions. However, this substitution is not forced in the body of the if statement. As a result, only one occurrence of the variable is substituted. I do not know yet what is the right way to fix this problem, but at least, not forcing the substitution leads to a successful translation, for this specific program. The key file is Substituter.cs, the function is Substitute, and the case is expr is ComprehensionExpr. |
The AST node for a "binding As you correctly noticed, @jtristan, the substituter should not generate a new bound variable for the bound variable that's part of the A good fix, thus, seems to be the following. Extract the While you're at it, please also fix any binding function AnotherBrokenFunction(): nat {
var y := 0;
assert true by {
if
case x: bool :| true =>
assert x;
}
0
} |
OK, I think it makes sense, will do. Thanks for the suggestion. |
Building on Rustan's suggested solution, for the record, there are at least two issues to watch for:
|
repro:
output:
Related to #2264, this was the kind of exception I was getting that led me to #2264
The text was updated successfully, but these errors were encountered: