test/Tools/isac/Interpret/ptyps.sml
author Walther Neuper <wneuper@ist.tugraz.at>
Thu, 20 Oct 2016 10:26:29 +0200
changeset 59253 f0bb15a046ae
parent 59188 c477d0f79ab9
child 59267 aab874fdd910
permissions -rw-r--r--
simplify handling of theorems

Notes:
# this should complete 727dff4f6b2c
# see comment at "type thm''" (TODO: rename to thm')
# see comment at "type tac " at "| Rewrite"
!!! random errors *only* in test/../use-cases.sml
!!! probably due to "val states = Synchronized.var"
!!! see subsequent changeset for further hints.
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 -----------------------------------";
neuper@55364
    17
"-----------------------------------------------------------------";
neuper@55364
    18
"-----------------------------------------------------------------";
neuper@55364
    19
"-----------------------------------------------------------------";
neuper@55356
    20
neuper@55364
    21
"----------- testdata for refin, refine_ori ----------------------";
neuper@55364
    22
"----------- testdata for refin, refine_ori ----------------------";
neuper@55364
    23
"----------- testdata for refin, refine_ori ----------------------";
neuper@55356
    24
show_ptyps();
neuper@55356
    25
val thy = @{theory "Isac"};
neuper@55356
    26
val ctxt = Proof_Context.init_global @{theory "Isac"};
neuper@55356
    27
neuper@55356
    28
(*case 1: no refinement *)
wneuper@59188
    29
val (d1,ts1) = split_dts ((Thm.term_of o the o (parse thy)) "fixedValues [aaa = 0]");
wneuper@59188
    30
val (d2,ts2) = split_dts ((Thm.term_of o the o (parse thy)) "errorBound (ddd = 0)");
neuper@55356
    31
val ori1 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2)]: ori list;
neuper@55356
    32
neuper@55356
    33
(*case 2: refined to pbt without children *)
wneuper@59188
    34
val (d2,ts2) = split_dts ((Thm.term_of o the o (parse thy)) "relations [aaa333]");
neuper@55356
    35
val ori2 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2)]:ori list;
neuper@55356
    36
neuper@55356
    37
(*case 3: refined to pbt with children *)
wneuper@59188
    38
val (d2,ts2) = split_dts ((Thm.term_of o the o (parse thy)) "valuesFor [aaa222]");
neuper@55356
    39
val ori3 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2)]:ori list;
neuper@55356
    40
neuper@55356
    41
(*case 4: refined to children (without child)*)
wneuper@59188
    42
val (d3,ts3) = split_dts ((Thm.term_of o the o (parse thy)) "boundVariable aaa222yyy");
neuper@55356
    43
val ori4 = [(1,[1],"#Given",d1,ts1), (2,[1],"#Given",d2,ts2), (3,[1],"#Given",d3,ts3)]:ori list;
neuper@55356
    44
neuper@55364
    45
