432 Graph.fold (cons o entry) classes [] |
432 Graph.fold (cons o entry) classes [] |
433 |> sort (int_ord o pairself #1) |> map #2; |
433 |> sort (int_ord o pairself #1) |> map #2; |
434 in Present.display_graph gr end); |
434 in Present.display_graph gr end); |
435 |
435 |
436 fun thm_deps args = Toplevel.unknown_theory o Toplevel.keep (fn state => |
436 fun thm_deps args = Toplevel.unknown_theory o Toplevel.keep (fn state => |
437 Thm_Deps.thm_deps (Proof.get_thmss_cmd (Toplevel.enter_proof_body state) args)); |
437 Thm_Deps.thm_deps (Toplevel.theory_of state) |
|
438 (Proof.get_thmss_cmd (Toplevel.enter_proof_body state) args)); |
438 |
439 |
439 |
440 |
440 (* find unused theorems *) |
441 (* find unused theorems *) |
441 |
442 |
442 fun unused_thms opt_range = Toplevel.keep (fn state => |
443 fun unused_thms opt_range = Toplevel.keep (fn state => |
443 let |
444 let |
444 val thy = Toplevel.theory_of state; |
445 val thy = Toplevel.theory_of state; |
445 val ctxt = Toplevel.context_of state; |
446 val ctxt = Toplevel.context_of state; |
446 fun pretty_thm (a, th) = ProofContext.pretty_fact ctxt (a, [th]); |
447 fun pretty_thm (a, th) = ProofContext.pretty_fact ctxt (a, [th]); |
|
448 val get_theory = Context.get_theory thy; |
447 in |
449 in |
448 Thm_Deps.unused_thms |
450 Thm_Deps.unused_thms |
449 (case opt_range of |
451 (case opt_range of |
450 NONE => (Theory.parents_of thy, [thy]) |
452 NONE => (Theory.parents_of thy, [thy]) |
451 | SOME (xs, NONE) => (map Thy_Info.get_theory xs, [thy]) |
453 | SOME (xs, NONE) => (map get_theory xs, [thy]) |
452 | SOME (xs, SOME ys) => (map Thy_Info.get_theory xs, map Thy_Info.get_theory ys)) |
454 | SOME (xs, SOME ys) => (map get_theory xs, map get_theory ys)) |
453 |> map pretty_thm |> Pretty.chunks |> Pretty.writeln |
455 |> map pretty_thm |> Pretty.chunks |> Pretty.writeln |
454 end); |
456 end); |
455 |
457 |
456 |
458 |
457 (* print proof context contents *) |
459 (* print proof context contents *) |