Skip to content

Change "violated assumption" to "assumption" in trace #2511

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

Merged
merged 2 commits into from
Mar 2, 2019

Conversation

polgreen
Copy link
Contributor

@polgreen polgreen commented Jul 3, 2018

Assumptions aren't violated, they are adhered to

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed Diffblue compatibility checks (cbmc commit: 8f441b2).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/77957158

@smowton
Copy link
Contributor

smowton commented Jul 3, 2018

Does this apply to assert as well?

@polgreen
Copy link
Contributor Author

polgreen commented Jul 3, 2018

No, that's the point. Assertions are violated, assumptions are not. Currently CBMC says that assumptions and assertions are violated

(if we actually are violating assumptions there are bigger problems, but that's not what's actually happening, it's just the output text that's misleading)

@smowton
Copy link
Contributor

smowton commented Jul 3, 2018

I mean, can you get an assert step in the trace that passes? The assumption seems like it would depend on where it occurs in the trace just like the assertion -- if it's in the middle, we passed the assertion/assumption, and if it's at the end we failed it?

@polgreen
Copy link
Contributor Author

polgreen commented Jul 3, 2018

Asserts are handled by a different case in this switch statement. The case I have changed only handles goto_trace_stept::typet::ASSUME, and asserts are goto_trace_stept::typet::ASSERT.

The output for assertions is "violated property".

Non-failing assertions, that are located on a path to a failing assertion, simply don't appear in the trace

@polgreen
Copy link
Contributor Author

polgreen commented Jul 3, 2018

I can't find any place where a __CPROVER_assert can end up being a goto_trace_stept::typet::ASSUME ? But if that does happen, and we have a trace where that __CPROVER_assert is somewhere in the middle and is not violated, it would still not be accurate to output "Violated assumption".

@polgreen
Copy link
Contributor Author

polgreen commented Jul 3, 2018

actually the condition on this output needs to be fixed as well, this code should be outputted when an assumption is passed. If an assumption is violated, something really wrong has happened, and CBMC should show some kind of error messages, as that would be against the documented behaviour of __CPROVER_assume

@smowton
Copy link
Contributor

smowton commented Jul 3, 2018

Agreed, I think at present this code is unreachable.

@smowton
Copy link
Contributor

smowton commented Jul 3, 2018

Nb. a failing assumption won't generate an error, we'll just call it a successful verification, since assumptions holding ==> assertions passing (even if "assumptions holding" is trivially false)

@polgreen
Copy link
Contributor Author

polgreen commented Jul 3, 2018

Yes, what I meant is you should never have a trace to a violated assertion in which there is a violated assumption. This code would only be reachable in the case where we were generating a trace, in which case that would mean a violated assertion and a violated assumption, which should definitely not ever happen.

@polgreen
Copy link
Contributor Author

polgreen commented Jul 3, 2018

I have now made this code reachable. I think outputting assumptions in the traces is useful, although I guess that can be argued either way

@smowton
Copy link
Contributor

smowton commented Jul 3, 2018

Agreed re: assumptions. @kroening's call re: displaying passing assumptions in the trace I suppose. I suspect if we want to go for passing assumptions we'd also want to show passing / failing GOTOs in the same spirit (personally I think that would be quite useful,but matter of trace)

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed Diffblue compatibility checks (cbmc commit: bccf5ac).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/77979582

@polgreen
Copy link
Contributor Author

@kroening ?

@polgreen
Copy link
Contributor Author

Either this PR should be merged, or this unreachable code in CBMC should be removed:
https://github.com/diffblue/cbmc/blob/develop/src/goto-programs/goto_trace.cpp#L323-L337

@martin-cs
Copy link
Collaborator

@polgreen I agree that one or the other should happen (I lean slightly towards your PR and having it print the correct thing) but I lack the code ownership to make it happen.

@tautschnig tautschnig self-assigned this Nov 10, 2018
@tautschnig
Copy link
Collaborator

@polgreen This needs a rebase.

@polgreen
Copy link
Contributor Author

rebased

@tautschnig
Copy link
Collaborator

Thanks @polgreen! Now clang-format is still unhappy and one regression test fails as it encodes a specific number of lines in the pattern being matched. I think that number now needs to be increased by 8, because the assumptions are printed. While at it, I am wondering whether there really should be two blank lines after each assumption? But that's just a visual detail.

polgreen added 2 commits March 2, 2019 07:25
Assumptions aren't violated, they are adhered to
Assumptions are never violated, instead they restrict the search space for non-det values
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️
Passed Diffblue compatibility checks (cbmc commit: 8c1ffc9).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102906408

@tautschnig tautschnig merged commit a35d547 into diffblue:develop Mar 2, 2019
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.

5 participants