test/Tools/isac/Knowledge/polyeq-1.sml
author Walther Neuper <walther.neuper@jku.at>
Wed, 22 Apr 2020 11:06:48 +0200
changeset 59901 07a042166900
parent 59900 4e6fc3336336
child 59903 5037ca1b112b
permissions -rw-r--r--
shift Unsynchronized.ref for tracing to respect.struct.
walther@59627
     1
(* Title:  Knowledge/polyeq-1.sml
walther@59627
     2
           testexamples for PolyEq, poynomial equations and equational systems
walther@59627
     3
   Author: Richard Lang 2003  
walther@59627
     4
   (c) due to copyright terms
walther@59627
     5
WN030609: some expls dont work due to unfinished handling of 'expanded terms';
walther@59627
     6
          others marked with TODO have to be checked, too.
walther@59627
     7
*)
walther@59627
     8
walther@59627
     9
"-----------------------------------------------------------------";
walther@59627
    10
"table of contents -----------------------------------------------";
walther@59627
    11
"-----------------------------------------------------------------";
walther@59627
    12
"------ polyeq-1.sml ---------------------------------------------";
walther@59627
    13
"----------- tests on predicates in problems ---------------------";
walther@59627
    14
"----------- test matching problems ------------------------------";
walther@59847
    15
"----------- prep. for introduction of Matthias Goldgruber 2003 trials on rewrite orders -----";
walther@59847
    16
"----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
walther@59627
    17
"----------- lin.eq degree_0 -------------------------------------";
walther@59627
    18
"----------- test thm's d2_pq_formulsxx[_neg]---------------------";
walther@59627
    19
"----------- equality (2 +(-1)*x + x^^^2 = (0::real)) ----------------------------------------";
walther@59627
    20
"----------- equality (-2 +(-1)*x + 1*x^^^2 = 0) ---------------------------------------------";
walther@59627
    21
"----------- equality (-2 + x + x^^^2 = 0) ---------------------------------------------------";
walther@59627
    22
"----------- equality (2 + x + x^^^2 = 0) ----------------------------------------------------";
walther@59627
    23
"----------- equality (-2 + x + 1*x^^^2 = 0)) ------------------------------------------------";
walther@59627
    24
"----------- equality (1*x +   x^^^2 = 0) ----------------------------------------------------";
walther@59627
    25
"----------- equality (1*x + 1*x^^^2 = 0) ----------------------------------------------------";
walther@59627
    26
"----------- equality (x +   x^^^2 = 0) ------------------------------------------------------";
walther@59627
    27
"----------- equality (x + 1*x^^^2 = 0) ------------------------------------------------------";
walther@59627
    28
"----------- equality (-4 + x^^^2 = 0) -------------------------------------------------------";
walther@59627
    29
"----------- equality (4 + 1*x^^^2 = 0) -------------------------------------------------------";
walther@59627
    30
"----------- equality (1 +(-1)*x + 2*x^^^2 = 0) ----------------------------------------------";
walther@59627
    31
"----------- equality (-1 + x + 2*x^^^2 = 0) -------------------------------------------------";
walther@59627
    32
"----------- equality (1 + x + 2*x^^^2 = 0) --------------------------------------------------";
walther@59627
    33
"----------- (-8 - 2*x + x^^^2 = 0),  (*Schalk 2, S.67 Nr.31.b----";
walther@59627
    34
"----------- (-8 - 2*x + x^^^2 = 0),  by rewriting ---------------";
walther@59627
    35
"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
walther@59627
    36
"-----------------------------------------------------------------";
walther@59627
    37
"------ polyeq-2.sml ---------------------------------------------";
walther@59627
    38
"----------- (a*b - (a+b)*x + x^^^2 = 0), (*Schalk 2,S.68Nr.44.a*)";
walther@59627
    39
"----------- (-64 + x^^^2 = 0), (*Schalk 2, S.66 Nr.1.a~--------*)";
walther@59627
    40
"----------- (-147 + 3*x^^^2 = 0), (*Schalk 2, S.66 Nr.1.b------*)";
walther@59627
    41
"----------- (3*x - 1 - (5*x - (2 - 4*x)) = -11),(*Schalk Is86Bsp5";
walther@59627
    42
"----------- ((x+1)*(x+2) - (3*x - 2)^^^2=.. Schalk II s.68 Bsp 37";
walther@59627
    43
"----------- rls make_polynomial_in ------------------------------";
walther@59627
    44
"----------- interSteps ([1],Res); on Schalk Is86Bsp5-------------";
walther@59627
    45
"----------- rls d2_polyeq_bdv_only_simplify ---------------------";
walther@59627
    46
"-----------------------------------------------------------------";
walther@59627
    47
"-----------------------------------------------------------------";
walther@59627
    48
walther@59627
    49
"----------- tests on predicates in problems ---------------------";
walther@59627
    50
"----------- tests on predicates in problems ---------------------";
walther@59627
    51
"----------- tests on predicates in problems ---------------------";
walther@59901
    52
(* Rewrite.trace_on:=true;
walther@59901
    53
 Rewrite.trace_on:=false;
walther@59627
    54
*)
walther@59627
    55
 val t1 = (Thm.term_of o the o (parse thy)) "lhs (-8 - 2*x + x^^^2 = 0)";
walther@59627
    56
 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t1;
walther@59868
    57
 if ((UnparseC.term t) = "-8 - 2 * x + x ^^^ 2") then ()
walther@59627
    58
 else  error "polyeq.sml: diff.behav. in lhs";
walther@59627
    59
walther@59627
    60
 val t2 = (Thm.term_of o the o (parse thy)) "(-8 - 2*x + x^^^2) is_expanded_in x";
walther@59627
    61
 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t2;
walther@59868
    62
 if (UnparseC.term t) = "True" then ()
walther@59627
    63
 else  error "polyeq.sml: diff.behav. 1 in is_expended_in";
walther@59627
    64
walther@59627
    65
 val t0 = (Thm.term_of o the o (parse thy)) "(sqrt(x)) is_poly_in x";
walther@59627
    66
 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t0;
walther@59868
    67
 if (UnparseC.term t) = "False" then ()
walther@59627
    68
 else  error "polyeq.sml: diff.behav. 2 in is_poly_in";
walther@59627
    69
walther@59627
    70
 val t3 = (Thm.term_of o the o (parse thy)) "(-8 + (-1)*2*x + x^^^2) is_poly_in x";
walther@59627
    71
 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
walther@59868
    72
 if (UnparseC.term t) = "True" then ()
walther@59627
    73
 else  error "polyeq.sml: diff.behav. 3 in is_poly_in";
walther@59627
    74
walther@59627
    75
 val t4 = (Thm.term_of o the o (parse thy)) "(lhs (-8 + (-1)*2*x + x^^^2 = 0)) is_expanded_in x";
walther@59627
    76
 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t4;
walther@59868
    77
 if (UnparseC.term t) = "True" then ()
walther@59627
    78
 else  error "polyeq.sml: diff.behav. 4 in is_expended_in";
walther@59627
    79
walther@59627
    80
walther@59627
    81
 val t6 = (Thm.term_of o the o (parse thy)) "(lhs (-8 - 2*x + x^^^2 = 0)) is_expanded_in x";
walther@59627
    82
 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t6;
walther@59868
    83
 if (UnparseC.term t) = "True" then ()
walther@59627
    84
 else  error "polyeq.sml: diff.behav. 5 in is_expended_in";
walther@59627
    85
 
walther@59627
    86
 val t3 = (Thm.term_of o the o (parse thy))"((-8 - 2*x + x^^^2) has_degree_in x) = 2";
walther@59627
    87
 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
walther@59868
    88
 if (UnparseC.term t) = "True" then ()
walther@59627
    89
 else  error "polyeq.sml: diff.behav. in has_degree_in_in";
walther@59627
    90
walther@59627
    91
 val t3 = (Thm.term_of o the o (parse thy)) "((sqrt(x)) has_degree_in x) = 2";
walther@59627
    92
 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t3;
walther@59868
    93
 if (UnparseC.term t) = "False" then ()
walther@59627
    94
 else  error "polyeq.sml: diff.behav. 6 in has_degree_in_in";
walther@59627
    95
walther@59627
    96
 val t4 = (Thm.term_of o the o (parse thy)) 
walther@59627
    97
	      "((-8 - 2*x + x^^^2) has_degree_in x) = 1";
walther@59627
    98
 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t4;
walther@59868
    99
 if (UnparseC.term t) = "False" then ()
walther@59627
   100
 else  error "polyeq.sml: diff.behav. 7 in has_degree_in_in";
walther@59627
   101
walther@59627
   102
 val t5 = (Thm.term_of o the o (parse thy)) 
walther@59627
   103
	      "((-8 - 2*x + x^^^2) has_degree_in x) = 2";
walther@59627
   104
 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_prls t5;
walther@59868
   105
 if (UnparseC.term t) = "True" then ()
walther@59627
   106
 else  error "polyeq.sml: diff.behav. 8 in has_degree_in_in";
walther@59627
   107
walther@59627
   108
"----------- test matching problems --------------------------0---";
walther@59627
   109
"----------- test matching problems --------------------------0---";
walther@59627
   110
"----------- test matching problems --------------------------0---";
walther@59627
   111
val fmz = ["equality (-8 - 2*x + x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   112
if match_pbl fmz (get_pbt ["expanded","univariate","equation"]) =
walther@59627
   113
  Matches' {Find = [Correct "solutions L"], 
walther@59627
   114
            With = [], 
walther@59627
   115
            Given = [Correct "equality (-8 - 2 * x + x ^^^ 2 = 0)", Correct "solveFor x"], 
walther@59627
   116
            Where = [Correct "matches (?a = 0) (-8 - 2 * x + x ^^^ 2 = 0)", 
walther@59627
   117
                     Correct "lhs (-8 - 2 * x + x ^^^ 2 = 0) is_expanded_in x"], 
walther@59627
   118
            Relate = []}
walther@59627
   119
then () else error "match_pbl [expanded,univariate,equation]";
walther@59627
   120
walther@59627
   121
if match_pbl fmz (get_pbt ["degree_2","expanded","univariate","equation"]) =
walther@59627
   122
  Matches' {Find = [Correct "solutions L"], 
walther@59627
   123
            With = [], 
walther@59627
   124
            Given = [Correct "equality (-8 - 2 * x + x ^^^ 2 = 0)", Correct "solveFor x"], 
walther@59627
   125
            Where = [Correct "lhs (-8 - 2 * x + x ^^^ 2 = 0) has_degree_in x = 2"], 
