src/Pure/Syntax/type_ext.ML
changeset 22764 ccbd31bc1ef7
parent 22704 f67607c3e56e
child 23167 b9bbdf7eab3b
equal deleted inserted replaced
22763:5c1752279f25 22764:ccbd31bc1ef7
     9 signature TYPE_EXT0 =
     9 signature TYPE_EXT0 =
    10 sig
    10 sig
    11   val sort_of_term: (sort -> sort) -> term -> sort
    11   val sort_of_term: (sort -> sort) -> term -> sort
    12   val term_sorts: (sort -> sort) -> term -> (indexname * sort) list
    12   val term_sorts: (sort -> sort) -> term -> (indexname * sort) list
    13   val typ_of_term: (indexname -> sort) -> (sort -> sort) -> term -> typ
    13   val typ_of_term: (indexname -> sort) -> (sort -> sort) -> term -> typ
    14   val decode_types: (((string * int) * sort) list -> string * int -> sort) ->
    14   val decode_term: (((string * int) * sort) list -> string * int -> sort) ->
    15     (string -> string option) -> (string -> string option) ->
    15     (string -> string option) -> (string -> string option) ->
    16     (typ -> typ) -> (sort -> sort) -> term -> term
    16     (typ -> typ) -> (sort -> sort) -> term -> term
    17   val term_of_typ: bool -> typ -> term
    17   val term_of_typ: bool -> typ -> term
    18   val no_brackets: unit -> bool
    18   val no_brackets: unit -> bool
    19   val no_type_brackets: unit -> bool
    19   val no_type_brackets: unit -> bool
    99               | _ => raise TERM ("typ_of_term: bad encoding of type", [tm]));
    99               | _ => raise TERM ("typ_of_term: bad encoding of type", [tm]));
   100           in Type (a, map typ_of ts) end;
   100           in Type (a, map typ_of ts) end;
   101   in typ_of t end;
   101   in typ_of t end;
   102 
   102 
   103 
   103 
   104 (* decode_types -- transform parse tree into raw term *)
   104 (* decode_term -- transform parse tree into raw term *)
   105 
   105 
   106 fun decode_types get_sort map_const map_free map_type map_sort tm =
   106 fun decode_term get_sort map_const map_free map_type map_sort tm =
   107   let
   107   let
   108     val sort_env = term_sorts map_sort tm;
   108     val sort_env = term_sorts map_sort tm;
   109     val decodeT = map_type o typ_of_term (get_sort sort_env) map_sort;
   109     val decodeT = map_type o typ_of_term (get_sort sort_env) map_sort;
   110 
   110 
   111     fun decode (Const ("_constrain", _) $ t $ typ) =
   111     fun decode (Const ("_constrain", _) $ t $ typ) =