src/HOL/Tools/Sledgehammer/sledgehammer_fact_filter.ML
changeset 37568 38968bbcec5a
parent 37567 02e4ccd512b6
child 37574 b8c1f4c46983
equal deleted inserted replaced
37567:02e4ccd512b6 37568:38968bbcec5a
     4 *)
     4 *)
     5 
     5 
     6 signature SLEDGEHAMMER_FACT_FILTER =
     6 signature SLEDGEHAMMER_FACT_FILTER =
     7 sig
     7 sig
     8   type cnf_thm = Sledgehammer_Fact_Preprocessor.cnf_thm
     8   type cnf_thm = Sledgehammer_Fact_Preprocessor.cnf_thm
     9   type classrel_clause = Sledgehammer_FOL_Clause.classrel_clause
       
    10   type arity_clause = Sledgehammer_FOL_Clause.arity_clause
       
    11   type hol_clause = Sledgehammer_HOL_Clause.hol_clause
       
    12 
     9 
    13   type relevance_override =
    10   type relevance_override =
    14     {add: Facts.ref list,
    11     {add: Facts.ref list,
    15      del: Facts.ref list,
    12      del: Facts.ref list,
    16      only: bool}
    13      only: bool}
   267           @{const Trueprop} $ (Const (@{const_name "op ="}, _) $ lhs $ rhs) =>
   264           @{const Trueprop} $ (Const (@{const_name "op ="}, _) $ lhs $ rhs) =>
   268             defs lhs rhs
   265             defs lhs rhs
   269         | _ => false
   266         | _ => false
   270     end;
   267     end;
   271 
   268 
   272 type annotated_clause = cnf_thm * ((string * const_typ list) list)
   269 type annotated_cnf_thm = cnf_thm * ((string * const_typ list) list)
   273 
   270 
   274 (*For a reverse sort, putting the largest values first.*)
   271 (*For a reverse sort, putting the largest values first.*)
   275 fun compare_pairs ((_, w1), (_, w2)) = Real.compare (w2, w1)
   272 fun compare_pairs ((_, w1), (_, w2)) = Real.compare (w2, w1)
   276 
   273 
   277 (*Limit the number of new clauses, to prevent runaway acceptance.*)
   274 (*Limit the number of new clauses, to prevent runaway acceptance.*)
   278 fun take_best max_new (newpairs : (annotated_clause * real) list) =
   275 fun take_best max_new (newpairs : (annotated_cnf_thm * real) list) =
   279   let val nnew = length newpairs
   276   let val nnew = length newpairs
   280   in
   277   in
   281     if nnew <= max_new then (map #1 newpairs, [])
   278     if nnew <= max_new then (map #1 newpairs, [])
   282     else
   279     else
   283       let val cls = sort compare_pairs newpairs
   280       let val cls = sort compare_pairs newpairs