3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-27 02:45:51 +00:00

Added sbv2s (#5413)

* Added sbv2s

* Fixed indention

Co-authored-by: Clemens Eisenhofer <Clemens.Eisenhofer@tuwien.ac.at>
This commit is contained in:
CEisenhofer 2021-07-16 17:58:28 +02:00 committed by GitHub
parent 9e5dcf3ecb
commit 0fa4b63d26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 104 additions and 22 deletions

View file

@ -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);
}
}