Clingo
|
#include <term.hh>
Public Types | |
using | Key = Symbol |
Key for the concept only matcher interface. | |
Public Member Functions | |
virtual | ~Term ()=default |
Destructor. | |
auto | score (double size, std::vector< bool > const &bound) const -> double |
Compute an estimate how often the term can match size symbols given the bound variables. | |
auto | match (EvalContext const &ctx, Symbol sym) const -> bool |
Match a term with the given symbol. | |
auto | eval (EvalContext const &ctx) const -> std::optional< Symbol > |
Evaluates a term w.r.t. | |
auto | rename (SymbolStore &store, RenameMode mode, String const *name, size_t *vars) const -> UTerm |
Create a copy of the term renaming/replacing parts of it. | |
auto | rename (Util::unordered_map< size_t, size_t > &vars) const -> UTerm |
Create a copy of the term renaming variables in order of occurrence. | |
void | vars (VariableSet &vars, bool provide=false) const |
Collect all variables in the term. | |
auto | copy () const -> UTerm |
Create a copy of the term. | |
auto | hash () const -> size_t |
Compute a hash for the term. | |
auto | signature (VariableSet const &bound, VariableSet const &bind) const -> std::pair< UTerm, VariableVec > |
Compute a signature of the term. | |
auto | vars () const -> VariableSet |
Collect all variables in the term. | |
Friends | |
auto | operator== (Term const &a, Term const &b) -> bool |
Compare two terms. | |
auto | operator<=> (Term const &a, Term const &b) -> std::strong_ordering |
Compare two terms. | |
auto | operator<< (std::ostream &out, Term const &term) -> std::ostream & |
Print the term. | |
Term interface.
|
inline |
Evaluates a term w.r.t.
the given assignment.
A term might fail to evaluate if a unary or binary operation is not defined for its arguments.
|
inline |
Match a term with the given symbol.
Returns true if the term can match the symbol. Variables in the term are assigned to symbols and stored in the given assignment.
|
inline |
Create a copy of the term renaming/replacing parts of it.
If a name is given, the name of the outermost function symbol is changed. Otherwise, variables and projection are replaced according to the given mode.
|
inline |
Compute a signature of the term.
This renames variables in the term in ascending order and then return a pair of the term and the bound variables.