src/HOLCF/domain/extender.ML
author oheimb
Thu, 30 Oct 1997 14:19:01 +0100
changeset 4043 35766855f344
parent 4030 ca44afcc259c
child 4122 f63c283cefaf
permissions -rw-r--r--
domain package: * theorems are stored in the theory * creates hierachical name space * minor changes to some names and values (for consistency), e.g. cases -> casedist, dists_eq -> dist_eqs, [take_lemma] -> take_lemmas * separator between mutual domain definitions changed from "," to "and" * minor debugging of Domain_Library.mk_var_names
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
     1
(*  Title:      HOLCF/domain/extender.ML
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
     2
    ID:         $Id$
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
     3
    Author : David von Oheimb
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
     4
    Copyright 1995, 1996 TU Muenchen
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
     5
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
     6
theory extender for domain section
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
     7
*)
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
     8
2446
c2a9bf6c0948 The previous log message was wrong. The correct one is:
oheimb
parents: 2445
diff changeset
     9
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    10
structure Domain_Extender =
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    11
struct
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    12
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    13
local
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    14
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    15
open Domain_Library;
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    16
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    17
(* ----- general testing and preprocessing of constructor list -------------- *)
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    18
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    19
  fun check_and_sort_domain (dtnvs: (string * typ list) list, cons'' :
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    20
     ((string * ThyOps.cmixfix * (bool*string*typ) list) list) list) sg =
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    21
  let
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    22
    val defaultS = Type.defaultS (tsig_of sg);
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    23
    val test_dupl_typs = (case duplicates (map fst dtnvs) of 
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    24
	[] => false | dups => error ("Duplicate types: " ^ commas_quote dups));
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    25
    val test_dupl_cons = (case duplicates (map first (flat cons'')) of 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    26
	[] => false | dups => error ("Duplicate constructors: " 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    27
							 ^ commas_quote dups));
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    28
    val test_dupl_sels = (case duplicates 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    29
			       (map second (flat (map third (flat cons'')))) of
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    30
        [] => false | dups => error("Duplicate selectors: "^commas_quote dups));
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    31
    val test_dupl_tvars = exists(fn s=>case duplicates(map(fst o rep_TFree)s)of
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    32
	[] => false | dups => error("Duplicate type arguments: " 
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    33
		   ^commas_quote dups)) (map snd dtnvs);
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    34
    (* test for free type variables, illegal sort constraints on rhs,
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    35
	       non-pcpo-types and invalid use of recursive type;
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    36
       replace sorts in type variables on rhs *)
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    37
    fun analyse_equation ((dname,typevars),cons') = 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    38
      let
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    39
	val tvars = map rep_TFree typevars;
4030
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
    40
	fun distinct_name s = "'"^Sign.base_name dname^"_"^s;
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
    41
	val distinct_typevars = map (fn (n,sort) => 
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
    42
				     TFree (distinct_name n,sort)) tvars;
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    43
	fun rm_sorts (TFree(s,_)) = TFree(s,[])
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    44
	|   rm_sorts (Type(s,ts)) = Type(s,remove_sorts ts)
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    45
	|   rm_sorts (TVar(s,_))  = TVar(s,[])
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    46
	and remove_sorts l = map rm_sorts l;
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    47
	fun analyse(TFree(v,s)) = (case assoc_string(tvars,v) of 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    48
		    None      => error ("Free type variable " ^ v ^ " on rhs.")
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    49
	          | Some sort => if eq_set_string (s,defaultS) orelse
4030
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
    50
				    eq_set_string (s,sort    )
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
    51
				 then TFree(distinct_name v,sort)
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    52
				 else error ("Additional constraint on rhs "^
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    53
					     "for type variable "^quote v))
4030
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
    54
        |    analyse(Type(s,typl)) = if s <> dname 
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
    55
			then Type(s,map analyse typl)
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
    56
			else if remove_sorts typevars = remove_sorts typl 
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    57
				then Type(s,map analyse typl) 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    58
				else error ("Recursion of type " ^ s ^ 
4030
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
    59
					    " with different arguments")
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    60
        | analyse(TVar _) = Imposs "extender:analyse";
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    61
	fun check_pcpo t = (pcpo_type sg t orelse 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    62
			   error("Not a pcpo type: "^string_of_typ sg t); t);
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    63
	val analyse_con = upd_third (map (upd_third (check_pcpo o analyse)));
4030
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
    64
      in ((dname,distinct_typevars), map analyse_con cons') end; 
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    65
  in ListPair.map analyse_equation (dtnvs,cons'')
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    66
  end; (* let *)
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    67
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    68
  fun check_gen_by sg' (typs': string list,cnstrss': string list list) = let
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    69
    val test_dupl_typs = (case duplicates typs' of [] => false
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    70
	  | dups => error ("Duplicate types: " ^ commas_quote dups));
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    71
    val test_dupl_cnstrs = map (fn cs => (case duplicates cs of [] => false 
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    72
	| ds => error ("Duplicate constructors: " ^ commas_quote ds))) cnstrss';
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    73
    val tycons = map fst (#tycons(Type.rep_tsig (tsig_of sg')));
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    74
    val test_types = forall (fn t => t mem tycons orelse 
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    75
				     error("Unknown type: "^t)) typs';
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    76
    val cnstrss = let
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    77
	fun type_of c = case (Sign.const_type sg' c) of Some t => t
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    78
				| None => error ("Unknown constructor: "^c);
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    79
	fun args_result_type (t as (Type(tn,[arg,rest]))) = 
4043
35766855f344 domain package:
oheimb
parents: 4030
diff changeset
    80
		if tn = cfun_arrow orelse tn = "=>"
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    81
		then let val (ts,r) = args_result_type rest in (arg::ts,r) end
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    82
		else ([],t)
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    83
	|   args_result_type t = ([],t);
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    84
    in map (map (fn cn => let val (args,res) = args_result_type (type_of cn) in
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    85
	                 (cn,mk_var_names args,(args,res)) end)) cnstrss' 
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    86
	: (string * 			(* operator name of constr *)
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    87
	   string list *		(* argument name list *)
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    88
	   (typ list *			(* argument types *)
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    89
	    typ))			(* result type *)
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    90
	  list list end;
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    91
    fun test_equal_type tn (cn,_,(_,rt)) = fst (rep_Type rt) = tn orelse
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    92
		      error("Inappropriate result type for constructor "^cn);
4030
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
    93
    val typs = ListPair.map (fn (tn, cnstrs) =>(map (test_equal_type tn) cnstrs;
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    94
				snd(third(hd(cnstrs)))))  (typs',cnstrss);
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    95
    val test_typs = ListPair.map (fn (typ,cnstrs) => 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    96
			if not (pcpo_type sg' typ)
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
    97
			then error("Not a pcpo type: "^string_of_typ sg' typ)
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    98
			else map (fn (cn,_,(_,rt)) => rt=typ orelse error(
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
    99
				"Non-identical result types for constructors "^
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 1637
diff changeset
   100
			        first(hd cnstrs)^" and "^ cn ))  cnstrs)
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   101
		    (typs,cnstrss);
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   102
    val proper_args = let
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   103
	fun occurs tn (Type(tn',ts)) = (tn'=tn) orelse exists (occurs tn) ts
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   104
	|   occurs _  _              = false;
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   105
	fun proper_arg cn atyp = forall (fn typ => let 
4030
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
   106
				  val tn = fst (rep_Type typ) 
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
   107
				  in atyp=typ orelse not (occurs tn atyp) orelse
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
   108
				     error("Illegal use of type "^ tn ^
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
   109
				   " as argument of constructor " ^cn)end )typs;
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   110
	fun proper_curry (cn,_,(args,_)) = forall (proper_arg cn) args;
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   111
    in map (map proper_curry) cnstrss end;
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   112
  in (typs, flat cnstrss) end;
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   113
4030
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
   114
(* ----- calls for building new thy and thms -------------------------------- *)
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   115
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   116
in
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   117
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   118
  fun add_domain (comp_dnam,eqs''') thy''' = let
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   119
    val sg''' = sign_of thy''';
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   120
    val dtnvs = map ((fn (dname,vs) => 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   121
			 (Sign.full_name sg''' dname,map (str2typ sg''') vs))
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   122
                   o fst) eqs''';
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   123
    val cons''' = map snd eqs''';
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   124
    fun thy_type  (dname,tvars)  = (Sign.base_name dname, length tvars, NoSyn);
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   125
    fun thy_arity (dname,tvars)  = (dname, map (snd o rep_TFree) tvars, pcpoS);
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   126
    val thy'' = thy''' |> Theory.add_types     (map thy_type  dtnvs)
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   127
		       |> Theory.add_arities_i (map thy_arity dtnvs);
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   128
    val sg'' = sign_of thy'';
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   129
    val cons''=map (map (upd_third (map (upd_third (str2typ sg''))))) cons''';
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   130
    val eqs' = check_and_sort_domain (dtnvs,cons'') sg'';
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   131
    val thy' = thy'' |> Domain_Syntax.add_syntax (comp_dnam,eqs');
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   132
    val dts  = map (Type o fst) eqs';
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   133
    fun cons cons' = (map (fn (con,syn,args) =>
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   134
	((ThyOps.const_name con syn),
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   135
	 ListPair.map (fn ((lazy,sel,tp),vn) => ((lazy,
4030
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
   136
					find (tp,dts) handle LIST "find" => ~1),
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   137
					sel,vn))
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   138
	     (args,(mk_var_names(map third args)))
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   139
	 )) cons') : cons list;
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   140
    val eqs = map (fn (dtnvs,cons') => (dtnvs,cons cons')) eqs' : eq list;
4030
ca44afcc259c debugging concerning sort variables
oheimb
parents: 4008
diff changeset
   141
    val thy       = thy' |> Domain_Axioms.add_axioms (comp_dnam,eqs);
4043
35766855f344 domain package:
oheimb
parents: 4030
diff changeset
   142
  in (foldl (fn (thy0,eq) => Domain_Theorems.theorems (eq,eqs) thy0) (thy,eqs)) 
35766855f344 domain package:
oheimb
parents: 4030
diff changeset
   143
                          |> Domain_Theorems.comp_theorems (comp_dnam, eqs) end;
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   144
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   145
  fun add_gen_by ((tname,finite),(typs',cnstrss')) thy' = let
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 2446
diff changeset
   146
   val (typs,cnstrs) = check_gen_by (sign_of thy') (typs',cnstrss');
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   147
  in
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   148
   Domain_Axioms.add_induct ((tname,finite),(typs,cnstrs)) thy' end;
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   149
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   150
end (* local *)
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   151
end (* struct *)