Skip to content

Commit

Permalink
add options for logging learned lemmas and theory axioms
Browse files Browse the repository at this point in the history
- add solver.axioms2files
  - prints negated theory axioms to files. Each file should be unsat
- add solver.lemmas2console
  - prints lemmas to the console.
- remove option smt.arith.dump_lemmas. It is replaced by solver.axioms2files
  • Loading branch information
NikolajBjorner committed Aug 8, 2022
1 parent 410eed9 commit 63f48f8
Show file tree
Hide file tree
Showing 32 changed files with 260 additions and 319 deletions.
5 changes: 5 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Version 4.11.0
==============
- remove `Z3_bool`, `Z3_TRUE`, `Z3_FALSE` from the API. Use `bool`, `true`, `false` instead.
- z3++.h no longer includes `<sstream>` as it did not use it.
- add solver.axioms2files
- prints negated theory axioms to files. Each file should be unsat
- add solver.lemmas2console
- prints lemmas to the console.
- remove option smt.arith.dump_lemmas. It is replaced by solver.axioms2files

Version 4.10.2
==============
Expand Down
1 change: 1 addition & 0 deletions src/smt/.#smt_justification.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nbjorner@DESKTOP-7DPTQP8.49008:1659539981
7 changes: 6 additions & 1 deletion src/smt/params/smt_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Revision History:
#include "smt/params/smt_params.h"
#include "smt/params/smt_params_helper.hpp"
#include "util/gparams.h"
#include "solver/solver_params.hpp"

