package mopsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=37966e98ffeebcedc09bd6e9b2b81f69
sha512=40d4d826c25f680766c07eccbabdf5e8a4fa023016e8a164e4e4f6b3781c8484dc4df437055721dfd19b9db8fb7fe3b61236c4833186d346fc7204a68d01eaaa
doc/mopsa.mopsa_utils/Mopsa_utils/CongUtils/IntCong/index.html
Module CongUtils.IntCong
IntCong - Integer congruences.
We rely on Zarith for arithmetic operations.
Types
type t_with_bot = t Core.Bot.with_bot
The type of possibly empty congruence sets.
val is_valid : t -> bool
module I = ItvUtils.IntItv
module B = ItvUtils.IntBound
Arithmetic utilities
Returns the gcd, lcm and cofactors u, v such that ua+vb=gcd. Undefined if a or b is 0.
Constructors
val of_int : int -> int -> t
val of_int64 : int64 -> int64 -> t
val cst_int : int -> t
val cst_int64 : int64 -> t
val zero : t
0ℤ+0
val one : t
0ℤ+1
val mone : t
0ℤ-1
val minf_inf : t
1ℤ+0
val of_range_bot : Z.t -> Z.t -> t Core.Bot.with_bot
val of_bound_bot : B.t -> B.t -> t Core.Bot.with_bot
Congruence overapproximating an interval.
Predicates
val equal_bot : t_with_bot -> t_with_bot -> bool
val included_bot : t_with_bot -> t_with_bot -> bool
val intersect_bot : t_with_bot -> t_with_bot -> bool
A 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 -> int
Total ordering on possibly empty congruences.
val contains_zero : t -> bool
Whether the congruence contains zero.
val contains_one : t -> bool
Whether the congruence contains one.
val contains_nonzero : t -> bool
Whether the congruence contains a non-zero value.
val is_zero : t -> bool
val is_positive : t -> bool
val is_negative : t -> bool
val is_positive_strict : t -> bool
val is_negative_strict : t -> bool
val is_nonzero : t -> bool
Sign.
val is_minf_inf : t -> bool
The congruence represents -∞,+∞
.
val is_singleton : t -> bool
Whether the congruence contains a single element.
val is_bounded : t -> bool
Whether the congruence contains a finite number of elements.
Printing
val to_string : t -> string
val print : out_channel -> t -> unit
val fprint : Format.formatter -> t -> unit
val to_string_bot : t Core.Bot.with_bot -> string
val print_bot : out_channel -> t Core.Bot.with_bot -> unit
val fprint_bot : Format.formatter -> t Core.Bot.with_bot -> unit
val bprint_bot : Buffer.t -> t Core.Bot.with_bot -> unit
Set operations
val join_bot : t_with_bot -> t_with_bot -> t_with_bot
val join_list : t list -> t_with_bot
val meet : t -> t -> t_with_bot
Abstract intersection.
val meet_bot : t_with_bot -> t_with_bot -> t_with_bot
val meet_list : t list -> t_with_bot
val meet_range : t -> Z.t -> Z.t -> t_with_bot
Abstract intersection with lo,up
.
val positive : t -> t_with_bot
val negative : t -> t_with_bot
Positive and negative part.
val meet_zero : t -> t_with_bot
Intersects with
.
val meet_nonzero : t -> t_with_bot
Keeps only non-zero elements.
Forward operations
val div : t -> t -> t_with_bot
Division (with truncation).
val rem : t -> t -> t_with_bot
Remainder. Uses the C semantics for remainder (%).
val to_bool : bool -> bool -> t
Conversion from integer to boolean in 0,1
: maps 0 to 0 (false) and non-zero to 1 (true). 0;1
is over-approximated as ℤ.
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. 0;1
is over-approximated as ℤ.
C comparison tests. Returns an interval included in 0,1
(a boolean)
C comparison tests. Returns a boolean if the test may succeed
val shift_left : t -> t -> t_with_bot
Bitshift left: multiplication by a power of 2.
val shift_right : t -> t -> t_with_bot
Bitshift right: division by a power of 2 rounding towards -∞.
val shift_right_trunc : t -> t -> t_with_bot
Unsigned bitshift right: division by a power of 2 with truncation.
Filters
Given two interval aruments, return the arguments assuming that the predicate holds.
val filter_eq : t -> t -> (t * t) Core.Bot.with_bot
val filter_neq : t -> t -> (t * t) Core.Bot.with_bot
val filter_leq : t -> t -> (t * t) Core.Bot.with_bot
val filter_geq : t -> t -> (t * t) Core.Bot.with_bot
val filter_lt : t -> t -> (t * t) Core.Bot.with_bot
val filter_gt : t -> t -> (t * t) Core.Bot.with_bot
Backward 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_neg : t -> t -> t_with_bot
val bwd_abs : t -> t -> t_with_bot
val bwd_succ : t -> t -> t_with_bot
val bwd_pred : t -> t -> t_with_bot
val bwd_bit_not : t -> t -> t_with_bot
Backward join: both arguments and intersected with the result.
val bwd_wrap : t -> 'a -> t -> t_with_bot
Reduction
val meet_inter : t -> I.t -> (t * I.t) Core.Bot.with_bot
Intersects a congruence with an interval, and returns the set represented both as a congruence and as an interval. Useful to implement reductions.