agriesma@338
|
1 |
(* use"test-script.sml";
|
agriesma@338
|
2 |
WN.13.3.00
|
agriesma@338
|
3 |
*)
|
agriesma@338
|
4 |
|
agriesma@338
|
5 |
" scripts: Variante 'funktional' ";
|
agriesma@338
|
6 |
"############## Make_fun_by_new_variable ##############";
|
agriesma@338
|
7 |
"############## Make_fun_by_explicit ##############";
|
agriesma@338
|
8 |
"################ Solve_root_equation #################";
|
agriesma@338
|
9 |
"------- Notlocatable: Free_Solve -------";
|
agriesma@338
|
10 |
|
agriesma@338
|
11 |
" --- test100: nxt_tac order------------------------------------ ";
|
agriesma@338
|
12 |
" --- test100: order 1 3 1 2 ----------------------------------- ";
|
agriesma@338
|
13 |
" --- test200: nxt_tac order ------------------------------------- ";
|
agriesma@338
|
14 |
" --- test200: order 3 1 1 2 --------------------------------- ";
|
agriesma@338
|
15 |
|
agriesma@338
|
16 |
" --- root-equation: nxt_tac order------------------------------ ";
|
agriesma@338
|
17 |
" --- root-equation: 1.norm_equation ------------------------------ ";
|
agriesma@338
|
18 |
(* --- test200: calculate -----------------------------------------*)
|
agriesma@338
|
19 |
" --- check_elementwise ------------------------------ ";
|
agriesma@338
|
20 |
|
agriesma@338
|
21 |
" --- test 30.4.02 Testterm: Repeat Repeat Or ------------------ ";
|
agriesma@338
|
22 |
" --- test 9.5.02 Testeq: While Try Repeat @@ ------------------ ";
|
agriesma@338
|
23 |
|
agriesma@338
|
24 |
|
agriesma@338
|
25 |
|
agriesma@338
|
26 |
|
agriesma@338
|
27 |
|
agriesma@338
|
28 |
|
agriesma@338
|
29 |
" #################################################### ";
|
agriesma@338
|
30 |
" scripts: Variante 'funktional' ";
|
agriesma@338
|
31 |
" #################################################### ";
|
agriesma@338
|
32 |
|
agriesma@338
|
33 |
val c = (the o (parse DiffApp.thy))
|
agriesma@338
|
34 |
"Script Maximum_value(fix_::bool list)(m_::real) (rs_::bool list)\
|
agriesma@338
|
35 |
\ (v_::real) (itv_::real set) (err_::bool) = \
|
agriesma@338
|
36 |
\ (let e_ = (hd o (filter (Testvar m_))) rs_; \
|
agriesma@338
|
37 |
\ t_ = (if 1 < Length rs_ \
|
agriesma@338
|
38 |
\ then (SubProblem (Reals_,[make,function],(Isac_,no_met))\
|
agriesma@338
|
39 |
\ [real_ m_, real_ v_, bool_list_ rs_])\
|
agriesma@338
|
40 |
\ else (hd rs_)); \
|
agriesma@338
|
41 |
\ (mx_::real) = SubProblem (Reals_,[on_interval,max_of,function], \
|
agriesma@338
|
42 |
\ (DiffAppl_,maximum_on_interval))\
|
agriesma@338
|
43 |
\ [bool_ t_, real_ v_, real_set_ itv_]\
|
agriesma@338
|
44 |
\ in ((SubProblem (Reals_,[find_values,tool],(DiffAppl_,find_values)) \
|
agriesma@338
|
45 |
\ [real_ mx_, real_ (Rhs t_), real_ v_, real_ m_, \
|
agriesma@338
|
46 |
\ bool_list_ (dropWhile (ident e_) rs_)])::bool list))";
|
agriesma@338
|
47 |
|
agriesma@338
|
48 |
|
agriesma@338
|
49 |
"######################################################";
|
agriesma@338
|
50 |
"############## Make_fun_by_new_variable ##############";
|
agriesma@338
|
51 |
"######################################################";
|
agriesma@338
|
52 |
|
agriesma@338
|
53 |
val sc = (the o (parse DiffApp.thy)) (*start interpretieren*)
|
agriesma@338
|
54 |
"Script Make_fun_by_new_variable (f_::real) (v_::real) \
|
agriesma@338
|
55 |
\ (eqs_::bool list) = \
|
agriesma@338
|
56 |
\(let h_ = (hd o (filter (Testvar m_))) eqs_; \
|
agriesma@338
|
57 |
\ es_ = dropWhile (ident h_) eqs_; \
|
agriesma@338
|
58 |
\ vs_ = dropWhile (ident f_) (Var h_); \
|
agriesma@338
|
59 |
\ v1_ = Nth 1 vs_; \
|
agriesma@338
|
60 |
\ v2_ = Nth 2 vs_; \
|
agriesma@338
|
61 |
\ e1_ = (hd o (filter (Testvar v1_))) es_; \
|
agriesma@338
|
62 |
\ e2_ = (hd o (filter (Testvar v2_))) es_; \
|
agriesma@338
|
63 |
\ (s_1::bool list) = (SubProblem(Reals_, [univar,equation],(Isac_,no_met))\
|
agriesma@338
|
64 |
\ [bool_ e1_, real_ v1_]);\
|
agriesma@338
|
65 |
\ (s_2::bool list) = (SubProblem(Reals_, [univar,equation],(Isac_,no_met))\
|
agriesma@338
|
66 |
\ [bool_ e2_, real_ v2_])\
|
agriesma@338
|
67 |
\in Substitute [(v_1, (Rhs o hd) s_1),(v_2, (Rhs o hd) s_2)] h_)";
|
agriesma@338
|
68 |
val ags = map (term_of o the o (parse DiffApp.thy))
|
agriesma@338
|
69 |
["A::real", "alpha::real",
|
agriesma@338
|
70 |
"[A=a*b, a/2=r*sin alpha, b/2=r*cos alpha]"];
|
agriesma@338
|
71 |
val ll = []:loc_;
|
agriesma@338
|
72 |
(* problem with exn PTREE + eval_to -------------------------
|
agriesma@338
|
73 |
"-------------- subproblem with empty formalizaton -------";
|
agriesma@338
|
74 |
val (mI1,m1) =
|
agriesma@338
|
75 |
("Subproblem", mstep2mstep' pt p
|
agriesma@338
|
76 |
(Subproblem (("Reals",["univar","equation","test"],
|
agriesma@338
|
77 |
(""(*"ANDERN !!!!!!!*),"no_met")),[])));
|
agriesma@338
|
78 |
val (mI2,m2) = (mI1,m1);
|
agriesma@338
|
79 |
val (mI3,m3) =
|
agriesma@338
|
80 |
("Substitute", mstep2mstep' pt p
|
agriesma@338
|
81 |
(Substitute [("a","#2*r*sin alpha"),("b","#2*r*cos alpha")]));
|
agriesma@338
|
82 |
"------- same_tacpbl + eval_to -------";
|
agriesma@338
|
83 |
val Some(l1,t1) = same_tacpbl sc ll (mI1,m1);
|
agriesma@338
|
84 |
loc_2str l1;
|
agriesma@338
|
85 |
(*"[R, R, D, R, D, R, D, R, D, R, D, R, D, R, D, L, R]"*)
|
agriesma@338
|
86 |
Sign.string_of_term (sign_of DiffApp.thy) t1;
|
agriesma@338
|
87 |
(*"solve_univar (Reals, [univar, equation], no_met) B.1 B.3 "?6 ?4 *)
|
agriesma@338
|
88 |
|
agriesma@338
|
89 |
val Some(l2,t2) = same_tacpbl sc l1 (mI2,m2);
|
agriesma@338
|
90 |
loc_2str l2;
|
agriesma@338
|
91 |
(*"[R, R, D, R, D, R, D, R, D, R, D, R, D, R, D, R, D, L, R]"*)
|
agriesma@338
|
92 |
Sign.string_of_term (sign_of DiffApp.thy) t2;
|
agriesma@338
|
93 |
(*"solve_univar (Reals, [univar, equation], no_met) B.1 B.3 "?7 ?3 *)
|
agriesma@338
|
94 |
|
agriesma@338
|
95 |
val Some(l3,t3) = same_tacpbl sc l2 (mI3,m3);
|
agriesma@338
|
96 |
loc_2str l3;
|
agriesma@338
|
97 |
(*"[R, R, D, R, D, R, D, R, D, R, D, R, D, R, D, R, D, R, D]"*)
|
agriesma@338
|
98 |
Sign.string_of_term (sign_of DiffApp.thy) t3;
|
agriesma@338
|
99 |
(*"Substitute [(v_1, (Rhs o hd) B.1), (v_2, (Rhs o hd) B.0)] B.8"*)
|
agriesma@338
|
100 |
|
agriesma@338
|
101 |
|
agriesma@338
|
102 |
"------- eq_tacIDs + eq_consts + eval_args -------";
|
agriesma@338
|
103 |
val eq_ids = eq_tacIDs (*start-loc_*)[] sc (mI,m) [];
|
agriesma@338
|
104 |
val eq_cons = filter (eq_consts m) eq_ids;
|
agriesma@338
|
105 |
val Ready (l,(_,m)::_,_) = eval_args sc (mI,m) [(1,ags)] eq_cons;
|
agriesma@338
|
106 |
"------- locate -------";
|
agriesma@338
|
107 |
|
agriesma@338
|
108 |
|
agriesma@338
|
109 |
"-------------- subproblem with formalizaton -------";
|
agriesma@338
|
110 |
val (mI,m) =
|
agriesma@338
|
111 |
("Subproblem", mstep2mstep' pt []
|
agriesma@338
|
112 |
(Subproblem (("Reals",["univar","equation","test"],
|
agriesma@338
|
113 |
(""(*"ANDERN !!!!!!!*),"no_met")),
|
agriesma@338
|
114 |
["a//#2=r*sin alpha","a"])));
|
agriesma@338
|
115 |
"------- same_tacpbl + eval_to -------";
|
agriesma@338
|
116 |
|
agriesma@338
|
117 |
|
agriesma@338
|
118 |
"------- eq_tacIDs + eq_consts + eval_args -------";
|
agriesma@338
|
119 |
val eq_ids = eq_tacIDs [] sc (mI,m) [];
|
agriesma@338
|
120 |
val eq_cons = filter (eq_consts m) eq_ids;
|
agriesma@338
|
121 |
val Ready (l,(_,m)::_,_) = eval_args sc (mI,m) [(1,ags)] eq_cons;
|
agriesma@338
|
122 |
|
agriesma@338
|
123 |
|
agriesma@338
|
124 |
"------- locate -------";
|
agriesma@338
|
125 |
-------------------------------------------------------*)
|
agriesma@338
|
126 |
(* use"ME/script.sml";
|
agriesma@338
|
127 |
use"test-script.sml";
|
agriesma@338
|
128 |
*)
|
agriesma@338
|
129 |
|
agriesma@338
|
130 |
|
agriesma@338
|
131 |
|
agriesma@338
|
132 |
(*#####################################################*)
|
agriesma@338
|
133 |
(*#####################################################*)
|
agriesma@338
|
134 |
"############## Make_fun_by_explicit ##############";
|
agriesma@338
|
135 |
val c = (the o (parse DiffApp.thy))
|
agriesma@338
|
136 |
"Script Make_fun_by_explicit (f_::real) (v_::real) \
|
agriesma@338
|
137 |
\ (eqs_::bool list) = \
|
agriesma@338
|
138 |
\ (let h_ = (hd o (filter (Testvar m_))) eqs_; \
|
agriesma@338
|
139 |
\ e1_ = hd (dropWhile (ident h_) eqs_); \
|
agriesma@338
|
140 |
\ vs_ = dropWhile (ident f_) (Var h_); \
|
agriesma@338
|
141 |
\ v1_ = hd (dropWhile (ident v_) vs_); \
|
agriesma@338
|
142 |
\ (s1::bool list) = (SubProblem (Reals_, [univar,equation],(Isac_,no_met))\
|
agriesma@338
|
143 |
\ [bool_ e1_, real_ v1_])\
|
agriesma@338
|
144 |
\ in Substitute [(v_1, (Rhs o hd) s_1)] h_)";
|
agriesma@338
|
145 |
|
agriesma@338
|
146 |
|
agriesma@338
|
147 |
(*#####################################################--------11.5.02
|
agriesma@338
|
148 |
"################ Solve_root_equation #################";
|
agriesma@338
|
149 |
(*#####################################################*)
|
agriesma@338
|
150 |
val sc = (term_of o the o (parse Test.thy))
|
agriesma@338
|
151 |
"Script Solve_root_equation (eq_::bool) (v_::real) (err_::bool) =\
|
agriesma@338
|
152 |
\ (let e_ = Rewrite square_equation_left True eq_; \
|
agriesma@338
|
153 |
\ e_ = Rewrite_Set Test_simplify False e_; \
|
agriesma@338
|
154 |
\ e_ = Rewrite_Set rearrange_assoc False e_; \
|
agriesma@338
|
155 |
\ e_ = Rewrite_Set isolate_root False e_; \
|
agriesma@338
|
156 |
\ e_ = Rewrite_Set Test_simplify False e_; \
|
agriesma@338
|
157 |
|
agriesma@338
|
158 |
\ e_ = Rewrite square_equation_left True e_; \
|
agriesma@338
|
159 |
\ e_ = Rewrite_Set Test_simplify False e_; \
|
agriesma@338
|
160 |
|
agriesma@338
|
161 |
\ e_ = Rewrite_Set norm_equation False e_; \
|
agriesma@338
|
162 |
\ e_ = Rewrite_Set Test_simplify False e_; \
|
agriesma@338
|
163 |
\ e_ = Rewrite_Set_Inst [(bdv,v_)] isolate_bdv False e_;\
|
agriesma@338
|
164 |
\ e_ = Rewrite_Set Test_simplify False e_ \
|
agriesma@338
|
165 |
\ in [e_::bool])";
|
agriesma@338
|
166 |
val ags = map (term_of o the o (parse Test.thy))
|
agriesma@338
|
167 |
["sqrt(#9+#4*x)=sqrt x + sqrt(#5+x)", "x::real","#0"];
|
agriesma@338
|
168 |
val fmz =
|
agriesma@338
|
169 |
["equality (sqrt(#9+#4*x)=sqrt x + sqrt(#5+x))",
|
agriesma@338
|
170 |
"solveFor x","errorBound (eps = #0)","solutions v_i_"];
|
agriesma@338
|
171 |
----------------------------------------------------------------11.5.02...*)
|
agriesma@338
|
172 |
|
agriesma@338
|
173 |
|
agriesma@338
|
174 |
(*#####################################################*)
|
agriesma@338
|
175 |
"------- Notlocatable: Free_Solve -------";
|
agriesma@338
|
176 |
"------- Notlocatable: Free_Solve -------";
|
agriesma@338
|
177 |
"------- Notlocatable: Free_Solve -------";
|
agriesma@338
|
178 |
val fmz = [];
|
agriesma@338
|
179 |
val (dI',pI',mI') =
|
agriesma@338
|
180 |
("Test.thy",["sqroot-test","univariate","equation","test"],
|
agriesma@338
|
181 |
("Test.thy","sqrt-equ-test"));
|
agriesma@338
|
182 |
val (mI,m) = ("Init_Proof",Init_Proof (fmz, (dI',pI',mI')));
|
agriesma@338
|
183 |
val (p,_,f,nxt,_,pt) = me (mI,m) e_pos'[1] EmptyPtree;
|
agriesma@338
|
184 |
val nxt =
|
agriesma@338
|
185 |
("Add_Given",
|
agriesma@338
|
186 |
Add_Given "equality (sqrt (9 + 4 * x) = sqrt x + sqrt (5 + x))");
|
agriesma@338
|
187 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
agriesma@338
|
188 |
val nxt = ("Add_Given",Add_Given "solveFor x");
|
agriesma@338
|
189 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
agriesma@338
|
190 |
val nxt = ("Add_Given",Add_Given "errorBound (eps = 0)");
|
agriesma@338
|
191 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
agriesma@338
|
192 |
val nxt = ("Add_Find",Add_Find "solutions v_i_");
|
agriesma@338
|
193 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
agriesma@338
|
194 |
val nxt = ("Specify_Domain",Specify_Domain "Test.thy");
|
agriesma@338
|
195 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
agriesma@338
|
196 |
val nxt =
|
agriesma@338
|
197 |
("Specify_Problem",Specify_Problem ["sqroot-test","univariate","equation","test"]);
|
agriesma@338
|
198 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
agriesma@338
|
199 |
val nxt = ("Specify_Method",Specify_Method ("Test.thy","sqrt-equ-test"));
|
agriesma@338
|
200 |
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
|
agriesma@338
|
201 |
|
agriesma@338
|
202 |
"--- -1 ---";
|
agriesma@338
|
203 |
val nxt = ("Free_Solve",Free_Solve);
|
agriesma@338
|
204 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
agriesma@338
|
205 |
|
agriesma@338
|
206 |
"--- 0 ---";
|
agriesma@338
|
207 |
val nxt = ("Take",Take "sqrt(9+4*x)=sqrt x + sqrt(5+x)");
|
agriesma@338
|
208 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
agriesma@338
|
209 |
(*me ("Begin_Trans" ////*)
|
agriesma@338
|
210 |
|
agriesma@338
|
211 |
"--- 1 ---";
|
agriesma@338
|
212 |
val nxt = ("Rewrite_Asm",Rewrite_Asm ("square_equation_left",""));
|
agriesma@338
|
213 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
agriesma@338
|
214 |
|
agriesma@338
|
215 |
"--- 2 ---";
|
agriesma@338
|
216 |
val nxt = ("Rewrite_Set",Rewrite_Set "Test_simplify");
|
agriesma@338
|
217 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
agriesma@338
|
218 |
|
agriesma@338
|
219 |
"--- 3 ---";
|
agriesma@338
|
220 |
val nxt = ("Rewrite_Set",Rewrite_Set "rearrange_assoc");
|
agriesma@338
|
221 |
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
|
agriesma@338
|
222 |
if f = Form'
|
agriesma@338
|
223 |
(FormKF
|
agriesma@338
|
224 |
(~1,EdUndef,1,Nundef,
|
agriesma@338
|
225 |
"9 + 4 * x = 5 + 2 * x + 2 * sqrt (x ^^^ 2 + 5 * x)"))
|
agriesma@338
|
226 |
then () else raise error "behaviour in root-expl. Free_Solve changed";
|
agriesma@338
|
227 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
228 |
|
agriesma@338
|
229 |
|
agriesma@338
|
230 |
|
agriesma@338
|
231 |
val d = e_rls;
|
agriesma@338
|
232 |
|
agriesma@338
|
233 |
" --- test100: nxt_tac order------------------------------------ ";
|
agriesma@338
|
234 |
" --- test100: nxt_tac order------------------------------------ ";
|
agriesma@338
|
235 |
|
agriesma@338
|
236 |
val scr as (Script sc) = Script (((inst_abs Test.thy)
|
agriesma@338
|
237 |
o term_of o the o (parse thy))
|
agriesma@338
|
238 |
"Script Testeq (e_::bool) = \
|
agriesma@338
|
239 |
\(While (contains_root e_) Do \
|
agriesma@338
|
240 |
\((Try (Repeat (Rewrite rroot_square_inv False))) @@ \
|
agriesma@338
|
241 |
\ (Try (Repeat (Rewrite square_equation_left True))) @@ \
|
agriesma@338
|
242 |
\ (Try (Repeat (Rewrite radd_0 False)))))\
|
agriesma@338
|
243 |
\ e_ ");
|
agriesma@338
|
244 |
atomty thy sc;
|
agriesma@338
|
245 |
val (dI',pI',mI') = ("Test.thy",e_pblID,
|
agriesma@338
|
246 |
("Test.thy","sqrt-equ-test"));
|
agriesma@338
|
247 |
val p = e_pos'; val c = [];
|
agriesma@338
|
248 |
val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
|
agriesma@338
|
249 |
val (p,_,_,_,_,pt) = me (mI,m) p c EmptyPtree;
|
agriesma@338
|
250 |
val nxt = ("Specify_Domain",Specify_Domain "Test.thy");
|
agriesma@338
|
251 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
252 |
val nxt = ("Specify_Method",Specify_Method("Test.thy","sqrt-equ-test")); (*for asm in square_equation_left*)
|
agriesma@338
|
253 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
254 |
val p = ([1],Res):pos';
|
agriesma@338
|
255 |
val eq_ = (term_of o the o (parse thy))"e_::bool";
|
agriesma@338
|
256 |
|
agriesma@338
|
257 |
val ct = "0+(sqrt(sqrt(sqrt a))^^^2)^^^2=0";
|
agriesma@338
|
258 |
val ve0_= (term_of o the o (parse thy)) ct;
|
agriesma@338
|
259 |
val ets0=[([],(Mstep'(Script.thy,"BS","",""),[(eq_,ve0_)],[(eq_,ve0_)],
|
agriesma@338
|
260 |
e_term,e_term,Safe)),
|
agriesma@338
|
261 |
([],(User', [], [], e_term, e_term,Sundef))]:ets;
|
agriesma@338
|
262 |
val l0 = [];
|
agriesma@338
|
263 |
" --------------- 1. ---------------------------------------------";
|
agriesma@338
|
264 |
val (pt,_) = cappend_atomic pt[1]e_istate""(Rewrite("test","")) ct Complete;
|
agriesma@338
|
265 |
val Appl m'=applicable_in p pt (Rewrite("rroot_square_inv",""));
|
agriesma@338
|
266 |
|
agriesma@338
|
267 |
|
agriesma@338
|
268 |
(*-----------11.5.02: ets disabolished ------------------
|
agriesma@338
|
269 |
|
agriesma@338
|
270 |
val NextStep(l1,m') = nxt_tac "Test.thy" (pt,p) scr ets0 l0;
|
agriesma@338
|
271 |
(*val l = [R,R,L,R,R,R] : loc_
|
agriesma@338
|
272 |
val m' = Rewrite'...("rroot_square_inv",..(sqrt (sqrt (sqrt a))..
|
agriesma@338
|
273 |
-> sqrt (sqrt a)*)
|
agriesma@338
|
274 |
|
agriesma@338
|
275 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets1)] =
|
agriesma@338
|
276 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets0 l0;
|
agriesma@338
|
277 |
val ets1 = (drop_last ets0) @ ets1;val pt = update_ets pt [] [(1,ets1)];
|
agriesma@338
|
278 |
writeln(ets2str ets1);
|
agriesma@338
|
279 |
" --------------- 2. ---------------------------------------------";
|
agriesma@338
|
280 |
val Appl m'=applicable_in p pt (Rewrite("rroot_square_inv",""));
|
agriesma@338
|
281 |
|
agriesma@338
|
282 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
283 |
(*val l = [R,R,L,R,R,R] : loc_
|
agriesma@338
|
284 |
val m' = Rewrite'...("rroot_square_inv",..,sqrt (sqrt a)..
|
agriesma@338
|
285 |
-> #0+ sqrt a =#0*)
|
agriesma@338
|
286 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
287 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
288 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
289 |
writeln(ets2str ets2);
|
agriesma@338
|
290 |
" --------------- 3. ---------------------------------------------";
|
agriesma@338
|
291 |
val Appl m'=applicable_in p pt (Rewrite("radd_0",""));
|
agriesma@338
|
292 |
|
agriesma@338
|
293 |
val NextStep(l3,m') = nxt_tac "Test.thy" (pt,p) scr ets2 l2;
|
agriesma@338
|
294 |
(*val l = [R,R,R,D,R,D,R,R] : loc_
|
agriesma@338
|
295 |
val m' = Rewrite'...("radd_0","")..(#0 + sqrt a = #0)..-> sqrt a = #0*)
|
agriesma@338
|
296 |
|
agriesma@338
|
297 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets3)] =
|
agriesma@338
|
298 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets2 l2;
|
agriesma@338
|
299 |
val ets3 = (drop_last ets2) @ ets3; val pt = update_ets pt [] [(1,ets3)];
|
agriesma@338
|
300 |
writeln(ets2str ets3);
|
agriesma@338
|
301 |
" --------------- 4. ---------------------------------------------";
|
agriesma@338
|
302 |
val Appl m'=applicable_in p pt (Rewrite("square_equation_left",""));
|
agriesma@338
|
303 |
|
agriesma@338
|
304 |
val NextStep(l4,m') = nxt_tac "Test.thy" (pt,p) scr ets3 l3;
|
agriesma@338
|
305 |
(*val l = [R,R,R,D,L,R,R,R] : loc_
|
agriesma@338
|
306 |
val m' = Rewrite'...("square_equation_left"..(sqrt a = #0)..a = #0^#2*)
|
agriesma@338
|
307 |
|
agriesma@338
|
308 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets4)] =
|
agriesma@338
|
309 |
(*=====*) locate_gen "Test.thy" m' (pt,p) (scr,d) ets3 l3;
|
agriesma@338
|
310 |
val ets4 = (drop_last ets3) @ ets4; val pt = update_ets pt [] [(1,ets4)];
|
agriesma@338
|
311 |
|
agriesma@338
|
312 |
" --------------- 5. ---------------------------------------------";
|
agriesma@338
|
313 |
val Finished _ = nxt_tac "Test.thy" (pt,p) scr ets4 l4;
|
agriesma@338
|
314 |
|
agriesma@338
|
315 |
writeln (pr_ptree pr_short pt);writeln("result: "^res^
|
agriesma@338
|
316 |
"\n===================================================================");
|
agriesma@338
|
317 |
"--- test100 nxt_tac order: finished correctly ---------------";
|
agriesma@338
|
318 |
"--- test100 nxt_tac order: finished correctly ---------------";
|
agriesma@338
|
319 |
"--- test100 nxt_tac order: finished correctly ---------------";
|
agriesma@338
|
320 |
|
agriesma@338
|
321 |
|
agriesma@338
|
322 |
|
agriesma@338
|
323 |
|
agriesma@338
|
324 |
" --- test100: order 1 3 1 2 ----------------------------------- ";
|
agriesma@338
|
325 |
" --- test100: order 1 3 1 2 ----------------------------------- ";
|
agriesma@338
|
326 |
val scr as (Script sc) =
|
agriesma@338
|
327 |
Script (((inst_abs Test.thy) o term_of o the o (parse thy))
|
agriesma@338
|
328 |
"Script Testeq (e_::bool) = \
|
agriesma@338
|
329 |
\While (contains_root e_) Do \
|
agriesma@338
|
330 |
\ (let e_ = Try (Repeat (Rewrite rroot_square_inv False e_)); \
|
agriesma@338
|
331 |
\ e_ = Try (Repeat (Rewrite square_equation_left True e_)) \
|
agriesma@338
|
332 |
\ in Try (Repeat (Rewrite radd_0 False e_))) ");
|
agriesma@338
|
333 |
val (dI',pI',mI') = ("Test.thy",e_pblID,
|
agriesma@338
|
334 |
("Test.thy","sqrt-equ-test"));
|
agriesma@338
|
335 |
val p = e_pos'; val c = [];
|
agriesma@338
|
336 |
val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
|
agriesma@338
|
337 |
val (p,_,_,_,_,pt) = me (mI,m) p c EmptyPtree;
|
agriesma@338
|
338 |
val nxt = ("Specify_Domain",Specify_Domain "Test.thy");
|
agriesma@338
|
339 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
340 |
val nxt = ("Specify_Method",Specify_Method("Test.thy","sqrt-equ-test")); (*for asm in square_equation_left*)
|
agriesma@338
|
341 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
342 |
val p = ([1],Res):pos';
|
agriesma@338
|
343 |
val eq_ = (term_of o the o (parse thy))"e_::bool";
|
agriesma@338
|
344 |
|
agriesma@338
|
345 |
val ct = "#0+(sqrt(sqrt(sqrt a))^^^#2)^^^#2=#0";
|
agriesma@338
|
346 |
val ve0_= (term_of o the o (parse thy)) ct;
|
agriesma@338
|
347 |
val ets0=[([],(Mstep'(Script.thy,"bS","",""),[(eq_,ve0_)],[(eq_,ve0_)],
|
agriesma@338
|
348 |
e_term,e_term,Safe)),
|
agriesma@338
|
349 |
([],(User', [], [], e_term, e_term,Sundef))]:ets;
|
agriesma@338
|
350 |
val l0 = [];
|
agriesma@338
|
351 |
" --------------- 1. --- test100 order 1 3 1 2 --------------------";
|
agriesma@338
|
352 |
val (pt,_) = cappend_atomic pt[1]e_istate""(Rewrite("test","")) ct Complete;
|
agriesma@338
|
353 |
val Appl m'=applicable_in p pt (Rewrite("rroot_square_inv",""));
|
agriesma@338
|
354 |
|
agriesma@338
|
355 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets1)] =
|
agriesma@338
|
356 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets0 l0;
|
agriesma@338
|
357 |
val ets1 = (drop_last ets0) @ ets1;val pt = update_ets pt [] [(1,ets1)];
|
agriesma@338
|
358 |
writeln (ets2str ets1);
|
agriesma@338
|
359 |
" --------------- 2. --- test100 order 1 3 1 2 --------------------";
|
agriesma@338
|
360 |
val Appl m'=applicable_in p pt (Rewrite("radd_0",""));
|
agriesma@338
|
361 |
val Rewrite'(_,_,_,_,("radd_0",""),f,(_,[])) = m';
|
agriesma@338
|
362 |
Sign.string_of_term (sign_of (thy)) f;
|
agriesma@338
|
363 |
(*"#0 + sqrt (sqrt a) ^^^ #2 = #0"
|
agriesma@338
|
364 |
-> AssocWeak .. pt aus ass_up,ass_dn,assy _verworfen_.. nur letzte tac*)
|
agriesma@338
|
365 |
|
agriesma@338
|
366 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
367 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
368 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
369 |
" --------------- 3. --- test100 order 1 3 1 2 --------------------";
|
agriesma@338
|
370 |
val Appl m'=applicable_in p pt (Rewrite("rroot_square_inv",""));
|
agriesma@338
|
371 |
|
agriesma@338
|
372 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets3)] =
|
agriesma@338
|
373 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets2 l2;
|
agriesma@338
|
374 |
val ets3 = (drop_last ets2) @ ets3; val pt = update_ets pt [] [(1,ets3)];
|
agriesma@338
|
375 |
" --------------- 4. --- test100 order 1 3 1 2 --------------------";
|
agriesma@338
|
376 |
val Appl m'=applicable_in p pt (Rewrite("square_equation_left",""));
|
agriesma@338
|
377 |
|
agriesma@338
|
378 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets4)] =
|
agriesma@338
|
379 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets3 l3;
|
agriesma@338
|
380 |
val ets4 = (drop_last ets3) @ ets4; val pt = update_ets pt [] [(1,ets4)];
|
agriesma@338
|
381 |
if res="a = #0 ^^^ #2"then()else raise error "test100 order 1 3 1 2";
|
agriesma@338
|
382 |
" --------------- 5. --- test100 order 1 3 1 2 --------------------";
|
agriesma@338
|
383 |
val Finished _ = nxt_tac "Test.thy" (pt,p) scr ets4 l4;
|
agriesma@338
|
384 |
writeln (pr_ptree pr_short pt);writeln("result: "^res^
|
agriesma@338
|
385 |
"\n===================================================================");
|
agriesma@338
|
386 |
"--- test100 order 1 3 1 2: finished correctly --------------";
|
agriesma@338
|
387 |
"--- test100 order 1 3 1 2: finished correctly --------------";
|
agriesma@338
|
388 |
|
agriesma@338
|
389 |
|
agriesma@338
|
390 |
|
agriesma@338
|
391 |
|
agriesma@338
|
392 |
" --- test200: nxt_tac order ------------------------------------- ";
|
agriesma@338
|
393 |
" --- test200: nxt_tac order ------------------------------------- ";
|
agriesma@338
|
394 |
|
agriesma@338
|
395 |
val scr as (Script sc) =
|
agriesma@338
|
396 |
Script (((inst_abs Test.thy) o term_of o the o (parse thy))
|
agriesma@338
|
397 |
"Script Testterm (g_::real) = \
|
agriesma@338
|
398 |
\Repeat \
|
agriesma@338
|
399 |
\ ((Repeat (Rewrite rmult_1 False g_)) Or \
|
agriesma@338
|
400 |
\ (Repeat (Rewrite rmult_0 False g_)) Or \
|
agriesma@338
|
401 |
\ (Repeat (Rewrite radd_0 False g_))) ");
|
agriesma@338
|
402 |
val d = e_rls; (*domain-rls for assod*)
|
agriesma@338
|
403 |
val (dI',pI',mI') = ("Test.thy",e_pblID,
|
agriesma@338
|
404 |
("Test.thy","sqrt-equ-test"));
|
agriesma@338
|
405 |
val p = e_pos'; val c = [];
|
agriesma@338
|
406 |
val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
|
agriesma@338
|
407 |
val (p,_,_,_,_,pt) = me (mI,m) p c EmptyPtree;
|
agriesma@338
|
408 |
val nxt = ("Specify_Domain",Specify_Domain "Test.thy");
|
agriesma@338
|
409 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
410 |
val nxt = ("Specify_Method",Specify_Method ("Test.thy","sqrt-equ-test")); (*for asm in square_equation_left*)
|
agriesma@338
|
411 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
412 |
val p = ([1],Res):pos';
|
agriesma@338
|
413 |
val g_ = (term_of o the o (parse thy)) "g_";
|
agriesma@338
|
414 |
|
agriesma@338
|
415 |
val ct = "(#0+#0)*(#1*(#1*a))";
|
agriesma@338
|
416 |
val vg0_= (term_of o the o (parse thy)) ct;
|
agriesma@338
|
417 |
val ets0 = [([],(Mstep'(Script.thy,"sB","",""), [(g_,vg0_)], [(g_,vg0_)],
|
agriesma@338
|
418 |
e_term, e_term,Safe)),
|
agriesma@338
|
419 |
([],(User', [], [], e_term, e_term,Sundef))]:ets;
|
agriesma@338
|
420 |
val l0 = [];
|
agriesma@338
|
421 |
" --------------- 1. ---------------------------------------------";
|
agriesma@338
|
422 |
val (pt,_) = cappend_atomic pt[1]e_istate ""(Rewrite("test",""))ct Complete;
|
agriesma@338
|
423 |
val Appl m'=applicable_in p pt (Rewrite("rmult_1",""));
|
agriesma@338
|
424 |
|
agriesma@338
|
425 |
val NextStep(l1,m') = nxt_tac "Test.thy" (pt,p) scr ets0 l0;
|
agriesma@338
|
426 |
(*val l = [R,R,L,R,L,R,R] : loc_
|
agriesma@338
|
427 |
val m' = Rewrite' ... ("rmult_1","") (#0+#0)*#1*(#1*a)*)
|
agriesma@338
|
428 |
|
agriesma@338
|
429 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets1)] =
|
agriesma@338
|
430 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets0 l0;
|
agriesma@338
|
431 |
val ets1 = (drop_last ets0) @ ets1;val pt = update_ets pt [] [(1,ets1)];
|
agriesma@338
|
432 |
|
agriesma@338
|
433 |
" --------------- 2. ---------------------------------------------";
|
agriesma@338
|
434 |
val Appl m'=applicable_in p pt (Rewrite("rmult_1",""));
|
agriesma@338
|
435 |
|
agriesma@338
|
436 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
437 |
(*val l = [R,R,L,R,L,R,R] : loc_
|
agriesma@338
|
438 |
val m' = Rewrite' ... ("rmult_1","") (#0+#0)*#1*a*)
|
agriesma@338
|
439 |
|
agriesma@338
|
440 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
441 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
442 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
443 |
|
agriesma@338
|
444 |
" --------------- 3. ---------------------------------------------";
|
agriesma@338
|
445 |
val Appl m'=applicable_in p pt (Rewrite("radd_0",""));
|
agriesma@338
|
446 |
|
agriesma@338
|
447 |
val NextStep(l3,m') = nxt_tac "Test.thy" (pt,p) scr ets2 l2;
|
agriesma@338
|
448 |
(*val l = [R,R,R,R] : loc_
|
agriesma@338
|
449 |
val m' = Rewrite'...("radd_0","") (#0+#0)*a *)
|
agriesma@338
|
450 |
|
agriesma@338
|
451 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets3)] =
|
agriesma@338
|
452 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets2 l2;
|
agriesma@338
|
453 |
val ets3 = (drop_last ets2) @ ets3; val pt = update_ets pt [] [(1,ets3)];
|
agriesma@338
|
454 |
|
agriesma@338
|
455 |
" --------------- 4. ---------------------------------------------";
|
agriesma@338
|
456 |
val Appl m'=applicable_in p pt (Rewrite("rmult_0",""));
|
agriesma@338
|
457 |
|
agriesma@338
|
458 |
val NextStep(l4,m') = nxt_tac "Test.thy" (pt,p) scr ets3 l3;
|
agriesma@338
|
459 |
(*al l = [R,R,L,R,R,R] : loc_
|
agriesma@338
|
460 |
val m' = Rewrite'...("rmult_0","") #0*a *)
|
agriesma@338
|
461 |
|
agriesma@338
|
462 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets4)] =
|
agriesma@338
|
463 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets3 l3;
|
agriesma@338
|
464 |
val ets4 = (drop_last ets3) @ ets4; val pt = update_ets pt [] [(1,ets4)];
|
agriesma@338
|
465 |
|
agriesma@338
|
466 |
" --------------- 5. ---------------------------------------------";
|
agriesma@338
|
467 |
val Finished _ = nxt_tac "Test.thy" (pt,p) scr ets4 l4;
|
agriesma@338
|
468 |
(*al l = [R,R,L,R,R,R] : loc_
|
agriesma@338
|
469 |
val m' = Rewrite'...("rmult_0","") #0*a *)
|
agriesma@338
|
470 |
writeln (pr_ptree pr_short pt);writeln("result: "^res^
|
agriesma@338
|
471 |
"\n===================================================================");
|
agriesma@338
|
472 |
"--- test200 nxt_tac order: finished correctly ---------------";
|
agriesma@338
|
473 |
"--- test200 nxt_tac order: finished correctly ---------------";
|
agriesma@338
|
474 |
|
agriesma@338
|
475 |
|
agriesma@338
|
476 |
|
agriesma@338
|
477 |
|
agriesma@338
|
478 |
" --- test200: order 3 1 1 2 --------------------------------- ";
|
agriesma@338
|
479 |
" --- test200: order 3 1 1 2 --------------------------------- ";
|
agriesma@338
|
480 |
val p = e_pos'; val c = [];
|
agriesma@338
|
481 |
val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
|
agriesma@338
|
482 |
val (p,_,_,_,_,pt) = me (mI,m) p c EmptyPtree;
|
agriesma@338
|
483 |
val nxt = ("Specify_Domain",Specify_Domain "Test.thy");
|
agriesma@338
|
484 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
485 |
val nxt = ("Specify_Method",Specify_Method ("Test.thy","sqrt-equ-test")); (*for asm in square_equation_left*)
|
agriesma@338
|
486 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
487 |
val p = ([1],Res):pos';
|
agriesma@338
|
488 |
val g_ = (term_of o the o (parse thy)) "g_";
|
agriesma@338
|
489 |
|
agriesma@338
|
490 |
val ct = "(#0+#0)*(#1*(#1*a))";
|
agriesma@338
|
491 |
val vg0_= (term_of o the o (parse thy)) ct;
|
agriesma@338
|
492 |
val ets0 = [([],(Mstep'(Script.thy,"sB","",""),[(g_,vg0_)],[(g_,vg0_)],
|
agriesma@338
|
493 |
e_term,e_term,Safe)),
|
agriesma@338
|
494 |
([],(User', [], [], e_term, e_term,Sundef))]:ets;
|
agriesma@338
|
495 |
val l0 = [];
|
agriesma@338
|
496 |
" --------------- 1. --- test200: order 3 1 1 2 -----------------";
|
agriesma@338
|
497 |
val (pt,_) = cappend_atomic pt[1]e_istate ""(Rewrite("test",""))ct Complete;
|
agriesma@338
|
498 |
val Appl m'=applicable_in p pt (Rewrite("radd_0",""));
|
agriesma@338
|
499 |
|
agriesma@338
|
500 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets1)] =
|
agriesma@338
|
501 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets0 l0;
|
agriesma@338
|
502 |
val ets1 = (drop_last ets0) @ ets1;val pt = update_ets pt [] [(1,ets1)];
|
agriesma@338
|
503 |
|
agriesma@338
|
504 |
" --------------- 2. --- test200: order 3 1 1 2 -----------------";
|
agriesma@338
|
505 |
val Appl m'=applicable_in p pt (Rewrite("rmult_1",""));
|
agriesma@338
|
506 |
|
agriesma@338
|
507 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
508 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
509 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
510 |
if res="#0 * (#1 * a)"then()else raise error "error test200: order 3 1 1 2";
|
agriesma@338
|
511 |
" --------------- 3. --- test200: order 3 1 1 2 -----------------";
|
agriesma@338
|
512 |
val Appl m'=applicable_in p pt (Rewrite("rmult_1",""));
|
agriesma@338
|
513 |
|
agriesma@338
|
514 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets3)] =
|
agriesma@338
|
515 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets2 l2;
|
agriesma@338
|
516 |
val ets3 = (drop_last ets2) @ ets3; val pt = update_ets pt [] [(1,ets3)];
|
agriesma@338
|
517 |
|
agriesma@338
|
518 |
" --------------- 4. --- test200: order 3 1 1 2 -----------------";
|
agriesma@338
|
519 |
val Appl m'=applicable_in p pt (Rewrite("rmult_0",""));
|
agriesma@338
|
520 |
|
agriesma@338
|
521 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets4)] =
|
agriesma@338
|
522 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets3 l3;
|
agriesma@338
|
523 |
val ets4 = (drop_last ets3) @ ets4; val pt = update_ets pt [] [(1,ets4)];
|
agriesma@338
|
524 |
|
agriesma@338
|
525 |
if res="#0"then()else raise error "test200 order 3 1 1 2";
|
agriesma@338
|
526 |
" --------------- 5. --- test200: order 3 1 1 2 -----------------";
|
agriesma@338
|
527 |
val Finished _ = nxt_tac "Test.thy" (pt,p) scr ets4 l4;
|
agriesma@338
|
528 |
writeln (pr_ptree pr_short pt);writeln("result: "^res^
|
agriesma@338
|
529 |
"\n===================================================================");
|
agriesma@338
|
530 |
"--- test200 order 3 1 1 2: finished correctly ---------------";
|
agriesma@338
|
531 |
"--- test200 order 3 1 1 2: finished correctly ---------------";
|
agriesma@338
|
532 |
|
agriesma@338
|
533 |
|
agriesma@338
|
534 |
------------------------------------11.5.02: ets disabolished ---*)
|
agriesma@338
|
535 |
(* use"test-script-nxt_tac.sml";
|
agriesma@338
|
536 |
*)
|
agriesma@338
|
537 |
|
agriesma@338
|
538 |
(*---------11.5.02:
|
agriesma@338
|
539 |
### Currently parsed expression could be extremely ambiguous. ----------
|
agriesma@338
|
540 |
|
agriesma@338
|
541 |
" --- root-equation: nxt_tac order------------------------------ ";
|
agriesma@338
|
542 |
" --- root-equation: nxt_tac order------------------------------ ";
|
agriesma@338
|
543 |
val scr as (Script sc) =
|
agriesma@338
|
544 |
Script (((inst_abs Test.thy) o term_of o the o (parse thy))
|
agriesma@338
|
545 |
"Script Solve_root_equation (e_::bool) (v_::real) (err_::bool) =\
|
agriesma@338
|
546 |
\ (let e_ = \
|
agriesma@338
|
547 |
\ (While (contains_root e_) Do \
|
agriesma@338
|
548 |
\ (let \
|
agriesma@338
|
549 |
\ e_ = Rewrite square_equation_left True e_; \
|
agriesma@338
|
550 |
\ e_ = Try (Rewrite_Set Test_simplify False e_); \
|
agriesma@338
|
551 |
\ e_ = Try (Rewrite_Set rearrange_assoc False e_); \
|
agriesma@338
|
552 |
\ e_ = Try (Rewrite_Set isolate_root False e_) \
|
agriesma@338
|
553 |
\ in Try (Rewrite_Set Test_simplify False e_))); \
|
agriesma@338
|
554 |
\ e_ = Try (Rewrite_Set norm_equation False e_); \
|
agriesma@338
|
555 |
\ e_ = Try (Rewrite_Set Test_simplify False e_); \
|
agriesma@338
|
556 |
\ e_ = Rewrite_Set_Inst [(bdv,v_::real)] isolate_bdv False e_;\
|
agriesma@338
|
557 |
\ e_ = Try (Rewrite_Set Test_simplify False e_) \
|
agriesma@338
|
558 |
\ in [e_::bool])");
|
agriesma@338
|
559 |
val (dI',pI',mI') = ("Test.thy",e_pblID,
|
agriesma@338
|
560 |
("Test.thy","sqrt-equ-test"));
|
agriesma@338
|
561 |
val p = e_pos'; val c = [];
|
agriesma@338
|
562 |
val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
|
agriesma@338
|
563 |
val (p,_,_,_,_,pt) = me (mI,m) p c EmptyPtree;
|
agriesma@338
|
564 |
val nxt = ("Specify_Domain",Specify_Domain "Test.thy");
|
agriesma@338
|
565 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
566 |
val nxt = ("Specify_Method",Specify_Method("Test.thy","sqrt-equ-test")); (*for asm in square_equation_left*)
|
agriesma@338
|
567 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
568 |
val p = ([1],Frm):pos';
|
agriesma@338
|
569 |
|
agriesma@338
|
570 |
val bdv_ =(term_of o the o (parse thy))"v_::real";
|
agriesma@338
|
571 |
val v_ =(term_of o the o (parse thy))"x::real";
|
agriesma@338
|
572 |
val eq_ = (term_of o the o (parse thy))"e_::bool";
|
agriesma@338
|
573 |
val ct = "sqrt(#9+#4*x)=sqrt x + sqrt(#5+x)";
|
agriesma@338
|
574 |
val ve0_= (term_of o the o (parse thy)) ct;
|
agriesma@338
|
575 |
val env= [(bdv_, v_), (eq_, ve0_)];
|
agriesma@338
|
576 |
val ets1 =[([],(Mstep'(Script.thy,"BS","",""),env,env,e_term,e_term,Safe)),
|
agriesma@338
|
577 |
([],(User', [], [], e_term, e_term,Sundef))]:ets;
|
agriesma@338
|
578 |
val l1 = [];
|
agriesma@338
|
579 |
" -------root-equation--- 1.--- nxt_tac-order----------------------";
|
agriesma@338
|
580 |
val (pt,_) = cappend_form pt[1]e_istate ct;
|
agriesma@338
|
581 |
|
agriesma@338
|
582 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
583 |
(*square_equation_left*)
|
agriesma@338
|
584 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
585 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
586 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
587 |
if res = "#9 + #4 * x = (sqrt x + sqrt (#5 + x)) ^^^ #2"
|
agriesma@338
|
588 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
589 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
590 |
" -------root-equation--- 2.--- nxt_tac-order----------------------";
|
agriesma@338
|
591 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
592 |
(*
|
agriesma@338
|
593 |
> val eee = (hd) ets2;
|
agriesma@338
|
594 |
> val (_,(_,_,ennv,_,rees,_)) = eee;
|
agriesma@338
|
595 |
> subst2str ennv;
|
agriesma@338
|
596 |
> Sign.string_of_term (sign_of ( thy)) rees;
|
agriesma@338
|
597 |
*)
|
agriesma@338
|
598 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
599 |
(*Test_simplify*)
|
agriesma@338
|
600 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
601 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
602 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
603 |
if res = "#9 + #4 * x = #5 + (#2 * x + #2 * sqrt (x ^^^ #2 + #5 * x))"
|
agriesma@338
|
604 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
605 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
606 |
" -------root-equation--- 3.--- nxt_tac-order----------------------";
|
agriesma@338
|
607 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
608 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
609 |
(*rearrange_assoc*)
|
agriesma@338
|
610 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
611 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
612 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
613 |
if res = "#9 + #4 * x = #5 + #2 * x + #2 * sqrt (x ^^^ #2 + #5 * x)"
|
agriesma@338
|
614 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
615 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
616 |
" -------root-equation--- 4.--- nxt_tac-order----------------------";
|
agriesma@338
|
617 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
618 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
619 |
(*isolate_root*)
|
agriesma@338
|
620 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
621 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
622 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
623 |
if res = "sqrt (x ^^^ #2 + #5 * x) = (#5 + #2 * x + #-1 * (#9 + #4 * x)) // (#-1 * #2)"
|
agriesma@338
|
624 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
625 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
626 |
" -------root-equation--- 5.--- nxt_tac-order----------------------";
|
agriesma@338
|
627 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
628 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
629 |
(*Test_simplify*)
|
agriesma@338
|
630 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
631 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
632 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
633 |
if res = "sqrt (x ^^^ #2 + #5 * x) = #2 + x"
|
agriesma@338
|
634 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
635 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
636 |
" -------root-equation--- 6.--- nxt_tac-order----------------------";
|
agriesma@338
|
637 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
638 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
639 |
(*square_equation_left*)
|
agriesma@338
|
640 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
641 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
642 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
643 |
if res = "x ^^^ #2 + #5 * x = (#2 + x) ^^^ #2"
|
agriesma@338
|
644 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
645 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
646 |
" -------root-equation--- 7.--- nxt_tac-order----------------------";
|
agriesma@338
|
647 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
648 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
649 |
(*Test_simplify*)
|
agriesma@338
|
650 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
651 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
652 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
653 |
if res = "x ^^^ #2 + #5 * x = #4 + (x ^^^ #2 + #4 * x)"
|
agriesma@338
|
654 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
655 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
656 |
" -------root-equation--- 8.--- nxt_tac-order----------------------";
|
agriesma@338
|
657 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
658 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
659 |
(*rearrange_assoc ...<> test-root-equ.sml: norm_equation*)
|
agriesma@338
|
660 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
661 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
662 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
663 |
if res = "x ^^^ #2 + #5 * x = #4 + x ^^^ #2 + #4 * x"
|
agriesma@338
|
664 |
(* "x ^^^ #2 + #5 * x + #-1 * (#4 + (x ^^^ #2 + #4 * x)) = #0"
|
agriesma@338
|
665 |
...<> test-root-equ.sml*)
|
agriesma@338
|
666 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
667 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
668 |
" -------root-equation--- 9.--- nxt_tac-order----------------------";
|
agriesma@338
|
669 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
670 |
(*> Sign.string_of_term (sign_of thy) (go l2 sc);
|
agriesma@338
|
671 |
val it = "Rewrite_Set rearrange_assoc False e_" : string*)
|
agriesma@338
|
672 |
|
agriesma@338
|
673 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
674 |
(*Test_simplify*)
|
agriesma@338
|
675 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
676 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
677 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
678 |
if res = "x ^^^ #2 + #5 * x = #4 + (x ^^^ #2 + #4 * x)"
|
agriesma@338
|
679 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
680 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
681 |
" -------root-equation--- 10.--- nxt_tac-order----------------------";
|
agriesma@338
|
682 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
683 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
684 |
(*norm_equation*)
|
agriesma@338
|
685 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
686 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
687 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
688 |
if res = "x ^^^ #2 + #5 * x + #-1 * (#4 + (x ^^^ #2 + #4 * x)) = #0"
|
agriesma@338
|
689 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
690 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
691 |
" -------root-equation--- 11.--- nxt_tac-order----------------------";
|
agriesma@338
|
692 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
693 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
694 |
(*Test_simplify*)
|
agriesma@338
|
695 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
696 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
697 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
698 |
if res = "#-4 + x = #0"
|
agriesma@338
|
699 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
700 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
701 |
" -------root-equation--- 12.--- nxt_tac-order----------------------";
|
agriesma@338
|
702 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
703 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
704 |
(*isolate_bdv*)
|
agriesma@338
|
705 |
(*> val eee = (last_elem o drop_last) ets2;
|
agriesma@338
|
706 |
> val (_,(mmm,_,ennv,_,rees,_)) = eee;
|
agriesma@338
|
707 |
val mmm = Rewrite_Set'
|
agriesma@338
|
708 |
("Test.thy","erls",false,"Test_simplify",# $ # $ Free #,(# $ #,[]))
|
agriesma@338
|
709 |
> writeln(subst2str ennv);
|
agriesma@338
|
710 |
["(e_, x ^^^ #2 + #5 * x + #-1 * (#4 + (x ^^^ #2 + #4 * x)) = #0)"]
|
agriesma@338
|
711 |
> Sign.string_of_term (sign_of ( thy)) rees;
|
agriesma@338
|
712 |
val it = "#-4 + x = #0" : string*)
|
agriesma@338
|
713 |
|
agriesma@338
|
714 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
715 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
716 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
717 |
if res = "x = #0 + #-1 * #-4"
|
agriesma@338
|
718 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
719 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
720 |
" -------root-equation--- 13.--- nxt_tac-order----------------------";
|
agriesma@338
|
721 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
722 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
723 |
(*Test_simplify*)
|
agriesma@338
|
724 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
725 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
726 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
727 |
if res = "x = #4"
|
agriesma@338
|
728 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
729 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
730 |
" -------root-equation--- 14.--- nxt_tac-order----------------------";
|
agriesma@338
|
731 |
val ets1 = ets2; val l1 = l2;
|
agriesma@338
|
732 |
val Finished _ = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
733 |
|
agriesma@338
|
734 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
735 |
writeln("result: "^res^"\n===================================================================");
|
agriesma@338
|
736 |
" --- root-equation: nxt_tac order .. finised correctly --------- ";
|
agriesma@338
|
737 |
" --- root-equation: nxt_tac order .. finised correctly --------- ";
|
agriesma@338
|
738 |
|
agriesma@338
|
739 |
|
agriesma@338
|
740 |
-------------------------------------11.5.02-----*)
|
agriesma@338
|
741 |
(*-----------------------------------11.5.02 ets disabolished -------
|
agriesma@338
|
742 |
|
agriesma@338
|
743 |
" --- root-equation: 1.norm_equation ------------------------------ ";
|
agriesma@338
|
744 |
" --- root-equation: 1.norm_equation ------------------------------ ";
|
agriesma@338
|
745 |
val p = e_pos'; val c = [];
|
agriesma@338
|
746 |
val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
|
agriesma@338
|
747 |
val (p,_,_,_,_,pt) = me (mI,m) p c EmptyPtree;
|
agriesma@338
|
748 |
val nxt = ("Specify_Domain",Specify_Domain "Test.thy");
|
agriesma@338
|
749 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
750 |
val nxt = ("Specify_Method",Specify_Method("Test.thy","sqrt-equ-test")); (*for asm in square_equation_left*)
|
agriesma@338
|
751 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
752 |
val p = ([1],Frm):pos';
|
agriesma@338
|
753 |
val ets1 =[([],(Mstep'(Script.thy,"BS","",""),env,env,e_term,e_term,Safe)),
|
agriesma@338
|
754 |
user_interrupt]:ets;
|
agriesma@338
|
755 |
" -------root-equation--- 1.--- 1.norm_equation----------------------";
|
agriesma@338
|
756 |
val (pt,_) = cappend_form pt[1]e_istate ct;
|
agriesma@338
|
757 |
val Appl m'= applicable_in p pt (Rewrite_Set "norm_equation");
|
agriesma@338
|
758 |
|
agriesma@338
|
759 |
val l1 = (fst o last_elem o drop_last) ets1;
|
agriesma@338
|
760 |
(*val l1 = [R,L,R,R,L,R];//////////////test-root_equ, me 11.10.00*)
|
agriesma@338
|
761 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
762 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
763 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
764 |
if res = "sqrt (#9 + #4 * x) + #-1 * (sqrt x + sqrt (#5 + x)) = #0"
|
agriesma@338
|
765 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
766 |
|
agriesma@338
|
767 |
val l2 = (fst o last_elem o drop_last) ets2;
|
agriesma@338
|
768 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets2 l2;
|
agriesma@338
|
769 |
val ets1 = ets2;
|
agriesma@338
|
770 |
" -------root-equation--- 2.--- 1.norm_equation----------------------";
|
agriesma@338
|
771 |
(*m'=Rewrite_Set'...,"Test_simplify" *)
|
agriesma@338
|
772 |
val l1 = (fst o last_elem o drop_last) ets1;
|
agriesma@338
|
773 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
774 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
775 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
776 |
if res = "#-1 * sqrt x + (#-1 * sqrt (#5 + x) + sqrt (#9 + #4 * x)) = #0"
|
agriesma@338
|
777 |
then () else raise error "new behaviour in test-example";
|
agriesma@338
|
778 |
|
agriesma@338
|
779 |
val Notappl _ =
|
agriesma@338
|
780 |
applicable_in p pt (Rewrite_Set_Inst(["(bdv,v_)"],"isolate_bdv"));
|
agriesma@338
|
781 |
val Notappl _ = applicable_in p pt (Rewrite_Set "Test_simplify");
|
agriesma@338
|
782 |
|
agriesma@338
|
783 |
val l2 = (fst o last_elem o drop_last) ets2;
|
agriesma@338
|
784 |
val Helpless = nxt_tac "Test.thy" (pt,p) scr ets2 l2;
|
agriesma@338
|
785 |
(* ~~~~ because isolate_bdv goes without Try *)
|
agriesma@338
|
786 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
787 |
val ets1 = ets2;
|
agriesma@338
|
788 |
" -------root-equation--- 3.--- 1.norm_equation----------------------";
|
agriesma@338
|
789 |
val Appl m'= applicable_in p pt (Rewrite_Set "rearrange_assoc");
|
agriesma@338
|
790 |
|
agriesma@338
|
791 |
val l1 = (fst o last_elem o drop_last) ets1;
|
agriesma@338
|
792 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
793 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
794 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
795 |
|
agriesma@338
|
796 |
val l2 = (fst o last_elem o drop_last) ets2;
|
agriesma@338
|
797 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets2 l2;
|
agriesma@338
|
798 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
799 |
val ets1 = ets2;
|
agriesma@338
|
800 |
" -------root-equation--- 4.--- 1.norm_equation----------------------";
|
agriesma@338
|
801 |
(*m' = .. isolate_root*)
|
agriesma@338
|
802 |
val l1 = (fst o last_elem o drop_last) ets1;
|
agriesma@338
|
803 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
804 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
805 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
806 |
|
agriesma@338
|
807 |
val l2 = (fst o last_elem o drop_last) ets2;
|
agriesma@338
|
808 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets2 l2;
|
agriesma@338
|
809 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
810 |
val ets1 = ets2;
|
agriesma@338
|
811 |
" -------root-equation--- 5.--- 1.norm_equation----------------------";
|
agriesma@338
|
812 |
(*m' = .. Test_simplify*)
|
agriesma@338
|
813 |
val l1 = (fst o last_elem o drop_last) ets1;
|
agriesma@338
|
814 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
815 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
816 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
817 |
|
agriesma@338
|
818 |
val l2 = (fst o last_elem o drop_last) ets2;
|
agriesma@338
|
819 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets2 l2;
|
agriesma@338
|
820 |
writeln (pr_ptree pr_short pt);
|
agriesma@338
|
821 |
if res="sqrt (#9 + #4 * x) = sqrt x + sqrt (#5 + x)" then ()
|
agriesma@338
|
822 |
else raise error "new behaviour in test-example";
|
agriesma@338
|
823 |
|
agriesma@338
|
824 |
-------------------------------------11.5.02-----*)
|
agriesma@338
|
825 |
|
agriesma@338
|
826 |
|
agriesma@338
|
827 |
(* use"test-script.sml";
|
agriesma@338
|
828 |
*)
|
agriesma@338
|
829 |
|
agriesma@338
|
830 |
|
agriesma@338
|
831 |
|
agriesma@338
|
832 |
|
agriesma@338
|
833 |
|
agriesma@338
|
834 |
|
agriesma@338
|
835 |
|
agriesma@338
|
836 |
(* --- test200: calculate -----------------------------------------
|
agriesma@338
|
837 |
" --- test200: calculate -----------------------------------------";
|
agriesma@338
|
838 |
val scr as (Script sc) =
|
agriesma@338
|
839 |
Script (((inst_abs Test.thy) o term_of o the o (parse thy))
|
agriesma@338
|
840 |
"Script Testterm (g_::real) = \
|
agriesma@338
|
841 |
\Repeat (Calculate plus g_) ");
|
agriesma@338
|
842 |
val (dI',pI',mI') = ("Test.thy",e_pblID,
|
agriesma@338
|
843 |
("Test.thy","sqrt-equ-test"));
|
agriesma@338
|
844 |
val p = e_pos'; val c = [];
|
agriesma@338
|
845 |
val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
|
agriesma@338
|
846 |
val (p,_,_,_,_,pt) = me (mI,m) p c EmptyPtree;
|
agriesma@338
|
847 |
val nxt = ("Specify_Domain",Specify_Domain "Test.thy");
|
agriesma@338
|
848 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
849 |
val nxt = ("Specify_Method",Specify_Method ("Test.thy","sqrt-equ-test")); (*for asm in square_equation_left*)
|
agriesma@338
|
850 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
851 |
val p = ([1],Res):pos';
|
agriesma@338
|
852 |
val g_ = (term_of o the o (parse thy)) "g_";
|
agriesma@338
|
853 |
val vg_= (term_of o the o (parse thy)) "#1+#2";
|
agriesma@338
|
854 |
val env = [(g_,vg_)];
|
agriesma@338
|
855 |
|
agriesma@338
|
856 |
val ets = []:ets;
|
agriesma@338
|
857 |
(* --------------- 1. ---------------------------------------------*)
|
agriesma@338
|
858 |
val (pt,_) = cappend_atomic pt [1] e_istate ""
|
agriesma@338
|
859 |
(Rewrite("test","")) "#1+#2" Complete;
|
agriesma@338
|
860 |
val Appl m'=applicable_in p pt (Calculate "plus");
|
agriesma@338
|
861 |
|
agriesma@338
|
862 |
val NextStep(l,m') = nxt_tac "Test.thy" (pt,p) scr ets l;
|
agriesma@338
|
863 |
(*val l = [R,R,R,R] : loc_
|
agriesma@338
|
864 |
val m' = Calculate' ("Test.thy","plus", #1+#2 = #3*)
|
agriesma@338
|
865 |
|
agriesma@338
|
866 |
val ets = (l,mstep'2etac m')::ets;
|
agriesma@338
|
867 |
(* --------------- 2. ---------------------------------------------*)
|
agriesma@338
|
868 |
val (pt,_) = cappend_atomic pt [1] e_istate ""
|
agriesma@338
|
869 |
(Rewrite("test","")) "#3" Complete;
|
agriesma@338
|
870 |
|
agriesma@338
|
871 |
val Helpless = nxt_tac "Test.thy" (pt,p) scr ets l;
|
agriesma@338
|
872 |
(*val l = [R,R,R,R] : loc_
|
agriesma@338
|
873 |
val m' = Calculate' ("Test.thy","plus", #1+#2 = #3*)
|
agriesma@338
|
874 |
---*)
|
agriesma@338
|
875 |
|
agriesma@338
|
876 |
|
agriesma@338
|
877 |
(* --- test200: Test_simplify -----------------------------------
|
agriesma@338
|
878 |
|
agriesma@338
|
879 |
val scr as (Script sc) =
|
agriesma@338
|
880 |
Script (((inst_abs Test.thy) o term_of o the o (parse thy))
|
agriesma@338
|
881 |
"Script Testterm (g_::real) = \
|
agriesma@338
|
882 |
\Repeat \
|
agriesma@338
|
883 |
\ ((Repeat (Rewrite radd_mult_distrib2 False g_)) Or \
|
agriesma@338
|
884 |
\ (Repeat (Rewrite rdistr_right_assoc False g_)) Or \
|
agriesma@338
|
885 |
\ (Repeat (Rewrite rdistr_right_assoc_p False g_)) Or \
|
agriesma@338
|
886 |
\ (Repeat (Rewrite rdistr_div_right False g_)) Or \
|
agriesma@338
|
887 |
\ (Repeat (Rewrite rbinom_power_2 False g_)) Or \
|
agriesma@338
|
888 |
\ (Repeat (Rewrite radd_commute False g_)) Or \
|
agriesma@338
|
889 |
\ (Repeat (Rewrite radd_left_commute False g_)) Or \
|
agriesma@338
|
890 |
\ (Repeat (Rewrite radd_assoc False g_)) Or \
|
agriesma@338
|
891 |
\ (Repeat (Rewrite rmult_commute False g_)) Or \
|
agriesma@338
|
892 |
\ (Repeat (Rewrite rmult_left_commute False g_)) Or \
|
agriesma@338
|
893 |
\ (Repeat (Rewrite rmult_assoc False g_)) Or \
|
agriesma@338
|
894 |
\ (Repeat (Rewrite radd_real_const_eq False g_)) Or \
|
agriesma@338
|
895 |
\ (Repeat (Rewrite radd_real_const False g_)) Or \
|
agriesma@338
|
896 |
\ (Repeat (Calculate plus g_)) Or \
|
agriesma@338
|
897 |
\ (Repeat (Calculate times g_)) Or \
|
agriesma@338
|
898 |
\ (Repeat (Rewrite rcollect_right False g_)) Or \
|
agriesma@338
|
899 |
\ (Repeat (Rewrite rcollect_one_left False g_)) Or \
|
agriesma@338
|
900 |
\ (Repeat (Rewrite rcollect_one_left_assoc False g_)) Or \
|
agriesma@338
|
901 |
\ (Repeat (Rewrite rcollect_one_left_assoc_p False g_))) ");
|
agriesma@338
|
902 |
---*)
|
agriesma@338
|
903 |
writeln
|
agriesma@338
|
904 |
"%%%%%%%%%%TODO 7.9.00---vvvvvv--- conflicts with Isa-types \n\
|
agriesma@338
|
905 |
\ (Repeat (Calculate cancel g_)) Or \n\
|
agriesma@338
|
906 |
\ (Repeat (Calculate pow g_)) Or \n\
|
agriesma@338
|
907 |
\%%%%%%%%%%%%%%%%%%%%%---^^^^^^--- conflicts with Isa-types \n\
|
agriesma@338
|
908 |
\%%%%%%%%%%%%%%%%%%%%%TODO before Detail Rewrite_Set";
|
agriesma@338
|
909 |
|
agriesma@338
|
910 |
|
agriesma@338
|
911 |
(*-------------------------------------11.5.02 ets disablished -------
|
agriesma@338
|
912 |
|
agriesma@338
|
913 |
" --- check_elementwise ------------------------------ ";
|
agriesma@338
|
914 |
" --- check_elementwise ------------------------------ ";
|
agriesma@338
|
915 |
val d = e_rls;
|
agriesma@338
|
916 |
val scr as (Script sc) = Script (((inst_abs Test.thy)
|
agriesma@338
|
917 |
o term_of o the o (parse thy))
|
agriesma@338
|
918 |
"Script Testchk (e_::bool) (v_::real) = \
|
agriesma@338
|
919 |
\ (let e_ = Try (Rewrite_Set Test_simplify False e_); \
|
agriesma@338
|
920 |
\ (L_::real list) = Mstep subproblem_equation_dummy; \
|
agriesma@338
|
921 |
\ L_ = Mstep solve_equation_dummy \
|
agriesma@338
|
922 |
\ in Check_elementwise L_ {(v_::real). Assumptions})");
|
agriesma@338
|
923 |
val (dI',pI',mI') = ("Test.thy",e_pblID,
|
agriesma@338
|
924 |
("Test.thy","sqrt-equ-test"));
|
agriesma@338
|
925 |
val p = e_pos'; val c = [];
|
agriesma@338
|
926 |
val (mI,m) = ("Init_Proof",Init_Proof ([], (dI',pI',mI')));
|
agriesma@338
|
927 |
val (p,_,_,_,_,pt) = me (mI,m) p c EmptyPtree;
|
agriesma@338
|
928 |
val nxt = ("Specify_Domain",Specify_Domain "Test.thy");
|
agriesma@338
|
929 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
930 |
val nxt = ("Specify_Method",Specify_Method("Test.thy","sqrt-equ-test")); (*for asm in square_equation_left*)
|
agriesma@338
|
931 |
val (p,_,_,_,_,pt) = me nxt p c pt;
|
agriesma@338
|
932 |
val pt = union_asm pt [] [("#0 <= sqrt x + sqrt (#5 + x)",[11]),
|
agriesma@338
|
933 |
("#0 <= #9 + #4 * x",[22]),
|
agriesma@338
|
934 |
("#0 <= x ^^^ #2 + #5 * x",[33]),
|
agriesma@338
|
935 |
("#0 <= #2 + x",[44])];
|
agriesma@338
|
936 |
val p = ([1],Res):pos';
|
agriesma@338
|
937 |
val eq_ = (term_of o the o (parse thy))"e_::bool";
|
agriesma@338
|
938 |
val ct = "x=#1+#3";
|
agriesma@338
|
939 |
val ve0_= (term_of o the o (parse thy)) ct;
|
agriesma@338
|
940 |
val v_ = (term_of o the o (parse thy))"v_::real";
|
agriesma@338
|
941 |
val xx = (term_of o the o (parse thy))"x::real";
|
agriesma@338
|
942 |
val env0= [(eq_,ve0_),(v_,xx)];
|
agriesma@338
|
943 |
|
agriesma@338
|
944 |
val ets0=[([],(Mstep'(Script.thy,"BS","",""),env0,env0,e_term,e_term,Safe)),
|
agriesma@338
|
945 |
([],(User', [], [], e_term, e_term,Sundef))]:ets;
|
agriesma@338
|
946 |
val l0 = [];
|
agriesma@338
|
947 |
val (pt,_) = cappend_atomic pt[1]e_istate""(Rewrite("test","")) ct Complete;
|
agriesma@338
|
948 |
" --------------- 1. ---------------------------------------------";
|
agriesma@338
|
949 |
val Appl m'=applicable_in p pt (Rewrite_Set "Test_simplify");
|
agriesma@338
|
950 |
|
agriesma@338
|
951 |
val NextStep(l1,m') = nxt_tac "Test.thy" (pt,p) scr ets0 l0;
|
agriesma@338
|
952 |
(*val l1 = [R,L,R,R] : loc_*)
|
agriesma@338
|
953 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets1)] =
|
agriesma@338
|
954 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets0 l0;
|
agriesma@338
|
955 |
(*val ets1 = [([R,L,R,R],(Rewrite_Set' #,[#],[#],Free #,# $ #,Safe)),..*)
|
agriesma@338
|
956 |
val ets1 = (drop_last ets0) @ ets1;val pt = update_ets pt [] [(1,ets1)];
|
agriesma@338
|
957 |
writeln(ets2str ets1);
|
agriesma@338
|
958 |
" --------------- 2. ---------------------------------------------";
|
agriesma@338
|
959 |
val Appl m'=applicable_in p pt (Mstep "subproblem_equation_dummy");
|
agriesma@338
|
960 |
|
agriesma@338
|
961 |
val NextStep(l2,m') = nxt_tac "Test.thy" (pt,p) scr ets1 l1;
|
agriesma@338
|
962 |
(*val l2 = [R,R,D,L,R] : loc_|| val m' = Mstep' ("x = #4",...*)
|
agriesma@338
|
963 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets2)] =
|
agriesma@338
|
964 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets1 l1;
|
agriesma@338
|
965 |
(*val ets2 =[([R,R,D,L,R],(Mstep' ..subpbl..,[#],[#],Const #,# $ #,Safe)),..*)
|
agriesma@338
|
966 |
val ets2 = (drop_last ets1) @ ets2;val pt = update_ets pt [] [(1,ets2)];
|
agriesma@338
|
967 |
writeln(ets2str ets2);
|
agriesma@338
|
968 |
" --------------- 3. ---------------------------------------------";
|
agriesma@338
|
969 |
val Appl m'=applicable_in p pt (Mstep "solve_equation_dummy");
|
agriesma@338
|
970 |
|
agriesma@338
|
971 |
val NextStep(l3,m') = nxt_tac "Test.thy" (pt,p) scr ets2 l2;
|
agriesma@338
|
972 |
(*val l3 = [R,R,D,R,D,L,R] : loc_
|
agriesma@338
|
973 |
val m' = Mstep'("subproblem_equation_dummy (x = #4)",..*)
|
agriesma@338
|
974 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets3)] = (*@@@*)
|
agriesma@338
|
975 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets2 l2;
|
agriesma@338
|
976 |
(*val ets3 = [([R,R,D,R,D,L,R], (Mstep' (..,"solve_equation_dummy",..*)
|
agriesma@338
|
977 |
val ets3 = (drop_last ets2) @ ets3; val pt = update_ets pt [] [(1,ets3)];
|
agriesma@338
|
978 |
writeln(ets2str ets3);
|
agriesma@338
|
979 |
" --------------- 4. ---------------------------------------------";
|
agriesma@338
|
980 |
val Appl (m' as (Check_elementwise' (consts,"Assumptions",consts'))) =
|
agriesma@338
|
981 |
applicable_in p pt (Check_elementwise "Assumptions");
|
agriesma@338
|
982 |
|
agriesma@338
|
983 |
val NextStep(l4,m') = nxt_tac "Test.thy" (pt,p) scr ets3 l3;
|
agriesma@338
|
984 |
(*val l4 = [R,R,D,R,D,R,D] : loc_ val m' = Check_elementwise' (Const (#,#) $ ...*)
|
agriesma@338
|
985 |
|
agriesma@338
|
986 |
val Steps[(Form' (FormKF (_,_,_,_,res)),pt,p,_,s,ets4)] =
|
agriesma@338
|
987 |
locate_gen "Test.thy" m' (pt,p) (scr,d) ets3 l3;
|
agriesma@338
|
988 |
(*val ets4 = [([R,R,D,R,D,R,D], (Check_elementwise' (# $ #,"Assumptions",Const #),..*)
|
agriesma@338
|
989 |
val ets4 = (drop_last ets3) @ ets4; val pt = update_ets pt [] [(1,ets4)];
|
agriesma@338
|
990 |
" --------------- 5. ---------------------------------------------";
|
agriesma@338
|
991 |
val Finished _ = nxt_tac "Test.thy" (pt,p) scr ets4 l4;
|
agriesma@338
|
992 |
|
agriesma@338
|
993 |
writeln (pr_ptree pr_short pt);writeln("result: "^res^
|
agriesma@338
|
994 |
"\n===================================================================");
|
agriesma@338
|
995 |
|
agriesma@338
|
996 |
-------------------------------------11.5.02-----*)
|