src/Tools/isac/BaseDefinitions/thmC-def.sml
author wneuper <walther.neuper@jku.at>
Mon, 19 Jul 2021 18:29:46 +0200
changeset 60337 cbad4e18e91b
parent 60331 40eb8aa2b0d6
child 60592 777d05447375
permissions -rw-r--r--
cleanup after "eliminate ThmC.numerals_to_Free"
     1 (* Title:  BaseDefinitions/thmC-def.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 Here is a minimum of code required for theory Know_Store,
     7 further code see structure ThmC.
     8 *)
     9 signature THEOREM_ISAC_DEF =
    10 sig
    11   type T
    12   eqtype id
    13 
    14   val string_of_thm: thm -> string
    15   val string_of_thms: thm list -> string
    16 
    17 (* required in ProgLang BEFORE definition in ---------------vvv   *)
    18   val int_opt_of_string: string -> int option (* belongs to TermC *)
    19 end
    20 
    21 (**)
    22 structure ThmC_Def(**): THEOREM_ISAC_DEF(**) =
    23 struct
    24 (**)
    25 
    26 type id = string; (* key into Know_Store, without point *)
    27 type T = id * Thm.thm;
    28 
    29 (*this is from times before the introduction of sessions*)
    30 fun string_of_thm thm =
    31   let
    32     val t = Thm.prop_of thm
    33     val ctxt = Proof_Context.init_global (Thy_Info.get_theory ("Isac.Isac_Knowledge"))
    34     val ctxt' = Config.put show_markup false ctxt
    35   in Print_Mode.setmp [] (Syntax.string_of_term ctxt') t end;
    36 fun string_of_thms thms = (strs2str o (map string_of_thm)) thms
    37 
    38 fun int_opt_of_string str = 
    39   let
    40     val ss = Symbol.explode str
    41     val ss' = case ss of "(" :: s => drop_last s | _ => ss
    42     val (sign, istr) = case ss' of "-" :: istr => (~1, istr) | _ => (1, ss')
    43   in
    44     case Library.read_int istr of (i, []) => SOME (sign * i) | _ => NONE
    45   end;
    46 
    47 (**)end(**)