src/Pure/Tools/thm_deps.ML
changeset 59936 b8ffc3dc9e24
parent 59210 8658b4290aed
child 60084 2a066431a814
equal deleted inserted replaced
59935:343905de27b1 59936:b8ffc3dc9e24
    42     Proofterm.fold_body_thms add_dep (Thm.proof_bodies_of thms) []
    42     Proofterm.fold_body_thms add_dep (Thm.proof_bodies_of thms) []
    43     |> Graph_Display.display_graph
    43     |> Graph_Display.display_graph
    44   end;
    44   end;
    45 
    45 
    46 val _ =
    46 val _ =
    47   Outer_Syntax.command @{command_spec "thm_deps"} "visualize theorem dependencies"
    47   Outer_Syntax.command @{command_keyword thm_deps} "visualize theorem dependencies"
    48     (Parse.xthms1 >> (fn args =>
    48     (Parse.xthms1 >> (fn args =>
    49       Toplevel.unknown_theory o Toplevel.keep (fn state =>
    49       Toplevel.unknown_theory o Toplevel.keep (fn state =>
    50         thm_deps (Toplevel.theory_of state) (Attrib.eval_thms (Toplevel.context_of state) args))));
    50         thm_deps (Toplevel.theory_of state) (Attrib.eval_thms (Toplevel.context_of state) args))));
    51 
    51 
    52 
    52 
    99              else ((a, th) :: thms, Inttab.update (grp, ()) seen_groups))
    99              else ((a, th) :: thms, Inttab.update (grp, ()) seen_groups))
   100       else q) new_thms ([], Inttab.empty);
   100       else q) new_thms ([], Inttab.empty);
   101   in rev thms' end;
   101   in rev thms' end;
   102 
   102 
   103 val _ =
   103 val _ =
   104   Outer_Syntax.command @{command_spec "unused_thms"} "find unused theorems"
   104   Outer_Syntax.command @{command_keyword unused_thms} "find unused theorems"
   105     (Scan.option ((Scan.repeat1 (Scan.unless Parse.minus Parse.name) --| Parse.minus) --
   105     (Scan.option ((Scan.repeat1 (Scan.unless Parse.minus Parse.name) --| Parse.minus) --
   106        Scan.option (Scan.repeat1 (Scan.unless Parse.minus Parse.name))) >> (fn opt_range =>
   106        Scan.option (Scan.repeat1 (Scan.unless Parse.minus Parse.name))) >> (fn opt_range =>
   107         Toplevel.keep (fn state =>
   107         Toplevel.keep (fn state =>
   108           let
   108           let
   109             val thy = Toplevel.theory_of state;
   109             val thy = Toplevel.theory_of state;