Common — library colibrilib.dv — module RealFacts

Facts about the product and the rounding of the reals

223
module RealFacts
224
use int.Int
225
use real.RealInfix
226
use real.FromInt
227
use real.Truncate
228
Valid (19ms) (colibri2)
229
let ghost
mul_nonneg
(a b:real) : unit
230
requires { 0.0 <=. a /\ 0.0 <=. b }
231
ensures { 0.0 <=. a *. b }
232
= ()
233
Valid (14ms) (colibri2)
234
let ghost
mul_pos
(a b:real) : unit
235
requires { 0.0 <. a /\ 0.0 <. b }
236
ensures { 0.0 <. a *. b }
237
= ()
238
Valid (30ms) (colibri2)
239
let ghost
floor_shift
(x:real) (n:int) : unit
240
ensures { floor (x +. from_int n) = floor x + n }
241
= {proof…} assert { from_int n +. from_int (floor x) = from_int (n + floor x) };
242
assert { from_int (floor x + n) <=. x +. from_int n <. from_int (floor x + n + 1) };
243
assert { floor (x +. from_int n) = floor x + n
244
by from_int (floor (x +. from_int n)) <=. x +. from_int n <. from_int (floor (x +. from_int n) + 1) } {qed}
245
Valid (29ms) (colibri2)
246
let ghost
ceil_shift
(x:real) (n:int) : unit
247
ensures { ceil (x +. from_int n) = ceil x + n }
248
= {proof…} assert { from_int n +. from_int (ceil x) = from_int (n + ceil x) };
249
assert { from_int (ceil x + n - 1) <. x +. from_int n <=. from_int (ceil x + n) };
250
assert { ceil (x +. from_int n) = ceil x + n
251
by from_int (ceil (x +. from_int n) - 1) <. x +. from_int n <=. from_int (ceil (x +. from_int n)) } {qed}
252
end