Debian Codegraph @

src/theory/bags/theory_bags.h

raw symbols SCIP
1 /******************************************************************************
2 * Top contributors (to current version):
3 * Mudathir Mohamed, Andrew Reynolds, Aina Niemetz
4 *
5 * This file is part of the cvc5 project.
6 *
7 * Copyright (c) 2009-2025 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 * Bags theory.
14 */
15
16 #include "cvc5_private.h"cxx . . $ `<file>/src/include/cvc5_private.h`/
17
18 #ifndef CVC5__THEORY__BAGS__THEORY_BAGS_Hcxx . . $ `src/theory/bags/theory_bags.h:19:9`!
19 #define CVC5__THEORY__BAGS__THEORY_BAGS_Hcxx . . $ `src/theory/bags/theory_bags.h:19:9`!
20
21 #include "theory/bags/bag_reduction.h"cxx . . $ `<file>/src/theory/bags/bag_reduction.h`/
22 #include "theory/bags/bag_solver.h"cxx . . $ `<file>/src/theory/bags/bag_solver.h`/
23 #include "theory/bags/bags_rewriter.h"cxx . . $ `<file>/src/theory/bags/bags_rewriter.h`/
24 #include "theory/bags/bags_statistics.h"cxx . . $ `<file>/src/theory/bags/bags_statistics.h`/
25 #include "theory/bags/inference_generator.h"cxx . . $ `<file>/src/theory/bags/inference_generator.h`/
26 #include "theory/bags/inference_manager.h"cxx . . $ `<file>/src/theory/bags/inference_manager.h`/
27 #include "theory/bags/solver_state.h"cxx . . $ `<file>/src/theory/bags/solver_state.h`/
28 #include "theory/bags/strategy.h"cxx . . $ `<file>/src/theory/bags/strategy.h`/
29 #include "theory/bags/term_registry.h"cxx . . $ `<file>/src/theory/bags/term_registry.h`/
30 #include "theory/care_pair_argument_callback.h"cxx . . $ `<file>/src/theory/care_pair_argument_callback.h`/
31 #include "theory/theory.h"cxx . . $ `<file>/src/theory/theory.h`/
32 #include "theory/theory_eq_notify.h"cxx . . $ `<file>/src/theory/theory_eq_notify.h`/
33
34 namespace cvc5cxx . . $ cvc5/::internalcxx . . $ cvc5/internal/ {
35 namespace theorycxx . . $ cvc5/internal/theory/ {
36 namespace bagscxx . . $ cvc5/internal/theory/bags/ {
37
38 class TheoryBagscxx . . $ cvc5/internal/theory/bags/TheoryBags# : public Theorycxx . . $ cvc5/internal/theory/Theory#
39 {
40 public:
41 /** Constructs a new instance of TheoryBags w.r.t. the provided contexts. */
42 TheoryBagscxx . . $ cvc5/internal/theory/bags/TheoryBags#TheoryBags(c1ddac6e9a132f0f).(Envcxx . . $ cvc5/internal/Env#& env, OutputChannelcxx . . $ cvc5/internal/theory/OutputChannel#& out, Valuationcxx . . $ cvc5/internal/theory/Valuation# valuation);
43 ~cxx . . $ cvc5/internal/theory/bags/TheoryBags#`~TheoryBags`(ced63f7c635d850d).TheoryBagscxx . . $ cvc5/internal/theory/bags/TheoryBags#() override;
44
45 //--------------------------------- initialization
46 /** get the official theory rewriter of this theory */
47 TheoryRewritercxx . . $ cvc5/internal/theory/TheoryRewriter#* getTheoryRewritercxx . . $ cvc5/internal/theory/bags/TheoryBags#getTheoryRewriter(690a06d19798324c).() override;
48 /** get the proof checker of this theory */
49 ProofRuleCheckercxx . . $ cvc5/internal/ProofRuleChecker#* getProofCheckercxx . . $ cvc5/internal/theory/bags/TheoryBags#getProofChecker(b1fb2114dbac39ba).() override;
50 /**
51 * Returns true if we need an equality engine. If so, we initialize the
52 * information regarding how it should be setup. For details, see the
53 * documentation in Theory::needsEqualityEngine.
54 */
55 bool needsEqualityEnginecxx . . $ cvc5/internal/theory/bags/TheoryBags#needsEqualityEngine(18909eef9ec1a5a0).(EeSetupInfocxx . . $ cvc5/internal/theory/EeSetupInfo#& esi) override;
56 /** finish initialization */
57 void finishInitcxx . . $ cvc5/internal/theory/bags/TheoryBags#finishInit(49f6e7a06ebc5aa8).() override;
58 /** preprocess rewrite */
59 TrustNodecxx . . $ cvc5/internal/TrustNode# ppRewritecxx . . $ cvc5/internal/theory/bags/TheoryBags#ppRewrite(f449b772273f6b7f).(TNodecxx . . $ cvc5/internal/TNode# atom, stdcxx . . $ std/::vectorcxx . . $ std/vector#<SkolemLemmacxx . . $ cvc5/internal/theory/SkolemLemma#>& lems) override;
60 //--------------------------------- end initialization
61
62 /**
63 * initialize bag and count terms
64 */
65 void initializecxx . . $ cvc5/internal/theory/bags/TheoryBags#initialize(49f6e7a06ebc5aa8).();
66 /**
67 * collect bags' representatives and all count terms.
68 */
69 void collectBagsAndCountTermscxx . . $ cvc5/internal/theory/bags/TheoryBags#collectBagsAndCountTerms(49f6e7a06ebc5aa8).();
70
71 //--------------------------------- standard check
72 /** Post-check, called after the fact queue of the theory is processed. */
73 void postCheckcxx . . $ cvc5/internal/theory/bags/TheoryBags#postCheck(8ce539ca4d7c816d).(Effortcxx . . $ cvc5/internal/theory/Theory#Effort# effort) override;
74 /** Notify fact */
75 void notifyFactcxx . . $ cvc5/internal/theory/bags/TheoryBags#notifyFact(da6d3e2d24694e65).(TNodecxx . . $ cvc5/internal/TNode# atom, bool pol, TNodecxx . . $ cvc5/internal/TNode# fact, bool isInternal) override;
76 //--------------------------------- end standard check
77 /** Collect model values in m based on the relevant terms given by termSet */
78 bool collectModelValuescxx . . $ cvc5/internal/theory/bags/TheoryBags#collectModelValues(f8b2f887a532433e).(TheoryModelcxx . . $ cvc5/internal/theory/TheoryModel#* m,
79 const stdcxx . . $ std/::setcxx . . $ std/set#<Nodecxx . . $ cvc5/internal/Node#>& termSet) override;
80 TrustNodecxx . . $ cvc5/internal/TrustNode# explaincxx . . $ cvc5/internal/theory/bags/TheoryBags#explain(296955b3bd84515b).(TNodecxx . . $ cvc5/internal/TNode#) override;
81 Nodecxx . . $ cvc5/internal/Node# getCandidateModelValuecxx . . $ cvc5/internal/theory/bags/TheoryBags#getCandidateModelValue(d20d5f7e724a896e).(TNodecxx . . $ cvc5/internal/TNode#) override;
82 stdcxx . . $ std/::stringcxx . . $ std/string# identifycxx . . $ cvc5/internal/theory/bags/TheoryBags#identify(219584694fe2b248).() const override { return "THEORY_BAGS"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; }
83 void preRegisterTermcxx . . $ cvc5/internal/theory/bags/TheoryBags#preRegisterTerm(a421fe81fe985cf6).(TNodecxx . . $ cvc5/internal/TNode# n) override;
84
85 void presolvecxx . . $ cvc5/internal/theory/bags/TheoryBags#presolve(49f6e7a06ebc5aa8).() override;
86 void computeCareGraphcxx . . $ cvc5/internal/theory/bags/TheoryBags#computeCareGraph(49f6e7a06ebc5aa8).() override;
87 void processCarePairArgscxx . . $ cvc5/internal/theory/bags/TheoryBags#processCarePairArgs(4952da49611e0114).(TNodecxx . . $ cvc5/internal/TNode# a, TNodecxx . . $ cvc5/internal/TNode# b) override;
88 bool isCareArgcxx . . $ cvc5/internal/theory/bags/TheoryBags#isCareArg(c176dbad43030cb9).(Nodecxx . . $ cvc5/internal/Node# n, unsigned a);
89 /** run strategy for effort e */
90 void runStrategycxx . . $ cvc5/internal/theory/bags/TheoryBags#runStrategy(8ce539ca4d7c816d).(Theorycxx . . $ cvc5/internal/theory/Theory#::Effortcxx . . $ cvc5/internal/theory/Theory#Effort# e);
91 /** run the given inference step */
92 bool runInferStepcxx . . $ cvc5/internal/theory/bags/TheoryBags#runInferStep(7b0823b2b82f8c0a).(InferStepcxx . . $ cvc5/internal/theory/bags/InferStep# s, int effort);
93
94 private:
95 /** Functions to handle callbacks from equality engine */
96 class NotifyClasscxx . . $ cvc5/internal/theory/bags/TheoryBags#NotifyClass# : public TheoryEqNotifyClasscxx . . $ cvc5/internal/theory/TheoryEqNotifyClass#
97 {
98 public:
99 NotifyClasscxx . . $ cvc5/internal/theory/bags/TheoryBags#NotifyClass#NotifyClass(36d4039e565d5ca6).(TheoryBagscxx . . $ cvc5/internal/theory/bags/TheoryBags#& theory, TheoryInferenceManagercxx . . $ cvc5/internal/theory/TheoryInferenceManager#& inferenceManager)
100
101 : TheoryEqNotifyClasscxx . . $ cvc5/internal/theory/TheoryEqNotifyClass#(inferenceManager), d_theorycxx . . $ cvc5/internal/theory/bags/TheoryBags#NotifyClass#d_theory.(theory)
102 {
103 }
104 void eqNotifyNewClasscxx . . $ cvc5/internal/theory/bags/TheoryBags#NotifyClass#eqNotifyNewClass(a421fe81fe985cf6).(TNodecxx . . $ cvc5/internal/TNode# n) override;
105 void eqNotifyMergecxx . . $ cvc5/internal/theory/bags/TheoryBags#NotifyClass#eqNotifyMerge(4952da49611e0114).(TNodecxx . . $ cvc5/internal/TNode# n1, TNodecxx . . $ cvc5/internal/TNode# n2) override;
106 void eqNotifyDisequalcxx . . $ cvc5/internal/theory/bags/TheoryBags#NotifyClass#eqNotifyDisequal(ae20c8399f20ead1).(TNodecxx . . $ cvc5/internal/TNode# n1, TNodecxx . . $ cvc5/internal/TNode# n2, TNodecxx . . $ cvc5/internal/TNode# reason) override;
107
108 private:
109 TheoryBagscxx . . $ cvc5/internal/theory/bags/TheoryBags#& d_theorycxx . . $ cvc5/internal/theory/bags/TheoryBags#NotifyClass#d_theory.;
110 };
111
112 /** expand the definition of the bag.choose operator */
113 TrustNodecxx . . $ cvc5/internal/TrustNode# expandChooseOperatorcxx . . $ cvc5/internal/theory/bags/TheoryBags#expandChooseOperator(77b037c52235e6ca).(const Nodecxx . . $ cvc5/internal/Node#& node,
114 stdcxx . . $ std/::vectorcxx . . $ std/vector#<SkolemLemmacxx . . $ cvc5/internal/theory/SkolemLemma#>& lems);
115
116 /** The state of the bags solver at full effort */
117 SolverStatecxx . . $ cvc5/internal/theory/bags/SolverState# d_statecxx . . $ cvc5/internal/theory/bags/TheoryBags#d_state.;
118 /** The inference manager */
119 InferenceManagercxx . . $ cvc5/internal/theory/bags/InferenceManager# d_imcxx . . $ cvc5/internal/theory/bags/TheoryBags#d_im.;
120 /** The inference generator */
121 InferenceGeneratorcxx . . $ cvc5/internal/theory/bags/InferenceGenerator# d_igcxx . . $ cvc5/internal/theory/bags/TheoryBags#d_ig.;
122 /** Instance of the above class */
123 NotifyClasscxx . . $ cvc5/internal/theory/bags/TheoryBags#NotifyClass# d_notifycxx . . $ cvc5/internal/theory/bags/TheoryBags#d_notify.;
124 /** Statistics for the theory of bags. */
125 BagsStatisticscxx . . $ cvc5/internal/theory/bags/BagsStatistics# d_statisticscxx . . $ cvc5/internal/theory/bags/TheoryBags#d_statistics.;
126 /** The theory rewriter for this theory. */
127 BagsRewritercxx . . $ cvc5/internal/theory/bags/BagsRewriter# d_rewritercxx . . $ cvc5/internal/theory/bags/TheoryBags#d_rewriter.;
128 /** The term registry for this theory */
129 TermRegistrycxx . . $ cvc5/internal/theory/bags/TermRegistry# d_termRegcxx . . $ cvc5/internal/theory/bags/TheoryBags#d_termReg.;
130 /** the main solver for bags */
131 BagSolvercxx . . $ cvc5/internal/theory/bags/BagSolver# d_solvercxx . . $ cvc5/internal/theory/bags/TheoryBags#d_solver.;
132
133 /** The care pair argument callback, used for theory combination */
134 CarePairArgumentCallbackcxx . . $ cvc5/internal/theory/CarePairArgumentCallback# d_cpacbcxx . . $ cvc5/internal/theory/bags/TheoryBags#d_cpacb.;
135 /** map kinds to their terms. It is cleared during post check */
136 stdcxx . . $ std/::mapcxx . . $ std/map#<Kindcxx . . $ cvc5/internal/Kind#, stdcxx . . $ std/::vectorcxx . . $ std/vector#<Nodecxx . . $ cvc5/internal/Node#>> d_opMapcxx . . $ cvc5/internal/theory/bags/TheoryBags#d_opMap.;
137
138 /** The representation of the strategy */
139 Strategycxx . . $ cvc5/internal/theory/bags/Strategy# d_stratcxx . . $ cvc5/internal/theory/bags/TheoryBags#d_strat.;
140
141 void eqNotifyNewClasscxx . . $ cvc5/internal/theory/bags/TheoryBags#eqNotifyNewClass(a421fe81fe985cf6).(TNodecxx . . $ cvc5/internal/TNode# n);
142 void eqNotifyMergecxx . . $ cvc5/internal/theory/bags/TheoryBags#eqNotifyMerge(4952da49611e0114).(TNodecxx . . $ cvc5/internal/TNode# n1, TNodecxx . . $ cvc5/internal/TNode# n2);
143 void eqNotifyDisequalcxx . . $ cvc5/internal/theory/bags/TheoryBags#eqNotifyDisequal(ae20c8399f20ead1).(TNodecxx . . $ cvc5/internal/TNode# t1, TNodecxx . . $ cvc5/internal/TNode# t2, TNodecxx . . $ cvc5/internal/TNode# reason);
144 }; /* class TheoryBags */
145
146 } // namespace bags
147 } // namespace theory
148 } // namespace cvc5::internal
149
150 #endif /* CVC5__THEORY__BAGS__THEORY_BAGS_H */