package mopsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=9f673f79708b44a7effb3b6bb3618d2c
sha512=cb91cb428e43a22f1abbcb8219710d0c10a5b3756d0da392d4084b3b3a6157350776c596983e63def344f617d39964e91f244f60c07958695ee5c8c809a9f0f4
doc/core/Core/Cases/index.html
Module Core.CasesSource
Cases - data structure for case-based transfer functions.
Transfer functions use Cases to return partitioned results. Cases are encoded as DNF formulas. Each individual case comes with a flow, a set of alarms, computation effects and cleaner statements. To represent suspended computations, the result of a case can be empty.
type 'r case = | Result of 'r * Effect.teffect * cleaners(*Actual result of the computation, with effects and cleaners
*)| Empty(*Empty results due to non-terminating computations (e.g. alarms)
*)| NotHandled(*This means that the domain can't process this case. The analyzer can ask other domains to handle it.
*)
A single case of a computation
Cases of results 'r over an abstraction 'a
val return :
?effects:Effect.teffect ->
?cleaners:Ast.Stmt.stmt list ->
'r ->
'a Flow.flow ->
('a, 'r) casesval singleton :
?effects:Effect.teffect ->
?cleaners:Ast.Stmt.stmt list ->
'r ->
'a Flow.flow ->
('a, 'r) casesCreate a case with a single non-empty result.
Create a non-handled case to be forwarded to other domains
val remove_duplicate_results :
('r -> 'r -> int) ->
'a Lattice.lattice ->
('a, 'r) cases ->
('a, 'r) casesRemove duplicate results
Cleaners
************
Option to apply cleaners on T_cur only
add_cleaners block c adds cleaner statements block to cases c.
Set the set of cleaners attached to a case
Set the same cleaners for all cases
Context
***********
get_ctx c returns the context of cases c.
set_ctx ctx c changes the context of cases c to ctx.
copy_ctx c1 c2 changes the context of cases c2 to the context of c1.
get_callstack c returns the callstack of cases c.
set_callstack cs c returns a copy of c with callstack cs.
Effects
***********
Get the effects attached to a case
Set the effects attached to a case
map_effects f c replaces each effects l in c with f l.
Set the same effects for all cases
Lattice operators
*********************
Join a list of cases.
Meet a list of cases.
Iterators
*************
val map :
('r case -> 'a Flow.flow -> 's case * 'a Flow.flow) ->
('a, 'r) cases ->
('a, 's) casesmap f c replaces each case ci*flow in c with f ci flow
map_result f c is similar to map f c, except that empty and not-handled cases are kept unmodified.
val map_conjunction :
(('r case * 'a Flow.flow) list -> ('s case * 'a Flow.flow) list) ->
('a, 'r) cases ->
('a, 's) casesmap_conjunction f c replaces each conjunction conj in c with f conj
val map_disjunction :
(('r case * 'a Flow.flow) list -> ('s case * 'a Flow.flow) list) ->
('a, 'r) cases ->
('a, 's) casesmap_disjunction f c replaces each disjunction disj in c with f disj
val reduce :
('r case -> 'a Flow.flow -> 'b) ->
join:('b -> 'b -> 'b) ->
meet:('b -> 'b -> 'b) ->
('a, 'r) cases ->
'breduce f ~join ~meet c collapses cases in c to a single value by applying f on each case and merging outputs using join and meet.
val reduce_result :
('r -> 'a Flow.flow -> 'b) ->
join:('b -> 'b -> 'b) ->
meet:('b -> 'b -> 'b) ->
bottom:(unit -> 'b) ->
('a, 'r) cases ->
'breduce_result f ~join ~meet bottom c is similar to reduce f join meet c, except that empty and not-handled cases are replaced with bottom.
Fold over the flattened list of cases
Fold over the flattened list of results
Iterate over the flattened list of cases
Iterate over the flattened list of results
val partition :
('r case -> 'a Flow.flow -> bool) ->
('a, 'r) cases ->
('a, 'r) cases option * ('a, 'r) cases optionpartition f cases separates cases that verify or not predicate f
Check whether a predicate is valid over all cases
Check whether a predicate is valid over all results
Check whether a predicate is valid for at least one case
Check whether a predicate is valid for at least one result
val print :
(Stdlib.Format.formatter -> 'r case -> 'a Flow.flow -> unit) ->
Stdlib.Format.formatter ->
('a, 'r) cases ->
unitPretty printer of cases
val print_result :
(Stdlib.Format.formatter -> 'r -> 'a Flow.flow -> unit) ->
Stdlib.Format.formatter ->
('a, 'r) cases ->
unitPretty printer of results
Monadic binders
val bind_opt :
('r case -> 'a Flow.flow -> ('a, 's) cases option) ->
('a, 'r) cases ->
('a, 's) cases optionbind_opt f cases substitutes each case (c,flow) in cases with f c flow. If the function returns None, the case becomes NotHandled. Effects and cleaners returned by f are concatenated with the previous ones in cases.
val (>>=?) :
('a, 'r) cases ->
('r case -> 'a Flow.flow -> ('a, 's) cases option) ->
('a, 's) cases optionBind operator for bind_opt
bind f cases substitutes each case (c,flow) in cases with f c flow. Effects and cleaners returned by f are concatenated with the previous ones in cases.
Bind operator for bind
val bind_result_opt :
('r -> 'a Flow.flow -> ('a, 's) cases option) ->
('a, 'r) cases ->
('a, 's) cases optionSame as bind_opt, but empty and not-handled cases are preserved and are not passed to f.
val (>>$?) :
('a, 'r) cases ->
('r -> 'a Flow.flow -> ('a, 's) cases option) ->
('a, 's) cases optionBind operator for bind_result_opt
Same as bind, but empty and not-handled cases are preserved and are not passed to f.
Bind operator for bind_result
val bind_conjunction :
(('r case * 'a Flow.flow) list -> ('a, 's) cases) ->
('a, 'r) cases ->
('a, 's) casesbind_conjunction f cases substitutes each conjunction of cases conj in cases with f conj. Effects and cleaners returned by f are concatenated with the previous ones in cases.
val bind_conjunction_result :
('r list -> 'a Flow.flow -> ('a, 's) cases) ->
'a Lattice.lattice ->
('a, 'r) cases ->
('a, 's) casesSame as bind_conjunction f cases] but empty and not-handled cases are preserved and are not passed to f.
val bind_disjunction :
(('r case * 'a Flow.flow) list -> ('a, 's) cases) ->
('a, 'r) cases ->
('a, 's) casesbind_disjunction f cases substitutes each disjunction of cases disj in cases with f disj. Effects and cleaners returned by f are concatenated with the previous ones in cases.
val bind_disjunction_result :
('r list -> 'a Flow.flow -> ('a, 's) cases) ->
'a Lattice.lattice ->
('a, 'r) cases ->
('a, 's) casesSame as bind_disjunction f cases] but empty and not-handled cases are preserved and are not passed to f.