mirror of
https://github.com/Z3Prover/z3
synced 2025-04-22 16:45:31 +00:00
Bugfix and new examples for implicit assumptions in Z3_solver_assert_and_track. Thanks to Amir Ebrahimi for reporting this issue!
(See http://stackoverflow.com/questions/28558683/modeling-constraints-in-z3-and-unsat-core-cases) Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
parent
d3fb5f2a4c
commit
9b137d54d3
5 changed files with 111 additions and 3 deletions
|
@ -178,8 +178,9 @@ public:
|
|||
|
||||
virtual lbool check_sat(unsigned num_assumptions, expr * const * assumptions) {
|
||||
m_check_sat_executed = true;
|
||||
|
||||
if (num_assumptions > 0 || // assumptions were provided
|
||||
|
||||
if (get_num_assumptions() != 0 ||
|
||||
num_assumptions > 0 || // assumptions were provided
|
||||
m_ignore_solver1) {
|
||||
// must use incremental solver
|
||||
switch_inc_mode();
|
||||
|
@ -241,6 +242,16 @@ public:
|
|||
return m_solver1->get_assertion(idx);
|
||||
}
|
||||
|
||||
virtual unsigned get_num_assumptions() const {
|
||||
return m_solver1->get_num_assumptions() + m_solver2->get_num_assumptions();
|
||||
}
|
||||
|
||||
virtual expr * get_assumption(unsigned idx) const {
|
||||
unsigned c1 = m_solver1->get_num_assumptions();
|
||||
if (idx < c1) return m_solver1->get_assumption(idx);
|
||||
return m_solver2->get_assumption(idx - c1);
|
||||
}
|
||||
|
||||
virtual void display(std::ostream & out) const {
|
||||
m_solver1->display(out);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
/**
|
||||
\brief Add a new formula \c t to the assertion stack, and "tag" it with \c a.
|
||||
The propositional varialbe \c a is used to track the use of \c t in a proof
|
||||
The propositional variable \c a is used to track the use of \c t in a proof
|
||||
of unsatisfiability.
|
||||
*/
|
||||
virtual void assert_expr(expr * t, expr * a) = 0;
|
||||
|
@ -125,6 +125,16 @@ public:
|
|||
*/
|
||||
virtual expr * get_assertion(unsigned idx) const;
|
||||
|
||||
/**
|
||||
\brief The number of tracked assumptions (see assert_expr(t, a)).
|
||||
*/
|
||||
virtual unsigned get_num_assumptions() const = 0;
|
||||
|
||||
/**
|
||||
\brief Retrieves the idx'th tracked assumption (see assert_expr(t, a)).
|
||||
*/
|
||||
virtual expr * get_assumption(unsigned idx) const = 0;
|
||||
|
||||
/**
|
||||
\brief Display the content of this solver.
|
||||
*/
|
||||
|
|
|
@ -41,6 +41,9 @@ public:
|
|||
virtual void push();
|
||||
virtual void pop(unsigned n);
|
||||
virtual unsigned get_scope_level() const;
|
||||
|
||||
virtual unsigned get_num_assumptions() const { return m_assumptions.size(); }
|
||||
virtual expr * get_assumption(unsigned idx) const { return m_assumptions[idx]; }
|
||||
protected:
|
||||
virtual lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions) = 0;
|
||||
virtual void push_core() = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue