25#include "Substitution.hpp"
30 for (SubPair s :
sub) {
31 result += s.first->to_string();
33 result += s.second->to_string(subbed);
42 for (SubPair s :
sub) {
43 result += s.first->make_LaTeX();
44 result +=
" \\leftarrow ";
45 result += s.second->make_LaTeX(subbed);
53 sub.push_back(SubPair(v, t));
57 for (SubPair s :
sub) {
58 s.first->substitute(s.second);
63 for (SubPair s :
sub) {
64 s.first->remove_substitution();
68ostream& operator<<(ostream& out,
const Substitution& s) {
70 for (SubPair sp : s.sub) {
71 out << cs(
"(").orange() << sp.first->to_string();
72 out << cs(
" -> ").orange();
73 out << sp.second->to_string() << cs(
") ").orange();
General representation of a substitution.
string make_LaTeX(bool=false) const
Make a useable LaTeX representation.
void backtrack() const
Remove a substitution everywhere.
void push_back(Variable *, Term *)
Add a pair to a substitution.
vector< SubPair > sub
A single substitution is just a pointer to the Variable being sustituted, and a pointer to the Term t...
void apply() const
Apply a substitution everywhere.
string to_string(bool=false) const
Make a string representation.
General representation of terms.
Basic representation of variables.
Simple addition of colour to strings and ostreams.
Simple function object for putting commas in lists.