test/Tools/isac/OLDTESTS/tacis.sml
author Walther Neuper <neuper@ist.tugraz.at>
Tue, 28 Sep 2010 09:06:56 +0200
branchisac-update-Isa09-2
changeset 38031 460c24a6a6ba
parent 37926 e6fc98fbcb85
child 38058 ad0485155c0e
permissions -rw-r--r--
tuned error and writeln

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