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

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