src/ZF/Datatype.ML
changeset 802 2f2fbf0a7e4f
parent 733 5207fca25b6b
child 1461 6bcb44e4d6e5
--- a/src/ZF/Datatype.ML	Fri Dec 16 17:44:09 1994 +0100
+++ b/src/ZF/Datatype.ML	Fri Dec 16 17:46:02 1994 +0100
@@ -67,68 +67,3 @@
 end;
 
 
-(*For installing the theory section.   co is either "" or "Co"*)
-fun datatype_decl co =
-  let open ThyParse Ind_Syntax
-      (*generate strings*)
-      fun mk_const ((x, y), z) = mk_triple (x, mk_list y, z);
-      val mk_data = mk_list o map mk_const o snd
-      val mk_scons = mk_big_list o map mk_data
-      fun mk_intr_name s =  (*the "op" cancels any infix status*)
-	  if Syntax.is_identifier s then "op " ^ s ^ "_I" else "_"
-      fun mk_params ((((dom, rec_pairs), monos), type_intrs), type_elims) =
-        let val rec_names = map (scan_to_id o trim o fst) rec_pairs
-	    val big_rec_name = space_implode "_" rec_names
-	    and srec_tms = mk_list (map fst rec_pairs)
-            and scons    = mk_scons rec_pairs
-            and sdom_sum = 
-		if dom = ""  then co ^ "data_domain rec_tms" (*default*)
-		else "readtm (sign_of thy) iT " ^ dom
-            val stri_name = big_rec_name ^ "_Intrnl"
-            val con_names = flat (map (map (trim o #1 o #1) o snd) rec_pairs)
-        in
-	   (";\n\n\
-            \structure " ^ stri_name ^ " =\n\
-            \ let open Ind_Syntax in\n\
-            \  struct\n\
-            \  val _ = writeln \"" ^ co ^ 
-	               "Datatype definition " ^ big_rec_name ^ "\"\n\
-            \  val rec_tms\t= map (readtm (sign_of thy) iT) " ^ srec_tms ^ "\n\
-            \  val dom_sum\t= " ^ sdom_sum ^ "\n\
-            \  and con_ty_lists\t= read_constructs (sign_of thy)\n" 
-	           ^ scons ^ "\n\
-            \  val intr_tms\t= mk_all_intr_tms (rec_tms, con_ty_lists)\n\
-            \  end\n\
-            \ end;\n\n\
-            \val thy = thy |> " ^ co ^ "Ind.add_constructs_def(" ^ 
-	         mk_list (map quote rec_names) ^ ", " ^ 
-                 stri_name ^ ".con_ty_lists) \n\
-            \              |> " ^ co ^ "Ind.add_fp_def_i \n    (" ^ 
-	       stri_name ^ ".rec_tms, " ^
-               stri_name ^ ".dom_sum, " ^
-               stri_name ^ ".intr_tms)"
-           ,
-	    "structure " ^ big_rec_name ^ " =\n\
-            \  struct\n\
-            \  val _ = writeln \"Proofs for " ^ co ^ 
-	               "Datatype definition " ^ big_rec_name ^ "\"\n\
-            \  structure Result = " ^ co ^ "Data_section_Fun\n\
-            \  (open " ^ stri_name ^ "\n\
-            \   val thy\t\t= thy\n\
-            \   val big_rec_name\t= \"" ^ big_rec_name ^ "\"\n\
-            \   val monos\t\t= " ^ monos ^ "\n\
-            \   val type_intrs\t= " ^ type_intrs ^ "\n\
-            \   val type_elims\t= " ^ type_elims ^ ");\n\n\
-            \  val " ^ mk_list (map mk_intr_name con_names) ^ " = Result.intrs;\n\
-            \  open Result\n\
-            \  end\n"
-	   )
-	end
-      fun optstring s = optional (s $$-- string) "\"[]\"" >> trim
-      val string_list = "(" $$-- list1 string --$$ ")" || ThyParse.empty;
-      val construct = name -- string_list -- opt_mixfix;
-  in optional ("<=" $$-- string) "" --
-     enum1 "and" (string --$$ "=" -- enum1 "|" construct) --
-     optstring "monos" -- optstring "type_intrs" -- optstring "type_elims"
-     >> mk_params
-end;