Skip to content

Commit 5de5afa

Browse files
authored
Merge pull request #502 from sosy-lab/490-opensmt2-evaluate-simplification-of-interpolants
490 opensmt2: improve options and add simplification option for interpolants
2 parents 9e55528 + 13b97a6 commit 5de5afa

File tree

6 files changed

+146
-7
lines changed

6 files changed

+146
-7
lines changed

src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtAbstractProver.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,14 @@ static SMTConfig getConfigInstance(
7979
config.setOption(":print-cores-full", optUnsatCore);
8080
config.setOption(":produce-interpolants", new SMTOption(interpolation));
8181
if (interpolation) {
82-
config.setOption(":interpolation-bool-algorithm", new SMTOption(pSolverOptions.algBool));
83-
config.setOption(":interpolation-euf-algorithm", new SMTOption(pSolverOptions.algUf));
84-
config.setOption(":interpolation-lra-algorithm", new SMTOption(pSolverOptions.algLra));
82+
config.setOption(
83+
":interpolation-bool-algorithm", new SMTOption(pSolverOptions.algBool.getValue()));
84+
config.setOption(
85+
":interpolation-euf-algorithm", new SMTOption(pSolverOptions.algUf.getValue()));
86+
config.setOption(
87+
":interpolation-lra-algorithm", new SMTOption(pSolverOptions.algLra.getValue()));
88+
config.setOption(
89+
":simplify-interpolants", new SMTOption(pSolverOptions.simplifyInterpolants));
8590
}
8691
return config;
8792
}

src/org/sosy_lab/java_smt/solvers/opensmt/OpenSmtSolverContext.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// an API wrapper for a collection of SMT solvers:
33
// https://github.com/sosy-lab/java-smt
44
//
5-
// SPDX-FileCopyrightText: 2023 Dirk Beyer <https://www.sosy-lab.org>
5+
// SPDX-FileCopyrightText: 2025 Dirk Beyer <https://www.sosy-lab.org>
66
//
77
// SPDX-License-Identifier: Apache-2.0
88

@@ -13,6 +13,7 @@
1313
import java.util.function.Consumer;
1414
import org.sosy_lab.common.ShutdownNotifier;
1515
import org.sosy_lab.common.configuration.Configuration;
16+
import org.sosy_lab.common.configuration.IntegerOption;
1617
import org.sosy_lab.common.configuration.InvalidConfigurationException;
1718
import org.sosy_lab.common.configuration.Option;
1819
import org.sosy_lab.common.configuration.Options;
@@ -25,6 +26,9 @@
2526
import org.sosy_lab.java_smt.basicimpl.AbstractNumeralFormulaManager.NonLinearArithmetic;
2627
import org.sosy_lab.java_smt.basicimpl.AbstractSolverContext;
2728
import org.sosy_lab.java_smt.solvers.opensmt.api.LogicFactory;
29+
import org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms.Core;
30+
import org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms.LA;
31+
import org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms.UF;
2832

