mirror of
https://github.com/Z3Prover/z3
synced 2025-06-20 04:43:39 +00:00
merge duality changes with unstable
This commit is contained in:
commit
d815af9f0f
194 changed files with 3554 additions and 1887 deletions
|
@ -1,5 +1,7 @@
|
||||||
#include<vector>
|
#include<vector>
|
||||||
#include"z3++.h"
|
#include"z3++.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace z3;
|
using namespace z3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -90,12 +90,12 @@ int main(int argc, const char **argv) {
|
||||||
|
|
||||||
/* Read an interpolation problem */
|
/* Read an interpolation problem */
|
||||||
|
|
||||||
int num;
|
unsigned num;
|
||||||
Z3_ast *constraints;
|
Z3_ast *constraints;
|
||||||
int *parents = 0;
|
unsigned *parents = 0;
|
||||||
const char *error;
|
const char *error;
|
||||||
bool ok;
|
bool ok;
|
||||||
int num_theory;
|
unsigned num_theory;
|
||||||
Z3_ast *theory;
|
Z3_ast *theory;
|
||||||
|
|
||||||
ok = Z3_read_interpolation_problem(ctx, &num, &constraints, tree_mode ? &parents : 0, filename, &error, &num_theory, &theory);
|
ok = Z3_read_interpolation_problem(ctx, &num, &constraints, tree_mode ? &parents : 0, filename, &error, &num_theory, &theory);
|
||||||
|
@ -144,7 +144,7 @@ int main(int argc, const char **argv) {
|
||||||
|
|
||||||
if(!incremental_mode){
|
if(!incremental_mode){
|
||||||
/* In non-incremental mode, we just pass the constraints. */
|
/* In non-incremental mode, we just pass the constraints. */
|
||||||
result = Z3_interpolate(ctx, num, constraints, (unsigned int *)parents, options, interpolants, &model, 0, false, num_theory, theory);
|
result = Z3_L_UNDEF; // FIXME: Z3_interpolate(ctx, num, constraints, parents, options, interpolants, &model, 0, false, num_theory, theory);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ int main(int argc, const char **argv) {
|
||||||
for(int i = 0; i < num; i++){
|
for(int i = 0; i < num; i++){
|
||||||
asserted[i] = constraints[i];
|
asserted[i] = constraints[i];
|
||||||
Z3_assert_cnstr(ctx,constraints[i]); // assert one constraint
|
Z3_assert_cnstr(ctx,constraints[i]); // assert one constraint
|
||||||
result = Z3_interpolate(ctx, num, &asserted[0], (unsigned int *)parents, options, interpolants, &model, 0, true, 0, 0);
|
result = Z3_L_UNDEF; // FIXME: Z3_interpolate(ctx, num, &asserted[0], parents, options, interpolants, &model, 0, true, 0, 0);
|
||||||
if(result == Z3_L_FALSE){
|
if(result == Z3_L_FALSE){
|
||||||
for(unsigned j = 0; j < num-1; j++)
|
for(unsigned j = 0; j < num-1; j++)
|
||||||
/* Since we want the interpolant formulas to survive a "pop", we
|
/* Since we want the interpolant formulas to survive a "pop", we
|
||||||
|
|
|
@ -75,7 +75,7 @@ def init_project_def():
|
||||||
# dll_name='foci2',
|
# dll_name='foci2',
|
||||||
# export_files=['foci2stub.cpp'])
|
# export_files=['foci2stub.cpp'])
|
||||||
# add_lib('interp', ['solver','foci2'])
|
# add_lib('interp', ['solver','foci2'])
|
||||||
API_files = ['z3_api.h', 'z3_algebraic.h', 'z3_polynomial.h', 'z3_rcf.h']
|
API_files = ['z3_api.h', 'z3_algebraic.h', 'z3_polynomial.h', 'z3_rcf.h', 'z3_interp.h']
|
||||||
add_lib('api', ['portfolio', 'user_plugin', 'smtparser', 'realclosure', 'interp'],
|
add_lib('api', ['portfolio', 'user_plugin', 'smtparser', 'realclosure', 'interp'],
|
||||||
includes2install=['z3.h', 'z3_v1.h', 'z3_macros.h'] + API_files)
|
includes2install=['z3.h', 'z3_v1.h', 'z3_macros.h'] + API_files)
|
||||||
add_exe('shell', ['api', 'sat', 'extra_cmds'], exe_name='z3')
|
add_exe('shell', ['api', 'sat', 'extra_cmds'], exe_name='z3')
|
||||||
|
|
|
@ -455,7 +455,7 @@ def display_help(exit_code):
|
||||||
print(" -v, --vsproj generate Visual Studio Project Files.")
|
print(" -v, --vsproj generate Visual Studio Project Files.")
|
||||||
if IS_WINDOWS:
|
if IS_WINDOWS:
|
||||||
print(" -n, --nodotnet do not generate Microsoft.Z3.dll make rules.")
|
print(" -n, --nodotnet do not generate Microsoft.Z3.dll make rules.")
|
||||||
print(" -j, --java generate Java bindinds.")
|
print(" -j, --java generate Java bindings.")
|
||||||
print(" --staticlib build Z3 static library.")
|
print(" --staticlib build Z3 static library.")
|
||||||
if not IS_WINDOWS:
|
if not IS_WINDOWS:
|
||||||
print(" -g, --gmp use GMP.")
|
print(" -g, --gmp use GMP.")
|
||||||
|
@ -587,7 +587,7 @@ def set_z3py_dir(p):
|
||||||
raise MKException("Python bindings directory '%s' does not exist" % full)
|
raise MKException("Python bindings directory '%s' does not exist" % full)
|
||||||
Z3PY_SRC_DIR = full
|
Z3PY_SRC_DIR = full
|
||||||
if VERBOSE:
|
if VERBOSE:
|
||||||
print("Python bindinds directory was detected.")
|
print("Python bindings directory was detected.")
|
||||||
|
|
||||||
_UNIQ_ID = 0
|
_UNIQ_ID = 0
|
||||||
|
|
||||||
|
@ -1801,7 +1801,7 @@ def def_module_params(module_name, export, params, class_name=None, description=
|
||||||
out.write(' {}\n')
|
out.write(' {}\n')
|
||||||
out.write(' static void collect_param_descrs(param_descrs & d) {\n')
|
out.write(' static void collect_param_descrs(param_descrs & d) {\n')
|
||||||
for param in params:
|
for param in params:
|
||||||
out.write(' d.insert("%s", %s, "%s", "%s");\n' % (param[0], TYPE2CPK[param[1]], param[3], pyg_default(param)))
|
out.write(' d.insert("%s", %s, "%s", "%s","%s");\n' % (param[0], TYPE2CPK[param[1]], param[3], pyg_default(param), module_name))
|
||||||
out.write(' }\n')
|
out.write(' }\n')
|
||||||
if export:
|
if export:
|
||||||
out.write(' /*\n')
|
out.write(' /*\n')
|
||||||
|
@ -2522,6 +2522,10 @@ def mk_vs_proj(name, components):
|
||||||
f.write(' <ClCompile>\n')
|
f.write(' <ClCompile>\n')
|
||||||
f.write(' <Optimization>Disabled</Optimization>\n')
|
f.write(' <Optimization>Disabled</Optimization>\n')
|
||||||
f.write(' <PreprocessorDefinitions>WIN32;_DEBUG;Z3DEBUG;_TRACE;_MP_INTERNAL;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n')
|
f.write(' <PreprocessorDefinitions>WIN32;_DEBUG;Z3DEBUG;_TRACE;_MP_INTERNAL;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n')
|
||||||
|
if VS_PAR:
|
||||||
|
f.write(' <MinimalRebuild>false</MinimalRebuild>\n')
|
||||||
|
f.write(' <MultiProcessorCompilation>true</MultiProcessorCompilation>\n')
|
||||||
|
else:
|
||||||
f.write(' <MinimalRebuild>true</MinimalRebuild>\n')
|
f.write(' <MinimalRebuild>true</MinimalRebuild>\n')
|
||||||
f.write(' <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n')
|
f.write(' <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n')
|
||||||
f.write(' <WarningLevel>Level3</WarningLevel>\n')
|
f.write(' <WarningLevel>Level3</WarningLevel>\n')
|
||||||
|
@ -2556,6 +2560,10 @@ def mk_vs_proj(name, components):
|
||||||
f.write(' <ClCompile>\n')
|
f.write(' <ClCompile>\n')
|
||||||
f.write(' <Optimization>Disabled</Optimization>\n')
|
f.write(' <Optimization>Disabled</Optimization>\n')
|
||||||
f.write(' <PreprocessorDefinitions>WIN32;_NDEBUG;_MP_INTERNAL;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n')
|
f.write(' <PreprocessorDefinitions>WIN32;_NDEBUG;_MP_INTERNAL;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n')
|
||||||
|
if VS_PAR:
|
||||||
|
f.write(' <MinimalRebuild>false</MinimalRebuild>\n')
|
||||||
|
f.write(' <MultiProcessorCompilation>true</MultiProcessorCompilation>\n')
|
||||||
|
else:
|
||||||
f.write(' <MinimalRebuild>true</MinimalRebuild>\n')
|
f.write(' <MinimalRebuild>true</MinimalRebuild>\n')
|
||||||
f.write(' <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n')
|
f.write(' <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n')
|
||||||
f.write(' <WarningLevel>Level3</WarningLevel>\n')
|
f.write(' <WarningLevel>Level3</WarningLevel>\n')
|
||||||
|
|
|
@ -108,6 +108,7 @@ INOUT = 2
|
||||||
IN_ARRAY = 3
|
IN_ARRAY = 3
|
||||||
OUT_ARRAY = 4
|
OUT_ARRAY = 4
|
||||||
INOUT_ARRAY = 5
|
INOUT_ARRAY = 5
|
||||||
|
OUT_MANAGED_ARRAY = 6
|
||||||
|
|
||||||
# Primitive Types
|
# Primitive Types
|
||||||
VOID = 0
|
VOID = 0
|
||||||
|
@ -131,13 +132,13 @@ def is_obj(ty):
|
||||||
|
|
||||||
Type2Str = { VOID : 'void', VOID_PTR : 'void*', INT : 'int', UINT : 'unsigned', INT64 : '__int64', UINT64 : '__uint64', DOUBLE : 'double',
|
Type2Str = { VOID : 'void', VOID_PTR : 'void*', INT : 'int', UINT : 'unsigned', INT64 : '__int64', UINT64 : '__uint64', DOUBLE : 'double',
|
||||||
STRING : 'Z3_string', STRING_PTR : 'Z3_string_ptr', BOOL : 'Z3_bool', SYMBOL : 'Z3_symbol',
|
STRING : 'Z3_string', STRING_PTR : 'Z3_string_ptr', BOOL : 'Z3_bool', SYMBOL : 'Z3_symbol',
|
||||||
PRINT_MODE : 'Z3_ast_print_mode', ERROR_CODE : 'Z3_error_code',
|
PRINT_MODE : 'Z3_ast_print_mode', ERROR_CODE : 'Z3_error_code'
|
||||||
}
|
}
|
||||||
|
|
||||||
Type2PyStr = { VOID_PTR : 'ctypes.c_void_p', INT : 'ctypes.c_int', UINT : 'ctypes.c_uint', INT64 : 'ctypes.c_longlong',
|
Type2PyStr = { VOID_PTR : 'ctypes.c_void_p', INT : 'ctypes.c_int', UINT : 'ctypes.c_uint', INT64 : 'ctypes.c_longlong',
|
||||||
UINT64 : 'ctypes.c_ulonglong', DOUBLE : 'ctypes.c_double',
|
UINT64 : 'ctypes.c_ulonglong', DOUBLE : 'ctypes.c_double',
|
||||||
STRING : 'ctypes.c_char_p', STRING_PTR : 'ctypes.POINTER(ctypes.c_char_p)', BOOL : 'ctypes.c_bool', SYMBOL : 'Symbol',
|
STRING : 'ctypes.c_char_p', STRING_PTR : 'ctypes.POINTER(ctypes.c_char_p)', BOOL : 'ctypes.c_bool', SYMBOL : 'Symbol',
|
||||||
PRINT_MODE : 'ctypes.c_uint', ERROR_CODE : 'ctypes.c_uint',
|
PRINT_MODE : 'ctypes.c_uint', ERROR_CODE : 'ctypes.c_uint'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Mapping to .NET types
|
# Mapping to .NET types
|
||||||
|
@ -224,6 +225,10 @@ def _out_array2(cap, sz, ty):
|
||||||
def _inout_array(sz, ty):
|
def _inout_array(sz, ty):
|
||||||
return (INOUT_ARRAY, ty, sz, sz);
|
return (INOUT_ARRAY, ty, sz, sz);
|
||||||
|
|
||||||
|
def _out_managed_array(sz,ty):
|
||||||
|
return (OUT_MANAGED_ARRAY, ty, 0, sz)
|
||||||
|
|
||||||
|
|
||||||
def param_kind(p):
|
def param_kind(p):
|
||||||
return p[0]
|
return p[0]
|
||||||
|
|
||||||
|
@ -254,12 +259,14 @@ def param2dotnet(p):
|
||||||
return "out IntPtr"
|
return "out IntPtr"
|
||||||
else:
|
else:
|
||||||
return "[In, Out] ref %s" % type2dotnet(param_type(p))
|
return "[In, Out] ref %s" % type2dotnet(param_type(p))
|
||||||
if k == IN_ARRAY:
|
elif k == IN_ARRAY:
|
||||||
return "[In] %s[]" % type2dotnet(param_type(p))
|
return "[In] %s[]" % type2dotnet(param_type(p))
|
||||||
if k == INOUT_ARRAY:
|
elif k == INOUT_ARRAY:
|
||||||
return "[In, Out] %s[]" % type2dotnet(param_type(p))
|
return "[In, Out] %s[]" % type2dotnet(param_type(p))
|
||||||
if k == OUT_ARRAY:
|
elif k == OUT_ARRAY:
|
||||||
return "[Out] %s[]" % type2dotnet(param_type(p))
|
return "[Out] %s[]" % type2dotnet(param_type(p))
|
||||||
|
elif k == OUT_MANAGED_ARRAY:
|
||||||
|
return "[Out] out %s[]" % type2dotnet(param_type(p))
|
||||||
else:
|
else:
|
||||||
return type2dotnet(param_type(p))
|
return type2dotnet(param_type(p))
|
||||||
|
|
||||||
|
@ -268,7 +275,7 @@ def param2java(p):
|
||||||
if k == OUT:
|
if k == OUT:
|
||||||
if param_type(p) == INT or param_type(p) == UINT:
|
if param_type(p) == INT or param_type(p) == UINT:
|
||||||
return "IntPtr"
|
return "IntPtr"
|
||||||
elif param_type(p) == INT64 or param_type(p) == UINT64 or param_type(p) >= FIRST_OBJ_ID:
|
elif param_type(p) == INT64 or param_type(p) == UINT64 or param_type(p) == VOID_PTR or param_type(p) >= FIRST_OBJ_ID:
|
||||||
return "LongPtr"
|
return "LongPtr"
|
||||||
elif param_type(p) == STRING:
|
elif param_type(p) == STRING:
|
||||||
return "StringPtr"
|
return "StringPtr"
|
||||||
|
@ -276,8 +283,13 @@ def param2java(p):
|
||||||
print("ERROR: unreachable code")
|
print("ERROR: unreachable code")
|
||||||
assert(False)
|
assert(False)
|
||||||
exit(1)
|
exit(1)
|
||||||
if k == IN_ARRAY or k == INOUT_ARRAY or k == OUT_ARRAY:
|
elif k == IN_ARRAY or k == INOUT_ARRAY or k == OUT_ARRAY:
|
||||||
return "%s[]" % type2java(param_type(p))
|
return "%s[]" % type2java(param_type(p))
|
||||||
|
elif k == OUT_MANAGED_ARRAY:
|
||||||
|
if param_type(p) == UINT:
|
||||||
|
return "UIntArrayPtr"
|
||||||
|
else:
|
||||||
|
return "ObjArrayPtr"
|
||||||
else:
|
else:
|
||||||
return type2java(param_type(p))
|
return type2java(param_type(p))
|
||||||
|
|
||||||
|
@ -466,6 +478,8 @@ def mk_dotnet_wrappers():
|
||||||
dotnet.write('out ');
|
dotnet.write('out ');
|
||||||
else:
|
else:
|
||||||
dotnet.write('ref ')
|
dotnet.write('ref ')
|
||||||
|
elif param_kind(param) == OUT_MANAGED_ARRAY:
|
||||||
|
dotnet.write('out ');
|
||||||
dotnet.write('a%d' % i)
|
dotnet.write('a%d' % i)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
dotnet.write(');\n');
|
dotnet.write(');\n');
|
||||||
|
@ -522,6 +536,8 @@ def mk_java():
|
||||||
java_native.write(' public static class IntPtr { public int value; }\n')
|
java_native.write(' public static class IntPtr { public int value; }\n')
|
||||||
java_native.write(' public static class LongPtr { public long value; }\n')
|
java_native.write(' public static class LongPtr { public long value; }\n')
|
||||||
java_native.write(' public static class StringPtr { public String value; }\n')
|
java_native.write(' public static class StringPtr { public String value; }\n')
|
||||||
|
java_native.write(' public static class ObjArrayPtr { public long[] value; }\n')
|
||||||
|
java_native.write(' public static class UIntArrayPtr { public int[] value; }\n')
|
||||||
java_native.write(' public static native void setInternalErrorHandler(long ctx);\n\n')
|
java_native.write(' public static native void setInternalErrorHandler(long ctx);\n\n')
|
||||||
if IS_WINDOWS or os.uname()[0]=="CYGWIN":
|
if IS_WINDOWS or os.uname()[0]=="CYGWIN":
|
||||||
java_native.write(' static { System.loadLibrary("%s"); }\n' % get_component('java').dll_name)
|
java_native.write(' static { System.loadLibrary("%s"); }\n' % get_component('java').dll_name)
|
||||||
|
@ -679,6 +695,8 @@ def mk_java():
|
||||||
java_wrapper.write(' GETLONGAREGION(%s, a%s, 0, a%s, _a%s);\n' % (type2str(param_type(param)), i, param_array_capacity_pos(param), i))
|
java_wrapper.write(' GETLONGAREGION(%s, a%s, 0, a%s, _a%s);\n' % (type2str(param_type(param)), i, param_array_capacity_pos(param), i))
|
||||||
elif k == IN and param_type(param) == STRING:
|
elif k == IN and param_type(param) == STRING:
|
||||||
java_wrapper.write(' Z3_string _a%s = (Z3_string) jenv->GetStringUTFChars(a%s, NULL);\n' % (i, i))
|
java_wrapper.write(' Z3_string _a%s = (Z3_string) jenv->GetStringUTFChars(a%s, NULL);\n' % (i, i))
|
||||||
|
elif k == OUT_MANAGED_ARRAY:
|
||||||
|
java_wrapper.write(' %s * _a%s = 0;\n' % (type2str(param_type(param)), i))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
# invoke procedure
|
# invoke procedure
|
||||||
java_wrapper.write(' ')
|
java_wrapper.write(' ')
|
||||||
|
@ -697,6 +715,8 @@ def mk_java():
|
||||||
java_wrapper.write('&_a%s' % i)
|
java_wrapper.write('&_a%s' % i)
|
||||||
elif k == OUT_ARRAY or k == IN_ARRAY or k == INOUT_ARRAY:
|
elif k == OUT_ARRAY or k == IN_ARRAY or k == INOUT_ARRAY:
|
||||||
java_wrapper.write('_a%s' % i)
|
java_wrapper.write('_a%s' % i)
|
||||||
|
elif k == OUT_MANAGED_ARRAY:
|
||||||
|
java_wrapper.write('&_a%s' % i)
|
||||||
elif k == IN and param_type(param) == STRING:
|
elif k == IN and param_type(param) == STRING:
|
||||||
java_wrapper.write('_a%s' % i)
|
java_wrapper.write('_a%s' % i)
|
||||||
else:
|
else:
|
||||||
|
@ -732,6 +752,8 @@ def mk_java():
|
||||||
java_wrapper.write(' jfieldID fid = jenv->GetFieldID(mc, "value", "J");\n')
|
java_wrapper.write(' jfieldID fid = jenv->GetFieldID(mc, "value", "J");\n')
|
||||||
java_wrapper.write(' jenv->SetLongField(a%s, fid, (jlong) _a%s);\n' % (i, i))
|
java_wrapper.write(' jenv->SetLongField(a%s, fid, (jlong) _a%s);\n' % (i, i))
|
||||||
java_wrapper.write(' }\n')
|
java_wrapper.write(' }\n')
|
||||||
|
elif k == OUT_MANAGED_ARRAY:
|
||||||
|
java_wrapper.write(' *(jlong**)a%s = (jlong*)_a%s;\n' % (i, i))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
# return
|
# return
|
||||||
if result == STRING:
|
if result == STRING:
|
||||||
|
@ -932,6 +954,9 @@ def def_API(name, result, params):
|
||||||
elif ty == INT64:
|
elif ty == INT64:
|
||||||
log_c.write(" I(0);\n")
|
log_c.write(" I(0);\n")
|
||||||
exe_c.write("in.get_int64_addr(%s)" % i)
|
exe_c.write("in.get_int64_addr(%s)" % i)
|
||||||
|
elif ty == VOID_PTR:
|
||||||
|
log_c.write(" P(0);\n")
|
||||||
|
exe_c.write("in.get_obj_addr(%s)" % i)
|
||||||
else:
|
else:
|
||||||
error("unsupported parameter for %s, %s" % (name, p))
|
error("unsupported parameter for %s, %s" % (name, p))
|
||||||
elif kind == IN_ARRAY or kind == INOUT_ARRAY:
|
elif kind == IN_ARRAY or kind == INOUT_ARRAY:
|
||||||
|
@ -953,22 +978,43 @@ def def_API(name, result, params):
|
||||||
log_c.write(" Au(a%s);\n" % sz)
|
log_c.write(" Au(a%s);\n" % sz)
|
||||||
exe_c.write("in.get_uint_array(%s)" % i)
|
exe_c.write("in.get_uint_array(%s)" % i)
|
||||||
else:
|
else:
|
||||||
error ("unsupported parameter for %s, %s" % (name, p))
|
error ("unsupported parameter for %s, %s" % (ty, name, p))
|
||||||
elif kind == OUT_ARRAY:
|
elif kind == OUT_ARRAY:
|
||||||
sz = param_array_capacity_pos(p)
|
sz = param_array_capacity_pos(p)
|
||||||
log_c.write(" for (unsigned i = 0; i < a%s; i++) { " % sz)
|
sz_p = params[sz]
|
||||||
|
sz_p_k = param_kind(sz_p)
|
||||||
|
tstr = type2str(ty)
|
||||||
|
if sz_p_k == OUT or sz_p_k == INOUT:
|
||||||
|
sz_e = ("(*a%s)" % sz)
|
||||||
|
else:
|
||||||
|
sz_e = ("a%s" % sz)
|
||||||
|
log_c.write(" for (unsigned i = 0; i < %s; i++) { " % sz_e)
|
||||||
if is_obj(ty):
|
if is_obj(ty):
|
||||||
log_c.write("P(0);")
|
log_c.write("P(0);")
|
||||||
log_c.write(" }\n")
|
log_c.write(" }\n")
|
||||||
log_c.write(" Ap(a%s);\n" % sz)
|
log_c.write(" Ap(%s);\n" % sz_e)
|
||||||
exe_c.write("reinterpret_cast<%s*>(in.get_obj_array(%s))" % (type2str(ty), i))
|
exe_c.write("reinterpret_cast<%s*>(in.get_obj_array(%s))" % (tstr, i))
|
||||||
elif ty == UINT:
|
elif ty == UINT:
|
||||||
log_c.write("U(0);")
|
log_c.write("U(0);")
|
||||||
log_c.write(" }\n")
|
log_c.write(" }\n")
|
||||||
log_c.write(" Au(a%s);\n" % sz)
|
log_c.write(" Au(%s);\n" % sz_e)
|
||||||
exe_c.write("in.get_uint_array(%s)" % i)
|
exe_c.write("in.get_uint_array(%s)" % i)
|
||||||
else:
|
else:
|
||||||
error ("unsupported parameter for %s, %s" % (name, p))
|
error ("unsupported parameter for %s, %s" % (name, p))
|
||||||
|
elif kind == OUT_MANAGED_ARRAY:
|
||||||
|
sz = param_array_size_pos(p)
|
||||||
|
sz_p = params[sz]
|
||||||
|
sz_p_k = param_kind(sz_p)
|
||||||
|
tstr = type2str(ty)
|
||||||
|
if sz_p_k == OUT or sz_p_k == INOUT:
|
||||||
|
sz_e = ("(*a%s)" % sz)
|
||||||
|
else:
|
||||||
|
sz_e = ("a%s" % sz)
|
||||||
|
log_c.write(" for (unsigned i = 0; i < %s; i++) { " % sz_e)
|
||||||
|
log_c.write("P(0);")
|
||||||
|
log_c.write(" }\n")
|
||||||
|
log_c.write(" Ap(%s);\n" % sz_e)
|
||||||
|
exe_c.write("reinterpret_cast<%s**>(in.get_obj_array(%s))" % (tstr, i))
|
||||||
else:
|
else:
|
||||||
error ("unsupported parameter for %s, %s" % (name, p))
|
error ("unsupported parameter for %s, %s" % (name, p))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
|
@ -208,7 +208,7 @@ extern "C" {
|
||||||
MK_BINARY(Z3_mk_xor, mk_c(c)->get_basic_fid(), OP_XOR, SKIP);
|
MK_BINARY(Z3_mk_xor, mk_c(c)->get_basic_fid(), OP_XOR, SKIP);
|
||||||
MK_NARY(Z3_mk_and, mk_c(c)->get_basic_fid(), OP_AND, SKIP);
|
MK_NARY(Z3_mk_and, mk_c(c)->get_basic_fid(), OP_AND, SKIP);
|
||||||
MK_NARY(Z3_mk_or, mk_c(c)->get_basic_fid(), OP_OR, SKIP);
|
MK_NARY(Z3_mk_or, mk_c(c)->get_basic_fid(), OP_OR, SKIP);
|
||||||
MK_UNARY(Z3_mk_interp, mk_c(c)->get_basic_fid(), OP_INTERP, SKIP);
|
MK_UNARY(Z3_mk_interpolant, mk_c(c)->get_basic_fid(), OP_INTERP, SKIP);
|
||||||
|
|
||||||
Z3_ast mk_ite_core(Z3_context c, Z3_ast t1, Z3_ast t2, Z3_ast t3) {
|
Z3_ast mk_ite_core(Z3_context c, Z3_ast t1, Z3_ast t2, Z3_ast t3) {
|
||||||
expr * result = mk_c(c)->m().mk_ite(to_expr(t1), to_expr(t2), to_expr(t3));
|
expr * result = mk_c(c)->m().mk_ite(to_expr(t1), to_expr(t2), to_expr(t3));
|
||||||
|
|
|
@ -106,10 +106,4 @@ extern "C" {
|
||||||
Z3_CATCH;
|
Z3_CATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
Z3_bool Z3_API Z3_get_param_value(Z3_context c, Z3_string param_id, Z3_string* param_value) {
|
|
||||||
LOG_Z3_get_param_value(c, param_id, param_value);
|
|
||||||
// TODO
|
|
||||||
return Z3_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -128,6 +128,7 @@ namespace api {
|
||||||
for (unsigned i = 0; i < m_replay_stack.size(); ++i) {
|
for (unsigned i = 0; i < m_replay_stack.size(); ++i) {
|
||||||
dealloc(m_replay_stack[i]);
|
dealloc(m_replay_stack[i]);
|
||||||
}
|
}
|
||||||
|
m_ast_trail.reset();
|
||||||
}
|
}
|
||||||
reset_parser();
|
reset_parser();
|
||||||
dealloc(m_solver);
|
dealloc(m_solver);
|
||||||
|
@ -342,15 +343,12 @@ namespace api {
|
||||||
|
|
||||||
void context::push() {
|
void context::push() {
|
||||||
get_smt_kernel().push();
|
get_smt_kernel().push();
|
||||||
if (!m_user_ref_count) {
|
|
||||||
m_ast_lim.push_back(m_ast_trail.size());
|
m_ast_lim.push_back(m_ast_trail.size());
|
||||||
m_replay_stack.push_back(0);
|
m_replay_stack.push_back(0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void context::pop(unsigned num_scopes) {
|
void context::pop(unsigned num_scopes) {
|
||||||
for (unsigned i = 0; i < num_scopes; ++i) {
|
for (unsigned i = 0; i < num_scopes; ++i) {
|
||||||
if (!m_user_ref_count) {
|
|
||||||
unsigned sz = m_ast_lim.back();
|
unsigned sz = m_ast_lim.back();
|
||||||
m_ast_lim.pop_back();
|
m_ast_lim.pop_back();
|
||||||
dealloc(m_replay_stack.back());
|
dealloc(m_replay_stack.back());
|
||||||
|
@ -359,7 +357,7 @@ namespace api {
|
||||||
m_ast_trail.pop_back();
|
m_ast_trail.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
SASSERT(num_scopes <= get_smt_kernel().get_scope_level());
|
||||||
get_smt_kernel().pop(num_scopes);
|
get_smt_kernel().pop(num_scopes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,8 @@ extern "C" {
|
||||||
Z3_params options,
|
Z3_params options,
|
||||||
Z3_ast *interps,
|
Z3_ast *interps,
|
||||||
int num_theory,
|
int num_theory,
|
||||||
Z3_ast *theory
|
Z3_ast *theory)
|
||||||
){
|
{
|
||||||
|
|
||||||
if (num > 1){ // if we have interpolants to compute
|
if (num > 1){ // if we have interpolants to compute
|
||||||
|
|
||||||
|
@ -123,98 +123,15 @@ extern "C" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Z3_lbool Z3_interpolate(Z3_context ctx,
|
|
||||||
int num,
|
|
||||||
Z3_ast *cnsts,
|
|
||||||
unsigned *parents,
|
|
||||||
Z3_params options,
|
|
||||||
Z3_ast *interps,
|
|
||||||
Z3_model *model,
|
|
||||||
Z3_literals *labels,
|
|
||||||
int incremental,
|
|
||||||
int num_theory,
|
|
||||||
Z3_ast *theory
|
|
||||||
){
|
|
||||||
|
|
||||||
|
|
||||||
profiling::timer_start("Solve");
|
|
||||||
|
|
||||||
if(!incremental){
|
|
||||||
|
|
||||||
profiling::timer_start("Z3 assert");
|
|
||||||
|
|
||||||
Z3_push(ctx); // so we can rewind later
|
|
||||||
|
|
||||||
for(int i = 0; i < num; i++)
|
|
||||||
Z3_assert_cnstr(ctx,cnsts[i]); // assert all the constraints
|
|
||||||
|
|
||||||
if(theory){
|
|
||||||
for(int i = 0; i < num_theory; i++)
|
|
||||||
Z3_assert_cnstr(ctx,theory[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
profiling::timer_stop("Z3 assert");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Get a proof of unsat
|
|
||||||
|
|
||||||
Z3_ast proof;
|
|
||||||
Z3_lbool result;
|
|
||||||
|
|
||||||
profiling::timer_start("Z3 solving");
|
|
||||||
result = Z3_check_assumptions(ctx, 0, 0, model, &proof, 0, 0);
|
|
||||||
profiling::timer_stop("Z3 solving");
|
|
||||||
|
|
||||||
switch (result) {
|
|
||||||
case Z3_L_FALSE:
|
|
||||||
|
|
||||||
Z3_interpolate_proof(ctx,
|
|
||||||
proof,
|
|
||||||
num,
|
|
||||||
cnsts,
|
|
||||||
parents,
|
|
||||||
options,
|
|
||||||
interps,
|
|
||||||
num_theory,
|
|
||||||
theory);
|
|
||||||
|
|
||||||
if(!incremental)
|
|
||||||
for(int i = 0; i < num-1; i++)
|
|
||||||
Z3_persist_ast(ctx,interps[i],1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Z3_L_UNDEF:
|
|
||||||
if(labels)
|
|
||||||
*labels = Z3_get_relevant_labels(ctx);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Z3_L_TRUE:
|
|
||||||
if(labels)
|
|
||||||
*labels = Z3_get_relevant_labels(ctx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
profiling::timer_start("Z3 pop");
|
|
||||||
if(!incremental)
|
|
||||||
Z3_pop(ctx,1);
|
|
||||||
profiling::timer_stop("Z3 pop");
|
|
||||||
|
|
||||||
profiling::timer_stop("Solve");
|
|
||||||
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::ostringstream itp_err;
|
static std::ostringstream itp_err;
|
||||||
|
|
||||||
int Z3_check_interpolant(Z3_context ctx,
|
int Z3_check_interpolant(Z3_context ctx,
|
||||||
int num,
|
unsigned num,
|
||||||
Z3_ast *cnsts,
|
Z3_ast *cnsts,
|
||||||
int *parents,
|
unsigned *parents,
|
||||||
Z3_ast *itp,
|
Z3_ast *itp,
|
||||||
const char **error,
|
Z3_string *error,
|
||||||
int num_theory,
|
unsigned num_theory,
|
||||||
Z3_ast *theory){
|
Z3_ast *theory){
|
||||||
|
|
||||||
ast_manager &_m = mk_c(ctx)->m();
|
ast_manager &_m = mk_c(ctx)->m();
|
||||||
|
@ -226,13 +143,13 @@ extern "C" {
|
||||||
scoped_ptr<solver> sp((*(sf))(_m, p, false, true, false, symbol("AUFLIA")));
|
scoped_ptr<solver> sp((*(sf))(_m, p, false, true, false, symbol("AUFLIA")));
|
||||||
|
|
||||||
ptr_vector<ast> cnsts_vec(num); // get constraints in a vector
|
ptr_vector<ast> cnsts_vec(num); // get constraints in a vector
|
||||||
for(int i = 0; i < num; i++){
|
for (unsigned i = 0; i < num; i++){
|
||||||
ast *a = to_ast(cnsts[i]);
|
ast *a = to_ast(cnsts[i]);
|
||||||
cnsts_vec[i] = a;
|
cnsts_vec[i] = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr_vector<ast> itp_vec(num); // get interpolants in a vector
|
ptr_vector<ast> itp_vec(num); // get interpolants in a vector
|
||||||
for(int i = 0; i < num-1; i++){
|
for (unsigned i = 0; i < num - 1; i++){
|
||||||
ast *a = to_ast(itp[i]);
|
ast *a = to_ast(itp[i]);
|
||||||
itp_vec[i] = a;
|
itp_vec[i] = a;
|
||||||
}
|
}
|
||||||
|
@ -240,14 +157,14 @@ extern "C" {
|
||||||
::vector<int> parents_vec; // get parents in a vector
|
::vector<int> parents_vec; // get parents in a vector
|
||||||
if (parents){
|
if (parents){
|
||||||
parents_vec.resize(num);
|
parents_vec.resize(num);
|
||||||
for(int i = 0; i < num; i++)
|
for (unsigned i = 0; i < num; i++)
|
||||||
parents_vec[i] = parents[i];
|
parents_vec[i] = parents[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr_vector<ast> theory_vec; // get background theory in a vector
|
ptr_vector<ast> theory_vec; // get background theory in a vector
|
||||||
if (theory){
|
if (theory){
|
||||||
theory_vec.resize(num_theory);
|
theory_vec.resize(num_theory);
|
||||||
for(int i = 0; i < num_theory; i++)
|
for (unsigned i = 0; i < num_theory; i++)
|
||||||
theory_vec[i] = to_ast(theory[i]);
|
theory_vec[i] = to_ast(theory[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +328,7 @@ static void get_file_params(const char *filename, hash_map<std::string,std::stri
|
||||||
for (unsigned i = 0; i < tokens.size(); i++){
|
for (unsigned i = 0; i < tokens.size(); i++){
|
||||||
std::string &tok = tokens[i];
|
std::string &tok = tokens[i];
|
||||||
size_t eqpos = tok.find('=');
|
size_t eqpos = tok.find('=');
|
||||||
if(eqpos >= 0 && eqpos < tok.size()){
|
if (eqpos != std::string::npos){
|
||||||
std::string left = tok.substr(0, eqpos);
|
std::string left = tok.substr(0, eqpos);
|
||||||
std::string right = tok.substr(eqpos + 1, tok.size() - eqpos - 1);
|
std::string right = tok.substr(eqpos + 1, tok.size() - eqpos - 1);
|
||||||
params[left] = right;
|
params[left] = right;
|
||||||
|
@ -441,7 +358,7 @@ extern "C" {
|
||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Z3_write_interpolation_problem(Z3_context ctx, int num, Z3_ast *cnsts, int *parents, const char *filename, int num_theory, Z3_ast *theory){
|
void Z3_write_interpolation_problem(Z3_context ctx, int num, Z3_ast *cnsts, unsigned *parents, const char *filename, int num_theory, Z3_ast *theory){
|
||||||
if(!parents){
|
if(!parents){
|
||||||
iZ3_write_seq(ctx,num,cnsts,filename,num_theory,theory);
|
iZ3_write_seq(ctx,num,cnsts,filename,num_theory,theory);
|
||||||
return;
|
return;
|
||||||
|
@ -472,13 +389,13 @@ extern "C" {
|
||||||
return (c.size() > 1) ? Z3_mk_and(ctx, c.size(), &c[0]) : c[0];
|
return (c.size() > 1) ? Z3_mk_and(ctx, c.size(), &c[0]) : c[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static Z3_ast parents_vector_to_tree(Z3_context ctx, int num, Z3_ast *cnsts, int *parents){
|
static Z3_ast parents_vector_to_tree(Z3_context ctx, int num, Z3_ast *cnsts, unsigned *parents){
|
||||||
Z3_ast res;
|
Z3_ast res;
|
||||||
if (!parents){
|
if (!parents){
|
||||||
res = Z3_mk_interp(ctx,cnsts[0]);
|
res = Z3_mk_interpolant(ctx, cnsts[0]);
|
||||||
for (int i = 1; i < num - 1; i++){
|
for (int i = 1; i < num - 1; i++){
|
||||||
Z3_ast bar[2] = { res, cnsts[i] };
|
Z3_ast bar[2] = { res, cnsts[i] };
|
||||||
res = Z3_mk_interp(ctx,Z3_mk_and(ctx,2,bar));
|
res = Z3_mk_interpolant(ctx, Z3_mk_and(ctx, 2, bar));
|
||||||
}
|
}
|
||||||
if (num > 1){
|
if (num > 1){
|
||||||
Z3_ast bar[2] = { res, cnsts[num - 1] };
|
Z3_ast bar[2] = { res, cnsts[num - 1] };
|
||||||
|
@ -490,7 +407,7 @@ extern "C" {
|
||||||
for (int i = 0; i < num - 1; i++){
|
for (int i = 0; i < num - 1; i++){
|
||||||
svector<Z3_ast> &c = chs[i];
|
svector<Z3_ast> &c = chs[i];
|
||||||
c.push_back(cnsts[i]);
|
c.push_back(cnsts[i]);
|
||||||
Z3_ast foo = Z3_mk_interp(ctx,and_vec(ctx,c));
|
Z3_ast foo = Z3_mk_interpolant(ctx, and_vec(ctx, c));
|
||||||
chs[parents[i]].push_back(foo);
|
chs[parents[i]].push_back(foo);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -503,19 +420,25 @@ extern "C" {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Z3_write_interpolation_problem(Z3_context ctx, int num, Z3_ast *cnsts, int *parents, const char *filename, int num_theory, Z3_ast *theory){
|
void Z3_write_interpolation_problem(Z3_context ctx, unsigned num, Z3_ast *cnsts, unsigned *parents, const char *filename, unsigned num_theory, Z3_ast *theory){
|
||||||
std::ofstream f(filename);
|
std::ofstream f(filename);
|
||||||
if (num > 0){
|
if (num > 0){
|
||||||
|
#if 0
|
||||||
|
// Suggested shorthand:
|
||||||
|
ptr_vector<expr> cnsts_vec;
|
||||||
|
cnsts_vec.append(num, to_exprs(cnsts));
|
||||||
|
cnsts_vec.append(num_theory, to_exprs(theory));
|
||||||
|
#endif
|
||||||
ptr_vector<expr> cnsts_vec(num); // get constraints in a vector
|
ptr_vector<expr> cnsts_vec(num); // get constraints in a vector
|
||||||
for(int i = 0; i < num; i++){
|
for (unsigned i = 0; i < num; i++){
|
||||||
expr *a = to_expr(cnsts[i]);
|
expr *a = to_expr(cnsts[i]);
|
||||||
cnsts_vec[i] = a;
|
cnsts_vec[i] = a;
|
||||||
}
|
}
|
||||||
Z3_ast tree = parents_vector_to_tree(ctx,num,cnsts,parents);
|
for (unsigned i = 0; i < num_theory; i++){
|
||||||
for(int i = 0; i < num_theory; i++){
|
|
||||||
expr *a = to_expr(theory[i]);
|
expr *a = to_expr(theory[i]);
|
||||||
cnsts_vec.push_back(a);
|
cnsts_vec.push_back(a);
|
||||||
}
|
}
|
||||||
|
Z3_ast tree = parents_vector_to_tree(ctx, num, cnsts, parents);
|
||||||
iz3pp(mk_c(ctx)->m(), cnsts_vec, to_expr(tree), f);
|
iz3pp(mk_c(ctx)->m(), cnsts_vec, to_expr(tree), f);
|
||||||
Z3_dec_ref(ctx, tree);
|
Z3_dec_ref(ctx, tree);
|
||||||
}
|
}
|
||||||
|
@ -554,7 +477,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static std::vector<Z3_ast> read_cnsts;
|
static std::vector<Z3_ast> read_cnsts;
|
||||||
static std::vector<int> read_parents;
|
static std::vector<unsigned> read_parents;
|
||||||
static std::ostringstream read_error;
|
static std::ostringstream read_error;
|
||||||
static std::string read_msg;
|
static std::string read_msg;
|
||||||
static std::vector<Z3_ast> read_theory;
|
static std::vector<Z3_ast> read_theory;
|
||||||
|
@ -597,7 +520,7 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Z3_read_interpolation_problem(Z3_context ctx, int *_num, Z3_ast **cnsts, int **parents, const char *filename, const char **error, int *ret_num_theory, Z3_ast **theory ){
|
int Z3_read_interpolation_problem(Z3_context ctx, unsigned *_num, Z3_ast *cnsts[], unsigned *parents[], const char *filename, Z3_string_ptr error, unsigned *ret_num_theory, Z3_ast *theory[]){
|
||||||
|
|
||||||
hash_map<std::string, std::string> file_params;
|
hash_map<std::string, std::string> file_params;
|
||||||
get_file_params(filename, file_params);
|
get_file_params(filename, file_params);
|
||||||
|
@ -711,3 +634,87 @@ extern "C" {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/** Constant reprepresenting a root of a formula tree for tree interpolation */
|
||||||
|
#define IZ3_ROOT SHRT_MAX
|
||||||
|
|
||||||
|
/** This function uses Z3 to determine satisfiability of a set of
|
||||||
|
constraints. If UNSAT, an interpolant is returned, based on the
|
||||||
|
refutation generated by Z3. If SAT, a model is returned.
|
||||||
|
|
||||||
|
If "parents" is non-null, computes a tree interpolant. The tree is
|
||||||
|
defined by the array "parents". This array maps each formula in
|
||||||
|
the tree to its parent, where formulas are indicated by their
|
||||||
|
integer index in "cnsts". The parent of formula n must have index
|
||||||
|
greater than n. The last formula is the root of the tree. Its
|
||||||
|
parent entry should be the constant IZ3_ROOT.
|
||||||
|
|
||||||
|
If "parents" is null, computes a sequence interpolant.
|
||||||
|
|
||||||
|
\param ctx The Z3 context. Must be generated by iz3_mk_context
|
||||||
|
\param num The number of constraints in the sequence
|
||||||
|
\param cnsts Array of constraints (AST's in context ctx)
|
||||||
|
\param parents The parents vector defining the tree structure
|
||||||
|
\param options Interpolation options (may be NULL)
|
||||||
|
\param interps Array to return interpolants (size at least num-1, may be NULL)
|
||||||
|
\param model Returns a Z3 model if constraints SAT (may be NULL)
|
||||||
|
\param labels Returns relevant labels if SAT (may be NULL)
|
||||||
|
\param incremental
|
||||||
|
|
||||||
|
VERY IMPORTANT: All the Z3 formulas in cnsts must be in Z3
|
||||||
|
context ctx. The model and interpolants returned are also
|
||||||
|
in this context.
|
||||||
|
|
||||||
|
The return code is as in Z3_check_assumptions, that is,
|
||||||
|
|
||||||
|
Z3_L_FALSE = constraints UNSAT (interpolants returned)
|
||||||
|
Z3_L_TRUE = constraints SAT (model returned)
|
||||||
|
Z3_L_UNDEF = Z3 produced no result, or interpolation not possible
|
||||||
|
|
||||||
|
Currently, this function supports integer and boolean variables,
|
||||||
|
as well as arrays over these types, with linear arithmetic,
|
||||||
|
uninterpreted functions and quantifiers over integers (that is
|
||||||
|
AUFLIA). Interpolants are produced in AULIA. However, some
|
||||||
|
uses of array operations may cause quantifiers to appear in the
|
||||||
|
interpolants even when there are no quantifiers in the input formulas.
|
||||||
|
Although quantifiers may appear in the input formulas, Z3 may give up in
|
||||||
|
this case, returning Z3_L_UNDEF.
|
||||||
|
|
||||||
|
If "incremental" is true, cnsts must contain exactly the set of
|
||||||
|
formulas that are currently asserted in the context. If false,
|
||||||
|
there must be no formulas currently asserted in the context.
|
||||||
|
Setting "incremental" to true makes it posisble to incrementally
|
||||||
|
add and remove constraints from the context until the context
|
||||||
|
becomes UNSAT, at which point an interpolant is computed. Caution
|
||||||
|
must be used, however. Before popping the context, if you wish to
|
||||||
|
keep the interolant formulas, you *must* preserve them by using
|
||||||
|
Z3_persist_ast. Also, if you want to simplify the interpolant
|
||||||
|
formulas using Z3_simplify, you must first pop all of the
|
||||||
|
assertions in the context (or use a different context). Otherwise,
|
||||||
|
the formulas will be simplified *relative* to these constraints,
|
||||||
|
which is almost certainly not what you want.
|
||||||
|
|
||||||
|
|
||||||
|
Current limitations on tree interpolants. In a tree interpolation
|
||||||
|
problem, each constant (0-ary function symbol) must occur only
|
||||||
|
along one path from root to leaf. Function symbols (of arity > 0)
|
||||||
|
are considered to have global scope (i.e., may appear in any
|
||||||
|
interpolant formula).
|
||||||
|
|
||||||
|
def_API('Z3_interpolate', BOOL, (_in(CONTEXT), _in(UINT), _in_array(1, AST), _in_array(1, UINT), _in(PARAMS), _out_array(1, AST), _out(MODEL), _out(LITERALS), _in(UINT), _in(UINT), _in_array(9, AST)))
|
||||||
|
*/
|
||||||
|
|
||||||
|
Z3_lbool Z3_API Z3_interpolate(__in Z3_context ctx,
|
||||||
|
__in unsigned num,
|
||||||
|
__in_ecount(num) Z3_ast *cnsts,
|
||||||
|
__in_ecount(num) unsigned *parents,
|
||||||
|
__in Z3_params options,
|
||||||
|
__out_ecount(num - 1) Z3_ast *interps,
|
||||||
|
__out Z3_model *model,
|
||||||
|
__out Z3_literals *labels,
|
||||||
|
__in unsigned incremental,
|
||||||
|
__in unsigned num_theory,
|
||||||
|
__in_ecount(num_theory) Z3_ast *theory);
|
||||||
|
#endif
|
|
@ -60,6 +60,7 @@ extern "C" {
|
||||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||||
RETURN_Z3(0);
|
RETURN_Z3(0);
|
||||||
}
|
}
|
||||||
|
mk_c(c)->save_ast_trail(r);
|
||||||
RETURN_Z3(of_expr(r));
|
RETURN_Z3(of_expr(r));
|
||||||
Z3_CATCH_RETURN(0);
|
Z3_CATCH_RETURN(0);
|
||||||
}
|
}
|
||||||
|
@ -263,6 +264,7 @@ extern "C" {
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
CHECK_NON_NULL(f, 0);
|
CHECK_NON_NULL(f, 0);
|
||||||
expr * e = to_func_interp_ref(f)->get_else();
|
expr * e = to_func_interp_ref(f)->get_else();
|
||||||
|
mk_c(c)->save_ast_trail(e);
|
||||||
RETURN_Z3(of_expr(e));
|
RETURN_Z3(of_expr(e));
|
||||||
Z3_CATCH_RETURN(0);
|
Z3_CATCH_RETURN(0);
|
||||||
}
|
}
|
||||||
|
@ -301,6 +303,7 @@ extern "C" {
|
||||||
LOG_Z3_func_entry_get_value(c, e);
|
LOG_Z3_func_entry_get_value(c, e);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
expr * v = to_func_entry_ref(e)->get_result();
|
expr * v = to_func_entry_ref(e)->get_result();
|
||||||
|
mk_c(c)->save_ast_trail(v);
|
||||||
RETURN_Z3(of_expr(v));
|
RETURN_Z3(of_expr(v));
|
||||||
Z3_CATCH_RETURN(0);
|
Z3_CATCH_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,11 @@ extern "C" {
|
||||||
params_ref p = s->m_params;
|
params_ref p = s->m_params;
|
||||||
mk_c(c)->params().get_solver_params(mk_c(c)->m(), p, proofs_enabled, models_enabled, unsat_core_enabled);
|
mk_c(c)->params().get_solver_params(mk_c(c)->m(), p, proofs_enabled, models_enabled, unsat_core_enabled);
|
||||||
s->m_solver = (*(s->m_solver_factory))(mk_c(c)->m(), p, proofs_enabled, models_enabled, unsat_core_enabled, s->m_logic);
|
s->m_solver = (*(s->m_solver_factory))(mk_c(c)->m(), p, proofs_enabled, models_enabled, unsat_core_enabled, s->m_logic);
|
||||||
|
|
||||||
|
param_descrs r;
|
||||||
|
s->m_solver->collect_param_descrs(r);
|
||||||
|
context_params::collect_solver_param_descrs(r);
|
||||||
|
p.validate(r);
|
||||||
s->m_solver->updt_params(p);
|
s->m_solver->updt_params(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +107,7 @@ extern "C" {
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
init_solver(c, s);
|
init_solver(c, s);
|
||||||
to_solver_ref(s)->collect_param_descrs(descrs);
|
to_solver_ref(s)->collect_param_descrs(descrs);
|
||||||
|
context_params::collect_solver_param_descrs(descrs);
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
to_solver(s)->m_solver = 0;
|
to_solver(s)->m_solver = 0;
|
||||||
descrs.display(buffer);
|
descrs.display(buffer);
|
||||||
|
@ -119,6 +125,7 @@ extern "C" {
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
init_solver(c, s);
|
init_solver(c, s);
|
||||||
to_solver_ref(s)->collect_param_descrs(d->m_descrs);
|
to_solver_ref(s)->collect_param_descrs(d->m_descrs);
|
||||||
|
context_params::collect_solver_param_descrs(d->m_descrs);
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
to_solver(s)->m_solver = 0;
|
to_solver(s)->m_solver = 0;
|
||||||
Z3_param_descrs r = of_param_descrs(d);
|
Z3_param_descrs r = of_param_descrs(d);
|
||||||
|
@ -130,14 +137,19 @@ extern "C" {
|
||||||
Z3_TRY;
|
Z3_TRY;
|
||||||
LOG_Z3_solver_set_params(c, s, p);
|
LOG_Z3_solver_set_params(c, s, p);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
|
|
||||||
if (to_solver(s)->m_solver) {
|
if (to_solver(s)->m_solver) {
|
||||||
bool old_model = to_solver(s)->m_params.get_bool("model", true);
|
bool old_model = to_solver(s)->m_params.get_bool("model", true);
|
||||||
bool new_model = to_param_ref(p).get_bool("model", true);
|
bool new_model = to_param_ref(p).get_bool("model", true);
|
||||||
if (old_model != new_model)
|
if (old_model != new_model)
|
||||||
to_solver_ref(s)->set_produce_models(new_model);
|
to_solver_ref(s)->set_produce_models(new_model);
|
||||||
|
param_descrs r;
|
||||||
|
to_solver_ref(s)->collect_param_descrs(r);
|
||||||
|
context_params::collect_solver_param_descrs(r);
|
||||||
|
to_param_ref(p).validate(r);
|
||||||
to_solver_ref(s)->updt_params(to_param_ref(p));
|
to_solver_ref(s)->updt_params(to_param_ref(p));
|
||||||
}
|
}
|
||||||
to_solver(s)->m_params = to_param_ref(p);
|
to_solver(s)->m_params.append(to_param_ref(p));
|
||||||
Z3_CATCH;
|
Z3_CATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ extern "C" {
|
||||||
LOG_Z3_pop(c, num_scopes);
|
LOG_Z3_pop(c, num_scopes);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
CHECK_SEARCHING(c);
|
CHECK_SEARCHING(c);
|
||||||
if (num_scopes > mk_c(c)->get_smt_kernel().get_scope_level()) {
|
if (num_scopes > mk_c(c)->get_num_scopes()) {
|
||||||
SET_ERROR_CODE(Z3_IOB);
|
SET_ERROR_CODE(Z3_IOB);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,6 +222,9 @@ extern "C" {
|
||||||
Z3_TRY;
|
Z3_TRY;
|
||||||
LOG_Z3_tactic_using_params(c, t, p);
|
LOG_Z3_tactic_using_params(c, t, p);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
|
param_descrs r;
|
||||||
|
to_tactic_ref(t)->collect_param_descrs(r);
|
||||||
|
to_param_ref(p).validate(r);
|
||||||
tactic * new_t = using_params(to_tactic_ref(t), to_param_ref(p));
|
tactic * new_t = using_params(to_tactic_ref(t), to_param_ref(p));
|
||||||
RETURN_TACTIC(new_t);
|
RETURN_TACTIC(new_t);
|
||||||
Z3_CATCH_RETURN(0);
|
Z3_CATCH_RETURN(0);
|
||||||
|
@ -447,6 +450,9 @@ extern "C" {
|
||||||
Z3_TRY;
|
Z3_TRY;
|
||||||
LOG_Z3_tactic_apply_ex(c, t, g, p);
|
LOG_Z3_tactic_apply_ex(c, t, g, p);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
|
param_descrs pd;
|
||||||
|
to_tactic_ref(t)->collect_param_descrs(pd);
|
||||||
|
to_param_ref(p).validate(pd);
|
||||||
Z3_apply_result r = _tactic_apply(c, t, g, to_param_ref(p));
|
Z3_apply_result r = _tactic_apply(c, t, g, to_param_ref(p));
|
||||||
RETURN_Z3(r);
|
RETURN_Z3(r);
|
||||||
Z3_CATCH_RETURN(0);
|
Z3_CATCH_RETURN(0);
|
||||||
|
|
|
@ -85,6 +85,8 @@ namespace z3 {
|
||||||
friend std::ostream & operator<<(std::ostream & out, exception const & e) { out << e.msg(); return out; }
|
friend std::ostream & operator<<(std::ostream & out, exception const & e) { out << e.msg(); return out; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Z3 global configuration object.
|
\brief Z3 global configuration object.
|
||||||
*/
|
*/
|
||||||
|
@ -269,8 +271,9 @@ namespace z3 {
|
||||||
object(object const & s):m_ctx(s.m_ctx) {}
|
object(object const & s):m_ctx(s.m_ctx) {}
|
||||||
context & ctx() const { return *m_ctx; }
|
context & ctx() const { return *m_ctx; }
|
||||||
void check_error() const { m_ctx->check_error(); }
|
void check_error() const { m_ctx->check_error(); }
|
||||||
friend void check_context(object const & a, object const & b) { assert(a.m_ctx == b.m_ctx); }
|
friend void check_context(object const & a, object const & b);
|
||||||
};
|
};
|
||||||
|
inline void check_context(object const & a, object const & b) { assert(a.m_ctx == b.m_ctx); }
|
||||||
|
|
||||||
class symbol : public object {
|
class symbol : public object {
|
||||||
Z3_symbol m_sym;
|
Z3_symbol m_sym;
|
||||||
|
@ -291,6 +294,7 @@ namespace z3 {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class params : public object {
|
class params : public object {
|
||||||
Z3_params m_params;
|
Z3_params m_params;
|
||||||
public:
|
public:
|
||||||
|
@ -309,7 +313,9 @@ namespace z3 {
|
||||||
void set(char const * k, unsigned n) { Z3_params_set_uint(ctx(), m_params, ctx().str_symbol(k), n); }
|
void set(char const * k, unsigned n) { Z3_params_set_uint(ctx(), m_params, ctx().str_symbol(k), n); }
|
||||||
void set(char const * k, double n) { Z3_params_set_double(ctx(), m_params, ctx().str_symbol(k), n); }
|
void set(char const * k, double n) { Z3_params_set_double(ctx(), m_params, ctx().str_symbol(k), n); }
|
||||||
void set(char const * k, symbol const & s) { Z3_params_set_symbol(ctx(), m_params, ctx().str_symbol(k), s); }
|
void set(char const * k, symbol const & s) { Z3_params_set_symbol(ctx(), m_params, ctx().str_symbol(k), s); }
|
||||||
friend std::ostream & operator<<(std::ostream & out, params const & p) { out << Z3_params_to_string(p.ctx(), p); return out; }
|
friend std::ostream & operator<<(std::ostream & out, params const & p) {
|
||||||
|
out << Z3_params_to_string(p.ctx(), p); return out;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ast : public object {
|
class ast : public object {
|
||||||
|
@ -325,14 +331,19 @@ namespace z3 {
|
||||||
ast & operator=(ast const & s) { Z3_inc_ref(s.ctx(), s.m_ast); if (m_ast) Z3_dec_ref(ctx(), m_ast); m_ctx = s.m_ctx; m_ast = s.m_ast; return *this; }
|
ast & operator=(ast const & s) { Z3_inc_ref(s.ctx(), s.m_ast); if (m_ast) Z3_dec_ref(ctx(), m_ast); m_ctx = s.m_ctx; m_ast = s.m_ast; return *this; }
|
||||||
Z3_ast_kind kind() const { Z3_ast_kind r = Z3_get_ast_kind(ctx(), m_ast); check_error(); return r; }
|
Z3_ast_kind kind() const { Z3_ast_kind r = Z3_get_ast_kind(ctx(), m_ast); check_error(); return r; }
|
||||||
unsigned hash() const { unsigned r = Z3_get_ast_hash(ctx(), m_ast); check_error(); return r; }
|
unsigned hash() const { unsigned r = Z3_get_ast_hash(ctx(), m_ast); check_error(); return r; }
|
||||||
friend std::ostream & operator<<(std::ostream & out, ast const & n) { out << Z3_ast_to_string(n.ctx(), n.m_ast); return out; }
|
friend std::ostream & operator<<(std::ostream & out, ast const & n) {
|
||||||
|
out << Z3_ast_to_string(n.ctx(), n.m_ast); return out;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Return true if the ASTs are structurally identical.
|
\brief Return true if the ASTs are structurally identical.
|
||||||
*/
|
*/
|
||||||
friend bool eq(ast const & a, ast const & b) { return Z3_is_eq_ast(a.ctx(), a, b) != 0; }
|
friend bool eq(ast const & a, ast const & b);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline bool eq(ast const & a, ast const & b) { return Z3_is_eq_ast(a.ctx(), a, b) != 0; }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief A Z3 sort (aka type). Every expression (i.e., formula or term) in Z3 has a sort.
|
\brief A Z3 sort (aka type). Every expression (i.e., formula or term) in Z3 has a sort.
|
||||||
*/
|
*/
|
||||||
|
@ -570,6 +581,7 @@ namespace z3 {
|
||||||
return expr(a.ctx(), r);
|
return expr(a.ctx(), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Return an expression representing <tt>a and b</tt>.
|
\brief Return an expression representing <tt>a and b</tt>.
|
||||||
|
|
||||||
|
@ -585,6 +597,7 @@ namespace z3 {
|
||||||
return expr(a.ctx(), r);
|
return expr(a.ctx(), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Return an expression representing <tt>a and b</tt>.
|
\brief Return an expression representing <tt>a and b</tt>.
|
||||||
The C++ Boolean value \c b is automatically converted into a Z3 Boolean constant.
|
The C++ Boolean value \c b is automatically converted into a Z3 Boolean constant.
|
||||||
|
@ -636,21 +649,10 @@ namespace z3 {
|
||||||
a.check_error();
|
a.check_error();
|
||||||
return expr(a.ctx(), r);
|
return expr(a.ctx(), r);
|
||||||
}
|
}
|
||||||
friend expr implies(expr const & a, bool b) { return implies(a, a.ctx().bool_val(b)); }
|
friend expr implies(expr const & a, bool b);
|
||||||
friend expr implies(bool a, expr const & b) { return implies(b.ctx().bool_val(a), b); }
|
friend expr implies(bool a, expr const & b);
|
||||||
|
|
||||||
/**
|
friend expr ite(expr const & c, expr const & t, expr const & e);
|
||||||
\brief Create the if-then-else expression <tt>ite(c, t, e)</tt>
|
|
||||||
|
|
||||||
\pre c.is_bool()
|
|
||||||
*/
|
|
||||||
friend expr ite(expr const & c, expr const & t, expr const & e) {
|
|
||||||
check_context(c, t); check_context(c, e);
|
|
||||||
assert(c.is_bool());
|
|
||||||
Z3_ast r = Z3_mk_ite(c.ctx(), c, t, e);
|
|
||||||
c.check_error();
|
|
||||||
return expr(c.ctx(), r);
|
|
||||||
}
|
|
||||||
|
|
||||||
friend expr distinct(expr_vector const& args);
|
friend expr distinct(expr_vector const& args);
|
||||||
|
|
||||||
|
@ -716,15 +718,9 @@ namespace z3 {
|
||||||
/**
|
/**
|
||||||
\brief Power operator
|
\brief Power operator
|
||||||
*/
|
*/
|
||||||
friend expr pw(expr const & a, expr const & b) {
|
friend expr pw(expr const & a, expr const & b);
|
||||||
assert(a.is_arith() && b.is_arith());
|
friend expr pw(expr const & a, int b);
|
||||||
check_context(a, b);
|
friend expr pw(int a, expr const & b);
|
||||||
Z3_ast r = Z3_mk_power(a.ctx(), a, b);
|
|
||||||
a.check_error();
|
|
||||||
return expr(a.ctx(), r);
|
|
||||||
}
|
|
||||||
friend expr pw(expr const & a, int b) { return pw(a, a.ctx().num_val(b, a.get_sort())); }
|
|
||||||
friend expr pw(int a, expr const & b) { return pw(b.ctx().num_val(a, b.get_sort()), b); }
|
|
||||||
|
|
||||||
friend expr operator/(expr const & a, expr const & b) {
|
friend expr operator/(expr const & a, expr const & b) {
|
||||||
check_context(a, b);
|
check_context(a, b);
|
||||||
|
@ -892,6 +888,38 @@ namespace z3 {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline expr implies(expr const & a, bool b) { return implies(a, a.ctx().bool_val(b)); }
|
||||||
|
inline expr implies(bool a, expr const & b) { return implies(b.ctx().bool_val(a), b); }
|
||||||
|
|
||||||
|
inline expr pw(expr const & a, expr const & b) {
|
||||||
|
assert(a.is_arith() && b.is_arith());
|
||||||
|
check_context(a, b);
|
||||||
|
Z3_ast r = Z3_mk_power(a.ctx(), a, b);
|
||||||
|
a.check_error();
|
||||||
|
return expr(a.ctx(), r);
|
||||||
|
}
|
||||||
|
inline expr pw(expr const & a, int b) { return pw(a, a.ctx().num_val(b, a.get_sort())); }
|
||||||
|
inline expr pw(int a, expr const & b) { return pw(b.ctx().num_val(a, b.get_sort()), b); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Create the if-then-else expression <tt>ite(c, t, e)</tt>
|
||||||
|
|
||||||
|
\pre c.is_bool()
|
||||||
|
*/
|
||||||
|
|
||||||
|
inline expr ite(expr const & c, expr const & t, expr const & e) {
|
||||||
|
check_context(c, t); check_context(c, e);
|
||||||
|
assert(c.is_bool());
|
||||||
|
Z3_ast r = Z3_mk_ite(c.ctx(), c, t, e);
|
||||||
|
c.check_error();
|
||||||
|
return expr(c.ctx(), r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Wraps a Z3_ast as an expr object. It also checks for errors.
|
\brief Wraps a Z3_ast as an expr object. It also checks for errors.
|
||||||
This function allows the user to use the whole C API with the C++ layer defined in this file.
|
This function allows the user to use the whole C API with the C++ layer defined in this file.
|
||||||
|
@ -1404,22 +1432,28 @@ namespace z3 {
|
||||||
t1.check_error();
|
t1.check_error();
|
||||||
return tactic(t1.ctx(), r);
|
return tactic(t1.ctx(), r);
|
||||||
}
|
}
|
||||||
friend tactic repeat(tactic const & t, unsigned max=UINT_MAX) {
|
friend tactic repeat(tactic const & t, unsigned max);
|
||||||
|
friend tactic with(tactic const & t, params const & p);
|
||||||
|
friend tactic try_for(tactic const & t, unsigned ms);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline tactic repeat(tactic const & t, unsigned max=UINT_MAX) {
|
||||||
Z3_tactic r = Z3_tactic_repeat(t.ctx(), t, max);
|
Z3_tactic r = Z3_tactic_repeat(t.ctx(), t, max);
|
||||||
t.check_error();
|
t.check_error();
|
||||||
return tactic(t.ctx(), r);
|
return tactic(t.ctx(), r);
|
||||||
}
|
}
|
||||||
friend tactic with(tactic const & t, params const & p) {
|
|
||||||
|
inline tactic with(tactic const & t, params const & p) {
|
||||||
Z3_tactic r = Z3_tactic_using_params(t.ctx(), t, p);
|
Z3_tactic r = Z3_tactic_using_params(t.ctx(), t, p);
|
||||||
t.check_error();
|
t.check_error();
|
||||||
return tactic(t.ctx(), r);
|
return tactic(t.ctx(), r);
|
||||||
}
|
}
|
||||||
friend tactic try_for(tactic const & t, unsigned ms) {
|
inline tactic try_for(tactic const & t, unsigned ms) {
|
||||||
Z3_tactic r = Z3_tactic_try_for(t.ctx(), t, ms);
|
Z3_tactic r = Z3_tactic_try_for(t.ctx(), t, ms);
|
||||||
t.check_error();
|
t.check_error();
|
||||||
return tactic(t.ctx(), r);
|
return tactic(t.ctx(), r);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
class probe : public object {
|
class probe : public object {
|
||||||
Z3_probe m_probe;
|
Z3_probe m_probe;
|
||||||
|
|
|
@ -3527,28 +3527,11 @@ namespace Microsoft.Z3
|
||||||
/// Only a few configuration parameters are mutable once the context is created.
|
/// Only a few configuration parameters are mutable once the context is created.
|
||||||
/// An exception is thrown when trying to modify an immutable parameter.
|
/// An exception is thrown when trying to modify an immutable parameter.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <seealso cref="GetParamValue"/>
|
|
||||||
public void UpdateParamValue(string id, string value)
|
public void UpdateParamValue(string id, string value)
|
||||||
{
|
{
|
||||||
Native.Z3_update_param_value(nCtx, id, value);
|
Native.Z3_update_param_value(nCtx, id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a configuration parameter.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Returns null if the parameter value does not exist.
|
|
||||||
/// </remarks>
|
|
||||||
/// <seealso cref="UpdateParamValue"/>
|
|
||||||
public string GetParamValue(string id)
|
|
||||||
{
|
|
||||||
IntPtr res = IntPtr.Zero;
|
|
||||||
if (Native.Z3_get_param_value(nCtx, id, out res) == 0)
|
|
||||||
return null;
|
|
||||||
else
|
|
||||||
return Marshal.PtrToStringAnsi(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Internal
|
#region Internal
|
||||||
|
|
|
@ -323,6 +323,14 @@ namespace Microsoft.Z3
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Interpolation
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the term is marked for interpolation.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks></remarks>
|
||||||
|
public bool IsInterpolant { get { return IsApp && FuncDecl.DeclKind == Z3_decl_kind.Z3_OP_INTERP; } }
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Arithmetic Terms
|
#region Arithmetic Terms
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates whether the term is of integer sort.
|
/// Indicates whether the term is of integer sort.
|
||||||
|
|
162
src/api/dotnet/InterpolationContext.cs
Normal file
162
src/api/dotnet/InterpolationContext.cs
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Diagnostics.Contracts;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Microsoft.Z3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The InterpolationContext is suitable for generation of interpolants.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For more information on interpolation please refer
|
||||||
|
/// too the C/C++ API, which is well documented.</remarks>
|
||||||
|
[ContractVerification(true)]
|
||||||
|
class InterpolationContext : Context
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
public InterpolationContext() : base() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks><seealso cref="Context.Context(Dictionary<string, string>)"/></remarks>
|
||||||
|
public InterpolationContext(Dictionary<string, string> settings) : base(settings) { }
|
||||||
|
|
||||||
|
#region Terms
|
||||||
|
/// <summary>
|
||||||
|
/// Create an expression that marks a formula position for interpolation.
|
||||||
|
/// </summary>
|
||||||
|
public BoolExpr MkInterpolant(BoolExpr a)
|
||||||
|
{
|
||||||
|
Contract.Requires(a != null);
|
||||||
|
Contract.Ensures(Contract.Result<BoolExpr>() != null);
|
||||||
|
|
||||||
|
CheckContextMatch(a);
|
||||||
|
return new BoolExpr(this, Native.Z3_mk_interpolant(nCtx, a.NativeObject));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Computes an interpolant.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For more information on interpolation please refer
|
||||||
|
/// too the function Z3_get_interpolant in the C/C++ API, which is
|
||||||
|
/// well documented.</remarks>
|
||||||
|
Expr[] GetInterpolant(Expr pf, Expr pat, Params p)
|
||||||
|
{
|
||||||
|
Contract.Requires(pf != null);
|
||||||
|
Contract.Requires(pat != null);
|
||||||
|
Contract.Requires(p != null);
|
||||||
|
Contract.Ensures(Contract.Result<Expr>() != null);
|
||||||
|
|
||||||
|
CheckContextMatch(pf);
|
||||||
|
CheckContextMatch(pat);
|
||||||
|
CheckContextMatch(p);
|
||||||
|
|
||||||
|
ASTVector seq = new ASTVector(this, Native.Z3_get_interpolant(nCtx, pf.NativeObject, pat.NativeObject, p.NativeObject));
|
||||||
|
uint n = seq.Size;
|
||||||
|
Expr[] res = new Expr[n];
|
||||||
|
for (uint i = 0; i < n; i++)
|
||||||
|
res[i] = Expr.Create(this, seq[i].NativeObject);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Computes an interpolant.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For more information on interpolation please refer
|
||||||
|
/// too the function Z3_compute_interpolant in the C/C++ API, which is
|
||||||
|
/// well documented.</remarks>
|
||||||
|
Z3_lbool ComputeInterpolant(Expr pat, Params p, out ASTVector interp, out Model model)
|
||||||
|
{
|
||||||
|
Contract.Requires(pat != null);
|
||||||
|
Contract.Requires(p != null);
|
||||||
|
Contract.Ensures(Contract.ValueAtReturn(out interp) != null);
|
||||||
|
Contract.Ensures(Contract.ValueAtReturn(out model) != null);
|
||||||
|
|
||||||
|
CheckContextMatch(pat);
|
||||||
|
CheckContextMatch(p);
|
||||||
|
|
||||||
|
IntPtr i = IntPtr.Zero, m = IntPtr.Zero;
|
||||||
|
int r = Native.Z3_compute_interpolant(nCtx, pat.NativeObject, p.NativeObject, ref i, ref m);
|
||||||
|
interp = new ASTVector(this, i);
|
||||||
|
model = new Model(this, m);
|
||||||
|
return (Z3_lbool)r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return a string summarizing cumulative time used for interpolation.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For more information on interpolation please refer
|
||||||
|
/// too the function Z3_interpolation_profile in the C/C++ API, which is
|
||||||
|
/// well documented.</remarks>
|
||||||
|
public string InterpolationProfile()
|
||||||
|
{
|
||||||
|
return Native.Z3_interpolation_profile(nCtx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks the correctness of an interpolant.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For more information on interpolation please refer
|
||||||
|
/// too the function Z3_check_interpolant in the C/C++ API, which is
|
||||||
|
/// well documented.</remarks>
|
||||||
|
public int CheckInterpolant(Expr[] cnsts, uint[] parents, Expr[] interps, out string error, Expr[] theory)
|
||||||
|
{
|
||||||
|
Contract.Requires(cnsts.Length == parents.Length);
|
||||||
|
Contract.Requires(cnsts.Length == interps.Length + 1);
|
||||||
|
IntPtr n_err_str;
|
||||||
|
int r = Native.Z3_check_interpolant(nCtx,
|
||||||
|
(uint)cnsts.Length,
|
||||||
|
Expr.ArrayToNative(cnsts),
|
||||||
|
parents,
|
||||||
|
Expr.ArrayToNative(interps),
|
||||||
|
out n_err_str,
|
||||||
|
(uint)theory.Length,
|
||||||
|
Expr.ArrayToNative(theory));
|
||||||
|
error = Marshal.PtrToStringAnsi(n_err_str);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reads an interpolation problem from a file.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For more information on interpolation please refer
|
||||||
|
/// too the function Z3_read_interpolation_problem in the C/C++ API, which is
|
||||||
|
/// well documented.</remarks>
|
||||||
|
public int ReadInterpolationProblem(string filename, out Expr[] cnsts, out uint[] parents, out string error, out Expr[] theory)
|
||||||
|
{
|
||||||
|
uint num = 0, num_theory = 0;
|
||||||
|
IntPtr[] n_cnsts;
|
||||||
|
IntPtr[] n_theory;
|
||||||
|
IntPtr n_err_str;
|
||||||
|
int r = Native.Z3_read_interpolation_problem(nCtx, ref num, out n_cnsts, out parents, filename, out n_err_str, ref num_theory, out n_theory);
|
||||||
|
error = Marshal.PtrToStringAnsi(n_err_str);
|
||||||
|
cnsts = new Expr[num];
|
||||||
|
parents = new uint[num];
|
||||||
|
theory = new Expr[num_theory];
|
||||||
|
for (int i = 0; i < num; i++)
|
||||||
|
cnsts[i] = Expr.Create(this, n_cnsts[i]);
|
||||||
|
for (int i = 0; i < num_theory; i++)
|
||||||
|
theory[i] = Expr.Create(this, n_theory[i]);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes an interpolation problem to a file.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For more information on interpolation please refer
|
||||||
|
/// too the function Z3_write_interpolation_problem in the C/C++ API, which is
|
||||||
|
/// well documented.</remarks>
|
||||||
|
public void WriteInterpolationProblem(string filename, Expr[] cnsts, uint[] parents, Expr[] theory)
|
||||||
|
{
|
||||||
|
Contract.Requires(cnsts.Length == parents.Length);
|
||||||
|
Native.Z3_write_interpolation_problem(nCtx, (uint)cnsts.Length, Expr.ArrayToNative(cnsts), parents, filename, (uint)theory.Length, Expr.ArrayToNative(theory));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,12 +19,12 @@
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\Debug\</OutputPath>
|
<OutputPath>..\..\..\..\..\cwinter\bugs\z3bugs\Debug\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<DocumentationFile>..\Debug\Microsoft.Z3.XML</DocumentationFile>
|
<DocumentationFile>C:\cwinter\bugs\z3bugs\Debug\Microsoft.Z3.XML</DocumentationFile>
|
||||||
<CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking>
|
<CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking>
|
||||||
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
|
<CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
|
||||||
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
|
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure>
|
||||||
|
@ -254,7 +254,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
<OutputPath>..\..\..\..\..\cwinter\bugs\z3bugs\Debug\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
|
@ -266,7 +266,7 @@
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
<DocumentationFile>bin\x86\Debug\Microsoft.Z3.XML</DocumentationFile>
|
<DocumentationFile>C:\cwinter\bugs\z3bugs\Debug\Microsoft.Z3.XML</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||||
<OutputPath>bin\x86\Release\</OutputPath>
|
<OutputPath>bin\x86\Release\</OutputPath>
|
||||||
|
@ -352,6 +352,7 @@
|
||||||
<Compile Include="FuncDecl.cs" />
|
<Compile Include="FuncDecl.cs" />
|
||||||
<Compile Include="FuncInterp.cs" />
|
<Compile Include="FuncInterp.cs" />
|
||||||
<Compile Include="Goal.cs" />
|
<Compile Include="Goal.cs" />
|
||||||
|
<Compile Include="InterpolationContext.cs" />
|
||||||
<Compile Include="IntExpr.cs" />
|
<Compile Include="IntExpr.cs" />
|
||||||
<Compile Include="IntNum.cs" />
|
<Compile Include="IntNum.cs" />
|
||||||
<Compile Include="IntSort.cs" />
|
<Compile Include="IntSort.cs" />
|
||||||
|
|
|
@ -58,6 +58,16 @@ namespace Microsoft.Z3
|
||||||
Native.Z3_params_set_double(Context.nCtx, NativeObject, name.NativeObject, value);
|
Native.Z3_params_set_double(Context.nCtx, NativeObject, name.NativeObject, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a parameter setting.
|
||||||
|
/// </summary>
|
||||||
|
public void Add(Symbol name, string value)
|
||||||
|
{
|
||||||
|
Contract.Requires(value != null);
|
||||||
|
|
||||||
|
Native.Z3_params_set_symbol(Context.nCtx, NativeObject, name.NativeObject, Context.MkSymbol(value).NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a parameter setting.
|
/// Adds a parameter setting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -103,6 +113,16 @@ namespace Microsoft.Z3
|
||||||
Native.Z3_params_set_symbol(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, value.NativeObject);
|
Native.Z3_params_set_symbol(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, value.NativeObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a parameter setting.
|
||||||
|
/// </summary>
|
||||||
|
public void Add(string name, string value)
|
||||||
|
{
|
||||||
|
Contract.Requires(value != null);
|
||||||
|
|
||||||
|
Native.Z3_params_set_symbol(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, Context.MkSymbol(value).NativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A string representation of the parameter set.
|
/// A string representation of the parameter set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -74,9 +74,10 @@ namespace Microsoft.Z3
|
||||||
Contract.Requires(name != null);
|
Contract.Requires(name != null);
|
||||||
|
|
||||||
IntPtr t = IntPtr.Zero;
|
IntPtr t = IntPtr.Zero;
|
||||||
|
IntPtr[] f = new IntPtr[numFields];
|
||||||
NativeObject = Native.Z3_mk_tuple_sort(ctx.nCtx, name.NativeObject, numFields,
|
NativeObject = Native.Z3_mk_tuple_sort(ctx.nCtx, name.NativeObject, numFields,
|
||||||
Symbol.ArrayToNative(fieldNames), AST.ArrayToNative(fieldSorts),
|
Symbol.ArrayToNative(fieldNames), AST.ArrayToNative(fieldSorts),
|
||||||
ref t, new IntPtr[numFields]);
|
ref t, f);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from AST.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
AST.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
ASTDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from ASTMap.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
ASTMap.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from ASTVector.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
ASTVector.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from AlgebraicNum.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
AlgebraicNum.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from ApplyResult.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
ApplyResult.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
ApplyResultDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,8 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from ArithExpr.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
* **/
|
|
||||||
|
ArithExpr.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from ArithSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
ArithSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from ArrayExpr.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
ArrayExpr.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from ArraySort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
ArraySort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
AstMapDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
AstVectorDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from BitVecExpr.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
BitVecExpr.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from BitVecNum.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
BitVecNum.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,8 +1,20 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from BitVecSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
BitVecSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from BoolExpr.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
BoolExpr.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from BoolSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
BoolSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Constructor.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Constructor.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from ConstructorList.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
ConstructorList.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Context.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Context.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
@ -2904,27 +2915,13 @@ public class Context extends IDisposable
|
||||||
* configuration parameters can be obtained using the Z3 executable:
|
* configuration parameters can be obtained using the Z3 executable:
|
||||||
* <code>z3.exe -ini?</code> Only a few configuration parameters are mutable
|
* <code>z3.exe -ini?</code> Only a few configuration parameters are mutable
|
||||||
* once the context is created. An exception is thrown when trying to modify
|
* once the context is created. An exception is thrown when trying to modify
|
||||||
* an immutable parameter. </remarks> <seealso cref="GetParamValue"/>
|
* an immutable parameter. </remarks>
|
||||||
**/
|
**/
|
||||||
public void updateParamValue(String id, String value) throws Z3Exception
|
public void updateParamValue(String id, String value) throws Z3Exception
|
||||||
{
|
{
|
||||||
Native.updateParamValue(nCtx(), id, value);
|
Native.updateParamValue(nCtx(), id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a configuration parameter. <remarks> Returns null if the parameter
|
|
||||||
* value does not exist. </remarks> <seealso cref="UpdateParamValue"/>
|
|
||||||
**/
|
|
||||||
public String getParamValue(String id) throws Z3Exception
|
|
||||||
{
|
|
||||||
Native.StringPtr res = new Native.StringPtr();
|
|
||||||
boolean r = Native.getParamValue(nCtx(), id, res);
|
|
||||||
if (!r)
|
|
||||||
return null;
|
|
||||||
else
|
|
||||||
return res.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
long m_ctx = 0;
|
long m_ctx = 0;
|
||||||
|
|
||||||
long nCtx()
|
long nCtx()
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from DatatypeExpr.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
DatatypeExpr.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from DatatypeSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
DatatypeSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from EnumSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
EnumSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Expr.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Expr.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from FiniteDomainSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
FiniteDomainSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Fixedpoint.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Fixedpoint.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
FixedpointDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from FuncDecl.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
FuncDecl.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from FuncInterp.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
FuncInterp.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
FuncInterpDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
FuncInterpEntryDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Global.java
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Global.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Goal.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Goal.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
GoalDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from IDecRefQueue.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
IDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from IntExpr.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
IntExpr.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from IntNum.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
IntNum.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from IntSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
IntSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from IntSymbol.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
IntSymbol.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
183
src/api/java/InterpolationContext.java
Normal file
183
src/api/java/InterpolationContext.java
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
/**
|
||||||
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
InterpolationContext.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
package com.microsoft.z3;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
import com.microsoft.z3.Native.IntPtr;
|
||||||
|
import com.microsoft.z3.Native.UIntArrayPtr;
|
||||||
|
import com.microsoft.z3.enumerations.Z3_lbool;
|
||||||
|
|
||||||
|
/** <summary>
|
||||||
|
* The InterpolationContext is suitable for generation of interpolants.
|
||||||
|
* </summary>
|
||||||
|
* <remarks>For more information on interpolation please refer
|
||||||
|
* too the C/C++ API, which is well documented.</remarks>
|
||||||
|
**/
|
||||||
|
public class InterpolationContext extends Context
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
**/
|
||||||
|
public InterpolationContext() throws Z3Exception
|
||||||
|
{
|
||||||
|
m_ctx = Native.mkInterpolationContext(0);
|
||||||
|
initContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* <remarks><seealso cref="Context.Context(Dictionary<string, string>)"/></remarks>
|
||||||
|
**/
|
||||||
|
public InterpolationContext(Map<String, String> settings) throws Z3Exception
|
||||||
|
{
|
||||||
|
long cfg = Native.mkConfig();
|
||||||
|
for (Map.Entry<String, String> kv : settings.entrySet())
|
||||||
|
Native.setParamValue(cfg, kv.getKey(), kv.getValue());
|
||||||
|
m_ctx = Native.mkInterpolationContext(cfg);
|
||||||
|
Native.delConfig(cfg);
|
||||||
|
initContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an expression that marks a formula position for interpolation.
|
||||||
|
* @throws Z3Exception
|
||||||
|
**/
|
||||||
|
public BoolExpr MkInterpolant(BoolExpr a) throws Z3Exception
|
||||||
|
{
|
||||||
|
checkContextMatch(a);
|
||||||
|
return new BoolExpr(this, Native.mkInterpolant(nCtx(), a.getNativeObject()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes an interpolant.
|
||||||
|
* <remarks>For more information on interpolation please refer
|
||||||
|
* too the function Z3_get_interpolant in the C/C++ API, which is
|
||||||
|
* well documented.</remarks>
|
||||||
|
* @throws Z3Exception
|
||||||
|
**/
|
||||||
|
Expr[] GetInterpolant(Expr pf, Expr pat, Params p) throws Z3Exception
|
||||||
|
{
|
||||||
|
checkContextMatch(pf);
|
||||||
|
checkContextMatch(pat);
|
||||||
|
checkContextMatch(p);
|
||||||
|
|
||||||
|
ASTVector seq = new ASTVector(this, Native.getInterpolant(nCtx(), pf.getNativeObject(), pat.getNativeObject(), p.getNativeObject()));
|
||||||
|
int n = seq.size();
|
||||||
|
Expr[] res = new Expr[n];
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
res[i] = Expr.create(this, seq.get(i).getNativeObject());
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes an interpolant.
|
||||||
|
* <remarks>For more information on interpolation please refer
|
||||||
|
* too the function Z3_compute_interpolant in the C/C++ API, which is
|
||||||
|
* well documented.</remarks>
|
||||||
|
* @throws Z3Exception
|
||||||
|
**/
|
||||||
|
Z3_lbool ComputeInterpolant(Expr pat, Params p, ASTVector interp, Model model) throws Z3Exception
|
||||||
|
{
|
||||||
|
checkContextMatch(pat);
|
||||||
|
checkContextMatch(p);
|
||||||
|
|
||||||
|
Native.LongPtr n_i = new Native.LongPtr();
|
||||||
|
Native.LongPtr n_m = new Native.LongPtr();
|
||||||
|
int r = Native.computeInterpolant(nCtx(), pat.getNativeObject(), p.getNativeObject(), n_i, n_m);
|
||||||
|
interp = new ASTVector(this, n_i.value);
|
||||||
|
model = new Model(this, n_m.value);
|
||||||
|
return Z3_lbool.fromInt(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return a string summarizing cumulative time used for interpolation.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For more information on interpolation please refer
|
||||||
|
/// too the function Z3_interpolation_profile in the C/C++ API, which is
|
||||||
|
/// well documented.</remarks>
|
||||||
|
public String InterpolationProfile() throws Z3Exception
|
||||||
|
{
|
||||||
|
return Native.interpolationProfile(nCtx());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks the correctness of an interpolant.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For more information on interpolation please refer
|
||||||
|
/// too the function Z3_check_interpolant in the C/C++ API, which is
|
||||||
|
/// well documented.</remarks>
|
||||||
|
public int CheckInterpolant(Expr[] cnsts, int[] parents, Expr[] interps, String error, Expr[] theory) throws Z3Exception
|
||||||
|
{
|
||||||
|
Native.StringPtr n_err_str = new Native.StringPtr();
|
||||||
|
int r = Native.checkInterpolant(nCtx(),
|
||||||
|
cnsts.length,
|
||||||
|
Expr.arrayToNative(cnsts),
|
||||||
|
parents,
|
||||||
|
Expr.arrayToNative(interps),
|
||||||
|
n_err_str,
|
||||||
|
theory.length,
|
||||||
|
Expr.arrayToNative(theory));
|
||||||
|
error = n_err_str.value;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reads an interpolation problem from a file.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For more information on interpolation please refer
|
||||||
|
/// too the function Z3_read_interpolation_problem in the C/C++ API, which is
|
||||||
|
/// well documented.</remarks>
|
||||||
|
public int ReadInterpolationProblem(String filename, Expr[] cnsts, int[] parents, String error, Expr[] theory) throws Z3Exception
|
||||||
|
{
|
||||||
|
Native.IntPtr n_num = new Native.IntPtr();
|
||||||
|
Native.IntPtr n_num_theory = new Native.IntPtr();
|
||||||
|
Native.ObjArrayPtr n_cnsts = new Native.ObjArrayPtr();
|
||||||
|
Native.UIntArrayPtr n_parents = new Native.UIntArrayPtr();
|
||||||
|
Native.ObjArrayPtr n_theory = new Native.ObjArrayPtr();
|
||||||
|
Native.StringPtr n_err_str = new Native.StringPtr();
|
||||||
|
int r = Native.readInterpolationProblem(nCtx(), n_num, n_cnsts, n_parents, filename, n_err_str, n_num_theory, n_theory);
|
||||||
|
int num = n_num.value;
|
||||||
|
int num_theory = n_num_theory.value;
|
||||||
|
error = n_err_str.value;
|
||||||
|
cnsts = new Expr[num];
|
||||||
|
parents = new int[num];
|
||||||
|
theory = new Expr[num_theory];
|
||||||
|
for (int i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
cnsts[i] = Expr.create(this, n_cnsts.value[i]);
|
||||||
|
parents[i] = n_parents.value[i];
|
||||||
|
}
|
||||||
|
for (int i = 0; i < num_theory; i++)
|
||||||
|
theory[i] = Expr.create(this, n_theory.value[i]);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes an interpolation problem to a file.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For more information on interpolation please refer
|
||||||
|
/// too the function Z3_write_interpolation_problem in the C/C++ API, which is
|
||||||
|
/// well documented.</remarks>
|
||||||
|
public void WriteInterpolationProblem(String filename, Expr[] cnsts, int[] parents, String error, Expr[] theory) throws Z3Exception
|
||||||
|
{
|
||||||
|
Native.writeInterpolationProblem(nCtx(), cnsts.length, Expr.arrayToNative(cnsts), parents, filename, theory.length, Expr.arrayToNative(theory));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from ListSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
ListSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Log.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Log.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Model.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Model.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
ModelDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from ParamDescrs.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
ParamDescrs.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
ParamDescrsDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,9 +1,21 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Params.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Params.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +41,17 @@ public class Params extends Z3Object
|
||||||
name.getNativeObject(), value);
|
name.getNativeObject(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a parameter setting.
|
||||||
|
**/
|
||||||
|
public void add(Symbol name, String value) throws Z3Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
Native.paramsSetSymbol(getContext().nCtx(), getNativeObject(),
|
||||||
|
name.getNativeObject(),
|
||||||
|
getContext().mkSymbol(value).getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a parameter setting.
|
* Adds a parameter setting.
|
||||||
**/
|
**/
|
||||||
|
@ -75,6 +98,17 @@ public class Params extends Z3Object
|
||||||
.mkSymbol(name).getNativeObject(), value.getNativeObject());
|
.mkSymbol(name).getNativeObject(), value.getNativeObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a parameter setting.
|
||||||
|
**/
|
||||||
|
public void add(String name, String value) throws Z3Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
Native.paramsSetSymbol(getContext().nCtx(), getNativeObject(),
|
||||||
|
getContext().mkSymbol(name).getNativeObject(),
|
||||||
|
getContext().mkSymbol(value).getNativeObject());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A string representation of the parameter set.
|
* A string representation of the parameter set.
|
||||||
**/
|
**/
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
ParamDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Pattern.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Pattern.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Probe.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Probe.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
ProbeDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Quantifier.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Quantifier.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from RatNum.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
RatNum.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from RealExpr.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
RealExpr.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from RealSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
RealSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from RelationSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
RelationSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from SetSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
SetSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Solver.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Solver.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
SolverDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Sort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Sort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Statistics.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Statistics.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
StatisticsDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Status.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Status.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from StringSymbol.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
StringSymbol.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Symbol.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Symbol.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Tactic.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Tactic.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Microsoft Corporation
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
TacticDecRefQueue.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from TupleSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
TupleSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from UninterpretedSort.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
UninterpretedSort.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Version.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Version.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Z3Exception.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Z3Exception.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
/**
|
/**
|
||||||
* This file was automatically generated from Z3Object.cs
|
Copyright (c) 2012-2014 Microsoft Corporation
|
||||||
* w/ further modifications by:
|
|
||||||
* @author Christoph M. Wintersteiger (cwinter)
|
Module Name:
|
||||||
|
|
||||||
|
Z3Object.java
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
package com.microsoft.z3;
|
package com.microsoft.z3;
|
||||||
|
|
|
@ -297,6 +297,11 @@ class AstRef(Z3PPObject):
|
||||||
"""Return a pointer to the corresponding C Z3_ast object."""
|
"""Return a pointer to the corresponding C Z3_ast object."""
|
||||||
return self.ast
|
return self.ast
|
||||||
|
|
||||||
|
def get_id(self):
|
||||||
|
"""Return unique identifier for object. It can be used for hash-tables and maps."""
|
||||||
|
return Z3_get_ast_id(self.ctx_ref(), self.as_ast())
|
||||||
|
|
||||||
|
|
||||||
def ctx_ref(self):
|
def ctx_ref(self):
|
||||||
"""Return a reference to the C context where this AST node is stored."""
|
"""Return a reference to the C context where this AST node is stored."""
|
||||||
return self.ctx.ref()
|
return self.ctx.ref()
|
||||||
|
@ -447,6 +452,10 @@ class SortRef(AstRef):
|
||||||
def as_ast(self):
|
def as_ast(self):
|
||||||
return Z3_sort_to_ast(self.ctx_ref(), self.ast)
|
return Z3_sort_to_ast(self.ctx_ref(), self.ast)
|
||||||
|
|
||||||
|
def get_id(self):
|
||||||
|
return Z3_get_ast_id(self.ctx_ref(), self.as_ast())
|
||||||
|
|
||||||
|
|
||||||
def kind(self):
|
def kind(self):
|
||||||
"""Return the Z3 internal kind of a sort. This method can be used to test if `self` is one of the Z3 builtin sorts.
|
"""Return the Z3 internal kind of a sort. This method can be used to test if `self` is one of the Z3 builtin sorts.
|
||||||
|
|
||||||
|
@ -585,6 +594,9 @@ class FuncDeclRef(AstRef):
|
||||||
def as_ast(self):
|
def as_ast(self):
|
||||||
return Z3_func_decl_to_ast(self.ctx_ref(), self.ast)
|
return Z3_func_decl_to_ast(self.ctx_ref(), self.ast)
|
||||||
|
|
||||||
|
def get_id(self):
|
||||||
|
return Z3_get_ast_id(self.ctx_ref(), self.as_ast())
|
||||||
|
|
||||||
def as_func_decl(self):
|
def as_func_decl(self):
|
||||||
return self.ast
|
return self.ast
|
||||||
|
|
||||||
|
@ -730,6 +742,9 @@ class ExprRef(AstRef):
|
||||||
def as_ast(self):
|
def as_ast(self):
|
||||||
return self.ast
|
return self.ast
|
||||||
|
|
||||||
|
def get_id(self):
|
||||||
|
return Z3_get_ast_id(self.ctx_ref(), self.as_ast())
|
||||||
|
|
||||||
def sort(self):
|
def sort(self):
|
||||||
"""Return the sort of expression `self`.
|
"""Return the sort of expression `self`.
|
||||||
|
|
||||||
|
@ -1524,6 +1539,9 @@ class PatternRef(ExprRef):
|
||||||
def as_ast(self):
|
def as_ast(self):
|
||||||
return Z3_pattern_to_ast(self.ctx_ref(), self.ast)
|
return Z3_pattern_to_ast(self.ctx_ref(), self.ast)
|
||||||
|
|
||||||
|
def get_id(self):
|
||||||
|
return Z3_get_ast_id(self.ctx_ref(), self.as_ast())
|
||||||
|
|
||||||
def is_pattern(a):
|
def is_pattern(a):
|
||||||
"""Return `True` if `a` is a Z3 pattern (hint for quantifier instantiation.
|
"""Return `True` if `a` is a Z3 pattern (hint for quantifier instantiation.
|
||||||
|
|
||||||
|
@ -1586,6 +1604,9 @@ class QuantifierRef(BoolRef):
|
||||||
def as_ast(self):
|
def as_ast(self):
|
||||||
return self.ast
|
return self.ast
|
||||||
|
|
||||||
|
def get_id(self):
|
||||||
|
return Z3_get_ast_id(self.ctx_ref(), self.as_ast())
|
||||||
|
|
||||||
def sort(self):
|
def sort(self):
|
||||||
"""Return the Boolean sort."""
|
"""Return the Boolean sort."""
|
||||||
return BoolSort(self.ctx)
|
return BoolSort(self.ctx)
|
||||||
|
@ -4448,7 +4469,7 @@ def args2params(arguments, keywords, ctx=None):
|
||||||
A ':' is added to the keywords, and '_' is replaced with '-'
|
A ':' is added to the keywords, and '_' is replaced with '-'
|
||||||
|
|
||||||
>>> args2params(['model', True, 'relevancy', 2], {'elim_and' : True})
|
>>> args2params(['model', True, 'relevancy', 2], {'elim_and' : True})
|
||||||
(params model 1 relevancy 2 elim_and 1)
|
(params model true relevancy 2 elim_and true)
|
||||||
"""
|
"""
|
||||||
if __debug__:
|
if __debug__:
|
||||||
_z3_assert(len(arguments) % 2 == 0, "Argument list must have an even number of elements.")
|
_z3_assert(len(arguments) % 2 == 0, "Argument list must have an even number of elements.")
|
||||||
|
@ -6011,6 +6032,24 @@ class Solver(Z3PPObject):
|
||||||
"""
|
"""
|
||||||
return Z3_solver_to_string(self.ctx.ref(), self.solver)
|
return Z3_solver_to_string(self.ctx.ref(), self.solver)
|
||||||
|
|
||||||
|
def to_smt2(self):
|
||||||
|
"""return SMTLIB2 formatted benchmark for solver's assertions"""
|
||||||
|
es = self.assertions()
|
||||||
|
sz = len(es)
|
||||||
|
sz1 = sz
|
||||||
|
if sz1 > 0:
|
||||||
|
sz1 -= 1
|
||||||
|
v = (Ast * sz1)()
|
||||||
|
for i in range(sz1):
|
||||||
|
v[i] = es[i].as_ast()
|
||||||
|
if sz > 0:
|
||||||
|
e = es[sz1].as_ast()
|
||||||
|
else:
|
||||||
|
e = BoolVal(True, self.ctx).as_ast()
|
||||||
|
return Z3_benchmark_to_smtlib_string(self.ctx.ref(), "benchmark generated from python API", "", "unknown", "", sz1, v, e)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def SolverFor(logic, ctx=None):
|
def SolverFor(logic, ctx=None):
|
||||||
"""Create a solver customized for the given logic.
|
"""Create a solver customized for the given logic.
|
||||||
|
|
||||||
|
@ -6960,7 +6999,7 @@ def substitute(t, *m):
|
||||||
if isinstance(m, tuple):
|
if isinstance(m, tuple):
|
||||||
m1 = _get_args(m)
|
m1 = _get_args(m)
|
||||||
if isinstance(m1, list):
|
if isinstance(m1, list):
|
||||||
m = _get_args(m1)
|
m = m1
|
||||||
if __debug__:
|
if __debug__:
|
||||||
_z3_assert(is_expr(t), "Z3 expression expected")
|
_z3_assert(is_expr(t), "Z3 expression expected")
|
||||||
_z3_assert(all([isinstance(p, tuple) and is_expr(p[0]) and is_expr(p[1]) and p[0].sort().eq(p[1].sort()) for p in m]), "Z3 invalid substitution, expression pairs expected.")
|
_z3_assert(all([isinstance(p, tuple) and is_expr(p[0]) and is_expr(p[1]) and p[0].sort().eq(p[1].sort()) for p in m]), "Z3 invalid substitution, expression pairs expected.")
|
||||||
|
@ -7253,19 +7292,19 @@ def parse_smt2_file(f, sorts={}, decls={}, ctx=None):
|
||||||
dsz, dnames, ddecls = _dict2darray(decls, ctx)
|
dsz, dnames, ddecls = _dict2darray(decls, ctx)
|
||||||
return _to_expr_ref(Z3_parse_smtlib2_file(ctx.ref(), f, ssz, snames, ssorts, dsz, dnames, ddecls), ctx)
|
return _to_expr_ref(Z3_parse_smtlib2_file(ctx.ref(), f, ssz, snames, ssorts, dsz, dnames, ddecls), ctx)
|
||||||
|
|
||||||
def Interp(a,ctx=None):
|
def Interpolant(a,ctx=None):
|
||||||
"""Create an interpolation operator.
|
"""Create an interpolation operator.
|
||||||
|
|
||||||
The argument is an interpolation pattern (see tree_interpolant).
|
The argument is an interpolation pattern (see tree_interpolant).
|
||||||
|
|
||||||
>>> x = Int('x')
|
>>> x = Int('x')
|
||||||
>>> print Interp(x>0)
|
>>> print Interpolant(x>0)
|
||||||
interp(x > 0)
|
interp(x > 0)
|
||||||
"""
|
"""
|
||||||
ctx = _get_ctx(_ctx_from_ast_arg_list([a], ctx))
|
ctx = _get_ctx(_ctx_from_ast_arg_list([a], ctx))
|
||||||
s = BoolSort(ctx)
|
s = BoolSort(ctx)
|
||||||
a = s.cast(a)
|
a = s.cast(a)
|
||||||
return BoolRef(Z3_mk_interp(ctx.ref(), a.as_ast()), ctx)
|
return BoolRef(Z3_mk_interpolant(ctx.ref(), a.as_ast()), ctx)
|
||||||
|
|
||||||
def tree_interpolant(pat,p=None,ctx=None):
|
def tree_interpolant(pat,p=None,ctx=None):
|
||||||
"""Compute interpolant for a tree of formulas.
|
"""Compute interpolant for a tree of formulas.
|
||||||
|
@ -7304,10 +7343,10 @@ def tree_interpolant(pat,p=None,ctx=None):
|
||||||
|
|
||||||
>>> x = Int('x')
|
>>> x = Int('x')
|
||||||
>>> y = Int('y')
|
>>> y = Int('y')
|
||||||
>>> print tree_interpolant(And(Interp(x < 0), Interp(y > 2), x == y))
|
>>> print tree_interpolant(And(Interpolant(x < 0), Interpolant(y > 2), x == y))
|
||||||
[Not(x >= 0), Not(y <= 2)]
|
[Not(x >= 0), Not(y <= 2)]
|
||||||
|
|
||||||
>>> g = And(Interp(x<0),x<2)
|
>>> g = And(Interpolant(x<0),x<2)
|
||||||
>>> try:
|
>>> try:
|
||||||
... print tree_interpolant(g).sexpr()
|
... print tree_interpolant(g).sexpr()
|
||||||
... except ModelRef as m:
|
... except ModelRef as m:
|
||||||
|
@ -7342,11 +7381,11 @@ def binary_interpolant(a,b,p=None,ctx=None):
|
||||||
If parameters p are supplied, these are used in creating the
|
If parameters p are supplied, these are used in creating the
|
||||||
solver that determines satisfiability.
|
solver that determines satisfiability.
|
||||||
|
|
||||||
>>> x = Int('x')
|
x = Int('x')
|
||||||
>>> print binary_interpolant(x<0,x>2)
|
print binary_interpolant(x<0,x>2)
|
||||||
x <= 2
|
Not(x >= 0)
|
||||||
"""
|
"""
|
||||||
f = And(Interp(a),b)
|
f = And(Interpolant(a),b)
|
||||||
return tree_interpolant(f,p,ctx)[0]
|
return tree_interpolant(f,p,ctx)[0]
|
||||||
|
|
||||||
def sequence_interpolant(v,p=None,ctx=None):
|
def sequence_interpolant(v,p=None,ctx=None):
|
||||||
|
@ -7375,6 +7414,6 @@ def sequence_interpolant(v,p=None,ctx=None):
|
||||||
"""
|
"""
|
||||||
f = v[0]
|
f = v[0]
|
||||||
for i in range(1,len(v)):
|
for i in range(1,len(v)):
|
||||||
f = And(Interp(f),v[i])
|
f = And(Interpolant(f),v[i])
|
||||||
return tree_interpolant(f,p,ctx)
|
return tree_interpolant(f,p,ctx)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Z3Exception(Exception):
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
self.value = value
|
self.value = value
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return repr(self.value)
|
return str(self.value)
|
||||||
|
|
||||||
class ContextObj(ctypes.c_void_p):
|
class ContextObj(ctypes.c_void_p):
|
||||||
def __init__(self, context): self._as_parameter_ = context
|
def __init__(self, context): self._as_parameter_ = context
|
||||||
|
|
|
@ -27,6 +27,7 @@ Notes:
|
||||||
#include"z3_algebraic.h"
|
#include"z3_algebraic.h"
|
||||||
#include"z3_polynomial.h"
|
#include"z3_polynomial.h"
|
||||||
#include"z3_rcf.h"
|
#include"z3_rcf.h"
|
||||||
|
#include"z3_interp.h"
|
||||||
|
|
||||||
#undef __in
|
#undef __in
|
||||||
#undef __out
|
#undef __out
|
||||||
|
|
364
src/api/z3_api.h
364
src/api/z3_api.h
|
@ -1375,6 +1375,16 @@ extern "C" {
|
||||||
although some parameters can be changed using #Z3_update_param_value.
|
although some parameters can be changed using #Z3_update_param_value.
|
||||||
All main interaction with Z3 happens in the context of a \c Z3_context.
|
All main interaction with Z3 happens in the context of a \c Z3_context.
|
||||||
|
|
||||||
|
In contrast to #Z3_mk_context_rc, the life time of Z3_ast objects
|
||||||
|
are determined by the scope level of #Z3_push and #Z3_pop.
|
||||||
|
In other words, a Z3_ast object remains valid until there is a
|
||||||
|
call to Z3_pop that takes the current scope below the level where
|
||||||
|
the object was created.
|
||||||
|
|
||||||
|
Note that all other reference counted objects, including Z3_model,
|
||||||
|
Z3_solver, Z3_func_interp have to be managed by the caller.
|
||||||
|
Their reference counts are not handled by the context.
|
||||||
|
|
||||||
\conly \sa Z3_del_context
|
\conly \sa Z3_del_context
|
||||||
|
|
||||||
\conly \deprecated Use #Z3_mk_context_rc
|
\conly \deprecated Use #Z3_mk_context_rc
|
||||||
|
@ -1452,15 +1462,6 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
void Z3_API Z3_update_param_value(__in Z3_context c, __in Z3_string param_id, __in Z3_string param_value);
|
void Z3_API Z3_update_param_value(__in Z3_context c, __in Z3_string param_id, __in Z3_string param_value);
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Return the value of a context parameter.
|
|
||||||
|
|
||||||
\sa Z3_global_param_get
|
|
||||||
|
|
||||||
def_API('Z3_get_param_value', BOOL, (_in(CONTEXT), _in(STRING), _out(STRING)))
|
|
||||||
*/
|
|
||||||
Z3_bool_opt Z3_API Z3_get_param_value(__in Z3_context c, __in Z3_string param_id, __out_opt Z3_string_ptr param_value);
|
|
||||||
|
|
||||||
#ifdef CorML4
|
#ifdef CorML4
|
||||||
/**
|
/**
|
||||||
\brief Interrupt the execution of a Z3 procedure.
|
\brief Interrupt the execution of a Z3 procedure.
|
||||||
|
@ -2107,16 +2108,6 @@ END_MLAPI_EXCLUDE
|
||||||
*/
|
*/
|
||||||
Z3_ast Z3_API Z3_mk_not(__in Z3_context c, __in Z3_ast a);
|
Z3_ast Z3_API Z3_mk_not(__in Z3_context c, __in Z3_ast a);
|
||||||
|
|
||||||
/**
|
|
||||||
\brief \mlh mk_interp c a \endmlh
|
|
||||||
Create an AST node marking a formula position for interpolation.
|
|
||||||
|
|
||||||
The node \c a must have Boolean sort.
|
|
||||||
|
|
||||||
def_API('Z3_mk_interp', AST, (_in(CONTEXT), _in(AST)))
|
|
||||||
*/
|
|
||||||
Z3_ast Z3_API Z3_mk_interp(__in Z3_context c, __in Z3_ast a);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief \mlh mk_ite c t1 t2 t2 \endmlh
|
\brief \mlh mk_ite c t1 t2 t2 \endmlh
|
||||||
Create an AST node representing an if-then-else: <tt>ite(t1, t2,
|
Create an AST node representing an if-then-else: <tt>ite(t1, t2,
|
||||||
|
@ -4907,8 +4898,7 @@ END_MLAPI_EXCLUDE
|
||||||
__in_ecount(num_sorts) Z3_sort const sorts[],
|
__in_ecount(num_sorts) Z3_sort const sorts[],
|
||||||
__in unsigned num_decls,
|
__in unsigned num_decls,
|
||||||
__in_ecount(num_decls) Z3_symbol const decl_names[],
|
__in_ecount(num_decls) Z3_symbol const decl_names[],
|
||||||
__in_ecount(num_decls) Z3_func_decl const decls[]
|
__in_ecount(num_decls) Z3_func_decl const decls[]);
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Similar to #Z3_parse_smtlib2_string, but reads the benchmark from a file.
|
\brief Similar to #Z3_parse_smtlib2_string, but reads the benchmark from a file.
|
||||||
|
@ -4922,8 +4912,7 @@ END_MLAPI_EXCLUDE
|
||||||
__in_ecount(num_sorts) Z3_sort const sorts[],
|
__in_ecount(num_sorts) Z3_sort const sorts[],
|
||||||
__in unsigned num_decls,
|
__in unsigned num_decls,
|
||||||
__in_ecount(num_decls) Z3_symbol const decl_names[],
|
__in_ecount(num_decls) Z3_symbol const decl_names[],
|
||||||
__in_ecount(num_decls) Z3_func_decl const decls[]
|
__in_ecount(num_decls) Z3_func_decl const decls[]);
|
||||||
);
|
|
||||||
|
|
||||||
#ifdef ML4only
|
#ifdef ML4only
|
||||||
#include <mlx_parse_smtlib.idl>
|
#include <mlx_parse_smtlib.idl>
|
||||||
|
@ -6610,6 +6599,13 @@ END_MLAPI_EXCLUDE
|
||||||
/**
|
/**
|
||||||
\brief Create a new (incremental) solver.
|
\brief Create a new (incremental) solver.
|
||||||
|
|
||||||
|
The function #Z3_solver_get_model retrieves a model if the
|
||||||
|
assertions is satisfiable (i.e., the result is \c
|
||||||
|
Z3_L_TRUE) and model construction is enabled.
|
||||||
|
The function #Z3_solver_get_model can also be used even
|
||||||
|
if the result is \c Z3_L_UNDEF, but the returned model
|
||||||
|
is not guaranteed to satisfy quantified assertions.
|
||||||
|
|
||||||
def_API('Z3_mk_simple_solver', SOLVER, (_in(CONTEXT),))
|
def_API('Z3_mk_simple_solver', SOLVER, (_in(CONTEXT),))
|
||||||
*/
|
*/
|
||||||
Z3_solver Z3_API Z3_mk_simple_solver(__in Z3_context c);
|
Z3_solver Z3_API Z3_mk_simple_solver(__in Z3_context c);
|
||||||
|
@ -6747,8 +6743,11 @@ END_MLAPI_EXCLUDE
|
||||||
\brief Check whether the assertions in a given solver are consistent or not.
|
\brief Check whether the assertions in a given solver are consistent or not.
|
||||||
|
|
||||||
The function #Z3_solver_get_model retrieves a model if the
|
The function #Z3_solver_get_model retrieves a model if the
|
||||||
assertions are not unsatisfiable (i.e., the result is not \c
|
assertions is satisfiable (i.e., the result is \c
|
||||||
Z3_L_FALSE) and model construction is enabled.
|
Z3_L_TRUE) and model construction is enabled.
|
||||||
|
Note that if the call returns Z3_L_UNDEF, Z3 does not
|
||||||
|
ensure that calls to #Z3_solver_get_model succeed and any models
|
||||||
|
produced in this case are not guaranteed to satisfy the assertions.
|
||||||
|
|
||||||
The function #Z3_solver_get_proof retrieves a proof if proof
|
The function #Z3_solver_get_proof retrieves a proof if proof
|
||||||
generation was enabled when the context was created, and the
|
generation was enabled when the context was created, and the
|
||||||
|
@ -7059,7 +7058,7 @@ END_MLAPI_EXCLUDE
|
||||||
\mlonly then a valid model is returned. Otherwise, it is unsafe to use the returned model.\endmlonly
|
\mlonly then a valid model is returned. Otherwise, it is unsafe to use the returned model.\endmlonly
|
||||||
\conly The caller is responsible for deleting the model using the function #Z3_del_model.
|
\conly The caller is responsible for deleting the model using the function #Z3_del_model.
|
||||||
|
|
||||||
\conly \remark In constrast with the rest of the Z3 API, the reference counter of the
|
\conly \remark In contrast with the rest of the Z3 API, the reference counter of the
|
||||||
\conly model is incremented. This is to guarantee backward compatibility. In previous
|
\conly model is incremented. This is to guarantee backward compatibility. In previous
|
||||||
\conly versions, models did not support reference counting.
|
\conly versions, models did not support reference counting.
|
||||||
|
|
||||||
|
@ -7173,6 +7172,11 @@ END_MLAPI_EXCLUDE
|
||||||
|
|
||||||
\sa Z3_check_and_get_model
|
\sa Z3_check_and_get_model
|
||||||
|
|
||||||
|
\conly \remark The Z3_check_and_get_model automatically increments a reference count on the model.
|
||||||
|
\conly The expected usage is that models created by that method are deleted using Z3_del_model.
|
||||||
|
\conly This is for backwards compatibility and in contrast to the rest of the API where
|
||||||
|
\conly callers are responsible for managing reference counts.
|
||||||
|
|
||||||
\deprecated Subsumed by Z3_solver API
|
\deprecated Subsumed by Z3_solver API
|
||||||
|
|
||||||
def_API('Z3_del_model', VOID, (_in(CONTEXT), _in(MODEL)))
|
def_API('Z3_del_model', VOID, (_in(CONTEXT), _in(MODEL)))
|
||||||
|
@ -7675,314 +7679,6 @@ END_MLAPI_EXCLUDE
|
||||||
Z3_ast Z3_API Z3_get_context_assignment(__in Z3_context c);
|
Z3_ast Z3_API Z3_get_context_assignment(__in Z3_context c);
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
/**
|
|
||||||
@name Interpolation
|
|
||||||
*/
|
|
||||||
/*@{*/
|
|
||||||
|
|
||||||
/** \brief This function generates a Z3 context suitable for generation of
|
|
||||||
interpolants. Formulas can be generated as abstract syntx trees in
|
|
||||||
this context using the Z3 C API.
|
|
||||||
|
|
||||||
Interpolants are also generated as AST's in this context.
|
|
||||||
|
|
||||||
If cfg is non-null, it will be used as the base configuration
|
|
||||||
for the Z3 context. This makes it possible to set Z3 options
|
|
||||||
to be used during interpolation. This feature should be used
|
|
||||||
with some caution however, as it may be that certain Z3 options
|
|
||||||
are incompatible with interpolation.
|
|
||||||
|
|
||||||
def_API('Z3_mk_interpolation_context', CONTEXT, (_in(CONFIG),))
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
Z3_context Z3_API Z3_mk_interpolation_context(__in Z3_config cfg);
|
|
||||||
|
|
||||||
/** Compute an interpolant from a refutation. This takes a proof of
|
|
||||||
"false" from a set of formulas C, and an interpolation
|
|
||||||
pattern. The pattern pat is a formula combining the formulas in C
|
|
||||||
using logical conjunction and the "interp" operator (see
|
|
||||||
#Z3_mk_interp). This interp operator is logically the identity
|
|
||||||
operator. It marks the sub-formulas of the pattern for which interpolants should
|
|
||||||
be computed. The interpolant is a map sigma from marked subformulas to
|
|
||||||
formulas, such that, for each marked subformula phi of pat (where phi sigma
|
|
||||||
is phi with sigma(psi) substituted for each subformula psi of phi such that
|
|
||||||
psi in dom(sigma)):
|
|
||||||
|
|
||||||
1) phi sigma implies sigma(phi), and
|
|
||||||
|
|
||||||
2) sigma(phi) is in the common uninterpreted vocabulary between
|
|
||||||
the formulas of C occurring in phi and those not occurring in
|
|
||||||
phi
|
|
||||||
|
|
||||||
and moreover pat sigma implies false. In the simplest case
|
|
||||||
an interpolant for the pattern "(and (interp A) B)" maps A
|
|
||||||
to an interpolant for A /\ B.
|
|
||||||
|
|
||||||
The return value is a vector of formulas representing sigma. The
|
|
||||||
vector contains sigma(phi) for each marked subformula of pat, in
|
|
||||||
pre-order traversal. This means that subformulas of phi occur before phi
|
|
||||||
in the vector. Also, subformulas that occur multiply in pat will
|
|
||||||
occur multiply in the result vector.
|
|
||||||
|
|
||||||
In particular, calling Z3_get_interpolant on a pattern of the
|
|
||||||
form (interp ... (interp (and (interp A_1) A_2)) ... A_N) will
|
|
||||||
result in a sequence interpolant for A_1, A_2,... A_N.
|
|
||||||
|
|
||||||
Neglecting interp markers, the pattern must be a conjunction of
|
|
||||||
formulas in C, the set of premises of the proof. Otherwise an
|
|
||||||
error is flagged.
|
|
||||||
|
|
||||||
Any premises of the proof not present in the pattern are
|
|
||||||
treated as "background theory". Predicate and function symbols
|
|
||||||
occurring in the background theory are treated as interpreted and
|
|
||||||
thus always allowed in the interpolant.
|
|
||||||
|
|
||||||
Interpolant may not necessarily be computable from all
|
|
||||||
proofs. To be sure an interpolant can be computed, the proof
|
|
||||||
must be generated by an SMT solver for which interpoaltion is
|
|
||||||
supported, and the premises must be expressed using only
|
|
||||||
theories and operators for which interpolation is supported.
|
|
||||||
|
|
||||||
Currently, the only SMT solver that is supported is the legacy
|
|
||||||
SMT solver. Such a solver is available as the default solver in
|
|
||||||
#Z3_context objects produced by #Z3_mk_interpolation_context.
|
|
||||||
Currently, the theories supported are equality with
|
|
||||||
uninterpreted functions, linear integer arithmetic, and the
|
|
||||||
theory of arrays (in SMT-LIB terms, this is AUFLIA).
|
|
||||||
Quantifiers are allowed. Use of any other operators (including
|
|
||||||
"labels") may result in failure to compute an interpolant from a
|
|
||||||
proof.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
\param c logical context.
|
|
||||||
\param pf a refutation from premises (assertions) C
|
|
||||||
\param pat an interpolation pattern over C
|
|
||||||
\param p parameters
|
|
||||||
|
|
||||||
def_API('Z3_get_interpolant', AST_VECTOR, (_in(CONTEXT), _in(AST), _in(AST), _in(PARAMS)))
|
|
||||||
*/
|
|
||||||
|
|
||||||
Z3_ast_vector Z3_API Z3_get_interpolant(__in Z3_context c, __in Z3_ast pf, __in Z3_ast pat, __in Z3_params p);
|
|
||||||
|
|
||||||
/* Compute an interpolant for an unsatisfiable conjunction of formulas.
|
|
||||||
|
|
||||||
This takes as an argument an interpolation pattern as in
|
|
||||||
#Z3_get_interpolant. This is a conjunction, some subformulas of
|
|
||||||
which are marked with the "interp" operator (see #Z3_mk_interp).
|
|
||||||
|
|
||||||
The conjunction is first checked for unsatisfiability. The result
|
|
||||||
of this check is returned in the out parameter "status". If the result
|
|
||||||
is unsat, an interpolant is computed from the refutation as in #Z3_get_interpolant
|
|
||||||
and returned as a vector of formulas. Otherwise the return value is
|
|
||||||
an empty formula.
|
|
||||||
|
|
||||||
See #Z3_get_interpolant for a discussion of supported theories.
|
|
||||||
|
|
||||||
The advantage of this function over #Z3_get_interpolant is that
|
|
||||||
it is not necessary to create a suitable SMT solver and generate
|
|
||||||
a proof. The disadvantage is that it is not possible to use the
|
|
||||||
solver incrementally.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
|
|
||||||
\param c logical context.
|
|
||||||
\param pat an interpolation pattern
|
|
||||||
\param p parameters for solver creation
|
|
||||||
\param status returns the status of the sat check
|
|
||||||
\param model returns model if satisfiable
|
|
||||||
|
|
||||||
Return value: status of SAT check
|
|
||||||
|
|
||||||
def_API('Z3_compute_interpolant', INT, (_in(CONTEXT), _in(AST), _in(PARAMS), _out(AST_VECTOR), _out(MODEL)))
|
|
||||||
*/
|
|
||||||
|
|
||||||
Z3_lbool Z3_API Z3_compute_interpolant(__in Z3_context c, __in Z3_ast pat, __in Z3_params p, __out Z3_ast_vector *interp, __out Z3_model *model);
|
|
||||||
|
|
||||||
|
|
||||||
/** Constant reprepresenting a root of a formula tree for tree interpolation */
|
|
||||||
#define IZ3_ROOT SHRT_MAX
|
|
||||||
|
|
||||||
/** This function uses Z3 to determine satisfiability of a set of
|
|
||||||
constraints. If UNSAT, an interpolant is returned, based on the
|
|
||||||
refutation generated by Z3. If SAT, a model is returned.
|
|
||||||
|
|
||||||
If "parents" is non-null, computes a tree interpolant. The tree is
|
|
||||||
defined by the array "parents". This array maps each formula in
|
|
||||||
the tree to its parent, where formulas are indicated by their
|
|
||||||
integer index in "cnsts". The parent of formula n must have index
|
|
||||||
greater than n. The last formula is the root of the tree. Its
|
|
||||||
parent entry should be the constant IZ3_ROOT.
|
|
||||||
|
|
||||||
If "parents" is null, computes a sequence interpolant.
|
|
||||||
|
|
||||||
\param ctx The Z3 context. Must be generated by iz3_mk_context
|
|
||||||
\param num The number of constraints in the sequence
|
|
||||||
\param cnsts Array of constraints (AST's in context ctx)
|
|
||||||
\param parents The parents vector defining the tree structure
|
|
||||||
\param options Interpolation options (may be NULL)
|
|
||||||
\param interps Array to return interpolants (size at least num-1, may be NULL)
|
|
||||||
\param model Returns a Z3 model if constraints SAT (may be NULL)
|
|
||||||
\param labels Returns relevant labels if SAT (may be NULL)
|
|
||||||
\param incremental
|
|
||||||
|
|
||||||
VERY IMPORTANT: All the Z3 formulas in cnsts must be in Z3
|
|
||||||
context ctx. The model and interpolants returned are also
|
|
||||||
in this context.
|
|
||||||
|
|
||||||
The return code is as in Z3_check_assumptions, that is,
|
|
||||||
|
|
||||||
Z3_L_FALSE = constraints UNSAT (interpolants returned)
|
|
||||||
Z3_L_TRUE = constraints SAT (model returned)
|
|
||||||
Z3_L_UNDEF = Z3 produced no result, or interpolation not possible
|
|
||||||
|
|
||||||
Currently, this function supports integer and boolean variables,
|
|
||||||
as well as arrays over these types, with linear arithmetic,
|
|
||||||
uninterpreted functions and quantifiers over integers (that is
|
|
||||||
AUFLIA). Interpolants are produced in AUFLIA. However, some
|
|
||||||
uses of array operations may cause quantifiers to appear in the
|
|
||||||
interpolants even when there are no quantifiers in the input formulas.
|
|
||||||
Although quantifiers may appear in the input formulas, Z3 may give up in
|
|
||||||
this case, returning Z3_L_UNDEF.
|
|
||||||
|
|
||||||
If "incremental" is true, cnsts must contain exactly the set of
|
|
||||||
formulas that are currently asserted in the context. If false,
|
|
||||||
there must be no formulas currently asserted in the context.
|
|
||||||
Setting "incremental" to true makes it posisble to incrementally
|
|
||||||
add and remove constraints from the context until the context
|
|
||||||
becomes UNSAT, at which point an interpolant is computed. Caution
|
|
||||||
must be used, however. Before popping the context, if you wish to
|
|
||||||
keep the interolant formulas, you *must* preserve them by using
|
|
||||||
Z3_persist_ast. Also, if you want to simplify the interpolant
|
|
||||||
formulas using Z3_simplify, you must first pop all of the
|
|
||||||
assertions in the context (or use a different context). Otherwise,
|
|
||||||
the formulas will be simplified *relative* to these constraints,
|
|
||||||
which is almost certainly not what you want.
|
|
||||||
|
|
||||||
|
|
||||||
Current limitations on tree interpolants. In a tree interpolation
|
|
||||||
problem, each constant (0-ary function symbol) must occur only
|
|
||||||
along one path from root to leaf. Function symbols (of arity > 0)
|
|
||||||
are considered to have global scope (i.e., may appear in any
|
|
||||||
interpolant formula).
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
Z3_lbool Z3_API Z3_interpolate(__in Z3_context ctx,
|
|
||||||
__in int num,
|
|
||||||
__in_ecount(num) Z3_ast *cnsts,
|
|
||||||
__in_ecount(num) unsigned *parents,
|
|
||||||
__in Z3_params options,
|
|
||||||
__out_ecount(num-1) Z3_ast *interps,
|
|
||||||
__out Z3_model *model,
|
|
||||||
__out Z3_literals *labels,
|
|
||||||
__in int incremental,
|
|
||||||
__in int num_theory,
|
|
||||||
__in_ecount(num_theory) Z3_ast *theory);
|
|
||||||
|
|
||||||
/** Return a string summarizing cumulative time used for
|
|
||||||
interpolation. This string is purely for entertainment purposes
|
|
||||||
and has no semantics.
|
|
||||||
|
|
||||||
\param ctx The context (currently ignored)
|
|
||||||
|
|
||||||
def_API('Z3_interpolation_profile', STRING, (_in(CONTEXT),))
|
|
||||||
*/
|
|
||||||
|
|
||||||
Z3_string Z3_API Z3_interpolation_profile(__in Z3_context ctx);
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Read an interpolation problem from file.
|
|
||||||
|
|
||||||
\param ctx The Z3 context. This resets the error handler of ctx.
|
|
||||||
\param filename The file name to read.
|
|
||||||
\param num Returns length of sequence.
|
|
||||||
\param cnsts Returns sequence of formulas (do not free)
|
|
||||||
\param parents Returns the parents vector (or NULL for sequence)
|
|
||||||
\param error Returns an error message in case of failure (do not free the string)
|
|
||||||
|
|
||||||
Returns true on success.
|
|
||||||
|
|
||||||
File formats: Currently two formats are supported, based on
|
|
||||||
SMT-LIB2. For sequence interpolants, the sequence of constraints is
|
|
||||||
represented by the sequence of "assert" commands in the file.
|
|
||||||
|
|
||||||
For tree interpolants, one symbol of type bool is associated to
|
|
||||||
each vertex of the tree. For each vertex v there is an "assert"
|
|
||||||
of the form:
|
|
||||||
|
|
||||||
(implies (and c1 ... cn f) v)
|
|
||||||
|
|
||||||
where c1 .. cn are the children of v (which must precede v in the file)
|
|
||||||
and f is the formula assiciated to node v. The last formula in the
|
|
||||||
file is the root vertex, and is represented by the predicate "false".
|
|
||||||
|
|
||||||
A solution to a tree interpolation problem can be thought of as a
|
|
||||||
valuation of the vertices that makes all the implications true
|
|
||||||
where each value is represented using the common symbols between
|
|
||||||
the formulas in the subtree and the remainder of the formulas.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
int Z3_API Z3_read_interpolation_problem(__in Z3_context ctx,
|
|
||||||
__out int *num,
|
|
||||||
__out_ecount(*num) Z3_ast **cnsts,
|
|
||||||
__out_ecount(*num) int **parents,
|
|
||||||
__in const char *filename,
|
|
||||||
__out const char **error,
|
|
||||||
__out int *num_theory,
|
|
||||||
__out_ecount(*num_theory) Z3_ast **theory);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Check the correctness of an interpolant. The Z3 context must
|
|
||||||
have no constraints asserted when this call is made. That means
|
|
||||||
that after interpolating, you must first fully pop the Z3
|
|
||||||
context before calling this. See Z3_interpolate for meaning of parameters.
|
|
||||||
|
|
||||||
\param ctx The Z3 context. Must be generated by Z3_mk_interpolation_context
|
|
||||||
\param num The number of constraints in the sequence
|
|
||||||
\param cnsts Array of constraints (AST's in context ctx)
|
|
||||||
\param parents The parents vector (or NULL for sequence)
|
|
||||||
\param interps The interpolant to check
|
|
||||||
\param error Returns an error message if interpolant incorrect (do not free the string)
|
|
||||||
|
|
||||||
Return value is Z3_L_TRUE if interpolant is verified, Z3_L_FALSE if
|
|
||||||
incorrect, and Z3_L_UNDEF if unknown.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
int Z3_API Z3_check_interpolant(Z3_context ctx, int num, Z3_ast *cnsts, int *parents, Z3_ast *interps, const char **error,
|
|
||||||
int num_theory, Z3_ast *theory);
|
|
||||||
|
|
||||||
/** Write an interpolation problem to file suitable for reading with
|
|
||||||
Z3_read_interpolation_problem. The output file is a sequence
|
|
||||||
of SMT-LIB2 format commands, suitable for reading with command-line Z3
|
|
||||||
or other interpolating solvers.
|
|
||||||
|
|
||||||
\param ctx The Z3 context. Must be generated by z3_mk_interpolation_context
|
|
||||||
\param num The number of constraints in the sequence
|
|
||||||
\param cnsts Array of constraints
|
|
||||||
\param parents The parents vector (or NULL for sequence)
|
|
||||||
\param filename The file name to write
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
void Z3_API Z3_write_interpolation_problem(Z3_context ctx,
|
|
||||||
int num,
|
|
||||||
Z3_ast *cnsts,
|
|
||||||
int *parents,
|
|
||||||
const char *filename,
|
|
||||||
int num_theory,
|
|
||||||
Z3_ast *theory);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
277
src/api/z3_interp.h
Normal file
277
src/api/z3_interp.h
Normal file
|
@ -0,0 +1,277 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2014 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
z3_interp.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
API for interpolation
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Kenneth McMillan (kenmcmil)
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _Z3_INTERPOLATION_H_
|
||||||
|
#define _Z3_INTERPOLATION_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
/**
|
||||||
|
@name Interpolation
|
||||||
|
*/
|
||||||
|
/*@{*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief \mlh mk_interp c a \endmlh
|
||||||
|
Create an AST node marking a formula position for interpolation.
|
||||||
|
|
||||||
|
The node \c a must have Boolean sort.
|
||||||
|
|
||||||
|
def_API('Z3_mk_interpolant', AST, (_in(CONTEXT), _in(AST)))
|
||||||
|
*/
|
||||||
|
Z3_ast Z3_API Z3_mk_interpolant(__in Z3_context c, __in Z3_ast a);
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief This function generates a Z3 context suitable for generation of
|
||||||
|
interpolants. Formulas can be generated as abstract syntax trees in
|
||||||
|
this context using the Z3 C API.
|
||||||
|
|
||||||
|
Interpolants are also generated as AST's in this context.
|
||||||
|
|
||||||
|
If cfg is non-null, it will be used as the base configuration
|
||||||
|
for the Z3 context. This makes it possible to set Z3 options
|
||||||
|
to be used during interpolation. This feature should be used
|
||||||
|
with some caution however, as it may be that certain Z3 options
|
||||||
|
are incompatible with interpolation.
|
||||||
|
|
||||||
|
def_API('Z3_mk_interpolation_context', CONTEXT, (_in(CONFIG),))
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Z3_context Z3_API Z3_mk_interpolation_context(__in Z3_config cfg);
|
||||||
|
|
||||||
|
/** Compute an interpolant from a refutation. This takes a proof of
|
||||||
|
"false" from a set of formulas C, and an interpolation
|
||||||
|
pattern. The pattern pat is a formula combining the formulas in C
|
||||||
|
using logical conjunction and the "interp" operator (see
|
||||||
|
#Z3_mk_interpolant). This interp operator is logically the identity
|
||||||
|
operator. It marks the sub-formulas of the pattern for which interpolants should
|
||||||
|
be computed. The interpolant is a map sigma from marked subformulas to
|
||||||
|
formulas, such that, for each marked subformula phi of pat (where phi sigma
|
||||||
|
is phi with sigma(psi) substituted for each subformula psi of phi such that
|
||||||
|
psi in dom(sigma)):
|
||||||
|
|
||||||
|
1) phi sigma implies sigma(phi), and
|
||||||
|
|
||||||
|
2) sigma(phi) is in the common uninterpreted vocabulary between
|
||||||
|
the formulas of C occurring in phi and those not occurring in
|
||||||
|
phi
|
||||||
|
|
||||||
|
and moreover pat sigma implies false. In the simplest case
|
||||||
|
an interpolant for the pattern "(and (interp A) B)" maps A
|
||||||
|
to an interpolant for A /\ B.
|
||||||
|
|
||||||
|
The return value is a vector of formulas representing sigma. The
|
||||||
|
vector contains sigma(phi) for each marked subformula of pat, in
|
||||||
|
pre-order traversal. This means that subformulas of phi occur before phi
|
||||||
|
in the vector. Also, subformulas that occur multiply in pat will
|
||||||
|
occur multiply in the result vector.
|
||||||
|
|
||||||
|
In particular, calling Z3_get_interpolant on a pattern of the
|
||||||
|
form (interp ... (interp (and (interp A_1) A_2)) ... A_N) will
|
||||||
|
result in a sequence interpolant for A_1, A_2,... A_N.
|
||||||
|
|
||||||
|
Neglecting interp markers, the pattern must be a conjunction of
|
||||||
|
formulas in C, the set of premises of the proof. Otherwise an
|
||||||
|
error is flagged.
|
||||||
|
|
||||||
|
Any premises of the proof not present in the pattern are
|
||||||
|
treated as "background theory". Predicate and function symbols
|
||||||
|
occurring in the background theory are treated as interpreted and
|
||||||
|
thus always allowed in the interpolant.
|
||||||
|
|
||||||
|
Interpolant may not necessarily be computable from all
|
||||||
|
proofs. To be sure an interpolant can be computed, the proof
|
||||||
|
must be generated by an SMT solver for which interpoaltion is
|
||||||
|
supported, and the premises must be expressed using only
|
||||||
|
theories and operators for which interpolation is supported.
|
||||||
|
|
||||||
|
Currently, the only SMT solver that is supported is the legacy
|
||||||
|
SMT solver. Such a solver is available as the default solver in
|
||||||
|
#Z3_context objects produced by #Z3_mk_interpolation_context.
|
||||||
|
Currently, the theories supported are equality with
|
||||||
|
uninterpreted functions, linear integer arithmetic, and the
|
||||||
|
theory of arrays (in SMT-LIB terms, this is AUFLIA).
|
||||||
|
Quantifiers are allowed. Use of any other operators (including
|
||||||
|
"labels") may result in failure to compute an interpolant from a
|
||||||
|
proof.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
\param c logical context.
|
||||||
|
\param pf a refutation from premises (assertions) C
|
||||||
|
\param pat an interpolation pattern over C
|
||||||
|
\param p parameters
|
||||||
|
|
||||||
|
def_API('Z3_get_interpolant', AST_VECTOR, (_in(CONTEXT), _in(AST), _in(AST), _in(PARAMS)))
|
||||||
|
*/
|
||||||
|
|
||||||
|
Z3_ast_vector Z3_API Z3_get_interpolant(__in Z3_context c, __in Z3_ast pf, __in Z3_ast pat, __in Z3_params p);
|
||||||
|
|
||||||
|
/* Compute an interpolant for an unsatisfiable conjunction of formulas.
|
||||||
|
|
||||||
|
This takes as an argument an interpolation pattern as in
|
||||||
|
#Z3_get_interpolant. This is a conjunction, some subformulas of
|
||||||
|
which are marked with the "interp" operator (see #Z3_mk_interpolant).
|
||||||
|
|
||||||
|
The conjunction is first checked for unsatisfiability. The result
|
||||||
|
of this check is returned in the out parameter "status". If the result
|
||||||
|
is unsat, an interpolant is computed from the refutation as in #Z3_get_interpolant
|
||||||
|
and returned as a vector of formulas. Otherwise the return value is
|
||||||
|
an empty formula.
|
||||||
|
|
||||||
|
See #Z3_get_interpolant for a discussion of supported theories.
|
||||||
|
|
||||||
|
The advantage of this function over #Z3_get_interpolant is that
|
||||||
|
it is not necessary to create a suitable SMT solver and generate
|
||||||
|
a proof. The disadvantage is that it is not possible to use the
|
||||||
|
solver incrementally.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
\param c logical context.
|
||||||
|
\param pat an interpolation pattern
|
||||||
|
\param p parameters for solver creation
|
||||||
|
\param status returns the status of the sat check
|
||||||
|
\param model returns model if satisfiable
|
||||||
|
|
||||||
|
Return value: status of SAT check
|
||||||
|
|
||||||
|
def_API('Z3_compute_interpolant', INT, (_in(CONTEXT), _in(AST), _in(PARAMS), _out(AST_VECTOR), _out(MODEL)))
|
||||||
|
*/
|
||||||
|
|
||||||
|
Z3_lbool Z3_API Z3_compute_interpolant(__in Z3_context c,
|
||||||
|
__in Z3_ast pat,
|
||||||
|
__in Z3_params p,
|
||||||
|
__out Z3_ast_vector *interp,
|
||||||
|
__out Z3_model *model);
|
||||||
|
|
||||||
|
/** Return a string summarizing cumulative time used for
|
||||||
|
interpolation. This string is purely for entertainment purposes
|
||||||
|
and has no semantics.
|
||||||
|
|
||||||
|
\param ctx The context (currently ignored)
|
||||||
|
|
||||||
|
|
||||||
|
def_API('Z3_interpolation_profile', STRING, (_in(CONTEXT),))
|
||||||
|
*/
|
||||||
|
|
||||||
|
Z3_string Z3_API Z3_interpolation_profile(__in Z3_context ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Read an interpolation problem from file.
|
||||||
|
|
||||||
|
\param ctx The Z3 context. This resets the error handler of ctx.
|
||||||
|
\param filename The file name to read.
|
||||||
|
\param num Returns length of sequence.
|
||||||
|
\param cnsts Returns sequence of formulas (do not free)
|
||||||
|
\param parents Returns the parents vector (or NULL for sequence)
|
||||||
|
\param error Returns an error message in case of failure (do not free the string)
|
||||||
|
|
||||||
|
Returns true on success.
|
||||||
|
|
||||||
|
File formats: Currently two formats are supported, based on
|
||||||
|
SMT-LIB2. For sequence interpolants, the sequence of constraints is
|
||||||
|
represented by the sequence of "assert" commands in the file.
|
||||||
|
|
||||||
|
For tree interpolants, one symbol of type bool is associated to
|
||||||
|
each vertex of the tree. For each vertex v there is an "assert"
|
||||||
|
of the form:
|
||||||
|
|
||||||
|
(implies (and c1 ... cn f) v)
|
||||||
|
|
||||||
|
where c1 .. cn are the children of v (which must precede v in the file)
|
||||||
|
and f is the formula assiciated to node v. The last formula in the
|
||||||
|
file is the root vertex, and is represented by the predicate "false".
|
||||||
|
|
||||||
|
A solution to a tree interpolation problem can be thought of as a
|
||||||
|
valuation of the vertices that makes all the implications true
|
||||||
|
where each value is represented using the common symbols between
|
||||||
|
the formulas in the subtree and the remainder of the formulas.
|
||||||
|
|
||||||
|
def_API('Z3_read_interpolation_problem', INT, (_in(CONTEXT), _out(UINT), _out_managed_array(1, AST), _out_managed_array(1, UINT), _in(STRING), _out(STRING), _out(UINT), _out_managed_array(6, AST)))
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
int Z3_API Z3_read_interpolation_problem(__in Z3_context ctx,
|
||||||
|
__out unsigned *num,
|
||||||
|
__out Z3_ast *cnsts[],
|
||||||
|
__out unsigned *parents[],
|
||||||
|
__in Z3_string filename,
|
||||||
|
__out_opt Z3_string_ptr error,
|
||||||
|
__out unsigned *num_theory,
|
||||||
|
__out Z3_ast *theory[]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Check the correctness of an interpolant. The Z3 context must
|
||||||
|
have no constraints asserted when this call is made. That means
|
||||||
|
that after interpolating, you must first fully pop the Z3
|
||||||
|
context before calling this. See Z3_interpolate for meaning of parameters.
|
||||||
|
|
||||||
|
\param ctx The Z3 context. Must be generated by Z3_mk_interpolation_context
|
||||||
|
\param num The number of constraints in the sequence
|
||||||
|
\param cnsts Array of constraints (AST's in context ctx)
|
||||||
|
\param parents The parents vector (or NULL for sequence)
|
||||||
|
\param interps The interpolant to check
|
||||||
|
\param error Returns an error message if interpolant incorrect (do not free the string)
|
||||||
|
|
||||||
|
Return value is Z3_L_TRUE if interpolant is verified, Z3_L_FALSE if
|
||||||
|
incorrect, and Z3_L_UNDEF if unknown.
|
||||||
|
|
||||||
|
def_API('Z3_check_interpolant', INT, (_in(CONTEXT), _in(UINT), _in_array(1, AST), _in_array(1, UINT), _in_array(1, AST), _out(STRING), _in(UINT), _in_array(6, AST)))
|
||||||
|
*/
|
||||||
|
|
||||||
|
int Z3_API Z3_check_interpolant(__in Z3_context ctx,
|
||||||
|
__in unsigned num,
|
||||||
|
__in_ecount(num) Z3_ast cnsts[],
|
||||||
|
__in_ecount(num) unsigned parents[],
|
||||||
|
__in_ecount(num - 1) Z3_ast *interps,
|
||||||
|
__out_opt Z3_string_ptr error,
|
||||||
|
__in unsigned num_theory,
|
||||||
|
__in_ecount(num_theory) Z3_ast theory[]);
|
||||||
|
|
||||||
|
/** Write an interpolation problem to file suitable for reading with
|
||||||
|
Z3_read_interpolation_problem. The output file is a sequence
|
||||||
|
of SMT-LIB2 format commands, suitable for reading with command-line Z3
|
||||||
|
or other interpolating solvers.
|
||||||
|
|
||||||
|
\param ctx The Z3 context. Must be generated by z3_mk_interpolation_context
|
||||||
|
\param num The number of constraints in the sequence
|
||||||
|
\param cnsts Array of constraints
|
||||||
|
\param parents The parents vector (or NULL for sequence)
|
||||||
|
\param filename The file name to write
|
||||||
|
|
||||||
|
def_API('Z3_write_interpolation_problem', VOID, (_in(CONTEXT), _in(UINT), _in_array(1, AST), _in_array(1, UINT), _in(STRING), _in(UINT), _in_array(5, AST)))
|
||||||
|
*/
|
||||||
|
|
||||||
|
void Z3_API Z3_write_interpolation_problem(__in Z3_context ctx,
|
||||||
|
__in unsigned num,
|
||||||
|
__in_ecount(num) Z3_ast cnsts[],
|
||||||
|
__in_ecount(num) unsigned parents[],
|
||||||
|
__in Z3_string filename,
|
||||||
|
__in unsigned num_theory,
|
||||||
|
__in_ecount(num_theory) Z3_ast theory[]);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif
|
|
@ -314,8 +314,8 @@ func_decl * float_decl_plugin::mk_binary_decl(decl_kind k, unsigned num_paramete
|
||||||
symbol name;
|
symbol name;
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case OP_FLOAT_REM: name = "remainder"; break;
|
case OP_FLOAT_REM: name = "remainder"; break;
|
||||||
case OP_FLOAT_MIN: name = "min"; break;
|
case OP_FLOAT_MIN: name = "fp.min"; break;
|
||||||
case OP_FLOAT_MAX: name = "max"; break;
|
case OP_FLOAT_MAX: name = "fp.max"; break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
|
@ -581,8 +581,9 @@ void float_decl_plugin::get_op_names(svector<builtin_name> & op_names, symbol co
|
||||||
op_names.push_back(builtin_name("isSubnormal", OP_FLOAT_IS_SUBNORMAL));
|
op_names.push_back(builtin_name("isSubnormal", OP_FLOAT_IS_SUBNORMAL));
|
||||||
op_names.push_back(builtin_name("isSignMinus", OP_FLOAT_IS_SIGN_MINUS));
|
op_names.push_back(builtin_name("isSignMinus", OP_FLOAT_IS_SIGN_MINUS));
|
||||||
|
|
||||||
op_names.push_back(builtin_name("min", OP_FLOAT_MIN));
|
// Disabled min/max, clashes with user-defined min/max functions
|
||||||
op_names.push_back(builtin_name("max", OP_FLOAT_MAX));
|
// op_names.push_back(builtin_name("min", OP_FLOAT_MIN));
|
||||||
|
// op_names.push_back(builtin_name("max", OP_FLOAT_MAX));
|
||||||
|
|
||||||
op_names.push_back(builtin_name("asFloat", OP_TO_FLOAT));
|
op_names.push_back(builtin_name("asFloat", OP_TO_FLOAT));
|
||||||
|
|
||||||
|
|
|
@ -911,18 +911,34 @@ void bit_blaster_tpl<Cfg>::mk_shl(unsigned sz, expr * const * a_bits, expr * con
|
||||||
out_bits.push_back(a_bits[i]);
|
out_bits.push_back(a_bits[i]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
expr_ref_vector eqs(m());
|
out_bits.append(sz, a_bits);
|
||||||
mk_eqs(sz, b_bits, eqs);
|
|
||||||
for (unsigned i = 0; i < sz; i++) {
|
unsigned i = 0;
|
||||||
|
expr_ref_vector new_out_bits(m());
|
||||||
|
for (; i < sz; ++i) {
|
||||||
checkpoint();
|
checkpoint();
|
||||||
expr_ref out(m());
|
unsigned shift_i = 1 << i;
|
||||||
mk_ite(eqs.get(i), a_bits[0], m().mk_false(), out);
|
if (shift_i >= sz) break;
|
||||||
for (unsigned j = 1; j <= i; j++) {
|
for (unsigned j = 0; j < sz; ++j) {
|
||||||
expr_ref new_out(m());
|
expr_ref new_out(m());
|
||||||
mk_ite(eqs.get(i - j), a_bits[j], out, new_out);
|
expr* a_j = m().mk_false();
|
||||||
out = new_out;
|
if (shift_i <= j) a_j = out_bits[j-shift_i].get();
|
||||||
|
mk_ite(b_bits[i], a_j, out_bits[j].get(), new_out);
|
||||||
|
new_out_bits.push_back(new_out);
|
||||||
}
|
}
|
||||||
out_bits.push_back(out);
|
out_bits.reset();
|
||||||
|
out_bits.append(new_out_bits);
|
||||||
|
new_out_bits.reset();
|
||||||
|
}
|
||||||
|
expr_ref is_large(m());
|
||||||
|
is_large = m().mk_false();
|
||||||
|
for (; i < sz; ++i) {
|
||||||
|
mk_or(is_large, b_bits[i], is_large);
|
||||||
|
}
|
||||||
|
for (unsigned j = 0; j < sz; ++j) {
|
||||||
|
expr_ref new_out(m());
|
||||||
|
mk_ite(is_large, m().mk_false(), out_bits[j].get(), new_out);
|
||||||
|
out_bits[j] = new_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -939,19 +955,32 @@ void bit_blaster_tpl<Cfg>::mk_lshr(unsigned sz, expr * const * a_bits, expr * co
|
||||||
out_bits.push_back(m().mk_false());
|
out_bits.push_back(m().mk_false());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
expr_ref_vector eqs(m());
|
out_bits.append(sz, a_bits);
|
||||||
mk_eqs(sz, b_bits, eqs);
|
unsigned i = 0;
|
||||||
out_bits.resize(sz);
|
for (; i < sz; ++i) {
|
||||||
for (unsigned i = 0; i < sz; i++) {
|
|
||||||
checkpoint();
|
checkpoint();
|
||||||
expr_ref out(m());
|
expr_ref_vector new_out_bits(m());
|
||||||
mk_ite(eqs.get(i), a_bits[sz-1], m().mk_false(), out);
|
unsigned shift_i = 1 << i;
|
||||||
for (unsigned j = 1; j <= i; j++) {
|
if (shift_i >= sz) break;
|
||||||
|
for (unsigned j = 0; j < sz; ++j) {
|
||||||
expr_ref new_out(m());
|
expr_ref new_out(m());
|
||||||
mk_ite(eqs.get(i - j), a_bits[sz - j - 1], out, new_out);
|
expr* a_j = m().mk_false();
|
||||||
out = new_out;
|
if (shift_i + j < sz) a_j = out_bits[j+shift_i].get();
|
||||||
|
mk_ite(b_bits[i], a_j, out_bits[j].get(), new_out);
|
||||||
|
new_out_bits.push_back(new_out);
|
||||||
}
|
}
|
||||||
out_bits.set(sz - i - 1, out);
|
out_bits.reset();
|
||||||
|
out_bits.append(new_out_bits);
|
||||||
|
}
|
||||||
|
expr_ref is_large(m());
|
||||||
|
is_large = m().mk_false();
|
||||||
|
for (; i < sz; ++i) {
|
||||||
|
mk_or(is_large, b_bits[i], is_large);
|
||||||
|
}
|
||||||
|
for (unsigned j = 0; j < sz; ++j) {
|
||||||
|
expr_ref new_out(m());
|
||||||
|
mk_ite(is_large, m().mk_false(), out_bits[j].get(), new_out);
|
||||||
|
out_bits[j] = new_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -968,20 +997,32 @@ void bit_blaster_tpl<Cfg>::mk_ashr(unsigned sz, expr * const * a_bits, expr * co
|
||||||
out_bits.push_back(a_bits[sz-1]);
|
out_bits.push_back(a_bits[sz-1]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
expr_ref_vector eqs(m());
|
out_bits.append(sz, a_bits);
|
||||||
mk_eqs(sz, b_bits, eqs);
|
unsigned i = 0;
|
||||||
out_bits.resize(sz);
|
for (; i < sz; ++i) {
|
||||||
for (unsigned i = 0; i < sz; i++) {
|
|
||||||
checkpoint();
|
checkpoint();
|
||||||
expr_ref out(m());
|
expr_ref_vector new_out_bits(m());
|
||||||
out = a_bits[sz-1];
|
unsigned shift_i = 1 << i;
|
||||||
for (unsigned j = 1; j <= i; j++) {
|
if (shift_i >= sz) break;
|
||||||
|
for (unsigned j = 0; j < sz; ++j) {
|
||||||
expr_ref new_out(m());
|
expr_ref new_out(m());
|
||||||
mk_ite(eqs.get(i - j), a_bits[sz - j - 1], out, new_out);
|
expr* a_j = a_bits[sz-1];
|
||||||
out = new_out;
|
if (shift_i + j < sz) a_j = out_bits[j+shift_i].get();
|
||||||
|
mk_ite(b_bits[i], a_j, out_bits[j].get(), new_out);
|
||||||
|
new_out_bits.push_back(new_out);
|
||||||
}
|
}
|
||||||
TRACE("bit_blaster", tout << (sz - i - 1) << " :\n" << mk_pp(out, m()) << "\n";);
|
out_bits.reset();
|
||||||
out_bits.set(sz - i - 1, out);
|
out_bits.append(new_out_bits);
|
||||||
|
}
|
||||||
|
expr_ref is_large(m());
|
||||||
|
is_large = m().mk_false();
|
||||||
|
for (; i < sz; ++i) {
|
||||||
|
mk_or(is_large, b_bits[i], is_large);
|
||||||
|
}
|
||||||
|
for (unsigned j = 0; j < sz; ++j) {
|
||||||
|
expr_ref new_out(m());
|
||||||
|
mk_ite(is_large, a_bits[sz-1], out_bits[j].get(), new_out);
|
||||||
|
out_bits[j] = new_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue