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 |
|
namespace cvc5::options { |
26 |
|
|
27 |
|
// clang-format off |
28 |
|
std::ostream& operator<<(std::ostream& os, ProofCheckMode mode) |
29 |
|
{ |
30 |
|
switch(mode) |
31 |
|
{ |
32 |
|
case ProofCheckMode::NONE: return os << "ProofCheckMode::NONE"; |
33 |
|
case ProofCheckMode::LAZY: return os << "ProofCheckMode::LAZY"; |
34 |
|
case ProofCheckMode::EAGER: return os << "ProofCheckMode::EAGER"; |
35 |
|
case ProofCheckMode::EAGER_SIMPLE: return os << "ProofCheckMode::EAGER_SIMPLE"; |
36 |
|
default: Unreachable(); |
37 |
|
} |
38 |
|
return os; |
39 |
|
} |
40 |
2 |
ProofCheckMode stringToProofCheckMode(const std::string& optarg) |
41 |
|
{ |
42 |
2 |
if (optarg == "none") return ProofCheckMode::NONE; |
43 |
2 |
else if (optarg == "lazy") return ProofCheckMode::LAZY; |
44 |
2 |
else if (optarg == "eager") return ProofCheckMode::EAGER; |
45 |
|
else if (optarg == "eager-simple") return ProofCheckMode::EAGER_SIMPLE; |
46 |
|
else if (optarg == "help") |
47 |
|
{ |
48 |
|
std::cerr << R"FOOBAR( |
49 |
|
Proof checking modes. |
50 |
|
Available modes for --proof-check are: |
51 |
|
+ none |
52 |
|
do not check rule applications |
53 |
|
+ lazy (default) |
54 |
|
check rule applications only during final proof construction |
55 |
|
+ eager |
56 |
|
check rule applications and proofs from generators eagerly for local debugging |
57 |
|
+ eager-simple |
58 |
|
check rule applications during construction |
59 |
|
)FOOBAR"; |
60 |
|
std::exit(1); |
61 |
|
} |
62 |
|
throw OptionException(std::string("unknown option for --proof-check: `") + |
63 |
|
optarg + "'. Try --proof-check=help."); |
64 |
|
} |
65 |
|
std::ostream& operator<<(std::ostream& os, ProofFormatMode mode) |
66 |
|
{ |
67 |
|
switch(mode) |
68 |
|
{ |
69 |
|
case ProofFormatMode::NONE: return os << "ProofFormatMode::NONE"; |
70 |
|
case ProofFormatMode::DOT: return os << "ProofFormatMode::DOT"; |
71 |
|
case ProofFormatMode::TPTP: return os << "ProofFormatMode::TPTP"; |
72 |
|
case ProofFormatMode::VERIT: return os << "ProofFormatMode::VERIT"; |
73 |
|
default: Unreachable(); |
74 |
|
} |
75 |
|
return os; |
76 |
|
} |
77 |
|
ProofFormatMode stringToProofFormatMode(const std::string& optarg) |
78 |
|
{ |
79 |
|
if (optarg == "none") return ProofFormatMode::NONE; |
80 |
|
else if (optarg == "dot") return ProofFormatMode::DOT; |
81 |
|
else if (optarg == "tptp") return ProofFormatMode::TPTP; |
82 |
|
else if (optarg == "verit") return ProofFormatMode::VERIT; |
83 |
|
else if (optarg == "help") |
84 |
|
{ |
85 |
|
std::cerr << R"FOOBAR( |
86 |
|
Proof format modes. |
87 |
|
Available modes for --proof-format-mode are: |
88 |
|
+ none (default) |
89 |
|
Do not translate proof output |
90 |
|
+ dot |
91 |
|
Output DOT proof |
92 |
|
+ tptp |
93 |
|
Output TPTP proof (work in progress) |
94 |
|
+ verit |
95 |
|
Output veriT proof |
96 |
|
)FOOBAR"; |
97 |
|
std::exit(1); |
98 |
|
} |
99 |
|
throw OptionException(std::string("unknown option for --proof-format-mode: `") + |
100 |
|
optarg + "'. Try --proof-format-mode=help."); |
101 |
|
} |
102 |
|
std::ostream& operator<<(std::ostream& os, ProofGranularityMode mode) |
103 |
|
{ |
104 |
|
switch(mode) |
105 |
|
{ |
106 |
|
case ProofGranularityMode::DSL_REWRITE: return os << "ProofGranularityMode::DSL_REWRITE"; |
107 |
|
case ProofGranularityMode::REWRITE: return os << "ProofGranularityMode::REWRITE"; |
108 |
|
case ProofGranularityMode::THEORY_REWRITE: return os << "ProofGranularityMode::THEORY_REWRITE"; |
109 |
|
case ProofGranularityMode::OFF: return os << "ProofGranularityMode::OFF"; |
110 |
|
default: Unreachable(); |
111 |
|
} |
112 |
|
return os; |
113 |
|
} |
114 |
|
ProofGranularityMode stringToProofGranularityMode(const std::string& optarg) |
115 |
|
{ |
116 |
|
if (optarg == "dsl-rewrite") return ProofGranularityMode::DSL_REWRITE; |
117 |
|
else if (optarg == "rewrite") return ProofGranularityMode::REWRITE; |
118 |
|
else if (optarg == "theory-rewrite") return ProofGranularityMode::THEORY_REWRITE; |
119 |
|
else if (optarg == "off") return ProofGranularityMode::OFF; |
120 |
|
else if (optarg == "help") |
121 |
|
{ |
122 |
|
std::cerr << R"FOOBAR( |
123 |
|
Modes for proof granularity. |
124 |
|
Available modes for --proof-granularity are: |
125 |
|
+ dsl-rewrite |
126 |
|
Allow DSL rewrites and evaluation steps, expand macros, rewrite, substitution, |
127 |
|
and theory rewrite steps. |
128 |
|
+ rewrite |
129 |
|
Allow rewrite or substitution steps, expand macros. |
130 |
|
+ theory-rewrite (default) |
131 |
|
Allow theory rewrite steps, expand macros, rewrite and substitution steps. |
132 |
|
+ off |
133 |
|
Do not improve the granularity of proofs. |
134 |
|
)FOOBAR"; |
135 |
|
std::exit(1); |
136 |
|
} |
137 |
|
throw OptionException(std::string("unknown option for --proof-granularity: `") + |
138 |
|
optarg + "'. Try --proof-granularity=help."); |
139 |
|
} |
140 |
|
// clang-format on |
141 |
|
|
142 |
|
namespace proof |
143 |
|
{ |
144 |
|
// clang-format off |
145 |
|
void setDefaultProofCheck(Options& opts, ProofCheckMode value) |
146 |
|
{ |
147 |
|
if (!opts.proof.proofCheckWasSetByUser) opts.proof.proofCheck = value; |
148 |
|
} |
149 |
|
void setDefaultProofFormatMode(Options& opts, ProofFormatMode value) |
150 |
|
{ |
151 |
|
if (!opts.proof.proofFormatModeWasSetByUser) opts.proof.proofFormatMode = value; |
152 |
|
} |
153 |
|
void setDefaultProofGranularityMode(Options& opts, ProofGranularityMode value) |
154 |
|
{ |
155 |
|
if (!opts.proof.proofGranularityModeWasSetByUser) opts.proof.proofGranularityMode = value; |
156 |
|
} |
157 |
|
void setDefaultProofPedantic(Options& opts, uint64_t value) |
158 |
|
{ |
159 |
|
if (!opts.proof.proofPedanticWasSetByUser) opts.proof.proofPedantic = value; |
160 |
|
} |
161 |
|
void setDefaultProofPpMerge(Options& opts, bool value) |
162 |
|
{ |
163 |
|
if (!opts.proof.proofPpMergeWasSetByUser) opts.proof.proofPpMerge = value; |
164 |
|
} |
165 |
|
void setDefaultProofPrintConclusion(Options& opts, bool value) |
166 |
|
{ |
167 |
|
if (!opts.proof.proofPrintConclusionWasSetByUser) opts.proof.proofPrintConclusion = value; |
168 |
|
} |
169 |
|
// clang-format on |
170 |
|
} |
171 |
|
|
172 |
29577 |
} // namespace cvc5::options |