mirror of
https://github.com/Z3Prover/z3
synced 2025-05-08 00:05:46 +00:00
support for legacy datatype test
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
aac7773a52
commit
06087c17be
12 changed files with 100 additions and 98 deletions
|
@ -15,21 +15,21 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include "cmd_context/cmd_context.h"
|
||||
#include "util/gparams.h"
|
||||
#include "util/env_params.h"
|
||||
#include "util/version.h"
|
||||
#include "ast/ast_smt_pp.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "model/model_smt2_pp.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
#include "ast/pp.h"
|
||||
#include "ast/well_sorted.h"
|
||||
#include "ast/pp_params.hpp"
|
||||
#include "model/model_smt2_pp.h"
|
||||
#include "cmd_context/cmd_context.h"
|
||||
#include "cmd_context/cmd_util.h"
|
||||
#include "cmd_context/simplify_cmd.h"
|
||||
#include "cmd_context/eval_cmd.h"
|
||||
#include "util/gparams.h"
|
||||
#include "util/env_params.h"
|
||||
#include "ast/well_sorted.h"
|
||||
#include "ast/pp_params.hpp"
|
||||
|
||||
class help_cmd : public cmd {
|
||||
svector<symbol> m_cmds;
|
||||
|
@ -79,19 +79,15 @@ public:
|
|||
}
|
||||
// named_cmd_lt is not a total order for commands, but this is irrelevant for Linux x Windows behavior
|
||||
std::sort(cmds.begin(), cmds.end(), named_cmd_lt());
|
||||
vector<named_cmd>::const_iterator it2 = cmds.begin();
|
||||
vector<named_cmd>::const_iterator end2 = cmds.end();
|
||||
for (; it2 != end2; ++it2) {
|
||||
display_cmd(ctx, it2->first, it2->second);
|
||||
for (named_cmd const& nc : cmds) {
|
||||
display_cmd(ctx, nc.first, nc.second);
|
||||
}
|
||||
}
|
||||
else {
|
||||
svector<symbol>::const_iterator it = m_cmds.begin();
|
||||
svector<symbol>::const_iterator end = m_cmds.end();
|
||||
for (; it != end; ++it) {
|
||||
cmd * c = ctx.find_cmd(*it);
|
||||
for (symbol const& s : m_cmds) {
|
||||
cmd * c = ctx.find_cmd(s);
|
||||
SASSERT(c);
|
||||
display_cmd(ctx, *it, c);
|
||||
display_cmd(ctx, s, c);
|
||||
}
|
||||
}
|
||||
ctx.regular_stream() << "\"\n";
|
||||
|
@ -136,11 +132,10 @@ ATOMIC_CMD(get_assignment_cmd, "get-assignment", "retrieve assignment", {
|
|||
ctx.get_check_sat_result()->get_model(m);
|
||||
ctx.regular_stream() << "(";
|
||||
dictionary<macro_decls> const & macros = ctx.get_macros();
|
||||
dictionary<macro_decls>::iterator it = macros.begin();
|
||||
dictionary<macro_decls>::iterator end = macros.end();
|
||||
for (bool first = true; it != end; ++it) {
|
||||
symbol const & name = (*it).m_key;
|
||||
macro_decls const & _m = (*it).m_value;
|
||||
bool first = true;
|
||||
for (auto const& kv : macros) {
|
||||
symbol const & name = kv.m_key;
|
||||
macro_decls const & _m = kv.m_value;
|
||||
for (auto md : _m) {
|
||||
if (md.m_domain.size() == 0 && ctx.m().is_bool(md.m_body)) {
|
||||
expr_ref val(ctx.m());
|
||||
|
@ -211,14 +206,13 @@ static void print_core(cmd_context& ctx) {
|
|||
ptr_vector<expr> core;
|
||||
ctx.get_check_sat_result()->get_unsat_core(core);
|
||||
ctx.regular_stream() << "(";
|
||||
ptr_vector<expr>::const_iterator it = core.begin();
|
||||
ptr_vector<expr>::const_iterator end = core.end();
|
||||
for (bool first = true; it != end; ++it) {
|
||||
bool first = true;
|
||||
for (expr* e : core) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
ctx.regular_stream() << " ";
|
||||
ctx.regular_stream() << mk_ismt2_pp(*it, ctx.m());
|
||||
ctx.regular_stream() << mk_ismt2_pp(e, ctx.m());
|
||||
}
|
||||
ctx.regular_stream() << ")" << std::endl;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,10 @@ Notes:
|
|||
|
||||
#include<signal.h>
|
||||
#include "util/tptr.h"
|
||||
#include "cmd_context/cmd_context.h"
|
||||
#include "util/cancel_eh.h"
|
||||
#include "util/scoped_ctrl_c.h"
|
||||
#include "util/dec_ref_util.h"
|
||||
#include "util/scoped_timer.h"
|
||||
#include "ast/func_decl_dependencies.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
|
@ -31,22 +34,19 @@ Notes:
|
|||
#include "ast/rewriter/var_subst.h"
|
||||
#include "ast/pp.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "cmd_context/basic_cmds.h"
|
||||
#include "util/cancel_eh.h"
|
||||
#include "util/scoped_ctrl_c.h"
|
||||
#include "util/dec_ref_util.h"
|
||||
#include "ast/decl_collector.h"
|
||||
#include "ast/well_sorted.h"
|
||||
#include "model/model_evaluator.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "util/scoped_timer.h"
|
||||
#include "cmd_context/interpolant_cmds.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "model/model_evaluator.h"
|
||||
#include "model/model_smt2_pp.h"
|
||||
#include "model/model_v2_pp.h"
|
||||
#include "model/model_params.hpp"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "tactic/tactic_exception.h"
|
||||
#include "solver/smt_logics.h"
|
||||
#include "cmd_context/basic_cmds.h"
|
||||
#include "cmd_context/interpolant_cmds.h"
|
||||
#include "cmd_context/cmd_context.h"
|
||||
|
||||
func_decls::func_decls(ast_manager & m, func_decl * f):
|
||||
m_decls(TAG(func_decl*, f, 0)) {
|
||||
|
@ -61,11 +61,9 @@ void func_decls::finalize(ast_manager & m) {
|
|||
else {
|
||||
TRACE("func_decls", tout << "finalize...\n";);
|
||||
func_decl_set * fs = UNTAG(func_decl_set *, m_decls);
|
||||
func_decl_set::iterator it = fs->begin();
|
||||
func_decl_set::iterator end = fs->end();
|
||||
for (; it != end; ++it) {
|
||||
TRACE("func_decls", tout << "dec_ref of " << (*it)->get_name() << " ref_count: " << (*it)->get_ref_count() << "\n";);
|
||||
m.dec_ref(*it);
|
||||
for (func_decl * f : *fs) {
|
||||
TRACE("func_decls", tout << "dec_ref of " << f->get_name() << " ref_count: " << f->get_ref_count() << "\n";);
|
||||
m.dec_ref(f);
|
||||
}
|
||||
dealloc(fs);
|
||||
}
|
||||
|
@ -161,10 +159,7 @@ bool func_decls::clash(func_decl * f) const {
|
|||
if (GET_TAG(m_decls) == 0)
|
||||
return false;
|
||||
func_decl_set * fs = UNTAG(func_decl_set *, m_decls);
|
||||
func_decl_set::iterator it = fs->begin();
|
||||
func_decl_set::iterator end = fs->end();
|
||||
for (; it != end; ++it) {
|
||||
func_decl * g = *it;
|
||||
for (func_decl * g : *fs) {
|
||||
if (g == f)
|
||||
continue;
|
||||
if (g->get_arity() != f->get_arity())
|
||||
|
@ -201,10 +196,7 @@ func_decl * func_decls::find(unsigned arity, sort * const * domain, sort * range
|
|||
if (!more_than_one())
|
||||
return first();
|
||||
func_decl_set * fs = UNTAG(func_decl_set *, m_decls);
|
||||
func_decl_set::iterator it = fs->begin();
|
||||
func_decl_set::iterator end = fs->end();
|
||||
for (; it != end; it++) {
|
||||
func_decl * f = *it;
|
||||
for (func_decl * f : *fs) {
|
||||
if (range != 0 && f->get_range() != range)
|
||||
continue;
|
||||
if (f->get_arity() != arity)
|
||||
|
@ -1957,11 +1949,9 @@ void cmd_context::dt_eh::operator()(sort * dt, pdecl* pd) {
|
|||
for (func_decl * c : *m_dt_util.get_datatype_constructors(dt)) {
|
||||
TRACE("new_dt_eh", tout << "new constructor: " << c->get_name() << "\n";);
|
||||
m_owner.insert(c);
|
||||
#ifndef DATATYPE_V2
|
||||
func_decl * r = m_dt_util.get_constructor_recognizer(c);
|
||||
m_owner.insert(r);
|
||||
TRACE("new_dt_eh", tout << "new recognizer: " << r->get_name() << "\n";);
|
||||
#endif
|
||||
for (func_decl * a : *m_dt_util.get_constructor_accessors(c)) {
|
||||
TRACE("new_dt_eh", tout << "new accessor: " << a->get_name() << "\n";);
|
||||
m_owner.insert(a);
|
||||
|
|
|
@ -267,8 +267,8 @@ public:
|
|||
|
||||
psort_decl::psort_decl(unsigned id, unsigned num_params, pdecl_manager & m, symbol const & n):
|
||||
pdecl(id, num_params),
|
||||
m_psort_kind(PSORT_BASE),
|
||||
m_name(n),
|
||||
m_psort_kind(PSORT_BASE),
|
||||
m_inst_cache(0) {
|
||||
}
|
||||
|
||||
|
|
|
@ -255,11 +255,9 @@ public:
|
|||
result->m_core.append(core_elems.size(), core_elems.c_ptr());
|
||||
if (p.get_bool("print_unsat_core", false)) {
|
||||
ctx.regular_stream() << "(unsat-core";
|
||||
ptr_vector<expr>::const_iterator it = core_elems.begin();
|
||||
ptr_vector<expr>::const_iterator end = core_elems.end();
|
||||
for (; it != end; ++it) {
|
||||
for (expr * e : core_elems) {
|
||||
ctx.regular_stream() << " ";
|
||||
ctx.display(ctx.regular_stream(), *it);
|
||||
ctx.display(ctx.regular_stream(), e);
|
||||
}
|
||||
ctx.regular_stream() << ")" << std::endl;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue