test/Tools/isac/BridgeLibisabelle/thy-present.sml
author wneuper <walther.neuper@jku.at>
Mon, 19 Jul 2021 18:29:46 +0200
changeset 60337 cbad4e18e91b
parent 60331 40eb8aa2b0d6
child 60516 795d1352493a
permissions -rw-r--r--
cleanup after "eliminate ThmC.numerals_to_Free"
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
"----------- debugging on Tests/solve_linear_as_rootpbl -";
neuper@38061
    14
"--------------------------------------------------------";
wneuper@55498
    15
(*============ inhibit exn WN120321 ==============================================
neuper@38061
    16
"--------------------------------------------------------";
neuper@38061
    17
"----------- fun filter_appl_rews -----------------------";
wneuper@55498
    18
============ inhibit exn WN120321 ==============================================*)
neuper@38061
    19
"----------- fun is_contained_in ------------------------";
neuper@38061
    20
"--------------------------------------------------------";
neuper@38061
    21
"--------------------------------------------------------";
neuper@37906
    22
neuper@38061
    23
"----------- fun thy_containing_rls ---------------------";
neuper@38061
    24
"----------- fun thy_containing_rls ---------------------";
neuper@38061
    25
"----------- fun thy_containing_rls ---------------------";
wneuper@59366
    26
(*ERROR WAS: Theory loader: undefined entry for theory "Isac.Complex_Main"*)
walther@59917
    27
if Thy_Read.thy_containing_rls "Biegelinie" "norm_Poly" = ("IsacKnowledge", "Poly") then ()
wneuper@59366
    28
else error ("thy_containing_rls changed for 'Biegelinie', 'norm_Poly'")  
wneuper@59366
    29
;
wneuper@59366
    30
"~~~~~ fun thy_containing_rls, args:"; val (thy', rls') = ("Biegelinie", "norm_Poly");
walther@59879
    31
    val thy = ThyC.get_theory thy'; (*.., EqSystem, Isac.Biegelinie}*)
wneuper@59366
    32
val xxx = AList.lookup op= (KEStore_Elems.get_rlss thy) rls';
wneuper@59366
    33
val SOME (thy'', _) = xxx;
wneuper@59366
    34
val SOME ("Poly", _) = xxx;
wneuper@59366
    35
if thy'' = "Poly" then () else error "--- fun thy_containing_rls: changed";
wneuper@59366
    36
(*ERROR WAS: Theory loader: undefined entry for theory "Isac.Complex_Main" *)
walther@59916
    37
if Thy_Read.partID' thy'' = "IsacKnowledge" then () else error "fun partID': changed"
wneuper@59366
    38
;
wneuper@59366
    39
"~~~~~ fun partID', args:"; val (thy') = (thy');
walther@59879
    40
ThyC.get_theory thy' (*.., EqSystem, Isac.Biegelinie}*)
wneuper@59366
    41
;
walther@59879
    42
"~~~~~ fun partID, args:"; val (thy) = (ThyC.get_theory thy');
wneuper@59366
    43
(*ERROR WAS: Theory loader: undefined entry for theory "Isac.Complex_Main"*)
walther@59916
    44
Thy_Read.knowthys () 
wneuper@59366
    45
;
wneuper@59600
    46
"~~~~~ fun knowthys , args:"; val () = ();
walther@60017
    47
        val allthys = filter_out (member Context.eq_thy
walther@59879
    48
          [(*ThyC.get_theory "ProgLang",*) ThyC.get_theory "Interpret", 
walther@59879
    49
            ThyC.get_theory "MathEngine", ThyC.get_theory "BridgeLibisabelle"]) 
walther@59879
    50
          (Theory.ancestors_of (ThyC.get_theory "Build_Thydata"));
wneuper@59366
    51
length allthys = 152; (*in Isabelle2015/Isac*)
wneuper@59366
    52
(*ERROR WAS: Theory loader: undefined entry for theory "Isac.Complex_Main"
walther@59879
    53
ThyC.get_theory "Complex_Main";*)
wneuper@59366
    54
Thy_Info.get_theory "Complex_Main";;
wneuper@59366
    55
wneuper@59366
    56
"----------- apply thy_containing_rls -------------------";
wneuper@59366
    57
"----------- apply thy_containing_rls -------------------";
wneuper@59366
    58
"----------- apply thy_containing_rls -------------------";
walther@59917
    59
if Thy_Read.thy_containing_rls "Biegelinie" "norm_Poly" = ("IsacKnowledge", "Poly") then ()
walther@59917
    60
else error ("Thy_Read.thy_containing_rls changed for 'Biegelinie', 'norm_Poly'")
neuper@55458
    61
;
walther@59917
    62
if Thy_Read.thy_containing_rls "Biegelinie" "empty" = ("IsacScripts", "Know_Store") then ()
walther@59917
    63
else error ("Thy_Read.thy_containing_rls changed for 'Biegelinie', 'e_rls'")
neuper@55458
    64
;
walther@59917
    65
if Thy_Read.thy_containing_rls "Build_Thydata" "prog_expr" = (*FIXME: handle redifinition in several thys*)
walther@60149
    66
(**)("IsacKnowledge", "Base_Tools")(**)
walther@60149
    67
(** )("IsacScripts", "Prog_Expr")( **)
walther@60121
    68
then () else error ("Thy_Read.thy_containing_rls changed for 'Biegelinie', 'prog_expr'")
neuper@37906
    69
neuper@38061
    70
"----------- fun thy_containing_cal ---------------------";
neuper@38061
    71
"----------- fun thy_containing_cal ---------------------";
neuper@38061
    72
"----------- fun thy_containing_cal ---------------------";
walther@59603
    73
(* ATTENTION: both, "IsacKnowledge" and "Prog_Expr" are fixed as results for any input*)
walther@59917
    74
if Thy_Read.thy_containing_cal "Biegelinie" "PLUS" = ("IsacKnowledge", "Base_Tools")
neuper@55458
    75
then () else error "(wrong) thy_containing_cal 'Biegelinie' 'PLUS' changed"
neuper@42407
    76
neuper@37906
    77
neuper@38061
    78
"----------- debugging on Tests/solve_linear_as_rootpbl -";
neuper@38061
    79
"----------- debugging on Tests/solve_linear_as_rootpbl -";
neuper@38061
    80
"----------- debugging on Tests/solve_linear_as_rootpbl -";
akargl@42108
    81
"----- initContext -----";
s1210629013@55445
    82
reset_states ();
neuper@37906
    83
CalcTree 
walther@60329
    84
    [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
neuper@38058
    85
      ("Test",
walther@59997
    86
       ["LINEAR", "univariate", "equation", "test"],
walther@59997
    87
       ["Test", "solve_linear"]))];
