Nominal/Perm.thy
changeset 2163 5dc48e1af733
parent 2144 e900526e95c4
child 2288 3b83960f9544
--- a/Nominal/Perm.thy	Tue May 18 14:40:05 2010 +0100
+++ b/Nominal/Perm.thy	Wed May 19 12:43:38 2010 +0100
@@ -7,20 +7,32 @@
 
 ML {*
 (* returns the type of the nth datatype *)
-fun nth_dtyp dt_descr sorts i = 
-  Datatype_Aux.typ_of_dtyp dt_descr sorts (Datatype_Aux.DtRec i);
+fun nth_dtyp descr sorts n = 
+  Datatype_Aux.typ_of_dtyp descr sorts (Datatype_Aux.DtRec n);
+
+(* returns the constructors of the nth datatype *)
+fun nth_dtyp_constrs descr n = 
+let
+  val (_, (_, _, constrs)) = nth descr n
+in
+  constrs
+end
+
+(* returns the types of the constructors of the nth datatype *)
+fun nth_dtyp_constr_typs descr sorts n = 
+  map (map (Datatype_Aux.typ_of_dtyp descr sorts) o snd) (nth_dtyp_constrs descr n)
 *}
 
 ML {*
 (* generates for every datatype a name str ^ dt_name 
    plus and index for multiple occurences of a string *)
-fun prefix_dt_names dt_descr sorts str = 
+fun prefix_dt_names descr sorts str = 
 let
   fun get_nth_name (i, _) = 
-    Datatype_Aux.name_of_typ (nth_dtyp dt_descr sorts i) 
+    Datatype_Aux.name_of_typ (nth_dtyp descr sorts i) 
 in
   Datatype_Prop.indexify_names 
-    (map (prefix str o get_nth_name) dt_descr)
+    (map (prefix str o get_nth_name) descr)
 end
 *}