equal
deleted
inserted
replaced
15 struct |
15 struct |
16 |
16 |
17 (** print certificate **) |
17 (** print certificate **) |
18 |
18 |
19 local |
19 local |
20 |
|
21 fun string_of_rat r = |
|
22 let |
|
23 val (nom, den) = Rat.dest r |
|
24 in |
|
25 if den = 1 then string_of_int nom |
|
26 else string_of_int nom ^ "/" ^ string_of_int den |
|
27 end |
|
28 |
|
29 |
20 |
30 (* map polynomials to strings *) |
21 (* map polynomials to strings *) |
31 |
22 |
32 fun string_of_varpow x k = |
23 fun string_of_varpow x k = |
33 let |
24 let |
47 val m' = FuncUtil.dest_monomial m |
38 val m' = FuncUtil.dest_monomial m |
48 val vps = fold_rev (fn (x,k) => cons (string_of_varpow x k)) m' [] |
39 val vps = fold_rev (fn (x,k) => cons (string_of_varpow x k)) m' [] |
49 in foldr1 (fn (s, t) => s ^ "*" ^ t) vps end |
40 in foldr1 (fn (s, t) => s ^ "*" ^ t) vps end |
50 |
41 |
51 fun string_of_cmonomial (m,c) = |
42 fun string_of_cmonomial (m,c) = |
52 if FuncUtil.Ctermfunc.is_empty m then string_of_rat c |
43 if FuncUtil.Ctermfunc.is_empty m then Rat.string_of_rat c |
53 else if c = @1 then string_of_monomial m |
44 else if c = @1 then string_of_monomial m |
54 else string_of_rat c ^ "*" ^ string_of_monomial m |
45 else Rat.string_of_rat c ^ "*" ^ string_of_monomial m |
55 |
46 |
56 fun string_of_poly p = |
47 fun string_of_poly p = |
57 if FuncUtil.Monomialfunc.is_empty p then "0" |
48 if FuncUtil.Monomialfunc.is_empty p then "0" |
58 else |
49 else |
59 let |
50 let |
65 (* print cert *) |
56 (* print cert *) |
66 |
57 |
67 fun pss_to_cert (RealArith.Axiom_eq i) = "A=" ^ string_of_int i |
58 fun pss_to_cert (RealArith.Axiom_eq i) = "A=" ^ string_of_int i |
68 | pss_to_cert (RealArith.Axiom_le i) = "A<=" ^ string_of_int i |
59 | pss_to_cert (RealArith.Axiom_le i) = "A<=" ^ string_of_int i |
69 | pss_to_cert (RealArith.Axiom_lt i) = "A<" ^ string_of_int i |
60 | pss_to_cert (RealArith.Axiom_lt i) = "A<" ^ string_of_int i |
70 | pss_to_cert (RealArith.Rational_eq r) = "R=" ^ string_of_rat r |
61 | pss_to_cert (RealArith.Rational_eq r) = "R=" ^ Rat.string_of_rat r |
71 | pss_to_cert (RealArith.Rational_le r) = "R<=" ^ string_of_rat r |
62 | pss_to_cert (RealArith.Rational_le r) = "R<=" ^ Rat.string_of_rat r |
72 | pss_to_cert (RealArith.Rational_lt r) = "R<" ^ string_of_rat r |
63 | pss_to_cert (RealArith.Rational_lt r) = "R<" ^ Rat.string_of_rat r |
73 | pss_to_cert (RealArith.Square p) = "[" ^ string_of_poly p ^ "]^2" |
64 | pss_to_cert (RealArith.Square p) = "[" ^ string_of_poly p ^ "]^2" |
74 | pss_to_cert (RealArith.Eqmul (p, pss)) = |
65 | pss_to_cert (RealArith.Eqmul (p, pss)) = |
75 "([" ^ string_of_poly p ^ "] * " ^ pss_to_cert pss ^ ")" |
66 "([" ^ string_of_poly p ^ "] * " ^ pss_to_cert pss ^ ")" |
76 | pss_to_cert (RealArith.Sum (pss1, pss2)) = |
67 | pss_to_cert (RealArith.Sum (pss1, pss2)) = |
77 "(" ^ pss_to_cert pss1 ^ " + " ^ pss_to_cert pss2 ^ ")" |
68 "(" ^ pss_to_cert pss1 ^ " + " ^ pss_to_cert pss2 ^ ")" |