1 signature SUB_PROBLEM =
4 val tac_from_prog: Ctree.ctree -> term -> Tactic.input * Tactic.T
5 (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
7 (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
9 ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
13 structure Sub_Problem(**): SUB_PROBLEM(**) =
17 fun tac_from_prog pt (stac as Const ("Prog_Tac.SubProblem", _) $ spec' $ ags') =
19 val (dI, pI, mI) = Prog_Tac.dest_spec spec'
20 val thy = Stool.common_subthy (Celem.assoc_thy dI, Ctree.rootthy pt);
21 val ags = TermC.isalist2list ags';
26 val pors = (Chead.match_ags thy ((#ppc o Specify.get_pbt) pI) ags)
27 (* Chead.match_ags : theory -> pat list -> term list -> ori list
28 ^^^ variables ^^^ values *)
29 handle ERROR "actual args do not match formal args"
30 => (Chead.match_ags_msg pI stac ags (*raise exn*);[]);
31 val pI' = Specify.refine_ori' pors pI;
32 in (pI', pors (* refinement over models with diff.prec only *),
33 (hd o #met o Specify.get_pbt) pI') end
34 else (pI, (Chead.match_ags thy ((#ppc o Specify.get_pbt) pI) ags)
35 handle ERROR "actual args do not match formal args"
36 => (Chead.match_ags_msg pI stac ags(*raise exn*); []), mI);
37 val (fmz_, vals) = Chead.oris2fmz_vals pors;
38 val {cas, ppc, thy, ...} = Specify.get_pbt pI
39 val dI = ThyC.theory2theory' thy (*take dI from _refined_ pbl*)
40 val dI = ThyC.theory2theory' (Stool.common_subthy (Celem.assoc_thy dI, Ctree.rootthy pt))
41 val ctxt = ContextC.initialise dI vals
44 NONE => Auto_Prog.pblterm dI pI
45 | SOME t => subst_atomic ((Chead.vars_of_pbl_' ppc) ~~~ vals) t
46 val f = Auto_Prog.subpbl (strip_thy dI) pI
48 (Tactic.Subproblem (dI, pI), Tactic.Subproblem' ((dI, pI, mI), pors, hdl, fmz_, ctxt, f))
50 | tac_from_prog _ t = raise ERROR ("tac_from_prog not impl. for " ^ Rule.term2str t)