src/Pure/type.ML
changeset 74266 612b7e0d6721
parent 74234 4f2bd13edce3
child 74411 20b0b27bc6c7
equal deleted inserted replaced
74265:633fe7390c97 74266:612b7e0d6721
    59   (*special treatment of type vars*)
    59   (*special treatment of type vars*)
    60   val sort_of_atyp: typ -> sort
    60   val sort_of_atyp: typ -> sort
    61   val strip_sorts: typ -> typ
    61   val strip_sorts: typ -> typ
    62   val strip_sorts_dummy: typ -> typ
    62   val strip_sorts_dummy: typ -> typ
    63   val no_tvars: typ -> typ
    63   val no_tvars: typ -> typ
    64   val varify_global: Term_Subst.TFrees.set -> term -> ((string * sort) * indexname) list * term
    64   val varify_global: TFrees.set -> term -> ((string * sort) * indexname) list * term
    65   val legacy_freeze_thaw_type: typ -> typ * (typ -> typ)
    65   val legacy_freeze_thaw_type: typ -> typ * (typ -> typ)
    66   val legacy_freeze_type: typ -> typ
    66   val legacy_freeze_type: typ -> typ
    67   val legacy_freeze_thaw: term -> term * (term -> term)
    67   val legacy_freeze_thaw: term -> term * (term -> term)
    68   val legacy_freeze: term -> term
    68   val legacy_freeze: term -> term
    69 
    69 
   355 
   355 
   356 fun varify_global fixed t =
   356 fun varify_global fixed t =
   357   let
   357   let
   358     val fs =
   358     val fs =
   359       build (t |> (Term.fold_types o Term.fold_atyps)
   359       build (t |> (Term.fold_types o Term.fold_atyps)
   360         (fn TFree v => if Term_Subst.TFrees.defined fixed v then I else insert (op =) v | _ => I));
   360         (fn TFree v => if TFrees.defined fixed v then I else insert (op =) v | _ => I));
   361     val used = Name.context
   361     val used = Name.context
   362       |> fold_types (fold_atyps (fn TVar ((a, _), _) => Name.declare a | _ => I)) t;
   362       |> fold_types (fold_atyps (fn TVar ((a, _), _) => Name.declare a | _ => I)) t;
   363     val fmap = fs ~~ map (rpair 0) (#1 (fold_map Name.variant (map fst fs) used));
   363     val fmap = fs ~~ map (rpair 0) (#1 (fold_map Name.variant (map fst fs) used));
   364     fun thaw (f as (_, S)) =
   364     fun thaw (f as (_, S)) =
   365       (case AList.lookup (op =) fmap f of
   365       (case AList.lookup (op =) fmap f of