src/Tools/isac/Build_Isac.thy
changeset 60651 b7a2ad3b3d45
parent 60639 b8bb7d8800e8
child 60652 75003e8f96ab
equal deleted inserted replaced
60650:06ec8abfd3bc 60651:b7a2ad3b3d45
   176   As next step we go bottom up from Thy_Info.get_theory and remove it.
   176   As next step we go bottom up from Thy_Info.get_theory and remove it.
   177   Afterwards $ISABELLE_ISAC_TEST will be changed accordingly.
   177   Afterwards $ISABELLE_ISAC_TEST will be changed accordingly.
   178 \<close>
   178 \<close>
   179   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/000-comments.sml"
   179   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/000-comments.sml"
   180   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/100-init-rootpbl.sml"
   180   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/100-init-rootpbl.sml"
       
   181 ML \<open>
       
   182 \<close> ML \<open>
       
   183 (* Title:  100-init-rootpbl.sml
       
   184    Author: Walther Neuper 1105
       
   185    (c) copyright due to lincense terms.
       
   186 *)
       
   187 
       
   188 "----------- Minisubplb/100-init-rootpbl.sml ---------------------";
       
   189 "----------- Minisubplb/100-init-rootpbl.sml ---------------------";
       
   190 "----------- Minisubplb/100-init-rootpbl.sml ---------------------";
       
   191 val (_(*example text*), 
       
   192   (model as ("Constants [r = (7::real)]" :: "Maximum A" :: "AdditionalValues [u, v]" :: 
       
   193      "Extremum (A = 2 * u * v - u \<up> 2)" :: 
       
   194      "SideConditions [((u::real) / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]" :: 
       
   195      "SideConditions [((u::real) / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]" :: 
       
   196      "SideConditions [(u::real) / 2 = r * sin \<alpha>, 2 / v = r * cos \<alpha>]" :: 
       
   197      "FunctionVariable a" :: "FunctionVariable b" :: "FunctionVariable \<alpha>" :: 
       
   198      "Domain {0 <..< r}" :: "Domain {0 <..< r}" :: "Domain {0 <..< \<pi> / 2}" ::
       
   199      "ErrorBound (\<epsilon> = (0::real))" :: []), 
       
   200    refs as ("Diff_App", 
       
   201      ["univariate_calculus", "Optimisation"],
       
   202      ["Optimisation", "by_univariate_calculus"])))
       
   203   = Store.get (Know_Store.get_expls @{theory}) ["Diff_App-No.123a"] ["Diff_App-No.123a"];
       
   204 
       
   205  Test_Code.init_calc @{context} [(model, refs)];
       
   206 "~~~~~ fun init_calc , args:"; val (ctxt, [(model, refs as (thy_id, _, _))])
       
   207   = (@{context}, [(model, refs)]);
       
   208 (*old* )val ctxt = thy_id |> ThyC.get_theory_PIDE ctxt |> Proof_Context.init_global
       
   209 ( *new*)val thy = thy_id |> ThyC.get_theory_PIDE ctxt  (*^^^^^^^^^^^^^^^^^^^^^^^^^ misleading*)
       
   210 
       
   211 (**)val return_nxt_specify_init_calc_PIDE =(**)
       
   212 Step_Specify.nxt_specify_init_calc_PIDE thy (model, refs);
       
   213 "~~~~~ fun nxt_specify_init_calc , args:"; val (ctxt, (model, (dI, pI, mI))) = (ctxt, (model, refs));
       
   214 
       
   215 Step_Specify.initialise_PIDE thy (model, refs);
       
   216 "~~~~~ fun initialise , args:"; val (ctxt, (fmz, (dI, pI, mI))) = (ctxt, (model, refs));
       
   217 (*old* )val thy = ThyC.get_theory_PIDE ctxt dI( *old*)
       
   218 	    val ctxt = Proof_Context.init_global thy (* ctxt restricted to Formalise.refs *)
       
   219 	    val (pI, (pors, pctxt), mI) = 
       
   220         if mI = ["no_met"] 
       
   221         then raise error "else not covered by test"
       
   222         else
       
   223           let
       
   224 (*old* )     val pors = Problem.from_store ctxt pI |> #model |> O_Model.init thy fmz; (*..TermC.parseNEW'*)
       
   225 (*old*)     val pctxt = ContextC.initialise' thy fmz;                (*..DUPLICATE ermC.parseNEW'*)
       
   226 (*old*)   in (pI, (pors, pctxt), mI) end;
       
   227 ( *new*)     val (pors, pctxt) = Problem.from_store ctxt pI |> #model |> O_Model.init_PIDE thy fmz;
       
   228           in (pI, (pors, pctxt), mI) end;
       
   229 
       
   230 (*/------------------- check result of O_Model.init_PIDE ------------------------------------\*)
       
   231 (*+*)val Free ("r", Type ("Real.real", [])) = Syntax.read_term pctxt "r";
       
   232 (*+*)val Free ("u", Type ("Real.real", [])) = Syntax.read_term pctxt "u";
       
   233 (*-------------------- stop step into Step_Specify.nxt_specify_init_calc ---------------------*)
       
   234 
       
   235 val ((pt, p), tacis) = return_nxt_specify_init_calc_PIDE(* kept for continuation *);
       
   236 "~~~~~ continue fun init_calc , args:"; val ((pt, p), tacis)
       
   237   = ((pt, p), tacis);
       
   238 	  val tac = case tacis of [] => Tactic.Empty_Tac | _ => (#1 o hd) tacis;
       
   239 
       
   240  Test_Code.TESTg_form ctxt (pt,p);
       
   241 "~~~~~ fun TESTg_form , args:"; val (ctxt, ptp) = (ctxt, (pt,p));
       
   242     val (form, _, _) =  ME_Misc.pt_extract ctxt ptp;
       
   243 val Ctree.ModSpec (_, p_, _, gfr, where_, _) =
       
   244     (*case*) form (*of*);
       
   245 val Pos.Pbl =
       
   246       (*case*) p_ (*of*);
       
   247     Test_Out.Problem [];
       
   248     Test_Out.MethodC [];
       
   249 
       
   250 (*val return =*)
       
   251   Test_Out.PpcKF (Test_Out.Problem [], 
       
   252    P_Model.from (Proof_Context.theory_of ctxt) gfr where_);
       
   253 "~~~~~ fun from , args:"; val (thy, itms, where_) = ((Proof_Context.theory_of ctxt), gfr, where_);
       
   254 
       
   255 (*//------------------ inserted hidden code ------------------------------------------------\\*)
       
   256 fun item_from_feedback thy (I_Model.Cor ((d, ts), _)) = P_Model.Correct (UnparseC.term_in_thy thy (Input_Descript.join (d, ts)))
       
   257   | item_from_feedback _ (I_Model.Syn c) = P_Model.SyntaxE c
       
   258   | item_from_feedback _ (I_Model.Typ c) = P_Model.TypeE c
       
   259   | item_from_feedback thy (I_Model.Inc ((d, ts), _)) = P_Model.Incompl (UnparseC.term_in_thy thy  (Input_Descript.join (d, ts)))
       
   260   | item_from_feedback thy (I_Model.Sup (d, ts)) = P_Model.Superfl (UnparseC.term_in_thy thy  (Input_Descript.join (d, ts)))
       
   261   | item_from_feedback thy (I_Model.Mis (d, pid)) = P_Model.Missing (UnparseC.term_in_thy thy d ^ " " ^ UnparseC.term_in_thy thy  pid)
       
   262   | item_from_feedback _ _ = raise ERROR "item_from_feedback: uncovered definition"
       
   263 fun add_sel_ppc (_: theory) sel {Given = gi, Where = wh, Find = fi, With = wi, Relate = re} x =
       
   264   case sel of
       
   265     "#Given" => {Given = gi @ [x], Where = wh, Find = fi, With = wi,Relate = re}
       
   266   | "#Where" => {Given = gi, Where = wh @ [x], Find = fi, With = wi, Relate = re}
       
   267   | "#Find"  => {Given = gi, Where = wh, Find = fi @ [x], With = wi, Relate = re}
       
   268   | "#Relate"=> {Given = gi, Where = wh, Find = fi, With = wi, Relate = re @ [x]}
       
   269   | "#undef" => {Given = gi @ [x], Where = wh, Find = fi, With = wi, Relate = re} (*ori2itmSup*)
       
   270   | _  => raise ERROR ("add_sel_ppc tried to select by \"" ^ sel ^ "\"")
       
   271 fun add_where {Given = gi, Where = _, Find = fi, With = wi, Relate = re} wh =
       
   272   {Given = gi, Where = wh, Find= fi ,With = wi, Relate = re}
       
   273 fun boolterm2item ctxt (true, term) = P_Model.Correct (UnparseC.term_in_ctxt ctxt term)
       
   274   | boolterm2item ctxt(false, term) = P_Model.False (UnparseC.term_in_ctxt ctxt term);
       
   275 (*\\------------------ inserted hidden code ------------------------------------------------//*)
       
   276 
       
   277     fun coll model [] = model
       
   278       | coll model ((_, _, _, field, itm_)::itms) =
       
   279         coll (add_sel_ppc thy field model (item_from_feedback thy itm_)) itms;
       
   280     val gfr = coll P_Model.empty itms;
       
   281 
       
   282 (*val return =*)
       
   283            add_where gfr (map (boolterm2item (Proof_Context.init_global thy)) where_);
       
   284 "~~~~~ fun add_where , args:"; val ({Given = gi, Where = _, Find = fi, With = wi, Relate = re}, wh)
       
   285   = (gfr, (map 
       
   286           (boolterm2item ctxt) where_));
       
   287 "~~~~~ fun boolterm2item , args:"; val () = ();
       
   288 (*\\------------------ step into nxt_specify_init_calc -------------------------------------//*)
       
   289 \<close> ML \<open>
       
   290 \<close> ML \<open>
       
   291 \<close> 
   181   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/150a-add-given-Maximum.sml"
   292   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/150a-add-given-Maximum.sml"
   182   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/150-add-given-Equation.sml"
   293   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/150-add-given-Equation.sml"
   183   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/200-start-method-NEXT_STEP.sml"
   294   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/200-start-method-NEXT_STEP.sml"
   184   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/200-start-method.sml"
   295   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/200-start-method.sml"
   185   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/250-Rewrite_Set-from-method-NEXT_STEP.sml"
   296   ML_file "$ISABELLE_ISAC_TEST/Tools/isac/Minisubpbl/250-Rewrite_Set-from-method-NEXT_STEP.sml"