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 : : * A class for finding unsoundness in the rewriter 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__THEORY__QUANTIFIERS__REWRITE_VERIFIER_H 16 : : #define CVC5__THEORY__QUANTIFIERS__REWRITE_VERIFIER_H 17 : : 18 : : #include "expr/node.h" 19 : : #include "theory/quantifiers/expr_miner.h" 20 : : 21 : : namespace cvc5::internal { 22 : : namespace theory { 23 : : namespace quantifiers { 24 : : 25 : : /** 26 : : * RewriteVerifier, which tests the rewritten form of terms provided to addTerm. 27 : : */ 28 : : class RewriteVerifier : public ExprMiner 29 : : { 30 : : public: 31 : : RewriteVerifier(Env& env); 32 : 24 : ~RewriteVerifier() {} 33 : : /** 34 : : * Add term to this module, which may add an equality of the form 35 : : * (= n Rewriter::rewrite(n)) to rewrites if we discover the rewrite is 36 : : * unsound. 37 : : */ 38 : : bool addTerm(Node n, std::vector<Node>& rewrites) override; 39 : : 40 : : private: 41 : : /** check equivalent 42 : : * 43 : : * Check whether bv and bvr are equivalent on all sample points, print 44 : : * an error if not. Used with --sygus-rr-verify. 45 : : * 46 : : * @param bv The original term 47 : : * @param bvr The rewritten form of bvr 48 : : * @param out The output stream to write if the rewrite was unsound. 49 : : */ 50 : : bool checkEquivalent(Node bv, Node bvr, std::ostream* out = nullptr); 51 : : }; 52 : : 53 : : } // namespace quantifiers 54 : : } // namespace theory 55 : : } // namespace cvc5::internal 56 : : 57 : : #endif /* CVC5__THEORY__QUANTIFIERS__REWRITE_VERIFIER_H */