neuper@37906
|
1 |
(* theory collecting all knowledge
|
neuper@37906
|
2 |
(predicates 'is_rootEq_in', 'is_sqrt_in', 'is_ratEq_in')
|
neuper@37906
|
3 |
for PolynomialEquations.
|
neuper@52140
|
4 |
alternative dependencies see @{theory "Isac"}
|
neuper@37906
|
5 |
created by: rlang
|
neuper@37906
|
6 |
date: 02.07
|
neuper@37906
|
7 |
changed by: rlang
|
neuper@37906
|
8 |
last change by: rlang
|
neuper@37906
|
9 |
date: 03.06.03
|
neuper@37954
|
10 |
(c) by Richard Lang, 2003
|
neuper@37906
|
11 |
*)
|
neuper@37906
|
12 |
|
neuper@37954
|
13 |
theory PolyEq imports LinEq RootRatEq begin
|
neuper@37906
|
14 |
|
neuper@37906
|
15 |
consts
|
neuper@37906
|
16 |
|
neuper@37906
|
17 |
(*---------scripts--------------------------*)
|
neuper@37906
|
18 |
Complete'_square
|
neuper@37954
|
19 |
:: "[bool,real,
|
neuper@37954
|
20 |
bool list] => bool list"
|
neuper@37954
|
21 |
("((Script Complete'_square (_ _ =))//
|
neuper@37954
|
22 |
(_))" 9)
|
neuper@37906
|
23 |
(*----- poly ----- *)
|
neuper@37906
|
24 |
Normalize'_poly
|
neuper@37954
|
25 |
:: "[bool,real,
|
neuper@37954
|
26 |
bool list] => bool list"
|
neuper@37954
|
27 |
("((Script Normalize'_poly (_ _=))//
|
neuper@37954
|
28 |
(_))" 9)
|
neuper@37906
|
29 |
Solve'_d0'_polyeq'_equation
|
neuper@37954
|
30 |
:: "[bool,real,
|
neuper@37954
|
31 |
bool list] => bool list"
|
neuper@37954
|
32 |
("((Script Solve'_d0'_polyeq'_equation (_ _ =))//
|
neuper@37954
|
33 |
(_))" 9)
|
neuper@37906
|
34 |
Solve'_d1'_polyeq'_equation
|
neuper@37954
|
35 |
:: "[bool,real,
|
neuper@37954
|
36 |
bool list] => bool list"
|
neuper@37954
|
37 |
("((Script Solve'_d1'_polyeq'_equation (_ _ =))//
|
neuper@37954
|
38 |
(_))" 9)
|
neuper@37906
|
39 |
Solve'_d2'_polyeq'_equation
|
neuper@37954
|
40 |
:: "[bool,real,
|
neuper@37954
|
41 |
bool list] => bool list"
|
neuper@37954
|
42 |
("((Script Solve'_d2'_polyeq'_equation (_ _ =))//
|
neuper@37954
|
43 |
(_))" 9)
|
neuper@37906
|
44 |
Solve'_d2'_polyeq'_sqonly'_equation
|
neuper@37954
|
45 |
:: "[bool,real,
|
neuper@37954
|
46 |
bool list] => bool list"
|
neuper@37954
|
47 |
("((Script Solve'_d2'_polyeq'_sqonly'_equation (_ _ =))//
|
neuper@37954
|
48 |
(_))" 9)
|
neuper@37906
|
49 |
Solve'_d2'_polyeq'_bdvonly'_equation
|
neuper@37954
|
50 |
:: "[bool,real,
|
neuper@37954
|
51 |
bool list] => bool list"
|
neuper@37954
|
52 |
("((Script Solve'_d2'_polyeq'_bdvonly'_equation (_ _ =))//
|
neuper@37954
|
53 |
(_))" 9)
|
neuper@37906
|
54 |
Solve'_d2'_polyeq'_pq'_equation
|
neuper@37954
|
55 |
:: "[bool,real,
|
neuper@37954
|
56 |
bool list] => bool list"
|
neuper@37954
|
57 |
("((Script Solve'_d2'_polyeq'_pq'_equation (_ _ =))//
|
neuper@37954
|
58 |
(_))" 9)
|
neuper@37906
|
59 |
Solve'_d2'_polyeq'_abc'_equation
|
neuper@37954
|
60 |
:: "[bool,real,
|
neuper@37954
|
61 |
bool list] => bool list"
|
neuper@37954
|
62 |
("((Script Solve'_d2'_polyeq'_abc'_equation (_ _ =))//
|
neuper@37954
|
63 |
(_))" 9)
|
neuper@37906
|
64 |
Solve'_d3'_polyeq'_equation
|
neuper@37954
|
65 |
:: "[bool,real,
|
neuper@37954
|
66 |
bool list] => bool list"
|
neuper@37954
|
67 |
("((Script Solve'_d3'_polyeq'_equation (_ _ =))//
|
neuper@37954
|
68 |
(_))" 9)
|
neuper@37906
|
69 |
Solve'_d4'_polyeq'_equation
|
neuper@37954
|
70 |
:: "[bool,real,
|
neuper@37954
|
71 |
bool list] => bool list"
|
neuper@37954
|
72 |
("((Script Solve'_d4'_polyeq'_equation (_ _ =))//
|
neuper@37954
|
73 |
(_))" 9)
|
neuper@37906
|
74 |
Biquadrat'_poly
|
neuper@37954
|
75 |
:: "[bool,real,
|
neuper@37954
|
76 |
bool list] => bool list"
|
neuper@37954
|
77 |
("((Script Biquadrat'_poly (_ _=))//
|
neuper@37954
|
78 |
(_))" 9)
|
neuper@37906
|
79 |
|
neuper@37906
|
80 |
(*-------------------- rules -------------------------------------------------*)
|
neuper@42394
|
81 |
(* type real enforced by op "^^^" *)
|
neuper@52148
|
82 |
axiomatization where
|
neuper@37983
|
83 |
cancel_leading_coeff1: "Not (c =!= 0) ==> (a + b*bdv + c*bdv^^^2 = 0) =
|
neuper@52148
|
84 |
(a/c + b/c*bdv + bdv^^^2 = 0)" and
|
neuper@37983
|
85 |
cancel_leading_coeff2: "Not (c =!= 0) ==> (a - b*bdv + c*bdv^^^2 = 0) =
|
neuper@52148
|
86 |
(a/c - b/c*bdv + bdv^^^2 = 0)" and
|
neuper@37983
|
87 |
cancel_leading_coeff3: "Not (c =!= 0) ==> (a + b*bdv - c*bdv^^^2 = 0) =
|
neuper@52148
|
88 |
(a/c + b/c*bdv - bdv^^^2 = 0)" and
|
neuper@37906
|
89 |
|
neuper@37983
|
90 |
cancel_leading_coeff4: "Not (c =!= 0) ==> (a + bdv + c*bdv^^^2 = 0) =
|
neuper@52148
|
91 |
(a/c + 1/c*bdv + bdv^^^2 = 0)" and
|
neuper@37983
|
92 |
cancel_leading_coeff5: "Not (c =!= 0) ==> (a - bdv + c*bdv^^^2 = 0) =
|
neuper@52148
|
93 |
(a/c - 1/c*bdv + bdv^^^2 = 0)" and
|
neuper@37983
|
94 |
cancel_leading_coeff6: "Not (c =!= 0) ==> (a + bdv - c*bdv^^^2 = 0) =
|
neuper@52148
|
95 |
(a/c + 1/c*bdv - bdv^^^2 = 0)" and
|
neuper@37906
|
96 |
|
neuper@37983
|
97 |
cancel_leading_coeff7: "Not (c =!= 0) ==> ( b*bdv + c*bdv^^^2 = 0) =
|
neuper@52148
|
98 |
( b/c*bdv + bdv^^^2 = 0)" and
|
neuper@37983
|
99 |
cancel_leading_coeff8: "Not (c =!= 0) ==> ( b*bdv - c*bdv^^^2 = 0) =
|
neuper@52148
|
100 |
( b/c*bdv - bdv^^^2 = 0)" and
|
neuper@37906
|
101 |
|
neuper@37983
|
102 |
cancel_leading_coeff9: "Not (c =!= 0) ==> ( bdv + c*bdv^^^2 = 0) =
|
neuper@52148
|
103 |
( 1/c*bdv + bdv^^^2 = 0)" and
|
neuper@37983
|
104 |
cancel_leading_coeff10:"Not (c =!= 0) ==> ( bdv - c*bdv^^^2 = 0) =
|
neuper@52148
|
105 |
( 1/c*bdv - bdv^^^2 = 0)" and
|
neuper@37906
|
106 |
|
neuper@37983
|
107 |
cancel_leading_coeff11:"Not (c =!= 0) ==> (a + b*bdv^^^2 = 0) =
|
neuper@52148
|
108 |
(a/b + bdv^^^2 = 0)" and
|
neuper@37983
|
109 |
cancel_leading_coeff12:"Not (c =!= 0) ==> (a - b*bdv^^^2 = 0) =
|
neuper@52148
|
110 |
(a/b - bdv^^^2 = 0)" and
|
neuper@37983
|
111 |
cancel_leading_coeff13:"Not (c =!= 0) ==> ( b*bdv^^^2 = 0) =
|
neuper@52148
|
112 |
( bdv^^^2 = 0/b)" and
|
neuper@37906
|
113 |
|
neuper@37983
|
114 |
complete_square1: "(q + p*bdv + bdv^^^2 = 0) =
|
neuper@52148
|
115 |
(q + (p/2 + bdv)^^^2 = (p/2)^^^2)" and
|
neuper@37983
|
116 |
complete_square2: "( p*bdv + bdv^^^2 = 0) =
|
neuper@52148
|
117 |
( (p/2 + bdv)^^^2 = (p/2)^^^2)" and
|
neuper@37983
|
118 |
complete_square3: "( bdv + bdv^^^2 = 0) =
|
neuper@52148
|
119 |
( (1/2 + bdv)^^^2 = (1/2)^^^2)" and
|
neuper@37906
|
120 |
|
neuper@37983
|
121 |
complete_square4: "(q - p*bdv + bdv^^^2 = 0) =
|
neuper@52148
|
122 |
(q + (p/2 - bdv)^^^2 = (p/2)^^^2)" and
|
neuper@37983
|
123 |
complete_square5: "(q + p*bdv - bdv^^^2 = 0) =
|
neuper@52148
|
124 |
(q + (p/2 - bdv)^^^2 = (p/2)^^^2)" and
|
neuper@37906
|
125 |
|
neuper@52148
|
126 |
square_explicit1: "(a + b^^^2 = c) = ( b^^^2 = c - a)" and
|
neuper@52148
|
127 |
square_explicit2: "(a - b^^^2 = c) = (-(b^^^2) = c - a)" and
|
neuper@37906
|
128 |
|
neuper@42318
|
129 |
(*bdv_explicit* required type constrain to real in --- (-8 - 2*x + x^^^2 = 0), by rewriting ---*)
|
neuper@52148
|
130 |
bdv_explicit1: "(a + bdv = b) = (bdv = - a + (b::real))" and
|
neuper@52148
|
131 |
bdv_explicit2: "(a - bdv = b) = ((-1)*bdv = - a + (b::real))" and
|
neuper@52148
|
132 |
bdv_explicit3: "((-1)*bdv = b) = (bdv = (-1)*(b::real))" and
|
neuper@37906
|
133 |
|
neuper@52148
|
134 |
plus_leq: "(0 <= a + b) = ((-1)*b <= a)"(*Isa?*) and
|
neuper@52148
|
135 |
minus_leq: "(0 <= a - b) = ( b <= a)"(*Isa?*) and
|
neuper@37906
|
136 |
|
neuper@37906
|
137 |
(*-- normalize --*)
|
neuper@37906
|
138 |
(*WN0509 compare LinEq.all_left "[|Not(b=!=0)|] ==> (a=b) = (a+(-1)*b=0)"*)
|
neuper@52148
|
139 |
all_left: "[|Not(b=!=0)|] ==> (a = b) = (a - b = 0)" and
|
neuper@52148
|
140 |
makex1_x: "a^^^1 = a" and
|
neuper@52148
|
141 |
real_assoc_1: "a+(b+c) = a+b+c" and
|
neuper@52148
|
142 |
real_assoc_2: "a*(b*c) = a*b*c" and
|
neuper@37906
|
143 |
|
neuper@37906
|
144 |
(* ---- degree 0 ----*)
|
neuper@52148
|
145 |
d0_true: "(0=0) = True" and
|
neuper@52148
|
146 |
d0_false: "[|Not(bdv occurs_in a);Not(a=0)|] ==> (a=0) = False" and
|
neuper@37906
|
147 |
(* ---- degree 1 ----*)
|
neuper@37983
|
148 |
d1_isolate_add1:
|
neuper@52148
|
149 |
"[|Not(bdv occurs_in a)|] ==> (a + b*bdv = 0) = (b*bdv = (-1)*a)" and
|
neuper@37983
|
150 |
d1_isolate_add2:
|
neuper@52148
|
151 |
"[|Not(bdv occurs_in a)|] ==> (a + bdv = 0) = ( bdv = (-1)*a)" and
|
neuper@37983
|
152 |
d1_isolate_div:
|
neuper@52148
|
153 |
"[|Not(b=0);Not(bdv occurs_in c)|] ==> (b*bdv = c) = (bdv = c/b)" and
|
neuper@37906
|
154 |
(* ---- degree 2 ----*)
|
neuper@37983
|
155 |
d2_isolate_add1:
|
neuper@52148
|
156 |
"[|Not(bdv occurs_in a)|] ==> (a + b*bdv^^^2=0) = (b*bdv^^^2= (-1)*a)" and
|
neuper@37983
|
157 |
d2_isolate_add2:
|
neuper@52148
|
158 |
"[|Not(bdv occurs_in a)|] ==> (a + bdv^^^2=0) = ( bdv^^^2= (-1)*a)" and
|
neuper@37983
|
159 |
d2_isolate_div:
|
neuper@52148
|
160 |
"[|Not(b=0);Not(bdv occurs_in c)|] ==> (b*bdv^^^2=c) = (bdv^^^2=c/b)" and
|
neuper@42394
|
161 |
|
neuper@52148
|
162 |
d2_prescind1: "(a*bdv + b*bdv^^^2 = 0) = (bdv*(a +b*bdv)=0)" and
|
neuper@52148
|
163 |
d2_prescind2: "(a*bdv + bdv^^^2 = 0) = (bdv*(a + bdv)=0)" and
|
neuper@52148
|
164 |
d2_prescind3: "( bdv + b*bdv^^^2 = 0) = (bdv*(1+b*bdv)=0)" and
|
neuper@52148
|
165 |
d2_prescind4: "( bdv + bdv^^^2 = 0) = (bdv*(1+ bdv)=0)" and
|
neuper@37906
|
166 |
(* eliminate degree 2 *)
|
neuper@37906
|
167 |
(* thm for neg arguments in sqroot have postfix _neg *)
|
neuper@37983
|
168 |
d2_sqrt_equation1: "[|(0<=c);Not(bdv occurs_in c)|] ==>
|
neuper@52148
|
169 |
(bdv^^^2=c) = ((bdv=sqrt c) | (bdv=(-1)*sqrt c ))" and
|
t@42197
|
170 |
d2_sqrt_equation1_neg:
|
neuper@52148
|
171 |
"[|(c<0);Not(bdv occurs_in c)|] ==> (bdv^^^2=c) = False" and
|
neuper@52148
|
172 |
d2_sqrt_equation2: "(bdv^^^2=0) = (bdv=0)" and
|
neuper@37983
|
173 |
d2_sqrt_equation3: "(b*bdv^^^2=0) = (bdv=0)"
|
neuper@52148
|
174 |
axiomatization where (*AK..if replaced by "and" we get errors:
|
t@42203
|
175 |
exception PTREE "nth _ []" raised
|
t@42203
|
176 |
(line 783 of "/usr/local/isabisac/src/Tools/isac/Interpret/ctree.sml"):
|
t@42203
|
177 |
'fun nth _ [] = raise PTREE "nth _ []"'
|
t@42203
|
178 |
and
|
t@42203
|
179 |
exception Bind raised
|
t@42203
|
180 |
(line 1097 of "/usr/local/isabisac/test/Tools/isac/Frontend/interface.sml"):
|
t@42203
|
181 |
'val (Form f, tac, asms) = pt_extract (pt, p);' *)
|
neuper@42394
|
182 |
(* WN120315 these 2 thms need "::real", because no "^^^" constrains type as
|
neuper@42394
|
183 |
required in test --- rls d2_polyeq_bdv_only_simplify --- *)
|
neuper@52148
|
184 |
d2_reduce_equation1: "(bdv*(a +b*bdv)=0) = ((bdv=0)|(a+b*bdv=(0::real)))" and
|
neuper@42394
|
185 |
d2_reduce_equation2: "(bdv*(a + bdv)=0) = ((bdv=0)|(a+ bdv=(0::real)))"
|
neuper@52148
|
186 |
|
neuper@52148
|
187 |
axiomatization where (*..if replaced by "and" we get errors:
|
t@42203
|
188 |
exception PTREE "nth _ []" raised
|
t@42203
|
189 |
(line 783 of "/usr/local/isabisac/src/Tools/isac/Interpret/ctree.sml"):
|
t@42203
|
190 |
'fun nth _ [] = raise PTREE "nth _ []"'
|
t@42203
|
191 |
and
|
t@42203
|
192 |
exception Bind raised
|
t@42203
|
193 |
(line 1097 of "/usr/local/isabisac/test/Tools/isac/Frontend/interface.sml"):
|
t@42203
|
194 |
'val (Form f, tac, asms) = pt_extract (pt, p);' *)
|
t@42197
|
195 |
d2_pqformula1: "[|0<=p^^^2 - 4*q|] ==> (q+p*bdv+ bdv^^^2=0) =
|
neuper@37954
|
196 |
((bdv= (-1)*(p/2) + sqrt(p^^^2 - 4*q)/2)
|
neuper@52148
|
197 |
| (bdv= (-1)*(p/2) - sqrt(p^^^2 - 4*q)/2))" and
|
neuper@52148
|
198 |
d2_pqformula1_neg: "[|p^^^2 - 4*q<0|] ==> (q+p*bdv+ bdv^^^2=0) = False" and
|
neuper@37983
|
199 |
d2_pqformula2: "[|0<=p^^^2 - 4*q|] ==> (q+p*bdv+1*bdv^^^2=0) =
|
neuper@37954
|
200 |
((bdv= (-1)*(p/2) + sqrt(p^^^2 - 4*q)/2)
|
neuper@52148
|
201 |
| (bdv= (-1)*(p/2) - sqrt(p^^^2 - 4*q)/2))" and
|
neuper@52148
|
202 |
d2_pqformula2_neg: "[|p^^^2 - 4*q<0|] ==> (q+p*bdv+1*bdv^^^2=0) = False" and
|
neuper@37983
|
203 |
d2_pqformula3: "[|0<=1 - 4*q|] ==> (q+ bdv+ bdv^^^2=0) =
|
neuper@37954
|
204 |
((bdv= (-1)*(1/2) + sqrt(1 - 4*q)/2)
|
neuper@52148
|
205 |
| (bdv= (-1)*(1/2) - sqrt(1 - 4*q)/2))" and
|
neuper@52148
|
206 |
d2_pqformula3_neg: "[|1 - 4*q<0|] ==> (q+ bdv+ bdv^^^2=0) = False" and
|
neuper@37983
|
207 |
d2_pqformula4: "[|0<=1 - 4*q|] ==> (q+ bdv+1*bdv^^^2=0) =
|
neuper@37954
|
208 |
((bdv= (-1)*(1/2) + sqrt(1 - 4*q)/2)
|
neuper@52148
|
209 |
| (bdv= (-1)*(1/2) - sqrt(1 - 4*q)/2))" and
|
neuper@52148
|
210 |
d2_pqformula4_neg: "[|1 - 4*q<0|] ==> (q+ bdv+1*bdv^^^2=0) = False" and
|
neuper@37983
|
211 |
d2_pqformula5: "[|0<=p^^^2 - 0|] ==> ( p*bdv+ bdv^^^2=0) =
|
neuper@37954
|
212 |
((bdv= (-1)*(p/2) + sqrt(p^^^2 - 0)/2)
|
neuper@52148
|
213 |
| (bdv= (-1)*(p/2) - sqrt(p^^^2 - 0)/2))" and
|
t@42203
|
214 |
(* d2_pqformula5_neg not need p^2 never less zero in R *)
|
neuper@37983
|
215 |
d2_pqformula6: "[|0<=p^^^2 - 0|] ==> ( p*bdv+1*bdv^^^2=0) =
|
neuper@37954
|
216 |
((bdv= (-1)*(p/2) + sqrt(p^^^2 - 0)/2)
|
neuper@52148
|
217 |
| (bdv= (-1)*(p/2) - sqrt(p^^^2 - 0)/2))" and
|
neuper@37906
|
218 |
(* d2_pqformula6_neg not need p^2 never less zero in R *)
|
t@42203
|
219 |
d2_pqformula7: "[|0<=1 - 0|] ==> ( bdv+ bdv^^^2=0) =
|
neuper@37954
|
220 |
((bdv= (-1)*(1/2) + sqrt(1 - 0)/2)
|
neuper@52148
|
221 |
| (bdv= (-1)*(1/2) - sqrt(1 - 0)/2))" and
|
neuper@37906
|
222 |
(* d2_pqformula7_neg not need, because 1<0 ==> False*)
|
neuper@37983
|
223 |
d2_pqformula8: "[|0<=1 - 0|] ==> ( bdv+1*bdv^^^2=0) =
|
neuper@37954
|
224 |
((bdv= (-1)*(1/2) + sqrt(1 - 0)/2)
|
neuper@52148
|
225 |
| (bdv= (-1)*(1/2) - sqrt(1 - 0)/2))" and
|
neuper@37906
|
226 |
(* d2_pqformula8_neg not need, because 1<0 ==> False*)
|
neuper@37983
|
227 |
d2_pqformula9: "[|Not(bdv occurs_in q); 0<= (-1)*4*q|] ==>
|
neuper@37954
|
228 |
(q+ 1*bdv^^^2=0) = ((bdv= 0 + sqrt(0 - 4*q)/2)
|
neuper@52148
|
229 |
| (bdv= 0 - sqrt(0 - 4*q)/2))" and
|
neuper@37983
|
230 |
d2_pqformula9_neg:
|
neuper@52148
|
231 |
"[|Not(bdv occurs_in q); (-1)*4*q<0|] ==> (q+ 1*bdv^^^2=0) = False" and
|
neuper@37983
|
232 |
d2_pqformula10:
|
neuper@37906
|
233 |
"[|Not(bdv occurs_in q); 0<= (-1)*4*q|] ==> (q+ bdv^^^2=0) =
|
neuper@37906
|
234 |
((bdv= 0 + sqrt(0 - 4*q)/2)
|
neuper@52148
|
235 |
| (bdv= 0 - sqrt(0 - 4*q)/2))" and
|
neuper@37983
|
236 |
d2_pqformula10_neg:
|
neuper@52148
|
237 |
"[|Not(bdv occurs_in q); (-1)*4*q<0|] ==> (q+ bdv^^^2=0) = False" and
|
neuper@37983
|
238 |
d2_abcformula1:
|
neuper@37906
|
239 |
"[|0<=b^^^2 - 4*a*c|] ==> (c + b*bdv+a*bdv^^^2=0) =
|
neuper@37906
|
240 |
((bdv=( -b + sqrt(b^^^2 - 4*a*c))/(2*a))
|
neuper@52148
|
241 |
| (bdv=( -b - sqrt(b^^^2 - 4*a*c))/(2*a)))" and
|
neuper@37983
|
242 |
d2_abcformula1_neg:
|
neuper@52148
|
243 |
"[|b^^^2 - 4*a*c<0|] ==> (c + b*bdv+a*bdv^^^2=0) = False" and
|
neuper@37983
|
244 |
d2_abcformula2:
|
neuper@37906
|
245 |
"[|0<=1 - 4*a*c|] ==> (c+ bdv+a*bdv^^^2=0) =
|
neuper@37906
|
246 |
((bdv=( -1 + sqrt(1 - 4*a*c))/(2*a))
|
neuper@52148
|
247 |
| (bdv=( -1 - sqrt(1 - 4*a*c))/(2*a)))" and
|
neuper@37983
|
248 |
d2_abcformula2_neg:
|
neuper@52148
|
249 |
"[|1 - 4*a*c<0|] ==> (c+ bdv+a*bdv^^^2=0) = False" and
|
neuper@37983
|
250 |
d2_abcformula3:
|
neuper@37906
|
251 |
"[|0<=b^^^2 - 4*1*c|] ==> (c + b*bdv+ bdv^^^2=0) =
|
neuper@37906
|
252 |
((bdv=( -b + sqrt(b^^^2 - 4*1*c))/(2*1))
|
neuper@52148
|
253 |
| (bdv=( -b - sqrt(b^^^2 - 4*1*c))/(2*1)))" and
|
neuper@37983
|
254 |
d2_abcformula3_neg:
|
neuper@52148
|
255 |
"[|b^^^2 - 4*1*c<0|] ==> (c + b*bdv+ bdv^^^2=0) = False" and
|
neuper@37983
|
256 |
d2_abcformula4:
|
neuper@37906
|
257 |
"[|0<=1 - 4*1*c|] ==> (c + bdv+ bdv^^^2=0) =
|
neuper@37906
|
258 |
((bdv=( -1 + sqrt(1 - 4*1*c))/(2*1))
|
neuper@52148
|
259 |
| (bdv=( -1 - sqrt(1 - 4*1*c))/(2*1)))" and
|
neuper@37983
|
260 |
d2_abcformula4_neg:
|
neuper@52148
|
261 |
"[|1 - 4*1*c<0|] ==> (c + bdv+ bdv^^^2=0) = False" and
|
neuper@37983
|
262 |
d2_abcformula5:
|
neuper@37906
|
263 |
"[|Not(bdv occurs_in c); 0<=0 - 4*a*c|] ==> (c + a*bdv^^^2=0) =
|
neuper@37906
|
264 |
((bdv=( 0 + sqrt(0 - 4*a*c))/(2*a))
|
neuper@52148
|
265 |
| (bdv=( 0 - sqrt(0 - 4*a*c))/(2*a)))" and
|
neuper@37983
|
266 |
d2_abcformula5_neg:
|
neuper@52148
|
267 |
"[|Not(bdv occurs_in c); 0 - 4*a*c<0|] ==> (c + a*bdv^^^2=0) = False" and
|
neuper@37983
|
268 |
d2_abcformula6:
|
neuper@37906
|
269 |
"[|Not(bdv occurs_in c); 0<=0 - 4*1*c|] ==> (c+ bdv^^^2=0) =
|
neuper@37906
|
270 |
((bdv=( 0 + sqrt(0 - 4*1*c))/(2*1))
|
neuper@52148
|
271 |
| (bdv=( 0 - sqrt(0 - 4*1*c))/(2*1)))" and
|
neuper@37983
|
272 |
d2_abcformula6_neg:
|
neuper@52148
|
273 |
"[|Not(bdv occurs_in c); 0 - 4*1*c<0|] ==> (c+ bdv^^^2=0) = False" and
|
neuper@37983
|
274 |
d2_abcformula7:
|
neuper@37906
|
275 |
"[|0<=b^^^2 - 0|] ==> ( b*bdv+a*bdv^^^2=0) =
|
neuper@37906
|
276 |
((bdv=( -b + sqrt(b^^^2 - 0))/(2*a))
|
neuper@52148
|
277 |
| (bdv=( -b - sqrt(b^^^2 - 0))/(2*a)))" and
|
neuper@37906
|
278 |
(* d2_abcformula7_neg not need b^2 never less zero in R *)
|
neuper@37983
|
279 |
d2_abcformula8:
|
neuper@37906
|
280 |
"[|0<=b^^^2 - 0|] ==> ( b*bdv+ bdv^^^2=0) =
|
neuper@37906
|
281 |
((bdv=( -b + sqrt(b^^^2 - 0))/(2*1))
|
neuper@52148
|
282 |
| (bdv=( -b - sqrt(b^^^2 - 0))/(2*1)))" and
|
neuper@37906
|
283 |
(* d2_abcformula8_neg not need b^2 never less zero in R *)
|
neuper@37983
|
284 |
d2_abcformula9:
|
neuper@37906
|
285 |
"[|0<=1 - 0|] ==> ( bdv+a*bdv^^^2=0) =
|
neuper@37906
|
286 |
((bdv=( -1 + sqrt(1 - 0))/(2*a))
|
neuper@52148
|
287 |
| (bdv=( -1 - sqrt(1 - 0))/(2*a)))" and
|
neuper@37906
|
288 |
(* d2_abcformula9_neg not need, because 1<0 ==> False*)
|
neuper@37983
|
289 |
d2_abcformula10:
|
neuper@37906
|
290 |
"[|0<=1 - 0|] ==> ( bdv+ bdv^^^2=0) =
|
neuper@37906
|
291 |
((bdv=( -1 + sqrt(1 - 0))/(2*1))
|
neuper@52148
|
292 |
| (bdv=( -1 - sqrt(1 - 0))/(2*1)))" and
|
neuper@37906
|
293 |
(* d2_abcformula10_neg not need, because 1<0 ==> False*)
|
neuper@37906
|
294 |
|
t@42203
|
295 |
|
neuper@37906
|
296 |
(* ---- degree 3 ----*)
|
neuper@37983
|
297 |
d3_reduce_equation1:
|
neuper@52148
|
298 |
"(a*bdv + b*bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | (a + b*bdv + c*bdv^^^2=0))" and
|
neuper@37983
|
299 |
d3_reduce_equation2:
|
neuper@52148
|
300 |
"( bdv + b*bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | (1 + b*bdv + c*bdv^^^2=0))" and
|
neuper@37983
|
301 |
d3_reduce_equation3:
|
neuper@52148
|
302 |
"(a*bdv + bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | (a + bdv + c*bdv^^^2=0))" and
|
neuper@37983
|
303 |
d3_reduce_equation4:
|
neuper@52148
|
304 |
"( bdv + bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | (1 + bdv + c*bdv^^^2=0))" and
|
neuper@37983
|
305 |
d3_reduce_equation5:
|
neuper@52148
|
306 |
"(a*bdv + b*bdv^^^2 + bdv^^^3=0) = (bdv=0 | (a + b*bdv + bdv^^^2=0))" and
|
neuper@37983
|
307 |
d3_reduce_equation6:
|
neuper@52148
|
308 |
"( bdv + b*bdv^^^2 + bdv^^^3=0) = (bdv=0 | (1 + b*bdv + bdv^^^2=0))" and
|
neuper@37983
|
309 |
d3_reduce_equation7:
|
neuper@52148
|
310 |
"(a*bdv + bdv^^^2 + bdv^^^3=0) = (bdv=0 | (1 + bdv + bdv^^^2=0))" and
|
neuper@37983
|
311 |
d3_reduce_equation8:
|
neuper@52148
|
312 |
"( bdv + bdv^^^2 + bdv^^^3=0) = (bdv=0 | (1 + bdv + bdv^^^2=0))" and
|
neuper@37983
|
313 |
d3_reduce_equation9:
|
neuper@52148
|
314 |
"(a*bdv + c*bdv^^^3=0) = (bdv=0 | (a + c*bdv^^^2=0))" and
|
neuper@37983
|
315 |
d3_reduce_equation10:
|
neuper@52148
|
316 |
"( bdv + c*bdv^^^3=0) = (bdv=0 | (1 + c*bdv^^^2=0))" and
|
neuper@37983
|
317 |
d3_reduce_equation11:
|
neuper@52148
|
318 |
"(a*bdv + bdv^^^3=0) = (bdv=0 | (a + bdv^^^2=0))" and
|
neuper@37983
|
319 |
d3_reduce_equation12:
|
neuper@52148
|
320 |
"( bdv + bdv^^^3=0) = (bdv=0 | (1 + bdv^^^2=0))" and
|
neuper@37983
|
321 |
d3_reduce_equation13:
|
neuper@52148
|
322 |
"( b*bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | ( b*bdv + c*bdv^^^2=0))" and
|
neuper@37983
|
323 |
d3_reduce_equation14:
|
neuper@52148
|
324 |
"( bdv^^^2 + c*bdv^^^3=0) = (bdv=0 | ( bdv + c*bdv^^^2=0))" and
|
neuper@37983
|
325 |
d3_reduce_equation15:
|
neuper@52148
|
326 |
"( b*bdv^^^2 + bdv^^^3=0) = (bdv=0 | ( b*bdv + bdv^^^2=0))" and
|
neuper@37983
|
327 |
d3_reduce_equation16:
|
neuper@52148
|
328 |
"( bdv^^^2 + bdv^^^3=0) = (bdv=0 | ( bdv + bdv^^^2=0))" and
|
neuper@37983
|
329 |
d3_isolate_add1:
|
neuper@52148
|
330 |
"[|Not(bdv occurs_in a)|] ==> (a + b*bdv^^^3=0) = (b*bdv^^^3= (-1)*a)" and
|
neuper@37983
|
331 |
d3_isolate_add2:
|
neuper@52148
|
332 |
"[|Not(bdv occurs_in a)|] ==> (a + bdv^^^3=0) = ( bdv^^^3= (-1)*a)" and
|
neuper@37983
|
333 |
d3_isolate_div:
|
neuper@52148
|
334 |
"[|Not(b=0);Not(bdv occurs_in a)|] ==> (b*bdv^^^3=c) = (bdv^^^3=c/b)" and
|
neuper@37983
|
335 |
d3_root_equation2:
|
neuper@52148
|
336 |
"(bdv^^^3=0) = (bdv=0)" and
|
neuper@37983
|
337 |
d3_root_equation1:
|
neuper@52148
|
338 |
"(bdv^^^3=c) = (bdv = nroot 3 c)" and
|
neuper@37906
|
339 |
|
neuper@37906
|
340 |
(* ---- degree 4 ----*)
|
neuper@37906
|
341 |
(* RL03.FIXME es wir nicht getestet ob u>0 *)
|
neuper@37989
|
342 |
d4_sub_u1:
|
neuper@37906
|
343 |
"(c+b*bdv^^^2+a*bdv^^^4=0) =
|
neuper@52148
|
344 |
((a*u^^^2+b*u+c=0) & (bdv^^^2=u))" and
|
neuper@37906
|
345 |
|
neuper@37906
|
346 |
(* ---- 7.3.02 von Termorder ---- *)
|
neuper@37906
|
347 |
|
neuper@52148
|
348 |
bdv_collect_1: "l * bdv + m * bdv = (l + m) * bdv" and
|
neuper@52148
|
349 |
bdv_collect_2: "bdv + m * bdv = (1 + m) * bdv" and
|
neuper@52148
|
350 |
bdv_collect_3: "l * bdv + bdv = (l + 1) * bdv" and
|
neuper@37906
|
351 |
|
neuper@37906
|
352 |
(* bdv_collect_assoc0_1 "l * bdv + m * bdv + k = (l + m) * bdv + k"
|
neuper@37906
|
353 |
bdv_collect_assoc0_2 "bdv + m * bdv + k = (1 + m) * bdv + k"
|
neuper@37906
|
354 |
bdv_collect_assoc0_3 "l * bdv + bdv + k = (l + 1) * bdv + k"
|
neuper@37906
|
355 |
*)
|
neuper@52148
|
356 |
bdv_collect_assoc1_1: "l * bdv + (m * bdv + k) = (l + m) * bdv + k" and
|
neuper@52148
|
357 |
bdv_collect_assoc1_2: "bdv + (m * bdv + k) = (1 + m) * bdv + k" and
|
neuper@52148
|
358 |
bdv_collect_assoc1_3: "l * bdv + (bdv + k) = (l + 1) * bdv + k" and
|
neuper@38030
|
359 |
|
neuper@52148
|
360 |
bdv_collect_assoc2_1: "k + l * bdv + m * bdv = k + (l + m) * bdv" and
|
neuper@52148
|
361 |
bdv_collect_assoc2_2: "k + bdv + m * bdv = k + (1 + m) * bdv" and
|
neuper@52148
|
362 |
bdv_collect_assoc2_3: "k + l * bdv + bdv = k + (l + 1) * bdv" and
|
neuper@37906
|
363 |
|
neuper@37906
|
364 |
|
neuper@52148
|
365 |
bdv_n_collect_1: "l * bdv^^^n + m * bdv^^^n = (l + m) * bdv^^^n" and
|
neuper@52148
|
366 |
bdv_n_collect_2: " bdv^^^n + m * bdv^^^n = (1 + m) * bdv^^^n" and
|
neuper@52148
|
367 |
bdv_n_collect_3: "l * bdv^^^n + bdv^^^n = (l + 1) * bdv^^^n" (*order!*) and
|
neuper@37906
|
368 |
|
neuper@38030
|
369 |
bdv_n_collect_assoc1_1:
|
neuper@52148
|
370 |
"l * bdv^^^n + (m * bdv^^^n + k) = (l + m) * bdv^^^n + k" and
|
neuper@52148
|
371 |
bdv_n_collect_assoc1_2: "bdv^^^n + (m * bdv^^^n + k) = (1 + m) * bdv^^^n + k" and
|
neuper@52148
|
372 |
bdv_n_collect_assoc1_3: "l * bdv^^^n + (bdv^^^n + k) = (l + 1) * bdv^^^n + k" and
|
neuper@37906
|
373 |
|
neuper@52148
|
374 |
bdv_n_collect_assoc2_1: "k + l * bdv^^^n + m * bdv^^^n = k +(l + m) * bdv^^^n" and
|
neuper@52148
|
375 |
bdv_n_collect_assoc2_2: "k + bdv^^^n + m * bdv^^^n = k + (1 + m) * bdv^^^n" and
|
neuper@52148
|
376 |
bdv_n_collect_assoc2_3: "k + l * bdv^^^n + bdv^^^n = k + (l + 1) * bdv^^^n" and
|
neuper@37906
|
377 |
|
neuper@37906
|
378 |
(*WN.14.3.03*)
|
neuper@52148
|
379 |
real_minus_div: "- (a / b) = (-1 * a) / b" and
|
neuper@38030
|
380 |
|
neuper@52148
|
381 |
separate_bdv: "(a * bdv) / b = (a / b) * (bdv::real)" and
|
neuper@52148
|
382 |
separate_bdv_n: "(a * bdv ^^^ n) / b = (a / b) * bdv ^^^ n" and
|
neuper@52148
|
383 |
separate_1_bdv: "bdv / b = (1 / b) * (bdv::real)" and
|
neuper@38030
|
384 |
separate_1_bdv_n: "bdv ^^^ n / b = (1 / b) * bdv ^^^ n"
|
neuper@37906
|
385 |
|
neuper@37954
|
386 |
ML {*
|
neuper@37972
|
387 |
val thy = @{theory};
|
neuper@37972
|
388 |
|
neuper@37954
|
389 |
(*-------------------------rulse-------------------------*)
|
neuper@37954
|
390 |
val PolyEq_prls = (*3.10.02:just the following order due to subterm evaluation*)
|
neuper@37954
|
391 |
append_rls "PolyEq_prls" e_rls
|
neuper@37954
|
392 |
[Calc ("Atools.ident",eval_ident "#ident_"),
|
neuper@37954
|
393 |
Calc ("Tools.matches",eval_matches ""),
|
neuper@37954
|
394 |
Calc ("Tools.lhs" ,eval_lhs ""),
|
neuper@37954
|
395 |
Calc ("Tools.rhs" ,eval_rhs ""),
|
neuper@37954
|
396 |
Calc ("Poly.is'_expanded'_in",eval_is_expanded_in ""),
|
neuper@37954
|
397 |
Calc ("Poly.is'_poly'_in",eval_is_poly_in ""),
|
neuper@37954
|
398 |
Calc ("Poly.has'_degree'_in",eval_has_degree_in ""),
|
neuper@37954
|
399 |
Calc ("Poly.is'_polyrat'_in",eval_is_polyrat_in ""),
|
neuper@37954
|
400 |
(*Calc ("Atools.occurs'_in",eval_occurs_in ""), *)
|
neuper@37954
|
401 |
(*Calc ("Atools.is'_const",eval_const "#is_const_"),*)
|
neuper@41922
|
402 |
Calc ("HOL.eq",eval_equal "#equal_"),
|
neuper@37954
|
403 |
Calc ("RootEq.is'_rootTerm'_in",eval_is_rootTerm_in ""),
|
neuper@37954
|
404 |
Calc ("RatEq.is'_ratequation'_in",eval_is_ratequation_in ""),
|
neuper@37969
|
405 |
Thm ("not_true",num_str @{thm not_true}),
|
neuper@37969
|
406 |
Thm ("not_false",num_str @{thm not_false}),
|
neuper@37969
|
407 |
Thm ("and_true",num_str @{thm and_true}),
|
neuper@37969
|
408 |
Thm ("and_false",num_str @{thm and_false}),
|
neuper@37969
|
409 |
Thm ("or_true",num_str @{thm or_true}),
|
neuper@37969
|
410 |
Thm ("or_false",num_str @{thm or_false})
|
neuper@37954
|
411 |
];
|
neuper@37954
|
412 |
|
neuper@37954
|
413 |
val PolyEq_erls =
|
neuper@37954
|
414 |
merge_rls "PolyEq_erls" LinEq_erls
|
neuper@37954
|
415 |
(append_rls "ops_preds" calculate_Rational
|
neuper@41922
|
416 |
[Calc ("HOL.eq",eval_equal "#equal_"),
|
neuper@37969
|
417 |
Thm ("plus_leq", num_str @{thm plus_leq}),
|
neuper@37969
|
418 |
Thm ("minus_leq", num_str @{thm minus_leq}),
|
neuper@37969
|
419 |
Thm ("rat_leq1", num_str @{thm rat_leq1}),
|
neuper@37969
|
420 |
Thm ("rat_leq2", num_str @{thm rat_leq2}),
|
neuper@37969
|
421 |
Thm ("rat_leq3", num_str @{thm rat_leq3})
|
neuper@37954
|
422 |
]);
|
neuper@37954
|
423 |
|
neuper@37954
|
424 |
val PolyEq_crls =
|
neuper@37954
|
425 |
merge_rls "PolyEq_crls" LinEq_crls
|
neuper@37954
|
426 |
(append_rls "ops_preds" calculate_Rational
|
neuper@41922
|
427 |
[Calc ("HOL.eq",eval_equal "#equal_"),
|
neuper@37969
|
428 |
Thm ("plus_leq", num_str @{thm plus_leq}),
|
neuper@37969
|
429 |
Thm ("minus_leq", num_str @{thm minus_leq}),
|
neuper@37969
|
430 |
Thm ("rat_leq1", num_str @{thm rat_leq1}),
|
neuper@37969
|
431 |
Thm ("rat_leq2", num_str @{thm rat_leq2}),
|
neuper@37969
|
432 |
Thm ("rat_leq3", num_str @{thm rat_leq3})
|
neuper@37954
|
433 |
]);
|
neuper@37954
|
434 |
|
neuper@37954
|
435 |
val cancel_leading_coeff = prep_rls(
|
neuper@37954
|
436 |
Rls {id = "cancel_leading_coeff", preconds = [],
|
neuper@37954
|
437 |
rew_ord = ("e_rew_ord",e_rew_ord),
|
neuper@42451
|
438 |
erls = PolyEq_erls, srls = Erls, calc = [], errpatts = [],
|
neuper@37989
|
439 |
rules =
|
neuper@37989
|
440 |
[Thm ("cancel_leading_coeff1",num_str @{thm cancel_leading_coeff1}),
|
neuper@37989
|
441 |
Thm ("cancel_leading_coeff2",num_str @{thm cancel_leading_coeff2}),
|
neuper@37989
|
442 |
Thm ("cancel_leading_coeff3",num_str @{thm cancel_leading_coeff3}),
|
neuper@37989
|
443 |
Thm ("cancel_leading_coeff4",num_str @{thm cancel_leading_coeff4}),
|
neuper@37989
|
444 |
Thm ("cancel_leading_coeff5",num_str @{thm cancel_leading_coeff5}),
|
neuper@37989
|
445 |
Thm ("cancel_leading_coeff6",num_str @{thm cancel_leading_coeff6}),
|
neuper@37989
|
446 |
Thm ("cancel_leading_coeff7",num_str @{thm cancel_leading_coeff7}),
|
neuper@37989
|
447 |
Thm ("cancel_leading_coeff8",num_str @{thm cancel_leading_coeff8}),
|
neuper@37989
|
448 |
Thm ("cancel_leading_coeff9",num_str @{thm cancel_leading_coeff9}),
|
neuper@37989
|
449 |
Thm ("cancel_leading_coeff10",num_str @{thm cancel_leading_coeff10}),
|
neuper@37989
|
450 |
Thm ("cancel_leading_coeff11",num_str @{thm cancel_leading_coeff11}),
|
neuper@37989
|
451 |
Thm ("cancel_leading_coeff12",num_str @{thm cancel_leading_coeff12}),
|
neuper@37989
|
452 |
Thm ("cancel_leading_coeff13",num_str @{thm cancel_leading_coeff13})
|
neuper@48763
|
453 |
],scr = Prog ((term_of o the o (parse thy)) "empty_script")}:rls);
|
neuper@37989
|
454 |
*}
|
neuper@37989
|
455 |
ML{*
|
neuper@37954
|
456 |
val complete_square = prep_rls(
|
neuper@37954
|
457 |
Rls {id = "complete_square", preconds = [],
|
neuper@37954
|
458 |
rew_ord = ("e_rew_ord",e_rew_ord),
|
neuper@42451
|
459 |
erls = PolyEq_erls, srls = Erls, calc = [], errpatts = [],
|
neuper@37969
|
460 |
rules = [Thm ("complete_square1",num_str @{thm complete_square1}),
|
neuper@37969
|
461 |
Thm ("complete_square2",num_str @{thm complete_square2}),
|
neuper@37969
|
462 |
Thm ("complete_square3",num_str @{thm complete_square3}),
|
neuper@37969
|
463 |
Thm ("complete_square4",num_str @{thm complete_square4}),
|
neuper@37969
|
464 |
Thm ("complete_square5",num_str @{thm complete_square5})
|
neuper@37954
|
465 |
],
|
neuper@48763
|
466 |
scr = Prog ((term_of o the o (parse thy)) "empty_script")
|
neuper@37954
|
467 |
}:rls);
|
neuper@37954
|
468 |
|
neuper@37954
|
469 |
val polyeq_simplify = prep_rls(
|
neuper@37954
|
470 |
Rls {id = "polyeq_simplify", preconds = [],
|
neuper@37954
|
471 |
rew_ord = ("termlessI",termlessI),
|
neuper@37954
|
472 |
erls = PolyEq_erls,
|
neuper@37954
|
473 |
srls = Erls,
|
neuper@42451
|
474 |
calc = [], errpatts = [],
|
neuper@37969
|
475 |
rules = [Thm ("real_assoc_1",num_str @{thm real_assoc_1}),
|
neuper@37969
|
476 |
Thm ("real_assoc_2",num_str @{thm real_assoc_2}),
|
neuper@37969
|
477 |
Thm ("real_diff_minus",num_str @{thm real_diff_minus}),
|
neuper@37969
|
478 |
Thm ("real_unari_minus",num_str @{thm real_unari_minus}),
|
neuper@37969
|
479 |
Thm ("realpow_multI",num_str @{thm realpow_multI}),
|
neuper@38014
|
480 |
Calc ("Groups.plus_class.plus",eval_binop "#add_"),
|
neuper@38014
|
481 |
Calc ("Groups.minus_class.minus",eval_binop "#sub_"),
|
neuper@38034
|
482 |
Calc ("Groups.times_class.times",eval_binop "#mult_"),
|
neuper@48789
|
483 |
Calc ("Fields.inverse_class.divide", eval_cancel "#divide_e"),
|
neuper@37982
|
484 |
Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
|
neuper@37954
|
485 |
Calc ("Atools.pow" ,eval_binop "#power_"),
|
neuper@37954
|
486 |
Rls_ reduce_012
|
neuper@37954
|
487 |
],
|
neuper@48763
|
488 |
scr = Prog ((term_of o the o (parse thy)) "empty_script")
|
neuper@37954
|
489 |
}:rls);
|
neuper@37989
|
490 |
*}
|
neuper@52125
|
491 |
setup {* KEStore_Elems.add_rlss
|
neuper@52125
|
492 |
[("cancel_leading_coeff", (Context.theory_name @{theory}, cancel_leading_coeff)),
|
neuper@52125
|
493 |
("complete_square", (Context.theory_name @{theory}, complete_square)),
|
neuper@52125
|
494 |
("PolyEq_erls", (Context.theory_name @{theory}, PolyEq_erls)),
|
neuper@52125
|
495 |
("polyeq_simplify", (Context.theory_name @{theory}, polyeq_simplify))] *}
|
neuper@37989
|
496 |
ML{*
|
neuper@37954
|
497 |
|
neuper@37954
|
498 |
(* ------------- polySolve ------------------ *)
|
neuper@37954
|
499 |
(* -- d0 -- *)
|
neuper@37954
|
500 |
(*isolate the bound variable in an d0 equation; 'bdv' is a meta-constant*)
|
neuper@37954
|
501 |
val d0_polyeq_simplify = prep_rls(
|
neuper@37954
|
502 |
Rls {id = "d0_polyeq_simplify", preconds = [],
|
neuper@37954
|
503 |
rew_ord = ("e_rew_ord",e_rew_ord),
|
neuper@37954
|
504 |
erls = PolyEq_erls,
|
neuper@37954
|
505 |
srls = Erls,
|
neuper@42451
|
506 |
calc = [], errpatts = [],
|
neuper@37969
|
507 |
rules = [Thm("d0_true",num_str @{thm d0_true}),
|
neuper@37969
|
508 |
Thm("d0_false",num_str @{thm d0_false})
|
neuper@37954
|
509 |
],
|
neuper@48763
|
510 |
scr = Prog ((term_of o the o (parse thy)) "empty_script")
|
neuper@37954
|
511 |
}:rls);
|
neuper@37954
|
512 |
|
neuper@37954
|
513 |
(* -- d1 -- *)
|
neuper@37954
|
514 |
(*isolate the bound variable in an d1 equation; 'bdv' is a meta-constant*)
|
neuper@37954
|
515 |
val d1_polyeq_simplify = prep_rls(
|
neuper@37954
|
516 |
Rls {id = "d1_polyeq_simplify", preconds = [],
|
neuper@37954
|
517 |
rew_ord = ("e_rew_ord",e_rew_ord),
|
neuper@37954
|
518 |
erls = PolyEq_erls,
|
neuper@37954
|
519 |
srls = Erls,
|
neuper@42451
|
520 |
calc = [], errpatts = [],
|
neuper@37954
|
521 |
rules = [
|
neuper@37969
|
522 |
Thm("d1_isolate_add1",num_str @{thm d1_isolate_add1}),
|
neuper@37954
|
523 |
(* a+bx=0 -> bx=-a *)
|
neuper@37969
|
524 |
Thm("d1_isolate_add2",num_str @{thm d1_isolate_add2}),
|
neuper@37954
|
525 |
(* a+ x=0 -> x=-a *)
|
neuper@37969
|
526 |
Thm("d1_isolate_div",num_str @{thm d1_isolate_div})
|
neuper@37954
|
527 |
(* bx=c -> x=c/b *)
|
neuper@37954
|
528 |
],
|
neuper@48763
|
529 |
scr = Prog ((term_of o the o (parse thy)) "empty_script")
|
neuper@37954
|
530 |
}:rls);
|
neuper@37954
|
531 |
|
neuper@37989
|
532 |
*}
|
neuper@42394
|
533 |
subsection {* degree 2 *}
|
neuper@37989
|
534 |
ML{*
|
neuper@42394
|
535 |
(* isolate the bound variable in an d2 equation with bdv only;
|
neuper@42394
|
536 |
"bdv" is a meta-constant substituted for the "x" below by isac's rewriter. *)
|
neuper@37954
|
537 |
val d2_polyeq_bdv_only_simplify = prep_rls(
|
neuper@42394
|
538 |
Rls {id = "d2_polyeq_bdv_only_simplify", preconds = [], rew_ord = ("e_rew_ord",e_rew_ord),
|
neuper@42451
|
539 |
erls = PolyEq_erls, srls = Erls, calc = [], errpatts = [],
|
neuper@42394
|
540 |
rules =
|
neuper@42394
|
541 |
[Thm ("d2_prescind1", num_str @{thm d2_prescind1}), (* ax+bx^2=0 -> x(a+bx)=0 *)
|
neuper@42394
|
542 |
Thm ("d2_prescind2", num_str @{thm d2_prescind2}), (* ax+ x^2=0 -> x(a+ x)=0 *)
|
neuper@42394
|
543 |
Thm ("d2_prescind3", num_str @{thm d2_prescind3}), (* x+bx^2=0 -> x(1+bx)=0 *)
|
neuper@42394
|
544 |
Thm ("d2_prescind4", num_str @{thm d2_prescind4}), (* x+ x^2=0 -> x(1+ x)=0 *)
|
neuper@42394
|
545 |
Thm ("d2_sqrt_equation1", num_str @{thm d2_sqrt_equation1}), (* x^2=c -> x=+-sqrt(c) *)
|
neuper@42394
|
546 |
Thm ("d2_sqrt_equation1_neg", num_str @{thm d2_sqrt_equation1_neg}), (* [0<c] x^2=c -> []*)
|
neuper@42394
|
547 |
Thm ("d2_sqrt_equation2", num_str @{thm d2_sqrt_equation2}), (* x^2=0 -> x=0 *)
|
neuper@42394
|
548 |
Thm ("d2_reduce_equation1", num_str @{thm d2_reduce_equation1}),(* x(a+bx)=0 -> x=0 |a+bx=0*)
|
neuper@42394
|
549 |
Thm ("d2_reduce_equation2", num_str @{thm d2_reduce_equation2}),(* x(a+ x)=0 -> x=0 |a+ x=0*)
|
neuper@42394
|
550 |
Thm ("d2_isolate_div", num_str @{thm d2_isolate_div}) (* bx^2=c -> x^2=c/b *)
|
neuper@42394
|
551 |
],
|
neuper@48763
|
552 |
scr = Prog ((term_of o the o (parse thy)) "empty_script")
|
neuper@37954
|
553 |
}:rls);
|
neuper@37989
|
554 |
*}
|
neuper@37989
|
555 |
ML{*
|
neuper@37954
|
556 |
(* isolate the bound variable in an d2 equation with sqrt only;
|
neuper@37954
|
557 |
'bdv' is a meta-constant*)
|
neuper@37954
|
558 |
val d2_polyeq_sq_only_simplify = prep_rls(
|
neuper@37954
|
559 |
Rls {id = "d2_polyeq_sq_only_simplify", preconds = [],
|
neuper@37954
|
560 |
rew_ord = ("e_rew_ord",e_rew_ord),
|
neuper@37954
|
561 |
erls = PolyEq_erls,
|
neuper@37954
|
562 |
srls = Erls,
|
neuper@42451
|
563 |
calc = [], errpatts = [],
|
neuper@37954
|
564 |
(*asm_thm = [("d2_sqrt_equation1",""),("d2_sqrt_equation1_neg",""),
|
neuper@37954
|
565 |
("d2_isolate_div","")],*)
|
neuper@37969
|
566 |
rules = [Thm("d2_isolate_add1",num_str @{thm d2_isolate_add1}),
|
neuper@37954
|
567 |
(* a+ bx^2=0 -> bx^2=(-1)a*)
|
neuper@37969
|
568 |
Thm("d2_isolate_add2",num_str @{thm d2_isolate_add2}),
|
neuper@37954
|
569 |
(* a+ x^2=0 -> x^2=(-1)a*)
|
neuper@37969
|
570 |
Thm("d2_sqrt_equation2",num_str @{thm d2_sqrt_equation2}),
|
neuper@37954
|
571 |
(* x^2=0 -> x=0 *)
|
neuper@37969
|
572 |
Thm("d2_sqrt_equation1",num_str @{thm d2_sqrt_equation1}),
|
neuper@37954
|
573 |
(* x^2=c -> x=+-sqrt(c)*)
|
neuper@37969
|
574 |
Thm("d2_sqrt_equation1_neg",num_str @{thm d2_sqrt_equation1_neg}),
|
neuper@37954
|
575 |
(* [c<0] x^2=c -> x=[] *)
|
neuper@37969
|
576 |
Thm("d2_isolate_div",num_str @{thm d2_isolate_div})
|
neuper@37954
|
577 |
(* bx^2=c -> x^2=c/b*)
|
neuper@37954
|
578 |
],
|
neuper@48763
|
579 |
scr = Prog ((term_of o the o (parse thy)) "empty_script")
|
neuper@37954
|
580 |
}:rls);
|
neuper@37989
|
581 |
*}
|
neuper@37989
|
582 |
ML{*
|
neuper@37954
|
583 |
(* isolate the bound variable in an d2 equation with pqFormula;
|
neuper@37954
|
584 |
'bdv' is a meta-constant*)
|
neuper@37954
|
585 |
val d2_polyeq_pqFormula_simplify = prep_rls(
|
neuper@37954
|
586 |
Rls {id = "d2_polyeq_pqFormula_simplify", preconds = [],
|
neuper@37954
|
587 |
rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
|
neuper@42451
|
588 |
srls = Erls, calc = [], errpatts = [],
|
neuper@37969
|
589 |
rules = [Thm("d2_pqformula1",num_str @{thm d2_pqformula1}),
|
neuper@37954
|
590 |
(* q+px+ x^2=0 *)
|
neuper@37969
|
591 |
Thm("d2_pqformula1_neg",num_str @{thm d2_pqformula1_neg}),
|
neuper@37954
|
592 |
(* q+px+ x^2=0 *)
|
neuper@37969
|
593 |
Thm("d2_pqformula2",num_str @{thm d2_pqformula2}),
|
neuper@37954
|
594 |
(* q+px+1x^2=0 *)
|
neuper@37969
|
595 |
Thm("d2_pqformula2_neg",num_str @{thm d2_pqformula2_neg}),
|
neuper@37954
|
596 |
(* q+px+1x^2=0 *)
|
neuper@37969
|
597 |
Thm("d2_pqformula3",num_str @{thm d2_pqformula3}),
|
neuper@37954
|
598 |
(* q+ x+ x^2=0 *)
|
neuper@37969
|
599 |
Thm("d2_pqformula3_neg",num_str @{thm d2_pqformula3_neg}),
|
neuper@37954
|
600 |
(* q+ x+ x^2=0 *)
|
neuper@37969
|
601 |
Thm("d2_pqformula4",num_str @{thm d2_pqformula4}),
|
neuper@37954
|
602 |
(* q+ x+1x^2=0 *)
|
neuper@37969
|
603 |
Thm("d2_pqformula4_neg",num_str @{thm d2_pqformula4_neg}),
|
neuper@37954
|
604 |
(* q+ x+1x^2=0 *)
|
neuper@37969
|
605 |
Thm("d2_pqformula5",num_str @{thm d2_pqformula5}),
|
neuper@37954
|
606 |
(* qx+ x^2=0 *)
|
neuper@37969
|
607 |
Thm("d2_pqformula6",num_str @{thm d2_pqformula6}),
|
neuper@37954
|
608 |
(* qx+1x^2=0 *)
|
neuper@37969
|
609 |
Thm("d2_pqformula7",num_str @{thm d2_pqformula7}),
|
neuper@37954
|
610 |
(* x+ x^2=0 *)
|
neuper@37969
|
611 |
Thm("d2_pqformula8",num_str @{thm d2_pqformula8}),
|
neuper@37954
|
612 |
(* x+1x^2=0 *)
|
neuper@37969
|
613 |
Thm("d2_pqformula9",num_str @{thm d2_pqformula9}),
|
neuper@37954
|
614 |
(* q +1x^2=0 *)
|
neuper@37969
|
615 |
Thm("d2_pqformula9_neg",num_str @{thm d2_pqformula9_neg}),
|
neuper@37954
|
616 |
(* q +1x^2=0 *)
|
neuper@37969
|
617 |
Thm("d2_pqformula10",num_str @{thm d2_pqformula10}),
|
neuper@37954
|
618 |
(* q + x^2=0 *)
|
neuper@37969
|
619 |
Thm("d2_pqformula10_neg",num_str @{thm d2_pqformula10_neg}),
|
neuper@37954
|
620 |
(* q + x^2=0 *)
|
neuper@37969
|
621 |
Thm("d2_sqrt_equation2",num_str @{thm d2_sqrt_equation2}),
|
neuper@37954
|
622 |
(* x^2=0 *)
|
neuper@37969
|
623 |
Thm("d2_sqrt_equation3",num_str @{thm d2_sqrt_equation3})
|
neuper@37954
|
624 |
(* 1x^2=0 *)
|
neuper@48763
|
625 |
],scr = Prog ((term_of o the o (parse thy)) "empty_script")
|
neuper@37954
|
626 |
}:rls);
|
neuper@37989
|
627 |
*}
|
neuper@37989
|
628 |
ML{*
|
neuper@37954
|
629 |
(* isolate the bound variable in an d2 equation with abcFormula;
|
neuper@37954
|
630 |
'bdv' is a meta-constant*)
|
neuper@37954
|
631 |
val d2_polyeq_abcFormula_simplify = prep_rls(
|
neuper@37954
|
632 |
Rls {id = "d2_polyeq_abcFormula_simplify", preconds = [],
|
neuper@37954
|
633 |
rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
|
neuper@42451
|
634 |
srls = Erls, calc = [], errpatts = [],
|
neuper@37969
|
635 |
rules = [Thm("d2_abcformula1",num_str @{thm d2_abcformula1}),
|
neuper@37954
|
636 |
(*c+bx+cx^2=0 *)
|
neuper@37969
|
637 |
Thm("d2_abcformula1_neg",num_str @{thm d2_abcformula1_neg}),
|
neuper@37954
|
638 |
(*c+bx+cx^2=0 *)
|
neuper@37969
|
639 |
Thm("d2_abcformula2",num_str @{thm d2_abcformula2}),
|
neuper@37954
|
640 |
(*c+ x+cx^2=0 *)
|
neuper@37969
|
641 |
Thm("d2_abcformula2_neg",num_str @{thm d2_abcformula2_neg}),
|
neuper@37954
|
642 |
(*c+ x+cx^2=0 *)
|
neuper@37969
|
643 |
Thm("d2_abcformula3",num_str @{thm d2_abcformula3}),
|
neuper@37954
|
644 |
(*c+bx+ x^2=0 *)
|
neuper@37969
|
645 |
Thm("d2_abcformula3_neg",num_str @{thm d2_abcformula3_neg}),
|
neuper@37954
|
646 |
(*c+bx+ x^2=0 *)
|
neuper@37969
|
647 |
Thm("d2_abcformula4",num_str @{thm d2_abcformula4}),
|
neuper@37954
|
648 |
(*c+ x+ x^2=0 *)
|
neuper@37969
|
649 |
Thm("d2_abcformula4_neg",num_str @{thm d2_abcformula4_neg}),
|
neuper@37954
|
650 |
(*c+ x+ x^2=0 *)
|
neuper@37969
|
651 |
Thm("d2_abcformula5",num_str @{thm d2_abcformula5}),
|
neuper@37954
|
652 |
(*c+ cx^2=0 *)
|
neuper@37969
|
653 |
Thm("d2_abcformula5_neg",num_str @{thm d2_abcformula5_neg}),
|
neuper@37954
|
654 |
(*c+ cx^2=0 *)
|
neuper@37969
|
655 |
Thm("d2_abcformula6",num_str @{thm d2_abcformula6}),
|
neuper@37954
|
656 |
(*c+ x^2=0 *)
|
neuper@37969
|
657 |
Thm("d2_abcformula6_neg",num_str @{thm d2_abcformula6_neg}),
|
neuper@37954
|
658 |
(*c+ x^2=0 *)
|
neuper@37969
|
659 |
Thm("d2_abcformula7",num_str @{thm d2_abcformula7}),
|
neuper@37954
|
660 |
(* bx+ax^2=0 *)
|
neuper@37969
|
661 |
Thm("d2_abcformula8",num_str @{thm d2_abcformula8}),
|
neuper@37954
|
662 |
(* bx+ x^2=0 *)
|
neuper@37969
|
663 |
Thm("d2_abcformula9",num_str @{thm d2_abcformula9}),
|
neuper@37954
|
664 |
(* x+ax^2=0 *)
|
neuper@37969
|
665 |
Thm("d2_abcformula10",num_str @{thm d2_abcformula10}),
|
neuper@37954
|
666 |
(* x+ x^2=0 *)
|
neuper@37969
|
667 |
Thm("d2_sqrt_equation2",num_str @{thm d2_sqrt_equation2}),
|
neuper@37954
|
668 |
(* x^2=0 *)
|
neuper@37969
|
669 |
Thm("d2_sqrt_equation3",num_str @{thm d2_sqrt_equation3})
|
neuper@37954
|
670 |
(* bx^2=0 *)
|
neuper@37954
|
671 |
],
|
neuper@48763
|
672 |
scr = Prog ((term_of o the o (parse thy)) "empty_script")
|
neuper@37954
|
673 |
}:rls);
|
neuper@37989
|
674 |
*}
|
neuper@37989
|
675 |
ML{*
|
neuper@37954
|
676 |
|
neuper@37954
|
677 |
(* isolate the bound variable in an d2 equation;
|
neuper@37954
|
678 |
'bdv' is a meta-constant*)
|
neuper@37954
|
679 |
val d2_polyeq_simplify = prep_rls(
|
neuper@37954
|
680 |
Rls {id = "d2_polyeq_simplify", preconds = [],
|
neuper@37954
|
681 |
rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
|
neuper@42451
|
682 |
srls = Erls, calc = [], errpatts = [],
|
neuper@37969
|
683 |
rules = [Thm("d2_pqformula1",num_str @{thm d2_pqformula1}),
|
neuper@37954
|
684 |
(* p+qx+ x^2=0 *)
|
neuper@37969
|
685 |
Thm("d2_pqformula1_neg",num_str @{thm d2_pqformula1_neg}),
|
neuper@37954
|
686 |
(* p+qx+ x^2=0 *)
|
neuper@37969
|
687 |
Thm("d2_pqformula2",num_str @{thm d2_pqformula2}),
|
neuper@37954
|
688 |
(* p+qx+1x^2=0 *)
|
neuper@37969
|
689 |
Thm("d2_pqformula2_neg",num_str @{thm d2_pqformula2_neg}),
|
neuper@37954
|
690 |
(* p+qx+1x^2=0 *)
|
neuper@37969
|
691 |
Thm("d2_pqformula3",num_str @{thm d2_pqformula3}),
|
neuper@37954
|
692 |
(* p+ x+ x^2=0 *)
|
neuper@37969
|
693 |
Thm("d2_pqformula3_neg",num_str @{thm d2_pqformula3_neg}),
|
neuper@37954
|
694 |
(* p+ x+ x^2=0 *)
|
neuper@37969
|
695 |
Thm("d2_pqformula4",num_str @{thm d2_pqformula4}),
|
neuper@37954
|
696 |
(* p+ x+1x^2=0 *)
|
neuper@37969
|
697 |
Thm("d2_pqformula4_neg",num_str @{thm d2_pqformula4_neg}),
|
neuper@37954
|
698 |
(* p+ x+1x^2=0 *)
|
neuper@37969
|
699 |
Thm("d2_abcformula1",num_str @{thm d2_abcformula1}),
|
neuper@37954
|
700 |
(* c+bx+cx^2=0 *)
|
neuper@37969
|
701 |
Thm("d2_abcformula1_neg",num_str @{thm d2_abcformula1_neg}),
|
neuper@37954
|
702 |
(* c+bx+cx^2=0 *)
|
neuper@37969
|
703 |
Thm("d2_abcformula2",num_str @{thm d2_abcformula2}),
|
neuper@37954
|
704 |
(* c+ x+cx^2=0 *)
|
neuper@37969
|
705 |
Thm("d2_abcformula2_neg",num_str @{thm d2_abcformula2_neg}),
|
neuper@37954
|
706 |
(* c+ x+cx^2=0 *)
|
neuper@37969
|
707 |
Thm("d2_prescind1",num_str @{thm d2_prescind1}),
|
neuper@37954
|
708 |
(* ax+bx^2=0 -> x(a+bx)=0 *)
|
neuper@37969
|
709 |
Thm("d2_prescind2",num_str @{thm d2_prescind2}),
|
neuper@37954
|
710 |
(* ax+ x^2=0 -> x(a+ x)=0 *)
|
neuper@37969
|
711 |
Thm("d2_prescind3",num_str @{thm d2_prescind3}),
|
neuper@37954
|
712 |
(* x+bx^2=0 -> x(1+bx)=0 *)
|
neuper@37969
|
713 |
Thm("d2_prescind4",num_str @{thm d2_prescind4}),
|
neuper@37954
|
714 |
(* x+ x^2=0 -> x(1+ x)=0 *)
|
neuper@37969
|
715 |
Thm("d2_isolate_add1",num_str @{thm d2_isolate_add1}),
|
neuper@37954
|
716 |
(* a+ bx^2=0 -> bx^2=(-1)a*)
|
neuper@37969
|
717 |
Thm("d2_isolate_add2",num_str @{thm d2_isolate_add2}),
|
neuper@37954
|
718 |
(* a+ x^2=0 -> x^2=(-1)a*)
|
neuper@37969
|
719 |
Thm("d2_sqrt_equation1",num_str @{thm d2_sqrt_equation1}),
|
neuper@37954
|
720 |
(* x^2=c -> x=+-sqrt(c)*)
|
neuper@37969
|
721 |
Thm("d2_sqrt_equation1_neg",num_str @{thm d2_sqrt_equation1_neg}),
|
neuper@37954
|
722 |
(* [c<0] x^2=c -> x=[]*)
|
neuper@37969
|
723 |
Thm("d2_sqrt_equation2",num_str @{thm d2_sqrt_equation2}),
|
neuper@37954
|
724 |
(* x^2=0 -> x=0 *)
|
neuper@37969
|
725 |
Thm("d2_reduce_equation1",num_str @{thm d2_reduce_equation1}),
|
neuper@37954
|
726 |
(* x(a+bx)=0 -> x=0 | a+bx=0*)
|
neuper@37969
|
727 |
Thm("d2_reduce_equation2",num_str @{thm d2_reduce_equation2}),
|
neuper@37954
|
728 |
(* x(a+ x)=0 -> x=0 | a+ x=0*)
|
neuper@37969
|
729 |
Thm("d2_isolate_div",num_str @{thm d2_isolate_div})
|
neuper@37954
|
730 |
(* bx^2=c -> x^2=c/b*)
|
neuper@37954
|
731 |
],
|
neuper@48763
|
732 |
scr = Prog ((term_of o the o (parse thy)) "empty_script")
|
neuper@37954
|
733 |
}:rls);
|
neuper@37989
|
734 |
*}
|
neuper@37989
|
735 |
ML{*
|
neuper@37954
|
736 |
|
neuper@37954
|
737 |
(* -- d3 -- *)
|
neuper@37954
|
738 |
(* isolate the bound variable in an d3 equation; 'bdv' is a meta-constant *)
|
neuper@37954
|
739 |
val d3_polyeq_simplify = prep_rls(
|
neuper@37954
|
740 |
Rls {id = "d3_polyeq_simplify", preconds = [],
|
neuper@37954
|
741 |
rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
|
neuper@42451
|
742 |
srls = Erls, calc = [], errpatts = [],
|
neuper@37954
|
743 |
rules =
|
neuper@37969
|
744 |
[Thm("d3_reduce_equation1",num_str @{thm d3_reduce_equation1}),
|
neuper@37954
|
745 |
(*a*bdv + b*bdv^^^2 + c*bdv^^^3=0) =
|
neuper@37954
|
746 |
(bdv=0 | (a + b*bdv + c*bdv^^^2=0)*)
|
neuper@37969
|
747 |
Thm("d3_reduce_equation2",num_str @{thm d3_reduce_equation2}),
|
neuper@37954
|
748 |
(* bdv + b*bdv^^^2 + c*bdv^^^3=0) =
|
neuper@37954
|
749 |
(bdv=0 | (1 + b*bdv + c*bdv^^^2=0)*)
|
neuper@37969
|
750 |
Thm("d3_reduce_equation3",num_str @{thm d3_reduce_equation3}),
|
neuper@37954
|
751 |
(*a*bdv + bdv^^^2 + c*bdv^^^3=0) =
|
neuper@37954
|
752 |
(bdv=0 | (a + bdv + c*bdv^^^2=0)*)
|
neuper@37969
|
753 |
Thm("d3_reduce_equation4",num_str @{thm d3_reduce_equation4}),
|
neuper@37954
|
754 |
(* bdv + bdv^^^2 + c*bdv^^^3=0) =
|
neuper@37954
|
755 |
(bdv=0 | (1 + bdv + c*bdv^^^2=0)*)
|
neuper@37969
|
756 |
Thm("d3_reduce_equation5",num_str @{thm d3_reduce_equation5}),
|
neuper@37954
|
757 |
(*a*bdv + b*bdv^^^2 + bdv^^^3=0) =
|
neuper@37954
|
758 |
(bdv=0 | (a + b*bdv + bdv^^^2=0)*)
|
neuper@37969
|
759 |
Thm("d3_reduce_equation6",num_str @{thm d3_reduce_equation6}),
|
neuper@37954
|
760 |
(* bdv + b*bdv^^^2 + bdv^^^3=0) =
|
neuper@37954
|
761 |
(bdv=0 | (1 + b*bdv + bdv^^^2=0)*)
|
neuper@37969
|
762 |
Thm("d3_reduce_equation7",num_str @{thm d3_reduce_equation7}),
|
neuper@37954
|
763 |
(*a*bdv + bdv^^^2 + bdv^^^3=0) =
|
neuper@37954
|
764 |
(bdv=0 | (1 + bdv + bdv^^^2=0)*)
|
neuper@37969
|
765 |
Thm("d3_reduce_equation8",num_str @{thm d3_reduce_equation8}),
|
neuper@37954
|
766 |
(* bdv + bdv^^^2 + bdv^^^3=0) =
|
neuper@37954
|
767 |
(bdv=0 | (1 + bdv + bdv^^^2=0)*)
|
neuper@37969
|
768 |
Thm("d3_reduce_equation9",num_str @{thm d3_reduce_equation9}),
|
neuper@37954
|
769 |
(*a*bdv + c*bdv^^^3=0) =
|
neuper@37954
|
770 |
(bdv=0 | (a + c*bdv^^^2=0)*)
|
neuper@37969
|
771 |
Thm("d3_reduce_equation10",num_str @{thm d3_reduce_equation10}),
|
neuper@37954
|
772 |
(* bdv + c*bdv^^^3=0) =
|
neuper@37954
|
773 |
(bdv=0 | (1 + c*bdv^^^2=0)*)
|
neuper@37969
|
774 |
Thm("d3_reduce_equation11",num_str @{thm d3_reduce_equation11}),
|
neuper@37954
|
775 |
(*a*bdv + bdv^^^3=0) =
|
neuper@37954
|
776 |
(bdv=0 | (a + bdv^^^2=0)*)
|
neuper@37969
|
777 |
Thm("d3_reduce_equation12",num_str @{thm d3_reduce_equation12}),
|
neuper@37954
|
778 |
(* bdv + bdv^^^3=0) =
|
neuper@37954
|
779 |
(bdv=0 | (1 + bdv^^^2=0)*)
|
neuper@37969
|
780 |
Thm("d3_reduce_equation13",num_str @{thm d3_reduce_equation13}),
|
neuper@37954
|
781 |
(* b*bdv^^^2 + c*bdv^^^3=0) =
|
neuper@37954
|
782 |
(bdv=0 | ( b*bdv + c*bdv^^^2=0)*)
|
neuper@37969
|
783 |
Thm("d3_reduce_equation14",num_str @{thm d3_reduce_equation14}),
|
neuper@37954
|
784 |
(* bdv^^^2 + c*bdv^^^3=0) =
|
neuper@37954
|
785 |
(bdv=0 | ( bdv + c*bdv^^^2=0)*)
|
neuper@37969
|
786 |
Thm("d3_reduce_equation15",num_str @{thm d3_reduce_equation15}),
|
neuper@37954
|
787 |
(* b*bdv^^^2 + bdv^^^3=0) =
|
neuper@37954
|
788 |
(bdv=0 | ( b*bdv + bdv^^^2=0)*)
|
neuper@37969
|
789 |
Thm("d3_reduce_equation16",num_str @{thm d3_reduce_equation16}),
|
neuper@37954
|
790 |
(* bdv^^^2 + bdv^^^3=0) =
|
neuper@37954
|
791 |
(bdv=0 | ( bdv + bdv^^^2=0)*)
|
neuper@37969
|
792 |
Thm("d3_isolate_add1",num_str @{thm d3_isolate_add1}),
|
neuper@37954
|
793 |
(*[|Not(bdv occurs_in a)|] ==> (a + b*bdv^^^3=0) =
|
neuper@37954
|
794 |
(bdv=0 | (b*bdv^^^3=a)*)
|
neuper@37969
|
795 |
Thm("d3_isolate_add2",num_str @{thm d3_isolate_add2}),
|
neuper@37954
|
796 |
(*[|Not(bdv occurs_in a)|] ==> (a + bdv^^^3=0) =
|
neuper@37954
|
797 |
(bdv=0 | ( bdv^^^3=a)*)
|
neuper@37969
|
798 |
Thm("d3_isolate_div",num_str @{thm d3_isolate_div}),
|
neuper@37954
|
799 |
(*[|Not(b=0)|] ==> (b*bdv^^^3=c) = (bdv^^^3=c/b*)
|
neuper@37969
|
800 |
Thm("d3_root_equation2",num_str @{thm d3_root_equation2}),
|
neuper@37954
|
801 |
(*(bdv^^^3=0) = (bdv=0) *)
|
neuper@37969
|
802 |
Thm("d3_root_equation1",num_str @{thm d3_root_equation1})
|
neuper@37954
|
803 |
(*bdv^^^3=c) = (bdv = nroot 3 c*)
|
neuper@37954
|
804 |
],
|
neuper@48763
|
805 |
scr = Prog ((term_of o the o (parse thy)) "empty_script")
|
neuper@37954
|
806 |
}:rls);
|
neuper@37989
|
807 |
*}
|
neuper@37989
|
808 |
ML{*
|
neuper@37954
|
809 |
|
neuper@37954
|
810 |
(* -- d4 -- *)
|
neuper@37954
|
811 |
(*isolate the bound variable in an d4 equation; 'bdv' is a meta-constant*)
|
neuper@37954
|
812 |
val d4_polyeq_simplify = prep_rls(
|
neuper@37954
|
813 |
Rls {id = "d4_polyeq_simplify", preconds = [],
|
neuper@37954
|
814 |
rew_ord = ("e_rew_ord",e_rew_ord), erls = PolyEq_erls,
|
neuper@42451
|
815 |
srls = Erls, calc = [], errpatts = [],
|
neuper@37954
|
816 |
rules =
|
neuper@37989
|
817 |
[Thm("d4_sub_u1",num_str @{thm d4_sub_u1})
|
neuper@37954
|
818 |
(* ax^4+bx^2+c=0 -> x=+-sqrt(ax^2+bx^+c) *)
|
neuper@37954
|
819 |
],
|
neuper@48763
|
820 |
scr = Prog ((term_of o the o (parse thy)) "empty_script")
|
neuper@37954
|
821 |
}:rls);
|
neuper@37989
|
822 |
*}
|
neuper@52125
|
823 |
setup {* KEStore_Elems.add_rlss
|
neuper@52125
|
824 |
[("d0_polyeq_simplify", (Context.theory_name @{theory}, d0_polyeq_simplify)),
|
neuper@52125
|
825 |
("d1_polyeq_simplify", (Context.theory_name @{theory}, d1_polyeq_simplify)),
|
neuper@52125
|
826 |
("d2_polyeq_simplify", (Context.theory_name @{theory}, d2_polyeq_simplify)),
|
neuper@52125
|
827 |
("d2_polyeq_bdv_only_simplify", (Context.theory_name @{theory}, d2_polyeq_bdv_only_simplify)),
|
neuper@52125
|
828 |
("d2_polyeq_sq_only_simplify", (Context.theory_name @{theory}, d2_polyeq_sq_only_simplify)),
|
neuper@52125
|
829 |
|
neuper@52125
|
830 |
("d2_polyeq_pqFormula_simplify",
|
neuper@52125
|
831 |
(Context.theory_name @{theory}, d2_polyeq_pqFormula_simplify)),
|
neuper@52125
|
832 |
("d2_polyeq_abcFormula_simplify",
|
neuper@52125
|
833 |
(Context.theory_name @{theory}, d2_polyeq_abcFormula_simplify)),
|
neuper@52125
|
834 |
("d3_polyeq_simplify", (Context.theory_name @{theory}, d3_polyeq_simplify)),
|
neuper@52125
|
835 |
("d4_polyeq_simplify", (Context.theory_name @{theory}, d4_polyeq_simplify))] *}
|
neuper@37989
|
836 |
ML{*
|
neuper@37954
|
837 |
(*------------------------problems------------------------*)
|
neuper@37954
|
838 |
(*
|
neuper@37954
|
839 |
(get_pbt ["degree_2","polynomial","univariate","equation"]);
|
neuper@37954
|
840 |
show_ptyps();
|
neuper@37954
|
841 |
*)
|
s1210629013@55339
|
842 |
*}
|
s1210629013@55359
|
843 |
setup {* KEStore_Elems.add_pbts
|
s1210629013@55339
|
844 |
[(prep_pbt thy "pbl_equ_univ_poly" [] e_pblID
|
s1210629013@55339
|
845 |
(["polynomial","univariate","equation"],
|
s1210629013@55339
|
846 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
847 |
("#Where" ,["~((e_e::bool) is_ratequation_in (v_v::real))",
|
s1210629013@55339
|
848 |
"~((lhs e_e) is_rootTerm_in (v_v::real))",
|
s1210629013@55339
|
849 |
"~((rhs e_e) is_rootTerm_in (v_v::real))"]),
|
s1210629013@55339
|
850 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55339
|
851 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)", [])),
|
s1210629013@55339
|
852 |
(*--- d0 ---*)
|
s1210629013@55339
|
853 |
(prep_pbt thy "pbl_equ_univ_poly_deg0" [] e_pblID
|
s1210629013@55339
|
854 |
(["degree_0","polynomial","univariate","equation"],
|
s1210629013@55339
|
855 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
856 |
("#Where" ,["matches (?a = 0) e_e",
|
s1210629013@55339
|
857 |
"(lhs e_e) is_poly_in v_v",
|
s1210629013@55339
|
858 |
"((lhs e_e) has_degree_in v_v ) = 0"]),
|
s1210629013@55339
|
859 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55339
|
860 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d0_polyeq_equation"]])),
|
s1210629013@55339
|
861 |
(*--- d1 ---*)
|
s1210629013@55339
|
862 |
(prep_pbt thy "pbl_equ_univ_poly_deg1" [] e_pblID
|
s1210629013@55339
|
863 |
(["degree_1","polynomial","univariate","equation"],
|
s1210629013@55339
|
864 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
865 |
("#Where" ,["matches (?a = 0) e_e",
|
s1210629013@55339
|
866 |
"(lhs e_e) is_poly_in v_v",
|
s1210629013@55339
|
867 |
"((lhs e_e) has_degree_in v_v ) = 1"]),
|
s1210629013@55339
|
868 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55339
|
869 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d1_polyeq_equation"]])),
|
s1210629013@55339
|
870 |
(*--- d2 ---*)
|
s1210629013@55339
|
871 |
(prep_pbt thy "pbl_equ_univ_poly_deg2" [] e_pblID
|
s1210629013@55339
|
872 |
(["degree_2","polynomial","univariate","equation"],
|
s1210629013@55339
|
873 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
874 |
("#Where" ,["matches (?a = 0) e_e",
|
s1210629013@55339
|
875 |
"(lhs e_e) is_poly_in v_v ",
|
s1210629013@55339
|
876 |
"((lhs e_e) has_degree_in v_v ) = 2"]),
|
s1210629013@55339
|
877 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55339
|
878 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_equation"]])),
|
s1210629013@55339
|
879 |
(prep_pbt thy "pbl_equ_univ_poly_deg2_sqonly" [] e_pblID
|
s1210629013@55339
|
880 |
(["sq_only","degree_2","polynomial","univariate","equation"],
|
s1210629013@55339
|
881 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
882 |
("#Where" ,["matches ( ?a + ?v_^^^2 = 0) e_e | " ^
|
s1210629013@55339
|
883 |
"matches ( ?a + ?b*?v_^^^2 = 0) e_e | " ^
|
s1210629013@55339
|
884 |
"matches ( ?v_^^^2 = 0) e_e | " ^
|
s1210629013@55339
|
885 |
"matches ( ?b*?v_^^^2 = 0) e_e" ,
|
s1210629013@55339
|
886 |
"Not (matches (?a + ?v_ + ?v_^^^2 = 0) e_e) &" ^
|
s1210629013@55339
|
887 |
"Not (matches (?a + ?b*?v_ + ?v_^^^2 = 0) e_e) &" ^
|
s1210629013@55339
|
888 |
"Not (matches (?a + ?v_ + ?c*?v_^^^2 = 0) e_e) &" ^
|
s1210629013@55339
|
889 |
"Not (matches (?a + ?b*?v_ + ?c*?v_^^^2 = 0) e_e) &" ^
|
s1210629013@55339
|
890 |
"Not (matches ( ?v_ + ?v_^^^2 = 0) e_e) &" ^
|
s1210629013@55339
|
891 |
"Not (matches ( ?b*?v_ + ?v_^^^2 = 0) e_e) &" ^
|
s1210629013@55339
|
892 |
"Not (matches ( ?v_ + ?c*?v_^^^2 = 0) e_e) &" ^
|
s1210629013@55339
|
893 |
"Not (matches ( ?b*?v_ + ?c*?v_^^^2 = 0) e_e)"]),
|
s1210629013@55339
|
894 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55339
|
895 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)",
|
s1210629013@55339
|
896 |
[["PolyEq","solve_d2_polyeq_sqonly_equation"]])),
|
s1210629013@55339
|
897 |
(prep_pbt thy "pbl_equ_univ_poly_deg2_bdvonly" [] e_pblID
|
s1210629013@55339
|
898 |
(["bdv_only","degree_2","polynomial","univariate","equation"],
|
s1210629013@55339
|
899 |
[("#Given", ["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
900 |
("#Where", ["matches (?a*?v_ + ?v_^^^2 = 0) e_e | " ^
|
s1210629013@55339
|
901 |
"matches ( ?v_ + ?v_^^^2 = 0) e_e | " ^
|
s1210629013@55339
|
902 |
"matches ( ?v_ + ?b*?v_^^^2 = 0) e_e | " ^
|
s1210629013@55339
|
903 |
"matches (?a*?v_ + ?b*?v_^^^2 = 0) e_e | " ^
|
s1210629013@55339
|
904 |
"matches ( ?v_^^^2 = 0) e_e | " ^
|
s1210629013@55339
|
905 |
"matches ( ?b*?v_^^^2 = 0) e_e "]),
|
s1210629013@55339
|
906 |
("#Find", ["solutions v_v'i'"])],
|
s1210629013@55339
|
907 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)",
|
s1210629013@55339
|
908 |
[["PolyEq","solve_d2_polyeq_bdvonly_equation"]])),
|
s1210629013@55339
|
909 |
(prep_pbt thy "pbl_equ_univ_poly_deg2_pq" [] e_pblID
|
s1210629013@55339
|
910 |
(["pqFormula","degree_2","polynomial","univariate","equation"],
|
s1210629013@55339
|
911 |
[("#Given", ["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
912 |
("#Where", ["matches (?a + 1*?v_^^^2 = 0) e_e | " ^
|
s1210629013@55339
|
913 |
"matches (?a + ?v_^^^2 = 0) e_e"]),
|
s1210629013@55339
|
914 |
("#Find", ["solutions v_v'i'"])],
|
s1210629013@55339
|
915 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_pq_equation"]])),
|
s1210629013@55339
|
916 |
(prep_pbt thy "pbl_equ_univ_poly_deg2_abc" [] e_pblID
|
s1210629013@55339
|
917 |
(["abcFormula","degree_2","polynomial","univariate","equation"],
|
s1210629013@55339
|
918 |
[("#Given", ["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
919 |
("#Where", ["matches (?a + ?v_^^^2 = 0) e_e | " ^
|
s1210629013@55339
|
920 |
"matches (?a + ?b*?v_^^^2 = 0) e_e"]),
|
s1210629013@55339
|
921 |
("#Find", ["solutions v_v'i'"])],
|
s1210629013@55339
|
922 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_abc_equation"]])),
|
s1210629013@55339
|
923 |
(*--- d3 ---*)
|
s1210629013@55339
|
924 |
(prep_pbt thy "pbl_equ_univ_poly_deg3" [] e_pblID
|
s1210629013@55339
|
925 |
(["degree_3","polynomial","univariate","equation"],
|
s1210629013@55339
|
926 |
[("#Given", ["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
927 |
("#Where", ["matches (?a = 0) e_e",
|
s1210629013@55339
|
928 |
"(lhs e_e) is_poly_in v_v ",
|
s1210629013@55339
|
929 |
"((lhs e_e) has_degree_in v_v) = 3"]),
|
s1210629013@55339
|
930 |
("#Find", ["solutions v_v'i'"])],
|
s1210629013@55339
|
931 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d3_polyeq_equation"]])),
|
s1210629013@55339
|
932 |
(*--- d4 ---*)
|
s1210629013@55339
|
933 |
(prep_pbt thy "pbl_equ_univ_poly_deg4" [] e_pblID
|
s1210629013@55339
|
934 |
(["degree_4","polynomial","univariate","equation"],
|
s1210629013@55339
|
935 |
[("#Given", ["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
936 |
("#Where", ["matches (?a = 0) e_e",
|
s1210629013@55339
|
937 |
"(lhs e_e) is_poly_in v_v ",
|
s1210629013@55339
|
938 |
"((lhs e_e) has_degree_in v_v) = 4"]),
|
s1210629013@55339
|
939 |
("#Find", ["solutions v_v'i'"])],
|
s1210629013@55339
|
940 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)", [(*["PolyEq","solve_d4_polyeq_equation"]*)])),
|
s1210629013@55339
|
941 |
(*--- normalize ---*)
|
s1210629013@55339
|
942 |
(prep_pbt thy "pbl_equ_univ_poly_norm" [] e_pblID
|
s1210629013@55339
|
943 |
(["normalize","polynomial","univariate","equation"],
|
s1210629013@55339
|
944 |
[("#Given", ["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
945 |
("#Where", ["(Not((matches (?a = 0 ) e_e ))) |" ^
|
s1210629013@55339
|
946 |
"(Not(((lhs e_e) is_poly_in v_v)))"]),
|
s1210629013@55339
|
947 |
("#Find", ["solutions v_v'i'"])],
|
s1210629013@55339
|
948 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","normalize_poly"]])),
|
s1210629013@55339
|
949 |
(*-------------------------expanded-----------------------*)
|
s1210629013@55339
|
950 |
(prep_pbt thy "pbl_equ_univ_expand" [] e_pblID
|
s1210629013@55339
|
951 |
(["expanded","univariate","equation"],
|
s1210629013@55339
|
952 |
[("#Given", ["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
953 |
("#Where", ["matches (?a = 0) e_e",
|
s1210629013@55339
|
954 |
"(lhs e_e) is_expanded_in v_v "]),
|
s1210629013@55339
|
955 |
("#Find", ["solutions v_v'i'"])],
|
s1210629013@55339
|
956 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)", [])),
|
s1210629013@55339
|
957 |
(*--- d2 ---*)
|
s1210629013@55339
|
958 |
(prep_pbt thy "pbl_equ_univ_expand_deg2" [] e_pblID
|
s1210629013@55339
|
959 |
(["degree_2","expanded","univariate","equation"],
|
s1210629013@55339
|
960 |
[("#Given", ["equality e_e","solveFor v_v"]),
|
s1210629013@55339
|
961 |
("#Where", ["((lhs e_e) has_degree_in v_v) = 2"]),
|
s1210629013@55339
|
962 |
("#Find", ["solutions v_v'i'"])],
|
s1210629013@55339
|
963 |
PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","complete_square"]]))] *}
|
neuper@37954
|
964 |
|
neuper@37989
|
965 |
ML{*
|
neuper@37989
|
966 |
val scr =
|
neuper@37989
|
967 |
"Script Normalize_poly (e_e::bool) (v_v::real) = " ^
|
neuper@37989
|
968 |
"(let e_e =((Try (Rewrite all_left False)) @@ " ^
|
neuper@37989
|
969 |
" (Try (Repeat (Rewrite makex1_x False))) @@ " ^
|
neuper@37989
|
970 |
" (Try (Repeat (Rewrite_Set expand_binoms False))) @@ " ^
|
neuper@37989
|
971 |
" (Try (Repeat (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37989
|
972 |
" make_ratpoly_in False))) @@ " ^
|
neuper@37989
|
973 |
" (Try (Repeat (Rewrite_Set polyeq_simplify False)))) e_e " ^
|
neuper@37989
|
974 |
" in (SubProblem (PolyEq',[polynomial,univariate,equation], [no_met]) " ^
|
neuper@37989
|
975 |
" [BOOL e_e, REAL v_v]))";
|
neuper@37989
|
976 |
parse thy scr;
|
neuper@37989
|
977 |
*}
|
neuper@37989
|
978 |
ML{*
|
neuper@37954
|
979 |
"-------------------------methods-----------------------";
|
neuper@37954
|
980 |
store_met
|
neuper@37972
|
981 |
(prep_met thy "met_polyeq" [] e_metID
|
neuper@37954
|
982 |
(["PolyEq"],
|
neuper@37954
|
983 |
[],
|
neuper@37954
|
984 |
{rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
|
neuper@42425
|
985 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational}, "empty_script"));
|
neuper@37954
|
986 |
|
neuper@37954
|
987 |
store_met
|
neuper@37972
|
988 |
(prep_met thy "met_polyeq_norm" [] e_metID
|
neuper@37954
|
989 |
(["PolyEq","normalize_poly"],
|
neuper@37981
|
990 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
neuper@37981
|
991 |
("#Where" ,["(Not((matches (?a = 0 ) e_e ))) |" ^
|
neuper@37981
|
992 |
"(Not(((lhs e_e) is_poly_in v_v)))"]),
|
neuper@38012
|
993 |
("#Find" ,["solutions v_v'i'"])
|
neuper@37954
|
994 |
],
|
neuper@37954
|
995 |
{rew_ord'="termlessI",
|
neuper@37954
|
996 |
rls'=PolyEq_erls,
|
neuper@37954
|
997 |
srls=e_rls,
|
neuper@37954
|
998 |
prls=PolyEq_prls,
|
neuper@37954
|
999 |
calc=[],
|
neuper@42425
|
1000 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
neuper@37982
|
1001 |
"Script Normalize_poly (e_e::bool) (v_v::real) = " ^
|
neuper@37981
|
1002 |
"(let e_e =((Try (Rewrite all_left False)) @@ " ^
|
neuper@37954
|
1003 |
" (Try (Repeat (Rewrite makex1_x False))) @@ " ^
|
neuper@37954
|
1004 |
" (Try (Repeat (Rewrite_Set expand_binoms False))) @@ " ^
|
neuper@37989
|
1005 |
" (Try (Repeat (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1006 |
" make_ratpoly_in False))) @@ " ^
|
neuper@37981
|
1007 |
" (Try (Repeat (Rewrite_Set polyeq_simplify False)))) e_e " ^
|
neuper@37989
|
1008 |
" in (SubProblem (PolyEq',[polynomial,univariate,equation], [no_met]) " ^
|
neuper@37989
|
1009 |
" [BOOL e_e, REAL v_v]))"
|
neuper@37954
|
1010 |
));
|
neuper@37954
|
1011 |
|
neuper@37989
|
1012 |
*}
|
neuper@37989
|
1013 |
ML{*
|
neuper@37954
|
1014 |
store_met
|
neuper@37972
|
1015 |
(prep_met thy "met_polyeq_d0" [] e_metID
|
neuper@37954
|
1016 |
(["PolyEq","solve_d0_polyeq_equation"],
|
neuper@37981
|
1017 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
neuper@37981
|
1018 |
("#Where" ,["(lhs e_e) is_poly_in v_v ",
|
neuper@37981
|
1019 |
"((lhs e_e) has_degree_in v_v) = 0"]),
|
neuper@38012
|
1020 |
("#Find" ,["solutions v_v'i'"])
|
neuper@37954
|
1021 |
],
|
neuper@37954
|
1022 |
{rew_ord'="termlessI",
|
neuper@37954
|
1023 |
rls'=PolyEq_erls,
|
neuper@37954
|
1024 |
srls=e_rls,
|
neuper@37954
|
1025 |
prls=PolyEq_prls,
|
neuper@37982
|
1026 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))],
|
neuper@42425
|
1027 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
neuper@37982
|
1028 |
"Script Solve_d0_polyeq_equation (e_e::bool) (v_v::real) = " ^
|
neuper@37989
|
1029 |
"(let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37981
|
1030 |
" d0_polyeq_simplify False))) e_e " ^
|
neuper@37981
|
1031 |
" in ((Or_to_List e_e)::bool list))"
|
neuper@37954
|
1032 |
));
|
neuper@37989
|
1033 |
*}
|
neuper@37989
|
1034 |
ML{*
|
neuper@37954
|
1035 |
store_met
|
neuper@37972
|
1036 |
(prep_met thy "met_polyeq_d1" [] e_metID
|
neuper@37954
|
1037 |
(["PolyEq","solve_d1_polyeq_equation"],
|
neuper@37981
|
1038 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
neuper@37981
|
1039 |
("#Where" ,["(lhs e_e) is_poly_in v_v ",
|
neuper@37981
|
1040 |
"((lhs e_e) has_degree_in v_v) = 1"]),
|
neuper@38012
|
1041 |
("#Find" ,["solutions v_v'i'"])
|
neuper@37954
|
1042 |
],
|
neuper@37989
|
1043 |
{rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
|
neuper@37982
|
1044 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))],
|
neuper@42425
|
1045 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
neuper@37982
|
1046 |
"Script Solve_d1_polyeq_equation (e_e::bool) (v_v::real) = " ^
|
neuper@37989
|
1047 |
"(let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1048 |
" d1_polyeq_simplify True)) @@ " ^
|
neuper@37954
|
1049 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
neuper@37989
|
1050 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
neuper@37989
|
1051 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
neuper@42133
|
1052 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"
|
neuper@37954
|
1053 |
));
|
neuper@37989
|
1054 |
*}
|
neuper@37989
|
1055 |
ML{*
|
neuper@37954
|
1056 |
store_met
|
neuper@37972
|
1057 |
(prep_met thy "met_polyeq_d22" [] e_metID
|
neuper@37954
|
1058 |
(["PolyEq","solve_d2_polyeq_equation"],
|
neuper@37981
|
1059 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
neuper@37981
|
1060 |
("#Where" ,["(lhs e_e) is_poly_in v_v ",
|
neuper@37981
|
1061 |
"((lhs e_e) has_degree_in v_v) = 2"]),
|
neuper@38012
|
1062 |
("#Find" ,["solutions v_v'i'"])
|
neuper@37954
|
1063 |
],
|
neuper@37954
|
1064 |
{rew_ord'="termlessI",
|
neuper@37954
|
1065 |
rls'=PolyEq_erls,
|
neuper@37954
|
1066 |
srls=e_rls,
|
neuper@37954
|
1067 |
prls=PolyEq_prls,
|
neuper@37982
|
1068 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))],
|
neuper@42425
|
1069 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
neuper@37982
|
1070 |
"Script Solve_d2_polyeq_equation (e_e::bool) (v_v::real) = " ^
|
neuper@37989
|
1071 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1072 |
" d2_polyeq_simplify True)) @@ " ^
|
neuper@37954
|
1073 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
neuper@37989
|
1074 |
" (Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1075 |
" d1_polyeq_simplify True)) @@ " ^
|
neuper@37954
|
1076 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
neuper@37989
|
1077 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
neuper@37989
|
1078 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
neuper@42268
|
1079 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"
|
neuper@37954
|
1080 |
));
|
neuper@37989
|
1081 |
*}
|
neuper@37989
|
1082 |
ML{*
|
neuper@37954
|
1083 |
store_met
|
neuper@37972
|
1084 |
(prep_met thy "met_polyeq_d2_bdvonly" [] e_metID
|
neuper@37954
|
1085 |
(["PolyEq","solve_d2_polyeq_bdvonly_equation"],
|
neuper@37981
|
1086 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
neuper@37981
|
1087 |
("#Where" ,["(lhs e_e) is_poly_in v_v ",
|
neuper@37981
|
1088 |
"((lhs e_e) has_degree_in v_v) = 2"]),
|
neuper@38012
|
1089 |
("#Find" ,["solutions v_v'i'"])
|
neuper@37954
|
1090 |
],
|
neuper@37954
|
1091 |
{rew_ord'="termlessI",
|
neuper@37954
|
1092 |
rls'=PolyEq_erls,
|
neuper@37954
|
1093 |
srls=e_rls,
|
neuper@37954
|
1094 |
prls=PolyEq_prls,
|
neuper@37982
|
1095 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))],
|
neuper@42425
|
1096 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
neuper@37982
|
1097 |
"Script Solve_d2_polyeq_bdvonly_equation (e_e::bool) (v_v::real) =" ^
|
neuper@37989
|
1098 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1099 |
" d2_polyeq_bdv_only_simplify True)) @@ " ^
|
neuper@37954
|
1100 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
neuper@37989
|
1101 |
" (Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1102 |
" d1_polyeq_simplify True)) @@ " ^
|
neuper@37954
|
1103 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
neuper@37989
|
1104 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
neuper@37989
|
1105 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
neuper@42268
|
1106 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"
|
neuper@37954
|
1107 |
));
|
neuper@37989
|
1108 |
*}
|
neuper@37989
|
1109 |
ML{*
|
neuper@37954
|
1110 |
store_met
|
neuper@37972
|
1111 |
(prep_met thy "met_polyeq_d2_sqonly" [] e_metID
|
neuper@37954
|
1112 |
(["PolyEq","solve_d2_polyeq_sqonly_equation"],
|
neuper@37981
|
1113 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
neuper@37981
|
1114 |
("#Where" ,["(lhs e_e) is_poly_in v_v ",
|
neuper@37981
|
1115 |
"((lhs e_e) has_degree_in v_v) = 2"]),
|
neuper@38012
|
1116 |
("#Find" ,["solutions v_v'i'"])
|
neuper@37954
|
1117 |
],
|
neuper@37954
|
1118 |
{rew_ord'="termlessI",
|
neuper@37954
|
1119 |
rls'=PolyEq_erls,
|
neuper@37954
|
1120 |
srls=e_rls,
|
neuper@37954
|
1121 |
prls=PolyEq_prls,
|
neuper@37982
|
1122 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))],
|
neuper@42425
|
1123 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
neuper@37982
|
1124 |
"Script Solve_d2_polyeq_sqonly_equation (e_e::bool) (v_v::real) =" ^
|
neuper@37989
|
1125 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1126 |
" d2_polyeq_sq_only_simplify True)) @@ " ^
|
neuper@37954
|
1127 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
neuper@37989
|
1128 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e; " ^
|
neuper@37989
|
1129 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
neuper@42268
|
1130 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"
|
neuper@37954
|
1131 |
));
|
neuper@37989
|
1132 |
*}
|
neuper@37989
|
1133 |
ML{*
|
neuper@37954
|
1134 |
store_met
|
neuper@37972
|
1135 |
(prep_met thy "met_polyeq_d2_pq" [] e_metID
|
neuper@37954
|
1136 |
(["PolyEq","solve_d2_polyeq_pq_equation"],
|
neuper@37981
|
1137 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
neuper@37981
|
1138 |
("#Where" ,["(lhs e_e) is_poly_in v_v ",
|
neuper@37981
|
1139 |
"((lhs e_e) has_degree_in v_v) = 2"]),
|
neuper@38012
|
1140 |
("#Find" ,["solutions v_v'i'"])
|
neuper@37954
|
1141 |
],
|
neuper@37954
|
1142 |
{rew_ord'="termlessI",
|
neuper@37954
|
1143 |
rls'=PolyEq_erls,
|
neuper@37954
|
1144 |
srls=e_rls,
|
neuper@37954
|
1145 |
prls=PolyEq_prls,
|
neuper@37982
|
1146 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))],
|
neuper@42425
|
1147 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
neuper@37982
|
1148 |
"Script Solve_d2_polyeq_pq_equation (e_e::bool) (v_v::real) = " ^
|
neuper@37989
|
1149 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1150 |
" d2_polyeq_pqFormula_simplify True)) @@ " ^
|
neuper@37954
|
1151 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
neuper@37989
|
1152 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
neuper@37989
|
1153 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
neuper@42255
|
1154 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"
|
neuper@37954
|
1155 |
));
|
neuper@37989
|
1156 |
*}
|
neuper@37989
|
1157 |
ML{*
|
neuper@37954
|
1158 |
store_met
|
neuper@37972
|
1159 |
(prep_met thy "met_polyeq_d2_abc" [] e_metID
|
neuper@37954
|
1160 |
(["PolyEq","solve_d2_polyeq_abc_equation"],
|
neuper@37981
|
1161 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
neuper@37981
|
1162 |
("#Where" ,["(lhs e_e) is_poly_in v_v ",
|
neuper@37981
|
1163 |
"((lhs e_e) has_degree_in v_v) = 2"]),
|
neuper@38012
|
1164 |
("#Find" ,["solutions v_v'i'"])
|
neuper@37954
|
1165 |
],
|
neuper@37954
|
1166 |
{rew_ord'="termlessI",
|
neuper@37954
|
1167 |
rls'=PolyEq_erls,
|
neuper@37954
|
1168 |
srls=e_rls,
|
neuper@37954
|
1169 |
prls=PolyEq_prls,
|
neuper@37982
|
1170 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))],
|
neuper@42425
|
1171 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
neuper@37982
|
1172 |
"Script Solve_d2_polyeq_abc_equation (e_e::bool) (v_v::real) = " ^
|
neuper@37989
|
1173 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1174 |
" d2_polyeq_abcFormula_simplify True)) @@ " ^
|
neuper@37954
|
1175 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
neuper@37989
|
1176 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
neuper@37989
|
1177 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
neuper@42268
|
1178 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"
|
neuper@37954
|
1179 |
));
|
neuper@37989
|
1180 |
*}
|
neuper@37989
|
1181 |
ML{*
|
neuper@37954
|
1182 |
store_met
|
neuper@37972
|
1183 |
(prep_met thy "met_polyeq_d3" [] e_metID
|
neuper@37954
|
1184 |
(["PolyEq","solve_d3_polyeq_equation"],
|
neuper@37981
|
1185 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
neuper@37981
|
1186 |
("#Where" ,["(lhs e_e) is_poly_in v_v ",
|
neuper@37981
|
1187 |
"((lhs e_e) has_degree_in v_v) = 3"]),
|
neuper@38012
|
1188 |
("#Find" ,["solutions v_v'i'"])
|
neuper@37954
|
1189 |
],
|
neuper@37954
|
1190 |
{rew_ord'="termlessI",
|
neuper@37954
|
1191 |
rls'=PolyEq_erls,
|
neuper@37954
|
1192 |
srls=e_rls,
|
neuper@37954
|
1193 |
prls=PolyEq_prls,
|
neuper@37982
|
1194 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))],
|
neuper@42425
|
1195 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
neuper@37982
|
1196 |
"Script Solve_d3_polyeq_equation (e_e::bool) (v_v::real) = " ^
|
neuper@37989
|
1197 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1198 |
" d3_polyeq_simplify True)) @@ " ^
|
neuper@37954
|
1199 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
neuper@37989
|
1200 |
" (Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1201 |
" d2_polyeq_simplify True)) @@ " ^
|
neuper@37954
|
1202 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
neuper@37989
|
1203 |
" (Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
neuper@37954
|
1204 |
" d1_polyeq_simplify True)) @@ " ^
|
neuper@37954
|
1205 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
neuper@37989
|
1206 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
neuper@37989
|
1207 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
neuper@42268
|
1208 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"
|
neuper@37954
|
1209 |
));
|
neuper@37989
|
1210 |
*}
|
neuper@37989
|
1211 |
ML{*
|
neuper@37954
|
1212 |
(*.solves all expanded (ie. normalized) terms of degree 2.*)
|
neuper@37954
|
1213 |
(*Oct.02 restriction: 'eval_true 0 =< discriminant' ony for integer values
|
neuper@37954
|
1214 |
by 'PolyEq_erls'; restricted until Float.thy is implemented*)
|
neuper@37954
|
1215 |
store_met
|
neuper@37972
|
1216 |
(prep_met thy "met_polyeq_complsq" [] e_metID
|
neuper@37954
|
1217 |
(["PolyEq","complete_square"],
|
neuper@37981
|
1218 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
neuper@37981
|
1219 |
("#Where" ,["matches (?a = 0) e_e",
|
neuper@37981
|
1220 |
"((lhs e_e) has_degree_in v_v) = 2"]),
|
neuper@38012
|
1221 |
("#Find" ,["solutions v_v'i'"])
|
neuper@37954
|
1222 |
],
|
neuper@37954
|
1223 |
{rew_ord'="termlessI",rls'=PolyEq_erls,srls=e_rls,prls=PolyEq_prls,
|
neuper@37982
|
1224 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))],
|
neuper@42425
|
1225 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
neuper@37989
|
1226 |
"Script Complete_square (e_e::bool) (v_v::real) = " ^
|
neuper@37989
|
1227 |
"(let e_e = " ^
|
neuper@37989
|
1228 |
" ((Try (Rewrite_Set_Inst [(bdv,v_v)] cancel_leading_coeff True)) " ^
|
neuper@37989
|
1229 |
" @@ (Try (Rewrite_Set_Inst [(bdv,v_v)] complete_square True)) " ^
|
neuper@37954
|
1230 |
" @@ (Try (Rewrite square_explicit1 False)) " ^
|
neuper@37954
|
1231 |
" @@ (Try (Rewrite square_explicit2 False)) " ^
|
neuper@37954
|
1232 |
" @@ (Rewrite root_plus_minus True) " ^
|
neuper@37989
|
1233 |
" @@ (Try (Repeat (Rewrite_Inst [(bdv,v_v)] bdv_explicit1 False))) " ^
|
neuper@37989
|
1234 |
" @@ (Try (Repeat (Rewrite_Inst [(bdv,v_v)] bdv_explicit2 False))) " ^
|
neuper@37954
|
1235 |
" @@ (Try (Repeat " ^
|
neuper@37989
|
1236 |
" (Rewrite_Inst [(bdv,v_v)] bdv_explicit3 False))) " ^
|
neuper@37954
|
1237 |
" @@ (Try (Rewrite_Set calculate_RootRat False)) " ^
|
neuper@37981
|
1238 |
" @@ (Try (Repeat (Calculate SQRT)))) e_e " ^
|
neuper@37981
|
1239 |
" in ((Or_to_List e_e)::bool list))"
|
neuper@37954
|
1240 |
));
|
neuper@37989
|
1241 |
*}
|
s1210629013@55373
|
1242 |
text {* "-------------------------methods-----------------------" *}
|
s1210629013@55373
|
1243 |
setup {* KEStore_Elems.add_mets
|
s1210629013@55373
|
1244 |
[prep_met thy "met_polyeq" [] e_metID
|
s1210629013@55373
|
1245 |
(["PolyEq"], [],
|
s1210629013@55373
|
1246 |
{rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
|
s1210629013@55373
|
1247 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
s1210629013@55373
|
1248 |
"empty_script"),
|
s1210629013@55373
|
1249 |
prep_met thy "met_polyeq_norm" [] e_metID
|
s1210629013@55373
|
1250 |
(["PolyEq","normalize_poly"],
|
s1210629013@55373
|
1251 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55373
|
1252 |
("#Where" ,["(Not((matches (?a = 0 ) e_e ))) |(Not(((lhs e_e) is_poly_in v_v)))"]),
|
s1210629013@55373
|
1253 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55373
|
1254 |
{rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls, calc=[],
|
s1210629013@55373
|
1255 |
crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
|
s1210629013@55373
|
1256 |
"Script Normalize_poly (e_e::bool) (v_v::real) = " ^
|
s1210629013@55373
|
1257 |
"(let e_e =((Try (Rewrite all_left False)) @@ " ^
|
s1210629013@55373
|
1258 |
" (Try (Repeat (Rewrite makex1_x False))) @@ " ^
|
s1210629013@55373
|
1259 |
" (Try (Repeat (Rewrite_Set expand_binoms False))) @@ " ^
|
s1210629013@55373
|
1260 |
" (Try (Repeat (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1261 |
" make_ratpoly_in False))) @@ " ^
|
s1210629013@55373
|
1262 |
" (Try (Repeat (Rewrite_Set polyeq_simplify False)))) e_e " ^
|
s1210629013@55373
|
1263 |
" in (SubProblem (PolyEq',[polynomial,univariate,equation], [no_met]) " ^
|
s1210629013@55373
|
1264 |
" [BOOL e_e, REAL v_v]))"),
|
s1210629013@55373
|
1265 |
prep_met thy "met_polyeq_d0" [] e_metID
|
s1210629013@55373
|
1266 |
(["PolyEq","solve_d0_polyeq_equation"],
|
s1210629013@55373
|
1267 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55373
|
1268 |
("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 0"]),
|
s1210629013@55373
|
1269 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55373
|
1270 |
{rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
|
s1210629013@55373
|
1271 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
|
s1210629013@55373
|
1272 |
nrls = norm_Rational},
|
s1210629013@55373
|
1273 |
"Script Solve_d0_polyeq_equation (e_e::bool) (v_v::real) = " ^
|
s1210629013@55373
|
1274 |
"(let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1275 |
" d0_polyeq_simplify False))) e_e " ^
|
s1210629013@55373
|
1276 |
" in ((Or_to_List e_e)::bool list))"),
|
s1210629013@55373
|
1277 |
prep_met thy "met_polyeq_d1" [] e_metID
|
s1210629013@55373
|
1278 |
(["PolyEq","solve_d1_polyeq_equation"],
|
s1210629013@55373
|
1279 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55373
|
1280 |
("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 1"]),
|
s1210629013@55373
|
1281 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55373
|
1282 |
{rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
|
s1210629013@55373
|
1283 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
|
s1210629013@55373
|
1284 |
nrls = norm_Rational},
|
s1210629013@55373
|
1285 |
"Script Solve_d1_polyeq_equation (e_e::bool) (v_v::real) = " ^
|
s1210629013@55373
|
1286 |
"(let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1287 |
" d1_polyeq_simplify True)) @@ " ^
|
s1210629013@55373
|
1288 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
s1210629013@55373
|
1289 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
s1210629013@55373
|
1290 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
s1210629013@55373
|
1291 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"),
|
s1210629013@55373
|
1292 |
prep_met thy "met_polyeq_d22" [] e_metID
|
s1210629013@55373
|
1293 |
(["PolyEq","solve_d2_polyeq_equation"],
|
s1210629013@55373
|
1294 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55373
|
1295 |
("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
|
s1210629013@55373
|
1296 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55373
|
1297 |
{rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
|
s1210629013@55373
|
1298 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
|
s1210629013@55373
|
1299 |
nrls = norm_Rational},
|
s1210629013@55373
|
1300 |
"Script Solve_d2_polyeq_equation (e_e::bool) (v_v::real) = " ^
|
s1210629013@55373
|
1301 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1302 |
" d2_polyeq_simplify True)) @@ " ^
|
s1210629013@55373
|
1303 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
s1210629013@55373
|
1304 |
" (Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1305 |
" d1_polyeq_simplify True)) @@ " ^
|
s1210629013@55373
|
1306 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
s1210629013@55373
|
1307 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
s1210629013@55373
|
1308 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
s1210629013@55373
|
1309 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"),
|
s1210629013@55373
|
1310 |
prep_met thy "met_polyeq_d2_bdvonly" [] e_metID
|
s1210629013@55373
|
1311 |
(["PolyEq","solve_d2_polyeq_bdvonly_equation"],
|
s1210629013@55373
|
1312 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55373
|
1313 |
("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
|
s1210629013@55373
|
1314 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55373
|
1315 |
{rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
|
s1210629013@55373
|
1316 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
|
s1210629013@55373
|
1317 |
nrls = norm_Rational},
|
s1210629013@55373
|
1318 |
"Script Solve_d2_polyeq_bdvonly_equation (e_e::bool) (v_v::real) =" ^
|
s1210629013@55373
|
1319 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1320 |
" d2_polyeq_bdv_only_simplify True)) @@ " ^
|
s1210629013@55373
|
1321 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
s1210629013@55373
|
1322 |
" (Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1323 |
" d1_polyeq_simplify True)) @@ " ^
|
s1210629013@55373
|
1324 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
s1210629013@55373
|
1325 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
s1210629013@55373
|
1326 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
s1210629013@55373
|
1327 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"),
|
s1210629013@55373
|
1328 |
prep_met thy "met_polyeq_d2_sqonly" [] e_metID
|
s1210629013@55373
|
1329 |
(["PolyEq","solve_d2_polyeq_sqonly_equation"],
|
s1210629013@55373
|
1330 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55373
|
1331 |
("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
|
s1210629013@55373
|
1332 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55373
|
1333 |
{rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
|
s1210629013@55373
|
1334 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
|
s1210629013@55373
|
1335 |
nrls = norm_Rational},
|
s1210629013@55373
|
1336 |
"Script Solve_d2_polyeq_sqonly_equation (e_e::bool) (v_v::real) =" ^
|
s1210629013@55373
|
1337 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1338 |
" d2_polyeq_sq_only_simplify True)) @@ " ^
|
s1210629013@55373
|
1339 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
s1210629013@55373
|
1340 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e; " ^
|
s1210629013@55373
|
1341 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
s1210629013@55373
|
1342 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"),
|
s1210629013@55373
|
1343 |
prep_met thy "met_polyeq_d2_pq" [] e_metID
|
s1210629013@55373
|
1344 |
(["PolyEq","solve_d2_polyeq_pq_equation"],
|
s1210629013@55373
|
1345 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55373
|
1346 |
("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
|
s1210629013@55373
|
1347 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55373
|
1348 |
{rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
|
s1210629013@55373
|
1349 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
|
s1210629013@55373
|
1350 |
nrls = norm_Rational},
|
s1210629013@55373
|
1351 |
"Script Solve_d2_polyeq_pq_equation (e_e::bool) (v_v::real) = " ^
|
s1210629013@55373
|
1352 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1353 |
" d2_polyeq_pqFormula_simplify True)) @@ " ^
|
s1210629013@55373
|
1354 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
s1210629013@55373
|
1355 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
s1210629013@55373
|
1356 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
s1210629013@55373
|
1357 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"),
|
s1210629013@55373
|
1358 |
prep_met thy "met_polyeq_d2_abc" [] e_metID
|
s1210629013@55373
|
1359 |
(["PolyEq","solve_d2_polyeq_abc_equation"],
|
s1210629013@55373
|
1360 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55373
|
1361 |
("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
|
s1210629013@55373
|
1362 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55373
|
1363 |
{rew_ord'="termlessI", rls'=PolyEq_erls,srls=e_rls, prls=PolyEq_prls,
|
s1210629013@55373
|
1364 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
|
s1210629013@55373
|
1365 |
nrls = norm_Rational},
|
s1210629013@55373
|
1366 |
"Script Solve_d2_polyeq_abc_equation (e_e::bool) (v_v::real) = " ^
|
s1210629013@55373
|
1367 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1368 |
" d2_polyeq_abcFormula_simplify True)) @@ " ^
|
s1210629013@55373
|
1369 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
s1210629013@55373
|
1370 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
s1210629013@55373
|
1371 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
s1210629013@55373
|
1372 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"),
|
s1210629013@55373
|
1373 |
prep_met thy "met_polyeq_d3" [] e_metID
|
s1210629013@55373
|
1374 |
(["PolyEq","solve_d3_polyeq_equation"],
|
s1210629013@55373
|
1375 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55373
|
1376 |
("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 3"]),
|
s1210629013@55373
|
1377 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55373
|
1378 |
{rew_ord'="termlessI", rls'=PolyEq_erls, srls=e_rls, prls=PolyEq_prls,
|
s1210629013@55373
|
1379 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
|
s1210629013@55373
|
1380 |
nrls = norm_Rational},
|
s1210629013@55373
|
1381 |
"Script Solve_d3_polyeq_equation (e_e::bool) (v_v::real) = " ^
|
s1210629013@55373
|
1382 |
" (let e_e = ((Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1383 |
" d3_polyeq_simplify True)) @@ " ^
|
s1210629013@55373
|
1384 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
s1210629013@55373
|
1385 |
" (Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1386 |
" d2_polyeq_simplify True)) @@ " ^
|
s1210629013@55373
|
1387 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
s1210629013@55373
|
1388 |
" (Try (Rewrite_Set_Inst [(bdv,v_v::real)] " ^
|
s1210629013@55373
|
1389 |
" d1_polyeq_simplify True)) @@ " ^
|
s1210629013@55373
|
1390 |
" (Try (Rewrite_Set polyeq_simplify False)) @@ " ^
|
s1210629013@55373
|
1391 |
" (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
|
s1210629013@55373
|
1392 |
" (L_L::bool list) = ((Or_to_List e_e)::bool list) " ^
|
s1210629013@55373
|
1393 |
" in Check_elementwise L_L {(v_v::real). Assumptions} )"),
|
s1210629013@55373
|
1394 |
(*.solves all expanded (ie. normalized) terms of degree 2.*)
|
s1210629013@55373
|
1395 |
(*Oct.02 restriction: 'eval_true 0 =< discriminant' ony for integer values
|
s1210629013@55373
|
1396 |
by 'PolyEq_erls'; restricted until Float.thy is implemented*)
|
s1210629013@55373
|
1397 |
prep_met thy "met_polyeq_complsq" [] e_metID
|
s1210629013@55373
|
1398 |
(["PolyEq","complete_square"],
|
s1210629013@55373
|
1399 |
[("#Given" ,["equality e_e","solveFor v_v"]),
|
s1210629013@55373
|
1400 |
("#Where" ,["matches (?a = 0) e_e", "((lhs e_e) has_degree_in v_v) = 2"]),
|
s1210629013@55373
|
1401 |
("#Find" ,["solutions v_v'i'"])],
|
s1210629013@55373
|
1402 |
{rew_ord'="termlessI",rls'=PolyEq_erls,srls=e_rls,prls=PolyEq_prls,
|
s1210629013@55373
|
1403 |
calc=[("sqrt", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))], crls=PolyEq_crls, errpats = [],
|
s1210629013@55373
|
1404 |
nrls = norm_Rational},
|
s1210629013@55373
|
1405 |
"Script Complete_square (e_e::bool) (v_v::real) = " ^
|
s1210629013@55373
|
1406 |
"(let e_e = " ^
|
s1210629013@55373
|
1407 |
" ((Try (Rewrite_Set_Inst [(bdv,v_v)] cancel_leading_coeff True)) " ^
|
s1210629013@55373
|
1408 |
" @@ (Try (Rewrite_Set_Inst [(bdv,v_v)] complete_square True)) " ^
|
s1210629013@55373
|
1409 |
" @@ (Try (Rewrite square_explicit1 False)) " ^
|
s1210629013@55373
|
1410 |
" @@ (Try (Rewrite square_explicit2 False)) " ^
|
s1210629013@55373
|
1411 |
" @@ (Rewrite root_plus_minus True) " ^
|
s1210629013@55373
|
1412 |
" @@ (Try (Repeat (Rewrite_Inst [(bdv,v_v)] bdv_explicit1 False))) " ^
|
s1210629013@55373
|
1413 |
" @@ (Try (Repeat (Rewrite_Inst [(bdv,v_v)] bdv_explicit2 False))) " ^
|
s1210629013@55373
|
1414 |
" @@ (Try (Repeat " ^
|
s1210629013@55373
|
1415 |
" (Rewrite_Inst [(bdv,v_v)] bdv_explicit3 False))) " ^
|
s1210629013@55373
|
1416 |
" @@ (Try (Rewrite_Set calculate_RootRat False)) " ^
|
s1210629013@55373
|
1417 |
" @@ (Try (Repeat (Calculate SQRT)))) e_e " ^
|
s1210629013@55373
|
1418 |
" in ((Or_to_List e_e)::bool list))")]
|
s1210629013@55373
|
1419 |
*}
|
s1210629013@55373
|
1420 |
|
neuper@37989
|
1421 |
ML{*
|
neuper@37954
|
1422 |
|
neuper@37954
|
1423 |
(* termorder hacked by MG *)
|
neuper@37954
|
1424 |
local (*. for make_polynomial_in .*)
|
neuper@37954
|
1425 |
|
neuper@37954
|
1426 |
open Term; (* for type order = EQUAL | LESS | GREATER *)
|
neuper@37954
|
1427 |
|
neuper@37954
|
1428 |
fun pr_ord EQUAL = "EQUAL"
|
neuper@37954
|
1429 |
| pr_ord LESS = "LESS"
|
neuper@37954
|
1430 |
| pr_ord GREATER = "GREATER";
|
neuper@37954
|
1431 |
|
neuper@37954
|
1432 |
fun dest_hd' x (Const (a, T)) = (((a, 0), T), 0)
|
neuper@37954
|
1433 |
| dest_hd' x (t as Free (a, T)) =
|
neuper@37954
|
1434 |
if x = t then ((("|||||||||||||", 0), T), 0) (*WN*)
|
neuper@37954
|
1435 |
else (((a, 0), T), 1)
|
neuper@37954
|
1436 |
| dest_hd' x (Var v) = (v, 2)
|
neuper@37954
|
1437 |
| dest_hd' x (Bound i) = ((("", i), dummyT), 3)
|
neuper@37954
|
1438 |
| dest_hd' x (Abs (_, T, _)) = ((("", 0), T), 4);
|
neuper@37954
|
1439 |
|
neuper@37954
|
1440 |
fun size_of_term' x (Const ("Atools.pow",_) $ Free (var,_) $ Free (pot,_)) =
|
neuper@37954
|
1441 |
(case x of (*WN*)
|
neuper@37954
|
1442 |
(Free (xstr,_)) =>
|
neuper@37954
|
1443 |
(if xstr = var then 1000*(the (int_of_str pot)) else 3)
|
neuper@38031
|
1444 |
| _ => error ("size_of_term' called with subst = "^
|
neuper@37954
|
1445 |
(term2str x)))
|
neuper@37954
|
1446 |
| size_of_term' x (Free (subst,_)) =
|
neuper@37954
|
1447 |
(case x of
|
neuper@37954
|
1448 |
(Free (xstr,_)) => (if xstr = subst then 1000 else 1)
|
neuper@38031
|
1449 |
| _ => error ("size_of_term' called with subst = "^
|
neuper@37954
|
1450 |
(term2str x)))
|
neuper@37954
|
1451 |
| size_of_term' x (Abs (_,_,body)) = 1 + size_of_term' x body
|
neuper@37954
|
1452 |
| size_of_term' x (f$t) = size_of_term' x f + size_of_term' x t
|
neuper@37954
|
1453 |
| size_of_term' x _ = 1;
|
neuper@37954
|
1454 |
|
neuper@37989
|
1455 |
fun term_ord' x pr thy (Abs (_, T, t), Abs(_, U, u)) = (* ~ term.ML *)
|
neuper@52070
|
1456 |
(case term_ord' x pr thy (t, u) of EQUAL => Term_Ord.typ_ord (T, U) | ord => ord)
|
neuper@37989
|
1457 |
| term_ord' x pr thy (t, u) =
|
neuper@52070
|
1458 |
(if pr
|
neuper@52070
|
1459 |
then
|
neuper@52070
|
1460 |
let
|
neuper@52070
|
1461 |
val (f, ts) = strip_comb t and (g, us) = strip_comb u;
|
neuper@52070
|
1462 |
val _ = tracing ("t= f@ts= \"" ^ term_to_string''' thy f ^ "\" @ \"[" ^
|
neuper@52070
|
1463 |
commas (map (term_to_string''' thy) ts) ^ "]\"");
|
neuper@52070
|
1464 |
val _ = tracing ("u= g@us= \"" ^ term_to_string''' thy g ^ "\" @ \"[" ^
|
neuper@52070
|
1465 |
commas(map (term_to_string''' thy) us) ^ "]\"");
|
neuper@52070
|
1466 |
val _ = tracing ("size_of_term(t,u)= (" ^ string_of_int (size_of_term' x t) ^ ", " ^
|
neuper@52070
|
1467 |
string_of_int (size_of_term' x u) ^ ")");
|
neuper@52070
|
1468 |
val _ = tracing ("hd_ord(f,g) = " ^ (pr_ord o (hd_ord x)) (f,g));
|
neuper@52070
|
1469 |
val _ = tracing ("terms_ord(ts,us) = " ^ (pr_ord o (terms_ord x) str false) (ts, us));
|
neuper@52070
|
1470 |
val _ = tracing ("-------");
|
neuper@52070
|
1471 |
in () end
|
neuper@52070
|
1472 |
else ();
|
neuper@52070
|
1473 |
case int_ord (size_of_term' x t, size_of_term' x u) of
|
neuper@52070
|
1474 |
EQUAL =>
|
neuper@52070
|
1475 |
let val (f, ts) = strip_comb t and (g, us) = strip_comb u
|
neuper@52070
|
1476 |
in
|
neuper@52070
|
1477 |
(case hd_ord x (f, g) of
|
neuper@52070
|
1478 |
EQUAL => (terms_ord x str pr) (ts, us)
|
neuper@52070
|
1479 |
| ord => ord)
|
neuper@52070
|
1480 |
end
|
neuper@37954
|
1481 |
| ord => ord)
|
neuper@37954
|
1482 |
and hd_ord x (f, g) = (* ~ term.ML *)
|
neuper@37989
|
1483 |
prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord)
|
neuper@37989
|
1484 |
int_ord (dest_hd' x f, dest_hd' x g)
|
neuper@37954
|
1485 |
and terms_ord x str pr (ts, us) =
|
neuper@37989
|
1486 |
list_ord (term_ord' x pr (assoc_thy "Isac"))(ts, us);
|
neuper@52070
|
1487 |
|
neuper@37954
|
1488 |
in
|
neuper@37954
|
1489 |
|
neuper@37954
|
1490 |
fun ord_make_polynomial_in (pr:bool) thy subst tu =
|
neuper@37954
|
1491 |
let
|
neuper@38015
|
1492 |
(* val _=tracing("*** subs variable is: "^(subst2str subst)); *)
|
neuper@37954
|
1493 |
in
|
neuper@37954
|
1494 |
case subst of
|
neuper@37954
|
1495 |
(_,x)::_ => (term_ord' x pr thy tu = LESS)
|
neuper@38031
|
1496 |
| _ => error ("ord_make_polynomial_in called with subst = "^
|
neuper@37954
|
1497 |
(subst2str subst))
|
neuper@37954
|
1498 |
end;
|
neuper@37989
|
1499 |
end;(*local*)
|
neuper@37954
|
1500 |
|
neuper@37989
|
1501 |
*}
|
neuper@37989
|
1502 |
ML{*
|
neuper@37954
|
1503 |
val order_add_mult_in = prep_rls(
|
neuper@37954
|
1504 |
Rls{id = "order_add_mult_in", preconds = [],
|
neuper@37954
|
1505 |
rew_ord = ("ord_make_polynomial_in",
|
neuper@52139
|
1506 |
ord_make_polynomial_in false @{theory "Poly"}),
|
neuper@37954
|
1507 |
erls = e_rls,srls = Erls,
|
neuper@42451
|
1508 |
calc = [], errpatts = [],
|
neuper@48763
|
1509 |
rules = [Thm ("mult_commute",num_str @{thm mult_commute}),
|
neuper@37954
|
1510 |
(* z * w = w * z *)
|
neuper@37969
|
1511 |
Thm ("real_mult_left_commute",num_str @{thm real_mult_left_commute}),
|
neuper@37954
|
1512 |
(*z1.0 * (z2.0 * z3.0) = z2.0 * (z1.0 * z3.0)*)
|
neuper@48763
|
1513 |
Thm ("mult_assoc",num_str @{thm mult_assoc}),
|
neuper@37954
|
1514 |
(*z1.0 * z2.0 * z3.0 = z1.0 * (z2.0 * z3.0)*)
|
neuper@37965
|
1515 |
Thm ("add_commute",num_str @{thm add_commute}),
|
neuper@37954
|
1516 |
(*z + w = w + z*)
|
neuper@37965
|
1517 |
Thm ("add_left_commute",num_str @{thm add_left_commute}),
|
neuper@37954
|
1518 |
(*x + (y + z) = y + (x + z)*)
|
neuper@37965
|
1519 |
Thm ("add_assoc",num_str @{thm add_assoc})
|
neuper@37954
|
1520 |
(*z1.0 + z2.0 + z3.0 = z1.0 + (z2.0 + z3.0)*)
|
neuper@37954
|
1521 |
], scr = EmptyScr}:rls);
|
neuper@37954
|
1522 |
|
neuper@37989
|
1523 |
*}
|
neuper@37989
|
1524 |
ML{*
|
neuper@37954
|
1525 |
val collect_bdv = prep_rls(
|
neuper@37954
|
1526 |
Rls{id = "collect_bdv", preconds = [],
|
neuper@37954
|
1527 |
rew_ord = ("dummy_ord", dummy_ord),
|
neuper@37954
|
1528 |
erls = e_rls,srls = Erls,
|
neuper@42451
|
1529 |
calc = [], errpatts = [],
|
neuper@37969
|
1530 |
rules = [Thm ("bdv_collect_1",num_str @{thm bdv_collect_1}),
|
neuper@37969
|
1531 |
Thm ("bdv_collect_2",num_str @{thm bdv_collect_2}),
|
neuper@37969
|
1532 |
Thm ("bdv_collect_3",num_str @{thm bdv_collect_3}),
|
neuper@37954
|
1533 |
|
neuper@37969
|
1534 |
Thm ("bdv_collect_assoc1_1",num_str @{thm bdv_collect_assoc1_1}),
|
neuper@37969
|
1535 |
Thm ("bdv_collect_assoc1_2",num_str @{thm bdv_collect_assoc1_2}),
|
neuper@37969
|
1536 |
Thm ("bdv_collect_assoc1_3",num_str @{thm bdv_collect_assoc1_3}),
|
neuper@37954
|
1537 |
|
neuper@37969
|
1538 |
Thm ("bdv_collect_assoc2_1",num_str @{thm bdv_collect_assoc2_1}),
|
neuper@37969
|
1539 |
Thm ("bdv_collect_assoc2_2",num_str @{thm bdv_collect_assoc2_2}),
|
neuper@37969
|
1540 |
Thm ("bdv_collect_assoc2_3",num_str @{thm bdv_collect_assoc2_3}),
|
neuper@37954
|
1541 |
|
neuper@37954
|
1542 |
|
neuper@37969
|
1543 |
Thm ("bdv_n_collect_1",num_str @{thm bdv_n_collect_1}),
|
neuper@37969
|
1544 |
Thm ("bdv_n_collect_2",num_str @{thm bdv_n_collect_2}),
|
neuper@37969
|
1545 |
Thm ("bdv_n_collect_3",num_str @{thm bdv_n_collect_3}),
|
neuper@37954
|
1546 |
|
neuper@37969
|
1547 |
Thm ("bdv_n_collect_assoc1_1",num_str @{thm bdv_n_collect_assoc1_1}),
|
neuper@37969
|
1548 |
Thm ("bdv_n_collect_assoc1_2",num_str @{thm bdv_n_collect_assoc1_2}),
|
neuper@37969
|
1549 |
Thm ("bdv_n_collect_assoc1_3",num_str @{thm bdv_n_collect_assoc1_3}),
|
neuper@37954
|
1550 |
|
neuper@37969
|
1551 |
Thm ("bdv_n_collect_assoc2_1",num_str @{thm bdv_n_collect_assoc2_1}),
|
neuper@37969
|
1552 |
Thm ("bdv_n_collect_assoc2_2",num_str @{thm bdv_n_collect_assoc2_2}),
|
neuper@37989
|
1553 |
Thm ("bdv_n_collect_assoc2_3",num_str @{thm bdv_n_collect_assoc2_3})
|
neuper@37954
|
1554 |
], scr = EmptyScr}:rls);
|
neuper@37954
|
1555 |
|
neuper@37989
|
1556 |
*}
|
neuper@37989
|
1557 |
ML{*
|
neuper@37954
|
1558 |
(*.transforms an arbitrary term without roots to a polynomial [4]
|
neuper@37954
|
1559 |
according to knowledge/Poly.sml.*)
|
neuper@37954
|
1560 |
val make_polynomial_in = prep_rls(
|
neuper@37954
|
1561 |
Seq {id = "make_polynomial_in", preconds = []:term list,
|
neuper@37954
|
1562 |
rew_ord = ("dummy_ord", dummy_ord),
|
neuper@37954
|
1563 |
erls = Atools_erls, srls = Erls,
|
neuper@42451
|
1564 |
calc = [], errpatts = [],
|
neuper@37954
|
1565 |
rules = [Rls_ expand_poly,
|
neuper@37954
|
1566 |
Rls_ order_add_mult_in,
|
neuper@37954
|
1567 |
Rls_ simplify_power,
|
neuper@37954
|
1568 |
Rls_ collect_numerals,
|
neuper@37954
|
1569 |
Rls_ reduce_012,
|
neuper@37969
|
1570 |
Thm ("realpow_oneI",num_str @{thm realpow_oneI}),
|
neuper@37954
|
1571 |
Rls_ discard_parentheses,
|
neuper@37954
|
1572 |
Rls_ collect_bdv
|
neuper@37954
|
1573 |
],
|
neuper@37954
|
1574 |
scr = EmptyScr
|
neuper@37954
|
1575 |
}:rls);
|
neuper@37954
|
1576 |
|
neuper@37989
|
1577 |
*}
|
neuper@37989
|
1578 |
ML{*
|
neuper@37954
|
1579 |
val separate_bdvs =
|
neuper@37954
|
1580 |
append_rls "separate_bdvs"
|
neuper@37954
|
1581 |
collect_bdv
|
neuper@37989
|
1582 |
[Thm ("separate_bdv", num_str @{thm separate_bdv}),
|
neuper@37954
|
1583 |
(*"?a * ?bdv / ?b = ?a / ?b * ?bdv"*)
|
neuper@37989
|
1584 |
Thm ("separate_bdv_n", num_str @{thm separate_bdv_n}),
|
neuper@37989
|
1585 |
Thm ("separate_1_bdv", num_str @{thm separate_1_bdv}),
|
neuper@37954
|
1586 |
(*"?bdv / ?b = (1 / ?b) * ?bdv"*)
|
neuper@37989
|
1587 |
Thm ("separate_1_bdv_n", num_str @{thm separate_1_bdv_n}),
|
neuper@37954
|
1588 |
(*"?bdv ^^^ ?n / ?b = 1 / ?b * ?bdv ^^^ ?n"*)
|
neuper@37990
|
1589 |
Thm ("add_divide_distrib",
|
neuper@37989
|
1590 |
num_str @{thm add_divide_distrib})
|
neuper@37954
|
1591 |
(*"(?x + ?y) / ?z = ?x / ?z + ?y / ?z"
|
neuper@37954
|
1592 |
WN051031 DOES NOT BELONG TO HERE*)
|
neuper@37954
|
1593 |
];
|
neuper@37989
|
1594 |
*}
|
neuper@37989
|
1595 |
ML{*
|
neuper@37954
|
1596 |
val make_ratpoly_in = prep_rls(
|
neuper@37954
|
1597 |
Seq {id = "make_ratpoly_in", preconds = []:term list,
|
neuper@37954
|
1598 |
rew_ord = ("dummy_ord", dummy_ord),
|
neuper@37954
|
1599 |
erls = Atools_erls, srls = Erls,
|
neuper@42451
|
1600 |
calc = [], errpatts = [],
|
neuper@37954
|
1601 |
rules = [Rls_ norm_Rational,
|
neuper@37954
|
1602 |
Rls_ order_add_mult_in,
|
neuper@37954
|
1603 |
Rls_ discard_parentheses,
|
neuper@37954
|
1604 |
Rls_ separate_bdvs,
|
neuper@37954
|
1605 |
(* Rls_ rearrange_assoc, WN060916 why does cancel_p not work?*)
|
neuper@37954
|
1606 |
Rls_ cancel_p
|
neuper@48789
|
1607 |
(*Calc ("Fields.inverse_class.divide" ,eval_cancel "#divide_e") too weak!*)
|
neuper@37954
|
1608 |
],
|
neuper@37954
|
1609 |
scr = EmptyScr}:rls);
|
neuper@37954
|
1610 |
*}
|
neuper@52130
|
1611 |
setup {* KEStore_Elems.add_rlss
|
neuper@52130
|
1612 |
[("order_add_mult_in", (Context.theory_name @{theory}, order_add_mult_in)),
|
neuper@52130
|
1613 |
("collect_bdv", (Context.theory_name @{theory}, collect_bdv)),
|
neuper@52130
|
1614 |
("make_polynomial_in", (Context.theory_name @{theory}, make_polynomial_in)),
|
neuper@52130
|
1615 |
("make_ratpoly_in", (Context.theory_name @{theory}, make_ratpoly_in)),
|
neuper@52130
|
1616 |
("separate_bdvs", (Context.theory_name @{theory}, separate_bdvs))] *}
|
neuper@37954
|
1617 |
|
neuper@37906
|
1618 |
end
|
neuper@37906
|
1619 |
|
neuper@37906
|
1620 |
|
neuper@37906
|
1621 |
|
neuper@37906
|
1622 |
|
neuper@37906
|
1623 |
|
neuper@37906
|
1624 |
|