test/Tools/isac/Interpret/script.sml
author Walther Neuper <wneuper@ist.tugraz.at>
Thu, 20 Oct 2016 10:26:29 +0200
changeset 59253 f0bb15a046ae
parent 59252 7d3dbc1171ff
child 59257 a1daf71787b1
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@41999
     1
(* Title:  test/../script.sml
neuper@41999
     2
   Author: Walther Neuper 050908
neuper@37906
     3
   (c) copyright due to lincense terms.
neuper@37906
     4
*)
neuper@37906
     5
"-----------------------------------------------------------------";
neuper@37906
     6
"table of contents -----------------------------------------------";
neuper@37906
     7
"-----------------------------------------------------------------";
neuper@37906
     8
"----------- WN0509 why does next_tac doesnt find Substitute -----";
neuper@37906
     9
"----------- WN0509 Substitute 2nd part --------------------------";
neuper@37906
    10
"----------- fun sel_appl_atomic_tacs ----------------------------";
neuper@41969
    11
"----------- fun init_form, fun get_stac -------------------------";
neuper@41972
    12
"----------- x+1=2 start SubProblem 'stac2tac_ TODO: no match for ";
neuper@42283
    13
"----------- Take as 1st stac in script --------------------------";
neuper@42394
    14
"----------- 'trace_script' from outside 'fun me '----------------";
neuper@42438
    15
"----------- fun sel_rules ---------------------------------------";
neuper@42438
    16
"----------- fun sel_appl_atomic_tacs ----------------------------";
neuper@37906
    17
"-----------------------------------------------------------------";
neuper@37906
    18
"-----------------------------------------------------------------";
neuper@37906
    19
"-----------------------------------------------------------------";
neuper@37906
    20
neuper@42438
    21
val thy =  @{theory Isac};
neuper@42281
    22
neuper@37906
    23
"----------- WN0509 why does next_tac doesnt find Substitute -----";
neuper@37906
    24
"----------- WN0509 why does next_tac doesnt find Substitute -----";
neuper@37906
    25
"----------- WN0509 why does next_tac doesnt find Substitute -----";
neuper@37906
    26
neuper@37906
    27
(*replace met 'IntegrierenUndKonstanteBestimmen' with this script...*)
neuper@37906
    28