2933
public final class OpenSmtSolverContext extends AbstractSolverContext {
3034
private final OpenSmtFormulaCreator creator;
@@ -45,13 +49,27 @@ static class OpenSMTOptions {
4549
Logics logic = Logics.QF_AUFLIRA;
4650

4751
@Option(secure = true, description = "Algorithm for boolean interpolation")
48-
int algBool = 0;
52+
Core algBool = Core.MCMILLAN;
4953

5054
@Option(secure = true, description = "Algorithm for UF interpolation")
51-
int algUf = 0;
55+
UF algUf = UF.STRONG;
5256

5357
@Option(secure = true, description = "Algorithm for LRA interpolation")
54-
int algLra = 0;
58+
LA algLra = LA.STRONG;
59+
60+
/**
61+
* This option controls the level of simplification applied to interpolants.
62+
*
63+
* <p>For details, please see the original sources:
64+
* https://github.com/usi-verification-and-security/opensmt/blob/7cef5bc983d7774874ffc177f06516c4e0f411f4/src/proof/InterpolationContext.cc#L933-L960
65+
*/
66+
@IntegerOption(min = 0, max = 4)
67+
@Option(
68+
secure = true,
69+
description =
70+
"Level of simplification for interpolants,"
71+
+ "ranging from 0 (no simplification) to 4 (maximum simplification).")
72+
int simplifyInterpolants = 0;
5573

5674
final int randomSeed;
5775

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* This file is part of JavaSMT,
3+
* an API wrapper for a collection of SMT solvers:
4+
* https://github.com/sosy-lab/java-smt
5+
*
6+
* SPDX-FileCopyrightText: 2025 Dirk Beyer <https://www.sosy-lab.org>
7+
*
8+
* SPDX-License-Identifier: Apache-2.0
9+
*/
10+
11+
package org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms;
12+
13+
/**
14+
* Enumeration for the different algorithms for boolean interpolation.
15+
*
16+
* <p>For details, please see the original sources:
17+
* https://github.com/usi-verification-and-security/opensmt/blob/c267e01e1e0d4d4b7f9ba273dd910c070c1aa9b1/src/options/SMTConfig.h#L163-L168
18+
*/
19+
public enum Core {
20+
MCMILLAN(0),
21+
PUDLAK(1),
22+
MCMILLAN_PRIME(2),
23+
PROOF_SENSITIVE(3),
24+
PROOF_SENSITIVE_WEAK(4),
25+
PROOF_SENSITIVE_STRONG(5);
26+
27+
private final int value;
28+
29+
Core(int i) {
30+
value = i;
31+
}
32+
33+
public int getValue() {
34+
return value;
35+
}
36+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* This file is part of JavaSMT,
3+
* an API wrapper for a collection of SMT solvers:
4+
* https://github.com/sosy-lab/java-smt
5+
*
6+
* SPDX-FileCopyrightText: 2025 Dirk Beyer <https://www.sosy-lab.org>
7+
*
8+
* SPDX-License-Identifier: Apache-2.0
9+
*/
10+
11+
package org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms;
12+
13+
/**
14+
* Enumeration for the different algorithms for LRA interpolation.
15+
*
16+
* <p>For details, please see the original sources:
17+
* https://github.com/usi-verification-and-security/opensmt/blob/c267e01e1e0d4d4b7f9ba273dd910c070c1aa9b1/src/options/SMTConfig.h#L172C42-L176
18+
*/
19+
public enum LA {
20+
STRONG(0),
21+
WEAK(2),
22+
FACTOR(3),
23+
DECOMPOSING_STRONG(4),
24+
DECOMPOSING_WEAK(5);
25+
26+
private final int value;
27+
28+
LA(int i) {
29+
value = i;
30+
}
31+
32+
public int getValue() {
33+
return value;
34+
}
35+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* This file is part of JavaSMT,
3+
* an API wrapper for a collection of SMT solvers:
4+
* https://github.com/sosy-lab/java-smt
5+
*
6+
* SPDX-FileCopyrightText: 2025 Dirk Beyer <https://www.sosy-lab.org>
7+
*
8+
* SPDX-License-Identifier: Apache-2.0
9+
*/
10+
11+
package org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms;
12+
13+
/**
14+
* Enumeration for the different algorithms for UF interpolation.
15+
*
16+
* <p>For details, please see the original sources:
17+
* https://github.com/usi-verification-and-security/opensmt/blob/c267e01e1e0d4d4b7f9ba273dd910c070c1aa9b1/src/options/SMTConfig.h#L169-L171
18+
*/
19+
public enum UF {
20+
STRONG(0),
21+
WEAK(2),
22+
RANDOM(3);
23+
24+
private final int value;
25+
26+
UF(int i) {
27+
value = i;
28+
}
29+
30+
public int getValue() {
31+
return value;
32+
}
33+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* This file is part of JavaSMT,
3+
* an API wrapper for a collection of SMT solvers:
4+
* https://github.com/sosy-lab/java-smt
5+
*
6+
* SPDX-FileCopyrightText: 2025 Dirk Beyer <https://www.sosy-lab.org>
7+
*
8+
* SPDX-License-Identifier: Apache-2.0
9+
*/
10+
11+
/** Supported interpolation algorithms. */
12+
package org.sosy_lab.java_smt.solvers.opensmt.interpolationAlgorithms;

0 commit comments

Comments
 (0)