src/Tools/auto_tools.ML
changeset 39324 05452dd66b2b
parent 39323 ce5c6a8b0359
child 39330 46c06182b1e3
equal deleted inserted replaced
39323:ce5c6a8b0359 39324:05452dd66b2b
     1 (*  Title:      Tools/auto_counterexample.ML
     1 (*  Title:      Tools/auto_tools.ML
     2     Author:     Jasmin Blanchette, TU Muenchen
     2     Author:     Jasmin Blanchette, TU Muenchen
     3 
     3 
     4 Counterexample Search Unit (do not abbreviate!).
     4 Manager for tools that should be run automatically on newly entered conjectures.
     5 *)
     5 *)
     6 
     6 
     7 signature AUTO_COUNTEREXAMPLE =
     7 signature AUTO_TOOLS =
     8 sig
     8 sig
     9   val time_limit: int Unsynchronized.ref
     9   val time_limit: int Unsynchronized.ref
    10 
    10 
    11   val register_tool :
    11   val register_tool :
    12     string * (Proof.state -> bool * Proof.state) -> theory -> theory
    12     string * (Proof.state -> bool * Proof.state) -> theory -> theory
    13 end;
    13 end;
    14 
    14 
    15 structure Auto_Counterexample : AUTO_COUNTEREXAMPLE =
    15 structure Auto_Tools : AUTO_TOOLS =
    16 struct
    16 struct
    17 
    17 
    18 (* preferences *)
    18 (* preferences *)
    19 
    19 
    20 val time_limit = Unsynchronized.ref 2500
    20 val time_limit = Unsynchronized.ref 2500
    21 
    21 
    22 val _ =
    22 val _ =
    23   ProofGeneralPgip.add_preference Preferences.category_tracing
    23   ProofGeneralPgip.add_preference Preferences.category_tracing
    24     (Preferences.nat_pref time_limit
    24     (Preferences.nat_pref time_limit
    25       "auto-counterexample-time-limit"
    25       "auto-tools-time-limit"
    26       "Time limit for automatic counterexample search (in milliseconds).")
    26       "Time limit for automatic tools (in milliseconds).")
    27 
    27 
    28 
    28 
    29 (* configuration *)
    29 (* configuration *)
    30 
    30 
    31 structure Data = Theory_Data
    31 structure Data = Theory_Data
    51               fold_rev (fn (_, tool) => fn (true, state) => (true, state)
    51               fold_rev (fn (_, tool) => fn (true, state) => (true, state)
    52                                          | (false, state) => tool state)
    52                                          | (false, state) => tool state)
    53                    (Data.get (Proof.theory_of state)) (false, state) |> snd
    53                    (Data.get (Proof.theory_of state)) (false, state) |> snd
    54             else
    54             else
    55               state) ()
    55               state) ()
    56     handle TimeLimit.TimeOut =>
    56     handle TimeLimit.TimeOut => state))
    57            (warning "Automatic counterexample search timed out."; state)))
       
    58 
    57 
    59 end;
    58 end;