author | wenzelm |
Thu, 03 Sep 2015 21:50:39 +0200 | |
changeset 61110 | 6b7c2ecc6aea |
parent 61103 | 8ed21464e260 |
child 61246 | 077b88f9ec16 |
permissions | -rw-r--r-- |
31723
f5cafe803b55
discontinued ancient tradition to suffix certain ML module names with "_package"
haftmann
parents:
30345
diff
changeset
|
1 |
(* Title: HOL/Tools/typedef.ML |
16458 | 2 |
Author: Markus Wenzel and Stefan Berghofer, TU Muenchen |
4866 | 3 |
|
21352 | 4 |
Gordon/HOL-style type definitions: create a new syntactic type |
35741 | 5 |
represented by a non-empty set. |
4866 | 6 |
*) |
7 |
||
31723
f5cafe803b55
discontinued ancient tradition to suffix certain ML module names with "_package"
haftmann
parents:
30345
diff
changeset
|
8 |
signature TYPEDEF = |
4866 | 9 |
sig |
19705 | 10 |
type info = |
36107 | 11 |
{rep_type: typ, abs_type: typ, Rep_name: string, Abs_name: string, axiom_name: string} * |
49833 | 12 |
{inhabited: thm, type_definition: thm, Rep: thm, Rep_inverse: thm, Abs_inverse: thm, |
13 |
Rep_inject: thm, Abs_inject: thm, Rep_cases: thm, Abs_cases: thm, |
|
29061
c67cc9402ba9
inhabitance goal is now stated in original form and result contracted --
wenzelm
parents:
29059
diff
changeset
|
14 |
Rep_induct: thm, Abs_induct: thm} |
35741 | 15 |
val transform_info: morphism -> info -> info |
16 |
val get_info: Proof.context -> string -> info list |
|
17 |
val get_info_global: theory -> string -> info list |
|
58662 | 18 |
val interpretation: (string -> local_theory -> local_theory) -> theory -> theory |
61110 | 19 |
type bindings = {Rep_name: binding, Abs_name: binding, type_definition_name: binding} |
20 |
val default_bindings: binding -> bindings |
|
21 |
val make_bindings: binding -> bindings option -> bindings |
|
22 |
val make_morphisms: binding -> (binding * binding) option -> bindings |
|
23 |
val add_typedef: binding * (string * sort) list * mixfix -> |
|
24 |
term -> bindings option -> (Proof.context -> tactic) -> local_theory -> |
|
58959 | 25 |
(string * info) * local_theory |
61110 | 26 |
val add_typedef_global: binding * (string * sort) list * mixfix -> |
27 |
term -> bindings option -> (Proof.context -> tactic) -> theory -> |
|
58959 | 28 |
(string * info) * theory |
61110 | 29 |
val typedef: binding * (string * sort) list * mixfix -> term -> bindings option -> |
30 |
local_theory -> Proof.state |
|
31 |
val typedef_cmd: binding * (string * string option) list * mixfix -> string -> bindings option -> |
|
32 |
local_theory -> Proof.state |
|
4866 | 33 |
end; |
34 |
||
31723
f5cafe803b55
discontinued ancient tradition to suffix certain ML module names with "_package"
haftmann
parents:
30345
diff
changeset
|
35 |
structure Typedef: TYPEDEF = |
4866 | 36 |
struct |
37 |
||
17922 | 38 |
(** type definitions **) |
39 |
||
40 |
(* theory data *) |
|
15259 | 41 |
|
19705 | 42 |
type info = |
35994
9cc3df9a606e
Typedef.info: separate global and local part, only the latter is transformed by morphisms;
wenzelm
parents:
35840
diff
changeset
|
43 |
(*global part*) |
36107 | 44 |
{rep_type: typ, abs_type: typ, Rep_name: string, Abs_name: string, axiom_name: string} * |
35741 | 45 |
(*local part*) |
49833 | 46 |
{inhabited: thm, type_definition: thm, Rep: thm, Rep_inverse: thm, Abs_inverse: thm, |
47 |
Rep_inject: thm, Abs_inject: thm, Rep_cases: thm, Abs_cases: thm, |
|
35994
9cc3df9a606e
Typedef.info: separate global and local part, only the latter is transformed by morphisms;
wenzelm
parents:
35840
diff
changeset
|
48 |
Rep_induct: thm, Abs_induct: thm}; |
19459 | 49 |
|
35741 | 50 |
fun transform_info phi (info: info) = |
51 |
let |
|
52 |
val thm = Morphism.thm phi; |
|
49833 | 53 |
val (global_info, {inhabited, type_definition, Rep, Rep_inverse, Abs_inverse, |
54 |
Rep_inject, Abs_inject, Rep_cases, Abs_cases, Rep_induct, Abs_induct}) = info; |
|
35741 | 55 |
in |
35994
9cc3df9a606e
Typedef.info: separate global and local part, only the latter is transformed by morphisms;
wenzelm
parents:
35840
diff
changeset
|
56 |
(global_info, |
9cc3df9a606e
Typedef.info: separate global and local part, only the latter is transformed by morphisms;
wenzelm
parents:
35840
diff
changeset
|
57 |
{inhabited = thm inhabited, type_definition = thm type_definition, |
49833 | 58 |
Rep = thm Rep, Rep_inverse = thm Rep_inverse, Abs_inverse = thm Abs_inverse, |
59 |
Rep_inject = thm Rep_inject, Abs_inject = thm Abs_inject, |
|
60 |
Rep_cases = thm Rep_cases, Abs_cases = thm Abs_cases, |
|
61 |
Rep_induct = thm Rep_induct, Abs_induct = thm Abs_induct}) |
|
35741 | 62 |
end; |
63 |
||
64 |
structure Data = Generic_Data |
|
22846 | 65 |
( |
35741 | 66 |
type T = info list Symtab.table; |
15259 | 67 |
val empty = Symtab.empty; |
16458 | 68 |
val extend = I; |
35741 | 69 |
fun merge data = Symtab.merge_list (K true) data; |
22846 | 70 |
); |
15259 | 71 |
|
61103 | 72 |
fun get_info_generic context = |
73 |
Symtab.lookup_list (Data.get context) #> |
|
74 |
map (transform_info (Morphism.transfer_morphism (Context.theory_of context))); |
|
35741 | 75 |
|
61103 | 76 |
val get_info = get_info_generic o Context.Proof; |
77 |
val get_info_global = get_info_generic o Context.Theory; |
|
78 |
||
79 |
fun put_info name info = |
|
80 |
Data.map (Symtab.cons_list (name, transform_info Morphism.trim_context_morphism info)); |
|
35741 | 81 |
|
82 |
||
83 |
(* global interpretation *) |
|
84 |
||
58662 | 85 |
structure Typedef_Plugin = Plugin(type T = string); |
86 |
||
87 |
val typedef_plugin = Plugin_Name.declare_setup @{binding typedef}; |
|
56375
32e0da92c786
use same idiom as used for datatype 'size' function to name constants and theorems emerging from various type interpretations -- reduces the chances of name clashes on theory merges
blanchet
parents:
54883
diff
changeset
|
88 |
|
58662 | 89 |
fun interpretation f = |
90 |
Typedef_Plugin.interpretation typedef_plugin |
|
91 |
(fn name => fn lthy => |
|
92 |
lthy |
|
59880
30687c3f2b10
clarified role of naming for background theory: transform_binding (e.g. for "concealed" flag) uses naming of hypothetical context;
wenzelm
parents:
59859
diff
changeset
|
93 |
|> Local_Theory.map_background_naming |
58662 | 94 |
(Name_Space.root_path #> Name_Space.add_path (Long_Name.qualifier name)) |
95 |
|> f name |
|
59880
30687c3f2b10
clarified role of naming for background theory: transform_binding (e.g. for "concealed" flag) uses naming of hypothetical context;
wenzelm
parents:
59859
diff
changeset
|
96 |
|> Local_Theory.restore_background_naming lthy); |
35741 | 97 |
|
98 |
||
99 |
(* primitive typedef axiomatization -- for fresh typedecl *) |
|
100 |
||
101 |
fun mk_inhabited A = |
|
102 |
let val T = HOLogic.dest_setT (Term.fastype_of A) |
|
103 |
in HOLogic.mk_Trueprop (HOLogic.exists_const T $ Abs ("x", T, HOLogic.mk_mem (Bound 0, A))) end; |
|
104 |
||
105 |
fun mk_typedef newT oldT RepC AbsC A = |
|
106 |
let |
|
107 |
val typedefC = |
|
108 |
Const (@{const_name type_definition}, |
|
109 |
(newT --> oldT) --> (oldT --> newT) --> HOLogic.mk_setT oldT --> HOLogic.boolT); |
|
110 |
in Logic.mk_implies (mk_inhabited A, HOLogic.mk_Trueprop (typedefC $ RepC $ AbsC $ A)) end; |
|
35134 | 111 |
|
61110 | 112 |
fun primitive_typedef type_definition_name newT oldT Rep_name Abs_name A lthy = |
35741 | 113 |
let |
114 |
(* errors *) |
|
115 |
||
116 |
fun show_names pairs = commas_quote (map fst pairs); |
|
117 |
||
118 |
val lhs_tfrees = Term.add_tfreesT newT []; |
|
119 |
val rhs_tfrees = Term.add_tfreesT oldT []; |
|
120 |
val _ = |
|
121 |
(case fold (remove (op =)) lhs_tfrees rhs_tfrees of [] => () |
|
122 |
| extras => error ("Extra type variables in representing set: " ^ show_names extras)); |
|
123 |
||
124 |
val _ = |
|
125 |
(case Term.add_frees A [] of [] => [] |
|
126 |
| xs => error ("Illegal variables in representing set: " ^ show_names xs)); |
|
35134 | 127 |
|
35741 | 128 |
|
129 |
(* axiomatization *) |
|
130 |
||
42375
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42361
diff
changeset
|
131 |
val ((RepC, AbsC), consts_lthy) = lthy |
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42361
diff
changeset
|
132 |
|> Local_Theory.background_theory_result |
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42361
diff
changeset
|
133 |
(Sign.declare_const lthy ((Rep_name, newT --> oldT), NoSyn) ##>> |
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42361
diff
changeset
|
134 |
Sign.declare_const lthy ((Abs_name, oldT --> newT), NoSyn)); |
35741 | 135 |
|
136 |
val typedef_deps = Term.add_consts A []; |
|
137 |
||
42375
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42361
diff
changeset
|
138 |
val ((axiom_name, axiom), axiom_lthy) = consts_lthy |
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42361
diff
changeset
|
139 |
|> Local_Theory.background_theory_result |
61110 | 140 |
(Thm.add_axiom consts_lthy (type_definition_name, mk_typedef newT oldT RepC AbsC A) ##> |
42375
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42361
diff
changeset
|
141 |
Theory.add_deps consts_lthy "" (dest_Const RepC) typedef_deps ##> |
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42361
diff
changeset
|
142 |
Theory.add_deps consts_lthy "" (dest_Const AbsC) typedef_deps); |
35741 | 143 |
|
42375
774df7c59508
report Name_Space.declare/define, relatively to context;
wenzelm
parents:
42361
diff
changeset
|
144 |
in ((RepC, AbsC, axiom_name, axiom), axiom_lthy) end; |
15259 | 145 |
|
146 |
||
61110 | 147 |
(* derived bindings *) |
148 |
||
149 |
type bindings = {Rep_name: binding, Abs_name: binding, type_definition_name: binding}; |
|
150 |
||
151 |
fun default_bindings name = |
|
152 |
{Rep_name = Binding.prefix_name "Rep_" name, |
|
153 |
Abs_name = Binding.prefix_name "Abs_" name, |
|
154 |
type_definition_name = Binding.prefix_name "type_definition_" name}; |
|
155 |
||
156 |
fun make_bindings name NONE = default_bindings name |
|
157 |
| make_bindings _ (SOME bindings) = bindings; |
|
158 |
||
159 |
fun make_morphisms name NONE = default_bindings name |
|
160 |
| make_morphisms name (SOME (Rep_name, Abs_name)) = |
|
161 |
{Rep_name = Rep_name, Abs_name = Abs_name, |
|
162 |
type_definition_name = #type_definition_name (default_bindings name)}; |
|
163 |
||
164 |
||
6383 | 165 |
(* prepare_typedef *) |
166 |
||
61110 | 167 |
fun prepare_typedef prep_term (name, raw_args, mx) raw_set opt_bindings lthy = |
4866 | 168 |
let |
30345 | 169 |
val bname = Binding.name_of name; |
4866 | 170 |
|
35741 | 171 |
|
172 |
(* rhs *) |
|
173 |
||
36153
1ac501e16a6a
replaced slightly odd Typedecl.predeclare_constraints by plain declaration of type arguments -- also avoid "recursive" declaration of type constructor, which can cause problems with sequential definitions B.foo = A.foo;
wenzelm
parents:
36107
diff
changeset
|
174 |
val tmp_ctxt = lthy |> fold (Variable.declare_typ o TFree) raw_args; |
1ac501e16a6a
replaced slightly odd Typedecl.predeclare_constraints by plain declaration of type arguments -- also avoid "recursive" declaration of type constructor, which can cause problems with sequential definitions B.foo = A.foo;
wenzelm
parents:
36107
diff
changeset
|
175 |
val set = prep_term tmp_ctxt raw_set; |
1ac501e16a6a
replaced slightly odd Typedecl.predeclare_constraints by plain declaration of type arguments -- also avoid "recursive" declaration of type constructor, which can cause problems with sequential definitions B.foo = A.foo;
wenzelm
parents:
36107
diff
changeset
|
176 |
val tmp_ctxt' = tmp_ctxt |> Variable.declare_term set; |
35836
9380fab5f4f7
eliminated slightly odd typedecl_wrt in favour of explicit predeclare_constraints;
wenzelm
parents:
35766
diff
changeset
|
177 |
|
21352 | 178 |
val setT = Term.fastype_of set; |
35741 | 179 |
val oldT = HOLogic.dest_setT setT handle TYPE _ => |
180 |
error ("Not a set type: " ^ quote (Syntax.string_of_typ lthy setT)); |
|
181 |
||
182 |
val goal = mk_inhabited set; |
|
42290
b1f544c84040
discontinued special treatment of structure Lexicon;
wenzelm
parents:
38757
diff
changeset
|
183 |
val goal_pat = mk_inhabited (Var (the_default (bname, 0) (Lexicon.read_variable bname), setT)); |
35741 | 184 |
|
185 |
||
186 |
(* lhs *) |
|
187 |
||
42361 | 188 |
val args = map (Proof_Context.check_tfree tmp_ctxt') raw_args; |
35741 | 189 |
val (newT, typedecl_lthy) = lthy |
49835 | 190 |
|> Typedecl.typedecl (name, args, mx) |
35741 | 191 |
||> Variable.declare_term set; |
192 |
||
56375
32e0da92c786
use same idiom as used for datatype 'size' function to name constants and theorems emerging from various type interpretations -- reduces the chances of name clashes on theory merges
blanchet
parents:
54883
diff
changeset
|
193 |
val Type (full_name, _) = newT; |
35741 | 194 |
|
195 |
||
196 |
(* axiomatization *) |
|
4866 | 197 |
|
61110 | 198 |
val {Rep_name, Abs_name, type_definition_name} = make_bindings name opt_bindings; |
4866 | 199 |
|
49833 | 200 |
val ((RepC, AbsC, axiom_name, typedef), typedef_lthy) = typedecl_lthy |
61110 | 201 |
|> primitive_typedef type_definition_name newT oldT Rep_name Abs_name set; |
35741 | 202 |
|
203 |
val alias_lthy = typedef_lthy |
|
204 |
|> Local_Theory.const_alias Rep_name (#1 (Term.dest_Const RepC)) |
|
205 |
|> Local_Theory.const_alias Abs_name (#1 (Term.dest_Const AbsC)); |
|
6383 | 206 |
|
29056 | 207 |
|
35741 | 208 |
(* result *) |
4866 | 209 |
|
35741 | 210 |
fun note_qualify ((b, atts), th) = |
211 |
Local_Theory.note ((Binding.qualify false bname b, map (Attrib.internal o K) atts), [th]) |
|
212 |
#>> (fn (_, [th']) => th'); |
|
4866 | 213 |
|
35741 | 214 |
fun typedef_result inhabited lthy1 = |
215 |
let |
|
49833 | 216 |
val typedef' = inhabited RS typedef; |
54883
dd04a8b654fc
proper context for norm_hhf and derived operations;
wenzelm
parents:
49835
diff
changeset
|
217 |
fun make th = Goal.norm_result lthy1 (typedef' RS th); |
35741 | 218 |
val (((((((((((_, [type_definition]), Rep), Rep_inverse), Abs_inverse), Rep_inject), |
219 |
Abs_inject), Rep_cases), Abs_cases), Rep_induct), Abs_induct), lthy2) = lthy1 |
|
61110 | 220 |
|> Local_Theory.note ((type_definition_name, []), [typedef']) |
35741 | 221 |
||>> note_qualify ((Rep_name, []), make @{thm type_definition.Rep}) |
222 |
||>> note_qualify ((Binding.suffix_name "_inverse" Rep_name, []), |
|
223 |
make @{thm type_definition.Rep_inverse}) |
|
224 |
||>> note_qualify ((Binding.suffix_name "_inverse" Abs_name, []), |
|
225 |
make @{thm type_definition.Abs_inverse}) |
|
226 |
||>> note_qualify ((Binding.suffix_name "_inject" Rep_name, []), |
|
227 |
make @{thm type_definition.Rep_inject}) |
|
228 |
||>> note_qualify ((Binding.suffix_name "_inject" Abs_name, []), |
|
229 |
make @{thm type_definition.Abs_inject}) |
|
230 |
||>> note_qualify ((Binding.suffix_name "_cases" Rep_name, |
|
231 |
[Rule_Cases.case_names [Binding.name_of Rep_name], Induct.cases_pred full_name]), |
|
232 |
make @{thm type_definition.Rep_cases}) |
|
233 |
||>> note_qualify ((Binding.suffix_name "_cases" Abs_name, |
|
49835 | 234 |
[Rule_Cases.case_names [Binding.name_of Abs_name], Induct.cases_type full_name]), |
35741 | 235 |
make @{thm type_definition.Abs_cases}) |
236 |
||>> note_qualify ((Binding.suffix_name "_induct" Rep_name, |
|
237 |
[Rule_Cases.case_names [Binding.name_of Rep_name], Induct.induct_pred full_name]), |
|
238 |
make @{thm type_definition.Rep_induct}) |
|
239 |
||>> note_qualify ((Binding.suffix_name "_induct" Abs_name, |
|
49835 | 240 |
[Rule_Cases.case_names [Binding.name_of Abs_name], Induct.induct_type full_name]), |
35741 | 241 |
make @{thm type_definition.Abs_induct}); |
4866 | 242 |
|
35994
9cc3df9a606e
Typedef.info: separate global and local part, only the latter is transformed by morphisms;
wenzelm
parents:
35840
diff
changeset
|
243 |
val info = |
36107 | 244 |
({rep_type = oldT, abs_type = newT, Rep_name = #1 (Term.dest_Const RepC), |
245 |
Abs_name = #1 (Term.dest_Const AbsC), axiom_name = axiom_name}, |
|
49833 | 246 |
{inhabited = inhabited, type_definition = type_definition, |
35741 | 247 |
Rep = Rep, Rep_inverse = Rep_inverse, Abs_inverse = Abs_inverse, |
248 |
Rep_inject = Rep_inject, Abs_inject = Abs_inject, Rep_cases = Rep_cases, |
|
35994
9cc3df9a606e
Typedef.info: separate global and local part, only the latter is transformed by morphisms;
wenzelm
parents:
35840
diff
changeset
|
249 |
Abs_cases = Abs_cases, Rep_induct = Rep_induct, Abs_induct = Abs_induct}); |
35741 | 250 |
in |
251 |
lthy2 |
|
45291
57cd50f98fdc
uniform Local_Theory.declaration with explicit params;
wenzelm
parents:
42381
diff
changeset
|
252 |
|> Local_Theory.declaration {syntax = false, pervasive = true} |
49835 | 253 |
(fn phi => put_info full_name (transform_info phi info)) |
58662 | 254 |
|> Typedef_Plugin.data Plugin_Name.default_filter full_name |
49835 | 255 |
|> pair (full_name, info) |
35741 | 256 |
end; |
11426
f280d4b29a2c
abtract non-emptiness statements (no longer use Eps);
wenzelm
parents:
10697
diff
changeset
|
257 |
|
35741 | 258 |
in ((goal, goal_pat, typedef_result), alias_lthy) end |
30345 | 259 |
handle ERROR msg => |
42381
309ec68442c6
added Binding.print convenience, which includes quote already;
wenzelm
parents:
42375
diff
changeset
|
260 |
cat_error msg ("The error(s) above occurred in typedef " ^ Binding.print name); |
4866 | 261 |
|
262 |
||
29056 | 263 |
(* add_typedef: tactic interface *) |
4866 | 264 |
|
61110 | 265 |
fun add_typedef typ set opt_bindings tac lthy = |
6383 | 266 |
let |
35741 | 267 |
val ((goal, _, typedef_result), lthy') = |
61110 | 268 |
prepare_typedef Syntax.check_term typ set opt_bindings lthy; |
35741 | 269 |
val inhabited = |
58959 | 270 |
Goal.prove lthy' [] [] goal (tac o #context) |
54883
dd04a8b654fc
proper context for norm_hhf and derived operations;
wenzelm
parents:
49835
diff
changeset
|
271 |
|> Goal.norm_result lthy' |> Thm.close_derivation; |
35741 | 272 |
in typedef_result inhabited lthy' end; |
273 |
||
61110 | 274 |
fun add_typedef_global typ set opt_bindings tac = |
38388 | 275 |
Named_Target.theory_init |
61110 | 276 |
#> add_typedef typ set opt_bindings tac |
35741 | 277 |
#> Local_Theory.exit_result_global (apsnd o transform_info); |
4866 | 278 |
|
17339 | 279 |
|
29056 | 280 |
(* typedef: proof interface *) |
6383 | 281 |
|
17339 | 282 |
local |
283 |
||
61110 | 284 |
fun gen_typedef prep_term prep_constraint (b, raw_args, mx) set opt_bindings lthy = |
11822 | 285 |
let |
35840
01d7c4ba9050
allow sort constraints in HOL/typedef and related HOLCF variants;
wenzelm
parents:
35836
diff
changeset
|
286 |
val args = map (apsnd (prep_constraint lthy)) raw_args; |
35741 | 287 |
val ((goal, goal_pat, typedef_result), lthy') = |
61110 | 288 |
prepare_typedef prep_term (b, args, mx) set opt_bindings lthy; |
35741 | 289 |
fun after_qed [[th]] = snd o typedef_result th; |
36323
655e2d74de3a
modernized naming conventions of main Isar proof elements;
wenzelm
parents:
36153
diff
changeset
|
290 |
in Proof.theorem NONE after_qed [[(goal, [goal_pat])]] lthy' end; |
17339 | 291 |
|
292 |
in |
|
6383 | 293 |
|
35840
01d7c4ba9050
allow sort constraints in HOL/typedef and related HOLCF variants;
wenzelm
parents:
35836
diff
changeset
|
294 |
val typedef = gen_typedef Syntax.check_term (K I); |
01d7c4ba9050
allow sort constraints in HOL/typedef and related HOLCF variants;
wenzelm
parents:
35836
diff
changeset
|
295 |
val typedef_cmd = gen_typedef Syntax.read_term Typedecl.read_constraint; |
17339 | 296 |
|
19705 | 297 |
end; |
15259 | 298 |
|
299 |
||
300 |
||
6383 | 301 |
(** outer syntax **) |
302 |
||
24867 | 303 |
val _ = |
59936
b8ffc3dc9e24
@{command_spec} is superseded by @{command_keyword};
wenzelm
parents:
59880
diff
changeset
|
304 |
Outer_Syntax.local_theory_to_proof @{command_keyword typedef} |
46961
5c6955f487e5
outer syntax command definitions based on formal command_spec derived from theory header declarations;
wenzelm
parents:
46949
diff
changeset
|
305 |
"HOL type definition (requires non-emptiness proof)" |
49835 | 306 |
(Parse.type_args_constrained -- Parse.binding -- Parse.opt_mixfix -- |
307 |
(@{keyword "="} |-- Parse.term) -- |
|
308 |
Scan.option (@{keyword "morphisms"} |-- Parse.!!! (Parse.binding -- Parse.binding)) |
|
61110 | 309 |
>> (fn ((((vs, t), mx), A), opt_morphs) => fn lthy => |
310 |
typedef_cmd (t, vs, mx) A (SOME (make_morphisms t opt_morphs)) lthy)); |
|
6357 | 311 |
|
29056 | 312 |
end; |