src/Pure/Syntax/type_ext.ML
changeset 42052 34f1d2d81284
parent 42050 5a505dfec04e
child 42053 006095137a81
equal deleted inserted replaced
42051:dbdd4790da34 42052:34f1d2d81284
     8 sig
     8 sig
     9   val sort_of_term: term -> sort
     9   val sort_of_term: term -> sort
    10   val term_sorts: term -> (indexname * sort) list
    10   val term_sorts: term -> (indexname * sort) list
    11   val typ_of_term: (indexname -> sort) -> term -> typ
    11   val typ_of_term: (indexname -> sort) -> term -> typ
    12   val strip_positions: term -> term
    12   val strip_positions: term -> term
       
    13   val strip_positions_ast: Ast.ast -> Ast.ast
    13   val decode_term: (((string * int) * sort) list -> string * int -> sort) ->
    14   val decode_term: (((string * int) * sort) list -> string * int -> sort) ->
    14     (string -> bool * string) -> (string -> string option) -> term -> term
    15     (string -> bool * string) -> (string -> string option) -> term -> term
    15   val term_of_typ: bool -> typ -> term
    16   val term_of_typ: bool -> typ -> term
    16   val no_brackets: unit -> bool
    17   val no_brackets: unit -> bool
    17   val no_type_brackets: unit -> bool
    18   val no_type_brackets: unit -> bool
   112       then strip_positions u
   113       then strip_positions u
   113       else t $ strip_positions u $ strip_positions v
   114       else t $ strip_positions u $ strip_positions v
   114   | strip_positions (t $ u) = strip_positions t $ strip_positions u
   115   | strip_positions (t $ u) = strip_positions t $ strip_positions u
   115   | strip_positions (Abs (x, T, t)) = Abs (x, T, strip_positions t)
   116   | strip_positions (Abs (x, T, t)) = Abs (x, T, strip_positions t)
   116   | strip_positions t = t;
   117   | strip_positions t = t;
       
   118 
       
   119 fun strip_positions_ast (Ast.Appl ((t as Ast.Constant c) :: u :: (v as Ast.Variable x) :: asts)) =
       
   120       if (c = "_constrain" orelse c = "_constrainAbs") andalso is_some (Lexicon.decode_position x)
       
   121       then Ast.mk_appl (strip_positions_ast u) (map strip_positions_ast asts)
       
   122       else Ast.Appl (map strip_positions_ast (t :: u :: v :: asts))
       
   123   | strip_positions_ast (Ast.Appl asts) = Ast.Appl (map strip_positions_ast asts)
       
   124   | strip_positions_ast ast = ast;
   117 
   125 
   118 
   126 
   119 (* decode_term -- transform parse tree into raw term *)
   127 (* decode_term -- transform parse tree into raw term *)
   120 
   128 
   121 fun decode_term get_sort map_const map_free tm =
   129 fun decode_term get_sort map_const map_free tm =