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, Valuation val, const LogicInfo& logicInfo); 33 : 50659 : ~QuantifiersState() {} 34 : : /** 35 : : * Increment the instantiation counters, called once at the beginning of when 36 : : * we perform a check with quantifiers engine for the given effort. 37 : : */ 38 : : void incrementInstRoundCounters(Theory::Effort e); 39 : : /** 40 : : * Get whether we need to check at effort e based on the inst-when mode. This 41 : : * option determines the policy of quantifier instantiation and theory 42 : : * combination, e.g. does it run before, after, or interleaved with theory 43 : : * combination. This is based on the state of the counters maintained by this 44 : : * class. 45 : : */ 46 : : bool getInstWhenNeedsCheck(Theory::Effort e) const; 47 : : /** Get the number of instantiation rounds performed in this SAT context */ 48 : : uint64_t getInstRoundDepth() const; 49 : : /** Get the total number of instantiation rounds performed */ 50 : : uint64_t getInstRounds() const; 51 : : /** debug print equality engine on trace c */ 52 : : void debugPrintEqualityEngine(const char* c) const; 53 : : /** get the logic info */ 54 : : const LogicInfo& getLogicInfo() const; 55 : : /** get the stats */ 56 : : QuantifiersStatistics& getStats(); 57 : : 58 : : /** Mark conflicting instance */ 59 : : void notifyConflictingInst(); 60 : : /** Is conflicting instance? */ 61 : 568894 : bool isConflictingInst() const { return d_conflictInst.get(); } 62 : : 63 : : private: 64 : : /** The number of instantiation rounds in this SAT context */ 65 : : context::CDO<uint64_t> d_ierCounterc; 66 : : /** Conflicting instantiation in this SAT context */ 67 : : context::CDO<bool> d_conflictInst; 68 : : /** The number of total instantiation rounds (full effort) */ 69 : : uint64_t d_ierCounter; 70 : : /** The number of total instantiation rounds (last call effort) */ 71 : : uint64_t d_ierCounterLc; 72 : : /** 73 : : * A counter to remember the last value of d_ierCounterLc where we a 74 : : * full effort check. This is used for interleaving theory combination 75 : : * and quantifier instantiation rounds. 76 : : */ 77 : : uint64_t d_ierCounterLastLc; 78 : : /** 79 : : * The number of instantiation rounds we run for each call to theory 80 : : * combination. 81 : : */ 82 : : uint64_t d_instWhenPhase; 83 : : /** Information about the logic we're operating within. */ 84 : : const LogicInfo& d_logicInfo; 85 : : /** The statistics */ 86 : : QuantifiersStatistics d_statistics; 87 : : }; 88 : : 89 : : } // namespace quantifiers 90 : : } // namespace theory 91 : : } // namespace cvc5::internal 92 : : 93 : : #endif /* CVC5__THEORY__QUANTIFIERS__QUANTIFIERS_STATE_H */