Common — library colibrilib.fp_conv — module Export
6290
module Export
6291
use list.List
6292
use colibrilib.ring.Atom
6293
use colibrilib.fbin.Fp
6294
use Env
6295
use Rules
6296
use GTerm
6297
use Conv
6298
use Linearize
6299
use list.Mem as LM
6300
use option.Option
6301
use colibrilib.polynome.Lin as Lin
6302
use real.RealInfix
6303
use colibrilib.fp.Ereal
6304
use colibrilib.stda.StdA as A
6305
6306
let
convert
(d: env) (g: ground) : bool
6307
= Conv.convert d g

r was registered on the branch of d or above (trusted: the daemons of colibri2 are backtracked with the propagators)

  Valid (50ms) (colibri2)
6311
let
run
[@requires:trusted "fp_conv_w.ml runs a propagator only while it is registered: on the branch of its registration or below, same model, live only if that one is"] (d: env) (r: reg) : bool
6312
requires { model_of d = r.rm /\ (live d -> r.rl) }
6313
= Rules.run_reg d r
6314
Valid (42ms) (colibri2)
6315
let
may_change
[@requires:trusted "fp_conv_w.ml runs a propagator only while it is registered: on the branch of its registration or below, same model, live only if that one is"] (d: envp ro) (r: reg) : bool
6316
requires { model_of d = r.rm /\ (live d -> r.rl) }
6317
= Rules.may_change_reg d r
6318
6319
type
rounding
= Linearize.rounding

The rounding of the ground term g (fp.add, fp.mul, fp.div), for the linearization of fp_to_real.ml

  Valid (42ms) (colibri2)
6323
let
rounding_of
(d: env) (g: ground) : option rounding
6324
ensures { match result with
6325
| Some r -> r.gm = d.model /\ r.gl = live d
6326
| None -> true end }
6327
= Linearize.rounding_of d g

The bounds of a rounding for the simplex: p >= 0 (true) or p <= 0 (false)

  Valid (50ms) (colibri2)
6331
let
equations
[@requires:trusted "fp_to_real.ml uses a rounding only while it is registered: on the branch of its registration or below, same model, live only if that one is"] (d: env) (g: rounding) : list (Lin.t, bool)
6332
requires { d.model = g.gm /\ (live d -> g.gl) }
6333
ensures { live d -> forall pk. LM.mem pk result -> bound_holds d.mr pk }
6334
= Linearize.equations d g

The rounding of a real (Env.round_a)

  Valid (45ms) (colibri2)
6337
let
round_a
(fm: format) (m: mode) (a: A.t) : t
6338
ensures { result = round_f fm m (A.real a <. 0.0) (Fin (A.real a)) }
6339
= Env.round_a fm m a
6340
end