260 |
260 |
261 val (thy2, reccomb_defs) = thy1 |> |
261 val (thy2, reccomb_defs) = thy1 |> |
262 Theory.add_consts_i (map (fn ((name, T), T') => |
262 Theory.add_consts_i (map (fn ((name, T), T') => |
263 (Sign.base_name name, reccomb_fn_Ts @ [T] ---> T', NoSyn)) |
263 (Sign.base_name name, reccomb_fn_Ts @ [T] ---> T', NoSyn)) |
264 (reccomb_names ~~ recTs ~~ rec_result_Ts)) |> |
264 (reccomb_names ~~ recTs ~~ rec_result_Ts)) |> |
265 (PureThy.add_defs_i o map Thm.no_attributes) (map (fn ((((name, comb), set), T), T') => |
265 (PureThy.add_defs_i false o map Thm.no_attributes) (map (fn ((((name, comb), set), T), T') => |
266 ((Sign.base_name name) ^ "_def", Logic.mk_equals (comb, absfree ("x", T, |
266 ((Sign.base_name name) ^ "_def", Logic.mk_equals (comb, absfree ("x", T, |
267 Const ("Eps", (T' --> HOLogic.boolT) --> T') $ absfree ("y", T', |
267 Const ("Eps", (T' --> HOLogic.boolT) --> T') $ absfree ("y", T', |
268 HOLogic.mk_mem (HOLogic.mk_prod (Free ("x", T), Free ("y", T')), set)))))) |
268 HOLogic.mk_mem (HOLogic.mk_prod (Free ("x", T), Free ("y", T')), set)))))) |
269 (reccomb_names ~~ reccombs ~~ rec_sets ~~ recTs ~~ rec_result_Ts)) |>> |
269 (reccomb_names ~~ reccombs ~~ rec_sets ~~ recTs ~~ rec_result_Ts)) |>> |
270 parent_path flat_names; |
270 parent_path flat_names; |
342 val def = ((Sign.base_name name) ^ "_def", |
342 val def = ((Sign.base_name name) ^ "_def", |
343 Logic.mk_equals (list_comb (Const (name, caseT), fns1), |
343 Logic.mk_equals (list_comb (Const (name, caseT), fns1), |
344 list_comb (reccomb, (flat (take (i, case_dummy_fns))) @ |
344 list_comb (reccomb, (flat (take (i, case_dummy_fns))) @ |
345 fns2 @ (flat (drop (i + 1, case_dummy_fns))) ))); |
345 fns2 @ (flat (drop (i + 1, case_dummy_fns))) ))); |
346 val (thy', [def_thm]) = thy |> |
346 val (thy', [def_thm]) = thy |> |
347 Theory.add_consts_i [decl] |> (PureThy.add_defs_i o map Thm.no_attributes) [def]; |
347 Theory.add_consts_i [decl] |> (PureThy.add_defs_i false o map Thm.no_attributes) [def]; |
348 |
348 |
349 in (defs @ [def_thm], thy') |
349 in (defs @ [def_thm], thy') |
350 end) (([], thy1), (hd descr) ~~ newTs ~~ case_names ~~ |
350 end) (([], thy1), (hd descr) ~~ newTs ~~ case_names ~~ |
351 (take (length newTs, reccomb_names))); |
351 (take (length newTs, reccomb_names))); |
352 |
352 |
444 |
444 |
445 val (thy', size_def_thms) = thy1 |> |
445 val (thy', size_def_thms) = thy1 |> |
446 Theory.add_consts_i (map (fn (s, T) => |
446 Theory.add_consts_i (map (fn (s, T) => |
447 (Sign.base_name s, T --> HOLogic.natT, NoSyn)) |
447 (Sign.base_name s, T --> HOLogic.natT, NoSyn)) |
448 (drop (length (hd descr), size_names ~~ recTs))) |> |
448 (drop (length (hd descr), size_names ~~ recTs))) |> |
449 (PureThy.add_defs_i o map Thm.no_attributes) (map (fn (((s, T), def_name), rec_name) => |
449 (PureThy.add_defs_i true o map Thm.no_attributes) (map (fn (((s, T), def_name), rec_name) => |
450 (def_name, Logic.mk_equals (Const (s, T --> HOLogic.natT), |
450 (def_name, Logic.mk_equals (Const (s, T --> HOLogic.natT), |
451 list_comb (Const (rec_name, fTs @ [T] ---> HOLogic.natT), fs)))) |
451 list_comb (Const (rec_name, fTs @ [T] ---> HOLogic.natT), fs)))) |
452 (size_names ~~ recTs ~~ def_names ~~ reccomb_names)) |>> |
452 (size_names ~~ recTs ~~ def_names ~~ reccomb_names)) |>> |
453 parent_path flat_names; |
453 parent_path flat_names; |
454 |
454 |