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 : : * Expand definitions for floating-point arithmetic. 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__THEORY__FP__FP_EXPAND_DEFS_H 16 : : #define CVC5__THEORY__FP__FP_EXPAND_DEFS_H 17 : : 18 : : #include "context/cdhashmap.h" 19 : : #include "expr/node.h" 20 : : #include "proof/trust_node.h" 21 : : 22 : : namespace cvc5::internal { 23 : : namespace theory { 24 : : namespace fp { 25 : : 26 : : /** 27 : : * Module responsibile for expanding definitions for the FP theory. 28 : : */ 29 : : class FpExpandDefs 30 : : { 31 : : using PairTypeNodeHashFunction = PairHashFunction<TypeNode, 32 : : TypeNode, 33 : : std::hash<TypeNode>, 34 : : std::hash<TypeNode>>; 35 : : /** Uninterpreted functions for undefined cases of non-total operators. */ 36 : : using ComparisonUFMap = context::CDHashMap<TypeNode, Node>; 37 : : /** Uninterpreted functions for lazy handling of conversions. */ 38 : : using ConversionUFMap = context:: 39 : : CDHashMap<std::pair<TypeNode, TypeNode>, Node, PairTypeNodeHashFunction>; 40 : : 41 : : public: 42 : 51042 : FpExpandDefs(NodeManager* nm) : d_nm(nm) {} 43 : : /** expand definitions in node */ 44 : : Node expandDefinition(Node node); 45 : : 46 : : private: 47 : : /** 48 : : * Helper to create a function application on a fresh UF for the undefined 49 : : * zero case of fp.min/fp.max. The UF is instantiated with the operands of 50 : : * the given node. 51 : : * @param node The fp.min/fp.maxnode to create the UF and its application for. 52 : : * @return The function application. 53 : : */ 54 : : Node minMaxUF(TNode node); 55 : : /** 56 : : * Helper to create a function application on a fresh UF for the undefined 57 : : * cases of fp.to_ubv/fp.to_sbv. The UF is instantiated with the operands of 58 : : * the given node. 59 : : * @param node The fp.to_sbv/to_ubv node to create the UF and its application 60 : : * for. 61 : : * @return The function application. 62 : : */ 63 : : Node toUbvSbvUF(TNode node); 64 : : /** 65 : : * Helper to create a function application on a fresh UF for the undefined 66 : : * cases of fp.to_real. The UF is instantiated with the operands of the given 67 : : * fp.to_real node. 68 : : * @param node The fp.to_real node to create the UF and its application for. 69 : : * @return The function application. 70 : : */ 71 : : Node toRealUF(TNode node); 72 : : /** The associated node manager. */ 73 : : NodeManager* d_nm; 74 : : }; /* class TheoryFp */ 75 : : 76 : : } // namespace fp 77 : : } // namespace theory 78 : : } // namespace cvc5::internal 79 : : 80 : : #endif /* CVC5__THEORY__FP__FP_EXPAND_DEFS_H */