1460
|
1 |
(* Title: HOL/Tools/Quotient/quotient_typ.thy
|
952
|
2 |
Author: Cezary Kaliszyk and Christian Urban
|
|
3 |
|
1460
|
4 |
Definition of a quotient type.
|
952
|
5 |
|
|
6 |
*)
|
|
7 |
|
762
|
8 |
signature QUOTIENT_TYPE =
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
9 |
sig
|
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
10 |
val add_quotient_type: ((string list * binding * mixfix) * (typ * term)) * thm
|
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
11 |
-> Proof.context -> (thm * thm) * local_theory
|
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
12 |
|
1128
|
13 |
val quotient_type: ((string list * binding * mixfix) * (typ * term)) list
|
787
5cf83fa5b36c
made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
14 |
-> Proof.context -> Proof.state
|
789
|
15 |
|
1128
|
16 |
val quotient_type_cmd: ((((string list * binding) * mixfix) * string) * string) list
|
787
5cf83fa5b36c
made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
17 |
-> Proof.context -> Proof.state
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
18 |
end;
|
71
|
19 |
|
762
|
20 |
structure Quotient_Type: QUOTIENT_TYPE =
|
71
|
21 |
struct
|
|
22 |
|
762
|
23 |
open Quotient_Info;
|
|
24 |
|
760
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
25 |
(* wrappers for define, note, Attrib.internal and theorem_i *)
|
135
|
26 |
fun define (name, mx, rhs) lthy =
|
|
27 |
let
|
|
28 |
val ((rhs, (_ , thm)), lthy') =
|
331
|
29 |
Local_Theory.define ((name, mx), (Attrib.empty_binding, rhs)) lthy
|
135
|
30 |
in
|
|
31 |
((rhs, thm), lthy')
|
|
32 |
end
|
|
33 |
|
503
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
34 |
fun note (name, thm, attrs) lthy =
|
135
|
35 |
let
|
503
d2c9a72e52e0
first version of internalised quotient theorems; added FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
36 |
val ((_,[thm']), lthy') = Local_Theory.note ((name, attrs), [thm]) lthy
|
135
|
37 |
in
|
|
38 |
(thm', lthy')
|
|
39 |
end
|
|
40 |
|
760
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
41 |
fun intern_attr at = Attrib.internal (K at)
|
582
|
42 |
|
203
|
43 |
fun theorem after_qed goals ctxt =
|
|
44 |
let
|
|
45 |
val goals' = map (rpair []) goals
|
|
46 |
fun after_qed' thms = after_qed (the_single thms)
|
1128
|
47 |
in
|
203
|
48 |
Proof.theorem_i NONE after_qed' [goals'] ctxt
|
|
49 |
end
|
135
|
50 |
|
130
|
51 |
|
838
|
52 |
|
|
53 |
(*** definition of quotient types ***)
|
130
|
54 |
|
780
a24e26f5488c
explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
55 |
val mem_def1 = @{lemma "y : S ==> S y" by (simp add: mem_def)}
|
a24e26f5488c
explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
56 |
val mem_def2 = @{lemma "S y ==> y : S" by (simp add: mem_def)}
|
a24e26f5488c
explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
57 |
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
58 |
(* constructs the term lambda (c::rty => bool). EX (x::rty). c = rel x *)
|
71
|
59 |
fun typedef_term rel rty lthy =
|
|
60 |
let
|
1101
|
61 |
val [x, c] =
|
|
62 |
[("x", rty), ("c", HOLogic.mk_setT rty)]
|
|
63 |
|> Variable.variant_frees lthy [rel]
|
|
64 |
|> map Free
|
71
|
65 |
in
|
790
|
66 |
lambda c (HOLogic.exists_const rty $
|
|
67 |
lambda x (HOLogic.mk_eq (c, (rel $ x))))
|
71
|
68 |
end
|
|
69 |
|
790
|
70 |
|
788
|
71 |
(* makes the new type definitions and proves non-emptyness *)
|
787
5cf83fa5b36c
made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
72 |
fun typedef_make (vs, qty_name, mx, rel, rty) lthy =
|
71
|
73 |
let
|
|
74 |
val typedef_tac =
|
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
75 |
EVERY1 (map rtac [@{thm exI}, mem_def2, @{thm exI}, @{thm refl}])
|
71
|
76 |
in
|
1460
|
77 |
Typedef.add_typedef false NONE (qty_name, vs, mx)
|
|
78 |
(typedef_term rel rty lthy) NONE typedef_tac lthy
|
71
|
79 |
end
|
|
80 |
|
790
|
81 |
|
1124
|
82 |
(* tactic to prove the quot_type theorem for the new type *)
|
71
|
83 |
fun typedef_quot_type_tac equiv_thm (typedef_info: Typedef.info) =
|
|
84 |
let
|
885
|
85 |
val rep_thm = #Rep typedef_info RS mem_def1
|
71
|
86 |
val rep_inv = #Rep_inverse typedef_info
|
885
|
87 |
val abs_inv = mem_def2 RS #Abs_inverse typedef_info
|
71
|
88 |
val rep_inj = #Rep_inject typedef_info
|
|
89 |
in
|
1124
|
90 |
(rtac @{thm quot_type.intro} THEN' RANGE [
|
1101
|
91 |
rtac equiv_thm,
|
|
92 |
rtac rep_thm,
|
|
93 |
rtac rep_inv,
|
|
94 |
EVERY' (map rtac [abs_inv, @{thm exI}, @{thm refl}]),
|
|
95 |
rtac rep_inj]) 1
|
71
|
96 |
end
|
|
97 |
|
790
|
98 |
|
1124
|
99 |
(* proves the quot_type theorem for the new type *)
|
71
|
100 |
fun typedef_quot_type_thm (rel, abs, rep, equiv_thm, typedef_info) lthy =
|
|
101 |
let
|
1124
|
102 |
val quot_type_const = Const (@{const_name "quot_type"}, dummyT)
|
1101
|
103 |
val goal =
|
|
104 |
HOLogic.mk_Trueprop (quot_type_const $ rel $ abs $ rep)
|
|
105 |
|> Syntax.check_term lthy
|
71
|
106 |
in
|
|
107 |
Goal.prove lthy [] [] goal
|
|
108 |
(K (typedef_quot_type_tac equiv_thm typedef_info))
|
|
109 |
end
|
|
110 |
|
885
|
111 |
(* proves the quotient theorem for the new type *)
|
71
|
112 |
fun typedef_quotient_thm (rel, abs, rep, abs_def, rep_def, quot_type_thm) lthy =
|
|
113 |
let
|
529
|
114 |
val quotient_const = Const (@{const_name "Quotient"}, dummyT)
|
1101
|
115 |
val goal =
|
|
116 |
HOLogic.mk_Trueprop (quotient_const $ rel $ abs $ rep)
|
|
117 |
|> Syntax.check_term lthy
|
71
|
118 |
|
|
119 |
val typedef_quotient_thm_tac =
|
1101
|
120 |
EVERY1 [
|
|
121 |
K (rewrite_goals_tac [abs_def, rep_def]),
|
1124
|
122 |
rtac @{thm quot_type.Quotient},
|
1101
|
123 |
rtac quot_type_thm]
|
71
|
124 |
in
|
|
125 |
Goal.prove lthy [] [] goal
|
|
126 |
(K typedef_quotient_thm_tac)
|
|
127 |
end
|
|
128 |
|
790
|
129 |
|
760
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
130 |
(* main function for constructing a quotient type *)
|
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
131 |
fun add_quotient_type (((vs, qty_name, mx), (rty, rel)), equiv_thm) lthy =
|
71
|
132 |
let
|
760
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
133 |
(* generates the typedef *)
|
787
5cf83fa5b36c
made the quotient_type definition more like typedef; now type variables need to be explicitly given
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
134 |
val ((qty_full_name, typedef_info), lthy1) = typedef_make (vs, qty_name, mx, rel, rty) lthy
|
71
|
135 |
|
760
c1989de100b4
various tunings; map_lookup now raises an exception; addition to FIXME-TODO
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
136 |
(* abs and rep functions from the typedef *)
|
782
|
137 |
val Abs_ty = #abs_type typedef_info
|
|
138 |
val Rep_ty = #rep_type typedef_info
|
|
139 |
val Abs_name = #Abs_name typedef_info
|
|
140 |
val Rep_name = #Rep_name typedef_info
|
|
141 |
val Abs_const = Const (Abs_name, Rep_ty --> Abs_ty)
|
|
142 |
val Rep_const = Const (Rep_name, Abs_ty --> Rep_ty)
|
71
|
143 |
|
792
|
144 |
(* more useful abs and rep definitions *)
|
1124
|
145 |
val abs_const = Const (@{const_name "quot_type.abs"}, dummyT )
|
|
146 |
val rep_const = Const (@{const_name "quot_type.rep"}, dummyT )
|
782
|
147 |
val abs_trm = Syntax.check_term lthy1 (abs_const $ rel $ Abs_const)
|
|
148 |
val rep_trm = Syntax.check_term lthy1 (rep_const $ Rep_const)
|
|
149 |
val abs_name = Binding.prefix_name "abs_" qty_name
|
|
150 |
val rep_name = Binding.prefix_name "rep_" qty_name
|
781
|
151 |
|
782
|
152 |
val ((abs, abs_def), lthy2) = define (abs_name, NoSyn, abs_trm) lthy1
|
|
153 |
val ((rep, rep_def), lthy3) = define (rep_name, NoSyn, rep_trm) lthy2
|
71
|
154 |
|
885
|
155 |
(* quot_type theorem *)
|
782
|
156 |
val quot_thm = typedef_quot_type_thm (rel, Abs_const, Rep_const, equiv_thm, typedef_info) lthy3
|
71
|
157 |
|
1128
|
158 |
(* quotient theorem *)
|
782
|
159 |
val quotient_thm = typedef_quotient_thm (rel, abs, rep, abs_def, rep_def, quot_thm) lthy3
|
529
|
160 |
val quotient_thm_name = Binding.prefix_name "Quotient_" qty_name
|
71
|
161 |
|
782
|
162 |
(* name equivalence theorem *)
|
|
163 |
val equiv_thm_name = Binding.suffix_name "_equivp" qty_name
|
|
164 |
|
182
|
165 |
(* storing the quot-info *)
|
799
|
166 |
fun qinfo phi = transform_quotdata phi
|
1110
1e5dee9e6ae2
proper declaration of types and terms during parsing (removes the varifyT when storing data)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
167 |
{qtyp = Abs_ty, rtyp = rty, equiv_rel = rel, equiv_thm = equiv_thm}
|
786
|
168 |
val lthy4 = Local_Theory.declaration true
|
1101
|
169 |
(fn phi => quotdata_update_gen qty_full_name (qinfo phi)) lthy3
|
71
|
170 |
in
|
781
|
171 |
lthy4
|
780
a24e26f5488c
explicit handling of mem_def, avoiding the use of the simplifier; this fixes some quotient_type definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
172 |
|> note (quotient_thm_name, quotient_thm, [intern_attr quotient_rules_add])
|
782
|
173 |
||>> note (equiv_thm_name, equiv_thm, [intern_attr equiv_rules_add])
|
71
|
174 |
end
|
|
175 |
|
790
|
176 |
|
805
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
177 |
(* sanity checks for the quotient type specifications *)
|
788
|
178 |
fun sanity_check ((vs, qty_name, _), (rty, rel)) =
|
|
179 |
let
|
|
180 |
val rty_tfreesT = map fst (Term.add_tfreesT rty [])
|
|
181 |
val rel_tfrees = map fst (Term.add_tfrees rel [])
|
|
182 |
val rel_frees = map fst (Term.add_frees rel [])
|
|
183 |
val rel_vars = Term.add_vars rel []
|
|
184 |
val rel_tvars = Term.add_tvars rel []
|
885
|
185 |
val qty_str = Binding.str_of qty_name ^ ": "
|
788
|
186 |
|
|
187 |
val illegal_rel_vars =
|
|
188 |
if null rel_vars andalso null rel_tvars then []
|
|
189 |
else [qty_str ^ "illegal schematic variable(s) in the relation."]
|
|
190 |
|
|
191 |
val dup_vs =
|
1128
|
192 |
(case duplicates (op =) vs of
|
788
|
193 |
[] => []
|
|
194 |
| dups => [qty_str ^ "duplicate type variable(s) on the lhs: " ^ commas_quote dups])
|
|
195 |
|
|
196 |
val extra_rty_tfrees =
|
1128
|
197 |
(case subtract (op =) vs rty_tfreesT of
|
788
|
198 |
[] => []
|
|
199 |
| extras => [qty_str ^ "extra type variable(s) on the lhs: " ^ commas_quote extras])
|
|
200 |
|
|
201 |
val extra_rel_tfrees =
|
1128
|
202 |
(case subtract (op =) vs rel_tfrees of
|
788
|
203 |
[] => []
|
|
204 |
| extras => [qty_str ^ "extra type variable(s) in the relation: " ^ commas_quote extras])
|
1128
|
205 |
|
788
|
206 |
val illegal_rel_frees =
|
1128
|
207 |
(case rel_frees of
|
788
|
208 |
[] => []
|
|
209 |
| xs => [qty_str ^ "illegal variable(s) in the relation: " ^ commas_quote xs])
|
|
210 |
|
|
211 |
val errs = illegal_rel_vars @ dup_vs @ extra_rty_tfrees @ extra_rel_tfrees @ illegal_rel_frees
|
|
212 |
in
|
|
213 |
if null errs then () else error (cat_lines errs)
|
|
214 |
end
|
130
|
215 |
|
805
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
216 |
(* check for existence of map functions *)
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
217 |
fun map_check ctxt (_, (rty, _)) =
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
218 |
let
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
219 |
val thy = ProofContext.theory_of ctxt
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
220 |
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
221 |
fun map_check_aux rty warns =
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
222 |
case rty of
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
223 |
Type (_, []) => warns
|
885
|
224 |
| Type (s, _) => if maps_defined thy s then warns else s::warns
|
805
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
225 |
| _ => warns
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
226 |
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
227 |
val warns = map_check_aux rty []
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
228 |
in
|
1101
|
229 |
if null warns then ()
|
853
|
230 |
else warning ("No map function defined for " ^ commas warns ^
|
1101
|
231 |
". This will cause problems later on.")
|
805
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
232 |
end
|
d193e2111811
added a warning to the quotient_type definition, if a map function is missing
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
233 |
|
790
|
234 |
|
838
|
235 |
|
|
236 |
(*** interface and syntax setup ***)
|
|
237 |
|
75
|
238 |
|
853
|
239 |
(* the ML-interface takes a list of 5-tuples consisting of:
|
|
240 |
|
|
241 |
- the name of the quotient type
|
|
242 |
- its free type variables (first argument)
|
|
243 |
- its mixfix annotation
|
|
244 |
- the type to be quotient
|
|
245 |
- the relation according to which the type is quotient
|
|
246 |
|
|
247 |
it opens a proof-state in which one has to show that the
|
|
248 |
relations are equivalence relations
|
838
|
249 |
*)
|
130
|
250 |
|
1128
|
251 |
fun quotient_type quot_list lthy =
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
252 |
let
|
1128
|
253 |
(* sanity check *)
|
|
254 |
val _ = List.app sanity_check quot_list
|
838
|
255 |
val _ = List.app (map_check lthy) quot_list
|
800
|
256 |
|
185
|
257 |
fun mk_goal (rty, rel) =
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
258 |
let
|
529
|
259 |
val equivp_ty = ([rty, rty] ---> @{typ bool}) --> @{typ bool}
|
1128
|
260 |
in
|
529
|
261 |
HOLogic.mk_Trueprop (Const (@{const_name equivp}, equivp_ty) $ rel)
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
262 |
end
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
263 |
|
185
|
264 |
val goals = map (mk_goal o snd) quot_list
|
1128
|
265 |
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
266 |
fun after_qed thms lthy =
|
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
267 |
fold_map add_quotient_type (quot_list ~~ thms) lthy |> snd
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
268 |
in
|
203
|
269 |
theorem after_qed goals lthy
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
270 |
end
|
1128
|
271 |
|
|
272 |
fun quotient_type_cmd specs lthy =
|
205
|
273 |
let
|
1110
1e5dee9e6ae2
proper declaration of types and terms during parsing (removes the varifyT when storing data)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
274 |
fun parse_spec ((((vs, qty_name), mx), rty_str), rel_str) lthy =
|
205
|
275 |
let
|
293
|
276 |
val rty = Syntax.read_typ lthy rty_str
|
1110
1e5dee9e6ae2
proper declaration of types and terms during parsing (removes the varifyT when storing data)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
277 |
val lthy1 = Variable.declare_typ rty lthy
|
1152
|
278 |
val rel =
|
1162
|
279 |
Syntax.parse_term lthy1 rel_str
|
|
280 |
|> Syntax.type_constraint (rty --> rty --> @{typ bool})
|
|
281 |
|> Syntax.check_term lthy1
|
1460
|
282 |
val (newT, lthy2) = lthy1
|
|
283 |
|> Typedecl.typedecl_wrt [rel] (qty_name, vs, mx)
|
|
284 |
||> Variable.declare_term rel
|
|
285 |
|
|
286 |
(*val Type (full_qty_name, type_args) = newT
|
|
287 |
val vs' = map Term.dest_TFree type_args*)
|
205
|
288 |
in
|
1110
1e5dee9e6ae2
proper declaration of types and terms during parsing (removes the varifyT when storing data)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
289 |
(((vs, qty_name, mx), (rty, rel)), lthy2)
|
205
|
290 |
end
|
1110
1e5dee9e6ae2
proper declaration of types and terms during parsing (removes the varifyT when storing data)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
291 |
|
1e5dee9e6ae2
proper declaration of types and terms during parsing (removes the varifyT when storing data)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
292 |
val (spec', lthy') = fold_map parse_spec specs lthy
|
205
|
293 |
in
|
1110
1e5dee9e6ae2
proper declaration of types and terms during parsing (removes the varifyT when storing data)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
294 |
quotient_type spec' lthy'
|
205
|
295 |
end
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
296 |
|
1128
|
297 |
val quotspec_parser =
|
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
298 |
OuterParse.and_list1
|
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
299 |
((OuterParse.type_args -- OuterParse.binding) --
|
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
300 |
OuterParse.opt_mixfix -- (OuterParse.$$$ "=" |-- OuterParse.typ) --
|
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
301 |
(OuterParse.$$$ "/" |-- OuterParse.term))
|
75
|
302 |
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
303 |
val _ = OuterKeyword.keyword "/"
|
75
|
304 |
|
1128
|
305 |
val _ =
|
1438
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
306 |
OuterSyntax.local_theory_to_proof "quotient_type"
|
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
307 |
"quotient type definitions (require equivalence proofs)"
|
61671de8a545
synchronised with main hg-repository; used add_typedef_global in nominal_atoms
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
308 |
OuterKeyword.thy_goal (quotspec_parser >> quotient_type_cmd)
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
309 |
|
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
310 |
end; (* structure *)
|