3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-14 21:08:46 +00:00
This commit is contained in:
Nikolaj Bjorner 2016-02-09 11:08:52 +00:00
commit 60c0e73b2f
7 changed files with 104 additions and 97 deletions

View file

@ -127,13 +127,13 @@ public class Solver extends Z3Object
* using the Boolean constants in ps. * using the Boolean constants in ps.
* *
* Remarks: * Remarks:
* This API is an alternative to <see cref="Check"/> with assumptions for * This API is an alternative to {@link check} with assumptions for
* extracting unsat cores. * extracting unsat cores.
* Both APIs can be used in the same solver. The unsat core will contain a * Both APIs can be used in the same solver. The unsat core will contain a
* combination * combination
* of the Boolean variables provided using <see cref="AssertAndTrack"/> * of the Boolean variables provided using {@link assertAndTrack}
* and the Boolean literals * and the Boolean literals
* provided using <see cref="Check"/> with assumptions. * provided using {@link check} with assumptions.
**/ **/
public void assertAndTrack(BoolExpr[] constraints, BoolExpr[] ps) public void assertAndTrack(BoolExpr[] constraints, BoolExpr[] ps)
{ {
@ -152,13 +152,13 @@ public class Solver extends Z3Object
* using the Boolean constant p. * using the Boolean constant p.
* *
* Remarks: * Remarks:
* This API is an alternative to <see cref="Check"/> with assumptions for * This API is an alternative to {@link check} with assumptions for
* extracting unsat cores. * extracting unsat cores.
* Both APIs can be used in the same solver. The unsat core will contain a * Both APIs can be used in the same solver. The unsat core will contain a
* combination * combination
* of the Boolean variables provided using <see cref="AssertAndTrack"/> * of the Boolean variables provided using {@link assertAndTrack}
* and the Boolean literals * and the Boolean literals
* provided using <see cref="Check"/> with assumptions. * provided using {@link check} with assumptions.
*/ */
public void assertAndTrack(BoolExpr constraint, BoolExpr p) public void assertAndTrack(BoolExpr constraint, BoolExpr p)
{ {
@ -294,7 +294,7 @@ public class Solver extends Z3Object
} }
/** /**
* Create a clone of the current solver with respect to <c>ctx</c>. * Create a clone of the current solver with respect to{@code ctx}.
*/ */
public Solver translate(Context ctx) public Solver translate(Context ctx)
{ {

View file

@ -419,11 +419,16 @@ void fpa2bv_converter::add_core(unsigned sbits, unsigned ebits,
dbg_decouple("fpa2bv_add_exp_delta", exp_delta); dbg_decouple("fpa2bv_add_exp_delta", exp_delta);
if (log2(sbits + 2) < ebits + 2)
{
// cap the delta // cap the delta
expr_ref cap(m), cap_le_delta(m); expr_ref cap(m), cap_le_delta(m);
cap = m_bv_util.mk_numeral(sbits+2, ebits); cap = m_bv_util.mk_numeral(sbits + 2, ebits + 2);
cap_le_delta = m_bv_util.mk_ule(cap, exp_delta); cap_le_delta = m_bv_util.mk_ule(cap, m_bv_util.mk_zero_extend(2, exp_delta));
m_simp.mk_ite(cap_le_delta, cap, exp_delta, exp_delta); m_simp.mk_ite(cap_le_delta, cap, m_bv_util.mk_zero_extend(2, exp_delta), exp_delta);
exp_delta = m_bv_util.mk_extract(ebits - 1, 0, exp_delta);
dbg_decouple("fpa2bv_add_exp_cap", cap);
}
dbg_decouple("fpa2bv_add_exp_delta_capped", exp_delta); dbg_decouple("fpa2bv_add_exp_delta_capped", exp_delta);

View file

@ -3,11 +3,11 @@ Copyright (c) 2011 Microsoft Corporation
Module Name: Module Name:
dl_decl_plugin.h seq_decl_plugin.h
Abstract: Abstract:
<abstract> decl_plugin for the theory of sequences
Author: Author:

View file

@ -7,7 +7,7 @@ Module Name:
Abstract: Abstract:
<abstract> decl_plugin for the theory of sequences
Author: Author:

View file

@ -28,12 +28,12 @@ bool fpa_simplifier_plugin::reduce(func_decl * f, unsigned num_args, expr * cons
SASSERT(f->get_family_id() == get_family_id()); SASSERT(f->get_family_id() == get_family_id());
return m_rw.mk_app_core(f, num_args, args, result) == BR_DONE; return m_rw.mk_app_core(f, num_args, args, result) != BR_FAILED;
} }
bool fpa_simplifier_plugin::reduce_eq(expr * lhs, expr * rhs, expr_ref & result) { bool fpa_simplifier_plugin::reduce_eq(expr * lhs, expr * rhs, expr_ref & result) {
set_reduce_invoked(); set_reduce_invoked();
return m_rw.mk_eq_core(lhs, rhs, result) == BR_DONE; return m_rw.mk_eq_core(lhs, rhs, result) != BR_FAILED;
} }

View file

@ -7,7 +7,7 @@ Module Name:
Abstract: Abstract:
Simplifier for the floating-point theory Simplifier for the theory of sequences
Author: Author:

View file

@ -26,17 +26,17 @@ namespace smt {
class fpa2bv_conversion_trail_elem : public trail<theory_fpa> { class fpa2bv_conversion_trail_elem : public trail<theory_fpa> {
ast_manager & m; ast_manager & m;
obj_map<expr, expr*> & m_conversions; obj_map<expr, expr*> & m_map;
expr * m_e; expr_ref key;
public: public:
fpa2bv_conversion_trail_elem(ast_manager & m, obj_map<expr, expr*> & c, expr * e) : fpa2bv_conversion_trail_elem(ast_manager & m, obj_map<expr, expr*> & map, expr * e) :
m(m), m_conversions(c), m_e(e) { m.inc_ref(e); } m(m), m_map(map), key(e, m) { }
virtual ~fpa2bv_conversion_trail_elem() { } virtual ~fpa2bv_conversion_trail_elem() { }
virtual void undo(theory_fpa & th) { virtual void undo(theory_fpa & th) {
expr * v = m_conversions.find(m_e); expr * val = m_map.find(key);
m_conversions.remove(m_e); m_map.remove(key);
m.dec_ref(v); m.dec_ref(val);
m.dec_ref(m_e); key = 0;
} }
}; };
@ -153,6 +153,8 @@ namespace smt {
theory_fpa::~theory_fpa() theory_fpa::~theory_fpa()
{ {
m_trail_stack.reset();
if (m_is_initialized) { if (m_is_initialized) {
ast_manager & m = get_manager(); ast_manager & m = get_manager();
dec_ref_map_values(m, m_conversions); dec_ref_map_values(m, m_conversions);