1 (* Title: solve an example by interpreting a method's script
2 Author: Walther Neuper 1999
3 (c) copyright due to lincense terms.
8 datatype auto = CompleteCalc | CompleteCalcHead | CompleteModel | CompleteSubpbl
9 | CompleteToSubpbl | Step of int
10 val autoord : auto -> int
12 val mk_tac'_ : Tac.tac -> string * Tac.tac
13 val specsteps : string list
15 val nxt_solve_ : Ctree.ctree * Ctree.pos' ->
16 (Tac.tac * Tac.tac_ * (Ctree.pos' * (Selem.istate * Proof.context))) list *
17 Ctree.pos' list * Ctree.state
18 val all_solve : auto -> Ctree.pos' list -> Ctree.state ->
19 string * Ctree.pos' list * (Ctree.ctree * (int list * Ctree.pos_))
21 auto -> Ctree.pos' list -> Ctree.state -> string * Ctree.pos' list * Ctree.state
22 val nxt_solv : Tac.tac_ -> Selem.istate * Proof.context -> Ctree.state -> Chead.calcstate'
23 val solve : string * Tac.tac_ -> Ctree.state -> string * Chead.calcstate'
25 val detailrls : Ctree.ctree -> Ctree.pos' -> string * Ctree.ctree * Ctree.pos'
26 (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
27 val get_form : tac'_ -> Ctree.pos' -> Ctree.ctree -> Generate.mout
28 (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
30 ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
32 (*----- unused code, kept as hints to design ideas ---------------------------------------------*)
37 structure Solve(**): SOLVE(**) =
43 type tac'_ = mstID * Tac.tac; (*DG <-> ME*)
45 fun mk_tac'_ m = case m of (* scr not cleaned -- will disappear eventually *)
46 Tac.Init_Proof (ppc, spec) => ("Init_Proof", Tac.Init_Proof (ppc, spec ))
47 | Tac.Model_Problem => ("Model_Problem", Tac.Model_Problem)
48 | Tac.Refine_Tacitly pblID => ("Refine_Tacitly", Tac.Refine_Tacitly pblID)
49 | Tac.Refine_Problem pblID => ("Refine_Problem", Tac.Refine_Problem pblID)
50 | Tac.Add_Given cterm' => ("Add_Given", Tac.Add_Given cterm')
51 | Tac.Del_Given cterm' => ("Del_Given", Tac.Del_Given cterm')
52 | Tac.Add_Find cterm' => ("Add_Find", Tac.Add_Find cterm')
53 | Tac.Del_Find cterm' => ("Del_Find", Tac.Del_Find cterm')
54 | Tac.Add_Relation cterm' => ("Add_Relation", Tac.Add_Relation cterm')
55 | Tac.Del_Relation cterm' => ("Del_Relation", Tac.Del_Relation cterm')
57 | Tac.Specify_Theory domID => ("Specify_Theory", Tac.Specify_Theory domID)
58 | Tac.Specify_Problem pblID => ("Specify_Problem", Tac.Specify_Problem pblID)
59 | Tac.Specify_Method metID => ("Specify_Method", Tac.Specify_Method metID)
60 | Tac.Apply_Method metID => ("Apply_Method", Tac.Apply_Method metID)
61 | Tac.Check_Postcond pblID => ("Check_Postcond", Tac.Check_Postcond pblID)
62 | Tac.Free_Solve => ("Free_Solve", Tac.Free_Solve)
64 | Tac.Rewrite_Inst (subs, thm') => ("Rewrite_Inst", Tac.Rewrite_Inst (subs, thm'))
65 | Tac.Rewrite thm' => ("Rewrite", Tac.Rewrite thm')
66 | Tac.Rewrite_Asm thm' => ("Rewrite_Asm", Tac.Rewrite_Asm thm')
67 | Tac.Rewrite_Set_Inst (subs, rls')
68 => ("Rewrite_Set_Inst", Tac.Rewrite_Set_Inst (subs, rls'))
69 | Tac.Rewrite_Set rls' => ("Rewrite_Set", Tac.Rewrite_Set rls')
70 | Tac.End_Ruleset => ("End_Ruleset", Tac.End_Ruleset)
72 | Tac.End_Detail => ("End_Detail", Tac.End_Detail)
73 | Tac.Detail_Set rls' => ("Detail_Set", Tac.Detail_Set rls')
74 | Tac.Detail_Set_Inst (s, rls') => ("Detail_Set_Inst", Tac.Detail_Set_Inst (s, rls'))
76 | Tac.Calculate op_ => ("Calculate", Tac.Calculate op_)
77 | Tac.Substitute sube => ("Substitute", Tac.Substitute sube)
78 | Tac.Apply_Assumption cts' => ("Apply_Assumption", Tac.Apply_Assumption cts')
80 | Tac.Take cterm' => ("Take", Tac.Take cterm')
81 | Tac.Take_Inst cterm' => ("Take_Inst", Tac.Take_Inst cterm')
82 | Tac.Subproblem (domID, pblID) => ("Subproblem", Tac.Subproblem (domID, pblID))
84 | Tac.Subproblem_Full(spec,cts')=> ("Subproblem_Full", Tac.Subproblem_Full(spec,cts'))
86 | Tac.End_Subproblem => ("End_Subproblem", Tac.End_Subproblem)
87 | Tac.CAScmd cterm' => ("CAScmd", Tac.CAScmd cterm')
89 | Tac.Split_And => ("Split_And", Tac.Split_And)
90 | Tac.Conclude_And => ("Conclude_And", Tac.Conclude_And)
91 | Tac.Split_Or => ("Split_Or", Tac.Split_Or)
92 | Tac.Conclude_Or => ("Conclude_Or", Tac.Conclude_Or)
93 | Tac.Begin_Trans => ("Begin_Trans", Tac.Begin_Trans)
94 | Tac.End_Trans => ("End_Trans", Tac.End_Trans)
95 | Tac.Begin_Sequ => ("Begin_Sequ", Tac.Begin_Sequ)
96 | Tac.End_Sequ => ("End_Sequ", Tac.Begin_Sequ)
97 | Tac.Split_Intersect => ("Split_Intersect", Tac.Split_Intersect)
98 | Tac.End_Intersect => ("End_Intersect", Tac.End_Intersect)
99 | Tac.Check_elementwise cterm' => ("Check_elementwise", Tac.Check_elementwise cterm')
100 | Tac.Or_to_List => ("Or_to_List", Tac.Or_to_List)
101 | Tac.Collect_Trues => ("Collect_Results", Tac.Collect_Trues)
103 | Tac.Empty_Tac => ("Empty_Tac", Tac.Empty_Tac)
104 | Tac.Tac string => ("Tac", Tac.Tac string)
105 | Tac.End_Proof' => ("End_Proof'", Tac.End_Proof')
106 | _ => error "mk_tac'_: uncovered case";
108 type squ = ctree; (* TODO: safe etc. *)
110 val specsteps = ["Init_Proof", "Refine_Tacitly", "Refine_Problem", "Model_Problem",
111 "Add_Given", "Del_Given", "Add_Find", "Del_Find", "Add_Relation", "Del_Relation",
112 "Specify_Theory", "Specify_Problem", "Specify_Method"];
114 fun step2taci ((tac_, _, pt, p, _) : Lucin.step) = (*FIXXME.040312: redesign step*)
115 (Lucin.tac_2tac tac_, tac_, (p, Ctree.get_loc pt p)): Generate.taci;
117 (*FIXME.WN050821 compare solve ... nxt_solv*)
118 fun solve ("Apply_Method", m as Tac.Apply_Method' (mI, _, _, _)) (pt, (pos as (p, _))) =
119 let val {srls, ...} = Specify.get_met mI;
120 val itms = case get_obj I pt p of
121 PblObj {meth=itms, ...} => itms
122 | _ => error "solve Apply_Method: uncovered case get_obj"
123 val thy' = get_obj g_domID pt p;
124 val thy = Celem.assoc_thy thy';
125 val (is, env, ctxt, sc) = case Lucin.init_scrstate thy itms mI of
126 (is as Selem.ScrState (env,_,_,_,_,_), ctxt, sc) => (is, env, ctxt, sc)
127 | _ => error "solve Apply_Method: uncovered case init_scrstate"
128 val ini = Lucin.init_form thy sc env;
133 let val (pos,c,_, pt) =
134 Generate.generate1 thy (Tac.Apply_Method' (mI, SOME t, is, ctxt))
135 (is, ctxt) (lev_on p, Frm)(*implicit Take*) pt;
136 in ("ok",([(Tac.Apply_Method mI, Tac.Apply_Method' (mI, SOME t, is, ctxt),
137 ((lev_on p, Frm), (is, ctxt)))], c, (pt, pos)))
139 | NONE => (*execute the first tac in the Script, compare solve m*)
141 val (m', (is', ctxt'), _) = Lucin.next_tac (thy', srls) (pt, (p, Res)) sc (is, ctxt);
142 val d = Celem.e_rls (*FIXME: get simplifier from domID*);
144 case Lucin.locate_gen (thy',srls) m' (pt,(p, Res)) (sc,d) (is', ctxt') of
145 Lucin.Steps (_, ss as (_, _, pt', p', c') :: _) =>
146 ("ok", (map step2taci ss, c', (pt', p')))
147 | _ => (* NotLocatable *)
148 let val (p, ps, _, pt) = Generate.generate_hard (Celem.assoc_thy "Isac") m (p, Frm) pt;
150 ("not-found-in-script",([(Lucin.tac_2tac m, m, (pos, (is, ctxt)))], ps, (pt, p)))
154 | solve ("Free_Solve", Tac.Free_Solve') (pt, po as (p, _)) =
156 val p' = lev_dn_ (p, Res);
157 val pt = update_metID pt (par_pblobj pt p) Celem.e_metID;
159 ("ok", ([(Tac.Empty_Tac, Tac.Empty_Tac_, (po, (Selem.Uistate, Selem.e_ctxt)))], [], (pt,p')))
161 | solve ("Check_Postcond", Tac.Check_Postcond' (pI, _)) (pt, (p, p_)) =
163 val pp = par_pblobj pt p
165 (case get_obj g_tac pt p of
166 Tac.Check_elementwise _ => (*collects and instantiates asms*)
167 (snd o (get_obj g_result pt)) p
168 | _ => get_assumptions_ pt (p,p_))
169 handle _ => [] (*WN.27.5.03 asms in subpbls not completely clear*)
170 val metID = get_obj g_metID pt pp;
171 val {srls = srls, scr = sc, ...} = Specify.get_met metID;
172 val (loc, E, l, a, b, ctxt) = case get_loc pt (p, p_) of
173 loc as (Selem.ScrState (E, l, a, _, _, b), ctxt) => (loc, E, l, a, b, ctxt)
174 | _ => error "solve Check_Postcond: uncovered case get_loc"
175 val thy' = get_obj g_domID pt pp;
176 val thy = Celem.assoc_thy thy';
177 val (_, _, (scval, scsaf)) = Lucin.next_tac (thy', srls) (pt, (p, p_)) sc loc;
182 val is = Selem.ScrState (E,l,a,scval,scsaf,b)
183 val tac_ = Tac.Check_Postcond' (pI, (scval, asm))
184 val (pos, ps, _, pt) = Generate.generate1 thy tac_ (is, ctxt) (pp, Res) pt;
185 in ("ok", ([(Tac.Check_Postcond pI, tac_, ((pp, Res), (is, ctxt)))], ps, (pt, pos))) end
187 let (*resume script of parpbl, transfer value of subpbl-script*)
188 val ppp = par_pblobj pt (lev_up p);
189 val thy' = get_obj g_domID pt ppp;
190 val thy = Celem.assoc_thy thy';
191 val (E, l, a, b, ctxt') = case get_loc pt (pp, Frm) of
192 (Selem.ScrState (E, l, a, _, _, b), ctxt') => (E, l, a, b, ctxt')
193 | _ => error "solve Check_Postcond resume script of parpbl: uncovered case get_loc"
194 val ctxt'' = Stool.from_subpbl_to_caller ctxt scval ctxt'
195 val ((p, p_), ps, _, pt) = Generate.generate1 thy (Tac.Check_Postcond' (pI, (scval, asm)))
196 (Selem.ScrState (E,l,a,scval,scsaf,b), ctxt'') (pp,Res) pt;
197 in ("ok", ([(Tac.Check_Postcond pI, Tac.Check_Postcond'(pI, (scval, asm)),
198 ((pp, Res), (Selem.ScrState (E, l, a, scval, scsaf, b), ctxt'')))], ps, (pt, (p, p_)))) end
200 | solve (_, Tac.End_Proof'') (pt, (p, p_)) =
201 ("end-proof", ([(Tac.Empty_Tac, Tac.Empty_Tac_, (([], Res), (Selem.Uistate, Selem.e_ctxt)))], [], (pt, (p, p_))))
202 | solve (_, Tac.End_Detail' t) (pt, (p, p_)) = (* could be done by generate1 ?!? *)
203 let (*Rewrite_Set* done at Detail_Set*: this result is already in ctree*)
204 val pr = (lev_up p, Res)
206 ("ok", ([(Tac.End_Detail, Tac.End_Detail' t , ((p, p_), get_loc pt (p, p_)))], [], (pt, pr)))
208 | solve (_, m) (pt, po as (p, p_)) =
209 if Celem.e_metID = get_obj g_metID pt (par_pblobj pt p) (*29.8.02: could be detail, too !!*)
212 val ctxt = get_ctxt pt po
213 val ((p,p_),ps,_,pt) = Generate.generate1 (Celem.assoc_thy (get_obj g_domID pt (par_pblobj pt p)))
214 m (Selem.e_istate, ctxt) (p, p_) pt;
215 in ("no-method-specified", (*Free_Solve*)
216 ([(Tac.Empty_Tac, Tac.Empty_Tac_, ((p, p_), (Selem.Uistate, ctxt)))], ps, (pt, (p, p_))))
220 val thy' = get_obj g_domID pt (par_pblobj pt p);
221 val (srls, is, sc) = Lucin.from_pblobj_or_detail' thy' (p,p_) pt;
222 val d = Celem.e_rls; (*FIXME.WN0108: canon.simplifier for domain is missing: generate from domID?*)
224 case Lucin.locate_gen (thy',srls) m (pt,(p, p_)) (sc,d) is of
225 Lucin.Steps (_, ss as (_, _, pt', p', c') :: _) =>
226 ("ok", (map step2taci ss, c', (pt', p')))
227 (*27.8.02:next_tac may change to other branches in pt FIXXXXME*)
228 | _ => (* NotLocatable *)
230 val (p,ps, _, pt) = Generate.generate_hard (Celem.assoc_thy "Isac") m (p, p_) pt;
232 ("not-found-in-script", ([(Lucin.tac_2tac m, m, (po, is))], ps, (pt, p)))
236 (* FIXME.WN050821 compare fun solve ... fun nxt_solv
237 nxt_solv (Apply_Method' vvv FIXME: get args in applicable_in *)
238 fun nxt_solv (Tac.Apply_Method' (mI, _, _, _)) _ (pt, pos as (p, _)) =
240 val {ppc, ...} = Specify.get_met mI;
241 val (itms, oris, probl) = case get_obj I pt p of
242 PblObj {meth = itms, origin = (oris, _, _), probl, ...} => (itms, oris, probl)
243 | _ => error "nxt_solv Apply_Method': uncovered case get_obj"
244 val itms = if itms <> [] then itms else Chead.complete_metitms oris probl [] ppc
245 val thy' = get_obj g_domID pt p;
246 val thy = Celem.assoc_thy thy';
247 val (is, env, ctxt, scr) = case Lucin.init_scrstate thy itms mI of
248 (is as Selem.ScrState (env,_,_,_,_,_), ctxt, scr) => (is, env, ctxt, scr)
249 | _ => error "nxt_solv Apply_Method': uncovered case init_scrstate"
250 val ini = Lucin.init_form thy scr env;
255 val pos = ((lev_on o lev_dn) p, Frm)
256 val tac_ = Tac.Apply_Method' (mI, SOME t, is, ctxt);
257 val (pos, c, _, pt) = Generate.generate1 thy tac_ (is, ctxt) pos pt (* implicit Take *)
259 ([(Tac.Apply_Method mI, tac_, (pos, (is, ctxt)))], c, (pt, pos))
263 val pt = update_env pt (fst pos) (SOME (is, ctxt))
264 val (tacis, c, ptp) = nxt_solve_ (pt, pos)
265 in (tacis @ [(Tac.Apply_Method mI, Tac.Apply_Method' (mI, NONE, Selem.e_istate, ctxt), (pos, (is, ctxt)))],
269 | nxt_solv (Tac.Check_Postcond' (pI, _)) _ (pt, (p, p_)) =
271 val pp = par_pblobj pt p
272 val asm = (case get_obj g_tac pt p of
273 Tac.Check_elementwise _ => (snd o (get_obj g_result pt)) p (*collects and instantiates asms*)
274 | _ => get_assumptions_ pt (p, p_))
275 handle _ => [] (*FIXME.WN030527 asms in subpbls not completely clear*)
276 val metID = get_obj g_metID pt pp;
277 val {srls = srls, scr = sc, ...} = Specify.get_met metID;
278 val (loc, E, l, a, b, ctxt) = case get_loc pt (p, p_) of
279 loc as (Selem.ScrState (E,l,a,_,_,b), ctxt) => (loc, E, l, a, b, ctxt)
280 | _ => error "nxt_solv Check_Postcond': uncovered case get_loc"
281 val thy' = get_obj g_domID pt pp;
282 val thy = Celem.assoc_thy thy';
283 val (_, _, (scval, scsaf)) = Lucin.next_tac (thy', srls) (pt, (p, p_)) sc loc;
288 val is = Selem.ScrState (E, l, a, scval, scsaf, b)
289 val tac_ = Tac.Check_Postcond'(pI,(scval, asm))
290 val ((p, p_), ps, _, pt) = Generate.generate1 thy tac_ (is, ctxt) (pp, Res) pt;
291 in ([(Tac.Check_Postcond pI, tac_, ((pp, Res), (is, ctxt)))], ps, (pt, (p, p_))) end
293 let (*resume script of parpbl, transfer value of subpbl-script*)
294 val ppp = par_pblobj pt (lev_up p);
295 val thy' = get_obj g_domID pt ppp;
296 val thy = Celem.assoc_thy thy';
297 val (E, l, a, b, ctxt') = case get_loc pt (pp, Frm) of
298 (Selem.ScrState (E,l,a,_,_,b), ctxt') => (E, l, a, b, ctxt')
299 | _ => error "nxt_solv Check_Postcond' script of parpbl: uncovered case get_loc"
300 val ctxt'' = Stool.from_subpbl_to_caller ctxt scval ctxt'
301 val tac_ = Tac.Check_Postcond' (pI, (scval, asm))
302 val is = Selem.ScrState (E,l,a,scval,scsaf,b)
303 val ((p, p_), ps, _, pt) = Generate.generate1 thy tac_ (is, ctxt'') (pp, Res) pt;
304 in ([(Tac.Check_Postcond pI, tac_, ((pp, Res), (is, ctxt'')))], ps, (pt, (p, p_))) end
306 | nxt_solv (Tac.End_Proof'') _ ptp = ([], [], ptp)
307 | nxt_solv tac_ is (pt, pos) =
309 val pos = case pos of
310 (p, Met) => ((lev_on o lev_dn) p, Frm) (* begin script *)
311 | (p, Res) => (lev_on p, Res) (* somewhere in script *)
313 val (pos', c, _, pt) = Generate.generate1 (Celem.assoc_thy "Isac") tac_ is pos pt;
315 ([(Lucin.tac_2tac tac_, tac_, (pos, is))], c, (pt, pos'))
317 (* find the next tac from the script, nxt_solv will update the ctree *)
318 and nxt_solve_ (ptp as (pt, pos as (p, p_))) =
319 if Celem.e_metID = get_obj g_metID pt (par_pblobj pt p)
320 then ([], [], (pt, (p, p_)))
323 val thy' = get_obj g_domID pt (par_pblobj pt p);
324 val (srls, is, sc) = Lucin.from_pblobj_or_detail' thy' (p,p_) pt;
325 val (tac_, is, (t, _)) = Lucin.next_tac (thy', srls) (pt, pos) sc is;
326 (* TODO here ^^^ return finished/helpless/ok !*)
328 Tac.End_Detail' _ => ([(Tac.End_Detail, Tac.End_Detail' (t, [(*FIXME.04*)]), (pos, is))], [], (pt, pos))
329 | _ => nxt_solv tac_ is ptp
332 (* says how may steps of a calculation should be done by "fun autocalc"
333 FIXXXME040624: does NOT match interfaces/ITOCalc.java
334 TODO.WN0512 redesign togehter with autocalc ? *)
336 Step of int (*1 do #int steps (may stop in model/specify)
337 IS VERY INEFFICIENT IN MODEL/SPECIY *)
338 | CompleteModel (*2 complete modeling
339 if model complete, finish specifying *)
340 | CompleteCalcHead (*3 complete model/specify in one go *)
341 | CompleteToSubpbl (*4 stop at the next begin of a subproblem,
342 if none, complete the actual (sub)problem *)
343 | CompleteSubpbl (*5 complete the actual (sub)problem (incl.ev.subproblems) *)
344 | CompleteCalc; (*6 complete the calculation as a whole *)
346 fun autoord (Step _ ) = 1
347 | autoord CompleteModel = 2
348 | autoord CompleteCalcHead = 3
349 | autoord CompleteToSubpbl = 4
350 | autoord CompleteSubpbl = 5
351 | autoord CompleteCalc = 6;
353 fun complete_solve auto c (ptp as (_, p as (_, p_))) =
355 then ("end-of-calculation", [], ptp)
357 if member op = [Pbl,Met] p_
360 val ptp = Chead.all_modspec ptp
361 val (_, c', ptp) = all_solve auto c ptp
362 in complete_solve auto (c @ c') ptp end
364 case nxt_solve_ ptp of
365 ((Tac.Subproblem _, _, _) :: _, c', ptp') =>
367 then ("ok", c @ c', ptp)
370 val ptp = Chead.all_modspec ptp'
371 val (_, c'', ptp) = all_solve auto (c @ c') ptp
372 in complete_solve auto (c @ c'@ c'') ptp end
373 | ((Tac.Check_Postcond _, _, _) :: _, c', ptp' as (_, p')) =>
374 if autoord auto < 6 orelse p' = ([], Res)
375 then ("ok", c @ c', ptp')
376 else complete_solve auto (c @ c') ptp'
377 | ((Tac.End_Detail, _, _) :: _, c', ptp') =>
379 then ("ok", c @ c', ptp')
380 else complete_solve auto (c @ c') ptp'
381 | (_, c', ptp') => complete_solve auto (c @ c') ptp'
382 and all_solve auto c (ptp as (pt, pos as (p,_)): ctree * pos') =
384 val (_, _, mI) = get_obj g_spec pt p
385 val ctxt = get_ctxt pt pos
386 val (_, c', ptp) = nxt_solv (Tac.Apply_Method' (mI, NONE, Selem.e_istate, ctxt)) (Selem.e_istate, ctxt) ptp
388 complete_solve auto (c @ c') ptp
391 (* aux.fun for detailrls with Rrls, reverse rewriting *)
392 fun rul_terms_2nds _ nds _ [] = nds
393 | rul_terms_2nds thy nds t ((rule, res as (t', _)) :: rts) =
394 (append_atomic [] (Selem.e_istate, Selem.e_ctxt) t (Tac.rule2tac thy [] rule) res Complete EmptyPtree) ::
395 (rul_terms_2nds thy nds t' rts);
397 (* detail steps done internally by Rewrite_Set* into ctree by use of a script *)
398 fun detailrls pt (pos as (p, _)) =
400 val t = get_obj g_form pt p
401 val tac = get_obj g_tac pt p
402 val rls = (assoc_rls o Tac.rls_of) tac
403 val ctxt = get_ctxt pt pos
406 Celem.Rrls {scr = Celem.Rfuns {init_state,...},...} =>
408 val (_, _, _, rul_terms) = init_state t
409 val newnds = rul_terms_2nds (Proof_Context.theory_of ctxt) [] t rul_terms
410 val pt''' = ins_chn newnds pt p
411 in ("detailrls", pt''', (p @ [length newnds], Res)) end
414 val is = Generate.init_istate tac t
415 (*TODO.WN060602 ScrState (["(t_, Problem (Isac,[equation,univar]))"]
416 is wrong for simpl, but working ?!? *)
417 val tac_ = Tac.Apply_Method' (Celem.e_metID(*WN0402: see generate1 !?!*), SOME t, is, ctxt)
418 val pos' = ((lev_on o lev_dn) p, Frm)
419 val thy = Celem.assoc_thy "Isac"
420 val (_, _, _, pt') = Generate.generate1 thy tac_ (is, ctxt) pos' pt (* implicit Take *)
421 val (_,_, (pt'', _)) = complete_solve CompleteSubpbl [] (pt', pos')
422 val newnds = children (get_nd pt'' p)
423 val pt''' = ins_chn newnds pt p (*complete_solve cuts branches after*)
424 in ("detailrls", pt''', (p @ [length newnds], Res):pos') end
427 fun get_form (mI, m) (p,p_) pt =
428 case Applicable.applicable_in (p, p_) pt m of
429 Chead.Notappl e => Generate.Error' e
431 if member op = specsteps mI
433 let val (_, _, f, _, _, _) = Chead.specify m (p, p_) [] pt
435 else Generate.EmptyMout;