module Ival:sig
..end
type
t = private
| |
Set of |
|||
| |
Float of |
(* | Top(min, max, rem, modulo) represents the interval between
min and max , congruent to rem modulo modulo . A value of
None for min (resp. max ) represents -infinity
(resp. +infinity). modulo is > 0, and 0 <= rem < modulo .
Actual | *) |
| |
Top of |
_int
expect arguments that are integers. Hence,
they will fail on an ival with constructor Float
. Conversely, _float
suffixed functions expect float arguments: the constructor Float
, or
the singleton set [| Int.zero |]
, that can be tested by Ival.is_zero
.
The function Ival.force_float
forces a bit-level conversion from the integer
representation to the floating-point one.Lattice_type
about over- and under-approximations,
and exact operations.module Widen_Hints:sig
..end
typesize_widen_hint =
Integer.t
typegeneric_widen_hint =
Widen_Hints.t
include Datatype.S_with_collections
include Lattice_type.Full_AI_Lattice_with_cardinality
val is_bottom : t -> bool
val partially_overlaps : size:Integer.t -> t -> t -> bool
val add_int : t -> t -> t
Float
) ivals.val add_int_under : t -> t -> t
val add_singleton_int : Integer.t -> t -> t
val neg_int : t -> t
val sub_int : t -> t -> t
val sub_int_under : t -> t -> t
val min_int : t -> Integer.t option
None
result means the argument is unbounded.
Raises Error_Bottom
if the argument is bottom.val max_int : t -> Integer.t option
None
result means the argument is unbounded.
Raises Error_Bottom
if the argument is bottom.val min_max_r_mod : t -> Integer.t option * Integer.t option * Integer.t * Integer.t
val min_and_max : t -> Integer.t option * Integer.t option
val bitwise_and : size:int -> signed:bool -> t -> t -> t
val bitwise_or : t -> t -> t
val bitwise_xor : t -> t -> t
val bitwise_not : t -> t
val bitwise_not_size : size:int -> signed:bool -> t -> t
val min_and_max_float : t -> Fval.F.t * Fval.F.t
val zero : t
val one : t
val minus_one : t
val zero_or_one : t
val positive_integers : t
val negative_integers : t
val float_zeros : t
val is_zero : t -> bool
val is_one : t -> bool
val contains_zero : t -> bool
val contains_non_zero : t -> bool
val top_float : t
val top_single_precision_float : t
exception Nan_or_infinite
val project_float : t -> Fval.t
Nan_or_infinite
when the float may be NaN or infinite.val force_float : Cil_types.fkind -> t -> bool * t
true
, some of the values may not be representable
as finite floats.val inject_singleton : Integer.t -> t
val inject_float : Fval.t -> t
val inject_float_interval : float -> float -> t
val inject_range : Integer.t option -> Integer.t option -> t
None
means unbounded. The interval is inclusive.val inject_interval : min:Integer.t option ->
max:Integer.t option -> rem:Integer.t -> modu:Integer.t -> t
min
and max
included and congruent
to rem
modulo modulo
. For min
and max
, None
is the corresponding
infinity. Checks that modu
> 0 and 0 <= rest
< modu
, and fails
otherwise.val cardinal_zero_or_one : t -> bool
val is_singleton_int : t -> bool
exception Not_Singleton_Int
val project_int : t -> Integer.t
Not_Singleton_Int
when the cardinal of the argument is not 1,
or if it is not an integer.val cardinal : t -> Integer.t option
cardinal v
returns n
if v
has finite cardinal n
, or None
if
the cardinal is not finite.val cardinal_estimate : t -> Integer.t -> Integer.t
cardinal_estimate v size
returns an estimation of the cardinal
of v
, knowing that v
fits in size
bits.val cardinal_less_than : t -> int -> int
cardinal_less_than t n
returns the cardinal of t
is this cardinal
is at most n
.Abstract_interp.Not_less_than
is the cardinal of t
is more than n
val cardinal_is_less_than : t -> int -> bool
val fold_int : (Integer.t -> 'a -> 'a) -> t -> 'a -> 'a
Error_Top
if the argument is a float or a potentially
infinite integer.val fold_int_decrease : (Integer.t -> 'a -> 'a) -> t -> 'a -> 'a
Error_Top
if the argument is a float or a potentially
infinite integer.val fold_enum : (t -> 'a -> 'a) -> t -> 'a -> 'a
Error_Top
if the argument is a
non-singleton float or a potentially infinite integer.val fold_int_bounds : (t -> 'a -> 'a) -> t -> 'a -> 'a
i
an integer abstraction min..max
, fold_int_bounds f i acc
tries to apply f
to min
, max
, and i'
successively, where i'
is i
from which min
and max
have been removed. If min
and/or
max
are infinite, f
is called with an argument i'
unreduced
in the corresponding direction(s).val apply_set : (Integer.t -> Integer.t -> Integer.t) -> t -> t -> t
val apply_set_unary : (Integer.t -> Integer.t) -> t -> t
val subdiv_float_interval : size:Fval.float_kind option -> t -> t * t
val subdiv_int : t -> t * t
val compare_min_float : t -> t -> int
compare_min_float m1 m2
returns 1 if the float interval m1
has a
better min bound (i.e. greater) than the float interval m2
.
compare_max_float m1 m2
returns 1 if the float interval m1
has a
better max bound (i.e. lower) than the float interval m2
.
val compare_max_float : t -> t -> int
compare_min_int m1 m2
returns 1 if the int interval m1
has a
better min bound (i.e. greater) than the int interval m2
.val compare_min_int : t -> t -> int
compare_max_int m1 m2
returns 1 if the int interval m1
has a
better max bound (i.e. lower) than the int interval m2
.val compare_max_int : t -> t -> int
val scale : Integer.t -> t -> t
scale f v
returns the interval of elements x * f
for x
in v
.
The operation is exact, except when v
is a float.val scale_div : pos:bool -> Integer.t -> t -> t
scale_div ~pos:false f v
is an over-approximation of the set of
elements x / f
for x
in v
.
scale_div ~pos:true f v
is an over-approximation of the set of
elements x pos_div f
for x
in v
.
val scale_div_under : pos:bool -> Integer.t -> t -> t
scale_div_under ~pos:false f v
is an under-approximation of the
set of elements x / f
for x
in v
.
scale_div_under ~pos:true f v
is an under-approximation of the
set of elements x pos_div f
for x
in v
.
val div : t -> t -> t
val scale_rem : pos:bool -> Integer.t -> t -> t
scale_rem ~pos:false f v
is an over-approximation of the set of
elements x mod f
for x
in v
.
scale_rem ~pos:true f v
is an over-approximation of the set of
elements x pos_rem f
for x
in v
.
val c_rem : t -> t -> t
val mul : t -> t -> t
val shift_left : t -> t -> t
val shift_right : t -> t -> t
val interp_boolean : contains_zero:bool -> contains_non_zero:bool -> t
val extract_bits : start:Integer.t -> stop:Integer.t -> size:Integer.t -> t -> t
start
to stop
from the given Ival, start
and stop
being included. size
is the size of the entire ival.val create_all_values_modu : modu:Integer.t -> signed:bool -> size:int -> t
val create_all_values : signed:bool -> size:int -> t
val all_values : size:Integer.t -> t -> bool
all_values ~size v
returns true iff v contains all integer values
representable in size
bits.val backward_mult_int_left : right:t -> result:t -> t option Bottom.or_bottom
val backward_comp_int_left : Abstract_interp.Comp.t -> t -> t -> t
backward_comp_int op l r
reduces l
into l'
so that
l' op r
holds. l
is assumed to be an integerval backward_comp_float_left : Abstract_interp.Comp.t ->
bool -> Fval.float_kind -> t -> t -> t
Ival.backward_comp_int_left
, except that the arguments should now
be floating-point values.val forward_comp_int : Abstract_interp.Comp.t -> t -> t -> Abstract_interp.Comp.result
val compare_max_min : Integer.t option -> Integer.t option -> int
min_int
and max_int
, None
represents the
corresponding infinity. compare_max_min ma mi
compares ma
to mi
,
interpreting None
for ma
as +infinity and None
for mi
as
-infinity.
In the results of min_int
and max_int
, None
represents the
corresponding infinity. compare_min_max mi ma
compares ma
to ma
,
interpreting None
for ma
as +infinity and None
for mi
as
-infinity.
val compare_min_max : Integer.t option -> Integer.t option -> int
val scale_int_base : Int_Base.t -> t -> t
val cast_float_to_int : signed:bool -> size:int -> t -> bool * (bool * bool) * t
val cast_float_to_int_inverse : single_precision:bool -> t -> t
val cast_int_to_float_inverse : single_precision:bool -> t -> t
val of_int : int -> t
val of_int64 : int64 -> t
val cast_int_to_float : Fval.rounding_mode -> t -> bool * t
val cast : size:Integer.t -> signed:bool -> value:t -> t
val cast_float : rounding_mode:Fval.rounding_mode -> t -> bool * t
val cast_double : t -> bool * t
val pretty_debug : Format.formatter -> t -> unit
val get_small_cardinal : unit -> int