32 std::unique_ptr<std::vector<std::size_t>>
indices;
41 :
name(std::move(_name))
49 explicit SortContent(std::string _name,
const std::vector<Sort>& _parameters)
50 :
name(std::move(_name)),
53 explicit SortContent(std::string _name, std::vector<Sort>&& _parameters)
54 :
name(std::move(_name)),
55 parameters(std::make_unique<std::vector<
Sort>>(std::move(_parameters)))
116 std::vector<std::unique_ptr<SortContent>>
mSorts;
120 std::map<const SortContent*, std::size_t, carl::less<const SortContent*>>
mSortMap;
126 std::map<Sort, std::pair<std::size_t, VariableType>>
mIndexable;
138 assert(sort.
id() > 0);
143 for (
const auto& s :
mSorts) {
144 if (s ==
nullptr)
continue;
145 if (s->name == name)
return false;
154 return Sort(it->second);
169 Sort baseSort(sortIt->second);
173 return it->second.second;
191 mSorts.emplace_back(
nullptr);
209 assert(sort.
id() > 0);
220 std::ostream&
print(std::ostream& os,
const Sort& sort)
const;
235 Sort replace(
const Sort& sort,
const std::map<std::string, Sort>& parameters);
244 bool declare(
const std::string& name, std::size_t arity);
254 bool define(
const std::string& name,
const std::vector<std::string>& params,
const Sort& sort);
285 Sort index(
const Sort& sort,
const std::vector<std::size_t>& indices);
301 Sort getSort(
const std::string& name,
const std::vector<Sort>& params);
303 Sort getSort(
const std::string& name,
const std::vector<std::size_t>& indices);
305 Sort getSort(
const std::string& name,
const std::vector<std::size_t>& indices,
const std::vector<Sort>& params);
312 template<
typename... Args>
carl is the main namespace for the library.
Coeff content(const UnivariatePolynomial< Coeff > &p)
The content of a polynomial is the gcd of the coefficients of the normal part of a polynomial.
bool operator<(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
Sort getSort(Args &&... args)
Gets the sort specified by the arguments.
VariableType
Several types of variables are supported.
Base class that implements a singleton.
static SortManager & getInstance()
Returns the single instance of this class by reference.
Implements a sort (for defining types of variables and functions).
The actual content of a sort.
std::unique_ptr< std::vector< std::size_t > > indices
The sort's indices. A sort can be indexed with the "_" operator. It is nullptr, if no indices are pre...
SortContent(std::string _name) noexcept
Constructs a sort content.
SortContent(std::string _name, std::vector< Sort > &&_parameters)
SortContent getUnindexed() const
Return a copy of this SortContent without any indices.
std::string name
The sort's name.
std::unique_ptr< std::vector< Sort > > parameters
The sort's argument types. It is nullptr, if the sort's arity is zero.
SortContent(std::string _name, const std::vector< Sort > &_parameters)
Constructs a sort content.
SortContent(const SortContent &sc)
~SortContent() noexcept=default
Destructs a sort content.
Implements a manager for sorts, containing the actual contents of these sort and allocating their ids...
bool declare(const std::string &name, std::size_t arity)
Adds a sort declaration.
const std::vector< std::size_t > * getIndices(const Sort &sort) const
Sort replace(const Sort &sort, const std::map< std::string, Sort > ¶meters)
Recursively replaces sorts within the given sort according to the mapping of sort names to sorts as d...
SortManager & operator=(SortManager &&)=delete
void makeSortIndexable(const Sort &sort, std::size_t indices, VariableType type)
const std::string & get_name(const Sort &sort) const
bool isInterpreted(const Sort &sort) const
Sort index(const Sort &sort, const std::vector< std::size_t > &indices)
SortManager(const SortManager &)=delete
bool isSymbolFree(const std::string &name) const
std::pair< std::vector< std::string >, Sort > SortTemplate
The type of a sort template, define by define-sort.
std::map< Sort, std::pair< std::size_t, VariableType > > mIndexable
Stores all sorts that may become interpreted when indexed.
std::map< const SortContent *, std::size_t, carl::less< const SortContent * > > mSortMap
Maps the sort contents to unique ids.
const SortContent & getContent(const Sort &sort) const
SortManager(SortManager &&)=delete
void exportDefinitions(std::ostream &os) const
Sort addSort(const std::string &name, VariableType type=VariableType::VT_UNINTERPRETED)
Sort getSort(std::unique_ptr< SortContent > &&content, VariableType type)
std::size_t getArity(const Sort &sort) const
VariableType checkIndices(const SortContent &content, std::size_t count) const
Sort getInterpreted(VariableType type) const
Sort addInterpretedMapping(const Sort &sort, VariableType type)
std::map< VariableType, Sort > mInterpreted
Maps variable types to actual sorts.
std::map< std::string, SortTemplate > mDefinitions
Stores all sort definitions invoked by a define-sort.
std::vector< VariableType > mSortTypes
Maps the unique ids to the sort types.
Sort addInterpretedSort(const std::string &name, VariableType type)
VariableType getType(const Sort &sort) const
Sort addInterpretedSort(const std::string &name, const std::vector< Sort > ¶meters, VariableType type)
SortManager()
Constructs a sort manager.
std::vector< std::unique_ptr< SortContent > > mSorts
Maps the unique ids to the sort content.
bool define(const std::string &name, const std::vector< std::string > ¶ms, const Sort &sort)
Adds a sort template definitions.
std::ostream & print(std::ostream &os, const Sort &sort) const
Prints the given sort on the given output stream.
~SortManager() noexcept override=default
std::size_t addSortContent(std::unique_ptr< SortContent > &&content, VariableType type)
SortManager & operator=(const SortManager &)=delete
const std::vector< Sort > * getParameters(const Sort &sort) const
std::map< std::string, std::size_t > mDeclarations
Stores all sort declarations invoked by a declare-sort.