src/Tools/isac/Interpret/sub-problem.sml
author Walther Neuper <walther.neuper@jku.at>
Wed, 08 Apr 2020 14:24:38 +0200
changeset 59854 c20d08e01ad2
parent 59823 4d222d137bb2
child 59861 65ec9f679c3f
permissions -rw-r--r--
separate struct ThyC

note: here is much outdated stuff due to many changes in Isabelle;
there is much to unify, probably all can be dropped now in 2020.
     1 signature SUB_PROBLEM =
     2 sig
     3 
     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. --------- *)
     6   (*NONE*)
     7 (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
     8   (*NONE*)
     9 ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
    10 end
    11 
    12 (**)
    13 structure Sub_Problem(**): SUB_PROBLEM(**) =
    14 struct
    15 (**)
    16 
    17 fun tac_from_prog pt (stac as Const ("Prog_Tac.SubProblem", _) $ spec' $ ags') =
    18     let
    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';
    22 	    val (pI, pors, mI) = 
    23 	      if mI = ["no_met"]
    24 	      then
    25           let
    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
    42 	    val hdl =
    43         case cas of
    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
    47     in
    48       (Tactic.Subproblem (dI, pI),	Tactic.Subproblem' ((dI, pI, mI), pors, hdl, fmz_, ctxt, f))
    49     end
    50   | tac_from_prog _ t = raise ERROR ("tac_from_prog not impl. for " ^ Rule.term2str t)
    51 
    52 (**)end(**)