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