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