test/Tools/isac/Interpret/inform.sml
branchisac-update-Isa09-2
changeset 38031 460c24a6a6ba
parent 37967 bd4f7a35e892
child 38050 4c52ad406c20
     1.1 --- a/test/Tools/isac/Interpret/inform.sml	Tue Sep 28 08:58:06 2010 +0200
     1.2 +++ b/test/Tools/isac/Interpret/inform.sml	Tue Sep 28 09:06:56 2010 +0200
     1.3 @@ -64,7 +64,7 @@
     1.4   val str = pr_ptree pr_short pt;
     1.5   writeln str;
     1.6   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 ()
     1.7 - else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 1";
     1.8 + else error "inform.sml: diff.behav.appendFormula: on Res + equ 1";
     1.9  
    1.10   moveDown 1 ([ ],Pbl); refFormula 1 ([1],Frm); (*x + 1 = 2*)
    1.11   moveDown 1 ([1],Frm); refFormula 1 ([1],Res); (*x + 1 + -1 * 2 = 0*)
    1.12 @@ -79,16 +79,16 @@
    1.13   moveDown 1 ([2,5],Res); refFormula 1 ([2,6],Res);
    1.14   val ((pt,_),_) = get_calc 1;
    1.15   if "-2 * 1 + (1 + x) = 0" = term2str (fst (get_obj g_result pt [2,6])) then()
    1.16 - else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 2";
    1.17 + else error "inform.sml: diff.behav.appendFormula: on Res + equ 2";
    1.18  
    1.19   fetchProposedTactic 1; (*takes Iterator 1 _1_*)
    1.20   val (_,(tac,_,_)::_) = get_calc 1;
    1.21   if tac = Rewrite_Set "Test_simplify" then ()
    1.22 - else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 3";
    1.23 + else error "inform.sml: diff.behav.appendFormula: on Res + equ 3";
    1.24   autoCalculate 1 CompleteCalc;
    1.25   val ((pt,_),_) = get_calc 1;
    1.26   if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
    1.27 - else raise error "inform.sml: diff.behav.appendFormula: on Res + equ 4";
    1.28 + else error "inform.sml: diff.behav.appendFormula: on Res + equ 4";
    1.29   (* autoCalculate 1 CompleteCalc;
    1.30     val ((pt,p),_) = get_calc 1;
    1.31     (writeln o istates2str) (get_obj g_loc pt [ ]);  
    1.32 @@ -144,16 +144,16 @@
    1.33   moveDown 1 ([1,5],Res); refFormula 1 ([1,6],Res); 
    1.34   val ((pt,_),_) = get_calc 1;
    1.35   if "2 + -1 + x = 2" = term2str (fst (get_obj g_result pt [1,6])) then()
    1.36 - else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 1";
    1.37 + else error "inform.sml: diff.behav.appendFormula: on Frm + equ 1";
    1.38  
    1.39   fetchProposedTactic 1; (*takes Iterator 1 _1_*)
    1.40   val (_,(tac,_,_)::_) = get_calc 1;
    1.41   if tac = Rewrite_Set "norm_equation" then ()
    1.42 - else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 2";
    1.43 + else error "inform.sml: diff.behav.appendFormula: on Frm + equ 2";
    1.44   autoCalculate 1 CompleteCalc;
    1.45   val ((pt,_),_) = get_calc 1;
    1.46   if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
    1.47 - else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
    1.48 + else error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
    1.49  
    1.50  
    1.51  "--------- appendFormula: on Res + NO deriv ----------------------";
    1.52 @@ -175,16 +175,16 @@
    1.53   writeln str;
    1.54   if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n" andalso p = ([1], Res)
    1.55   then ()
    1.56 - else raise error "inform.sml: diff.behav.appendFormula: Res + NOder 1";
    1.57 + else error "inform.sml: diff.behav.appendFormula: Res + NOder 1";
    1.58  
    1.59   fetchProposedTactic 1;
    1.60   val (_,(tac,_,_)::_) = get_calc 1;
    1.61   if tac = Rewrite_Set "Test_simplify" then ()
    1.62 - else raise error "inform.sml: diff.behav.appendFormula: Res + NOder 2";
    1.63 + else error "inform.sml: diff.behav.appendFormula: Res + NOder 2";
    1.64   autoCalculate 1 CompleteCalc;
    1.65   val ((pt,_),_) = get_calc 1;
    1.66   if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
    1.67 - else raise error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
    1.68 + else error "inform.sml: diff.behav.appendFormula: on Frm + equ 3";
    1.69  
    1.70  
    1.71  "--------- appendFormula: on Res + late deriv --------------------";
    1.72 @@ -206,16 +206,16 @@
    1.73   writeln str;
    1.74   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)
    1.75   then () (*finds 1 step too early: ([3,2], Res) "x = 1" also by script !!!*)
    1.76 - else raise error "inform.sml: diff.behav.appendFormula: Res + late d 1";
    1.77 + else error "inform.sml: diff.behav.appendFormula: Res + late d 1";
    1.78   
    1.79   fetchProposedTactic 1;
    1.80   val (_,(tac,_,_)::_) = get_calc 1;
    1.81   if tac = Check_Postcond ["linear", "univariate", "equation", "test"] then ()
    1.82 - else raise error "inform.sml: diff.behav.appendFormula: Res + late d 2";
    1.83 + else error "inform.sml: diff.behav.appendFormula: Res + late d 2";
    1.84   autoCalculate 1 CompleteCalc;
    1.85   val ((pt,_),_) = get_calc 1;
    1.86   if "[x = 1]" = term2str (fst (get_obj g_result pt [])) then ()
    1.87 - else raise error "inform.sml: diff.behav.appendFormula: Res + late d 3";
    1.88 + else error "inform.sml: diff.behav.appendFormula: Res + late d 3";
    1.89  
    1.90  
    1.91  "--------- appendFormula: on Res + late deriv [x = 3 + -2]---///--";
    1.92 @@ -235,12 +235,12 @@
    1.93   val str = pr_ptree pr_short pt;
    1.94   writeln str;
    1.95   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 ()
    1.96 - else raise error "inform.sml: diff.behav.appendFormula: Res + latEE 1";
    1.97 + else error "inform.sml: diff.behav.appendFormula: Res + latEE 1";
    1.98   autoCalculate 1 CompleteCalc;
    1.99   val ((pt,p),_) = get_calc 1;
   1.100   if "[x = 3 + -2 * 1]" = term2str (fst (get_obj g_result pt [])) then ()
   1.101   (*       ~~~~~~~~~~ simplify as last step in any script ?!*)
   1.102 - else raise error "inform.sml: diff.behav.appendFormula: Res + latEE 2";
   1.103 + else error "inform.sml: diff.behav.appendFormula: Res + latEE 2";
   1.104  
   1.105  
   1.106  
   1.107 @@ -263,11 +263,11 @@
   1.108   val str = pr_ptree pr_short pt;
   1.109   writeln str;
   1.110   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()
   1.111 - else raise error "inform.sml: diff.behav.replaceFormula: on Res += 1";
   1.112 + else error "inform.sml: diff.behav.replaceFormula: on Res += 1";
   1.113   autoCalculate 1 CompleteCalc;
   1.114   val ((pt,pos as(p,_)),_) = get_calc 1;
   1.115   if pos=([],Res)andalso"[x = 1]"=(term2str o fst)(get_obj g_result pt p)then()
   1.116 - else raise error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
   1.117 + else error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
   1.118   
   1.119  
   1.120  "--------- replaceFormula: on Res + = 1st Nd ---------------------";
   1.121 @@ -288,11 +288,11 @@
   1.122   val str = pr_ptree pr_short pt;
   1.123   writeln str;
   1.124   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 ()
   1.125 - else raise error "inform.sml: diff.behav.replaceFormula: on Res 1 + = 1";
   1.126 + else error "inform.sml: diff.behav.replaceFormula: on Res 1 + = 1";
   1.127   autoCalculate 1 CompleteCalc;
   1.128   val ((pt,pos as(p,_)),_) = get_calc 1;
   1.129   if pos=([],Res)andalso"[x = 1]"=(term2str o fst)(get_obj g_result pt p)then()
   1.130 - else raise error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
   1.131 + else error "inform.sml: diff.behav.replaceFormula: on Res + = 2";
   1.132  
   1.133  
   1.134  "--------- replaceFormula: on Frm + = 1st Nd ---------------------";
   1.135 @@ -312,11 +312,11 @@
   1.136   val str = pr_ptree pr_short pt;
   1.137   writeln str;
   1.138   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 ()
   1.139 - else raise error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 1";
   1.140 + else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 1";
   1.141   autoCalculate 1 CompleteCalc;
   1.142   val ((pt,pos as(p,_)),_) = get_calc 1;
   1.143   if pos=([],Res)andalso"[x = 1]"=(term2str o fst)(get_obj g_result pt p)then()
   1.144 - else raise error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 2";
   1.145 + else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 2";
   1.146  
   1.147  
   1.148  "--------- replaceFormula: cut calculation -----------------------";
   1.149 @@ -331,14 +331,14 @@
   1.150   autoCalculate 1 CompleteCalc;
   1.151   moveActiveRoot 1; moveActiveDown 1;
   1.152   if get_pos 1 1 = ([1], Frm) then ()
   1.153 - else raise error "inform.sml: diff.behav. cut calculation 1";
   1.154 + else error "inform.sml: diff.behav. cut calculation 1";
   1.155  
   1.156   replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   1.157   val ((pt,p),_) = get_calc 1;
   1.158   val str = pr_ptree pr_short pt;
   1.159   writeln str;
   1.160   if p = ([1], Res) then ()
   1.161 - else raise error "inform.sml: diff.behav. cut calculation 2";
   1.162 + else error "inform.sml: diff.behav. cut calculation 2";
   1.163  
   1.164  
   1.165  
   1.166 @@ -385,7 +385,7 @@
   1.167   (*the empty CalcHead is checked w.r.t the model and re-established as such*)
   1.168   val (b,pt,ocalhd) = input_icalhd pt (p,"", empty_model, Pbl, e_spec);
   1.169   val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl; 
   1.170 - 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 raise error "informtest.sml: diff.behav. max 1";
   1.171 + 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";
   1.172  
   1.173   (*there is one input to the model (could be more)*)
   1.174   val (b,pt,ocalhd) = 
   1.175 @@ -394,7 +394,7 @@
   1.176  			     Relate ["relations"]], Pbl, e_spec);
   1.177   val pbl = get_obj g_pbl pt (fst p); (writeln o (itms2str_ ctxt)) pbl; 
   1.178   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 () 
   1.179 - else raise error "informtest.sml: diff.behav. max 2";
   1.180 + else error "informtest.sml: diff.behav. max 2";
   1.181  
   1.182   (*this input is complete in variant 3, but the ME doesn't recognize FIXXXXME
   1.183   val (b,pt''''',ocalhd) = 
   1.184 @@ -435,7 +435,7 @@
   1.185   val str = pr_ptree pr_short pt;
   1.186   writeln str;
   1.187   if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n" then ()
   1.188 - else raise error "inform.sml: diff.behav.appendFormula: syntax error";
   1.189 + else error "inform.sml: diff.behav.appendFormula: syntax error";
   1.190  
   1.191  
   1.192  "--------- CAS-command on ([],Pbl) -------------------------------";
   1.193 @@ -449,7 +449,7 @@
   1.194  val nxt = ("Apply_Method",Apply_Method ["Test","squ-equ-test-subpbl1"]);
   1.195  val (p,_,f,nxt,_,pt) = me nxt p [] pt;
   1.196  if p = ([1], Frm) andalso f2str f = "x + 1 = 2" then ()
   1.197 -else raise error "inform.sml: diff.behav. CAScmd ([],Pbl)";
   1.198 +else error "inform.sml: diff.behav. CAScmd ([],Pbl)";
   1.199  
   1.200  
   1.201  "--------- CAS-command on ([],Pbl) FE-interface ------------------";
   1.202 @@ -464,7 +464,7 @@
   1.203  val ((pt,p),_) = get_calc 1;
   1.204  show_pt pt;
   1.205  if p = ([], Res) then ()
   1.206 -else raise error "inform.sml: diff.behav. CAScmd ([],Pbl) FE-interface";
   1.207 +else error "inform.sml: diff.behav. CAScmd ([],Pbl) FE-interface";
   1.208  
   1.209  
   1.210  "--------- inform [rational,simplification] ----------------------";
   1.211 @@ -484,20 +484,20 @@
   1.212  appendFormula 1 "(4 * y + -3 * x) / (x * y) + -1";
   1.213  val ((pt,p),_) = get_calc 1;
   1.214  if p = ([4], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
   1.215 -else raise error ("inform.sml: [rational,simplification] 1");
   1.216 +else error ("inform.sml: [rational,simplification] 1");
   1.217  
   1.218  "--- input the next formula that would be presented by mat-engine";
   1.219  (*autoCalculate 1 (Step 1);*)
   1.220  appendFormula 1 "(4 * y + -3 * x + -1 * (x * y)) / (x * y)";
   1.221  val ((pt,p),_) = get_calc 1;
   1.222  if p = ([5], Res) andalso (length o children o (get_nd pt)) (fst p) = 0 then ()
   1.223 -else raise error ("inform.sml: [rational,simplification] 2");
   1.224 +else error ("inform.sml: [rational,simplification] 2");
   1.225  
   1.226  "--- input the exact final result";(*TODO: Exception- LIST "last_elem" raised*)
   1.227  appendFormula 1 "(-3 * x + 4 * y + -1 * x * y) / (x * y)";
   1.228  val ((pt,p),_) = get_calc 1;
   1.229  if p = ([6], Res) andalso (length o children o (get_nd pt)) (fst p) = 2 then ()
   1.230 -else raise error ("inform.sml: [rational,simplification] 3");
   1.231 +else error ("inform.sml: [rational,simplification] 3");
   1.232  show_pt pt;
   1.233  
   1.234  "--------- Take as 1st tac, start with <NEW> (CAS input) ---------";
   1.235 @@ -565,7 +565,7 @@
   1.236  val Form res = (#1 o pt_extract) (pt, ([],Res));
   1.237  show_pt pt;
   1.238  if p = ([], Res) andalso term2str res = "1 + 2 * x" then ()
   1.239 -else raise error "diff.sml behav.changed for Diff (x^2 + x + 1, x)";
   1.240 +else error "diff.sml behav.changed for Diff (x^2 + x + 1, x)";
   1.241  
   1.242  
   1.243  "--------- Take as 1st tac, start from exp -----------------------";
   1.244 @@ -609,7 +609,7 @@
   1.245  val ((pt,p),_) = get_calc 1;
   1.246  val Form res = (#1 o pt_extract) (pt, p);
   1.247  if term2str res = "d_d x (x ^^^ 2 + x + 1)" then ()
   1.248 -else raise error "diff.sml Diff (x^2 + x + 1, x) from exp";
   1.249 +else error "diff.sml Diff (x^2 + x + 1, x) from exp";
   1.250  
   1.251  
   1.252  "--------- init_form, start with <NEW> (CAS input) ---------------";