test/Tools/isac/Knowledge/diff.sml
branchisac-update-Isa09-2
changeset 37991 028442673981
parent 37981 b2877b9d455a
child 37994 eb4c556a525b
equal deleted inserted replaced
37990:24609758d219 37991:028442673981
    84     
    84     
    85 "----------- for correction of diff_const ------------------------";
    85 "----------- for correction of diff_const ------------------------";
    86 "----------- for correction of diff_const ------------------------";
    86 "----------- for correction of diff_const ------------------------";
    87 "----------- for correction of diff_const ------------------------";
    87 "----------- for correction of diff_const ------------------------";
    88 (*re-evaluate this file, otherwise > *** ME_Isa: 'erls' not known*)
    88 (*re-evaluate this file, otherwise > *** ME_Isa: 'erls' not known*)
    89 val thy' = "Diff.thy";
    89 val thy' = "Diff";
    90 val ct = "Not (x =!= a)";
    90 val ct = "Not (x =!= a)";
    91 rewrite_set thy' false "erls" ct;
    91 rewrite_set thy' false "erls" ct;
    92 val ct = "2 is_const";
    92 val ct = "2 is_const";
    93 rewrite_set thy' false "erls" ct;
    93 rewrite_set thy' false "erls" ct;
    94 
    94 
   125 
   125 
   126 
   126 
   127 " _________________ for correction of diff_quot  _________________ ";
   127 " _________________ for correction of diff_quot  _________________ ";
   128 " _________________ for correction of diff_quot  _________________ ";
   128 " _________________ for correction of diff_quot  _________________ ";
   129 " _________________ for correction of diff_quot  _________________ ";
   129 " _________________ for correction of diff_quot  _________________ ";
   130 val thy' = "Diff.thy";
   130 val thy' = "Diff";
   131 val ct = "Not (x = 0)";
   131 val ct = "Not (x = 0)";
   132 rewrite_set thy' false "erls" ct;
   132 rewrite_set thy' false "erls" ct;
   133 
   133 
   134 val ct = "d_d x ((x+1) / (x - 1))";
   134 val ct = "d_d x ((x+1) / (x - 1))";
   135 val thm = ("diff_quot","");
   135 val thm = ("diff_quot","");
   143 
   143 
   144 
   144 
   145 " _________________ differentiate by rewrite _________________ ";
   145 " _________________ differentiate by rewrite _________________ ";
   146 " _________________ differentiate by rewrite _________________ ";
   146 " _________________ differentiate by rewrite _________________ ";
   147 " _________________ differentiate by rewrite _________________ ";
   147 " _________________ differentiate by rewrite _________________ ";
   148 val thy' = "Diff.thy";
   148 val thy' = "Diff";
   149 val ct = "d_d x (x ^^^ 2 + 3 * x + 4)";
   149 val ct = "d_d x (x ^^^ 2 + 3 * x + 4)";
   150 "--- 1 ---";
   150 "--- 1 ---";
   151 val thm = ("diff_sum","");
   151 val thm = ("diff_sum","");
   152 val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true 
   152 val (ct,_) = the (rewrite_inst thy' "tless_true" "erls" true 
   153 		  [("bdv","x::real")] thm ct);
   153 		  [("bdv","x::real")] thm ct);
   195 " ______________ differentiate: me (*+ tacs input*) ______________ ";
   195 " ______________ differentiate: me (*+ tacs input*) ______________ ";
   196 " ______________ differentiate: me (*+ tacs input*) ______________ ";
   196 " ______________ differentiate: me (*+ tacs input*) ______________ ";
   197 val fmz = ["functionTerm (x ^^^ 2 + 3 * x + 4)", 
   197 val fmz = ["functionTerm (x ^^^ 2 + 3 * x + 4)", 
   198 	   "differentiateFor x","derivative f_'_"];
   198 	   "differentiateFor x","derivative f_'_"];
   199 val (dI',pI',mI') =
   199 val (dI',pI',mI') =
   200   ("Diff.thy",["derivative_of","function"],
   200   ("Diff",["derivative_of","function"],
   201    ["diff","diff_simpl"]);
   201    ["diff","diff_simpl"]);
   202 val p = e_pos'; val c = []; 
   202 val p = e_pos'; val c = []; 
   203 "--- s1 ---";
   203 "--- s1 ---";
   204 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   204 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   205 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   205 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   256  val (_,_,f,_,_,_) = me nxt p c pt;
   256  val (_,_,f,_,_,_) = me nxt p c pt;
   257  val Form' (FormKF (_,_,_,_,res)) = f;
   257  val Form' (FormKF (_,_,_,_,res)) = f;
   258  trace_rewrite:=false;
   258  trace_rewrite:=false;
   259 
   259 
   260  val ct = "2 * x ^^^ (2 - 1) + 3 * 1 + 0";
   260  val ct = "2 * x ^^^ (2 - 1) + 3 * 1 + 0";
   261  val SOME (ct',_) = rewrite_set "Isac.thy" false "make_polynomial" ct;
   261  val SOME (ct',_) = rewrite_set "Isac" false "make_polynomial" ct;
   262 
   262 
   263  trace_rewrite:=true;
   263  trace_rewrite:=true;
   264  val t = str2term ct; 
   264  val t = str2term ct; 
   265  term2str t;
   265  term2str t;
   266  val SOME (t',_) = rewrite_set_ Isac.thy false make_polynomial t;
   266  val SOME (t',_) = rewrite_set_ Isac.thy false make_polynomial t;
   272  
   272  
   273  val thm = num_str @{thm realpow_eq_oneI;
   273  val thm = num_str @{thm realpow_eq_oneI;
   274  case string_of_thm thm of
   274  case string_of_thm thm of
   275 
   275 
   276 
   276 
   277  val Rewrite_Set' ("Diff.thy",false,"make_polynomial",ff,(ff',[])) = m;
   277  val Rewrite_Set' ("Diff",false,"make_polynomial",ff,(ff',[])) = m;
   278  term2str ff; term2str ff';
   278  term2str ff; term2str ff';
   279 
   279 
   280 
   280 
   281 
   281 
   282 --------------------------------11.3.03--------------------*)
   282 --------------------------------11.3.03--------------------*)
   283 
   283 
   284 (*val nxt = ("Rewrite_Set",Rewrite_Set "make_polynomial");*)
   284 (*val nxt = ("Rewrite_Set",Rewrite_Set "make_polynomial");*)
   285 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   285 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   286 "--- 8 ---";
   286 "--- 8 ---";
   287 (*val nxt =
   287 (*val nxt =
   288 ("Check_Postcond",Check_Postcond ("Diff.thy","differentiate_on_R"));*)
   288 ("Check_Postcond",Check_Postcond ("Diff","differentiate_on_R"));*)
   289 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   289 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   290 "--- 9 ---";
   290 "--- 9 ---";
   291 (*val nxt = ("End_Proof'",End_Proof');*)
   291 (*val nxt = ("End_Proof'",End_Proof');*)
   292 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
   292 val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f;
   293 if nxt = ("End_Proof'",End_Proof') andalso f2str f = "3 + 2 * x" then ()
   293 if nxt = ("End_Proof'",End_Proof') andalso f2str f = "3 + 2 * x" then ()
   301 (*---------------- 1.5.02 -----------------------------------------
   301 (*---------------- 1.5.02 -----------------------------------------
   302 
   302 
   303 " _________________ script-eval corrected _________________ ";
   303 " _________________ script-eval corrected _________________ ";
   304 " _________________ script-eval corrected _________________ ";
   304 " _________________ script-eval corrected _________________ ";
   305 " _________________ script-eval corrected _________________ ";
   305 " _________________ script-eval corrected _________________ ";
   306 val scr = Script (((inst_abs (assoc_thy "Test.thy")) o 
   306 val scr = Script (((inst_abs (assoc_thy "Test")) o 
   307 	   term_of o the o (parse Diff.thy))
   307 	   term_of o the o (parse Diff.thy))
   308   "Script Differentiate (f_::real) (v_::real) =                                 \
   308   "Script Differentiate (f_::real) (v_v::real) =                                 \
   309    \(let f_ = Try (Repeat (Rewrite frac_conv False f_));                        \
   309    \(let f_ = Try (Repeat (Rewrite frac_conv False f_));                        \
   310    \     f_ = Try (Repeat (Rewrite root_conv False f_));                        \
   310    \     f_ = Try (Repeat (Rewrite root_conv False f_));                        \
   311    \     f_ = Repeat                                                            \
   311    \     f_ = Repeat                                                            \
   312    \            ((Repeat (Rewrite_Inst [(bdv,v_)] diff_sum        False f_)) Or \
   312    \            ((Repeat (Rewrite_Inst [(bdv,v_v)] diff_sum        False f_)) Or \
   313    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod_const False f_)) Or \
   313    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_prod_const False f_)) Or \
   314    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod       False f_)) Or \
   314    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_prod       False f_)) Or \
   315    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_quot       False f_)) Or \
   315    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_quot       False f_)) Or \
   316    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin        False f_)) Or \
   316    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_sin        False f_)) Or \
   317    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin_chain  False f_)) Or \
   317    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_sin_chain  False f_)) Or \
   318    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos        False f_)) Or \
   318    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_cos        False f_)) Or \
   319    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos_chain  False f_)) Or \
   319    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_cos_chain  False f_)) Or \
   320    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow        False f_)) Or \
   320    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_pow        False f_)) Or \
   321    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow_chain  False f_)) Or \
   321    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_pow_chain  False f_)) Or \
   322    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln         False f_)) Or \
   322    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_ln         False f_)) Or \
   323    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln_chain   False f_)) Or \
   323    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_ln_chain   False f_)) Or \
   324    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp        False f_)) Or \
   324    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_exp        False f_)) Or \
   325    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp_chain  False f_)) Or \
   325    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_exp_chain  False f_)) Or \
   326    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_const      False f_)) Or \
   326    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_const      False f_)) Or \
   327    \             (Repeat (Rewrite_Inst [(bdv,v_)] diff_var        False f_)) Or \
   327    \             (Repeat (Rewrite_Inst [(bdv,v_v)] diff_var        False f_)) Or \
   328    \             (Repeat (Rewrite_Set             Test_simplify False f_)));  \
   328    \             (Repeat (Rewrite_Set             Test_simplify False f_)));  \
   329    \     f_ = Try (Repeat (Rewrite sym_frac_conv False f_))                     \
   329    \     f_ = Try (Repeat (Rewrite sym_frac_conv False f_))                     \
   330    \ in       Try (Repeat (Rewrite sym_root_conv False f_)))");
   330    \ in       Try (Repeat (Rewrite sym_root_conv False f_)))");
   331 val d = e_rls;
   331 val d = e_rls;
   332 val (dI',pI',mI') =
   332 val (dI',pI',mI') =
   333   ("Diff.thy",e_pblID,
   333   ("Diff",e_pblID,
   334    ("Diff.thy","differentiate_on_R"));
   334    ("Diff","differentiate_on_R"));
   335 val p = e_pos'; val c = []; 
   335 val p = e_pos'; val c = []; 
   336 val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
   336 val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
   337 val (p,_,_,_,_,pt) = me (mI,m) p c  EmptyPtree;
   337 val (p,_,_,_,_,pt) = me (mI,m) p c  EmptyPtree;
   338 val nxt = ("Specify_Theory",Specify_Theory dI');
   338 val nxt = ("Specify_Theory",Specify_Theory dI');
   339 val (p,_,_,_,_,pt) = me nxt p c pt;
   339 val (p,_,_,_,_,pt) = me nxt p c pt;
   350 val l0 = [];
   350 val l0 = [];
   351 " --------------- 1. ---------------------------------------------";
   351 " --------------- 1. ---------------------------------------------";
   352 val (pt,_) = cappend_atomic pt[1]e_loc ct (Rewrite("test","")) ct Complete;
   352 val (pt,_) = cappend_atomic pt[1]e_loc ct (Rewrite("test","")) ct Complete;
   353 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_sum","")));
   353 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_sum","")));
   354 
   354 
   355 val NextStep(l1,m') = nxt_tac "Diff.thy" (pt,p) scr ets0 l0;
   355 val NextStep(l1,m') = nxt_tac "Diff" (pt,p) scr ets0 l0;
   356 (*("diff_sum","")*)
   356 (*("diff_sum","")*)
   357 val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets1)] = 
   357 val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets1)] = 
   358   locate_gen "Diff.thy" m' (pt,p) (scr,d) ets0 l0;
   358   locate_gen "Diff" m' (pt,p) (scr,d) ets0 l0;
   359 val ets1 = (drop_last ets0) @ ets1;val pt = update_ets pt [] [(1,ets1)];
   359 val ets1 = (drop_last ets0) @ ets1;val pt = update_ets pt [] [(1,ets1)];
   360 " --------------- 2. ---------------------------------------------";
   360 " --------------- 2. ---------------------------------------------";
   361 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_sum","")));
   361 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_sum","")));
   362 val NextStep(l2,m') = nxt_tac "Diff.thy" (pt,p) scr ets1 l1;
   362 val NextStep(l2,m') = nxt_tac "Diff" (pt,p) scr ets1 l1;
   363 (*("diff_sum","")*)
   363 (*("diff_sum","")*)
   364 val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] = 
   364 val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] = 
   365   locate_gen "Diff.thy" m' (pt,p) (scr,d) ets1 l1;
   365   locate_gen "Diff" m' (pt,p) (scr,d) ets1 l1;
   366 val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
   366 val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
   367 " --------------- 3. ---------------------------------------------";
   367 " --------------- 3. ---------------------------------------------";
   368 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_prod_const","")));
   368 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_prod_const","")));
   369 val NextStep(l3,m') = nxt_tac "Diff.thy" (pt,p) scr ets2 l2;
   369 val NextStep(l3,m') = nxt_tac "Diff" (pt,p) scr ets2 l2;
   370 (*("diff_prod_const","")*)
   370 (*("diff_prod_const","")*)
   371 val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets3)] = 
   371 val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets3)] = 
   372   locate_gen "Diff.thy" m' (pt,p) (scr,d) ets2 l2;
   372   locate_gen "Diff" m' (pt,p) (scr,d) ets2 l2;
   373 val ets3 = (drop_last ets2) @ ets3; val pt = update_ets pt [] [(1,ets3)];
   373 val ets3 = (drop_last ets2) @ ets3; val pt = update_ets pt [] [(1,ets3)];
   374 " --------------- 4. ---------------------------------------------";
   374 " --------------- 4. ---------------------------------------------";
   375 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_pow","")));
   375 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_pow","")));
   376 val NextStep(l4,m') = nxt_tac "Diff.thy" (pt,p) scr ets3 l3;
   376 val NextStep(l4,m') = nxt_tac "Diff" (pt,p) scr ets3 l3;
   377 (*("diff_pow","")*)
   377 (*("diff_pow","")*)
   378 val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets4)] = 
   378 val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets4)] = 
   379     locate_gen "Diff.thy" m' (pt,p) (scr,d) ets3 l3;
   379     locate_gen "Diff" m' (pt,p) (scr,d) ets3 l3;
   380 val ets4 = (drop_last ets3) @ ets4; val pt = update_ets pt [] [(1,ets4)];
   380 val ets4 = (drop_last ets3) @ ets4; val pt = update_ets pt [] [(1,ets4)];
   381 " --------------- 5. ---------------------------------------------";
   381 " --------------- 5. ---------------------------------------------";
   382 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_const","")));
   382 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_const","")));
   383 val NextStep(l5,m') = nxt_tac "Diff.thy" (pt,p) scr ets4 l4;
   383 val NextStep(l5,m') = nxt_tac "Diff" (pt,p) scr ets4 l4;
   384 (*("diff_const","")*)
   384 (*("diff_const","")*)
   385 val Steps[ (Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets5)] = 
   385 val Steps[ (Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets5)] = 
   386     locate_gen "Diff.thy" m' (pt,p) (scr,d) ets4 l4;
   386     locate_gen "Diff" m' (pt,p) (scr,d) ets4 l4;
   387 val ets5 = (drop_last ets4) @ ets5; val pt = update_ets pt [] [(1,ets5)];
   387 val ets5 = (drop_last ets4) @ ets5; val pt = update_ets pt [] [(1,ets5)];
   388 " --------------- 6. ---------------------------------------------";
   388 " --------------- 6. ---------------------------------------------";
   389 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_var","")));
   389 val Appl m'=applicable_in p pt (Rewrite_Inst (["(bdv,x)"],("diff_var","")));
   390 val NextStep(l6,m') = nxt_tac "Diff.thy" (pt,p) scr ets5 l5;
   390 val NextStep(l6,m') = nxt_tac "Diff" (pt,p) scr ets5 l5;
   391 (*("diff_var","")ok; here was("diff_const","")because of wrong rule in *.thy*)
   391 (*("diff_var","")ok; here was("diff_const","")because of wrong rule in *.thy*)
   392 val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets6)] = 
   392 val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets6)] = 
   393     locate_gen "Diff.thy" m' (pt,p) (scr,d) ets5 l5;
   393     locate_gen "Diff" m' (pt,p) (scr,d) ets5 l5;
   394 val ets6 = (drop_last ets5) @ ets6; val pt = update_ets pt [] [(1,ets6)];
   394 val ets6 = (drop_last ets5) @ ets6; val pt = update_ets pt [] [(1,ets6)];
   395 " --------------- 7. ---------------------------------------------";
   395 " --------------- 7. ---------------------------------------------";
   396 val Appl m'=applicable_in p pt (Rewrite_Set "Test_simplify");
   396 val Appl m'=applicable_in p pt (Rewrite_Set "Test_simplify");
   397 
   397 
   398 
   398 
   410 set_dstate 1 test_hide 4 1;(*SelRule,St..PutRuleRes,TskipS..*)
   410 set_dstate 1 test_hide 4 1;(*SelRule,St..PutRuleRes,TskipS..*)
   411 StdinSML 1 0 0 0 New_Proof;
   411 StdinSML 1 0 0 0 New_Proof;
   412 val fmz = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))", 
   412 val fmz = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))", 
   413 	   "differentiateFor x","derivative f_'_"];
   413 	   "differentiateFor x","derivative f_'_"];
   414 val (dI',pI',mI') =
   414 val (dI',pI',mI') =
   415   ("Diff.thy",["derivative_of","function"],
   415   ("Diff",["derivative_of","function"],
   416    ["diff","differentiate_on_R"]);
   416    ["diff","differentiate_on_R"]);
   417 *)
   417 *)
   418 
   418 
   419 
   419 
   420 " _________________ differentiate stdin: tutor active_________________ ";
   420 " _________________ differentiate stdin: tutor active_________________ ";
   425 set_dstate 1 test_hide 0 2;(*PutRule,TskipS..PutRuleRes,Tt..*)
   425 set_dstate 1 test_hide 0 2;(*PutRule,TskipS..PutRuleRes,Tt..*)
   426 StdinSML 1 0 0 0 New_Proof;
   426 StdinSML 1 0 0 0 New_Proof;
   427 val fmz = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))", 
   427 val fmz = ["functionTerm (d_d x (x ^^^ 2 + 3 * x + 4))", 
   428 	   "differentiateFor x","derivative f_'_"];
   428 	   "differentiateFor x","derivative f_'_"];
   429 val (dI',pI',mI') =
   429 val (dI',pI',mI') =
   430   ("Diff.thy",["derivative_of","function"],
   430   ("Diff",["derivative_of","function"],
   431    ["diff","differentiate_on_R"]);
   431    ["diff","differentiate_on_R"]);
   432 *)
   432 *)
   433 
   433 
   434 
   434 
   435 "---------------------1.5.02 me from script ---------------------";
   435 "---------------------1.5.02 me from script ---------------------";
   437 "---------------------1.5.02 me from script ---------------------";
   437 "---------------------1.5.02 me from script ---------------------";
   438 (*exp_Diff_No-1.xml*)
   438 (*exp_Diff_No-1.xml*)
   439 val fmz = ["functionTerm (x ^^^ 2 + 3 * x + 4)", 
   439 val fmz = ["functionTerm (x ^^^ 2 + 3 * x + 4)", 
   440 	   "differentiateFor x","derivative f_'_"];
   440 	   "differentiateFor x","derivative f_'_"];
   441 val (dI',pI',mI') =
   441 val (dI',pI',mI') =
   442   ("Diff.thy",["derivative_of","function"],
   442   ("Diff",["derivative_of","function"],
   443    ["diff","diff_simpl"]);
   443    ["diff","diff_simpl"]);
   444 (*val p = e_pos'; val c = []; 
   444 (*val p = e_pos'; val c = []; 
   445 val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
   445 val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
   446 val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
   446 val (p,_,f,nxt,_,pt) = me (mI,m) p c EmptyPtree;*)
   447 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   447 val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   450 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   450 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   451 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   451 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   452 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   452 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   453 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   453 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   454 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   454 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   455 (*nxt = ("Apply_Method",Apply_Method ("Diff.thy","differentiate_on_R*)
   455 (*nxt = ("Apply_Method",Apply_Method ("Diff","differentiate_on_R*)
   456 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   456 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   457 
   457 
   458 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   458 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   459 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   459 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   460 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   460 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   484 val SOME (f'_,_) = rewrite_set_ Isac.thy false srls_diff screxp1; 
   484 val SOME (f'_,_) = rewrite_set_ Isac.thy false srls_diff screxp1; 
   485 if term2str f'_= "Take (A' = d_d s (s * (a - s)))" then ()
   485 if term2str f'_= "Take (A' = d_d s (s * (a - s)))" then ()
   486 else raise error "diff.sml: diff.behav. in 'primed'";
   486 else raise error "diff.sml: diff.behav. in 'primed'";
   487 atomty f'_;
   487 atomty f'_;
   488 
   488 
   489 val str = "Script DiffEqScr (f_::bool) (v_::real) =                         \
   489 val str = "Script DiffEqScr (f_::bool) (v_v::real) =                         \
   490 \ (let f'_ = Take ((primed (lhs f_)) = d_d v_v (rhs f_))           \
   490 \ (let f'_ = Take ((primed (lhs f_)) = d_d v_v (rhs f_))           \
   491 \ in (((Try (Repeat (Rewrite frac_conv   False))) @@              \
   491 \ in (((Try (Repeat (Rewrite frac_conv   False))) @@              \
   492  \ (Try (Repeat (Rewrite root_conv   False))) @@                  \
   492  \ (Try (Repeat (Rewrite root_conv   False))) @@                  \
   493  \ (Try (Repeat (Rewrite realpow_pow False))) @@                  \
   493  \ (Try (Repeat (Rewrite realpow_pow False))) @@                  \
   494  \ (Repeat                                                        \
   494  \ (Repeat                                                        \
   495  \   ((Repeat (Rewrite_Inst [(bdv,v_)] diff_sum        False)) Or \
   495  \   ((Repeat (Rewrite_Inst [(bdv,v_v)] diff_sum        False)) Or \
   496  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod_const False)) Or \
   496  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_prod_const False)) Or \
   497  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_prod       False)) Or \
   497  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_prod       False)) Or \
   498  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_quot       True )) Or \
   498  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_quot       True )) Or \
   499  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin        False)) Or \
   499  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_sin        False)) Or \
   500  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_sin_chain  False)) Or \
   500  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_sin_chain  False)) Or \
   501  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos        False)) Or \
   501  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_cos        False)) Or \
   502  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_cos_chain  False)) Or \
   502  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_cos_chain  False)) Or \
   503  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow        False)) Or \
   503  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_pow        False)) Or \
   504  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_pow_chain  False)) Or \
   504  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_pow_chain  False)) Or \
   505  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln         False)) Or \
   505  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_ln         False)) Or \
   506  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_ln_chain   False)) Or \
   506  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_ln_chain   False)) Or \
   507  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp        False)) Or \
   507  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_exp        False)) Or \
   508  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_exp_chain  False)) Or \
   508  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_exp_chain  False)) Or \
   509  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_sqrt       False)) Or \
   509  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_sqrt       False)) Or \
   510  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_sqrt_chain False)) Or \
   510  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_sqrt_chain False)) Or \
   511  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_const      False)) Or \
   511  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_const      False)) Or \
   512  \    (Repeat (Rewrite_Inst [(bdv,v_)] diff_var        False)) Or \
   512  \    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_var        False)) Or \
   513  \    (Repeat (Rewrite_Set             make_polynomial False)))) @@ \
   513  \    (Repeat (Rewrite_Set             make_polynomial False)))) @@ \
   514  \ (Try (Repeat (Rewrite sym_frac_conv False))) @@              \
   514  \ (Try (Repeat (Rewrite sym_frac_conv False))) @@              \
   515  \ (Try (Repeat (Rewrite sym_root_conv False))))) f'_)"
   515  \ (Try (Repeat (Rewrite sym_root_conv False))))) f'_)"
   516 ;
   516 ;
   517 val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
   517 val sc = ((inst_abs thy) o term_of o the o (parse thy)) str;
   566 states:=[];
   566 states:=[];
   567 CalcTree
   567 CalcTree
   568 [(["functionTerm (x^2 + x+ 1/x + 2/x^2)",
   568 [(["functionTerm (x^2 + x+ 1/x + 2/x^2)",
   569    (*"functionTerm ((x^3)^5)",*)
   569    (*"functionTerm ((x^3)^5)",*)
   570    "differentiateFor x", "derivative f_'_"], 
   570    "differentiateFor x", "derivative f_'_"], 
   571   ("Isac.thy", ["derivative_of","function"],
   571   ("Isac", ["derivative_of","function"],
   572   ["diff","differentiate_on_R"]))];
   572   ["diff","differentiate_on_R"]))];
   573 Iterator 1;
   573 Iterator 1;
   574 moveActiveRoot 1;
   574 moveActiveRoot 1;
   575 autoCalculate 1 CompleteCalc;
   575 autoCalculate 1 CompleteCalc;
   576 val ((pt,p),_) = get_calc 1; show_pt pt;
   576 val ((pt,p),_) = get_calc 1; show_pt pt;
   581 "-----------------------------------------------------------------";
   581 "-----------------------------------------------------------------";
   582 states:=[];
   582 states:=[];
   583 CalcTree
   583 CalcTree
   584 [(["functionTerm (x^3 * x^5)",
   584 [(["functionTerm (x^3 * x^5)",
   585    "differentiateFor x", "derivative f_'_"], 
   585    "differentiateFor x", "derivative f_'_"], 
   586   ("Isac.thy", ["derivative_of","function"],
   586   ("Isac", ["derivative_of","function"],
   587   ["diff","differentiate_on_R"]))];
   587   ["diff","differentiate_on_R"]))];
   588 Iterator 1;
   588 Iterator 1;
   589 moveActiveRoot 1;
   589 moveActiveRoot 1;
   590 (* trace_rewrite := true;
   590 (* trace_rewrite := true;
   591    trace_script := true;
   591    trace_script := true;
   606 "----------- autoCalculate diff after_simplification -------------";
   606 "----------- autoCalculate diff after_simplification -------------";
   607 states:=[];
   607 states:=[];
   608 CalcTree
   608 CalcTree
   609 [(["functionTerm (x^3 * x^5)",
   609 [(["functionTerm (x^3 * x^5)",
   610    "differentiateFor x", "derivative f_'_"], 
   610    "differentiateFor x", "derivative f_'_"], 
   611   ("Isac.thy", ["derivative_of","function"],
   611   ("Isac", ["derivative_of","function"],
   612   ["diff","after_simplification"]))];
   612   ["diff","after_simplification"]))];
   613 Iterator 1;
   613 Iterator 1;
   614 moveActiveRoot 1;
   614 moveActiveRoot 1;
   615 (* trace_rewrite := true;
   615 (* trace_rewrite := true;
   616    trace_script := true;
   616    trace_script := true;
   626 "-----------------------------------------------------------------";
   626 "-----------------------------------------------------------------";
   627 states:=[];
   627 states:=[];
   628 CalcTree
   628 CalcTree
   629 [(["functionTerm ((x^3)^5)",
   629 [(["functionTerm ((x^3)^5)",
   630    "differentiateFor x", "derivative f_'_"], 
   630    "differentiateFor x", "derivative f_'_"], 
   631   ("Isac.thy", ["derivative_of","function"],
   631   ("Isac", ["derivative_of","function"],
   632   ["diff","after_simplification"]))];
   632   ["diff","after_simplification"]))];
   633 Iterator 1;
   633 Iterator 1;
   634 moveActiveRoot 1;
   634 moveActiveRoot 1;
   635 autoCalculate 1 CompleteCalc;
   635 autoCalculate 1 CompleteCalc;
   636 val ((pt,p),_) = get_calc 1; show_pt pt;
   636 val ((pt,p),_) = get_calc 1; show_pt pt;
   643 "----------- autoCalculate differentiate_equality ----------------";
   643 "----------- autoCalculate differentiate_equality ----------------";
   644 "----------- autoCalculate differentiate_equality ----------------";
   644 "----------- autoCalculate differentiate_equality ----------------";
   645 states:=[];
   645 states:=[];
   646 CalcTree
   646 CalcTree
   647 [(["functionEq (A = s * (a - s))", "differentiateFor s", "derivativeEq f_'_"], 
   647 [(["functionEq (A = s * (a - s))", "differentiateFor s", "derivativeEq f_'_"], 
   648   ("Isac.thy", ["named","derivative_of","function"],
   648   ("Isac", ["named","derivative_of","function"],
   649   ["diff","differentiate_equality"]))];
   649   ["diff","differentiate_equality"]))];
   650 Iterator 1;
   650 Iterator 1;
   651 moveActiveRoot 1;
   651 moveActiveRoot 1;
   652 autoCalculate 1 CompleteCalc;
   652 autoCalculate 1 CompleteCalc;
   653 val ((pt,p),_) = get_calc 1; show_pt pt;
   653 val ((pt,p),_) = get_calc 1; show_pt pt;
   675 "------------inform for x^2+x+1 ----------------------------------";
   675 "------------inform for x^2+x+1 ----------------------------------";
   676 states:=[];
   676 states:=[];
   677 CalcTree
   677 CalcTree
   678 [(["functionTerm (x^2 + x + 1)",
   678 [(["functionTerm (x^2 + x + 1)",
   679    "differentiateFor x", "derivative f_'_"], 
   679    "differentiateFor x", "derivative f_'_"], 
   680   ("Isac.thy", ["derivative_of","function"],
   680   ("Isac", ["derivative_of","function"],
   681   ["diff","differentiate_on_R"]))];
   681   ["diff","differentiate_on_R"]))];
   682 Iterator 1;
   682 Iterator 1;
   683 moveActiveRoot 1;
   683 moveActiveRoot 1;
   684 autoCalculate 1 CompleteCalcHead;
   684 autoCalculate 1 CompleteCalcHead;
   685 autoCalculate 1 (Step 1);
   685 autoCalculate 1 (Step 1);