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 *}
32 val ctxt = thy2ctxt thy;
34 val univariate_equation_prls =
35 append_rls "univariate_equation_prls" e_rls
36 [Calc ("Tools.matches",eval_matches "")];
38 overwritelthy @{theory} (!ruleset',
39 [("univariate_equation_prls",
40 prep_rls univariate_equation_prls)]);
44 (prep_pbt thy "pbl_equ" [] e_pblID
46 [("#Given" ,["equality e_e","solveFor v_v"]),
47 ("#Where" ,["matches (?a = ?b) e_e"]),
48 ("#Find" ,["solutions v_v'i'"])
50 append_rls "equation_prls" e_rls
51 [Calc ("Tools.matches",eval_matches "")],
52 SOME "solve (e_e::bool, v_v)",
56 (prep_pbt thy "pbl_equ_univ" [] e_pblID
57 (["univariate","equation"],
58 [("#Given" ,["equality e_e","solveFor v_v"]),
59 ("#Where" ,["matches (?a = ?b) e_e"]),
60 ("#Find" ,["solutions v_v'i'"])
62 univariate_equation_prls,SOME "solve (e_e::bool, v_v)",[]));
65 (*.function for handling the cas-input "solve (x+1=2, x)":
66 make a model which is already in ptree-internal format.*)
67 (* val (h,argl) = strip_comb (str2term "solve (x+1=2, x)");
68 val (h,argl) = strip_comb ((term_of o the o (parse thy))
69 "solveTest (x+1=2, x)");
71 fun argl2dtss [Const ("Product_Type.Pair", _) $ eq $ bdv] =
72 [((the o (parseNEW ctxt)) "equality", [eq]),
73 ((the o (parseNEW ctxt)) "solveFor", [bdv]),
74 ((the o (parseNEW ctxt)) "solutions",
75 [(the o (parseNEW ctxt)) "L"])
77 | argl2dtss _ = error "Equation.ML: wrong argument for argl2dtss";
81 [((term_of o the o (parse thy)) "solveTest",
82 (("Test", ["univariate","equation","test"], ["no_met"]),
84 ((term_of o the o (parse thy)) "solve",
85 (("Isac", ["univariate","equation"], ["no_met"]),
92 (prep_met thy "met_equ" [] e_metID
95 {rew_ord'="tless_true", rls'=Erls, calc = [],
98 crls = Atools_erls, nrls = e_rls},