@@ -8,10 +8,10 @@ Author: CM Wintersteiger
88
99#include < solvers/prop/literal.h>
1010
11- #include < cassert>
1211#include < fstream>
1312
1413#include < util/arith_tools.h>
14+ #include < util/invariant.h>
1515#include < util/std_expr.h>
1616
1717#include < cuddObj.hh> // CUDD Library
@@ -80,7 +80,7 @@ qbf_bdd_coret::~qbf_bdd_coret()
8080
8181tvt qbf_bdd_coret::l_get (literalt a) const
8282{
83- assert ( false ) ;
83+ UNREACHABLE ;
8484 return tvt (false );
8585}
8686
@@ -122,17 +122,18 @@ propt::resultt qbf_bdd_coret::prop_solve()
122122
123123 *matrix=matrix->ExistAbstract (*bdd_variable_map[var]);
124124 }
125- else if (it-> type ==quantifiert::UNIVERSAL)
125+ else
126126 {
127+ INVARIANT (
128+ it->type == quantifiert::UNIVERSAL,
129+ " Only handles quantified variables." );
127130 #if 0
128131 std::cout << "BDD A: " << var << ", " <<
129132 matrix->nodeCount() << " nodes\n";
130133 #endif
131134
132135 *matrix=matrix->UnivAbstract (*bdd_variable_map[var]);
133136 }
134- else
135- throw " unquantified variable" ;
136137 }
137138
138139 if (*matrix==bdd_manager->bddOne ())
@@ -151,12 +152,12 @@ propt::resultt qbf_bdd_coret::prop_solve()
151152
152153bool qbf_bdd_coret::is_in_core (literalt l) const
153154{
154- throw " nyi " ;
155+ UNIMPLEMENTED ;
155156}
156157
157158qdimacs_coret::modeltypet qbf_bdd_coret::m_get (literalt a) const
158159{
159- throw " nyi " ;
160+ UNIMPLEMENTED ;
160161}
161162
162163literalt qbf_bdd_coret::new_variable ()
@@ -268,17 +269,17 @@ void qbf_bdd_coret::compress_certificate(void)
268269const exprt qbf_bdd_certificatet::f_get (literalt l)
269270{
270271 quantifiert q;
271- if (! find_quantifier (l, q))
272- throw " no model for unquantified variable " ;
272+ PRECONDITION_WITH_DIAGNOSTICS (
273+ ! find_quantifier (l, q), " No model for unquantified variables. " ) ;
273274
274275 // universal?
275276 if (q.type ==quantifiert::UNIVERSAL)
276277 {
277- assert (l.var_no ()!= 0 );
278+ INVARIANT (l.var_no () != 0 , " Input literal wasn't properly initialized. " );
278279 variable_mapt::const_iterator it=variable_map.find (l.var_no ());
279280
280- if (it==variable_map. end ())
281- throw " variable map error " ;
281+ INVARIANT (
282+ it != variable_map. end (), " Variable not found in the variable map. " ) ;
282283
283284 const exprt &sym=it->second .first ;
284285 unsigned index=it->second .second ;
@@ -293,7 +294,9 @@ const exprt qbf_bdd_certificatet::f_get(literalt l)
293294 else
294295 {
295296 // skolem functions for existentials
296- assert (q.type ==quantifiert::EXISTENTIAL);
297+ INVARIANT (
298+ q.type == quantifiert::EXISTENTIAL,
299+ " Only quantified literals are supported." );
297300
298301 function_cachet::const_iterator it=function_cache.find (l.var_no ());
299302 if (it!=function_cache.end ())
@@ -310,7 +313,9 @@ const exprt qbf_bdd_certificatet::f_get(literalt l)
310313
311314 // no cached function, so construct one
312315
313- assert (model_bdds[l.var_no ()]!=NULL );
316+ INVARIANT (
317+ model_bdds[l.var_no ()] != NULL ,
318+ " There must be a model BDD for the literal." );
314319 BDD &model=*model_bdds[l.var_no ()];
315320
316321 #if 0
0 commit comments