test/Tools/isac/Knowledge/polyeq-1.sml
changeset 60230 0ca0f9363ad3
parent 59997 46fe5a8c3911
child 60237 e534316f9e07
equal deleted inserted replaced
60228:762098243261 60230:0ca0f9363ad3
    50 "----------- tests on predicates in problems ---------------------";
    50 "----------- tests on predicates in problems ---------------------";
    51 "----------- tests on predicates in problems ---------------------";
    51 "----------- tests on predicates in problems ---------------------";
    52 (* Rewrite.trace_on:=true;
    52 (* Rewrite.trace_on:=true;
    53  Rewrite.trace_on:=false;
    53  Rewrite.trace_on:=false;
    54 *)
    54 *)
    55  val t1 = (Thm.term_of o the o (parse thy)) "lhs (-8 - 2*x + x^^^2 = 0)";
    55  val t1 = (Thm.term_of o the o (TermC.parse thy)) "lhs (-8 - 2*x + x^^^2 = 0)";
    56  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t1;
    56  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t1;
    57  if ((UnparseC.term t) = "-8 - 2 * x + x ^^^ 2") then ()
    57  if ((UnparseC.term t) = "-8 - 2 * x + x ^^^ 2") then ()
    58  else  error "polyeq.sml: diff.behav. in lhs";
    58  else  error "polyeq.sml: diff.behav. in lhs";
    59 
    59 
    60  val t2 = (Thm.term_of o the o (parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x";
    60  val t2 = (Thm.term_of o the o (TermC.parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x";
    61  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t2;
    61  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t2;
    62  if (UnparseC.term t) = "True" then ()
    62  if (UnparseC.term t) = "True" then ()
    63  else  error "polyeq.sml: diff.behav. 1 in is_expended_in";
    63  else  error "polyeq.sml: diff.behav. 1 in is_expended_in";
    64 
    64 
    65  val t0 = (Thm.term_of o the o (parse thy)) "(sqrt(x)) is_poly_in x";
    65  val t0 = (Thm.term_of o the o (TermC.parse thy)) "(sqrt(x)) is_poly_in x";
    66  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t0;
    66  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t0;
    67  if (UnparseC.term t) = "False" then ()
    67  if (UnparseC.term t) = "False" then ()
    68  else  error "polyeq.sml: diff.behav. 2 in is_poly_in";
    68  else  error "polyeq.sml: diff.behav. 2 in is_poly_in";
    69 
    69 
    70  val t3 = (Thm.term_of o the o (parse thy)) "(-8 + (-1)*2*x + x^^^2) is_poly_in x";
    70  val t3 = (Thm.term_of o the o (TermC.parse thy)) "(-8 + (-1)*2*x + x^^^2) is_poly_in x";
    71  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
    71  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
    72  if (UnparseC.term t) = "True" then ()
    72  if (UnparseC.term t) = "True" then ()
    73  else  error "polyeq.sml: diff.behav. 3 in is_poly_in";
    73  else  error "polyeq.sml: diff.behav. 3 in is_poly_in";
    74 
    74 
    75  val t4 = (Thm.term_of o the o (parse thy)) "(lhs (-8 + (-1)*2*x + x^^^2 = 0)) is_expanded_in x";
    75  val t4 = (Thm.term_of o the o (TermC.parse thy)) "(lhs (-8 + (-1)*2*x + x^^^2 = 0)) is_expanded_in x";
    76  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t4;
    76  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t4;
    77  if (UnparseC.term t) = "True" then ()
    77  if (UnparseC.term t) = "True" then ()
    78  else  error "polyeq.sml: diff.behav. 4 in is_expended_in";
    78  else  error "polyeq.sml: diff.behav. 4 in is_expended_in";
    79 
    79 
    80 
    80 
    81  val t6 = (Thm.term_of o the o (parse thy)) "(lhs (-8 - 2*x + x^^^2 = 0)) is_expanded_in x";
    81  val t6 = (Thm.term_of o the o (TermC.parse thy)) "(lhs (-8 - 2*x + x^^^2 = 0)) is_expanded_in x";
    82  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t6;
    82  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t6;
    83  if (UnparseC.term t) = "True" then ()
    83  if (UnparseC.term t) = "True" then ()
    84  else  error "polyeq.sml: diff.behav. 5 in is_expended_in";
    84  else  error "polyeq.sml: diff.behav. 5 in is_expended_in";
    85  
    85  
    86  val t3 = (Thm.term_of o the o (parse thy))"((-8 - 2*x + x^^^2) has_degree_in x) = 2";
    86  val t3 = (Thm.term_of o the o (TermC.parse thy))"((-8 - 2*x + x^^^2) has_degree_in x) = 2";
    87  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
    87  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
    88  if (UnparseC.term t) = "True" then ()
    88  if (UnparseC.term t) = "True" then ()
    89  else  error "polyeq.sml: diff.behav. in has_degree_in_in";
    89  else  error "polyeq.sml: diff.behav. in has_degree_in_in";
    90 
    90 
    91  val t3 = (Thm.term_of o the o (parse thy)) "((sqrt(x)) has_degree_in x) = 2";
    91  val t3 = (Thm.term_of o the o (TermC.parse thy)) "((sqrt(x)) has_degree_in x) = 2";
    92  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
    92  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
    93  if (UnparseC.term t) = "False" then ()
    93  if (UnparseC.term t) = "False" then ()
    94  else  error "polyeq.sml: diff.behav. 6 in has_degree_in_in";
    94  else  error "polyeq.sml: diff.behav. 6 in has_degree_in_in";
    95 
    95 
    96  val t4 = (Thm.term_of o the o (parse thy)) 
    96  val t4 = (Thm.term_of o the o (TermC.parse thy)) 
    97 	      "((-8 - 2*x + x^^^2) has_degree_in x) = 1";
    97 	      "((-8 - 2*x + x^^^2) has_degree_in x) = 1";
    98  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t4;
    98  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t4;
    99  if (UnparseC.term t) = "False" then ()
    99  if (UnparseC.term t) = "False" then ()
   100  else  error "polyeq.sml: diff.behav. 7 in has_degree_in_in";
   100  else  error "polyeq.sml: diff.behav. 7 in has_degree_in_in";
   101 
   101 
   102  val t5 = (Thm.term_of o the o (parse thy)) 
   102  val t5 = (Thm.term_of o the o (TermC.parse thy)) 
   103 	      "((-8 - 2*x + x^^^2) has_degree_in x) = 2";
   103 	      "((-8 - 2*x + x^^^2) has_degree_in x) = 2";
   104  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t5;
   104  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t5;
   105  if (UnparseC.term t) = "True" then ()
   105  if (UnparseC.term t) = "True" then ()
   106  else  error "polyeq.sml: diff.behav. 8 in has_degree_in_in";
   106  else  error "polyeq.sml: diff.behav. 8 in has_degree_in_in";
   107 
   107 
   111 val fmz = ["equality (-8 - 2*x + x^^^2 = 0)", "solveFor x", "solutions L"];
   111 val fmz = ["equality (-8 - 2*x + x^^^2 = 0)", "solveFor x", "solutions L"];
   112 if M_Match.match_pbl fmz (Problem.from_store ["expanded", "univariate", "equation"]) =
   112 if M_Match.match_pbl fmz (Problem.from_store ["expanded", "univariate", "equation"]) =
   113   M_Match.Matches' {Find = [Correct "solutions L"], 
   113   M_Match.Matches' {Find = [Correct "solutions L"], 
   114             With = [], 
   114             With = [], 
   115             Given = [Correct "equality (-8 - 2 * x + x ^^^ 2 = 0)", Correct "solveFor x"], 
   115             Given = [Correct "equality (-8 - 2 * x + x ^^^ 2 = 0)", Correct "solveFor x"], 
   116             Where = [Correct "matches (?a = 0) (-8 - 2 * x + x ^^^ 2 = 0)", 
   116             Where = [Correct "TermC.matches (?a = 0) (-8 - 2 * x + x ^^^ 2 = 0)", 
   117                      Correct "lhs (-8 - 2 * x + x ^^^ 2 = 0) is_expanded_in x"], 
   117                      Correct "lhs (-8 - 2 * x + x ^^^ 2 = 0) is_expanded_in x"], 
   118             Relate = []}
   118             Relate = []}
   119 then () else error "M_Match.match_pbl [expanded,univariate,equation]";
   119 then () else error "M_Match.match_pbl [expanded,univariate,equation]";
   120 
   120 
   121 if M_Match.match_pbl fmz (Problem.from_store ["degree_2", "expanded", "univariate", "equation"]) =
   121 if M_Match.match_pbl fmz (Problem.from_store ["degree_2", "expanded", "univariate", "equation"]) =
   132 "----------- prep. for introduction of Matthias Goldgruber 2003 trials on rewrite orders -----";
   132 "----------- prep. for introduction of Matthias Goldgruber 2003 trials on rewrite orders -----";
   133 (*##################################################################################
   133 (*##################################################################################
   134 -----------28.2.03: war nicht upgedatet und ausgeklammert in ROOT.ML-->Test_Isac.thy
   134 -----------28.2.03: war nicht upgedatet und ausgeklammert in ROOT.ML-->Test_Isac.thy
   135 
   135 
   136   (*Aufgabe zum Einstieg in die Arbeit...*)
   136   (*Aufgabe zum Einstieg in die Arbeit...*)
   137   val t = (Thm.term_of o the o (parse thy)) "a*b - (a+b)*x + x^^^2 = 0";
   137   val t = (Thm.term_of o the o (TermC.parse thy)) "a*b - (a+b)*x + x^^^2 = 0";
   138   (*ein 'ruleset' aus Poly.ML wird angewandt...*)
   138   (*ein 'ruleset' aus Poly.ML wird angewandt...*)
   139   val SOME (t,_) = rewrite_set_ thy Poly_erls false make_polynomial t;
   139   val SOME (t,_) = rewrite_set_ thy Poly_erls false make_polynomial t;
   140   UnparseC.term t;
   140   UnparseC.term t;
   141   "a * b + (-1 * (a * x) + (-1 * (b * x) + x ^^^ 2)) = 0";
   141   "a * b + (-1 * (a * x) + (-1 * (b * x) + x ^^^ 2)) = 0";
   142   val SOME (t,_) = 
   142   val SOME (t,_) = 
   162   (*das rewriting l"asst sich beobachten mit
   162   (*das rewriting l"asst sich beobachten mit
   163 Rewrite.trace_on := false;
   163 Rewrite.trace_on := false;
   164   *)
   164   *)
   165 
   165 
   166 "------15.11.02 --------------------------";
   166 "------15.11.02 --------------------------";
   167   val t = (Thm.term_of o the o (parse thy)) "1 + a * x + b * x";
   167   val t = (Thm.term_of o the o (TermC.parse thy)) "1 + a * x + b * x";
   168   val bdv = (Thm.term_of o the o (parse thy)) "bdv";
   168   val bdv = (Thm.term_of o the o (TermC.parse thy)) "bdv";
   169   val a = (Thm.term_of o the o (parse thy)) "a";
   169   val a = (Thm.term_of o the o (TermC.parse thy)) "a";
   170  
   170  
   171 Rewrite.trace_on := false;
   171 Rewrite.trace_on := false;
   172  (* Anwenden einer Regelmenge aus Termorder.ML: *)
   172  (* Anwenden einer Regelmenge aus Termorder.ML: *)
   173  val SOME (t,_) =
   173  val SOME (t,_) =
   174      rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
   174      rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
   176  val SOME (t,_) =
   176  val SOME (t,_) =
   177      rewrite_set_ thy false discard_parentheses t;
   177      rewrite_set_ thy false discard_parentheses t;
   178  UnparseC.term t;
   178  UnparseC.term t;
   179 "1 + b * x + x * a";
   179 "1 + b * x + x * a";
   180 
   180 
   181  val t = (Thm.term_of o the o (parse thy)) "1 + a * (x + b * x) + a^^^2";
   181  val t = (Thm.term_of o the o (TermC.parse thy)) "1 + a * (x + b * x) + a^^^2";
   182  val SOME (t,_) =
   182  val SOME (t,_) =
   183      rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
   183      rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
   184  UnparseC.term t;
   184  UnparseC.term t;
   185  val SOME (t,_) =
   185  val SOME (t,_) =
   186      rewrite_set_ thy false discard_parentheses t;
   186      rewrite_set_ thy false discard_parentheses t;
   187  UnparseC.term t;
   187  UnparseC.term t;
   188 "1 + (x + b * x) * a + a ^^^ 2";
   188 "1 + (x + b * x) * a + a ^^^ 2";
   189 
   189 
   190  val t = (Thm.term_of o the o (parse thy)) "1 + a ^^^2 * x + b * a + 7*a^^^2";
   190  val t = (Thm.term_of o the o (TermC.parse thy)) "1 + a ^^^2 * x + b * a + 7*a^^^2";
   191  val SOME (t,_) =
   191  val SOME (t,_) =
   192      rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
   192      rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
   193  UnparseC.term t;
   193  UnparseC.term t;
   194  val SOME (t,_) =
   194  val SOME (t,_) =
   195      rewrite_set_ thy false discard_parentheses t;
   195      rewrite_set_ thy false discard_parentheses t;
   205  Termorder.thy    BITTE NUR HIERHER SCHREIBEN (...WN03)
   205  Termorder.thy    BITTE NUR HIERHER SCHREIBEN (...WN03)
   206 
   206 
   207  get_thm Termorder.thy "bdv_n_collect";
   207  get_thm Termorder.thy "bdv_n_collect";
   208  get_thm (theory "Isac_Knowledge") "bdv_n_collect";
   208  get_thm (theory "Isac_Knowledge") "bdv_n_collect";
   209 *)
   209 *)
   210  val t = (Thm.term_of o the o (parse thy)) "a ^^^2 * x + 7 * a^^^2";
   210  val t = (Thm.term_of o the o (TermC.parse thy)) "a ^^^2 * x + 7 * a^^^2";
   211  val SOME (t,_) =
   211  val SOME (t,_) =
   212      rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
   212      rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
   213  UnparseC.term t;
   213  UnparseC.term t;
   214  val SOME (t,_) =
   214  val SOME (t,_) =
   215      rewrite_set_ thy false discard_parentheses t;
   215      rewrite_set_ thy false discard_parentheses t;
   216  UnparseC.term t;
   216  UnparseC.term t;
   217 "(7 + x) * a ^^^ 2";
   217 "(7 + x) * a ^^^ 2";
   218 
   218 
   219  val t = (Thm.term_of o the o (parse Termorder.thy)) "Pi";
   219  val t = (Thm.term_of o the o (TermC.parse Termorder.thy)) "Pi";
   220 
   220 
   221  val t = (Thm.term_of o the o (parseold thy)) "7";
   221  val t = (Thm.term_of o the o (parseold thy)) "7";
   222 ##################################################################################*)
   222 ##################################################################################*)
   223 
   223 
   224 
   224 
   225 "----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
   225 "----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
   226 "----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
   226 "----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
   227 "----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
   227 "----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
   228   val substa = [(TermC.empty, (Thm.term_of o the o (parse thy)) "a")];
   228   val substa = [(TermC.empty, (Thm.term_of o the o (TermC.parse thy)) "a")];
   229   val substb = [(TermC.empty, (Thm.term_of o the o (parse thy)) "b")];
   229   val substb = [(TermC.empty, (Thm.term_of o the o (TermC.parse thy)) "b")];
   230   val substx = [(TermC.empty, (Thm.term_of o the o (parse thy)) "x")];
   230   val substx = [(TermC.empty, (Thm.term_of o the o (TermC.parse thy)) "x")];
   231 
   231 
   232   val x1 = (Thm.term_of o the o (parse thy)) "a + b + x";
   232   val x1 = (Thm.term_of o the o (TermC.parse thy)) "a + b + x";
   233   val x2 = (Thm.term_of o the o (parse thy)) "a + x + b";
   233   val x2 = (Thm.term_of o the o (TermC.parse thy)) "a + x + b";
   234   val x3 = (Thm.term_of o the o (parse thy)) "a + x + b";
   234   val x3 = (Thm.term_of o the o (TermC.parse thy)) "a + x + b";
   235   val x4 = (Thm.term_of o the o (parse thy)) "x + a + b";
   235   val x4 = (Thm.term_of o the o (TermC.parse thy)) "x + a + b";
   236 
   236 
   237 if ord_make_polynomial_in true thy substx (x1,x2) = true(*LESS *) then ()
   237 if ord_make_polynomial_in true thy substx (x1,x2) = true(*LESS *) then ()
   238 else error "termorder.sml diff.behav ord_make_polynomial_in #1";
   238 else error "termorder.sml diff.behav ord_make_polynomial_in #1";
   239  
   239  
   240 if ord_make_polynomial_in true thy substa (x1,x2) = true(*LESS *) then ()
   240 if ord_make_polynomial_in true thy substa (x1,x2) = true(*LESS *) then ()
   241 else error "termorder.sml diff.behav ord_make_polynomial_in #2";
   241 else error "termorder.sml diff.behav ord_make_polynomial_in #2";
   242 
   242 
   243 if ord_make_polynomial_in true thy substb (x1,x2) = false(*GREATER*) then ()
   243 if ord_make_polynomial_in true thy substb (x1,x2) = false(*GREATER*) then ()
   244 else error "termorder.sml diff.behav ord_make_polynomial_in #3";
   244 else error "termorder.sml diff.behav ord_make_polynomial_in #3";
   245 
   245 
   246   val aa = (Thm.term_of o the o (parse thy)) "-1 * a * x";
   246   val aa = (Thm.term_of o the o (TermC.parse thy)) "-1 * a * x";
   247   val bb = (Thm.term_of o the o (parse thy)) "x^^^3";
   247   val bb = (Thm.term_of o the o (TermC.parse thy)) "x^^^3";
   248   ord_make_polynomial_in true thy substx (aa, bb);
   248   ord_make_polynomial_in true thy substx (aa, bb);
   249   true; (* => LESS *) 
   249   true; (* => LESS *) 
   250   
   250   
   251   val aa = (Thm.term_of o the o (parse thy)) "-1 * a * x";
   251   val aa = (Thm.term_of o the o (TermC.parse thy)) "-1 * a * x";
   252   val bb = (Thm.term_of o the o (parse thy)) "x^^^3";
   252   val bb = (Thm.term_of o the o (TermC.parse thy)) "x^^^3";
   253   ord_make_polynomial_in true thy substa (aa, bb);
   253   ord_make_polynomial_in true thy substa (aa, bb);
   254   false; (* => GREATER *)
   254   false; (* => GREATER *)
   255 
   255 
   256 (* und nach dem Re-engineering der Termorders in den 'rulesets' 
   256 (* und nach dem Re-engineering der Termorders in den 'rulesets' 
   257    kannst Du die 'gr"osste' Variable frei w"ahlen: *)
   257    kannst Du die 'gr"osste' Variable frei w"ahlen: *)
   258   val bdv= (Thm.term_of o the o (parse thy)) "''bdv''";
   258   val bdv= (Thm.term_of o the o (TermC.parse thy)) "''bdv''";
   259   val x  = (Thm.term_of o the o (parse thy)) "x";
   259   val x  = (Thm.term_of o the o (TermC.parse thy)) "x";
   260   val a  = (Thm.term_of o the o (parse thy)) "a";
   260   val a  = (Thm.term_of o the o (TermC.parse thy)) "a";
   261   val b  = (Thm.term_of o the o (parse thy)) "b";
   261   val b  = (Thm.term_of o the o (TermC.parse thy)) "b";
   262 val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in x2;
   262 val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in x2;
   263 if UnparseC.term t' = "b + x + a" then ()
   263 if UnparseC.term t' = "b + x + a" then ()
   264 else error "termorder.sml diff.behav ord_make_polynomial_in #11";
   264 else error "termorder.sml diff.behav ord_make_polynomial_in #11";
   265 
   265 
   266 val NONE = rewrite_set_inst_ thy false [(bdv,b)] make_polynomial_in x2;
   266 val NONE = rewrite_set_inst_ thy false [(bdv,b)] make_polynomial_in x2;
   268 val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in x2;
   268 val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in x2;
   269 if UnparseC.term t' = "a + b + x" then ()
   269 if UnparseC.term t' = "a + b + x" then ()
   270 else error "termorder.sml diff.behav ord_make_polynomial_in #13";
   270 else error "termorder.sml diff.behav ord_make_polynomial_in #13";
   271 
   271 
   272   val ppp' = "-6 + -5*x + x^^^3 + -1*x^^^2 + -1*x^^^3 + -14*x^^^2";
   272   val ppp' = "-6 + -5*x + x^^^3 + -1*x^^^2 + -1*x^^^3 + -14*x^^^2";
   273   val ppp  = (Thm.term_of o the o (parse thy)) ppp';
   273   val ppp  = (Thm.term_of o the o (TermC.parse thy)) ppp';
   274 val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ppp;
   274 val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ppp;
   275 if UnparseC.term t' = "-6 + -5 * x + -15 * x ^^^ 2 + 0" then ()
   275 if UnparseC.term t' = "-6 + -5 * x + -15 * x ^^^ 2 + 0" then ()
   276 else error "termorder.sml diff.behav ord_make_polynomial_in #14";
   276 else error "termorder.sml diff.behav ord_make_polynomial_in #14";
   277 
   277 
   278 val SOME (t', _) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ppp;
   278 val SOME (t', _) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ppp;
   279 if UnparseC.term t' = "-6 + -5 * x + -15 * x ^^^ 2 + 0" then ()
   279 if UnparseC.term t' = "-6 + -5 * x + -15 * x ^^^ 2 + 0" then ()
   280 else error "termorder.sml diff.behav ord_make_polynomial_in #15";
   280 else error "termorder.sml diff.behav ord_make_polynomial_in #15";
   281 
   281 
   282   val ttt' = "(3*x + 5)/18";
   282   val ttt' = "(3*x + 5)/18";
   283   val ttt = (Thm.term_of o the o (parse thy)) ttt';
   283   val ttt = (Thm.term_of o the o (TermC.parse thy)) ttt';
   284 val SOME (uuu,_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ttt;
   284 val SOME (uuu,_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ttt;
   285 if UnparseC.term uuu = "(5 + 3 * x) / 18" then ()
   285 if UnparseC.term uuu = "(5 + 3 * x) / 18" then ()
   286 else error "termorder.sml diff.behav ord_make_polynomial_in #16a";
   286 else error "termorder.sml diff.behav ord_make_polynomial_in #16a";
   287 
   287 
   288 (*============ inhibit exn WN120316 ==============================================
   288 (*============ inhibit exn WN120316 ==============================================
   939 
   939 
   940 "-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
   940 "-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
   941 "-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
   941 "-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
   942 "-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
   942 "-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
   943 "---- test the erls ----";
   943 "---- test the erls ----";
   944  val t1 = (Thm.term_of o the o (parse thy)) "0 <= (10/3/2)^^^2 - 1";
   944  val t1 = (Thm.term_of o the o (TermC.parse thy)) "0 <= (10/3/2)^^^2 - 1";
   945  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_erls t1;
   945  val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_erls t1;
   946  val t' = UnparseC.term t;
   946  val t' = UnparseC.term t;
   947  (*if t'= "HOL.True" then ()
   947  (*if t'= "HOL.True" then ()
   948  else error "polyeq.sml: diff.behav. in 'rewrite_set_.. PolyEq_erls";*)
   948  else error "polyeq.sml: diff.behav. in 'rewrite_set_.. PolyEq_erls";*)
   949 (* *)
   949 (* *)