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