test/Tools/isac/Frontend/interface.sml
author Walther Neuper <neuper@ist.tugraz.at>
Tue, 28 Sep 2010 09:06:56 +0200
branchisac-update-Isa09-2
changeset 38031 460c24a6a6ba
parent 37960 ec20007095f2
child 38050 4c52ad406c20
permissions -rw-r--r--
tuned error and writeln

# raise error --> error
# writeln in atomtyp, atomty, atomt and xmlsrc
neuper@37906
     1
(* tests the interface of isac's SML-kernel in accordance to 
neuper@37906
     2
   java-tests/isac.bridge.
neuper@37906
     3
neuper@37906
     4
WN050707 ... if true, the test ist marked with a \label referring
neuper@37906
     5
to the same UC in isac-docu.tex as the JUnit testcase.
neuper@37906
     6
use"../smltest/FE-interface/interface.sml";
neuper@37906
     7
use"interface.sml";
neuper@37906
     8
 *)
neuper@37906
     9
neuper@37906
    10
 print_depth 3;
neuper@37906
    11
neuper@37906
    12
"-----------------------------------------------------------------";
neuper@37906
    13
"table of contents -----------------------------------------------";
neuper@37906
    14
"-----------------------------------------------------------------";
neuper@37906
    15
"within struct ---------------------------------------------------";
neuper@37906
    16
"-----------------------------------------------------------------";
neuper@37906
    17
"--------- encode ^ -> ^^^ ---------------------------------------";
neuper@37906
    18
"-----------------------------------------------------------------";
neuper@37906
    19
"exported from struct --------------------------------------------";
neuper@37906
    20
"-----------------------------------------------------------------";
neuper@37906
    21
"---------------- empty rootpbl ----------------------------------";
neuper@37906
    22
"---------------- solve_linear as rootpbl FE ---------------------";
neuper@37906
    23
"--------- inspect the CalcTree No.1 with Iterator No.2 ----------";
neuper@37906
    24
"---------------- miniscript with mini-subpbl --------------------";
neuper@37906
    25
"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
neuper@37906
    26
"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
neuper@37906
    27
"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
neuper@37906
    28
"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
neuper@37906
    29
"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
neuper@37906
    30
"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
neuper@37906
    31
"--------- setContext..Thy ---------------------------------------";
neuper@37906
    32
"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
neuper@37906
    33
"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
neuper@37906
    34
"--------- tryMatchProblem, tryRefineProblem -------------------UC";
neuper@37906
    35
"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
neuper@37906
    36
"--------- maximum-example, UC: Modeling an example --------------";
neuper@37906
    37
"--------- solve_linear from pbl-hierarchy -----------------------";
neuper@37906
    38
"--------- solve_linear as in an algebra system (CAS)-------------";
neuper@37906
    39
"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
neuper@37906
    40
"--------- getTactic, fetchApplicableTactics ---------------------";
neuper@37906
    41
"--------- getAssumptions, getAccumulatedAsms --------------------";
neuper@37906
    42
"--------- arbitrary combinations of steps -----------------------";
neuper@37906
    43
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
neuper@37906
    44
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
neuper@37906
    45
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
neuper@37906
    46
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
neuper@37906
    47
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
neuper@37906
    48
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
neuper@37906
    49
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
neuper@37906
    50
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
neuper@37906
    51
"-----------------------------------------------------------------";
neuper@37906
    52
neuper@37906
    53
"within struct ---------------------------------------------------";
neuper@37906
    54
"within struct ---------------------------------------------------";
neuper@37906
    55
"within struct ---------------------------------------------------";
neuper@37906
    56
(*==================================================================
neuper@37906
    57
neuper@37906
    58
neuper@37906
    59
"--------- encode ^ -> ^^^ ---------------------------------------";
neuper@37906
    60
"--------- encode ^ -> ^^^ ---------------------------------------";
neuper@37906
    61
"--------- encode ^ -> ^^^ ---------------------------------------";
neuper@37906
    62
if encode "a^2+b^2=c^2" = "a^^^2+b^^^2=c^^^2" then ()
neuper@38031
    63
else error "interface.sml: diff.behav. in encode ^ -> ^^^ ";
neuper@37906
    64
neuper@37906
    65
if (decode o encode) "a^2+b^2=c^2" = "a^2+b^2=c^2" then ()
neuper@38031
    66
else error "interface.sml: diff.behav. in de/encode ^ <-> ^^^ ";
neuper@37906
    67
neuper@37906
    68
==================================================================*)
neuper@37906
    69
"exported from struct --------------------------------------------";
neuper@37906
    70
"exported from struct --------------------------------------------";
neuper@37906
    71
"exported from struct --------------------------------------------";
neuper@37906
    72
neuper@37906
    73
neuper@37906
    74
(*------------ set at startup of the Kernel --------------------------*)
neuper@37906
    75
 states:= [];  (*resets all state information in Kernel               *)
neuper@37906
    76
(*----------------------------------------------------------------*)
neuper@37906
    77
neuper@37906
    78
"---------------- empty rootpbl ----------------------------------";
neuper@37906
    79
"---------------- empty rootpbl ----------------------------------";
neuper@37906
    80
"---------------- empty rootpbl ----------------------------------";
neuper@37906
    81
 CalcTree [([], ("", [], []))];
neuper@37906
    82
 Iterator 1;
neuper@37906
    83
 moveActiveRoot 1;
neuper@37906
    84
 refFormula 1 (get_pos 1 1);
neuper@37906
    85
(*WN.040222: stoert das sehr, dass e_domID etc. statt leer kommt ???*)
neuper@37906
    86
neuper@37906
    87
neuper@37906
    88
"---------------- solve_linear as rootpbl FE ---------------------";
neuper@37906
    89
"---------------- solve_linear as rootpbl FE ---------------------";
neuper@37906
    90
"---------------- solve_linear as rootpbl FE ---------------------";
neuper@37906
    91
 states := [];
neuper@37906
    92
 CalcTree      (*start of calculation, return No.1*)
neuper@37906
    93
     [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
neuper@37906
    94
       ("Test.thy", 
neuper@37906
    95
	["linear","univariate","equation","test"],
neuper@37906
    96
	["Test","solve_linear"]))];
neuper@37906
    97
 Iterator 1;     (*create an active Iterator on CalcTree No.1*)
neuper@37906
    98
 
neuper@37906
    99
 moveActiveRoot 1;(*sets the CalcIterator No.1 at the root of CalcTree No.1*);
neuper@37906
   100
 refFormula 1 (get_pos 1 1)  (*gets CalcHead; model is still empty*);
neuper@37906
   101
 
neuper@37906
   102
 fetchProposedTactic 1 (*by using Iterator No.1*);
neuper@37906
   103
 setNextTactic 1 (Model_Problem (*["linear","univariate","equation","test"]*));
neuper@37906
   104
                        (*by using Iterator No.1*)
neuper@37906
   105
 autoCalculate 1 (Step 1);
neuper@37906
   106
 refFormula 1 (get_pos 1 1)  (*model contains descriptions for all items*);
neuper@37906
   107
 autoCalculate 1 (Step 1);
neuper@37926
   108
(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
neuper@37906
   109
 fetchProposedTactic 1;
neuper@37906
   110
 setNextTactic 1 (Add_Given "equality (1 + -1 * 2 + x = 0)");
neuper@37906
   111
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1); (*equality added*);
neuper@37906
   112
neuper@37906
   113
 fetchProposedTactic 1;
neuper@37906
   114
 setNextTactic 1 (Add_Given "solveFor x");
neuper@37906
   115
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   116
neuper@37906
   117
 fetchProposedTactic 1;
neuper@37906
   118
 setNextTactic 1 (Add_Find "solutions L");
neuper@37906
   119
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   120
neuper@37906
   121
 fetchProposedTactic 1;
neuper@37906
   122
 setNextTactic 1 (Specify_Theory "Test.thy");
neuper@37906
   123
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37926
   124
*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
neuper@37906
   125
neuper@37906
   126
 fetchProposedTactic 1;
neuper@37906
   127
 setNextTactic 1 (Specify_Problem ["linear","univariate","equation","test"]);
neuper@37906
   128
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   129
(*-------------------------------------------------------------------------*)
neuper@37906
   130
 fetchProposedTactic 1;
neuper@37906
   131
 val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
neuper@37906
   132
neuper@37906
   133
 setNextTactic 1 (Specify_Method ["Test","solve_linear"]);
neuper@37906
   134
 val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
neuper@37906
   135
neuper@37906
   136
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   137
 val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
neuper@37906
   138
neuper@37906
   139
(*-------------------------------------------------------------------------*)
neuper@37906
   140
 fetchProposedTactic 1;
neuper@37906
   141
 val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
neuper@37906
   142
neuper@37906
   143
 setNextTactic 1 (Apply_Method ["Test","solve_linear"]);
neuper@37906
   144
 val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
neuper@37906
   145
 is_complete_mod ptp;
neuper@37906
   146
 is_complete_spec ptp;
neuper@37906
   147
neuper@37906
   148
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   149
 val (ptp as (pt,p), tacis) = get_calc 1; get_pos 1 1;
neuper@37906
   150
 (*term2str (get_obj g_form pt [1]);*)
neuper@37906
   151
(*-------------------------------------------------------------------------*)
neuper@37906
   152
neuper@37906
   153
 fetchProposedTactic 1;
neuper@37906
   154
 setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "isolate_bdv"));
neuper@37906
   155
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   156
neuper@37906
   157
 fetchProposedTactic 1;
neuper@37906
   158
 setNextTactic 1 (Rewrite_Set "Test_simplify");
neuper@37906
   159
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   160
neuper@37906
   161
 fetchProposedTactic 1;
neuper@37906
   162
 setNextTactic 1 (Check_Postcond ["linear","univariate","equation","test"]);
neuper@37906
   163
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   164
neuper@37906
   165
 val ((pt,_),_) = get_calc 1;
neuper@37906
   166
 val ip = get_pos 1 1;
neuper@37906
   167
 val (Form f, tac, asms) = pt_extract (pt, ip);
neuper@37906
   168
     (*exception just above means: 'ModSpec' has been returned: error anyway*)
neuper@37906
   169
 if term2str f = "[x = 1]" then () else 
neuper@38031
   170
 error "FE-Kernel-interface.sml: diff.behav. in solve_linear as rootpbl";
neuper@37906
   171
neuper@37906
   172
neuper@37906
   173
neuper@37906
   174
"--------- inspect the CalcTree No.1 with Iterator No.2 ---------";
neuper@37906
   175
"--------- inspect the CalcTree No.1 with Iterator No.2 ---------";
neuper@37906
   176
"--------- inspect the CalcTree No.1 with Iterator No.2 ---------";
neuper@37906
   177
(*WN041118: inspection shifted to Iterator No.1, because others need pos'*)
neuper@37906
   178
 moveActiveRoot 1; 
neuper@37906
   179
 refFormula 1 ([],Pbl); getTactic 1 ([],Pbl);(*Error*)
neuper@37906
   180
 moveActiveDown 1; 
neuper@37906
   181
 refFormula 1 ([1],Frm); getTactic 1 ([1],Frm);(*Error*)
neuper@37906
   182
 moveActiveDown 1 ; 
neuper@37906
   183
 refFormula 1 ([1],Res); getTactic 1 ([1],Res);(*OK*) 
neuper@37906
   184
 (*getAssumption 1 ([1],Res); TODO.WN041217*)
neuper@37906
   185
 moveActiveDown 1 ; refFormula 1 ([2],Res);
neuper@37906
   186
 moveActiveCalcHead 1; refFormula 1 ([],Pbl);
neuper@37906
   187
 moveActiveDown 1;
neuper@37906
   188
 moveActiveDown 1;
neuper@37906
   189
 moveActiveDown 1;
neuper@37906
   190
 if get_pos 1 1 = ([2], Res) then () else 
neuper@38031
   191
 error "FE-interface.sml: diff.behav. in a inspect 1 with Iterator 2";
neuper@37906
   192
 moveActiveDown 1; refFormula 1 ([], Res);
neuper@37906
   193
 if get_pos 1 1 = ([], Res) then () else 
neuper@38031
   194
 error "FE-interface.sml: diff.behav. in b inspect 1 with Iterator 2";
neuper@37906
   195
 moveActiveCalcHead 1; refFormula 1 ([],Pbl);
neuper@37906
   196
neuper@37906
   197
neuper@37906
   198
neuper@37906
   199
"---------------- miniscript with mini-subpbl --------------------";
neuper@37906
   200
"---------------- miniscript with mini-subpbl --------------------";
neuper@37906
   201
"---------------- miniscript with mini-subpbl --------------------";
neuper@37906
   202
 states:=[];
neuper@37906
   203
 CalcTree      (*start of calculation, return No.1*)
neuper@37906
   204
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
   205
   ("Test.thy", 
neuper@37906
   206
    ["sqroot-test","univariate","equation","test"],
neuper@37906
   207
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
   208
 Iterator 1;
neuper@37906
   209
neuper@37906
   210
 moveActiveRoot 1; 
neuper@37906
   211
 refFormula 1 (get_pos 1 1);
neuper@37906
   212
 fetchProposedTactic 1;
neuper@37906
   213
 setNextTactic 1 (Model_Problem);
neuper@37906
   214
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);(*gets ModSpec;model is still empty*)
neuper@37906
   215
neuper@37906
   216
 fetchProposedTactic 1;
neuper@37906
   217
 setNextTactic 1 (Add_Given "equality (x + 1 = 2)");
neuper@37906
   218
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   219
neuper@37906
   220
 fetchProposedTactic 1;
neuper@37906
   221
 setNextTactic 1 (Add_Given "solveFor x");
neuper@37906
   222
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   223
neuper@37906
   224
 fetchProposedTactic 1;
neuper@37906
   225
 setNextTactic 1 (Add_Find "solutions L");
neuper@37906
   226
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   227
neuper@37906
   228
 fetchProposedTactic 1;
neuper@37906
   229
 setNextTactic 1 (Specify_Theory "Test.thy");
neuper@37906
   230
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   231
neuper@37906
   232
 fetchProposedTactic 1;
neuper@37906
   233
 setNextTactic 1 (Specify_Problem 
neuper@37906
   234
		      ["sqroot-test","univariate","equation","test"]);
neuper@37906
   235
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   236
"1-----------------------------------------------------------------";
neuper@37906
   237
neuper@37906
   238
 fetchProposedTactic 1;
neuper@37906
   239
 setNextTactic 1 (Specify_Method ["Test","squ-equ-test-subpbl1"]);
neuper@37906
   240
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   241
neuper@37906
   242
 fetchProposedTactic 1;
neuper@37906
   243
 setNextTactic 1 (Apply_Method ["Test","squ-equ-test-subpbl1"]);
neuper@37906
   244
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   245
neuper@37906
   246
 fetchProposedTactic 1;
neuper@37906
   247
 setNextTactic 1 (Rewrite_Set "norm_equation");
neuper@37906
   248
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   249
neuper@37906
   250
 fetchProposedTactic 1;
neuper@37906
   251
 setNextTactic 1 (Rewrite_Set "Test_simplify");
neuper@37906
   252
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   253
neuper@37906
   254
 fetchProposedTactic 1;(*----------------Subproblem--------------------*);
neuper@37906
   255
 setNextTactic 1 (Subproblem ("Test.thy",
neuper@37906
   256
			      ["linear","univariate","equation","test"]));
neuper@37906
   257
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   258
neuper@37906
   259
 fetchProposedTactic 1;
neuper@37906
   260
 setNextTactic 1 (Model_Problem );
neuper@37906
   261
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   262
neuper@37906
   263
 fetchProposedTactic 1;
neuper@37906
   264
 setNextTactic 1 (Add_Given "equality (-1 + x = 0)");
neuper@37906
   265
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   266
neuper@37906
   267
 fetchProposedTactic 1;
neuper@37906
   268
 setNextTactic 1 (Add_Given "solveFor x");
neuper@37906
   269
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   270
neuper@37906
   271
 fetchProposedTactic 1;
neuper@37906
   272
 setNextTactic 1 (Add_Find "solutions x_i");
neuper@37906
   273
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   274
neuper@37906
   275
 fetchProposedTactic 1;
neuper@37906
   276
 setNextTactic 1 (Specify_Theory "Test.thy");
neuper@37906
   277
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   278
neuper@37906
   279
 fetchProposedTactic 1;
neuper@37906
   280
 setNextTactic 1 (Specify_Problem ["linear","univariate","equation","test"]);
neuper@37906
   281
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   282
"2-----------------------------------------------------------------";
neuper@37906
   283
neuper@37906
   284
 fetchProposedTactic 1;
neuper@37906
   285
 setNextTactic 1 (Specify_Method ["Test","solve_linear"]);
neuper@37906
   286
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   287
neuper@37906
   288
 fetchProposedTactic 1;
neuper@37906
   289
 setNextTactic 1 (Apply_Method ["Test","solve_linear"]);
neuper@37906
   290
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   291
neuper@37906
   292
 fetchProposedTactic 1;
neuper@37906
   293
 setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "isolate_bdv"));
neuper@37906
   294
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   295
neuper@37906
   296
 fetchProposedTactic 1;
neuper@37906
   297
 setNextTactic 1 (Rewrite_Set "Test_simplify");
neuper@37906
   298
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   299
neuper@37906
   300
 fetchProposedTactic 1;
neuper@37906
   301
 setNextTactic 1 (Check_Postcond ["linear","univariate","equation","test"]);
neuper@37906
   302
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   303
neuper@37906
   304
 fetchProposedTactic 1;
neuper@37906
   305
 setNextTactic 1 (Check_elementwise "Assumptions");
neuper@37906
   306
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   307
neuper@37906
   308
 val xml = fetchProposedTactic 1;
neuper@37906
   309
 setNextTactic 1 (Check_Postcond 
neuper@37906
   310
		      ["sqroot-test","univariate","equation","test"]);
neuper@37906
   311
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   312
neuper@37906
   313
 val ((pt,_),_) = get_calc 1;
neuper@37906
   314
 val str = pr_ptree pr_short pt;
neuper@37906
   315
 writeln str;
neuper@37906
   316
 val ip = get_pos 1 1;
neuper@37906
   317
 val (Form f, tac, asms) = pt_extract (pt, ip);
neuper@37906
   318
     (*exception just above means: 'ModSpec' has been returned: error anyway*)
neuper@37906
   319
 if term2str f = "[x = 1]" then () else 
neuper@38031
   320
 error "FE-interface.sml: diff.behav. in miniscript with mini-subpb";
neuper@37906
   321
neuper@37906
   322
 DEconstrCalcTree 1;
neuper@37906
   323
neuper@37906
   324
neuper@37906
   325
"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
neuper@37906
   326
"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
neuper@37906
   327
"--------- miniscript with mini-subpbl AUTOCALCULATE Step 1-------";
neuper@37906
   328
 states:=[];
neuper@37906
   329
 CalcTree
neuper@37906
   330
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
   331
   ("Test.thy", 
neuper@37906
   332
    ["sqroot-test","univariate","equation","test"],
neuper@37906
   333
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
   334
 Iterator 1;
neuper@37906
   335
 moveActiveRoot 1;
neuper@37906
   336
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   337
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   338
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   339
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   340
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   341
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   342
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   343
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   344
 (*here the solve-phase starts*)
neuper@37906
   345
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   346
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   347
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   348
 (*------------------------------------*)
neuper@37906
   349
(* print_depth 13; get_calc 1;
neuper@37906
   350
   *)
neuper@37906
   351
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   352
 (*calc-head of subproblem*)
neuper@37906
   353
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   354
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   355
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   356
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   357
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   358
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   359
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   360
 (*solve-phase of the subproblem*)
neuper@37906
   361
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   362
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   363
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   364
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   365
 (*finish subproblem*)
neuper@37906
   366
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   367
 (*finish problem*)
neuper@37906
   368
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1); 
neuper@37906
   369
neuper@37906
   370
 (*this checks the test for correctness..*)
neuper@37906
   371
 val ((pt,_),_) = get_calc 1;
neuper@37906
   372
 val p = get_pos 1 1;
neuper@37906
   373
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
   374
 if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
neuper@38031
   375
 error "FE-interface.sml: diff.behav. in miniscript with mini-subpb";
neuper@37906
   376
neuper@37906
   377
 DEconstrCalcTree 1;
neuper@37906
   378
neuper@37906
   379
