src/Tools/isac/BaseDefinitions/thmC-def.sml
author wneuper <Walther.Neuper@jku.at>
Wed, 16 Nov 2022 10:29:52 +0100
changeset 60592 777d05447375
parent 60337 cbad4e18e91b
child 60638 8942f07ead44
permissions -rw-r--r--
make Minisubplb/200-start-method independent #2: Tactic.Rewrite_Set partially
walther@59866
     1
(* Title:  BaseDefinitions/thmC-def.sml
walther@59858
     2
   Author: Walther Neuper
walther@59858
     3
   (c) due to copyright terms
walther@59858
     4
walther@59865
     5
Probably this structure can be dropped due to improved reflection in Isabelle.
walther@59919
     6
Here is a minimum of code required for theory Know_Store,
walther@59919
     7
further code see structure ThmC.
walther@59858
     8
*)
walther@59865
     9
signature THEOREM_ISAC_DEF =
walther@59858
    10
sig
walther@59874
    11
  type T
walther@59874
    12
  eqtype id
walther@59861
    13
walther@59875
    14
  val string_of_thm: thm -> string
walther@59875
    15
  val string_of_thms: thm list -> string
Walther@60592
    16
(*stepwise replace ^^^ by vvv and finally rename by eliminating "_PIDE"*)
Walther@60592
    17
  val string_of_thm_PIDE: Proof.context -> thm -> string
Walther@60592
    18
  val string_of_thms_PIDE: Proof.context -> thm list -> string
walther@59871
    19
walther@59875
    20
(* required in ProgLang BEFORE definition in ---------------vvv   *)
walther@59875
    21
  val int_opt_of_string: string -> int option (* belongs to TermC *)
walther@59858
    22
end
walther@59858
    23
walther@59858
    24
(**)
walther@59865
    25
structure ThmC_Def(**): THEOREM_ISAC_DEF(**) =
walther@59858
    26
struct
walther@59858
    27
(**)
walther@59858
    28
walther@59887
    29
type id = string; (* key into Know_Store, without point *)
walther@59874
    30
type T = id * Thm.thm;
walther@59861
    31
walther@60227
    32
(*this is from times before the introduction of sessions*)
walther@59875
    33
fun string_of_thm thm =
walther@59874
    34
  let
walther@59874
    35
    val t = Thm.prop_of thm
walther@59874
    36
    val ctxt = Proof_Context.init_global (Thy_Info.get_theory ("Isac.Isac_Knowledge"))
walther@59874
    37
    val ctxt' = Config.put show_markup false ctxt
walther@59874
    38
  in Print_Mode.setmp [] (Syntax.string_of_term ctxt') t end;
Walther@60592
    39
fun string_of_thms thms = (strs2str o (map (string_of_thm))) thms
Walther@60592
    40
Walther@60592
    41
fun string_of_thm_PIDE ctxt thm =
Walther@60592
    42
  let
Walther@60592
    43
    val t = Thm.prop_of thm
Walther@60592
    44
  (*val ctxt = Proof_Context.init_global (Thy_Info.get_theory ("Isac.Isac_Knowledge"))*)
Walther@60592
    45
    val ctxt' = Config.put show_markup false ctxt
Walther@60592
    46
  in Print_Mode.setmp [] (Syntax.string_of_term ctxt') t end;
Walther@60592
    47
fun string_of_thms_PIDE ctxt thms = (strs2str o (map (string_of_thm_PIDE ctxt))) thms
walther@59861
    48
walther@59875
    49
fun int_opt_of_string str = 
walther@59871
    50
  let
walther@59871
    51
    val ss = Symbol.explode str
walther@59871
    52
    val ss' = case ss of "(" :: s => drop_last s | _ => ss
walther@59871
    53
    val (sign, istr) = case ss' of "-" :: istr => (~1, istr) | _ => (1, ss')
walther@59871
    54
  in
walther@59871
    55
    case Library.read_int istr of (i, []) => SOME (sign * i) | _ => NONE
walther@59871
    56
  end;
walther@59871
    57
walther@59858
    58
(**)end(**)