33#include <boost/program_options.hpp> 
   35#include "connect++-version.hpp" 
   37#include "StackProver.hpp" 
   38#include "Schedule.hpp" 
   39#include "ProofChecker.hpp" 
   45namespace fs = std::filesystem;
 
   46namespace chrono = std::chrono;
 
   47namespace po = boost::program_options;
 
   49using namespace verbose_print;
 
   50using namespace boost::spirit;
 
   55void SIGINT_handler(
int p) {
 
   56  cout << endl << 
"% SZS status Error for "  
   57       << params::problem_name 
 
   58       << 
" : terminated by SIGINT." << endl;
 
   61void SIGXCPU_handler(
int p) {
 
   62  cout << endl << 
"% SZS status Timeout for " 
   63       << params::problem_name
 
   64       << 
" : terminated by SIGXCPU." << endl;
 
   67void SIGALRM_handler(
int p) {
 
   68  cout << endl << 
"% SZS status Timeout for "  
   69       << params::problem_name 
 
   70       << 
" : terminated by SIGALRM." << endl;
 
   74int main(
int argc, 
char** argv) {
 
   78  chrono::steady_clock::time_point startTime;
 
   79  startTime = chrono::steady_clock::now();
 
   83  std::signal(SIGINT, SIGINT_handler);
 
   84  std::signal(SIGXCPU, SIGXCPU_handler);
 
   85  std::signal(SIGALRM, SIGALRM_handler);
 
   91  char* tptp_env = getenv(
"TPTP");
 
   92  if (tptp_env != 
nullptr) {
 
   93     params::tptp_path = fs::path(tptp_env);
 
   95  char* pwd_env = getenv(
"PWD");
 
   96  if (pwd_env != 
nullptr) {
 
   97     params::pwd_path = fs::path(pwd_env);
 
   99  char* path_env = getenv(
"CONNECTPP_PATH");
 
  100  if (path_env != 
nullptr) {
 
  101     params::connectpp_path = fs::path(path_env);
 
  104     params::connectpp_path = params::pwd_path;
 
  110  po::options_description main_options(
"Basic options");
 
  111  main_options.add_options()
 
  113        "Show this message.")
 
  115        "Show version number.")
 
  116    (
"input,i", po::value<string>(), 
 
  118    (
"output,o", po::value<string>(), 
 
  119        "Write a short output summary (file, status, outcome, time etc) to the specified file. Using \"default\" places it in \"./output_summary.txt\"" )
 
  121        "Don't add equality axioms. (For example, if they were added elsewhere.) NOTE: also inhibits adding of distinct object axioms.")
 
  123        "Place equality axioms at the end of the matrix, not the beginning")
 
  124    (
"all-distinct-objects", 
 
  125        "By default Connect++ follows the TPTP convention of considering \"foobar\" to be a distinct object. This option makes *all* constants distinct.")
 
  126    (
"no-distinct-objects", 
 
  127        "By default Connect++ follows the TPTP convention of considering \"foobar\" to be a distinct object. This option disables that behaviour, so constants can be equal to others.")
 
  128    (
"timeout,t", po::value<int>(), 
 
  129        "Timeout in seconds. (Default UINT32_MAX).")
 
  130    (
"show-default-schedule", 
 
  131        "Display the build-in default schedule and halt.")
 
  132    (
"schedule,s", po::value<string>(), 
 
  133        "Instead of running with fixed parameters, use a schedule from the specified file. Use value \"default\" for the default schedule. If no --timeout is specified use 600s.")
 
  134    (
"random-seed", po::value<int>(), 
 
  135        "Specify the (non-negative, integer) seed to use for random number generation. Default 0.")
 
  137        "Use the alternative, polynomial-time unification algorithm.")
 
  138    (
"tptp", po::value<string>(), 
 
  139        "Specify a path for the TPTP. Alternative to using the TPTP environment variable.")
 
  140    (
"path", po::value<string>(), 
 
  141        "Specify the path for output files other than the one produced by --output. Alternative to using the CONNECTPP_PATH environment variable."); 
 
  143  po::options_description conversion_options(
"Clause conversion");
 
  144  conversion_options.add_options()
 
  146        "Don't apply definitional transformation for any formula.")
 
  148        "Apply definitional transformation to all formulas.")
 
  149    (
"reorder,r", po::value<int>(), 
 
  150        "Reorder the clauses a specified number of times.")
 
  152        "Randomly reorder the clauses.")
 
  153    (
"random-reorder-literals",  
 
  154        "Randomly reorder the literals in each clause in the matrix.")
 
  156        "Don't miniscope when converting to CNF.")
 
  158        "Show translation of first-order formulas to clauses and halt.");
 
  160  po::options_description output_options(
"Output formatting");
 
  161  output_options.add_options()
 
  162    (
"verbosity,v", po::value<int>(), 
 
  163        "Set verbosity level (0-3). Default is 2.")
 
  165        "Don't use colour to highlight output.")
 
  167        "Include substitutions when writing output.")
 
  168    (
"indent", po::value<int>(), 
 
  169        "Set indentation size. (Default 4.)")
 
  170    (
"out-int", po::value<int>(), 
 
  171        "Interval for updating output (default 50,000).");
 
  173  po::options_description search_options(
"Search control");
 
  174  search_options.add_options()
 
  176        "Use all start clauses. (Overides other start clause options.)")
 
  178        "Use all positive/negative start clauses, according to representation (currently always negative). (Interacts with other start clause options.)")
 
  180        "Use all conjecture clauses as start clauses. (Interacts with other start clause options.)")
 
  182        "Only use one start clause. (Interacts with other start clause options.)")
 
  184        "Don't use the regularity test.")
 
  186        "Compute reductions for all literals in the clause, not just the first one.")
 
  188        "Compute extensions for all literals in the clause, not just the first one.")
 
  190        "When using lemmata, consider all literals in the clause, not just the first one.")
 
  192        "Do not use lemmata.");
 
  194  po::options_description backtrack_options(
"Backtracking");
 
  195  backtrack_options.add_options()
 
  197        "Do not limit any backtracking.")
 
  198    (
"lemmata-backtrack", 
 
  199        "Do not limit backtracking for lemmata.")
 
  200    (
"reduction-backtrack", 
 
  201        "Do not limit backtracking for reductions.")
 
  202    (
"extension-backtrack",
 
  203        "Do not limit backtracking for extensions.")
 
  204    (
"explore-left-trees", 
 
  205        "Apply backtracking within left extension trees.")
 
  206    (
"complete,c", po::value<int>(), 
 
  207        "Start again with a complete search on reaching the specified depth. (Default UINT32_MAX.)");
 
  209  po::options_description depth_options(
"Depth limiting");
 
  210  depth_options.add_options()
 
  211    (
"depth-limit,d", po::value<int>(), 
 
  212        "Maximum depth/path length. (Default UINT32_MAX.)")
 
  213    (
"start-depth", po::value<int>(), 
 
  214        "Initial depth/path length. (Default 1.)")
 
  215    (
"depth-increment", po::value<int>(), 
 
  216        "Increment for iterative deepening. (Default 1.)")
 
  218        "By default we do not depth limit on reductions or lemmata. Set this if you want to.")
 
  219    (
"limit-by-tree-depth", 
 
  220        "Use tree depth (not path length) for deepening.");
 
  222  po::options_description proof_options(
"Proof generation");
 
  223  proof_options.add_options()
 
  225        "Generate a proof compatible with the TPTP. Note that what constitutes a TPTP-compatible proof in connection calculus is currently a moving target, so the format is subject to change. Output is to stdout.")
 
  227        "Generate Prolog format files proof.pl and matrix.pl and store in the $CONNECTPP_PATH directory. You can check these using the check_proof utility.")
 
  229        "Verify any proof found using the internal proof checker. Use this version to get a detailed description of the verification sent to stdout.")
 
  231        "Verify any proof found using the internal proof checker. Use this version for a quiet verification that only adds \"Verified\" or \"FaliedVerification\" to the output string."); 
 
  233  po::options_description latex_options(
"LaTeX output");
 
  234  latex_options.add_options()
 
  235    (
"latex", po::value<string>(), 
 
  236        "Make a LaTeX file containing a typeset proof. Use \"default\" for \"./latex_proof.tex\" or specify a destination.")
 
  238        "Include substitutions in the LaTeX proof.")
 
  240        "Typeset the latex proof in a tiny font.")
 
  242        "Don't include the matrix in the LaTeX proof.");
 
  244  po::options_description all_options(
"Options");
 
  245  all_options.add(main_options)
 
  246    .add(conversion_options)
 
  249    .add(backtrack_options)
 
  254  po::positional_options_description pos_opts;
 
  255  pos_opts.add(
"input", -1);
 
  256  po::variables_map vars_map;
 
  258    po::store(po::command_line_parser(argc, argv).
 
  259              options(all_options).
 
  260              positional(pos_opts).
 
  266  catch (boost::program_options::error& err) {
 
  267      cout << 
"% SZS status Error for " 
  268           << params::problem_name << 
" : " << err.what() << endl;
 
  271  po::notify(vars_map);
 
  276  if (vars_map.count(
"help")) {
 
  277    cout << all_options << endl;
 
  280  if (vars_map.count(
"version")) {
 
  281    cout << 
"Connect++ Version V" << VERSION << 
"." << endl;
 
  282    cout << 
"Copyright © 2021-24 Sean Holden. All rights reserved." << endl;
 
  285  if (vars_map.count(
"verbosity")) {
 
  286    int v = vars_map[
"verbosity"].as<
int>();
 
  287    if (v >= 0 && v <= 3) 
 
  288      params::verbosity = v;
 
  290      cerr << 
"Verbosity should be between 0 and 3. Using default (2)." << endl;
 
  295  VPrint show(params::verbosity);
 
  299  if (vars_map.count(
"sub-output")) {
 
  300      params::output_terms_with_substitution = 
true;
 
  302  if (vars_map.count(
"indent")) {
 
  303    int i = vars_map[
"indent"].as<
int>();
 
  304    if (i >= 0 && i <= UINT8_MAX)
 
  305      params::indent_size = i;
 
  307      cerr << 
"Indent size is negative or too large. Using default." << endl;
 
  309  if (vars_map.count(
"out-int")) {
 
  310    int i = vars_map[
"out-int"].as<
int>();
 
  311    if (i > 0 && i <= UINT32_MAX)
 
  312      params::output_frequency = i;
 
  314      cerr << 
"Interval is negative or too large. Using default." << endl;
 
  316  if (vars_map.count(
"no-equality")) {
 
  317    params::add_equality_axioms = 
false;
 
  319  if (vars_map.count(
"equality-last")) {
 
  320    params::equality_axioms_at_start = 
false;
 
  322  if (vars_map.count(
"all-distinct-objects")) {
 
  323    params::all_distinct_objects = 
true;
 
  325  if (vars_map.count(
"no-distinct-objects")) {
 
  326    if (params::all_distinct_objects) {
 
  327      cerr << 
"Cancelled --all-distinct-objects." << endl;
 
  328      params::all_distinct_objects = 
false;
 
  330    params::no_distinct_objects = 
true;
 
  332  if (vars_map.count(
"timeout")) {
 
  333    params::timeout = 
true;
 
  334    int t = vars_map[
"timeout"].as<
int>();
 
  337        params::timeout_value = t;
 
  339        cerr << 
"Timeout is too small. Using 10 seconds." << endl;
 
  340        params::timeout_value = 10;
 
  344      cerr << 
"Timeout should be positive. Using default." << endl;
 
  346  if (vars_map.count(
"show-default-schedule")) {
 
  347    params::set_default_schedule();
 
  348    cout << params::default_schedule << endl;
 
  351  if (vars_map.count(
"path")) {
 
  352    params::connectpp_path = vars_map[
"path"].as<
string>();
 
  358  params::LaTeX_proof_path 
 
  359    = params::pwd_path / params::LaTeX_proof_path;
 
  360  params::Prolog_matrix_path 
 
  361    = params::connectpp_path / params::Prolog_matrix_path;
 
  362  params::Prolog_proof_path 
 
  363    = params::connectpp_path / params::Prolog_proof_path;
 
  364  params::output_summary_path 
 
  365    = params::pwd_path / params::output_summary_path;
 
  369  if (vars_map.count(
"output")) {
 
  370    params::write_output_summary = 
true;
 
  371    string op = vars_map[
"output"].as<
string>();
 
  373      params::output_summary_path = op;
 
  375  if (vars_map.count(
"all-definitional")) {
 
  376    params::all_definitional = 
true;
 
  378  if (vars_map.count(
"no-definitional")) {
 
  379    params::no_definitional = 
true;
 
  380    if (params::all_definitional) {
 
  381      cerr << 
"Setting --no-definitional has cancelled --all-definitional." << endl;
 
  382      params::all_definitional = 
false;
 
  386  if (vars_map.count(
"schedule")) {
 
  387    params::use_schedule = 
true;
 
  388    if (!params::timeout) {
 
  389      params::timeout = 
true;
 
  390      params::timeout_value = 600;
 
  392    params::schedule_path = vars_map[
"schedule"].as<
string>();
 
  394      schedule.read_schedule_from_file(params::schedule_path);
 
  396    catch (std::exception& err) {
 
  397      cout << 
"% SZS status Error for " 
  398           << params::problem_name << 
" : " << err.what() << endl;
 
  406  if (vars_map.count(
"tptp")) {
 
  407    params::tptp_path = vars_map[
"tptp"].as<
string>();
 
  409  if (vars_map.count(
"reorder")) {
 
  410    int n = vars_map[
"reorder"].as<
int>();
 
  412      params::deterministic_reorder = 
true;
 
  413      params::number_of_reorders = n;
 
  416      cerr << 
"Number of re-orders should be positive. Skipping." << endl;
 
  418  if (vars_map.count(
"random-seed")) {
 
  419    int seed = vars_map[
"random-seed"].as<
int>();
 
  421      params::random_seed = 
static_cast<unsigned>(seed);
 
  422      params::boost_random_seed = 
static_cast<uint32_t
>(seed);
 
  425      cerr << 
"Error: random seed must be a non-negative integer. Using default of 0." << endl;
 
  428  if (vars_map.count(
"random-reorder")) {
 
  429    params::random_reorder = 
true;
 
  431  if (vars_map.count(
"random-reorder-literals")) {
 
  432    params::random_reorder_literals = 
true;
 
  434  if (vars_map.count(
"no-miniscope")) {
 
  435    params::miniscope = 
false;
 
  437  if (vars_map.count(
"show-clauses")) {
 
  438    params::show_clauses = 
true;
 
  440  if (vars_map.count(
"no-colour")) {
 
  441    params::use_colours = 
false;
 
  443  if (vars_map.count(
"poly-unification")) {
 
  444    params::poly_unification = 
true;
 
  464  fs::path initial_path;
 
  465  bool found_file = 
false;
 
  466  if (vars_map.count(
"input")) {
 
  468    initial_path = vars_map[
"input"].as<
string>();
 
  471    if (initial_path.is_relative()) {
 
  473      if (fs::exists(initial_path)) {
 
  477          initial_path = fs::canonical(initial_path);
 
  479        catch (std::filesystem::filesystem_error& err) {
 
  480          cout << 
"% SZS status Error for "  
  481               << params::problem_name << 
" : "  
  482               << err.what() << endl;
 
  490         fs::path tptp_path(params::tptp_path);
 
  491         initial_path = tptp_path / initial_path;
 
  493         if (fs::exists(initial_path)) {
 
  496            initial_path = fs::canonical(initial_path);
 
  498          catch (std::filesystem::filesystem_error& err) {
 
  499            cout << 
"% SZS status Error for "  
  500                 << params::problem_name << 
" : "  
  501                 << err.what() << endl;
 
  510      if (initial_path.is_absolute() && fs::exists(initial_path)) {
 
  513          initial_path = fs::canonical(initial_path);
 
  515        catch (std::filesystem::filesystem_error& err) {
 
  516            cout << 
"% SZS status Error for "  
  517                 << params::problem_name << 
" : "  
  518                 << err.what() << endl;
 
  526    cout << 
"% SZS status Error for "  
  527         << params::problem_name << 
" : no problem specified."  << endl;
 
  532    cout << 
"% SZS status Error for "  
  533         << params::problem_name << 
" : the specified file does not exist."  << endl;
 
  537  params::full_problem_path = initial_path;
 
  538  params::full_problem_path.remove_filename();
 
  539  params::problem_name = initial_path.stem().string();
 
  540  fs::path path = initial_path;
 
  545  if (vars_map.count(
"depth-limit")) {
 
  546    int l = vars_map[
"depth-limit"].as<
int>();
 
  548      params::depth_limit = l;
 
  550      cerr << 
"Depth limit should be positive. Using default." << endl;
 
  552  if (vars_map.count(
"start-depth")) {
 
  553    int l = vars_map[
"start-depth"].as<
int>();
 
  554    if (l > 1 && l <= params::depth_limit)
 
  555      params::start_depth = l;
 
  557      cerr << 
"Start depth should be positive and bounded by the maximum depth. Using default." << endl;
 
  559  if (vars_map.count(
"depth-increment")) {
 
  560    int l = vars_map[
"depth-increment"].as<
int>();
 
  562      params::depth_increment = l;
 
  564      cerr << 
"Depth increment should be positive. Using default." << endl;
 
  566  if (vars_map.count(
"depth-limit-all")) {
 
  567    params::depth_limit_all = 
true;
 
  569  if (vars_map.count(
"limit-by-tree-depth")) {
 
  570    params::limit_by_tree_depth = 
true;
 
  584  if (vars_map.count(
"restrict-start")) {
 
  585    params::restrict_start = 
true;
 
  587  if (vars_map.count(
"pos-neg-start")) {
 
  588    params::all_pos_neg_start = 
true;
 
  590  if (vars_map.count(
"conjecture-start")) {
 
  591    params::conjecture_start = 
true;
 
  593  if (vars_map.count(
"all-start")) {
 
  594    show(2, 
string(
"--all-start set. This cancels all other start options."), 
true);
 
  607  if (vars_map.count(
"no-regularity")) {
 
  608    params::use_regularity_test = 
false;
 
  610  if (vars_map.count(
"lemmata-backtrack")) {
 
  611    params::limit_bt_lemmas = 
false;
 
  613  if (vars_map.count(
"reduction-backtrack")) {
 
  614    params::limit_bt_reductions = 
false;
 
  616  if (vars_map.count(
"extension-backtrack")) {
 
  617    params::limit_bt_extensions = 
false;
 
  619  if (vars_map.count(
"explore-left-trees")) {
 
  620    params::limit_bt_extensions_left_tree = 
false;
 
  622  if (vars_map.count(
"all-backtrack")) {
 
  623    show(2, 
string(
"--all-backtrack set. This prevails over all other backtracking options."), 
true);
 
  626  if (vars_map.count(
"all-reductions")) {
 
  627    params::limit_reductions = 
false;
 
  629   if (vars_map.count(
"all-extensions")) {
 
  630    params::limit_extensions = 
false;
 
  632  if (vars_map.count(
"all-lemmata")) {
 
  633    params::limit_lemmata = 
false;
 
  635  if (vars_map.count(
"no-lemmata")) {
 
  636    params::use_lemmata = 
false;
 
  638  if (vars_map.count(
"complete")) {
 
  639    int d = vars_map[
"complete"].as<
int>();
 
  640    if (d >= params::start_depth)
 
  641      params::switch_to_complete = d;
 
  643      cerr << 
"Switch to complete search must happen after start depth. Using start depth." << endl;
 
  644      params::switch_to_complete = params::start_depth;
 
  647  if (vars_map.count(
"latex")) {
 
  648      params::generate_LaTeX_proof = 
true;
 
  649      params::build_proof = 
true;
 
  650      string lp = vars_map[
"latex"].as<
string>();
 
  652        params::LaTeX_proof_path = lp;
 
  654  if (vars_map.count(
"sub-latex")) {
 
  655      params::sub_LaTeX_proof = 
true;
 
  657  if (vars_map.count(
"tiny-latex")) {
 
  658      params::latex_tiny_proof = 
true;
 
  660  if (vars_map.count(
"latex-no-matrix")) {
 
  661      params::latex_include_matrix = 
false;
 
  663  if (vars_map.count(
"tptp-proof")) {
 
  664    params::generate_tptp_proof = 
true;
 
  665    params::build_proof = 
true;
 
  667  if (vars_map.count(
"prolog-proof")) {
 
  668    params::generate_Prolog_proof = 
true;
 
  669    params::build_proof = 
true;
 
  671  if (vars_map.count(
"verify")) {
 
  672      params::verify_proof = 
true;
 
  673      params::build_proof = 
true;
 
  675  if (vars_map.count(
"full-verify")) {
 
  676      params::verify_proof = 
true;
 
  677      params::verify_proof_verbose = 
true;
 
  678      params::build_proof = 
true;
 
  692  show(1, 
string(
"Connect++ V"));
 
  693  show(1, 
string(VERSION));
 
  694  show(1, 
string(
" started at: "));
 
  695  time_t date_and_time;
 
  696  time(&date_and_time);
 
  697  show(1, asctime(localtime(&date_and_time)));
 
  721  if (params::use_schedule) {
 
  722    params::no_definitional = 
false;
 
  723    params::all_definitional = 
false;
 
  725  show(1, 
string(
"Reading from: "));
 
  726  show(1, path.c_str(), 
true);
 
  727  bool found_conjecture = 
false;
 
  732  catch (std::exception& err) {
 
  733    cout << 
"% SZS status Error for "  
  734         << params::problem_name << 
" : "  
  735         << err.what() << endl;
 
  742  if (params::use_schedule) {
 
  743    params::all_definitional = 
true;
 
  747    catch (std::exception& err) {
 
  748      cout << 
"% SZS status Error for "  
  749           << params::problem_name << 
" : "  
  750           << err.what() << endl;
 
  753    params::all_definitional = 
false;
 
  754    params::no_definitional = 
true;
 
  758    catch (std::exception& err) {
 
  759      cout << 
"% SZS status Error for "  
  760           << params::problem_name << 
" : "  
  761           << err.what() << endl;
 
  769  chrono::milliseconds parse_time =
 
  770    chrono::duration_cast<chrono::milliseconds>(chrono::steady_clock::now() - startTime);
 
  771  show(1, 
string(
"Total parse and conversion time: "));
 
  772  show(1, std::to_string(parse_time.count()));
 
  773  show(1, 
string(
" milliseconds."), 
true);
 
  779  show(2, 
string(
"Starting proof attempt for: "), 
false);
 
  780  show(2, params::problem_name, 
true);
 
  784  ProverOutcome prover_outcome;
 
  785  ProverOutcome final_outcome;
 
  786  final_outcome = ProverOutcome::TimeOut;
 
  796  if (!params::use_schedule) {
 
  797    if (params::verbosity > 2) {
 
  807    if (params::timeout) {
 
  808      chrono::seconds timeout_duration(params::timeout_value);
 
  809      prover_standard.
set_timeout(startTime + timeout_duration);
 
  814    prover_outcome = prover_standard.
prove();
 
  815    final_outcome = prover_outcome;
 
  830    if (!params::timeout) {
 
  831      params::timeout = 
true;
 
  832      params::timeout_value = 600;
 
  837    chrono::milliseconds time_chunk((params::timeout_value * 1000) / 100);
 
  838    chrono::steady_clock::time_point start_time = startTime;
 
  839    chrono::milliseconds chunk_time;
 
  844    size_t schedule_step_number = 1;
 
  845    pair<bool, unsigned int> next_schedule = 
schedule.set_next_schedule();
 
  846    if (params::verbosity > 0)
 
  851    while (next_schedule.first) {
 
  852      show(1, 
string(
"Schedule step "));
 
  853      show(1, std::to_string(schedule_step_number));
 
  854      show(1, 
string(
": "));
 
  855      show(1, 
schedule.step_to_string(schedule_step_number - 1), 
true);
 
  856      if (params::verbosity > 2) {
 
  862      if (params::all_definitional) {
 
  863        prover = &prover_all_definitional;
 
  865      else if (params::no_definitional) {
 
  866        prover = &prover_no_definitional;
 
  869        prover = &prover_standard;
 
  874      if (next_schedule.second == 0) { 
 
  875        prover->
set_timeout(startTime + chrono::seconds(params::timeout_value));
 
  877      else if (schedule_step_number == 1) {
 
  878        prover->
set_timeout(startTime + (next_schedule.second * time_chunk));
 
  881        prover->
set_timeout(start_time + (next_schedule.second * time_chunk));
 
  884      prover_outcome = prover->
prove();
 
  886      if (prover_outcome == ProverOutcome::Valid ||
 
  887        prover_outcome == ProverOutcome::Error ||
 
  888        prover_outcome == ProverOutcome::False) {
 
  889          final_outcome = prover_outcome;
 
  893      chunk_time = chrono::duration_cast<chrono::milliseconds>(chrono::steady_clock::now() - start_time);
 
  896      show(1, 
string(
"Timeout after "));
 
  897      show(1, std::to_string(chunk_time.count()));
 
  898      show(1, 
string(
" milliseconds"), 
true);
 
  900      start_time = chrono::steady_clock::now();
 
  901      schedule_step_number++;
 
  902      next_schedule = 
schedule.set_next_schedule();
 
  915  chrono::milliseconds runTime =
 
  916    chrono::duration_cast<chrono::milliseconds>(chrono::steady_clock::now() - startTime);
 
  917  show(1, 
string(
"Total run time: "));
 
  918  show(1, std::to_string(runTime.count()));
 
  919  show(1, 
string(
" milliseconds."), 
true);
 
  921  if (params::verbosity > 0) {
 
  922    if (params::show_full_stats) {
 
  952   cout << 
"% SZS status ";
 
  953   switch (final_outcome) {
 
  954    case ProverOutcome::Valid:
 
  957        outcome = 
"Unsatisfiable";
 
  961        if (simplified_has_axioms) {
 
  964            outcome = 
"ContradictoryAxioms";
 
  967          else if (conj_false || neg_conj_removed) {
 
  968            outcome = 
"ContradictoryAxioms";
 
  972          else if (conj_missing) {
 
  973            outcome = 
"Unsatisfiable";
 
  987          if (neg_conj_removed) {
 
  996    case ProverOutcome::False:
 
  999        outcome = 
"Satisfiable";
 
 1002        if (simplified_has_axioms) {
 
 1006          else if (conj_false || neg_conj_removed) {
 
 1007            outcome = 
"CounterSatisfiable";
 
 1009          else if (conj_missing) {
 
 1010            outcome = 
"Satisfiable";
 
 1013            outcome = 
"CounterSatisfiable";
 
 1019            outcome = 
"Theorem";
 
 1021          else if (neg_conj_removed) {
 
 1026            outcome = 
"CounterSatisfiable";
 
 1030    case ProverOutcome::PathLenLimit:
 
 1033    case ProverOutcome::Error:
 
 1036    case ProverOutcome::TimeOut:
 
 1040      if (chrono::duration_cast<chrono::milliseconds>(chrono::steady_clock::now() - startTime).count() < (params::timeout_value * 1000))
 
 1043        outcome = 
"Timeout";
 
 1049  cout << outcome << 
" for " << params::problem_name;
 
 1053  bool verified = 
false;
 
 1054  if (params::verify_proof && final_outcome == ProverOutcome::Valid) {
 
 1061    vector<pair<string, vector<size_t>>> 
 
 1066                         get<0>(inds), get<3>(inds));
 
 1068    bool verification_outcome;
 
 1069    string outcome_string;
 
 1070    if (params::verify_proof_verbose) {
 
 1071      pair<bool, string> outcome = checker.check_proof_verbose();
 
 1072      verification_outcome = outcome.first;
 
 1073      outcome_string = outcome.second;
 
 1076      verification_outcome = checker.check_proof();
 
 1079    if (verification_outcome) {
 
 1081        cout << 
" : Verified";
 
 1084        cout << 
" : FailedVerification";
 
 1087    if (params::verify_proof_verbose) {
 
 1088      cout << endl << 
"% SZS output start Proof for " << params::problem_name << endl << endl;
 
 1089      cout << outcome_string << endl;
 
 1090      cout << 
"% SZS output end Proof for " << params::problem_name << endl;
 
 1097  if (params::write_output_summary) {
 
 1099      std::ofstream out_file(params::output_summary_path);
 
 1100      out_file << 
"ProblemName: " << params::problem_name << endl;
 
 1101      if (found_conjecture) 
 
 1102        out_file << 
"ConjectureFound" << endl;
 
 1104        out_file << 
"NoConjectureFound" << endl; 
 
 1106        status = 
"NoStatus";
 
 1107      out_file << 
"ProblemStatus: " << status << endl;
 
 1108      out_file << 
"ProverOutcome: " << outcome << endl;
 
 1109      if (params::verify_proof && final_outcome == ProverOutcome::Valid) {
 
 1111          out_file << 
"Verified" << endl;
 
 1113          out_file << 
"FailedVerification" << endl; 
 
 1116        out_file << 
"NoVerify" << endl;
 
 1117      out_file << 
"Time: " << runTime.count() << endl;
 
 1120    catch (std::exception& err) {
 
 1121      cerr << 
"Error: can't write output summary." << endl;
 
 1127  if (params::generate_tptp_proof && (final_outcome == ProverOutcome::Valid)) {
 
 1128    cout << 
"% SZS output start Proof for " << params::problem_name << endl;
 
 1129    cout << prover->get_tptp_conversion_string();
 
 1131    cout << 
"% SZS output end Proof for " << params::problem_name << endl;
 
 1133  return EXIT_SUCCESS;
 
Mechanism for looking after functions.
Management of Predicate objects.
Prover using a pair of stacks to conduct the proof search.
void read_from_tptp_file(const string &, bool &, size_t &)
Obviously, reads a problem from a TPTP file.
void show_full_statistics(size_t) const
Display counts of number of extensions tried and so on, as well as numbers per second.
bool problem_has_true_conjecture() const
Find out whether the problem's conjecture   is $true.
void show_tptp_proof()
Show a Prolog-formatted proof.
bool problem_is_cnf_only() const
Find out whether the problem is CNF only.
void set_problem_path(fs::path &p)
Set the path for the problem being solved.
void show_statistics() const
Display counts of number of extensions tried and so on.
void show_matrix()
Show a nicely formatted matrix.
bool problem_has_missing_conjecture() const
Find out whether the problem's conjecture   is missing, in the sense that it didn't appear in the inp...
bool problem_has_negated_conjecture_removed() const
Find out whether the problem's   negated conjecture was simplified out.
void set_timeout(chrono::steady_clock::time_point time)
Set a timeout.
bool simplified_problem_has_fof_axioms() const
Find out from the parser whether the problem had axioms after simplification.
string get_status() const
Straightforward get method.
bool problem_has_fof_axioms() const
Find out from the parser whether the problem had axioms before simplification.
std::tuple< VariableIndex *, FunctionIndex *, PredicateIndex *, TermIndex * > get_indexes()
Straightforward get method.
vector< pair< string, vector< size_t > > > get_internal_proof() const
Get an internal representation of the proof stack.
Matrix & get_matrix()
Get a reference to the matrix.
bool problem_has_false_conjecture() const
Find out whether the problem's conjecture   is $false.
ProverOutcome prove()
Here is where the magic happens.
Look after terms, using hash consing to avoid storing copies of terms.
Storage of named variables, and management of new, anonymous and unique variables.
Wrap up the parsing process and the operation of a schedule in a single class.
Hide all the global stuff in this namespace.
static void set_all_backtrack()
Self-explanatory.
static void set_all_start()
Self-explanatory.
static bool no_start_options()
Self-explanatory.
static void correct_missing_start_options()
Self-explanatory.
static void show_search_parameter_settings()
Give a detailed indication of what the parameters affecting the search are currently set to.