src/Pure/variable.ML
changeset 81543 fa37ee54644c
parent 81521 1bfad73ab115
child 81545 6f8a56a6b391
equal deleted inserted replaced
81542:e2ab4147b244 81543:fa37ee54644c
   324 fun revert_bounds ctxt t =
   324 fun revert_bounds ctxt t =
   325   (case #2 (#bounds (rep_data ctxt)) of
   325   (case #2 (#bounds (rep_data ctxt)) of
   326     [] => t
   326     [] => t
   327   | bounds =>
   327   | bounds =>
   328       let
   328       let
   329         val names = Term.declare_term_names t (names_of ctxt);
   329         val names = Term.declare_free_names t (names_of ctxt);
   330         val xs = rev (Name.variants names (rev (map #2 bounds)));
   330         val xs = rev (Name.variants names (rev (map #2 bounds)));
   331         fun substs (((b, T), _), x') =
   331         fun substs (((b, T), _), x') =
   332           let fun subst U = (Free (b, U), Syntax_Trans.mark_bound_abs (x', U))
   332           let fun subst U = (Free (b, U), Syntax_Trans.mark_bound_abs (x', U))
   333           in [subst T, subst (Type_Annotation.ignore_type T)] end;
   333           in [subst T, subst (Type_Annotation.ignore_type T)] end;
   334       in Term.subst_atomic (maps substs (bounds ~~ xs)) t end);
   334       in Term.subst_atomic (maps substs (bounds ~~ xs)) t end);
   703 val set_bound_focus = Config.put bound_focus;
   703 val set_bound_focus = Config.put bound_focus;
   704 val restore_bound_focus = set_bound_focus o is_bound_focus;
   704 val restore_bound_focus = set_bound_focus o is_bound_focus;
   705 
   705 
   706 fun focus_params bindings t ctxt =
   706 fun focus_params bindings t ctxt =
   707   let
   707   let
   708     val ps = Term.variant_frees t (Term.strip_all_vars t);  (*as they are printed :-*)
   708     val ps = Term.variant_bounds t (Term.strip_all_vars t);
   709     val (xs, Ts) = split_list ps;
   709     val (xs, Ts) = split_list ps;
   710     val (xs', ctxt') =
   710     val (xs', ctxt') =
   711       (case bindings of
   711       (case bindings of
   712         SOME bs => ctxt |> set_body true |> add_fixes_binding bs ||> restore_body ctxt
   712         SOME bs => ctxt |> set_body true |> add_fixes_binding bs ||> restore_body ctxt
   713       | NONE => if is_bound_focus ctxt then bound_fixes ps ctxt else variant_fixes xs ctxt);
   713       | NONE => if is_bound_focus ctxt then bound_fixes ps ctxt else variant_fixes xs ctxt);