144 ML_file "ProgLang/termC.sml" |
144 ML_file "ProgLang/termC.sml" |
145 ML_file "ProgLang/calculate.sml" (* requires setup from calculate.thy *) |
145 ML_file "ProgLang/calculate.sml" (* requires setup from calculate.thy *) |
146 ML_file "ProgLang/rewrite.sml" |
146 ML_file "ProgLang/rewrite.sml" |
147 ML_file "ProgLang/listC.sml" |
147 ML_file "ProgLang/listC.sml" |
148 ML_file "ProgLang/scrtools.sml" |
148 ML_file "ProgLang/scrtools.sml" |
|
149 |
|
150 ML {* |
|
151 "~~~~~ fun xxx, args:"; val () = (); |
|
152 *} ML {* |
|
153 "-------- test the same called by interSteps norm_Poly -----------"; |
|
154 "-------- test the same called by interSteps norm_Poly -----------"; |
|
155 "-------- test the same called by interSteps norm_Poly -----------"; |
|
156 val Seq {scr = Prog auto_script,...} = assoc_rls "norm_Poly"; |
|
157 writeln(term2str auto_script); |
|
158 (*Script Stepwise t_t = |
|
159 (Try (Rewrite_Set discard_minus False) @@ |
|
160 Try (Rewrite_Set expand_poly_ False) @@ |
|
161 Try (Repeat (Calculate TIMES)) @@ |
|
162 Try (Rewrite_Set order_mult_rls_ False) @@ |
|
163 Try (Rewrite_Set simplify_power_ False) @@ |
|
164 Try (Rewrite_Set calc_add_mult_pow_ False) @@ |
|
165 Try (Rewrite_Set reduce_012_mult_ False) @@ |
|
166 Try (Rewrite_Set order_add_rls_ False) @@ |
|
167 Try (Rewrite_Set collect_numerals_ False) @@ |
|
168 Try (Rewrite_Set reduce_012_ False) @@ |
|
169 Try (Rewrite_Set discard_parentheses1 False)) |
|
170 ??.empty ..WORKS, NEVERTHELESS *) |
|
171 atomty auto_script; |
|
172 |
|
173 reset_states (); |
|
174 CalcTree |
|
175 [(["Term (b + a - b)", "normalform N"], |
|
176 ("Poly",["polynomial","simplification"], |
|
177 ["simplification","for_polynomials"]))]; |
|
178 Iterator 1; |
|
179 moveActiveRoot 1; |
|
180 autoCalculate 1 CompleteCalc; |
|
181 |
|
182 val ((pt,p),_) = get_calc 1; |
|
183 show_pt pt; |
|
184 (* isabisac17 = 15 [ |
|
185 (([], Frm), Simplify (b + a - b)), |
|
186 (([1], Frm), b + a - b), |
|
187 (([1], Res), a), |
|
188 (([], Res), a)] *) |
|
189 |
|
190 interSteps 1 ([], Res); |
|
191 val ((pt,p),_) = get_calc 1; |
|
192 show_pt pt; |
|
193 (* isabisac17 = 15 [ |
|
194 (([], Frm), Simplify (b + a - b)), |
|
195 (([1], Frm), b + a - b), |
|
196 (([1], Res), a), |
|
197 (([], Res), a)] *) |
|
198 |
|
199 interSteps 1 ([1], Res); |
|
200 (*interSteps 1 ([1], Res)<SYSERROR><CALCID>1</CALCID><ERROR>error in kernel 8</ERROR></SYSERROR>*) |
|
201 "~~~~~ fun interSteps, args:"; val (cI, ip) = (1, ([1], Res)); |
|
202 val ((pt, p), tacis) = get_calc cI; |
|
203 (*if*) (not o is_interpos) ip = false; |
|
204 val ip' = lev_pred' pt ip; |
|
205 |
|
206 (*Math_Engine.detailstep pt ip ..ERROR interSteps>..>init_istate: "norm_Poly" has EmptyScr*) |
|
207 "~~~~~ fun detailstep, args:"; val (pt, (pos as (p, _))) = (pt, ip); |
|
208 val nd = Ctree.get_nd pt p |
|
209 val cn = Ctree.children nd; |
|
210 (*if*) null cn = true; |
|
211 (*if*) (Tac.is_rewset o (Ctree.get_obj Ctree.g_tac nd)) [(*root of nd*)] = true; |
|
212 |
|
213 (*Solve.detailrls pt pos ..ERROR interSteps>..>init_istate: "norm_Poly" has EmptyScr*) |
|
214 "~~~~~ fun detailrls, args:"; val (pt, (pos as (p, _))) = (pt, pos); |
|
215 val t = get_obj g_form pt p |
|
216 val tac = get_obj g_tac pt p |
|
217 val rls = (assoc_rls o Tac.rls_of) tac |
|
218 val ctxt = get_ctxt pt pos |
|
219 val Seq _ = (*case*) rls (*of*); |
|
220 |
|
221 (* val is = Generate.init_istate tac t ..ERROR ,,>..>init_istate: "norm_Poly" has EmptyScr*) |
|
222 "~~~~~ fun init_istate, args:"; val ((Tac.Rewrite_Set rls), t) = (tac, t); |
|
223 val Celem.Seq {scr = Celem.Prog s,...} = (*case*) assoc_rls rls (*of*); |
|
224 |
|
225 "~~~~~ to detailrls return val:"; val is = (Selem.ScrState ([(LTool.one_scr_arg s, t)], [], NONE, Celem.e_term, Selem.Sundef, true)) |
|
226 val tac_ = Tac.Apply_Method' (Celem.e_metID(*WN0402: see generate1 !?!*), SOME t, is, ctxt) |
|
227 val pos' = ((lev_on o lev_dn) p, Ctree.Frm) |
|
228 val thy = Celem.assoc_thy "Isac" |
|
229 val (_, _, _, pt') = Generate.generate1 thy tac_ (is, ctxt) pos' pt (* implicit Take *) |
|
230 val (_,_, (pt'', _)) = complete_solve CompleteSubpbl [] (pt', pos') |
|
231 val newnds = children (get_nd pt'' p) |
|
232 val pt''' = ins_chn newnds pt p (*complete_solve cuts branches after*); |
|
233 |
|
234 "~~~~~ to detailstep return val:"; val xxx = ("detailrls", pt''', (p @ [length newnds], Res)); |
|
235 "~~~~~ to interSteps return val:"; val ("detailrls", pt, lastpos) = xxx; |
|
236 show_pt pt; |
|
237 (*[ |
|
238 (([], Frm), Simplify (b + a - b)), |
|
239 (([1], Frm), b + a - b), |
|
240 (([1,1], Frm), b + a - b), |
|
241 (([1,1], Res), b + a + -1 * b), |
|
242 (([1,2], Res), a + b + -1 * b), |
|
243 (([1,3], Res), a + 0 * b), |
|
244 (([1,4], Res), a), |
|
245 (([1], Res), a), |
|
246 (([], Res), a)]*) |
|
247 if existpt' ([1,4], Res) pt then () |
|
248 else error "scrtools.sml: auto-generated norm_Poly doesnt work"; |
|
249 *} ML {* |
|
250 *} ML {* |
|
251 *} ML {* |
|
252 *} ML {* |
|
253 *} ML {* |
|
254 "~~~~~ fun xxx, args:"; val () = (); |
|
255 *} |
|
256 |
149 ML_file "ProgLang/tools.sml" |
257 ML_file "ProgLang/tools.sml" |
150 (*---------------------- do Minisubpbl before ADDTESTS/All_Ctxt -------------------------------- |
258 (*---------------------- do Minisubpbl before ADDTESTS/All_Ctxt -------------------------------- |
151 ---------------------- do Minisubpbl before ADDTESTS/All_Ctxt --------------------------------*) |
259 ---------------------- do Minisubpbl before ADDTESTS/All_Ctxt --------------------------------*) |
152 ML {*"%%%%%%%%%%%%%%%%% end ProgLang.thy %%%%%%%%%%%%%%%%%%%%%";*} |
260 ML {*"%%%%%%%%%%%%%%%%% end ProgLang.thy %%%%%%%%%%%%%%%%%%%%%";*} |
153 ML {*"%%%%%%%%%%%%%%%%% start Minisubpbl %%%%%%%%%%%%%%%%%%%%%";*} |
261 ML {*"%%%%%%%%%%%%%%%%% start Minisubpbl %%%%%%%%%%%%%%%%%%%%%";*} |
154 ML_file "Minisubpbl/000-comments.sml" |
262 ML_file "Minisubpbl/000-comments.sml" |
155 ML_file "Minisubpbl/100-init-rootpbl.sml" |
263 ML_file "Minisubpbl/100-init-rootpbl.sml" |
156 ML_file "Minisubpbl/150-add-given.sml" |
264 ML_file "Minisubpbl/150-add-given.sml" |
157 ML_file "Minisubpbl/200-start-method.sml" |
265 ML_file "Minisubpbl/200-start-method.sml" |
|
266 ML_file "Minisubpbl/250-Rewrite_Set-from-method.sml" |
158 ML_file "Minisubpbl/300-init-subpbl.sml" |
267 ML_file "Minisubpbl/300-init-subpbl.sml" |
159 ML_file "Minisubpbl/400-start-meth-subpbl.sml" |
268 ML_file "Minisubpbl/400-start-meth-subpbl.sml" |
160 ML_file "Minisubpbl/490-nxt-Check_Postcond.sml" |
269 ML_file "Minisubpbl/490-nxt-Check_Postcond.sml" |
161 ML_file "Minisubpbl/500-met-sub-to-root.sml" |
270 ML_file "Minisubpbl/500-met-sub-to-root.sml" |
162 ML_file "Minisubpbl/530-error-Check_Elementwise.sml" |
271 ML_file "Minisubpbl/530-error-Check_Elementwise.sml" |