Connect++ 0.5.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
StackItem Struct Reference

Stack items: each contains its own stack of possible next inferences. More...

#include <StackItem.hpp>

Collaboration diagram for StackItem:

Public Member Functions

 StackItem (StackItemType sit)
 
 StackItem (StackItemType sit, const Clause &_c, const SimplePath &_p)
 
 StackItem (StackItemType sit, const Clause &_c, const SimplePath &_p, const Lemmata &_l)
 
 StackItem (StackItemType sit, const Clause &_c, const SimplePath &_p, uint32_t _d)
 
 StackItem (StackItemType sit, const Clause &_c, const SimplePath &_p, const Lemmata &_l, uint32_t _d)
 
 StackItem (StackItemType sit, const Clause &_c, const SimplePath &_p, const Substitution &_sub, uint32_t _d)
 
 StackItem (StackItemType sit, const Clause &_c, const SimplePath &_p, const Lemmata &_l, const Substitution &_sub, uint32_t _d)
 
void restrict_backtrack ()
 Adjust the collection of actions to limit backtracking.
 
string to_string_unsubbed () const
 Make a string representation.
 
void clear ()
 Delete all the remaining possible actions.
 
void set_this_action (const InferenceItem &inf_i)
 Basic set method.
 
void set_bt_restriction_index (size_t i)
 Basic set method.
 

Public Attributes

StackItemType item_type
 What type of StackItem is this?
 
Clause c
 Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the clause.
 
SimplePath p
 Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the path.
 
Lemmata l
 Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the lemmata.
 
Substitution sub
 Some nodes in the proof tree have an associated substitution.
 
vector< InferenceItemactions
 Actions available to try.
 
uint32_t depth
 How deep in the proof tree are we?
 
InferenceItem this_action
 Action that got you to this clause, path etc.
 
size_t bt_restriction_index
 Pointer that allows a right branch to know where to delete alternatives for restricted backtracking.
 

Detailed Description

Stack items: each contains its own stack of possible next inferences.

Definition at line 51 of file StackItem.hpp.

Constructor & Destructor Documentation

◆ StackItem() [1/7]

StackItem::StackItem ( StackItemType sit)
inline

Definition at line 107 of file StackItem.hpp.

108 : item_type(sit)
109 , c()
110 , p()
111 , l()
112 , sub()
113 , actions()
114 , depth(0)
115 , this_action()
117 {};
SimplePath p
Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the path.
Definition StackItem.hpp:65
vector< InferenceItem > actions
Actions available to try.
Definition StackItem.hpp:84
Substitution sub
Some nodes in the proof tree have an associated substitution.
Definition StackItem.hpp:75
uint32_t depth
How deep in the proof tree are we?
Definition StackItem.hpp:88
size_t bt_restriction_index
Pointer that allows a right branch to know where to delete alternatives for restricted backtracking.
InferenceItem this_action
Action that got you to this clause, path etc.
Definition StackItem.hpp:92
Lemmata l
Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the lemmata.
Definition StackItem.hpp:70
Clause c
Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the clause.
Definition StackItem.hpp:60
StackItemType item_type
What type of StackItem is this?
Definition StackItem.hpp:55

◆ StackItem() [2/7]

StackItem::StackItem ( StackItemType sit,
const Clause & _c,
const SimplePath & _p )
inline

Definition at line 118 of file StackItem.hpp.

119 : item_type(sit)
120 , c(_c)
121 , p(_p)
122 , l()
123 , sub()
124 , actions()
125 , depth(0)
126 , this_action()
128 {};

◆ StackItem() [3/7]

StackItem::StackItem ( StackItemType sit,
const Clause & _c,
const SimplePath & _p,
const Lemmata & _l )
inline

Definition at line 129 of file StackItem.hpp.

130 : item_type(sit)
131 , c(_c)
132 , p(_p)
133 , l(_l)
134 , sub()
135 , actions()
136 , depth(0)
137 , this_action()
139 {};

◆ StackItem() [4/7]

StackItem::StackItem ( StackItemType sit,
const Clause & _c,
const SimplePath & _p,
uint32_t _d )
inline

Definition at line 140 of file StackItem.hpp.

141 : item_type(sit)
142 , c(_c)
143 , p(_p)
144 , l()
145 , sub()
146 , actions()
147 , depth(_d)
148 , this_action()
150 {};

◆ StackItem() [5/7]

StackItem::StackItem ( StackItemType sit,
const Clause & _c,
const SimplePath & _p,
const Lemmata & _l,
uint32_t _d )
inline

Definition at line 151 of file StackItem.hpp.

156 : item_type(sit)
157 , c(_c)
158 , p(_p)
159 , l(_l)
160 , sub()
161 , actions()
162 , depth(_d)
163 , this_action()
165 {};

◆ StackItem() [6/7]

