aboutsummaryrefslogtreecommitdiff
path: root/plugins/micromega/sos_types.ml
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2020-03-04 14:29:10 -0500
committerEmilio Jesus Gallego Arias2020-03-04 21:17:46 -0500
commit8af9dbdcc27934deda35f6c8fbdecdfe869b09c5 (patch)
treee0e4f6ece4b2bbfc01b7662d43519ff49a27143a /plugins/micromega/sos_types.ml
parent33ab70ac3a8d08afb67d9602d7c23da7133ad0f4 (diff)
[micromega] Add numerical compatibility layer.
Only significant change is in gcd / lcm which now are typed in `Z.t`
Diffstat (limited to 'plugins/micromega/sos_types.ml')
-rw-r--r--plugins/micromega/sos_types.ml20
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/micromega/sos_types.ml b/plugins/micromega/sos_types.ml
index 988024968b..62699d8362 100644
--- a/plugins/micromega/sos_types.ml
+++ b/plugins/micromega/sos_types.ml
@@ -9,13 +9,13 @@
(************************************************************************)
(* The type of positivstellensatz -- used to communicate with sos *)
-open Num
-
type vname = string
+open NumCompat
+
type term =
| Zero
- | Const of Num.num
+ | Const of Q.t
| Var of vname
| Opp of term
| Add of (term * term)
@@ -26,7 +26,7 @@ type term =
let rec output_term o t =
match t with
| Zero -> output_string o "0"
- | Const n -> output_string o (string_of_num n)
+ | Const n -> output_string o (Q.to_string n)
| Var n -> Printf.fprintf o "v%s" n
| Opp t -> Printf.fprintf o "- (%a)" output_term t
| Add (t1, t2) -> Printf.fprintf o "(%a)+(%a)" output_term t1 output_term t2
@@ -42,9 +42,9 @@ type positivstellensatz =
| Axiom_eq of int
| Axiom_le of int
| Axiom_lt of int
- | Rational_eq of num
- | Rational_le of num
- | Rational_lt of num
+ | Rational_eq of Q.t
+ | Rational_le of Q.t
+ | Rational_lt of Q.t
| Square of term
| Monoid of int list
| Eqmul of term * positivstellensatz
@@ -55,9 +55,9 @@ let rec output_psatz o = function
| Axiom_eq i -> Printf.fprintf o "Aeq(%i)" i
| Axiom_le i -> Printf.fprintf o "Ale(%i)" i
| Axiom_lt i -> Printf.fprintf o "Alt(%i)" i
- | Rational_eq n -> Printf.fprintf o "eq(%s)" (string_of_num n)
- | Rational_le n -> Printf.fprintf o "le(%s)" (string_of_num n)
- | Rational_lt n -> Printf.fprintf o "lt(%s)" (string_of_num n)
+ | Rational_eq n -> Printf.fprintf o "eq(%s)" (Q.to_string n)
+ | Rational_le n -> Printf.fprintf o "le(%s)" (Q.to_string n)
+ | Rational_lt n -> Printf.fprintf o "lt(%s)" (Q.to_string n)
| Square t -> Printf.fprintf o "(%a)^2" output_term t
| Monoid l -> Printf.fprintf o "monoid"
| Eqmul (t, ps) -> Printf.fprintf o "%a * %a" output_term t output_psatz ps