38#include "InferenceItem.hpp"
40#include "ClauseComparisons.hpp"
51using std::filesystem::path;
59using MatrixPairType = pair<ClauseNum, LitNum>;
65using LiteralClausePairType = pair<Literal,Clause>;
128 vector<vector<MatrixPairType>>
index;
137 static std::mt19937
d;
161 template<
class Comparison>
166 vector<ClauseAndRole> cr;
168 for (
size_t i = 0; i < s; i++) {
174 std::sort(cr.begin(), cr.end(), comparison);
182 size_t s2 =
index.size();
184 index = vector<vector<MatrixPairType> >(s2, vector<MatrixPairType>());
185 for (
size_t i = 0; i < s; i++) {
230 return index[_i].size();
236 return (
index[_i])[_j];
349 vector<Clause>::const_iterator cbegin()
const {
return clauses.cbegin(); }
350 vector<Clause>::const_iterator cend()
const {
return clauses.cend(); }
351 vector<Clause>::iterator begin() {
return clauses.begin(); }
352 vector<Clause>::iterator end() {
return clauses.end(); }
387 sort_clauses<ClauseLengthCompare>(comparison);
399 friend ostream& operator<<(ostream&,
const Matrix&);
Representation of clauses.
Basic representation of literals, bundling together (pointers to) a Predicate, a collection of argume...
Representation of the Matrix within a proof.
string to_string() const
Make a string representation.
void rebuild_index(vector< Clause > &, vector< string > &)
Rebuild the index after, for example, reordering.
void sort_clauses_by_increasing_size()
Self-explanatory.
vector< Clause > clauses
The Matrix itself is just a set of Clauses.
void deterministic_reorder(size_t)
Deterministic reorder of the clauses.
void move_equals_to_start()
Self-explanatory.
const Literal & inspect_index_literal(size_t i, size_t j)
Straightforward get method.
ClauseNum get_num_clauses() const
Straightforward get method.
string make_LaTeX(bool=false) const
Make a usable LaTeX representation.
vector< string > clause_roles
Keep track of which clauses are conjectures etc.
void make_clauses_copy()
Store a copy of the clauses.
Matrix()
Use this constructor if you really want an empty Matrix.
void get_literal_clause_pair(LitNum, size_t, Literal &, Clause &) const
Get a literal and clause from the index.
uint32_t num_equals
You need to know how many equality axioms there are in case you want to move them around.
vector< vector< MatrixPairType > > index
We want to be able to quickly identify where in each clause a particular literal lives.
void add_clause(Clause &, string="")
Add a Clause to the Matrix and update the index accordingly.
bool is_negative(size_t i) const
Is a particular Clause negative?
bool copy_saved
Remember whether you've saved a copy.
static std::mt19937 d
Randomness for random reordering.
bool is_conjecture(size_t i) const
Is a particular Clause a conjecture?
vector< string > roles_copy
It makes sense to keep a copy of the roles if your schedule reorders multiple times.
void write_to_prolog_file(const path &) const
Write to a file that can be read by Prolog.
void random_reorder_literals()
Randomly reorder the literals in each clause in the matrix.
void set_num_equals(uint32_t n)
Straightforward set method.
const Clause & operator[](size_t i) const
Straightforward get method.
Matrix(const Matrix &)=delete
You're never going to need to copy a Matrix.
bool is_positive(size_t i) const
Is a particular Clause positive?
MatrixPairType get_index_entry(size_t _i, size_t _j) const
The ExtensionEnumerator needs to know this.
size_t get_index_entry_size(size_t _i) const
The ExtensionEnumerator needs to know this.
void show_tptp() const
Output in TPTP compatible format.
const Literal & inspect_literal(size_t i, size_t j)
Straightforward get method.
vector< Clause > clauses_copy
It makes sense to keep a copy of the clauses if your schedule reorders multiple times.
void sort_clauses(Comparison comparison)
Template method for general sorting of clauses, which sorts roles at the same time.
void set_num_preds(size_t)
Make an empty index.
vector< vector< LiteralClausePairType > > literal_clause_index
This corresponds closely to index, but has the actual Literal, and the Clause after the Literal's rem...
pair< bool, size_t > find_start() const
Use a simple heuristic to find a good start clause.
void random_reorder()
Randomly reorder the matrix.
vector< bool > negative_clauses
Keep track of which clauses are negative.
vector< bool > ground_clauses
We need to know this to control backtracking.
vector< bool > positive_clauses
Keep track of which clauses are positive.
bool is_ground(size_t i) const
Is a particular Clause ground?
Provide a function object to compare clauses by size.