changeset 59852 | ea7e6679080e |
parent 59851 | 4dd533681fef |
child 59857 | cbb3fae0381d |
59851:4dd533681fef | 59852:ea7e6679080e |
---|---|
358 |
358 |
359 section \<open>rulesets\<close> |
359 section \<open>rulesets\<close> |
360 ML \<open> |
360 ML \<open> |
361 val testerls = |
361 val testerls = |
362 Rule_Def.Repeat {id = "testerls", preconds = [], rew_ord = ("termlessI",termlessI), |
362 Rule_Def.Repeat {id = "testerls", preconds = [], rew_ord = ("termlessI",termlessI), |
363 erls = Rule_Set.e_rls, srls = Rule_Set.Empty, |
363 erls = Rule_Set.empty, srls = Rule_Set.Empty, |
364 calc = [], errpatts = [], |
364 calc = [], errpatts = [], |
365 rules = [Rule.Thm ("refl",TermC.num_str @{thm refl}), |
365 rules = [Rule.Thm ("refl",TermC.num_str @{thm refl}), |
366 Rule.Thm ("order_refl",TermC.num_str @{thm order_refl}), |
366 Rule.Thm ("order_refl",TermC.num_str @{thm order_refl}), |
367 Rule.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), |
367 Rule.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), |
368 Rule.Thm ("not_true",TermC.num_str @{thm not_true}), |
368 Rule.Thm ("not_true",TermC.num_str @{thm not_true}), |
392 (*.for evaluation of conditions in rewrite rules.*) |
392 (*.for evaluation of conditions in rewrite rules.*) |
393 (*FIXXXXXXME 10.8.02: handle like _simplify*) |
393 (*FIXXXXXXME 10.8.02: handle like _simplify*) |
394 val tval_rls = |
394 val tval_rls = |
395 Rule_Def.Repeat{id = "tval_rls", preconds = [], |
395 Rule_Def.Repeat{id = "tval_rls", preconds = [], |
396 rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), |
396 rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), |
397 erls=testerls,srls = Rule_Set.e_rls, |
397 erls=testerls,srls = Rule_Set.empty, |
398 calc=[], errpatts = [], |
398 calc=[], errpatts = [], |
399 rules = [Rule.Thm ("refl",TermC.num_str @{thm refl}), |
399 rules = [Rule.Thm ("refl",TermC.num_str @{thm refl}), |
400 Rule.Thm ("order_refl",TermC.num_str @{thm order_refl}), |
400 Rule.Thm ("order_refl",TermC.num_str @{thm order_refl}), |
401 Rule.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), |
401 Rule.Thm ("radd_left_cancel_le",TermC.num_str @{thm radd_left_cancel_le}), |
402 Rule.Thm ("not_true",TermC.num_str @{thm not_true}), |
402 Rule.Thm ("not_true",TermC.num_str @{thm not_true}), |
438 ML \<open> |
438 ML \<open> |
439 (*make () dissappear*) |
439 (*make () dissappear*) |
440 val rearrange_assoc = |
440 val rearrange_assoc = |
441 Rule_Def.Repeat{id = "rearrange_assoc", preconds = [], |
441 Rule_Def.Repeat{id = "rearrange_assoc", preconds = [], |
442 rew_ord = ("e_rew_ord",Rule.e_rew_ord), |
442 rew_ord = ("e_rew_ord",Rule.e_rew_ord), |
443 erls = Rule_Set.e_rls, srls = Rule_Set.e_rls, calc = [], errpatts = [], |
443 erls = Rule_Set.empty, srls = Rule_Set.empty, calc = [], errpatts = [], |
444 rules = |
444 rules = |
445 [Rule.Thm ("sym_add_assoc",TermC.num_str (@{thm add.assoc} RS @{thm sym})), |
445 [Rule.Thm ("sym_add_assoc",TermC.num_str (@{thm add.assoc} RS @{thm sym})), |
446 Rule.Thm ("sym_rmult_assoc",TermC.num_str (@{thm rmult_assoc} RS @{thm sym}))], |
446 Rule.Thm ("sym_rmult_assoc",TermC.num_str (@{thm rmult_assoc} RS @{thm sym}))], |
447 scr = Rule.EmptyScr |
447 scr = Rule.EmptyScr |
448 }; |
448 }; |
449 |
449 |
450 val ac_plus_times = |
450 val ac_plus_times = |
451 Rule_Def.Repeat{id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order), |
451 Rule_Def.Repeat{id = "ac_plus_times", preconds = [], rew_ord = ("term_order",term_order), |
452 erls = Rule_Set.e_rls, srls = Rule_Set.e_rls, calc = [], errpatts = [], |
452 erls = Rule_Set.empty, srls = Rule_Set.empty, calc = [], errpatts = [], |
453 rules = |
453 rules = |
454 [Rule.Thm ("radd_commute",TermC.num_str @{thm radd_commute}), |
454 [Rule.Thm ("radd_commute",TermC.num_str @{thm radd_commute}), |
455 Rule.Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}), |
455 Rule.Thm ("radd_left_commute",TermC.num_str @{thm radd_left_commute}), |
456 Rule.Thm ("add_assoc",TermC.num_str @{thm add.assoc}), |
456 Rule.Thm ("add_assoc",TermC.num_str @{thm add.assoc}), |
457 Rule.Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}), |
457 Rule.Thm ("rmult_commute",TermC.num_str @{thm rmult_commute}), |
461 }; |
461 }; |
462 |
462 |
463 (*todo: replace by Rewrite("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add)*) |
463 (*todo: replace by Rewrite("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add)*) |
464 val norm_equation = |
464 val norm_equation = |
465 Rule_Def.Repeat{id = "norm_equation", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord), |
465 Rule_Def.Repeat{id = "norm_equation", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord), |
466 erls = tval_rls, srls = Rule_Set.e_rls, calc = [], errpatts = [], |
466 erls = tval_rls, srls = Rule_Set.empty, calc = [], errpatts = [], |
467 rules = [Rule.Thm ("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add}) |
467 rules = [Rule.Thm ("rnorm_equation_add",TermC.num_str @{thm rnorm_equation_add}) |
468 ], |
468 ], |
469 scr = Rule.EmptyScr |
469 scr = Rule.EmptyScr |
470 }; |
470 }; |
471 \<close> |
471 \<close> |
472 ML \<open> |
472 ML \<open> |
473 (* expects * distributed over + *) |
473 (* expects * distributed over + *) |
474 val Test_simplify = |
474 val Test_simplify = |
475 Rule_Def.Repeat{id = "Test_simplify", preconds = [], |
475 Rule_Def.Repeat{id = "Test_simplify", preconds = [], |
476 rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), |
476 rew_ord = ("sqrt_right",sqrt_right false @{theory "Pure"}), |
477 erls = tval_rls, srls = Rule_Set.e_rls, |
477 erls = tval_rls, srls = Rule_Set.empty, |
478 calc=[(*since 040209 filled by prep_rls'*)], errpatts = [], |
478 calc=[(*since 040209 filled by prep_rls'*)], errpatts = [], |
479 rules = [ |
479 rules = [ |
480 Rule.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), |
480 Rule.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}), |
481 Rule.Thm ("radd_mult_distrib2",TermC.num_str @{thm radd_mult_distrib2}), |
481 Rule.Thm ("radd_mult_distrib2",TermC.num_str @{thm radd_mult_distrib2}), |
482 Rule.Thm ("rdistr_right_assoc",TermC.num_str @{thm rdistr_right_assoc}), |
482 Rule.Thm ("rdistr_right_assoc",TermC.num_str @{thm rdistr_right_assoc}), |
528 \<close> |
528 \<close> |
529 ML \<open> |
529 ML \<open> |
530 (*isolate the root in a root-equation*) |
530 (*isolate the root in a root-equation*) |
531 val isolate_root = |
531 val isolate_root = |
532 Rule_Def.Repeat{id = "isolate_root", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord), |
532 Rule_Def.Repeat{id = "isolate_root", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord), |
533 erls=tval_rls,srls = Rule_Set.e_rls, calc=[], errpatts = [], |
533 erls=tval_rls,srls = Rule_Set.empty, calc=[], errpatts = [], |
534 rules = [Rule.Thm ("rroot_to_lhs",TermC.num_str @{thm rroot_to_lhs}), |
534 rules = [Rule.Thm ("rroot_to_lhs",TermC.num_str @{thm rroot_to_lhs}), |
535 Rule.Thm ("rroot_to_lhs_mult",TermC.num_str @{thm rroot_to_lhs_mult}), |
535 Rule.Thm ("rroot_to_lhs_mult",TermC.num_str @{thm rroot_to_lhs_mult}), |
536 Rule.Thm ("rroot_to_lhs_add_mult",TermC.num_str @{thm rroot_to_lhs_add_mult}), |
536 Rule.Thm ("rroot_to_lhs_add_mult",TermC.num_str @{thm rroot_to_lhs_add_mult}), |
537 Rule.Thm ("risolate_root_add",TermC.num_str @{thm risolate_root_add}), |
537 Rule.Thm ("risolate_root_add",TermC.num_str @{thm risolate_root_add}), |
538 Rule.Thm ("risolate_root_mult",TermC.num_str @{thm risolate_root_mult}), |
538 Rule.Thm ("risolate_root_mult",TermC.num_str @{thm risolate_root_mult}), |
542 }; |
542 }; |
543 |
543 |
544 (*isolate the bound variable in an equation; 'bdv' is a meta-constant*) |
544 (*isolate the bound variable in an equation; 'bdv' is a meta-constant*) |
545 val isolate_bdv = |
545 val isolate_bdv = |
546 Rule_Def.Repeat{id = "isolate_bdv", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord), |
546 Rule_Def.Repeat{id = "isolate_bdv", preconds = [], rew_ord = ("e_rew_ord",Rule.e_rew_ord), |
547 erls=tval_rls,srls = Rule_Set.e_rls, calc= [], errpatts = [], |
547 erls=tval_rls,srls = Rule_Set.empty, calc= [], errpatts = [], |
548 rules = |
548 rules = |
549 [Rule.Thm ("risolate_bdv_add",TermC.num_str @{thm risolate_bdv_add}), |
549 [Rule.Thm ("risolate_bdv_add",TermC.num_str @{thm risolate_bdv_add}), |
550 Rule.Thm ("risolate_bdv_mult_add",TermC.num_str @{thm risolate_bdv_mult_add}), |
550 Rule.Thm ("risolate_bdv_mult_add",TermC.num_str @{thm risolate_bdv_mult_add}), |
551 Rule.Thm ("risolate_bdv_mult",TermC.num_str @{thm risolate_bdv_mult}), |
551 Rule.Thm ("risolate_bdv_mult",TermC.num_str @{thm risolate_bdv_mult}), |
552 Rule.Thm ("mult_square",TermC.num_str @{thm mult_square}), |
552 Rule.Thm ("mult_square",TermC.num_str @{thm mult_square}), |
562 [("Test_simplify", (Context.theory_name @{theory}, prep_rls' Test_simplify)), |
562 [("Test_simplify", (Context.theory_name @{theory}, prep_rls' Test_simplify)), |
563 ("tval_rls", (Context.theory_name @{theory}, prep_rls' tval_rls)), |
563 ("tval_rls", (Context.theory_name @{theory}, prep_rls' tval_rls)), |
564 ("isolate_root", (Context.theory_name @{theory}, prep_rls' isolate_root)), |
564 ("isolate_root", (Context.theory_name @{theory}, prep_rls' isolate_root)), |
565 ("isolate_bdv", (Context.theory_name @{theory}, prep_rls' isolate_bdv)), |
565 ("isolate_bdv", (Context.theory_name @{theory}, prep_rls' isolate_bdv)), |
566 ("matches", (Context.theory_name @{theory}, prep_rls' |
566 ("matches", (Context.theory_name @{theory}, prep_rls' |
567 (Rule_Set.append_rls "matches" testerls [Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches "#matches_")])))] |
567 (Rule_Set.append_rules "matches" testerls [Rule.Num_Calc ("Prog_Expr.matches", Prog_Expr.eval_matches "#matches_")])))] |
568 \<close> |
568 \<close> |
569 |
569 |
570 subsection \<open>problems\<close> |
570 subsection \<open>problems\<close> |
571 (** problem types **) |
571 (** problem types **) |
572 setup \<open>KEStore_Elems.add_pbts |
572 setup \<open>KEStore_Elems.add_pbts |
573 [(Specify.prep_pbt thy "pbl_test" [] Celem.e_pblID (["test"], [], Rule_Set.e_rls, NONE, [])), |
573 [(Specify.prep_pbt thy "pbl_test" [] Celem.e_pblID (["test"], [], Rule_Set.empty, NONE, [])), |
574 (Specify.prep_pbt thy "pbl_test_equ" [] Celem.e_pblID |
574 (Specify.prep_pbt thy "pbl_test_equ" [] Celem.e_pblID |
575 (["equation","test"], |
575 (["equation","test"], |
576 [("#Given" ,["equality e_e","solveFor v_v"]), |
576 [("#Given" ,["equality e_e","solveFor v_v"]), |
577 ("#Where" ,["matches (?a = ?b) e_e"]), |
577 ("#Where" ,["matches (?a = ?b) e_e"]), |
578 ("#Find" ,["solutions v_v'i'"])], |
578 ("#Find" ,["solutions v_v'i'"])], |
785 (Specify.prep_pbt thy "pbl_test_uni_poly" [] Celem.e_pblID |
785 (Specify.prep_pbt thy "pbl_test_uni_poly" [] Celem.e_pblID |
786 (["polynomial","univariate","equation","test"], |
786 (["polynomial","univariate","equation","test"], |
787 [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]), |
787 [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]), |
788 ("#Where" ,["HOL.False"]), |
788 ("#Where" ,["HOL.False"]), |
789 ("#Find" ,["solutions v_v'i'"])], |
789 ("#Find" ,["solutions v_v'i'"])], |
790 Rule_Set.e_rls, SOME "solve (e_e::bool, v_v)", [])), |
790 Rule_Set.empty, SOME "solve (e_e::bool, v_v)", [])), |
791 (Specify.prep_pbt thy "pbl_test_uni_poly_deg2" [] Celem.e_pblID |
791 (Specify.prep_pbt thy "pbl_test_uni_poly_deg2" [] Celem.e_pblID |
792 (["degree_two","polynomial","univariate","equation","test"], |
792 (["degree_two","polynomial","univariate","equation","test"], |
793 [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]), |
793 [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]), |
794 ("#Find" ,["solutions v_v'i'"])], |
794 ("#Find" ,["solutions v_v'i'"])], |
795 Rule_Set.e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])), |
795 Rule_Set.empty, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])), |
796 (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_pq" [] Celem.e_pblID |
796 (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_pq" [] Celem.e_pblID |
797 (["pq_formula","degree_two","polynomial","univariate","equation","test"], |
797 (["pq_formula","degree_two","polynomial","univariate","equation","test"], |
798 [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]), |
798 [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]), |
799 ("#Find" ,["solutions v_v'i'"])], |
799 ("#Find" ,["solutions v_v'i'"])], |
800 Rule_Set.e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])), |
800 Rule_Set.empty, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])), |
801 (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_abc" [] Celem.e_pblID |
801 (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_abc" [] Celem.e_pblID |
802 (["abc_formula","degree_two","polynomial","univariate","equation","test"], |
802 (["abc_formula","degree_two","polynomial","univariate","equation","test"], |
803 [("#Given" ,["equality (a_a * x ^^^2 + b_b * x + c_c = 0)","solveFor v_v"]), |
803 [("#Given" ,["equality (a_a * x ^^^2 + b_b * x + c_c = 0)","solveFor v_v"]), |
804 ("#Find" ,["solutions v_v'i'"])], |
804 ("#Find" ,["solutions v_v'i'"])], |
805 Rule_Set.e_rls, SOME "solve (a_a * x ^^^2 + b_b * x + c_c = 0, v_v)", [])), |
805 Rule_Set.empty, SOME "solve (a_a * x ^^^2 + b_b * x + c_c = 0, v_v)", [])), |
806 (Specify.prep_pbt thy "pbl_test_uni_root" [] Celem.e_pblID |
806 (Specify.prep_pbt thy "pbl_test_uni_root" [] Celem.e_pblID |
807 (["squareroot","univariate","equation","test"], |
807 (["squareroot","univariate","equation","test"], |
808 [("#Given" ,["equality e_e","solveFor v_v"]), |
808 [("#Given" ,["equality e_e","solveFor v_v"]), |
809 ("#Where" ,["precond_rootpbl v_v"]), |
809 ("#Where" ,["precond_rootpbl v_v"]), |
810 ("#Find" ,["solutions v_v'i'"])], |
810 ("#Find" ,["solutions v_v'i'"])], |
811 Rule_Set.append_rls "contains_root" Rule_Set.e_rls [Rule.Num_Calc ("Test.contains'_root", |
811 Rule_Set.append_rules "contains_root" Rule_Set.empty [Rule.Num_Calc ("Test.contains'_root", |
812 eval_contains_root "#contains_root_")], |
812 eval_contains_root "#contains_root_")], |
813 SOME "solve (e_e::bool, v_v)", [["Test","square_equation"]])), |
813 SOME "solve (e_e::bool, v_v)", [["Test","square_equation"]])), |
814 (Specify.prep_pbt thy "pbl_test_uni_norm" [] Celem.e_pblID |
814 (Specify.prep_pbt thy "pbl_test_uni_norm" [] Celem.e_pblID |
815 (["normalise","univariate","equation","test"], |
815 (["normalise","univariate","equation","test"], |
816 [("#Given" ,["equality e_e","solveFor v_v"]), |
816 [("#Given" ,["equality e_e","solveFor v_v"]), |
817 ("#Where" ,[]), |
817 ("#Where" ,[]), |
818 ("#Find" ,["solutions v_v'i'"])], |
818 ("#Find" ,["solutions v_v'i'"])], |
819 Rule_Set.e_rls, SOME "solve (e_e::bool, v_v)", [["Test","norm_univar_equation"]])), |
819 Rule_Set.empty, SOME "solve (e_e::bool, v_v)", [["Test","norm_univar_equation"]])), |
820 (Specify.prep_pbt thy "pbl_test_uni_roottest" [] Celem.e_pblID |
820 (Specify.prep_pbt thy "pbl_test_uni_roottest" [] Celem.e_pblID |
821 (["sqroot-test","univariate","equation","test"], |
821 (["sqroot-test","univariate","equation","test"], |
822 [("#Given" ,["equality e_e","solveFor v_v"]), |
822 [("#Given" ,["equality e_e","solveFor v_v"]), |
823 ("#Where" ,["precond_rootpbl v_v"]), |
823 ("#Where" ,["precond_rootpbl v_v"]), |
824 ("#Find" ,["solutions v_v'i'"])], |
824 ("#Find" ,["solutions v_v'i'"])], |
825 Rule_Set.e_rls, SOME "solve (e_e::bool, v_v)", [])), |
825 Rule_Set.empty, SOME "solve (e_e::bool, v_v)", [])), |
826 (Specify.prep_pbt thy "pbl_test_intsimp" [] Celem.e_pblID |
826 (Specify.prep_pbt thy "pbl_test_intsimp" [] Celem.e_pblID |
827 (["inttype","test"], |
827 (["inttype","test"], |
828 [("#Given" ,["intTestGiven t_t"]), |
828 [("#Given" ,["intTestGiven t_t"]), |
829 ("#Where" ,[]), |
829 ("#Where" ,[]), |
830 ("#Find" ,["intTestFind s_s"])], |
830 ("#Find" ,["intTestFind s_s"])], |
831 Rule_Set.e_rls, NONE, [["Test","intsimp"]]))]\<close> |
831 Rule_Set.empty, NONE, [["Test","intsimp"]]))]\<close> |
832 |
832 |
833 section \<open>methods\<close> |
833 section \<open>methods\<close> |
834 subsection \<open>differentiate\<close> |
834 subsection \<open>differentiate\<close> |
835 setup \<open>KEStore_Elems.add_mets |
835 setup \<open>KEStore_Elems.add_mets |
836 [Specify.prep_met @{theory "Diff"} "met_test" [] Celem.e_metID |
836 [Specify.prep_met @{theory "Diff"} "met_test" [] Celem.e_metID |
837 (["Test"], [], |
837 (["Test"], [], |
838 {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule_Set.e_rls, prls=Rule_Set.e_rls, |
838 {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = Rule_Set.empty, prls=Rule_Set.empty, |
839 crls=Atools_erls, errpats = [], nrls = Rule_Set.e_rls}, @{thm refl})] |
839 crls=Atools_erls, errpats = [], nrls = Rule_Set.empty}, @{thm refl})] |
840 \<close> |
840 \<close> |
841 |
841 |
842 partial_function (tailrec) solve_linear :: "bool \<Rightarrow> real \<Rightarrow> bool list" |
842 partial_function (tailrec) solve_linear :: "bool \<Rightarrow> real \<Rightarrow> bool list" |
843 where |
843 where |
844 "solve_linear e_e v_v = ( |
844 "solve_linear e_e v_v = ( |
852 [Specify.prep_met thy "met_test_solvelin" [] Celem.e_metID |
852 [Specify.prep_met thy "met_test_solvelin" [] Celem.e_metID |
853 (["Test","solve_linear"], |
853 (["Test","solve_linear"], |
854 [("#Given" ,["equality e_e","solveFor v_v"]), |
854 [("#Given" ,["equality e_e","solveFor v_v"]), |
855 ("#Where" ,["matches (?a = ?b) e_e"]), |
855 ("#Where" ,["matches (?a = ?b) e_e"]), |
856 ("#Find" ,["solutions v_v'i'"])], |
856 ("#Find" ,["solutions v_v'i'"])], |
857 {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.e_rls, |
857 {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.empty, |
858 prls = assoc_rls' @{theory} "matches", calc = [], crls = tval_rls, errpats = [], |
858 prls = assoc_rls' @{theory} "matches", calc = [], crls = tval_rls, errpats = [], |
859 nrls = Test_simplify}, |
859 nrls = Test_simplify}, |
860 @{thm solve_linear.simps})] |
860 @{thm solve_linear.simps})] |
861 \<close> |
861 \<close> |
862 subsection \<open>root equation\<close> |
862 subsection \<open>root equation\<close> |
885 (["Test","sqrt-equ-test"], |
885 (["Test","sqrt-equ-test"], |
886 [("#Given" ,["equality e_e","solveFor v_v"]), |
886 [("#Given" ,["equality e_e","solveFor v_v"]), |
887 ("#Where" ,["contains_root (e_e::bool)"]), |
887 ("#Where" ,["contains_root (e_e::bool)"]), |
888 ("#Find" ,["solutions v_v'i'"])], |
888 ("#Find" ,["solutions v_v'i'"])], |
889 {rew_ord'="e_rew_ord",rls'=tval_rls, |
889 {rew_ord'="e_rew_ord",rls'=tval_rls, |
890 srls = Rule_Set.append_rls "srls_contains_root" Rule_Set.e_rls |
890 srls = Rule_Set.append_rules "srls_contains_root" Rule_Set.empty |
891 [Rule.Num_Calc ("Test.contains'_root", eval_contains_root "")], |
891 [Rule.Num_Calc ("Test.contains'_root", eval_contains_root "")], |
892 prls = Rule_Set.append_rls "prls_contains_root" Rule_Set.e_rls |
892 prls = Rule_Set.append_rules "prls_contains_root" Rule_Set.empty |
893 [Rule.Num_Calc ("Test.contains'_root", eval_contains_root "")], |
893 [Rule.Num_Calc ("Test.contains'_root", eval_contains_root "")], |
894 calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.e_rls (*,asm_rls=[], |
894 calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.empty (*,asm_rls=[], |
895 asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, |
895 asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, |
896 @{thm solve_root_equ.simps})] |
896 @{thm solve_root_equ.simps})] |
897 \<close> |
897 \<close> |
898 |
898 |
899 partial_function (tailrec) minisubpbl :: "bool \<Rightarrow> real \<Rightarrow> bool list" |
899 partial_function (tailrec) minisubpbl :: "bool \<Rightarrow> real \<Rightarrow> bool list" |
912 (*tests subproblem fixed linear*) |
912 (*tests subproblem fixed linear*) |
913 (["Test","squ-equ-test-subpbl1"], |
913 (["Test","squ-equ-test-subpbl1"], |
914 [("#Given" ,["equality e_e","solveFor v_v"]), |
914 [("#Given" ,["equality e_e","solveFor v_v"]), |
915 ("#Where" ,["precond_rootmet v_v"]), |
915 ("#Where" ,["precond_rootmet v_v"]), |
916 ("#Find" ,["solutions v_v'i'"])], |
916 ("#Find" ,["solutions v_v'i'"])], |
917 {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.e_rls, |
917 {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.empty, |
918 prls = Rule_Set.append_rls "prls_met_test_squ_sub" Rule_Set.e_rls |
918 prls = Rule_Set.append_rules "prls_met_test_squ_sub" Rule_Set.empty |
919 [Rule.Num_Calc ("Test.precond'_rootmet", eval_precond_rootmet "")], |
919 [Rule.Num_Calc ("Test.precond'_rootmet", eval_precond_rootmet "")], |
920 calc=[], crls=tval_rls, errpats = [], nrls = Test_simplify}, |
920 calc=[], crls=tval_rls, errpats = [], nrls = Test_simplify}, |
921 @{thm minisubpbl.simps})] |
921 @{thm minisubpbl.simps})] |
922 \<close> |
922 \<close> |
923 |
923 |
944 (*root-equation1:*) |
944 (*root-equation1:*) |
945 (["Test","square_equation1"], |
945 (["Test","square_equation1"], |
946 [("#Given" ,["equality e_e","solveFor v_v"]), |
946 [("#Given" ,["equality e_e","solveFor v_v"]), |
947 ("#Find" ,["solutions v_v'i'"])], |
947 ("#Find" ,["solutions v_v'i'"])], |
948 {rew_ord'="e_rew_ord",rls'=tval_rls, |
948 {rew_ord'="e_rew_ord",rls'=tval_rls, |
949 srls = Rule_Set.append_rls "srls_contains_root" Rule_Set.e_rls |
949 srls = Rule_Set.append_rules "srls_contains_root" Rule_Set.empty |
950 [Rule.Num_Calc ("Test.contains'_root", eval_contains_root"")], prls=Rule_Set.e_rls, calc=[], crls=tval_rls, |
950 [Rule.Num_Calc ("Test.contains'_root", eval_contains_root"")], prls=Rule_Set.empty, calc=[], crls=tval_rls, |
951 errpats = [], nrls = Rule_Set.e_rls(*,asm_rls=[], asm_thm=[("square_equation_left",""), |
951 errpats = [], nrls = Rule_Set.empty(*,asm_rls=[], asm_thm=[("square_equation_left",""), |
952 ("square_equation_right","")]*)}, |
952 ("square_equation_right","")]*)}, |
953 @{thm solve_root_equ2.simps})] |
953 @{thm solve_root_equ2.simps})] |
954 \<close> |
954 \<close> |
955 |
955 |
956 partial_function (tailrec) solve_root_equ3 :: "bool \<Rightarrow> real \<Rightarrow> bool list" |
956 partial_function (tailrec) solve_root_equ3 :: "bool \<Rightarrow> real \<Rightarrow> bool list" |
977 (*root-equation2*) |
977 (*root-equation2*) |
978 (["Test","square_equation2"], |
978 (["Test","square_equation2"], |
979 [("#Given" ,["equality e_e","solveFor v_v"]), |
979 [("#Given" ,["equality e_e","solveFor v_v"]), |
980 ("#Find" ,["solutions v_v'i'"])], |
980 ("#Find" ,["solutions v_v'i'"])], |
981 {rew_ord'="e_rew_ord",rls'=tval_rls, |
981 {rew_ord'="e_rew_ord",rls'=tval_rls, |
982 srls = Rule_Set.append_rls "srls_contains_root" Rule_Set.e_rls |
982 srls = Rule_Set.append_rules "srls_contains_root" Rule_Set.empty |
983 [Rule.Num_Calc ("Test.contains'_root", eval_contains_root"")], |
983 [Rule.Num_Calc ("Test.contains'_root", eval_contains_root"")], |
984 prls=Rule_Set.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.e_rls(*,asm_rls=[], |
984 prls=Rule_Set.empty,calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.empty(*,asm_rls=[], |
985 asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, |
985 asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, |
986 @{thm solve_root_equ3.simps})] |
986 @{thm solve_root_equ3.simps})] |
987 \<close> |
987 \<close> |
988 |
988 |
989 partial_function (tailrec) solve_root_equ4 :: "bool \<Rightarrow> real \<Rightarrow> bool list" |
989 partial_function (tailrec) solve_root_equ4 :: "bool \<Rightarrow> real \<Rightarrow> bool list" |
1010 (*root-equation*) |
1010 (*root-equation*) |
1011 (["Test","square_equation"], |
1011 (["Test","square_equation"], |
1012 [("#Given" ,["equality e_e","solveFor v_v"]), |
1012 [("#Given" ,["equality e_e","solveFor v_v"]), |
1013 ("#Find" ,["solutions v_v'i'"])], |
1013 ("#Find" ,["solutions v_v'i'"])], |
1014 {rew_ord'="e_rew_ord",rls'=tval_rls, |
1014 {rew_ord'="e_rew_ord",rls'=tval_rls, |
1015 srls = Rule_Set.append_rls "srls_contains_root" Rule_Set.e_rls |
1015 srls = Rule_Set.append_rules "srls_contains_root" Rule_Set.empty |
1016 [Rule.Num_Calc ("Test.contains'_root", eval_contains_root"")], |
1016 [Rule.Num_Calc ("Test.contains'_root", eval_contains_root"")], |
1017 prls=Rule_Set.e_rls,calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.e_rls (*,asm_rls=[], |
1017 prls=Rule_Set.empty,calc=[], crls=tval_rls, errpats = [], nrls = Rule_Set.empty (*,asm_rls=[], |
1018 asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, |
1018 asm_thm=[("square_equation_left",""), ("square_equation_right","")]*)}, |
1019 @{thm solve_root_equ4.simps})] |
1019 @{thm solve_root_equ4.simps})] |
1020 \<close> |
1020 \<close> |
1021 |
1021 |
1022 partial_function (tailrec) solve_plain_square :: "bool \<Rightarrow> real \<Rightarrow> bool list" |
1022 partial_function (tailrec) solve_plain_square :: "bool \<Rightarrow> real \<Rightarrow> bool list" |
1039 ("#Where" ,["(matches (?a + ?b*v_v ^^^2 = 0) e_e) |" ^ |
1039 ("#Where" ,["(matches (?a + ?b*v_v ^^^2 = 0) e_e) |" ^ |
1040 "(matches ( ?b*v_v ^^^2 = 0) e_e) |" ^ |
1040 "(matches ( ?b*v_v ^^^2 = 0) e_e) |" ^ |
1041 "(matches (?a + v_v ^^^2 = 0) e_e) |" ^ |
1041 "(matches (?a + v_v ^^^2 = 0) e_e) |" ^ |
1042 "(matches ( v_v ^^^2 = 0) e_e)"]), |
1042 "(matches ( v_v ^^^2 = 0) e_e)"]), |
1043 ("#Find" ,["solutions v_v'i'"])], |
1043 ("#Find" ,["solutions v_v'i'"])], |
1044 {rew_ord'="e_rew_ord",rls'=tval_rls,calc=[],srls=Rule_Set.e_rls, |
1044 {rew_ord'="e_rew_ord",rls'=tval_rls,calc=[],srls=Rule_Set.empty, |
1045 prls = assoc_rls' @{theory} "matches", crls=tval_rls, errpats = [], nrls = Rule_Set.e_rls(*, |
1045 prls = assoc_rls' @{theory} "matches", crls=tval_rls, errpats = [], nrls = Rule_Set.empty(*, |
1046 asm_rls=[],asm_thm=[]*)}, |
1046 asm_rls=[],asm_thm=[]*)}, |
1047 @{thm solve_plain_square.simps})] |
1047 @{thm solve_plain_square.simps})] |
1048 \<close> |
1048 \<close> |
1049 subsection \<open>polynomial equation\<close> |
1049 subsection \<open>polynomial equation\<close> |
1050 |
1050 |
1062 [Specify.prep_met thy "met_test_norm_univ" [] Celem.e_metID |
1062 [Specify.prep_met thy "met_test_norm_univ" [] Celem.e_metID |
1063 (["Test","norm_univar_equation"], |
1063 (["Test","norm_univar_equation"], |
1064 [("#Given",["equality e_e","solveFor v_v"]), |
1064 [("#Given",["equality e_e","solveFor v_v"]), |
1065 ("#Where" ,[]), |
1065 ("#Where" ,[]), |
1066 ("#Find" ,["solutions v_v'i'"])], |
1066 ("#Find" ,["solutions v_v'i'"])], |
1067 {rew_ord'="e_rew_ord",rls'=tval_rls,srls = Rule_Set.e_rls,prls=Rule_Set.e_rls, calc=[], crls=tval_rls, |
1067 {rew_ord'="e_rew_ord",rls'=tval_rls,srls = Rule_Set.empty,prls=Rule_Set.empty, calc=[], crls=tval_rls, |
1068 errpats = [], nrls = Rule_Set.e_rls}, |
1068 errpats = [], nrls = Rule_Set.empty}, |
1069 @{thm norm_univariate_equ.simps})] |
1069 @{thm norm_univariate_equ.simps})] |
1070 \<close> |
1070 \<close> |
1071 subsection \<open>diophantine equation\<close> |
1071 subsection \<open>diophantine equation\<close> |
1072 |
1072 |
1073 partial_function (tailrec) test_simplify :: "int \<Rightarrow> int" |
1073 partial_function (tailrec) test_simplify :: "int \<Rightarrow> int" |
1080 [Specify.prep_met thy "met_test_intsimp" [] Celem.e_metID |
1080 [Specify.prep_met thy "met_test_intsimp" [] Celem.e_metID |
1081 (["Test","intsimp"], |
1081 (["Test","intsimp"], |
1082 [("#Given" ,["intTestGiven t_t"]), |
1082 [("#Given" ,["intTestGiven t_t"]), |
1083 ("#Where" ,[]), |
1083 ("#Where" ,[]), |
1084 ("#Find" ,["intTestFind s_s"])], |
1084 ("#Find" ,["intTestFind s_s"])], |
1085 {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.e_rls, prls = Rule_Set.e_rls, calc = [], |
1085 {rew_ord' = "e_rew_ord", rls' = tval_rls, srls = Rule_Set.empty, prls = Rule_Set.empty, calc = [], |
1086 crls = tval_rls, errpats = [], nrls = Test_simplify}, |
1086 crls = tval_rls, errpats = [], nrls = Test_simplify}, |
1087 @{thm test_simplify.simps})] |
1087 @{thm test_simplify.simps})] |
1088 \<close> |
1088 \<close> |
1089 |
1089 |
1090 end |
1090 end |