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

Introduce monitor state when creating a property #104

Merged
merged 5 commits into from
Oct 29, 2020
Merged

Conversation

makaimann
Copy link
Collaborator

Automatically introduces a monitor state value (and logs a warning for verbosity >= 1) if the property has inputs or next states in it. This was previously done only for the BTOR2 frontend, but now happens internally in a Property object. This extends the counterexample trace by one step, but allows us to use any state invariant checking technique (not just unrolling based ones).

One disadvantage of this PR is that it modifies the transition system in place. Thus, if we're checking many properties on the same transition system, we could end up with too many monitor state variables. I've opened an issue for that which we can address later.

@leonardt

@makaimann makaimann added the simple A very simple (meaning easy to review) change. label Oct 20, 2020
@makaimann
Copy link
Collaborator Author

Ran some tests. There are no discrepancies so I think it looks good. Interpolant-based model checking is solving less than this baseline, but I'm pretty sure that's not related to this (there was another change to interpolant based model checking since that baseline run).

Screen Shot 2020-10-23 at 1 46 46 PM

Screen Shot 2020-10-23 at 1 48 10 PM

Copy link
Collaborator

@lonsing lonsing left a comment

Choose a reason for hiding this comment

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

Looks good to me! I just left two comments.

Comment on lines 145 to 147
assert(ts_.only_curr(bad_));
assert(ts_.only_curr(ts_.init()));

Copy link
Collaborator

Choose a reason for hiding this comment

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

A minor thing: I think that these assertions are redundant here since assert(ts_.only_curr(bad_)); is checked already in super::initialize();

Also, assert(ts_.only_curr(ts_.init())) is redundant because we check that in the TS class in the respective functions used to construct init_, but we can keep these assertions here for documentation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a very good point! I don't feel strongly either way. What do you think -- should we leave it there for documentation or remove it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then I suggest to remove them, just for consistency with the other engine classes that are derived from Prover, and which do not have these assertions.

ts_.make_sort(BOOL));
break;
}
catch (SmtException & e) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not very familiar with the smt-switch code: is it guaranteed that an SmtException will always be thrown when ts_.make_statevar(...) fails, regardless of the cause of failure? (to avoid getting stuck in the infinite loop)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question -- an SmtException is the parent class for all exceptions thrown by smt-switch, but it is possible that some other type of exception is thrown in the underlying solver and is not caught correctly by smt-switch. In that case, I believe we still wouldn't be stuck in the infinite loop because we'd get an uncaught exception.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see, that makes sense!

@makaimann
Copy link
Collaborator Author

Thanks for the review! Responded to the comments directly and I'm happy to make changes based on how that discussion goes.

core/prop.cpp Outdated Show resolved Hide resolved
Co-authored-by: Ahmed Irfan <43099566+ahmed-irfan@users.noreply.github.com>
@@ -148,8 +149,7 @@ void Prover::print_coi_info()
cout << " " << statevar << "\n";

cout << "constraints: \n";
for (auto constr : ts_.constraints())
cout << " " << constr << "\n";
for (auto constr : ts_.constraints()) cout << " " << constr << "\n";
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this formatted by git-clang-format?

Copy link
Collaborator Author

@makaimann makaimann Oct 29, 2020

Choose a reason for hiding this comment

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

Yeah it must have been because I didn't intend to change that code otherwise, except for removing a trailing space.

Copy link
Collaborator

@ahmed-irfan ahmed-irfan left a comment

Choose a reason for hiding this comment

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

LGTM

@makaimann makaimann merged commit b4a19cb into master Oct 29, 2020
@makaimann makaimann deleted the property-witness branch October 29, 2020 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
simple A very simple (meaning easy to review) change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants