module WpFroms:This file groups functions needed to check the fonctional dependenciessig
..end
Build a strategy for each of the \from property of the function behavior
val dkey : string
exception NoFromForBhv
exception NoFromForLoop of Cil_types.stmt
exception NoFromForCall of Cil_types.stmt
val mk_name : string ->
Kernel_function.t ->
Cil_types.kinstr -> ('a, 'b) Cil_types.behavior -> int -> string -> string
val mk_linfo_type : Cil_types.logic_type option * Cil_types.logic_type list ->
Cil_types.logic_type
in_types
and return an out_type
result (None
for a predicate)val make_logic_info : string ->
Cil_types.logic_type option * Cil_types.logic_type list ->
Cil_types.logic_info
logic_info
with fname
and the signature given by
(out_type, in_types)
(see WpFroms.mk_linfo_type
)
TODO: should be Cil_const.make_logic_info
when it be finished.val get_linfo : string ->
Cil_types.logic_type option * Cil_types.logic_type list ->
Cil_types.logic_info
logic_info
for the given name and signature.
Build and register it if it doesn't exist yet.
val mk_bhv_implicit_fun_name : Kernel_function.t ->
Cil_types.kinstr -> ('a, 'b) Cil_types.behavior -> int -> string
val mk_loop_implicit_fun_name : Cil_types.stmt -> int -> string
val get_pred_linfo : Kernel_function.t ->
Cil_types.kinstr ->
('a, 'b) Cil_types.behavior ->
int -> Cil_types.logic_type -> Cil_types.logic_info
val get_init_linfo : Kernel_function.t ->
Cil_types.kinstr ->
('a, 'b) Cil_types.behavior ->
int -> int -> Cil_types.logic_type -> Cil_types.logic_info
val get_implicit_fun : string ->
Cil_types.logic_type * Cil_types.logic_type list -> Cil_types.logic_info
val build_elem_opt : addrlab:Cil_types.logic_label ->
mlab:Cil_types.logic_label -> Cil_types.term -> Cil_types.term option
\at (mlab, * (\at (addrlab, & elem)))
.
This is needed because the left part of assigns properties is an lvalue
which address has to be interpreted in the pre-state (addrlab
),
but its value is to be considered in the post-state (mlab
).val build_elem : addrlab:Cil_types.logic_label ->
mlab:Cil_types.logic_label -> Cil_types.term -> Cil_types.term
build_elem_opt
above.val build_post_output : Cil_types.termination_kind ->
Cil_types.identified_term -> Cil_types.term option
assigns
property
Process \result
and \exit_status
according to termination_kind
.
Returns None
if out
is not compatible with termination_kind
.
val mk_assign_post : Kernel_function.t ->
('a, 'b) Cil_types.behavior ->
int ->
Cil_types.termination_kind ->
Cil_types.identified_term * 'c -> Cil_types.identified_predicate option
P(out)
where out
is the left part of the assigns property.
Process \result
and \exit_status
according to termination_kind
.
Returns None
if out
is not compatible with termination_kind
.
module Vars:sig
..end
val build_fimpl_eq : string ->
Cil_types.term ->
Cil_types.term list option -> Cil_types.predicate Cil_types.named
out = f_n (inputs)
.
The correct label \at should already be in output
and inputs
.
NoFromForBhv
if inputs = None
meaning FromAny
.val bhv_from_hyps : Kernel_function.t ->
Cil_types.kinstr ->
('a, 'b) Cil_types.behavior ->
(Cil_types.identified_term * Cil_types.identified_term Cil_types.deps) list ->
Cil_types.termination_kind ->
((Cil_types.identified_term * Cil_types.identified_term Cil_types.deps) *
Cil_types.predicate Cil_types.named)
list
from, out_i = implicit_fun_i (inputs)
for each out_i \from inputs
assigns property of the behavior.
The from
part is for identification purpose later on.
implicit_fun_i
is the implicit fonction for the output.
kf
and ki
give information to know there the specification comes from
in order to build the names for the implicit functions.
termination_kind
is used to filter \result
and \exit_status
when needed.val post_of_spec_assigns : Kernel_function.t ->
Cil_types.kinstr ->
Cil_types.funspec ->
Cil_types.termination_kind ->
(Cil_types.funbehavior *
(Cil_types.identified_term * Cil_types.identified_term Cil_types.deps) *
Cil_types.predicate Cil_types.named)
list
assumes => out_i = implicit_fun_i (inputs)
.
If the assigns information is missing from a behavior, try to use
the whole assigns information of the spec.
NoFromForBhv
if we don't manage to compute the assigns information.
See bhv_from_hyps
above.val inv_of_loop_from : Cil_types.stmt ->
int ->
Cil_types.identified_term * Cil_types.identified_term Cil_types.deps ->
Cil_types.predicate Cil_types.named
val mk_assign_pre : Kernel_function.t ->
Cil_types.kinstr ->
('a, 'b) Cil_types.behavior ->
int -> Cil_types.identified_term list -> Cil_types.identified_predicate
xi = Init (i) /\ ...
forall inputs part of the assigns property.val annot_for_asked_bhv : 'a list -> 'a -> bool
val get_loop_assigns_for_froms : string ->
Cil_types.stmt ->
(Cil_types.code_annotation * Cil_types.identified_term Cil_types.from list)
option
val add_loop_assigns_hyp : Cil_types.kernel_function ->
string -> Cil_types.stmt -> WpStrategy.t_annots -> WpStrategy.t_annots
val add_stmt_spec_assigns_hyp : WpStrategy.t_annots * 'a ->
Cil_types.kernel_function ->
Cil_types.stmt ->
Cil_types.logic_label option -> Cil_types.funspec -> WpStrategy.t_annots * 'a
val add_call_assigns_hyp : WpStrategy.t_annots * 'a ->
Cil_types.kernel_function ->
Cil_types.stmt ->
Cil_types.logic_label option -> Cil_types.funspec -> WpStrategy.t_annots * 'a
val add_spec_annots : Kernel_function.t ->
Cil_types.stmt ->
Cil_types.logic_label option ->
Cil_types.funspec ->
WpStrategy.t_annots * (WpStrategy.t_annots * WpStrategy.t_annots) ->
WpStrategy.t_annots * (WpStrategy.t_annots * WpStrategy.t_annots)
NoFromForBhv
is the assigns information is missing.val get_stmt_hyp : Kernel_function.t ->
string ->
Cil_types.stmt ->
Cil_types.logic_label option ->
WpStrategy.t_annots * (WpStrategy.t_annots * WpStrategy.t_annots)
val get_called_post : Kernel_function.t -> Cil_types.termination_kind -> WpStrategy.t_annots
ensures
properties ?
NoFromForBhv
is the assigns information is missing.val get_call_hyp : Cil_types.kernel_function ->
Cil_types.stmt ->
Cil_types.logic_label option ->
Cil_types.exp ->
WpStrategy.t_annots * (WpStrategy.t_annots * WpStrategy.t_annots)
val get_fct_bhv_from_annots : Cil2cfg.t ->
Cil_types.funbehavior ->
int -> Cil_types.identified_term Cil_types.from -> WpStrategy.annots_tbl
val mk_strategy_for_fct_from : Cil2cfg.t ->
Cil_types.funbehavior ->
WpStrategy.t_annots ->
Cil_types.identified_term * Cil_types.identified_term Cil_types.deps ->
WpStrategy.strategy
val pp_err : Format.formatter -> exn -> unit
val get_bhv_pre : Kernel_function.t -> Cil_types.funbehavior -> WpStrategy.t_annots
val get_strategy_for_from : Kernel_function.t * Cil_types.kinstr * Property.behavior_or_loop *
(Cil_types.identified_term * Cil_types.identified_term Cil_types.deps) ->
WpStrategy.strategy
val get_strategies_for_froms : Kernel_function.t -> WpStrategy.strategy list
from
properties of the function.
At the moment, only the function behaviors are handled,
but the strategies make use of the from
properties of stmt spec,
loops and called functions.