mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
more fpa
This commit is contained in:
parent
6708a764f5
commit
4cb07a539b
6 changed files with 91 additions and 68 deletions
|
@ -23,64 +23,11 @@ Revision History:
|
|||
#include "ast/fpa/fpa2bv_converter.h"
|
||||
#include "ast/fpa/fpa2bv_rewriter.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "model/value_factory.h"
|
||||
#include "model/fpa_factory.h"
|
||||
#include "smt/smt_model_generator.h"
|
||||
|
||||
namespace smt {
|
||||
|
||||
class fpa_value_factory : public value_factory {
|
||||
fpa_util m_util;
|
||||
|
||||
virtual app * mk_value_core(mpf const & val, sort * s) {
|
||||
SASSERT(m_util.get_ebits(s) == val.get_ebits());
|
||||
SASSERT(m_util.get_sbits(s) == val.get_sbits());
|
||||
return m_util.mk_value(val);
|
||||
}
|
||||
|
||||
public:
|
||||
fpa_value_factory(ast_manager & m, family_id fid) :
|
||||
value_factory(m, fid),
|
||||
m_util(m) {}
|
||||
|
||||
~fpa_value_factory() override {}
|
||||
|
||||
expr * get_some_value(sort * s) override {
|
||||
mpf_manager & mpfm = m_util.fm();
|
||||
|
||||
if (m_util.is_rm(s))
|
||||
return m_util.mk_round_toward_zero();
|
||||
else
|
||||
{
|
||||
scoped_mpf q(mpfm);
|
||||
mpfm.set(q, m_util.get_ebits(s), m_util.get_sbits(s), 0);
|
||||
return m_util.mk_value(q);
|
||||
}
|
||||
}
|
||||
|
||||
bool get_some_values(sort * s, expr_ref & v1, expr_ref & v2) override {
|
||||
mpf_manager & mpfm = m_util.fm();
|
||||
|
||||
if (m_util.is_rm(s))
|
||||
v1 = v2 = m_util.mk_round_toward_zero();
|
||||
else
|
||||
{
|
||||
scoped_mpf q(mpfm);
|
||||
mpfm.set(q, m_util.get_ebits(s), m_util.get_sbits(s), 0);
|
||||
v1 = m_util.mk_value(q);
|
||||
mpfm.set(q, m_util.get_ebits(s), m_util.get_sbits(s), 1);
|
||||
v2 = m_util.mk_value(q);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
expr * get_fresh_value(sort * s) override { return get_some_value(s); }
|
||||
void register_value(expr * n) override { /* Ignore */ }
|
||||
|
||||
app * mk_value(mpf const & x) {
|
||||
return m_util.mk_value(x);
|
||||
}
|
||||
};
|
||||
|
||||
class theory_fpa : public theory {
|
||||
protected:
|
||||
typedef trail_stack<theory_fpa> th_trail_stack;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue