export primitive netpairs;
authorwenzelm
Thu, 29 Nov 2001 01:51:38 +0100
changeset 12326 b4e706774e96
parent 12325 4966dae8fa62
child 12327 5a4d78204492
export primitive netpairs; activate attributes;
src/Pure/Isar/rule_context.ML
--- a/src/Pure/Isar/rule_context.ML	Thu Nov 29 01:51:06 2001 +0100
+++ b/src/Pure/Isar/rule_context.ML	Thu Nov 29 01:51:38 2001 +0100
@@ -9,6 +9,7 @@
 
 signature RULE_CONTEXT =
 sig
+  type netpair
   type T
   val print_global_rules: theory -> unit
   val print_local_rules: Proof.context -> unit
@@ -32,6 +33,8 @@
   val elim_query_local: int option -> Proof.context attribute
   val dest_query_local: int option -> Proof.context attribute
   val rule_del_local: Proof.context attribute
+  val netpairs: Proof.context -> netpair list
+  val orderlist: ((int * int) * 'a) list -> 'a list
   val setup: (theory -> theory) list
 end;
 
@@ -64,13 +67,13 @@
 
 (* netpairs *)
 
-type net = ((int * int) * (bool * thm)) Net.net;
-val empty_netpairs = replicate (length rule_indexes) (Net.empty: net, Net.empty: net);
+type netpair = ((int * int) * (bool * thm)) Net.net * ((int * int) * (bool * thm)) Net.net;
+val empty_netpairs: netpair list = replicate (length rule_indexes) (Net.empty, Net.empty);
 
 datatype T = Rules of
  {next: int,
   rules: (int * ((int * bool) * thm)) list,
-  netpairs: (net * net) list,
+  netpairs: netpair list,
   wrappers: ((bool * ((int -> tactic) -> int -> tactic)) * stamp) list};
 
 fun make_rules next rules netpairs wrappers =
@@ -207,11 +210,19 @@
 
 
 
+(** retrieving rules **)
+
+fun netpairs ctxt = let val Rules {netpairs, ...} = LocalRules.get ctxt in netpairs end;
+
+fun orderlist brls =
+  map snd (sort (prod_ord int_ord int_ord o pairself fst) brls);
+
+
+
 (** theory setup **)
 
 val setup =
- [GlobalRules.init, LocalRules.init
-  (*FIXME Attrib.add_attributes rule_atts*)];
+ [GlobalRules.init, LocalRules.init, Attrib.add_attributes rule_atts];
 
 
 end;