![]() |
Connect++ 0.6.0
A fast, readable connection prover for first-order logic.
|
As you build a proof you make substitutions that apply to the entire proof: if you backtrack during the search you need to remove the relevant substitutions. More...
#include <SubstitutionStack.hpp>
Public Member Functions | |
SubstitutionStack () | |
If you need a different initialization, you're probably doing something wrong. | |
SubstitutionStack (const SubstitutionStack &)=delete | |
As usual, you really don't want to be messing with this kind of thing, so let the compiler find your errors. | |
SubstitutionStack & | operator= (const SubstitutionStack &)=delete |
void | push_all (Substitution &) |
Take all the substitutions provided and add the corresponding variables to the stack. | |
void | backtrack () |
Remove variables from the stack, and remove substitutions as you go, as far back as the most recent backtrack point. | |
void | clear () |
Reset everything. | |
Private Attributes | |
vector< Variable * > | stack |
Stack of pointers to Variables that have been substituted. | |
vector< size_t > | backtrack_points |
Indexes on the stack that can be backtracked to. | |
size_t | next_index |
Self-explanatory. | |
Friends | |
ostream & | operator<< (ostream &, const SubstitutionStack &) |
As you build a proof you make substitutions that apply to the entire proof: if you backtrack during the search you need to remove the relevant substitutions.
This class implements a stack that takes a Substitution applying possibly to multiple variables, and applies it while keeping track of backtracking information so that backtracking while removing substitutions is a single method call.
Definition at line 42 of file SubstitutionStack.hpp.
|
inline |
If you need a different initialization, you're probably doing something wrong.
Definition at line 65 of file SubstitutionStack.hpp.
void SubstitutionStack::backtrack | ( | ) |
Remove variables from the stack, and remove substitutions as you go, as far back as the most recent backtrack point.
Definition at line 36 of file SubstitutionStack.cpp.
|
inline |
void SubstitutionStack::push_all | ( | Substitution & | sub | ) |
Take all the substitutions provided and add the corresponding variables to the stack.
Also save the starting point as a backtrack point.
sub | Reference to Substitution that has been applied. |
Definition at line 28 of file SubstitutionStack.cpp.
|
friend |
Definition at line 46 of file SubstitutionStack.cpp.
|
private |
Indexes on the stack that can be backtracked to.
When you backtrack you undo every substitution back to the most recent index.
Definition at line 55 of file SubstitutionStack.hpp.
|
private |
Self-explanatory.
Definition at line 59 of file SubstitutionStack.hpp.
|
private |
Stack of pointers to Variables that have been substituted.
Definition at line 48 of file SubstitutionStack.hpp.