From: Andrew Reynolds Date: Thu, 15 Jul 2021 05:20:11 +0000 (-0500) Subject: Move master equality engine notification to own file (#6877) X-Git-Tag: cvc5-1.0.0~1480 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=17eb04b4e06a8b6d6ac18098d9efa961c49f6863;p=cvc5.git Move master equality engine notification to own file (#6877) Preparation for central equality engine. --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 95b6f401e..8053ba25e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -797,6 +797,8 @@ libcvc5_add_sources( theory/quantifiers/instantiation_list.h theory/quantifiers/lazy_trie.cpp theory/quantifiers/lazy_trie.h + theory/quantifiers/master_eq_notify.cpp + theory/quantifiers/master_eq_notify.h theory/quantifiers/proof_checker.cpp theory/quantifiers/proof_checker.h theory/quantifiers/quant_bound_inference.cpp diff --git a/src/theory/ee_manager_distributed.cpp b/src/theory/ee_manager_distributed.cpp index 384bace15..7e4932767 100644 --- a/src/theory/ee_manager_distributed.cpp +++ b/src/theory/ee_manager_distributed.cpp @@ -56,7 +56,7 @@ void EqEngineManagerDistributed::initializeTheories() Assert(d_masterEqualityEngine == nullptr); QuantifiersEngine* qe = d_te.getQuantifiersEngine(); Assert(qe != nullptr); - d_masterEENotify.reset(new MasterNotifyClass(qe)); + d_masterEENotify.reset(new quantifiers::MasterNotifyClass(qe)); d_masterEqualityEngine.reset(new eq::EqualityEngine(*d_masterEENotify.get(), d_te.getSatContext(), "theory::master", @@ -109,11 +109,5 @@ void EqEngineManagerDistributed::notifyModel(bool incomplete) } } -void EqEngineManagerDistributed::MasterNotifyClass::eqNotifyNewClass(TNode t) -{ - // adds t to the quantifiers term database - d_quantEngine->eqNotifyNewClass(t); -} - } // namespace theory } // namespace cvc5 diff --git a/src/theory/ee_manager_distributed.h b/src/theory/ee_manager_distributed.h index 0bf184a57..8c7bb2618 100644 --- a/src/theory/ee_manager_distributed.h +++ b/src/theory/ee_manager_distributed.h @@ -22,6 +22,7 @@ #include #include "theory/ee_manager.h" +#include "theory/quantifiers/master_eq_notify.h" namespace cvc5 { namespace theory { @@ -59,38 +60,8 @@ class EqEngineManagerDistributed : public EqEngineManager void notifyModel(bool incomplete) override; private: - /** notify class for master equality engine */ - class MasterNotifyClass : public theory::eq::EqualityEngineNotify - { - public: - MasterNotifyClass(QuantifiersEngine* qe) : d_quantEngine(qe) {} - /** - * Called when a new equivalence class is created in the master equality - * engine. - */ - void eqNotifyNewClass(TNode t) override; - - bool eqNotifyTriggerPredicate(TNode predicate, bool value) override - { - return true; - } - bool eqNotifyTriggerTermEquality(TheoryId tag, - TNode t1, - TNode t2, - bool value) override - { - return true; - } - void eqNotifyConstantTermMerge(TNode t1, TNode t2) override {} - void eqNotifyMerge(TNode t1, TNode t2) override {} - void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override {} - - private: - /** Pointer to quantifiers engine */ - QuantifiersEngine* d_quantEngine; - }; /** The master equality engine notify class */ - std::unique_ptr d_masterEENotify; + std::unique_ptr d_masterEENotify; /** The master equality engine. */ std::unique_ptr d_masterEqualityEngine; /** The equality engine of the shared solver / shared terms database. */ diff --git a/src/theory/quantifiers/master_eq_notify.cpp b/src/theory/quantifiers/master_eq_notify.cpp new file mode 100644 index 000000000..7aaec56c3 --- /dev/null +++ b/src/theory/quantifiers/master_eq_notify.cpp @@ -0,0 +1,34 @@ +/****************************************************************************** + * Top contributors (to current version): + * Andrew Reynolds + * + * This file is part of the cvc5 project. + * + * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS + * in the top-level source directory and their institutional affiliations. + * All rights reserved. See the file COPYING in the top-level source + * directory for licensing information. + * **************************************************************************** + * + * Notification class for the master equality engine + */ + +#include "theory/quantifiers/master_eq_notify.h" + +#include "theory/quantifiers_engine.h" + +namespace cvc5 { +namespace theory { +namespace quantifiers { + +MasterNotifyClass::MasterNotifyClass(QuantifiersEngine* qe) : d_quantEngine(qe) {} + +void MasterNotifyClass::eqNotifyNewClass(TNode t) +{ + d_quantEngine->eqNotifyNewClass(t); +} + + +} // namespace quantifiers +} // namespace theory +} // namespace cvc5 diff --git a/src/theory/quantifiers/master_eq_notify.h b/src/theory/quantifiers/master_eq_notify.h new file mode 100644 index 000000000..262ec483b --- /dev/null +++ b/src/theory/quantifiers/master_eq_notify.h @@ -0,0 +1,68 @@ +/****************************************************************************** + * Top contributors (to current version): + * Andrew Reynolds + * + * This file is part of the cvc5 project. + * + * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS + * in the top-level source directory and their institutional affiliations. + * All rights reserved. See the file COPYING in the top-level source + * directory for licensing information. + * **************************************************************************** + * + * Notification class for the master equality engine + */ + +#include "cvc5_private.h" + +#ifndef CVC5__THEORY__QUANTIFIERS__MASTER_EQ_NOTIFY__H +#define CVC5__THEORY__QUANTIFIERS__MASTER_EQ_NOTIFY__H + +#include + +#include "theory/uf/equality_engine_notify.h" + +namespace cvc5 { +namespace theory { + +class QuantifiersEngine; + +namespace quantifiers { + +/** notify class for master equality engine */ +class MasterNotifyClass : public theory::eq::EqualityEngineNotify +{ + public: + MasterNotifyClass(QuantifiersEngine* qe); + /** + * Called when a new equivalence class is created in the master equality + * engine. + */ + void eqNotifyNewClass(TNode t) override; + + bool eqNotifyTriggerPredicate(TNode predicate, bool value) override + { + return true; + } + bool eqNotifyTriggerTermEquality(TheoryId tag, + TNode t1, + TNode t2, + bool value) override + { + return true; + } + void eqNotifyConstantTermMerge(TNode t1, TNode t2) override {} + void eqNotifyMerge(TNode t1, TNode t2) override {} + void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override {} + + private: + /** Pointer to quantifiers engine */ + QuantifiersEngine* d_quantEngine; +}; + + +} // namespace quantifiers +} // namespace theory +} // namespace cvc5 + +#endif /* CVC5__THEORY__QUANTIFIERS__MASTER_EQ_NOTIFY__H */