This file provides the user routines to perform compilation of the read model into BDD.

int 
CommandBuildBooleanModel(
  int  argc, 
  char ** argv 
)
Compiles the flattened hierarchy into boolean SEXP

Defined in compileCmd.c

int 
CommandBuildFlatModel(
  int  argc, 
  char ** argv 
)
Compiles the flattened hierarchy into SEXP

Defined in compileCmd.c

int 
CommandBuildModel(
  int  argc, 
  char ** argv 
)
Compiles the flattened hierarchy into BDD

Defined in compileCmd.c

int 
CommandCPPrintClusterInfo(
  int  argc, 
  char ** argv 
)
Prints out the information of the clustering.

Defined in compileCmd.c

int 
CommandCheckWff(
  int  argc, 
  char ** argv 
)
Checks formulas potential errors.

Defined in compileCmd.c

int 
CommandEncodeVariables(
  int  argc, 
  char ** argv 
)
Builds the BDD variables necessary to compile the model into BDD.

Defined in compileCmd.c

int 
CommandFlattenHierarchy(
  int  argc, 
  char ** argv 
)
Flattens the hierarchy of modules

Defined in compileCmd.c

int 
CommandGetInternalStatus(
  int  argc, 
  char ** argv 
)
Implements the get_internal_status command

Defined in compileCmd.c

int 
CommandGoBmc(
  int  argc, 
  char ** argv 
)
Implements the go_bmc command

Defined in compileCmd.c

int 
CommandGo(
  int  argc, 
  char ** argv 
)
Implements the go command

Defined in compileCmd.c

int 
CommandIwls95PrintOption(
  int  argc, 
  char ** argv 
)
Prints the Iwls95 Options.

Defined in compileCmd.c

int 
CommandProcessModel(
  int  argc, 
  char ** argv 
)
Performs the batch steps and then returns control to the interactive shell.

Defined in compileCmd.c

int 
CommandShowVars(
  int  argc, 
  char ** argv 
)
Shows model's symbolic variables and their values

Defined in compileCmd.c

int 
CommandWriteModelFlatBool(
  int  argc, 
  char ** argv 
)
Writes a flat and boolean model of a given SMV file

Defined in compileCmd.c

int 
CommandWriteModelFlat(
  int  argc, 
  char ** argv 
)
Writes the currently loaded SMV model in the specified file, after having flattened it

Defined in compileCmd.c

int 
CommandWriteOrder(
  int  argc, 
  char ** argv 
)
Writes variable order to file.

Defined in compileCmd.c

node_ptr 
CompileFlatten_expand_range(
  int  a, 
  int  b 
)
Returns a range going from a to b. An empty range (Nil) is returned whether given 'a' is greater than 'b'

Defined in compileFlatten.c

void 
CompileFlatten_quit_flattener(
    
)
Resets all internal structures, in order to correctly shut down the flattener. Calls clear_* local functions, and reset all private variables.

Side Effects This module will be initialized, all previously iniitalized data will be lost

Defined in compileFlatten.c

Expr_ptr 
CompileFlatten_resolve_name(
  Expr_ptr  expr, 
  node_ptr  context 
)
Takes an expression representing an identifier and recursively evaluates it. This function is repsonsible of building the symbolic name of the given symbol n in module instance context. If the given symbol is a formal parameter of the module instance, than the actual parameter is built. If the given symbol is an array, than the expression referring to the element of the array must evaluate to an unique integer (not to a set of integers) in the range of array bound.

See Also compile_flatten_resolve_name_recur
Defined in compileFlatten.c

void 
Compile_CheckProgram(
  node_ptr  procs, 
  node_ptr  spec_expr, 
  node_ptr  ltlspec_expr, 
  node_ptr  invar_expr, 
  node_ptr  justice_expr, 
  node_ptr  compassion_expr 
)
The main routine performing all the check on the read model.
First it loops on the body of processes to verify that there are no multiple assignments and circular definitions.
Then performs circularity checks on the list of SPECS, LTL SPECS, INVARIANT SPECS, FAIRNESS constraints.
The last operation performed consists in detecting multiple assignments between different modules.

Defined in compileCheck.c

int 
Compile_CheckWff(
  node_ptr  wff, 
  node_ptr  context 
)
It analizes a formula on the basis of its arguments and operators and returns 0 if the formula is ok, 1 otherwise

See Also check_wff_recur
Defined in compileCheckWff.c

void 
Compile_End(
    
)
Shut down the compile package

Defined in compileCmd.c

