test/Tools/isac/Interpret/ptyps.sml
author Walther Neuper <wneuper@ist.tugraz.at>
Sat, 01 Jun 2019 11:09:19 +0200
changeset 59549 e0e3d41ef86c
parent 59507 0c839aea0c2e
child 59592 99c8d2ff63eb
permissions -rw-r--r--
[-Test_Isac] funpack: repair errors in test, spot remaining errors

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