44enum class SimplificationResult {OK, Tautology, Contradiction};
61 static std::mt19937
d;
69 Clause(
const vector<Literal>& new_lits) :
c(new_lits) {
71 if (new_lits.size() == 0)
72 cerr <<
"Why are you constructing an empty clause?" << endl;
78 inline size_t size()
const {
return c.size(); }
82 inline bool empty()
const {
return c.empty(); }
190 vector<Literal>::const_iterator cbegin()
const {
return c.cbegin(); }
191 vector<Literal>::const_iterator cend()
const {
return c.cend(); }
192 vector<Literal>::iterator begin() {
return c.begin(); }
193 vector<Literal>::iterator end() {
return c.end(); }
195 friend ostream& operator<<(ostream&,
const Clause&);
Representation of clauses.
Literal & operator[](size_t)
Direct read of the specified Literal.
Literal extract_literal(LitNum)
Get rid of and return the specified Literal.
bool has_complementary_literals() const
Check whether the clause contains complementary literals.
string to_tptp_string() const
Convert to a string that is compatible with the TPTP.
void random_reorder()
Randomly re-order the literals.
bool empty() const
Straightforward get method.
void remove_duplicates()
Get rid of identical literals.
void clear()
Straightforward reset method.
static std::mt19937 d
Randomness for random reordering.
string to_prolog_string() const
Convert to a string that can be read by Prolog.
Clause make_copy_with_new_vars(VariableIndex &, TermIndex &) const
Make a copy of an entire clause, introducing new variables.
vector< Literal > c
A Clause is just a vector of Literals.
SimplificationResult simplify()
Simplify a clause by dealing with $true, $false, complementary literals, and duplicates.
bool is_positive() const
A clause is positive if it has no negated literals.
void add_lit(const Literal &)
Add a literal, making sure you don't duplicate.
size_t size() const
Straightforward get method.
bool is_negative() const
A clause is negative if it has only negated literals.
string to_string(bool=false) const
Convert to a string.
string make_LaTeX(bool=false) const
Convert the clause to a LaTeX representation.
Clause(const vector< Literal > &new_lits)
Construction is just taking a new vector of Literals.
void drop_literal(LitNum)
Get rid of the specified Literal.
Basic representation of literals, bundling together (pointers to) a Predicate, a collection of argume...
Look after terms, (ideally) using hash consing to avoid storing copies of terms.
Storage of named variables, and management of new, anonymous and unique variables.