src/Tools/isac/BaseDefinitions/thmC-def.sml
author wneuper <Walther.Neuper@jku.at>
Mon, 01 Jan 2024 11:31:16 +0100
changeset 60789 8fa678b678e8
parent 60650 06ec8abfd3bc
permissions -rw-r--r--
Doc/Specify_Phase 4: start use antiquotations from isar-ref
     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: Proof.context -> thm -> string
    15   val string_of_thms: Proof.context -> 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 fun string_of_thm ctxt thm =
    30   let
    31     val t = Thm.prop_of thm
    32     val ctxt' = Config.put show_markup false ctxt
    33   in Print_Mode.setmp [] (Syntax.string_of_term ctxt') t end;
    34 fun string_of_thms ctxt thms = (strs2str o (map (string_of_thm ctxt))) thms
    35 
    36 fun int_opt_of_string str = 
    37   let
    38     val ss = Symbol.explode str
    39     val ss' = case ss of "(" :: s => drop_last s | _ => ss
    40     val (sign, istr) = case ss' of "-" :: istr => (~1, istr) | _ => (1, ss')
    41   in
    42     case Library.read_int istr of (i, []) => SOME (sign * i) | _ => NONE
    43   end;
    44 
    45 (**)end(**)