Connect++ 0.4.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
SubstitutionStack.hpp
1/*
2
3Copyright © 2023-24 Sean Holden. All rights reserved.
4
5*/
6/*
7
8This file is part of Connect++.
9
10Connect++ is free software: you can redistribute it and/or modify it
11under the terms of the GNU General Public License as published by the
12Free Software Foundation, either version 3 of the License, or (at your
13option) any later version.
14
15Connect++ is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18more details.
19
20You should have received a copy of the GNU General Public License along
21with Connect++. If not, see <https://www.gnu.org/licenses/>.
22
23*/
24
25#ifndef SUBSTITUTIONSTACK_HPP
26#define SUBSTITUTIONSTACK_HPP
27
28#include<iostream>
29
30#include "Substitution.hpp"
31
43private:
48 vector<Variable*> stack;
55 vector<size_t> backtrack_points;
59 size_t next_index;
60public:
72 SubstitutionStack& operator=(const SubstitutionStack&) = delete;
87 void backtrack();
91 void clear() { stack.clear(); backtrack_points.clear(); next_index = 0; }
92
93 friend ostream& operator<<(ostream&, const SubstitutionStack&);
94};
95
96#endif
General representation of a substitution.
As you build a proof you make substitutions that apply to the entire proof: if you backtrack during t...
void backtrack()
Remove variables from the stack, and remove substitutions as you go, as far back as the most recent b...
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 ...
void clear()
Reset everything.
void push_all(Substitution &)
Take all the substitutions provided and add the corresponding variables to the stack.
vector< size_t > backtrack_points
Indexes on the stack that can be backtracked to.
SubstitutionStack()
If you need a different initialization, you're probably doing something wrong.
vector< Variable * > stack
Stack of pointers to Variables that have been substituted.
size_t next_index
Self-explanatory.