Connect++ 0.7.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
convert_fof_atomic_formula Struct Reference

More complex semantic actions, now functions etc to make a literal. More...

#include <TPTPParser.hpp>

Inheritance diagram for convert_fof_atomic_formula:
Collaboration diagram for convert_fof_atomic_formula:

Public Member Functions

Literal operator() (const fof_plain_term_struct &) const
 
Literal operator() (const infix_struct &) const
 

Detailed Description

More complex semantic actions, now functions etc to make a literal.

This is complicated by the need to be very careful to distinguish predicates from functions. So we have one function to deal with fof_plain_term the first time it's seen, to get a predicate. Then a different one to get the functions.

Definition at line 534 of file TPTPParser.hpp.

Member Function Documentation

◆ operator()() [1/2]

Literal convert_fof_atomic_formula::operator() ( const fof_plain_term_struct & f) const

Definition at line 1123 of file TPTPParser.cpp.

1124 {
1125 Literal result;
1126 size_t arity = f.args.size();
1127 Predicate* new_P =
1128 p_index_p->add_predicate(f.functor, arity);
1129 vector<Term*> args;
1130 for (size_t i = 0; i < arity; i++) {
1131 Term* new_t =
1132 boost::apply_visitor(convert_fof_arguments_struct(),
1133 f.args[i]);
1134 args.push_back(new_t);
1135 }
1136 // neg_lit is set by a semantic action.
1137 return Literal(new_P, args, arity, !neg_lit);
1138 }
Basic representation of literals, bundling together (pointers to) a Predicate, a collection of argume...
Definition Literal.hpp:50
Basic representation of predicates: here just names, ids and arities.
Definition Predicate.hpp:51
Predicate * add_predicate(const string &, Arity)
Self-explanatory.
General representation of terms.
Definition Term.hpp:62
More complex semantic actions, now functions etc to make a literal.

◆ operator()() [2/2]

Literal convert_fof_atomic_formula::operator() ( const infix_struct & f) const

Definition at line 1140 of file TPTPParser.cpp.

1141 {
1142 size_t arity = 2;
1143 if (!equals_added) {
1144 equals_added = true;
1145 equals_p = p_index_p->add_predicate("=", arity);
1146 }
1147 bool polarity = true;
1148 if (f.connective == "!=")
1149 polarity = false;
1150 vector<Term*> args;
1151 Term* new_t =
1152 boost::apply_visitor(convert_fof_arguments_struct(),
1153 f.left);
1154 args.push_back(new_t);
1155 new_t =
1156 boost::apply_visitor(convert_fof_arguments_struct(),
1157 f.right);
1158 args.push_back(new_t);
1159 return Literal(equals_p, args, arity, polarity);
1160 }

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