(*=================================================================
neuper@55364
    46
This test expects pbls at a certain position in the tree.
neuper@55364
    47
Since parallel evaluation (i.e. Theory_Data) this cannot be expected.
neuper@55364
    48
Solutions would be
neuper@55364
    49
* provide an access function for a branch (not only leaves)
neuper@55364
    50
* sort the tree of pbls.
neuper@55356
    51
"----------- refin test-pbtyps -----------------------------------";
neuper@55356
    52
"----------- refin test-pbtyps -----------------------------------";
neuper@55356
    53
"----------- refin test-pbtyps -----------------------------------";
neuper@55356
    54
(* fragile test setup: expects ptyps as fixed *)
neuper@55356
    55
val level_1 = case nth 9 (get_ptyps ()) of
neuper@55356
    56
Ptyp ("test", _, level_1) => level_1 | _ => error "refin broken: root-branch in ptyps changed?"
neuper@55356
    57
val level_2 = case nth 4 level_1 of
neuper@55356
    58
Ptyp ("refine", _, level_2) => level_2 | _ => error "refin broken: lev1-branch in ptyps changed?"
neuper@55356
    59
val pbla_branch = case level_2 of 
neuper@55356
    60
[Ptyp ("pbla", _, _)] => level_2 | _ => error "refin broken: lev2-branch in ptyps changed?";
neuper@55356
    61
neuper@55356
    62
(*case 1: no refinement *)
neuper@55356
    63
case refin [] ori1 (hd pbla_branch) of 
neuper@55356
    64
  SOME ["pbla"] => () | _ => error "refin case 1 broken";
neuper@55356
    65
neuper@55356
    66
(*case 2: refined to pbt without children *)
neuper@55356
    67
case refin [] ori2 (hd pbla_branch) of 
neuper@55356
    68
  SOME ["pbla", "pbla3"] => () | _ => error "refin case 2 broken";
neuper@55356
    69
neuper@55356
    70
(*case 3: refined to pbt with children *)
neuper@55356
    71
case refin [] ori3 (hd pbla_branch) of 
neuper@55356
    72
  SOME ["pbla", "pbla2"] => () | _ => error "refin case 3 broken";
neuper@55356
    73
neuper@55356
    74
(*case 4: refined to children (without child)*)
neuper@55356
    75
case refin [] ori4 (hd pbla_branch) of 
neuper@55356
    76
  SOME ["pbla", "pbla2", "pbla2y"] => () | _ => error "refin case 4 broken";
neuper@55356
    77
neuper@55356
    78
(*case 5: start refinement somewhere in ptyps*)
neuper@55356
    79
val [Ptyp ("pbla",_,[_, ppp as Ptyp ("pbla2",_,_), _])] = pbla_branch;
neuper@55356
    80
case refin ["pbla"] ori4 ppp of 
neuper@55356
    81
  SOME ["pbla", "pbla2", "pbla2y"] => () | _ => error "refin case 5 broken";
neuper@55364
    82
==================================================================*)
neuper@55356
    83
neuper@55356
    84
"----------- refine_ori test-pbtyps ------------------------------";
neuper@55356
    85
"----------- refine_ori test-pbtyps ------------------------------";
neuper@55356
    86
"----------- refine_ori test-pbtyps ------------------------------";
neuper@55356
    87
(*case 1: no refinement *)
neuper@55356
    88
case refine_ori ori1 ["pbla", "refine", "test"] of 
neuper@55356
    89
  NONE => () | _ => error "refine_ori case 1 broken";
neuper@55356
    90
neuper@55356
    91
(*case 2: refined to pbt without children *)
neuper@55356
    92
case refine_ori ori2 ["pbla", "refine", "test"] of 
neuper@55356
    93
  SOME ["pbla3", "pbla", "refine", "test"] => () | _ => error "refine_ori case 2 broken";
neuper@55356
    94
neuper@55356
    95
(*case 3: refined to pbt with children *)
neuper@55356
    96
case refine_ori ori3 ["pbla", "refine", "test"] of 
neuper@55356
    97
  SOME ["pbla2", "pbla", "refine", "test"] => () | _ => error "refine_ori case 3 broken";
neuper@55356
    98
neuper@55356
    99
(*case 4: refined to children (without child)*)
neuper@55356
   100
case refine_ori ori4 ["pbla", "refine", "test"] of 
neuper@55356
   101
  SOME ["pbla2y","pbla2","pbla", "refine", "test"] => () | _ => error "refine_ori case 4 broken";
neuper@55356
   102
neuper@55356
   103
(*case 5: start refinement somewhere in ptyps*)
neuper@55356
   104
case refine_ori ori4 ["pbla2","pbla", "refine", "test"] of 
neuper@55356
   105
  SOME ["pbla2y", "pbla2", "pbla", "refine", "test"] => () | _ => error "refine_ori case 5 broken";
neuper@55356
   106
neuper@55356
   107
"----------- refine test-pbtyps ----------------------------------";
neuper@55356
   108
"----------- refine test-pbtyps ----------------------------------";
neuper@55356
   109
"----------- refine test-pbtyps ----------------------------------";
neuper@55356
   110
