Connect++ 0.1
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
TermIndex.hpp
1/*
2
3Copyright © 2023 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 TERMINDEX_HPP
26#define TERMINDEX_HPP
27
28#include <iostream>
29#include <vector>
30#include <unordered_map>
31
32// Not actually needed in the current implementation but
33// it's very much an aim to include it later -- see comments
34// below.
35#include "TermHash.hpp"
36
37using std::unordered_map;
38using std::vector;
39using std::ostream;
40using std::endl;
41
69class TermIndex {
70private:
75 vector<Term*> term_pointers;
81 Term* find(const Term&);
82public:
83 TermIndex() : term_pointers() {}
84 ~TermIndex();
90 TermIndex(const TermIndex&) = delete;
91 TermIndex(const TermIndex&&) = delete;
92 TermIndex& operator=(const TermIndex&) = delete;
93 TermIndex& operator=(const TermIndex&&) = delete;
97 size_t get_size() const { return term_pointers.size(); }
121 Term* add_function_term(Function*, const vector<Term*>&);
150
151 friend ostream& operator<<(ostream&, const TermIndex&);
152};
153
154#endif
Basic representation of functions.
Definition Function.hpp:54
General representation of terms.
Definition Term.hpp:62
Look after terms, using hash consing to avoid storing copies of terms.
Definition TermIndex-hash.hpp:26
size_t get_size() const
Basic get method.
Definition TermIndex.hpp:97
Term * add_function_term(Function *, const vector< Term * > &)
Self-explanatory: add a Term containing a function to the index.
Term * add_variable_term(Variable *)
Self-explanatory: add a Term containing a variable to the index.
Term * replace_variable_in_term_with_term(Term *, Variable *, Term *)
Minor variation on replace_variable_in_term.
Term * replace_variable_in_term(Variable *, Variable *, Term *)
Replace a variable in a term with an alternative, maintaining the structure of the TermIndex.
TermIndex(const TermIndex &)=delete
Don't allow copying as this is a terrible idea.
Basic representation of variables.
Definition Variable.hpp:58