blob: 31a99b0981e08abc58a1e7c812e572fc715514b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/******************************************************************************
* Top contributors (to current version):
* Andrew Reynolds, Mathias Preiner, Tim King
*
* 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.
* ****************************************************************************
*
* The theory equality notify utility.
*/
#include "cvc4_private.h"
#ifndef CVC5__THEORY__THEORY_EQ_NOTIFY_H
#define CVC5__THEORY__THEORY_EQ_NOTIFY_H
#include "expr/node.h"
#include "theory/theory_inference_manager.h"
#include "theory/uf/equality_engine_notify.h"
namespace cvc5 {
namespace theory {
/**
* The default class for equality engine callbacks for a theory. This forwards
* calls for trigger predicates, trigger term equalities and conflicts due to
* constant merges to the provided theory inference manager.
*/
class TheoryEqNotifyClass : public eq::EqualityEngineNotify
{
public:
TheoryEqNotifyClass(TheoryInferenceManager& im) : d_im(im) {}
~TheoryEqNotifyClass() {}
bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
{
if (value)
{
return d_im.propagateLit(predicate);
}
return d_im.propagateLit(predicate.notNode());
}
bool eqNotifyTriggerTermEquality(TheoryId tag,
TNode t1,
TNode t2,
bool value) override
{
if (value)
{
return d_im.propagateLit(t1.eqNode(t2));
}
return d_im.propagateLit(t1.eqNode(t2).notNode());
}
void eqNotifyConstantTermMerge(TNode t1, TNode t2) override
{
d_im.conflictEqConstantMerge(t1, t2);
}
void eqNotifyNewClass(TNode t) override
{
// do nothing
}
void eqNotifyMerge(TNode t1, TNode t2) override
{
// do nothing
}
void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override
{
// do nothing
}
protected:
/** Reference to the theory inference manager */
TheoryInferenceManager& d_im;
};
} // namespace theory
} // namespace cvc5
#endif
|