Connect++ 0.1
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. | |
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 | 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 () |
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.
|
inline |
Construction is just taking a new vector of Literals.
new_lits | Reference to new vector of Literals. |
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 |
void Clause::drop_literal | ( | LitNum | l | ) |
Get rid of the specified Literal.
l | Index of literal to remove. |
Literal Clause::extract_literal | ( | LitNum | l | ) |
Get rid of and return the specified Literal.
l | Index of literal to remove. |
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.
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 |
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. |
Literal & Clause::operator[] | ( | size_t | i | ) |
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.
string Clause::to_prolog_string | ( | ) | const |
Convert to a string that can be read by Prolog.
Does not apply substitutions.
string Clause::to_string | ( | bool | subbed = false | ) | const |
Convert to a string.
subbed | Implement substitutions if true. |