src/Tools/isac/BaseDefinitions/rewrite-order.sml
author Walther Neuper <walther.neuper@jku.at>
Sun, 19 Apr 2020 11:07:02 +0200
changeset 59886 106e7d8723ca
parent 59885 59c5dd27d589
child 60223 740ebee5948b
permissions -rw-r--r--
switch "activate for Test_Isac .." back to Build_Isac
     1 (* Title:  BaseDefinitions/rewrite-order.sml
     2    Author: Walther Neuper
     3    (c) due to copyright terms
     4 
     5 TODO: use "Rewrite_Ord" for renaming identifiers.
     6 *)
     7 signature REWRITE_ORDER =
     8 sig
     9   type subst
    10   val e_rew_ord': Rule_Def.rew_ord';
    11   val dummy_ord: Rule_Def.rew_ord_
    12   val e_rew_ord: Rule_Def.rew_ord_
    13 
    14   type rew_ord = Rule_Def.rew_ord
    15   val e_rew_ordX: rew_ord
    16 
    17   type rew_ord' = Rule_Def.rew_ord'
    18   val rew_ord': (rew_ord' * (subst -> term * term -> bool)) list Unsynchronized.ref
    19   val assoc_rew_ord: string -> subst -> term * term -> bool
    20 (* ---- for tests only: shifted from below to remove the Warning "unused" at fun.def. --------- *)
    21   (*NONE*)
    22 (*/-------------------------------------------------------- ! aktivate for Test_Isac BEGIN ---\* )
    23   (*NONE*)
    24 ( *\--- ! aktivate for Test_Isac END ----------------------------------------------------------/*)
    25 end
    26 
    27 (**)
    28 structure Rewrite_Ord(**): REWRITE_ORDER(**) =
    29 struct
    30 (**)
    31 
    32 val e_rew_ord' = "e_rew_ord" : Rule_Def.rew_ord';
    33 type rew_ord_ = Rule_Def.rew_ord_;
    34 type subst = (term * term) list;
    35 fun dummy_ord (_: subst) (_: term, _: term) = true;
    36 val e_rew_ord_ = dummy_ord;
    37 
    38 type rew_ord = (*rew_ord' * rew_ord_;*) Rule_Def.rew_ord
    39 val e_rew_ord = dummy_ord; (* TODO.WN071231 clarify identifiers..e_rew_ordX*)
    40 val e_rew_ordX = (e_rew_ord', e_rew_ord_)
    41 
    42 type rew_ord' = Rule_Def.rew_ord'
    43 (* rewrite orders, also stored in 'type met' and type 'and rls'
    44   The association list is required for 'rewrite.."rew_ord"..' *)
    45 val rew_ord' = Unsynchronized.ref
    46   ([("e_rew_ord", e_rew_ord), ("dummy_ord", dummy_ord)]
    47 	: (rew_ord' *    (* the key for the association list         *)
    48 	    (subst 	    (* the bound variables - they get high order*)
    49 	     -> (term * term) (* (t1, t2) to be compared                  *)
    50 	     -> bool))        (* if t1 <= t2 then true else false         *)
    51 		list);              (* association list                         *)
    52 fun assoc' ([], key) = raise ERROR ("ME_Isa: \"" ^ key ^ "\" not known")
    53   | assoc' ((keyi, xi) :: pairs, key) =
    54     if key = keyi then SOME xi else assoc' (pairs, key);
    55 fun assoc_rew_ord ro = ((the o assoc') (! rew_ord',ro))
    56   handle _ => raise ERROR ("ME_Isa: rew_ord '" ^ ro ^ "' not in system");
    57 
    58 end