src/Pure/term.ML
changeset 35986 b7fcca3d9a44
parent 35227 d67857e3a8c0
child 38980 af73cf0dc31f
equal deleted inserted replaced
35985:0bbf0d2348f9 35986:b7fcca3d9a44
    70   val map_aterms: (term -> term) -> term -> term
    70   val map_aterms: (term -> term) -> term -> term
    71   val map_type_tvar: (indexname * sort -> typ) -> typ -> typ
    71   val map_type_tvar: (indexname * sort -> typ) -> typ -> typ
    72   val map_type_tfree: (string * sort -> typ) -> typ -> typ
    72   val map_type_tfree: (string * sort -> typ) -> typ -> typ
    73   val map_types: (typ -> typ) -> term -> term
    73   val map_types: (typ -> typ) -> term -> term
    74   val fold_atyps: (typ -> 'a -> 'a) -> typ -> 'a -> 'a
    74   val fold_atyps: (typ -> 'a -> 'a) -> typ -> 'a -> 'a
       
    75   val fold_atyps_sorts: (typ * sort -> 'a -> 'a) -> typ -> 'a -> 'a
    75   val fold_aterms: (term -> 'a -> 'a) -> term -> 'a -> 'a
    76   val fold_aterms: (term -> 'a -> 'a) -> term -> 'a -> 'a
    76   val fold_term_types: (term -> typ -> 'a -> 'a) -> term -> 'a -> 'a
    77   val fold_term_types: (term -> typ -> 'a -> 'a) -> term -> 'a -> 'a
    77   val fold_types: (typ -> 'a -> 'a) -> term -> 'a -> 'a
    78   val fold_types: (typ -> 'a -> 'a) -> term -> 'a -> 'a
    78   val burrow_types: (typ list -> typ list) -> term list -> term list
    79   val burrow_types: (typ list -> typ list) -> term list -> term list
    79   val aconv: term * term -> bool
    80   val aconv: term * term -> bool
   429 (* fold types and terms *)
   430 (* fold types and terms *)
   430 
   431 
   431 fun fold_atyps f (Type (_, Ts)) = fold (fold_atyps f) Ts
   432 fun fold_atyps f (Type (_, Ts)) = fold (fold_atyps f) Ts
   432   | fold_atyps f T = f T;
   433   | fold_atyps f T = f T;
   433 
   434 
       
   435 fun fold_atyps_sorts f =
       
   436   fold_atyps (fn T as TFree (_, S) => f (T, S) | T as TVar (_, S) => f (T, S));
       
   437 
   434 fun fold_aterms f (t $ u) = fold_aterms f t #> fold_aterms f u
   438 fun fold_aterms f (t $ u) = fold_aterms f t #> fold_aterms f u
   435   | fold_aterms f (Abs (_, _, t)) = fold_aterms f t
   439   | fold_aterms f (Abs (_, _, t)) = fold_aterms f t
   436   | fold_aterms f a = f a;
   440   | fold_aterms f a = f a;
   437 
   441 
   438 fun fold_term_types f (t as Const (_, T)) = f t T
   442 fun fold_term_types f (t as Const (_, T)) = f t T