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 : : * The rewrite preprocessing pass. 11 : : * 12 : : * Calls the rewriter on every assertion. 13 : : */ 14 : : 15 : : #include "preprocessing/passes/rewrite.h" 16 : : 17 : : #include "options/smt_options.h" 18 : : #include "preprocessing/assertion_pipeline.h" 19 : : #include "theory/rewriter.h" 20 : : 21 : : namespace cvc5::internal { 22 : : namespace preprocessing { 23 : : namespace passes { 24 : : 25 : : using namespace cvc5::internal::theory; 26 : : 27 : 51930 : Rewrite::Rewrite(PreprocessingPassContext* preprocContext) 28 : : : PreprocessingPass(preprocContext, "rewrite"), 29 [ + + ]: 51930 : d_proof(options().smt.produceProofs ? new RewriteProofGenerator(d_env) 30 : 51930 : : nullptr) 31 : : { 32 : 51930 : } 33 : : 34 : 77442 : PreprocessingPassResult Rewrite::applyInternal( 35 : : AssertionPipeline* assertionsToPreprocess) 36 : : { 37 [ + + ]: 995793 : for (size_t i = 0, size = assertionsToPreprocess->size(); i < size; ++i) 38 : : { 39 : 918351 : const Node& a = (*assertionsToPreprocess)[i]; 40 : 918351 : Node ar = rewrite(a); 41 [ + + ]: 918351 : assertionsToPreprocess->replace(i, ar, d_proof.get()); 42 [ - + ]: 918351 : if (assertionsToPreprocess->isInConflict()) 43 : : { 44 : 0 : return PreprocessingPassResult::CONFLICT; 45 : : } 46 [ + - ]: 918351 : } 47 : 77442 : return PreprocessingPassResult::NO_CONFLICT; 48 : : } 49 : : 50 : : } // namespace passes 51 : : } // namespace preprocessing 52 : : } // namespace cvc5::internal