29                 const vector<Term*>& new_args,
 
   38    if (new_p == 
nullptr) {
 
   39      cerr << 
"Why would you construct an empty predicate?" << endl;
 
   42    if (new_p->
get_arity() != new_args.size()) {
 
   43        cerr << 
"Number of arguments doesn't match predicate arity" << endl;
 
   44        cerr << 
"Are you mixing up your predicate names?" << endl;
 
 
   50                                                unordered_map<Variable*,Term*>& new_vars)
 const {
 
   51    vector<Term*> new_args;
 
   52    for (
size_t i = 0; i < arity; i++)
 
   53        new_args.push_back(args[i]->make_copy_with_new_vars_helper(vi, ti, new_vars));
 
   54    Literal result(pred, new_args, arity, polarity);
 
 
   60                                           unordered_map<Variable*,Term*>& new_vars) {
 
   61  for (
size_t i = 0; i < arity; i++)
 
 
   68      cerr << 
"You shouldn't be making copies of empty Literals" << endl;
 
   70    unordered_map<Variable*,Term*> new_vars;
 
 
   76    if (pred == 
nullptr || l->pred == 
nullptr) {
 
   77      cerr << 
"You shouldn't be checking compatibility of empty Literals" << endl;
 
   80    return (pred == l->pred &&
 
   81      polarity == l->polarity &&
 
 
   86  return (pred == l.pred &&
 
   89          !polarity == l.polarity);
 
 
   93  for (
Term* t : args) {
 
   94    if (!t->is_ground()) {
 
 
  103          (pred->
get_name() == 
string(
"$true")) && 
 
  107          (pred->
get_name() == 
string(
"$false")) && 
 
 
  113          (pred->
get_name() == 
string(
"$false")) && 
 
  117          (pred->
get_name() == 
string(
"$true")) && 
 
 
  122  for (
size_t i = 0; i < args.size(); i++) {
 
 
  132    if (pred == 
nullptr || l.pred == 
nullptr) {
 
  133      cerr << 
"You shouldn't be checking equality of empty Literals" << endl;
 
  136    return (pred == l.pred &&
 
  139            polarity == l.polarity);
 
 
  144    if (pred == 
nullptr || l->pred == 
nullptr) {
 
  145      cerr << 
"You shouldn't be checking subbed equality of empty Literals" << endl;
 
  151    for (
size_t i = 0; i < arity; i++) {
 
 
  161      result += unicode_symbols::LogSym::neg;
 
 
  167  string result(
"Empty literal");
 
  169    if (pred->
get_name() == 
string(
"=")) {
 
  171      result += args[0]->to_string(subbed);
 
  173      result += polarity ? 
"=" : unicode_symbols::LogSym::neq;
 
  175      result += args[1]->to_string(subbed);
 
  180      result += vector_to_string(args, subbed);
 
 
  197    for (
Term* p : args) {
 
  198      result += p->to_prolog_string();
 
 
  216      for (
Term* p : args) {
 
  217        result += p->to_prolog_string();
 
  225    result += args[0]->to_prolog_string();
 
  230    result += args[1]->to_prolog_string();
 
 
  244    for (
Term* p : args) {
 
  245        s += p->make_LaTeX(subbed);
 
 
  257    cerr << 
"You shouldn't be replacing variables in an empty Literal" << endl;
 
  259  for (
size_t i = 0; i < arity; i++) {
 
 
  268    cerr << 
"You shouldn't be subbing terms in an empty Literal" << endl;
 
  270  for (
size_t i = 0; i < arity; i++) {
 
 
  275ostream& operator<<(ostream& out, 
const Literal& l) {
 
  277    out << 
"Empty literal";
 
  280      out << unicode_symbols::LogSym::neg;
 
  282    out << vector_to_string(l.args);
 
Basic representation of literals, bundling together (pointers to) a Predicate, a collection of argume...
bool is_false() const
Is this equivalent to $false?
void replace_variable_with_term(Term *, Variable *, TermIndex *)
Replace one variable with a term throughout.
string to_string(bool=false) const
Full conversion of Literal to string.
bool is_empty() const
Basic manipulation - entirely self-explanatory.
string make_LaTeX(bool=false) const
Make a useable LaTeX version.
bool contains_variable(Variable *) const
Does this Literal contain the specified variable?
void replace_variable(Variable *, Variable *, TermIndex *)
Replace one variable with another throughout.
string to_tptp_string() const
Convert to a string in a format compatible with the TPTP.
bool is_complement_of(const Literal &) const
Test whether one literal is exactly the same as another, with the exception of the polarity.
bool is_compatible_with(const Literal *) const
Literals can only be unified if the polarity and actual predicate are the same.
void make_copy_with_new_vars_replace_helper(VariableIndex &, TermIndex &, unordered_map< Variable *, Term * > &)
Helper function for making copies with new variables.
Literal make_copy_with_new_vars(VariableIndex &, TermIndex &) const
Make a copy of the Literal but with a new set of variables.
bool operator==(const Literal &) const
Equality without taking account of substutions.
bool is_true() const
Is this equivalent to $true?
string get_small_lit() const
Get the predicate and polarity as a string.
bool is_ground() const
Is the literal ground?
bool subbed_equal(Literal *) const
Equality, taking account of substitutions.
string to_prolog_string() const
Convert to a string in a format readable by Prolog.
Literal make_copy_with_new_vars_helper(VariableIndex &, TermIndex &, unordered_map< Variable *, Term * > &) const
Helper function for make_copy_with_new_vars.
Basic representation of predicates: here just names, ids and arities.
Arity get_arity() const
Basic get method.
string make_LaTeX() const
Make a useable LaTeX version.
string to_string() const
Converting to a string just gives you the name.
string get_name() const
Basic get method.
General representation of terms.
Look after terms, using hash consing to avoid storing copies of terms.
Term * replace_variable_in_term_with_term(Term *, Variable *, Term *)
Minor variation on replace_variable_in_term.
Term * replace_variable_in_term(Variable *, Variable *, Term *)
Replace a variable in a term with an alternative, maintaining the structure of the TermIndex.
Basic representation of variables.
Storage of named variables, and management of new, anonymous and unique variables.
Simple function object for putting commas in lists.