3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

Merge branch 'unstable' of https://git01.codeplex.com/z3 into unstable

This commit is contained in:
Leonardo de Moura 2012-11-04 12:49:58 -08:00
commit 2c66afadd6
14 changed files with 2015 additions and 446 deletions

View file

@ -77,7 +77,7 @@ static void validate_quant_solutions(app* x, expr* fml, expr_ref_vector& guards)
#endif
static void test_quant_solver(ast_manager& m, unsigned sz, app*const* xs, expr* fml) {
static void test_quant_solver(ast_manager& m, unsigned sz, app*const* xs, expr* fml, bool validate) {
front_end_params params;
qe::expr_quant_elim qe(m, params);
qe::guarded_defs defs(m);
@ -86,7 +86,8 @@ static void test_quant_solver(ast_manager& m, unsigned sz, app*const* xs, expr*
std::cout << mk_pp(fml, m) << "\n";
if (success) {
defs.display(std::cout);
for (unsigned i = 0; i < defs.size(); ++i) {
for (unsigned i = 0; validate && i < defs.size(); ++i) {
validate_quant_solution(m, fml, defs.guard(i), defs.defs(i));
}
}
@ -106,6 +107,10 @@ static expr_ref parse_fml(ast_manager& m, char const* str) {
<< "(declare-const z Int)\n"
<< "(declare-const a Int)\n"
<< "(declare-const b Int)\n"
<< "(declare-const P Bool)\n"
<< "(declare-const Q Bool)\n"
<< "(declare-const r1 Real)\n"
<< "(declare-const r2 Real)\n"
<< "(declare-datatypes () ((IList (nil) (cons (car Int) (cdr IList)))))\n"
<< "(declare-const l1 IList)\n"
<< "(declare-const l2 IList)\n"
@ -140,21 +145,21 @@ static void parse_fml(char const* str, app_ref_vector& vars, expr_ref& fml) {
}
}
static void test_quant_solver(ast_manager& m, app* x, char const* str) {
static void test_quant_solver(ast_manager& m, app* x, char const* str, bool validate = true) {
expr_ref fml = parse_fml(m, str);
test_quant_solver(m, 1, &x, fml);
test_quant_solver(m, 1, &x, fml, validate);
}
static void test_quant_solver(ast_manager& m, unsigned sz, app*const* xs, char const* str) {
static void test_quant_solver(ast_manager& m, unsigned sz, app*const* xs, char const* str, bool validate = true) {
expr_ref fml = parse_fml(m, str);
test_quant_solver(m, sz, xs, fml);
test_quant_solver(m, sz, xs, fml, validate);
}
static void test_quant_solver(ast_manager& m, char const* str) {
static void test_quant_solver(ast_manager& m, char const* str, bool validate = true) {
expr_ref fml(m);
app_ref_vector vars(m);
parse_fml(str, vars, fml);
test_quant_solver(m, vars.size(), vars.c_ptr(), fml);
test_quant_solver(m, vars.size(), vars.c_ptr(), fml, validate);
}
@ -222,9 +227,18 @@ static void test_quant_solve1() {
test_quant_solver(m, "(exists ((c Cell)) (= c null))");
test_quant_solver(m, "(exists ((c Cell)) (= c (cell null c1)))");
//TBD:
//test_quant_solver(m, "(exists ((c Cell)) (= (cell c c) c1))");
//test_quant_solver(m, "(exists ((c Cell)) (not (= c null)))");
test_quant_solver(m, "(exists ((c Cell)) (not (= c null)))", false);
test_quant_solver(m, "(exists ((c Cell)) (= (cell c c) c1))", false);
test_quant_solver(m, "(exists ((c Cell)) (= (cell c (cdr c1)) c1))", false);
test_quant_solver(m, "(exists ((t Tuple)) (= (tuple a P r1) t))");
test_quant_solver(m, "(exists ((t Tuple)) (= a (first t)))");
test_quant_solver(m, "(exists ((t Tuple)) (= P (second t)))");
test_quant_solver(m, "(exists ((t Tuple)) (= r2 (third t)))");
test_quant_solver(m, "(exists ((t Tuple)) (not (= a (first t))))");
test_quant_solver(m, "(exists ((t Tuple)) (not (= P (second t))))");
test_quant_solver(m, "(exists ((t Tuple)) (not (= r2 (third t))))");
}