Test_Isac works again, almost ..
4 files raise errors:
# Interpret/solve.sml: "solve.sml: interSteps on norm_Rational 2"
# Interpret/inform.sml: "inform.sml: [rational,simplification] 2"
# Knowledge/partial_fractions.sml: "autoCalculate for met_partial_fraction changed: final result"
# Knowledge/eqsystem.sml: "eqsystem.sml: exp 7.70 normalize 4x4 by rewrite changed"
The chunk of changes is due to the fact, that Isac's code still is unstable.
The changes are accumulated since e8f46493af82.
2 cd /usr/local/Isabelle/test/Tools/isac/ADDTESTS/course/
3 /usr/local/Isabelle/bin/isabelle jedit -l Isac T2_Rewriting.thy &
6 theory T3_MathEngine imports Isac begin
8 chapter {* ISACs mathematics engine *}
9 text {* This is a brief introduction to ISACs mathematics engine (ME). The
10 goal of the introduction is enabling authors to test new developments of
12 As an example we continue the previous one on rewriting. The previous
13 chapter raised questions about didactics and stated open developments problems.
14 So, let us assume, some additional knowledge has been added to solve some of
15 the open problems with '-' in simplification.
16 Now we want to test, if
17 Vereinfache (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)
19 3 - 2 * e + 2 * f + 2 * g
22 section {* Knowledge for automated solving the example problem *}
23 text {* ISAC wants to show possibilities for next steps, if learners get stuck.
24 So, at least ISAC needs to be able to solve a problem automatically. For this
25 purpose, ISAC requires three kinds of knowledge, (1) rules to apply (2) a
26 specification of the problem and (3) a method solving the problem.
28 ad (1) The rules required for simplifying our example are found in theory
29 ~~/Tools/isac/Knowledge/PolyMinus.thy.
31 ad (2) The problem of 'vereinfachen' is one of many other problems;
32 the function 'get_pbt' gets the one we need:
35 get_pbt ["plus_minus", "polynom", "vereinfachen"];
37 text {* However, 'get_pbt' shows an internal format; for a human readable format
38 see http://www.ist.tugraz.at/projects/isac/www/kbase/pbl/index_pbl.html
39 Note, that in this tree you first lookup "vereinfachen", then "polynom" and
40 finally "plus_minus", the same as you see from 'show_ptyps ()'.
41 However, we call the problem "plus_minus - polynom - vereinfachen".
43 ad (3) The method solving the problem is also one of many others; the function
44 'get_met' gets the one we need:
48 get_met ["simplification","for_polynomials","with_minus"];
50 text {* For a readable format of the method look up the definition in
51 ~~/Tools/isac/Knowledge/PolyMinus.thy or
52 http://www.ist.tugraz.at/projects/isac/www/kbase/met/index_met.html
53 The path to the method "simplification - for_polynomials - with_minus" is
54 not reversed like the one to the problem, because the structure of the
55 methods' container is not yet clarified.
58 section {* Testing the example problem *}
59 text {* Now we have all the knowledge ISAC requires for guiding the learner:
60 (1) the theory "PolyMinus", (2) the problem ["plus_minus","polynom","vereinfachen"]
61 and (3) the method ["simplification","for_polynomials","with_minus"].
63 So we can start testing the example by calling 'CalcTreeTEST':
65 ML {* val (p,_,f,nxt,_,pt) =
67 [(["Term (5*e + 6*f - 8*g - 9 - 7*e - 4*f + 10*g + 12)",
69 ("PolyMinus",["plus_minus","polynom","vereinfachen"],
70 ["simplification","for_polynomials","with_minus"]))];
72 text {* The function 'CalcTreeTEST' returns the following values:
73 p: the position in the calculation
74 f: the formula produced by this step of calculation.
75 In this case 'f' is an incomplete model of the problem.
76 nxt: the tactic suggested to do the next step
77 pt: the _whole_ calculation in an internal format; the calculation 'pt'
78 will be fed back into the mathematics engine, the function 'me' below,
79 'me' is purely functional, no further data remains in the memory.
80 'me' returns the same data as 'CalcTreeTEST'.
82 The first tactic suggested by ISAC is 'Model_Problem', we use this tactic
83 (stored in 'nxt') and enter the 'specification phase'.
86 section {* Specifying the example problem *}
87 text {* Often the specification phase is hidden from the learner by the dialog
88 module; here we see the mathematics engine at work directly.
90 Only note the tactic 'nxt' suggested for the next step:
92 ML {* val c = [(*this is an unimportant, but necessary detail*)];
93 val (p,_,f,nxt,_,pt) = me nxt p c pt;
94 val (p,_,f,nxt,_,pt) = me nxt p c pt;
96 text{* The tactics 'Add_Given' and 'Add_Find' inserted the respective values
97 into the model. Then 'Specify_Theory' determines the knowledge item no.1 from
98 above, 'Specify_Problem' item 2 and 'Specify_Method' item 3.
101 val (p,_,f,nxt,_,pt) = me nxt p c pt;
102 val (p,_,f,nxt,_,pt) = me nxt p c pt;
103 val (p,_,f,nxt,_,pt) = me nxt p c pt;
104 val (p,_,f,nxt,_,pt) = me nxt p c pt;
106 text{* The final suggestion 'Apply_Method' completes the specification phase
107 and starts the 'solving phase', which is guided by the method determined.
110 section {* Solving the example problem *}
111 text {* Now let us observe, how the method ["simplification","for_polynomials",
112 "with_minus"] guides through simplification by rewriting. For that purpose
113 we increase the 'print_depth' (with the disadvantage of extending the output)
114 and print out the results by use of 'f2str'.
115 Please, note only 'nxt' close to the beginning of the output and the resulting
118 ML {* print_depth 40; *}
119 ML {* val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f; *}
120 ML {* val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f; *}
121 ML {* val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f; *}
122 ML {* val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f; *}
123 ML {* print_depth 3; *}
124 text{* And, please, note that the result of applying the 'nxt' ruleset is to be
125 found in the output of the next step !
128 section {* Completing the example problem *}
129 text {* The 'nxt' tactic suggested above was 'Check_Postcond'. That means, a
130 perfect mathematics engine has to prove the socalled 'postcondition' of the
131 current problem; this is not yet implemented in the current version of ISAC.
133 ML {* val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f; *}
134 text{* Now the mathematics engine has found the end of the calculation.
136 With 'show_pt' the calculation can be inspected (in a more or less readable
137 format) by clicking the checkbox <Tracing> on top of the <Output> window:
142 section {* Test further examples *}
143 text{* Now it is easy to do further examples: just put another calculation into
146 ML {* val (p,_,f,nxt,_,pt) =
148 [(["Term (1 + 2 + 3)", "normalform N"],
149 ("PolyMinus",["plus_minus","polynom","vereinfachen"],
150 ["simplification","for_polynomials","with_minus"]))];
152 ML {* val (p,_,f,nxt,_,pt) = me nxt p c pt; *}
153 text{* and repeat this ML line as often as required ...*}