"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
neuper@37906
   380
"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
neuper@37906
   381
"--------- solve_linear as rootpbl AUTOCALCULATE CompleteCalc ----";
neuper@37906
   382
 states:=[];
neuper@37906
   383
 CalcTree
neuper@37906
   384
     [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
neuper@37906
   385
       ("Test.thy", 
neuper@37906
   386
	["linear","univariate","equation","test"],
neuper@37906
   387
	["Test","solve_linear"]))];
neuper@37906
   388
 Iterator 1;
neuper@37906
   389
 moveActiveRoot 1;
neuper@37906
   390
getFormulaeFromTo 1 ([],Pbl) ([],Pbl) 999 false;
neuper@37906
   391
neuper@37906
   392
 autoCalculate 1 CompleteCalc; 
neuper@37906
   393
 val (unc, del, gen) = (([],Pbl), ([],Pbl), ([],Res));
neuper@37906
   394
 getFormulaeFromTo 1 unc gen 1 (*only level 1*) false;
neuper@37906
   395
neuper@37906
   396
 val ((pt,_),_) = get_calc 1;
neuper@37906
   397
 val p = get_pos 1 1;
neuper@37906
   398
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
   399
 if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
neuper@38031
   400
 error "FE-interface.sml: diff.behav. in solve_linear/rt AUTOCALCULATE ";
neuper@37906
   401
neuper@37906
   402
neuper@37906
   403
"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
neuper@37906
   404
"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
neuper@37906
   405
"--------- solve_linear as rootpbl AUTOCALC CompleteHead/Calc ----";
neuper@37906
   406
 states:=[];
neuper@37906
   407
 CalcTree
neuper@37906
   408
     [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
neuper@37906
   409
       ("Test.thy", 
neuper@37906
   410
	["linear","univariate","equation","test"],
neuper@37906
   411
	["Test","solve_linear"]))];
neuper@37906
   412
 Iterator 1;
neuper@37906
   413
 moveActiveRoot 1;
neuper@37906
   414
 autoCalculate 1 CompleteCalcHead;
neuper@37906
   415
 refFormula 1 (get_pos 1 1);
neuper@37906
   416
 val ((pt,p),_) = get_calc 1;
neuper@37906
   417
neuper@37906
   418
neuper@37906
   419
neuper@37906
   420
 autoCalculate 1 CompleteCalc; 
neuper@37906
   421
 val ((pt,p),_) = get_calc 1;
neuper@37906
   422
 if p=([], Res) then () else 
neuper@38031
   423
 error "FE-interface.sml: diff.behav. in solve_linear AUTOC Head/Calc ";
neuper@37906
   424
neuper@37906
   425
neuper@37906
   426
"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
neuper@37906
   427
"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
neuper@37906
   428
"--------- miniscript with mini-subpbl AUTOCALCULATE CompleteCalc-";
neuper@37906
   429
 states:=[];
neuper@37906
   430
 CalcTree
