src/HOL/Tools/Sledgehammer/sledgehammer_fact.ML
changeset 53513 1082a6fb36c6
parent 53512 b9bc867e49f6
child 53529 1eb7c65b526c
equal deleted inserted replaced
53512:b9bc867e49f6 53513:1082a6fb36c6
   212 fun is_that_fact th =
   212 fun is_that_fact th =
   213   String.isSuffix sep_that (Thm.get_name_hint th)
   213   String.isSuffix sep_that (Thm.get_name_hint th)
   214   andalso exists_subterm (fn Free (s, _) => s = Name.skolem Auto_Bind.thesisN
   214   andalso exists_subterm (fn Free (s, _) => s = Name.skolem Auto_Bind.thesisN
   215                            | _ => false) (prop_of th)
   215                            | _ => false) (prop_of th)
   216 
   216 
       
   217 datatype interest = Deal_Breaker | Interesting | Boring
       
   218 
       
   219 fun combine_interests Deal_Breaker _ = Deal_Breaker
       
   220   | combine_interests _ Deal_Breaker = Deal_Breaker
       
   221   | combine_interests Interesting _ = Interesting
       
   222   | combine_interests _ Interesting = Interesting
       
   223   | combine_interests Boring Boring = Boring
       
   224 
   217 fun is_likely_tautology_too_meta_or_too_technical th =
   225 fun is_likely_tautology_too_meta_or_too_technical th =
   218   let
   226   let
   219     fun is_interesting_subterm (Const (s, _)) =
   227     fun is_interesting_subterm (Const (s, _)) =
   220         not (member (op =) atp_widely_irrelevant_consts s)
   228         not (member (op =) atp_widely_irrelevant_consts s)
   221       | is_interesting_subterm (Free _) = true
   229       | is_interesting_subterm (Free _) = true
   222       | is_interesting_subterm _ = false
   230       | is_interesting_subterm _ = false
   223     fun is_boring_bool t =
   231     fun interest_of_bool t =
   224       not (exists_subterm is_interesting_subterm t) orelse
   232       if exists_Const (is_technical_const orf is_low_level_class_const) t then
   225       exists_type (exists_subtype (curry (op =) @{typ prop})) t
   233         Deal_Breaker
   226     fun is_boring_prop _ (@{const Trueprop} $ t) = is_boring_bool t
   234       else if exists_type (exists_subtype (curry (op =) @{typ prop})) t orelse
   227       | is_boring_prop Ts (@{const "==>"} $ t $ u) =
   235               not (exists_subterm is_interesting_subterm t) then
   228         is_boring_prop Ts t andalso is_boring_prop Ts u
   236         Boring
   229       | is_boring_prop Ts (Const (@{const_name all}, _) $ Abs (_, T, t)) =
   237       else
   230         is_boring_prop (T :: Ts) t
   238         Interesting
   231       | is_boring_prop Ts ((t as Const (@{const_name all}, _)) $ u) =
   239     fun interest_of_prop _ (@{const Trueprop} $ t) = interest_of_bool t
   232         is_boring_prop Ts (t $ eta_expand Ts u 1)
   240       | interest_of_prop Ts (@{const "==>"} $ t $ u) =
   233       | is_boring_prop _ (Const (@{const_name "=="}, _) $ t $ u) =
   241         combine_interests (interest_of_prop Ts t) (interest_of_prop Ts u)
   234         is_boring_bool t andalso is_boring_bool u
   242       | interest_of_prop Ts (Const (@{const_name all}, _) $ Abs (_, T, t)) =
   235       | is_boring_prop _ _ = true
   243         interest_of_prop (T :: Ts) t
       
   244       | interest_of_prop Ts ((t as Const (@{const_name all}, _)) $ u) =
       
   245         interest_of_prop Ts (t $ eta_expand Ts u 1)
       
   246       | interest_of_prop _ (Const (@{const_name "=="}, _) $ t $ u) =
       
   247         combine_interests (interest_of_bool t) (interest_of_bool u)
       
   248       | interest_of_prop _ _ = Deal_Breaker
   236     val t = prop_of th
   249     val t = prop_of th
   237   in
   250   in
   238     (is_boring_prop [] t andalso not (Thm.eq_thm_prop (@{thm ext}, th))) orelse
   251     (interest_of_prop [] t <> Interesting andalso
   239     exists_Const (is_technical_const orf is_low_level_class_const) t orelse
   252      not (Thm.eq_thm_prop (@{thm ext}, th))) orelse
   240     is_that_fact th
   253     is_that_fact th
   241   end
   254   end
   242 
   255 
   243 fun is_blacklisted_or_something ctxt ho_atp =
   256 fun is_blacklisted_or_something ctxt ho_atp =
   244   let
   257   let