src/Pure/Tools/find_theorems.ML
changeset 38334 c677c2c1d333
parent 36953 2af1ad9aa1a3
child 38335 630f379f2660
     1.1 --- a/src/Pure/Tools/find_theorems.ML	Wed Aug 11 17:37:04 2010 +0200
     1.2 +++ b/src/Pure/Tools/find_theorems.ML	Wed Aug 11 17:50:29 2010 +0200
     1.3 @@ -455,14 +455,6 @@
     1.4  
     1.5  (** command syntax **)
     1.6  
     1.7 -fun find_theorems_cmd ((opt_lim, rem_dups), spec) =
     1.8 -  Toplevel.unknown_theory o Toplevel.keep (fn state =>
     1.9 -    let
    1.10 -      val proof_state = Toplevel.enter_proof_body state;
    1.11 -      val ctxt = Proof.context_of proof_state;
    1.12 -      val opt_goal = try Proof.simple_goal proof_state |> Option.map #goal;
    1.13 -    in print_theorems ctxt opt_goal opt_lim rem_dups spec end);
    1.14 -
    1.15  local
    1.16  
    1.17  val criterion =
    1.18 @@ -486,7 +478,13 @@
    1.19    Outer_Syntax.improper_command "find_theorems" "print theorems meeting specified criteria"
    1.20      Keyword.diag
    1.21      (options -- Scan.repeat (((Scan.option Parse.minus >> is_none) -- criterion))
    1.22 -      >> (Toplevel.no_timing oo find_theorems_cmd));
    1.23 +      >> (fn ((opt_lim, rem_dups), spec) =>
    1.24 +        Toplevel.no_timing o
    1.25 +        Toplevel.keep (fn state =>
    1.26 +          let
    1.27 +            val ctxt = Toplevel.context_of state;
    1.28 +            val opt_goal = try (Proof.simple_goal o Toplevel.proof_of) state |> Option.map #goal;
    1.29 +          in print_theorems ctxt opt_goal opt_lim rem_dups spec end)));
    1.30  
    1.31  end;
    1.32