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 : : * quantifier relevance 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__THEORY__QUANT_RELEVANCE_H 16 : : #define CVC5__THEORY__QUANT_RELEVANCE_H 17 : : 18 : : #include <map> 19 : : 20 : : #include "theory/quantifiers/quant_util.h" 21 : : 22 : : namespace cvc5::internal { 23 : : namespace theory { 24 : : namespace quantifiers { 25 : : 26 : : /** QuantRelevance 27 : : * 28 : : * This class is used for implementing SinE-style heuristics 29 : : * (e.g. see Hoder et al. CADE 2011) 30 : : * This is enabled by the option --relevant-triggers. 31 : : */ 32 : : class QuantRelevance : public QuantifiersUtil 33 : : { 34 : : public: 35 : : /** constructor 36 : : * cr is whether relevance is computed by this class. 37 : : * if this is false, then all calls to getRelevance 38 : : * return -1. 39 : : */ 40 : : QuantRelevance(Env& env); 41 : 12 : ~QuantRelevance() {} 42 : : /** reset */ 43 : 0 : bool reset(CVC5_UNUSED Theory::Effort e) override { return true; } 44 : : /** register quantifier */ 45 : : void registerQuantifier(Node q) override; 46 : : /** identify */ 47 : 0 : std::string identify() const override { return "QuantRelevance"; } 48 : : /** get number of quantifiers for symbol s */ 49 : : size_t getNumQuantifiersForSymbol(Node s) const; 50 : : 51 : : private: 52 : : /** map from quantifiers to symbols they contain */ 53 : : std::map<Node, std::vector<Node> > d_syms; 54 : : /** map from symbols to quantifiers */ 55 : : std::map<Node, std::vector<Node> > d_syms_quants; 56 : : /** relevance for quantifiers and symbols */ 57 : : std::map<Node, int> d_relevance; 58 : : /** compute symbols */ 59 : : void computeSymbols(Node n, std::vector<Node>& syms); 60 : : }; 61 : : 62 : : } // namespace quantifiers 63 : : } // namespace theory 64 : : } // namespace cvc5::internal 65 : : 66 : : #endif /* CVC5__THEORY__QUANT_RELEVANCE_H */