2015-11-10 19:03:54 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#include "util/sexpr/option_declarations.h"
|
2015-11-13 21:05:20 +00:00
|
|
|
#include "library/blast/options.h"
|
2015-11-10 19:03:54 +00:00
|
|
|
|
|
|
|
#ifndef LEAN_DEFAULT_BLAST_MAX_DEPTH
|
|
|
|
#define LEAN_DEFAULT_BLAST_MAX_DEPTH 128
|
|
|
|
#endif
|
|
|
|
#ifndef LEAN_DEFAULT_BLAST_INIT_DEPTH
|
|
|
|
#define LEAN_DEFAULT_BLAST_INIT_DEPTH 1
|
|
|
|
#endif
|
|
|
|
#ifndef LEAN_DEFAULT_BLAST_INC_DEPTH
|
|
|
|
#define LEAN_DEFAULT_BLAST_INC_DEPTH 5
|
|
|
|
#endif
|
2015-11-13 21:05:20 +00:00
|
|
|
#ifndef LEAN_DEFAULT_BLAST_TRACE
|
|
|
|
#define LEAN_DEFAULT_BLAST_TRACE false
|
|
|
|
#endif
|
2015-11-23 00:32:07 +00:00
|
|
|
#ifndef LEAN_DEFAULT_BLAST_SHOW_FAILURE
|
|
|
|
#define LEAN_DEFAULT_BLAST_SHOW_FAILURE true
|
|
|
|
#endif
|
2015-11-20 18:53:02 +00:00
|
|
|
#ifndef LEAN_DEFAULT_BLAST_SUBST
|
|
|
|
#define LEAN_DEFAULT_BLAST_SUBST true
|
|
|
|
#endif
|
2015-11-21 20:19:55 +00:00
|
|
|
#ifndef LEAN_DEFAULT_BLAST_SIMP
|
|
|
|
#define LEAN_DEFAULT_BLAST_SIMP true
|
|
|
|
#endif
|
2015-11-22 01:45:25 +00:00
|
|
|
#ifndef LEAN_DEFAULT_BLAST_CC
|
|
|
|
#define LEAN_DEFAULT_BLAST_CC true
|
|
|
|
#endif
|
2015-11-10 19:03:54 +00:00
|
|
|
|
|
|
|
namespace lean {
|
|
|
|
namespace blast {
|
|
|
|
/* Options */
|
|
|
|
static name * g_blast_max_depth = nullptr;
|
|
|
|
static name * g_blast_init_depth = nullptr;
|
|
|
|
static name * g_blast_inc_depth = nullptr;
|
2015-11-13 21:05:20 +00:00
|
|
|
static name * g_blast_trace = nullptr;
|
2015-11-20 18:53:02 +00:00
|
|
|
static name * g_blast_subst = nullptr;
|
2015-11-21 20:19:55 +00:00
|
|
|
static name * g_blast_simp = nullptr;
|
2015-11-22 01:45:25 +00:00
|
|
|
static name * g_blast_cc = nullptr;
|
2015-11-23 00:32:07 +00:00
|
|
|
static name * g_blast_show_failure = nullptr;
|
2015-11-10 19:03:54 +00:00
|
|
|
|
|
|
|
unsigned get_blast_max_depth(options const & o) {
|
|
|
|
return o.get_unsigned(*g_blast_max_depth, LEAN_DEFAULT_BLAST_MAX_DEPTH);
|
|
|
|
}
|
|
|
|
unsigned get_blast_init_depth(options const & o) {
|
|
|
|
return o.get_unsigned(*g_blast_init_depth, LEAN_DEFAULT_BLAST_INIT_DEPTH);
|
|
|
|
}
|
|
|
|
unsigned get_blast_inc_depth(options const & o) {
|
|
|
|
return o.get_unsigned(*g_blast_inc_depth, LEAN_DEFAULT_BLAST_INC_DEPTH);
|
|
|
|
}
|
2015-11-13 21:05:20 +00:00
|
|
|
bool get_blast_trace(options const & o) {
|
|
|
|
return o.get_bool(*g_blast_trace, LEAN_DEFAULT_BLAST_TRACE);
|
|
|
|
}
|
2015-11-20 18:53:02 +00:00
|
|
|
bool get_blast_subst(options const & o) {
|
|
|
|
return o.get_bool(*g_blast_subst, LEAN_DEFAULT_BLAST_SUBST);
|
|
|
|
}
|
2015-11-21 20:19:55 +00:00
|
|
|
bool get_blast_simp(options const & o) {
|
|
|
|
return o.get_bool(*g_blast_simp, LEAN_DEFAULT_BLAST_SIMP);
|
|
|
|
}
|
2015-11-22 01:45:25 +00:00
|
|
|
bool get_blast_cc(options const & o) {
|
|
|
|
return o.get_bool(*g_blast_cc, LEAN_DEFAULT_BLAST_CC);
|
|
|
|
}
|
2015-11-23 00:32:07 +00:00
|
|
|
bool get_blast_show_failure(options const & o) {
|
|
|
|
return o.get_bool(*g_blast_show_failure, LEAN_DEFAULT_BLAST_SHOW_FAILURE);
|
|
|
|
}
|
2015-11-13 21:05:20 +00:00
|
|
|
|
|
|
|
config::config(options const & o) {
|
2015-11-23 00:32:07 +00:00
|
|
|
m_max_depth = get_blast_max_depth(o);
|
|
|
|
m_init_depth = get_blast_init_depth(o);
|
|
|
|
m_inc_depth = get_blast_inc_depth(o);
|
|
|
|
m_trace = get_blast_trace(o);
|
|
|
|
m_subst = get_blast_subst(o);
|
|
|
|
m_simp = get_blast_simp(o);
|
|
|
|
m_cc = get_blast_cc(o);
|
|
|
|
m_show_failure = get_blast_show_failure(o);
|
2015-11-13 21:05:20 +00:00
|
|
|
}
|
2015-11-10 19:03:54 +00:00
|
|
|
|
2015-11-20 18:39:26 +00:00
|
|
|
LEAN_THREAD_PTR(config, g_config);
|
|
|
|
|
|
|
|
scope_config::scope_config(options const & o):
|
|
|
|
m_old(g_config),
|
|
|
|
m_config(o) {
|
|
|
|
g_config = &m_config;
|
|
|
|
}
|
|
|
|
|
|
|
|
scope_config::~scope_config() {
|
|
|
|
g_config = m_old;
|
|
|
|
}
|
|
|
|
|
2015-11-23 00:32:07 +00:00
|
|
|
config & get_config() {
|
2015-11-20 18:39:26 +00:00
|
|
|
lean_assert(g_config);
|
|
|
|
return *g_config;
|
|
|
|
}
|
|
|
|
|
2015-11-10 19:03:54 +00:00
|
|
|
void initialize_options() {
|
2015-11-23 00:32:07 +00:00
|
|
|
g_blast_max_depth = new name{"blast", "max_depth"};
|
|
|
|
g_blast_init_depth = new name{"blast", "init_depth"};
|
|
|
|
g_blast_inc_depth = new name{"blast", "inc_depth"};
|
|
|
|
g_blast_trace = new name{"blast", "trace"};
|
|
|
|
g_blast_subst = new name{"blast", "subst"};
|
|
|
|
g_blast_simp = new name{"blast", "simp"};
|
|
|
|
g_blast_cc = new name{"blast", "cc"};
|
|
|
|
g_blast_show_failure = new name{"blast", "show_failure"};
|
2015-11-10 19:03:54 +00:00
|
|
|
|
|
|
|
register_unsigned_option(*blast::g_blast_max_depth, LEAN_DEFAULT_BLAST_MAX_DEPTH,
|
|
|
|
"(blast) max search depth for blast");
|
|
|
|
register_unsigned_option(*blast::g_blast_init_depth, LEAN_DEFAULT_BLAST_INIT_DEPTH,
|
|
|
|
"(blast) initial search depth for blast (remark: blast uses iteration deepening)");
|
|
|
|
register_unsigned_option(*blast::g_blast_inc_depth, LEAN_DEFAULT_BLAST_INC_DEPTH,
|
|
|
|
"(blast) search depth increment for blast (remark: blast uses iteration deepening)");
|
2015-11-13 21:05:20 +00:00
|
|
|
register_bool_option(*blast::g_blast_trace, LEAN_DEFAULT_BLAST_TRACE,
|
|
|
|
"(blast) trace");
|
2015-11-20 18:53:02 +00:00
|
|
|
register_bool_option(*blast::g_blast_subst, LEAN_DEFAULT_BLAST_SUBST,
|
|
|
|
"(blast) enable subst action");
|
2015-11-21 20:19:55 +00:00
|
|
|
register_bool_option(*blast::g_blast_simp, LEAN_DEFAULT_BLAST_SIMP,
|
|
|
|
"(blast) enable simplier actions");
|
2015-11-22 01:45:25 +00:00
|
|
|
register_bool_option(*blast::g_blast_cc, LEAN_DEFAULT_BLAST_CC,
|
|
|
|
"(blast) enable congruence closure");
|
2015-11-23 00:32:07 +00:00
|
|
|
register_bool_option(*blast::g_blast_cc, LEAN_DEFAULT_BLAST_SHOW_FAILURE,
|
|
|
|
"(blast) show failure state");
|
2015-11-10 19:03:54 +00:00
|
|
|
}
|
|
|
|
void finalize_options() {
|
|
|
|
delete g_blast_max_depth;
|
|
|
|
delete g_blast_init_depth;
|
|
|
|
delete g_blast_inc_depth;
|
2015-11-13 21:05:20 +00:00
|
|
|
delete g_blast_trace;
|
2015-11-20 18:53:02 +00:00
|
|
|
delete g_blast_subst;
|
2015-11-21 20:19:55 +00:00
|
|
|
delete g_blast_simp;
|
2015-11-22 01:45:25 +00:00
|
|
|
delete g_blast_cc;
|
2015-11-23 00:32:07 +00:00
|
|
|
delete g_blast_show_failure;
|
2015-11-10 19:03:54 +00:00
|
|
|
}
|
|
|
|
}}
|