equal
deleted
inserted
replaced
596 | Free (a, _) => Name.declare a |
596 | Free (a, _) => Name.declare a |
597 | _ => I) tm #> |
597 | _ => I) tm #> |
598 declare_tfree_names tm; |
598 declare_tfree_names tm; |
599 |
599 |
600 fun variant_frees t frees = |
600 fun variant_frees t frees = |
601 fst (fold_map Name.variant (map fst frees) (declare_term_names t Name.context)) ~~ |
601 #1 (fold_map Name.variant (map fst frees) (Name.build_context (declare_term_names t))) ~~ |
602 map snd frees; |
602 map #2 frees; |
603 |
603 |
604 fun rename_wrt_term t frees = rev (variant_frees t frees); (*reversed result!*) |
604 fun rename_wrt_term t frees = rev (variant_frees t frees); (*reversed result!*) |
605 |
605 |
606 |
606 |
607 (* sorts *) |
607 (* sorts *) |
810 |
810 |
811 (*unfolding abstractions with substitution |
811 (*unfolding abstractions with substitution |
812 of bound variables and implicit eta-expansion*) |
812 of bound variables and implicit eta-expansion*) |
813 fun strip_abs_eta k t = |
813 fun strip_abs_eta k t = |
814 let |
814 let |
815 val used = fold_aterms declare_free_names t Name.context; |
815 val used = Name.build_context (fold_aterms declare_free_names t); |
816 fun strip_abs t (0, used) = (([], t), (0, used)) |
816 fun strip_abs t (0, used) = (([], t), (0, used)) |
817 | strip_abs (Abs (v, T, t)) (k, used) = |
817 | strip_abs (Abs (v, T, t)) (k, used) = |
818 let |
818 let |
819 val (v', used') = Name.variant v used; |
819 val (v', used') = Name.variant v used; |
820 val t' = subst_bound (Free (v', T), t); |
820 val t' = subst_bound (Free (v', T), t); |