42enum class SimplificationResult {OK, Tautology, Contradiction};
63 Clause(
const vector<Literal>& new_lits) : c(new_lits) {
65 if (new_lits.size() == 0)
66 cerr <<
"Why are you constructing an empty clause?" << endl;
72 inline size_t size()
const {
return c.size(); }
76 inline bool empty()
const {
return c.empty(); }
80 inline void clear() { c.clear(); }
157 string to_string(
bool =
false)
const;
173 vector<Literal>::const_iterator cbegin()
const {
return c.cbegin(); }
174 vector<Literal>::const_iterator cend()
const {
return c.cend(); }
175 vector<Literal>::iterator begin() {
return c.begin(); }
176 vector<Literal>::iterator end() {
return c.end(); }
178 friend ostream& operator<<(ostream&,
const Clause&);
Representation of clauses.
Definition Clause.hpp:50
Literal & operator[](size_t)
Direct read of the specified Literal.
Definition Clause.cpp:178
Literal extract_literal(LitNum)
Get rid of and return the specified Literal.
Definition Clause.cpp:154
bool has_complementary_literals() const
Check whether the clause contains complementary literals.
Definition Clause.cpp:72
bool empty() const
Straightforward get method.
Definition Clause.hpp:76
void remove_duplicates()
Get rid of identical literals.
Definition Clause.cpp:52
void clear()
Straightforward reset method.
Definition Clause.hpp:80
string to_prolog_string() const
Convert to a string that can be read by Prolog.
Definition Clause.cpp:197
Clause make_copy_with_new_vars(VariableIndex &, TermIndex &) const
Make a copy of an entire clause, introducing new variables.
Definition Clause.cpp:96
SimplificationResult simplify()
Simplify a clause by dealing with $true, $false, complementary literals, and duplicates.
Definition Clause.cpp:108
bool is_positive() const
A clause is positive if it has no negated literals.
Definition Clause.cpp:28
void add_lit(const Literal &)
Add a literal, making sure you don't duplicate.
Definition Clause.cpp:85
size_t size() const
Straightforward get method.
Definition Clause.hpp:72
bool is_negative() const
A clause is negative if it has only negated literals.
Definition Clause.cpp:40
string make_LaTeX(bool=false) const
Convert the clause to a LaTeX representation.
Definition Clause.cpp:208
Clause(const vector< Literal > &new_lits)
Construction is just taking a new vector of Literals.
Definition Clause.hpp:63
void drop_literal(LitNum)
Get rid of the specified Literal.
Definition Clause.cpp:133
Basic representation of literals, bundling together (pointers to) a Predicate, a collection of argume...
Definition Literal.hpp:50
Look after terms, (ideally) using hash consing to avoid storing copies of terms.
Definition TermIndex.hpp:75
Storage of named variables, and management of new, anonymous variables.
Definition VariableIndex.hpp:61