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