33#include "LaTeXUtilities.hpp"
34#include "Function.hpp"
71 Variable() : id(0), name(), substitution(nullptr) {}
72 Variable(ID new_id) : id(new_id), name(), substitution(nullptr) {}
73 Variable(ID new_id,
const string& new_name)
74 : id(new_id), name(new_name), substitution(nullptr) {}
92 inline ID
get_id()
const {
return id; }
99 inline string get_name()
const {
return name; }
111 inline bool is_subbed()
const {
return (substitution !=
nullptr); }
Basic representation of functions.
General representation of terms.
Basic representation of variables.
Variable * subbed_variable() const
If the variable is unsubbed then return "this"; otherwise a pointer to the variable at the end of a c...
Term * skip_leading_variables() const
It may be that there is a chain of substitutions attached to this variable: skip the leading ones.
bool contains_variable(Variable *) const
Does the substitution turn the variable into something that includes the variable passed?
friend ostream & operator<<(ostream &, const Variable &)
Some methods are in Term.cpp to make the dependencies work.
bool subbed_is_variable() const
Is the variable still in fact a variable, taking substitution into account?
void substitute(Term *t)
Self-explanatory, but be careful!
ID get_id() const
Self-explanatory access function.
Variable()
Constructors: you can only construct un-substituted variables.
bool is_subbed() const
Self-explanatory.
Variable(const Variable &)=delete
Explicitly disallow copying as this is a very bad idea.
Arity get_subbed_arity() const
If there is a chain of substitutions ending in a function, find that function's arity.
Function * get_subbed_f() const
If there is a chain of substitutions ending in a function, find that function.
void remove_substitution()
Self-explanatory, but be careful!
string to_string(bool=false) const
Convert to a (coloured) string.
bool subbed_is_function() const
Is the variable now a function, taking substitution into account?
string get_name() const
Self-explanatory access function.
string make_LaTeX(bool=false) const
Convert the Variable to a useable LaTeX representation.
Term * get_subbed_term() const
Self-explanatory.
Storage of named variables, and management of new, anonymous variables.