Skip to content

Throw SolverException when interpolation fails - #701

Open
daniel-raffler wants to merge 12 commits into
masterfrom
solver-exceptions
Open

Throw SolverException when interpolation fails#701
daniel-raffler wants to merge 12 commits into
masterfrom
solver-exceptions

Conversation

@daniel-raffler

Copy link
Copy Markdown
Contributor

Hello,

this PR changes some runtime exceptions to SolverExceptions so that they can be better caught by the user. Specifically, we now throw a SolverException if interpolation fails in Bitwuzla or Yices. This is in line with how interpolation failures are handled in MathSAT, which also only has partial interpolation support for some theories. In addition we throw a SolverException in OpenSMT when model generation or interpolation are not available for the selected logic

Closes #643

OpenSMT doesn't support model generation for arrays and will only return abstract values when evaluting array variables. We therefore can't return a model when arrays were used in the constraints
…for the selected logic

OpenSMT only supports interpolation for QF_UF, QF_LIA and QF_LRA and the logic needs to be explicitly set with `solver.opensmt.logic`

@baierd baierd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work! Only minor points to work on.

Comment thread src/org/sosy_lab/java_smt/solvers/bitwuzla/BitwuzlaInterpolatingProver.java Outdated
Comment thread src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtInterpolatingProver.java Outdated
Comment thread src/org/sosy_lab/java_smt/solvers/yices2/Yices2InterpolatingProver.java Outdated
// https://github.com/usi-verification-and-security/opensmt/issues/630
throw new UnsupportedOperationException(
"OpenSMT does not support model generation when arrays are used");
throw new SolverException("OpenSMT does not support model generation when arrays are used");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Better: OpenSMT2 does not support model generation when using the theory of arrays

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmmm.. I think that message may also be a bit misleading: OpenSMT uses QF_AUFLIRA by default, and that's fine for model generation as long as no array variables are used in the constraints. The problem is really only with extracting assignments for array variables for the model. It would be possible to return a partial model where array variables are skipped, but for the sake of simplicity we currently just throw an error

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not returning assignments for variables can be interpreted as "may be any value" and should be considered a bug. We can however add a option that allows this, and add a warning to the logger. (If you want, you can open a issue/branch/PR for this)

Thanks for the clarification though! We should definitely change the text to reflect this better. For example: "OpenSMT2 can not return satisfiable assignments for arrays. To avoid wrong interpretation, we disallow model export for queries including arrays." + potentially some info about the option should it be added.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I've now updated the message

Comment thread src/org/sosy_lab/java_smt/solvers/bitwuzla/BitwuzlaInterpolatingProver.java Outdated
// https://github.com/usi-verification-and-security/opensmt/issues/630
throw new UnsupportedOperationException(
"OpenSMT does not support model generation when arrays are used");
throw new SolverException("OpenSMT does not support model generation when arrays are used");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not returning assignments for variables can be interpreted as "may be any value" and should be considered a bug. We can however add a option that allows this, and add a warning to the logger. (If you want, you can open a issue/branch/PR for this)

Thanks for the clarification though! We should definitely change the text to reflect this better. For example: "OpenSMT2 can not return satisfiable assignments for arrays. To avoid wrong interpretation, we disallow model export for queries including arrays." + potentially some info about the option should it be added.

OpenSMT doesn't support extraction of array values for the model. We abort model generation when the constraints contain formulas over arrays and print this message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Investigate Bitwuzla Interpolation Crash

2 participants