1 (* equations and functions; functions NOT as lambda-terms
2 author: Walther Neuper 2005, 2006
3 (c) due to copyright terms
6 theory Equation imports Atools begin
10 (*descriptions in the related problems TODOshift here from Descriptions.thy*)
11 substitution :: "bool => una"
14 solve :: "[bool * 'a] => bool list" (* solve (x+1=2, x) *)
15 solveTest :: "[bool * 'a] => bool list" (* for test collection *)
18 Function2Equality :: "[bool, bool, bool]
20 ("((Script Function2Equality (_ _ =))// (_))" 9)
22 text {* defines equation and univariate-equation
28 (c) by Richard Lang, 2003 *}
33 val univariate_equation_prls =
34 append_rls "univariate_equation_prls" e_rls
35 [Calc ("Tools.matches",eval_matches "")];
37 overwritelthy @{theory} (!ruleset',
38 [("univariate_equation_prls",
39 prep_rls univariate_equation_prls)]);
43 (prep_pbt thy "pbl_equ" [] e_pblID
45 [("#Given" ,["equality e_","solveFor v_"]),
46 ("#Where" ,["matches (?a = ?b) e_"]),
47 ("#Find" ,["solutions v_i_"])
49 append_rls "equation_prls" e_rls
50 [Calc ("Tools.matches",eval_matches "")],
51 SOME "solve (e_::bool, v_)",
55 (prep_pbt thy "pbl_equ_univ" [] e_pblID
56 (["univariate","equation"],
57 [("#Given" ,["equality e_","solveFor v_"]),
58 ("#Where" ,["matches (?a = ?b) e_"]),
59 ("#Find" ,["solutions v_i_"])
61 univariate_equation_prls,SOME "solve (e_::bool, v_)",[]));
64 (*.function for handling the cas-input "solve (x+1=2, x)":
65 make a model which is already in ptree-internal format.*)
66 (* val (h,argl) = strip_comb (str2term "solve (x+1=2, x)");
67 val (h,argl) = strip_comb ((term_of o the o (parse thy))
68 "solveTest (x+1=2, x)");
70 fun argl2dtss [Const ("Pair", _) $ eq $ bdv] =
71 [((term_of o the o (parse thy)) "equality", [eq]),
72 ((term_of o the o (parse thy)) "solveFor", [bdv]),
73 ((term_of o the o (parse thy)) "solutions",
74 [(term_of o the o (parse thy)) "L"])
76 | argl2dtss _ = raise error "Equation.ML: wrong argument for argl2dtss";
80 [((term_of o the o (parse thy)) "solveTest",
81 (("Test.thy", ["univariate","equation","test"], ["no_met"]),
83 ((term_of o the o (parse thy)) "solve",
84 (("Isac.thy", ["univariate","equation"], ["no_met"]),
91 (prep_met thy "met_equ" [] e_metID
94 {rew_ord'="tless_true", rls'=Erls, calc = [],
97 crls = Atools_erls, nrls = e_rls},