Connect++ 0.6.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
SimplePath.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 SIMPLEPATH_HPP
26#define SIMPLEPATH_HPP
27
28#include<iostream>
29#include<vector>
30
31#include "InferenceItem.hpp"
32#include "Unifier.hpp"
33#include "Clause.hpp"
34
35using std::vector;
36using std::ostream;
37using std::endl;
38using std::cout;
39
56private:
60 vector<Literal> path;
61 uint32_t num_preds;
62 uint32_t len;
76 void find_reductions(Unifier&, vector<InferenceItem>&, const Literal&,
77 LitNum);
78public:
83 SimplePath() : path(), num_preds(0), len(0) {}
90 SimplePath(uint32_t);
94 inline uint32_t length() const { return len; }
98 void clear();
102 inline void set_num_preds(size_t num_predicates) { num_preds = num_predicates; }
108 void push(const Literal&);
112 Literal back() const;
116 void pop();
120 inline const Literal& examine_literal(size_t i) const { return path[i]; }
129 bool test_for_regularity(Clause&) const;
142 void find_limited_reductions(Unifier&, vector<InferenceItem>&,
143 Clause&);
155 void find_all_reductions(Unifier&, vector<InferenceItem>&,
156 Clause&);
168 void show_path_only(ostream&);
174 string to_string(bool = false) const;
180 string make_LaTeX(bool = false) const;
184 vector<Literal>::const_iterator cbegin() const { return path.cbegin(); }
185 vector<Literal>::const_iterator cend() const { return path.cend(); }
186 vector<Literal>::iterator begin() { return path.begin(); }
187 vector<Literal>::iterator end() { return path.end(); }
188
189 friend ostream& operator<<(ostream&, const SimplePath&);
190};
191
192#endif
Representation of clauses.
Definition Clause.hpp:52
Basic representation of literals, bundling together (pointers to) a Predicate, a collection of argume...
Definition Literal.hpp:50
Simple representation of the path within a proof tree.
vector< Literal > path
Simple representation of a path as a vector of Literals.
string to_string(bool=false) const
Convert the path to a string.
vector< Literal >::const_iterator cbegin() const
Iterators just traverse the path vector.
uint32_t length() const
Straightforward get method.
void push(const Literal &)
Add a new Literal to the Path.
void show_path_only(ostream &)
Show just the path.
string make_LaTeX(bool=false) const
Convert the Path only to a LaTeX representation.
void set_num_preds(size_t num_predicates)
Set method for num_predicates.
bool test_for_regularity(Clause &) const
Regularity test.
void find_limited_reductions(Unifier &, vector< InferenceItem > &, Clause &)
Given a Clause, find all possible reductions given the current Path, but only for the first Literal i...
void clear()
Revert to the empty state without changing num_preds.
SimplePath()
You should usually never need a more compilcated constructor.
void pop()
Remove the last item from the Path.
const Literal & examine_literal(size_t i) const
Access individual literals.
void find_reductions(Unifier &, vector< InferenceItem > &, const Literal &, LitNum)
Find the reductions that you can perform for a specified Literal.
Literal back() const
Get the last Literal in the Path. Non-destructive.
void find_all_reductions(Unifier &, vector< InferenceItem > &, Clause &)
Given a Clause, find all possible reductions given the current Path.
Wrap up various applications of unificiation into a single class: all the unification you need to do ...
Definition Unifier.hpp:89