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) {
43 s += (item_p->
c).
make_LaTeX(params::sub_LaTeX_proof);
44 s +=
", \\textcolor{magenta}{M}, ";
45 s += (item_p->
p).
make_LaTeX(params::sub_LaTeX_proof);
47 s += (item_p->
l).
make_LaTeX(params::sub_LaTeX_proof);
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}{$";
86 if ((item_p->
c).size() == 0)
96 right_item_p = item_p + 1;
102 case StackItemType::RightBranch:
103 if ((item_p->
c).size() == 0)
110 cerr <<
"Something is really wrong..." << endl;
117 const path& path_to_input_file,
118 const string& matrix_as_latex) {
119 std::ofstream file(path_to_file);
121 file <<
"\\documentclass[10pt]{article}" <<
'\n';
122 file <<
"\\usepackage{libertine}" <<
'\n';
123 file <<
"\\usepackage{amsmath,amsfonts,amssymb}" <<
'\n';
124 file <<
"\\usepackage{prftree}" <<
'\n';
125 file <<
"\\usepackage{color}" <<
'\n';
126 file <<
"\\usepackage[paperwidth = 750mm, paperheight = 1500mm,landscape]{geometry}" <<
'\n' <<
'\n';
127 file <<
"\\begin{document}" <<
'\n';
130 file <<
"\\noindent\\begin{LARGE}\\textsc{Connect++}\\end{LARGE} \\\\" << endl << endl;
131 file <<
"\\noindent Attempting to prove problem from file: ";
132 file <<
"$\\mathtt{";
133 file << latex_escape_characters(path_to_input_file.filename());
134 file <<
"}$ \\\\" << endl << endl;
135 if (params::latex_include_matrix) {
136 file <<
"\\noindent Problem has matrix: " << endl << endl;
137 file << matrix_as_latex << endl;
139 file <<
"\\noindent\\textsc{Proof}: \\\\" << endl << endl;
141 if (params::latex_tiny_proof)
142 file <<
"\\begin{tiny}" << endl;
153 file <<
"\\prftree[r]{Start}{";
155 file <<
"}{\\epsilon, \\textcolor{magenta}{M}, \\epsilon, \\epsilon}\n";
160 if (params::latex_tiny_proof)
161 file <<
"\\end{tiny}" << endl;
163 file <<
'\n' <<
'\n' <<
"\\end{document}" <<
'\n';
169 std::ofstream file(path_to_file);
170 file <<
"proof_stack([" << std::endl;
171 size_t s =
p->size() - 1;
174 switch (si.item_type) {
175 case StackItemType::Start:
177 file << std::to_string(si.this_action.C_2);
180 case StackItemType::Axiom:
183 case StackItemType::Reduction:
184 file <<
"reduction(";
185 file << std::to_string(si.this_action.Lindex);
187 file << std::to_string(si.this_action.index_in_path);
190 case StackItemType::LeftBranch:
191 file <<
"left_branch(";
192 file << std::to_string(si.this_action.Lindex);
194 file << std::to_string(si.this_action.C_2);
196 file << std::to_string(si.this_action.Lprime);
198 file << std::to_string(si.depth);
201 case StackItemType::RightBranch:
202 file <<
"right_branch(";
203 file << std::to_string(si.depth);
206 case StackItemType::Lemmata:
208 file << std::to_string(si.this_action.Lindex);
210 file << std::to_string(si.this_action.index_in_lemmata);
214 cerr <<
"Something is really wrong..." << endl;
222 file <<
"])." << std::endl;
227 cout <<
"proof_stack([" << std::endl;
228 size_t s =
p->size() - 1;
231 switch (si.item_type) {
232 case StackItemType::Start:
234 cout << std::to_string(si.this_action.C_2);
237 case StackItemType::Axiom:
240 case StackItemType::Reduction:
241 cout <<
"reduction(";
242 cout << std::to_string(si.this_action.Lindex);
244 cout << std::to_string(si.this_action.index_in_path);
247 case StackItemType::LeftBranch:
248 cout <<
"left_branch(";
249 cout << std::to_string(si.this_action.Lindex);
251 cout << std::to_string(si.this_action.C_2);
253 cout << std::to_string(si.this_action.Lprime);
255 cout << std::to_string(si.depth);
258 case StackItemType::RightBranch:
259 cout <<
"right_branch(";
260 cout << std::to_string(si.depth);
263 case StackItemType::Lemmata:
265 cout << std::to_string(si.this_action.Lindex);
267 cout << std::to_string(si.this_action.index_in_lemmata);
271 cerr <<
"Something is really wrong..." << endl;
279 cout <<
"])." << std::endl;
283 cout <<
"cnf(proof-stack, plain, " << std::endl;
284 cout <<
"proof_stack(" << std::endl;
285 size_t s =
p->size() - 1;
288 switch (si.item_type) {
289 case StackItemType::Start:
291 cout << std::to_string(si.this_action.C_2);
294 case StackItemType::Axiom:
297 case StackItemType::Reduction:
298 cout <<
"reduction(";
299 cout << std::to_string(si.this_action.Lindex);
301 cout << std::to_string(si.this_action.index_in_path);
304 case StackItemType::LeftBranch:
305 cout <<
"left_branch(";
306 cout << std::to_string(si.this_action.Lindex);
308 cout << std::to_string(si.this_action.C_2);
310 cout << std::to_string(si.this_action.Lprime);
312 cout << std::to_string(si.depth);
315 case StackItemType::RightBranch:
316 cout <<
"right_branch(";
317 cout << std::to_string(si.depth);
320 case StackItemType::Lemmata:
322 cout << std::to_string(si.this_action.Lindex);
324 cout << std::to_string(si.this_action.index_in_lemmata);
328 cerr <<
"Something is really wrong..." << endl;
336 cout <<
"))." << std::endl;
340 vector<pair<string, vector<size_t>>> out;
342 size_t s =
p->size() - 1;
344 pair<string, vector<size_t>> next_out;
346 next_out.second.clear();
347 switch (si.item_type) {
348 case StackItemType::Start:
349 next_out.first =
"start";
350 next_out.second.push_back(si.this_action.C_2);
351 out.push_back(next_out);
353 case StackItemType::Axiom:
354 next_out.first =
"axiom";
355 out.push_back(next_out);
357 case StackItemType::Reduction:
358 next_out.first =
"reduction";
359 next_out.second.push_back(si.this_action.Lindex);
360 next_out.second.push_back(si.this_action.index_in_path);
361 out.push_back(next_out);
363 case StackItemType::LeftBranch:
364 next_out.first =
"left_branch";
365 next_out.second.push_back(si.this_action.Lindex);
366 next_out.second.push_back(si.this_action.C_2);
367 next_out.second.push_back(si.this_action.Lprime);
368 next_out.second.push_back(si.depth);
369 out.push_back(next_out);
371 case StackItemType::RightBranch:
372 next_out.first =
"right_branch";
373 next_out.second.push_back(si.depth);
374 out.push_back(next_out);
376 case StackItemType::Lemmata:
377 next_out.first =
"lemmata";
378 next_out.second.push_back(si.this_action.Lindex);
379 next_out.second.push_back(si.this_action.index_in_lemmata);
380 out.push_back(next_out);
383 cerr <<
"Something is really wrong..." << endl;
vector< StackItem > * p
Pointer to the output of StackProver.
string make_LaTeX_state(StackItem *) const
Helper for producing LaTeX output.
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.
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.
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?
Lemmata l
Each node in the proof tree is a tuple of clause, matrix, path, lemmata: this is the lemmata.
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?