walther@59866
|
1 |
(* Title: BaseDefinitions/theoryC.sml
|
walther@59854
|
2 |
Author: Walther Neuper
|
walther@59854
|
3 |
(c) due to copyright terms
|
walther@59854
|
4 |
|
walther@59865
|
5 |
Probably this structure can be dropped due to improved reflection in Isabelle.
|
walther@59854
|
6 |
*)
|
walther@59854
|
7 |
signature THEORY_ISAC =
|
walther@59854
|
8 |
sig
|
walther@59879
|
9 |
eqtype id
|
walther@59879
|
10 |
val cut_id: string -> id
|
walther@59856
|
11 |
|
walther@60082
|
12 |
val last_isabelle_thy: theory
|
walther@60182
|
13 |
val session_specify_names: id list
|
walther@60081
|
14 |
val session_interpret_names: id list
|
walther@60081
|
15 |
val get_theory: id -> theory (* restricted to Isac_Knowledge *)
|
walther@59879
|
16 |
val id_to_ctxt: id -> Proof.context
|
walther@60016
|
17 |
val to_ctxt: theory -> Proof.context (* inverse of Proof_Context.theory_of *)
|
walther@59879
|
18 |
|
walther@59879
|
19 |
val id_empty: id
|
walther@59854
|
20 |
val Isac: 'a -> theory
|
walther@59918
|
21 |
val parent_of: theory -> theory -> theory
|
walther@59965
|
22 |
val sub_common : theory * theory -> theory
|
walther@59918
|
23 |
|
walther@59861
|
24 |
(* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
|
walther@59861
|
25 |
(*NONE*)
|
walther@59886
|
26 |
(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
|
walther@60081
|
27 |
val get_thy: id -> theory (* restricted to session Isac *)
|
walther@59886
|
28 |
( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
|
walther@59854
|
29 |
end
|
walther@59854
|
30 |
|
walther@59854
|
31 |
(**)
|
walther@59854
|
32 |
structure ThyC(**): THEORY_ISAC(**) =
|
walther@59854
|
33 |
struct
|
walther@59854
|
34 |
(**)
|
walther@59854
|
35 |
|
walther@59879
|
36 |
type id = string;
|
walther@59879
|
37 |
fun cut_id dn = hd (space_explode "." dn);
|
walther@59865
|
38 |
|
walther@60082
|
39 |
val last_isabelle_thy = @{theory Complex_Main}
|
walther@60182
|
40 |
val session_specify_names = ["Specify", "MathEngBasic", "Input_Descript",
|
walther@60081
|
41 |
"ProgLang", "Auto_Prog", "Prog_Expr", "Tactical", "Prog_Tac", "Program", "ListC", "Calculate",
|
walther@60081
|
42 |
"BaseDefinitions", "Know_Store"]
|
walther@60182
|
43 |
val session_interpret_names = ["Interpret"]
|
walther@60081
|
44 |
fun get_thy thyID =
|
walther@60182
|
45 |
if member op = session_specify_names thyID
|
walther@60182
|
46 |
then Thy_Info.get_theory ("Specify." ^ thyID)
|
walther@60182
|
47 |
else if member op = session_interpret_names thyID
|
walther@60081
|
48 |
then Thy_Info.get_theory ("Interpret." ^ thyID)
|
walther@60081
|
49 |
else Thy_Info.get_theory ("Isac." ^ thyID);
|
walther@60081
|
50 |
fun get_theory thy =
|
walther@59903
|
51 |
if thy = "empty_thy_id"
|
walther@59881
|
52 |
then (get_thy "Base_Tools") (*lower bound of Knowledge*)
|
walther@59881
|
53 |
else (get_thy thy) handle _ => raise ERROR ("ME_Isa: thy \"" ^ thy ^ "\" not in system");
|
walther@59881
|
54 |
|
walther@59879
|
55 |
fun id_to_ctxt thy' = Proof_Context.init_global (get_theory thy');
|
walther@59879
|
56 |
fun to_ctxt thy = Proof_Context.init_global thy;
|
walther@59879
|
57 |
|
walther@59903
|
58 |
val id_empty = "empty_thy_id";
|
walther@59879
|
59 |
fun Isac _ = Proof_Context.theory_of (id_to_ctxt "Isac_Knowledge");
|
walther@59879
|
60 |
|
walther@59918
|
61 |
fun parent_of thy1 thy2 = if Context.subthy (thy1, thy2) then thy2 else thy1;
|
walther@59918
|
62 |
|
walther@59965
|
63 |
fun sub_common (thy1, thy2) =
|
walther@59965
|
64 |
if Context.subthy (thy1, thy2) then
|
walther@59965
|
65 |
thy2
|
walther@59965
|
66 |
else if Context.subthy (thy2, thy1) then
|
walther@59965
|
67 |
thy1
|
walther@59965
|
68 |
else get_theory "Isac_Knowledge"
|
walther@59965
|
69 |
|
walther@59858
|
70 |
(**)end(**)
|