1.1 --- a/src/Tools/isac/BaseDefinitions/Know_Store.thy Sun Apr 19 15:37:39 2020 +0200
1.2 +++ b/src/Tools/isac/BaseDefinitions/Know_Store.thy Sun Apr 19 15:51:31 2020 +0200
1.3 @@ -35,7 +35,6 @@
1.4 ML_file "celem-8.sml" (*thydata*)
1.5 ML_file "celem-91.sml" (*check_guhs_unique*)
1.6
1.7 -ML_file calcelems.sml
1.8 ML_file tracing.sml
1.9 ML \<open>
1.10 \<close> ML \<open>
1.11 @@ -62,15 +61,15 @@
1.12 val add_rlss: (Rule_Set.id * (ThyC.id * Rule_Set.T)) list -> theory -> theory
1.13 val get_calcs: theory -> (Exec_Def.prog_calcID * (Exec_Def.calID * Exec_Def.eval_fn)) list
1.14 val add_calcs: (Exec_Def.prog_calcID * (Exec_Def.calID * Exec_Def.eval_fn)) list -> theory -> theory
1.15 - val get_cas: theory -> Celem.cas_elem list
1.16 - val add_cas: Celem.cas_elem list -> theory -> theory
1.17 - val get_ptyps: theory -> Celem.ptyps
1.18 - val add_pbts: (Celem.pbt * Celem.pblID) list -> theory -> theory
1.19 - val get_mets: theory -> Celem.mets
1.20 - val add_mets: (Celem.met * Celem.metID) list -> theory -> theory
1.21 - val get_thes: theory -> (Celem.thydata Celem1.ptyp) list
1.22 - val add_thes: (Celem.thydata * Celem.theID) list -> theory -> theory (* thydata dropped at existing elems *)
1.23 - val insert_fillpats: (Celem.theID * Error_Fill_Def.fillpat list) list -> theory -> theory
1.24 + val get_cas: theory -> Celem7.cas_elem list
1.25 + val add_cas: Celem7.cas_elem list -> theory -> theory
1.26 + val get_ptyps: theory -> Celem5.ptyps
1.27 + val add_pbts: (Celem5.pbt * Celem3.pblID) list -> theory -> theory
1.28 + val get_mets: theory -> Celem6.mets
1.29 + val add_mets: (Celem6.met * Celem3.metID) list -> theory -> theory
1.30 + val get_thes: theory -> (Celem8.thydata Celem1.ptyp) list
1.31 + val add_thes: (Celem8.thydata * Celem8.theID) list -> theory -> theory (* thydata dropped at existing elems *)
1.32 + val insert_fillpats: (Celem8.theID * Error_Fill_Def.fillpat list) list -> theory -> theory
1.33 val get_ref_thy: unit -> theory
1.34 val set_ref_thy: theory -> unit
1.35 end;
1.36 @@ -98,17 +97,17 @@
1.37 fun add_calcs calcs = Data.map (union_overwrite Exec_Def.calc_eq calcs)
1.38
1.39 structure Data = Theory_Data (
1.40 - type T = (term * (Celem.spec * (term list -> (term * term list) list))) list;
1.41 + type T = (term * (Celem3.spec * (term list -> (term * term list) list))) list;
1.42 val empty = [];
1.43 val extend = I;
1.44 - val merge = merge Celem.cas_eq;
1.45 + val merge = merge Celem7.cas_eq;
1.46 );
1.47 fun get_cas thy = Data.get thy
1.48 - fun add_cas cas = Data.map (union_overwrite Celem.cas_eq cas)
1.49 + fun add_cas cas = Data.map (union_overwrite Celem7.cas_eq cas)
1.50
1.51 structure Data = Theory_Data (
1.52 - type T = Celem.ptyps;
1.53 - val empty = [Celem.e_Ptyp];
1.54 + type T = Celem5.ptyps;
1.55 + val empty = [Celem5.e_Ptyp];
1.56 val extend = I;
1.57 val merge = Celem1.merge_ptyps;
1.58 );
1.59 @@ -116,39 +115,39 @@
1.60 fun add_pbts pbts thy = let
1.61 fun add_pbt (pbt as {guh,...}, pblID) =
1.62 (* the pblID has the leaf-element as first; better readability achieved *)
1.63 - (if (!Celem.check_guhs_unique) then Celem.check_pblguh_unique guh (Data.get thy) else ();
1.64 + (if (!Celem91.check_guhs_unique) then Celem91.check_pblguh_unique guh (Data.get thy) else ();
1.65 rev pblID |> Celem1.insrt pblID pbt);
1.66 in Data.map (fold add_pbt pbts) thy end;
1.67
1.68 structure Data = Theory_Data (
1.69 - type T = Celem.mets;
1.70 - val empty = [Celem.e_Mets];
1.71 + type T = Celem6.mets;
1.72 + val empty = [Celem6.e_Mets];
1.73 val extend = I;
1.74 val merge = Celem1.merge_ptyps;
1.75 );
1.76 val get_mets = Data.get;
1.77 fun add_mets mets thy = let
1.78 fun add_met (met as {guh,...}, metID) =
1.79 - (if (!Celem.check_guhs_unique) then Celem.check_metguh_unique guh (Data.get thy) else ();
1.80 + (if (!Celem91.check_guhs_unique) then Celem91.check_metguh_unique guh (Data.get thy) else ();
1.81 Celem1.insrt metID met metID);
1.82 in Data.map (fold add_met mets) thy end;
1.83
1.84 structure Data = Theory_Data (
1.85 - type T = (Celem.thydata Celem1.ptyp) list;
1.86 + type T = (Celem8.thydata Celem1.ptyp) list;
1.87 val empty = [];
1.88 val extend = I;
1.89 val merge = Celem1.merge_ptyps; (* relevant for store_thm, store_rls *)
1.90 );
1.91 fun get_thes thy = Data.get thy
1.92 fun add_thes thes thy = let
1.93 - fun add_the (thydata, theID) = Celem.add_thydata ([], theID) thydata
1.94 + fun add_the (thydata, theID) = Celem8.add_thydata ([], theID) thydata
1.95 in Data.map (fold add_the thes) thy end;
1.96 fun insert_fillpats fis thy =
1.97 let
1.98 fun update_elem (theID, fillpats) =
1.99 let
1.100 val hthm = Celem1.get_py (Data.get thy) theID theID
1.101 - val hthm' = Celem.update_hthm hthm fillpats
1.102 + val hthm' = Celem8.update_hthm hthm fillpats
1.103 handle ERROR _ =>
1.104 error ("insert_fillpats: " ^ strs2str theID ^ "must address a theorem")
1.105 in Celem1.update_ptyps theID theID hthm' end
1.106 @@ -207,11 +206,11 @@
1.107 section \<open>determine sequence of main parts in thehier\<close>
1.108 setup \<open>
1.109 KEStore_Elems.add_thes
1.110 - [(Celem.Html {guh = Celem.part2guh ["IsacKnowledge"], html = "",
1.111 + [(Celem8.Html {guh = Celem8.part2guh ["IsacKnowledge"], html = "",
1.112 mathauthors = ["Isac team"], coursedesign = []}, ["IsacKnowledge"]),
1.113 - (Celem.Html {guh = Celem.part2guh ["Isabelle"], html = "",
1.114 + (Celem8.Html {guh = Celem8.part2guh ["Isabelle"], html = "",
1.115 mathauthors = ["Isabelle team, TU Munich"], coursedesign = []}, ["Isabelle"]),
1.116 - (Celem.Html {guh = Celem.part2guh ["IsacScripts"], html = "",
1.117 + (Celem8.Html {guh = Celem8.part2guh ["IsacScripts"], html = "",
1.118 mathauthors = ["Isac team"], coursedesign = []}, ["IsacScripts"])]
1.119 \<close>
1.120
1.121 @@ -231,31 +230,31 @@
1.122 fun check_kestore_calc ((id, (c, _)) : Rule_Def.calc) = "(" ^ id ^ ", (" ^ c ^ ", fn))";
1.123
1.124 (* we avoid term_to_string''' defined later *)
1.125 -fun check_kestore_cas ((t, (s, _)) : Celem.cas_elem) =
1.126 +fun check_kestore_cas ((t, (s, _)) : Celem7.cas_elem) =
1.127 "(" ^ (Print_Mode.setmp [] (Syntax.string_of_term (Config.put show_markup false
1.128 - (Proof_Context.init_global @{theory})))) t ^ ", " ^ Celem.spec2str s ^ ")";
1.129 + (Proof_Context.init_global @{theory})))) t ^ ", " ^ Celem3.spec2str s ^ ")";
1.130
1.131 fun count_kestore_ptyps [] = 0
1.132 | count_kestore_ptyps ((Celem1.Ptyp (_, _, ps)) :: ps') =
1.133 1 + count_kestore_ptyps ps + count_kestore_ptyps ps';
1.134 fun check_kestore_ptyp' strfun (Celem1.Ptyp (key, pbts, pts)) = "Ptyp (" ^ (quote key) ^ ", " ^
1.135 (strfun pbts) ^ ", " ^ (map (check_kestore_ptyp' strfun) pts |> list2str) ^ ")" |> linefeed;
1.136 -val check_kestore_ptyp = check_kestore_ptyp' Celem.pbts2str;
1.137 +val check_kestore_ptyp = check_kestore_ptyp' Celem5.pbts2str;
1.138 fun ptyp_ord ((Celem1.Ptyp (s1, _, _)), (Celem1.Ptyp (s2, _, _))) = string_ord (s1, s2);
1.139 -fun pbt_ord ({guh = guh'1, ...} : Celem.pbt, {guh = guh'2, ...} : Celem.pbt) = string_ord (guh'1, guh'2);
1.140 +fun pbt_ord ({guh = guh'1, ...} : Celem5.pbt, {guh = guh'2, ...} : Celem5.pbt) = string_ord (guh'1, guh'2);
1.141 fun sort_kestore_ptyp' _ [] = []
1.142 | sort_kestore_ptyp' ordfun ((Celem1.Ptyp (key, pbts, ps)) :: ps') =
1.143 ((Celem1.Ptyp (key, sort ordfun pbts, sort_kestore_ptyp' ordfun ps |> sort ptyp_ord))
1.144 :: sort_kestore_ptyp' ordfun ps');
1.145 val sort_kestore_ptyp = sort_kestore_ptyp' pbt_ord;
1.146
1.147 -fun metguh2str ({guh,...} : Celem.met) = guh : string;
1.148 -fun check_kestore_met (mp: Celem.met Celem1.ptyp) =
1.149 +fun metguh2str ({guh,...} : Celem6.met) = guh : string;
1.150 +fun check_kestore_met (mp: Celem6.met Celem1.ptyp) =
1.151 check_kestore_ptyp' (fn xs => map metguh2str xs |> strs2str) mp;
1.152 -fun met_ord ({guh = guh'1, ...} : Celem.met, {guh = guh'2, ...} : Celem.met) = string_ord (guh'1, guh'2);
1.153 +fun met_ord ({guh = guh'1, ...} : Celem6.met, {guh = guh'2, ...} : Celem6.met) = string_ord (guh'1, guh'2);
1.154 val sort_kestore_met = sort_kestore_ptyp' met_ord;
1.155
1.156 -fun check_kestore_thes thes = ((map writeln) o (map (check_kestore_ptyp' Celem.thes2str))) thes
1.157 +fun check_kestore_thes thes = ((map writeln) o (map (check_kestore_ptyp' Celem8.thes2str))) thes
1.158 fun write_thes thydata_list =
1.159 thydata_list
1.160 |> map (fn (id, the) => (Celem8.theID2str id, Celem8.the2str the))