src/HOL/Library/old_recdef.ML
changeset 61038 9c28a4feebd1
parent 60949 ccbf9379e355
child 61125 4c68426800de
equal deleted inserted replaced
61037:0e273cbec33f 61038:9c28a4feebd1
   916 
   916 
   917 fun cconcl thm = Dcterm.drop_prop (Thm.cprop_of thm);
   917 fun cconcl thm = Dcterm.drop_prop (Thm.cprop_of thm);
   918 fun chyps thm = map Dcterm.drop_prop (Thm.chyps_of thm);
   918 fun chyps thm = map Dcterm.drop_prop (Thm.chyps_of thm);
   919 
   919 
   920 fun dest_thm thm =
   920 fun dest_thm thm =
   921   let val {prop,hyps,...} = Thm.rep_thm thm
   921   (map HOLogic.dest_Trueprop (Thm.hyps_of thm), HOLogic.dest_Trueprop (Thm.prop_of thm))
   922   in (map HOLogic.dest_Trueprop hyps, HOLogic.dest_Trueprop prop) end
   922     handle TERM _ => raise RULES_ERR "dest_thm" "missing Trueprop";
   923   handle TERM _ => raise RULES_ERR "dest_thm" "missing Trueprop";
       
   924 
   923 
   925 
   924 
   926 (* Inference rules *)
   925 (* Inference rules *)
   927 
   926 
   928 (*---------------------------------------------------------------------------
   927 (*---------------------------------------------------------------------------
  1222         EXISTS ctxt (ex r2 (subst_free [b]
  1221         EXISTS ctxt (ex r2 (subst_free [b]
  1223                    (HOLogic.dest_Trueprop(Thm.prop_of thm))), Thm.cterm_of ctxt r1)
  1222                    (HOLogic.dest_Trueprop(Thm.prop_of thm))), Thm.cterm_of ctxt r1)
  1224               thm)
  1223               thm)
  1225        blist' th
  1224        blist' th
  1226   end;
  1225   end;
  1227 
       
  1228 (*---------------------------------------------------------------------------
       
  1229  *  Faster version, that fails for some as yet unknown reason
       
  1230  * fun IT_EXISTS blist th =
       
  1231  *    let val {thy,...} = rep_thm th
       
  1232  *        val tych = cterm_of thy
       
  1233  *        fun detype (x,y) = ((#t o rep_cterm) x, (#t o rep_cterm) y)
       
  1234  *   in
       
  1235  *  fold (fn (b as (r1,r2), thm) =>
       
  1236  *  EXISTS(D.mk_exists(r2, tych(subst_free[detype b](#t(rep_cterm(cconcl thm))))),
       
  1237  *           r1) thm)  blist th
       
  1238  *   end;
       
  1239  *---------------------------------------------------------------------------*)
       
  1240 
  1226 
  1241 (*----------------------------------------------------------------------------
  1227 (*----------------------------------------------------------------------------
  1242  *        Rewriting
  1228  *        Rewriting
  1243  *---------------------------------------------------------------------------*)
  1229  *---------------------------------------------------------------------------*)
  1244 
  1230