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 : : * Implementation of witness elimination node conversion 14 : : */ 15 : : #include "cvc5_private.h" 16 : : 17 : : #ifndef CVC5__EXPR__ELIM_WITNESS_NODE_CONVERTER_H 18 : : #define CVC5__EXPR__ELIM_WITNESS_NODE_CONVERTER_H 19 : : 20 : : #include <unordered_set> 21 : : 22 : : #include "expr/node.h" 23 : : #include "expr/node_converter.h" 24 : : #include "smt/env_obj.h" 25 : : 26 : : namespace cvc5::internal { 27 : : 28 : : /** 29 : : * Node converter to eliminate all terms of kind WITNESS. Each term replaced 30 : : * in this way is captured by an existential, which can be obtained by 31 : : * getExistentials. 32 : : */ 33 : : class ElimWitnessNodeConverter : protected EnvObj, public NodeConverter 34 : : { 35 : : public: 36 : : /** Eliminate witness terms.*/ 37 : : ElimWitnessNodeConverter(Env& env); 38 : 687 : ~ElimWitnessNodeConverter() {} 39 : : /** 40 : : * Convert node n as described above during post-order traversal. 41 : : */ 42 : : Node postConvert(Node n) override; 43 : : /** 44 : : * Get the existentials 45 : : */ 46 : : const std::vector<Node>& getExistentials() const; 47 : : 48 : : /** 49 : : * Get the normal form of a quantified formula for which we are introducing 50 : : * a skolem variable based on eliminating a witness term. 51 : : */ 52 : : virtual Node getNormalFormFor(const Node& q); 53 : : 54 : : private: 55 : : /** The list of existentials introduced by eliminating witness */ 56 : : std::vector<Node> d_exists; 57 : : }; 58 : : 59 : : } // namespace cvc5::internal 60 : : 61 : : #endif