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