Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * This file is part of the cvc5 project. 3 : : * 4 : : * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS 5 : : * in the top-level source directory and their institutional affiliations. 6 : : * All rights reserved. See the file COPYING in the top-level source 7 : : * directory for licensing information. 8 : : * **************************************************************************** 9 : : * 10 : : * Utility for quantifiers state. 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__THEORY__QUANTIFIERS__QUANTIFIERS_STATE_H 16 : : #define CVC5__THEORY__QUANTIFIERS__QUANTIFIERS_STATE_H 17 : : 18 : : #include "theory/quantifiers/quantifiers_statistics.h" 19 : : #include "theory/theory.h" 20 : : #include "theory/theory_state.h" 21 : : 22 : : namespace cvc5::internal { 23 : : namespace theory { 24 : : namespace quantifiers { 25 : : 26 : : /** 27 : : * The quantifiers state. 28 : : */ 29 : : class QuantifiersState : public TheoryState 30 : : { 31 : : public: 32 : : QuantifiersState(Env& env, 33 : : Valuation val, 34 : : const LogicInfo& logicInfo); 35 : 49607 : ~QuantifiersState() {} 36 : : /** 37 : : * Increment the instantiation counters, called once at the beginning of when 38 : : * we perform a check with quantifiers engine for the given effort. 39 : : */ 40 : : void incrementInstRoundCounters(Theory::Effort e); 41 : : /** 42 : : * Get whether we need to check at effort e based on the inst-when mode. This 43 : : * option determines the policy of quantifier instantiation and theory 44 : : * combination, e.g. does it run before, after, or interleaved with theory 45 : : * combination. This is based on the state of the counters maintained by this 46 : : * class. 47 : : */ 48 : : bool getInstWhenNeedsCheck(Theory::Effort e) const; 49 : : /** Get the number of instantiation rounds performed in this SAT context */ 50 : : uint64_t getInstRoundDepth() const; 51 : : /** Get the total number of instantiation rounds performed */ 52 : : uint64_t getInstRounds() const; 53 : : /** debug print equality engine on trace c */ 54 : : void debugPrintEqualityEngine(const char* c) const; 55 : : /** get the logic info */ 56 : : const LogicInfo& getLogicInfo() const; 57 : : /** get the stats */ 58 : : QuantifiersStatistics& getStats(); 59 : : 60 : : /** Mark conflicting instance */ 61 : : void notifyConflictingInst(); 62 : : /** Is conflicting instance? */ 63 : 546859 : bool isConflictingInst() const { return d_conflictInst.get(); } 64 : : private: 65 : : /** The number of instantiation rounds in this SAT context */ 66 : : context::CDO<uint64_t> d_ierCounterc; 67 : : /** Conflicting instantiation in this SAT context */ 68 : : context::CDO<bool> d_conflictInst; 69 : : /** The number of total instantiation rounds (full effort) */ 70 : : uint64_t d_ierCounter; 71 : : /** The number of total instantiation rounds (last call effort) */ 72 : : uint64_t d_ierCounterLc; 73 : : /** 74 : : * A counter to remember the last value of d_ierCounterLc where we a 75 : : * full effort check. This is used for interleaving theory combination 76 : : * and quantifier instantiation rounds. 77 : : */ 78 : : uint64_t d_ierCounterLastLc; 79 : : /** 80 : : * The number of instantiation rounds we run for each call to theory 81 : : * combination. 82 : : */ 83 : : uint64_t d_instWhenPhase; 84 : : /** Information about the logic we're operating within. */ 85 : : const LogicInfo& d_logicInfo; 86 : : /** The statistics */ 87 : : QuantifiersStatistics d_statistics; 88 : : }; 89 : : 90 : : } // namespace quantifiers 91 : : } // namespace theory 92 : : } // namespace cvc5::internal 93 : : 94 : : #endif /* CVC5__THEORY__QUANTIFIERS__QUANTIFIERS_STATE_H */