Skip to content

Commit 2b21b02

Browse files
committed
Boolector: remove deprecated and unused method for formula visitor.
Boolector does not support visiting formulas anyway.
1 parent a6bdbf9 commit 2b21b02

File tree

1 file changed

+0
-53
lines changed

1 file changed

+0
-53
lines changed

src/org/sosy_lab/java_smt/solvers/boolector/BoolectorFormulaCreator.java

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@
1212

1313
import com.google.common.base.Preconditions;
1414
import com.google.common.collect.HashBasedTable;
15-
import com.google.common.collect.ImmutableList;
1615
import com.google.common.collect.Table;
1716
import com.google.common.primitives.Longs;
1817
import java.math.BigInteger;
1918
import java.util.ArrayList;
20-
import java.util.HashMap;
2119
import java.util.Iterator;
2220
import java.util.List;
23-
import java.util.Map;
2421
import java.util.Optional;
2522
import org.sosy_lab.java_smt.api.ArrayFormula;
2623
import org.sosy_lab.java_smt.api.BitvectorFormula;
@@ -29,10 +26,8 @@
2926
import org.sosy_lab.java_smt.api.FormulaType;
3027
import org.sosy_lab.java_smt.api.FormulaType.ArrayFormulaType;
3128
import org.sosy_lab.java_smt.api.FormulaType.FloatingPointType;
32-
import org.sosy_lab.java_smt.api.FunctionDeclarationKind;
3329
import org.sosy_lab.java_smt.api.visitors.FormulaVisitor;
3430
import org.sosy_lab.java_smt.basicimpl.FormulaCreator;
35-
import org.sosy_lab.java_smt.basicimpl.FunctionDeclarationImpl;
3631
import org.sosy_lab.java_smt.solvers.boolector.BoolectorFormula.BoolectorArrayFormula;
3732
import org.sosy_lab.java_smt.solvers.boolector.BoolectorFormula.BoolectorBitvectorFormula;
3833
import org.sosy_lab.java_smt.solvers.boolector.BoolectorFormula.BoolectorBooleanFormula;
@@ -48,9 +43,6 @@ public class BoolectorFormulaCreator extends FormulaCreator<Long, Long, Long, Lo
4843
*/
4944
private final Table<String, Long, Long> formulaCache = HashBasedTable.create();
5045

51-
// Remember uf sorts, as Boolector does not give them back correctly
52-
private final Map<Long, List<Long>> ufArgumentsSortMap = new HashMap<>();
53-
5446
// Possibly we need to split this up into vars, ufs, and arrays
5547

5648
BoolectorFormulaCreator(Long btor) {
@@ -203,50 +195,6 @@ public <R> R visit(FormulaVisitor<R> visitor, Formula formula, Long f) {
203195
"Boolector has no methods to access internal nodes for visitation.");
204196
}
205197

206-
// Hopefully a helpful template for when visitor gets implemented
207-
// Btor only has bitvec arrays and ufs with bitvecs and arrays of bitvecs
208-
// (and quantifier with bitvecs only)
209-
@SuppressWarnings({"deprecation", "unused"})
210-
private <R> R visit1(FormulaVisitor<R> visitor, Formula formula, Long f) {
211-
if (BtorJNI.boolector_is_const(getEnv(), f)) {
212-
// Handles all constants (bitvec, bool)
213-
String bits = BtorJNI.boolector_get_bits(getEnv(), f);
214-
return visitor.visitConstant(formula, convertValue(f, parseBitvector(bits)));
215-
} else if (BtorJNI.boolector_is_param(getEnv(), f)) {
216-
// Quantifier have their own variables called param.
217-
// They can only be bound once! (use them as bitvec)
218-
int deBruijnIdx = 0; // TODO: Ask Developers for this because this is WRONG!
219-
return visitor.visitBoundVariable(formula, deBruijnIdx);
220-
} else if (false) {
221-
// Quantifier
222-
// there is currently no way to find out if the formula is a quantifier
223-
// do we need them separately?
224-
/*
225-
* return visitor .visitQuantifier( (BoolectorBooleanFormula) formula, quantifier,
226-
* boundVariables, new BoolectorBooleanFormula(body, getEnv()));
227-
*/
228-
} else if (BtorJNI.boolector_is_var(getEnv(), f)) {
229-
// bitvec var (size 1 is bool!)
230-
return visitor.visitFreeVariable(formula, getName(f));
231-
} else {
232-
ImmutableList.Builder<Formula> args = ImmutableList.builder();
233-
234-
ImmutableList.Builder<FormulaType<?>> argTypes = ImmutableList.builder();
235-
236-
return visitor.visitFunction(
237-
formula,
238-
args.build(),
239-
FunctionDeclarationImpl.of(
240-
getName(f), getDeclarationKind(f), argTypes.build(), getFormulaType(f), f));
241-
} // TODO: fix declaration in visitFunction
242-
return null;
243-
}
244-
245-
// TODO: returns kind of formula (add, uf etc....) once methods are provided
246-
private FunctionDeclarationKind getDeclarationKind(@SuppressWarnings("unused") long f) {
247-
return null;
248-
}
249-
250198
@Override
251199
public Long callFunctionImpl(Long pDeclaration, List<Long> pArgs) {
252200
Preconditions.checkArgument(
@@ -270,7 +218,6 @@ public Long declareUFImpl(String name, Long pReturnType, List<Long> pArgTypes) {
270218
}
271219
long uf = BtorJNI.boolector_uf(getEnv(), sort, name);
272220
formulaCache.put(name, sort, uf);
273-
ufArgumentsSortMap.put(uf, pArgTypes);
274221
return uf;
275222
}
276223

0 commit comments

Comments
 (0)