test/Tools/isac/BridgeLibisabelle/thy-present.sml
author Walther Neuper <walther.neuper@jku.at>
Fri, 01 May 2020 15:28:40 +0200
changeset 59921 0766dade4a78
parent 59920 33913fe24685
child 59974 712fcbae5f9f
permissions -rw-r--r--
separate Solve_Step.check, repair ALL of Test_Isac_Short
walther@59921
     1
(* Title:  BridgeLibisabelle/thy-present.sml
walther@59921
     2
   Author: Walther Neuper
walther@59921
     3
   (c) due to copyright terms
neuper@37906
     4
*)
neuper@37906
     5
neuper@38061
     6
"--------------------------------------------------------";
neuper@38061
     7
"--------------------------------------------------------";
neuper@38061
     8
"table of contents --------------------------------------";
neuper@38061
     9
"--------------------------------------------------------";
neuper@38061
    10
"----------- fun thy_containing_rls ---------------------";
wneuper@59366
    11
"----------- apply thy_containing_rls -------------------";
neuper@38061
    12
"----------- fun thy_containing_cal ---------------------";
neuper@38061
    13
"----------- initContext Thy_ Integration-demo ----------";
neuper@38061
    14
"----------- initContext..Thy_, fun context_thm ---------";
neuper@38061
    15
"----------- initContext..Thy_, fun context_rls ---------";
neuper@38061
    16
"----------- checkContext..Thy_, fun context_thy --------";
neuper@38061
    17
"----------- checkContext..Thy_, fun context_rls --------";
neuper@38061
    18
"----------- checkContext..Thy_ on last formula ---------"; 
neuper@38061
    19
"----------- fun guh2theID ------------------------------";
neuper@38061
    20
"----------- debugging on Tests/solve_linear_as_rootpbl -";
neuper@38061
    21
"--------------------------------------------------------";
wneuper@55498
    22
(*============ inhibit exn WN120321 ==============================================
neuper@38061
    23
"--------------------------------------------------------";
neuper@38061
    24
"----------- fun filter_appl_rews -----------------------";
wneuper@55498
    25
============ inhibit exn WN120321 ==============================================*)
neuper@38061
    26
"----------- fun is_contained_in ------------------------";
neuper@38061
    27
"--------------------------------------------------------";
neuper@38061
    28
"--------------------------------------------------------";
neuper@37906
    29
neuper@38061
    30
"----------- fun thy_containing_rls ---------------------";
neuper@38061
    31
"----------- fun thy_containing_rls ---------------------";
neuper@38061
    32
"----------- fun thy_containing_rls ---------------------";
wneuper@59366
    33
(*ERROR WAS: Theory loader: undefined entry for theory "Isac.Complex_Main"*)
walther@59917
    34
if Thy_Read.thy_containing_rls "Biegelinie" "norm_Poly" = ("IsacKnowledge", "Poly") then ()
wneuper@59366
    35
else error ("thy_containing_rls changed for 'Biegelinie', 'norm_Poly'")  
wneuper@59366
    36
;
wneuper@59366
    37
"~~~~~ fun thy_containing_rls, args:"; val (thy', rls') = ("Biegelinie", "norm_Poly");
walther@59879
    38
    val thy = ThyC.get_theory thy'; (*.., EqSystem, Isac.Biegelinie}*)
wneuper@59366
    39
val xxx = AList.lookup op= (KEStore_Elems.get_rlss thy) rls';
wneuper@59366
    40
val SOME (thy'', _) = xxx;
wneuper@59366
    41
val SOME ("Poly", _) = xxx;
wneuper@59366
    42
if thy'' = "Poly" then () else error "--- fun thy_containing_rls: changed";
wneuper@59366
    43
(*ERROR WAS: Theory loader: undefined entry for theory "Isac.Complex_Main" *)
walther@59916
    44
if Thy_Read.partID' thy'' = "IsacKnowledge" then () else error "fun partID': changed"
wneuper@59366
    45
;
wneuper@59366
    46
"~~~~~ fun partID', args:"; val (thy') = (thy');
walther@59879
    47
ThyC.get_theory thy' (*.., EqSystem, Isac.Biegelinie}*)
wneuper@59366
    48
