src/Tools/isac/Knowledge/Integrate.thy
branchisac-update-Isa09-2
changeset 37996 eb7d9cbaa3ef
parent 37994 eb4c556a525b
child 38014 3e11e3c2dc42
equal deleted inserted replaced
37995:fac82f29f143 37996:eb7d9cbaa3ef
    11   Integral            :: "[real, real]=> real" ("Integral _ D _" 91)
    11   Integral            :: "[real, real]=> real" ("Integral _ D _" 91)
    12 (*new'_c	      :: "real => real"        ("new'_c _" 66)*)
    12 (*new'_c	      :: "real => real"        ("new'_c _" 66)*)
    13   is'_f'_x            :: "real => bool"        ("_ is'_f'_x" 10)
    13   is'_f'_x            :: "real => bool"        ("_ is'_f'_x" 10)
    14 
    14 
    15   (*descriptions in the related problems*)
    15   (*descriptions in the related problems*)
    16   integrateBy         :: real => una
    16   integrateBy         :: "real => una"
    17   antiDerivative      :: real => una
    17   antiDerivative      :: "real => una"
    18   antiDerivativeName  :: (real => real) => una
    18   antiDerivativeName  :: "(real => real) => una"
    19 
    19 
    20   (*the CAS-command, eg. "Integrate (2*x^^^3, x)"*)
    20   (*the CAS-command, eg. "Integrate (2*x^^^3, x)"*)
    21   Integrate           :: "[real * real] => real"
    21   Integrate           :: "[real * real] => real"
    22 
    22 
    23   (*Script-names*)
    23   (*Script-names*)
   111 calclist':= overwritel (!calclist', 
   111 calclist':= overwritel (!calclist', 
   112    [(*("new_c", ("Integrate.new'_c", eval_new_c "new_c_")),*)
   112    [(*("new_c", ("Integrate.new'_c", eval_new_c "new_c_")),*)
   113     ("add_new_c", ("Integrate.add'_new'_c", eval_add_new_c "add_new_c_")),
   113     ("add_new_c", ("Integrate.add'_new'_c", eval_add_new_c "add_new_c_")),
   114     ("is_f_x", ("Integrate.is'_f'_x", eval_is_f_x "is_f_idextifier_"))
   114     ("is_f_x", ("Integrate.is'_f'_x", eval_is_f_x "is_f_idextifier_"))
   115     ]);
   115     ]);
   116 
   116 *}
   117 
   117 ML {*
   118 (** rulesets **)
   118 (** rulesets **)
   119 
   119 
   120 (*.rulesets for integration.*)
   120 (*.rulesets for integration.*)
   121 val integration_rules = 
   121 val integration_rules = 
   122     Rls {id="integration_rules", preconds = [], 
   122     Rls {id="integration_rules", preconds = [], 
   141 		  Thm ("integral_mult",num_str @{thm integral_mult}),
   141 		  Thm ("integral_mult",num_str @{thm integral_mult}),
   142 		  Thm ("integral_pow",num_str @{thm integral_pow}),
   142 		  Thm ("integral_pow",num_str @{thm integral_pow}),
   143 		  Calc ("op +", eval_binop "#add_")(*for n+1*)
   143 		  Calc ("op +", eval_binop "#add_")(*for n+1*)
   144 		  ],
   144 		  ],
   145 	 scr = EmptyScr};
   145 	 scr = EmptyScr};
       
   146 *}
       
   147 ML {*
   146 val add_new_c = 
   148 val add_new_c = 
   147     Seq {id="add_new_c", preconds = [], 
   149     Seq {id="add_new_c", preconds = [], 
   148 	 rew_ord = ("termlessI",termlessI), 
   150 	 rew_ord = ("termlessI",termlessI), 
   149 	 erls = Rls {id="conditions_in_add_new_c", 
   151 	 erls = Rls {id="conditions_in_add_new_c", 
   150 		     preconds = [], 
   152 		     preconds = [], 
   153 		     srls = Erls, calc = [],
   155 		     srls = Erls, calc = [],
   154 		     rules = [Calc ("Tools.matches", eval_matches""),
   156 		     rules = [Calc ("Tools.matches", eval_matches""),
   155 			      Calc ("Integrate.is'_f'_x", 
   157 			      Calc ("Integrate.is'_f'_x", 
   156 				    eval_is_f_x "is_f_x_"),
   158 				    eval_is_f_x "is_f_x_"),
   157 			      Thm ("not_true",num_str @{thm not_true}),
   159 			      Thm ("not_true",num_str @{thm not_true}),
   158 			      Thm ("not_false",num_str @{thm not_false)
   160 			      Thm ("not_false",num_str @{thm not_false})
   159 			      ],
   161 			      ],
   160 		     scr = EmptyScr}, 
   162 		     scr = EmptyScr}, 
   161 	 srls = Erls, calc = [],
   163 	 srls = Erls, calc = [],
   162 	 rules = [ (*Thm ("call_for_new_c", num_str @{thm call_for_new_c}),*)
   164 	 rules = [ (*Thm ("call_for_new_c", num_str @{thm call_for_new_c}),*)
   163 		   Cal1 ("Integrate.add'_new'_c", eval_add_new_c "new_c_")
   165 		   Cal1 ("Integrate.add'_new'_c", eval_add_new_c "new_c_")
   164 		   ],
   166 		   ],
   165 	 scr = EmptyScr};
   167 	 scr = EmptyScr};
       
   168 *}
       
   169 ML {*
   166 
   170 
   167 (*.rulesets for simplifying Integrals.*)
   171 (*.rulesets for simplifying Integrals.*)
   168 
   172 
   169 (*.for simplify_Integral adapted from 'norm_Rational_rls'.*)
   173 (*.for simplify_Integral adapted from 'norm_Rational_rls'.*)
   170 val norm_Rational_rls_noadd_fractions = 
   174 val norm_Rational_rls_noadd_fractions = 
   329 	     ("separate_bdv2", separate_bdv2),
   333 	     ("separate_bdv2", separate_bdv2),
   330 	     ("norm_Rational_noadd_fractions", norm_Rational_noadd_fractions),
   334 	     ("norm_Rational_noadd_fractions", norm_Rational_noadd_fractions),
   331 	     ("norm_Rational_rls_noadd_fractions", 
   335 	     ("norm_Rational_rls_noadd_fractions", 
   332 	      norm_Rational_rls_noadd_fractions)
   336 	      norm_Rational_rls_noadd_fractions)
   333 	     ]);
   337 	     ]);
       
   338 *}
       
   339 ML {*
   334 
   340 
   335 (** problems **)
   341 (** problems **)
   336 
   342 
   337 store_pbt
   343 store_pbt
   338  (prep_pbt thy "pbl_fun_integ" [] e_pblID
   344  (prep_pbt thy "pbl_fun_integ" [] e_pblID
   339  (["integrate","function"],
   345  (["integrate","function"],
   340   [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
   346   [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
   341    ("#Find"  ,["antiDerivative F_"])
   347    ("#Find"  ,["antiDerivative F_F"])
   342   ],
   348   ],
   343   append_rls "e_rls" e_rls [(*for preds in where_*)], 
   349   append_rls "e_rls" e_rls [(*for preds in where_*)], 
   344   SOME "Integrate (f_f, v_v)", 
   350   SOME "Integrate (f_f, v_v)", 
   345   [["diff","integration"]]));
   351   [["diff","integration"]]));
   346  
   352  
   347 (*here "named" is used differently from Differentiation"*)
   353 (*here "named" is used differently from Differentiation"*)
   348 store_pbt
   354 store_pbt
   349  (prep_pbt thy "pbl_fun_integ_nam" [] e_pblID
   355  (prep_pbt thy "pbl_fun_integ_nam" [] e_pblID
   350  (["named","integrate","function"],
   356  (["named","integrate","function"],
   351   [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
   357   [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
   352    ("#Find"  ,["antiDerivativeName F_"])
   358    ("#Find"  ,["antiDerivativeName F_F"])
   353   ],
   359   ],
   354   append_rls "e_rls" e_rls [(*for preds in where_*)], 
   360   append_rls "e_rls" e_rls [(*for preds in where_*)], 
   355   SOME "Integrate (f_f, v_v)", 
   361   SOME "Integrate (f_f, v_v)", 
   356   [["diff","integration","named"]]));
   362   [["diff","integration","named"]]));
   357  
   363  
       
   364 *}
       
   365 ML {*
   358 (** methods **)
   366 (** methods **)
   359 
   367 
   360 store_met
   368 store_met
   361     (prep_met thy "met_diffint" [] e_metID
   369     (prep_met thy "met_diffint" [] e_metID
   362 	      (["diff","integration"],
   370 	      (["diff","integration"],
   363 	       [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
   371 	       [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
   364 		("#Find"  ,["antiDerivative F_"])
   372 		("#Find"  ,["antiDerivative F_F"])
   365 		],
   373 		],
   366 	       {rew_ord'="tless_true", rls'=Atools_erls, calc = [], 
   374 	       {rew_ord'="tless_true", rls'=Atools_erls, calc = [], 
   367 		srls = e_rls, 
   375 		srls = e_rls, 
   368 		prls=e_rls,
   376 		prls=e_rls,
   369 	     crls = Atools_erls, nrls = e_rls},
   377 	     crls = Atools_erls, nrls = e_rls},
   370 "Script IntegrationScript (f_f::real) (v_v::real) =                " ^
   378 "Script IntegrationScript (f_f::real) (v_v::real) =                " ^
   371 "  (let t_ = Take (Integral f_ D v_v)                             " ^
   379 "  (let t_t = Take (Integral f_f D v_v)                             " ^
   372 "   in (Rewrite_Set_Inst [(bdv,v_v)] integration False) (t_::real))"
   380 "   in (Rewrite_Set_Inst [(bdv,v_v)] integration False) (t_t::real))"
   373 ));
   381 ));
   374     
   382   *}
       
   383 ML {*
       
   384 
   375 store_met
   385 store_met
   376     (prep_met thy "met_diffint_named" [] e_metID
   386     (prep_met thy "met_diffint_named" [] e_metID
   377 	      (["diff","integration","named"],
   387 	      (["diff","integration","named"],
   378 	       [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
   388 	       [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
   379 		("#Find"  ,["antiDerivativeName F_"])
   389 		("#Find"  ,["antiDerivativeName F_F"])
   380 		],
   390 		],
   381 	       {rew_ord'="tless_true", rls'=Atools_erls, calc = [], 
   391 	       {rew_ord'="tless_true", rls'=Atools_erls, calc = [], 
   382 		srls = e_rls, 
   392 		srls = e_rls, 
   383 		prls=e_rls,
   393 		prls=e_rls,
   384 		crls = Atools_erls, nrls = e_rls},
   394 		crls = Atools_erls, nrls = e_rls},
   385 "Script NamedIntegrationScript (f_f::real) (v_v::real) (F_::real=>real) = " ^
   395 "Script NamedIntegrationScript (f_f::real) (v_v::real) (F_F::real=>real) = " ^
   386 "  (let t_ = Take (F_ v_v = Integral f_ D v_v)                            " ^
   396 "  (let t_t = Take (F_F v_v = Integral f_f D v_v)                            " ^
   387 "   in ((Try (Rewrite_Set_Inst [(bdv,v_v)] simplify_Integral False)) @@  " ^
   397 "   in ((Try (Rewrite_Set_Inst [(bdv,v_v)] simplify_Integral False)) @@  " ^
   388 "       (Rewrite_Set_Inst [(bdv,v_v)] integration False)) t_)            "
   398 "       (Rewrite_Set_Inst [(bdv,v_v)] integration False)) t_t)            "
   389     ));
   399     ));
   390 *}
   400 *}
   391 
   401 
   392 end
   402 end