test/Tools/isac/IsacKnowledge/poly.sml
author Walther Neuper <neuper@ist.tugraz.at>
Wed, 18 Aug 2010 13:40:09 +0200
branchisac-update-Isa09-2
changeset 37924 6c53fe2519e5
parent 37906 e2b23ba9df13
child 37926 e6fc98fbcb85
permissions -rw-r--r--
established thy-ctxt strategy (1..2) for ME/mstools.sml

strategy in 2 steps:
(1) update isac to Isabelle2009-2 with minimal changes
(a) 'parse thy' left as is
'str2t' --> 'str2term_' according to (b)
'comp_dts thy' left as is, but returns term NOT cterm
(b) pretty printing '*2str' always without thy | ctxt
pretty printing '*2str_' always with ctxt
(2) make parsing dependent on context of calculation
(a) 'parse thy' --> 'parse ctxt' simplified by searchin 'thy'
(b) nothin to do
     1 (* testexamples for Poly, polynomials
     2    author: Matthias Goldgruber 2003
     3    (c) due to copyright terms
     4 
     5 use"../smltest/IsacKnowledge/poly.sml";
     6 use"poly.sml";
     7 ****************************************************************.*)
     8 
     9 (******************************************************************
    10   WN060104 'SPB' came into 'exp_IsacCore_Simp_Poly_Book.xml'
    11 	   'SPO' came into 'exp_IsacCore_Simp_Poly_Other.xml'
    12 *******************************************************************)
    13 "-----------------------------------------------------------------";
    14 "table of contents -----------------------------------------------";
    15 "-----------------------------------------------------------------";
    16 "-------- investigate new uniary minus ---------------------------";
    17 "-------- Bsple aus Schalk I -------------------------------------";
    18 "-------- Script 'simplification for_polynomials' ----------------";
    19 "-------- check pbl  'polynomial simplification' -----------------";
    20 "-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
    21 "-------- norm_Poly NOT COMPLETE ---------------------------------";
    22 "-------- ord_make_polynomial ------------------------------------";
    23 "-----------------------------------------------------------------";
    24 "-----------------------------------------------------------------";
    25 "-----------------------------------------------------------------";
    26 
    27 
    28 "-------- investigate new uniary minus ---------------------------";
    29 "-------- investigate new uniary minus ---------------------------";
    30 "-------- investigate new uniary minus ---------------------------";
    31 val t = (#prop o rep_thm) real_diff_0; (*"0 - ?x = - ?x"*)
    32 atomty t;
    33 (*** -------------
    34 *** Const ( Trueprop, bool => prop)
    35 *** . Const ( op =, [real, real] => bool)
    36 *** . . Const ( op -, [real, real] => real)
    37 *** . . . Const ( 0, real)
    38 *** . . . Var ((x, 0), real)
    39 *** . . Const ( uminus, real => real)
    40 *** . . . Var ((x, 0), real)              *)
    41 
    42 val t = (term_of o the o (parse thy)) "-1";
    43 atomty t;
    44 (*** -------------
    45 *** Free ( -1, real)                      *)
    46 val t = (term_of o the o (parse thy)) "- 1";
    47 atomty t;
    48 (*** -------------
    49 *** Const ( uminus, real => real)
    50 *** . Free ( 1, real)                     *)
    51 
    52 val t = (term_of o the o (parse thy)) "-x"; (*1-x  syntyx error !!!*)
    53 atomty t;
    54 (**** -------------
    55 *** Free ( -x, real)*)
    56 val t = (term_of o the o (parse thy)) "- x";
    57 atomty t;
    58 (**** -------------
    59 *** Free ( -x, real) !!!!!!!!!!!!!!!!!!!!!!!! is the same !!!*)
    60 val t = (term_of o the o (parse thy)) "-(x)";
    61 atomty t;
    62 (**** -------------
    63 *** Free ( -x, real)*)
    64 
    65 
    66 "-------- Bsple aus Schalk I -------------------------------------";
    67 "-------- Bsple aus Schalk I -------------------------------------";
    68 "-------- Bsple aus Schalk I -------------------------------------";
    69 (*SPB Schalk I p.63 No.267b*)
    70 val t = str2term
    71  	    "(5*x^^^2 + 3) * (2*x^^^7 + 3) - (3*x^^^5 + 8) * (6*x^^^4 - 1)";
    72 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
    73 if (term2str t) = 
    74 "17 + 15 * x ^^^ 2 + -48 * x ^^^ 4 + 3 * x ^^^ 5 + 6 * x ^^^ 7 + -8 * x ^^^ 9"
    75 then ()
    76 else raise error "poly.sml: diff.behav. in make_polynomial 1";
    77 
    78 (*SPB Schalk I p.63 No.275b*)
    79  val t = str2term
    80  	     "(3*x^^^2 - 2*x*y + y^^^2) * (x^^^2 - 2*y^^^2)";
    81  val Some (t,_) = rewrite_set_ thy false make_polynomial t;
    82  term2str t;
    83 if (term2str t) = 
    84 "3 * x ^^^ 4 + -2 * x ^^^ 3 * y + -5 * x ^^^ 2 * y ^^^ 2 + \
    85 \4 * x * y ^^^ 3 +\n-2 * y ^^^ 4"
    86 then ()
    87 else raise error "poly.sml: diff.behav. in make_polynomial 2";
    88 
    89 (*SPB Schalk I p.63 No.279b*)
    90  val t = str2term
    91  	     "(x-a)*(x-b)*(x-c)*(x-d)";
    92  val Some (t,_) = rewrite_set_ thy false make_polynomial t;
    93  term2str t;
    94 (* Richtig! *)
    95 if (term2str t) = 
    96 "a * b * c * d + -1 * a * b * c * x + -1 * a * b * d * x + a * b * x ^^^ 2 +\n-1 * a * c * d * x +\na * c * x ^^^ 2 +\na * d * x ^^^ 2 +\n-1 * a * x ^^^ 3 +\n-1 * b * c * d * x +\nb * c * x ^^^ 2 +\nb * d * x ^^^ 2 +\n-1 * b * x ^^^ 3 +\nc * d * x ^^^ 2 +\n-1 * c * x ^^^ 3 +\n-1 * d * x ^^^ 3 +\nx ^^^ 4"
    97 then ()
    98 else raise error "poly.sml: diff.behav. in make_polynomial 3";
    99 
   100 (*SPB Schalk I p.63 No.291*)
   101  val t = str2term
   102  "(5+96*x^^^3+8*x*(-4+(7- 3*x)*4*x))*(5*(2- 3*x)- (-15*x*(-8*x- 5)))";
   103  val Some (t,_) = rewrite_set_ thy false make_polynomial t;
   104  term2str t;
   105 if (term2str t) = 
   106 "50 + -770 * x + 4520 * x ^^^ 2 + -16320 * x ^^^ 3 + -26880 * x ^^^ 4"
   107 then ()
   108 else raise error "poly.sml: diff.behav. in make_polynomial 4";
   109 
   110 (*SPB Schalk I p.64 No.295c*)
   111  val t = str2term
   112  "(13*a^^^4*b^^^9*c - 12*a^^^3*b^^^6*c^^^9)^^^2";
   113  val Some (t,_) = rewrite_set_ thy false make_polynomial t;
   114  term2str t;
   115 if (term2str t) = 
   116 "169 * a ^^^ 8 * b ^^^ 18 * c ^^^ 2 + -312 * a ^^^ 7 * b ^^^ 15 * c ^^^ 10\
   117 \ +\n144 * a ^^^ 6 * b ^^^ 12 * c ^^^ 18"
   118 then ()
   119 else raise error "poly.sml: diff.behav. in make_polynomial 5";
   120 
   121 (*SPB Schalk I p.64 No.299a*)
   122  val t = str2term
   123  "(x - y)*(x + y)";
   124  val Some (t,_) = rewrite_set_ thy false make_polynomial t;
   125  term2str t;
   126 if (term2str t) = 
   127 "x ^^^ 2 + -1 * y ^^^ 2"
   128 then ()
   129 else raise error "poly.sml: diff.behav. in make_polynomial 6";
   130 
   131 (*SPB Schalk I p.64 No.300c*)
   132  val t = str2term
   133  "(3*x^^^2*y - 1)*(3*x^^^2*y + 1)";
   134  val Some (t,_) = rewrite_set_ thy false make_polynomial t;
   135  term2str t;
   136 if (term2str t) = 
   137 "-1 + 9 * x ^^^ 4 * y ^^^ 2"
   138 then ()
   139 else raise error "poly.sml: diff.behav. in make_polynomial 7";
   140 
   141 (*SPB Schalk I p.64 No.302*)
   142 val t = str2term
   143  "(13*x^^^2 + 5)*(13*x^^^2 - 5) - (5*x^^^2 + 3)*(5*x^^^2 - 3) - (12*x^^^2 + 4)*(12*x^^^2 - 4)";
   144 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   145 if term2str t = "0" then ()
   146 else raise error "poly.sml: diff.behav. in make_polynomial 8";
   147 (* Bei Berechnung sollte 3 mal real_plus_minus_binom1_p aus expand_poly verwendet werden *)
   148 
   149 
   150 (*SPB Schalk I p.64 No.306a*)
   151 val t = str2term "((x^^^2 + 1)*(x^^^2 - 1))^^^2";
   152 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   153 if (term2str t) = "1 + 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 + x ^^^ 8" then ()
   154 else raise error "poly.sml: diff.behav. in make_polynomial: not confluent \
   155 		 \2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 = -2 * x ^^^ 4 works again";
   156 
   157 
   158 (*WN071729 when reducing "rls reduce_012_" for Schaerding,
   159 the above resulted in the term below ... but reduces from then correctly*)
   160 val t = str2term "1 + 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 + x ^^^ 8";
   161 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   162 if (term2str t) = "1 + -2 * x ^^^ 4 + x ^^^ 8" then ()
   163 else raise error "poly.sml: diff.behav. in make_polynomial 9b";
   164 
   165 (*SPB Schalk I p.64 No.296a*)
   166 val t = str2term "(x - a)^^^3";
   167 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   168 if (term2str t) = "-1 * a ^^^ 3 + 3 * a ^^^ 2 * x + -3 * a * x ^^^ 2 + x ^^^ 3"
   169 then () else raise error "poly.sml: diff.behav. in make_polynomial 10";
   170 
   171 (*SPB Schalk I p.64 No.296c*)
   172 val t = str2term "(-3*x - 4*y)^^^3";
   173 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   174 if (term2str t) = 
   175 "-27 * x ^^^ 3 + -108 * x ^^^ 2 * y + -144 * x * y ^^^ 2 + -64 * y ^^^ 3"
   176 then () else raise error "poly.sml: diff.behav. in make_polynomial 11";
   177 
   178 (*SPB Schalk I p.62 No.242c*)
   179 val t = str2term "x^^^(-4)*(x^^^(-4)*y^^^(-2))^^^(-1)*y^^^(-2)";
   180 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   181 if (term2str t) = "1" then ()
   182 else raise error "poly.sml: diff.behav. in make_polynomial 12";
   183 
   184 (*SPB Schalk I p.60 No.209a*)
   185 val t = str2term "a^^^(7-x) * a^^^x";
   186 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   187 if term2str t = "a ^^^ 7" then ()
   188 else raise error "poly.sml: diff.behav. in make_polynomial 13";
   189 
   190 (*SPB Schalk I p.60 No.209d*)
   191 val t = str2term "d^^^x * d^^^(x+1) * d^^^(2 - 2*x)";
   192 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   193 if term2str t = "d ^^^ 3" then ()
   194 else raise error "poly.sml: diff.behav. in make_polynomial 14";
   195 
   196 
   197 (*---------------------------------------------------------------------*)
   198 (*------------------ Bsple bei denen es Probleme gibt------------------*)
   199 (*---------------------------------------------------------------------*)
   200 
   201 (*Schalk I p.64 No.303*)
   202 val t = str2term "(a + 2*b)*(a^^^2 + 4*b^^^2)*(a - 2*b) - (a - 6*b)*(a^^^2 + 36*b^^^2)*(a + 6*b)";
   203 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   204 if term2str t = "1280 * b ^^^ 4" then ()
   205 else raise error "poly.sml: diff.behav. in make_polynomial 14b";
   206 (* Richtig - aber Binomische Formel wurde nicht verwendet! *)
   207 
   208 
   209 (*--------------------------------------------------------------------*)
   210 (*----------------------- Eigene Beispiele ---------------------------*)
   211 (*--------------------------------------------------------------------*)
   212 (*SPO*)
   213 val t = str2term "a^^^2*a^^^(-2)";
   214 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   215 if term2str t = "1" then ()
   216 else raise error "poly.sml: diff.behav. in make_polynomial 15";
   217 (*SPO*)
   218 val t = str2term "a + a + a";
   219 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   220 if term2str t = "3 * a" then ()
   221 else raise error "poly.sml: diff.behav. in make_polynomial 16";
   222 (*SPO*)
   223 val t = str2term "a + b + b + b";
   224 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   225 if term2str t = "a + 3 * b" then ()
   226 else raise error "poly.sml: diff.behav. in make_polynomial 17";
   227 (*SPO*)
   228 val t = str2term "a^^^2*b*b^^^(-1)";
   229 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   230 if term2str t = "a ^^^ 2" then ()
   231 else raise error "poly.sml: diff.behav. in make_polynomial 18";
   232 (*SPO*)
   233 val t = str2term "a^^^2*a^^^(-2)";
   234 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   235 if (term2str t) = "1" then ()
   236 else raise error "poly.sml: diff.behav. in make_polynomial 19";
   237 (*SPO*)
   238 val t = str2term "b + a - b";
   239 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   240 if (term2str t) = "a" then ()
   241 else raise error "poly.sml: diff.behav. in make_polynomial 20";
   242 (*SPO*)
   243 val t = str2term "b * a * a";
   244 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   245 if term2str t = "a ^^^ 2 * b" then ()
   246 else raise error "poly.sml: diff.behav. in make_polynomial 21";
   247 (*SPO*)
   248 val t = str2term "(a^^^2)^^^3";
   249 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   250 if term2str t = "a ^^^ 6" then ()
   251 else raise error "poly.sml: diff.behav. in make_polynomial 22";
   252 (*SPO*)
   253 val t = str2term "x^^^2 * y^^^2 + x * x^^^2 * y";
   254 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   255 if term2str t = "x ^^^ 3 * y + x ^^^ 2 * y ^^^ 2" then ()
   256 else raise error "poly.sml: diff.behav. in make_polynomial 23";
   257 (*SPO*)
   258 val t = (term_of o the o (parse thy)) "a^^^2 * (-a)^^^2";
   259 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   260 if (term2str t) = "a ^^^ 4" then ()
   261 else raise error "poly.sml: diff.behav. in make_polynomial 24";
   262 (*SPO*)
   263 val t = str2term "a * b * b^^^(-1) + a";
   264 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   265 if (term2str t) = "2 * a" then ()
   266 else raise error "poly.sml: diff.behav. in make_polynomial 25";
   267 (*SPO*)
   268 val t = str2term "a*c*b^^^(2*n) + 3*a + 5*b^^^(2*n)*c*b";
   269 val Some (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
   270 if (term2str t) = "3 * a + 5 * b ^^^ (1 + 2 * n) * c + a * b ^^^ (2 * n) * c"
   271 then () else raise error "poly.sml: diff.behav. in make_polynomial 26";
   272 
   273 
   274 (*MG.27.6.03 -------------vvv-: Verschachtelte Terme -----------*)
   275 (*SPO*)
   276 val t = str2term "(1 + (x*y*a) + x)^^^(1 + (x*y*a) + x)";
   277  val Some (t,_) = rewrite_set_ thy false make_polynomial t;
   278  term2str t;
   279 if term2str t = "(1 + x + a * x * y) ^^^ (1 + x + a * x * y)"
   280  then () else raise error "poly.sml: diff.behav. in make_polynomial 27";(*SPO*)
   281 val t = str2term "(1 + x*(y*z)*zz)^^^(1 + x*(y*z)*zz)";
   282  val Some (t,_) = rewrite_set_ thy false make_polynomial t;
   283  term2str t;
   284 if term2str t = "(1 + x * y * z * zz) ^^^ (1 + x * y * z * zz)"
   285  then () else raise error "poly.sml: diff.behav. in make_polynomial 28";
   286 
   287 "-------- Script 'simplification for_polynomials' ----------------";
   288 "-------- Script 'simplification for_polynomials' ----------------";
   289 "-------- Script 'simplification for_polynomials' ----------------";
   290 val str = 
   291 "Script SimplifyScript (t_::real) =                \
   292 \  ((Rewrite_Set norm_Poly False) t_)";
   293 val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
   294 atomty sc;
   295 
   296 
   297 "-------- check pbl  'polynomial simplification' -----------------";
   298 "-------- check pbl  'polynomial simplification' -----------------";
   299 "-------- check pbl  'polynomial simplification' -----------------";
   300 val fmz = ["term ((5*x^^^2 + 3) * (2*x^^^7 + 3) \
   301 	   \- (3*x^^^5 + 8) * (6*x^^^4 - 1))",
   302 	   "normalform N"];
   303 (*0*)
   304 case refine fmz ["polynomial","simplification"]of
   305     [Matches (["polynomial", "simplification"], _)] => ()
   306   | _ => raise error "poly.sml diff.behav. in check pbl, refine";
   307 (*...if there is an error, then ...*)
   308 
   309 (*1*)
   310 print_depth 7;
   311 val pbt = get_pbt ["polynomial","simplification"];
   312 print_depth 3;
   313 (*if there is ...
   314 > val NoMatch' {Given=gi, Where=wh, Find=fi,...} = match_pbl fmz pbt;
   315 ... then trace_rewrite:*)
   316 
   317 (*2*)
   318 trace_rewrite:=true; 
   319 match_pbl fmz pbt;
   320 trace_rewrite:=false;
   321 (*... if there is no rewrite, then there is something wrong with prls*)
   322 
   323 (*3*)
   324 print_depth 7;
   325 val prls = (#prls o get_pbt) ["polynomial","simplification"];
   326 print_depth 3;
   327 val t = str2term "((5*x^^^2 + 3) * (2*x^^^7 + 3) \
   328 		 \- (3*x^^^5 + 8) * (6*x^^^4 - 1)) is_polyexp";
   329 trace_rewrite:=true; 
   330 val Some (t',_) = rewrite_set_ thy false prls t;
   331 trace_rewrite:=false;
   332 if t' = HOLogic.true_const then () 
   333 else raise error "poly.sml: diff.behav. in check pbl 'polynomial..";
   334 (*... if this works, but (*1*) does still NOT work, check types:*)
   335 
   336 (*4*)
   337 show_types:=true;
   338 (*
   339 > val NoMatch' {Given=gi, Where=wh, Find=fi,...} = match_pbl fmz pbt;
   340 val wh = [False "(t_::real => real) (is_polyexp::real)"]
   341 ......................^^^^^^^^^^^^...............^^^^*)
   342 val Matches' _ = match_pbl fmz pbt;
   343 show_types:=false;
   344 
   345 
   346 "-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
   347 "-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
   348 "-------- me 'polynomial simplification' Schalk I p.63 No.267b ---";
   349 val fmz = ["term ((5*x^^^2 + 3) * (2*x^^^7 + 3) \
   350 	   \- (3*x^^^5 + 8) * (6*x^^^4 - 1))",
   351 	   "normalform N"];
   352 val (dI',pI',mI') =
   353   ("Poly.thy",["polynomial","simplification"],
   354    ["simplification","for_polynomials"]);
   355 val p = e_pos'; val c = []; 
   356 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   357 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   358 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   359 (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
   360 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   361 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   362 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   363 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   364 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
   365 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
   366 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
   367 if f2str f = 
   368 "17 + 15 * x ^^^ 2 + -48 * x ^^^ 4 + 3 * x ^^^ 5 + 6 * x ^^^ 7 + -8 * x ^^^ 9"
   369 then () else raise error "poly.sml diff.behav. in me Schalk I p.63 No.267b";
   370 
   371 
   372 "-------- interSteps for Schalk 299a -----------------------------";
   373 "-------- interSteps for Schalk 299a -----------------------------";
   374 "-------- interSteps for Schalk 299a -----------------------------";
   375 states:=[];
   376 CalcTree
   377 [(["term ((x - y)*(x + y))", "normalform N"], 
   378   ("Poly.thy",["polynomial","simplification"],
   379   ["simplification","for_polynomials"]))];
   380 Iterator 1;
   381 moveActiveRoot 1;
   382 autoCalculate 1 CompleteCalc;
   383 val ((pt,p),_) = get_calc 1; show_pt pt;
   384 
   385 interSteps 1 ([1],Res)(*<ERROR> syserror in detailstep </ERROR>*);
   386 val ((pt,p),_) = get_calc 1; show_pt pt;
   387 if existpt' ([1,1], Frm) pt then ()
   388 else raise error "poly.sml: interSteps doesnt work again 1";
   389 
   390 interSteps 1 ([1,1],Res)(*<ERROR> syserror in detailstep </ERROR>*);
   391 val ((pt,p),_) = get_calc 1; show_pt pt;
   392 if existpt' ([1,1,1], Frm) pt then ()
   393 else raise error "poly.sml: interSteps doesnt work again 2";
   394 
   395 
   396 "-------- norm_Poly NOT COMPLETE ---------------------------------";
   397 "-------- norm_Poly NOT COMPLETE ---------------------------------";
   398 "-------- norm_Poly NOT COMPLETE ---------------------------------";
   399 trace_rewrite:=true;
   400 val Some (f',_) = rewrite_set_ thy false norm_Poly 
   401 (str2term "L = k - 2 * q + (k - 2 * q) + (k - 2 * q) + (k - 2 * q) + senkrecht + oben")(*see poly.sml: -- norm_Poly NOT COMPLETE -- TODO MG*);
   402 trace_rewrite:=false;
   403 term2str f';
   404 
   405 "-------- ord_make_polynomial ------------------------------------";
   406 "-------- ord_make_polynomial ------------------------------------";
   407 "-------- ord_make_polynomial ------------------------------------";
   408 val t1 = str2term "2 * b + (3 * a + 3 * b)";
   409 val t2 = str2term "3 * a + 3 * b + 2 * b";
   410 
   411 if ord_make_polynomial true Poly.thy [] (t1, t2) then ()
   412 else raise error "poly.sml: diff.behav. in ord_make_polynomial";
   413 
   414 (*WN071202: ^^^ why then is there no rewriting ...*)
   415 val term = str2term "2*b + (3*a + 3*b)";
   416 val None = rewrite_set_ Isac.thy false order_add_mult term;
   417 
   418 (*or why is there no rewriting this way...*)
   419 val t1 = str2term "2 * b + (3 * a + 3 * b)";
   420 val t2 = str2term "3 * a + (2 * b + 3 * b)";
   421 
   422 
   423