neuper@37906
   431
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
   432
   ("Test.thy", 
neuper@37906
   433
    ["sqroot-test","univariate","equation","test"],
neuper@37906
   434
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
   435
 Iterator 1;
neuper@37906
   436
 moveActiveRoot 1;
neuper@37906
   437
 autoCalculate 1 CompleteCalc;
neuper@37906
   438
neuper@37906
   439
(*
neuper@37906
   440
getTactic 1 ([1],Frm);
neuper@37906
   441
getTactic 1 ([1],Res);
neuper@37906
   442
initContext 1 Thy_ ([1],Res);
neuper@37906
   443
*)
neuper@37906
   444
neuper@37906
   445
 (*... returns calcChangedEvent with*)
neuper@37906
   446
 val (unc, del, gen) = (([],Pbl), ([],Pbl), ([],Res));
neuper@37906
   447
 getFormulaeFromTo 1 unc gen 0 (*only result*) false;
neuper@37906
   448
 getFormulaeFromTo 1 unc gen 1 (*only level 1*) false;
neuper@37906
   449
 getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
neuper@37906
   450
neuper@37906
   451
 val ((pt,_),_) = get_calc 1;
neuper@37906
   452
 val p = get_pos 1 1;
neuper@37906
   453
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
   454
 if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
neuper@38031
   455
 error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
neuper@37906
   456
neuper@37906
   457
neuper@37906
   458
"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
neuper@37906
   459
"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
neuper@37906
   460
"--------- miniscript with mini-subpbl AUTO CompleteCalcHead------";
neuper@37906
   461
 states:=[];
neuper@37906
   462
 CalcTree
neuper@37906
   463
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
   464
   ("Test.thy", 
neuper@37906
   465
    ["sqroot-test","univariate","equation","test"],
neuper@37906
   466
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
   467
 Iterator 1;
neuper@37906
   468
(* doesn't terminate !!!
neuper@37906
   469
 autoCalculate 1 CompleteCalcHead; 
neuper@37906
   470
*)
neuper@37906
   471
neuper@37906
   472
"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
neuper@37906
   473
"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
neuper@37906
   474
"--------- solve_linear as rootpbl AUTOCALCULATE CompleteModel ---";
neuper@37906
   475
 states:=[];
neuper@37906
   476
 CalcTree
neuper@37906
   477
     [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
neuper@37906
   478
       ("Test.thy", 
neuper@37906
   479
	["linear","univariate","equation","test"],
neuper@37906
   480
	["Test","solve_linear"]))];
neuper@37906
   481
 Iterator 1;
neuper@37906
   482
 moveActiveRoot 1;
neuper@37906
   483
 autoCalculate 1 CompleteModel; 
neuper@37906
   484
 refFormula 1 (get_pos 1 1);
neuper@37906
   485
neuper@37906
   486
setProblem 1 ["linear","univariate","equation","test"];
neuper@37906
   487
val pos = get_pos 1 1;
neuper@37906
   488
setContext 1 pos (kestoreID2guh Pbl_["linear","univariate","equation","test"]);
neuper@37906
   489
 refFormula 1 (get_pos 1 1);
neuper@37906
   490
neuper@37906
   491
setMethod 1 ["Test","solve_linear"];
neuper@37906
   492
setContext 1 pos (kestoreID2guh Met_ ["Test","solve_linear"]);
neuper@37906
   493
 refFormula 1 (get_pos 1 1);
neuper@37906
   494
 val ((pt,_),_) = get_calc 1;
neuper@37906
   495
 if get_obj g_spec pt [] = ("e_domID", 
neuper@37906
   496
			    ["linear", "univariate","equation","test"],
neuper@37906
   497
			    ["Test","solve_linear"]) then ()
neuper@38031
   498
 else error "FE-interface.sml: diff.behav. in setProblem, setMethod";
neuper@37906
   499
neuper@37906
   500
 autoCalculate 1 CompleteCalcHead;
neuper@37906
   501
 refFormula 1 (get_pos 1 1); 
neuper@37906
   502
 autoCalculate 1 CompleteCalc; 
neuper@37906
   503
 moveActiveDown 1;
neuper@37906
   504
 moveActiveDown 1;
neuper@37906
   505
 moveActiveDown 1;
neuper@37906
   506
 refFormula 1 (get_pos 1 1); 
neuper@37906
   507
 val ((pt,_),_) = get_calc 1;
neuper@37906
   508
 val p = get_pos 1 1;
neuper@37906
   509
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
   510
 if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
neuper@38031
   511
 error "FE-interface.sml: diff.behav. in mini-subpbl AUTOCALCULATE 6";
neuper@37906
   512
neuper@37906
   513
neuper@37906
   514
"--------- setContext..Thy ---------------------------------------";
neuper@37906
   515
"--------- setContext..Thy ---------------------------------------";
neuper@37906
   516
"--------- setContext..Thy ---------------------------------------";
neuper@37906
   517
states:=[];
neuper@37906
   518
CalcTree
neuper@37906
   519
[(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
   520
  ("Test.thy", 
neuper@37906
   521
   ["sqroot-test","univariate","equation","test"],
neuper@37906
   522
   ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
   523
Iterator 1; moveActiveRoot 1;
neuper@37906
   524
autoCalculate 1 CompleteCalcHead;
neuper@37906
   525
autoCalculate 1 (Step 1);
neuper@37906
   526
val ((pt,p),_) = get_calc 1;  show_pt pt;
neuper@37906
   527
(*
neuper@37906
   528
setNextTactic 1 (Rewrite_Set "Test_simplify");
neuper@37906
   529
autoCalculate 1 (Step 1);
neuper@37906
   530
val ((pt,p),_) = get_calc 1;  show_pt pt;
neuper@37906
   531
*)
neuper@37906
   532
"-----^^^^^ and vvvvv do the same -----";
neuper@37906
   533
setContext 1 p "thy_isac_Test-rls-Test_simplify";
neuper@37906
   534
val ((pt,p),_) = get_calc 1;  show_pt pt;
neuper@37906
   535
neuper@37906
   536
autoCalculate 1 (Step 1);
neuper@37906
   537
setContext 1 p "thy_isac_Test-rls-Test_simplify";
neuper@37906
   538
val ((pt,p),_) = get_calc 1;  show_pt pt;
neuper@37906
   539
neuper@37906
   540
autoCalculate 1 CompleteCalc;
neuper@37906
   541
neuper@37906
   542
neuper@37906
   543
neuper@37906
   544
"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
neuper@37906
   545
"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
neuper@37906
   546
"--------- miniscript with mini-subpbl AUTOCALC CompleteToSubpbl -";
neuper@37906
   547
 states:=[];
neuper@37906
   548
 CalcTree
neuper@37906
   549
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
   550
   ("Test.thy", 
neuper@37906
   551
    ["sqroot-test","univariate","equation","test"],
neuper@37906
   552
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
   553
 Iterator 1; moveActiveRoot 1;
neuper@37906
   554
 autoCalculate 1 CompleteToSubpbl;
neuper@37906
   555
 refFormula 1 (get_pos 1 1); (*<ISA> -1 + x = 0 </ISA>*);
neuper@37906
   556
 val ((pt,_),_) = get_calc 1;
neuper@37906
   557
 val str = pr_ptree pr_short pt;
neuper@37906
   558
 writeln str;
neuper@37906
   559
 if str = ".    ----- pblobj -----\n1.   x + 1 = 2\n2.   x + 1 + -1 * 2 = 0\n"
neuper@37906
   560
 then () else 
neuper@38031
   561
 error "FE-interface.sml: diff.behav. in mini-subpbl CompleteToSubpbl-1";
neuper@37906
   562
neuper@37906
   563
 autoCalculate 1 (Step 1); (*proceeds only, of NOT 1 step before subplb*)
neuper@37906
   564
 autoCalculate 1 CompleteToSubpbl;
neuper@37906
   565
 val ((pt,_),_) = get_calc 1;
neuper@37906
   566
 val str = pr_ptree pr_short pt;
neuper@37906
   567
 writeln str;
neuper@37906
   568
 autoCalculate 1 CompleteCalc; (*das geht ohnehin !*);
neuper@37906
   569
 val ((pt,_),_) = get_calc 1;
neuper@37906
   570
 val p = get_pos 1 1;
neuper@37906
   571
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
   572
 if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
neuper@38031
   573
 error "FE-interface.sml: diff.behav. in mini-subpbl CompleteToSubpbl 1";
neuper@37906
   574
neuper@37906
   575
neuper@37906
   576
neuper@37906
   577
"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
neuper@37906
   578
"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
neuper@37906
   579
"---------------- rat-eq + subpbl: no_met, NO solution dropped ---";
neuper@37906
   580
 states:=[];
neuper@37906
   581
 CalcTree
neuper@37906
   582
 [(["equality ((5*x)/(x - 2) - x/(x+2)=4)", "solveFor x","solutions L"],
neuper@37906
   583
   ("RatEq.thy", ["univariate","equation"], ["no_met"]))];
neuper@37906
   584
 Iterator 1;
neuper@37906
   585
 moveActiveRoot 1; 
neuper@37906
   586
 fetchProposedTactic 1;
neuper@37906
   587
 setNextTactic 1 (Model_Problem );
neuper@37906
   588
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37926
   589
(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
neuper@37906
   590
 setNextTactic 1 (Add_Given "equality (5 * x / (x - 2) - x / (x + 2) = 4)");
neuper@37906
   591
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   592
 setNextTactic 1 (Add_Given "solveFor x");
neuper@37906
   593
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   594
 setNextTactic 1 (Add_Find "solutions L");
neuper@37906
   595
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37926
   596
*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
neuper@37906
   597
 setNextTactic 1 (Specify_Theory "RatEq.thy");
neuper@37906
   598
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   599
 setNextTactic 1 (Specify_Problem ["rational","univariate","equation"]);
neuper@37906
   600
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   601
 setNextTactic 1 (Specify_Method ["RatEq","solve_rat_equation"]);
neuper@37906
   602
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   603
 setNextTactic 1 (Apply_Method ["RatEq","solve_rat_equation"]);
neuper@37906
   604
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   605
 setNextTactic 1 (Rewrite_Set "RatEq_simplify");
neuper@37906
   606
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   607
 setNextTactic 1 (Rewrite_Set "norm_Rational");
neuper@37906
   608
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   609
 setNextTactic 1 (Rewrite_Set "RatEq_eliminate");
neuper@37906
   610
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   611
 (*               __________ for "12 * x + 4 * x ^^^ 2 = 4 * (-4 + x ^^^ 2)"*)
neuper@37906
   612
 setNextTactic 1 (Subproblem ("PolyEq.thy", ["normalize","polynomial",
neuper@37906
   613
					    "univariate","equation"]));
neuper@37906
   614
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   615
 setNextTactic 1 (Model_Problem );
neuper@37906
   616
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37926
   617
(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
neuper@37906
   618
 setNextTactic 1 (Add_Given 
neuper@37906
   619
		      "equality (12 * x + 4 * x ^^^ 2 = 4 * (-4 + x ^^^ 2))");
neuper@37906
   620
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   621
 setNextTactic 1 (Add_Given "solveFor x");
neuper@37906
   622
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   623
 setNextTactic 1 (Add_Find "solutions x_i");
neuper@37906
   624
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37926
   625
*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
neuper@37906
   626
 setNextTactic 1 (Specify_Theory "PolyEq.thy");
neuper@37906
   627
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   628
 setNextTactic 1 (Specify_Problem ["normalize","polynomial",
neuper@37906
   629
				   "univariate","equation"]);
neuper@37906
   630
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   631
 setNextTactic 1 (Specify_Method ["PolyEq","normalize_poly"]);
neuper@37906
   632
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   633
 setNextTactic 1 (Apply_Method ["PolyEq","normalize_poly"]);
neuper@37906
   634
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   635
 setNextTactic 1 (Rewrite ("all_left",""));
neuper@37906
   636
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   637
 setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "make_ratpoly_in"));
neuper@37906
   638
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   639
 (*               __________ for "16 + 12 * x = 0"*)
neuper@37906
   640
 setNextTactic 1 (Subproblem ("PolyEq.thy",
neuper@37906
   641
			 ["degree_1","polynomial","univariate","equation"]));
neuper@37906
   642
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   643
 setNextTactic 1 (Model_Problem );
neuper@37906
   644
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37926
   645
(*-----since Model_Problem + complete_mod_ in case cas of SOME-----*
neuper@37906
   646
 setNextTactic 1 (Add_Given 
neuper@37906
   647
		      "equality (16 + 12 * x = 0)");
neuper@37906
   648
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   649
 setNextTactic 1 (Add_Given "solveFor x");
neuper@37906
   650
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   651
 setNextTactic 1 (Add_Find "solutions x_i");
neuper@37906
   652
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37926
   653
*-----since Model_Problem + complete_mod_ in case cas of SOME-----*)
neuper@37906
   654
 setNextTactic 1 (Specify_Theory "PolyEq.thy");
neuper@37906
   655
 (*------------- some trials in the problem-hierarchy ---------------*)
neuper@37906
   656
 setNextTactic 1 (Specify_Problem ["linear","univariate","equation"]);
neuper@37906
   657
 autoCalculate 1 (Step 1); fetchProposedTactic 1; (*<ERROR> helpless </ERROR> !!!*)
neuper@37906
   658
 setNextTactic 1 (Refine_Problem ["univariate","equation"]);
neuper@37906
   659
neuper@37906
   660
neuper@37906
   661
neuper@37906
   662
neuper@37906
   663
neuper@37906
   664
 (*------------------------------------------------------------------*)
neuper@37906
   665
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   666
 setNextTactic 1 (Specify_Method ["PolyEq","solve_d1_polyeq_equation"]);
neuper@37906
   667
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   668
 setNextTactic 1 (Apply_Method ["PolyEq","solve_d1_polyeq_equation"]);
neuper@37906
   669
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   670
 setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "d1_polyeq_simplify"));
neuper@37906
   671
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   672
 setNextTactic 1 (Rewrite_Set "polyeq_simplify");
neuper@37906
   673
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   674
 (*==================================================================*)
neuper@37906
   675
 setNextTactic 1 Or_to_List;
neuper@37906
   676
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   677
 setNextTactic 1 (Check_elementwise "Assumptions");
neuper@37906
   678
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   679
 setNextTactic 1 (Check_Postcond ["degree_1","polynomial",
neuper@37906
   680
				 "univariate","equation"]);
neuper@37906
   681
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   682
 setNextTactic 1 (Check_Postcond ["normalize","polynomial",
neuper@37906
   683
				   "univariate","equation"]);
neuper@37906
   684
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   685
 setNextTactic 1 (Check_elementwise "Assumptions");
neuper@37906
   686
 autoCalculate 1 (Step 1); fetchProposedTactic 1;
neuper@37906
   687
 setNextTactic 1 (Check_Postcond ["rational","univariate","equation"]);
neuper@37906
   688
 val (ptp,_) = get_calc 1;
neuper@37906
   689
 val (Form t,_,_) = pt_extract ptp;
neuper@37906
   690
 if get_pos 1 1 = ([], Res) andalso term2str t = "[x = -4 / 3]" then ()
neuper@37906
   691
 else writeln "FE-inteface.sml: diff.behav. in rat-eq + subpbl: no_met, NO ..";
neuper@37906
   692
neuper@37906
   693
neuper@37906
   694
"---------------- tryMatchProblem, tryRefineProblem --------------";
neuper@37906
   695
"---------------- tryMatchProblem, tryRefineProblem --------------";
neuper@37906
   696
"---------------- tryMatchProblem, tryRefineProblem --------------";
neuper@37906
   697
(*{\bf\UC{Having \isac{} Refine the Problem
neuper@37906
   698
 * Automatically}\label{SPECIFY:refine-auto}\\} test match and refine with
neuper@37906
   699
 * x^^^2 + 4*x + 5 = 2
neuper@37906
   700
see isac.bridge.TestSpecify#testMatchRefine*)
neuper@37906
   701
 DEconstrCalcTree 1;
neuper@37906
   702
 CalcTree
neuper@37906
   703
 [(["equality (x^2 + 4*x + 5 = 2)", "solveFor x","solutions L"],
neuper@37906
   704
   ("Isac.thy", 
neuper@37906
   705
    ["univariate","equation"],
neuper@37906
   706
    ["no_met"]))];
neuper@37906
   707
 Iterator 1;
neuper@37906
   708
 moveActiveRoot 1; 
neuper@37906
   709
neuper@37906
   710
 fetchProposedTactic 1;
neuper@37906
   711
 setNextTactic 1 (Model_Problem );
neuper@37906
   712
 (*..this tactic should be done 'tacitly', too !*)
neuper@37906
   713
neuper@37906
   714
(*
neuper@37906
   715
autoCalculate 1 CompleteCalcHead; 
neuper@37906
   716
checkContext 1 ([],Pbl) "pbl_equ_univ";
neuper@37906
   717
checkContext 1 ([],Pbl) (kestoreID2guh Pbl_ ["univariate","equation"]);
neuper@37906
   718
*)
neuper@37906
   719
neuper@37906
   720
 autoCalculate 1 (Step 1); 
neuper@37906
   721
neuper@37906
   722
 fetchProposedTactic 1;
neuper@37906
   723
 setNextTactic 1 (Add_Given "equality (x ^^^ 2 + 4 * x + 5 = 2)");
neuper@37906
   724
 autoCalculate 1 (Step 1); 
neuper@37906
   725
neuper@37906
   726
 "--------- we go into the ProblemBrowser (_NO_ pblID selected) -";
neuper@37906
   727
initContext 1 Pbl_ ([],Pbl);
neuper@37906
   728
initContext 1 Met_ ([],Pbl);
neuper@37906
   729
neuper@37906
   730
 "--------- this match will show some incomplete items: ---------";
neuper@37906
   731
checkContext 1 ([],Pbl) (kestoreID2guh Pbl_ ["univariate","equation"]);
neuper@37906
   732
checkContext 1 ([],Pbl) (kestoreID2guh Met_ ["LinEq", "solve_lineq_equation"]);
neuper@37906
   733
neuper@37906
   734
neuper@37906
   735
 fetchProposedTactic 1;
neuper@37906
   736
 setNextTactic 1 (Add_Given "solveFor x"); autoCalculate 1 (Step 1);
neuper@37906
   737
neuper@37906
   738
 fetchProposedTactic 1;
neuper@37906
   739
 setNextTactic 1 (Add_Find "solutions L"); autoCalculate 1 (Step 1);
neuper@37906
   740
neuper@37906
   741
 "--------- this is a matching model (all items correct): -------";
neuper@37906
   742
checkContext 1  ([],Pbl) (kestoreID2guh Pbl_ ["univariate","equation"]);
neuper@37906
   743
 "--------- this is a NOT matching model (some 'false': ---------";
neuper@37906
   744
checkContext 1  ([],Pbl)(kestoreID2guh Pbl_["linear","univariate","equation"]);
neuper@37906
   745
neuper@37906
   746
 "--------- find out a matching problem: ------------------------";
neuper@37906
   747
 "--------- find out a matching problem (FAILING: no new pbl) ---";
neuper@37906
   748
 refineProblem 1([],Pbl)(pblID2guh ["linear","univariate","equation"]);
neuper@37906
   749
neuper@37906
   750
 "--------- find out a matching problem (SUCCESSFUL) ------------";
neuper@37906
   751
 refineProblem 1 ([],Pbl) (pblID2guh ["univariate","equation"]);
neuper@37906
   752
neuper@37906
   753
 "--------- tryMatch, tryRefine did not change the calculation -";
neuper@37906
   754
 "--------- this is done by <TRANSFER> on the pbl-browser: ------";
neuper@37906
   755
 setNextTactic 1 (Specify_Problem ["normalize","polynomial",
neuper@37906
   756
				 "univariate","equation"]);
neuper@37906
   757
 autoCalculate 1 (Step 1);
neuper@37906
   758
(*WN050904 fetchProposedTactic again --> Specify_Problem ["normalize",...
neuper@37906
   759
  and Specify_Theory skipped in comparison to below ---^^^-inserted      *)
neuper@37906
   760
(*------------vvv-inserted-----------------------------------------------*)
neuper@37906
   761
 fetchProposedTactic 1;
neuper@37906
   762
 setNextTactic 1 (Specify_Problem ["normalize","polynomial",
neuper@37906
   763
				 "univariate","equation"]);
neuper@37906
   764
 autoCalculate 1 (Step 1);
neuper@37906
   765
neuper@37906
   766
(*and Specify_Theory skipped by fetchProposedTactic ?!?*)
neuper@37906
   767
neuper@37906
   768
 fetchProposedTactic 1;
neuper@37906
   769
 setNextTactic 1 (Specify_Method ["PolyEq","normalize_poly"]);
neuper@37906
   770
 autoCalculate 1 (Step 1);
neuper@37906
   771
neuper@37906
   772
 fetchProposedTactic 1;
neuper@37906
   773
 setNextTactic 1 (Apply_Method ["PolyEq","normalize_poly"]);
neuper@37906
   774
 autoCalculate 1 CompleteCalc;
neuper@37906
   775
 val ((pt,_),_) = get_calc 1;
neuper@37906
   776
 show_pt pt;
neuper@37906
   777
 val p = get_pos 1 1;
neuper@37906
   778
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
   779
 if term2str f = "[x = -1, x = -3]" andalso p = ([], Res) then () else 
neuper@38031
   780
 error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
neuper@37906
   781
neuper@37906
   782
(*------------^^^-inserted-----------------------------------------------*)
neuper@37906
   783
(*WN050904 the fetchProposedTactic's below may not have worked like that
neuper@37906
   784
  before, too, because there was no check*)
neuper@37906
   785
 fetchProposedTactic 1;
neuper@37906
   786
 setNextTactic 1 (Specify_Theory "PolyEq.thy");
neuper@37906
   787
 autoCalculate 1 (Step 1);
neuper@37906
   788
neuper@37906
   789
 fetchProposedTactic 1;
neuper@37906
   790
 setNextTactic 1 (Specify_Method ["PolyEq","normalize_poly"]);
neuper@37906
   791
 autoCalculate 1 (Step 1);
neuper@37906
   792
neuper@37906
   793
 fetchProposedTactic 1;
neuper@37906
   794
 "--------- now the calc-header is ready for enter 'solving' ----";
neuper@37906
   795
 autoCalculate 1 CompleteCalc;
neuper@37906
   796
neuper@37906
   797
 val ((pt,_),_) = get_calc 1;
neuper@37906
   798
rootthy pt;
neuper@37906
   799
 show_pt pt;
neuper@37906
   800
 val p = get_pos 1 1;
neuper@37906
   801
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
   802
 if term2str f = "[x = -1, x = -3]" andalso p = ([], Res) then () else 
neuper@38031
   803
 error "FE-interface.sml: diff.behav. in tryMatchProblem, tryRefine";
neuper@37906
   804
neuper@37906
   805
neuper@37906
   806
"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
neuper@37906
   807
"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
neuper@37906
   808
"--------- modifyCalcHead, resetCalcHead, modelProblem ------------";
neuper@37906
   809
neuper@37906
   810
 states:=[]; 
neuper@37906
   811
 DEconstrCalcTree 1;
neuper@37906
   812
 CalcTree
neuper@37906
   813
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
   814
   ("Test.thy", 
neuper@37906
   815
    ["sqroot-test","univariate","equation","test"],
neuper@37906
   816
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
   817
 Iterator 1;
neuper@37906
   818
 moveActiveRoot 1; 
neuper@37906
   819
neuper@37906
   820
 modifyCalcHead 1 (([],Pbl),(*the position from refFormula*)
neuper@37906
   821
		  "solve (x+1=2, x)",(*the headline*)
neuper@37906
   822
		  [Given ["equality (x+1=2)", "solveFor x"],
neuper@37906
   823
		   Find ["solutions L"](*,Relate []*)],
neuper@37906
   824
		  Pbl, 
neuper@37906
   825
		  ("Test.thy", 
neuper@37906
   826
		   ["sqroot-test","univariate","equation","test"],
neuper@37906
   827
		   ["Test","squ-equ-test-subpbl1"]));
neuper@37906
   828
resetCalcHead 1;
neuper@37906
   829
modelProblem 1;
neuper@37906
   830
neuper@37906
   831
neuper@37906
   832
"---------------- maximum-example, UC: Modeling an example -------";
neuper@37906
   833
"---------------- maximum-example, UC: Modeling an example -------";
neuper@37906
   834
"---------------- maximum-example, UC: Modeling an example -------";
neuper@37906
   835
(* {\bf\UC{Editing the Model}\label{SPECIFY:enter}\label{SPECIFY:check}\\}
neuper@37906
   836
see isac.bridge.TestModel#testEditItems
neuper@37906
   837
*)
neuper@37906
   838
 val elems = ["fixedValues [r=Arbfix]","maximum A","valuesFor [a,b]",
neuper@37906
   839
	      "relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
neuper@37906
   840
	      "relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
neuper@37906
   841
	      "relations [A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]",
neuper@37906
   842
	      (*^^^ these are the elements for the root-problem (in variants)*)
neuper@37906
   843
              (*vvv these are elements required for subproblems*)
neuper@37906
   844
	      "boundVariable a","boundVariable b","boundVariable alpha",
neuper@37906
   845
	      "interval {x::real. 0 <= x & x <= 2*r}",
neuper@37906
   846
	      "interval {x::real. 0 <= x & x <= 2*r}",
neuper@37906
   847
	      "interval {x::real. 0 <= x & x <= pi}",
neuper@37906
   848
	      "errorBound (eps=(0::real))"]
neuper@37906
   849
 (*specifying is not interesting for this example*)
neuper@37906
   850
 val spec = ("DiffApp.thy", ["maximum_of","function"], 
neuper@37906
   851
	     ["DiffApp","max_by_calculus"]);
neuper@37906
   852
 (*the empty model with descriptions for user-guidance by Model_Problem*)
neuper@37906
   853
 val empty_model = [Given ["fixedValues []"],
neuper@37906
   854
		    Find ["maximum", "valuesFor"],
neuper@37906
   855
		    Relate ["relations []"]];
neuper@37906
   856
 states:=[];
neuper@37906
   857
 DEconstrCalcTree 1;
neuper@37906
   858
 CalcTree [(elems, spec)];
neuper@37906
   859
 Iterator 1;
neuper@37906
   860
 moveActiveRoot 1; 
neuper@37906
   861
 refFormula 1 (get_pos 1 1);
neuper@37906
   862
 (*this gives a completely empty model*) 
neuper@37906
   863
neuper@37906
   864
 fetchProposedTactic 1;
neuper@37906
   865
(*fill the CalcHead with Descriptions...*)
neuper@37906
   866
 setNextTactic 1 (Model_Problem );
neuper@37906
   867
 autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   868
neuper@37906
   869
 (*user input is !!!!!EITHER!!!!! _some_ (at least one) items of the model 
neuper@37906
   870
 !!!!!OR!!!!! _one_ part of the specification !!!!!!!!!!!!!*)
neuper@37906
   871
 (*input of two items, 'fixedValues [r=Arbfix]' and 'maximum b'...*)
neuper@37906
   872
 modifyCalcHead 1 (([],Pbl) (*position, from previous refFormula*),
neuper@37906
   873
		  "Problem (DiffApp.thy, [maximum_of, function])",
neuper@37906
   874
		  (*the head-form ^^^ is not used for input here*)
neuper@37906
   875
		  [Given ["fixedValues [r=Arbfix]"(*new input*)],
neuper@37906
   876
		   Find ["maximum b"(*new input*), "valuesFor"], 
neuper@37906
   877
		   Relate ["relations"]],
neuper@37906
   878
		  (*input (Arbfix will dissappear soon)*)
neuper@37906
   879
		  Pbl (*belongsto*),
neuper@37906
   880
		  e_spec (*no input to the specification*));
neuper@37906
   881
neuper@37906
   882
 (*the user does not know, what 'superfluous' for 'maximum b' may mean
neuper@37906
   883
  and asks what to do next*)
neuper@37906
   884
 fetchProposedTactic 1;
neuper@37906
   885
 (*the student follows the advice*)
neuper@37906
   886
 setNextTactic 1 (Add_Find "maximum A"); (*FIXME.17.11.03: does not yet work*)
neuper@37906
   887
  autoCalculate 1 (Step 1); refFormula 1 (get_pos 1 1);
neuper@37906
   888
 
neuper@37906
   889
 (*this input completes the model*)
neuper@37906
   890
 modifyCalcHead 1 (([],Pbl), "not used here",
neuper@37906
   891
		  [Given ["fixedValues [r=Arbfix]"],
neuper@37906
   892
		   Find ["maximum A", "valuesFor [a,b]"(*new input*)], 
neuper@37906
   893
		   Relate ["relations [A=a*b, \
neuper@37906
   894
			   \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl, e_spec);
neuper@37906
   895
neuper@37906
   896
 (*specification is not interesting an should be skipped by the dialogguide;
neuper@37906
   897
   !!!!!!!!!!!!!!!!!!!! input of ONE part at a time !!!!!!!!!!!!!!!!!!!!!!*)
neuper@37906
   898
 modifyCalcHead 1 (([],Pbl), "not used here",
neuper@37906
   899
		  [Given ["fixedValues [r=Arbfix]"],
neuper@37906
   900
		   Find ["maximum A", "valuesFor [a,b]"(*new input*)], 
neuper@37906
   901
		   Relate ["relations [A=a*b, \
neuper@37906
   902
			   \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl, 
neuper@37906
   903
		  ("DiffApp.thy", ["e_pblID"], ["e_metID"]));
neuper@37906
   904
 modifyCalcHead 1 (([],Pbl), "not used here",
neuper@37906
   905
		  [Given ["fixedValues [r=Arbfix]"],
neuper@37906
   906
		   Find ["maximum A", "valuesFor [a,b]"(*new input*)], 
neuper@37906
   907
		   Relate ["relations [A=a*b, \
neuper@37906
   908
			   \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl, 
neuper@37906
   909
		  ("DiffApp.thy", ["maximum_of","function"], 
neuper@37906
   910
		   ["e_metID"]));
neuper@37906
   911
 modifyCalcHead 1 (([],Pbl), "not used here",
neuper@37906
   912
		  [Given ["fixedValues [r=Arbfix]"],
neuper@37906
   913
		   Find ["maximum A", "valuesFor [a,b]"(*new input*)], 
neuper@37906
   914
		   Relate ["relations [A=a*b, \
neuper@37906
   915
			   \(a/2)^2 + (b/2)^2 = r^2]"]], Pbl, 
neuper@37906
   916
		  ("DiffApp.thy", ["maximum_of","function"], 
neuper@37906
   917
		   ["DiffApp","max_by_calculus"]));
neuper@37906
   918
 (*this final calcHead now has STATUS 'complete' !*)
neuper@37906
   919
 DEconstrCalcTree 1;
neuper@37906
   920
neuper@37906
   921
neuper@37906
   922
"--------- solve_linear from pbl-hierarchy -----------------------";
neuper@37906
   923
"--------- solve_linear from pbl-hierarchy -----------------------";
neuper@37906
   924
"--------- solve_linear from pbl-hierarchy -----------------------";
neuper@37906
   925
 states:=[];
neuper@37906
   926
 val (fmz, sp) = ([], ("", ["linear","univariate","equation","test"], []));
neuper@37906
   927
 CalcTree [(fmz, sp)];
neuper@37906
   928
 Iterator 1; moveActiveRoot 1;
neuper@37906
   929
 refFormula 1 (get_pos 1 1);
neuper@37906
   930
 modifyCalcHead 1 (([],Pbl),"solve (1+-1*2+x=0)",
neuper@37906
   931
		  [Given ["equality (1+-1*2+x=0)", "solveFor x"],
neuper@37906
   932
		   Find ["solutions L"]],
neuper@37906
   933
		  Pbl, 
neuper@37906
   934
		  ("Test.thy", ["linear","univariate","equation","test"],
neuper@37906
   935
		   ["Test","solve_linear"]));
neuper@37906
   936
 autoCalculate 1 CompleteCalc;
neuper@37906
   937
 refFormula 1 (get_pos 1 1);
neuper@37906
   938
 val ((pt,_),_) = get_calc 1;
neuper@37906
   939
 val p = get_pos 1 1;
neuper@37906
   940
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
   941
 if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
neuper@38031
   942
 error "FE-interface.sml: diff.behav. in from pbl-hierarchy";
neuper@37906
   943
 
neuper@37906
   944
neuper@37906
   945
neuper@37906
   946
"--------- solve_linear as in an algebra system (CAS)-------------";
neuper@37906
   947
"--------- solve_linear as in an algebra system (CAS)-------------";
neuper@37906
   948
"--------- solve_linear as in an algebra system (CAS)-------------";
neuper@37906
   949
 states:=[];
neuper@37906
   950
 val (fmz, sp) = ([], ("", [], []));
neuper@37906
   951
 CalcTree [(fmz, sp)];
neuper@37906
   952
 Iterator 1; moveActiveRoot 1;
neuper@37906
   953
 modifyCalcHead 1 (([],Pbl),"solveTest (1+-1*2+x=0,x)", [], Pbl, ("", [], []));
neuper@37906
   954
 autoCalculate 1 CompleteCalc;
neuper@37906
   955
 refFormula 1 (get_pos 1 1);
neuper@37906
   956
 val ((pt,_),_) = get_calc 1;
neuper@37906
   957
 val p = get_pos 1 1;
neuper@37906
   958
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
   959
 if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
neuper@38031
   960
 error "FE-interface.sml: diff.behav. in algebra system";
neuper@37906
   961
neuper@37906
   962
neuper@37906
   963
neuper@37906
   964
"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
neuper@37906
   965
"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
neuper@37906
   966
"--------- interSteps: on 'miniscript with mini-subpbl' ----------";
neuper@37906
   967
 states:=[];
neuper@37906
   968
 CalcTree
neuper@37906
   969
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
   970
   ("Test.thy", 
neuper@37906
   971
    ["sqroot-test","univariate","equation","test"],
neuper@37906
   972
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
   973
 Iterator 1;
neuper@37906
   974
 moveActiveRoot 1;
neuper@37906
   975
 autoCalculate 1 CompleteCalc; 
neuper@37906
   976
 val ((pt,_),_) = get_calc 1;
neuper@37906
   977
 show_pt pt;
neuper@37906
   978
neuper@37906
   979
 (*UC\label{SOLVE:INFO:intermediate-steps}*)
neuper@37906
   980
 interSteps 1 ([2],Res);
neuper@37906
   981
 val ((pt,_),_) = get_calc 1; show_pt pt (*new ([2,1],Frm)..([2,6],Res)*);
neuper@37906
   982
 val (unc, del, gen) = (([1],Res),([1],Res),([2,6],Res));
neuper@37906
   983
 getFormulaeFromTo 1 unc gen 1 false; 
neuper@37906
   984
neuper@37906
   985
 (*UC\label{SOLVE:INFO:intermediate-steps}*)
neuper@37906
   986
 interSteps 1 ([3,2],Res);
neuper@37906
   987
 val ((pt,_),_) = get_calc 1; show_pt pt (*new ([3,2,1],Frm)..([3,2,2],Res)*);
neuper@37906
   988
 val (unc, del, gen) = (([3,1],Res),([3,1],Res),([3,2,2],Res));
neuper@37906
   989
 getFormulaeFromTo 1 unc gen 1 false; 
neuper@37906
   990
neuper@37906
   991
 (*UC\label{SOLVE:INFO:intermediate-steps}*)
neuper@37906
   992
 interSteps 1 ([3],Res)  (*no new steps in subproblems*);
neuper@37906
   993
 val (unc, del, gen) = (([3],Pbl),([3],Pbl),([3,2],Res));
neuper@37906
   994
 getFormulaeFromTo 1 unc gen 1 false; 
neuper@37906
   995
neuper@37906
   996
 (*UC\label{SOLVE:INFO:intermediate-steps}*)
neuper@37906
   997
 interSteps 1 ([],Res)  (*no new steps in subproblems*);
neuper@37906
   998
 val (unc, del, gen) = (([],Pbl),([],Pbl),([4],Res));
neuper@37906
   999
 getFormulaeFromTo 1 unc gen 1 false; 
neuper@37906
  1000
neuper@37906
  1001
neuper@37906
  1002
"--------- getTactic, fetchApplicableTactics ---------------------";
neuper@37906
  1003
"--------- getTactic, fetchApplicableTactics ---------------------";
neuper@37906
  1004
"--------- getTactic, fetchApplicableTactics ---------------------";
neuper@37906
  1005
 states:=[];
neuper@37906
  1006
 CalcTree
neuper@37906
  1007
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
  1008
   ("Test.thy", 
neuper@37906
  1009
    ["sqroot-test","univariate","equation","test"],
neuper@37906
  1010
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
  1011
 Iterator 1; moveActiveRoot 1;
neuper@37906
  1012
 autoCalculate 1 CompleteCalc;
neuper@37906
  1013
 val ((pt,_),_) = get_calc 1;
neuper@37906
  1014
 show_pt pt;
neuper@37906
  1015
neuper@37906
  1016
 (*UC\label{SOLVE:HIDE:getTactic}*)
neuper@37906
  1017
 getTactic 1 ([],Pbl);
neuper@37906
  1018
 getTactic 1 ([1],Res);
neuper@37906
  1019
 getTactic 1 ([3],Pbl);
neuper@37906
  1020
 getTactic 1 ([3,1],Frm);
neuper@37906
  1021
 getTactic 1 ([3],Res);
neuper@37906
  1022
 getTactic 1 ([],Res);
neuper@37906
  1023
neuper@37906
  1024
(*UC\label{SOLVE:MANUAL:TACTIC:listall}*)
neuper@37906
  1025
 fetchApplicableTactics 1 99999 ([],Pbl);
neuper@37906
  1026
 fetchApplicableTactics 1 99999 ([1],Res);
neuper@37906
  1027
 fetchApplicableTactics 1 99999 ([3],Pbl);
neuper@37906
  1028
 fetchApplicableTactics 1 99999 ([3,1],Res);
neuper@37906
  1029
 fetchApplicableTactics 1 99999 ([3],Res);
neuper@37906
  1030
 fetchApplicableTactics 1 99999 ([],Res);
neuper@37906
  1031
neuper@37906
  1032
neuper@37906
  1033
"--------- getAssumptions, getAccumulatedAsms --------------------";
neuper@37906
  1034
"--------- getAssumptions, getAccumulatedAsms --------------------";
neuper@37906
  1035
"--------- getAssumptions, getAccumulatedAsms --------------------";
neuper@37906
  1036
states:=[];
neuper@37906
  1037
CalcTree
neuper@37906
  1038
[(["equality (x/(x^2 - 6*x+9) - 1/(x^2 - 3*x) =1/x)",
neuper@37906
  1039
	   "solveFor x","solutions L"], 
neuper@37906
  1040
  ("RatEq.thy",["univariate","equation"],["no_met"]))];
neuper@37906
  1041
Iterator 1; moveActiveRoot 1;
neuper@37906
  1042
autoCalculate 1 CompleteCalc; 
neuper@37906
  1043
val ((pt,_),_) = get_calc 1;
neuper@37906
  1044
show_pt pt;
neuper@37906
  1045
neuper@37906
  1046
(*UC\label{SOLVE:HELP:assumptions}*)
neuper@37906
  1047
getAssumptions 1 ([3], Res);
neuper@37906
  1048
getAssumptions 1 ([5], Res);
neuper@37906
  1049
(*UC\label{SOLVE:HELP:assumptions-origin} WN0502 still without positions*)
neuper@37906
  1050
getAccumulatedAsms 1 ([3], Res);
neuper@37906
  1051
getAccumulatedAsms 1 ([5], Res);
neuper@37906
  1052
neuper@37906
  1053
neuper@37906
  1054
"--------- arbitrary combinations of steps -----------------------";
neuper@37906
  1055
"--------- arbitrary combinations of steps -----------------------";
neuper@37906
  1056
"--------- arbitrary combinations of steps -----------------------";
neuper@37906
  1057
 states:=[];
neuper@37906
  1058
 CalcTree      (*start of calculation, return No.1*)
neuper@37906
  1059
     [(["equality (1+-1*2+x=0)", "solveFor x","solutions L"],
neuper@37906
  1060
       ("Test.thy", 
neuper@37906
  1061
	["linear","univariate","equation","test"],
neuper@37906
  1062
	["Test","solve_linear"]))];
neuper@37906
  1063
 Iterator 1; moveActiveRoot 1;
neuper@37906
  1064
neuper@37906
  1065
 fetchProposedTactic 1;
neuper@37906
  1066
 setNextTactic 1 (Model_Problem );
neuper@37906
  1067
 autoCalculate 1 (Step 1); 
neuper@37906
  1068
neuper@37906
  1069
 fetchProposedTactic 1;
neuper@37906
  1070
 fetchProposedTactic 1;
neuper@37906
  1071
neuper@37906
  1072
 setNextTactic 1 (Add_Find "solutions L");
neuper@37906
  1073
 setNextTactic 1 (Add_Find "solutions L");
neuper@37906
  1074
neuper@37906
  1075
 autoCalculate 1 (Step 1); 
neuper@37906
  1076
 autoCalculate 1 (Step 1); 
neuper@37906
  1077
neuper@37906
  1078
 setNextTactic 1 (Specify_Theory "Test.thy");
neuper@37906
  1079
 fetchProposedTactic 1;
neuper@37906
  1080
 autoCalculate 1 (Step 1); 
neuper@37906
  1081
neuper@37906
  1082
 autoCalculate 1 (Step 1); 
neuper@37906
  1083
 autoCalculate 1 (Step 1); 
neuper@37906
  1084
 autoCalculate 1 (Step 1); 
neuper@37906
  1085
 autoCalculate 1 (Step 1); 
neuper@37906
  1086
(*------------------------- end calc-head*)
neuper@37906
  1087
neuper@37906
  1088
 fetchProposedTactic 1;
neuper@37906
  1089
 setNextTactic 1 (Rewrite_Set_Inst (["(bdv,x)"], "isolate_bdv"));
neuper@37906
  1090
 autoCalculate 1 (Step 1); 
neuper@37906
  1091
neuper@37906
  1092
 setNextTactic 1 (Rewrite_Set "Test_simplify");
neuper@37906
  1093
 fetchProposedTactic 1;
neuper@37906
  1094
 autoCalculate 1 (Step 1); 
neuper@37906
  1095
neuper@37906
  1096
 autoCalculate 1 CompleteCalc; 
neuper@37906
  1097
 val ((pt,_),_) = get_calc 1;
neuper@37906
  1098
 val p = get_pos 1 1;
neuper@37906
  1099
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
  1100
 if term2str f = "[x = 1]" andalso p = ([], Res) then () else 
neuper@38031
  1101
 error "FE-interface.sml: diff.behav. in combinations of steps";
neuper@37906
  1102
neuper@37906
  1103
neuper@37906
  1104
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
neuper@37906
  1105
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
neuper@37906
  1106
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} right--";
neuper@37906
  1107
 states:=[];
neuper@37906
  1108
 CalcTree
neuper@37906
  1109
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
  1110
   ("Test.thy", 
neuper@37906
  1111
    ["sqroot-test","univariate","equation","test"],
neuper@37906
  1112
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
  1113
 Iterator 1;
neuper@37906
  1114
 moveActiveRoot 1;
neuper@37906
  1115
 autoCalculate 1 CompleteCalcHead;
neuper@37906
  1116
 autoCalculate 1 (Step 1);
neuper@37906
  1117
 autoCalculate 1 (Step 1);
neuper@37906
  1118
 appendFormula 1 "-1 + x = 0";  
neuper@37906
  1119
 (*... returns calcChangedEvent with*)
neuper@37906
  1120
 val (unc, del, gen) = (([1],Res), ([1],Res), ([2],Res));
neuper@37906
  1121
 getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
neuper@37906
  1122
neuper@37906
  1123
 val ((pt,_),_) = get_calc 1;
neuper@37906
  1124
 val p = get_pos 1 1;
neuper@37906
  1125
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
  1126
 if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else 
neuper@38031
  1127
 error "FE-interface.sml: diff.behav. in FORMULA:enter} right";
neuper@37906
  1128
neuper@37906
  1129
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
neuper@37906
  1130
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
neuper@37906
  1131
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} other--";
neuper@37906
  1132
 states:=[];
neuper@37906
  1133
 CalcTree
neuper@37906
  1134
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
  1135
   ("Test.thy", 
neuper@37906
  1136
    ["sqroot-test","univariate","equation","test"],
neuper@37906
  1137
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
  1138
 Iterator 1;
neuper@37906
  1139
 moveActiveRoot 1;
neuper@37906
  1140
 autoCalculate 1 CompleteCalcHead;
neuper@37906
  1141
 autoCalculate 1 (Step 1);
neuper@37906
  1142
 autoCalculate 1 (Step 1);
neuper@37906
  1143
 appendFormula 1 "x - 1 = 0"; 
neuper@37906
  1144
 val (unc, del, gen) = (([1],Res), ([1],Res), ([2],Res));
neuper@37906
  1145
 getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
neuper@37906
  1146
 (*11 elements !!!*)
neuper@37906
  1147
neuper@37906
  1148
 val ((pt,_),_) = get_calc 1;
neuper@37906
  1149
 val p = get_pos 1 1;
neuper@37906
  1150
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
  1151
 if term2str f = "x - 1 = 0" andalso p = ([2], Res) then () else 
neuper@38031
  1152
 error "FE-interface.sml: diff.behav. in FORMULA:enter} other";
neuper@37906
  1153
neuper@37906
  1154
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
neuper@37906
  1155
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
neuper@37906
  1156
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} oth 2--";
neuper@37906
  1157
 states:=[];
neuper@37906
  1158
 CalcTree
neuper@37906
  1159
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
  1160
   ("Test.thy", 
neuper@37906
  1161
    ["sqroot-test","univariate","equation","test"],
neuper@37906
  1162
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
  1163
 Iterator 1;
neuper@37906
  1164
 moveActiveRoot 1;
neuper@37906
  1165
 autoCalculate 1 CompleteCalcHead;
neuper@37906
  1166
 autoCalculate 1 (Step 1);
neuper@37906
  1167
 autoCalculate 1 (Step 1);
neuper@37906
  1168
 appendFormula 1 "x = 1"; 
neuper@37906
  1169
 (*... returns calcChangedEvent with*)
neuper@37906
  1170
 val (unc, del, gen) = (([1],Res), ([1],Res), ([3,2],Res));
neuper@37906
  1171
 getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
neuper@37906
  1172
 (*6 elements !!!*)
neuper@37906
  1173
neuper@37906
  1174
 val ((pt,_),_) = get_calc 1;
neuper@37906
  1175
 val p = get_pos 1 1;
neuper@37906
  1176
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
  1177
 if term2str f = "x = 1" andalso p = ([3,2], Res) then () else 
neuper@38031
  1178
 error "FE-interface.sml: diff.behav. in FORMULA:enter} oth 2";
neuper@37906
  1179
neuper@37906
  1180
neuper@37906
  1181
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
neuper@37906
  1182
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
neuper@37906
  1183
"--------- appendFormula label{SOLVE:MANUAL:FORMULA:enter} NOTok--";
neuper@37906
  1184
 states:=[];
neuper@37906
  1185
 CalcTree
neuper@37906
  1186
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
  1187
   ("Test.thy", 
neuper@37906
  1188
    ["sqroot-test","univariate","equation","test"],
neuper@37906
  1189
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
  1190
 Iterator 1;
neuper@37906
  1191
 moveActiveRoot 1;
neuper@37906
  1192
 autoCalculate 1 CompleteCalcHead;
neuper@37906
  1193
 autoCalculate 1 (Step 1);
neuper@37906
  1194
 autoCalculate 1 (Step 1);
neuper@37906
  1195
 appendFormula 1 "x - 4711 = 0"; 
neuper@37906
  1196
 (*... returns <ERROR> no derivation found </ERROR>*)
neuper@37906
  1197
neuper@37906
  1198
 val ((pt,_),_) = get_calc 1;
neuper@37906
  1199
 val p = get_pos 1 1;
neuper@37906
  1200
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
  1201
 if term2str f = "x + 1 + -1 * 2 = 0" andalso p = ([1], Res) then () else 
neuper@38031
  1202
 error "FE-interface.sml: diff.behav. in FORMULA:enter} NOTok";
neuper@37906
  1203
neuper@37906
  1204
neuper@37906
  1205
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
neuper@37906
  1206
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
neuper@37906
  1207
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} right----";
neuper@37906
  1208
 states:=[];
neuper@37906
  1209
 CalcTree
neuper@37906
  1210
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
  1211
   ("Test.thy", 
neuper@37906
  1212
    ["sqroot-test","univariate","equation","test"],
neuper@37906
  1213
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
  1214
 Iterator 1;
neuper@37906
  1215
 moveActiveRoot 1;
neuper@37906
  1216
 autoCalculate 1 CompleteCalc;
neuper@37906
  1217
 moveActiveFormula 1 ([2],Res);
neuper@37906
  1218
 replaceFormula 1 "-1 + x = 0" (*i.e. repeats input*);
neuper@37906
  1219
 (*... returns <ERROR> formula not changed </ERROR>*)
neuper@37906
  1220
neuper@37906
  1221
 val ((pt,_),_) = get_calc 1;
neuper@37906
  1222
 val p = get_pos 1 1;
neuper@37906
  1223
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
  1224
 if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else 
neuper@38031
  1225
 error "FE-interface.sml: diff.behav. in FORMULA:replace} right 1";
neuper@37906
  1226
 if map fst (get_interval ([2],Res) ([],Res) 9999 pt) = 
neuper@37906
  1227
    [([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res), ([3, 2], Res),
neuper@37906
  1228
     ([3], Res), ([4], Res), ([], Res)] then () (*nothing deleted!*) else
neuper@38031
  1229
 error "FE-interface.sml: diff.behav. in FORMULA:replace} right 2";
neuper@37906
  1230
 
neuper@37906
  1231
(*WN050211 replaceFormula didn't work on second ctree: thus now tested...*)
neuper@37906
  1232
 CalcTree
neuper@37906
  1233
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
  1234
   ("Test.thy", 
neuper@37906
  1235
    ["sqroot-test","univariate","equation","test"],
neuper@37906
  1236
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
  1237
 Iterator 2;
neuper@37906
  1238
 moveActiveRoot 2;
neuper@37906
  1239
 autoCalculate 2 CompleteCalc;
neuper@37906
  1240
 moveActiveFormula 2 ([2],Res);
neuper@37906
  1241
 replaceFormula 2 "-1 + x = 0" (*i.e. repeats input*);
neuper@37906
  1242
 (*... returns <ERROR> formula not changed </ERROR>*)
neuper@37906
  1243
neuper@37906
  1244
 val ((pt,_),_) = get_calc 2;
neuper@37906
  1245
 val p = get_pos 2 1;
neuper@37906
  1246
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
  1247
 if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else 
neuper@38031
  1248
 error "FE-interface.sml: diff.behav. in FORMULA:replace} right 1";
neuper@37906
  1249
 if map fst (get_interval ([2],Res) ([],Res) 9999 pt) = 
neuper@37906
  1250
    [([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res), ([3, 2], Res),
neuper@37906
  1251
     ([3], Res), ([4], Res), ([], Res)] then () (*nothing deleted!*) else
neuper@38031
  1252
 error "FE-interface.sml: diff.behav. in FORMULA:replace} right 2b";
neuper@37906
  1253
neuper@37906
  1254
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
neuper@37906
  1255
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
neuper@37906
  1256
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other----";
neuper@37906
  1257
 states:=[];
neuper@37906
  1258
 CalcTree
neuper@37906
  1259
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
  1260
   ("Test.thy", 
neuper@37906
  1261
    ["sqroot-test","univariate","equation","test"],
neuper@37906
  1262
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
  1263
 Iterator 1;
neuper@37906
  1264
 moveActiveRoot 1;
neuper@37906
  1265
 autoCalculate 1 CompleteCalc;
neuper@37906
  1266
 moveActiveFormula 1 ([2],Res); (*there is "-1 + x = 0"*)
neuper@37906
  1267
 replaceFormula 1 "x - 1 = 0"; (*<-------------------------------------*)
neuper@37906
  1268
 (*... returns calcChangedEvent with*)
neuper@37906
  1269
 val (unc, del, gen) = (([1],Res), ([4],Res), ([2],Res));
neuper@37906
  1270
 getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
neuper@37906
  1271
neuper@37906
  1272
 val ((pt,_),_) = get_calc 1;
neuper@37906
  1273
 show_pt pt;
neuper@37906
  1274
 val p = get_pos 1 1;
neuper@37906
  1275
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
  1276
 if term2str f = "x - 1 = 0" andalso p = ([2], Res) then () else 
neuper@38031
  1277
 error "FE-interface.sml: diff.behav. in FORMULA:replace} other 1";
neuper@37906
  1278
(* for getting the list in whole length ...
neuper@37906
  1279
print_depth 99;map fst (get_interval ([1],Res) ([],Res) 9999 pt);print_depth 3;
neuper@37906
  1280
   *)
neuper@37906
  1281
 if map fst (get_interval ([1],Res) ([],Res) 9999 pt) = 
neuper@37906
  1282
    [([1], Res), ([2, 1], Frm), ([2, 1], Res), ([2, 2], Res), ([2, 3], Res),
neuper@37906
  1283
      ([2, 4], Res), ([2, 5], Res), ([2, 6], Res), ([2, 7], Res),
neuper@37906
  1284
      ([2, 8], Res), ([2, 9], Res), ([2], Res)
neuper@37906
  1285
(*WN060727 {cutlevup->test_trans} removed: , 
neuper@37906
  1286
      ([], Res)(*dropped, if test_trans doesnt stop at PblNd*)*)] then () else
neuper@38031
  1287
 error "FE-interface.sml: diff.behav. in FORMULA:replace} other 2";
neuper@37906
  1288
neuper@37906
  1289
neuper@37906
  1290
neuper@37906
  1291
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
neuper@37906
  1292
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
neuper@37906
  1293
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} other 2--";
neuper@37906
  1294
 states:=[];
neuper@37906
  1295
 CalcTree
neuper@37906
  1296
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
  1297
   ("Test.thy", 
neuper@37906
  1298
    ["sqroot-test","univariate","equation","test"],
neuper@37906
  1299
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
  1300
 Iterator 1;
neuper@37906
  1301
 moveActiveRoot 1;
neuper@37906
  1302
 autoCalculate 1 CompleteCalc;
neuper@37906
  1303
 moveActiveFormula 1 ([2],Res); (*there is "-1 + x = 0"*)
neuper@37906
  1304
 replaceFormula 1 "x = 1"; (*<-------------------------------------*)
neuper@37906
  1305
 (*... returns calcChangedEvent with ...*)
neuper@37906
  1306
 val (unc, del, gen) = (([1],Res), ([4],Res), ([3,2],Res));
neuper@37906
  1307
 getFormulaeFromTo 1 unc gen 99999 (*all levels*) false;
neuper@37906
  1308
 (*9 elements !!!*)
neuper@37906
  1309
neuper@37906
  1310
 val ((pt,_),_) = get_calc 1;
neuper@37906
  1311
 show_pt pt; (*error: ...get_interval drops ([3,2],Res) ...*)
neuper@37906
  1312
 val (t,_) = get_obj g_result pt [3,2]; term2str t;
neuper@37906
  1313
  if map fst (get_interval ([1],Res) ([],Res) 9999 pt) = 
neuper@37906
  1314
    [([1], Res), ([2], Res), ([3], Pbl), ([3, 1], Frm), ([3, 1], Res),
neuper@37906
  1315
      ([3, 2, 1], Frm), ([3, 2, 1], Res), ([3, 2, 2], Res), 
neuper@37906
  1316
      ([3,2],Res)] then () else
neuper@38031
  1317
 error "FE-interface.sml: diff.behav. in FORMULA:replace} oth2 1";
neuper@37906
  1318
neuper@37906
  1319
 val p = get_pos 1 1;
neuper@37906
  1320
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
  1321
 if term2str f = "x = 1" andalso p = ([3,2], Res) then () else 
neuper@38031
  1322
 error "FE-interface.sml: diff.behav. in FORMULA:replace} oth2 2";
neuper@37906
  1323
neuper@37906
  1324
neuper@37906
  1325
neuper@37906
  1326
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
neuper@37906
  1327
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
neuper@37906
  1328
"--------- replaceFormula {SOLVE:MANUAL:FORMULA:replace} NOTok----";
neuper@37906
  1329
 states:=[];
neuper@37906
  1330
 CalcTree
neuper@37906
  1331
 [(["equality (x+1=2)", "solveFor x","solutions L"], 
neuper@37906
  1332
   ("Test.thy", 
neuper@37906
  1333
    ["sqroot-test","univariate","equation","test"],
neuper@37906
  1334
    ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
  1335
 Iterator 1;
neuper@37906
  1336
 moveActiveRoot 1;
neuper@37906
  1337
 autoCalculate 1 CompleteCalc;
neuper@37906
  1338
 moveActiveFormula 1 ([2],Res); (*there is "-1 + x = 0"*)
neuper@37906
  1339
 replaceFormula 1 "x - 4711 = 0"; 
neuper@37906
  1340
 (*... returns <ERROR> no derivation found </ERROR>*)
neuper@37906
  1341
neuper@37906
  1342
 val ((pt,_),_) = get_calc 1;
neuper@37906
  1343
 show_pt pt;
neuper@37906
  1344
 val p = get_pos 1 1;
neuper@37906
  1345
 val (Form f, tac, asms) = pt_extract (pt, p);
neuper@37906
  1346
 if term2str f = "-1 + x = 0" andalso p = ([2], Res) then () else 
neuper@38031
  1347
 error "FE-interface.sml: diff.behav. in FORMULA:replace} NOTok";
neuper@37906
  1348
neuper@37906
  1349