mirror of
https://github.com/Z3Prover/z3
synced 2025-06-06 22:23:22 +00:00
spacing, unit test
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
fe14a22baa
commit
4cae91b096
5 changed files with 98 additions and 88 deletions
|
@ -799,6 +799,7 @@ namespace smt {
|
||||||
}
|
}
|
||||||
|
|
||||||
void theory_fpa::finalize_model(model_generator & mg) {
|
void theory_fpa::finalize_model(model_generator & mg) {
|
||||||
|
#if 0
|
||||||
ast_manager & m = get_manager();
|
ast_manager & m = get_manager();
|
||||||
proto_model & mdl = mg.get_model();
|
proto_model & mdl = mg.get_model();
|
||||||
proto_model new_model(m);
|
proto_model new_model(m);
|
||||||
|
@ -824,6 +825,7 @@ namespace smt {
|
||||||
func_interp * fi = new_model.get_func_interp(f)->copy();
|
func_interp * fi = new_model.get_func_interp(f)->copy();
|
||||||
mdl.register_decl(f, fi);
|
mdl.register_decl(f, fi);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void theory_fpa::display(std::ostream & out) const
|
void theory_fpa::display(std::ostream & out) const
|
||||||
|
|
|
@ -41,8 +41,7 @@ void fpa2bv_model_converter::convert(model_core * mc, model * float_mdl) {
|
||||||
|
|
||||||
// Keep all the non-float constants.
|
// Keep all the non-float constants.
|
||||||
unsigned sz = mc->get_num_constants();
|
unsigned sz = mc->get_num_constants();
|
||||||
for (unsigned i = 0; i < sz; i++)
|
for (unsigned i = 0; i < sz; i++) {
|
||||||
{
|
|
||||||
func_decl * c = mc->get_constant(i);
|
func_decl * c = mc->get_constant(i);
|
||||||
if (!seen.contains(c))
|
if (!seen.contains(c))
|
||||||
float_mdl->register_decl(c, mc->get_const_interp(c));
|
float_mdl->register_decl(c, mc->get_const_interp(c));
|
||||||
|
@ -50,11 +49,9 @@ void fpa2bv_model_converter::convert(model_core * mc, model * float_mdl) {
|
||||||
|
|
||||||
// And keep everything else
|
// And keep everything else
|
||||||
sz = mc->get_num_functions();
|
sz = mc->get_num_functions();
|
||||||
for (unsigned i = 0; i < sz; i++)
|
for (unsigned i = 0; i < sz; i++) {
|
||||||
{
|
|
||||||
func_decl * f = mc->get_function(i);
|
func_decl * f = mc->get_function(i);
|
||||||
if (!seen.contains(f))
|
if (!seen.contains(f)) {
|
||||||
{
|
|
||||||
TRACE("fpa2bv_mc", tout << "Keeping: " << mk_ismt2_pp(f, m) << std::endl;);
|
TRACE("fpa2bv_mc", tout << "Keeping: " << mk_ismt2_pp(f, m) << std::endl;);
|
||||||
func_interp * val = mc->get_func_interp(f)->copy();
|
func_interp * val = mc->get_func_interp(f)->copy();
|
||||||
float_mdl->register_decl(f, val);
|
float_mdl->register_decl(f, val);
|
||||||
|
@ -62,8 +59,7 @@ void fpa2bv_model_converter::convert(model_core * mc, model * float_mdl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sz = mc->get_num_uninterpreted_sorts();
|
sz = mc->get_num_uninterpreted_sorts();
|
||||||
for (unsigned i = 0; i < sz; i++)
|
for (unsigned i = 0; i < sz; i++) {
|
||||||
{
|
|
||||||
sort * s = mc->get_uninterpreted_sort(i);
|
sort * s = mc->get_uninterpreted_sort(i);
|
||||||
ptr_vector<expr> u = mc->get_universe(s);
|
ptr_vector<expr> u = mc->get_universe(s);
|
||||||
float_mdl->register_usort(s, u.size(), u.c_ptr());
|
float_mdl->register_usort(s, u.size(), u.c_ptr());
|
||||||
|
|
|
@ -29,13 +29,12 @@ class fpa2bv_model_converter : public model_converter {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
fpa2bv_model_converter(ast_manager & m, fpa2bv_converter & conv):
|
fpa2bv_model_converter(ast_manager & m, fpa2bv_converter & conv):
|
||||||
m(m) {
|
m(m),
|
||||||
m_bv2fp = alloc(bv2fpa_converter, m, conv);
|
m_bv2fp(alloc(bv2fpa_converter, m, conv)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~fpa2bv_model_converter() {
|
virtual ~fpa2bv_model_converter() {
|
||||||
if (m_bv2fp) dealloc(m_bv2fp);
|
dealloc(m_bv2fp);
|
||||||
m_bv2fp = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void operator()(model_ref & md, unsigned goal_idx) {
|
virtual void operator()(model_ref & md, unsigned goal_idx) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ Copyright (c) 2016 Microsoft Corporation
|
||||||
#include "datatype_decl_plugin.h"
|
#include "datatype_decl_plugin.h"
|
||||||
#include "reg_decl_plugins.h"
|
#include "reg_decl_plugins.h"
|
||||||
#include "ast_pp.h"
|
#include "ast_pp.h"
|
||||||
|
#include "dt2bv.h"
|
||||||
//include
|
//include
|
||||||
|
|
||||||
static expr_ref mk_const(ast_manager& m, char const* name, sort* s) {
|
static expr_ref mk_const(ast_manager& m, char const* name, sort* s) {
|
||||||
|
@ -72,6 +73,18 @@ static void test2() {
|
||||||
g->assert_expr(m.mk_not(m.mk_eq(x, r)));
|
g->assert_expr(m.mk_not(m.mk_eq(x, r)));
|
||||||
g->assert_expr(m.mk_not(m.mk_eq(x, b)));
|
g->assert_expr(m.mk_not(m.mk_eq(x, b)));
|
||||||
g->display(std::cout);
|
g->display(std::cout);
|
||||||
|
tactic_ref dt2bv = mk_dt2bv_tactic(m);
|
||||||
|
goal_ref_buffer result;
|
||||||
|
model_converter_ref mc;
|
||||||
|
proof_converter_ref pc;
|
||||||
|
expr_dependency_ref core;
|
||||||
|
(*dt2bv)(g, result, mc, pc, core);
|
||||||
|
model_ref mdl1 = alloc(model, m);
|
||||||
|
model_ref mdl2 = (*mc)(*mdl1);
|
||||||
|
expr_ref val(m);
|
||||||
|
mdl2->eval(x, val);
|
||||||
|
std::cout << val << "\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_get_consequences() {
|
void tst_get_consequences() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue