src/Tools/isac/Knowledge/Build_Thydata.thy
author Walther Neuper <neuper@ist.tugraz.at>
Wed, 17 Jul 2013 07:32:53 +0200
changeset 52062 b3f18f0d55d9
parent 48896 e0681e8b6c26
child 52070 77138c64f4f6
permissions -rw-r--r--
--- heap image for Isac on Isabelle2013 builds

This required introduction of 'session'.
NOTE: building the session raised errors NOT detected
by Build_Isac.thy, cf. 4ecea2fcdc2c
neuper@48895
     1
(* theory collecting all knowledge defined for the isac mathengine
neuper@42400
     2
   WN.11.00
neuper@42400
     3
 *)
neuper@42400
     4
neuper@42400
     5
theory Build_Thydata
neuper@42400
     6
imports Isac
neuper@42400
     7
begin
neuper@42400
     8
neuper@42400
     9
text {* This theory collects data of theorems and axioms defined and used in ISAC *}
neuper@42400
    10
neuper@42400
    11
ML {*
neuper@48880
    12
(** set up a list for getting guh + theID for a thm defined in isabelle (and NOT in isac) **)
neuper@42400
    13
neuper@42400
    14
(*local*)
neuper@42400
    15
  val first_ProgLang_thy = @{theory ListC}
neuper@42400
    16
  val first_Knowledge_thy = @{theory Delete}  (*see WN120321.TODO rearrange theories*)
neuper@42407
    17
  val allthys = (*!!! @{theory} :: ..START WITH Isac.thy..*) Theory.ancestors_of @{theory};
neuper@42400
    18
  val isabthys' =
neuper@42400
    19
    drop ((find_index (curry Theory.eq_thy first_ProgLang_thy) allthys) + 1, allthys);
neuper@42407
    20
  val isacthys' =
neuper@42407
    21
    take ((find_index (curry Theory.eq_thy first_ProgLang_thy) allthys) + 1, allthys);
neuper@42400
    22
  val knowthys' =
neuper@42407
    23
    take ((find_index (curry Theory.eq_thy first_Knowledge_thy) isacthys') + 1, isacthys');
neuper@42407
    24
  val progthys' =                   (*WN120321.TODO rearrange theories -------vvv*)
neuper@42407
    25
    drop ((find_index (curry Theory.eq_thy first_Knowledge_thy) isacthys') + 1 +3, isacthys');
neuper@42400
    26
neuper@42400
    27
  val isacrlsthms = ! ruleset'
neuper@42400
    28
    |> map (thms_of_rls o #2 o #2)
neuper@42400
    29
    |> flat
neuper@42400
    30
    |> map thm_of_thm
neuper@42400
    31
    |> gen_distinct Thm.eq_thm 
neuper@42400
    32
    |> map (` I)
neuper@42400
    33
    |> map (apfst Thm.get_name_hint)
neuper@42400
    34
    |> map (apsnd prop_of)  (*this adapts to Theory.axioms_of*)
neuper@42400
    35
    : (thmDeriv * term) list;
neuper@42400
    36
  val isacthms =
neuper@42407
    37
    (flat o (map Theory.axioms_of)) isacthys': (thmDeriv * term) list; 
neuper@42400
    38
(*in*)
neuper@42400
    39
    isabthys := isabthys';
neuper@42400
    40
    knowthys := knowthys';
neuper@42400
    41
    progthys := progthys';
neuper@42407
    42
    theory' := rev ((map Context.theory_name isacthys') ~~ isacthys'); (*WN120320 easy to remove*)
neuper@42400
    43
    val rlsthmsNOTisac = gen_diff eq_thmI' (isacrlsthms, isacthms); 
neuper@48880
    44
(*end;(*local*)*)
neuper@42400
    45
(*WN120319: since num_str destoys derivation_name, we hardcode rlsthmsNOTisac:
neuper@42400
    46
  see tests
neuper@42400
    47
  --- OLD compute rlsthmsNOTisac by eq_thmID ---
neuper@42400
    48
  --- compute val rlsthmsNOTisac ---
neuper@42400
    49
  for improvements (###sym_* etc)
neuper@42400
    50
*)
neuper@42400
    51
val rlsthmsNOTisac =
neuper@42400
    52
 [("HOL.refl", (prop_of o num_str) @{thm refl}),
neuper@42400
    53
  ("Fun.o_apply", (prop_of o num_str) @{thm o_apply}),
neuper@42400
    54
  (*/------------these are not found in ListC.thy, because they are no axioms---\*)
neuper@42400
    55
  ("ListC.del.del_base", (prop_of o num_str) @{thm del_base}), 
neuper@42400
    56
  ("ListC.del.del_rec", (prop_of o num_str) @{thm del_rec}),
neuper@42400
    57
  ("ListC.LENGTH.LENGTH_CONS", (prop_of o num_str) @{thm LENGTH_CONS}), 
neuper@42400
    58
  ("ListC.LENGTH.LENGTH_NIL", (prop_of o num_str) @{thm LENGTH_NIL}), 
neuper@42400
    59
  ("ListC.list_diff_def", (prop_of o num_str) @{thm list_diff_def}), 
neuper@42400
    60
  (*\------------these are not found in ListC.thy, because they are no axioms---/*)
neuper@42400
    61
  ("List.take_Nil", (prop_of o num_str) @{thm take_Nil}),
neuper@42400
    62
  ("List.take_Cons", (prop_of o num_str) @{thm take_Cons}),
neuper@42400
    63
  ("List.if_True", (prop_of o num_str) @{thm if_True}),
neuper@42400
    64
  ("HOL.if_False", (prop_of o num_str) @{thm if_False}),
neuper@42400
    65
  (*###("sym_real_mult_minus1", "- ?z1 = -1 * ?z1")*)
neuper@52062
    66
  ("Rings.semiring_class.distrib_right", (prop_of o num_str) @{thm distrib_right}),
neuper@52062
    67
  ("Rings.semiring_class.distrib_left", (prop_of o num_str) @{thm distrib_left}),
neuper@42400
    68
  (*###("sym_realpow_twoI", "?r1 * ?r1 = ?r1 ^^^ 2")*)
neuper@42400
    69
  (*###("sym_realpow_addI", "?r1 ^^^ ?n1 * ?r1 ^^^ ?m1 = ?r1 ^^^ (?n1 + ?m1)")*)
neuper@42400
    70
  ("Groups.monoid_mult_class.mult_1_right", (prop_of o num_str) @{thm mult_1_right}),
neuper@42400
    71
  (*("sym_real_mult_2", "?z1 + ?z1 = 2 * ?z1")*)
neuper@42400
    72
  ("Groups.monoid_mult_class.mult_1_left", (prop_of o num_str) @{thm mult_1_left}),
neuper@42400
    73
  ("Rings.mult_zero_class.mult_zero_left", (prop_of o num_str) @{thm mult_zero_left}),
neuper@42400
    74
  ("Rings.mult_zero_class.mult_zero_right", (prop_of o num_str) @{thm mult_zero_right}),
neuper@42400
    75
  ("Groups.monoid_add_class.add_0_left", (prop_of o num_str) @{thm add_0_left}),
neuper@42400
    76
  ("Groups.monoid_add_class.add_0_right", (prop_of o num_str) @{thm add_0_right}),
neuper@42400
    77
  ("Rings.division_ring_class.divide_zero_left", (prop_of o num_str) @{thm divide_zero_left}),
neuper@48763
    78
  (*###("sym_mult_assoc", "?z1.1 * (?z2.1 * ?z3.1) = ?z1.1 * ?z2.1 * ?z3.1")*)
neuper@48764
    79
  ("RealDef.order_refl", (prop_of o num_str) @{thm order_refl}),
neuper@42400
    80
  ("Groups.group_add_class.minus_minus", (prop_of o num_str) @{thm minus_minus}),
neuper@48763
    81
  ("RealDef.mult_commute", (prop_of o num_str) @{thm mult_commute }),
neuper@48763
    82
  ("RealDef.mult_assoc", (prop_of o num_str) @{thm mult_assoc}),
neuper@42400
    83
  ("Groups.ab_semigroup_add_class.add_commute", (prop_of o num_str) @{thm add_commute}),
neuper@42400
    84
  ("Groups.ab_semigroup_add_class.add_left_commute", (prop_of o num_str) @{thm add_left_commute}),
neuper@42400
    85
  ("Groups.semigroup_add_class.add_assoc", (prop_of o num_str) @{thm add_assoc}),
neuper@42400
    86
  ("Rings.ring_class.minus_mult_left", (prop_of o num_str) @{thm minus_mult_left}),
neuper@42400
    87
  ("Groups.group_add_class.right_minus", (prop_of o num_str) @{thm right_minus}),
neuper@42400
    88
  (*###("sym_add_assoc", "?a1 + (?b1 + ?c1) = ?a1 + ?b1 + ?c1"),*)
neuper@42400
    89
  ("Rings.ring_class.left_diff_distrib", (prop_of o num_str) @{thm left_diff_distrib}),
neuper@42400
    90
  ("Rings.ring_class.right_diff_distrib", (prop_of o num_str) @{thm right_diff_distrib}),
neuper@42400
    91
  ("Rings.division_ring_class.minus_divide_left", (prop_of o num_str) @{thm minus_divide_left}),
neuper@42400
    92
  ("Rings.division_ring_class.times_divide_eq_right", (prop_of o num_str) @{thm times_divide_eq_right}),
neuper@42400
    93
  ("Fields.field_class.times_divide_eq_left", (prop_of o num_str) @{thm times_divide_eq_left}),
neuper@42400
    94
  ("Fields.field_inverse_zero_class.divide_divide_eq_left", (prop_of o num_str) @{thm divide_divide_eq_left}),
neuper@42400
    95
  ("Fields.field_inverse_zero_class.divide_divide_eq_right", (prop_of o num_str) @{thm divide_divide_eq_right}),
neuper@42400
    96
  ("Rings.division_ring_class.divide_1", (prop_of o num_str) @{thm divide_1}),
neuper@42400
    97
  ("Rings.division_ring_class.add_divide_distrib", (prop_of o num_str) @{thm add_divide_distrib }),
neuper@42400
    98
  (*###("sym_rmult_assoc", "?m1 * (?n1 * ?k1) = ?m1 * ?n1 * ?k1")*)
neuper@42400
    99
  (* thms in Scripts: *)
neuper@42400
   100
  ("Int.divide_minus1", (prop_of o num_str) @{thm divide_minus1}),
neuper@42400
   101
  ("Groups.group_add_class.neg_equal_iff_equal", (prop_of o num_str) @{thm neg_equal_iff_equal})]
neuper@42400
   102
  : (thmDeriv * term) list;
neuper@42400
   103
neuper@42400
   104
(*.set up the list using 'val first_isac_thy' (see ListC.thy).*)
neuper@42400
   105
(*isab_thm_thy := make_isab rlsthmsNOTisac isabthys;*)
neuper@42400
   106
  isab_thm_thy := rlsthmsNOTisac; (*WN120320 remove ref*)
neuper@42400
   107
neuper@42400
   108
(*.create the hierarchy of theory elements from IsacKnowledge
neuper@42400
   109
   including thms from Isabelle used in rls;
neuper@42400
   110
   elements store_*d in any *.thy are not overwritten.*)
neuper@42400
   111
neuper@48886
   112
(*========== inhibit exn WN130616: ME_Isa: thy 'Script' not in system =======
neuper@48887
   113
  WN130620: instead of building thehier correctly, the elements required for tests
neuper@48887
   114
  are inserted at "=== inhibit exn WN130620 (1.4.1) below: fill thehier ===" 
neuper@48887
   115
  according to (1.4.1) below.
neuper@48887
   116
neuper@48880
   117
thehier := the_hier (! thehier) (collect_thydata ()); (*ME_Isa: thy 'Script' not in system*)
neuper@42400
   118
tracing("----------------------------------\n" ^
neuper@42400
   119
	"*** insert: not found ... IS OK : \n" ^
neuper@42400
   120
	"comes from fill_parents           \n" ^
neuper@42400
   121
	"----------------------------------\n");
neuper@48886
   122
========== inhibit exn WN130616: ME_Isa: thy 'Script' not in system =======*)
neuper@42457
   123
*}
neuper@42429
   124
neuper@42457
   125
text {* interface for dialog-authoring *}
neuper@42453
   126
neuper@42457
   127
ML {*
neuper@48887
   128
(*/========= inhibit exn WN130620 (1.4.1) below: fill thehier ==============\*)
neuper@48887
   129
store_thy @{theory "Diff"} ["Isabelle2011-->12"];
neuper@48887
   130
store_isa ["IsacKnowledge","Diff","Theorems"] ["Isabelle2011-->12"];
neuper@48887
   131
store_thm @{theory "Diff"} "IsacKnowledge" ("diff_sin_chain", prop_of @{thm diff_sin_chain})
neuper@48887
   132
   ["Isabelle2011-->12"];
neuper@48889
   133
store_thm @{theory "Diff"} "IsacKnowledge" ("diff_cos_chain", prop_of @{thm diff_cos_chain})
neuper@48889
   134
   ["Isabelle2011-->12"];
neuper@48891
   135
store_thm @{theory "Diff"} "IsacKnowledge" ("diff_pow_chain", prop_of @{thm diff_pow_chain})
neuper@48891
   136
   ["Isabelle2011-->12"];
neuper@48895
   137
store_thm @{theory "Diff"} "IsacKnowledge" ("diff_ln_chain", prop_of @{thm diff_ln_chain})
neuper@48895
   138
   ["Isabelle2011-->12"];
neuper@48895
   139
store_thm @{theory "Diff"} "IsacKnowledge" ("diff_exp_chain", prop_of @{thm diff_exp_chain})
neuper@48895
   140
   ["Isabelle2011-->12"];
neuper@48887
   141
store_isa ["IsacKnowledge","Diff","Rulesets"] ["Isabelle2011-->12"];
neuper@48887
   142
store_rls @{theory "Diff"} norm_diff ["Isabelle2011-->12"];
neuper@48895
   143
neuper@48895
   144
store_thy @{theory "Test"} ["Isabelle2011-->12"];
neuper@48892
   145
store_isa ["IsacKnowledge","Test","Theorems"] ["Isabelle2011-->12"];
neuper@48892
   146
store_thm @{theory "Test"} "IsacKnowledge" ("radd_left_commute", prop_of @{thm radd_left_commute
neuper@48892
   147
})
neuper@48892
   148
   ["Isabelle2011-->12"];
neuper@48887
   149
(*\========= inhibit exn WN130620 (1.4.1) below: fill thehier ==============/*)
neuper@48887
   150
*}
neuper@48887
   151
ML {*
neuper@42454
   152
insert_errpats ["diff","differentiate_on_R"]
neuper@42454
   153
 ([("chain-rule-diff-both",
neuper@48895
   154
    [parse_patt @{theory Diff} "d_d ?bdv (sin ?u) = cos (d_d ?bdv ?u)",
neuper@48895
   155
     parse_patt @{theory Diff} "d_d ?bdv (cos ?u) = - sin (d_d ?bdv ?u)",
neuper@48895
   156
     parse_patt @{theory Diff} "d_d ?bdv (?u ^^^ ?n) = ?n * ?u ^^^ (?n - 1)",
neuper@48895
   157
     parse_patt @{theory Diff} "d_d ?bdv (LogExp.ln ?u) = 1 / ?u",
neuper@48895
   158
     parse_patt @{theory Diff} "d_d ?bdv (LogExp.ln ?u) = 1 / d_d ?bdv ?u"],
neuper@42453
   159
    [@{thm diff_sin_chain}, @{thm diff_cos_chain}, @{thm diff_pow_chain}, 
neuper@42454
   160
     @{thm diff_ln_chain}, @{thm  diff_exp_chain}])]: errpat list);
neuper@42453
   161
neuper@42454
   162
insert_fillpats ["IsacKnowledge", "Diff", "Theorems", "diff_sin_chain"]
neuper@42454
   163
 ([("fill-d_d-arg",
neuper@48895
   164
     parse_patt @{theory Diff} "d_d ?bdv (sin ?u) = cos ?u * d_d ?bdv _", "chain-rule-diff-both"),
neuper@42455
   165
   ("fill-both-args",
neuper@48895
   166
     parse_patt @{theory Diff} "d_d ?bdv (sin _) = cos ?u * d_d ?bdv _", "chain-rule-diff-both"),
neuper@42455
   167
   ("fill-d_d",
neuper@48895
   168
     parse_patt @{theory Diff} "d_d ?bdv (sin ?u) = cos ?u * _ ?bdv ?u", "chain-rule-diff-both"),
neuper@42455
   169
   ("fill-inner-deriv",
neuper@48895
   170
     parse_patt @{theory Diff} "d_d ?bdv (sin ?u) = cos ?u * _", "chain-rule-diff-both"),
neuper@42455
   171
   ("fill-all",
neuper@48895
   172
     parse_patt @{theory Diff} "d_d ?bdv (sin ?u) = _", "chain-rule-diff-both")]: fillpat list);
neuper@42445
   173
neuper@42516
   174
insert_errpats ["simplification","of_rationals"]
neuper@42516
   175
 ([("addition-of-fractions",
neuper@48895
   176
   [parse_patt @{theory Rational} "(?a / ?b + ?c / ?d) = (?a + ?c)/(?b + ?d)",
neuper@48895
   177
    parse_patt @{theory Rational} "(?a / ?b + ?c / ?d) = (?a + ?c)/(?b * ?d)",
neuper@48895
   178
    parse_patt @{theory Rational} "(?a / ?b + ?c / ?d) = (?c * ?a)/(?d * ?b)",
neuper@48895
   179
    parse_patt @{theory Rational} "?a + (?b /?c)= (?a + ?b)/ ?c",
neuper@48895
   180
    parse_patt @{theory Rational} "?a + (?b /?c)= (?a * ?b)/ ?c"],
neuper@42516
   181
   [@{thm rat_add}, @{thm rat_add_assoc}, @{thm rat_add1},
neuper@42516
   182
    @{thm rat_add1_assoc}, @{thm rat_add2}, @{thm rat_add2_assoc},
neuper@42516
   183
    @{thm rat_add3}, @{thm rat_add3_assoc}])]: errpat list);
neuper@42516
   184
neuper@42516
   185
(*TODO insert_fillpats ["IsacKnowledge", "Rational", "Theorems", "???"]*)
neuper@42516
   186
neuper@42516
   187
(* TODO insert_errpats overwrites instead of appending
neuper@42516
   188
insert_errpats ["simplification","of_rationals"]
neuper@42516
   189
 (("cancel", (*see master thesis gdarocy*)
neuper@48895
   190
    [(*a*)parse_patt @{theory Rational} "(?a + ?b)/?a = ?b",
neuper@48895
   191
     (*b*)parse_patt @{theory Rational} "(?a + ?b)/?b = ?a",
neuper@48895
   192
     (*c*)parse_patt @{theory Rational} "(?a + ?b)/(?b + ?c) = ?a / ?c",
neuper@48895
   193
     (*d*)parse_patt @{theory Rational} "(?a + ?c)/(?b + ?c) = ?a / ?b",
neuper@48895
   194
     (*e*)parse_patt @{theory Rational} "(?a + ?c)/(?b + ?c) = ?a / ?c",
neuper@48895
   195
     (*f*)parse_patt @{theory Rational} "(?a + ?b)/(?c + ?a) = ?b / ?c",
neuper@48895
   196
     (*g*)parse_patt @{theory Rational} "(?a*?b + ?c)/?a = ?b + ?c",
neuper@48895
   197
     (*h*)parse_patt @{theory Rational} "(?a*?b + ?c)/?b = ?a + ?c",
neuper@48895
   198
     (*i*)parse_patt @{theory Rational} "(?a + ?b*?c)/?b = ?a + ?c",
neuper@48895
   199
     (*j*)parse_patt @{theory Rational} "(?a + ?b*?c)/?b = ?a + ?b",
neuper@48895
   200
     (*k*)parse_patt @{theory Rational} "(?a + ?b*?e)/(?c + ?d*?e) = (?a + ?b)/(?c + ?d)"],
neuper@42516
   201
    [@{thm real_times_divide_1_eq}, (*TODO*) @{thm real_times_divide_1_eq}]));
neuper@42516
   202
neuper@42445
   203
val fillpats = [
neuper@42445
   204
  ("fill-cancel-left-num",
neuper@42445
   205
    parse_patt @{theory Rational} "(?a * ?b) / (?a * ?c) = _ / ?c", "cancel"),
neuper@42445
   206
  ("fill-cancel-left-den",
neuper@42445
   207
    parse_patt @{theory Rational} "(?a * ?b) / (?a * ?c) = ?b / _", "cancel"),
neuper@42445
   208
  ("fill-cancel-none",
neuper@42445
   209
    parse_patt @{theory Rational} "(?a * ?b) / (?a * ?c) = ?b / ?c", "cancel"),
neuper@42445
   210
neuper@42445
   211
  ("fill-cancel-left-add-num1",
neuper@42445
   212
    parse_patt @{theory Rational} "(?a * (?b + ?c)) / (?a * ?d) = (_ + ?c) / ?d", "cancel"),
neuper@42445
   213
  ("fill-cancel-left-add-num2",
neuper@42445
   214
    parse_patt @{theory Rational} "(?a * (?b + ?c)) / (?a * ?d) = (?b + _) / ?d", "cancel"),
neuper@42445
   215
  ("fill-cancel-left-add-num3",
neuper@42445
   216
    parse_patt @{theory Rational} "(?a * (?b + ?c)) / (?a * ?d) = (_ + _) / ?d", "cancel"),
neuper@42445
   217
  ("fill-cancel-left-add-num4",
neuper@42445
   218
    parse_patt @{theory Rational} "(?a * (?b + ?c)) / (?a * ?d) = (?b + ?c) / _", "cancel"),
neuper@42445
   219
  ("fill-cancel-left-add-num5",
neuper@42445
   220
    parse_patt @{theory Rational} "(?a * (?b + ?c)) / (?a * ?d) = (_ + ?c) / _", "cancel"),
neuper@42445
   221
  ("fill-cancel-left-add-num6",
neuper@42445
   222
    parse_patt @{theory Rational} "(?a * (?b + ?c)) / (?a * ?d) = (?b + _) / _", "cancel"),
neuper@42445
   223
  ("fill-cancel-left-add-none",
neuper@42445
   224
    parse_patt @{theory Rational} "(?a * (?b + ?c)) / (?a * ?d) = (?b + ?c) / ?d", "cancel"),
neuper@42445
   225
neuper@42445
   226
  ("fill-cancel-left-add-den1",
neuper@42445
   227
    parse_patt @{theory Rational} "(?a * ?b) / (?a * (?c + ?d)) = ?b / (?c + ?d)", "cancel"),
neuper@42445
   228
  ("fill-cancel-left-add-den2",
neuper@42445
   229
    parse_patt @{theory Rational} "(?a * ?b) / (?a * (?c + ?d)) = ?b / (?c + ?d)", "cancel"),
neuper@42445
   230
  ("fill-cancel-left-add-den3",
neuper@42445
   231
    parse_patt @{theory Rational} "(?a * ?b) / (?a * (?c + ?d)) = ?b / (?c + ?d)", "cancel"),
neuper@42445
   232
  ("fill-cancel-left-add-den4",
neuper@42445
   233
    parse_patt @{theory Rational} "(?a * ?b) / (?a * (?c + ?d)) = ?b / (?c + ?d)", "cancel"),
neuper@42445
   234
  ("fill-cancel-left-add-den5",
neuper@42445
   235
    parse_patt @{theory Rational} "(?a * ?b) / (?a * (?c + ?d)) = ?b / (?c + ?d)", "cancel"),
neuper@42445
   236
  ("fill-cancel-left-add-den6",
neuper@42445
   237
    parse_patt @{theory Rational} "(?a * ?b) / (?a * (?c + ?d)) = ?b / (?c + ?d)", "cancel"),
neuper@42445
   238
  ("fill-cancel-left-add-none",
neuper@42445
   239
    parse_patt @{theory Rational} "(?a * ?b) / (?a * (?c + ?d)) = ?b / (?c + ?d)", "cancel")
neuper@42445
   240
 ]: fillpat list;
neuper@42445
   241
*)
neuper@42445
   242
neuper@42453
   243
(* still ununsed; planned for stepToErrorpattern: this is just a reminder... *)
neuper@42453
   244
neuper@42454
   245
insert_errpatIDs ["IsacKnowledge", "Diff", "Rulesets", "norm_diff"]
neuper@42454
   246
  (["chain-rule-diff-both", "cancel"]: errpatID list);
neuper@42453
   247
neuper@42453
   248
(* ...and all other related rls by hand;
neuper@42453
   249
   TODO: lift errpattIDs from theorems to respective rls AUTOMATICALLY *)
neuper@42400
   250
*}
neuper@48886
   251
neuper@48896
   252
section {* Plans for updating isac from Isabelle2011 to Isabelle2012 and Isabelle2013 *}
neuper@48886
   253
subsection {* (1) problem analysis *}
neuper@48886
   254
subsubsection {* (1.1) "Unsynchronized.ref" are not conformant with parallel Isabelle *}
neuper@48886
   255
text {* 
neuper@48889
   256
  "Unsynchronized.ref" make "Test_Isac.thy" unreliable, too: in Isabelle2009-2
neuper@48889
   257
  a (bad) trick with "check_unsynchronized_ref ()" was a way out; 
neuper@48889
   258
  however, this trick doesn't work anymore in Isabelle2011 
neuper@48889
   259
  (remarkably, "Interpret/calchead.sml" sometimes has an error, sometimes not
neuper@48889
   260
  when cutting/pasting check_unsynchronized_ref in Isabelle2011; 
neuper@48889
   261
  but this is permanently without errors in Isabelle2012).
neuper@48886
   262
neuper@48886
   263
  The major cases of "Unsynchronized.ref" are those in "~~/src/Tools/isac/calcelems.sml",
neuper@48886
   264
  thehier, ptyps, mets, theory', rew_ord', ruleset', calclist', 
neuper@48886
   265
  which shall be handled by "Theory_Data", see 
neuper@48886
   266
  "~~/test/Tools/isac/ADDTESTS/accumulate-val/lucas_interpreter.sml".
neuper@48886
   267
neuper@48886
   268
  The transition from the above "Unsynchronized.ref" to "Theory_Data" is a task 
neuper@48886
   269
  to be scheduled for several days. An exception is "thehier", see (1.2) (1.3) below.
neuper@48886
   270
*}
neuper@48886
   271
neuper@48886
   272
subsubsection {* (1.2) Removing "Unsynchronized.ref" depends on special cases *}
neuper@48886
   273
text {* 
neuper@48886
   274
  The difficulties in removing "Unsynchronized.ref" differ largely:
neuper@48886
   275
  * Rational.thy will be cleared by Diana Meindl's GCD_Poly.thy, this is easy;
neuper@48886
   276
  * other cases seem easy to clear, too
neuper@48893
   277
  * clearing "thehier" became harder from Isabelle2009-2 to Isabelle2011;
neuper@48893
   278
    for instance, isac's Context has been broken already there, because 
neuper@48893
   279
    essential functions from Isabelle2009-2 were dropped in Isabelle2011,
neuper@48893
   280
    see for instance "fun context_thy".
neuper@48893
   281
    Another obstacle for this case also seems "fun num_str".
neuper@48886
   282
neuper@48886
   283
  So (1.2) depends on (1.3).
neuper@48886
   284
*}
neuper@48886
   285
neuper@48886
   286
subsubsection {* (1.3) isac's numerals are not conformant with Isabelle *}
neuper@48886
   287
text {* 
neuper@48886
   288
  In 2002 isac already strived for floating point numbers. Since that time
neuper@48886
   289
  isac represents numerals as "Free", see below (*1*). These experiments are
neuper@48886
   290
  unsatisfactory with respect to logical soundness.
neuper@48886
   291
  Since Isabelle now has started to care about floating point numbers, it is high 
neuper@48886
   292
  time to adopt these together with the other numerals. Isabelle2012/13's numerals
neuper@48886
   293
  are different from Isabelle2011, see "test/Tools/isac/ProgLang/termC.sml".
neuper@48886
   294
  
neuper@48886
   295
  The transition from "Free" to standard numerals is a task to be scheduled for 
neuper@48886
   296
  several weeks. The urgency of this task follows from the experience, 
neuper@48886
   297
  that (1.2) for "thehier" is very hard, because "num_str" seems to destroy 
neuper@48886
   298
  some of the long identifiers of theorems which would tremendously simplify
neuper@48886
   299
  building a hierarchy of theorems according to (1.2), see (*2*) below.
neuper@48886
   300
*}
neuper@48886
   301
ML {*(*1*) Free ("123.456", HOLogic.realT) *}
neuper@48886
   302
ML {*(*2*)
neuper@48886
   303
val unknown = filter ((curry op= "??.unknown") o fst) isacrlsthms;
neuper@48886
   304
unknown |> nth 1 |> snd 
neuper@48886
   305
  |> Print_Mode.setmp [] (Syntax.string_of_term (Proof_Context.init_global @{theory}));
neuper@48886
   306
unknown |> nth 2 |> snd 
neuper@48886
   307
  |> Print_Mode.setmp [] (Syntax.string_of_term (Proof_Context.init_global @{theory}));
neuper@48886
   308
(*but these seem ok:*)
neuper@48886
   309
  Thm.get_name_hint @{thm add_0};
neuper@48886
   310
  Thm.get_name_hint (num_str @{thm add_0});
neuper@48886
   311
*}
neuper@48886
   312
neuper@48886
   313
subsubsection {* (1.4) "axioms" are a legacy feature disappearing soon *}
neuper@48886
   314
text {*
neuper@48886
   315
  isac works with (many!) rewrite rules, which are defined as "axioms" since Isabelle2002
neuper@48886
   316
  and before: isac saved time by not proving any theorem.
neuper@48886
   317
  We have the message "Legacy feature! Old 'axioms' command -- use 'axiomatization' instead"
neuper@48886
   318
  for some time; Isabelle2013 still accepts it.
neuper@48889
   319
  This task affects collection of rewrite rules in "thehier".
neuper@48886
   320
*}
neuper@48886
   321
neuper@48886
   322
subsection {* (2) possible solutions *}
neuper@48890
   323
subsubsection {* (2.1) Tackle (1.1) (1.2) (1.3) (1.4) already in Isabelle2011 *}
neuper@48886
   324
text {*
neuper@48886
   325
  Advantage: we have a perfect "Test_Isac.thy" in all transitions Isabelle2011-->12-->13
neuper@48886
   326
  Disadvantage: (1.3) would require effort twice: Isabelle2011-->12 and 12-->13,
neuper@48886
   327
    because numerals in Isabelle2011 are quite different from Isabelle2012/13.
neuper@48886
   328
*}
neuper@48886
   329
neuper@48890
   330
subsubsection {* (2.2) Transition Isabelle2011-->12 with minimal effort *}
neuper@48886
   331
text {*
neuper@48886
   332
  Postpone (1.1) (1.2) (1.3) (1.4) and 
neuper@48887
   333
  * (1.4.1) manually insert those elements into "thehier" which are required for tests
neuper@48886
   334
  * make "Test_Isac.thy" perform equivalenty on Isabelle2011 and on Isabelle2012
neuper@48886
   335
    (and then on Isabelle2013).
neuper@48886
   336
    This might enforce to outcomment tests in Isabelle2011 marked "Isabelle2011-->12"
neuper@48886
   337
neuper@48886
   338
  Advantages:
neuper@48886
   339
    * the transition Isabelle2011-->12 can be accomplished within few days,
neuper@48886
   340
      and hopefully Isabelle2012-->13 in the same way
neuper@48886
   341
    * student projects (which seem independent of the outcommented tests "Isabelle2011-->12") 
neuper@48886
   342
      can start immediately
neuper@48886
   343
  Disadvantage:
neuper@48886
   344
    * we do not yet know details about the transition Isabelle2012-->13,
neuper@48886
   345
      which might be very different from Isabelle2011-->12
neuper@48886
   346
    * some tests are outcommented;
neuper@48886
   347
      However, if new regression tests come from new student project, 
neuper@48886
   348
      these provisionally do not concern "thehier".
neuper@48886
   349
*}
neuper@48886
   350
neuper@42400
   351
end