test/Tools/isac/OLDTESTS/tacis.sml
author Walther Neuper <wneuper@ist.tugraz.at>
Thu, 22 Dec 2016 11:36:20 +0100
changeset 59279 255c853ea2f0
parent 59248 5eba5e6d5266
child 59497 8952c43fdce3
permissions -rw-r--r--
renamed Ctree.ptree --> Ctree.ctree
     1 (* 
     2  use"systest/tacis.sml";
     3  use"tacis.sml";
     4    *)
     5 "=================================================================";
     6 "------ fetchProposedTactic -> autoCalculate (Step1 ) ------------";
     7 "------ setNextTactic -> autoCalculate (Step1 ) ------------------";
     8 "=================================================================";
     9 
    10 
    11 
    12 "------ fetchProposedTactic -> autoCalculate (Step1 ) ------------";
    13 "------ fetchProposedTactic -> autoCalculate (Step1 ) ------------";
    14 "------ fetchProposedTactic -> autoCalculate (Step1 ) ------------";
    15  reset_states ();
    16  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    17 	    ("Test", ["sqroot-test","univariate","equation","test"],
    18 	     ["Test","squ-equ-test-subpbl1"]))];
    19  Iterator 1; moveActiveRoot 1;
    20  autoCalculate 1 CompleteCalcHead;
    21  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x + 1 = 2*);
    22 
    23  fetchProposedTactic 1 (*'Rewrite_Set norm_equation' in tacis*);
    24  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x + 1 + -1 * 2 = 0*);
    25 
    26  fetchProposedTactic 1 (*'Rewrite_Set Test_simplify' in tacis*);
    27  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*-1 + x = 0*);
    28  val ((pt,_),_) = get_calc 1;
    29  val str = pr_ctree pr_short pt;
    30  writeln str;
    31 
    32  fetchProposedTactic 1 (*'Subproblem ...' in tacis*);
    33  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*solve (-1 + x = 0,x)*);
    34 
    35  fetchProposedTactic 1 (*'Model_Problem' in tacis*);
    36  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*equality ///*);
    37 (*----- WN060222 since complete_mod_ case cas of SOME headline -----
    38  fetchProposedTactic 1 (*'Add_Given equality (-1 + x = 0)' in tacis*);
    39  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*equality (-1 + x =0)*);
    40 ---------------------------------------------------------------------*)
    41 
    42  fetchProposedTactic 1 (*'Add_Given solveFor x' in tacis*);
    43 (*----- WN060222 since complete_mod_ case cas of SOME headline:
    44                        (*Specify_Theory Test.thy*)
    45 ---------------------------------------------------------------------*)
    46  autoCalculate 1 CompleteCalcHead; refFormula 1 (get_pos 1 1) (*OK*);
    47  (*###########################################autoCalculate 1 (Step 1);*)
    48  fetchProposedTactic 1 (*'Apply_Method Test solve_linear' in tacis*);
    49  (* there was the only error ^^^^^^^^^ in step/nxt_solv ..Apply_Method..
    50  val (str', (tacis', (pt',p'))) = step ip (ptp, tacis);
    51  writeln (tacis2str tacis');
    52  ######################################################################*)
    53  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*-1 + x = 0*);
    54 
    55  fetchProposedTactic 1 (*'Rewrite_Set_Inst isolate_bdv' in tacis*);
    56  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x = 0 + -1 * -1*);
    57 
    58  fetchProposedTactic 1 (*'Rewrite_Set Test_simplify' in tacis*);
    59  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x = 1*);
    60  val ((pt,_),_) = get_calc 1;
    61  val str = pr_ctree pr_short pt;
    62  writeln str;
    63 
    64  fetchProposedTactic 1 (*'Check_Postcond linear...' in tacis*);
    65  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*[x = 1]*);
    66 
    67  fetchProposedTactic 1 (*'Check_elementwise Assumptions' in tacis*);
    68  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*[x = 1]*);
    69 
    70  fetchProposedTactic 1 (*'Check_Postcond sqroot-test...' in tacis*);
    71  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*[x = 1]*);
    72 
    73  fetchProposedTactic 1 (*'' in tacis*);
    74  val ((pt,p),tacis) = get_calc 1;
    75  val ip = get_pos 1 1;
    76  val (Form f, tac, asms) = pt_extract (pt, p);
    77  if term2str f = "[x = 1]"andalso p = ([],Res) andalso ip = ([],Res)then()else 
    78  error "tacis.sml: diff.behav. in fetchProposedTactic autoCalculate";
    79 
    80 
    81 
    82 "------ setNextTactic -> autoCalculate (Step1 ) ------------------";
    83 "------ setNextTactic -> autoCalculate (Step1 ) ------------------";
    84 "------ setNextTactic -> autoCalculate (Step1 ) ------------------";
    85  reset_states ();
    86  CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
    87 	    ("Test", ["sqroot-test","univariate","equation","test"],
    88 	     ["Test","squ-equ-test-subpbl1"]))];
    89  Iterator 1; moveActiveRoot 1;
    90  autoCalculate 1 CompleteCalcHead;
    91  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x + 1 = 2*);
    92 
    93  setNextTactic 1 (Rewrite_Set "norm_equation");
    94  val (_, tacis) = get_calc 1;
    95  case tacis of [(Rewrite_Set "norm_equation",_,(([1], Res), _))] => () | _ =>
    96  error "tacis.sml: diff.behav. in setNextTactic -> autoCalculate (1)"; 
    97  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x + 1 + -1 * 2 = 0*);
    98 
    99  setNextTactic 1 (Rewrite_Set "Test_simplify");
   100  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*-1 + x = 0*);
   101  val ((pt,_),_) = get_calc 1;
   102  val str = pr_ctree pr_short pt;
   103  writeln str;
   104 
   105  setNextTactic 1 (Subproblem ("Test",["LINEAR","univariate",
   106 					  "equation","test"]));
   107  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*solve (-1 + x = 0, x)*);
   108  val ((pt,_),_) = get_calc 1;
   109  val str = pr_ctree pr_short pt;
   110  writeln str;
   111 
   112  setNextTactic 1 (Model_Problem (*["LINEAR","univariate","equation","test"]*));
   113  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*equality ///*);
   114 
   115  setNextTactic 1 (Add_Given "equality (-1 + x = 0)");
   116  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*equality (-1 + x = 0)*);
   117 
   118  setNextTactic 1 (Add_Given "solveFor x");
   119  autoCalculate 1 CompleteCalcHead; refFormula 1 (get_pos 1 1) (*OK*);
   120 
   121  setNextTactic 1 (Apply_Method ["Test", "solve_linear"]);
   122  val (_, tacis) = get_calc 1;
   123  case tacis of 
   124      [((Apply_Method ["Test","solve_linear"],_,(([3,1], Frm), _)))] =>() | _ =>
   125  error "tacis.sml: diff.behav. in setNextTactic -> autoCalculate (2)"; 
   126  (*#######################################################################*)
   127  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*-1 + x = 0*);
   128 
   129  setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "isolate_bdv"));
   130  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x = 0 + -1 * -1*);
   131 
   132  setNextTactic 1 (Rewrite_Set "Test_simplify");
   133  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x = 1*);
   134 
   135  setNextTactic 1 (Check_Postcond ["LINEAR","univariate","equation","test"]);
   136  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*[x = 1]*);
   137 
   138  setNextTactic 1 (Check_elementwise "Assumptions");
   139  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*[x = 1]*);
   140  val ((pt,_),_) = get_calc 1;
   141  val str = pr_ctree pr_short pt;
   142  writeln str;
   143 
   144  setNextTactic 1 (Check_Postcond 
   145 		      ["sqroot-test","univariate","equation","test"]);
   146  val (_, tacis) = get_calc 1;
   147  
   148  (*case tacis of      040609 suddenly ???!
   149      [((Check_Postcond _, _,(([], Res), _)))] =>() | _ =>
   150  error "tacis.sml: diff.behav. in setNextTactic -> autoCalculate (3)"; 
   151  #######################################################################*)
   152  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*[x = 1]*);
   153 
   154  val ((pt,p),tacis) = get_calc 1;
   155  val ip = get_pos 1 1;
   156  val (Form f, tac, asms) = pt_extract (pt, p);
   157  if term2str f = "[x = 1]"andalso p = ([],Res) andalso ip = ([],Res)then()else 
   158  error "tacis.sml: diff.behav. in setNextTactic -> autoCalculate (4)"; 
   159 
   160 
   161