GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/smt/set_defaults.h Lines: 1 1 100.0 %
Date: 2021-11-07 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds
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
 * Method for setting the default options of an SMT engine.
14
 */
15
16
#ifndef CVC5__SMT__SET_DEFAULTS_H
17
#define CVC5__SMT__SET_DEFAULTS_H
18
19
#include "options/options.h"
20
#include "smt/env_obj.h"
21
#include "theory/logic_info.h"
22
23
namespace cvc5 {
24
namespace smt {
25
26
/**
27
 * Class responsible for setting default options, which includes managing
28
 * implied options and dependencies between the options and the logic.
29
 */
30
15274
class SetDefaults : protected EnvObj
31
{
32
 public:
33
  /**
34
   * @param isInternalSubsolver Whether we are setting the options for an
35
   * internal subsolver (see SolverEngine::isInternalSubsolver).
36
   */
37
  SetDefaults(Env& env, bool isInternalSubsolver);
38
  /**
39
   * The purpose of this method is to set the default options and update the
40
   * logic info for an SMT engine.
41
   *
42
   * @param logic A reference to the logic of SolverEngine, which can be
43
   * updated by this method based on the current options and the logic itself.
44
   * @param opts The options to modify, typically the main options of the
45
   * SolverEngine in scope.
46
   */
47
  void setDefaults(LogicInfo& logic, Options& opts);
48
49
 private:
50
  //------------------------- utility methods
51
  /**
52
   * Determine whether we will be solving a SyGuS problem.
53
   */
54
  bool isSygus(const Options& opts) const;
55
  /**
56
   * Determine whether we will be using SyGuS.
57
   */
58
  bool usesSygus(const Options& opts) const;
59
  /**
60
   * Check if incompatible with incremental mode. Notice this method may modify
61
   * the options to ensure that we are compatible with incremental mode.
62
   *
63
   * If this method returns true, then the reason why we were incompatible with
64
   * incremental mode is written on the reason output stream. Suggestions for how to
65
   * resolve the incompatibility exception are written on the suggest stream.
66
   */
67
  bool incompatibleWithIncremental(const LogicInfo& logic,
68
                                   Options& opts,
69
                                   std::ostream& reason,
70
                                   std::ostream& suggest) const;
71
  /**
72
   * Return true if proofs must be disabled. This is the case for any technique
73
   * that answers "unsat" without showing a proof of unsatisfiabilty. The output
74
   * stream reason is similar to above.
75
   *
76
   * Notice this method may modify the options to ensure that we are compatible
77
   * with proofs.
78
   */
79
  bool incompatibleWithProofs(Options& opts, std::ostream& reason) const;
80
  /**
81
   * Check whether we should disable models. The output stream reason is similar
82
   * to above.
83
   */
84
  bool incompatibleWithModels(const Options& opts, std::ostream& reason) const;
85
  /**
86
   * Check if incompatible with unsat cores. Notice this method may modify
87
   * the options to ensure that we are compatible with unsat cores.
88
   * The output stream reason is similar to above.
89
   */
90
  bool incompatibleWithUnsatCores(Options& opts, std::ostream& reason) const;
91
  /**
92
   * Return true if we are using "safe" unsat cores, which disables all
93
   * techniques that may interfere with producing correct unsat cores.
94
   */
95
  bool safeUnsatCores(const Options& opts) const;
96
  /**
97
   * Check if incompatible with quantified formulas. Notice this method may
98
   * modify the options to ensure that we are compatible with quantified logics.
99
   * The output stream reason is similar to above.
100
   */
101
  bool incompatibleWithQuantifiers(Options& opts, std::ostream& reason) const;
102
  //------------------------- options setting, prior finalization of logic
103
  /**
104
   * Set defaults pre, which sets all options prior to finalizing the logic.
105
   * It is required that any options that impact the finalization of logic
106
   * (finalizeLogic).
107
   */
108
  void setDefaultsPre(Options& opts);
109
  //------------------------- finalization of the logic
110
  /**
111
   * Finalize the logic based on the options.
112
   */
113
  void finalizeLogic(LogicInfo& logic, Options& opts) const;
114
  /**
115
   * Widen logic to theories that are required, since some theories imply the
116
   * use of other theories to handle certain operators, e.g. UF to handle
117
   * partial functions.
118
   */
119
  void widenLogic(LogicInfo& logic, const Options& opts) const;
120
  //------------------------- options setting, post finalization of logic
121
  /**
122
   * Set all default options, after we have finalized the logic.
123
   */
124
  void setDefaultsPost(const LogicInfo& logic, Options& opts) const;
125
  /**
126
   * Set defaults related to quantifiers, called when quantifiers are enabled.
127
   * This method modifies opt.quantifiers only.
128
   */
129
  void setDefaultsQuantifiers(const LogicInfo& logic, Options& opts) const;
130
  /**
131
   * Set defaults related to SyGuS, called when SyGuS is enabled.
132
   */
133
  void setDefaultsSygus(Options& opts) const;
134
  /**
135
   * Set default decision mode
136
   */
137
  void setDefaultDecisionMode(const LogicInfo& logic, Options& opts) const;
138
  /** Are we an internal subsolver? */
139
  bool d_isInternalSubsolver;
140
};
141
142
}  // namespace smt
143
}  // namespace cvc5
144
145
#endif /* CVC5__SMT__SET_DEFAULTS_H */