@@ -445,6 +445,23 @@ let exclude =
445
445
let uints1_c = union_intervals {uints1 with ints = l_c} in
446
446
intersect uints1_c uints2
447
447
448
+ let add_borne b1 b2 =
449
+ match b1,b2 with
450
+ | Minfty , Pinfty | Pinfty , Minfty -> assert false
451
+ | Minfty , _ | _ , Minfty -> Minfty
452
+ | Pinfty , _ | _ , Pinfty -> Pinfty
453
+ | Large (v1 , e1 ), Large (v2 , e2 ) ->
454
+ Large (Q. add v1 v2, Ex. union e1 e2)
455
+ | (Large (v1 , e1 ) | Strict (v1 , e1 )), (Large (v2 , e2 ) | Strict (v2 , e2 )) ->
456
+ Strict (Q. add v1 v2, Ex. union e1 e2)
457
+
458
+ let translate c ((b1 , b2 ) as b ) =
459
+ if Q. (equal zero) c then b
460
+ else begin
461
+ let tmp = Large (c, Ex. empty) in
462
+ (add_borne b1 tmp, add_borne b2 tmp)
463
+ end
464
+
448
465
let scale_interval_zero n (b1 , b2 ) =
449
466
assert (Q. sign n = 0 );
450
467
Large (Q. zero, explain_borne b1), Large (Q. zero, explain_borne b2)
@@ -463,34 +480,31 @@ let scale_interval_neg n (b1, b2) =
463
480
minus_borne (scale_borne_non_zero (Q. minus n) b2),
464
481
minus_borne (scale_borne_non_zero (Q. minus n) b1)
465
482
466
- let scale n uints =
483
+
484
+ let affine_scale ~const ~coef uints =
467
485
Options. tool_req 4 " TR-Arith-Axiomes scale" ;
468
- if Q. equal n Q. one then uints
486
+ if Q. equal coef Q. one then
487
+ { uints with ints = List. map (translate const) uints.ints; }
469
488
else
470
- let sgn = Q. sign n in
489
+ let sgn = Q. sign coef in
471
490
let aux =
472
491
if sgn = 0 then scale_interval_zero
473
492
else if sgn > 0 then scale_interval_pos
474
493
else scale_interval_neg
475
494
in
476
- let rl = List. rev_map (aux n) uints.ints in
495
+ let rl = List. rev_map (fun bornes ->
496
+ translate const (aux coef bornes)
497
+ ) uints.ints in
477
498
let l =
478
- if uints.is_int then rev_normalize_int_bounds rl uints.expl n
499
+ if uints.is_int then rev_normalize_int_bounds rl uints.expl coef
479
500
else List. rev rl
480
501
in
481
502
let res = union_intervals { uints with ints = l } in
482
503
assert (res.ints != [] );
483
504
res
484
505
485
- let add_borne b1 b2 =
486
- match b1,b2 with
487
- | Minfty , Pinfty | Pinfty , Minfty -> assert false
488
- | Minfty , _ | _ , Minfty -> Minfty
489
- | Pinfty , _ | _ , Pinfty -> Pinfty
490
- | Large (v1 , e1 ), Large (v2 , e2 ) ->
491
- Large (Q. add v1 v2, Ex. union e1 e2)
492
- | (Large (v1 , e1 ) | Strict (v1 , e1 )), (Large (v2 , e2 ) | Strict (v2 , e2 )) ->
493
- Strict (Q. add v1 v2, Ex. union e1 e2)
506
+ let scale coef uints =
507
+ affine_scale ~const: Q. zero ~coef uints
494
508
495
509
let add_interval is_int l (b1 ,b2 ) =
496
510
List. fold_right
0 commit comments