void 
Compile_FlattenHierarchy(
  Encoding_ptr  senc, 
  node_ptr  root_name, the ATOM representing the module at
the top of the hierarchy.
  node_ptr  name, the name of the module at the top of the hierarchy.
  node_ptr * trans, the list of TRANS actually recognized
  node_ptr * init, the list of INIT actually recognized
  node_ptr * invar, the list of INVAR actually recognized
  node_ptr * spec, the list of SPEC actually recognized
  node_ptr * compute, the list of COMPUTE actually recognized
  node_ptr * ltl_spec, the list of LTLSPEC actually recognized
  node_ptr * invar_spec, the list of INVARSPEC actually recognized
  node_ptr * justice, the list of JUSTICE actually recognized
  node_ptr * compassion, the list of COMPASSION actually recognized
  node_ptr * procs, the list of processes actually recognized
  node_ptr  actual the actual module arguments
)
Traverses the module hierarchy and extracts the information needed to compile the automaton. The hierarchy of modules is flattened, the variables are contextualized, the various parts of the model read in are extracted (i.e. the formulae to be verified, the initial expressions, ...)...
Moreover all these informations are flattened.

Side Effects None

See Also compileFlattenHierarchy
Defined in compileFlatten.c

node_ptr 
Compile_FlattenSexpExpandDefine(
  const Encoding_ptr  senc, 
  node_ptr  sexp, 
  node_ptr  context 
)
Flattens an expression and expands defined symbols.

See Also Flatten_GetDefinition
Defined in compileFlatten.c

node_ptr 
Compile_FlattenSexp(
  const Encoding_ptr  senc, 
  node_ptr  sexp, 
  node_ptr  context 
)
Builds the flattened version of an expression. It does not expand defined symbols with the corresponding body.

See Also Flatten_GetDefinition
Defined in compileFlatten.c

void 
Compile_FlattenTableau(
  Encoding_ptr  senc, 
  node_ptr  root_name, the ATOM representing the module at the top of the hierarchy.
  node_ptr  name, the name of the module at the top of the hierarchy.
  node_ptr * trans, the list of TRANS actually recognized
  node_ptr * init, the list of INIT actually recognized
  node_ptr * invar, the list of INVAR actually recognized
  node_ptr * spec, the list of SPEC actually recognized
  node_ptr * compute, the list of COMPUTE actually recognized
  node_ptr * ltl_spec, the list of LTLSPEC actually recognized
  node_ptr * invar_spec, the list of INVARSPEC actually recognized
  node_ptr * justice, the list of JUSTICE actually recognized
  node_ptr * compassion, the list of COMPASSION actually recognized
  node_ptr * procs, the list of processes actually recognized
  node_ptr  actual the actual module arguments
)
Traverses the module tableau and extracts the information needed to compile the automaton. The tableau of modules is flattened, the variables are contextualized, the various parts of the model read in are extracted (i.e. the formulae to be verified, the initial expressions, ...)...
Moreover all these informations are flattened.

Side Effects None

See Also Compile_FlattenHierarchy compileFlattenHierarchy
Defined in compileFlatten.c

void 
Compile_InitializeBuildModel(
    
)
Checks correctness of the NuSMV progrma if not yet checked. Initializes the build model if not yet initialized.

Side Effects required

See Also optional
Defined in compileUtil.c

void 
Compile_Init(
    
)
Initializes the compile package.

Defined in compileCmd.c

int 
Compile_WriteFlattenBool(
  const Encoding_ptr  senc, 
  FILE* out, 
  SexpFsm_ptr  fsm, 
  cmp_struct_ptr  s 
)
[Prints on the specified file the flatten version of an SMV model.

Defined in compileWriteBool.c

int 
Compile_WriteFlatten(
  const Encoding_ptr  senc, 
  FILE* out, 
  cmp_struct_ptr  s 
)
[Prints on the specified file the flatten version of an SMV model.

Defined in compileWriteFlat.c

NodeList_ptr 
Compile_get_expression_dependencies(
  const Encoding_ptr  senc, 
  Expr_ptr  expression 
)
Calls Formula_GetDependencies to get the set of variables which appear in the expression. This is then converted to the type NodeList_ptr and returned. It is the responsibility of the caller to destroy the NodeList object

Side Effects NodeList object created

Defined in compileCheck.c

boolean 
Compile_is_input_variable_formula(
  const Encoding_ptr  senc, 
  node_ptr  n 
)
Returns true if the given formula contains input variable, false otherwise.

Defined in compileCheckWff.c

Set_t 
ComputeCOI(
  const Encoding_ptr  senc, 
  Set_t  base 
)
Computes the COI of a given set of variables.

Defined in compileCone.c

static node_ptr 
Flatten_FlattenSexpRecur(
  const Encoding_ptr  senc, 
  node_ptr  sexp, 
  node_ptr  context 
)
Recursive function for flattenig a sexp.

See Also Compile_FlattenSexp Compile_FlattenSexpExpandDefine
Defined in compileFlatten.c

node_ptr 
Flatten_GetDefinition(
  const Encoding_ptr  senc, 
  node_ptr  atom 
)
Gets the flattened version of an atom. If the atom is a define then it is expanded. If the definition mode is set to "expand", then the expanded flattened version is returned, otherwise, the atom is returned.

Side Effects The flatten_def_hash is modified in order to memoize previously computed definition expansion.

Defined in compileFlatten.c

Set_t 
Formula_GetDependencies(
  const Encoding_ptr  senc, 
  node_ptr  formula, 
  node_ptr  context 
)
The set of dependencies of a given formula are computed. A traversal of the formula is performed. Each time a variable is encountered, it is added to the so far computed set. When a formula depends on a next variable, then the corresponding current variable is added to the set. When an atom is found a call to formulaGetDefinitionDependencies is performed to compute the dependencies.

See Also formulaGetDefinitionDependencies
Defined in compileCone.c

Set_t 
Formulae_GetDependencies(
  const Encoding_ptr  senc, 
  node_ptr  formula, 
  node_ptr  justice, 
  node_ptr  compassion 
)
Given a formula and a list of fairness constraints, the set of variables occurring in them is computed.

Defined in compileCone.c

BddFsm_ptr 
FsmBuilder_create_bdd_fsm(
  const FsmBuilder_ptr  self, 
  BddEnc_ptr  enc, 
  const SexpFsm_ptr  sexp_fsm, 
  const TransType  trans_type 
)
Creates a BddFsm instance from a given SexpFsm

Defined in compileFsmMgr.c

SexpFsm_ptr 
FsmBuilder_create_sexp_fsm(
  const FsmBuilder_ptr  self, 
  const Encoding_ptr  senc, 
  VarSet_ptr  vars_list, 
  const enum SexpFsmType  type 
)
The caller becomes the owner of the returned object

Defined in compileFsmMgr.c

FsmBuilder_ptr 
FsmBuilder_create(
  DdManager* dd 
)
The constructor creates a BddEnc and self handles it

Defined in compileFsmMgr.c

void 
FsmBuilder_destroy(
  FsmBuilder_ptr  self 
)
Class FsmBuilder destructor

Defined in compileFsmMgr.c

static node_ptr 
add2bexpr_recur(
  BddEnc_ptr  enc, 
  add_ptr  bool_add, 
  boolean  in_next, 
  boolean  allow_nondet, 
  hash_ptr  lc 
)
Auxiliary function for add2bexpr.

Side Effects A new boolean variable can be introduced.

See Also add2bexpr Utils_is_in_range
Defined in compileBEval.c

static node_ptr 
add2bexpr(
  add_ptr  bool_add, 
  boolean  in_next, 
  boolean  allow_nondet 
)
Takes an ADD with leaves 0, 1, or {0,1}. The case of {0,1} leaves is allowed only if flag allow_nondet is set to true.

Side Effects A new boolean variable can be introduced.

See Also add2bexpr_recur mk_new_var
Defined in compileBEval.c

static void 
check_assign_both(
  node_ptr  v, 
  int  node_type, 
  int  lineno 
)
Checks if there exists in the model an assignments of type node_type for variable v. If such an assignment exists, then an error is generated.

Defined in compileCheck.c

static void 
check_assign(
  BddEnc_ptr  enc, 
  node_ptr  n, 
  node_ptr  context, 
  int  mode 
)
This function detects either multiple or circular assignments in "context" regarding to "mode". If mode is equal to 0 (zero) then it checks for multiple assignments or symbols redefinition. Otherwise it performs checks for circular assignments.

Defined in compileCheck.c

static void 
check_circular_assign(
  BddEnc_ptr  enc, 
  node_ptr  n, 
  node_ptr  context, 
  boolean  is_next, 
  boolean  is_lhs, 
  boolean  lhs_is_next 
)
Checks for circular assignments in the model. If there are any, then an error is generated. NEXT operator, if any, must be stripped away from given expression 'n', and in that case is_next must be set to true. Parameter is_lhs is true at the first call (done with the first left-hand-side value (the assigned value)

Defined in compileCheck.c

static void 
check_circ(
  BddEnc_ptr  enc, 
  node_ptr  n, 
  node_ptr  context, 
  boolean  is_next, 
  boolean  lhs_is_next 
)
This function checks for circular definition of any kind. This function is able to detect circularity of the following kinds: where alpha(x) (alpha(next(x))) is a formula in which the variable x (next(x)) occurs. Notice that next(alpha(x)) can be rewritten in term of next(x), since the next operator distributes along all kind of operators.

Defined in compileCheck.c

static wff_result_type 
check_definition(
  BddEnc_ptr  enc, 
  node_ptr  n 
)
Given the symbol represented by n, this function returns the its definition as a wff result.

See Also Compile_CheckWff
Defined in compileCheckWff.c

static wff_result_type 
check_wff_recur(
  BddEnc_ptr  enc, 
  node_ptr  wff, 
  node_ptr  context 
)
Performs the recursive step of the Compile_CheckWff function.

Side Effects wfftype_hash

See Also Compile_CheckWff
Defined in compileCheckWff.c

void 
check_wff(
  node_ptr  wff, 
  node_ptr  context 
)
It analizes a formula on the basis of its arguments and operators and returns the domain type of the result that the formula will generate. Possible results are:
  • BOOLEAN
  • SYMBOLIC
  • NUMERIC
  • ERROR (erroneous mismatch between arguments)
  • NIL (internal error)

See Also Compile_CheckWff check_wff_recur
Defined in compileCheckWff.c

static void 
coiInit(
  const Encoding_ptr  senc 
)
Computes the COI of all the variables in the current model

See Also ComputeCOI
Defined in compileCone.c

void 
compileCheckAssignForInputVars(
  Encoding_ptr  senc, 
  node_ptr  assign 
)
If the flattened assign statement contains input variables then this function will print out an error message. Note that input variables are allowed in some parts of an assign statement. They're not allowed anywhere in an init section and cannot be contained within a next statement inside a next declaration.

Defined in compileCheck.c

void 
compileCheckForInputVars(
  Encoding_ptr  senc, 
  node_ptr  trans_expr, 
  node_ptr  init_expr, 
  node_ptr  invar_expr, 
  node_ptr  assign_expr 
)
Checks the TRANS, INIT, INVAR and ASSIGN statements to make sure that input variables are not used where they should not be. That is, anywhere in a TRANS, INIT or INVAR statement and within next expressions in the init and next sections of an ASSIGN statement.

Defined in compileCheck.c

void 
compileCheckInitForInputVars(
  Encoding_ptr  senc, 
  node_ptr  init 
)
If the flattened init statement contains input variables then this function will print out an error message.

Defined in compileCheck.c

void 
compileCheckInvarForInputVars(
  Encoding_ptr  senc, 
  node_ptr  invar 
)
If the flattened invar statement contains input variables then this function will print out an error message.

Defined in compileCheck.c

void 
compileCheckTransForInputVars(
  Encoding_ptr  senc, 
  node_ptr  trans 
)
If the flattened trans statement contains input variables within next() statements then this function will print out an error message.

Defined in compileCheck.c

boolean 
compileExpressionHasNextInputs(
  Encoding_ptr  senc, 
  node_ptr  expr 
)
Returns true if the expression contains a next statement which itself has an input variable in it.

Defined in compileCheck.c

static Set_t 
compileFlattenConstantSexpCheck(
  Encoding_ptr  senc, 
  node_ptr  expr, 
  int  type 
)
If the constant is trivially true, it is skipped; otherwise it will be associated to each fsm of all state variables

Side Effects required

See Also optional
Defined in compileFlatten.c

static void 
compileFlattenHierarchy(
  Encoding_ptr  senc, 
  node_ptr  root_name, the ATOM representing the module
at the top of the hierarchy.
  node_ptr  name, the name of the module at the top of the hierarchy.
  node_ptr * trans, the list of TRANS actually recognized
  node_ptr * init, the list of INIT actually recognized
  node_ptr * invar, the list of INVAR actually recognized
  node_ptr * spec, the list of SPEC actually recognized
  node_ptr * compute, the list of COMPUTE actually recognized
  node_ptr * ltl_spec, the list of LTLSPEC actually recognized
  node_ptr * invar_spec, the list of INVARSPEC actually recognized
  node_ptr * justice, the list of JUSTICE actually recognized
  node_ptr * compassion, the list of COMPASSION actually recognized
  node_ptr * assign, the list of ASSIGN actually recognized
  node_ptr * procs, the list of processes actually recognized
  node_ptr  actual the actual module arguments
)
Traverses the module hierarchy and extracts the information needed to compile the automaton. The hierarchy of modules is flattened, the variables are contextualized, the various parts of the model read in are extracted (i.e. the formulae to be verified, the initial expressions, ...)...
Notice that this function only manage s_expr and not ADD or BDD.

Side Effects None

Defined in compileFlatten.c

static void 
compileFlattenProcessRecur(
  const Encoding_ptr  senc, 
  node_ptr  assign, 
  node_ptr  context, 
  node_ptr  running 
)
Recursive definition of Compute_FlattenProcess

Defined in compileFlatten.c

node_ptr 
compileFlattenProcess(
  Encoding_ptr  senc, 
  node_ptr  procs_expr 
)
This functions takes in input the list of processes resulting from the instantiation step and builds a hash table ASSIGNthat associates to each variable the following informations:
  • init(var) -> (list_i init_assign_i)
    where init_assign_i is the right side of the initialization assignement of the variable var in process i.
  • next(var) -> (list_i Pi.running -> next_assign_i)
    where next_assign_i is the right side of the next assignement for the variable var in process i. When other processes not affecting the variable are running, the variable stutter.
  • var -> (list_i Pi.running -> normal_assign_i)
    where normal_assign_i is the right side of the normal (invariant) assignement for the variable var in process i. When other variables not affecting the variable are running, the variable is free to evolve randomly assuming a value among its possible values.

Defined in compileFlatten.c

static void 
compileFlattenSexpModelAux(
  Encoding_ptr  senc, 
  node_ptr  expr, 
  int  type 
)
optional

Side Effects required

See Also optional
Defined in compileFlatten.c

static void 
compileFlattenSexpModelRecur(
  Encoding_ptr  senc, 
  node_ptr  expr, 
  int  type 
)
optional

Side Effects required

See Also optional
Defined in compileFlatten.c

void 
compileFlattenSexpModel(
  Encoding_ptr  senc, 
  node_ptr  init_expr, 
  node_ptr  invar_expr, 
  node_ptr  trans_expr 
)
Associate to each variables the small pieces of the trans where the variable occurs, in a way similar to Compile_FlattenProcess

See Also Compile_FlattenProcess
Defined in compileFlatten.c

void 
compile_create_flat_model(
    
)
Initializes the fsm builder if needed, and creates the master scalar fsm only if required

Defined in compileCmd.c

Expr_ptr 
compile_flatten_resolve_name_recur(
  Expr_ptr  n, 
  node_ptr  context 
)
Performs the recursive step of CompileFlatten_resolve_name.

See Also CompileFlatten_resolve_name
Defined in compileFlatten.c

static void 
create_process_symbolic_variables(
  Encoding_ptr  senc, 
  node_ptr  procs_expr 
)
Creates the internal process selector variable. The internal process selector variable is as default positioned at the top of the ordering. It is attached to input_variables and all_variables too.

Side Effects input_variables and all_variables are affected.

Defined in compileFlatten.c

Expr_ptr 
detexpr2bexpr(
  Expr_ptr  expr 
)
Takes an scalar expression intended to evaluate to boolean, maps through booleans down to the atomic scalar propositions, builds the corresponding boolean function, and returns the resulting boolean expression. The conversion of atomic scalar proposition is currently performed by generating the corresponding ADD, and then printing it in terms of binary variables. An error is returned is determinization variables are introduced in the booleanization process.

Side Effects None

See Also expr2bexpr expr2bexpr_recur
Defined in compileBEval.c

static node_ptr 
expr2bexpr_recur(
  BddEnc_ptr  enc, 
  node_ptr  expr, 
  boolean  in_next, 
  boolean  allow_nondet 
)
Takes an expression intended to evaluate to boolean, maps through booleans down to the atomic scalar propositions, builds the corresponding boolean function, and returns the resulting boolean expression. The conversion of atomic scalar proposition is currently performed by generating the corresponding ADD, and then printing it in terms of binary variables. The introduction of determinization variables is allowed only if flag allow_nondet is set to true.

Side Effects None

See Also expr2bexpr detexpr2bexpr
Defined in compileBEval.c

Expr_ptr 
expr2bexpr(
  Expr_ptr  expr 
)
Takes an scalar expression intended to evaluate to boolean, maps through booleans down to the atomic scalar propositions, builds the corresponding boolean function, and returns the resulting boolean expression. The conversion of atomic scalar proposition is currently performed by generating the corresponding ADD, and then printing it in terms of binary variables.

Side Effects None

See Also detexpr2bexpr expr2bexpr_recur
Defined in compileBEval.c

static Set_t 
formulaGetDefinitionDependencies(
  const Encoding_ptr  senc, 
  node_ptr  formula 
)
This function computes the dependencies of an atom. If the atom corresponds to a variable then the singleton with the variable is returned. If the atom corresponds to a "running" condition the singleton with variable PROCESS_SELECTOR_VAR_NAME is returned. Otherwise if the atom corresponds to a defined symbol the dependency set corresponding to the body of the definition is computed and returned.

Side Effects The define_dep_hash is modified in order to memoize previously computed dependencies of defined symbols.

See Also Formula_GetDependencies
Defined in compileCone.c

static Set_t 
formulaGetDependenciesRecur(
  const Encoding_ptr  senc, 
  node_ptr  formula, 
  node_ptr  context 
)
Recursive call to Formula_GetDependencies.

See Also Formula_GetDependencies formulaGetDefinitionDependencies
Defined in compileCone.c

static void 
fsm_builder_clusterize_expr_aux(
  const FsmBuilder_ptr  self, 
  BddEnc_ptr  enc, 
  ClusterList_ptr  clusters, 
  Expr_ptr  expr_trans, 
  boolean  is_inside_and 
)
Auxiliary function to recursively traverse the given expression, clusterizing each node as bdd. If called from outside, parameter is_inside_and is false.

Side Effects given cluster list will change

Defined in compileFsmMgr.c

static ClusterList_ptr 
fsm_builder_clusterize_expr(
  FsmBuilder_ptr  self, 
  BddEnc_ptr  enc, 
  Expr_ptr  expr 
)
Each cluster into the list represents a piece of transition relation. One important requirement is that the given expr should not contain duplicates. See for example SexpFsm_get_{init, invar, trans} on how to obtain a well formed expression

Defined in compileFsmMgr.c

static CompassionList_ptr 
fsm_builder_compassion_sexp_to_bdd(
  FsmBuilder_ptr  self, 
  BddEnc_ptr  enc, 
  node_ptr  compassion_sexp_list 
)
The caller becomes the wner of the returned object. Internally used by the bdd fsm building code

Defined in compileFsmMgr.c

static void 
fsm_builder_deinit(
  FsmBuilder_ptr  self 
)

Defined in compileFsmMgr.c

static void 
fsm_builder_init(
  FsmBuilder_ptr  self, 
  DdManager* dd 
)

Defined in compileFsmMgr.c

static JusticeList_ptr 
fsm_builder_justice_sexp_to_bdd(
  FsmBuilder_ptr  self, 
  BddEnc_ptr  enc, 
  node_ptr  justice_sexp_list 
)
The caller becomes the wner of the returned object. Internally used by the bdd fsm building code

Defined in compileFsmMgr.c

static void 
init_check_program_recur(
  node_ptr  l 
)
Performs recursive step of init_check_program. Loops over the list of process names and inserts the process symbolic name in the check_constant_hash.

Defined in compileCheck.c

static void 
init_check_program(
  node_ptr  procs_exp 
)
Initializes the data structure to perform semantic checks. The check constant hash is filled in with the names of the declared processes.

Defined in compileCheck.c

static void 
instantiate_by_name(
  Encoding_ptr  senc, 
  node_ptr  root_name, 
  node_ptr  name, 
  node_ptr * trans, 
  node_ptr * init, 
  node_ptr * invar, 
  node_ptr * spec, 
  node_ptr * compute, 
  node_ptr * ltl_spec, 
  node_ptr * invar_spec, 
  node_ptr * justice, 
  node_ptr * compassion, 
  node_ptr * assign, 
  node_ptr * procs, 
  node_ptr  actual 
)
Uses root_name as root module in the flattening of the hierarchy. The name of the module in the hierarchy is name. First checks if the module exists. Then it checks if the module is recursively defined, and if the case an error is printed out. If these checks are passed, then it proceeds in the instantiation of the body of the module.

Defined in compileFlatten.c

void 
instantiate_vars(
  Encoding_ptr  senc, 
  node_ptr  var_list, 
  node_ptr  mod_name, 
  node_ptr * trans, 
  node_ptr * init, 
  node_ptr * invar, 
  node_ptr * spec, 
  node_ptr * compute, 
  node_ptr * ltl_spec, 
  node_ptr * invar_spec, 
  node_ptr * justice, 
  node_ptr * compassion, 
  node_ptr * assign, 
  node_ptr * procs 
)
Recursively applies instantiate_var to a given list of variables declaration, and performs some check for multiple variable definitions.

See Also instantiate_var
Defined in compileFlatten.c

void 
instantiate_var(
  Encoding_ptr  senc, 
  node_ptr  name, 
  node_ptr  type, 
  node_ptr * trans, 
  node_ptr * init, 
  node_ptr * invar, 
  node_ptr * spec, 
  node_ptr * compute, 
  node_ptr * ltl_spec, 
  node_ptr * invar_spec, 
  node_ptr * justice, 
  node_ptr * compassion, 
  node_ptr * assign, 
  node_ptr * procs, 
  node_ptr  context 
)
It takes as input a variable and a context, and depending on the type of the variable some operation are performed in order to instantiate it in the given context:

  • BOOLEAN
    if the variable is of type boolean, then we add an entry in symbol_hash saying that the variable range is {0,1}.
  • RANGE
    if the variable is a range of the form M..N, then we add an entry in the symbol_hash saying that the variable range is {M, M+1, ..., N-1, N}. If M is less or equal to N, than an error occurs.
  • SCALAR
    if the variable is a scalar variable whose possible values are {a1, a2, ..., aN}, then we add an entry in the symbol_hash saying that the variable range is {a1, ..., aN}.
  • ARRAY
    for each element of the array it is created the corresponding symbol. Suppose you have the following definition "VAR x : array 1..4 of boolean;". We call this function for 4 times, asking at each call i (i from 1 to 4) to declare the boolean variable x[i].
  • MODULE
    If the variable is an instantiation of a module, than their arguments (if any) are contextualized, and passed as actual parameter to instantiate_by_name with the name of the instantiated module as root name (to extract its definition) and as variable name as the name of the module (to perform flattening).
  • PROCESS
    If the variable is of type process, than we extract the module name and args, we perform the contextualization of the process arguments and we perform a call to compileFlattenHierarchy using the variable name as process name (to perform flattening), the module name as root name (to extract its definition) and the computed actual parameters.

The variables of type boolean, scalar, and array depending the kind of variable instantiation mode are appended to input_variables or to state_variables.

See Also instantiate_vars
Defined in compileFlatten.c

static void 
instantiate(
  Encoding_ptr  senc, 
  node_ptr  mod_def, 
  node_ptr  mod_name, 
  node_ptr * trans, 
  node_ptr * init, 
  node_ptr * invar, 
  node_ptr * spec, 
  node_ptr * compute, 
  node_ptr * ltl_spec, 
  node_ptr * invar_spec, 
  node_ptr * justice, 
  node_ptr * compassion, 
  node_ptr * assign, 
  node_ptr * procs, 
  node_ptr  actual 
)
This function is responsible of the instantiation of the body of a module. The module definition is mod_def and the module name mod_name are passed as arguments. First we instantiate the arguments of the given module. Then it loops over the module definition searching for defined symbols (i.e. those introduced by the keyword DEFINE) and inserts their definition in the symbol_hash. After this preliminary phase it loops again over module body in order to performs the other instantiation, and to extract all the information needed to compile the automaton, i.e. the list of processes, the TRANS statements, the INIT statements, ... and so on.

See Also instantiate_var instantiate_vars
Defined in compileFlatten.c

static node_ptr 
make_atom_set(
  node_ptr  l 
)
Given a range it builds the corresponding internal representation in term of UNION.

Defined in compileFlatten.c

static void 
make_params(
  node_ptr  basename, 
  node_ptr  actual, 
  node_ptr  formal 
)
Builds the parameters of a module from the list of formal parameters of the module itself and a basename.
There must be a one to one correspondence between the elements of actual and formal parameters. If the number of elements of the lists are different then, an error occurs.

Side Effects In the param_hash, the new parameter is associated to the old one.

Defined in compileFlatten.c

static node_ptr 
mk_and(
  node_ptr  a, 
  node_ptr  b 
)
optional

See Also optional
Defined in compileFlatten.c

static node_ptr 
mk_false(
    
)
optional

See Also optional
Defined in compileFlatten.c

static node_ptr 
mk_new_var(
  Encoding_ptr  senc 
)
Creates a fresh variable name, creates the corresponding name expressions, stores it as input variable, creates the corresponding encoding, builds and stores the resulting variable node. A side note, in order to submit a booleanized formula to the evaluator to obtain the corresponding BDD, a new BddEnc has to be created after the booleanization.

Side Effects A new dd variable is created.

See Also INT_VAR_PREFIX det_counter Compile_EncodeVar
Defined in compileBEval.c

static node_ptr 
mk_true(
    
)
optional

See Also optional
Defined in compileFlatten.c

int 
parsecheckwffcmd(
  int  argc, 
  char ** argv, 
  node_ptr * pc 
)
Parses string looking for a SIMPLE / CTL / LTL/ COMPUTE expression. Return 0 if an expected expression has been parsed, 1 otherwise. The parsed expression is stored in pc.

Defined in compileCheckWff.c

static void 
print_assign(
  FILE * out, 
  node_ptr  lhs, 
  node_ptr  rhs 
)
[Prints an assignement statement

Defined in compileWriteFlat.c

static void 
print_io_atom_stack_assign(
  FILE * fd 
)

Defined in compileCheck.c

static node_ptr 
put_in_context(
  node_ptr  v 
)
Put a variable in the current "context", which is stored in param_context.

Side Effects None

See Also param_context
Defined in compileFlatten.c

static node_ptr 
scalar_atom2bexpr(
  BddEnc_ptr  enc, 
  node_ptr  expr, 
  boolean  in_next, 
  boolean  allow_nondet 
)
Takes an atomic expression and converts it into a cooresponding boolean expression. The introduction of determinization variables is allowed only if flag allow_nondet is set to true.

Side Effects A new boolean variable can be introduced.

See Also add2bexpr_recur mk_new_var
Defined in compileBEval.c

node_ptr 
sym_intern(
  char * s 
)
Builds an internal representation for a given string. If the conversion has been performed in the past, then the hashed value is returned back, else a new one is created, hashed and returned. We hash this in order to allow the following:
  VAR
     x : {a1, a2, a3};
     y : {a3, a4, a5};

  ASSIGN
     next(x) := case
                 x = y    : a2;
                 !(x = y) : a1;
                 1        : a3;
                esac;
  
i.e. to allow the equality test between x and y. This can be performed because we internally have a unique representation of the atom a3.

See Also find_atom
Defined in compileUtil.c

static char * 
type_to_string(
  int  type 
)
optional

See Also optional
Defined in compileFlatten.c

static boolean 
wff_is_boolean(
  node_ptr  l 
)
Checks if an atom is boolean or symbolic.

See Also wff_is_numeric
Defined in compileCheckWff.c

static boolean 
wff_is_numeric(
  node_ptr  l 
)
Checks if an atom is numeric or symbolic.

See Also wff_is_boolean
Defined in compileCheckWff.c

static int 
write_flatten_assign(
  const Encoding_ptr  senc, 
  FILE* out 
)
Writes flattened ASSIGN declarations in SMV format on a file.

See Also write_flatten_assign_recur
Defined in compileWriteFlat.c

static int 
write_flatten_bfexpr(
  const Encoding_ptr  senc, 
  FILE* out, 
  node_ptr  n, 
  char* s 
)
Writes a generic expression prefixed by a given string in SMV format on a file.

Defined in compileWriteBool.c

static int 
write_flatten_define(
  const Encoding_ptr  senc, 
  FILE* out 
)
Writes DEFINE declarations in SMV format on a file.

Defined in compileWriteFlat.c

static int 
write_flatten_expr_pair(
  const Encoding_ptr  senc, 
  FILE* out, 
  node_ptr  l, 
  char* s 
)
Writes a list of flattened expression pairs prefixed by a given string in SMV format on a file.

Defined in compileWriteBool.c

static int 
write_flatten_expr_pair(
  const Encoding_ptr  senc, 
  FILE* out, 
  node_ptr  l, 
  char* s 
)
Writes a list of flattened expression pairs prefixed by a given string in SMV format on a file.

Defined in compileWriteFlat.c

static int 
write_flatten_expr(
  const Encoding_ptr  senc, 
  FILE* out, 
  node_ptr  n, 
  char* s 
)
Writes a generic expression prefixed by a given string in SMV format on a file.

Defined in compileWriteBool.c

static int 
write_flatten_expr(
  const Encoding_ptr  senc, 
  FILE* out, 
  node_ptr  n, 
  char* s 
)
Writes a generic expression prefixed by a given string in SMV format on a file.

Defined in compileWriteFlat.c

static int 
write_flatten_vars(
  const Encoding_ptr  senc, 
  FILE* out, 
  node_ptr  lov, 
  char* str 
)
Writes VAR declarations in SMV format on a file.

Defined in compileWriteBool.c

static int 
write_flatten_vars(
  const Encoding_ptr  senc, 
  FILE* out, 
  node_ptr  lov, 
  char* str 
)
Writes VAR declarations in SMV format on a file.

Defined in compileWriteFlat.c

static int 
write_process_selector_define(
  const Encoding_ptr  senc, 
  FILE* out 
)
Writes DEFINE declarations in SMV format on a file.

Defined in compileWriteFlat.c

 
(
    
)
Indicates that the body of a define is under the flattening, it is usde to discover possible recursive definitions.

See Also Flatten_GetDefinition
Defined in compileFlatten.c

 
(
    
)
Indicates that the COI computation should be verbose.

Defined in compileCone.c

 
(
    
)
The value used during the building of dependencies of defined symbols to keep track that compuation is ongoing to discover circular definitions.

Defined in compileCone.c

 
(
    
)
This is the internal symbolic name of process selector variable. The range of this variable is the set of names of the instantiated processes.

Defined in compile.h

Last updated on 2004/08/06 15h:37