equal
deleted
inserted
replaced
542 let |
542 let |
543 val nn = length fpTs; |
543 val nn = length fpTs; |
544 |
544 |
545 val fpT_to_C as Type (_, [fpT, _]) = snd (strip_typeN nn (fastype_of (hd ctor_iters))); |
545 val fpT_to_C as Type (_, [fpT, _]) = snd (strip_typeN nn (fastype_of (hd ctor_iters))); |
546 |
546 |
547 fun generate_iter suf (f_Tss, _, fss, xssss) ctor_iter = |
547 fun generate_iter pre (f_Tss, _, fss, xssss) ctor_iter = |
548 let |
548 let |
549 val res_T = fold_rev (curry (op --->)) f_Tss fpT_to_C; |
549 val res_T = fold_rev (curry (op --->)) f_Tss fpT_to_C; |
550 val b = mk_binding suf; |
550 val b = mk_binding pre; |
551 val spec = |
551 val spec = |
552 mk_Trueprop_eq (lists_bmoc fss (Free (Binding.name_of b, res_T)), |
552 mk_Trueprop_eq (lists_bmoc fss (Free (Binding.name_of b, res_T)), |
553 mk_iter_body ctor_iter fss xssss); |
553 mk_iter_body ctor_iter fss xssss); |
554 in (b, spec) end; |
554 in (b, spec) end; |
555 in |
555 in |
561 let |
561 let |
562 val nn = length fpTs; |
562 val nn = length fpTs; |
563 |
563 |
564 val C_to_fpT as Type (_, [_, fpT]) = snd (strip_typeN nn (fastype_of (hd dtor_coiters))); |
564 val C_to_fpT as Type (_, [_, fpT]) = snd (strip_typeN nn (fastype_of (hd dtor_coiters))); |
565 |
565 |
566 fun generate_coiter suf ((pfss, cqfsss), (f_sum_prod_Ts, pf_Tss)) dtor_coiter = |
566 fun generate_coiter pre ((pfss, cqfsss), (f_sum_prod_Ts, pf_Tss)) dtor_coiter = |
567 let |
567 let |
568 val res_T = fold_rev (curry (op --->)) pf_Tss C_to_fpT; |
568 val res_T = fold_rev (curry (op --->)) pf_Tss C_to_fpT; |
569 val b = mk_binding suf; |
569 val b = mk_binding pre; |
570 val spec = |
570 val spec = |
571 mk_Trueprop_eq (lists_bmoc pfss (Free (Binding.name_of b, res_T)), |
571 mk_Trueprop_eq (lists_bmoc pfss (Free (Binding.name_of b, res_T)), |
572 mk_coiter_body cs cpss f_sum_prod_Ts cqfsss dtor_coiter); |
572 mk_coiter_body cs cpss f_sum_prod_Ts cqfsss dtor_coiter); |
573 in (b, spec) end; |
573 in (b, spec) end; |
574 in |
574 in |
1354 in |
1354 in |
1355 (((map_thms, rel_inject_thms, rel_distinct_thms, set_thmss), ctr_sugar), |
1355 (((map_thms, rel_inject_thms, rel_distinct_thms, set_thmss), ctr_sugar), |
1356 lthy |> Local_Theory.notes (anonymous_notes @ notes) |> snd) |
1356 lthy |> Local_Theory.notes (anonymous_notes @ notes) |> snd) |
1357 end; |
1357 end; |
1358 |
1358 |
1359 fun mk_binding suf = qualify false fp_b_name (Binding.suffix_name ("_" ^ suf) fp_b); |
1359 fun mk_binding pre = qualify false fp_b_name (Binding.prefix_name (pre ^ "_") fp_b); |
1360 |
1360 |
1361 fun massage_res (((maps_sets_rels, ctr_sugar), co_iter_res), lthy) = |
1361 fun massage_res (((maps_sets_rels, ctr_sugar), co_iter_res), lthy) = |
1362 (((maps_sets_rels, (ctrs, xss, ctr_defs, ctr_sugar)), co_iter_res), lthy); |
1362 (((maps_sets_rels, (ctrs, xss, ctr_defs, ctr_sugar)), co_iter_res), lthy); |
1363 in |
1363 in |
1364 (wrap_ctrs |
1364 (wrap_ctrs |