Connect++ 0.6.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
Predicate.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 PREDICATE_HPP
26#define PREDICATE_HPP
27
28#include<iostream>
29#include<iomanip>
30#include<string>
31#include<vector>
32
33#include "LaTeXUtilities.hpp"
34#include "BasicTypes.hpp"
35#include "Parameters.hpp"
36#include "vic_strings.hpp"
37
38using std::string;
39using std::ostream;
40using std::endl;
41using std::setw;
42
51class Predicate {
52private:
53 ID id;
54 string name;
55 Arity arity;
61 Predicate() : id(0), name(), arity(0) {}
62 Predicate(ID new_id) : id(new_id), name(), arity(0) {}
63 Predicate(ID new_id, const string& new_name)
64 : id(new_id), name(new_name), arity(0) {}
65 Predicate(ID new_id, const string& new_name, Arity new_arity)
66 : id(new_id), name(new_name), arity(new_arity) {}
67public:
68 friend class PredicateIndex;
75 Predicate(const Predicate&) = delete;
76 Predicate(const Predicate&&) = delete;
77 Predicate& operator=(const Predicate&) = delete;
78 Predicate& operator=(const Predicate&&) = delete;
82 inline ID get_ID() const { return id; }
86 inline string get_name() const { return name; }
90 inline Arity get_arity() const { return arity; }
97 bool is_compatible_with(const Predicate&) const;
101 string to_string() const;
107 string make_LaTeX() const;
108
109 friend ostream& operator<<(ostream&, const Predicate&);
110};
111
112#endif
Basic representation of predicates: here just names, ids and arities.
Definition Predicate.hpp:51
Arity get_arity() const
Basic get method.
Definition Predicate.hpp:90
bool is_compatible_with(const Predicate &) const
Do the name and the arity of a pair of Predicates both match?
Definition Predicate.cpp:39
ID get_ID() const
Basic get method.
Definition Predicate.hpp:82
Predicate()
These should only be constructed by PredicateIndex, which is a friend, and the constructors are there...
Definition Predicate.hpp:61
Predicate(const Predicate &)=delete
Don't allow copies of these to be made.
string make_LaTeX() const
Make a useable LaTeX version.
Definition Predicate.cpp:32
friend ostream & operator<<(ostream &, const Predicate &)
Only for debugging.
Definition Predicate.cpp:48
string to_string() const
Converting to a string just gives you the name.
Definition Predicate.cpp:27
string get_name() const
Basic get method.
Definition Predicate.hpp:86
Management of Predicate objects.