Connect++ 0.6.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
Predicate Class Reference

Basic representation of predicates: here just names, ids and arities. More...

#include <Predicate.hpp>

Collaboration diagram for Predicate:

Public Member Functions

 Predicate (const Predicate &)=delete
 Don't allow copies of these to be made.
 
 Predicate (const Predicate &&)=delete
 
Predicateoperator= (const Predicate &)=delete
 
Predicateoperator= (const Predicate &&)=delete
 
ID get_ID () const
 Basic get method.
 
string get_name () const
 Basic get method.
 
Arity get_arity () const
 Basic get method.
 
bool is_compatible_with (const Predicate &) const
 Do the name and the arity of a pair of Predicates both match?
 
string to_string () const
 Converting to a string just gives you the name.
 
string make_LaTeX () const
 Make a useable LaTeX version.
 

Private Member Functions

 Predicate ()
 These should only be constructed by PredicateIndex, which is a friend, and the constructors are therefore private.
 
 Predicate (ID new_id)
 
 Predicate (ID new_id, const string &new_name)
 
 Predicate (ID new_id, const string &new_name, Arity new_arity)
 

Private Attributes

ID id
 
string name
 
Arity arity
 

Friends

class PredicateIndex
 
ostream & operator<< (ostream &, const Predicate &)
 Only for debugging.
 

Detailed Description

Basic representation of predicates: here just names, ids and arities.

This really just acts as identification. See the Literal class, which is where Predicate and Term get connected together. (No pun intended.)

Definition at line 51 of file Predicate.hpp.

Constructor & Destructor Documentation

◆ Predicate() [1/5]

Predicate::Predicate ( )
inlineprivate

These should only be constructed by PredicateIndex, which is a friend, and the constructors are therefore private.

Definition at line 61 of file Predicate.hpp.

61: id(0), name(), arity(0) {}

◆ Predicate() [2/5]

Predicate::Predicate ( ID new_id)
inlineprivate

Definition at line 62 of file Predicate.hpp.

62: id(new_id), name(), arity(0) {}

◆ Predicate() [3/5]

Predicate::Predicate ( ID new_id,
const string & new_name )
inlineprivate

Definition at line 63 of file Predicate.hpp.

64 : id(new_id), name(new_name), arity(0) {}

◆ Predicate() [4/5]

Predicate::Predicate ( ID new_id,
const string & new_name,
Arity new_arity )
inlineprivate

Definition at line 65 of file Predicate.hpp.

66 : id(new_id), name(new_name), arity(new_arity) {}

◆ Predicate() [5/5]

Predicate::Predicate ( const Predicate & )
delete

Don't allow copies of these to be made.

As usual, let the compiler find any errors because you should never need to make copies this way.

Member Function Documentation

◆ get_arity()

Arity Predicate::get_arity ( ) const
inline

Basic get method.

Definition at line 90 of file Predicate.hpp.

90{ return arity; }

◆ get_ID()

ID Predicate::get_ID ( ) const
inline

Basic get method.

Definition at line 82 of file Predicate.hpp.

82{ return id; }

◆ get_name()

string Predicate::get_name ( ) const
inline

Basic get method.

Definition at line 86 of file Predicate.hpp.

86{ return name; }

◆ is_compatible_with()

bool Predicate::is_compatible_with ( const Predicate & p2) const

Do the name and the arity of a pair of Predicates both match?

Parameters
p2Predicate to compare with

Definition at line 39 of file Predicate.cpp.

39 {
40 return (name == p2.name) && (arity == p2.arity);
41}

◆ make_LaTeX()

string Predicate::make_LaTeX ( ) const

Make a useable LaTeX version.

Assumes you are typesetting in Math Mode.

Definition at line 32 of file Predicate.cpp.

32 {
33 string s ("\\text{");
34 s += latex_escape_characters(name);
35 s += "}";
36 return s;
37}

◆ to_string()

string Predicate::to_string ( ) const

Converting to a string just gives you the name.

Definition at line 27 of file Predicate.cpp.

27 {
28 colour_string::ColourString cs(params::use_colours);
29 return cs(name).purple();
30}
Simple addition of colour to strings and ostreams.

Friends And Related Symbol Documentation

◆ operator<<

ostream & operator<< ( ostream & out,
const Predicate & p )
friend

Only for debugging.

Use Predicate::to_string if you want something pretty.

Definition at line 48 of file Predicate.cpp.

48 {
49 out << "Predicate: " << setw(params::output_width) << p.id
50 << " Name: " << setw(params::output_width + 15) << p.name
51 << " Arity: " << setw(params::output_width) << p.arity;
52 return out;
53}

◆ PredicateIndex

friend class PredicateIndex
friend

Definition at line 68 of file Predicate.hpp.

Member Data Documentation

◆ arity

Arity Predicate::arity
private

Definition at line 55 of file Predicate.hpp.

◆ id

ID Predicate::id
private

Definition at line 53 of file Predicate.hpp.

◆ name

string Predicate::name
private

Definition at line 54 of file Predicate.hpp.


The documentation for this class was generated from the following files: