Module Aorai_utils


module Aorai_utils: sig .. end
exception to avoid pre computation with structure and array*

Given a transition a function name and a function status (call or return) it returns if the cross condition can be statisfied with only function status.


exception LazyInit
exception to avoid pre computation with structure and array*
val isCrossable : Promelaast.trans -> string -> Promelaast.funcStatus -> bool
Given a transition a function name and a function status (call or return) it returns if the cross condition can be statisfied with only function status.
val debug_display_func_status : string -> unit
val get_next : string -> Promelaast.funcStatus -> bool array -> bool array * bool array
Given a function name, is status (call or return) and an array of boolean describing states status, it returns a couple of boolean array. The first one describes the set of reachable states and the second one is the set of crossable transitions.

Given a function name, is status (call or return) and an array of boolean describing states status, it returns a couple of boolean array. The first one describes the set of reachable states and the second one is the set of crossable transitions.

val get_prev : string ->
Promelaast.funcStatus -> bool array * bool array -> bool array * bool array
Given a function name, its status (call or return) and an array of boolean describing states status, it returns a couple of boolean array. The first one describes the set of possible initial states and the second one is the set of crossable transitions.

Given a function name, is status (call or return) and an array of boolean describing states status, it returns a couple of boolean array. The first one describes the set of possible initial states and the second one is the set of crossable transitions.

val mk_pre_or_post_bycase_from_pre_or_post : bool array * bool array -> bool array array * bool array array
val debug_display_func_status_bycase : string -> unit
val compose_assocs_post : bool array -> bool array array * bool array array -> bool array * bool array
bool array -> (bool array array*bool array array) -> (bool array*bool array)
val mk_forward_composition : bool array array ->
bool array array * bool array array -> bool array array * bool array array
bool array array -> (bool array array*bool array array) -> (bool array array*bool array array) Given a set of states and the bycase post-condition of an operation this function returns the new pre-condition after the call of the operation in the context of current_st.

Given a set of states and the bycase post-condition of an operation this function returns the new post-condition after the execution of the operation in the context of current_st.

val compose_assocs_pre : bool array ->
'a * bool array -> bool array array * 'b -> bool array * bool array
bool array -> (bool array * bool array) (bool array array*bool array array) -> (bool array*bool array)
val mk_backward_composition : bool array array ->
'a * bool array ->
bool array array * 'b -> bool array array * bool array array
bool array array -> (bool array*bool array) -> (bool array array*bool array array) -> (bool array array*bool array array) Given a set of states and the bycase post-condition of an operation this function returns the new pre-condition after the call of the operation in the context of current_st.

Given a set of states and the bycases pre and post-conditions of an operation this function returns the new pre-condition before the execution of the operation in the context of current_st.

val get_next_bycase : string ->
Promelaast.funcStatus ->
bool array array -> bool array array * bool array array
Given a function name, is status (call or return) and an array of boolean describing states status, it returns a couple of boolean array. The first one describes the set of reachable states and the second one is the set of crossable transitions.

Given a function name, is status (call or return) and an array of boolean describing states status, it returns a couple of boolean array. The first one describes the set of reachable states and the second one is the set of crossable transitions.

val get_prev_bycase : string ->
Promelaast.funcStatus ->
bool array array * bool array array -> bool array array * bool array array
Given a function name, is status (call or return) and an array of boolean describing states status, it returns a couple of boolean array. The first one describes the set of possible initial states and the second one is the set of crossable transitions.

Given a function name, is status (call or return) and an array of boolean describing states status, it returns a couple of boolean array. The first one describes the set of possible initial states and the second one is the set of crossable transitions.

val isCrossableAtInit : Promelaast.trans -> string -> bool
Given a transition a function name and a function status (call or return) it returns if the cross condition can be statisfied with only function status.

Given a transition a function name and a function status (call or return) it returns if the cross condition can be statisfied with only function status.


Expressions management
val mk_int_exp : int -> Cil_types.exp
Returns an int constant expression which represents the given int value.
val mk_offseted_array_lval : string -> Cil_types.exp -> Cil_types.lval
Returns an lval expression which represents the access of the host_name variable (a string) with the offset off_exp (an expression).
val mk_int_offseted_array_lval : string -> int -> Cil_types.lval
Returns an lval expression which represents the access of the host_name variable (a string) with the offset off_value (an int).
val get_concrete_param_from_formal : String.t ->
Cil_types.varinfo list ->
Cil_types.exp list -> string -> int -> Cil_types.exp_node
val get_concrete_value_of_call : string -> int option -> String.t list -> Cil_types.exp_node list
Compute the set of concrete value of a call, associated to a given list of parameters.
Returns a list of exp_node, such that each formal parameter from paramlist is affected by the associated expression.
f : name of the called function
sid : stmt id of the call
paramlist : list of parameters name
val get_concrete_value_of_return : string -> Cil_types.exp_node
Compute the concrete value of a return
Returns an exp_node.
f : name of the called function
val crosscond_to_exp : Promelaast.condition ->
string -> Promelaast.funcStatus -> int option -> Bool3.bool3 * Cil_types.exp
This function rewrite a cross condition into a Cil expression. Moreover, by giving current operation name and its status (call or return) the generation simplifies the generated expression. This function is use only to compute the C code of synchronization.
val crosscond_to_pred : Promelaast.condition ->
Cil_types.logic_var -> Cil_types.logic_var -> Cil_types.predicate
This function rewrite a cross condition into a Cil expression. Moreover, by giving current operation name and its status (call or return) the generation simplifies the generated expression. This function is used to compute the axiomatized automata
cross : condition to convert from Promelaast.condition to Cil_types.predicate
op_logic_var : operation variable
status_logic_var : status variable (call/return)

Buchi automata and C code synchronisation
val mk_expr_disjunction : Cil_types.exp list -> Cil_types.exp
val conj_crosscond_old : Bool3.bool3 * Cil_types.exp -> Cil_types.exp -> Cil_types.exp

Computed formula : OR(tr) (crosscond(tr) && i==curStateTMPtransStart(tr))
val upd_one_state : Promelaast.trans list ->
int -> Cil_types.location -> bool array -> bool array -> Cil_types.instr
It remains only to affect this result to curStatestate

Computed formula : crosscond(trans) && curStateTMPtransStart(trans) && curStatetransStop(trans)
val upd_one_trans : Promelaast.trans ->
string ->
Promelaast.funcStatus ->
Cil_types.location ->
bool array -> bool array -> int option -> bool * Cil_types.instr
It remains only to affect this result to curTranstrans
val synch_upd_linear : Promelaast.state list * Promelaast.trans list ->
string ->
Promelaast.funcStatus ->
Cil_types.location -> string option -> int option -> Cil_types.instr list
This function returns the list of instructions that have to be introduced just before each call of function and each return of function. These instructions correspond to the synchronisation between C code and Buchi automata. The parameters are :
func : the name of the function that is called or that returns
status : the status of this action (call or return)
loc : the localisation associated to this generated code
caller : the name of the caller (if any)
sid : the stmt id of the call (if any)
val synch_upd : Promelaast.state list * Promelaast.trans list ->
string ->
Promelaast.funcStatus ->
Cil_types.location -> string option -> int option -> Cil_types.instr list
This function returns the list of instructions that have to be introduced just before each call of function and each return of function. These instructions correspond to the synchronisation between C code and Buchi automata. The parameters are :

This function returns the list of instructions that have to be introduced just before each call of function and each return of function. These instructions correspond to the synchronisation between C code and Buchi automata. The parameters are :

  1. The buchi automata
  2. the name of the function that is called or that returns
  3. the status of this action (call or return)
  4. the localisation associated to this generated code
  5. the name of the caller (if any)
  6. the stmt id of the call (if any)

automata : The buchi automata
func : the name of the function that is called or that returns
status : the status of this action (call or return)
loc : the localisation associated to this generated code
caller : the name of the caller (if any)
sid : the stmt id of the call (if any)

Globals management
val file : Cil_types.file Pervasives.ref
Local copy of the file pointer
val initFile : Cil_types.file -> unit
Copy the file pointer locally in the class in order to ease globals management and initializes some tables.

Copy the file pointer locally in the class in order to easiest globals management and initializes some tables.

val globals_queue : Cil_types.global list Pervasives.ref
List of globals awaiting for adding into C file globals
val flush_globals : unit -> unit
Flush all queued globals declarations into C file globals.
val mk_global_c_initialized_vars : string -> Cil_types.typ -> Cil_types.initinfo -> unit
val mk_global_c_vars : string -> Cil_types.typ -> unit
val mk_int_const : int -> Cil_types.exp
val mk_global_c_initialized_array : string -> int -> Cil_types.initinfo -> unit
val mk_global_c_array : string -> int -> unit
val mk_global_c_int : string -> unit
val mk_global_c_enum_type_tagged : string -> (string * int) list -> Cil_types.enuminfo
val mk_global_c_enum_type : string -> string list -> unit
val mk_global_c_enum : string -> string -> unit
val mk_global_c_initialized_enum : string -> string -> Cil_types.initinfo -> unit

Terms management / computation
val mk_int_term : int -> Cil_types.term
Return an integer constant term from the given value.
val zero_term : unit -> Cil_types.term
Return an integer constant term with the 0 value.

Return an integer constant term with the 0 value.

val mk_term_from_logic_var : Cil_types.logic_var -> Cil_types.term
Returns a term representing the given logic variable (usually a fresh quantified variable).
val mk_term_from_vi : Cil_types.varinfo -> Cil_types.term
Returns a term representing the variable associated to the given varinfo

Returns a term representing the given logic variable (usually a fresh quantified variable).

val mk_offseted_array : Cil_types.term_lval -> int -> Cil_types.term
Given an lval term 'host' and an integer value 'off', it returns a lval term hostoff.

Given an lval term 'host' and an integer value 'off', it returns a lval term hostoff.

val int2enumstate : int -> Cil_types.typ -> Cil_types.term
val mk_offseted_array_states_as_enum : Cil_types.term_lval -> int -> Cil_types.term
Given an lval term 'host' and an integer value 'off', it returns a lval term hostoff.
val mk_offseted_array_lval_from_term : Cil_types.term_lval -> Cil_types.term -> Cil_types.term
Given an lval term 'host' and a term 'term_off', it returns a lval term hostoff.
val mk_offseted_array_lval_from_lval : Cil_types.term_lval -> Cil_types.logic_var -> Cil_types.term
Given an lval term 'host' and a logic variable 'lvar_off', it returns a lval term hostoff. Usually, logic variables stand for fresh quantified variables.
val mk_logic_call : string -> Cil_types.logic_var list -> Cil_types.term
Given the name of a logic and a list of logic variables it returns a call of the logic with variables as parameters.
val host_state_term : unit -> Cil_types.term_lval
Returns a lval term associated to the curState generated variable.
val host_stateOld_term : unit -> Cil_types.term_lval
Returns a lval term associated to the curStateOld generated variable.
val host_trans_term : unit -> Cil_types.term_lval
Returns a lval term associated to the curTrans generated variable.
val mk_logicvar_intervalle : Cil_types.logic_var -> int -> int -> Cil_types.predicate
Given a logic variable and two bounces, it returns the predicate: min<=v<max
val mk_eq_tables : string -> string -> int -> Cil_types.predicate
Given two names of generated arrays and their size, it returns the predicate: (forall i. 0<=i<size => host1i==host2i)
val mk_valid_range : string -> int -> Cil_types.predicate
Given a name of generated array and its size, it returns the expression: (Valide_range(name,0,size-)
val mk_conjunction : Cil_types.predicate list -> Cil_types.predicate
val mk_conjunction_named : Cil_types.predicate Cil_types.named list ->
Cil_types.predicate Cil_types.named
Given a NON EMPTY list of predicates, it returns a conjunction of these predicates.
val mk_disjunction : Cil_types.predicate list -> Cil_types.predicate
val mk_disjunction_named : Cil_types.predicate Cil_types.named list ->
Cil_types.predicate Cil_types.named
Given a NON EMPTY list of predicates, it returns a disjunction of these predicates.
val mk_global_invariant : Cil_types.predicate -> string -> unit
val mk_global_comment : string -> unit
val mk_global_logic : string ->
Cil_types.logic_var list ->
Cil_types.logic_type option -> Cil_types.global_annotation
Given
  1. the name of the logic (string),
  2. the list of its genericity parameter names (string),
  3. the list of their type (logic_var),
  4. the type of the function return
  5. and a list of reads tsets, it returns a logic function declaration. A side effect of this function is the registration of this logic into the logics hashtbl from Data_for_aorai.

val mk_global_axiom : string -> Cil_types.predicate -> Cil_types.global_annotation
val mk_global_predicate : string ->
string list -> Cil_types.logic_var list -> Cil_types.predicate -> unit
val mk_decl_axiomatized_automata : unit -> unit
Generates an axiomatisation of transitions from automata into globals. These annotations are used to express some pre and post condition properties

Initialization management / computation
val get_states_trans_init : string ->
Cil_types.initinfo * Cil_types.initinfo * Cil_types.initinfo *
Cil_types.initinfo
val func_to_init : string -> Cil_types.initinfo
val funcStatus_to_init : Promelaast.funcStatus -> Cil_types.initinfo
class visit_decl_loops_init : unit -> object .. end
val mk_decl_loops_init : unit -> unit
val mk_invariant_1 : unit -> unit
val mk_invariant_2 : unit -> unit
val mk_invariant_3 : unit -> unit
val mk_invariant_4 : unit -> unit
val mk_invariant_5 : unit -> unit
val mk_invariant_6 : unit -> unit
val mk_invariant_1_2 : unit -> unit
val mk_invariant_2_2 : unit -> unit
val mk_invariant_2_2_1 : unit -> unit
val mk_invariant_2_2_2 : unit -> unit
val mk_invariant_3_2 : unit -> unit
val mk_invariant_4_2 : unit -> unit
val mk_invariant_StatesDisjunction : unit -> unit
val mk_invariant_TransitionsDisjunction : unit -> unit
val make_enum_states : unit -> unit
val initGlobals : string -> bool -> unit
This function computes all newly introduced globals (variables, enumeration structure, invariants, etc.

Given the name of the main function, this function computes all newly introduced globals (variables, enumeration structure, invariants, etc.)


Pre/post management
val mk_abstract_pre_post : 'a list * Promelaast.trans list ->
string -> Promelaast.funcStatus -> bool array * bool array
Function called by mk_asbstract_pre and mk_asbstract_post.

Pre and post condition of C functions In our point of view, the pre or the post condition of a C function are defined by the set of states authorized just before/after the call, as such as the set of crossable transitions. The following functions generates abstract pre and post-conditions by using only informations deduced from the buchi automata.
val mk_asbstract_pre : 'a list * Promelaast.trans list -> string -> bool array * bool array
Given the buchi automata and the name of a function, it returns two arrays corresponding to the abstract pre-condition.

Given the buchi automata and the name of a function, it returns two arrays corresponding to the abstract pre-condition.

val mk_asbstract_post : 'a list * Promelaast.trans list -> string -> bool array * bool array
Given the buchi automata and the name of a function, it returns two arrays corresponding to the abstract post-condition.

Given the buchi automata and the name of a function, it returns two arrays corresponding to the abstract post-condition.

val pre_post_to_term : bool array * bool array -> Cil_types.predicate Cil_types.named list
Generates a term representing the given pre or post condition. Transitions and states are rewritten into predicates in the same manner. The computation is then generalized Conjunction of forbidden and disjunction of authorized are computed together.

Generates a term representing the given pre or post condition. Transitions and states are rewrited into predicates in the same maner. The computation is then generalized Conjunction of forbidden and disjunction of authorized are compute together.

val force_condition_to_predicate : bool array * bool array -> bool array * bool array -> Cil_types.predicate
val display : string -> unit
val display_operations_spec__ : bool -> bool -> unit
Intermediate function that factorizes some functionalities. This function is designed to be internally called.
val display_operations_spec : unit -> unit
Some displaying functions
val display_operations_spec_bycase : unit -> unit
val display_operations_spec_sorted : unit -> unit
val display_operations_spec_sorted_bycase : unit -> unit
val debug_display_all_specs : unit -> unit
val pasEtatOp : string -> string -> unit
val pasEtatAvantOp : string -> unit
val pasEtatApresOp : string -> unit
val pasEtatLoop : string -> string -> int -> unit
val pasEtatAvantLoop : int -> unit
val pasEtatApresLoop : int -> unit
val pasEtatAvantLoopBlock : int -> unit
val pasEtatApresLoopBlock : int -> unit
val display_all_warnings_about_operations_specs : unit -> unit
val display_all_warnings_about_loops_specs : unit -> unit
val display_all_warnings_about_specs : unit -> unit