src/HOL/Tools/Sledgehammer/sledgehammer_run.ML
changeset 41245 cddc7db22bc9
parent 41242 8edeb1dbbc76
child 41255 a80024d7b71b
equal deleted inserted replaced
41244:7c05c8301d7e 41245:cddc7db22bc9
     9 signature SLEDGEHAMMER_RUN =
     9 signature SLEDGEHAMMER_RUN =
    10 sig
    10 sig
    11   type relevance_override = Sledgehammer_Filter.relevance_override
    11   type relevance_override = Sledgehammer_Filter.relevance_override
    12   type minimize_command = Sledgehammer_ATP_Reconstruct.minimize_command
    12   type minimize_command = Sledgehammer_ATP_Reconstruct.minimize_command
    13   type params = Sledgehammer_Provers.params
    13   type params = Sledgehammer_Provers.params
       
    14 
       
    15   (* for experimentation purposes -- do not use in production code *)
       
    16   val smt_weights : bool Unsynchronized.ref
       
    17   val smt_weight_min_facts : int Unsynchronized.ref
       
    18   val smt_min_weight : int Unsynchronized.ref
       
    19   val smt_max_weight : int Unsynchronized.ref
       
    20   val smt_max_weight_index : int Unsynchronized.ref
       
    21   val smt_weight_curve : (int -> int) Unsynchronized.ref
    14 
    22 
    15   val run_sledgehammer :
    23   val run_sledgehammer :
    16     params -> bool -> int -> relevance_override -> (string -> minimize_command)
    24     params -> bool -> int -> relevance_override -> (string -> minimize_command)
    17     -> Proof.state -> bool * Proof.state
    25     -> Proof.state -> bool * Proof.state
    18 end;
    26 end;
   115       (Async_Manager.launch das_Tool birth_time death_time desc (snd o go);
   123       (Async_Manager.launch das_Tool birth_time death_time desc (snd o go);
   116        (false, state))
   124        (false, state))
   117   end
   125   end
   118 
   126 
   119 val smt_weights = Unsynchronized.ref true
   127 val smt_weights = Unsynchronized.ref true
   120 val smt_weight_min_facts = 20
   128 val smt_weight_min_facts = Unsynchronized.ref 20
   121 
   129 
   122 (* FUDGE *)
   130 (* FUDGE *)
   123 val smt_min_weight = Unsynchronized.ref 0
   131 val smt_min_weight = Unsynchronized.ref 0
   124 val smt_max_weight = Unsynchronized.ref 10
   132 val smt_max_weight = Unsynchronized.ref 10
   125 val smt_max_index = Unsynchronized.ref 200
   133 val smt_max_weight_index = Unsynchronized.ref 200
   126 val smt_weight_curve = Unsynchronized.ref (fn x : int => x * x)
   134 val smt_weight_curve = Unsynchronized.ref (fn x : int => x * x)
   127 
   135 
   128 fun smt_fact_weight j num_facts =
   136 fun smt_fact_weight j num_facts =
   129   if !smt_weights andalso num_facts >= smt_weight_min_facts then
   137   if !smt_weights andalso num_facts >= !smt_weight_min_facts then
   130     SOME (!smt_max_weight
   138     SOME (!smt_max_weight
   131           - (!smt_max_weight - !smt_min_weight + 1)
   139           - (!smt_max_weight - !smt_min_weight + 1)
   132             * !smt_weight_curve (Int.max (0, !smt_max_index - j - 1))
   140             * !smt_weight_curve (Int.max (0, !smt_max_weight_index - j - 1))
   133             div !smt_weight_curve (!smt_max_index))
   141             div !smt_weight_curve (!smt_max_weight_index))
   134   else
   142   else
   135     NONE
   143     NONE
   136 
   144 
   137 fun weight_smt_fact thy num_facts (fact, j) =
   145 fun weight_smt_fact thy num_facts (fact, j) =
   138   fact |> apsnd (pair (smt_fact_weight j num_facts) o Thm.transfer thy)
   146   fact |> apsnd (pair (smt_fact_weight j num_facts) o Thm.transfer thy)