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