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

Line Exec Source
1
/*********************                                                        */
2
/*! \file theory_sets.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Andrew Reynolds, Tim King, Kshitij Bansal
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 Sets theory.
13
 **
14
 ** Sets theory.
15
 **/
16
17
#include "cvc4_private.h"
18
19
#ifndef CVC4__THEORY__SETS__THEORY_SETS_H
20
#define CVC4__THEORY__SETS__THEORY_SETS_H
21
22
#include <memory>
23
24
#include "smt/logic_exception.h"
25
#include "theory/sets/inference_manager.h"
26
#include "theory/sets/skolem_cache.h"
27
#include "theory/sets/solver_state.h"
28
#include "theory/theory.h"
29
#include "theory/theory_eq_notify.h"
30
#include "theory/uf/equality_engine.h"
31
32
namespace CVC4 {
33
namespace theory {
34
namespace sets {
35
36
class TheorySetsPrivate;
37
class TheorySetsScrutinize;
38
39
class TheorySets : public Theory
40
{
41
  friend class TheorySetsPrivate;
42
  friend class TheorySetsRels;
43
 public:
44
  /** Constructs a new instance of TheorySets w.r.t. the provided contexts. */
45
  TheorySets(context::Context* c,
46
             context::UserContext* u,
47
             OutputChannel& out,
48
             Valuation valuation,
49
             const LogicInfo& logicInfo,
50
             ProofNodeManager* pnm);
51
  ~TheorySets() override;
52
53
  //--------------------------------- initialization
54
  /** get the official theory rewriter of this theory */
55
  TheoryRewriter* getTheoryRewriter() override;
56
  /**
57
   * Returns true if we need an equality engine. If so, we initialize the
58
   * information regarding how it should be setup. For details, see the
59
   * documentation in Theory::needsEqualityEngine.
60
   */
61
  bool needsEqualityEngine(EeSetupInfo& esi) override;
62
  /** finish initialization */
63
  void finishInit() override;
64
  //--------------------------------- end initialization
65
66
  //--------------------------------- standard check
67
  /** Post-check, called after the fact queue of the theory is processed. */
68
  void postCheck(Effort level) override;
69
  /** Notify fact */
70
  void notifyFact(TNode atom, bool pol, TNode fact, bool isInternal) override;
71
  //--------------------------------- end standard check
72
  /** Collect model values in m based on the relevant terms given by termSet */
73
  bool collectModelValues(TheoryModel* m,
74
                          const std::set<Node>& termSet) override;
75
  void computeCareGraph() override;
76
  TrustNode explain(TNode) override;
77
  Node getModelValue(TNode) override;
78
  std::string identify() const override { return "THEORY_SETS"; }
79
  void preRegisterTerm(TNode node) override;
80
  /**  Expand partial operators (choose) from n. */
81
  TrustNode expandDefinition(Node n) override;
82
  /**
83
   * If the sets-ext option is not set and we have an extended operator,
84
   * we throw an exception. Additionally, we expand operators like choose
85
   * and is_singleton.
86
   */
87
  TrustNode ppRewrite(TNode n, std::vector<SkolemLemma>& lems) override;
88
  PPAssertStatus ppAssert(TrustNode tin,
89
                          TrustSubstitutionMap& outSubstitutions) override;
90
  void presolve() override;
91
  bool isEntailed(Node n, bool pol);
92
93
 private:
94
  /** Functions to handle callbacks from equality engine */
95
8994
  class NotifyClass : public TheoryEqNotifyClass
96
  {
97
   public:
98
8997
    NotifyClass(TheorySetsPrivate& theory, TheoryInferenceManager& im)
99
8997
        : TheoryEqNotifyClass(im), d_theory(theory)
100
    {
101
8997
    }
102
    void eqNotifyNewClass(TNode t) override;
103
    void eqNotifyMerge(TNode t1, TNode t2) override;
104
    void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override;
105
106
   private:
107
    TheorySetsPrivate& d_theory;
108
  };
109
  /** The skolem cache */
110
  SkolemCache d_skCache;
111
  /** The state of the sets solver at full effort */
112
  SolverState d_state;
113
  /** The inference manager */
114
  InferenceManager d_im;
115
  /** The internal theory */
116
  std::unique_ptr<TheorySetsPrivate> d_internal;
117
  /** Instance of the above class */
118
  NotifyClass d_notify;
119
}; /* class TheorySets */
120
121
}/* CVC4::theory::sets namespace */
122
}/* CVC4::theory namespace */
123
}/* CVC4 namespace */
124
125
#endif /* CVC4__THEORY__SETS__THEORY_SETS_H */