src/Tools/isac/CalcElements/thmC.sml
author Walther Neuper <walther.neuper@jku.at>
Thu, 09 Apr 2020 11:21:53 +0200
changeset 59858 a2c32a38327a
child 59861 65ec9f679c3f
permissions -rw-r--r--
separate struct. ThmC, Error_Fill_Def; unite error-pattern and fill-pattern
walther@59858
     1
(* Title:  CalcElements/thmC.sml
walther@59858
     2
   Author: Walther Neuper
walther@59858
     3
   (c) due to copyright terms
walther@59858
     4
walther@59858
     5
TODO: use "ThmC" for renaming identifiers.
walther@59858
     6
Probably this structure can be dropped due to improvements of Isabelle.
walther@59858
     7
*)
walther@59858
     8
signature THEOREM_ISAC =
walther@59858
     9
sig
walther@59858
    10
(*datatype T = Rule_Def.Thm  ..ERROR: cannot get out from Rule_Def.rule*)
walther@59858
    11
walther@59858
    12
  val string_of_thmI: thm -> string
walther@59858
    13
(* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
walther@59858
    14
  val thm2str: thm -> string
walther@59858
    15
  val thms2str : thm list -> string
walther@59858
    16
(*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
walther@59858
    17
  val string_of_thm: thm -> string
walther@59858
    18
  val string_of_thm': theory -> thm -> string
walther@59858
    19
( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
walther@59858
    20
end
walther@59858
    21
walther@59858
    22
(**)
walther@59858
    23
structure ThmC(**): THEOREM_ISAC(**) =
walther@59858
    24
struct
walther@59858
    25
(**)
walther@59858
    26
walther@59858
    27
(*datatype T = Rule_Def.Thm  ..ERROR: cannot get out from Rule_Def.rule*)
walther@59858
    28
 
walther@59858
    29
fun thm2str thm =
walther@59858
    30
  let
walther@59858
    31
    val t = Thm.prop_of thm
walther@59858
    32
    val ctxt = Proof_Context.init_global (Thy_Info.get_theory ("Isac.Isac_Knowledge"))
walther@59858
    33
    val ctxt' = Config.put show_markup false ctxt
walther@59858
    34
  in Print_Mode.setmp [] (Syntax.string_of_term ctxt') t end;
walther@59858
    35
fun thms2str thms = (strs2str o (map thm2str)) thms
walther@59858
    36
walther@59858
    37
(*check for [.] as caused by "fun assoc_thm'"*)
walther@59858
    38
fun string_of_thm thm = Rule.term_to_string' (ThyC.thy2ctxt' "Isac_Knowledge") (Thm.prop_of thm)
walther@59858
    39
fun string_of_thm' thy thm = Rule.term_to_string' (ThyC.thy2ctxt thy) (Thm.prop_of thm)
walther@59858
    40
fun string_of_thmI thm =
walther@59858
    41
  let 
walther@59858
    42
    val str = (de_quote o string_of_thm) thm
walther@59858
    43
    val (a, b) = split_nlast (5, Symbol.explode str)
walther@59858
    44
  in 
walther@59858
    45
    case b of
walther@59858
    46
      [" ", " ","[", ".", "]"] => implode a
walther@59858
    47
    | _ => str
walther@59858
    48
  end
walther@59858
    49
walther@59858
    50
(**)end(**)