StackItem::StackItem ( StackItemType sit,
const Clause & _c,
const SimplePath & _p,
const Substitution & _sub,
uint32_t _d )
inline

Definition at line 166 of file StackItem.hpp.

168 : item_type(sit)
169 , c(_c)
170 , p(_p)
171 , l()
172 , sub(_sub)
173 , actions()
174 , depth(_d)
175 , this_action()
177 {};

◆ StackItem() [7/7]

StackItem::StackItem ( StackItemType sit,
const Clause & _c,
const SimplePath & _p,
const Lemmata & _l,
const Substitution & _sub,
uint32_t _d )
inline

Definition at line 178 of file StackItem.hpp.

180 : item_type(sit)
181 , c(_c)
182 , p(_p)
183 , l(_l)
184 , sub(_sub)
185 , actions()
186 , depth(_d)
187 , this_action()
189 {};

Member Function Documentation

◆ clear()

void StackItem::clear ( )
inline

Delete all the remaining possible actions.

Possibly the most aggressive backtracking restriction heuristic available.

Definition at line 208 of file StackItem.hpp.

208{ actions.clear(); }

◆ restrict_backtrack()

void StackItem::restrict_backtrack ( )

Adjust the collection of actions to limit backtracking.

Of course, you might want to modify how this works if you want to do something more sophisticated. At present you have the leanCop style.

Definition at line 51 of file StackItem.cpp.

51 {
52 /*
53 * Implement the leanCop style restriction on backtracking.
54 */
55 actions.clear();
56}

◆ set_bt_restriction_index()

void StackItem::set_bt_restriction_index ( size_t i)
inline

Basic set method.

Definition at line 218 of file StackItem.hpp.

218 {
220 }

◆ set_this_action()

void StackItem::set_this_action ( const InferenceItem & inf_i)
inline

Basic set method.

Definition at line 212 of file StackItem.hpp.

212 {
213 this_action = inf_i;
214 }

◆ to_string_unsubbed()

string StackItem::to_string_unsubbed ( ) const

Make a string representation.

Definition at line 58 of file StackItem.cpp.

58 {
59 string result;
60 result += "Stack item: ";
61 switch (item_type) {
62 case StackItemType::Start:
63 result += "Start";
64 break;
65 case StackItemType::Axiom:
66 result += "Axiom";
67 break;
68 case StackItemType::Reduction:
69 result += "Reduction";
70 break;
71 case StackItemType::LeftBranch:
72 result += "Left Branch";
73 break;
74 case StackItemType::RightBranch:
75 result += "Right Branch";
76 break;
77 default:
78 break;
79 }
80 result += " with ";
81 result += to_string(actions.size()) += " options\n";
82 result += "C = ";
83 result += c.to_string() += "\n";
84 result += "P = ";
85 result += p.to_string() += "\n";
86 result += "L = ";
87 result += l.to_string() += "\n";
88 result += "Sub = ";
89 result += sub.to_string() += "\n";
90 result += "Depth: ";
91 result += std::to_string(depth);
92 return result;
93}
string to_string(bool=false) const
Convert to a string.
Definition Clause.cpp:202
string to_string(bool=false) const
Convert to a string.
Definition Lemmata.cpp:82
string to_string(bool=false) const
Convert the path to a string.
string to_string(bool=false) const
Make a string representation.

Member Data Documentation

◆ actions

vector<InferenceItem> StackItem::actions

Actions available to try.

These are all the actions that can be used to extend the proof further from this point onward. They are tried in order. Reordering here is an obvious approach to making a heuristic, and deletion corresponds to restriction of backtracking.

Definition at line 84 of file StackItem.hpp.

◆ bt_restriction_index

size_t StackItem::bt_restriction_index

Pointer that allows a right branch to know where to delete alternatives for restricted backtracking.

DO NOT try to do this by storing a pointer to the StackItem. As the vector can have its storage reallocated in the background, you end up with all manner of segfaultyness.

Definition at line 101 of file StackItem.hpp.

◆ c

Clause StackItem::c

Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the clause.

Definition at line 60 of file StackItem.hpp.

◆ depth

uint32_t StackItem::depth

How deep in the proof tree are we?

Definition at line 88 of file StackItem.hpp.

◆ item_type

StackItemType StackItem::item_type

What type of StackItem is this?

Definition at line 55 of file StackItem.hpp.

◆ l

Lemmata StackItem::l

Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the lemmata.

Definition at line 70 of file StackItem.hpp.

◆ p

SimplePath StackItem::p

Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the path.

Definition at line 65 of file StackItem.hpp.

◆ sub

Substitution StackItem::sub

Some nodes in the proof tree have an associated substitution.

Definition at line 75 of file StackItem.hpp.

◆ this_action

InferenceItem StackItem::this_action

Action that got you to this clause, path etc.

Definition at line 92 of file StackItem.hpp.


The documentation for this struct was generated from the following files: