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

change lt

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-06-21 09:08:20 +02:00
parent 7c9d2e0d75
commit 5177cc4a9a
2 changed files with 8 additions and 2 deletions

View file

@ -28,6 +28,10 @@ struct ast_to_lt {
bool operator()(ast * n1, ast * n2) const { return lt(n1, n2); } bool operator()(ast * n1, ast * n2) const { return lt(n1, n2); }
}; };
struct ast_lt {
bool operator()(ast * n1, ast * n2) const { return n1->get_id() < n2->get_id(); }
};
bool lex_lt(unsigned num, ast * const * n1, ast * const * n2); bool lex_lt(unsigned num, ast * const * n1, ast * const * n2);
inline bool lex_lt(unsigned num, expr * const * n1, expr * const * n2) { inline bool lex_lt(unsigned num, expr * const * n1, expr * const * n2) {
return lex_lt(num, reinterpret_cast<ast*const*>(n1), reinterpret_cast<ast*const*>(n2)); return lex_lt(num, reinterpret_cast<ast*const*>(n1), reinterpret_cast<ast*const*>(n2));

View file

@ -234,7 +234,8 @@ br_status bool_rewriter::mk_nflat_or_core(unsigned num_args, expr * const * args
return BR_DONE; return BR_DONE;
} }
if (s) { if (s) {
std::sort(buffer.begin(), buffer.end(), ast_to_lt()); ast_lt lt;
std::sort(buffer.begin(), buffer.end(), lt);
result = m().mk_or(sz, buffer.c_ptr()); result = m().mk_or(sz, buffer.c_ptr());
return BR_DONE; return BR_DONE;
} }
@ -272,7 +273,8 @@ br_status bool_rewriter::mk_flat_or_core(unsigned num_args, expr * const * args,
} }
if (mk_nflat_or_core(flat_args.size(), flat_args.c_ptr(), result) == BR_FAILED) { if (mk_nflat_or_core(flat_args.size(), flat_args.c_ptr(), result) == BR_FAILED) {
if (!ordered) { if (!ordered) {
std::sort(flat_args.begin(), flat_args.end(), ast_to_lt()); ast_lt lt;
std::sort(flat_args.begin(), flat_args.end(), lt);
} }
result = m().mk_or(flat_args.size(), flat_args.c_ptr()); result = m().mk_or(flat_args.size(), flat_args.c_ptr());
} }