mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
Added sbv2s (#5413)
* Added sbv2s * Fixed indention Co-authored-by: Clemens Eisenhofer <Clemens.Eisenhofer@tuwien.ac.at>
This commit is contained in:
parent
9e5dcf3ecb
commit
0fa4b63d26
11 changed files with 104 additions and 22 deletions
|
@ -1202,7 +1202,8 @@ extern "C" {
|
|||
|
||||
case OP_STRING_STOI: return Z3_OP_STR_TO_INT;
|
||||
case OP_STRING_ITOS: return Z3_OP_INT_TO_STR;
|
||||
case OP_STRING_UBVTOS: return Z3_OP_UBV_TO_STR;
|
||||
case OP_STRING_UBVTOS: return Z3_OP_UBV_TO_STR;
|
||||
case OP_STRING_SBVTOS: return Z3_OP_SBV_TO_STR;
|
||||
case OP_STRING_LT: return Z3_OP_STRING_LT;
|
||||
case OP_STRING_LE: return Z3_OP_STRING_LE;
|
||||
|
||||
|
|
|
@ -245,6 +245,7 @@ extern "C" {
|
|||
MK_UNARY(Z3_mk_int_to_str, mk_c(c)->get_seq_fid(), OP_STRING_ITOS, SKIP);
|
||||
MK_UNARY(Z3_mk_str_to_int, mk_c(c)->get_seq_fid(), OP_STRING_STOI, SKIP);
|
||||
MK_UNARY(Z3_mk_ubv_to_str, mk_c(c)->get_seq_fid(), OP_STRING_UBVTOS, SKIP);
|
||||
MK_UNARY(Z3_mk_sbv_to_str, mk_c(c)->get_seq_fid(), OP_STRING_SBVTOS, SKIP);
|
||||
|
||||
|
||||
Z3_ast Z3_API Z3_mk_re_loop(Z3_context c, Z3_ast r, unsigned lo, unsigned hi) {
|
||||
|
|
|
@ -1447,6 +1447,11 @@ namespace z3 {
|
|||
check_error();
|
||||
return expr(ctx(), r);
|
||||
}
|
||||
expr sbvtos() const {
|
||||
Z3_ast r = Z3_mk_sbv_to_str(ctx(), *this);
|
||||
check_error();
|
||||
return expr(ctx(), r);
|
||||
}
|
||||
|
||||
friend expr range(expr const& lo, expr const& hi);
|
||||
/**
|
||||
|
|
|
@ -556,18 +556,18 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Bind a definition to a recursive function declaration.
|
||||
/// The function must have previously been created using
|
||||
/// MkRecFuncDecl. The body may contain recursive uses of the function or
|
||||
/// other mutually recursive functions.
|
||||
/// The function must have previously been created using
|
||||
/// MkRecFuncDecl. The body may contain recursive uses of the function or
|
||||
/// other mutually recursive functions.
|
||||
/// </summary>
|
||||
public void AddRecDef(FuncDecl f, Expr[] args, Expr body)
|
||||
{
|
||||
CheckContextMatch(f);
|
||||
CheckContextMatch<Expr>(args);
|
||||
CheckContextMatch(body);
|
||||
public void AddRecDef(FuncDecl f, Expr[] args, Expr body)
|
||||
{
|
||||
CheckContextMatch(f);
|
||||
CheckContextMatch<Expr>(args);
|
||||
CheckContextMatch(body);
|
||||
IntPtr[] argsNative = AST.ArrayToNative(args);
|
||||
Native.Z3_add_rec_def(nCtx, f.NativeObject, (uint)args.Length, argsNative, body.NativeObject);
|
||||
}
|
||||
Native.Z3_add_rec_def(nCtx, f.NativeObject, (uint)args.Length, argsNative, body.NativeObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new function declaration.
|
||||
|
@ -2405,6 +2405,15 @@ namespace Microsoft.Z3
|
|||
return new SeqExpr(this, Native.Z3_mk_ubv_to_str(nCtx, e.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a bit-vector expression, represented as an signed number, to a string.
|
||||
/// </summary>
|
||||
public SeqExpr SbvToString(Expr e) {
|
||||
Debug.Assert(e != null);
|
||||
Debug.Assert(e is ArithExpr);
|
||||
return new SeqExpr(this, Native.Z3_mk_sbv_to_str(nCtx, e.NativeObject));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert an integer expression to a string.
|
||||
/// </summary>
|
||||
|
@ -2474,7 +2483,7 @@ namespace Microsoft.Z3
|
|||
/// <summary>
|
||||
/// Check if the string s1 is lexicographically strictly less than s2.
|
||||
/// </summary>
|
||||
public BoolExpr MkStringLt(SeqExpr s1, SeqExpr s2)
|
||||
public BoolExpr MkStringLt(SeqExpr s1, SeqExpr s2)
|
||||
{
|
||||
Debug.Assert(s1 != null);
|
||||
Debug.Assert(s2 != null);
|
||||
|
@ -2485,7 +2494,7 @@ namespace Microsoft.Z3
|
|||
/// <summary>
|
||||
/// Check if the string s1 is lexicographically strictly less than s2.
|
||||
/// </summary>
|
||||
public BoolExpr MkStringLe(SeqExpr s1, SeqExpr s2)
|
||||
public BoolExpr MkStringLe(SeqExpr s1, SeqExpr s2)
|
||||
{
|
||||
Debug.Assert(s1 != null);
|
||||
Debug.Assert(s2 != null);
|
||||
|
@ -2655,7 +2664,7 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Create the empty regular expression.
|
||||
/// The sort s should be a regular expression.
|
||||
/// The sort s should be a regular expression.
|
||||
/// </summary>
|
||||
public ReExpr MkEmptyRe(Sort s)
|
||||
{
|
||||
|
@ -2665,7 +2674,7 @@ namespace Microsoft.Z3
|
|||
|
||||
/// <summary>
|
||||
/// Create the full regular expression.
|
||||
/// The sort s should be a regular expression.
|
||||
/// The sort s should be a regular expression.
|
||||
/// </summary>
|
||||
public ReExpr MkFullRe(Sort s)
|
||||
{
|
||||
|
@ -3399,7 +3408,7 @@ namespace Microsoft.Z3
|
|||
{
|
||||
Debug.Assert(t1 != null);
|
||||
Debug.Assert(t2 != null);
|
||||
// Debug.Assert(ts == null || Contract.ForAll(0, ts.Length, j => ts[j] != null));
|
||||
// Debug.Assert(ts == null || Contract.ForAll(0, ts.Length, j => ts[j] != null));
|
||||
|
||||
return AndThen(t1, t2, ts);
|
||||
}
|
||||
|
@ -4696,7 +4705,7 @@ namespace Microsoft.Z3
|
|||
{
|
||||
foreach (Z3Object a in arr)
|
||||
{
|
||||
Debug.Assert(a != null); // It was an assume, now we added the precondition, and we made it into an assert
|
||||
Debug.Assert(a != null); // It was an assume, now we added the precondition, and we made it into an assert
|
||||
CheckContextMatch(a);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2035,7 +2035,15 @@ public class Context implements AutoCloseable {
|
|||
{
|
||||
return (SeqExpr<CharSort>) Expr.create(this, Native.mkUbvToStr(nCtx(), e.getNativeObject()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert an signed bitvector expression to a string.
|
||||
*/
|
||||
public SeqExpr<CharSort> sbvToString(Expr<BitVecSort> e)
|
||||
{
|
||||
return (SeqExpr<CharSort>) Expr.create(this, Native.mkSbvToStr(nCtx(), e.getNativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an integer expression to a string.
|
||||
*/
|
||||
|
|
|
@ -1203,6 +1203,7 @@ typedef enum {
|
|||
Z3_OP_STR_TO_INT,
|
||||
Z3_OP_INT_TO_STR,
|
||||
Z3_OP_UBV_TO_STR,
|
||||
Z3_OP_SBV_TO_STR,
|
||||
Z3_OP_STRING_LT,
|
||||
Z3_OP_STRING_LE,
|
||||
|
||||
|
@ -3655,6 +3656,12 @@ extern "C" {
|
|||
*/
|
||||
Z3_ast Z3_API Z3_mk_ubv_to_str(Z3_context c, Z3_ast s);
|
||||
|
||||
/**
|
||||
\brief Signed bit-vector to string conversion.
|
||||
|
||||
def_API('Z3_mk_sbv_to_str' ,AST ,(_in(CONTEXT), _in(AST)))
|
||||
*/
|
||||
Z3_ast Z3_API Z3_mk_sbv_to_str(Z3_context c, Z3_ast s);
|
||||
|
||||
/**
|
||||
\brief Create a regular expression that accepts the sequence \c seq.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue