33#include<unordered_map>
35#include "VariableIndex.hpp"
39using std::unordered_map;
41using std::ostringstream;
45using VarMapType = pair<Variable*,Term*>;
72 Term() : v(
nullptr), f(
nullptr), args() {}
99 Term& operator=(
const Term&) =
delete;
100 Term& operator=(
const Term&&) =
delete;
122 inline Arity
arity()
const {
return args.size(); }
139 string to_string(
bool =
false,
bool =
false)
const;
281 unordered_map<Variable*,Term*>&)
const;
284 friend ostream& operator<<(ostream&,
const Term&);
Basic representation of functions.
Definition Function.hpp:54
General representation of terms.
Definition Term.hpp:62
Function * get_subbed_f() const
Taking substitution into account, what function do we actually have?
Definition Term.cpp:138
Term * make_copy_with_new_vars(VariableIndex &, TermIndex &) const
Does as the name suggests.
Definition TermIndex.cpp:179
bool is_unsubbed_variable() const
Is this a variable that hasn't been substituted?
Definition Term.cpp:228
string make_LaTeX(bool=false) const
Make a useable LaTeX representation.
Definition Term.cpp:211
Variable * get_v() const
Self-explanatory access function.
Definition Term.hpp:106
bool subbed_equal(Term *) const
Equality test, taking substitution into account.
Definition Term.cpp:72
Term * skip_leading_variables() const
It may be that there is a chain of substitutions attached to a variable.
Definition Term.cpp:234
void find_subbed_vars(set< Variable * > &) const
Taking substitution into account, find all the variables in a term.
Definition Term.cpp:152
bool subbed_is_variable() const
Is this term a variable, taking substitution into accoumt?
Definition Term.cpp:112
Term * make_copy_with_new_vars_helper(VariableIndex &, TermIndex &, unordered_map< Variable *, Term * > &) const
Main implementation of make_copy_with_new_vars.
Definition TermIndex.cpp:148
Variable * subbed_variable() const
Taking substitution into account, what variable do we actually have?
Definition Term.cpp:119
Arity get_subbed_arity() const
Taking substitution into account, what arity do we actually have?
Definition Term.cpp:145
Function * get_f() const
Self-explanatory access function.
Definition Term.hpp:110
bool contains_variable(Variable *) const
Taking substitution into account, does the term include the variable passed?
Definition Term.cpp:128
bool operator==(const Term &) const
For the TermIndex you want strict equaliity of the data members.
Definition Term.cpp:44
bool is_function() const
Self-explanatory.
Definition Term.hpp:118
bool is_variable() const
Self-explanatory.
Definition Term.hpp:114
string to_prolog_string() const
Convert to a string that can be read by Prolog.
Definition Term.cpp:191
bool is_subbed() const
Test whether any variable has been substituted.
Definition Term.cpp:58
Arity arity() const
Self-explanatory access function.
Definition Term.hpp:122
Term * operator[](size_t) const
Access to args, but don't mess with them!
Definition Term.cpp:50
bool subbed_is_function() const
Is this term a function, taking substitution into accoumt?
Definition Term.cpp:105
Look after terms, (ideally) using hash consing to avoid storing copies of terms.
Definition TermIndex.hpp:75
Basic representation of variables.
Definition Variable.hpp:58
Storage of named variables, and management of new, anonymous variables.
Definition VariableIndex.hpp:61