1 (* Algebra Einf"uhrung, Unterrichtsversuch IMST-Projekt
2 author: Walther Neuper 2007
3 (c) due to copyright terms
6 theory AlgEin imports Rational begin
7 (*Poly + ..shouldbe sufficient, but norm_Poly required*)
11 (*new Descriptions in the related problems*)
12 KantenUnten :: "bool list => una"
13 KantenSenkrecht :: "bool list => una"
14 KantenOben :: "bool list => una"
15 KantenLaenge :: "bool => una"
16 Querschnitt :: "bool => una"
17 GesamtLaenge :: "real => una"
26 setup \<open>KEStore_Elems.add_pbts
27 [(Problem.prep_input thy "pbl_algein" [] Problem.id_empty (["Berechnung"], [], Rule_Set.empty, NONE, [])),
28 (Problem.prep_input thy "pbl_algein_numsym" [] Problem.id_empty
29 (["numerischSymbolische", "Berechnung"],
31 ["KantenLaenge k_k", "Querschnitt q__q"(*q_ in Biegelinie.thy*), "KantenUnten u_u",
32 "KantenSenkrecht s_s", "KantenOben o_o"]),
33 ("#Find", ["GesamtLaenge l_l"])],
34 Rule_Set.empty, NONE, [["Berechnung", "erstNumerisch"], ["Berechnung", "erstSymbolisch"]]))]\<close>
36 setup \<open>KEStore_Elems.add_mets
37 [MethodC.prep_input thy "met_algein" [] MethodC.id_empty
39 {rew_ord'="tless_true", rls'= Rule_Set.Empty, calc = [], srls = Rule_Set.Empty, prls = Rule_Set.Empty, crls =Rule_Set.Empty,
40 errpats = [], nrls = Rule_Set.Empty},
42 MethodC.prep_input thy "met_algein_numsym" [] MethodC.id_empty
43 (["Berechnung", "erstNumerisch"], [],
44 {rew_ord'="tless_true", rls'= Rule_Set.Empty, calc = [], srls = Rule_Set.Empty, prls = Rule_Set.Empty, crls =Rule_Set.Empty,
45 errpats = [], nrls = Rule_Set.Empty},
49 partial_function (tailrec) symbolisch_rechnen :: "bool \<Rightarrow> bool \<Rightarrow> bool list \<Rightarrow> bool list \<Rightarrow> bool list \<Rightarrow> real \<Rightarrow> bool"
51 "symbolisch_rechnen k_k q__q u_u s_s o_o l_l = (
53 t_t = Take (l_l = oben + senkrecht + unten);
54 su_m = boollist2sum o_o;
55 t_t = Substitute [oben = su_m] t_t;
56 t_t = Substitute o_o t_t;
57 t_t = Substitute [k_k, q__q] t_t;
58 t_t = Repeat (Try (Rewrite_Set ''norm_Poly'')) t_t;
59 su_m = boollist2sum s_s;
60 t_t = Substitute [senkrecht = su_m] t_t;
61 t_t = Substitute s_s t_t;
62 t_t = Substitute [k_k, q__q] t_t;
63 t_t = Repeat (Try (Rewrite_Set ''norm_Poly'')) t_t;
64 su_m = boollist2sum u_u;
65 t_t = Substitute [unten = su_m] t_t;
66 t_t = Substitute u_u t_t;
67 t_t = Substitute [k_k, q__q] t_t;
68 t_t = Repeat (Try (Rewrite_Set ''norm_Poly'')) t_t
70 Try (Rewrite_Set ''norm_Poly'') t_t)"
71 setup \<open>KEStore_Elems.add_mets
72 [MethodC.prep_input thy "met_algein_numsym_1num" [] MethodC.id_empty
73 (["Berechnung", "erstNumerisch"],
74 [("#Given" ,["KantenLaenge k_k", "Querschnitt q__q", "KantenUnten u_u",
75 "KantenSenkrecht s_s", "KantenOben o_o"]),
76 ("#Find" ,["GesamtLaenge l_l"])],
77 {rew_ord'="tless_true", rls'= Rule_Set.empty, calc = [],
78 srls = Rule_Set.append_rules "srls_..Berechnung-erstSymbolisch" Rule_Set.empty
79 [Rule.Eval ("Prog_Expr.boollist2sum", Prog_Expr.eval_boollist2sum "")],
80 prls = Rule_Set.empty, crls =Rule_Set.empty , errpats = [], nrls = norm_Rational},
81 @{thm symbolisch_rechnen.simps})]
84 partial_function (tailrec) symbolisch_rechnen_2 :: "bool \<Rightarrow> bool \<Rightarrow> bool list \<Rightarrow> bool list \<Rightarrow> bool list \<Rightarrow> real \<Rightarrow> bool"
86 "symbolisch_rechnen k_k q__q u_u s_s o_o l_l = (
88 t_t = Take (l_l = oben + senkrecht + unten);
89 su_m = boollist2sum o_o;
90 t_t = Substitute [oben = su_m] t_t;
91 t_t = Substitute o_o t_t;
92 t_t = Repeat (Try (Rewrite_Set ''norm_Poly'')) t_t;
93 su_m = boollist2sum s_s;
94 t_t = Substitute [senkrecht = su_m] t_t;
95 t_t = Substitute s_s t_t;
96 t_t = Repeat (Try (Rewrite_Set ''norm_Poly'')) t_t;
97 su_m = boollist2sum u_u;
98 t_t = Substitute [unten = su_m] t_t;
99 t_t = Substitute u_u t_t;
100 t_t = Repeat (Try (Rewrite_Set ''norm_Poly'')) t_t;
101 t_t = Substitute [k_k, q__q] t_t
103 (Try (Rewrite_Set ''norm_Poly'')) t_t)"
104 setup \<open>KEStore_Elems.add_mets
105 [MethodC.prep_input thy "met_algein_symnum" [] MethodC.id_empty
106 (["Berechnung", "erstSymbolisch"],
107 [("#Given" ,["KantenLaenge k_k", "Querschnitt q__q", "KantenUnten u_u",
108 "KantenSenkrecht s_s", "KantenOben o_o"]),
109 ("#Find" ,["GesamtLaenge l_l"])],
110 {rew_ord'="tless_true", rls'= Rule_Set.empty, calc = [],
111 srls = Rule_Set.append_rules "srls_..Berechnung-erstSymbolisch" Rule_Set.empty
112 [Rule.Eval ("Prog_Expr.boollist2sum", Prog_Expr.eval_boollist2sum "")],
113 prls = Rule_Set.empty, crls =Rule_Set.empty , errpats = [], nrls = norm_Rational},
114 @{thm symbolisch_rechnen.simps})]