test/Tools/isac/Specify/ptyps.sml
author Walther Neuper <walther.neuper@jku.at>
Tue, 05 May 2020 13:33:23 +0200
changeset 59942 d6261de56fb0
parent 59921 0766dade4a78
child 59943 4816df44437f
permissions -rw-r--r--
assign code struct.O_Model and I_Model, part 1
     1 (* Title: tests for Interpret/ptyps.sml
     2    Author: Walther Neuper 010916
     3    (c) due to copyright terms
     4 *)
     5 
     6 "-----------------------------------------------------------------";
     7 "table of contents -----------------------------------------------";
     8 "-----------------------------------------------------------------";
     9 "-ptyps.thy: store test-pbtyps by 'setup' ------------------------";
    10 "----------- testdata for refin, refine_ori ----------------------";
    11 (*"----------- refin test-pbtyps -------requires 'setup'------------";*)
    12 "----------- refine_ori test-pbtyps --requires 'setup'------------";
    13 "----------- refine test-pbtyps ------requires 'setup'------------";
    14 "----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
    15 "----------- fun coll_guhs ---------------------------------------";
    16 "----------- fun guh2kestoreID -----------------------------------";
    17 "----------- fun mark --------------------------------------------";
    18 "----------- fun coll --------------------------------------------";
    19 "----------- fun coll_variants -----------------------------------";
    20 "----------- fun add_id ------------------------------------------";
    21 "----------- fun filter_vat --------------------------------------";
    22 "----------- fun match_pbl ---------------------------------------";
    23 "----------- fun match_oris --------------------------------------";
    24 "-------- fun get_fun_ids ----------------------------------------------------";
    25 "-----------------------------------------------------------------";
    26 "-----------------------------------------------------------------";
    27 "-----------------------------------------------------------------";
    28 
    29 "----------- testdata for refin, refine_ori ----------------------";
    30 "----------- testdata for refin, refine_ori ----------------------";
    31 "----------- testdata for refin, refine_ori ----------------------";
    32 show_ptyps();
    33 val thy = @{theory "Isac_Knowledge"};
    34 val ctxt = Proof_Context.init_global @{theory "Isac_Knowledge"};
    35 
    36 (*case 1: no refinement *)
    37 val (d1,ts1) = I_Model.split_dts ((Thm.term_of o the o (parse thy)) "fixedValues [aaa = 0]");
    38 val (d2,ts2) = I_Model.split_dts ((Thm.term_of o the o (parse thy)) "errorBound (ddd = 0)");
    39 val ori1 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2)]: ori list;
    40 
    41 (*case 2: refined to pbt without children *)
    42 val (d2,ts2) = I_Model.split_dts ((Thm.term_of o the o (parse thy)) "relations [aaa333]");
    43 val ori2 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2)]:ori list;
    44 
    45 (*case 3: refined to pbt with children *)
    46 val (d2,ts2) = I_Model.split_dts ((Thm.term_of o the o (parse thy)) "valuesFor [aaa222]");
    47 val ori3 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2)]:ori list;
    48 
    49 (*case 4: refined to children (without child)*)
    50 val (d3,ts3) = I_Model.split_dts ((Thm.term_of o the o (parse thy)) "boundVariable aaa222yyy");
    51 val ori4 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2), (3,[1],"#Given",d3,ts3)]:ori list;
    52 
    53 (*=================================================================
    54 This test expects pbls at a certain position in the tree.
    55 Since parallel evaluation (i.e. Theory_Data) this cannot be expected.
    56 Solutions would be
    57 * provide an access function for a branch (not only leaves)
    58 * sort the tree of pbls.
    59 "----------- refin test-pbtyps -----------------------------------";
    60 "----------- refin test-pbtyps -----------------------------------";
    61 "----------- refin test-pbtyps -----------------------------------";
    62 (* fragile test setup: expects ptyps as fixed *)
    63 val level_1 = case nth 9 (get_ptyps ()) of
    64 Store.Node ("test", _, level_1) => level_1 | _ => error "refin broken: root-branch in ptyps changed?"
    65 val level_2 = case nth 4 level_1 of
    66 Store.Node ("refine", _, level_2) => level_2 | _ => error "refin broken: lev1-branch in ptyps changed?"
    67 val pbla_branch = case level_2 of 
    68 [Store.Node ("pbla", _, _)] => level_2 | _ => error "refin broken: lev2-branch in ptyps changed?";
    69 
    70 (*case 1: no refinement *)
    71 case refin [] ori1 (hd pbla_branch) of 
    72   SOME ["pbla"] => () | _ => error "refin case 1 broken";
    73 
    74 (*case 2: refined to pbt without children *)
    75 case refin [] ori2 (hd pbla_branch) of 
    76   SOME ["pbla", "pbla3"] => () | _ => error "refin case 2 broken";
    77 
    78 (*case 3: refined to pbt with children *)
    79 case refin [] ori3 (hd pbla_branch) of 
    80   SOME ["pbla", "pbla2"] => () | _ => error "refin case 3 broken";
    81 
    82 (*case 4: refined to children (without child)*)
    83 case refin [] ori4 (hd pbla_branch) of 
    84   SOME ["pbla", "pbla2", "pbla2y"] => () | _ => error "refin case 4 broken";
    85 
    86 (*case 5: start refinement somewhere in ptyps*)
    87 val [Store.Node ("pbla",_,[_, ppp as Store.Node ("pbla2",_,_), _])] = pbla_branch;
    88 case refin ["pbla"] ori4 ppp of 
    89   SOME ["pbla", "pbla2", "pbla2y"] => () | _ => error "refin case 5 broken";
    90 ==================================================================*)
    91 
    92 "----------- refine_ori test-pbtyps ------------------------------";
    93 "----------- refine_ori test-pbtyps ------------------------------";
    94 "----------- refine_ori test-pbtyps ------------------------------";
    95 (*case 1: no refinement *)
    96 case refine_ori ori1 ["pbla", "refine", "test"] of 
    97   NONE => () | _ => error "refine_ori case 1 broken";
    98 
    99 (*case 2: refined to pbt without children *)
   100 case refine_ori ori2 ["pbla", "refine", "test"] of 
   101   SOME ["pbla3", "pbla", "refine", "test"] => () | _ => error "refine_ori case 2 broken";
   102 
   103 (*case 3: refined to pbt with children *)
   104 case refine_ori ori3 ["pbla", "refine", "test"] of 
   105   SOME ["pbla2", "pbla", "refine", "test"] => () | _ => error "refine_ori case 3 broken";
   106 
   107 (*case 4: refined to children (without child)*)
   108 case refine_ori ori4 ["pbla", "refine", "test"] of 
   109   SOME ["pbla2y","pbla2","pbla", "refine", "test"] => () | _ => error "refine_ori case 4 broken";
   110 
   111 (*case 5: start refinement somewhere in ptyps*)
   112 case refine_ori ori4 ["pbla2","pbla", "refine", "test"] of 
   113   SOME ["pbla2y", "pbla2", "pbla", "refine", "test"] => () | _ => error "refine_ori case 5 broken";
   114 
   115 "----------- refine test-pbtyps ----------------------------------";
   116 "----------- refine test-pbtyps ----------------------------------";
   117 "----------- refine test-pbtyps ----------------------------------";
   118 val fmz1 = ["fixedValues [aaa=0]","errorBound (ddd=0)"];
   119 val fmz2 = ["fixedValues [aaa=0]","relations aaa333"];
   120 val fmz3 = ["fixedValues [aaa=0]","valuesFor [aaa222]"];
   121 val fmz4 = ["fixedValues [aaa=0]","valuesFor [aaa222]",
   122 	    "boundVariable aaa222yyy"];
   123 
   124 (*case 1: no refinement *)
   125 case refine fmz1 ["pbla", "refine", "test"] of
   126   [Matches (["pbla", "refine", "test"], _), 
   127    NoMatch (["pbla1", "pbla", "refine", "test"], _), 
   128    NoMatch (["pbla2", "pbla", "refine", "test"], _), 
   129    NoMatch (["pbla3", "pbla", "refine", "test"], _)] => ()
   130  | _ => error "--- refine test-pbtyps --- broken with case 1";
   131 (* 
   132 *** pass ["pbla"]
   133 *** pass ["pbla","pbla1"]
   134 *** pass ["pbla","pbla2"]
   135 *** pass ["pbla","pbla3"]
   136 val it =
   137   [Matches
   138      (["pbla"],
   139       {Find=[],
   140        Given=[Correct "fixedValues [aaa = #0]",
   141               Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
   142    NoMatch
   143      (["pbla1","pbla"],
   144       {Find=[],
   145        Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
   146               Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
   147    NoMatch
   148      (["pbla2","pbla"],
   149       {Find=[],
   150        Given=[Correct "fixedValues [aaa = #0]",Missing "valuesFor a2_",
   151               Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
   152    NoMatch
   153      (["pbla3","pbla"],
   154       {Find=[],
   155        Given=[Correct "fixedValues [aaa = #0]",Missing "relations a3_",
   156               Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]})]
   157   : match list*)
   158 
   159 (*case 2: refined to pbt without children *)
   160 case refine fmz2 ["pbla", "refine", "test"] of
   161   [Matches (["pbla", "refine", "test"], _),
   162    NoMatch (["pbla1", "pbla", "refine", "test"], _),
   163    NoMatch (["pbla2", "pbla", "refine", "test"], _),
   164    Matches (["pbla3", "pbla", "refine", "test"], _)] => ()
   165  | _ => error "--- refine test-pbtyps --- broken with case 2";
   166 (* 
   167 *** pass ["pbla"]
   168 *** pass ["pbla","pbla1"]
   169 *** pass ["pbla","pbla2"]
   170 *** pass ["pbla","pbla3"]
   171 val it =
   172   [Matches
   173      (["pbla"],
   174       {Find=[],
   175        Given=[Correct "fixedValues [aaa = #0]",Superfl "relations aaa333"],
   176        Relate=[],Where=[],With=[]}),
   177    NoMatch
   178      (["pbla1","pbla"],
   179       {Find=[],
   180        Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
   181               Superfl "relations aaa333"],Relate=[],Where=[],With=[]}),
   182    NoMatch
   183      (["pbla2","pbla"],
   184       {Find=[],
   185        Given=[Correct "fixedValues [aaa = #0]",Missing "valuesFor a2_",
   186               Superfl "relations aaa333"],Relate=[],Where=[],With=[]}),
   187    Matches
   188      (["pbla3","pbla"],
   189       {Find=[],
   190        Given=[Correct "fixedValues [aaa = #0]",Correct "relations aaa333"],
   191        Relate=[],Where=[],With=[]})] : match list*)
   192 
   193 (*case 3: refined to pbt with children *)
   194 case refine fmz3 ["pbla", "refine", "test"] of
   195   [Matches (["pbla", "refine", "test"], _),
   196    NoMatch (["pbla1", "pbla", "refine", "test"], _),
   197    Matches (["pbla2", "pbla", "refine", "test"], _),
   198    NoMatch (["pbla2x", "pbla2", "pbla", "refine", "test"], _),
   199    NoMatch (["pbla2y", "pbla2", "pbla", "refine", "test"], _),
   200    NoMatch (["pbla2z", "pbla2", "pbla", "refine", "test"], _),
   201    NoMatch (["pbla3", "pbla", "refine", "test"], _)] => ()
   202  | _ => error "--- refine test-pbtyps --- broken with case 3";
   203 (* 
   204 *** pass ["pbla"]
   205 *** pass ["pbla","pbla1"]
   206 *** pass ["pbla","pbla2"]
   207 *** pass ["pbla","pbla2","pbla2x"]
   208 *** pass ["pbla","pbla2","pbla2y"]
   209 *** pass ["pbla","pbla2","pbla2z"]
   210 *** pass ["pbla","pbla3"]
   211 val it =
   212   [Matches
   213      (["pbla"],
   214       {Find=[],
   215        Given=[Correct "fixedValues [aaa = #0]",Superfl "valuesFor aaa222"],
   216        Relate=[],Where=[],With=[]}),
   217    NoMatch
   218      (["pbla1","pbla"],
   219       {Find=[],
   220        Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
   221               Superfl "valuesFor aaa222"],Relate=[],Where=[],With=[]}),
   222    Matches
   223      (["pbla2","pbla"],
   224       {Find=[],
   225        Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222"],
   226        Relate=[],Where=[],With=[]}),
   227    NoMatch
   228      (["pbla2x","pbla2","pbla"],
   229       {Find=[],
   230        Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
   231               Missing "functionOf a2x_"],Relate=[],Where=[],With=[]}),
   232    NoMatch
   233      (["pbla2y","pbla2","pbla"],
   234       {Find=[],
   235        Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
   236               Missing "boundVariable a2y_"],Relate=[],Where=[],With=[]}),
   237    NoMatch
   238      (["pbla2z","pbla2","pbla"],
   239       {Find=[],
   240        Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
   241               Missing "interval a2z_"],Relate=[],Where=[],With=[]}),
   242    NoMatch
   243      (["pbla3","pbla"],
   244       {Find=[],
   245        Given=[Correct "fixedValues [aaa = #0]",Missing "relations a3_",
   246               Superfl "valuesFor aaa222"],Relate=[],Where=[],With=[]})]
   247   : match list*)
   248 
   249 (*case 4: refined to children (without child)*)
   250 case refine fmz4 ["pbla", "refine", "test"] of
   251     [Matches (["pbla", "refine", "test"], _), 
   252      NoMatch (["pbla1", "pbla", "refine", "test"], _), 
   253      Matches (["pbla2", "pbla", "refine", "test"], _), 
   254      NoMatch (["pbla2x", "pbla2", "pbla", "refine", "test"], _), 
   255      Matches (["pbla2y", "pbla2", "pbla", "refine", "test"], _)] => ()
   256   | _ => error "--- refine test-pbtyps --- broken with case 4";
   257 (* 
   258 *** pass ["pbla"]
   259 *** pass ["pbla","pbla1"]
   260 *** pass ["pbla","pbla2"]
   261 *** pass ["pbla","pbla2","pbla2x"]
   262 *** pass ["pbla","pbla2","pbla2y"]
   263 val it =
   264   [Matches
   265      (["pbla"],
   266       {Find=[],
   267        Given=[Correct "fixedValues [aaa = #0]",Superfl "valuesFor aaa222",
   268               Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
   269    NoMatch
   270      (["pbla1","pbla"],
   271       {Find=[],
   272        Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
   273               Superfl "valuesFor aaa222",Superfl "boundVariable aaa222yyy"],
   274        Relate=[],Where=[],With=[]}),
   275    Matches
   276      (["pbla2","pbla"],
   277       {Find=[],
   278        Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
   279               Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
   280    NoMatch
   281      (["pbla2x","pbla2","pbla"],
   282       {Find=[],
   283        Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
   284               Missing "functionOf a2x_",Superfl "boundVariable aaa222yyy"],
   285        Relate=[],Where=[],With=[]}),
   286    Matches
   287      (["pbla2y","pbla2","pbla"],
   288       {Find=[],
   289        Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
   290               Correct "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]})]
   291   : match list*)
   292 
   293 (*case 5: start refinement somewhere in ptyps*)
   294 case refine fmz4 ["pbla2","pbla", "refine", "test"] of
   295     [Matches (["pbla2", "pbla", "refine", "test"], _), 
   296      NoMatch (["pbla2x", "pbla2", "pbla", "refine", "test"], _), 
   297      Matches (["pbla2y", "pbla2", "pbla", "refine", "test"], _)] => ()
   298   | _ => error "--- refine test-pbtyps --- broken with case 5";
   299 (* 
   300 *** pass ["pbla","pbla2"]
   301 *** pass ["pbla","pbla2","pbla2x"]
   302 *** pass ["pbla","pbla2","pbla2y"]
   303 val it =
   304   [Matches
   305      (["pbla2","pbla"],
   306       {Find=[],
   307        Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
   308               Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
   309    NoMatch
   310      (["pbla2x","pbla2","pbla"],
   311       {Find=[],
   312        Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
   313               Missing "functionOf a2x_",Superfl "boundVariable aaa222yyy"],
   314        Relate=[],Where=[],With=[]}),
   315    Matches
   316      (["pbla2y","pbla2","pbla"],
   317       {Find=[],
   318        Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
   319               Correct "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]})]
   320   : match list*)
   321 
   322 "----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
   323 "----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
   324 "----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
   325 val c = [];
   326 val fmz = ["equality ((x+1)*(x+2)=x^^^2+(8::real))","solveFor x",
   327 	   "errorBound (eps=0)","solutions L"];
   328 val (dI',pI',mI') = ("Test",["sqroot-test","univariate","equation","test"],
   329 		     ["Test","squ-equ-test-subpbl1"]);
   330 (*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
   331 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt;
   332 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt;
   333 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Find "solutions L"*)
   334 
   335 (*=== specify a not-matching problem ---vvvvvvvvvvvvvvvvvvvvvvvvvvvv*)
   336 val nxt = (Specify_Problem ["LINEAR","univariate","equation","test"]);
   337 (*=== specify a not-matching problem ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
   338 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt; (*\<rightarrow>Add_Find "solutions L"*)
   339 
   340 val www =
   341 case f of PpcKF (Problem [],
   342   {Find = [Incompl "solutions []"], With = [],
   343    Given = [Correct "equality ((x + 1) * (x + 2) = x ^^^ 2 + 8)", Correct "solveFor x"],
   344    Where = [False www(*! ! ! ! ! !*)],
   345    Relate = [],...}) => www(*! ! !*)
   346 | _ => error "--- Refine_Problem broken 1";
   347 if www = "matches (x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\nmatches (?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\nmatches (?a + x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) \<or>\nmatches (?a + ?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8)"
   348 then () else error "--- Refine_Problem broken 2";
   349 (*ML> f; 
   350 val it = Form' (PpcKF (0,EdUndef,0,Nundef,
   351         (Problem ["LINEAR","univariate","equation","test"],   <<<<<===== diff.to above WN120313
   352          {Find=[Incompl "solutions []"],
   353           Given=[Correct "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)",
   354                  Correct "solveFor x"],Relate=[],
   355           Where=[False "matches (x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
   356                 |\nmatches (?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
   357                 |\nmatches (?a + x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
   358         |\nmatches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)"],
   359           With=[]}))) : mout
   360 *)
   361 
   362 (*[], Pbl*)val (p,_,f,nxt,_,pt) = (me nxt p c pt) (*Empty_Tac ?!?*);
   363 
   364 (*=== refine problem -----vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*)
   365 val nxt = (Refine_Problem ["univariate","equation","test"]);
   366 (*=== refine problem -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
   367 (*[], Pbl*)val (p,_,f,nxt,_,pt) = me nxt p c pt;
   368 (*("Specify_Problem", Specify_Problem ["normalise", "univariate", ...])*)
   369 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   370 (*nxt = ("Specify_Theory", Specify_Theory "Test")*)
   371 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   372 (*nxt = ("Specify_Method", Specify_Method ["Test", "squ-equ-test-subpbl1"]*)
   373 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   374 (*nxt = ("Apply_Method", *)
   375 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   376 (*nxt = ("Rewrite_Set", Rewrite_Set "norm_equation")*)
   377 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   378 (*nxt = ("Rewrite_Set", Rewrite_Set "Test_simplify")*)
   379 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   380 (*Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]*)
   381 
   382 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   383 (*nxt = Model_Problem ["LINEAR","univariate","equation","test"]*)
   384 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   385 (*nxt = ("Add_Given", Add_Given "equality (-6 + 3 * x = 0)"*)
   386 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   387 (**)
   388 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   389 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   390 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   391 (*nxt = Specify_Problem ["LINEAR","univariate","equation","test"])*)
   392 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   393 (*xt = ("Specify_Method", Specify_Method ["Test", "solve_linear"])*)
   394 val nxt = (Refine_Problem ["univariate","equation","test"]);
   395 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   396 (*("Specify_Problem", Specify_Problem ["LINEAR", "univariate", ...])*)
   397 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   398 (*val nxt = ("Specify_Method",Specify_Method ("Test","solve_linear"))*)
   399 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   400 (*val nxt = ("Apply_Method",Apply_Method ("Test","solve_linear"))*)
   401 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   402 (*val nxt = ("Rewrite_Set_Inst",Rewrite_Set_Inst ([#],"isolate_bdv"))*)
   403 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   404 (*val nxt = ("Rewrite_Set",Rewrite_Set "Test_simplify")*)
   405 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   406 (*val nxt = ("Check_Postcond",Check_Postcond ["LINEAR","univariate","eq*)
   407 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   408 (*val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*)
   409 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   410 (*Check_Postcond ["normalise","univariate","equation","test"])*)
   411 val (p,_,f,nxt,_,pt) = me nxt p c pt;
   412 val FormKF res = f;
   413 
   414 if res = "[x = 2]"
   415 then case nxt of End_Proof' => ()
   416   | _ => error "new behaviour in test:refine.sml:miniscript with mini-subpb 1"
   417 else error "new behaviour in test:refine.sml:miniscript with mini-subpb 2" 
   418 
   419 "----------- fun coll_guhs ---------------------------------------";
   420 "----------- fun coll_guhs ---------------------------------------";
   421 "----------- fun coll_guhs ---------------------------------------";
   422 val n = Probl_Def.empty;
   423 (#guh : Problem.T -> Check_Unique.id) Probl_Def.empty;
   424 
   425 fun XXXnode coll (Store.Node (_,[n],ns)) =
   426     [(#guh : Problem.T -> Check_Unique.id) n]
   427 and XXXnodes coll [] = coll
   428   | XXXnodes coll (n::ns : Problem.T Store.T) = (XXXnode coll n) @ 
   429 					    (XXXnodes coll ns);
   430 (*^^^ this works, but not this ...
   431 fun node coll (Store.Node (_,[n],ns)) =
   432     [(#guh : 'a -> Check_Unique.id) n]
   433 and nodes coll [] = coll
   434   | nodes coll (n::ns : 'a Store.T) = (node coll n) @ (nodes coll ns);
   435 
   436 Error:
   437 Can't unify {guh: 'a, ...} with 'b (Cannot unify with explicit type variable)
   438    Found near #guh : 'a -> Check_Unique.id
   439 
   440 i.e. there is no common fun for pbls and mets ?!?*)
   441 
   442 ((Check_Unique.collect (#guh : Probl_Def.T -> Check_Unique.id))) (get_ptyps ());
   443 sort string_ord (((Check_Unique.collect (#guh : Probl_Def.T -> Check_Unique.id))) (get_ptyps ()));
   444 show_pblguhs ();
   445 sort_pblguhs ();
   446 
   447 "----------- fun guh2kestoreID -----------------------------------";
   448 "----------- fun guh2kestoreID -----------------------------------";
   449 "----------- fun guh2kestoreID -----------------------------------";
   450 "----- we assumed the problem-hierarchy containing 3 elements on toplevel";
   451 (* ERROR: Exception Bind raised *)
   452 val (Store.Node (id1,[n1 as {guh=guh1,...} : Problem.T], ns1)::
   453      Store.Node (id2,[n2 as {guh=guh2,...} : Problem.T], ns2):: _) = (get_ptyps ());
   454 
   455 (*
   456 nodes [] guh1 (get_ptyps ());
   457 nodes [] guh2 (get_ptyps ());
   458 *)
   459 val (Store.Node (id1,[n1 as {guh=guh1,...} : Problem.T], ns1)
   460      ::
   461      Store.Node (id2,[n2 as {guh=guh2,...} : Problem.T], 
   462 	   (Store.Node (id21,[n21 as {guh=guh21,...} : Problem.T], ns21)) :: _ )
   463      ::
   464      Store.Node (id3,[n3 as {guh=guh3,...} : Problem.T], ns3)
   465      ::
   466      _ ) = (get_ptyps ());
   467 (*
   468 nodes [] guh3 (get_ptyps ());
   469 nodes [] guh21 (get_ptyps ());
   470 *)
   471 
   472 "----------- fun mark --------------------------------------------";
   473 "----------- fun mark --------------------------------------------";
   474 "----------- fun mark --------------------------------------------";
   475 (*
   476 > val xs = [1,1,1,2,4,4,5];
   477 > mark (op=) xs;
   478 val it = [(1,1),(2,1),(3,1),(0,2),(1,4),(2,4),(0,5)]
   479 *)
   480 
   481 "----------- fun coll --------------------------------------------";
   482 "----------- fun coll --------------------------------------------";
   483 "----------- fun coll --------------------------------------------";
   484 (* 
   485 > val xs = [1,1,1,2,4,4,4];
   486 > coll (op=) xs;
   487 val it = [1,2,4] : int list
   488 *)
   489 "----------- fun coll_variants -----------------------------------";
   490 "----------- fun coll_variants -----------------------------------";
   491 "----------- fun coll_variants -----------------------------------";
   492 (* val xs = [(1,1),(2,1),(3,1),(0,2),(1,4),(2,4),(0,5)];
   493 > col [] ([(fst o hd) xs],(snd o hd) xs) (tl xs);
   494 val it = [([1,2,3],1),([0],2),([1,2],4),([0],5)]  *)
   495 "----------- fun add_id ------------------------------------------";
   496 "----------- fun add_id ------------------------------------------";
   497 "----------- fun add_id ------------------------------------------";
   498 (*
   499 > val xs = [([1,2,3],1),([0],2),([1,2],4),([0],5)];
   500 > add_id xs;
   501 val it = [(1,([#,#,#],1)),(2,([#],2)),(3,([#,#],4)),(4,([#],5))]
   502  *)
   503 "----------- fun filter_vat --------------------------------------";
   504 "----------- fun filter_vat --------------------------------------";
   505 "----------- fun filter_vat --------------------------------------";
   506 (*> map (filter_vat oris) [1,2,3];
   507 val it =
   508   [[(1,[1,2,3],"#Given",Const (#,#),[# $ #]),
   509     (2,[1,2,3],"#Find",Const (#,#),[Free #]),
   510     (3,[1,2,3],"#Find",Const (#,#),[# $ #,# $ #]),
   511     (4,[1,2],"#Relate",Const (#,#),[# $ #,# $ #]),
   512     (6,[1],"#undef",Const (#,#),[Free #]),
   513     (9,[1,2],"#undef",Const (#,#),[# $ #]),
   514     (11,[1,2,3],"#undef",Const (#,#),[# $ #])],
   515    [(1,[1,2,3],"#Given",Const (#,#),[# $ #]),
   516     (2,[1,2,3],"#Find",Const (#,#),[Free #]),
   517     (3,[1,2,3],"#Find",Const (#,#),[# $ #,# $ #]),
   518     (4,[1,2],"#Relate",Const (#,#),[# $ #,# $ #]),
   519     (7,[2],"#undef",Const (#,#),[Free #]),
   520     (9,[1,2],"#undef",Const (#,#),[# $ #]),
   521     (11,[1,2,3],"#undef",Const (#,#),[# $ #])],
   522    [(1,[1,2,3],"#Given",Const (#,#),[# $ #]),
   523     (2,[1,2,3],"#Find",Const (#,#),[Free #]),
   524     (3,[1,2,3],"#Find",Const (#,#),[# $ #,# $ #]),
   525     (5,[3],"#Relate",Const (#,#),[# $ #,# $ #,# $ #]),
   526     (8,[3],"#undef",Const (#,#),[Free #]),
   527     (10,[3],"#undef",Const (#,#),[# $ #]),
   528     (11,[1,2,3],"#undef",Const (#,#),[# $ #])]] : ori list list*)
   529 "----------- fun match_pbl ---------------------------------------";
   530 "----------- fun match_pbl ---------------------------------------";
   531 "----------- fun match_pbl ---------------------------------------";
   532 (* 
   533 val fmz = ["equality (sqrt(9+4*x)=sqrt x + sqrt(5+x))",
   534 	      "solveFor x","errorBound (eps=0)","solutions L"];
   535 val pbt as {thy = thy, where_ = pre, ppc = ppc,...} =
   536     get_pbt ["univariate","equation"];
   537 match_pbl fmz pbt;
   538 *)
   539 "----------- fun match_oris --------------------------------------";
   540 "----------- fun match_oris --------------------------------------";
   541 "----------- fun match_oris --------------------------------------";
   542 (* val (pblRD,ori)=("xxx",oris);
   543  val py = get_pbt ["equation"];
   544  val py = get_pbt ["univariate","equation"];
   545  val py = get_pbt ["linear","univariate","equation"];
   546  val py = get_pbt ["root\"","univariate","equation"];
   547  match_oris (#prls py) ori (#ppc py, #where_ py);
   548   *)
   549 
   550 "-------- fun get_fun_ids ----------------------------------------------------";
   551 "-------- fun get_fun_ids ----------------------------------------------------";
   552 "-------- fun get_fun_ids ----------------------------------------------------";
   553 val met_fun_ids = get_fun_ids @{theory Biegelinie};
   554 if map fst (get_fun_ids @{theory Biegelinie}) = 
   555   ["Biegelinie.function_to_equality", "Biegelinie.biegelinie", "Biegelinie.belastung_zu_biegelinie",
   556     "Biegelinie.setzte_randbedingungen"] then () else error "get_fun_ids changed"