Connect++ 0.4.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 531 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 1113 of file TPTPParser.cpp.

1114 {
1115 Literal result;
1116 size_t arity = f.args.size();
1117 Predicate* new_P =
1118 p_index_p->add_predicate(f.functor, arity);
1119 vector<Term*> args;
1120 for (size_t i = 0; i < arity; i++) {
1121 Term* new_t =
1122 boost::apply_visitor(convert_fof_arguments_struct(),
1123 f.args[i]);
1124 args.push_back(new_t);
1125 }
1126 // neg_lit is set by a semantic action.
1127 return Literal(new_P, args, arity, !neg_lit);
1128 }
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 1130 of file TPTPParser.cpp.

1131 {
1132 size_t arity = 2;
1133 if (!equals_added) {
1134 equals_added = true;
1135 equals_p = p_index_p->add_predicate("=", arity);
1136 }
1137 bool polarity = true;
1138 if (f.connective == "!=")
1139 polarity = false;
1140 vector<Term*> args;
1141 Term* new_t =
1142 boost::apply_visitor(convert_fof_arguments_struct(),
1143 f.left);
1144 args.push_back(new_t);
1145 new_t =
1146 boost::apply_visitor(convert_fof_arguments_struct(),
1147 f.right);
1148 args.push_back(new_t);
1149 return Literal(equals_p, args, arity, polarity);
1150 }

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