src/HOL/Library/Efficient_Nat.thy
changeset 29270 0eade173f77e
parent 29258 bce03c644efb
child 29287 5b0bfd63b5da
equal deleted inserted replaced
29269:5c25a2012975 29270:0eade173f77e
     1 (*  Title:      HOL/Library/Efficient_Nat.thy
     1 (*  Title:      HOL/Library/Efficient_Nat.thy
     2     ID:         $Id$
       
     3     Author:     Stefan Berghofer, Florian Haftmann, TU Muenchen
     2     Author:     Stefan Berghofer, Florian Haftmann, TU Muenchen
     4 *)
     3 *)
     5 
     4 
     6 header {* Implementation of natural numbers by target-language integers *}
     5 header {* Implementation of natural numbers by target-language integers *}
     7 
     6 
   168   end;
   167   end;
   169 
   168 
   170 fun eqn_suc_preproc thy ths =
   169 fun eqn_suc_preproc thy ths =
   171   let
   170   let
   172     val dest = fst o HOLogic.dest_eq o HOLogic.dest_Trueprop o prop_of;
   171     val dest = fst o HOLogic.dest_eq o HOLogic.dest_Trueprop o prop_of;
   173     fun contains_suc t = member (op =) (term_consts t) @{const_name Suc};
   172     fun contains_suc t = member (op =) (OldTerm.term_consts t) @{const_name Suc};
   174   in
   173   in
   175     if forall (can dest) ths andalso
   174     if forall (can dest) ths andalso
   176       exists (contains_suc o dest) ths
   175       exists (contains_suc o dest) ths
   177     then remove_suc thy ths else ths
   176     then remove_suc thy ths else ths
   178   end;
   177   end;
   210 fun clause_suc_preproc thy ths =
   209 fun clause_suc_preproc thy ths =
   211   let
   210   let
   212     val dest = fst o HOLogic.dest_mem o HOLogic.dest_Trueprop
   211     val dest = fst o HOLogic.dest_mem o HOLogic.dest_Trueprop
   213   in
   212   in
   214     if forall (can (dest o concl_of)) ths andalso
   213     if forall (can (dest o concl_of)) ths andalso
   215       exists (fn th => member (op =) (foldr add_term_consts
   214       exists (fn th => member (op =) (foldr OldTerm.add_term_consts
   216         [] (map_filter (try dest) (concl_of th :: prems_of th))) "Suc") ths
   215         [] (map_filter (try dest) (concl_of th :: prems_of th))) "Suc") ths
   217     then remove_suc_clause thy ths else ths
   216     then remove_suc_clause thy ths else ths
   218   end;
   217   end;
   219 
   218 
   220 fun lift f thy eqns1 =
   219 fun lift f thy eqns1 =