src/HOL/Tools/Nitpick/nitpick_util.ML
changeset 38652 e063be321438
parent 38240 a44d108a8d39
child 39118 12f3788be67b
equal deleted inserted replaced
38651:8aadda8e1338 38652:e063be321438
    50   val plural_s_for_list : 'a list -> string
    50   val plural_s_for_list : 'a list -> string
    51   val serial_commas : string -> string list -> string list
    51   val serial_commas : string -> string list -> string list
    52   val pretty_serial_commas : string -> Pretty.T list -> Pretty.T list
    52   val pretty_serial_commas : string -> Pretty.T list -> Pretty.T list
    53   val parse_bool_option : bool -> string -> string -> bool option
    53   val parse_bool_option : bool -> string -> string -> bool option
    54   val parse_time_option : string -> string -> Time.time option
    54   val parse_time_option : string -> string -> Time.time option
       
    55   val nat_subscript : int -> string
    55   val flip_polarity : polarity -> polarity
    56   val flip_polarity : polarity -> polarity
    56   val prop_T : typ
    57   val prop_T : typ
    57   val bool_T : typ
    58   val bool_T : typ
    58   val nat_T : typ
    59   val nat_T : typ
    59   val int_T : typ
    60   val int_T : typ
    65   val is_of_class_const : theory -> string * typ -> bool
    66   val is_of_class_const : theory -> string * typ -> bool
    66   val get_class_def : theory -> string -> (string * term) option
    67   val get_class_def : theory -> string -> (string * term) option
    67   val monomorphic_term : Type.tyenv -> term -> term
    68   val monomorphic_term : Type.tyenv -> term -> term
    68   val specialize_type : theory -> string * typ -> term -> term
    69   val specialize_type : theory -> string * typ -> term -> term
    69   val varify_type : Proof.context -> typ -> typ
    70   val varify_type : Proof.context -> typ -> typ
    70   val nat_subscript : int -> string
    71   val eta_expand : typ list -> term -> int -> term
    71   val time_limit : Time.time option -> ('a -> 'b) -> 'a -> 'b
    72   val time_limit : Time.time option -> ('a -> 'b) -> 'a -> 'b
    72   val DETERM_TIMEOUT : Time.time option -> tactic -> tactic
    73   val DETERM_TIMEOUT : Time.time option -> tactic -> tactic
    73   val setmp_show_all_types : ('a -> 'b) -> 'a -> 'b
    74   val setmp_show_all_types : ('a -> 'b) -> 'a -> 'b
    74   val indent_size : int
    75   val indent_size : int
    75   val pstrs : string -> Pretty.T list
    76   val pstrs : string -> Pretty.T list
   235     p :: Pretty.str "," :: Pretty.brk 1 :: pretty_serial_commas conj ps
   236     p :: Pretty.str "," :: Pretty.brk 1 :: pretty_serial_commas conj ps
   236 
   237 
   237 val parse_bool_option = Sledgehammer_Util.parse_bool_option
   238 val parse_bool_option = Sledgehammer_Util.parse_bool_option
   238 val parse_time_option = Sledgehammer_Util.parse_time_option
   239 val parse_time_option = Sledgehammer_Util.parse_time_option
   239 
   240 
   240 fun flip_polarity Pos = Neg
       
   241   | flip_polarity Neg = Pos
       
   242   | flip_polarity Neut = Neut
       
   243 
       
   244 val prop_T = @{typ prop}
       
   245 val bool_T = @{typ bool}
       
   246 val nat_T = @{typ nat}
       
   247 val int_T = @{typ int}
       
   248 
       
   249 val simple_string_of_typ = Refute.string_of_typ
       
   250 val is_real_constr = Refute.is_IDT_constructor
       
   251 val typ_of_dtyp = Refute.typ_of_dtyp
       
   252 val is_of_class_const = Refute.is_const_of_class
       
   253 val get_class_def = Refute.get_classdef
       
   254 val monomorphic_term = Sledgehammer_Util.monomorphic_term
       
   255 val specialize_type = Sledgehammer_Util.specialize_type
       
   256 
       
   257 fun varify_type ctxt T =
       
   258   Variable.polymorphic_types ctxt [Const (@{const_name undefined}, T)]
       
   259   |> snd |> the_single |> dest_Const |> snd
       
   260 
       
   261 val i_subscript = implode o map (prefix "\<^isub>") o explode
   241 val i_subscript = implode o map (prefix "\<^isub>") o explode
   262 fun be_subscript s = "\<^bsub>" ^ s ^ "\<^esub>"
   242 fun be_subscript s = "\<^bsub>" ^ s ^ "\<^esub>"
   263 fun nat_subscript n =
   243 fun nat_subscript n =
   264   let val s = signed_string_of_int n in
   244   let val s = signed_string_of_int n in
   265     if print_mode_active Symbol.xsymbolsN then
   245     if print_mode_active Symbol.xsymbolsN then
   268       (if n <= 9 then be_subscript else i_subscript) s
   248       (if n <= 9 then be_subscript else i_subscript) s
   269     else
   249     else
   270       s
   250       s
   271   end
   251   end
   272 
   252 
       
   253 fun flip_polarity Pos = Neg
       
   254   | flip_polarity Neg = Pos
       
   255   | flip_polarity Neut = Neut
       
   256 
       
   257 val prop_T = @{typ prop}
       
   258 val bool_T = @{typ bool}
       
   259 val nat_T = @{typ nat}
       
   260 val int_T = @{typ int}
       
   261 
       
   262 val simple_string_of_typ = Refute.string_of_typ
       
   263 val is_real_constr = Refute.is_IDT_constructor
       
   264 val typ_of_dtyp = Refute.typ_of_dtyp
       
   265 val is_of_class_const = Refute.is_const_of_class
       
   266 val get_class_def = Refute.get_classdef
       
   267 val monomorphic_term = Sledgehammer_Util.monomorphic_term
       
   268 val specialize_type = Sledgehammer_Util.specialize_type
       
   269 
       
   270 fun varify_type ctxt T =
       
   271   Variable.polymorphic_types ctxt [Const (@{const_name undefined}, T)]
       
   272   |> snd |> the_single |> dest_Const |> snd
       
   273 
       
   274 val eta_expand = Sledgehammer_Util.eta_expand
       
   275 
   273 fun time_limit NONE = I
   276 fun time_limit NONE = I
   274   | time_limit (SOME delay) = TimeLimit.timeLimit delay
   277   | time_limit (SOME delay) = TimeLimit.timeLimit delay
   275 
   278 
   276 fun DETERM_TIMEOUT delay tac st =
   279 fun DETERM_TIMEOUT delay tac st =
   277   Seq.of_list (the_list (time_limit delay (fn () => SINGLE tac st) ()))
   280   Seq.of_list (the_list (time_limit delay (fn () => SINGLE tac st) ()))