val fmz1 = ["fixedValues [aaa=0]","errorBound (ddd=0)"];
neuper@55356
   111
val fmz2 = ["fixedValues [aaa=0]","relations aaa333"];
neuper@55356
   112
val fmz3 = ["fixedValues [aaa=0]","valuesFor [aaa222]"];
neuper@55356
   113
val fmz4 = ["fixedValues [aaa=0]","valuesFor [aaa222]",
neuper@55356
   114
	    "boundVariable aaa222yyy"];
neuper@55356
   115
neuper@55356
   116
(*case 1: no refinement *)
neuper@55356
   117
case refine fmz1 ["pbla", "refine", "test"] of
neuper@55356
   118
  [Matches (["pbla", "refine", "test"], _), 
neuper@55356
   119
   NoMatch (["pbla1", "pbla", "refine", "test"], _), 
neuper@55356
   120
   NoMatch (["pbla2", "pbla", "refine", "test"], _), 
neuper@55356
   121
   NoMatch (["pbla3", "pbla", "refine", "test"], _)] => ()
neuper@55356
   122
 | _ => error "--- refine test-pbtyps --- broken with case 1";
neuper@55356
   123
(* 
neuper@55356
   124
*** pass ["pbla"]
neuper@55356
   125
*** pass ["pbla","pbla1"]
neuper@55356
   126
*** pass ["pbla","pbla2"]
neuper@55356
   127
*** pass ["pbla","pbla3"]
neuper@55356
   128
val it =
neuper@55356
   129
  [Matches
neuper@55356
   130
     (["pbla"],
neuper@55356
   131
      {Find=[],
neuper@55356
   132
       Given=[Correct "fixedValues [aaa = #0]",
neuper@55356
   133
              Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
neuper@55356
   134
   NoMatch
neuper@55356
   135
     (["pbla1","pbla"],
neuper@55356
   136
      {Find=[],
neuper@55356
   137
       Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
neuper@55356
   138
              Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
neuper@55356
   139
   NoMatch
neuper@55356
   140
     (["pbla2","pbla"],
neuper@55356
   141
      {Find=[],
neuper@55356
   142
       Given=[Correct "fixedValues [aaa = #0]",Missing "valuesFor a2_",
neuper@55356
   143
              Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]}),
neuper@55356
   144
   NoMatch
neuper@55356
   145
     (["pbla3","pbla"],
neuper@55356
   146
      {Find=[],
neuper@55356
   147
       Given=[Correct "fixedValues [aaa = #0]",Missing "relations a3_",
neuper@55356
   148
              Superfl "errorBound (ddd = #0)"],Relate=[],Where=[],With=[]})]
neuper@55356
   149
  : match list*)
neuper@55356
   150
neuper@55356
   151
(*case 2: refined to pbt without children *)
neuper@55356
   152
case refine fmz2 ["pbla", "refine", "test"] of
neuper@55356
   153
  [Matches (["pbla", "refine", "test"], _),
neuper@55356
   154
   NoMatch (["pbla1", "pbla", "refine", "test"], _),
neuper@55356
   155
   NoMatch (["pbla2", "pbla", "refine", "test"], _),
neuper@55356
   156
   Matches (["pbla3", "pbla", "refine", "test"], _)] => ()
neuper@55356
   157
 | _ => error "--- refine test-pbtyps --- broken with case 2";
neuper@55356
   158
(* 
neuper@55356
   159
*** pass ["pbla"]
neuper@55356
   160
*** pass ["pbla","pbla1"]
neuper@55356
   161
*** pass ["pbla","pbla2"]
neuper@55356
   162
*** pass ["pbla","pbla3"]
neuper@55356
   163
val it =
neuper@55356
   164
  [Matches
neuper@55356
   165
     (["pbla"],
neuper@55356
   166
      {Find=[],
neuper@55356
   167
       Given=[Correct "fixedValues [aaa = #0]",Superfl "relations aaa333"],
neuper@55356
   168
       Relate=[],Where=[],With=[]}),
neuper@55356
   169
   NoMatch
neuper@55356
   170
     (["pbla1","pbla"],
neuper@55356
   171
      {Find=[],
neuper@55356
   172
       Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
neuper@55356
   173
              Superfl "relations aaa333"],Relate=[],Where=[],With=[]}),
neuper@55356
   174
   NoMatch
neuper@55356
   175
     (["pbla2","pbla"],
neuper@55356
   176
      {Find=[],
neuper@55356
   177
       Given=[Correct "fixedValues [aaa = #0]",Missing "valuesFor a2_",
neuper@55356
   178
              Superfl "relations aaa333"],Relate=[],Where=[],With=[]}),
neuper@55356
   179
   Matches
neuper@55356
   180
     (["pbla3","pbla"],
neuper@55356
   181
      {Find=[],
neuper@55356
   182
       Given=[Correct "fixedValues [aaa = #0]",Correct "relations aaa333"],
neuper@55356
   183
       Relate=[],Where=[],With=[]})] : match list*)
neuper@55356
   184
neuper@55356
   185
(*case 3: refined to pbt with children *)
neuper@55356
   186
case refine fmz3 ["pbla", "refine", "test"] of
neuper@55356
   187
  [Matches (["pbla", "refine", "test"], _),
neuper@55356
   188
   NoMatch (["pbla1", "pbla", "refine", "test"], _),
neuper@55356
   189
   Matches (["pbla2", "pbla", "refine", "test"], _),
neuper@55356
   190
   NoMatch (["pbla2x", "pbla2", "pbla", "refine", "test"], _),
neuper@55356
   191
   NoMatch (["pbla2y", "pbla2", "pbla", "refine", "test"], _),
neuper@55356
   192
   NoMatch (["pbla2z", "pbla2", "pbla", "refine", "test"], _),
neuper@55356
   193
   NoMatch (["pbla3", "pbla", "refine", "test"], _)] => ()
neuper@55356
   194
 | _ => error "--- refine test-pbtyps --- broken with case 3";
neuper@55356
   195
(* 
neuper@55356
   196
*** pass ["pbla"]
neuper@55356
   197
*** pass ["pbla","pbla1"]
neuper@55356
   198
*** pass ["pbla","pbla2"]
neuper@55356
   199
*** pass ["pbla","pbla2","pbla2x"]
neuper@55356
   200
*** pass ["pbla","pbla2","pbla2y"]
neuper@55356
   201
*** pass ["pbla","pbla2","pbla2z"]
neuper@55356
   202
*** pass ["pbla","pbla3"]
neuper@55356
   203
val it =
neuper@55356
   204
  [Matches
neuper@55356
   205
     (["pbla"],
neuper@55356
   206
      {Find=[],
neuper@55356
   207
       Given=[Correct "fixedValues [aaa = #0]",Superfl "valuesFor aaa222"],
neuper@55356
   208
       Relate=[],Where=[],With=[]}),
neuper@55356
   209
   NoMatch
neuper@55356
   210
     (["pbla1","pbla"],
neuper@55356
   211
      {Find=[],
neuper@55356
   212
       Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
neuper@55356
   213
              Superfl "valuesFor aaa222"],Relate=[],Where=[],With=[]}),
neuper@55356
   214
   Matches
neuper@55356
   215
     (["pbla2","pbla"],
neuper@55356
   216
      {Find=[],
neuper@55356
   217
       Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222"],
neuper@55356
   218
       Relate=[],Where=[],With=[]}),
neuper@55356
   219
   NoMatch
neuper@55356
   220
     (["pbla2x","pbla2","pbla"],
neuper@55356
   221
      {Find=[],
neuper@55356
   222
       Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
neuper@55356
   223
              Missing "functionOf a2x_"],Relate=[],Where=[],With=[]}),
neuper@55356
   224
   NoMatch
neuper@55356
   225
     (["pbla2y","pbla2","pbla"],
neuper@55356
   226
      {Find=[],
neuper@55356
   227
       Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
neuper@55356
   228
              Missing "boundVariable a2y_"],Relate=[],Where=[],With=[]}),
neuper@55356
   229
   NoMatch
neuper@55356
   230
     (["pbla2z","pbla2","pbla"],
neuper@55356
   231
      {Find=[],
neuper@55356
   232
       Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
neuper@55356
   233
              Missing "interval a2z_"],Relate=[],Where=[],With=[]}),
neuper@55356
   234
   NoMatch
neuper@55356
   235
     (["pbla3","pbla"],
neuper@55356
   236
      {Find=[],
neuper@55356
   237
       Given=[Correct "fixedValues [aaa = #0]",Missing "relations a3_",
neuper@55356
   238
              Superfl "valuesFor aaa222"],Relate=[],Where=[],With=[]})]
neuper@55356
   239
  : match list*)
