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

support recursive terms (#5246)

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2021-05-05 12:53:20 -07:00 committed by GitHub
parent 466269ee13
commit 179988e161
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 3 deletions

View file

@ -53,10 +53,20 @@ public:
unsigned size() const { return static_cast<unsigned>(m_coeffs.size()); }
template <typename T>
const T & coeffs() const {
const T & coeffs() const {
return m_coeffs;
}
void subst_by_term(const lar_term& t, unsigned term_column) {
auto it = this->m_coeffs.find_core(term_column);
if (it == nullptr) return;
mpq a = it->get_data().m_value;
this->m_coeffs.erase(term_column);
for (const auto & p : t) {
this->add_monomial(a * p.coeff(), p.column());
}
}
lar_term(const vector<std::pair<mpq, unsigned>>& coeffs) {
for (const auto & p : coeffs) {
add_monomial(p.first, p.second);
@ -94,7 +104,7 @@ public:
}
// j is the basic variable to substitute
void subst(unsigned j, indexed_vector<mpq> & li) {
void subst_in_row(unsigned j, indexed_vector<mpq> & li) {
auto* it = m_coeffs.find_core(j);
if (it == nullptr) return;
const mpq & b = it->get_data().m_value;