src/Pure/type.ML
changeset 1215 a206f722bef9
parent 963 7a78fda77104
child 1239 2c0d94151e74
equal deleted inserted replaced
1214:3f3888213ceb 1215:a206f722bef9
    36   val ext_tsig_arities: type_sig -> (string * sort list * sort)list -> type_sig
    36   val ext_tsig_arities: type_sig -> (string * sort list * sort)list -> type_sig
    37   val merge_tsigs: type_sig * type_sig -> type_sig
    37   val merge_tsigs: type_sig * type_sig -> type_sig
    38   val subsort: type_sig -> sort * sort -> bool
    38   val subsort: type_sig -> sort * sort -> bool
    39   val norm_sort: type_sig -> sort -> sort
    39   val norm_sort: type_sig -> sort -> sort
    40   val rem_sorts: typ -> typ
    40   val rem_sorts: typ -> typ
       
    41   val nonempty_sort: type_sig -> (string * sort) list -> sort -> bool
    41   val cert_typ: type_sig -> typ -> typ
    42   val cert_typ: type_sig -> typ -> typ
    42   val norm_typ: type_sig -> typ -> typ
    43   val norm_typ: type_sig -> typ -> typ
    43   val freeze: term -> term
    44   val freeze: term -> term
    44   val freeze_vars: typ -> typ
    45   val freeze_vars: typ -> typ
    45   val infer_types: type_sig * (string -> typ option) *
    46   val infer_types: type_sig * (string -> typ option) *
   395   sort_strings (min_sort subclass S);
   396   sort_strings (min_sort subclass S);
   396 
   397 
   397 fun rem_sorts (Type (a, tys)) = Type (a, map rem_sorts tys)
   398 fun rem_sorts (Type (a, tys)) = Type (a, map rem_sorts tys)
   398   | rem_sorts (TFree (x, _)) = TFree (x, [])
   399   | rem_sorts (TFree (x, _)) = TFree (x, [])
   399   | rem_sorts (TVar (xi, _)) = TVar (xi, []);
   400   | rem_sorts (TVar (xi, _)) = TVar (xi, []);
       
   401 
       
   402 
       
   403 (* nonempty_sort *)
       
   404 
       
   405 (* FIXME improve: proper sorts; non-base, non-ground types (vars from hyps) *)
       
   406 fun nonempty_sort _ _ [] = true
       
   407   | nonempty_sort (tsig as TySg {arities, ...}) hyps S =
       
   408       exists (exists (fn (c, ss) => [c] = S andalso null ss) o snd) arities
       
   409         orelse exists (fn (_, S') => subsort tsig (S', S)) hyps;
       
   410 
   400 
   411 
   401 
   412 
   402 (* typ_errors *)
   413 (* typ_errors *)
   403 
   414 
   404 (*check validity of (not necessarily normal) type; accumulate error messages*)
   415 (*check validity of (not necessarily normal) type; accumulate error messages*)