src/HOL/Tools/Nitpick/nitpick.ML
changeset 40132 7ee65dbffa31
parent 39361 520ea38711e4
child 40223 9f001f7e6c0c
equal deleted inserted replaced
40131:7cbebd636e79 40132:7ee65dbffa31
   214       if auto then
   214       if auto then
   215         Unsynchronized.change state_ref o Proof.goal_message o K
   215         Unsynchronized.change state_ref o Proof.goal_message o K
   216         o Pretty.chunks o cons (Pretty.str "") o single
   216         o Pretty.chunks o cons (Pretty.str "") o single
   217         o Pretty.mark Markup.hilite
   217         o Pretty.mark Markup.hilite
   218       else
   218       else
   219         (fn s => (priority s; if debug then tracing s else ()))
   219         (fn s => (Output.urgent_message s; if debug then tracing s else ()))
   220         o Pretty.string_of
   220         o Pretty.string_of
   221     fun pprint_m f = () |> not auto ? pprint o f
   221     fun pprint_m f = () |> not auto ? pprint o f
   222     fun pprint_v f = () |> verbose ? pprint o f
   222     fun pprint_v f = () |> verbose ? pprint o f
   223     fun pprint_d f = () |> debug ? pprint o f
   223     fun pprint_d f = () |> debug ? pprint o f
   224     val print = pprint o curry Pretty.blk 0 o pstrs
   224     val print = pprint o curry Pretty.blk 0 o pstrs
   987   handle Exn.Interrupt =>
   987   handle Exn.Interrupt =>
   988          if auto orelse #debug params then
   988          if auto orelse #debug params then
   989            raise Interrupt
   989            raise Interrupt
   990          else
   990          else
   991            if passed_deadline deadline then
   991            if passed_deadline deadline then
   992              (priority "Nitpick ran out of time."; ("unknown", state))
   992              (Output.urgent_message "Nitpick ran out of time."; ("unknown", state))
   993            else
   993            else
   994              error "Nitpick was interrupted."
   994              error "Nitpick was interrupted."
   995 
   995 
   996 fun pick_nits_in_term state (params as {debug, timeout, expect, ...}) auto i n
   996 fun pick_nits_in_term state (params as {debug, timeout, expect, ...}) auto i n
   997                       step subst assm_ts orig_t =
   997                       step subst assm_ts orig_t =
  1038   let
  1038   let
  1039     val ctxt = Proof.context_of state
  1039     val ctxt = Proof.context_of state
  1040     val t = state |> Proof.raw_goal |> #goal |> prop_of
  1040     val t = state |> Proof.raw_goal |> #goal |> prop_of
  1041   in
  1041   in
  1042     case Logic.count_prems t of
  1042     case Logic.count_prems t of
  1043       0 => (priority "No subgoal!"; ("none", state))
  1043       0 => (Output.urgent_message "No subgoal!"; ("none", state))
  1044     | n =>
  1044     | n =>
  1045       let
  1045       let
  1046         val t = Logic.goal_params t i |> fst
  1046         val t = Logic.goal_params t i |> fst
  1047         val assms = map term_of (Assumption.all_assms_of ctxt)
  1047         val assms = map term_of (Assumption.all_assms_of ctxt)
  1048         val (subst, assms, t) = extract_fixed_frees ctxt (assms, t)
  1048         val (subst, assms, t) = extract_fixed_frees ctxt (assms, t)