GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/src/options/proof_options.cpp Lines: 1 73 1.4 %
Date: 2021-08-20 Branches: 2 68 2.9 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Mathias Preiner, Aina Niemetz
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * Option template for option modules.
14
 *
15
 * For each <module>_options.toml configuration file, mkoptions.py
16
 * expands this template and generates a <module>_options.cpp file.
17
 */
18
#include "options/proof_options.h"
19
20
#include <iostream>
21
22
#include "base/check.h"
23
#include "options/option_exception.h"
24
25
// clang-format off
26
namespace cvc5::options {
27
28
std::ostream& operator<<(std::ostream& os, ProofFormatMode mode)
29
{
30
  switch(mode) {
31
    case ProofFormatMode::TPTP:
32
      return os << "ProofFormatMode::TPTP";
33
    case ProofFormatMode::DOT:
34
      return os << "ProofFormatMode::DOT";
35
    case ProofFormatMode::VERIT:
36
      return os << "ProofFormatMode::VERIT";
37
    case ProofFormatMode::NONE:
38
      return os << "ProofFormatMode::NONE";
39
    default:
40
      Unreachable();
41
  }
42
  return os;
43
}
44
ProofFormatMode stringToProofFormatMode(const std::string& optarg)
45
{
46
  if (optarg == "tptp")
47
  {
48
    return ProofFormatMode::TPTP;
49
  }
50
  else if (optarg == "dot")
51
  {
52
    return ProofFormatMode::DOT;
53
  }
54
  else if (optarg == "verit")
55
  {
56
    return ProofFormatMode::VERIT;
57
  }
58
  else if (optarg == "none")
59
  {
60
    return ProofFormatMode::NONE;
61
  }
62
  else if (optarg == "help")
63
  {
64
    std::cerr << "Proof format modes.\n"
65
         "Available modes for --proof-format-mode are:\n"
66
         "+ tptp\n"
67
         "  Output TPTP proof (work in progress)\n"
68
         "+ dot\n"
69
         "  Output DOT proof\n"
70
         "+ verit\n"
71
         "  Output veriT proof\n"
72
         "+ none (default)\n"
73
         "  Do not translate proof output\n";
74
    std::exit(1);
75
  }
76
  throw OptionException(std::string("unknown option for --proof-format-mode: `") +
77
                        optarg + "'.  Try --proof-format-mode=help.");
78
}
79
std::ostream& operator<<(std::ostream& os, ProofGranularityMode mode)
80
{
81
  switch(mode) {
82
    case ProofGranularityMode::OFF:
83
      return os << "ProofGranularityMode::OFF";
84
    case ProofGranularityMode::DSL_REWRITE:
85
      return os << "ProofGranularityMode::DSL_REWRITE";
86
    case ProofGranularityMode::THEORY_REWRITE:
87
      return os << "ProofGranularityMode::THEORY_REWRITE";
88
    case ProofGranularityMode::REWRITE:
89
      return os << "ProofGranularityMode::REWRITE";
90
    default:
91
      Unreachable();
92
  }
93
  return os;
94
}
95
ProofGranularityMode stringToProofGranularityMode(const std::string& optarg)
96
{
97
  if (optarg == "off")
98
  {
99
    return ProofGranularityMode::OFF;
100
  }
101
  else if (optarg == "dsl-rewrite")
102
  {
103
    return ProofGranularityMode::DSL_REWRITE;
104
  }
105
  else if (optarg == "theory-rewrite")
106
  {
107
    return ProofGranularityMode::THEORY_REWRITE;
108
  }
109
  else if (optarg == "rewrite")
110
  {
111
    return ProofGranularityMode::REWRITE;
112
  }
113
  else if (optarg == "help")
114
  {
115
    std::cerr << "Modes for proof granularity.\n"
116
         "Available modes for --proof-granularity are:\n"
117
         "+ off\n"
118
         "  Do not improve the granularity of proofs.\n"
119
         "+ dsl-rewrite\n"
120
         "  Allow DSL rewrites and evaluation steps, expand macros, rewrite, substitution,\n"
121
         "  and theory rewrite steps.\n"
122
         "+ theory-rewrite (default)\n"
123
         "  Allow theory rewrite steps, expand macros, rewrite and substitution steps.\n"
124
         "+ rewrite\n"
125
         "  Allow rewrite or substitution steps, expand macros.\n";
126
    std::exit(1);
127
  }
128
  throw OptionException(std::string("unknown option for --proof-granularity: `") +
129
                        optarg + "'.  Try --proof-granularity=help.");
130
}
131
132
namespace proof
133
{
134
// clang-format off
135
void setDefaultProofEagerChecking(Options& opts, bool value)
136
{
137
    if (!opts.proof.proofEagerCheckingWasSetByUser) {
138
        opts.proof.proofEagerChecking = value;
139
    }
140
}
141
void setDefaultProofFormatMode(Options& opts, ProofFormatMode value)
142
{
143
    if (!opts.proof.proofFormatModeWasSetByUser) {
144
        opts.proof.proofFormatMode = value;
145
    }
146
}
147
void setDefaultProofGranularityMode(Options& opts, ProofGranularityMode value)
148
{
149
    if (!opts.proof.proofGranularityModeWasSetByUser) {
150
        opts.proof.proofGranularityMode = value;
151
    }
152
}
153
void setDefaultProofPedantic(Options& opts, uint64_t value)
154
{
155
    if (!opts.proof.proofPedanticWasSetByUser) {
156
        opts.proof.proofPedantic = value;
157
    }
158
}
159
void setDefaultProofPrintConclusion(Options& opts, bool value)
160
{
161
    if (!opts.proof.proofPrintConclusionWasSetByUser) {
162
        opts.proof.proofPrintConclusion = value;
163
    }
164
}
165
// clang-format on
166
}
167
168
29358
}  // namespace cvc5::options
169
// clang-format on