test/Tools/isac/Interpret/inform.sml
author Alexander Kargl <akargl@brgkepler.net>
Wed, 27 Jul 2011 08:43:58 +0200
branchdecompose-isar
changeset 42209 a12b724f1d37
parent 42176 3573fd729e99
child 42423 89afb340571c
permissions -rw-r--r--
intermed: uncommented tests
     1 (* Title: tests on inform.sml
     2    Author: Walther Neuper 060225,
     3    (c) due to copyright terms 
     4 
     5 use"../smltest/ME/inform.sml";
     6 use"inform.sml";
     7 *)
     8 
     9 "-----------------------------------------------------------------";
    10 "table of contents -----------------------------------------------";
    11 "-----------------------------------------------------------------";
    12 "appendForm with miniscript with mini-subpbl:";
    13 "--------- appendFormula: on Res + equ_nrls ----------------------";
    14 "--------- appendFormula: on Frm + equ_nrls ----------------------";
    15 "--------- appendFormula: on Res + NO deriv ----------------------";
    16 "--------- appendFormula: on Res + late deriv --------------------";
    17 "--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
    18 "replaceForm with miniscript with mini-subpbl:";
    19 "--------- replaceFormula: on Res + = ----------------------------";
    20 "--------- replaceFormula: on Res + = 1st Nd ---------------------";
    21 "--------- replaceFormula: on Frm + = 1st Nd ---------------------";
    22 "--------- replaceFormula: cut calculation -----------------------";
    23 "--------- replaceFormula: cut calculation -----------------------";
    24 (* 040307 copied from informtest.sml ... old versions
    25 "--------- maximum-example, UC: Modeling / modifyCalcHead --------";*)
    26 "--------- syntax error ------------------------------------------";
    27 "CAS-command:";
    28 "--------- CAS-command on ([],Pbl) -------------------------------";
    29 "--------- CAS-command on ([],Pbl) FE-interface ------------------";
    30 "--------- inform [rational,simplification] ----------------------";
    31 "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
    32 "--------- Take as 1st tac, start from exp -----------------------";
    33 "--------- init_form, start with <NEW> (CAS input) ---------------";
    34 "-----------------------------------------------------------------";
    35 "-----------------------------------------------------------------";
    36 "-----------------------------------------------------------------";
    37 
    38 
    39 
    40 
    41 
    42 
    43 "--------- appendFormula: on Res + equ_nrls ----------------------";
    44 "--------- appendFormula: on Res + equ_nrls ----------------------";
    45 "--------- appendFormula: on Res + equ_nrls ----------------------";
    46 
    47  val Script sc = (#scr o get_met) ["Test","squ-equ-test-subpbl1"];
    48  (writeln o term2str) sc;
    49  val Script sc = (#scr o get_met) ["Test","solve_linear"];
    50  (writeln o term2str) sc;
    51 
    52  states:=[];
    53  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    54 	    ("Test", ["sqroot-test","univariate","equation","test"],
    55 	     ["Test","squ-equ-test-subpbl1"]))];
    56  Iterator 1; moveActiveRoot 1;
    57  autoCalculate 1 CompleteCalcHead;
    58  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
    59  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
    60 
    61  appendFormula 1 "-2 * 1 + (1 + x) = 0"; refFormula 1 (get_pos 1 1);
    62  val ((pt,_),_) = get_calc 1;
    63  val str = pr_ptree pr_short pt;
    64 
    65  writeln str;
    66 (*============ inhibit exn AK110726 ==============================================
    67 (* 2nd string should be the same as 1st one *)
    68 ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n2.1.   x + 1 + -1 * 2 = 0\n2.2.   1 + x + -1 * 2 = 0\n2.3.   1 + (x + -1 * 2) = 0\n2.4.   1 + (x + -2) = 0\n2.5.   1 + (x + -2 * 1) = 0\n2.6.   1 + x + -2 * 1 = 0\n";
    69 ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n2.1.   x + 1 + -1 * 2 = 0\n2.2.   -1 * 2 + (x + 1) = 0\n2.3.   -1 * 2 + (1 + x) = 0\n2.4.   1 + (-1 * 2 + x) = 0\n2.5.   1 + (-2 + x) = 0\n2.6.   1 + (-2 * 1 + x) = 0\n";
    70  if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n2.1.   x + 1 + -1 * 2 = 0\n2.2.   -1 * 2 + (x + 1) = 0\n2.3.   -1 * 2 + (1 + x) = 0\n2.4.   1 + (-1 * 2 + x) = 0\n2.5.   1 + (-2 + x) = 0\n2.6.   1 + (-2 * 1 + x) = 0\n" then ()
    71    else error "inform.sml: diff.behav.appendFormula: on Res + equ 1";
    72 ============ inhibit exn AK110726 ==============================================*)
    73 
    74  moveDown 1 ([ ],Pbl); refFormula 1 ([1],Frm); (*x + 1 = 2*)
    75  moveDown 1 ([1],Frm); refFormula 1 ([1],Res); (*x + 1 + -1 * 2 = 0*)
    76 
    77  (*the seven steps of detailed derivation*)
    78  moveDown 1 ([1  ],Res); refFormula 1 ([2,1],Frm); 
    79  moveDown 1 ([2,1],Frm); refFormula 1 ([2,1],Res);
    80  moveDown 1 ([2,1],Res); refFormula 1 ([2,2],Res);
    81  moveDown 1 ([2,2],Res); refFormula 1 ([2,3],Res); 
    82  moveDown 1 ([2,3],Res); refFormula 1 ([2,4],Res);
    83  moveDown 1 ([2,4],Res); refFormula 1 ([2,5],Res);
    84  moveDown 1 ([2,5],Res); refFormula 1 ([2,6],Res);
    85  val ((pt,_),_) = get_calc 1;
    86  if "-2 * 1 + (1 + x) = 0" = term2str (fst (get_obj g_result pt [2,6])) then()
    87  else error "inform.sml: diff.behav.appendFormula: on Res + equ 2";
    88 
    89  fetchProposedTactic 1; (*takes Iterator 1 _1_*)
    90 
    91 (*============ inhibit exn AK110725 ==============================================
    92 (* ERROR: exception Bind raised *)
    93  val (_,(tac,_,_)::_) = get_calc 1;
    94  if tac = Rewrite_Set "Test_simplify" then ()
    95  else error "inform.sml: diff.behav.appendFormula: on Res + equ 3";
    96 ============ inhibit exn AK110725 ==============================================*)
    97 
    98  autoCalculate 1 CompleteCalc;
    99  val ((pt,_),_) = get_calc 1;
   100  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   101  else error "inform.sml: diff.behav.appendFormula: on Res + equ 4";
   102  (* autoCalculate 1 CompleteCalc;
   103    val ((pt,p),_) = get_calc 1;
   104    (writeln o istates2str) (get_obj g_loc pt [ ]);  
   105    (writeln o istates2str) (get_obj g_loc pt [1]);  
   106    (writeln o istates2str) (get_obj g_loc pt [2]);  
   107    (writeln o istates2str) (get_obj g_loc pt [3]);  
   108    (writeln o istates2str) (get_obj g_loc pt [3,1]);  
   109    (writeln o istates2str) (get_obj g_loc pt [3,2]);  
   110    (writeln o istates2str) (get_obj g_loc pt [4]);  
   111 
   112    *)
   113 "----------------------------------------------------------";
   114 
   115  val fod = make_deriv (@{theory "Isac"}) Atools_erls 
   116 		       ((#rules o rep_rls) Test_simplify)
   117 		       (sqrt_right false (@{theory "Pure"})) NONE 
   118 		       (str2term "x + 1 + -1 * 2 = 0");
   119  (writeln o trtas2str) fod;
   120 
   121  val ifod = make_deriv (@{theory "Isac"}) Atools_erls 
   122 		       ((#rules o rep_rls) Test_simplify)
   123 		       (sqrt_right false (@{theory "Pure"})) NONE 
   124 		       (str2term "-2 * 1 + (1 + x) = 0");
   125  (writeln o trtas2str) ifod;
   126  fun equal (_,_,(t1, _)) (_,_,(t2, _)) = t1 = t2;
   127  val (fod', rifod') = dropwhile' equal (rev fod) (rev ifod);
   128  val der = fod' @ (map rev_deriv' rifod');
   129  (writeln o trtas2str) der;
   130  "----------------------------------------------------------";
   131 
   132 
   133 "--------- appendFormula: on Frm + equ_nrls ----------------------";
   134 "--------- appendFormula: on Frm + equ_nrls ----------------------";
   135 "--------- appendFormula: on Frm + equ_nrls ----------------------";
   136  states:=[];
   137  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   138 	    ("Test", ["sqroot-test","univariate","equation","test"],
   139 	     ["Test","squ-equ-test-subpbl1"]))];
   140  Iterator 1; moveActiveRoot 1;
   141  autoCalculate 1 CompleteCalcHead;
   142  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x + 1 = 2*);
   143  appendFormula 1 "2+ -1 + x = 2"; refFormula 1 (get_pos 1 1);
   144 
   145  moveDown 1 ([],Pbl); refFormula 1 ([1],Frm) (*x + 1 = 2*);
   146 
   147  moveDown 1 ([1  ],Frm); refFormula 1 ([1,1],Frm); 
   148  moveDown 1 ([1,1],Frm); refFormula 1 ([1,1],Res); 
   149  moveDown 1 ([1,1],Res); refFormula 1 ([1,2],Res); 
   150  moveDown 1 ([1,2],Res); refFormula 1 ([1,3],Res); 
   151  moveDown 1 ([1,3],Res); refFormula 1 ([1,4],Res); 
   152  moveDown 1 ([1,4],Res); refFormula 1 ([1,5],Res); 
   153  moveDown 1 ([1,5],Res); refFormula 1 ([1,6],Res); 
   154  val ((pt,_),_) = get_calc 1;
   155  if "2 + -1 + x = 2" = term2str (fst (get_obj g_result pt [1,6])) then()
   156  else error "inform.sml: diff.behav.appendFormula: on Frm + equ 1";
   157 
   158  fetchProposedTactic 1; (*takes Iterator 1 _1_*)
   159  val (_,(tac,_,_)::_) = get_calc 1;
   160  if tac = Rewrite_Set "norm_equation" then ()
   161  else error "inform.sml: diff.behav.appendFormula: on Frm + equ 2";
   162  autoCalculate 1 CompleteCalc;
   163  val ((pt,_),_) = get_calc 1;
   164  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   165  else error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
   166 
   167 
   168 "--------- appendFormula: on Res + NO deriv ----------------------";
   169 "--------- appendFormula: on Res + NO deriv ----------------------";
   170 "--------- appendFormula: on Res + NO deriv ----------------------";
   171  states:=[];
   172  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   173 	    ("Test", ["sqroot-test","univariate","equation","test"],
   174 	     ["Test","squ-equ-test-subpbl1"]))];
   175  Iterator 1; moveActiveRoot 1;
   176  autoCalculate 1 CompleteCalcHead;
   177  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   178  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   179 
   180  appendFormula 1 "x = 2";
   181  val ((pt,p),_) = get_calc 1;
   182  val str = pr_ptree pr_short pt;
   183  writeln str;
   184  if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n" andalso p = ([1], Res)
   185  then ()
   186  else error "inform.sml: diff.behav.appendFormula: Res + NOder 1";
   187 
   188  fetchProposedTactic 1;
   189  val (_,(tac,_,_)::_) = get_calc 1;
   190  if tac = Rewrite_Set "Test_simplify" then ()
   191  else error "inform.sml: diff.behav.appendFormula: Res + NOder 2";
   192  autoCalculate 1 CompleteCalc;
   193  val ((pt,_),_) = get_calc 1;
   194  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   195  else error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
   196 
   197 
   198 "--------- appendFormula: on Res + late deriv --------------------";
   199 "--------- appendFormula: on Res + late deriv --------------------";
   200 "--------- appendFormula: on Res + late deriv --------------------";
   201  states:=[];
   202  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   203 	    ("Test", ["sqroot-test","univariate","equation","test"],
   204 	     ["Test","squ-equ-test-subpbl1"]))];
   205  Iterator 1; moveActiveRoot 1;
   206  autoCalculate 1 CompleteCalcHead;
   207  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   208  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   209 
   210  appendFormula 1 "x = 1";
   211  val ((pt,p),_) = get_calc 1;
   212  val str = pr_ptree pr_short pt;
   213  writeln str;
   214  if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n3.    ----- pblobj -----\n3.1.   -1 + x = 0\n3.2.   x = 0 + -1 * -1\n3.2.1.   x = 0 + -1 * -1\n3.2.2.   x = 0 + 1\n" andalso p = ([3,2], Res)
   215  then () (*finds 1 step too early: ([3,2], Res) "x = 1" also by script !!!*)
   216  else error "inform.sml: diff.behav.appendFormula: Res + late d 1";
   217 
   218  fetchProposedTactic 1;
   219  val (_,(tac,_,_)::_) = get_calc 1;
   220  if tac = Check_Postcond ["linear", "univariate", "equation", "test"] then ()
   221  else error "inform.sml: diff.behav.appendFormula: Res + late d 2";
   222  autoCalculate 1 CompleteCalc;
   223  val ((pt,_),_) = get_calc 1;
   224  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   225  else error "inform.sml: diff.behav.appendFormula: Res + late d 3";
   226 
   227 
   228 "--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
   229 "--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
   230 "--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
   231  states:=[];
   232  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   233 	    ("Test", ["sqroot-test","univariate","equation","test"],
   234 	     ["Test","squ-equ-test-subpbl1"]))];
   235  Iterator 1; moveActiveRoot 1;
   236  autoCalculate 1 CompleteCalcHead;
   237  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   238  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   239  appendFormula 1 "[x = 3 + -2*1]";
   240  val ((pt,p),_) = get_calc 1;
   241  val str = pr_ptree pr_short pt;
   242  writeln str;
   243  if str=".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n3.    ----- pblobj -----\n3.1.   -1 + x = 0\n3.2.   x = 0 + -1 * -1\n4.   [x = 1]\n4.1.   [x = 1]\n4.2.   [x = -2 + 3]\n4.3.   [x = 3 + -2]\n" then ()
   244  else error "inform.sml: diff.behav.appendFormula: Res + latEE 1";
   245  autoCalculate 1 CompleteCalc;
   246  val ((pt,p),_) = get_calc 1;
   247  if "[x = 3 + -2 * 1]" = term2str (fst (get_obj g_result pt [])) then ()
   248  (*       ~~~~~~~~~~ simplify as last step in any script ?!*)
   249  else error "inform.sml: diff.behav.appendFormula: Res + latEE 2";
   250 
   251 
   252 
   253 "--------- replaceFormula: on Res + = ----------------------------";
   254 "--------- replaceFormula: on Res + = ----------------------------";
   255 "--------- replaceFormula: on Res + = ----------------------------";
   256  states:=[];
   257  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   258 	    ("Test", ["sqroot-test","univariate","equation","test"],
   259 	     ["Test","squ-equ-test-subpbl1"]))];
   260  Iterator 1; moveActiveRoot 1;
   261  autoCalculate 1 CompleteCalcHead;
   262  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   263  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   264  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*-1 + x*);
   265 
   266  replaceFormula 1 "-2 * 1 + (1 + x) = 0"; refFormula 1 (get_pos 1 1);
   267  val ((pt,_),_) = get_calc 1;
   268  val str = pr_ptree pr_short pt;
   269  writeln str;
   270 
   271 (*============ inhibit exn AK110725 ==============================================
   272 (* 2nd string should be the same as 1st one *)
   273 ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n2.1.   x + 1 + -1 * 2 = 0\n2.2.   1 + x + -1 * 2 = 0\n2.3.   1 + (x + -1 * 2) = 0\n2.4.   1 + (x + -2) = 0\n2.5.   1 + (x + -2 * 1) = 0\n2.6.   1 + x + -2 * 1 = 0\n";
   274 ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n2.1.   x + 1 + -1 * 2 = 0\n2.2.   -1 * 2 + (x + 1) = 0\n2.3.   -1 * 2 + (1 + x) = 0\n2.4.   1 + (-1 * 2 + x) = 0\n2.5.   1 + (-2 + x) = 0\n2.6.   1 + (-2 * 1 + x) = 0\n";
   275  if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n2.1.   x + 1 + -1 * 2 = 0\n2.2.   -1 * 2 + (x + 1) = 0\n2.3.   -1 * 2 + (1 + x) = 0\n2.4.   1 + (-1 * 2 + x) = 0\n2.5.   1 + (-2 + x) = 0\n2.6.   1 + (-2 * 1 + x) = 0\n" then()
   276  else error "inform.sml: diff.behav.replaceFormula: on Res += 1";
   277 ============ inhibit exn AK110725 ==============================================*)
   278 
   279  autoCalculate 1 CompleteCalc;
   280  val ((pt,pos as (p,_)),_) = get_calc 1;
   281  if pos = ([],Res) andalso "[x = 1]" = (term2str o fst) (get_obj g_result pt p) then()
   282  else error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
   283  
   284 
   285 "--------- replaceFormula: on Res + = 1st Nd ---------------------";
   286 "--------- replaceFormula: on Res + = 1st Nd ---------------------";
   287 "--------- replaceFormula: on Res + = 1st Nd ---------------------";
   288  states:=[];
   289  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   290 	    ("Test", ["sqroot-test","univariate","equation","test"],
   291 	     ["Test","squ-equ-test-subpbl1"]))];
   292  Iterator 1; moveActiveRoot 1;
   293  autoCalculate 1 CompleteCalcHead;
   294  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   295  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   296 
   297  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   298  val ((pt,_),_) = get_calc 1;
   299  val str = pr_ptree pr_short pt;
   300  writeln str;
   301  if str= ".    ----- pblobj -----\n1.   x + 1 = 2\n1.1.   x + 1 = 2\n1.2.   1 + x = 2\n1.3.   1 + x = -2 + 4\n1.4.   x + 1 = -2 + 4\n" then ()
   302  else error "inform.sml: diff.behav.replaceFormula: on Res 1 + = 1";
   303  autoCalculate 1 CompleteCalc;
   304  val ((pt,pos as (p,_)),_) = get_calc 1;
   305  if pos = ([],Res) andalso "[x = 1]" = (term2str o fst)(get_obj g_result pt p) then()
   306  else error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
   307 
   308 
   309 "--------- replaceFormula: on Frm + = 1st Nd ---------------------";
   310 "--------- replaceFormula: on Frm + = 1st Nd ---------------------";
   311 "--------- replaceFormula: on Frm + = 1st Nd ---------------------";
   312  states:=[];
   313  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   314 	    ("Test", ["sqroot-test","univariate","equation","test"],
   315 	     ["Test","squ-equ-test-subpbl1"]))];
   316  Iterator 1; moveActiveRoot 1;
   317  autoCalculate 1 CompleteCalcHead;
   318  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   319 
   320  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   321  val ((pt,_),_) = get_calc 1;
   322  val str = pr_ptree pr_short pt;
   323  writeln str;
   324  if str= ".    ----- pblobj -----\n1.   x + 1 = 2\n1.1.   x + 1 = 2\n1.2.   1 + x = 2\n1.3.   1 + x = -2 + 4\n1.4.   x + 1 = -2 + 4\n" then ()
   325  else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 1";
   326  autoCalculate 1 CompleteCalc;
   327  val ((pt,pos as (p,_)),_) = get_calc 1;
   328  if pos = ([],Res) andalso "[x = 1]" = (term2str o fst)(get_obj g_result pt p) then()
   329  else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 2";
   330 
   331 
   332 "--------- replaceFormula: cut calculation -----------------------";
   333 "--------- replaceFormula: cut calculation -----------------------";
   334 "--------- replaceFormula: cut calculation -----------------------";
   335  states:=[];
   336  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   337 	    ("Test", ["sqroot-test","univariate","equation","test"],
   338 	     ["Test","squ-equ-test-subpbl1"]))];
   339  Iterator 1; moveActiveRoot 1;
   340  autoCalculate 1 CompleteCalc;
   341  moveActiveRoot 1; moveActiveDown 1;
   342  if get_pos 1 1 = ([1], Frm) then ()
   343  else error "inform.sml: diff.behav. cut calculation 1";
   344 
   345  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   346  val ((pt,p),_) = get_calc 1;
   347  val str = pr_ptree pr_short pt;
   348  writeln str;
   349  if p = ([1], Res) then ()
   350  else error "inform.sml: diff.behav. cut calculation 2";
   351 
   352 
   353 (* 040307 copied from informtest.sml; ... old version 
   354  "---------------- maximum-example, UC: Modeling / modifyCalcHead -";
   355  "---------------- maximum-example, UC: Modeling / modifyCalcHead -";
   356  "---------------- maximum-example, UC: Modeling / modifyCalcHead -";
   357 
   358  val p = ([],Pbl);
   359  val elems = ["fixedValues [r=Arbfix]","maximum A","valuesFor [a,b]",
   360 	      "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
   361 	      "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
   362 	      "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
   363 	      (*^^^ these are the elements for the root-problem (in variants)*)
   364               (*vvv these are elements required for subproblems*)
   365 	      "boundVariable a","boundVariable b","boundVariable alpha",
   366 	      "interval {x::real. 0 <= x & x <= 2*r}",
   367 	      "interval {x::real. 0 <= x & x <= 2*r}",
   368 	      "interval {x::real. 0 <= x & x <= pi}",
   369 	      "errorBound (eps=(0::real))"]
   370  (*specifying is not interesting for this example*)
   371  val spec = ("DiffApp", ["maximum_of","function"], 
   372 	     ["DiffApp","max_by_calculus"]);
   373  (*the empty model with descriptions for user-guidance by Model_Problem*)
   374  val empty_model = [Given ["fixedValues []"],
   375 		    Find ["maximum", "valuesFor"],
   376 		    Relate ["relations []"]];
   377 
   378 
   379  (*!!!!!!!!!!!!!!!!! DON'T USE me FOR FINDING nxt !!!!!!!!!!!!!!!!!!*)
   380  val (p,_,f,nxt,_,pt) = CalcTreeTEST [(elems, spec)];
   381  (*val nxt = ("Model_Problem", ...*)
   382  val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl; 
   383 
   384  val (p,_,f,nxt,_,pt) = me nxt p c pt;
   385  (*nxt = Add_Given "fixedValues [r = Arbfix]"*)
   386  val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl; 
   387 (*[
   388 (0 ,[] ,false ,#Given ,Inc fixedValues [] ,(??.empty, [])),
   389 (0 ,[] ,false ,#Find ,Inc maximum ,(??.empty, [])),
   390 (0 ,[] ,false ,#Find ,Inc valuesFor ,(??.empty, [])),
   391 (0 ,[] ,false ,#Relate ,Inc relations [] ,(??.empty, []))]*)
   392 
   393  (*the empty CalcHead is checked w.r.t the model and re-established as such*)
   394  val (b,pt,ocalhd) = input_icalhd pt (p,"", empty_model, Pbl, e_spec);
   395  val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl; 
   396  if ocalhd2str ocalhd = "(Pbl, ??.empty, [\n(0 ,[] ,false ,#Given ,Inc fixedValues [] ,(??.empty, [])),\n(0 ,[] ,false ,#Find ,Inc maximum ,(??.empty, [])),\n(0 ,[] ,false ,#Find ,Inc valuesFor ,(??.empty, [])),\n(0 ,[] ,false ,#Relate ,Inc relations [] ,(??.empty, []))], [], \n(\"e_domID\", [\"e_pblID\"], [\"e_metID\"]) )" then () else error "informtest.sml: diff.behav. max 1";
   397 
   398  (*there is one input to the model (could be more)*)
   399  val (b,pt,ocalhd) = 
   400      input_icalhd pt (p,"", [Given ["fixedValues [r=Arbfix]"],
   401 			     Find ["maximum", "valuesFor"],
   402 			     Relate ["relations"]], Pbl, e_spec);
   403  val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl; 
   404  if ocalhd2str ocalhd = "(Pbl, ??.empty, [\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(0 ,[] ,false ,#Find ,Inc maximum ,(??.empty, [])),\n(0 ,[] ,false ,#Find ,Inc valuesFor ,(??.empty, [])),\n(0 ,[] ,false ,#Relate ,Inc relations [] ,(??.empty, []))], [], \n(\"e_domID\", [\"e_pblID\"], [\"e_metID\"]) )" then () 
   405  else error "informtest.sml: diff.behav. max 2";
   406 
   407  (*this input is complete in variant 3, but the ME doesn't recognize FIXXXXME
   408  val (b,pt''''',ocalhd) = 
   409      input_icalhd pt (p,"", [Given ["fixedValues [r=Arbfix]"],
   410 			     Find ["maximum A", "valuesFor [a,b]"],
   411 			     Relate ["relations [A=a*b, a/2=r*sin alpha, \
   412 				     \b/2=r*cos alpha]"]], Pbl, e_spec);
   413  val pbl = get_obj g_pbl pt''''' (fst p); (writeln o (itms2str_ ctxt)) pbl; 
   414  if ocalhd2str ocalhd = ------------^^^^^^^^^^ missing !!!*)
   415 
   416  (*this input is complete in variant 1 (variant 3 does not work yet)*)
   417  val (b,pt''''',ocalhd) = 
   418      input_icalhd pt (p,"", [Given ["fixedValues [r=Arbfix]"],
   419 			     Find ["maximum A", "valuesFor [a,b]"],
   420 			     Relate ["relations [A=a*b, \
   421 				     \(a/2)^^^2 + (b/2)^^^2 = r^^^2]"]], 
   422 		      Pbl, e_spec);
   423  val pbl = get_obj g_pbl pt''''' (fst p); (writeln o (itms2str_ ctxt)) pbl; 
   424 
   425  modifycalcheadOK2xml 111 (bool2str b) ocalhd;
   426 *)
   427 
   428 "--------- syntax error ------------------------------------------";
   429 "--------- syntax error ------------------------------------------";
   430 "--------- syntax error ------------------------------------------";
   431  states:=[];
   432  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   433 	    ("Test", ["sqroot-test","univariate","equation","test"],
   434 	     ["Test","squ-equ-test-subpbl1"]))];
   435  Iterator 1; moveActiveRoot 1;
   436  autoCalculate 1 CompleteCalcHead;
   437  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   438  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   439 
   440  appendFormula 1 " x - "; (*<ERROR> syntax error in ' x - ' </ERROR>*)
   441  val ((pt,_),_) = get_calc 1;
   442  val str = pr_ptree pr_short pt;
   443  writeln str;
   444  if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n" then ()
   445  else error "inform.sml: diff.behav.appendFormula: syntax error";
   446 
   447 
   448 "--------- CAS-command on ([],Pbl) -------------------------------";
   449 "--------- CAS-command on ([],Pbl) -------------------------------";
   450 "--------- CAS-command on ([],Pbl) -------------------------------";
   451 val (p,_,f,nxt,_,pt) = 
   452     CalcTreeTEST [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
   453 val ifo = "solve(x+1=2,x)";
   454 val (_,(_,c,(pt,p))) = inform ([],[],(pt,p)) "solve(x+1=2,x)";
   455 show_pt pt;
   456 val nxt = ("Apply_Method",Apply_Method ["Test","squ-equ-test-subpbl1"]);
   457 val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   458 if p = ([1], Frm) andalso f2str f = "x + 1 = 2" then ()
   459 else error "inform.sml: diff.behav. CAScmd ([],Pbl)";
   460 
   461 
   462 "--------- CAS-command on ([],Pbl) FE-interface ------------------";
   463 "--------- CAS-command on ([],Pbl) FE-interface ------------------";
   464 "--------- CAS-command on ([],Pbl) FE-interface ------------------";
   465 states:=[];
   466 CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
   467 Iterator 1;
   468 moveActiveRoot 1;
   469 replaceFormula 1 "solve(x+1=2,x)";
   470 autoCalculate 1 CompleteCalc;
   471 val ((pt,p),_) = get_calc 1;
   472 show_pt pt;
   473 if p = ([], Res) then ()
   474 else error "inform.sml: diff.behav. CAScmd ([],Pbl) FE-interface";
   475 
   476 
   477 "--------- inform [rational,simplification] ----------------------";
   478 "--------- inform [rational,simplification] ----------------------";
   479 "--------- inform [rational,simplification] ----------------------";
   480 states:=[];
   481 CalcTree [(["Term (4/x - 3/y - 1)", "normalform N"],
   482 	   ("Rational",["rational","simplification"],
   483 	    ["simplification","of_rationals"]))];
   484 Iterator 1; moveActiveRoot 1;
   485 autoCalculate 1 CompleteCalcHead;
   486 autoCalculate 1 (Step 1);
   487 autoCalculate 1 (Step 1);
   488 autoCalculate 1 (Step 1);
   489 autoCalculate 1 (Step 1);
   490 "--- input the next formula that _should_ be presented by mat-engine";
   491 appendFormula 1 "(4 * y + -3 * x) / (x * y) + -1";
   492 val ((pt,p),_) = get_calc 1;
   493 if p = ([4], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
   494 else error ("inform.sml: [rational,simplification] 1");
   495 
   496 "--- input the next formula that would be presented by mat-engine";
   497 (*autoCalculate 1 (Step 1);*)
   498 appendFormula 1 "(4 * y + -3 * x + -1 * (x * y)) / (x * y)";
   499 val ((pt,p),_) = get_calc 1;
   500 if p = ([5], Res) andalso (length o children o (get_nd pt)) (fst p) = 0 then ()
   501 else error ("inform.sml: [rational,simplification] 2");
   502 
   503 "--- input the exact final result";(*TODO: Exception- LIST "last_elem" raised*)
   504 appendFormula 1 "(-3 * x + 4 * y + -1 * x * y) / (x * y)";
   505 val ((pt,p),_) = get_calc 1;
   506 if p = ([6], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
   507 else error ("inform.sml: [rational,simplification] 3");
   508 show_pt pt;
   509 
   510 "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
   511 "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
   512 "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
   513 val t = str2term "Diff (x^^^2 + x + 1, x)";
   514 case t of Const ("Diff.Diff", _) $ _ => ()
   515 	| _ => raise 
   516 	      error "diff.sml behav.changed for CAS Diff (..., x)";
   517 atomty t;
   518 "-----------------------------------------------------------------";
   519 (*1>*)states:=[];
   520 (*2>*)CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
   521 (*3>*)Iterator 1;moveActiveRoot 1;
   522 "----- here the Headline has been finished";
   523 (*4>*)moveActiveFormula 1 ([],Pbl);
   524 (*5>*)replaceFormula 1 "Diff (x^2 + x + 1, x)";
   525 val ((pt,_),_) = get_calc 1;
   526 val PblObj {probl, meth, spec, fmz, env, loc, ...} = get_obj I pt [];
   527 val NONE = env;
   528 val (SOME istate, NONE) = loc;
   529 print_depth 5;
   530 writeln"-----------------------------------------------------------";
   531 spec;
   532 writeln (itms2str_ ctxt probl);
   533 writeln (itms2str_ ctxt meth);
   534 
   535 (*============ inhibit exn AK110725 ==============================================
   536 (* ERROR: Argument: istate : istate * Proof.context Reason: 
   537         Can't unify istate to istate * Proof.context *)
   538 writeln (istate2str istate);
   539 ============ inhibit exn AK110725 ==============================================*)
   540 
   541 print_depth 3;
   542 
   543 refFormula 1 ([],Pbl) (*--> correct CalcHead*);
   544  (*081016 NOT necessary (but leave it in Java):*)
   545 (*6>*)(*completeCalcHead*)autoCalculate 1 CompleteCalcHead;
   546 "----- here the CalcHead has been completed --- ONCE MORE ?????";
   547 
   548 (***difference II***)
   549 val ((pt,p),_) = get_calc 1;
   550 (*val p = ([], Pbl)*)
   551 val PblObj {probl, meth, spec, fmz, env, loc, ...} = get_obj I pt [];
   552 val NONE = env;
   553 val (SOME istate, NONE) = loc;
   554 (*============ inhibit exn AK110725 ==============================================
   555 (* ERROR: Argument: istate : istate * Proof.context Reason: Can't unify istate to istate * Proof.context *)
   556 print_depth 5; writeln (istate2str istate);  print_depth 3;
   557 ============ inhibit exn AK110725 ==============================================*)
   558 (*ScrState ([],
   559  [], NONE,
   560  ??.empty, Sundef, false)*)
   561 print_depth 5; spec; print_depth 3;
   562 (*("Isac",
   563       ["derivative_of", "function"],
   564       ["diff", "differentiate_on_R"]) : spec*)
   565 writeln (itms2str_ ctxt probl);
   566 (*[
   567 (1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
   568 (2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
   569 (3 ,[1] ,true ,#Find ,Cor derivative f_'_f ,(f_'_f, [f_'_f]))]*)
   570 writeln (itms2str_ ctxt meth);
   571 (*[
   572 (1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
   573 (2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
   574 (3 ,[1] ,true ,#Find ,Cor derivative f_'_f ,(f_'_f, [f_'_f]))]*)
   575 writeln"-----------------------------------------------------------";
   576 (*7>*)fetchProposedTactic 1 (*--> Apply_Method*);
   577 (*WN081028 fixed <ERROR> helpless </ERROR> by inform returning ...(.,Met)*)
   578 autoCalculate 1 CompleteCalc;
   579 val ((pt,p),_) = get_calc 1;
   580 val Form res = (#1 o pt_extract) (pt, ([],Res));
   581 show_pt pt;
   582 if p = ([], Res) andalso term2str res = "1 + 2 * x" then ()
   583 else error "diff.sml behav.changed for Diff (x^2 + x + 1, x)";
   584 
   585 
   586 "--------- Take as 1st tac, start from exp -----------------------";
   587 "--------- Take as 1st tac, start from exp -----------------------";
   588 "--------- Take as 1st tac, start from exp -----------------------";
   589 (*the following input is copied from BridgeLog Java <==> SML,
   590   omitting unnecessary inputs*)
   591 (*1>*)states:=[];
   592 (*2>*)CalcTree [(["functionTerm (x^2 + x + 1)", "differentiateFor x", "derivative f_'_f"],("Isac",["derivative_of","function"],["diff","differentiate_on_R"]))];
   593 (*3>*)Iterator 1; moveActiveRoot 1;
   594 
   595 (*6>*)(*completeCalcHead*)autoCalculate 1 CompleteCalcHead;
   596 (***difference II***)
   597 val ((pt,_),_) = get_calc 1;
   598 val PblObj {probl, meth, spec, fmz, env, loc, ...} = get_obj I pt [];
   599 val NONE = env;
   600 val (SOME istate, NONE) = loc;
   601 (*============ inhibit exn AK110725 ==============================================
   602 (* ERROR: Argument: istate : istate * Proof.context Reason: Can't unify istate to istate * Proof.context *)
   603 print_depth 5; writeln (istate2str istate);  print_depth 3;
   604 ============ inhibit exn AK110725 ==============================================*)
   605 (*ScrState ([],
   606  [], NONE,
   607  ??.empty, Sundef, false)*)
   608 print_depth 5; spec; print_depth 3;
   609 (*("Isac",
   610       ["derivative_of", "function"],
   611       ["diff", "differentiate_on_R"]) : spec*)
   612 writeln (itms2str_ ctxt probl);
   613 (*[
   614 (1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
   615 (2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
   616 (3 ,[1] ,true ,#Find ,Cor derivative f_'_f ,(f_'_f, [f_'_f]))]*)
   617 writeln (itms2str_ ctxt meth);
   618 (*[
   619 (1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
   620 (2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
   621 (3 ,[1] ,true ,#Find ,Cor derivative f_'_f ,(f_'_f, [f_'_f]))]*)
   622 writeln"-----------------------------------------------------------";
   623 (*7>*)fetchProposedTactic 1 (*--> Apply_Method*);
   624 autoCalculate 1 (Step 1);
   625 val ((pt,p),_) = get_calc 1;
   626 val Form res = (#1 o pt_extract) (pt, p);
   627 if term2str res = "d_d x (x ^^^ 2 + x + 1)" then ()
   628 else error "diff.sml Diff (x^2 + x + 1, x) from exp";
   629 
   630 
   631 "--------- init_form, start with <NEW> (CAS input) ---------------";
   632 "--------- init_form, start with <NEW> (CAS input) ---------------";
   633 "--------- init_form, start with <NEW> (CAS input) ---------------";
   634 states:=[];
   635 CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
   636 (*[[from sml: > @@@@@begin@@@@@
   637 [[from sml:  1 
   638 [[from sml: <CALCTREE>
   639 [[from sml:    <CALCID> 1 </CALCID>
   640 [[from sml: </CALCTREE>
   641 [[from sml: @@@@@end@@@@@*)
   642 Iterator 1;
   643 (*[[from sml: > @@@@@begin@@@@@
   644 [[from sml:  1 
   645 [[from sml: <ADDUSER>
   646 [[from sml:   <CALCID> 1 </CALCID>
   647 [[from sml:   <USERID> 1 </USERID>
   648 [[from sml: </ADDUSER>
   649 [[from sml: @@@@@end@@@@@*)
   650 moveActiveRoot 1;
   651 (*[[from sml: > @@@@@begin@@@@@
   652 [[from sml:  1 
   653 [[from sml: <CALCITERATOR>
   654 [[from sml:   <CALCID> 1 </CALCID>
   655 [[from sml:   <POSITION>
   656 [[from sml:     <INTLIST>
   657 [[from sml:     </INTLIST>
   658 [[from sml:     <POS> Pbl </POS>
   659 [[from sml:   </POSITION>
   660 [[from sml: </CALCITERATOR>
   661 [[from sml: @@@@@end@@@@@*)
   662 getFormulaeFromTo 1 ([],Pbl) ([],Pbl) 0 false;
   663 (*[[from sml: > @@@@@begin@@@@@                STILL CORRECT
   664 [[from sml:  1 
   665 [[from sml: <GETELEMENTSFROMTO>
   666 [[from sml:   <CALCID> 1 </CALCID>
   667 [[from sml:   <FORMHEADS>
   668 [[from sml:     <CALCFORMULA>
   669 [[from sml:       <POSITION>
   670 [[from sml:         <INTLIST>
   671 [[from sml:         </INTLIST>
   672 [[from sml:         <POS> Pbl </POS>
   673 [[from sml:       </POSITION>
   674 [[from sml:       <FORMULA>
   675 [[from sml:         <MATHML>
   676 [[from sml:           <ISA> ________________________________________________ </ISA>
   677 [[from sml:         </MATHML>
   678 [[from sml: 
   679 [[from sml:       </FORMULA>
   680 [[from sml:     </CALCFORMULA>
   681 [[from sml:   </FORMHEADS>
   682 [[from sml: </GETELEMENTSFROMTO>
   683 [[from sml: @@@@@end@@@@@*)
   684 refFormula 1 ([],Pbl);
   685 (*[[from sml: > @@@@@begin@@@@@                STILL CORRECT
   686 [[from sml:  1 
   687 [[from sml: <REFFORMULA>
   688 [[from sml:   <CALCID> 1 </CALCID>
   689 [[from sml:   <CALCHEAD status = "incorrect">
   690 [[from sml:     <POSITION>
   691 [[from sml:       <INTLIST>
   692 [[from sml:       </INTLIST>
   693 [[from sml:       <POS> Pbl </POS>
   694 [[from sml:     </POSITION>
   695 [[from sml:     <HEAD>
   696 [[from sml:       <MATHML>
   697 [[from sml:         <ISA> Problem (e_domID, [e_pblID]) </ISA>
   698 [[from sml:       </MATHML>
   699 [[from sml:     </HEAD>
   700 [[from sml:     <MODEL>
   701 [[from sml:       <GIVEN>  </GIVEN>
   702 [[from sml:       <WHERE>  </WHERE>
   703 [[from sml:       <FIND>  </FIND>
   704 [[from sml:       <RELATE>  </RELATE>
   705 [[from sml:     </MODEL>
   706 [[from sml:     <BELONGSTO> Pbl </BELONGSTO>
   707 [[from sml:     <SPECIFICATION>
   708 [[from sml:       <THEORYID> e_domID </THEORYID>
   709 [[from sml:       <PROBLEMID>
   710 [[from sml:         <STRINGLIST>
   711 [[from sml:           <STRING> e_pblID </STRING>
   712 [[from sml:         </STRINGLIST>
   713 [[from sml:       </PROBLEMID>
   714 [[from sml:       <METHODID>
   715 [[from sml:         <STRINGLIST>
   716 [[from sml:           <STRING> e_metID </STRING>
   717 [[from sml:         </STRINGLIST>
   718 [[from sml:       </METHODID>
   719 [[from sml:     </SPECIFICATION>
   720 [[from sml:   </CALCHEAD>
   721 [[from sml: </REFFORMULA>
   722 [[from sml: @@@@@end@@@@@*)
   723 moveActiveFormula 1 ([],Pbl);
   724 (*[[from sml: > @@@@@begin@@@@@
   725 [[from sml:  1 
   726 [[from sml: <CALCITERATOR>
   727 [[from sml:   <CALCID> 1 </CALCID>
   728 [[from sml:   <POSITION>
   729 [[from sml:     <INTLIST>
   730 [[from sml:     </INTLIST>
   731 [[from sml:     <POS> Pbl </POS>
   732 [[from sml:   </POSITION>
   733 [[from sml: </CALCITERATOR>
   734 [[from sml: @@@@@end@@@@@*)
   735 replaceFormula 1 "Simplify (1+2)";
   736 (*[[from sml: > @@@@@begin@@@@@
   737 [[from sml:  1 
   738 [[from sml: <REPLACEFORMULA>
   739 [[from sml:   <CALCID> 1 </CALCID>
   740 [[from sml:   <CALCCHANGED>
   741 [[from sml:     <UNCHANGED>
   742 [[from sml:       <INTLIST>
   743 [[from sml:       </INTLIST>
   744 [[from sml:       <POS> Pbl </POS>
   745 [[from sml:     </UNCHANGED>
   746 [[from sml:     <DELETED>
   747 [[from sml:       <INTLIST>
   748 [[from sml:       </INTLIST>
   749 [[from sml:       <POS> Pbl </POS>
   750 [[from sml:     </DELETED>
   751 [[from sml:     <GENERATED>
   752 [[from sml:       <INTLIST>
   753 [[from sml:       </INTLIST>
   754 [[from sml:       <POS> Met </POS>                           DIFFERENCE: Pbl
   755 [[from sml:     </GENERATED>
   756 [[from sml:   </CALCCHANGED>
   757 [[from sml: </REPLACEFORMULA>
   758 [[from sml: @@@@@end@@@@@*)
   759 getFormulaeFromTo 1 ([],Pbl) ([],Pbl) 0 false(*              DIFFERENCE: Pbl*);
   760 (*@@@@@begin@@@@@
   761  1
   762 <GETELEMENTSFROMTO>
   763   <CALCID> 1 </CALCID>
   764   <FORMHEADS>
   765     <CALCFORMULA>
   766       <POSITION>
   767         <INTLIST>
   768         </INTLIST>
   769         <POS> Pbl </POS>
   770       </POSITION>
   771       <FORMULA>
   772         <MATHML>
   773           <ISA> Simplify (1 + 2) </ISA>                      WORKS !!!!!
   774         </MATHML>
   775       </FORMULA>
   776     </CALCFORMULA>
   777   </FORMHEADS>
   778 </GETELEMENTSFROMTO>
   779 @@@@@end@@@@@*)
   780 getFormulaeFromTo 1 ([],Pbl) ([],Met) 0 false;
   781 (*[[from sml: > @@@@@begin@@@@@
   782 [[from sml:  1 
   783 [[from sml: <SYSERROR>
   784 [[from sml:   <CALCID> 1 </CALCID>
   785 [[from sml:   <ERROR> error in getFormulaeFromTo </ERROR>
   786 [[from sml: </SYSERROR>
   787 [[from sml: @@@@@end@@@@@*)
   788 (*step into getFormulaeFromTo --- bug corrected...*)