33#include<unordered_map>
35#include "TermIndex.hpp"
36#include "Predicate.hpp"
41using std::unordered_map;
57 Literal() : pred(
nullptr), args(), arity(0), polarity(
true) {}
83 inline const vector<Term*>&
get_args()
const {
return args; }
103 inline void invert() { polarity = !polarity; }
111 inline bool is_empty()
const {
return (pred ==
nullptr); }
115 void clear() { pred =
nullptr; args.clear(), arity = 0; polarity =
true; }
123 size_t index = pred->
get_ID() << 1;
233 unordered_map<Variable*,Term*>&)
const;
258 friend ostream& operator<<(ostream&,
const Literal&);
Basic representation of literals, bundling together (pointers to) a Predicate, a collection of argume...
bool is_false() const
Is this equivalent to $false?
void make_positive()
Basic manipulation - entirely self-explanatory.
void replace_variable_with_term(Term *, Variable *, TermIndex *)
Replace one variable with a term throughout.
const vector< Term * > & get_args() const
Basic get method.
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.
bool is_positive() const
Basic manipulation - entirely self-explanatory.
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.
Arity get_arity() const
Basic get method.
bool is_compatible_with(const Literal *) const
Literals can only be unified if the polarity and actual predicate are the same.
Literal make_copy_with_new_vars(VariableIndex &, TermIndex &) const
Make a copy of the Literal but with a new set of variables.
void make_empty()
Basic manipulation - entirely self-explanatory.
bool operator==(const Literal &) const
Equality without taking account of substutions.
bool get_polarity() const
Basic get method.
bool is_true() const
Is this equivalent to $true?
string get_small_lit() const
Get the predicate and polarity as a string.
size_t get_pred_as_index() const
Turn a Literal into an array index.
bool subbed_equal(Literal *) const
Equality, taking account of substitutions.
void invert()
Basic manipulation - entirely self-explanatory.
bool is_negative() const
Basic manipulation - entirely self-explanatory.
void clear()
Basic manipulation - entirely self-explanatory.
string to_prolog_string() const
Convert to a string in a format readable by Prolog.
void make_negative()
Basic manipulation - entirely self-explanatory.
Predicate * get_pred() const
Basic get method.
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.
ID get_ID() const
Basic get method.
General representation of terms.
Look after terms, (ideally) using hash consing to avoid storing copies of terms.
Basic representation of variables.
Storage of named variables, and management of new, anonymous and unique variables.