Connect++ 0.5.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:
82 SimplePath() : path(), num_preds(0), len(0) {}
89 SimplePath(uint32_t);
93 inline uint32_t length() const { return len; }
97 void clear();
101 inline void set_num_preds(size_t num_predicates) { num_preds = num_predicates; }
107 void push(const Literal&);
111 Literal back() const;
115 void pop();
124 bool test_for_regularity(Clause&) const;
137 void find_limited_reductions(Unifier&, vector<InferenceItem>&,
138 Clause&);
150 void find_all_reductions(Unifier&, vector<InferenceItem>&,
151 Clause&);
163 void show_path_only(ostream&);
169 string to_string(bool = false) const;
175 string make_LaTeX(bool = false) const;
179 vector<Literal>::const_iterator cbegin() const { return path.cbegin(); }
180 vector<Literal>::const_iterator cend() const { return path.cend(); }
181 vector<Literal>::iterator begin() { return path.begin(); }
182 vector<Literal>::iterator end() { return path.end(); }
183
184 friend ostream& operator<<(ostream&, const SimplePath&);
185};
186
187#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()
evert 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.
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:83