GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/src/options/proof_options.cpp Lines: 17 79 21.5 %
Date: 2021-05-24 Branches: 2 55 3.6 %

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 {
27
28
1318
template <> options::proofEagerChecking__option_t::type& Options::ref(
29
    options::proofEagerChecking__option_t)
30
{
31
1318
    return proof().proofEagerChecking;
32
}
33
14013538
template <> const options::proofEagerChecking__option_t::type& Options::operator[](
34
    options::proofEagerChecking__option_t) const
35
{
36
14013538
  return proof().proofEagerChecking;
37
}
38
template <> bool Options::wasSetByUser(options::proofEagerChecking__option_t) const
39
{
40
  return proof().proofEagerChecking__setByUser__;
41
}
42
template <> options::proofFormatMode__option_t::type& Options::ref(
43
    options::proofFormatMode__option_t)
44
{
45
    return proof().proofFormatMode;
46
}
47
3601
template <> const options::proofFormatMode__option_t::type& Options::operator[](
48
    options::proofFormatMode__option_t) const
49
{
50
3601
  return proof().proofFormatMode;
51
}
52
template <> bool Options::wasSetByUser(options::proofFormatMode__option_t) const
53
{
54
  return proof().proofFormatMode__setByUser__;
55
}
56
2409
template <> options::proofGranularityMode__option_t::type& Options::ref(
57
    options::proofGranularityMode__option_t)
58
{
59
2409
    return proof().proofGranularityMode;
60
}
61
5916
template <> const options::proofGranularityMode__option_t::type& Options::operator[](
62
    options::proofGranularityMode__option_t) const
63
{
64
5916
  return proof().proofGranularityMode;
65
}
66
2409
template <> bool Options::wasSetByUser(options::proofGranularityMode__option_t) const
67
{
68
2409
  return proof().proofGranularityMode__setByUser__;
69
}
70
template <> options::proofPedantic__option_t::type& Options::ref(
71
    options::proofPedantic__option_t)
72
{
73
    return proof().proofPedantic;
74
}
75
3600
template <> const options::proofPedantic__option_t::type& Options::operator[](
76
    options::proofPedantic__option_t) const
77
{
78
3600
  return proof().proofPedantic;
79
}
80
template <> bool Options::wasSetByUser(options::proofPedantic__option_t) const
81
{
82
  return proof().proofPedantic__setByUser__;
83
}
84
template <> options::proofPrintConclusion__option_t::type& Options::ref(
85
    options::proofPrintConclusion__option_t)
86
{
87
    return proof().proofPrintConclusion;
88
}
89
208579
template <> const options::proofPrintConclusion__option_t::type& Options::operator[](
90
    options::proofPrintConclusion__option_t) const
91
{
92
208579
  return proof().proofPrintConclusion;
93
}
94
template <> bool Options::wasSetByUser(options::proofPrintConclusion__option_t) const
95
{
96
  return proof().proofPrintConclusion__setByUser__;
97
}
98
99
namespace options {
100
101
thread_local struct proofEagerChecking__option_t proofEagerChecking;
102
thread_local struct proofFormatMode__option_t proofFormatMode;
103
thread_local struct proofGranularityMode__option_t proofGranularityMode;
104
thread_local struct proofPedantic__option_t proofPedantic;
105
thread_local struct proofPrintConclusion__option_t proofPrintConclusion;
106
107
108
std::ostream& operator<<(std::ostream& os, ProofFormatMode mode)
109
{
110
  switch(mode) {
111
    case ProofFormatMode::VERIT:
112
      return os << "ProofFormatMode::VERIT";
113
    case ProofFormatMode::NONE:
114
      return os << "ProofFormatMode::NONE";
115
    case ProofFormatMode::DOT:
116
      return os << "ProofFormatMode::DOT";
117
    default:
118
      Unreachable();
119
  }
120
  return os;
121
}
122
123
ProofFormatMode stringToProofFormatMode(const std::string& optarg)
124
{
125
  if (optarg == "verit")
126
  {
127
    return ProofFormatMode::VERIT;
128
  }
129
  else if (optarg == "none")
130
  {
131
    return ProofFormatMode::NONE;
132
  }
133
  else if (optarg == "dot")
134
  {
135
    return ProofFormatMode::DOT;
136
  }
137
  else if (optarg == "help")
138
  {
139
    std::cerr << "Proof format modes.\n"
140
         "Available modes for --proof-format-mode are:\n"
141
         "+ verit\n"
142
         "  Output veriT proof\n"
143
         "+ none (default)\n"
144
         "  Do not translate proof output\n"
145
         "+ dot\n"
146
         "  Output DOT proof\n";
147
    std::exit(1);
148
  }
149
  throw OptionException(std::string("unknown option for --proof-format-mode: `") +
150
                        optarg + "'.  Try --proof-format-mode=help.");
151
}
152
153
std::ostream& operator<<(std::ostream& os, ProofGranularityMode mode)
154
{
155
  switch(mode) {
156
    case ProofGranularityMode::REWRITE:
157
      return os << "ProofGranularityMode::REWRITE";
158
    case ProofGranularityMode::THEORY_REWRITE:
159
      return os << "ProofGranularityMode::THEORY_REWRITE";
160
    case ProofGranularityMode::DSL_REWRITE:
161
      return os << "ProofGranularityMode::DSL_REWRITE";
162
    case ProofGranularityMode::OFF:
163
      return os << "ProofGranularityMode::OFF";
164
    default:
165
      Unreachable();
166
  }
167
  return os;
168
}
169
170
ProofGranularityMode stringToProofGranularityMode(const std::string& optarg)
171
{
172
  if (optarg == "rewrite")
173
  {
174
    return ProofGranularityMode::REWRITE;
175
  }
176
  else if (optarg == "theory-rewrite")
177
  {
178
    return ProofGranularityMode::THEORY_REWRITE;
179
  }
180
  else if (optarg == "dsl-rewrite")
181
  {
182
    return ProofGranularityMode::DSL_REWRITE;
183
  }
184
  else if (optarg == "off")
185
  {
186
    return ProofGranularityMode::OFF;
187
  }
188
  else if (optarg == "help")
189
  {
190
    std::cerr << "Modes for proof granularity.\n"
191
         "Available modes for --proof-granularity are:\n"
192
         "+ rewrite\n"
193
         "  Allow rewrite or substitution steps, expand macros.\n"
194
         "+ theory-rewrite (default)\n"
195
         "  Allow theory rewrite steps, expand macros, rewrite and substitution steps.\n"
196
         "+ dsl-rewrite\n"
197
         "  Allow DSL rewrites and evaluation steps, expand macros, rewrite, substitution,\n"
198
         "  and theory rewrite steps.\n"
199
         "+ off\n"
200
         "  Do not improve the granularity of proofs.\n";
201
    std::exit(1);
202
  }
203
  throw OptionException(std::string("unknown option for --proof-granularity: `") +
204
                        optarg + "'.  Try --proof-granularity=help.");
205
}
206
207
208
}  // namespace options
209
28191
}  // namespace cvc5
210
// clang-format on