GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/theory_eq_notify.h Lines: 19 19 100.0 %
Date: 2021-09-17 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
49710
  TheoryEqNotifyClass(TheoryInferenceManager& im) : d_im(im) {}
37
49695
  ~TheoryEqNotifyClass() {}
38
39
6386407
  bool eqNotifyTriggerPredicate(TNode predicate, bool value) override
40
  {
41
6386407
    if (value)
42
    {
43
2301260
      return d_im.propagateLit(predicate);
44
    }
45
4085147
    return d_im.propagateLit(predicate.notNode());
46
  }
47
1603368
  bool eqNotifyTriggerTermEquality(TheoryId tag,
48
                                   TNode t1,
49
                                   TNode t2,
50
                                   bool value) override
51
  {
52
1603368
    if (value)
53
    {
54
1009937
      return d_im.propagateLit(t1.eqNode(t2));
55
    }
56
593431
    return d_im.propagateLit(t1.eqNode(t2).notNode());
57
  }
58
12252
  void eqNotifyConstantTermMerge(TNode t1, TNode t2) override
59
  {
60
12252
    d_im.conflictEqConstantMerge(t1, t2);
61
12252
  }
62
301520
  void eqNotifyNewClass(TNode t) override
63
  {
64
    // do nothing
65
301520
  }
66
3580256
  void eqNotifyMerge(TNode t1, TNode t2) override
67
  {
68
    // do nothing
69
3580256
  }
70
427896
  void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override
71
  {
72
    // do nothing
73
427896
  }
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