src/Provers/classical.ML
changeset 60817 3f38ed5a02c1
parent 60757 c09598a97436
child 60942 0af3e522406c
equal deleted inserted replaced
60816:92913f915e3d 60817:3f38ed5a02c1
   145 *)
   145 *)
   146 
   146 
   147 fun classical_rule ctxt rule =
   147 fun classical_rule ctxt rule =
   148   if is_some (Object_Logic.elim_concl ctxt rule) then
   148   if is_some (Object_Logic.elim_concl ctxt rule) then
   149     let
   149     let
       
   150       val thy = Proof_Context.theory_of ctxt;
   150       val rule' = rule RS Data.classical;
   151       val rule' = rule RS Data.classical;
   151       val concl' = Thm.concl_of rule';
   152       val concl' = Thm.concl_of rule';
   152       fun redundant_hyp goal =
   153       fun redundant_hyp goal =
   153         concl' aconv Logic.strip_assums_concl goal orelse
   154         concl' aconv Logic.strip_assums_concl goal orelse
   154           (case Logic.strip_assums_hyp goal of
   155           (case Logic.strip_assums_hyp goal of
   159           if i = 1 orelse redundant_hyp goal
   160           if i = 1 orelse redundant_hyp goal
   160           then eresolve_tac ctxt [thin_rl] i
   161           then eresolve_tac ctxt [thin_rl] i
   161           else all_tac))
   162           else all_tac))
   162         |> Seq.hd
   163         |> Seq.hd
   163         |> Drule.zero_var_indexes;
   164         |> Drule.zero_var_indexes;
   164     in if Thm.equiv_thm (rule, rule'') then rule else rule'' end
   165     in if Thm.equiv_thm thy (rule, rule'') then rule else rule'' end
   165   else rule;
   166   else rule;
   166 
   167 
   167 (*flatten nested meta connectives in prems*)
   168 (*flatten nested meta connectives in prems*)
   168 fun flat_rule ctxt =
   169 fun flat_rule ctxt =
   169   Conv.fconv_rule (Conv.prems_conv ~1 (Object_Logic.atomize_prems ctxt));
   170   Conv.fconv_rule (Conv.prems_conv ~1 (Object_Logic.atomize_prems ctxt));