test/Tools/isac/OLDTESTS/tacis.sml
author Mathias Lehnfeld <s1210629013@students.fh-hagenberg.at>
Fri, 13 Jun 2014 12:06:38 +0200
changeset 55445 33b0f6db720c
parent 55279 130688f277ba
child 55446 42c45d1241d7
permissions -rw-r--r--
moved from "Unsynchronized.ref states" to "Synchronized.var states"
neuper@37906
     1
(* 
neuper@37906
     2
 use"systest/tacis.sml";
neuper@37906
     3
 use"tacis.sml";
neuper@37906
     4
   *)
neuper@37906
     5
"=================================================================";
neuper@37906
     6
"------ fetchProposedTactic -> autoCalculate (Step1 ) ------------";
neuper@37906
     7
"------ setNextTactic -> autoCalculate (Step1 ) ------------------";
neuper@37906
     8
"=================================================================";
neuper@37906
     9
neuper@37906
    10
neuper@37906
    11
neuper@37906
    12
"------ fetchProposedTactic -> autoCalculate (Step1 ) ------------";
neuper@37906
    13
"------ fetchProposedTactic -> autoCalculate (Step1 ) ------------";
neuper@37906
    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;
neuper@37906
    20
 autoCalculate 1 CompleteCalcHead;
neuper@37906
    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*);
neuper@37906
    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*);
neuper@37906
    27
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*-1 + x = 0*);
neuper@37906
    28
 val ((pt,_),_) = get_calc 1;
neuper@37906
    29
 val str = pr_ptree pr_short pt;
neuper@37906
    30
 writeln str;
neuper@37906
    31
neuper@37906
    32
 fetchProposedTactic 1 (*'Subproblem ...' in tacis*);
neuper@37906
    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*);
neuper@37906
    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*);
neuper@37906
    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
---------------------------------------------------------------------*)
neuper@37906
    46
 autoCalculate 1 CompleteCalcHead; refFormula 1 (get_pos 1 1) (*OK*);
neuper@37906
    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
 ######################################################################*)
neuper@37906
    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*);
neuper@37906
    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*);
neuper@37906
    59
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*x = 1*);
neuper@37906
    60
 val ((pt,_),_) = get_calc 1;
neuper@37906
    61
 val str = pr_ptree pr_short pt;
neuper@37906
    62
 writeln str;
neuper@37906
    63
neuper@37906
    64
 fetchProposedTactic 1 (*'Check_Postcond linear...' in tacis*);
neuper@37906
    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*);
neuper@37906
    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*);
neuper@37906
    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
neuper@37906
    82
"------ setNextTactic -> autoCalculate (Step1 ) ------------------";
neuper@37906
    83
"------ setNextTactic -> autoCalculate (Step1 ) ------------------";
neuper@37906
    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;
neuper@37906
    90
 autoCalculate 1 CompleteCalcHead;
neuper@37906
    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), _))] => () | _ =>
neuper@38031
    96
 error "tacis.sml: diff.behav. in setNextTactic -> autoCalculate (1)"; 
neuper@37906
    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");
neuper@37906
   100
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*-1 + x = 0*);
neuper@37906
   101
 val ((pt,_),_) = get_calc 1;
neuper@37906
   102
 val str = pr_ptree 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"]));
neuper@37906
   107
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*solve (-1 + x = 0, x)*);
neuper@37906
   108
 val ((pt,_),_) = get_calc 1;
neuper@37906
   109
 val str = pr_ptree pr_short pt;
neuper@37906
   110
 writeln str;
neuper@37906
   111
neuper@55279
   112
 setNextTactic 1 (Model_Problem (*["LINEAR","univariate","equation","test"]*));
neuper@37906
   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)");
neuper@37906
   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");
neuper@37906
   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), _)))] =>() | _ =>
neuper@38031
   125
 error "tacis.sml: diff.behav. in setNextTactic -> autoCalculate (2)"; 
neuper@37906
   126
 (*#######################################################################*)
neuper@37906
   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"));
neuper@37906
   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");
neuper@37906
   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"]);
neuper@37906
   136
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*[x = 1]*);
neuper@37906
   137
neuper@37906
   138
 setNextTactic 1 (Check_elementwise "Assumptions");
neuper@37906
   139
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1) (*[x = 1]*);
neuper@37906
   140
 val ((pt,_),_) = get_calc 1;
neuper@37906
   141
 val str = pr_ptree 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), _)))] =>() | _ =>
neuper@38031
   150
 error "tacis.sml: diff.behav. in setNextTactic -> autoCalculate (3)"; 
neuper@37906
   151
 #######################################################################*)
neuper@37906
   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 
neuper@38031
   158
 error "tacis.sml: diff.behav. in setNextTactic -> autoCalculate (4)"; 
neuper@37906
   159
neuper@37906
   160
neuper@37906
   161