Connect++ 0.6.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
ProofChecker.hpp
1/*
2
3Copyright © 2023-24 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 PROOFCHECKER_HPP
26#define PROOFCHECKER_HPP
27
28#include<iostream>
29#include<string>
30#include<vector>
31
32#include "Matrix.hpp"
33#include "Unifier.hpp"
34
35using std::vector;
36using std::pair;
37using std::get;
38
45using ProofLine = pair<string, vector<size_t>>;
49using ProofType = vector<ProofLine>;
54using RightStackItem = std::tuple<Clause,
55 vector<Literal>,
56 vector<Literal>,
57 size_t>;
58
71private:
91 vector<Literal> P;
95 vector<Literal> Lem;
99 ProofType proof;
107 vector<RightStackItem> r_stack;
111 size_t num_subs;
115 bool C_i_ok(size_t) const;
119 bool Lit_i_ok(size_t) const;
123 bool P_i_ok(size_t) const;
127 bool Lem_i_ok(size_t) const;
131 string state_to_string() const;
132public:
133 ProofChecker() = delete;
134 ProofChecker(Matrix&, const ProofType&, VariableIndex*, TermIndex*);
139 pair<bool, string> check_proof_verbose();
143 bool check_proof();
144};
145
146#endif
Representation of clauses.
Definition Clause.hpp:52
Representation of the Matrix within a proof.
Definition Matrix.hpp:74
ProofType proof
Straightforward internal representation of the proof.
VariableIndex * vi
Needed as we need to generate things with new variables.
bool P_i_ok(size_t) const
Check index. Self-explanatory!
bool check_proof()
Check the proof quietly.
bool C_i_ok(size_t) const
Check index. Self-explanatory!
bool Lem_i_ok(size_t) const
Check index. Self-explanatory!
vector< Literal > P
Part of the representation of the current state of the proof.
TermIndex * ti
Needed as we need to generate things with new variables.
vector< Literal > Lem
Part of the representation of the current state of the proof.
Unifier u
Needed to check some proof steps.
Matrix & matrix
Reference to the problem matrix.
Clause C
Part of the representation of the current state of the proof.
vector< RightStackItem > r_stack
Collection of right-hand branches to complete.
size_t num_subs
Use this to undo the substitutions when you've finished.
pair< bool, string > check_proof_verbose()
Check the proof and produce a string with a detailed description.
bool Lit_i_ok(size_t) const
Check index. Self-explanatory!
string state_to_string() const
Make a string containing the current state.
Look after terms, using hash consing to avoid storing copies of terms.
Definition TermIndex.hpp:54
Wrap up various applications of unificiation into a single class: all the unification you need to do ...
Definition Unifier.hpp:89
Storage of named variables, and management of new, anonymous and unique variables.