3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-22 16:45:31 +00:00

Merge branch 'working' of https://z3-1/gw/git/z3 into working

This commit is contained in:
Nikolaj Bjorner 2012-10-12 17:15:53 -07:00
commit 9ad4b5bc0f
58 changed files with 1809 additions and 1526 deletions

View file

@ -57,10 +57,9 @@ def _find_lib():
_dir = os.path.dirname(os.path.abspath(__file__))
libs = ['z3.dll', 'libz3.so', 'libz3.dylib']
if sys.maxsize > 2**32:
winlibdir = 'x64'
locs = [_dir, '%s%s..%sx64%sexternal' % (_dir, os.sep, os.sep, os.sep), '%s%s..%sbin%sexternal' % (_dir, os.sep, os.sep, os.sep)]
else:
winlibdir = 'bin'
locs = [_dir, '%s%s..%s%s' % (_dir, os.sep, os.sep, winlibdir), '%s%s..%slib' % (_dir, os.sep, os.sep), '%s%s..%sexternal' % (_dir, os.sep, os.sep), '%s%s..%sbin%sexternal' % (_dir, os.sep, os.sep, os.sep)]
locs = [_dir, '%s%s..%sexternal' % (_dir, os.sep, os.sep), '%s%s..%sbin%sexternal' % (_dir, os.sep, os.sep, os.sep)]
for loc in locs:
for lib in libs:
f = '%s%s%s' % (loc, os.sep, lib)
@ -1101,6 +1100,7 @@ API('Z3_param_descrs_dec_ref', VOID, (_in(CONTEXT), _in(PARAM_DESCRS)))
API('Z3_param_descrs_get_kind', UINT, (_in(CONTEXT), _in(PARAM_DESCRS), _in(SYMBOL)))
API('Z3_param_descrs_size', UINT, (_in(CONTEXT), _in(PARAM_DESCRS)))
API('Z3_param_descrs_get_name', SYMBOL, (_in(CONTEXT), _in(PARAM_DESCRS), _in(UINT)))
API('Z3_param_descrs_to_string', STRING, (_in(CONTEXT), _in(PARAM_DESCRS)))
# New APIs
API('Z3_interrupt', VOID, (_in(CONTEXT),))
API('Z3_get_error_msg_ex', STRING, (_in(CONTEXT), _in(ERROR_CODE)))

View file

