1 (* Title: generate specific entries into Ctree
3 (c) due to copyright terms
6 signature GENERATE_CALC_TREE =
8 (* vvv request into signature is incremental with *.sml *)
9 (* for calchead.sml --------------------------------------------------------------- vvv *)
12 datatype pblmet = Method of Celem.metID | Problem of Celem.pblID | Upblmet
16 | FormKF of Rule.cterm'
17 | PpcKF of pblmet * Model.item Model.ppc
18 | RefinedKF of Celem.pblID * (Model.itm list * (bool * term) list)
19 val generate1 : theory -> Tactic.T -> Selem.istate * Proof.context ->
20 Ctree.pos' -> Ctree.ctree -> Ctree.pos' * Ctree.pos' list * mout * Ctree.ctree (* for calchead.sml------------- ^^^ *)
21 val init_istate : Tactic.input -> term -> Selem.istate
22 val init_pbl : (string * (term * 'a)) list -> Model.itm list
23 val init_pbl' : (string * (term * term)) list -> Model.itm list
24 val embed_deriv : taci list -> Ctree.state -> Ctree.pos' list * (Ctree.state) (* for inform.sml *)
25 val generate_hard : (* for solve.sml *)
26 theory -> Tactic.T -> Ctree.pos' -> Ctree.ctree -> Ctree.pos' * Ctree.pos' list * mout * Ctree.ctree
27 val generate : (Tactic.input * Tactic.T * (Ctree.pos' * (Selem.istate * Proof.context))) list ->
28 Ctree.ctree * Ctree.pos' list * Ctree.pos' -> Ctree.ctree * Ctree.pos' list * Ctree.pos' (* for mathengine.sml *)
29 val generate_inconsistent_rew : Selem.subs option * Celem.thm'' -> term -> Selem.istate * Proof.context ->
30 Ctree.pos' -> Ctree.ctree -> Ctree.state (* for interface.sml *)
31 (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
32 val tacis2str : taci list -> string
33 (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
35 ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
37 (*----- unused code, kept as hints to design ideas ---------------------------------------------*)
41 structure Generate(**): GENERATE_CALC_TREE(**) =
45 (* initialize istate for Detail_Set *)
46 fun init_istate (Tactic.Rewrite_Set rls) t =
47 (case assoc_rls rls of
48 Rule.Rrls {scr = Rule.Rfuns {init_state = ii, ...}, ...} => Selem.RrlsState (ii t)
49 | Rule.Rls {scr = Rule.EmptyScr, ...} =>
50 error ("interSteps>..>init_istate: \"" ^ rls ^ "\" has EmptyScr." ^
51 "use prep_rls' for storing rule-sets !")
52 | Rule.Rls {scr = Rule.Prog s, ...} =>
53 (Selem.ScrState ([(hd (LTool.formal_args s), t)], [], NONE, Rule.e_term, Selem.Sundef, true))
54 | Rule.Seq {scr = Rule.EmptyScr,...} =>
55 error ("interSteps>..>init_istate: \"" ^ rls ^ "\" has EmptyScr." ^
56 " Use prep_rls' for storing rule-sets !")
57 | Rule.Seq {scr = Rule.Prog s,...} =>
58 (writeln ("### init_istate: rls = \"" ^ "rls" ^ "\", Prog = \"" ^ Rule.term2str s ^ "\"");
59 (Selem.ScrState ([(hd (LTool.formal_args s), t)], [], NONE, Rule.e_term, Selem.Sundef, true))
61 | _ => error "init_istate Rewrite_Set: uncovered case assoc_rls")
62 | init_istate (Tactic.Rewrite_Set_Inst (subs, rls)) t =
64 val v = case Selem.subs2subst (Celem.assoc_thy "Isac") subs of
66 | _ => error "init_istate: uncovered case "
67 (*...we suppose the substitution of only _one_ bound variable*)
68 in case assoc_rls rls of
69 Rule.Rls {scr = Rule.EmptyScr, ...} =>
70 error ("interSteps>..>init_istate: \""^rls^"\" has EmptyScr." ^
71 "use prep_rls' for storing rule-sets !")
72 | Rule.Rls {scr = Rule.Prog s, ...} =>
73 let val env = (LTool.formal_args s) ~~ [t, v]
74 in (Selem.ScrState (env, [], NONE, Rule.e_term, Selem.Sundef,true))
76 | Rule.Seq {scr = Rule.EmptyScr, ...} =>
77 error ("interSteps>..>init_istate: \""^rls^"\" has EmptyScr." ^
78 "use prep_rls' for storing rule-sets !")
79 | Rule.Seq {scr = Rule.Prog s,...} =>
80 let val env = (LTool.formal_args s) ~~ [t, v]
81 in (Selem.ScrState (env,[], NONE, Rule.e_term, Selem.Sundef,true))
83 | _ => error "init_istate Rewrite_Set_Inst: uncovered case assoc_rls"
85 | init_istate tac _ = error ("init_istate: uncovered definition for " ^ Tactic.tac2str tac)
87 (* a taci holds alle information required to build a node in the calc-tree;
88 a taci is assumed to be used efficiently such that the calc-tree
89 resulting from applying a taci need not be stored separately;
90 see "type calcstate" *)
91 (*TODO.WN0504 redesign ??? or redesign generate ?? see "fun generate"
92 TODO.WN0512 ? redesign this _list_:
93 # only used for [Apply_Method + (Take or Subproblem)], i.e. for initacs
94 # the latter problem may be resolved automatically if "fun autocalc" is
95 not any more used for the specify-phase and for changing the phases*)
97 (Tactic.input * (* for comparison with input tac *)
98 Tactic.T * (* for ctree generation *)
99 (pos' * (* after applying tac_, for ctree generation *)
100 (Selem.istate * Proof.context))) (* after applying tac_, for ctree generation *)
101 val e_taci = (Tactic.Empty_Tac, Tactic.Empty_Tac_, (e_pos', (Selem.e_istate, Selem.e_ctxt))): taci
102 fun taci2str ((tac, tac_, (pos', (istate, _))):taci) =
103 "( " ^ Tactic.tac2str tac ^ ", " ^ Tactic.tac_2str tac_ ^ ", ( " ^ pos'2str pos' ^ ", " ^
104 Selem.istate2str istate ^ " ))"
105 fun tacis2str tacis = (strs2str o (map (Celem.linefeed o taci2str))) tacis
107 datatype pblmet = (*%^%*)
108 Upblmet (*undefined*)
109 | Problem of Celem.pblID (*%^%*)
110 | Method of Celem.metID; (*%^%*)
111 fun pblmet2str (Problem pblID) = "Problem " ^ strs2str pblID (*%^%*)
112 | pblmet2str (Method metID) = "Method " ^ Celem.metID2str metID (*%^%*)
113 | pblmet2str x = error ("pblmet2str: uncovered definition " ^ pblmet2str x)
115 (*3.5.00: TODO: foppFK eliminated in interface FE-KE !!!*)
116 datatype foppFK = (* in DG cases div 2 *)
117 EmptyFoppFK (*DG internal*)
118 | FormFK of Rule.cterm'
119 | PpcFK of Rule.cterm' Model.ppc
120 fun foppFK2str (FormFK ct') ="FormFK " ^ ct'
121 | foppFK2str (PpcFK ppc) ="PpcFK " ^ Model.ppc2str ppc
122 | foppFK2str EmptyFoppFK ="EmptyFoppFK"
124 datatype nest = Open | Closed | Nundef;
125 fun nest2str Open = "Open"
126 | nest2str Closed = "Closed"
127 | nest2str Nundef = "Nundef"
130 datatype edit = EdUndef | Write | Protect;
131 (* bridge --> kernel *)
132 (* bridge <-> kernel *)
133 (* needed in dialog.sml *) (* bridge <-- kernel *)
134 fun edit2str EdUndef = "EdUndef"
135 | edit2str Write = "Write"
136 | edit2str Protect = "Protect";
138 datatype inout = (*FIXME.WN1105 drop this: was required for proto0 with dialog in sml*)
139 Error_ of string (*<--*)
140 | FormKF of cellID * edit * indent * nest * Rule.cterm' (*<--*)
141 | PpcKF of cellID * edit * indent * nest * (pblmet * Model.item Model.ppc) (*<--*)
142 | RefineKF of Stool.match list (*<--*)
143 | RefinedKF of (Celem.pblID * ((Model.itm list) * ((bool * term) list))) (*<--*)
146 datatype mout = EmptyMout | Error' of inout | Form' of inout | Problems of inout
149 FormKF of Rule.cterm'
150 | PpcKF of (pblmet * Model.item Model.ppc)
151 | RefinedKF of Celem.pblID * (Model.itm list * (bool * term) list)
155 fun mout2str (FormKF cterm') = "FormKF " ^ cterm'
156 | mout2str (PpcKF (pm, itemppc)) = "PpcKF (" ^ pblmet2str pm ^ "," ^ Model.itemppc2str itemppc ^ ")"
157 | mout2str (RefinedKF (_, _)) = "mout2str: RefinedKF not impl."
158 | mout2str (Error' str) = "Error' " ^ str
159 | mout2str (EmptyMout ) = "EmptyMout"
161 (* init pbl with ...,dsc,empty | [] *)
164 fun pbt2itm (f, (d, _)) = (0, [], false, f, Model.Inc ((d, []), (Rule.e_term, [])))
165 in map pbt2itm pbt end
167 (* take formal parameters from pbt, for transfer from pbl/met-hierarchy *)
170 fun pbt2itm (f, (d, t)) = (0, [], false, f, Model.Inc((d, [t]), (Rule.e_term, [])))
171 in map pbt2itm pbt end
173 (*generate 1 ppobj in ctree*)
174 (*TODO.WN0501: take calcstate as an argument (see embed_derive etc.)?specify?*)
175 fun generate1 thy (Tactic.Add_Given' (_, itmlist)) _ (pos as (p, p_)) pt =
176 (pos: pos', [], PpcKF (Upblmet, Specify.itms2itemppc thy [][]),
178 Pbl => update_pbl pt p itmlist
179 | Met => update_met pt p itmlist
180 | _ => error ("uncovered case " ^ pos_2str p_))
181 (* WN110515 probably declare_constraints with input item (without dsc) --
182 -- important when specifying without formalisation *)
183 | generate1 thy (Tactic.Add_Find' (_, itmlist)) _ (pos as (p, p_)) pt =
184 (pos, [], (PpcKF (Upblmet, Specify.itms2itemppc thy [] [])),
186 Pbl => update_pbl pt p itmlist
187 | Met => update_met pt p itmlist
188 | _ => error ("uncovered case " ^ pos_2str p_))
189 (*WN110515 probably declare_constraints with input item (without dsc)*)
190 | generate1 thy (Tactic.Add_Relation' (_, itmlist)) _ (pos as (p, p_)) pt =
191 (pos, [], PpcKF (Upblmet, Specify.itms2itemppc thy [] []),
193 Pbl => update_pbl pt p itmlist
194 | Met => update_met pt p itmlist
195 | _ => error ("uncovered case " ^ pos_2str p_))
196 | generate1 thy (Tactic.Specify_Theory' domID) _ (pos as (p,_)) pt =
197 (pos, [] , PpcKF (Upblmet, Specify.itms2itemppc thy [] []),
198 update_domID pt p domID)
199 | generate1 thy (Tactic.Specify_Problem' (pI, (_, (itms, _)))) _ (p, _) pt =
201 val pt = update_pbl pt p itms
202 val pt = update_pblID pt p pI
204 ((p, Pbl), [], PpcKF (Upblmet, Specify.itms2itemppc thy [] []), pt)
206 | generate1 thy (Tactic.Specify_Method' (mID, oris, itms)) _ (p, _) pt =
208 val pt = update_oris pt p oris
209 val pt = update_met pt p itms
210 val pt = update_metID pt p mID
212 ((p, Met), [], PpcKF (Upblmet, Specify.itms2itemppc thy [] []), pt)
214 | generate1 thy (Tactic.Model_Problem' (_, itms, met)) _ (pos as (p,_)) pt =
216 val pt = update_pbl pt p itms
217 val pt = update_met pt p met
219 (pos, [], PpcKF (Upblmet, Specify.itms2itemppc thy [] []), pt)
221 | generate1 thy (Tactic.Refine_Tacitly' (_, pIre, domID, metID, pbl)) _ (pos as (p, _)) pt =
223 val pt = update_pbl pt p pbl
224 val pt = update_orispec pt p (domID, pIre, metID)
226 (pos, [], PpcKF (Upblmet, Specify.itms2itemppc thy [] []), pt)
228 | generate1 thy (Tactic.Refine_Problem' (pI, _)) _ (pos as (p, _)) pt =
230 val (dI, _, mI) = get_obj g_spec pt p
231 val pt = update_spec pt p (dI, pI, mI)
233 (pos, [], PpcKF (Upblmet, Specify.itms2itemppc thy [] []), pt)
235 | generate1 _ (Tactic.Apply_Method' (_, topt, is, ctxt)) _ (pos as (p, _)) pt =
238 let val (pt, c) = cappend_form pt p (is, ctxt) t
239 in (pos, c, EmptyMout, pt) end
240 | NONE => (pos, [], EmptyMout, update_env pt p (SOME (is, ctxt))))
241 | generate1 _ (Tactic.Take' t) l (p, _) pt = (* val (Take' t) = m; *)
244 let val (ps, p') = split_last p (* no connex to prev.ppobj *)
245 in if p' = 0 then ps @ [1] else p end
246 val (pt, c) = cappend_form pt p l t
248 ((p, Frm): pos', c, FormKF (Rule.term2str t), pt)
250 | generate1 _ (Tactic.Begin_Trans' t) l (p, Frm) pt =
252 val (pt, c) = cappend_form pt p l t
253 val pt = update_branch pt p TransitiveB (*040312*)
254 (* replace the old PrfOjb ~~~~~ *)
255 val p = (lev_on o lev_dn (* starts with [...,0] *)) p
256 val (pt, c') = cappend_form pt p l t (*FIXME.0402 same istate ???*)
258 ((p, Frm), c @ c', FormKF (Rule.term2str t), pt)
260 | generate1 thy (Tactic.Begin_Trans' t) l (p, Res) pt =
261 (*append after existing PrfObj vvvvvvvvvvvvv*)
262 generate1 thy (Tactic.Begin_Trans' t) l (lev_on p, Frm) pt
263 | generate1 _ (Tactic.End_Trans' tasm) l (p, _) pt =
266 val (pt, c) = append_result pt p' l tasm Complete
268 ((p', Res), c, FormKF "DUMMY" (*term2str t ..ERROR (t) has not been declared*), pt)
270 | generate1 _ (Tactic.Rewrite_Inst' (_, _, _, _, subs', thm', f, (f', asm))) (is, ctxt) (p, _) pt =
272 val (pt, c) = cappend_atomic pt p (is, Stool.insert_assumptions asm ctxt) f
273 (Tactic.Rewrite_Inst (Selem.subst2subs subs', thm')) (f',asm) Complete;
274 val pt = update_branch pt p TransitiveB
276 ((p, Res), c, FormKF (Rule.term2str f'), pt)
278 | generate1 _ (Tactic.Rewrite' (_, _, _, _, thm', f, (f', asm))) (is, ctxt) (p, _) pt =
280 val (pt, c) = cappend_atomic pt p (is, Stool.insert_assumptions asm ctxt) f
281 (Tactic.Rewrite thm') (f', asm) Complete
282 val pt = update_branch pt p TransitiveB
284 ((p, Res), c, FormKF (Rule.term2str f'), pt)
286 | generate1 thy (Tactic.Rewrite_Asm' all) l p pt = generate1 thy (Tactic.Rewrite' all) l p pt
287 | generate1 _ (Tactic.Rewrite_Set_Inst' (_, _, subs', rls', f, (f', asm))) (is, ctxt) (p, _) pt =
289 val (pt, c) = cappend_atomic pt p (is, Stool.insert_assumptions asm ctxt) f
290 (Tactic.Rewrite_Set_Inst (Selem.subst2subs subs', Rule.id_rls rls')) (f', asm) Complete
291 val pt = update_branch pt p TransitiveB
293 ((p, Res), c, FormKF (Rule.term2str f'), pt)
295 | generate1 thy (Tactic.Detail_Set_Inst' (_, _, subs, rls, f, (_, asm))) (is, ctxt) (p, _) pt =
297 val ctxt' = Stool.insert_assumptions asm ctxt
298 val (pt, _) = cappend_form pt p (is, ctxt') f
299 val pt = update_branch pt p TransitiveB
300 val is = init_istate (Tactic.Rewrite_Set_Inst (Selem.subst2subs subs, Rule.id_rls rls)) f
301 val tac_ = Tactic.Apply_Method' (Celem.e_metID, SOME Rule.e_term (*t ..has not been declared*), is, ctxt')
302 val pos' = ((lev_on o lev_dn) p, Frm)
304 generate1 thy tac_ (is, ctxt') pos' pt (*implicit Take*)
306 | generate1 _ (Tactic.Rewrite_Set' (_, _, rls', f, (f', asm))) (is, ctxt) (p, _) pt =
308 val (pt, c) = cappend_atomic pt p (is, Stool.insert_assumptions asm ctxt) f
309 (Tactic.Rewrite_Set (Rule.id_rls rls')) (f',asm) Complete
310 val pt = update_branch pt p TransitiveB
312 ((p, Res), c, FormKF (Rule.term2str f'), pt)
314 | generate1 thy (Tactic.Detail_Set' (_, _, rls, f, (_, asm))) (is, ctxt) (p, _) pt =
316 val ctxt' = Stool.insert_assumptions asm ctxt
317 val (pt, _) = cappend_form pt p (is, ctxt') f
318 val pt = update_branch pt p TransitiveB
319 val is = init_istate (Tactic.Rewrite_Set (Rule.id_rls rls)) f
320 val tac_ = Tactic.Apply_Method' (Celem.e_metID, SOME Rule.e_term (*t ..has not been declared*), is, ctxt')
321 val pos' = ((lev_on o lev_dn) p, Frm)
323 generate1 thy tac_ (is, ctxt') pos' pt (*implicit Take*)
325 | generate1 _ (Tactic.Check_Postcond' (_, (scval, asm))) l (p, _) pt =
327 val (pt, c) = append_result pt p l (scval, asm) Complete
329 ((p, Res), c, FormKF (Rule.term2str scval), pt)
331 | generate1 _ (Tactic.Calculate' (_, op_, f, (f', _))) l (p, _) pt =
333 val (pt,c) = cappend_atomic pt p l f (Tactic.Calculate op_) (f', []) Complete
335 ((p, Res), c, FormKF (Rule.term2str f'), pt)
337 | generate1 _ (Tactic.Check_elementwise' (consts, pred, (f', asm))) l (p, _) pt =
339 val (pt,c) = cappend_atomic pt p l consts (Tactic.Check_elementwise pred) (f', asm) Complete
341 ((p, Res), c, FormKF (Rule.term2str f'), pt)
343 | generate1 _ (Tactic.Or_to_List' (ors, list)) l (p, _) pt =
345 val (pt,c) = cappend_atomic pt p l ors Tactic.Or_to_List (list, []) Complete
347 ((p, Res), c, FormKF (Rule.term2str list), pt)
349 | generate1 _ (Tactic.Substitute' (_, _, subte, t, t')) l (p, _) pt =
352 cappend_atomic pt p l t (Tactic.Substitute (Selem.subte2sube subte)) (t',[]) Complete
353 in ((p, Res), c, FormKF (Rule.term2str t'), pt)
355 | generate1 _ (Tactic.Tac_ (_, f, id, f')) l (p, _) pt =
357 val (pt, c) = cappend_atomic pt p l (TermC.str2term f) (Tactic.Tac id) (TermC.str2term f', []) Complete
359 ((p,Res), c, FormKF f', pt)
361 | generate1 thy (Tactic.Subproblem' ((domID, pblID, metID), oris, hdl, fmz_, ctxt, f)) l (p, _) pt =
363 val (pt, c) = cappend_problem pt p l (fmz_, (domID, pblID, metID)) (oris, (domID, pblID, metID), hdl)
364 val pt = update_ctxt pt p ctxt
365 val f = Syntax.string_of_term (Rule.thy2ctxt thy) f
367 ((p, Pbl), c, FormKF f, pt)
369 | generate1 _ m' _ _ _ = error ("generate1: not impl.for " ^ Tactic.tac_2str m')
371 fun generate_inconsistent_rew (subs_opt, thm') f' (is, ctxt) (pos as (p,_)) pt =
373 val f = get_curr_formula (pt, pos)
374 val pos' as (p', _) = (lev_on p, Res)
375 val (pt, _) = case subs_opt of
376 NONE => cappend_atomic pt p' (is, Stool.insert_assumptions [] ctxt) f
377 (Tactic.Rewrite thm') (f', []) Inconsistent
378 | SOME subs => cappend_atomic pt p' (is, Stool.insert_assumptions [] ctxt) f
379 (Tactic.Rewrite_Inst (subs, thm')) (f', []) Inconsistent
380 val pt = update_branch pt p' TransitiveB
383 fun generate_hard thy m' (p,p_) pt =
386 Frm => p | Res => lev_on p
387 | _ => error ("generate_hard: call by " ^ pos'2str (p,p_))
388 in generate1 thy m' (Selem.e_istate, Selem.e_ctxt) (p,p_) pt end
390 (* tacis are in reverse order from do_solve_step/specify_: last = fst to insert *)
391 fun generate ([]: taci list) ptp = ptp
392 | generate tacis (pt, c, _: pos'(*!dropped!WN0504redesign generate/tacis?*))=
394 val (tacis', (_, tac_, (p, is))) = split_last tacis
395 val (p',c',_,pt') = generate1 (Celem.assoc_thy "Isac") tac_ is p pt
397 generate tacis' (pt', c@c', p')
400 (* update pos in tacis for embedding by generate *)
401 fun insert_pos (_: pos) [] = []
402 | insert_pos (p: pos) (((tac, tac_, (_, ist)): taci) :: tacis) =
403 ((tac, tac_, ((p, Res), ist)): taci) :: (insert_pos (lev_on p) tacis)
405 fun res_from_taci (_, Tactic.Rewrite' (_, _, _, _, _, _,(res, asm)), _) = (res, asm)
406 | res_from_taci (_, Tactic.Rewrite_Set' (_, _, _, _, (res, asm)), _) = (res, asm)
407 | res_from_taci (_, tac_, _) = error ("res_from_taci: called with" ^ Tactic.tac_2str tac_)
409 (* embed the tacis created by a '_deriv'ation; sys.form <> input.form
410 tacis are in order, thus are reverted for generate *)
411 fun embed_deriv (tacis: taci list) (pt, pos as (p, Frm): pos') =
412 (*inform at Frm: replace the whole PrfObj by a Transitive-ProfObj FIXME?0402
413 and transfer the istate (from _after_ compare_deriv) from Frm to Res*)
415 val (res, asm) = (res_from_taci o last_elem) tacis
416 val (ist, ctxt) = case get_obj g_loc pt p of
417 (SOME (ist, ctxt), _) => (ist, ctxt)
418 | (NONE, _) => error "embed_deriv Frm: uncovered case get_obj"
419 val form = get_obj g_form pt p
420 (*val p = lev_on p; ---------------only difference to (..,Res) below*)
421 val tacis = (Tactic.Begin_Trans, Tactic.Begin_Trans' form, (pos, (Selem.Uistate, ctxt))) ::
422 (insert_pos ((lev_on o lev_dn) p) tacis) @ [(Tactic.End_Trans, Tactic.End_Trans' (res, asm),
423 (pos_plus (length tacis) (lev_dn p, Res), (new_val res ist, ctxt)))]
424 val {nrls, ...} = Specify.get_met (get_obj g_metID pt (par_pblobj pt p))
425 val (pt, c, pos as (p, _)) = generate (rev tacis) (pt, [], (p, Res))
426 val pt = update_tac pt p (Tactic.Derive (Rule.id_rls nrls))
427 val pt = update_branch pt p TransitiveB
428 in (c, (pt, pos: pos')) end
429 | embed_deriv tacis (pt, (p, Res)) =
430 (*inform at Res: append a Transitive-PrfObj FIXME?0402 other branch-types ?
431 and transfer the istate (from _after_ compare_deriv) from Res to new Res*)
432 let val (res, asm) = (res_from_taci o last_elem) tacis
433 val (ist, ctxt) = case get_obj g_loc pt p of
434 (_, SOME (ist, ctxt)) => (ist, ctxt)
435 | (_, NONE) => error "embed_deriv Frm: uncovered case get_obj"
436 val (f, _) = get_obj g_result pt p
437 val p = lev_on p(*---------------only difference to (..,Frm) above*);
438 val tacis = (Tactic.Begin_Trans, Tactic.Begin_Trans' f, ((p, Frm), (Selem.Uistate, ctxt))) ::
439 (insert_pos ((lev_on o lev_dn) p) tacis) @ [(Tactic.End_Trans, Tactic.End_Trans' (res, asm),
440 (pos_plus (length tacis) (lev_dn p, Res), (new_val res ist, ctxt)))];
441 val {nrls, ...} = Specify.get_met (get_obj g_metID pt (par_pblobj pt p))
442 val (pt, c, pos as (p, _)) = generate (rev tacis) (pt, [], (p, Res))
443 val pt = update_tac pt p (Tactic.Derive (Rule.id_rls nrls))
444 val pt = update_branch pt p TransitiveB
445 in (c, (pt, pos)) end
446 | embed_deriv _ _ = error "embed_deriv: uncovered definition"