neuper@37906
|
1 |
(* theory collecting all knowledge for Root
|
neuper@37906
|
2 |
created by:
|
neuper@37906
|
3 |
date:
|
neuper@37906
|
4 |
changed by: rlang
|
neuper@37906
|
5 |
last change by: rlang
|
neuper@37906
|
6 |
date: 02.10.21
|
neuper@37906
|
7 |
*)
|
neuper@37906
|
8 |
|
neuper@37982
|
9 |
theory Root imports Poly begin
|
neuper@37906
|
10 |
|
neuper@37906
|
11 |
consts
|
neuper@37906
|
12 |
|
neuper@37982
|
13 |
(*sqrt :: "real => real" Isabelle "NthRoot.sqrt"*)
|
neuper@37950
|
14 |
nroot :: "[real, real] => real"
|
neuper@37906
|
15 |
|
neuper@52148
|
16 |
axiomatization where (*.not contained in Isabelle2002,
|
neuper@37906
|
17 |
stated as axioms, TODO: prove as theorems;
|
neuper@37906
|
18 |
theorem-IDs 'xxxI' with ^^^ instead of ^ in 'xxx' in Isabelle2002.*)
|
neuper@37906
|
19 |
|
neuper@37982
|
20 |
root_plus_minus: "0 <= b ==>
|
neuper@52148
|
21 |
(a^^^2 = b) = ((a = sqrt b) | (a = (-1)*sqrt b))" and
|
neuper@52148
|
22 |
root_false: "b < 0 ==> (a^^^2 = b) = False" and
|
neuper@37906
|
23 |
|
neuper@37906
|
24 |
(* for expand_rootbinom *)
|
neuper@52148
|
25 |
real_pp_binom_times: "(a + b)*(c + d) = a*c + a*d + b*c + b*d" and
|
neuper@52148
|
26 |
real_pm_binom_times: "(a + b)*(c - d) = a*c - a*d + b*c - b*d" and
|
neuper@52148
|
27 |
real_mp_binom_times: "(a - b)*(c + d) = a*c + a*d - b*c - b*d" and
|
neuper@52148
|
28 |
real_mm_binom_times: "(a - b)*(c - d) = a*c - a*d - b*c + b*d" and
|
neuper@52148
|
29 |
real_plus_binom_pow3: "(a + b)^^^3 = a^^^3 + 3*a^^^2*b + 3*a*b^^^2 + b^^^3" and
|
neuper@52148
|
30 |
real_minus_binom_pow3: "(a - b)^^^3 = a^^^3 - 3*a^^^2*b + 3*a*b^^^2 - b^^^3" and
|
neuper@52148
|
31 |
realpow_mul: "(a*b)^^^n = a^^^n * b^^^n" and
|
neuper@37906
|
32 |
|
neuper@52148
|
33 |
real_diff_minus: "a - b = a + (-1) * b" and
|
neuper@52148
|
34 |
real_plus_binom_times: "(a + b)*(a + b) = a^^^2 + 2*a*b + b^^^2" and
|
neuper@52148
|
35 |
real_minus_binom_times: "(a - b)*(a - b) = a^^^2 - 2*a*b + b^^^2" and
|
neuper@52148
|
36 |
real_plus_binom_pow2: "(a + b)^^^2 = a^^^2 + 2*a*b + b^^^2" and
|
neuper@52148
|
37 |
real_minus_binom_pow2: "(a - b)^^^2 = a^^^2 - 2*a*b + b^^^2" and
|
neuper@52148
|
38 |
real_plus_minus_binom1: "(a + b)*(a - b) = a^^^2 - b^^^2" and
|
neuper@52148
|
39 |
real_plus_minus_binom2: "(a - b)*(a + b) = a^^^2 - b^^^2" and
|
neuper@37906
|
40 |
|
neuper@52148
|
41 |
real_root_positive: "0 <= a ==> (x ^^^ 2 = a) = (x = sqrt a)" and
|
neuper@37982
|
42 |
real_root_negative: "a < 0 ==> (x ^^^ 2 = a) = False"
|
neuper@37906
|
43 |
|
neuper@37950
|
44 |
ML {*
|
neuper@37972
|
45 |
val thy = @{theory};
|
neuper@37972
|
46 |
|
neuper@37950
|
47 |
(*-------------------------functions---------------------*)
|
neuper@37950
|
48 |
(*evaluation square-root over the integers*)
|
neuper@37950
|
49 |
fun eval_sqrt (thmid:string) (op_:string) (t as
|
neuper@37950
|
50 |
(Const(op0,t0) $ arg)) thy =
|
neuper@37950
|
51 |
(case arg of
|
neuper@37950
|
52 |
Free (n1,t1) =>
|
wneuper@59390
|
53 |
(case TermC.int_of_str_opt n1 of
|
neuper@37950
|
54 |
SOME ni =>
|
neuper@37950
|
55 |
if ni < 0 then NONE
|
neuper@37950
|
56 |
else
|
wneuper@59401
|
57 |
let val fact = Calc.squfact ni;
|
neuper@37950
|
58 |
in if fact*fact = ni
|
neuper@37950
|
59 |
then SOME ("#sqrt #"^(string_of_int ni)^" = #"
|
neuper@37950
|
60 |
^(string_of_int (if ni = 0 then 0
|
neuper@37950
|
61 |
else ni div fact)),
|
wneuper@59390
|
62 |
HOLogic.Trueprop $ TermC.mk_equality (t, TermC.term_of_num t1 fact))
|
neuper@37950
|
63 |
else if fact = 1 then NONE
|
neuper@37950
|
64 |
else SOME ("#sqrt #"^(string_of_int ni)^" = sqrt (#"
|
neuper@37950
|
65 |
^(string_of_int fact)^" * #"
|
neuper@37950
|
66 |
^(string_of_int fact)^" * #"
|
neuper@37950
|
67 |
^(string_of_int (ni div (fact*fact))^")"),
|
wneuper@59390
|
68 |
HOLogic.Trueprop $
|
wneuper@59389
|
69 |
(TermC.mk_equality
|
neuper@37950
|
70 |
(t,
|
wneuper@59389
|
71 |
(TermC.mk_factroot op0 t1 fact
|
neuper@37950
|
72 |
(ni div (fact*fact))))))
|
neuper@37950
|
73 |
end
|
neuper@37950
|
74 |
| NONE => NONE)
|
neuper@37950
|
75 |
| _ => NONE)
|
neuper@37950
|
76 |
|
neuper@37950
|
77 |
| eval_sqrt _ _ _ _ = NONE;
|
neuper@37950
|
78 |
(*val (thmid, op_, t as Const(op0,t0) $ arg) = ("","", str2term "sqrt 0");
|
neuper@37950
|
79 |
> eval_sqrt thmid op_ t thy;
|
neuper@37950
|
80 |
> val Free (n1,t1) = arg;
|
neuper@37950
|
81 |
> val SOME ni = int_of_str n1;
|
neuper@37950
|
82 |
*)
|
s1210629013@52145
|
83 |
*}
|
s1210629013@52145
|
84 |
setup {* KEStore_Elems.add_calcs
|
s1210629013@52145
|
85 |
[("SQRT", ("NthRoot.sqrt", eval_sqrt "#sqrt_"))
|
s1210629013@52145
|
86 |
(*different types for 'sqrt 4' --- 'Calculate SQRT'*)] *}
|
s1210629013@52145
|
87 |
ML {*
|
neuper@37950
|
88 |
local (* Vers. 7.10.99.A *)
|
neuper@37950
|
89 |
|
neuper@37950
|
90 |
open Term; (* for type order = EQUAL | LESS | GREATER *)
|
neuper@37950
|
91 |
|
neuper@37950
|
92 |
fun pr_ord EQUAL = "EQUAL"
|
neuper@37950
|
93 |
| pr_ord LESS = "LESS"
|
neuper@37950
|
94 |
| pr_ord GREATER = "GREATER";
|
neuper@37950
|
95 |
|
neuper@37950
|
96 |
fun dest_hd' (Const (a, T)) = (* ~ term.ML *)
|
neuper@37982
|
97 |
(case a of "NthRoot.sqrt" => ((("|||", 0), T), 0) (*WN greatest *)
|
neuper@37950
|
98 |
| _ => (((a, 0), T), 0))
|
neuper@37950
|
99 |
| dest_hd' (Free (a, T)) = (((a, 0), T), 1)
|
neuper@37950
|
100 |
| dest_hd' (Var v) = (v, 2)
|
neuper@37950
|
101 |
| dest_hd' (Bound i) = ((("", i), dummyT), 3)
|
neuper@37950
|
102 |
| dest_hd' (Abs (_, T, _)) = ((("", 0), T), 4);
|
neuper@37950
|
103 |
fun size_of_term' (Const(str,_) $ t) =
|
neuper@37982
|
104 |
(case str of "NthRoot.sqrt" => (1000 + size_of_term' t)
|
neuper@37950
|
105 |
| _ => 1 + size_of_term' t)
|
neuper@37950
|
106 |
| size_of_term' (Abs (_,_,body)) = 1 + size_of_term' body
|
neuper@37950
|
107 |
| size_of_term' (f $ t) = size_of_term' f + size_of_term' t
|
neuper@37950
|
108 |
| size_of_term' _ = 1;
|
neuper@37950
|
109 |
fun term_ord' pr thy (Abs (_, T, t), Abs(_, U, u)) = (* ~ term.ML *)
|
neuper@38053
|
110 |
(case term_ord' pr thy (t, u) of EQUAL => Term_Ord.typ_ord (T, U)
|
neuper@38053
|
111 |
| ord => ord)
|
neuper@37950
|
112 |
| term_ord' pr thy (t, u) =
|
neuper@38053
|
113 |
(if pr then
|
neuper@37950
|
114 |
let
|
neuper@38053
|
115 |
val (f, ts) = strip_comb t and (g, us) = strip_comb u;
|
wneuper@59406
|
116 |
val _ = tracing ("t= f@ts= \"" ^ Celem.term2str f ^"\" @ \"[" ^
|
wneuper@59406
|
117 |
commas (map Celem.term2str ts) ^ "]\"");
|
wneuper@59406
|
118 |
val _ = tracing ("u= g@us= \"" ^ Celem.term2str g ^"\" @ \"[" ^
|
wneuper@59406
|
119 |
commas (map Celem.term2str us) ^ "]\"");
|
neuper@38053
|
120 |
val _ = tracing ("size_of_term(t,u)= (" ^
|
neuper@38053
|
121 |
string_of_int(size_of_term' t) ^", " ^
|
neuper@38053
|
122 |
string_of_int(size_of_term' u) ^")");
|
neuper@38053
|
123 |
val _ = tracing ("hd_ord(f,g) = " ^ (pr_ord o hd_ord) (f,g));
|
neuper@38053
|
124 |
val _ = tracing ("terms_ord(ts,us) = " ^
|
neuper@38053
|
125 |
(pr_ord o terms_ord str false) (ts,us));
|
neuper@38053
|
126 |
val _=tracing("-------");
|
neuper@37950
|
127 |
in () end
|
neuper@38053
|
128 |
else ();
|
neuper@38053
|
129 |
case int_ord (size_of_term' t, size_of_term' u) of
|
neuper@38053
|
130 |
EQUAL =>
|
neuper@38053
|
131 |
let val (f, ts) = strip_comb t and (g, us) = strip_comb u in
|
neuper@38053
|
132 |
(case hd_ord (f, g) of EQUAL => (terms_ord str pr) (ts, us)
|
neuper@38053
|
133 |
| ord => ord)
|
neuper@38053
|
134 |
end
|
neuper@38053
|
135 |
| ord => ord)
|
neuper@37950
|
136 |
and hd_ord (f, g) = (* ~ term.ML *)
|
neuper@37982
|
137 |
prod_ord (prod_ord Term_Ord.indexname_ord Term_Ord.typ_ord) int_ord
|
neuper@37982
|
138 |
(dest_hd' f, dest_hd' g)
|
neuper@37950
|
139 |
and terms_ord str pr (ts, us) =
|
wneuper@59406
|
140 |
list_ord (term_ord' pr (Celem.assoc_thy "Isac"))(ts, us);
|
neuper@37950
|
141 |
|
neuper@37950
|
142 |
in
|
neuper@37950
|
143 |
(* associates a+(b+c) => (a+b)+c = a+b+c ... avoiding parentheses
|
neuper@37950
|
144 |
by (1) size_of_term: less(!) to right, size_of 'sqrt (...)' = 1
|
neuper@37950
|
145 |
(2) hd_ord: greater to right, 'sqrt' < numerals < variables
|
neuper@37950
|
146 |
(3) terms_ord: recurs. on args, greater to right
|
neuper@37950
|
147 |
*)
|
neuper@37950
|
148 |
|
neuper@37950
|
149 |
(*args
|
neuper@37950
|
150 |
pr: print trace, WN0509 'sqrt_right true' not used anymore
|
neuper@37950
|
151 |
thy:
|
neuper@37950
|
152 |
subst: no bound variables, only Root.sqrt
|
neuper@37950
|
153 |
tu: the terms to compare (t1, t2) ... *)
|
wneuper@59406
|
154 |
fun sqrt_right (pr:bool) thy (_: Celem.subst) tu =
|
neuper@37950
|
155 |
(term_ord' pr thy(***) tu = LESS );
|
neuper@37950
|
156 |
end;
|
neuper@37950
|
157 |
|
wneuper@59406
|
158 |
Celem.rew_ord' := overwritel (! Celem.rew_ord',
|
neuper@37950
|
159 |
[("termlessI", termlessI),
|
wneuper@59397
|
160 |
("sqrt_right", sqrt_right false @{theory "Pure"})
|
neuper@37950
|
161 |
]);
|
neuper@37950
|
162 |
|
neuper@37950
|
163 |
(*-------------------------rulse-------------------------*)
|
neuper@37950
|
164 |
val Root_crls =
|
wneuper@59406
|
165 |
Celem.append_rls "Root_crls" Atools_erls
|
wneuper@59406
|
166 |
[Celem.Thm ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
|
wneuper@59406
|
167 |
Celem.Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"),
|
wneuper@59406
|
168 |
Celem.Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"),
|
wneuper@59406
|
169 |
Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
|
wneuper@59406
|
170 |
Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
|
wneuper@59406
|
171 |
Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
|
wneuper@59406
|
172 |
Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
|
wneuper@59406
|
173 |
Celem.Calc ("HOL.eq",eval_equal "#equal_")
|
neuper@37950
|
174 |
];
|
neuper@37950
|
175 |
|
neuper@37950
|
176 |
val Root_erls =
|
wneuper@59406
|
177 |
Celem.append_rls "Root_erls" Atools_erls
|
wneuper@59406
|
178 |
[Celem.Thm ("real_unari_minus",TermC.num_str @{thm real_unari_minus}),
|
wneuper@59406
|
179 |
Celem.Calc ("NthRoot.sqrt" ,eval_sqrt "#sqrt_"),
|
wneuper@59406
|
180 |
Celem.Calc ("Rings.divide_class.divide",eval_cancel "#divide_e"),
|
wneuper@59406
|
181 |
Celem.Calc ("Atools.pow" ,eval_binop "#power_"),
|
wneuper@59406
|
182 |
Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
|
wneuper@59406
|
183 |
Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
|
wneuper@59406
|
184 |
Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
|
wneuper@59406
|
185 |
Celem.Calc ("HOL.eq",eval_equal "#equal_")
|
neuper@37950
|
186 |
];
|
neuper@52125
|
187 |
*}
|
neuper@52125
|
188 |
setup {* KEStore_Elems.add_rlss [("Root_erls", (Context.theory_name @{theory}, Root_erls))] *}
|
neuper@52125
|
189 |
ML {*
|
neuper@37950
|
190 |
|
s1210629013@55444
|
191 |
val make_rooteq = prep_rls'(
|
wneuper@59406
|
192 |
Celem.Rls{id = "make_rooteq", preconds = []:term list,
|
neuper@37972
|
193 |
rew_ord = ("sqrt_right", sqrt_right false thy),
|
wneuper@59406
|
194 |
erls = Atools_erls, srls = Celem.Erls,
|
neuper@42451
|
195 |
calc = [], errpatts = [],
|
wneuper@59406
|
196 |
rules = [Celem.Thm ("real_diff_minus",TermC.num_str @{thm real_diff_minus}),
|
neuper@37950
|
197 |
(*"a - b = a + (-1) * b"*)
|
neuper@37950
|
198 |
|
wneuper@59406
|
199 |
Celem.Thm ("distrib_right" ,TermC.num_str @{thm distrib_right}),
|
neuper@37950
|
200 |
(*"(z1.0 + z2.0) * w = z1.0 * w + z2.0 * w"*)
|
wneuper@59406
|
201 |
Celem.Thm ("distrib_left",TermC.num_str @{thm distrib_left}),
|
neuper@37950
|
202 |
(*"w * (z1.0 + z2.0) = w * z1.0 + w * z2.0"*)
|
wneuper@59406
|
203 |
Celem.Thm ("left_diff_distrib" ,TermC.num_str @{thm left_diff_distrib}),
|
neuper@37950
|
204 |
(*"(z1.0 - z2.0) * w = z1.0 * w - z2.0 * w"*)
|
wneuper@59406
|
205 |
Celem.Thm ("right_diff_distrib",TermC.num_str @{thm right_diff_distrib}),
|
neuper@37950
|
206 |
(*"w * (z1.0 - z2.0) = w * z1.0 - w * z2.0"*)
|
neuper@37950
|
207 |
|
wneuper@59406
|
208 |
Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}),
|
neuper@37950
|
209 |
(*"1 * z = z"*)
|
wneuper@59406
|
210 |
Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}),
|
neuper@37950
|
211 |
(*"0 * z = 0"*)
|
wneuper@59406
|
212 |
Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
|
neuper@37950
|
213 |
(*"0 + z = z"*)
|
neuper@37950
|
214 |
|
wneuper@59406
|
215 |
Celem.Thm ("mult_commute",TermC.num_str @{thm mult.commute}),
|
neuper@37950
|
216 |
(*AC-rewriting*)
|
wneuper@59406
|
217 |
Celem.Thm ("real_mult_left_commute",TermC.num_str @{thm real_mult_left_commute}),
|
neuper@37950
|
218 |
(**)
|
wneuper@59406
|
219 |
Celem.Thm ("mult_assoc",TermC.num_str @{thm mult.assoc}),
|
neuper@37950
|
220 |
(**)
|
wneuper@59406
|
221 |
Celem.Thm ("add_commute",TermC.num_str @{thm add.commute}),
|
neuper@37950
|
222 |
(**)
|
wneuper@59406
|
223 |
Celem.Thm ("add_left_commute",TermC.num_str @{thm add.left_commute}),
|
neuper@37950
|
224 |
(**)
|
wneuper@59406
|
225 |
Celem.Thm ("add_assoc",TermC.num_str @{thm add.assoc}),
|
neuper@37950
|
226 |
(**)
|
neuper@37950
|
227 |
|
wneuper@59406
|
228 |
Celem.Thm ("sym_realpow_twoI",
|
wneuper@59389
|
229 |
TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
|
neuper@37950
|
230 |
(*"r1 * r1 = r1 ^^^ 2"*)
|
wneuper@59406
|
231 |
Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),
|
neuper@37950
|
232 |
(*"r * r ^^^ n = r ^^^ (n + 1)"*)
|
wneuper@59406
|
233 |
Celem.Thm ("sym_real_mult_2",
|
wneuper@59389
|
234 |
TermC.num_str (@{thm real_mult_2} RS @{thm sym})),
|
neuper@37950
|
235 |
(*"z1 + z1 = 2 * z1"*)
|
wneuper@59406
|
236 |
Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),
|
neuper@37950
|
237 |
(*"z1 + (z1 + k) = 2 * z1 + k"*)
|
neuper@37950
|
238 |
|
wneuper@59406
|
239 |
Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}),
|
neuper@37950
|
240 |
(*"[| l is_const; m is_const |]==> l * n + m * n = (l + m) * n"*)
|
wneuper@59406
|
241 |
Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
|
neuper@37950
|
242 |
(*"[| l is_const; m is_const |] ==>
|
neuper@37950
|
243 |
l * n + (m * n + k) = (l + m) * n + k"*)
|
wneuper@59406
|
244 |
Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),
|
neuper@37950
|
245 |
(*"m is_const ==> n + m * n = (1 + m) * n"*)
|
wneuper@59406
|
246 |
Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}),
|
neuper@37950
|
247 |
(*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
|
neuper@37950
|
248 |
|
wneuper@59406
|
249 |
Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
|
wneuper@59406
|
250 |
Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
|
wneuper@59406
|
251 |
Celem.Calc ("Atools.pow", eval_binop "#power_")
|
neuper@37950
|
252 |
],
|
wneuper@59406
|
253 |
scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
|
wneuper@59406
|
254 |
});
|
neuper@52125
|
255 |
*}
|
neuper@52125
|
256 |
setup {* KEStore_Elems.add_rlss [("make_rooteq", (Context.theory_name @{theory}, make_rooteq))] *}
|
neuper@52125
|
257 |
ML {*
|
neuper@37950
|
258 |
|
wneuper@59374
|
259 |
val prep_rls' = LTool.prep_rls @{theory};
|
s1210629013@55444
|
260 |
|
s1210629013@55444
|
261 |
val expand_rootbinoms = prep_rls'(
|
wneuper@59406
|
262 |
Celem.Rls{id = "expand_rootbinoms", preconds = [],
|
neuper@37950
|
263 |
rew_ord = ("termlessI",termlessI),
|
wneuper@59406
|
264 |
erls = Atools_erls, srls = Celem.Erls,
|
neuper@42451
|
265 |
calc = [], errpatts = [],
|
wneuper@59406
|
266 |
rules = [Celem.Thm ("real_plus_binom_pow2" ,TermC.num_str @{thm real_plus_binom_pow2}),
|
neuper@37950
|
267 |
(*"(a + b) ^^^ 2 = a ^^^ 2 + 2 * a * b + b ^^^ 2"*)
|
wneuper@59406
|
268 |
Celem.Thm ("real_plus_binom_times" ,TermC.num_str @{thm real_plus_binom_times}),
|
neuper@37950
|
269 |
(*"(a + b)*(a + b) = ...*)
|
wneuper@59406
|
270 |
Celem.Thm ("real_minus_binom_pow2" ,TermC.num_str @{thm real_minus_binom_pow2}),
|
neuper@37950
|
271 |
(*"(a - b) ^^^ 2 = a ^^^ 2 - 2 * a * b + b ^^^ 2"*)
|
wneuper@59406
|
272 |
Celem.Thm ("real_minus_binom_times",TermC.num_str @{thm real_minus_binom_times}),
|
neuper@37950
|
273 |
(*"(a - b)*(a - b) = ...*)
|
wneuper@59406
|
274 |
Celem.Thm ("real_plus_minus_binom1",TermC.num_str @{thm real_plus_minus_binom1}),
|
neuper@37950
|
275 |
(*"(a + b) * (a - b) = a ^^^ 2 - b ^^^ 2"*)
|
wneuper@59406
|
276 |
Celem.Thm ("real_plus_minus_binom2",TermC.num_str @{thm real_plus_minus_binom2}),
|
neuper@37950
|
277 |
(*"(a - b) * (a + b) = a ^^^ 2 - b ^^^ 2"*)
|
neuper@37950
|
278 |
(*RL 020915*)
|
wneuper@59406
|
279 |
Celem.Thm ("real_pp_binom_times",TermC.num_str @{thm real_pp_binom_times}),
|
neuper@37950
|
280 |
(*(a + b)*(c + d) = a*c + a*d + b*c + b*d*)
|
wneuper@59406
|
281 |
Celem.Thm ("real_pm_binom_times",TermC.num_str @{thm real_pm_binom_times}),
|
neuper@37950
|
282 |
(*(a + b)*(c - d) = a*c - a*d + b*c - b*d*)
|
wneuper@59406
|
283 |
Celem.Thm ("real_mp_binom_times",TermC.num_str @{thm real_mp_binom_times}),
|
neuper@37950
|
284 |
(*(a - b)*(c p d) = a*c + a*d - b*c - b*d*)
|
wneuper@59406
|
285 |
Celem.Thm ("real_mm_binom_times",TermC.num_str @{thm real_mm_binom_times}),
|
neuper@37950
|
286 |
(*(a - b)*(c p d) = a*c - a*d - b*c + b*d*)
|
wneuper@59406
|
287 |
Celem.Thm ("realpow_mul",TermC.num_str @{thm realpow_mul}),
|
neuper@37950
|
288 |
(*(a*b)^^^n = a^^^n * b^^^n*)
|
neuper@37950
|
289 |
|
wneuper@59406
|
290 |
Celem.Thm ("mult_1_left",TermC.num_str @{thm mult_1_left}), (*"1 * z = z"*)
|
wneuper@59406
|
291 |
Celem.Thm ("mult_zero_left",TermC.num_str @{thm mult_zero_left}), (*"0 * z = 0"*)
|
wneuper@59406
|
292 |
Celem.Thm ("add_0_left",TermC.num_str @{thm add_0_left}),
|
neuper@37950
|
293 |
(*"0 + z = z"*)
|
neuper@37950
|
294 |
|
wneuper@59406
|
295 |
Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
|
wneuper@59406
|
296 |
Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
|
wneuper@59406
|
297 |
Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
|
wneuper@59406
|
298 |
Celem.Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e"),
|
wneuper@59406
|
299 |
Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
|
wneuper@59406
|
300 |
Celem.Calc ("Atools.pow", eval_binop "#power_"),
|
neuper@37950
|
301 |
|
wneuper@59406
|
302 |
Celem.Thm ("sym_realpow_twoI",
|
wneuper@59389
|
303 |
TermC.num_str (@{thm realpow_twoI} RS @{thm sym})),
|
neuper@37950
|
304 |
(*"r1 * r1 = r1 ^^^ 2"*)
|
wneuper@59406
|
305 |
Celem.Thm ("realpow_plus_1",TermC.num_str @{thm realpow_plus_1}),
|
neuper@37950
|
306 |
(*"r * r ^^^ n = r ^^^ (n + 1)"*)
|
wneuper@59406
|
307 |
Celem.Thm ("real_mult_2_assoc",TermC.num_str @{thm real_mult_2_assoc}),
|
neuper@37950
|
308 |
(*"z1 + (z1 + k) = 2 * z1 + k"*)
|
neuper@37950
|
309 |
|
wneuper@59406
|
310 |
Celem.Thm ("real_num_collect",TermC.num_str @{thm real_num_collect}),
|
neuper@37950
|
311 |
(*"[| l is_const; m is_const |] ==>l * n + m * n = (l + m) * n"*)
|
wneuper@59406
|
312 |
Celem.Thm ("real_num_collect_assoc",TermC.num_str @{thm real_num_collect_assoc}),
|
neuper@37950
|
313 |
(*"[| l is_const; m is_const |] ==>
|
neuper@37950
|
314 |
l * n + (m * n + k) = (l + m) * n + k"*)
|
wneuper@59406
|
315 |
Celem.Thm ("real_one_collect",TermC.num_str @{thm real_one_collect}),
|
neuper@37950
|
316 |
(*"m is_const ==> n + m * n = (1 + m) * n"*)
|
wneuper@59406
|
317 |
Celem.Thm ("real_one_collect_assoc",TermC.num_str @{thm real_one_collect_assoc}),
|
neuper@37950
|
318 |
(*"m is_const ==> k + (n + m * n) = k + (1 + m) * n"*)
|
neuper@37950
|
319 |
|
wneuper@59406
|
320 |
Celem.Calc ("Groups.plus_class.plus", eval_binop "#add_"),
|
wneuper@59406
|
321 |
Celem.Calc ("Groups.minus_class.minus", eval_binop "#sub_"),
|
wneuper@59406
|
322 |
Celem.Calc ("Groups.times_class.times", eval_binop "#mult_"),
|
wneuper@59406
|
323 |
Celem.Calc ("Rings.divide_class.divide" ,eval_cancel "#divide_e"),
|
wneuper@59406
|
324 |
Celem.Calc ("NthRoot.sqrt",eval_sqrt "#sqrt_"),
|
wneuper@59406
|
325 |
Celem.Calc ("Atools.pow", eval_binop "#power_")
|
neuper@37950
|
326 |
],
|
wneuper@59406
|
327 |
scr = Celem.Prog ((Thm.term_of o the o (TermC.parse thy)) "empty_script")
|
wneuper@59406
|
328 |
});
|
neuper@37950
|
329 |
*}
|
neuper@52125
|
330 |
setup {* KEStore_Elems.add_rlss
|
neuper@52125
|
331 |
[("expand_rootbinoms", (Context.theory_name @{theory}, expand_rootbinoms))] *}
|
neuper@52125
|
332 |
|
neuper@37950
|
333 |
|
neuper@37906
|
334 |
end
|