src/Tools/isac/CalcElements/theoryC.sml
author Walther Neuper <walther.neuper@jku.at>
Fri, 10 Apr 2020 14:46:55 +0200
changeset 59865 75a9d629ea53
parent 59862 2423c3a49a11
permissions -rw-r--r--
rearrange code for ThmC
walther@59855
     1
(* Title:  CalcElements/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@59856
     9
  eqtype thyID
walther@59856
    10
  eqtype domID
walther@59856
    11
  eqtype theory'
walther@59856
    12
walther@59854
    13
  val Thy_Info_get_theory: string -> theory
walther@59854
    14
  val thy2ctxt': string -> Proof.context
walther@59854
    15
  val thy2ctxt: theory -> Proof.context
walther@59854
    16
  val Isac: 'a -> theory
walther@59854
    17
  val e_domID: domID
walther@59854
    18
  val string_of_thy: theory -> theory'
walther@59854
    19
  val theory2domID: theory -> theory'
walther@59854
    20
  val theory2thyID: theory -> thyID
walther@59854
    21
  val theory2theory': theory -> theory'
walther@59854
    22
  val theory2str: theory -> theory'
walther@59854
    23
  val thyID2theory': thyID -> thyID
walther@59854
    24
  val theory'2thyID: theory' -> theory'
walther@59862
    25
  val thyID_of_derivation_name: string -> string
walther@59861
    26
(* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
walther@59861
    27
  (*NONE*)
walther@59861
    28
(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
walther@59861
    29
  (*NONE*)
walther@59861
    30
( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
walther@59854
    31
end
walther@59854
    32
walther@59854
    33
(**)
walther@59854
    34
structure ThyC(**): THEORY_ISAC(**) =
walther@59854
    35
struct
walther@59854
    36
(**)
walther@59854
    37
walther@59854
    38
(* Since Isabelle2017 sessions in theory identifiers are enforced.
walther@59854
    39
  However, we leave theory identifiers short, in particular in use as keys into KEStore. *)
walther@59854
    40
fun Thy_Info_get_theory thyID = Thy_Info.get_theory ("Isac." ^ thyID)
walther@59865
    41
walther@59854
    42
fun thy2ctxt' thy' = Proof_Context.init_global (Thy_Info_get_theory thy');(*FIXXXME thy-ctxt*)
walther@59854
    43
fun thy2ctxt thy = Proof_Context.init_global thy;(*FIXXXME thy-ctxt*)
walther@59854
    44
fun Isac _ = Proof_Context.theory_of (thy2ctxt' "Isac_Knowledge"); (*@{theory "Isac_Knowledge"}*)
walther@59854
    45
type thyID = string;   (* WN.3.11.03 TODO: replace domID with thyID*)
walther@59854
    46
type domID = string;   (* domID ^".thy" = theory' WN.101011 replace by thyID*)
walther@59854
    47
type theory' = string; (* = domID ^".thy" WN.101011 ABOLISH !*)
walther@59854
    48
val e_domID = "e_domID" : domID;
walther@59854
    49
fun string_of_thy thy = Context.theory_name thy: theory';
walther@59854
    50
val theory2domID = string_of_thy;
walther@59854
    51
val theory2thyID = (get_thy o string_of_thy) : theory -> thyID;
walther@59854
    52
val theory2theory' = string_of_thy;
walther@59854
    53
val theory2str = string_of_thy; (*WN050903 ..most consistent naming*)
walther@59854
    54
walther@59854
    55
fun thyID2theory' (thyID:thyID) = thyID;
walther@59854
    56
fun theory'2thyID (theory':theory') = theory';
walther@59854
    57
walther@59862
    58
fun thyID_of_derivation_name dn = hd (space_explode "." dn);
walther@59862
    59
walther@59858
    60
(**)end(**)