-
Notifications
You must be signed in to change notification settings - Fork 261
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
In what order are isolated assertions verified? #5862
Comments
I noticed that with Still remains the question of whether verification of vcNum x+1 logically follows vcNum x. |
Usually one verifies using multiple cores, so multiple could be verifying at the same time, and the first assertion to start might be the last to finish.
Can you elaborate on what the problem is? As long as you get at least one error when a method/lemma does not verify, that's fine right? |
I am measuring the brittleness of isolated assertions to estimate which ones could yield the biggest improvement if "stabilized". |
I don't see why you need to take into account previous failures. I think you could use |
If I understood correctly, here it was established that a failed assertion renders any following assertion useless, right? I am currenly using Or am I missing something? |
No, that was only the case in that particular example, because the previous assertion proved I think you'd be OK not doing anything particular when an assertion fails, and still looking at the resource counts of subsequent assertions. In the example where you have: assert false;
assert SomeThingDifficult(x,y,z); Then the resource count of To conclude, if there are assertions that have a high resource count, that means they are doing significant work despite the assertions before them, and they could benefit from being optimized. |
But the problem is that it will rarely be as clear as I guess that answering that is too complicated, and that's why I am trying to just bypass the whole problem by ignoring the "tainted" assertions. So to circle back... isn't there an order to assertions? |
I don't see a problem to solve. If you have: assert ProvingThisIsDifficultAndShouldBeOptimized(0);
assert ComplicatedButBoilsDownToFalse();
assert ProvingThisIsDifficultAndShouldBeOptimized(1); then |
Taking a step back, it looks like it's difficult to state whether there is an order or not? Should I understand that there isn't one? Or, can you point to something I could read to learn more? |
I'm not sure what you mean by assertions being ordered or not. Statements in a program are ordered, and the order of statements matters to the meaning of the program. All statements that occur after an assert statement may assume that the asserted expression holds, so the order of assert statements can affect their verification. For example:
Versus
It is safe to assume the expression of an assertion after asserting it, because if it not true, then at least one error will be emitted and Dafny will not let you run your program. |
The mental model I'm fighting is that of the C standards, which allow compilers to reorder statements and evaluation of expressions with rather minimal requirements, for the sake of optimization. This is one source for nasty surprises and much "language lawyering". In Dafny, my initial assumption was that there is no such reordering; that if From what you are saying now, that seems to not be the case. That's all I wanted to know. |
Okay, good. The |
What change in documentation do you suggest?
In the JSON log of
dafny measure-complexity --isolated-assertions
, arevcResults
assigned avcNum
according to their verification order? For example, isvcNum
1 verified beforevcNum
2?Asking because I have a log that lists the
vcNum
s of thevcResults
of averificationResult
out of order. E.g., I'm seeing avcResult
list withvcNums
[4,1,3,2] in the JSON. So I wonder if they are being verified in JSON order or invcNum
order. This is important because, IIUC, if e.g.vcNum
3 fails verification, then subsequent verifications are unreliable.When those example
vcNum
s are sorted as [1,2,3,4], their line:col follow the order one encounters when reading the source code. This is the order that I intuitively (naively?) expected for verification. However some languages change the order of evaluation of things; so I wonder how this works during Dafny's verification.Issue #5805 also made me think of this.
The text was updated successfully, but these errors were encountered: