library colibrilib.fp_conv — module Convmodule Conv5430use list.List5431use colibrilib.ring.Atom5432use colibrilib.fbin.Fp5433use int.Int5434use int.Power5435use real.RealInfix5436use real.FromInt5437use mach.int.Int635438use option.Option5439use colibrilib.stda.StdA as A5440use colibrilib.pow2r.Pow2r5441use Env5442use colibrilib.fp_interval.Intervals5443use colibrilib.fp_interval.FpInterval5444use RealConv5445use BvConv5446use Rules5447use GTerm5448use Dolmen as D5449
The waits of colibri2 (DaemonWithKey.Register, on the class of n): run d p is called when the domain (the value) of n changes, in an environment with the same model, until it returns true; the term g is the origin of the daemon (for the learning of colibri2)
The waits on the domains of the propagators Rel schedule them only when may_change (on the read–only environment of the event), as wait_rdom_dy
val wait_dom (d: env) (g: ground) (n: Atom.t) (p: reg) : unit5458writes { d.state }54595460val wait_value (d: env) (g: ground) (n: Atom.t) (p: reg) : unit5461writes { d.state }5462
On the value of the Boolean node n
val wait_bool (d: env) (g: ground) (n: Atom.t) (p: reg) : unit5465writes { d.state }5466
On the domain of the real node n (Dom_interval.events_attach_dom of the LRA theory, which schedules run d p)
val wait_rdom (d: env) (g: ground) (n: Atom.t) (p: reg) : unit5470writes { d.state }5471
As wait_rdom, but run d p is scheduled only when n has a congruence class that is not a singleton and whose dyadic domain (D.congr, as in Rules.getdr_r; every node of sort Int has the class ℤ) is not already included in the dyadic domain of n, and one of the nodes ns has a dyadic domain (Rules.has_dy: without it run d p does nothing)
val wait_rdom_dy (d: env) (g: ground) (n: Atom.t) (ns: list Atom.t) (p: reg) : unit5479writes { d.state }5480
On the dyadic domain of the real node n only
val wait_ddom (d: env) (g: ground) (n: Atom.t) (p: reg) : unit5483writes { d.state }5484
On the terms fp.neg b of the class of n (its Info domain)
val wait_negs (d: env) (g: ground) (n: Atom.t) (p: reg) : unit5487writes { d.state }5488
On the relations between a and b (colibri's update_deltas, keyed by the pair): run d p is called when the relation database (Env.updrel) changes the relation of the classes of a and b
val wait_rel (d: env) (g: ground) (a b: Atom.t) (p: reg) : unit5493writes { d.state }5494
The propagator Mono of the term g: run d p is called (when may_change) when the relation database changes the relation between two of its siblings' arguments, or between two terms of its class and of a sibling (kept in a backtrackable table keyed by g)
val wait_mono (d: env) (g: ground) (p: reg) : unit5500writes { d.state }5501
On the terms fp.div m c n of the class of n (its Info domain)
val wait_divs (d: env) (g: ground) (n: Atom.t) (p: reg) : unit5504writes { d.state }5505
On the representative of the class of n (a merge)
val wait_repr (d: env) (g: ground) (n: Atom.t) (p: reg) : unit5508writes { d.state }5509
The node c is the float 2 of the format fm, in every model
predicate two_node (fm: format) (c: Atom.t) =5512(forall d: env. live d -> is_two fm (d.mf c)) /\5513(forall d: envp ro. live d -> is_two fm (d.mf c))55145515val node (g: ground) : Atom.t5516ensures { result = gnode g }55175518exception NoFormat5519
The format of a Dolmen builtin
Valid (78ms) (colibri2)let fmt_ep (e p: int63) : format5522ensures { D.isfmt result e p }5523raises { NoFormat -> not (1 < to_int e /\ 1 < to_int p) }5524= match mk_format_o (to_int e) (to_int p) with5525| Some fm -> fm5526| None -> raise NoFormat5527end5528
The float 2 of a format
Valid (56ms) (colibri2)let two (fm: format) : t5531ensures { is_two fm result }5532= {proof…} two_exact fm; {qed}5533Fp.of_int fm RNE false 25534
The integer node of a bit–vector node x of n bits, registered
Valid (73ms) (colibri2)let bv_int (d: env) (n: int63) (s: bool) (x: Atom.t) : Atom.t5537requires { D.bvsize x = to_int n }5538ensures { D.means (D.Bitv_to_int n s) result (Cons x Nil) }5539= let i = D.apply d (D.cst_bv_to_int n s) (Cons x Nil) in5540register d i; i5541
SMT–LIB: fp s x y is to_fp of the concatenation, whose integer is s 2^(e+p-1) + x 2^(p-1) + y (the real node of a bit–vector is its unsigned integer); the constant node when the three are known in the e–graph (a fact of the branch of d)
Valid (215ms) (colibri2 10) (split_vc) (depth 1)let concat_int (d: env) (e p: int) (s x y: Atom.t) : Atom.t5547requires { 0 <= e /\ 1 <= p }5548writes { d.state }5549ensures { live d -> forall d': env. model_of d' = model_of d ->5550d'.mr result = d'.mr s *. from_int (power 2 (e + p - 1)) +.5551d'.mr x *. from_int (power 2 (p - 1)) +. d'.mr y }5552ensures { live d -> forall d': envp ro. model_of d' = model_of d ->5553d'.mr result = d'.mr s *. from_int (power 2 (e + p - 1)) +.5554d'.mr x *. from_int (power 2 (p - 1)) +. d'.mr y }5555= let k1 = a_pow2 (e + p - 1) in5556let k2 = a_pow2 (p - 1) in5557{proof…}5558assert { pow2r (e + p - 1) = from_int (power 2 (e + p - 1)) };5559assert { pow2r (p - 1) = from_int (power 2 (p - 1)) };5560{qed}5561let n = match D.real_value d s, D.real_value d x, D.real_value d y with5562| Some vs, Some vx, Some vy ->5563(* a literal: the constant node *)5564D.real_cst (A.add (A.mul vs k1) (A.add (A.mul vx k2) vy))5565| _ ->5566D.real_lin d (Cons (s, k1) (Cons (x, k2) (Cons (y, A.of_bigint 1) Nil)))5567end in5568register d n; n5569
to_fp of a signed (s) or unsigned bit–vector x of n bits, as the conversion of its integer node, often exact
Valid (4.6s) (colibri2 12) (split_vc 3) (depth 2)let exact_int (d: env) (fm: format) (bi: D.builtin) (n e p: int63) (s: bool)5573(r m x: Atom.t) : (builtin, list Atom.t)5574requires { D.means bi r (Cons m (Cons x Nil)) }5575requires { bi = if s then D.Sbv_to_fp n e p else D.Ubv_to_fp n e p }5576requires { D.isfmt fm e p }5577writes { d.state }5578ensures { match result with5579| (FpExactInt fm', Cons a (Cons t (Cons c Nil))) ->5580valid (ExactInt fm' r a t) /\ (forall d: env. live d -> d.mf r = d.mf c)5581| _ -> false end }5582= {proof…} D.means_at d bi r (Cons m (Cons x Nil)); {qed}5583register d m; register d x;5584let ai = bv_int d n s x in5585let tr = D.apply d (D.cst_to_real e p) (Cons r Nil) in5586register d tr;5587(* `to_fp` of a real of its integer node *)5588let c = D.apply d (D.cst_real_to_fp e p) (Cons m (Cons ai Nil)) in5589register d c;5590{proof…}5591D.valid_of d bi r (Cons m (Cons x Nil)) (D.Bitv_to_int n s) ai (Cons x Nil)5592(D.To_real e p) tr (Cons r Nil) (ExactInt fm r ai tr);5593assert { forall d: env. live d -> d.mf r = d.mf c5594by D.sem_in d bi r (Cons m (Cons x Nil)) /\5595D.sem_in d (D.Bitv_to_int n s) ai (Cons x Nil) /\5596D.sem_in d (D.Real_to_fp e p) c (Cons m (Cons ai Nil)) };5597{qed}5598(FpExactInt fm, Cons ai (Cons tr (Cons c Nil)))5599
fp.to_sbv (s) or fp.to_ubv of n bits: the integer node of the result is the real of the rounding to an integral float, when it is finite and in the range of the bit–vectors
Valid (2.4s) (colibri2 12) (split_vc 3) (depth 2)let to_bv (d: env) (fm: format) (bi: D.builtin) (e p n: int63) (s: bool)5604(r m x: Atom.t) : (builtin, list Atom.t)5605requires { D.means bi r (Cons m (Cons x Nil)) }5606requires { bi = if s then D.To_sbv e p n else D.To_ubv e p n }5607requires { D.isfmt fm e p }5608writes { d.state }5609ensures { match result with5610| (FpToRealIn fm' lo hi, Cons ri (Cons t Nil)) -> valid (ToRealIn fm' ri t lo hi)5611| (Other, Nil) -> true5612| _ -> false end }5613= {proof…} D.means_at d bi r (Cons m (Cons x Nil)); {qed}5614if 1 <= to_int n then begin5615register d m; register d x;5616let t = D.apply d (D.cst_rti e p) (Cons m (Cons x Nil)) in5617register d t;5618let (lo, hi) =5619if s then let h = pow2 (to_int n - 1) in (- h, h - 1)5620else (0, pow2 (to_int n) - 1) in5621let ri = bv_int d n s r in5622{proof…}5623D.valid_of d bi r (Cons m (Cons x Nil)) (D.Bitv_to_int n s) ri (Cons r Nil)5624(D.Fp_roundToIntegral e p) t (Cons m (Cons x Nil)) (ToRealIn fm ri t lo hi);5625{qed}5626(FpToRealIn fm lo hi, Cons ri (Cons t Nil))5627end else (Other, Nil)5628
The operator and the arguments of a ground term: its value is the value of its interpretation in every model (Dolmen.sem). It may create and register the nodes of the arguments (the integer of a bit–vector, fp.to_real, fp.roundToIntegral), read as in SMT–LIB. FpCvt gives the conversion and the exact conversion (to a wider format)
Valid (3.6s) (colibri2 203) (cvc5) (split_vc 19) (depth 2)let view (d: env) (g: ground) : (builtin, list Atom.t)5636writes { d.state }5637ensures { match result with5638| (FpBin o fm, Cons m (Cons a (Cons b Nil))) ->5639valid (Bin o fm (gnode g) m a b)5640| (FpAdd fm, Cons m (Cons a (Cons b (Cons c (Cons t Nil))))) ->5641valid (Bin OAdd fm (gnode g) m a b) /\ valid (Bin OMul fm t m c a) /\5642two_node fm c5643| (FpUn o fm, Cons m (Cons a Nil)) ->5644valid (Un o fm (gnode g) m a)5645| (FpCvt fm fm', Cons m (Cons a (Cons tr (Cons ta Nil)))) ->5646valid (Cvt fm fm' (gnode g) m a) /\5647valid (ExactCvt fm fm' (gnode g) a tr ta)5648| (FpAbs fm, Cons a Nil) ->5649valid (Abs fm (gnode g) a)5650| (FpNeg, Cons a Nil) ->5651valid (Neg (gnode g) a)5652| (FpChoice, Cons a (Cons b Nil)) ->5653valid (Choice (gnode g) a b)5654| (FpCmp o fm, Cons a (Cons b Nil)) ->5655valid (Cmp o fm (gnode g) a b)5656| (FpIs o fm, Cons a Nil) ->5657valid (Is o fm (gnode g) a)5658| (FpToReal fm, Cons a Nil) ->5659valid (ToReal fm (gnode g) a)5660| (FpOfReal fm, Cons m (Cons a Nil)) ->5661valid (OfReal fm (gnode g) m a)5662| (FpOfBits fm back, Cons a Nil) ->5663valid_at (model_of d) (live d) (OfBits fm (gnode g) a back)5664| (FpExactInt fm, Cons a (Cons t (Cons c Nil))) ->5665valid (ExactInt fm (gnode g) a t) /\5666(forall d: env. live d -> d.mf (gnode g) = d.mf c)5667| (FpRw, Cons t Nil) ->5668forall d: env. live d -> d.mf (gnode g) = d.mf t5669| (FpToRealIn fm lo hi, Cons r (Cons a Nil)) ->5670valid (ToRealIn fm r a lo hi)5671| (RealBin o, Cons a (Cons b Nil)) ->5672valid (RBin o (gnode g) a b)5673| (RealNeg, Cons a Nil) ->5674valid (RNeg (gnode g) a)5675| _ -> true5676end }5677= let r = node g in5678match D.sem g with5679| None -> (Other, Nil)5680| Some (bi, l) ->5681{proof…} D.means_at d bi r l; {qed}5682try5683match bi, l with5684| D.Fp_add e p, Cons m (Cons a (Cons b Nil)) ->5685(* with the float 2 and the term `2 * a`, merged when `a = b` *)5686let fm = fmt_ep e p in5687let c = D.float_node fm (two fm) in5688let t = D.apply d (D.cst_mul e p) (Cons m (Cons c (Cons a Nil))) in5689{proof…}5690D.valid_of d bi r l bi r l bi r l (Bin OAdd fm r m a b);5691D.valid_of d (D.Fp_mul e p) t (Cons m (Cons c (Cons a Nil)))5692(D.Fp_mul e p) t (Cons m (Cons c (Cons a Nil)))5693(D.Fp_mul e p) t (Cons m (Cons c (Cons a Nil))) (Bin OMul fm t m c a);5694{qed}5695(FpAdd fm, Cons m (Cons a (Cons b (Cons c (Cons t Nil)))))5696| D.Fp_mul e p, Cons m (Cons a (Cons b Nil)) ->5697let fm = fmt_ep e p in5698{proof…} D.valid_of d bi r l bi r l bi r l (Bin OMul fm r m a b); {qed}5699(FpBin OMul fm, l)5700| D.Fp_sub e p, Cons m (Cons a (Cons b Nil)) ->5701(* `fp.sub m a b` is `fp.add m a (fp.neg b)` *)5702let fm = fmt_ep e p in5703register d m; register d a; register d b;5704let t1 = D.apply d (D.cst_neg e p) (Cons b Nil) in5705{proof…}5706D.means_at d (D.Fp_neg e p) t1 (Cons b Nil);5707assert { fmt_of a = fm /\ fmt_of b = fm /\ fmt_of t1 = fm };5708{qed}5709register d t1;5710let t2 = D.apply d (D.cst_add e p) (Cons m (Cons a (Cons t1 Nil))) in5711{proof…}5712assert { forall d: env. live d -> d.mf r = d.mf t25713by D.sem_in d bi r l /\ D.sem_in d (D.Fp_neg e p) t1 (Cons b Nil) /\5714D.sem_in d (D.Fp_add e p) t2 (Cons m (Cons a (Cons t1 Nil))) };5715{qed}5716(FpRw, Cons t2 Nil)5717| D.Fp_div e p, Cons m (Cons a (Cons b Nil)) ->5718let fm = fmt_ep e p in5719{proof…} D.valid_of d bi r l bi r l bi r l (Bin ODiv fm r m a b); {qed}5720(FpBin ODiv fm, l)5721| D.Fp_sqrt e p, Cons m (Cons a Nil) ->5722let fm = fmt_ep e p in5723{proof…} D.valid_of d bi r l bi r l bi r l (Un USqrt fm r m a); {qed}5724(FpUn USqrt fm, l)5725| D.Fp_roundToIntegral e p, Cons m (Cons a Nil) ->5726let fm = fmt_ep e p in5727{proof…} D.valid_of d bi r l bi r l bi r l (Un URti fm r m a); {qed}5728(FpUn URti fm, l)5729| D.Fp_to_fp e p e' p', Cons m (Cons a Nil) ->5730(* with the exact conversion: `fp.to_real r = fp.to_real a` *)5731let fm = fmt_ep e p in5732let fm' = fmt_ep e' p' in5733{proof…}5734assert { D.sp d (Cvt fm fm' r m a) };5735assert { fmt_of r = fm' /\ fmt_of a = fm };5736{qed}5737let tr = D.apply d (D.cst_to_real e' p') (Cons r Nil) in5738let ta = D.apply d (D.cst_to_real e p) (Cons a Nil) in5739register d tr; register d ta;5740{proof…}5741D.valid_of d bi r l bi r l bi r l (Cvt fm fm' r m a);5742D.valid_of d bi r l (D.To_real e' p') tr (Cons r Nil)5743(D.To_real e p) ta (Cons a Nil) (ExactCvt fm fm' r a tr ta);5744{qed}5745(FpCvt fm fm', Cons m (Cons a (Cons tr (Cons ta Nil))))5746| D.Ieee_format_to_fp e p, Cons x Nil ->5747let fm = fmt_ep e p in5748if to_int e <= 0x100000 && to_int p <= 0x100000 then begin5749register d x;5750let n = e + p in5751let i = bv_int d n false x in5752{proof…}5753assert { power 2 (eb fm + sb fm) = 2 * half_bits fm };5754D.valid_of d bi r l (D.Bitv_to_int n false) i (Cons x Nil)5755bi r l (OfBits fm r i true);5756{qed}5757(FpOfBits fm true, Cons i Nil)5758end else (Other, Nil)5759| D.Fp e p, Cons s (Cons x (Cons y Nil)) ->5760(* without the update of the integer of the concatenation, a linear term: costly in the LRA theory *)5762let fm = fmt_ep e p in5763register d s; register d x; register d y;5764let n = concat_int d (to_int e) (to_int p) s x y in5765{proof…}5766D.concat_valid d fm (to_int e) (to_int p) bi r s x y n;5767{qed}5768(FpOfBits fm false, Cons n Nil)5769| D.Sbv_to_fp n e p, Cons m (Cons x Nil) ->5770(* the conversion of an integer is often exact: `fp.to_real r = a` *)5771let fm = fmt_ep e p in5772exact_int d fm bi n e p true r m x5773| D.Ubv_to_fp n e p, Cons m (Cons x Nil) ->5774let fm = fmt_ep e p in5775exact_int d fm bi n e p false r m x5776| D.To_sbv e p n, Cons m (Cons x Nil) ->5777let fm = fmt_ep e p in5778to_bv d fm bi e p n true r m x5779| D.To_ubv e p n, Cons m (Cons x Nil) ->5780let fm = fmt_ep e p in5781to_bv d fm bi e p n false r m x5782| D.Fp_abs e p, Cons a Nil ->5783let fm = fmt_ep e p in5784{proof…} D.valid_of d bi r l bi r l bi r l (Abs fm r a); {qed}5785(FpAbs fm, l)5786| D.Fp_neg _ _, Cons a Nil ->5787{proof…} D.valid_of d bi r l bi r l bi r l (Neg r a); {qed}5788(FpNeg, l)5789| D.Fp_min _ _, Cons a (Cons b Nil)5790| D.Fp_max _ _, Cons a (Cons b Nil) ->5791{proof…} D.valid_of d bi r l bi r l bi r l (Choice r a b); {qed}5792(FpChoice, l)5793| D.Fp_leq e p, Cons a (Cons b Nil) ->5794let fm = fmt_ep e p in5795{proof…} D.valid_of d bi r l bi r l bi r l (Cmp CLe fm r a b); {qed}5796(FpCmp CLe fm, l)5797| D.Fp_lt e p, Cons a (Cons b Nil) ->5798let fm = fmt_ep e p in5799{proof…} D.valid_of d bi r l bi r l bi r l (Cmp CLt fm r a b); {qed}5800(FpCmp CLt fm, l)5801| D.Fp_eq e p, Cons a (Cons b Nil) ->5802let fm = fmt_ep e p in5803{proof…} D.valid_of d bi r l bi r l bi r l (Cmp CEq fm r a b); {qed}5804(FpCmp CEq fm, l)5805(* `a >= b` is `b <= a`, `a > b` is `b < a` *)5806| D.Fp_geq e p, Cons a (Cons b Nil) ->5807let fm = fmt_ep e p in5808{proof…} D.valid_of d bi r l bi r l bi r l (Cmp CLe fm r b a); {qed}5809(FpCmp CLe fm, Cons b (Cons a Nil))5810| D.Fp_gt e p, Cons a (Cons b Nil) ->5811let fm = fmt_ep e p in5812{proof…} D.valid_of d bi r l bi r l bi r l (Cmp CLt fm r b a); {qed}5813(FpCmp CLt fm, Cons b (Cons a Nil))5814| D.Fp_isNaN e p, Cons a Nil ->5815let fm = fmt_ep e p in5816{proof…} D.valid_of d bi r l bi r l bi r l (Is INaN fm r a); {qed}5817(FpIs INaN fm, l)5818| D.Fp_isNormal e p, Cons a Nil ->5819let fm = fmt_ep e p in5820{proof…} D.valid_of d bi r l bi r l bi r l (Is INormal fm r a); {qed}5821(FpIs INormal fm, l)5822| D.Fp_isSubnormal e p, Cons a Nil ->5823let fm = fmt_ep e p in5824{proof…} D.valid_of d bi r l bi r l bi r l (Is ISubnormal fm r a); {qed}5825(FpIs ISubnormal fm, l)5826| D.Fp_isZero e p, Cons a Nil ->5827let fm = fmt_ep e p in5828{proof…} D.valid_of d bi r l bi r l bi r l (Is IZero fm r a); {qed}5829(FpIs IZero fm, l)5830| D.Fp_isInfinite e p, Cons a Nil ->5831let fm = fmt_ep e p in5832{proof…} D.valid_of d bi r l bi r l bi r l (Is IInf fm r a); {qed}5833(FpIs IInf fm, l)5834| D.Fp_isNegative e p, Cons a Nil ->5835let fm = fmt_ep e p in5836{proof…} D.valid_of d bi r l bi r l bi r l (Is INeg fm r a); {qed}5837(FpIs INeg fm, l)5838| D.Fp_isPositive e p, Cons a Nil ->5839let fm = fmt_ep e p in5840{proof…} D.valid_of d bi r l bi r l bi r l (Is IPos fm r a); {qed}5841(FpIs IPos fm, l)5842| D.Fp_isFinite e p, Cons a Nil ->5843let fm = fmt_ep e p in5844{proof…} D.valid_of d bi r l bi r l bi r l (Is IFinite fm r a); {qed}5845(FpIs IFinite fm, l)5846| D.To_real e p, Cons a Nil ->5847let fm = fmt_ep e p in5848{proof…} D.valid_of d bi r l bi r l bi r l (ToReal fm r a); {qed}5849(FpToReal fm, l)5850| D.Real_to_fp e p, Cons m (Cons a Nil) ->5851let fm = fmt_ep e p in5852{proof…} D.valid_of d bi r l bi r l bi r l (OfReal fm r m a); {qed}5853(FpOfReal fm, l)5854(* the terms of the LRA theory, for the dyadic domain of the reals *)5855| D.Add _, Cons a (Cons b Nil) ->5856{proof…} D.valid_of d bi r l bi r l bi r l (RBin RAdd r a b); {qed}5857(RealBin RAdd, l)5858| D.Sub _, Cons a (Cons b Nil) ->5859{proof…} D.valid_of d bi r l bi r l bi r l (RBin RSub r a b); {qed}5860(RealBin RSub, l)5861| D.Mul _, Cons a (Cons b Nil) ->5862{proof…} D.valid_of d bi r l bi r l bi r l (RBin RMul r a b); {qed}5863(RealBin RMul, l)5864| D.Minus _, Cons a Nil ->5865{proof…} D.valid_of d bi r l bi r l bi r l (RNeg r a); {qed}5866(RealNeg, l)5867| _ -> (Other, Nil)5868end5869with NoFormat -> (Other, Nil)5870end5871end5872
The propagators of the term g; false when it is not handled here
Valid (1.2s) (colibri2 61) (split_vc) (depth 1)let convert (d: env) (g: ground) : bool5875= let r = node g in5876match view d g with5877| (FpBin o fm, Cons m (Cons a (Cons b Nil))) ->5878register d m; register d a; register d b;5879let p = mk_reg d (Bin o fm r m a b) in5880wait_value d g m p; wait_dom d g a p; wait_dom d g b p; wait_dom d g r p;5881let _ = run_reg d p in5882(* the rules on the sign and the magnitude *)5883let p = mk_reg d (Rule o fm r m a b) in5884wait_dom d g a p; wait_dom d g b p;5885let _ = run_reg d p in5886(* the relations between the arguments *)5887match o with5888| ODiv ->5889let p = mk_reg d (Rel o fm r m a b) in5890wait_dom d g b p; wait_dom d g r p; wait_rel d g a b p;5891let _ = run_reg d p in5892(* the monotonicity in the numerator *)5893let p = mk_reg d (Mono o fm r m a b false) in5894wait_dom d g b p; wait_mono d g p;5895let _ = run_reg d p in ()5896| OMul ->5897let p = mk_reg d (Mono o fm r m a b false) in5898wait_dom d g a p; wait_mono d g p;5899let _ = run_reg d p in5900let p = mk_reg d (Mono o fm r m a b true) in5901wait_dom d g b p; wait_mono d g p;5902let _ = run_reg d p in ()5903| OAdd -> ()5904end;5905true5906| (FpAdd fm, Cons m (Cons a (Cons b (Cons c (Cons t Nil))))) ->5907register d m; register d a; register d b;5908let p = mk_reg d (Bin OAdd fm r m a b) in5909wait_value d g m p; wait_dom d g a p; wait_dom d g b p; wait_dom d g r p;5910let _ = run_reg d p in5911let p = mk_reg d (Rule OAdd fm r m a b) in5912wait_dom d g a p; wait_dom d g b p;5913let _ = run_reg d p in5914let p = mk_reg d (Rel OAdd fm r m a b) in5915wait_dom d g a p; wait_dom d g b p; wait_dom d g r p; wait_rel d g a b p; wait_divs d g r p;5916let _ = run_reg d p in5917let p = mk_reg d (Mono OAdd fm r m a b false) in5918wait_mono d g p;5919let _ = run_reg d p in5920let p = mk_reg d (Mono OAdd fm r m a b true) in5921wait_mono d g p;5922let _ = run_reg d p in5923let p = mk_reg d (AddOpp fm r m a b) in5924wait_value d g m p; wait_negs d g a p; wait_negs d g b p;5925wait_repr d g a p; wait_repr d g b p;5926let _ = run_reg d p in5927(* `x + x` is `2 * x` *)5928let q = mk_reg d (AddSelf r a b t) in5929wait_repr d g a q; wait_repr d g b q;5930let _ = run_reg d q in5931true5932| (FpUn o fm, Cons m (Cons a Nil)) ->5933register d m; register d a;5934let p = mk_reg d (Un o fm r m a) in5935wait_value d g m p; wait_dom d g a p; wait_dom d g r p;5936let _ = run_reg d p in5937true5938| (FpCvt fm fm', Cons m (Cons a (Cons tr (Cons ta Nil)))) ->5939register d m; register d a;5940let p = mk_reg d (Cvt fm fm' r m a) in5941wait_value d g m p; wait_dom d g a p; wait_dom d g r p;5942let _ = run_reg d p in5943let p = mk_reg d (ExactCvt fm fm' r a tr ta) in5944wait_dom d g a p;5945let _ = run_reg d p in5946true5947| (FpOfBits fm back, Cons a Nil) ->5948register d a;5949let p = mk_reg d (OfBits fm r a back) in5950wait_rdom d g a p; if back then wait_dom d g r p;5951let _ = run_reg d p in5952true5953| (FpExactInt fm, Cons a (Cons t (Cons c Nil))) ->5954register d c; mergef d r c;5955register d a;5956let p = mk_reg d (ExactInt fm r a t) in5957wait_rdom d g a p; wait_ddom d g a p;5958let _ = run_reg d p in5959true5960| (FpToRealIn fm lo hi, Cons ri (Cons a Nil)) ->5961register d a; register d ri;5962let p = mk_reg d (ToRealIn fm ri a lo hi) in5963wait_dom d g a p; wait_rdom d g ri p;5964let _ = run_reg d p in5965true5966| (FpAbs fm, Cons a Nil) ->5967register d a;5968let p = mk_reg d (Abs fm r a) in5969wait_dom d g a p; wait_dom d g r p;5970let _ = run_reg d p in5971true5972| (FpNeg, Cons a Nil) ->5973register d a;5974let p = mk_reg d (Neg r a) in5975wait_dom d g a p; wait_dom d g r p;5976let _ = run_reg d p in5977let p = mk_reg d (NegInv r a) in5978wait_negs d g a p; wait_negs d g r p;5979let _ = run_reg d p in5980true5981| (FpChoice, Cons a (Cons b Nil)) ->5982register d a; register d b;5983let p = mk_reg d (Choice r a b) in5984wait_dom d g a p; wait_dom d g b p;5985let _ = run_reg d p in5986true5987| (FpCmp o fm, Cons a (Cons b Nil)) ->5988register d a; register d b;5989let p = mk_reg d (Cmp o fm r a b) in5990wait_bool d g r p; wait_dom d g a p; wait_dom d g b p;5991wait_rel d g a b p;5992let _ = run_reg d p in5993true5994| (FpIs o fm, Cons a Nil) ->5995register d a;5996let p = mk_reg d (Is o fm r a) in5997wait_bool d g r p; wait_dom d g a p;5998let _ = run_reg d p in5999true6000| (FpToReal fm, Cons a Nil) ->6001register d a;6002let p = mk_reg d (ToReal fm r a) in6003wait_dom d g a p; wait_rdom d g r p; wait_ddom d g r p;6004let _ = run_reg d p in6005true6006| (FpOfReal fm, Cons m (Cons a Nil)) ->6007register d m; register d a;6008let p = mk_reg d (OfReal fm r m a) in6009wait_value d g m p; wait_rdom d g a p; wait_dom d g r p;6010let _ = run_reg d p in6011true6012| (RealBin o, Cons a (Cons b Nil)) ->6013register d a; register d b;6014let p = mk_reg d (RBin o r a b) in6015wait_ddom d g a p; wait_ddom d g b p; wait_ddom d g r p;6016let ns = Cons a (Cons b (Cons r Nil)) in6017wait_rdom_dy d g a ns p; wait_rdom_dy d g b ns p; wait_rdom_dy d g r ns p;6018let _ = run_reg d p in6019true6020| (RealNeg, Cons a Nil) ->6021register d a;6022let p = mk_reg d (RNeg r a) in6023wait_ddom d g a p; wait_ddom d g r p;6024let ns = Cons a (Cons r Nil) in6025wait_rdom_dy d g a ns p; wait_rdom_dy d g r ns p;6026let _ = run_reg d p in6027true6028| (FpRw, Cons t Nil) ->6029register d t; mergef d r t;6030true6031| _ -> false6032end6033end6034