neuper@37906
|
1 |
(* equations and functions; functions NOT as lambda-terms
|
neuper@37906
|
2 |
author: Walther Neuper 2005, 2006
|
neuper@37906
|
3 |
(c) due to copyright terms
|
neuper@37906
|
4 |
*)
|
neuper@37906
|
5 |
|
neuper@37950
|
6 |
theory Equation imports Atools begin
|
neuper@37906
|
7 |
|
neuper@42398
|
8 |
text {* univariate equations over terms :
|
neuper@42398
|
9 |
In 2003 Richard Lang prototyped ISAC's equation solver while also alpha-testing
|
neuper@42398
|
10 |
the Lucas-Interpreter's Subproblem mechanism.
|
neuper@42398
|
11 |
This prototype suffers from the drop-out of Matthias Goldgruber for a year,
|
neuper@42398
|
12 |
who had started to work on simplification in parallel. So this implementation
|
neuper@42398
|
13 |
replaced simplifiers by many specific theorems for specific terms in specific
|
neuper@42398
|
14 |
phases of equation solving; these specific solutions wait for generalisation
|
neuper@42398
|
15 |
in future improvements of ISAC's equation solver.
|
neuper@42398
|
16 |
*}
|
neuper@42398
|
17 |
|
neuper@37906
|
18 |
consts
|
neuper@37906
|
19 |
|
neuper@37906
|
20 |
(*descriptions in the related problems TODOshift here from Descriptions.thy*)
|
neuper@37950
|
21 |
substitution :: "bool => una"
|
neuper@37906
|
22 |
|
neuper@37906
|
23 |
(*the CAS-commands*)
|
neuper@37950
|
24 |
solve :: "[bool * 'a] => bool list" (* solve (x+1=2, x) *)
|
neuper@37950
|
25 |
solveTest :: "[bool * 'a] => bool list" (* for test collection *)
|
neuper@37906
|
26 |
|
neuper@37906
|
27 |
(*Script-names*)
|
neuper@37950
|
28 |
Function2Equality :: "[bool, bool, bool]
|
neuper@37950
|
29 |
=> bool"
|
neuper@37906
|
30 |
("((Script Function2Equality (_ _ =))// (_))" 9)
|
neuper@37906
|
31 |
|
neuper@37950
|
32 |
text {* defines equation and univariate-equation
|
neuper@37950
|
33 |
created by: rlang
|
neuper@37950
|
34 |
date: 02.09
|
neuper@37950
|
35 |
changed by: rlang
|
neuper@37950
|
36 |
last change by: rlang
|
neuper@37950
|
37 |
date: 02.11.29
|
neuper@37950
|
38 |
(c) by Richard Lang, 2003 *}
|
neuper@37950
|
39 |
|
neuper@37950
|
40 |
ML {*
|
neuper@37972
|
41 |
val thy = @{theory};
|
bonzai@41952
|
42 |
val ctxt = thy2ctxt thy;
|
neuper@37972
|
43 |
|
neuper@37950
|
44 |
val univariate_equation_prls =
|
neuper@37950
|
45 |
append_rls "univariate_equation_prls" e_rls
|
neuper@37950
|
46 |
[Calc ("Tools.matches",eval_matches "")];
|
neuper@52125
|
47 |
*}
|
neuper@52125
|
48 |
setup {* KEStore_Elems.add_rlss [("univariate_equation_prls",
|
neuper@52125
|
49 |
(Context.theory_name @{theory}, prep_rls univariate_equation_prls))] *}
|
s1210629013@55359
|
50 |
setup {* KEStore_Elems.add_pbts
|
s1210629013@55339
|
51 |
[(prep_pbt thy "pbl_equ" [] e_pblID
|
s1210629013@55339
|
52 |
(["equation"],
|
s1210629013@55339
|
53 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
54 |
("#Where" ,["matches (?a = ?b) e_e"]),
|
s1210629013@55339
|
55 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55339
|
56 |
append_rls "equation_prls" e_rls [Calc ("Tools.matches",eval_matches "")],
|
s1210629013@55339
|
57 |
SOME "solve (e_e::bool, v_v)", [])),
|
s1210629013@55339
|
58 |
(prep_pbt thy "pbl_equ_univ" [] e_pblID
|
s1210629013@55339
|
59 |
(["univariate","equation"],
|
s1210629013@55339
|
60 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
61 |
("#Where" ,["matches (?a = ?b) e_e"]),
|
s1210629013@55339
|
62 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55339
|
63 |
univariate_equation_prls, SOME "solve (e_e::bool, v_v)", []))] *}
|
neuper@37950
|
64 |
|
neuper@37950
|
65 |
|
s1210629013@55339
|
66 |
ML{*
|
neuper@37950
|
67 |
(*.function for handling the cas-input "solve (x+1=2, x)":
|
neuper@37950
|
68 |
make a model which is already in ptree-internal format.*)
|
neuper@37950
|
69 |
(* val (h,argl) = strip_comb (str2term "solve (x+1=2, x)");
|
neuper@37950
|
70 |
val (h,argl) = strip_comb ((term_of o the o (parse thy))
|
neuper@37950
|
71 |
"solveTest (x+1=2, x)");
|
neuper@37950
|
72 |
*)
|
neuper@41972
|
73 |
fun argl2dtss [Const ("Product_Type.Pair", _) $ eq $ bdv] =
|
bonzai@41952
|
74 |
[((the o (parseNEW ctxt)) "equality", [eq]),
|
bonzai@41952
|
75 |
((the o (parseNEW ctxt)) "solveFor", [bdv]),
|
bonzai@41952
|
76 |
((the o (parseNEW ctxt)) "solutions",
|
bonzai@41952
|
77 |
[(the o (parseNEW ctxt)) "L"])
|
neuper@37950
|
78 |
]
|
neuper@38031
|
79 |
| argl2dtss _ = error "Equation.ML: wrong argument for argl2dtss";
|
s1210629013@52170
|
80 |
*}
|
s1210629013@52170
|
81 |
setup {* KEStore_Elems.add_cas
|
s1210629013@52170
|
82 |
[((term_of o the o (parse thy)) "solveTest",
|
s1210629013@52170
|
83 |
(("Test", ["univariate","equation","test"], ["no_met"]), argl2dtss)),
|
s1210629013@52170
|
84 |
((term_of o the o (parse thy)) "solve",
|
s1210629013@52170
|
85 |
(("Isac", ["univariate","equation"], ["no_met"]), argl2dtss))]*}
|
neuper@37950
|
86 |
|
neuper@37950
|
87 |
|
s1210629013@55373
|
88 |
setup {* KEStore_Elems.add_mets
|
s1210629013@55373
|
89 |
[prep_met thy "met_equ" [] e_metID
|
s1210629013@55373
|
90 |
(["Equation"], [],
|
s1210629013@55373
|
91 |
{rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls,
|
s1210629013@55373
|
92 |
errpats = [], nrls = e_rls},
|
s1210629013@55373
|
93 |
"empty_script")]
|
s1210629013@55373
|
94 |
*}
|
neuper@37950
|
95 |
|
neuper@37906
|
96 |
end |