GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/theory_eq_notify.h Lines: 15 19 78.9 %
Date: 2021-05-22 Branches: 14 24 58.3 %

Line Exec Source
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
47295
  TheoryEqNotifyClass(TheoryInferenceManager& im) : d_im(im) {}
37
47295
  ~TheoryEqNotifyClass() {}
38
39
4479281
  bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
40
  {
41
4479281
    if (value)
42
    {
43
1523526
      return d_im.propagateLit(predicate);
44
    }
45
2955755
    return d_im.propagateLit(predicate.notNode());
46
  }
47
1210404
  bool eqNotifyTriggerTermEquality(TheoryId tag,
48
                                   TNode t1,
49
                                   TNode t2,
50
                                   bool value) override
51
  {
52
1210404
    if (value)
53
    {
54
835325
      return d_im.propagateLit(t1.eqNode(t2));
55
    }
56
375079
    return d_im.propagateLit(t1.eqNode(t2).notNode());
57
  }
58
10500
  void eqNotifyConstantTermMerge(TNode t1, TNode t2) override
59
  {
60
10500
    d_im.conflictEqConstantMerge(t1, t2);
61
10500
  }
62
  void eqNotifyNewClass(TNode t) override
63
  {
64
    // do nothing
65
  }
66
  void eqNotifyMerge(TNode t1, TNode t2) override
67
  {
68
    // do nothing
69
  }
70
139736
  void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override
71
  {
72
    // do nothing
73
139736
  }
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