val str = (*#1#*)
akargl@42169
    29
"Script BiegelinieScript                                             " ^ 
akargl@42169
    30
"(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real)              " ^ 
akargl@42169
    31
"(rb_rb::bool list) (rm_rm::bool list) =                             " ^
akargl@42169
    32
"  (let q___q = Take (M_b v_v = q__q);                               " ^
akargl@42169
    33
"       (M1__M1::bool) = ((Substitute [v_v = 0])) q___q              " ^
akargl@42169
    34
" in True)";
akargl@42169
    35
wneuper@59188
    36
val sc' = ((inst_abs thy) o Thm.term_of o the o (parse thy)) str;
neuper@37906
    37
neuper@37906
    38
val str = (*#2#*)
akargl@42169
    39
"Script BiegelinieScript                                             " ^ 
akargl@42169
    40
"(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real)              " ^ 
akargl@42169
    41
"(rb_rb::bool list) (rm_rm::bool list) =                             " ^ 
akargl@42169
    42
"       (M1__M1::bool) = ((Substitute [v_v = 0]) @@                  " ^
akargl@42169
    43
" in True)";(*..doesnt find Substitute with ..@@ !!!!!!!!!!!!!!!!!!!!!*)
neuper@37906
    44
neuper@37906
    45
val str = (*#3#*)
akargl@42169
    46
"Script BiegelinieScript                                             " ^
akargl@42169
    47
"(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real)              " ^
akargl@42169
    48
"(rb_rb::bool list) (rm_rm::bool list) =                             " ^
akargl@42169
    49
"  (let q___q = Take (q_q v_v = q__q);                               " ^
akargl@42169
    50
"      (M1__M1::bool) = Substitute [v_v = 0]      q___q ;            " ^
akargl@42169
    51
"       M1__m1 =        Substitute [M_b 0 = 0]  M1__M1               " ^
akargl@42169
    52
" in True)"
neuper@37906
    53
;
neuper@37906
    54
val str = (*#4#*)
akargl@42169
    55
"Script BiegelinieScript                                             " ^
akargl@42169
    56
"(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real)              " ^
akargl@42169
    57
"(rb_rb::bool list) (rm_rm::bool list) =                             " ^
akargl@42169
    58
"  (let q___q = Take (q_q v_v = q__q);                               " ^
akargl@42169
    59
"      (M1__M1::bool) = Substitute [v_v = 0]      q___q ;            " ^
akargl@42169
    60
"       M1__M1 =        Substitute [v_v = 1]      q___q ;            " ^
akargl@42169
    61
"       M1__M1 =        Substitute [v_v = 2]      q___q ;            " ^
akargl@42169
    62
"       M1__M1 =        Substitute [v_v = 3]      q___q ;            " ^
akargl@42169
    63
"       M1__M1 =        Substitute [M_b 0 = 0]  M1__M1               " ^
akargl@42169
    64
" in True)"
neuper@37906
    65
;
neuper@37906
    66
val str = (*#5#*)
akargl@42169
    67
"Script BiegelinieScript                                             " ^
akargl@42169
    68
"(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real)              " ^
akargl@42169
    69
"(rb_rb::bool list) (rm_rm::bool list) =                             " ^
akargl@42169
    70
"  (let q___q = Take (M_b v_v = q__q);                               " ^
akargl@42169
    71
"      (M1__M1::bool) = Substitute [v_v = 0]      q___q ;            " ^
akargl@42169
    72
"       M2__M2 = Take q___q ;                                        " ^
akargl@42169
    73
"       M2__M2 =        Substitute [v_v = 2]      q___q              " ^
akargl@42169
    74
" in True)"
neuper@37906
    75
;
akargl@42145
    76
wneuper@59188
    77
val sc' = ((inst_abs thy) o Thm.term_of o the o (parse thy)) str;
neuper@37906
    78
atomty sc';
akargl@42145
    79
neuper@48790
    80
val {scr = Prog sc,...} = get_met ["IntegrierenUndKonstanteBestimmen"];
neuper@37906
    81
(*---------------------------------------------------------------------
neuper@38031
    82
if sc = sc' then () else error"script.sml, doesnt find Substitute #1";
neuper@37906
    83
---------------------------------------------------------------------*)
neuper@37906
    84
neuper@37906
    85
"----------- WN0509 Substitute 2nd part --------------------------";
neuper@37906
    86
"----------- WN0509 Substitute 2nd part --------------------------";
neuper@37906
    87
"----------- WN0509 Substitute 2nd part --------------------------";
neuper@37906
    88
(*replace met 'IntegrierenUndKonstanteBestimmen' with this script...*)
neuper@37906
    89
val str = (*Substitute ; Substitute works*)
akargl@42169
    90
"Script BiegelinieScript                                             " ^
akargl@42169
    91
"(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real)              " ^
akargl@42169
    92
"(rb_rb::bool list) (rm_rm::bool list) =                             "^
neuper@37906
    93
(*begin after the 2nd integrate*)
akargl@42169
    94
"  (let M__M = Take (M_b v_v = q__q);                                " ^
akargl@42169
    95
"       e1__e1 = nth_nth 1 rm_rm ;                                   " ^
akargl@42169
    96
"       (x1__x1::real) = argument_in (lhs e1__e1);                   " ^
akargl@42169
    97
"       (M1__M1::bool) = Substitute [v_v = x1__x1] M__M;             " ^
akargl@42169
    98
"        M1__M1        = Substitute [e1__e1] M1__M1                  " ^
akargl@42169
    99
" in True)"
neuper@37906
   100
;
wneuper@59188
   101
val sc' = ((inst_abs thy) o Thm.term_of o the o (parse thy)) str;
neuper@37906
   102
atomty sc';
akargl@42145
   103
neuper@37906
   104
val str = (*Substitute @@ Substitute does NOT work???*)
akargl@42169
   105
"Script BiegelinieScript                                             " ^
akargl@42169
   106
"(l_l::real) (q__q::real) (v_v::real) (b_b::real=>real)              " ^
akargl@42169
   107
"(rb_rb::bool list) (rm_rm::bool list) =                             "^
neuper@37906
   108
(*begin after the 2nd integrate*)
akargl@42169
   109
"  (let M__M = Take (M_b v_v = q__q);                                " ^
akargl@42169
   110
"       e1__e1 = nth_nth 1 rm_rm ;                                   " ^
akargl@42169
   111
"       (x1__x1::real) = argument_in (lhs e1__e1);                   " ^
akargl@42169
   112
"       (M1__M1::bool) = ((Substitute [v_v = x1__x1]) @@             " ^
akargl@42169
   113
"                       (Substitute [e1__e1]))        M__M           " ^
akargl@42169
   114
" in True)"
neuper@37906
   115
;
neuper@37906
   116
neuper@48790
   117
val {scr = Prog sc,...} = get_met ["IntegrierenUndKonstanteBestimmen"];
neuper@37906
   118
(*---------------------------------------------------------------------
akargl@42169
   119
if sc = sc' then () else error "script.sml, doesnt find Substitute #1";
neuper@37906
   120
---------------------------------------------------------------------*)
neuper@37906
   121
val fmz = ["Traegerlaenge L",
neuper@37906
   122
	   "Streckenlast (- q_0 * x^^^2 / 2 + x * c + c_2)",
neuper@37906
   123
	   "Biegelinie y",
neuper@37906
   124
	   "RandbedingungenBiegung [y 0 = 0, y L = 0]",
neuper@37906
   125
	   "RandbedingungenMoment [M_b 0 = 0, M_b L = 0]",
neuper@37906
   126
	   "FunktionsVariable x"];
neuper@37906
   127
val (dI',pI',mI') =
neuper@38058
   128
  ("Biegelinie",["MomentBestimmte","Biegelinien"],
neuper@37906
   129
   ["IntegrierenUndKonstanteBestimmen"]);
neuper@37906
   130
val p = e_pos'; val c = [];
neuper@37906
   131
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
akargl@42169
   132
val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
akargl@42169
   133
val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
akargl@42169
   134
val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
akargl@42169
   135
val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
akargl@42169
   136
val (p,_,f,nxt,_,pt) = me nxt p c pt; val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   137
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   138
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@37906
   139
case nxt of (_, Apply_Method ["IntegrierenUndKonstanteBestimmen"]) => ()
neuper@38031
   140
	  | _ => error "script.sml, doesnt find Substitute #2";
akargl@42169
   141
(* ERROR: caused by f2str f *)
neuper@52101
   142
trace_rewrite := false;
neuper@42387
   143
neuper@37906
   144
val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f(*------------------------*);
neuper@37906
   145
trace_rewrite:=false;
akargl@42169
   146
  (*Exception TYPE raised:
akargl@42169
   147
    Illegal type for constant "HOL.eq" :: "[real, bool] => bool"
akargl@42169
   148
    Atools.argument'_in (Tools.lhs (ListG.nth_ (1 + -1 + -1) [])) =
akargl@42169
   149
    ListG.nth_ (1 + -1 + -1) []
akargl@42169
   150
    Exception-
akargl@42169
   151
       TYPE
akargl@42169
   152
          ("Illegal type for constant \"op =\" :: \"[real, bool] => bool\"",
akargl@42169
   153
             [],
akargl@42169
   154
             [Const ("HOL.Trueprop", "bool => prop") $
neuper@55279
   155
                   (Const ("HOL.eq", "["Real.real, bool] => bool") $ ... $ ...)])
akargl@42169
   156
       raised
akargl@42169
   157
    ... this was because eval_argument_in took "argument_in (lhs (M_b 0 = 0))"
akargl@42169
   158
    ie. the argument had not been simplified before          ^^^^^^^^^^^^^^^
akargl@42169
   159
    thus corrected eval_argument_in OK*)
neuper@37906
   160
val {srls,...} = get_met ["IntegrierenUndKonstanteBestimmen"];
neuper@42387
   161
val e1__e1 = str2term "NTH 1 [M_b 0 = 0, M_b L = 0]";
akargl@42169
   162
val e1__e1 = eval_listexpr_ @{theory Biegelinie} srls e1__e1; term2str e1__e1;
akargl@42169
   163
if term2str e1__e1 = "M_b 0 = 0"
akargl@42169
   164
  then ()
akargl@42169
   165
  else error"script.sml diff.beh. eval_listexpr_ nth_nth 1 [...";
neuper@37906
   166
neuper@37906
   167
(*TODO.WN050913 ??? doesnt eval_listexpr_ go into subterms ???...
akargl@42169
   168
 val x1__ = str2term"argument_in (lhs (M_b 0 = 0))";
akargl@42169
   169
 val x1__ = eval_listexpr_ Biegelinie.thy srls x1__; term2str x1__;
akargl@42169
   170
 (*no rewrite*)
akargl@42169
   171
 calculate_ Biegelinie.thy ("Tools.lhs", eval_rhs"eval_lhs_") x1__;
akargl@42169
   172
 val SOME (str, t) = eval_lhs 0 "Tools.lhs" (str2term"lhs (M_b 0 = 0)") 0;*)
neuper@37906
   173
akargl@42169
   174
val l__l = str2term "lhs (M_b 0 = 0)";
akargl@42169
   175
val l__l = eval_listexpr_ @{theory Biegelinie} srls l__l; term2str l__l;
akargl@42169
   176
val SOME (str, t) = eval_lhs 0 "Tools.lhs" (str2term "lhs (M_b 0 = 0)") 0;
neuper@42387
   177
akargl@42169
   178
val (p,_,f,nxt,_,pt) = me nxt p c pt; f2str f (*------------------------*);
wneuper@59253
   179
val thm = case nxt of ("Rewrite", Rewrite ("Belastung_Querkraft", thm)) => thm
wneuper@59253
   180
| _ => error "--- WN0509 Substitute 2nd part --- changed 1";
wneuper@59253
   181
if (term2str o Thm.prop_of) thm = "- qq ?x = Q' ?x" then ()
wneuper@59253
   182
else error "--- WN0509 Substitute 2nd part --- changed 2";
neuper@37906
   183
neuper@37906
   184
neuper@37906
   185
"----------- fun sel_appl_atomic_tacs ----------------------------";
neuper@37906
   186
"----------- fun sel_appl_atomic_tacs ----------------------------";
neuper@37906
   187
"----------- fun sel_appl_atomic_tacs ----------------------------";
akargl@42145
   188
s1210629013@55445
   189
reset_states ();
neuper@41970
   190
CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
neuper@41970
   191
  ("Test", ["sqroot-test","univariate","equation","test"],
neuper@37906
   192
   ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
   193
Iterator 1;
neuper@37906
   194
moveActiveRoot 1;
wneuper@59248
   195
autoCalculate 1 CompleteCalcHead;
wneuper@59248
   196
autoCalculate 1 (Step 1);
wneuper@59248
   197
autoCalculate 1 (Step 1);
neuper@37906
   198
val ((pt, p), _) = get_calc 1; show_pt pt;
neuper@37906
   199
val appltacs = sel_appl_atomic_tacs pt p;
wneuper@59252
   200
case appltacs of 
wneuper@59252
   201
  [Rewrite ("radd_commute", radd_commute), 
wneuper@59252
   202
  Rewrite ("add_assoc", add_assoc), Calculate "TIMES"]
wneuper@59253
   203
  => if (term2str o Thm.prop_of) radd_commute = "?m + ?n = ?n + ?m" andalso 
wneuper@59253
   204
        (term2str o Thm.prop_of) add_assoc = "?a + ?b + ?c = ?a + (?b + ?c)" then ()
wneuper@59252
   205
        else error "script.sml fun sel_appl_atomic_tacs diff.behav. 2"
wneuper@59252
   206
| _ => error "script.sml fun sel_appl_atomic_tacs diff.behav. 1";
neuper@37906
   207
neuper@37906
   208
trace_script := true;
neuper@37906
   209
trace_script := false;
neuper@37906
   210
applyTactic 1 p (hd appltacs);
neuper@37906
   211
val ((pt, p), _) = get_calc 1; show_pt pt;
neuper@37906
   212
val appltacs = sel_appl_atomic_tacs pt p;
neuper@48895
   213
(*applyTactic 1 p (hd appltacs); WAS assy: call by ([3], Pbl)*)
neuper@37906
   214
akargl@42169
   215
"~~~~~ fun applyTactic, args:"; val ((cI:calcID), ip, tac) = (1, p, (hd appltacs));
akargl@42169
   216
val ((pt, _), _) = get_calc cI;
akargl@42169
   217
val p = get_pos cI 1;
akargl@42169
   218
locatetac;
akargl@42169
   219
locatetac tac;
akargl@42169
   220
akargl@42169
   221
(*locatetac tac (pt, ip); (*WAS assy: call by ([3], Pbl)*)*)
akargl@42169
   222
"~~~~~ fun locatetac, args:"; val (tac, (ptp as (pt, p))) = (tac, (pt, ip));
akargl@42169
   223
val (mI,m) = mk_tac'_ tac;
akargl@42169
   224
applicable_in p pt m ; (*Appl*)
akargl@42169
   225
member op = specsteps mI; (*false*)
akargl@42169
   226
(*loc_solve_ (mI,m) ptp; (*Argument: (mI, m) : string * tac Reason: Can't unify tac_ with tac*)*)
akargl@42169
   227
loc_solve_; (*without _ ??? result is -> lOc writing error ???*)
akargl@42169
   228
(*val it = fn: string * tac_ -> ptree * (pos * pos_) -> lOc_*)
akargl@42169
   229
(mI,m); (*string * tac*)
akargl@42169
   230
ptp (*ptree * pos'*);
akargl@42169
   231
"~~~~~ fun loc_solve_, args:"; val (m ,(pt,pos)) = ((mI,m), ptp);
akargl@42169
   232
(*val (msg, cs') = solve m (pt, pos);
akargl@42169
   233
(*Argument: m : string * tac Reason: Can't unify tac_ with tac (Different type constructors)*)*)
akargl@42169
   234
m;
akargl@42169
   235
(pt, pos);
akargl@42169
   236
"~~~~~ fun solve, args:"; val ((mI,m), (pt, po as (p,p_))) = (m, (pt, pos));
akargl@42169
   237
(*solve has still p_!!!!!!!!!!!!!!!!!!!!!!!!!*)
akargl@42169
   238
akargl@42169
   239
e_metID = get_obj g_metID pt (par_pblobj pt p); (*false*)
akargl@42169
   240
val ctxt = get_ctxt pt po;
akargl@42169
   241
akargl@42169
   242
(*generate1 (assoc_thy (get_obj g_domID pt (par_pblobj pt p))) m (e_istate, ctxt) (p,p_) pt;
akargl@42169
   243
(*Argument: m : tac Reason: Can't unify tac_ with tac (Different type constructors)*)*)
akargl@42169
   244
(assoc_thy (get_obj g_domID pt (par_pblobj pt p)));
akargl@42169
   245
assoc_thy;
akargl@42169
   246
wneuper@59248
   247
autoCalculate 1 CompleteCalc;
neuper@37906
   248
neuper@41969
   249
"----------- fun init_form, fun get_stac -------------------------";
neuper@41969
   250
"----------- fun init_form, fun get_stac -------------------------";
neuper@41969
   251
"----------- fun init_form, fun get_stac -------------------------";
neuper@41969
   252
val fmz = ["equality (x+1=(2::real))", "solveFor x", "solutions L"];
neuper@41969
   253
val (dI',pI',mI') = ("Test",["sqroot-test","univariate","equation","test"],
neuper@41969
   254
  ["Test","squ-equ-test-subpbl1"]);
neuper@41969
   255
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@41969
   256
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@41969
   257
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@41969
   258
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@41969
   259
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@41969
   260
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@41969
   261
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@41969
   262
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@41969
   263
"~~~~~ fun me, args:"; val (_,tac) = nxt;
neuper@41969
   264
"~~~~~ fun locatetac, args:"; val ptp as (pt, p) = (pt, p);
neuper@41969
   265
val (mI,m) = mk_tac'_ tac;
neuper@41969
   266
val Appl m = applicable_in p pt m;
neuper@41969
   267
member op = specsteps mI; (*false*)
neuper@41969
   268
"~~~~~ fun loc_solve_, args:"; val (m, (pt, pos) ) = ((mI, m), ptp);
neuper@41969
   269
"~~~~~ fun solve, args:"; val (("Apply_Method", Apply_Method' (mI,_,_,_)), pos as (p,_)) = (m, pos);
neuper@41969
   270
val {srls, ...} = get_met mI;
neuper@41969
   271
val PblObj {meth=itms, ...} = get_obj I pt p;
neuper@41969
   272
val thy' = get_obj g_domID pt p;
neuper@41969
   273
val thy = assoc_thy thy';
neuper@41969
   274
val (is as ScrState (env,_,_,_,_,_), ctxt, sc) = init_scrstate thy itms mI;
neuper@41969
   275
val ini = init_form thy sc env;
neuper@48790
   276
"----- fun init_form, args:"; val (Prog sc) = sc;
neuper@41969
   277
"----- fun get_stac, args:"; val (y, h $ body) = (thy, sc);
neuper@41969
   278
case get_stac thy sc of SOME (Free ("e_e", _)) => ()
neuper@41969
   279
| _ => error "script: Const (?, ?) in script (as term) changed";;
neuper@41969
   280
neuper@41972
   281
neuper@41972
   282
"----------- x+1=2 start SubProblem 'stac2tac_ TODO: no match for ";
neuper@41972
   283
"----------- x+1=2 start SubProblem 'stac2tac_ TODO: no match for ";
neuper@41972
   284
"----------- x+1=2 start SubProblem 'stac2tac_ TODO: no match for ";
neuper@41972
   285
val fmz = ["equality (x+1=(2::real))", "solveFor x","solutions L"];
neuper@41972
   286
val (dI',pI',mI') =
neuper@41972
   287
  ("Test", ["sqroot-test","univariate","equation","test"],
neuper@41972
   288
   ["Test","squ-equ-test-subpbl1"]);
neuper@41972
   289
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@41972
   290
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@41972
   291
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@41972
   292
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@41972
   293
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@41972
   294
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@41972
   295
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@41972
   296
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@41972
   297
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@41972
   298
val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
neuper@41972
   299
(*val (p,_,f,nxt,_,pt) = me nxt p [1] pt; WAS: Empty_Tac, helpless*)
neuper@41972
   300
show_pt pt;
neuper@41972
   301
"~~~~~ fun me, args:"; val (_,tac) = nxt;
neuper@41973
   302
val (pt, p) = case locatetac tac (pt,p) of
neuper@41973
   303
	("ok", (_, _, ptp))  => ptp | _ => error "script.sml locatetac";
neuper@41972
   304
"~~~~~ fun step, args:"; val (ip as (_,p_), (ptp as (pt,p), tacis)) = (p, ((pt, e_pos'), []))
neuper@55279
   305
val pIopt = get_pblID (pt,ip); (*SOME ["LINEAR", "univariate", "equation", "test"]*)
neuper@41972
   306
tacis; (*= []*)
neuper@41972
   307
member op = [Pbl,Met] p_ andalso is_none (get_obj g_env pt (fst p)); (*= false*)
neuper@41972
   308
"~~~~~ fun nxt_solve_, args:"; val (ptp as (pt, pos as (p, p_))) = (pt, ip);
neuper@41972
   309
                                 (*WAS stac2tac_ TODO: no match for SubProblem*)
neuper@41972
   310
val thy' = get_obj g_domID pt (par_pblobj pt p);
neuper@41972
   311
val (srls, is, sc) = from_pblobj_or_detail' thy' (p,p_) pt;
neuper@48790
   312
"~~~~~ fun next_tac, args:"; val (thy, (ptp as (pt,(p,_)):ptree * pos'), (sc as Prog (h $ body)), 
neuper@41972
   313
	                               (ScrState (E,l,a,v,s,b), ctxt)) = ((thy',srls), (pt,pos), sc, is);
neuper@41972
   314
l; (*= [R, L, R, L, R, R]*)
neuper@41972
   315
val Appy (m', scrst as (_,_,_,v,_,_)) = nstep_up thy ptp sc E l Skip_ a v;
neuper@41972
   316
"~~~~~ dont like to go into nstep_up...";
neuper@41972
   317
val t = str2term ("SubProblem" ^ 
neuper@55279
   318
  "(Test', [LINEAR, univariate, equation, test], [Test, solve_linear])" ^
neuper@41972
   319
  "[BOOL (-1 + x = 0), REAL x]");
neuper@41972
   320
val (tac, tac_) = stac2tac_ pt @{theory "Isac"} t; (*WAS stac2tac_ TODO: no match for SubProblem*)
neuper@41972
   321
case tac_ of 
neuper@41972
   322
  Subproblem' _ => ()
neuper@41972
   323
| _ => error "script.sml x+1=2 start SubProblem from script";
neuper@41972
   324
neuper@41972
   325
neuper@42283
   326
"----------- Take as 1st stac in script --------------------------";
neuper@42283
   327
"----------- Take as 1st stac in script --------------------------";
neuper@42283
   328
"----------- Take as 1st stac in script --------------------------";
neuper@42283
   329
val p = e_pos'; val c = []; 
neuper@42283
   330
val (p,_,f,nxt,_,pt) = 
neuper@42283
   331
    CalcTreeTEST 
neuper@42283
   332
        [(["functionTerm (x^^^2 + 1)", "integrateBy x", "antiDerivative FF"],
neuper@42283
   333
          ("Integrate", ["integrate","function"], ["diff","integration"]))];
neuper@42283
   334
val (p,_,f,nxt,_,pt) = me nxt p c pt; (*nxt = ("Tac ", ...) --> Add_Given...*)
neuper@42283
   335
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@42283
   336
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@42283
   337
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@42283
   338
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@42283
   339
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@42283
   340
val (p,_,f,nxt,_,pt) = me nxt p c pt;
neuper@42283
   341
case nxt of (_, Apply_Method ["diff", "integration"]) => ()
neuper@42283
   342
          | _ => error "integrate.sml -- me method [diff,integration] -- spec";
neuper@42283
   343
"----- step 8: returns nxt = Rewrite_Set_Inst ([\"(bdv, x)\"],\"integration\")";
neuper@42283
   344
neuper@42283
   345
"~~~~~ fun me, args:"; val (((_,tac):tac'_), (p:pos'), _, (pt:ptree)) = (nxt, p, c, pt);
neuper@42283
   346
"~~~~~ fun locatetac, args:"; val (tac, (ptp as (pt, p))) = (tac, (pt,p));
neuper@42283
   347
val (mI,m) = mk_tac'_ tac;
neuper@42283
   348
val Appl m = applicable_in p pt m;
neuper@42283
   349
member op = specsteps mI (*false*);
neuper@42283
   350
"~~~~~ fun loc_solve_, args:"; val (m, (pt,pos)) = ((mI,m), ptp);
neuper@42283
   351
"~~~~~ fun solve, args:"; val ((_, m as Apply_Method' (mI, _, _, _)), (pt, (pos as (p,_)))) = 
neuper@42283
   352
                            (m, (pt, pos));
neuper@42283
   353
val {srls, ...} = get_met mI;
neuper@42283
   354
        val PblObj {meth=itms, ...} = get_obj I pt p;
neuper@42283
   355
        val thy' = get_obj g_domID pt p;
neuper@42283
   356
        val thy = assoc_thy thy';
neuper@42283
   357
        val (is as ScrState (env,_,_,_,_,_), ctxt, sc) = init_scrstate thy itms mI;
neuper@42283
   358
        val ini = init_form thy sc env;
neuper@42283
   359
        val p = lev_dn p;
neuper@42283
   360
ini = NONE; (*true*)
neuper@42283
   361
            val (m', (is', ctxt'), _) = next_tac (thy', srls) (pt, (p, Res)) sc (is, ctxt);
neuper@42283
   362
	            val d = e_rls (*FIXME: get simplifier from domID*);
neuper@42283
   363
"~~~~~ fun locate_gen, args:"; val ((ts as (thy',srls)), (m:tac_), ((pt,p):ptree * pos'), 
neuper@48790
   364
	                     (scr as Prog (h $ body),d), (ScrState (E,l,a,v,S,b), ctxt)) = 
neuper@42283
   365
                   ((thy',srls), m', (pt,(p, Res)), (sc,d), (is', ctxt'));
neuper@42283
   366
val thy = assoc_thy thy';
neuper@42283
   367
l = [] orelse ((*init.in solve..Apply_Method...*)
neuper@42283
   368
			         (last_elem o fst) p = 0 andalso snd p = Res); (*true*)
neuper@42283
   369
"~~~~~ fun assy, args:"; val (ya, (is as (E,l,a,v,S,b),ss), 
neuper@42283
   370
                   (Const ("HOL.Let",_) $ e $ (Abs (id,T,body)))) = 
neuper@42283
   371
                 ((thy',ctxt,srls,d,Aundef), ((E,[R],a,v,S,b), [(m,EmptyMout,pt,p,[])]), body);
neuper@42283
   372
 (*check: true*) term2str e = "Take (Integral f_f D v_v)";
neuper@42283
   373
"~~~~~ fun assy, args:"; val ((thy',ctxt,sr,d,ap), (is as (E,l,a,v,S,b), (m,_,pt,(p,p_),c)::ss), t) = 
neuper@42283
   374
                           (ya, ((E , l@[L,R], a,v,S,b),ss), e);
neuper@42283
   375
val (a', STac stac) = handle_leaf "locate" thy' sr E a v t;
neuper@42283
   376
(*             val ctxt = get_ctxt pt (p,p_)
neuper@42283
   377
exception PTREE "get_obj: pos = [0] does not exist" raised 
neuper@42283
   378
(line 908 of "/usr/local/isabisac/src/Tools/isac/Interpret/ctree.sml")*)
neuper@42283
   379
neuper@42283
   380
neuper@42394
   381
"----------- 'trace_script' from outside 'fun me '----------------";
neuper@42394
   382
"----------- 'trace_script' from outside 'fun me '----------------";
neuper@42394
   383
"----------- 'trace_script' from outside 'fun me '----------------";
neuper@42394
   384
val fmz = ["equality (x+1=(2::real))", "solveFor x","solutions L"];
neuper@42394
   385
val (dI',pI',mI') =
neuper@42394
   386
   ("Test", ["sqroot-test","univariate","equation","test"],
neuper@42394
   387
    ["Test","squ-equ-test-subpbl1"]);
neuper@42394
   388
val (p,_,f,nxt,_,pt) = CalcTreeTEST [(fmz, (dI',pI',mI'))];
neuper@42394
   389
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42394
   390
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42394
   391
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42394
   392
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42394
   393
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42394
   394
val (p,_,f,nxt,_,pt) = me nxt p [] pt;
neuper@42394
   395
val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*nxt = Apply_Method ["Test", "squ-equ-test-subpbl1"]*)
neuper@42394
   396
(*from_pblobj_or_detail': no istate = from_pblobj_or_detail' "Isac" p pt;*)
neuper@42394
   397
neuper@42394
   398
val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*---------------------------------------------------*)
neuper@42394
   399
val (p'''', pt'''') = (p, pt);
wneuper@59253
   400
f2str f = "x + 1 = 2"; case snd nxt of Rewrite_Set "norm_equation" => () | _ => error "CHANGED";
neuper@42394
   401
val (p, p_) = p(* = ([1], Frm)*);
neuper@48790
   402
val (srls, (ScrState scrstate, ctxt), Prog sc) = from_pblobj_or_detail' "Isac" (p, p_) pt;
neuper@42394
   403
val (env, loc_, curry_arg, res, Safe, true) = scrstate;
neuper@42394
   404
  env2str env = "[\"\n(e_e, x + 1 = 2)\",\"\n(v_v, x)\"]";
neuper@42394
   405
  loc_ = [];
neuper@42394
   406
  curry_arg = NONE;
neuper@42394
   407
  term2str res = "??.empty";                     (* scrstate before starting interpretation *)
neuper@48790
   408
(*term2str (go loc_ sc) = "Prog Solve_root_equation e_e v_v = ...*)
neuper@42394
   409
neuper@42394
   410
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
neuper@42394
   411
val (p'''', pt'''') = (p, pt);
wneuper@59253
   412
f2str f = "x + 1 + -1 * 2 = 0";
wneuper@59253
   413
case snd nxt of Rewrite_Set "Test_simplify" => () | _ => error "CHANGED";
neuper@42394
   414
val (p, p_) = p(* = ([1], Res)*);
neuper@48790
   415
val (srls, (ScrState scrstate, ctxt), Prog sc) = from_pblobj_or_detail' "Isac" (p, p_) pt;
neuper@42394
   416
val (env, loc_, curry_arg, res, Safe, true) = scrstate;
neuper@42394
   417
  env2str env = "[\"\n(e_e, x + 1 = 2)\",\"\n(v_v, x)\"]";
neuper@42394
   418
  loc_ = [R, L, R, L, L, R, R];
neuper@42394
   419
  curry_arg = SOME (str2term "e_e::bool");
neuper@42394
   420
  term2str res = "x + 1 + -1 * 2 = 0";(* scrstate after norm_equation, before Test_simplify *)
neuper@42394
   421
term2str (go loc_ sc) = "Rewrite_Set norm_equation False";
neuper@42394
   422
neuper@42394
   423
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
neuper@42394
   424
val (p'''', pt'''') = (p, pt);
wneuper@59253
   425
f2str f = "-1 + x = 0";
wneuper@59253
   426
case snd nxt of Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]) => () 
wneuper@59253
   427
| _ => error "CHANGED";
neuper@42394
   428
val (p, p_) = p(* = ([2], Res)*);
neuper@48790
   429
val (srls, (ScrState scrstate, ctxt), Prog sc) = from_pblobj_or_detail' "Isac" (p, p_) pt;
neuper@42394
   430
val (env, loc_, curry_arg, res, Safe, false) = scrstate;
neuper@42394
   431
  env2str env = "[\"\n(e_e, x + 1 = 2)\",\"\n(v_v, x)\"]";
neuper@42394
   432
  loc_ = [R, L, R, L, R, R];
neuper@42394
   433
  curry_arg = SOME (str2term "e_e::bool");
neuper@42394
   434
  term2str res = "-1 + x = 0";           (* scrstate after Test_simplify, before Subproblem *)
neuper@42394
   435
term2str (go loc_ sc) = "Rewrite_Set Test_simplify False";
neuper@42394
   436
neuper@42394
   437
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
neuper@42394
   438
val (p'''', pt'''') = (p, pt);     (*f2str f = exception Match; ...is a model, not a formula*)
neuper@42394
   439
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
neuper@42394
   440
val (p'''', pt'''') = (p, pt);
neuper@42394
   441
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
neuper@42394
   442
val (p'''', pt'''') = (p, pt);
neuper@42394
   443
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
neuper@42394
   444
val (p'''', pt'''') = (p, pt);
neuper@42394
   445
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
neuper@42394
   446
val (p'''', pt'''') = (p, pt);
neuper@42394
   447
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
neuper@42394
   448
val (p'''', pt'''') = (p, pt);
neuper@42394
   449
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
neuper@42394
   450
val (p'''', pt'''') = (p, pt);
neuper@42394
   451
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*nxt = Apply_Method ["Test", "solve_linear"]*)
neuper@42394
   452
(*from_pblobj_or_detail': no istate = from_pblobj_or_detail' "Isac" p pt;*)
neuper@42394
   453
neuper@42394
   454
val (p,_,f,nxt,_,pt) = me nxt p [] pt; (*---------------------------------------------------*)
neuper@42394
   455
val (p'''', pt'''') = (p, pt);
wneuper@59253
   456
f2str f = "-1 + x = 0";
wneuper@59253
   457
case snd nxt of Rewrite_Set_Inst (["(bdv, x)"], "isolate_bdv") => () | _ => error "CHANGED";
neuper@42394
   458
val (p, p_) = p(* = ([3, 1], Frm)*);
neuper@48790
   459
val (srls, (ScrState scrstate, ctxt), Prog sc) = from_pblobj_or_detail' "Isac" (p, p_) pt;
neuper@42394
   460
val (env, loc_, curry_arg, res, Safe, true) = scrstate;
neuper@42394
   461
  env2str env = "[\"\n(e_e, -1 + x = 0)\",\"\n(v_v, x)\"]";
neuper@42394
   462
  loc_ = [];
neuper@42394
   463
  curry_arg = NONE;
neuper@42394
   464
  term2str res = "??.empty";                     (* scrstate before starting interpretation *)
neuper@48790
   465
(*term2str (go loc_ sc) = "Prog Solve_linear e_e v_v = ...*)
neuper@42394
   466
neuper@42394
   467
val (p,_,f,nxt,_,pt) = me nxt p'''' [] pt''''; (*-------------------------------------------*)
neuper@42394
   468
val (p'''', pt'''') = (p, pt);
wneuper@59253
   469
f2str f = "x = 0 + -1 * -1";
wneuper@59253
   470
case snd nxt of Rewrite_Set "Test_simplify" => () | _ => error "CHANGED";
neuper@42394
   471
val (p, p_) = p(* = ([3, 1], Res)*);
neuper@48790
   472
val (srls, (ScrState scrstate, ctxt), Prog sc) = from_pblobj_or_detail' "Isac" (p, p_) pt;
neuper@42394
   473
val (env, loc_, curry_arg, res, Safe, true) = scrstate;
neuper@42394
   474
  env2str env = "[\"\n(e_e, -1 + x = 0)\",\"\n(v_v, x)\"]";
neuper@42394
   475
  loc_ = [R, L, R, L, R, L, R];
neuper@42394
   476
  curry_arg = SOME (str2term "e_e::bool");
neuper@42394
   477
  term2str res = "x = 0 + -1 * -1";(* scrstate after isolate_bdv, before Test_simplify *)
neuper@42394
   478
term2str (go loc_ sc) = "Rewrite_Set_Inst [(bdv, v_v)] isolate_bdv False";
neuper@42394
   479
neuper@42438
   480
"----------- fun sel_rules ---------------------------------------";
neuper@42438
   481
"----------- fun sel_rules ---------------------------------------";
neuper@42438
   482
"----------- fun sel_rules ---------------------------------------";
neuper@42438
   483
(* compare test/../interface.sml
neuper@42438
   484
"--------- getTactic, fetchApplicableTactics ------------";
neuper@42438
   485
*)
s1210629013@55445
   486
 reset_states ();
neuper@42438
   487
 CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
neuper@42438
   488
   ("Test", ["sqroot-test","univariate","equation","test"],
neuper@42438
   489
    ["Test","squ-equ-test-subpbl1"]))];
neuper@42438
   490
 Iterator 1;
neuper@42438
   491
 moveActiveRoot 1;
wneuper@59248
   492
 autoCalculate 1 CompleteCalc;
neuper@42438
   493
 val ((pt,_),_) = get_calc 1;
neuper@42438
   494
 show_pt pt;
neuper@42394
   495
neuper@42438
   496
(*UC\label{SOLVE:MANUAL:TACTIC:listall} UC 30.3.2.2 p.175*)
neuper@42438
   497
 val tacs = sel_rules pt ([],Pbl);
wneuper@59253
   498
 case tacs of [Apply_Method ["Test", "squ-equ-test-subpbl1"]] => ()
wneuper@59253
   499
 | _ => error "script.sml: diff.behav. in sel_rules ([],Pbl)";
neuper@42438
   500
neuper@42438
   501
 val tacs = sel_rules pt ([1],Res);
wneuper@59253
   502
 case tacs of [Rewrite_Set "norm_equation", Rewrite_Set "Test_simplify",
neuper@55279
   503
      Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]),
wneuper@59253
   504
      Check_elementwise "Assumptions"] => ()
wneuper@59253
   505
 | _ => error "script.sml: diff.behav. in sel_rules ([1],Res)";
neuper@42438
   506
neuper@42438
   507
 val tacs = sel_rules pt ([3],Pbl);
wneuper@59253
   508
 case tacs of [Apply_Method ["Test", "solve_linear"]] => ()
wneuper@59253
   509
 | _ => error "script.sml: diff.behav. in sel_rules ([3],Pbl)";
neuper@42438
   510
neuper@42438
   511
 val tacs = sel_rules pt ([3,1],Res);
wneuper@59253
   512
 case tacs of [Rewrite_Set_Inst (["(bdv, x)"], "isolate_bdv"), Rewrite_Set "Test_simplify"] => ()
wneuper@59253
   513
 | _ => error "script.sml: diff.behav. in sel_rules ([3,1],Res)";
neuper@42438
   514
neuper@42438
   515
 val tacs = sel_rules pt ([3],Res);
wneuper@59253
   516
 case tacs of [Rewrite_Set "norm_equation", Rewrite_Set "Test_simplify",
neuper@55279
   517
      Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]),
wneuper@59253
   518
      Check_elementwise "Assumptions"] => ()
wneuper@59253
   519
 | _ => error "script.sml: diff.behav. in sel_rules ([3],Res)";
neuper@42438
   520
neuper@42438
   521
 val tacs = (sel_rules pt ([],Res)) handle PTREE str => [Tac str];
wneuper@59253
   522
 case tacs of [Tac "no tactics applicable at the end of a calculation"] => ()
wneuper@59253
   523
 | _ => error "script.sml: diff.behav. in sel_rules ([],Res)";
neuper@42438
   524
neuper@42438
   525
"----------- fun sel_appl_atomic_tacs ----------------------------";
neuper@42438
   526
"----------- fun sel_appl_atomic_tacs ----------------------------";
neuper@42438
   527
"----------- fun sel_appl_atomic_tacs ----------------------------";
s1210629013@55445
   528
 reset_states ();
neuper@42438
   529
 CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
neuper@42438
   530
   ("Test", ["sqroot-test","univariate","equation","test"],
neuper@42438
   531
    ["Test","squ-equ-test-subpbl1"]))];
neuper@42438
   532
 Iterator 1;
neuper@42438
   533
 moveActiveRoot 1;
wneuper@59248
   534
 autoCalculate 1 CompleteCalc;
neuper@42438
   535
neuper@42438
   536
(*UC\label{SOLVE:MANUAL:TACTIC:listall} UC 30.3.2.2 p.175*)
neuper@42438
   537
 fetchApplicableTactics 1 99999 ([],Pbl);
neuper@42438
   538
neuper@42438
   539
 fetchApplicableTactics 1 99999 ([1],Res);
neuper@42438
   540
"~~~~~ fun fetchApplicableTactics, args:"; val (cI, (scope:int), (p:pos')) = (1, 99999, ([1],Res));
neuper@42438
   541
val ((pt, _), _) = get_calc cI;
neuper@42438
   542
(*version 1:*)
wneuper@59253
   543
case sel_rules pt p of [Rewrite_Set "norm_equation", Rewrite_Set "Test_simplify",
neuper@55279
   544
  Subproblem ("Test", ["LINEAR", "univariate", "equation", "test"]),
wneuper@59253
   545
  Check_elementwise "Assumptions"] => ()
wneuper@59253
   546
| _ => error "fetchApplicableTactics ([1],Res) changed";
neuper@42438
   547
(*version 2:*)
neuper@42438
   548
(*WAS:
neuper@42438
   549
sel_appl_atomic_tacs pt p;
neuper@42438
   550
...
neuper@55279
   551
### atomic_appl_tacs: not impl. for tac='Subproblem(Test,["LINEAR","univariate","equation","test"])' 
neuper@42438
   552
### atomic_appl_tacs: not impl. for tac = 'Check_elementwise "Assumptions"' 
neuper@42438
   553
*)
neuper@42438
   554
neuper@42438
   555
"~~~~~ fun sel_appl_atomic_tacs, args:"; val (pt, (p,p_)) = (pt, p);
neuper@42438
   556
is_spec_pos p_ = false;
neuper@42438
   557
        val pp = par_pblobj pt p
neuper@42438
   558
        val thy' = (get_obj g_domID pt pp):theory'
neuper@42438
   559
        val thy = assoc_thy thy'
neuper@42438
   560
        val metID = get_obj g_metID pt pp
neuper@42438
   561
        val metID' =
neuper@42438
   562
          if metID = e_metID 
neuper@42438
   563
          then (thd3 o snd3) (get_obj g_origin pt pp)
neuper@42438
   564
          else metID
neuper@48790
   565
        val {scr=Prog sc,srls,erls,rew_ord'=ro,...} = get_met metID'
neuper@42438
   566
        val ScrState (env,_,a,v,_,_) = get_istate pt (p,p_)
neuper@42438
   567
        val alltacs = (*we expect at least 1 stac in a script*)
neuper@42438
   568
          map ((stac2tac pt thy) o rep_stacexpr o #2 o
neuper@42438
   569
           (handle_leaf "selrul" thy' srls env a v)) (stacpbls sc)
neuper@42438
   570
        val f =
neuper@42438
   571
          case p_ of
neuper@42438
   572
              Frm => get_obj g_form pt p
neuper@42438
   573
            | Res => (fst o (get_obj g_result pt)) p
neuper@42438
   574
(*WN120611 stopped and took version 1 again for fetchApplicableTactics !
neuper@42438
   575
(distinct o flat o (map (atomic_appl_tacs thy ro erls f))) alltacs
neuper@42438
   576
...
neuper@55279
   577
### atomic_appl_tacs: not impl. for tac='Subproblem(Test,["LINEAR","univariate","equation","test"])' 
neuper@42438
   578
### atomic_appl_tacs: not impl. for tac = 'Check_elementwise "Assumptions"' 
neuper@42438
   579
*)
neuper@42438
   580