Connect++ 0.6.1
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
Parameters.cpp
1/*
2
3Copyright © 2023-25 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 = 500000;
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";
41bool params::show_full_stats = true;
42bool params::first_parse = true;
43//------------------------------------------------------------------
44// CNF conversion.
45//------------------------------------------------------------------
46bool params::miniscope = true;
47bool params::all_definitional = false;
48bool params::no_definitional = false;
49//------------------------------------------------------------------
50// Equality axioms.
51 //------------------------------------------------------------------
52bool params::add_equality_axioms = true;
53bool params::equality_axioms_at_start = true;
54bool params::all_distinct_objects = false;
55bool params::no_distinct_objects = false;
56//------------------------------------------------------------------
57// Reordering
58//------------------------------------------------------------------
59unsigned params::random_seed = 0;
60uint32_t params::boost_random_seed = 0;
61bool params::deterministic_reorder = false;
62uint32_t params::number_of_reorders = 0;
63bool params::random_reorder = false;
64bool params::random_reorder_literals = false;
65//------------------------------------------------------------------
66// Timeout.
67//------------------------------------------------------------------
68bool params::timeout = false;
69uint32_t params::timeout_value = UINT32_MAX;
70std::chrono::steady_clock::time_point params::global_timeout(std::chrono::steady_clock::now());
71//------------------------------------------------------------------
72// Use of schedule.
73//------------------------------------------------------------------
74bool params::use_schedule = false;
75//------------------------------------------------------------------
76// Positive/negative representation.
77//------------------------------------------------------------------
78bool params::positive_representation = false;
79//------------------------------------------------------------------
80// Deepening.
81//------------------------------------------------------------------
82uint32_t params::start_depth = 2;
83uint32_t params::depth_limit = UINT32_MAX;
84uint32_t params::depth_increment = 1;
85//------------------------------------------------------------------
86// Start clauses.
87//------------------------------------------------------------------
88bool params::all_start = false;
89bool params::all_pos_neg_start = false;
90bool params::conjecture_start = false;
91bool params::restrict_start = false;
92//------------------------------------------------------------------
93// Use of regularity test.
94//------------------------------------------------------------------
95bool params::use_regularity_test = true;
96//------------------------------------------------------------------
97// Various basic limitations of search.
98//------------------------------------------------------------------
99bool params::use_lemmata = true;
100bool params::limit_lemmata = true;
101bool params::limit_reductions = true;
102bool params::limit_extensions = true;
103bool params::limit_bt_all = true;
104bool params::limit_bt_lemmas = true;
105bool params::limit_bt_reductions = true;
106bool params::limit_bt_extensions = true;
107bool params::limit_bt_extensions_left_tree = true;
108//------------------------------------------------------------------
109// Move to a complete search.
110//------------------------------------------------------------------
111uint32_t params::switch_to_complete = UINT32_MAX;
112//------------------------------------------------------------------
113// Type of unification to use.
114//------------------------------------------------------------------
115bool params::poly_unification = false;
116//------------------------------------------------------------------
117// Start and increment sizes for clause cache and stacks.
118//------------------------------------------------------------------
119size_t params::clause_copy_cache_start_size = 5; // This MUST be at least 1.
120size_t params::clause_copy_cache_increment = 1;
121size_t params::stack_start_size = 5000;
122size_t params::stack_increment = 0; // 0 means you'll double the size.
123//------------------------------------------------------------------
124// Generation of proof for output.
125//------------------------------------------------------------------
126bool params::verify_proof_verbose = false;
127bool params::verify_proof = false;
128bool params::build_proof = false;
129bool params::generate_LaTeX_proof = false;
130bool params::generate_LaTeX_tableau_proof = false;
131bool params::sub_LaTeX_proof = false;
132int params::latex_truncation_length = 25;
133bool params::latex_tiny_proof = false;
134bool params::latex_include_matrix = true;
135bool params::generate_Prolog_proof = false;
136bool params::generate_tptp_proof = false;
137//------------------------------------------------------------------
138// Assorted file paths.
139//------------------------------------------------------------------
140std::filesystem::path params::LaTeX_proof_path = "latex_proof.tex";
141std::filesystem::path params::LaTeX_tableau_proof_path = "latex_tableau_proof.tex";
142std::filesystem::path params::Prolog_matrix_path = "matrix.pl";
143std::filesystem::path params::Prolog_proof_path = "proof.pl";
144std::filesystem::path params::output_summary_path = "output_summary.txt";
145std::filesystem::path params::schedule_path = ".";
146std::filesystem::path params::tptp_path = ".";
147std::filesystem::path params::pwd_path = ".";
148std::filesystem::path params::connectpp_path = ".";
149std::filesystem::path params::full_problem_path;
150//------------------------------------------------------------------
151// Default schedule.
152//------------------------------------------------------------------
153std::string params::default_schedule;
154
155void params::set_default_schedule() {
156 default_schedule = "10 --complete 7 ;\n";
157 default_schedule += "15 --conjecture-start --all-definitional ;\n";
158 default_schedule += "15 --no-definitional --restrict-start ;\n";
159 default_schedule += "10 --restrict-start --all-backtrack ;\n";
160 default_schedule += "5 --all-definitional ;\n";
161 default_schedule += "4 --conjecture-start --no-definitional ;\n";
162 default_schedule += "2 --all-definitional --restrict-start ;\n";
163 default_schedule += "2 --restrict-start ;\n";
164 default_schedule += "1 --conjecture-start --all-definitional --all-backtrack ;\n";
165 default_schedule += "4 --random-reorder --random-reorder-literals --conjecture-start --no-definitional --restrict-start ;\n";
166 default_schedule += "4 --random-reorder --random-reorder-literals --all-definitional --restrict-start ;\n";
167 default_schedule += "2 --random-reorder --random-reorder-literals --all-definitional --restrict-start ;\n";
168 default_schedule += "2 --random-reorder --random-reorder-literals --all-definitional --restrict-start ;\n";
169 default_schedule += "2 --random-reorder --random-reorder-literals --no-definitional ;\n";
170 default_schedule += "2 --random-reorder --random-reorder-literals --conjecture-start --all-definitional ;\n";
171 default_schedule += "2 --random-reorder --random-reorder-literals --conjecture-start --all-definitional ;\n";
172 default_schedule += "1 --random-reorder --random-reorder-literals --conjecture-start --all-definitional ;\n";
173 default_schedule += "1 --random-reorder --random-reorder-literals --conjecture-start --all-definitional ;\n";
174 default_schedule += "1 --random-reorder --random-reorder-literals --conjecture-start --no-definitional --restrict-start ;\n";
175 default_schedule += "1 --random-reorder --random-reorder-literals --conjecture-start --no-definitional --restrict-start ;\n";
176 default_schedule += "1 --random-reorder --random-reorder-literals --conjecture-start --no-definitional --restrict-start ;\n";
177 default_schedule += "1 --random-reorder --random-reorder-literals --conjecture-start --no-definitional --restrict-start --all-backtrack ;\n";
178 default_schedule += "1 --random-reorder --random-reorder-literals --conjecture-start --no-definitional --restrict-start --all-backtrack ;\n";
179 default_schedule += "1 --random-reorder --random-reorder-literals --all-definitional --restrict-start --all-backtrack ;\n";
180 default_schedule += "1 --random-reorder --random-reorder-literals --all-definitional --restrict-start ;\n";
181 default_schedule += "1 --random-reorder --random-reorder-literals --all-definitional --restrict-start ;\n";
182 default_schedule += "1 --random-reorder --random-reorder-literals --no-definitional ;\n";
183 default_schedule += "1 --random-reorder --random-reorder-literals --no-definitional ;\n";
184 default_schedule += "1 --random-reorder --random-reorder-literals --no-definitional --restrict-start --all-backtrack ;\n";
185 default_schedule += "0 --all-definitional --all-backtrack ;\n";
186}
187//------------------------------------------------------------------------
188bool params::show_clauses = false;
189//------------------------------------------------------------------
191 all_definitional = false;
192 no_definitional = false;
193
194 deterministic_reorder = false;
195 number_of_reorders = 0;
196 random_reorder = false;
197 random_reorder_literals = false;
198
199 start_depth = 2;
200 depth_increment = 1;
201
202 all_start = false;
203 all_pos_neg_start = false;
204 conjecture_start = false;
205 restrict_start = false;
206
207 use_regularity_test = true;
208
209 use_lemmata = true;
210 limit_lemmata = true;
211 limit_reductions = true;
212 limit_extensions = true;
213 limit_bt_all = true;
214 limit_bt_lemmas = true;
215 limit_bt_reductions = true;
216 limit_bt_extensions = true;
217 limit_bt_extensions_left_tree = true;
218
219 switch_to_complete = UINT32_MAX;
220}
221//------------------------------------------------------------------------
223 all_start = false;
224 all_pos_neg_start = true;
225 conjecture_start = false;
226 restrict_start = false;
227
228 limit_bt_all = false;
229 limit_bt_reductions = false;
230 limit_bt_extensions = false;
231 limit_bt_extensions_left_tree = false;
232}
233//------------------------------------------------------------------------
235 bool start_conditions_ok =
236 (all_pos_neg_start || all_start) && !restrict_start && !conjecture_start;
237
238 // You don't care about lemmas.
239 bool backtracking_ok =
240 !limit_bt_all && !limit_bt_reductions && !limit_bt_extensions &&
241 !limit_bt_extensions_left_tree;
242
243 return start_conditions_ok && backtracking_ok;
244}
245//------------------------------------------------------------------------
247 limit_bt_all = false;
248 limit_bt_lemmas = false;
249 limit_bt_reductions = false;
250 limit_bt_extensions = false;
251 limit_bt_extensions_left_tree = false;
252}
253//------------------------------------------------------------------------
255 return !all_start &&
256 !all_pos_neg_start &&
257 !conjecture_start &&
258 !restrict_start;
259}
260//------------------------------------------------------------------------
262 all_start = false;
263 all_pos_neg_start = true;
264 conjecture_start = false;
265 restrict_start = false;
266}
267//------------------------------------------------------------------------
269 all_start = true;
270 all_pos_neg_start = false;
271 conjecture_start = false;
272 restrict_start = false;
273}
274//------------------------------------------------------------------------
276 cout << std::boolalpha
277 << "all_definitional: " << all_definitional << endl
278 << "no_definitional: " << no_definitional << endl
279 << "all_start: " << all_start << endl
280 << "all_pos_neg_start: " << all_pos_neg_start << endl
281 << "conjecture_start: " << conjecture_start << endl
282 << "restrict_start: " << restrict_start << endl
283 << "limit_bt_all: " << limit_bt_all << endl
284 << "switch_to_complete: " << switch_to_complete
285 << std::noboolalpha;
286}
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.
static void show_search_parameter_settings()
Give a detailed indication of what the parameters affecting the search are currently set to.