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

Solver independent interpolation #432

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

Conversation

baierd
Copy link
Collaborator

@baierd baierd commented Jan 17, 2025

This MR adds solver independent interpolation as an option to JavaSMT.
Currently there are 2 distinct techniques used, model based and uniform interpolants based on quantifier elimination.
The uniform interpolants can be generated in a forward and backwards way.

Tests have been extended to test the native interpolation together with the new independent interpolation.

This is currently a WIP MR and not yet finished.

…reconditions. Also make sure that interpolationStrategy is not null to remove the warning from the if-clause below. This may not be necessary, because it is already ensured that interpolationStrategy cannot be null at that time.
…ModelBasedInterpolant method to better understand the model-based approach and its implementation.
…ied, by adding checkArguments and delete the corresponding TODO.
…ifierEliminationBasedInterpolant to understand the quantifier-based approach and its implementation better
…hether they are empty and write a corresponding errorMessage
…ning go away. This may not be necessary since it is already certain that interpolationStrategy cannot be null at this point.
…ther a generated interpolant is really valid and satisfies the definition of Craig interpolation.
…he purpose of the method. TODO: You may want to rename the method to satisfyCraigInterpolationCriteria if the name is not too long and there is still some confusion.
…ion of Craig Interpolation by checking it in the getQuantifierEliminationBasedInterpolant method.
…ion about the context and check that the quantifier has been eliminated properly and return an error if its still present and do some clean up.
…een eliminated properly in the getForwardInterpolant method. And do some clean up.
…ter understanding of the implementation and the strategy.
Copy link
Collaborator Author

@baierd baierd left a comment

Choose a reason for hiding this comment

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

Some small hints about the most urgent needed changes @stefaniesinner

private BooleanFormula getModelBasedInterpolant(
Collection<BooleanFormula> formulasOfA, Collection<BooleanFormula> formulasOfB)
throws InterruptedException, SolverException {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The cases for empty interpolation groups A and/or B is missing.

ProverOptions.GENERATE_UNIFORM_FORWARD_INTERPOLANTS);
itpStrat.retainAll(allIndependentInterpolationStrategies);
if (itpStrat.isEmpty()) {
return null;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Instead of null we could use Optional, avoiding the ugly null with code that needs explicit checking.

private BooleanFormula getQuantifierEliminationBasedInterpolant(
Collection<BooleanFormula> formulasOfA, Collection<BooleanFormula> formulasOfB)
throws SolverException, InterruptedException {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The cases for empty interpolation groups A and/or B is missing.
Note: since this is the same for model based, you could handle it further up in the calling method.


// The non-interpolating delegates usually return nothing useful as itp points, so we have to
// track it here
@SuppressWarnings("unused")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is not needed anymore.

private static @Nullable ProverOptions getIndependentInterpolationStrategy(
Set<ProverOptions> options) {
List<ProverOptions> itpStrat = new ArrayList<>(options);
final Set<ProverOptions> allIndependentInterpolationStrategies =
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This looks like a constant.

if (itpStrat.isEmpty()) {
return null;
}
Preconditions.checkState(itpStrat.size() == 1);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since we only allow exactly 1 solver independent interpolation option, we could fail here more gracefully with an InvalidConfigurationException explaining the problem.

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

Successfully merging this pull request may close these issues.

2 participants