mirror of
https://github.com/Z3Prover/z3
synced 2025-04-07 09:55:19 +00:00
Merge branch 'master' of https://github.com/z3prover/z3
This commit is contained in:
commit
c7bbf2f8de
|
@ -299,7 +299,7 @@ func_decl * array_decl_plugin::mk_store(unsigned arity, sort * const * domain) {
|
||||||
sort* srt2 = domain[i+1];
|
sort* srt2 = domain[i+1];
|
||||||
if (!m_manager->compatible_sorts(srt1, srt2)) {
|
if (!m_manager->compatible_sorts(srt1, srt2)) {
|
||||||
std::stringstream strm;
|
std::stringstream strm;
|
||||||
strm << "domain sort " << sort_ref(srt2, *m_manager) << " and parameter sort " << sort_ref(srt2, *m_manager) << " do not match";
|
strm << "domain sort " << sort_ref(srt2, *m_manager) << " and parameter sort " << sort_ref(srt1, *m_manager) << " do not match";
|
||||||
m_manager->raise_exception(strm.str());
|
m_manager->raise_exception(strm.str());
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -839,3 +839,13 @@ expr_ref th_rewriter::mk_app(func_decl* f, unsigned num_args, expr* const* args)
|
||||||
void th_rewriter::set_solver(expr_solver* solver) {
|
void th_rewriter::set_solver(expr_solver* solver) {
|
||||||
m_imp->set_solver(solver);
|
m_imp->set_solver(solver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool th_rewriter::reduce_quantifier(quantifier * old_q,
|
||||||
|
expr * new_body,
|
||||||
|
expr * const * new_patterns,
|
||||||
|
expr * const * new_no_patterns,
|
||||||
|
expr_ref & result,
|
||||||
|
proof_ref & result_pr) {
|
||||||
|
return m_imp->cfg().reduce_quantifier(old_q, new_body, new_patterns, new_no_patterns, result, result_pr);
|
||||||
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
static void get_param_descrs(param_descrs & r);
|
static void get_param_descrs(param_descrs & r);
|
||||||
unsigned get_cache_size() const;
|
unsigned get_cache_size() const;
|
||||||
unsigned get_num_steps() const;
|
unsigned get_num_steps() const;
|
||||||
|
|
||||||
void operator()(expr_ref& term);
|
void operator()(expr_ref& term);
|
||||||
void operator()(expr * t, expr_ref & result);
|
void operator()(expr * t, expr_ref & result);
|
||||||
void operator()(expr * t, expr_ref & result, proof_ref & result_pr);
|
void operator()(expr * t, expr_ref & result, proof_ref & result_pr);
|
||||||
|
@ -49,6 +49,13 @@ public:
|
||||||
|
|
||||||
expr_ref mk_app(func_decl* f, unsigned num_args, expr* const* args);
|
expr_ref mk_app(func_decl* f, unsigned num_args, expr* const* args);
|
||||||
|
|
||||||
|
bool reduce_quantifier(quantifier * old_q,
|
||||||
|
expr * new_body,
|
||||||
|
expr * const * new_patterns,
|
||||||
|
expr * const * new_no_patterns,
|
||||||
|
expr_ref & result,
|
||||||
|
proof_ref & result_pr);
|
||||||
|
|
||||||
void cleanup();
|
void cleanup();
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ Revision History:
|
||||||
#include "ast/rewriter/datatype_rewriter.h"
|
#include "ast/rewriter/datatype_rewriter.h"
|
||||||
#include "ast/rewriter/array_rewriter.h"
|
#include "ast/rewriter/array_rewriter.h"
|
||||||
#include "ast/rewriter/fpa_rewriter.h"
|
#include "ast/rewriter/fpa_rewriter.h"
|
||||||
|
#include "ast/rewriter/th_rewriter.h"
|
||||||
#include "ast/rewriter/rewriter_def.h"
|
#include "ast/rewriter/rewriter_def.h"
|
||||||
#include "ast/ast_pp.h"
|
#include "ast/ast_pp.h"
|
||||||
#include "ast/ast_util.h"
|
#include "ast/ast_util.h"
|
||||||
|
@ -124,6 +125,17 @@ struct evaluator_cfg : public default_rewriter_cfg {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool reduce_quantifier(quantifier * old_q,
|
||||||
|
expr * new_body,
|
||||||
|
expr * const * new_patterns,
|
||||||
|
expr * const * new_no_patterns,
|
||||||
|
expr_ref & result,
|
||||||
|
proof_ref & result_pr) {
|
||||||
|
th_rewriter th(m);
|
||||||
|
return th.reduce_quantifier(old_q, new_body, new_patterns, new_no_patterns, result, result_pr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||||
result_pr = nullptr;
|
result_pr = nullptr;
|
||||||
family_id fid = f->get_family_id();
|
family_id fid = f->get_family_id();
|
||||||
|
|
|
@ -1427,7 +1427,7 @@ namespace smt {
|
||||||
// 0 < i < len(H) -->
|
// 0 < i < len(H) -->
|
||||||
// H = hd ++ tl
|
// H = hd ++ tl
|
||||||
// len(hd) = i
|
// len(hd) = i
|
||||||
// str.indexof(tl, N, 0)
|
// i + str.indexof(tl, N, 0)
|
||||||
|
|
||||||
expr * H = nullptr; // "haystack"
|
expr * H = nullptr; // "haystack"
|
||||||
expr * N = nullptr; // "needle"
|
expr * N = nullptr; // "needle"
|
||||||
|
@ -1463,12 +1463,19 @@ namespace smt {
|
||||||
expr_ref conclusion(ctx.mk_eq_atom(e, minus_one), m);
|
expr_ref conclusion(ctx.mk_eq_atom(e, minus_one), m);
|
||||||
assert_implication(premise, conclusion);
|
assert_implication(premise, conclusion);
|
||||||
}
|
}
|
||||||
// case 4: 0 < i < len(H)
|
// case 3.5: H doesn't contain N
|
||||||
|
{
|
||||||
|
expr_ref premise(m.mk_not(u.str.mk_contains(H, N)), m);
|
||||||
|
expr_ref conclusion(ctx.mk_eq_atom(e, minus_one), m);
|
||||||
|
assert_implication(premise, conclusion);
|
||||||
|
}
|
||||||
|
// case 4: 0 < i < len(H) and H contains N
|
||||||
{
|
{
|
||||||
expr_ref premise1(m_autil.mk_gt(i, zero), m);
|
expr_ref premise1(m_autil.mk_gt(i, zero), m);
|
||||||
//expr_ref premise2(m_autil.mk_lt(i, mk_strlen(H)), m);
|
//expr_ref premise2(m_autil.mk_lt(i, mk_strlen(H)), m);
|
||||||
expr_ref premise2(m.mk_not(m_autil.mk_ge(m_autil.mk_add(i, m_autil.mk_mul(minus_one, mk_strlen(H))), zero)), m);
|
expr_ref premise2(m.mk_not(m_autil.mk_ge(m_autil.mk_add(i, m_autil.mk_mul(minus_one, mk_strlen(H))), zero)), m);
|
||||||
expr_ref _premise(m.mk_and(premise1, premise2), m);
|
expr_ref premise3(u.str.mk_contains(H, N), m);
|
||||||
|
expr_ref _premise(m.mk_and(premise1, premise2, premise3), m);
|
||||||
expr_ref premise(_premise);
|
expr_ref premise(_premise);
|
||||||
th_rewriter rw(m);
|
th_rewriter rw(m);
|
||||||
rw(premise);
|
rw(premise);
|
||||||
|
@ -1479,7 +1486,8 @@ namespace smt {
|
||||||
expr_ref_vector conclusion_terms(m);
|
expr_ref_vector conclusion_terms(m);
|
||||||
conclusion_terms.push_back(ctx.mk_eq_atom(H, mk_concat(hd, tl)));
|
conclusion_terms.push_back(ctx.mk_eq_atom(H, mk_concat(hd, tl)));
|
||||||
conclusion_terms.push_back(ctx.mk_eq_atom(mk_strlen(hd), i));
|
conclusion_terms.push_back(ctx.mk_eq_atom(mk_strlen(hd), i));
|
||||||
conclusion_terms.push_back(ctx.mk_eq_atom(e, mk_indexof(tl, N)));
|
conclusion_terms.push_back(u.str.mk_contains(tl, N));
|
||||||
|
conclusion_terms.push_back(ctx.mk_eq_atom(e, m_autil.mk_add(i, mk_indexof(tl, N))));
|
||||||
|
|
||||||
expr_ref conclusion(mk_and(conclusion_terms), m);
|
expr_ref conclusion(mk_and(conclusion_terms), m);
|
||||||
assert_implication(premise, conclusion);
|
assert_implication(premise, conclusion);
|
||||||
|
|
Loading…
Reference in a new issue