library colibrilib.generic_divrem_rewrite — module DefCmodule DefC457use real.RealInfix458use real.Abs459use real.FromInt460461use colibrilib.q.Real as Real462463use real.Truncate as Truncate464465function ceil (d:real) (_:real) : int = Truncate.ceil d466predicate in_bound_c (y r:real) = if y >. 0. then -. y <. r <=. 0. else 0. <=. r <. -. y467468use Round469
The axiom in_bound_uniq of the clone
Valid (145ms) (cvc4)
472 let lemma uniq_c (x y r:real) (d:int)
473 requires { y <> 0. }
474 requires { in_bound_c y r }
475 requires { x = y *. from_int d +. r }
476 ensures { d = ceil (x /. y) y /\ r = x -. y *. from_int (ceil (x /. y) y) }
477 = assert { x /. y = from_int d +. r /. y };
478 if y >. 0. then assert { -. 1. <. r /. y <=. 0. }
479 else assert { -. 1. <. r /. y <=. 0. };
480 ceil_shift d (r /. y)
481
482 clone Gen as GC {…
begin
(* cloned colibrilib.generic_divrem_rewrite.Gen *)
Valid (18ms) (colibri2)
lemma GC.round_increasing
Valid (19ms) (colibri2)
lemma GC.round_zero
Valid (115ms) (cvc5)
lemma GC.round_add_int
function GC.div real real : int
function GC.mod real real : real
Valid (52ms) (cvc4) (split_vc) (depth 1)
lemma GC.mod_in_bound
Valid (196ms) (cvc4)
lemma GC.in_bound_scale
Valid (160ms) (cvc4)
lemma GC.in_bound_bigger_scale
Valid (321ms) (cvc5)
lemma GC.in_bound_scale2
Valid (31ms) (colibri2)
lemma GC.in_bound_uniq
Valid (535ms) (cvc4)
lemma GC.Scaling
function GC.div_int int int : int
function GC.mod_int int int : int
let ghost GC.mod_from_int int int : int
let ghost GC.divmod_uniq real real real int : unit
let ghost GC.divmod_uniq2 real real real int : unit
let ghost GC.divmod_facts real real : unit
let ghost GC.mod_unique real real real int : unit
let ghost GC.on_diff_period real real real int : unit
let ghost GC.on_mod real real : unit
let ghost GC.on_add real real real : unit
let ghost GC.on_mul real real int int int : unit
let ghost GC.on_mul_x_int int real real : unit
let ghost GC.on_mul_int int int int : unit
let ghost GC.on_add_period real real int : unit
let ghost GC.on_scale real real real : unit
let ghost GC.on_x_mul_to_y real real real : unit
let ghost GC.on_neg real real : unit
let ghost GC.on_sub real real real : unit
let ghost GC.on_y_scale real real int : unit
let ghost GC.when_in_bound real real : unit
let ghost GC.on_out_mod real real real : unit
let ghost GC.on_same real : unit
let ghost GC.on_zero real : unit
let ghost GC.on_eq_mod real real real real : unit
let ghost GC.on_eq_div real real real : unit
let ghost GC.mod_split real real int : unit
let ghost GC.mod_mod_divisible real real int : unit
let ghost GC.div_mod_divisible real real int : int
let ghost GC.div_split real real int : unit
end
} with function round = ceil, predicate in_bound = in_bound_c
483
484 use int.Int
Changing the sign of both arguments
Valid (37ms) (cvc5)
487 let ghost neg_both (x y:real) : unit
488 requires { y <> 0. }
489 ensures { GC.mod (-. x) (-. y) = -. GC.mod x y }
490 ensures { GC.div (-. x) (-. y) = GC.div x y } =
491 GC.divmod_facts x y;
492 GC.divmod_uniq (-. x) (-. y) (-. GC.mod x y) (GC.div x y)
y * div x y is the smallest multiple of y not below x (ceil_a_nz of colibrilib/congruence.mlw)
Valid (584ms) (cvc4)
496 let ghost div_min (x y:real) (k:int) : unit
497 requires { y >. 0. }
498 requires { x <=. from_int k *. y }
499 ensures { GC.div x y <= k } =
500 GC.divmod_facts x y;
501 let d = GC.div x y in
502 if k <= d - 1 then begin
503 assert { from_int k <=. from_int d -. 1. };
504 assert { from_int k *. y <=. (from_int d -. 1.) *. y };
505 assert { false }
506 end
507
508end