src/Pure/Isar/isar_cmd.ML
changeset 57934 5e500c0e7eca
parent 57683 cc0aa6528890
child 58011 bc6bced136e5
equal deleted inserted replaced
57931:4e2cbff02f23 57934:5e500c0e7eca
    37   val diag_goal: Proof.context -> {context: Proof.context, facts: thm list, goal: thm}
    37   val diag_goal: Proof.context -> {context: Proof.context, facts: thm list, goal: thm}
    38   val pretty_theorems: bool -> Toplevel.state -> Pretty.T list
    38   val pretty_theorems: bool -> Toplevel.state -> Pretty.T list
    39   val thy_deps: Toplevel.transition -> Toplevel.transition
    39   val thy_deps: Toplevel.transition -> Toplevel.transition
    40   val locale_deps: Toplevel.transition -> Toplevel.transition
    40   val locale_deps: Toplevel.transition -> Toplevel.transition
    41   val class_deps: Toplevel.transition -> Toplevel.transition
    41   val class_deps: Toplevel.transition -> Toplevel.transition
    42   val thm_deps: (Facts.ref * Attrib.src list) list -> Toplevel.transition -> Toplevel.transition
       
    43   val unused_thms: (string list * string list option) option ->
       
    44     Toplevel.transition -> Toplevel.transition
       
    45   val print_stmts: string list * (Facts.ref * Attrib.src list) list
    42   val print_stmts: string list * (Facts.ref * Attrib.src list) list
    46     -> Toplevel.transition -> Toplevel.transition
    43     -> Toplevel.transition -> Toplevel.transition
    47   val print_thms: string list * (Facts.ref * Attrib.src list) list
    44   val print_thms: string list * (Facts.ref * Attrib.src list) list
    48     -> Toplevel.transition -> Toplevel.transition
    45     -> Toplevel.transition -> Toplevel.transition
    49   val print_prfs: bool -> string list * (Facts.ref * Attrib.src list) list option
    46   val print_prfs: bool -> string list * (Facts.ref * Attrib.src list) list option
   311             dir = "", unfold = true, path = "", content = []});
   308             dir = "", unfold = true, path = "", content = []});
   312     val gr =
   309     val gr =
   313       Graph.fold (cons o entry) classes []
   310       Graph.fold (cons o entry) classes []
   314       |> sort (int_ord o pairself #1) |> map #2;
   311       |> sort (int_ord o pairself #1) |> map #2;
   315   in Graph_Display.display_graph gr end);
   312   in Graph_Display.display_graph gr end);
   316 
       
   317 fun thm_deps args = Toplevel.unknown_theory o Toplevel.keep (fn state =>
       
   318   Thm_Deps.thm_deps (Toplevel.theory_of state)
       
   319     (Attrib.eval_thms (Toplevel.context_of state) args));
       
   320 
       
   321 
       
   322 (* find unused theorems *)
       
   323 
       
   324 fun unused_thms opt_range = Toplevel.keep (fn state =>
       
   325   let
       
   326     val thy = Toplevel.theory_of state;
       
   327     val ctxt = Toplevel.context_of state;
       
   328     fun pretty_thm (a, th) = Proof_Context.pretty_fact ctxt (a, [th]);
       
   329     val get_theory = Context.get_theory thy;
       
   330   in
       
   331     Thm_Deps.unused_thms
       
   332       (case opt_range of
       
   333         NONE => (Theory.parents_of thy, [thy])
       
   334       | SOME (xs, NONE) => (map get_theory xs, [thy])
       
   335       | SOME (xs, SOME ys) => (map get_theory xs, map get_theory ys))
       
   336     |> map pretty_thm |> Pretty.writeln_chunks
       
   337   end);
       
   338 
   313 
   339 
   314 
   340 (* print theorems, terms, types etc. *)
   315 (* print theorems, terms, types etc. *)
   341 
   316 
   342 local
   317 local