mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
adding euf
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
314bd9277b
commit
4d41db3028
26 changed files with 353 additions and 152 deletions
|
@ -50,6 +50,7 @@ static char const * g_input_file = nullptr;
|
|||
static bool g_standard_input = false;
|
||||
static input_kind g_input_kind = IN_UNSPECIFIED;
|
||||
bool g_display_statistics = false;
|
||||
bool g_display_model = false;
|
||||
static bool g_display_istatistics = false;
|
||||
|
||||
static void error(const char * msg) {
|
||||
|
@ -84,6 +85,7 @@ void display_usage() {
|
|||
std::cout << " -lp use parser for a modest subset of CPLEX LP input format.\n";
|
||||
std::cout << " -log use parser for Z3 log input format.\n";
|
||||
std::cout << " -in read formula from standard input.\n";
|
||||
std::cout << " -model display model for satisfiable SMT.\n";
|
||||
std::cout << "\nMiscellaneous:\n";
|
||||
std::cout << " -h, -? prints this message.\n";
|
||||
std::cout << " -version prints version number of Z3.\n";
|
||||
|
@ -208,6 +210,9 @@ static void parse_cmd_line_args(int argc, char ** argv) {
|
|||
g_display_statistics = true;
|
||||
gparams::set("stats", "true");
|
||||
}
|
||||
else if (strcmp(opt_name, "model") == 0) {
|
||||
g_display_model = true;
|
||||
}
|
||||
else if (strcmp(opt_name, "ist") == 0) {
|
||||
g_display_istatistics = true;
|
||||
}
|
||||
|
|
|
@ -22,32 +22,40 @@ Copyright (c) 2015 Microsoft Corporation
|
|||
#include "opt/opt_parse.h"
|
||||
|
||||
extern bool g_display_statistics;
|
||||
extern bool g_display_model;
|
||||
static bool g_first_interrupt = true;
|
||||
static opt::context* g_opt = nullptr;
|
||||
static double g_start_time = 0;
|
||||
static unsigned_vector g_handles;
|
||||
static mutex *display_stats_mux = new mutex;
|
||||
|
||||
static void display_model(std::ostream& out) {
|
||||
if (!g_opt)
|
||||
return;
|
||||
model_ref mdl;
|
||||
g_opt->get_model(mdl);
|
||||
if (mdl) {
|
||||
model_smt2_pp(out, g_opt->get_manager(), *mdl, 0);
|
||||
}
|
||||
for (unsigned h : g_handles) {
|
||||
expr_ref lo = g_opt->get_lower(h);
|
||||
expr_ref hi = g_opt->get_upper(h);
|
||||
if (lo == hi) {
|
||||
out << " " << lo << "\n";
|
||||
}
|
||||
else {
|
||||
out << " [" << lo << ":" << hi << "]\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void display_model() {
|
||||
if (g_display_model)
|
||||
display_model(std::cout);
|
||||
}
|
||||
|
||||
static void display_results() {
|
||||
IF_VERBOSE(1,
|
||||
if (g_opt) {
|
||||
model_ref mdl;
|
||||
g_opt->get_model(mdl);
|
||||
if (mdl) {
|
||||
model_smt2_pp(verbose_stream(), g_opt->get_manager(), *mdl, 0);
|
||||
}
|
||||
for (unsigned h : g_handles) {
|
||||
expr_ref lo = g_opt->get_lower(h);
|
||||
expr_ref hi = g_opt->get_upper(h);
|
||||
if (lo == hi) {
|
||||
std::cout << " " << lo << "\n";
|
||||
}
|
||||
else {
|
||||
std::cout << " [" << lo << ":" << hi << "]\n";
|
||||
}
|
||||
}
|
||||
});
|
||||
IF_VERBOSE(1, display_model(verbose_stream()));
|
||||
}
|
||||
|
||||
static void display_statistics() {
|
||||
|
@ -128,6 +136,7 @@ static unsigned parse_opt(std::istream& in, opt_format f) {
|
|||
std::cerr << ex.msg() << "\n";
|
||||
}
|
||||
display_statistics();
|
||||
display_model();
|
||||
g_opt = nullptr;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ Revision History:
|
|||
static mutex *display_stats_mux = new mutex;
|
||||
|
||||
extern bool g_display_statistics;
|
||||
extern bool g_display_model;
|
||||
static clock_t g_start_time;
|
||||
static cmd_context * g_cmd_context = nullptr;
|
||||
|
||||
|
@ -51,6 +52,14 @@ static void display_statistics() {
|
|||
}
|
||||
}
|
||||
|
||||
static void display_model() {
|
||||
if (g_display_model && g_cmd_context) {
|
||||
model_ref mdl;
|
||||
if (g_cmd_context->is_model_available(mdl))
|
||||
g_cmd_context->display_model(mdl);
|
||||
}
|
||||
}
|
||||
|
||||
static void on_timeout() {
|
||||
display_statistics();
|
||||
exit(0);
|
||||
|
@ -63,10 +72,19 @@ static void STD_CALL on_ctrl_c(int) {
|
|||
}
|
||||
|
||||
void help_tactics() {
|
||||
struct cmp {
|
||||
bool operator()(tactic_cmd* a, tactic_cmd* b) const {
|
||||
return a->get_name().str() < b->get_name().str();
|
||||
}
|
||||
};
|
||||
cmd_context ctx;
|
||||
for (auto cmd : ctx.tactics()) {
|
||||
ptr_vector<tactic_cmd> cmds;
|
||||
for (auto cmd : ctx.tactics())
|
||||
cmds.push_back(cmd);
|
||||
cmp lt;
|
||||
std::sort(cmds.begin(), cmds.end(), lt);
|
||||
for (auto cmd : cmds)
|
||||
std::cout << "- " << cmd->get_name() << " " << cmd->get_descr() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
void help_tactic(char const* name) {
|
||||
|
@ -82,10 +100,19 @@ void help_tactic(char const* name) {
|
|||
}
|
||||
|
||||
void help_probes() {
|
||||
struct cmp {
|
||||
bool operator()(probe_info* a, probe_info* b) const {
|
||||
return a->get_name().str() < b->get_name().str();
|
||||
}
|
||||
};
|
||||
cmd_context ctx;
|
||||
for (auto cmd : ctx.probes()) {
|
||||
ptr_vector<probe_info> cmds;
|
||||
for (auto cmd : ctx.probes())
|
||||
cmds.push_back(cmd);
|
||||
cmp lt;
|
||||
std::sort(cmds.begin(), cmds.end(), lt);
|
||||
for (auto cmd : cmds)
|
||||
std::cout << "- " << cmd->get_name() << " " << cmd->get_descr() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
unsigned read_smtlib2_commands(char const * file_name) {
|
||||
|
@ -118,8 +145,8 @@ unsigned read_smtlib2_commands(char const * file_name) {
|
|||
result = parse_smt2_commands(ctx, std::cin, true);
|
||||
}
|
||||
|
||||
|
||||
display_statistics();
|
||||
display_model();
|
||||
g_cmd_context = nullptr;
|
||||
return result ? 0 : 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue