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 : : * Remove rewrite rules, apply pre-skolemization to existential quantifiers. 11 : : * 12 : : * Calls the quantifier rewriter, removing rewrite rules and applying 13 : : * pre-skolemization to existential quantifiers 14 : : */ 15 : : 16 : : #include "preprocessing/passes/quantifiers_preprocess.h" 17 : : 18 : : #include "base/output.h" 19 : : #include "preprocessing/assertion_pipeline.h" 20 : : #include "theory/quantifiers/quantifiers_preprocess.h" 21 : : #include "theory/rewriter.h" 22 : : 23 : : namespace cvc5::internal { 24 : : namespace preprocessing { 25 : : namespace passes { 26 : : 27 : : using namespace std; 28 : : using namespace cvc5::internal::theory; 29 : : 30 : 51695 : QuantifiersPreprocess::QuantifiersPreprocess( 31 : 51695 : PreprocessingPassContext* preprocContext) 32 : 51695 : : PreprocessingPass(preprocContext, "quantifiers-preprocess") {}; 33 : : 34 : 32408 : PreprocessingPassResult QuantifiersPreprocess::applyInternal( 35 : : AssertionPipeline* assertionsToPreprocess) 36 : : { 37 : 32408 : size_t size = assertionsToPreprocess->size(); 38 : 32408 : quantifiers::QuantifiersPreprocess qp(d_env); 39 [ + + ]: 253464 : for (size_t i = 0; i < size; ++i) 40 : : { 41 : 221063 : Node prev = (*assertionsToPreprocess)[i]; 42 : 221063 : TrustNode trn = qp.preprocess(prev); 43 [ + + ]: 221063 : if (!trn.isNull()) 44 : : { 45 : 37 : Node next = trn.getNode(); 46 : 37 : assertionsToPreprocess->replace( 47 : : i, next, nullptr, TrustId::PREPROCESS_QUANTIFIERS_PP); 48 : 37 : assertionsToPreprocess->ensureRewritten(i); 49 [ + - ]: 37 : Trace("quantifiers-preprocess") << "*** Pre-skolemize " << prev << endl; 50 [ + - ]: 74 : Trace("quantifiers-preprocess") 51 : 37 : << " ...got " << (*assertionsToPreprocess)[i] << endl; 52 [ + + ]: 37 : if (assertionsToPreprocess->isInConflict()) 53 : : { 54 : 7 : return PreprocessingPassResult::CONFLICT; 55 : : } 56 [ + + ]: 37 : } 57 [ + + ][ + + ]: 221070 : } 58 : : 59 : 32401 : return PreprocessingPassResult::NO_CONFLICT; 60 : 32408 : } 61 : : 62 : : } // namespace passes 63 : : } // namespace preprocessing 64 : : } // namespace cvc5::internal