12
12
13
13
import com .google .common .base .Preconditions ;
14
14
import com .google .common .collect .HashBasedTable ;
15
- import com .google .common .collect .ImmutableList ;
16
15
import com .google .common .collect .Table ;
17
16
import com .google .common .primitives .Longs ;
18
17
import java .math .BigInteger ;
19
18
import java .util .ArrayList ;
20
- import java .util .HashMap ;
21
19
import java .util .Iterator ;
22
20
import java .util .List ;
23
- import java .util .Map ;
24
21
import java .util .Optional ;
25
22
import org .sosy_lab .java_smt .api .ArrayFormula ;
26
23
import org .sosy_lab .java_smt .api .BitvectorFormula ;
29
26
import org .sosy_lab .java_smt .api .FormulaType ;
30
27
import org .sosy_lab .java_smt .api .FormulaType .ArrayFormulaType ;
31
28
import org .sosy_lab .java_smt .api .FormulaType .FloatingPointType ;
32
- import org .sosy_lab .java_smt .api .FunctionDeclarationKind ;
33
29
import org .sosy_lab .java_smt .api .visitors .FormulaVisitor ;
34
30
import org .sosy_lab .java_smt .basicimpl .FormulaCreator ;
35
- import org .sosy_lab .java_smt .basicimpl .FunctionDeclarationImpl ;
36
31
import org .sosy_lab .java_smt .solvers .boolector .BoolectorFormula .BoolectorArrayFormula ;
37
32
import org .sosy_lab .java_smt .solvers .boolector .BoolectorFormula .BoolectorBitvectorFormula ;
38
33
import org .sosy_lab .java_smt .solvers .boolector .BoolectorFormula .BoolectorBooleanFormula ;
@@ -48,9 +43,6 @@ public class BoolectorFormulaCreator extends FormulaCreator<Long, Long, Long, Lo
48
43
*/
49
44
private final Table <String , Long , Long > formulaCache = HashBasedTable .create ();
50
45
51
- // Remember uf sorts, as Boolector does not give them back correctly
52
- private final Map <Long , List <Long >> ufArgumentsSortMap = new HashMap <>();
53
-
54
46
// Possibly we need to split this up into vars, ufs, and arrays
55
47
56
48
BoolectorFormulaCreator (Long btor ) {
@@ -203,50 +195,6 @@ public <R> R visit(FormulaVisitor<R> visitor, Formula formula, Long f) {
203
195
"Boolector has no methods to access internal nodes for visitation." );
204
196
}
205
197
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
-
250
198
@ Override
251
199
public Long callFunctionImpl (Long pDeclaration , List <Long > pArgs ) {
252
200
Preconditions .checkArgument (
@@ -270,7 +218,6 @@ public Long declareUFImpl(String name, Long pReturnType, List<Long> pArgTypes) {
270
218
}
271
219
long uf = BtorJNI .boolector_uf (getEnv (), sort , name );
272
220
formulaCache .put (name , sort , uf );
273
- ufArgumentsSortMap .put (uf , pArgTypes );
274
221
return uf ;
275
222
}
276
223
0 commit comments