25#include "StackItem.hpp"
28ostream& operator<<(ostream& out,
const StackItemType& si) {
30 case StackItemType::Start:
33 case StackItemType::Axiom:
36 case StackItemType::Reduction:
39 case StackItemType::LeftBranch:
42 case StackItemType::RightBranch:
43 out <<
"Right Branch";
80 UnificationOutcome outcome = UnificationOutcome::ConflictFail;
81 while (outcome != UnificationOutcome::Succeed &&
88 if (outcome == UnificationOutcome::Succeed) {
128 UnificationOutcome outcome = UnificationOutcome::ConflictFail;
129 while (outcome != UnificationOutcome::Succeed &&
133 if (outcome == UnificationOutcome::Succeed) {
208 result +=
"Stack item: ";
210 case StackItemType::Start:
213 case StackItemType::Axiom:
216 case StackItemType::Reduction:
217 result +=
"Reduction";
219 case StackItemType::LeftBranch:
220 result +=
"Left Branch";
222 case StackItemType::RightBranch:
223 result +=
"Right Branch";
229 result += to_string(
actions.size()) +=
" options\n";
239 result += std::to_string(
depth);
243ostream& operator<<(ostream& out,
const StackItem& si) {
Literal get_literal(LitNum) const
Get and return the specified Literal.
string to_string(bool=false) const
Convert to a string.
string to_string(bool=false) const
Convert to a string.
Basic representation of literals, bundling together (pointers to) a Predicate, a collection of argume...
bool is_compatible_with(const Literal *) const
Literals can only be unified if the polarity and actual predicate are the same.
size_t get_pred_as_index() const
Turn a Literal into an array index.
void invert()
Basic manipulation - entirely self-explanatory.
Representation of the Matrix within a proof.
const Literal & inspect_index_literal(size_t i, size_t j)
Straightforward get method.
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.
string to_string(bool=false) const
Convert the path to a string.
uint32_t length() const
Straightforward get method.
const Literal & examine_literal(size_t i) const
Access individual literals.
string to_string(bool=false) const
Make a string representation.
Wrap up various applications of unificiation into a single class: all the unification you need to do ...
void backtrack()
Apply the backtracking process to the substitution that has been constructed.
Substitution get_substitution() const
Trivial get methods for the result.
Full representation of inferences, beyond just the name.
Stack items: each contains its own material for generating possible next inferences.
size_t reduction_current_path_index
Which possible reduction will we consider next?
size_t extension_current_index_entry
Which possible extension will we consider next?
void add_all_reductions_to_actions(Unifier &)
You may really want to generate all the reductions at once.
bool extension_no_more_results
Make it easy to know when there are no more possibilities.
InferenceItem get_next_inference(Matrix &, Unifier &)
Get the next inference to try.
void restrict_backtrack()
Adjust the collection of actions to limit backtracking.
SimplePath p
Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the path.
size_t extension_index_entry_size
Size of matrix index entry.
void all_extensions(vector< InferenceItem > &, Matrix &, Unifier &)
Generate all possible extensions in one go, should you need to.
InferenceItem extension_next_result
We always want to know the next available result, and especially need to try to find it so that we ac...
vector< InferenceItem > actions
Actions available to try.
string to_string_unsubbed() const
Make a string representation.
Literal reduction_neg_lit
Negation of literal of interest.
size_t extension_i
Index computed for neg_lit telling us where to find the information we need in the matrix index.
Literal reduction_lit
Literal of interest.
bool extension_backtrack_restricted
Setting this to true stops any further possibilities from being generated.
Substitution sub
Some nodes in the proof tree have an associated substitution.
uint32_t depth
How deep in the proof tree are we?
InferenceItem next_extension(Matrix &, Unifier &)
Find the next possible extension or indicate there is none. The state of the object keeps track of wh...
bool reduction_no_more_results
Make it easy to know when there are no more possibilities.
void extension_restrict_backtrack()
Indicate that we don't want any further possibilities.
Literal extension_lit
Literal of interest.
bool no_more_inferences()
Is there anything left to do?
void add_all_extensions_to_actions(Matrix &, Unifier &)
You may really want to generate all the extensions at once.
InferenceItem reduction_next_result
We always want to know the next available result, and especially need to try to find it so that we ac...
void initialize(Matrix &, Unifier &)
Call this after the constructor but before you want to use the enumeration of possible actions.
bool reduction_is_empty() const
Have we exhaused all possible reductions?
bool extension_is_empty() const
Have we exhaused all possible extensions?
void extension_initialize(Matrix &, Unifier &)
Make sure you do this!
bool reduction_backtrack_restricted
Setting this to true stops any further possibilities from being generated.
LitNum reduction_ind
Index of literal of interest.
void reduction_initialize(Unifier &)
Make sure you do this!
void extension_move_to_next_result(Matrix &, Unifier &)
Before you do anything else, set up the first result.
Literal extension_neg_lit
Negation of literal of interest.
Lemmata l
Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the lemmata.
InferenceItem next_reduction(Unifier &)
Find the next possible reduction or indicate there is none. The state of the object keeps track of wh...
Clause c
Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the clause.
void reduction_move_to_next_result(Unifier &)
Before you do anything else, set up the first result.
StackItemType item_type
What type of StackItem is this?
LitNum extension_ind
Index of literal of interest.
void all_reductions(vector< InferenceItem > &, Unifier &)
Generate all possible reductions in one go, should you need to.
void reduction_restrict_backtrack()
Indicate that we don't want any further possibilities.
void stack_item_setup()
Basic setup collected in a method to avoid repeating it in the various constructors.
size_t path_length
Length of current path.