3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-08 00:05:46 +00:00

integrate lambda expressions

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-06-26 07:23:04 -07:00
parent bf4edef761
commit 520ce9a5ee
139 changed files with 2243 additions and 1506 deletions

View file

@ -1070,7 +1070,7 @@ void cmd_context::mk_app(symbol const & s, unsigned num_args, expr * const * arg
tout << "body:\n" << mk_ismt2_pp(_t, m()) << "\n";
tout << "args:\n"; for (unsigned i = 0; i < num_args; i++) tout << mk_ismt2_pp(args[i], m()) << "\n" << mk_pp(m().get_sort(args[i]), m()) << "\n";);
var_subst subst(m());
subst(_t, num_args, args, result);
result = subst(_t, num_args, args);
if (well_sorted_check_enabled() && !is_well_sorted(m(), result))
throw cmd_exception("invalid macro application, sort mismatch ", s);
return;
@ -1625,6 +1625,7 @@ void cmd_context::display_dimacs() {
void cmd_context::display_model(model_ref& mdl) {
if (mdl) {
if (m_mc0) (*m_mc0)(mdl);
if (m_params.m_model_compress) mdl->compress();
model_params p;
if (p.v1() || p.v2()) {
std::ostringstream buffer;

View file

@ -34,6 +34,7 @@ context_params::context_params() {
m_debug_ref_count = false;
m_smtlib2_compliant = false;
m_well_sorted_check = false;
m_model_compress = true;
m_timeout = UINT_MAX;
m_rlimit = 0;
updt_params();
@ -102,6 +103,9 @@ void context_params::set(char const * param, char const * value) {
else if (p == "model_validate") {
set_bool(m_model_validate, param, value);
}
else if (p == "model_compress") {
set_bool(m_model_compress, param, value);
}
else if (p == "dump_models") {
set_bool(m_dump_models, param, value);
}
@ -146,6 +150,7 @@ void context_params::updt_params(params_ref const & p) {
m_proof = p.get_bool("proof", m_proof);
m_model = p.get_bool("model", m_model);
m_model_validate = p.get_bool("model_validate", m_model_validate);
m_model_compress = p.get_bool("model_compress", m_model_compress);
m_dump_models = p.get_bool("dump_models", m_dump_models);
m_trace = p.get_bool("trace", m_trace);
m_trace_file_name = p.get_str("trace_file_name", "z3.log");
@ -162,6 +167,7 @@ void context_params::collect_param_descrs(param_descrs & d) {
d.insert("type_check", CPK_BOOL, "type checker (alias for well_sorted_check)", "true");
d.insert("auto_config", CPK_BOOL, "use heuristics to automatically select solver and configure it", "true");
d.insert("model_validate", CPK_BOOL, "validate models produced by solvers", "false");
d.insert("model_compress", CPK_BOOL, "compress models for easier consumption", "true");
d.insert("dump_models", CPK_BOOL, "dump models whenever check-sat returns sat", "false");
d.insert("trace", CPK_BOOL, "trace generation for VCC", "false");
d.insert("trace_file_name", CPK_STRING, "trace out file name (see option 'trace')", "z3.log");

View file

@ -40,6 +40,7 @@ public:
bool m_well_sorted_check;
bool m_model;
bool m_model_validate;
bool m_model_compress;
bool m_dump_models;
bool m_unsat_core;
bool m_smtlib2_compliant; // it must be here because it enable/disable the use of coercions in the ast_manager.

View file

@ -135,9 +135,8 @@ public:
m_idx++;
}
void execute(cmd_context & ctx) override {
expr_ref r(ctx.m());
beta_reducer p(ctx.m());
p(m_source, m_subst.size(), m_subst.c_ptr(), r);
expr_ref r = p(m_source, m_subst.size(), m_subst.c_ptr());
store_expr_ref(ctx, m_target, r.get());
}
};
@ -274,8 +273,7 @@ UNARY_CMD(elim_unused_vars_cmd, "dbg-elim-unused-vars", "<expr>", "eliminate unu
ctx.display(ctx.regular_stream(), arg);
return;
}
expr_ref r(ctx.m());
elim_unused_vars(ctx.m(), to_quantifier(arg), gparams::get_ref(), r);
expr_ref r = elim_unused_vars(ctx.m(), to_quantifier(arg), gparams::get_ref());
SASSERT(!is_quantifier(r) || !to_quantifier(r)->may_have_unused_vars());
ctx.display(ctx.regular_stream(), r);
ctx.regular_stream() << std::endl;
@ -307,8 +305,7 @@ public:
if (num != m_q->get_num_decls())
throw cmd_exception("invalid command, mismatch between the number of quantified variables and the number of arguments.");
unsigned i = num;
while (i > 0) {
--i;
while (i-- > 0) {
sort * s = ctx.m().get_sort(ts[i]);
if (s != m_q->get_decl_sort(i)) {
std::ostringstream buffer;
@ -320,8 +317,7 @@ public:
}
void execute(cmd_context & ctx) override {
expr_ref r(ctx.m());
instantiate(ctx.m(), m_q, m_args.c_ptr(), r);
expr_ref r = instantiate(ctx.m(), m_q, m_args.c_ptr());
ctx.display(ctx.regular_stream(), r);
ctx.regular_stream() << std::endl;
}