Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * Top contributors (to current version): 3 : : * Andrew Reynolds 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 : : * Learned literal manager 14 : : */ 15 : : 16 : : #include "preprocessing/learned_literal_manager.h" 17 : : 18 : : #include "smt/env.h" 19 : : #include "theory/rewriter.h" 20 : : #include "theory/trust_substitutions.h" 21 : : 22 : : namespace cvc5::internal { 23 : : namespace preprocessing { 24 : : 25 : 51061 : LearnedLiteralManager::LearnedLiteralManager(Env& env) 26 : 51061 : : EnvObj(env), d_learnedLits(userContext()) 27 : : { 28 : 51061 : } 29 : : 30 : 156481 : void LearnedLiteralManager::notifyLearnedLiteral(TNode lit) 31 : : { 32 : 156481 : d_learnedLits.insert(lit); 33 [ + - ]: 156481 : Trace("pp-llm") << "LLM:notifyLearnedLiteral: " << lit << std::endl; 34 : 156481 : } 35 : : 36 : 16 : std::vector<Node> LearnedLiteralManager::getLearnedLiterals() const 37 : : { 38 : 16 : theory::TrustSubstitutionMap& tls = d_env.getTopLevelSubstitutions(); 39 : 16 : std::vector<Node> currLearnedLits; 40 [ + + ]: 68 : for (const auto& lit: d_learnedLits) 41 : : { 42 : : // update based on substitutions 43 : 52 : Node tlsNode = tls.get().apply(lit); 44 : 52 : tlsNode = rewrite(tlsNode); 45 : 52 : currLearnedLits.push_back(tlsNode); 46 [ + - ]: 104 : Trace("pp-llm") << "Learned literal : " << tlsNode << " from " << lit 47 : 52 : << std::endl; 48 : : } 49 : 16 : return currLearnedLits; 50 : : } 51 : : 52 : : } // namespace preprocessing 53 : : } // namespace cvc5::internal