mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
fix sorting network bug, add network compilation,...
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
72f09e4729
commit
019ff77613
15 changed files with 350 additions and 100 deletions
|
@ -2058,6 +2058,22 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar
|
|||
return r;
|
||||
}
|
||||
|
||||
expr* ast_manager::mk_or_reduced(unsigned n, expr* const* args) {
|
||||
switch (n) {
|
||||
case 0: return mk_false();
|
||||
case 1: return args[0];
|
||||
default: return mk_or(n, args);
|
||||
}
|
||||
}
|
||||
|
||||
expr* ast_manager::mk_and_reduced(unsigned n, expr* const* args) {
|
||||
switch (n) {
|
||||
case 0: return mk_true();
|
||||
case 1: return args[0];
|
||||
default: return mk_and(n, args);
|
||||
}
|
||||
}
|
||||
|
||||
func_decl * ast_manager::mk_fresh_func_decl(symbol const & prefix, symbol const & suffix, unsigned arity,
|
||||
sort * const * domain, sort * range) {
|
||||
func_decl_info info(null_family_id, null_decl_kind);
|
||||
|
|
|
@ -2004,6 +2004,9 @@ public:
|
|||
app * mk_true() { return m_true; }
|
||||
app * mk_false() { return m_false; }
|
||||
app * mk_interp(expr * arg) { return mk_app(m_basic_family_id, OP_INTERP, arg); }
|
||||
expr * mk_or_reduced(unsigned num_args, expr * const * args);
|
||||
expr * mk_and_reduced(unsigned num_args, expr * const * args);
|
||||
|
||||
|
||||
func_decl* mk_and_decl() {
|
||||
sort* domain[2] = { m_bool_sort, m_bool_sort };
|
||||
|
|
|
@ -271,3 +271,12 @@ rational pb_util::to_rational(parameter const& p) const {
|
|||
SASSERT(p.is_rational());
|
||||
return p.get_rational();
|
||||
}
|
||||
|
||||
bool pb_util::has_unit_coefficients(func_decl* f) const {
|
||||
if (is_at_most_k(f) || is_at_least_k(f)) return true;
|
||||
unsigned sz = f->get_arity();
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
if (!get_coeff(f, i).is_one()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -103,6 +103,9 @@ public:
|
|||
bool is_ge(expr* a, rational& k) const;
|
||||
rational get_coeff(expr* a, unsigned index) const { return get_coeff(to_app(a)->get_decl(), index); }
|
||||
rational get_coeff(func_decl* a, unsigned index) const;
|
||||
bool has_unit_coefficients(func_decl* f) const;
|
||||
bool has_unit_coefficients(expr* f) const { return is_app(f) && has_unit_coefficients(to_app(f)->get_decl()); }
|
||||
|
||||
|
||||
bool is_eq(func_decl* f) const;
|
||||
bool is_eq(expr* e) const { return is_app(e) && is_eq(to_app(e)->get_decl()); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue