3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-06 06:03:23 +00:00

spacing, unit test

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-10-17 08:07:23 -04:00
parent fe14a22baa
commit 4cae91b096
5 changed files with 98 additions and 88 deletions

View file

@ -799,6 +799,7 @@ namespace smt {
}
void theory_fpa::finalize_model(model_generator & mg) {
#if 0
ast_manager & m = get_manager();
proto_model & mdl = mg.get_model();
proto_model new_model(m);
@ -824,6 +825,7 @@ namespace smt {
func_interp * fi = new_model.get_func_interp(f)->copy();
mdl.register_decl(f, fi);
}
#endif
}
void theory_fpa::display(std::ostream & out) const

View file

@ -41,8 +41,7 @@ void fpa2bv_model_converter::convert(model_core * mc, model * float_mdl) {
// Keep all the non-float 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);
if (!seen.contains(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
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);
if (!seen.contains(f))
{
if (!seen.contains(f)) {
TRACE("fpa2bv_mc", tout << "Keeping: " << mk_ismt2_pp(f, m) << std::endl;);
func_interp * val = mc->get_func_interp(f)->copy();
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();
for (unsigned i = 0; i < sz; i++)
{
for (unsigned i = 0; i < sz; i++) {
sort * s = mc->get_uninterpreted_sort(i);
ptr_vector<expr> u = mc->get_universe(s);
float_mdl->register_usort(s, u.size(), u.c_ptr());

View file

@ -29,13 +29,12 @@ class fpa2bv_model_converter : public model_converter {
public:
fpa2bv_model_converter(ast_manager & m, fpa2bv_converter & conv):
m(m) {
m_bv2fp = alloc(bv2fpa_converter, m, conv);
m(m),
m_bv2fp(alloc(bv2fpa_converter, m, conv)) {
}
virtual ~fpa2bv_model_converter() {
if (m_bv2fp) dealloc(m_bv2fp);
m_bv2fp = 0;
dealloc(m_bv2fp);
}
virtual void operator()(model_ref & md, unsigned goal_idx) {

View file

@ -8,6 +8,7 @@ Copyright (c) 2016 Microsoft Corporation
#include "datatype_decl_plugin.h"
#include "reg_decl_plugins.h"
#include "ast_pp.h"
#include "dt2bv.h"
//include
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, b)));
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() {