Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * Top contributors (to current version): 3 : : * Andrew Reynolds, Tianyi Liang 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 : : * Model normal form finder for strings 14 : : */ 15 : : 16 : : #include "cvc5_private.h" 17 : : 18 : : #ifndef CVC5__THEORY__STRINGS__MODEL_CONS_H 19 : : #define CVC5__THEORY__STRINGS__MODEL_CONS_H 20 : : 21 : : #include "smt/env_obj.h" 22 : : 23 : : namespace cvc5::internal { 24 : : namespace theory { 25 : : namespace strings { 26 : : 27 : : /** 28 : : * The base class for strings model construction. This is used by TheoryStrings 29 : : * during collectModeValues for specifying how to construct model values 30 : : * for string-like terms. 31 : : */ 32 : : class ModelCons : protected EnvObj 33 : : { 34 : : public: 35 : 49278 : ModelCons(Env& env) : EnvObj(env) {} 36 : 49022 : virtual ~ModelCons() {} 37 : : 38 : : /** 39 : : * Get string representatives from relevant term set. 40 : : * 41 : : * Based on the current set of relevant terms in termSet, this gets all 42 : : * representatives of string-like type to be used for model construction, 43 : : * and groups them by type. 44 : : * 45 : : * @param termSet The relevant term set 46 : : * @param repTypes The set of types of terms in the domain of repSet 47 : : * @param repSet Map from types to the representatives of that type 48 : : * @param auxEq A list of equalities to assert directly to the model, e.g. 49 : : * if some term was equated to another. 50 : : */ 51 : : virtual void getStringRepresentativesFrom( 52 : : const std::set<Node>& termSet, 53 : : std::unordered_set<TypeNode>& repTypes, 54 : : std::map<TypeNode, std::unordered_set<Node>>& repSet, 55 : : std::vector<Node>& auxEq) = 0; 56 : : /** 57 : : * Separate by length. 58 : : * 59 : : * Separate the string representatives in argument n into a partition cols 60 : : * whose collections have equal length. The i^th vector in cols has length 61 : : * lts[i] for all elements in col. 62 : : * 63 : : * Must assign lts to *concrete* lengths. 64 : : */ 65 : : virtual void separateByLength(const std::vector<Node>& n, 66 : : std::vector<std::vector<Node>>& cols, 67 : : std::vector<Node>& lts) = 0; 68 : : /** 69 : : * Get the normal form for n. If the returned vector has length > 1, then the 70 : : * model value for (all variables in) the equivalence class of n will be 71 : : * assigned to the model value based on this list. If the returned vector 72 : : * has length 0, the equivalence class will be assigned the empty string. 73 : : * If the returned vector has size 1 and contains a constant, the equivalence 74 : : * class will be assigned that constant. Otherwise, the equivalence class 75 : : * will be assigned an arbitrary value whose length was determined by 76 : : * a call to separateByLength. 77 : : */ 78 : : virtual std::vector<Node> getNormalForm(Node n) = 0; 79 : : }; 80 : : 81 : : } // namespace strings 82 : : } // namespace theory 83 : : } // namespace cvc5::internal 84 : : 85 : : #endif /* CVC5__THEORY__STRINGS__MODEL_CONS_H */