mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
update slicing to fix unbound variables. test datatype realizer
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
bfbdad3ce6
commit
37a13b1d09
3 changed files with 59 additions and 34 deletions
|
@ -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))))");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue