418 |
418 |
419 "-------- examples from textbook Schalk I ------------------------------------------------------"; |
419 "-------- examples from textbook Schalk I ------------------------------------------------------"; |
420 "-------- examples from textbook Schalk I ------------------------------------------------------"; |
420 "-------- examples from textbook Schalk I ------------------------------------------------------"; |
421 "-------- examples from textbook Schalk I ------------------------------------------------------"; |
421 "-------- examples from textbook Schalk I ------------------------------------------------------"; |
422 "-----SPB Schalk I p.63 No.267b ---"; |
422 "-----SPB Schalk I p.63 No.267b ---"; |
423 val t = TermC.str2term "(5*x \<up> 2 + 3) * (2*x \<up> 7 + 3) - (3*x \<up> 5 + 8) * (6*x \<up> 4 - 1)"; |
423 val t = TermC.parse_test @{context} "(5*x \<up> 2 + 3) * (2*x \<up> 7 + 3) - (3*x \<up> 5 + 8) * (6*x \<up> 4 - 1)"; |
424 val SOME (t, _) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
424 val SOME (t, _) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
425 if UnparseC.term t = "17 + 15 * x \<up> 2 + - 48 * x \<up> 4 + 3 * x \<up> 5 + 6 * x \<up> 7 +\n- 8 * x \<up> 9" |
425 if UnparseC.term t = "17 + 15 * x \<up> 2 + - 48 * x \<up> 4 + 3 * x \<up> 5 + 6 * x \<up> 7 +\n- 8 * x \<up> 9" |
426 then () else error "poly.sml: diff.behav. in make_polynomial 1"; |
426 then () else error "poly.sml: diff.behav. in make_polynomial 1"; |
427 |
427 |
428 "-----SPB Schalk I p.63 No.275b ---"; |
428 "-----SPB Schalk I p.63 No.275b ---"; |
429 val t = TermC.str2term "(3*x \<up> 2 - 2*x*y + y \<up> 2) * (x \<up> 2 - 2*y \<up> 2)"; |
429 val t = TermC.parse_test @{context} "(3*x \<up> 2 - 2*x*y + y \<up> 2) * (x \<up> 2 - 2*y \<up> 2)"; |
430 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
430 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
431 if UnparseC.term t = |
431 if UnparseC.term t = |
432 "3 * x \<up> 4 + - 2 * x \<up> 3 * y + - 5 * x \<up> 2 * y \<up> 2 +\n4 * x * y \<up> 3 +\n- 2 * y \<up> 4" |
432 "3 * x \<up> 4 + - 2 * x \<up> 3 * y + - 5 * x \<up> 2 * y \<up> 2 +\n4 * x * y \<up> 3 +\n- 2 * y \<up> 4" |
433 then () else error "poly.sml: diff.behav. in make_polynomial 2"; |
433 then () else error "poly.sml: diff.behav. in make_polynomial 2"; |
434 |
434 |
435 "-----SPB Schalk I p.63 No.279b ---"; |
435 "-----SPB Schalk I p.63 No.279b ---"; |
436 val t = TermC.str2term "(x-a)*(x-b)*(x-c)*(x-d)"; |
436 val t = TermC.parse_test @{context} "(x-a)*(x-b)*(x-c)*(x-d)"; |
437 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
437 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
438 if UnparseC.term t = |
438 if UnparseC.term t = |
439 ("a * b * c * d + - 1 * a * b * c * x + - 1 * a * b * d * x +\na * b * x \<up> 2 +\n" ^ |
439 ("a * b * c * d + - 1 * a * b * c * x + - 1 * a * b * d * x +\na * b * x \<up> 2 +\n" ^ |
440 "- 1 * a * c * d * x +\na * c * x \<up> 2 +\na * d * x \<up> 2 +\n- 1 * a * x \<up> 3 +\n" ^ |
440 "- 1 * a * c * d * x +\na * c * x \<up> 2 +\na * d * x \<up> 2 +\n- 1 * a * x \<up> 3 +\n" ^ |
441 "- 1 * b * c * d * x +\nb * c * x \<up> 2 +\nb * d * x \<up> 2 +\n- 1 * b * x \<up> 3 +\nc" ^ |
441 "- 1 * b * c * d * x +\nb * c * x \<up> 2 +\nb * d * x \<up> 2 +\n- 1 * b * x \<up> 3 +\nc" ^ |
442 " * d * x \<up> 2 +\n- 1 * c * x \<up> 3 +\n- 1 * d * x \<up> 3 +\nx \<up> 4") |
442 " * d * x \<up> 2 +\n- 1 * c * x \<up> 3 +\n- 1 * d * x \<up> 3 +\nx \<up> 4") |
443 then () else error "poly.sml: diff.behav. in make_polynomial 3"; |
443 then () else error "poly.sml: diff.behav. in make_polynomial 3"; |
444 (*associate poly*) |
444 (*associate poly*) |
445 |
445 |
446 "-----SPB Schalk I p.63 No.291 ---"; |
446 "-----SPB Schalk I p.63 No.291 ---"; |
447 val t = TermC.str2term "(5+96*x \<up> 3+8*x*(-4+(7- 3*x)*4*x))*(5*(2- 3*x)- (- 15*x*(-8*x- 5)))"; |
447 val t = TermC.parse_test @{context} "(5+96*x \<up> 3+8*x*(-4+(7- 3*x)*4*x))*(5*(2- 3*x)- (- 15*x*(-8*x- 5)))"; |
448 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
448 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
449 if UnparseC.term t = "50 + - 770 * x + 4520 * x \<up> 2 + - 16320 * x \<up> 3 +\n- 26880 * x \<up> 4" |
449 if UnparseC.term t = "50 + - 770 * x + 4520 * x \<up> 2 + - 16320 * x \<up> 3 +\n- 26880 * x \<up> 4" |
450 then () else error "poly.sml: diff.behav. in make_polynomial 4"; |
450 then () else error "poly.sml: diff.behav. in make_polynomial 4"; |
451 |
451 |
452 "-----SPB Schalk I p.64 No.295c ---"; |
452 "-----SPB Schalk I p.64 No.295c ---"; |
453 val t = TermC.str2term "(13*a \<up> 4*b \<up> 9*c - 12*a \<up> 3*b \<up> 6*c \<up> 9) \<up> 2"; |
453 val t = TermC.parse_test @{context} "(13*a \<up> 4*b \<up> 9*c - 12*a \<up> 3*b \<up> 6*c \<up> 9) \<up> 2"; |
454 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
454 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
455 if UnparseC.term t = |
455 if UnparseC.term t = |
456 "169 * a \<up> 8 * b \<up> 18 * c \<up> 2 +\n- 312 * a \<up> 7 * b \<up> 15 * c \<up> 10 +\n144 * a \<up> 6 * b \<up> 12 * c \<up> 18" |
456 "169 * a \<up> 8 * b \<up> 18 * c \<up> 2 +\n- 312 * a \<up> 7 * b \<up> 15 * c \<up> 10 +\n144 * a \<up> 6 * b \<up> 12 * c \<up> 18" |
457 then ()else error "poly.sml: diff.behav. in make_polynomial 5"; |
457 then ()else error "poly.sml: diff.behav. in make_polynomial 5"; |
458 |
458 |
459 "-----SPB Schalk I p.64 No.299a ---"; |
459 "-----SPB Schalk I p.64 No.299a ---"; |
460 val t = TermC.str2term "(x - y)*(x + y)"; |
460 val t = TermC.parse_test @{context} "(x - y)*(x + y)"; |
461 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
461 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
462 if UnparseC.term t = "x \<up> 2 + - 1 * y \<up> 2" |
462 if UnparseC.term t = "x \<up> 2 + - 1 * y \<up> 2" |
463 then () else error "poly.sml: diff.behav. in make_polynomial 6"; |
463 then () else error "poly.sml: diff.behav. in make_polynomial 6"; |
464 |
464 |
465 "-----SPB Schalk I p.64 No.300c ---"; |
465 "-----SPB Schalk I p.64 No.300c ---"; |
466 val t = TermC.str2term "(3*x \<up> 2*y - 1)*(3*x \<up> 2*y + 1)"; |
466 val t = TermC.parse_test @{context} "(3*x \<up> 2*y - 1)*(3*x \<up> 2*y + 1)"; |
467 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
467 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
468 if UnparseC.term t = "- 1 + 9 * x \<up> 4 * y \<up> 2" |
468 if UnparseC.term t = "- 1 + 9 * x \<up> 4 * y \<up> 2" |
469 then () else error "poly.sml: diff.behav. in make_polynomial 7"; |
469 then () else error "poly.sml: diff.behav. in make_polynomial 7"; |
470 |
470 |
471 "-----SPB Schalk I p.64 No.302 ---"; |
471 "-----SPB Schalk I p.64 No.302 ---"; |
472 val t = TermC.str2term |
472 val t = TermC.parse_test @{context} |
473 "(13*x \<up> 2 + 5)*(13*x \<up> 2 - 5) - (5*x \<up> 2 + 3)*(5*x \<up> 2 - 3) - (12*x \<up> 2 + 4)*(12*x \<up> 2 - 4)"; |
473 "(13*x \<up> 2 + 5)*(13*x \<up> 2 - 5) - (5*x \<up> 2 + 3)*(5*x \<up> 2 - 3) - (12*x \<up> 2 + 4)*(12*x \<up> 2 - 4)"; |
474 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
474 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; |
475 if UnparseC.term t = "0" |
475 if UnparseC.term t = "0" |
476 then () else error "poly.sml: diff.behav. in make_polynomial 8"; |
476 then () else error "poly.sml: diff.behav. in make_polynomial 8"; |
477 (* RL?MG?: Bei Berechnung sollte 3 mal real_plus_minus_binom1_p aus expand_poly verwendet werden *) |
477 (* RL?MG?: Bei Berechnung sollte 3 mal real_plus_minus_binom1_p aus expand_poly verwendet werden *) |
478 |
478 |
479 "-----SPB Schalk I p.64 No.306a ---"; |
479 "-----SPB Schalk I p.64 No.306a ---"; |
480 val t = TermC.str2term "((x \<up> 2 + 1)*(x \<up> 2 - 1)) \<up> 2"; |
480 val t = TermC.parse_test @{context} "((x \<up> 2 + 1)*(x \<up> 2 - 1)) \<up> 2"; |
481 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
481 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
482 if UnparseC.term t = "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8" then () |
482 if UnparseC.term t = "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8" then () |
483 else error "poly.sml: diff.behav. in 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 = - 2 * x \<up> 4"; |
483 else error "poly.sml: diff.behav. in 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 = - 2 * x \<up> 4"; |
484 |
484 |
485 (*WN071729 when reducing "rls reduce_012_" for Schaerding, |
485 (*WN071729 when reducing "rls reduce_012_" for Schaerding, |
486 the above resulted in the term below ... but reduces from then correctly*) |
486 the above resulted in the term below ... but reduces from then correctly*) |
487 val t = TermC.str2term "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8"; |
487 val t = TermC.parse_test @{context} "1 + 2 * x \<up> 4 + 2 * - 2 * x \<up> 4 + x \<up> 8"; |
488 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
488 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
489 if UnparseC.term t = "1 + - 2 * x \<up> 4 + x \<up> 8" |
489 if UnparseC.term t = "1 + - 2 * x \<up> 4 + x \<up> 8" |
490 then () else error "poly.sml: diff.behav. in make_polynomial 9b"; |
490 then () else error "poly.sml: diff.behav. in make_polynomial 9b"; |
491 |
491 |
492 "-----SPB Schalk I p.64 No.296a ---"; |
492 "-----SPB Schalk I p.64 No.296a ---"; |
493 val t = TermC.str2term "(x - a) \<up> 3"; |
493 val t = TermC.parse_test @{context} "(x - a) \<up> 3"; |
494 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
494 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
495 |
495 |
496 val NONE = eval_is_even "aaa" "bbb" (TermC.str2term "3::real") "ccc"; |
496 val NONE = eval_is_even "aaa" "bbb" (TermC.parse_test @{context} "3::real") "ccc"; |
497 |
497 |
498 if UnparseC.term t = "- 1 * a \<up> 3 + 3 * a \<up> 2 * x + - 3 * a * x \<up> 2 + x \<up> 3" |
498 if UnparseC.term t = "- 1 * a \<up> 3 + 3 * a \<up> 2 * x + - 3 * a * x \<up> 2 + x \<up> 3" |
499 then () else error "poly.sml: diff.behav. in make_polynomial 10"; |
499 then () else error "poly.sml: diff.behav. in make_polynomial 10"; |
500 |
500 |
501 "-----SPB Schalk I p.64 No.296c ---"; |
501 "-----SPB Schalk I p.64 No.296c ---"; |
502 val t = TermC.str2term "(-3*x - 4*y) \<up> 3"; |
502 val t = TermC.parse_test @{context} "(-3*x - 4*y) \<up> 3"; |
503 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
503 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
504 if UnparseC.term t = "- 27 * x \<up> 3 + - 108 * x \<up> 2 * y + - 144 * x * y \<up> 2 +\n- 64 * y \<up> 3" |
504 if UnparseC.term t = "- 27 * x \<up> 3 + - 108 * x \<up> 2 * y + - 144 * x * y \<up> 2 +\n- 64 * y \<up> 3" |
505 then () else error "poly.sml: diff.behav. in make_polynomial 11"; |
505 then () else error "poly.sml: diff.behav. in make_polynomial 11"; |
506 |
506 |
507 "-----SPB Schalk I p.62 No.242c ---"; |
507 "-----SPB Schalk I p.62 No.242c ---"; |
508 val t = TermC.str2term "x \<up> (-4)*(x \<up> (-4)*y \<up> (- 2)) \<up> (- 1)*y \<up> (- 2)"; |
508 val t = TermC.parse_test @{context} "x \<up> (-4)*(x \<up> (-4)*y \<up> (- 2)) \<up> (- 1)*y \<up> (- 2)"; |
509 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
509 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
510 if UnparseC.term t = "1" |
510 if UnparseC.term t = "1" |
511 then () else error "poly.sml: diff.behav. in make_polynomial 12"; |
511 then () else error "poly.sml: diff.behav. in make_polynomial 12"; |
512 |
512 |
513 "-----SPB Schalk I p.60 No.209a ---"; |
513 "-----SPB Schalk I p.60 No.209a ---"; |
514 val t = TermC.str2term "a \<up> (7-x) * a \<up> x"; |
514 val t = TermC.parse_test @{context} "a \<up> (7-x) * a \<up> x"; |
515 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
515 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
516 if UnparseC.term t = "a \<up> 7" |
516 if UnparseC.term t = "a \<up> 7" |
517 then () else error "poly.sml: diff.behav. in make_polynomial 13"; |
517 then () else error "poly.sml: diff.behav. in make_polynomial 13"; |
518 |
518 |
519 "-----SPB Schalk I p.60 No.209d ---"; |
519 "-----SPB Schalk I p.60 No.209d ---"; |
520 val t = TermC.str2term "d \<up> x * d \<up> (x+1) * d \<up> (2 - 2*x)"; |
520 val t = TermC.parse_test @{context} "d \<up> x * d \<up> (x+1) * d \<up> (2 - 2*x)"; |
521 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
521 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
522 if UnparseC.term t = "d \<up> 3" |
522 if UnparseC.term t = "d \<up> 3" |
523 then () else error "poly.sml: diff.behav. in make_polynomial 14"; |
523 then () else error "poly.sml: diff.behav. in make_polynomial 14"; |
524 |
524 |
525 "-------- ?RL?Bsple bei denen es Probleme gibt--------------------------------------------------"; |
525 "-------- ?RL?Bsple bei denen es Probleme gibt--------------------------------------------------"; |
526 "-------- ?RL?Bsple bei denen es Probleme gibt--------------------------------------------------"; |
526 "-------- ?RL?Bsple bei denen es Probleme gibt--------------------------------------------------"; |
527 "-------- ?RL?Bsple bei denen es Probleme gibt--------------------------------------------------"; |
527 "-------- ?RL?Bsple bei denen es Probleme gibt--------------------------------------------------"; |
528 "-----Schalk I p.64 No.303 ---"; |
528 "-----Schalk I p.64 No.303 ---"; |
529 val t = TermC.str2term "(a + 2*b)*(a \<up> 2 + 4*b \<up> 2)*(a - 2*b) - (a - 6*b)*(a \<up> 2 + 36*b \<up> 2)*(a + 6*b)"; |
529 val t = TermC.parse_test @{context} "(a + 2*b)*(a \<up> 2 + 4*b \<up> 2)*(a - 2*b) - (a - 6*b)*(a \<up> 2 + 36*b \<up> 2)*(a + 6*b)"; |
530 (*SOMETIMES LOOPS---------------------------------------------------------------------------\\*) |
530 (*SOMETIMES LOOPS---------------------------------------------------------------------------\\*) |
531 val SOME (t, _) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
531 val SOME (t, _) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
532 if UnparseC.term t = "1280 * b \<up> 4" |
532 if UnparseC.term t = "1280 * b \<up> 4" |
533 then () else error "poly.sml: diff.behav. in make_polynomial 14b"; |
533 then () else error "poly.sml: diff.behav. in make_polynomial 14b"; |
534 (* Richtig - aber Binomische Formel wurde nicht verwendet! *) |
534 (* Richtig - aber Binomische Formel wurde nicht verwendet! *) |
536 |
536 |
537 "-------- Eigene Beispiele (Mathias Goldgruber) ------------------------------------------------"; |
537 "-------- Eigene Beispiele (Mathias Goldgruber) ------------------------------------------------"; |
538 "-------- Eigene Beispiele (Mathias Goldgruber) ------------------------------------------------"; |
538 "-------- Eigene Beispiele (Mathias Goldgruber) ------------------------------------------------"; |
539 "-------- Eigene Beispiele (Mathias Goldgruber) ------------------------------------------------"; |
539 "-------- Eigene Beispiele (Mathias Goldgruber) ------------------------------------------------"; |
540 "-----SPO ---"; |
540 "-----SPO ---"; |
541 val t = TermC.str2term "a + a + a"; |
541 val t = TermC.parse_test @{context} "a + a + a"; |
542 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
542 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
543 if UnparseC.term t = "3 * a" then () |
543 if UnparseC.term t = "3 * a" then () |
544 else error "poly.sml: diff.behav. in make_polynomial 16"; |
544 else error "poly.sml: diff.behav. in make_polynomial 16"; |
545 "-----SPO ---"; |
545 "-----SPO ---"; |
546 val t = TermC.str2term "a + b + b + b"; |
546 val t = TermC.parse_test @{context} "a + b + b + b"; |
547 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
547 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
548 if UnparseC.term t = "a + 3 * b" then () |
548 if UnparseC.term t = "a + 3 * b" then () |
549 else error "poly.sml: diff.behav. in make_polynomial 17"; |
549 else error "poly.sml: diff.behav. in make_polynomial 17"; |
550 "-----SPO ---"; |
550 "-----SPO ---"; |
551 val t = TermC.str2term "b * a * a"; |
551 val t = TermC.parse_test @{context} "b * a * a"; |
552 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
552 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
553 if UnparseC.term t = "a \<up> 2 * b" then () |
553 if UnparseC.term t = "a \<up> 2 * b" then () |
554 else error "poly.sml: diff.behav. in make_polynomial 21"; |
554 else error "poly.sml: diff.behav. in make_polynomial 21"; |
555 "-----SPO ---"; |
555 "-----SPO ---"; |
556 val t = TermC.str2term "(a \<up> 2) \<up> 3"; |
556 val t = TermC.parse_test @{context} "(a \<up> 2) \<up> 3"; |
557 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
557 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
558 if UnparseC.term t = "a \<up> 6" then () |
558 if UnparseC.term t = "a \<up> 6" then () |
559 else error "poly.sml: diff.behav. in make_polynomial 22"; |
559 else error "poly.sml: diff.behav. in make_polynomial 22"; |
560 "-----SPO ---"; |
560 "-----SPO ---"; |
561 val t = TermC.str2term "x \<up> 2 * y \<up> 2 + x * x \<up> 2 * y"; |
561 val t = TermC.parse_test @{context} "x \<up> 2 * y \<up> 2 + x * x \<up> 2 * y"; |
562 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
562 val SOME (t,_) = rewrite_set_ thy false make_polynomial t; UnparseC.term t; |
563 if UnparseC.term t = "x \<up> 3 * y + x \<up> 2 * y \<up> 2" then () |
563 if UnparseC.term t = "x \<up> 3 * y + x \<up> 2 * y \<up> 2" then () |
564 else error "poly.sml: diff.behav. in make_polynomial 23"; |
564 else error "poly.sml: diff.behav. in make_polynomial 23"; |
565 "-----SPO ---"; |
565 "-----SPO ---"; |
566 val t = TermC.str2term "a * b * b \<up> (- 1) + a"; |
566 val t = TermC.parse_test @{context} "a * b * b \<up> (- 1) + a"; |
567 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; UnparseC.term t; |
567 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; UnparseC.term t; |
568 if UnparseC.term t = "2 * a" then () |
568 if UnparseC.term t = "2 * a" then () |
569 else error "poly.sml: diff.behav. in make_polynomial 25"; |
569 else error "poly.sml: diff.behav. in make_polynomial 25"; |
570 "-----SPO ---"; |
570 "-----SPO ---"; |
571 val t = TermC.str2term "a*c*b \<up> (2*n) + 3*a + 5*b \<up> (2*n)*c*b"; |
571 val t = TermC.parse_test @{context} "a*c*b \<up> (2*n) + 3*a + 5*b \<up> (2*n)*c*b"; |
572 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; UnparseC.term t; |
572 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; UnparseC.term t; |
573 if UnparseC.term t = "3 * a + 5 * b \<up> (1 + 2 * n) * c + a * b \<up> (2 * n) * c" |
573 if UnparseC.term t = "3 * a + 5 * b \<up> (1 + 2 * n) * c + a * b \<up> (2 * n) * c" |
574 then () else error "poly.sml: diff.behav. in make_polynomial 26"; |
574 then () else error "poly.sml: diff.behav. in make_polynomial 26"; |
575 |
575 |
576 (*MG030627 -------------vvv-: Verschachtelte Terme -----------*) |
576 (*MG030627 -------------vvv-: Verschachtelte Terme -----------*) |
577 "-----SPO ---"; |
577 "-----SPO ---"; |
578 val t = TermC.str2term "(1 + (x*y*a) + x) \<up> (1 + (x*y*a) + x)"; |
578 val t = TermC.parse_test @{context} "(1 + (x*y*a) + x) \<up> (1 + (x*y*a) + x)"; |
579 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; |
579 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; |
580 if UnparseC.term t = "(1 + x + a * x * y) \<up> (1 + x + a * x * y)" |
580 if UnparseC.term t = "(1 + x + a * x * y) \<up> (1 + x + a * x * y)" |
581 then () else error "poly.sml: diff.behav. in make_polynomial 27";(*SPO*) |
581 then () else error "poly.sml: diff.behav. in make_polynomial 27";(*SPO*) |
582 |
582 |
583 val t = TermC.str2term "(1 + x*(y*z)*zz) \<up> (1 + x*(y*z)*zz)"; |
583 val t = TermC.parse_test @{context} "(1 + x*(y*z)*zz) \<up> (1 + x*(y*z)*zz)"; |
584 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; |
584 val SOME (t,_) = rewrite_set_ @{context} false make_polynomial t; |
585 if UnparseC.term t = "(1 + x * y * z * zz) \<up> (1 + x * y * z * zz)" |
585 if UnparseC.term t = "(1 + x * y * z * zz) \<up> (1 + x * y * z * zz)" |
586 then () else error "poly.sml: diff.behav. in make_polynomial 28"; |
586 then () else error "poly.sml: diff.behav. in make_polynomial 28"; |
587 |
587 |
588 "-------- check pbl 'polynomial simplification' -----------------------------------------------"; |
588 "-------- check pbl 'polynomial simplification' -----------------------------------------------"; |