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_BE_BE_H__
00039 #define __NUSMV_CORE_BE_BE_H__
00040
00041
00042
00043
00044
00053 typedef struct Be_Manager_TAG* Be_Manager_ptr;
00054
00055
00066 typedef struct Be_Cnf_TAG* Be_Cnf_ptr;
00067
00068
00081 typedef void* be_ptr;
00082
00083
00098 typedef be_ptr (*Be_Spec2Be_fun)(Be_Manager_ptr self, void* spec_be);
00099
00100
00109 typedef void* (*Be_Be2Spec_fun)(Be_Manager_ptr self, be_ptr be);
00110
00111
00117 #include "nusmv/core/rbc/rbc.h"
00118 typedef Rbc_2CnfAlgorithm Be_CnfAlgorithm;
00119
00120
00121 #include <limits.h>
00122
00123
00124
00125 #include "nusmv/core/be/beRbcManager.h"
00126
00127
00128 #include "nusmv/core/utils/Slist.h"
00129 #include "nusmv/core/cinit/NuSMVEnv.h"
00130
00131
00132
00133
00134
00135
00145 #define BE_INVALID_SUBST_VALUE RBC_INVALID_SUBST_VALUE
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00172 void Be_Init(void);
00173
00183 void Be_Quit(void);
00184
00185
00186
00187
00188
00189
00196 NuSMVEnv_ptr Be_Manager_GetEnvironment(const Be_Manager_ptr self);
00197
00211 be_ptr Be_Manager_Spec2Be(const Be_Manager_ptr self,
00212 void* spec_expr);
00213
00223 void* Be_Manager_Be2Spec(const Be_Manager_ptr self, be_ptr be);
00224
00231 void* Be_Manager_GetSpecManager(Be_Manager_ptr self);
00232
00233
00234
00235
00236
00237
00247 Be_Cnf_ptr Be_Cnf_Create(const be_ptr be);
00248
00257 void Be_Cnf_Delete(Be_Cnf_ptr self);
00258
00265 void Be_Cnf_RemoveDuplicateLiterals(Be_Cnf_ptr self);
00266
00267
00268
00269
00270
00277 be_ptr Be_Cnf_GetOriginalProblem(const Be_Cnf_ptr self);
00278
00286 int Be_Cnf_GetFormulaLiteral(const Be_Cnf_ptr self);
00287
00295 Slist_ptr Be_Cnf_GetVarsList(const Be_Cnf_ptr self);
00296
00306 Slist_ptr Be_Cnf_GetClausesList(const Be_Cnf_ptr self);
00307
00314 int Be_Cnf_GetMaxVarIndex(const Be_Cnf_ptr self);
00315
00323 size_t Be_Cnf_GetVarsNumber(const Be_Cnf_ptr self);
00324
00331 size_t Be_Cnf_GetClausesNumber(const Be_Cnf_ptr self);
00332
00339 void Be_Cnf_SetFormulaLiteral(const Be_Cnf_ptr self,
00340 const int formula_literal);
00341
00348 void Be_Cnf_SetMaxVarIndex(const Be_Cnf_ptr self,
00349 const int max_idx);
00350
00351
00352
00353
00354
00355
00362 boolean Be_IsTrue(Be_Manager_ptr manager, be_ptr arg);
00363
00370 boolean Be_IsFalse(Be_Manager_ptr manager, be_ptr arg);
00371
00378 boolean Be_IsConstant(Be_Manager_ptr manager, be_ptr arg);
00379
00385 be_ptr Be_Truth(Be_Manager_ptr manager);
00386
00392 be_ptr Be_Falsity(Be_Manager_ptr manager);
00393
00399 be_ptr Be_Not(Be_Manager_ptr manager, be_ptr arg);
00400
00407 be_ptr
00408 Be_And(Be_Manager_ptr manager, be_ptr arg1, be_ptr arg2);
00409
00416 be_ptr
00417 Be_Or(Be_Manager_ptr manager, be_ptr arg1, be_ptr arg2);
00418
00425 be_ptr
00426 Be_Xor(Be_Manager_ptr manager, be_ptr arg1, be_ptr arg2);
00427
00434 be_ptr
00435 Be_Implies(Be_Manager_ptr manager, be_ptr arg1, be_ptr arg2);
00436
00443 be_ptr
00444 Be_Iff(Be_Manager_ptr manager, be_ptr arg1, be_ptr arg2);
00445
00453 be_ptr
00454 Be_Ite(Be_Manager_ptr manager, be_ptr arg_if,
00455 be_ptr arg_then, be_ptr arg_else);
00456
00481 be_ptr
00482 Be_LogicalShiftVar(Be_Manager_ptr manager, be_ptr f,
00483 int shift,
00484 const int* log2phy,
00485 const int* phy2log);
00486
00513 be_ptr
00514 Be_LogicalVarSubst(Be_Manager_ptr manager, be_ptr f,
00515 int* subst,
00516 const int* log2phy,
00517 const int* phy2log);
00518
00519
00520
00521
00522
00523
00524
00525
00549 Be_Cnf_ptr
00550 Be_ConvertToCnf(Be_Manager_ptr manager, be_ptr f, int polarity,
00551 Be_CnfAlgorithm alg);
00552
00562 int Be_CnfLiteral2BeLiteral(const Be_Manager_ptr self,
00563 int cnfLiteral);
00564
00573 int Be_BeLiteral2CnfLiteral(const Be_Manager_ptr self,
00574 int beLiteral);
00575
00583 int Be_BeLiteral2BeIndex(const Be_Manager_ptr self,
00584 int beLiteral);
00585
00593 int Be_BeIndex2BeLiteral(const Be_Manager_ptr self,
00594 int beIndex);
00595
00606 int Be_BeIndex2CnfLiteral(const Be_Manager_ptr self,
00607 int beIndex);
00608
00616 Slist_ptr Be_CnfModelToBeModel(Be_Manager_ptr manager,
00617 const Slist_ptr cnfModel);
00618
00624 void
00625 Be_DumpDavinci(Be_Manager_ptr manager, be_ptr f, FILE* outFile);
00626
00632 void
00633 Be_DumpGdl(Be_Manager_ptr manager, be_ptr f, FILE* outFile);
00634
00640 void
00641 Be_DumpSexpr(Be_Manager_ptr manager, be_ptr f, FILE* outFile);
00642
00643
00644
00652 be_ptr Be_Index2Var(Be_Manager_ptr manager, int varIndex);
00653
00660 int Be_Var2Index(Be_Manager_ptr manager, be_ptr var);
00661
00662
00663
00671 boolean Be_CnfLiteral_IsSignPositive(const Be_Manager_ptr self,
00672 int cnfLiteral);
00673
00681 int Be_CnfLiteral_Negate(const Be_Manager_ptr self,
00682 int cnfLiteral);
00683
00691 boolean Be_BeLiteral_IsSignPositive(const Be_Manager_ptr self,
00692 int beLiteral);
00693
00701 int Be_BeLiteral_Negate(const Be_Manager_ptr self,
00702 int beLiteral);
00703
00713 be_ptr
00714 Be_apply_inlining(Be_Manager_ptr self, be_ptr f, boolean add_conj);
00715
00726 void
00727 Be_Cnf_PrintStat(const Be_Cnf_ptr self, FILE* outFile, char* prefix);
00728
00729
00730
00731 #endif