1212
1313import com .google .common .base .Preconditions ;
1414import com .google .common .collect .HashBasedTable ;
15- import com .google .common .collect .ImmutableList ;
1615import com .google .common .collect .Table ;
1716import com .google .common .primitives .Longs ;
1817import java .math .BigInteger ;
1918import java .util .ArrayList ;
20- import java .util .HashMap ;
2119import java .util .Iterator ;
2220import java .util .List ;
23- import java .util .Map ;
2421import java .util .Optional ;
2522import org .sosy_lab .java_smt .api .ArrayFormula ;
2623import org .sosy_lab .java_smt .api .BitvectorFormula ;
2926import org .sosy_lab .java_smt .api .FormulaType ;
3027import org .sosy_lab .java_smt .api .FormulaType .ArrayFormulaType ;
3128import org .sosy_lab .java_smt .api .FormulaType .FloatingPointType ;
32- import org .sosy_lab .java_smt .api .FunctionDeclarationKind ;
3329import org .sosy_lab .java_smt .api .visitors .FormulaVisitor ;
3430import org .sosy_lab .java_smt .basicimpl .FormulaCreator ;
35- import org .sosy_lab .java_smt .basicimpl .FunctionDeclarationImpl ;
3631import org .sosy_lab .java_smt .solvers .boolector .BoolectorFormula .BoolectorArrayFormula ;
3732import org .sosy_lab .java_smt .solvers .boolector .BoolectorFormula .BoolectorBitvectorFormula ;
3833import 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