test/Tools/isac/ADDTESTS/accumulate-val/lucas_interpreter.sml
author Mathias Lehnfeld <s1210629013@students.fh-hagenberg.at>
Mon, 27 Jan 2014 21:49:27 +0100
changeset 55359 73dc85c025ab
parent 52139 511fc271f783
child 59410 2cbb98890190
permissions -rw-r--r--
cleanup, naming: 'KEStore_Elems' in Tests now 'Test_KEStore_Elems', 'store_pbts' now 'add_pbts'
     1 (* KEStore holds Knowledge and Exercises in Isac's Java front-end.
     2   In the front-end knowledge comprises theories, problems and methods.
     3   Elements of problems and methods are defined in theories alongside
     4   the development of respective language elements. 
     5   The structure of methods and problems is independent from theories' deductive
     6   structure. The respective structures are built in Build_Thydata.thy.
     7 *)
     8 signature KESTORE_ELEMS =
     9 sig
    10   val get_rlss: theory -> (rls' * (theory' * rls)) list
    11   val add_rlss: (rls' * (theory' * rls)) list -> theory -> theory
    12   val get_calcs: theory -> (prog_calcID * (calID * eval_fn)) list
    13   val add_calcs: (prog_calcID * (calID * eval_fn)) list -> theory -> theory
    14   (*etc*)
    15 end;                               
    16 
    17 structure Test_KEStore_Elems: KESTORE_ELEMS =
    18 struct
    19   fun union_overwrite eq l1 l2 = fold (insert eq) l2 (*..swapped..*) l1;
    20 
    21   fun rls_eq ((id1, (thyID1, _)), (id2, (thyID2, _))) = id1 = id2 (*andalso thyID1 = thyID2*)
    22   structure Data = Theory_Data (
    23     type T = (rls' * (theory' * rls)) list;
    24     val empty = [];
    25     val extend = I;
    26     val merge = merge rls_eq;
    27     );  
    28   fun get_rlss thy = Data.get thy
    29   fun add_rlss rlss = Data.map (union_overwrite rls_eq rlss)
    30 
    31   val calc_eq = rls_eq
    32   structure Data = Theory_Data (
    33     type T = (prog_calcID * (calID * eval_fn)) list;
    34     val empty = [];
    35     val extend = I;
    36     val merge = merge calc_eq;
    37     );                                                              
    38   fun get_calcs thy = Data.get thy
    39   fun add_calcs calcs = Data.map (union_overwrite calc_eq calcs)
    40 
    41   (*etc*)
    42 end;