@ -2328,6 +2328,11 @@ void exec_Z3_param_descrs_get_name(z3_replayer & in) {
reinterpret_cast<Z3_param_descrs>(in.get_obj(1)),
in.get_uint(2));
}
void exec_Z3_param_descrs_to_string(z3_replayer & in) {
Z3_param_descrs_to_string(
reinterpret_cast<Z3_context>(in.get_obj(0)),
reinterpret_cast<Z3_param_descrs>(in.get_obj(1)));
}
void exec_Z3_interrupt(z3_replayer & in) {
Z3_interrupt(
reinterpret_cast<Z3_context>(in.get_obj(0)));
@ -3359,120 +3364,121 @@ void register_z3_replayer_cmds(z3_replayer & in) {
in.register_cmd(357, exec_Z3_param_descrs_get_kind);
in.register_cmd(358, exec_Z3_param_descrs_size);
in.register_cmd(359, exec_Z3_param_descrs_get_name);
in.register_cmd(360, exec_Z3_interrupt);
in.register_cmd(361, exec_Z3_get_error_msg_ex);
in.register_cmd(362, exec_Z3_translate);
in.register_cmd(363, exec_Z3_mk_goal);
in.register_cmd(364, exec_Z3_goal_inc_ref);
in.register_cmd(365, exec_Z3_goal_dec_ref);
in.register_cmd(366, exec_Z3_goal_precision);
in.register_cmd(367, exec_Z3_goal_assert);
in.register_cmd(368, exec_Z3_goal_inconsistent);
in.register_cmd(369, exec_Z3_goal_depth);
in.register_cmd(370, exec_Z3_goal_reset);
in.register_cmd(371, exec_Z3_goal_size);
in.register_cmd(372, exec_Z3_goal_formula);
in.register_cmd(373, exec_Z3_goal_num_exprs);
in.register_cmd(374, exec_Z3_goal_is_decided_sat);
in.register_cmd(375, exec_Z3_goal_is_decided_unsat);
in.register_cmd(376, exec_Z3_goal_translate);
in.register_cmd(377, exec_Z3_goal_to_string);
in.register_cmd(378, exec_Z3_mk_tactic);
in.register_cmd(379, exec_Z3_mk_probe);
in.register_cmd(380, exec_Z3_tactic_inc_ref);
in.register_cmd(381, exec_Z3_tactic_dec_ref);
in.register_cmd(382, exec_Z3_probe_inc_ref);
in.register_cmd(383, exec_Z3_probe_dec_ref);
in.register_cmd(384, exec_Z3_tactic_and_then);
in.register_cmd(385, exec_Z3_tactic_or_else);
in.register_cmd(386, exec_Z3_tactic_par_or);
in.register_cmd(387, exec_Z3_tactic_par_and_then);
in.register_cmd(388, exec_Z3_tactic_try_for);
in.register_cmd(389, exec_Z3_tactic_when);
in.register_cmd(390, exec_Z3_tactic_cond);
in.register_cmd(391, exec_Z3_tactic_repeat);
in.register_cmd(392, exec_Z3_tactic_skip);
in.register_cmd(393, exec_Z3_tactic_fail);
in.register_cmd(394, exec_Z3_tactic_fail_if);
in.register_cmd(395, exec_Z3_tactic_fail_if_not_decided);
in.register_cmd(396, exec_Z3_tactic_using_params);
in.register_cmd(397, exec_Z3_probe_const);
in.register_cmd(398, exec_Z3_probe_lt);
in.register_cmd(399, exec_Z3_probe_le);
in.register_cmd(400, exec_Z3_probe_gt);
in.register_cmd(401, exec_Z3_probe_ge);
in.register_cmd(402, exec_Z3_probe_eq);
in.register_cmd(403, exec_Z3_probe_and);
in.register_cmd(404, exec_Z3_probe_or);
in.register_cmd(405, exec_Z3_probe_not);
in.register_cmd(406, exec_Z3_get_num_tactics);
in.register_cmd(407, exec_Z3_get_tactic_name);
in.register_cmd(408, exec_Z3_get_num_probes);
in.register_cmd(409, exec_Z3_get_probe_name);
in.register_cmd(410, exec_Z3_tactic_get_help);
in.register_cmd(411, exec_Z3_tactic_get_param_descrs);
in.register_cmd(412, exec_Z3_tactic_get_descr);
in.register_cmd(413, exec_Z3_probe_get_descr);
in.register_cmd(414, exec_Z3_probe_apply);
in.register_cmd(415, exec_Z3_tactic_apply);
in.register_cmd(416, exec_Z3_tactic_apply_ex);
in.register_cmd(417, exec_Z3_apply_result_inc_ref);
in.register_cmd(418, exec_Z3_apply_result_dec_ref);
in.register_cmd(419, exec_Z3_apply_result_to_string);
in.register_cmd(420, exec_Z3_apply_result_get_num_subgoals);
in.register_cmd(421, exec_Z3_apply_result_get_subgoal);
in.register_cmd(422, exec_Z3_apply_result_convert_model);
in.register_cmd(423, exec_Z3_mk_solver);
in.register_cmd(424, exec_Z3_mk_simple_solver);
in.register_cmd(425, exec_Z3_mk_solver_for_logic);
in.register_cmd(426, exec_Z3_mk_solver_from_tactic);
in.register_cmd(427, exec_Z3_solver_get_help);
in.register_cmd(428, exec_Z3_solver_get_param_descrs);
in.register_cmd(429, exec_Z3_solver_set_params);
in.register_cmd(430, exec_Z3_solver_inc_ref);
in.register_cmd(431, exec_Z3_solver_dec_ref);
in.register_cmd(432, exec_Z3_solver_push);
in.register_cmd(433, exec_Z3_solver_pop);
in.register_cmd(434, exec_Z3_solver_reset);
in.register_cmd(435, exec_Z3_solver_get_num_scopes);
in.register_cmd(436, exec_Z3_solver_assert);
in.register_cmd(437, exec_Z3_solver_get_assertions);
in.register_cmd(438, exec_Z3_solver_check);
in.register_cmd(439, exec_Z3_solver_check_assumptions);
in.register_cmd(440, exec_Z3_solver_get_model);
in.register_cmd(441, exec_Z3_solver_get_proof);
in.register_cmd(442, exec_Z3_solver_get_unsat_core);
in.register_cmd(443, exec_Z3_solver_get_reason_unknown);
in.register_cmd(444, exec_Z3_solver_get_statistics);
in.register_cmd(445, exec_Z3_solver_to_string);
in.register_cmd(446, exec_Z3_stats_to_string);
in.register_cmd(447, exec_Z3_stats_inc_ref);
in.register_cmd(448, exec_Z3_stats_dec_ref);
in.register_cmd(449, exec_Z3_stats_size);
in.register_cmd(450, exec_Z3_stats_get_key);
in.register_cmd(451, exec_Z3_stats_is_uint);
in.register_cmd(452, exec_Z3_stats_is_double);
in.register_cmd(453, exec_Z3_stats_get_uint_value);
in.register_cmd(454, exec_Z3_stats_get_double_value);
in.register_cmd(455, exec_Z3_mk_ast_vector);
in.register_cmd(456, exec_Z3_ast_vector_inc_ref);
in.register_cmd(457, exec_Z3_ast_vector_dec_ref);
in.register_cmd(458, exec_Z3_ast_vector_size);
in.register_cmd(459, exec_Z3_ast_vector_get);
in.register_cmd(460, exec_Z3_ast_vector_set);
in.register_cmd(461, exec_Z3_ast_vector_resize);
in.register_cmd(462, exec_Z3_ast_vector_push);
in.register_cmd(463, exec_Z3_ast_vector_translate);
in.register_cmd(464, exec_Z3_ast_vector_to_string);
in.register_cmd(465, exec_Z3_mk_ast_map);
in.register_cmd(466, exec_Z3_ast_map_inc_ref);
in.register_cmd(467, exec_Z3_ast_map_dec_ref);
in.register_cmd(468, exec_Z3_ast_map_contains);
in.register_cmd(469, exec_Z3_ast_map_find);
in.register_cmd(470, exec_Z3_ast_map_insert);
in.register_cmd(471, exec_Z3_ast_map_erase);
in.register_cmd(472, exec_Z3_ast_map_size);
in.register_cmd(473, exec_Z3_ast_map_reset);
in.register_cmd(474, exec_Z3_ast_map_keys);
in.register_cmd(475, exec_Z3_ast_map_to_string);
in.register_cmd(360, exec_Z3_param_descrs_to_string);
in.register_cmd(361, exec_Z3_interrupt);
in.register_cmd(362, exec_Z3_get_error_msg_ex);
in.register_cmd(363, exec_Z3_translate);
in.register_cmd(364, exec_Z3_mk_goal);
in.register_cmd(365, exec_Z3_goal_inc_ref);
in.register_cmd(366, exec_Z3_goal_dec_ref);
in.register_cmd(367, exec_Z3_goal_precision);
in.register_cmd(368, exec_Z3_goal_assert);
in.register_cmd(369, exec_Z3_goal_inconsistent);
in.register_cmd(370, exec_Z3_goal_depth);
in.register_cmd(371, exec_Z3_goal_reset);
in.register_cmd(372, exec_Z3_goal_size);
in.register_cmd(373, exec_Z3_goal_formula);
in.register_cmd(374, exec_Z3_goal_num_exprs);
in.register_cmd(375, exec_Z3_goal_is_decided_sat);
in.register_cmd(376, exec_Z3_goal_is_decided_unsat);
in.register_cmd(377, exec_Z3_goal_translate);
in.register_cmd(378, exec_Z3_goal_to_string);
in.register_cmd(379, exec_Z3_mk_tactic);
in.register_cmd(380, exec_Z3_mk_probe);
in.register_cmd(381, exec_Z3_tactic_inc_ref);
in.register_cmd(382, exec_Z3_tactic_dec_ref);
in.register_cmd(383, exec_Z3_probe_inc_ref);
in.register_cmd(384, exec_Z3_probe_dec_ref);
in.register_cmd(385, exec_Z3_tactic_and_then);
in.register_cmd(386, exec_Z3_tactic_or_else);
in.register_cmd(387, exec_Z3_tactic_par_or);
in.register_cmd(388, exec_Z3_tactic_par_and_then);
in.register_cmd(389, exec_Z3_tactic_try_for);
in.register_cmd(390, exec_Z3_tactic_when);
in.register_cmd(391, exec_Z3_tactic_cond);
in.register_cmd(392, exec_Z3_tactic_repeat);
in.register_cmd(393, exec_Z3_tactic_skip);
in.register_cmd(394, exec_Z3_tactic_fail);
in.register_cmd(395, exec_Z3_tactic_fail_if);
in.register_cmd(396, exec_Z3_tactic_fail_if_not_decided);
in.register_cmd(397, exec_Z3_tactic_using_params);
in.register_cmd(398, exec_Z3_probe_const);
in.register_cmd(399, exec_Z3_probe_lt);
in.register_cmd(400, exec_Z3_probe_le);
in.register_cmd(401, exec_Z3_probe_gt);
in.register_cmd(402, exec_Z3_probe_ge);
in.register_cmd(403, exec_Z3_probe_eq);
in.register_cmd(404, exec_Z3_probe_and);
in.register_cmd(405, exec_Z3_probe_or);
in.register_cmd(406, exec_Z3_probe_not);
in.register_cmd(407, exec_Z3_get_num_tactics);
in.register_cmd(408, exec_Z3_get_tactic_name);
in.register_cmd(409, exec_Z3_get_num_probes);
in.register_cmd(410, exec_Z3_get_probe_name);
in.register_cmd(411, exec_Z3_tactic_get_help);
in.register_cmd(412, exec_Z3_tactic_get_param_descrs);
in.register_cmd(413, exec_Z3_tactic_get_descr);
in.register_cmd(414, exec_Z3_probe_get_descr);
in.register_cmd(415, exec_Z3_probe_apply);
in.register_cmd(416, exec_Z3_tactic_apply);
in.register_cmd(417, exec_Z3_tactic_apply_ex);
in.register_cmd(418, exec_Z3_apply_result_inc_ref);
in.register_cmd(419, exec_Z3_apply_result_dec_ref);
in.register_cmd(420, exec_Z3_apply_result_to_string);
in.register_cmd(421, exec_Z3_apply_result_get_num_subgoals);
in.register_cmd(422, exec_Z3_apply_result_get_subgoal);
in.register_cmd(423, exec_Z3_apply_result_convert_model);
in.register_cmd(424, exec_Z3_mk_solver);
in.register_cmd(425, exec_Z3_mk_simple_solver);
in.register_cmd(426, exec_Z3_mk_solver_for_logic);
in.register_cmd(427, exec_Z3_mk_solver_from_tactic);
in.register_cmd(428, exec_Z3_solver_get_help);
in.register_cmd(429, exec_Z3_solver_get_param_descrs);
in.register_cmd(430, exec_Z3_solver_set_params);
in.register_cmd(431, exec_Z3_solver_inc_ref);
in.register_cmd(432, exec_Z3_solver_dec_ref);
in.register_cmd(433, exec_Z3_solver_push);
in.register_cmd(434, exec_Z3_solver_pop);
in.register_cmd(435, exec_Z3_solver_reset);
in.register_cmd(436, exec_Z3_solver_get_num_scopes);
in.register_cmd(437, exec_Z3_solver_assert);
in.register_cmd(438, exec_Z3_solver_get_assertions);
in.register_cmd(439, exec_Z3_solver_check);
in.register_cmd(440, exec_Z3_solver_check_assumptions);
in.register_cmd(441, exec_Z3_solver_get_model);
in.register_cmd(442, exec_Z3_solver_get_proof);
in.register_cmd(443, exec_Z3_solver_get_unsat_core);
in.register_cmd(444, exec_Z3_solver_get_reason_unknown);
in.register_cmd(445, exec_Z3_solver_get_statistics);
in.register_cmd(446, exec_Z3_solver_to_string);
in.register_cmd(447, exec_Z3_stats_to_string);
in.register_cmd(448, exec_Z3_stats_inc_ref);
in.register_cmd(449, exec_Z3_stats_dec_ref);
in.register_cmd(450, exec_Z3_stats_size);
in.register_cmd(451, exec_Z3_stats_get_key);
in.register_cmd(452, exec_Z3_stats_is_uint);
in.register_cmd(453, exec_Z3_stats_is_double);
in.register_cmd(454, exec_Z3_stats_get_uint_value);
in.register_cmd(455, exec_Z3_stats_get_double_value);
in.register_cmd(456, exec_Z3_mk_ast_vector);
in.register_cmd(457, exec_Z3_ast_vector_inc_ref);
in.register_cmd(458, exec_Z3_ast_vector_dec_ref);
in.register_cmd(459, exec_Z3_ast_vector_size);
in.register_cmd(460, exec_Z3_ast_vector_get);
in.register_cmd(461, exec_Z3_ast_vector_set);
in.register_cmd(462, exec_Z3_ast_vector_resize);
in.register_cmd(463, exec_Z3_ast_vector_push);
in.register_cmd(464, exec_Z3_ast_vector_translate);
in.register_cmd(465, exec_Z3_ast_vector_to_string);
in.register_cmd(466, exec_Z3_mk_ast_map);
in.register_cmd(467, exec_Z3_ast_map_inc_ref);
in.register_cmd(468, exec_Z3_ast_map_dec_ref);
in.register_cmd(469, exec_Z3_ast_map_contains);
in.register_cmd(470, exec_Z3_ast_map_find);
in.register_cmd(471, exec_Z3_ast_map_insert);
in.register_cmd(472, exec_Z3_ast_map_erase);
in.register_cmd(473, exec_Z3_ast_map_size);
in.register_cmd(474, exec_Z3_ast_map_reset);
in.register_cmd(475, exec_Z3_ast_map_keys);
in.register_cmd(476, exec_Z3_ast_map_to_string);
}

View file

@ -2570,23 +2570,29 @@ void log_Z3_param_descrs_get_name(Z3_context a0, Z3_param_descrs a1, unsigned a2
U(a2);
C(359);
}
void log_Z3_param_descrs_to_string(Z3_context a0, Z3_param_descrs a1) {
R();
P(a0);
P(a1);
C(360);
}
void log_Z3_interrupt(Z3_context a0) {
R();
P(a0);
C(360);
C(361);
}
void log_Z3_get_error_msg_ex(Z3_context a0, Z3_error_code a1) {
R();
P(a0);
U(static_cast<unsigned>(a1));
C(361);
C(362);
}
void log_Z3_translate(Z3_context a0, Z3_ast a1, Z3_context a2) {
R();
P(a0);
P(a1);
P(a2);
C(362);
C(363);
}
void log_Z3_mk_goal(Z3_context a0, Z3_bool a1, Z3_bool a2, Z3_bool a3) {
R();
@ -2594,144 +2600,144 @@ void log_Z3_mk_goal(Z3_context a0, Z3_bool a1, Z3_bool a2, Z3_bool a3) {
I(a1);
I(a2);
I(a3);
C(363);
C(364);
}
void log_Z3_goal_inc_ref(Z3_context a0, Z3_goal a1) {
R();
P(a0);
P(a1);
C(364);
C(365);
}
void log_Z3_goal_dec_ref(Z3_context a0, Z3_goal a1) {
R();
P(a0);
P(a1);
C(365);
C(366);
}
void log_Z3_goal_precision(Z3_context a0, Z3_goal a1) {
R();
P(a0);
P(a1);
C(366);
C(367);
}
void log_Z3_goal_assert(Z3_context a0, Z3_goal a1, Z3_ast a2) {
R();
P(a0);
P(a1);
P(a2);
C(367);
C(368);
}
void log_Z3_goal_inconsistent(Z3_context a0, Z3_goal a1) {
R();
P(a0);
P(a1);
C(368);
C(369);
}
void log_Z3_goal_depth(Z3_context a0, Z3_goal a1) {
R();
P(a0);
P(a1);
C(369);
C(370);
}
void log_Z3_goal_reset(Z3_context a0, Z3_goal a1) {
R();
P(a0);
P(a1);
C(370);
C(371);
}
void log_Z3_goal_size(Z3_context a0, Z3_goal a1) {
R();
P(a0);
P(a1);
C(371);
C(372);
}
void log_Z3_goal_formula(Z3_context a0, Z3_goal a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(372);
C(373);
}
void log_Z3_goal_num_exprs(Z3_context a0, Z3_goal a1) {
R();
P(a0);
P(a1);
C(373);
C(374);
}
void log_Z3_goal_is_decided_sat(Z3_context a0, Z3_goal a1) {
R();
P(a0);
P(a1);
C(374);
C(375);
}
void log_Z3_goal_is_decided_unsat(Z3_context a0, Z3_goal a1) {
R();
P(a0);
P(a1);
C(375);
C(376);
}
void log_Z3_goal_translate(Z3_context a0, Z3_goal a1, Z3_context a2) {
R();
P(a0);
P(a1);
P(a2);
C(376);
C(377);
}
void log_Z3_goal_to_string(Z3_context a0, Z3_goal a1) {
R();
P(a0);
P(a1);
C(377);
C(378);
}
void log_Z3_mk_tactic(Z3_context a0, Z3_string a1) {
R();
P(a0);
S(a1);
C(378);
C(379);
}
void log_Z3_mk_probe(Z3_context a0, Z3_string a1) {
R();
P(a0);
S(a1);
C(379);
C(380);
}
void log_Z3_tactic_inc_ref(Z3_context a0, Z3_tactic a1) {
R();
P(a0);
P(a1);
C(380);
C(381);
}
void log_Z3_tactic_dec_ref(Z3_context a0, Z3_tactic a1) {
R();
P(a0);
P(a1);
C(381);
C(382);
}
void log_Z3_probe_inc_ref(Z3_context a0, Z3_probe a1) {
R();
P(a0);
P(a1);
C(382);
C(383);
}
void log_Z3_probe_dec_ref(Z3_context a0, Z3_probe a1) {
R();
P(a0);
P(a1);
C(383);
C(384);
}
void log_Z3_tactic_and_then(Z3_context a0, Z3_tactic a1, Z3_tactic a2) {
R();
P(a0);
P(a1);
P(a2);
C(384);
C(385);
}
void log_Z3_tactic_or_else(Z3_context a0, Z3_tactic a1, Z3_tactic a2) {
R();
P(a0);
P(a1);
P(a2);
C(385);
C(386);
}
void log_Z3_tactic_par_or(Z3_context a0, unsigned a1, Z3_tactic const * a2) {
R();
@ -2739,28 +2745,28 @@ void log_Z3_tactic_par_or(Z3_context a0, unsigned a1, Z3_tactic const * a2) {
U(a1);
for (unsigned i = 0; i < a1; i++) { P(a2[i]); }
Ap(a1);
C(386);
C(387);
}
void log_Z3_tactic_par_and_then(Z3_context a0, Z3_tactic a1, Z3_tactic a2) {
R();
P(a0);
P(a1);
P(a2);
C(387);
C(388);
}
void log_Z3_tactic_try_for(Z3_context a0, Z3_tactic a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(388);
C(389);
}
void log_Z3_tactic_when(Z3_context a0, Z3_probe a1, Z3_tactic a2) {
R();
P(a0);
P(a1);
P(a2);
C(389);
C(390);
}
void log_Z3_tactic_cond(Z3_context a0, Z3_probe a1, Z3_tactic a2, Z3_tactic a3) {
R();
@ -2768,163 +2774,163 @@ void log_Z3_tactic_cond(Z3_context a0, Z3_probe a1, Z3_tactic a2, Z3_tactic a3)
P(a1);
P(a2);
P(a3);
C(390);
C(391);
}
void log_Z3_tactic_repeat(Z3_context a0, Z3_tactic a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(391);
C(392);
}
void log_Z3_tactic_skip(Z3_context a0) {
R();
P(a0);
C(392);
C(393);
}
void log_Z3_tactic_fail(Z3_context a0) {
R();
P(a0);
C(393);
C(394);
}
void log_Z3_tactic_fail_if(Z3_context a0, Z3_probe a1) {
R();
P(a0);
P(a1);
C(394);
C(395);
}
void log_Z3_tactic_fail_if_not_decided(Z3_context a0) {
R();
P(a0);
C(395);
C(396);
}
void log_Z3_tactic_using_params(Z3_context a0, Z3_tactic a1, Z3_params a2) {
R();
P(a0);
P(a1);
P(a2);
C(396);
C(397);
}
void log_Z3_probe_const(Z3_context a0, double a1) {
R();
P(a0);
D(a1);
C(397);
C(398);
}
void log_Z3_probe_lt(Z3_context a0, Z3_probe a1, Z3_probe a2) {
R();
P(a0);
P(a1);
P(a2);
C(398);
C(399);
}
void log_Z3_probe_le(Z3_context a0, Z3_probe a1, Z3_probe a2) {
R();
P(a0);
P(a1);
P(a2);
C(399);
C(400);
}
void log_Z3_probe_gt(Z3_context a0, Z3_probe a1, Z3_probe a2) {
R();
P(a0);
P(a1);
P(a2);
C(400);
C(401);
}
void log_Z3_probe_ge(Z3_context a0, Z3_probe a1, Z3_probe a2) {
R();
P(a0);
P(a1);
P(a2);
C(401);
C(402);
}
void log_Z3_probe_eq(Z3_context a0, Z3_probe a1, Z3_probe a2) {
R();
P(a0);
P(a1);
P(a2);
C(402);
C(403);
}
void log_Z3_probe_and(Z3_context a0, Z3_probe a1, Z3_probe a2) {
R();
P(a0);
P(a1);
P(a2);
C(403);
C(404);
}
void log_Z3_probe_or(Z3_context a0, Z3_probe a1, Z3_probe a2) {
R();
P(a0);
P(a1);
P(a2);
C(404);
C(405);
}
void log_Z3_probe_not(Z3_context a0, Z3_probe a1) {
R();
P(a0);
P(a1);
C(405);
C(406);
}
void log_Z3_get_num_tactics(Z3_context a0) {
R();
P(a0);
C(406);
C(407);
}
void log_Z3_get_tactic_name(Z3_context a0, unsigned a1) {
R();
P(a0);
U(a1);
C(407);
C(408);
}
void log_Z3_get_num_probes(Z3_context a0) {
R();
P(a0);
C(408);
C(409);
}
void log_Z3_get_probe_name(Z3_context a0, unsigned a1) {
R();
P(a0);
U(a1);
C(409);
C(410);
}
void log_Z3_tactic_get_help(Z3_context a0, Z3_tactic a1) {
R();
P(a0);
P(a1);
C(410);
C(411);
}
void log_Z3_tactic_get_param_descrs(Z3_context a0, Z3_tactic a1) {
R();
P(a0);
P(a1);
C(411);
C(412);
}
void log_Z3_tactic_get_descr(Z3_context a0, Z3_string a1) {
R();
P(a0);
S(a1);
C(412);
C(413);
}
void log_Z3_probe_get_descr(Z3_context a0, Z3_string a1) {
R();
P(a0);
S(a1);
C(413);
C(414);
}
void log_Z3_probe_apply(Z3_context a0, Z3_probe a1, Z3_goal a2) {
R();
P(a0);
P(a1);
P(a2);
C(414);
C(415);
}
void log_Z3_tactic_apply(Z3_context a0, Z3_tactic a1, Z3_goal a2) {
R();
P(a0);
P(a1);
P(a2);
C(415);
C(416);
}
void log_Z3_tactic_apply_ex(Z3_context a0, Z3_tactic a1, Z3_goal a2, Z3_params a3) {
R();
@ -2932,38 +2938,38 @@ void log_Z3_tactic_apply_ex(Z3_context a0, Z3_tactic a1, Z3_goal a2, Z3_params a
P(a1);
P(a2);
P(a3);
C(416);
C(417);
}
void log_Z3_apply_result_inc_ref(Z3_context a0, Z3_apply_result a1) {
R();
P(a0);
P(a1);
C(417);
C(418);
}
void log_Z3_apply_result_dec_ref(Z3_context a0, Z3_apply_result a1) {
R();
P(a0);
P(a1);
C(418);
C(419);
}
void log_Z3_apply_result_to_string(Z3_context a0, Z3_apply_result a1) {
R();
P(a0);
P(a1);
C(419);
C(420);
}
void log_Z3_apply_result_get_num_subgoals(Z3_context a0, Z3_apply_result a1) {
R();
P(a0);
P(a1);
C(420);
C(421);
}
void log_Z3_apply_result_get_subgoal(Z3_context a0, Z3_apply_result a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(421);
C(422);
}
void log_Z3_apply_result_convert_model(Z3_context a0, Z3_apply_result a1, unsigned a2, Z3_model a3) {
R();
@ -2971,104 +2977,104 @@ void log_Z3_apply_result_convert_model(Z3_context a0, Z3_apply_result a1, unsign
P(a1);
U(a2);
P(a3);
C(422);
C(423);
}
void log_Z3_mk_solver(Z3_context a0) {
R();
P(a0);
C(423);
C(424);
}
void log_Z3_mk_simple_solver(Z3_context a0) {
R();
P(a0);
C(424);
C(425);
}
void log_Z3_mk_solver_for_logic(Z3_context a0, Z3_symbol a1) {
R();
P(a0);
Sy(a1);
C(425);
C(426);
}
void log_Z3_mk_solver_from_tactic(Z3_context a0, Z3_tactic a1) {
R();
P(a0);
P(a1);
C(426);
C(427);
}
void log_Z3_solver_get_help(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(427);
C(428);
}
void log_Z3_solver_get_param_descrs(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(428);
C(429);
}
void log_Z3_solver_set_params(Z3_context a0, Z3_solver a1, Z3_params a2) {
R();
P(a0);
P(a1);
P(a2);
C(429);
C(430);
}
void log_Z3_solver_inc_ref(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(430);
C(431);
}
void log_Z3_solver_dec_ref(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(431);
C(432);
}
void log_Z3_solver_push(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(432);
C(433);
}
void log_Z3_solver_pop(Z3_context a0, Z3_solver a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(433);
C(434);
}
void log_Z3_solver_reset(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(434);
C(435);
}
void log_Z3_solver_get_num_scopes(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(435);
C(436);
}
void log_Z3_solver_assert(Z3_context a0, Z3_solver a1, Z3_ast a2) {
R();
P(a0);
P(a1);
P(a2);
C(436);
C(437);
}
void log_Z3_solver_get_assertions(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(437);
C(438);
}
void log_Z3_solver_check(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(438);
C(439);
}
void log_Z3_solver_check_assumptions(Z3_context a0, Z3_solver a1, unsigned a2, Z3_ast const * a3) {
R();
@ -3077,132 +3083,132 @@ void log_Z3_solver_check_assumptions(Z3_context a0, Z3_solver a1, unsigned a2, Z
U(a2);
for (unsigned i = 0; i < a2; i++) { P(a3[i]); }
Ap(a2);
C(439);
C(440);
}
void log_Z3_solver_get_model(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(440);
C(441);
}
void log_Z3_solver_get_proof(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(441);
C(442);
}
void log_Z3_solver_get_unsat_core(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(442);
C(443);
}
void log_Z3_solver_get_reason_unknown(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(443);
C(444);
}
void log_Z3_solver_get_statistics(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(444);
C(445);
}
void log_Z3_solver_to_string(Z3_context a0, Z3_solver a1) {
R();
P(a0);
P(a1);
C(445);
C(446);
}
void log_Z3_stats_to_string(Z3_context a0, Z3_stats a1) {
R();
P(a0);
P(a1);
C(446);
C(447);
}
void log_Z3_stats_inc_ref(Z3_context a0, Z3_stats a1) {
R();
P(a0);
P(a1);
C(447);
C(448);
}
void log_Z3_stats_dec_ref(Z3_context a0, Z3_stats a1) {
R();
P(a0);
P(a1);
C(448);
C(449);
}
void log_Z3_stats_size(Z3_context a0, Z3_stats a1) {
R();
P(a0);
P(a1);
C(449);
C(450);
}
void log_Z3_stats_get_key(Z3_context a0, Z3_stats a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(450);
C(451);
}
void log_Z3_stats_is_uint(Z3_context a0, Z3_stats a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(451);
C(452);
}
void log_Z3_stats_is_double(Z3_context a0, Z3_stats a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(452);
C(453);
}
void log_Z3_stats_get_uint_value(Z3_context a0, Z3_stats a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(453);
C(454);
}
void log_Z3_stats_get_double_value(Z3_context a0, Z3_stats a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(454);
C(455);
}
void log_Z3_mk_ast_vector(Z3_context a0) {
R();
P(a0);
C(455);
C(456);
}
void log_Z3_ast_vector_inc_ref(Z3_context a0, Z3_ast_vector a1) {
R();
P(a0);
P(a1);
C(456);
C(457);
}
void log_Z3_ast_vector_dec_ref(Z3_context a0, Z3_ast_vector a1) {
R();
P(a0);
P(a1);
C(457);
C(458);
}
void log_Z3_ast_vector_size(Z3_context a0, Z3_ast_vector a1) {
R();
P(a0);
P(a1);
C(458);
C(459);
}
void log_Z3_ast_vector_get(Z3_context a0, Z3_ast_vector a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(459);
C(460);
}
void log_Z3_ast_vector_set(Z3_context a0, Z3_ast_vector a1, unsigned a2, Z3_ast a3) {
R();
@ -3210,65 +3216,65 @@ void log_Z3_ast_vector_set(Z3_context a0, Z3_ast_vector a1, unsigned a2, Z3_ast
P(a1);
U(a2);
P(a3);
C(460);
C(461);
}
void log_Z3_ast_vector_resize(Z3_context a0, Z3_ast_vector a1, unsigned a2) {
R();
P(a0);
P(a1);
U(a2);
C(461);
C(462);
}
void log_Z3_ast_vector_push(Z3_context a0, Z3_ast_vector a1, Z3_ast a2) {
R();
P(a0);
P(a1);
P(a2);
C(462);
C(463);
}
void log_Z3_ast_vector_translate(Z3_context a0, Z3_ast_vector a1, Z3_context a2) {
R();
P(a0);
P(a1);
P(a2);
C(463);
C(464);
}
void log_Z3_ast_vector_to_string(Z3_context a0, Z3_ast_vector a1) {
R();
P(a0);
P(a1);
C(464);
C(465);
}
void log_Z3_mk_ast_map(Z3_context a0) {
R();
P(a0);
C(465);
C(466);
}
void log_Z3_ast_map_inc_ref(Z3_context a0, Z3_ast_map a1) {
R();
P(a0);
P(a1);
C(466);
C(467);
}
void log_Z3_ast_map_dec_ref(Z3_context a0, Z3_ast_map a1) {
R();
P(a0);
P(a1);
C(467);
C(468);
}
void log_Z3_ast_map_contains(Z3_context a0, Z3_ast_map a1, Z3_ast a2) {
R();
P(a0);
P(a1);
P(a2);
C(468);
C(469);
}
void log_Z3_ast_map_find(Z3_context a0, Z3_ast_map a1, Z3_ast a2) {
R();
P(a0);
P(a1);
P(a2);
C(469);
C(470);
}
void log_Z3_ast_map_insert(Z3_context a0, Z3_ast_map a1, Z3_ast a2, Z3_ast a3) {
R();
@ -3276,36 +3282,36 @@ void log_Z3_ast_map_insert(Z3_context a0, Z3_ast_map a1, Z3_ast a2, Z3_ast a3) {
P(a1);
P(a2);
P(a3);
C(470);
C(471);
}
void log_Z3_ast_map_erase(Z3_context a0, Z3_ast_map a1, Z3_ast a2) {
R();
P(a0);
P(a1);
P(a2);
C(471);
C(472);
}
void log_Z3_ast_map_size(Z3_context a0, Z3_ast_map a1) {
R();
P(a0);
P(a1);
C(472);
C(473);
}
void log_Z3_ast_map_reset(Z3_context a0, Z3_ast_map a1) {
R();
P(a0);
P(a1);
C(473);
C(474);
}
void log_Z3_ast_map_keys(Z3_context a0, Z3_ast_map a1) {
R();
P(a0);
P(a1);
C(474);
C(475);
}
void log_Z3_ast_map_to_string(Z3_context a0, Z3_ast_map a1) {
R();
P(a0);
P(a1);
C(475);
C(476);
}

View file

@ -741,6 +741,8 @@ void log_Z3_param_descrs_size(Z3_context a0, Z3_param_descrs a1);
#define LOG_Z3_param_descrs_size(_ARG0, _ARG1) z3_log_ctx _LOG_CTX; if (_LOG_CTX.enabled()) { log_Z3_param_descrs_size(_ARG0, _ARG1); }
void log_Z3_param_descrs_get_name(Z3_context a0, Z3_param_descrs a1, unsigned a2);
#define LOG_Z3_param_descrs_get_name(_ARG0, _ARG1, _ARG2) z3_log_ctx _LOG_CTX; if (_LOG_CTX.enabled()) { log_Z3_param_descrs_get_name(_ARG0, _ARG1, _ARG2); }
void log_Z3_param_descrs_to_string(Z3_context a0, Z3_param_descrs a1);
#define LOG_Z3_param_descrs_to_string(_ARG0, _ARG1) z3_log_ctx _LOG_CTX; if (_LOG_CTX.enabled()) { log_Z3_param_descrs_to_string(_ARG0, _ARG1); }
void log_Z3_interrupt(Z3_context a0);
#define LOG_Z3_interrupt(_ARG0) z3_log_ctx _LOG_CTX; if (_LOG_CTX.enabled()) { log_Z3_interrupt(_ARG0); }
void log_Z3_get_error_msg_ex(Z3_context a0, Z3_error_code a1);

View file

@ -179,4 +179,21 @@ extern "C" {
Z3_CATCH_RETURN(0);
}
Z3_string Z3_API Z3_param_descrs_to_string(Z3_context c, Z3_param_descrs p) {
Z3_TRY;
LOG_Z3_param_descrs_to_string(c, p);
RESET_ERROR_CODE();
std::ostringstream buffer;
buffer << "(";
unsigned sz = to_param_descrs_ptr(p)->size();
for (unsigned i = 0; i < sz; i++) {
if (i > 0)
buffer << ", ";
buffer << to_param_descrs_ptr(p)->get_param_name(i);
}
buffer << ")";
return mk_c(c)->mk_external_string(buffer.str());
Z3_CATCH_RETURN("");
}
};

View file

@ -332,8 +332,8 @@ inline func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, bool is_real) {
case OP_SUB: return is_real ? m_r_sub_decl : m_i_sub_decl;
case OP_UMINUS: return is_real ? m_r_uminus_decl : m_i_uminus_decl;
case OP_MUL: return is_real ? m_r_mul_decl : m_i_mul_decl;
case OP_DIV: SASSERT(is_real); return m_r_div_decl;
case OP_IDIV: SASSERT(!is_real); return m_i_div_decl;
case OP_DIV: return m_r_div_decl;
case OP_IDIV: return m_i_div_decl;
case OP_REM: return m_i_rem_decl;
case OP_MOD: return m_i_mod_decl;
case OP_TO_REAL: return m_to_real_decl;
@ -415,6 +415,24 @@ func_decl * arith_decl_plugin::mk_num_decl(unsigned num_parameters, parameter co
else
return m_manager->mk_const_decl(m_realv_sym, m_real_decl, func_decl_info(m_family_id, OP_NUM, num_parameters, parameters));
}
static bool use_coercion(decl_kind k) {
return k == OP_ADD || k == OP_SUB || k == OP_MUL || k == OP_POWER || k == OP_LE || k == OP_GE || k == OP_LT || k == OP_GT || k == OP_UMINUS;
}
static bool has_real_arg(unsigned arity, sort * const * domain, sort * real_sort) {
for (unsigned i = 0; i < arity; i++)
if (domain[i] == real_sort)
return true;
return false;
}
static bool has_real_arg(ast_manager * m, unsigned num_args, expr * const * args, sort * real_sort) {
for (unsigned i = 0; i < num_args; i++)
if (m->get_sort(args[i]) == real_sort)
return true;
return false;
}
func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range) {
@ -424,8 +442,13 @@ func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
m_manager->raise_exception("no arguments supplied to arithmetical operator");
return 0;
}
bool is_real = arity > 0 && domain[0] == m_real_decl;
return mk_func_decl(fix_kind(k, arity), is_real);
if (m_manager->int_real_coercions() && use_coercion(k)) {
return mk_func_decl(fix_kind(k, arity), has_real_arg(arity, domain, m_real_decl));
}
else {
bool is_real = arity > 0 && domain[0] == m_real_decl;
return mk_func_decl(fix_kind(k, arity), is_real);
}
}
func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
@ -436,8 +459,13 @@ func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters
m_manager->raise_exception("no arguments supplied to arithmetical operator");
return 0;
}
bool is_real = num_args > 0 && m_manager->get_sort(args[0]) == m_real_decl;
return mk_func_decl(fix_kind(k, num_args), is_real);
if (m_manager->int_real_coercions() && use_coercion(k)) {
return mk_func_decl(fix_kind(k, num_args), has_real_arg(m_manager, num_args, args, m_real_decl));
}
else {
bool is_real = num_args > 0 && m_manager->get_sort(args[0]) == m_real_decl;
return mk_func_decl(fix_kind(k, num_args), is_real);
}
}
void arith_decl_plugin::get_sort_names(svector<builtin_name>& sort_names, symbol const & logic) {

View file

@ -943,6 +943,42 @@ br_status arith_rewriter::mk_to_int_core(expr * arg, expr_ref & result) {
return BR_DONE;
}
else {
if (m_util.is_add(arg) || m_util.is_mul(arg) || m_util.is_power(arg)) {
// Try to apply simplifications such as:
// (to_int (+ 1.0 (to_real x))) --> (+ 1 x)
// if all arguments of arg are
// - integer numerals, OR
// - to_real applications
// then, to_int can be eliminated
unsigned num_args = to_app(arg)->get_num_args();
unsigned i = 0;
for (; i < num_args; i++) {
expr * c = to_app(arg)->get_arg(i);
if (m_util.is_numeral(c, a) && a.is_int())
continue;
if (m_util.is_to_real(c))
continue;
break; // failed
}
if (i == num_args) {
// simplification can be applied
expr_ref_buffer new_args(m());
for (i = 0; i < num_args; i++) {
expr * c = to_app(arg)->get_arg(i);
if (m_util.is_numeral(c, a) && a.is_int()) {
new_args.push_back(m_util.mk_numeral(a, true));
}
else {
SASSERT(m_util.is_to_real(c));
new_args.push_back(to_app(c)->get_arg(0));
}
}
SASSERT(num_args == new_args.size());
result = m().mk_app(get_fid(), to_app(arg)->get_decl()->get_decl_kind(), new_args.size(), new_args.c_ptr());
return BR_REWRITE1;
}
}
return BR_FAILED;
}
}

View file

@ -237,18 +237,20 @@ func_decl* array_decl_plugin::mk_select(unsigned arity, sort * const * domain) {
m_manager->raise_exception("select requires as many arguments as the size of the domain");
return 0;
}
if (domain[0] != s) {
m_manager->raise_exception("first argument of select needs to be an array");
return 0;
}
ptr_buffer<sort> new_domain; // we need this because of coercions.
new_domain.push_back(s);
for (unsigned i = 0; i + 1 < num_parameters; ++i) {
if (!parameters[i].is_ast() || domain[i+1] != parameters[i].get_ast()) {
if (!parameters[i].is_ast() ||
!is_sort(parameters[i].get_ast()) ||
!m_manager->compatible_sorts(domain[i+1], to_sort(parameters[i].get_ast()))) {
m_manager->raise_exception("domain sort and parameter do not match");
UNREACHABLE();
return 0;
}
new_domain.push_back(to_sort(parameters[i].get_ast()));
}
return m_manager->mk_func_decl(m_select_sym, arity, domain, get_array_range(domain[0]),
SASSERT(new_domain.size() == arity);
return m_manager->mk_func_decl(m_select_sym, arity, new_domain.c_ptr(), get_array_range(domain[0]),
func_decl_info(m_family_id, OP_SELECT));
}
@ -273,18 +275,22 @@ func_decl * array_decl_plugin::mk_store(unsigned arity, sort * const * domain) {
UNREACHABLE();
return 0;
}
ptr_buffer<sort> new_domain; // we need this because of coercions.
new_domain.push_back(s);
for (unsigned i = 0; i < num_parameters; ++i) {
if (!parameters[i].is_ast()) {
if (!parameters[i].is_ast() || !is_sort(parameters[i].get_ast())) {
m_manager->raise_exception("expecting sort parameter");
return 0;
}
if (parameters[i].get_ast() != domain[i+1]) {
if (!m_manager->compatible_sorts(to_sort(parameters[i].get_ast()), domain[i+1])) {
m_manager->raise_exception("domain sort and parameter do not match");
UNREACHABLE();
return 0;
}
new_domain.push_back(to_sort(parameters[i].get_ast()));
}
return m_manager->mk_func_decl(m_store_sym, arity, domain, domain[0],
SASSERT(new_domain.size() == arity);
return m_manager->mk_func_decl(m_store_sym, arity, new_domain.c_ptr(), domain[0],
func_decl_info(m_family_id, OP_STORE));
}

View file

@ -1231,6 +1231,7 @@ ast_manager::ast_manager(ast_manager const & src, bool disable_proofs):
}
void ast_manager::init() {
m_int_real_coercions = true;
m_debug_ref_count = false;
m_fresh_id = 0;
m_expr_id_gen.reset(0);
@ -1241,6 +1242,7 @@ void ast_manager::init() {
m_pattern_family_id = get_family_id("pattern");
m_model_value_family_id = get_family_id("model-value");
m_user_sort_family_id = get_family_id("user-sort");
m_arith_family_id = get_family_id("arith");
basic_decl_plugin * plugin = alloc(basic_decl_plugin);
register_plugin(m_basic_family_id, plugin);
m_bool_sort = plugin->mk_bool_sort();
@ -1772,7 +1774,7 @@ void ast_manager::check_sort(func_decl const * decl, unsigned num_args, expr * c
sort * expected = decl->get_domain(0);
for (unsigned i = 0; i < num_args; i++) {
sort * given = get_sort(args[i]);
if (expected != given) {
if (!compatible_sorts(expected, given)) {
string_buffer<> buff;
buff << "invalid function application, sort mismatch on argument at position " << (i+1);
throw ast_exception(buff.c_str());
@ -1786,7 +1788,7 @@ void ast_manager::check_sort(func_decl const * decl, unsigned num_args, expr * c
for (unsigned i = 0; i < num_args; i++) {
sort * expected = decl->get_domain(i);
sort * given = get_sort(args[i]);
if (expected != given) {
if (!compatible_sorts(expected, given)) {
string_buffer<> buff;
buff << "invalid function application, sort mismatch on argument at position " << (i+1);
throw ast_exception(buff.c_str());
@ -1822,11 +1824,80 @@ bool ast_manager::check_sorts(ast const * n) const {
}
}
bool ast_manager::compatible_sorts(sort * s1, sort * s2) const {
if (s1 == s2)
return true;
if (m_int_real_coercions)
return s1->get_family_id() == m_arith_family_id && s2->get_family_id() == m_arith_family_id;
return false;
}
bool ast_manager::coercion_needed(func_decl * decl, unsigned num_args, expr * const * args) {
SASSERT(m_int_real_coercions);
if (decl->is_associative()) {
sort * d = decl->get_domain(0);
if (d->get_family_id() == m_arith_family_id) {
for (unsigned i = 0; i < num_args; i++) {
if (d != get_sort(args[i]))
return true;
}
}
}
else {
for (unsigned i = 0; i < num_args; i++) {
sort * d = decl->get_domain(i);
if (d->get_family_id() == m_arith_family_id && d != get_sort(args[i]))
return true;
}
}
return false;
}
app * ast_manager::mk_app_core(func_decl * decl, unsigned num_args, expr * const * args) {
unsigned sz = app::get_obj_size(num_args);
void * mem = allocate_node(sz);
app * new_node = new (mem) app(decl, num_args, args);
app * r = register_node(new_node);
app * new_node;
app * r;
if (m_int_real_coercions && coercion_needed(decl, num_args, args)) {
expr_ref_buffer new_args(*this);
if (decl->is_associative()) {
sort * d = decl->get_domain(0);
for (unsigned i = 0; i < num_args; i++) {
sort * s = get_sort(args[i]);
if (d != s && d->get_family_id() == m_arith_family_id && s->get_family_id() == m_arith_family_id) {
if (d->get_decl_kind() == REAL_SORT)
new_args.push_back(mk_app(m_arith_family_id, OP_TO_REAL, args[i]));
else
new_args.push_back(mk_app(m_arith_family_id, OP_TO_INT, args[i]));
}
else {
new_args.push_back(args[i]);
}
}
}
else {
for (unsigned i = 0; i < num_args; i++) {
sort * d = decl->get_domain(i);
sort * s = get_sort(args[i]);
if (d != s && d->get_family_id() == m_arith_family_id && s->get_family_id() == m_arith_family_id) {
if (d->get_decl_kind() == REAL_SORT)
new_args.push_back(mk_app(m_arith_family_id, OP_TO_REAL, args[i]));
else
new_args.push_back(mk_app(m_arith_family_id, OP_TO_INT, args[i]));
}
else {
new_args.push_back(args[i]);
}
}
}
SASSERT(new_args.size() == num_args);
new_node = new (mem) app(decl, num_args, new_args.c_ptr());
r = register_node(new_node);
}
else {
new_node = new (mem) app(decl, num_args, args);
r = register_node(new_node);
}
#ifndef SMTCOMP
if (m_trace_stream != NULL && r == new_node) {
*m_trace_stream << "[mk-app] #" << r->get_id() << " ";

View file

@ -1282,6 +1282,8 @@ enum proof_gen_mode {
//
// -----------------------------------
class arith_decl_plugin;
class ast_manager {
protected:
protected:
@ -1331,11 +1333,13 @@ protected:
expr_dependency_array_manager m_expr_dependency_array_manager;
ptr_vector<decl_plugin> m_plugins;
proof_gen_mode m_proof_mode;
bool m_int_real_coercions; // If true, use hack that automatically introduces to_int/to_real when needed.
family_id m_basic_family_id;
family_id m_label_family_id;
family_id m_pattern_family_id;
family_id m_model_value_family_id;
family_id m_user_sort_family_id;
family_id m_arith_family_id;
ast_table m_ast_table;
id_gen m_expr_id_gen;
id_gen m_decl_id_gen;
@ -1355,11 +1359,19 @@ protected:
void init();
bool coercion_needed(func_decl * decl, unsigned num_args, expr * const * args);
public:
ast_manager(proof_gen_mode = PGM_DISABLED, std::ostream * trace_stream = NULL, bool is_format_manager = false);
ast_manager(ast_manager const & src, bool disable_proofs = false);
~ast_manager();
void enable_int_real_coercions(bool f) { m_int_real_coercions = f; }
bool int_real_coercions() const { return m_int_real_coercions; }
// Return true if s1 and s2 are equal, or coercions are enabled, and s1 and s2 are compatible.
bool compatible_sorts(sort * s1, sort * s2) const;
// For debugging purposes
void display_free_ids(std::ostream & out) { m_expr_id_gen.display_free_ids(out); out << "\n"; m_decl_id_gen.display_free_ids(out); }

View file

@ -258,6 +258,7 @@ protected:
symbol m_global_decls;
symbol m_numeral_as_real;
symbol m_error_behavior;
symbol m_int_real_coercions;
ini_params m_ini;
bool is_builtin_option(symbol const & s) const {
@ -288,6 +289,7 @@ public:
m_global_decls(":global-decls"),
m_numeral_as_real(":numeral-as-real"),
m_error_behavior(":error-behavior"),
m_int_real_coercions(":int-real-coercions"),
m_ini(false) {
params.register_params(m_ini);
register_pp_params(m_ini);
@ -376,6 +378,9 @@ class set_option_cmd : public set_get_option_cmd {
else if (m_option == m_numeral_as_real) {
ctx.set_numeral_as_real(to_bool(value));
}
else if (m_option == m_int_real_coercions) {
ctx.m().enable_int_real_coercions(to_bool(value));
}
#ifdef Z3DEBUG
else if (m_option == ":enable-assertions") {
enable_assertions(to_bool(value));
@ -536,6 +541,9 @@ public:
print_string(ctx, "continued-execution");
}
}
else if (opt == m_int_real_coercions) {
print_bool(ctx, ctx.m().int_real_coercions());
}
else {
std::string iopt = smt_keyword2opt_name(opt);
std::string r;

View file

@ -532,6 +532,8 @@ void cmd_context::init_manager() {
m_manager = alloc(ast_manager, m_params.m_proof_mode, m_params.m_trace_stream);
m_pmanager = alloc(pdecl_manager, *m_manager);
init_manager_core(true);
if (m_params.m_smtlib2_compliant)
m_manager->enable_int_real_coercions(false);
}
void cmd_context::init_external_manager() {

View file

@ -17,6 +17,8 @@ Revision History:
--*/
#include"dimacs.h"
#undef max
#undef min
#include"sat_solver.h"
class stream_buffer {

View file

@ -19,6 +19,10 @@ Revision History:
#ifndef _DL_CONTEXT_H_
#define _DL_CONTEXT_H_
#ifdef _CYGWIN
#undef min
#undef max
#endif
#include"arith_decl_plugin.h"
#include"front_end_params.h"
#include"map.h"

View file

@ -95,8 +95,7 @@ struct front_end_params : public preprocessor_params, public spc_params, public
#else
m_auto_config(false),
#endif
#if 1
// #if defined(SMTCOMP) TODO: put it back after SMTCOMP
#if 0
m_smtlib2_compliant(true),
#else
m_smtlib2_compliant(false),

View file

@ -21,11 +21,9 @@ Revision History:
#include<algorithm>
#ifndef _WINDOWS
#ifndef __fallthrough
#define __fallthrough
#endif
#endif
#define mix(a,b,c) \
{ \

View file

@ -146,6 +146,12 @@ public:
if (m_context)
m_context->set_progress_callback(callback);
}
virtual void collect_param_descrs(param_descrs & r) {
smt::solver::collect_param_descrs(r);
}
};
solver * mk_non_incremental_smt_solver(cmd_context & ctx) {

View file

@ -20,6 +20,10 @@ Revision History:
#ifndef _PDR_CONTEXT_H_
#define _PDR_CONTEXT_H_
#ifdef _CYGWIN
#undef min
#undef max
#endif
#include <deque>
#include "pdr_manager.h"
#include "dl_base.h"

View file

@ -18,7 +18,7 @@ Revision History:
--*/
#include"z3_exception.h"
#include"z3_omp.h"
#ifdef _WINDOWS
#if defined(_WINDOWS) || defined(_CYGWIN)
// Windows
#include<windows.h>
#elif defined(__APPLE__) && defined(__MACH__)
@ -40,12 +40,16 @@ Revision History:
#endif
#include"scoped_timer.h"
#ifdef _CYGWIN
#undef min
#undef max
#endif
#include"util.h"
#include<limits.h>
struct scoped_timer::imp {
event_handler * m_eh;
#ifdef _WINDOWS
#if defined(_WINDOWS) || defined(_CYGWIN)
HANDLE m_timer;
bool m_first;
#elif defined(__APPLE__) && defined(__MACH__)
@ -62,7 +66,7 @@ struct scoped_timer::imp {
timer_t m_timerid;
#endif
#ifdef _WINDOWS
#if defined(_WINDOWS) || defined(_CYGWIN)
static void CALLBACK abort_proc(PVOID param, BOOLEAN timer_or_wait_fired) {
imp * obj = static_cast<imp*>(param);
if (obj->m_first) {
@ -117,7 +121,7 @@ struct scoped_timer::imp {
imp(unsigned ms, event_handler * eh):
m_eh(eh) {
#ifdef _WINDOWS
#if defined(_WINDOWS) || defined(_CYGWIN)
m_first = true;
CreateTimerQueueTimer(&m_timer,
NULL,
@ -167,7 +171,7 @@ struct scoped_timer::imp {
}
~imp() {
#ifdef _WINDOWS
#if defined(_WINDOWS) || defined(_CYGWIN)
DeleteTimerQueueTimer(NULL,
m_timer,
INVALID_HANDLE_VALUE);
@ -191,7 +195,7 @@ struct scoped_timer::imp {
};
#ifdef _WINDOWS
#if defined(_WINDOWS) || defined(_CYGWIN)
#elif defined(__APPLE__) && defined(__MACH__)
// Mac OS X
#else

View file

@ -181,10 +181,6 @@ namespace smt {
void updt_params(params_ref const & p) {
params2front_end_params(p, fparams());
}
void collect_param_descrs(param_descrs & d) {
solver_front_end_params_descrs(d);
}
};
solver::solver(ast_manager & m, front_end_params & fp, params_ref const & p) {
@ -346,8 +342,8 @@ namespace smt {
return m_imp->updt_params(p);
}
void solver::collect_param_descrs(param_descrs & d) const {
return m_imp->collect_param_descrs(d);
void solver::collect_param_descrs(param_descrs & d) {
solver_front_end_params_descrs(d);
}
context & solver::kernel() {

View file

@ -228,7 +228,7 @@ namespace smt {
/**
\brief Collect a description of the configuration parameters.
*/
void collect_param_descrs(param_descrs & d) const;
static void collect_param_descrs(param_descrs & d);
/**
\brief Return a reference to the kernel.

View file

@ -55,9 +55,16 @@ public:
}
virtual void collect_param_descrs(param_descrs & r) {
if (m_context == 0)
return;
m_context->collect_param_descrs(r);
if (m_context == 0) {
ast_manager m;
m.register_decl_plugins();
front_end_params p;
smt::solver s(m, p);
s.collect_param_descrs(r);
}
else {
m_context->collect_param_descrs(r);
}
}
virtual void init(ast_manager & m, symbol const & logic) {

View file

@ -20,7 +20,7 @@ Revision History:
#ifndef _STOPWATCH_H_
#define _STOPWATCH_H_
#ifdef _WINDOWS
#if defined(_WINDOWS) || defined(_CYGWIN)
// Does this redefinition work?
#define ARRAYSIZE_TEMP ARRAYSIZE

View file

@ -33,7 +33,7 @@ strategic_solver::strategic_solver():
m_check_sat_executed(false),
m_inc_solver(0),
m_inc_solver_timeout(UINT_MAX),
m_tactic_if_undef(false),
m_inc_unknown_behavior(IUB_USE_TACTIC_IF_QF),
m_default_fct(0),
m_curr_tactic(0),
m_proof(0),
@ -56,6 +56,29 @@ strategic_solver::~strategic_solver() {
m().dec_ref(m_proof);
}
bool strategic_solver::has_quantifiers() const {
unsigned sz = get_num_assertions();
for (unsigned i = 0; i < sz; i++) {
if (::has_quantifiers(get_assertion(i)))
return true;
}
return false;
}
/**
\brief Return true if a tactic should be used when the incremental solver returns unknown.
*/
bool strategic_solver::use_tactic_when_undef() const {
switch (m_inc_unknown_behavior) {
case IUB_RETURN_UNDEF: return false;
case IUB_USE_TACTIC_IF_QF: return !has_quantifiers();
case IUB_USE_TACTIC: return true;
default:
UNREACHABLE();
return false;
}
}
void strategic_solver::set_inc_solver(solver * s) {
SASSERT(m_inc_solver == 0);
SASSERT(m_num_scopes == 0);
@ -86,13 +109,6 @@ void strategic_solver::set_inc_solver_timeout(unsigned timeout) {
m_inc_solver_timeout = timeout;
}
/**
\brief Use tactic when the incremental solver return undef.
*/
void strategic_solver::use_tactic_if_undef(bool f) {
m_tactic_if_undef = f;
}
/**
\brief Set the default tactic factory.
It is used if there is no tactic for a given logic.
@ -285,7 +301,7 @@ lbool strategic_solver::check_sat(unsigned num_assumptions, expr * const * assum
IF_VERBOSE(PS_VB_LVL, verbose_stream() << "using incremental solver (without a timeout).\n";);
m_use_inc_solver_results = true;
lbool r = m_inc_solver->check_sat(0, 0);
if (r != l_undef || factory == 0 || !m_tactic_if_undef) {
if (r != l_undef || factory == 0 || !use_tactic_when_undef()) {
m_use_inc_solver_results = true;
return r;
}
@ -299,7 +315,7 @@ lbool strategic_solver::check_sat(unsigned num_assumptions, expr * const * assum
scoped_timer timer(m_inc_solver_timeout, &eh);
r = m_inc_solver->check_sat(0, 0);
}
if ((r != l_undef || !m_tactic_if_undef) && !eh.m_canceled) {
if ((r != l_undef || !use_tactic_when_undef()) && !eh.m_canceled) {
m_use_inc_solver_results = true;
return r;
}

View file

@ -26,6 +26,15 @@ class progress_callback;
struct front_end_params;
class strategic_solver : public solver {
public:
// Behavior when the incremental solver returns unknown.
enum inc_unknown_behavior {
IUB_RETURN_UNDEF, // just return unknown
IUB_USE_TACTIC_IF_QF, // invoke tactic if problem is quantifier free
IUB_USE_TACTIC // invoke tactic
};
private:
ast_manager * m_manager;
front_end_params * m_fparams;
symbol m_logic;
@ -34,7 +43,7 @@ class strategic_solver : public solver {
bool m_check_sat_executed;
scoped_ptr<solver> m_inc_solver;
unsigned m_inc_solver_timeout;
bool m_tactic_if_undef;
inc_unknown_behavior m_inc_unknown_behavior;
scoped_ptr<tactic_factory> m_default_fct;
dictionary<tactic_factory*> m_logic2fct;
@ -63,6 +72,9 @@ class strategic_solver : public solver {
struct mk_tactic;
bool has_quantifiers() const;
bool use_tactic_when_undef() const;
public:
strategic_solver();
~strategic_solver();
@ -73,7 +85,7 @@ public:
void set_inc_solver_timeout(unsigned timeout);
void set_default_tactic(tactic_factory * fct);
void set_tactic_for(symbol const & logic, tactic_factory * fct);
void use_tactic_if_undef(bool f);
void set_inc_unknown_behavior(inc_unknown_behavior b) { m_inc_unknown_behavior = b; }
void force_tactic(bool f) { m_force_tactic = f; }
virtual void set_front_end_params(front_end_params & p) { m_fparams = &p; }

View file

@ -19,6 +19,11 @@ Revision History:
#ifndef _TRACE_H_
#define _TRACE_H_
#ifdef _CYGWIN
#undef max
#undef min
#endif
#include<fstream>
#ifdef _TRACE

View file

@ -1456,6 +1456,12 @@ extern "C" {
*/
Z3_symbol Z3_API Z3_param_descrs_get_name(__in Z3_context c, __in Z3_param_descrs p, __in unsigned i);
/**
\brief Convert a parameter description set into a string. This function is mainly used for printing the
contents of a parameter description set.
*/
Z3_string Z3_API Z3_param_descrs_to_string(__in Z3_context c, __in Z3_param_descrs p);
/*@}*/
#endif