src/Tools/misc_legacy.ML
changeset 74269 f084d599bb44
parent 74266 612b7e0d6721
child 74272 0f3ca0cd8071
equal deleted inserted replaced
74268:d01920a8b082 74269:f084d599bb44
     3 Misc legacy stuff -- to be phased out eventually.
     3 Misc legacy stuff -- to be phased out eventually.
     4 *)
     4 *)
     5 
     5 
     6 signature MISC_LEGACY =
     6 signature MISC_LEGACY =
     7 sig
     7 sig
     8   val thm_frees: thm -> cterm list
     8   val thm_frees: thm -> Cterms.set
     9   val cterm_frees: cterm -> cterm list
     9   val cterm_frees: cterm -> Cterms.set
    10   val add_term_names: term * string list -> string list
    10   val add_term_names: term * string list -> string list
    11   val add_term_tvars: term * (indexname * sort) list -> (indexname * sort) list
    11   val add_term_tvars: term * (indexname * sort) list -> (indexname * sort) list
    12   val add_term_tfrees: term * (string * sort) list -> (string * sort) list
    12   val add_term_tfrees: term * (string * sort) list -> (string * sort) list
    13   val typ_tvars: typ -> (indexname * sort) list
    13   val typ_tvars: typ -> (indexname * sort) list
    14   val term_tfrees: term -> (string * sort) list
    14   val term_tfrees: term -> (string * sort) list
    24 end;
    24 end;
    25 
    25 
    26 structure Misc_Legacy: MISC_LEGACY =
    26 structure Misc_Legacy: MISC_LEGACY =
    27 struct
    27 struct
    28 
    28 
    29 fun thm_frees th =
    29 val thm_frees = Cterms.build o Thm.fold_atomic_cterms {hyps = true} Term.is_Free Cterms.add_set;
    30   (th, (Frees.empty, [])) |-> Thm.fold_atomic_cterms {hyps = true} Term.is_Free
       
    31     (fn ct => fn (set, list) =>
       
    32       let val v = Term.dest_Free (Thm.term_of ct) in
       
    33         if not (Frees.defined set v)
       
    34         then (Frees.add_set v set, ct :: list)
       
    35         else (set, list)
       
    36       end)
       
    37   |> #2;
       
    38 
       
    39 val cterm_frees = thm_frees o Drule.mk_term;
    30 val cterm_frees = thm_frees o Drule.mk_term;
    40 
    31 
    41 (*iterate a function over all types in a term*)
    32 (*iterate a function over all types in a term*)
    42 fun it_term_types f =
    33 fun it_term_types f =
    43 let fun iter(Const(_,T), a) = f(T,a)
    34 let fun iter(Const(_,T), a) = f(T,a)