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 : : * Algorithms for node tries 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__EXPR__NODE_TRIE_ALGORITHM_H 16 : : #define CVC5__EXPR__NODE_TRIE_ALGORITHM_H 17 : : 18 : : #include "expr/node_trie.h" 19 : : 20 : : namespace cvc5::internal { 21 : : 22 : : /** A virtual base class for the algorithm below. */ 23 : : class NodeTriePathPairProcessCallback 24 : : { 25 : : public: 26 : 256575 : NodeTriePathPairProcessCallback() {} 27 : 254835 : virtual ~NodeTriePathPairProcessCallback() {} 28 : : /** Whether to consider a pair in paths in a trie */ 29 : : virtual bool considerPath(TNode a, TNode b) = 0; 30 : : /** Process leaves */ 31 : : virtual void processData(TNode fa, TNode fb) = 0; 32 : : }; 33 : : 34 : : /** 35 : : * Given a TNode trie of arity n, this calls ntpc.processData(fa, fb) on all 36 : : * pairs of distinct leaves fa and fb in t at paths [fa1, ..., fan] and 37 : : * [fb1, ..., fbn] in t such that ntpc.considerPath(fai, fbi) returns true for 38 : : * all i = 1, ..., n. 39 : : * 40 : : * A common use case for this algorithm is computing the care graph for theory 41 : : * combination. 42 : : */ 43 : : void nodeTriePathPairProcess(const TNodeTrie* t, 44 : : size_t n, 45 : : NodeTriePathPairProcessCallback& ntpc); 46 : : 47 : : } // namespace cvc5::internal 48 : : 49 : : #endif /* CVC5__EXPR__NODE_TRIE_ALGORITHM_H */