walther@59627
   126
            Relate = []}              (*before WN110906 was: has_degree_in x =!= 2"]*)
walther@59627
   127
then () else error "match_pbl [degree_2,expanded,univariate,equation]";
walther@59627
   128
walther@59847
   129
walther@59847
   130
"----------- prep. for introduction of Matthias Goldgruber 2003 trials on rewrite orders -----";
walther@59847
   131
"----------- prep. for introduction of Matthias Goldgruber 2003 trials on rewrite orders -----";
walther@59847
   132
"----------- prep. for introduction of Matthias Goldgruber 2003 trials on rewrite orders -----";
walther@59847
   133
(*##################################################################################
walther@59847
   134
-----------28.2.03: war nicht upgedatet und ausgeklammert in ROOT.ML-->Test_Isac.thy
walther@59847
   135
walther@59847
   136
  (*Aufgabe zum Einstieg in die Arbeit...*)
walther@59847
   137
  val t = (Thm.term_of o the o (parse thy)) "a*b - (a+b)*x + x^^^2 = 0";
walther@59847
   138
  (*ein 'ruleset' aus Poly.ML wird angewandt...*)
walther@59847
   139
  val SOME (t,_) = rewrite_set_ thy Poly_erls false make_polynomial t;
walther@59868
   140
  UnparseC.term t;
walther@59847
   141
  "a * b + (-1 * (a * x) + (-1 * (b * x) + x ^^^ 2)) = 0";
walther@59847
   142
  val SOME (t,_) = 
walther@59847
   143
      rewrite_set_inst_ thy Poly_erls false [("bdv","a")] make_polynomial_in t;
walther@59868
   144
  UnparseC.term t;
walther@59847
   145
  "x ^^^ 2 + (-1 * (b * x) + (-1 * (x * a) + b * a)) = 0";
walther@59847
   146
(* bei Verwendung von "size_of-term" nach MG :*)
walther@59847
   147
(*"x ^^^ 2 + (-1 * (b * x) + (b * a + -1 * (x * a))) = 0"  !!! *)
walther@59847
   148
walther@59847
   149
  (*wir holen 'a' wieder aus der Klammerung heraus...*)
walther@59847
   150
  val SOME (t,_) = rewrite_set_ thy Poly_erls false discard_parentheses t;
walther@59868
   151
  UnparseC.term t;
walther@59847
   152
   "x ^^^ 2 + -1 * b * x + -1 * x * a + b * a = 0";
walther@59847
   153
(* "x ^^^ 2 + -1 * b * x + b * a + -1 * x * a = 0" !!! *)
walther@59847
   154
walther@59847
   155
  val SOME (t,_) =
walther@59847
   156
      rewrite_set_inst_ thy Poly_erls false [("bdv","a")] make_polynomial_in t;
walther@59868
   157
  UnparseC.term t;
walther@59847
   158
  "x ^^^ 2 + (-1 * (b * x) + a * (b + -1 * x)) = 0"; 
walther@59847
   159
  (*da sind wir fast am Ziel: make_polynomial_in 'a' sollte ergeben
walther@59847
   160
  "x ^^^ 2 + (-1 * (b * x)) + (b + -1 * x) * a = 0"*)
walther@59847
   161
walther@59847
   162
  (*das rewriting l"asst sich beobachten mit
walther@59901
   163
Rewrite.trace_on := false;
walther@59847
   164
  *)
walther@59847
   165
walther@59847
   166
"------15.11.02 --------------------------";
walther@59847
   167
  val t = (Thm.term_of o the o (parse thy)) "1 + a * x + b * x";
walther@59847
   168
  val bdv = (Thm.term_of o the o (parse thy)) "bdv";
walther@59847
   169
  val a = (Thm.term_of o the o (parse thy)) "a";
walther@59847
   170
 
walther@59901
   171
Rewrite.trace_on := false;
walther@59847
   172
 (* Anwenden einer Regelmenge aus Termorder.ML: *)
walther@59847
   173
 val SOME (t,_) =
walther@59847
   174
     rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
walther@59868
   175
 UnparseC.term t;
walther@59847
   176
 val SOME (t,_) =
walther@59847
   177
     rewrite_set_ thy false discard_parentheses t;
walther@59868
   178
 UnparseC.term t;
walther@59847
   179
"1 + b * x + x * a";
walther@59847
   180
walther@59847
   181
 val t = (Thm.term_of o the o (parse thy)) "1 + a * (x + b * x) + a^^^2";
walther@59847
   182
 val SOME (t,_) =
walther@59847
   183
     rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
walther@59868
   184
 UnparseC.term t;
walther@59847
   185
 val SOME (t,_) =
walther@59847
   186
     rewrite_set_ thy false discard_parentheses t;
walther@59868
   187
 UnparseC.term t;
walther@59847
   188
"1 + (x + b * x) * a + a ^^^ 2";
walther@59847
   189
walther@59847
   190
 val t = (Thm.term_of o the o (parse thy)) "1 + a ^^^2 * x + b * a + 7*a^^^2";
walther@59847
   191
 val SOME (t,_) =
walther@59847
   192
     rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
walther@59868
   193
 UnparseC.term t;
walther@59847
   194
 val SOME (t,_) =
walther@59847
   195
     rewrite_set_ thy false discard_parentheses t;
walther@59868
   196
 UnparseC.term t;
walther@59847
   197
"1 + b * a + (7 + x) * a ^^^ 2";
walther@59847
   198
walther@59847
   199
(* MG2003
walther@59847
   200
 Prog_Expr.thy       grundlegende Algebra
walther@59847
   201
 Poly.thy         Polynome
walther@59847
   202
 Rational.thy     Br"uche
walther@59847
   203
 Root.thy         Wurzeln
walther@59847
   204
 RootRat.thy      Wurzen + Br"uche
walther@59847
   205
 Termorder.thy    BITTE NUR HIERHER SCHREIBEN (...WN03)
walther@59847
   206
walther@59847
   207
 get_thm Termorder.thy "bdv_n_collect";
walther@59847
   208
 get_thm (theory "Isac_Knowledge") "bdv_n_collect";
walther@59847
   209
*)
walther@59847
   210
 val t = (Thm.term_of o the o (parse thy)) "a ^^^2 * x + 7 * a^^^2";
walther@59847
   211
 val SOME (t,_) =
walther@59847
   212
     rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in t;
walther@59868
   213
 UnparseC.term t;
walther@59847
   214
 val SOME (t,_) =
walther@59847
   215
     rewrite_set_ thy false discard_parentheses t;
walther@59868
   216
 UnparseC.term t;
walther@59847
   217
"(7 + x) * a ^^^ 2";
walther@59847
   218
walther@59847
   219
 val t = (Thm.term_of o the o (parse Termorder.thy)) "Pi";
walther@59847
   220
walther@59847
   221
 val t = (Thm.term_of o the o (parseold thy)) "7";
walther@59847
   222
##################################################################################*)
walther@59847
   223
walther@59847
   224
walther@59847
   225
"----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
walther@59847
   226
"----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
walther@59847
   227
"----------- Matthias Goldgruber 2003 trials on rewrite orders -------------------------------";
walther@59861
   228
  val substa = [(TermC.empty, (Thm.term_of o the o (parse thy)) "a")];
walther@59861
   229
  val substb = [(TermC.empty, (Thm.term_of o the o (parse thy)) "b")];
walther@59861
   230
  val substx = [(TermC.empty, (Thm.term_of o the o (parse thy)) "x")];
walther@59847
   231
walther@59847
   232
  val x1 = (Thm.term_of o the o (parse thy)) "a + b + x";
walther@59847
   233
  val x2 = (Thm.term_of o the o (parse thy)) "a + x + b";
walther@59847
   234
  val x3 = (Thm.term_of o the o (parse thy)) "a + x + b";
walther@59847
   235
  val x4 = (Thm.term_of o the o (parse thy)) "x + a + b";
walther@59847
   236
walther@59847
   237
if ord_make_polynomial_in true thy substx (x1,x2) = true(*LESS *) then ()
walther@59847
   238
else error "termorder.sml diff.behav ord_make_polynomial_in #1";
walther@59847
   239
 
walther@59847
   240
if ord_make_polynomial_in true thy substa (x1,x2) = true(*LESS *) then ()
walther@59847
   241
else error "termorder.sml diff.behav ord_make_polynomial_in #2";
walther@59847
   242
walther@59847
   243
if ord_make_polynomial_in true thy substb (x1,x2) = false(*GREATER*) then ()
walther@59847
   244
else error "termorder.sml diff.behav ord_make_polynomial_in #3";
walther@59847
   245
walther@59847
   246
  val aa = (Thm.term_of o the o (parse thy)) "-1 * a * x";
walther@59847
   247
  val bb = (Thm.term_of o the o (parse thy)) "x^^^3";
walther@59847
   248
  ord_make_polynomial_in true thy substx (aa, bb);
walther@59847
   249
  true; (* => LESS *) 
walther@59847
   250
  
walther@59847
   251
  val aa = (Thm.term_of o the o (parse thy)) "-1 * a * x";
walther@59847
   252
  val bb = (Thm.term_of o the o (parse thy)) "x^^^3";
walther@59847
   253
  ord_make_polynomial_in true thy substa (aa, bb);
walther@59847
   254
  false; (* => GREATER *)
walther@59847
   255
walther@59847
   256
(* und nach dem Re-engineering der Termorders in den 'rulesets' 
walther@59847
   257
   kannst Du die 'gr"osste' Variable frei w"ahlen: *)
walther@59847
   258
  val bdv= (Thm.term_of o the o (parse thy)) "''bdv''";
walther@59847
   259
  val x  = (Thm.term_of o the o (parse thy)) "x";
walther@59847
   260
  val a  = (Thm.term_of o the o (parse thy)) "a";
walther@59847
   261
  val b  = (Thm.term_of o the o (parse thy)) "b";
walther@59847
   262
val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,a)] make_polynomial_in x2;
walther@59868
   263
if UnparseC.term t' = "b + x + a" then ()
walther@59847
   264
else error "termorder.sml diff.behav ord_make_polynomial_in #11";
walther@59847
   265
walther@59847
   266
val NONE = rewrite_set_inst_ thy false [(bdv,b)] make_polynomial_in x2;
walther@59847
   267
walther@59847
   268
val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in x2;
walther@59868
   269
if UnparseC.term t' = "a + b + x" then ()
walther@59847
   270
else error "termorder.sml diff.behav ord_make_polynomial_in #13";
walther@59847
   271
walther@59847
   272
  val ppp' = "-6 + -5*x + x^^^3 + -1*x^^^2 + -1*x^^^3 + -14*x^^^2";
walther@59847
   273
  val ppp  = (Thm.term_of o the o (parse thy)) ppp';
walther@59847
   274
val SOME (t',_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ppp;
walther@59868
   275
if UnparseC.term t' = "-6 + -5 * x + -15 * x ^^^ 2 + 0" then ()
walther@59847
   276
else error "termorder.sml diff.behav ord_make_polynomial_in #14";
walther@59847
   277
walther@59847
   278
val SOME (t', _) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ppp;
walther@59868
   279
if UnparseC.term t' = "-6 + -5 * x + -15 * x ^^^ 2 + 0" then ()
walther@59847
   280
else error "termorder.sml diff.behav ord_make_polynomial_in #15";
walther@59847
   281
walther@59847
   282
  val ttt' = "(3*x + 5)/18";
walther@59847
   283
  val ttt = (Thm.term_of o the o (parse thy)) ttt';
walther@59847
   284
val SOME (uuu,_) = rewrite_set_inst_ thy false [(bdv,x)] make_polynomial_in ttt;
walther@59868
   285
if UnparseC.term uuu = "(5 + 3 * x) / 18" then ()
walther@59847
   286
else error "termorder.sml diff.behav ord_make_polynomial_in #16a";
walther@59847
   287
walther@59847
   288
(*============ inhibit exn WN120316 ==============================================
walther@59847
   289
val SOME (uuu,_) = rewrite_set_ thy false make_polynomial ttt;
walther@59868
   290
if UnparseC.term uuu = "(5 + 3 * x) / 18" then ()
walther@59847
   291
else error "termorder.sml diff.behav ord_make_polynomial_in #16b";
walther@59847
   292
============ inhibit exn WN120316 ==============================================*)
walther@59847
   293
walther@59847
   294
walther@59627
   295
"----------- lin.eq degree_0 -------------------------------------";
walther@59627
   296
"----------- lin.eq degree_0 -------------------------------------";
walther@59627
   297
"----------- lin.eq degree_0 -------------------------------------";
walther@59627
   298
"----- d0_false ------";
walther@59627
   299
val fmz = ["equality (1 = (0::real))", "solveFor x", "solutions L"];
walther@59627
   300
val (dI',pI',mI') = ("PolyEq",["degree_0","polynomial","univariate","equation"],
walther@59627
   301
                     ["PolyEq","solve_d0_polyeq_equation"]);
walther@59871
   302
(*=== inhibit exn WN110914: declare_constraints doesnt work with ThmC.numerals_to_Free ========
walther@59627
   303
TODO: change to "equality (x + -1*x = (0::real))"
walther@59627
   304
      and search for an appropriate problem and method.
walther@59627
   305
walther@59627
   306
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   307
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   308
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   309
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   310
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   311
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   312
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   313
case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[]")) => ()
walther@59627
   314
	 | _ => error "polyeq.sml: diff.behav. in 1 = 0 -> []";
walther@59627
   315
walther@59627
   316
"----- d0_true ------";
walther@59627
   317
val fmz = ["equality (0 = (0::real))", "solveFor x","solutions L"];
walther@59627
   318
val (dI',pI',mI') = ("PolyEq",["degree_0","polynomial","univariate","equation"],
walther@59627
   319
                     ["PolyEq","solve_d0_polyeq_equation"]);
walther@59627
   320
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   321
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   322
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   323
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   324
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   325
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   326
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   327
case f of Form' (FormKF (~1,EdUndef,0,Nundef,"UniversalList")) => ()
walther@59627
   328
	 | _ => error "polyeq.sml: diff.behav. in 0 = 0 -> UniversalList";
walther@59627
   329
============ inhibit exn WN110914 ============================================*)
walther@59627
   330
walther@59627
   331
"----------- test thm's d2_pq_formulsxx[_neg]---------------------";
walther@59627
   332
"----------- test thm's d2_pq_formulsxx[_neg]---------------------";
walther@59627
   333
"----------- test thm's d2_pq_formulsxx[_neg]---------------------";
walther@59627
   334
"----- d2_pqformula1 ------!!!!";
walther@59627
   335
val fmz = ["equality (-1/8 + (-1/4)*z + z^^^2 = (0::real))", "solveFor z","solutions L"];
walther@59627
   336
val (dI',pI',mI') =
walther@59627
   337
  ("Isac_Knowledge", ["pqFormula","degree_2","polynomial","univariate","equation"], ["no_met"]);
walther@59627
   338
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   339
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   340
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   341
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   342
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   343
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   344
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   345
val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*Apply_Method ["PolyEq", "solve_d2_polyeq_pq_equation"]*)
walther@59627
   346
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   347
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   348
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   349
val (p,_,f,nxt,_,pt) = me nxt p [] pt;         
walther@59627
   350
walther@59627
   351
(*[z = 1 / 8 + sqrt (9 / 16) / 2, z = 1 / 8 + -1 * sqrt (9 / 16) / 2] TODO sqrt*)
walther@59627
   352
val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt =..,Check_elementwise "Assumptions")*)
walther@59749
   353
"~~~~~ fun me, args:"; val (tac, (p:pos'), _, (pt:ctree)) = (nxt, p, [], pt);
walther@59804
   354
"~~~~~ fun Step.by_tactic, args:"; val (tac, (ptp as (pt, p))) = (tac, (pt, p));
walther@59755
   355
val Appl m = applicable_in p pt tac;
walther@59627
   356
val Check_elementwise' (trm1, str, (trm2, trms)) = m;
walther@59868
   357
UnparseC.term trm1 = "[z = 1 / 8 + sqrt (9 / 16) / 2, z = 1 / 8 + -1 * sqrt (9 / 16) / 2]";
walther@59627
   358
str = "Assumptions";
walther@59868
   359
UnparseC.term trm2 = "[z = 1 / 8 + sqrt (9 / 16) / 2, z = 1 / 8 + -1 * sqrt (9 / 16) / 2]";
walther@59868
   360
UnparseC.terms trms = "[\"lhs (-1 / 8 + -1 * (1 / 8 + sqrt (9 / 16) / 2) / 4 +\n "^
walther@59627
   361
  "    (1 / 8 + sqrt (9 / 16) / 2) ^^^ 2 =\n     0) is_poly_in 1 / 8 + sqrt (9 / 16) / 2\","^
walther@59627
   362
  "\"lhs (-1 / 8 + -1 * (1 / 8 + sqrt (9 / 16) / 2) / 4 +\n     (1 / 8 + sqrt (9 / 16) / 2) ^^^ 2 =\n     0) "^
walther@59627
   363
      "has_degree_in 1 / 8 + sqrt (9 / 16) / 2 =\n2\","^
walther@59627
   364
  "\"lhs (-1 / 8 + -1 * (1 / 8 + -1 * sqrt (9 / 16) / 2) / 4 +\n     (1 / 8 + -1 * sqrt (9 / 16) / 2) ^^^ 2 =\n     0) is_poly_in 1 / 8 + -1 * sqrt (9 / 16) / 2\","^
walther@59627
   365
  "\"lhs (-1 / 8 + -1 * (1 / 8 + -1 * sqrt (9 / 16) / 2) / 4 +\n     (1 / 8 + -1 * sqrt (9 / 16) / 2) ^^^ 2 =\n     0) has_degree_in 1 / 8 + -1 * sqrt (9 / 16) / 2 =\n2\"]";
walther@59627
   366
(*TODO simplify assumptions (sqrt!) and check ERROR in has_degree_in*);
walther@59755
   367
      (*if*) Tactic.for_specify' m; (*false*)
walther@59627
   368
(*loc_solve_ (mI,m) ptp;
walther@59845
   369
  WAS: not-found-in-program: NotLocatable from Term_Val1 (Const ("List...*)
walther@59749
   370
"~~~~~ fun loc_solve_, args:"; val (m, (pt,pos)) = (m, ptp);
walther@59627
   371
(*solve m (pt, pos);
walther@59845
   372
  WAS: not-found-in-program: NotLocatable from Term_Val1 (Const ("List...*)
walther@59751
   373
"~~~~~ fun Step_Solve.by_tactic , args:"; val (m, (pt, po as (p,p_))) = (m, (pt, pos));
walther@59898
   374
Spec.e_metID = get_obj g_metID pt (par_pblobj pt p) (*false*);
walther@59627
   375
        val thy' = get_obj g_domID pt (par_pblobj pt p);
walther@59831
   376
	        val (is, sc) = resume_prog thy' (p,p_) pt;
walther@59852
   377
		        val d = Rule_Set.empty;
walther@59627
   378
(*locate_input_tactic (thy',srls) m  (pt,(p,p_)) (sc,d) is;
walther@59845
   379
  WAS: not-found-in-program: NotLocatable from Term_Val1 (Const ("List...*)
walther@59679
   380
"~~~~~ fun locate_input_tactic, args:"; val () = ();
walther@59679
   381
(*----- outcommented during cleanup of args in lucas-interpreter.sml ------------------------\\* )
walther@59627
   382
l = [] orelse ((last_elem o fst) p = 0 andalso snd p = Res) (*false*);
walther@59712
   383
(*WAS val Reject_Tac1 _ =(go_scan_up1 (thy',srls,scr,d) ((E,l,a,v,S,b), [(m,EmptyMout,pt,p,[])]) )
walther@59718
   384
  ... Accept_Tac1 ... is correct*)
walther@59691
   385
"~~~~~ and go_scan_up1, args:"; val ((ys as (_,_,_,Prog sc,_)), ((E,l,a,v,S,b),ss)) =
walther@59627
   386
   ((thy',ctxt,srls,scr,d), ((E,l,a,v,S,b), [(m,EmptyMout,pt,p,[])]));
walther@59627
   387
1 < length l (*true*);
walther@59627
   388
val up = drop_last l;
walther@59868
   389
  UnparseC.term (at_location up sc);
walther@59767
   390
  (at_location up sc);
walther@59767
   391
(*WAS val Term_Val1 _ = scan_up1 ys ((E,up,a,v,S,b),ss) (at_location up sc)
walther@59627
   392
      ... ???? ... is correct*)
walther@59691
   393
"~~~~~ fun scan_up1, args:"; val ((ys as (y,ctxt,s,Prog sc,d)), (is as (E,l,a,v,S,b),ss), 
walther@59767
   394
	   (Const ("HOL.Let",_) $ _)) = (ys, ((E,up,a,v,S,b),ss:step list), (at_location up sc));
walther@59627
   395
      val l = drop_last l; (*comes from e, goes to Abs*)
walther@59767
   396
      val (Const ("HOL.Let",_) $ e $ (Abs (i,T,body))) = at_location l sc;
walther@59627
   397
      val i = mk_Free (i, T);
walther@59697
   398
      val E = Env.update E (i, v);
walther@59627
   399
(*Type error ...: Can't unify _a to pos * pos_ (Incompatible types)*)
walther@59627
   400
val [(tac_, mout, ctree, pos', xxx)] = ss;
walther@59627
   401
val ss = [(tac_, mout, ctree, pos', []:(pos * pos_) list)];
walther@59718
   402
(*WAS val Reject_Tac1 iss = scan_dn1 (((y,s),d),ORundef) ((E, l@[R,D], a,v,S,b),ss) body
walther@59718
   403
      ... Accept_Tac1 ... is correct*)
walther@59691
   404
"~~~~~ fun scan_dn1, args:"; val ((((thy',sr),d),ap), (is as (E,l,a,v,S,b), (m,_,pt,(p,p_),c)::ss), t) =
walther@59718
   405
     ((((y,s),d),ORundef), ((E, l@[R,D], a,v,S,b),ss), body);
walther@59772
   406
val (Program.Tac stac, a') = check_leaf "locate" thy' sr (E, (a, v)) t
walther@59627
   407
             val ctxt = get_ctxt pt (p,p_)
walther@59627
   408
             val p' = lev_on p : pos;
walther@59844
   409
(* WAS val Not_Associated = associate pt d (m, stac)
walther@59844
   410
      ... Associated ... is correct*)
walther@59627
   411
"~~~~~ fun associate, args:"; val (pt, _, (m as Check_elementwise' (consts,_,(consts_chkd,_))),
walther@59627
   412
    (Const ("Prog_Tac.Check'_elementwise",_) $ consts' $ _)) = (pt, d, m, stac);
walther@59868
   413
UnparseC.term consts;
walther@59868
   414
UnparseC.term consts';
walther@59627
   415
if consts = consts' (*WAS false*) then () else error "Check_elementwise changed";
walther@59627
   416
(*[z = 1 / 8 + sqrt (9 / 16) / 2, z = 1 / 8 + -1 * sqrt (9 / 16) / 2] TODO sqrt*)
walther@59679
   417
( *----- outcommented during cleanup of args in lucas-interpreter.sml ------------------------//*)
walther@59627
   418
walther@59627
   419
"----------- equality (2 +(-1)*x + x^^^2 = (0::real)) ----------------------------------------";
walther@59627
   420
"----------- equality (2 +(-1)*x + x^^^2 = (0::real)) ----------------------------------------";
walther@59627
   421
"----------- equality (2 +(-1)*x + x^^^2 = (0::real)) ----------------------------------------";
walther@59627
   422
"----- d2_pqformula1_neg ------";
walther@59627
   423
val fmz = ["equality (2 +(-1)*x + x^^^2 = (0::real))", "solveFor x","solutions L"];
walther@59627
   424
val (dI',pI',mI') = ("PolyEq",["pqFormula","degree_2","polynomial","univariate","equation"], ["PolyEq","solve_d2_polyeq_pq_equation"]);
walther@59627
   425
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   426
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   427
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   428
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   429
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   430
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   431
(*### or2list False
walther@59627
   432
  ([1],Res)  False   Or_to_List)*)
walther@59627
   433
val (p,_,f,nxt,_,pt) = me nxt p [] pt; 
walther@59627
   434
(*### or2list False                           
walther@59627
   435
  ([2],Res)  []      Check_elementwise "Assumptions"*)
walther@59627
   436
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   437
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59844
   438
val asm = Ctree.get_assumptions pt p;
walther@59627
   439
if f2str f = "[]" andalso 
walther@59868
   440
  UnparseC.terms asm = "[\"lhs (2 + -1 * x + x ^^^ 2 = 0) is_poly_in x\"," ^
walther@59627
   441
    "\"lhs (2 + -1 * x + x ^^^ 2 = 0) has_degree_in x = 2\"]" then ()
walther@59627
   442
else error "polyeq.sml: diff.behav. in 2 +(-1)*x + x^^^2 = 0";
walther@59627
   443
walther@59627
   444
"----------- equality (-2 +(-1)*x + 1*x^^^2 = 0) ---------------------------------------------";
walther@59627
   445
"----------- equality (-2 +(-1)*x + 1*x^^^2 = 0) ---------------------------------------------";
walther@59627
   446
"----------- equality (-2 +(-1)*x + 1*x^^^2 = 0) ---------------------------------------------";
walther@59627
   447
"----- d2_pqformula2 ------";
walther@59627
   448
val fmz = ["equality (-2 +(-1)*x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   449
val (dI',pI',mI') = ("PolyEq",["pqFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   450
                     ["PolyEq","solve_d2_polyeq_pq_equation"]);
walther@59627
   451
(*val p = e_pos'; 
walther@59627
   452
val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
walther@59627
   453
val (p,_,f,nxt,_,pt) = me (mI,m) p [] EmptyPtree;*)
walther@59627
   454
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   455
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   456
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   457
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   458
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   459
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   460
walther@59627
   461
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   462
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   463
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   464
case f of FormKF "[x = 2, x = -1]" => ()
walther@59627
   465
	 | _ => error "polyeq.sml: diff.behav. in -2 + (-1)*x + x^2 = 0 -> [x = 2, x = -1]";
walther@59627
   466
walther@59627
   467
walther@59627
   468
"----------- equality (-2 + x + x^^^2 = 0) ---------------------------------------------------";
walther@59627
   469
"----------- equality (-2 + x + x^^^2 = 0) ---------------------------------------------------";
walther@59627
   470
"----------- equality (-2 + x + x^^^2 = 0) ---------------------------------------------------";
walther@59627
   471
"----- d2_pqformula3 ------";
walther@59627
   472
(*EP-9*)
walther@59627
   473
val fmz = ["equality (-2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   474
val (dI',pI',mI') = ("PolyEq",["pqFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   475
                     ["PolyEq","solve_d2_polyeq_pq_equation"]);
walther@59627
   476
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   477
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   478
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   479
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   480
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   481
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   482
walther@59627
   483
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   484
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   485
val (p,_,f,nxt,_,pt) = me nxt p [] pt; 
walther@59627
   486
case f of FormKF "[x = 1, x = -2]" => ()
walther@59627
   487
	 | _ => error "polyeq.sml: diff.behav. in  -2 + x + x^2 = 0-> [x = 1, x = -2]";
walther@59627
   488
walther@59627
   489
walther@59627
   490
"----------- equality (2 + x + x^^^2 = 0) ----------------------------------------------------";
walther@59627
   491
"----------- equality (2 + x + x^^^2 = 0) ----------------------------------------------------";
walther@59627
   492
"----------- equality (2 + x + x^^^2 = 0) ----------------------------------------------------";
walther@59627
   493
"----- d2_pqformula3_neg ------";
walther@59627
   494
val fmz = ["equality (2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   495
val (dI',pI',mI') = ("PolyEq",["pqFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   496
                     ["PolyEq","solve_d2_polyeq_pq_equation"]);
walther@59627
   497
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   498
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   499
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   500
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   501
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   502
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   503
walther@59627
   504
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   505
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   506
"TODO 2 + x + x^^^2 = 0";
walther@59627
   507
"TODO 2 + x + x^^^2 = 0";
walther@59627
   508
"TODO 2 + x + x^^^2 = 0";
walther@59627
   509
walther@59627
   510
"----------- equality (-2 + x + 1*x^^^2 = 0)) ------------------------------------------------";
walther@59627
   511
"----------- equality (-2 + x + 1*x^^^2 = 0)) ------------------------------------------------";
walther@59627
   512
"----------- equality (-2 + x + 1*x^^^2 = 0)) ------------------------------------------------";
walther@59627
   513
"----- d2_pqformula4 ------";
walther@59627
   514
val fmz = ["equality (-2 + x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   515
val (dI',pI',mI') = ("PolyEq",["pqFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   516
                     ["PolyEq","solve_d2_polyeq_pq_equation"]);
walther@59627
   517
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   518
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   519
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   520
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   521
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   522
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   523
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   524
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   525
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   526
case f of FormKF "[x = 1, x = -2]" => ()
walther@59627
   527
	 | _ => error "polyeq.sml: diff.behav. in  -2 + x + 1*x^^^2 = 0 -> [x = 1, x = -2]";
walther@59627
   528
walther@59627
   529
"----------- equality (1*x +   x^^^2 = 0) ----------------------------------------------------";
walther@59627
   530
"----------- equality (1*x +   x^^^2 = 0) ----------------------------------------------------";
walther@59627
   531
"----------- equality (1*x +   x^^^2 = 0) ----------------------------------------------------";
walther@59627
   532
"----- d2_pqformula5 ------";
walther@59627
   533
val fmz = ["equality (1*x +   x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   534
val (dI',pI',mI') = ("PolyEq",["pqFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   535
                     ["PolyEq","solve_d2_polyeq_pq_equation"]);
walther@59627
   536
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   537
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   538
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   539
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   540
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   541
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   542
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   543
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   544
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   545
case f of FormKF "[x = 0, x = -1]" => ()
walther@59627
   546
	 | _ => error "polyeq.sml: diff.behav. in  1*x +   x^2 = 0 -> [x = 0, x = -1]";
walther@59627
   547
walther@59627
   548
"----------- equality (1*x + 1*x^^^2 = 0) ----------------------------------------------------";
walther@59627
   549
"----------- equality (1*x + 1*x^^^2 = 0) ----------------------------------------------------";
walther@59627
   550
"----------- equality (1*x + 1*x^^^2 = 0) ----------------------------------------------------";
walther@59627
   551
"----- d2_pqformula6 ------";
walther@59627
   552
val fmz = ["equality (1*x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   553
val (dI',pI',mI') = ("PolyEq",["pqFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   554
                     ["PolyEq","solve_d2_polyeq_pq_equation"]);
walther@59627
   555
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   556
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   557
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   558
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   559
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   560
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   561
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   562
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   563
val (p,_,f,nxt,_,pt) = me nxt p [] pt; 
walther@59627
   564
case f of FormKF "[x = 0, x = -1]" => ()
walther@59627
   565
	 | _ => error "polyeq.sml: diff.behav. in  1*x + 1*x^2 = 0 -> [x = 0, x = -1]";
walther@59627
   566
walther@59627
   567
"----------- equality (x +   x^^^2 = 0) ------------------------------------------------------";
walther@59627
   568
"----------- equality (x +   x^^^2 = 0) ------------------------------------------------------";
walther@59627
   569
"----------- equality (x +   x^^^2 = 0) ------------------------------------------------------";
walther@59627
   570
"----- d2_pqformula7 ------";
walther@59627
   571
(*EP-10*)
walther@59627
   572
val fmz = ["equality (  x +   x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   573
val (dI',pI',mI') = ("PolyEq",["pqFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   574
                     ["PolyEq","solve_d2_polyeq_pq_equation"]);
walther@59627
   575
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   576
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   577
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   578
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   579
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   580
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   581
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   582
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   583
val (p,_,f,nxt,_,pt) = me nxt p [] pt; 
walther@59627
   584
case f of FormKF "[x = 0, x = -1]" => ()
walther@59627
   585
	 | _ => error "polyeq.sml: diff.behav. in  x + x^2 = 0 -> [x = 0, x = -1]";
walther@59627
   586
walther@59627
   587
"----------- equality (x + 1*x^^^2 = 0) ------------------------------------------------------";
walther@59627
   588
"----------- equality (x + 1*x^^^2 = 0) ------------------------------------------------------";
walther@59627
   589
"----------- equality (x + 1*x^^^2 = 0) ------------------------------------------------------";
walther@59627
   590
"----- d2_pqformula8 ------";
walther@59627
   591
val fmz = ["equality (x + 1*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   592
val (dI',pI',mI') = ("PolyEq",["pqFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   593
                     ["PolyEq","solve_d2_polyeq_pq_equation"]);
walther@59627
   594
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   595
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   596
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   597
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   598
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   599
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   600
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   601
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   602
val (p,_,f,nxt,_,pt) = me nxt p [] pt; 
walther@59627
   603
case f of FormKF "[x = 0, x = -1]" => ()
walther@59627
   604
	 | _ => error "polyeq.sml: diff.behav. in  x + 1*x^2 = 0 -> [x = 0, x = -1]";
walther@59627
   605
walther@59627
   606
"----------- equality (-4 + x^^^2 = 0) -------------------------------------------------------";
walther@59627
   607
"----------- equality (-4 + x^^^2 = 0) -------------------------------------------------------";
walther@59627
   608
"----------- equality (-4 + x^^^2 = 0) -------------------------------------------------------";
walther@59627
   609
"----- d2_pqformula9 ------";
walther@59627
   610
val fmz = ["equality (-4 + x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   611
val (dI',pI',mI') = ("PolyEq",["pqFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   612
                     ["PolyEq","solve_d2_polyeq_pq_equation"]);
walther@59627
   613
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   614
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   615
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   616
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   617
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   618
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   619
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   620
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   621
case f of FormKF "[x = 2, x = -2]" => ()
walther@59627
   622
	 | _ => error "polyeq.sml: diff.behav. in -4 + x^2 = 0 -> [x = 2, x = -2]";
walther@59627
   623
walther@59627
   624
walther@59627
   625
"----------- equality (4 + 1*x^^^2 = 0) -------------------------------------------------------";
walther@59627
   626
"----------- equality (4 + 1*x^^^2 = 0) -------------------------------------------------------";
walther@59627
   627
"----------- equality (4 + 1*x^^^2 = 0) -------------------------------------------------------";
walther@59627
   628
"----- d2_pqformula9_neg ------";
walther@59627
   629
val fmz = ["equality (4 + 1*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   630
val (dI',pI',mI') = ("PolyEq",["pqFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   631
                     ["PolyEq","solve_d2_polyeq_pq_equation"]);
walther@59627
   632
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   633
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   634
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   635
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   636
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   637
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   638
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   639
"TODO 4 + 1*x^^^2 = 0";
walther@59627
   640
"TODO 4 + 1*x^^^2 = 0";
walther@59627
   641
"TODO 4 + 1*x^^^2 = 0";
walther@59627
   642
walther@59627
   643
"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
walther@59627
   644
"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
walther@59627
   645
"-------------------- test thm's d2_abc_formulsxx[_neg]-----";
walther@59627
   646
val fmz = ["equality (-1 +(-1)*x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   647
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   648
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   649
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   650
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   651
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   652
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   653
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   654
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   655
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   656
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   657
case f of FormKF "[x = 1, x = -1 / 2]" => ()
walther@59627
   658
	 | _ => error "polyeq.sml: diff.behav. in -1 + (-1)*x + 2*x^2 = 0 -> [x = 1, x = -1/2]";
walther@59627
   659
walther@59627
   660
"----------- equality (1 +(-1)*x + 2*x^^^2 = 0) ----------------------------------------------";
walther@59627
   661
"----------- equality (1 +(-1)*x + 2*x^^^2 = 0) ----------------------------------------------";
walther@59627
   662
"----------- equality (1 +(-1)*x + 2*x^^^2 = 0) ----------------------------------------------";
walther@59627
   663
val fmz = ["equality (1 +(-1)*x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   664
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   665
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   666
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   667
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   668
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   669
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   670
walther@59627
   671
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   672
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   673
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   674
"TODO 1 +(-1)*x + 2*x^^^2 = 0";
walther@59627
   675
"TODO 1 +(-1)*x + 2*x^^^2 = 0";
walther@59627
   676
"TODO 1 +(-1)*x + 2*x^^^2 = 0";
walther@59627
   677
walther@59627
   678
walther@59627
   679
"----------- equality (-1 + x + 2*x^^^2 = 0) -------------------------------------------------";
walther@59627
   680
"----------- equality (-1 + x + 2*x^^^2 = 0) -------------------------------------------------";
walther@59627
   681
"----------- equality (-1 + x + 2*x^^^2 = 0) -------------------------------------------------";
walther@59627
   682
(*EP-11*)
walther@59627
   683
val fmz = ["equality (-1 + x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   684
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   685
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   686
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   687
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   688
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   689
walther@59627
   690
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   691
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   692
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   693
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   694
walther@59627
   695
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   696
case f of FormKF "[x = 1 / 2, x = -1]" => ()
walther@59627
   697
	 | _ => error "polyeq.sml: diff.behav. in -1 + x + 2*x^2 = 0 -> [x = 1/2, x = -1]";
walther@59627
   698
walther@59627
   699
walther@59627
   700
"----------- equality (1 + x + 2*x^^^2 = 0) --------------------------------------------------";
walther@59627
   701
"----------- equality (1 + x + 2*x^^^2 = 0) --------------------------------------------------";
walther@59627
   702
"----------- equality (1 + x + 2*x^^^2 = 0) --------------------------------------------------";
walther@59627
   703
val fmz = ["equality (1 + x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   704
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   705
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   706
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   707
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   708
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   709
walther@59627
   710
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   711
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   712
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   713
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   714
val (p,_,f,nxt,_,pt) = me nxt p [] pt; 
walther@59627
   715
"TODO 1 + x + 2*x^^^2 = 0";
walther@59627
   716
"TODO 1 + x + 2*x^^^2 = 0";
walther@59627
   717
"TODO 1 + x + 2*x^^^2 = 0";
walther@59627
   718
walther@59627
   719
walther@59627
   720
val fmz = ["equality (-2 + 1*x + x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   721
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   722
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   723
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   724
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   725
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   726
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   727
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   728
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   729
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   730
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   731
case f of FormKF "[x = 1, x = -2]" => ()
walther@59627
   732
	 | _ => error "polyeq.sml: diff.behav. in -2 + 1*x + x^2 = 0 -> [x = 1, x = -2]";
walther@59627
   733
walther@59627
   734
val fmz = ["equality ( 2 + 1*x + x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   735
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   736
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   737
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   738
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   739
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   740
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   741
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   742
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   743
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   744
val (p,_,f,nxt,_,pt) = me nxt p [] pt; 
walther@59627
   745
"TODO 2 + 1*x + x^^^2 = 0";
walther@59627
   746
"TODO 2 + 1*x + x^^^2 = 0";
walther@59627
   747
"TODO 2 + 1*x + x^^^2 = 0";
walther@59627
   748
walther@59627
   749
(*EP-12*)
walther@59627
   750
val fmz = ["equality (-2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   751
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   752
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   753
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   754
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   755
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   756
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   757
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   758
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   759
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   760
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   761
case f of FormKF "[x = 1, x = -2]" => ()
walther@59627
   762
	 | _ => error "polyeq.sml: diff.behav. in -2 + x + x^2 = 0 -> [x = 1, x = -2]";
walther@59627
   763
walther@59627
   764
val fmz = ["equality ( 2 + x + x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   765
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   766
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   767
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   768
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   769
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   770
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   771
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   772
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   773
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   774
val (p,_,f,nxt,_,pt) = me nxt p [] pt; 
walther@59627
   775
"TODO 2 + x + x^^^2 = 0";
walther@59627
   776
"TODO 2 + x + x^^^2 = 0";
walther@59627
   777
"TODO 2 + x + x^^^2 = 0";
walther@59627
   778
walther@59627
   779
(*EP-13*)
walther@59627
   780
val fmz = ["equality (-8 + 2*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   781
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   782
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   783
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   784
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   785
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   786
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   787
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   788
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   789
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   790
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   791
case f of FormKF "[x = 2, x = -2]" => ()
walther@59627
   792
	 | _ => error "polyeq.sml: diff.behav. in -8 + 2*x^2 = 0 -> [x = 2, x = -2]";
walther@59627
   793
walther@59627
   794
val fmz = ["equality ( 8+ 2*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   795
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   796
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   797
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   798
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   799
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   800
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   801
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   802
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   803
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   804
"TODO 8+ 2*x^^^2 = 0";
walther@59627
   805
"TODO 8+ 2*x^^^2 = 0";
walther@59627
   806
"TODO 8+ 2*x^^^2 = 0";
walther@59627
   807
walther@59627
   808
(*EP-14*)
walther@59627
   809
val fmz = ["equality (-4 + x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   810
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"], ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   811
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   812
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   813
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   814
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   815
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   816
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   817
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   818
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   819
case f of FormKF "[x = 2, x = -2]" => ()
walther@59627
   820
	 | _ => error "polyeq.sml: diff.behav. in -4 + x^2 = 0 -> [x = 2, x = -2]";
walther@59627
   821
walther@59627
   822
walther@59627
   823
val fmz = ["equality ( 4+ x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   824
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"], ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   825
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   826
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   827
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   828
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   829
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   830
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   831
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   832
"TODO 4+ x^^^2 = 0";
walther@59627
   833
"TODO 4+ x^^^2 = 0";
walther@59627
   834
"TODO 4+ x^^^2 = 0";
walther@59627
   835
walther@59627
   836
(*EP-15*)
walther@59627
   837
val fmz = ["equality (2*x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   838
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   839
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   840
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   841
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   842
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   843
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   844
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   845
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   846
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   847
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   848
case f of FormKF "[x = 0, x = -1]" => ()
walther@59627
   849
	 | _ => error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1]";
walther@59627
   850
walther@59627
   851
val fmz = ["equality (1*x + x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   852
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   853
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   854
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   855
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   856
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   857
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   858
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   859
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   860
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   861
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   862
case f of FormKF "[x = 0, x = -1]" => ()
walther@59627
   863
	 | _ => error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1]";
walther@59627
   864
walther@59627
   865
(*EP-16*)
walther@59627
   866
val fmz = ["equality (x + 2*x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   867
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   868
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   869
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   870
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   871
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   872
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   873
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   874
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   875
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   876
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   877
case f of FormKF "[x = 0, x = -1 / 2]" => ()
walther@59627
   878
	 | _ => error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1 / 2]";
walther@59627
   879
walther@59627
   880
(*EP-//*)
walther@59627
   881
val fmz = ["equality (x + x^^^2 = 0)", "solveFor x","solutions L"];
walther@59627
   882
val (dI',pI',mI') = ("PolyEq",["abcFormula","degree_2","polynomial","univariate","equation"],
walther@59627
   883
                     ["PolyEq","solve_d2_polyeq_abc_equation"]);
walther@59627
   884
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   885
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   886
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   887
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   888
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   889
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   890
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   891
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   892
case f of FormKF "[x = 0, x = -1]" => ()
walther@59627
   893
	 | _ => error "polyeq.sml: diff.behav. in x + x^2 = 0 -> [x = 0, x = -1]";
walther@59627
   894
walther@59627
   895
walther@59627
   896
"----------- (-8 - 2*x + x^^^2 = 0),  (*Schalk 2, S.67 Nr.31.b----";
walther@59627
   897
"----------- (-8 - 2*x + x^^^2 = 0),  (*Schalk 2, S.67 Nr.31.b----";
walther@59627
   898
"----------- (-8 - 2*x + x^^^2 = 0),  (*Schalk 2, S.67 Nr.31.b----";
walther@59627
   899
(*stopped du to TODO.txt WN111014.TODO calculate_Poly < calculate_Rational < calculate_RootRat
walther@59627
   900
see --- val rls = calculate_RootRat > calculate_Rational ---
walther@59627
   901
calculate_RootRat was a TODO with 2002, requires re-design.
walther@59627
   902
see also --- (-8 - 2*x + x^^^2 = 0),  by rewriting --- below
walther@59627
   903
*)
walther@59627
   904
 val fmz = ["equality (-8 - 2*x + x^^^2 = 0)", (*Schalk 2, S.67 Nr.31.b*)
walther@59627
   905
 	    "solveFor x","solutions L"];
walther@59627
   906
 val (dI',pI',mI') =
walther@59627
   907
     ("PolyEq",["degree_2","expanded","univariate","equation"],
walther@59627
   908
      ["PolyEq","complete_square"]);
walther@59627
   909
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
   910
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   911
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   912
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   913
walther@59627
   914
val (p,_,f,nxt,_,pt) = me nxt p [] pt; val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   915
(*Apply_Method ("PolyEq","complete_square")*)
walther@59627
   916
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   917
(*"-8 - 2 * x + x ^^^ 2 = 0", nxt = Rewrite_Set_Inst ... "complete_square*)
walther@59627
   918
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   919
(*"-8 + (2 / 2 - x) ^^^ 2 = (2 / 2) ^^^ 2", nxt = Rewrite("square_explicit1"*)
walther@59627
   920
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   921
(*"(2 / 2 - x) ^^^ 2 = (2 / 2) ^^^ 2 - -8" nxt = Rewrite("root_plus_minus*)
walther@59627
   922
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   923
(*"2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |
walther@59627
   924
   2 / 2 - x = - sqrt ((2 / 2) ^^^ 2 - -8)" nxt = Rewr_Inst("bdv_explicit2"*)
walther@59627
   925
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   926
(*"2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |
walther@59627
   927
   -1*x = - (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8)"nxt = R_Inst("bdv_explt2"*)
walther@59627
   928
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   929
(*"-1 * x = - (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8) |
walther@59627
   930
   -1 * x = (- (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8))"nxt = bdv_explicit3*)
walther@59627
   931
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   932
(*"-1 * x = - (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8) |
walther@59627
   933
  x = -1 * (- (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8))" nxt = bdv_explicit3*)
walther@59627
   934
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   935
(*"x = -1 * (- (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8)) |
walther@59627
   936
   x = -1 * (- (2 / 2) + - sqrt ((2 / 2) ^^^ 2 - -8))"nxt = calculate_Rational
walther@59627
   937
   NOT IMPLEMENTED SINCE 2002 ------------------------------^^^^^^^^^^^^^^^^^^*)
walther@59627
   938
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   939
(*"x = -2 | x = 4" nxt = Or_to_List*)
walther@59627
   940
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
   941
(*"[x = -2, x = 4]" nxt = Check_Postcond*)
walther@59627
   942
val (p,_,f,nxt,_,pt) = me nxt p [] pt; f2str f;
walther@59627
   943
(* FIXXXME 
walther@59627
   944
 case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = -2, x = 4]")) => () TODO
walther@59627
   945
	 | _ => error "polyeq.sml: diff.behav. in [x = -2, x = 4]";
walther@59627
   946
*)
walther@59627
   947
if f2str f =
walther@59627
   948
"[x = -1 * -1 + -1 * sqrt (2 ^^^ 2 / 2 ^^^ 2 - -8),\n x = -1 * -1 + -1 * (-1 * sqrt (2 ^^^ 2 / 2 ^^^ 2 - -8))]"
walther@59627
   949
(*"[x = -1 * -1 + -1 * sqrt (1 ^^^ 2 - -8),\n x = -1 * -1 + -1 * (-1 * sqrt (1 ^^^ 2 - -8))]"*)
walther@59627
   950
then () else error "polyeq.sml corrected?behav. in [x = -2, x = 4]";
walther@59627
   951
walther@59627
   952
walther@59627
   953
"----------- (-8 - 2*x + x^^^2 = 0),  by rewriting ---------------";
walther@59627
   954
"----------- (-8 - 2*x + x^^^2 = 0),  by rewriting ---------------";
walther@59627
   955
"----------- (-8 - 2*x + x^^^2 = 0),  by rewriting ---------------";
walther@59627
   956
(*stopped du to TODO.txt WN111014.TODO calculate_Poly < calculate_Rational < calculate_RootRat
walther@59627
   957
see --- val rls = calculate_RootRat > calculate_Rational ---*)
walther@59627
   958
val thy = @{theory PolyEq};
walther@59627
   959
val ctxt = Proof_Context.init_global thy;
walther@59627
   960
val inst = [((the o (parseNEW  ctxt)) "bdv::real", (the o (parseNEW  ctxt)) "x::real")];
walther@59627
   961
val t = (the o (parseNEW  ctxt)) "-8 - 2*x + x^^^2 = (0::real)";
walther@59627
   962
walther@59627
   963
val rls = complete_square;
walther@59627
   964
val SOME (t,asm) = rewrite_set_inst_ thy true inst rls t;
walther@59868
   965
UnparseC.term t = "-8 + (2 / 2 - x) ^^^ 2 = (2 / 2) ^^^ 2";
walther@59627
   966
walther@59871
   967
val thm = ThmC.numerals_to_Free @{thm square_explicit1};
walther@59851
   968
val SOME (t,asm) = rewrite_ thy dummy_ord Rule_Set.Empty true thm t;
walther@59868
   969
UnparseC.term t = "(2 / 2 - x) ^^^ 2 = (2 / 2) ^^^ 2 - -8";
walther@59627
   970
walther@59871
   971
val thm = ThmC.numerals_to_Free @{thm root_plus_minus};
walther@59627
   972
val SOME (t,asm) = rewrite_ thy dummy_ord PolyEq_erls true thm t;
walther@59868
   973
UnparseC.term t = "2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |"^
walther@59627
   974
           "\n2 / 2 - x = -1 * sqrt ((2 / 2) ^^^ 2 - -8)";
walther@59627
   975
walther@59627
   976
(*the thm bdv_explicit2* here required to be constrained to ::real*)
walther@59871
   977
val thm = ThmC.numerals_to_Free @{thm bdv_explicit2};
walther@59851
   978
val SOME (t,asm) = rewrite_inst_ thy dummy_ord Rule_Set.Empty true inst thm t;
walther@59868
   979
UnparseC.term t = "2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |"^
walther@59627
   980
              "\n-1 * x = - (2 / 2) + -1 * sqrt ((2 / 2) ^^^ 2 - -8)";
walther@59627
   981
walther@59871
   982
val thm = ThmC.numerals_to_Free @{thm bdv_explicit3};
walther@59851
   983
val SOME (t,asm) = rewrite_inst_ thy dummy_ord Rule_Set.Empty true inst thm t;
walther@59868
   984
UnparseC.term t = "2 / 2 - x = sqrt ((2 / 2) ^^^ 2 - -8) |"^
walther@59627
   985
                   "\nx = -1 * (- (2 / 2) + -1 * sqrt ((2 / 2) ^^^ 2 - -8))";
walther@59627
   986
walther@59871
   987
val thm = ThmC.numerals_to_Free @{thm bdv_explicit2};
walther@59851
   988
val SOME (t,asm) = rewrite_inst_ thy dummy_ord Rule_Set.Empty true inst thm t;
walther@59868
   989
UnparseC.term t = "-1 * x = - (2 / 2) + sqrt ((2 / 2) ^^^ 2 - -8) |"^
walther@59627
   990
                "\nx = -1 * (- (2 / 2) + -1 * sqrt ((2 / 2) ^^^ 2 - -8))";
walther@59627
   991
walther@59627
   992
val rls = calculate_RootRat;
walther@59627
   993
val SOME (t,asm) = rewrite_set_ thy true rls t;
walther@59868
   994
if UnparseC.term t =
walther@59627
   995
  "-1 * x = -1 + sqrt (2 ^^^ 2 / 2 ^^^ 2 - -8) \<or>\nx = -1 * -1 + -1 * (-1 * sqrt (2 ^^^ 2 / 2 ^^^ 2 - -8))"
walther@59627
   996
(*"-1 * x = -1 + sqrt (2 ^^^ 2 / 2 ^^^ 2 - -8) |\nx = -1 * -1 + -1 * (-1 * sqrt (2 ^^^ 2 / 2 ^^^ 2 - -8))"..isabisac15*)
walther@59627
   997
then () else error "(-8 - 2*x + x^^^2 = 0),  by rewriting -- ERROR INDICATES IMPROVEMENT";
walther@59868
   998
(*SHOULD BE: UnparseC.term = "x = -2 | x = 4;*)
walther@59627
   999
walther@59627
  1000
walther@59627
  1001
"-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
walther@59627
  1002
"-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
walther@59627
  1003
"-------------------- (3 - 10*x + 3*x^^^2 = 0), ----------------------";
walther@59627
  1004
"---- test the erls ----";
walther@59627
  1005
 val t1 = (Thm.term_of o the o (parse thy)) "0 <= (10/3/2)^^^2 - 1";
walther@59627
  1006
 val SOME (t,_) = rewrite_set_ @{theory PolyEq} false PolyEq_erls t1;
walther@59868
  1007
 val t' = UnparseC.term t;
walther@59627
  1008
 (*if t'= "HOL.True" then ()
walther@59627
  1009
 else error "polyeq.sml: diff.behav. in 'rewrite_set_.. PolyEq_erls";*)
walther@59627
  1010
(* *)
walther@59627
  1011
 val fmz = ["equality (3 - 10*x + 3*x^^^2 = 0)",
walther@59627
  1012
 	    "solveFor x","solutions L"];
walther@59627
  1013
 val (dI',pI',mI') =
walther@59627
  1014
     ("PolyEq",["degree_2","expanded","univariate","equation"],
walther@59627
  1015
      ["PolyEq","complete_square"]);
walther@59627
  1016
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
  1017
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1018
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1019
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1020
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1021
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1022
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1023
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1024
 (*Apply_Method ("PolyEq","complete_square")*)
walther@59627
  1025
 val (p,_,f,nxt,_,pt) = me nxt p [] pt; f2str f;
walther@59627
  1026
walther@59627
  1027
"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
walther@59627
  1028
"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
walther@59627
  1029
"----------- (-16 + 4*x + 2*x^^^2 = 0), --------------------------";
walther@59627
  1030
 val fmz = ["equality (-16 + 4*x + 2*x^^^2 = 0)",
walther@59627
  1031
 	    "solveFor x","solutions L"];
walther@59627
  1032
 val (dI',pI',mI') =
walther@59627
  1033
     ("PolyEq",["degree_2","expanded","univariate","equation"],
walther@59627
  1034
      ["PolyEq","complete_square"]);
walther@59627
  1035
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
walther@59627
  1036
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1037
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1038
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1039
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1040
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1041
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1042
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1043
 (*Apply_Method ("PolyEq","complete_square")*)
walther@59627
  1044
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1045
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1046
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1047
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1048
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1049
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1050
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1051
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1052
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1053
 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
walther@59627
  1054
(* FIXXXXME n1.,
walther@59627
  1055
 case f of Form' (FormKF (~1,EdUndef,0,Nundef,"[x = 2, x = -4]")) => () TODO
walther@59627
  1056
	 | _ => error "polyeq.sml: diff.behav. in [x = 2, x = -4]";
walther@59627
  1057
*)
walther@59627
  1058