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

working on new parameter framework

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-12-01 15:54:34 -08:00
parent be5f933201
commit 589f096e6e
36 changed files with 436 additions and 377 deletions

View file

@ -29,6 +29,7 @@ Notes:
#include"eval_cmd.h"
#include"front_end_params.h"
#include"gparams.h"
#include"model_params.hpp"
class help_cmd : public cmd {
svector<symbol> m_cmds;
@ -104,9 +105,10 @@ ATOMIC_CMD(get_model_cmd, "get-model", "retrieve model for the last check-sat co
throw cmd_exception("model is not available");
model_ref m;
ctx.get_check_sat_result()->get_model(m);
if (ctx.params().m_model_v1_pp || ctx.params().m_model_v2_pp) {
model_params p;
if (p.v1() || p.v2()) {
std::ostringstream buffer;
model_v2_pp(buffer, *m, ctx.params().m_model_partial);
model_v2_pp(buffer, *m, p.partial());
ctx.regular_stream() << "\"" << escaped(buffer.str().c_str(), true) << "\"" << std::endl;
} else {
ctx.regular_stream() << "(model " << std::endl;

View file

@ -316,10 +316,9 @@ public:
}
};
cmd_context::cmd_context(front_end_params * params, bool main_ctx, ast_manager * m, symbol const & l):
cmd_context::cmd_context(bool main_ctx, ast_manager * m, symbol const & l):
m_main_ctx(main_ctx),
m_params(params == 0 ? alloc(front_end_params) : params),
m_params_owner(params == 0),
m_fparams(alloc(front_end_params)),
m_logic(l),
m_interactive_mode(false),
m_global_decls(false), // :global-decls is false by default.
@ -359,9 +358,7 @@ cmd_context::~cmd_context() {
finalize_probes();
m_solver = 0;
m_check_sat_result = 0;
if (m_params_owner) {
dealloc(m_params);
}
dealloc(m_fparams);
}
void cmd_context::set_produce_models(bool f) {
@ -382,10 +379,6 @@ void cmd_context::set_produce_proofs(bool f) {
params().m_proof_mode = f ? PGM_FINE : PGM_DISABLED;
}
bool cmd_context::is_smtlib2_compliant() const {
return params().m_smtlib2_compliant;
}
bool cmd_context::produce_models() const {
return params().m_model;
}
@ -599,8 +592,9 @@ void cmd_context::init_manager() {
m_manager = alloc(ast_manager, params().m_proof_mode, params().m_trace_stream);
m_pmanager = alloc(pdecl_manager, *m_manager);
init_manager_core(true);
if (params().m_smtlib2_compliant)
m_manager->enable_int_real_coercions(false);
// PARAM-TODO
// if (params().m_smtlib2_compliant)
// m_manager->enable_int_real_coercions(false);
}
void cmd_context::init_external_manager() {

View file

@ -138,8 +138,7 @@ public:
protected:
bool m_main_ctx;
front_end_params * m_params;
bool m_params_owner;
front_end_params * m_fparams;
symbol m_logic;
bool m_interactive_mode;
bool m_global_decls;
@ -251,9 +250,8 @@ protected:
void print_unsupported_info(symbol const& s) { if (s != symbol::null) diagnostic_stream() << "; " << s << std::endl;}
public:
cmd_context(front_end_params * params = 0, bool main_ctx = true, ast_manager * m = 0, symbol const & l = symbol::null);
cmd_context(bool main_ctx = true, ast_manager * m = 0, symbol const & l = symbol::null);
~cmd_context();
bool is_smtlib2_compliant() const;
void set_logic(symbol const & s);
bool has_logic() const { return m_logic != symbol::null; }
symbol const & get_logic() const { return m_logic; }
@ -290,7 +288,7 @@ public:
virtual ast_manager & get_ast_manager() { return m(); }
pdecl_manager & pm() const { if (!m_pmanager) const_cast<cmd_context*>(this)->init_manager(); return *m_pmanager; }
sexpr_manager & sm() const { if (!m_sexpr_manager) const_cast<cmd_context*>(this)->m_sexpr_manager = alloc(sexpr_manager); return *m_sexpr_manager; }
front_end_params & params() const { return *m_params; }
front_end_params & params() const { return *m_fparams; }
void set_solver(solver * s);
solver * get_solver() const { return m_solver.get(); }