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