3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-20 21:03:39 +00:00

add hilbert basis utility for extracting auxiliary invariants

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2013-02-12 14:58:04 -08:00
parent 3a15db5244
commit a14f29a4eb
4 changed files with 23 additions and 1 deletions

View file

@ -62,7 +62,7 @@ static void tst1() {
// SASSERT(foo_foo_x2 == foo_foo_x); // SASSERT(foo_foo_x2 == foo_foo_x);
} }
void tst2() { static void tst2() {
// ast_manager m; // ast_manager m;
// ast_vector<ast> m_nodes(m); // ast_vector<ast> m_nodes(m);

View file

@ -207,6 +207,7 @@ int main(int argc, char ** argv) {
TST(horn_subsume_model_converter); TST(horn_subsume_model_converter);
TST(model2expr); TST(model2expr);
TST(rcf); TST(rcf);
TST(hilbert_basis);
} }
void initialize_mam() {} void initialize_mam() {}

View file

@ -239,6 +239,24 @@ public:
m_value2indices.swap(other.m_value2indices); m_value2indices.swap(other.m_value2indices);
} }
/**
\brief return set of values in heap that are less or equal to val.
*/
void find_le(int val, int_vector& result) {
int_vector todo;
todo.push_back(1);
while (!todo.empty()) {
int index = todo.back();
todo.pop_back();
if (index < static_cast<int>(m_values.size()) &&
!less_than(val, m_values[index])) {
result.push_back(m_values[index]);
todo.push_back(left(index));
todo.push_back(right(index));
}
}
}
}; };
#endif /* _HEAP_H_ */ #endif /* _HEAP_H_ */

View file

@ -179,6 +179,9 @@ public:
} }
vector & operator=(vector const & source) { vector & operator=(vector const & source) {
if (this == &source) {
return *this;
}
destroy(); destroy();
if (source.m_data) { if (source.m_data) {
copy_core(source); copy_core(source);