![]() |
Connect++ 0.5.0
A fast, readable connection prover for first-order logic.
|
Representation of clauses. More...
#include <Clause.hpp>
Public Member Functions | |
Clause (const vector< Literal > &new_lits) | |
Construction is just taking a new vector of Literals. | |
size_t | size () const |
Straightforward get method. | |
bool | empty () const |
Straightforward get method. | |
void | clear () |
Straightforward reset method. | |
bool | is_positive () const |
A clause is positive if it has no negated literals. | |
bool | is_negative () const |
A clause is negative if it has only negated literals. | |
void | remove_duplicates () |
Get rid of identical literals. | |
bool | has_complementary_literals () const |
Check whether the clause contains complementary literals. | |
void | add_lit (const Literal &) |
Add a literal, making sure you don't duplicate. | |
void | drop_literal (LitNum) |
Get rid of the specified Literal. | |
Literal | extract_literal (LitNum) |
Get rid of and return the specified Literal. | |
Literal & | operator[] (size_t) |
Direct read of the specified Literal. | |
Clause | make_copy_with_new_vars (VariableIndex &, TermIndex &) const |
Make a copy of an entire clause, introducing new variables. | |
SimplificationResult | simplify () |
Simplify a clause by dealing with $true, $false, complementary literals, and duplicates. | |
void | random_reorder () |
Randomly re-order the literals. | |
string | to_string (bool=false) const |
Convert to a string. | |
string | to_prolog_string () const |
Convert to a string that can be read by Prolog. | |
string | to_tptp_string () const |
Convert to a string that is compatible with the TPTP. | |
string | make_LaTeX (bool=false) const |
Convert the clause to a LaTeX representation. | |
vector< Literal >::const_iterator | cbegin () const |
vector< Literal >::const_iterator | cend () const |
vector< Literal >::iterator | begin () |
vector< Literal >::iterator | end () |
Private Attributes | |
vector< Literal > | c |
A Clause is just a vector of Literals. | |
Static Private Attributes | |
static std::mt19937 | d |
Randomness for random reordering. | |
Friends | |
ostream & | operator<< (ostream &, const Clause &) |
Representation of clauses.
Essentially straightforward as they are just vectors of Literals. Other classes do all the heavy lifting.
Definition at line 52 of file Clause.hpp.
|
inline |
Definition at line 63 of file Clause.hpp.
|
inline |
Construction is just taking a new vector of Literals.
new_lits | Reference to new vector of Literals. |
Definition at line 69 of file Clause.hpp.
void Clause::add_lit | ( | const Literal & | l | ) |
Add a literal, making sure you don't duplicate.
Yes, yes a set<> would be a good idea, but vectors are easy, nicer if you want indexes amd nicer for the cache.
l | Reference to Literal to add |
Definition at line 87 of file Clause.cpp.
|
inline |
Definition at line 192 of file Clause.hpp.
|
inline |
Definition at line 190 of file Clause.hpp.
|
inline |
Definition at line 191 of file Clause.hpp.
|
inline |
void Clause::drop_literal | ( | LitNum | l | ) |
Get rid of the specified Literal.
l | Index of literal to remove. |
Definition at line 135 of file Clause.cpp.
|
inline |
|
inline |
Definition at line 193 of file Clause.hpp.
Literal Clause::extract_literal | ( | LitNum | l | ) |
Get rid of and return the specified Literal.
l | Index of literal to remove. |
Definition at line 156 of file Clause.cpp.
bool Clause::has_complementary_literals | ( | ) | const |
Check whether the clause contains complementary literals.
This does not take account of substitutions as it is mainly used for simplification before any substitutions happen.
Definition at line 74 of file Clause.cpp.
bool Clause::is_negative | ( | ) | const |
A clause is negative if it has only negated literals.
Definition at line 42 of file Clause.cpp.
bool Clause::is_positive | ( | ) | const |
A clause is positive if it has no negated literals.
Definition at line 30 of file Clause.cpp.
Clause Clause::make_copy_with_new_vars | ( | VariableIndex & | vi, |
TermIndex & | ti ) const |
Make a copy of an entire clause, introducing new variables.
Straightforward because the heavy lifting is done elsewhere.
vi | Reference to the VariableIndex |
ti | Reference to the TermIndex |
Definition at line 98 of file Clause.cpp.
string Clause::make_LaTeX | ( | bool | subbed = false | ) | const |
Convert the clause to a LaTeX representation.
Assumes you are in Math Mode.
subbed | implement substitution if true. |
Definition at line 231 of file Clause.cpp.
Literal & Clause::operator[] | ( | size_t | i | ) |
Direct read of the specified Literal.
There is no check on whether you've given a sensible index, so behave yourself!
i | Index of required Literal |
Definition at line 180 of file Clause.cpp.
void Clause::random_reorder | ( | ) |
Randomly re-order the literals.
Definition at line 188 of file Clause.cpp.
void Clause::remove_duplicates | ( | ) |
Get rid of identical literals.
This does not take account of substitutions as it is mainly used for simplification before any substitutions happen.
Definition at line 54 of file Clause.cpp.
SimplificationResult Clause::simplify | ( | ) |
Simplify a clause by dealing with $true, $false, complementary literals, and duplicates.
Definition at line 110 of file Clause.cpp.
|
inline |
string Clause::to_prolog_string | ( | ) | const |
Convert to a string that can be read by Prolog.
Does not apply substitutions.
Definition at line 206 of file Clause.cpp.
string Clause::to_string | ( | bool | subbed = false | ) | const |
Convert to a string.
subbed | Implement substitutions if true. |
Definition at line 202 of file Clause.cpp.
string Clause::to_tptp_string | ( | ) | const |
Convert to a string that is compatible with the TPTP.
Does not apply substitutions.
Definition at line 217 of file Clause.cpp.
|
friend |
Definition at line 242 of file Clause.cpp.
|
private |
A Clause is just a vector of Literals.
Definition at line 57 of file Clause.hpp.
|
staticprivate |
Randomness for random reordering.
Definition at line 61 of file Clause.hpp.