src/HOLCF/domain/interface.ML
author oheimb
Mon, 27 Oct 1997 11:34:33 +0100
changeset 4008 2444085532c6
parent 3622 85898be702b2
child 4030 ca44afcc259c
permissions -rw-r--r--
adapted domain and ax_ops package for name spaces
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: 2267
diff changeset
     1
(*  Title:      HOLCF/domain/interface.ML
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 2267
diff changeset
     2
    ID:         $Id$
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 2267
diff changeset
     3
    Author : David von Oheimb
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 2267
diff changeset
     4
    Copyright 1995, 1996 TU Muenchen
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 2267
diff changeset
     5
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 2267
diff changeset
     6
parser for domain section
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
     7
*)
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
     8
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
     9
local 
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    10
  open ThyParse;
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    11
  open Domain_Library;
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    12
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    13
(* --- generation of bindings for axioms and theorems in trailer of .thy.ML - *)
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    14
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    15
  fun gt_ax         name   = "get_axiom thy " ^ quote name;
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    16
  fun gen_val dname name   = "val "^name^" = "^ gt_ax (dname^"_"^name)^";";
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    17
  fun gen_vall      name l = "val "^name^" = "^ mk_list l^";";
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    18
  val rews1 = "iso_rews @ when_rews @\n\
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    19
 	      \con_rews @ sel_rews @ dis_rews @ dists_le @ dists_eq @\n\
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    20
	      \copy_rews";
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    21
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    22
  fun gen_domain eqname num ((dname,_), cons') = let
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    23
    val axioms1 = ["abs_iso", "rep_iso", "when_def"];
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    24
		   (* con_defs , sel_defs, dis_defs *) 
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    25
    val axioms2 = ["copy_def"];
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    26
    val theorems = 
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    27
	"iso_rews, exhaust, cases, when_rews, con_rews, sel_rews, dis_rews,\n    \
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    28
	\dists_le, dists_eq, inverts, injects, copy_rews";
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    29
    in
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    30
      "structure "^dname^" = struct\n"^
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    31
      cat_lines(map (gen_val dname) axioms1)^"\n"^
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    32
      gen_vall"con_defs"(map(fn (con,_,_) => gt_ax(strip_esc con^"_def")) cons')^"\n"^
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    33
      gen_vall"sel_defs"(flat(map (fn (_,_,args) => map (fn (_,sel,_) => 
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    34
					     gt_ax(sel^"_def")) args)    cons'))^"\n"^
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    35
      gen_vall"dis_defs"(map(fn (con,_,_) => gt_ax(dis_name_ con^"_def")) 
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    36
								          cons')^"\n"^
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    37
      cat_lines(map (gen_val dname) axioms2)^"\n"^
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    38
      "val ("^ theorems ^") =\n\
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    39
      \Domain_Theorems.theorems thy "^eqname^";\n" ^
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    40
      (if num > 1 then "val rews = " ^rews1 ^";\n" else "")
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    41
    end;
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    42
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    43
  fun mk_domain eqs'' = let
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    44
    val num    = length eqs'';
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    45
    val dtnvs  = map fst eqs'';
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    46
    val dnames = map fst dtnvs;
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    47
    val comp_dname = implode (separate "_" dnames);
2267
b2326aefecbc Replaced map...~~ by ListPair.map
paulson
parents: 2240
diff changeset
    48
    val conss' = ListPair.map 
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    49
	(fn (dname,cons'') => let fun sel n m = upd_second 
2267
b2326aefecbc Replaced map...~~ by ListPair.map
paulson
parents: 2240
diff changeset
    50
			      (fn None   => dname^"_sel_"^(string_of_int n)^
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    51
						      "_"^(string_of_int m)
2267
b2326aefecbc Replaced map...~~ by ListPair.map
paulson
parents: 2240
diff changeset
    52
				| Some s => s)
b2326aefecbc Replaced map...~~ by ListPair.map
paulson
parents: 2240
diff changeset
    53
	      fun fill_sels n con = upd_third (mapn (sel n) 1) con;
b2326aefecbc Replaced map...~~ by ListPair.map
paulson
parents: 2240
diff changeset
    54
	  in mapn fill_sels 1 cons'' end)
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    55
	(dnames, map snd eqs'');
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    56
    val eqs' = dtnvs~~conss';
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    57
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    58
(* ----- string for calling add_domain -------------------------------------- *)
1284
e5b95ee2616b removed incompatibility with sml
regensbu
parents: 1274
diff changeset
    59
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    60
    val thy_ext_string = let
2240
a8c074224e11 Replaced obsolete "makestring" by Bool.toString
paulson
parents: 1637
diff changeset
    61
      fun mk_conslist cons' = 
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    62
	  mk_list (map (fn (c,syn,ts)=>
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    63
		    mk_triple(quote c, syn, mk_list (map (fn (b,s ,tp) =>
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    64
		    mk_triple(Bool.toString b, quote s, tp)) ts))) cons');
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    65
    in "val (thy, "^comp_dname^"_equations) = thy |> Domain_Extender.add_domain \n"
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    66
       ^ mk_pair(quote comp_dname, mk_list(map (fn ((n,vs),cs) => 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    67
				   mk_pair (mk_pair (quote n, mk_list vs), 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    68
					    mk_conslist cs)) eqs'))
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    69
       ^ ";\nval thy = thy"
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    70
    end;
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    71
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
    72
(* ----- string for calling (comp_)theorems and producing the structures ---- *)
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    73
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    74
    val val_gen_string =  let
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    75
      fun plural s = if num > 1 then s^"s" else "["^s^"]";
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    76
      val comp_axioms   = [(* copy, *) "reach", "take_def", "finite_def"
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    77
			   (*, "bisim_def" *)];
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    78
      val comp_theorems = "take_rews, " ^ implode (separate ", " (map plural
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    79
			       ["take_lemma","finite"]))^", finite_ind, ind, coind";
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    80
      fun eqname n = "(hd(funpow "^string_of_int n^" tl "^comp_dname^"_equations), "
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    81
							 ^comp_dname^"_equations)";
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    82
      fun collect sep name = if num = 1 then name else
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    83
			     implode (separate sep (map (fn s => s^"."^name) dnames));
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    84
    in
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    85
      implode (separate "end; (* struct *)\n\n" 
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    86
        	 (mapn (fn n => gen_domain (eqname n) num) 0 eqs'))^(if num > 1 then
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    87
      "end; (* struct *)\n\n\
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    88
      \structure "^comp_dname^" = struct\n" else "") ^
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    89
	(if num > 1 then gen_val comp_dname "copy_def" ^"\n" else "") ^
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    90
	implode ((map (fn s => gen_vall (plural s)
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    91
	           (map (fn dn => gt_ax(dn ^ "_" ^ s)) dnames) ^"\n") comp_axioms)) ^
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    92
	 gen_val comp_dname "bisim_def" ^"\n\
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
    93
        \val ("^ comp_theorems ^") =\n\
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    94
	\Domain_Theorems.comp_theorems thy \
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    95
	\(" ^ quote comp_dname   ^ ","^ comp_dname ^"_equations,\n\
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    96
	\ ["^collect "    ," "cases"    ^"],\n\
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    97
	\  "^collect "@"     "con_rews " ^",\n\
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    98
	\  "^collect " @"    "copy_rews" ^");\n\
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
    99
	\val rews = "^(if num>1 then collect" @ " "rews"else rews1)^ " @ take_rews;\n\
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   100
      \end; (* struct *)"
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   101
    end;
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   102
  in (thy_ext_string, val_gen_string) end;
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   103
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   104
(* ----- strings for calling add_gen_by and producing the value binding ----------- *)
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   105
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   106
  fun mk_gen_by (finite,eqs) = let
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   107
      val typs    = map fst eqs;
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   108
      val cnstrss = map snd eqs;
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   109
      val tname = implode (separate "_" typs) in
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   110
      ("|> Domain_Extender.add_gen_by "
2240
a8c074224e11 Replaced obsolete "makestring" by Bool.toString
paulson
parents: 1637
diff changeset
   111
       ^ mk_pair(mk_pair(quote tname, Bool.toString finite),
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   112
		 mk_pair(mk_list(map quote typs), 
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   113
			 mk_list (map (fn cns => mk_list(map quote cns)) cnstrss))),
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   114
       "val "^tname^"_induct = " ^gt_ax (tname^"_induct")^";") end;
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   115
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   116
(* ----- parser for domain declaration equation ----------------------------------- *)
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   117
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 2267
diff changeset
   118
  val name' = name >> strip_quotes;
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 2267
diff changeset
   119
  val type_var' = type_var >> strip_quotes;
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   120
  fun esc_quote s = let fun esc [] = []
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   121
			|   esc ("\""::xs) = esc xs
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   122
			|   esc ("[" ::xs) = "{"::esc xs
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   123
			|   esc ("]" ::xs) = "}"::esc xs
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   124
			|   esc (x   ::xs) = x  ::esc xs
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   125
		    in implode (esc (explode s)) end;
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   126
  val tvar = (type_var' ^^ optional ($$ "::" ^^ (sort >> esc_quote)) "") >> quote;
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   127
  fun type_args l = (tvar >> (fn x => [x])
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   128
                 ||  "(" $$-- !! (list1 tvar --$$ ")")
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   129
                 ||  empty >> K []) l
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   130
  fun con_typ l   = (type_args -- name' >> (fn (x,y) => (y,x))) l
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   131
                      (* here ident may be used instead of name' 
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   132
                         to avoid ambiguity with standard mixfix option *)
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   133
  val domain_arg  = "(" $$-- (optional ($$ "lazy" >> K true) false)
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 2267
diff changeset
   134
			  -- (optional ((name' >> Some) --$$ "::") None)
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   135
			  -- typ --$$ ")" >> (fn ((lazy,sel),tp) => (lazy,sel,tp))
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   136
		 || typ >> (fn x => (false,None,x)) 
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 2267
diff changeset
   137
  val domain_cons = name' -- !! (repeat domain_arg) 
1637
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   138
		    -- ThyOps.opt_cmixfix
b8a8ae2e5de1 Updated: 01-Mar-96 when functional strictified, copy_def based on when_def
oheimb
parents: 1461
diff changeset
   139
		    >> (fn ((con,args),syn) => (con,syn,args));
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   140
in
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   141
  val domain_decl = (enum1 "," (con_typ --$$ "="  -- !! 
4008
2444085532c6 adapted domain and ax_ops package for name spaces
oheimb
parents: 3622
diff changeset
   142
			       (enum1 "|" domain_cons))) >> mk_domain;
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   143
  val gen_by_decl = (optional ($$ "finite" >> K true) false) -- 
2445
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 2267
diff changeset
   144
		    (enum1 "," (name'   --$$ "by" -- !!
51993fea433f removed Holcfb.thy and Holcfb.ML, moving classical3 to HOL.ML as classical2
oheimb
parents: 2267
diff changeset
   145
			       (enum1 "|" name'))) >> mk_gen_by;
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   146
3622
85898be702b2 use ThySyn.add_syntax;
wenzelm
parents: 2446
diff changeset
   147
  val _ = ThySyn.add_syntax
85898be702b2 use ThySyn.add_syntax;
wenzelm
parents: 2446
diff changeset
   148
    ["lazy", "by", "finite"]
85898be702b2 use ThySyn.add_syntax;
wenzelm
parents: 2446
diff changeset
   149
    [("domain", domain_decl), ("generated", gen_by_decl)]
1274
ea0668a1c0ba added 8bit pragmas
regensbu
parents:
diff changeset
   150
3622
85898be702b2 use ThySyn.add_syntax;
wenzelm
parents: 2446
diff changeset
   151
end; (* local *)