src/HOL/Divides.thy
changeset 29404 ee15ccdeaa72
parent 29403 fe17df4e4ab3
child 29405 98ab21b14f09
equal deleted inserted replaced
29403:fe17df4e4ab3 29404:ee15ccdeaa72
   244 proof -
   244 proof -
   245   have "(a mod c * (b mod c)) mod c = (a' mod c * (b' mod c)) mod c"
   245   have "(a mod c * (b mod c)) mod c = (a' mod c * (b' mod c)) mod c"
   246     unfolding assms ..
   246     unfolding assms ..
   247   thus ?thesis
   247   thus ?thesis
   248     by (simp only: mod_mult_eq [symmetric])
   248     by (simp only: mod_mult_eq [symmetric])
       
   249 qed
       
   250 
       
   251 lemma mod_mod_cancel:
       
   252   assumes "c dvd b"
       
   253   shows "a mod b mod c = a mod c"
       
   254 proof -
       
   255   from `c dvd b` obtain k where "b = c * k"
       
   256     by (rule dvdE)
       
   257   have "a mod b mod c = a mod (c * k) mod c"
       
   258     by (simp only: `b = c * k`)
       
   259   also have "\<dots> = (a mod (c * k) + a div (c * k) * k * c) mod c"
       
   260     by (simp only: mod_mult_self1)
       
   261   also have "\<dots> = (a div (c * k) * (c * k) + a mod (c * k)) mod c"
       
   262     by (simp only: add_ac mult_ac)
       
   263   also have "\<dots> = a mod c"
       
   264     by (simp only: mod_div_equality)
       
   265   finally show ?thesis .
   249 qed
   266 qed
   250 
   267 
   251 end
   268 end
   252 
   269 
   253 
   270