branch | isac-update-Isa09-2 |
changeset 37995 | fac82f29f143 |
parent 37994 | eb4c556a525b |
child 38031 | 460c24a6a6ba |
37994:eb4c556a525b | 37995:fac82f29f143 |
---|---|
26 " #################################################### "; |
26 " #################################################### "; |
27 " problemtypes + formalizations "; |
27 " problemtypes + formalizations "; |
28 " #################################################### "; |
28 " #################################################### "; |
29 " -------------- [maximum_of,function] --------------- "; |
29 " -------------- [maximum_of,function] --------------- "; |
30 val pbt = |
30 val pbt = |
31 ["fixedValues fix_","maximum m_","valuesFor vs_","relations rs_"]; |
31 ["fixedValues f_ix","maximum m_","valuesFor v_s","relations r_s"]; |
32 map (the o (parseold thy)) pbt; |
32 map (the o (parseold thy)) pbt; |
33 val fmz = |
33 val fmz = |
34 ["fixedValues [r=Arbfix]","maximum A", |
34 ["fixedValues [r=Arbfix]","maximum A", |
35 "valuesFor [a,b]", |
35 "valuesFor [a,b]", |
36 "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]", |
36 "relations [A=a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]", |
67 "solveFor b","solutions b_i"]; |
67 "solveFor b","solutions b_i"]; |
68 map (the o (parseold thy)) fmz; |
68 map (the o (parseold thy)) fmz; |
69 " ---- [on_interval,maximum_of,function] ---- "; |
69 " ---- [on_interval,maximum_of,function] ---- "; |
70 val pbt = |
70 val pbt = |
71 ["functionTerm t_","boundVariable v_v","interval itv_", |
71 ["functionTerm t_","boundVariable v_v","interval itv_", |
72 "errorBound err_","maxArgument v_0_"]; |
72 "errorBound err_","maxArgument v_0"]; |
73 map (the o (parseold thy)) pbt; |
73 map (the o (parseold thy)) pbt; |
74 val fmz12 = |
74 val fmz12 = |
75 [(*28.11.00: "functionTerm (A_0 = a*sqrt(#4*r^^^#2 - a^^^#2))",*) |
75 [(*28.11.00: "functionTerm (A_0 = a*sqrt(#4*r^^^#2 - a^^^#2))",*) |
76 "functionTerm (a*sqrt(4*r^^^2 - a^^^2))", |
76 "functionTerm (a*sqrt(4*r^^^2 - a^^^2))", |
77 (*28.11.00: "functionTerm (A_0 = b*sqrt(#4*r^^^#2 - b^^^#2))",*) |
77 (*28.11.00: "functionTerm (A_0 = b*sqrt(#4*r^^^#2 - b^^^#2))",*) |
98 (*28.11.00: "derivative (A_0'=Undef)"*)"derivative (Undef)"]; |
98 (*28.11.00: "derivative (A_0'=Undef)"*)"derivative (Undef)"]; |
99 map (the o (parseold thy)) fmz; |
99 map (the o (parseold thy)) fmz; |
100 " --------- [find_values,tool] --------- "; |
100 " --------- [find_values,tool] --------- "; |
101 val pbt = |
101 val pbt = |
102 ["maxArgument ma_","functionTerm f_f","boundVariable v_v", |
102 ["maxArgument ma_","functionTerm f_f","boundVariable v_v", |
103 "valuesFor vls_","additionalRels rs_"]; |
103 "valuesFor vls_","additionalRels r_s"]; |
104 map (the o (parseold thy)) pbt; |
104 map (the o (parseold thy)) pbt; |
105 val fmz1 = |
105 val fmz1 = |
106 ["maxArgument (a_0=(srqt 2)*r)", |
106 ["maxArgument (a_0=(srqt 2)*r)", |
107 (*28.11.00: "functionTerm (A_0=a*#2*sqrt r^^^#2 - (a//#2)^^^#2)",*) |
107 (*28.11.00: "functionTerm (A_0=a*#2*sqrt r^^^#2 - (a//#2)^^^#2)",*) |
108 "functionTerm (a*2*sqrt r^^^2 - (a/2)^^^2)", |
108 "functionTerm (a*2*sqrt r^^^2 - (a/2)^^^2)", |
426 fetchProposedTactic 1; |
426 fetchProposedTactic 1; |
427 val ((pt,p),_) = get_calc 1; |
427 val ((pt,p),_) = get_calc 1; |
428 val mits = get_obj g_met pt (fst p); |
428 val mits = get_obj g_met pt (fst p); |
429 writeln (itms2str_ ctxt mits); |
429 writeln (itms2str_ ctxt mits); |
430 (* |
430 (* |
431 if itms2str_ ctxt mits = "[\n(1 ,[1] ,true ,#Given ,Cor functionEq (hd rs_) ,(t_, [hd rs_])),\n(2 ,[1] ,true ,#Given ,Cor boundVariable v_v ,(v_, [v_])),\n(3 ,[1] ,true ,#Given ,Cor interval itv_ ,(itv_, [itv_])),\n(4 ,[1] ,true ,#Find ,Cor maxArgument v__0 ,(v_0_, [v__0]))]" then () |
431 if itms2str_ ctxt mits = "[\n(1 ,[1] ,true ,#Given ,Cor functionEq (hd r_s) ,(t_, [hd r_s])),\n(2 ,[1] ,true ,#Given ,Cor boundVariable v_v ,(v_, [v_])),\n(3 ,[1] ,true ,#Given ,Cor interval itv_ ,(itv_, [itv_])),\n(4 ,[1] ,true ,#Find ,Cor maxArgument v__0 ,(v_0, [v__0]))]" then () |
432 else raise error "diffapp.sml: diff.behav. in autoCalc .. scripts for max 1"; |
432 else raise error "diffapp.sml: diff.behav. in autoCalc .. scripts for max 1"; |
433 *) |
433 *) |
434 (*FIXME: the environments contain identifers, and NOT values ?!?!?*) |
434 (*FIXME: the environments contain identifers, and NOT values ?!?!?*) |
435 (* WN051209 while extending 'fun step' for initac, this became better ... |
435 (* WN051209 while extending 'fun step' for initac, this became better ... |
436 if itms2str_ ctxt mits = "[\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(fix_, [[r = Arbfix]])),\n(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),\n(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(vs_, [[a],[b]])),\n(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2] ,(rs_, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),\n(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(v_, [a])),\n(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(itv_, [{x. 0 <= x & x <= 2 * r}])),\n(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(err_, [eps = 0]))]" then () |
436 if itms2str_ ctxt mits = "[\n(1 ,[1,2,3] ,true ,#Given ,Cor fixedValues [r = Arbfix] ,(f_ix, [[r = Arbfix]])),\n(2 ,[1,2,3] ,true ,#Find ,Cor maximum A ,(m_, [A])),\n(3 ,[1,2,3] ,true ,#Find ,Cor valuesFor [a, b] ,(v_s, [[a],[b]])),\n(4 ,[1,2] ,true ,#Relate ,Cor relations [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2] ,(r_s, [[A = a * b],[(a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]])),\n(6 ,[1] ,true ,#undef ,Cor boundVariable a ,(v_, [a])),\n(9 ,[1,2] ,true ,#undef ,Cor interval {x. 0 <= x & x <= 2 * r} ,(itv_, [{x. 0 <= x & x <= 2 * r}])),\n(11 ,[1,2,3] ,true ,#undef ,Cor errorBound (eps = 0) ,(err_, [eps = 0]))]" then () |
437 else raise error "diffapp.sml: diff.behav. in autoCalc .. scripts for max 1"; |
437 else raise error "diffapp.sml: diff.behav. in autoCalc .. scripts for max 1"; |
438 *) |
438 *) |
439 |
439 |
440 |
440 |
441 |
441 |
442 "--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------"; |
442 "--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------"; |
443 "--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------"; |
443 "--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------"; |
444 "--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------"; |
444 "--------------------- 30.4.03: maximum .. rewrite_set_ list_rls ---------"; |
445 str2term |
445 str2term |
446 "Script Maximum_value(fix_::bool list)(m_::real) (rs_::bool list)\ |
446 "Script Maximum_value(f_ix::bool list)(m_::real) (r_s::bool list)\ |
447 \ (v_v::real) (itv_v::real set) (err_::bool) = \ |
447 \ (v_v::real) (itv_v::real set) (err_::bool) = \ |
448 \ (let e_e = (hd o (filterVar m_)) rs_; \ |
448 \ (let e_e = (hd o (filterVar m_)) r_s; \ |
449 \ t_ = (if 1 < length_ rs_ \ |
449 \ t_ = (if 1 < length_ r_s \ |
450 \ then (SubProblem (Reals_,[make,function],[no_met])\ |
450 \ then (SubProblem (Reals_,[make,function],[no_met])\ |
451 \ [REAL m_, REAL v_v, BOOL_LIST rs_])\ |
451 \ [REAL m_, REAL v_v, BOOL_LIST r_s])\ |
452 \ else (hd rs_)); \ |
452 \ else (hd r_s)); \ |
453 \ (mx_::real) = SubProblem (Reals_,[on_interval,max_of,function], \ |
453 \ (mx_::real) = SubProblem (Reals_,[on_interval,max_of,function], \ |
454 \ [Isac,maximum_on_interval])\ |
454 \ [Isac,maximum_on_interval])\ |
455 \ [BOOL t_, REAL v_v, REAL_SET itv_]\ |
455 \ [BOOL t_, REAL v_v, REAL_SET itv_]\ |
456 \ in ((SubProblem (Reals_,[find_values,tool],[Isac,find_values]) \ |
456 \ in ((SubProblem (Reals_,[find_values,tool],[Isac,find_values]) \ |
457 \ [REAL mx_, REAL (Rhs t_), REAL v_v, REAL m_, \ |
457 \ [REAL mx_, REAL (Rhs t_), REAL v_v, REAL m_, \ |
458 \ BOOL_LIST (dropWhile (ident e_e) rs_)])::bool list))"; |
458 \ BOOL_LIST (dropWhile (ident e_e) r_s)])::bool list))"; |
459 |
459 |
460 val fix_ = (str2term "fix_::bool list", |
460 val f_ix = (str2term "f_ix::bool list", |
461 str2term "[r=Arbfix]"); |
461 str2term "[r=Arbfix]"); |
462 val m_ = (str2term "m_::real", |
462 val m_ = (str2term "m_::real", |
463 str2term "A"); |
463 str2term "A"); |
464 val rs_ = (str2term "rs_::bool list", |
464 val r_s = (str2term "rs_::bool list", |
465 str2term "[A = a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]"); |
465 str2term "[A = a*b, (a/2)^^^2 + (b/2)^^^2 = r^^^2]"); |
466 val v_v = (str2term "v_v::real", |
466 val v_v = (str2term "v_v::real", |
467 str2term "b"); |
467 str2term "b"); |
468 val itv_ = (str2term "itv_v::real set", |
468 val itv_ = (str2term "itv_v::real set", |
469 str2term "{x::real. 0 <= x & x <= 2*r}"); |
469 str2term "{x::real. 0 <= x & x <= 2*r}"); |
470 val err_ = (str2term "err_::bool", |
470 val err_ = (str2term "err_::bool", |
471 str2term "eps=0"); |
471 str2term "eps=0"); |
472 val env = [fix_, m_, rs_ ,v_, itv_, err_]; |
472 val env = [f_ix, m_, r_s ,v_, itv_, err_]; |
473 |
473 |
474 (*--- 1.line in script ---*) |
474 (*--- 1.line in script ---*) |
475 val t = str2term "(hd o (filterVar m_)) (rs_::bool list)"; |
475 val t = str2term "(hd o (filterVar m_)) (r_s::bool list)"; |
476 val s = subst_atomic env t; |
476 val s = subst_atomic env t; |
477 term2str s; |
477 term2str s; |
478 "(hd o filterVar A) [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]"; |
478 "(hd o filterVar A) [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]"; |
479 val SOME (s',_) = rewrite_set_ thy false list_rls s; |
479 val SOME (s',_) = rewrite_set_ thy false list_rls s; |
480 val s'' = term2str s'; |
480 val s'' = term2str s'; |
481 if s''="A = a * b" then () else raise error "new behaviour with list_rls 1.1."; |
481 if s''="A = a * b" then () else raise error "new behaviour with list_rls 1.1."; |
482 val env = env @ [(str2term "e_::bool",str2term "A = a * b")]; |
482 val env = env @ [(str2term "e_::bool",str2term "A = a * b")]; |
483 |
483 |
484 (*--- 2.line: condition alone ---*) |
484 (*--- 2.line: condition alone ---*) |
485 val t = str2term "1 < length_ (rs_::bool list)"; |
485 val t = str2term "1 < length_ (r_s::bool list)"; |
486 val s = subst_atomic env t; |
486 val s = subst_atomic env t; |
487 term2str s; |
487 term2str s; |
488 "1 < length_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]"; |
488 "1 < length_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]"; |
489 val SOME (s',_) = rewrite_set_ thy false list_rls s; |
489 val SOME (s',_) = rewrite_set_ thy false list_rls s; |
490 val s'' = term2str s'; |
490 val s'' = term2str s'; |
491 if s''="True" then () else raise error "new behaviour with list_rls 1.2."; |
491 if s''="True" then () else raise error "new behaviour with list_rls 1.2."; |
492 |
492 |
493 (*--- 2.line in script ---*) |
493 (*--- 2.line in script ---*) |
494 val t = str2term |
494 val t = str2term |
495 "(if 1 < length_ rs_ \ |
495 "(if 1 < length_ r_s \ |
496 \ then (SubProblem (Reals_,[make,function],[no_met])\ |
496 \ then (SubProblem (Reals_,[make,function],[no_met])\ |
497 \ [REAL m_, REAL v_v, BOOL_LIST rs_])\ |
497 \ [REAL m_, REAL v_v, BOOL_LIST r_s])\ |
498 \ else (hd rs_))"; |
498 \ else (hd r_s))"; |
499 val s = subst_atomic env t; |
499 val s = subst_atomic env t; |
500 term2str s; |
500 term2str s; |
501 "if 1 < length_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]\ |
501 "if 1 < length_ [A = a * b, (a / 2) ^^^ 2 + (b / 2) ^^^ 2 = r ^^^ 2]\ |
502 \then SubProblem (Reals_, [make, function], [no_met])\ |
502 \then SubProblem (Reals_, [make, function], [no_met])\ |
503 \ [REAL A, REAL b,\ |
503 \ [REAL A, REAL b,\ |
521 str2term |
521 str2term |
522 "Script Make_fun_by_explicit (f_f::real) (v_v::real) \ |
522 "Script Make_fun_by_explicit (f_f::real) (v_v::real) \ |
523 \ (eqs::bool list) = \ |
523 \ (eqs::bool list) = \ |
524 \ (let h_ = (hd o (filterVar f_)) eqs; \ |
524 \ (let h_ = (hd o (filterVar f_)) eqs; \ |
525 \ e_1 = hd (dropWhile (ident h_) eqs); \ |
525 \ e_1 = hd (dropWhile (ident h_) eqs); \ |
526 \ vs_ = dropWhile (ident f_) (Vars h_); \ |
526 \ v_s = dropWhile (ident f_) (Vars h_); \ |
527 \ v_1 = hd (dropWhile (ident v_v) vs_); \ |
527 \ v_1 = hd (dropWhile (ident v_v) v_s); \ |
528 \ (s_1::bool list)=(SubProblem(Reals_,[univar,equation],[no_met])\ |
528 \ (s_1::bool list)=(SubProblem(Reals_,[univar,equation],[no_met])\ |
529 \ [BOOL e_1, REAL v_1])\ |
529 \ [BOOL e_1, REAL v_1])\ |
530 \ in Substitute [(v_1 = (rhs o hd) s_1)] h_)"; |
530 \ in Substitute [(v_1 = (rhs o hd) s_1)] h_)"; |
531 val f_ = (str2term "f_f::real", |
531 val f_ = (str2term "f_f::real", |
532 str2term "A"); |
532 str2term "A"); |
571 val s' = term2str t'; |
571 val s' = term2str t'; |
572 if s' = "[a, b]" then () else raise error "new behaviour with list_rls 2.3"; |
572 if s' = "[a, b]" then () else raise error "new behaviour with list_rls 2.3"; |
573 val env = env @ [(str2term "vs_::real list", str2term s')]; |
573 val env = env @ [(str2term "vs_::real list", str2term s')]; |
574 |
574 |
575 (*--- 4.line in script ---*) |
575 (*--- 4.line in script ---*) |
576 val t = str2term "hd (dropWhile (ident v_v) vs_)"; |
576 val t = str2term "hd (dropWhile (ident v_v) v_s)"; |
577 val s = subst_atomic env t; |
577 val s = subst_atomic env t; |
578 term2str s; |
578 term2str s; |
579 val t = str2term "hd (dropWhile (ident b) [a, b])"; |
579 val t = str2term "hd (dropWhile (ident b) [a, b])"; |
580 val SOME (t',_) = rewrite_set_ thy false list_rls t; |
580 val SOME (t',_) = rewrite_set_ thy false list_rls t; |
581 val s' = term2str t'; |
581 val s' = term2str t'; |
612 str2term |
612 str2term |
613 "Script Make_fun_by_new_variable (f_f::real) (v_v::real) \ |
613 "Script Make_fun_by_new_variable (f_f::real) (v_v::real) \ |
614 \ (eqs::bool list) = \ |
614 \ (eqs::bool list) = \ |
615 \(let h_ = (hd o (filterVar f_)) eqs; \ |
615 \(let h_ = (hd o (filterVar f_)) eqs; \ |
616 \ es_ = dropWhile (ident h_) eqs; \ |
616 \ es_ = dropWhile (ident h_) eqs; \ |
617 \ vs_ = dropWhile (ident f_) (Vars h_); \ |
617 \ v_s = dropWhile (ident f_) (Vars h_); \ |
618 \ v_1 = nth_ 1 vs_; \ |
618 \ v_1 = nth_ 1 v_s; \ |
619 \ v_2 = nth_ 2 vs_; \ |
619 \ v_2 = nth_ 2 v_s; \ |
620 \ e_1 = (hd o (filterVar v_1)) es_; \ |
620 \ e_1 = (hd o (filterVar v_1)) es_; \ |
621 \ e_2 = (hd o (filterVar v_2)) es_; \ |
621 \ e_2 = (hd o (filterVar v_2)) es_; \ |
622 \ (s_1::bool list) = (SubProblem (Reals_,[univar,equation],[no_met])\ |
622 \ (s_1::bool list) = (SubProblem (Reals_,[univar,equation],[no_met])\ |
623 \ [BOOL e_1, REAL v_1]);\ |
623 \ [BOOL e_1, REAL v_1]);\ |
624 \ (s_2::bool list) = (SubProblem (Reals_,[univar,equation],[no_met])\ |
624 \ (s_2::bool list) = (SubProblem (Reals_,[univar,equation],[no_met])\ |
667 val s' = term2str t'; |
667 val s' = term2str t'; |
668 if s' = "[a, b]" then () else raise error "new behaviour with list_rls 3.3."; |
668 if s' = "[a, b]" then () else raise error "new behaviour with list_rls 3.3."; |
669 val env = env @ [(str2term "vs_::real list", str2term s')]; |
669 val env = env @ [(str2term "vs_::real list", str2term s')]; |
670 |
670 |
671 (*--- 4.line in script ---*) |
671 (*--- 4.line in script ---*) |
672 val t = str2term "nth_ 1 vs_"; |
672 val t = str2term "nth_ 1 v_s"; |
673 val s = subst_atomic env t; |
673 val s = subst_atomic env t; |
674 term2str s; |
674 term2str s; |
675 val t = str2term "nth_ 1 [a, b]"; |
675 val t = str2term "nth_ 1 [a, b]"; |
676 val SOME (t',_) = rewrite_set_ thy false list_rls t; |
676 val SOME (t',_) = rewrite_set_ thy false list_rls t; |
677 val s' = term2str t'; |
677 val s' = term2str t'; |
678 if s' = "a" then () else raise error "new behaviour with list_rls 3.4."; |
678 if s' = "a" then () else raise error "new behaviour with list_rls 3.4."; |
679 val env = env @ [(str2term "v_1", str2term s')]; |
679 val env = env @ [(str2term "v_1", str2term s')]; |
680 |
680 |
681 (*--- 5.line in script ---*) |
681 (*--- 5.line in script ---*) |
682 val t = str2term "nth_ 2 vs_"; |
682 val t = str2term "nth_ 2 v_s"; |
683 val s = subst_atomic env t; |
683 val s = subst_atomic env t; |
684 term2str s; |
684 term2str s; |
685 val t = str2term "nth_ 2 [a, b]"; |
685 val t = str2term "nth_ 2 [a, b]"; |
686 val SOME (t',_) = rewrite_set_ thy false list_rls t; |
686 val SOME (t',_) = rewrite_set_ thy false list_rls t; |
687 val s' = term2str t'; |
687 val s' = term2str t'; |