;
walther@59879
    49
"~~~~~ fun partID, args:"; val (thy) = (ThyC.get_theory thy');
wneuper@59366
    50
(*ERROR WAS: Theory loader: undefined entry for theory "Isac.Complex_Main"*)
walther@59916
    51
Thy_Read.knowthys () 
wneuper@59366
    52
;
wneuper@59600
    53
"~~~~~ fun knowthys , args:"; val () = ();
walther@59914
    54
        val allthys = filter_out (Library.member Context.eq_thy
walther@59879
    55
          [(*ThyC.get_theory "ProgLang",*) ThyC.get_theory "Interpret", 
walther@59879
    56
            ThyC.get_theory "MathEngine", ThyC.get_theory "BridgeLibisabelle"]) 
walther@59879
    57
          (Theory.ancestors_of (ThyC.get_theory "Build_Thydata"));
wneuper@59366
    58
length allthys = 152; (*in Isabelle2015/Isac*)
wneuper@59366
    59
(*ERROR WAS: Theory loader: undefined entry for theory "Isac.Complex_Main"
walther@59879
    60
ThyC.get_theory "Complex_Main";*)
wneuper@59366
    61
Thy_Info.get_theory "Complex_Main";;
wneuper@59366
    62
wneuper@59366
    63
"----------- apply thy_containing_rls -------------------";
wneuper@59366
    64
"----------- apply thy_containing_rls -------------------";
wneuper@59366
    65
"----------- apply thy_containing_rls -------------------";
walther@59917
    66
if Thy_Read.thy_containing_rls "Biegelinie" "norm_Poly" = ("IsacKnowledge", "Poly") then ()
walther@59917
    67
else error ("Thy_Read.thy_containing_rls changed for 'Biegelinie', 'norm_Poly'")
neuper@55458
    68
;
walther@59917
    69
if Thy_Read.thy_containing_rls "Biegelinie" "empty" = ("IsacScripts", "Know_Store") then ()
walther@59917
    70
else error ("Thy_Read.thy_containing_rls changed for 'Biegelinie', 'e_rls'")
neuper@55458
    71
;
walther@59917
    72
if Thy_Read.thy_containing_rls "Build_Thydata" "prog_expr" = (*FIXME: handle redifinition in several thys*)
wneuper@59602
    73
  ("IsacKnowledge", "Base_Tools") then ()
walther@59917
    74
else error ("Thy_Read.thy_containing_rls changed for 'Biegelinie', 'prog_expr'")
neuper@37906
    75
neuper@38061
    76
"----------- fun thy_containing_cal ---------------------";
neuper@38061
    77
"----------- fun thy_containing_cal ---------------------";
neuper@38061
    78
"----------- fun thy_containing_cal ---------------------";
walther@59603
    79
(* ATTENTION: both, "IsacKnowledge" and "Prog_Expr" are fixed as results for any input*)
walther@59917
    80
if Thy_Read.thy_containing_cal "Biegelinie" "PLUS" = ("IsacKnowledge", "Base_Tools")
neuper@55458
    81
then () else error "(wrong) thy_containing_cal 'Biegelinie' 'PLUS' changed"
neuper@42407
    82
neuper@38061
    83
"----------- initContext Thy_ Integration-demo ----------";
neuper@38061
    84
"----------- initContext Thy_ Integration-demo ----------";
neuper@38061
    85
"----------- initContext Thy_ Integration-demo ----------";
s1210629013@55445
    86
reset_states ();
neuper@37906
    87
CalcTree
neuper@37906
    88
[(["functionTerm (2 * x)","integrateBy x","antiDerivative FF"], 
neuper@38058
    89
  ("Integrate",["integrate","function"],
neuper@37906
    90
  ["diff","integration"]))];
neuper@37906
    91
Iterator 1;
neuper@37906
    92
moveActiveRoot 1;
wneuper@59248
    93
autoCalculate 1 CompleteCalc;
neuper@37906
    94
interSteps 1 ([1],Res);
neuper@37906
    95
interSteps 1 ([1,1],Res);
neuper@37906
    96
val ((pt,p),_) = get_calc 1; show_pt pt;
neuper@37906
    97
if existpt' ([1,1,1], Frm) pt then ()
neuper@38031
    98
else error "integrate.sml: interSteps on Rewrite_Set_Inst 1";
neuper@37906
    99
initContext  1 Thy_ ([1,1,1], Frm);
neuper@37906
   100
neuper@38061
   101
"----------- initContext..Thy_, fun context_thm ---------";
neuper@38061
   102
"----------- initContext..Thy_, fun context_thm ---------";
neuper@38061
   103
"----------- initContext..Thy_, fun context_thm ---------";
s1210629013@55445
   104
reset_states (); (*start of calculation, return No.1*)
neuper@41970
   105
CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
neuper@41970
   106
  ("Test", ["sqroot-test","univariate","equation","test"],
neuper@37906
   107
   ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
   108
Iterator 1; moveActiveRoot 1;
wneuper@59248
   109
autoCalculate 1 CompleteCalc;
neuper@37906
   110
neuper@37906
   111
"----- no thy-context at result -----";
neuper@37906
   112
val p = ([], Res);
neuper@37906
   113
initContext 1 Thy_ p;
wneuper@55498
   114
val ((pt,_),_) = get_calc 1; show_pt pt; (* 11 lines with subpbl *)
neuper@37906
   115
neuper@37906
   116
interSteps 1 ([2], Res);
wneuper@55498
   117
val ((pt,_),_) = get_calc 1; show_pt pt; (* added [2,1]..[2,6] *)
neuper@37906
   118
interSteps 1 ([3,1], Res);
wneuper@55498
   119
val ((pt,_),_) = get_calc 1; show_pt pt; (* added [3,1,1] Frm + Res *)
neuper@37906
   120
neuper@37906
   121
val p = ([2,4], Res);
wneuper@55498
   122
"~~~~~ fun initContext, args:"; val ((cI:calcID), Thy_, (pos as (p,p_):pos')) = (1, Thy_, p);
walther@59914
   123
  Library.member op = [Pbl,Met] p_ = false;
wneuper@55498
   124
  pos = ([],Res) = false;
wneuper@55498
   125
  val cs as (ptp as (pt,_),_) = get_calc cI;
wneuper@55498
   126
  exist_lev_on' pt pos = true;
wneuper@55498
   127
              val pos' = lev_on' pt pos
walther@59917
   128
              val tac = Thy_Present.get_tac_checked pt pos';
wneuper@55498
   129
  is_rewtac tac = true;
wneuper@55498
   130
"~~~~~ fun context_thy, args:"; val ((pt, pos as (p,p_)), (tac as Rewrite (thmID,_))) =
wneuper@55498
   131
  ((pt, pos), tac);
walther@59921
   132
    val Applicable.Yes (Rewrite' (thy', ord', erls, _, (thmID, thm), f, (res,asm))) = Step.check tac (pt, pos)
walther@59881
   133
            val thm = Global_Theory.get_thm (Isac ()(*WN141021 ThyC.get_theory thy' ERROR*)) thmID
wneuper@55498
   134
            val thm_deriv = Thm.get_name_hint thm;
wneuper@55498
   135
walther@59917
   136
if Thy_Write.thm2guh (Thy_Read.thy_containing_thm thm_deriv) (ThmC.cut_id thm_deriv)
wneuper@55498
   137
   = "thy_isac_Test-thm-radd_left_commute" then ()
wneuper@55498
   138
else error "context_thy mini-subpbl ([2,4], Res) changed";
wneuper@55498
   139
(*~/proto3/kbase/thy$ ls -l thy_isac_Test-thm-radd_left_commute*
wneuper@55498
   140
-rw-rw-r-- 1 wneuper wneuper 638 Aug  8 16:04 thy_isac_Test-thm-radd_left_commute.html*)
neuper@37906
   141
akargl@42108
   142
neuper@37906
   143
val p = ([3,1,1], Frm);
wneuper@55498
   144
"~~~~~ fun initContext, args:"; val ((cI:calcID), Thy_, (pos as (p,p_):pos')) = (1, Thy_, p);
walther@59914
   145
  Library.member op = [Pbl,Met] p_ = false;
wneuper@55498
   146
  pos = ([],Res) = false;
wneuper@55498
   147
  val cs as (ptp as (pt,_),_) = get_calc cI;
wneuper@55498
   148
  exist_lev_on' pt pos = true;
wneuper@55498
   149
              val pos' = lev_on' pt pos
walther@59917
   150
              val tac = Thy_Present.get_tac_checked pt pos';
wneuper@55498
   151
  is_rewtac tac = true;
wneuper@55498
   152
"~~~~~ fun context_thy, args:"; val ((pt, pos as (p,p_)), (tac as Rewrite_Inst (subs, (thmID,_))))=
wneuper@55498
   153
  ((pt, pos), tac);
walther@59920
   154
val Applicable.Yes (Rewrite_Inst' (thy', ord', erls, _, subst, (thmID,_), f, (res, asm))) = 
walther@59921
   155
   Step.check tac (pt, pos)
walther@59881
   156
             val thm = Global_Theory.get_thm (Isac ()(*WN141021 ThyC.get_theory thy' ERROR*)) thmID
wneuper@55498
   157
             val thm_deriv = Thm.get_name_hint thm;
walther@59917
   158
if Thy_Write.thm2guh (Thy_Read.thy_containing_thm thm_deriv) (ThmC.cut_id thm_deriv) =
wneuper@55498
   159
  "thy_isac_Test-thm-risolate_bdv_add" then ()
wneuper@55498
   160
else error "context_thy mini-subpbl ([3,1,1], Frm) changed";
wneuper@55498
   161
(*~/proto3/kbase/thy$ ls -l thy_isac_Test-thm-risolate_bdv_add*
wneuper@55498
   162
-rw-rw-r-- 1 wneuper wneuper 646 Aug  8 16:04 thy_isac_Test-thm-risolate_bdv_add.html*)
neuper@37906
   163
neuper@37906
   164
wneuper@55498
   165
val p = ([2,5], Res);
wneuper@55498
   166
"~~~~~ fun initContext, args:"; val ((cI:calcID), Thy_, (pos as (p,p_):pos')) = (1, Thy_, p);
walther@59914
   167
  Library.member op = [Pbl,Met] p_ = false;
wneuper@55498
   168
  pos = ([],Res) = false;
wneuper@55498
   169
  val cs as (ptp as (pt,_),_) = get_calc cI;
wneuper@55498
   170
 exist_lev_on' pt pos = true;
wneuper@55498
   171
              val pos' = lev_on' pt pos
walther@59917
   172
              val tac = Thy_Present.get_tac_checked pt pos';
wneuper@55498
   173
if is_rewtac tac = false then () 
wneuper@55498
   174
else error "initContext: context_thy .. Calculate PLUS .. TO BE IMPLEMENTED"
neuper@37906
   175
neuper@38061
   176
"----------- initContext..Thy_, fun context_rls ---------";
neuper@38061
   177
"----------- initContext..Thy_, fun context_rls ---------";
neuper@38061
   178
"----------- initContext..Thy_, fun context_rls ---------";
neuper@37906
   179
(*using pt from above*)
neuper@37906
   180
val p = ([1], Res);
neuper@37906
   181
val tac = Rewrite_Set "Test_simplify";
neuper@37906
   182
initContext 1 Thy_ p;
neuper@37906
   183
(*Res->Res, Rewrite_Set "Test_simplify" x + 1 + -1 * 2 = 0 -> -1 + x = 0
neuper@37906
   184
  --- in initContext..Thy_ ---*)
walther@59917
   185
val Thy_Present.ContRls {rls,result,...} = Thy_Present.context_thy (pt,p) tac;
neuper@37906
   186
if rls = "thy_isac_Test-rls-Test_simplify" 
walther@59868
   187
   andalso UnparseC.term result = "-1 + x = 0" then ()
wneuper@55498
   188
else error "rewtools.sml initContext..Th_ thy_isac_Test-rls-Test_simplify";
neuper@37906
   189
neuper@37906
   190
val p = ([3,1], Frm);
wneuper@59494
   191
val tac = Rewrite_Set_Inst (["(''bdv'', x)"],"isolate_bdv");
neuper@37906
   192
initContext 1 Thy_ p;
neuper@37906
   193
(*Frm->Res, Rewrite_Set_Inst "isolate_bdv" -1 + x = 0 ->  x = 0 + -1 * -1
neuper@37906
   194
  --- in initContext..Thy_ ---*)
walther@59917
   195
val Thy_Present.ContRlsInst {rls,result,...} = Thy_Present.context_thy (pt,p) tac;
neuper@37906
   196
if rls =  "thy_isac_Test-rls-isolate_bdv"
walther@59868
   197
   andalso UnparseC.term result = "x = 0 + -1 * -1" then ()
neuper@38031
   198
else error "rewtools.sml initContext..Th_ thy_Test-thm-risolate_bdv_add";
neuper@37906
   199
neuper@38061
   200
"----------- checkContext..Thy_, fun context_thy --------";
neuper@38061
   201
"----------- checkContext..Thy_, fun context_thy --------";
neuper@38061
   202
"----------- checkContext..Thy_, fun context_thy --------";
neuper@37906
   203
(*using pt from above*)
neuper@37906
   204
val p = ([2,4], Res);
wneuper@59253
   205
val tac = Rewrite ("radd_left_commute", @{thm radd_left_commute});
neuper@37906
   206
checkContext 1 p "thy_Test-thm-radd_left_commute";
neuper@37906
   207
(* radd_left_commute: 1 + (-2 + x) = 0 -> -2 + (1 + x) = 0
neuper@37906
   208
  --- in checkContext..Thy_ ---*)
walther@59917
   209
val Thy_Present.ContThm {thm,result,...} = Thy_Present.context_thy (pt,p) tac;
neuper@37906
   210
if thm =  "thy_isac_Test-thm-radd_left_commute"
walther@59868
   211
   andalso UnparseC.term result = "-2 + (1 + x) = 0" then ()
neuper@38031
   212
else error "rewtools.sml checkContext.._ thy_Test-thm-radd_left_commute";
neuper@37906
   213
neuper@37906
   214
val p = ([3,1,1], Frm);
wneuper@59494
   215
val tac = Rewrite_Inst (["(''bdv'',x)"],("risolate_bdv_add", @{thm "risolate_bdv_add"}));
neuper@37906
   216
checkContext 1 p "thy_Test-thm-risolate_bdv_add";
neuper@37906
   217
(* risolate_bdv_add:  -1 + x = 0 -> x = 0 + -1 * -1
neuper@37906
   218
  --- in checkContext..Thy_ ---*)
walther@59917
   219
val Thy_Present.ContThmInst {thm,result,...} = Thy_Present.context_thy (pt,p) tac;
neuper@37906
   220
if thm =  "thy_isac_Test-thm-risolate_bdv_add"
walther@59868
   221
   andalso UnparseC.term result = "x = 0 + - 1 * -1" then ()
neuper@38031
   222
else error "rewtools.sml checkContext..T_ thy_Test-thm-risolate_bdv_add";
neuper@37906
   223
neuper@37906
   224
val p = ([2,5], Res);
neuper@37906
   225
val tac = Calculate "plus";
neuper@37906
   226
(*checkContext..Thy_ 1 ([2,5], Res);*)
neuper@37906
   227
(*FIXXXME #######################vvvvv kestoreID !!!!!!!!!!!!!!!!*)
neuper@37906
   228
checkContext 1 p ;
neuper@37906
   229
(* Calculate "plus"  -2 + (1 + x) = 0 -> -1 + x = 0
neuper@37906
   230
  --- in checkContext..Thy_ ---*)
neuper@37906
   231
neuper@38061
   232
"----------- checkContext..Thy_, fun context_rls --------";
neuper@38061
   233
"----------- checkContext..Thy_, fun context_rls --------";
neuper@38061
   234
"----------- checkContext..Thy_, fun context_rls --------";
neuper@37906
   235
(*using pt from above*)
neuper@37906
   236
val p = ([1], Res);
neuper@37906
   237
val tac = Rewrite_Set "Test_simplify";
neuper@37906
   238
checkContext 1 p "thy_isac_Test-rls-Test_simplify";
neuper@37906
   239
(*Res->Res, Rewrite_Set "Test_simplify" x + 1 + -1 * 2 = 0 -> -1 + x = 0
neuper@37906
   240
  --- in checkContext..Thy_ ---*)
walther@59917
   241
val Thy_Present.ContRls {rls,result,...} = Thy_Present.context_thy (pt,p) tac;
neuper@37906
   242
if rls = "thy_isac_Test-rls-Test_simplify" 
walther@59868
   243
   andalso UnparseC.term result = "-1 + x = 0" then ()
neuper@38031
   244
else error "rewtools.sml checkContext..Thy_ thy_Test-rls-Test_simplify";
neuper@37906
   245
neuper@37906
   246
val p = ([3,1], Frm);
wneuper@59494
   247
val tac = Rewrite_Set_Inst (["(''bdv'', x)"],"isolate_bdv");
neuper@37906
   248
checkContext 1 p "thy_Test-rls-isolate_bdv";
walther@59917
   249
val Thy_Present.ContRlsInst {rls,result,...} = Thy_Present.context_thy (pt,p) tac;
neuper@37906
   250
if rls = "thy_isac_Test-rls-isolate_bdv" 
walther@59868
   251
   andalso UnparseC.term result = "x = 0 + -1 * -1" then ()
neuper@38031
   252
else error "rewtools.sml checkContext..Thy_ thy_Test-thm-isolate_bdv";
neuper@37906
   253
neuper@38061
   254
"----------- checkContext..Thy_ on last formula ---------"; 
neuper@38061
   255
"----------- checkContext..Thy_ on last formula ---------"; 
neuper@38061
   256
"----------- checkContext..Thy_ on last formula ---------"; 
s1210629013@55445
   257
reset_states (); (*start of calculation, return No.1*)
neuper@41970
   258
CalcTree [(["equality (x+1=(2::real))", "solveFor x","solutions L"], 
neuper@41970
   259
  ("Test", ["sqroot-test","univariate","equation","test"],
neuper@37906
   260
   ["Test","squ-equ-test-subpbl1"]))];
neuper@37906
   261
Iterator 1; moveActiveRoot 1;
neuper@37906
   262
wneuper@59248
   263
autoCalculate 1 CompleteCalcHead;
walther@59747
   264
autoCalculate 1 (Steps 1);
neuper@37906
   265
val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
neuper@37906
   266
initContext 1 Thy_ ([1], Frm);
neuper@37906
   267
checkContext 1 ([1], Frm) "thy_isac_Test-thm-radd_left_commute";
neuper@37906
   268
walther@59747
   269
autoCalculate 1 (Steps 1);
neuper@37906
   270
val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
neuper@37906
   271
initContext 1 Thy_ ([1], Res);
neuper@37906
   272
checkContext 1 ([1], Res) "thy_isac_Test-rls-Test_simplify";
neuper@37906
   273
neuper@38061
   274
"----------- fun guh2theID ------------------------------";
neuper@38061
   275
"----------- fun guh2theID ------------------------------";
neuper@38061
   276
"----------- fun guh2theID ------------------------------";
neuper@37906
   277
val guh = "thy_scri_ListG-thm-zip_Nil";
wneuper@59348
   278
(*default_print_depth 3; 999*)
akargl@42181
   279
take_fromto 1 4 (Symbol.explode guh);
akargl@42181
   280
take_fromto 5 9 (Symbol.explode guh);
akargl@42181
   281
val rest = takerest (9,(Symbol.explode guh)); 
neuper@37906
   282
neuper@37906
   283
separate "-" rest;
neuper@37906
   284
space_implode "-" rest;
neuper@37906
   285
commas rest;
neuper@37906
   286
neuper@37906
   287
val delim = "-";
neuper@37906
   288
val thyID = takewhile [] (not o (curry op= delim)) rest;
neuper@37906
   289
val rest' = dropuntil (curry op= delim) rest;
neuper@37906
   290
val setc = take_fromto 1 5 rest';
neuper@37906
   291
val xstr = takerest (5, rest');
neuper@37906
   292
walther@59917
   293
if Thy_Present.guh2theID guh = ["IsacScripts", "ListG", "Theorems", "zip_Nil"] then ()
neuper@38031
   294
else error "rewtools.sml: guh2theID thy_scri_ListG-thm-zip_Nil changed";
neuper@37906
   295
neuper@37906
   296
neuper@38061
   297
"----------- debugging on Tests/solve_linear_as_rootpbl -";
neuper@38061
   298
"----------- debugging on Tests/solve_linear_as_rootpbl -";
neuper@38061
   299
"----------- debugging on Tests/solve_linear_as_rootpbl -";
akargl@42108
   300
"----- initContext -----";
s1210629013@55445
   301
reset_states ();
neuper@37906
   302
CalcTree 
neuper@42124
   303
    [(["equality (1+-1*2+x=(0::real))", "solveFor x", "solutions L"],
neuper@38058
   304
      ("Test",
neuper@55279
   305
       ["LINEAR","univariate","equation","test"],
neuper@37906
   306
       ["Test","solve_linear"]))];
neuper@37906
   307
Iterator 1; moveActiveRoot 1;
wneuper@59248
   308
autoCalculate 1 CompleteCalcHead;
neuper@37906
   309
walther@59747
   310
autoCalculate 1 (Steps 1); val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
neuper@37906
   311
if is_curr_endof_calc pt ([1],Frm) then ()
neuper@38031
   312
else error "rewtools.sml is_curr_endof_calc ([1],Frm)";
neuper@37906
   313
walther@59747
   314
autoCalculate 1 (Steps 1); val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
akargl@42125
   315
neuper@37906
   316
if not (is_curr_endof_calc pt ([1],Frm)) then ()
neuper@38031
   317
else error "rewtools.sml is_curr_endof_calc ([1],Frm) not";
neuper@37906
   318
if is_curr_endof_calc pt ([1],Res) then ()
neuper@38031
   319
else error "rewtools.sml is_curr_endof_calc ([1],Res)";
neuper@37906
   320
neuper@37906
   321
initContext 1 Thy_ ([1],Res);
neuper@37906
   322
neuper@37906
   323
"----- checkContext -----";
s1210629013@55445
   324
reset_states ();
neuper@37906
   325
CalcTree 
neuper@42124
   326
    [(["equality (1+-1*2+x=(0::real))", "solveFor x", "solutions L"],
neuper@38058
   327
      ("Test",
neuper@55279
   328
       ["LINEAR","univariate","equation","test"],
neuper@37906
   329
       ["Test","solve_linear"]))];
neuper@37906
   330
Iterator 1; moveActiveRoot 1;
wneuper@59248
   331
autoCalculate 1 CompleteCalc;
neuper@37906
   332
interSteps 1 ([1],Res);
akargl@42108
   333
neuper@37906
   334
val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
neuper@37906
   335
checkContext 1 ([1],Res) "thy_isac_Test-rls-Test_simplify";
neuper@37906
   336
neuper@37906
   337
interSteps 1 ([2],Res);
neuper@37906
   338
val (ptp as (pt,p), tacis) = get_calc 1; show_pt pt;
neuper@37906
   339
neuper@37906
   340
checkContext 1 ([2,1],Res) "thy_isac_Test-rls-Test_simplify";
neuper@37906
   341
checkContext 1 ([2,2],Res) "thy_isac_Test-rls-Test_simplify";
neuper@37906
   342
neuper@38061
   343
"----------- fun is_contained_in ------------------------";
neuper@38061
   344
"----------- fun is_contained_in ------------------------";
neuper@38061
   345
"----------- fun is_contained_in ------------------------";
walther@59871
   346
val r1 = Thm ("real_diff_minus",ThmC.numerals_to_Free @{thm real_diff_minus});
walther@59914
   347
if Rule_Set.contains r1 Test_simplify then ()
walther@59914
   348
else error "rewtools.sml Rule_Set.contains Thm";
neuper@37906
   349
walther@59878
   350
val r1 = Eval ("Groups.plus_class.plus", eval_binop "#add_");
walther@59914
   351
if Rule_Set.contains r1 Test_simplify then ()
walther@59914
   352
else error "rewtools.sml Rule_Set.contains Eval";
neuper@37906
   353
walther@59878
   354
val r1 = Eval ("Groups.minus_class.minus", eval_binop "#add_");
walther@59914
   355
if not (Rule_Set.contains r1 Test_simplify) then ()
walther@59914
   356
else error "rewtools.sml Rule_Set.contains Eval";