mirror of
https://github.com/Z3Prover/z3
synced 2025-05-02 13:27:01 +00:00
Add get_sort(expr * n) function that does not depend on ast_manager. Move power_of_two to rational class. Add arith_recognizers and bv_recognizers classes. The two new classes contain the 'read-only' methods from arith_util and bv_util.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
4f0d5a5756
commit
cec328cfdc
17 changed files with 314 additions and 282 deletions
|
@ -544,7 +544,7 @@ bool bv2int_rewriter::is_sbv2int(expr* n, expr_ref& s) {
|
|||
m_bv.is_extract(e2, lo1, hi1, e3) &&
|
||||
lo1 == 0 && hi1 == hi-1 &&
|
||||
m_arith.is_numeral(t2, k, is_int) && is_int &&
|
||||
k == m_bv.power_of_two(hi)
|
||||
k == rational::power_of_two(hi)
|
||||
) {
|
||||
s = e3;
|
||||
return true;
|
||||
|
|
|
@ -253,7 +253,7 @@ class nla2bv_tactic : public tactic {
|
|||
s_bv = m_arith.mk_sub(m_arith.mk_numeral(*up, true), s_bv);
|
||||
}
|
||||
else {
|
||||
s_bv = m_arith.mk_sub(s_bv, m_arith.mk_numeral(m_bv.power_of_two(num_bits-1), true));
|
||||
s_bv = m_arith.mk_sub(s_bv, m_arith.mk_numeral(rational::power_of_two(num_bits-1), true));
|
||||
}
|
||||
|
||||
m_trail.push_back(s_bv);
|
||||
|
|
|
@ -583,7 +583,7 @@ private:
|
|||
return false; // size must be even
|
||||
// I implemented only the easy (and very common) case, where a_i = 2^{n-i-1} and c = 2^n - 1
|
||||
unsigned n = sz/2;
|
||||
if (c != m_bv_util.power_of_two(n) - numeral(1))
|
||||
if (c != rational::power_of_two(n) - numeral(1))
|
||||
return false;
|
||||
for (unsigned i = 0; i < n; i++) {
|
||||
monomial const & m1 = p[i*2];
|
||||
|
@ -592,7 +592,7 @@ private:
|
|||
return false;
|
||||
if (m1.m_a != m2.m_a)
|
||||
return false;
|
||||
if (m1.m_a != m_bv_util.power_of_two(n - i - 1))
|
||||
if (m1.m_a != rational::power_of_two(n - i - 1))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue