test/Tools/isac/Interpret/error-pattern.sml
changeset 60571 19a172de0bb5
parent 60565 f92963a33fe3
child 60577 ca9f84786137
     1.1 --- a/test/Tools/isac/Interpret/error-pattern.sml	Wed Oct 19 15:39:15 2022 +0200
     1.2 +++ b/test/Tools/isac/Interpret/error-pattern.sml	Thu Oct 20 10:23:38 2022 +0200
     1.3 @@ -23,12 +23,12 @@
     1.4  "--------- maximum-example, UC: Modeling / modifyCalcHead --------";*)
     1.5  "--------- syntax error ------------------------------------------";
     1.6  "CAS-command:";
     1.7 -"--------- CAS-command on ([],Pbl) -------------------------------";
     1.8 -"--------- CAS-command on ([],Pbl) FE-interface ------------------";
     1.9 +(*"--------- CAS-command on ([],Pbl) -------------------------------";*)
    1.10 +(*"--------- CAS-command on ([],Pbl) FE-interface ------------------";*)
    1.11  "--------- locate_input_term [rational,simplification] ----------------------";
    1.12 -"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
    1.13 +(*"--------- Take as 1st tac, start with <NEW> (CAS input) ---------";*)
    1.14  "--------- Take as 1st tac, start from exp -----------------------";
    1.15 -"--------- implicit_take, start with <NEW> (CAS input) ---------------";
    1.16 +(*"--------- implicit_take, start with <NEW> (CAS input) ---------------";*)
    1.17  "--------- build fun check_for' ------------------------------";
    1.18  "--------- build fun check_for' ?bdv -------------------------";
    1.19  "--------- build fun check_for ------------------------";
    1.20 @@ -53,7 +53,7 @@
    1.21   (writeln o UnparseC.term) sc;
    1.22  
    1.23   States.reset ();
    1.24 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.25 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.26  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.27  	     ["Test", "squ-equ-test-subpbl1"]))];
    1.28   Iterator 1; moveActiveRoot 1;
    1.29 @@ -138,7 +138,7 @@
    1.30  "--------- appendFormula: on Frm + equ_nrls ----------------------";
    1.31  "--------- appendFormula: on Frm + equ_nrls ----------------------";
    1.32   States.reset ();
    1.33 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.34 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.35  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.36  	     ["Test", "squ-equ-test-subpbl1"]))];
    1.37   Iterator 1; moveActiveRoot 1;
    1.38 @@ -173,7 +173,7 @@
    1.39  "--------- appendFormula: on Res + NO deriv ----------------------";
    1.40  "--------- appendFormula: on Res + NO deriv ----------------------";
    1.41   States.reset ();
    1.42 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.43 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.44  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.45  	     ["Test", "squ-equ-test-subpbl1"]))];
    1.46   Iterator 1; moveActiveRoot 1;
    1.47 @@ -206,7 +206,7 @@
    1.48   re-build: fun locate_input_term ---------------------------------------------------"; 
    1.49  *)
    1.50   States.reset ();
    1.51 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.52 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.53  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.54  	     ["Test", "squ-equ-test-subpbl1"]))];
    1.55   Iterator 1; moveActiveRoot 1;
    1.56 @@ -236,7 +236,7 @@
    1.57  "--------- appendFormula: on Res + late deriv [x = 3 + - 2]---///--";
    1.58  "--------- appendFormula: on Res + late deriv [x = 3 + - 2]---///--";
    1.59   States.reset ();
    1.60 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.61 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.62  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.63  	     ["Test", "squ-equ-test-subpbl1"]))];
    1.64   Iterator 1; moveActiveRoot 1;
    1.65 @@ -260,7 +260,7 @@
    1.66  "--------- replaceFormula: on Res + = ----------------------------";
    1.67  "--------- replaceFormula: on Res + = ----------------------------";
    1.68   States.reset ();
    1.69 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.70 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.71  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.72  	     ["Test", "squ-equ-test-subpbl1"]))];
    1.73   Iterator 1; moveActiveRoot 1;
    1.74 @@ -306,7 +306,7 @@
    1.75  "--------- replaceFormula: on Res + = 1st Nd ---------------------";
    1.76  "--------- replaceFormula: on Res + = 1st Nd ---------------------";
    1.77   States.reset ();
    1.78 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.79 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.80  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.81  	     ["Test", "squ-equ-test-subpbl1"]))];
    1.82   Iterator 1; moveActiveRoot 1;
    1.83 @@ -330,7 +330,7 @@
    1.84  "--------- replaceFormula: on Frm + = 1st Nd ---------------------";
    1.85  "--------- replaceFormula: on Frm + = 1st Nd ---------------------";
    1.86   States.reset (); 
    1.87 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.88 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.89  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.90  	     ["Test", "squ-equ-test-subpbl1"]))];
    1.91   Iterator 1; moveActiveRoot 1;
    1.92 @@ -353,7 +353,7 @@
    1.93  "--------- replaceFormula: cut calculation -----------------------";
    1.94  "--------- replaceFormula: cut calculation -----------------------";
    1.95   States.reset ();
    1.96 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.97 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.98  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.99  	     ["Test", "squ-equ-test-subpbl1"]))];
   1.100   Iterator 1; moveActiveRoot 1;
   1.101 @@ -397,7 +397,7 @@
   1.102  
   1.103  
   1.104   (*!!!!!!!!!!!!!!!!! DON'T USE me FOR FINDING nxt !!!!!!!!!!!!!!!!!!*)
   1.105 - val (p,_,f,nxt,_,pt) = CalcTreeTEST [(elems, spec)];
   1.106 + val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(elems, spec)];
   1.107   (*val nxt = ("Model_Problem", ...*)
   1.108   val pbl = get_obj g_pbl pt (fst p); (writeln o (I_Model.to_string ctxt)) pbl; 
   1.109  
   1.110 @@ -450,7 +450,7 @@
   1.111  "--------- syntax error ------------------------------------------";
   1.112  "--------- syntax error ------------------------------------------";
   1.113   States.reset ();
   1.114 - CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   1.115 + CalcTree @{context} [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   1.116  	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   1.117  	     ["Test", "squ-equ-test-subpbl1"]))];
   1.118   Iterator 1; moveActiveRoot 1;
   1.119 @@ -466,14 +466,15 @@
   1.120   else error "inform.sml: diff.behav.appendFormula: syntax error";
   1.121  DEconstrCalcTree 1;
   1.122  
   1.123 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
   1.124  "--------- CAS-command on ([],Pbl) -------------------------------";
   1.125  "--------- CAS-command on ([],Pbl) -------------------------------";
   1.126  "--------- CAS-command on ([],Pbl) -------------------------------";
   1.127  val (p,_,f,nxt,_,pt) = 
   1.128 -    CalcTreeTEST [([], References.empty)];
   1.129 +    Test_Code.init_calc @{context} [([], References.empty)];
   1.130  val ifo = "solve(x+1=2,x)";
   1.131  val (_,(_,c,(pt,p))) = Step_Solve.by_term (pt,p) "solve(x+1=2,x)";
   1.132 -(*
   1.133 +( *
   1.134    This trick           \<up> \<up> \<up> micked input of \<up> \<up> \<up> \<up>  \<up> ^^ in the front-end.
   1.135    The trick worked in changeset fbaff8cf0179, it does not work in 59c5dd27d589 anymore
   1.136    (TODO hg bisect ?) and raises the ERROR Undefined fact: "xfoldr_Nil".
   1.137 @@ -488,11 +489,12 @@
   1.138  DEconstrCalcTree 1;
   1.139  -----------------------------------------------------------------------------------------------*)
   1.140  
   1.141 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
   1.142  "--------- CAS-command on ([],Pbl) FE-interface ------------------";
   1.143  "--------- CAS-command on ([],Pbl) FE-interface ------------------";
   1.144  "--------- CAS-command on ([],Pbl) FE-interface ------------------";
   1.145  States.reset ();
   1.146 -CalcTree [([], References.empty)];
   1.147 +CalcTree @{context} [([], References.empty)];
   1.148  Iterator 1;
   1.149  moveActiveRoot 1;
   1.150  replaceFormula 1 "solve(x+1=2,x)";
   1.151 @@ -502,12 +504,13 @@
   1.152  if p = ([], Res) then ()
   1.153  else error "inform.sml: diff.behav. CAScmd ([],Pbl) FE-interface";
   1.154  DEconstrCalcTree 1;
   1.155 +-----------------------------------------------------------------------------------------------*)
   1.156  
   1.157  "--------- inform [rational,simplification] ----------------------";
   1.158  "--------- inform [rational,simplification] ----------------------";
   1.159  "--------- inform [rational,simplification] ----------------------";
   1.160  States.reset ();
   1.161 -CalcTree [(["Term (a * x / (b * x) + c * x / (d * x) + e / f)", "normalform N"],
   1.162 +CalcTree @{context} [(["Term (a * x / (b * x) + c * x / (d * x) + e / f)", "normalform N"],
   1.163  	("Rational", ["rational", "simplification"], ["simplification", "of_rationals"]))];
   1.164  Iterator 1; moveActiveRoot 1;
   1.165  autoCalculate 1 CompleteCalcHead;
   1.166 @@ -634,6 +637,7 @@
   1.167  *)
   1.168  DEconstrCalcTree 1;
   1.169  
   1.170 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
   1.171  "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
   1.172  "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
   1.173  "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
   1.174 @@ -644,7 +648,7 @@
   1.175  TermC.atomty t;
   1.176  "-----------------------------------------------------------------";
   1.177  (*1>*)States.reset ();
   1.178 -(*2>*)CalcTree [([], References.empty)];
   1.179 +(*2>*)CalcTree @{context} [([], References.empty)];
   1.180  (*3>*)Iterator 1;moveActiveRoot 1;
   1.181  "----- here the Headline has been finished";
   1.182  (*4>*)moveActiveFormula 1 ([],Pbl);
   1.183 @@ -698,6 +702,7 @@
   1.184  if p = ([], Res) andalso UnparseC.term res = "1 + 2 * x" then ()
   1.185  else error "diff.sml behav.changed for Diff (x \<up> 2 + x + 1, x)";
   1.186  DEconstrCalcTree 1;
   1.187 +-----------------------------------------------------------------------------------------------*)
   1.188  
   1.189  "--------- Take as 1st tac, start from exp -----------------------";
   1.190  "--------- Take as 1st tac, start from exp -----------------------";
   1.191 @@ -705,7 +710,7 @@
   1.192  (*the following input is copied from BridgeLog Java <==> SML,
   1.193    omitting unnecessary inputs*)
   1.194  (*1>*)States.reset ();
   1.195 -(*2>*)CalcTree [(["functionTerm (x \<up> 2 + x + 1)", "differentiateFor x", "derivative f_'_f"],("Isac_Knowledge",["derivative_of", "function"],["diff", "differentiate_on_R"]))];
   1.196 +(*2>*)CalcTree @{context} [(["functionTerm (x \<up> 2 + x + 1)", "differentiateFor x", "derivative f_'_f"],("Isac_Knowledge",["derivative_of", "function"],["diff", "differentiate_on_R"]))];
   1.197  (*3>*)Iterator 1; moveActiveRoot 1;
   1.198  
   1.199  (*6>*)(*completeCalcHead*)autoCalculate 1 CompleteCalcHead;
   1.200 @@ -740,11 +745,12 @@
   1.201  else error "diff.sml Diff (x \<up> 2 + x + 1, x) from exp";
   1.202  DEconstrCalcTree 1;
   1.203  
   1.204 +(*POSTPONE CORRECTION AT END OF TRANSITION TO Isabelle/PIDE/Isac (~ Cas_Cmd)
   1.205  "--------- implicit_take, start with <NEW> (CAS input) ---------------";
   1.206  "--------- implicit_take, start with <NEW> (CAS input) ---------------";
   1.207  "--------- implicit_take, start with <NEW> (CAS input) ---------------";
   1.208  States.reset ();
   1.209 -CalcTree [([], References.empty)];
   1.210 +CalcTree @{context} [([], References.empty)];
   1.211  (*[[from sml: > @@@@@begin@@@@@
   1.212  [[from sml:  1 
   1.213  [[from sml: <CALCTREE>
   1.214 @@ -898,6 +904,7 @@
   1.215  [[from sml: </SYSERROR>
   1.216  [[from sml: @@@@@end@@@@@*)
   1.217  (*step into getFormulaeFromTo --- bug corrected...*)
   1.218 +-----------------------------------------------------------------------------------------------*)
   1.219  
   1.220  "--------- build fun check_for' ------------------------------";
   1.221  "--------- build fun check_for' ------------------------------";
   1.222 @@ -1007,7 +1014,7 @@
   1.223  "--------- embed fun check_for ------------------------";
   1.224  "--------- embed fun check_for ------------------------";
   1.225  States.reset ();     
   1.226 -CalcTree
   1.227 +CalcTree @{context}
   1.228  [(["functionTerm (x \<up> 2 + sin (x \<up> 4))", "differentiateFor x", "derivative f_f'"], 
   1.229    ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
   1.230  Iterator 1;
   1.231 @@ -1066,7 +1073,7 @@
   1.232  "--------- embed fun find_fill_patterns ---------------------------";
   1.233  "--------- embed fun find_fill_patterns ---------------------------";
   1.234  States.reset ();
   1.235 -CalcTree
   1.236 +CalcTree @{context}
   1.237  [(["functionTerm (x \<up> 2 + sin (x \<up> 4))", "differentiateFor x", "derivative f_f'"], 
   1.238    ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
   1.239  Iterator 1;
   1.240 @@ -1151,7 +1158,7 @@
   1.241  "--------- build fun is_exactly_equal, inputFillFormula ----------";
   1.242  "--------- build fun is_exactly_equal, inputFillFormula ----------";
   1.243  States.reset ();
   1.244 -CalcTree
   1.245 +CalcTree @{context}
   1.246  [(["functionTerm (x \<up> 2 + sin (x \<up> 4))", "differentiateFor x", "derivative f_f'"], 
   1.247    ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
   1.248  Iterator 1;