25 val axclass_tac: theory -> thm list -> tactic |
25 val axclass_tac: theory -> thm list -> tactic |
26 val prove_subclass: theory -> class * class -> thm list |
26 val prove_subclass: theory -> class * class -> thm list |
27 -> tactic option -> thm |
27 -> tactic option -> thm |
28 val prove_arity: theory -> string * sort list * class -> thm list |
28 val prove_arity: theory -> string * sort list * class -> thm list |
29 -> tactic option -> thm |
29 -> tactic option -> thm |
30 val goal_subclass: theory -> class * class -> thm list |
30 val goal_subclass: theory -> xclass * xclass -> thm list |
31 val goal_arity: theory -> string * sort list * class -> thm list |
31 val goal_arity: theory -> xstring * xsort list * xclass -> thm list |
32 end; |
32 end; |
33 |
33 |
34 structure AxClass : AX_CLASS = |
34 structure AxClass : AX_CLASS = |
35 struct |
35 struct |
36 |
36 |
282 |
282 |
283 val prove_arity = |
283 val prove_arity = |
284 prove mk_arity (fn (sg, (t, Ss, c)) => Sign.str_of_arity sg (t, Ss, [c])); |
284 prove mk_arity (fn (sg, (t, Ss, c)) => Sign.str_of_arity sg (t, Ss, [c])); |
285 |
285 |
286 |
286 |
287 (* make goals (for interactive use) *) |
|
288 |
|
289 fun mk_goal term_of thy sig_prop = |
|
290 goalw_cterm [] (cterm_of (sign_of thy) (term_of sig_prop)); |
|
291 |
|
292 val goal_subclass = mk_goal mk_classrel; |
|
293 val goal_arity = mk_goal mk_arity; |
|
294 |
|
295 |
|
296 |
287 |
297 (** add proved subclass relations and arities **) |
288 (** add proved subclass relations and arities **) |
298 |
289 |
|
290 fun intrn_classrel sg c1_c2 = |
|
291 pairself (Sign.intern_class sg) c1_c2; |
|
292 |
299 fun ext_inst_subclass int raw_c1_c2 axms thms usr_tac thy = |
293 fun ext_inst_subclass int raw_c1_c2 axms thms usr_tac thy = |
300 let |
294 let |
301 val intrn = if int then pairself (Sign.intern_class (sign_of thy)) else I; |
295 val c1_c2 = |
302 val c1_c2 = intrn raw_c1_c2; |
296 if int then intrn_classrel (sign_of thy) raw_c1_c2 |
|
297 else raw_c1_c2; |
303 in |
298 in |
304 writeln ("Proving class inclusion " ^ |
299 writeln ("Proving class inclusion " ^ |
305 quote (Sign.str_of_classrel (sign_of thy) c1_c2) ^ " ..."); |
300 quote (Sign.str_of_classrel (sign_of thy) c1_c2) ^ " ..."); |
306 add_classrel_thms |
301 add_classrel_thms |
307 [prove_subclass thy c1_c2 (witnesses thy axms thms) usr_tac] thy |
302 [prove_subclass thy c1_c2 (witnesses thy axms thms) usr_tac] thy |
308 end; |
303 end; |
309 |
304 |
310 |
305 |
|
306 fun intrn_arity sg intrn (t, Ss, x) = |
|
307 (Sign.intern_tycon sg t, map (Sign.intern_sort sg) Ss, intrn sg x); |
|
308 |
311 fun ext_inst_arity int (raw_t, raw_Ss, raw_cs) axms thms usr_tac thy = |
309 fun ext_inst_arity int (raw_t, raw_Ss, raw_cs) axms thms usr_tac thy = |
312 let |
310 let |
313 val sign = sign_of thy; |
311 val sign = sign_of thy; |
314 val (t, Ss, cs) = |
312 val (t, Ss, cs) = |
315 if int then |
313 if int then intrn_arity sign Sign.intern_sort (raw_t, raw_Ss, raw_cs) |
316 (Sign.intern_tycon sign raw_t, |
|
317 map (Sign.intern_sort sign) raw_Ss, |
|
318 map (Sign.intern_class sign) raw_cs) |
|
319 else (raw_t, raw_Ss, raw_cs); |
314 else (raw_t, raw_Ss, raw_cs); |
320 val wthms = witnesses thy axms thms; |
315 val wthms = witnesses thy axms thms; |
321 fun prove c = |
316 fun prove c = |
322 (writeln ("Proving type arity " ^ |
317 (writeln ("Proving type arity " ^ |
323 quote (Sign.str_of_arity sign (t, Ss, [c])) ^ " ..."); |
318 quote (Sign.str_of_arity sign (t, Ss, [c])) ^ " ..."); |
330 val add_inst_subclass_i = ext_inst_subclass false; |
325 val add_inst_subclass_i = ext_inst_subclass false; |
331 val add_inst_arity = ext_inst_arity true; |
326 val add_inst_arity = ext_inst_arity true; |
332 val add_inst_arity_i = ext_inst_arity false; |
327 val add_inst_arity_i = ext_inst_arity false; |
333 |
328 |
334 |
329 |
|
330 (* make goals (for interactive use) *) |
|
331 |
|
332 fun mk_goal term_of thy sig_prop = |
|
333 goalw_cterm [] (cterm_of (sign_of thy) (term_of sig_prop)); |
|
334 |
|
335 fun goal_subclass thy = |
|
336 mk_goal (mk_classrel o intrn_classrel (sign_of thy)) thy; |
|
337 |
|
338 fun goal_arity thy = |
|
339 mk_goal (mk_arity o intrn_arity (sign_of thy) Sign.intern_class) thy; |
|
340 |
|
341 |
335 end; |
342 end; |