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 sBranch #72

Closed
LeventErkok opened this issue Jun 5, 2013 · 1 comment
Closed

Introduce sBranch #72

LeventErkok opened this issue Jun 5, 2013 · 1 comment

Comments

@LeventErkok
Copy link
Owner

It's useful at times to do a branch only if the condition is satisfiable. This cannot be done outside the SBV machinary currently, since cross-definitions would be missed. (This is realted to issue #71.) So, it needs to be supported primitively. The idea is to introduce a new kind of "ite", that only takes the branches that are reachable; pruning of either the true or false branch if we can show that they are not reachable from the current condition. This should be tied to a time-out; since we wouldn't want to spend way too much time doing this analysis: If timeout happens, then we assume both branches are reachable.

One idea is to add a new configuration to the SBV solver type. Just like you say now:

proveWith z3{verbose=True}

you'll be allowed to say:

proveWith z3{branchCheck=True, branchCheckTimeOut=Just 5}

which will change the "semantics" of "ite"; so it'll only evaluate a branch if it's on a satisfiable path.

Of course, this'll impact all the "ite"'s in your program. So, an alternative idea is to introduce a new kind of ite, let's call it sBranch; with the following signature:

sBranch :: Mergeable a => Maybe Int -> SBool -> SBV a -> SBV a -> SBV a
sBranch mbTimeOut cond trueBranch falseBranch = ...

With this design, you can selectively introduce "smarter" branching as you need.

@LeventErkok
Copy link
Owner Author

New design:

 sBranch :: Mergeable a => SBool -> a -> a -> a

And the time-out can be controlled via sBranchTimeOut parameter, which defaults to Nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant