CBMC
prop.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 #include "prop.h"
10 
13 {
14  if(b.is_constant())
15  {
16  if(b.is_true())
17  lcnf({a});
18  else
19  lcnf({!a});
20 
21  return;
22  }
23 
24  lcnf(a, !b);
25  lcnf(!a, b);
26 }
27 
30 bvt propt::new_variables(std::size_t width)
31 {
32  bvt result;
33  result.reserve(width);
34  for(std::size_t i=0; i<width; i++)
35  result.push_back(new_variable());
36  return result;
37 }
38 
40 {
41  static const bvt empty_assumptions;
43  return do_prop_solve(empty_assumptions);
44 }
45 
47 {
49  return do_prop_solve(assumptions);
50 }
51 
53 {
55 }
bool is_true() const
Definition: literal.h:156
bool is_constant() const
Definition: literal.h:166
std::size_t number_of_solver_calls
Definition: prop.h:135
std::size_t get_number_of_solver_calls() const
Definition: prop.cpp:52
virtual resultt do_prop_solve(const bvt &assumptions)=0
void lcnf(literalt l0, literalt l1)
Definition: prop.h:58
virtual void set_equal(literalt a, literalt b)
asserts a==b in the propositional formula
Definition: prop.cpp:12
resultt prop_solve()
Definition: prop.cpp:39
virtual bvt new_variables(std::size_t width)
generates a bitvector of given width with new variables
Definition: prop.cpp:30
resultt
Definition: prop.h:101
virtual literalt new_variable()=0
std::vector< literalt > bvt
Definition: literal.h:201