00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00038 #ifndef __NUSMV_CORE_BMC_BMC_UTILS_H__
00039 #define __NUSMV_CORE_BMC_BMC_UTILS_H__
00040
00041 #include "nusmv/core/trace/Trace.h"
00042 #include "nusmv/core/trace/TraceMgr.h"
00043
00044 #include "nusmv/core/utils/utils.h"
00045 #include "nusmv/core/utils/ucmd.h"
00046
00047
00048
00049
00050
00051
00057 #define UNKNOWN_OP -1
00058
00064 #define CONSTANT_EXPR 0
00065
00071 #define LITERAL 1
00072
00078 #define PROP_CONNECTIVE 2
00079
00085 #define TIME_OPERATOR 3
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00108 #define isConstantExpr(op) ((op)==TRUEEXP) || ((op)==FALSEEXP)
00109
00115 #define isVariable(op) (((op)==DOT) || ((op) == BIT))
00116
00122 #define isPastOp(op) ((op)==OP_PREC) || ((op)==OP_NOTPRECNOT) || \
00123 ((op)==OP_ONCE) || ((op)==OP_HISTORICAL) || \
00124 ((op)==SINCE) || ((op)==TRIGGERED)
00125
00131 #define isBinaryOp(op) ((op)==AND) || ((op)==OR) || \
00132 ((op)==IFF) || ((op)==UNTIL) || \
00133 ((op)==SINCE) || ((op)==RELEASES) || \
00134 ((op)==TRIGGERED)
00135
00141 #define getOpClass(op) \
00142 ((op)==TRUEEXP) || ((op)==FALSEEXP) ? CONSTANT_EXPR \
00143 : \
00144 ((op)==DOT) || ((op) == BIT) || ((op)==NOT) ? LITERAL \
00145 : \
00146 ((op)==AND) || ((op)==OR) || \
00147 ((op)==IFF) ? PROP_CONNECTIVE \
00148 : \
00149 ((op)==OP_PREC) || ((op)==OP_NEXT) || \
00150 ((op)==OP_NOTPRECNOT) || \
00151 ((op)==OP_ONCE) || ((op)==OP_FUTURE) || \
00152 ((op)==OP_HISTORICAL) || ((op)==OP_GLOBAL) || \
00153 ((op)==SINCE) || ((op)==UNTIL) || \
00154 ((op)==TRIGGERED) || ((op)==RELEASES) ? TIME_OPERATOR \
00155 : \
00156 UNKNOWN_OP
00157
00160
00161
00162
00163
00177 Trace_ptr
00178 Bmc_Utils_generate_and_print_cntexample(BeEnc_ptr be_enc,
00179 TraceMgr_ptr tm,
00180 SatSolver_ptr solver,
00181 be_ptr be_prob,
00182 const int k,
00183 const char* trace_name,
00184 NodeList_ptr symbols);
00185
00197 Trace_ptr
00198 Bmc_Utils_generate_cntexample(BeEnc_ptr be_enc,
00199 SatSolver_ptr solver,
00200 be_ptr be_prob,
00201 const int k,
00202 const char* trace_name,
00203 NodeList_ptr symbols);
00204
00213 Trace_ptr
00214 Bmc_Utils_fill_cntexample(BeEnc_ptr be_enc,
00215 SatSolver_ptr solver,
00216 const int k, Trace_ptr trace);
00217
00225 boolean Bmc_Utils_IsNoLoopback(const int l);
00226
00234 boolean Bmc_Utils_IsNoLoopbackString(const char* str);
00235
00244 boolean Bmc_Utils_IsSingleLoopback(const int l);
00245
00254 boolean Bmc_Utils_IsAllLoopbacks(const int l);
00255
00264 boolean Bmc_Utils_IsAllLoopbacksString(const char* str);
00265
00272 int Bmc_Utils_GetNoLoopback(void);
00273
00280 int Bmc_Utils_GetAllLoopbacks(void);
00281
00288 const char* Bmc_Utils_GetAllLoopbacksString(void);
00289
00297 int Bmc_Utils_RelLoop2AbsLoop(const int loop, const int k);
00298
00305 Outcome Bmc_Utils_Check_k_l(const int k, const int l);
00306
00314 int Bmc_Utils_GetSuccTime(const int time, const int k, const int l);
00315
00332 int Bmc_Utils_ConvertLoopFromString(const char* strValue, Outcome* result);
00333
00347 void Bmc_Utils_ConvertLoopFromInteger(const int iLoopback, char* szLoopback, const int _bufsize);
00348
00363 void
00364 Bmc_Utils_ExpandMacrosInFilename(const char* filename_to_be_expanded,
00365 const SubstString* table_ptr,
00366 const size_t table_len,
00367 char* filename_expanded, size_t buf_len);
00368
00375 be_ptr
00376 Bmc_Utils_apply_inlining(Be_Manager_ptr be_mgr, be_ptr f);
00377
00385 be_ptr
00386 Bmc_Utils_apply_inlining4inc(Be_Manager_ptr be_mgr, be_ptr f);
00387
00400 be_ptr
00401 Bmc_Utils_simple_costraint_from_string(BeEnc_ptr be_enc,
00402 BddEnc_ptr bdd_enc,
00403 const char* str,
00404 Expr_ptr* node_expr);
00405
00419 be_ptr
00420 Bmc_Utils_next_costraint_from_string(BeEnc_ptr be_enc,
00421 BddEnc_ptr bdd_enc,
00422 const char* str,
00423 Expr_ptr* node_expr);
00424
00433 void
00434 Bmc_Utils_add_be_into_inc_solver_positively(SatIncSolver_ptr solver,
00435 SatSolverGroup group,
00436 be_ptr prob,
00437 BeEnc_ptr be_enc,
00438 Be_CnfAlgorithm cnf_alg);
00439
00448 void
00449 Bmc_Utils_add_be_into_non_inc_solver_positively(SatSolver_ptr solver,
00450 be_ptr prob,
00451 BeEnc_ptr be_enc,
00452 Be_CnfAlgorithm cnf_alg);
00453
00456 #endif