test/Tools/isac/Interpret/ctree.sml
changeset 59279 255c853ea2f0
parent 59267 aab874fdd910
child 59283 96c2da5217f8
     1.1 --- a/test/Tools/isac/Interpret/ctree.sml	Thu Dec 22 11:12:18 2016 +0100
     1.2 +++ b/test/Tools/isac/Interpret/ctree.sml	Thu Dec 22 11:36:20 2016 +0100
     1.3 @@ -13,23 +13,23 @@
     1.4  "-------------- fun get_ctxt -------------------------------------";
     1.5  "-------------- fun update_ctxt, fun g_ctxt ----------------------";
     1.6  "-------------- check positions in miniscript --------------------";
     1.7 -"-------------- get_allpos' (from ptree above)--------------------";
     1.8 -"-------------- cut_level (from ptree above)----------------------";
     1.9 -"-------------- cut_tree (from ptree above)-----------------------";
    1.10 -"=====new ptree 1a miniscript with mini-subpbl ===================";
    1.11 +"-------------- get_allpos' (from ctree above)--------------------";
    1.12 +"-------------- cut_level (from ctree above)----------------------";
    1.13 +"-------------- cut_tree (from ctree above)-----------------------";
    1.14 +"=====new ctree 1a miniscript with mini-subpbl ===================";
    1.15  "-------------- cut_level ( ,Frm) on Incomplete Nd ---------------";
    1.16 -"=====new ptree 2 miniscript with mini-subpbl ====================";
    1.17 -"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
    1.18 -"-------------- cappend (from ptree above)------------------------";
    1.19 +"=====new ctree 2 miniscript with mini-subpbl ====================";
    1.20 +"-------------- cut_tree (intermedi.ctree: 3rd level)-------------";
    1.21 +"-------------- cappend (from ctree above)------------------------";
    1.22  "-------------- cappend minisubpbl -------------------------------";
    1.23 -"=====new ptree 3 ================================================";
    1.24 +"=====new ctree 3 ================================================";
    1.25  "-------------- move_dn ------------------------------------------";
    1.26  "-------------- move_dn: Frm -> Res ------------------------------";
    1.27  "-------------- move_up ------------------------------------------";
    1.28  "------ move into detail -----------------------------------------";
    1.29 -"=====new ptree 3a ===============================================";
    1.30 +"=====new ctree 3a ===============================================";
    1.31  "-------------- move_dn in Incomplete ctree ----------------------";
    1.32 -"=====new ptree 4: crooked by cut_level_'_ =======================";
    1.33 +"=====new ctree 4: crooked by cut_level_'_ =======================";
    1.34  (*############## development stopped 0501 ########################*)
    1.35  (******************************************************************)
    1.36  (*              val SAVE_get_trace = get_trace;                   *)
    1.37 @@ -39,13 +39,13 @@
    1.38  (*              val get_trace = SAVE_get_trace;                   *)
    1.39  (******************************************************************)
    1.40  (*############## development stopped 0501 ########################*)
    1.41 -"=====new ptree 4 ratequation ====================================";
    1.42 +"=====new ctree 4 ratequation ====================================";
    1.43  "-------------- pt_extract form, tac, asm<>[] --------------------";
    1.44 -"=====new ptree 5 minisubpbl =====================================";
    1.45 +"=====new ctree 5 minisubpbl =====================================";
    1.46  "-------------- pt_extract form, tac, asm ------------------------";
    1.47 -"=====new ptree 6 minisubpbl intersteps ==========================";
    1.48 +"=====new ctree 6 minisubpbl intersteps ==========================";
    1.49  "-------------- get_allpos' new ----------------------------------";
    1.50 -"-------------- cut_tree new (from ptree above)-------------------";
    1.51 +"-------------- cut_tree new (from ctree above)-------------------";
    1.52  "-------------- subst2subs subs2subst sube2subst subte2subst -----";
    1.53  "-----------------------------------------------------------------";
    1.54  "-----------------------------------------------------------------";
    1.55 @@ -105,7 +105,7 @@
    1.56  
    1.57  val cuts = get_allp [] ([], ([],Frm)) pt;
    1.58  val cuts2 = get_allps [] [1] (children pt);
    1.59 -"ctree.sml-------------- cut_tree new (from ptree above)----------";
    1.60 +"ctree.sml-------------- cut_tree new (from ctree above)----------";
    1.61  val (pt', cuts) = cut_tree pt ([1],Frm);
    1.62  "ctree.sml-------------- cappend on complete ctree from above ----";
    1.63  val (pt', cuts) = cappend_form pt [1] (e_istate, e_ctxt) (str2term "Inform[1]");
    1.64 @@ -139,9 +139,9 @@
    1.65  
    1.66   show_pt pt;
    1.67  
    1.68 -"-------------- get_allpos' (from ptree above)--------------------";
    1.69 -"-------------- get_allpos' (from ptree above)--------------------";
    1.70 -"-------------- get_allpos' (from ptree above)--------------------";
    1.71 +"-------------- get_allpos' (from ctree above)--------------------";
    1.72 +"-------------- get_allpos' (from ctree above)--------------------";
    1.73 +"-------------- get_allpos' (from ctree above)--------------------";
    1.74  if get_allpos' ([], 1) pt = 
    1.75     [([], Frm), 
    1.76      ([1], Frm), 
    1.77 @@ -206,9 +206,9 @@
    1.78  
    1.79  
    1.80  
    1.81 -"-------------- cut_level (from ptree above)----------------------";
    1.82 -"-------------- cut_level (from ptree above)----------------------";
    1.83 -"-------------- cut_level (from ptree above)----------------------";
    1.84 +"-------------- cut_level (from ctree above)----------------------";
    1.85 +"-------------- cut_level (from ctree above)----------------------";
    1.86 +"-------------- cut_level (from ctree above)----------------------";
    1.87  show_pt pt;
    1.88  show_pt pt';
    1.89  default_print_depth 99; cuts; default_print_depth 3;
    1.90 @@ -252,25 +252,25 @@
    1.91  	   ([4], Res)]
    1.92  then () else error "ctree.sml: diff:behav. in cut_level 2a";
    1.93  
    1.94 -if pr_ptree pr_short pt' = ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n"
    1.95 +if pr_ctree pr_short pt' = ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n"
    1.96  then () else error "ctree.sml: diff:behav. in cut_level 2b";
    1.97  
    1.98  val (pt',cuts) = cut_level [] [3] pt ([3,1],Frm);
    1.99  if cuts = [([3, 1], Res), ([3, 2], Res)]
   1.100  then () else error "ctree.sml: diff:behav. in cut_level 3a";
   1.101 -if pr_ptree pr_short pt' = ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n3.    ----- pblobj -----\n3.1.   -1 + x = 0\n4.   [x = 1]\n"
   1.102 +if pr_ctree pr_short pt' = ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n3.    ----- pblobj -----\n3.1.   -1 + x = 0\n4.   [x = 1]\n"
   1.103  then () else error "ctree.sml: diff:behav. in cut_level 3b";
   1.104  
   1.105  val (pt',cuts) = cut_level [] [3] pt ([3,1],Res);
   1.106  if cuts = [([3, 2], Res)]
   1.107  then () else error "ctree.sml: diff:behav. in cut_level 4a";
   1.108 -if pr_ptree pr_short pt' = ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n3.    ----- pblobj -----\n3.1.   -1 + x = 0\n4.   [x = 1]\n"
   1.109 +if pr_ctree pr_short pt' = ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n3.    ----- pblobj -----\n3.1.   -1 + x = 0\n4.   [x = 1]\n"
   1.110  then () else error "ctree.sml: diff:behav. in cut_level 4b";
   1.111  
   1.112  
   1.113 -"-------------- cut_tree (from ptree above)-----------------------";
   1.114 -"-------------- cut_tree (from ptree above)-----------------------";
   1.115 -"-------------- cut_tree (from ptree above)-----------------------";
   1.116 +"-------------- cut_tree (from ctree above)-----------------------";
   1.117 +"-------------- cut_tree (from ctree above)-----------------------";
   1.118 +"-------------- cut_tree (from ctree above)-----------------------";
   1.119  val (pt', cuts) = cut_tree pt ([2],Frm);(*not created by move_dn -- not on WS*)
   1.120  
   1.121  (*============ inhibit exn AK110726 ==============================================
   1.122 @@ -340,9 +340,9 @@
   1.123  	   ([], Res)]
   1.124  then () else error "ctree.sml: diff:behav. in cut_tree 4";
   1.125  
   1.126 -"=====new ptree 1a miniscript with mini-subpbl ===================";
   1.127 -"=====new ptree 1a miniscript with mini-subpbl ===================";
   1.128 -"=====new ptree 1a miniscript with mini-subpbl ===================";
   1.129 +"=====new ctree 1a miniscript with mini-subpbl ===================";
   1.130 +"=====new ctree 1a miniscript with mini-subpbl ===================";
   1.131 +"=====new ctree 1a miniscript with mini-subpbl ===================";
   1.132  val fmz = ["equality (x+1=(2::real))", "solveFor x","solutions L"];
   1.133  val (dI',pI',mI') =
   1.134    ("Test",["sqroot-test","univariate","equation","test"],
   1.135 @@ -383,9 +383,9 @@
   1.136  
   1.137  
   1.138  
   1.139 -"=====new ptree 2 miniscript with mini-subpbl ====================";
   1.140 -"=====new ptree 2 miniscript with mini-subpbl ====================";
   1.141 -"=====new ptree 2 miniscript with mini-subpbl ====================";
   1.142 +"=====new ctree 2 miniscript with mini-subpbl ====================";
   1.143 +"=====new ctree 2 miniscript with mini-subpbl ====================";
   1.144 +"=====new ctree 2 miniscript with mini-subpbl ====================";
   1.145  reset_states ();
   1.146   CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   1.147     ("Test", ["sqroot-test","univariate","equation","test"],
   1.148 @@ -401,9 +401,9 @@
   1.149  if (term2str o fst) (get_obj g_result pt [3,2,1]) = "x = 0 + 1" then ()
   1.150  else error "mini-subpbl interSteps broken";
   1.151  
   1.152 -"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
   1.153 -"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
   1.154 -"-------------- cut_tree (intermedi.ptree: 3rd level)-------------";
   1.155 +"-------------- cut_tree (intermedi.ctree: 3rd level)-------------";
   1.156 +"-------------- cut_tree (intermedi.ctree: 3rd level)-------------";
   1.157 +"-------------- cut_tree (intermedi.ctree: 3rd level)-------------";
   1.158  (*WN050225 intermed. outcommented
   1.159   val (pt', cuts) = cut_tree pt ([3,2,1],Frm);
   1.160   if cuts = [([3, 2, 1], Res),
   1.161 @@ -421,9 +421,9 @@
   1.162   then () else error "ctree.sml: diff:behav. in cut_tree 3rd level 2";
   1.163  
   1.164  
   1.165 -"-------------- cappend (from ptree above)------------------------";
   1.166 -"-------------- cappend (from ptree above)------------------------";
   1.167 -"-------------- cappend (from ptree above)------------------------";
   1.168 +"-------------- cappend (from ctree above)------------------------";
   1.169 +"-------------- cappend (from ctree above)------------------------";
   1.170 +"-------------- cappend (from ctree above)------------------------";
   1.171  val (pt',cuts) = cappend_form pt [3,2,1] e_istate (str2term "newnew");
   1.172  if cuts = [([3, 2, 1], Res),
   1.173  	   ([3, 2, 2], Res),
   1.174 @@ -452,7 +452,7 @@
   1.175  "-------------- cappend minisubpbl -------------------------------";
   1.176  "-------------- cappend minisubpbl -------------------------------";
   1.177  "-------------- cappend minisubpbl -------------------------------";
   1.178 -"=====new ptree 1 miniscript with mini-subpbl ====================";
   1.179 +"=====new ctree 1 miniscript with mini-subpbl ====================";
   1.180  val fmz = ["equality (x+1=(2::real))", "solveFor x","solutions L"];
   1.181  val (dI',pI',mI') =
   1.182    ("Test",["sqroot-test","univariate","equation","test"],
   1.183 @@ -550,9 +550,9 @@
   1.184  
   1.185  WN050225 intermed. outcommented---*)
   1.186  
   1.187 -"=====new ptree 3 ================================================";
   1.188 -"=====new ptree 3 ================================================";
   1.189 -"=====new ptree 3 ================================================";
   1.190 +"=====new ctree 3 ================================================";
   1.191 +"=====new ctree 3 ================================================";
   1.192 +"=====new ctree 3 ================================================";
   1.193  
   1.194  reset_states ();
   1.195   CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   1.196 @@ -665,9 +665,9 @@
   1.197   if p = ([2, 6], Res) then() 
   1.198   else error "ctree.sml: diff.behav. in move into detail";
   1.199  
   1.200 -"=====new ptree 3a ===============================================";
   1.201 -"=====new ptree 3a ===============================================";
   1.202 -"=====new ptree 3a ===============================================";
   1.203 +"=====new ctree 3a ===============================================";
   1.204 +"=====new ctree 3a ===============================================";
   1.205 +"=====new ctree 3a ===============================================";
   1.206   reset_states ();
   1.207   CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   1.208     ("Test", ["sqroot-test","univariate","equation","test"],
   1.209 @@ -698,9 +698,9 @@
   1.210  
   1.211  
   1.212  
   1.213 -"=====new ptree 4: crooked by cut_level_'_ =======================";
   1.214 -"=====new ptree 4: crooked by cut_level_'_ =======================";
   1.215 -"=====new ptree 4: crooked by cut_level_'_ =======================";
   1.216 +"=====new ctree 4: crooked by cut_level_'_ =======================";
   1.217 +"=====new ctree 4: crooked by cut_level_'_ =======================";
   1.218 +"=====new ctree 4: crooked by cut_level_'_ =======================";
   1.219  reset_states ();
   1.220  CalcTree
   1.221  [(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
   1.222 @@ -733,11 +733,11 @@
   1.223  moveActiveFormula 1 ([4,2],Res)(*4.2.1.*);
   1.224  interSteps 1 ([4,2],Res)(*..is activeFormula !?!*);
   1.225  val ((pt,_),_) = get_calc 1;
   1.226 -writeln(pr_ptree pr_short pt);
   1.227 +writeln(pr_ctree pr_short pt);
   1.228  (*delete [4,1] in order to make pos [4],[4,4] for pblobjs differen [4],[4,3]:
   1.229   ###########################################################################*)
   1.230  val (pt, ppp) = cut_level_'_ [] [] pt ([4,1],Frm);
   1.231 -writeln(pr_ptree pr_short pt);
   1.232 +writeln(pr_ctree pr_short pt);
   1.233  
   1.234  
   1.235  
   1.236 @@ -785,7 +785,7 @@
   1.237  	 | SOME t => term2str (subst_atomic (mk_env probl) t)
   1.238      end;
   1.239  *)
   1.240 -(*.get an 'interval' from ptree down to a certain level
   1.241 +(*.get an 'interval' from ctree down to a certain level
   1.242     by 'take_fromto children' of the nodes with specific 'from' and 'to';
   1.243     'i > 0' suppresses output during recursive descent towards 'from'
   1.244     b: the 'from' incremented to the actual pos
   1.245 @@ -820,7 +820,7 @@
   1.246      (getnd i             (       b,[0]) [99999] nd) @
   1.247      (getnds ~99999 false (lev_on b,[0]) q nds); 
   1.248  in
   1.249 -(*get an 'interval from to' from a ptree as 'intervals f t' of respective nodes
   1.250 +(*get an 'interval from to' from a ctree as 'intervals f t' of respective nodes
   1.251    where 'from' are pos, i.e. a key as int list, 'f' an int (to,t analoguous)
   1.252  (1) the 'f' are given 
   1.253  (1a) by 'from' if 'f' = the respective element of 'from' (left margin)
   1.254 @@ -834,7 +834,7 @@
   1.255  	(take_fromto (hdp p) (hdq q) (children pt));
   1.256  end;
   1.257  
   1.258 -writeln(pr_ptree pr_short pt);
   1.259 +writeln(pr_ctree pr_short pt);
   1.260  
   1.261  case get_trace pt [1,3] [4,1,1] of
   1.262      [[1,3],[1,4],[2],[3],[4],[4,1],[4,1,1]] => () 
   1.263 @@ -892,9 +892,9 @@
   1.264  (******************************************************************)
   1.265  
   1.266  
   1.267 -"=====new ptree 4 ratequation ====================================";
   1.268 -"=====new ptree 4 ratequation ====================================";
   1.269 -"=====new ptree 4 ratequation ====================================";
   1.270 +"=====new ctree 4 ratequation ====================================";
   1.271 +"=====new ctree 4 ratequation ====================================";
   1.272 +"=====new ctree 4 ratequation ====================================";
   1.273  reset_states ();
   1.274  CalcTree
   1.275  [(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
   1.276 @@ -907,12 +907,12 @@
   1.277  val (Form f, tac, asms) = pt_extract (pt, p);
   1.278  (*============ inhibit exn WN120316 ==============================================
   1.279  if term2str f = "[x = 6 / 5]" andalso p = ([], Res) then ()
   1.280 -  else error "after ===new ptree 4 ratequation ===";
   1.281 +  else error "after ===new ctree 4 ratequation ===";
   1.282  (*WN120317.TODO dropped rateq*)
   1.283  ============ inhibit exn WN120316 ==============================================*)
   1.284  if p = ([], Res) andalso term2str f = "[]" (*see WN120317.TODO dropped rateq*)
   1.285  andalso asms = [] (*STRANGE!, compare test --- x / (x ^ 2 - 6 * x + 9) - 1 / (x ^ 2 ...*)
   1.286 -then () else error "after ===new ptree 4 ratequation ===";
   1.287 +then () else error "after ===new ctree 4 ratequation ===";
   1.288  
   1.289  
   1.290  "-------------- pt_extract form, tac, asm<>[] --------------------";
   1.291 @@ -941,9 +941,9 @@
   1.292  
   1.293  
   1.294  
   1.295 -"=====new ptree 5 minisubpbl =====================================";
   1.296 -"=====new ptree 5 minisubpbl =====================================";
   1.297 -"=====new ptree 5 minisubpbl =====================================";
   1.298 +"=====new ctree 5 minisubpbl =====================================";
   1.299 +"=====new ctree 5 minisubpbl =====================================";
   1.300 +"=====new ctree 5 minisubpbl =====================================";
   1.301  reset_states ();
   1.302  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   1.303     ("Test", ["sqroot-test","univariate","equation","test"],
   1.304 @@ -1020,9 +1020,9 @@
   1.305    | _ => error "diff.behav.in ctree.sml: pt_extract ([], Res)";
   1.306  ========== inhibit exn AK110719 ==============================================*)
   1.307  
   1.308 -"=====new ptree 6 minisubpbl intersteps ==========================";
   1.309 -"=====new ptree 6 minisubpbl intersteps ==========================";
   1.310 -"=====new ptree 6 minisubpbl intersteps ==========================";
   1.311 +"=====new ctree 6 minisubpbl intersteps ==========================";
   1.312 +"=====new ctree 6 minisubpbl intersteps ==========================";
   1.313 +"=====new ctree 6 minisubpbl intersteps ==========================";
   1.314  reset_states ();
   1.315  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
   1.316     ("Test", ["sqroot-test","univariate","equation","test"],
   1.317 @@ -1117,9 +1117,9 @@
   1.318  
   1.319  
   1.320  (**#################################################################**)
   1.321 -"-------------- cut_tree new (from ptree above)-------------------";
   1.322 -"-------------- cut_tree new (from ptree above)-------------------";
   1.323 -"-------------- cut_tree new (from ptree above)-------------------";
   1.324 +"-------------- cut_tree new (from ctree above)-------------------";
   1.325 +"-------------- cut_tree new (from ctree above)-------------------";
   1.326 +"-------------- cut_tree new (from ctree above)-------------------";
   1.327  show_pt pt;
   1.328  val b = get_obj g_branch pt [];
   1.329  if b = TransitiveB then () else