aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/micromega
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/micromega')
-rw-r--r--plugins/micromega/certificate.ml2
-rw-r--r--plugins/micromega/mfourier.ml6
-rw-r--r--plugins/micromega/mutils.ml2
-rw-r--r--plugins/micromega/polynomial.ml21
-rw-r--r--plugins/micromega/sos_lib.ml12
5 files changed, 23 insertions, 20 deletions
diff --git a/plugins/micromega/certificate.ml b/plugins/micromega/certificate.ml
index 8db2841c2..4f9129396 100644
--- a/plugins/micromega/certificate.ml
+++ b/plugins/micromega/certificate.ml
@@ -313,7 +313,7 @@ let primal l =
let op_op = function Mc.NonStrict -> Ge |Mc.Equal -> Eq | _ -> raise Strict in
- let cmp x y = Pervasives.compare (fst x) (fst y) in
+ let cmp x y = Int.compare (fst x) (fst y) in
snd (List.fold_right (fun (p,op) (map,l) ->
let (mp,vect) = vect_of_poly map p in
diff --git a/plugins/micromega/mfourier.ml b/plugins/micromega/mfourier.ml
index a1f08d568..7d08f2116 100644
--- a/plugins/micromega/mfourier.ml
+++ b/plugins/micromega/mfourier.ml
@@ -10,6 +10,8 @@ let from_option = Utils.from_option
let debug = false
type ('a,'b) lr = Inl of 'a | Inr of 'b
+let compare_float (p : float) q = Pervasives.compare p q
+
(** Implementation of intervals *)
module Itv =
struct
@@ -590,7 +592,7 @@ struct
(ISet.fold (fun v (eval,s) -> let ts,vl = abstract_partition v s in
((v,vl)::eval, ts)) v ([],sl)) in
- List.sort (fun x y -> Pervasives.compare (snd x) (snd y) ) evals
+ List.sort (fun x y -> compare_float (snd x) (snd y) ) evals
end
@@ -704,7 +706,7 @@ struct
(* pp_list (fun o ((v,eq,_,_),cst) -> Printf.fprintf o "((%i,%a),%i)\n" v pp_vect eq cst) stdout all_costs ; *)
- List.sort (fun x y -> Pervasives.compare (snd x) (snd y) ) all_costs
+ List.sort (fun x y -> Int.compare (snd x) (snd y) ) all_costs
| Some (v,vect, const,prf,_) -> [(v,vect,const,prf),0]
diff --git a/plugins/micromega/mutils.ml b/plugins/micromega/mutils.ml
index ae89364e6..ce7496fec 100644
--- a/plugins/micromega/mutils.ml
+++ b/plugins/micromega/mutils.ml
@@ -393,7 +393,7 @@ struct
let from i = i
let next i = i + 1
let pp o i = output_string o (string_of_int i)
- let compare : int -> int -> int = Pervasives.compare
+ let compare : int -> int -> int = Int.compare
end
diff --git a/plugins/micromega/polynomial.ml b/plugins/micromega/polynomial.ml
index f993dc14f..6484e5382 100644
--- a/plugins/micromega/polynomial.ml
+++ b/plugins/micromega/polynomial.ml
@@ -44,7 +44,7 @@ end
=
struct
(* A monomial is represented by a multiset of variables *)
- module Map = Map.Make(struct type t = var let compare = Pervasives.compare end)
+ module Map = Map.Make(Int)
open Map
type t = int Map.t
@@ -65,8 +65,8 @@ struct
fun m1 m2 ->
let s1 = sum_degree m1
and s2 = sum_degree m2 in
- if s1 = s2 then Map.compare Pervasives.compare m1 m2
- else Pervasives.compare s1 s2
+ if Int.equal s1 s2 then Map.compare Int.compare m1 m2
+ else Int.compare s1 s2
let is_const m = (m = Map.empty)
@@ -241,8 +241,7 @@ module Vect =
type var = int
type t = (var * num) list
-(** [equal v1 v2 = true] if the vectors are syntactically equal.
- ([num] is not handled by [Pervasives.equal] *)
+(** [equal v1 v2 = true] if the vectors are syntactically equal. *)
let rec equal v1 v2 =
match v1 , v2 with
@@ -250,7 +249,7 @@ module Vect =
| [] , _ -> false
| _::_ , [] -> false
| (i1,n1)::v1 , (i2,n2)::v2 ->
- (i1 = i2) && n1 =/ n2 && equal v1 v2
+ (Int.equal i1 i2) && n1 =/ n2 && equal v1 v2
let hash v =
let rec hash i = function
@@ -294,7 +293,7 @@ module Vect =
match t with
| [] -> cons i (f zero_num) []
| (k,v)::l ->
- match Pervasives.compare i k with
+ match Int.compare i k with
| 0 -> cons k (f v) l
| -1 -> cons i (f zero_num) t
| 1 -> (k,v) ::(update i f l)
@@ -304,7 +303,7 @@ module Vect =
match t with
| [] -> cons i n []
| (k,v)::l ->
- match Pervasives.compare i k with
+ match Int.compare i k with
| 0 -> cons k n l
| -1 -> cons i n t
| 1 -> (k,v) :: (set i n l)
@@ -346,7 +345,7 @@ module Vect =
let compare : t -> t -> int = Utils.Cmp.compare_list (fun x y -> Utils.Cmp.compare_lexical
[
- (fun () -> Pervasives.compare (fst x) (fst y));
+ (fun () -> Int.compare (fst x) (fst y));
(fun () -> compare_num (snd x) (snd y))])
(** [tail v vect] returns
@@ -359,7 +358,7 @@ module Vect =
match vect with
| [] -> None
| (v',vl)::vect' ->
- match Pervasives.compare v' v with
+ match Int.compare v' v with
| 0 -> Some (vl,vect) (* Ok, found *)
| -1 -> tail v vect' (* Might be in the tail *)
| _ -> None (* Hopeless *)
@@ -615,7 +614,7 @@ struct
end
let normalise (v,c) =
- (List.sort (fun x y -> Pervasives.compare (fst x) (fst y)) v , c)
+ (List.sort (fun x y -> Int.compare (fst x) (fst y)) v , c)
let output_mon o (x,v) =
diff --git a/plugins/micromega/sos_lib.ml b/plugins/micromega/sos_lib.ml
index efb3f9885..235f9ce9b 100644
--- a/plugins/micromega/sos_lib.ml
+++ b/plugins/micromega/sos_lib.ml
@@ -15,11 +15,13 @@ let debugging = ref false;;
(* Comparisons that are reflexive on NaN and also short-circuiting. *)
(* ------------------------------------------------------------------------- *)
-let (=?) = fun x y -> Pervasives.compare x y = 0;;
-let (<?) = fun x y -> Pervasives.compare x y < 0;;
-let (<=?) = fun x y -> Pervasives.compare x y <= 0;;
-let (>?) = fun x y -> Pervasives.compare x y > 0;;
-let (>=?) = fun x y -> Pervasives.compare x y >= 0;;
+let cmp = Pervasives.compare (** FIXME *)
+
+let (=?) = fun x y -> cmp x y = 0;;
+let (<?) = fun x y -> cmp x y < 0;;
+let (<=?) = fun x y -> cmp x y <= 0;;
+let (>?) = fun x y -> cmp x y > 0;;
+let (>=?) = fun x y -> cmp x y >= 0;;
(* ------------------------------------------------------------------------- *)
(* Combinators. *)