Skip to content

Commit e1d18a8

Browse files
authored
Z3: add conversion for idiv and bvcomp operations (#117)
1 parent 2ffab1a commit e1d18a8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ksmt-z3/src/main/kotlin/io/ksmt/solver/z3/KZ3ExprConverter.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ open class KZ3ExprConverter(
212212
Z3_decl_kind.Z3_OP_MUL -> expr.convertList(::mkArithMul)
213213
Z3_decl_kind.Z3_OP_UMINUS -> expr.convert(::mkArithUnaryMinus)
214214
Z3_decl_kind.Z3_OP_DIV -> expr.convert(::mkArithDiv)
215+
// Special case when arguments are integers
216+
Z3_decl_kind.Z3_OP_IDIV -> expr.convert(::mkArithDiv)
215217
Z3_decl_kind.Z3_OP_POWER -> expr.convert(::mkArithPower)
216218
Z3_decl_kind.Z3_OP_REM -> expr.convert(::mkIntRem)
217219
Z3_decl_kind.Z3_OP_MOD -> expr.convert(::mkIntMod)
@@ -280,7 +282,9 @@ open class KZ3ExprConverter(
280282
}
281283
Z3_decl_kind.Z3_OP_BREDOR -> expr.convert(::mkBvReductionOrExpr)
282284
Z3_decl_kind.Z3_OP_BREDAND -> expr.convert(::mkBvReductionAndExpr)
283-
Z3_decl_kind.Z3_OP_BCOMP -> TODO("bcomp conversion is not supported")
285+
Z3_decl_kind.Z3_OP_BCOMP -> expr.convert { arg0: KExpr<KBvSort>, arg1: KExpr<KBvSort> ->
286+
mkIte(arg0 eq arg1, mkBv(true), mkBv(false))
287+
}
284288
Z3_decl_kind.Z3_OP_BSHL -> expr.convert(::mkBvShiftLeftExpr)
285289
Z3_decl_kind.Z3_OP_BLSHR -> expr.convert(::mkBvLogicalShiftRightExpr)
286290
Z3_decl_kind.Z3_OP_BASHR -> expr.convert(::mkBvArithShiftRightExpr)

0 commit comments

Comments
 (0)