Connect++ 0.3.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
Parameters.cpp
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#include "Parameters.hpp"
26
27//------------------------------------------------------------------
28// Cosmetic output options.
29//------------------------------------------------------------------
30uint8_t params::verbosity = 2;
31bool params::use_colours = true;
32uint8_t params::indent_size = 4;
33uint8_t params::output_width = 7;
34uint32_t params::output_frequency = 50000;
35bool params::output_terms_with_substitution = false;
36std::string params::problem_name = "Unknown";
37bool params::write_output_summary = false;
38std::string params::definitional_predicate_prefix = "_def";
39std::string params::unique_var_prefix = "_u";
40std::string params::unique_skolem_prefix = "skolem";
41//------------------------------------------------------------------
42// CNF conversion.
43//------------------------------------------------------------------
44bool params::miniscope = true;
45bool params::all_definitional = false;
46bool params::no_definitional = false;
47//------------------------------------------------------------------
48// Equality axioms.
49 //------------------------------------------------------------------
50bool params::add_equality_axioms = true;
51bool params::equality_axioms_at_start = true;
52bool params::all_distinct_objects = false;
53bool params::no_distinct_objects = false;
54//------------------------------------------------------------------
55// Reordering
56//------------------------------------------------------------------
57unsigned params::random_seed = 0;
58uint32_t params::boost_random_seed = 0;
59bool params::deterministic_reorder = false;
60uint32_t params::number_of_reorders = 0;
61bool params::random_reorder = false;
62//------------------------------------------------------------------
63// Timeout.
64//------------------------------------------------------------------
65bool params::timeout = false;
66uint32_t params::timeout_value = UINT32_MAX;
67//------------------------------------------------------------------
68// Use of schedule.
69//------------------------------------------------------------------
70bool params::use_schedule = false;
71//------------------------------------------------------------------
72// Positive/negative representation.
73//------------------------------------------------------------------
74bool params::positive_representation = false;
75//------------------------------------------------------------------
76// Deepening.
77//------------------------------------------------------------------
78uint32_t params::start_depth = 2;
79uint32_t params::depth_limit = UINT32_MAX;
80uint32_t params::depth_increment = 1;
81bool params::limit_by_tree_depth = false;
82//------------------------------------------------------------------
83// Start clauses.
84//------------------------------------------------------------------
85bool params::all_start = false;
86bool params::all_pos_neg_start = false;
87bool params::conjecture_start = false;
88bool params::restrict_start = false;
89//------------------------------------------------------------------
90// Use of regularity test.
91//------------------------------------------------------------------
92bool params::use_regularity_test = true;
93//------------------------------------------------------------------
94// Various basic limitations of search.
95//------------------------------------------------------------------
96bool params::use_lemmata = true;
97bool params::limit_lemmata = true;
98bool params::limit_reductions = true;
99bool params::limit_extensions = true;
100bool params::limit_bt_all = true;
101bool params::limit_bt_lemmas = true;
102bool params::limit_bt_reductions = true;
103bool params::limit_bt_extensions = true;
104bool params::limit_bt_extensions_left_tree = true;
105bool params::hard_prune = false;
106//------------------------------------------------------------------
107// Move to a complete search.
108//------------------------------------------------------------------
109uint32_t params::switch_to_complete = UINT32_MAX;
110//------------------------------------------------------------------
111// Generation of proof for output.
112//------------------------------------------------------------------
113bool params::verify_proof_verbose = false;
114bool params::verify_proof = false;
115bool params::build_proof = false;
116bool params::generate_LaTeX_proof = false;
117bool params::sub_LaTeX_proof = false;
118int params::latex_truncation_length = 25;
119bool params::latex_tiny_proof = false;
120bool params::latex_include_matrix = true;
121bool params::generate_Prolog_proof = false;
122bool params::generate_tptp_proof = false;
123std::string params::tptp_conversion_string;
124//------------------------------------------------------------------
125// Assorted file paths.
126//------------------------------------------------------------------
127std::filesystem::path params::LaTeX_proof_path = "latex_proof.tex";
128std::filesystem::path params::Prolog_matrix_path = "matrix.pl";
129std::filesystem::path params::Prolog_proof_path = "proof.pl";
130std::filesystem::path params::output_summary_path = "output_summary.txt";
131std::filesystem::path params::schedule_path = ".";
132std::filesystem::path params::tptp_path = ".";
133std::filesystem::path params::pwd_path = ".";
134std::filesystem::path params::connectpp_path = ".";
135std::filesystem::path params::full_problem_path;
136//------------------------------------------------------------------
137// Default schedule.
138//------------------------------------------------------------------
139std::string params::default_schedule;
140
141void params::set_default_schedule() {
142 default_schedule = "2 --pos-neg-start --complete 7 ;\n";
143 default_schedule += "60 --conjecture-start ;\n";
144 default_schedule += "20 --pos-neg-start --restrict-start ;\n";
145 default_schedule += "2 --conjecture-start --reorder 23 ;\n";
146 default_schedule += "2 --pos-neg-start --restrict-start --reorder 29 ;\n";
147 default_schedule += "2 --conjecture-start --reorder 37 ;\n";
148 default_schedule += "2 --pos-neg-start --restrict-start --reorder 41 ;\n";
149 default_schedule += "2 --conjecture-start --reorder 47 ;\n";
150 default_schedule += "0 --pos-neg-start --all-backtrack ;\n";
151}
152//------------------------------------------------------------------------
153bool params::show_clauses = false;
154//------------------------------------------------------------------
156 deterministic_reorder = false;
157 number_of_reorders = 0;
158
159 all_start = false;
160 all_pos_neg_start = false;
161 conjecture_start = false;
162 restrict_start = false;
163
164 use_regularity_test = true;
165
166 use_lemmata = true;
167 limit_lemmata = true;
168 limit_reductions = true;
169 limit_extensions = true;
170 limit_bt_all = true;
171 limit_bt_lemmas = true;
172 limit_bt_reductions = true;
173 limit_bt_extensions = true;
174 limit_bt_extensions_left_tree = true;
175 hard_prune = false;
176
177 switch_to_complete = UINT32_MAX;
178}
179//------------------------------------------------------------------------
181 all_start = false;
182 all_pos_neg_start = true;
183 conjecture_start = false;
184 restrict_start = false;
185
186 limit_bt_all = false;
187 limit_bt_reductions = false;
188 limit_bt_extensions = false;
189 limit_bt_extensions_left_tree = false;
190}
191//------------------------------------------------------------------------
193 bool start_conditions_ok =
194 (all_pos_neg_start || all_start) && !restrict_start && !conjecture_start;
195
196 // You don't care about lemmas.
197 bool backtracking_ok =
198 !limit_bt_all && !limit_bt_reductions && !limit_bt_extensions &&
199 !limit_bt_extensions_left_tree;
200
201 return start_conditions_ok && backtracking_ok;
202}
203//------------------------------------------------------------------------
205 limit_bt_all = false;
206 limit_bt_lemmas = false;
207 limit_bt_reductions = false;
208 limit_bt_extensions = false;
209 limit_bt_extensions_left_tree = false;
210}
211//------------------------------------------------------------------------
213 return !all_start &&
214 !all_pos_neg_start &&
215 !conjecture_start &&
216 !restrict_start;
217}
218//------------------------------------------------------------------------
220 all_start = false;
221 all_pos_neg_start = true;
222 conjecture_start = false;
223 restrict_start = false;
224}
225//------------------------------------------------------------------------
227 all_start = true;
228 all_pos_neg_start = false;
229 conjecture_start = false;
230 restrict_start = false;
231}
static void set_default_schedule_parameters()
Self-explanatory.
static void set_all_backtrack()
Self-explanatory.
static void set_all_start()
Self-explanatory.
static void set_complete_parameters()
Change the parameters to make the search complete.
static bool no_start_options()
Self-explanatory.
static void correct_missing_start_options()
Self-explanatory.
static bool search_is_complete()
Self-explanatory.