1 (* testexamples for Poly, polynomials
2 author: Matthias Goldgruber 2003
3 (c) due to copyright terms
5 12345678901234567890123456789012345678901234567890123456789012345678901234567890
6 10 20 30 40 50 60 70 80
8 WN060104: examples marked with 'SPB' came into 'exp_IsacCore_Simp_Poly_Book.xml'
9 examples marked with 'SPO' came into 'exp_IsacCore_Simp_Poly_Other.xml'
12 "--------------------------------------------------------";
13 "--------------------------------------------------------";
14 "table of contents --------------------------------------";
15 "--------------------------------------------------------";
16 "-------- check is'_polyexp is_polyexp ------------------";
17 "-------- investigate (new 2002) uniary minus -----------";
18 "-------- check make_polynomial with simple terms -------";
19 "-------- fun is_multUnordered --------------------------";
20 "-------- examples from textbook Schalk I ---------------";
21 "-------- check pbl 'polynomial simplification' --------";
22 "-------- me 'poly. simpl.' Schalk I p.63 No.267b -------";
23 "-------- interSteps for Schalk 299a --------------------";
24 "-------- norm_Poly NOT COMPLETE ------------------------";
25 "-------- ord_make_polynomial ---------------------------";
26 "--------------------------------------------------------";
27 "--------------------------------------------------------";
28 "--------------------------------------------------------";
31 "-------- check is'_polyexp is_polyexp ------------------";
32 "-------- check is'_polyexp is_polyexp ------------------";
33 "-------- check is'_polyexp is_polyexp ------------------";
34 if is_polyexp @{term "x / x"}
35 then error "poly.sml: check is'_polyexp is_polyexp" else ();
37 "-------- investigate (new 2002) uniary minus -----------";
38 "-------- investigate (new 2002) uniary minus -----------";
39 "-------- investigate (new 2002) uniary minus -----------";
40 (*---------------------------------------------- vvvvvvvvvvvvvv -----------------------*)
41 val t = (#prop o Thm.rep_thm) @{thm real_diff_0}; (*"0 - ?x = - ?x"*)
44 *** Const (HOL.Trueprop, bool => prop)
45 *** . Const (HOL.eq, real => real => bool)
46 *** . . Const (Groups.minus_class.minus, real => real => real)
47 *** . . . Const (Groups.zero_class.zero, real)
48 *** . . . Var ((x, 0), real)
49 *** . . Const (Groups.uminus_class.uminus, real => real)
50 *** . . . Var ((x, 0), real)
53 Const ("HOL.Trueprop", _) $
54 (Const ("HOL.eq", _) $
55 (Const ("Groups.minus_class.minus", _) $ Const ("Groups.zero_class.zero", _) $
57 (Const ("Groups.uminus_class.uminus", _) $ Var (("x", 0), _))) => ()
58 | _ => error "internal representation of \"0 - ?x = - ?x\" changed";
60 (*----------------------------------- vvvv --------------------------------------------*)
61 val t = (Thm.term_of o the o (parse thy)) "-1";
64 *** Free ( -1, real) *)
67 | _ => error "internal representation of \"-1\" changed";
68 (*----------------------------------- vvvvv -------------------------------------------*)
69 val t = (Thm.term_of o the o (parse thy)) "- 1";
78 | _ => error "internal representation of \"- 1\" changed";
80 "======= these external values all have the same internal representation";
81 (* "1-x" causes syntyx error --- binary minus detected by blank inbetween !!!*)
82 (*----------------------------------- vvvvv -------------------------------------------*)
83 val t = (Thm.term_of o the o (parse thy)) "-x";
86 *** Free ( -x, real)*)
88 Const ("Groups.uminus_class.uminus", _) $ Free ("x", _) => ()
89 | _ => error "internal representation of \"-x\" changed";
90 (*----------------------------------- vvvvv -------------------------------------------*)
91 val t = (Thm.term_of o the o (parse thy)) "- x";
94 *** Free ( -x, real) !!!!!!!!!!!!!!!!!!!!!!!! is the same !!!*)
96 Const ("Groups.uminus_class.uminus", _) $ Free ("x", _) => ()
97 | _ => error "internal representation of \"- x\" changed";
98 (*----------------------------------- vvvvvv ------------------------------------------*)
99 val t = (Thm.term_of o the o (parse thy)) "-(x)";
102 *** Free ( -x, real)*)
104 Const ("Groups.uminus_class.uminus", _) $ Free ("x", _) => ()
105 | _ => error "internal representation of \"-(x)\" changed";
107 "-------- check make_polynomial with simple terms -------";
108 "-------- check make_polynomial with simple terms -------";
109 "-------- check make_polynomial with simple terms -------";
111 val t = str2term "2*3*a";
112 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
113 if term2str t = "6 * a" then () else error "check make_polynomial 1";
116 val t = str2term "2*a + 3*a";
117 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
118 if term2str t = "5 * a" then () else error "check make_polynomial 2";
121 val t = str2term "2*a + 3*a + 3*a";
122 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
123 if term2str t = "8 * a" then () else error "check make_polynomial 3";
126 val t = str2term "3*a - 2*a";
127 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
128 if term2str t = "a" then () else error "check make_polynomial 4";
131 val t = str2term "4*(3*a - 2*a)";
132 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
133 if term2str t = "4 * a" then () else error "check make_polynomial 5";
136 val t = str2term "4*(3*a^^^2 - 2*a^^^2)";
137 val SOME (t, _) = rewrite_set_ thy false make_polynomial t;
138 if term2str t = "4 * a ^^^ 2" then () else error "check make_polynomial 6";
140 "-------- fun is_multUnordered --------------------------";
141 "-------- fun is_multUnordered --------------------------";
142 "-------- fun is_multUnordered --------------------------";
143 val thy = @{theory "Isac"};
144 "===== works for a simple example, see rewrite.sml -- fun app_rev ===";
145 val t = str2term "x^^^2 * x";
146 val SOME (t', _) = rewrite_set_ thy true order_mult_ t;
147 if term2str t' = "x * x ^^^ 2" then ()
148 else error "poly.sml Poly.is'_multUnordered doesn't work";
150 (* 100928 trace_rewrite shows the first occurring difference in 267b:
151 ### rls: order_mult_ on: 5 * x ^^^ 2 * (2 * x ^^^ 7) + 5 * x ^^^ 2 * 3 + (6 * x ^^^ 7 + 9) + (-1 * (3 * x ^^^ 5 * (6 * x ^^^ 4)) + -1 * (3 * x ^^^ 5 * -1) +
153 ###### rls: e_rls-is_multUnordered on: p is_multUnordered
154 ####### try calc: Poly.is'_multUnordered'
155 ======= calc. to: False !!!!!!!!!!!!! INSTEAD OF TRUE in 2002 !!!!!!!!!!!!!
157 val t = str2term "5 * x ^^^ 2 * (2 * x ^^^ 7) + 5 * x ^^^ 2 * 3 + (6 * x ^^^ 7 + 9) + (-1 * (3 * x ^^^ 5 * (6 * x ^^^ 4)) + -1 * (3 * x ^^^ 5 * -1) + (-48 * x ^^^ 4 + 8))";
159 "----- is_multUnordered ---";
160 val tsort = sort_variables t;
161 term2str tsort = "2 * (5 * (x ^^^ 2 * x ^^^ 7)) + 3 * (5 * x ^^^ 2) + 6 * x ^^^ 7 + 9 +\n-1 * (3 * (6 * (x ^^^ 4 * x ^^^ 5))) +\n-1 * (-1 * (3 * x ^^^ 5)) +\n-48 * x ^^^ 4 +\n8";
164 is_polyexp t andalso not (t = sort_variables t);
165 if is_multUnordered t then () else error "poly.sml diff. is_multUnordered 1";
167 "----- eval_is_multUnordered ---";
168 val tm = str2term "(5 * x ^^^ 2 * (2 * x ^^^ 7) + 5 * x ^^^ 2 * 3 + (6 * x ^^^ 7 + 9) + (-1 * (3 * x ^^^ 5 * (6 * x ^^^ 4)) + -1 * (3 * x ^^^ 5 * -1) + (-48 * x ^^^ 4 + 8))) is_multUnordered";
169 case eval_is_multUnordered "testid" "" tm thy of
170 SOME (_, Const ("HOL.Trueprop", _) $
171 (Const ("HOL.eq", _) $
172 (Const ("Poly.is'_multUnordered", _) $ _) $
173 Const ("HOL.True", _))) => ()
174 | _ => error "poly.sml diff. eval_is_multUnordered";
176 "----- rewrite_set_ STILL DIDN'T WORK";
177 val SOME (t, _) = rewrite_set_ thy true order_mult_ t;
180 "-------- examples from textbook Schalk I ---------------";
181 "-------- examples from textbook Schalk I ---------------";
182 "-------- examples from textbook Schalk I ---------------";
183 "-----SPB Schalk I p.63 No.267b ---";
184 val t = str2term "(5*x^^^2 + 3) * (2*x^^^7 + 3) - (3*x^^^5 + 8) * (6*x^^^4 - 1)";
185 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
186 if (term2str t) = "17 + 15 * x ^^^ 2 + -48 * x ^^^ 4 + 3 * x ^^^ 5 + 6 * x ^^^ 7 + -8 * x ^^^ 9"
187 then () else error "poly.sml: diff.behav. in make_polynomial 1";
189 "-----SPB Schalk I p.63 No.275b ---";
190 val t = str2term "(3*x^^^2 - 2*x*y + y^^^2) * (x^^^2 - 2*y^^^2)";
191 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
192 if (term2str t) = ("3 * x ^^^ 4 + -2 * x ^^^ 3 * y + -5 * x ^^^ 2 * y ^^^ 2 + " ^
193 "4 * x * y ^^^ 3 +\n-2 * y ^^^ 4")
194 then () else error "poly.sml: diff.behav. in make_polynomial 2";
196 "-----SPB Schalk I p.63 No.279b ---";
197 val t = str2term "(x-a)*(x-b)*(x-c)*(x-d)";
198 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
200 ("a * b * c * d + -1 * a * b * c * x + -1 * a * b * d * x + a * b * x ^^^ 2 +\n" ^
201 "-1 * a * c * d * x +\na * c * x ^^^ 2 +\na * d * x ^^^ 2 +\n-1 * a * x ^^^ 3 +\n" ^
202 "-1 * b * c * d * x +\nb * c * x ^^^ 2 +\nb * d * x ^^^ 2 +\n-1 * b * x ^^^ 3 +\n" ^
203 "c * d * x ^^^ 2 +\n-1 * c * x ^^^ 3 +\n-1 * d * x ^^^ 3 +\nx ^^^ 4")
204 then () else error "poly.sml: diff.behav. in make_polynomial 3";
206 "-----SPB Schalk I p.63 No.291 ---";
207 val t = str2term "(5+96*x^^^3+8*x*(-4+(7- 3*x)*4*x))*(5*(2- 3*x)- (-15*x*(-8*x- 5)))";
208 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
209 if (term2str t) = "50 + -770 * x + 4520 * x ^^^ 2 + -16320 * x ^^^ 3 + -26880 * x ^^^ 4"
210 then () else error "poly.sml: diff.behav. in make_polynomial 4";
212 "-----SPB Schalk I p.64 No.295c ---";
213 val t = str2term "(13*a^^^4*b^^^9*c - 12*a^^^3*b^^^6*c^^^9)^^^2";
214 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
215 if (term2str t) = ("169 * a ^^^ 8 * b ^^^ 18 * c ^^^ 2 + -312 * a ^^^ 7 * b ^^^ 15 * c ^^^ 10" ^
216 " +\n144 * a ^^^ 6 * b ^^^ 12 * c ^^^ 18")
217 then ()else error "poly.sml: diff.behav. in make_polynomial 5";
219 "-----SPB Schalk I p.64 No.299a ---";
220 val t = str2term "(x - y)*(x + y)";
221 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
222 if (term2str t) = "x ^^^ 2 + -1 * y ^^^ 2"
223 then () else error "poly.sml: diff.behav. in make_polynomial 6";
225 "-----SPB Schalk I p.64 No.300c ---";
226 val t = str2term "(3*x^^^2*y - 1)*(3*x^^^2*y + 1)";
227 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
228 if (term2str t) = "-1 + 9 * x ^^^ 4 * y ^^^ 2"
229 then () else error "poly.sml: diff.behav. in make_polynomial 7";
231 "-----SPB Schalk I p.64 No.302 ---";
233 "(13*x^^^2 + 5)*(13*x^^^2 - 5) - (5*x^^^2 + 3)*(5*x^^^2 - 3) - (12*x^^^2 + 4)*(12*x^^^2 - 4)";
234 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
236 then () else error "poly.sml: diff.behav. in make_polynomial 8";
237 (* RL?MG?: Bei Berechnung sollte 3 mal real_plus_minus_binom1_p aus expand_poly verwendet werden *)
239 "-----SPB Schalk I p.64 No.306a ---";
240 val t = str2term "((x^^^2 + 1)*(x^^^2 - 1))^^^2";
241 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
242 if (term2str t) = "1 + 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 + x ^^^ 8" then ()
243 else error "poly.sml: diff.behav. in 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 = -2 * x ^^^ 4";
245 (*WN071729 when reducing "rls reduce_012_" for Schaerding,
246 the above resulted in the term below ... but reduces from then correctly*)
247 val t = str2term "1 + 2 * x ^^^ 4 + 2 * -2 * x ^^^ 4 + x ^^^ 8";
248 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
249 if (term2str t) = "1 + -2 * x ^^^ 4 + x ^^^ 8"
250 then () else error "poly.sml: diff.behav. in make_polynomial 9b";
252 "-----SPB Schalk I p.64 No.296a ---";
253 val t = str2term "(x - a)^^^3";
254 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
255 if (term2str t) = "-1 * a ^^^ 3 + 3 * a ^^^ 2 * x + -3 * a * x ^^^ 2 + x ^^^ 3"
256 then () else error "poly.sml: diff.behav. in make_polynomial 10";
258 "-----SPB Schalk I p.64 No.296c ---";
259 val t = str2term "(-3*x - 4*y)^^^3";
260 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
261 if (term2str t) = "-27 * x ^^^ 3 + -108 * x ^^^ 2 * y + -144 * x * y ^^^ 2 + -64 * y ^^^ 3"
262 then () else error "poly.sml: diff.behav. in make_polynomial 11";
264 "-----SPB Schalk I p.62 No.242c ---";
265 val t = str2term "x^^^(-4)*(x^^^(-4)*y^^^(-2))^^^(-1)*y^^^(-2)";
266 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
267 if (term2str t) = "1"
268 then () else error "poly.sml: diff.behav. in make_polynomial 12";
270 "-----SPB Schalk I p.60 No.209a ---";
271 val t = str2term "a^^^(7-x) * a^^^x";
272 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
273 if term2str t = "a ^^^ 7"
274 then () else error "poly.sml: diff.behav. in make_polynomial 13";
276 "-----SPB Schalk I p.60 No.209d ---";
277 val t = str2term "d^^^x * d^^^(x+1) * d^^^(2 - 2*x)";
278 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
279 if term2str t = "d ^^^ 3"
280 then () else error "poly.sml: diff.behav. in make_polynomial 14";
282 (*---------------------------------------------------------------------*)
283 (*---------------- ?RL?Bsple bei denen es Probleme gibt----------------*)
284 (*---------------------------------------------------------------------*)
285 "-----Schalk I p.64 No.303 ---";
286 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)";
287 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
288 if term2str t = "1280 * b ^^^ 4"
289 then () else error "poly.sml: diff.behav. in make_polynomial 14b";
290 (* Richtig - aber Binomische Formel wurde nicht verwendet! *)
292 (*--------------------------------------------------------------------*)
293 (*----------------------- Eigene Beispiele ---------------------------*)
294 (*--------------------------------------------------------------------*)
296 val t = str2term "a^^^2*a^^^(-2)";
297 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
298 if term2str t = "1" then ()
299 else error "poly.sml: diff.behav. in make_polynomial 15";
301 val t = str2term "a + a + a";
302 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
303 if term2str t = "3 * a" then ()
304 else error "poly.sml: diff.behav. in make_polynomial 16";
306 val t = str2term "a + b + b + b";
307 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
308 if term2str t = "a + 3 * b" then ()
309 else error "poly.sml: diff.behav. in make_polynomial 17";
311 val t = str2term "a^^^2*b*b^^^(-1)";
312 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
313 if term2str t = "a ^^^ 2" then ()
314 else error "poly.sml: diff.behav. in make_polynomial 18";
316 val t = str2term "a^^^2*a^^^(-2)";
317 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
318 if (term2str t) = "1" then ()
319 else error "poly.sml: diff.behav. in make_polynomial 19";
321 val t = str2term "b + a - b";
322 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
323 if (term2str t) = "a" then ()
324 else error "poly.sml: diff.behav. in make_polynomial 20";
326 val t = str2term "b * a * a";
327 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
328 if term2str t = "a ^^^ 2 * b" then ()
329 else error "poly.sml: diff.behav. in make_polynomial 21";
331 val t = str2term "(a^^^2)^^^3";
332 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
333 if term2str t = "a ^^^ 6" then ()
334 else error "poly.sml: diff.behav. in make_polynomial 22";
336 val t = str2term "x^^^2 * y^^^2 + x * x^^^2 * y";
337 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
338 if term2str t = "x ^^^ 3 * y + x ^^^ 2 * y ^^^ 2" then ()
339 else error "poly.sml: diff.behav. in make_polynomial 23";
341 val t = (Thm.term_of o the o (parse thy)) "a^^^2 * (-a)^^^2";
342 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
343 if (term2str t) = "a ^^^ 4" then ()
344 else error "poly.sml: diff.behav. in make_polynomial 24";
346 val t = str2term "a * b * b^^^(-1) + a";
347 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
348 if (term2str t) = "2 * a" then ()
349 else error "poly.sml: diff.behav. in make_polynomial 25";
351 val t = str2term "a*c*b^^^(2*n) + 3*a + 5*b^^^(2*n)*c*b";
352 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; term2str t;
353 if (term2str t) = "3 * a + 5 * b ^^^ (1 + 2 * n) * c + a * b ^^^ (2 * n) * c"
354 then () else error "poly.sml: diff.behav. in make_polynomial 26";
356 (*MG030627 -------------vvv-: Verschachtelte Terme -----------*)
358 val t = str2term "(1 + (x*y*a) + x)^^^(1 + (x*y*a) + x)";
359 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
360 if term2str t = "(1 + x + a * x * y) ^^^ (1 + x + a * x * y)"
361 then () else error "poly.sml: diff.behav. in make_polynomial 27";(*SPO*)
363 val t = str2term "(1 + x*(y*z)*zz)^^^(1 + x*(y*z)*zz)";
364 val SOME (t,_) = rewrite_set_ thy false make_polynomial t;
365 if term2str t = "(1 + x * y * z * zz) ^^^ (1 + x * y * z * zz)"
366 then () else error "poly.sml: diff.behav. in make_polynomial 28";
368 "-------- check pbl 'polynomial simplification' --------";
369 "-------- check pbl 'polynomial simplification' --------";
370 "-------- check pbl 'polynomial simplification' --------";
371 val fmz = ["Term ((5*x^^^2 + 3) * (2*x^^^7 + 3) - (3*x^^^5 + 8) * (6*x^^^4 - 1))", "normalform N"];
373 case refine fmz ["polynomial","simplification"]of
374 [Matches (["polynomial", "simplification"], _)] => ()
375 | _ => error "poly.sml diff.behav. in check pbl, refine";
376 (*...if there is an error, then ...*)
379 default_print_depth 7;
380 val pbt = get_pbt ["polynomial","simplification"];
381 default_print_depth 3;
383 > val NoMatch' {Given=gi, Where=wh, Find=fi,...} = match_pbl fmz pbt;
384 ... then trace_rewrite:*)
387 trace_rewrite := false;
389 trace_rewrite := false;
390 (*... if there is no rewrite, then there is something wrong with prls*)
393 default_print_depth 7;
394 val prls = (#prls o get_pbt) ["polynomial","simplification"];
395 default_print_depth 3;
396 val t = str2term "((5*x^^^2 + 3) * (2*x^^^7 + 3) - (3*x^^^5 + 8) * (6*x^^^4 - 1)) is_polyexp";
397 val SOME (t',_) = rewrite_set_ thy false prls t;
398 if t' = @{term True} then ()
399 else error "poly.sml: diff.behav. in check pbl 'polynomial..";
400 (*... if this works, but --1-- does still NOT work, check types:*)
403 (*show_types:=true;*)
405 > val NoMatch' {Given=gi, Where=wh, Find=fi,...} = match_pbl fmz pbt;
406 val wh = [False "(t_::real => real) (is_polyexp::real)"]
407 ......................^^^^^^^^^^^^...............^^^^*)
408 val Matches' _ = match_pbl fmz pbt;
409 (*show_types:=false;*)
411 "-------- me 'poly. simpl.' Schalk I p.63 No.267b -------";
412 "-------- me 'poly. simpl.' Schalk I p.63 No.267b -------";
413 "-------- me 'poly. simpl.' Schalk I p.63 No.267b -------";
414 val fmz = ["Term ((5*x^^^2 + 3) * (2*x^^^7 + 3) - (3*x^^^5 + 8) * (6*x^^^4 - 1))", "normalform N"];
416 ("Poly",["polynomial","simplification"],
417 ["simplification","for_polynomials"]);
418 val p = e_pos'; val c = [];
419 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
420 val (p,_,f,nxt,_,pt) = me nxt p c pt;
421 val (p,_,f,nxt,_,pt) = me nxt p c pt;
422 (writeln o (itms2str_ ctxt)) (get_obj g_pbl pt (fst p));
423 val (p,_,f,nxt,_,pt) = me nxt p c pt;
424 val (p,_,f,nxt,_,pt) = me nxt p c pt;
425 val (p,_,f,nxt,_,pt) = me nxt p c pt;
426 val (p,_,f,nxt,_,pt) = me nxt p c pt;
427 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
428 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
429 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
430 if f2str f = "17 + 15 * x ^^^ 2 + -48 * x ^^^ 4 + 3 * x ^^^ 5 + 6 * x ^^^ 7 + -8 * x ^^^ 9"
431 then () else error "poly.sml diff.behav. in me Schalk I p.63 No.267b";
433 "-------- interSteps for Schalk 299a --------------------";
434 "-------- interSteps for Schalk 299a --------------------";
435 "-------- interSteps for Schalk 299a --------------------";
438 [(["Term ((x - y)*(x + (y::real)))", "normalform N"],
439 ("Poly",["polynomial","simplification"],
440 ["simplification","for_polynomials"]))];
443 autoCalculate 1 CompleteCalc;
444 val ((pt,p),_) = get_calc 1; show_pt pt;
446 interSteps 1 ([1],Res)(*<ERROR> syserror in detailstep </ERROR>*);
447 val ((pt,p),_) = get_calc 1; show_pt pt;
448 if existpt' ([1,1], Frm) pt then ()
449 else error "poly.sml: interSteps doesnt work again 1";
451 interSteps 1 ([1,1],Res)(*<ERROR> syserror in detailstep </ERROR>*);
452 val ((pt,p),_) = get_calc 1; show_pt pt;
453 (*============ inhibit exn WN120316 ==============================================
454 if existpt' ([1,1,1], Frm) pt then ()
455 else error "poly.sml: interSteps doesnt work again 2";
456 ============ inhibit exn WN120316 ==============================================*)
458 "-------- norm_Poly NOT COMPLETE ------------------------";
459 "-------- norm_Poly NOT COMPLETE ------------------------";
460 "-------- norm_Poly NOT COMPLETE ------------------------";
461 val SOME (f',_) = rewrite_set_ thy false norm_Poly
462 (str2term "L = k - 2 * q + (k - 2 * q) + (k - 2 * q) + (k - 2 * q) + senkrecht + oben");
463 if term2str f' = "L = 2 * 2 * k + oben + 2 * -4 * q + senkrecht"
464 then ((*norm_Poly NOT COMPLETE -- TODO MG*))
465 else error "norm_Poly changed behavior";
467 "-------- ord_make_polynomial ---------------------------";
468 "-------- ord_make_polynomial ---------------------------";
469 "-------- ord_make_polynomial ---------------------------";
470 val t1 = str2term "2 * b + (3 * a + 3 * b)";
471 val t2 = str2term "3 * a + 3 * b + 2 * b";
473 if ord_make_polynomial true thy [] (t1, t2) then ()
474 else error "poly.sml: diff.behav. in ord_make_polynomial";
476 (*WN071202: ^^^ why then is there no rewriting ...*)
477 val term = str2term "2*b + (3*a + 3*b)";
478 val NONE = rewrite_set_ (@{theory "Isac"}) false order_add_mult term;
480 (*or why is there no rewriting this way...*)
481 val t1 = str2term "2 * b + (3 * a + 3 * b)";
482 val t2 = str2term "3 * a + (2 * b + 3 * b)";