src/Tools/isac/BaseDefinitions/celem-91.sml
author Walther Neuper <walther.neuper@jku.at>
Sun, 19 Apr 2020 15:37:39 +0200
changeset 59888 2c2fdf9dd52d
parent 59886 106e7d8723ca
child 59890 ba0757da0dc8
permissions -rw-r--r--
run Know_Store with Celem1..91 via Celem in calcelements.sml
     1 (* Title:  BaseDefinitions/celem-91.sml
     2    Author: Walther Neuper
     3    (c) due to copyright terms
     4 
     5           *)
     6 signature CALCELEMENT_91 =
     7 (*/------- to Celem91 -------\*)
     8 (*\------- to Celem91 -------/*)
     9 sig
    10 (*/------- to Celem91 -------\*)
    11   val check_guhs_unique: bool Unsynchronized.ref
    12   val check_pblguh_unique: Celem2.guh -> Celem5.pbt Celem1.ptyp list -> unit
    13   val check_metguh_unique: Celem2.guh -> Celem6.met Celem1.ptyp list -> unit
    14   val coll_pblguhs: Celem5.pbt Celem1.ptyp list -> Celem2.guh list
    15   val coll_metguhs: Celem6.met Celem1.ptyp list -> Celem2.guh list
    16 (*\------- to Celem91 -------/*)
    17 (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
    18   (*NONE*)
    19 (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
    20   (*NONE*)
    21 ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
    22 end
    23 
    24 (**)
    25 structure Celem91(**): CALCELEMENT_91(**) =
    26 struct
    27 (**)
    28 
    29 (*/------- to Celem91 -------\*)
    30 (* switch for checking guhs unique before storing a pbl or met;
    31    set true at startup (done at begin of ROOT.ML)
    32    set false for editing IsacKnowledge (done at end of ROOT.ML) *)
    33 val check_guhs_unique = Unsynchronized.ref true;
    34 
    35 fun coll_pblguhs pbls =
    36   let
    37     fun node coll (Celem1.Ptyp (_, [n], ns)) = [(#guh : Celem5.pbt -> Celem2.guh) n] @ (nodes coll ns)
    38       | node _ _ = raise ERROR "coll_pblguhs - node"
    39 	  and nodes coll [] = coll
    40       | nodes coll (n :: ns) = (node coll n) @ (nodes coll ns);
    41   in nodes [] pbls end;
    42 fun check_pblguh_unique guh pbls =
    43   if member op = (coll_pblguhs pbls) guh
    44   then error ("check_guh_unique failed with \""^ guh ^"\";\n"^
    45 	      "use \"sort_pblguhs()\" for a list of guhs;\n"^
    46 	      "consider setting \"check_guhs_unique := false\"")
    47   else ();
    48 fun coll_metguhs mets =
    49   let
    50     fun node coll (Celem1.Ptyp (_, [n], ns)) = [(#guh : Celem6.met -> Celem2.guh) n] @ (nodes coll ns)
    51       | node _ _ = raise ERROR "coll_pblguhs - node"
    52   	and nodes coll [] = coll
    53   	  | nodes coll (n :: ns) = (node coll n) @ (nodes coll ns);
    54     in nodes [] mets end;
    55 fun check_metguh_unique (guh: Celem2.guh) (mets: (Celem6.met Celem1.ptyp) list) =
    56     if member op = (coll_metguhs mets) guh
    57     then raise ERROR ("check_guh_unique failed with \"" ^ guh ^"\";\n"^
    58 		(*"use \"sort_metguhs()\" for a list of guhs;\n" ^        ...evaluates to [] ?!?*)
    59 		  "consider setting \"check_guhs_unique := false\"")
    60     else ();
    61 (*\------- to Celem91 -------/*)
    62 
    63 (**)end(**)