3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 20:05:51 +00:00

adding ack/model

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-08-28 12:55:31 -07:00
parent 7f0b5bc129
commit 4244ce4aad
31 changed files with 831 additions and 914 deletions

View file

@ -0,0 +1,89 @@
/*++
Copyright (c) 2020 Microsoft Corporation
Module Name:
euf_ackerman.h
Abstract:
Ackerman reduction plugin for EUF
Author:
Nikolaj Bjorner (nbjorner) 2020-08-25
--*/
#pragma once
#include "ast/euf/euf_egraph.h"
#include "sat/smt/atom2bool_var.h"
#include "sat/smt/sat_th.h"
namespace euf {
class solver;
class ackerman {
struct inference {
bool is_cc;
expr* a, *b, *c;
inference* m_next{ nullptr };
inference* m_prev{ nullptr };
unsigned m_count{ 0 };
inference():is_cc(false), a(nullptr), b(nullptr), c(nullptr) {}
inference(app* a, app* b):is_cc(true), a(a), b(b), c(nullptr) {}
inference(expr* a, expr* b, expr* c):is_cc(false), a(a), b(b), c(c) {}
};
struct inference_eq {
bool operator()(inference const* a, inference const* b) const {
return a->is_cc == b->is_cc && a->a == b->a && a->b == b->b && a->c == b->c;
}
};
struct inference_hash {
unsigned operator()(inference const* a) const {
SASSERT(a->a && a->b);
return mk_mix(a->a->get_id(), a->b->get_id(), a->c ? a->c->get_id() : 0);
}
};
typedef hashtable<inference*, inference_hash, inference_eq> table_t;
solver& s;
ast_manager& m;
table_t m_table;
inference* m_queue { nullptr };
inference* m_tmp_inference { nullptr };
unsigned m_gc_threshold { 1 };
unsigned m_propagate_threshold { 0 };
unsigned m_num_propagations_since_last_gc { 0 };
void reset();
void new_tmp();
void insert(expr* a, expr* b, expr* lca);
void insert(app* a, app* b);
void insert();
void remove(inference* inf);
void add_cc(expr* a, expr* b);
void add_eq(expr* a, expr* b, expr* c);
void gc();
void push_to_front(inference* inf);
void remove_from_queue(inference* inf);
public:
ackerman(solver& s, ast_manager& m);
~ackerman();
void cg_conflict_eh(expr * n1, expr * n2);
void used_eq_eh(expr* a, expr* b, expr* lca);
void used_cc_eh(app* a, app* b);
void propagate();
};
};