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

[Symex] Only generate counterexample when the user asks for it #67

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dawa6183
Copy link

@dawa6183 dawa6183 commented Nov 6, 2024

This commit reduces the time to get an answer when the result is unsat. Generating a counterexample can also cause a stackoverflow in some cases.

Results below for running the symex engine on this file: https://github.com/chc-comp/aeval-unsafe/blob/de86ef1051b1c521b8c04f5c30c13f417d339529/s_split_01.smt2

Before changes:
% command time ./eld -sym:bfs s_split_01_equivalent.smt2
unsat
72,82 real 93,15 user 1,98 sys

After changes:
% command time ./eld -sym:bfs s_split_01_equivalent.smt2
unsat
3,61 real 6,94 user 0,27 sys

Copy link
Collaborator

@zafer-esen zafer-esen left a comment

Choose a reason for hiding this comment

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

Thanks for this PR @dawa6183 ! I left a few comments for improvement.

In addition, I think an improvement to this PR (or possibly another PR) would be to add verification for solutions and counterexamples -- it doesn't look like we are doing this right now. You can do something similar to what happens in the CEGAR engine, you can search for HornWrapper.verifyCEX in HornWrapper.scala.

@@ -80,7 +80,8 @@ trait ConstraintSimplifierUsingConjunctEliminator extends ConstraintSimplifier {
symex_sf.reducer(Conjunction.TRUE)(constraint)
else constraint

if (constraint.negatedConjs.isEmpty) {
if (constraint.negatedConjs.isEmpty ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change is not mentioned in the PR description. If this is another issue I think it would be great to have it as a separate PR.

@@ -56,6 +56,10 @@ abstract class Symex[CC](iClauses: Iterable[CC])(
import Symex._

var printInfo = false

// This might be set to true in SymexHornWrapper
var generateCounterExample = false
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could maybe use GlobalParameters.needFullCEX (can access with GlobalParameters.get.needFullCEX) instead of introducing a new local parameter for the same?

Copy link
Author

Choose a reason for hiding this comment

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

needFullCEX is not true when simplifiedCEX is true but I can remove generateCounterExample and check whether ( lazabs.GlobalParameters.get.plainCEX || lazabs.GlobalParameters.get.simplifiedCEX) is true if that is preferred?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That sounds good!

@dawa6183 dawa6183 marked this pull request as draft November 6, 2024 12:43
Check for needFullCEX instead of plainCEX
@dawa6183 dawa6183 marked this pull request as ready for review November 8, 2024 07:52
@dawa6183 dawa6183 marked this pull request as draft November 13, 2024 09:25
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.

3 participants