Skip to content

Commit

Permalink
fix #6121
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Jul 1, 2022
1 parent c3d2120 commit 959a0ba
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/ackermannization/lackr_model_constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "ast/for_each_expr.h"
#include "ast/rewriter/bv_rewriter.h"
#include "ast/rewriter/bool_rewriter.h"
#include <iostream>

struct lackr_model_constructor::imp {
public:
Expand Down Expand Up @@ -186,7 +187,7 @@ struct lackr_model_constructor::imp {
return m_app2val.find(a, val);
}

bool evaluate(app * const a, expr_ref& result) {
bool evaluate(app * a, expr_ref& result) {
SASSERT(!is_val(a));
const unsigned num = a->get_num_args();
if (num == 0) { // handle constants
Expand Down Expand Up @@ -232,20 +233,20 @@ struct lackr_model_constructor::imp {
// Check and record the value for a given term, given that all arguments are already checked.
//
bool mk_value(app * a) {
if (is_val(a)) return true; // skip numerals
if (is_val(a))
return true; // skip numerals
TRACE("model_constructor", tout << "mk_value(\n" << mk_ismt2_pp(a, m, 2) << ")\n";);
SASSERT(!m_app2val.contains(a));
expr_ref result(m);
if (!evaluate(a, result)) return false;
SASSERT(is_val(result));
if (!evaluate(a, result))
return false;
TRACE("model_constructor",
tout << "map term(\n" << mk_ismt2_pp(a, m, 2) << "\n->"
<< mk_ismt2_pp(result.get(), m, 2)<< ")\n"; );
CTRACE("model_constructor",
!is_val(result.get()),
tout << "eval fail\n" << mk_ismt2_pp(a, m, 2) << mk_ismt2_pp(result, m, 2) << "\n";
tout << "eval didn't create a constant \n" << mk_ismt2_pp(a, m, 2) << " " << mk_ismt2_pp(result, m, 2) << "\n";
);
SASSERT(is_val(result.get()));
m_app2val.insert(a, result.get()); // memoize
m_pinned.push_back(a);
m_pinned.push_back(result);
Expand Down

0 comments on commit 959a0ba

Please sign in to comment.