Connect++ 0.1
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
TermIndex-hash.hpp
1//
2// Copyright © 2021-22 Sean Holden. All rights reserved.
3//
4
5#ifndef TERMINDEX_HPP
6#define TERMINDEX_HPP
7
8#include <iostream>
9#include <vector>
10#include <unordered_map>
11
12#include "TermHash.hpp"
13
14using std::unordered_map;
15using std::vector;
16using std::ostream;
17using std::endl;
18
26class TermIndex {
27private:
28 unordered_map<Term, Term*, term_hash> index;
29 vector<Term*> term_pointers;
30public:
31 TermIndex() : index(), term_pointers() {}
32 ~TermIndex();
36 TermIndex(const TermIndex&) = delete;
37 TermIndex(const TermIndex&&) = delete;
38 TermIndex& operator=(const TermIndex&) = delete;
39 TermIndex& operator=(const TermIndex&&) = delete;
40
41 size_t get_size() const { return term_pointers.size(); }
50 Term* add_function_term(Function*, const vector<Term*>&);
69
70 friend ostream& operator<<(ostream&, const TermIndex&);
71};
72
73#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
Term * add_function_term(Function *, const vector< Term * > &)
Self-explanatory: add a Term containing a function to the index.
Definition TermIndex-hash.cpp:28
Term * add_variable_term(Variable *)
Self-explanatory: add a Term containing a variable to the index.
Definition TermIndex-hash.cpp:13
Term * replace_variable_in_term_with_term(Term *, Variable *, Term *)
Minor variation on replace_variable_in_term.
Definition TermIndex-hash.cpp:67
Term * replace_variable_in_term(Variable *, Variable *, Term *)
Replace a variable in a term with an alternative, maintaining the structure of the TermIndex.
Definition TermIndex-hash.cpp:46
TermIndex(const TermIndex &)=delete
Don't allow copying as this is a terrible idea.
Basic representation of variables.
Definition Variable.hpp:58