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);
132 file <<
"\\documentclass[10pt]{article}" <<
'\n';
133 file <<
"\\usepackage{libertine}" <<
'\n';
134 file <<
"\\usepackage{amsmath,amsfonts,amssymb}" <<
'\n';
135 file <<
"\\usepackage{prftree}" <<
'\n';
136 file <<
"\\usepackage{color}" <<
'\n';
137 file <<
"\\usepackage[paperwidth = 750mm, paperheight = 1500mm,landscape]{geometry}" <<
'\n' <<
'\n';
138 file <<
"\\begin{document}" <<
'\n';
141 file <<
"\\noindent\\begin{LARGE}\\textsc{Connect++}\\end{LARGE} \\\\" << endl << endl;
142 file <<
"\\noindent Attempting to prove problem from file: ";
143 file <<
"$\\mathtt{";
144 file << latex_escape_characters(path_to_input_file.filename());
145 file <<
"}$ \\\\" << endl << endl;
146 if (params::latex_include_matrix) {
147 file <<
"\\noindent Problem has matrix: " << endl << endl;
148 file << matrix_as_latex << endl;
150 file <<
"\\noindent\\textsc{Proof}: \\\\" << endl << endl;
152 if (params::latex_tiny_proof)
153 file <<
"\\begin{tiny}" << endl;
164 file <<
"\\prftree[r]{Start}{";
166 file <<
"}{\\epsilon, \\textcolor{magenta}{M}, \\epsilon, \\epsilon}\n";
171 if (params::latex_tiny_proof)
172 file <<
"\\end{tiny}" << endl;
183 file <<
'\n' <<
'\n' <<
"\\end{document}" <<
'\n';
190 std::ofstream file(path_to_file);
191 file <<
"proof_stack([" << std::endl;
192 size_t s =
p->size() - 1;
195 switch (si.item_type) {
196 case StackItemType::Start:
198 file << std::to_string(si.this_action.C_2);
201 case StackItemType::Axiom:
204 case StackItemType::Reduction:
205 file <<
"reduction(";
206 file << std::to_string(si.this_action.Lindex);
208 file << std::to_string(si.this_action.index_in_path);
211 case StackItemType::LeftBranch:
212 file <<
"left_branch(";
213 file << std::to_string(si.this_action.Lindex);
215 file << std::to_string(si.this_action.C_2);
217 file << std::to_string(si.this_action.Lprime);
219 file << std::to_string(si.depth);
222 case StackItemType::RightBranch:
223 file <<
"right_branch(";
224 file << std::to_string(si.depth);
227 case StackItemType::Lemmata:
229 file << std::to_string(si.this_action.Lindex);
231 file << std::to_string(si.this_action.index_in_lemmata);
235 cerr <<
"Something is really wrong..." << endl;
243 file <<
"])." << std::endl;
248 cout <<
"proof_stack([" << std::endl;
249 size_t s =
p->size() - 1;
252 switch (si.item_type) {
253 case StackItemType::Start:
255 cout << std::to_string(si.this_action.C_2);
258 case StackItemType::Axiom:
261 case StackItemType::Reduction:
262 cout <<
"reduction(";
263 cout << std::to_string(si.this_action.Lindex);
265 cout << std::to_string(si.this_action.index_in_path);
268 case StackItemType::LeftBranch:
269 cout <<
"left_branch(";
270 cout << std::to_string(si.this_action.Lindex);
272 cout << std::to_string(si.this_action.C_2);
274 cout << std::to_string(si.this_action.Lprime);
276 cout << std::to_string(si.depth);
279 case StackItemType::RightBranch:
280 cout <<
"right_branch(";
281 cout << std::to_string(si.depth);
284 case StackItemType::Lemmata:
286 cout << std::to_string(si.this_action.Lindex);
288 cout << std::to_string(si.this_action.index_in_lemmata);
292 cerr <<
"Something is really wrong..." << endl;
300 cout <<
"])." << std::endl;
304 cout <<
"cnf(proof-stack, plain, " << std::endl;
305 cout <<
"proof_stack(" << std::endl;
306 size_t s =
p->size() - 1;
309 switch (si.item_type) {
310 case StackItemType::Start:
312 cout << std::to_string(si.this_action.C_2);
315 case StackItemType::Axiom:
318 case StackItemType::Reduction:
319 cout <<
"reduction(";
320 cout << std::to_string(si.this_action.Lindex);
322 cout << std::to_string(si.this_action.index_in_path);
325 case StackItemType::LeftBranch:
326 cout <<
"left_branch(";
327 cout << std::to_string(si.this_action.Lindex);
329 cout << std::to_string(si.this_action.C_2);
331 cout << std::to_string(si.this_action.Lprime);
333 cout << std::to_string(si.depth);
336 case StackItemType::RightBranch:
337 cout <<
"right_branch(";
338 cout << std::to_string(si.depth);
341 case StackItemType::Lemmata:
343 cout << std::to_string(si.this_action.Lindex);
345 cout << std::to_string(si.this_action.index_in_lemmata);
349 cerr <<
"Something is really wrong..." << endl;
357 cout <<
"))." << std::endl;
361 vector<pair<string, vector<size_t>>> out;
363 size_t s =
p->size() - 1;
365 pair<string, vector<size_t>> next_out;
367 next_out.second.clear();
368 switch (si.item_type) {
369 case StackItemType::Start:
370 next_out.first =
"start";
371 next_out.second.push_back(si.this_action.C_2);
372 out.push_back(next_out);
374 case StackItemType::Axiom:
375 next_out.first =
"axiom";
376 out.push_back(next_out);
378 case StackItemType::Reduction:
379 next_out.first =
"reduction";
380 next_out.second.push_back(si.this_action.Lindex);
381 next_out.second.push_back(si.this_action.index_in_path);
382 out.push_back(next_out);
384 case StackItemType::LeftBranch:
385 next_out.first =
"left_branch";
386 next_out.second.push_back(si.this_action.Lindex);
387 next_out.second.push_back(si.this_action.C_2);
388 next_out.second.push_back(si.this_action.Lprime);
389 next_out.second.push_back(si.depth);
390 out.push_back(next_out);
392 case StackItemType::RightBranch:
393 next_out.first =
"right_branch";
394 next_out.second.push_back(si.depth);
395 out.push_back(next_out);
397 case StackItemType::Lemmata:
398 next_out.first =
"lemmata";
399 next_out.second.push_back(si.this_action.Lindex);
400 next_out.second.push_back(si.this_action.index_in_lemmata);
401 out.push_back(next_out);
404 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 stack of 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?