test/Tools/isac/Interpret/inform.sml
changeset 59248 5eba5e6d5266
parent 59188 c477d0f79ab9
child 59252 7d3dbc1171ff
equal deleted inserted replaced
59247:7f29665daeb2 59248:5eba5e6d5266
    54  reset_states ();
    54  reset_states ();
    55  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    55  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    56 	    ("Test", ["sqroot-test","univariate","equation","test"],
    56 	    ("Test", ["sqroot-test","univariate","equation","test"],
    57 	     ["Test","squ-equ-test-subpbl1"]))];
    57 	     ["Test","squ-equ-test-subpbl1"]))];
    58  Iterator 1; moveActiveRoot 1;
    58  Iterator 1; moveActiveRoot 1;
    59  autoCalculate' 1 CompleteCalcHead;
    59  autoCalculate 1 CompleteCalcHead;
    60  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
    60  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
    61  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
    61  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
    62 
    62 
    63  appendFormula 1 "-2 * 1 + (1 + x) = 0" (*|> Future.join*); refFormula 1 (get_pos 1 1);
    63  appendFormula 1 "-2 * 1 + (1 + x) = 0" (*|> Future.join*); refFormula 1 (get_pos 1 1);
    64  val ((pt,_),_) = get_calc 1;
    64  val ((pt,_),_) = get_calc 1;
    65  val str = pr_ptree pr_short pt;
    65  val str = pr_ptree pr_short pt;
    66 if str =
    66 if str =
    96  val (_,(tac,_,_)::_) = get_calc 1;
    96  val (_,(tac,_,_)::_) = get_calc 1;
    97  if tac = Rewrite_Set "Test_simplify" then ()
    97  if tac = Rewrite_Set "Test_simplify" then ()
    98  else error "inform.sml: diff.behav.appendFormula: on Res + equ 3";
    98  else error "inform.sml: diff.behav.appendFormula: on Res + equ 3";
    99 ============ inhibit exn WN1130701 broken at Isabelle2002 --> 2009-2 ============*)
    99 ============ inhibit exn WN1130701 broken at Isabelle2002 --> 2009-2 ============*)
   100 
   100 
   101  autoCalculate' 1 CompleteCalc;
   101  autoCalculate 1 CompleteCalc;
   102  val ((pt,_),_) = get_calc 1;
   102  val ((pt,_),_) = get_calc 1;
   103  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   103  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   104  else error "inform.sml: diff.behav.appendFormula: on Res + equ 4";
   104  else error "inform.sml: diff.behav.appendFormula: on Res + equ 4";
   105  (* autoCalculate' 1 CompleteCalc;
   105  (* autoCalculate 1 CompleteCalc;
   106    val ((pt,p),_) = get_calc 1;
   106    val ((pt,p),_) = get_calc 1;
   107    (writeln o istates2str) (get_obj g_loc pt [ ]);  
   107    (writeln o istates2str) (get_obj g_loc pt [ ]);  
   108    (writeln o istates2str) (get_obj g_loc pt [1]);  
   108    (writeln o istates2str) (get_obj g_loc pt [1]);  
   109    (writeln o istates2str) (get_obj g_loc pt [2]);  
   109    (writeln o istates2str) (get_obj g_loc pt [2]);  
   110    (writeln o istates2str) (get_obj g_loc pt [3]);  
   110    (writeln o istates2str) (get_obj g_loc pt [3]);  
   139  reset_states ();
   139  reset_states ();
   140  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   140  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   141 	    ("Test", ["sqroot-test","univariate","equation","test"],
   141 	    ("Test", ["sqroot-test","univariate","equation","test"],
   142 	     ["Test","squ-equ-test-subpbl1"]))];
   142 	     ["Test","squ-equ-test-subpbl1"]))];
   143  Iterator 1; moveActiveRoot 1;
   143  Iterator 1; moveActiveRoot 1;
   144  autoCalculate' 1 CompleteCalcHead;
   144  autoCalculate 1 CompleteCalcHead;
   145  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1) (*x + 1 = 2*);
   145  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x + 1 = 2*);
   146  appendFormula 1 "2+ -1 + x = 2" (*|> Future.join*); refFormula 1 (get_pos 1 1);
   146  appendFormula 1 "2+ -1 + x = 2" (*|> Future.join*); refFormula 1 (get_pos 1 1);
   147 
   147 
   148  moveDown 1 ([],Pbl); refFormula 1 ([1],Frm) (*x + 1 = 2*);
   148  moveDown 1 ([],Pbl); refFormula 1 ([1],Frm) (*x + 1 = 2*);
   149 
   149 
   150  moveDown 1 ([1  ],Frm); refFormula 1 ([1,1],Frm); 
   150  moveDown 1 ([1  ],Frm); refFormula 1 ([1,1],Frm); 
   160 
   160 
   161  fetchProposedTactic 1; (*takes Iterator 1 _1_*)
   161  fetchProposedTactic 1; (*takes Iterator 1 _1_*)
   162  val (_,(tac,_,_)::_) = get_calc 1;
   162  val (_,(tac,_,_)::_) = get_calc 1;
   163  if tac = Rewrite_Set "norm_equation" then ()
   163  if tac = Rewrite_Set "norm_equation" then ()
   164  else error "inform.sml: diff.behav.appendFormula: on Frm + equ 2";
   164  else error "inform.sml: diff.behav.appendFormula: on Frm + equ 2";
   165  autoCalculate' 1 CompleteCalc;
   165  autoCalculate 1 CompleteCalc;
   166  val ((pt,_),_) = get_calc 1;
   166  val ((pt,_),_) = get_calc 1;
   167  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   167  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   168  else error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
   168  else error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
   169 
   169 
   170 
   170 
   174  reset_states ();
   174  reset_states ();
   175  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   175  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   176 	    ("Test", ["sqroot-test","univariate","equation","test"],
   176 	    ("Test", ["sqroot-test","univariate","equation","test"],
   177 	     ["Test","squ-equ-test-subpbl1"]))];
   177 	     ["Test","squ-equ-test-subpbl1"]))];
   178  Iterator 1; moveActiveRoot 1;
   178  Iterator 1; moveActiveRoot 1;
   179  autoCalculate' 1 CompleteCalcHead;
   179  autoCalculate 1 CompleteCalcHead;
   180  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   180  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   181  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   181  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   182 
   182 
   183  appendFormula 1 "x = 2" (*|> Future.join*);
   183  appendFormula 1 "x = 2" (*|> Future.join*);
   184  val ((pt,p),_) = get_calc 1;
   184  val ((pt,p),_) = get_calc 1;
   185  val str = pr_ptree pr_short pt;
   185  val str = pr_ptree pr_short pt;
   186  writeln str;
   186  writeln str;
   190 
   190 
   191  fetchProposedTactic 1;
   191  fetchProposedTactic 1;
   192  val (_,(tac,_,_)::_) = get_calc 1;
   192  val (_,(tac,_,_)::_) = get_calc 1;
   193  if tac = Rewrite_Set "Test_simplify" then ()
   193  if tac = Rewrite_Set "Test_simplify" then ()
   194  else error "inform.sml: diff.behav.appendFormula: Res + NOder 2";
   194  else error "inform.sml: diff.behav.appendFormula: Res + NOder 2";
   195  autoCalculate' 1 CompleteCalc;
   195  autoCalculate 1 CompleteCalc;
   196  val ((pt,_),_) = get_calc 1;
   196  val ((pt,_),_) = get_calc 1;
   197  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   197  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   198  else error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
   198  else error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
   199 
   199 
   200 
   200 
   204  reset_states ();
   204  reset_states ();
   205  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   205  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   206 	    ("Test", ["sqroot-test","univariate","equation","test"],
   206 	    ("Test", ["sqroot-test","univariate","equation","test"],
   207 	     ["Test","squ-equ-test-subpbl1"]))];
   207 	     ["Test","squ-equ-test-subpbl1"]))];
   208  Iterator 1; moveActiveRoot 1;
   208  Iterator 1; moveActiveRoot 1;
   209  autoCalculate' 1 CompleteCalcHead;
   209  autoCalculate 1 CompleteCalcHead;
   210  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   210  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   211  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   211  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   212 
   212 
   213  appendFormula 1 "x = 1" (*|> Future.join*);
   213  appendFormula 1 "x = 1" (*|> Future.join*);
   214  val ((pt,p),_) = get_calc 1;
   214  val ((pt,p),_) = get_calc 1;
   215  val str = pr_ptree pr_short pt;
   215  val str = pr_ptree pr_short pt;
   216  writeln str;
   216  writeln str;
   220 
   220 
   221  fetchProposedTactic 1;
   221  fetchProposedTactic 1;
   222  val (_,(tac,_,_)::_) = get_calc 1;
   222  val (_,(tac,_,_)::_) = get_calc 1;
   223  if tac = Check_Postcond ["LINEAR", "univariate", "equation", "test"] then ()
   223  if tac = Check_Postcond ["LINEAR", "univariate", "equation", "test"] then ()
   224  else error "inform.sml: diff.behav.appendFormula: Res + late d 2";
   224  else error "inform.sml: diff.behav.appendFormula: Res + late d 2";
   225  autoCalculate' 1 CompleteCalc;
   225  autoCalculate 1 CompleteCalc;
   226  val ((pt,_),_) = get_calc 1;
   226  val ((pt,_),_) = get_calc 1;
   227  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   227  if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
   228  else error "inform.sml: diff.behav.appendFormula: Res + late d 3";
   228  else error "inform.sml: diff.behav.appendFormula: Res + late d 3";
   229 
   229 
   230 
   230 
   234  reset_states ();
   234  reset_states ();
   235  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   235  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   236 	    ("Test", ["sqroot-test","univariate","equation","test"],
   236 	    ("Test", ["sqroot-test","univariate","equation","test"],
   237 	     ["Test","squ-equ-test-subpbl1"]))];
   237 	     ["Test","squ-equ-test-subpbl1"]))];
   238  Iterator 1; moveActiveRoot 1;
   238  Iterator 1; moveActiveRoot 1;
   239  autoCalculate' 1 CompleteCalcHead;
   239  autoCalculate 1 CompleteCalcHead;
   240  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   240  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   241  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   241  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   242  appendFormula 1 "[x = 3 + -2*1]" (*|> Future.join*);
   242  appendFormula 1 "[x = 3 + -2*1]" (*|> Future.join*);
   243  val ((pt,p),_) = get_calc 1;
   243  val ((pt,p),_) = get_calc 1;
   244  val str = pr_ptree pr_short pt;
   244  val str = pr_ptree pr_short pt;
   245  writeln str;
   245  writeln str;
   246  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 ()
   246  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 ()
   247  else error "inform.sml: diff.behav.appendFormula: Res + latEE 1";
   247  else error "inform.sml: diff.behav.appendFormula: Res + latEE 1";
   248  autoCalculate' 1 CompleteCalc;
   248  autoCalculate 1 CompleteCalc;
   249  val ((pt,p),_) = get_calc 1;
   249  val ((pt,p),_) = get_calc 1;
   250  if "[x = 3 + -2 * 1]" = term2str (fst (get_obj g_result pt [])) then ()
   250  if "[x = 3 + -2 * 1]" = term2str (fst (get_obj g_result pt [])) then ()
   251  (*       ~~~~~~~~~~ simplify as last step in any script ?!*)
   251  (*       ~~~~~~~~~~ simplify as last step in any script ?!*)
   252  else error "inform.sml: diff.behav.appendFormula: Res + latEE 2";
   252  else error "inform.sml: diff.behav.appendFormula: Res + latEE 2";
   253 
   253 
   259  reset_states ();
   259  reset_states ();
   260  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   260  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   261 	    ("Test", ["sqroot-test","univariate","equation","test"],
   261 	    ("Test", ["sqroot-test","univariate","equation","test"],
   262 	     ["Test","squ-equ-test-subpbl1"]))];
   262 	     ["Test","squ-equ-test-subpbl1"]))];
   263  Iterator 1; moveActiveRoot 1;
   263  Iterator 1; moveActiveRoot 1;
   264  autoCalculate' 1 CompleteCalcHead;
   264  autoCalculate 1 CompleteCalcHead;
   265  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   265  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   266  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   266  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   267  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*-1 + x*);
   267  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*-1 + x*);
   268 
   268 
   269  replaceFormula 1 "-2 * 1 + (1 + x) = 0"; refFormula 1 (get_pos 1 1);
   269  replaceFormula 1 "-2 * 1 + (1 + x) = 0"; refFormula 1 (get_pos 1 1);
   270  val ((pt,_),_) = get_calc 1;
   270  val ((pt,_),_) = get_calc 1;
   271  val str = pr_ptree pr_short pt;
   271  val str = pr_ptree pr_short pt;
   272 
   272 
   291 "2.4.   1 + (x + -2) = 0\n"^
   291 "2.4.   1 + (x + -2) = 0\n"^
   292 "2.5.   1 + (x + -2 * 1) = 0\n"^
   292 "2.5.   1 + (x + -2 * 1) = 0\n"^
   293 "2.6.   1 + x + -2 * 1 = 0\n" then()
   293 "2.6.   1 + x + -2 * 1 = 0\n" then()
   294 else error "inform.sml: diff.behav.replaceFormula: on Res += 1";
   294 else error "inform.sml: diff.behav.replaceFormula: on Res += 1";
   295 
   295 
   296  autoCalculate' 1 CompleteCalc;
   296  autoCalculate 1 CompleteCalc;
   297  val ((pt,pos as (p,_)),_) = get_calc 1;
   297  val ((pt,pos as (p,_)),_) = get_calc 1;
   298  if pos = ([],Res) andalso "[x = 1]" = (term2str o fst) (get_obj g_result pt p) then()
   298  if pos = ([],Res) andalso "[x = 1]" = (term2str o fst) (get_obj g_result pt p) then()
   299  else error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
   299  else error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
   300 
   300 
   301 "--------- replaceFormula: on Res + = 1st Nd ---------------------";
   301 "--------- replaceFormula: on Res + = 1st Nd ---------------------";
   304  reset_states ();
   304  reset_states ();
   305  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   305  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   306 	    ("Test", ["sqroot-test","univariate","equation","test"],
   306 	    ("Test", ["sqroot-test","univariate","equation","test"],
   307 	     ["Test","squ-equ-test-subpbl1"]))];
   307 	     ["Test","squ-equ-test-subpbl1"]))];
   308  Iterator 1; moveActiveRoot 1;
   308  Iterator 1; moveActiveRoot 1;
   309  autoCalculate' 1 CompleteCalcHead;
   309  autoCalculate 1 CompleteCalcHead;
   310  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   310  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   311  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   311  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   312 
   312 
   313  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   313  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   314  val ((pt,_),_) = get_calc 1;
   314  val ((pt,_),_) = get_calc 1;
   315  val str = pr_ptree pr_short pt;
   315  val str = pr_ptree pr_short pt;
   316  writeln str;
   316  writeln str;
   317  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 ()
   317  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 ()
   318  else error "inform.sml: diff.behav.replaceFormula: on Res 1 + = 1";
   318  else error "inform.sml: diff.behav.replaceFormula: on Res 1 + = 1";
   319  autoCalculate' 1 CompleteCalc;
   319  autoCalculate 1 CompleteCalc;
   320  val ((pt,pos as (p,_)),_) = get_calc 1;
   320  val ((pt,pos as (p,_)),_) = get_calc 1;
   321  if pos = ([],Res) andalso "[x = 1]" = (term2str o fst)(get_obj g_result pt p) then()
   321  if pos = ([],Res) andalso "[x = 1]" = (term2str o fst)(get_obj g_result pt p) then()
   322  else error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
   322  else error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
   323 
   323 
   324 
   324 
   328  reset_states ();
   328  reset_states ();
   329  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   329  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   330 	    ("Test", ["sqroot-test","univariate","equation","test"],
   330 	    ("Test", ["sqroot-test","univariate","equation","test"],
   331 	     ["Test","squ-equ-test-subpbl1"]))];
   331 	     ["Test","squ-equ-test-subpbl1"]))];
   332  Iterator 1; moveActiveRoot 1;
   332  Iterator 1; moveActiveRoot 1;
   333  autoCalculate' 1 CompleteCalcHead;
   333  autoCalculate 1 CompleteCalcHead;
   334  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   334  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   335 
   335 
   336  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   336  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   337  val ((pt,_),_) = get_calc 1;
   337  val ((pt,_),_) = get_calc 1;
   338  val str = pr_ptree pr_short pt;
   338  val str = pr_ptree pr_short pt;
   339  writeln str;
   339  writeln str;
   340  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 ()
   340  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 ()
   341  else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 1";
   341  else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 1";
   342  autoCalculate' 1 CompleteCalc;
   342  autoCalculate 1 CompleteCalc;
   343  val ((pt,pos as (p,_)),_) = get_calc 1;
   343  val ((pt,pos as (p,_)),_) = get_calc 1;
   344  if pos = ([],Res) andalso "[x = 1]" = (term2str o fst)(get_obj g_result pt p) then()
   344  if pos = ([],Res) andalso "[x = 1]" = (term2str o fst)(get_obj g_result pt p) then()
   345  else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 2";
   345  else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 2";
   346 
   346 
   347 
   347 
   351  reset_states ();
   351  reset_states ();
   352  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   352  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   353 	    ("Test", ["sqroot-test","univariate","equation","test"],
   353 	    ("Test", ["sqroot-test","univariate","equation","test"],
   354 	     ["Test","squ-equ-test-subpbl1"]))];
   354 	     ["Test","squ-equ-test-subpbl1"]))];
   355  Iterator 1; moveActiveRoot 1;
   355  Iterator 1; moveActiveRoot 1;
   356  autoCalculate' 1 CompleteCalc;
   356  autoCalculate 1 CompleteCalc;
   357  moveActiveRoot 1; moveActiveDown 1;
   357  moveActiveRoot 1; moveActiveDown 1;
   358  if get_pos 1 1 = ([1], Frm) then ()
   358  if get_pos 1 1 = ([1], Frm) then ()
   359  else error "inform.sml: diff.behav. cut calculation 1";
   359  else error "inform.sml: diff.behav. cut calculation 1";
   360 
   360 
   361  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   361  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   447  reset_states ();
   447  reset_states ();
   448  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   448  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   449 	    ("Test", ["sqroot-test","univariate","equation","test"],
   449 	    ("Test", ["sqroot-test","univariate","equation","test"],
   450 	     ["Test","squ-equ-test-subpbl1"]))];
   450 	     ["Test","squ-equ-test-subpbl1"]))];
   451  Iterator 1; moveActiveRoot 1;
   451  Iterator 1; moveActiveRoot 1;
   452  autoCalculate' 1 CompleteCalcHead;
   452  autoCalculate 1 CompleteCalcHead;
   453  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   453  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   454  autoCalculate' 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   454  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   455 
   455 
   456  appendFormula 1 " x - "; (*<ERROR> syntax error in ' x - ' </ERROR>*)
   456  appendFormula 1 " x - "; (*<ERROR> syntax error in ' x - ' </ERROR>*)
   457  val ((pt,_),_) = get_calc 1;
   457  val ((pt,_),_) = get_calc 1;
   458  val str = pr_ptree pr_short pt;
   458  val str = pr_ptree pr_short pt;
   459  writeln str;
   459  writeln str;
   481 reset_states ();
   481 reset_states ();
   482 CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
   482 CalcTree [([], ("e_domID", ["e_pblID"], ["e_metID"]))];
   483 Iterator 1;
   483 Iterator 1;
   484 moveActiveRoot 1;
   484 moveActiveRoot 1;
   485 replaceFormula 1 "solve(x+1=2,x)";
   485 replaceFormula 1 "solve(x+1=2,x)";
   486 autoCalculate' 1 CompleteCalc;
   486 autoCalculate 1 CompleteCalc;
   487 val ((pt,p),_) = get_calc 1;
   487 val ((pt,p),_) = get_calc 1;
   488 show_pt pt;
   488 show_pt pt;
   489 if p = ([], Res) then ()
   489 if p = ([], Res) then ()
   490 else error "inform.sml: diff.behav. CAScmd ([],Pbl) FE-interface";
   490 else error "inform.sml: diff.behav. CAScmd ([],Pbl) FE-interface";
   491 
   491 
   495 "--------- inform [rational,simplification] ----------------------";
   495 "--------- inform [rational,simplification] ----------------------";
   496 reset_states ();
   496 reset_states ();
   497 CalcTree [(["Term (a * x / (b * x) + c * x / (d * x) + e / f)", "normalform N"],
   497 CalcTree [(["Term (a * x / (b * x) + c * x / (d * x) + e / f)", "normalform N"],
   498 	("Rational", ["rational", "simplification"], ["simplification", "of_rationals"]))];
   498 	("Rational", ["rational", "simplification"], ["simplification", "of_rationals"]))];
   499 Iterator 1; moveActiveRoot 1;
   499 Iterator 1; moveActiveRoot 1;
   500 autoCalculate' 1 CompleteCalcHead;
   500 autoCalculate 1 CompleteCalcHead;
   501 
   501 
   502 "--- (-1) give a preview on the calculation without any input";
   502 "--- (-1) give a preview on the calculation without any input";
   503 (*
   503 (*
   504 autoCalculate' 1 CompleteCalc;
   504 autoCalculate 1 CompleteCalc;
   505 val ((pt, p), _) = get_calc 1;
   505 val ((pt, p), _) = get_calc 1;
   506 show_pt pt;
   506 show_pt pt;
   507 [
   507 [
   508 (([], Frm), Simplify (a * x / (b * x) + c * x / (d * x) + e / f)),
   508 (([], Frm), Simplify (a * x / (b * x) + c * x / (d * x) + e / f)),
   509 (([1], Frm), a * x / (b * x) + c * x / (d * x) + e / f),
   509 (([1], Frm), a * x / (b * x) + c * x / (d * x) + e / f),
   513 (([4], Res), (a * d * f + b * c * f + b * d * e) / (b * d * f)), <--- (2) input next
   513 (([4], Res), (a * d * f + b * c * f + b * d * e) / (b * d * f)), <--- (2) input next
   514 (([], Res), (a * d * f + b * c * f + b * d * e) / (b * d * f))]  <--- (3) is also final result
   514 (([], Res), (a * d * f + b * c * f + b * d * e) / (b * d * f))]  <--- (3) is also final result
   515                                                                           EXAMPLE NOT OPTIMAL
   515                                                                           EXAMPLE NOT OPTIMAL
   516 *)
   516 *)
   517 "--- (0) user input as the *first* step does not work, thus impdo at least 1 step";
   517 "--- (0) user input as the *first* step does not work, thus impdo at least 1 step";
   518 autoCalculate' 1 (Step 1);
   518 autoCalculate 1 (Step 1);
   519 autoCalculate' 1 (Step 1);
   519 autoCalculate 1 (Step 1);
   520 val ((pt, p), _) = get_calc 1;
   520 val ((pt, p), _) = get_calc 1;
   521 (*show_pt pt;
   521 (*show_pt pt;
   522 [
   522 [
   523 (([], Frm), Simplify (a * x / (b * x) + c * x / (d * x) + e / f)),
   523 (([], Frm), Simplify (a * x / (b * x) + c * x / (d * x) + e / f)),
   524 (([1], Frm), a * x / (b * x) + c * x / (d * x) + e / f),
   524 (([1], Frm), a * x / (b * x) + c * x / (d * x) + e / f),
   541 if p = ([2], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
   541 if p = ([2], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
   542 else error ("inform.sml: [rational,simplification] 1");
   542 else error ("inform.sml: [rational,simplification] 1");
   543 
   543 
   544 "--- (2) input the next formula that would be presented by mat-engine";
   544 "--- (2) input the next formula that would be presented by mat-engine";
   545 (* generate a preview:
   545 (* generate a preview:
   546 autoCalculate' 1 (Step 1);
   546 autoCalculate 1 (Step 1);
   547 val ((pt, p), _) = get_calc 1;
   547 val ((pt, p), _) = get_calc 1;
   548 show_pt pt;
   548 show_pt pt;
   549 [
   549 [
   550 (([], Frm), Simplify (a * x / (b * x) + c * x / (d * x) + e / f)),
   550 (([], Frm), Simplify (a * x / (b * x) + c * x / (d * x) + e / f)),
   551 (([1], Frm), a * x / (b * x) + c * x / (d * x) + e / f),
   551 (([1], Frm), a * x / (b * x) + c * x / (d * x) + e / f),
   592 *)
   592 *)
   593 if p = ([4], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
   593 if p = ([4], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
   594 else error ("inform.sml: [rational,simplification] 3");
   594 else error ("inform.sml: [rational,simplification] 3");
   595 
   595 
   596 "--- (4) finish the calculation + check the postcondition (in the future)";
   596 "--- (4) finish the calculation + check the postcondition (in the future)";
   597 autoCalculate' 1 CompleteCalc;
   597 autoCalculate 1 CompleteCalc;
   598 val ((pt, p), _) = get_calc 1;
   598 val ((pt, p), _) = get_calc 1;
   599 val (t, asm) = get_obj g_result pt [];
   599 val (t, asm) = get_obj g_result pt [];
   600 if term2str t = "(a * d * f + b * c * f + b * d * e) / (b * d * f)" andalso
   600 if term2str t = "(a * d * f + b * c * f + b * d * e) / (b * d * f)" andalso
   601 terms2str asm = "[\"b * d * f ~= 0\",\"d ~= 0\",\"b ~= 0\"," ^
   601 terms2str asm = "[\"b * d * f ~= 0\",\"d ~= 0\",\"b ~= 0\"," ^
   602   "\"a * x / (b * x) + c * x / (d * x) + e / f is_ratpolyexp\"]"
   602   "\"a * x / (b * x) + c * x / (d * x) + e / f is_ratpolyexp\"]"
   646 writeln (itms2str_ ctxt meth);
   646 writeln (itms2str_ ctxt meth);
   647 writeln (istate2str (fst istate));
   647 writeln (istate2str (fst istate));
   648 
   648 
   649 refFormula 1 ([],Pbl) (*--> correct CalcHead*);
   649 refFormula 1 ([],Pbl) (*--> correct CalcHead*);
   650  (*081016 NOT necessary (but leave it in Java):*)
   650  (*081016 NOT necessary (but leave it in Java):*)
   651 (*6>*)(*completeCalcHead*)autoCalculate' 1 CompleteCalcHead;
   651 (*6>*)(*completeCalcHead*)autoCalculate 1 CompleteCalcHead;
   652 "----- here the CalcHead has been completed --- ONCE MORE ?????";
   652 "----- here the CalcHead has been completed --- ONCE MORE ?????";
   653 
   653 
   654 (***difference II***)
   654 (***difference II***)
   655 val ((pt,p),_) = get_calc 1;
   655 val ((pt,p),_) = get_calc 1;
   656 (*val p = ([], Pbl)*)
   656 (*val p = ([], Pbl)*)
   676 (2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
   676 (2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
   677 (3 ,[1] ,true ,#Find ,Cor derivative f_'_f ,(f_'_f, [f_'_f]))]*)
   677 (3 ,[1] ,true ,#Find ,Cor derivative f_'_f ,(f_'_f, [f_'_f]))]*)
   678 writeln"-----------------------------------------------------------";
   678 writeln"-----------------------------------------------------------";
   679 (*7>*)fetchProposedTactic 1 (*--> Apply_Method*);
   679 (*7>*)fetchProposedTactic 1 (*--> Apply_Method*);
   680 (*WN081028 fixed <ERROR> helpless </ERROR> by inform returning ...(.,Met)*)
   680 (*WN081028 fixed <ERROR> helpless </ERROR> by inform returning ...(.,Met)*)
   681 autoCalculate' 1 CompleteCalc;
   681 autoCalculate 1 CompleteCalc;
   682 val ((pt,p),_) = get_calc 1;
   682 val ((pt,p),_) = get_calc 1;
   683 val Form res = (#1 o pt_extract) (pt, ([],Res));
   683 val Form res = (#1 o pt_extract) (pt, ([],Res));
   684 show_pt pt;
   684 show_pt pt;
   685 if p = ([], Res) andalso term2str res = "1 + 2 * x" then ()
   685 if p = ([], Res) andalso term2str res = "1 + 2 * x" then ()
   686 else error "diff.sml behav.changed for Diff (x^2 + x + 1, x)";
   686 else error "diff.sml behav.changed for Diff (x^2 + x + 1, x)";
   692   omitting unnecessary inputs*)
   692   omitting unnecessary inputs*)
   693 (*1>*)reset_states ();
   693 (*1>*)reset_states ();
   694 (*2>*)CalcTree [(["functionTerm (x^2 + x + 1)", "differentiateFor x", "derivative f_'_f"],("Isac",["derivative_of","function"],["diff","differentiate_on_R"]))];
   694 (*2>*)CalcTree [(["functionTerm (x^2 + x + 1)", "differentiateFor x", "derivative f_'_f"],("Isac",["derivative_of","function"],["diff","differentiate_on_R"]))];
   695 (*3>*)Iterator 1; moveActiveRoot 1;
   695 (*3>*)Iterator 1; moveActiveRoot 1;
   696 
   696 
   697 (*6>*)(*completeCalcHead*)autoCalculate' 1 CompleteCalcHead;
   697 (*6>*)(*completeCalcHead*)autoCalculate 1 CompleteCalcHead;
   698 (***difference II***)
   698 (***difference II***)
   699 val ((pt,_),_) = get_calc 1;
   699 val ((pt,_),_) = get_calc 1;
   700 val PblObj {probl, meth, spec, fmz, env, loc, ...} = get_obj I pt [];
   700 val PblObj {probl, meth, spec, fmz, env, loc, ...} = get_obj I pt [];
   701 val NONE = env;
   701 val NONE = env;
   702 val (SOME istate, NONE) = loc;
   702 val (SOME istate, NONE) = loc;
   718 (1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
   718 (1 ,[1] ,true ,#Given ,Cor functionTerm (x ^^^ 2 + x + 1) ,(f_, [x ^^^ 2 + x + 1])),
   719 (2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
   719 (2 ,[1] ,true ,#Given ,Cor differentiateFor x ,(v_, [x])),
   720 (3 ,[1] ,true ,#Find ,Cor derivative f_'_f ,(f_'_f, [f_'_f]))]*)
   720 (3 ,[1] ,true ,#Find ,Cor derivative f_'_f ,(f_'_f, [f_'_f]))]*)
   721 writeln"-----------------------------------------------------------";
   721 writeln"-----------------------------------------------------------";
   722 (*7>*)fetchProposedTactic 1 (*--> Apply_Method*);
   722 (*7>*)fetchProposedTactic 1 (*--> Apply_Method*);
   723 autoCalculate' 1 (Step 1);
   723 autoCalculate 1 (Step 1);
   724 val ((pt,p),_) = get_calc 1;
   724 val ((pt,p),_) = get_calc 1;
   725 val Form res = (#1 o pt_extract) (pt, p);
   725 val Form res = (#1 o pt_extract) (pt, p);
   726 if term2str res = "d_d x (x ^^^ 2 + x + 1)" then ()
   726 if term2str res = "d_d x (x ^^^ 2 + x + 1)" then ()
   727 else error "diff.sml Diff (x^2 + x + 1, x) from exp";
   727 else error "diff.sml Diff (x^2 + x + 1, x) from exp";
   728 
   728 
   994 CalcTree
   994 CalcTree
   995 [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
   995 [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
   996   ("Isac", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
   996   ("Isac", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
   997 Iterator 1;
   997 Iterator 1;
   998 moveActiveRoot 1;
   998 moveActiveRoot 1;
   999 autoCalculate' 1 CompleteCalcHead;
   999 autoCalculate 1 CompleteCalcHead;
  1000 autoCalculate' 1 (Step 1);
  1000 autoCalculate 1 (Step 1);
  1001 autoCalculate' 1 (Step 1);(*([1], Res), d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))*)
  1001 autoCalculate 1 (Step 1);(*([1], Res), d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))*)
  1002 (*autoCalculate' 1 (Step 1);([2], Res), d_d x (x ^^^ 2) + cos (x ^^^ 4) * d_d x (x ^^^ 4)*)
  1002 (*autoCalculate 1 (Step 1);([2], Res), d_d x (x ^^^ 2) + cos (x ^^^ 4) * d_d x (x ^^^ 4)*)
  1003 
  1003 
  1004 "~~~~~ fun appendFormula, args:"; val (cI, (ifo:cterm')) = (1, "d_d x (x ^ 2) + cos (4 * x ^ 3)");
  1004 "~~~~~ fun appendFormula, args:"; val (cI, (ifo:cterm')) = (1, "d_d x (x ^ 2) + cos (4 * x ^ 3)");
  1005 val cs = get_calc cI
  1005 val cs = get_calc cI
  1006 val pos as (_,p_) = get_pos cI 1; (*pos = ([1], Res)*)
  1006 val pos as (_,p_) = get_pos cI 1; (*pos = ([1], Res)*)
  1007 val cs' = 
  1007 val cs' = 
  1114 CalcTree
  1114 CalcTree
  1115 [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
  1115 [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
  1116   ("Isac", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
  1116   ("Isac", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
  1117 Iterator 1;
  1117 Iterator 1;
  1118 moveActiveRoot 1;
  1118 moveActiveRoot 1;
  1119 autoCalculate' 1 CompleteCalcHead;
  1119 autoCalculate 1 CompleteCalcHead;
  1120 autoCalculate' 1 (Step 1);
  1120 autoCalculate 1 (Step 1);
  1121 autoCalculate' 1 (Step 1);(*([1], Res), d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))*)
  1121 autoCalculate 1 (Step 1);(*([1], Res), d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))*)
  1122 appendFormula 1 "d_d x (x ^ 2) + cos (4 * x ^ 3)" (*|> Future.join*);
  1122 appendFormula 1 "d_d x (x ^ 2) + cos (4 * x ^ 3)" (*|> Future.join*);
  1123   (*<CALCMESSAGE> error pattern #chain-rule-diff-both# </CALCMESSAGE>*)
  1123   (*<CALCMESSAGE> error pattern #chain-rule-diff-both# </CALCMESSAGE>*)
  1124   (*or
  1124   (*or
  1125     <CALCMESSAGE> no derivation found </CALCMESSAGE>*)
  1125     <CALCMESSAGE> no derivation found </CALCMESSAGE>*)
  1126 
  1126 
  1196 CalcTree
  1196 CalcTree
  1197 [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
  1197 [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
  1198   ("Isac", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
  1198   ("Isac", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
  1199 Iterator 1;
  1199 Iterator 1;
  1200 moveActiveRoot 1;
  1200 moveActiveRoot 1;
  1201 autoCalculate' 1 CompleteCalcHead;
  1201 autoCalculate 1 CompleteCalcHead;
  1202 autoCalculate' 1 (Step 1);
  1202 autoCalculate 1 (Step 1);
  1203 autoCalculate' 1 (Step 1);(*([1], Res), d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))*)
  1203 autoCalculate 1 (Step 1);(*([1], Res), d_d x (x ^^^ 2) + d_d x (sin (x ^^^ 4))*)
  1204 appendFormula 1 "d_d x (x ^ 2) + cos (4 * x ^ 3)" (*|> Future.join*); (*<<<<<<<=========================*)
  1204 appendFormula 1 "d_d x (x ^ 2) + cos (4 * x ^ 3)" (*|> Future.join*); (*<<<<<<<=========================*)
  1205 (* the check for errpat is maximally liberal (whole term modulo "nrls" from "type met"),
  1205 (* the check for errpat is maximally liberal (whole term modulo "nrls" from "type met"),
  1206   would recognize "cos (4 * x ^ (4 - 1)) + 2 * x" as well.
  1206   would recognize "cos (4 * x ^ (4 - 1)) + 2 * x" as well.
  1207   results in <CALCMESSAGE> error pattern #chain-rule-diff-both# </CALCMESSAGE>
  1207   results in <CALCMESSAGE> error pattern #chain-rule-diff-both# </CALCMESSAGE>
  1208   instead of <CALCMESSAGE> no derivation found </CALCMESSAGE> *)
  1208   instead of <CALCMESSAGE> no derivation found </CALCMESSAGE> *)