src/Tools/isac/BaseDefinitions/celem-0.sml
author Walther Neuper <walther.neuper@jku.at>
Fri, 17 Apr 2020 15:12:19 +0200
changeset 59882 f3782753c805
child 59884 3063a52db028
permissions -rw-r--r--
prep. take apart struct.Celem
     1 (* Title:  BaseDefinitions/celem-0.sml
     2    Author: Walther Neuper
     3    (c) due to copyright terms
     4 
     5           *)
     6 signature CALCELEMENT_0 =
     7 (*/------- to Celem0 -------\*)
     8 (*\------- to Celem0 -------/*)
     9 sig
    10 (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
    11   (*NONE*)
    12 (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
    13   (*NONE*)
    14 ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
    15 end
    16 
    17 (**)
    18 structure Celem0(**): CALCELEMENT_0(**) =
    19 struct
    20 (**)
    21 (*
    22 val get_cas: theory -> Celem.cas_elem list
    23   val add_cas: Celem.cas_elem list -> theory -> theory
    24   val get_ptyps: theory -> Celem.ptyps
    25   val add_pbts: (Celem.pbt * Celem.pblID) list -> theory -> theory
    26   val get_mets: theory -> Celem.mets
    27   val add_mets: (Celem.met * Celem.metID) list -> theory -> theory
    28   val get_thes: theory -> (Celem.thydata Celem.ptyp) list
    29   val add_thes: (Celem.thydata * Celem.theID) list -> theory -> theory (* thydata dropped at existing elems *)
    30   val insert_fillpats: (Celem.theID * Error_Fill_Def.fillpat list) list -> theory -> theory 
    31     type T = (term * (Celem.spec * (term list -> (term * term list) list))) list;
    32     val merge = merge Celem.cas_eq;
    33   fun add_cas cas = Data.map (union_overwrite Celem.cas_eq cas)
    34     type T = Celem.ptyps;
    35     val empty = [Celem.e_Ptyp];
    36     val merge = Celem.merge_ptyps;
    37                 (if (!Celem.check_guhs_unique) then Celem.check_pblguh_unique guh (Data.get thy) else ();
    38                   rev pblID |> Celem.insrt pblID pbt);
    39     type T = Celem.mets;
    40     val empty = [Celem.e_Mets];
    41     val merge = Celem.merge_ptyps;
    42                 (if (!Celem.check_guhs_unique) then Celem.check_metguh_unique guh (Data.get thy) else ();
    43                   Celem.insrt metID met metID);
    44     type T = (Celem.thydata Celem.ptyp) list;
    45     val merge = Celem.merge_ptyps; (* relevant for store_thm, store_rls *)
    46     fun add_the (thydata, theID) = Celem.add_thydata ([], theID) thydata
    47           val hthm = Celem.get_py (Data.get thy) theID theID
    48           val hthm' = Celem.update_hthm hthm fillpats
    49         in Celem.update_ptyps theID theID hthm' end
    50   [(Celem.Html {guh = Celem.part2guh ["IsacKnowledge"], html = "",
    51   (Celem.Html {guh = Celem.part2guh ["Isabelle"], html = "",
    52   (Celem.Html {guh = Celem.part2guh ["IsacScripts"], html = "",
    53 fun check_kestore_cas ((t, (s, _)) : Celem.cas_elem) =
    54   (Proof_Context.init_global @{theory})))) t ^ ", " ^ Celem.spec2str s ^ ")";
    55   | count_kestore_ptyps ((Celem.Ptyp (_, _, ps)) :: ps') =
    56 fun check_kestore_ptyp' strfun (Celem.Ptyp (key, pbts, pts)) = "Ptyp (" ^ (quote key) ^ ", " ^
    57       (strfun pbts) ^ ", " ^ (map (check_kestore_ptyp' strfun) pts |> list2str) ^ ")" |> Celem.linefeed;
    58 val check_kestore_ptyp = check_kestore_ptyp' Celem.pbts2str;
    59 fun ptyp_ord ((Celem.Ptyp (s1, _, _)), (Celem.Ptyp (s2, _, _))) = string_ord (s1, s2);
    60 fun pbt_ord ({guh = guh'1, ...} : Celem.pbt, {guh = guh'2, ...} : Celem.pbt) = string_ord (guh'1, guh'2);
    61   | sort_kestore_ptyp' ordfun ((Celem.Ptyp (key, pbts, ps)) :: ps') =
    62      ((Celem.Ptyp (key, sort ordfun pbts, sort_kestore_ptyp' ordfun ps |> sort ptyp_ord))
    63 fun metguh2str ({guh,...} : Celem.met) = guh : string;
    64 fun check_kestore_met (mp: Celem.met Celem.ptyp) =
    65 fun met_ord ({guh = guh'1, ...} : Celem.met, {guh = guh'2, ...} : Celem.met) = string_ord (guh'1, guh'2);
    66 fun check_kestore_thes thes = ((map writeln) o (map (check_kestore_ptyp' Celem.thes2str))) thes
    67     |> map (fn (id, the) => (Celem.theID2str id, Celem.the2str the))
    68 *)
    69 (*/------- to Celem0 -------\*)
    70 (*\------- to Celem0 -------/*)
    71 
    72 (**)end(**)