GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/src/options/proof_options.cpp Lines: 8 54 14.8 %
Date: 2021-11-07 Branches: 7 88 8.0 %

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
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::LAZY: return os << "lazy";
33
    case ProofCheckMode::EAGER_SIMPLE: return os << "eager-simple";
34
    case ProofCheckMode::NONE: return os << "none";
35
    case ProofCheckMode::EAGER: return os << "eager";
36
    default: Unreachable();
37
  }
38
  return os;
39
}
40
9
ProofCheckMode stringToProofCheckMode(const std::string& optarg)
41
{
42
9
  if (optarg == "lazy") return ProofCheckMode::LAZY;
43
9
  else if (optarg == "eager-simple") return ProofCheckMode::EAGER_SIMPLE;
44
9
  else if (optarg == "none") return ProofCheckMode::NONE;
45
9
  else if (optarg == "eager") return ProofCheckMode::EAGER;
46
  else if (optarg == "help")
47
  {
48
    std::cerr << R"FOOBAR(
49
  Proof checking modes.
50
Available modes for --proof-check are:
51
+ lazy (default)
52
  check rule applications only during final proof construction
53
+ eager-simple
54
  check rule applications during construction
55
+ none
56
  do not check rule applications
57
+ eager
58
  check rule applications and proofs from generators eagerly for local debugging
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::LFSC: return os << "lfsc";
70
    case ProofFormatMode::DOT: return os << "dot";
71
    case ProofFormatMode::NONE: return os << "none";
72
    case ProofFormatMode::TPTP: return os << "tptp";
73
    case ProofFormatMode::ALETHE: return os << "alethe";
74
    default: Unreachable();
75
  }
76
  return os;
77
}
78
1
ProofFormatMode stringToProofFormatMode(const std::string& optarg)
79
{
80
1
  if (optarg == "lfsc") return ProofFormatMode::LFSC;
81
  else if (optarg == "dot") return ProofFormatMode::DOT;
82
  else if (optarg == "none") return ProofFormatMode::NONE;
83
  else if (optarg == "tptp") return ProofFormatMode::TPTP;
84
  else if (optarg == "alethe") return ProofFormatMode::ALETHE;
85
  else if (optarg == "help")
86
  {
87
    std::cerr << R"FOOBAR(
88
  Proof format modes.
89
Available modes for --proof-format-mode are:
90
+ lfsc
91
  Output LFSC proof
92
+ dot
93
  Output DOT proof
94
+ none (default)
95
  Do not translate proof output
96
+ tptp
97
  Output TPTP proof (work in progress)
98
+ alethe
99
  Output Alethe proof
100
)FOOBAR";
101
    std::exit(1);
102
  }
103
  throw OptionException(std::string("unknown option for --proof-format-mode: `") +
104
                        optarg + "'.  Try --proof-format-mode=help.");
105
}
106
std::ostream& operator<<(std::ostream& os, ProofGranularityMode mode)
107
{
108
  switch(mode)
109
  {
110
    case ProofGranularityMode::DSL_REWRITE: return os << "dsl-rewrite";
111
    case ProofGranularityMode::THEORY_REWRITE: return os << "theory-rewrite";
112
    case ProofGranularityMode::REWRITE: return os << "rewrite";
113
    case ProofGranularityMode::OFF: return os << "off";
114
    default: Unreachable();
115
  }
116
  return os;
117
}
118
ProofGranularityMode stringToProofGranularityMode(const std::string& optarg)
119
{
120
  if (optarg == "dsl-rewrite") return ProofGranularityMode::DSL_REWRITE;
121
  else if (optarg == "theory-rewrite") return ProofGranularityMode::THEORY_REWRITE;
122
  else if (optarg == "rewrite") return ProofGranularityMode::REWRITE;
123
  else if (optarg == "off") return ProofGranularityMode::OFF;
124
  else if (optarg == "help")
125
  {
126
    std::cerr << R"FOOBAR(
127
  Modes for proof granularity.
128
Available modes for --proof-granularity are:
129
+ dsl-rewrite
130
  Allow DSL rewrites and evaluation steps, expand macros, rewrite, substitution,
131
  and theory rewrite steps.
132
+ theory-rewrite (default)
133
  Allow theory rewrite steps, expand macros, rewrite and substitution steps.
134
+ rewrite
135
  Allow rewrite or substitution steps, expand macros.
136
+ off
137
  Do not improve the granularity of proofs.
138
)FOOBAR";
139
    std::exit(1);
140
  }
141
  throw OptionException(std::string("unknown option for --proof-granularity: `") +
142
                        optarg + "'.  Try --proof-granularity=help.");
143
}
144
// clang-format on
145
146
31137
}  // namespace cvc5::options