Skip to content

Commit

Permalink
add hook for induction
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Apr 29, 2020
1 parent fd911a5 commit 9f6a733
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
24 changes: 15 additions & 9 deletions src/smt/smt_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,14 @@ namespace smt {
}
d.m_phase_available = true;
d.m_phase = !l.sign();
CTRACE("assign_core", l.var() == 13, tout << (decision?"decision: ":"propagating: ") << l << " ";
/*display_literal(tout, l);*/
tout << "relevant: " << is_relevant_core(l) << " level: " << m_scope_lvl << " is atom " << d.is_atom() << "\n";
/*display(tout, j);*/
);
TRACE("assign_core", tout << (decision?"decision: ":"propagating: ") << l << " ";
display_literal_smt2(tout, l) << "\n";
tout << "relevant: " << is_relevant_core(l) << " level: " << m_scope_lvl << " is atom " << d.is_atom() << "\n";
/*display(tout, j);*/
);
TRACE("phase_selection", tout << "saving phase, is_pos: " << d.m_phase << " l: " << l << "\n";);

CTRACE("relevancy", l.var() == 13,
tout << "is_atom: " << d.is_atom() << " is relevant: "
<< is_relevant_core(l) << " relevancy-lvl: " << relevancy_lvl() << "\n";);
if (d.is_atom() && (relevancy_lvl() == 0 || (relevancy_lvl() == 1 && !d.is_quantifier()) || is_relevant_core(l))) {
CTRACE("assign_core", l.var() == 13, tout << "propagation queue\n";);
m_atom_propagation_queue.push_back(l);
}

Expand Down Expand Up @@ -1655,6 +1651,16 @@ namespace smt {
!m_th_diseq_propagation_queue.empty();
}

/**
\brief retrieve facilities for creating induction lemmas.
*/
induction& context::get_induction() {
if (!m_induction) {
m_induction = alloc(induction, *this, get_manager());
}
return *m_induction;
}

/**
\brief unit propagation.
Cancelation is not safe during propagation at base level because
Expand Down
6 changes: 5 additions & 1 deletion src/smt/smt_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Revision History:
#include "smt/smt_statistics.h"
#include "smt/smt_conflict_resolution.h"
#include "smt/smt_relevancy.h"
#include "smt/smt_induction.h"
#include "smt/smt_case_split_queue.h"
#include "smt/smt_almost_cg_table.h"
#include "smt/smt_failure.h"
Expand Down Expand Up @@ -185,6 +186,7 @@ namespace smt {
unsigned m_simp_qhead;
int m_simp_counter; //!< can become negative
scoped_ptr<case_split_queue> m_case_split_queue;
scoped_ptr<induction> m_induction;
double m_bvar_inc;
bool m_phase_cache_on;
unsigned m_phase_counter; //!< auxiliary variable used to decide when to turn on/off phase caching
Expand Down Expand Up @@ -848,7 +850,7 @@ namespace smt {
void remove_lit_occs(clause const& cls, unsigned num_bool_vars);

void add_lit_occs(clause const& cls);
public:
public:

void ensure_internalized(expr* e);

Expand Down Expand Up @@ -1267,6 +1269,8 @@ namespace smt {
public:
bool can_propagate() const;

induction& get_induction();

// Retrieve arithmetic values.
bool get_arith_lo(expr* e, rational& lo, bool& strict);
bool get_arith_up(expr* e, rational& up, bool& strict);
Expand Down
1 change: 0 additions & 1 deletion src/smt/smt_induction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ void create_induction_lemmas::create_lemmas(expr* t, expr* sk, abstraction& a, l
sort* s = m.get_sort(sk);
if (!m_dt.is_datatype(s))
return;
family_id fid = s->get_family_id();
expr_ref alpha = a.m_term;
auto const& eqs = a.m_eqs;
literal_vector common_literals;
Expand Down

0 comments on commit 9f6a733

Please sign in to comment.