25#include "ProofPrinter.hpp"
27void show_internal_proof(
const ProofType& proof) {
29 for (
const ProofLine& line : proof) {
30 cout <<
"Proof step " << i <<
": ";
31 cout << line.first <<
" (";
32 for (
size_t n : line.second) {
41 string s(
"{\\begin{aligned}");
43 s += (item_p->
c).
make_LaTeX(params::sub_LaTeX_proof);
45 s += (item_p->
p).
make_LaTeX(params::sub_LaTeX_proof);
47 s += (item_p->
l).
make_LaTeX(params::sub_LaTeX_proof);
48 s +=
"\\end{aligned}}";
54 string axiom_s(
"\\prfbyaxiom{Axiom}");
58 case StackItemType::Start:
62 case StackItemType::Lemmata:
63 s +=
"\\prftree[r]{Lem}{";
64 if ((item_p->
c).size() == 0)
71 case StackItemType::Reduction:
72 s +=
"\\prftree[r,l]{Red}{$";
75 if ((item_p->
c).size() == 0)
82 case StackItemType::LeftBranch:
83 s +=
"\\prftree[r,l]{Ext[";
88 if ((item_p->
c).size() == 0)
98 right_item_p = item_p + 1;
104 case StackItemType::RightBranch:
105 if ((item_p->
c).size() == 0)
112 cerr <<
"Something is really wrong..." << endl;
119 const path& path_to_input_file,
120 const string& matrix_as_latex) {
121 std::ofstream file(path_to_file);
123 file <<
"\\documentclass[10pt]{article}" <<
'\n';
124 file <<
"\\usepackage{libertine}" <<
'\n';
125 file <<
"\\usepackage{amsmath,amsfonts,amssymb}" <<
'\n';
126 file <<
"\\usepackage{prftree}" <<
'\n';
127 file <<
"\\usepackage{color}" <<
'\n';
128 file <<
"\\usepackage[paperwidth = 5000mm, paperheight = 5000mm,landscape]{geometry}" <<
'\n' <<
'\n';
129 file <<
"\\begin{document}" <<
'\n';
132 file <<
"\\noindent\\begin{LARGE}\\textsc{Connect++}\\end{LARGE} \\\\" << endl << endl;
133 file <<
"\\noindent Attempting to prove problem from file: ";
134 file <<
"$\\mathtt{";
135 file << latex_escape_characters(path_to_input_file.filename());
136 file <<
"}$ \\\\" << endl << endl;
137 if (params::latex_include_matrix) {
138 file <<
"\\noindent Problem has matrix: " << endl << endl;
139 file << matrix_as_latex << endl;
141 file <<
"\\noindent\\textsc{Proof}: \\\\" << endl << endl;
143 if (params::latex_tiny_proof)
144 file <<
"\\begin{tiny}" << endl;
155 file <<
"\\prftree[r]{Start}{";
157 file <<
"}{\\epsilon, \\textcolor{magenta}{M}, \\epsilon, \\epsilon}\n";
162 if (params::latex_tiny_proof)
163 file <<
"\\end{tiny}" << endl;
165 file <<
'\n' <<
'\n' <<
"\\end{document}" <<
'\n';
171 const path& path_to_input_file,
172 const string& matrix_as_latex) {
173 std::ofstream file(path_to_file);
175 file <<
"\\documentclass[10pt]{article}" <<
'\n';
176 file <<
"\\usepackage{libertine}" <<
'\n';
177 file <<
"\\usepackage{amsmath,amsfonts,amssymb}" <<
'\n';
178 file <<
"\\usepackage{forest}" <<
'\n';
179 file <<
"\\usepackage{color}" <<
'\n';
180 file <<
"\\usepackage[paperwidth = 5000mm, paperheight = 5000mm,landscape]{geometry}" <<
'\n' <<
'\n';
181 file <<
"\\begin{document}" <<
'\n';
184 file <<
"\\noindent\\begin{LARGE}\\textsc{Connect++}\\end{LARGE} \\\\" << endl << endl;
185 file <<
"\\noindent Attempting to prove problem from file: ";
186 file <<
"$\\mathtt{";
187 file << latex_escape_characters(path_to_input_file.filename());
188 file <<
"}$ \\\\" << endl << endl;
189 if (params::latex_include_matrix) {
190 file <<
"\\noindent Problem has matrix: " << endl << endl;
191 file << matrix_as_latex << endl;
193 file <<
"\\noindent\\textsc{Proof}: \\\\" << endl << endl;
195 if (params::latex_tiny_proof)
196 file <<
"\\begin{tiny}" << endl;
205 file <<
"\\begin{forest}[Start";
207 Clause start_clause((*
p)[0].c);
208 for (
const Literal& lit : start_clause) {
210 file << lit.make_LaTeX(params::sub_LaTeX_proof);
214 file <<
"]\\end{forest}";
220 if (params::latex_tiny_proof)
221 file <<
"\\end{tiny}" << endl;
223 file <<
'\n' <<
'\n' <<
"\\end{document}" <<
'\n';
229 std::ofstream file(path_to_file);
230 file <<
"proof_stack([" << std::endl;
231 size_t s =
p->
size() - 1;
233 for (
size_t si_index = 0; si_index <
p->
size(); si_index++) {
236 case StackItemType::Start:
241 case StackItemType::Axiom:
244 case StackItemType::Reduction:
245 file <<
"reduction(";
251 case StackItemType::LeftBranch:
252 file <<
"left_branch(";
259 file << std::to_string(si.
depth);
262 case StackItemType::RightBranch:
263 file <<
"right_branch(";
264 file << std::to_string(si.
depth);
267 case StackItemType::Lemmata:
275 cerr <<
"Something is really wrong..." << endl;
283 file <<
"])." << std::endl;
288 cout <<
"proof_stack([" << std::endl;
289 size_t s =
p->
size() - 1;
291 for (
size_t si_index = 0; si_index <
p->
size(); si_index++) {
294 case StackItemType::Start:
299 case StackItemType::Axiom:
302 case StackItemType::Reduction:
303 cout <<
"reduction(";
309 case StackItemType::LeftBranch:
310 cout <<
"left_branch(";
317 cout << std::to_string(si.
depth);
320 case StackItemType::RightBranch:
321 cout <<
"right_branch(";
322 cout << std::to_string(si.
depth);
325 case StackItemType::Lemmata:
333 cerr <<
"Something is really wrong..." << endl;
341 cout <<
"])." << std::endl;
345 cout <<
"cnf(proof-stack, plain, " << std::endl;
346 cout <<
"proof_stack(" << std::endl;
347 size_t s =
p->
size() - 1;
349 for (
size_t si_index = 0; si_index <
p->
size(); si_index++) {
352 case StackItemType::Start:
357 case StackItemType::Axiom:
360 case StackItemType::Reduction:
361 cout <<
"reduction(";
367 case StackItemType::LeftBranch:
368 cout <<
"left_branch(";
375 cout << std::to_string(si.
depth);
378 case StackItemType::RightBranch:
379 cout <<
"right_branch(";
380 cout << std::to_string(si.
depth);
383 case StackItemType::Lemmata:
391 cerr <<
"Something is really wrong..." << endl;
399 cout <<
"))." << std::endl;
403 vector<pair<string, vector<size_t>>> out;
405 size_t s =
p->
size() - 1;
407 pair<string, vector<size_t>> next_out;
408 for (
size_t si_index = 0; si_index <
p->
size(); si_index++) {
410 next_out.second.clear();
412 case StackItemType::Start:
413 next_out.first =
"start";
415 out.push_back(next_out);
417 case StackItemType::Axiom:
418 next_out.first =
"axiom";
419 out.push_back(next_out);
421 case StackItemType::Reduction:
422 next_out.first =
"reduction";
425 out.push_back(next_out);
427 case StackItemType::LeftBranch:
428 next_out.first =
"left_branch";
432 next_out.second.push_back(si.
depth);
433 out.push_back(next_out);
435 case StackItemType::RightBranch:
436 next_out.first =
"right_branch";
437 next_out.second.push_back(si.
depth);
438 out.push_back(next_out);
440 case StackItemType::Lemmata:
441 next_out.first =
"lemmata";
444 out.push_back(next_out);
447 cerr <<
"Something is really wrong..." << endl;
Representation of clauses.
Basic representation of literals, bundling together (pointers to) a Predicate, a collection of argume...
string make_LaTeX_state(StackItem *) const
Helper for producing LaTeX output.
void make_LaTeX_connection_tableau(const path &, const path &, const string &)
Convert to LaTeX in the connection tableau calculus and store in the specified file.
void make_Prolog(const path &)
Convert to a form suitable for use by the Prolog proof checker and write to a file.
string make_LaTeX_subtree(StackItem *) const
Helper for producing LaTeX output.
void show_tptp()
Show the proof in a TPTP-friendly format.
Stack * p
Pointer to the output of StackProver.
void make_LaTeX(const path &, const path &, const string &)
Convert to LaTeX and store in the specified file.
void show_Prolog()
Show the proof in Prolog format.
vector< pair< string, vector< size_t > > > make_internal() const
Make a simple data structure representing the proof stack.
size_t size() const
Exact analogue of the same function for vector<>.
LitNum Lindex
The index of the literal within the clause being used.
size_t index_in_lemmata
For certification, you want to know which element of the lemmata list was used when the Lemma rule wa...
size_t index_in_path
The index in the path of the literal being used.
LitNum Lprime
The index of the literal in C_2 being used.
ClauseNum C_2
For extensions, the number of the clause for which a fresh copy is being made.
Stack items: each contains its own material for generating possible next inferences.
SimplePath p
Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the path.
Substitution sub
Some nodes in the proof tree have an associated substitution.
uint32_t depth
How deep in the proof tree are we?
InferenceItem this_action
Action that got you to this clause, path etc.
Lemmata l
Each node in the proof tree is a tuple of clause, matrix, path, lemmas: this is the lemmas.
Clause c
Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the clause.
StackItemType item_type
What type of StackItem is this?