test/Tools/isac/ADDTESTS/accumulate-val/lucas_interpreter.sml
author Walther Neuper <neuper@ist.tugraz.at>
Sun, 29 Sep 2013 18:27:37 +0200
changeset 52139 511fc271f783
parent 52126 47995aefb1c9
child 55359 73dc85c025ab
permissions -rw-r--r--
collected updates since changeset 9690a8d5f1c
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
neuper@52115
    10
  val get_rlss: theory -> (rls' * (theory' * rls)) list
neuper@52115
    11
  val add_rlss: (rls' * (theory' * rls)) list -> theory -> theory
neuper@52118
    12
  val get_calcs: theory -> (prog_calcID * (calID * eval_fn)) list
neuper@52118
    13
  val add_calcs: (prog_calcID * (calID * eval_fn)) list -> theory -> theory
neuper@52118
    14
  (*etc*)
neuper@52115
    15
end;                               
neuper@48809
    16
neuper@52115
    17
structure 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 (
neuper@52115
    23
    type T = (rls' * (theory' * rls)) 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 (
neuper@52118
    33
    type T = (prog_calcID * (calID * 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;