src/HOL/Integ/IntDef.thy
changeset 21404 eb85850d3eb7
parent 21243 afffe1f72143
child 21454 a1937c51ed88
equal deleted inserted replaced
21403:dd58f13a8eb4 21404:eb85850d3eb7
   868 attach (test) {*
   868 attach (test) {*
   869 fun gen_int i = one_of [~1, 1] * random_range 0 i;
   869 fun gen_int i = one_of [~1, 1] * random_range 0 i;
   870 *}
   870 *}
   871 
   871 
   872 definition
   872 definition
   873   int_aux :: "int \<Rightarrow> nat \<Rightarrow> int"
   873   int_aux :: "int \<Rightarrow> nat \<Rightarrow> int" where
   874   "int_aux i n = (i + int n)"
   874   "int_aux i n = (i + int n)"
   875   nat_aux :: "nat \<Rightarrow> int \<Rightarrow> nat"
   875 
       
   876 definition
       
   877   nat_aux :: "nat \<Rightarrow> int \<Rightarrow> nat" where
   876   "nat_aux n i = (n + nat i)"
   878   "nat_aux n i = (n + nat i)"
   877 
   879 
   878 lemma [code]:
   880 lemma [code]:
   879   "int_aux i 0 = i"
   881   "int_aux i 0 = i"
   880   "int_aux i (Suc n) = int_aux (i + 1) n" -- {* tail recursive *}
   882   "int_aux i (Suc n) = int_aux (i + 1) n" -- {* tail recursive *}