test/Tools/isac/Interpret/inform.sml
changeset 59279 255c853ea2f0
parent 59269 1da53d1540fe
child 59348 ddfabb53082c
equal deleted inserted replaced
59278:a474900d5bd2 59279:255c853ea2f0
    61  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 = 2*)
    62  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
    62  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
    63 
    63 
    64  appendFormula 1 "-2 * 1 + (1 + x) = 0" (*|> Future.join*); refFormula 1 (get_pos 1 1);
    64  appendFormula 1 "-2 * 1 + (1 + x) = 0" (*|> Future.join*); refFormula 1 (get_pos 1 1);
    65  val ((pt,_),_) = get_calc 1;
    65  val ((pt,_),_) = get_calc 1;
    66  val str = pr_ptree pr_short pt;
    66  val str = pr_ctree pr_short pt;
    67 if str =
    67 if str =
    68 (".    ----- pblobj -----\n" ^
    68 (".    ----- pblobj -----\n" ^
    69 "1.   x + 1 = 2\n" ^
    69 "1.   x + 1 = 2\n" ^
    70 "2.   x + 1 + -1 * 2 = 0\n" ^
    70 "2.   x + 1 + -1 * 2 = 0\n" ^
    71 "2.1.   x + 1 + -1 * 2 = 0\n" ^
    71 "2.1.   x + 1 + -1 * 2 = 0\n" ^
   181  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 = 2*)
   182  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   182  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   183 
   183 
   184  appendFormula 1 "x = 2" (*|> Future.join*);
   184  appendFormula 1 "x = 2" (*|> Future.join*);
   185  val ((pt,p),_) = get_calc 1;
   185  val ((pt,p),_) = get_calc 1;
   186  val str = pr_ptree pr_short pt;
   186  val str = pr_ctree pr_short pt;
   187  writeln str;
   187  writeln str;
   188  if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n" andalso p = ([1], Res)
   188  if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n" andalso p = ([1], Res)
   189  then ()
   189  then ()
   190  else error "inform.sml: diff.behav.appendFormula: Res + NOder 1";
   190  else error "inform.sml: diff.behav.appendFormula: Res + NOder 1";
   191 
   191 
   211  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 = 2*)
   212  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   212  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   213 
   213 
   214  appendFormula 1 "x = 1" (*|> Future.join*);
   214  appendFormula 1 "x = 1" (*|> Future.join*);
   215  val ((pt,p),_) = get_calc 1;
   215  val ((pt,p),_) = get_calc 1;
   216  val str = pr_ptree pr_short pt;
   216  val str = pr_ctree pr_short pt;
   217  writeln str;
   217  writeln str;
   218  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)
   218  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)
   219  then () (*finds 1 step too early: ([3,2], Res) "x = 1" also by script !!!*)
   219  then () (*finds 1 step too early: ([3,2], Res) "x = 1" also by script !!!*)
   220  else error "inform.sml: diff.behav.appendFormula: Res + late d 1";
   220  else error "inform.sml: diff.behav.appendFormula: Res + late d 1";
   221 
   221 
   240  autoCalculate 1 CompleteCalcHead;
   240  autoCalculate 1 CompleteCalcHead;
   241  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 = 2*)
   242  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   242  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   243  appendFormula 1 "[x = 3 + -2*1]" (*|> Future.join*);
   243  appendFormula 1 "[x = 3 + -2*1]" (*|> Future.join*);
   244  val ((pt,p),_) = get_calc 1;
   244  val ((pt,p),_) = get_calc 1;
   245  val str = pr_ptree pr_short pt;
   245  val str = pr_ctree pr_short pt;
   246  writeln str;
   246  writeln str;
   247  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  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 ()
   248  else error "inform.sml: diff.behav.appendFormula: Res + latEE 1";
   248  else error "inform.sml: diff.behav.appendFormula: Res + latEE 1";
   249  autoCalculate 1 CompleteCalc;
   249  autoCalculate 1 CompleteCalc;
   250  val ((pt,p),_) = get_calc 1;
   250  val ((pt,p),_) = get_calc 1;
   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_ctree pr_short pt;
   272 
   272 
   273 (* before AK110725 this was
   273 (* before AK110725 this was
   274 ".    ----- pblobj -----\n
   274 ".    ----- pblobj -----\n
   275 1.   x + 1 = 2\n
   275 1.   x + 1 = 2\n
   276 2.   x + 1 + -1 * 2 = 0\n
   276 2.   x + 1 + -1 * 2 = 0\n
   311  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 = 2*)
   312  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   312  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   313 
   313 
   314  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   314  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   315  val ((pt,_),_) = get_calc 1;
   315  val ((pt,_),_) = get_calc 1;
   316  val str = pr_ptree pr_short pt;
   316  val str = pr_ctree pr_short pt;
   317  writeln str;
   317  writeln str;
   318  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  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 ()
   319  else error "inform.sml: diff.behav.replaceFormula: on Res 1 + = 1";
   319  else error "inform.sml: diff.behav.replaceFormula: on Res 1 + = 1";
   320  autoCalculate 1 CompleteCalc;
   320  autoCalculate 1 CompleteCalc;
   321  val ((pt,pos as (p,_)),_) = get_calc 1;
   321  val ((pt,pos as (p,_)),_) = get_calc 1;
   334  autoCalculate 1 CompleteCalcHead;
   334  autoCalculate 1 CompleteCalcHead;
   335  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   335  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   336 
   336 
   337  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   337  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   338  val ((pt,_),_) = get_calc 1;
   338  val ((pt,_),_) = get_calc 1;
   339  val str = pr_ptree pr_short pt;
   339  val str = pr_ctree pr_short pt;
   340  writeln str;
   340  writeln str;
   341  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  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 ()
   342  else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 1";
   342  else error "inform.sml: diff.behav.replaceFormula: on Frm 1 + = 1";
   343  autoCalculate 1 CompleteCalc;
   343  autoCalculate 1 CompleteCalc;
   344  val ((pt,pos as (p,_)),_) = get_calc 1;
   344  val ((pt,pos as (p,_)),_) = get_calc 1;
   359  if get_pos 1 1 = ([1], Frm) then ()
   359  if get_pos 1 1 = ([1], Frm) then ()
   360  else error "inform.sml: diff.behav. cut calculation 1";
   360  else error "inform.sml: diff.behav. cut calculation 1";
   361 
   361 
   362  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   362  replaceFormula 1 "x + 1 = 4 + -2"; refFormula 1 (get_pos 1 1);
   363  val ((pt,p),_) = get_calc 1;
   363  val ((pt,p),_) = get_calc 1;
   364  val str = pr_ptree pr_short pt;
   364  val str = pr_ctree pr_short pt;
   365  writeln str;
   365  writeln str;
   366  if p = ([1], Res) then ()
   366  if p = ([1], Res) then ()
   367  else error "inform.sml: diff.behav. cut calculation 2";
   367  else error "inform.sml: diff.behav. cut calculation 2";
   368 
   368 
   369 
   369 
   455  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   455  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 = 2*)
   456  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   456  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*x + 1 + -1 * 2 = 0*);
   457 
   457 
   458  appendFormula 1 " x - "; (*<ERROR> syntax error in ' x - ' </ERROR>*)
   458  appendFormula 1 " x - "; (*<ERROR> syntax error in ' x - ' </ERROR>*)
   459  val ((pt,_),_) = get_calc 1;
   459  val ((pt,_),_) = get_calc 1;
   460  val str = pr_ptree pr_short pt;
   460  val str = pr_ctree pr_short pt;
   461  writeln str;
   461  writeln str;
   462  if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n" then ()
   462  if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n" then ()
   463  else error "inform.sml: diff.behav.appendFormula: syntax error";
   463  else error "inform.sml: diff.behav.appendFormula: syntax error";
   464 DEconstrCalcTree 1;
   464 DEconstrCalcTree 1;
   465 
   465