1 (* Title: Tactics; tac_ for interaction with frontend, input for internal use.
2 Author: Walther Neuper 170121
3 (c) due to copyright terms
5 regular expression for search:
7 Add_Find|Add_Given|Add_Relation|Apply_Method|Begin_Sequ|Begin_Trans|Split_And|Split_Or|Split_Intersect|Conclude_And|Conclude_Or|End_Sequ|End_Trans|End_Ruleset|End_Subproblem|End_Intersect|End_Proof|CAScmd|Calculate|Check_Postcond|Check_elementwise|Del_Find|Del_Given|Del_Relation|Derive|Detail_Set|Detail_Set_Inst|End_Detail|Empty_Tac|Free_Solve|Init_Proof|Model_Problem Or_to_List|Refine_Problem|Refine_Tacitly| Rewrite|Rewrite_Inst|Rewrite_Set|Rewrite_Set_Inst|Specify_Method|Specify_Problem|Specify_Theory|Subproblem|Substitute|Tac|Take|Take_Inst
13 Add_Find' of TermC.as_string * Model.itm list | Add_Given' of TermC.as_string * Model.itm list
14 | Add_Relation' of TermC.as_string * Model.itm list
15 | Apply_Method' of Method.id * term option * Istate_Def.T * Proof.context
16 (*RM*)| Del_Find' of TermC.as_string | Del_Given' of TermC.as_string | Del_Relation' of TermC.as_string
17 | Model_Problem' of Problem.id * Model.itm list * Model.itm list
18 | Refine_Problem' of Problem.id * (Model.itm list * (bool * term) list)
19 | Refine_Tacitly' of Problem.id * Problem.id * ThyC.id * Method.id * Model.itm list
20 | Specify_Method' of Method.id * Model.ori list * Model.itm list
21 | Specify_Problem' of Problem.id * (bool * (Model.itm list * (bool * term) list))
22 | Specify_Theory' of ThyC.id
23 (* ^^^^^--------------------- for specify-phase, for solve-phase ---------------------vvvvv*)
25 | Calculate' of ThyC.id * string * term * (term * ThmC.T)
26 | Check_Postcond' of Problem.id * term
27 | Check_elementwise' of term * TermC.as_string * Selem.result
28 | Derive' of Rule_Set.T
31 | Or_to_List' of term * term
32 | Rewrite' of ThyC.id * Rewrite_Ord.rew_ord' * Rule_Set.T * bool * ThmC.T * term * Selem.result
33 | Rewrite_Inst' of ThyC.id * Rewrite_Ord.rew_ord' * Rule_Set.T * bool * subst * ThmC.T * term * Selem.result
34 | Rewrite_Set' of ThyC.id * bool * Rule_Set.T * term * Selem.result
35 | Rewrite_Set_Inst' of ThyC.id * bool * subst * Rule_Set.T * term * Selem.result
36 | Subproblem' of Spec.T * Model.ori list * term * Selem.fmz_ * Proof.context * term
37 | Substitute' of Rule_Def.rew_ord_ * Rule_Set.T * Subst.as_eqs * term * term
38 (*RM*)| Tac_ of theory * string * string * string
40 | End_Detail' of Selem.result
41 | Begin_Trans' of term | End_Trans' of Selem.result
44 val string_of: T -> string
47 Add_Find of TermC.as_string | Add_Given of TermC.as_string
48 | Add_Relation of TermC.as_string
49 | Apply_Method of Method.id
50 | Del_Find of TermC.as_string | Del_Given of TermC.as_string | Del_Relation of TermC.as_string
52 | Refine_Problem of Problem.id
53 | Refine_Tacitly of Problem.id
54 | Specify_Method of Method.id
55 | Specify_Problem of Problem.id
56 | Specify_Theory of ThyC.id
57 (* ^^^^^--------------------- for specify-phase, for solve-phase ---------------------vvvvv*)
58 | CAScmd of TermC.as_string
60 | Check_Postcond of Problem.id
61 | Check_elementwise of TermC.as_string
62 | Derive of Rule_Set.id
67 | Rewrite_Inst of Subst.input * ThmC.T
68 | Rewrite_Set of Rule_Set.id
69 | Rewrite_Set_Inst of Subst.input * Rule_Set.id
70 | Subproblem of ThyC.id * Problem.id
71 | Substitute of Subst.input
73 | Take of TermC.as_string
75 | Begin_Trans | End_Trans
78 val input_to_string : input -> string
79 val tac2IDstr : input -> string
80 val is_empty : input -> bool
82 val eq_tac : input * input -> bool
83 val is_rewtac : input -> bool
84 val is_rewset : input -> bool
85 val rls_of : input -> Rule_Set.id
86 val rule2tac : theory -> (term * term) list -> Rule.rule -> input
87 val applicable : theory -> string -> Rule_Set.T -> term -> input ->input list
88 val for_specify: input -> bool
90 val input_from_T : T -> input
91 val result : T -> term
92 val creates_assms: T -> term list
93 val insert_assumptions: T -> Proof.context -> Proof.context
94 val for_specify': T -> bool
96 (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
98 (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
100 ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
102 (*----- unused code, kept as hints to design ideas ---------------------------------------------*)
107 structure Tactic(**): TACTIC(**) =
111 (** tactics for user at front-end **)
114 Add_Find of TermC.as_string | Add_Given of TermC.as_string | Add_Relation of TermC.as_string
115 | Apply_Method of Method.id
116 | Del_Find of TermC.as_string | Del_Given of TermC.as_string | Del_Relation of TermC.as_string
118 | Refine_Problem of Problem.id
119 | Refine_Tacitly of Problem.id
120 | Specify_Method of Method.id
121 | Specify_Problem of Problem.id
122 | Specify_Theory of ThyC.id
123 (* ^^^^^--------------------- for specify-phase, for solve-phase ---------------------vvvvv*)
124 | CAScmd of TermC.as_string
125 | Calculate of string
126 | Check_Postcond of Problem.id
127 | Check_elementwise of TermC.as_string
128 | Derive of Rule_Set.id
133 | Rewrite_Inst of Subst.input * ThmC.T
134 | Rewrite_Set of Rule_Set.id
135 | Rewrite_Set_Inst of Subst.input * Rule_Set.id
136 | Subproblem of ThyC.id * Problem.id
137 | Substitute of Subst.input
138 (*RM*)| Tac of string
139 | Take of TermC.as_string
141 | Begin_Trans | End_Trans
144 fun input_to_string ma = case ma of
145 Model_Problem => "Model_Problem "
146 | Refine_Tacitly pblID => "Refine_Tacitly " ^ strs2str pblID
147 | Refine_Problem pblID => "Refine_Problem " ^ strs2str pblID
148 | Add_Given cterm' => "Add_Given " ^ cterm'
149 | Del_Given cterm' => "Del_Given " ^ cterm'
150 | Add_Find cterm' => "Add_Find " ^ cterm'
151 | Del_Find cterm' => "Del_Find " ^ cterm'
152 | Add_Relation cterm' => "Add_Relation " ^ cterm'
153 | Del_Relation cterm' => "Del_Relation " ^ cterm'
155 | Specify_Theory domID => "Specify_Theory " ^ quote domID
156 | Specify_Problem pblID => "Specify_Problem " ^ strs2str pblID
157 | Specify_Method metID => "Specify_Method " ^ strs2str metID
158 | Apply_Method metID => "Apply_Method " ^ strs2str metID
159 | Check_Postcond pblID => "Check_Postcond " ^ strs2str pblID
160 | Free_Solve => "Free_Solve"
162 | Rewrite_Inst (subs, (id, thm)) =>
163 "Rewrite_Inst " ^ (pair2str (subs2str subs, spair2str (id, thm |> Thm.prop_of |> UnparseC.term)))
164 | Rewrite (id, thm) => "Rewrite " ^ spair2str (id, thm |> Thm.prop_of |> UnparseC.term)
165 | Rewrite_Set_Inst (subs, rls) =>
166 "Rewrite_Set_Inst " ^ pair2str (subs2str subs, quote rls)
167 | Rewrite_Set rls => "Rewrite_Set " ^ quote rls
168 | End_Detail => "End_Detail"
169 | Derive rls' => "Derive " ^ rls'
170 | Calculate op_ => "Calculate " ^ op_
171 | Substitute sube => "Substitute " ^ Subst.string_eqs_to_string sube
173 | Take cterm' => "Take " ^ quote cterm'
174 | Subproblem (domID, pblID) => "Subproblem " ^ pair2str (domID, strs2str pblID)
175 | CAScmd cterm' => "CAScmd " ^ quote cterm'
177 | Check_elementwise cterm'=> "Check_elementwise " ^ quote cterm'
178 | Or_to_List => "Or_to_List "
180 | Empty_Tac => "Empty_Tac"
181 (*RM*)| Tac string => "Tac " ^ string(*RM*)
182 | End_Proof' => "input End_Proof'"
183 | _ => "input_to_string not impl. for ?!";
185 fun tac2IDstr ma = case ma of
186 Model_Problem => "Model_Problem"
187 | Refine_Tacitly _ => "Refine_Tacitly"
188 | Refine_Problem _ => "Refine_Problem"
189 | Add_Given _ => "Add_Given"
190 | Del_Given _ => "Del_Given"
191 | Add_Find _ => "Add_Find"
192 | Del_Find _ => "Del_Find"
193 | Add_Relation _ => "Add_Relation"
194 | Del_Relation _ => "Del_Relation"
196 | Specify_Theory _ => "Specify_Theory"
197 | Specify_Problem _ => "Specify_Problem"
198 | Specify_Method _ => "Specify_Method"
199 | Apply_Method _ => "Apply_Method"
200 | Check_Postcond _ => "Check_Postcond"
201 | Free_Solve => "Free_Solve"
203 | Rewrite_Inst _ => "Rewrite_Inst"
204 | Rewrite _ => "Rewrite"
205 | Rewrite_Set_Inst _ => "Rewrite_Set_Inst"
206 | Rewrite_Set _ => "Rewrite_Set"
207 | Derive _ => "Derive "
208 | Calculate _ => "Calculate "
209 | Substitute _ => "Substitute"
212 | Subproblem _ => "Subproblem"
213 | CAScmd _ => "CAScmd"
215 | Check_elementwise _ => "Check_elementwise"
216 | Or_to_List => "Or_to_List "
218 | Empty_Tac => "Empty_Tac"
220 | End_Proof' => "End_Proof'"
221 | _ => "input_to_string not impl. for ?!";
223 fun is_empty input = case input of Empty_Tac => true | _ => false
225 fun eq_tac (Rewrite (id1, _), Rewrite (id2, _)) = id1 = id2
226 | eq_tac (Rewrite_Inst (_, (id1, _)), Rewrite_Inst (_, (id2, _))) = id1 = id2
227 | eq_tac (Rewrite_Set id1, Rewrite_Set id2) = id1 = id2
228 | eq_tac (Rewrite_Set_Inst (_, id1), Rewrite_Set_Inst (_, id2)) = id1 = id2
229 | eq_tac (Calculate id1, Calculate id2) = id1 = id2
232 fun is_rewset (Rewrite_Set_Inst _) = true
233 | is_rewset (Rewrite_Set _) = true
234 | is_rewset _ = false;
235 fun is_rewtac (Rewrite _) = true
236 | is_rewtac (Rewrite_Inst _) = true
237 | is_rewtac input = is_rewset input;
240 fun rls_of (Rewrite_Set_Inst (_, rls)) = rls
241 | rls_of (Rewrite_Set rls) = rls
242 | rls_of input = error ("rls_of: called with input \"" ^ tac2IDstr input ^ "\"");
244 fun rule2tac thy _ (Rule.Eval (opID, _)) = Calculate (assoc_calc thy opID)
245 | rule2tac _ [] (Rule.Thm thm'') = Rewrite thm''
246 | rule2tac _ subst (Rule.Thm thm'') =
247 Rewrite_Inst (Subst.T_to_input subst, thm'')
248 | rule2tac _ [] (Rule.Rls_ rls) = Rewrite_Set (Rule_Set.id rls)
249 | rule2tac _ subst (Rule.Rls_ rls) =
250 Rewrite_Set_Inst (Subst.T_to_input subst, (Rule_Set.id rls))
251 | rule2tac _ _ rule =
252 error ("rule2tac: called with \"" ^ Rule.to_string rule ^ "\"");
254 (* try if a rewrite-rule is applicable to a given formula;
255 in case of rule-sets (recursivley) collect all _atomic_ rewrites *)
256 fun try_rew thy ((_, ro) : Rewrite_Ord.rew_ord) erls (subst : subst) f (thm' as Rule.Thm (_, thm)) =
257 if Auto_Prog.contains_bdv thm
258 then case Rewrite.rewrite_inst_ thy ro erls false subst thm f of
259 SOME _ => [rule2tac thy subst thm']
261 else (case Rewrite.rewrite_ thy ro erls false thm f of
262 SOME _ => [rule2tac thy [] thm']
264 | try_rew thy _ _ _ f (cal as Rule.Eval c) =
265 (case Eval.adhoc_thm thy c f of
266 SOME _ => [rule2tac thy [] cal]
268 | try_rew thy _ _ _ f (cal as Rule.Cal1 c) =
269 (case Eval.adhoc_thm thy c f of
270 SOME _ => [rule2tac thy [] cal]
272 | try_rew thy _ _ subst f (Rule.Rls_ rls) = filter_appl_rews thy subst f rls
273 | try_rew _ _ _ _ _ _ = error "try_rew: uncovered case"
274 and filter_appl_rews thy subst f (Rule_Def.Repeat {rew_ord = ro, erls, rules, ...}) =
275 gen_distinct eq_tac (flat (map (try_rew thy ro erls subst f) rules))
276 | filter_appl_rews thy subst f (Rule_Set.Sequence {rew_ord = ro, erls, rules,...}) =
277 gen_distinct eq_tac (flat (map (try_rew thy ro erls subst f) rules))
278 | filter_appl_rews _ _ _ (Rule_Set.Rrls _) = []
279 | filter_appl_rews _ _ _ _ = error "filter_appl_rews: uncovered case"
281 (* decide if a tactic is applicable to a given formula;
282 in case of Rewrite_Set* go down to _atomic_ rewrite-tactics *)
283 fun applicable thy _ _ f (Calculate scrID) =
284 try_rew thy Rewrite_Ord.e_rew_ordX Rule_Set.empty [] f (Rule.Eval (assoc_calc' thy scrID |> snd))
285 | applicable thy ro erls f (Rewrite thm'') =
286 try_rew thy (ro, Rewrite_Ord.assoc_rew_ord ro) erls [] f (Rule.Thm thm'')
287 | applicable thy ro erls f (Rewrite_Inst (subs, thm'')) =
288 try_rew thy (ro, Rewrite_Ord.assoc_rew_ord ro) erls (Subst.T_from_input thy subs) f (Rule.Thm thm'')
290 | applicable thy _ _ f (Rewrite_Set rls') =
291 filter_appl_rews thy [] f (assoc_rls rls')
292 | applicable thy _ _ f (Rewrite_Set_Inst (subs, rls')) =
293 filter_appl_rews thy (Subst.T_from_input thy subs) f (assoc_rls rls')
294 | applicable _ _ _ _ tac =
295 (tracing ("### applicable: not impl. for tac = '" ^ input_to_string tac ^ "'"); []);
298 (** tactics for internal use **)
301 Add_Find' of TermC.as_string * Model.itm list | Add_Given' of TermC.as_string * Model.itm list
302 | Add_Relation' of TermC.as_string * Model.itm list (* for Step.do_next *)
303 | Apply_Method' of (* last step in specifu-phse, switch to solve-phase *)
304 Method.id * (* id in the Know_Store *)
305 term option * (* first formula in the (sub-)Problem TODO: rm option *)
306 Istate_Def.T * (* for starting the Program *)
307 Proof.context (* for starting the Program *)
308 (*RM*)| Del_Find' of TermC.as_string | Del_Given' of TermC.as_string | Del_Relation' of TermC.as_string
309 | Model_Problem' of (* first step in specify-phase *)
310 Problem.id * (* id in the Know_Store *)
311 Model.itm list * (* the model for the Problem *)
312 Model.itm list (* the model for the method *)
313 | Refine_Problem' of Problem.id * (Model.itm list * (bool * term) list)
315 Problem.id * (* the original id in the Know_Store *)
316 Problem.id * (* the id of the refined Problem *)
317 ThyC.id * (* the id of the refined theory *)
318 Method.id * (* the id of the refined Method *)
319 Model.itm list (* RM 9.03: remains [] for Model_Problem recognizing its activation *)
320 | Specify_Method' of Method.id * Model.ori list * Model.itm list
321 | Specify_Problem' of Problem.id *
322 (bool * (* all preconditions evaluate to True *)
323 (Model.itm list * (* the model checked for the input id *)
324 (bool * term) list)) (* individual preconditions marked true/false *)
325 | Specify_Theory' of ThyC.id
326 (* ^^^^^--------------------- for specify-phase, for solve-phase ---------------------vvvvv*)
328 | Calculate' of ThyC.id * string * term * (term * ThmC.T)
329 | Check_Postcond' of (* last step in solving a (sub-)Problem *)
330 Problem.id * (* id of the Problem to be checked *)
331 term (* return value of the program *)
332 | Check_elementwise' of(* DEPRECATED, made idle for Calc.T in df00a2b5c4cc *)
333 term * (* the current formula: [x=1,x=...] *)
334 string * (* the pred from Check_elementwise *)
335 Selem.result (* composed from (1) and (2): {x. pred} *)
336 | Derive' of Rule_Set.T(* for Generate.embed_deriv *)
339 | Or_to_List' of term * term
340 | Rewrite' of ThyC.id * Rewrite_Ord.rew_ord' * Rule_Set.T * bool * ThmC.T * term * Selem.result
341 | Rewrite_Inst' of ThyC.id * Rewrite_Ord.rew_ord' * Rule_Set.T * bool * subst * ThmC.T * term * Selem.result
342 | Rewrite_Set' of ThyC.id * bool * Rule_Set.T * term * Selem.result
343 | Rewrite_Set_Inst' of ThyC.id * bool * subst * Rule_Set.T * term * Selem.result
344 | Subproblem' of (* switch from solve-phase to specify-phase *)
345 Spec.T * (* specification of the SubProblem *)
346 (Model.ori list) * (* original model, filled in associate Subproblem' *)
347 term * (* headline of calc-head, filled -"- *)
348 Selem.fmz_ * (* string list from arguments of the calling Program*)
349 Proof.context * (* for the specify-phase *)
350 term (* Subproblem (thyID, pbl) OR CAS_Cmd *)
351 | Substitute' of (* substitute variables (TODO: from the context) *)
352 Rule_Def.rew_ord_ *(* for re-calculation *)
353 Rule_Set.T * (* for re-calculation *)
354 Subst.as_eqs * (* the substitution: terms of type bool *)
355 term * (* to be substituted into *)
356 term (* resulting from the substitution *)
357 (*RM*)| Tac_ of theory * string * string * string
359 | End_Detail' of Selem.result (* for intermediate steps into Rewrite_Set *)
360 | Begin_Trans' of term (* for intermediate steps into Rewrite_Set *)
361 | End_Trans' of Selem.result (* for intermediate steps into Rewrite_Set *)
364 fun string_of ma = case ma of
365 Model_Problem' (pblID, _, _) => "Model_Problem' " ^ strs2str pblID
366 | Refine_Tacitly'(p, prefin, domID, metID, _) => "Refine_Tacitly' (" ^ strs2str p ^ ", " ^
367 strs2str prefin ^ ", " ^ domID ^ ", " ^ strs2str metID ^ ", pbl-itms)"
368 | Refine_Problem' _ => "Refine_Problem' (" ^ (*matchs2str ms*)"..." ^ ")"
369 | Add_Given' _ => "Add_Given' "(*^cterm'*)
370 | Del_Given' _ => "Del_Given' "(*^cterm'*)
371 | Add_Find' _ => "Add_Find' "(*^cterm'*)
372 | Del_Find' _ => "Del_Find' "(*^cterm'*)
373 | Add_Relation' _ => "Add_Relation' "(*^cterm'*)
374 | Del_Relation' _ => "Del_Relation' "(*^cterm'*)
376 | Specify_Theory' domID => "Specify_Theory' " ^ quote domID
377 | Specify_Problem' (pI, (ok, _)) => "Specify_Problem' " ^
378 spair2str (strs2str pI, spair2str (bool2str ok, spair2str ("itms2str_ itms", "items2str pre")))
379 | Specify_Method' (pI, oris, _) => "Specify_Method' (" ^
380 Method.id_to_string pI ^ ", " ^ Model.oris2str oris ^ ", )"
382 | Apply_Method' (metID, _, _, _) => "Apply_Method' " ^ strs2str metID
383 | Check_Postcond' (pblID, scval) => "Check_Postcond' " ^
384 (spair2str (strs2str pblID, UnparseC.term scval))
386 | Free_Solve' => "Free_Solve'"
388 | Rewrite_Inst' (*subs,thm'*) _ => "Rewrite_Inst' "(*^(pair2str (subs2str subs, spair2str thm'))*)
389 | Rewrite' _(*thm'*) => "Rewrite' "(*^(spair2str thm')*)
390 | Rewrite_Set_Inst' _(*subs,thm'*) => "Rewrite_Set_Inst' "(*^(pair2str (subs2str subs, quote rls))*)
391 | Rewrite_Set' (thy', pasm, rls', f, (f', asm)) => "Rewrite_Set' (" ^ thy' ^ "," ^ bool2str pasm ^
392 "," ^ Rule_Set.id rls' ^ "," ^ UnparseC.term f ^ ",(" ^ UnparseC.term f' ^ "," ^ UnparseC.terms asm ^ "))"
393 | End_Detail' _ => "End_Detail' xxx"
395 | Derive' rls => "Derive' " ^ Rule_Set.id rls
396 | Calculate' _ => "Calculate' "
397 | Substitute' _ => "Substitute' "(*^(subs2str subs)*)
399 | Take' _(*cterm'*) => "Take' "(*^(quote cterm' )*)
400 | Subproblem' _(*(spec, oris, _, _, _, pbl_form)*) =>
401 "Subproblem' "(*^(pair2str (domID, strs2str ,))*)
402 | CAScmd' _(*cterm'*) => "CAScmd' "(*^(quote cterm')*)
404 | Empty_Tac_ => "Empty_Tac_"
405 | Tac_ (_, form, id, result) => "Tac_ (thy," ^ form ^ "," ^ id ^ "," ^ result ^ ")"
407 | Begin_Trans' _ => "Begin_Trans' xxx"
408 | End_Trans' _ => "End_Trans' xxx"
409 | End_Proof'' => "End_Trans' xxx"
410 | _ => "string_of not impl. for arg";
412 fun input_from_T (Refine_Tacitly' (pI, _, _, _, _)) = Refine_Tacitly pI
413 | input_from_T (Model_Problem' (_, _, _)) = Model_Problem
414 | input_from_T (Add_Given' (t, _)) = Add_Given t
415 | input_from_T (Add_Find' (t, _)) = Add_Find t
416 | input_from_T (Add_Relation' (t, _)) = Add_Relation t
418 | input_from_T (Specify_Theory' dI) = Specify_Theory dI
419 | input_from_T (Specify_Problem' (dI, _)) = Specify_Problem dI
420 | input_from_T (Specify_Method' (dI, _, _)) = Specify_Method dI
422 | input_from_T (Rewrite' (_, _, _, _, thm, _, _)) = Rewrite thm
423 | input_from_T (Rewrite_Inst' (_, _, _, _, sub, thm, _, _)) = Rewrite_Inst (Subst.T_to_input sub, thm)
425 | input_from_T (Rewrite_Set' (_, _, rls, _, _)) = Rewrite_Set (Rule_Set.id rls)
426 | input_from_T (Rewrite_Set_Inst' (_, _, sub, rls, _, _)) =
427 Rewrite_Set_Inst (Subst.T_to_input sub, Rule_Set.id rls)
429 | input_from_T (Calculate' (_, op_, _, _)) = Calculate (op_)
430 | input_from_T (Check_elementwise' (_, pred, _)) = Check_elementwise pred
432 | input_from_T (Or_to_List' _) = Or_to_List
433 | input_from_T (Take' term) = Take (UnparseC.term term)
434 | input_from_T (Substitute' (_, _, subte, _, _)) = Substitute (Subst.eqs_to_input subte)
435 | input_from_T (Tac_ (_, _, id, _)) = Tac id
437 | input_from_T (Subproblem' ((domID, pblID, _), _, _, _,_ ,_)) = Subproblem (domID, pblID)
438 | input_from_T (Check_Postcond' (pblID, _)) = Check_Postcond pblID
439 | input_from_T Empty_Tac_ = Empty_Tac
440 | input_from_T m = raise ERROR (": not impl. for "^(string_of m));
442 fun res (Rewrite_Inst' (_ , _, _, _, _, _, _, res)) = res
443 | res (Rewrite' (_, _, _, _, _, _, res)) = res
444 | res (Rewrite_Set_Inst' (_, _, _, _, _, res)) = res
445 | res (Rewrite_Set' (_, _, _, _, res)) = res
446 | res (Calculate' (_, _, _, (t, _))) = (t, [])
447 | res (Check_elementwise' (_, _, res)) = res
448 | res (Subproblem' (_, _, _, _, _, t)) = (t, [])
449 | res (Take' t) = (t, [])
450 | res (Substitute' (_, _, _, _, t)) = (t, [])
451 | res (Or_to_List' (_, t)) = (t, [])
452 | res m = raise ERROR ("result: not impl.for " ^ string_of m)
454 (*fun result m = (fst o res) m; TODO*)
455 fun result tac = (fst o res) tac;
456 fun creates_assms tac = (snd o res) tac;
458 fun insert_assumptions tac ctxt = ContextC.insert_assumptions (creates_assms tac) ctxt
460 fun for_specify Model_Problem = true
461 | for_specify (Refine_Tacitly _) = true
462 | for_specify (Refine_Problem _) = true
463 | for_specify (Add_Given _) = true
464 | for_specify (Del_Given _) = true
465 | for_specify (Add_Find _) = true
466 | for_specify (Del_Find _) = true
467 | for_specify (Add_Relation _) = true
468 | for_specify (Del_Relation _) = true
469 | for_specify (Specify_Theory _) = true
470 | for_specify (Specify_Problem _) = true
471 | for_specify (Specify_Method _) = true
472 | for_specify _ = false
473 fun for_specify' (Model_Problem' _) = true
474 | for_specify' (Refine_Tacitly' _) = true
475 | for_specify' (Refine_Problem' _) = true
476 | for_specify' (Add_Given' _) = true
477 | for_specify' (Del_Given' _) = true
478 | for_specify' (Add_Find' _) = true
479 | for_specify' (Del_Find' _) = true
480 | for_specify' (Add_Relation' _) = true
481 | for_specify' (Del_Relation' _) = true
482 | for_specify' (Specify_Theory' _) = true
483 | for_specify' (Specify_Problem' _) = true
484 | for_specify' (Specify_Method' _) = true
485 | for_specify' _ = false