src/HOL/IntDiv.thy
changeset 24490 a4c2a0ffa5be
parent 24481 c3a4a289decc
child 24630 351a308ab58d
equal deleted inserted replaced
24489:d4967d2188d6 24490:a4c2a0ffa5be
   932 
   932 
   933 lemma zmod_zmult_zmult2: "(a*c) mod (b*c) = (a mod b) * (c::int)"
   933 lemma zmod_zmult_zmult2: "(a*c) mod (b*c) = (a mod b) * (c::int)"
   934 apply (cut_tac c = c in zmod_zmult_zmult1)
   934 apply (cut_tac c = c in zmod_zmult_zmult1)
   935 apply (auto simp add: mult_commute)
   935 apply (auto simp add: mult_commute)
   936 done
   936 done
       
   937 
       
   938 lemma zmod_zmod_cancel:
       
   939 assumes "n dvd m" shows "(k::int) mod m mod n = k mod n"
       
   940 proof -
       
   941   from `n dvd m` obtain r where "m = n*r" by(auto simp:dvd_def)
       
   942   have "k mod n = (m * (k div m) + k mod m) mod n"
       
   943     using zmod_zdiv_equality[of k m] by simp
       
   944   also have "\<dots> = (m * (k div m) mod n + k mod m mod n) mod n"
       
   945     by(subst zmod_zadd1_eq, rule refl)
       
   946   also have "m * (k div m) mod n = 0" using `m = n*r`
       
   947     by(simp add:mult_ac)
       
   948   finally show ?thesis by simp
       
   949 qed
   937 
   950 
   938 
   951 
   939 subsection {*Splitting Rules for div and mod*}
   952 subsection {*Splitting Rules for div and mod*}
   940 
   953 
   941 text{*The proofs of the two lemmas below are essentially identical*}
   954 text{*The proofs of the two lemmas below are essentially identical*}