Common — library colibrilib.kb_interval — module Export

The functions called by Colibri2 (they are total)

294
module Export
295
use int.Int
296
use real.FromInt
297
use option.Option
298
use colibrilib.q.Real as Real
299
use colibrilib.union_congr.UnionCongr as UC
300
use colibrilib.known_bits.KnownBits as KB
301
use colibrilib.zarith.Zbit
302
use colibrilib.safe_bits.BitsSpec
303
use KbInterval
304
Valid (45ms) (colibri2)
305
let
known_bits
(use_domain: bool) (t: UC.t) : option KB.t
306
ensures { match result with
307
| Some k -> forall x. UC.mem x t -> has_bits x k
308
| None -> forall x. UC.mem x t -> not Real.is_integer x end }
309
= KbInterval.known_bits use_domain t
310
Valid (52ms) (colibri2)
311
let
of_known_bits
(k: KB.t) : option UC.t
312
ensures { match result with
313
| Some t -> forall n. KB.mem n k -> UC.mem (from_int n) t
314
| None -> forall n. not KB.mem n k end }
315
= KbInterval.of_known_bits k Valid (41ms) (colibri2)
316
let
logand
(use_domain: bool) (va vb: UC.t) : option UC.t
317
ensures { prop2 Zbit.land va vb result }
318
= KbInterval.logand use_domain va vb
319
Valid (50ms) (colibri2)
320
let
logor
(use_domain: bool) (va vb: UC.t) : option UC.t
321
ensures { prop2 Zbit.lor va vb result }
322
= KbInterval.logor use_domain va vb
323
Valid (53ms) (colibri2)
324
let
logxor
(use_domain: bool) (va vb: UC.t) : option UC.t
325
ensures { prop2 Zbit.lxor va vb result }
326
= KbInterval.logxor use_domain va vb
327
Valid (51ms) (colibri2)
328
let
update
(use_domain: bool) (off len: int) (vsrc vdst: UC.t) : option UC.t
329
ensures { prop2 (fun xs xd -> BitsSpec.update off len xs xd) vsrc vdst result }
330
= KbInterval.update use_domain off len vsrc vdst Valid (56ms) (colibri2)
331
let
lognot
(use_domain: bool) (va: UC.t) : option UC.t
332
ensures { prop1 Zbit.lnot va result }
333
= KbInterval.lognot use_domain va
334
Valid (57ms) (colibri2)
335
let
shift_right
(use_domain: bool) (off: int) (va: UC.t) : option UC.t
336
ensures { prop1 (fun x -> Zbit.asr x off) va result }
337
= KbInterval.shift_right use_domain off va
338
Valid (42ms) (colibri2)
339
let
extract
(use_domain: bool) (off len: int) (va: UC.t) : option UC.t
340
ensures { prop1 (fun x -> BitsSpec.extract off len x) va result }
341
= KbInterval.extract use_domain off len va
342
Valid (53ms) (colibri2)
343
let
signed_extract
(use_domain: bool) (off len: int) (va: UC.t) : option UC.t
344
ensures { prop1 (fun x -> BitsSpec.signed_extract off len x) va result }
345
= KbInterval.signed_extract use_domain off len va
346
Valid (52ms) (colibri2)
347
let
testbit
(use_domain: bool) (va: UC.t) (i: int) : option KB.kind
348
ensures { match result with
349
| Some k -> forall x. UC.mem (from_int x) va ->
350
(k = KB.One -> Zbit.bittest x i) /\ (k = KB.Zero -> not Zbit.bittest x i)
351
| None -> forall x. UC.mem (from_int x) va -> false end }
352
= KbInterval.testbit use_domain va i
353
end