added structure Specify : MODEL_SPECIFY
authorWalther Neuper <wneuper@ist.tugraz.at>
Sun, 18 Dec 2016 16:27:41 +0100
changeset 592691da53d1540fe
parent 59268 c988bdecd7be
child 59270 78823a903342
added structure Specify : MODEL_SPECIFY
src/Tools/isac/Frontend/interface.sml
src/Tools/isac/Interpret/appl.sml
src/Tools/isac/Interpret/calchead.sml
src/Tools/isac/Interpret/generate.sml
src/Tools/isac/Interpret/inform.sml
src/Tools/isac/Interpret/mathengine.sml
src/Tools/isac/Interpret/ptyps.sml
src/Tools/isac/Interpret/script.sml
src/Tools/isac/Interpret/solve.sml
src/Tools/isac/Knowledge/AlgEin.thy
src/Tools/isac/Knowledge/Biegelinie.thy
src/Tools/isac/Knowledge/Diff.thy
src/Tools/isac/Knowledge/DiffApp.thy
src/Tools/isac/Knowledge/DiophantEq.thy
src/Tools/isac/Knowledge/EqSystem.thy
src/Tools/isac/Knowledge/Equation.thy
src/Tools/isac/Knowledge/InsSort.thy
src/Tools/isac/Knowledge/Integrate.thy
src/Tools/isac/Knowledge/Inverse_Z_Transform.thy
src/Tools/isac/Knowledge/LinEq.thy
src/Tools/isac/Knowledge/LogExp.thy
src/Tools/isac/Knowledge/Partial_Fractions.thy
src/Tools/isac/Knowledge/Poly.thy
src/Tools/isac/Knowledge/PolyEq.thy
src/Tools/isac/Knowledge/PolyMinus.thy
src/Tools/isac/Knowledge/RatEq.thy
src/Tools/isac/Knowledge/Rational.thy
src/Tools/isac/Knowledge/RootEq.thy
src/Tools/isac/Knowledge/RootRatEq.thy
src/Tools/isac/Knowledge/Simplify.thy
src/Tools/isac/Knowledge/Test.thy
src/Tools/isac/xmlsrc/datatypes.sml
src/Tools/isac/xmlsrc/pbl-met-hierarchy.sml
src/Tools/isac/xmlsrc/thy-hierarchy.sml
test/Tools/isac/ADDTESTS/course/phst11/T3_MathEngine.thy
test/Tools/isac/Interpret/inform.sml
test/Tools/isac/Interpret/ptyps.sml
test/Tools/isac/Interpret/ptyps.thy
test/Tools/isac/Knowledge/integrate.thy
test/Tools/isac/ProgLang/calculate.thy
test/Tools/isac/ProgLang/scrtools.thy
test/Tools/isac/Test_Isac.thy
test/Tools/isac/Test_Some.thy
     1.1 --- a/src/Tools/isac/Frontend/interface.sml	Wed Dec 14 14:20:25 2016 +0100
     1.2 +++ b/src/Tools/isac/Frontend/interface.sml	Sun Dec 18 16:27:41 2016 +0100
     1.3 @@ -351,7 +351,7 @@
     1.4       ) handle _ => sysERROR2xml cI "setContext: thy_ ???")
     1.5    | "pbl_" =>
     1.6  	  ((let
     1.7 -        val pI = guh2kestoreID guh
     1.8 +        val pI = Specify.guh2kestoreID guh
     1.9  	      val ((pt, _), _) = get_calc cI
    1.10  	    in
    1.11          if member op = [Pbl, Met] p_
    1.12 @@ -363,7 +363,7 @@
    1.13      ) handle _ => sysERROR2xml cI "setContext: pbl_ ???")
    1.14    | "met_" =>
    1.15  	  ((let
    1.16 -        val mI = guh2kestoreID guh
    1.17 +        val mI = Specify.guh2kestoreID guh
    1.18  	      val ((pt, _), _) = get_calc cI
    1.19  	    in
    1.20          if member op = [Pbl, Met] p_
    1.21 @@ -424,7 +424,7 @@
    1.22    Not used in isac-java (see comment WN0825 for setContext) but tryrefine is used within isabisac *)
    1.23  fun refineProblem cI (p, p_) guh =
    1.24    (let 
    1.25 -    val pblID = guh2kestoreID guh
    1.26 +    val pblID = Specify.guh2kestoreID guh
    1.27  	  val ((pt,_),_) = get_calc cI
    1.28  	  val pp = par_pblobj pt p
    1.29  	  val chd = Math_Engine.tryrefine pblID pt (pp, p_)
    1.30 @@ -633,7 +633,7 @@
    1.31  	    ((let 
    1.32  	      val ((pt, _), _) = get_calc cI
    1.33    	    val pp = par_pblobj pt p
    1.34 -  	    val keID = guh2kestoreID guh
    1.35 +  	    val keID = Specify.guh2kestoreID guh
    1.36    	    val chd = Math_Engine.context_pbl keID pt pp
    1.37  	    in contextpblOK2xml cI chd end
    1.38        ) handle _ => sysERROR2xml cI "error in kernel 35")
    1.39 @@ -641,7 +641,7 @@
    1.40  	     ((let 
    1.41  	       val ((pt, _), _) = get_calc cI
    1.42  	       val pp = par_pblobj pt p
    1.43 -	       val keID = guh2kestoreID guh
    1.44 +	       val keID = Specify.guh2kestoreID guh
    1.45  	       val chd = Math_Engine.context_met keID pt pp
    1.46  	     in contextmetOK2xml cI chd end
    1.47        ) handle _ => sysERROR2xml cI "error in kernel 36")
     2.1 --- a/src/Tools/isac/Interpret/appl.sml	Wed Dec 14 14:20:25 2016 +0100
     2.2 +++ b/src/Tools/isac/Interpret/appl.sml	Sun Dec 18 16:27:41 2016 +0100
     2.3 @@ -24,7 +24,7 @@
     2.4      then 
     2.5        let 
     2.6          val thy' = get_obj g_domID pt p'
     2.7 -        val {rew_ord', erls, ...} = get_met (get_obj g_metID pt p')              
     2.8 +        val {rew_ord', erls, ...} = Specify.get_met (get_obj g_metID pt p')              
     2.9  	    in ("OK", thy', rew_ord', erls, false) end
    2.10       else 
    2.11        let
    2.12 @@ -41,7 +41,7 @@
    2.13      then
    2.14        let
    2.15          val thy' = get_obj g_domID pt p'
    2.16 -        val {calc = scr_isa_fns,...} = get_met (get_obj g_metID pt p')
    2.17 +        val {calc = scr_isa_fns,...} = Specify.get_met (get_obj g_metID pt p')
    2.18          val opt = assoc (scr_isa_fns, scrop)
    2.19  	    in
    2.20  	      case opt of
    2.21 @@ -224,7 +224,7 @@
    2.22        else 
    2.23          let 
    2.24            val (PblObj{origin=(_,(_,pI',_),_),...}) = get_obj I pt p
    2.25 -	        val {ppc,...} = get_pbt pI'
    2.26 +	        val {ppc,...} = Specify.get_pbt pI'
    2.27  	        val pbl = Ctree.init_pbl ppc
    2.28          in Chead.Appl (Model_Problem' (pI', pbl, [])) end
    2.29  
    2.30 @@ -234,7 +234,7 @@
    2.31        else 
    2.32          let 
    2.33            val (PblObj {origin = (oris, (dI',_,_),_), ...}) = get_obj I pt p;
    2.34 -          val opt = refine_ori oris pI;
    2.35 +          val opt = Specify.refine_ori oris pI;
    2.36          in case opt of
    2.37  	           SOME pblID => 
    2.38  	             Chead.Appl (Refine_Tacitly' (pI, pblID, 
    2.39 @@ -250,12 +250,10 @@
    2.40      let val (PblObj {origin=(_,(dI,_,_),_),spec=(dI',_,_),
    2.41  		     probl=itms, ...}) = get_obj I pt p;
    2.42  	val thy = if dI' = e_domID then dI else dI';
    2.43 -	val rfopt = refine_pbl (assoc_thy thy) pI itms;
    2.44 +	val rfopt = Specify.refine_pbl (assoc_thy thy) pI itms;
    2.45      in case rfopt of
    2.46  	   NONE => Chead.Notappl ((tac2str (Refine_Problem pI))^" not applicable")
    2.47  	 | SOME (rf as (pI',_)) =>
    2.48 -(* val SOME (rf as (pI',_)) = rfopt;
    2.49 -   *)
    2.50  	   if pI' = pI
    2.51  	   then Chead.Notappl ((tac2str (Refine_Problem pI))^" not applicable")
    2.52  	   else Chead.Appl (Refine_Problem' rf)
    2.53 @@ -316,10 +314,10 @@
    2.54      let val (PblObj {origin=(oris,(dI,pI,_),_),spec=(dI',pI',_),
    2.55  		     probl=itms, ...}) = get_obj I pt p;
    2.56  	val thy = assoc_thy (if dI' = e_domID then dI else dI');
    2.57 -        val {ppc,where_,prls,...} = get_pbt pID;
    2.58 +        val {ppc,where_,prls,...} = Specify.get_pbt pID;
    2.59  	val pbl = if pI'=e_pblID andalso pI=e_pblID
    2.60  		  then (false, (Ctree.init_pbl ppc, []))
    2.61 -		  else match_itms_oris thy itms (ppc,where_,prls) oris;
    2.62 +		  else Specify.match_itms_oris thy itms (ppc,where_,prls) oris;
    2.63      in Chead.Appl (Specify_Problem' (pID, pbl)) end
    2.64  (* val Specify_Method mID = nxt; val (p,p_) = p; 
    2.65     *)
    2.66 @@ -336,7 +334,7 @@
    2.67        else
    2.68          let
    2.69            val (PblObj{origin = (_, (dI, pI, _), _), probl, ctxt, ...}) = get_obj I pt p;
    2.70 -          val {where_, ...} = get_pbt pI
    2.71 +          val {where_, ...} = Specify.get_pbt pI
    2.72            val pres = map (mk_env probl |> subst_atomic) where_
    2.73            val ctxt = 
    2.74              if is_e_ctxt ctxt
    2.75 @@ -365,7 +363,7 @@
    2.76          val pp = par_pblobj pt p;
    2.77          val thy' = (get_obj g_domID pt pp): theory';
    2.78          val thy = assoc_thy thy';
    2.79 -        val {rew_ord' = ro', erls = erls, ...} = get_met (get_obj g_metID pt pp);
    2.80 +        val {rew_ord' = ro', erls = erls, ...} = Specify.get_met (get_obj g_metID pt pp);
    2.81          val (f, p) = case p_ of (*p 12.4.00 unnecessary*)
    2.82                        Frm => (get_obj g_form pt p, p)
    2.83                      | Res => ((fst o (get_obj g_result pt)) p, lev_on p)
    2.84 @@ -409,8 +407,7 @@
    2.85      val pp = par_pblobj pt p; 
    2.86      val thy' = (get_obj g_domID pt pp):theory';
    2.87      val thy = assoc_thy thy';
    2.88 -    val {rew_ord'=ro',erls=erls,...} = 
    2.89 -      get_met (get_obj g_metID pt pp);
    2.90 +    val {rew_ord'=ro',erls=erls,...} = Specify.get_met (get_obj g_metID pt pp);
    2.91      (*val put_asm = true;*)
    2.92      val (f, _) = case p_ of
    2.93                Frm => (get_obj g_form pt p, p)
    2.94 @@ -430,7 +427,7 @@
    2.95      val pp = par_pblobj pt p;
    2.96      val thy' = (get_obj g_domID pt pp):theory';
    2.97      val thy = assoc_thy thy';
    2.98 -    val {rew_ord'=ro',...} = get_met (get_obj g_metID pt pp);
    2.99 +    val {rew_ord'=ro',...} = Specify.get_met (get_obj g_metID pt pp);
   2.100      val f = case p_ of Frm => get_obj g_form pt p
   2.101  		     | Res => (fst o (get_obj g_result pt)) p
   2.102  		     | _ => error ("applicable_in: call by "^
   2.103 @@ -452,8 +449,7 @@
   2.104      val pp = par_pblobj pt p;
   2.105      val thy' = (get_obj g_domID pt pp):theory';
   2.106      val thy = assoc_thy thy';
   2.107 -    val {rew_ord'=ro',(*asm_rls=asm_rls,*)...} = 
   2.108 -      get_met (get_obj g_metID pt pp);
   2.109 +    val {rew_ord'=ro',(*asm_rls=asm_rls,*)...} = Specify.get_met (get_obj g_metID pt pp);
   2.110      val (f,p) = case p_ of  (*p 12.4.00 unnecessary*)
   2.111                Frm => (get_obj g_form pt p, p)
   2.112  	    | Res => ((fst o (get_obj g_result pt)) p, lev_on p)
   2.113 @@ -541,7 +537,7 @@
   2.114            val f = case p_ of
   2.115  		        Frm => get_obj g_form pt p
   2.116  		      | Res => (fst o (get_obj g_result pt)) p
   2.117 -		      val {rew_ord',erls,...} = get_met (get_obj g_metID pt pp)
   2.118 +		      val {rew_ord',erls,...} = Specify.get_met (get_obj g_metID pt pp)
   2.119  		      val subte = sube2subte sube
   2.120  		      val subst = sube2subst thy sube
   2.121  		      val ro = assoc_rew_ord rew_ord'
   2.122 @@ -643,7 +639,7 @@
   2.123          val thy' = (get_obj g_domID pt pp):theory';
   2.124          val thy = assoc_thy thy'
   2.125          val metID = (get_obj g_metID pt pp)
   2.126 -        val {crls,...} =  get_met metID
   2.127 +        val {crls,...} =  Specify.get_met metID
   2.128          val (f,asm) = case p_ of Frm => (get_obj g_form pt p , [])
   2.129                                 | Res => get_obj g_result pt p;
   2.130          val vp = (thy2ctxt thy, pred) |-> parseNEW |> the |> mk_set thy pt p f;
     3.1 --- a/src/Tools/isac/Interpret/calchead.sml	Wed Dec 14 14:20:25 2016 +0100
     3.2 +++ b/src/Tools/isac/Interpret/calchead.sml	Sun Dec 18 16:27:41 2016 +0100
     3.3 @@ -256,9 +256,9 @@
     3.4          | SOME ori => SOME (geti_ct thy ori (hd icl))
     3.5      end
     3.6  
     3.7 -fun mk_delete thy "#Given" itm_ = Del_Given (itm_out thy itm_)
     3.8 -  | mk_delete thy "#Find" itm_ = Del_Find (itm_out thy itm_)
     3.9 -  | mk_delete thy "#Relate" itm_ = Del_Relation(itm_out thy itm_)
    3.10 +fun mk_delete thy "#Given" itm_ = Del_Given (Specify.itm_out thy itm_)
    3.11 +  | mk_delete thy "#Find" itm_ = Del_Find (Specify.itm_out thy itm_)
    3.12 +  | mk_delete thy "#Relate" itm_ = Del_Relation(Specify.itm_out thy itm_)
    3.13    | mk_delete _ str _ = error ("mk_delete: called with field \"" ^ str ^ "\"")
    3.14  fun mk_additem "#Given" ct = Add_Given ct
    3.15    | mk_additem "#Find" ct = Add_Find ct    
    3.16 @@ -433,7 +433,7 @@
    3.17              let val (d, ts) = split_dts t
    3.18              in 
    3.19                if d = e_term 
    3.20 -              then Add (i, [], false, sel, Mis (dsc_unknown, hd ts)) 
    3.21 +              then Add (i, [], false, sel, Mis (Specify.dsc_unknown, hd ts)) 
    3.22                else
    3.23                  (case find_first (eq1 d) pbt of
    3.24                     NONE => Add (i, [], true, sel, Sup (d,ts))
    3.25 @@ -551,13 +551,13 @@
    3.26      val cy = filter is_copy_named pbt
    3.27      val oris' = matc thy pbt' ags []
    3.28      val cy' = map (cpy_nam pbt' oris') cy
    3.29 -    val ors = add_id (oris' @ cy') (*...appended in order to get into the model-items *)
    3.30 +    val ors = Specify.add_id (oris' @ cy') (*...appended in order to get into the model-items *)
    3.31    in (map flattup ors): ori list end
    3.32  
    3.33  (* report part of the error-msg which is not available in match_args *)
    3.34  fun match_ags_msg pI stac ags =
    3.35    let
    3.36 -    val pats = (#ppc o get_pbt) pI
    3.37 +    val pats = (#ppc o Specify.get_pbt) pI
    3.38      val msg = (dots 70^"\n"
    3.39         ^ "*** problem "^strs2str pI ^ " has the ...\n"
    3.40         ^ "*** model-pattern "^pats2str pats ^ "\n"
    3.41 @@ -619,7 +619,7 @@
    3.42        val thy = if dI = e_domID then assoc_thy dI' else assoc_thy dI
    3.43        val cpI = if pI = e_pblID then pI' else pI
    3.44        val cmI = if mI = e_metID then mI' else mI
    3.45 -      val {ppc, pre, prls, ...} = get_met cmI
    3.46 +      val {ppc, pre, prls, ...} = Specify.get_met cmI
    3.47      in 
    3.48        case appl_add ctxt sel oris met ppc ct of
    3.49          Add itm =>  (*..union old input *)
    3.50 @@ -637,9 +637,9 @@
    3.51    	        val pb = foldl and_ (true, map fst pre')
    3.52    	        val (p_, nxt) =
    3.53    	          nxt_spec Met pb oris (dI',pI',mI') (pbl,met') 
    3.54 -  	            ((#ppc o get_pbt) cpI,ppc) (dI,pI,mI);
    3.55 +  	            ((#ppc o Specify.get_pbt) cpI,ppc) (dI,pI,mI);
    3.56    	      in ((p, p_), ((p, p_), Uistate),
    3.57 -  	        Ctree.PpcKF (Ctree.Method cmI, itms2itemppc thy met' pre'), nxt, Safe, pt')
    3.58 +  	        Ctree.PpcKF (Ctree.Method cmI, Specify.itms2itemppc thy met' pre'), nxt, Safe, pt')
    3.59            end
    3.60        | Err msg =>
    3.61    	      let
    3.62 @@ -647,7 +647,7 @@
    3.63    	        val pb = foldl and_ (true, map fst pre')
    3.64    	        val (p_, nxt) =
    3.65    	          nxt_spec Met pb oris (dI',pI',mI') (pbl,met) 
    3.66 -  	            ((#ppc o get_pbt) cpI,(#ppc o get_met) cmI) (dI,pI,mI);
    3.67 +  	            ((#ppc o Specify.get_pbt) cpI,(#ppc o Specify.get_met) cmI) (dI,pI,mI);
    3.68    	      in ((p,p_), ((p,p_),Uistate), Ctree.Error' msg, nxt, Safe,pt) end
    3.69      end
    3.70    | specify_additem sel (ct, _) (p,_(*Frm, Pbl*)) _ pt = 
    3.71 @@ -659,7 +659,7 @@
    3.72          val thy = if dI = e_domID then assoc_thy dI' else assoc_thy dI
    3.73          val cpI = if pI = e_pblID then pI' else pI
    3.74          val cmI = if mI = e_metID then mI' else mI
    3.75 -        val {ppc, where_, prls, ...} = get_pbt cpI
    3.76 +        val {ppc, where_, prls, ...} = Specify.get_pbt cpI
    3.77        in
    3.78          case appl_add ctxt sel oris pbl ppc ct of
    3.79            Add itm => (*..union old input *)
    3.80 @@ -674,11 +674,11 @@
    3.81  	            val pre = check_preconds thy prls where_ pbl'
    3.82  	            val pb = foldl and_ (true, map fst pre)
    3.83  	            val (p_, nxt) =
    3.84 -	              nxt_spec Pbl pb oris (dI',pI',mI') (pbl',met) (ppc, (#ppc o get_met) cmI) (dI, pI, mI)
    3.85 +	              nxt_spec Pbl pb oris (dI',pI',mI') (pbl',met) (ppc, (#ppc o Specify.get_met) cmI) (dI, pI, mI)
    3.86  	            val ppc = if p_= Pbl then pbl' else met
    3.87  	          in
    3.88  	            ((p, p_), ((p, p_), Uistate),
    3.89 -	              Ctree.PpcKF (header p_ pI cmI, itms2itemppc thy ppc pre), nxt, Safe, pt')
    3.90 +	              Ctree.PpcKF (header p_ pI cmI, Specify.itms2itemppc thy ppc pre), nxt, Safe, pt')
    3.91              end
    3.92          | Err msg =>
    3.93  	          let
    3.94 @@ -686,7 +686,7 @@
    3.95  	            val pb = foldl and_ (true, map fst pre)
    3.96  	            val (p_, nxt) =
    3.97  	              nxt_spec Pbl pb oris (dI', pI', mI') (pbl, met) 
    3.98 -	                (ppc, (#ppc o get_met) cmI) (dI, pI, mI)
    3.99 +	                (ppc, (#ppc o Specify.get_met) cmI) (dI, pI, mI)
   3.100  	          in ((p, p_), ((p, p_), Uistate), Ctree.Error' msg, nxt, Safe,pt) end
   3.101        end
   3.102  
   3.103 @@ -696,7 +696,7 @@
   3.104        val (oris, ctxt) = 
   3.105          if dI' = e_domID orelse pI' = e_pblID  (*andalso? WN110511*)
   3.106          then ([], e_ctxt)
   3.107 -  	    else pI' |> #ppc o get_pbt |> prep_ori fmz thy
   3.108 +  	    else pI' |> #ppc o Specify.get_pbt |> Specify.prep_ori fmz thy
   3.109        val (pt, _) = cappend_problem e_ptree [] (e_istate, ctxt) (fmz, spec')
   3.110    			(oris, (dI',pI',mI'), e_term)
   3.111        val pt = update_ctxt pt [] ctxt
   3.112 @@ -705,11 +705,11 @@
   3.113        case mI' of
   3.114    	    ["no_met"] => 
   3.115    	      (([], Pbl), (([], Pbl), Uistate),
   3.116 -  	        Ctree.PpcKF (Ctree.Problem [], itms2itemppc (assoc_thy dI') pbl pre),
   3.117 +  	        Ctree.PpcKF (Ctree.Problem [], Specify.itms2itemppc (assoc_thy dI') pbl pre),
   3.118    	        Refine_Tacitly pI', Safe, pt)
   3.119         | _ => 
   3.120    	      (([], Pbl), (([], Pbl), Uistate),
   3.121 -  	        Ctree.PpcKF (Ctree.Problem [], itms2itemppc (assoc_thy dI') pbl pre),
   3.122 +  	        Ctree.PpcKF (Ctree.Problem [], Specify.itms2itemppc (assoc_thy dI') pbl pre),
   3.123    	        Model_Problem, Safe, pt)
   3.124      end
   3.125      (* ONLY for STARTING modeling phase *)
   3.126 @@ -721,16 +721,16 @@
   3.127        | _ => error "specify (Model_Problem': uncovered case get_obj"
   3.128        val thy' = if dI = e_domID then dI' else dI
   3.129        val thy = assoc_thy thy'
   3.130 -      val {ppc, prls, where_, ...} = get_pbt pI'
   3.131 +      val {ppc, prls, where_, ...} = Specify.get_pbt pI'
   3.132        val pre = check_preconds thy prls where_ pbl
   3.133        val pb = foldl and_ (true, map fst pre)
   3.134        val ((p, _), _, _, pt) =
   3.135          Ctree.generate1 thy (Model_Problem'([],pbl,met)) (Uistate, ctxt) pos pt
   3.136        val (_, nxt) = nxt_spec Pbl pb oris (dI', pI', mI') (pbl, met) 
   3.137 -		    (ppc,(#ppc o get_met) mI') (dI',pI',mI');
   3.138 +		    (ppc,(#ppc o Specify.get_met) mI') (dI',pI',mI');
   3.139      in
   3.140        ((p, Pbl), ((p, p_), Uistate), 
   3.141 -      Ctree.PpcKF (Ctree.Problem pI', itms2itemppc (assoc_thy dI') pbl pre),
   3.142 +      Ctree.PpcKF (Ctree.Problem pI', Specify.itms2itemppc (assoc_thy dI') pbl pre),
   3.143        nxt, Safe, pt)
   3.144      end
   3.145      (* called only if no_met is specified *)     
   3.146 @@ -739,13 +739,13 @@
   3.147          val (dI', ctxt) = case get_obj I pt p of
   3.148            PblObj {origin= (_, (dI', _, _), _), ctxt, ...} => (dI', ctxt)
   3.149          | _ => error "specify (Refine_Tacitly': uncovered case get_obj"
   3.150 -        val {met, thy,...} = get_pbt pIre
   3.151 +        val {met, thy,...} = Specify.get_pbt pIre
   3.152          val (domID, metID) = (string_of_thy thy, if length met = 0 then e_metID else hd met)
   3.153          val ((p,_), _, _, pt) = 
   3.154  	        Ctree.generate1 thy (Refine_Tacitly' (pI, pIre, domID, metID, [(*pbl*)])) (Uistate, ctxt) pos pt
   3.155          val (pbl, pre, _) = ([], [], false)
   3.156        in ((p, Pbl), (pos, Uistate),
   3.157 -        Ctree.PpcKF (Ctree.Problem pIre, itms2itemppc (assoc_thy dI') pbl pre),
   3.158 +        Ctree.PpcKF (Ctree.Problem pIre, Specify.itms2itemppc (assoc_thy dI') pbl pre),
   3.159          Model_Problem, Safe, pt)
   3.160        end
   3.161    | specify (Refine_Problem' rfd) pos _ pt =
   3.162 @@ -770,11 +770,11 @@
   3.163            | _ => error "specify (Specify_Problem': uncovered case generate1 (WARNING WHY ?)"
   3.164          val dI'' = assoc_thy (if dI=e_domID then dI' else dI)
   3.165          val mI'' = if mI=e_metID then mI' else mI
   3.166 -        val (_, nxt) = nxt_spec Pbl ok oris (dI', pI', mI') (itms, met) ((#ppc o get_pbt) pI,
   3.167 -          (#ppc o get_met) mI'') (dI, pI, mI);
   3.168 +        val (_, nxt) = nxt_spec Pbl ok oris (dI', pI', mI') (itms, met) ((#ppc o Specify.get_pbt) pI,
   3.169 +          (#ppc o Specify.get_met) mI'') (dI, pI, mI);
   3.170        in
   3.171          ((p,Pbl), (pos,Uistate),
   3.172 -        Ctree.PpcKF (Ctree.Problem pI, itms2itemppc dI'' itms pre),
   3.173 +        Ctree.PpcKF (Ctree.Problem pI, Specify.itms2itemppc dI'' itms pre),
   3.174          nxt, Safe, pt)
   3.175        end    
   3.176      (*WN110515 initialise ctxt again from itms and add preconds*)
   3.177 @@ -784,20 +784,20 @@
   3.178            PblObj {origin= (oris, (dI', pI', mI'), _), spec= (dI, pI, _), probl = pbl, meth = met, ctxt, ...} =>
   3.179               (oris, dI', pI', mI', dI, pI, pbl, met, ctxt)
   3.180          | _ => error "specify (Specify_Problem': uncovered case get_obj"
   3.181 -        val {ppc,pre,prls,...} = get_met mID
   3.182 +        val {ppc,pre,prls,...} = Specify.get_met mID
   3.183          val thy = assoc_thy dI
   3.184 -        val oris = add_field' thy ppc oris
   3.185 +        val oris = Specify.add_field' thy ppc oris
   3.186          val dI'' = if dI=e_domID then dI' else dI
   3.187          val pI'' = if pI = e_pblID then pI' else pI
   3.188          val met = if met = [] then pbl else met
   3.189 -        val (_, (itms, pre')) = match_itms_oris thy met (ppc, pre, prls ) oris
   3.190 +        val (_, (itms, pre')) = Specify.match_itms_oris thy met (ppc, pre, prls ) oris
   3.191          val (pos, _, _, pt) = 
   3.192  	        Ctree.generate1 thy (Specify_Method' (mID, oris, itms)) (Uistate, ctxt) pos pt
   3.193          val (_, nxt) = nxt_spec Met true oris (dI', pI',mI') (pbl, itms) 
   3.194 -		      ((#ppc o get_pbt) pI'', ppc) (dI'', pI'', mID)
   3.195 +		      ((#ppc o Specify.get_pbt) pI'', ppc) (dI'', pI'', mID)
   3.196        in
   3.197          (pos, (pos,Uistate),
   3.198 -        Ctree.PpcKF (Ctree.Method mID, itms2itemppc (assoc_thy dI'') itms pre'),
   3.199 +        Ctree.PpcKF (Ctree.Method mID, Specify.itms2itemppc (assoc_thy dI'') itms pre'),
   3.200          nxt, Safe, pt)
   3.201        end    
   3.202    | specify (Add_Given' ct) p c pt = specify_additem "#Given" ct p c pt
   3.203 @@ -813,9 +813,9 @@
   3.204          | _ => error "specify (Specify_Theory': uncovered case get_obj"
   3.205          val mppc = case p_ of Met => met | _ => pbl
   3.206          val cpI = if pI = e_pblID then pI' else pI
   3.207 -        val {prls = per, ppc, where_ = pwh, ...} = get_pbt cpI
   3.208 +        val {prls = per, ppc, where_ = pwh, ...} = Specify.get_pbt cpI
   3.209          val cmI = if mI = e_metID then mI' else mI
   3.210 -        val {prls = mer, ppc = mpc, pre= mwh, ...} = get_met cmI
   3.211 +        val {prls = mer, ppc = mpc, pre= mwh, ...} = Specify.get_met cmI
   3.212          val pre = case p_ of
   3.213            Met => (check_preconds thy mer mwh met)
   3.214          | _ => (check_preconds thy per pwh pbl)
   3.215 @@ -826,7 +826,7 @@
   3.216            let val (p_, nxt) = nxt_spec p_ pb oris (dI', pI', mI') (pbl, met) (ppc, mpc) (dI, pI, mI)
   3.217  	        in
   3.218  	          ((p, p_), (pos, Uistate), 
   3.219 -		        Ctree.PpcKF (header p_ pI cmI, itms2itemppc thy mppc pre),
   3.220 +		        Ctree.PpcKF (header p_ pI cmI, Specify.itms2itemppc thy mppc pre),
   3.221  		        nxt, Safe, pt)
   3.222            end
   3.223          else (*FIXME: check ppc wrt. (new!) domID ..? still parsable?*)
   3.224 @@ -835,7 +835,7 @@
   3.225  	          val (p_,nxt) = nxt_spec p_ pb oris (dI', pI', mI') (pbl, met) (ppc, mpc) (domID, pI, mI)
   3.226  	        in
   3.227  	          ((p,p_), (pos,Uistate), 
   3.228 -	          Ctree.PpcKF (header p_ pI cmI, itms2itemppc thy mppc pre),
   3.229 +	          Ctree.PpcKF (header p_ pI cmI, Specify.itms2itemppc thy mppc pre),
   3.230  	          nxt, Safe, pt)
   3.231            end
   3.232        end
   3.233 @@ -852,7 +852,7 @@
   3.234        val thy = if dI = e_domID then assoc_thy dI' else assoc_thy dI;
   3.235        val cpI = if pI = e_pblID then pI' else pI;
   3.236      in
   3.237 -      case appl_add ctxt sel oris pbl ((#ppc o get_pbt) cpI) ct of
   3.238 +      case appl_add ctxt sel oris pbl ((#ppc o Specify.get_pbt) cpI) ct of
   3.239  	      Add itm (*..union old input *) =>
   3.240  	        let
   3.241  	          val pbl' = insert_ppc thy itm pbl
   3.242 @@ -881,7 +881,7 @@
   3.243        val thy = if dI = e_domID then assoc_thy dI' else assoc_thy dI;
   3.244        val cmI = if mI = e_metID then mI' else mI;
   3.245      in 
   3.246 -      case appl_add ctxt sel oris met ((#ppc o get_met) cmI) ct of
   3.247 +      case appl_add ctxt sel oris met ((#ppc o Specify.get_met) cmI) ct of
   3.248          Add itm (*..union old input *) =>
   3.249  	        let
   3.250  	          val met' = insert_ppc thy itm met;
   3.251 @@ -963,8 +963,8 @@
   3.252        | _ => error "nxt_specif Model_Problem; uncovered case get_obj"
   3.253        val (dI, pI, mI) = some_spec ospec spec
   3.254        val thy = assoc_thy dI
   3.255 -      val mpc = (#ppc o get_met) mI (* just for reuse complete_mod_ *)
   3.256 -      val {cas, ppc, ...} = get_pbt pI
   3.257 +      val mpc = (#ppc o Specify.get_met) mI (* just for reuse complete_mod_ *)
   3.258 +      val {cas, ppc, ...} = Specify.get_pbt pI
   3.259        val pbl = Ctree.init_pbl ppc (* fill in descriptions *)
   3.260        (*----------------if you think, this should be done by the Dialog 
   3.261         in the java front-end, search there for WN060225-modelProblem----*)
   3.262 @@ -984,12 +984,12 @@
   3.263        val (oris, dI, ctxt) = case get_obj I pt p of
   3.264          (PblObj {origin = (oris, (dI, _, _), _), ctxt, ...}) => (oris, dI, ctxt)
   3.265        | _ => error "nxt_specif Refine_Tacitly: uncovered case get_obj"
   3.266 -      val opt = refine_ori oris pI
   3.267 +      val opt = Specify.refine_ori oris pI
   3.268      in 
   3.269        case opt of
   3.270  	      SOME pI' => 
   3.271  	        let 
   3.272 -            val {met, ...} = get_pbt pI'
   3.273 +            val {met, ...} = Specify.get_pbt pI'
   3.274  	          (*val pt = update_pbl pt p pbl ..done by Model_Problem*)
   3.275  	          val mI = if length met = 0 then e_metID else hd met
   3.276              val thy = assoc_thy dI
   3.277 @@ -1009,7 +1009,7 @@
   3.278        | _ => error "nxt_specif Refine_Problem: uncovered case get_obj"
   3.279  	    val thy = if dI' = e_domID then dI else dI'
   3.280      in 
   3.281 -      case refine_pbl (assoc_thy thy) pI probl of
   3.282 +      case Specify.refine_pbl (assoc_thy thy) pI probl of
   3.283  	      NONE => ([], [], ptp)
   3.284  	    | SOME rfd => 
   3.285  	      let 
   3.286 @@ -1025,11 +1025,11 @@
   3.287            (oris, dI, dI', pI', probl, ctxt)
   3.288        | _ => error ""
   3.289  	    val thy = assoc_thy (if dI' = e_domID then dI else dI');
   3.290 -      val {ppc,where_,prls,...} = get_pbt pI
   3.291 +      val {ppc,where_,prls,...} = Specify.get_pbt pI
   3.292  	    val pbl = 
   3.293  	      if pI' = e_pblID andalso pI = e_pblID
   3.294  	      then (false, (Ctree.init_pbl ppc, []))
   3.295 -	      else match_itms_oris thy probl (ppc,where_,prls) oris
   3.296 +	      else Specify.match_itms_oris thy probl (ppc,where_,prls) oris
   3.297  	      (*FIXXXME~~~~~~~~~~~~~~~: take pbl and compare with new pI WN.8.03*)
   3.298  	    val (c, pt) = case Ctree.generate1 thy (Specify_Problem' (pI, pbl)) (Uistate, ctxt) pos pt of
   3.299  	      ((_, Pbl), c, _, pt) => (c, pt)
   3.300 @@ -1045,11 +1045,11 @@
   3.301          PblObj {origin = (oris, _, _), probl = pbl, spec = (dI, _, _), meth=met, ctxt, ...}
   3.302            => (oris, pbl, dI, met, ctxt)
   3.303        | _ => error "nxt_specif Specify_Method: uncovered case get_obj"
   3.304 -      val {ppc,pre,prls,...} = get_met mID
   3.305 +      val {ppc,pre,prls,...} = Specify.get_met mID
   3.306        val thy = assoc_thy dI
   3.307 -      val oris = add_field' thy ppc oris
   3.308 +      val oris = Specify.add_field' thy ppc oris
   3.309        val met = if met=[] then pbl else met (* WN0602 what if more itms in met? *)
   3.310 -      val (_, (itms, _)) = match_itms_oris thy met (ppc,pre,prls ) oris
   3.311 +      val (_, (itms, _)) = Specify.match_itms_oris thy met (ppc,pre,prls ) oris
   3.312        val (pos, c, _, pt) = 
   3.313  	      Ctree.generate1 thy (Specify_Method' (mID, oris, itms)) (Uistate, ctxt) pos pt
   3.314      in
   3.315 @@ -1083,7 +1083,7 @@
   3.316      if pI <> [] 
   3.317      then (* from pbl-browser or from CAS cmd with pI=[e_pblID] *)
   3.318  	    let 
   3.319 -        val {cas, met, ppc, thy, ...} = get_pbt pI
   3.320 +        val {cas, met, ppc, thy, ...} = Specify.get_pbt pI
   3.321  	      val dI = if dI = "" then theory2theory' thy else dI
   3.322  	      val mI = if mI = [] then hd met else mI
   3.323  	      val hdl = case cas of NONE => pblterm dI pI | SOME t => t
   3.324 @@ -1097,7 +1097,7 @@
   3.325        if mI <> [] 
   3.326        then (* from met-browser *)
   3.327  	      let 
   3.328 -          val {ppc, ...} = get_met mI
   3.329 +          val {ppc, ...} = Specify.get_met mI
   3.330  	        val dI = if dI = "" then "Isac" else dI
   3.331  	        val (pt, _) =
   3.332  	          cappend_problem e_ptree [] (e_istate, e_ctxt) ([], (dI, pI, mI)) ([], (dI, pI, mI), e_term (*FIXME met*))
   3.333 @@ -1117,13 +1117,13 @@
   3.334  	      if mI = ["no_met"] 
   3.335  	      then 
   3.336            let 
   3.337 -            val (pors, pctxt) = get_pbt pI |> #ppc |> prep_ori fmz thy;
   3.338 -		        val pI' = refine_ori' pors pI;
   3.339 +            val (pors, pctxt) = Specify.get_pbt pI |> #ppc |> Specify.prep_ori fmz thy;
   3.340 +		        val pI' = Specify.refine_ori' pors pI;
   3.341  		      in (pI', (pors(*refinement over models with diff.precond only*), pctxt),
   3.342 -		        (hd o #met o get_pbt) pI')
   3.343 +		        (hd o #met o Specify.get_pbt) pI')
   3.344  		      end
   3.345 -	      else (pI, get_pbt pI |> #ppc |> prep_ori fmz thy, mI)
   3.346 -	    val {cas, ppc, thy = thy', ...} = get_pbt pI (*take dI from _refined_ pbl*)
   3.347 +	      else (pI, Specify.get_pbt pI |> #ppc |> Specify.prep_ori fmz thy, mI)
   3.348 +	    val {cas, ppc, thy = thy', ...} = Specify.get_pbt pI (*take dI from _refined_ pbl*)
   3.349  	    val dI = theory2theory' (maxthy thy thy')
   3.350  	    val hdl = case cas of
   3.351  		    NONE => pblterm dI pI
   3.352 @@ -1158,7 +1158,7 @@
   3.353  (* check pbltypes, announces one failure a time *)
   3.354  fun chk_vars ctppc = 
   3.355    let
   3.356 -    val {Given = gi, Where = wh, Find = fi, Relate = re, ...} = appc flat (mappc vars ctppc)
   3.357 +    val {Given = gi, Where = wh, Find = fi, Relate = re, ...} = Specify.appc flat (Specify.mappc vars ctppc)
   3.358      val chked = subtract op = gi wh
   3.359    in
   3.360      if chked <> [] then ("wh\\gi", chked)
   3.361 @@ -1174,7 +1174,7 @@
   3.362  (* check a new pbltype: variables (Free) unbound by given, find*) 
   3.363  fun unbound_ppc ctppc =
   3.364    let
   3.365 -    val {Given = gi, Find = fi, Relate = re, ...} = appc flat (mappc vars ctppc)
   3.366 +    val {Given = gi, Find = fi, Relate = re, ...} = Specify.appc flat (Specify.mappc vars ctppc)
   3.367    in
   3.368      distinct (subtract op = (union op = gi fi) re)
   3.369    end
   3.370 @@ -1217,8 +1217,8 @@
   3.371  	    PblObj {origin = (oris, ospec, _), probl, spec, ...} => (oris, ospec, probl, spec)
   3.372  	  | _ => error "complete_mod: unvered case get_obj"
   3.373    	val (_, pI, mI) = some_spec ospec spec
   3.374 -  	val mpc = (#ppc o get_met) mI
   3.375 -  	val ppc = (#ppc o get_pbt) pI
   3.376 +  	val mpc = (#ppc o Specify.get_met) mI
   3.377 +  	val ppc = (#ppc o Specify.get_pbt) pI
   3.378    	val (pits, mits) = complete_mod_ (oris, mpc, ppc, probl)
   3.379      val pt = update_pblppc pt p pits
   3.380  	  val pt = update_metppc pt p mits
   3.381 @@ -1231,7 +1231,7 @@
   3.382      val (pors, dI, pI, mI) = case get_obj I pt p of
   3.383        PblObj {origin = (pors, (dI, pI, mI), _), ...} => (pors, dI, pI, mI)
   3.384      | _ => error "all_modspec: uncovered case get_obj"
   3.385 -	  val {ppc, ...} = get_met mI
   3.386 +	  val {ppc, ...} = Specify.get_met mI
   3.387      val (_, vals) = oris2fmz_vals pors
   3.388  	  val ctxt = dI |> Thy_Info.get_theory |> Proof_Context.init_global 
   3.389        |> declare_constraints' vals
   3.390 @@ -1286,7 +1286,7 @@
   3.391  	    val pre = if metID = e_metID then []
   3.392  	      else
   3.393  	        let
   3.394 -	          val {prls, pre= where_, ...} = get_met metID
   3.395 +	          val {prls, pre= where_, ...} = Specify.get_met metID
   3.396  	          val pre = check_preconds' prls where_ meth 0
   3.397  		      in pre end
   3.398  	    val allcorrect = is_complete_mod_ meth andalso foldl and_ (true, (map #1 pre))
   3.399 @@ -1299,7 +1299,7 @@
   3.400        val pre = if pI = e_pblID then []
   3.401  	      else
   3.402  	        let
   3.403 -	          val {prls, where_, ...} = get_pbt pI
   3.404 +	          val {prls, where_, ...} = Specify.get_pbt pI
   3.405  	          val pre = check_preconds' prls where_ probl 0
   3.406  	        in pre end
   3.407  	    val allcorrect = is_complete_mod_ probl andalso foldl and_ (true, (map #1 pre))
   3.408 @@ -1312,7 +1312,7 @@
   3.409    | pt_form (PblObj {probl, spec, origin = (_, spec', _), ...}) =
   3.410      let
   3.411        val (dI, pI, _) = get_somespec' spec spec'
   3.412 -      val {cas, ...} = get_pbt pI
   3.413 +      val {cas, ...} = Specify.get_pbt pI
   3.414      in case cas of
   3.415        NONE => Form (pblterm dI pI)
   3.416      | SOME t => Form (subst_atomic (mk_env probl) t)
   3.417 @@ -1461,7 +1461,7 @@
   3.418  	    val (ospec, hdf', spec, probl) = case get_obj I pt p of
   3.419  	      PblObj {origin = (_, ospec, hdf'), spec, probl,...} => (ospec, hdf', spec, probl)
   3.420  	    | _ => error "get_ocalhd Pbl: uncovered case get_obj"
   3.421 -      val {prls, where_, ...} = get_pbt (#2 (some_spec ospec spec))
   3.422 +      val {prls, where_, ...} = Specify.get_pbt (#2 (some_spec ospec spec))
   3.423        val pre = check_preconds (assoc_thy"Isac") prls where_ probl
   3.424      in
   3.425        (ocalhd_complete probl pre spec, Pbl, hdf', probl, pre, spec) : ocalhd
   3.426 @@ -1471,7 +1471,7 @@
   3.427  		  val (ospec, hdf', spec, meth) = case get_obj I pt p of
   3.428  		    PblObj {origin = (_, ospec, hdf'), spec, meth, ...} => (ospec, hdf', spec, meth)
   3.429  		  | _ => error "get_ocalhd Met: uncovered case get_obj"
   3.430 -      val {prls, pre, ...} = get_met (#3 (some_spec ospec spec))
   3.431 +      val {prls, pre, ...} = Specify.get_met (#3 (some_spec ospec spec))
   3.432        val pre = check_preconds (assoc_thy"Isac") prls pre meth
   3.433      in
   3.434        (ocalhd_complete meth pre spec, Met, hdf', meth, pre, spec)
     4.1 --- a/src/Tools/isac/Interpret/generate.sml	Wed Dec 14 14:20:25 2016 +0100
     4.2 +++ b/src/Tools/isac/Interpret/generate.sml	Sun Dec 18 16:27:41 2016 +0100
     4.3 @@ -176,7 +176,7 @@
     4.4  (*generate 1 ppobj in ptree*)
     4.5  (*TODO.WN0501: take calcstate as an argument (see embed_derive etc.)?specify?*)
     4.6  fun generate1 thy (Add_Given' (_, itmlist)) _ (pos as (p, p_)) pt = 
     4.7 -    (pos: pos', [], PpcKF (Upblmet, itms2itemppc thy [][]),
     4.8 +    (pos: pos', [], PpcKF (Upblmet, Specify.itms2itemppc thy [][]),
     4.9         case p_ of
    4.10           Pbl => update_pbl pt p itmlist
    4.11  	     | Met => update_met pt p itmlist
    4.12 @@ -184,27 +184,27 @@
    4.13      (* WN110515 probably declare_constraints with input item (without dsc) --
    4.14        -- important when specifying without formalisation *)
    4.15    | generate1 thy (Add_Find' (_, itmlist)) _ (pos as (p, p_)) pt = 
    4.16 -    (pos, [], (PpcKF (Upblmet, itms2itemppc thy [] [])),
    4.17 +    (pos, [], (PpcKF (Upblmet, Specify.itms2itemppc thy [] [])),
    4.18         case p_ of
    4.19           Pbl => update_pbl pt p itmlist
    4.20  	     | Met => update_met pt p itmlist
    4.21         | _ => error ("uncovered case " ^ pos_2str p_))
    4.22      (*WN110515 probably declare_constraints with input item (without dsc)*)
    4.23    | generate1 thy (Add_Relation' (_, itmlist)) _ (pos as (p, p_)) pt = 
    4.24 -    (pos, [],  PpcKF (Upblmet, itms2itemppc thy [] []),
    4.25 +    (pos, [],  PpcKF (Upblmet, Specify.itms2itemppc thy [] []),
    4.26         case p_ of
    4.27           Pbl => update_pbl pt p itmlist
    4.28  	     | Met => update_met pt p itmlist
    4.29         | _ => error ("uncovered case " ^ pos_2str p_))
    4.30    | generate1 thy (Specify_Theory' domID) _ (pos as (p,_)) pt = 
    4.31 -    (pos, [] , PpcKF  (Upblmet, itms2itemppc thy [] []),
    4.32 +    (pos, [] , PpcKF  (Upblmet, Specify.itms2itemppc thy [] []),
    4.33        update_domID pt p domID)
    4.34    | generate1 thy (Specify_Problem' (pI, (_, (itms, _)))) _ (p, _) pt = 
    4.35      let
    4.36        val pt = update_pbl pt p itms
    4.37        val pt = update_pblID pt p pI
    4.38      in
    4.39 -      ((p, Pbl), [], PpcKF (Upblmet, itms2itemppc thy [] []), pt)
    4.40 +      ((p, Pbl), [], PpcKF (Upblmet, Specify.itms2itemppc thy [] []), pt)
    4.41      end
    4.42    | generate1 thy (Specify_Method' (mID, oris, itms)) _ (p, _) pt = 
    4.43      let
    4.44 @@ -212,28 +212,28 @@
    4.45        val pt = update_met pt p itms
    4.46        val pt = update_metID pt p mID
    4.47      in
    4.48 -      ((p, Met), [], PpcKF (Upblmet, itms2itemppc thy [] []), pt)
    4.49 +      ((p, Met), [], PpcKF (Upblmet, Specify.itms2itemppc thy [] []), pt)
    4.50      end
    4.51    | generate1 thy (Model_Problem' (_, itms, met)) _ (pos as (p,_)) pt =
    4.52      let 
    4.53        val pt = update_pbl pt p itms
    4.54  	    val pt = update_met pt p met
    4.55      in
    4.56 -      (pos, [], PpcKF (Upblmet, itms2itemppc thy [] []), pt)
    4.57 +      (pos, [], PpcKF (Upblmet, Specify.itms2itemppc thy [] []), pt)
    4.58      end
    4.59    | generate1 thy (Refine_Tacitly' (_, pIre, domID, metID, pbl)) _ (pos as (p, _)) pt = 
    4.60      let
    4.61        val pt = update_pbl pt p pbl
    4.62        val pt = update_orispec pt p (domID, pIre, metID)
    4.63      in
    4.64 -      (pos, [], PpcKF (Upblmet, itms2itemppc thy [] []), pt)
    4.65 +      (pos, [], PpcKF (Upblmet, Specify.itms2itemppc thy [] []), pt)
    4.66      end
    4.67    | generate1 thy (Refine_Problem' (pI, _)) _ (pos as (p, _)) pt =
    4.68      let
    4.69        val (dI, _, mI) = get_obj g_spec pt p
    4.70        val pt = update_spec pt p (dI, pI, mI)
    4.71      in
    4.72 -      (pos, [], PpcKF (Upblmet, itms2itemppc thy [] []), pt)
    4.73 +      (pos, [], PpcKF (Upblmet, Specify.itms2itemppc thy [] []), pt)
    4.74      end
    4.75    | generate1 _ (Apply_Method' (_, topt, is, ctxt)) _ (pos as (p, _)) pt = 
    4.76      (case topt of 
    4.77 @@ -424,7 +424,7 @@
    4.78      	val tacis = (Begin_Trans, Begin_Trans' form, (pos, (Uistate, ctxt))) ::
    4.79      		(insert_pos ((lev_on o lev_dn) p) tacis) @ [(End_Trans, End_Trans' (res, asm),
    4.80      			(pos_plus (length tacis) (lev_dn p, Res), (new_val res ist, ctxt)))]
    4.81 -    	val {nrls, ...} = get_met (get_obj g_metID pt (par_pblobj pt p))
    4.82 +    	val {nrls, ...} = Specify.get_met (get_obj g_metID pt (par_pblobj pt p))
    4.83      	val (pt, c, pos as (p, _)) = generate (rev tacis) (pt, [], (p, Res))
    4.84      	val pt = update_tac pt p (Derive (id_rls nrls))
    4.85      	val pt = update_branch pt p TransitiveB
    4.86 @@ -441,7 +441,7 @@
    4.87      	val tacis = (Begin_Trans, Begin_Trans' f, ((p, Frm), (Uistate, ctxt))) ::
    4.88      		(insert_pos ((lev_on o lev_dn) p) tacis) @ [(End_Trans, End_Trans' (res, asm), 
    4.89      			(pos_plus (length tacis) (lev_dn p, Res), (new_val res ist, ctxt)))];
    4.90 -    	val {nrls, ...} = get_met (get_obj g_metID pt (par_pblobj pt p))
    4.91 +    	val {nrls, ...} = Specify.get_met (get_obj g_metID pt (par_pblobj pt p))
    4.92      	val (pt, c, pos as (p, _)) = generate (rev tacis) (pt, [], (p, Res))
    4.93      	val pt = update_tac pt p (Derive (id_rls nrls))
    4.94      	val pt = update_branch pt p TransitiveB
     5.1 --- a/src/Tools/isac/Interpret/inform.sml	Wed Dec 14 14:20:25 2016 +0100
     5.2 +++ b/src/Tools/isac/Interpret/inform.sml	Sun Dec 18 16:27:41 2016 +0100
     5.3 @@ -75,20 +75,20 @@
     5.4  fun cas_input_ ((dI, pI, mI): spec) dtss = (*WN110515 reconsider thy..ctxt*)
     5.5    let
     5.6      val thy = assoc_thy dI
     5.7 -	  val {ppc, ...} = get_pbt pI
     5.8 +	  val {ppc, ...} = Specify.get_pbt pI
     5.9  	  val its_ = map (dtss2itm_ ppc) dtss (*([1],true,"#Given",Cor (...))*)
    5.10 -	  val its = add_id its_
    5.11 +	  val its = Specify.add_id its_
    5.12  	  val pits = map flattup2 its
    5.13  	  val (pI, mI) =
    5.14        if mI <> ["no_met"]
    5.15        then (pI, mI)
    5.16  		  else
    5.17 -        case refine_pbl thy pI pits of
    5.18 -			    SOME (pI,_) => (pI, (hd o #met o get_pbt) pI)
    5.19 -			  | NONE => (pI, (hd o #met o get_pbt) pI)
    5.20 -	  val {ppc, pre, prls, ...} = get_met mI
    5.21 +        case Specify.refine_pbl thy pI pits of
    5.22 +			    SOME (pI,_) => (pI, (hd o #met o Specify.get_pbt) pI)
    5.23 +			  | NONE => (pI, (hd o #met o Specify.get_pbt) pI)
    5.24 +	  val {ppc, pre, prls, ...} = Specify.get_met mI
    5.25  	  val its_ = map (dtss2itm_ ppc) dtss (*([1],true,"#Given",Cor (...))*)
    5.26 -	  val its = add_id its_
    5.27 +	  val its = Specify.add_id its_
    5.28  	  val mits = map flattup2 its
    5.29  	  val pre = check_preconds thy prls pre mits
    5.30      val ctxt = e_ctxt (*WN110515 cas_input_ DOESNT WORK*)
    5.31 @@ -217,7 +217,7 @@
    5.32    let
    5.33      val thy = assoc_thy dI
    5.34      val its_ = map (fstr2itm_ thy pbt) selcts (*([1],true,"#Given",Cor (...))*)
    5.35 -    val its = add_id its_ 
    5.36 +    val its = Specify.add_id its_ 
    5.37    in
    5.38      (map flattup2 its): itm list
    5.39    end
    5.40 @@ -273,35 +273,35 @@
    5.41  	         if dI <> sdI
    5.42  	         then let val its = map (parsitm (assoc_thy dI)) probl;
    5.43  			            val (its, trms) = filter_sep is_Par its;
    5.44 -			            val pbt = (#ppc o get_pbt) (#2 (Chead.some_spec ospec sspec))
    5.45 +			            val pbt = (#ppc o Specify.get_pbt) (#2 (Chead.some_spec ospec sspec))
    5.46  		            in (Pbl, appl_adds dI oris its pbt  (map par2fstr trms), meth) end 
    5.47             else
    5.48               if pI <> spI 
    5.49  	           then if pI = snd3 ospec then (Pbl, probl, meth) 
    5.50                    else
    5.51 -		                let val pbt = (#ppc o get_pbt) pI
    5.52 +		                let val pbt = (#ppc o Specify.get_pbt) pI
    5.53  			                val dI' = #1 (Chead.some_spec ospec spec)
    5.54  			                val oris = if pI = #2 ospec then oris 
    5.55 -				                         else prep_ori fmz_(assoc_thy"Isac") pbt |> #1;
    5.56 +				                         else Specify.prep_ori fmz_(assoc_thy"Isac") pbt |> #1;
    5.57  		                in (Pbl, appl_adds dI' oris probl pbt 
    5.58  				              (map itms2fstr probl), meth) end 
    5.59               else if mI <> smI (*FIXME.WN0311: what if probl is incomplete?!*)
    5.60 -	                then let val met = (#ppc o get_met) mI
    5.61 +	                then let val met = (#ppc o Specify.get_met) mI
    5.62  		                     val mits = Chead.complete_metitms oris probl meth met
    5.63  		                   in if foldl and_ (true, map #3 mits)
    5.64  		                      then (Pbl, probl, mits) else (Met, probl, mits) 
    5.65  		                   end 
    5.66                    else (Pbl, appl_adds (#1 (Chead.some_spec ospec spec)) oris [(*!!!*)]
    5.67 -			                  ((#ppc o get_pbt) (#2 (Chead.some_spec ospec spec)))
    5.68 +			                  ((#ppc o Specify.get_pbt) (#2 (Chead.some_spec ospec spec)))
    5.69  			                  (imodel2fstr imodel), meth)
    5.70  	         val pt = update_spec pt p spec;
    5.71           in if pos_ = Pbl
    5.72 -	          then let val {prls,where_,...} = get_pbt (#2 (Chead.some_spec ospec spec))
    5.73 +	          then let val {prls,where_,...} = Specify.get_pbt (#2 (Chead.some_spec ospec spec))
    5.74  		               val pre =check_preconds(assoc_thy"Isac")prls where_ pits
    5.75  	               in (update_pbl pt p pits,
    5.76  		                 (Chead.ocalhd_complete pits pre spec, Pbl, hdf', pits, pre, spec):ocalhd) 
    5.77                   end
    5.78 -	           else let val {prls,pre,...} = get_met (#3 (Chead.some_spec ospec spec))
    5.79 +	           else let val {prls,pre,...} = Specify.get_met (#3 (Chead.some_spec ospec spec))
    5.80  		                val pre = check_preconds (assoc_thy"Isac") prls pre mits
    5.81  	                in (update_met pt p mits,
    5.82  		                  (Chead.ocalhd_complete mits pre spec, Met, hdf', mits, pre, spec) : ocalhd)
    5.83 @@ -381,7 +381,7 @@
    5.84          Frm => get_obj g_form pt p
    5.85  			| Res => (fst o (get_obj g_result pt)) p
    5.86  			| _ => e_term (*on PblObj is fo <> ifo*);
    5.87 -	  val {nrls, ...} = get_met (get_obj g_metID pt (par_pblobj pt p))
    5.88 +	  val {nrls, ...} = Specify.get_met (get_obj g_metID pt (par_pblobj pt p))
    5.89  	  val {rew_ord, erls, rules, ...} = rep_rls nrls
    5.90  	  val (found, der) = concat_deriv rew_ord erls rules fo ifo; (*<---------------*)
    5.91    in
    5.92 @@ -478,7 +478,7 @@
    5.93  			            ("no derivation found", calcstate') => 
    5.94  			               let
    5.95  			                 val pp = par_pblobj pt p
    5.96 -			                 val (errpats, nrls, prog) = case get_met (get_obj g_metID pt pp) of
    5.97 +			                 val (errpats, nrls, prog) = case Specify.get_met (get_obj g_metID pt pp) of
    5.98  			                   {errpats, nrls, scr = Prog prog, ...} => (errpats, nrls, prog)
    5.99  			                 | _ => error "inform: uncovered case of get_met"
   5.100  			                 val env = case get_istate pt pos of
   5.101 @@ -511,7 +511,7 @@
   5.102      val thmDeriv = Thm.get_name_hint thm
   5.103      val (part, thyID) = Rtools.thy_containing_thm thmDeriv
   5.104      val theID = [part, thyID, "Theorems", thmID_of_derivation_name thmDeriv]
   5.105 -    val fillpats = case get_the theID of
   5.106 +    val fillpats = case Specify.get_the theID of
   5.107        Hthm {fillpats, ...} => fillpats
   5.108      | _ => error "get_fillpats: uncovered case of get_the"
   5.109      val some = map (get_fillform subst (thm, form) errpatID) fillpats
   5.110 @@ -521,7 +521,7 @@
   5.111    let 
   5.112      val f_curr = get_curr_formula (pt, pos);
   5.113      val pp = par_pblobj pt p
   5.114 -    val (errpats, prog) = case get_met (get_obj g_metID pt pp) of
   5.115 +    val (errpats, prog) = case Specify.get_met (get_obj g_metID pt pp) of
   5.116        {errpats, scr = Prog prog, ...} => (errpats, prog)
   5.117      | _ => error "find_fillpatterns: uncovered case of get_met"
   5.118      val env = case get_istate pt pos of
   5.119 @@ -568,7 +568,7 @@
   5.120        | Rewrite_Set_Inst (_, rlsID) => rlsID
   5.121        | _ => "e_rls"
   5.122      val (part, thyID) = Rtools.thy_containing_rls "Isac" rlsID;
   5.123 -    val rls = case get_the [part, thyID, "Rulesets", rlsID] of
   5.124 +    val rls = case Specify.get_the [part, thyID, "Rulesets", rlsID] of
   5.125        Hrls {thy_rls = (_, rls), ...} => rls
   5.126      | _ => error "fetchErrorpatterns: uncovered case of get_the"
   5.127    in case rls of
     6.1 --- a/src/Tools/isac/Interpret/mathengine.sml	Wed Dec 14 14:20:25 2016 +0100
     6.2 +++ b/src/Tools/isac/Interpret/mathengine.sml	Sun Dec 18 16:27:41 2016 +0100
     6.3 @@ -120,12 +120,12 @@
     6.4        let 
     6.5          val cpI = if pI = e_pblID then pI' else pI;
     6.6    	    val cmI = if mI = e_metID then mI' else mI;
     6.7 -  	    val {ppc, prls, where_, ...} = get_pbt cpI;
     6.8 +  	    val {ppc, prls, where_, ...} = Specify.get_pbt cpI;
     6.9    	    val pre = check_preconds "thy 100820" prls where_ probl;
    6.10    	    val pb = foldl and_ (true, map fst pre);
    6.11    	    (*FIXME.WN0308:    ~~~~~: just check true in itms of pbl/met?*)
    6.12    	    val (_, tac) =
    6.13 -  	      Chead.nxt_spec p_ pb oris (dI', pI', mI') (probl, meth) (ppc, (#ppc o get_met) cmI) (dI, pI, mI)
    6.14 +  	      Chead.nxt_spec p_ pb oris (dI', pI', mI') (probl, meth) (ppc, (#ppc o Specify.get_met) cmI) (dI, pI, mI)
    6.15        in
    6.16          case tac of
    6.17    	      Apply_Method mI => 
    6.18 @@ -279,8 +279,8 @@
    6.19    	  if pI' = e_pblID 
    6.20    		then (* TODO.WN051125 (#init o get_pbt) pI *) takelast (2, pI)
    6.21    		else pI'
    6.22 -  	val {ppc, where_, prls, ...} = get_pbt pblID
    6.23 -  	val (model_ok, (pbl, pre)) = match_itms_oris (assoc_thy "Isac") probl (ppc,where_,prls) os
    6.24 +  	val {ppc, where_, prls, ...} = Specify.get_pbt pblID
    6.25 +  	val (model_ok, (pbl, pre)) = Specify.match_itms_oris (assoc_thy "Isac") probl (ppc,where_,prls) os
    6.26    in
    6.27      (model_ok, pblID, hdl, pbl, pre)
    6.28    end
    6.29 @@ -294,8 +294,8 @@
    6.30    	val metID = if mI' = e_metID 
    6.31    		    then (*TODO.WN051125 (#init o get_pbt) pI *) takelast (2, mI)
    6.32    		    else mI'
    6.33 -  	val {ppc, pre, prls, scr, ...} = get_met metID
    6.34 -  	val (model_ok, (pbl, pre)) = match_itms_oris (assoc_thy "Isac") meth (ppc,pre,prls) os
    6.35 +  	val {ppc, pre, prls, scr, ...} = Specify.get_met metID
    6.36 +  	val (model_ok, (pbl, pre)) = Specify.match_itms_oris (assoc_thy "Isac") meth (ppc,pre,prls) os
    6.37    in
    6.38      (model_ok, metID, scr, pbl, pre)
    6.39    end
    6.40 @@ -307,8 +307,8 @@
    6.41        case get_obj I pt p of
    6.42          PblObj {probl,origin = (os, _, hdl),...} => (probl, os, hdl)
    6.43        | PrfObj _ => error "context_pbl: uncovered case"
    6.44 -  	val {ppc,where_,prls,...} = get_pbt pI
    6.45 -  	val (model_ok, (pbl, pre)) = match_itms_oris (assoc_thy "Isac") probl (ppc,where_,prls) os
    6.46 +  	val {ppc,where_,prls,...} = Specify.get_pbt pI
    6.47 +  	val (model_ok, (pbl, pre)) = Specify.match_itms_oris (assoc_thy "Isac") probl (ppc,where_,prls) os
    6.48    in
    6.49      (model_ok, pI, hdl, pbl, pre)
    6.50    end
    6.51 @@ -319,8 +319,8 @@
    6.52        case get_obj I pt p of
    6.53          PblObj {meth, origin = (os, _, _),...} => (meth, os)
    6.54        | PrfObj _ => error "context_met: uncovered case"
    6.55 -  	val {ppc,pre,prls,scr,...} = get_met mI
    6.56 -  	val (model_ok, (pbl, pre)) = match_itms_oris (assoc_thy "Isac") meth (ppc,pre,prls) os
    6.57 +  	val {ppc,pre,prls,scr,...} = Specify.get_met mI
    6.58 +  	val (model_ok, (pbl, pre)) = Specify.match_itms_oris (assoc_thy "Isac") meth (ppc,pre,prls) os
    6.59    in
    6.60      (model_ok, mI, scr, pbl, pre)
    6.61    end
    6.62 @@ -332,11 +332,11 @@
    6.63          PblObj {probl, origin = (os, _, hdl), ...} => (probl, os, hdl)
    6.64        | PrfObj _ => error "context_met: uncovered case"
    6.65    in
    6.66 -    case refine_pbl (assoc_thy "Isac") pI probl of
    6.67 +    case Specify.refine_pbl (assoc_thy "Isac") pI probl of
    6.68    	  NONE => (*copy from context_pbl*)
    6.69    	    let
    6.70 -  	      val {ppc,where_,prls,...} = get_pbt pI
    6.71 -  	      val (_, (pbl, pre)) = match_itms_oris (assoc_thy "Isac") probl (ppc,where_,prls) os
    6.72 +  	      val {ppc,where_,prls,...} = Specify.get_pbt pI
    6.73 +  	      val (_, (pbl, pre)) = Specify.match_itms_oris (assoc_thy "Isac") probl (ppc,where_,prls) os
    6.74          in
    6.75            (false, pI, hdl, pbl, pre)
    6.76          end
    6.77 @@ -369,10 +369,11 @@
    6.78    in
    6.79      case form of
    6.80        Form t => Ctree.FormKF (term2str t)
    6.81 -    | ModSpec (_,p_, _, gfr, pre, _) => Ctree.PpcKF (
    6.82 +    | ModSpec (_, p_, _, gfr, pre, _) =>
    6.83 +      Ctree.PpcKF (
    6.84          (case p_ of Pbl => Ctree.Problem [] | Met => Ctree.Method []
    6.85          | _ => error "TESTg_form: uncovered case",
    6.86 - 			itms2itemppc (assoc_thy"Isac") gfr pre))
    6.87 + 			Specify.itms2itemppc (assoc_thy"Isac") gfr pre))
    6.88     end
    6.89  
    6.90  (* create a calc-tree; for use within sml: thus "^^^" NOT decoded to "^" etc;
     7.1 --- a/src/Tools/isac/Interpret/ptyps.sml	Wed Dec 14 14:20:25 2016 +0100
     7.2 +++ b/src/Tools/isac/Interpret/ptyps.sml	Sun Dec 18 16:27:41 2016 +0100
     7.3 @@ -3,211 +3,206 @@
     7.4     (c) due to copyright terms
     7.5  *)
     7.6  
     7.7 -(*-----------------------------------------vvv-(1) aus modspec.sml 23.3.02*)
     7.8 -val dsc_unknown = (Thm.term_of o the o (parseold @{theory Script})) 
     7.9 -  "unknown::'a => unknow";
    7.10 -(*-----------------------------------------^^^-(1) aus modspec.sml 23.3.02*)
    7.11 +signature MODEL_SPECIFY =
    7.12 +sig
    7.13 +  (* for generate.sml *)
    7.14 +  val itms2itemppc : theory -> itm list -> (bool * term) list -> item ppc
    7.15 +  val get_met : metID -> met
    7.16 +  (* for calchead.sml *)
    7.17 +  val itm_out : 'a -> itm_ -> string
    7.18 +  val dsc_unknown : term
    7.19 +  val add_id : 'a list -> (int * 'a) list
    7.20 +  val get_pbt : pblID -> pbt
    7.21 +  val prep_ori : string list -> theory -> (string * (term * 'a)) list ->
    7.22 +    (int * int list * string * term * term list) list * Proof.context
    7.23 +  val add_field' : theory -> (string * (term * 'a)) list -> ori list -> ori list
    7.24 +  val match_itms_oris : theory -> itm list -> (string * (term * term)) list * term list * rls ->
    7.25 +    ori list -> bool * (itm list * (bool * term) list)
    7.26 +  val refine_ori : ori list -> pblID -> pblID option
    7.27 +  val refine_pbl : theory -> pblID -> itm list -> (pblID * (itm list * (bool * term) list)) option
    7.28 +  val refine_ori' : ori list -> pblID -> pblID
    7.29 +  val appc : ('a list -> 'b list) -> 'a ppc -> 'b ppc 
    7.30 +  val mappc : ('a -> 'b) -> 'a ppc -> 'b ppc
    7.31 +  (* for appl.sml *)
    7.32 +  (* for rewtools.sml *)
    7.33 +  (* for script.sml *)
    7.34 +  (* for inform.sml *)
    7.35 +  val get_the : theID -> thydata
    7.36 +  (* for datatypes.sml *)
    7.37 +  val kestoreID2guh : ketype -> kestoreID -> guh
    7.38 +  val pblID2guh : pblID -> guh
    7.39 +  val metID2guh : metID -> guh
    7.40 +  (* for pbl-met-hierarchy.sml *)
    7.41 +  type pblRD = string list
    7.42 +  val get_met' : theory -> metID -> met
    7.43 +  (* for thy-hierarchy.sml *)
    7.44 +  val format_pblIDl : string list list -> string
    7.45 +  val scan : string list -> 'a ptyp list -> string list list
    7.46 +  (* for interface.sml *)
    7.47 +  val guh2kestoreID : guh -> string list
    7.48 +  (* for Knowledge/ *)
    7.49 +  val prep_pbt : theory -> guh -> string list -> pblID ->
    7.50 +    string list * (string * string list) list * rls * string option * metID list -> pbt * pblID
    7.51 +  val prep_met : theory -> string -> string list -> pblID ->
    7.52 +     string list * (string * string list) list *
    7.53 +     {calc: 'a, crls: rls, errpats: errpat list, nrls: rls, prls: rls, rew_ord': rew_ord', rls': rls, srls: rls}
    7.54 +     * string -> met * metID
    7.55 +(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
    7.56 +  val show_ptyps : unit -> unit
    7.57 +  val show_mets : unit -> unit
    7.58 +  val refine : fmz_ -> pblID -> match list
    7.59 +  val e_errpat : errpat
    7.60 +  datatype match' = Matches' of item ppc | NoMatch' of item ppc
    7.61 +  val match_pbl : fmz_ -> pbt -> match'
    7.62 +  val show_pblguhs : unit -> unit
    7.63 +  val sort_pblguhs : unit -> unit
    7.64 +( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
    7.65 +end
    7.66  
    7.67 +(**)
    7.68 +structure Specify(**): MODEL_SPECIFY(**) =
    7.69 +struct
    7.70 +(**)
    7.71  
    7.72 -(*-----------------------------------------vvv-(2) aus modspec.sml 23.3.02*)
    7.73 +val dsc_unknown = (Thm.term_of o the o (parseold @{theory Script})) "unknown::'a => unknow";
    7.74  
    7.75 -fun itm_2item thy (Cor ((d,ts),_)) = 
    7.76 -    Correct (term2str (comp_dts (d,ts)))
    7.77 -  | itm_2item _ (Syn c)            = SyntaxE c
    7.78 -  | itm_2item _ (Typ c)            = TypeE c
    7.79 -  | itm_2item thy (Inc ((d,ts),_)) = 
    7.80 -    Incompl (term2str (comp_dts (d,ts)))
    7.81 -  | itm_2item thy (Sup (d,ts))     = 
    7.82 -    Superfl (term2str (comp_dts (d,ts)))
    7.83 -  | itm_2item _ (Mis (d,pid))   =
    7.84 -    Missing (term2str d ^ " " ^ term2str pid);
    7.85 +fun itm_2item (_: theory) (Cor ((d, ts), _)) = Correct (term2str (comp_dts (d, ts)))
    7.86 +  | itm_2item _ (Syn c) = SyntaxE c
    7.87 +  | itm_2item _ (Typ c) = TypeE c
    7.88 +  | itm_2item _ (Inc ((d, ts), _)) = Incompl (term2str (comp_dts (d, ts)))
    7.89 +  | itm_2item _ (Sup (d, ts)) = Superfl (term2str (comp_dts (d, ts)))
    7.90 +  | itm_2item _ (Mis (d, pid)) = Missing (term2str d ^ " " ^ term2str pid)
    7.91 +  | itm_2item _ _ = error "itm_2item: uncovered definition"
    7.92  
    7.93 +fun mappc f ({Given = gi, Where = wh, Find = fi, With = wi, Relate = re}: 'a ppc) = 
    7.94 +  {Given= map f gi, Where = map f wh, Find = map f fi, With = map f wi, Relate = map f re} :'b ppc
    7.95 +fun appc f ({Given = gi, Where = wh, Find = fi, With = wi, Relate = re}: 'a ppc) = 
    7.96 +  {Given = f gi, Where = f wh, Find = f fi, With = f wi, Relate = f re}: 'b ppc
    7.97  
    7.98 -(* --- 8.3.00
    7.99 -fun get_dsc_in dscppc sel = ((the (assoc (dscppc, sel))):term list)
   7.100 -  handle _ => error ("get_dsc_in not for "^sel);
   7.101 -
   7.102 -fun dscs_in dscppc = 
   7.103 -  ((get_dsc_in dscppc "#Given") @
   7.104 -   (get_dsc_in dscppc "#Find") @
   7.105 -   (get_dsc_in dscppc "#Relate")):term list;
   7.106 -
   7.107 -   --- 26.1.88
   7.108 -fun get_dsc_of pblID sel = (the (assoc((snd o get_pbt) pblID, sel)));
   7.109 -fun get_dsc pblID = 
   7.110 -  (get_dsc_of pblID "#Given") @
   7.111 -  (get_dsc_of pblID "#Find") @
   7.112 -  (get_dsc_of pblID "#Relate");
   7.113 - --- *)
   7.114 -
   7.115 -fun mappc f ({Given=gi,Where=wh,Find=fi,With=wi,Relate=re}:'a ppc) = 
   7.116 -  {Given=map f gi, Where=map f wh,
   7.117 -   Find=map f fi, With=map f wi, Relate=map f re}:'b ppc;
   7.118 -fun appc f ({Given=gi,Where=wh,Find=fi,With=wi,Relate=re}:'a ppc) = 
   7.119 -  {Given=f gi, Where=f wh,
   7.120 -   Find=f fi, With=f wi, Relate=f re}:'b ppc;
   7.121 -
   7.122 -(*for ppc of changing type*)
   7.123 +(* for ppc of changing type *)
   7.124  fun sel_ppc sel ppc =
   7.125    case sel of
   7.126 -    "#Given" => #Given (ppc:'a ppc)
   7.127 -  | "#Where" => #Where (ppc:'a ppc)
   7.128 -  | "#Find" => #Find (ppc:'a ppc)
   7.129 -  | "#With" => #With (ppc:'a ppc)
   7.130 -  | "#Relate" => #Relate (ppc:'a ppc)
   7.131 -  | _  => error ("sel_ppc tried to select by '"^sel^"'");
   7.132 +    "#Given" => #Given (ppc: 'a ppc)
   7.133 +  | "#Where" => #Where (ppc: 'a ppc)
   7.134 +  | "#Find" => #Find (ppc: 'a ppc)
   7.135 +  | "#With" => #With (ppc: 'a ppc)
   7.136 +  | "#Relate" => #Relate (ppc: 'a ppc)
   7.137 +  | _  => error ("sel_ppc tried to select by \"" ^ sel ^ "\"");
   7.138  
   7.139 -fun repl_sel_ppc sel
   7.140 -  ({Given=gi,Where=wh,Find=fi,With=wi,Relate=re}:'a ppc) x =
   7.141 +fun repl_sel_ppc sel ({Given = gi, Where = wh, Find = fi, With = wi, Relate = re}: 'a ppc) x =
   7.142    case sel of
   7.143 -    "#Given" => ({Given= x,Where=wh,Find=fi,With=wi,Relate=re}:'a ppc)
   7.144 +    "#Given" => ({Given = x, Where = wh, Find = fi, With = wi, Relate = re}: 'a ppc)
   7.145    | "#Where" => {Given=gi,Where= x,Find=fi,With=wi,Relate=re}
   7.146    | "#Find" => {Given=gi,Where=wh,Find= x,With=wi,Relate=re}
   7.147    | "#With" => {Given=gi,Where=wh,Find=fi,With= x,Relate=re}
   7.148    | "#Relate" => {Given=gi,Where=wh,Find=fi,With=wi,Relate= x}
   7.149 -  | _  => error ("repl_sel_ppc tried to select by '"^sel^"'");
   7.150 +  | _  => error ("repl_sel_ppc tried to select by \"" ^ sel ^ "\"");
   7.151  
   7.152 -fun add_sel_ppc thy sel
   7.153 -  ({Given=gi,Where=wh,Find=fi,With=wi,Relate=re}:'a ppc) x =
   7.154 +fun add_sel_ppc (_: theory) sel ({Given = gi, Where = wh, Find = fi, With = wi, Relate = re}: 'a ppc) x =
   7.155    case sel of
   7.156 -    "#Given" => ({Given=gi@[x],Where=wh,Find=fi,With=wi,Relate=re}:'a ppc)
   7.157 -  | "#Where" => {Given=gi,Where=wh@[x],Find=fi,With=wi,Relate=re}
   7.158 -  | "#Find"  => {Given=gi,Where=wh,Find=fi@[x],With=wi,Relate=re}
   7.159 -  | "#Relate"=> {Given=gi,Where=wh,Find=fi,With=wi,Relate=re@[x]}
   7.160 -  | "#undef" => {Given=gi@[x],Where=wh,Find=fi,With=wi,Relate=re}(*ori2itmSup*)
   7.161 -  | _  => error ("add_sel_ppc tried to select by '"^sel^"'");
   7.162 -fun add_where ({Given=gi,Find=fi,With=wi,Relate=re,...}:'a ppc) wh =
   7.163 -    ({Given=gi,Where=wh,Find=fi,With=wi,Relate=re}:'a ppc);
   7.164 +    "#Given" => ({Given = gi @ [x], Where = wh, Find = fi, With = wi,Relate = re}: 'a ppc)
   7.165 +  | "#Where" =>  {Given = gi, Where = wh @ [x], Find = fi, With = wi, Relate = re}
   7.166 +  | "#Find"  =>  {Given = gi, Where = wh, Find = fi @ [x], With = wi, Relate = re}
   7.167 +  | "#Relate"=>  {Given = gi, Where = wh, Find = fi, With = wi, Relate = re @ [x]}
   7.168 +  | "#undef" =>  {Given = gi @ [x], Where = wh, Find = fi, With = wi, Relate = re} (*ori2itmSup*)
   7.169 +  | _  => error ("add_sel_ppc tried to select by \"" ^ sel ^ "\"")
   7.170 +fun add_where ({Given = gi, Where = _, Find = fi, With = wi, Relate = re}: 'a ppc) wh =
   7.171 +  ({Given = gi, Where = wh, Find= fi ,With = wi, Relate = re}: 'a ppc)
   7.172  
   7.173 -(*decompose a problem-type into description and identifier
   7.174 -  FIXME split_dsc: no term list !!! (just for quick redoing prep_ori) *)
   7.175 -fun split_dsc thy t =
   7.176 -  (let val (hd,args) = strip_comb t
   7.177 -   in if is_dsc hd
   7.178 -      then (hd, args)
   7.179 -       else (e_term, [t])    (*??? 9.01 just copied*)
   7.180 +(* decompose a problem-type into description and identifier
   7.181 +   FIXME split_dsc: no term list !!! (just for quick redoing prep_ori) *)
   7.182 +fun split_dsc _ t =
   7.183 +  (let val (hd, args) = strip_comb t
   7.184 +   in
   7.185 +    if is_dsc hd
   7.186 +    then (hd, args)
   7.187 +    else (e_term, [t]) (*??? 9.01 just copied*)
   7.188     end)
   7.189    handle _ => error ("split_dsc: called with " ^ term2str t);
   7.190 -(*
   7.191 -> val t1 = (Thm.term_of o the o (parse thy)) "errorBound err_";
   7.192 -> split_dsc t1;
   7.193 -(Const ("Descript.errorBound","bool => Tools.nam"),Free ("err_","bool"))
   7.194 -  : term * term
   7.195 -> val t3 = (Thm.term_of o the o (parse thy)) "valuesFor vs_";
   7.196 -> split_dsc t3;
   7.197 -(Const ("Descript.valuesFor","bool List.list => Tools.toreall"),
   7.198 -   Free ("vs_","bool List.list")) : term * term*)
   7.199  
   7.200 -
   7.201 -
   7.202 -(*. take the first two return-values; for prep_ori .*)
   7.203 -(*WN.13.5.03fun split_dts' thy t =
   7.204 -    let val (d, ts, _) = split_dts thy t
   7.205 -    in (d, ts) end;*)
   7.206 -(*WN.8.12.03 quick for prep_ori'*)
   7.207 +(* take the first two return-values; for prep_ori *)
   7.208  fun split_dsc' t =
   7.209    (let val dsc $ var = t
   7.210    in var end)
   7.211 -  handle _ => error ("split_dsc': called with "^term2str t);
   7.212 +    handle _ => error ("split_dsc': called with " ^ term2str t)
   7.213  
   7.214 -(*9.3.00*)
   7.215 -(* split a term into description and (id | structured variable)
   7.216 -   for pbt, met.ppc *)
   7.217 +(* split a term into description and (id | structured variable) for pbt, met.ppc *)
   7.218  fun split_did t =
   7.219 -  (let val (hd,[arg]) = strip_comb t
   7.220 -  in (hd,arg) end)
   7.221 -  handle _ => 
   7.222 -         error ("split_did: doesn't match (hd,[arg]) for t = " ^term2str t);
   7.223 -
   7.224 -
   7.225 +  (let val (hd, [arg]) = strip_comb t
   7.226 +  in (hd, arg) end)
   7.227 +    handle _ =>  error ("split_did: doesn't match (hd,[arg]) for t = " ^ term2str t)
   7.228  
   7.229  (*create output-string for itm_*)
   7.230 -fun itm_out thy (Cor ((d,ts),_)) = term2str (comp_dts (d,ts))
   7.231 -  | itm_out thy (Syn c)      = c
   7.232 -  | itm_out thy (Typ c)      = c
   7.233 -  | itm_out thy (Inc ((d,ts),_)) = term2str (comp_dts (d,ts))
   7.234 -  | itm_out thy (Sup (d,ts)) = term2str (comp_dts (d,ts))
   7.235 -  | itm_out thy (Mis (d,pid)) = term2str d ^ " " ^ term2str pid;
   7.236 +fun itm_out _ (Cor ((d, ts), _)) = term2str (comp_dts (d, ts))
   7.237 +  | itm_out _ (Syn c) = c
   7.238 +  | itm_out _ (Typ c) = c
   7.239 +  | itm_out _ (Inc ((d, ts), _)) = term2str (comp_dts (d, ts))
   7.240 +  | itm_out _ (Sup (d, ts)) = term2str (comp_dts (d, ts))
   7.241 +  | itm_out _ (Mis (d, pid)) = term2str d ^ " " ^ term2str pid
   7.242 +  | itm_out _ _ = error "itm_out: uncovered definition"
   7.243  
   7.244  fun boolterm2item (true, term) = Correct (term2str term)
   7.245    | boolterm2item (false, term) = False (term2str term);
   7.246  
   7.247 -(* use"ME/modspec.sml";
   7.248 -   *)
   7.249 -fun itms2itemppc thy (itms:itm list) (pre:(bool * term) list) =
   7.250 +fun itms2itemppc thy (itms: itm list) (pre: (bool * term) list) =
   7.251    let
   7.252      fun coll ppc [] = ppc
   7.253 -      | coll ppc ((_,_,_,field,itm_)::itms) = 
   7.254 -      coll (add_sel_ppc thy field ppc (itm_2item thy itm_)) itms;
   7.255 +      | coll ppc ((_,_,_,field,itm_)::itms) =
   7.256 +        coll (add_sel_ppc thy field ppc (itm_2item thy itm_)) itms;
   7.257      val gfr = coll empty_ppc itms;
   7.258    in add_where gfr (map boolterm2item pre) end;
   7.259  
   7.260 -(* 9.3.00
   7.261 -   compare d and dsc in pbt and transfer field to pre-ori *)
   7.262 -fun add_field thy pbt (d,ts) = 
   7.263 +(* compare d and dsc in pbt and transfer field to pre-ori *)
   7.264 +fun add_field (_: theory) pbt (d,ts) = 
   7.265    let fun eq d pt = (d = (fst o snd) pt);
   7.266    in case filter (eq d) pbt of
   7.267 -       [(fi,(dsc,_))] => (fi,d,ts)
   7.268 -     | [] => ("#undef",d,ts)   (*may come with met.ppc*)
   7.269 +       [(fi, (_, _))] => (fi, d, ts)
   7.270 +     | [] => ("#undef", d, ts)   (*may come with met.ppc*)
   7.271       | _ => error ("add_field: " ^ term2str d ^ " more than once in pbt")
   7.272    end;
   7.273  
   7.274 -(*. take over field from met.ppc at 'Specify_Method' into ori,
   7.275 -   i.e. also removes "#undef" fields                        .*)
   7.276 -(* val (mpc, ori) =  ((#ppc o get_met) mID, oris);
   7.277 -   *)
   7.278 -fun add_field' thy mpc (ori:ori list) =
   7.279 +(* take over field from met.ppc at 'Specify_Method' into ori,
   7.280 +   i.e. also removes "#undef" fields                        *)
   7.281 +fun add_field' (_: theory) mpc (ori: ori list) =
   7.282    let fun eq d pt = (d = (fst o snd) pt);
   7.283 -    fun repl mpc (i,v,_,d,ts) = 
   7.284 +    fun repl mpc (i, v, _, d, ts) = 
   7.285        case filter (eq d) mpc of
   7.286 -	[(fi,(dsc,_))] => [(i,v,fi,d,ts)]
   7.287 +	[(fi, (_, _))] => [(i, v, fi, d, ts)]
   7.288        | [] => [] (*25.2.02: dsc in ori, but not in met -> superfluous*)    
   7.289        | _ => error ("add_field': " ^ term2str d ^ " more than once in met");
   7.290 -  in (flat ((map (repl mpc)) ori)):ori list end;
   7.291 +  in (flat ((map (repl mpc)) ori)): ori list end;
   7.292  
   7.293 +(* mark an element with the position within a plateau;
   7.294 +   a plateau with length 1 is marked with 0         *)
   7.295 +fun mark _ [] = error "mark []"
   7.296 +  | mark eq xs =
   7.297 +    let
   7.298 +      fun mar xx _ [x] n = xx @ [(if n = 1 then 0 else n, x)]
   7.299 +        | mar _ _ [] _ = error "mark []"
   7.300 +        | mar xx eq (x:: x' :: xs) n = 
   7.301 +        if eq(x, x') then mar (xx @ [(n, x)]) eq (x' :: xs) (n + 1)
   7.302 +        else mar (xx @ [(if n = 1 then 0 else n, x)]) eq (x' :: xs) 1;
   7.303 +    in mar [] eq xs 1 end;
   7.304  
   7.305 -(*.mark an element with the position within a plateau;
   7.306 -   a plateau with length 1 is marked with 0        .*)
   7.307 -fun mark eq [] = error "mark []"
   7.308 -  | mark eq xs =
   7.309 -  let
   7.310 -    fun mar xx eq [x] n = xx @ [(if n=1 then 0 else n,x)]
   7.311 -      | mar xx eq (x::x'::xs) n = 
   7.312 -      if eq(x,x') then mar (xx @ [(n,x)]) eq (x'::xs) (n+1)
   7.313 -      else mar (xx @ [(if n=1 then 0 else n,x)]) eq (x'::xs) 1;
   7.314 -  in mar [] eq xs 1 end;
   7.315 -(*
   7.316 -> val xs = [1,1,1,2,4,4,5];
   7.317 -> mark (op=) xs;
   7.318 -val it = [(1,1),(2,1),(3,1),(0,2),(1,4),(2,4),(0,5)]
   7.319 -*)
   7.320 -
   7.321 -(*.assumes equal descriptions to be in adjacent 'plateaus',
   7.322 +(* assumes equal descriptions to be in adjacent 'plateaus',
   7.323     items at a certain position within the plateaus form a variant;
   7.324 -   length = 1 ... marked with 0: covers all variants           .*)
   7.325 +   length = 1 ... marked with 0: covers all variants            *)
   7.326  fun add_variants fdts = 
   7.327    let 
   7.328 -    fun eq (a,b) = curry op= (snd3 a) (snd3 b);
   7.329 +    fun eq (a, b) = curry op= (snd3 a) (snd3 b);
   7.330    in mark eq fdts end;
   7.331  
   7.332  (* collect equal elements: the model for coll_variants *)
   7.333  fun coll eq xs =
   7.334    let
   7.335 -    fun col xs eq x [] = xs @ [x]
   7.336 -      | col xs eq x (y::ys) = 
   7.337 -      if eq(x,y) then col xs eq x ys
   7.338 -      else col (xs @ [x]) eq y ys;
   7.339 +    fun col xs _ x [] = xs @ [x]
   7.340 +      | col xs eq x (y :: ys) = if eq(x, y) then col xs eq x ys else col (xs @ [x]) eq y ys;
   7.341    in col [] eq (hd xs) xs end;
   7.342 -(* 
   7.343 -> val xs = [1,1,1,2,4,4,4];
   7.344 -> coll (op=) xs;
   7.345 -val it = [1,2,4] : int list
   7.346 -*)
   7.347  
   7.348  fun max [] = error "max of []"
   7.349 -  | max (y::ys) =
   7.350 +  | max (y :: ys) =
   7.351    let fun mx x [] = x
   7.352 -	| mx x (y::ys) = if x < y then mx y ys else mx x ys;
   7.353 +	| mx x (y :: ys) = if x < y then mx y ys else mx x ys;
   7.354  in mx y ys end;
   7.355  fun gen_max _ [] = error "gen_max of []"
   7.356    | gen_max ord (y::ys) =
   7.357 @@ -215,757 +210,526 @@
   7.358  	| mx x (y::ys) = if ord (x, y) then mx y ys else mx x ys;
   7.359  in mx y ys end;
   7.360  
   7.361 -
   7.362 -
   7.363 -(* assumes *)
   7.364 -fun coll_variants (((v,x)::vxs)) =
   7.365 -  let
   7.366 -    fun col xs (vs,x) [] = xs @ [(vs,x)]
   7.367 -      | col xs (vs,x) ((v',x')::vxs') = 
   7.368 -      if x=x' then col xs (vs @ [v'], x') vxs'
   7.369 -      else col (xs @ [(vs,x)]) ([v'], x') vxs';
   7.370 -  in col [] ([v],x) vxs end;
   7.371 -(* val xs = [(1,1),(2,1),(3,1),(0,2),(1,4),(2,4),(0,5)];
   7.372 -> col [] ([(fst o hd) xs],(snd o hd) xs) (tl xs);
   7.373 -val it = [([1,2,3],1),([0],2),([1,2],4),([0],5)]  *)
   7.374 -
   7.375 +fun coll_variants (((v,x) :: vxs)) =
   7.376 +    let
   7.377 +      fun col xs (vs, x) [] = xs @ [(vs, x)]
   7.378 +        | col xs (vs, x) ((v', x') :: vxs') = 
   7.379 +        if x = x' then col xs (vs @ [v'], x') vxs'
   7.380 +        else col (xs @ [(vs, x)]) ([v'], x') vxs';
   7.381 +    in col [] ([v], x) vxs end
   7.382 +  | coll_variants _ = error "coll_variants: called with []";
   7.383  
   7.384  fun replace_0 vm [0] = intsto vm
   7.385 -  | replace_0 vm vs = vs;
   7.386 +  | replace_0 _ vs = vs;
   7.387  
   7.388  fun add_id [] = error "add_id []"
   7.389    | add_id xs =
   7.390 -  let fun add n [] = []
   7.391 -	| add n (x::xs) = (n,x) :: add (n+1) xs;
   7.392 -in add 1 xs end;
   7.393 -(*
   7.394 -> val xs = [([1,2,3],1),([0],2),([1,2],4),([0],5)];
   7.395 -> add_id xs;
   7.396 -val it = [(1,([#,#,#],1)),(2,([#],2)),(3,([#,#],4)),(4,([#],5))]
   7.397 - *)
   7.398 +    let
   7.399 +      fun add _ [] = []
   7.400 +        | add n (x :: xs) = (n, x) :: add (n + 1) xs;
   7.401 +    in add 1 xs end;
   7.402  
   7.403 -fun flattup (a,(b,(c,d,e))) = (a,b,c,d,e);
   7.404 -fun flattup' (a,(b,((c,d),e))) = (a,b,c,d,e);
   7.405 -fun flat3 (a,(b,c)) = (a,b,c);
   7.406 -(*
   7.407 - val pI = pI';
   7.408 - !pbts;
   7.409 -*)
   7.410 -(* in root (only!) fmz may be empty: fill with ..,dsc,[]
   7.411 -fun init_ori fmz thy pI =
   7.412 -  if fmz <> [] then prep_ori fmz thy pI (*fmz assumed complete*)
   7.413 -  else
   7.414 -    let 
   7.415 -      val fds = map (cons2 (fst, fst o snd)) (get_pbt pI);
   7.416 -      val vfds = map ((pair [1]) o (rpair [])) fds;
   7.417 -      val ivfds = add_id vfds
   7.418 -    in (map flattup' ivfds):ori list end;   10.3.00---*)
   7.419 -(* val fmz = ctl; val pI=["sqroot-test","univariate","equation"];
   7.420 -   val (thy,pbt) = (assoc_thy dI',(#ppc o get_pbt) pI');
   7.421 -   val (fmz, thy, pbt) = (fmz, thy, ((#ppc o get_pbt) pI));
   7.422 -   *)
   7.423 +fun flattup (a, (b, (c, d, e))) = (a, b, c, d, e);
   7.424 +fun flattup' (a, (b, ((c,d), e))) = (a, b, c, d, e);
   7.425 +fun flat3 (a, (b, c)) = (a, b, c);
   7.426  
   7.427  fun prep_ori [] _ _ = ([], e_ctxt)
   7.428    | prep_ori fmz thy pbt =
   7.429 -      let
   7.430 -        val ctxt = Proof_Context.init_global thy |> fold declare_constraints fmz;
   7.431 -        val ori = map (add_field thy pbt o split_dts o the o parseNEW ctxt) fmz
   7.432 -          |> add_variants;
   7.433 -        val maxv = map fst ori |> max;
   7.434 -        val maxv = if maxv = 0 then 1 else maxv;
   7.435 -        val oris = coll_variants ori
   7.436 -          |> map (replace_0 maxv |> apfst)
   7.437 -          |> add_id
   7.438 -          |> map flattup;
   7.439 -      in (oris, ctxt) end;
   7.440 -
   7.441 +    let
   7.442 +      val ctxt = Proof_Context.init_global thy |> fold declare_constraints fmz;
   7.443 +      val ori = map (add_field thy pbt o split_dts o the o parseNEW ctxt) fmz |> add_variants;
   7.444 +      val maxv = map fst ori |> max;
   7.445 +      val maxv = if maxv = 0 then 1 else maxv;
   7.446 +      val oris = coll_variants ori
   7.447 +        |> map (replace_0 maxv |> apfst)
   7.448 +        |> add_id
   7.449 +        |> map flattup;
   7.450 +    in (oris, ctxt) end;
   7.451  
   7.452  val e_errpat = ("e_errpatID", [parse_patt @{theory} "?a = ?b"], [@{thm refl}]): errpat
   7.453  val e_fillpat = ("e_fillpatID", parse_patt @{theory} "?a = _", "e_errpatID")
   7.454  
   7.455  
   7.456 -(**+ breadth-first search on hierarchy of problem-types +**)
   7.457 +(** breadth-first search on hierarchy of problem-types **)
   7.458  
   7.459 -type pblRD = pblID;(*pblID are Reverted _on calling_ the retrieve-funs*)
   7.460 -     (* eg. ["equations","univariate","normalize"] while
   7.461 -	    ["normalize","univariate","equations"] is the related pblID
   7.462 -      WN.24.4.03: also used for metID*)
   7.463 +(* pblID are reverted _on calling_ the retrieve-funs *)
   7.464 +type pblRD = (*e.g. ["equations","univariate","normalize"] for internal retrieval *)
   7.465 +  pblID;     (*e.g. ["normalize","univariate","equations"] presented to student   *)
   7.466  
   7.467 -
   7.468 -(*> ptyps:= 
   7.469 -[Ptyp ("1",[("ptyp 1",([],[]))],
   7.470 -	[Ptyp ("11",[("ptyp 11",([],[]))],
   7.471 -		[])
   7.472 -	 ]),
   7.473 - Ptyp ("2",[("ptyp 2",([],[]))],
   7.474 -	[Ptyp ("21",[("ptyp 21",([],[]))],
   7.475 -		[])
   7.476 -	 ])
   7.477 - ];
   7.478 -> get_py SqRoot.thy ["1"] ["1"] (!ptyps);
   7.479 -> get_py SqRoot.thy ["2","21"] ["2","21"] (!ptyps);
   7.480 -         _REVERSE_  .......... !!!!!!!!!!*)
   7.481 -
   7.482 -(*. apply a fun to a ptyps node .*)
   7.483 +(* apply a fun to a ptyps node *)
   7.484  fun app_ptyp x = app_py (get_ptyps ()) x;
   7.485  
   7.486 -(*TODO: search generalized for subthy*)
   7.487 -fun get_pbt (pblID:pblID) = get_py (get_ptyps ()) pblID (rev pblID)
   7.488 -(* get_pbt thy ["1"];
   7.489 -   get_pbt thy ["21","2"];
   7.490 -   *)
   7.491 +(* TODO: generalize search for subthy *)
   7.492 +fun get_pbt (pblID: pblID) = get_py (get_ptyps ()) pblID (rev pblID)
   7.493  
   7.494 -(*TODO: throws exn 'get_pbt not found: ' ... confusing !!
   7.495 -  take 'ketype' as an argument !!!!!*)
   7.496 +(* TODO: throws exn 'get_pbt not found: ' ... confusing !! take 'ketype' as an argument *)
   7.497  fun get_met (metID : metID) = get_py (get_mets ()) metID metID;
   7.498  fun get_met' thy (metID : metID) = get_py (KEStore_Elems.get_mets thy) metID metID;
   7.499  fun get_the (theID : theID) = get_py (get_thes ()) theID theID;
   7.500  
   7.501 +fun del_eq k ptyps =
   7.502 +  let
   7.503 +    fun del _ ptyps [] = ptyps
   7.504 +      | del k ptyps ((Ptyp (k', [p], ps)) :: pys) =
   7.505 +  	    if k = k' then del k ptyps pys else del k (ptyps @ [Ptyp (k', [p], ps)]) pys
   7.506 +      | del _ _ _ = error "del_eq: uncovered fun def."
   7.507 +  in del k [] ptyps end;
   7.508  
   7.509 -fun del_eq k ptyps =
   7.510 -let fun del k ptyps [] = ptyps
   7.511 -      | del k ptyps ((Ptyp (k', [p], ps))::pys) =
   7.512 -	if k=k' then del k ptyps pys
   7.513 -	else del k (ptyps @ [Ptyp (k', [p], ps)]) pys;
   7.514 -in del k [] ptyps end;
   7.515 +(* lookup a guh in hierarchy of problems / methods depending on fst 4 chars in guh *)
   7.516 +fun guh2kestoreID (guh: guh) =
   7.517 +  case (implode o (take_fromto 1 4) o Symbol.explode) guh of
   7.518 +	  "pbl_" =>
   7.519 +	    let
   7.520 +	      fun node ids gu (Ptyp (id, [{guh, ...} : pbt], ns)) =
   7.521 +	        if gu = guh then SOME ((ids @ [id]) : kestoreID) else nodes (ids @ [id]) gu ns
   7.522 +	        | node _ _ _ = error "guh2kestoreID node: uncovered fun def."
   7.523 +	      and nodes _ _ [] = NONE 
   7.524 +	        | nodes ids gu (n :: ns) = case node ids gu n of
   7.525 +	            SOME id => SOME id
   7.526 +			      | NONE =>  nodes ids gu ns
   7.527 +	    in case nodes [] guh (get_ptyps ()) of
   7.528 +	      SOME id => rev id
   7.529 +	    | NONE => error ("guh2kestoreID: \"" ^ guh ^ "\" " ^ "not found in ptyps")
   7.530 +      end
   7.531 +  | "met_" =>
   7.532 +	    let
   7.533 +	      fun node ids gu (Ptyp (id, [{guh, ...} : met], ns)) =
   7.534 +	        if gu = guh then SOME ((ids @ [id]) : kestoreID) else nodes (ids @ [id]) gu ns
   7.535 +	        | node _ _ _ = error "guh2kestoreID node: uncovered fun def."
   7.536 +	      and nodes _ _ [] = NONE 
   7.537 +	        | nodes ids gu (n :: ns) = case node ids gu n of
   7.538 +	            SOME id => SOME id
   7.539 +				    | NONE =>  nodes ids gu ns
   7.540 +	    in case nodes [] guh (get_mets ()) of
   7.541 +	      SOME id => id
   7.542 +	    | NONE => error ("guh2kestoreID: \"" ^ guh ^ "\" " ^ "not found in mets")
   7.543 +      end
   7.544 +  | _ => error ("guh2kestoreID called with \"" ^ guh ^ "\":");
   7.545  
   7.546 -(*.lookup a guh in hierarchy or methods depending on fst chars in guh.*)
   7.547 -fun guh2kestoreID (guh:guh) =
   7.548 -    case (implode o (take_fromto 1 4) o Symbol.explode) guh of
   7.549 -	"pbl_" =>
   7.550 -	let fun node ids gu (Ptyp (id,[n as {guh,...} : pbt], ns)) =
   7.551 -		if gu = guh 
   7.552 -		then SOME ((ids@[id]) : kestoreID)
   7.553 -		else nodes (ids@[id]) gu ns
   7.554 -	    and nodes _ _ [] = NONE 
   7.555 -	      | nodes ids gu (n::ns) = 
   7.556 -		case node ids gu n of SOME id => SOME id
   7.557 -				    | NONE =>  nodes ids gu ns
   7.558 -	in case nodes [] guh (get_ptyps ()) of
   7.559 -	       SOME id => rev id
   7.560 -	     | NONE => error ("guh2kestoreID: '" ^ guh ^ "' " ^
   7.561 -				    "not found in ptyps")
   7.562 -	end
   7.563 -      | "met_" =>
   7.564 -	let fun node ids gu (Ptyp (id,[n as {guh,...} : met], ns)) =
   7.565 -		if gu = guh 
   7.566 -		then SOME ((ids@[id]) : kestoreID)
   7.567 -		else nodes (ids@[id]) gu ns
   7.568 -	    and nodes _ _ [] = NONE 
   7.569 -	      | nodes ids gu (n::ns) = 
   7.570 -		case node ids gu n of SOME id => SOME id
   7.571 -				    | NONE =>  nodes ids gu ns
   7.572 -	in case nodes [] guh (get_mets ()) of
   7.573 -	       SOME id => id
   7.574 -	     | NONE => error ("guh2kestoreID: '" ^ guh ^ "' " ^
   7.575 -				    "not found in mets") end
   7.576 -      | _ => error ("guh2kestoreID called with '" ^ guh ^ "'");
   7.577 -(*> guh2kestoreID "pbl_equ_univ_lin";
   7.578 -val it = ["linear", "univariate", "equation"] : string list*)
   7.579 +(* prepare problem-types before storing in pbltypes; 
   7.580 +   dont forget to "check_guh_unique" before ins   *)
   7.581 +fun prep_pbt thy guh maa init
   7.582 +      (pblID, dsc_dats: (string * (string list)) list, ev: rls, ca: string option, metIDs: metID list) =
   7.583 +    let
   7.584 +      fun eq f (f', _) = f = f';
   7.585 +      val gi = filter (eq "#Given") dsc_dats;
   7.586 +      val gi = (case gi of
   7.587 +		    [] => []
   7.588 +		  | ((_, gi') :: []) => (map (split_did o Thm.term_of o the o (parse thy)) gi'
   7.589 +		      handle _ => error ("prep_pbt: syntax error in '#Given' of " ^ strs2str pblID))
   7.590 +		  | _ => error ("prep_pbt: more than one '#Given' in " ^ strs2str pblID));
   7.591 +		  val gi = map (pair "#Given") gi;
   7.592  
   7.593 +		  val fi = filter (eq "#Find") dsc_dats;
   7.594 +		  val fi = (case fi of
   7.595 +		    [] => []
   7.596 +		  | ((_, fi') :: []) => (map (split_did o Thm.term_of o the o (parse thy)) fi'
   7.597 +		      handle _ => error ("prep_pbt: syntax error in '#Find' of " ^ strs2str pblID))
   7.598 +		  | _ => error ("prep_pbt: more than one '#Find' in " ^ strs2str pblID));
   7.599 +		  val fi = map (pair "#Find") fi;
   7.600  
   7.601 -(*. prepare problem-types before storing in pbltypes; 
   7.602 -    dont forget to 'check_guh_unique' before ins.*)
   7.603 -fun prep_pbt thy guh maa init
   7.604 -	     (pblID, dsc_dats: (string * (string list)) list, 
   7.605 -		  ev:rls, ca: string option, metIDs:metID list) =
   7.606 -(* val (thy, (pblID, dsc_dats: (string * (string list)) list, 
   7.607 -		  ev:rls, ca: string option, metIDs:metID list)) =
   7.608 -       ((EqSystem.thy, (["system"],
   7.609 -		       [("#Given" ,["equalities es_", "solveForVars vs_"]),
   7.610 -			("#Find"  ,["solution ss___"](*___ is copy-named*))
   7.611 -			],
   7.612 -		       append_rls "e_rls" e_rls [(*for preds in where_*)], 
   7.613 -		       SOME "solveSystem es_ vs_", 
   7.614 -		       [])));
   7.615 -   *)
   7.616 -    let fun eq f (f', _) = f = f';
   7.617 -	val gi = filter (eq "#Given") dsc_dats;
   7.618 -(*val gi = [("#Given",["equality e_","solveFor v_"])]
   7.619 -  : (string * string list) list*)
   7.620 -	val gi = (case gi of
   7.621 -		     [] => []
   7.622 -		   | ((_,gi')::[]) => 
   7.623 -		     ((map (split_did o Thm.term_of o the o (parse thy)) gi')
   7.624 -		     handle _ => error 
   7.625 -			("prep_pbt: syntax error in '#Given' of "^
   7.626 -			 (strs2str pblID)))
   7.627 -		   | _ =>
   7.628 -		     (error ("prep_pbt: more than one '#Given' in "^
   7.629 -				  (strs2str pblID))));
   7.630 -(*val gi =
   7.631 -  [(Const ("Descript.equality","bool => Tools.una"),Free ("e_","bool")),
   7.632 -   (Const ("Descript.solveFor","RealDef.real => Tools.una"),
   7.633 -    Free ("v_","RealDef.real"))] : (term * term) list  *)
   7.634 -	val gi = map (pair "#Given") gi;
   7.635 -(*val gi =
   7.636 -  [("#Given",
   7.637 -    (Const ("Descript.equality","bool => Tools.una"),Free ("e_","bool"))),
   7.638 -   ("#Given",
   7.639 -    (Const ("Descript.solveFor","RealDef.real => Tools.una"),
   7.640 -     Free ("v_","RealDef.real")))] : (string * (term * term)) list*)
   7.641 +		  val re = filter (eq "#Relate") dsc_dats;
   7.642 +		  val re = (case re of
   7.643 +		    [] => []
   7.644 +		  | ((_, re') :: []) => (map (split_did o Thm.term_of o the o (parse thy)) re'
   7.645 +		      handle _ => error ("prep_pbt: syntax error in '#Relate' of " ^ strs2str pblID))
   7.646 +		  | _ => error ("prep_pbt: more than one '#Relate' in " ^ strs2str pblID));
   7.647 +		  val re = map (pair "#Relate") re;
   7.648  
   7.649 -	val fi = filter (eq "#Find") dsc_dats;
   7.650 -	val fi = (case fi of
   7.651 -		     [] => [](*28.8.01: ["tool"] ...// error 
   7.652 -			("prep_pbt: no '#Find' in "^(strs2str pblID))*)
   7.653 -(* val ((_,fi')::[]) = fi;
   7.654 -   *)
   7.655 -		   | ((_,fi')::[]) => 
   7.656 -		     ((map (split_did o Thm.term_of o the o (parse thy)) fi')
   7.657 -		     handle _ => error 
   7.658 -			("prep_pbt: syntax error in '#Find' of "^
   7.659 -			 (strs2str pblID)))
   7.660 -		   | _ =>
   7.661 -		     (error ("prep_pbt: more than one '#Find' in "^
   7.662 -				  (strs2str pblID))));
   7.663 -	val fi = map (pair "#Find") fi;
   7.664 -
   7.665 -	val re = filter (eq "#Relate") dsc_dats;
   7.666 -	val re = (case re of
   7.667 -		     [] => []
   7.668 -		   | ((_,re')::[]) => 
   7.669 -		     ((map (split_did o Thm.term_of o the o (parse thy)) re')
   7.670 -		     handle _ => error 
   7.671 -			("prep_pbt: syntax error in '#Relate' of "^
   7.672 -			 (strs2str pblID)))
   7.673 -		   | _ =>
   7.674 -		     (error ("prep_pbt: more than one '#Relate' in "^
   7.675 -				  (strs2str pblID))));
   7.676 -	val re = map (pair "#Relate") re;
   7.677 -
   7.678 -	val wh = filter (eq "#Where") dsc_dats;
   7.679 -	val wh = (case wh of
   7.680 -		     [] => []
   7.681 -		   | ((_,wh')::[]) => 
   7.682 -		     ((map (parse_patt thy) wh')
   7.683 -		      handle _ => error 
   7.684 -			("prep_pbt: syntax error in '#Where' of "^
   7.685 -			 (strs2str pblID)))
   7.686 -		   | _ =>
   7.687 -		     (error ("prep_pbt: more than one '#Where' in "^
   7.688 -				  (strs2str pblID))));
   7.689 -    in ({guh=guh,mathauthors=maa,init=init,
   7.690 -	 thy=thy,cas= case ca of NONE => NONE
   7.691 -			       | SOME s => 
   7.692 -				 SOME ((Thm.term_of o the o (parse thy)) s),
   7.693 -	 prls=ev,where_=wh,ppc= gi @ fi @ re,
   7.694 -	 met=metIDs}, pblID):pbt * pblID end;
   7.695 -(* prep_pbt thy (pblID, dsc_dats, metIDs);   
   7.696 - val it =
   7.697 -  ({met=[],
   7.698 -    ppc=[("#Given",(Const (#,#),Free (#,#))),
   7.699 -         ("#Given",(Const (#,#),Free (#,#))),
   7.700 -         ("#Find",(Const (#,#),Free (#,#)))],
   7.701 -    thy={ProtoPure, ..., Atools, RatArith},
   7.702 -    where_=[Const ("Descript.solutions","bool List.list => Tools.toreall") $
   7.703 -            Free ("v_i_","bool List.list")]},["equation"]) : pbt * pblID    *)
   7.704 -
   7.705 -
   7.706 -
   7.707 -
   7.708 -(*. prepare met for storage analogous to pbt .*)
   7.709 -fun prep_met thy guh maa init
   7.710 -	     (metID, ppc: (string * string list) list (*'#Where' -> #pre*),
   7.711 -    {rew_ord'=ro, rls'=rls, srls=srls, prls=prls, 
   7.712 -     calc = scr_isa_fns(*FIXME.040207: del - auto-done*),
   7.713 -     crls=cr, errpats = ep, nrls= nr}, scr) =
   7.714 -    let fun eq f (f', _) = f = f';
   7.715 -	(*val thy = (assoc_thy o fst) metID*)
   7.716 -	val gi = filter (eq "#Given") ppc;
   7.717 -	val gi = (case gi of
   7.718 -		     [] => (writeln ("prep_met: in " ^ guh ^ " #Given is empty ?!?"); [])
   7.719 -		   | ((_,gi')::[]) => 
   7.720 -		     ((map (split_did o Thm.term_of o the o (parse thy)) gi')
   7.721 -		     handle _ => error 
   7.722 -			("prep_pbt: syntax error in '#Given' of "^
   7.723 -			 (strs2str metID)))
   7.724 -		   | _ =>
   7.725 -		     (error ("prep_pbt: more than one '#Given' in "^
   7.726 -				  (strs2str metID))));
   7.727 -	val gi = map (pair "#Given") gi;
   7.728 -
   7.729 -	val fi = filter (eq "#Find") ppc;
   7.730 -	val fi = (case fi of
   7.731 -		     [] => (writeln ("prep_met: in " ^ guh ^ " #Find is empty ?!?"); [])
   7.732 -		   | ((_,fi')::[]) => 
   7.733 -		     ((map (split_did o Thm.term_of o the o (parse thy)) fi')
   7.734 -		     handle _ => error 
   7.735 -			("prep_pbt: syntax error in '#Find' of "^
   7.736 -			 (strs2str metID)))
   7.737 -		   | _ =>
   7.738 -		     (error ("prep_pbt: more than one '#Find' in "^
   7.739 -				  (strs2str metID))));
   7.740 -	val fi = map (pair "#Find") fi;
   7.741 -
   7.742 -	val re = filter (eq "#Relate") ppc;
   7.743 -	val re = (case re of
   7.744 -		     [] => (writeln ("prep_met: in " ^ guh ^ " #Relate is empty ?!?"); [])
   7.745 -		   | ((_,re')::[]) => 
   7.746 -		     ((map (split_did o Thm.term_of o the o (parse thy)) re')
   7.747 -		     handle _ => error 
   7.748 -			("prep_pbt: syntax error in '#Relate' of "^
   7.749 -			 (strs2str metID)))
   7.750 -		   | _ =>
   7.751 -		     (error ("prep_pbt: more than one '#Relate' in "^
   7.752 -				  (strs2str metID))));
   7.753 -	val re = map (pair "#Relate") re;
   7.754 -
   7.755 -	val wh = filter (eq "#Where") ppc;
   7.756 -	val wh = (case wh of
   7.757 -		     [] => (writeln ("prep_met: in " ^ guh ^ " #Where is empty ?!?"); [])
   7.758 -		   | ((_,wh')::[]) => 
   7.759 -		     ((map (parse_patt thy) wh')
   7.760 -		     handle _ => error 
   7.761 -			("prep_pbt: syntax error in '#Where' of "^
   7.762 -			 (strs2str metID)))
   7.763 -		   | _ =>
   7.764 -		     (error ("prep_pbt: more than one '#Where' in "^
   7.765 -				  (strs2str metID))));
   7.766 -	val sc = (((inst_abs thy) o Thm.term_of o the o (parse thy)) scr)
   7.767 -    in ({guh=guh,mathauthors=maa,init=init,
   7.768 -	 ppc=gi@fi@re, pre=wh, rew_ord'=ro, erls=rls, srls=srls, prls=prls,
   7.769 -	 calc = if scr = "empty_script" then []
   7.770 -		else ((assoc_calc' thy |> map) o (map op_of_calc) o 
   7.771 -		      (filter is_calc) o stacpbls) sc, 
   7.772 -	 crls=cr, errpats = ep, nrls= nr, scr = Prog sc}:met,
   7.773 -	metID:metID)
   7.774 +		  val wh = filter (eq "#Where") dsc_dats;
   7.775 +		  val wh = (case wh of
   7.776 +		    [] => []
   7.777 +		  | ((_, wh') :: []) => (map (parse_patt thy) wh'
   7.778 +		      handle _ => error ("prep_pbt: syntax error in '#Where' of " ^ strs2str pblID))
   7.779 +		  | _ => error ("prep_pbt: more than one '#Where' in " ^ strs2str pblID));
   7.780 +    in
   7.781 +      ({guh = guh, mathauthors = maa, init = init, thy = thy,
   7.782 +        cas= case ca of
   7.783 +          NONE => NONE
   7.784 +			  | SOME s => SOME ((Thm.term_of o the o (parse thy)) s),
   7.785 +			  prls = ev, where_ = wh, ppc = gi @ fi @ re, met = metIDs}, pblID): pbt * pblID
   7.786      end;
   7.787  
   7.788 +(* prepare met for storage analogous to pbt *)
   7.789 +fun prep_met thy guh maa init
   7.790 +	    (metID, ppc: (string * string list) list,
   7.791 +        {rew_ord' = ro, rls' = rls, srls = srls, prls = prls, calc = scr_isa_fns, crls = cr,
   7.792 +          errpats = ep, nrls = nr}, scr) =
   7.793 +    let
   7.794 +      fun eq f (f', _) = f = f';
   7.795 +      val gi = filter (eq "#Given") ppc;
   7.796 +      val gi = (case gi of
   7.797 +		    [] => (writeln ("prep_met: in " ^ guh ^ " #Given is empty ?!?"); [])
   7.798 +		  | ((_, gi') :: []) => (map (split_did o Thm.term_of o the o (parse thy)) gi'
   7.799 +		      handle _ => error ("prep_pbt: syntax error in '#Given' of " ^ strs2str metID))
   7.800 +		  | _ => error ("prep_pbt: more than one '#Given' in " ^ strs2str metID));
   7.801 +		  val gi = map (pair "#Given") gi;
   7.802  
   7.803 -(**. get pblIDs of all entries in mat3D .**)
   7.804 +		  val fi = filter (eq "#Find") ppc;
   7.805 +		  val fi = (case fi of
   7.806 +		    [] => (writeln ("prep_met: in " ^ guh ^ " #Find is empty ?!?"); [])
   7.807 +		  | ((_, fi') :: []) =>  (map (split_did o Thm.term_of o the o (parse thy)) fi'
   7.808 +		      handle _ => error ("prep_pbt: syntax error in '#Find' of " ^ strs2str metID))
   7.809 +		  | _ => error ("prep_pbt: more than one '#Find' in " ^ strs2str metID));
   7.810 +		  val fi = map (pair "#Find") fi;
   7.811  
   7.812 +		  val re = filter (eq "#Relate") ppc;
   7.813 +		  val re = (case re of
   7.814 +		    [] => (writeln ("prep_met: in " ^ guh ^ " #Relate is empty ?!?"); [])
   7.815 +		  | ((_,re') :: []) => (map (split_did o Thm.term_of o the o (parse thy)) re'
   7.816 +		      handle _ => error ("prep_pbt: syntax error in '#Relate' of " ^ strs2str metID))
   7.817 +		  | _ => error ("prep_pbt: more than one '#Relate' in " ^ strs2str metID));
   7.818 +		  val re = map (pair "#Relate") re;
   7.819 +
   7.820 +		  val wh = filter (eq "#Where") ppc;
   7.821 +		  val wh = (case wh of
   7.822 +		    [] => (writeln ("prep_met: in " ^ guh ^ " #Where is empty ?!?"); [])
   7.823 +		  | ((_, wh') :: []) => (map (parse_patt thy) wh'
   7.824 +		      handle _ => error ("prep_pbt: syntax error in '#Where' of " ^ strs2str metID))
   7.825 +		  | _ => error ("prep_pbt: more than one '#Where' in " ^ strs2str metID));
   7.826 +		  val sc = (((inst_abs thy) o Thm.term_of o the o (parse thy)) scr)
   7.827 +    in
   7.828 +      ({guh = guh, mathauthors = maa, init = init, ppc = gi @ fi @ re, pre = wh, rew_ord' = ro,
   7.829 +         erls = rls, srls = srls, prls = prls,
   7.830 +         calc =
   7.831 +           if scr = "empty_script"
   7.832 +           then []
   7.833 +           else ((assoc_calc' thy |> map) o (map op_of_calc) o (filter is_calc) o stacpbls) sc, 
   7.834 +         crls = cr, errpats = ep, nrls = nr, scr = Prog sc}: met, metID: metID)
   7.835 +    end;
   7.836 +
   7.837 +
   7.838 +(** get pblIDs of all entries in mat3D **)
   7.839  
   7.840  fun format_pblID strl = enclose " [" "]" (commas_quote strl);
   7.841 -fun format_pblIDl strll = enclose "[\n" "\n]\n" 
   7.842 -    (space_implode ",\n" (map format_pblID strll));
   7.843 +fun format_pblIDl strll = enclose "[\n" "\n]\n" (space_implode ",\n" (map format_pblID strll));
   7.844  
   7.845  fun scan _  [] = [] (* no base case, for empty doms only *)
   7.846 -  | scan id ((Ptyp ((i,_,[])))::[]) =      [id@[i]]
   7.847 -  | scan id ((Ptyp ((i,_,pl)))::[]) = scan (id@[i]) pl
   7.848 -  | scan id ((Ptyp ((i,_,[])))::ps) =      [id@[i]]    @(scan id ps)
   7.849 -  | scan id ((Ptyp ((i,_,pl)))::ps) =(scan (id@[i]) pl)@(scan id ps);
   7.850 +  | scan id ((Ptyp ((i, _, []))) :: []) = [id @ [i]]
   7.851 +  | scan id ((Ptyp ((i, _, pl))) :: []) = scan (id @ [i]) pl
   7.852 +  | scan id ((Ptyp ((i, _, []))) :: ps) = [id @ [i]] @ (scan id ps)
   7.853 +  | scan id ((Ptyp ((i, _, pl))) :: ps) = (scan (id @ [i]) pl) @ (scan id ps);
   7.854  
   7.855  fun show_ptyps () = (writeln o format_pblIDl o (scan [])) (get_ptyps ());
   7.856 -(* ptyps:=[];
   7.857 -   show_ptyps();
   7.858 -   *)
   7.859  fun show_mets () = (writeln o format_pblIDl o (scan [])) (get_mets ());
   7.860  
   7.861  
   7.862 +(** instantiate a problem-type **)
   7.863  
   7.864 -(*vvvvv---------- preparational work 8.01. UNUSED *)
   7.865 -(**+ instantiate a problem-type +**)
   7.866 +(* transform oris *)
   7.867  
   7.868 -(*+ transform oris +*)
   7.869 +fun coll_vats (vats, ((_, vs, _, _, _): ori)) = union op = vats vs;
   7.870 +fun filter_vat oris i = filter ((member_swap op = i) o (#2 : ori -> int list)) oris;
   7.871 +fun separate_vats oris =
   7.872 +  let
   7.873 +    val vats = foldl coll_vats ([] : int list, oris);
   7.874 +  in
   7.875 +    map (filter_vat oris) vats
   7.876 +  end;
   7.877  
   7.878 -fun coll_vats (vats, ((_,vs,_,_,_):ori)) = union op = vats vs;
   7.879 -(*> coll_vats [11,22] (hd oris);
   7.880 -val it = [22,11,1,2,3] : int list
   7.881 +(** check a problem (ie. itm list) for matching a problemtype **)
   7.882  
   7.883 -> foldl coll_vats ([],oris);
   7.884 -val it = [1,2,3] : int list
   7.885 +fun eq1 d (_, (d', _)) = (d = d');
   7.886 +fun itm_id ((i, _, _, _, _): itm) = i;
   7.887 +fun ori_id ((i, _, _, _, _): ori) = i;
   7.888 +fun ori2itmSup ((i, v, _, d, ts): ori) = ((i, v, true, "#Given", Sup (d, ts)): itm);
   7.889 +(*see + add_sel_ppc                                    ~~~~~~~*)
   7.890  
   7.891 -> val i=1;
   7.892 -> filter ((curry (op mem) i) o #2) oris;
   7.893 -val it =
   7.894 -  [(1,[1,2,3],"#Given",Const (#,#),[# $ #]),
   7.895 -   (2,[1,2,3],"#Find",Const (#,#),[Free #]),
   7.896 -   (3,[1,2,3],"#Find",Const (#,#),[# $ #,# $ #]),
   7.897 -   (4,[1,2],"#Relate",Const (#,#),[# $ #,# $ #]),
   7.898 -   (6,[1],"#undef",Const (#,#),[Free #]),
   7.899 -   (9,[1,2],"#undef",Const (#,#),[# $ #]),
   7.900 -   (11,[1,2,3],"#undef",Const (#,#),[# $ #])] : ori list *)    
   7.901 +fun field_eq f ((_, _, f', _, _): ori) = f = f';
   7.902  
   7.903 -local infix mem; (*from Isabelle2002*)
   7.904 -fun x mem [] = false
   7.905 -  | x mem (y :: ys) = x = y orelse x mem ys;
   7.906 -in
   7.907 -fun filter_vat oris i = 
   7.908 -    filter ((curry (op mem) i) o (#2 : ori -> int list)) oris;
   7.909 -end;
   7.910 -(*> map (filter_vat oris) [1,2,3];
   7.911 -val it =
   7.912 -  [[(1,[1,2,3],"#Given",Const (#,#),[# $ #]),
   7.913 -    (2,[1,2,3],"#Find",Const (#,#),[Free #]),
   7.914 -    (3,[1,2,3],"#Find",Const (#,#),[# $ #,# $ #]),
   7.915 -    (4,[1,2],"#Relate",Const (#,#),[# $ #,# $ #]),
   7.916 -    (6,[1],"#undef",Const (#,#),[Free #]),
   7.917 -    (9,[1,2],"#undef",Const (#,#),[# $ #]),
   7.918 -    (11,[1,2,3],"#undef",Const (#,#),[# $ #])],
   7.919 -   [(1,[1,2,3],"#Given",Const (#,#),[# $ #]),
   7.920 -    (2,[1,2,3],"#Find",Const (#,#),[Free #]),
   7.921 -    (3,[1,2,3],"#Find",Const (#,#),[# $ #,# $ #]),
   7.922 -    (4,[1,2],"#Relate",Const (#,#),[# $ #,# $ #]),
   7.923 -    (7,[2],"#undef",Const (#,#),[Free #]),
   7.924 -    (9,[1,2],"#undef",Const (#,#),[# $ #]),
   7.925 -    (11,[1,2,3],"#undef",Const (#,#),[# $ #])],
   7.926 -   [(1,[1,2,3],"#Given",Const (#,#),[# $ #]),
   7.927 -    (2,[1,2,3],"#Find",Const (#,#),[Free #]),
   7.928 -    (3,[1,2,3],"#Find",Const (#,#),[# $ #,# $ #]),
   7.929 -    (5,[3],"#Relate",Const (#,#),[# $ #,# $ #,# $ #]),
   7.930 -    (8,[3],"#undef",Const (#,#),[Free #]),
   7.931 -    (10,[3],"#undef",Const (#,#),[# $ #]),
   7.932 -    (11,[1,2,3],"#undef",Const (#,#),[# $ #])]] : ori list list*)
   7.933 +(* check an item (with arbitrary itm_ from previous matchings) 
   7.934 +   for matching a problemtype; returns true only for itms found in pbt *)
   7.935 +fun chk_ (_: theory) pbt ((i, vats, b, f, Cor ((d, vs), _)): itm) =
   7.936 +    (case find_first (eq1 d) pbt of 
   7.937 +      SOME (_, (_, id)) => ((i, vats, b, f, Cor ((d, vs), (id, pbl_ids' d vs))): itm)
   7.938 +    | NONE =>  (i, vats, false, f, Sup (d, vs)))
   7.939 +  | chk_ _ pbt (i, vats, b, f, Inc ((d, vs), _)) =
   7.940 +    (case find_first (eq1 d) pbt of 
   7.941 +      SOME (_, (_, id)) => (i, vats, b, f, Cor ((d, vs), (id, pbl_ids' d vs)))
   7.942 +    | NONE => (i, vats, false, f, Sup (d, vs)))
   7.943 +  | chk_ _ _ (itm as (_, _, _, _, Syn _)) = itm
   7.944 +  | chk_ _ _ (itm as (_, _, _, _, Typ _)) = itm
   7.945 +  | chk_ _ pbt (i, vats, b, f, Sup (d, vs)) =
   7.946 +    (case find_first (eq1 d) pbt of 
   7.947 +      SOME (_, (_, id)) => (i, vats, b, f, Cor ((d,vs), (id, pbl_ids' d vs)))
   7.948 +    | NONE => (i, vats, false, f, Sup (d, vs)))
   7.949 +  | chk_ _ pbt (i, vats, _, f, Mis (d, vs)) =
   7.950 +    (case find_first (eq1 d) pbt of
   7.951 +      SOME (_, _) => error "chk_: ((i,vats,b,f,Cor ((d,vs),(id, pbl_ids' d vs))):itm)"
   7.952 +    | NONE => (i, vats, false, f, Sup (d, [vs])))
   7.953 +  | chk_ _ _ _ = error "chk_: uncovered fun def.";
   7.954  
   7.955 -fun separate_vats oris =
   7.956 -    let val vats = foldl coll_vats ([] : int list, oris);
   7.957 -    in map (filter_vat oris) vats end;
   7.958 -(*^^^ end preparational work 8.01.*)
   7.959 -
   7.960 -
   7.961 -
   7.962 -(**. check a problem (ie. itm list) for matching a problemtype .**)
   7.963 -
   7.964 -fun eq1 d (_,(d',_)) = (d = d');
   7.965 -fun itm_id ((i,_,_,_,_):itm) = i;
   7.966 -fun ori_id ((i,_,_,_,_):ori) = i;
   7.967 -fun ori2itmSup ((i,v,_,d,ts):ori) = ((i,v,true,"#Given",Sup(d,ts)):itm);
   7.968 -(*see + add_sel_ppc                             ~~~~~~~*)
   7.969 -fun field_eq f ((_,_,f',_,_):ori) = f = f';
   7.970 -
   7.971 -(*. check an item (with arbitrary itm_ from previous matchings) 
   7.972 -    for matching a problemtype; returns true only for itms found in pbt .*)
   7.973 -fun chk_ thy pbt ((i,vats,b,f,Cor ((d,vs),_)):itm) =
   7.974 -    (case find_first (eq1 d) pbt of 
   7.975 -	 SOME (_,(_,id)) => ((i,vats,b,f,Cor ((d,vs),
   7.976 -					      (id, pbl_ids' d vs))):itm)
   7.977 -       | NONE => (i,vats,false,f,Sup (d,vs)))
   7.978 -  | chk_ thy pbt ((i,vats,b,f,Inc ((d,vs),_)):itm) =
   7.979 -    (case find_first (eq1 d) pbt of 
   7.980 -	SOME (_,(_,id)) => ((i,vats,b,f,Cor ((d,vs),
   7.981 -					     (id, pbl_ids' d vs))):itm)
   7.982 -      | NONE => (i,vats,false,f,Sup (d,vs)))
   7.983 -
   7.984 -  | chk_ thy pbt (itm as (i,vats,b,f,Syn ct):itm) = itm
   7.985 -  | chk_ thy pbt (itm as (i,vats,b,f,Typ ct):itm) = itm
   7.986 -
   7.987 -  | chk_ thy pbt ((i,vats,b,f,Sup (d,vs)):itm) =
   7.988 -    (case find_first (eq1 d) pbt of 
   7.989 -	SOME (_,(_,id)) => ((i,vats,b,f,Cor ((d,vs),
   7.990 -					     (id, pbl_ids' d vs))):itm)
   7.991 -      | NONE => (i,vats,false,f,Sup (d,vs)))
   7.992 -(* val (i,vats,b,f,Mis (d,vs)) = i4;
   7.993 -   *)
   7.994 -  | chk_ thy pbt ((i,vats,b,f,Mis (d,vs)):itm) =
   7.995 -    (case find_first (eq1 d) pbt of
   7.996 -(* val SOME (_,(_,id)) = find_first (eq1 d) pbt;
   7.997 -   *) 
   7.998 -	SOME (_,(_,id)) => error "chk_: ((i,vats,b,f,Cor ((d,vs),\
   7.999 -				   \(id, pbl_ids' d vs))):itm)"
  7.1000 -      | NONE => (i,vats,false,f,Sup (d,[vs])));
  7.1001 -
  7.1002 -(* chk_ thy pbt i
  7.1003 -    *)
  7.1004 -
  7.1005 -fun eq2 (_,(d,_)) ((_,_,_,_,itm_):itm) = d = d_in itm_;
  7.1006 -fun eq2' (_,(d,_)) ((_,_,_,d',_):ori) = d = d';
  7.1007 -fun eq0 ((0,_,_,_,_):itm) = true
  7.1008 +fun eq2 (_, (d, _)) ((_, _, _, _, itm_): itm) = d = d_in itm_;
  7.1009 +fun eq2' (_, (d, _)) ((_, _, _, d', _): ori) = d = d';
  7.1010 +fun eq0 ((0, _, _, _, _): itm) = true
  7.1011    | eq0 _ = false;
  7.1012  fun max_i i [] = i
  7.1013 -  | max_i i ((id,_,_,_,_)::is) = 
  7.1014 -    if i > id then max_i i is else max_i id is;
  7.1015 -fun max_id [] = 0
  7.1016 -  | max_id ((id,_,_,_,_)::is) = max_i id is;
  7.1017 -fun add_idvat itms _ _ [] = itms
  7.1018 -  | add_idvat itms i mvat (((_,_,b,f,itm_):itm)::its) =
  7.1019 -    add_idvat (itms @ [(i,[(*mvat ...meaningless with pbl-identifier *)
  7.1020 -			     ],b,f,itm_):itm]) (i+1) mvat its;
  7.1021 +  | max_i i ((id, _, _, _, _) :: is) = if i > id then max_i i is else max_i id is;
  7.1022 +fun max_id ([]: itm list) = 0
  7.1023 +  | max_id ((id, _, _, _, _) :: is) = max_i id is;
  7.1024 +fun add_idvat itms _ _ ([]: itm list) = itms
  7.1025 +  | add_idvat itms i mvat (((_, _, b, f, itm_): itm) :: its) =
  7.1026 +    add_idvat (itms @ [(i,[],b,f,itm_):itm]) (i + 1) mvat its;
  7.1027 +                       (* ^^ mvat ...meaningless with pbl-identifier *)
  7.1028  
  7.1029 +(* find elements of pbt not contained in itms;
  7.1030 +   if such one is untouched, return this one, otherwise create new itm *)
  7.1031 +fun chk_m (itms: itm list) untouched (p as (f, (d, id))) = 
  7.1032 +  case find_first (eq2 p) itms of
  7.1033 +	  SOME _ => []
  7.1034 +  | NONE =>
  7.1035 +      (case find_first (eq2 p) untouched of
  7.1036 +        SOME itm => [itm]
  7.1037 +      | NONE => [(0, [], false, f, Mis (d, id)): itm]);
  7.1038  
  7.1039 -(*. find elements of pbt not contained in itms;
  7.1040 -    if such one is untouched, return this one, otherwise create new itm .*)
  7.1041 -fun chk_m (itms:itm list) untouched (p as (f,(d,id))) = 
  7.1042 -    case find_first (eq2 p) itms of
  7.1043 -	SOME _ => []
  7.1044 -      | NONE => (case find_first (eq2 p) untouched of
  7.1045 -		     SOME itm => [itm]
  7.1046 -		   | NONE => [(0,[],false,f,Mis (d,id)):itm]);
  7.1047 -(* val itms = itms'';
  7.1048 -   *) 
  7.1049  fun chk_mis mvat itms untouched pbt = 
  7.1050      let val mis = (flat o (map (chk_m itms untouched))) pbt; 
  7.1051          val mid = max_id itms;
  7.1052      in add_idvat [] (mid + 1) mvat mis end;
  7.1053  
  7.1054 -(*. check a problem (ie. itm list) for matching a problemtype, 
  7.1055 -    takes the max_vt for concluding completeness (could be another!) .*)
  7.1056 -(* val itms = itms'; val (pbt,pre) = (ppc, pre);
  7.1057 -   val itms = itms; val (pbt,pre) = (ppc, pre);
  7.1058 -   *)
  7.1059 -fun match_itms thy itms (pbt,pre,prls) = 
  7.1060 -    (let fun okv mvat (_,vats,b,_,_) = member op = vats mvat
  7.1061 -				       andalso b;
  7.1062 -	val itms' = map (chk_ thy pbt) itms; (*all found are #3 true*)
  7.1063 -        val mvat = max_vt itms';
  7.1064 -	val itms'' = filter (okv mvat) itms';
  7.1065 -	val untouched = filter eq0 itms;(*i.e. dsc only (from init)*)
  7.1066 -	val mis = chk_mis mvat itms'' untouched pbt;
  7.1067 -	val pre' = check_preconds' prls pre itms'' mvat
  7.1068 -	val pb = foldl and_ (true, map fst pre')
  7.1069 -    in (length mis = 0 andalso pb, (itms'@ mis, pre')) end);
  7.1070 +(* check a problem (ie. itm list) for matching a problemtype, 
  7.1071 +   takes the max_vt for concluding completeness (could be another!) *)
  7.1072 +fun match_itms thy itms (pbt, pre, prls) = 
  7.1073 +  let
  7.1074 +    fun okv mvat (_, vats, b, _, _) = member op = vats mvat andalso b;
  7.1075 +    val itms' = map (chk_ thy pbt) itms; (* all found are #3 true *)
  7.1076 +    val mvat = max_vt itms';
  7.1077 +	  val itms'' = filter (okv mvat) itms';
  7.1078 +	  val untouched = filter eq0 itms; (* i.e. dsc only (from init)*)
  7.1079 +	  val mis = chk_mis mvat itms'' untouched pbt;
  7.1080 +	  val pre' = check_preconds' prls pre itms'' mvat
  7.1081 +	  val pb = foldl and_ (true, map fst pre')
  7.1082 +  in (length mis = 0 andalso pb, (itms'@ mis, pre')) end;
  7.1083  
  7.1084 -(*. check a problem pbl (ie. itm list) for matching a problemtype pbt,
  7.1085 -    for missing items get data from formalization (ie. ori list); 
  7.1086 -    takes the max_vt for concluding completeness (could be another!) .*)
  7.1087 -(*  (0) determine the most frequent variant mv in pbl
  7.1088 -    ALL pbt. (1) dsc(pbt) notmem dsc(pbls) =>
  7.1089 -             (2) filter (dsc(pbt) = dsc(oris)) oris; -> news;
  7.1090 -             (3) newitms = filter (mv mem vat(news)) news 
  7.1091 -    (4) pbt @ newitms                                           *)
  7.1092 -(* val (pbl, pbt, pre) = (met, mtt, pre);
  7.1093 -   val (pbl, pbt, pre) = (itms, #ppc pbt, #where_ pbt);
  7.1094 -   val (pbl, pbt, pre) = (itms, ppc, where_);
  7.1095 -   *)
  7.1096 -fun match_itms_oris thy (pbl:itm list) (pbt, pre, prls) oris =
  7.1097 +(* check a problem pbl (ie. itm list) for matching a problemtype pbt,
  7.1098 +   for missing items get data from formalization (ie. ori list); 
  7.1099 +   takes the max_vt for concluding completeness (could be another!)
  7.1100 + 
  7.1101 +  (0) determine the most frequent variant mv in pbl
  7.1102 +   ALL pbt. (1) dsc(pbt) notmem dsc(pbls) =>
  7.1103 +            (2) filter (dsc(pbt) = dsc(oris)) oris; -> news;
  7.1104 +            (3) newitms = filter (mv mem vat(news)) news 
  7.1105 +   (4) pbt @ newitms                                           *)
  7.1106 +fun match_itms_oris (_: theory) (pbl: itm list) (pbt, pre, prls) oris =
  7.1107    let 
  7.1108   (*0*)val mv = max_vt pbl;
  7.1109  
  7.1110 -      fun eqdsc_pbt_itm ((_,(d,_))) ((_,_,_,_,itm_):itm) = d = d_in itm_;
  7.1111 +      fun eqdsc_pbt_itm ((_,(d,_))) ((_, _, _, _, itm_): itm) = d = d_in itm_;
  7.1112        fun notmem pbl pbt1 = case find_first (eqdsc_pbt_itm pbt1) pbl of
  7.1113  				SOME _ => false | NONE => true;
  7.1114 - (*1*)val mis = (*(map (cons2 (fst, fst o snd)))o*) (filter (notmem pbl)) pbt;
  7.1115 + (*1*)val mis = (filter (notmem pbl)) pbt;
  7.1116  
  7.1117 -      fun eqdsc_ori (_,(d,_)) ((_,_,_,d',_):ori) = d = d';
  7.1118 -      fun ori2itmMis (f,(d,pid)) ((i,v,_,_,ts):ori) = 
  7.1119 -	  (i,v,false,f,Mis (d,pid)):itm;
  7.1120 - (*2*)fun oris2itms oris mis1 = 
  7.1121 -	  ((map (ori2itmMis mis1)) o (filter (eqdsc_ori mis1))) oris;
  7.1122 +      fun eqdsc_ori (_,(d,_)) ((_, _, _, d', _): ori) = d = d';
  7.1123 +      fun ori2itmMis (f, (d, pid)) ((i, v, _, _, _): ori) = (i, v, false, f, Mis (d, pid)): itm;
  7.1124 + (*2*)fun oris2itms oris mis1 = ((map (ori2itmMis mis1)) o (filter (eqdsc_ori mis1))) oris;
  7.1125        val news = (flat o (map (oris2itms oris))) mis;
  7.1126 - (*3*)fun mem_vat (_,vats,b,_,_) = member op = vats mv;
  7.1127 + (*3*)fun mem_vat (_, vats, _, _, _) = member op = vats mv;
  7.1128        val newitms = filter mem_vat news;
  7.1129   (*4*)val itms' = pbl @ newitms;
  7.1130 -      val pre' = check_preconds' prls pre itms' mv
  7.1131 -      val pb = foldl and_ (true, map fst pre')
  7.1132 +      val pre' = check_preconds' prls pre itms' mv;
  7.1133 +      val pb = foldl and_ (true, map fst pre');
  7.1134    in (length mis = 0 andalso pb, (itms', pre')) end;
  7.1135 -    (*handle _ => (false,([],[]))*);
  7.1136  
  7.1137  
  7.1138 -(*vvv--- doubled 20.9.01: ... 7.3.02 itms  -->  oris, because oris
  7.1139 -  allow for faster access to descriptions and terms *)
  7.1140 -(**. check a problem (ie. itm list) for matching a problemtype .**)
  7.1141 +(** check a problem (ie. itm list) for matching a problemtype **)
  7.1142  
  7.1143 -(*. check an ori for matching a problemtype by description; 
  7.1144 -    returns true only for itms found in pbt .*)
  7.1145 -fun chk1_ thy pbt ((i,vats,f,d,vs):ori) =
  7.1146 -    case find_first (eq1 d) pbt of 
  7.1147 -	SOME (_,(_,id)) => [(i,vats,true,f,
  7.1148 -			     Cor ((d,vs), (id, pbl_ids' d vs))):itm]
  7.1149 -      | NONE => [];
  7.1150 +(* check an ori for matching a problemtype by description; 
  7.1151 +   returns true only for itms found in pbt              *)
  7.1152 +fun chk1_ (_: theory) pbt ((i, vats, f, d, vs): ori) =
  7.1153 +  case find_first (eq1 d) pbt of 
  7.1154 +	  SOME (_, (_, id)) => [(i, vats, true, f, Cor ((d, vs), (id, pbl_ids' d vs))): itm]
  7.1155 +  | NONE => [];
  7.1156  
  7.1157  (* elem 'p' of pbt contained in itms ? *)
  7.1158 -fun chk1_m (itms:itm list) p = 
  7.1159 -    case find_first (eq2 p) itms of
  7.1160 -	SOME _ => true | NONE => false;
  7.1161 -fun chk1_m' (oris: ori list) (p as (f,(d,t))) = 
  7.1162 -    case find_first (eq2' p) oris of
  7.1163 -	SOME _ => []
  7.1164 -      | NONE => [(f, Mis (d, t))];
  7.1165 -fun pair0vatsfalse (f,itm_) = (0,[],false,f,itm_):itm;
  7.1166 +fun chk1_m (itms:itm list) p = case find_first (eq2 p) itms of SOME _ => true | NONE => false;
  7.1167 +fun chk1_m' (oris: ori list) (p as (f, (d, t))) = 
  7.1168 +  case find_first (eq2' p) oris of
  7.1169 +	  SOME _ => []
  7.1170 +  | NONE => [(f, Mis (d, t))];
  7.1171 +fun pair0vatsfalse (f, itm_) = (0, [], false, f, itm_): itm;
  7.1172  
  7.1173 -fun chk1_mis mvat itms ppc = foldl and_ (true, map (chk1_m itms) ppc);
  7.1174 -fun chk1_mis' oris ppc = 
  7.1175 -    map pair0vatsfalse ((flat o (map (chk1_m' oris))) ppc);
  7.1176 +fun chk1_mis _(*mvat*) itms ppc = foldl and_ (true, map (chk1_m itms) ppc);
  7.1177 +fun chk1_mis' oris ppc = map pair0vatsfalse ((flat o (map (chk1_m' oris))) ppc);
  7.1178 +  
  7.1179 +(* check a problem (ie. ori list) for matching a problemtype, 
  7.1180 +   takes the max_vt for concluding completeness (FIXME could be another!) *)
  7.1181 +fun match_oris thy prls oris (pbt,pre) = 
  7.1182 +  let
  7.1183 +    val itms = (flat o (map (chk1_ thy pbt))) oris;
  7.1184 +    val mvat = max_vt itms;
  7.1185 +    val complete = chk1_mis mvat itms pbt;
  7.1186 +    val pre' = check_preconds' prls pre itms mvat;
  7.1187 +    val pb = foldl and_ (true, map fst pre');
  7.1188 +  in if complete andalso pb then true else false end;
  7.1189  
  7.1190 -  
  7.1191 -(*. check a problem (ie. ori list) for matching a problemtype, 
  7.1192 -    takes the max_vt for concluding completeness (FIXME could be another!) .*)
  7.1193 -(* val (prls,oris,pbt,pre)=(#prls py, ori, #ppc py, #where_ py);
  7.1194 -   *)
  7.1195 -fun match_oris thy prls oris (pbt,pre) = 
  7.1196 -    let val itms = (flat o (map (chk1_ thy pbt))) oris;
  7.1197 -        val mvat = max_vt itms;
  7.1198 -	val complete = chk1_mis mvat itms pbt;
  7.1199 -	val pre' = check_preconds' prls pre itms mvat
  7.1200 -	val pb = foldl and_ (true, map fst pre')
  7.1201 -    in if complete andalso pb then true else false end;
  7.1202 +(* check a problem (ie. ori list) for matching a problemtype, 
  7.1203 +   returns items for output to math-experts *)
  7.1204 +fun match_oris' thy oris (ppc,pre,prls) =
  7.1205 +  let
  7.1206 +    val itms = (flat o (map (chk1_ thy ppc))) oris;
  7.1207 +    val sups = ((map ori2itmSup) o (filter (field_eq "#undef"))) oris;
  7.1208 +    val mvat = max_vt itms;
  7.1209 +    val miss = chk1_mis' oris ppc;
  7.1210 +    val pre' = check_preconds' prls pre itms mvat;
  7.1211 +    val pb = foldl and_ (true, map fst pre');
  7.1212 +  in (miss = [] andalso pb, (itms @ miss @ sups, pre')) end;
  7.1213  
  7.1214 -(*. check a problem (ie. ori list) for matching a problemtype, 
  7.1215 -    returns items for output to math-experts .*)
  7.1216 -fun match_oris' thy oris (ppc,pre,prls) =
  7.1217 -(* val (thy, oris, (ppc,pre,prls)) = (thy, oris, (ppc, where_, prls));
  7.1218 -   *)
  7.1219 -    let val itms = (flat o (map (chk1_ thy ppc))) oris;
  7.1220 -	val sups = ((map ori2itmSup) o (filter(field_eq "#undef")))oris;
  7.1221 -        val mvat = max_vt itms;
  7.1222 -	val miss = chk1_mis' oris ppc;
  7.1223 -	val pre' = check_preconds' prls pre itms mvat
  7.1224 -	val pb = foldl and_ (true, map fst pre')
  7.1225 -    in (miss = [] andalso pb, (itms @ miss @ sups, pre')) end;
  7.1226 -
  7.1227 -(* for the user *)
  7.1228 -datatype match' = 
  7.1229 +datatype match' = (* for the user *)
  7.1230    Matches' of item ppc
  7.1231  | NoMatch' of item ppc;
  7.1232  
  7.1233  (* match a formalization with a problem type *)
  7.1234 -fun match_pbl (fmz:fmz_) ({thy=thy,where_=pre,ppc,prls=er,...}:pbt) =
  7.1235 -    let val oris = prep_ori fmz thy ppc |> #1;
  7.1236 -	val (bool, (itms, pre')) = match_oris' thy oris (ppc,pre,er);
  7.1237 -    in if bool then Matches' (itms2itemppc thy itms pre')
  7.1238 -       else NoMatch' (itms2itemppc thy itms pre') end;
  7.1239 -(* 
  7.1240 -val fmz = ["equality (sqrt(9+4*x)=sqrt x + sqrt(5+x))",
  7.1241 -	      "solveFor x","errorBound (eps=0)","solutions L"];
  7.1242 -val pbt as {thy = thy, where_ = pre, ppc = ppc,...} =
  7.1243 -    get_pbt ["univariate","equation"];
  7.1244 -match_pbl fmz pbt;
  7.1245 -*)
  7.1246 +fun match_pbl (fmz: fmz_) ({thy = thy, where_ = pre, ppc, prls = er, ...}: pbt) =
  7.1247 +  let
  7.1248 +    val oris = prep_ori fmz thy ppc |> #1;
  7.1249 +    val (bool, (itms, pre')) = match_oris' thy oris (ppc, pre, er);
  7.1250 +  in
  7.1251 +    if bool
  7.1252 +    then Matches' (itms2itemppc thy itms pre')
  7.1253 +    else NoMatch' (itms2itemppc thy itms pre')
  7.1254 +  end;
  7.1255  
  7.1256 -
  7.1257 -(*. refine a problem; construct pblRD while scanning .*)
  7.1258 -(* val (pblRD,ori)=("xxx",oris);
  7.1259 - val py = get_pbt ["equation"];
  7.1260 - val py = get_pbt ["univariate","equation"];
  7.1261 - val py = get_pbt ["linear","univariate","equation"];
  7.1262 - val py = get_pbt ["root'","univariate","equation"];
  7.1263 - match_oris (#prls py) ori (#ppc py, #where_ py);
  7.1264 -
  7.1265 -  *)
  7.1266 -fun refin (pblRD:pblRD) ori 
  7.1267 -((Ptyp (pI,[py],[])):pbt ptyp) =
  7.1268 +(* refine a problem; construct pblRD while scanning *)
  7.1269 +fun refin (pblRD: pblRD) ori ((Ptyp (pI, [py], [])): pbt ptyp) =
  7.1270      if match_oris (#thy py) (#prls py) ori (#ppc py, #where_ py) 
  7.1271 -    then SOME ((pblRD @ [pI]):pblRD)
  7.1272 +    then SOME ((pblRD @ [pI]): pblRD)
  7.1273      else NONE
  7.1274 -  | refin pblRD ori (Ptyp (pI,[py],pys)) =
  7.1275 +  | refin pblRD ori (Ptyp (pI, [py], pys)) =
  7.1276      if match_oris (#thy py) (#prls py) ori (#ppc py, #where_ py) 
  7.1277      then (case refins (pblRD @ [pI]) ori pys of
  7.1278  	      SOME pblRD' => SOME pblRD'
  7.1279  	    | NONE => SOME (pblRD @ [pI]))
  7.1280      else NONE
  7.1281 -and refins pblRD ori [] = NONE
  7.1282 -  | refins pblRD ori ((p as Ptyp (pI,_,_))::pts) =
  7.1283 +  | refin _ _ _ = error "refin: uncovered fun def."
  7.1284 +and refins _ _ [] = NONE
  7.1285 +  | refins pblRD ori ((p as Ptyp _) :: pts) =
  7.1286      (case refin pblRD ori p of
  7.1287 -	 SOME pblRD' => SOME pblRD'
  7.1288 -       | NONE => refins pblRD ori pts);
  7.1289 +      SOME pblRD' => SOME pblRD'
  7.1290 +    | NONE => refins pblRD ori pts);
  7.1291  
  7.1292 -(*. refine a problem; version providing output for math-experts .*)
  7.1293 -fun refin' (pblRD: pblRD) fmz pbls ((Ptyp (pI, [py], [])):pbt ptyp) =
  7.1294 +(* refine a problem; version providing output for math-experts *)
  7.1295 +fun refin' (pblRD: pblRD) fmz pbls ((Ptyp (pI, [py], [])): pbt ptyp) =
  7.1296      let
  7.1297 -      val _ = (tracing o ((curry op ^)"*** pass ") o strs2str) (pblRD @ [pI])
  7.1298 +      val _ = (tracing o ((curry op ^) "*** pass ") o strs2str) (pblRD @ [pI])
  7.1299        val {thy, ppc, where_, prls, ...} = py 
  7.1300        val oris = prep_ori fmz thy ppc |> #1;
  7.1301 -      (*8.3.02: itms!: oris ev. are _not_ complete here*)
  7.1302 +      (* WN020803: itms!: oris might _not_ be complete here *)
  7.1303        val (b, (itms, pre')) = match_oris' thy oris (ppc, where_, prls)
  7.1304 -    in if b
  7.1305 +    in
  7.1306 +      if b
  7.1307        then pbls @ [Matches (rev (pblRD @ [pI]), itms2itemppc thy itms pre')]
  7.1308        else pbls @ [NoMatch (rev (pblRD @ [pI]), itms2itemppc thy itms pre')]
  7.1309      end
  7.1310 -
  7.1311    | refin' pblRD fmz pbls (Ptyp (pI, [py], pys)) =
  7.1312      let
  7.1313        val _ = (tracing o ((curry op ^)"*** pass ") o strs2str) (pblRD @ [pI])
  7.1314        val {thy, ppc, where_, prls, ...} = py 
  7.1315        val oris = prep_ori fmz thy ppc |> #1;
  7.1316 -      (*8.3.02: itms!: oris ev. are _not_ complete here*)
  7.1317 +      (* WN020803: itms!: oris might _not_ be complete here *)
  7.1318        val(b, (itms, pre')) = match_oris' thy oris (ppc,where_,prls);
  7.1319 -    in if b 
  7.1320 -      then let val pbl = Matches (rev (pblRD @ [pI]), itms2itemppc thy itms pre')
  7.1321 +    in
  7.1322 +      if b 
  7.1323 +      then
  7.1324 +        let val pbl = Matches (rev (pblRD @ [pI]), itms2itemppc thy itms pre')
  7.1325  	      in refins' (pblRD @ [pI]) fmz (pbls @ [pbl]) pys end
  7.1326        else (pbls @ [NoMatch (rev (pblRD @ [pI]), itms2itemppc thy itms pre')])
  7.1327      end
  7.1328 -
  7.1329 -and refins' pblRD fmz pbls [] = pbls
  7.1330 -  | refins' pblRD fmz pbls ((p as Ptyp (pI, _, _))::pts) =
  7.1331 -    let val pbls' = refin' pblRD fmz pbls p
  7.1332 -    in case last_elem pbls' of
  7.1333 +  | refin' _ _ _ _ = error "refin': uncovered fun def."
  7.1334 +and refins' _ _ pbls [] = pbls
  7.1335 +  | refins' pblRD fmz pbls ((p as Ptyp _) :: pts) =
  7.1336 +    let
  7.1337 +      val pbls' = refin' pblRD fmz pbls p
  7.1338 +    in
  7.1339 +      case last_elem pbls' of
  7.1340          Matches _ => pbls'
  7.1341        | NoMatch _ => refins' pblRD fmz pbls' pts
  7.1342      end;
  7.1343  
  7.1344 -(*. refine a problem; version for tactic Refine_Problem .*)
  7.1345 -fun refin'' thy (pblRD:pblRD) itms pbls ((Ptyp (pI,[py],[])):pbt ptyp) =
  7.1346 -    let (*val _ = tracing("### refin''1: pI="^pI);*)
  7.1347 -	val {thy,ppc,where_,prls,...} = py 
  7.1348 -	val (b, (itms', pre')) = match_itms thy itms (ppc,where_,prls);
  7.1349 -    in if b then pbls @ [Match_ (rev (pblRD @ [pI]), (itms', pre'))]
  7.1350 -       else pbls @ [NoMatch_] 
  7.1351 +(* refine a problem; version for tactic Refine_Problem *)
  7.1352 +fun refin'' _ (pblRD: pblRD) itms pbls ((Ptyp (pI, [py], [])): pbt ptyp) =
  7.1353 +    let
  7.1354 +	    val {thy, ppc, where_, prls, ...} = py 
  7.1355 +	    val (b, (itms', pre')) = match_itms thy itms (ppc, where_, prls);
  7.1356 +    in
  7.1357 +      if b
  7.1358 +      then pbls @ [Match_ (rev (pblRD @ [pI]), (itms', pre'))]
  7.1359 +      else pbls @ [NoMatch_] 
  7.1360      end
  7.1361 -(* val pblRD = (rev o tl) pblID; val pbls = []; 
  7.1362 -   val Ptyp (pI,[py],pys) = app_ptyp I pblID (rev pblID) (!ptyps);
  7.1363 -   *)
  7.1364 -  | refin'' thy pblRD itms pbls (Ptyp (pI,[py],pys)) =
  7.1365 -    let (*val _ = tracing("### refin''2: pI="^pI);*)
  7.1366 -	val {thy,ppc,where_,prls,...} = py 
  7.1367 -	val(b, (itms', pre')) = match_itms thy itms (ppc,where_,prls);
  7.1368 +  | refin'' _ pblRD itms pbls (Ptyp (pI, [py], pys)) =
  7.1369 +    let
  7.1370 +      val {thy, ppc, where_, prls, ...} = py 
  7.1371 +      val (b, (itms', pre')) = match_itms thy itms (ppc, where_, prls);
  7.1372      in if b 
  7.1373         then let val pbl = Match_ (rev (pblRD @ [pI]), (itms', pre'))
  7.1374  	    in refins'' thy (pblRD @ [pI]) itms (pbls @ [pbl]) pys end
  7.1375         else (pbls @ [NoMatch_])
  7.1376      end
  7.1377 -and refins'' thy pblRD itms pbls [] = pbls
  7.1378 -  | refins'' thy pblRD itms pbls ((p as Ptyp (pI,_,_))::pts) =
  7.1379 -    let val pbls' = refin'' thy pblRD itms pbls p
  7.1380 +  | refin'' _ _ _ _ _ = error "refin': uncovered fun def."
  7.1381 +and refins'' _ _ _ pbls [] = pbls
  7.1382 +  | refins'' thy pblRD itms pbls ((p as Ptyp _) :: pts) =
  7.1383 +    let
  7.1384 +      val pbls' = refin'' thy pblRD itms pbls p
  7.1385      in case last_elem pbls' of
  7.1386 -	 Match_ _ => pbls'
  7.1387 -       | NoMatch_ => refins'' thy pblRD itms pbls' pts end;
  7.1388 +      Match_ _ => pbls'
  7.1389 +    | NoMatch_ => refins'' thy pblRD itms pbls' pts
  7.1390 +  end;
  7.1391  
  7.1392 -(*. for tactic Refine_Tacitly .*)
  7.1393 -(*!!! oris are already created wrt. some pbt; pbt contains thy for parsing*)
  7.1394 -(* val (thy,pblID) = (assoc_thy dI',pI);
  7.1395 -   *)
  7.1396 -fun refine_ori oris (pblID:pblID) =
  7.1397 -    let val opt = app_ptyp (refin ((rev o tl) pblID) oris) 
  7.1398 -			   pblID (rev pblID);
  7.1399 +(* for tactic Refine_Tacitly
  7.1400 +   oris are already created wrt. some pbt; pbt contains thy for parsing *)
  7.1401 +fun refine_ori oris (pblID: pblID) =
  7.1402 +  let
  7.1403 +    val opt = app_ptyp (refin ((rev o tl) pblID) oris) pblID (rev pblID);
  7.1404      in case opt of 
  7.1405 -	   SOME pblRD => let val (pblID':pblID) =(rev pblRD)
  7.1406 -			 in if pblID' = pblID then NONE
  7.1407 -			    else SOME pblID' end
  7.1408 -	 | NONE => NONE end;
  7.1409 +      SOME pblRD =>
  7.1410 +        let val pblID': pblID = rev pblRD
  7.1411 +			  in if pblID' = pblID then NONE else SOME pblID' end
  7.1412 +	  | NONE => NONE
  7.1413 +	end;
  7.1414  fun refine_ori' oris pI = (the (refine_ori oris pI)) handle _ => pI;
  7.1415  
  7.1416 -(*. for tactic Refine_Problem .*); 
  7.1417 -(* 10.03: returnvalue -> (pIrefined, itm list) would be sufficient *)
  7.1418 -(* val pblID = pI; app_ptyp I pblID (rev pblID) (!ptyps);
  7.1419 -   *)
  7.1420 -fun refine_pbl thy (pblID:pblID) itms =
  7.1421 -    case refined_ (app_ptyp (refin'' thy ((rev o tl) pblID) itms []) 
  7.1422 -			    pblID (rev pblID)) of
  7.1423 -	NONE => NONE
  7.1424 -      | SOME (Match_ (rfd as (pI',_))) => 
  7.1425 -	if pblID = pI' then NONE else SOME rfd;
  7.1426 +(* for tactic Refine_Problem
  7.1427 +   10.03: returnvalue -> (pIrefined, itm list) would be sufficient *)
  7.1428 +fun refine_pbl thy (pblID: pblID) itms =
  7.1429 +  case refined_ (app_ptyp (refin'' thy ((rev o tl) pblID) itms []) pblID (rev pblID)) of
  7.1430 +	  NONE => NONE
  7.1431 +  | SOME (Match_ (rfd as (pI', _))) => if pblID = pI' then NONE else SOME rfd
  7.1432 +  | _ => error "refine_pbl: uncovered case refined_";
  7.1433  
  7.1434  
  7.1435 -(*. for math-experts .*)
  7.1436 -(*FIXME.WN021019: needs thy for parsing fmz*)
  7.1437 -(* val fmz = fmz1; val pblID = ["pbla"]; val pblRD = (rev o tl) pblID; 
  7.1438 -   val pbls = []; val ptys = !ptyps;
  7.1439 -   *)
  7.1440 -fun refine (fmz:fmz_) (pblID:pblID) =
  7.1441 +(* for math-experts
  7.1442 +   FIXME.WN021019: needs thy for parsing fmz *)
  7.1443 +fun refine (fmz: fmz_) (pblID: pblID) =
  7.1444    app_ptyp (refin' ((rev o tl) pblID) fmz []) pblID (rev pblID);
  7.1445  
  7.1446 -
  7.1447 -(*.make a guh from a reference to an element in the kestore;
  7.1448 -   EXCEPT theory hierarchy ... compare 'fun keref2xml'.*)
  7.1449 -fun pblID2guh (pblID:pblID) =
  7.1450 -    (((#guh o get_pbt) pblID)
  7.1451 -     handle _ => error ("pblID2guh: not for '"^strs2str' pblID ^ "'"));
  7.1452 -fun metID2guh (metID:metID) =
  7.1453 -    (((#guh o get_met) metID)
  7.1454 -     handle _ => error ("metID2guh: no 'Met_' for '"^
  7.1455 -			      strs2str' metID ^ "'"));
  7.1456 -fun kestoreID2guh Pbl_ (kestoreID:kestoreID) = pblID2guh kestoreID
  7.1457 -  | kestoreID2guh Met_ (kestoreID:kestoreID) = metID2guh kestoreID
  7.1458 +(* make a guh from a reference to an element in the kestore;
  7.1459 +   EXCEPT theory hierarchy ... compare 'fun keref2xml'    *)
  7.1460 +fun pblID2guh (pblID:pblID) = (((#guh o get_pbt) pblID)
  7.1461 +  handle _ => error ("pblID2guh: not for \"" ^ strs2str' pblID ^ "\""));
  7.1462 +fun metID2guh (metID:metID) = (((#guh o get_met) metID)
  7.1463 +  handle _ => error ("metID2guh: no 'Met_' for \"" ^ strs2str' metID ^ "\""));
  7.1464 +fun kestoreID2guh Pbl_ (kestoreID: kestoreID) = pblID2guh kestoreID
  7.1465 +  | kestoreID2guh Met_ (kestoreID: kestoreID) = metID2guh kestoreID
  7.1466    | kestoreID2guh ketype kestoreID =
  7.1467 -    error ("kestoreID2guh: '" ^ ketype2str ketype ^ "' not for '" ^
  7.1468 -		 strs2str' kestoreID ^ "'");
  7.1469 +    error ("kestoreID2guh: \"" ^ ketype2str ketype ^ "\" not for \"" ^ strs2str' kestoreID ^ "\"");
  7.1470  
  7.1471  fun show_pblguhs () =
  7.1472 -    (default_print_depth 999; 
  7.1473 -     (tracing o strs2str o (map linefeed)) (coll_pblguhs (get_ptyps ())); 
  7.1474 -     default_print_depth 3);
  7.1475 +  (default_print_depth 999; 
  7.1476 +  (tracing o strs2str o (map linefeed)) (coll_pblguhs (get_ptyps ())); 
  7.1477 +  default_print_depth 3);
  7.1478  fun sort_pblguhs () =
  7.1479 -    (default_print_depth 999; 
  7.1480 -     (tracing o strs2str o (map linefeed)) 
  7.1481 -	 (((sort string_ord) o coll_pblguhs) (get_ptyps ())); 
  7.1482 -     default_print_depth 3);
  7.1483 +  (default_print_depth 999; 
  7.1484 +  (tracing o strs2str o (map linefeed)) (((sort string_ord) o coll_pblguhs) (get_ptyps ())); 
  7.1485 +  default_print_depth 3);
  7.1486  
  7.1487  fun show_metguhs () =
  7.1488 -    (default_print_depth 999; 
  7.1489 -     (tracing o strs2str o (map linefeed)) (coll_metguhs (get_mets ())); 
  7.1490 -     default_print_depth 3);
  7.1491 +  (default_print_depth 999; 
  7.1492 +  (tracing o strs2str o (map linefeed)) (coll_metguhs (get_mets ())); 
  7.1493 +  default_print_depth 3);
  7.1494  fun sort_metguhs () =
  7.1495 -    (default_print_depth 999; 
  7.1496 -     (tracing o strs2str o (map linefeed)) 
  7.1497 -	 (((sort string_ord) o coll_metguhs) (get_mets ())); 
  7.1498 -     default_print_depth 3);
  7.1499 +  (default_print_depth 999; 
  7.1500 +  (tracing o strs2str o (map linefeed)) (((sort string_ord) o coll_metguhs) (get_mets ())); 
  7.1501 +  default_print_depth 3);
  7.1502 +
  7.1503 +(**)
  7.1504 +end
  7.1505 +(**)
  7.1506 \ No newline at end of file
     8.1 --- a/src/Tools/isac/Interpret/script.sml	Wed Dec 14 14:20:25 2016 +0100
     8.2 +++ b/src/Tools/isac/Interpret/script.sml	Sun Dec 18 16:27:41 2016 +0100
     8.3 @@ -205,7 +205,7 @@
     8.4          | SOME (_, _, _, _, itm_) => penvval_in itm_
     8.5        (*| SOME (_,_,_,_,itm_) => mk_arg thy (d_in itm_) (ts_in itm_);
     8.6              penv postponed; presently penv holds already env for script*)
     8.7 -    val pats = (#ppc o get_met) mI
     8.8 +    val pats = (#ppc o Specify.get_met) mI
     8.9      val _ = if pats = [] then raise ERROR errmsg else ()
    8.10    in (flat o (map (itm2arg itms))) pats end;
    8.11  
    8.12 @@ -254,17 +254,17 @@
    8.13  	      if mI = ["no_met"] 
    8.14  	      then
    8.15            let
    8.16 -            val pors = (Chead.match_ags thy ((#ppc o get_pbt) pI) ags)
    8.17 +            val pors = (Chead.match_ags thy ((#ppc o Specify.get_pbt) pI) ags)
    8.18  		          handle ERROR "actual args do not match formal args" 
    8.19  			        => (Chead.match_ags_msg pI stac ags(*raise exn*); [])
    8.20 -		        val pI' = refine_ori' pors pI;
    8.21 +		        val pI' = Specify.refine_ori' pors pI;
    8.22  		      in (pI', pors (* refinement over models with diff.prec only *), 
    8.23 -		          (hd o #met o get_pbt) pI') end
    8.24 -	      else (pI, (Chead.match_ags thy ((#ppc o get_pbt) pI) ags)
    8.25 +		          (hd o #met o Specify.get_pbt) pI') end
    8.26 +	      else (pI, (Chead.match_ags thy ((#ppc o Specify.get_pbt) pI) ags)
    8.27  		      handle ERROR "actual args do not match formal args"
    8.28  		      => (Chead.match_ags_msg pI stac ags(*raise exn*); []), mI);
    8.29        val (fmz_, vals) = Chead.oris2fmz_vals pors;
    8.30 -	    val {cas,ppc,thy,...} = get_pbt pI
    8.31 +	    val {cas,ppc,thy,...} = Specify.get_pbt pI
    8.32  	    val dI = theory2theory' thy (*.take dI from _refined_ pbl.*)
    8.33  	    val dI = theory2theory' (maxthy (assoc_thy dI) (rootthy pt));
    8.34        val ctxt = dI |> Thy_Info.get_theory |> Proof_Context.init_global |> declare_constraints' vals
    8.35 @@ -416,17 +416,17 @@
    8.36  	      if mI = ["no_met"] 
    8.37  	      then
    8.38            let
    8.39 -            val pors = (Chead.match_ags thy ((#ppc o get_pbt) pI) ags)
    8.40 +            val pors = (Chead.match_ags thy ((#ppc o Specify.get_pbt) pI) ags)
    8.41  		          handle ERROR "actual args do not match formal args"
    8.42  			          => (Chead.match_ags_msg pI stac ags(*raise exn*);[]);
    8.43 -		        val pI' = refine_ori' pors pI;
    8.44 -		      in (pI', pors (*refinement over models with diff.prec only*), (hd o #met o get_pbt) pI')
    8.45 +		        val pI' = Specify.refine_ori' pors pI;
    8.46 +		      in (pI', pors (*refinement over models with diff.prec only*), (hd o #met o Specify.get_pbt) pI')
    8.47            end
    8.48 -	      else (pI, (Chead.match_ags thy ((#ppc o get_pbt) pI) ags)
    8.49 +	      else (pI, (Chead.match_ags thy ((#ppc o Specify.get_pbt) pI) ags)
    8.50  		      handle ERROR "actual args do not match formal args"
    8.51  		      => (Chead.match_ags_msg pI stac ags(*raise exn*); []), mI);
    8.52        val (fmz_, vals) = Chead.oris2fmz_vals pors;
    8.53 -	    val {cas, ppc, thy, ...} = get_pbt pI
    8.54 +	    val {cas, ppc, thy, ...} = Specify.get_pbt pI
    8.55  	    val dI = theory2theory' thy (*take dI from _refined_ pbl*)
    8.56  	    val dI = theory2theory' (maxthy (assoc_thy dI) (rootthy pt))
    8.57  	    val ctxt = dI |> Thy_Info.get_theory |> Proof_Context.init_global |> declare_constraints' vals
    8.58 @@ -1082,7 +1082,7 @@
    8.59    let
    8.60      val actuals = itms2args thy metID itms
    8.61      val _ = if actuals <> [] then () else raise ERROR (errmsg ^ strs2str' metID)
    8.62 -    val (scr, sc) = (case (#scr o get_met) metID of
    8.63 +    val (scr, sc) = (case (#scr o Specify.get_met) metID of
    8.64         scr as Prog sc => (scr, sc) | _ => raise ERROR ("init_scrstate with " ^ metID2str metID))
    8.65      val formals = formal_args sc    
    8.66  	  (*expects same sequence of (actual) args in itms and (formal) args in met*)
    8.67 @@ -1095,7 +1095,7 @@
    8.68          else error (msg_type (sc, metID, a, f, formals, actuals))
    8.69      val env = relate_args [] formals actuals;
    8.70      val ctxt = Proof_Context.init_global thy |> declare_constraints' actuals
    8.71 -    val {pre, prls, ...} = get_met metID;
    8.72 +    val {pre, prls, ...} = Specify.get_met metID;
    8.73      val pres = check_preconds thy prls pre itms |> map snd;
    8.74      val ctxt = ctxt |> insert_assumptions pres;
    8.75    in (ScrState (env, [], NONE, e_term, Safe, true), ctxt, scr) : istate * Proof.context * scr end;
    8.76 @@ -1112,16 +1112,16 @@
    8.77    | SOME is =>
    8.78        let
    8.79          val metID = get_obj g_metID pt p
    8.80 -        val {srls, ...} = get_met metID
    8.81 -      in (srls, is, (#scr o get_met) metID) end
    8.82 +        val {srls, ...} = Specify.get_met metID
    8.83 +      in (srls, is, (#scr o Specify.get_met) metID) end
    8.84    else
    8.85      let val (pbl, p', rls') = par_pbl_det pt p
    8.86      in if pbl 
    8.87         then (*if last_elem p = 0 nothing written to pt yet*)                                (* 2 *)
    8.88           let
    8.89  	         val metID = get_obj g_metID pt p'
    8.90 -	         val {srls,...} = get_met metID
    8.91 -	       in (srls, get_loc pt (p,p_), (#scr o get_met) metID) end
    8.92 +	         val {srls,...} = Specify.get_met metID
    8.93 +	       in (srls, get_loc pt (p,p_), (#scr o Specify.get_met) metID) end
    8.94         else (*FIXME.WN0?: get from pbl or met !!! unused for Rrls in locate_gen, next_tac*) (* 3 *)
    8.95  	       (e_rls, get_loc pt (p,p_),
    8.96  	          case rls' of
    8.97 @@ -1141,7 +1141,7 @@
    8.98  	      PblObj {meth = itms, ...} => itms
    8.99  	    | PrfObj _ => error "from_pblobj' NOT with PrfObj")
   8.100  	  val metID = get_obj g_metID pt p'
   8.101 -	  val {srls, scr, ...} = get_met metID
   8.102 +	  val {srls, scr, ...} = Specify.get_met metID
   8.103    in
   8.104      if last_elem p = 0 (*nothing written to pt yet*)
   8.105      then
   8.106 @@ -1171,7 +1171,7 @@
   8.107          val thy = assoc_thy thy';
   8.108          val metID = get_obj g_metID pt pp;
   8.109          val metID' = if metID =e_metID then (thd3 o snd3) (get_obj g_origin pt pp) else metID
   8.110 -        val (sc, srls) = (case get_met metID' of
   8.111 +        val (sc, srls) = (case Specify.get_met metID' of
   8.112              {scr = Prog sc, srls, ...} => (sc, srls) | _ => error "sel_rules 1")
   8.113          val (env, a, v) = (case get_istate pt (p, p_) of
   8.114              ScrState (env, _, a, v, _, _) => (env, a, v) | _ => error "sel_rules 2")
   8.115 @@ -1196,7 +1196,7 @@
   8.116            if metID = e_metID 
   8.117            then (thd3 o snd3) (get_obj g_origin pt pp)
   8.118            else metID
   8.119 -        val (sc, srls, erls, ro) = (case get_met metID' of
   8.120 +        val (sc, srls, erls, ro) = (case Specify.get_met metID' of
   8.121              {scr = Prog sc, srls, erls, rew_ord' = ro, ...} => (sc, srls, erls, ro)
   8.122            | _ => error "sel_appl_atomic_tacs 1")
   8.123          val (env, a, v) = (case get_istate pt (p, p_) of
     9.1 --- a/src/Tools/isac/Interpret/solve.sml	Wed Dec 14 14:20:25 2016 +0100
     9.2 +++ b/src/Tools/isac/Interpret/solve.sml	Sun Dec 18 16:27:41 2016 +0100
     9.3 @@ -143,7 +143,7 @@
     9.4     val (("Apply_Method",Apply_Method' (mI,_,_)),pt, pos as (p,_))=(m,pt, pos);
     9.5     *)
     9.6  fun solve ("Apply_Method", m as Apply_Method' (mI, _, _, _)) (pt:ptree, (pos as (p,_))) =
     9.7 -      let val {srls, ...} = get_met mI;
     9.8 +      let val {srls, ...} = Specify.get_met mI;
     9.9          val PblObj {meth=itms, ...} = get_obj I pt p;
    9.10          val thy' = get_obj g_domID pt p;
    9.11          val thy = assoc_thy thy';
    9.12 @@ -192,7 +192,7 @@
    9.13  		       | _ => get_assumptions_ pt (p,p_))
    9.14  	        handle _ => [] (*WN.27.5.03 asms in subpbls not completely clear*)
    9.15          val metID = get_obj g_metID pt pp;
    9.16 -        val {srls=srls,scr=sc,...} = get_met metID;
    9.17 +        val {srls=srls,scr=sc,...} = Specify.get_met metID;
    9.18          val loc as (ScrState (E,l,a,_,_,b), ctxt) = get_loc pt (p,p_); 
    9.19          val thy' = get_obj g_domID pt pp;
    9.20          val thy = assoc_thy thy';
    9.21 @@ -211,7 +211,7 @@
    9.22  	          val thy' = get_obj g_domID pt ppp;
    9.23              val thy = assoc_thy thy';
    9.24  	          val metID = get_obj g_metID pt ppp;
    9.25 -            val sc = (#scr o get_met) metID;
    9.26 +            val sc = (#scr o Specify.get_met) metID;
    9.27              val (ScrState (E,l,a,_,_,b), ctxt') = get_loc pt (pp(*!/p/*),Frm); 
    9.28  	          val ctxt'' = from_subpbl_to_caller ctxt scval ctxt'
    9.29              val ((p,p_),ps,f,pt) = 
    9.30 @@ -274,7 +274,7 @@
    9.31  (* nxt_solv (Apply_Method'     vvv FIXME: get args in applicable_in *)
    9.32  fun nxt_solv (Apply_Method' (mI,_,_,_)) _ (pt:ptree, pos as (p,_)) =
    9.33        let
    9.34 -        val {srls,ppc,...} = get_met mI;
    9.35 +        val {srls,ppc,...} = Specify.get_met mI;
    9.36          val PblObj{meth=itms,origin=(oris,_,_),probl, ...} = get_obj I pt p;
    9.37          val itms = if itms <> [] then itms else Chead.complete_metitms oris probl [] ppc
    9.38          val thy' = get_obj g_domID pt p;
    9.39 @@ -311,7 +311,7 @@
    9.40  		       | _ => get_assumptions_ pt (p,p_))
    9.41  	        handle _ => [] (*FIXME.WN030527 asms in subpbls not completely clear*)
    9.42          val metID = get_obj g_metID pt pp;
    9.43 -        val {srls=srls,scr=sc,...} = get_met metID;
    9.44 +        val {srls=srls,scr=sc,...} = Specify.get_met metID;
    9.45          val loc as (ScrState (E,l,a,_,_,b), ctxt) = get_loc pt (p,p_); 
    9.46          val thy' = get_obj g_domID pt pp;
    9.47          val thy = assoc_thy thy';
    9.48 @@ -331,7 +331,7 @@
    9.49  	          val thy' = get_obj g_domID pt ppp;
    9.50              val thy = assoc_thy thy';
    9.51  	          val metID = get_obj g_metID pt ppp;
    9.52 -	          val {scr,...} = get_met metID;
    9.53 +	          val {scr,...} = Specify.get_met metID;
    9.54              val (ScrState (E,l,a,_,_,b), ctxt') = get_loc pt (pp(*!/p/*),Frm)
    9.55  	          val ctxt'' = from_subpbl_to_caller ctxt scval ctxt'
    9.56              val tac_ = Check_Postcond' (pI, (scval, asm))
    10.1 --- a/src/Tools/isac/Knowledge/AlgEin.thy	Wed Dec 14 14:20:25 2016 +0100
    10.2 +++ b/src/Tools/isac/Knowledge/AlgEin.thy	Sun Dec 18 16:27:41 2016 +0100
    10.3 @@ -26,8 +26,8 @@
    10.4  *}
    10.5  (** problems **)
    10.6  setup {* KEStore_Elems.add_pbts
    10.7 -  [(prep_pbt thy "pbl_algein" [] e_pblID (["Berechnung"], [], e_rls, NONE, [])),
    10.8 -    (prep_pbt thy "pbl_algein_numsym" [] e_pblID
    10.9 +  [(Specify.prep_pbt thy "pbl_algein" [] e_pblID (["Berechnung"], [], e_rls, NONE, [])),
   10.10 +    (Specify.prep_pbt thy "pbl_algein_numsym" [] e_pblID
   10.11        (["numerischSymbolische", "Berechnung"],
   10.12          [("#Given",
   10.13              ["KantenLaenge k_k","Querschnitt q__q"(*q_ in Biegelinie.thy*), "KantenUnten u_u",
   10.14 @@ -36,17 +36,17 @@
   10.15          e_rls, NONE, [["Berechnung","erstNumerisch"], ["Berechnung","erstSymbolisch"]]))]; *}
   10.16  
   10.17  setup {* KEStore_Elems.add_mets
   10.18 -  [prep_met thy "met_algein" [] e_metID
   10.19 +  [Specify.prep_met thy "met_algein" [] e_metID
   10.20  	    (["Berechnung"], [],
   10.21  	      {rew_ord'="tless_true", rls'= Erls, calc = [], srls = Erls, prls = Erls, crls =Erls,
   10.22            errpats = [], nrls = Erls},
   10.23          "empty_script"),
   10.24 -    prep_met thy "met_algein_numsym" [] e_metID
   10.25 +    Specify.prep_met thy "met_algein_numsym" [] e_metID
   10.26  	    (["Berechnung","erstNumerisch"], [],
   10.27  	      {rew_ord'="tless_true", rls'= Erls, calc = [], srls = Erls, prls = Erls, crls =Erls,
   10.28  	        errpats = [], nrls = Erls},
   10.29  	      "empty_script"),
   10.30 -    prep_met thy "met_algein_numsym" [] e_metID
   10.31 +    Specify.prep_met thy "met_algein_numsym" [] e_metID
   10.32  	    (["Berechnung","erstNumerisch"],
   10.33  	       [("#Given" ,["KantenLaenge k_k","Querschnitt q__q", "KantenUnten u_u",
   10.34  	           "KantenSenkrecht s_s", "KantenOben o_o"]),
   10.35 @@ -74,7 +74,7 @@
   10.36             "      t_t = Substitute [k_k, q__q] t_t;                         " ^
   10.37             "      t_t = (Repeat (Try (Rewrite_Set norm_Poly False))) t_t  " ^
   10.38             " in (Try (Rewrite_Set norm_Poly False)) t_t)                  "),
   10.39 -    prep_met thy "met_algein_symnum" [] e_metID
   10.40 +    Specify.prep_met thy "met_algein_symnum" [] e_metID
   10.41  	    (["Berechnung","erstSymbolisch"],
   10.42  	        [("#Given" ,["KantenLaenge k_k","Querschnitt q__q", "KantenUnten u_u",
   10.43                  "KantenSenkrecht s_s", "KantenOben o_o"]),
    11.1 --- a/src/Tools/isac/Knowledge/Biegelinie.thy	Wed Dec 14 14:20:25 2016 +0100
    11.2 +++ b/src/Tools/isac/Knowledge/Biegelinie.thy	Sun Dec 18 16:27:41 2016 +0100
    11.3 @@ -94,14 +94,14 @@
    11.4  
    11.5  (** problems **)
    11.6  setup {* KEStore_Elems.add_pbts
    11.7 -  [(prep_pbt @{theory} "pbl_bieg" [] e_pblID
    11.8 +  [(Specify.prep_pbt @{theory} "pbl_bieg" [] e_pblID
    11.9        (["Biegelinien"],
   11.10          [("#Given" ,["Traegerlaenge l_l", "Streckenlast q_q"]),
   11.11            (*("#Where",["0 < l_l"]), ...wait for &lt; and handling Arbfix*)
   11.12            ("#Find"  ,["Biegelinie b_b"]),
   11.13            ("#Relate",["Randbedingungen r_b"])],
   11.14          append_rls "e_rls" e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen2"]])),
   11.15 -    (prep_pbt @{theory} "pbl_bieg_mom" [] e_pblID
   11.16 +    (Specify.prep_pbt @{theory} "pbl_bieg_mom" [] e_pblID
   11.17        (["MomentBestimmte","Biegelinien"],
   11.18          [("#Given" ,["Traegerlaenge l_l", "Streckenlast q_q"]),
   11.19            (*("#Where",["0 < l_l"]), ...wait for &lt; and handling Arbfix*)
   11.20 @@ -109,26 +109,26 @@
   11.21            ("#Relate",["RandbedingungenBiegung r_b","RandbedingungenMoment r_m"])
   11.22          ],
   11.23          append_rls "e_rls" e_rls [], NONE, [["IntegrierenUndKonstanteBestimmen"]])),
   11.24 -    (prep_pbt @{theory} "pbl_bieg_momg" [] e_pblID
   11.25 +    (Specify.prep_pbt @{theory} "pbl_bieg_momg" [] e_pblID
   11.26        (["MomentGegebene","Biegelinien"], [], append_rls "e_rls" e_rls [], NONE,
   11.27          [["IntegrierenUndKonstanteBestimmen","2xIntegrieren"]])),
   11.28 -    (prep_pbt @{theory} "pbl_bieg_einf" [] e_pblID
   11.29 +    (Specify.prep_pbt @{theory} "pbl_bieg_einf" [] e_pblID
   11.30        (["einfache","Biegelinien"], [], append_rls "e_rls" e_rls [], NONE,
   11.31          [["IntegrierenUndKonstanteBestimmen","4x4System"]])),
   11.32 -    (prep_pbt @{theory} "pbl_bieg_momquer" [] e_pblID
   11.33 +    (Specify.prep_pbt @{theory} "pbl_bieg_momquer" [] e_pblID
   11.34        (["QuerkraftUndMomentBestimmte","Biegelinien"], [], append_rls "e_rls" e_rls [], NONE,
   11.35          [["IntegrierenUndKonstanteBestimmen","1xIntegrieren"]])),
   11.36 -    (prep_pbt @{theory} "pbl_bieg_vonq" [] e_pblID
   11.37 +    (Specify.prep_pbt @{theory} "pbl_bieg_vonq" [] e_pblID
   11.38        (["vonBelastungZu","Biegelinien"],
   11.39            [("#Given" ,["Streckenlast q_q","FunktionsVariable v_v"]),
   11.40              ("#Find"  ,["Funktionen funs'''"])],
   11.41          append_rls "e_rls" e_rls [], NONE, [["Biegelinien","ausBelastung"]])),
   11.42 -    (prep_pbt @{theory} "pbl_bieg_randbed" [] e_pblID
   11.43 +    (Specify.prep_pbt @{theory} "pbl_bieg_randbed" [] e_pblID
   11.44        (["setzeRandbedingungen","Biegelinien"],
   11.45            [("#Given" ,["Funktionen fun_s","Randbedingungen r_b"]),
   11.46              ("#Find"  ,["Gleichungen equs'''"])],
   11.47          append_rls "e_rls" e_rls [], NONE, [["Biegelinien","setzeRandbedingungenEin"]])),
   11.48 -    (prep_pbt @{theory} "pbl_equ_fromfun" [] e_pblID
   11.49 +    (Specify.prep_pbt @{theory} "pbl_equ_fromfun" [] e_pblID
   11.50        (["makeFunctionTo","equation"],
   11.51            [("#Given" ,["functionEq fu_n","substitution su_b"]),
   11.52              ("#Find"  ,["equality equ'''"])],
   11.53 @@ -185,7 +185,7 @@
   11.54  *}
   11.55  
   11.56  setup {* KEStore_Elems.add_mets
   11.57 -  [prep_met @{theory} "met_biege" [] e_metID 
   11.58 +  [Specify.prep_met @{theory} "met_biege" [] e_metID 
   11.59  	    (["IntegrierenUndKonstanteBestimmen"],
   11.60  	      [("#Given" ,["Traegerlaenge l_l", "Streckenlast q__q", "FunktionsVariable v_v"]),
   11.61  		      (*("#Where",["0 < l_l"]), ...wait for &lt; and handling Arbfix*)
   11.62 @@ -261,7 +261,7 @@
   11.63            "       B__B = ((Substitute c_1_2) @@                                    " ^
   11.64            "              (Rewrite_Set_Inst [(bdv, x)] make_ratpoly_in False)) B__B " ^
   11.65            " in B__B)"),
   11.66 -    prep_met @{theory} "met_biege_2" [] e_metID
   11.67 +    Specify.prep_met @{theory} "met_biege_2" [] e_metID
   11.68  	    (["IntegrierenUndKonstanteBestimmen2"],
   11.69  	      [("#Given" ,["Traegerlaenge l_l", "Streckenlast q__q", "FunktionsVariable v_v"]),
   11.70  		      (*("#Where",["0 < l_l"]), ...wait for &lt; and handling Arbfix*)
   11.71 @@ -298,27 +298,27 @@
   11.72            "       B_B = ((Substitute con_s) @@                                       " ^
   11.73            "              (Rewrite_Set_Inst [(bdv, v_v)] make_ratpoly_in False)) B_B  " ^
   11.74            " in B_B)"),
   11.75 -    prep_met @{theory} "met_biege_intconst_2" [] e_metID
   11.76 +    Specify.prep_met @{theory} "met_biege_intconst_2" [] e_metID
   11.77  	    (["IntegrierenUndKonstanteBestimmen","2xIntegrieren"], [],
   11.78  	      {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls,
   11.79            errpats = [], nrls = e_rls},
   11.80          "empty_script"),
   11.81 -    prep_met @{theory} "met_biege_intconst_4" [] e_metID
   11.82 +    Specify.prep_met @{theory} "met_biege_intconst_4" [] e_metID
   11.83  	    (["IntegrierenUndKonstanteBestimmen","4x4System"], [],
   11.84  	      {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls,
   11.85            errpats = [], nrls = e_rls},
   11.86          "empty_script"),
   11.87 -    prep_met @{theory} "met_biege_intconst_1" [] e_metID
   11.88 +    Specify.prep_met @{theory} "met_biege_intconst_1" [] e_metID
   11.89  	    (["IntegrierenUndKonstanteBestimmen","1xIntegrieren"], [],
   11.90          {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls,
   11.91            errpats = [], nrls = e_rls},
   11.92          "empty_script"),
   11.93 -    prep_met @{theory} "met_biege2" [] e_metID
   11.94 +    Specify.prep_met @{theory} "met_biege2" [] e_metID
   11.95  	    (["Biegelinien"], [],
   11.96  	      {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls,
   11.97            errpats = [], nrls = e_rls},
   11.98          "empty_script"),
   11.99 -    prep_met @{theory} "met_biege_ausbelast" [] e_metID
  11.100 +    Specify.prep_met @{theory} "met_biege_ausbelast" [] e_metID
  11.101  	    (["Biegelinien", "ausBelastung"],
  11.102  	      [("#Given" ,["Streckenlast q__q", "FunktionsVariable v_v"]),
  11.103  	        ("#Find"  ,["Funktionen fun_s"])],
  11.104 @@ -355,7 +355,7 @@
  11.105            "                          [diff,integration,named])                    " ^
  11.106            "                          [REAL (rhs N__N), REAL v_v, REAL_REAL y])    " ^
  11.107            " in [Q__Q, M__M, N__N, B__B])"),
  11.108 -    prep_met @{theory} "met_biege_setzrand" [] e_metID
  11.109 +    Specify.prep_met @{theory} "met_biege_setzrand" [] e_metID
  11.110  	    (["Biegelinien", "setzeRandbedingungenEin"],
  11.111  	      [("#Given" , ["Funktionen fun_s", "Randbedingungen r_b"]),
  11.112  	        ("#Find"  , ["Gleichungen equs'''"])],
  11.113 @@ -414,7 +414,7 @@
  11.114            "                          [Equation,fromFunction])              " ^
  11.115            "                          [BOOL (hd f_s), BOOL b_4])          " ^
  11.116            " in [e_1,e_2,e_3,e_4])"*)),
  11.117 -    prep_met @{theory} "met_equ_fromfun" [] e_metID
  11.118 +    Specify.prep_met @{theory} "met_equ_fromfun" [] e_metID
  11.119  	    (["Equation","fromFunction"],
  11.120  	      [("#Given" ,["functionEq fu_n","substitution su_b"]),
  11.121  	        ("#Find"  ,["equality equ'''"])],
    12.1 --- a/src/Tools/isac/Knowledge/Diff.thy	Wed Dec 14 14:20:25 2016 +0100
    12.2 +++ b/src/Tools/isac/Knowledge/Diff.thy	Sun Dec 18 16:27:41 2016 +0100
    12.3 @@ -248,8 +248,8 @@
    12.4  
    12.5  (** problem types **)
    12.6  setup {* KEStore_Elems.add_pbts
    12.7 -  [(prep_pbt thy "pbl_fun" [] e_pblID (["function"], [], e_rls, NONE, [])),
    12.8 -    (prep_pbt thy "pbl_fun_deriv" [] e_pblID
    12.9 +  [(Specify.prep_pbt thy "pbl_fun" [] e_pblID (["function"], [], e_rls, NONE, [])),
   12.10 +    (Specify.prep_pbt thy "pbl_fun_deriv" [] e_pblID
   12.11        (["derivative_of","function"],
   12.12          [("#Given" ,["functionTerm f_f","differentiateFor v_v"]),
   12.13            ("#Find"  ,["derivative f_f'"])],
   12.14 @@ -257,7 +257,7 @@
   12.15          SOME "Diff (f_f, v_v)", [["diff","differentiate_on_R"],
   12.16  			  ["diff","after_simplification"]])),
   12.17      (*here "named" is used differently from Integration"*)
   12.18 -    (prep_pbt thy "pbl_fun_deriv_nam" [] e_pblID
   12.19 +    (Specify.prep_pbt thy "pbl_fun_deriv_nam" [] e_pblID
   12.20        (["named","derivative_of","function"],
   12.21          [("#Given" ,["functionEq f_f","differentiateFor v_v"]),
   12.22            ("#Find"  ,["derivativeEq f_f'"])],
   12.23 @@ -281,12 +281,12 @@
   12.24    | argl2dtss _ = error "Diff.ML: wrong argument for argl2dtss";
   12.25  *}
   12.26  setup {* KEStore_Elems.add_mets
   12.27 -  [prep_met thy "met_diff" [] e_metID
   12.28 +  [Specify.prep_met thy "met_diff" [] e_metID
   12.29        (["diff"], [],
   12.30          {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
   12.31            crls = Atools_erls, errpats = [], nrls = norm_diff},
   12.32          "empty_script"),
   12.33 -    prep_met thy "met_diff_onR" [] e_metID
   12.34 +    Specify.prep_met thy "met_diff_onR" [] e_metID
   12.35        (["diff","differentiate_on_R"],
   12.36          [("#Given" ,["functionTerm f_f","differentiateFor v_v"]),
   12.37            ("#Find"  ,["derivative f_f'"])],
   12.38 @@ -314,7 +314,7 @@
   12.39            "    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_var        False)) Or " ^
   12.40            "    (Repeat (Rewrite_Set             make_polynomial False)))) @@ " ^
   12.41            " (Try (Rewrite_Set_Inst [(bdv,v_v)] diff_sym_conv False)))) f_f')"),
   12.42 -    prep_met thy "met_diff_simpl" [] e_metID
   12.43 +    Specify.prep_met thy "met_diff_simpl" [] e_metID
   12.44        (["diff","diff_simpl"],
   12.45          [("#Given", ["functionTerm f_f","differentiateFor v_v"]),
   12.46           ("#Find" , ["derivative f_f'"])],
   12.47 @@ -342,7 +342,7 @@
   12.48            "    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_var        False)) Or " ^
   12.49            "    (Repeat (Rewrite_Set              make_polynomial False))))  " ^
   12.50            " )) f_f')"),
   12.51 -    prep_met thy "met_diff_equ" [] e_metID
   12.52 +    Specify.prep_met thy "met_diff_equ" [] e_metID
   12.53        (["diff","differentiate_equality"],
   12.54          [("#Given" ,["functionEq f_f","differentiateFor v_v"]),
   12.55            ("#Find"  ,["derivativeEq f_f'"])],
   12.56 @@ -371,7 +371,7 @@
   12.57            "    (Repeat (Rewrite_Inst [(bdv,v_v)] diff_var        False)) Or   " ^
   12.58            "    (Repeat (Rewrite_Set             make_polynomial False)))) @@ " ^
   12.59            " (Try (Rewrite_Set_Inst [(bdv,v_v)] diff_sym_conv False)))) f_f')"),
   12.60 -    prep_met thy "met_diff_after_simp" [] e_metID
   12.61 +    Specify.prep_met thy "met_diff_after_simp" [] e_metID
   12.62        (["diff","after_simplification"],
   12.63          [("#Given" ,["functionTerm f_f","differentiateFor v_v"]),
   12.64            ("#Find"  ,["derivative f_f'"])],
    13.1 --- a/src/Tools/isac/Knowledge/DiffApp.thy	Wed Dec 14 14:20:25 2016 +0100
    13.2 +++ b/src/Tools/isac/Knowledge/DiffApp.thy	Sun Dec 18 16:27:41 2016 +0100
    13.3 @@ -79,37 +79,37 @@
    13.4  
    13.5  (** problem types **)
    13.6  setup {* KEStore_Elems.add_pbts
    13.7 -  [(prep_pbt thy "pbl_fun_max" [] e_pblID
    13.8 +  [(Specify.prep_pbt thy "pbl_fun_max" [] e_pblID
    13.9        (["maximum_of","function"],
   13.10          [("#Given" ,["fixedValues f_ix"]),
   13.11            ("#Find"  ,["maximum m_m","valuesFor v_s"]),
   13.12            ("#Relate",["relations r_s"])],
   13.13          e_rls, NONE, [])),
   13.14 -    (prep_pbt thy "pbl_fun_make" [] e_pblID
   13.15 +    (Specify.prep_pbt thy "pbl_fun_make" [] e_pblID
   13.16        (["make","function"]:pblID,
   13.17          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   13.18            ("#Find"  ,["functionEq f_1"])],
   13.19          e_rls, NONE, [])),
   13.20 -    (prep_pbt thy "pbl_fun_max_expl" [] e_pblID
   13.21 +    (Specify.prep_pbt thy "pbl_fun_max_expl" [] e_pblID
   13.22        (["by_explicit","make","function"]:pblID,
   13.23          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   13.24            ("#Find"  ,["functionEq f_1"])],
   13.25        e_rls, NONE, [["DiffApp","make_fun_by_explicit"]])),
   13.26 -    (prep_pbt thy "pbl_fun_max_newvar" [] e_pblID
   13.27 +    (Specify.prep_pbt thy "pbl_fun_max_newvar" [] e_pblID
   13.28        (["by_new_variable","make","function"]:pblID,
   13.29          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   13.30            (*WN.12.5.03: precond for distinction still missing*)
   13.31            ("#Find"  ,["functionEq f_1"])],
   13.32        e_rls, NONE, [["DiffApp","make_fun_by_new_variable"]])),
   13.33 -    (prep_pbt thy "pbl_fun_max_interv" [] e_pblID
   13.34 +    (Specify.prep_pbt thy "pbl_fun_max_interv" [] e_pblID
   13.35        (["on_interval","maximum_of","function"]:pblID,
   13.36          [("#Given" ,["functionEq t_t","boundVariable v_v","interval i_tv"]),
   13.37            (*WN.12.5.03: precond for distinction still missing*)
   13.38            ("#Find"  ,["maxArgument v_0"])],
   13.39        e_rls, NONE, [])),
   13.40 -    (prep_pbt thy "pbl_tool" [] e_pblID
   13.41 +    (Specify.prep_pbt thy "pbl_tool" [] e_pblID
   13.42        (["tool"]:pblID, [], e_rls, NONE, [])),
   13.43 -    (prep_pbt thy "pbl_tool_findvals" [] e_pblID
   13.44 +    (Specify.prep_pbt thy "pbl_tool_findvals" [] e_pblID
   13.45        (["find_values","tool"]:pblID,
   13.46          [("#Given" ,["maxArgument m_ax","functionEq f_f","boundVariable v_v"]),
   13.47            ("#Find"  ,["valuesFor v_ls"]),
   13.48 @@ -119,12 +119,12 @@
   13.49  
   13.50  (** methods, scripts not yet implemented **)
   13.51  setup {* KEStore_Elems.add_mets
   13.52 -  [prep_met thy "met_diffapp" [] e_metID
   13.53 +  [Specify.prep_met thy "met_diffapp" [] e_metID
   13.54        (["DiffApp"], [],
   13.55          {rew_ord'="tless_true", rls'=Atools_erls,calc = [], srls = e_rls, prls = e_rls,
   13.56            crls = Atools_erls, errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)},
   13.57          "empty_script"),
   13.58 -    prep_met thy "met_diffapp_max" [] e_metID
   13.59 +    Specify.prep_met thy "met_diffapp_max" [] e_metID
   13.60        (["DiffApp","max_by_calculus"]:metID,
   13.61          [("#Given" ,["fixedValues f_ix","maximum m_m","relations r_s", "boundVariable v_v",
   13.62                "interval i_tv","errorBound e_rr"]),
   13.63 @@ -146,7 +146,7 @@
   13.64            " in ((SubProblem (DiffApp',[find_values,tool],[Isac,find_values])      " ^
   13.65            "      [REAL m_x, REAL (Rhs t_t), REAL v_v, REAL m_m,                  " ^
   13.66            "       BOOL_LIST (dropWhile (ident e_e) r_s)])::bool list))            "),
   13.67 -    prep_met thy "met_diffapp_funnew" [] e_metID
   13.68 +    Specify.prep_met thy "met_diffapp_funnew" [] e_metID
   13.69        (["DiffApp","make_fun_by_new_variable"]:metID,
   13.70          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   13.71            ("#Find"  ,["functionEq f_1"])],
   13.72 @@ -168,7 +168,7 @@
   13.73            "                (SubProblem (DiffApp',[univariate,equation],[no_met])" ^
   13.74            "                    [BOOL e_2, REAL v_2])" ^
   13.75            "in Substitute [(v_1 = (rhs o hd) s_1),(v_2 = (rhs o hd) s_2)] h_h)"),
   13.76 -    prep_met thy "met_diffapp_funexp" [] e_metID
   13.77 +    Specify.prep_met thy "met_diffapp_funexp" [] e_metID
   13.78        (["DiffApp","make_fun_by_explicit"]:metID,
   13.79          [("#Given" ,["functionOf f_f","boundVariable v_v","equalities eqs"]),
   13.80            ("#Find"  ,["functionEq f_1"])],
   13.81 @@ -184,14 +184,14 @@
   13.82            "              (SubProblem(DiffApp',[univariate,equation],[no_met])" ^
   13.83            "                          [BOOL e_1, REAL v_1])                 " ^
   13.84            " in Substitute [(v_1 = (rhs o hd) s_1)] h_h)                       "),
   13.85 -    prep_met thy "met_diffapp_max_oninterval" [] e_metID
   13.86 +    Specify.prep_met thy "met_diffapp_max_oninterval" [] e_metID
   13.87        (["DiffApp","max_on_interval_by_calculus"]:metID,
   13.88          [("#Given" ,["functionEq t_t","boundVariable v_v","interval i_tv"(*, "errorBound e_rr"*)]),
   13.89            ("#Find"  ,["maxArgument v_0"])],
   13.90        {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = e_rls,prls=e_rls, crls = eval_rls,
   13.91          errpats = [], nrls = norm_Rational (*, asm_rls=[],asm_thm=[]*)},
   13.92        "empty_script"),
   13.93 -    prep_met thy "met_diffapp_findvals" [] e_metID
   13.94 +    Specify.prep_met thy "met_diffapp_findvals" [] e_metID
   13.95        (["DiffApp","find_values"]:metID, [],
   13.96          {rew_ord'="tless_true",rls'=eval_rls,calc=[],srls = e_rls,prls=e_rls, crls = eval_rls,
   13.97            errpats = [], nrls = norm_Rational(*, asm_rls = [], asm_thm = []*)},
    14.1 --- a/src/Tools/isac/Knowledge/DiophantEq.thy	Wed Dec 14 14:20:25 2016 +0100
    14.2 +++ b/src/Tools/isac/Knowledge/DiophantEq.thy	Sun Dec 18 16:27:41 2016 +0100
    14.3 @@ -20,7 +20,7 @@
    14.4  
    14.5  text {*problemclass for the usecase*}
    14.6  setup {* KEStore_Elems.add_pbts
    14.7 -  [(prep_pbt thy "pbl_equ_dio" [] e_pblID
    14.8 +  [(Specify.prep_pbt thy "pbl_equ_dio" [] e_pblID
    14.9        (["diophantine","equation"],
   14.10          [("#Given" ,["boolTestGiven e_e","intTestGiven (v_v::int)"]),
   14.11            (*                                      TODO: drop ^^^^^*)
   14.12 @@ -30,7 +30,7 @@
   14.13  
   14.14  text {*method solving the usecase*}
   14.15  setup {* KEStore_Elems.add_mets
   14.16 -  [prep_met thy "met_test_diophant" [] e_metID
   14.17 +  [Specify.prep_met thy "met_test_diophant" [] e_metID
   14.18        (["Test","solve_diophant"]:metID,
   14.19          [("#Given" ,["boolTestGiven e_e","intTestGiven (v_v::int)"]),
   14.20            (*                                      TODO: drop ^^^^^*)
    15.1 --- a/src/Tools/isac/Knowledge/EqSystem.thy	Wed Dec 14 14:20:25 2016 +0100
    15.2 +++ b/src/Tools/isac/Knowledge/EqSystem.thy	Sun Dec 18 16:27:41 2016 +0100
    15.3 @@ -412,18 +412,18 @@
    15.4  
    15.5  (** problems **)
    15.6  setup {* KEStore_Elems.add_pbts
    15.7 -  [(prep_pbt thy "pbl_equsys" [] e_pblID
    15.8 +  [(Specify.prep_pbt thy "pbl_equsys" [] e_pblID
    15.9        (["system"],
   15.10          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
   15.11            ("#Find"  ,["solution ss'''"](*''' is copy-named*))],
   15.12          append_rls "e_rls" e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])),
   15.13 -    (prep_pbt thy "pbl_equsys_lin" [] e_pblID
   15.14 +    (Specify.prep_pbt thy "pbl_equsys_lin" [] e_pblID
   15.15        (["LINEAR", "system"],
   15.16          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
   15.17            (*TODO.WN050929 check linearity*)
   15.18            ("#Find"  ,["solution ss'''"])],
   15.19          append_rls "e_rls" e_rls [(*for preds in where_*)], SOME "solveSystem e_s v_s", [])),
   15.20 -    (prep_pbt thy "pbl_equsys_lin_2x2" [] e_pblID
   15.21 +    (Specify.prep_pbt thy "pbl_equsys_lin_2x2" [] e_pblID
   15.22        (["2x2", "LINEAR", "system"],
   15.23        (*~~~~~~~~~~~~~~~~~~~~~~~~~*)
   15.24          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
   15.25 @@ -435,7 +435,7 @@
   15.26  			      Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   15.27  			      Calc ("HOL.eq",eval_equal "#equal_")], 
   15.28          SOME "solveSystem e_s v_s", [])),
   15.29 -    (prep_pbt thy "pbl_equsys_lin_2x2_tri" [] e_pblID
   15.30 +    (Specify.prep_pbt thy "pbl_equsys_lin_2x2_tri" [] e_pblID
   15.31        (["triangular", "2x2", "LINEAR", "system"],
   15.32          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
   15.33            ("#Where",
   15.34 @@ -443,14 +443,14 @@
   15.35                "    v_s  from v_s occur_exactly_in (NTH 2 (e_s::bool list))"]),
   15.36            ("#Find"  ,["solution ss'''"])],
   15.37          prls_triangular, SOME "solveSystem e_s v_s", [["EqSystem","top_down_substitution","2x2"]])),
   15.38 -    (prep_pbt thy "pbl_equsys_lin_2x2_norm" [] e_pblID
   15.39 +    (Specify.prep_pbt thy "pbl_equsys_lin_2x2_norm" [] e_pblID
   15.40        (["normalize", "2x2", "LINEAR", "system"],
   15.41          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
   15.42            ("#Find"  ,["solution ss'''"])],
   15.43        append_rls "e_rls" e_rls [(*for preds in where_*)], 
   15.44        SOME "solveSystem e_s v_s", 
   15.45        [["EqSystem","normalize","2x2"]])),
   15.46 -    (prep_pbt thy "pbl_equsys_lin_3x3" [] e_pblID
   15.47 +    (Specify.prep_pbt thy "pbl_equsys_lin_3x3" [] e_pblID
   15.48        (["3x3", "LINEAR", "system"],
   15.49          (*~~~~~~~~~~~~~~~~~~~~~~~~~*)
   15.50          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
   15.51 @@ -462,7 +462,7 @@
   15.52  			      Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   15.53  			      Calc ("HOL.eq",eval_equal "#equal_")],
   15.54          SOME "solveSystem e_s v_s", [])),
   15.55 -    (prep_pbt thy "pbl_equsys_lin_4x4" [] e_pblID
   15.56 +    (Specify.prep_pbt thy "pbl_equsys_lin_4x4" [] e_pblID
   15.57        (["4x4", "LINEAR", "system"],
   15.58          (*~~~~~~~~~~~~~~~~~~~~~~~~~*)
   15.59          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
   15.60 @@ -474,7 +474,7 @@
   15.61  			      Calc ("Groups.plus_class.plus", eval_binop "#add_"),
   15.62  			      Calc ("HOL.eq",eval_equal "#equal_")],
   15.63          SOME "solveSystem e_s v_s", [])),
   15.64 -    (prep_pbt thy "pbl_equsys_lin_4x4_tri" [] e_pblID
   15.65 +    (Specify.prep_pbt thy "pbl_equsys_lin_4x4_tri" [] e_pblID
   15.66        (["triangular", "4x4", "LINEAR", "system"],
   15.67          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
   15.68            ("#Where" , (*accepts missing variables up to diagional form*)
   15.69 @@ -487,7 +487,7 @@
   15.70  	      [Calc ("Atools.occurs'_in",eval_occurs_in "")], 
   15.71        SOME "solveSystem e_s v_s", 
   15.72        [["EqSystem","top_down_substitution","4x4"]])),
   15.73 -    (prep_pbt thy "pbl_equsys_lin_4x4_norm" [] e_pblID
   15.74 +    (Specify.prep_pbt thy "pbl_equsys_lin_4x4_norm" [] e_pblID
   15.75        (["normalize", "4x4", "LINEAR", "system"],
   15.76          [("#Given" ,["equalities e_s", "solveForVars v_s"]),
   15.77            (*LENGTH is checked 1 level above*)
   15.78 @@ -516,17 +516,17 @@
   15.79  
   15.80  (**methods**)
   15.81  setup {* KEStore_Elems.add_mets
   15.82 -  [prep_met thy "met_eqsys" [] e_metID
   15.83 +  [Specify.prep_met thy "met_eqsys" [] e_metID
   15.84  	    (["EqSystem"], [],
   15.85  	      {rew_ord'="tless_true", rls' = Erls, calc = [], srls = Erls, prls = Erls, crls = Erls,
   15.86            errpats = [], nrls = Erls},
   15.87  	      "empty_script"),
   15.88 -    prep_met thy "met_eqsys_topdown" [] e_metID
   15.89 +    Specify.prep_met thy "met_eqsys_topdown" [] e_metID
   15.90        (["EqSystem","top_down_substitution"], [],
   15.91          {rew_ord'="tless_true", rls' = Erls, calc = [], srls = Erls, prls = Erls, crls = Erls,
   15.92            errpats = [], nrls = Erls},
   15.93         "empty_script"),
   15.94 -    prep_met thy "met_eqsys_topdown_2x2" [] e_metID
   15.95 +    Specify.prep_met thy "met_eqsys_topdown_2x2" [] e_metID
   15.96        (["EqSystem", "top_down_substitution", "2x2"],
   15.97          [("#Given", ["equalities e_s", "solveForVars v_s"]),
   15.98            ("#Where",
   15.99 @@ -572,12 +572,12 @@
  15.100            "       (Try (Rewrite_Set_Inst [(bdv_1, hd v_s),(bdv_2, hd (tl v_s))]" ^
  15.101            "                                  simplify_System False))) e__s)"
  15.102            ---------------------------------------------------------------------------*)),
  15.103 -    prep_met thy "met_eqsys_norm" [] e_metID
  15.104 +    Specify.prep_met thy "met_eqsys_norm" [] e_metID
  15.105  	    (["EqSystem", "normalize"], [],
  15.106  	      {rew_ord'="tless_true", rls' = Erls, calc = [], srls = Erls, prls = Erls, crls = Erls,
  15.107            errpats = [], nrls = Erls},
  15.108  	      "empty_script"),
  15.109 -    prep_met thy "met_eqsys_norm_2x2" [] e_metID
  15.110 +    Specify.prep_met thy "met_eqsys_norm_2x2" [] e_metID
  15.111  	    (["EqSystem","normalize","2x2"],
  15.112  	      [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  15.113  		      ("#Find"  ,["solution ss'''"])],
  15.114 @@ -598,7 +598,7 @@
  15.115            "               (Try (Rewrite_Set order_system False))) e_s                  " ^
  15.116            "   in (SubProblem (EqSystem',[LINEAR,system],[no_met])                      " ^
  15.117            "                  [BOOL_LIST e__s, REAL_LIST v_s]))"),
  15.118 -    prep_met thy "met_eqsys_norm_4x4" [] e_metID
  15.119 +    Specify.prep_met thy "met_eqsys_norm_4x4" [] e_metID
  15.120  	      (["EqSystem","normalize","4x4"],
  15.121  	       [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  15.122  	         ("#Find"  ,["solution ss'''"])],
  15.123 @@ -625,7 +625,7 @@
  15.124             "      (Try (Rewrite_Set order_system False)))                           e_s " ^
  15.125             "   in (SubProblem (EqSystem',[LINEAR,system],[no_met])                      " ^
  15.126             "                  [BOOL_LIST e__s, REAL_LIST v_s]))"),
  15.127 -    prep_met thy "met_eqsys_topdown_4x4" [] e_metID
  15.128 +    Specify.prep_met thy "met_eqsys_topdown_4x4" [] e_metID
  15.129  	    (["EqSystem","top_down_substitution","4x4"],
  15.130  	      [("#Given" ,["equalities e_s", "solveForVars v_s"]),
  15.131  	        ("#Where" , (*accepts missing variables up to diagonal form*)
    16.1 --- a/src/Tools/isac/Knowledge/Equation.thy	Wed Dec 14 14:20:25 2016 +0100
    16.2 +++ b/src/Tools/isac/Knowledge/Equation.thy	Sun Dec 18 16:27:41 2016 +0100
    16.3 @@ -48,14 +48,14 @@
    16.4  setup {* KEStore_Elems.add_rlss [("univariate_equation_prls",
    16.5    (Context.theory_name @{theory}, prep_rls @{theory} univariate_equation_prls))] *}
    16.6  setup {* KEStore_Elems.add_pbts
    16.7 -  [(prep_pbt thy "pbl_equ" [] e_pblID
    16.8 +  [(Specify.prep_pbt thy "pbl_equ" [] e_pblID
    16.9        (["equation"],
   16.10          [("#Given" ,["equality e_e","solveFor v_v"]),
   16.11            ("#Where" ,["matches (?a = ?b) e_e"]),
   16.12            ("#Find"  ,["solutions v_v'i'"])],
   16.13          append_rls "equation_prls" e_rls  [Calc ("Tools.matches",eval_matches "")],
   16.14          SOME "solve (e_e::bool, v_v)", [])),
   16.15 -    (prep_pbt thy "pbl_equ_univ" [] e_pblID
   16.16 +    (Specify.prep_pbt thy "pbl_equ_univ" [] e_pblID
   16.17        (["univariate","equation"],
   16.18          [("#Given" ,["equality e_e","solveFor v_v"]),
   16.19            ("#Where" ,["matches (?a = ?b) e_e"]),
   16.20 @@ -86,7 +86,7 @@
   16.21  
   16.22  
   16.23  setup {* KEStore_Elems.add_mets
   16.24 -  [prep_met thy "met_equ" [] e_metID
   16.25 +  [Specify.prep_met thy "met_equ" [] e_metID
   16.26  	    (["Equation"], [],
   16.27  	      {rew_ord'="tless_true", rls'=Erls, calc = [], srls = e_rls, prls=e_rls, crls = Atools_erls,
   16.28            errpats = [], nrls = e_rls},
    17.1 --- a/src/Tools/isac/Knowledge/InsSort.thy	Wed Dec 14 14:20:25 2016 +0100
    17.2 +++ b/src/Tools/isac/Knowledge/InsSort.thy	Sun Dec 18 16:27:41 2016 +0100
    17.3 @@ -71,11 +71,11 @@
    17.4  
    17.5  subsection {* problems *}
    17.6  setup {* KEStore_Elems.add_pbts
    17.7 -  [(prep_pbt @{theory} "pbl_Programming" [] e_pblID 
    17.8 +  [(Specify.prep_pbt @{theory} "pbl_Programming" [] e_pblID 
    17.9       (["Programming"], [], e_rls, NONE, [])),
   17.10 -   (prep_pbt @{theory} "pbl_Prog_sort" [] e_pblID 
   17.11 +   (Specify.prep_pbt @{theory} "pbl_Prog_sort" [] e_pblID 
   17.12       (["SORT","Programming"], [], e_rls, NONE, [])),
   17.13 -   (prep_pbt @{theory} "pbl_Prog_sort_ins" [] e_pblID
   17.14 +   (Specify.prep_pbt @{theory} "pbl_Prog_sort_ins" [] e_pblID
   17.15       (["insertion","SORT","Programming"], 
   17.16       [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])], 
   17.17       e_rls, 
   17.18 @@ -84,16 +84,16 @@
   17.19  subsection {* methods *}
   17.20  (* TODO: implementation needs extra object-level lists ?!?*)
   17.21  setup {* KEStore_Elems.add_mets
   17.22 -  [ prep_met @{theory} "met_Programming" [] e_metID
   17.23 +  [ Specify.prep_met @{theory} "met_Programming" [] e_metID
   17.24        (["Programming"], [],
   17.25          {rew_ord'="tless_true",rls' = e_rls, calc = [], srls = e_rls, prls = e_rls,
   17.26            crls = e_rls, errpats = [], nrls = e_rls}, "empty_script"),
   17.27 -    prep_met @{theory} "met_Prog_sort" [] e_metID
   17.28 +    Specify.prep_met @{theory} "met_Prog_sort" [] e_metID
   17.29        (["Programming","SORT"], [],
   17.30          {rew_ord'="tless_true",rls' = e_rls, calc = [], srls = e_rls, prls = e_rls,
   17.31            crls = e_rls, errpats = [], nrls = e_rls},
   17.32          "empty_script"),
   17.33 -    prep_met @{theory} "met_Prog_sort_ins" [] e_metID
   17.34 +    Specify.prep_met @{theory} "met_Prog_sort_ins" [] e_metID
   17.35        (["Programming","SORT","insertion"], 
   17.36        [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])],
   17.37          {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = e_rls, prls = e_rls,
   17.38 @@ -103,7 +103,7 @@
   17.39          "  in " ^
   17.40          "    (Rewrite_Set ins_sort False) uns" ^
   17.41          "  )"),
   17.42 -    prep_met @{theory} "met_Prog_sort_ins_steps" [] e_metID
   17.43 +    Specify.prep_met @{theory} "met_Prog_sort_ins_steps" [] e_metID
   17.44        (["Programming","SORT","insertion_steps"], 
   17.45        [("#Given", ["unsorted u_u"]), ("#Find", ["sorted s_s"])],
   17.46          {rew_ord'="tless_true",rls' = Atools_erls, calc = [], srls = e_rls, prls = e_rls,
    18.1 --- a/src/Tools/isac/Knowledge/Integrate.thy	Wed Dec 14 14:20:25 2016 +0100
    18.2 +++ b/src/Tools/isac/Knowledge/Integrate.thy	Sun Dec 18 16:27:41 2016 +0100
    18.3 @@ -338,7 +338,7 @@
    18.4  
    18.5  (** problems **)
    18.6  setup {* KEStore_Elems.add_pbts
    18.7 -  [(prep_pbt thy "pbl_fun_integ" [] e_pblID
    18.8 +  [(Specify.prep_pbt thy "pbl_fun_integ" [] e_pblID
    18.9        (["integrate","function"],
   18.10          [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
   18.11            ("#Find"  ,["antiDerivative F_F"])],
   18.12 @@ -346,7 +346,7 @@
   18.13          SOME "Integrate (f_f, v_v)", 
   18.14          [["diff","integration"]])),
   18.15      (*here "named" is used differently from Differentiation"*)
   18.16 -    (prep_pbt thy "pbl_fun_integ_nam" [] e_pblID
   18.17 +    (Specify.prep_pbt thy "pbl_fun_integ_nam" [] e_pblID
   18.18        (["named","integrate","function"],
   18.19          [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
   18.20            ("#Find"  ,["antiDerivativeName F_F"])],
   18.21 @@ -356,7 +356,7 @@
   18.22  
   18.23  (** methods **)
   18.24  setup {* KEStore_Elems.add_mets
   18.25 -  [prep_met thy "met_diffint" [] e_metID
   18.26 +  [Specify.prep_met thy "met_diffint" [] e_metID
   18.27  	    (["diff","integration"],
   18.28  	      [("#Given" ,["functionTerm f_f", "integrateBy v_v"]), ("#Find"  ,["antiDerivative F_F"])],
   18.29  	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = e_rls, prls=e_rls,
   18.30 @@ -364,7 +364,7 @@
   18.31  	      "Script IntegrationScript (f_f::real) (v_v::real) =                " ^
   18.32            "  (let t_t = Take (Integral f_f D v_v)                             " ^
   18.33            "   in (Rewrite_Set_Inst [(bdv,v_v)] integration False) (t_t::real))"),
   18.34 -    prep_met thy "met_diffint_named" [] e_metID
   18.35 +    Specify.prep_met thy "met_diffint_named" [] e_metID
   18.36  	    (["diff","integration","named"],
   18.37  	      [("#Given" ,["functionTerm f_f", "integrateBy v_v"]),
   18.38  	        ("#Find"  ,["antiDerivativeName F_F"])],
    19.1 --- a/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy	Wed Dec 14 14:20:25 2016 +0100
    19.2 +++ b/src/Tools/isac/Knowledge/Inverse_Z_Transform.thy	Sun Dec 18 16:27:41 2016 +0100
    19.3 @@ -47,10 +47,10 @@
    19.4  val thy = @{theory};
    19.5  *}
    19.6  setup {* KEStore_Elems.add_pbts
    19.7 -  [(prep_pbt thy "pbl_SP" [] e_pblID (["SignalProcessing"], [], e_rls, NONE, [])),
    19.8 -    (prep_pbt thy "pbl_SP_Ztrans" [] e_pblID
    19.9 +  [(Specify.prep_pbt thy "pbl_SP" [] e_pblID (["SignalProcessing"], [], e_rls, NONE, [])),
   19.10 +    (Specify.prep_pbt thy "pbl_SP_Ztrans" [] e_pblID
   19.11        (["Z_Transform","SignalProcessing"], [], e_rls, NONE, [])),
   19.12 -    (prep_pbt thy "pbl_SP_Ztrans_inv" [] e_pblID
   19.13 +    (Specify.prep_pbt thy "pbl_SP_Ztrans_inv" [] e_pblID
   19.14        (["Inverse", "Z_Transform", "SignalProcessing"],
   19.15          (*^ capital letter breaks coding standard
   19.16            because "inverse" = Const ("Rings.inverse_class.inverse", ..*)
   19.17 @@ -58,7 +58,7 @@
   19.18            ("#Find"  ,["stepResponse (n_eq::bool)"])],
   19.19          append_rls "e_rls" e_rls [(*for preds in where_*)], NONE, 
   19.20          [["SignalProcessing","Z_Transform","Inverse"]])),
   19.21 -    (prep_pbt thy "pbl_SP_Ztrans_inv" [] e_pblID
   19.22 +    (Specify.prep_pbt thy "pbl_SP_Ztrans_inv" [] e_pblID
   19.23        (["Inverse", "Z_Transform", "SignalProcessing"],
   19.24          [("#Given" ,["filterExpression X_eq"]),
   19.25            ("#Find"  ,["stepResponse n_eq"])],
   19.26 @@ -73,15 +73,15 @@
   19.27  subsection {*Setup Parent Nodes in Hierarchy of Method*}
   19.28  ML {* val thy = @{theory}; (*latest version of thy required*) *}
   19.29  setup {* KEStore_Elems.add_mets
   19.30 -  [prep_met thy "met_SP" [] e_metID
   19.31 +  [Specify.prep_met thy "met_SP" [] e_metID
   19.32        (["SignalProcessing"], [],
   19.33          {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls, crls = e_rls,
   19.34            errpats = [], nrls = e_rls}, "empty_script"),
   19.35 -    prep_met thy "met_SP_Ztrans" [] e_metID
   19.36 +    Specify.prep_met thy "met_SP_Ztrans" [] e_metID
   19.37        (["SignalProcessing", "Z_Transform"], [],
   19.38          {rew_ord'="tless_true", rls'= e_rls, calc = [], srls = e_rls, prls = e_rls, crls = e_rls,
   19.39            errpats = [], nrls = e_rls}, "empty_script"),
   19.40 -    prep_met thy "met_SP_Ztrans_inv" [] e_metID
   19.41 +    Specify.prep_met thy "met_SP_Ztrans_inv" [] e_metID
   19.42        (["SignalProcessing", "Z_Transform", "Inverse"], 
   19.43          [("#Given" ,["filterExpression (X_eq::bool)"]),
   19.44            ("#Find"  ,["stepResponse (n_eq::bool)"])],
   19.45 @@ -102,7 +102,7 @@
   19.46            "                         [Test,solve_linear])              " ^
   19.47            "                        [BOOL equ, REAL z])              " ^
   19.48            "  in X)"),
   19.49 -    prep_met thy "met_SP_Ztrans_inv" [] e_metID
   19.50 +    Specify.prep_met thy "met_SP_Ztrans_inv" [] e_metID
   19.51        (["SignalProcessing", "Z_Transform", "Inverse"], 
   19.52          [("#Given" ,["filterExpression X_eq"]),
   19.53            ("#Find"  ,["stepResponse n_eq"])],
   19.54 @@ -175,7 +175,7 @@
   19.55             "      (n_eq::bool) = (Rewrite_Set inverse_z False) X_z;        "^
   19.56             "      n_eq = drop_questionmarks n_eq                           "^
   19.57             "in n_eq)"),
   19.58 -    prep_met thy "met_SP_Ztrans_inv_sub" [] e_metID
   19.59 +    Specify.prep_met thy "met_SP_Ztrans_inv_sub" [] e_metID
   19.60        (["SignalProcessing", "Z_Transform", "Inverse_sub"], 
   19.61          [("#Given" ,["filterExpression X_eq"]),
   19.62            ("#Find"  ,["stepResponse n_eq"])],
    20.1 --- a/src/Tools/isac/Knowledge/LinEq.thy	Wed Dec 14 14:20:25 2016 +0100
    20.2 +++ b/src/Tools/isac/Knowledge/LinEq.thy	Sun Dec 18 16:27:41 2016 +0100
    20.3 @@ -121,7 +121,7 @@
    20.4  (*----------------------------- problem types --------------------------------*)
    20.5  (* ---------linear----------- *)
    20.6  setup {* KEStore_Elems.add_pbts
    20.7 -  [(prep_pbt thy "pbl_equ_univ_lin" [] e_pblID
    20.8 +  [(Specify.prep_pbt thy "pbl_equ_univ_lin" [] e_pblID
    20.9        (["LINEAR", "univariate", "equation"],
   20.10          [("#Given" ,["equality e_e", "solveFor v_v"]),
   20.11            ("#Where" ,["HOL.False", (*WN0509 just detected: this pbl can never be used?!?*)
   20.12 @@ -134,13 +134,13 @@
   20.13  
   20.14  (*-------------- methods------------------------------------------------------*)
   20.15  setup {* KEStore_Elems.add_mets
   20.16 -  [prep_met thy "met_eqlin" [] e_metID
   20.17 +  [Specify.prep_met thy "met_eqlin" [] e_metID
   20.18        (["LinEq"], [],
   20.19          {rew_ord' = "tless_true",rls' = Atools_erls,calc = [], srls = e_rls, prls = e_rls,
   20.20            crls = LinEq_crls, errpats = [], nrls = norm_Poly},
   20.21          "empty_script"),
   20.22      (* ansprechen mit ["LinEq","solve_univar_equation"] *)
   20.23 -    prep_met thy "met_eq_lin" [] e_metID
   20.24 +    Specify.prep_met thy "met_eq_lin" [] e_metID
   20.25        (["LinEq","solve_lineq_equation"],
   20.26          [("#Given", ["equality e_e", "solveFor v_v"]),
   20.27            ("#Where", ["Not ((lhs e_e) is_polyrat_in v_v)", "((lhs e_e)  has_degree_in v_v) = 1"]),
   20.28 @@ -159,7 +159,7 @@
   20.29            "            (Repeat(Try (Rewrite_Set LinPoly_simplify     False)))) e_e " ^
   20.30            " in ((Or_to_List e_e)::bool list))")]
   20.31  *}
   20.32 -ML {* get_met' @{theory} ["LinEq","solve_lineq_equation"]; *}
   20.33 +ML {* Specify.get_met' @{theory} ["LinEq","solve_lineq_equation"]; *}
   20.34  
   20.35  end
   20.36  
    21.1 --- a/src/Tools/isac/Knowledge/LogExp.thy	Wed Dec 14 14:20:25 2016 +0100
    21.2 +++ b/src/Tools/isac/Knowledge/LogExp.thy	Sun Dec 18 16:27:41 2016 +0100
    21.3 @@ -29,7 +29,7 @@
    21.4  *}
    21.5  (** problems **)
    21.6  setup {* KEStore_Elems.add_pbts
    21.7 -  [(prep_pbt thy "pbl_test_equ_univ_log" [] e_pblID
    21.8 +  [(Specify.prep_pbt thy "pbl_test_equ_univ_log" [] e_pblID
    21.9        (["logarithmic","univariate","equation"],
   21.10          [("#Given",["equality e_e","solveFor v_v"]),
   21.11            ("#Where",["matches ((?a log ?v_v) = ?b) e_e"]),
   21.12 @@ -40,7 +40,7 @@
   21.13  
   21.14  (** methods **)
   21.15  setup {* KEStore_Elems.add_mets
   21.16 -  [prep_met thy "met_equ_log" [] e_metID
   21.17 +  [Specify.prep_met thy "met_equ_log" [] e_metID
   21.18        (["Equation","solve_log"],
   21.19          [("#Given" ,["equality e_e","solveFor v_v"]),
   21.20            ("#Where" ,["matches ((?a log ?v_v) = ?b) e_e"]),
    22.1 --- a/src/Tools/isac/Knowledge/Partial_Fractions.thy	Wed Dec 14 14:20:25 2016 +0100
    22.2 +++ b/src/Tools/isac/Knowledge/Partial_Fractions.thy	Sun Dec 18 16:27:41 2016 +0100
    22.3 @@ -170,7 +170,7 @@
    22.4  check_guhs_unique := false; (*WN120307 REMOVE after editing*)
    22.5  *}
    22.6  setup {* KEStore_Elems.add_pbts
    22.7 -  [(prep_pbt @{theory} "pbl_simp_rat_partfrac" [] e_pblID
    22.8 +  [(Specify.prep_pbt @{theory} "pbl_simp_rat_partfrac" [] e_pblID
    22.9        (["partial_fraction", "rational", "simplification"],
   22.10          [("#Given" ,["functionTerm t_t", "solveFor v_v"]),
   22.11            (* TODO: call this sub-problem with appropriate functionTerm: 
   22.12 @@ -226,7 +226,7 @@
   22.13  
   22.14  (* current version, error outcommented *)
   22.15  setup {* KEStore_Elems.add_mets
   22.16 -  [prep_met @{theory} "met_partial_fraction" [] e_metID
   22.17 +  [Specify.prep_met @{theory} "met_partial_fraction" [] e_metID
   22.18        (["simplification","of_rationals","to_partial_fraction"], 
   22.19          [("#Given" ,["functionTerm t_t", "solveFor v_v"]),
   22.20            (*("#Where" ,["((get_numerator t_t) has_degree_in v_v) < 
    23.1 --- a/src/Tools/isac/Knowledge/Poly.thy	Wed Dec 14 14:20:25 2016 +0100
    23.2 +++ b/src/Tools/isac/Knowledge/Poly.thy	Sun Dec 18 16:27:41 2016 +0100
    23.3 @@ -1596,7 +1596,7 @@
    23.4  
    23.5  (** problems **)
    23.6  setup {* KEStore_Elems.add_pbts
    23.7 -  [(prep_pbt thy "pbl_simp_poly" [] e_pblID
    23.8 +  [(Specify.prep_pbt thy "pbl_simp_poly" [] e_pblID
    23.9        (["polynomial","simplification"],
   23.10          [("#Given" ,["Term t_t"]),
   23.11            ("#Where" ,["t_t is_polyexp"]),
   23.12 @@ -1607,7 +1607,7 @@
   23.13          [["simplification","for_polynomials"]]))] *}
   23.14  (** methods **)
   23.15  setup {* KEStore_Elems.add_mets
   23.16 -  [prep_met thy "met_simp_poly" [] e_metID
   23.17 +  [Specify.prep_met thy "met_simp_poly" [] e_metID
   23.18  	    (["simplification","for_polynomials"],
   23.19  	      [("#Given" ,["Term t_t"]),
   23.20  	        ("#Where" ,["t_t is_polyexp"]),
    24.1 --- a/src/Tools/isac/Knowledge/PolyEq.thy	Wed Dec 14 14:20:25 2016 +0100
    24.2 +++ b/src/Tools/isac/Knowledge/PolyEq.thy	Sun Dec 18 16:27:41 2016 +0100
    24.3 @@ -843,7 +843,7 @@
    24.4  *)
    24.5  *}
    24.6  setup {* KEStore_Elems.add_pbts
    24.7 -  [(prep_pbt thy "pbl_equ_univ_poly" [] e_pblID
    24.8 +  [(Specify.prep_pbt thy "pbl_equ_univ_poly" [] e_pblID
    24.9        (["polynomial","univariate","equation"],
   24.10          [("#Given" ,["equality e_e","solveFor v_v"]),
   24.11            ("#Where" ,["~((e_e::bool) is_ratequation_in (v_v::real))",
   24.12 @@ -852,7 +852,7 @@
   24.13            ("#Find"  ,["solutions v_v'i'"])],
   24.14          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [])),
   24.15      (*--- d0 ---*)
   24.16 -    (prep_pbt thy "pbl_equ_univ_poly_deg0" [] e_pblID
   24.17 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg0" [] e_pblID
   24.18        (["degree_0","polynomial","univariate","equation"],
   24.19          [("#Given" ,["equality e_e","solveFor v_v"]),
   24.20            ("#Where" ,["matches (?a = 0) e_e",
   24.21 @@ -861,7 +861,7 @@
   24.22            ("#Find"  ,["solutions v_v'i'"])],
   24.23          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d0_polyeq_equation"]])),
   24.24      (*--- d1 ---*)
   24.25 -    (prep_pbt thy "pbl_equ_univ_poly_deg1" [] e_pblID
   24.26 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg1" [] e_pblID
   24.27        (["degree_1","polynomial","univariate","equation"],
   24.28          [("#Given" ,["equality e_e","solveFor v_v"]),
   24.29            ("#Where" ,["matches (?a = 0) e_e",
   24.30 @@ -870,7 +870,7 @@
   24.31            ("#Find"  ,["solutions v_v'i'"])],
   24.32          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d1_polyeq_equation"]])),
   24.33      (*--- d2 ---*)
   24.34 -    (prep_pbt thy "pbl_equ_univ_poly_deg2" [] e_pblID
   24.35 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2" [] e_pblID
   24.36        (["degree_2","polynomial","univariate","equation"],
   24.37          [("#Given" ,["equality e_e","solveFor v_v"]),
   24.38            ("#Where" ,["matches (?a = 0) e_e",
   24.39 @@ -878,7 +878,7 @@
   24.40  	          "((lhs e_e) has_degree_in v_v ) = 2"]),
   24.41            ("#Find"  ,["solutions v_v'i'"])],
   24.42          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_equation"]])),
   24.43 -    (prep_pbt thy "pbl_equ_univ_poly_deg2_sqonly" [] e_pblID
   24.44 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_sqonly" [] e_pblID
   24.45        (["sq_only","degree_2","polynomial","univariate","equation"],
   24.46          [("#Given" ,["equality e_e","solveFor v_v"]),
   24.47            ("#Where" ,["matches ( ?a +    ?v_^^^2 = 0) e_e | " ^
   24.48 @@ -896,7 +896,7 @@
   24.49            ("#Find"  ,["solutions v_v'i'"])],
   24.50          PolyEq_prls, SOME "solve (e_e::bool, v_v)",
   24.51          [["PolyEq","solve_d2_polyeq_sqonly_equation"]])),
   24.52 -    (prep_pbt thy "pbl_equ_univ_poly_deg2_bdvonly" [] e_pblID
   24.53 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_bdvonly" [] e_pblID
   24.54        (["bdv_only","degree_2","polynomial","univariate","equation"],
   24.55          [("#Given", ["equality e_e","solveFor v_v"]),
   24.56            ("#Where", ["matches (?a*?v_ +    ?v_^^^2 = 0) e_e | " ^
   24.57 @@ -908,14 +908,14 @@
   24.58            ("#Find", ["solutions v_v'i'"])],
   24.59          PolyEq_prls, SOME "solve (e_e::bool, v_v)",
   24.60          [["PolyEq","solve_d2_polyeq_bdvonly_equation"]])),
   24.61 -    (prep_pbt thy "pbl_equ_univ_poly_deg2_pq" [] e_pblID
   24.62 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_pq" [] e_pblID
   24.63        (["pqFormula","degree_2","polynomial","univariate","equation"],
   24.64          [("#Given", ["equality e_e","solveFor v_v"]),
   24.65            ("#Where", ["matches (?a + 1*?v_^^^2 = 0) e_e | " ^
   24.66  	          "matches (?a +   ?v_^^^2 = 0) e_e"]),
   24.67            ("#Find", ["solutions v_v'i'"])],
   24.68          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_pq_equation"]])),
   24.69 -    (prep_pbt thy "pbl_equ_univ_poly_deg2_abc" [] e_pblID
   24.70 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg2_abc" [] e_pblID
   24.71        (["abcFormula","degree_2","polynomial","univariate","equation"],
   24.72          [("#Given", ["equality e_e","solveFor v_v"]),
   24.73            ("#Where", ["matches (?a +    ?v_^^^2 = 0) e_e | " ^
   24.74 @@ -923,7 +923,7 @@
   24.75            ("#Find", ["solutions v_v'i'"])],
   24.76          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d2_polyeq_abc_equation"]])),
   24.77      (*--- d3 ---*)
   24.78 -    (prep_pbt thy "pbl_equ_univ_poly_deg3" [] e_pblID
   24.79 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg3" [] e_pblID
   24.80        (["degree_3","polynomial","univariate","equation"],
   24.81          [("#Given", ["equality e_e","solveFor v_v"]),
   24.82            ("#Where", ["matches (?a = 0) e_e",
   24.83 @@ -932,7 +932,7 @@
   24.84            ("#Find", ["solutions v_v'i'"])],
   24.85          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","solve_d3_polyeq_equation"]])),
   24.86      (*--- d4 ---*)
   24.87 -    (prep_pbt thy "pbl_equ_univ_poly_deg4" [] e_pblID
   24.88 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_deg4" [] e_pblID
   24.89        (["degree_4","polynomial","univariate","equation"],
   24.90          [("#Given", ["equality e_e","solveFor v_v"]),
   24.91            ("#Where", ["matches (?a = 0) e_e",
   24.92 @@ -941,7 +941,7 @@
   24.93            ("#Find", ["solutions v_v'i'"])],
   24.94          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [(*["PolyEq","solve_d4_polyeq_equation"]*)])),
   24.95      (*--- normalize ---*)
   24.96 -    (prep_pbt thy "pbl_equ_univ_poly_norm" [] e_pblID
   24.97 +    (Specify.prep_pbt thy "pbl_equ_univ_poly_norm" [] e_pblID
   24.98        (["normalize","polynomial","univariate","equation"],
   24.99          [("#Given", ["equality e_e","solveFor v_v"]),
  24.100            ("#Where", ["(Not((matches (?a = 0 ) e_e ))) |" ^
  24.101 @@ -949,7 +949,7 @@
  24.102            ("#Find", ["solutions v_v'i'"])],
  24.103          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [["PolyEq","normalize_poly"]])),
  24.104      (*-------------------------expanded-----------------------*)
  24.105 -    (prep_pbt thy "pbl_equ_univ_expand" [] e_pblID
  24.106 +    (Specify.prep_pbt thy "pbl_equ_univ_expand" [] e_pblID
  24.107        (["expanded","univariate","equation"],
  24.108          [("#Given", ["equality e_e","solveFor v_v"]),
  24.109            ("#Where", ["matches (?a = 0) e_e",
  24.110 @@ -957,7 +957,7 @@
  24.111            ("#Find", ["solutions v_v'i'"])],
  24.112          PolyEq_prls, SOME "solve (e_e::bool, v_v)", [])),
  24.113      (*--- d2 ---*)
  24.114 -    (prep_pbt thy "pbl_equ_univ_expand_deg2" [] e_pblID
  24.115 +    (Specify.prep_pbt thy "pbl_equ_univ_expand_deg2" [] e_pblID
  24.116        (["degree_2","expanded","univariate","equation"],
  24.117          [("#Given", ["equality e_e","solveFor v_v"]),
  24.118            ("#Where", ["((lhs e_e) has_degree_in v_v) = 2"]),
  24.119 @@ -980,12 +980,12 @@
  24.120  
  24.121  text {* "-------------------------methods-----------------------" *}
  24.122  setup {* KEStore_Elems.add_mets
  24.123 -  [prep_met thy "met_polyeq" [] e_metID
  24.124 +  [Specify.prep_met thy "met_polyeq" [] e_metID
  24.125        (["PolyEq"], [],
  24.126          {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
  24.127            crls=PolyEq_crls, errpats = [], nrls = norm_Rational},
  24.128          "empty_script"),
  24.129 -    prep_met thy "met_polyeq_norm" [] e_metID
  24.130 +    Specify.prep_met thy "met_polyeq_norm" [] e_metID
  24.131        (["PolyEq","normalize_poly"],
  24.132          [("#Given" ,["equality e_e","solveFor v_v"]),
  24.133            ("#Where" ,["(Not((matches (?a = 0 ) e_e ))) |(Not(((lhs e_e) is_poly_in v_v)))"]),
  24.134 @@ -1001,7 +1001,7 @@
  24.135            "          (Try (Repeat (Rewrite_Set polyeq_simplify  False)))) e_e " ^
  24.136            " in (SubProblem (PolyEq',[polynomial,univariate,equation], [no_met])   " ^
  24.137            "                 [BOOL e_e, REAL v_v]))"),
  24.138 -    prep_met thy "met_polyeq_d0" [] e_metID
  24.139 +    Specify.prep_met thy "met_polyeq_d0" [] e_metID
  24.140        (["PolyEq","solve_d0_polyeq_equation"],
  24.141          [("#Given" ,["equality e_e","solveFor v_v"]),
  24.142            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 0"]),
  24.143 @@ -1013,7 +1013,7 @@
  24.144            "(let e_e =  ((Try (Rewrite_Set_Inst [(bdv,v_v::real)]      " ^
  24.145            "                  d0_polyeq_simplify  False))) e_e        " ^
  24.146            " in ((Or_to_List e_e)::bool list))"),
  24.147 -    prep_met thy "met_polyeq_d1" [] e_metID
  24.148 +    Specify.prep_met thy "met_polyeq_d1" [] e_metID
  24.149        (["PolyEq","solve_d1_polyeq_equation"],
  24.150          [("#Given" ,["equality e_e","solveFor v_v"]),
  24.151            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 1"]),
  24.152 @@ -1028,7 +1028,7 @@
  24.153            "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
  24.154            " (L_L::bool list) = ((Or_to_List e_e)::bool list)            " ^
  24.155            " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  24.156 -    prep_met thy "met_polyeq_d22" [] e_metID
  24.157 +    Specify.prep_met thy "met_polyeq_d22" [] e_metID
  24.158        (["PolyEq","solve_d2_polyeq_equation"],
  24.159          [("#Given" ,["equality e_e","solveFor v_v"]),
  24.160            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  24.161 @@ -1046,7 +1046,7 @@
  24.162              "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
  24.163              " (L_L::bool list) = ((Or_to_List e_e)::bool list)              " ^
  24.164              " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  24.165 -    prep_met thy "met_polyeq_d2_bdvonly" [] e_metID
  24.166 +    Specify.prep_met thy "met_polyeq_d2_bdvonly" [] e_metID
  24.167        (["PolyEq","solve_d2_polyeq_bdvonly_equation"],
  24.168          [("#Given" ,["equality e_e","solveFor v_v"]),
  24.169            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  24.170 @@ -1064,7 +1064,7 @@
  24.171              "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
  24.172              " (L_L::bool list) = ((Or_to_List e_e)::bool list)              " ^
  24.173              " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  24.174 -    prep_met thy "met_polyeq_d2_sqonly" [] e_metID
  24.175 +    Specify.prep_met thy "met_polyeq_d2_sqonly" [] e_metID
  24.176        (["PolyEq","solve_d2_polyeq_sqonly_equation"],
  24.177          [("#Given" ,["equality e_e","solveFor v_v"]),
  24.178            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  24.179 @@ -1079,7 +1079,7 @@
  24.180              "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e; " ^
  24.181              " (L_L::bool list) = ((Or_to_List e_e)::bool list)               " ^
  24.182              " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  24.183 -    prep_met thy "met_polyeq_d2_pq" [] e_metID
  24.184 +    Specify.prep_met thy "met_polyeq_d2_pq" [] e_metID
  24.185        (["PolyEq","solve_d2_polyeq_pq_equation"],
  24.186          [("#Given" ,["equality e_e","solveFor v_v"]),
  24.187            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  24.188 @@ -1094,7 +1094,7 @@
  24.189              "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
  24.190              " (L_L::bool list) = ((Or_to_List e_e)::bool list)              " ^
  24.191              " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  24.192 -    prep_met thy "met_polyeq_d2_abc" [] e_metID
  24.193 +    Specify.prep_met thy "met_polyeq_d2_abc" [] e_metID
  24.194        (["PolyEq","solve_d2_polyeq_abc_equation"],
  24.195          [("#Given" ,["equality e_e","solveFor v_v"]),
  24.196            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 2"]),
  24.197 @@ -1109,7 +1109,7 @@
  24.198              "            (Try (Rewrite_Set norm_Rational_parenthesized False))) e_e;" ^
  24.199              " (L_L::bool list) = ((Or_to_List e_e)::bool list)               " ^
  24.200              " in Check_elementwise L_L {(v_v::real). Assumptions} )"),
  24.201 -    prep_met thy "met_polyeq_d3" [] e_metID
  24.202 +    Specify.prep_met thy "met_polyeq_d3" [] e_metID
  24.203        (["PolyEq","solve_d3_polyeq_equation"],
  24.204          [("#Given" ,["equality e_e","solveFor v_v"]),
  24.205            ("#Where" ,["(lhs e_e) is_poly_in v_v ", "((lhs e_e) has_degree_in v_v) = 3"]),
  24.206 @@ -1133,7 +1133,7 @@
  24.207      (*.solves all expanded (ie. normalized) terms of degree 2.*) 
  24.208      (*Oct.02 restriction: 'eval_true 0 =< discriminant' ony for integer values
  24.209        by 'PolyEq_erls'; restricted until Float.thy is implemented*)
  24.210 -    prep_met thy "met_polyeq_complsq" [] e_metID
  24.211 +    Specify.prep_met thy "met_polyeq_complsq" [] e_metID
  24.212        (["PolyEq","complete_square"],
  24.213          [("#Given" ,["equality e_e","solveFor v_v"]),
  24.214            ("#Where" ,["matches (?a = 0) e_e", "((lhs e_e) has_degree_in v_v) = 2"]),
    25.1 --- a/src/Tools/isac/Knowledge/PolyMinus.thy	Wed Dec 14 14:20:25 2016 +0100
    25.2 +++ b/src/Tools/isac/Knowledge/PolyMinus.thy	Sun Dec 18 16:27:41 2016 +0100
    25.3 @@ -397,9 +397,9 @@
    25.4  
    25.5  (** problems **)
    25.6  setup {* KEStore_Elems.add_pbts
    25.7 -  [(prep_pbt thy "pbl_vereinf_poly" [] e_pblID
    25.8 +  [(Specify.prep_pbt thy "pbl_vereinf_poly" [] e_pblID
    25.9        (["polynom","vereinfachen"], [], Erls, NONE, [])),
   25.10 -    (prep_pbt thy "pbl_vereinf_poly_minus" [] e_pblID
   25.11 +    (Specify.prep_pbt thy "pbl_vereinf_poly_minus" [] e_pblID
   25.12        (["plus_minus","polynom","vereinfachen"],
   25.13          [("#Given", ["Term t_t"]),
   25.14            ("#Where", ["t_t is_polyexp",
   25.15 @@ -424,7 +424,7 @@
   25.16              Thm ("not_false",num_str @{thm not_false})
   25.17              (*"(~ False) = True"*)], 
   25.18         SOME "Vereinfache t_t", [["simplification","for_polynomials","with_minus"]])),
   25.19 -    (prep_pbt thy "pbl_vereinf_poly_klammer" [] e_pblID
   25.20 +    (Specify.prep_pbt thy "pbl_vereinf_poly_klammer" [] e_pblID
   25.21        (["klammer","polynom","vereinfachen"],
   25.22          [("#Given" ,["Term t_t"]),
   25.23            ("#Where" ,["t_t is_polyexp",
   25.24 @@ -446,7 +446,7 @@
   25.25               (*"(~ False) = True"*)], 
   25.26          SOME "Vereinfache t_t", 
   25.27          [["simplification","for_polynomials","with_parentheses"]])),
   25.28 -    (prep_pbt thy "pbl_vereinf_poly_klammer_mal" [] e_pblID
   25.29 +    (Specify.prep_pbt thy "pbl_vereinf_poly_klammer_mal" [] e_pblID
   25.30        (["binom_klammer","polynom","vereinfachen"],
   25.31          [("#Given", ["Term t_t"]),
   25.32            ("#Where", ["t_t is_polyexp"]),
   25.33 @@ -455,8 +455,8 @@
   25.34  			      Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
   25.35          SOME "Vereinfache t_t", 
   25.36          [["simplification","for_polynomials","with_parentheses_mult"]])),
   25.37 -    (prep_pbt thy "pbl_probe" [] e_pblID (["probe"], [], Erls, NONE, [])),
   25.38 -    (prep_pbt thy "pbl_probe_poly" [] e_pblID
   25.39 +    (Specify.prep_pbt thy "pbl_probe" [] e_pblID (["probe"], [], Erls, NONE, [])),
   25.40 +    (Specify.prep_pbt thy "pbl_probe_poly" [] e_pblID
   25.41        (["polynom","probe"],
   25.42          [("#Given", ["Pruefe e_e", "mitWert w_w"]),
   25.43            ("#Where", ["e_e is_polyexp"]),
   25.44 @@ -465,7 +465,7 @@
   25.45  		      Calc ("Poly.is'_polyexp", eval_is_polyexp "")], 
   25.46          SOME "Probe e_e w_w", 
   25.47          [["probe","fuer_polynom"]])),
   25.48 -    (prep_pbt thy "pbl_probe_bruch" [] e_pblID
   25.49 +    (Specify.prep_pbt thy "pbl_probe_bruch" [] e_pblID
   25.50        (["bruch","probe"],
   25.51          [("#Given" ,["Pruefe e_e", "mitWert w_w"]),
   25.52            ("#Where" ,["e_e is_ratpolyexp"]),
   25.53 @@ -476,7 +476,7 @@
   25.54  
   25.55  (** methods **)
   25.56  setup {* KEStore_Elems.add_mets
   25.57 -  [prep_met thy "met_simp_poly_minus" [] e_metID
   25.58 +  [Specify.prep_met thy "met_simp_poly_minus" [] e_metID
   25.59  	    (["simplification","for_polynomials","with_minus"],
   25.60  	      [("#Given" ,["Term t_t"]),
   25.61  	        ("#Where" ,["t_t is_polyexp",
   25.62 @@ -502,7 +502,7 @@
   25.63              "  ((Repeat((Try (Rewrite_Set ordne_alphabetisch False)) @@  " ^
   25.64              "           (Try (Rewrite_Set fasse_zusammen     False)) @@  " ^
   25.65              "           (Try (Rewrite_Set verschoenere       False)))) t_t)"),
   25.66 -    prep_met thy "met_simp_poly_parenth" [] e_metID
   25.67 +    Specify.prep_met thy "met_simp_poly_parenth" [] e_metID
   25.68  	    (["simplification","for_polynomials","with_parentheses"],
   25.69  	      [("#Given" ,["Term t_t"]),
   25.70  	        ("#Where" ,["t_t is_polyexp"]),
   25.71 @@ -516,7 +516,7 @@
   25.72            "           (Try (Rewrite_Set ordne_alphabetisch False)) @@  " ^
   25.73            "           (Try (Rewrite_Set fasse_zusammen     False)) @@  " ^
   25.74            "           (Try (Rewrite_Set verschoenere       False)))) t_t)"),
   25.75 -    prep_met thy "met_simp_poly_parenth_mult" [] e_metID
   25.76 +    Specify.prep_met thy "met_simp_poly_parenth_mult" [] e_metID
   25.77  	    (["simplification","for_polynomials","with_parentheses_mult"],
   25.78  	      [("#Given" ,["Term t_t"]), ("#Where" ,["t_t is_polyexp"]), ("#Find"  ,["normalform n_n"])],
   25.79  	        {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, 
   25.80 @@ -531,12 +531,12 @@
   25.81              "           (Try (Rewrite_Set ordne_alphabetisch         False)) @@ " ^
   25.82              "           (Try (Rewrite_Set fasse_zusammen             False)) @@ " ^
   25.83              "           (Try (Rewrite_Set verschoenere               False)))) t_t)"),
   25.84 -    prep_met thy "met_probe" [] e_metID
   25.85 +    Specify.prep_met thy "met_probe" [] e_metID
   25.86  	    (["probe"], [],
   25.87  	      {rew_ord'="tless_true", rls' = e_rls, calc = [], srls = e_rls, prls = Erls, crls = e_rls,
   25.88  	        errpats = [], nrls = Erls}, 
   25.89  	      "empty_script"),
   25.90 -    prep_met thy "met_probe_poly" [] e_metID
   25.91 +    Specify.prep_met thy "met_probe_poly" [] e_metID
   25.92  	    (["probe","fuer_polynom"],
   25.93  	      [("#Given" ,["Pruefe e_e", "mitWert w_w"]),
   25.94  	        ("#Where" ,["e_e is_polyexp"]),
   25.95 @@ -551,7 +551,7 @@
   25.96            " in (Repeat((Try (Repeat (Calculate TIMES))) @@  " ^
   25.97            "            (Try (Repeat (Calculate PLUS ))) @@  " ^
   25.98            "            (Try (Repeat (Calculate MINUS))))) e_e)"),
   25.99 -    prep_met thy "met_probe_bruch" [] e_metID
  25.100 +    Specify.prep_met thy "met_probe_bruch" [] e_metID
  25.101  	    (["probe","fuer_bruch"],
  25.102  	      [("#Given" ,["Pruefe e_e", "mitWert w_w"]),
  25.103  	        ("#Where" ,["e_e is_ratpolyexp"]),
    26.1 --- a/src/Tools/isac/Knowledge/RatEq.thy	Wed Dec 14 14:20:25 2016 +0100
    26.2 +++ b/src/Tools/isac/Knowledge/RatEq.thy	Sun Dec 18 16:27:41 2016 +0100
    26.3 @@ -184,7 +184,7 @@
    26.4  *)
    26.5  *}
    26.6  setup {* KEStore_Elems.add_pbts
    26.7 -  [(prep_pbt thy "pbl_equ_univ_rat" [] e_pblID
    26.8 +  [(Specify.prep_pbt thy "pbl_equ_univ_rat" [] e_pblID
    26.9      (["rational","univariate","equation"],
   26.10        [("#Given", ["equality e_e","solveFor v_v"]),
   26.11          ("#Where", ["(e_e::bool) is_ratequation_in (v_v::real)"]),
   26.12 @@ -193,11 +193,11 @@
   26.13  
   26.14  (*-------------------------methods-----------------------*)
   26.15  setup {* KEStore_Elems.add_mets
   26.16 -  [prep_met thy "met_rateq" [] e_metID
   26.17 +  [Specify.prep_met thy "met_rateq" [] e_metID
   26.18        (["RatEq"], [],
   26.19          {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
   26.20            crls=RatEq_crls, errpats = [], nrls = norm_Rational}, "empty_script"),
   26.21 -    prep_met thy "met_rat_eq" [] e_metID
   26.22 +    Specify.prep_met thy "met_rat_eq" [] e_metID
   26.23        (["RatEq", "solve_rat_equation"],
   26.24          [("#Given" ,["equality e_e","solveFor v_v"]),
   26.25            ("#Where" ,["(e_e::bool) is_ratequation_in (v_v::real)"]),
    27.1 --- a/src/Tools/isac/Knowledge/Rational.thy	Wed Dec 14 14:20:25 2016 +0100
    27.2 +++ b/src/Tools/isac/Knowledge/Rational.thy	Sun Dec 18 16:27:41 2016 +0100
    27.3 @@ -886,7 +886,7 @@
    27.4  
    27.5  section {* A problem for simplification of rationals *}
    27.6  setup {* KEStore_Elems.add_pbts
    27.7 -  [(prep_pbt thy "pbl_simp_rat" [] e_pblID
    27.8 +  [(Specify.prep_pbt thy "pbl_simp_rat" [] e_pblID
    27.9        (["rational","simplification"],
   27.10          [("#Given" ,["Term t_t"]),
   27.11            ("#Where" ,["t_t is_ratpolyexp"]),
   27.12 @@ -898,7 +898,7 @@
   27.13  (*WN061025 this methods script is copied from (auto-generated) script
   27.14    of norm_Rational in order to ease repair on inform*)
   27.15  setup {* KEStore_Elems.add_mets
   27.16 -  [prep_met thy "met_simp_rat" [] e_metID
   27.17 +  [Specify.prep_met thy "met_simp_rat" [] e_metID
   27.18        (["simplification","of_rationals"],
   27.19          [("#Given" ,["Term t_t"]),
   27.20            ("#Where" ,["t_t is_ratpolyexp"]),
    28.1 --- a/src/Tools/isac/Knowledge/RootEq.thy	Wed Dec 14 14:20:25 2016 +0100
    28.2 +++ b/src/Tools/isac/Knowledge/RootEq.thy	Sun Dec 18 16:27:41 2016 +0100
    28.3 @@ -488,7 +488,7 @@
    28.4  *}
    28.5  setup {* KEStore_Elems.add_pbts
    28.6    (* ---------root----------- *)
    28.7 -  [(prep_pbt thy "pbl_equ_univ_root" [] e_pblID
    28.8 +  [(Specify.prep_pbt thy "pbl_equ_univ_root" [] e_pblID
    28.9        (["root'","univariate","equation"],
   28.10          [("#Given" ,["equality e_e","solveFor v_v"]),
   28.11            ("#Where" ,["(lhs e_e) is_rootTerm_in  (v_v::real) | " ^
   28.12 @@ -496,7 +496,7 @@
   28.13            ("#Find"  ,["solutions v_v'i'"])],
   28.14          RootEq_prls, SOME "solve (e_e::bool, v_v)", [])),
   28.15      (* ---------sqrt----------- *)
   28.16 -    (prep_pbt thy "pbl_equ_univ_root_sq" [] e_pblID
   28.17 +    (Specify.prep_pbt thy "pbl_equ_univ_root_sq" [] e_pblID
   28.18        (["sq","root'","univariate","equation"],
   28.19          [("#Given" ,["equality e_e","solveFor v_v"]),
   28.20            ("#Where" ,["( ((lhs e_e) is_sqrtTerm_in (v_v::real)) &" ^
   28.21 @@ -506,7 +506,7 @@
   28.22            ("#Find"  ,["solutions v_v'i'"])],
   28.23            RootEq_prls,  SOME "solve (e_e::bool, v_v)", [["RootEq","solve_sq_root_equation"]])),
   28.24      (* ---------normalize----------- *)
   28.25 -    (prep_pbt thy "pbl_equ_univ_root_norm" [] e_pblID
   28.26 +    (Specify.prep_pbt thy "pbl_equ_univ_root_norm" [] e_pblID
   28.27        (["normalize","root'","univariate","equation"],
   28.28          [("#Given" ,["equality e_e","solveFor v_v"]),
   28.29            ("#Where" ,["( ((lhs e_e) is_sqrtTerm_in (v_v::real)) &" ^
   28.30 @@ -520,12 +520,12 @@
   28.31  (*-------------------------methods-----------------------*)
   28.32  setup {* KEStore_Elems.add_mets
   28.33    [(* ---- root 20.8.02 ---*)
   28.34 -    prep_met thy "met_rooteq" [] e_metID
   28.35 +    Specify.prep_met thy "met_rooteq" [] e_metID
   28.36        (["RootEq"], [],
   28.37          {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
   28.38            crls=RootEq_crls, errpats = [], nrls = norm_Poly}, "empty_script"),
   28.39      (*-- normalize 20.10.02 --*)
   28.40 -    prep_met thy "met_rooteq_norm" [] e_metID
   28.41 +    Specify.prep_met thy "met_rooteq_norm" [] e_metID
   28.42        (["RootEq","norm_sq_root_equation"],
   28.43          [("#Given" ,["equality e_e","solveFor v_v"]),
   28.44            ("#Where" ,["( ((lhs e_e) is_sqrtTerm_in (v_v::real)) &" ^
   28.45 @@ -543,7 +543,7 @@
   28.46            "           (Try (Rewrite_Set rooteq_simplify              True))) e_e " ^
   28.47            " in ((SubProblem (RootEq',[univariate,equation],                     " ^
   28.48            "      [no_met]) [BOOL e_e, REAL v_v])))"),
   28.49 -    prep_met thy "met_rooteq_sq" [] e_metID
   28.50 +    Specify.prep_met thy "met_rooteq_sq" [] e_metID
   28.51        (["RootEq","solve_sq_root_equation"],
   28.52          [("#Given" ,["equality e_e", "solveFor v_v"]),
   28.53            ("#Where" ,["(((lhs e_e) is_sqrtTerm_in (v_v::real))     & " ^
   28.54 @@ -568,7 +568,7 @@
   28.55            "                     [BOOL e_e, REAL v_v]))                             " ^
   28.56            "in Check_elementwise L_L {(v_v::real). Assumptions})"),
   28.57      (*-- right 28.08.02 --*)
   28.58 -    prep_met thy "met_rooteq_sq_right" [] e_metID
   28.59 +    Specify.prep_met thy "met_rooteq_sq_right" [] e_metID
   28.60        (["RootEq","solve_right_sq_root_equation"],
   28.61          [("#Given" ,["equality e_e","solveFor v_v"]),
   28.62            ("#Where" ,["(rhs e_e) is_sqrtTerm_in v_v"]),
   28.63 @@ -588,7 +588,7 @@
   28.64            " else ((SubProblem (RootEq',[univariate,equation],                      " ^
   28.65            "        [no_met]) [BOOL e_e, REAL v_v])))"),
   28.66      (*-- left 28.08.02 --*)
   28.67 -    prep_met thy "met_rooteq_sq_left" [] e_metID
   28.68 +    Specify.prep_met thy "met_rooteq_sq_left" [] e_metID
   28.69        (["RootEq","solve_left_sq_root_equation"],
   28.70          [("#Given" ,["equality e_e","solveFor v_v"]),
   28.71            ("#Where" ,["(lhs e_e) is_sqrtTerm_in v_v"]),
    29.1 --- a/src/Tools/isac/Knowledge/RootRatEq.thy	Wed Dec 14 14:20:25 2016 +0100
    29.2 +++ b/src/Tools/isac/Knowledge/RootRatEq.thy	Sun Dec 18 16:27:41 2016 +0100
    29.3 @@ -140,7 +140,7 @@
    29.4  *)
    29.5  *}
    29.6  setup {* KEStore_Elems.add_pbts
    29.7 -  [(prep_pbt thy "pbl_equ_univ_root_sq_rat" [] e_pblID
    29.8 +  [(Specify.prep_pbt thy "pbl_equ_univ_root_sq_rat" [] e_pblID
    29.9        (["rat","sq","root'","univariate","equation"],
   29.10          [("#Given" ,["equality e_e","solveFor v_v"]),
   29.11            ("#Where" ,["( (lhs e_e) is_rootRatAddTerm_in (v_v::real) )| " ^
   29.12 @@ -150,12 +150,12 @@
   29.13  
   29.14  (*-------------------------Methode-----------------------*)
   29.15  setup {* KEStore_Elems.add_mets
   29.16 -  [prep_met @{theory LinEq} "met_rootrateq" [] e_metID
   29.17 +  [Specify.prep_met @{theory LinEq} "met_rootrateq" [] e_metID
   29.18        (["RootRatEq"], [],
   29.19          {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
   29.20            crls=Atools_erls, errpats = [], nrls = norm_Rational}, "empty_script"),
   29.21      (*-- left 20.10.02 --*)
   29.22 -    prep_met thy "met_rootrateq_elim" [] e_metID
   29.23 +    Specify.prep_met thy "met_rootrateq_elim" [] e_metID
   29.24        (["RootRatEq","elim_rootrat_equation"],
   29.25          [("#Given" ,["equality e_e","solveFor v_v"]),
   29.26            ("#Where" ,["( (lhs e_e) is_rootRatAddTerm_in (v_v::real) ) | " ^
    30.1 --- a/src/Tools/isac/Knowledge/Simplify.thy	Wed Dec 14 14:20:25 2016 +0100
    30.2 +++ b/src/Tools/isac/Knowledge/Simplify.thy	Sun Dec 18 16:27:41 2016 +0100
    30.3 @@ -29,12 +29,12 @@
    30.4  *}
    30.5  (** problems **)
    30.6  setup {* KEStore_Elems.add_pbts
    30.7 -  [(prep_pbt thy "pbl_simp" [] e_pblID
    30.8 +  [(Specify.prep_pbt thy "pbl_simp" [] e_pblID
    30.9        (["simplification"],
   30.10          [("#Given" ,["Term t_t"]),
   30.11            ("#Find"  ,["normalform n_n"])],
   30.12          append_rls "e_rls" e_rls [(*for preds in where_*)], SOME "Simplify t_t", [])),
   30.13 -    (prep_pbt thy "pbl_vereinfache" [] e_pblID
   30.14 +    (Specify.prep_pbt thy "pbl_vereinfache" [] e_pblID
   30.15        (["vereinfachen"],
   30.16          [("#Given", ["Term t_t"]),
   30.17            ("#Find", ["normalform n_n"])],
   30.18 @@ -42,7 +42,7 @@
   30.19  
   30.20  (** methods **)
   30.21  setup {* KEStore_Elems.add_mets
   30.22 -  [prep_met thy "met_tsimp" [] e_metID
   30.23 +  [Specify.prep_met thy "met_tsimp" [] e_metID
   30.24  	    (["simplification"],
   30.25  	      [("#Given" ,["Term t_t"]),
   30.26  		      ("#Find"  ,["normalform n_n"])],
    31.1 --- a/src/Tools/isac/Knowledge/Test.thy	Wed Dec 14 14:20:25 2016 +0100
    31.2 +++ b/src/Tools/isac/Knowledge/Test.thy	Sun Dec 18 16:27:41 2016 +0100
    31.3 @@ -512,20 +512,20 @@
    31.4  
    31.5  (** problem types **)
    31.6  setup {* KEStore_Elems.add_pbts
    31.7 -  [(prep_pbt thy "pbl_test" [] e_pblID (["test"], [], e_rls, NONE, [])),
    31.8 -    (prep_pbt thy "pbl_test_equ" [] e_pblID
    31.9 +  [(Specify.prep_pbt thy "pbl_test" [] e_pblID (["test"], [], e_rls, NONE, [])),
   31.10 +    (Specify.prep_pbt thy "pbl_test_equ" [] e_pblID
   31.11        (["equation","test"],
   31.12          [("#Given" ,["equality e_e","solveFor v_v"]),
   31.13             ("#Where" ,["matches (?a = ?b) e_e"]),
   31.14             ("#Find"  ,["solutions v_v'i'"])],
   31.15          assoc_rls' @{theory} "matches", SOME "solve (e_e::bool, v_v)", [])),
   31.16 -    (prep_pbt thy "pbl_test_uni" [] e_pblID
   31.17 +    (Specify.prep_pbt thy "pbl_test_uni" [] e_pblID
   31.18        (["univariate","equation","test"],
   31.19          [("#Given" ,["equality e_e","solveFor v_v"]),
   31.20             ("#Where" ,["matches (?a = ?b) e_e"]),
   31.21             ("#Find"  ,["solutions v_v'i'"])],
   31.22          assoc_rls' @{theory} "matches", SOME "solve (e_e::bool, v_v)", [])),
   31.23 -    (prep_pbt thy "pbl_test_uni_lin" [] e_pblID
   31.24 +    (Specify.prep_pbt thy "pbl_test_uni_lin" [] e_pblID
   31.25        (["LINEAR","univariate","equation","test"],
   31.26          [("#Given" ,["equality e_e","solveFor v_v"]),
   31.27             ("#Where" ,["(matches (   v_v = 0) e_e) | (matches (   ?b*v_v = 0) e_e) |" ^
   31.28 @@ -533,12 +533,12 @@
   31.29             ("#Find"  ,["solutions v_v'i'"])],
   31.30          assoc_rls' @{theory} "matches", 
   31.31          SOME "solve (e_e::bool, v_v)", [["Test","solve_linear"]]))(*,
   31.32 -    (prep_pbt thy
   31.33 +    (Specify.prep_pbt thy
   31.34        (["thy"],
   31.35          [("#Given" ,"boolTestGiven g_g"),
   31.36            ("#Find"  ,"boolTestFind f_f")],
   31.37          [])),
   31.38 -    (prep_pbt thy
   31.39 +    (Specify.prep_pbt thy
   31.40        (["testeq","thy"],
   31.41          [("#Given" ,"boolTestGiven g_g"),
   31.42           ("#Find"  ,"boolTestFind f_f")],
   31.43 @@ -549,11 +549,11 @@
   31.44  
   31.45  (** methods **)
   31.46  setup {* KEStore_Elems.add_mets
   31.47 -  [prep_met @{theory "Diff"} "met_test" [] e_metID
   31.48 +  [Specify.prep_met @{theory "Diff"} "met_test" [] e_metID
   31.49        (["Test"], [],
   31.50          {rew_ord'="tless_true",rls'=Atools_erls,calc = [], srls = e_rls, prls=e_rls,
   31.51            crls=Atools_erls, errpats = [], nrls = e_rls}, "empty_script"),
   31.52 -    prep_met thy "met_test_solvelin" [] e_metID
   31.53 +    Specify.prep_met thy "met_test_solvelin" [] e_metID
   31.54        (["Test","solve_linear"]:metID,
   31.55          [("#Given" ,["equality e_e","solveFor v_v"]),
   31.56            ("#Where" ,["matches (?a = ?b) e_e"]),
   31.57 @@ -567,7 +567,7 @@
   31.58            "    (((Rewrite_Set_Inst [(bdv,v_v::real)] isolate_bdv False) @@  " ^
   31.59            "      (Rewrite_Set Test_simplify False))) e_e" ^
   31.60            " in [e_e::bool])")(*,
   31.61 -    prep_met thy (*test for equations*)
   31.62 +    Specify.prep_met thy (*test for equations*)
   31.63        (["Test","testeq"]:metID,
   31.64          [("#Given" ,["boolTestGiven g_g"]),
   31.65            ("#Find"  ,["boolTestFind f_f"])],
   31.66 @@ -726,7 +726,7 @@
   31.67  *}
   31.68  (** problem types **)
   31.69  setup {* KEStore_Elems.add_pbts
   31.70 -  [(prep_pbt thy "pbl_test_uni_plain2" [] e_pblID
   31.71 +  [(Specify.prep_pbt thy "pbl_test_uni_plain2" [] e_pblID
   31.72      (["plain_square","univariate","equation","test"],
   31.73        [("#Given" ,["equality e_e","solveFor v_v"]),
   31.74          ("#Where" ,["(matches (?a + ?b*v_v ^^^2 = 0) e_e) |" ^
   31.75 @@ -759,28 +759,28 @@
   31.76  
   31.77  *)
   31.78  setup {* KEStore_Elems.add_pbts
   31.79 -  [(prep_pbt thy "pbl_test_uni_poly" [] e_pblID
   31.80 +  [(Specify.prep_pbt thy "pbl_test_uni_poly" [] e_pblID
   31.81        (["polynomial","univariate","equation","test"],
   31.82          [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]),
   31.83            ("#Where" ,["HOL.False"]),
   31.84            ("#Find"  ,["solutions v_v'i'"])],
   31.85          e_rls, SOME "solve (e_e::bool, v_v)", [])),
   31.86 -    (prep_pbt thy "pbl_test_uni_poly_deg2" [] e_pblID
   31.87 +    (Specify.prep_pbt thy "pbl_test_uni_poly_deg2" [] e_pblID
   31.88        (["degree_two","polynomial","univariate","equation","test"],
   31.89          [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]),
   31.90            ("#Find"  ,["solutions v_v'i'"])],
   31.91          e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])),
   31.92 -    (prep_pbt thy "pbl_test_uni_poly_deg2_pq" [] e_pblID
   31.93 +    (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_pq" [] e_pblID
   31.94        (["pq_formula","degree_two","polynomial","univariate","equation","test"],
   31.95          [("#Given" ,["equality (v_v ^^^2 + p_p * v_v + q__q = 0)","solveFor v_v"]),
   31.96            ("#Find"  ,["solutions v_v'i'"])],
   31.97          e_rls, SOME "solve (v_v ^^^2 + p_p * v_v + q__q = 0, v_v)", [])),
   31.98 -    (prep_pbt thy "pbl_test_uni_poly_deg2_abc" [] e_pblID
   31.99 +    (Specify.prep_pbt thy "pbl_test_uni_poly_deg2_abc" [] e_pblID
  31.100        (["abc_formula","degree_two","polynomial","univariate","equation","test"],
  31.101          [("#Given" ,["equality (a_a * x ^^^2 + b_b * x + c_c = 0)","solveFor v_v"]),
  31.102            ("#Find"  ,["solutions v_v'i'"])],
  31.103          e_rls, SOME "solve (a_a * x ^^^2 + b_b * x + c_c = 0, v_v)", [])),
  31.104 -    (prep_pbt thy "pbl_test_uni_root" [] e_pblID
  31.105 +    (Specify.prep_pbt thy "pbl_test_uni_root" [] e_pblID
  31.106        (["squareroot","univariate","equation","test"],
  31.107          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.108            ("#Where" ,["precond_rootpbl v_v"]),
  31.109 @@ -788,19 +788,19 @@
  31.110          append_rls "contains_root" e_rls [Calc ("Test.contains'_root",
  31.111              eval_contains_root "#contains_root_")], 
  31.112          SOME "solve (e_e::bool, v_v)", [["Test","square_equation"]])),
  31.113 -    (prep_pbt thy "pbl_test_uni_norm" [] e_pblID
  31.114 +    (Specify.prep_pbt thy "pbl_test_uni_norm" [] e_pblID
  31.115        (["normalize","univariate","equation","test"],
  31.116          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.117            ("#Where" ,[]),
  31.118            ("#Find"  ,["solutions v_v'i'"])],
  31.119          e_rls, SOME "solve (e_e::bool, v_v)", [["Test","norm_univar_equation"]])),
  31.120 -    (prep_pbt thy "pbl_test_uni_roottest" [] e_pblID
  31.121 +    (Specify.prep_pbt thy "pbl_test_uni_roottest" [] e_pblID
  31.122        (["sqroot-test","univariate","equation","test"],
  31.123          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.124            ("#Where" ,["precond_rootpbl v_v"]),
  31.125            ("#Find"  ,["solutions v_v'i'"])],
  31.126          e_rls, SOME "solve (e_e::bool, v_v)", [])),
  31.127 -    (prep_pbt thy "pbl_test_intsimp" [] e_pblID
  31.128 +    (Specify.prep_pbt thy "pbl_test_intsimp" [] e_pblID
  31.129        (["inttype","test"],
  31.130          [("#Given" ,["intTestGiven t_t"]),
  31.131            ("#Where" ,[]),
  31.132 @@ -812,7 +812,7 @@
  31.133  *)
  31.134  
  31.135  setup {* KEStore_Elems.add_mets
  31.136 -  [prep_met thy  "met_test_sqrt" [] e_metID
  31.137 +  [Specify.prep_met thy  "met_test_sqrt" [] e_metID
  31.138        (*root-equation, version for tests before 8.01.01*)
  31.139        (["Test","sqrt-equ-test"]:metID,
  31.140          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.141 @@ -839,7 +839,7 @@
  31.142            "    (Try (Rewrite_Set Test_simplify False)))" ^
  31.143            "   e_e" ^
  31.144            " in [e_e::bool])"),
  31.145 -    prep_met thy  "met_test_sqrt2" [] e_metID
  31.146 +    Specify.prep_met thy  "met_test_sqrt2" [] e_metID
  31.147        (*root-equation ... for test-*.sml until 8.01*)
  31.148        (["Test","squ-equ-test2"]:metID,
  31.149          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.150 @@ -865,7 +865,7 @@
  31.151            "  (L_L::bool list) = Tac subproblem_equation_dummy;          " ^
  31.152            "  L_L = Tac solve_equation_dummy                             " ^
  31.153            "  in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.154 -    prep_met thy "met_test_squ_sub" [] e_metID
  31.155 +    Specify.prep_met thy "met_test_squ_sub" [] e_metID
  31.156        (*tests subproblem fixed linear*)
  31.157        (["Test","squ-equ-test-subpbl1"]:metID,
  31.158          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.159 @@ -884,7 +884,7 @@
  31.160          "                         [Test,solve_linear])              " ^
  31.161          "                        [BOOL e_e, REAL v_v])              " ^
  31.162          "  in Check_elementwise L_L {(v_v::real). Assumptions})     "),
  31.163 -    prep_met thy "met_test_squ_sub2" [] e_metID
  31.164 +    Specify.prep_met thy "met_test_squ_sub2" [] e_metID
  31.165        (*tests subproblem fixed degree 2*)
  31.166        (["Test","squ-equ-test-subpbl2"]:metID,
  31.167          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.168 @@ -897,7 +897,7 @@
  31.169          "(L_L::bool list) = (SubProblem (Test',[LINEAR,univariate,equation,test]," ^
  31.170          "                    [Test,solve_by_pq_formula]) [BOOL e_e, REAL v_v])" ^
  31.171          "in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.172 -    prep_met thy "met_test_squ_nonterm" [] e_metID
  31.173 +    Specify.prep_met thy "met_test_squ_nonterm" [] e_metID
  31.174        (*root-equation: see foils..., but notTerminating*)
  31.175        (["Test","square_equation...notTerminating"]:metID,
  31.176          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.177 @@ -922,7 +922,7 @@
  31.178            "    (SubProblem (Test',[LINEAR,univariate,equation,test]," ^
  31.179            "                 [Test,solve_linear]) [BOOL e_e, REAL v_v])" ^
  31.180            "in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.181 -    prep_met thy  "met_test_eq1" [] e_metID
  31.182 +    Specify.prep_met thy  "met_test_eq1" [] e_metID
  31.183        (*root-equation1:*)
  31.184        (["Test","square_equation1"]:metID,
  31.185          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.186 @@ -946,7 +946,7 @@
  31.187            "  (L_L::bool list) = (SubProblem (Test',[LINEAR,univariate,equation,test]," ^
  31.188            "                    [Test,solve_linear]) [BOOL e_e, REAL v_v])" ^
  31.189            "  in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.190 -    prep_met thy "met_test_squ2" [] e_metID
  31.191 +    Specify.prep_met thy "met_test_squ2" [] e_metID
  31.192        (*root-equation2*)
  31.193          (["Test","square_equation2"]:metID,
  31.194            [("#Given" ,["equality e_e","solveFor v_v"]),
  31.195 @@ -971,7 +971,7 @@
  31.196          "  (L_L::bool list) = (SubProblem (Test',[plain_square,univariate,equation,test]," ^
  31.197          "                    [Test,solve_plain_square]) [BOOL e_e, REAL v_v])" ^
  31.198          "  in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.199 -    prep_met thy "met_test_squeq" [] e_metID
  31.200 +    Specify.prep_met thy "met_test_squeq" [] e_metID
  31.201        (*root-equation*)
  31.202        (["Test","square_equation"]:metID,
  31.203          [("#Given" ,["equality e_e","solveFor v_v"]),
  31.204 @@ -996,7 +996,7 @@
  31.205            "  (L_L::bool list) = (SubProblem (Test',[univariate,equation,test]," ^
  31.206            "                    [no_met]) [BOOL e_e, REAL v_v])" ^
  31.207            "  in Check_elementwise L_L {(v_v::real). Assumptions})"),
  31.208 -    prep_met thy "met_test_eq_plain" [] e_metID
  31.209 +    Specify.prep_met thy "met_test_eq_plain" [] e_metID
  31.210        (*solve_plain_square*)
  31.211        (["Test","solve_plain_square"]:metID,
  31.212          [("#Given",["equality e_e","solveFor v_v"]),
  31.213 @@ -1015,7 +1015,7 @@
  31.214            "             (Rewrite square_equality True)) @@            " ^
  31.215            "            (Try (Rewrite_Set tval_rls False))) e_e             " ^
  31.216            "  in ((Or_to_List e_e)::bool list))"),
  31.217 -    prep_met thy "met_test_norm_univ" [] e_metID
  31.218 +    Specify.prep_met thy "met_test_norm_univ" [] e_metID
  31.219        (["Test","norm_univar_equation"]:metID,
  31.220          [("#Given",["equality e_e","solveFor v_v"]),
  31.221            ("#Where" ,[]), 
  31.222 @@ -1028,7 +1028,7 @@
  31.223            "  in (SubProblem (Test',[univariate,equation,test],         " ^
  31.224            "                    [no_met]) [BOOL e_e, REAL v_v]))"),
  31.225      (*17.9.02 aus SqRoot.ML------------------------------^^^---*)  
  31.226 -    prep_met thy "met_test_intsimp" [] e_metID
  31.227 +    Specify.prep_met thy "met_test_intsimp" [] e_metID
  31.228        (["Test","intsimp"]:metID,
  31.229          [("#Given" ,["intTestGiven t_t"]),
  31.230            ("#Where" ,[]),
    32.1 --- a/src/Tools/isac/xmlsrc/datatypes.sml	Wed Dec 14 14:20:25 2016 +0100
    32.2 +++ b/src/Tools/isac/xmlsrc/datatypes.sml	Sun Dec 18 16:27:41 2016 +0100
    32.3 @@ -174,7 +174,7 @@
    32.4      end;
    32.5  fun keref2xml j typ (kestoreID:kestoreID) =
    32.6      let val id = strs2str' kestoreID
    32.7 -	val guh = kestoreID2guh typ kestoreID
    32.8 +	val guh = Specify.kestoreID2guh typ kestoreID
    32.9      in indt j ^ "<KESTOREREF>\n" ^
   32.10         indt (j+i) ^ "<TAG> " ^ ketype2str' typ ^ "</TAG>\n" ^
   32.11         indt (j+i) ^ "<ID> " ^ id ^ " </ID>\n" ^
   32.12 @@ -759,7 +759,7 @@
   32.13  
   32.14  fun xml_of_matchpbl (model_ok, pI, hdl, pbl, pre) =
   32.15    XML.Elem (("CONTEXTDATA", []), [
   32.16 -    XML.Elem (("GUH", []), [XML.Text (pblID2guh pI)]),
   32.17 +    XML.Elem (("GUH", []), [XML.Text (Specify.pblID2guh pI)]),
   32.18      XML.Elem (("STATUS", []), [
   32.19        XML.Text ((if model_ok then "correct" else "incorrect"))]),
   32.20      XML.Elem (("HEAD", []), [xml_of_term_NEW hdl]),
   32.21 @@ -767,7 +767,7 @@
   32.22  
   32.23  fun xml_of_matchmet (model_ok, pI, scr, pbl, pre) =
   32.24    XML.Elem (("CONTEXTDATA", []), [
   32.25 -    XML.Elem (("GUH", []), [XML.Text (metID2guh pI)]),
   32.26 +    XML.Elem (("GUH", []), [XML.Text (Specify.metID2guh pI)]),
   32.27      XML.Elem (("STATUS", []), [
   32.28        XML.Text ((if model_ok then "correct" else "incorrect"))]),
   32.29      XML.Elem (("PROGRAM", []), [xml_of_src scr]),
    33.1 --- a/src/Tools/isac/xmlsrc/pbl-met-hierarchy.sml	Wed Dec 14 14:20:25 2016 +0100
    33.2 +++ b/src/Tools/isac/xmlsrc/pbl-met-hierarchy.sml	Sun Dec 18 16:27:41 2016 +0100
    33.3 @@ -107,7 +107,7 @@
    33.4     new version with <KESTOREREF>s -- not used because linking
    33.5     requires elements (rls, calc, ...) to be reorganized.*)
    33.6  (*######## ATTENTION: THIS IS not THE ACTUAL VERSION ################*)
    33.7 -fun pbl2term thy (pblRD:pblRD) = (*WN120405.TODO.txt*)
    33.8 +fun pbl2term thy (pblRD: Specify.pblRD) = (*WN120405.TODO.txt*)
    33.9    str2term ("Problem (" ^ (get_thy o theory2domID) thy ^ "', " ^ (strs2str' o rev) pblRD ^ ")");
   33.10  (* term2str (pbl2term (Thy_Info.get_theory "Isac") ["equations","univariate","normalize"]);
   33.11  val it = "Problem (Isac, [normalize, univariate, equations])" : string
   33.12 @@ -299,6 +299,6 @@
   33.13  
   33.14  (* interface for dialog-authoring: call in Buld_Thydata.thy only ! *)
   33.15  fun update_metpair thy metID errpats = let
   33.16 -        val ret = (update_metdata (get_met' thy metID) errpats, metID)
   33.17 +        val ret = (update_metdata (Specify.get_met' thy metID) errpats, metID)
   33.18            handle ERROR _ => error ("update_metpair: " ^ (strs2str metID) ^ " must address a method");
   33.19        in ret end;
    34.1 --- a/src/Tools/isac/xmlsrc/thy-hierarchy.sml	Wed Dec 14 14:20:25 2016 +0100
    34.2 +++ b/src/Tools/isac/xmlsrc/thy-hierarchy.sml	Sun Dec 18 16:27:41 2016 +0100
    34.3 @@ -82,7 +82,7 @@
    34.4        thm = thm}) 
    34.5    end
    34.6  
    34.7 -fun show_thes () = (writeln o format_pblIDl o (scan [])) (get_thes ());
    34.8 +fun show_thes () = (writeln o Specify.format_pblIDl o (Specify.scan [])) (get_thes ());
    34.9  
   34.10  
   34.11  (** create an xml representation for thehier: hierarchy of entries + files per entry **)
   34.12 @@ -234,7 +234,7 @@
   34.13  
   34.14  fun insert_errpatIDs thy theID errpatIDs = (* TODO: redo like insert_fillpatts *)
   34.15    let
   34.16 -    val hrls = get_the theID
   34.17 +    val hrls = Specify.get_the theID
   34.18      val hrls' = update_hrls hrls errpatIDs
   34.19        handle ERROR _ => error ("insert_errpatIDs: " ^ strs2str theID ^ "must address a rule-set")
   34.20    in (hrls', theID) end
    35.1 --- a/test/Tools/isac/ADDTESTS/course/phst11/T3_MathEngine.thy	Wed Dec 14 14:20:25 2016 +0100
    35.2 +++ b/test/Tools/isac/ADDTESTS/course/phst11/T3_MathEngine.thy	Sun Dec 18 16:27:41 2016 +0100
    35.3 @@ -28,8 +28,8 @@
    35.4    ad (2) The problem of 'vereinfachen' is one of many other problems;
    35.5    the function 'get_pbt' gets the one we need:  
    35.6  *}
    35.7 -ML {* show_ptyps ();
    35.8 -  get_pbt ["plus_minus", "polynom", "vereinfachen"];
    35.9 +ML {* Specify.show_ptyps ();
   35.10 +  Specify.get_pbt ["plus_minus", "polynom", "vereinfachen"];
   35.11  *}
   35.12  text {* However, 'get_pbt' shows an internal format; for a human readable format
   35.13    see http://www.ist.tugraz.at/projects/isac/www/kbase/pbl/index_pbl.html
   35.14 @@ -41,8 +41,8 @@
   35.15    'get_met' gets the one we need:
   35.16  *}
   35.17  ML {*
   35.18 -show_mets ();
   35.19 -get_met ["simplification","for_polynomials","with_minus"];
   35.20 +Specify.show_mets ();
   35.21 +Specify.get_met ["simplification","for_polynomials","with_minus"];
   35.22  *}
   35.23  text {* For a readable format of the method look up the definition in
   35.24    ~~/Tools/isac/Knowledge/PolyMinus.thy or 
    36.1 --- a/test/Tools/isac/Interpret/inform.sml	Wed Dec 14 14:20:25 2016 +0100
    36.2 +++ b/test/Tools/isac/Interpret/inform.sml	Sun Dec 18 16:27:41 2016 +0100
    36.3 @@ -1,9 +1,6 @@
    36.4  (* Title: tests on inform.sml
    36.5     Author: Walther Neuper 060225,
    36.6     (c) due to copyright terms 
    36.7 -
    36.8 -use"../smltest/ME/inform.sml";
    36.9 -use"inform.sml";
   36.10  *)
   36.11  
   36.12  "-----------------------------------------------------------------";
    37.1 --- a/test/Tools/isac/Interpret/ptyps.sml	Wed Dec 14 14:20:25 2016 +0100
    37.2 +++ b/test/Tools/isac/Interpret/ptyps.sml	Sun Dec 18 16:27:41 2016 +0100
    37.3 @@ -14,6 +14,14 @@
    37.4  "----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
    37.5  "----------- fun coll_guhs ---------------------------------------";
    37.6  "----------- fun guh2kestoreID -----------------------------------";
    37.7 +"----------- fun split_dsc ---------------------------------------";
    37.8 +"----------- fun mark --------------------------------------------";
    37.9 +"----------- fun coll --------------------------------------------";
   37.10 +"----------- fun coll_variants -----------------------------------";
   37.11 +"----------- fun add_id ------------------------------------------";
   37.12 +"----------- fun filter_vat --------------------------------------";
   37.13 +"----------- fun match_pbl ---------------------------------------";
   37.14 +"----------- fun match_oris --------------------------------------";
   37.15  "-----------------------------------------------------------------";
   37.16  "-----------------------------------------------------------------";
   37.17  "-----------------------------------------------------------------";
   37.18 @@ -461,4 +469,93 @@
   37.19  nodes [] guh3 (get_ptyps ());
   37.20  nodes [] guh21 (get_ptyps ());
   37.21  *)
   37.22 +"----------- fun split_dsc ---------------------------------------";
   37.23 +"----------- fun split_dsc ---------------------------------------";
   37.24 +"----------- fun split_dsc ---------------------------------------";
   37.25 +(*
   37.26 +> val t1 = (Thm.term_of o the o (parse thy)) "errorBound err_";
   37.27 +> split_dsc t1;
   37.28 +(Const ("Descript.errorBound","bool => Tools.nam"),Free ("err_","bool"))
   37.29 +  : term * term
   37.30 +> val t3 = (Thm.term_of o the o (parse thy)) "valuesFor vs_";
   37.31 +> split_dsc t3;
   37.32 +(Const ("Descript.valuesFor","bool List.list => Tools.toreall"),
   37.33 +   Free ("vs_","bool List.list")) : term * term*)
   37.34  
   37.35 +"----------- fun mark --------------------------------------------";
   37.36 +"----------- fun mark --------------------------------------------";
   37.37 +"----------- fun mark --------------------------------------------";
   37.38 +(*
   37.39 +> val xs = [1,1,1,2,4,4,5];
   37.40 +> mark (op=) xs;
   37.41 +val it = [(1,1),(2,1),(3,1),(0,2),(1,4),(2,4),(0,5)]
   37.42 +*)
   37.43 +
   37.44 +"----------- fun coll --------------------------------------------";
   37.45 +"----------- fun coll --------------------------------------------";
   37.46 +"----------- fun coll --------------------------------------------";
   37.47 +(* 
   37.48 +> val xs = [1,1,1,2,4,4,4];
   37.49 +> coll (op=) xs;
   37.50 +val it = [1,2,4] : int list
   37.51 +*)
   37.52 +"----------- fun coll_variants -----------------------------------";
   37.53 +"----------- fun coll_variants -----------------------------------";
   37.54 +"----------- fun coll_variants -----------------------------------";
   37.55 +(* val xs = [(1,1),(2,1),(3,1),(0,2),(1,4),(2,4),(0,5)];
   37.56 +> col [] ([(fst o hd) xs],(snd o hd) xs) (tl xs);
   37.57 +val it = [([1,2,3],1),([0],2),([1,2],4),([0],5)]  *)
   37.58 +"----------- fun add_id ------------------------------------------";
   37.59 +"----------- fun add_id ------------------------------------------";
   37.60 +"----------- fun add_id ------------------------------------------";
   37.61 +(*
   37.62 +> val xs = [([1,2,3],1),([0],2),([1,2],4),([0],5)];
   37.63 +> add_id xs;
   37.64 +val it = [(1,([#,#,#],1)),(2,([#],2)),(3,([#,#],4)),(4,([#],5))]
   37.65 + *)
   37.66 +"----------- fun filter_vat --------------------------------------";
   37.67 +"----------- fun filter_vat --------------------------------------";
   37.68 +"----------- fun filter_vat --------------------------------------";
   37.69 +(*> map (filter_vat oris) [1,2,3];
   37.70 +val it =
   37.71 +  [[(1,[1,2,3],"#Given",Const (#,#),[# $ #]),
   37.72 +    (2,[1,2,3],"#Find",Const (#,#),[Free #]),
   37.73 +    (3,[1,2,3],"#Find",Const (#,#),[# $ #,# $ #]),
   37.74 +    (4,[1,2],"#Relate",Const (#,#),[# $ #,# $ #]),
   37.75 +    (6,[1],"#undef",Const (#,#),[Free #]),
   37.76 +    (9,[1,2],"#undef",Const (#,#),[# $ #]),
   37.77 +    (11,[1,2,3],"#undef",Const (#,#),[# $ #])],
   37.78 +   [(1,[1,2,3],"#Given",Const (#,#),[# $ #]),
   37.79 +    (2,[1,2,3],"#Find",Const (#,#),[Free #]),
   37.80 +    (3,[1,2,3],"#Find",Const (#,#),[# $ #,# $ #]),
   37.81 +    (4,[1,2],"#Relate",Const (#,#),[# $ #,# $ #]),
   37.82 +    (7,[2],"#undef",Const (#,#),[Free #]),
   37.83 +    (9,[1,2],"#undef",Const (#,#),[# $ #]),
   37.84 +    (11,[1,2,3],"#undef",Const (#,#),[# $ #])],
   37.85 +   [(1,[1,2,3],"#Given",Const (#,#),[# $ #]),
   37.86 +    (2,[1,2,3],"#Find",Const (#,#),[Free #]),
   37.87 +    (3,[1,2,3],"#Find",Const (#,#),[# $ #,# $ #]),
   37.88 +    (5,[3],"#Relate",Const (#,#),[# $ #,# $ #,# $ #]),
   37.89 +    (8,[3],"#undef",Const (#,#),[Free #]),
   37.90 +    (10,[3],"#undef",Const (#,#),[# $ #]),
   37.91 +    (11,[1,2,3],"#undef",Const (#,#),[# $ #])]] : ori list list*)
   37.92 +"----------- fun match_pbl ---------------------------------------";
   37.93 +"----------- fun match_pbl ---------------------------------------";
   37.94 +"----------- fun match_pbl ---------------------------------------";
   37.95 +(* 
   37.96 +val fmz = ["equality (sqrt(9+4*x)=sqrt x + sqrt(5+x))",
   37.97 +	      "solveFor x","errorBound (eps=0)","solutions L"];
   37.98 +val pbt as {thy = thy, where_ = pre, ppc = ppc,...} =
   37.99 +    get_pbt ["univariate","equation"];
  37.100 +match_pbl fmz pbt;
  37.101 +*)
  37.102 +"----------- fun match_oris --------------------------------------";
  37.103 +"----------- fun match_oris --------------------------------------";
  37.104 +"----------- fun match_oris --------------------------------------";
  37.105 +(* val (pblRD,ori)=("xxx",oris);
  37.106 + val py = get_pbt ["equation"];
  37.107 + val py = get_pbt ["univariate","equation"];
  37.108 + val py = get_pbt ["linear","univariate","equation"];
  37.109 + val py = get_pbt ["root\"","univariate","equation"];
  37.110 + match_oris (#prls py) ori (#ppc py, #where_ py);
  37.111 +  *)
    38.1 --- a/test/Tools/isac/Interpret/ptyps.thy	Wed Dec 14 14:20:25 2016 +0100
    38.2 +++ b/test/Tools/isac/Interpret/ptyps.thy	Sun Dec 18 16:27:41 2016 +0100
    38.3 @@ -17,30 +17,30 @@
    38.4  "-ptyps.thy: store test-pbtyps by 'setup' ------------------------";
    38.5  *}
    38.6  setup {* KEStore_Elems.add_pbts
    38.7 -[(prep_pbt thy "pbl_test_refine" [] e_pblID
    38.8 +[(Specify.prep_pbt thy "pbl_test_refine" [] e_pblID
    38.9    (["refine", "test"], [], e_rls, NONE, [])),
   38.10 -(prep_pbt @{theory DiffApp} "pbl_pbla" [] e_pblID
   38.11 +(Specify.prep_pbt @{theory DiffApp} "pbl_pbla" [] e_pblID
   38.12    (["pbla", "refine", "test"],         
   38.13    [("#Given", ["fixedValues a_a"])], e_rls, NONE, [])),
   38.14 -(prep_pbt @{theory DiffApp} "pbl_pbla1" [] e_pblID
   38.15 +(Specify.prep_pbt @{theory DiffApp} "pbl_pbla1" [] e_pblID
   38.16    (["pbla1","pbla", "refine", "test"], 
   38.17    [("#Given", ["fixedValues a_a","maximum a_1"])], e_rls, NONE, [])),
   38.18 -(prep_pbt @{theory DiffApp} "pbl_pbla2" [] e_pblID
   38.19 +(Specify.prep_pbt @{theory DiffApp} "pbl_pbla2" [] e_pblID
   38.20    (["pbla2","pbla", "refine", "test"], 
   38.21    [("#Given", ["fixedValues a_a","valuesFor a_2"])], e_rls, NONE, [])),
   38.22 -(prep_pbt @{theory DiffApp} "pbl_pbla2x" [] e_pblID
   38.23 +(Specify.prep_pbt @{theory DiffApp} "pbl_pbla2x" [] e_pblID
   38.24    (["pbla2x","pbla2","pbla", "refine", "test"],
   38.25    [("#Given", ["fixedValues a_a","valuesFor a_2","functionOf a2_x"])], 
   38.26    e_rls, NONE, [])),
   38.27 -(prep_pbt @{theory DiffApp} "pbl_pbla2y" [] e_pblID
   38.28 +(Specify.prep_pbt @{theory DiffApp} "pbl_pbla2y" [] e_pblID
   38.29    (["pbla2y","pbla2","pbla", "refine", "test"],
   38.30    [("#Given" ,["fixedValues a_a","valuesFor a_2","boundVariable a2_y"])], 
   38.31    e_rls, NONE, [])),
   38.32 -(prep_pbt @{theory DiffApp} "pbl_pbla2z" [] e_pblID
   38.33 +(Specify.prep_pbt @{theory DiffApp} "pbl_pbla2z" [] e_pblID
   38.34    (["pbla2z","pbla2","pbla", "refine", "test"],
   38.35    [("#Given" ,["fixedValues a_a","valuesFor a_2","interval a2_z"])], 
   38.36    e_rls, NONE, [])),
   38.37 -(prep_pbt @{theory DiffApp} "pbl_pbla3" [] e_pblID
   38.38 +(Specify.prep_pbt @{theory DiffApp} "pbl_pbla3" [] e_pblID
   38.39   (["pbla3","pbla", "refine", "test"],
   38.40    [("#Given" ,["fixedValues a_a","relations a_3"])], 
   38.41    e_rls, NONE, []))]
    39.1 --- a/test/Tools/isac/Knowledge/integrate.thy	Wed Dec 14 14:20:25 2016 +0100
    39.2 +++ b/test/Tools/isac/Knowledge/integrate.thy	Sun Dec 18 16:27:41 2016 +0100
    39.3 @@ -9,7 +9,7 @@
    39.4  *}
    39.5  
    39.6  setup {* KEStore_Elems.add_mets
    39.7 -  [prep_met @{theory "Isac"} "met_testint" [] e_metID
    39.8 +  [Specify.prep_met @{theory "Isac"} "met_testint" [] e_metID
    39.9  	    (["diff","integration","test"],
   39.10  	      [("#Given" ,["functionTerm f_f", "integrateBy v_v"]), ("#Find", ["antiDerivative F_F"])],
   39.11  	      {rew_ord'="tless_true", rls'=Atools_erls, calc = [], srls = e_rls, prls=e_rls,
    40.1 --- a/test/Tools/isac/ProgLang/calculate.thy	Wed Dec 14 14:20:25 2016 +0100
    40.2 +++ b/test/Tools/isac/ProgLang/calculate.thy	Sun Dec 18 16:27:41 2016 +0100
    40.3 @@ -18,15 +18,15 @@
    40.4  *}
    40.5  
    40.6  setup {* KEStore_Elems.add_pbts
    40.7 -  [prep_pbt @{theory "Test"} "pbl_ttest" [] e_pblID (["test"], [], e_rls, NONE, []),
    40.8 -    prep_pbt @{theory "Test"} "pbl_ttest_calc" [] e_pblID
    40.9 +  [Specify.prep_pbt @{theory "Test"} "pbl_ttest" [] e_pblID (["test"], [], e_rls, NONE, []),
   40.10 +    Specify.prep_pbt @{theory "Test"} "pbl_ttest_calc" [] e_pblID
   40.11        (["calculate","test"],
   40.12          [("#Given" ,["realTestGiven t_t"]),
   40.13            ("#Find"  ,["realTestFind s_s"])],
   40.14          e_rls, NONE, [["Test","test_calculate"]])] *}
   40.15  
   40.16  setup {* KEStore_Elems.add_mets
   40.17 -  [prep_met (@{theory "Test"}) "met_testcal" [] e_metID
   40.18 +  [Specify.prep_met (@{theory "Test"}) "met_testcal" [] e_metID
   40.19        (["Test","test_calculate"]:metID,
   40.20          [("#Given" ,["realTestGiven t_t"]), ("#Find"  ,["realTestFind s_s"])],
   40.21          {rew_ord'="sqrt_right",rls'=tval_rls,srls=e_rls,prls=e_rls,
    41.1 --- a/test/Tools/isac/ProgLang/scrtools.thy	Wed Dec 14 14:20:25 2016 +0100
    41.2 +++ b/test/Tools/isac/ProgLang/scrtools.thy	Sun Dec 18 16:27:41 2016 +0100
    41.3 @@ -3,7 +3,7 @@
    41.4  begin
    41.5  
    41.6  setup {* KEStore_Elems.add_mets
    41.7 -  [prep_met @{theory "Test"} "met_testinter" [] e_metID
    41.8 +  [Specify.prep_met @{theory "Test"} "met_testinter" [] e_metID
    41.9        (["Test","test_interSteps_1"]:metID,
   41.10          [("#Given" ,["Term t_t"]), ("#Find"  ,["normalform n_n"])],
   41.11        {rew_ord' = "dummy_ord", rls' = tval_rls, calc = [], srls = e_rls, prls = e_rls,
    42.1 --- a/test/Tools/isac/Test_Isac.thy	Wed Dec 14 14:20:25 2016 +0100
    42.2 +++ b/test/Tools/isac/Test_Isac.thy	Sun Dec 18 16:27:41 2016 +0100
    42.3 @@ -68,7 +68,7 @@
    42.4  
    42.5  ML {*
    42.6  (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\*)
    42.7 -                      (* these vvv test, if additional funs intermediately added to structure *)
    42.8 +                      (* these vvv test, if funs are intermediately opened in structure *)
    42.9    open Kernel;
   42.10    open Math_Engine;            CalcTreeTEST;
   42.11    open Lucin;                  appy;
   42.12 @@ -76,6 +76,7 @@
   42.13    open Rtools;                 trtas2str;
   42.14    open Chead;                  pt_extract;
   42.15    open Ctree;                  (*//*)
   42.16 +  open Specify;                show_ptyps;
   42.17  (*\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
   42.18  *}
   42.19  ML {*
    43.1 --- a/test/Tools/isac/Test_Some.thy	Wed Dec 14 14:20:25 2016 +0100
    43.2 +++ b/test/Tools/isac/Test_Some.thy	Sun Dec 18 16:27:41 2016 +0100
    43.3 @@ -9,6 +9,8 @@
    43.4    open Inform;                 cas_input;
    43.5    open Rtools;                 trtas2str;
    43.6    open Chead;                  pt_extract;
    43.7 +  open Ctree;                  (*//*)
    43.8 +  open Specify;                show_ptyps;
    43.9  (*\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
   43.10  *}
   43.11  ML_file "~~/test/Tools/isac/ADDTESTS/accumulate-val/lucas_interpreter.sml"