602 [] => () |
602 [] => () |
603 | frees => Proof_Display.print_consts true lthy (K false) frees; |
603 | frees => Proof_Display.print_consts true lthy (K false) frees; |
604 |
604 |
605 val bnf_map = Morphism.term phi bnf_map_term; |
605 val bnf_map = Morphism.term phi bnf_map_term; |
606 |
606 |
607 fun iter_split ((Ts, T1), T2) = if length Ts < live then error "Bad map function" |
|
608 else if length Ts = live then ((Ts, T1), T2) |
|
609 else iter_split (split_last Ts, T1 --> T2); |
|
610 |
|
611 (*TODO: handle errors*) |
607 (*TODO: handle errors*) |
612 (*simple shape analysis of a map function*) |
608 (*simple shape analysis of a map function*) |
613 val (((alphas, betas), CA), _) = |
609 val ((alphas, betas), (CA, _)) = |
614 apfst (apfst (map_split dest_funT)) |
610 fastype_of bnf_map |
615 (iter_split (apfst split_last (strip_type (fastype_of bnf_map)))); |
611 |> strip_typeN live |
|
612 |>> map_split dest_funT |
|
613 ||> dest_funT |
|
614 handle TYPE _ => error "Bad map function"; |
616 |
615 |
617 val CA_params = map TVar (Term.add_tvarsT CA []); |
616 val CA_params = map TVar (Term.add_tvarsT CA []); |
618 |
617 |
619 val bnf_sets = map2 (normalize_set CA_params) alphas (map (Morphism.term phi) bnf_set_terms); |
618 val bnf_sets = map2 (normalize_set CA_params) alphas (map (Morphism.term phi) bnf_set_terms); |
620 val bdT = Morphism.typ phi bd_rhsT; |
619 val bdT = Morphism.typ phi bd_rhsT; |