void smt_params::updt_local_params(params_ref const & _p) {
smt_params_helper p(_p);
Expand Down Expand Up @@ -59,6 +60,9 @@ void smt_params::updt_local_params(params_ref const & _p) {
m_dump_benchmarks = false;
m_dump_min_time = 0.5;
m_dump_recheck = false;
solver_params sp(_p);
m_axioms2files = sp.axioms2files();
m_lemmas2console = sp.lemmas2console();
}

void smt_params::updt_params(params_ref const & p) {
Expand Down Expand Up @@ -150,7 +154,8 @@ void smt_params::display(std::ostream & out) const {
DISPLAY_PARAM(m_old_clause_relevancy);
DISPLAY_PARAM(m_inv_clause_decay);

DISPLAY_PARAM(m_smtlib_dump_lemmas);
DISPLAY_PARAM(m_axioms2files);
DISPLAY_PARAM(m_lemmas2console);
DISPLAY_PARAM(m_logic);
DISPLAY_PARAM(m_string_solver);

Expand Down
212 changes: 71 additions & 141 deletions src/smt/params/smt_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,144 +82,145 @@ struct smt_params : public preprocessor_params,
public theory_seq_params,
public theory_pb_params,
public theory_datatype_params {
bool m_display_proof;
bool m_display_dot_proof;
bool m_display_unsat_core;
bool m_check_proof;
bool m_eq_propagation;
bool m_binary_clause_opt;
unsigned m_relevancy_lvl;
bool m_relevancy_lemma;
unsigned m_random_seed;
double m_random_var_freq;
double m_inv_decay;
bool m_display_proof = false;
bool m_display_dot_proof = false;
bool m_display_unsat_core = false;
bool m_check_proof = false;
bool m_eq_propagation = true;
bool m_binary_clause_opt = true;
unsigned m_relevancy_lvl = 2;
bool m_relevancy_lemma = false;
unsigned m_random_seed = 0;
double m_random_var_freq = 1.052;
double m_inv_decay = 1;
unsigned m_clause_decay;
initial_activity m_random_initial_activity;
phase_selection m_phase_selection;
unsigned m_phase_caching_on;
unsigned m_phase_caching_off;
bool m_minimize_lemmas;
unsigned m_max_conflicts;
initial_activity m_random_initial_activity = initial_activity::IA_RANDOM_WHEN_SEARCHING;
phase_selection m_phase_selection = phase_selection::PS_CACHING_CONSERVATIVE;
unsigned m_phase_caching_on = 700;
unsigned m_phase_caching_off = 100;
bool m_minimize_lemmas = true;
unsigned m_max_conflicts = UINT_MAX;
unsigned m_restart_max;
unsigned m_cube_depth;
unsigned m_threads;
unsigned m_threads_max_conflicts;
unsigned m_threads_cube_frequency;
bool m_simplify_clauses;
unsigned m_tick;
bool m_display_features;
bool m_new_core2th_eq;
bool m_ematching;
bool m_induction;
bool m_clause_proof;
unsigned m_cube_depth = 1;
unsigned m_threads = 1;
unsigned m_threads_max_conflicts = UINT_MAX;
unsigned m_threads_cube_frequency = 2;
bool m_simplify_clauses = true;
unsigned m_tick = 1000;
bool m_display_features = false;
bool m_new_core2th_eq = true;
bool m_ematching = true;
bool m_induction = false;
bool m_clause_proof = false;

// -----------------------------------
//
// Case split strategy
//
// -----------------------------------
case_split_strategy m_case_split_strategy;
unsigned m_rel_case_split_order;
bool m_lookahead_diseq;
bool m_theory_case_split;
bool m_theory_aware_branching;
case_split_strategy m_case_split_strategy = case_split_strategy::CS_ACTIVITY_DELAY_NEW;
unsigned m_rel_case_split_order = 0;
bool m_lookahead_diseq = false;
bool m_theory_case_split = false;
bool m_theory_aware_branching = false;

// -----------------------------------
//
// Delay units...
//
// -----------------------------------
bool m_delay_units;
unsigned m_delay_units_threshold;
bool m_delay_units = false;
unsigned m_delay_units_threshold = 32;

// -----------------------------------
//
// Conflict resolution
//
// -----------------------------------
bool m_theory_resolve;
bool m_theory_resolve = false;

// -----------------------------------
//
// Restart
//
// -----------------------------------
restart_strategy m_restart_strategy;
unsigned m_restart_initial;
double m_restart_factor;
bool m_restart_adaptive;
double m_agility_factor;
double m_restart_agility_threshold;
restart_strategy m_restart_strategy = restart_strategy::RS_IN_OUT_GEOMETRIC;
unsigned m_restart_initial = 100;
double m_restart_factor = 1.1;
bool m_restart_adaptive = true;
double m_agility_factor = 0.9999;
double m_restart_agility_threshold = 0.18;

// -----------------------------------
//
// Lemma garbage collection
//
// -----------------------------------
lemma_gc_strategy m_lemma_gc_strategy;
bool m_lemma_gc_half;
unsigned m_recent_lemmas_size;
unsigned m_lemma_gc_initial;
double m_lemma_gc_factor;
unsigned m_new_old_ratio; //!< the ratio of new and old clauses.
unsigned m_new_clause_activity;
unsigned m_old_clause_activity;
unsigned m_new_clause_relevancy; //!< Max. number of unassigned literals to be considered relevant.
unsigned m_old_clause_relevancy; //!< Max. number of unassigned literals to be considered relevant.
double m_inv_clause_decay; //!< clause activity decay
lemma_gc_strategy m_lemma_gc_strategy = lemma_gc_strategy::LGC_FIXED;
bool m_lemma_gc_half = false;
unsigned m_recent_lemmas_size = 100;
unsigned m_lemma_gc_initial = 5000;
double m_lemma_gc_factor = 1.1;
unsigned m_new_old_ratio = 16; //!< the ratio of new and old clauses.
unsigned m_new_clause_activity = 10;
unsigned m_old_clause_activity = 500;
unsigned m_new_clause_relevancy = 45; //!< Max. number of unassigned literals to be considered relevant.
unsigned m_old_clause_relevancy = 6; //!< Max. number of unassigned literals to be considered relevant.
double m_inv_clause_decay = 1; //!< clause activity decay

// -----------------------------------
//
// SMT-LIB (debug) pretty printer
//
// -----------------------------------
bool m_smtlib_dump_lemmas;
symbol m_logic;
bool m_axioms2files = false;
bool m_lemmas2console = false;
symbol m_logic = symbol::null;

// -----------------------------------
//
// Statistics for Profiling
//
// -----------------------------------
bool m_profile_res_sub;
bool m_display_bool_var2expr;
bool m_display_ll_bool_var2expr;
bool m_profile_res_sub = false;
bool m_display_bool_var2expr = false;
bool m_display_ll_bool_var2expr = false;

// -----------------------------------
//
// Model generation
//
// -----------------------------------
bool m_model;
bool m_model_on_timeout;
bool m_model_on_final_check;
bool m_model = true;
bool m_model_on_timeout = false;
bool m_model_on_final_check = false;

// -----------------------------------
//
// Progress sampling
//
// -----------------------------------
unsigned m_progress_sampling_freq;
unsigned m_progress_sampling_freq = 0;

// -----------------------------------
//
// Debugging goodies
//
// -----------------------------------
bool m_core_validate;
bool m_core_validate = false;

// -----------------------------------
//
// From front_end_params
//
// -----------------------------------
bool m_preprocess; // temporary hack for disabling all preprocessing..
bool m_user_theory_preprocess_axioms;
bool m_user_theory_persist_axioms;
bool m_at_labels_cex; // only use labels which contains the @ symbol when building multiple counterexamples.
bool m_check_at_labels; // check that @ labels are inserted to generate unique counter-examples.
bool m_dump_goal_as_smt;
bool m_auto_config;
bool m_preprocess = true; // temporary hack for disabling all preprocessing..
bool m_user_theory_preprocess_axioms = false;
bool m_user_theory_persist_axioms = false;
bool m_at_labels_cex = false; // only use labels which contains the @ symbol when building multiple counterexamples.
bool m_check_at_labels = false; // check that @ labels are inserted to generate unique counter-examples.
bool m_dump_goal_as_smt = false;
bool m_auto_config = true;

// -----------------------------------
//
Expand All @@ -238,77 +239,6 @@ struct smt_params : public preprocessor_params,
symbol m_string_solver;

smt_params(params_ref const & p = params_ref()):
m_display_proof(false),
m_display_dot_proof(false),
m_display_unsat_core(false),
m_check_proof(false),
m_eq_propagation(true),
m_binary_clause_opt(true),
m_relevancy_lvl(2),
m_relevancy_lemma(false),
m_random_seed(0),
m_random_var_freq(0.01),
m_inv_decay(1.052),
m_clause_decay(1),
m_random_initial_activity(initial_activity::IA_RANDOM_WHEN_SEARCHING),
m_phase_selection(phase_selection::PS_CACHING_CONSERVATIVE),
m_phase_caching_on(700),
m_phase_caching_off(100),
m_minimize_lemmas(true),
m_max_conflicts(UINT_MAX),
m_cube_depth(1),
m_threads(1),
m_threads_max_conflicts(UINT_MAX),
m_threads_cube_frequency(2),
m_simplify_clauses(true),
m_tick(1000),
m_display_features(false),
m_new_core2th_eq(true),
m_ematching(true),
m_induction(false),
m_clause_proof(false),
m_case_split_strategy(case_split_strategy::CS_ACTIVITY_DELAY_NEW),
m_rel_case_split_order(0),
m_lookahead_diseq(false),
m_theory_case_split(false),
m_theory_aware_branching(false),
m_delay_units(false),
m_delay_units_threshold(32),
m_theory_resolve(false),
m_restart_strategy(restart_strategy::RS_IN_OUT_GEOMETRIC),
m_restart_initial(100),
m_restart_factor(1.1),
m_restart_adaptive(true),
m_agility_factor(0.9999),
m_restart_agility_threshold(0.18),
m_lemma_gc_strategy(lemma_gc_strategy::LGC_FIXED),
m_lemma_gc_half(false),
m_recent_lemmas_size(100),
m_lemma_gc_initial(5000),
m_lemma_gc_factor(1.1),
m_new_old_ratio(16),
m_new_clause_activity(10),
m_old_clause_activity(500),
m_new_clause_relevancy(45),
m_old_clause_relevancy(6),
m_inv_clause_decay(1),
m_smtlib_dump_lemmas(false),
m_logic(symbol::null),
m_profile_res_sub(false),
m_display_bool_var2expr(false),
m_display_ll_bool_var2expr(false),
m_model(true),
m_model_on_timeout(false),
m_model_on_final_check(false),
m_progress_sampling_freq(0),
m_core_validate(false),
m_preprocess(true), // temporary hack for disabling all preprocessing..
m_user_theory_preprocess_axioms(false),
m_user_theory_persist_axioms(false),
m_at_labels_cex(false),
m_check_at_labels(false),
m_dump_goal_as_smt(false),
m_auto_config(true),
m_string_solver(symbol("auto")){
updt_local_params(p);
}
Expand Down
2 changes: 0 additions & 2 deletions src/smt/params/theory_arith_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ void theory_arith_params::updt_params(params_ref const & _p) {
m_arith_int_eq_branching = p.arith_int_eq_branch();
m_arith_ignore_int = p.arith_ignore_int();
m_arith_bound_prop = static_cast<bound_prop_mode>(p.arith_propagation_mode());
m_arith_dump_lemmas = p.arith_dump_lemmas();
m_arith_eager_eq_axioms = p.arith_eager_eq_axioms();
m_arith_auto_config_simplex = p.arith_auto_config_simplex();

Expand Down Expand Up @@ -67,7 +66,6 @@ void theory_arith_params::display(std::ostream & out) const {
DISPLAY_PARAM(m_arith_adaptive);
DISPLAY_PARAM(m_arith_adaptive_assertion_threshold);
DISPLAY_PARAM(m_arith_adaptive_propagation_threshold);
DISPLAY_PARAM(m_arith_dump_lemmas);
DISPLAY_PARAM(m_arith_eager_eq_axioms);
DISPLAY_PARAM(m_arith_branch_cut_ratio);
DISPLAY_PARAM(m_arith_int_eq_branching);
Expand Down
1 change: 0 additions & 1 deletion src/smt/params/theory_arith_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ struct theory_arith_params {
bool m_arith_adaptive = false;
double m_arith_adaptive_assertion_threshold = 0.2;
double m_arith_adaptive_propagation_threshold = 0.4;
bool m_arith_dump_lemmas = false;
bool m_arith_eager_eq_axioms = true;
unsigned m_arith_branch_cut_ratio = 2;
bool m_arith_int_eq_branching = false;
Expand Down
2 changes: 1 addition & 1 deletion src/smt/seq_axioms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void seq_axioms::add_clause(expr_ref_vector const& clause) {
justification* js =
ctx().mk_justification(
ext_theory_eq_propagation_justification(
th.get_id(), ctx().get_region(), 0, nullptr, 0, nullptr, n1, n2));
th.get_id(), ctx(), 0, nullptr, 0, nullptr, n1, n2));
ctx().assign_eq(n1, n2, eq_justification(js));
return;
}
Expand Down
7 changes: 4 additions & 3 deletions src/smt/smt_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ namespace smt {
m_unsat_core(m),
m_mk_bool_var_trail(*this),
m_mk_enode_trail(*this),
m_mk_lambda_trail(*this) {
m_mk_lambda_trail(*this),
m_lemma_visitor(m) {

SASSERT(m_scope_lvl == 0);
SASSERT(m_base_lvl == 0);
Expand Down Expand Up @@ -2560,7 +2561,7 @@ namespace smt {
justification * js = cls.get_justification();
justification * new_js = nullptr;
if (js->in_region())
new_js = mk_justification(unit_resolution_justification(m_region,
new_js = mk_justification(unit_resolution_justification(*this,
js,
simp_lits.size(),
simp_lits.data()));
Expand Down Expand Up @@ -2618,7 +2619,7 @@ namespace smt {
if (!cls_js || cls_js->in_region()) {
// If cls_js is 0 or is allocated in a region, then
// we can allocate the new justification in a region too.
js = mk_justification(unit_resolution_justification(m_region,
js = mk_justification(unit_resolution_justification(*this,
cls_js,
simp_lits.size(),
simp_lits.data()));
Expand Down
Loading

0 comments on commit 63f48f8

Please sign in to comment.