test/Tools/isac/ADDTESTS/accumulate-val/lucas_interpreter.sml
author Walther Neuper <walther.neuper@jku.at>
Wed, 08 Apr 2020 13:21:19 +0200
changeset 59853 e18f30c44998
parent 59852 ea7e6679080e
child 59854 c20d08e01ad2
permissions -rw-r--r--
separate struct Exec_Def
neuper@52115
     1
(* KEStore holds Knowledge and Exercises in Isac's Java front-end.
neuper@52115
     2
  In the front-end knowledge comprises theories, problems and methods.
neuper@52115
     3
  Elements of problems and methods are defined in theories alongside
neuper@52115
     4
  the development of respective language elements. 
neuper@52115
     5
  The structure of methods and problems is independent from theories' deductive
neuper@52115
     6
  structure. The respective structures are built in Build_Thydata.thy.
neuper@52115
     7
*)
neuper@52115
     8
signature KESTORE_ELEMS =
neuper@48809
     9
sig
walther@59852
    10
  val get_rlss: theory -> (Rule_Set.identifier * (Rule.theory' * Rule_Set.T)) list
walther@59852
    11
  val add_rlss: (Rule_Set.identifier * (Rule.theory' * Rule_Set.T)) list -> theory -> theory
walther@59853
    12
  val get_calcs: theory -> (Exec_Def.prog_calcID * (Rule.calID * Rule.eval_fn)) list
walther@59853
    13
  val add_calcs: (Exec_Def.prog_calcID * (Rule.calID * Rule.eval_fn)) list -> theory -> theory
neuper@52118
    14
  (*etc*)
neuper@52115
    15
end;                               
neuper@48809
    16
s1210629013@55359
    17
structure Test_KEStore_Elems: KESTORE_ELEMS =
neuper@48809
    18
struct
neuper@52139
    19
  fun union_overwrite eq l1 l2 = fold (insert eq) l2 (*..swapped..*) l1;
neuper@48809
    20
neuper@52126
    21
  fun rls_eq ((id1, (thyID1, _)), (id2, (thyID2, _))) = id1 = id2 (*andalso thyID1 = thyID2*)
neuper@52115
    22
  structure Data = Theory_Data (
walther@59852
    23
    type T = (Rule_Set.identifier * (Rule.theory' * Rule_Set.T)) list;
neuper@52115
    24
    val empty = [];
neuper@52115
    25
    val extend = I;
neuper@52115
    26
    val merge = merge rls_eq;
neuper@52118
    27
    );  
neuper@52115
    28
  fun get_rlss thy = Data.get thy
neuper@52139
    29
  fun add_rlss rlss = Data.map (union_overwrite rls_eq rlss)
neuper@48809
    30
neuper@52118
    31
  val calc_eq = rls_eq
neuper@52118
    32
  structure Data = Theory_Data (
walther@59853
    33
    type T = (Exec_Def.prog_calcID * (Rule.calID * Rule.eval_fn)) list;
neuper@52118
    34
    val empty = [];
neuper@52118
    35
    val extend = I;
neuper@52118
    36
    val merge = merge calc_eq;
neuper@52118
    37
    );                                                              
neuper@52118
    38
  fun get_calcs thy = Data.get thy
neuper@52139
    39
  fun add_calcs calcs = Data.map (union_overwrite calc_eq calcs)
neuper@52118
    40
neuper@52118
    41
  (*etc*)
neuper@48809
    42
end;