1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds, Mathias Preiner, Tim King |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
8 |
|
* in the top-level source directory and their institutional affiliations. |
9 |
|
* All rights reserved. See the file COPYING in the top-level source |
10 |
|
* directory for licensing information. |
11 |
|
* **************************************************************************** |
12 |
|
* |
13 |
|
* The theory equality notify utility. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#ifndef CVC5__THEORY__THEORY_EQ_NOTIFY_H |
19 |
|
#define CVC5__THEORY__THEORY_EQ_NOTIFY_H |
20 |
|
|
21 |
|
#include "expr/node.h" |
22 |
|
#include "theory/theory_inference_manager.h" |
23 |
|
#include "theory/uf/equality_engine_notify.h" |
24 |
|
|
25 |
|
namespace cvc5 { |
26 |
|
namespace theory { |
27 |
|
|
28 |
|
/** |
29 |
|
* The default class for equality engine callbacks for a theory. This forwards |
30 |
|
* calls for trigger predicates, trigger term equalities and conflicts due to |
31 |
|
* constant merges to the provided theory inference manager. |
32 |
|
*/ |
33 |
|
class TheoryEqNotifyClass : public eq::EqualityEngineNotify |
34 |
|
{ |
35 |
|
public: |
36 |
49265 |
TheoryEqNotifyClass(TheoryInferenceManager& im) : d_im(im) {} |
37 |
49265 |
~TheoryEqNotifyClass() {} |
38 |
|
|
39 |
5735212 |
bool eqNotifyTriggerPredicate(TNode predicate, bool value) override |
40 |
|
{ |
41 |
5735212 |
if (value) |
42 |
|
{ |
43 |
2070831 |
return d_im.propagateLit(predicate); |
44 |
|
} |
45 |
3664381 |
return d_im.propagateLit(predicate.notNode()); |
46 |
|
} |
47 |
1429531 |
bool eqNotifyTriggerTermEquality(TheoryId tag, |
48 |
|
TNode t1, |
49 |
|
TNode t2, |
50 |
|
bool value) override |
51 |
|
{ |
52 |
1429531 |
if (value) |
53 |
|
{ |
54 |
936610 |
return d_im.propagateLit(t1.eqNode(t2)); |
55 |
|
} |
56 |
492921 |
return d_im.propagateLit(t1.eqNode(t2).notNode()); |
57 |
|
} |
58 |
11821 |
void eqNotifyConstantTermMerge(TNode t1, TNode t2) override |
59 |
|
{ |
60 |
11821 |
d_im.conflictEqConstantMerge(t1, t2); |
61 |
11821 |
} |
62 |
301909 |
void eqNotifyNewClass(TNode t) override |
63 |
|
{ |
64 |
|
// do nothing |
65 |
301909 |
} |
66 |
3484348 |
void eqNotifyMerge(TNode t1, TNode t2) override |
67 |
|
{ |
68 |
|
// do nothing |
69 |
3484348 |
} |
70 |
389803 |
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override |
71 |
|
{ |
72 |
|
// do nothing |
73 |
389803 |
} |
74 |
|
|
75 |
|
protected: |
76 |
|
/** Reference to the theory inference manager */ |
77 |
|
TheoryInferenceManager& d_im; |
78 |
|
}; |
79 |
|
|
80 |
|
} // namespace theory |
81 |
|
} // namespace cvc5 |
82 |
|
|
83 |
|
#endif |