1 (* Title: test/Tools/isac/Knowledge/integrate.sml
2 Author: Walther Neuper 050826
3 (c) due to copyright terms
5 "--------------------------------------------------------";
6 "table of contents --------------------------------------";
7 "--------------------------------------------------------";
8 "----------- parsing ------------------------------------";
9 "----------- integrate by rewriting ---------------------";
10 "----------- test add_new_c, TermC.is_f_x ---------------------";
11 "----------- simplify by ruleset reducing make_ratpoly_in";
12 "----------- integrate by ruleset -----------------------";
13 "----------- rewrite 3rd integration in 7.27 ------------";
14 "----------- check probem type --------------------------";
15 "----------- me method [diff,integration] ---------------";
16 "----------- autoCalculate [diff,integration] -----------";
17 "----------- me method [diff,integration,named] ---------";
18 "----------- me met [diff,integration,named] Biegelinie.Q";
19 "----------- method analog to rls 'integration' ---------";
20 "--------------------------------------------------------";
21 "--------------------------------------------------------";
22 "--------------------------------------------------------";
24 (*these val/fun provide for exact parsing in Integrate.thy, not Isac.thy;
25 they are used several times below; TODO remove duplicates*)
26 val thy = @{theory "Integrate"};
27 val ctxt = Proof_Context.init_global thy;
29 fun str2t str = ParseC.term_opt ctxt str |> the;
30 fun term2s t = UnparseC.term ctxt t;
32 val conditions_in_integration_rules =
33 Rule_Set.Repeat {id="conditions_in_integration_rules",
35 rew_ord = ("termlessI",termlessI),
36 asm_rls = Rule_Set.Empty,
37 prog_rls = Rule_Set.Empty, calc = [], errpatts = [],
38 rules = [(*for rewriting conditions in Thm's*)
39 Eval ("Prog_Expr.occurs_in",
40 eval_occurs_in "#occurs_in_"),
41 Thm ("not_true", @{thm not_true}),
42 Thm ("not_false", @{thm not_false})],
43 program = Empty_Prog};
44 val subs = [(str2t "bdv::real", str2t "x::real")];
46 fst (the (rewrite_inst_ ctxt tless_true
47 conditions_in_integration_rules
51 "----------- parsing ------------------------------------";
52 "----------- parsing ------------------------------------";
53 "----------- parsing ------------------------------------";
54 val t = ParseC.parse_test @{context} "Integral x D x";
55 val t = ParseC.parse_test @{context} "Integral x \<up> 2 D x";
57 Const (\<^const_name>\<open>Integral\<close>, _) $
58 (Const (\<^const_name>\<open>realpow\<close>, _) $ Free _ $ _) $ Free ("x", _) => ()
59 | _ => error "integrate.sml: parsing: Integral x \<up> 2 D x";
61 val t = ParseC.parse_test @{context} "ff x is_f_x";
62 case t of Const (\<^const_name>\<open>is_f_x\<close>, _) $ _ => ()
63 | _ => error "integrate.sml: parsing: ff x is_f_x";
66 "----------- integrate by rewriting ---------------------";
67 "----------- integrate by rewriting ---------------------";
68 "----------- integrate by rewriting ---------------------";
69 val str = rewrit @{thm "integral_const"} (ParseC.parse_test @{context} "Integral 1 D x");
70 if term2s str = "1 * x" then () else error "integrate.sml Integral 1 D x";
72 val str = rewrit @{thm "integral_const"} (ParseC.parse_test @{context} "Integral M'/EJ D x");
73 if term2s str = "M' / EJ * x" then ()
74 else error "Integral M'/EJ D x BY integral_const";
76 val str = rewrit @{thm "integral_var"} (ParseC.parse_test @{context} "Integral x D x");
77 if term2s str = "x \<up> 2 / 2" then ()
78 else error "Integral x D x BY integral_var";
80 val str = rewrit @{thm "integral_add"} (ParseC.parse_test @{context} "Integral x + 1 D x");
81 if term2s str = "Integral x D x + Integral 1 D x" then ()
82 else error "Integral x + 1 D x BY integral_add";
84 val str = rewrit @{thm "integral_mult"} (ParseC.parse_test @{context} "Integral M'/EJ * x \<up> 3 D x");
85 if term2s str = "M' / EJ * Integral x \<up> 3 D x" then ()
86 else error "Integral M'/EJ * x \<up> 3 D x BY integral_mult";
88 val str = rewrit @{thm "integral_pow"} (ParseC.parse_test @{context} "Integral x \<up> 3 D x");
89 if term2s str = "x \<up> (3 + 1) / (3 + 1)" then ()
90 else error "integrate.sml Integral x \<up> 3 D x";
93 "----------- test add_new_c, TermC.is_f_x ---------------------";
94 "----------- test add_new_c, TermC.is_f_x ---------------------";
95 "----------- test add_new_c, TermC.is_f_x ---------------------";
96 val term = ParseC.parse_test @{context} "x \<up> 2 * c + c_2";
98 if UnparseC.term @{context} cc = "c_3" then () else error "integrate.sml: new_c ???";
100 val SOME (id,t') = eval_add_new_c "" "Integrate.add_new_c" term ctxt;
101 if UnparseC.term @{context} t' = "x \<up> 2 * c + c_2 = x \<up> 2 * c + c_2 + c_3" then ()
102 else error "intergrate.sml: diff. eval_add_new_c";
104 val cc = ("Integrate.add_new_c", eval_add_new_c "add_new_c_");
105 val SOME (thmstr, thm) = adhoc_thm1_ @{context} cc term;
107 val SOME (t',_) = rewrite_set_ ctxt true add_new_c term;
108 if UnparseC.term @{context} t' = "x \<up> 2 * c + c_2 + c_3" then ()
109 else error "intergrate.sml: diff. rewrite_set add_new_c 1";
111 val term = ParseC.parse_test @{context} "ff x = x \<up> 2*c + c_2";
112 val SOME (t',_) = rewrite_set_ ctxt true add_new_c term;
113 if UnparseC.term @{context} t' = "ff x = x \<up> 2 * c + c_2 + c_3" then ()
114 else error "intergrate.sml: diff. rewrite_set add_new_c 2";
117 (*WN080222 replace call_new_c with add_new_c----------------------
118 val term = str2t "new_c (c * x \<up> 2 + c_2)";
119 val SOME (_,t') = eval_new_c 0 0 term 0;
120 if term2s t' = "new_c c * x \<up> 2 + c_2 = c_3" then ()
121 else error "integrate.sml: eval_new_c ???";
123 val t = str2t "matches (?u + new_c ?v) (x \<up> 2 / 2)";
124 val SOME (_,t') = eval_matches "" "Prog_Expr.matches" t thy; term2s t';
125 if term2s t' = "matches (?u + new_c ?v) (x \<up> 2 / 2) = False" then ()
126 else error "integrate.sml: matches new_c = False";
128 val t = str2t "matches (?u + new_c ?v) (x \<up> 2 / 2 + new_c x \<up> 2 / 2)";
129 val SOME (_,t') = eval_matches "" "Prog_Expr.matches" t thy; term2s t';
130 if term2s t'="matches (?u + new_c ?v) (x \<up> 2 / 2 + new_c x \<up> 2 / 2) = True"
131 then () else error "integrate.sml: matches new_c = True";
133 val t = str2t "ff x TermC.is_f_x";
134 val SOME (_,t') = eval_is_f_x "" "" t thy; term2s t';
135 if term2s t' = "(ff x TermC.is_f_x) = True" then ()
136 else error "integrate.sml: eval_is_f_x --> true";
138 val t = str2t "q_0/2 * L * x TermC.is_f_x";
139 val SOME (_,t') = eval_is_f_x "" "" t thy; term2s t';
140 if term2s t' = "(q_0 / 2 * L * x TermC.is_f_x) = False" then ()
141 else error "integrate.sml: eval_is_f_x --> false";
143 val conditions_in_integration =
144 Rule_Set.Repeat {id="conditions_in_integration",
146 rew_ord = ("termlessI",termlessI),
147 asm_rls = Rule_Set.Empty,
148 prog_rls = Rule_Set.Empty, calc = [], errpatts = [],
149 rules = [Eval ("Prog_Expr.matches",eval_matches ""),
150 Eval ("Integrate.is_f_x",
151 eval_is_f_x "is_f_x_"),
152 Thm ("not_true",ThmC.numerals_to_Free @{thm not_true}),
153 Thm ("not_false",ThmC.numerals_to_Free @{thm not_false})
155 program = Empty_Prog};
157 fst (the (rewrite_inst_ thy tless_true
158 conditions_in_integration true subs thm t));
159 val t = rewrit call_for_new_c (str2t "x \<up> 2 / 2"); term2s t;
160 val t = (rewrit call_for_new_c t)
161 handle OPTION => str2t "no_rewrite";
163 val t = rewrit call_for_new_c
164 (str2t "ff x = q_0/2 *L*x"); term2s t;
165 val t = (rewrit call_for_new_c
166 (str2t "ff x = q_0 / 2 * L * x + new_c q_0 / 2 * L * x"))
167 handle OPTION => (*NOT: + new_c ..=..!!*)str2t "no_rewrite";
168 --------------------------------------------------------------------*)
171 "----------- simplify by ruleset reducing make_ratpoly_in";
172 "----------- simplify by ruleset reducing make_ratpoly_in";
173 "----------- simplify by ruleset reducing make_ratpoly_in";
174 val thy = @{theory "Isac_Knowledge"};
175 val ctxt = Proof_Context.init_global thy;
176 val subst = [(ParseC.parse_test @{context} "bdv ::real", ParseC.parse_test @{context} "x ::real")]; (*DOESN'T HELP*)
178 val t = ParseC.parse_test @{context} "1/EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)";
180 "----- stepwise from the rulesets in simplify_Integral and below-----";
181 val rls = norm_Rational_noadd_fractions;
182 case rewrite_set_inst_ ctxt true subs rls t of
183 SOME _ => error "integrate.sml simplify by ruleset norm_Rational_.#2"
187 val rls = order_add_mult_in;
188 val SOME (t, []) = rewrite_set_inst_ ctxt true subst rls t;
189 if UnparseC.term @{context} t = "1 / EI * (L * (q_0 * x) / 2 + - 1 * (q_0 * x \<up> 2) / 2)" then()
190 else error "integrate.sml simplify by ruleset order_add_mult_in #2";
193 val rls = discard_parentheses;
194 val SOME (t, []) = rewrite_set_ ctxt true rls t;
195 if UnparseC.term @{context} t = "1 / EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)" then ()
196 else error "integrate.sml simplify by ruleset discard_parenth.. #3";
199 val subs = [(ParseC.parse_test @{context} "bdv::real", ParseC.parse_test @{context} "x::real")];
201 (Rule_Set.append_rules "separate_bdv" collect_bdv
202 [Thm ("separate_bdv", @{thm separate_bdv}),
203 (*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
204 Thm ("separate_bdv_n", @{thm separate_bdv_n}),
205 (*"?a * ?bdv \<up> ?n / ?b = ?a / ?b * ?bdv \<up> ?n"*)
206 Thm ("separate_1_bdv", @{thm separate_1_bdv}),
207 (*"?bdv / ?b = (1 / ?b) * ?bdv"*)
208 Thm ("separate_1_bdv_n", @{thm separate_1_bdv_n})
209 (*"?bdv \<up> ?n / ?b = 1 / ?b * ?bdv \<up> ?n"*)
211 (*show_types := true; --- do we need type-constraint in thms? *)
212 @{thm separate_bdv}; (*::?'a does NOT rewrite here WITHOUT type constraint*)
213 @{thm separate_bdv_n}; (*::real ..because of \<up> , rewrites*)
214 @{thm separate_1_bdv}; (*::?'a*)
215 val xxx = @{thm separate_1_bdv}; (*::?'a*)
216 @{thm separate_1_bdv_n}; (*::real ..because of \<up> *)
217 (*show_types := false; --- do we need type-constraint in thms? YES ?!?!?!*)
219 val SOME (t, []) = rewrite_set_inst_ ctxt true subs rls t;
220 if UnparseC.term @{context} t = "1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2)" then ()
221 else error "integrate.sml simplify by ruleset separate_bdv.. #4";
224 val t = ParseC.parse_test @{context} "1/EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)";
225 val rls = simplify_Integral;
226 val SOME (t,[]) = rewrite_set_inst_ ctxt true subs rls t;
227 (* given was: "1 / EI * (L * q_0 * x / 2 + - 1 * q_0 * x \<up> 2 / 2)" *)
228 if UnparseC.term @{context} t = "1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2)" then ()
229 else error "integrate.sml, simplify_Integral #99";
231 "........... 2nd integral ........................................";
232 "........... 2nd integral ........................................";
233 "........... 2nd integral ........................................";
234 val subs = [(ParseC.parse_test @{context} "bdv::real", ParseC.parse_test @{context} "x::real")];
236 val thy = @{theory Biegelinie};
237 val t = ParseC.parse_test @{context}
238 "Integral 1 / EI * (L * q_0 / 2 * (x \<up> 2 / 2) + - 1 * q_0 / 2 * (x \<up> 3 / 3)) D x";
240 val rls = simplify_Integral;
241 val SOME (t,[]) = rewrite_set_inst_ ctxt true subs rls t;
242 if UnparseC.term @{context} t = "Integral 1 / EI * (L * q_0 / 4 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3) D x"
243 then () else raise error "integrate.sml, simplify_Integral #198";
245 val rls = integration_rules;
246 val SOME (t, []) = rewrite_set_ ctxt true rls t;
247 if UnparseC.term @{context} t = "1 / EI * (L * q_0 / 4 * (x \<up> 3 / 3) + - 1 * q_0 / 6 * (x \<up> 4 / 4))"
248 then () else error "integrate.sml, simplify_Integral #199";
251 "----------- integrate by ruleset -----------------------";
252 "----------- integrate by ruleset -----------------------";
253 "----------- integrate by ruleset -----------------------";
254 val thy = @{theory "Integrate"};
255 val rls = integration_rules;
256 val subs = [(@{term "bdv::real"}, @{term "x::real"})];
257 (*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
259 val t = ParseC.parse_test ctxt "Integral x D x";
260 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
261 if UnparseC.term @{context} res = "x \<up> 2 / 2" then () else error "Integral x D x changed";
263 val t = ParseC.parse_test ctxt "Integral c * x \<up> 2 + c_2 D x";
264 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
265 if UnparseC.term @{context} res = "c * (x \<up> 3 / 3) + c_2 * x" then () else error "Integral c * x \<up> 2 + c_2 D x";
268 val t = ParseC.parse_test ctxt "c * (x \<up> 3 / 3) + c_2 * x";
269 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
270 if UnparseC.term @{context} res = "c * (x \<up> 3 / 3) + c_2 * x + c_3" then ()
271 else error "integrate.sml: diff.behav. in add_new_c simpl.";
273 val t = ParseC.parse_test ctxt "F x = x \<up> 3 / 3 + x";
274 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
275 if UnparseC.term @{context} res = "F x = x \<up> 3 / 3 + x + c"(*not "F x + c =..."*) then ()
276 else error "integrate.sml: diff.behav. in add_new_c equation";
278 val rls = simplify_Integral;
279 (*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
280 val t = ParseC.parse_test ctxt "ff x = c * x + - 1 * q_0 * (x \<up> 2 / 2) + c_2";
281 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
282 if UnparseC.term @{context} res = "ff x = c_2 + c * x + - 1 * q_0 / 2 * x \<up> 2"
283 then () else error "integrate.sml: diff.behav. in simplify_I #1";
285 val rls = integration;
286 (*~~~~~~~~~~~~~~~~~~~~~~~~~~~*)
287 val t = ParseC.parse_test ctxt "Integral c * x \<up> 2 + c_2 D x";
288 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
289 if UnparseC.term @{context} res = "c_3 + c_2 * x + c / 3 * x \<up> 3"
290 then () else error "integrate.sml: diff.behav. in integration #1";
292 val t = ParseC.parse_test ctxt "Integral 3*x \<up> 2 + 2*x + 1 D x";
293 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
294 if UnparseC.term @{context} res = "c + x + x \<up> 2 + x \<up> 3" then ()
295 else error "integrate.sml: diff.behav. in integration #2";
297 val t = ParseC.parse_test ctxt
298 "Integral 1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2) D x";
299 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
300 "Integral 1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2) D x";
301 if UnparseC.term @{context} res = "c + 1 / EI * (L * q_0 / 4 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)"
302 then () else error "integrate.sml: diff.behav. in integration #3";
304 val t = ParseC.parse_test ctxt ("Integral " ^ UnparseC.term @{context} res ^ " D x");
305 val SOME (res, _) = rewrite_set_inst_ ctxt true subs rls t;
306 if UnparseC.term @{context} res = "c_2 + c * x +\n1 / EI * (L * q_0 / 12 * x \<up> 3 + - 1 * q_0 / 24 * x \<up> 4)"
307 then () else error "integrate.sml: diff.behav. in integration #4";
309 "----------- rewrite 3rd integration in 7.27 ------------";
310 "----------- rewrite 3rd integration in 7.27 ------------";
311 "----------- rewrite 3rd integration in 7.27 ------------";
312 val t = ParseC.parse_test @{context} "Integral 1 / EI * ((L * q_0 * x + - 1 * q_0 * x \<up> 2) / 2) D x";
313 val SOME(t, _)= rewrite_set_inst_ ctxt true subs simplify_Integral t;
314 if UnparseC.term @{context} t =
315 "Integral 1 / EI * (L * q_0 / 2 * x + - 1 * q_0 / 2 * x \<up> 2) D x"
316 then () else error "integrate.sml 3rd integration in 7.27, simplify_Integral";
318 val SOME(t, _) = rewrite_set_inst_ ctxt true subs integration t;
319 if UnparseC.term @{context} t =
320 "c + 1 / EI * (L * q_0 / 4 * x \<up> 2 + - 1 * q_0 / 6 * x \<up> 3)"
321 then () else error "integrate.sml 3rd integration in 7.27, integration";
324 "----------- check probem type --------------------------";
325 "----------- check probem type --------------------------";
326 "----------- check probem type --------------------------";
327 val thy = @{theory Integrate};
328 val model = {Given =["functionTerm f_f", "integrateBy v_v"],
330 Find =["antiDerivative F_F"],
332 Relate=[]}:string model;
333 val chkmodel = ((map (ParseC.parse_test ctxt)) o P_Model.to_list) model;
334 val t1 = (hd) chkmodel;
335 val t2 = (hd o tl) chkmodel;
336 val t3 = (hd o tl o tl) chkmodel;
337 case t3 of Const (\<^const_name>\<open>antiDerivative\<close>, _) $ _ => ()
338 | _ => error "integrate.sml: Integrate.antiDerivative ???";
340 val model = {Given =["functionTerm f_f", "integrateBy v_v"],
342 Find =["antiDerivativeName F_F"],
344 Relate=[]}:string model;
345 val chkmodel = ((map (ParseC.parse_test ctxt)) o P_Model.to_list) model;
346 val t1 = (hd) chkmodel;
347 val t2 = (hd o tl) chkmodel;
348 val t3 = (hd o tl o tl) chkmodel;
349 case t3 of Const (\<^const_name>\<open>antiDerivativeName\<close>, _) $ _ => ()
350 | _ => error "integrate.sml: Integrate.antiDerivativeName";
352 "----- compare 'Find's from problem, script, formalization -------";
353 val {model,...} = Problem.from_store @{context} ["named", "integrate", "function"];
354 val ("#Find", (Const (\<^const_name>\<open>antiDerivativeName\<close>, _),
355 F1_ as Free ("F_F", F1_type))) = last_elem model;
356 val {program = Prog sc,... } = MethodC.from_store ctxt ["diff", "integration", "named"];
357 val [_,_, F2_] = formal_args sc;
358 if F1_ = F2_ then () else error "integrate.sml: unequal find's";
360 val ((dsc as Const (\<^const_name>\<open>antiDerivativeName\<close>, _))
361 $ Free ("ff", F3_type)) = ParseC.parse_test @{context} "antiDerivativeName ff";
362 if Input_Descript.is_a dsc then () else error "integrate.sml: no description";
363 if F1_type = F3_type then ()
364 else error "integrate.sml: unequal types in find's";
366 Test_Tool.show_ptyps();
367 val pbl = Problem.from_store @{context} ["integrate", "function"];
368 case #cas pbl of SOME (Const (\<^const_name>\<open>Integrate\<close>, _) $ _) => ()
369 | _ => error "integrate.sml: Integrate.Integrate ???";
372 "----------- me method [diff,integration] ---------------";
373 "----------- me method [diff,integration] ---------------";
374 "----------- me method [diff,integration] ---------------";
375 (*exp_CalcInt_No- 1.xml*)
376 val p = e_pos'; val c = [];
377 "----- step 0: returns nxt = Model_Problem ---";
378 val (p,_,f,nxt,_,pt) =
379 Test_Code.init_calc @{context}
380 [(["functionTerm (x \<up> 2 + 1)", "integrateBy x", "antiDerivative FF"],
381 ("Integrate", ["integrate", "function"], ["diff", "integration"]))];
382 "----- step 1: returns nxt = Add_Given \"functionTerm (x \<up> 2 + 1)\" ---";
383 val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = ("Tac ", ...) --> Add_Given...*)
384 "----- step 2: returns nxt = Add_Given \"integrateBy x\" ---";
385 val (p,_,f,nxt,_,pt) = me nxt p c pt;
386 "----- step 3: returns nxt = Add_Find \"Integrate.antiDerivative FF\" ---";
387 val (p,_,f,nxt,_,pt) = me nxt p c pt;
388 "----- step 4: returns nxt = Specify_Theory \"Integrate\" ---";
389 val (p,_,f,nxt,_,pt) = me nxt p c pt;
390 "----- step 5: returns nxt = Specify_Problem [\"integrate\", \"function\"] ---";
391 val (p,_,f,nxt,_,pt) = me nxt p c pt;
392 "----- step 6: returns nxt = Specify_Method [\"diff\", \"integration\"] ---";
393 val (p,_,f,nxt,_,pt) = me nxt p c pt;
394 "----- step 7: returns nxt = Apply_Method [\"diff\", \"integration\"] ---";
395 val (p,_,f,nxt,_,pt) = me nxt p c pt;
396 case nxt of (Apply_Method ["diff", "integration"]) => ()
397 | _ => error "integrate.sml -- me method [diff,integration] -- spec";
398 "----- step 8: returns nxt = Rewrite_Set_Inst ([\"(''bdv'', x)\"],\"integration\")";
399 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
400 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
401 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
402 if f2str f = "c + x + 1 / 3 * x \<up> 3" then ()
403 else error "integrate.sml -- me method [diff,integration] -- end";
406 "----------- autoCalculate [diff,integration] -----------";
407 "----------- autoCalculate [diff,integration] -----------";
408 "----------- autoCalculate [diff,integration] -----------";
411 [(["functionTerm (x \<up> 2 + 1)", "integrateBy x", "antiDerivative FF"],
412 ("Integrate", ["integrate", "function"], ["diff", "integration"]))];
415 autoCalculate 1 CompleteCalc;
416 val ((pt,p),_) = States.get_calc 1; @{make_string} p; Test_Tool.show_pt pt;
417 val (Form t,_,_) = ME_Misc.pt_extract ctxt (pt, p);
418 if UnparseC.term @{context} t = "c + x + 1 / 3 * x \<up> 3" then ()
419 else error "integrate.sml -- interSteps [diff,integration] -- result";
422 "----------- me method [diff,integration,named] ---------";
423 "----------- me method [diff,integration,named] ---------";
424 "----------- me method [diff,integration,named] ---------";
425 (*exp_CalcInt_No- 2.xml*)
426 val fmz = ["functionTerm (x \<up> 2 + (1::real))",
427 "integrateBy x", "antiDerivativeName F"];
429 ("Integrate",["named", "integrate", "function"],
430 ["diff", "integration", "named"]);
431 val p = e_pos'; val c = [];
432 val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
433 val (p,_,f,nxt,_,pt) = me nxt p c pt;
434 val (p,_,f,nxt,_,pt) = me nxt p c pt;
435 val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Add_Find *);
436 val (p,_,f,nxt,_,pt) = me nxt p c pt;
437 val (p,_,f,nxt,_,pt) = me nxt p c pt;
438 val (p,_,f,nxt,_,pt) = me nxt p c pt;
439 val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Apply_Method*);
440 val (p,_,f,nxt,_,pt) = me nxt p c pt;
441 val (p,_,f,nxt,_,pt) = me nxt p c pt;
442 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
443 if f2str f = "F x = c + x + 1 / 3 * x \<up> 3" then()
444 else error "integrate.sml: method [diff,integration,named]";
447 "----------- me met [diff,integration,named] Biegelinie.Q";
448 "----------- me met [diff,integration,named] Biegelinie.Q";
449 "----------- me met [diff,integration,named] Biegelinie.Q";
450 (*exp_CalcInt_No-3.xml*)
451 val fmz = ["functionTerm (- q_0)",
452 "integrateBy x", "antiDerivativeName Q"];
454 ("Biegelinie",["named", "integrate", "function"],
455 ["diff", "integration", "named"]);
456 val p = e_pos'; val c = [];
457 val (p,_,f,nxt,_,pt) = Test_Code.init_calc @{context} [(fmz, (dI',pI',mI'))];
458 val (p,_,f,nxt,_,pt) = me nxt p c pt;
459 val (p,_,f,nxt,_,pt) = me nxt p c pt;
460 (*Error Tac Q not in ...*)
461 val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Add_Find *);
462 val (p,_,f,nxt,_,pt) = me nxt p c pt;
463 val (p,_,f,nxt,_,pt) = me nxt p c pt;
464 val (p,_,f,nxt,_,pt) = me nxt p c pt;
465 val (p,_,f,nxt,_,pt) = me nxt p c pt(*nxt <- Apply_Method*);
466 val (p,_,f,nxt,_,pt) = me nxt p c pt;
467 val (p,_,f,nxt,_,pt) = me nxt p c pt;
468 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
469 if f2str f = "Q x = c + - 1 * q_0 * x" then()
470 else error "integrate.sml: method [diff,integration,named] .Q";