Connect++ 0.7.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
ProofPrinter.hpp
1/*
2
3Copyright © 2023-26 Sean Holden. All rights reserved.
4
5*/
6/*
7
8This file is part of Connect++.
9
10Connect++ is free software: you can redistribute it and/or modify it
11under the terms of the GNU General Public License as published by the
12Free Software Foundation, either version 3 of the License, or (at your
13option) any later version.
14
15Connect++ is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18more details.
19
20You should have received a copy of the GNU General Public License along
21with Connect++. If not, see <https://www.gnu.org/licenses/>.
22
23*/
24
25#ifndef PROOFPRINTER_HPP
26#define PROOFPRINTER_HPP
27
28#include<iostream>
29#include<fstream>
30#include<filesystem>
31
32#include "Stack.hpp"
33#include "TableauProof.hpp"
34
35using std::filesystem::path;
36
37using ProofLine = pair<string, vector<size_t>>;
38using ProofType = vector<ProofLine>;
39
46void show_internal_proof(const ProofType&);
47
63private:
76 string make_LaTeX_state(StackItem*) const;
88 string make_LaTeX_subtree(StackItem*) const;
93 string make_LaTeX_start(const path&, const path&, const string&) const;
98 string make_LaTeX_end() const;
99public:
103 ProofPrinter() : p(nullptr) {};
109 ProofPrinter(Stack* _p) : p(_p) {};
115 inline void set_proof(Stack* _p) { p = _p; }
119 inline void clear() { p = nullptr; }
127 void make_LaTeX(const path&, const path&, const string&);
136 void make_LaTeX_connection_tableau(const path&, const path&, const string&,
144 void make_graphviz_connection_tableau(const path&, const path&,
152 void make_Prolog(const path&);
156 void show_Prolog();
160 pair<string, unordered_set<string>> make_tptp(Matrix*, VariableIndex*, TermIndex*);
169 vector<pair<string, vector<size_t>>> make_internal() const;
170};
171
172#endif
Representation of the Matrix within a proof.
Definition Matrix.hpp:74
Class for rendering a proof in various formats.
string make_LaTeX_start(const path &, const path &, const string &) const
The beginning and end of output LaTeX files are the same for all formats.
pair< string, unordered_set< string > > make_tptp(Matrix *, VariableIndex *, TermIndex *)
Show the proof in a TPTP-friendly format.
void make_graphviz_connection_tableau(const path &, const path &, Matrix *, VariableIndex *, TermIndex *)
Convert to LaTeX in the connection tableau calculus and store in the specified file.
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.
ProofPrinter(Stack *_p)
The constructor you want.
void set_proof(Stack *_p)
Basic set method.
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.
ProofPrinter()
Basic constructor.
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.
void make_LaTeX_connection_tableau(const path &, const path &, const string &, Matrix *, VariableIndex *, TermIndex *)
Convert to LaTeX in the connection tableau calculus and store in the specified file.
string make_LaTeX_end() const
The beginning and end of output LaTeX files are the same for all formats.
void clear()
Basic set method.
If you implement the stacks used by the prover as a vector<StackItem> then every time you move down t...
Definition Stack.hpp:40
Look after terms, using hash consing to avoid storing copies of terms.
Definition TermIndex.hpp:54
Storage of named variables, and management of new, anonymous and unique variables.
Stack items: each contains its own material for generating possible next inferences.
Definition StackItem.hpp:54