Common — library colibrilib.fp_conv — module Dolmen

The Dolmen builtins of the floats

A copy of the constructors of Dolmen_std.Builtin.t (and of the builtins of colibri2 RealValue.Builtin and Fp_value.Builtin) of the terms that Conv.view reads, and their meaning in the model, as in SMT–LIB. The extraction maps each constructor to the Dolmen one (colibri2/theories/FP/fp_conv.drv), in patterns too: the trusted part is this list of names and the meanings (sem_in), not a translation in OCaml. The constructor Other stands for all the other builtins (the Dolmen type is extensible): it is never built, so a match always keeps a wildcard. The integers are the ones of Dolmen: Fp_add (e, p) is the format of e bits of exponent and p of significand (the hidden bit included); Sbv_to_fp (n, e, p) converts a bit–vector of n bits, To_sbv (e, p, n) converts to one.

4882
module Dolmen
4883
use int.Int
4884
use int.Power
4885
use real.RealInfix
4886
use real.FromInt
4887
use list.List
4888
use option.Option
4889
use mach.int.Int63
4890
use colibrilib.ring.Atom
4891
use colibrilib.fbin.Fp
4892
use colibrilib.stda.StdA as A
4893
use Env
4894
use RealConv
4895
use BvConv
4896
use colibrilib.fp_interval.Intervals
4897
use colibrilib.fp_interval.FpInterval
4898
use Rules
4899
use GTerm

The arithmetic of +, -, *, - (unary): Int , Rat , Real `

4903
type
arith
=
AInt
|
ARat
|
AReal

The sorts of the division of Dolmen

4906
type
darith
=
DRat
|
DReal
4907
4908
type
builtin
=
4909
|
Fp_add
int63 int63
4910
|
Fp_sub
int63 int63
4911
|
Fp_mul
int63 int63
4912
|
Fp_div
int63 int63
4913
|
Fp_sqrt
int63 int63
4914
|
Fp_roundToIntegral
int63 int63
4915
|
Fp_to_fp
int63 int63 int63 int63
4916
|
Ieee_format_to_fp
int63 int63
4917
|
Fp
int63 int63
4918
|
Sbv_to_fp
int63 int63 int63
4919
|
Ubv_to_fp
int63 int63 int63
4920
|
To_sbv
int63 int63 int63
4921
|
To_ubv
int63 int63 int63
4922
|
Fp_abs
int63 int63
4923
|
Fp_neg
int63 int63
4924
|
Fp_min
int63 int63
4925
|
Fp_max
int63 int63
4926
|
Fp_leq
int63 int63
4927
|
Fp_lt
int63 int63
4928
|
Fp_eq
int63 int63
4929
|
Fp_geq
int63 int63
4930
|
Fp_gt
int63 int63
4931
|
Fp_isNaN
int63 int63
4932
|
Fp_isNormal
int63 int63
4933
|
Fp_isSubnormal
int63 int63
4934
|
Fp_isZero
int63 int63
4935
|
Fp_isInfinite
int63 int63
4936
|
Fp_isNegative
int63 int63
4937
|
Fp_isPositive
int63 int63
4938
|
Fp_isFinite
int63 int63
4939
|
To_real
int63 int63
4940
|
Real_to_fp
int63 int63
4941
|
Add
arith
4942
|
Sub
arith
4943
|
Mul
arith
4944
|
Minus
arith
4945
|
Div
darith
4946
|
Bitv_to_int
int63 bool
4947
|
Other

The format of e bits of exponent and p of significand

4950
predicate
isfmt
(fm: format) (e p: int63) = eb fm = to_int e /\ sb fm = to_int p

The number of bits of a bit–vector node, from its type: it does not depend on the model

4954
function
bvsize
(n: Atom.t) : int

The integer of the bits b of a bit–vector of n bits, in two's complement

4958
function
sbv
(n b: int) : int =
4959
if power 2 (n - 1) <= b then b - power 2 n else b

The bit–vector node x of n bits: its real is its unsigned integer b (as RealValue checks it in the model)

4963
predicate
bv_val
(d: envp 'm) (x: Atom.t) (n b: int) =
4964
bvsize x = n /\ d.mr x = from_int b /\ 0 <= b < power 2 n

A propagator that holds when the environment is live

4967
predicate
sp
(d: envp 'm) (p: prop) = wf p /\ (live d -> holds d p)

The meaning of the term b l of node r in the model of d, as in SMT–LIB. fp.sub is fp.add of the opposite (IEEE 754 §6.3). The conversion fp.to_sbv (resp. fp.to_ubv) is the integral rounding when it is finite and fits in the bit–vectors, unspecified otherwise. fp is the float of the concatenation of its three bit–vectors (sign, exponent, significand). A meaning on other arguments is true

4975
predicate
sem_in
(d: envp 'm) (b: builtin) (r: Atom.t) (l: list Atom.t) =
4976
match b with
4977
| Fp_add e p ->
4978
match l with
4979
| Cons m (Cons x (Cons y Nil)) ->
4980
forall fm. isfmt fm e p -> sp d (Bin OAdd fm r m x y)
4981
| _ -> true
4982
end
4983
| Fp_mul e p ->
4984
match l with
4985
| Cons m (Cons x (Cons y Nil)) ->
4986
forall fm. isfmt fm e p -> sp d (Bin OMul fm r m x y)
4987
| _ -> true
4988
end
4989
| Fp_div e p ->
4990
match l with
4991
| Cons m (Cons x (Cons y Nil)) ->
4992
forall fm. isfmt fm e p -> sp d (Bin ODiv fm r m x y)
4993
| _ -> true
4994
end
4995
| Fp_sub e p ->
4996
match l with
4997
| Cons m (Cons x (Cons y Nil)) ->
4998
forall fm. isfmt fm e p ->
4999
fmt_of r = fm /\ fmt_of x = fm /\ fmt_of y = fm /\
5000
(live d -> fmt (d.mf r) = fm /\ fmt (d.mf x) = fm /\ fmt (d.mf y) = fm /\
5001
d.mf r = fp_add (d.mm m) (d.mf x) (neg (d.mf y)))
5002
| _ -> true
5003
end
5004
| Fp_sqrt e p ->
5005
match l with
5006
| Cons m (Cons x Nil) ->
5007
forall fm. isfmt fm e p -> sp d (Un USqrt fm r m x)
5008
| _ -> true
5009
end
5010
| Fp_roundToIntegral e p ->
5011
match l with
5012
| Cons m (Cons x Nil) ->
5013
forall fm. isfmt fm e p -> sp d (Un URti fm r m x)
5014
| _ -> true
5015
end
5016
| Fp_to_fp e p e' p' ->
5017
match l with
5018
| Cons m (Cons x Nil) ->
5019
forall fm fm'. isfmt fm e p -> isfmt fm' e' p' -> sp d (Cvt fm fm' r m x)
5020
| _ -> true
5021
end
5022
| Fp_abs e p ->
5023
match l with
5024
| Cons x Nil ->
5025
forall fm. isfmt fm e p -> sp d (Abs fm r x)
5026
| _ -> true
5027
end
5028
| Fp_neg _ _ ->
5029
match l with
5030
| Cons x Nil ->
5031
sp d (Neg r x)
5032
| _ -> true
5033
end
5034
| Fp_min _ _ ->
5035
match l with
5036
| Cons x (Cons y Nil) ->
5037
fmt_of r = fmt_of x /\ fmt_of y = fmt_of x /\
5038
(live d -> d.mf r = min (d.mf x) (d.mf y))
5039
| _ -> true
5040
end
5041
| Fp_max _ _ ->
5042
match l with
5043
| Cons x (Cons y Nil) ->
5044
fmt_of r = fmt_of x /\ fmt_of y = fmt_of x /\
5045
(live d -> d.mf r = max (d.mf x) (d.mf y))
5046
| _ -> true
5047
end
5048
| Fp_leq e p ->
5049
match l with
5050
| Cons x (Cons y Nil) ->
5051
forall fm. isfmt fm e p -> sp d (Cmp CLe fm r x y)
5052
| _ -> true
5053
end
5054
| Fp_lt e p ->
5055
match l with
5056
| Cons x (Cons y Nil) ->
5057
forall fm. isfmt fm e p -> sp d (Cmp CLt fm r x y)
5058
| _ -> true
5059
end
5060
| Fp_eq e p ->
5061
match l with
5062
| Cons x (Cons y Nil) ->
5063
forall fm. isfmt fm e p -> sp d (Cmp CEq fm r x y)
5064
| _ -> true
5065
end
5066
| Fp_geq e p ->
5067
match l with
5068
| Cons x (Cons y Nil) ->
5069
forall fm. isfmt fm e p -> sp d (Cmp CLe fm r y x)
5070
| _ -> true
5071
end
5072
| Fp_gt e p ->
5073
match l with
5074
| Cons x (Cons y Nil) ->
5075
forall fm. isfmt fm e p -> sp d (Cmp CLt fm r y x)
5076
| _ -> true
5077
end
5078
| Fp_isNaN e p ->
5079
match l with
5080
| Cons x Nil ->
5081
forall fm. isfmt fm e p -> sp d (Is INaN fm r x)
5082
| _ -> true
5083
end
5084
| Fp_isNormal e p ->
5085
match l with
5086
| Cons x Nil ->
5087
forall fm. isfmt fm e p -> sp d (Is INormal fm r x)
5088
| _ -> true
5089
end
5090
| Fp_isSubnormal e p ->
5091
match l with
5092
| Cons x Nil ->
5093
forall fm. isfmt fm e p -> sp d (Is ISubnormal fm r x)
5094
| _ -> true
5095
end
5096
| Fp_isZero e p ->
5097
match l with
5098
| Cons x Nil ->
5099
forall fm. isfmt fm e p -> sp d (Is IZero fm r x)
5100
| _ -> true
5101
end
5102
| Fp_isInfinite e p ->
5103
match l with
5104
| Cons x Nil ->
5105
forall fm. isfmt fm e p -> sp d (Is IInf fm r x)
5106
| _ -> true
5107
end
5108
| Fp_isNegative e p ->
5109
match l with
5110
| Cons x Nil ->
5111
forall fm. isfmt fm e p -> sp d (Is INeg fm r x)
5112
| _ -> true
5113
end
5114
| Fp_isPositive e p ->
5115
match l with
5116
| Cons x Nil ->
5117
forall fm. isfmt fm e p -> sp d (Is IPos fm r x)
5118
| _ -> true
5119
end
5120
| Fp_isFinite e p ->
5121
match l with
5122
| Cons x Nil ->
5123
forall fm. isfmt fm e p -> sp d (Is IFinite fm r x)
5124
| _ -> true
5125
end
5126
| To_real e p ->
5127
match l with
5128
| Cons x Nil ->
5129
forall fm. isfmt fm e p -> sp d (ToReal fm r x)
5130
| _ -> true
5131
end
5132
| Real_to_fp e p ->
5133
match l with
5134
| Cons m (Cons x Nil) ->
5135
forall fm. isfmt fm e p -> sp d (OfReal fm r m x)
5136
| _ -> true
5137
end
5138
| Ieee_format_to_fp e p ->
5139
match l with
5140
| Cons x Nil ->
5141
forall fm. isfmt fm e p -> fmt_of r = fm /\ bvsize x = to_int e + to_int p /\
5142
(live d -> exists b. bv_val d x (to_int e + to_int p) b /\ of_bits fm b (d.mf r))
5143
| _ -> true
5144
end
5145
| Fp e p ->
5146
match l with
5147
| Cons s (Cons x (Cons y Nil)) ->
5148
forall fm. isfmt fm e p -> fmt_of r = fm /\
5149
(live d -> exists bs bx bm.
5150
bv_val d s 1 bs /\ bv_val d x (to_int e) bx /\ bv_val d y (to_int p - 1) bm /\
5151
of_bits fm (bs * power 2 (to_int e + to_int p - 1) +
5152
bx * power 2 (to_int p - 1) + bm) (d.mf r))
5153
| _ -> true
5154
end
5155
| Sbv_to_fp n e p ->
5156
match l with
5157
| Cons m (Cons x Nil) ->
5158
forall fm. isfmt fm e p -> fmt_of r = fm /\ bvsize x = to_int n /\
5159
(live d -> exists b. bv_val d x (to_int n) b /\
5160
d.mf r = round_x fm (d.mm m) (from_int (sbv (to_int n) b)))
5161
| _ -> true
5162
end
5163
| Ubv_to_fp n e p ->
5164
match l with
5165
| Cons m (Cons x Nil) ->
5166
forall fm. isfmt fm e p -> fmt_of r = fm /\ bvsize x = to_int n /\
5167
(live d -> exists b. bv_val d x (to_int n) b /\
5168
d.mf r = round_x fm (d.mm m) (from_int b))
5169
| _ -> true
5170
end
5171
| To_sbv e p n ->
5172
match l with
5173
| Cons m (Cons x Nil) ->
5174
forall fm. isfmt fm e p -> fmt_of x = fm /\ bvsize r = to_int n /\
5175
(live d -> fmt (d.mf x) = fm /\ exists b. bv_val d r (to_int n) b /\
5176
let y = fp_rti (d.mm m) (d.mf x) in
5177
is_not_nan y /\ not (is_inf y) /\
5178
from_int (- power 2 (to_int n - 1)) <=. to_real y <=.
5179
from_int (power 2 (to_int n - 1) - 1) ->
5180
from_int (sbv (to_int n) b) = to_real y)
5181
| _ -> true
5182
end
5183
| To_ubv e p n ->
5184
match l with
5185
| Cons m (Cons x Nil) ->
5186
forall fm. isfmt fm e p -> fmt_of x = fm /\ bvsize r = to_int n /\
5187
(live d -> fmt (d.mf x) = fm /\ exists b. bv_val d r (to_int n) b /\
5188
let y = fp_rti (d.mm m) (d.mf x) in
5189
is_not_nan y /\ not (is_inf y) /\
5190
0.0 <=. to_real y <=. from_int (power 2 (to_int n) - 1) ->
5191
from_int b = to_real y)
5192
| _ -> true
5193
end
5194
| Bitv_to_int n s ->
5195
match l with
5196
| Cons x Nil ->
5197
bvsize x = to_int n ->
5198
(live d -> exists b. bv_val d x (to_int n) b /\
5199
d.mr r = from_int (if s then sbv (to_int n) b else b))
5200
| _ -> true
5201
end
5202
| Add _ ->
5203
match l with
5204
| Cons x (Cons y Nil) ->
5205
sp d (RBin RAdd r x y)
5206
| _ -> true
5207
end
5208
| Sub _ ->
5209
match l with
5210
| Cons x (Cons y Nil) ->
5211
sp d (RBin RSub r x y)
5212
| _ -> true
5213
end
5214
| Mul _ ->
5215
match l with
5216
| Cons x (Cons y Nil) ->
5217
sp d (RBin RMul r x y)
5218
| _ -> true
5219
end
5220
| Minus _ ->
5221
match l with
5222
| Cons x Nil ->
5223
sp d (RNeg r x)
5224
| _ -> true
5225
end
5226
| Div _ ->
5227
(* the division by zero is unspecified *)
5228
match l with
5229
| Cons x (Cons y Nil) ->
5230
live d -> d.mr y <> 0.0 -> d.mr r = d.mr x /. d.mr y
5231
| _ -> true
5232
end
5233
| _ -> true
5234
end

The meaning in every model

5237
predicate
means
(b: builtin) (r: Atom.t) (l: list Atom.t) =
5238
(forall d: env. sem_in d b r l) /\ (forall d: envp ro. sem_in d b r l)

The meaning in d (its formats and sizes do not depend on d)

  Valid (66ms) (colibri2)
5241
let ghost
means_at
(d: env) (b: builtin) (r: Atom.t) (l: list Atom.t) : unit
5242
requires { means b r l }
5243
ensures { sem_in d b r l }
5244
= ()

A propagator that follows from the meaning of three terms is valid

  Valid (327ms) (colibri2 10) (split_vc 3) (depth 2)
5247
let ghost
valid_of
(d0: env) (b1: builtin) (r1: Atom.t) (l1: list Atom.t)
5248
(b2: builtin) (r2: Atom.t) (l2: list Atom.t)
5249
(b3: builtin) (r3: Atom.t) (l3: list Atom.t) (p: prop) : unit
5250
requires { means b1 r1 l1 /\ means b2 r2 l2 /\ means b3 r3 l3 }
5251
requires { forall d: env.
5252
sem_in d b1 r1 l1 -> sem_in d b2 r2 l2 -> sem_in d b3 r3 l3 -> sp d p }
5253
requires { forall d: envp ro.
5254
sem_in d b1 r1 l1 -> sem_in d b2 r2 l2 -> sem_in d b3 r3 l3 -> sp d p }
5255
ensures { valid p }
5256
= {proof…}
5257
assert { sp d0 p by sem_in d0 b1 r1 l1 /\ sem_in d0 b2 r2 l2 /\ sem_in d0 b3 r3 l3 };
5258
assert { forall d: env. live d -> holds d p
5259
by sem_in d b1 r1 l1 /\ sem_in d b2 r2 l2 /\ sem_in d b3 r3 l3 };
5260
assert { forall d: envp ro. live d -> holds d p
5261
by sem_in d b1 r1 l1 /\ sem_in d b2 r2 l2 /\ sem_in d b3 r3 l3 }
5262
{qed}

The integer of the concatenation of the bit–vectors of the sign, the exponent and the significand is an encoding

  Valid (389ms) (colibri2 5) (split_vc) (depth 1)
5266
let ghost
concat_range
(e p bs bx bm: int) : unit
5267
requires { 0 <= e /\ 1 <= p }
5268
requires { 0 <= bs < 2 /\ 0 <= bx < power 2 e /\ 0 <= bm < power 2 (p - 1) }
5269
ensures { 0 <= bs * power 2 (e + p - 1) + bx * power 2 (p - 1) + bm < power 2 (e + p) }
5270
= {proof…}
5271
assert { power 2 (e + p - 1) = power 2 e * power 2 (p - 1) };
5272
assert { power 2 (e + p) = 2 * power 2 (e + p - 1) };
5273
assert { bx * power 2 (p - 1) <= (power 2 e - 1) * power 2 (p - 1) };
5274
assert { bs * power 2 (e + p - 1) <= power 2 (e + p - 1) }
5275
{qed}

The propagator of fp s x y, on the node n of the integer of the concatenation

  Valid (1.3s) (colibri2 23) (split_vc 5) (depth 2)
5279
let ghost
concat_valid
(d0: env) (fm: format) (e p: int) (bi: builtin)
5280
(r s x y n: Atom.t) : unit
5281
requires { means bi r (Cons s (Cons x (Cons y Nil))) }
5282
requires { match bi with
5283
| Fp e' p' -> to_int e' = e /\ to_int p' = p /\ isfmt fm e' p'
5284
| _ -> false end }
5285
requires { live d0 -> forall d: env. model_of d = model_of d0 ->
5286
d.mr n = d.mr s *. from_int (power 2 (e + p - 1)) +.
5287
d.mr x *. from_int (power 2 (p - 1)) +. d.mr y }
5288
requires { live d0 -> forall d: envp ro. model_of d = model_of d0 ->
5289
d.mr n = d.mr s *. from_int (power 2 (e + p - 1)) +.
5290
d.mr x *. from_int (power 2 (p - 1)) +. d.mr y }
5291
ensures { valid_at (model_of d0) (live d0) (OfBits fm r n false) }
5292
= {proof…}
5293
let l = Cons s (Cons x (Cons y Nil)) in
5294
assert { 2 * half_bits fm = power 2 (e + p) };
5295
let lemma enc_rw (d: env)
5296
requires { live d0 /\ model_of d = model_of d0 }
5297
requires { d.mr n = d.mr s *. from_int (power 2 (e + p - 1)) +.
5298
d.mr x *. from_int (power 2 (p - 1)) +. d.mr y }
5299
ensures { holds d (OfBits fm r n false) }
5300
= assert { d.mf = d0.mf /\ d.mr = d0.mr /\ sem_in d0 bi r l };
5301
let (bs, bx, bm) = any (int, int, int) ensures { let (bs, bx, bm) = result in
5302
bv_val d0 s 1 bs /\ bv_val d0 x e bx /\ bv_val d0 y (p - 1) bm /\
5303
of_bits fm (bs * power 2 (e + p - 1) + bx * power 2 (p - 1) + bm) (d.mf r) } in
5304
concat_range e p bs bx bm;
5305
let v = bs * power 2 (e + p - 1) + bx * power 2 (p - 1) + bm in
5306
assert { from_int v = from_int bs *. from_int (power 2 (e + p - 1)) +.
5307
from_int bx *. from_int (power 2 (p - 1)) +. from_int bm };
5308
assert { d.mr n = from_int v };
5309
assert { 0 <= v < 2 * half_bits fm }
5310
in
5311
let lemma enc_ro (d: envp ro)
5312
requires { live d0 /\ model_of d = model_of d0 }
5313
requires { d.mr n = d.mr s *. from_int (power 2 (e + p - 1)) +.
5314
d.mr x *. from_int (power 2 (p - 1)) +. d.mr y }
5315
ensures { holds d (OfBits fm r n false) }
5316
= assert { d.mf = d0.mf /\ d.mr = d0.mr /\ sem_in d0 bi r l };
5317
let (bs, bx, bm) = any (int, int, int) ensures { let (bs, bx, bm) = result in
5318
bv_val d0 s 1 bs /\ bv_val d0 x e bx /\ bv_val d0 y (p - 1) bm /\
5319
of_bits fm (bs * power 2 (e + p - 1) + bx * power 2 (p - 1) + bm) (d.mf r) } in
5320
concat_range e p bs bx bm;
5321
let v = bs * power 2 (e + p - 1) + bx * power 2 (p - 1) + bm in
5322
assert { from_int v = from_int bs *. from_int (power 2 (e + p - 1)) +.
5323
from_int bx *. from_int (power 2 (p - 1)) +. from_int bm };
5324
assert { d.mr n = from_int v };
5325
assert { 0 <= v < 2 * half_bits fm }
5326
in
5327
assert { sem_in d0 bi r l };
5328
assert { live d0 -> forall d: env. model_of d = model_of d0 ->
5329
holds d (OfBits fm r n false) };
5330
assert { live d0 -> forall d: envp ro. model_of d = model_of d0 ->
5331
holds d (OfBits fm r n false) }
5332
{qed}

The Dolmen builtin and the arguments of a ground term without type arguments (Ground.sem): its node has the meaning of the term in every model

5337
val
sem
(g: ground) : option (builtin, list Atom.t)
5338
ensures { match result with
5339
| Some (b, l) -> means b (gnode g) l
5340
| None -> true end }

A term constant of colibri2 (Expr.Term.Const.t, a record of Dolmen) and its Dolmen builtin (its field builtin)

5344
type
cst
= private {
builtin
: builtin }

Expr.Term.Const.Float.neg, add, mul, roundToIntegral, real_to_fp, to_real of a format, RealValue.Builtin.bv_to_int

5348
val
cst_neg
(e p: int63) : cst ensures { result.builtin = Fp_neg e p }
5349
val
cst_add
(e p: int63) : cst ensures { result.builtin = Fp_add e p }
5350
val
cst_mul
(e p: int63) : cst ensures { result.builtin = Fp_mul e p }
5351
val
cst_rti
(e p: int63) : cst ensures { result.builtin = Fp_roundToIntegral e p }
5352
val
cst_real_to_fp
(e p: int63) : cst ensures { result.builtin = Real_to_fp e p }
5353
val
cst_to_real
(e p: int63) : cst ensures { result.builtin = To_real e p }
5354
val
cst_radd
() : cst ensures { result.builtin = Add AReal }
5355
val
cst_rmul
() : cst ensures { result.builtin = Mul AReal }
5356
val
cst_rdiv
() : cst ensures { result.builtin = Div DReal }
5357
val
cst_bv_to_int
(n: int63) (s: bool) : cst
5358
ensures { result.builtin = Bitv_to_int n s }

The arguments of the floats and of the bit–vectors of apply have the types of the builtin

5362
predicate
well_typed
(b: builtin) (l: list Atom.t) =
5363
match b with
5364
| Fp_neg e p | To_real e p ->
5365
match l with
5366
| Cons x Nil -> eb (fmt_of x) = to_int e /\ sb (fmt_of x) = to_int p
5367
| _ -> false
5368
end
5369
| Fp_roundToIntegral e p ->
5370
match l with
5371
| Cons _ (Cons x Nil) -> eb (fmt_of x) = to_int e /\ sb (fmt_of x) = to_int p
5372
| _ -> false
5373
end
5374
| Fp_add e p | Fp_mul e p ->
5375
match l with
5376
| Cons _ (Cons x (Cons y Nil)) ->
5377
eb (fmt_of x) = to_int e /\ sb (fmt_of x) = to_int p /\ fmt_of y = fmt_of x
5378
| _ -> false
5379
end
5380
| Real_to_fp _ _ ->
5381
match l with Cons _ (Cons _ Nil) -> true | _ -> false end
5382
| Add _ | Mul _ | Div _ ->
5383
match l with Cons _ (Cons _ Nil) -> true | _ -> false end
5384
| Bitv_to_int n _ ->
5385
match l with Cons x Nil -> bvsize x = to_int n | _ -> false end
5386
| _ -> false
5387
end

Ground.apply' (no type arguments, not registered): the node of the term c l

5391
val
apply
(d: env) (c: cst) (l: list Atom.t) : Atom.t
5392
requires { well_typed c.builtin l }
5393
ensures { means c.builtin result l }

The node of the float x (Fp_value)

5396
val
float_node
(fm: format) (x: t) : Atom.t
5397
requires { fmt x = fm }
5398
ensures { fmt_of result = fm }
5399
ensures { forall d: env. live d -> d.mf result = x }
5400
ensures { forall d: envp ro. live d -> d.mf result = x }

RealValue.get: the value of a real node in the e–graph, if it is known

5404
val
real_value
(d: envp 'm) (n: Atom.t) : option A.t
5405
ensures { match result with
5406
| Some v -> live d -> d.mr n = A.real v
5407
| None -> true end }

The node of the real constant v (RealValue.cst)

5410
val
real_cst
(v: A.t) : Atom.t
5411
ensures { forall d: env. d.mr result = A.real v }
5412
ensures { forall d: envp ro. d.mr result = A.real v }

sum k_i x_i

5415
function
lsum
(d: envp 'm) (l: list (Atom.t, A.t)) : real =
5416
match l with
5417
| Nil -> 0.0
5418
| Cons (x, k) l -> A.real k *. d.mr x +. lsum d l
5419
end

The node of the linear term sum k_i x_i (Dom_polynome), not registered

5423
val
real_lin
(d: env) (l: list (Atom.t, A.t)) : Atom.t
5424
writes { d.state }
5425
ensures { forall d: env. live d -> d.mr result = lsum d l }
5426
ensures { forall d: envp ro. live d -> d.mr result = lsum d l }
5427
end