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
00042 #ifndef __NUSMV_CORE_FSM_BDD_BDD_FSM_H__
00043 #define __NUSMV_CORE_FSM_BDD_BDD_FSM_H__
00044
00045 #include "nusmv/core/fsm/bdd/bdd.h"
00046 #include "nusmv/core/fsm/bdd/FairnessList.h"
00047
00048 #include "nusmv/core/dd/dd.h"
00049 #include "nusmv/core/trans/bdd/BddTrans.h"
00050 #include "nusmv/core/enc/bdd/BddEnc.h"
00051 #include "nusmv/core/fsm/sexp/sexp.h"
00052
00059 typedef struct BddFsm_TAG* BddFsm_ptr;
00060
00066 #define BDD_FSM(x) \
00067 ((BddFsm_ptr) x)
00068
00074 #define BDD_FSM_CHECK_INSTANCE(x) \
00075 (nusmv_assert( BDD_FSM(x) != BDD_FSM(NULL) ))
00076
00077
00078 enum Bdd_Fsm_dir_TAG {BDD_FSM_DIR_BWD, BDD_FSM_DIR_FWD};
00079 typedef enum Bdd_Fsm_dir_TAG BddFsm_dir;
00080
00084 enum BddFsmTransPrinterFormat {
00085 BDD_FSM_TRANS_PRINTER_SILENT,
00086 BDD_FSM_TRANS_PRINTER_SMV,
00087 BDD_FSM_TRANS_PRINTER_CSV,
00088 BDD_FSM_TRANS_PRINTER_DOT,
00089 BDD_FSM_TRANS_PRINTER_INVALID = -1,
00090 };
00091
00092
00093
00094
00095
00096
00105 BddFsm_ptr
00106 BddFsm_create(BddEnc_ptr encoding, BddStates init,
00107 BddInvarStates invar_states, BddInvarInputs invar_inputs,
00108 BddTrans_ptr trans,
00109 JusticeList_ptr justice, CompassionList_ptr compassion);
00110
00117 void BddFsm_destroy(BddFsm_ptr self);
00118
00125 BddFsm_ptr BddFsm_copy(const BddFsm_ptr self);
00126
00142 void BddFsm_copy_cache(BddFsm_ptr self, const BddFsm_ptr other,
00143 boolean keep_family);
00144
00151 JusticeList_ptr BddFsm_get_justice(const BddFsm_ptr self);
00152
00159 CompassionList_ptr BddFsm_get_compassion(const BddFsm_ptr self);
00160
00167 BddStates BddFsm_get_init(const BddFsm_ptr self);
00168
00176 BddEnc_ptr BddFsm_get_bdd_encoding(const BddFsm_ptr self);
00177
00184 BddInvarStates
00185 BddFsm_get_state_constraints(const BddFsm_ptr self);
00186
00193 BddInvarInputs
00194 BddFsm_get_input_constraints(const BddFsm_ptr self);
00195
00203 BddTrans_ptr BddFsm_get_trans(const BddFsm_ptr self);
00204
00216 BddStates BddFsm_get_fair_states(BddFsm_ptr self);
00217
00229 BddStatesInputs BddFsm_get_fair_states_inputs(BddFsm_ptr self);
00230
00242 BddStates BddFsm_get_revfair_states(BddFsm_ptr self);
00243
00256 BddStatesInputs BddFsm_get_revfair_states_inputs(BddFsm_ptr self);
00257
00272 bdd_ptr BddFsm_get_monolithic_trans_bdd(BddFsm_ptr self);
00273
00282 boolean BddFsm_reachable_states_computed(BddFsm_ptr self);
00283
00317 BddStates BddFsm_get_reachable_states(BddFsm_ptr self);
00318
00339 void
00340 BddFsm_copy_reachable_states(BddFsm_ptr self, BddFsm_ptr other,
00341 boolean keep_family,
00342 boolean force_calculation);
00343
00372 BddStates
00373 BddFsm_get_reachable_states_at_distance(BddFsm_ptr self,
00374 int distance);
00375
00405 int
00406 BddFsm_get_distance_of_states(BddFsm_ptr self,
00407 BddStates states);
00408
00428 int
00429 BddFsm_get_minimum_distance_of_states(BddFsm_ptr self,
00430 BddStates states);
00431
00454 int BddFsm_get_diameter(BddFsm_ptr self);
00455
00474 BddStates
00475 BddFsm_get_not_successor_states(BddFsm_ptr self);
00476
00499 BddStates BddFsm_get_deadlock_states(BddFsm_ptr self);
00500
00529 boolean BddFsm_is_total(BddFsm_ptr self);
00530
00555 boolean BddFsm_is_deadlock_free(BddFsm_ptr self);
00556
00582 BddStates
00583 BddFsm_get_forward_image(const BddFsm_ptr self, BddStates states);
00584
00617 BddStates
00618 BddFsm_get_constrained_forward_image(const BddFsm_ptr self,
00619 BddStates states,
00620 BddStatesInputsNexts constraints);
00621
00654 BddStates BddFsm_get_sins_constrained_forward_image(
00655 const BddFsm_ptr self,
00656 BddStates states,
00657 BddStatesInputsNexts constraints);
00658
00688 BddStatesInputs
00689 BddFsm_get_forward_image_states_inputs(const BddFsm_ptr self,
00690 BddStatesInputs si);
00691
00727 BddStatesInputs
00728 BddFsm_get_constrained_forward_image_states_inputs(const BddFsm_ptr self,
00729 BddStatesInputs si,
00730 BddStatesInputsNexts constraints);
00731
00757 BddStates
00758 BddFsm_get_backward_image(const BddFsm_ptr self, BddStates states);
00759
00793 BddStates
00794 BddFsm_get_constrained_backward_image(const BddFsm_ptr self,
00795 BddStates states,
00796 BddStatesInputsNexts constraints);
00797
00824 BddStatesInputs
00825 BddFsm_get_weak_backward_image(const BddFsm_ptr self,
00826 BddStates states);
00827
00853 BddStatesInputs
00854 BddFsm_get_k_backward_image(const BddFsm_ptr self,
00855 BddStates states,
00856 int k);
00857
00882 BddStatesInputs
00883 BddFsm_get_strong_backward_image(const BddFsm_ptr self,
00884 BddStates states);
00885
00894 void BddFsm_print_info(const BddFsm_ptr self, OStream_ptr file);
00895
00904 void
00905 BddFsm_print_reachable_states_info(const BddFsm_ptr self,
00906 const boolean print_states,
00907 const boolean print_defines,
00908 const boolean print_formula,
00909 OStream_ptr file);
00910
00919 void
00920 BddFsm_print_fair_states_info(const BddFsm_ptr self,
00921 const boolean verbose,
00922 OStream_ptr file);
00923
00932 void BddFsm_print_fair_transitions_info(
00933 const BddFsm_ptr self,
00934 const enum BddFsmTransPrinterFormat format,
00935 OStream_ptr file);
00936
00944 void BddFsm_print_fair_state_input_pairs_info(const BddFsm_ptr self,
00945 const boolean print_transitions,
00946 OStream_ptr file);
00947
00956 void BddFsm_check_machine(const BddFsm_ptr self);
00957
00987 void
00988 BddFsm_apply_synchronous_product_custom_varsets(BddFsm_ptr self,
00989 const BddFsm_ptr other,
00990 bdd_ptr state_vars_cube,
00991 bdd_ptr input_vars_cube,
00992 bdd_ptr next_vars_cube);
00993
01013 void
01014 BddFsm_apply_synchronous_product(BddFsm_ptr self,
01015 const BddFsm_ptr other);
01016
01023 boolean BddFsm_is_fair_states(const BddFsm_ptr self,
01024 BddStates states);
01025
01034 BddInputs
01035 BddFsm_states_to_states_get_inputs(const BddFsm_ptr self,
01036 BddStates cur_states,
01037 BddStates next_states);
01038
01047 BddStatesInputs
01048 BddFsm_get_states_inputs_constraints(const BddFsm_ptr self,
01049 BddFsm_dir dir);
01050
01058 BddStates BddFsm_states_inputs_to_states(const BddFsm_ptr self,
01059 BddStatesInputs si);
01060
01069 BddStates BddFsm_states_inputs_to_inputs(const BddFsm_ptr self,
01070 BddStatesInputs si);
01071
01076 boolean BddFsm_get_cached_reachable_states(const BddFsm_ptr self,
01077 BddStates** layers,
01078 int* size);
01079
01084 void BddFsm_update_cached_reachable_states(const BddFsm_ptr self,
01085 node_ptr layers,
01086 int size,
01087 boolean completed);
01088
01097 void BddFsm_set_reachable_states(const BddFsm_ptr self,
01098 BddStates reachable);
01099
01106 boolean BddFsm_has_cached_reachable_states(const BddFsm_ptr self);
01107
01120 boolean
01121 BddFsm_expand_cached_reachable_states(BddFsm_ptr self,
01122 int k,
01123 int max_seconds);
01124
01125
01126
01133 boolean
01134 BddFsm_compute_reachable(BddFsm_ptr self, int k, int t, int* diameter);
01135
01136
01142 double
01143 BddFsm_count_transitions(const BddFsm_ptr self,
01144 BddStatesInputs bdd);
01145
01150 int
01151 BddFsm_dump_fsm(BddFsm_ptr self,
01152 const NuSMVEnv_ptr env, node_ptr node_expr,
01153 char* str_constr,
01154 boolean init,
01155 boolean invar, boolean trans, boolean fair,
01156 boolean reachable,
01157 FILE* outfile);
01158
01165 int
01166 BddFsm_print_reachable_states(BddFsm_ptr self,
01167 NuSMVEnv_ptr env, OStream_ptr stream,
01168 boolean verbose, boolean print_defines,
01169 boolean formula);
01170
01177 int BddFsm_print_fair_states(BddFsm_ptr self,
01178 const NuSMVEnv_ptr env,
01179 const OStream_ptr outstream,
01180 const boolean verbose);
01181
01187 int BddFsm_print_fair_transitions(BddFsm_ptr self,
01188 const NuSMVEnv_ptr env,
01189 const enum BddFsmTransPrinterFormat format,
01190 const OStream_ptr outstream);
01191
01200 int BddFsm_print_fair_state_input_pairs(BddFsm_ptr self,
01201 const NuSMVEnv_ptr env,
01202 const OStream_ptr outstream,
01203 const boolean verbose);
01210 enum BddFsmTransPrinterFormat
01211 BddFsm_trans_printer_format_from_string(const char* format_str);
01212
01218 const char*
01219 BddFsm_trans_printer_format_to_string(enum BddFsmTransPrinterFormat format);
01220
01227 enum BddFsmTransPrinterFormat*
01228 BddFsm_trans_printer_get_avail_formats(size_t* num);
01229
01230
01231 #endif