1 package cvc3; 2 3 import java.util.*; 4 5 import cvc3.Expr; 6 import cvc3.JniUtils; 7 8 public class ValidityChecker extends Embedded { 9 // jni methods 10 private static native Object jniCreate1()11 jniCreate1() throws Cvc3Exception; 12 private static native Object jniCreate2(Object Flags)13 jniCreate2(Object Flags) throws Cvc3Exception; 14 private static native Object jniCreateFlags()15 jniCreateFlags() throws Cvc3Exception; 16 private static native Object jniGetFlags(Object ValidityChecker)17 jniGetFlags(Object ValidityChecker) throws Cvc3Exception; 18 19 20 private static native Object jniBoolType(Object ValidityChecker)21 jniBoolType(Object ValidityChecker) throws Cvc3Exception; 22 private static native Object jniRealType(Object ValidityChecker)23 jniRealType(Object ValidityChecker) throws Cvc3Exception; 24 private static native Object jniIntType(Object ValidityChecker)25 jniIntType(Object ValidityChecker) throws Cvc3Exception; 26 private static native Object jniSubrangeType(Object ValidityChecker, Object lExpr, Object rExpr)27 jniSubrangeType(Object ValidityChecker, Object lExpr, Object rExpr) throws Cvc3Exception; 28 private static native Object jniSubtypeType(Object ValidityChecker, Object predExpr, Object witnessExpr)29 jniSubtypeType(Object ValidityChecker, Object predExpr, Object witnessExpr) throws Cvc3Exception; 30 private static native Object jniTupleType1(Object ValidityChecker, Object Type0, Object Type1)31 jniTupleType1(Object ValidityChecker, Object Type0, Object Type1) throws Cvc3Exception; 32 private static native Object jniTupleType2(Object ValidityChecker, Object Type0, Object Type1, Object Type2)33 jniTupleType2(Object ValidityChecker, Object Type0, Object Type1, Object Type2) throws Cvc3Exception; 34 private static native Object jniTupleType3(Object ValidityChecker, Object[] Types)35 jniTupleType3(Object ValidityChecker, Object[] Types) throws Cvc3Exception; 36 private static native Object jniRecordType1(Object ValidityChecker, String field, Object Type)37 jniRecordType1(Object ValidityChecker, String field, Object Type) throws Cvc3Exception; 38 private static native Object jniRecordType2(Object ValidityChecker, String field0, Object Type0, String field1, Object Type1)39 jniRecordType2(Object ValidityChecker, String field0, Object Type0, 40 String field1, Object Type1) throws Cvc3Exception; 41 private static native Object jniRecordType3(Object ValidityChecker, String field0, Object Type0, String field1, Object Type1, String field2, Object Type2)42 jniRecordType3(Object ValidityChecker, String field0, Object Type0, 43 String field1, Object Type1, String field2, Object Type2) throws Cvc3Exception; 44 private static native Object jniRecordType4(Object ValidityChecker, Object[] fields, Object[] types)45 jniRecordType4(Object ValidityChecker, Object[] fields, Object[] types) throws Cvc3Exception; 46 private static native Object jniDataType1(Object ValidityChecker, String name, String constructor, Object[] selectors, Object[] types)47 jniDataType1(Object ValidityChecker, String name, String constructor, 48 Object[] selectors, Object[] types) throws Cvc3Exception; 49 private static native Object jniDataType2(Object ValidityChecker, String name, Object[] constructors, Object[] selectors, Object[] types)50 jniDataType2(Object ValidityChecker, String name, Object[] constructors, 51 Object[] selectors, Object[] types) throws Cvc3Exception; 52 private static native Object[] jniDataType3(Object ValidityChecker, Object[] names, Object[] constructors, Object[] selectors, Object[] types)53 jniDataType3(Object ValidityChecker, Object[] names, Object[] constructors, 54 Object[] selectors, Object[] types) throws Cvc3Exception; 55 private static native Object jniAnyType(Object ValidityChecker)56 jniAnyType(Object ValidityChecker) throws Cvc3Exception; 57 private static native Object jniArrayLiteral(Object ValidityChecker, Object indexVar, Object bodyExpr)58 jniArrayLiteral(Object ValidityChecker, Object indexVar, Object bodyExpr) throws Cvc3Exception; 59 private static native Object jniArrayType(Object ValidityChecker, Object TypeIndex, Object TypeData)60 jniArrayType(Object ValidityChecker, Object TypeIndex, Object TypeData) throws Cvc3Exception; 61 private static native Object jniBitvecType(Object ValidityChecker, int n)62 jniBitvecType(Object ValidityChecker, int n) throws Cvc3Exception; 63 private static native Object jniFunType1(Object ValidityChecker, Object typeDom, Object TypeRan)64 jniFunType1(Object ValidityChecker, Object typeDom, Object TypeRan) throws Cvc3Exception; 65 private static native Object jniFunType2(Object ValidityChecker, Object[] typeDom, Object TypeRan)66 jniFunType2(Object ValidityChecker, Object[] typeDom, Object TypeRan) throws Cvc3Exception; 67 private static native Object jniCreateType1(Object ValidityChecker, String typeName)68 jniCreateType1(Object ValidityChecker, String typeName) throws Cvc3Exception; 69 private static native Object jniCreateType2(Object ValidityChecker, String typeName, Object TypeDef)70 jniCreateType2(Object ValidityChecker, String typeName, Object TypeDef) throws Cvc3Exception; 71 private static native Object jniLookupType(Object ValidityChecker, String typeName)72 jniLookupType(Object ValidityChecker, String typeName) throws Cvc3Exception; 73 74 75 private static native Object jniGetExprManager(Object ValidityChecker)76 jniGetExprManager(Object ValidityChecker) throws Cvc3Exception; 77 private static native Object jniNullExpr(Object ValidityChecker)78 jniNullExpr(Object ValidityChecker) throws Cvc3Exception; 79 private static native Object jniVarExpr1(Object ValidityChecker, String name, Object Type)80 jniVarExpr1(Object ValidityChecker, String name, Object Type) throws Cvc3Exception; 81 private static native Object jniVarExpr2(Object ValidityChecker, String name, Object Type, Object defExpr)82 jniVarExpr2(Object ValidityChecker, String name, Object Type, Object defExpr) throws Cvc3Exception; 83 private static native Object jniBoundVarExpr(Object ValidityChecker, String name, String uid, Object Type)84 jniBoundVarExpr(Object ValidityChecker, String name, String uid, Object Type) throws Cvc3Exception; 85 /*private static native Object 86 jniBoundVarExpr2(Object ValidityChecker, Object Type) throws Cvc3Exception; 87 */ 88 private static native Object jniLookupVar(Object ValidityChecker, String name)89 jniLookupVar(Object ValidityChecker, String name) throws Cvc3Exception; 90 private static native Object jniLookupOp(Object ValidityChecker, String name)91 jniLookupOp(Object ValidityChecker, String name) throws Cvc3Exception; 92 private static native Object jniGetType(Object ValidityChecker, Object Expr)93 jniGetType(Object ValidityChecker, Object Expr) throws Cvc3Exception; 94 private static native Object jniGetBaseType1(Object ValidityChecker, Object Expr)95 jniGetBaseType1(Object ValidityChecker, Object Expr) throws Cvc3Exception; 96 private static native Object jniGetBaseType2(Object ValidityChecker, Object Type)97 jniGetBaseType2(Object ValidityChecker, Object Type) throws Cvc3Exception; 98 private static native Object jniGetTypePred(Object ValidityChecker, Object Type, Object Expr)99 jniGetTypePred(Object ValidityChecker, Object Type, Object Expr) throws Cvc3Exception; 100 private static native Object jniStringExpr(Object ValidityChecker, String str)101 jniStringExpr(Object ValidityChecker, String str) throws Cvc3Exception; 102 private static native Object jniIdExpr(Object ValidityChecker, String name)103 jniIdExpr(Object ValidityChecker, String name) throws Cvc3Exception; 104 private static native Object jniListExpr1(Object ValidityChecker, Object[] kids)105 jniListExpr1(Object ValidityChecker, Object[] kids) throws Cvc3Exception; 106 private static native Object jniListExpr2(Object ValidityChecker, Object Expr1)107 jniListExpr2(Object ValidityChecker, Object Expr1) throws Cvc3Exception; 108 private static native Object jniListExpr3(Object ValidityChecker, Object Expr1, Object Expr2)109 jniListExpr3(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 110 private static native Object jniListExpr4(Object ValidityChecker, Object Expr1, Object Expr2, Object Expr3)111 jniListExpr4(Object ValidityChecker, Object Expr1, Object Expr2, Object Expr3) throws Cvc3Exception; 112 private static native Object jniListExpr5(Object ValidityChecker, String op, Object[] kids)113 jniListExpr5(Object ValidityChecker, String op, Object[] kids) throws Cvc3Exception; 114 private static native Object jniListExpr6(Object ValidityChecker, String op, Object Expr1)115 jniListExpr6(Object ValidityChecker, String op, Object Expr1) throws Cvc3Exception; 116 private static native Object jniListExpr7(Object ValidityChecker, String op, Object Expr1, Object Expr2)117 jniListExpr7(Object ValidityChecker, String op, Object Expr1, Object Expr2) throws Cvc3Exception; 118 private static native Object jniListExpr8(Object ValidityChecker, String op, Object Expr1, Object Expr2, Object Expr3)119 jniListExpr8(Object ValidityChecker, String op, Object Expr1, Object Expr2, Object Expr3) throws Cvc3Exception; 120 private static native void jniPrintExpr(Object ValidityChecker, Object Expr)121 jniPrintExpr(Object ValidityChecker, Object Expr) throws Cvc3Exception; 122 private static native Object jniParseExpr(Object ValidityChecker, Object Expr)123 jniParseExpr(Object ValidityChecker, Object Expr) throws Cvc3Exception; 124 private static native Object jniParseType(Object ValidityChecker, Object Expr)125 jniParseType(Object ValidityChecker, Object Expr) throws Cvc3Exception; 126 private static native Object jniImportExpr(Object ValidityChecker, Object Expr)127 jniImportExpr(Object ValidityChecker, Object Expr) throws Cvc3Exception; 128 private static native Object jniImportType(Object ValidityChecker, Object Type)129 jniImportType(Object ValidityChecker, Object Type) throws Cvc3Exception; 130 private static native void jniCmdsFromString(Object ValidityChecker, String s)131 jniCmdsFromString(Object ValidityChecker, String s) throws Cvc3Exception; 132 private static native Object jniExprFromString(Object ValidityChecker, String s)133 jniExprFromString(Object ValidityChecker, String s) throws Cvc3Exception; 134 private static native Object jniTrueExpr(Object ValidityChecker)135 jniTrueExpr(Object ValidityChecker) throws Cvc3Exception; 136 private static native Object jniFalseExpr(Object ValidityChecker)137 jniFalseExpr(Object ValidityChecker) throws Cvc3Exception; 138 private static native Object jniNotExpr(Object ValidityChecker, Object Expr)139 jniNotExpr(Object ValidityChecker, Object Expr) throws Cvc3Exception; 140 private static native Object jniAndExpr1(Object ValidityChecker, Object ExprLeft, Object ExprRight)141 jniAndExpr1(Object ValidityChecker, Object ExprLeft, Object ExprRight) throws Cvc3Exception; 142 private static native Object jniAndExpr2(Object ValidityChecker, Object[] ExprChildren)143 jniAndExpr2(Object ValidityChecker, Object[] ExprChildren) throws Cvc3Exception; 144 private static native Object jniOrExpr1(Object ValidityChecker, Object ExprLeft, Object ExprRight)145 jniOrExpr1(Object ValidityChecker, Object ExprLeft, Object ExprRight) throws Cvc3Exception; 146 private static native Object jniOrExpr2(Object ValidityChecker, Object[] Exprchildren)147 jniOrExpr2(Object ValidityChecker, Object[] Exprchildren) throws Cvc3Exception; 148 private static native Object jniImpliesExpr(Object ValidityChecker, Object ExprHyp, Object ExprConc)149 jniImpliesExpr(Object ValidityChecker, Object ExprHyp, Object ExprConc) throws Cvc3Exception; 150 private static native Object jniIffExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight)151 jniIffExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight) throws Cvc3Exception; 152 private static native Object jniEqExpr(Object ValidityChecker, Object Expr1, Object Expr2)153 jniEqExpr(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 154 private static native Object jniDistinctExpr(Object ValidityChecker, Object[] ExprChildren)155 jniDistinctExpr(Object ValidityChecker, Object[] ExprChildren) throws Cvc3Exception; 156 private static native Object jniIteExpr(Object ValidityChecker, Object ExprIf, Object ExprThen, Object ExprElse)157 jniIteExpr(Object ValidityChecker, Object ExprIf, Object ExprThen, Object ExprElse) throws Cvc3Exception; 158 private static native Object jniCreateOp1(Object ValidityChecker, String name, Object Type)159 jniCreateOp1(Object ValidityChecker, String name, Object Type) throws Cvc3Exception; 160 private static native Object jniCreateOp2(Object ValidityChecker, String name, Object Type, Object ExprDef)161 jniCreateOp2(Object ValidityChecker, String name, Object Type, Object ExprDef) throws Cvc3Exception; 162 private static native Object jniEqOp()163 jniEqOp() throws Cvc3Exception; 164 private static native Object jniLtOp()165 jniLtOp() throws Cvc3Exception; 166 private static native Object jniLeOp()167 jniLeOp() throws Cvc3Exception; 168 private static native Object jniGtOp()169 jniGtOp() throws Cvc3Exception; 170 private static native Object jniGeOp()171 jniGeOp() throws Cvc3Exception; 172 private static native Object jniPlusOp()173 jniPlusOp() throws Cvc3Exception; 174 private static native Object jniMinusOp()175 jniMinusOp() throws Cvc3Exception; 176 private static native Object jniMultOp()177 jniMultOp() throws Cvc3Exception; 178 private static native Object jniDivideOp()179 jniDivideOp() throws Cvc3Exception; 180 private static native Object jniFunExpr1(Object ValidityChecker, Object Op, Object Expr)181 jniFunExpr1(Object ValidityChecker, Object Op, Object Expr) throws Cvc3Exception; 182 private static native Object jniFunExpr2(Object ValidityChecker, Object Op, Object ExprLeft, Object ExprRight)183 jniFunExpr2(Object ValidityChecker, Object Op, Object ExprLeft, Object ExprRight) throws Cvc3Exception; 184 private static native Object jniFunExpr3(Object ValidityChecker, Object Op, Object Expr1, Object Expr2, Object Expr3)185 jniFunExpr3(Object ValidityChecker, Object Op, Object Expr1, Object Expr2, Object Expr3) throws Cvc3Exception; 186 private static native Object jniFunExpr4(Object ValidityChecker, Object Op, Object[] ExprChildren)187 jniFunExpr4(Object ValidityChecker, Object Op, Object[] ExprChildren) throws Cvc3Exception; 188 private static native Object jniRatExpr1(Object ValidityChecker, int n, int d)189 jniRatExpr1(Object ValidityChecker, int n, int d) throws Cvc3Exception; 190 private static native Object jniRatExpr2(Object ValidityChecker, String n, String d, int base)191 jniRatExpr2(Object ValidityChecker, String n, String d, int base) throws Cvc3Exception; 192 private static native Object jniRatExpr3(Object ValidityChecker, String n, int base)193 jniRatExpr3(Object ValidityChecker, String n, int base) throws Cvc3Exception; 194 private static native Object jniUminusExpr(Object ValidityChecker, Object Expr)195 jniUminusExpr(Object ValidityChecker, Object Expr) throws Cvc3Exception; 196 private static native Object jniPlusExpr1(Object ValidityChecker, Object Exprleft, Object ExprRight)197 jniPlusExpr1(Object ValidityChecker, Object Exprleft, Object ExprRight) throws Cvc3Exception; 198 private static native Object jniPlusExpr2(Object ValidityChecker, Object[] kids)199 jniPlusExpr2(Object ValidityChecker, Object[] kids) throws Cvc3Exception; 200 private static native Object jniMinusExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight)201 jniMinusExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight) throws Cvc3Exception; 202 private static native Object jniMultExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight)203 jniMultExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight) throws Cvc3Exception; 204 private static native Object jniPowExpr(Object ValidityChecker, Object ExprX, Object ExprN)205 jniPowExpr(Object ValidityChecker, Object ExprX, Object ExprN) throws Cvc3Exception; 206 private static native Object jniDivideExpr(Object ValidityChecker, Object ExprNumerator, Object ExprDenominator)207 jniDivideExpr(Object ValidityChecker, Object ExprNumerator, Object ExprDenominator) throws Cvc3Exception; 208 private static native Object jniLtExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight)209 jniLtExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight) throws Cvc3Exception; 210 private static native Object jniLeExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight)211 jniLeExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight) throws Cvc3Exception; 212 private static native Object jniGtExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight)213 jniGtExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight) throws Cvc3Exception; 214 private static native Object jniGeExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight)215 jniGeExpr(Object ValidityChecker, Object ExprLeft, Object ExprRight) throws Cvc3Exception; 216 private static native Object jniRecordExpr1(Object ValidityChecker, String field, Object Expr)217 jniRecordExpr1(Object ValidityChecker, String field, Object Expr) throws Cvc3Exception; 218 private static native Object jniRecordExpr2(Object ValidityChecker, String field1, Object Expr1, String field2, Object Expr2)219 jniRecordExpr2(Object ValidityChecker, String field1, Object Expr1, 220 String field2, Object Expr2) throws Cvc3Exception; 221 private static native Object jniRecordExpr3(Object ValidityChecker, String field1, Object Expr1, String field2, Object Expr2, String field3, Object Expr3)222 jniRecordExpr3(Object ValidityChecker, String field1, Object Expr1, String field2, Object Expr2, 223 String field3, Object Expr3) throws Cvc3Exception; 224 private static native Object jniRecordExpr4(Object ValidityChecker, Object[] StringFields, Object[] Exprs)225 jniRecordExpr4(Object ValidityChecker, Object[] StringFields, Object[] Exprs) throws Cvc3Exception; 226 private static native Object jniRecSelectExpr(Object ValidityChecker, Object ExprRecord, String field)227 jniRecSelectExpr(Object ValidityChecker, Object ExprRecord, String field) throws Cvc3Exception; 228 private static native Object jniRecUpdateExpr(Object ValidityChecker, Object ExprRecord, String field, Object ExprNewValue)229 jniRecUpdateExpr(Object ValidityChecker, Object ExprRecord, String field, 230 Object ExprNewValue) throws Cvc3Exception; 231 private static native Object jniReadExpr(Object ValidityChecker, Object ExprArray, Object ExprIndex)232 jniReadExpr(Object ValidityChecker, Object ExprArray, Object ExprIndex) throws Cvc3Exception; 233 private static native Object jniWriteExpr(Object ValidityChecker, Object ExprArray, Object ExprIndex, Object ExprNewValue)234 jniWriteExpr(Object ValidityChecker, Object ExprArray, Object ExprIndex, 235 Object ExprNewValue) throws Cvc3Exception; 236 private static native Object jniNewBVConstExpr1(Object ValidityChecker, String s, int base)237 jniNewBVConstExpr1(Object ValidityChecker, String s, int base) throws Cvc3Exception; 238 private static native Object jniNewBVConstExpr2(Object ValidityChecker, boolean[] bits)239 jniNewBVConstExpr2(Object ValidityChecker, boolean[] bits) throws Cvc3Exception; 240 private static native Object jniNewBVConstExpr3(Object ValidityChecker, Object RationalR, int len)241 jniNewBVConstExpr3(Object ValidityChecker, Object RationalR, int len) throws Cvc3Exception; 242 private static native Object jniNewConcatExpr1(Object ValidityChecker, Object Expr1, Object Expr2)243 jniNewConcatExpr1(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 244 private static native Object jniNewConcatExpr2(Object ValidityChecker, Object[] Exprkids)245 jniNewConcatExpr2(Object ValidityChecker, Object[] Exprkids) throws Cvc3Exception; 246 private static native Object jniNewBVExtractExpr(Object ValidityChecker, Object ExprE, int hi, int low)247 jniNewBVExtractExpr(Object ValidityChecker, Object ExprE, int hi, int low) throws Cvc3Exception; 248 private static native Object jniNewBVNegExpr(Object ValidityChecker, Object Expr1)249 jniNewBVNegExpr(Object ValidityChecker, Object Expr1) throws Cvc3Exception; 250 private static native Object jniNewBVAndExpr1(Object ValidityChecker, Object Expr1, Object Expr2)251 jniNewBVAndExpr1(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 252 private static native Object jniNewBVAndExpr2(Object ValidityChecker, Object[] ExprKids)253 jniNewBVAndExpr2(Object ValidityChecker, Object[] ExprKids) throws Cvc3Exception; 254 private static native Object jniNewBVOrExpr1(Object ValidityChecker, Object Expr1, Object Expr2)255 jniNewBVOrExpr1(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 256 private static native Object jniNewBVOrExpr2(Object ValidityChecker, Object[] ExprKids)257 jniNewBVOrExpr2(Object ValidityChecker, Object[] ExprKids) throws Cvc3Exception; 258 private static native Object jniNewBVXorExpr1(Object ValidityChecker, Object Expr1, Object Expr2)259 jniNewBVXorExpr1(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 260 private static native Object jniNewBVXorExpr2(Object ValidityChecker, Object[] ExprKids)261 jniNewBVXorExpr2(Object ValidityChecker, Object[] ExprKids) throws Cvc3Exception; 262 private static native Object jniNewBVXnorExpr1(Object ValidityChecker, Object Expr1, Object Expr2)263 jniNewBVXnorExpr1(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 264 private static native Object jniNewBVXnorExpr2(Object ValidityChecker, Object[] ExprKids)265 jniNewBVXnorExpr2(Object ValidityChecker, Object[] ExprKids) throws Cvc3Exception; 266 private static native Object jniNewBVNandExpr(Object ValidityChecker, Object Expr1, Object Expr2)267 jniNewBVNandExpr(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 268 private static native Object jniNewBVNorExpr(Object ValidityChecker, Object Expr1, Object Expr2)269 jniNewBVNorExpr(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 270 private static native Object jniNewBVLTExpr(Object ValidityChecker, Object Expr1, Object Expr2)271 jniNewBVLTExpr(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 272 private static native Object jniNewBVLEExpr(Object ValidityChecker, Object Expr1, Object Expr2)273 jniNewBVLEExpr(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 274 private static native Object jniNewBVSLTExpr(Object ValidityChecker, Object Expr1, Object Expr2)275 jniNewBVSLTExpr(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 276 private static native Object jniNewBVSLEExpr(Object ValidityChecker, Object Expr1, Object Expr2)277 jniNewBVSLEExpr(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 278 private static native Object jniNewSXExpr(Object ValidityChecker, Object Expr1, int len)279 jniNewSXExpr(Object ValidityChecker, Object Expr1, int len) throws Cvc3Exception; 280 private static native Object jniNewBVUminusExpr(Object ValidityChecker, Object Expr)281 jniNewBVUminusExpr(Object ValidityChecker, Object Expr) throws Cvc3Exception; 282 private static native Object jniNewBVSubExpr(Object ValidityChecker, Object Expr1, Object Expr2)283 jniNewBVSubExpr(Object ValidityChecker, Object Expr1, Object Expr2) throws Cvc3Exception; 284 private static native Object jniNewBVPlusExpr(Object ValidityChecker, int numbits, Object[] ExprK)285 jniNewBVPlusExpr(Object ValidityChecker, int numbits, Object[] ExprK) throws Cvc3Exception; 286 private static native Object jniNewBVMultExpr(Object ValidityChecker, int numbits, Object Expr1, Object Expr2)287 jniNewBVMultExpr(Object ValidityChecker, int numbits, Object Expr1, Object Expr2) throws Cvc3Exception; 288 private static native Object jniNewBVUDivExpr(Object ValidityChecker, Object left, Object right)289 jniNewBVUDivExpr(Object ValidityChecker, Object left, Object right) throws Cvc3Exception; 290 private static native Object jniNewBVURemExpr(Object ValidityChecker, Object left, Object right)291 jniNewBVURemExpr(Object ValidityChecker, Object left, Object right) throws Cvc3Exception; 292 private static native Object jniNewBVSDivExpr(Object ValidityChecker, Object left, Object right)293 jniNewBVSDivExpr(Object ValidityChecker, Object left, Object right) throws Cvc3Exception; 294 private static native Object jniNewBVSRemExpr(Object ValidityChecker, Object left, Object right)295 jniNewBVSRemExpr(Object ValidityChecker, Object left, Object right) throws Cvc3Exception; 296 private static native Object jniNewBVSModExpr(Object ValidityChecker, Object left, Object right)297 jniNewBVSModExpr(Object ValidityChecker, Object left, Object right) throws Cvc3Exception; 298 private static native Object jniNewBVSHL(Object ValidityChecker, Object left, Object right)299 jniNewBVSHL(Object ValidityChecker, Object left, Object right) throws Cvc3Exception; 300 private static native Object jniNewBVLSHR(Object ValidityChecker, Object left, Object right)301 jniNewBVLSHR(Object ValidityChecker, Object left, Object right) throws Cvc3Exception; 302 private static native Object jniNewBVASHR(Object ValidityChecker, Object left, Object right)303 jniNewBVASHR(Object ValidityChecker, Object left, Object right) throws Cvc3Exception; 304 private static native Object jniNewFixedLeftShiftExpr(Object ValidityChecker, Object Expr1, int r)305 jniNewFixedLeftShiftExpr(Object ValidityChecker, Object Expr1, int r) throws Cvc3Exception; 306 private static native Object jniNewFixedConstWidthLeftShiftExpr(Object ValidityChecker, Object Expr1, int r)307 jniNewFixedConstWidthLeftShiftExpr(Object ValidityChecker, Object Expr1, int r) throws Cvc3Exception; 308 private static native Object jniNewFixedRightShiftExpr(Object ValidityChecker, Object Expr1, int r)309 jniNewFixedRightShiftExpr(Object ValidityChecker, Object Expr1, int r) throws Cvc3Exception; 310 private static native Object jniComputeBVConst(Object ValidityChecker, Object Expr)311 jniComputeBVConst(Object ValidityChecker, Object Expr) throws Cvc3Exception; 312 private static native Object jniTupleExpr(Object ValidityChecker, Object[] Exprs)313 jniTupleExpr(Object ValidityChecker, Object[] Exprs) throws Cvc3Exception; 314 private static native Object jniTupleSelectExpr(Object ValidityChecker, Object ExprTuple, int index)315 jniTupleSelectExpr(Object ValidityChecker, Object ExprTuple, int index) throws Cvc3Exception; 316 private static native Object jniTupleUpdateExpr(Object ValidityChecker, Object ExprTuple, int index, Object ExprNewValue)317 jniTupleUpdateExpr(Object ValidityChecker, Object ExprTuple, int index, 318 Object ExprNewValue) throws Cvc3Exception; 319 private static native Object jniDatatypeConsExpr(Object ValidityChecker, String constructor, Object[] ExprArgs)320 jniDatatypeConsExpr(Object ValidityChecker, String constructor, Object[] ExprArgs) throws Cvc3Exception; 321 private static native Object jniDatatypeSelExpr(Object ValidityChecker, String selector, Object ExprArg)322 jniDatatypeSelExpr(Object ValidityChecker, String selector, Object ExprArg) throws Cvc3Exception; 323 private static native Object jniDatatypeTestExpr(Object ValidityChecker, String constructor, Object ExprArg)324 jniDatatypeTestExpr(Object ValidityChecker, String constructor, Object ExprArg) throws Cvc3Exception; 325 private static native Object jniForallExpr1(Object ValidityChecker, Object[] ExprVars, Object ExprBody)326 jniForallExpr1(Object ValidityChecker, Object[] ExprVars, Object ExprBody) throws Cvc3Exception; 327 private static native Object jniForallExpr2(Object ValidityChecker, Object[] ExprVars, Object ExprBody, Object ExprTrigger)328 jniForallExpr2(Object ValidityChecker, Object[] ExprVars, Object ExprBody, 329 Object ExprTrigger) throws Cvc3Exception; 330 private static native Object jniForallExpr3(Object ValidityChecker, Object[] ExprVars, Object ExprBody, Object[] ExprTriggers)331 jniForallExpr3(Object ValidityChecker, Object[] ExprVars, Object ExprBody, 332 Object[] ExprTriggers) throws Cvc3Exception; 333 private static native Object jniForallExpr4(Object ValidityChecker, Object[] ExprVars, Object ExprBody, Object[][] ExprTriggers)334 jniForallExpr4(Object ValidityChecker, Object[] ExprVars, Object ExprBody, 335 Object[][] ExprTriggers) throws Cvc3Exception; 336 private static native void jniSetTrigger(Object ValidityChecker, Object ExprClosure, Object ExprTrigger)337 jniSetTrigger(Object ValidityChecker, Object ExprClosure, Object ExprTrigger) throws Cvc3Exception; 338 private static native void jniSetTriggers(Object ValidityChecker, Object ExprClosure, Object[] ExprTriggers)339 jniSetTriggers(Object ValidityChecker, Object ExprClosure, Object[] ExprTriggers) throws Cvc3Exception; 340 private static native void jniSetTriggers2(Object ValidityChecker, Object ExprClosure, Object[][] ExprTriggers)341 jniSetTriggers2(Object ValidityChecker, Object ExprClosure, Object[][] ExprTriggers) throws Cvc3Exception; 342 private static native void jniSetMultiTrigger(Object ValidityChecker, Object ExprClosure, Object[] ExprMultiTrigger)343 jniSetMultiTrigger(Object ValidityChecker, Object ExprClosure, Object[] ExprMultiTrigger) throws Cvc3Exception; 344 private static native Object jniExistsExpr(Object ValidityChecker, Object[] ExprVars, Object ExprBody)345 jniExistsExpr(Object ValidityChecker, Object[] ExprVars, Object ExprBody) throws Cvc3Exception; 346 private static native Object jniLambdaExpr(Object ValidityChecker, Object[] ExprVars, Object ExprBody)347 jniLambdaExpr(Object ValidityChecker, Object[] ExprVars, Object ExprBody) throws Cvc3Exception; 348 private static native Object jniTransClosure(Object ValidityChecker, Object Op)349 jniTransClosure(Object ValidityChecker, Object Op) throws Cvc3Exception; 350 private static native Object jniSimulateExpr(Object ValidityChecker, Object ExprF, Object ExprS, Object[] ExprInputs, Object ExprN)351 jniSimulateExpr(Object ValidityChecker, Object ExprF, Object ExprS, 352 Object[] ExprInputs, Object ExprN) throws Cvc3Exception; 353 354 private static native void jniSetResourceLimit(Object ValidityChecker, int limit)355 jniSetResourceLimit(Object ValidityChecker, int limit) throws Cvc3Exception; 356 private static native void jniAssertFormula(Object ValidityChecker, Object Expr)357 jniAssertFormula(Object ValidityChecker, Object Expr) throws Cvc3Exception; 358 private static native void jniRegisterAtom(Object ValidityChecker, Object Expr)359 jniRegisterAtom(Object ValidityChecker, Object Expr) throws Cvc3Exception; 360 private static native Object jniGetImpliedLiteral(Object ValidityChecker)361 jniGetImpliedLiteral(Object ValidityChecker) throws Cvc3Exception; 362 private static native Object jniSimplify(Object ValidityChecker, Object Expr)363 jniSimplify(Object ValidityChecker, Object Expr) throws Cvc3Exception; 364 private static native String jniQuery(Object ValidityChecker, Object Expr)365 jniQuery(Object ValidityChecker, Object Expr) throws Cvc3Exception; 366 private static native String jniCheckUnsat(Object ValidityChecker, Object Expr)367 jniCheckUnsat(Object ValidityChecker, Object Expr) throws Cvc3Exception; 368 private static native String jniCheckContinue(Object ValidityChecker)369 jniCheckContinue(Object ValidityChecker) throws Cvc3Exception; 370 private static native String jniRestart(Object ValidityChecker, Object Expr)371 jniRestart(Object ValidityChecker, Object Expr) throws Cvc3Exception; 372 private static native void jniReturnFromCheck(Object ValidityChecker)373 jniReturnFromCheck(Object ValidityChecker) throws Cvc3Exception; 374 private static native Object[] jniGetUserAssumptions(Object ValidityChecker)375 jniGetUserAssumptions(Object ValidityChecker) throws Cvc3Exception; 376 private static native Object[] jniGetInternalAssumptions(Object ValidityChecker)377 jniGetInternalAssumptions(Object ValidityChecker) throws Cvc3Exception; 378 private static native Object[] jniGetAssumptions(Object ValidityChecker)379 jniGetAssumptions(Object ValidityChecker) throws Cvc3Exception; 380 private static native Object[] jniGetAssumptionsUsed(Object ValidityChecker)381 jniGetAssumptionsUsed(Object ValidityChecker) throws Cvc3Exception; 382 private static native Object[] jniGetCounterExample(Object ValidityChecker, boolean inOrder)383 jniGetCounterExample(Object ValidityChecker, boolean inOrder) throws Cvc3Exception; 384 private static native Object[] jniGetConcreteModel(Object ValidityChecker)385 jniGetConcreteModel(Object ValidityChecker) throws Cvc3Exception; 386 private static native String jniGetValue(Object ValidityChecker, Object Expr)387 jniGetValue(Object ValidityChecker, Object Expr) throws Cvc3Exception; 388 private static native boolean jniInconsistent1(Object ValidityChecker)389 jniInconsistent1(Object ValidityChecker) throws Cvc3Exception; 390 private static native Object[] jniInconsistent2(Object ValidityChecker)391 jniInconsistent2(Object ValidityChecker) throws Cvc3Exception; 392 private static native boolean jniIncomplete1(Object ValidityChecker)393 jniIncomplete1(Object ValidityChecker) throws Cvc3Exception; 394 private static native Object[] jniIncomplete2(Object ValidityChecker)395 jniIncomplete2(Object ValidityChecker) throws Cvc3Exception; 396 private static native Object jniGetProof(Object ValidityChecker)397 jniGetProof(Object ValidityChecker) throws Cvc3Exception; 398 private static native Object jniGetTCC(Object ValidityChecker)399 jniGetTCC(Object ValidityChecker) throws Cvc3Exception; 400 private static native Object[] jniGetAssumptionsTCC(Object ValidityChecker)401 jniGetAssumptionsTCC(Object ValidityChecker) throws Cvc3Exception; 402 private static native Object jniGetProofTCC(Object ValidityChecker)403 jniGetProofTCC(Object ValidityChecker) throws Cvc3Exception; 404 private static native Object jniGetClosure(Object ValidityChecker)405 jniGetClosure(Object ValidityChecker) throws Cvc3Exception; 406 private static native Object jniGetProofClosure(Object ValidityChecker)407 jniGetProofClosure(Object ValidityChecker) throws Cvc3Exception; 408 409 private static native int jniStackLevel(Object ValidityChecker)410 jniStackLevel(Object ValidityChecker) throws Cvc3Exception; 411 private static native void jniPush(Object ValidityChecker)412 jniPush(Object ValidityChecker) throws Cvc3Exception; 413 private static native void jniPop(Object ValidityChecker)414 jniPop(Object ValidityChecker) throws Cvc3Exception; 415 private static native void jniPopTo(Object ValidityChecker, int stackLevel)416 jniPopTo(Object ValidityChecker, int stackLevel) throws Cvc3Exception; 417 private static native int jniScopeLevel(Object ValidityChecker)418 jniScopeLevel(Object ValidityChecker) throws Cvc3Exception; 419 private static native void jniPushScope(Object ValidityChecker)420 jniPushScope(Object ValidityChecker) throws Cvc3Exception; 421 private static native void jniPopScope(Object ValidityChecker)422 jniPopScope(Object ValidityChecker) throws Cvc3Exception; 423 private static native void jniPopToScope(Object ValidityChecker, int scopeLevel)424 jniPopToScope(Object ValidityChecker, int scopeLevel) throws Cvc3Exception; 425 private static native Object jniGetCurrentContext(Object ValidityChecker)426 jniGetCurrentContext(Object ValidityChecker) throws Cvc3Exception; 427 428 private static native void jniLoadFile1(Object ValidityChecker, String fileName, String lang)429 jniLoadFile1(Object ValidityChecker, String fileName, String lang) throws Cvc3Exception; 430 431 private static native Object jniGetStatistics(Object ValidityChecker)432 jniGetStatistics(Object ValidityChecker) throws Cvc3Exception; 433 private static native void jniPrintStatistics(Object ValidityChecker)434 jniPrintStatistics(Object ValidityChecker) throws Cvc3Exception; 435 436 private static native void jniSetTimeLimit(Object ValidityChecker, int limit)437 jniSetTimeLimit(Object ValidityChecker, int limit) throws Cvc3Exception; 438 439 440 441 // delete ValidityChecker, all expressions created using it, 442 // and all embedded objects registered with its embeddedManager delete()443 public synchronized void delete() throws Cvc3Exception { 444 if (isDeleted()) return; 445 446 //:TEST: 447 embeddedManager().cleanUp(); 448 449 embeddedManager().delete(); 450 EmbeddedManager.jniDelete(embedded()); 451 d_embedded = null; 452 } 453 454 // ensure that all embedded objects are deallocated eventually finalize()455 public void finalize() throws Throwable { 456 try { 457 if (!isDeleted()) { 458 assert(false); 459 // System.out.println("ValidityChecker.Finalizer: should never be called"); 460 throw new Error("ValidityChecker.Finalizer: should never be called"); 461 } 462 } finally { 463 super.finalize(); 464 } 465 } 466 467 /// Constructor 468 469 // create embedded object ValidityChecker(Object ValidityChecker)470 protected ValidityChecker(Object ValidityChecker) { 471 super(ValidityChecker, new EmbeddedManager()); 472 } 473 474 475 /// API: ValidityChecker 476 477 478 // Creation 479 480 // delete must be called before ValidityChecker is garbage collected create()481 public static ValidityChecker create() throws Cvc3Exception { 482 return new ValidityChecker(jniCreate1()); 483 } 484 485 // delete must be called before ValidityChecker is garbage collected create(Flags flags)486 public static ValidityChecker create(Flags flags) throws Cvc3Exception { 487 return new ValidityChecker(jniCreate2(flags.embedded())); 488 } 489 490 491 // Flags 492 493 // if embeddedManger is null then delete must be called before 494 // the returned Flags is garbage collected createFlags(EmbeddedManager embeddedManager)495 public static FlagsMut createFlags(EmbeddedManager embeddedManager) throws Cvc3Exception { 496 return new FlagsMut(jniCreateFlags(), embeddedManager); 497 } 498 getFlags()499 public FlagsMut getFlags() throws Cvc3Exception { 500 return new FlagsMut(jniGetFlags(embedded()), embeddedManager()); 501 } 502 503 504 505 // Type-related methods 506 boolType()507 public TypeMut boolType() throws Cvc3Exception { 508 return new TypeMut(jniBoolType(embedded()), embeddedManager()); 509 } 510 realType()511 public TypeMut realType() throws Cvc3Exception { 512 return new TypeMut(jniRealType(embedded()), embeddedManager()); 513 } 514 intType()515 public TypeMut intType() throws Cvc3Exception { 516 return new TypeMut(jniIntType(embedded()), embeddedManager()); 517 } 518 subrangeType(Expr l, Expr r)519 public TypeMut subrangeType(Expr l, Expr r) throws Cvc3Exception { 520 return new TypeMut( 521 jniSubrangeType(embedded(), l.embedded(), r.embedded()), 522 embeddedManager()); 523 } 524 subtypeType(Expr pred, Expr witness)525 public TypeMut subtypeType(Expr pred, Expr witness) throws Cvc3Exception { 526 return new TypeMut( 527 jniSubtypeType(embedded(), pred.embedded(), witness.embedded()), 528 embeddedManager()); 529 } 530 tupleType(Type type0, Type type1)531 public TypeMut tupleType(Type type0, Type type1) throws Cvc3Exception { 532 return new TypeMut( 533 jniTupleType1(embedded(), type0.embedded(), type1.embedded()), 534 embeddedManager()); 535 } 536 tupleType(Type type0, Type type1, Type type2)537 public TypeMut tupleType(Type type0, Type type1, Type type2) throws Cvc3Exception { 538 return new TypeMut( 539 jniTupleType2(embedded(), type0.embedded(), type1.embedded(), type2.embedded()), 540 embeddedManager()); 541 } 542 tupleType(List types)543 public TypeMut tupleType(List types) throws Cvc3Exception { 544 return new TypeMut( 545 jniTupleType3(embedded(), JniUtils.unembedList(types)), 546 embeddedManager()); 547 } 548 recordType(String field, Type type)549 public TypeMut recordType(String field, Type type) throws Cvc3Exception { 550 return new TypeMut( 551 jniRecordType1(embedded(), field, type.embedded()), 552 embeddedManager()); 553 } 554 recordType(String field0, Type type0, String field1, Type type1)555 public TypeMut recordType(String field0, Type type0, String field1, Type type1) throws Cvc3Exception { 556 return new TypeMut( 557 jniRecordType2(embedded(), field0, type0.embedded(), field1, type1.embedded()), 558 embeddedManager()); 559 } 560 recordType(String field0, Type type0, String field1, Type type1, String field2, Type type2)561 public TypeMut recordType(String field0, Type type0, String field1, Type type1, 562 String field2, Type type2) throws Cvc3Exception { 563 return new TypeMut( 564 jniRecordType3(embedded(), field0, type0.embedded(), field1, type1.embedded(), 565 field2, type2.embedded()), 566 embeddedManager()); 567 } 568 recordType(List fields, List types)569 public TypeMut recordType(List fields, List types) throws Cvc3Exception { 570 assert(JniUtils.listInstanceof(fields, String.class)); 571 return new TypeMut( 572 jniRecordType4(embedded(), JniUtils.toArray(fields), JniUtils.unembedList(types)), 573 embeddedManager()); 574 } 575 dataType(String name, String constructor, List selectors, List types)576 public TypeMut dataType(String name, String constructor, 577 List selectors, List types) throws Cvc3Exception { 578 assert(JniUtils.listInstanceof(selectors, String.class)); 579 assert(JniUtils.listInstanceof(types, Expr.class)); 580 return new TypeMut( 581 jniDataType1(embedded(), name, constructor, 582 JniUtils.toArray(selectors), JniUtils.unembedList(types)), 583 embeddedManager()); 584 } 585 dataType(String name, String[] constructors, String[][] selectors, Expr[][] types)586 public TypeMut dataType(String name, String[] constructors, 587 String[][] selectors, Expr[][] types) throws Cvc3Exception { 588 return new TypeMut( 589 jniDataType2(embedded(), name, constructors, selectors, JniUtils.unembedArrayArray(types)), 590 embeddedManager()); 591 } 592 dataType(String name, List constructors, List selectors, List types)593 public TypeMut dataType(String name, List constructors, 594 List selectors, List types) throws Cvc3Exception { 595 assert(JniUtils.listInstanceof(constructors, String.class)); 596 assert(JniUtils.listListInstanceof(selectors, String.class)); 597 assert(JniUtils.listListInstanceof(types, Expr.class)); 598 return new TypeMut( 599 jniDataType2(embedded(), name, JniUtils.toArray(constructors), 600 JniUtils.toArrayArray(selectors), JniUtils.unembedListList(types)), 601 embeddedManager()); 602 } 603 dataType(List names, List constructors, List selectors, List types)604 public List dataType(List names, List constructors, 605 List selectors, List types) throws Cvc3Exception { 606 assert(JniUtils.listInstanceof(names, String.class)); 607 assert(JniUtils.listListInstanceof(constructors, String.class)); 608 assert(JniUtils.listListListInstanceof(selectors, String.class)); 609 assert(JniUtils.listListListInstanceof(types, Expr.class)); 610 Object[] dataTypes = 611 jniDataType3(embedded(), JniUtils.toArray(names), JniUtils.toArrayArray(constructors), 612 JniUtils.toArrayArrayArray(selectors), JniUtils.unembedListListList(types)); 613 return JniUtils.embedList(dataTypes, TypeMut.class, embeddedManager()); 614 } 615 arrayLiteral(Expr var, Expr body)616 public ExprMut arrayLiteral(Expr var, Expr body) throws Cvc3Exception { 617 return new ExprMut(jniArrayLiteral(embedded(), var.embedded(), body.embedded()),embeddedManager()); 618 } 619 anyType()620 public TypeMut anyType() throws Cvc3Exception { 621 return new TypeMut(jniAnyType(embedded()),embeddedManager()); 622 } 623 arrayType(Type typeIndex, Type typeData)624 public TypeMut arrayType(Type typeIndex, Type typeData) throws Cvc3Exception { 625 return new TypeMut( 626 jniArrayType(embedded(), typeIndex.embedded(), typeData.embedded()), 627 embeddedManager()); 628 } 629 bitvecType(int n)630 public TypeMut bitvecType(int n) throws Cvc3Exception { 631 return new TypeMut( 632 jniBitvecType(embedded(), n), 633 embeddedManager()); 634 } 635 funType(Type typeDom, Type typeRange)636 public TypeMut funType(Type typeDom, Type typeRange) throws Cvc3Exception { 637 return new TypeMut( 638 jniFunType1(embedded(), typeDom.embedded(), typeRange.embedded()), 639 embeddedManager()); 640 } 641 funType(List typeDom, Type typeRange)642 public TypeMut funType(List typeDom, Type typeRange) throws Cvc3Exception { 643 assert(JniUtils.listInstanceof(typeDom, Type.class)); 644 return new TypeMut( 645 jniFunType2(embedded(), JniUtils.unembedList(typeDom), typeRange.embedded()), 646 embeddedManager()); 647 } 648 createType(String typeName)649 public TypeMut createType(String typeName) throws Cvc3Exception { 650 return new TypeMut( 651 jniCreateType1(embedded(), typeName), 652 embeddedManager()); 653 } 654 createType(String typeName, Type typeDef)655 public TypeMut createType(String typeName, Type typeDef) throws Cvc3Exception { 656 return new TypeMut( 657 jniCreateType2(embedded(), typeName, typeDef.embedded()), 658 embeddedManager()); 659 } 660 lookupType(String typeName)661 public TypeMut lookupType(String typeName) throws Cvc3Exception { 662 return new TypeMut( 663 jniLookupType(embedded(), typeName), 664 embeddedManager()); 665 } 666 667 668 669 // Expressions 670 getExprManager()671 public ExprManagerMut getExprManager() throws Cvc3Exception { 672 return new ExprManagerMut(jniGetExprManager(embedded()), embeddedManager()); 673 } 674 nullExpr()675 public Expr nullExpr() throws Cvc3Exception { 676 return new Expr(jniNullExpr(embedded()), embeddedManager()); 677 } 678 varExpr(String name, Type type)679 public ExprMut varExpr(String name, Type type) throws Cvc3Exception { 680 return new ExprMut( 681 jniVarExpr1(embedded(), name, type.embedded()), 682 embeddedManager()); 683 } 684 varExpr(String name, Type type, Expr def)685 public ExprMut varExpr(String name, Type type, Expr def) throws Cvc3Exception { 686 return new ExprMut( 687 jniVarExpr2(embedded(), name, type.embedded(), def.embedded()), 688 embeddedManager()); 689 } 690 boundVarExpr(String name, String uid, Type type)691 public ExprMut boundVarExpr(String name, String uid, Type type) throws Cvc3Exception { 692 return new ExprMut( 693 jniBoundVarExpr(embedded(), name, uid, type.embedded()), 694 embeddedManager()); 695 } 696 697 /* public ExprMut boundVarExpr(Type type) throws Cvc3Exception { 698 return new ExprMut( 699 jniBoundVarExpr(embedded(), type.embedded()), 700 embeddedManager()); 701 }*/ 702 lookupVar(String name)703 public ExprMut lookupVar(String name) throws Cvc3Exception { 704 return new ExprMut( 705 jniLookupVar(embedded(), name), 706 embeddedManager()); 707 } 708 lookupOp(String name)709 public OpMut lookupOp(String name) throws Cvc3Exception { 710 return new OpMut( 711 jniLookupOp(embedded(), name), 712 embeddedManager()); 713 } 714 getType(Expr expr)715 public TypeMut getType(Expr expr) throws Cvc3Exception { 716 return new TypeMut( 717 jniGetType(embedded(), expr.embedded()), 718 embeddedManager()); 719 } 720 getBaseType(Expr expr)721 public TypeMut getBaseType(Expr expr) throws Cvc3Exception { 722 return new TypeMut( 723 jniGetBaseType1(embedded(), expr.embedded()), 724 embeddedManager()); 725 } 726 getBaseType(Type type)727 public TypeMut getBaseType(Type type) throws Cvc3Exception { 728 return new TypeMut( 729 jniGetBaseType2(embedded(), type.embedded()), 730 embeddedManager()); 731 } 732 getTypePred(Type type, Expr expr)733 public ExprMut getTypePred(Type type, Expr expr) throws Cvc3Exception { 734 return new ExprMut( 735 jniGetTypePred(embedded(), type.embedded(), expr.embedded()), 736 embeddedManager()); 737 } 738 stringExpr(String str)739 public ExprMut stringExpr(String str) throws Cvc3Exception { 740 return new ExprMut( 741 jniStringExpr(embedded(), str), 742 embeddedManager()); 743 } 744 idExpr(String name)745 public ExprMut idExpr(String name) throws Cvc3Exception { 746 return new ExprMut( 747 jniIdExpr(embedded(), name), 748 embeddedManager()); 749 } 750 listExpr(List kids)751 public ExprMut listExpr(List kids) throws Cvc3Exception { 752 assert(JniUtils.listInstanceof(kids, Expr.class)); 753 return new ExprMut( 754 jniListExpr1(embedded(), JniUtils.unembedList(kids)), 755 embeddedManager()); 756 } 757 listExpr(Expr expr1)758 public ExprMut listExpr(Expr expr1) throws Cvc3Exception { 759 return new ExprMut( 760 jniListExpr2(embedded(), expr1.embedded()), 761 embeddedManager()); 762 } 763 listExpr(Expr expr1, Expr expr2)764 public ExprMut listExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 765 return new ExprMut( 766 jniListExpr3(embedded(), expr1.embedded(), expr2.embedded()), 767 embeddedManager()); 768 } 769 listExpr(Expr expr1, Expr expr2, Expr expr3)770 public ExprMut listExpr(Expr expr1, Expr expr2, Expr expr3) throws Cvc3Exception { 771 return new ExprMut( 772 jniListExpr4(embedded(), expr1.embedded(), expr2.embedded(), expr3.embedded()), 773 embeddedManager()); 774 } 775 listExpr(String op, List kids)776 public ExprMut listExpr(String op, List kids) throws Cvc3Exception { 777 assert(JniUtils.listInstanceof(kids, Expr.class)); 778 return new ExprMut( 779 jniListExpr5(embedded(), op, JniUtils.unembedList(kids)), 780 embeddedManager()); 781 } 782 listExpr(String op, Expr expr1)783 public ExprMut listExpr(String op, Expr expr1) throws Cvc3Exception { 784 return new ExprMut( 785 jniListExpr6(embedded(), op, expr1.embedded()), 786 embeddedManager()); 787 } 788 listExpr(String op, Expr expr1, Expr expr2)789 public ExprMut listExpr(String op, Expr expr1, Expr expr2) throws Cvc3Exception { 790 return new ExprMut( 791 jniListExpr7(embedded(), op, expr1.embedded(), expr2.embedded()), 792 embeddedManager()); 793 } 794 listExpr(String op, Expr expr1, Expr expr2, Expr expr3)795 public ExprMut listExpr(String op, Expr expr1, Expr expr2, Expr expr3) throws Cvc3Exception { 796 return new ExprMut( 797 jniListExpr8(embedded(), op, expr1.embedded(), expr2.embedded(), expr3.embedded()), 798 embeddedManager()); 799 } 800 printExpr(Expr expr)801 public void printExpr(Expr expr) throws Cvc3Exception { 802 jniPrintExpr(embedded(), expr.embedded()); 803 } 804 parseExpr(Expr expr)805 public ExprMut parseExpr(Expr expr) throws Cvc3Exception { 806 return new ExprMut( 807 jniParseExpr(embedded(), expr.embedded()), 808 embeddedManager()); 809 } 810 parseType(Expr expr)811 public TypeMut parseType(Expr expr) throws Cvc3Exception { 812 return new TypeMut( 813 jniParseType(embedded(), expr.embedded()), 814 embeddedManager()); 815 } 816 importExpr(Expr expr)817 public ExprMut importExpr(Expr expr) throws Cvc3Exception { 818 return new ExprMut( 819 jniImportExpr(embedded(), expr.embedded()), 820 embeddedManager()); 821 } 822 importType(Type type)823 public TypeMut importType(Type type) throws Cvc3Exception { 824 return new TypeMut( 825 jniImportType(embedded(), type.embedded()), 826 embeddedManager()); 827 } 828 cmdsFromString(String s)829 public void cmdsFromString(String s) throws Cvc3Exception { 830 jniCmdsFromString(embedded(), s); 831 } 832 exprFromString(String s)833 public ExprMut exprFromString(String s) throws Cvc3Exception { 834 return new ExprMut( jniExprFromString(embedded(), s), embeddedManager() ); 835 } 836 837 trueExpr()838 public ExprMut trueExpr() throws Cvc3Exception { 839 return new ExprMut(jniTrueExpr(embedded()), embeddedManager()); 840 } 841 falseExpr()842 public ExprMut falseExpr() throws Cvc3Exception { 843 return new ExprMut(jniFalseExpr(embedded()), embeddedManager()); 844 } 845 notExpr(Expr expr)846 public ExprMut notExpr(Expr expr) throws Cvc3Exception { 847 return new ExprMut( 848 jniNotExpr(embedded(), expr.embedded()), 849 embeddedManager()); 850 } 851 andExpr(Expr expr1, Expr expr2)852 public ExprMut andExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 853 return new ExprMut( 854 jniAndExpr1(embedded(), expr1.embedded(), expr2.embedded()), 855 embeddedManager()); 856 } 857 andExpr(List children)858 public ExprMut andExpr(List children) throws Cvc3Exception { 859 assert(JniUtils.listInstanceof(children, Expr.class)); 860 return new ExprMut( 861 jniAndExpr2(embedded(), JniUtils.unembedList(children)), 862 embeddedManager()); 863 } 864 orExpr(Expr expr1, Expr expr2)865 public ExprMut orExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 866 return new ExprMut( 867 jniOrExpr1(embedded(), expr1.embedded(), expr2.embedded()), 868 embeddedManager()); 869 } 870 orExpr(List children)871 public ExprMut orExpr(List children) throws Cvc3Exception { 872 assert(JniUtils.listInstanceof(children, Expr.class)); 873 return new ExprMut( 874 jniOrExpr2(embedded(), JniUtils.unembedList(children)), 875 embeddedManager()); 876 } 877 impliesExpr(Expr hyp, Expr conc)878 public ExprMut impliesExpr(Expr hyp, Expr conc) throws Cvc3Exception { 879 return new ExprMut( 880 jniImpliesExpr(embedded(), hyp.embedded(), conc.embedded()), 881 embeddedManager()); 882 } 883 iffExpr(Expr left, Expr right)884 public ExprMut iffExpr(Expr left, Expr right) throws Cvc3Exception { 885 return new ExprMut( 886 jniIffExpr(embedded(), left.embedded(), right.embedded()), 887 embeddedManager()); 888 } 889 eqExpr(Expr left, Expr right)890 public ExprMut eqExpr(Expr left, Expr right) throws Cvc3Exception { 891 return new ExprMut( 892 jniEqExpr(embedded(), left.embedded(), right.embedded()), 893 embeddedManager()); 894 } 895 distinctExpr(List children)896 public ExprMut distinctExpr(List children) throws Cvc3Exception { 897 assert(JniUtils.listInstanceof(children, Expr.class)); 898 return new ExprMut( 899 jniDistinctExpr(embedded(), JniUtils.unembedList(children)), embeddedManager()); 900 } 901 iteExpr(Expr ifPart, Expr thenPart, Expr elsePart)902 public ExprMut iteExpr(Expr ifPart, Expr thenPart, Expr elsePart) throws Cvc3Exception { 903 return new ExprMut( 904 jniIteExpr(embedded(), ifPart.embedded(), thenPart.embedded(), elsePart.embedded()), 905 embeddedManager()); 906 } 907 createOp(String name, Type type)908 public OpMut createOp(String name, Type type) throws Cvc3Exception { 909 return new OpMut( 910 jniCreateOp1(embedded(), name, type.embedded()), 911 embeddedManager()); 912 } 913 createOp(String name, Type type, Expr expr)914 public OpMut createOp(String name, Type type, Expr expr) throws Cvc3Exception { 915 return new OpMut( 916 jniCreateOp2(embedded(), name, type.embedded(), expr.embedded()), 917 embeddedManager()); 918 } 919 920 // '=' eqOp()921 public OpMut eqOp() throws Cvc3Exception { 922 return new OpMut(jniEqOp(), embeddedManager()); 923 } 924 925 // '<' ltOp()926 public OpMut ltOp() throws Cvc3Exception { 927 return new OpMut(jniLtOp(), embeddedManager()); 928 } 929 930 // '<=' leOp()931 public OpMut leOp() throws Cvc3Exception { 932 return new OpMut(jniLeOp(), embeddedManager()); 933 } 934 935 // '>' gtOp()936 public OpMut gtOp() throws Cvc3Exception { 937 return new OpMut(jniGtOp(), embeddedManager()); 938 } 939 940 // '>=' geOp()941 public OpMut geOp() throws Cvc3Exception { 942 return new OpMut(jniGeOp(), embeddedManager()); 943 } 944 945 // '+' plusOp()946 public OpMut plusOp() throws Cvc3Exception { 947 return new OpMut(jniPlusOp(), embeddedManager()); 948 } 949 950 // '-' minusOp()951 public OpMut minusOp() throws Cvc3Exception { 952 return new OpMut(jniMinusOp(), embeddedManager()); 953 } 954 955 // '*' multOp()956 public OpMut multOp() throws Cvc3Exception { 957 return new OpMut(jniMultOp(), embeddedManager()); 958 } 959 960 // '/' for rationals divideOp()961 public OpMut divideOp() throws Cvc3Exception { 962 return new OpMut(jniDivideOp(), embeddedManager()); 963 } 964 funExpr(Op op, Expr expr1)965 public ExprMut funExpr(Op op, Expr expr1) throws Cvc3Exception { 966 return new ExprMut( 967 jniFunExpr1(embedded(), op.embedded(), expr1.embedded()), 968 embeddedManager()); 969 } 970 funExpr(Op op, Expr expr1, Expr expr2)971 public ExprMut funExpr(Op op, Expr expr1, Expr expr2) throws Cvc3Exception { 972 return new ExprMut( 973 jniFunExpr2(embedded(), op.embedded(), expr1.embedded(), expr2.embedded()), 974 embeddedManager()); 975 } 976 funExpr(Op op, Expr expr1, Expr expr2, Expr expr3)977 public ExprMut funExpr(Op op, Expr expr1, Expr expr2, Expr expr3) throws Cvc3Exception { 978 return new ExprMut( 979 jniFunExpr3(embedded(), op.embedded(), expr1.embedded(), expr2.embedded(), expr3.embedded()), 980 embeddedManager()); 981 } 982 funExpr(Op op, List children)983 public ExprMut funExpr(Op op, List children) throws Cvc3Exception { 984 assert(JniUtils.listInstanceof(children, Expr.class)); 985 return new ExprMut( 986 jniFunExpr4(embedded(), op.embedded(), JniUtils.unembedList(children)), 987 embeddedManager()); 988 } 989 ratExpr(int n)990 public ExprMut ratExpr(int n) throws Cvc3Exception { 991 return ratExpr(n, 1); 992 } 993 ratExpr(int n, int d)994 public ExprMut ratExpr(int n, int d) throws Cvc3Exception { 995 return new ExprMut( 996 jniRatExpr1(embedded(), n, d), 997 embeddedManager()); 998 } 999 ratExpr(String n, String d, int base)1000 public ExprMut ratExpr(String n, String d, int base) throws Cvc3Exception { 1001 return new ExprMut( 1002 jniRatExpr2(embedded(), n, d, base), 1003 embeddedManager()); 1004 } 1005 ratExpr(String n)1006 public ExprMut ratExpr(String n) throws Cvc3Exception { 1007 return ratExpr(n, 10); 1008 } 1009 ratExpr(String n, int base)1010 public ExprMut ratExpr(String n, int base) throws Cvc3Exception { 1011 return new ExprMut( 1012 jniRatExpr3(embedded(), n, base), 1013 embeddedManager()); 1014 } 1015 uminusExpr(Expr expr)1016 public ExprMut uminusExpr(Expr expr) throws Cvc3Exception { 1017 return new ExprMut( 1018 jniUminusExpr(embedded(), expr.embedded()), 1019 embeddedManager()); 1020 } 1021 plusExpr(Expr left, Expr right)1022 public ExprMut plusExpr(Expr left, Expr right) throws Cvc3Exception { 1023 return new ExprMut( 1024 jniPlusExpr1(embedded(), left.embedded(), right.embedded()), 1025 embeddedManager()); 1026 } 1027 plusExpr(List kids)1028 public ExprMut plusExpr(List kids) throws Cvc3Exception { 1029 return new ExprMut( 1030 jniPlusExpr2(embedded(), JniUtils.unembedList(kids)), 1031 embeddedManager()); 1032 } 1033 minusExpr(Expr left, Expr right)1034 public ExprMut minusExpr(Expr left, Expr right) throws Cvc3Exception { 1035 return new ExprMut( 1036 jniMinusExpr(embedded(), left.embedded(), right.embedded()), 1037 embeddedManager()); 1038 } 1039 multExpr(Expr left, Expr right)1040 public ExprMut multExpr(Expr left, Expr right) throws Cvc3Exception { 1041 return new ExprMut( 1042 jniMultExpr(embedded(), left.embedded(), right.embedded()), 1043 embeddedManager()); 1044 } 1045 powExpr(Expr x, Expr n)1046 public ExprMut powExpr(Expr x, Expr n) throws Cvc3Exception { 1047 return new ExprMut( 1048 jniPowExpr(embedded(), x.embedded(), n.embedded()), 1049 embeddedManager()); 1050 } 1051 divideExpr(Expr numerator, Expr denominator)1052 public ExprMut divideExpr(Expr numerator, Expr denominator) throws Cvc3Exception { 1053 return new ExprMut( 1054 jniDivideExpr(embedded(), numerator.embedded(), denominator.embedded()), 1055 embeddedManager()); 1056 } 1057 ltExpr(Expr left, Expr right)1058 public ExprMut ltExpr(Expr left, Expr right) throws Cvc3Exception { 1059 return new ExprMut( 1060 jniLtExpr(embedded(), left.embedded(), right.embedded()), 1061 embeddedManager()); 1062 } 1063 leExpr(Expr left, Expr right)1064 public ExprMut leExpr(Expr left, Expr right) throws Cvc3Exception { 1065 return new ExprMut( 1066 jniLeExpr(embedded(), left.embedded(), right.embedded()), 1067 embeddedManager()); 1068 } 1069 gtExpr(Expr left, Expr right)1070 public ExprMut gtExpr(Expr left, Expr right) throws Cvc3Exception { 1071 return new ExprMut( 1072 jniGtExpr(embedded(), left.embedded(), right.embedded()), 1073 embeddedManager()); 1074 } 1075 geExpr(Expr left, Expr right)1076 public ExprMut geExpr(Expr left, Expr right) throws Cvc3Exception { 1077 return new ExprMut( 1078 jniGeExpr(embedded(), left.embedded(), right.embedded()), 1079 embeddedManager()); 1080 } 1081 recordExpr(String field, Expr expr)1082 public ExprMut recordExpr(String field, Expr expr) throws Cvc3Exception { 1083 return new ExprMut( 1084 jniRecordExpr1(embedded(), field, expr.embedded()), 1085 embeddedManager()); 1086 } 1087 recordExpr(String field1, Expr expr1, String field2, Expr expr2)1088 public ExprMut recordExpr(String field1, Expr expr1, String field2, Expr expr2) throws Cvc3Exception { 1089 return new ExprMut( 1090 jniRecordExpr2(embedded(), field1, expr1.embedded(), field2, expr2.embedded()), 1091 embeddedManager()); 1092 } 1093 recordExpr(String field1, Expr expr1, String field2, Expr expr2, String field3, Expr expr3)1094 public ExprMut recordExpr(String field1, Expr expr1, String field2, Expr expr2, 1095 String field3, Expr expr3) throws Cvc3Exception { 1096 return new ExprMut( 1097 jniRecordExpr3(embedded(), field1, expr1.embedded(), field2, expr2.embedded(), 1098 field3, expr3.embedded()), 1099 embeddedManager()); 1100 } 1101 recordExpr(List fields, List exprs)1102 public ExprMut recordExpr(List fields, List exprs) throws Cvc3Exception { 1103 assert(JniUtils.listInstanceof(fields, String.class)); 1104 assert(JniUtils.listInstanceof(exprs, Expr.class)); 1105 return new ExprMut( 1106 jniRecordExpr4(embedded(), JniUtils.toArray(fields), JniUtils.unembedList(exprs)), 1107 embeddedManager()); 1108 } 1109 recSelectExpr(Expr record, String field)1110 public ExprMut recSelectExpr(Expr record, String field) throws Cvc3Exception { 1111 return new ExprMut( 1112 jniRecSelectExpr(embedded(), record.embedded(), field), 1113 embeddedManager()); 1114 } 1115 recUpdateExpr(Expr record, String field, Expr newValue)1116 public ExprMut recUpdateExpr(Expr record, String field, Expr newValue) throws Cvc3Exception { 1117 return new ExprMut( 1118 jniRecUpdateExpr(embedded(), record.embedded(), field, newValue.embedded()), 1119 embeddedManager()); 1120 } 1121 readExpr(Expr array, Expr index)1122 public ExprMut readExpr(Expr array, Expr index) throws Cvc3Exception { 1123 return new ExprMut( 1124 jniReadExpr(embedded(), array.embedded(), index.embedded()), 1125 embeddedManager()); 1126 } 1127 writeExpr(Expr array, Expr index, Expr newValue)1128 public ExprMut writeExpr(Expr array, Expr index, Expr newValue) throws Cvc3Exception { 1129 return new ExprMut( 1130 jniWriteExpr(embedded(), array.embedded(), index.embedded(), newValue.embedded()), 1131 embeddedManager()); 1132 } 1133 newBVConstExpr(String s)1134 public ExprMut newBVConstExpr(String s) throws Cvc3Exception { 1135 return newBVConstExpr(s, 2); 1136 } 1137 newBVConstExpr(String s, int base)1138 public ExprMut newBVConstExpr(String s, int base) throws Cvc3Exception { 1139 return new ExprMut( 1140 jniNewBVConstExpr1(embedded(), s, base), 1141 embeddedManager()); 1142 } 1143 newBVConstExpr(boolean[] bits)1144 public ExprMut newBVConstExpr(boolean[] bits) throws Cvc3Exception { 1145 return new ExprMut( 1146 jniNewBVConstExpr2(embedded(), bits), 1147 embeddedManager()); 1148 } 1149 newBVConstExpr(Rational r, int len)1150 public ExprMut newBVConstExpr(Rational r, int len) throws Cvc3Exception { 1151 return new ExprMut( 1152 jniNewBVConstExpr3(embedded(), r.embedded(), len), 1153 embeddedManager()); 1154 } 1155 newConcatExpr(Expr expr1, Expr expr2)1156 public ExprMut newConcatExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1157 return new ExprMut( 1158 jniNewConcatExpr1(embedded(), expr1.embedded(), expr2.embedded()), 1159 embeddedManager()); 1160 } 1161 newConcatExpr(List kids)1162 public ExprMut newConcatExpr(List kids) throws Cvc3Exception { 1163 assert(JniUtils.listInstanceof(kids, Expr.class)); 1164 return new ExprMut( 1165 jniNewConcatExpr2(embedded(), JniUtils.unembedList(kids)), 1166 embeddedManager()); 1167 } 1168 newBVExtractExpr(Expr e, int hi, int low)1169 public ExprMut newBVExtractExpr(Expr e, int hi, int low) throws Cvc3Exception { 1170 return new ExprMut( 1171 jniNewBVExtractExpr(embedded(), e.embedded(), hi, low), 1172 embeddedManager()); 1173 } 1174 newBVNegExpr(Expr expr)1175 public ExprMut newBVNegExpr(Expr expr) throws Cvc3Exception { 1176 return new ExprMut( 1177 jniNewBVNegExpr(embedded(), expr.embedded()), 1178 embeddedManager()); 1179 } 1180 newBVAndExpr(Expr expr1, Expr expr2)1181 public ExprMut newBVAndExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1182 return new ExprMut( 1183 jniNewBVAndExpr1(embedded(), expr1.embedded(), expr2.embedded()), 1184 embeddedManager()); 1185 } 1186 newBVAndExpr(List kids)1187 public ExprMut newBVAndExpr(List kids) throws Cvc3Exception { 1188 assert(JniUtils.listInstanceof(kids, Expr.class)); 1189 return new ExprMut( 1190 jniNewBVAndExpr2(embedded(), JniUtils.unembedList(kids)), 1191 embeddedManager()); 1192 } 1193 newBVOrExpr(Expr expr1, Expr expr2)1194 public ExprMut newBVOrExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1195 return new ExprMut( 1196 jniNewBVOrExpr1(embedded(), expr1.embedded(), expr2.embedded()), 1197 embeddedManager()); 1198 } 1199 newBVOrExpr(List kids)1200 public ExprMut newBVOrExpr(List kids) throws Cvc3Exception { 1201 assert(JniUtils.listInstanceof(kids, Expr.class)); 1202 return new ExprMut( 1203 jniNewBVOrExpr2(embedded(), JniUtils.unembedList(kids)), 1204 embeddedManager()); 1205 } 1206 newBVXorExpr(Expr expr1, Expr expr2)1207 public ExprMut newBVXorExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1208 return new ExprMut( 1209 jniNewBVXorExpr1(embedded(), expr1.embedded(), expr2.embedded()), 1210 embeddedManager()); 1211 } 1212 newBVXorExpr(List kids)1213 public ExprMut newBVXorExpr(List kids) throws Cvc3Exception { 1214 assert(JniUtils.listInstanceof(kids, Expr.class)); 1215 return new ExprMut( 1216 jniNewBVXorExpr2(embedded(), JniUtils.unembedList(kids)), 1217 embeddedManager()); 1218 } 1219 newBVXnorExpr(Expr expr1, Expr expr2)1220 public ExprMut newBVXnorExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1221 return new ExprMut( 1222 jniNewBVXnorExpr1(embedded(), expr1.embedded(), expr2.embedded()), 1223 embeddedManager()); 1224 } 1225 newBVXnorExpr(List kids)1226 public ExprMut newBVXnorExpr(List kids) throws Cvc3Exception { 1227 assert(JniUtils.listInstanceof(kids, Expr.class)); 1228 return new ExprMut( 1229 jniNewBVXnorExpr2(embedded(), JniUtils.unembedList(kids)), 1230 embeddedManager()); 1231 } 1232 newBVNandExpr(Expr expr1, Expr expr2)1233 public ExprMut newBVNandExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1234 return new ExprMut( 1235 jniNewBVNandExpr(embedded(), expr1.embedded(), expr2.embedded()), 1236 embeddedManager()); 1237 } 1238 newBVNorExpr(Expr expr1, Expr expr2)1239 public ExprMut newBVNorExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1240 return new ExprMut( 1241 jniNewBVNorExpr(embedded(), expr1.embedded(), expr2.embedded()), 1242 embeddedManager()); 1243 } 1244 newBVLTExpr(Expr expr1, Expr expr2)1245 public ExprMut newBVLTExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1246 return new ExprMut( 1247 jniNewBVLTExpr(embedded(), expr1.embedded(), expr2.embedded()), 1248 embeddedManager()); 1249 } 1250 newBVLEExpr(Expr expr1, Expr expr2)1251 public ExprMut newBVLEExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1252 return new ExprMut( 1253 jniNewBVLEExpr(embedded(), expr1.embedded(), expr2.embedded()), 1254 embeddedManager()); 1255 } 1256 newBVSLTExpr(Expr expr1, Expr expr2)1257 public ExprMut newBVSLTExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1258 return new ExprMut( 1259 jniNewBVSLTExpr(embedded(), expr1.embedded(), expr2.embedded()), 1260 embeddedManager()); 1261 } 1262 newBVSLEExpr(Expr expr1, Expr expr2)1263 public ExprMut newBVSLEExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1264 return new ExprMut( 1265 jniNewBVSLEExpr(embedded(), expr1.embedded(), expr2.embedded()), 1266 embeddedManager()); 1267 } 1268 newSXExpr(Expr expr, int len)1269 public ExprMut newSXExpr(Expr expr, int len) throws Cvc3Exception { 1270 return new ExprMut( 1271 jniNewSXExpr(embedded(), expr.embedded(), len), 1272 embeddedManager()); 1273 } 1274 newBVUminusExpr(Expr expr)1275 public ExprMut newBVUminusExpr(Expr expr) throws Cvc3Exception { 1276 return new ExprMut( 1277 jniNewBVUminusExpr(embedded(), expr.embedded()), 1278 embeddedManager()); 1279 } 1280 newBVSubExpr(Expr expr1, Expr expr2)1281 public ExprMut newBVSubExpr(Expr expr1, Expr expr2) throws Cvc3Exception { 1282 return new ExprMut( 1283 jniNewBVSubExpr(embedded(), expr1.embedded(), expr2.embedded()), 1284 embeddedManager()); 1285 } 1286 newBVPlusExpr(int numbits, List exprs)1287 public ExprMut newBVPlusExpr(int numbits, List exprs) throws Cvc3Exception { 1288 assert(JniUtils.listInstanceof(exprs, Expr.class)); 1289 return new ExprMut( 1290 jniNewBVPlusExpr(embedded(), numbits, JniUtils.unembedList(exprs)), 1291 embeddedManager()); 1292 } 1293 newBVMultExpr(int numbits, Expr expr1, Expr expr2)1294 public ExprMut newBVMultExpr(int numbits, Expr expr1, Expr expr2) throws Cvc3Exception { 1295 return new ExprMut( 1296 jniNewBVMultExpr(embedded(), numbits, expr1.embedded(), expr2.embedded()), 1297 embeddedManager()); 1298 } 1299 newBVUDivExpr(Expr left, Expr right)1300 public ExprMut newBVUDivExpr(Expr left, Expr right) throws Cvc3Exception { 1301 return new ExprMut( 1302 jniNewBVUDivExpr(embedded(), left.embedded(), right.embedded()), 1303 embeddedManager()); 1304 } 1305 newBVURemExpr(Expr left, Expr right)1306 public ExprMut newBVURemExpr(Expr left, Expr right) throws Cvc3Exception { 1307 return new ExprMut( 1308 jniNewBVURemExpr(embedded(), left.embedded(), right.embedded()), 1309 embeddedManager()); 1310 } 1311 newBVSDivExpr(Expr left, Expr right)1312 public ExprMut newBVSDivExpr(Expr left, Expr right) throws Cvc3Exception { 1313 return new ExprMut( 1314 jniNewBVSDivExpr(embedded(), left.embedded(), right.embedded()), 1315 embeddedManager()); 1316 } 1317 newBVSRemExpr(Expr left, Expr right)1318 public ExprMut newBVSRemExpr(Expr left, Expr right) throws Cvc3Exception { 1319 return new ExprMut( 1320 jniNewBVSRemExpr(embedded(), left.embedded(), right.embedded()), 1321 embeddedManager()); 1322 } 1323 newBVSModExpr(Expr left, Expr right)1324 public ExprMut newBVSModExpr(Expr left, Expr right) throws Cvc3Exception { 1325 return new ExprMut( 1326 jniNewBVSModExpr(embedded(), left.embedded(), right.embedded()), 1327 embeddedManager()); 1328 } 1329 newBVSHL(Expr left, Expr right)1330 public ExprMut newBVSHL(Expr left, Expr right) throws Cvc3Exception { 1331 return new ExprMut( 1332 jniNewBVSHL(embedded(), left.embedded(), right.embedded()), 1333 embeddedManager()); 1334 } 1335 newBVLSHR(Expr left, Expr right)1336 public ExprMut newBVLSHR(Expr left, Expr right) throws Cvc3Exception { 1337 return new ExprMut( 1338 jniNewBVLSHR(embedded(), left.embedded(), right.embedded()), 1339 embeddedManager()); 1340 } 1341 newBVASHR(Expr left, Expr right)1342 public ExprMut newBVASHR(Expr left, Expr right) throws Cvc3Exception { 1343 return new ExprMut( 1344 jniNewBVASHR(embedded(), left.embedded(), right.embedded()), 1345 embeddedManager()); 1346 } 1347 newFixedLeftShiftExpr(Expr expr, int r)1348 public ExprMut newFixedLeftShiftExpr(Expr expr, int r) throws Cvc3Exception { 1349 return new ExprMut( 1350 jniNewFixedLeftShiftExpr(embedded(), expr.embedded(), r), 1351 embeddedManager()); 1352 } 1353 newFixedConstWidthLeftShiftExpr(Expr expr, int r)1354 public ExprMut newFixedConstWidthLeftShiftExpr(Expr expr, int r) throws Cvc3Exception { 1355 return new ExprMut( 1356 jniNewFixedConstWidthLeftShiftExpr(embedded(), expr.embedded(), r), 1357 embeddedManager()); 1358 } 1359 newFixedRightShiftExpr(Expr expr, int r)1360 public ExprMut newFixedRightShiftExpr(Expr expr, int r) throws Cvc3Exception { 1361 return new ExprMut( 1362 jniNewFixedRightShiftExpr(embedded(), expr.embedded(), r), 1363 embeddedManager()); 1364 } 1365 computeBVConst(Expr expr)1366 public Rational computeBVConst(Expr expr) { 1367 Rational rat = new Rational( 1368 jniComputeBVConst(embedded(),expr.embedded()), 1369 embeddedManager()); 1370 assert( rat.isInteger() ); 1371 return rat; 1372 } 1373 tupleExpr(List exprs)1374 public ExprMut tupleExpr(List exprs) throws Cvc3Exception { 1375 assert(JniUtils.listInstanceof(exprs, Expr.class)); 1376 return new ExprMut( 1377 jniTupleExpr(embedded(), JniUtils.unembedList(exprs)), 1378 embeddedManager()); 1379 } 1380 tupleSelectExpr(Expr tuple, int index)1381 public ExprMut tupleSelectExpr(Expr tuple, int index) throws Cvc3Exception { 1382 return new ExprMut( 1383 jniTupleSelectExpr(embedded(), tuple.embedded(), index), 1384 embeddedManager()); 1385 } 1386 tupleUpdateExpr(Expr tuple, int index, Expr newValue)1387 public ExprMut tupleUpdateExpr(Expr tuple, int index, Expr newValue) throws Cvc3Exception { 1388 return new ExprMut( 1389 jniTupleUpdateExpr(embedded(), tuple.embedded(), index, newValue.embedded()), 1390 embeddedManager()); 1391 } 1392 datatypeConsExpr(String constructor, List exprs)1393 public ExprMut datatypeConsExpr(String constructor, List exprs) throws Cvc3Exception { 1394 assert(JniUtils.listInstanceof(exprs, Expr.class)); 1395 return new ExprMut( 1396 jniDatatypeConsExpr(embedded(), constructor, JniUtils.unembedList(exprs)), 1397 embeddedManager()); 1398 } 1399 datatypeSelExpr(String selector, Expr arg)1400 public ExprMut datatypeSelExpr(String selector, Expr arg) throws Cvc3Exception { 1401 return new ExprMut( 1402 jniDatatypeSelExpr(embedded(), selector, arg.embedded()), 1403 embeddedManager()); 1404 } 1405 datatypeTestExpr(String constructor, Expr arg)1406 public ExprMut datatypeTestExpr(String constructor, Expr arg) throws Cvc3Exception { 1407 return new ExprMut( 1408 jniDatatypeTestExpr(embedded(), constructor, arg.embedded()), 1409 embeddedManager()); 1410 } 1411 forallExpr(List vars, Expr body)1412 public ExprMut forallExpr(List vars, Expr body) throws Cvc3Exception { 1413 assert(JniUtils.listInstanceof(vars, Expr.class)); 1414 return new ExprMut( 1415 jniForallExpr1(embedded(), JniUtils.unembedList(vars), body.embedded()), 1416 embeddedManager()); 1417 } 1418 forallExpr(List vars, Expr body, Expr trigger)1419 public ExprMut forallExpr(List vars, Expr body, Expr trigger) throws Cvc3Exception { 1420 assert(JniUtils.listInstanceof(vars, Expr.class)); 1421 return new ExprMut( 1422 jniForallExpr2(embedded(), JniUtils.unembedList(vars), body.embedded(), 1423 trigger.embedded()), 1424 embeddedManager()); 1425 } 1426 forallExpr(List vars, Expr body, List triggers)1427 public ExprMut forallExpr(List vars, Expr body, List triggers) throws Cvc3Exception { 1428 assert(JniUtils.listInstanceof(vars, Expr.class)); 1429 assert(JniUtils.listInstanceof(triggers, Expr.class)); 1430 return new ExprMut( 1431 jniForallExpr3(embedded(), JniUtils.unembedList(vars), body.embedded(), 1432 JniUtils.unembedList(triggers)), 1433 embeddedManager()); 1434 } 1435 forallExprMultiTriggers(List vars, Expr body, List multiTriggers)1436 public ExprMut forallExprMultiTriggers(List vars, Expr body, List multiTriggers) 1437 throws Cvc3Exception { 1438 assert (JniUtils.listInstanceof(vars, Expr.class)); 1439 assert (JniUtils.listListInstanceof(multiTriggers, Expr.class)); 1440 return new ExprMut(jniForallExpr4(embedded(), JniUtils.unembedList(vars), 1441 body.embedded(), JniUtils.unembedListList(multiTriggers)), 1442 embeddedManager()); 1443 } 1444 setTrigger(Expr closure, Expr trigger)1445 public void setTrigger(Expr closure, Expr trigger) throws Cvc3Exception { 1446 jniSetTrigger(embedded(), closure.embedded(), trigger.embedded()); 1447 } 1448 setTriggers(Expr closure, List triggers)1449 public void setTriggers(Expr closure, List triggers) throws Cvc3Exception { 1450 jniSetTriggers(embedded(), closure.embedded(), JniUtils.unembedList(triggers)); 1451 } 1452 setMultiTrigger(Expr closure, List multiTrigger)1453 public void setMultiTrigger(Expr closure, List multiTrigger) throws Cvc3Exception { 1454 jniSetMultiTrigger(embedded(), closure.embedded(), JniUtils.unembedList(multiTrigger)); 1455 } 1456 setMultiTriggers(Expr closure, List triggers)1457 public void setMultiTriggers(Expr closure, List triggers) throws Cvc3Exception { 1458 jniSetTriggers2(embedded(), closure.embedded(), JniUtils.unembedListList(triggers)); 1459 } 1460 existsExpr(List vars, Expr body)1461 public ExprMut existsExpr(List vars, Expr body) throws Cvc3Exception { 1462 assert(JniUtils.listInstanceof(vars, Expr.class)); 1463 return new ExprMut( 1464 jniExistsExpr(embedded(), JniUtils.unembedList(vars), body.embedded()), 1465 embeddedManager()); 1466 } 1467 lambdaExpr(List vars, Expr body)1468 public OpMut lambdaExpr(List vars, Expr body) throws Cvc3Exception { 1469 assert(JniUtils.listInstanceof(vars, Expr.class)); 1470 return new OpMut( 1471 jniLambdaExpr(embedded(), JniUtils.unembedList(vars), body.embedded()), 1472 embeddedManager()); 1473 } 1474 transClosure(Op p)1475 public OpMut transClosure(Op p) throws Cvc3Exception { 1476 return new OpMut( 1477 jniTransClosure(embedded(), p.embedded()), 1478 embeddedManager()); 1479 } 1480 simulateExpr(Expr f, Expr s, List inputs, Expr n)1481 public ExprMut simulateExpr(Expr f, Expr s, List inputs, Expr n) throws Cvc3Exception { 1482 assert(JniUtils.listInstanceof(inputs, Expr.class)); 1483 return new ExprMut( 1484 jniSimulateExpr(embedded(), f.embedded(), s.embedded(), JniUtils.unembedList(inputs), n.embedded()), 1485 embeddedManager()); 1486 } 1487 1488 setResourceLimit(int limit)1489 public void setResourceLimit(int limit) throws Cvc3Exception { 1490 jniSetResourceLimit(embedded(), limit); 1491 } 1492 1493 // Validity checking methods 1494 assertFormula(Expr expr)1495 public void assertFormula(Expr expr) throws Cvc3Exception { 1496 embeddedManager().cleanUp(); 1497 jniAssertFormula(embedded(), expr.embedded()); 1498 embeddedManager().cleanUp(); 1499 } 1500 registerAtom(Expr expr)1501 public void registerAtom(Expr expr) throws Cvc3Exception { 1502 jniRegisterAtom(embedded(), expr.embedded()); 1503 } 1504 getImpliedLiteral()1505 public ExprMut getImpliedLiteral() throws Cvc3Exception { 1506 return new ExprMut( 1507 jniGetImpliedLiteral(embedded()), 1508 embeddedManager()); 1509 } 1510 simplify(Expr expr)1511 public ExprMut simplify(Expr expr) throws Cvc3Exception { 1512 return new ExprMut( 1513 jniSimplify(embedded(), expr.embedded()), 1514 embeddedManager()); 1515 } 1516 query(Expr expr)1517 public QueryResult query(Expr expr) throws Cvc3Exception { 1518 embeddedManager().cleanUp(); 1519 QueryResult result = QueryResult.get(jniQuery(embedded(), expr.embedded())); 1520 1521 //:TEST: 1522 embeddedManager().cleanUp(); 1523 return result; 1524 } 1525 checkUnsat(Expr expr)1526 public SatResult checkUnsat(Expr expr) throws Cvc3Exception { 1527 embeddedManager().cleanUp(); 1528 SatResult result = SatResult.get(jniCheckUnsat(embedded(), expr.embedded())); 1529 1530 //:TEST: 1531 embeddedManager().cleanUp(); 1532 return result; 1533 } 1534 checkContinue()1535 public QueryResult checkContinue() throws Cvc3Exception { 1536 embeddedManager().cleanUp(); 1537 QueryResult result = QueryResult.get(jniCheckContinue(embedded())); 1538 1539 //:TEST: 1540 embeddedManager().cleanUp(); 1541 return result; 1542 } 1543 restart(Expr expr)1544 public QueryResult restart(Expr expr) throws Cvc3Exception { 1545 embeddedManager().cleanUp(); 1546 QueryResult result = QueryResult.get(jniRestart(embedded(), expr.embedded())); 1547 1548 //:TEST: 1549 embeddedManager().cleanUp(); 1550 return result; 1551 } 1552 returnFromCheck()1553 public void returnFromCheck() throws Cvc3Exception { 1554 jniReturnFromCheck(embedded()); 1555 1556 //:TEST: 1557 embeddedManager().cleanUp(); 1558 } 1559 getUserAssumptions()1560 public List getUserAssumptions() throws Cvc3Exception { 1561 Object[] assumptions = jniGetUserAssumptions(embedded()); 1562 return JniUtils.embedList(assumptions, ExprMut.class, embeddedManager()); 1563 } 1564 getInternalAssumptions()1565 public List getInternalAssumptions() throws Cvc3Exception { 1566 Object[] assumptions = jniGetInternalAssumptions(embedded()); 1567 return JniUtils.embedList(assumptions, ExprMut.class, embeddedManager()); 1568 } 1569 getAssumptions()1570 public List getAssumptions() throws Cvc3Exception { 1571 Object[] assumptions = jniGetAssumptions(embedded()); 1572 return JniUtils.embedList(assumptions, ExprMut.class, embeddedManager()); 1573 } 1574 getAssumptionsUsed()1575 public List getAssumptionsUsed() throws Cvc3Exception { 1576 Object[] assumptions = jniGetAssumptionsUsed(embedded()); 1577 return JniUtils.embedList(assumptions, ExprMut.class, embeddedManager()); 1578 } 1579 getCounterExample()1580 public List getCounterExample() throws Cvc3Exception { 1581 return getCounterExample(true); 1582 } 1583 getCounterExample(boolean inOrder)1584 public List getCounterExample(boolean inOrder) throws Cvc3Exception { 1585 Object[] assumptions = jniGetCounterExample(embedded(), inOrder); 1586 return JniUtils.embedList(assumptions, ExprMut.class, embeddedManager()); 1587 } 1588 getConcreteModel()1589 public HashMap getConcreteModel() throws Cvc3Exception { 1590 Object[] model = jniGetConcreteModel(embedded()); 1591 return JniUtils.embedHashMap(model, Expr.class, Expr.class, embeddedManager()); 1592 } 1593 getValue(Expr expr)1594 public FormulaValue getValue(Expr expr) throws Cvc3Exception { 1595 return FormulaValue.get(jniGetValue(embedded(), expr.embedded())); 1596 } 1597 inconsistent()1598 public boolean inconsistent() throws Cvc3Exception { 1599 return jniInconsistent1(embedded()); 1600 } 1601 1602 // makes only sense if inconsistent is true inconsistentReasons()1603 public List inconsistentReasons() throws Cvc3Exception { 1604 Object[] assumptions = jniInconsistent2(embedded()); 1605 return JniUtils.embedList(assumptions, ExprMut.class, embeddedManager()); 1606 } 1607 incomplete()1608 public boolean incomplete() throws Cvc3Exception { 1609 return jniIncomplete1(embedded()); 1610 } 1611 1612 // makes only sense if incomplete is true incompleteReasons()1613 public List incompleteReasons() throws Cvc3Exception { 1614 Object[] assumptions = jniIncomplete2(embedded()); 1615 return JniUtils.embedList(assumptions, String.class, embeddedManager()); 1616 } 1617 getProof()1618 public ProofMut getProof() throws Cvc3Exception { 1619 return new ProofMut( 1620 jniGetProof(embedded()), 1621 embeddedManager()); 1622 } 1623 getTCC()1624 public ExprMut getTCC() throws Cvc3Exception { 1625 return new ExprMut( 1626 jniGetTCC(embedded()), 1627 embeddedManager()); 1628 } 1629 getAssumptionsTCC()1630 public List getAssumptionsTCC() throws Cvc3Exception { 1631 Object[] assumptions = jniGetAssumptionsTCC(embedded()); 1632 return JniUtils.embedList(assumptions, ExprMut.class, embeddedManager()); 1633 } 1634 getProofTCC()1635 public ProofMut getProofTCC() throws Cvc3Exception { 1636 return new ProofMut( 1637 jniGetProofTCC(embedded()), 1638 embeddedManager()); 1639 } 1640 getClosure()1641 public ExprMut getClosure() throws Cvc3Exception { 1642 return new ExprMut( 1643 jniGetClosure(embedded()), 1644 embeddedManager()); 1645 } 1646 getProofClosure()1647 public ProofMut getProofClosure() throws Cvc3Exception { 1648 return new ProofMut( 1649 jniGetProofClosure(embedded()), 1650 embeddedManager()); 1651 } 1652 1653 1654 1655 1656 // Context Methods 1657 stackLevel()1658 public int stackLevel() throws Cvc3Exception { 1659 return jniStackLevel(embedded()); 1660 } 1661 push()1662 public void push() throws Cvc3Exception { 1663 jniPush(embedded()); 1664 } 1665 pop()1666 public void pop() throws Cvc3Exception { 1667 jniPop(embedded()); 1668 //:TEST: 1669 embeddedManager().cleanUp(); 1670 } 1671 popTo(int stackLevel)1672 public void popTo(int stackLevel) throws Cvc3Exception { 1673 jniPopTo(embedded(), stackLevel); 1674 //:TEST: 1675 embeddedManager().cleanUp(); 1676 } 1677 scopeLevel()1678 public int scopeLevel() throws Cvc3Exception { 1679 return jniScopeLevel(embedded()); 1680 } 1681 pushScope()1682 public void pushScope() throws Cvc3Exception { 1683 jniPushScope(embedded()); 1684 } 1685 popScope()1686 public void popScope() throws Cvc3Exception { 1687 jniPopScope(embedded()); 1688 } 1689 popToScope(int scopeLevel)1690 public void popToScope(int scopeLevel) throws Cvc3Exception { 1691 jniPopToScope(embedded(), scopeLevel); 1692 } 1693 getCurrentContext()1694 public ContextMut getCurrentContext() throws Cvc3Exception { 1695 return new ContextMut( 1696 jniGetCurrentContext(embedded()), 1697 embeddedManager()); 1698 } 1699 1700 1701 1702 1703 // Reading Files 1704 loadFile(String fileName)1705 public void loadFile(String fileName) throws Cvc3Exception { 1706 loadFile(fileName, InputLanguage.PRESENTATION); 1707 } 1708 loadFile(String fileName, InputLanguage lang)1709 public void loadFile(String fileName, InputLanguage lang) throws Cvc3Exception { 1710 jniLoadFile1(embedded(), fileName, lang.toString()); 1711 } 1712 1713 // Reporting Statistics 1714 printStatistics()1715 public void printStatistics() throws Cvc3Exception { 1716 jniPrintStatistics(embedded()); 1717 } 1718 getStatistics()1719 public StatisticsMut getStatistics() throws Cvc3Exception { 1720 return new StatisticsMut( 1721 jniGetStatistics(embedded()), 1722 embeddedManager()); 1723 } 1724 setTimeLimit(int limit)1725 public void setTimeLimit(int limit) throws Cvc3Exception { 1726 jniSetTimeLimit(embedded(), limit); 1727 } 1728 } 1729