3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00

Add accessor for lower/upper bounds of algebraic numerals #3245

The pretty printer for algebraic numerals prints a polynomial root expression, however, polynomial root expressions are not exposed over the API. The C API contains methods for approximating root objects from above and below with arbitrary precision. These functions are now exposed over the C++ API.
Note that algebraic numbers are also disjoint from rcf (real closed field) objects.
Thus, z3 doesn't support adding "pi" as an extension field to algebraic numbers that are used by the nlsat solver. It operats on algebraic numbers formed by roots over polynomial with rational coefficients
This commit is contained in:
Nikolaj Bjorner 2020-03-12 14:23:45 -07:00
parent 356a9bb9ed
commit a6fcdecfd7
3 changed files with 25 additions and 4 deletions

View file

@ -797,6 +797,23 @@ namespace z3 {
assert(is_numeral() || is_algebraic());
return std::string(Z3_get_numeral_decimal_string(ctx(), m_ast, precision));
}
/**
* Retrieve lower and upper bounds for algebraic numerals based on a decimal precision
*/
expr algebraic_lower(unsigned precision) const {
assert(is_algebraic());
Z3_ast r = Z3_get_algebraic_number_lower(ctx(), m_ast, precision);
check_error();
return expr(ctx(), r);
}
expr algebraic_upper(unsigned precision) const {
assert(is_algebraic());
Z3_ast r = Z3_get_algebraic_number_upper(ctx(), m_ast, precision);
check_error();
return expr(ctx(), r);
}
/**