src/HOL/Tools/Sledgehammer/sledgehammer_mepo.ML
changeset 51004 5f2788c38127
parent 50985 23bb011a5832
child 51026 48e82e199df1
equal deleted inserted replaced
51003:198cb05fb35b 51004:5f2788c38127
     6 *)
     6 *)
     7 
     7 
     8 signature SLEDGEHAMMER_MEPO =
     8 signature SLEDGEHAMMER_MEPO =
     9 sig
     9 sig
    10   type stature = ATP_Problem_Generate.stature
    10   type stature = ATP_Problem_Generate.stature
       
    11   type raw_fact = Sledgehammer_Fact.raw_fact
    11   type fact = Sledgehammer_Fact.fact
    12   type fact = Sledgehammer_Fact.fact
    12   type params = Sledgehammer_Provers.params
    13   type params = Sledgehammer_Provers.params
    13   type relevance_fudge = Sledgehammer_Provers.relevance_fudge
    14   type relevance_fudge = Sledgehammer_Provers.relevance_fudge
    14 
    15 
    15   val trace : bool Config.T
    16   val trace : bool Config.T
    18   val const_names_in_fact :
    19   val const_names_in_fact :
    19     theory -> (string * typ -> term list -> bool * term list) -> term
    20     theory -> (string * typ -> term list -> bool * term list) -> term
    20     -> string list
    21     -> string list
    21   val mepo_suggested_facts :
    22   val mepo_suggested_facts :
    22     Proof.context -> params -> string -> int -> relevance_fudge option
    23     Proof.context -> params -> string -> int -> relevance_fudge option
    23     -> term list -> term -> fact list -> fact list
    24     -> term list -> term -> raw_fact list -> fact list
    24 end;
    25 end;
    25 
    26 
    26 structure Sledgehammer_MePo : SLEDGEHAMMER_MEPO =
    27 structure Sledgehammer_MePo : SLEDGEHAMMER_MEPO =
    27 struct
    28 struct
    28 
    29 
   335         val res = rel_weight / (rel_weight + irrel_weight)
   336         val res = rel_weight / (rel_weight + irrel_weight)
   336       in if Real.isFinite res then res else 0.0 end
   337       in if Real.isFinite res then res else 0.0 end
   337 
   338 
   338 fun take_most_relevant ctxt max_facts remaining_max
   339 fun take_most_relevant ctxt max_facts remaining_max
   339         ({max_imperfect, max_imperfect_exp, ...} : relevance_fudge)
   340         ({max_imperfect, max_imperfect_exp, ...} : relevance_fudge)
   340         (candidates : ((fact * (string * ptype) list) * real) list) =
   341         (candidates : ((raw_fact * (string * ptype) list) * real) list) =
   341   let
   342   let
   342     val max_imperfect =
   343     val max_imperfect =
   343       Real.ceil (Math.pow (max_imperfect,
   344       Real.ceil (Math.pow (max_imperfect,
   344                     Math.pow (Real.fromInt remaining_max
   345                     Math.pow (Real.fromInt remaining_max
   345                               / Real.fromInt max_facts, max_imperfect_exp)))
   346                               / Real.fromInt max_facts, max_imperfect_exp)))
   531        []
   532        []
   532      else
   533      else
   533        relevance_filter ctxt thres0 decay max_facts is_built_in_const fudge
   534        relevance_filter ctxt thres0 decay max_facts is_built_in_const fudge
   534            facts hyp_ts
   535            facts hyp_ts
   535            (concl_t |> theory_constify fudge (Context.theory_name thy)))
   536            (concl_t |> theory_constify fudge (Context.theory_name thy)))
       
   537     |> map fact_of_raw_fact
   536   end
   538   end
   537 
   539 
   538 end;
   540 end;