neuper@37906
    88
Iterator 1; moveActiveRoot 1;
wneuper@59248
    89
autoCalculate 1 CompleteCalcHead;
neuper@37906
    90
walther@59983
    91
autoCalculate 1 (Steps 1); val (ptp as (pt,p), tacis) = get_calc 1; Test_Tool.show_pt pt;
neuper@37906
    92
if is_curr_endof_calc pt ([1],Frm) then ()
neuper@38031
    93
else error "rewtools.sml is_curr_endof_calc ([1],Frm)";
neuper@37906
    94
walther@59983
    95
autoCalculate 1 (Steps 1); val (ptp as (pt,p), tacis) = get_calc 1; Test_Tool.show_pt pt;
akargl@42125
    96
neuper@37906
    97
if not (is_curr_endof_calc pt ([1],Frm)) then ()
neuper@38031
    98
else error "rewtools.sml is_curr_endof_calc ([1],Frm) not";
neuper@37906
    99
if is_curr_endof_calc pt ([1],Res) then ()
neuper@38031
   100
else error "rewtools.sml is_curr_endof_calc ([1],Res)";
neuper@37906
   101
walther@60255
   102
(*//----------------- dropped with "purge code for theory-hierarchy" * )
walther@59974
   103
initContext 1 Ptool.Thy_ ([1],Res);
neuper@37906
   104
neuper@37906
   105
"----- checkContext -----";
s1210629013@55445
   106
reset_states ();
neuper@37906
   107
CalcTree 
walther@60329
   108
    [(["equality (1+- 1*2+x=(0::real))", "solveFor x", "solutions L"],
neuper@38058
   109
      ("Test",
walther@59997
   110
       ["LINEAR", "univariate", "equation", "test"],
walther@59997
   111
       ["Test", "solve_linear"]))];
neuper@37906
   112
Iterator 1; moveActiveRoot 1;
wneuper@59248
   113
autoCalculate 1 CompleteCalc;
neuper@37906
   114
interSteps 1 ([1],Res);
akargl@42108
   115
walther@59983
   116
val (ptp as (pt,p), tacis) = get_calc 1; Test_Tool.show_pt pt;
neuper@37906
   117
checkContext 1 ([1],Res) "thy_isac_Test-rls-Test_simplify";
neuper@37906
   118
neuper@37906
   119
interSteps 1 ([2],Res);
walther@59983
   120
val (ptp as (pt,p), tacis) = get_calc 1; Test_Tool.show_pt pt;
neuper@37906
   121
neuper@37906
   122
checkContext 1 ([2,1],Res) "thy_isac_Test-rls-Test_simplify";
neuper@37906
   123
checkContext 1 ([2,2],Res) "thy_isac_Test-rls-Test_simplify";
walther@60255
   124
( *//----------------- dropped with "purge code for theory-hierarchy" *)
neuper@37906
   125
neuper@38061
   126
"----------- fun is_contained_in ------------------------";
neuper@38061
   127
"----------- fun is_contained_in ------------------------";
neuper@38061
   128
"----------- fun is_contained_in ------------------------";
walther@60337
   129
val r1 = Thm ("real_diff_minus", @{thm real_diff_minus});
walther@59914
   130
if Rule_Set.contains r1 Test_simplify then ()
walther@59914
   131
else error "rewtools.sml Rule_Set.contains Thm";
neuper@37906
   132
wenzelm@60309
   133
val r1 = Eval (\<^const_name>\<open>plus\<close>, eval_binop "#add_");
walther@59914
   134
if Rule_Set.contains r1 Test_simplify then ()
walther@59914
   135
else error "rewtools.sml Rule_Set.contains Eval";
neuper@37906
   136
wenzelm@60309
   137
val r1 = Eval (\<^const_name>\<open>minus\<close>, eval_binop "#add_");
walther@59914
   138
if not (Rule_Set.contains r1 Test_simplify) then ()
walther@59914
   139
else error "rewtools.sml Rule_Set.contains Eval";