20using System.Collections.Generic;
21using System.Diagnostics;
23using System.Runtime.InteropServices;
65 Debug.Assert(settings !=
null);
69 IntPtr cfg = Native.Z3_mk_config();
70 foreach (KeyValuePair<string, string> kv
in settings)
71 Native.Z3_set_param_value(cfg, kv.Key, kv.Value);
72 m_ctx = Native.Z3_mk_context(cfg);
73 Native.Z3_del_config(cfg);
85 Debug.Assert(t !=
null);
86 Debug.Assert(t.All(a => a != IntPtr.Zero));
88 return Native.Z3_mk_add(nCtx, (uint)(t?.
Length ?? 0), t);
96 Debug.Assert(t !=
null);
97 Debug.Assert(t.All(a => a != IntPtr.Zero));
100 return Native.Z3_mk_mul(nCtx, (uint)(ts?.
Length ?? 0), ts);
108 Debug.Assert(t !=
null);
109 Debug.Assert(t.All(a => a != IntPtr.Zero));
110 var ts = t.ToArray();
111 return Native.Z3_mk_sub(nCtx, (uint)(ts?.
Length ?? 0), ts);
119 Debug.Assert(t1 != IntPtr.Zero);
120 Debug.Assert(t2 != IntPtr.Zero);
122 return Native.Z3_mk_div(nCtx, t1, t2);
130 Debug.Assert(t1 != IntPtr.Zero);
131 Debug.Assert(t2 != IntPtr.Zero);
133 return Native.Z3_mk_le(nCtx, t1, t2);
141 Debug.Assert(t1 != IntPtr.Zero);
142 Debug.Assert(t2 != IntPtr.Zero);
144 return Native.Z3_mk_lt(nCtx, t1, t2);
152 Debug.Assert(t1 != IntPtr.Zero);
153 Debug.Assert(t2 != IntPtr.Zero);
155 return Native.Z3_mk_ge(nCtx, t1, t2);
163 Debug.Assert(t1 != IntPtr.Zero);
164 Debug.Assert(t2 != IntPtr.Zero);
166 return Native.Z3_mk_gt(nCtx, t1, t2);
177 Debug.Assert(t1 != IntPtr.Zero);
178 Debug.Assert(t2 != IntPtr.Zero);
180 return Native.Z3_mk_bvult(nCtx, t1, t2);
191 Debug.Assert(t1 != IntPtr.Zero);
192 Debug.Assert(t2 != IntPtr.Zero);
194 return Native.Z3_mk_bvule(nCtx, t1, t2);
202 Debug.Assert(x != IntPtr.Zero);
203 Debug.Assert(y != IntPtr.Zero);
205 return Native.Z3_mk_eq(nCtx, x, y);
213 Debug.Assert(a != IntPtr.Zero);
215 return Native.Z3_mk_not(nCtx, a);
223 Debug.Assert(t !=
null);
224 Debug.Assert(t.All(a => a != IntPtr.Zero));
226 return Native.Z3_mk_and(nCtx, (uint)(t?.
Length ?? 0), t);
234 Debug.Assert(t !=
null);
235 Debug.Assert(t.All(a => a != IntPtr.Zero));
237 return Native.Z3_mk_or(nCtx, (uint)(t?.
Length ?? 0), t);
248 Debug.Assert(!
string.IsNullOrEmpty(v));
249 return Native.Z3_mk_numeral(nCtx, v,
RealSort);
259 Debug.Assert(sort != IntPtr.Zero);
261 return Native.Z3_mk_int(nCtx, v, sort);
271 Debug.Assert(sort !=
null);
273 return Native.Z3_mk_unsigned_int(nCtx, v, sort);
283 Debug.Assert(sort !=
null);
285 return Native.Z3_mk_int64(nCtx, v, sort);
296 Debug.Assert(t1 != IntPtr.Zero);
297 Debug.Assert(t2 != IntPtr.Zero);
298 Debug.Assert(t3 != IntPtr.Zero);
300 return Native.Z3_mk_ite(nCtx, t1, t2, t3);
308 Debug.Assert(t1 != IntPtr.Zero);
309 Debug.Assert(t2 != IntPtr.Zero);
311 return Native.Z3_mk_implies(nCtx, t1, t2);
357 Debug.Assert(!
string.IsNullOrEmpty(name));
358 Debug.Assert(elemSort != IntPtr.Zero);
360 IntPtr nil = IntPtr.Zero, isnil = IntPtr.Zero,
361 cons = IntPtr.Zero, iscons = IntPtr.Zero,
362 head = IntPtr.Zero, tail = IntPtr.Zero;
364 var symbol = Native.Z3_mk_string_symbol(nCtx, name);
365 var sort = Native.Z3_mk_list_sort(nCtx, symbol, elemSort,
366 ref nil, ref isnil, ref cons, ref iscons, ref head, ref tail);
383 Debug.Assert(domain != IntPtr.Zero);
384 Debug.Assert(
range != IntPtr.Zero);
386 return Native.Z3_mk_array_sort(nCtx, domain,
range);
394 Debug.Assert(name != IntPtr.Zero);
395 Debug.Assert(fieldNames !=
null);
396 Debug.Assert(fieldNames.All(fn => fn != IntPtr.Zero));
397 Debug.Assert(fieldSorts ==
null || fieldSorts.All(fs => fs != IntPtr.Zero));
399 var numFields = (uint)(fieldNames?.
Length ?? 0);
400 constructor = IntPtr.Zero;
401 return Native.Z3_mk_tuple_sort(nCtx, name, numFields, fieldNames, fieldSorts, ref constructor, projections);
406 #region Propositional
427 Debug.Assert(t1 != IntPtr.Zero);
428 Debug.Assert(t2 != IntPtr.Zero);
430 return Native.Z3_mk_iff(nCtx, t1, t2);
440 Debug.Assert(!
string.IsNullOrEmpty(name));
441 Debug.Assert(
range != IntPtr.Zero);
456 Debug.Assert(!
string.IsNullOrEmpty(name));
458 return Native.Z3_mk_string_symbol(nCtx, name);
468 Debug.Assert(f != IntPtr.Zero);
469 Debug.Assert(args ==
null || args.All(a => a != IntPtr.Zero));
471 return Native.Z3_mk_app(nCtx, f, (uint)(args?.
Length ?? 0), args);
476 #region Bound Variables
484 Debug.Assert(sort != IntPtr.Zero);
486 return Native.Z3_mk_bound(nCtx, index, sort);
497 Debug.Assert(t1 != IntPtr.Zero);
498 Debug.Assert(t2 != IntPtr.Zero);
500 return Native.Z3_mk_bvand(nCtx, t1, t2);
509 Debug.Assert(t != IntPtr.Zero);
511 return Native.Z3_mk_bvnot(nCtx, t);
520 Debug.Assert(t != IntPtr.Zero);
522 return Native.Z3_mk_bvneg(nCtx, t);
531 Debug.Assert(t != IntPtr.Zero);
533 return Native.Z3_mk_bvneg(nCtx, t);
542 Debug.Assert(t1 != IntPtr.Zero);
543 Debug.Assert(t2 != IntPtr.Zero);
545 return Native.Z3_mk_bvadd(nCtx, t1, t2);
559 Debug.Assert(t != IntPtr.Zero);
561 return Native.Z3_mk_extract(nCtx, high, low, t);
574 Debug.Assert(t != IntPtr.Zero);
576 return Native.Z3_mk_sign_ext(nCtx, i, t);
590 Debug.Assert(t != IntPtr.Zero);
592 return Native.Z3_mk_zero_ext(nCtx, i, t);
609 Debug.Assert(t1 != IntPtr.Zero);
610 Debug.Assert(t2 != IntPtr.Zero);
612 return Native.Z3_mk_bvshl(nCtx, t1, t2);
629 Debug.Assert(t1 != IntPtr.Zero);
630 Debug.Assert(t2 != IntPtr.Zero);
632 return Native.Z3_mk_bvlshr(nCtx, t1, t2);
651 Debug.Assert(t1 != IntPtr.Zero);
652 Debug.Assert(t2 != IntPtr.Zero);
654 return Native.Z3_mk_bvashr(nCtx, t1, t2);
665 Debug.Assert(t1 != IntPtr.Zero);
666 Debug.Assert(t2 != IntPtr.Zero);
668 return Native.Z3_mk_bvslt(nCtx, t1, t2);
677 Debug.Assert(t1 != IntPtr.Zero);
678 Debug.Assert(t2 != IntPtr.Zero);
680 return Native.Z3_mk_bvmul(nCtx, t1, t2);
694 Debug.Assert(t1 != IntPtr.Zero);
695 Debug.Assert(t2 != IntPtr.Zero);
697 return Native.Z3_mk_bvudiv(nCtx, t1, t2);
715 Debug.Assert(t1 != IntPtr.Zero);
716 Debug.Assert(t2 != IntPtr.Zero);
718 return Native.Z3_mk_bvsdiv(nCtx, t1, t2);
731 Debug.Assert(t1 != IntPtr.Zero);
732 Debug.Assert(t2 != IntPtr.Zero);
734 return Native.Z3_mk_bvurem(nCtx, t1, t2);
749 Debug.Assert(t1 != IntPtr.Zero);
750 Debug.Assert(t2 != IntPtr.Zero);
752 return Native.Z3_mk_bvsrem(nCtx, t1, t2);
761 Debug.Assert(t1 != IntPtr.Zero);
762 Debug.Assert(t2 != IntPtr.Zero);
764 return Native.Z3_mk_bvsub(nCtx, t1, t2);
773 Debug.Assert(t1 != IntPtr.Zero);
774 Debug.Assert(t2 != IntPtr.Zero);
776 return Native.Z3_mk_bvor(nCtx, t1, t2);
785 Debug.Assert(t1 !=
null);
786 Debug.Assert(t2 != IntPtr.Zero);
788 return Native.Z3_mk_bvxor(nCtx, t1, t2);
819 return MkQuantifier(
true, sorts, names, body, weight, patterns, noPatterns, quantifierID, skolemID);
837 return MkQuantifier(
false, sorts, names, body, weight, patterns, noPatterns, quantifierID, skolemID);
855 Debug.Assert(sorts !=
null);
856 Debug.Assert(names !=
null);
857 Debug.Assert(body !=
null);
858 Debug.Assert(sorts.Length == names.Length);
859 Debug.Assert(sorts.All(s => s != IntPtr.Zero));
860 Debug.Assert(names.All(n => n != IntPtr.Zero));
861 Debug.Assert(patterns ==
null || patterns.All(p => p != IntPtr.Zero));
862 Debug.Assert(noPatterns ==
null || noPatterns.All(np => np != IntPtr.Zero));
864 if (noPatterns ==
null && quantifierID ==
null && skolemID ==
null)
866 return Native.Z3_mk_quantifier(nCtx, (
byte)(is_forall ? 1 : 0), weight,
867 (uint)(patterns?.
Length ?? 0), patterns,
868 (uint)(sorts?.
Length ?? 0), sorts,
874 return Native.Z3_mk_quantifier_ex(nCtx, (
byte)(is_forall ? 1 : 0), weight,
875 AST.GetNativeObject(quantifierID), AST.GetNativeObject(skolemID),
876 (uint)(patterns?.Length ?? 0), patterns,
877 (uint)(noPatterns?.Length ?? 0), noPatterns,
878 (uint)(sorts?.Length ?? 0), sorts,
905 set { Native.Z3_set_ast_print_mode(nCtx, (uint)value); }
922 Debug.Assert(domain != IntPtr.Zero);
923 Debug.Assert(v != IntPtr.Zero);
925 return Native.Z3_mk_const_array(nCtx, domain, v);
945 Debug.Assert(a != IntPtr.Zero);
946 Debug.Assert(i != IntPtr.Zero);
947 Debug.Assert(v != IntPtr.Zero);
949 return Native.Z3_mk_store(nCtx, a, i, v);
965 Debug.Assert(array != IntPtr.Zero);
966 Debug.Assert(index != IntPtr.Zero);
968 return Native.Z3_mk_select(nCtx, array, index);
980 Debug.Assert(a !=
null);
982 return Native.Z3_mk_array_default(nCtx, a);
987 #region Function Declarations
994 Debug.Assert(!
string.IsNullOrEmpty(name));
995 Debug.Assert(
range != IntPtr.Zero);
996 Debug.Assert(domain !=
null);
997 Debug.Assert(domain.All(d => d != IntPtr.Zero));
999 var symbol = Native.Z3_mk_string_symbol(nCtx, name);
1000 return Native.Z3_mk_func_decl(nCtx, symbol, (uint)(domain?.
Length ?? 0), domain,
range);
1008 Debug.Assert(!
string.IsNullOrEmpty(name));
1009 Debug.Assert(
range != IntPtr.Zero);
1010 Debug.Assert(domain != IntPtr.Zero);
1012 var symbol = Native.Z3_mk_string_symbol(nCtx, name);
1013 var q =
new Z3_sort[] { domain };
1014 return Native.Z3_mk_func_decl(nCtx, symbol, (uint)q.Length, q,
range);
1022 Debug.Assert(domain !=
null);
1023 Debug.Assert(
range != IntPtr.Zero);
1024 Debug.Assert(domain.All(d => d != IntPtr.Zero));
1026 return Native.Z3_mk_fresh_func_decl(nCtx, prefix, (uint)(domain?.
Length ?? 0), domain,
range);
1034 Debug.Assert(
range != IntPtr.Zero);
1036 var symbol = Native.Z3_mk_string_symbol(nCtx, name);
1037 return Native.Z3_mk_func_decl(nCtx, symbol, 0,
new IntPtr[0],
range);
1047 Debug.Assert(fdecl != IntPtr.Zero);
1049 var sz = Native.Z3_get_domain_size(nCtx, fdecl);
1051 for (uint i = 0; i < sz; i++)
1053 domain[i] = Native.Z3_get_domain(nCtx, fdecl, i);
1065 Debug.Assert(fdecl != IntPtr.Zero);
1067 return Native.Z3_get_range(nCtx, fdecl);
1072 #region Quantifier Patterns
1078 Debug.Assert(terms !=
null);
1079 if (terms ==
null || terms.Length == 0)
1080 throw new Z3Exception(
"Cannot create a pattern from zero terms");
1082 return Native.Z3_mk_pattern(nCtx, (uint)terms.Length, terms);
1093 Z3_solver nSolver = Native.Z3_mk_simple_solver(nCtx);
1105 Debug.Assert(sort != IntPtr.Zero);
1107 return (
Z3_sort_kind)Native.Z3_get_sort_kind(nCtx, sort);
1115 Debug.Assert(ast != IntPtr.Zero);
1117 return (
Z3_ast_kind)Native.Z3_get_ast_kind(nCtx, ast);
1125 Debug.Assert(decl != IntPtr.Zero);
1127 return (
Z3_decl_kind)Native.Z3_get_decl_kind(nCtx, decl);
1135 Debug.Assert(ast != IntPtr.Zero);
1137 return Native.Z3_get_sort(nCtx, ast);
1148 var args =
new Z3_ast[numArgs];
1149 for (uint i = 0; i < numArgs; i++)
1151 args[i] = GetAppArg(app, i);
1163 Debug.Assert(app != IntPtr.Zero);
1165 return Native.Z3_get_app_num_args(nCtx, app);
1168 internal Z3_ast GetAppArg(
Z3_app app, uint i) => Native.Z3_get_app_arg(nCtx, app, i);
1175 Debug.Assert(ast != IntPtr.Zero);
1177 return Native.Z3_get_app_decl(nCtx, ast);
1187 Debug.Assert(decl != IntPtr.Zero);
1189 var namePtr = Native.Z3_get_decl_name(nCtx, decl);
1190 return Marshal.PtrToStringAnsi(namePtr);
1198 Debug.Assert(bvSort != IntPtr.Zero);
1200 return Native.Z3_get_bv_sort_size(nCtx, bvSort);
1208 Debug.Assert(array != IntPtr.Zero);
1210 return Native.Z3_get_array_sort_domain(nCtx, array);
1218 Debug.Assert(array != IntPtr.Zero);
1220 return Native.Z3_get_array_sort_range(nCtx, array);
1231 Debug.Assert(v != IntPtr.Zero);
1234 if (Native.Z3_get_numeral_int(nCtx, v, ref result) == 0)
1250 Debug.Assert(v != IntPtr.Zero);
1252 uint result = u = 0;
1253 if (Native.Z3_get_numeral_uint(nCtx, v, ref result) == 0)
1269 Debug.Assert(v != IntPtr.Zero);
1271 long result = i = 0;
1272 if (Native.Z3_get_numeral_int64(nCtx, v, ref result) == 0)
1288 Debug.Assert(v != IntPtr.Zero);
1290 ulong result = u = 0;
1291 if (Native.Z3_get_numeral_uint64(nCtx, v, ref result) == 0)
1306 Debug.Assert(v != IntPtr.Zero);
1307 return Native.Z3_get_numeral_string(nCtx, v);
1317 Debug.Assert(ast != IntPtr.Zero);
1319 return Native.Z3_ast_to_string(nCtx, ast);
1327 => Native.Z3_toggle_warning_messages(turnOn ? (
byte)1 : (
byte)0);
1332 internal static Object creation_lock =
new Object();
1333 internal IntPtr m_ctx = IntPtr.Zero;
1334 internal Native.Z3_error_handler m_n_err_handler =
null;
1335 internal IntPtr nCtx {
get {
return m_ctx; } }
1337 internal void NativeErrorHandler(IntPtr ctx,
Z3_error_code errorCode)
1342 internal void InitContext()
1345 m_n_err_handler =
new Native.Z3_error_handler(NativeErrorHandler);
1346 Native.Z3_set_error_handler(m_ctx, m_n_err_handler);
1348 GC.SuppressFinalize(
this);
1360 Debug.Assert(!
string.IsNullOrEmpty(tag));
1361 Native.Z3_enable_trace(tag);
1373 if (m_ctx != IntPtr.Zero)
1375 m_n_err_handler =
null;
1377 m_ctx = IntPtr.Zero;
1378 Native.Z3_del_context(ctx);
1381 GC.ReRegisterForFinalize(
this);
1393 Native.Z3_ast_vector_inc_ref(nCtx, vec);
1394 var sz = Native.Z3_ast_vector_size(nCtx, vec);
1395 var result =
new Z3_ast[sz];
1396 for (uint i = 0; i < sz; ++i)
1397 result[i] = Native.Z3_ast_vector_get(nCtx, vec, i);
1398 Native.Z3_ast_vector_dec_ref(nCtx, vec);
1409 Native.Z3_stats_inc_ref(nCtx, stats);
1410 var result =
Statistics.NativeEntries(nCtx, stats);
1411 Native.Z3_stats_dec_ref(nCtx, stats);
The main interaction with Z3 happens via the Context. NativeContext allows for efficient wrapper-redu...
Z3_sort MkListSort(string name, Z3_sort elemSort, out Z3_func_decl inil, out Z3_func_decl iisnil, out Z3_func_decl icons, out Z3_func_decl iiscons, out Z3_func_decl ihead, out Z3_func_decl itail)
returns ListSort
Z3_ast MkGe(Z3_ast t1, Z3_ast t2)
Create an expression representing t1 >= t2
Z3_ast MkApp(Z3_func_decl f, params Z3_ast[] args)
Create a new function application.
Z3_ast_vector MkBvSrem(Z3_ast_vector t1, Z3_ast_vector t2)
Signed remainder.
Z3_sort MkTupleSort(Z3_symbol name, Z3_symbol[] fieldNames, Z3_sort[] fieldSorts, out Z3_func_decl constructor, Z3_func_decl[] projections)
Create a new tuple sort.
Z3_ast_vector MkBvAshr(Z3_ast_vector t1, Z3_ast_vector t2)
Arithmetic shift right
Z3_ast_kind GetAstKind(Z3_ast ast)
Get the AST kind from IntPtr
Z3_ast_vector MkBvSub(Z3_ast_vector t1, Z3_ast_vector t2)
Two's complement subtraction.
Z3_ast MkIff(Z3_ast t1, Z3_ast t2)
Create an expression representing t1 iff t2.
uint GetNumArgs(Z3_app app)
Return number of arguments for app
Z3_ast MkAdd(params Z3_ast[] t)
Create an expression representing t[0] + t[1] + ....
Z3_sort GetArraySortRange(Z3_ast array)
Get the range IntPtr for Sort
Z3_ast_vector MkBvAnd(Z3_ast_vector t1, Z3_ast_vector t2)
Bitwise conjunction.
Z3_ast_vector MkBvSdiv(Z3_ast_vector t1, Z3_ast_vector t2)
Signed division.
Z3_ast_vector MkBVNeg(Z3_ast_vector t)
Standard two's complement unary minus.
bool TryGetNumeralInt(Z3_ast v, out int i)
Try to get integer from AST
Z3_ast MkBvUle(Z3_ast t1, Z3_ast t2)
Unsigned less-than-equal
Z3_func_decl MkFuncDecl(string name, Z3_sort[] domain, Z3_sort range)
Creates a new function declaration.
bool TryGetNumeralUInt(Z3_ast v, out uint u)
Try to get uint from AST
Z3_sort MkBvSort(uint size)
Returns the BvSort for size in this NativeContext
Z3_pattern MkPattern(params Z3_ast[] terms)
Create a quantifier pattern.
Z3_ast MkEq(Z3_ast x, Z3_ast y)
Creates the equality x = y .
Z3_symbol MkStringSymbol(string name)
Return a ptr to symbol for string
Z3_func_decl MkFuncDecl(string name, Z3_sort domain, Z3_sort range)
Creates a new function declaration.
Z3_ast[] GetAppArgs(Z3_app app)
Get the arguments for app
Z3_ast MkDiv(Z3_ast t1, Z3_ast t2)
Create an expression representing t1 / t2.
Z3_ast MkBool(bool value)
Creates a Boolean value.
Z3_ast MkExists(Z3_sort[] sorts, Z3_symbol[] names, Z3_ast body, uint weight=1, Z3_ast[] patterns=null, Z3_ast[] noPatterns=null, Symbol quantifierID=null, Symbol skolemID=null)
Same as MkForAll but defaults to "forall" = false Create an existential Quantifier.
Z3_ast_vector MkBvNot(Z3_ast_vector t)
Bitwise negation.
Z3_ast MkStore(Z3_ast a, Z3_ast i, Z3_ast v)
Array update.
bool TryGetNumeralInt64(Z3_ast v, out long i)
Try to get long from AST
Z3_ast_vector MkBvShl(Z3_ast_vector t1, Z3_ast_vector t2)
Shift left.
Z3_ast MkNot(Z3_ast a)
Mk an expression representing not(a).
Z3_ast_print_mode PrintMode
Selects the format used for pretty-printing expressions.
void Dispose()
Disposes of the context.
Z3_ast MkNumeral(uint v, Z3_sort sort)
Create a Term of a given sort. This function can be used to create numerals that fit in a machine int...
Z3_ast MkAnd(params Z3_ast[] t)
Create an expression representing t[0] and t[1] and ....
Z3_sort[] GetDomain(Z3_func_decl fdecl)
Get domain for a funcdecl
Z3_decl_kind GetDeclKind(Z3_func_decl decl)
Get the Decl kind from IntPtr
Z3_ast MkOr(params Z3_ast[] t)
Create an expression representing t[0] or t[1] or ....
Z3_ast MkConstArray(Z3_sort domain, Z3_ast v)
Create a constant array.
Z3_ast MkIte(Z3_ast t1, Z3_ast t2, Z3_ast t3)
Create an expression representing an if-then-else: ite(t1, t2, t3).
Z3_ast MkLe(Z3_ast t1, Z3_ast t2)
Create an expression representing t1 <= t2
Z3_ast_vector MkBvOr(Z3_ast_vector t1, Z3_ast_vector t2)
Bitwise disjunction.
Z3_ast MkSelect(Z3_ast array, Z3_ast index)
Array read.
Z3_sort GetRange(Z3_func_decl fdecl)
Get range for a funcdecl
Z3_ast_vector MkBvUrem(Z3_ast_vector t1, Z3_ast_vector t2)
Unsigned remainder.
Z3_ast_vector MkBvAdd(Z3_ast_vector t1, Z3_ast_vector t2)
Two's complement addition.
Z3_ast MkBvUlt(Z3_ast t1, Z3_ast t2)
Unsigned less-than
Z3_ast MkNumeral(long v, Z3_sort sort)
Create a Term of a given sort. This function can be used to create numerals that fit in a machine int...
Z3_ast MkNumeral(int v, Z3_sort sort)
Create a Term of a given sort. This function can be used to create numerals that fit in a machine int...
Z3_func_decl MkConstDecl(string name, Z3_sort range)
Creates a new constant function declaration.
Z3_ast MkReal(string v)
Create a real numeral.
Statistics.Entry[] GetStatistics(Z3_stats stats)
Retrieve statistics as an array of entries
Z3_sort GetSort(Z3_ast ast)
Get Sort for AST
Z3_ast MkFalse()
The false Term.
void ToggleWarningMessages(bool turnOn)
Enable or disable warning messages
Z3_ast_vector MkBvXor(Z3_ast_vector t1, Z3_ast_vector t2)
Bitwise XOR.
Z3_ast MkMul(params Z3_ast[] t)
Create an expression representing t[0] * t[1] * ....
Z3_ast MkLt(Z3_ast t1, Z3_ast t2)
Create an expression representing t1 < t2
Z3_sort GetArraySortDomain(Z3_ast array)
Get the domain IntPtr for Sort
Z3_ast_vector MkBvZeroExt(uint i, Z3_ast_vector t)
Bit-vector zero extension.
Z3_sort_kind GetSortKind(Z3_sort sort)
Get the sort kind from IntPtr
Z3_sort MkArraySort(Z3_sort domain, Z3_sort range)
Create a new array sort.
Z3_ast_vector MkBvMul(Z3_ast_vector t1, Z3_ast_vector t2)
Two's complement multiplication.
Z3_ast MkBound(uint index, Z3_sort sort)
Creates a new bound variable.
Z3_ast_vector MkBvNeg(Z3_ast_vector t)
Standard two's complement unary minus.
Z3_ast MkSub(params Z3_ast[] t)
Create an expression representing t[0] - t[1] - ....
uint GetBvSortSize(Z3_sort bvSort)
Get size of BitVector Sort
string GetDeclName(Z3_func_decl decl)
Get string name for Decl
Z3_ast_vector MkBvLshr(Z3_ast_vector t1, Z3_ast_vector t2)
Logical shift right
Z3_ast MkBvSlt(Z3_ast_vector t1, Z3_ast_vector t2)
Two's complement signed less-than
Z3_ast MkDefault(Z3_ast a)
Access the array default value.
Z3_ast MkTrue()
The true Term.
string GetNumeralString(Z3_ast v)
Get string for numeral ast
NativeContext(Dictionary< string, string > settings)
Constructor.
Z3_func_decl GetAppDecl(Z3_ast ast)
Get App Decl from IntPtr
Z3_ast_vector MkBvSignExt(uint i, Z3_ast_vector t)
Bit-vector sign extension.
Z3_ast MkConst(string name, Z3_sort range)
Creates a new Constant of sort range and named name .
Z3_ast_vector MkBvUdiv(Z3_ast_vector t1, Z3_ast_vector t2)
Unsigned division.
static void EnableTrace(string tag)
Enable trace to file
bool TryGetNumeralUInt64(Z3_ast v, out ulong u)
Try get ulong from AST
NativeSolver MkSimpleSolver()
Creates a new (incremental) solver.
Z3_ast MkGt(Z3_ast t1, Z3_ast t2)
Create an expression representing t1 > t2
Z3_ast[] ToArray(Z3_ast_vector vec)
Utility to convert a vector object of ast to a .Net array
string ToString(Z3_ast ast)
Get printable string representing Z3_ast
Z3_ast MkForall(Z3_sort[] sorts, Z3_symbol[] names, Z3_ast body, uint weight=1, Z3_ast[] patterns=null, Z3_ast[] noPatterns=null, Symbol quantifierID=null, Symbol skolemID=null)
Create a universal Quantifier.
Z3_func_decl MkFreshFuncDecl(string prefix, Z3_sort[] domain, Z3_sort range)
Creates a fresh function declaration with a name prefixed with prefix .
Z3_ast_vector MkBvExtract(uint high, uint low, Z3_ast_vector t)
Bit-vector extraction.
Z3_ast MkImplies(Z3_ast t1, Z3_ast t2)
Create an expression representing t1 -> t2.
Statistical data is organized into pairs of [Key, Entry], where every Entry is either a DoubleEntry o...
Objects of this class track statistical information about solvers.
Symbols are used to name several term and type constructors.
The exception base class for error reporting from Z3
Z3_ast_print_mode
Z3 pretty printing modes (See Z3_set_ast_print_mode).
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types.
Z3_decl_kind
The different kinds of interpreted function kinds.
Z3_sort_kind
The different kinds of Z3 types (See Z3_get_sort_kind).
Z3_error_code
Z3 error codes (See Z3_get_error_code).
System.IntPtr Z3_func_decl
System.IntPtr Z3_ast_vector
expr range(expr const &lo, expr const &hi)