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