CBMC
satcheck_minisat2.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 
10 #ifndef CPROVER_SOLVERS_SAT_SATCHECK_MINISAT2_H
11 #define CPROVER_SOLVERS_SAT_SATCHECK_MINISAT2_H
12 
13 #include "cnf.h"
14 
16 
17 #include <memory>
18 
19 // Select one: basic solver or with simplification.
20 // Note that the solver with simplifier isn't really robust
21 // when used incrementally, as variables may disappear
22 // unless set to 'frozen'.
23 
24 namespace Minisat // NOLINT(readability/namespace)
25 {
26 // NOLINTNEXTLINE(readability/identifiers)
27 class Solver; // IWYU pragma: keep
28 // NOLINTNEXTLINE(readability/identifiers)
29 class SimpSolver; // IWYU pragma: keep
30 }
31 
32 template <typename T>
34 {
35 public:
36  explicit satcheck_minisat2_baset(message_handlert &message_handler);
40 
41  tvt l_get(literalt a) const override final;
42 
43  void lcnf(const bvt &bv) override final;
44  void set_assignment(literalt a, bool value) override;
45 
46  // extra MiniSat feature: default branching decision
47  void set_polarity(literalt a, bool value);
48 
49  // extra MiniSat feature: interrupt running SAT query
50  void interrupt();
51 
52  // extra MiniSat feature: permit previously interrupted SAT query to continue
53  void clear_interrupt();
54 
55  bool is_in_conflict(literalt a) const override;
56  bool has_assumptions() const override final
57  {
58  return true;
59  }
60  bool has_is_in_conflict() const override final
61  {
62  return true;
63  }
64 
65  void set_time_limit_seconds(uint32_t lim) override
66  {
68  }
69 
70 protected:
71  resultt do_prop_solve(const bvt &) override;
72 
73  std::unique_ptr<T> solver;
75 
76  void add_variables();
77 };
78 
80  public satcheck_minisat2_baset<Minisat::Solver>
81 {
82 public:
84  std::string solver_text() const override;
85 };
86 
88  public satcheck_minisat2_baset<Minisat::SimpSolver>
89 {
90 public:
92  std::string solver_text() const override final;
93  void set_frozen(literalt a) override final;
94  bool is_eliminated(literalt a) const;
95 };
96 
97 #endif // CPROVER_SOLVERS_SAT_SATCHECK_MINISAT2_H
bool is_in_conflict(literalt a) const override
Returns true if an assumption is in the final conflict.
std::unique_ptr< T > solver
bool has_is_in_conflict() const override final
~satcheck_minisat2_baset() override
A default destructor defined in the .cpp is used to ensure the unique_ptr to the solver is correctly ...
resultt do_prop_solve(const bvt &) override
satcheck_minisat2_baset(message_handlert &message_handler)
void set_polarity(literalt a, bool value)
void lcnf(const bvt &bv) override final
tvt l_get(literalt a) const override final
bool has_assumptions() const override final
void set_time_limit_seconds(uint32_t lim) override
void set_assignment(literalt a, bool value) override
std::string solver_text() const override
void set_frozen(literalt a) override final
bool is_eliminated(literalt a) const
std::string solver_text() const override final
Definition: threeval.h:20
CNF Generation, via Tseitin.
Capability to collect the statistics of the complexity of individual solver queries.
std::vector< literalt > bvt
Definition: literal.h:201
resultt
The result of goto verifying.
Definition: properties.h:45