GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/bags/theory_bags.h Lines: 4 5 80.0 %
Date: 2021-03-22 Branches: 0 2 0.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file theory_bags.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Mudathir Mohamed
6
 ** This file is part of the CVC4 project.
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.\endverbatim
11
 **
12
 ** \brief Bags theory.
13
 **/
14
15
#include "cvc4_private.h"
16
17
#ifndef CVC4__THEORY__BAGS__THEORY_BAGS_H
18
#define CVC4__THEORY__BAGS__THEORY_BAGS_H
19
20
#include "theory/bags/bag_solver.h"
21
#include "theory/bags/bags_rewriter.h"
22
#include "theory/bags/bags_statistics.h"
23
#include "theory/bags/inference_generator.h"
24
#include "theory/bags/inference_manager.h"
25
#include "theory/bags/solver_state.h"
26
#include "theory/bags/term_registry.h"
27
#include "theory/theory.h"
28
#include "theory/theory_eq_notify.h"
29
30
namespace CVC4 {
31
namespace theory {
32
namespace bags {
33
34
class TheoryBags : public Theory
35
{
36
 public:
37
  /** Constructs a new instance of TheoryBags w.r.t. the provided contexts. */
38
  TheoryBags(context::Context* c,
39
             context::UserContext* u,
40
             OutputChannel& out,
41
             Valuation valuation,
42
             const LogicInfo& logicInfo,
43
             ProofNodeManager* pnm);
44
  ~TheoryBags() override;
45
46
  //--------------------------------- initialization
47
  /** get the official theory rewriter of this theory */
48
  TheoryRewriter* getTheoryRewriter() override;
49
  /**
50
   * Returns true if we need an equality engine. If so, we initialize the
51
   * information regarding how it should be setup. For details, see the
52
   * documentation in Theory::needsEqualityEngine.
53
   */
54
  bool needsEqualityEngine(EeSetupInfo& esi) override;
55
  /** finish initialization */
56
  void finishInit() override;
57
  //--------------------------------- end initialization
58
59
  //--------------------------------- standard check
60
  /** Post-check, called after the fact queue of the theory is processed. */
61
  void postCheck(Effort effort) override;
62
  /** Notify fact */
63
  void notifyFact(TNode atom, bool pol, TNode fact, bool isInternal) override;
64
  //--------------------------------- end standard check
65
  /** Collect model values in m based on the relevant terms given by termSet */
66
  bool collectModelValues(TheoryModel* m,
67
                          const std::set<Node>& termSet) override;
68
  TrustNode explain(TNode) override;
69
  Node getModelValue(TNode) override;
70
  std::string identify() const override { return "THEORY_BAGS"; }
71
  void preRegisterTerm(TNode n) override;
72
  TrustNode expandDefinition(Node n) override;
73
  void presolve() override;
74
75
 private:
76
  /** Functions to handle callbacks from equality engine */
77
8992
  class NotifyClass : public TheoryEqNotifyClass
78
  {
79
   public:
80
8995
    NotifyClass(TheoryBags& theory, TheoryInferenceManager& inferenceManager)
81
82
8995
        : TheoryEqNotifyClass(inferenceManager), d_theory(theory)
83
    {
84
8995
    }
85
    void eqNotifyNewClass(TNode n) override;
86
    void eqNotifyMerge(TNode n1, TNode n2) override;
87
    void eqNotifyDisequal(TNode n1, TNode n2, TNode reason) override;
88
89
   private:
90
    TheoryBags& d_theory;
91
  };
92
93
  /** The state of the bags solver at full effort */
94
  SolverState d_state;
95
  /** The inference manager */
96
  InferenceManager d_im;
97
  /** The inference generator */
98
  InferenceGenerator d_ig;
99
  /** Instance of the above class */
100
  NotifyClass d_notify;
101
  /** Statistics for the theory of bags. */
102
  BagsStatistics d_statistics;
103
  /** The theory rewriter for this theory. */
104
  BagsRewriter d_rewriter;
105
  /** The term registry for this theory */
106
  TermRegistry d_termReg;
107
  /** the main solver for bags */
108
  BagSolver d_solver;
109
110
  void eqNotifyNewClass(TNode n);
111
  void eqNotifyMerge(TNode n1, TNode n2);
112
  void eqNotifyDisequal(TNode t1, TNode t2, TNode reason);
113
}; /* class TheoryBags */
114
115
}  // namespace bags
116
}  // namespace theory
117
}  // namespace CVC4
118
119
#endif /* CVC4__THEORY__BAGS__THEORY_BAGS_H */