package mopsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=37966e98ffeebcedc09bd6e9b2b81f69
sha512=40d4d826c25f680766c07eccbabdf5e8a4fa023016e8a164e4e4f6b3781c8484dc4df437055721dfd19b9db8fb7fe3b61236c4833186d346fc7204a68d01eaaa
doc/mopsa.mopsa_utils/Mopsa_utils/ItvUtils/IntItv/index.html
Module ItvUtils.IntItv
IntItv - Intervals for arbitrary precision integers.
We rely on Zarith for arithmetic operations, and IntBounds to represent unbounded intervals.
module B = ItvUtils.IntBoundTypes
type t_with_bot = t Core.Bot.with_botThe type of possibly empty intervals.
val is_valid : t -> boolConstructors
val of_int : int -> int -> tval of_int64 : int64 -> int64 -> tConstructs a non-empty interval.
val of_float : float -> float -> tConstructs a non-empty interval.
val of_bound_bot : B.t -> B.t -> t_with_botval of_range_bot : Z.t -> Z.t -> t_with_botval of_int_bot : int -> int -> t_with_botval of_int64_bot : int64 -> int64 -> t_with_botConstructs a possibly empty interval.
val of_float_bot : float -> float -> t_with_botConstructs a possibly empty interval.
val cst_int : int -> tval cst_int64 : int64 -> tval zero : t0,0
val one : t1,1
val mone : t-1,-1
val zero_one : t0,1
val mone_zero : t-1,0
val mone_one : t-1,1
val zero_inf : t0,+∞
val minf_zero : t-∞,0
val minf_inf : t-∞,+∞
val unsigned : int -> tval unsigned8 : tval unsigned16 : tval unsigned32 : tval unsigned64 : tIntervals of unsigned integers with the specified bitsize.
val signed : int -> tval signed8 : tval signed16 : tval signed32 : tval signed64 : tIntervals of two compement's integers with the specified bitsize.
Predicates
val equal_bot : t_with_bot -> t_with_bot -> boolval included_bot : t_with_bot -> t_with_bot -> boolval intersect_bot : t_with_bot -> t_with_bot -> boolA total ordering (lexical ordering) returning -1, 0, or 1. Can be used as compare for sets, maps, etc.
val compare_bot : t Core.Bot.with_bot -> t Core.Bot.with_bot -> intTotal ordering on possibly empty intervals.
val contains_zero : t -> boola,b contains 0.
val contains_one : t -> boola,b contains 1.
val contains_nonzero : t -> boola,b contains a non-zero value.
val is_zero : t -> boolval is_one : t -> boolval is_positive : t -> boolval is_negative : t -> boolval is_positive_strict : t -> boolval is_negative_strict : t -> boolval is_nonzero : t -> boolInterval sign.
val is_singleton : t -> boola,b contains a single element.
val is_bounded : t -> boola,b has finite bounds.
val is_minf_inf : t -> boola,b represents -∞,+∞.
Printing
val to_string : t -> stringval print : out_channel -> t -> unitval fprint : Format.formatter -> t -> unitval to_string_bot : t Core.Bot.with_bot -> stringval print_bot : out_channel -> t Core.Bot.with_bot -> unitval fprint_bot : Format.formatter -> t Core.Bot.with_bot -> unitval bprint_bot : Buffer.t -> t Core.Bot.with_bot -> unitEnumeration
List of elements, in increasing order. Raises an invalid argument if it is unbounded.
Set operations
val join_bot : t_with_bot -> t_with_bot -> t_with_botJoin of possibly empty intervals.
val join_list : t list -> t_with_botJoin of a list of (non-empty) intervals.
val meet : t -> t -> t_with_botIntersection of non-emtpty intervals (possibly empty)
val meet_bot : t_with_bot -> t_with_bot -> t_with_botIntersection of possibly empty intervals.
val meet_list : t list -> t_with_botMeet of a list of (non-empty) intervals.
val widen_bot : t_with_bot -> t_with_bot -> t_with_botval positive : t -> t_with_botval negative : t -> t_with_botPositive and negative part.
val meet_zero : t -> t_with_botIntersects with
.
val meet_nonzero : t -> t_with_botKeeps only non-zero elements.
Forward operations
Given one or two interval argument(s), return the interval result.
Division (with truncation). Returns a list of 0, 1, or 2 intervals to remain precise.
Euclidian division (towards -oo). Returns a list of 0, 1, or 2 intervals to remain precise.
val div : t -> t -> t_with_botDivision (with truncation). Returns a single (possibly empty) overapproximating interval.
val ediv : t -> t -> t_with_botDivision (euclidian, towards -oo) Returns a single (possibly empty) overapproximating interval.
val rem : t -> t -> t_with_botRemainder. Uses the C semantics for remainder (%).
val erem : t -> t -> t_with_botEuclidian remainder. rounding towards -oo
Put back the interval inside lo,up by modular arithmetics. Useful to model the effect of arithmetic or conversion overflow.
val to_bool : bool -> bool -> tConversion from integer to boolean in 0,1: maps 0 to 0 (false) and non-zero to 1 (true).
Logical negation. Logical operation use the C semantics: they accept 0 and non-0 respectively as false and true, but they always return 0 and 1 respectively for false and true.
Bit operations
val shift_left : t -> t -> t_with_botBitshift left: multiplication by a power of 2.
val shift_right : t -> t -> t_with_botBitshift right: division by a power of 2 rounding towards -∞.
val shift_right_trunc : t -> t -> t_with_botUnsigned bitshift right: division by a power of 2 with truncation.
Internal functions
Interval functions, based on the previous ones
Filters
Given two interval aruments, return the arguments assuming that the predicate holds.
val filter_leq : t -> t -> (t * t) Core.Bot.with_botval filter_geq : t -> t -> (t * t) Core.Bot.with_botval filter_lt : t -> t -> (t * t) Core.Bot.with_botval filter_gt : t -> t -> (t * t) Core.Bot.with_botval filter_eq : t -> t -> (t * t) Core.Bot.with_botval filter_neq : t -> t -> (t * t) Core.Bot.with_botBackward operations
Given one or two interval argument(s) and a result interval, return the argument(s) assuming the result in the operation is in the given result.
val bwd_default_unary : t -> t -> t_with_botFallback for backward unary operators
Fallback for backward binary operators
val bwd_neg : t -> t -> t_with_botval bwd_abs : t -> t -> t_with_botval bwd_succ : t -> t -> t_with_botval bwd_pred : t -> t -> t_with_botval bwd_bit_not : t -> t -> t_with_botBackward join: both arguments are intersected with the result.
val bwd_wrap : t -> (Z.t * Z.t) -> t -> t_with_botval pos_mod : ItvUtils.IntBound.t -> ItvUtils.IntBound.t -> ItvUtils.IntBound.t