test/Tools/isac/Interpret/error-pattern.sml
changeset 59997 46fe5a8c3911
parent 59988 9a6aa40d1962
child 60154 2ab0d1523731
     1.1 --- a/test/Tools/isac/Interpret/error-pattern.sml	Tue May 19 12:33:35 2020 +0200
     1.2 +++ b/test/Tools/isac/Interpret/error-pattern.sml	Wed May 20 12:52:09 2020 +0200
     1.3 @@ -47,15 +47,15 @@
     1.4  "--------- appendFormula: on Res + equ_nrls ----------------------";
     1.5  "--------- appendFormula: on Res + equ_nrls ----------------------";
     1.6  "--------- appendFormula: on Res + equ_nrls ----------------------";
     1.7 - val Prog sc = (#scr o Method.from_store) ["Test","squ-equ-test-subpbl1"];
     1.8 + val Prog sc = (#scr o Method.from_store) ["Test", "squ-equ-test-subpbl1"];
     1.9   (writeln o UnparseC.term) sc;
    1.10 - val Prog sc = (#scr o Method.from_store) ["Test","solve_linear"];
    1.11 + val Prog sc = (#scr o Method.from_store) ["Test", "solve_linear"];
    1.12   (writeln o UnparseC.term) sc;
    1.13  
    1.14   reset_states ();
    1.15 - CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    1.16 -	    ("Test", ["sqroot-test","univariate","equation","test"],
    1.17 -	     ["Test","squ-equ-test-subpbl1"]))];
    1.18 + CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.19 +	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.20 +	     ["Test", "squ-equ-test-subpbl1"]))];
    1.21   Iterator 1; moveActiveRoot 1;
    1.22   autoCalculate 1 CompleteCalcHead;
    1.23   autoCalculate 1 (Steps 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
    1.24 @@ -138,9 +138,9 @@
    1.25  "--------- appendFormula: on Frm + equ_nrls ----------------------";
    1.26  "--------- appendFormula: on Frm + equ_nrls ----------------------";
    1.27   reset_states ();
    1.28 - CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    1.29 -	    ("Test", ["sqroot-test","univariate","equation","test"],
    1.30 -	     ["Test","squ-equ-test-subpbl1"]))];
    1.31 + CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.32 +	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.33 +	     ["Test", "squ-equ-test-subpbl1"]))];
    1.34   Iterator 1; moveActiveRoot 1;
    1.35   autoCalculate 1 CompleteCalcHead;
    1.36   autoCalculate 1 (Steps 1); refFormula 1 (get_pos 1 1) (*x + 1 = 2*);
    1.37 @@ -173,9 +173,9 @@
    1.38  "--------- appendFormula: on Res + NO deriv ----------------------";
    1.39  "--------- appendFormula: on Res + NO deriv ----------------------";
    1.40   reset_states ();
    1.41 - CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    1.42 -	    ("Test", ["sqroot-test","univariate","equation","test"],
    1.43 -	     ["Test","squ-equ-test-subpbl1"]))];
    1.44 + CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.45 +	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.46 +	     ["Test", "squ-equ-test-subpbl1"]))];
    1.47   Iterator 1; moveActiveRoot 1;
    1.48   autoCalculate 1 CompleteCalcHead;
    1.49   autoCalculate 1 (Steps 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
    1.50 @@ -206,9 +206,9 @@
    1.51   re-build: fun locate_input_term ---------------------------------------------------"; 
    1.52  *)
    1.53   reset_states ();
    1.54 - CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    1.55 -	    ("Test", ["sqroot-test","univariate","equation","test"],
    1.56 -	     ["Test","squ-equ-test-subpbl1"]))];
    1.57 + CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.58 +	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.59 +	     ["Test", "squ-equ-test-subpbl1"]))];
    1.60   Iterator 1; moveActiveRoot 1;
    1.61   autoCalculate 1 CompleteCalcHead;
    1.62   autoCalculate 1 (Steps 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
    1.63 @@ -236,9 +236,9 @@
    1.64  "--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
    1.65  "--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
    1.66   reset_states ();
    1.67 - CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    1.68 -	    ("Test", ["sqroot-test","univariate","equation","test"],
    1.69 -	     ["Test","squ-equ-test-subpbl1"]))];
    1.70 + CalcTree [(["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   autoCalculate 1 CompleteCalcHead;
    1.75   autoCalculate 1 (Steps 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
    1.76 @@ -260,9 +260,9 @@
    1.77  "--------- replaceFormula: on Res + = ----------------------------";
    1.78  "--------- replaceFormula: on Res + = ----------------------------";
    1.79   reset_states ();
    1.80 - CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    1.81 -	    ("Test", ["sqroot-test","univariate","equation","test"],
    1.82 -	     ["Test","squ-equ-test-subpbl1"]))];
    1.83 + CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.84 +	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.85 +	     ["Test", "squ-equ-test-subpbl1"]))];
    1.86   Iterator 1; moveActiveRoot 1;
    1.87   autoCalculate 1 CompleteCalcHead;
    1.88   autoCalculate 1 (Steps 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
    1.89 @@ -306,9 +306,9 @@
    1.90  "--------- replaceFormula: on Res + = 1st Nd ---------------------";
    1.91  "--------- replaceFormula: on Res + = 1st Nd ---------------------";
    1.92   reset_states ();
    1.93 - CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    1.94 -	    ("Test", ["sqroot-test","univariate","equation","test"],
    1.95 -	     ["Test","squ-equ-test-subpbl1"]))];
    1.96 + CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
    1.97 +	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
    1.98 +	     ["Test", "squ-equ-test-subpbl1"]))];
    1.99   Iterator 1; moveActiveRoot 1;
   1.100   autoCalculate 1 CompleteCalcHead;
   1.101   autoCalculate 1 (Steps 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   1.102 @@ -330,9 +330,9 @@
   1.103  "--------- replaceFormula: on Frm + = 1st Nd ---------------------";
   1.104  "--------- replaceFormula: on Frm + = 1st Nd ---------------------";
   1.105   reset_states ();
   1.106 - CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   1.107 -	    ("Test", ["sqroot-test","univariate","equation","test"],
   1.108 -	     ["Test","squ-equ-test-subpbl1"]))];
   1.109 + CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   1.110 +	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   1.111 +	     ["Test", "squ-equ-test-subpbl1"]))];
   1.112   Iterator 1; moveActiveRoot 1;
   1.113   autoCalculate 1 CompleteCalcHead;
   1.114   autoCalculate 1 (Steps 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   1.115 @@ -353,9 +353,9 @@
   1.116  "--------- replaceFormula: cut calculation -----------------------";
   1.117  "--------- replaceFormula: cut calculation -----------------------";
   1.118   reset_states ();
   1.119 - CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   1.120 -	    ("Test", ["sqroot-test","univariate","equation","test"],
   1.121 -	     ["Test","squ-equ-test-subpbl1"]))];
   1.122 + CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   1.123 +	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   1.124 +	     ["Test", "squ-equ-test-subpbl1"]))];
   1.125   Iterator 1; moveActiveRoot 1;
   1.126   autoCalculate 1 CompleteCalc;
   1.127   moveActiveRoot 1; moveActiveDown 1;
   1.128 @@ -376,20 +376,20 @@
   1.129   "---------------- maximum-example, UC: Modeling / modifyCalcHead -";
   1.130  
   1.131   val p = ([],Pbl);
   1.132 - val elems = ["fixedValues [r=Arbfix]","maximum A","valuesFor [a,b]",
   1.133 + val elems = ["fixedValues [r=Arbfix]", "maximum A", "valuesFor [a,b]",
   1.134  	      "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
   1.135  	      "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]",
   1.136          "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos (alpha::real)]",
   1.137  	      (*^^^ these are the elements for the root-problem (in variants)*)
   1.138                (*vvv these are elements required for subproblems*)
   1.139 -	      "boundVariable a","boundVariable b","boundVariable alpha",
   1.140 +	      "boundVariable a", "boundVariable b", "boundVariable alpha",
   1.141  	      "interval {x::real. 0 <= x & x <= 2*r}",
   1.142  	      "interval {x::real. 0 <= x & x <= 2*r}",
   1.143  	      "interval {x::real. 0 <= x & x <= pi}",
   1.144  	      "errorBound (eps=(0::real))"]
   1.145   (*specifying is not interesting for this example*)
   1.146 - val spec = ("DiffApp", ["maximum_of","function"], 
   1.147 -	     ["DiffApp","max_by_calculus"]);
   1.148 + val spec = ("DiffApp", ["maximum_of", "function"], 
   1.149 +	     ["DiffApp", "max_by_calculus"]);
   1.150   (*the empty model with descriptions for user-guidance by Model_Problem*)
   1.151   val empty_model = [Given ["fixedValues []"],
   1.152  		    Find ["maximum", "valuesFor"],
   1.153 @@ -450,9 +450,9 @@
   1.154  "--------- syntax error ------------------------------------------";
   1.155  "--------- syntax error ------------------------------------------";
   1.156   reset_states ();
   1.157 - CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   1.158 -	    ("Test", ["sqroot-test","univariate","equation","test"],
   1.159 -	     ["Test","squ-equ-test-subpbl1"]))];
   1.160 + CalcTree [(["equality (x+1=(2::real))", "solveFor x", "solutions L"], 
   1.161 +	    ("Test", ["sqroot-test", "univariate", "equation", "test"],
   1.162 +	     ["Test", "squ-equ-test-subpbl1"]))];
   1.163   Iterator 1; moveActiveRoot 1;
   1.164   autoCalculate 1 CompleteCalcHead;
   1.165   autoCalculate 1 (Steps 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   1.166 @@ -481,7 +481,7 @@
   1.167    Compare tests "CAS-command" in test/../inssort.sml etc.
   1.168    ---------------------------------------------------------------------------------------------
   1.169  Test_Tool.show_pt pt;
   1.170 -val nxt = (Apply_Method ["Test","squ-equ-test-subpbl1"]);
   1.171 +val nxt = (Apply_Method ["Test", "squ-equ-test-subpbl1"]);
   1.172  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   1.173  if p = ([1], Frm) andalso f2str f = "x + 1 = 2" then ()
   1.174  else error "inform.sml: diff.behav. CAScmd ([],Pbl)";
   1.175 @@ -704,7 +704,7 @@
   1.176  (*the following input is copied from BridgeLog Java <==> SML,
   1.177    omitting unnecessary inputs*)
   1.178  (*1>*)reset_states ();
   1.179 -(*2>*)CalcTree [(["functionTerm (x^2 + x + 1)", "differentiateFor x", "derivative f_'_f"],("Isac_Knowledge",["derivative_of","function"],["diff","differentiate_on_R"]))];
   1.180 +(*2>*)CalcTree [(["functionTerm (x^2 + x + 1)", "differentiateFor x", "derivative f_'_f"],("Isac_Knowledge",["derivative_of", "function"],["diff", "differentiate_on_R"]))];
   1.181  (*3>*)Iterator 1; moveActiveRoot 1;
   1.182  
   1.183  (*6>*)(*completeCalcHead*)autoCalculate 1 CompleteCalcHead;
   1.184 @@ -1007,7 +1007,7 @@
   1.185  reset_states ();     
   1.186  CalcTree
   1.187  [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
   1.188 -  ("Isac_Knowledge", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
   1.189 +  ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
   1.190  Iterator 1;
   1.191  moveActiveRoot 1;
   1.192  autoCalculate 1 CompleteCalcHead;
   1.193 @@ -1043,7 +1043,7 @@
   1.194                		    {errpats, nrls, scr = Rule.Prog prog, ...} => (errpats, nrls, prog)
   1.195                		  | _ => error "inform: uncovered case of Method.from_store"
   1.196  ;
   1.197 -(*+*)if Error_Pattern.s_to_string errpats = "[(\"chain-rule-diff-both\",\n[\"d_d ?bdv (sin ?u) = cos (d_d ?bdv ?u)\",\"d_d ?bdv (cos ?u) = - sin (d_d ?bdv ?u)\",\"d_d ?bdv (?u ^^^ ?n) = ?n * ?u ^^^ (?n - 1)\",\"d_d ?bdv (LogExp.ln ?u) = 1 / ?u\",\"d_d ?bdv (LogExp.ln ?u) = 1 / d_d ?bdv ?u\"],\n[\"d_d ?bdv (sin ?u) = cos ?u * d_d ?bdv ?u\",\"d_d ?bdv (cos ?u) = - sin ?u * d_d ?bdv ?u\",\"d_d ?bdv (?u ^^^ ?n) = ?n * ?u ^^^ (?n - 1) * d_d ?bdv ?u\",\"d_d ?bdv (LogExp.ln ?u) = d_d ?bdv ?u / ?u\",\"d_d ?bdv (E_ ^^^ ?u) = E_ ^^^ ?u * d_d ?x ?u\"]]"
   1.198 +(*+*)if Error_Pattern.s_to_string errpats = "[(\"chain-rule-diff-both\",\n[\"d_d ?bdv (sin ?u) = cos (d_d ?bdv ?u)\", \"d_d ?bdv (cos ?u) = - sin (d_d ?bdv ?u)\", \"d_d ?bdv (?u ^^^ ?n) = ?n * ?u ^^^ (?n - 1)\", \"d_d ?bdv (LogExp.ln ?u) = 1 / ?u\", \"d_d ?bdv (LogExp.ln ?u) = 1 / d_d ?bdv ?u\"],\n[\"d_d ?bdv (sin ?u) = cos ?u * d_d ?bdv ?u\", \"d_d ?bdv (cos ?u) = - sin ?u * d_d ?bdv ?u\", \"d_d ?bdv (?u ^^^ ?n) = ?n * ?u ^^^ (?n - 1) * d_d ?bdv ?u\", \"d_d ?bdv (LogExp.ln ?u) = d_d ?bdv ?u / ?u\", \"d_d ?bdv (E_ ^^^ ?u) = E_ ^^^ ?u * d_d ?x ?u\"]]"
   1.199  (*+*)then () else error "inform with (positive) Error_Pattern.check_for broken 3";
   1.200  
   1.201              		  val {env, ...} = Ctree.get_istate_LI pt pos |> Istate.the_pstate
   1.202 @@ -1067,7 +1067,7 @@
   1.203  reset_states ();
   1.204  CalcTree
   1.205  [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
   1.206 -  ("Isac_Knowledge", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
   1.207 +  ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
   1.208  Iterator 1;
   1.209  moveActiveRoot 1;
   1.210  autoCalculate 1 CompleteCalcHead;
   1.211 @@ -1152,7 +1152,7 @@
   1.212  reset_states ();
   1.213  CalcTree
   1.214  [(["functionTerm (x ^ 2 + sin (x ^ 4))", "differentiateFor x", "derivative f_f'"], 
   1.215 -  ("Isac_Knowledge", ["derivative_of","function"], ["diff","differentiate_on_R"]))];
   1.216 +  ("Isac_Knowledge", ["derivative_of", "function"], ["diff", "differentiate_on_R"]))];
   1.217  Iterator 1;
   1.218  moveActiveRoot 1;
   1.219  autoCalculate 1 CompleteCalcHead;
   1.220 @@ -1279,16 +1279,16 @@
   1.221       (Rule_Set.rep Test_simplify, str2term "x+1+ -1*2=0", str2term "-2*1+(x+1)=0");
   1.222   (tracing o Derive.trtas2str) fod';
   1.223  > ["
   1.224 -(x + 1 + -1 * 2 = 0, Thm ("radd_commute","?m + ?n = ?n + ?m"), (-1 * 2 + (x + 1) = 0, []))","
   1.225 -(-1 * 2 + (x + 1) = 0, Thm ("radd_commute","?m + ?n = ?n + ?m"), (-1 * 2 + (1 + x) = 0, []))","
   1.226 -(-1 * 2 + (1 + x) = 0, Thm ("radd_left_commute","?x + (?y + ?z) = ?y + (?x + ?z)"), (1 + (-1 * 2 + x) = 0, []))","
   1.227 -(1 + (-1 * 2 + x) = 0, Thm ("#mult_Float ((~1,0), (0,0)) __ ((2,0), (0,0))","-1 * 2 = -2"), (1 + (-2 + x) = 0, []))"]
   1.228 +(x + 1 + -1 * 2 = 0, Thm ("radd_commute", "?m + ?n = ?n + ?m"), (-1 * 2 + (x + 1) = 0, []))", "
   1.229 +(-1 * 2 + (x + 1) = 0, Thm ("radd_commute", "?m + ?n = ?n + ?m"), (-1 * 2 + (1 + x) = 0, []))", "
   1.230 +(-1 * 2 + (1 + x) = 0, Thm ("radd_left_commute", "?x + (?y + ?z) = ?y + (?x + ?z)"), (1 + (-1 * 2 + x) = 0, []))", "
   1.231 +(1 + (-1 * 2 + x) = 0, Thm ("#mult_Float ((~1,0), (0,0)) __ ((2,0), (0,0))", "-1 * 2 = -2"), (1 + (-2 + x) = 0, []))"]
   1.232  val it = () : unit
   1.233   (tracing o Derive.trtas2str) (map Derive.rev_deriv' rifod');
   1.234  > ["
   1.235 -(1 + (-2 + x) = 0, Thm ("sym_#mult_Float ((~2,0), (0,0)) __ ((1,0), (0,0))","-2 = -2 * 1"), (1 + (-2 * 1 + x) = 0, []))","
   1.236 -(1 + (-2 * 1 + x) = 0, Thm ("sym_radd_left_commute","?y + (?x + ?z) = ?x + (?y + ?z)"), (-2 * 1 + (1 + x) = 0, []))","
   1.237 -(-2 * 1 + (1 + x) = 0, Thm ("sym_radd_commute","?n + ?m = ?m + ?n"), (-2 * 1 + (x + 1) = 0, []))"]
   1.238 +(1 + (-2 + x) = 0, Thm ("sym_#mult_Float ((~2,0), (0,0)) __ ((1,0), (0,0))", "-2 = -2 * 1"), (1 + (-2 * 1 + x) = 0, []))", "
   1.239 +(1 + (-2 * 1 + x) = 0, Thm ("sym_radd_left_commute", "?y + (?x + ?z) = ?x + (?y + ?z)"), (-2 * 1 + (1 + x) = 0, []))", "
   1.240 +(-2 * 1 + (1 + x) = 0, Thm ("sym_radd_commute", "?n + ?m = ?m + ?n"), (-2 * 1 + (x + 1) = 0, []))"]
   1.241  val it = () : unit
   1.242  *)
   1.243  "--------- handle an input formula -------------------------------";