library colibrilib.kb_interval — module ExportThe functions called by Colibri2 (they are total)
module Export294use int.Int295use real.FromInt296use option.Option297use colibrilib.q.Real as Real298use colibrilib.union_congr.UnionCongr as UC299use colibrilib.known_bits.KnownBits as KB300use colibrilib.zarith.Zbit301use colibrilib.safe_bits.BitsSpec302use KbInterval303Valid (45ms) (colibri2)304let known_bits (use_domain: bool) (t: UC.t) : option KB.t305ensures { match result with306| Some k -> forall x. UC.mem x t -> has_bits x k307| None -> forall x. UC.mem x t -> not Real.is_integer x end }308= KbInterval.known_bits use_domain t309Valid (52ms) (colibri2)310let of_known_bits (k: KB.t) : option UC.t311ensures { match result with312| Some t -> forall n. KB.mem n k -> UC.mem (from_int n) t313| None -> forall n. not KB.mem n k end }314= KbInterval.of_known_bits k Valid (41ms) (colibri2)315let logand (use_domain: bool) (va vb: UC.t) : option UC.t316ensures { prop2 Zbit.land va vb result }317= KbInterval.logand use_domain va vb318Valid (50ms) (colibri2)319let logor (use_domain: bool) (va vb: UC.t) : option UC.t320ensures { prop2 Zbit.lor va vb result }321= KbInterval.logor use_domain va vb322Valid (53ms) (colibri2)323let logxor (use_domain: bool) (va vb: UC.t) : option UC.t324ensures { prop2 Zbit.lxor va vb result }325= KbInterval.logxor use_domain va vb326Valid (51ms) (colibri2)327let update (use_domain: bool) (off len: int) (vsrc vdst: UC.t) : option UC.t328ensures { prop2 (fun xs xd -> BitsSpec.update off len xs xd) vsrc vdst result }329= KbInterval.update use_domain off len vsrc vdst Valid (56ms) (colibri2)330let lognot (use_domain: bool) (va: UC.t) : option UC.t331ensures { prop1 Zbit.lnot va result }332= KbInterval.lognot use_domain va333Valid (57ms) (colibri2)334let shift_right (use_domain: bool) (off: int) (va: UC.t) : option UC.t335ensures { prop1 (fun x -> Zbit.asr x off) va result }336= KbInterval.shift_right use_domain off va337Valid (42ms) (colibri2)338let extract (use_domain: bool) (off len: int) (va: UC.t) : option UC.t339ensures { prop1 (fun x -> BitsSpec.extract off len x) va result }340= KbInterval.extract use_domain off len va341Valid (53ms) (colibri2)342let signed_extract (use_domain: bool) (off len: int) (va: UC.t) : option UC.t343ensures { prop1 (fun x -> BitsSpec.signed_extract off len x) va result }344= KbInterval.signed_extract use_domain off len va345Valid (52ms) (colibri2)346let testbit (use_domain: bool) (va: UC.t) (i: int) : option KB.kind347ensures { match result with348| Some k -> forall x. UC.mem (from_int x) va ->349(k = KB.One -> Zbit.bittest x i) /\ (k = KB.Zero -> not Zbit.bittest x i)350| None -> forall x. UC.mem (from_int x) va -> false end }351= KbInterval.testbit use_domain va i352end353