neuper@55356
   240
neuper@55356
   241
(*case 4: refined to children (without child)*)
neuper@55356
   242
case refine fmz4 ["pbla", "refine", "test"] of
neuper@55356
   243
    [Matches (["pbla", "refine", "test"], _), 
neuper@55356
   244
     NoMatch (["pbla1", "pbla", "refine", "test"], _), 
neuper@55356
   245
     Matches (["pbla2", "pbla", "refine", "test"], _), 
neuper@55356
   246
     NoMatch (["pbla2x", "pbla2", "pbla", "refine", "test"], _), 
neuper@55356
   247
     Matches (["pbla2y", "pbla2", "pbla", "refine", "test"], _)] => ()
neuper@55356
   248
  | _ => error "--- refine test-pbtyps --- broken with case 4";
neuper@55356
   249
(* 
neuper@55356
   250
*** pass ["pbla"]
neuper@55356
   251
*** pass ["pbla","pbla1"]
neuper@55356
   252
*** pass ["pbla","pbla2"]
neuper@55356
   253
*** pass ["pbla","pbla2","pbla2x"]
neuper@55356
   254
*** pass ["pbla","pbla2","pbla2y"]
neuper@55356
   255
val it =
neuper@55356
   256
  [Matches
neuper@55356
   257
     (["pbla"],
neuper@55356
   258
      {Find=[],
neuper@55356
   259
       Given=[Correct "fixedValues [aaa = #0]",Superfl "valuesFor aaa222",
neuper@55356
   260
              Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
neuper@55356
   261
   NoMatch
neuper@55356
   262
     (["pbla1","pbla"],
neuper@55356
   263
      {Find=[],
neuper@55356
   264
       Given=[Correct "fixedValues [aaa = #0]",Missing "maximum a1_",
neuper@55356
   265
              Superfl "valuesFor aaa222",Superfl "boundVariable aaa222yyy"],
neuper@55356
   266
       Relate=[],Where=[],With=[]}),
neuper@55356
   267
   Matches
neuper@55356
   268
     (["pbla2","pbla"],
neuper@55356
   269
      {Find=[],
neuper@55356
   270
       Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
neuper@55356
   271
              Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
neuper@55356
   272
   NoMatch
neuper@55356
   273
     (["pbla2x","pbla2","pbla"],
neuper@55356
   274
      {Find=[],
neuper@55356
   275
       Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
neuper@55356
   276
              Missing "functionOf a2x_",Superfl "boundVariable aaa222yyy"],
neuper@55356
   277
       Relate=[],Where=[],With=[]}),
neuper@55356
   278
   Matches
neuper@55356
   279
     (["pbla2y","pbla2","pbla"],
neuper@55356
   280
      {Find=[],
neuper@55356
   281
       Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
neuper@55356
   282
              Correct "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]})]
neuper@55356
   283
  : match list*)
neuper@55356
   284
neuper@55356
   285
(*case 5: start refinement somewhere in ptyps*)
neuper@55356
   286
case refine fmz4 ["pbla2","pbla", "refine", "test"] of
neuper@55356
   287
    [Matches (["pbla2", "pbla", "refine", "test"], _), 
neuper@55356
   288
     NoMatch (["pbla2x", "pbla2", "pbla", "refine", "test"], _), 
neuper@55356
   289
     Matches (["pbla2y", "pbla2", "pbla", "refine", "test"], _)] => ()
neuper@55356
   290
  | _ => error "--- refine test-pbtyps --- broken with case 5";
neuper@55356
   291
(* 
neuper@55356
   292
*** pass ["pbla","pbla2"]
neuper@55356
   293
*** pass ["pbla","pbla2","pbla2x"]
neuper@55356
   294
*** pass ["pbla","pbla2","pbla2y"]
neuper@55356
   295
val it =
neuper@55356
   296
  [Matches
neuper@55356
   297
     (["pbla2","pbla"],
neuper@55356
   298
      {Find=[],
neuper@55356
   299
       Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
neuper@55356
   300
              Superfl "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]}),
neuper@55356
   301
   NoMatch
neuper@55356
   302
     (["pbla2x","pbla2","pbla"],
neuper@55356
   303
      {Find=[],
neuper@55356
   304
       Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
neuper@55356
   305
              Missing "functionOf a2x_",Superfl "boundVariable aaa222yyy"],
neuper@55356
   306
       Relate=[],Where=[],With=[]}),
neuper@55356
   307
   Matches
neuper@55356
   308
     (["pbla2y","pbla2","pbla"],
neuper@55356
   309
      {Find=[],
neuper@55356
   310
       Given=[Correct "fixedValues [aaa = #0]",Correct "valuesFor aaa222",
neuper@55356
   311
              Correct "boundVariable aaa222yyy"],Relate=[],Where=[],With=[]})]
neuper@55356
   312
  : match list*)
neuper@55364
   313
neuper@37906
   314
"----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
neuper@37906
   315
"----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
neuper@37906
   316
"----------- Refine_Problem (aus subp-rooteq.sml) ----------------";
neuper@42390
   317
(*WN120313: attention: the 'nxt' in the comments are not correct!*)
neuper@42390
   318
val c = [];
neuper@42390
   319
val fmz = ["equality ((x+1)*(x+2)=x^^^2+(8::real))","solveFor x",
neuper@37906
   320
	   "errorBound (eps=0)","solutions L"];
neuper@38058
   321
val (dI',pI',mI') = ("Test",["sqroot-test","univariate","equation","test"],
neuper@37906
   322
		     ["Test","squ-equ-test-subpbl1"]);
neuper@37906
   323
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@42390
   324
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@42390
   325
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@42390
   326
val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = ("Add_Find", Add_Find "solutions L")*)
akargl@42188
   327
neuper@55279
   328
val nxt = ("Specify_Problem", 	  Specify_Problem ["LINEAR","univariate","equation","test"]);
neuper@42390
   329
(*=== specify a not-matching problem ------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
neuper@37906
   330
val (p,_,f,nxt,_,pt) = me nxt p c pt;
wneuper@59253
   331
val www = 
wneuper@59253
   332
case f of Form' (PpcKF (0, EdUndef, 0, Nundef, (Problem [],
wneuper@59253
   333
  {Find = [Incompl "solutions"], With = [],
wneuper@59253
   334
   Given = [Correct "equality ((x + 1) * (x + 2) = x ^^^ 2 + 8)", Correct "solveFor x"],
wneuper@59253
   335
   Where = [False www],
wneuper@59253
   336
   Relate = [],...}))) => www
wneuper@59253
   337
| _ => error "--- Refine_Problem broken 1";
wneuper@59253
   338
if www = "matches (x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) |\nmatches (?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) |\nmatches (?a + x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8) |\nmatches (?a + ?b * x = 0) ((x + 1) * (x + 2) = x ^^^ 2 + 8)"
wneuper@59253
   339
then () else error "--- Refine_Problem broken 2";
neuper@37906
   340
(*ML> f; 
neuper@37906
   341
val it = Form' (PpcKF (0,EdUndef,0,Nundef,
neuper@55279
   342
        (Problem ["LINEAR","univariate","equation","test"],   <<<<<===== diff.to above WN120313
neuper@37906
   343
         {Find=[Incompl "solutions []"],
neuper@37906
   344
          Given=[Correct "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)",
neuper@37906
   345
                 Correct "solveFor x"],Relate=[],
neuper@37906
   346
          Where=[False "matches (x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
neuper@37906
   347
                |\nmatches (?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
neuper@37906
   348
                |\nmatches (?a + x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)
neuper@37906
   349
        |\nmatches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)"],
neuper@37906
   350
          With=[]}))) : mout
neuper@37906
   351
val nxt = ("Add_Find",Add_Find "solutions L") ????!!!!????*)
neuper@37906
   352
neuper@42390
   353
val (p,_,f,nxt,_,pt) = (me nxt p c pt) (*handle e => OldGoals.print_exn e*);
neuper@42390
   354
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   355
(*val nxt = ("Empty_Tac",Empty_Tac) 
neuper@55279
   356
... Refine_Problem ["LINEAR"..] fails internally 040312: works!?!*)
neuper@37906
   357
neuper@37906
   358
val nxt = ("Refine_Problem",Refine_Problem ["univariate","equation","test"]);
neuper@42390
   359
(*=== refine problem -----------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*)
neuper@37906
   360
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   361
(*("Specify_Problem", Specify_Problem ["normalize", "univariate", ...])*)
neuper@37906
   362
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@38058
   363
(*nxt = ("Specify_Theory", Specify_Theory "Test")*)
neuper@37906
   364
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   365
(*nxt = ("Specify_Method", Specify_Method ["Test", "squ-equ-test-subpbl1"]*)
neuper@37906
   366
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   367
(*nxt = ("Apply_Method", *)
neuper@37906
   368
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   369
(*nxt = ("Rewrite_Set", Rewrite_Set "norm_equation")*)
neuper@37906
   370
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   371
(*nxt = ("Rewrite_Set", Rewrite_Set "Test_simplify")*)
neuper@37906
   372
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@55279
   373
(*Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]*)
neuper@37906
   374
neuper@37906
   375
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@55279
   376
(*nxt = Model_Problem ["LINEAR","univariate","equation","test"]*)
neuper@37906
   377
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   378
(*nxt = ("Add_Given", Add_Given "equality (-6 + 3 * x = 0)"*)
neuper@37906
   379
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   380
(**)
neuper@42390
   381
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   382
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   383
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@55279
   384
(*nxt = Specify_Problem ["LINEAR","univariate","equation","test"])*)
neuper@37906
   385
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   386
(*xt = ("Specify_Method", Specify_Method ["Test", "solve_linear"])*)
neuper@37906
   387
val nxt = ("Refine_Problem",Refine_Problem ["univariate","equation","test"]);
neuper@37906
   388
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@55279
   389
(*("Specify_Problem", Specify_Problem ["LINEAR", "univariate", ...])*)
neuper@37906
   390
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   391
(*val nxt = ("Specify_Method",Specify_Method ("Test","solve_linear"))*)
neuper@37906
   392
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   393
(*val nxt = ("Apply_Method",Apply_Method ("Test","solve_linear"))*)
neuper@37906
   394
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   395
(*val nxt = ("Rewrite_Set_Inst",Rewrite_Set_Inst ([#],"isolate_bdv"))*)
neuper@37906
   396
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   397
(*val nxt = ("Rewrite_Set",Rewrite_Set "Test_simplify")*)
neuper@37906
   398
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@55279
   399
(*val nxt = ("Check_Postcond",Check_Postcond ["LINEAR","univariate","eq*)
neuper@37906
   400
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   401
(*val nxt = ("Check_elementwise",Check_elementwise "Assumptions")*)
neuper@37906
   402
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   403
(*Check_Postcond ["normalize","univariate","equation","test"])*)
neuper@37906
   404
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   405
val Form' (FormKF (~1,EdUndef,_,Nundef,res)) = f;
neuper@42390
   406
wneuper@59253
   407
if res = "[x = 2]"
wneuper@59253
   408
then case nxt of ("End_Proof'", End_Proof') => ()
wneuper@59253
   409
  | _ => error "new behaviour in test:refine.sml:miniscript with mini-subpb 1"
wneuper@59253
   410
else error "new behaviour in test:refine.sml:miniscript with mini-subpb 2" 
neuper@37906
   411
neuper@37906
   412
"----------- fun coll_guhs ---------------------------------------";
neuper@37906
   413
"----------- fun coll_guhs ---------------------------------------";
neuper@37906
   414
"----------- fun coll_guhs ---------------------------------------";
neuper@37906
   415
val n = e_pbt;
neuper@37906
   416
(#guh : pbt -> guh) e_pbt;
neuper@37906
   417
neuper@37906
   418
fun XXXnode coll (Ptyp (_,[n],ns)) =
neuper@37906
   419
    [(#guh : pbt -> guh) n]
neuper@37906
   420
and XXXnodes coll [] = coll
neuper@37906
   421
  | XXXnodes coll (n::ns : pbt ptyp list) = (XXXnode coll n) @ 
neuper@37906
   422
					    (XXXnodes coll ns);
neuper@37906
   423
(*^^^ this works, but not this ...
neuper@37906
   424
fun node coll (Ptyp (_,[n],ns)) =
neuper@37906
   425
    [(#guh : 'a -> guh) n]
neuper@37906
   426
and nodes coll [] = coll
neuper@37906
   427
  | nodes coll (n::ns : 'a ptyp list) = (node coll n) @ (nodes coll ns);
neuper@37906
   428
neuper@37906
   429
Error:
neuper@37906
   430
Can't unify {guh: 'a, ...} with 'b (Cannot unify with explicit type variable)
neuper@37906
   431
   Found near #guh : 'a -> guh
neuper@37906
   432
neuper@37906
   433
i.e. there is no common fun for pbls and mets ?!?*)
neuper@37906
   434
s1210629013@55355
   435
coll_pblguhs (get_ptyps ());
s1210629013@55354
   436
sort string_ord (coll_pblguhs (get_ptyps ()));
neuper@37906
   437
show_pblguhs ();
neuper@37906
   438
sort_pblguhs ();
neuper@37906
   439
neuper@37906
   440
"----------- fun guh2kestoreID -----------------------------------";
neuper@37906
   441
"----------- fun guh2kestoreID -----------------------------------";
neuper@37906
   442
"----------- fun guh2kestoreID -----------------------------------";
neuper@37906
   443
"----- we assumed the problem-hierarchy containing 3 elements on toplevel";
akargl@42188
   444
(* ERROR: Exception Bind raised *)
neuper@37906
   445
val (Ptyp (id1,[n1 as {guh=guh1,...} : pbt], ns1)::
s1210629013@55354
   446
     Ptyp (id2,[n2 as {guh=guh2,...} : pbt], ns2):: _) = (get_ptyps ());
akargl@42188
   447
neuper@37906
   448
(*
neuper@55356
   449
nodes [] guh1 (get_ptyps ());
neuper@55356
   450
nodes [] guh2 (get_ptyps ());
neuper@37906
   451
*)
neuper@37906
   452
val (Ptyp (id1,[n1 as {guh=guh1,...} : pbt], ns1)
neuper@37906
   453
     ::
neuper@37906
   454
     Ptyp (id2,[n2 as {guh=guh2,...} : pbt], 
neuper@37906
   455
	   (Ptyp (id21,[n21 as {guh=guh21,...} : pbt], ns21)) :: _ )
neuper@37906
   456
     ::
neuper@37906
   457
     Ptyp (id3,[n3 as {guh=guh3,...} : pbt], ns3)
neuper@37906
   458
     ::
s1210629013@55354
   459
     _ ) = (get_ptyps ());
neuper@37906
   460
(*
neuper@55356
   461
nodes [] guh3 (get_ptyps ());
neuper@55356
   462
nodes [] guh21 (get_ptyps ());
neuper@38036
   463
*)
neuper@42390
   464